Yeah, i thought about that, not sure the best way to do this, mabye onArmourTick on first call calls the put on method, not sure how to do take off, thinking living entity update, checking every tick to see if they do not have the armour on any more. however not sure how to call it on that armour piece.
Is there a hook somewhere that i am missing, or a way to implement it myself, because i was wondering how to tell when a piece of armour has been taken off or put on.
Hello,
I have been having problems trying to add slots to a Inventory/Container/Gui for a Tile Entity. Sort of like how the Tool Station from Tinker's Construct Works. However, i have had trouble, because i cannot figure out how i would add one or two slots to the inventory screen dynamically, with me being able to just register where i want them and having my code add them.
I get this would require a lot of code, especially with the gui, but i keep on having different exceptions thrown whenever i try to register that there could be more slots than are hard-coded into me TileEntity.
This is the code:
NBTTagCompound stackTagCompound = new NBTTagCompound();
NBTTagList list = (NBTTagList) stackTagCompound.getTag("String"); // Works
NBTTagList list = stackTagCompoung.getTagList("String", Constants.NBT.TAG_LIST); // Does not work.
And yes, i know i didn't give the stackTagCompound anything to pull from, but this is just example code.
i have already figured out the workaround, but i wanted to let the community know, and ask if i am doing anything wrong. Sorry if i am, but it was really annoying to deal with that.
ok i fixed up the method, but the nbt is still not saving. I am sorry for asking, but i have been trying to figure this out for a week.
Here is the total source code:
https://github.com/chbachman/ModularStorage
with the relevant code here (i think):
https://github.com/chbachman/ModularStorage/blob/master/common/io/github/chbachman/fluid/Tank.java
and here:
https://github.com/chbachman/ModularStorage/blob/master/common/io/github/chbachman/blocks/modulartank/TileModularTank.java
Thank you for your help
I have read so many of the posts where people just stick the two lines of code that they think are causing the problem, and tell others to fix it. I am sorry if this comes off as one of those posts, but i am using code borrowed from build craft for saving the nbt of my tank and it is not working, and i cannot figure out why, because it traces back to code from KingLemming.
This is my nbt saving code:
the class extends the FluidTank class
@Override
public final NBTTagCompound writeToNBT(NBTTagCompound nbt) {
NBTTagCompound tankData = new NBTTagCompound();
super.writeToNBT(tankData);
this.writeTankToNBT(tankData);
nbt.setCompoundTag(this.name, tankData);
return nbt;
}
@Override
public final FluidTank readFromNBT(NBTTagCompound nbt) {
if (nbt.hasKey(this.name)) {
NBTTagCompound tankData = nbt.getCompoundTag(this.name);
super.readFromNBT(tankData);
this.readTankFromNBT(tankData);
}
return this;
}
public void writeTankToNBT(NBTTagCompound nbt) {
}
public void readTankFromNBT(NBTTagCompound nbt) {
}
Thank you for your time.
Sorry to bother people, but i have gone through the vanilla code and cannot find the tile entity file for the vanilla workbench. I am interested to learn how to accurately remove the crafting ingredients after taking the result out. Thank you for your help.