make it possible to differenciate between the lasertables and engines

This commit is contained in:
AEnterprise 2014-09-17 15:41:45 +02:00
parent cdc7ea054b
commit b01533e1d5
5 changed files with 13 additions and 4 deletions

View file

@ -10,9 +10,16 @@ import cpw.mods.fml.common.eventhandler.Event;
public class BlockInteractionEvent extends Event {
public EntityPlayer player;
public Block block;
public int meta;
public BlockInteractionEvent(EntityPlayer player, Block block) {
this.player = player;
this.block = block;
}
public BlockInteractionEvent(EntityPlayer player, Block block, int meta) {
this.player = player;
this.block = block;
this.meta = meta;
}
}

View file

@ -11,9 +11,11 @@ import cpw.mods.fml.common.eventhandler.Event;
public class BlockPlacedDownEvent extends Event {
public EntityPlayer player;
public Block block;
public int meta;
public BlockPlacedDownEvent(EntityPlayer player, Block block) {
public BlockPlacedDownEvent(EntityPlayer player, Block block, int meta) {
this.player = player;
this.block = block;
this.meta = meta;
}
}

View file

@ -44,7 +44,7 @@ public abstract class BlockBuildCraft extends BlockContainer {
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
super.onBlockPlacedBy(world, x, y, z, entity, stack);
FMLCommonHandler.instance().bus().post(new BlockPlacedDownEvent((EntityPlayer) entity, world.getBlock(x, y, z)));
FMLCommonHandler.instance().bus().post(new BlockPlacedDownEvent((EntityPlayer) entity, world.getBlock(x, y, z), world.getBlockMetadata(x, y, z)));
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileBuildCraft) {
((TileBuildCraft) tile).onBlockPlacedBy(entity, stack);

View file

@ -131,7 +131,7 @@ public class BlockEngine extends BlockBuildCraft implements ICustomHighlight {
// return false;
// }
BlockInteractionEvent event = new BlockInteractionEvent(player, this);
BlockInteractionEvent event = new BlockInteractionEvent(player, this, world.getBlockMetadata(i, j, k));
FMLCommonHandler.instance().bus().post(event);
if (event.isCanceled()) {
return false;

View file

@ -65,7 +65,7 @@ public class BlockLaserTable extends BlockBuildCraft {
return false;
}
BlockInteractionEvent event = new BlockInteractionEvent(entityplayer, this);
BlockInteractionEvent event = new BlockInteractionEvent(entityplayer, this, world.getBlockMetadata(i, j, k));
FMLCommonHandler.instance().bus().post(event);
if (event.isCanceled()) {
return false;