changed onBlockPlaced to updateBlockMetadata

This commit is contained in:
Krapht 2012-08-11 22:35:55 +02:00
parent 47dcb242f9
commit d4397d4894
4 changed files with 27 additions and 25 deletions

View file

@ -163,28 +163,28 @@ public class BlockMarker extends BlockContainer {
}
@Override
public void onBlockPlaced(World world, int i, int j, int k, int l) {
super.onBlockPlaced(world, i, j, k, l);
int i1 = world.getBlockMetadata(i, j, k);
if (l == 1 && BuildersProxy.canPlaceTorch(world, i, j - 1, k)) {
public void updateBlockMetadata(World world, int x, int y, int z, int par5, float par6, float par7, float par8) {
super.updateBlockMetadata(world, x, y, z, par5, par6, par7, par8);
int i1 = world.getBlockMetadata(x, y, z);
if (par5 == 1 && BuildersProxy.canPlaceTorch(world, x, y - 1, z)) {
i1 = 5;
}
if (l == 2 && BuildersProxy.canPlaceTorch(world, i, j, k + 1)) {
if (par5 == 2 && BuildersProxy.canPlaceTorch(world, x, y, z + 1)) {
i1 = 4;
}
if (l == 3 && BuildersProxy.canPlaceTorch(world, i, j, k - 1)) {
if (par5 == 3 && BuildersProxy.canPlaceTorch(world, x, y, z - 1)) {
i1 = 3;
}
if (l == 4 && BuildersProxy.canPlaceTorch(world, i + 1, j, k)) {
if (par5 == 4 && BuildersProxy.canPlaceTorch(world, x + 1, y, z)) {
i1 = 2;
}
if (l == 5 && BuildersProxy.canPlaceTorch(world, i - 1, j, k)) {
if (par5 == 5 && BuildersProxy.canPlaceTorch(world, x - 1, y, z)) {
i1 = 1;
}
if (l == 0 && BuildersProxy.canPlaceTorch(world, i, j + 1, k)) {
if (par5 == 0 && BuildersProxy.canPlaceTorch(world, x, y + 1, z)) {
i1 = 0;
}
world.setBlockMetadataWithNotify(i, j, k, i1);
world.setBlockMetadataWithNotify(x, y, z, i1);
}
@Override

View file

@ -107,8 +107,8 @@ public class BlockEngine extends BlockContainer {
}
@Override
public void onBlockPlaced(World world, int i, int j, int k, int l) {
TileEngine tile = (TileEngine) world.getBlockTileEntity(i, j, k);
public void updateBlockMetadata(World world, int x, int y, int z, int par5, float par6, float par7, float par8) {
TileEngine tile = (TileEngine) world.getBlockTileEntity(x, y, z);
tile.orientation = Orientations.YPos.ordinal();
tile.switchOrientation();
}

View file

@ -70,14 +70,15 @@ public class BlockLaser extends BlockContainer {
}
@Override
public void onBlockPlaced(World world, int i, int j, int k, int l) {
super.onBlockPlaced(world, i, j, k, l);
int i1 = world.getBlockMetadata(i, j, k);
if (l <= 6) {
i1 = l;
public void updateBlockMetadata(World world, int x, int y, int z, int par5, float par6, float par7, float par8) {
super.updateBlockMetadata(world, x, y, z, par5, par6, par7, par8);
int i1 = world.getBlockMetadata(x, y, z);
if (par5 <= 6) {
i1 = par5;
}
world.setBlockMetadataWithNotify(i, j, k, i1);
world.setBlockMetadataWithNotify(x, y, z, i1);
}
@SuppressWarnings({ "unchecked", "rawtypes" })

View file

@ -258,14 +258,15 @@ public class BlockGenericPipe extends BlockContainer {
pipe.container.scheduleNeighborChange();
}
@Override
public void onBlockPlaced(World world, int i, int j, int k, int l) {
super.onBlockPlaced(world, i, j, k, l);
Pipe pipe = getPipe(world, i, j, k);
@Override
public void updateBlockMetadata(World world, int x, int y, int z, int par5, float par6, float par7, float par8) {
super.updateBlockMetadata(world, x, y, z, par5, par6, par7, par8);
Pipe pipe = getPipe(world, x, y, z);
if (isValid(pipe))
pipe.onBlockPlaced();
}
@Override