Temporary (?) hacky fix to display the craftable items
This is kind of a hackjob IMO but it saves me the trouble of possibly rewriting large portions of either the AE codebase or ASM'ing the vanilla classes.
This commit is contained in:
parent
c74aaddbd3
commit
370fc49357
6 changed files with 47 additions and 4 deletions
|
@ -203,4 +203,15 @@ public interface IAEStack<StackType extends 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 );
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 );
|
||||
|
||||
|
|
|
@ -60,6 +60,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> 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<IAEFluidStack> 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<IAEFluidStack> 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<IAEFluidStack> 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<IAEFluidStack> 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
|
||||
|
|
|
@ -57,6 +57,7 @@ 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 )
|
||||
|
@ -156,6 +157,7 @@ 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();
|
||||
|
@ -182,6 +184,11 @@ public final class AEItemStack extends AEStack<IAEItemStack> 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<IAEItemStack> 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<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
|
||||
|
|
|
@ -32,6 +32,7 @@ public abstract class AEStack<StackType extends IAEStack> implements IAEStack<St
|
|||
private boolean isCraftable;
|
||||
private long stackSize;
|
||||
private long countRequestable;
|
||||
private boolean showCraftingLabel = false;
|
||||
|
||||
static long getPacketValue( final byte type, final ByteBuf tag )
|
||||
{
|
||||
|
@ -103,9 +104,20 @@ public abstract class AEStack<StackType extends IAEStack> implements IAEStack<St
|
|||
// priority = Integer.MIN_VALUE;
|
||||
this.setCountRequestable( 0 );
|
||||
this.setCraftable( false );
|
||||
this.setShowCraftingLabel( false );
|
||||
return (StackType) this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getShowCraftingLabel() {
|
||||
return this.showCraftingLabel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setShowCraftingLabel(boolean showCraftingLabel) {
|
||||
this.showCraftingLabel = showCraftingLabel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMeaningful()
|
||||
{
|
||||
|
@ -142,6 +154,8 @@ public abstract class AEStack<StackType extends IAEStack> implements IAEStack<St
|
|||
final byte mask = (byte) ( this.getType( 0 ) | ( this.getType( this.stackSize ) << 2 ) | ( this.getType( this.countRequestable ) << 4 ) | ( (byte) ( this.isCraftable ? 1 : 0 ) << 6 ) | ( this.hasTagCompound() ? 1 : 0 ) << 7 );
|
||||
|
||||
i.writeByte( mask );
|
||||
i.writeBoolean( this.showCraftingLabel );
|
||||
|
||||
this.writeIdentity( i );
|
||||
|
||||
this.readNBT( i );
|
||||
|
|
Loading…
Reference in a new issue