Follow along with the video below to see how to install our site as a web app on your home screen.
Примечание: This feature may not be available in some browsers.
private void readFromNBT()
{
if(!storage.hasTagCompound()){storage.setTagCompound(new NBTTagCompound());}
else
{
NBTTagList list = storage.getTagCompound().getTagList("Items", 10);
for(int i = 0; i < list.tagCount(); i++)
{
NBTTagCompound tag = list.getCompoundTagAt(i);
int j = tag.getByte("Slot") & 255;
if (j >= 0 && j < this.inventory.length)
{
this.inventory[j] = ItemStack.loadItemStackFromNBT(tag);
}
}
}
}
private void writeToNBT()
{
NBTTagList list = new NBTTagList();
for(int i = 0; i < inventory.length; i++)
{
if(getStackInSlot(i) != null)
{
NBTTagCompound tag = new NBTTagCompound();
tag.setByte("Slot",(byte) i);
getStackInSlot(i).writeToNBT(tag);
list.appendTag(tag);
}
}
storage.getTagCompound().setTag("Items", list);
}