From 53b75e3ea44fc6187756abe5506e53cbcd4d9396 Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Sun, 6 Nov 2016 23:36:24 -0600 Subject: [PATCH] Don't Copy Nulls ( #164 ) --- .../chiseledblock/TileEntityBlockChiseled.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/mod/chiselsandbits/chiseledblock/TileEntityBlockChiseled.java b/src/main/java/mod/chiselsandbits/chiseledblock/TileEntityBlockChiseled.java index 3e49e193..93d5f9a7 100644 --- a/src/main/java/mod/chiselsandbits/chiseledblock/TileEntityBlockChiseled.java +++ b/src/main/java/mod/chiselsandbits/chiseledblock/TileEntityBlockChiseled.java @@ -660,6 +660,11 @@ public ItemStackGeneratedCache( final ItemStack out; final VoxelBlobStateReference ref; final int rotations; + + public ItemStack getItemStack() + { + return out == null ? null : out.copy(); + } }; /** @@ -680,7 +685,7 @@ public ItemStack getItemStack( if ( cache != null && cache.rotations == rotations && cache.ref == getBlobStateReference() && cache.out != null ) { - return cache.out.copy(); + return cache.getItemStack(); } VoxelBlob vb = getBlob(); @@ -703,7 +708,7 @@ public ItemStack getItemStack( { if ( cache != null && cache.rotations == 0 && cache.ref == getBlobStateReference() ) { - return cache.out.copy(); + return cache.getItemStack(); } final BitAccess ba = new BitAccess( null, null, getBlob(), VoxelBlob.NULL_BLOB );