aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/tileentities
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/core/tileentities')
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java22
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/base/TileEntityBase.java18
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/general/TileEntityCircuitProgrammer.java35
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/machines/TileEntityPestKiller.java506
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/machines/TileEntityRoundRobinator.java739
5 files changed, 1305 insertions, 15 deletions
diff --git a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java b/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java
index c3670ef959..e7b7c46e7b 100644
--- a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java
+++ b/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java
@@ -1,14 +1,26 @@
package gtPlusPlus.core.tileentities;
import cpw.mods.fml.common.registry.GameRegistry;
-
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.block.general.BlockSuperLight.TileEntitySuperLight;
import gtPlusPlus.core.block.machine.Machine_SuperJukebox.TileEntitySuperJukebox;
import gtPlusPlus.core.lib.LoadedMods;
-import gtPlusPlus.core.tileentities.general.*;
-import gtPlusPlus.core.tileentities.general.redstone.TileEntityRedstoneHandler;
-import gtPlusPlus.core.tileentities.machines.*;
+import gtPlusPlus.core.tileentities.general.TileEntityCircuitProgrammer;
+import gtPlusPlus.core.tileentities.general.TileEntityDecayablesChest;
+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.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.core.tileentities.machines.TileEntityWorkbench;
+import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced;
import gtPlusPlus.plugin.villagers.tile.TileEntityGenericSpawner;
public class ModTileEntities {
@@ -32,6 +44,8 @@ public class ModTileEntities {
GameRegistry.registerTileEntity(TileEntityDecayablesChest.class, "TileDecayablesChest");
GameRegistry.registerTileEntity(TileEntitySuperJukebox.class, "TileEntitySuperJukebox");
GameRegistry.registerTileEntity(TileEntitySuperLight.class, "TileEntitySuperLight");
+ GameRegistry.registerTileEntity(TileEntityPestKiller.class, "TileEntityPestKiller");
+ GameRegistry.registerTileEntity(TileEntityRoundRobinator.class, "TileEntityRoundRobinator");
//Mod TEs
diff --git a/src/Java/gtPlusPlus/core/tileentities/base/TileEntityBase.java b/src/Java/gtPlusPlus/core/tileentities/base/TileEntityBase.java
index 4f9a8d3748..65ae9218fe 100644
--- a/src/Java/gtPlusPlus/core/tileentities/base/TileEntityBase.java
+++ b/src/Java/gtPlusPlus/core/tileentities/base/TileEntityBase.java
@@ -1315,6 +1315,24 @@ public class TileEntityBase extends TileEntity implements ILazyCoverable, IGregT
}
return false;
}
+
+
+ /**
+ * Adds support for the newer function added by https://github.com/Blood-Asp/GT5-Unofficial/commit/73ee102b63efd92c0f164a7ed7a79ebcd2619617#diff-3051838621d8ae87aa5ccd1345e1f07d
+ */
+ public boolean inputEnergyFrom(byte arg0, boolean arg1) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+
+ /**
+ * Adds support for the newer function added by https://github.com/Blood-Asp/GT5-Unofficial/commit/73ee102b63efd92c0f164a7ed7a79ebcd2619617#diff-3051838621d8ae87aa5ccd1345e1f07d
+ */
+ public boolean outputsEnergyTo(byte arg0, boolean arg1) {
+ // TODO Auto-generated method stub
+ return false;
+ }
diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityCircuitProgrammer.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityCircuitProgrammer.java
index 0cda40c616..23ad2a3233 100644
--- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityCircuitProgrammer.java
+++ b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityCircuitProgrammer.java
@@ -11,6 +11,7 @@ import net.minecraft.tileentity.TileEntity;
import gtPlusPlus.api.objects.data.AutoMap;
import gtPlusPlus.core.inventories.InventoryCircuitProgrammer;
import gtPlusPlus.core.recipe.common.CI;
+import gtPlusPlus.core.slots.SlotIntegratedCircuit;
import gtPlusPlus.core.util.minecraft.PlayerUtils;
public class TileEntityCircuitProgrammer extends TileEntity implements ISidedInventory {
@@ -76,16 +77,21 @@ public class TileEntityCircuitProgrammer extends TileEntity implements ISidedInv
boolean doAdd = false;
ItemStack g = this.getStackInSlot(e);
int aSize = 0;
- ItemStack aInputStack = null;
- if (g != null) {
+ ItemStack aInputStack = null;
+ int aTypeInSlot = SlotIntegratedCircuit.isRegularProgrammableCircuit(g);
+ if (aTypeInSlot >= 0 && g != null) {
+ // No Existing Output
if (!hasOutput) {
aSize = g.stackSize;
doAdd = true;
}
+ // Existing Output
else {
ItemStack f = this.getStackInSlot(25);
- if (f != null) {
- if (f.getItemDamage() == e) {
+ int aTypeInCheckedSlot = SlotIntegratedCircuit.isRegularProgrammableCircuit(f);
+ // Check that the Circuit in the Output slot is not null and the same type as the circuit input.
+ if (aTypeInCheckedSlot >= 0 && (aTypeInSlot == aTypeInCheckedSlot) && f != null) {
+ if (g.getItem() == f.getItem() && f.getItemDamage() == e) {
aSize = f.stackSize + g.stackSize;
if (aSize > 64) {
aInputStack = g.copy();
@@ -93,16 +99,23 @@ public class TileEntityCircuitProgrammer extends TileEntity implements ISidedInv
}
doAdd = true;
}
- }
- else {
- doAdd = true;
- aSize = g.stackSize;
}
}
- if (doAdd) {
- ItemStack aOutput = CI.getNumberedCircuit(e);
- aOutput.stackSize = aSize;
+ if (doAdd) {
+ // Check Circuit Type
+ ItemStack aOutput;
+ if (aTypeInSlot == 0) {
+ aOutput = CI.getNumberedCircuit(e);
+ }
+ else if (aTypeInSlot == 1) {
+ aOutput = CI.getNumberedBioCircuit(e);
+ }
+ else {
+ aOutput = null;
+ }
+
if (aOutput != null) {
+ aOutput.stackSize = aSize;
this.setInventorySlotContents(e, aInputStack);
this.setInventorySlotContents(25, aOutput);
return true;
diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityPestKiller.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityPestKiller.java
new file mode 100644
index 0000000000..3ebe5be40d
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityPestKiller.java
@@ -0,0 +1,506 @@
+package gtPlusPlus.core.tileentities.machines;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.api.objects.minecraft.BTF_FluidTank;
+import gtPlusPlus.core.inventories.InventoryPestKiller;
+import gtPlusPlus.core.lib.LoadedMods;
+import gtPlusPlus.core.material.MISC_MATERIALS;
+import gtPlusPlus.core.recipe.common.CI;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.EntityUtils;
+import gtPlusPlus.core.util.minecraft.FluidUtils;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.passive.EntityBat;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.ISidedInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.network.NetworkManager;
+import net.minecraft.network.Packet;
+import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.DamageSource;
+import net.minecraft.world.World;
+import net.minecraft.world.chunk.Chunk;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidEvent;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTank;
+import net.minecraftforge.fluids.FluidTankInfo;
+import net.minecraftforge.fluids.IFluidHandler;
+import net.minecraftforge.oredict.OreDictionary;
+
+public class TileEntityPestKiller extends TileEntity implements ISidedInventory, IFluidHandler {
+
+ private final int mBaseTickRate = 20 * 30;
+ private final InventoryPestKiller mInventory;
+ private final FluidTank mTank;
+ private int mChunkX;
+ private int mChunkZ;
+ private boolean mSet = false;
+
+ private int mTickCounter = 0;
+ private int mUpdateTick = 0;
+ private boolean mNeedsUpdate = false;
+ private String mCustomName;
+
+ private static final AutoMap<Class<?>> mEntityMap = new AutoMap<Class<?>>();
+
+ static {
+ mEntityMap.put(EntityBat.class);
+ if (LoadedMods.Forestry) {
+ mEntityMap.put(ReflectionUtils.getClass("forestry.lepidopterology.entities.EntityButterfly"));
+ }
+ }
+
+ public TileEntityPestKiller() {
+ this.mInventory = new InventoryPestKiller();
+ mTank = new BTF_FluidTank(2000);
+ }
+
+ public InventoryPestKiller getInventory() {
+ return this.mInventory;
+ }
+
+ public FluidTank getTank() {
+ return mTank;
+ }
+
+ private final void setup() {
+ World w = this.worldObj;
+ if (w != null) {
+ Chunk c = w.getChunkFromBlockCoords(this.xCoord, this.zCoord);
+ if (c != null) {
+ mChunkX = c.xPosition;
+ mChunkZ = c.zPosition;
+ mSet = true;
+ }
+ }
+ }
+
+ @SuppressWarnings("rawtypes")
+ public boolean tryKillPests() {
+ int min = 0;
+ int max = 0;
+ switch (getTier()) {
+ case 1:
+ min = -2;
+ max = 3;
+ break;
+ case 2:
+ min = -4;
+ max = 5;
+ break;
+ default:
+ // code block
+ }
+ int aChunkCount = 0;
+ AutoMap<Entity> entities = new AutoMap<Entity>();
+ if (min != 0 && max != 0) {
+ for (int x = min; x < max; x++) {
+ for (int z = min; z < max; z++) {
+ Chunk c = getChunkFromOffsetIfLoaded(x, z);
+ if (c != null) {
+ if (c.hasEntities) {
+ aChunkCount++;
+ List[] lists = c.entityLists;
+ for (List o : lists) {
+ for (Object e : o) {
+ if (e instanceof Entity) {
+ for (Class<?> C : mEntityMap) {
+ if (e.getClass().equals(C) || C.isAssignableFrom(e.getClass())) {
+ entities.put((Entity) e);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ } else {
+ Chunk c = getChunkFromOffsetIfLoaded(0, 0);
+ if (c != null) {
+ if (c.hasEntities) {
+ List[] lists = c.entityLists;
+ for (List o : lists) {
+ for (Object e : o) {
+ if (e instanceof Entity) {
+ for (Class<?> C : mEntityMap) {
+ if (e.getClass().equals(C) || C.isAssignableFrom(e.getClass())) {
+ entities.put((Entity) e);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ boolean killed = false;
+ if (!entities.isEmpty()) {
+ for (Entity e : entities) {
+ if (e != null) {
+ if (e.isEntityAlive()) {
+ if (this.mTank.getFluidAmount() >= 1 || getTier() == 0) {
+ if (getTier() > 0) {
+ int aChanceToUse = MathUtils.randInt(1, (100 * getTier()));
+ if (aChanceToUse == 1) {
+ this.mTank.drain(1, true);
+ }
+ }
+ e.performHurtAnimation();
+ EntityUtils.doDamage(e, DamageSource.generic, Short.MAX_VALUE);
+ e.setDead();
+ killed = true;
+ }
+ }
+ }
+ }
+ }
+ updateTileEntity();
+ return killed;
+ }
+
+ public Chunk getChunkFromOffsetIfLoaded(int x, int y) {
+ Chunk c = this.worldObj.getChunkFromChunkCoords(mChunkX + x, mChunkZ + y);
+ if (c.isChunkLoaded) {
+ return c;
+ }
+ return null;
+ }
+
+ public int getTier() {
+ if (this.mTank != null) {
+ FluidStack f = mTank.getFluid();
+ if (f != null) {
+ if (f.isFluidEqual(FluidUtils.getWildcardFluidStack("formaldehyde", 1))) {
+ return 1;
+ } else if (f.isFluidEqual(MISC_MATERIALS.HYDROGEN_CYANIDE.getFluid(1))) {
+ return 2;
+ }
+ }
+ }
+ return 0;
+ }
+
+ @Override
+ public void updateEntity() {
+ if (worldObj.isRemote) {
+ return;
+ }
+ if (!mSet) {
+ setup();
+ }
+ this.mTickCounter++;
+ if (this.mTank != null) {
+ if (this.hasFluidSpace()) {
+ handleInventory();
+ }
+ }
+ if (this.mTickCounter % this.mBaseTickRate == 0) {
+ tryKillPests();
+ }
+ updateTick();
+ }
+
+ 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) {
+ mTank.writeToNBT(nbt);
+ super.writeToNBT(nbt);
+ // Utils.LOG_MACHINE_INFO("Trying to write NBT data to TE.");
+ final NBTTagCompound chestData = new NBTTagCompound();
+ this.mInventory.writeToNBT(chestData);
+ nbt.setTag("ContentsChest", chestData);
+ if (this.hasCustomInventoryName()) {
+ nbt.setString("CustomName", this.getCustomName());
+ }
+ }
+
+ @Override
+ public void readFromNBT(final NBTTagCompound nbt) {
+ mTank.readFromNBT(nbt);
+ super.readFromNBT(nbt);
+ // Utils.LOG_MACHINE_INFO("Trying to read NBT data from TE.");
+ this.mInventory.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() {
+ 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.getInventory().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.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 aSlot, final ItemStack aStack, final int p_102007_3_) {
+ if (this.getInventory().getInventory()[0] == null) {
+ return true;
+ } else if (GT_Utility.areStacksEqual(aStack, this.getInventory().getInventory()[0])) {
+ if (this.getInventory().getInventory()[0].stackSize < 64) {
+ int diff = 64 - this.getInventory().getInventory()[0].stackSize;
+ if (aStack.stackSize <= diff) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean canExtractItem(final int aSlot, final ItemStack aStack, final int p_102008_3_) {
+ if (this.getInventory().getInventory()[1] == null) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ public String getCustomName() {
+ return this.mCustomName;
+ }
+
+ public void setCustomName(final String customName) {
+ this.mCustomName = customName;
+ }
+
+ @Override
+ public String getInventoryName() {
+ return this.hasCustomInventoryName() ? this.mCustomName : "container.pestkiller";
+ }
+
+ @Override
+ public boolean hasCustomInventoryName() {
+ return (this.mCustomName != null) && !this.mCustomName.equals("");
+ }
+
+ @Override
+ public final int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
+ updateTileEntity();
+ return this.mTank.fill(resource, doFill);
+ }
+
+ @Override
+ public final FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
+ updateTileEntity();
+ return this.mTank.drain(resource.amount, doDrain);
+ }
+
+ @Override
+ public final FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
+ FluidStack fluid = this.mTank.getFluid();
+ // return this.tank.drain(maxDrain, doDrain);
+ if (fluid == null) {
+ return null;
+ }
+
+ int drained = maxDrain;
+ if (fluid.amount < drained) {
+ drained = fluid.amount;
+ }
+
+ FluidStack stack = new FluidStack(fluid, drained);
+ if (doDrain) {
+ fluid.amount -= drained;
+ if (fluid.amount <= 0) {
+ fluid = null;
+ }
+
+ if (this != null) {
+ FluidEvent.fireEvent(new FluidEvent.FluidDrainingEvent(fluid, this.getWorldObj(), this.xCoord,
+ this.yCoord, this.zCoord, this.mTank, 0));
+ }
+ }
+ updateTileEntity();
+ return stack;
+ }
+
+ @Override
+ public boolean canFill(ForgeDirection from, Fluid fluid) {
+ return mTank.getFluid() == null || mTank.getFluid().getFluid().equals(fluid);
+ }
+
+ @Override
+ public boolean canDrain(ForgeDirection from, Fluid fluid) {
+ return false;
+ }
+
+ @Override
+ public final FluidTankInfo[] getTankInfo(ForgeDirection from) {
+ return new FluidTankInfo[] { this.mTank.getInfo() };
+ }
+
+ @Override
+ public final Packet getDescriptionPacket() {
+ NBTTagCompound tag = new NBTTagCompound();
+ writeToNBT(tag);
+ return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, this.blockMetadata, tag);
+ }
+
+ @Override
+ public final void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
+ NBTTagCompound tag = pkt.func_148857_g();
+ readFromNBT(tag);
+ }
+
+
+ public boolean hasFluidSpace() {
+ if (this.mTank.getFluidAmount() <= 1000) {
+ return true;
+ }
+ return false;
+ }
+
+ public boolean drainCell() {
+ boolean didFill = false;
+ ItemStack aInput = this.getStackInSlot(0);
+ if (aInput == null) {
+ return false;
+ }
+ aInput = aInput.copy();
+ if (aInput != null && (this.getStackInSlot(1) == null || this.getStackInSlot(1).stackSize < 64)) {
+ ArrayList<ItemStack> t1Cells = OreDictionary.getOres("cellFormaldehyde");
+ ArrayList<ItemStack> t2Cells = OreDictionary.getOres("cellHydrogenCyanide");
+ didFill = addFluid(t1Cells, aInput, FluidUtils.getWildcardFluidStack("formaldehyde", 1000));
+ if (!didFill) {
+ didFill = addFluid(t2Cells, aInput, MISC_MATERIALS.HYDROGEN_CYANIDE.getFluid(1000));
+ }
+ }
+
+ return didFill;
+ }
+
+ public boolean handleInventory() {
+ if (this.getInventory() != null && drainCell()) {
+ this.decrStackSize(0, 1);
+ if (this.getStackInSlot(1) == null) {
+ this.setInventorySlotContents(1, CI.emptyCells(1));
+ } else {
+ this.getStackInSlot(1).stackSize++;
+ }
+ this.updateTileEntity();
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public boolean addFluid(ArrayList<ItemStack> inputs, ItemStack aInput, FluidStack aFluidForInput) {
+ for (ItemStack a : inputs) {
+ if (GT_Utility.areStacksEqual(a, aInput)) {
+ if (mTank.getFluid() == null || mTank.getFluid()
+ .isFluidEqual(aFluidForInput)) {
+ boolean didFill = fill(ForgeDirection.UNKNOWN, aFluidForInput, true) > 0;
+ return didFill;
+ }
+ } else {
+ continue;
+ }
+ }
+ return false;
+ }
+
+ public void updateTileEntity() {
+ this.getInventory().markDirty();
+ this.markDirty();
+ this.mNeedsUpdate = true;
+ }
+
+ private final void updateTick() {
+ if (mNeedsUpdate) {
+ if (mUpdateTick == 0) {
+ mUpdateTick = 4; // every 4 ticks it will send an update
+ } else {
+ --mUpdateTick;
+ if (mUpdateTick == 0) {
+ markDirty();
+ worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
+ mNeedsUpdate = false;
+ }
+ }
+ }
+ }
+
+
+
+}
diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityRoundRobinator.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityRoundRobinator.java
new file mode 100644
index 0000000000..a220997c84
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityRoundRobinator.java
@@ -0,0 +1,739 @@
+package gtPlusPlus.core.tileentities.machines;
+
+import java.util.List;
+
+import gtPlusPlus.GTplusplus;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.handler.GuiHandler;
+import gtPlusPlus.core.inventories.Inventory_RoundRobinator;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.core.util.sys.KeyboardUtils;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockChest;
+import net.minecraft.command.IEntitySelector;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.ISidedInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.network.NetworkManager;
+import net.minecraft.network.Packet;
+import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
+import net.minecraft.tileentity.IHopper;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.tileentity.TileEntityChest;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.Facing;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.World;
+
+public class TileEntityRoundRobinator extends TileEntity implements ISidedInventory, IHopper {
+
+ private int tickCount = 0;
+ private final Inventory_RoundRobinator inventoryContents;
+ private String customName;
+ public int locationX;
+ public int locationY;
+ public int locationZ;
+ private int aData = 1111;
+ private int aTier = 1;
+ private int aTickRate = 100;
+
+ public TileEntityRoundRobinator() {
+ this.inventoryContents = new Inventory_RoundRobinator();
+ this.setTileLocation();
+ }
+
+ public boolean setTileLocation() {
+ if (this.hasWorldObj()) {
+ if (!this.getWorldObj().isRemote) {
+ this.locationX = this.xCoord;
+ this.locationY = this.yCoord;
+ this.locationZ = this.zCoord;
+ this.aTier = this.getWorldObj().getBlockMetadata(locationX, locationY, locationZ) + 1;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ //Rename to hasCircuitToConfigure
+ public final boolean hasInventoryContents() {
+ for (ItemStack i : this.aHopperInventory) {
+ if (i == null) {
+ continue;
+ }
+ else {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public Inventory_RoundRobinator getInventory() {
+ return this.inventoryContents;
+ }
+
+ public int getTier() {
+ return this.aTier;
+ }
+
+ public int getTickRate() {
+ return this.aTickRate;
+ }
+
+ @Override
+ public void updateEntity() {
+ try{
+ // TODO
+ if (this.worldObj != null && !this.worldObj.isRemote){
+ setTileLocation();
+ aTickRate = (60-(aTier*10));
+ if (this.getTier() == 1) {
+ // 20 s
+ aTickRate = 400;
+ }
+ else if (this.getTier() == 2) {
+ // 5
+ aTickRate = 100;
+ }
+ else if (this.getTier() == 3) {
+ // 1
+ aTickRate = 20;
+ }
+ else if (this.getTier() == 4) {
+ // 1/5
+ aTickRate = 10;
+ }
+ else if (this.getTier() == 5) {
+ // 1/20
+ aTickRate = 1;
+ }
+ else {
+ aTickRate = 999999;
+ }
+
+ if (tickCount % getTickRate() == 0) {
+ if (hasInventoryContents()) {
+ Logger.WARNING("Trying to move items. "+aTickRate);
+ this.tryProcessItems();
+ }
+ }
+ this.tickCount++;
+ }
+ }
+ catch (final Throwable t){
+ t.printStackTrace();
+ }
+ }
+
+ 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);
+ if (this.hasCustomInventoryName()) {
+ nbt.setString("CustomName", this.getCustomName());
+ }
+ nbt.setInteger("aCurrentMode", aData);
+ this.writeToNBT2(nbt);
+ }
+
+ @Override
+ public void readFromNBT(final NBTTagCompound nbt) {
+ super.readFromNBT(nbt);
+ if (nbt.hasKey("CustomName", 8)) {
+ this.setCustomName(nbt.getString("CustomName"));
+ }
+ aData = nbt.getInteger("aCurrentMode");
+ this.readFromNBT2(nbt);
+ }
+
+ @Override
+ public int getInventoryStackLimit() {
+ return 64;
+ }
+
+ @Override
+ public boolean isUseableByPlayer(final EntityPlayer entityplayer) {
+ return this.getInventory().isUseableByPlayer(entityplayer);
+ }
+
+ @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.getInventory().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.getInventory().closeInventory();
+ }
+
+ @Override
+ public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) {
+ return true;
+ }
+
+ @Override
+ public int[] getAccessibleSlotsFromSide(final int aSide) {
+ return new int[] {0, 1, 2, 3, 4};
+ }
+
+ @Override
+ public boolean canInsertItem(final int aSlot, final ItemStack aStack, final int aSide) {
+ return aSide < 2;
+ }
+
+ @Override
+ public boolean canExtractItem(final int aSlot, final ItemStack aStack, final int aSide) {
+ return false;
+ }
+
+ 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.roundrobinator";
+ }
+
+ @Override
+ public boolean hasCustomInventoryName() {
+ return (this.customName != null) && !this.customName.equals("");
+ }
+
+ @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 boolean onRightClick(byte side, EntityPlayer player, int x, int y, int z) {
+ if (player != null && player.getHeldItem() == null) {
+ if (!player.isSneaking() && !KeyboardUtils.isShiftKeyDown()) {
+ player.openGui(GTplusplus.instance, GuiHandler.GUI16, player.getEntityWorld(), x, y, z);
+ }
+ else {
+ String InventoryContents = ItemUtils.getArrayStackNames(this.aHopperInventory);
+ PlayerUtils.messagePlayer(player, "Contents: "+InventoryContents+" | "+getDataString());
+ }
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ public boolean onScrewdriverRightClick(byte side, EntityPlayer player, int x, int y, int z) {
+ try {
+ if (side < 2) {
+ // Top/Bottom
+ }
+ else {
+ if (toggleSide(side)) {
+ PlayerUtils.messagePlayer(player, "Enabling side "+side+".");
+ }
+ else {
+ PlayerUtils.messagePlayer(player, "Disabling side "+side+".");
+ }
+ PlayerUtils.messagePlayer(player, "Mode String: "+aData+"");
+ }
+ return true;
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ return false;
+ }
+ }
+
+ public int getDataString() {
+ return aData;
+ }
+
+ public boolean[] getActiveSides() {
+ this.markDirty();
+ String s = String.valueOf(aData);
+ if (s == null || s.length() != 4) {
+ s = "1111";
+ }
+ boolean[] aActiveSides = new boolean[4];
+ for (int i=0;i<4;i++) {
+ char ch = s.charAt(i);
+ if (ch == '1') {
+ aActiveSides[i] = true;
+ }
+ else {
+ aActiveSides[i] = false;
+ }
+ }
+ return aActiveSides;
+ }
+
+ /**
+ * Toggle active state of side
+ * @param aSide - Forge Direction / Side
+ * @return - True if the side is now Active, false if now disabled.
+ */
+ public boolean toggleSide(int aSide) {
+ setSideActive(!getSideActive(aSide), aSide);
+ return getSideActive(aSide);
+ }
+
+
+ public void setSideActive(boolean aActive, int aSide) {
+ try {
+ if (aSide < 2) {
+ }
+ else {
+ if (aData < 1111) {
+ aData = 1111;
+ }
+ else if (aData > 2222) {
+ aData = 2222;
+ }
+ String s = String.valueOf(aData);
+ StringBuilder aDataString = new StringBuilder(s);
+ int aIndex = aSide - 2;
+ if (aActive) {
+ aDataString.setCharAt(aIndex, '1');
+ }
+ else {
+ aDataString.setCharAt(aIndex, '2');
+ }
+ aData = Integer.valueOf(aDataString.toString());
+ this.markDirty();
+ }
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+
+ public boolean getSideActive(int aSide) {
+ this.markDirty();
+ try {
+ if (aSide < 2) {
+ return false;
+ }
+ else {
+ if (aData < 1111) {
+ aData = 1111;
+ }
+ else if (aData > 2222) {
+ aData = 2222;
+ }
+ String s = String.valueOf(aData);
+ int aIndex = aSide - 2;
+ char ch = s.charAt(aIndex);
+ if (ch == '1') {
+ return true;
+ }
+ else {
+ return false;
+ }
+
+ }
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ return false;
+ }
+ }
+
+ @Override
+ public double getXPos() {
+ return this.locationX;
+ }
+
+ @Override
+ public double getYPos() {
+ return this.locationY;
+ }
+
+ @Override
+ public double getZPos() {
+ return this.locationZ;
+ }
+
+
+
+
+
+
+
+
+ // TODO
+
+
+
+ /*
+ * Hopper Code
+ */
+
+
+ private ItemStack[] aHopperInventory = new ItemStack[5];
+
+ public int getSizeInventory() {
+ return this.aHopperInventory.length;
+ }
+
+ public ItemStack getStackInSlot(int aSlot) {
+ return this.aHopperInventory[aSlot];
+ }
+
+ /**
+ * Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a
+ * new stack.
+ */
+ public ItemStack decrStackSize(int aSlot, int aMinimumSizeOfExistingStack)
+ {
+ if (this.aHopperInventory[aSlot] != null)
+ {
+ ItemStack itemstack;
+
+ if (this.aHopperInventory[aSlot].stackSize <= aMinimumSizeOfExistingStack)
+ {
+ itemstack = this.aHopperInventory[aSlot];
+ this.aHopperInventory[aSlot] = null;
+ return itemstack;
+ }
+ else
+ {
+ itemstack = this.aHopperInventory[aSlot].splitStack(aMinimumSizeOfExistingStack);
+
+ if (this.aHopperInventory[aSlot].stackSize == 0)
+ {
+ this.aHopperInventory[aSlot] = null;
+ }
+
+ return itemstack;
+ }
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /**
+ * When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem -
+ * like when you close a workbench GUI.
+ */
+ public ItemStack getStackInSlotOnClosing(int aSlot)
+ {
+ if (this.aHopperInventory[aSlot] != null)
+ {
+ ItemStack itemstack = this.aHopperInventory[aSlot];
+ this.aHopperInventory[aSlot] = null;
+ return itemstack;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /**
+ * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).
+ */
+ public void setInventorySlotContents(int aSlot, ItemStack aStack)
+ {
+ this.aHopperInventory[aSlot] = aStack;
+
+ if (aStack != null && aStack.stackSize > this.getInventoryStackLimit())
+ {
+ aStack.stackSize = this.getInventoryStackLimit();
+ }
+ }
+
+ public boolean tryProcessItems() {
+ if (this.worldObj != null && !this.worldObj.isRemote) {
+ boolean didSomething = false;
+ if (!this.isEmpty()) {
+ Logger.WARNING("Has Items, Trying to push to all active directions.");
+ didSomething = this.tryPushItemsIntoNeighbours();
+ }
+ if (didSomething) {
+ this.markDirty();
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Is Empty
+ * @return
+ */
+ private boolean isEmpty() {
+ ItemStack[] aitemstack = this.aHopperInventory;
+ int i = aitemstack.length;
+
+ for (int j = 0; j < i; ++j) {
+ ItemStack itemstack = aitemstack[j];
+
+ if (itemstack != null) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ private boolean tryPushItemsIntoNeighbours() {
+
+ boolean aDidPush = false;
+
+ for (int u = 2; u < 6; u++) {
+ if (!this.getSideActive(u)) {
+ Logger.WARNING("Not pushing on side "+u);
+ continue;
+ }
+
+ Logger.WARNING("Pushing on side "+u);
+ IInventory iinventory = this.getInventoryFromFacing(u);
+
+ if (iinventory == null) {
+ Logger.WARNING("No inventory found.");
+ continue;
+ }
+ else {
+
+ int i = Facing.oppositeSide[u];
+ Logger.WARNING("Using Opposite direction: "+i);
+
+ if (this.isInventoryFull(iinventory, i)) {
+ Logger.WARNING("Target is full, skipping.");
+ continue;
+ }
+ else {
+ Logger.WARNING("Target has space, let's move a single item.");
+ for (int j = 0; j < this.getSizeInventory(); ++j) {
+ if (this.getStackInSlot(j) != null) {
+ ItemStack itemstack = this.getStackInSlot(j).copy();
+ ItemStack itemstack1 = setStackInNeighbour(iinventory, this.decrStackSize(j, 1), i);
+ if (itemstack1 == null || itemstack1.stackSize == 0) {
+ iinventory.markDirty();
+ aDidPush = true;
+ continue;
+ }
+ this.setInventorySlotContents(j, itemstack);
+ }
+ }
+ }
+ }
+ }
+
+ return aDidPush;
+ }
+
+ private boolean isInventoryFull(IInventory aInv, int aSide) {
+ if (aInv instanceof ISidedInventory && aSide > -1) {
+ ISidedInventory isidedinventory = (ISidedInventory)aInv;
+ int[] aint = isidedinventory.getAccessibleSlotsFromSide(aSide);
+
+ for (int l = 0; l < aint.length; ++l)
+ {
+ ItemStack itemstack1 = isidedinventory.getStackInSlot(aint[l]);
+
+ if (itemstack1 == null || itemstack1.stackSize != itemstack1.getMaxStackSize())
+ {
+ return false;
+ }
+ }
+ }
+ else {
+ int j = aInv.getSizeInventory();
+
+ for (int k = 0; k < j; ++k)
+ {
+ ItemStack itemstack = aInv.getStackInSlot(k);
+
+ if (itemstack == null || itemstack.stackSize != itemstack.getMaxStackSize())
+ {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ public static ItemStack setStackInNeighbour(IInventory aNeighbour, ItemStack aStack, int aSide) {
+ if (aNeighbour instanceof ISidedInventory && aSide > -1)
+ {
+ ISidedInventory isidedinventory = (ISidedInventory)aNeighbour;
+ int[] aint = isidedinventory.getAccessibleSlotsFromSide(aSide);
+
+ for (int l = 0; l < aint.length && aStack != null && aStack.stackSize > 0; ++l)
+ {
+ aStack = tryMoveStack(aNeighbour, aStack, aint[l], aSide);
+ }
+ }
+ else
+ {
+ int j = aNeighbour.getSizeInventory();
+
+ for (int k = 0; k < j && aStack != null && aStack.stackSize > 0; ++k)
+ {
+ aStack = tryMoveStack(aNeighbour, aStack, k, aSide);
+ }
+ }
+
+ if (aStack != null && aStack.stackSize == 0)
+ {
+ aStack = null;
+ }
+
+ return aStack;
+ }
+
+ private static boolean canInsertItemIntoNeighbour(IInventory aNeighbour, ItemStack aStack, int aSlot, int aSide) {
+ return !aNeighbour.isItemValidForSlot(aSlot, aStack) ? false : !(aNeighbour instanceof ISidedInventory) || ((ISidedInventory)aNeighbour).canInsertItem(aSlot, aStack, aSide);
+ }
+
+ private static ItemStack tryMoveStack(IInventory aNeighbour, ItemStack aStack, int aSlot, int aSide) {
+ ItemStack itemstack1 = aNeighbour.getStackInSlot(aSlot);
+ if (canInsertItemIntoNeighbour(aNeighbour, aStack, aSlot, aSide)) {
+ boolean aDidSomething = false;
+ if (itemstack1 == null) {
+ //Forge: BUGFIX: Again, make things respect max stack sizes.
+ int max = Math.min(aStack.getMaxStackSize(), aNeighbour.getInventoryStackLimit());
+ if (max >= aStack.stackSize) {
+ aNeighbour.setInventorySlotContents(aSlot, aStack);
+ aStack = null;
+ }
+ else {
+ aNeighbour.setInventorySlotContents(aSlot, aStack.splitStack(max));
+ }
+ aDidSomething = true;
+ }
+ else if (areItemStacksEqual(itemstack1, aStack)) {
+ //Forge: BUGFIX: Again, make things respect max stack sizes.
+ int max = Math.min(aStack.getMaxStackSize(), aNeighbour.getInventoryStackLimit());
+ if (max > itemstack1.stackSize) {
+ int l = Math.min(aStack.stackSize, max - itemstack1.stackSize);
+ aStack.stackSize -= l;
+ itemstack1.stackSize += l;
+ aDidSomething = l > 0;
+ }
+ }
+ if (aDidSomething){
+ aNeighbour.markDirty();
+ }
+ }
+ return aStack;
+ }
+
+ private IInventory getInventoryFromFacing(int aSide)
+ {
+ int i = aSide;
+ return tryFindInvetoryAtXYZ(this.getWorldObj(), (double)(this.xCoord + Facing.offsetsXForSide[i]), (double)(this.yCoord + Facing.offsetsYForSide[i]), (double)(this.zCoord + Facing.offsetsZForSide[i]));
+ }
+
+ public static IInventory tryFindInvetoryAtXYZ(World aWorld, double aX, double aY, double aZ)
+ {
+ IInventory iinventory = null;
+ int sX = MathHelper.floor_double(aX);
+ int sY = MathHelper.floor_double(aY);
+ int sZ = MathHelper.floor_double(aZ);
+ TileEntity tileentity = aWorld.getTileEntity(sX, sY, sZ);
+
+ if (tileentity != null && tileentity instanceof IInventory)
+ {
+ iinventory = (IInventory)tileentity;
+
+ if (iinventory instanceof TileEntityChest)
+ {
+ Block block = aWorld.getBlock(sX, sY, sZ);
+
+ if (block instanceof BlockChest)
+ {
+ iinventory = ((BlockChest)block).func_149951_m(aWorld, sX, sY, sZ);
+ }
+ }
+ }
+
+ if (iinventory == null)
+ {
+ List list = aWorld.getEntitiesWithinAABBExcludingEntity((Entity)null, AxisAlignedBB.getBoundingBox(aX, aY, aZ, aX + 1.0D, aY + 1.0D, aZ + 1.0D), IEntitySelector.selectInventories);
+
+ if (list != null && list.size() > 0)
+ {
+ iinventory = (IInventory)list.get(aWorld.rand.nextInt(list.size()));
+ }
+ }
+
+ return iinventory;
+ }
+
+ private static boolean areItemStacksEqual(ItemStack aStack, ItemStack aStack2) {
+ return aStack.getItem() != aStack2.getItem() ? false : (aStack.getItemDamage() != aStack2.getItemDamage() ? false : (aStack.stackSize > aStack.getMaxStackSize() ? false : ItemStack.areItemStackTagsEqual(aStack, aStack2)));
+ }
+
+ public void readFromNBT2(NBTTagCompound p_145839_1_) {
+ super.readFromNBT(p_145839_1_);
+ NBTTagList nbttaglist = p_145839_1_.getTagList("Items", 10);
+ this.aHopperInventory = new ItemStack[this.getSizeInventory()];
+ for (int i = 0; i < nbttaglist.tagCount(); ++i) {
+ NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
+ byte b0 = nbttagcompound1.getByte("Slot");
+ if (b0 >= 0 && b0 < this.aHopperInventory.length) {
+ this.aHopperInventory[b0] = ItemStack.loadItemStackFromNBT(
+ nbttagcompound1
+ );
+ }
+ }
+ }
+
+ public void writeToNBT2(NBTTagCompound aNBT) {
+ super.writeToNBT(aNBT);
+ NBTTagList nbttaglist = new NBTTagList();
+ for (int i = 0; i < this.aHopperInventory.length; ++i) {
+ if (this.aHopperInventory[i] != null) {
+ NBTTagCompound nbttagcompound1 = new NBTTagCompound();
+ nbttagcompound1.setByte("Slot", (byte) i);
+ this.aHopperInventory[i].writeToNBT(nbttagcompound1);
+ nbttaglist.appendTag(nbttagcompound1);
+ }
+ }
+ aNBT.setTag("Items", nbttaglist);
+ }
+
+
+
+
+
+
+
+}