Posted August 23, 201510 yr I have created a Lantern TileEntity, but it does not save the values. Here is the TileEntity class: package itsamysterious.mods.reallifemod.core.blocks.tiles; import itsamysterious.mods.reallifemod.core.tiles.RLMTileEntity; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; public class TileEntity_Lantern extends RLMTileEntity{ public float rotation; public boolean isActive; public TileEntity_Lantern(int i) { super("LanternTileentity"); this.rotation=i*90; } public void writeToNBT(NBTTagCompound compound){ NBTTagCompound tag=new NBTTagCompound(); tag.setBoolean("IsActive", isActive); tag.setFloat("Rotation", rotation); compound.setTag("LanternTag", tag); super.writeToNBT(compound); } @Override public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); NBTTagCompound tag=compound.getCompoundTag("LanternTag"); this.isActive=tag.getBoolean("IsActive"); this.rotation=tag.getFloat("Rotation"); } @Override public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { NBTTagCompound tag = pkt.getNbtCompound(); readFromNBT(tag); } public Packet getDescriptionPacket() { NBTTagCompound tag = new NBTTagCompound(); writeToNBT(tag); return new S35PacketUpdateTileEntity(getPos(), 1, tag); } }
August 23, 201510 yr Author Yes, problem is, i have the rotation stored in the tileentity and i set this in the createNewTileEntity method in the BlockClass.
August 23, 201510 yr Author But it works - i don't render normal blockmodels (.json) i render .obj models and now the saving worked too(thanks for helping!!), i added the method AND the empty constructor
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.