Goldspeak Community

Full Version: Kod MultiBlock'a
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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 ]
//////////////////////////////////////////////////
Proszę, opakuj to w
Code:
kod
i rozdziel go na linie,
by był czytelny.