From 48c253d3ed92aebec32061f6e45934ffa7413bed Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Sat, 11 Apr 2015 22:26:27 -0400 Subject: [PATCH] Fix unnecessary object creation in TileEntityEio#getLocation --- src/main/java/crazypants/enderio/TileEntityEio.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/crazypants/enderio/TileEntityEio.java b/src/main/java/crazypants/enderio/TileEntityEio.java index 922d0d04..6bd4f464 100644 --- a/src/main/java/crazypants/enderio/TileEntityEio.java +++ b/src/main/java/crazypants/enderio/TileEntityEio.java @@ -56,8 +56,10 @@ public abstract class TileEntityEio extends TileEntity { public void init() { } + private BlockCoord cachedLocation = null; + public BlockCoord getLocation() { - return new BlockCoord(this); + return cachedLocation == null || !cachedLocation.equals(xCoord, yCoord, zCoord) ? (cachedLocation = new BlockCoord(this)) : cachedLocation; } /**