We don't need the showCraftingLabel flag, as IAEStack is perfectly fine with 0 size stacks. (#3071)
Adjust rendering code to use ItemStack with size 1 where required.
This commit is contained in:
@@ -455,7 +455,8 @@ 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.getShowCraftingLabel() && player.inventory.getItemStack().isEmpty() )
|
||||
if( stack != null && action == InventoryAction.PICKUP_OR_SET_DOWN && stack.getStackSize() == 0 && player.inventory.getItemStack()
|
||||
.isEmpty() )
|
||||
{
|
||||
action = InventoryAction.AUTO_CRAFT;
|
||||
}
|
||||
@@ -715,7 +716,7 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
// Annoying but easier than trying to splice into render item
|
||||
super.drawSlot( new Size1Slot( (SlotME) s ) );
|
||||
|
||||
this.stackSizeRenderer.renderStackSize( this.fontRenderer, ( (SlotME) s ).getAEStack(), s.getStack(), s.xPos, s.yPos );
|
||||
this.stackSizeRenderer.renderStackSize( this.fontRenderer, ( (SlotME) s ).getAEStack(), s.xPos, s.yPos );
|
||||
|
||||
}
|
||||
catch( final Exception err )
|
||||
|
||||
@@ -352,7 +352,8 @@ public class GuiCraftConfirm extends AEBaseGui
|
||||
final int posX = x * ( 1 + sectionLength ) + xo + sectionLength - 19;
|
||||
final int posY = y * offY + yo;
|
||||
|
||||
final ItemStack is = refStack.copy().getItemStack();
|
||||
final ItemStack is = refStack.getItemStack();
|
||||
is.setCount( 1 );
|
||||
|
||||
if( this.tooltip == z - viewStart )
|
||||
{
|
||||
|
||||
@@ -309,7 +309,8 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
|
||||
final int posX = x * ( 1 + SECTION_LENGTH ) + ITEMSTACK_LEFT_OFFSET + SECTION_LENGTH - 19;
|
||||
final int posY = y * offY + ITEMSTACK_TOP_OFFSET;
|
||||
|
||||
final ItemStack is = refStack.copy().getItemStack();
|
||||
final ItemStack is = refStack.getItemStack();
|
||||
is.setCount( 1 );
|
||||
|
||||
if( this.tooltip == z - viewStart )
|
||||
{
|
||||
|
||||
@@ -177,12 +177,10 @@ public class ItemRepo
|
||||
if( viewMode == ViewItems.CRAFTABLE )
|
||||
{
|
||||
is = is.copy();
|
||||
// is.setStackSize( 0 ) triggers isEmpty() and thus only shows empty stacks!
|
||||
is.setStackSize( 1 );
|
||||
is.setShowCraftingLabel( true );
|
||||
is.setStackSize( 0 );
|
||||
}
|
||||
|
||||
if( viewMode == ViewItems.STORED && is.getShowCraftingLabel() )
|
||||
if( viewMode == ViewItems.STORED && is.getStackSize() == 0 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -240,7 +238,9 @@ public class ItemRepo
|
||||
|
||||
for( final IAEItemStack is : this.view )
|
||||
{
|
||||
this.dsp.add( is.getItemStack() );
|
||||
final ItemStack displayStack = is.getItemStack();
|
||||
displayStack.setCount( 1 );
|
||||
this.dsp.add( displayStack );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ package appeng.client.render;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.core.AEConfig;
|
||||
@@ -42,9 +41,9 @@ public class StackSizeRenderer
|
||||
private static final ISlimReadableNumberConverter SLIM_CONVERTER = ReadableNumberConverter.INSTANCE;
|
||||
private static final IWideReadableNumberConverter WIDE_CONVERTER = ReadableNumberConverter.INSTANCE;
|
||||
|
||||
public void renderStackSize( FontRenderer fontRenderer, IAEItemStack aeStack, ItemStack is, int xPos, int yPos )
|
||||
public void renderStackSize( FontRenderer fontRenderer, IAEItemStack aeStack, int xPos, int yPos )
|
||||
{
|
||||
if( !is.isEmpty() )
|
||||
if( aeStack != null )
|
||||
{
|
||||
final float scaleFactor = AEConfig.instance().useTerminalUseLargeFont() ? 0.85f : 0.5f;
|
||||
final float inverseScaleFactor = 1.0f / scaleFactor;
|
||||
@@ -53,7 +52,7 @@ public class StackSizeRenderer
|
||||
final boolean unicodeFlag = fontRenderer.getUnicodeFlag();
|
||||
fontRenderer.setUnicodeFlag( false );
|
||||
|
||||
if( aeStack.getShowCraftingLabel() )
|
||||
if( aeStack.getStackSize() == 0 && aeStack.isCraftable() )
|
||||
{
|
||||
final String craftLabelText = AEConfig.instance().useTerminalUseLargeFont() ? GuiText.LargeFontCraft.getLocal() : GuiText.SmallFontCraft
|
||||
.getLocal();
|
||||
@@ -71,10 +70,9 @@ public class StackSizeRenderer
|
||||
GlStateManager.enableBlend();
|
||||
}
|
||||
|
||||
final long amount = aeStack != null ? aeStack.getStackSize() : is.getCount();
|
||||
if( amount != 0 && !aeStack.getShowCraftingLabel() )
|
||||
if( aeStack.getStackSize() > 0 )
|
||||
{
|
||||
final String stackSize = this.getToBeRenderedStackSize( amount );
|
||||
final String stackSize = this.getToBeRenderedStackSize( aeStack.getStackSize() );
|
||||
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.disableDepth();
|
||||
|
||||
@@ -22,6 +22,7 @@ package appeng.client.render.effects;
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
@@ -45,7 +46,9 @@ public class AssemblerFX extends Particle implements ICanDie
|
||||
this.motionY = 0;
|
||||
this.motionZ = 0;
|
||||
this.speed = speed;
|
||||
this.fi = new EntityFloatingItem( this, w, x, y, z, is.getItemStack() );
|
||||
final ItemStack displayItem = is.getItemStack();
|
||||
displayItem.setCount( 1 );
|
||||
this.fi = new EntityFloatingItem( this, w, x, y, z, displayItem );
|
||||
w.spawnEntity( this.fi );
|
||||
this.particleMaxAge = (int) Math.ceil( Math.max( 1, 100.0f / speed ) ) + 2;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user