Inscriber improvements and fixes (#3028)

This commit is contained in:
fscan
2017-08-12 14:52:01 +02:00
committed by yueh
parent eec3e59eea
commit 3e2bc0e038
5 changed files with 15 additions and 13 deletions
@@ -135,13 +135,13 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
{
final boolean matchA = ( top.isEmpty() && !recipe.getTopOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( top,
recipe.getTopOptional().orElse( ItemStack.EMPTY ) ) ) && // and...
( bot.isEmpty() && !recipe.getBottomOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( bot,
recipe.getBottomOptional().orElse( ItemStack.EMPTY ) ) );
( ( bot.isEmpty() && !recipe.getBottomOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( bot,
recipe.getBottomOptional().orElse( ItemStack.EMPTY ) ) ) );
final boolean matchB = ( bot.isEmpty() && !recipe.getTopOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( bot,
recipe.getTopOptional().orElse( ItemStack.EMPTY ) ) ) && // and...
( top.isEmpty() && !recipe.getBottomOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( top,
recipe.getBottomOptional().orElse( ItemStack.EMPTY ) ) );
( ( top.isEmpty() && !recipe.getBottomOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( top,
recipe.getBottomOptional().orElse( ItemStack.EMPTY ) ) ) );
if( matchA || matchB )
{
@@ -43,7 +43,6 @@ public abstract class PartUpgradeable extends PartBasicState implements IAEAppEn
{
super( is );
this.upgrades = new StackUpgradeInventory( this.getItemStack(), this, this.getUpgradeSlots() );
this.upgrades.setMaxStackSize( 1 );
this.manager = new ConfigManager( this );
}
@@ -19,6 +19,7 @@
package appeng.tile.inventory;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
@@ -39,7 +40,7 @@ public class AppEngInternalInventory extends ItemStackHandler implements IIntern
{
private boolean enableClientEvents = false;
private IAEAppEngInventory te;
private int maxStack;
private final int[] maxStack;
private InvOperation currentOp;
private ItemStack previousStack = ItemStack.EMPTY;
private IAEItemFilter filter;
@@ -49,7 +50,8 @@ public class AppEngInternalInventory extends ItemStackHandler implements IIntern
super( size );
this.setTileEntity( inventory );
this.setFilter( filter );
this.maxStack = maxStack;
this.maxStack = new int[size];
Arrays.fill( this.maxStack, maxStack );
}
public AppEngInternalInventory( final IAEAppEngInventory inventory, final int size, final int maxStack )
@@ -70,7 +72,7 @@ public class AppEngInternalInventory extends ItemStackHandler implements IIntern
@Override
public int getSlotLimit( int slot )
{
return this.maxStack;
return this.maxStack[slot];
}
@Override
@@ -135,9 +137,9 @@ public class AppEngInternalInventory extends ItemStackHandler implements IIntern
return Platform.isServer() || this.isEnableClientEvents();
}
public void setMaxStackSize( final int s )
public void setMaxStackSize( final int slot, final int size )
{
this.maxStack = s;
this.maxStack[slot] = size;
}
@Override
@@ -152,7 +154,7 @@ public class AppEngInternalInventory extends ItemStackHandler implements IIntern
@Override
public boolean isItemValidForSlot( int slot, ItemStack stack )
{
if( this.maxStack == 0 )
if( this.maxStack[slot] == 0 )
{
return false;
}
@@ -114,6 +114,8 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
final ITileDefinition inscriberDefinition = AEApi.instance().definitions().blocks().inscriber();
this.upgrades = new DefinitionUpgradeInventory( inscriberDefinition, this, this.getUpgradeSlots() );
this.sideItemHandler.setMaxStackSize( 1, 64 );
final IAEItemFilter filter = new ItemHandlerFilter();
this.topItemHandlerExtern = new WrapperFilteredItemHandler( this.topItemHandler, filter );
this.bottomItemHandlerExtern = new WrapperFilteredItemHandler( this.bottomItemHandler, filter );
@@ -57,7 +57,7 @@ import appeng.util.inv.InvOperation;
public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock, ITickable
{
private final byte corner = 16;
private final AppEngInternalInventory internalInventory = new AppEngInternalInventory( this, 1 );
private final AppEngInternalInventory internalInventory = new AppEngInternalInventory( this, 1, 1 );
private final byte hasSingularity = 32;
private final byte powered = 64;
@@ -71,7 +71,6 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
this.getProxy().setValidSides( EnumSet.noneOf( EnumFacing.class ) );
this.getProxy().setFlags( GridFlags.DENSE_CAPACITY );
this.getProxy().setIdlePowerUsage( 22 );
this.internalInventory.setMaxStackSize( 1 );
}
@Override