diff --git a/src/main/java/me/planetguy/remaininmotion/core/interop/EventPool.java b/src/main/java/me/planetguy/remaininmotion/core/interop/EventPool.java index 6b4989f..d00bdd9 100644 --- a/src/main/java/me/planetguy/remaininmotion/core/interop/EventPool.java +++ b/src/main/java/me/planetguy/remaininmotion/core/interop/EventPool.java @@ -6,7 +6,6 @@ import cpw.mods.fml.common.eventhandler.Event; import cpw.mods.fml.common.eventhandler.EventPriority; -import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; @@ -19,8 +18,6 @@ import me.planetguy.remaininmotion.api.event.CancelableOnBlockAddedEvent; import me.planetguy.remaininmotion.api.event.IBlockPos; import me.planetguy.remaininmotion.api.event.MotionFinalizeEvent; -import me.planetguy.remaininmotion.api.event.PostRenderDuringMovementEvent; -import me.planetguy.remaininmotion.api.event.PreRenderDuringMovementEvent; import me.planetguy.remaininmotion.api.event.RotatingTEPreUnpackEvent; import me.planetguy.remaininmotion.api.event.TEPostPlaceEvent; import me.planetguy.remaininmotion.api.event.TEPrePlaceEvent; @@ -33,8 +30,6 @@ public class EventPool { private static BlockPreMoveEvent theBlockPreMoveEvent=new BlockPreMoveEvent(); private static BlockSelectForMoveEvent theBlockSelectForMoveEvent=new BlockSelectForMoveEvent(); private static BlockSelectForRotateEvent theBlockSelectForRotateEvent=new BlockSelectForRotateEvent(); - private static PreRenderDuringMovementEvent thePreRenderDuringMovementEvent=new PreRenderDuringMovementEvent(); - private static PostRenderDuringMovementEvent thePostRenderDuringMovementEvent=new PostRenderDuringMovementEvent(); private static CancelableOnBlockAddedEvent theCancelableOnBlockAddedEvent=new CancelableOnBlockAddedEvent(); private static MotionFinalizeEvent theMotionFinalizeEvent=new MotionFinalizeEvent(); private static BlocksReplacedEvent theBlocksReplacedEvent=new BlocksReplacedEvent(); @@ -89,27 +84,6 @@ public static String postBlockSelectForMoveEvent(CarriagePackage poster, boolean } } - public static boolean postPreRenderDuringMovementEvent(RenderBlocks blockRenderer, int x, int y, int z, TileEntity entity, int pass) { - thePreRenderDuringMovementEvent.renderBlocks=blockRenderer; - thePreRenderDuringMovementEvent.x=x; - thePreRenderDuringMovementEvent.y=y; - thePreRenderDuringMovementEvent.z=z; - thePreRenderDuringMovementEvent.tile=entity; - thePreRenderDuringMovementEvent.pass=pass; - postEvent(thePreRenderDuringMovementEvent); - return thePreRenderDuringMovementEvent.isCanceled(); - } - - public static void postPostRenderDuringMovementEvent(RenderBlocks blockRenderer, int x, int y, int z, TileEntity entity, int pass) { - thePostRenderDuringMovementEvent.renderBlocks=blockRenderer; - thePostRenderDuringMovementEvent.x=x; - thePostRenderDuringMovementEvent.y=y; - thePostRenderDuringMovementEvent.z=z; - thePostRenderDuringMovementEvent.tile=entity; - thePostRenderDuringMovementEvent.pass=pass; - postEvent(thePostRenderDuringMovementEvent); - } - public static boolean postCancelableOnBlockAddedEvent(World worldObj, int x, int y, int z) { theCancelableOnBlockAddedEvent.worldObj=worldObj; theCancelableOnBlockAddedEvent.xCoord=x; @@ -160,7 +134,7 @@ public static void postBlockRotateEvent(BlockRecord record, ForgeDirection forge postEvent(theBlockRotateEvent); } - private static void postEvent(Event e) { + static void postEvent(Event e) { try { eventPhase.set(e, null); } catch (IllegalArgumentException e1) { diff --git a/src/main/java/me/planetguy/remaininmotion/core/interop/EventPoolClient.java b/src/main/java/me/planetguy/remaininmotion/core/interop/EventPoolClient.java new file mode 100644 index 0000000..2c7e8de --- /dev/null +++ b/src/main/java/me/planetguy/remaininmotion/core/interop/EventPoolClient.java @@ -0,0 +1,34 @@ +package me.planetguy.remaininmotion.core.interop; + +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.tileentity.TileEntity; +import me.planetguy.remaininmotion.api.event.PostRenderDuringMovementEvent; +import me.planetguy.remaininmotion.api.event.PreRenderDuringMovementEvent; + +public class EventPoolClient { + + private static PreRenderDuringMovementEvent thePreRenderDuringMovementEvent=new PreRenderDuringMovementEvent(); + private static PostRenderDuringMovementEvent thePostRenderDuringMovementEvent=new PostRenderDuringMovementEvent(); + + public static boolean postPreRenderDuringMovementEvent(RenderBlocks blockRenderer, int x, int y, int z, TileEntity entity, int pass) { + thePreRenderDuringMovementEvent.renderBlocks=blockRenderer; + thePreRenderDuringMovementEvent.x=x; + thePreRenderDuringMovementEvent.y=y; + thePreRenderDuringMovementEvent.z=z; + thePreRenderDuringMovementEvent.tile=entity; + thePreRenderDuringMovementEvent.pass=pass; + EventPool.postEvent(thePreRenderDuringMovementEvent); + return thePreRenderDuringMovementEvent.isCanceled(); + } + + public static void postPostRenderDuringMovementEvent(RenderBlocks blockRenderer, int x, int y, int z, TileEntity entity, int pass) { + thePostRenderDuringMovementEvent.renderBlocks=blockRenderer; + thePostRenderDuringMovementEvent.x=x; + thePostRenderDuringMovementEvent.y=y; + thePostRenderDuringMovementEvent.z=z; + thePostRenderDuringMovementEvent.tile=entity; + thePostRenderDuringMovementEvent.pass=pass; + EventPool.postEvent(thePostRenderDuringMovementEvent); + } + +} diff --git a/src/main/java/me/planetguy/remaininmotion/render/CarriageRenderCache.java b/src/main/java/me/planetguy/remaininmotion/render/CarriageRenderCache.java index 5fa43d4..31440ef 100644 --- a/src/main/java/me/planetguy/remaininmotion/render/CarriageRenderCache.java +++ b/src/main/java/me/planetguy/remaininmotion/render/CarriageRenderCache.java @@ -7,7 +7,7 @@ import me.planetguy.remaininmotion.api.RiMRegistry; import me.planetguy.remaininmotion.api.event.PostRenderDuringMovementEvent; import me.planetguy.remaininmotion.api.event.PreRenderDuringMovementEvent; -import me.planetguy.remaininmotion.core.interop.EventPool; +import me.planetguy.remaininmotion.core.interop.EventPoolClient; import me.planetguy.remaininmotion.util.position.BlockPosition; import me.planetguy.remaininmotion.util.position.BlockRecord; import me.planetguy.remaininmotion.util.position.BlockRecordSet; @@ -62,9 +62,9 @@ public static void Render(RenderBlocks blockRenderer, BlockRecordSet Blocks, Blo } try { - if(!EventPool.postPreRenderDuringMovementEvent(blockRenderer, Record.X, Record.Y, Record.Z, Record.entity, Pass)) + if(!EventPoolClient.postPreRenderDuringMovementEvent(blockRenderer, Record.X, Record.Y, Record.Z, Record.entity, Pass)) blockRenderer.renderBlockByRenderType(Record.block, Record.X, Record.Y, Record.Z); - EventPool.postPostRenderDuringMovementEvent(blockRenderer, Record.X, Record.Y, Record.Z, Record.entity, Pass); + EventPoolClient.postPostRenderDuringMovementEvent(blockRenderer, Record.X, Record.Y, Record.Z, Record.entity, Pass); } catch (Throwable Throwable) { Throwable.printStackTrace(); }