diff --git a/ChangeLog.txt b/ChangeLog.txt index bbd98cea..64cedd1e 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,4 +1,8 @@ -7/20/2014 0.1.2a +7/21/2014 0.1.3a + Various bug fixes. + Code comments and cleanup + +7/20/2014 0.1.2a Essentia Providers now take on the color of the cable they are placed against. Essentia Providers will take on the color of the first cable it finds if there are not matching cables with its color. Bugfix: Incorrect lighting on essentia providers. diff --git a/src/main/java/thaumicenergistics/ThaumicEnergistics.java b/src/main/java/thaumicenergistics/ThaumicEnergistics.java index 21f71761..d2161528 100644 --- a/src/main/java/thaumicenergistics/ThaumicEnergistics.java +++ b/src/main/java/thaumicenergistics/ThaumicEnergistics.java @@ -16,29 +16,32 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.network.NetworkRegistry; -@Mod(modid = ThaumicEnergistics.MODID, name = "Thaumic Energistics", version = ThaumicEnergistics.VERSION, dependencies = "required-after:appliedenergistics2;required-after:Thaumcraft") +@Mod(modid = ThaumicEnergistics.MOD_ID, name = "Thaumic Energistics", version = ThaumicEnergistics.VERSION, dependencies = "required-after:appliedenergistics2;required-after:Thaumcraft") public class ThaumicEnergistics { /** * String ID of the mod. */ - public static final String MODID = "thaumicenergistics"; + public static final String MOD_ID = "thaumicenergistics"; /** * Current version of the mod. */ - public static final String VERSION = "0.1.2a"; + public static final String VERSION = "0.1.3a"; // Note: dont forget to change the mcmod.info file as well /** * Singleton instance */ - @Instance(value = ThaumicEnergistics.MODID) + @Instance(value = ThaumicEnergistics.MOD_ID) public static ThaumicEnergistics instance; // Says where the client and server 'proxy' code is loaded. @SidedProxy(clientSide = "thaumicenergistics.proxy.ClientProxy", serverSide = "thaumicenergistics.proxy.CommonProxy") public static CommonProxy proxy; + /** + * Creative tab that displays this mods items + */ public static CreativeTabs ModTab = new CreativeTabs( "ThaumicEnergistics" ) { diff --git a/src/main/java/thaumicenergistics/aspect/AspectStack.java b/src/main/java/thaumicenergistics/aspect/AspectStack.java index cbaba9aa..692b9b41 100644 --- a/src/main/java/thaumicenergistics/aspect/AspectStack.java +++ b/src/main/java/thaumicenergistics/aspect/AspectStack.java @@ -3,32 +3,60 @@ package thaumicenergistics.aspect; import net.minecraft.nbt.NBTTagCompound; import thaumcraft.api.aspects.Aspect; +/** + * Stores an aspect and an amount. + * @author Nividica + * + */ public class AspectStack { + /** + * Creates an aspect stack from a NBT compound tag. + * @param nbt Tag to load from + * @return Created stack, or null. + */ public static AspectStack loadAspectStackFromNBT( NBTTagCompound nbt ) { + // Attempt to get the aspect Aspect aspect = Aspect.aspects.get( nbt.getString( "AspectTag" ) ); + // Did we get an aspect? if ( aspect == null ) { return null; } + // Load the amount long amount = nbt.getLong( "Amount" ); + // Return a newly created stack. return new AspectStack( aspect, amount ); } + /** + * The aspect this stack contains. + */ public Aspect aspect; + /** + * The amount this stack contains + */ public long amount; + /** + * Creates an empty stack + */ public AspectStack() { this.aspect = null; this.amount = 0; } + /** + * Creates a stack using the specified aspect and amount. + * @param aspect What aspect this stack will have. + * @param amount How much this stack will have. + */ public AspectStack( Aspect aspect, long amount ) { this.aspect = aspect; @@ -36,6 +64,10 @@ public class AspectStack this.amount = amount; } + /** + * Sets this stacks values to match that of the specified stack. + * @param source + */ public AspectStack( AspectStack source ) { this.aspect = source.aspect; @@ -43,31 +75,74 @@ public class AspectStack this.amount = source.amount; } + /** + * Creates a copy of this stack and returns it. + * @return Copy of the stack. + */ public AspectStack copy() { return new AspectStack( this ); } + /** + * The chat color associated with this aspect. + * @return Chat prefix string, or empty string if no aspect. + */ public String getChatColor() { - return this.aspect.getChatcolor(); + // Do we have an aspect? + if( this.aspect != null ) + { + return this.aspect.getChatcolor(); + } + + return ""; } + /** + * Gets the Thaumcraft tag for the aspect + * @return Thaumcraft tag, or empty string if no aspect. + */ public String getTag() { - return this.aspect.getTag(); + // Do we have an aspect? + if( this.aspect != null ) + { + return this.aspect.getTag(); + } + + return ""; } + /** + * Gets the display name for the aspect. + * @return Aspect name, or empty string if no aspect. + */ public String getName() { - return this.aspect.getName(); + // Do we have an aspect? + if( this.aspect != null ) + { + return this.aspect.getName(); + } + + return ""; } + /** + * Writes this aspect stack to the specified NBT tag + * @param nbt The tag to write to + * @return The nbt tag. + */ public NBTTagCompound writeToNBT( NBTTagCompound nbt ) { - nbt.setString( "AspectTag", this.aspect.getTag() ); + // Do we have an aspect? + if( this.aspect != null ) + { + nbt.setString( "AspectTag", this.aspect.getTag() ); - nbt.setLong( "Amount", this.amount ); + nbt.setLong( "Amount", this.amount ); + } return nbt; } diff --git a/src/main/java/thaumicenergistics/aspect/AspectStackComparator.java b/src/main/java/thaumicenergistics/aspect/AspectStackComparator.java index 286f0aa2..24642b2a 100644 --- a/src/main/java/thaumicenergistics/aspect/AspectStackComparator.java +++ b/src/main/java/thaumicenergistics/aspect/AspectStackComparator.java @@ -2,10 +2,23 @@ package thaumicenergistics.aspect; import java.util.Comparator; +/** + * Compares one aspect stack against another. + * @author Nividica + * + */ public class AspectStackComparator implements Comparator { + /** + * Compare based on name + */ public static final int MODE_ALPHABETIC = 0; + /** + * Compare based on amount + */ + public static final int MODE_AMOUNT = 1; + public int mode; /** @@ -35,6 +48,10 @@ public class AspectStackComparator implements Comparator case AspectStackComparator.MODE_ALPHABETIC: // Compare tags return left.aspect.getTag().compareTo( right.aspect.getTag() ); + + case AspectStackComparator.MODE_AMOUNT: + // Compare amounts + return (int)( left.amount - right.amount ); } return 0; diff --git a/src/main/java/thaumicenergistics/blocks/BlockEssentiaProvider.java b/src/main/java/thaumicenergistics/blocks/BlockEssentiaProvider.java index a8d874b4..11237d36 100644 --- a/src/main/java/thaumicenergistics/blocks/BlockEssentiaProvider.java +++ b/src/main/java/thaumicenergistics/blocks/BlockEssentiaProvider.java @@ -16,10 +16,15 @@ import thaumicenergistics.tileentities.TileEssentiaProvider; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +/** + * Block definition of the essentia provider. + * @author Nividica + * + */ public class BlockEssentiaProvider extends BlockContainer { - + public BlockEssentiaProvider() { // Call super with material machine (iron) @@ -46,6 +51,7 @@ public class BlockEssentiaProvider @Override public TileEntity createNewTileEntity( World world, int metaData ) { + // Create a new provider tile, passing the side to attach to return new TileEssentiaProvider( metaData ); } diff --git a/src/main/java/thaumicenergistics/container/ContainerCellTerminalBase.java b/src/main/java/thaumicenergistics/container/ContainerCellTerminalBase.java index ac1b06a6..a5ae1481 100644 --- a/src/main/java/thaumicenergistics/container/ContainerCellTerminalBase.java +++ b/src/main/java/thaumicenergistics/container/ContainerCellTerminalBase.java @@ -21,27 +21,147 @@ import appeng.api.networking.security.BaseActionSource; import appeng.api.storage.IMEMonitor; import appeng.api.storage.IMEMonitorHandlerReceiver; import appeng.api.storage.data.IAEFluidStack; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +/** + * Base class for cell and terminal inventory containers + * + * @author Nividica + * + */ public abstract class ContainerCellTerminalBase extends ContainerWithPlayerInventory implements IMEMonitorHandlerReceiver, IAspectSelectorContainer, IInventoryUpdateReceiver { + /** + * X position for the output slot + */ + private static int OUTPUT_POSITION_X = 26; + + /** + * Y position for the output slot + */ + private static int OUTPUT_POSITION_Y = 74; + + /** + * X position for the input slot + */ + private static int INPUT_POSITION_X = 8; + + /** + * Y position for the input slot + */ + private static int INPUT_POSITION_Y = 74; + + /** + * X position for the player inventory + */ + private static int PLAYER_INV_POSITION_X = 104; + + /** + * Y position for the player inventory + */ + private static int PLAYER_INV_POSITION_Y = 162; + + /** + * The minimum amount of time to wait before playing + * sounds again. In ms. + */ + private static int MINIMUM_SOUND_WAIT = 900; + + /** + * Slot ID for the output + */ + public static int OUTPUT_SLOT_ID = 1; + + /** + * Slot ID for the input + */ + public static int INPUT_SLOT_ID = 0; + + /** + * Slot ID offset the player inventory + */ + public static int PLAYER_INV_SLOT_OFFSET = 2; + + /** + * AE network monitor + */ protected IMEMonitor monitor; + + /** + * List of aspects on the network + */ protected List aspectStackList = new ArrayList(); + + /** + * The aspect the user has selected. + */ protected Aspect selectedAspect; + + /** + * The player that owns this container. + */ protected EntityPlayer player; + + /** + * The gui associated with this container + */ protected GuiCellTerminalBase guiBase; + + /** + * Import and export inventory + */ protected PrivateInventory inventory; + + /** + * The last known stack size stored in the export slot + */ private int lastInventorySecondSlotCount = 0; + + /** + * The last time, in ms, the splashy sound played + */ private long lastSoundPlaytime = 0; + /** + * Create the container and register the owner + * + * @param player + */ public ContainerCellTerminalBase( EntityPlayer player ) { this.player = player; - + this.lastSoundPlaytime = System.currentTimeMillis(); } - + + /** + * Binds the container to the specified inventory and the players inventory. + * + * @param inventory + */ + protected void bindToInventory( PrivateInventory inventory ) + { + this.inventory = inventory; + + this.inventory.setReceiver( this ); + + this.addSlotToContainer( new SlotRespective( inventory, ContainerCellTerminalBase.INPUT_SLOT_ID, ContainerCellTerminalBase.INPUT_POSITION_X, + ContainerCellTerminalBase.INPUT_POSITION_Y ) ); + + this.addSlotToContainer( new SlotFurnace( this.player, inventory, ContainerCellTerminalBase.OUTPUT_SLOT_ID, + ContainerCellTerminalBase.OUTPUT_POSITION_X, ContainerCellTerminalBase.OUTPUT_POSITION_Y ) ); + + this.bindPlayerInventory( this.player.inventory, ContainerCellTerminalBase.PLAYER_INV_SLOT_OFFSET, + ContainerCellTerminalBase.PLAYER_INV_POSITION_X, ContainerCellTerminalBase.PLAYER_INV_POSITION_Y ); + + } + + /** + * Attach this container to the AE monitor + */ public void attachToMonitor() { if ( ( !this.player.worldObj.isRemote ) && ( this.monitor != null ) ) @@ -49,50 +169,64 @@ public abstract class ContainerCellTerminalBase this.monitor.addListener( this, null ); } } - - protected void bindToInventory( PrivateInventory inventory ) - { - this.inventory = inventory; - - this.inventory.setReceiver( this ); - - this.addSlotToContainer( new SlotRespective( inventory, 0, 8, 74 ) ); - - this.addSlotToContainer( new SlotFurnace( this.player, inventory, 1, 26, 74 ) ); - - this.bindPlayerInventory( this.player.inventory, 104, 162 ); - - } + /** + * Who can interact with the container? + */ @Override public boolean canInteractWith( EntityPlayer player ) { return true; } + /** + * Called when the GUI's aspect list needs refreshing. + */ public abstract void forceAspectUpdate(); + /** + * Gets the list of aspect stacks in the container. + * + * @return + */ public List getAspectStackList() { return this.aspectStackList; } + /** + * Get the player that owns this container + * + * @return + */ public EntityPlayer getPlayer() { return this.player; } + /** + * Gets the aspect that the player has selected. + * + * @return + */ public Aspect getSelectedAspect() { return this.selectedAspect; } + /** + * Is this container still valid for receiving updates + * from the AE monitor? + */ @Override public boolean isValid( Object verificationToken ) { return true; } + /** + * Unregister this container from the monitor. + */ @Override public void onContainerClosed( EntityPlayer player ) { @@ -106,38 +240,98 @@ public abstract class ContainerCellTerminalBase } } } - + + /** + * Called when the import or export has changed items. + */ + @Override + public void onInventoryChanged() + { + // Is this client side? + if ( this.player.worldObj.isRemote ) + { + // Get the itemstack in the output slot + ItemStack itemStack = this.inventory.getStackInSlot( ContainerCellTerminalBase.OUTPUT_SLOT_ID ); + + // Is there anything in the second slot? + if ( itemStack != null ) + { + // Has the count changed? + if ( this.lastInventorySecondSlotCount != itemStack.stackSize ) + { + // Has enough time passed to play the sound again? + if ( ( System.currentTimeMillis() - this.lastSoundPlaytime ) > ContainerCellTerminalBase.MINIMUM_SOUND_WAIT ) + { + // Play swimy sound + Minecraft.getMinecraft().getSoundHandler() + .playSound( PositionedSoundRecord.func_147674_a( new ResourceLocation( "game.neutral.swim" ), 1.0F ) ); + + // Set the playtime + this.lastSoundPlaytime = System.currentTimeMillis(); + } + + // Set the count + this.lastInventorySecondSlotCount = itemStack.stackSize; + } + } + else + { + // Reset the count + this.lastInventorySecondSlotCount = 0; + } + } + } + @Override public void onListUpdate() { + // Ignored } + /** + * Called by the AE montior when the network changes. + */ @Override public void postChange( IMEMonitor monitor, IAEFluidStack change, BaseActionSource source ) { this.aspectStackList = EssentiaConversionHelper.convertIIAEFluidStackListToAspectStackList( monitor.getStorageList() ); } + /** + * Called when the the selected aspect has changed, and that + * change has been sent via packet. + * + * @param selectedAspect + */ public abstract void receiveSelectedAspect( Aspect selectedAspect ); - - public void setGui( GuiCellTerminalBase guiCommon ) + /** + * Sets the gui associated with this container + * + * @param guiBase + */ + public void setGui( GuiCellTerminalBase guiBase ) { - if ( guiCommon != null ) + if ( guiBase != null ) { - this.guiBase = guiCommon; + this.guiBase = guiBase; } } + /** + * Called when the user clicks an aspect in the GUI + */ @Override + @SideOnly(Side.CLIENT) public abstract void setSelectedAspect( Aspect selectedAspect ); + // TODO: Fix this up, move to superclass @Override public ItemStack transferStackInSlot( EntityPlayer player, int slotnumber ) { ItemStack itemstack = null; - Slot slot = (Slot) this.inventorySlots.get( slotnumber ); + Slot slot = (Slot)this.inventorySlots.get( slotnumber ); if ( ( slot != null ) && ( slot.getHasStack() ) ) { @@ -176,6 +370,13 @@ public abstract class ContainerCellTerminalBase return itemstack; } + /** + * Called when the aspect list has changed and that + * change has been sent via packet + * + * @param aspectStackList + */ + @SideOnly(Side.CLIENT) public void updateAspectList( List aspectStackList ) { this.aspectStackList = aspectStackList; @@ -185,42 +386,5 @@ public abstract class ContainerCellTerminalBase this.guiBase.updateAspects(); } } - - - @Override - public void onInventoryChanged() - { - if( this.player.worldObj.isRemote ) - { - // Get the itemstack in the second slot - ItemStack itemStack = this.inventory.getStackInSlot( 1 ); - - // Is there anything in the second slot? - if( itemStack != null ) - { - // Has the count changed? - if( this.lastInventorySecondSlotCount != itemStack.stackSize ) - { - // Has enough time passed to play the sound again? - if( ( System.currentTimeMillis() - this.lastSoundPlaytime ) > 900 ) - { - // Play swimy sound - Minecraft.getMinecraft().getSoundHandler() - .playSound( PositionedSoundRecord.func_147674_a(new ResourceLocation("game.neutral.swim"), 1.0F) ); - - // Set the playtime - this.lastSoundPlaytime = System.currentTimeMillis(); - } - - // Set the count - this.lastInventorySecondSlotCount = itemStack.stackSize; - } - } - else - { - this.lastInventorySecondSlotCount = 0; - } - } - } } diff --git a/src/main/java/thaumicenergistics/container/ContainerEssentiaCell.java b/src/main/java/thaumicenergistics/container/ContainerEssentiaCell.java index cf5ff2db..2ca60ea8 100644 --- a/src/main/java/thaumicenergistics/container/ContainerEssentiaCell.java +++ b/src/main/java/thaumicenergistics/container/ContainerEssentiaCell.java @@ -1,5 +1,7 @@ package thaumicenergistics.container; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; @@ -20,12 +22,27 @@ import appeng.api.storage.StorageChannel; import appeng.api.storage.data.IAEFluidStack; import appeng.tile.storage.TileChest; +/** + * Inventory container for essentia cells in a ME chest. + * @author Nividica + * + */ public class ContainerEssentiaCell extends ContainerCellTerminalBase { + /** + * The aspect the player has selected. + */ private AspectStack selectedAspectStack; + + /** + * The ME chest the cell is stored in. + */ private TileChest hostChest; - private PrivateInventory privateInventory = new PrivateInventory( ThaumicEnergistics.MODID + ".item.essentia.cell.inventory", 2, 64 ) + /** + * Import and export inventory slots. + */ + private PrivateInventory privateInventory = new PrivateInventory( ThaumicEnergistics.MOD_ID + ".item.essentia.cell.inventory", 2, 64 ) { @Override public boolean isItemValidForSlot( int slotID, ItemStack itemStack ) @@ -34,6 +51,14 @@ public class ContainerEssentiaCell extends ContainerCellTerminalBase } }; + /** + * Creates the container. + * @param player The player that owns this container. + * @param world The world the ME chest is in. + * @param x X position of the ME chest. + * @param y Y position of the ME chest. + * @param z Z position of the ME chest. + */ public ContainerEssentiaCell( EntityPlayer player, World world, int x, int y, int z ) { // Call the super-constructor @@ -69,7 +94,12 @@ public class ContainerEssentiaCell extends ContainerCellTerminalBase } + /** + * Gets the current list from the AE monitor and sends + * it to the client. + */ @Override + @SideOnly(Side.SERVER) public void forceAspectUpdate() { if ( this.monitor != null ) @@ -79,6 +109,9 @@ public class ContainerEssentiaCell extends ContainerCellTerminalBase } } + /** + * Drops any items in the import and export inventory. + */ @Override public void onContainerClosed( EntityPlayer player ) { @@ -93,7 +126,11 @@ public class ContainerEssentiaCell extends ContainerCellTerminalBase } } + /** + * Updates the list of aspects, and sends that list to the client. + */ @Override + @SideOnly(Side.SERVER) public void postChange( IMEMonitor monitor, IAEFluidStack change, BaseActionSource source ) { super.postChange( monitor, change, source ); @@ -101,6 +138,9 @@ public class ContainerEssentiaCell extends ContainerCellTerminalBase new PacketClientEssentiaCell( this.player, this.aspectStackList ).sendPacketToPlayer( this.player ); } + /** + * Updates the selected aspect, aspect stack and gui. + */ @Override public void receiveSelectedAspect( Aspect selectedAspect ) { @@ -132,28 +172,43 @@ public class ContainerEssentiaCell extends ContainerCellTerminalBase } } + /** + * Gets the currently selected aspect. + * @return + */ public AspectStack getSelectedAspectStack() { return this.selectedAspectStack; } + /** + * Called when the user has clicked on an aspect. + * Sends that change to the server for validation. + */ @Override + @SideOnly(Side.CLIENT) public void setSelectedAspect( Aspect selectedAspect ) { new PacketServerEssentiaCell( this.player, selectedAspect ).sendPacketToServer(); } - - + /** + * Checks if there is any work to perform. + * If there is it does so. + */ @Override + @SideOnly(Side.SERVER) public void detectAndSendChanges() { super.detectAndSendChanges(); + // Do we have a monitor? if( this.monitor != null ) - { + { + // Is there work to do? if( EssentiaCellTerminalWorker.hasWork( this.inventory ) ) { + // Do the work EssentiaCellTerminalWorker.doWork( this.inventory, this.monitor, null, this.selectedAspect ); } } diff --git a/src/main/java/thaumicenergistics/container/ContainerEssentiaTerminal.java b/src/main/java/thaumicenergistics/container/ContainerEssentiaTerminal.java index 466f3aec..14b29a2a 100644 --- a/src/main/java/thaumicenergistics/container/ContainerEssentiaTerminal.java +++ b/src/main/java/thaumicenergistics/container/ContainerEssentiaTerminal.java @@ -1,5 +1,7 @@ package thaumicenergistics.container; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.player.EntityPlayer; import thaumcraft.api.aspects.Aspect; import thaumicenergistics.network.packet.PacketClientEssentiaTerminal; @@ -12,33 +14,63 @@ import appeng.api.networking.security.MachineSource; import appeng.api.storage.IMEMonitor; import appeng.api.storage.data.IAEFluidStack; +/** + * Inventory container for the essentia terminal. + * @author Nividica + * + */ public class ContainerEssentiaTerminal extends ContainerCellTerminalBase { + /** + * The terminal this is associated with. + */ private AEPartEssentiaTerminal terminal = null; + + /** + * The AE machine source representation of the terminal. + */ private MachineSource machineSource = null; + /** + * Creates the container + * @param terminal Parent terminal. + * @param player Player that owns this container. + */ public ContainerEssentiaTerminal( AEPartEssentiaTerminal terminal, EntityPlayer player ) { + // Call the super super( player ); + // Set the terminal this.terminal = terminal; + // Get and set the machine source this.machineSource = terminal.getTerminalMachineSource(); + // Is this server side? if ( !player.worldObj.isRemote ) { + // Get the monitor this.monitor = terminal.getGridBlock().getFluidMonitor(); + // Attach to the monitor this.attachToMonitor(); + // Add this container to the terminal's list terminal.addContainer( this ); } + // Bind our inventory this.bindToInventory( terminal.getInventory() ); } + /** + * Gets the current list from the AE monitor and sends + * it to the client. + */ @Override + @SideOnly(Side.SERVER) public void forceAspectUpdate() { if ( this.monitor != null ) @@ -48,6 +80,9 @@ public class ContainerEssentiaTerminal } } + /** + * Removes this container from the terminal. + */ @Override public void onContainerClosed( EntityPlayer player ) { @@ -59,7 +94,11 @@ public class ContainerEssentiaTerminal } } + /** + * Updates the list of aspects, and sends that list to the client. + */ @Override + @SideOnly(Side.SERVER) public void postChange( IMEMonitor monitor, IAEFluidStack change, BaseActionSource source ) { super.postChange( monitor, change, source ); @@ -67,6 +106,9 @@ public class ContainerEssentiaTerminal new PacketClientEssentiaTerminal( this.player, this.aspectStackList ).sendPacketToPlayer( this.player ); } + /** + * Updates the selected aspect and gui. + */ @Override public void receiveSelectedAspect( Aspect selectedAspect ) { @@ -86,24 +128,52 @@ public class ContainerEssentiaTerminal } } + /** + * Called when the user has clicked on an aspect. + * Sends that change to the server for validation. + */ @Override + @SideOnly(Side.CLIENT) public void setSelectedAspect( Aspect selectedAspect ) { new PacketServerEssentiaTerminal( this.player, selectedAspect ).sendPacketToServer(); } + /** + * Checks if there is any work to perform. + * If there is it does so. + */ @Override + @SideOnly(Side.SERVER) public void detectAndSendChanges() { super.detectAndSendChanges(); - // TODO: locks on terminal tile to prevent CME's - + // Do we have a monitor if( this.monitor != null ) { - if( EssentiaCellTerminalWorker.hasWork( this.inventory ) ) + + // Can we lock the inventory? + if( this.terminal.lockInventoryForWork() ) { - EssentiaCellTerminalWorker.doWork( this.inventory, this.monitor, this.machineSource, this.selectedAspect ); + // Try block ensures lock gets released. + try + { + // Do we have work to do? + if( EssentiaCellTerminalWorker.hasWork( this.inventory ) ) + { + // Do the work. + EssentiaCellTerminalWorker.doWork( this.inventory, this.monitor, this.machineSource, this.selectedAspect ); + } + } + catch( Exception e ) + { + } + finally + { + // Release the lock. + this.terminal.unlockInventory(); + } } } } diff --git a/src/main/java/thaumicenergistics/container/ContainerPartEssentiaEmitter.java b/src/main/java/thaumicenergistics/container/ContainerPartEssentiaEmitter.java index da6d9ba3..a88402e3 100644 --- a/src/main/java/thaumicenergistics/container/ContainerPartEssentiaEmitter.java +++ b/src/main/java/thaumicenergistics/container/ContainerPartEssentiaEmitter.java @@ -4,25 +4,59 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -public class ContainerPartEssentiaEmitter extends ContainerWithPlayerInventory +/** + * Inventory container for essentia emitter. + * + * @author Nividica + * + */ +public class ContainerPartEssentiaEmitter + extends ContainerWithPlayerInventory { - public ContainerPartEssentiaEmitter(EntityPlayer player) + /** + * X position for the player inventory + */ + private static int PLAYER_INV_POSITION_X = 93; + + /** + * Y position for the player inventory + */ + private static int PLAYER_INV_POSITION_Y = 151; + + /** + * Slot ID offset the player inventory + */ + public static int PLAYER_INV_SLOT_OFFSET = 0; + + /** + * Create the container. + * + * @param player + * The owner of this container. + */ + public ContainerPartEssentiaEmitter( EntityPlayer player ) { - this.bindPlayerInventory( player.inventory, 93, 151 ); + // Get the players inventory and bind it to the container. + this.bindPlayerInventory( player.inventory, ContainerPartEssentiaEmitter.PLAYER_INV_SLOT_OFFSET, ContainerPartEssentiaEmitter.PLAYER_INV_POSITION_X, + ContainerPartEssentiaEmitter.PLAYER_INV_POSITION_Y ); } + /** + * Who can interact with the container? + */ @Override public boolean canInteractWith( EntityPlayer player ) { return true; } + // TODO: Fix this up, move to superclass @Override public ItemStack transferStackInSlot( EntityPlayer player, int slotNumber ) { ItemStack itemStack = null; - Slot slot = (Slot) this.inventorySlots.get( slotNumber ); + Slot slot = (Slot)this.inventorySlots.get( slotNumber ); if ( ( slot != null ) && ( slot.getHasStack() ) ) { @@ -34,11 +68,11 @@ public class ContainerPartEssentiaEmitter extends ContainerWithPlayerInventory if ( slotNumber == 0 ) { - ( (Slot) this.inventorySlots.get( 0 ) ).putStack( null ); + ( (Slot)this.inventorySlots.get( 0 ) ).putStack( null ); } else if ( ( slotNumber >= 1 ) && ( slotNumber <= 36 ) ) { - ( (Slot) this.inventorySlots.get( 0 ) ).putStack( itemStack ); + ( (Slot)this.inventorySlots.get( 0 ) ).putStack( itemStack ); } } diff --git a/src/main/java/thaumicenergistics/container/ContainerPartEssentiaIOBus.java b/src/main/java/thaumicenergistics/container/ContainerPartEssentiaIOBus.java index 2c00df4b..2df5be2b 100644 --- a/src/main/java/thaumicenergistics/container/ContainerPartEssentiaIOBus.java +++ b/src/main/java/thaumicenergistics/container/ContainerPartEssentiaIOBus.java @@ -1,80 +1,123 @@ package thaumicenergistics.container; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import thaumicenergistics.container.slot.SlotNetworkTool; import thaumicenergistics.container.slot.SlotRespective; import thaumicenergistics.gui.GuiEssentiatIO; import thaumicenergistics.parts.AEPartEssentiaIO; -import appeng.api.AEApi; -import appeng.api.implementations.guiobjects.IGuiItem; -import appeng.api.implementations.guiobjects.INetworkTool; -import appeng.api.util.DimensionalCoord; -public class ContainerPartEssentiaIOBus extends ContainerWithPlayerInventory +/** + * Inventory container for the import and export busses. + * + * @author Nividica + * + */ +public class ContainerPartEssentiaIOBus + extends ContainerWithNetworkTool { + /** + * The number of upgrade slots we have + */ + private static int NUMBER_OF_UPGRADE_SLOTS = 4; + + /** + * The x position of the upgrade slots + */ + private static int UPGRADE_X_POS = 187; + + /** + * The starting Y position for the upgrade slots + */ + private static int UPGRADE_Y_OFFSET = 8; + + /** + * How far apart each slot should be drawn + */ + private static int UPGRADE_Y_MULTIPLIER = 18; + + /** + * X position for the player inventory + */ + private static int PLAYER_INV_POSITION_X = 102; + + /** + * Y position for the player inventory + */ + private static int PLAYER_INV_POSITION_Y = 160; + + /** + * Slot ID offset the player inventory + */ + public static int PLAYER_INV_SLOT_OFFSET = 9; + private GuiEssentiatIO guiBusAspectIO; - public ContainerPartEssentiaIOBus(AEPartEssentiaIO part, EntityPlayer player) + /** + * Creates the container. + * + * @param part + * The AE part associated with the container. + * @param player + * The owner of the container. + */ + public ContainerPartEssentiaIOBus( AEPartEssentiaIO part, EntityPlayer player ) { - for( int i = 0; i < 4; i++ ) + // Add the upgrade slots + for( int slotIndex = 0; slotIndex < ContainerPartEssentiaIOBus.NUMBER_OF_UPGRADE_SLOTS; slotIndex++ ) { - this.addSlotToContainer( new SlotRespective( part.getUpgradeInventory(), i, 187, ( i * 18 ) + 8 ) ); + this.addSlotToContainer( new SlotRespective( part.getUpgradeInventory(), slotIndex, ContainerPartEssentiaIOBus.UPGRADE_X_POS, + ContainerPartEssentiaIOBus.UPGRADE_Y_OFFSET + ( slotIndex * ContainerPartEssentiaIOBus.UPGRADE_Y_MULTIPLIER ) ) ); } - this.bindPlayerInventory( player.inventory, 102, 160 ); + // Bind to the player's inventory + this.bindPlayerInventory( player.inventory, ContainerPartEssentiaIOBus.PLAYER_INV_SLOT_OFFSET, + ContainerPartEssentiaIOBus.PLAYER_INV_POSITION_X, ContainerPartEssentiaIOBus.PLAYER_INV_POSITION_Y ); - for( int i = 0; i < player.inventory.getSizeInventory(); i++ ) - { - ItemStack stack = player.inventory.getStackInSlot( i ); - - if ( ( stack != null ) && ( stack.isItemEqual( AEApi.instance().items().itemNetworkTool.stack( 1 ) ) ) ) - { - DimensionalCoord coord = part.getHost().getLocation(); - - IGuiItem guiItem = (IGuiItem) stack.getItem(); - - INetworkTool networkTool = (INetworkTool) guiItem.getGuiObject( stack, coord.getWorld(), coord.x, coord.y, coord.z ); - - for( int j = 0; j < 3; j++ ) - { - for( int k = 0; k < 3; k++ ) - { - this.addSlotToContainer( new SlotNetworkTool( networkTool, j + ( k * 3 ), 187 + ( k * 18 ), ( j * 18 ) + 102 ) ); - } - } - } - } + // Bind to the network tool + this.bindToNetworkTool( player.inventory, part.getHost().getLocation() ); } @Override protected void retrySlotClick( int par1, int par2, boolean par3, EntityPlayer player ) { + // Ignored } + /** + * Who can interact with the container? + */ @Override public boolean canInteractWith( EntityPlayer player ) { return true; } + /** + * Sets the gui associated with this container + * + * @param gui + */ + @SideOnly(Side.CLIENT) public void setGui( GuiEssentiatIO gui ) { this.guiBusAspectIO = gui; } + // TODO: Fix this up, move to superclass @Override public ItemStack transferStackInSlot( EntityPlayer player, int slotId ) - { + { if ( ( this.guiBusAspectIO != null ) && ( this.guiBusAspectIO.shiftClick( this.getSlot( slotId ).getStack() ) ) ) { - return ( (Slot) this.inventorySlots.get( slotId ) ).getStack(); + return ( (Slot)this.inventorySlots.get( slotId ) ).getStack(); } ItemStack itemStack = null; - Slot slot = (Slot) this.inventorySlots.get( slotId ); + Slot slot = (Slot)this.inventorySlots.get( slotId ); if ( ( slot != null ) && ( slot.getHasStack() ) ) { diff --git a/src/main/java/thaumicenergistics/container/ContainerPartEssentiaStorageBus.java b/src/main/java/thaumicenergistics/container/ContainerPartEssentiaStorageBus.java index 898adb7a..0d623d86 100644 --- a/src/main/java/thaumicenergistics/container/ContainerPartEssentiaStorageBus.java +++ b/src/main/java/thaumicenergistics/container/ContainerPartEssentiaStorageBus.java @@ -3,63 +3,64 @@ package thaumicenergistics.container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import thaumicenergistics.container.slot.SlotNetworkTool; import thaumicenergistics.container.slot.SlotRespective; import thaumicenergistics.gui.GuiEssentiaStorageBus; import thaumicenergistics.parts.AEPartEssentiaStorageBus; -import appeng.api.AEApi; -import appeng.api.implementations.guiobjects.IGuiItem; -import appeng.api.implementations.guiobjects.INetworkTool; -import appeng.api.util.DimensionalCoord; -public class ContainerPartEssentiaStorageBus extends ContainerWithPlayerInventory +public class ContainerPartEssentiaStorageBus + extends ContainerWithNetworkTool { + /** + * X position offset for upgrade slots + */ + private static final int UPGRADE_SLOT_X = 187; + + /** + * Y position offset for upgrade slots + */ + private static final int UPGRADE_SLOT_Y = 8; + + /** + * Slot ID offset the player inventory + */ + public static int PLAYER_INV_SLOT_OFFSET = 9; private GuiEssentiaStorageBus guiBusAspectStorage; - public ContainerPartEssentiaStorageBus(AEPartEssentiaStorageBus part, EntityPlayer player) + public ContainerPartEssentiaStorageBus( AEPartEssentiaStorageBus part, EntityPlayer player ) { - this.addSlotToContainer( new SlotRespective( part.getUpgradeInventory(), 0, 187, 8 ) ); + // Add the upgrade slot + this.addSlotToContainer( new SlotRespective( part.getUpgradeInventory(), 0, ContainerPartEssentiaStorageBus.UPGRADE_SLOT_X, + ContainerPartEssentiaStorageBus.UPGRADE_SLOT_Y ) ); - this.bindPlayerInventory( player.inventory, 140, 198 ); + // Bind to the player's inventory + this.bindPlayerInventory( player.inventory, ContainerPartEssentiaStorageBus.PLAYER_INV_SLOT_OFFSET, 140, 198 ); - for( int i = 0; i < player.inventory.getSizeInventory(); i++ ) - { - ItemStack stack = player.inventory.getStackInSlot( i ); - - if ( ( stack != null ) && ( stack.isItemEqual( AEApi.instance().items().itemNetworkTool.stack( 1 ) ) ) ) - { - DimensionalCoord coord = part.getHost().getLocation(); - - IGuiItem guiItem = (IGuiItem) stack.getItem(); - - INetworkTool networkTool = (INetworkTool) guiItem.getGuiObject( stack, coord.getWorld(), coord.x, coord.y, coord.z ); - - for( int j = 0; j < 3; j++ ) - { - for( int k = 0; k < 3; k++ ) - { - this.addSlotToContainer( new SlotNetworkTool( networkTool, j + ( k * 3 ), 187 + ( k * 18 ), ( j * 18 ) + 102 ) ); - } - } - - return; - } - } + // Bind to the network tool + this.bindToNetworkTool( player.inventory, part.getHost().getLocation() ); } + /** + * Who can interact with the container? + */ @Override public boolean canInteractWith( EntityPlayer player ) { return true; } + /** + * Set the gui associated with this container + * + * @param guiBusAspectStorage + */ public void setGui( GuiEssentiaStorageBus guiBusAspectStorage ) { this.guiBusAspectStorage = guiBusAspectStorage; } + // TODO: Fix and superclass @Override public ItemStack transferStackInSlot( EntityPlayer player, int slotnumber ) { @@ -70,7 +71,7 @@ public class ContainerPartEssentiaStorageBus extends ContainerWithPlayerInventor ItemStack itemstack = null; - Slot slot = (Slot) this.inventorySlots.get( slotnumber ); + Slot slot = (Slot)this.inventorySlots.get( slotnumber ); if ( ( slot != null ) && ( slot.getHasStack() ) ) { diff --git a/src/main/java/thaumicenergistics/container/ContainerWithNetworkTool.java b/src/main/java/thaumicenergistics/container/ContainerWithNetworkTool.java new file mode 100644 index 00000000..4c960eb7 --- /dev/null +++ b/src/main/java/thaumicenergistics/container/ContainerWithNetworkTool.java @@ -0,0 +1,77 @@ +package thaumicenergistics.container; + +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import thaumicenergistics.container.slot.SlotNetworkTool; +import appeng.api.AEApi; +import appeng.api.implementations.guiobjects.IGuiItem; +import appeng.api.implementations.guiobjects.INetworkTool; +import appeng.api.util.DimensionalCoord; + +/** + * Container that shows the network tool and player inventory. + * @author Nividica + * + */ +public abstract class ContainerWithNetworkTool + extends ContainerWithPlayerInventory +{ + /** + * Number of rows in the network tool + */ + private static final int TOOL_ROWS = 3; + + /** + * Number of columns in the network tool + */ + private static final int TOOL_COLUMNS = 3; + + + /** + * X position to start drawing slots + */ + private static final int SLOT_X_OFFSET = 187; + + /** + * Y position to start drawing slots + */ + private static final int SLOT_Y_OFFSET = 102; + + protected void bindToNetworkTool( InventoryPlayer playerInventory, DimensionalCoord partLocation ) + { + // Check the player inventory for the network tool + for( int slotIndex = 0; slotIndex < playerInventory.getSizeInventory(); slotIndex++ ) + { + // Get the item in the current slot + ItemStack stack = playerInventory.getStackInSlot( slotIndex ); + + // Is it the network tool? + if ( ( stack != null ) && ( stack.isItemEqual( AEApi.instance().items().itemNetworkTool.stack( 1 ) ) ) ) + { + // Get the gui item for the tool + IGuiItem guiItem = (IGuiItem)stack.getItem(); + + // Get the gui for the tool + INetworkTool networkTool = (INetworkTool)guiItem.getGuiObject( stack, partLocation.getWorld(), partLocation.x, partLocation.y, + partLocation.z ); + + // Add a slot for each network tool slot + for( int column = 0; column < ContainerWithNetworkTool.TOOL_COLUMNS; column++ ) + { + for( int row = 0; row < ContainerWithNetworkTool.TOOL_ROWS; row++ ) + { + // Calculate the tools slot index + int slotToolIndex = column + ( row * ContainerWithNetworkTool.TOOL_COLUMNS ); + + this.addSlotToContainer( new SlotNetworkTool( networkTool, slotToolIndex, ContainerWithNetworkTool.SLOT_X_OFFSET + + ( column * ContainerWithPlayerInventory.SLOT_SIZE ), ( row * ContainerWithPlayerInventory.SLOT_SIZE ) + + ContainerWithNetworkTool.SLOT_Y_OFFSET ) ); + } + } + + // Done + return; + } + } + } +} diff --git a/src/main/java/thaumicenergistics/container/ContainerWithPlayerInventory.java b/src/main/java/thaumicenergistics/container/ContainerWithPlayerInventory.java index 978944f5..23a7a29e 100644 --- a/src/main/java/thaumicenergistics/container/ContainerWithPlayerInventory.java +++ b/src/main/java/thaumicenergistics/container/ContainerWithPlayerInventory.java @@ -1,31 +1,59 @@ package thaumicenergistics.container; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; -public abstract class ContainerWithPlayerInventory extends Container +public abstract class ContainerWithPlayerInventory + extends Container { - protected void bindPlayerInventory( IInventory playerInventory, int inventoryOffsetY, int hotbarPositionY ) + /** + * The number of rows in the player inventory + */ + private static int ROWS = 3; + + /** + * The number of columns in the player inventory + */ + private static int COLUMNS = 9; + + /** + * The width and height of the slots + */ + protected static final int SLOT_SIZE = 18; + + /** + * X position offset for inventory slots + */ + private static final int INVENTORY_X_OFFSET = 8; + + /** + * Binds the player inventory to this container. + * @param playerInventory Inventory to bind + * @param indexOffset The first player slot will take this id + * @param inventoryOffsetY The Y position offset for the slots + * @param hotbarPositionY The Y position offset for hotbar slots + */ + protected void bindPlayerInventory( IInventory playerInventory, int indexOffset, int inventoryOffsetY, int hotbarPositionY ) { + // Main inventory - for( int i = 0; i < 3; i++ ) + for( int row = 0; row < ContainerWithPlayerInventory.ROWS; row++ ) { - for( int j = 0; j < 9; j++ ) + for( int column = 0; column < ContainerWithPlayerInventory.COLUMNS; column++ ) { - this.addSlotToContainer( new Slot( playerInventory, j + ( i * 9 ) + 9, 8 + ( j * 18 ), ( i * 18 ) + inventoryOffsetY ) ); + this.addSlotToContainer( new Slot( playerInventory, indexOffset + ( column + ( row * ContainerWithPlayerInventory.COLUMNS ) ), + ContainerWithPlayerInventory.INVENTORY_X_OFFSET + ( column * ContainerWithPlayerInventory.SLOT_SIZE ), + ( row * ContainerWithPlayerInventory.SLOT_SIZE ) + inventoryOffsetY ) ); } } // Hot-bar - for( int i = 0; i < 9; i++ ) + for( int column = 0; column < ContainerWithPlayerInventory.COLUMNS; column++ ) { - this.addSlotToContainer( new Slot( playerInventory, i, 8 + ( i * 18 ), hotbarPositionY ) ); + this.addSlotToContainer( new Slot( playerInventory, column, ContainerWithPlayerInventory.INVENTORY_X_OFFSET + + ( column * ContainerWithPlayerInventory.SLOT_SIZE ), hotbarPositionY ) ); } } - @Override - public abstract boolean canInteractWith( EntityPlayer player ); - } diff --git a/src/main/java/thaumicenergistics/container/slot/SlotNetworkTool.java b/src/main/java/thaumicenergistics/container/slot/SlotNetworkTool.java index 20a0711f..7cf258f7 100644 --- a/src/main/java/thaumicenergistics/container/slot/SlotNetworkTool.java +++ b/src/main/java/thaumicenergistics/container/slot/SlotNetworkTool.java @@ -7,31 +7,56 @@ import net.minecraft.item.ItemStack; import appeng.api.implementations.guiobjects.INetworkTool; import appeng.api.implementations.items.IUpgradeModule; +/** + * Represents a slot in the network tool + * @author Nividica + * + */ public class SlotNetworkTool extends Slot { + /** + * Inventory of the network tool we are bound to + */ IInventory inventory; + /** + * Creates the slot. + * @param inventory The inventory of the network tool. + * @param slotIndex Index of the slot + * @param xDisplayPosition X position of the slot + * @param yDisplayPosition Y position of the slot + */ public SlotNetworkTool( INetworkTool inventory, int slotIndex, int xDisplayPosition, int yDisplayPosition ) { + // Pass to super super( inventory, slotIndex, xDisplayPosition, yDisplayPosition ); + // Set the inventory this.inventory = inventory; } + /** + * Called to see if an item can go in this inventory + */ @Override public boolean isItemValid( ItemStack itemStack ) { + // Is the itemstack valid? if ( itemStack != null ) { + // Get the item Item item = itemStack.getItem(); + // Is the item an upgrade card? if ( item instanceof IUpgradeModule ) { + // True if a valid upgrade return ( (IUpgradeModule)item ).getType( itemStack ) != null; } } + // Not an upgrade or invalid itemstack return false; } diff --git a/src/main/java/thaumicenergistics/container/slot/SlotRespective.java b/src/main/java/thaumicenergistics/container/slot/SlotRespective.java index 9227ee0b..8dddf52e 100644 --- a/src/main/java/thaumicenergistics/container/slot/SlotRespective.java +++ b/src/main/java/thaumicenergistics/container/slot/SlotRespective.java @@ -4,17 +4,37 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +/** + * Wrapper class to pass validation to inventory + * @author Nividica + * + */ public class SlotRespective extends Slot { + /** + * The inventory we belong to + */ IInventory inventory; + /** + * Create the slot. + * @param inventory Inventory it belongs to. + * @param index Index of the slot + * @param x X position of the slot + * @param y Y position of the slot + */ public SlotRespective(IInventory inventory, int index, int x, int y) { + // Pass to super super( inventory, index, x, y ); + // Set the inventory this.inventory = inventory; } + /** + * Pass the is valid call to the inventory. + */ @Override public boolean isItemValid( ItemStack itemstack ) { diff --git a/src/main/java/thaumicenergistics/fluids/GaseousEssentia.java b/src/main/java/thaumicenergistics/fluids/GaseousEssentia.java index ec5d9c85..3b2374ae 100644 --- a/src/main/java/thaumicenergistics/fluids/GaseousEssentia.java +++ b/src/main/java/thaumicenergistics/fluids/GaseousEssentia.java @@ -9,10 +9,57 @@ import thaumcraft.api.aspects.Aspect; import thaumicenergistics.ThaumicEnergistics; import cpw.mods.fml.common.FMLLog; -public class GaseousEssentia extends Fluid +/** + * A fluid which represents the gas form of an essentia. + * + * @author Nividica + * + */ +public class GaseousEssentia + extends Fluid { + /** + * List of all created gasses. + */ public static LinkedHashMap gasList = new LinkedHashMap(); + /** + * The aspect the gas is based off of. + */ + private Aspect associatedAspect; + + /** + * Creates the gas. + * @param gasName Name of the gas displayed to the user + * @param aspect The aspect the gas is based off of. + */ + private GaseousEssentia( String gasName, Aspect aspect ) + { + // Pass to super + super( gasName ); + + // Set the aspect + this.associatedAspect = aspect; + + // Gas slightly glows + this.setLuminosity( 7 ); + + // Negative density, it floats away! + this.setDensity( -4 ); + + // Flow speed, 3x slower than water + this.setViscosity( 3000 ); + + // This is a gas, adjusts the render pass. + this.setGaseous( true ); + + } + + /** + * Creates a gas based on the specified aspect + * + * @param aspect + */ private static void create( Aspect aspect ) { // Ensure this has not already been register @@ -37,16 +84,25 @@ public class GaseousEssentia extends Fluid else { //TODO: format string - FMLLog.warning( "", ThaumicEnergistics.MODID + ": Unable to register '" + aspect.getTag() + "' as fluid." ); + FMLLog.warning( "", ThaumicEnergistics.MOD_ID + ": Unable to register '" + aspect.getTag() + "' as fluid." ); } } + /** + * Gets the gas form of the specified aspect + * + * @param aspect + * @return + */ public static GaseousEssentia getGasFromAspect( Aspect aspect ) { return GaseousEssentia.gasList.get( aspect ); } + /** + * Called from load to register all gas types with the game. + */ public static void registerGases() { // Create a gas for each essentia type @@ -61,29 +117,18 @@ public class GaseousEssentia extends Fluid } - private Aspect associatedAspect; - - private GaseousEssentia(String gasName, Aspect aspect) - { - super( gasName ); - - this.associatedAspect = aspect; - - this.setLuminosity( 7 ); - - this.setDensity( -4 ); - - this.setViscosity( 3000 ); - - this.setGaseous( true ); - - } - + /** + * Get the aspect this gas is based off of. + * @return + */ public Aspect getAssociatedAspect() { return this.associatedAspect; } + /** + * Gets the color of the gas. + */ @Override public int getColor() { @@ -95,6 +140,9 @@ public class GaseousEssentia extends Fluid return super.getColor(); } + /** + * Gets the localized version of the gasses name. + */ @Override public String getLocalizedName() { diff --git a/src/main/java/thaumicenergistics/grid/AEPartGridBlock.java b/src/main/java/thaumicenergistics/grid/AEPartGridBlock.java index 1247d849..977f311c 100644 --- a/src/main/java/thaumicenergistics/grid/AEPartGridBlock.java +++ b/src/main/java/thaumicenergistics/grid/AEPartGridBlock.java @@ -17,92 +17,157 @@ import appeng.api.storage.data.IAEFluidStack; import appeng.api.util.AEColor; import appeng.api.util.DimensionalCoord; +/** + * AE Gridblock used for all my AE parts. + * @author Nividica + * + */ public class AEPartGridBlock implements IGridBlock { - + /** + * The color of the grid we are attached to + */ protected AEColor gridColor; + + /** + * The grid we are attached to + */ protected IGrid grid; + + /** + * The number of channels used in the grid? I think. + */ protected int usedChannels; - protected AEPartBase partHost; + + /** + * The part using this gridblock. + */ + protected AEPartBase part; - public AEPartGridBlock(AEPartBase partHost) + /** + * Create the gridblock for the specified part. + * @param part + */ + public AEPartGridBlock(AEPartBase part) { - this.partHost = partHost; + this.part = part; } @Override public EnumSet getConnectableSides() { + // Ignored. return null; } + /** + * Return that we require a channel to function. + */ @Override public EnumSet getFlags() { return EnumSet.of( GridFlags.REQUIRE_CHANNEL ); } + /** + * Gets the AE fluid monitor for the grid. + * @return Monitor if valid grid, null otherwise. + */ public IMEMonitor getFluidMonitor() { - IGridNode node = this.partHost.getGridNode(); + // Get the grid node + IGridNode node = this.part.getGridNode(); + // Do we have a grid node? if ( node == null ) { return null; } + // Get the grid. IGrid grid = node.getGrid(); + // Do we have a grid? if ( grid == null ) { return null; } + // Get the storage grid from the cache. IStorageGrid storageGrid = (IStorageGrid) grid.getCache( IStorageGrid.class ); + // Do we have a storage grid? if ( storageGrid == null ) { return null; } + // Return the storage grid's fluid monitor. return storageGrid.getFluidInventory(); } + /** + * Returns the color of the grid. + */ @Override public AEColor getGridColor() { - return this.gridColor; + // Do we have a grid color? + if( this.gridColor != null ) + { + // Return the grid color + return this.gridColor; + } + + // Invalid color, return transparent. + return AEColor.Transparent; } + /** + * Gets how much power the part is using. + */ @Override public double getIdlePowerUsage() { - return this.partHost.getPowerUsage(); + return this.part.getPowerUsage(); } + /** + * Gets the location of the part. + */ @Override public DimensionalCoord getLocation() { - return this.partHost.getLocation(); + return this.part.getLocation(); } + /** + * Gets the part + */ @Override public IGridHost getMachine() { - return this.partHost; + return this.part; } + /** + * Gets the an itemstack based on the parts state. + */ @Override public ItemStack getMachineRepresentation() { - return this.partHost.getItemStack( PartItemStack.Network ); + return this.part.getItemStack( PartItemStack.Network ); } @Override public void gridChanged() { + // Ignored } + /** + * Parts are not world accessable + */ @Override public boolean isWorldAccessable() { @@ -110,14 +175,21 @@ public class AEPartGridBlock implements IGridBlock } @Override - public void onGridNotification( GridNotification arg0 ) + public void onGridNotification( GridNotification notification ) { + // Ignored } + /** + * Called to update the grid and the channels used. + */ @Override public final void setNetworkStatus( IGrid grid, int usedChannels ) { + // Set the grid. this.grid = grid; + + // Set the channels used. this.usedChannels = usedChannels; } diff --git a/src/main/java/thaumicenergistics/gui/GuiCellTerminalBase.java b/src/main/java/thaumicenergistics/gui/GuiCellTerminalBase.java index 01071f41..fb29aed0 100644 --- a/src/main/java/thaumicenergistics/gui/GuiCellTerminalBase.java +++ b/src/main/java/thaumicenergistics/gui/GuiCellTerminalBase.java @@ -134,7 +134,7 @@ public class GuiCellTerminalBase @Override protected void drawGuiContainerForegroundLayer( int mouseX, int mouseY ) { - this.fontRendererObj.drawString( StatCollector.translateToLocal( ThaumicEnergistics.MODID + ".aeparts.essentia.terminal.name" ), 9, -12, 0 ); + this.fontRendererObj.drawString( StatCollector.translateToLocal( ThaumicEnergistics.MOD_ID + ".aeparts.essentia.terminal.name" ), 9, -12, 0 ); this.drawWidgets( mouseX, mouseY ); @@ -146,10 +146,10 @@ public class GuiCellTerminalBase String aspectName = this.currentAspect.aspect.getName(); - this.fontRendererObj.drawString( StatCollector.translateToLocal( ThaumicEnergistics.MODID + ".tooltip.amount" ) + ": " + amountToText, + this.fontRendererObj.drawString( StatCollector.translateToLocal( ThaumicEnergistics.MOD_ID + ".tooltip.amount" ) + ": " + amountToText, 45, 83, 0 ); - this.fontRendererObj.drawString( StatCollector.translateToLocal( ThaumicEnergistics.MODID + ".tooltip.aspect" ) + ": " + aspectName, 45, + this.fontRendererObj.drawString( StatCollector.translateToLocal( ThaumicEnergistics.MOD_ID + ".tooltip.aspect" ) + ": " + aspectName, 45, 73, 0 ); } } diff --git a/src/main/java/thaumicenergistics/gui/widget/WidgetRedstoneModes.java b/src/main/java/thaumicenergistics/gui/widget/WidgetRedstoneModes.java index 4c2c088f..1715bd5d 100644 --- a/src/main/java/thaumicenergistics/gui/widget/WidgetRedstoneModes.java +++ b/src/main/java/thaumicenergistics/gui/widget/WidgetRedstoneModes.java @@ -18,7 +18,7 @@ import com.google.common.base.Splitter; public class WidgetRedstoneModes extends GuiButton { private static final String GUI_TEXTURE_PATH = "textures/gui/redstonemodes.png"; - private static final ResourceLocation GUI_TEXTURE_RESOURCE = new ResourceLocation( ThaumicEnergistics.MODID, GUI_TEXTURE_PATH ); + private static final ResourceLocation GUI_TEXTURE_RESOURCE = new ResourceLocation( ThaumicEnergistics.MOD_ID, GUI_TEXTURE_PATH ); private RedstoneMode redstoneMode; private boolean emitter = false; diff --git a/src/main/java/thaumicenergistics/items/ItemAEPart.java b/src/main/java/thaumicenergistics/items/ItemAEPart.java index 9239bd03..12de4c04 100644 --- a/src/main/java/thaumicenergistics/items/ItemAEPart.java +++ b/src/main/java/thaumicenergistics/items/ItemAEPart.java @@ -63,7 +63,7 @@ public class ItemAEPart extends Item implements IPartItem, IItemGroup catch( Throwable e ) { // Bad stuff, log the error. - FMLLog.severe( ThaumicEnergistics.MODID + ": Unable to create part from item " + itemStack.getDisplayName() ); + FMLLog.severe( ThaumicEnergistics.MOD_ID + ": Unable to create part from item " + itemStack.getDisplayName() ); // Print that stack-trace e.printStackTrace(); diff --git a/src/main/java/thaumicenergistics/items/ItemEssentiaCell.java b/src/main/java/thaumicenergistics/items/ItemEssentiaCell.java index 938f6ed5..85bf4b5b 100644 --- a/src/main/java/thaumicenergistics/items/ItemEssentiaCell.java +++ b/src/main/java/thaumicenergistics/items/ItemEssentiaCell.java @@ -91,7 +91,7 @@ public class ItemEssentiaCell @Override public String getUnlocalizedName( ItemStack itemStack ) { - return ThaumicEnergistics.MODID + ".item.essentia.cell." + SUFFIXES[itemStack.getItemDamage()]; + return ThaumicEnergistics.MOD_ID + ".item.essentia.cell." + SUFFIXES[itemStack.getItemDamage()]; } @Override @@ -110,11 +110,11 @@ public class ItemEssentiaCell HandlerItemEssentiaCell cellHandler = (HandlerItemEssentiaCell)handler; // Create the bytes tooltip - String bytesTip = String.format( StatCollector.translateToLocal( ThaumicEnergistics.MODID + ".tooltip.essentia.cell.bytes" ), + String bytesTip = String.format( StatCollector.translateToLocal( ThaumicEnergistics.MOD_ID + ".tooltip.essentia.cell.bytes" ), new Object[] { cellHandler.usedBytes() / ItemEssentiaCell.CONVERSION_SIZE, cellHandler.totalBytes() / ItemEssentiaCell.CONVERSION_SIZE } ); // Create the types tooltip - String typesTip = String.format( StatCollector.translateToLocal( ThaumicEnergistics.MODID + ".tooltip.essentia.cell.types" ), + String typesTip = String.format( StatCollector.translateToLocal( ThaumicEnergistics.MOD_ID + ".tooltip.essentia.cell.types" ), new Object[] { cellHandler.usedTypes(), cellHandler.totalTypes() } ); // Add the tooltips @@ -311,7 +311,7 @@ public class ItemEssentiaCell for( int i = 0; i < SUFFIXES.length; i++ ) { - this.icons[i] = iconRegister.registerIcon( ThaumicEnergistics.MODID + ":essentia.cell." + SUFFIXES[i] ); + this.icons[i] = iconRegister.registerIcon( ThaumicEnergistics.MOD_ID + ":essentia.cell." + SUFFIXES[i] ); } } diff --git a/src/main/java/thaumicenergistics/items/ItemStorageCasing.java b/src/main/java/thaumicenergistics/items/ItemStorageCasing.java index 969146bc..a04397d5 100644 --- a/src/main/java/thaumicenergistics/items/ItemStorageCasing.java +++ b/src/main/java/thaumicenergistics/items/ItemStorageCasing.java @@ -21,13 +21,13 @@ public class ItemStorageCasing @Override public String getUnlocalizedName( ItemStack itemStack ) { - return ThaumicEnergistics.MODID + ".item." + ItemEnum.STORAGE_CASING.getInternalName(); + return ThaumicEnergistics.MOD_ID + ".item." + ItemEnum.STORAGE_CASING.getInternalName(); } @Override public void registerIcons( IIconRegister iconRegister ) { - this.itemIcon = iconRegister.registerIcon( ThaumicEnergistics.MODID + ":essentia.cell.casing" ); + this.itemIcon = iconRegister.registerIcon( ThaumicEnergistics.MOD_ID + ":essentia.cell.casing" ); } } diff --git a/src/main/java/thaumicenergistics/items/ItemStorageComponent.java b/src/main/java/thaumicenergistics/items/ItemStorageComponent.java index 26607a2c..60a0246e 100644 --- a/src/main/java/thaumicenergistics/items/ItemStorageComponent.java +++ b/src/main/java/thaumicenergistics/items/ItemStorageComponent.java @@ -57,7 +57,7 @@ public class ItemStorageComponent extends Item implements IStorageComponent @Override public String getUnlocalizedName( ItemStack itemStack ) { - return ThaumicEnergistics.MODID + ".item.storage.component." + this.suffixes[itemStack.getItemDamage()]; + return ThaumicEnergistics.MOD_ID + ".item.storage.component." + this.suffixes[itemStack.getItemDamage()]; } @Override @@ -73,7 +73,7 @@ public class ItemStorageComponent extends Item implements IStorageComponent for( int i = 0; i < this.suffixes.length; i++ ) { - this.icons[i] = iconRegister.registerIcon( ThaumicEnergistics.MODID + ":storage.component." + this.suffixes[i] ); + this.icons[i] = iconRegister.registerIcon( ThaumicEnergistics.MOD_ID + ":storage.component." + this.suffixes[i] ); } } diff --git a/src/main/java/thaumicenergistics/network/ChannelHandler.java b/src/main/java/thaumicenergistics/network/ChannelHandler.java index a9a13ea3..27320b61 100644 --- a/src/main/java/thaumicenergistics/network/ChannelHandler.java +++ b/src/main/java/thaumicenergistics/network/ChannelHandler.java @@ -28,7 +28,7 @@ import cpw.mods.fml.relauncher.Side; public class ChannelHandler { // private static EnumMap channels; - public static SimpleNetworkWrapper wrapper = NetworkRegistry.INSTANCE.newSimpleChannel( ThaumicEnergistics.MODID ); + public static SimpleNetworkWrapper wrapper = NetworkRegistry.INSTANCE.newSimpleChannel( ThaumicEnergistics.MOD_ID ); public static void registerMessages() { diff --git a/src/main/java/thaumicenergistics/parts/AEPartEssentiaTerminal.java b/src/main/java/thaumicenergistics/parts/AEPartEssentiaTerminal.java index ff92a111..31ad920d 100644 --- a/src/main/java/thaumicenergistics/parts/AEPartEssentiaTerminal.java +++ b/src/main/java/thaumicenergistics/parts/AEPartEssentiaTerminal.java @@ -31,8 +31,13 @@ public class AEPartEssentiaTerminal private List containers = new ArrayList(); private MachineSource machineSource = new MachineSource( this ); + + /** + * Tracks if the inventory has been locked for work. + */ + private boolean inventoryLocked = false; - private PrivateInventory inventory = new PrivateInventory( ThaumicEnergistics.MODID + ".part.aspect.terminal", 2, 64 ) + private PrivateInventory inventory = new PrivateInventory( ThaumicEnergistics.MOD_ID + ".part.aspect.terminal", 2, 64 ) { @Override public boolean isItemValidForSlot( int slotId, ItemStack itemStack ) @@ -199,5 +204,46 @@ public class AEPartEssentiaTerminal super.writeToNBT( data ); data.setTag( "inventory", this.inventory.writeToNBT() ); } + + /** + * Attempts to lock the terminal's inventory so that + * changes can be made. + * @return True if the lock was acquired, false otherwise. + */ + public boolean lockInventoryForWork() + { + boolean gotLock = false; + + // Ensure only 1 thread can access the lock at a time + synchronized( this.inventory ) + { + // Is the inventory not locked? + if( !this.inventoryLocked ) + { + // Mark it is now locked + this.inventoryLocked = true; + + // Mark that this thread got the lock + gotLock = true; + } + } + + // Return if this thread got the lock or not + return gotLock; + } + + /** + * Unlocks the terminal so that other threads can + * perform work. This should only be called from + * a thread that owns the lock. + */ + public void unlockInventory() + { + // Ensure only 1 thread can access the lock at a time + synchronized( this.inventory ) + { + this.inventoryLocked = false; + } + } } diff --git a/src/main/java/thaumicenergistics/registries/AEPartsEnum.java b/src/main/java/thaumicenergistics/registries/AEPartsEnum.java index 33563a01..9a0948eb 100644 --- a/src/main/java/thaumicenergistics/registries/AEPartsEnum.java +++ b/src/main/java/thaumicenergistics/registries/AEPartsEnum.java @@ -18,14 +18,14 @@ import appeng.api.config.Upgrades; public enum AEPartsEnum { - EssentiaImportBus ("essentia.ImportBus", AEPartEssentiaImportBus.class, ThaumicEnergistics.MODID + ".group.essentia.transport", new Pair[] { generatePair( + EssentiaImportBus ("essentia.ImportBus", AEPartEssentiaImportBus.class, ThaumicEnergistics.MOD_ID + ".group.essentia.transport", new Pair[] { generatePair( Upgrades.CAPACITY, 2 ), generatePair( Upgrades.REDSTONE, 1 ), generatePair( Upgrades.SPEED, 2 ) }), EssentiaLevelEmitter ("essentia.levelemitter", AEPartEssentiaLevelEmitter.class), EssentiaStorageBus ("essentia.StorageBus", AEPartEssentiaStorageBus.class, null, new Pair[] { generatePair( Upgrades.INVERTER, 1 ) }), - EssentiaExportBus ("essentia.ExportBus", AEPartEssentiaExportBus.class, ThaumicEnergistics.MODID + ".group.essentia.transport", new Pair[] { generatePair( + EssentiaExportBus ("essentia.ExportBus", AEPartEssentiaExportBus.class, ThaumicEnergistics.MOD_ID + ".group.essentia.transport", new Pair[] { generatePair( Upgrades.CAPACITY, 2 ), generatePair( Upgrades.REDSTONE, 1 ), generatePair( Upgrades.SPEED, 2 ) }), EssentiaTerminal ("essentia.terminal", AEPartEssentiaTerminal.class); @@ -46,7 +46,7 @@ public enum AEPartsEnum private AEPartsEnum( String unlocalizedName, Class partClass, String groupName ) { // Add the mod name and parts sub-folder to the name - this.unlocalizedName = ThaumicEnergistics.MODID + ".aeparts." + unlocalizedName; + this.unlocalizedName = ThaumicEnergistics.MOD_ID + ".aeparts." + unlocalizedName; // Set the class this.partClass = partClass; @@ -61,6 +61,7 @@ public enum AEPartsEnum for( Pair pair : upgrades ) { + // Add the upgrade to the map this.upgrades.put( pair.getKey(), pair.getValue() ); } diff --git a/src/main/java/thaumicenergistics/registries/BlockEnum.java b/src/main/java/thaumicenergistics/registries/BlockEnum.java index 87a6f927..d92068b6 100644 --- a/src/main/java/thaumicenergistics/registries/BlockEnum.java +++ b/src/main/java/thaumicenergistics/registries/BlockEnum.java @@ -18,7 +18,7 @@ public enum BlockEnum this.block = block; // Set the unlocalized name - this.unlocalizedName = ThaumicEnergistics.MODID + ".block." + unlocalizedName; + this.unlocalizedName = ThaumicEnergistics.MOD_ID + ".block." + unlocalizedName; // Set the block's name block.setBlockName( this.unlocalizedName ); diff --git a/src/main/java/thaumicenergistics/registries/ItemEnum.java b/src/main/java/thaumicenergistics/registries/ItemEnum.java index ac62d40c..f85eead1 100644 --- a/src/main/java/thaumicenergistics/registries/ItemEnum.java +++ b/src/main/java/thaumicenergistics/registries/ItemEnum.java @@ -25,7 +25,7 @@ public enum ItemEnum this.item = item; - this.item.setUnlocalizedName( ThaumicEnergistics.MODID + "." + this.internalName ); + this.item.setUnlocalizedName( ThaumicEnergistics.MOD_ID + "." + this.internalName ); this.item.setCreativeTab( ThaumicEnergistics.ModTab ); } diff --git a/src/main/java/thaumicenergistics/texture/BlockTextureManager.java b/src/main/java/thaumicenergistics/texture/BlockTextureManager.java index 836a82fe..7d27e9cc 100644 --- a/src/main/java/thaumicenergistics/texture/BlockTextureManager.java +++ b/src/main/java/thaumicenergistics/texture/BlockTextureManager.java @@ -54,7 +54,7 @@ public enum BlockTextureManager { if ( textureMap.getTextureType() == 0 ) { - String header = ThaumicEnergistics.MODID + ":"; + String header = ThaumicEnergistics.MOD_ID + ":"; if ( this.textureType == TextureTypes.Part ) { diff --git a/src/main/java/thaumicenergistics/texture/EssentiaGasTexture.java b/src/main/java/thaumicenergistics/texture/EssentiaGasTexture.java index cde8f431..66d6d28f 100644 --- a/src/main/java/thaumicenergistics/texture/EssentiaGasTexture.java +++ b/src/main/java/thaumicenergistics/texture/EssentiaGasTexture.java @@ -95,7 +95,7 @@ public class EssentiaGasTexture extends TextureAtlasSprite public EssentiaGasTexture(Aspect aspect) { - super( ThaumicEnergistics.MODID + ":" + GAS_FILE_NAME + "_" + aspect.getName() ); + super( ThaumicEnergistics.MOD_ID + ":" + GAS_FILE_NAME + "_" + aspect.getName() ); this.overlayColor = new Pixel( aspect.getColor() ); } diff --git a/src/main/java/thaumicenergistics/texture/GuiTextureManager.java b/src/main/java/thaumicenergistics/texture/GuiTextureManager.java index db38a668..5d24466f 100644 --- a/src/main/java/thaumicenergistics/texture/GuiTextureManager.java +++ b/src/main/java/thaumicenergistics/texture/GuiTextureManager.java @@ -15,7 +15,7 @@ public enum GuiTextureManager private GuiTextureManager( String textureName ) { // Create the resource location - this.texture = new ResourceLocation( ThaumicEnergistics.MODID, "textures/gui/" + textureName + ".png" ); + this.texture = new ResourceLocation( ThaumicEnergistics.MOD_ID, "textures/gui/" + textureName + ".png" ); } public ResourceLocation getTexture() diff --git a/src/main/java/thaumicenergistics/util/EssentiaCellTerminalWorker.java b/src/main/java/thaumicenergistics/util/EssentiaCellTerminalWorker.java index 9bcd0dfc..b71bd3aa 100644 --- a/src/main/java/thaumicenergistics/util/EssentiaCellTerminalWorker.java +++ b/src/main/java/thaumicenergistics/util/EssentiaCellTerminalWorker.java @@ -4,6 +4,7 @@ import net.minecraft.item.ItemStack; import org.apache.commons.lang3.tuple.MutablePair; import thaumcraft.api.aspects.Aspect; import thaumicenergistics.aspect.AspectStack; +import thaumicenergistics.container.ContainerCellTerminalBase; import thaumicenergistics.fluids.GaseousEssentia; import appeng.api.config.Actionable; import appeng.api.networking.security.MachineSource; @@ -12,18 +13,15 @@ import appeng.api.storage.data.IAEFluidStack; public class EssentiaCellTerminalWorker { - private static int INPUT_SLOT_ID = 0; - private static int OUTPUT_SLOT_ID = 1; - protected static void decreaseInputSlot( PrivateInventory inventory ) { - ItemStack slot = inventory.getStackInSlot( EssentiaCellTerminalWorker.INPUT_SLOT_ID ); + ItemStack slot = inventory.getStackInSlot( ContainerCellTerminalBase.INPUT_SLOT_ID ); slot.stackSize -= 1; if ( slot.stackSize <= 0 ) { - inventory.setInventorySlotContents( EssentiaCellTerminalWorker.INPUT_SLOT_ID, null ); + inventory.setInventorySlotContents( ContainerCellTerminalBase.INPUT_SLOT_ID, null ); inventory.markDirty(); } @@ -145,11 +143,11 @@ public class EssentiaCellTerminalWorker return false; } - ItemStack secondSlot = inventory.getStackInSlot( EssentiaCellTerminalWorker.OUTPUT_SLOT_ID ); + ItemStack secondSlot = inventory.getStackInSlot( ContainerCellTerminalBase.OUTPUT_SLOT_ID ); if ( secondSlot == null ) { - inventory.setInventorySlotContents( EssentiaCellTerminalWorker.OUTPUT_SLOT_ID, itemStack ); + inventory.setInventorySlotContents( ContainerCellTerminalBase.OUTPUT_SLOT_ID, itemStack ); inventory.markDirty(); @@ -161,7 +159,7 @@ public class EssentiaCellTerminalWorker return false; } - if( inventory.incrStackSize( EssentiaCellTerminalWorker.OUTPUT_SLOT_ID, itemStack.stackSize ) != null ) + if( inventory.incrStackSize( ContainerCellTerminalBase.OUTPUT_SLOT_ID, itemStack.stackSize ) != null ) { inventory.markDirty(); return true; @@ -179,7 +177,7 @@ public class EssentiaCellTerminalWorker } // Get the output slot - ItemStack outputSlot = inventory.getStackInSlot( EssentiaCellTerminalWorker.OUTPUT_SLOT_ID ); + ItemStack outputSlot = inventory.getStackInSlot( ContainerCellTerminalBase.OUTPUT_SLOT_ID ); // Is the output slot valid and not full? if ( ( outputSlot != null ) && ( outputSlot.stackSize >= 64 ) ) @@ -188,7 +186,7 @@ public class EssentiaCellTerminalWorker } // Is the item in the input slot an essentia container? - if ( !EssentiaItemContainerHelper.isContainer( inventory.getStackInSlot( EssentiaCellTerminalWorker.INPUT_SLOT_ID ) ) ) + if ( !EssentiaItemContainerHelper.isContainer( inventory.getStackInSlot( ContainerCellTerminalBase.INPUT_SLOT_ID ) ) ) { return false; } @@ -211,7 +209,7 @@ public class EssentiaCellTerminalWorker } // Make a copy of the input slot - ItemStack inputSlot = inventory.getStackInSlot( EssentiaCellTerminalWorker.INPUT_SLOT_ID ).copy(); + ItemStack inputSlot = inventory.getStackInSlot( ContainerCellTerminalBase.INPUT_SLOT_ID ).copy(); // Is the container empty? if ( EssentiaItemContainerHelper.isContainerEmpty( inputSlot ) ) diff --git a/src/main/resources/assets/thaumicenergistics/lang/en_US.lang b/src/main/resources/assets/thaumicenergistics/lang/en_US.lang index d8b4075e..4f391abc 100644 --- a/src/main/resources/assets/thaumicenergistics/lang/en_US.lang +++ b/src/main/resources/assets/thaumicenergistics/lang/en_US.lang @@ -6,7 +6,7 @@ thaumicenergistics.group.essentia.transport=ME Essentia Import/Export Bus thaumicenergistics.fluid.gaseous=Gaseous #Blocks -thaumicenergistics.block.essentia.provider.name=Basic Essentia Provider +thaumicenergistics.block.essentia.provider.name=Essentia Provider #Cable parts thaumicenergistics.aeparts.essentia.ImportBus.name=Essentia Import Bus diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 3357e555..1a73e30b 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -3,7 +3,7 @@ "modid": "thaumicenergistics", "name": "Thaumic Energistics", "description": "The digital age could use some magic", - "version": "0.1.2a", + "version": "0.1.3a", "mcversion": "1.7.2", "url": "", "updateUrl": "",