Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Kod MultiBlock'a
#1
Żarówka 
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 ]
//////////////////////////////////////////////////
Reply


Messages In This Thread
Kod MultiBlock'a - by spajkowiecki - 11.02.2015, 11:55
RE: Kod MultiBlock'a - by Wieku - 11.02.2015, 12:01

Forum Jump:


Users browsing this thread: 1 Guest(s)