Fix Inscriber and Molecular Assembler (#2995)
* Fix inscriber * Allow GUI extraction for Molecular Assembler
This commit is contained in:
@@ -76,6 +76,7 @@ import appeng.util.Platform;
|
|||||||
import appeng.util.helpers.ItemHandlerUtil;
|
import appeng.util.helpers.ItemHandlerUtil;
|
||||||
import appeng.util.inv.InvOperation;
|
import appeng.util.inv.InvOperation;
|
||||||
import appeng.util.inv.WrapperChainedItemHandler;
|
import appeng.util.inv.WrapperChainedItemHandler;
|
||||||
|
import appeng.util.inv.WrapperFilteredItemHandler;
|
||||||
import appeng.util.inv.filter.IAEItemFilter;
|
import appeng.util.inv.filter.IAEItemFilter;
|
||||||
import appeng.util.item.AEItemStack;
|
import appeng.util.item.AEItemStack;
|
||||||
|
|
||||||
@@ -83,8 +84,9 @@ import appeng.util.item.AEItemStack;
|
|||||||
public class TileMolecularAssembler extends AENetworkInvTile implements IUpgradeableHost, IConfigManagerHost, IGridTickable, ICraftingMachine, IPowerChannelState
|
public class TileMolecularAssembler extends AENetworkInvTile implements IUpgradeableHost, IConfigManagerHost, IGridTickable, ICraftingMachine, IPowerChannelState
|
||||||
{
|
{
|
||||||
private final InventoryCrafting craftingInv;
|
private final InventoryCrafting craftingInv;
|
||||||
private final AppEngInternalInventory gridInv = new AppEngInternalInventory( this, 9 + 1, 1, new CraftingGridFilter() );
|
private final AppEngInternalInventory gridInv = new AppEngInternalInventory( this, 9 + 1, 1 );
|
||||||
private final AppEngInternalInventory patternInv = new AppEngInternalInventory( this, 1, 1 );
|
private final AppEngInternalInventory patternInv = new AppEngInternalInventory( this, 1, 1 );
|
||||||
|
private final IItemHandler gridInvExt = new WrapperFilteredItemHandler( gridInv, new CraftingGridFilter() );
|
||||||
private final IItemHandler internalInv = new WrapperChainedItemHandler( gridInv, patternInv );
|
private final IItemHandler internalInv = new WrapperChainedItemHandler( gridInv, patternInv );
|
||||||
private final IConfigManager settings;
|
private final IConfigManager settings;
|
||||||
private final UpgradeInventory upgrades;
|
private final UpgradeInventory upgrades;
|
||||||
@@ -347,7 +349,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
|||||||
@Override
|
@Override
|
||||||
protected IItemHandler getItemHandlerForSide( EnumFacing side )
|
protected IItemHandler getItemHandlerForSide( EnumFacing side )
|
||||||
{
|
{
|
||||||
return gridInv;
|
return gridInvExt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -96,6 +96,9 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
|||||||
private final AppEngInternalInventory topItemHandler = new AppEngInternalInventory( this, 1, 1 );
|
private final AppEngInternalInventory topItemHandler = new AppEngInternalInventory( this, 1, 1 );
|
||||||
private final AppEngInternalInventory bottomItemHandler = new AppEngInternalInventory( this, 1, 1 );
|
private final AppEngInternalInventory bottomItemHandler = new AppEngInternalInventory( this, 1, 1 );
|
||||||
private final AppEngInternalInventory sideItemHandler = new AppEngInternalInventory( this, 2, 1 );
|
private final AppEngInternalInventory sideItemHandler = new AppEngInternalInventory( this, 2, 1 );
|
||||||
|
|
||||||
|
private final IItemHandler topItemHandlerExtern;
|
||||||
|
private final IItemHandler bottomItemHandlerExtern;
|
||||||
private final IItemHandler sideItemHandlerExtern;
|
private final IItemHandler sideItemHandlerExtern;
|
||||||
|
|
||||||
private final IItemHandlerModifiable inv = new WrapperChainedItemHandler( topItemHandler, bottomItemHandler, sideItemHandler );
|
private final IItemHandlerModifiable inv = new WrapperChainedItemHandler( topItemHandler, bottomItemHandler, sideItemHandler );
|
||||||
@@ -112,10 +115,9 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
|||||||
this.upgrades = new DefinitionUpgradeInventory( inscriberDefinition, this, this.getUpgradeSlots() );
|
this.upgrades = new DefinitionUpgradeInventory( inscriberDefinition, this, this.getUpgradeSlots() );
|
||||||
|
|
||||||
final IAEItemFilter filter = new ItemHandlerFilter();
|
final IAEItemFilter filter = new ItemHandlerFilter();
|
||||||
topItemHandler.setFilter( filter );
|
topItemHandlerExtern = new WrapperFilteredItemHandler( topItemHandler, filter );
|
||||||
bottomItemHandler.setFilter( filter );
|
bottomItemHandlerExtern = new WrapperFilteredItemHandler( bottomItemHandler, filter );
|
||||||
sideItemHandlerExtern = new WrapperFilteredItemHandler( sideItemHandler, filter );
|
sideItemHandlerExtern = new WrapperFilteredItemHandler( sideItemHandler, filter );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getUpgradeSlots()
|
private int getUpgradeSlots()
|
||||||
@@ -360,13 +362,13 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
|||||||
|
|
||||||
final boolean matchA = ( plateA.isEmpty() && !recipe.getTopOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( plateA,
|
final boolean matchA = ( plateA.isEmpty() && !recipe.getTopOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( plateA,
|
||||||
recipe.getTopOptional().orElse( ItemStack.EMPTY ) ) ) && // and...
|
recipe.getTopOptional().orElse( ItemStack.EMPTY ) ) ) && // and...
|
||||||
( plateB.isEmpty() && !recipe.getBottomOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( plateB,
|
( ( plateB.isEmpty() && !recipe.getBottomOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( plateB,
|
||||||
recipe.getBottomOptional().orElse( ItemStack.EMPTY ) ) );
|
recipe.getBottomOptional().orElse( ItemStack.EMPTY ) ) ) );
|
||||||
|
|
||||||
final boolean matchB = ( plateB.isEmpty() && !recipe.getTopOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( plateB,
|
final boolean matchB = ( plateB.isEmpty() && !recipe.getTopOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( plateB,
|
||||||
recipe.getTopOptional().orElse( ItemStack.EMPTY ) ) ) && // and...
|
recipe.getTopOptional().orElse( ItemStack.EMPTY ) ) ) && // and...
|
||||||
( plateA.isEmpty() && !recipe.getBottomOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( plateA,
|
( ( plateA.isEmpty() && !recipe.getBottomOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( plateA,
|
||||||
recipe.getBottomOptional().orElse( ItemStack.EMPTY ) ) );
|
recipe.getBottomOptional().orElse( ItemStack.EMPTY ) ) ) );
|
||||||
|
|
||||||
if( matchA || matchB )
|
if( matchA || matchB )
|
||||||
{
|
{
|
||||||
@@ -501,11 +503,11 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
|||||||
{
|
{
|
||||||
if( facing == getUp() )
|
if( facing == getUp() )
|
||||||
{
|
{
|
||||||
return topItemHandler;
|
return topItemHandlerExtern;
|
||||||
}
|
}
|
||||||
else if( facing == getUp().getOpposite() )
|
else if( facing == getUp().getOpposite() )
|
||||||
{
|
{
|
||||||
return bottomItemHandler;
|
return bottomItemHandlerExtern;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -574,7 +576,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return slot == 1;
|
return inv == topItemHandler || inv == bottomItemHandler || slot == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user