diff options
author | draknyte1 <draknyte1@hotmail.com> | 2017-02-18 09:59:51 +1000 |
---|---|---|
committer | draknyte1 <draknyte1@hotmail.com> | 2017-02-18 09:59:51 +1000 |
commit | 1198cdf56c8c5ec5162cd3171eecc8e72e96b3d3 (patch) | |
tree | d1042100fe5d5314c6e9ced39d90a28f56b76c48 /src/Java/gtPlusPlus/core | |
parent | 0b26602190bb40b501c15b2e7672131b97f325b6 (diff) | |
download | GT5-Unofficial-1198cdf56c8c5ec5162cd3171eecc8e72e96b3d3.tar.gz GT5-Unofficial-1198cdf56c8c5ec5162cd3171eecc8e72e96b3d3.tar.bz2 GT5-Unofficial-1198cdf56c8c5ec5162cd3171eecc8e72e96b3d3.zip |
% Applied better formatting to NBT methods in the FishTrap Inventory and TileEntity. (Still doesn't properly save data, no idea why. I hate NBT.)
Diffstat (limited to 'src/Java/gtPlusPlus/core')
-rw-r--r-- | src/Java/gtPlusPlus/core/inventories/InventoryFishtrap.java | 18 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java | 25 |
2 files changed, 12 insertions, 31 deletions
diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryFishtrap.java b/src/Java/gtPlusPlus/core/inventories/InventoryFishtrap.java index 7af1f08bd7..834173a768 100644 --- a/src/Java/gtPlusPlus/core/inventories/InventoryFishtrap.java +++ b/src/Java/gtPlusPlus/core/inventories/InventoryFishtrap.java @@ -25,30 +25,24 @@ public class InventoryFishTrap implements IInventory{ } - public void readFromNBT(NBTTagCompound nbt) - { + public void readFromNBT(NBTTagCompound nbt){ NBTTagList list = nbt.getTagList("Items", 10); inventory = new ItemStack[INV_SIZE]; - for(int i = 0;i<list.tagCount();i++) - { + for(int i = 0;i<list.tagCount();i++){ NBTTagCompound data = list.getCompoundTagAt(i); int slot = data.getInteger("Slot"); - if(slot >= 0 && slot < INV_SIZE) - { + if(slot >= 0 && slot < INV_SIZE){ Utils.LOG_INFO("Trying to read NBT data from inventory."); inventory[slot] = ItemStack.loadItemStackFromNBT(data); } } } - public void writeToNBT(NBTTagCompound nbt) - { + public void writeToNBT(NBTTagCompound nbt){ NBTTagList list = new NBTTagList(); - for(int i = 0;i<INV_SIZE;i++) - { + for(int i = 0;i<INV_SIZE;i++){ ItemStack stack = inventory[i]; - if(stack != null) - { + if(stack != null){ Utils.LOG_INFO("Trying to write NBT data to inventory."); NBTTagCompound data = new NBTTagCompound(); stack.writeToNBT(data); diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java index df573d5112..ab74d10019 100644 --- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java +++ b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java @@ -1,7 +1,5 @@ package gtPlusPlus.core.tileentities.general; -import java.util.UUID; - import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.inventories.*; import gtPlusPlus.core.util.Utils; @@ -16,7 +14,6 @@ import net.minecraft.tileentity.TileEntity; public class TileEntityFishTrap extends TileEntity{ - private UUID ownerUUID; private int tickCount = 0; private boolean isInWater = false; private InventoryFishTrap inventoryContents; @@ -28,7 +25,6 @@ public class TileEntityFishTrap extends TileEntity{ public TileEntityFishTrap(){ this.inventoryContents = new InventoryFishTrap();//number of slots - without product slot - this.canUpdate(); setTileLocation(); } @@ -203,15 +199,6 @@ public class TileEntityFishTrap extends TileEntity{ return this.worldObj.getClosestPlayer(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D, 32) != null; } - public UUID getOwnerUUID() { - return ownerUUID; - } - - public void setOwnerUUID(UUID ownerUUID) { - this.ownerUUID = ownerUUID; - markDirty(); - } - public NBTTagCompound getTag(NBTTagCompound nbt, String tag){ if(!nbt.hasKey(tag)){ nbt.setTag(tag, new NBTTagCompound()); @@ -221,17 +208,17 @@ public class TileEntityFishTrap extends TileEntity{ @Override - public void writeToNBT(NBTTagCompound tagCompound) { - //super.writeToNBT(tagCompound); + public void writeToNBT(NBTTagCompound nbt){ + super.writeToNBT(nbt); Utils.LOG_INFO("Trying to write NBT data to TE."); - inventoryContents.writeToNBT(getTag(tagCompound, "ContentsChest")); + inventoryContents.writeToNBT(getTag(nbt, "ContentsChest")); } @Override - public void readFromNBT(NBTTagCompound tagCompound) { - //super.readFromNBT(tagCompound); + public void readFromNBT(NBTTagCompound nbt){ + super.readFromNBT(nbt); Utils.LOG_INFO("Trying to read NBT data from TE."); - inventoryContents.readFromNBT(tagCompound.getCompoundTag("ContentsChest")); + inventoryContents.readFromNBT(nbt.getCompoundTag("ContentsChest")); } } |