diff --git a/src/main/java/appeng/util/item/AEItemStack.java b/src/main/java/appeng/util/item/AEItemStack.java index 7a661e069..9aa1a5d6c 100644 --- a/src/main/java/appeng/util/item/AEItemStack.java +++ b/src/main/java/appeng/util/item/AEItemStack.java @@ -279,31 +279,19 @@ public final class AEItemStack extends AEStack implements IAEItemS } @Override - public ItemStack getCachedItemStack( long stackSize ) - { - ItemStack currentCached = null; - if( this.cachedItemStack != null ) - { - currentCached = this.cachedItemStack; + public ItemStack getCachedItemStack( long stackSize ) { + if (this.cachedItemStack != null) { + ItemStack currentCached = this.cachedItemStack; this.cachedItemStack = null; - } + currentCached.setCount(Ints.saturatedCast(stackSize)); + return currentCached; + } - ItemStack itemStack; + ItemStack itemStack = this.createItemStack(); + itemStack.setCount(Ints.saturatedCast(stackSize)); - if( currentCached != null ) - { - // Cache is suitable, just update the count - itemStack = currentCached; - currentCached.setCount( Ints.saturatedCast( stackSize ) ); - } - else - { - // We need a new stack :-( - itemStack = this.createItemStack(); - itemStack.setCount( Ints.saturatedCast( stackSize ) ); - } - return itemStack; - } + return itemStack; + } @Override public void setCachedItemStack( ItemStack itemStack )