make it possible to differenciate between the lasertables and engines
This commit is contained in:
parent
cdc7ea054b
commit
b01533e1d5
5 changed files with 13 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue