3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 20:40:08 +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! // 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; int index = 0;
for (BlockFace currentFace : faces) { 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)); 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) { 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); 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); VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(vehicle, block);

Datei anzeigen

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

Datei anzeigen

@ -952,17 +952,17 @@ public class CraftWorld implements World {
} }
int dir; int dir;
switch (face) { switch (face) {
case EAST: case SOUTH:
default: default:
dir = 0; dir = 0;
break; break;
case NORTH: case WEST:
dir = 1; dir = 1;
break; break;
case WEST: case NORTH:
dir = 2; dir = 2;
break; break;
case SOUTH: case EAST:
dir = 3; dir = 3;
break; 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. * in that order all over. This method is convenience to convert for us.
* *
* @return BlockFace the BlockFace represented by this number * @return BlockFace the BlockFace represented by this number
@ -186,13 +186,13 @@ public class CraftBlock implements Block {
case 1: case 1:
return BlockFace.UP; return BlockFace.UP;
case 2: case 2:
return BlockFace.EAST;
case 3:
return BlockFace.WEST;
case 4:
return BlockFace.NORTH; return BlockFace.NORTH;
case 5: case 3:
return BlockFace.SOUTH; return BlockFace.SOUTH;
case 4:
return BlockFace.WEST;
case 5:
return BlockFace.EAST;
default: default:
return BlockFace.SELF; return BlockFace.SELF;
} }
@ -204,13 +204,13 @@ public class CraftBlock implements Block {
return 0; return 0;
case UP: case UP:
return 1; return 1;
case EAST:
return 2;
case WEST:
return 3;
case NORTH: case NORTH:
return 4; return 2;
case SOUTH: case SOUTH:
return 3;
case WEST:
return 4;
case EAST:
return 5; return 5;
default: default:
return 7; // Good as anything here, but technically invalid 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; 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.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.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.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, y, z + 1, 3)) power = wire.getPower(world, x, y, z + 1, 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 - 1, y, z, 4)) 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 + 1, y, z, 5)) power = wire.getPower(world, x + 1, y, z, 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; 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.y = block.getY();
hanging.z = block.getZ(); hanging.z = block.getZ();
switch (face) { switch (face) {
case EAST: case SOUTH:
default: default:
getHandle().setDirection(0); getHandle().setDirection(0);
break; break;
case NORTH: case WEST:
getHandle().setDirection(1); getHandle().setDirection(1);
break; break;
case WEST: case NORTH:
getHandle().setDirection(2); getHandle().setDirection(2);
break; break;
case SOUTH: case EAST:
getHandle().setDirection(3); getHandle().setDirection(3);
break; break;
} }
@ -57,13 +57,13 @@ public class CraftHanging extends CraftEntity implements Hanging {
switch (this.getHandle().direction) { switch (this.getHandle().direction) {
case 0: case 0:
default: default:
return BlockFace.EAST;
case 1:
return BlockFace.NORTH;
case 2:
return BlockFace.WEST;
case 3:
return BlockFace.SOUTH; return BlockFace.SOUTH;
case 1:
return BlockFace.WEST;
case 2:
return BlockFace.NORTH;
case 3:
return BlockFace.EAST;
} }
} }