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
@@ -58,7 +58,6 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
this.setStackSize( is.getStackSize() );
this.setCraftable( is.isCraftable() );
this.setCountRequestable( is.getCountRequestable() );
this.setShowCraftingLabel( is.getShowCraftingLabel() );
}
private AEItemStack( final ItemStack is )
@@ -158,7 +157,6 @@ public final class AEItemStack extends AEStack<IAEItemStack> 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();
@@ -186,11 +184,6 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
final ItemStack itemstack = new ItemStack( d );
if( !showCraftingLabel )
{
showCraftingLabel = stackSize == 0 && isCraftable;
}
if( itemstack.isEmpty() )
{
return null;
@@ -198,8 +191,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
final AEItemStack item = AEItemStack.create( itemstack );
// item.priority = (int) priority;
item.setStackSize( showCraftingLabel ? 1 : stackSize );
item.setShowCraftingLabel( showCraftingLabel );
item.setStackSize( stackSize );
item.setCountRequestable( countRequestable );
item.setCraftable( isCraftable );
return item;
@@ -219,7 +211,6 @@ public final class AEItemStack extends AEStack<IAEItemStack> 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
@@ -597,12 +588,14 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
@SideOnly( Side.CLIENT )
public List getToolTip()
{
if( this.getDefinition().getTooltip() != null )
if( this.getDefinition().getTooltip() == null )
{
return this.getDefinition().getTooltip();
final ItemStack is = this.getItemStack();
is.setCount( 1 );
this.getDefinition().setTooltip( Platform.getTooltip( is ) );
}
return this.getDefinition().setTooltip( Platform.getTooltip( this.getItemStack() ) );
return this.getDefinition().getTooltip();
}
@SideOnly( Side.CLIENT )
@@ -610,7 +603,9 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
{
if( this.getDefinition().getDisplayName() == null )
{
this.getDefinition().setDisplayName( Platform.getItemDisplayName( this.getItemStack() ) );
final ItemStack is = this.getItemStack();
is.setCount( 1 );
this.getDefinition().setDisplayName( Platform.getItemDisplayName( is ) );
}
return this.getDefinition().getDisplayName();