Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class TileEntityMaterializer extends TileEntity {
- private EnumSoulType soulType;
- private int level;
- public TileEntityMaterializer() {
- }
- public TileEntityMaterializer(EnumSoulType soulType, int level) {
- this.soulType = soulType;
- this.level = level;
- }
- @Override
- public NBTTagCompound writeToNBT(NBTTagCompound compound) {
- super.writeToNBT(compound);
- compound.setString("SoulType", soulType.getName());
- compound.setInteger("Level", level);
- return compound;
- }
- @Override
- public void readFromNBT(NBTTagCompound compound) {
- super.readFromNBT(compound);
- soulType = EnumSoulType.getTypeFromName(compound.getString("SoulType"));
- level = compound.getInteger("Level");
- }
- @Override
- public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newState) {
- return (oldState.getBlock() != newState.getBlock());
- }
- @Override
- public NBTTagCompound getUpdateTag()
- {
- return this.writeToNBT(new NBTTagCompound());
- }
- @Override
- public void handleUpdateTag(NBTTagCompound compound)
- {
- readFromNBT(compound);
- }
- @Override
- public SPacketUpdateTileEntity getUpdatePacket()
- {
- return new SPacketUpdateTileEntity(this.pos, 1, writeToNBT(new NBTTagCompound()));
- }
- @Override
- public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt)
- {
- readFromNBT(pkt.getNbtCompound());
- }
- public int getLevel() {
- return level;
- }
- public void setLevel(int level) {
- this.level = level;
- }
- public EnumSoulType getSoulType() {
- return soulType;
- }
- public void setSoulType(EnumSoulType soulType) {
- this.soulType = soulType;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment