diff --git a/core/Registration.java b/core/Registration.java index af09d9e5..e8d31762 100644 --- a/core/Registration.java +++ b/core/Registration.java @@ -539,7 +539,10 @@ public class Registration FMLCommonHandler.instance().bus().register( TickHandler.instance ); MinecraftForge.EVENT_BUS.register( TickHandler.instance ); - MinecraftForge.EVENT_BUS.register( new PartPlacement() ); + + PartPlacement pp = new PartPlacement(); + MinecraftForge.EVENT_BUS.register( pp ); + FMLCommonHandler.instance().bus().register( pp ); IGridCacheRegistry gcr = AEApi.instance().registries().gridCache(); gcr.registerGridCache( ITickManager.class, TickManagerCache.class ); diff --git a/parts/PartPlacement.java b/parts/PartPlacement.java index 6e26f761..bf5d9686 100644 --- a/parts/PartPlacement.java +++ b/parts/PartPlacement.java @@ -37,11 +37,19 @@ import appeng.integration.abstraction.IFMP; import appeng.util.LookDirection; import appeng.util.Platform; import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.TickEvent; public class PartPlacement { private ThreadLocal placing = new ThreadLocal(); + private boolean wasCanceled = false; + + @SubscribeEvent + public void playerInteract(TickEvent.ClientTickEvent event) + { + wasCanceled = false; + } @SubscribeEvent public void playerInteract(PlayerInteractEvent event) @@ -60,7 +68,7 @@ public class PartPlacement { World w = event.entity.worldObj; TileEntity te = w.getTileEntity( mop.blockX, mop.blockY, mop.blockZ ); - if ( te instanceof IPartHost ) + if ( te instanceof IPartHost && wasCanceled ) event.setCanceled( true ); } else if ( event.entityPlayer != null ) @@ -90,7 +98,10 @@ public class PartPlacement ItemStack held = event.entityPlayer.getHeldItem(); if ( place( held, event.x, event.y, event.z, event.face, event.entityPlayer, event.entityPlayer.worldObj, PlaceType.INTERACT_FIRST_PASS, 0 ) ) + { event.setCanceled( true ); + wasCanceled = true; + } placing.set( null ); }