Posted April 23, 201312 yr Hi there. Here's my code package net.railowar.src; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; public class TileEntityBlockZRail extends TileEntity{ public int mid; @Override public void writeToNBT(NBTTagCompound par1NBTTagCompound) { super.writeToNBT(par1NBTTagCompound); par1NBTTagCompound.setInteger("mid", mid); } @Override public void readFromNBT(NBTTagCompound par1NBTTagCompound) { super.readFromNBT(par1NBTTagCompound); this.mid = par1NBTTagCompound.getInteger("mid"); } } But after i save/load, it loses all those mids... If i helped you, don't forget pressing "Thank You" button. Thanks for your time.
April 23, 201312 yr Author Hi there. Here's my code package net.railowar.src; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; public class TileEntityBlockZRail extends TileEntity{ public int mid; @Override public void writeToNBT(NBTTagCompound par1NBTTagCompound) { super.writeToNBT(par1NBTTagCompound); par1NBTTagCompound.setInteger("mid", mid); } @Override public void readFromNBT(NBTTagCompound par1NBTTagCompound) { super.readFromNBT(par1NBTTagCompound); this.mid = par1NBTTagCompound.getInteger("mid"); } } But after i save/load, it loses all those mids... If i helped you, don't forget pressing "Thank You" button. Thanks for your time.
April 23, 201312 yr Author public int mid = 0; makes no result. If i helped you, don't forget pressing "Thank You" button. Thanks for your time.
April 23, 201312 yr Author public int mid = 0; makes no result. If i helped you, don't forget pressing "Thank You" button. Thanks for your time.
April 23, 201312 yr Author Problem solved. That helped public Packet getDescriptionPacket() { NBTTagCompound nbtTag = new NBTTagCompound(); this.writeToNBT(nbtTag); return new Packet132TileEntityData(this.xCoord, this.yCoord, this.zCoord, 1, nbtTag); } public void onDataPacket(INetworkManager net, Packet132TileEntityData packet) { readFromNBT(packet.customParam1); } If i helped you, don't forget pressing "Thank You" button. Thanks for your time.
April 23, 201312 yr Author Problem solved. That helped public Packet getDescriptionPacket() { NBTTagCompound nbtTag = new NBTTagCompound(); this.writeToNBT(nbtTag); return new Packet132TileEntityData(this.xCoord, this.yCoord, this.zCoord, 1, nbtTag); } public void onDataPacket(INetworkManager net, Packet132TileEntityData packet) { readFromNBT(packet.customParam1); } If i helped you, don't forget pressing "Thank You" button. Thanks for your time.
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.