diff options
author | Connor-Colenso <52056774+Connor-Colenso@users.noreply.github.com> | 2023-09-04 03:05:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-04 03:05:22 +0100 |
commit | 76719d65a90d98e228a914774d3b11ed9f01ac8e (patch) | |
tree | ce0d35f954e441e9cc4aa95aa347073728e6f4ee /src/main/java/gtPlusPlus/core/tileentities | |
parent | 0393b582eb3edcb5c575330804b6747577a55e27 (diff) | |
download | GT5-Unofficial-76719d65a90d98e228a914774d3b11ed9f01ac8e.tar.gz GT5-Unofficial-76719d65a90d98e228a914774d3b11ed9f01ac8e.tar.bz2 GT5-Unofficial-76719d65a90d98e228a914774d3b11ed9f01ac8e.zip |
Clean-up v2 (#729)
* Remove test items from NEI with no texture
* Add number formatting to hand pumps
* Remove heavy plates (no recipes & completely unused).
* Remove helium generator (no texture, no recipe)
* Remove fire pit and fire starter (no use, no recipe, no textures)
* Remove giant chicken and associated unused stuff, has no texture and is unobtainable. Used to be relevant but isn't anymore.
* Remove villagers with silly trades like 1 motor + 1 hull = 1 hull. Why?
* Remove trade bench, no recipe, missing textures. Unused.
* Remove farm processors, no texture, no recipe. Unused.
* Remove MAX tier components, these exist in GT now, have no recipe here and are unused.
* Hide untextured light block from NEI
* Update buildscript
* Remove unused backpacks, no recipe and contains dupe bugs. Bad.
* Remove eatotronic, universal toolbox and magic tool bag. All 3 are missing textures and uncraftable.
* Remove eatotronic, universal toolbox and magic tool bag. All 3 are missing textures and uncraftable. part 2
* Remove dragon catcher (what?), no texture, no recipe, unused.
* Remove empty item, does nothing, has no recipe, no idea why it is here.
* Empty item v2 removal
* Revert "Empty item v2 removal"
This reverts commit 75bcd3ccfaf55bbfe2c12b2e4167d5c37636030d.
* Revert "Remove empty item, does nothing, has no recipe, no idea why it is here."
This reverts commit e41a9f484392776331c58530ab1faa5ef978ef36.
* Remove debug square. No recipe, unused.
* Number formatting overflow covers
* Remove JVM garbage collection block. Unused, no recipe.
* Remove nanotubes, no recipe for them. Unused.
* Remove "git" item, doesn't seem to work. Has no recipe.
* Remove uncraftable food with awful textures.
* Remove "bat king" mob, unused content. Does not spawn.
* Remove uncraftable doors with bad textures. Unused content.
* Remove uncraftable, unlocalised redstone stuff that crashes game when placed.
* Remove weird spawner item. No recipe, does not exist in world.
* Remove sunnarium bit, no recipe, no usage.
* Remove unused modularity table and some misc uncraftable, unused items.
* Remove Interconnecting Storage Crate, no recipe, unused.
* Delete worse debug power gen, this already exists as part of GT. Unneeded duplication.
* Delete unused placeholder circuit
* Delete uncraftable generator hatches.
* Spotless
* Remove XP tank thing, unused and uncraftable.
* Remove null item, this fluid registry only seemed to register one null fluid. All others exist?
* Remove EU -> RF battery. Unused in GTNH.
* Remove some shelf nonsense, why is this in this mod?
* Remove some weird random tools. These have no realistic usage in GTNH.
* Remove firemaker. Useless in GTNH.
* Removed helium blob. Deprecated item, not used anymore, uncraftable.
* spotlessApply (#730)
Co-authored-by: GitHub GTNH Actions <>
* Stop modulators generating unused blocks with no textures
* Remove more unused untextured casings
* Remove more unused untextured casings
* Remove more unused untextured casings
* Remove more unused untextured casings
* Remove more unused untextured casings
* Remove some weird methods and uncraftable mining parts, probably part of deprecated multiblock.
* spotlessApply (#732)
Co-authored-by: GitHub GTNH Actions <>
* Remove gem shards, unused.
* Remove unused atoms
* Remove unused gum
* Remove unused elements/materials
* Bye bye
* Remove some unused reflection stuff
* Remove control cores, obsolete now.
* Remove mob killing thing with no texture and no recipe.
* Remove uncraftable covers
* Remove pizza gloves
* Net and rope removal, unused
* Remove force crop
* Removal of some old event stuff
* Remove unused nuclear chem items
* Remove player safe, mostly because of the horrible event code that was intercepting every block break. I can't see any real usage of this via discord.
* Remove Force material and associated other nonsense. Also remove some nuclear chem stuff.
* Remove force for realsies
* Skookum Chooker purge.
* Remove some enderio compat, these plates/dusts are added via GT5 anyway now. This is obsolete.
* spotlessApply (#733)
Co-authored-by: GitHub GTNH Actions <>
* Unused textures
* Bump dep
* Revert "Remove force for realsies"
This reverts commit 0d288912a99f9dabce56d2a2623d4d3510f4804e.
* Revert "Remove Force material and associated other nonsense. Also remove some nuclear chem stuff."
This reverts commit 3455e6e916defe1f2aef923be6f9696a6cf3095b.
* Remove nuclear items that are unused
* spotlessApply (#734)
Co-authored-by: GitHub GTNH Actions <>
---------
Co-authored-by: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com>
Co-authored-by: Connor Colenso <colen@CONNORSPC>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'src/main/java/gtPlusPlus/core/tileentities')
8 files changed, 0 insertions, 1570 deletions
diff --git a/src/main/java/gtPlusPlus/core/tileentities/ModTileEntities.java b/src/main/java/gtPlusPlus/core/tileentities/ModTileEntities.java index f7ed248669..1cb6e5699c 100644 --- a/src/main/java/gtPlusPlus/core/tileentities/ModTileEntities.java +++ b/src/main/java/gtPlusPlus/core/tileentities/ModTileEntities.java @@ -6,21 +6,15 @@ import gtPlusPlus.core.block.general.BlockSuperLight.TileEntitySuperLight; import gtPlusPlus.core.block.machine.Machine_SuperJukebox.TileEntitySuperJukebox; import gtPlusPlus.core.tileentities.general.TileEntityCircuitProgrammer; import gtPlusPlus.core.tileentities.general.TileEntityDecayablesChest; -import gtPlusPlus.core.tileentities.general.TileEntityEggBox; -import gtPlusPlus.core.tileentities.general.TileEntityFirepit; import gtPlusPlus.core.tileentities.general.TileEntityFishTrap; import gtPlusPlus.core.tileentities.general.TileEntityInfiniteFluid; import gtPlusPlus.core.tileentities.general.TileEntityPlayerDoorBase; import gtPlusPlus.core.tileentities.general.TileEntityVolumetricFlaskSetter; -import gtPlusPlus.core.tileentities.general.TileEntityXpConverter; import gtPlusPlus.core.tileentities.machines.TileEntityAdvPooCollector; -import gtPlusPlus.core.tileentities.machines.TileEntityModularityTable; import gtPlusPlus.core.tileentities.machines.TileEntityPestKiller; import gtPlusPlus.core.tileentities.machines.TileEntityPooCollector; import gtPlusPlus.core.tileentities.machines.TileEntityProjectTable; import gtPlusPlus.core.tileentities.machines.TileEntityRoundRobinator; -import gtPlusPlus.core.tileentities.machines.TileEntityTradeTable; -import gtPlusPlus.plugin.villagers.tile.TileEntityGenericSpawner; public class ModTileEntities { @@ -29,13 +23,8 @@ public class ModTileEntities { GameRegistry.registerTileEntity(TileEntityPooCollector.class, "TileEntityPooCollector"); GameRegistry.registerTileEntity(TileEntityAdvPooCollector.class, "TileEntityAdvPooCollector"); GameRegistry.registerTileEntity(TileEntityFishTrap.class, "TileFishTrap"); - GameRegistry.registerTileEntity(TileEntityFirepit.class, "TileFirePit"); GameRegistry.registerTileEntity(TileEntityInfiniteFluid.class, "TileInfiniteFluid"); GameRegistry.registerTileEntity(TileEntityProjectTable.class, "TileProjectTable"); - GameRegistry.registerTileEntity(TileEntityTradeTable.class, "TileTradeTable"); - GameRegistry.registerTileEntity(TileEntityModularityTable.class, "TileEntityModularityTable"); - GameRegistry.registerTileEntity(TileEntityXpConverter.class, "TileEntityXpConverter"); - GameRegistry.registerTileEntity(TileEntityGenericSpawner.class, "TileEntityGenericSpawner"); GameRegistry.registerTileEntity(TileEntityCircuitProgrammer.class, "TileCircuitProgrammer"); GameRegistry.registerTileEntity(TileEntityPlayerDoorBase.class, "TilePlayerDoorBase"); GameRegistry.registerTileEntity(TileEntityDecayablesChest.class, "TileDecayablesChest"); @@ -43,7 +32,6 @@ public class ModTileEntities { GameRegistry.registerTileEntity(TileEntitySuperLight.class, "TileEntitySuperLight"); GameRegistry.registerTileEntity(TileEntityPestKiller.class, "TileEntityPestKiller"); GameRegistry.registerTileEntity(TileEntityRoundRobinator.class, "TileEntityRoundRobinator"); - GameRegistry.registerTileEntity(TileEntityEggBox.class, "TileEggBox"); GameRegistry.registerTileEntity(TileEntityVolumetricFlaskSetter.class, "TileEntityVolumetricFlaskSetter"); } diff --git a/src/main/java/gtPlusPlus/core/tileentities/general/TileEntityEggBox.java b/src/main/java/gtPlusPlus/core/tileentities/general/TileEntityEggBox.java deleted file mode 100644 index 27a1c4ad0c..0000000000 --- a/src/main/java/gtPlusPlus/core/tileentities/general/TileEntityEggBox.java +++ /dev/null @@ -1,365 +0,0 @@ -package gtPlusPlus.core.tileentities.general; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.ISidedInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.inventories.Inventory_EggBox; -import gtPlusPlus.core.item.general.ItemGiantEgg; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class TileEntityEggBox extends TileEntity implements ISidedInventory { - - private final Inventory_EggBox inventoryContents; - - /** Determines if the check for adjacent chests has taken place. */ - public boolean adjacentChestChecked; - /** Contains the chest tile located adjacent to this one (if any) */ - public TileEntityEggBox adjacentChestZNeg; - /** Contains the chest tile located adjacent to this one (if any) */ - public TileEntityEggBox adjacentChestXPos; - /** Contains the chest tile located adjacent to this one (if any) */ - public TileEntityEggBox adjacentChestXNeg; - /** Contains the chest tile located adjacent to this one (if any) */ - public TileEntityEggBox adjacentChestZPos; - /** The current angle of the lid (between 0 and 1) */ - public float lidAngle; - /** The angle of the lid last tick */ - public float prevLidAngle; - /** The number of players currently using this chest */ - public int numPlayersUsing; - - private String customName; - - private int cachedChestType; - private int tickCount = 0; - - public TileEntityEggBox() { - this.inventoryContents = new Inventory_EggBox(); - } - - public Inventory_EggBox getInventory() { - return this.inventoryContents; - } - - @Override - public void updateEntity() { - - // Try do chesty stuff - try { - this.updateEntityChest(); - } catch (Throwable t) { - - } - - try { - if (!this.worldObj.isRemote) { - this.tickCount++; - if ((this.tickCount % 10) == 0) { - cachedChestType = 1; - } - - if ((this.tickCount % 20) == 0) { - for (ItemStack inv : this.getInventory().getInventory()) { - if (inv == null) { - continue; - } - if (inv.getItem() instanceof ItemGiantEgg) { - ItemGiantEgg D = (ItemGiantEgg) inv.getItem(); - tryUpdateDecayable(D, inv, this.worldObj); - } - } - } - updateSlots(); - } - } catch (final Throwable t) {} - } - - public void tryUpdateDecayable(final ItemGiantEgg d, ItemStack iStack, final World world) { - if (world == null || iStack == null) { - return; - } - if (world.isRemote) { - return; - } - - boolean a1, a2; - int u = 0; - a1 = d.isTicking(world, iStack); - a2 = false; - int SECONDS_TO_PROCESS = 1; - while (u < (20 * SECONDS_TO_PROCESS)) { - if (!a1) { - break; - } - a1 = d.isTicking(world, iStack); - a2 = d.tickItemTag(world, iStack); - u++; - } - Logger.MACHINE_INFO("| " + d.getUnlocalizedName() + " | " + a1 + "/" + a2); - - if (!a1 && !a2) { - ItemStack replacement = ItemUtils.getSimpleStack(d.getHatchResult(), 1); - replacement.stackSize = 1; - // iStack = replacement.copy(); - for (int fff = 0; fff < this.inventoryContents.getSizeInventory(); fff++) { - if (this.inventoryContents.getStackInSlot(fff) == iStack) { - this.inventoryContents.setInventorySlotContents(fff, replacement.copy()); - } - } - - updateSlots(); - this.inventoryContents.markDirty(); - } - } - - public boolean anyPlayerInRange() { - return this.worldObj.getClosestPlayer(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D, 32) != null; - } - - public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag) { - if (!nbt.hasKey(tag)) { - nbt.setTag(tag, new NBTTagCompound()); - } - return nbt.getCompoundTag(tag); - } - - @Override - public void writeToNBT(final NBTTagCompound nbt) { - super.writeToNBT(nbt); - // Utils.LOG_WARNING("Trying to write NBT data to TE."); - final NBTTagCompound chestData = new NBTTagCompound(); - this.inventoryContents.writeToNBT(chestData); - nbt.setTag("ContentsChest", chestData); - if (this.hasCustomInventoryName()) { - nbt.setString("CustomName", this.getCustomName()); - } - } - - @Override - public void readFromNBT(final NBTTagCompound nbt) { - super.readFromNBT(nbt); - // Utils.LOG_WARNING("Trying to read NBT data from TE."); - this.inventoryContents.readFromNBT(nbt.getCompoundTag("ContentsChest")); - if (nbt.hasKey("CustomName", 8)) { - this.setCustomName(nbt.getString("CustomName")); - } - } - - @Override - public int getSizeInventory() { - return this.getInventory().getSizeInventory(); - } - - @Override - public ItemStack getStackInSlot(final int slot) { - return this.getInventory().getStackInSlot(slot); - } - - @Override - public ItemStack decrStackSize(final int slot, final int count) { - return this.getInventory().decrStackSize(slot, count); - } - - @Override - public ItemStack getStackInSlotOnClosing(final int slot) { - return this.getInventory().getStackInSlotOnClosing(slot); - } - - @Override - public void setInventorySlotContents(final int slot, final ItemStack stack) { - this.getInventory().setInventorySlotContents(slot, stack); - } - - @Override - public int getInventoryStackLimit() { - return this.getInventory().getInventoryStackLimit(); - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer entityplayer) { - return this.getInventory().isUseableByPlayer(entityplayer); - } - - @Override - public void openInventory() { - if (this.numPlayersUsing < 0) { - this.numPlayersUsing = 0; - } - if (!this.worldObj.isRemote) { - this.numPlayersUsing++; - cachedChestType = 1; - } - this.worldObj - .addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, this.numPlayersUsing); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType()); - this.getInventory().openInventory(); - } - - @Override - public void closeInventory() { - if (!this.worldObj.isRemote) { - this.numPlayersUsing--; - cachedChestType = 1; - } - this.worldObj - .addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, this.numPlayersUsing); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType()); - this.getInventory().closeInventory(); - } - - @Override - public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) { - return this.getInventory().isItemValidForSlot(slot, itemstack); - } - - @Override - public int[] getAccessibleSlotsFromSide(final int p_94128_1_) { - final int[] accessibleSides = new int[this.getSizeInventory()]; - for (int r = 0; r < this.getInventory().getSizeInventory(); r++) { - accessibleSides[r] = r; - } - return accessibleSides; - } - - @Override - public boolean canInsertItem(final int p_102007_1_, final ItemStack p_102007_2_, final int p_102007_3_) { - return this.getInventory().isItemValidForSlot(0, p_102007_2_); - } - - @Override - public boolean canExtractItem(final int p_102008_1_, final ItemStack p_102008_2_, final int p_102008_3_) { - return this.getInventory().isItemValidForSlot(0, p_102008_2_); - } - - public String getCustomName() { - return this.customName; - } - - public void setCustomName(final String customName) { - this.customName = customName; - } - - @Override - public String getInventoryName() { - return this.hasCustomInventoryName() ? this.customName : "container.EggBox"; - } - - @Override - public boolean hasCustomInventoryName() { - return (this.customName != null) && !this.customName.equals(""); - } - - /** - * Causes the TileEntity to reset all it's cached values for it's container Block, metadata and in the case of - * chests, the adjacent chest check - */ - @Override - public void updateContainingBlockInfo() { - super.updateContainingBlockInfo(); - this.adjacentChestChecked = false; - } - - /** - * Performs the check for adjacent chests to determine if this chest is double or not. - */ - public void checkForAdjacentChests() { - if (!this.adjacentChestChecked) { - this.adjacentChestChecked = true; - this.adjacentChestZNeg = null; - this.adjacentChestXPos = null; - this.adjacentChestXNeg = null; - this.adjacentChestZPos = null; - } - } - - public void updateEntityChest() { - float f; - this.prevLidAngle = this.lidAngle; - f = 0.04F; - double d2; - if (this.numPlayersUsing > 0 && this.lidAngle == 0.0F - && this.adjacentChestZNeg == null - && this.adjacentChestXNeg == null) { - double d1 = (double) this.xCoord + 0.5D; - d2 = (double) this.zCoord + 0.5D; - this.worldObj.playSoundEffect( - d1, - (double) this.yCoord + 0.5D, - d2, - "random.chestopen", - 0.5F, - this.worldObj.rand.nextFloat() * 0.1F + 0.9F); - } - - if (this.numPlayersUsing == 0 && this.lidAngle > 0.0F || this.numPlayersUsing > 0 && this.lidAngle < 1.0F) { - float f1 = this.lidAngle; - if (this.numPlayersUsing > 0) { - // this.lidAngle += f; - this.lidAngle += (float) (f * (1 + 0.10 * 0.01)); - } else { - // this.lidAngle -= f; - this.lidAngle -= (float) (f * (1 + 0.10 * 0.01)); - } - if (this.lidAngle > 1.0F) { - this.lidAngle = 1.0F; - } - float f2 = 0.5F; - if (this.lidAngle < f2 && f1 >= f2 && this.adjacentChestZNeg == null && this.adjacentChestXNeg == null) { - d2 = (double) this.xCoord + 0.5D; - double d0 = (double) this.zCoord + 0.5D; - this.worldObj.playSoundEffect( - d2, - (double) this.yCoord + 0.5D, - d0, - "random.chestclosed", - 0.5F, - this.worldObj.rand.nextFloat() * 0.1F + 0.9F); - } - - if (this.lidAngle < 0.0F) { - this.lidAngle = 0.0F; - } - } - } - - /** - * Called when a client event is received with the event number and argument, see World.sendClientEvent - */ - @Override - public boolean receiveClientEvent(int p_145842_1_, int p_145842_2_) { - if (p_145842_1_ == 1) { - this.numPlayersUsing = p_145842_2_; - return true; - } else { - return super.receiveClientEvent(p_145842_1_, p_145842_2_); - } - } - - /** - * invalidates a tile entity - */ - @Override - public final void invalidate() { - super.invalidate(); - cachedChestType = 1; - this.updateContainingBlockInfo(); - this.checkForAdjacentChests(); - } - - private final int updateSlots() { - // Have slots changed? - if (cachedChestType == 0) { - return 0; - } - ItemUtils.organiseInventory(getInventory()); - cachedChestType = 0; - return cachedChestType; - } -} diff --git a/src/main/java/gtPlusPlus/core/tileentities/general/TileEntityFirepit.java b/src/main/java/gtPlusPlus/core/tileentities/general/TileEntityFirepit.java deleted file mode 100644 index 08feceb192..0000000000 --- a/src/main/java/gtPlusPlus/core/tileentities/general/TileEntityFirepit.java +++ /dev/null @@ -1,38 +0,0 @@ -package gtPlusPlus.core.tileentities.general; - -import java.util.UUID; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; - -public class TileEntityFirepit extends TileEntity { - - private UUID ownerUUID; - - public UUID getOwnerUUID() { - return this.ownerUUID; - } - - public void setOwnerUUID(final UUID ownerUUID) { - this.ownerUUID = ownerUUID; - this.markDirty(); - } - - @Override - public void writeToNBT(final NBTTagCompound tagCompound) { - super.writeToNBT(tagCompound); - - final UUID ownerUUID = this.getOwnerUUID(); - if (ownerUUID != null) { - tagCompound.setLong("OwnerUUIDMost", ownerUUID.getMostSignificantBits()); - tagCompound.setLong("OwnerUUIDLeast", ownerUUID.getLeastSignificantBits()); - } - } - - @Override - public void readFromNBT(final NBTTagCompound tagCompound) { - super.readFromNBT(tagCompound); - - this.setOwnerUUID(new UUID(tagCompound.getLong("OwnerUUIDMost"), tagCompound.getLong("OwnerUUIDLeast"))); - } -} diff --git a/src/main/java/gtPlusPlus/core/tileentities/general/TileEntityHeliumGenerator.java b/src/main/java/gtPlusPlus/core/tileentities/general/TileEntityHeliumGenerator.java deleted file mode 100644 index 3e24c7fe96..0000000000 --- a/src/main/java/gtPlusPlus/core/tileentities/general/TileEntityHeliumGenerator.java +++ /dev/null @@ -1,117 +0,0 @@ -package gtPlusPlus.core.tileentities.general; - -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; - -import gregtech.api.enums.GT_Values; -import gtPlusPlus.core.inventories.InventoryHeliumGenerator; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class TileEntityHeliumGenerator extends TileEntity { - - private int tickCount = 0; - private final InventoryHeliumGenerator inventoryContents; // TODO - private int locationX; - private int locationY; - private int locationZ; - private int baseTickRate = 1200; - - public TileEntityHeliumGenerator() { - this.inventoryContents = new InventoryHeliumGenerator(); // number of slots - without product slot - this.setTileLocation(); - } - - public boolean setTileLocation() { - if (this.hasWorldObj()) { - if (!this.getWorldObj().isRemote) { - this.locationX = this.xCoord; - this.locationY = this.yCoord; - this.locationZ = this.zCoord; - return true; - } - } - return false; - } - - public InventoryHeliumGenerator getInventory() { - return this.inventoryContents; - } - - public boolean tryAddLoot() { - if (this.getInventory().getInventory() != null) { - int checkingSlot = 0; - final ItemStack loot = this.generateLootForFishTrap(); - for (final ItemStack contents : this.getInventory().getInventory()) { - if (contents == null) { - this.getInventory().setInventorySlotContents(checkingSlot, loot); - this.markDirty(); - return true; - } else if (contents.getItem() == loot.getItem()) { - if (contents.stackSize < contents.getMaxStackSize()) { - contents.stackSize++; - this.markDirty(); - return true; - } else { - this.getInventory().setInventorySlotContents(checkingSlot, loot); - this.markDirty(); - return true; - } - } else { - - } - checkingSlot++; - } - } - this.markDirty(); - return false; - } - - private ItemStack generateLootForFishTrap() { - final int lootWeight = MathUtils.randInt(0, 1000); - ItemStack loot = GT_Values.NI; - if (lootWeight > 990) { - loot = ItemUtils.getSimpleStack(Items.slime_ball); - } - return loot; - } - - @Override - public void updateEntity() { - if (!this.worldObj.isRemote) {} - } - - public void calculateTickrate() { - int calculateTickrate = 0; - this.baseTickRate = calculateTickrate; - } - - public boolean anyPlayerInRange() { - return this.worldObj.getClosestPlayer(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D, 32) != null; - } - - public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag) { - if (!nbt.hasKey(tag)) { - nbt.setTag(tag, new NBTTagCompound()); - } - return nbt.getCompoundTag(tag); - } - - @Override - public void writeToNBT(final NBTTagCompound nbt) { - super.writeToNBT(nbt); - // Utils.LOG_INFO("Trying to write NBT data to TE."); - final NBTTagCompound chestData = new NBTTagCompound(); - this.inventoryContents.writeToNBT(chestData); - nbt.setTag("ContentsChest", chestData); - } - - @Override - public void readFromNBT(final NBTTagCompound nbt) { - super.readFromNBT(nbt); - // Utils.LOG_INFO("Trying to read NBT data from TE."); - this.inventoryContents.readFromNBT(nbt.getCompoundTag("ContentsChest")); - } -} diff --git a/src/main/java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java b/src/main/java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java deleted file mode 100644 index 8fa0580158..0000000000 --- a/src/main/java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java +++ /dev/null @@ -1,297 +0,0 @@ -package gtPlusPlus.core.tileentities.general; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.NetworkManager; -import net.minecraft.network.Packet; -import net.minecraft.network.play.server.S35PacketUpdateTileEntity; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; - -import org.lwjgl.input.Keyboard; - -import gtPlusPlus.api.objects.minecraft.BTF_FluidTank; -import gtPlusPlus.core.tileentities.base.TileBasicTank; -import gtPlusPlus.core.util.minecraft.EnchantingUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; - -public class TileEntityXpConverter extends TileBasicTank { - - public BTF_FluidTank tankEssence = new BTF_FluidTank( - (int) (64000 * EnchantingUtils.RATIO_MOB_ESSENCE_TO_LIQUID_XP)); - public BTF_FluidTank tankLiquidXp = new BTF_FluidTank(64000); - private boolean mConvertToEssence = true; - - public TileEntityXpConverter() { - super(4, 32000); - } - - private void changeMode() { - if (this.mConvertToEssence) { - this.mConvertToEssence = false; - return; - } else { - this.mConvertToEssence = true; - return; - } - } - - public float getAdjustedVolume() { - if (this.mConvertToEssence) { - if ((this.tankLiquidXp.getFluid() != null) && (this.tankLiquidXp.getFluidAmount() >= 100) - && (this.tankEssence.getFluidAmount() <= (this.tankEssence.getCapacity() - - (100 * EnchantingUtils.RATIO_MOB_ESSENCE_TO_LIQUID_XP)))) { - final FluidStack bigStorage = EnchantingUtils.getEssenceFromLiquidXp(100); - this.tankEssence.fill(bigStorage, true); - this.tankLiquidXp.drain(100, true); - return (this.tankEssence.getCapacity() - this.tankEssence.getFluidAmount()); - } - } else { - final double rm = EnchantingUtils.RATIO_MOB_ESSENCE_TO_LIQUID_XP; - if ((this.tankEssence.getFluid() != null) && (this.tankEssence.getFluidAmount() >= rm) - && (this.tankLiquidXp.getFluidAmount() <= (this.tankLiquidXp.getCapacity() - rm))) { - final FluidStack bigStorage = EnchantingUtils.getLiquidXP(1); - this.tankLiquidXp.fill(bigStorage, true); - this.tankEssence.drain((int) rm, true); - return (this.tankLiquidXp.getCapacity() - this.tankLiquidXp.getFluidAmount()); - } - } - return 0f; - } - - @Override - public void readFromNBT(final NBTTagCompound tag) { - this.tankEssence.readFromNBT(tag); - this.tankLiquidXp.readFromNBT(tag); - this.mConvertToEssence = tag.getBoolean("mConvertToEssence"); - super.readFromNBT(tag); - } - - @Override - public void writeToNBT(final NBTTagCompound tag) { - this.tankEssence.writeToNBT(tag); - this.tankLiquidXp.writeToNBT(tag); - tag.setBoolean("mConvertToEssence", this.mConvertToEssence); - super.writeToNBT(tag); - } - - @Override - public Packet getDescriptionPacket() { - final NBTTagCompound tag = new NBTTagCompound(); - this.writeToNBT(tag); - return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, this.blockMetadata, tag); - } - - @Override - public void onDataPacket(final NetworkManager net, final S35PacketUpdateTileEntity pkt) { - final NBTTagCompound tag = pkt.func_148857_g(); - this.readFromNBT(tag); - } - - public void onScrewdriverRightClick(final byte aSide, final EntityPlayer aPlayer, final float aX, final float aY, - final float aZ) { - if (this.isServerSide()) { - if (this.mConvertToEssence) { - PlayerUtils.messagePlayer(aPlayer, "Converting from Mob Essence to Liquid Xp."); - } else { - PlayerUtils.messagePlayer(aPlayer, "Converting from Liquid Xp to Mob Essence."); - } - // Mode Change - this.changeMode(); - } - } - - public void onRightClick(final byte aSide, final EntityPlayer aPlayer, final int aX, final int aY, final int aZ) { - if ((Keyboard.isKeyDown(42)) || (Keyboard.isKeyDown(54))) { - String mInput; - String mOutput; - - if (this.mConvertToEssence) { - mInput = "Liquid Xp"; - mOutput = "Mob Essence"; - } else { - mInput = "Mob Essence"; - mOutput = "Liquid Xp"; - } - - PlayerUtils.messagePlayer(aPlayer, "Input: " + mInput + "."); - PlayerUtils.messagePlayer(aPlayer, "Output: " + mOutput + "."); - } - } - - @Override - public boolean onPreTick(long aTick) { - boolean aSuperResult = super.onPreTick(aTick); - long aTankSpaceLeft = 0; - double aAmount = 0; - int aRuns = 0; - if (this.mConvertToEssence) { - aTankSpaceLeft = (this.tankEssence.getCapacity() - this.tankEssence.getFluidAmount()); - aAmount = EnchantingUtils.getEssenceFromLiquidXp(100).amount; - } else { - aTankSpaceLeft = (this.tankLiquidXp.getCapacity() - this.tankLiquidXp.getFluidAmount()); - aAmount = EnchantingUtils.RATIO_MOB_ESSENCE_TO_LIQUID_XP; - } - aRuns = (int) (aTankSpaceLeft / aAmount); - for (int i = 0; i < aRuns; i++) { - if (getAdjustedVolume() == 0) { - break; - } - } - return aSuperResult; - } - - @Override - public boolean isLiquidInput(ForgeDirection side) { - if (mConvertToEssence) { - if (side.offsetY != 0) { - return false; - } - } else { - if (side.offsetY != 0) { - return true; - } - } - return false; - } - - @Override - public boolean isLiquidOutput(ForgeDirection side) { - if (mConvertToEssence) { - if (side.offsetY != 0) { - return true; - } - } else { - if (side.offsetY != 0) { - return false; - } - } - return false; - } - - @Override - public int fill(ForgeDirection aSide, FluidStack aFluid, boolean doFill) { - if (mConvertToEssence) { - if (aSide != ForgeDirection.UP && aSide != ForgeDirection.DOWN) { - return this.tankLiquidXp.fill(aFluid, doFill); - } - } else { - if (aSide == ForgeDirection.UP || aSide == ForgeDirection.DOWN) { - return this.tankEssence.fill(aFluid, doFill); - } - } - return 0; - } - - @Override - public FluidStack drain(ForgeDirection side, int maxDrain, boolean doDrain) { - if (mConvertToEssence) { - if (side == ForgeDirection.UP || side == ForgeDirection.DOWN) { - return this.tankEssence.drain(maxDrain, doDrain); - } - } else { - if (side != ForgeDirection.UP && side != ForgeDirection.DOWN) { - return this.tankLiquidXp.drain(maxDrain, doDrain); - } - } - return null; - } - - @Override - public FluidStack drain(ForgeDirection side, FluidStack aFluid, boolean doDrain) { - if (mConvertToEssence) { - if (side == ForgeDirection.UP || side == ForgeDirection.DOWN) { - return this.tankEssence.drain(aFluid, doDrain); - } - } else { - if (side != ForgeDirection.UP && side != ForgeDirection.DOWN) { - return this.tankLiquidXp.drain(aFluid, doDrain); - } - } - return null; - } - - @Override - public boolean canFill(ForgeDirection side, Fluid aFluid) { - if (mConvertToEssence) { - if (side != ForgeDirection.UP && side != ForgeDirection.DOWN) { - return this.tankLiquidXp.canTankBeFilled(); - } - } else { - if (side == ForgeDirection.UP || side == ForgeDirection.DOWN) { - return this.tankEssence.canTankBeFilled(); - } - } - return false; - } - - @Override - public boolean canDrain(ForgeDirection side, Fluid aFluid) { - if (mConvertToEssence) { - if (side == ForgeDirection.UP || side == ForgeDirection.DOWN) { - return this.tankEssence.canTankBeEmptied(); - } - } else { - if (side != ForgeDirection.UP && side != ForgeDirection.DOWN) { - return this.tankLiquidXp.canTankBeEmptied(); - } - } - return false; - } - - @Override - public FluidTankInfo[] getTankInfo(ForgeDirection side) { - if (side == ForgeDirection.UP || side == ForgeDirection.DOWN) { - return new FluidTankInfo[] { this.tankEssence.getInfo() }; - } else { - return new FluidTankInfo[] { this.tankLiquidXp.getInfo() }; - } - } - - @Override - public FluidStack getFluid() { - if (mConvertToEssence) { - return this.tankEssence.getFluid(); - } else { - return this.tankLiquidXp.getFluid(); - } - } - - @Override - public int getFluidAmount() { - if (mConvertToEssence) { - return this.tankEssence.getFluidAmount(); - } else { - return this.tankLiquidXp.getFluidAmount(); - } - } - - @Override - public FluidTankInfo getInfo() { - if (mConvertToEssence) { - return this.tankEssence.getInfo(); - } else { - return this.tankLiquidXp.getInfo(); - } - } - - @Override - public int fill(FluidStack resource, boolean doFill) { - if (mConvertToEssence) { - return this.tankEssence.fill(resource, doFill); - } else { - return this.tankLiquidXp.fill(resource, doFill); - } - } - - @Override - public FluidStack drain(int maxDrain, boolean doDrain) { - if (mConvertToEssence) { - return this.tankEssence.drain(maxDrain, doDrain); - } else { - return this.tankLiquidXp.drain(maxDrain, doDrain); - } - } -} diff --git a/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityModularityTable.java b/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityModularityTable.java deleted file mode 100644 index 45c20ce07d..0000000000 --- a/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityModularityTable.java +++ /dev/null @@ -1,482 +0,0 @@ -package gtPlusPlus.core.tileentities.machines; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Map.Entry; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; -import net.minecraft.inventory.ISidedInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -import gregtech.api.enums.ItemList; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.core.container.Container_ModularityTable; -import gtPlusPlus.core.inventories.modulartable.InventoryModularMain; -import gtPlusPlus.core.inventories.modulartable.InventoryModularOutput; -import gtPlusPlus.core.item.bauble.ModularBauble; -import gtPlusPlus.core.tileentities.base.TileEntityBase; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.ModularArmourUtils; -import gtPlusPlus.core.util.minecraft.ModularArmourUtils.BT; -import gtPlusPlus.core.util.minecraft.ModularArmourUtils.Modifiers; - -public class TileEntityModularityTable extends TileEntityBase implements ISidedInventory { - - public InventoryModularMain inventoryGrid; - public InventoryModularOutput inventoryOutputs; - public InventoryModularOutput mTempRecipeStorage; - private Container_ModularityTable container; - private String customName; - private int mRecipeTimeRemaining = -1; - - public TileEntityModularityTable() { - super(16); - this.inventoryGrid = new InventoryModularMain(); - this.inventoryOutputs = new InventoryModularOutput(); - this.mTempRecipeStorage = new InventoryModularOutput(); - this.canUpdate(); - generateAllValidUpgrades(); - } - - public void setContainer(Container_ModularityTable container_ModularityTable) { - this.container = container_ModularityTable; - } - - public Container_ModularityTable getContainer() { - return this.container; - } - - public int getRecipeTime() { - return this.mRecipeTimeRemaining; - } - - @Override - public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag) { - if (!nbt.hasKey(tag)) { - nbt.setTag(tag, new NBTTagCompound()); - } - return nbt.getCompoundTag(tag); - } - - @Override - public void writeToNBT(final NBTTagCompound nbt) { - super.writeToNBT(nbt); - nbt.setInteger("mRecipeTime", this.mRecipeTimeRemaining); - this.inventoryOutputs.writeToNBT(this.getTag(nbt, "ContentsOutput")); - this.inventoryGrid.writeToNBT(this.getTag(nbt, "ContentsGrid")); - this.mTempRecipeStorage.writeToNBT(this.getTag(nbt, "ContentsRecipeTemp")); - if (this.hasCustomInventoryName()) { - nbt.setString("CustomName", this.getCustomName()); - } - } - - @Override - public void readFromNBT(final NBTTagCompound nbt) { - super.readFromNBT(nbt); - this.mRecipeTimeRemaining = nbt.getInteger("mRecipeTime"); - this.inventoryOutputs.readFromNBT(nbt.getCompoundTag("ContentsOutput")); - this.inventoryGrid.readFromNBT(nbt.getCompoundTag("ContentsGrid")); - this.mTempRecipeStorage.readFromNBT(nbt.getCompoundTag("ContentsRecipeTemp")); - if (nbt.hasKey("CustomName", 8)) { - this.setCustomName(nbt.getString("CustomName")); - } - } - - protected ItemStack mOutputStack; // Upgraded Bauble - protected ItemStack mInputstackA; // Bauble - protected ItemStack mInputstackB; // Upgrade - - public ItemStack getPendingOutputItem() { - this.mRecipeTimeRemaining--; - return this.mOutputStack; - } - - public ItemStack[] getCurrentInputItems() { - if (this.mRecipeTimeRemaining < 0) { - return null; - } else { - return new ItemStack[] { this.mInputstackA, this.mInputstackB }; - } - } - - public boolean setInputStacks(ItemStack tBauble, ItemStack tUpgrade) { - if (tBauble != null) { - this.mInputstackA = tBauble; - } else { - this.mInputstackA = null; - } - if (tUpgrade != null) { - this.mInputstackB = tBauble; - } else { - this.mInputstackB = null; - } - if (this.mInputstackA != null && this.mInputstackB != null) { - return true; - } - return false; - } - - public boolean setOutputStack(ItemStack mNewBauble) { - if (mNewBauble != null) { - this.mOutputStack = mNewBauble; - return true; - } else { - this.mOutputStack = null; - return false; - } - } - - public boolean clearRecipeData() { - this.mInputstackA = null; - this.mInputstackB = null; - this.mOutputStack = null; - return true; - } - - @Override - public boolean canUpdate() { - return true; - } - - public static Map<ItemStack, Pair<Modifiers, Integer>> mValidUpgradeList = new HashMap<ItemStack, Pair<Modifiers, Integer>>(); - public static Map<ItemStack, BT> mValidUpgradeListFormChange = new HashMap<ItemStack, BT>(); - - private static boolean generateAllValidUpgrades() { - - // Form Change - generateUpgradeFormData(ItemList.Sensor_MV.get(1), BT.TYPE_RING); - generateUpgradeFormData(ItemList.Electric_Piston_MV.get(1), BT.TYPE_BELT); - generateUpgradeFormData(ItemList.Emitter_MV.get(1), BT.TYPE_AMULET); - - // Damage Boost - generateUpgradeData(ItemList.Electric_Motor_LV.get(1), Modifiers.BOOST_DAMAGE, 1); - generateUpgradeData(ItemList.Electric_Motor_MV.get(1), Modifiers.BOOST_DAMAGE, 2); - generateUpgradeData(ItemList.Electric_Motor_HV.get(1), Modifiers.BOOST_DAMAGE, 3); - generateUpgradeData(ItemList.Electric_Motor_EV.get(1), Modifiers.BOOST_DAMAGE, 4); - generateUpgradeData(ItemList.Electric_Motor_IV.get(1), Modifiers.BOOST_DAMAGE, 5); - - // Defence Boost - generateUpgradeData( - ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateAluminium", 1), - Modifiers.BOOST_DEF, - 1); - generateUpgradeData( - ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateStainlessSteel", 1), - Modifiers.BOOST_DEF, - 2); - generateUpgradeData( - ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateTungsten", 1), - Modifiers.BOOST_DEF, - 3); - generateUpgradeData( - ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateTungstenSteel", 1), - Modifiers.BOOST_DEF, - 4); - generateUpgradeData( - ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateNaquadah", 1), - Modifiers.BOOST_DEF, - 5); - - // Hp Boost - generateUpgradeData(ItemUtils.simpleMetaStack(Items.golden_apple, 0, 1), Modifiers.BOOST_HP, 1); - generateUpgradeData(ItemUtils.simpleMetaStack(Items.golden_apple, 1, 1), Modifiers.BOOST_HP, 2); - generateUpgradeData(ItemUtils.simpleMetaStack(Items.nether_star, 0, 1), Modifiers.BOOST_HP, 3); - generateUpgradeData( - ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01:32725", 32725, 1), - Modifiers.BOOST_HP, - 4); - generateUpgradeData( - ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01:32726", 32726, 1), - Modifiers.BOOST_HP, - 5); - - return true; - } - - public static boolean generateUpgradeData(ItemStack tStack, Modifiers tMod, int tLevel) { - Pair<Modifiers, Integer> tTemp = new Pair<Modifiers, Integer>(tMod, tLevel); - if (mValidUpgradeList.put(tStack, tTemp) != null) { - return true; - } - return false; - } - - public static boolean generateUpgradeFormData(ItemStack tStack, BT tMod) { - if (mValidUpgradeListFormChange.put(tStack, tMod) != null) { - return true; - } - return false; - } - - public static boolean addUpgrade(ItemStack tStack, ItemStack tBauble) { - - try { - Iterator<Entry<ItemStack, BT>> it = mValidUpgradeListFormChange.entrySet().iterator(); - while (it.hasNext()) { - Entry<ItemStack, BT> pair = it.next(); - if (pair.getKey().getItem() == tStack.getItem() - && pair.getKey().getItemDamage() == tStack.getItemDamage()) { - ModularArmourUtils.setBaubleType(tBauble, pair.getValue()); - tBauble.setItemDamage(ModularArmourUtils.getBaubleTypeID(tBauble)); - return true; - } - } - } catch (Throwable t) { - - } - try { - Iterator<Entry<ItemStack, Pair<Modifiers, Integer>>> it2 = mValidUpgradeList.entrySet().iterator(); - while (it2.hasNext()) { - Entry<ItemStack, Pair<Modifiers, Integer>> pair = it2.next(); - if (pair.getKey().getItem() == tStack.getItem() - && pair.getKey().getItemDamage() == tStack.getItemDamage()) { - Pair<Modifiers, Integer> newPair = pair.getValue(); - ModularArmourUtils.setModifierLevel(tBauble, newPair); - return true; - } - } - } catch (Throwable t) { - - } - return false; - } - - @Override - public int getSizeInventory() { - return 11; - } - - @Override - public ItemStack getStackInSlot(int slot) { - if (slot >= this.inventoryGrid.getSizeInventory()) { - return this.inventoryOutputs.getStackInSlot(slot - 9); - } else if (slot < this.inventoryGrid.getSizeInventory()) { - return this.inventoryGrid.getStackInSlot(slot); - } else { - return null; - } - } - - @Override - public ItemStack decrStackSize(int slot, int count) { - if (slot < this.inventoryGrid.getSizeInventory()) { - return this.inventoryGrid.decrStackSize(slot, count); - } else if (slot >= this.inventoryGrid.getSizeInventory()) { - return this.inventoryOutputs.decrStackSize(slot - 9, count); - } else { - return null; - } - } - - @Override - public ItemStack getStackInSlotOnClosing(int slot) { - return this.getStackInSlot(slot); - } - - @Override - public void setInventorySlotContents(int slot, ItemStack stack) { - if (slot >= this.inventoryGrid.getSizeInventory()) { - this.inventoryOutputs.setInventorySlotContents(slot - 9, stack); - } else if (slot < this.inventoryGrid.getSizeInventory()) { - this.inventoryGrid.setInventorySlotContents(slot, stack); - } - } - - @Override - public int getInventoryStackLimit() { - return 64; - } - - @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) { - return true; - } - - @Override - public void openInventory() { - this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, 1); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType()); - this.inventoryGrid.openInventory(); - this.inventoryOutputs.openInventory(); - } - - @Override - public void closeInventory() { - this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, 1); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType()); - this.inventoryGrid.openInventory(); - this.inventoryOutputs.openInventory(); - } - - @Override - public boolean isItemValidForSlot(int slot, ItemStack itemstack) { - if (slot >= this.inventoryGrid.getSizeInventory()) { - return this.inventoryOutputs.isItemValidForSlot(slot - 9, itemstack); - } else if (slot < this.inventoryGrid.getSizeInventory()) { - return this.inventoryGrid.isItemValidForSlot(slot, itemstack); - } else { - return false; - } - } - - @Override - public int[] getAccessibleSlotsFromSide(int side) { - int[] accessibleSides = new int[this.getSizeInventory()]; - for (int r = 0; r < this.getSizeInventory(); r++) { - accessibleSides[r] = r; - } - return accessibleSides; - } - - @Override - public boolean canInsertItem(int slot, ItemStack item, int side) { - Logger.INFO("Slot:" + slot + " | side? " + side); - - /* - * if (side == 1){ return this.inventoryOutputs.isItemValidForSlot(slot-9, item); } - */ - if (slot >= 9) { - return this.inventoryOutputs.isItemValidForSlot(slot - 9, item); - } else { - return this.inventoryGrid.isItemValidForSlot(slot, item); - } - } - - @Override - public boolean canExtractItem(int slot, ItemStack item, int side) { - Logger.INFO("Slot:" + slot + " | side? " + side); - if (slot == 11 || slot <= 8) { - return true; - } - return false; - } - - @Override - public String getCustomName() { - return this.customName; - } - - @Override - public void setCustomName(String customName) { - this.customName = customName; - } - - @Override - public String getInventoryName() { - return this.hasCustomInventoryName() ? this.customName : "container.fishtrap"; - } - - @Override - public boolean hasCustomInventoryName() { - return this.customName != null && !this.customName.equals(""); - } - - @Override - public boolean onPreTick(long aTick) { - // Check for active recipe - if (this.mRecipeTimeRemaining > -1 - || (this.mTempRecipeStorage != null) && (this.mTempRecipeStorage.getRecipeTime() > -1)) { - if ((this.mTempRecipeStorage != null) && this.mTempRecipeStorage.getRecipeTime() > -1) { - if (this.mRecipeTimeRemaining < this.mTempRecipeStorage.getRecipeTime()) { - this.mRecipeTimeRemaining = this.mTempRecipeStorage.getRecipeTime(); - this.markDirty(); - } - } - if (this.mInputstackA != null && this.mInputstackB != null && this.mOutputStack != null) { - this.mTempRecipeStorage.setInventorySlotContents(0, this.mInputstackA); - this.mTempRecipeStorage.setInventorySlotContents(1, this.mInputstackB); - this.mTempRecipeStorage.setInventorySlotContents(2, this.mOutputStack); - this.mTempRecipeStorage.setRecipeTime(this.mRecipeTimeRemaining); - this.markDirty(); - } - } - return true; - } - - @Override - public boolean onPostTick(long aTick) { - if (mRecipeTimeRemaining == 0) { - this.inventoryOutputs.setInventorySlotContents(2, this.getPendingOutputItem()); - clearRecipeData(); - this.mTempRecipeStorage.setRecipeTime(this.mRecipeTimeRemaining); - this.markDirty(); - } else if (mRecipeTimeRemaining > 0) { - mRecipeTimeRemaining--; - this.mTempRecipeStorage.setRecipeTime(this.mRecipeTimeRemaining); - } - return true; - } - - @Override - public boolean processRecipe() { - boolean removeInputA = false; - boolean removeInputB = false; - // Data stick - ItemStack tBauble = this.inventoryOutputs.getStackInSlot(0); - ItemStack tUpgrade = this.inventoryOutputs.getStackInSlot(1); - if (tBauble != null && tUpgrade != null && this.container != null) { - if (tBauble.getItem() instanceof ModularBauble && this.mRecipeTimeRemaining == -1) { - if (tUpgrade != null && tBauble != null) { - removeInputA = true; - this.setInputStacks(tBauble, tUpgrade); - try { - removeInputB = addUpgrade(tUpgrade, tBauble); - if (!removeInputB) {} - } catch (Throwable t) {} - if (removeInputA && removeInputB) { - if (this.setOutputStack(tBauble)) { - if (this.inventoryOutputs.getStackInSlot(1).stackSize > 1) { - ItemStack mTempStack = this.inventoryOutputs.getStackInSlot(1); - mTempStack.stackSize--; - this.inventoryOutputs.setInventorySlotContents(1, mTempStack); - } else { - this.inventoryOutputs.setInventorySlotContents(1, null); - } - this.inventoryOutputs.setInventorySlotContents(0, null); - this.mRecipeTimeRemaining = 80; - this.markDirty(); - return true; - } - } - } - } - } - return false; - } - - public static boolean isValidModularPiece(final ItemStack itemstack) { - if (itemstack.getItem() instanceof ModularBauble) { - return true; - } - return false; - } - - public static boolean isValidUpgrade(final ItemStack itemstack) { - boolean isValid = false; - if (itemstack != null) { - Iterator<Entry<ItemStack, BT>> it = mValidUpgradeListFormChange.entrySet().iterator(); - while (it.hasNext()) { - Entry<ItemStack, BT> pair = it.next(); - if (pair.getKey().getItem() == itemstack.getItem() - && pair.getKey().getItemDamage() == itemstack.getItemDamage()) { - isValid = true; - } - } - Iterator<Entry<ItemStack, Pair<Modifiers, Integer>>> it2 = mValidUpgradeList.entrySet().iterator(); - while (it2.hasNext()) { - Entry<ItemStack, Pair<Modifiers, Integer>> pair = it2.next(); - if (pair.getKey().getItem() == itemstack.getItem() - && pair.getKey().getItemDamage() == itemstack.getItemDamage()) { - isValid = true; - } - } - } - return isValid; - } -} diff --git a/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityProjectTable.java b/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityProjectTable.java index 0d74b69fb2..0229f89402 100644 --- a/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityProjectTable.java +++ b/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityProjectTable.java @@ -4,7 +4,6 @@ import java.util.List; import java.util.Vector; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; @@ -17,11 +16,6 @@ import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.container.Container_ProjectTable; import gtPlusPlus.core.inventories.projecttable.InventoryProjectMain; import gtPlusPlus.core.inventories.projecttable.InventoryProjectOutput; -import gtPlusPlus.core.item.bauble.ModularBauble; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.ModularArmourUtils; -import gtPlusPlus.core.util.minecraft.ModularArmourUtils.BT; -import gtPlusPlus.core.util.minecraft.ModularArmourUtils.Modifiers; import gtPlusPlus.core.util.minecraft.NBTUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechItems; @@ -165,136 +159,6 @@ public class TileEntityProjectTable extends TileEntity } } - // Utils.LOG_INFO("Doing thing 1"); - if (dataStick != null) if (dataStick.getItem() instanceof ModularBauble) { - Logger.INFO("Doing thing 2"); - ItemStack tBauble = dataStick; - dataStick = null; - this.inventoryOutputs.setInventorySlotContents(0, dataStick); - if (this.inventoryGrid != null) { - Logger.INFO("Doing things"); - ItemStack[] tStack = container.getInputComponents(); - if (tStack != null) { - // Utils.LOG_INFO(""+tStack.length); - if (tBauble != null) { - for (int i = 0; i < tStack.length; i++) { - - ItemStack testStack; - if ((testStack = container.inventoryGrid.getStackInSlot(i)) != null) { - Logger.INFO("FOUND: " + testStack.getDisplayName()); - } - - if (tStack[i] != null) { - Logger.INFO("found " + tStack[i].getDisplayName()); - try { - if (tStack[i].getItem() == Items.feather) { - ModularArmourUtils.setBaubleType(tBauble, BT.TYPE_BELT); - Logger.INFO("buffed Modular bauble"); - tStack[i] = null; - container.inventoryGrid.setInventorySlotContents(i, null); - this.inventoryGrid.setInventorySlotContents(i, null); - } - if (tStack[i].getItem() == Items.bed) { - ModularArmourUtils.setBaubleType(tBauble, BT.TYPE_RING); - Logger.INFO("buffed Modular bauble"); - tStack[i] = null; - container.inventoryGrid.setInventorySlotContents(i, null); - this.inventoryGrid.setInventorySlotContents(i, null); - } - if (tStack[i].getItem() == Items.boat) { - ModularArmourUtils.setBaubleType(tBauble, BT.TYPE_AMULET); - Logger.INFO("buffed Modular bauble"); - tStack[i] = null; - container.inventoryGrid.setInventorySlotContents(i, null); - this.inventoryGrid.setInventorySlotContents(i, null); - } - - if (tStack[i].getItem() == Items.egg) { - ModularArmourUtils.setModifierLevel( - tBauble, - Modifiers.BOOST_HOLY, - ModularArmourUtils.getModifierLevel(tBauble, Modifiers.BOOST_HOLY) - + 1); - Logger.INFO("buffed Modular bauble"); - tStack[i] = null; - container.inventoryGrid.setInventorySlotContents(i, null); - this.inventoryGrid.setInventorySlotContents(i, null); - } - - if (tStack[i].getItem() == Items.baked_potato) { - ModularArmourUtils.setModifierLevel( - tBauble, - Modifiers.BOOST_DEF, - ModularArmourUtils.getModifierLevel(tBauble, Modifiers.BOOST_DEF) - + 1); - Logger.INFO("buffed Modular bauble"); - tStack[i] = null; - container.inventoryGrid.setInventorySlotContents(i, null); - this.inventoryGrid.setInventorySlotContents(i, null); - } - - if (tStack[i].getItem() == Items.cooked_beef) { - ModularArmourUtils.setModifierLevel( - tBauble, - Modifiers.BOOST_HP, - ModularArmourUtils.getModifierLevel(tBauble, Modifiers.BOOST_HP) - + 1); - Logger.INFO("buffed Modular bauble"); - tStack[i] = null; - container.inventoryGrid.setInventorySlotContents(i, null); - this.inventoryGrid.setInventorySlotContents(i, null); - } - - if (tStack[i] == ItemUtils - .simpleMetaStack("gregtech:gt.metaitem.01:17019", 17019, 1)) { - ModularArmourUtils.setModifierLevel( - tBauble, - Modifiers.BOOST_DEF, - ModularArmourUtils.getModifierLevel(tBauble, Modifiers.BOOST_DEF) - + 1); - Logger.INFO("buffed Modular bauble"); - tStack[i] = null; - container.inventoryGrid.setInventorySlotContents(i, null); - } - if (tStack[i] == ItemList.Electric_Motor_LV.get(1)) { - ModularArmourUtils.setModifierLevel( - tBauble, - Modifiers.BOOST_DAMAGE, - ModularArmourUtils.getModifierLevel(tBauble, Modifiers.BOOST_DAMAGE) - + 1); - Logger.INFO("buffed Modular bauble"); - tStack[i] = null; - container.inventoryGrid.setInventorySlotContents(i, null); - } else if (tStack[i] == ItemList.Electric_Motor_MV.get(1)) { - ModularArmourUtils.setModifierLevel( - tBauble, - Modifiers.BOOST_DAMAGE, - ModularArmourUtils.getModifierLevel(tBauble, Modifiers.BOOST_DAMAGE) - + 2); - Logger.INFO("buffed Modular bauble"); - tStack[i] = null; - container.inventoryGrid.setInventorySlotContents(i, null); - } else if (tStack[i] == ItemList.Electric_Motor_HV.get(1)) { - ModularArmourUtils.setModifierLevel( - tBauble, - Modifiers.BOOST_DAMAGE, - ModularArmourUtils.getModifierLevel(tBauble, Modifiers.BOOST_DAMAGE) - + 3); - Logger.INFO("buffed Modular bauble"); - tStack[i] = null; - container.inventoryGrid.setInventorySlotContents(i, null); - } - } catch (Throwable t) { - - } - } - } - Logger.INFO("set new Modular bauble"); - this.inventoryOutputs.setInventorySlotContents(1, tBauble); - } - } - } - } } super.updateEntity(); } diff --git a/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityTradeTable.java b/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityTradeTable.java deleted file mode 100644 index bf3a3c704e..0000000000 --- a/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityTradeTable.java +++ /dev/null @@ -1,123 +0,0 @@ -package gtPlusPlus.core.tileentities.machines; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -import gtPlusPlus.core.container.Container_TradeTable; -import gtPlusPlus.core.inventories.tradetable.InventoryTradeMain; -import gtPlusPlus.core.inventories.tradetable.InventoryTradeOutput; -import gtPlusPlus.core.tileentities.base.TileEntityBase; -import gtPlusPlus.core.util.minecraft.NBTUtils; - -public class TileEntityTradeTable extends TileEntityBase { - - public InventoryTradeMain inventoryGrid; - public InventoryTradeOutput inventoryOutputs; - - private Container_TradeTable container; - - public TileEntityTradeTable() { - super(2); - this.inventoryGrid = new InventoryTradeMain(); // number of slots - without product slot - this.inventoryOutputs = new InventoryTradeOutput(); // number of slots - without product slot - } - - public void setContainer(Container_TradeTable container_TradeTable) { - this.container = container_TradeTable; - } - - @Override - public void writeToNBT(final NBTTagCompound nbt) { - super.writeToNBT(nbt); - this.inventoryGrid.writeToNBT(this.getTag(nbt, "ContentsGrid")); - this.inventoryOutputs.writeToNBT(this.getTag(nbt, "ContentsOutput")); - } - - @Override - public void readFromNBT(final NBTTagCompound nbt) { - this.inventoryGrid.readFromNBT(nbt); - this.inventoryOutputs.readFromNBT(nbt); - super.readFromNBT(nbt); - } - - @Override - public void updateEntity() { - if (!this.worldObj.isRemote) { - ItemStack slot0; - try { - - slot0 = this.inventoryOutputs.getStackInSlot(0); - if (slot0 != null && slot0.hasTagCompound()) { - NBTUtils.tryIterateNBTData(slot0); - this.inventoryOutputs.setInventorySlotContents(0, null); - this.inventoryOutputs.setInventorySlotContents(1, slot0); - } - - } catch (Throwable t) { - t.printStackTrace(); - this.inventoryOutputs.setInventorySlotContents(0, null); - } - } - super.updateEntity(); - } - - @Override - public int getSizeInventory() { - return 0; - } - - @Override - public ItemStack getStackInSlot(int p_70301_1_) { - return null; - } - - @Override - public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_) { - return null; - } - - @Override - public ItemStack getStackInSlotOnClosing(int p_70304_1_) { - return null; - } - - @Override - public void setInventorySlotContents(int p_70299_1_, ItemStack p_70299_2_) {} - - @Override - public int getInventoryStackLimit() { - return 64; - } - - @Override - public boolean isUseableByPlayer(EntityPlayer p_70300_1_) { - return true; - } - - @Override - public void openInventory() {} - - @Override - public void closeInventory() {} - - @Override - public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) { - return false; - } - - @Override - public int[] getAccessibleSlotsFromSide(int side) { - return new int[] {}; - } - - @Override - public boolean canInsertItem(int p_102007_1_, ItemStack p_102007_2_, int side) { - return false; - } - - @Override - public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_, int p_102008_3_) { - return false; - } -} |