3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 12:30:06 +01:00

[BREAKING] Update BlockFace directions. Fixes BUKKIT-1567, BUKKIT-3069

The answer is 42
Dieser Commit ist enthalten in:
feildmaster 2012-12-01 00:22:01 -06:00
Ursprung 3404318bc5
Commit c596093c31
6 geänderte Dateien mit 37 neuen und 37 gelöschten Zeilen

Datei anzeigen

@ -134,7 +134,7 @@ public class BlockFlowing extends BlockFluids {
}
// CraftBukkit start - all four cardinal directions. Do not change the order!
BlockFace[] faces = new BlockFace[] { BlockFace.NORTH, BlockFace.SOUTH, BlockFace.EAST, BlockFace.WEST };
BlockFace[] faces = new BlockFace[] { BlockFace.WEST, BlockFace.EAST, BlockFace.SOUTH, BlockFace.NORTH };
int index = 0;
for (BlockFace currentFace : faces) {

Datei anzeigen

@ -634,13 +634,13 @@ public abstract class Entity {
org.bukkit.block.Block block = this.world.getWorld().getBlockAt(MathHelper.floor(this.locX), MathHelper.floor(this.locY - (double) this.height), MathHelper.floor(this.locZ));
if (d6 > d0) {
block = block.getRelative(BlockFace.SOUTH);
} else if (d6 < d0) {
block = block.getRelative(BlockFace.NORTH);
} else if (d8 > d2) {
block = block.getRelative(BlockFace.WEST);
} else if (d8 < d2) {
block = block.getRelative(BlockFace.EAST);
} else if (d6 < d0) {
block = block.getRelative(BlockFace.WEST);
} else if (d8 > d2) {
block = block.getRelative(BlockFace.NORTH);
} else if (d8 < d2) {
block = block.getRelative(BlockFace.SOUTH);
}
VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(vehicle, block);

Datei anzeigen

@ -18,7 +18,7 @@ public class CraftEffect {
datavalue = ((Material) data).getId();
break;
case SMOKE:
switch((BlockFace)data) {
switch((BlockFace) data) { // TODO: Verify (Where did these values come from...?)
case SOUTH_EAST:
datavalue = 0;
break;

Datei anzeigen

@ -952,17 +952,17 @@ public class CraftWorld implements World {
}
int dir;
switch (face) {
case EAST:
case SOUTH:
default:
dir = 0;
break;
case NORTH:
case WEST:
dir = 1;
break;
case WEST:
case NORTH:
dir = 2;
break;
case SOUTH:
case EAST:
dir = 3;
break;
}

Datei anzeigen

@ -174,7 +174,7 @@ public class CraftBlock implements Block {
}
/**
* Notch uses a 0-5 to mean DOWN, UP, EAST, WEST, NORTH, SOUTH
* Notch uses a 0-5 to mean DOWN, UP, NORTH, SOUTH, WEST, EAST
* in that order all over. This method is convenience to convert for us.
*
* @return BlockFace the BlockFace represented by this number
@ -186,13 +186,13 @@ public class CraftBlock implements Block {
case 1:
return BlockFace.UP;
case 2:
return BlockFace.EAST;
case 3:
return BlockFace.WEST;
case 4:
return BlockFace.NORTH;
case 5:
case 3:
return BlockFace.SOUTH;
case 4:
return BlockFace.WEST;
case 5:
return BlockFace.EAST;
default:
return BlockFace.SELF;
}
@ -204,13 +204,13 @@ public class CraftBlock implements Block {
return 0;
case UP:
return 1;
case EAST:
return 2;
case WEST:
return 3;
case NORTH:
return 4;
return 2;
case SOUTH:
return 3;
case WEST:
return 4;
case EAST:
return 5;
default:
return 7; // Good as anything here, but technically invalid
@ -312,10 +312,10 @@ public class CraftBlock implements Block {
net.minecraft.server.World world = chunk.getHandle().world;
if ((face == BlockFace.DOWN || face == BlockFace.SELF) && world.isBlockFacePowered(x, y - 1, z, 0)) power = wire.getPower(world, x, y - 1, z, power);
if ((face == BlockFace.UP || face == BlockFace.SELF) && world.isBlockFacePowered(x, y + 1, z, 1)) power = wire.getPower(world, x, y + 1, z, power);
if ((face == BlockFace.EAST || face == BlockFace.SELF) && world.isBlockFacePowered(x, y, z - 1, 2)) power = wire.getPower(world, x, y, z - 1, power);
if ((face == BlockFace.WEST || face == BlockFace.SELF) && world.isBlockFacePowered(x, y, z + 1, 3)) power = wire.getPower(world, x, y, z + 1, power);
if ((face == BlockFace.NORTH || face == BlockFace.SELF) && world.isBlockFacePowered(x - 1, y, z, 4)) power = wire.getPower(world, x - 1, y, z, power);
if ((face == BlockFace.SOUTH || face == BlockFace.SELF) && world.isBlockFacePowered(x + 1, y, z, 5)) power = wire.getPower(world, x + 1, y, z, power);
if ((face == BlockFace.EAST || face == BlockFace.SELF) && world.isBlockFacePowered(x + 1, y, z, 2)) power = wire.getPower(world, x + 1, y, z, power);
if ((face == BlockFace.WEST || face == BlockFace.SELF) && world.isBlockFacePowered(x - 1, y, z, 3)) power = wire.getPower(world, x - 1, y, z, power);
if ((face == BlockFace.NORTH || face == BlockFace.SELF) && world.isBlockFacePowered(x, y, z - 1, 4)) power = wire.getPower(world, x, y, z - 1, power);
if ((face == BlockFace.SOUTH || face == BlockFace.SELF) && world.isBlockFacePowered(x, y, z + 1, 5)) power = wire.getPower(world, x, y, z - 1, power);
return power > 0 ? power : (face == BlockFace.SELF ? isBlockIndirectlyPowered() : isBlockFaceIndirectlyPowered(face)) ? 15 : 0;
}

Datei anzeigen

@ -28,17 +28,17 @@ public class CraftHanging extends CraftEntity implements Hanging {
hanging.y = block.getY();
hanging.z = block.getZ();
switch (face) {
case EAST:
case SOUTH:
default:
getHandle().setDirection(0);
break;
case NORTH:
case WEST:
getHandle().setDirection(1);
break;
case WEST:
case NORTH:
getHandle().setDirection(2);
break;
case SOUTH:
case EAST:
getHandle().setDirection(3);
break;
}
@ -57,13 +57,13 @@ public class CraftHanging extends CraftEntity implements Hanging {
switch (this.getHandle().direction) {
case 0:
default:
return BlockFace.EAST;
case 1:
return BlockFace.NORTH;
case 2:
return BlockFace.WEST;
case 3:
return BlockFace.SOUTH;
case 1:
return BlockFace.WEST;
case 2:
return BlockFace.NORTH;
case 3:
return BlockFace.EAST;
}
}