Added an option to toggle oredict subsitutions for patterns.
It adds a backward compatibility to convert current patterns to use oredict by default, which should be removed with rv4 stable. Closes #1156
This commit is contained in:
@@ -70,15 +70,17 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
{
|
||||
|
||||
public final PartPatternTerminal ct;
|
||||
final AppEngInternalInventory cOut = new AppEngInternalInventory( null, 1 );
|
||||
final IInventory crafting;
|
||||
final SlotFakeCraftingMatrix[] craftingSlots = new SlotFakeCraftingMatrix[9];
|
||||
final OptionalSlotFake[] outputSlots = new OptionalSlotFake[3];
|
||||
final SlotPatternTerm craftSlot;
|
||||
final SlotRestrictedInput patternSlotIN;
|
||||
final SlotRestrictedInput patternSlotOUT;
|
||||
private final AppEngInternalInventory cOut = new AppEngInternalInventory( null, 1 );
|
||||
private final IInventory crafting;
|
||||
private final SlotFakeCraftingMatrix[] craftingSlots = new SlotFakeCraftingMatrix[9];
|
||||
private final OptionalSlotFake[] outputSlots = new OptionalSlotFake[3];
|
||||
private final SlotPatternTerm craftSlot;
|
||||
private final SlotRestrictedInput patternSlotIN;
|
||||
private final SlotRestrictedInput patternSlotOUT;
|
||||
@GuiSync( 97 )
|
||||
public boolean craftingMode = true;
|
||||
@GuiSync( 96 )
|
||||
public boolean substitute = false;
|
||||
|
||||
public ContainerPatternTerm( final InventoryPlayer ip, final ITerminalHost monitorable )
|
||||
{
|
||||
@@ -87,6 +89,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
|
||||
final IInventory patternInv = this.ct.getInventoryByName( "pattern" );
|
||||
final IInventory output = this.ct.getInventoryByName( "output" );
|
||||
|
||||
this.crafting = this.ct.getInventoryByName( "crafting" );
|
||||
|
||||
for( int y = 0; y < 3; y++ )
|
||||
@@ -155,6 +158,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
public ItemStack getAndUpdateOutput()
|
||||
{
|
||||
final InventoryCrafting ic = new InventoryCrafting( this, 3, 3 );
|
||||
|
||||
for( int x = 0; x < ic.getSizeInventory(); x++ )
|
||||
{
|
||||
ic.setInventorySlotContents( x, this.crafting.getStackInSlot( x ) );
|
||||
@@ -237,6 +241,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
encodedValue.setTag( "in", tagIn );
|
||||
encodedValue.setTag( "out", tagOut );
|
||||
encodedValue.setBoolean( "crafting", this.craftingMode );
|
||||
encodedValue.setBoolean( "substitute", this.substitute );
|
||||
|
||||
output.setTagCompound( encodedValue );
|
||||
}
|
||||
@@ -268,6 +273,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
if( this.craftingMode )
|
||||
{
|
||||
final ItemStack out = this.getAndUpdateOutput();
|
||||
|
||||
if( out != null && out.stackSize > 0 )
|
||||
{
|
||||
return new ItemStack[] { out };
|
||||
@@ -281,6 +287,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
for( final OptionalSlotFake outputSlot : this.outputSlots )
|
||||
{
|
||||
final ItemStack out = outputSlot.getStack();
|
||||
|
||||
if( out != null && out.stackSize > 0 )
|
||||
{
|
||||
list.add( out );
|
||||
@@ -346,9 +353,9 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
if( packetPatternSlot.slotItem != null && this.cellInv != null )
|
||||
{
|
||||
final IAEItemStack out = packetPatternSlot.slotItem.copy();
|
||||
|
||||
InventoryAdaptor inv = new AdaptorPlayerHand( this.getPlayerInv().player );
|
||||
final InventoryAdaptor playerInv = InventoryAdaptor.getAdaptor( this.getPlayerInv().player, EnumFacing.UP );
|
||||
|
||||
if( packetPatternSlot.shift )
|
||||
{
|
||||
inv = playerInv;
|
||||
@@ -375,6 +382,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
|
||||
final InventoryCrafting ic = new InventoryCrafting( new ContainerNull(), 3, 3 );
|
||||
final InventoryCrafting real = new InventoryCrafting( new ContainerNull(), 3, 3 );
|
||||
|
||||
for( int x = 0; x < 9; x++ )
|
||||
{
|
||||
ic.setInventorySlotContents( x, packetPatternSlot.pattern[x] == null ? null : packetPatternSlot.pattern[x].getItemStack() );
|
||||
@@ -411,6 +419,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
for( int x = 0; x < real.getSizeInventory(); x++ )
|
||||
{
|
||||
final ItemStack failed = playerInv.addItems( real.getStackInSlot( x ) );
|
||||
|
||||
if( failed != null )
|
||||
{
|
||||
p.dropPlayerItemWithRandomChoice( failed, false );
|
||||
@@ -449,6 +458,8 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
this.craftingMode = this.ct.isCraftingRecipe();
|
||||
this.updateOrderOfOutputSlots();
|
||||
}
|
||||
|
||||
this.substitute = this.ct.isSubstitution();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -518,4 +529,12 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void toggleSubstitute()
|
||||
{
|
||||
this.substitute = !this.substitute;
|
||||
|
||||
this.detectAndSendChanges();
|
||||
this.getAndUpdateOutput();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user