diff --git a/src/api/java/appeng/api/storage/data/IAEStack.java b/src/api/java/appeng/api/storage/data/IAEStack.java index adc877cf..2e1ca2a7 100644 --- a/src/api/java/appeng/api/storage/data/IAEStack.java +++ b/src/api/java/appeng/api/storage/data/IAEStack.java @@ -203,4 +203,15 @@ public interface IAEStack * @return ITEM or FLUID */ StorageChannel getChannel(); + + /** + * @return true if it should show the crafting label. + */ + boolean getShowCraftingLabel(); + + /** + * Used internally to show that it should show a Crafting label instead of a "1" + */ + void setShowCraftingLabel( boolean showCraftingLabel ); + } diff --git a/src/main/java/appeng/client/gui/AEBaseGui.java b/src/main/java/appeng/client/gui/AEBaseGui.java index b14909eb..7f4ec823 100644 --- a/src/main/java/appeng/client/gui/AEBaseGui.java +++ b/src/main/java/appeng/client/gui/AEBaseGui.java @@ -453,7 +453,7 @@ public abstract class AEBaseGui extends GuiContainer action = ( mouseButton == 1 ) ? InventoryAction.SPLIT_OR_PLACE_SINGLE : InventoryAction.PICKUP_OR_SET_DOWN; stack = ( (SlotME) slot ).getAEStack(); - if( stack != null && action == InventoryAction.PICKUP_OR_SET_DOWN && stack.getStackSize() == 0 && player.inventory.getItemStack() == null ) + if( stack != null && action == InventoryAction.PICKUP_OR_SET_DOWN && stack.getShowCraftingLabel()) { action = InventoryAction.AUTO_CRAFT; } diff --git a/src/main/java/appeng/client/render/StackSizeRenderer.java b/src/main/java/appeng/client/render/StackSizeRenderer.java index 0176d17f..8e5e058a 100644 --- a/src/main/java/appeng/client/render/StackSizeRenderer.java +++ b/src/main/java/appeng/client/render/StackSizeRenderer.java @@ -53,7 +53,7 @@ public class StackSizeRenderer final boolean unicodeFlag = fontRenderer.getUnicodeFlag(); fontRenderer.setUnicodeFlag( false ); - if( is.getCount() == 0 ) + if( aeStack.getShowCraftingLabel() ) { final String craftLabelText = AEConfig.instance().useTerminalUseLargeFont() ? GuiText.LargeFontCraft.getLocal() : GuiText.SmallFontCraft.getLocal(); GlStateManager.disableLighting(); @@ -71,7 +71,7 @@ public class StackSizeRenderer } final long amount = aeStack != null ? aeStack.getStackSize() : is.getCount(); - if( amount != 0 ) + if( amount != 0 && !aeStack.getShowCraftingLabel() ) { final String stackSize = this.getToBeRenderedStackSize( amount ); diff --git a/src/main/java/appeng/util/item/AEFluidStack.java b/src/main/java/appeng/util/item/AEFluidStack.java index 89106f5b..31beebc2 100644 --- a/src/main/java/appeng/util/item/AEFluidStack.java +++ b/src/main/java/appeng/util/item/AEFluidStack.java @@ -60,6 +60,7 @@ public final class AEFluidStack extends AEStack implements IAEFlu // priority = is.priority; this.setCraftable( is.isCraftable() ); this.setCountRequestable( is.getCountRequestable() ); + this.setShowCraftingLabel( is.getShowCraftingLabel() ); this.myHash = is.myHash; } @@ -120,6 +121,7 @@ public final class AEFluidStack extends AEStack implements IAEFlu final byte countReqType = (byte) ( ( mask & 0x30 ) >> 4 ); final boolean isCraftable = ( mask & 0x40 ) > 0; final boolean hasTagCompound = ( mask & 0x80 ) > 0; + boolean showCraftingLabel = data.readBoolean(); // don't send this... final NBTTagCompound d = new NBTTagCompound(); @@ -147,6 +149,11 @@ public final class AEFluidStack extends AEStack implements IAEFlu final long countRequestable = getPacketValue( countReqType, data ); final FluidStack fluidStack = FluidStack.loadFluidStackFromNBT( d ); + + if (!showCraftingLabel) { + showCraftingLabel = stackSize == 0; + } + if( fluidStack == null ) { return null; @@ -155,6 +162,7 @@ public final class AEFluidStack extends AEStack implements IAEFlu final AEFluidStack fluid = AEFluidStack.create( fluidStack ); // fluid.priority = (int) priority; fluid.setStackSize( stackSize ); + fluid.setShowCraftingLabel( showCraftingLabel ); fluid.setCountRequestable( countRequestable ); fluid.setCraftable( isCraftable ); return fluid; @@ -174,6 +182,7 @@ public final class AEFluidStack extends AEStack implements IAEFlu this.incStackSize( option.getStackSize() ); this.setCountRequestable( this.getCountRequestable() + option.getCountRequestable() ); this.setCraftable( this.isCraftable() || option.isCraftable() ); + this.setShowCraftingLabel( this.getShowCraftingLabel() || option.getShowCraftingLabel() ); } @Override diff --git a/src/main/java/appeng/util/item/AEItemStack.java b/src/main/java/appeng/util/item/AEItemStack.java index f8cd2600..15358252 100644 --- a/src/main/java/appeng/util/item/AEItemStack.java +++ b/src/main/java/appeng/util/item/AEItemStack.java @@ -57,6 +57,7 @@ public final class AEItemStack extends AEStack implements IAEItemS this.setStackSize( is.getStackSize() ); this.setCraftable( is.isCraftable() ); this.setCountRequestable( is.getCountRequestable() ); + this.setShowCraftingLabel( is.getShowCraftingLabel() ); } private AEItemStack( final ItemStack is ) @@ -156,6 +157,7 @@ public final class AEItemStack extends AEStack implements IAEItemS final byte countReqType = (byte) ( ( mask & 0x30 ) >> 4 ); final boolean isCraftable = ( mask & 0x40 ) > 0; final boolean hasTagCompound = ( mask & 0x80 ) > 0; + boolean showCraftingLabel = data.readBoolean(); // don't send this... final NBTTagCompound d = new NBTTagCompound(); @@ -182,6 +184,11 @@ public final class AEItemStack extends AEStack implements IAEItemS final long countRequestable = getPacketValue( countReqType, data ); final ItemStack itemstack = new ItemStack( d ); + + if(!showCraftingLabel) { + showCraftingLabel = stackSize == 0; + } + if( itemstack == null ) { return null; @@ -189,7 +196,8 @@ public final class AEItemStack extends AEStack implements IAEItemS final AEItemStack item = AEItemStack.create( itemstack ); // item.priority = (int) priority; - item.setStackSize( stackSize ); + item.setStackSize( showCraftingLabel ? 1 : stackSize ); + item.setShowCraftingLabel( showCraftingLabel ); item.setCountRequestable( countRequestable ); item.setCraftable( isCraftable ); return item; @@ -209,6 +217,7 @@ public final class AEItemStack extends AEStack implements IAEItemS this.incStackSize( option.getStackSize() ); this.setCountRequestable( this.getCountRequestable() + option.getCountRequestable() ); this.setCraftable( this.isCraftable() || option.isCraftable() ); + this.setShowCraftingLabel( this.getShowCraftingLabel() || option.getShowCraftingLabel() ); } @Override diff --git a/src/main/java/appeng/util/item/AEStack.java b/src/main/java/appeng/util/item/AEStack.java index c3ecb223..1439663a 100644 --- a/src/main/java/appeng/util/item/AEStack.java +++ b/src/main/java/appeng/util/item/AEStack.java @@ -32,6 +32,7 @@ public abstract class AEStack implements IAEStack implements IAEStack implements IAEStack