From b01533e1d5d03575592e1fa7b6e252682f00ab8d Mon Sep 17 00:00:00 2001 From: AEnterprise Date: Wed, 17 Sep 2014 15:41:45 +0200 Subject: [PATCH] make it possible to differenciate between the lasertables and engines --- api/buildcraft/api/events/BlockInteractionEvent.java | 7 +++++++ api/buildcraft/api/events/BlockPlacedDownEvent.java | 4 +++- common/buildcraft/core/BlockBuildCraft.java | 2 +- common/buildcraft/energy/BlockEngine.java | 2 +- common/buildcraft/silicon/BlockLaserTable.java | 2 +- 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/api/buildcraft/api/events/BlockInteractionEvent.java b/api/buildcraft/api/events/BlockInteractionEvent.java index 0c1f938c..88fcac02 100644 --- a/api/buildcraft/api/events/BlockInteractionEvent.java +++ b/api/buildcraft/api/events/BlockInteractionEvent.java @@ -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; + } } diff --git a/api/buildcraft/api/events/BlockPlacedDownEvent.java b/api/buildcraft/api/events/BlockPlacedDownEvent.java index d63932f5..cc5f2d9a 100644 --- a/api/buildcraft/api/events/BlockPlacedDownEvent.java +++ b/api/buildcraft/api/events/BlockPlacedDownEvent.java @@ -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; } } diff --git a/common/buildcraft/core/BlockBuildCraft.java b/common/buildcraft/core/BlockBuildCraft.java index 6b0de599..399ef74a 100644 --- a/common/buildcraft/core/BlockBuildCraft.java +++ b/common/buildcraft/core/BlockBuildCraft.java @@ -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); diff --git a/common/buildcraft/energy/BlockEngine.java b/common/buildcraft/energy/BlockEngine.java index 90e8c697..5553198b 100644 --- a/common/buildcraft/energy/BlockEngine.java +++ b/common/buildcraft/energy/BlockEngine.java @@ -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; diff --git a/common/buildcraft/silicon/BlockLaserTable.java b/common/buildcraft/silicon/BlockLaserTable.java index 3d733d50..cc074d85 100644 --- a/common/buildcraft/silicon/BlockLaserTable.java +++ b/common/buildcraft/silicon/BlockLaserTable.java @@ -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;