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.
public void readFromNBT(NBTTagCompound compound)
{
super.readFromNBT(compound);
NBTTagList nbttaglist = compound.getTagList("Items", 10);
this.chestContents = new ItemStack[this.getSizeInventory()];
if (compound.hasKey("CustomName", 8))
{
this.customName = compound.getString("CustomName");
}
for (int i = 0; i < nbttaglist.tagCount(); ++i)
{
NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
int j = nbttagcompound1.getByte("Slot") & 255;
if (j >= 0 && j < this.chestContents.length)
{
this.chestContents[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
}
}
}
public void writeToNBT(NBTTagCompound compound)
{
super.writeToNBT(compound);
NBTTagList nbttaglist = new NBTTagList();
for (int i = 0; i < this.chestContents.length; ++i)
{
if (this.chestContents[i] != null)
{
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.setByte("Slot", (byte)i);
this.chestContents[i].writeToNBT(nbttagcompound1);
nbttaglist.appendTag(nbttagcompound1);
}
}
compound.setTag("Items", nbttaglist);
if (this.hasCustomName())
{
compound.setString("CustomName", this.customName);
}
}
Нуок. Я бы просто попытался, понял, что ничегошеньки не работает, и пошел бы в интернет. Либо, что более вероятно, бросил бы проект. Но, буду знать.Oldestkon написал(а):Вопрос: причём тут тайл? Он тут вообще никаким боком не нужен.
Всё реализуется через события и IExtendedEntityProperties + NBT самого ItemStack'а, где, внезапно, можно хранить другие ItemStack'и.