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:
fscan
2017-09-09 12:58:22 +02:00
committed by GitHub
parent 955fcac92a
commit 375e1efb15
13 changed files with 38 additions and 67 deletions
@@ -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;
}