mirror of
https://github.com/GTNewHorizons/ThaumicEnergistics.git
synced 2026-10-26 14:33:46 +00:00
Import Bus Crash
Fixes #203: Crystallized Essentia & Wisp Essence can now be used to set filters. Fixes #206: Import bus will no longer crash with redstone card.
This commit is contained in:
1 parent
a36538c23b
commit
27b60213ae
16 files changed
+238
-136
No files matched your search
+5
-1
@@ -1,4 +1,8 @@
|
||||
6/12/2016 0.8.10.6
|
||||
7/2/2015 0.8.10.6
|
||||
Fixes #203: Crystallized Essentia & Wisp Essence can now be used to set filters.
|
||||
Fixes #206: Import bus will no longer crash with redstone card.
|
||||
|
||||
6/12/2016 0.8.10.6
|
||||
Fixes #199: Conversion & Storage monitors now placeable in SMP.
|
||||
EssentiaGrid:
|
||||
* Updated Conversion Monitor
|
||||
|
||||
@@ -18,6 +18,7 @@ import thaumicenergistics.container.slot.SlotRestrictive;
|
||||
import thaumicenergistics.grid.IMEEssentiaMonitor;
|
||||
import thaumicenergistics.grid.IMEEssentiaMonitorReceiver;
|
||||
import thaumicenergistics.integration.tc.EssentiaItemContainerHelper;
|
||||
import thaumicenergistics.integration.tc.EssentiaItemContainerHelper.AspectItemType;
|
||||
import thaumicenergistics.network.packet.client.PacketClientEssentiaCellTerminal;
|
||||
import thaumicenergistics.network.packet.server.PacketServerEssentiaCellTerminal;
|
||||
import thaumicenergistics.util.EffectiveSide;
|
||||
@@ -552,7 +553,7 @@ public abstract class AbstractContainerCellTerminalBase
|
||||
|
||||
// Re-validate the label
|
||||
ItemStack label = this.inventory.getStackInSlot( AbstractContainerCellTerminalBase.INPUT_SLOT_ID );
|
||||
if( !EssentiaItemContainerHelper.INSTANCE.isLabel( label ) )
|
||||
if( EssentiaItemContainerHelper.INSTANCE.getItemType( label ) != AspectItemType.JarLabel )
|
||||
{
|
||||
// Not a label
|
||||
return;
|
||||
@@ -683,14 +684,21 @@ public abstract class AbstractContainerCellTerminalBase
|
||||
return;
|
||||
}
|
||||
|
||||
// Ensure the input slot is an aspect container item.
|
||||
if( !EssentiaItemContainerHelper.INSTANCE.isContainer( inputStack ) )
|
||||
// Get the item type
|
||||
AspectItemType iType = EssentiaItemContainerHelper.INSTANCE.getItemType( inputStack );
|
||||
|
||||
// Label?
|
||||
if( iType == AspectItemType.JarLabel )
|
||||
{
|
||||
// Input is not aspect container, is it a label?
|
||||
if( EssentiaItemContainerHelper.INSTANCE.isLabel( inputStack ) )
|
||||
{
|
||||
this.setLabelAspect();
|
||||
}
|
||||
// Set the label
|
||||
this.setLabelAspect();
|
||||
return;
|
||||
}
|
||||
|
||||
// Valid container?
|
||||
if( iType != AspectItemType.EssentiaContainer )
|
||||
{
|
||||
// Invalid container
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import thaumicenergistics.aspect.AspectStack;
|
||||
import thaumicenergistics.aspect.AspectStackComparator.ComparatorMode;
|
||||
import thaumicenergistics.grid.EssentiaMonitor;
|
||||
import thaumicenergistics.integration.tc.EssentiaItemContainerHelper;
|
||||
import thaumicenergistics.integration.tc.EssentiaItemContainerHelper.AspectItemType;
|
||||
import thaumicenergistics.inventory.HandlerItemEssentiaCell;
|
||||
import thaumicenergistics.items.ItemEssentiaCell;
|
||||
import thaumicenergistics.network.packet.client.PacketClientEssentiaCellTerminal;
|
||||
@@ -59,7 +60,11 @@ public class ContainerEssentiaCell
|
||||
@Override
|
||||
public boolean isItemValidForSlot( final int slotID, final ItemStack itemStack )
|
||||
{
|
||||
return EssentiaItemContainerHelper.INSTANCE.isContainerOrLabel( itemStack );
|
||||
// Get the type
|
||||
AspectItemType iType = EssentiaItemContainerHelper.INSTANCE.getItemType( itemStack );
|
||||
|
||||
// True if jar or jar label
|
||||
return ( iType == AspectItemType.EssentiaContainer ) || ( iType == AspectItemType.JarLabel );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ public class ContainerEssentiaCellWorkbench
|
||||
if( !didMerge )
|
||||
{
|
||||
// Is the stack an aspect container?
|
||||
Aspect slotAspect = EssentiaItemContainerHelper.INSTANCE.getAspectInContainer( slotStack );
|
||||
Aspect slotAspect = EssentiaItemContainerHelper.INSTANCE.getFilterAspectFromItem( slotStack );
|
||||
if( slotAspect != null )
|
||||
{
|
||||
// Attempt to add the aspect to the cell partition list
|
||||
|
||||
@@ -6,6 +6,7 @@ import net.minecraft.item.ItemStack;
|
||||
import thaumicenergistics.ThaumicEnergistics;
|
||||
import thaumicenergistics.aspect.AspectStackComparator.ComparatorMode;
|
||||
import thaumicenergistics.integration.tc.EssentiaItemContainerHelper;
|
||||
import thaumicenergistics.integration.tc.EssentiaItemContainerHelper.AspectItemType;
|
||||
import thaumicenergistics.inventory.HandlerWirelessEssentiaTerminal;
|
||||
import thaumicenergistics.network.packet.client.PacketClientEssentiaCellTerminal;
|
||||
import thaumicenergistics.network.packet.server.PacketServerEssentiaCellTerminal;
|
||||
@@ -36,7 +37,11 @@ public class ContainerWirelessEssentiaTerminal
|
||||
@Override
|
||||
public boolean isItemValidForSlot( final int slotID, final ItemStack itemStack )
|
||||
{
|
||||
return EssentiaItemContainerHelper.INSTANCE.isContainerOrLabel( itemStack );
|
||||
// Get the type
|
||||
AspectItemType iType = EssentiaItemContainerHelper.INSTANCE.getItemType( itemStack );
|
||||
|
||||
// True if jar or jar label
|
||||
return ( iType == AspectItemType.EssentiaContainer ) || ( iType == AspectItemType.JarLabel );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ public class GuiEssentiaCellWorkbench
|
||||
if( partitionWidget.isMouseOverWidget( mouseX, mouseY ) )
|
||||
{
|
||||
// Get the aspect of the currently held item
|
||||
Aspect itemAspect = EssentiaItemContainerHelper.INSTANCE.getAspectInContainer( this.player.inventory.getItemStack() );
|
||||
Aspect itemAspect = EssentiaItemContainerHelper.INSTANCE.getFilterAspectFromItem( this.player.inventory.getItemStack() );
|
||||
|
||||
// Get the aspect of the widget
|
||||
Aspect widgetAspect = partitionWidget.getAspect();
|
||||
|
||||
@@ -17,8 +17,8 @@ import thaumicenergistics.integration.tc.EssentiaItemContainerHelper;
|
||||
import thaumicenergistics.network.IAspectSlotGui;
|
||||
import thaumicenergistics.network.packet.server.PacketServerEssentiaIOBus;
|
||||
import thaumicenergistics.parts.AEPartEssentiaExportBus;
|
||||
import thaumicenergistics.parts.AbstractAEPartEssentiaIOBus;
|
||||
import thaumicenergistics.parts.AEPartEssentiaImportBus;
|
||||
import thaumicenergistics.parts.AbstractAEPartEssentiaIOBus;
|
||||
import thaumicenergistics.registries.AEPartsEnum;
|
||||
import thaumicenergistics.texture.GuiTextureManager;
|
||||
import appeng.api.config.RedstoneMode;
|
||||
@@ -246,7 +246,7 @@ public class GuiEssentiaIO
|
||||
if( aspectSlot.isMouseOverWidget( mouseX, mouseY ) )
|
||||
{
|
||||
// Get the aspect of the currently held item
|
||||
Aspect itemAspect = EssentiaItemContainerHelper.INSTANCE.getAspectInContainer( this.player.inventory.getItemStack() );
|
||||
Aspect itemAspect = EssentiaItemContainerHelper.INSTANCE.getFilterAspectFromItem( this.player.inventory.getItemStack() );
|
||||
|
||||
// Is there an aspect?
|
||||
if( itemAspect != null )
|
||||
@@ -428,7 +428,10 @@ public class GuiEssentiaIO
|
||||
this.buttonList.add( this.redstoneControlButton );
|
||||
|
||||
// Adjust void mode button Y
|
||||
this.voidModeButton.yPosition += 18;
|
||||
if( this.voidModeButton != null )
|
||||
{
|
||||
this.voidModeButton.yPosition += 18;
|
||||
}
|
||||
}
|
||||
else if( !newRedstoneControled && this.buttonList.contains( this.redstoneControlButton ) )
|
||||
{
|
||||
@@ -436,7 +439,10 @@ public class GuiEssentiaIO
|
||||
this.buttonList.remove( this.redstoneControlButton );
|
||||
|
||||
// Adjust void mode button Y
|
||||
this.voidModeButton.yPosition -= 18;
|
||||
if( this.voidModeButton != null )
|
||||
{
|
||||
this.voidModeButton.yPosition -= 18;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -267,7 +267,7 @@ public class GuiEssentiaLevelEmitter
|
||||
if( this.aspectFilterSlot.isMouseOverWidget( mouseX, mouseY ) )
|
||||
{
|
||||
// Pass to the widget
|
||||
this.aspectFilterSlot.mouseClicked( EssentiaItemContainerHelper.INSTANCE.getAspectInContainer( this.player.inventory.getItemStack() ) );
|
||||
this.aspectFilterSlot.mouseClicked( EssentiaItemContainerHelper.INSTANCE.getFilterAspectFromItem( this.player.inventory.getItemStack() ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -460,9 +460,15 @@ public class GuiEssentiaLevelEmitter
|
||||
this.amountField.setText( Long.toString( amount ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the tracked aspect based on the specified item.
|
||||
*
|
||||
* @param itemStack
|
||||
* @return
|
||||
*/
|
||||
public boolean setFilteredAspectFromItemstack( final ItemStack itemStack )
|
||||
{
|
||||
Aspect itemAspect = EssentiaItemContainerHelper.INSTANCE.getAspectInContainer( itemStack );
|
||||
Aspect itemAspect = EssentiaItemContainerHelper.INSTANCE.getFilterAspectFromItem( itemStack );
|
||||
|
||||
if( itemAspect != null )
|
||||
{
|
||||
|
||||
@@ -201,7 +201,7 @@ public class GuiEssentiaStorageBus
|
||||
if( aspectSlot.isMouseOverWidget( mouseX, mouseY ) )
|
||||
{
|
||||
// Get the aspect of the currently held item
|
||||
Aspect itemAspect = EssentiaItemContainerHelper.INSTANCE.getAspectInContainer( this.player.inventory.getItemStack() );
|
||||
Aspect itemAspect = EssentiaItemContainerHelper.INSTANCE.getFilterAspectFromItem( this.player.inventory.getItemStack() );
|
||||
|
||||
// Is there an aspect?
|
||||
if( itemAspect != null )
|
||||
|
||||
@@ -11,8 +11,10 @@ import thaumcraft.common.blocks.BlockJarItem;
|
||||
import thaumcraft.common.blocks.ItemJarFilled;
|
||||
import thaumcraft.common.config.ConfigBlocks;
|
||||
import thaumcraft.common.config.ConfigItems;
|
||||
import thaumcraft.common.items.ItemCrystalEssence;
|
||||
import thaumcraft.common.items.ItemEssence;
|
||||
import thaumcraft.common.items.ItemResource;
|
||||
import thaumcraft.common.items.ItemWispEssence;
|
||||
import thaumicenergistics.api.IThEEssentiaContainerPermission;
|
||||
import thaumicenergistics.api.IThETransportPermissions;
|
||||
import thaumicenergistics.api.ThEApi;
|
||||
@@ -26,6 +28,34 @@ import thaumicenergistics.aspect.AspectStack;
|
||||
*/
|
||||
public final class EssentiaItemContainerHelper
|
||||
{
|
||||
public enum AspectItemType
|
||||
{
|
||||
/**
|
||||
* Unknown item, or non-whitelisted container
|
||||
*/
|
||||
Invalid,
|
||||
|
||||
/**
|
||||
* Whitelisted container.
|
||||
*/
|
||||
EssentiaContainer,
|
||||
|
||||
/**
|
||||
* Warded jar label.
|
||||
*/
|
||||
JarLabel,
|
||||
|
||||
/**
|
||||
* Crystallized essentia.
|
||||
*/
|
||||
CrystallizedEssentia,
|
||||
|
||||
/**
|
||||
* Wispy Essence.
|
||||
*/
|
||||
WispEssence;
|
||||
}
|
||||
|
||||
/**
|
||||
* Singleton
|
||||
*/
|
||||
@@ -59,6 +89,31 @@ public final class EssentiaItemContainerHelper
|
||||
this.perms = ThEApi.instance().transportPermissions();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the first aspect contained in the IEssentiaContainerItem. Ignores the whitelist.
|
||||
*
|
||||
* @param itemStack
|
||||
* @return
|
||||
*/
|
||||
private Aspect getAspectFromAnyContainerItem( final ItemStack itemStack )
|
||||
{
|
||||
// Is it a container?
|
||||
if( itemStack.getItem() instanceof IEssentiaContainerItem )
|
||||
{
|
||||
// Get the list of aspects from the container
|
||||
AspectList aspectList = ( (IEssentiaContainerItem)itemStack.getItem() ).getAspects( itemStack );
|
||||
|
||||
// Is there are list?
|
||||
if( aspectList != null )
|
||||
{
|
||||
// Return the aspect contained
|
||||
return aspectList.getAspects()[0];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an itemstack with a single empty jar
|
||||
*
|
||||
@@ -176,14 +231,8 @@ public final class EssentiaItemContainerHelper
|
||||
*/
|
||||
public ImmutablePair<Integer, ItemStack> extractFromContainer( final ItemStack container, final AspectStack aspectStack )
|
||||
{
|
||||
// Ensure we have a valid container
|
||||
if( container == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Ensure it is a container
|
||||
if( !this.isContainer( container ) )
|
||||
if( this.getItemType( container ) != AspectItemType.EssentiaContainer )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -324,7 +373,7 @@ public final class EssentiaItemContainerHelper
|
||||
public Aspect getAspectFromLabel( final ItemStack label )
|
||||
{
|
||||
// Ensure the item is a label
|
||||
if( !this.isLabel( label ) )
|
||||
if( this.getItemType( label ) != AspectItemType.JarLabel )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -346,39 +395,17 @@ public final class EssentiaItemContainerHelper
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the aspect of whatever essentia is in the container.
|
||||
* This method supports jar labels.
|
||||
* Returns the aspect in the container, or null if empty or invalid container.
|
||||
*
|
||||
* @param container
|
||||
* @return Aspect if container has one, null otherwise.
|
||||
* @param itemStack
|
||||
* @return
|
||||
*/
|
||||
public Aspect getAspectInContainer( final ItemStack container )
|
||||
public Aspect getAspectInContainer( final ItemStack itemStack )
|
||||
{
|
||||
// Is it a label?
|
||||
if( this.isLabel( container ) )
|
||||
// Ensure the item is a valid container
|
||||
if( this.getItemType( itemStack ) == AspectItemType.EssentiaContainer )
|
||||
{
|
||||
return this.getAspectFromLabel( container );
|
||||
}
|
||||
// Is the itemstack valid?
|
||||
else if( container != null )
|
||||
{
|
||||
// Is it a container?
|
||||
if( container.getItem() instanceof IEssentiaContainerItem )
|
||||
{
|
||||
// Is the container whitelisted?
|
||||
if( this.isContainerWhitelisted( container ) )
|
||||
{
|
||||
// Get the list of aspects from the container
|
||||
AspectList aspectList = ( (IEssentiaContainerItem)container.getItem() ).getAspects( container );
|
||||
|
||||
// Is there are list?
|
||||
if( aspectList != null )
|
||||
{
|
||||
// Return the aspect contained
|
||||
return aspectList.getAspects()[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
return this.getAspectFromAnyContainerItem( itemStack );
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -502,6 +529,89 @@ public final class EssentiaItemContainerHelper
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the aspect of of the specified item. This method supports jars, jar labels and crystallized essentia.
|
||||
* This should not be used to validate a container.
|
||||
*
|
||||
* @param itemStack
|
||||
* @return Aspect if container has one, null otherwise.
|
||||
*/
|
||||
public Aspect getFilterAspectFromItem( final ItemStack itemStack )
|
||||
{
|
||||
// Get the type
|
||||
AspectItemType type = this.getItemType( itemStack );
|
||||
|
||||
switch ( type )
|
||||
{
|
||||
case JarLabel:
|
||||
return this.getAspectFromLabel( itemStack );
|
||||
|
||||
case CrystallizedEssentia:
|
||||
case EssentiaContainer:
|
||||
case WispEssence:
|
||||
return this.getAspectFromAnyContainerItem( itemStack );
|
||||
|
||||
case Invalid:
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the aspect type of the item.
|
||||
*
|
||||
* @param itemStack
|
||||
* @return
|
||||
*/
|
||||
public AspectItemType getItemType( final ItemStack itemStack )
|
||||
{
|
||||
// Ensure the stack is not null
|
||||
if( itemStack != null )
|
||||
{
|
||||
// Get the item
|
||||
Item item = itemStack.getItem();
|
||||
|
||||
// Ensure the item is not null
|
||||
if( item != null )
|
||||
{
|
||||
// IEssentiaContainerItem?
|
||||
if( item instanceof IEssentiaContainerItem )
|
||||
{
|
||||
|
||||
// Valid container?
|
||||
if( this.isContainerWhitelisted( itemStack ) )
|
||||
{
|
||||
return AspectItemType.EssentiaContainer;
|
||||
}
|
||||
|
||||
// Crystallized Essentia?
|
||||
if( item instanceof ItemCrystalEssence )
|
||||
{
|
||||
return AspectItemType.CrystallizedEssentia;
|
||||
}
|
||||
|
||||
// Wisp essence?
|
||||
if( item instanceof ItemWispEssence )
|
||||
{
|
||||
return AspectItemType.WispEssence;
|
||||
}
|
||||
}
|
||||
|
||||
// Label?
|
||||
if( ( item instanceof ItemResource ) && ( itemStack.getItemDamage() == 13 ) )
|
||||
{
|
||||
return AspectItemType.JarLabel;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return AspectItemType.Invalid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the aspect represented by a jar's label.
|
||||
*
|
||||
@@ -539,14 +649,8 @@ public final class EssentiaItemContainerHelper
|
||||
*/
|
||||
public ImmutablePair<Integer, ItemStack> injectIntoContainer( final ItemStack container, final AspectStack aspectStack )
|
||||
{
|
||||
// Is there an item?
|
||||
if( container == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Is the item an essentia container?
|
||||
if( !this.isContainer( container ) )
|
||||
if( this.getItemType( container ) != AspectItemType.EssentiaContainer )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -654,24 +758,6 @@ public final class EssentiaItemContainerHelper
|
||||
return new ImmutablePair<Integer, ItemStack>( amountToFill, resultStack );
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the specified itemstack represents a container we can use
|
||||
*
|
||||
* @param container
|
||||
* @return
|
||||
*/
|
||||
public boolean isContainer( final ItemStack container )
|
||||
{
|
||||
// Is the container not null?
|
||||
if( container != null )
|
||||
{
|
||||
// Return if the container whitelisted or not.
|
||||
return this.isContainerWhitelisted( container );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the specified itemstack represents an empty container.
|
||||
*
|
||||
@@ -695,17 +781,6 @@ public final class EssentiaItemContainerHelper
|
||||
return( this.getContainerStoredAmount( container ) > 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* True if the item is a container or label
|
||||
*
|
||||
* @param stack
|
||||
* @return
|
||||
*/
|
||||
public boolean isContainerOrLabel( final ItemStack stack )
|
||||
{
|
||||
return this.isContainer( stack ) || this.isLabel( stack );
|
||||
}
|
||||
|
||||
/**
|
||||
* Quick check to see if the item is whitelisted.
|
||||
*
|
||||
@@ -729,24 +804,6 @@ public final class EssentiaItemContainerHelper
|
||||
return this.getContainerInfo( container ) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* True if the itemstack is a jar label.
|
||||
*
|
||||
* @param stack
|
||||
* @return
|
||||
*/
|
||||
public boolean isLabel( final ItemStack stack )
|
||||
{
|
||||
// Ensure the stack is not null
|
||||
if( stack != null )
|
||||
{
|
||||
// True if resource and meta = 13
|
||||
return( ( stack.getItem() instanceof ItemResource ) && ( stack.getItemDamage() == 13 ) );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup the standard white list
|
||||
*/
|
||||
@@ -789,7 +846,7 @@ public final class EssentiaItemContainerHelper
|
||||
}
|
||||
else
|
||||
{
|
||||
labelAspect = this.getAspectInContainer( jar );
|
||||
labelAspect = this.getFilterAspectFromItem( jar );
|
||||
}
|
||||
|
||||
// Ensure we have an aspect to set
|
||||
@@ -820,7 +877,7 @@ public final class EssentiaItemContainerHelper
|
||||
public void setLabelAspect( final ItemStack label, final Aspect aspect )
|
||||
{
|
||||
// Ensure the item is a label
|
||||
if( !this.isLabel( label ) )
|
||||
if( this.getItemType( label ) != AspectItemType.JarLabel )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import thaumcraft.api.aspects.Aspect;
|
||||
import thaumicenergistics.aspect.AspectStack;
|
||||
import thaumicenergistics.grid.IMEEssentiaMonitor;
|
||||
import thaumicenergistics.integration.tc.EssentiaItemContainerHelper;
|
||||
import thaumicenergistics.integration.tc.EssentiaItemContainerHelper.AspectItemType;
|
||||
import thaumicenergistics.registries.AEPartsEnum;
|
||||
import thaumicenergistics.util.EffectiveSide;
|
||||
import appeng.api.config.Actionable;
|
||||
@@ -130,16 +131,23 @@ public class AEPartEssentiaConversionMonitor
|
||||
* @param heldItem
|
||||
* @return
|
||||
*/
|
||||
private boolean fillEssentiaContainer( final EntityPlayer player, final ItemStack heldItem )
|
||||
private boolean fillEssentiaContainer( final EntityPlayer player, final ItemStack heldItem, final AspectItemType itemType )
|
||||
{
|
||||
// Is the item being held a label?
|
||||
if( EssentiaItemContainerHelper.INSTANCE.isLabel( heldItem ) )
|
||||
if( itemType == AspectItemType.JarLabel )
|
||||
{
|
||||
// Set the label type
|
||||
EssentiaItemContainerHelper.INSTANCE.setLabelAspect( heldItem, this.trackedEssentia.getAspectStack().aspect );
|
||||
return true;
|
||||
}
|
||||
|
||||
// Is the item not a container?
|
||||
if( itemType != AspectItemType.EssentiaContainer )
|
||||
{
|
||||
// Not a container
|
||||
return false;
|
||||
}
|
||||
|
||||
// Does the player have extract permission?
|
||||
if( !this.doesPlayerHavePermission( player, SecurityPermissions.EXTRACT ) )
|
||||
{
|
||||
@@ -332,17 +340,17 @@ public class AEPartEssentiaConversionMonitor
|
||||
* Attempts to fill an essentia container if monitor locked
|
||||
*/
|
||||
@Override
|
||||
protected boolean onActivatedWithEssentiaContainerOrLabel( final EntityPlayer player, final ItemStack heldItem )
|
||||
protected boolean onActivateWithAspectItem( final EntityPlayer player, final ItemStack heldItem, final AspectItemType itemType )
|
||||
{
|
||||
// Is there nothing being tracked, or is the monitor unlocked?
|
||||
if( !this.trackedEssentia.isValid() || !this.isLocked() )
|
||||
{
|
||||
// Pass to super
|
||||
return super.onActivatedWithEssentiaContainerOrLabel( player, heldItem );
|
||||
return super.onActivateWithAspectItem( player, heldItem, itemType );
|
||||
}
|
||||
|
||||
// Fill the container
|
||||
return this.fillEssentiaContainer( player, heldItem );
|
||||
return this.fillEssentiaContainer( player, heldItem, itemType );
|
||||
|
||||
}
|
||||
|
||||
@@ -371,22 +379,15 @@ public class AEPartEssentiaConversionMonitor
|
||||
ItemStack heldItem = player.getCurrentEquippedItem();
|
||||
|
||||
// Is the player holding an essentia container?
|
||||
if( !EssentiaItemContainerHelper.INSTANCE.isContainerOrLabel( heldItem ) )
|
||||
if( EssentiaItemContainerHelper.INSTANCE.getItemType( heldItem ) != AspectItemType.EssentiaContainer )
|
||||
{
|
||||
// Not holding container
|
||||
// Not holding valid container
|
||||
return false;
|
||||
}
|
||||
|
||||
// Shift-right-clicking attempts to insert the essentia into the network.
|
||||
// Shift-double-right-clicking attempts to insert all essentia in the players inventory into the network.
|
||||
|
||||
// Is the item being held a label?
|
||||
if( EssentiaItemContainerHelper.INSTANCE.isLabel( heldItem ) )
|
||||
{
|
||||
// Can't do anything with a label.
|
||||
return false;
|
||||
}
|
||||
|
||||
// Was it a double click?
|
||||
if( this.wasDoubleClick( player ) )
|
||||
{
|
||||
|
||||
@@ -555,7 +555,7 @@ public class AEPartEssentiaLevelEmitter
|
||||
public boolean setFilteredAspectFromItemstack( final EntityPlayer player, final ItemStack itemStack )
|
||||
{
|
||||
// Get the aspect
|
||||
Aspect itemAspect = EssentiaItemContainerHelper.INSTANCE.getAspectInContainer( itemStack );
|
||||
Aspect itemAspect = EssentiaItemContainerHelper.INSTANCE.getFilterAspectFromItem( itemStack );
|
||||
|
||||
// Ensure we got an aspect
|
||||
if( itemAspect == null )
|
||||
|
||||
@@ -131,7 +131,7 @@ public class AEPartEssentiaStorageBus
|
||||
public boolean addFilteredAspectFromItemstack( final EntityPlayer player, final ItemStack itemStack )
|
||||
{
|
||||
// Get the aspect of the item
|
||||
Aspect itemAspect = EssentiaItemContainerHelper.INSTANCE.getAspectInContainer( itemStack );
|
||||
Aspect itemAspect = EssentiaItemContainerHelper.INSTANCE.getFilterAspectFromItem( itemStack );
|
||||
|
||||
// Is there an aspect?
|
||||
if( itemAspect != null )
|
||||
|
||||
@@ -26,6 +26,7 @@ import thaumicenergistics.grid.IEssentiaWatcher;
|
||||
import thaumicenergistics.grid.IEssentiaWatcherHost;
|
||||
import thaumicenergistics.grid.IMEEssentiaMonitor;
|
||||
import thaumicenergistics.integration.tc.EssentiaItemContainerHelper;
|
||||
import thaumicenergistics.integration.tc.EssentiaItemContainerHelper.AspectItemType;
|
||||
import thaumicenergistics.registries.AEPartsEnum;
|
||||
import thaumicenergistics.texture.BlockTextureManager;
|
||||
import thaumicenergistics.util.EffectiveSide;
|
||||
@@ -551,9 +552,10 @@ public class AEPartEssentiaStorageMonitor
|
||||
*
|
||||
* @param player
|
||||
* @param heldItem
|
||||
* @param itemType
|
||||
* @return
|
||||
*/
|
||||
protected boolean onActivatedWithEssentiaContainerOrLabel( final EntityPlayer player, final ItemStack heldItem )
|
||||
protected boolean onActivateWithAspectItem( final EntityPlayer player, final ItemStack heldItem, final AspectItemType itemType )
|
||||
{
|
||||
// Is the monitor locked?
|
||||
if( this.monitorLocked )
|
||||
@@ -562,7 +564,7 @@ public class AEPartEssentiaStorageMonitor
|
||||
}
|
||||
|
||||
// Get the aspect
|
||||
Aspect heldAspect = EssentiaItemContainerHelper.INSTANCE.getAspectInContainer( heldItem );
|
||||
Aspect heldAspect = EssentiaItemContainerHelper.INSTANCE.getFilterAspectFromItem( heldItem );
|
||||
|
||||
// Ensure there is an aspect
|
||||
if( heldAspect == null )
|
||||
@@ -691,10 +693,13 @@ public class AEPartEssentiaStorageMonitor
|
||||
return this.onActivatedWithEmptyHand();
|
||||
}
|
||||
|
||||
// Is the player holding an essentia container?
|
||||
if( EssentiaItemContainerHelper.INSTANCE.isContainerOrLabel( heldItem ) )
|
||||
// Get the type
|
||||
AspectItemType itemType = EssentiaItemContainerHelper.INSTANCE.getItemType( heldItem );
|
||||
|
||||
// Is the item valid?
|
||||
if( itemType != AspectItemType.Invalid )
|
||||
{
|
||||
return this.onActivatedWithEssentiaContainerOrLabel( player, heldItem );
|
||||
return this.onActivateWithAspectItem( player, heldItem, itemType );
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -15,6 +15,7 @@ import thaumicenergistics.container.AbstractContainerCellTerminalBase;
|
||||
import thaumicenergistics.container.ContainerEssentiaTerminal;
|
||||
import thaumicenergistics.gui.GuiEssentiaCellTerminal;
|
||||
import thaumicenergistics.integration.tc.EssentiaItemContainerHelper;
|
||||
import thaumicenergistics.integration.tc.EssentiaItemContainerHelper.AspectItemType;
|
||||
import thaumicenergistics.registries.AEPartsEnum;
|
||||
import thaumicenergistics.texture.BlockTextureManager;
|
||||
import thaumicenergistics.util.PrivateInventory;
|
||||
@@ -69,7 +70,11 @@ public class AEPartEssentiaTerminal
|
||||
@Override
|
||||
public boolean isItemValidForSlot( final int slotId, final ItemStack itemStack )
|
||||
{
|
||||
return EssentiaItemContainerHelper.INSTANCE.isContainerOrLabel( itemStack );
|
||||
// Get the type
|
||||
AspectItemType iType = EssentiaItemContainerHelper.INSTANCE.getItemType( itemStack );
|
||||
|
||||
// True if jar or jar label
|
||||
return ( iType == AspectItemType.EssentiaContainer ) || ( iType == AspectItemType.JarLabel );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -237,7 +237,7 @@ public abstract class AbstractAEPartEssentiaIOBus
|
||||
|
||||
public boolean addFilteredAspectFromItemstack( final EntityPlayer player, final ItemStack itemStack )
|
||||
{
|
||||
Aspect itemAspect = EssentiaItemContainerHelper.INSTANCE.getAspectInContainer( itemStack );
|
||||
Aspect itemAspect = EssentiaItemContainerHelper.INSTANCE.getFilterAspectFromItem( itemStack );
|
||||
|
||||
if( itemAspect != null )
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user