Goldspeak Community
Kod MultiBlock'a - Printable Version

+- Goldspeak Community (https://forum.goldspeak.pl)
+-- Forum: Starchasers (https://forum.goldspeak.pl/forumdisplay.php?fid=12)
+--- Forum: Programujemy (https://forum.goldspeak.pl/forumdisplay.php?fid=3)
+---- Forum: Java (https://forum.goldspeak.pl/forumdisplay.php?fid=4)
+----- Forum: Nasze programy (https://forum.goldspeak.pl/forumdisplay.php?fid=39)
+----- Thread: Kod MultiBlock'a (/showthread.php?tid=41)



Kod MultiBlock'a - spajkowiecki - 11.02.2015

Cześć tu zamieszczam kod multiblock'a ktory mozna dowolnie edytować:

Jest to kod na multiblock 2 szerokosci, 2 dlugosci, 2 wysokosci


/// MULTIBLOCK 2x2x2 ///                            ///ID BLOCKU = 1       /// stone  ///ID PIEC = 157 ///

[shcode=java]
public boolean isMultiBlockStructure(World world, int x, int y, int z){
if (checkNorth(world, x, y, z))/*North*/ return true;
if (checkEast(world, x, y, z))/*East*/ return true;
if (checkSouth(world, x, y, z))/*South*/ return true;
if (checkWest(world, x, y, z))/*West*/ return true;
return false;
}

private static boolean checkNorth(World world, int x, int y, int z){
if(world.getBlockId(x+0, y+0, z+-1) == 1){
if(world.getBlockId(x+0, y+1, z+0) == 157){
if(world.getBlockId(x+0, y+1, z+-1) == 157){
if(world.getBlockId(x+1, y+0, z+0) == 1){
if(world.getBlockId(x+1, y+0, z+-1) == 1){
if(world.getBlockId(x+1, y+1, z+0) == 157){
if(world.getBlockId(x+1, y+1, z+-1) == 157){
return true;
}
}
}
}
}
}
}

return false;
}

private static boolean checkEast(World world, int x, int y, int z){
if(world.getBlockId(x+1, y+0, z+0) == 1){
if(world.getBlockId(x+0, y+1, z+0) == 157){
if(world.getBlockId(x+1, y+1, z+0) == 157){
if(world.getBlockId(x+0, y+0, z+1) == 1){
if(world.getBlockId(x+1, y+0, z+1) == 1){
if(world.getBlockId(x+0, y+1, z+1) == 157){
if(world.getBlockId(x+1, y+1, z+1) == 157){
return true;
}
}
}
}
}
}
}

return false;
}

private static boolean checkSouth(World world, int x, int y, int z){
if(world.getBlockId(x+0, y+0, z+1) == 1){
if(world.getBlockId(x+0, y+1, z+0) == 157){
if(world.getBlockId(x+0, y+1, z+1) == 157){
if(world.getBlockId(x+-1, y+0, z+0) == 1){
if(world.getBlockId(x+-1, y+0, z+1) == 1){
if(world.getBlockId(x+-1, y+1, z+0) == 157){
if(world.getBlockId(x+-1, y+1, z+1) == 157){
return true;
}
}
}
}
}
}
}

return false;
}

private static boolean checkWest(World world, int x, int y, int z){
if(world.getBlockId(x+-1, y+0, z+0) == 1){
if(world.getBlockId(x+0, y+1, z+0) == 157){
if(world.getBlockId(x+-1, y+1, z+0) == 157){
if(world.getBlockId(x+0, y+0, z+-1) == 1){
if(world.getBlockId(x+-1, y+0, z+-1) == 1){
if(world.getBlockId(x+0, y+1, z+-1) == 157){
if(world.getBlockId(x+-1, y+1, z+-1) == 157){
return true;
}
}
}
}
}
}
}

return false;
}
[/shcode]



Budowla musi byc zbudowana w ten sposób:|
[157] [157]
[  1 ] [  1 ]
//////////////////////////////////////////////////


RE: Kod MultiBlock'a - Wieku - 11.02.2015

Proszę, opakuj to w
Code:
kod
i rozdziel go na linie,
by był czytelny.