package net.glowstone.block.entity;

import org.bukkit.material.MaterialData;

import net.glowstone.block.GlowBlock;
import net.glowstone.block.GlowBlockState;
import net.glowstone.block.state.GlowFlowerPot;
import net.glowstone.constants.ItemIds;
import net.glowstone.util.nbt.CompoundTag;

public class TEFlowerPot extends TileEntity {

    private MaterialData contents;

    public TEFlowerPot(GlowBlock block) {
        super(block);
        setSaveId("FlowerPot");
    }

    public MaterialData getContents() {
        return contents;
    }

    public void setContents(MaterialData contents) {
        this.contents = contents;
    }

    @Override
    public void loadNbt(CompoundTag tag) {
        super.loadNbt(tag);

        if (tag.isString("Item") && !tag.getString("Item").isEmpty() && tag.isByte("Data")) {
            contents = ItemIds.getMaterial(tag.getString("Item")).getNewData(tag.getByte("Data"));
        }
    }

    @Override
    public void saveNbt(CompoundTag tag) {
        super.saveNbt(tag);

        if (contents != null) {
            tag.putString("Item", ItemIds.getName(contents.getItemType()));
            tag.putByte("Data", contents.getData());
        } else {
            // Mimics how Minecraft does it.
            tag.putString("Item", "");
            tag.putByte("Data", 0);
        }
    }

    @Override
    public GlowBlockState getState() {
        return new GlowFlowerPot(block);
    }
}

@@ -232,23 +232,111 @@
 nstants.
-ItemIds
+GlowBlockEntity;%0Aimport net.glowstone.constants.ItemIds;%0Aimport net.glowstone.entity.GlowPlayer
 ;%0Aimport
@@ -1521,11 +1521,272 @@
 );%0A    %7D
+%0A%0A    @Override%0A    public void update(GlowPlayer player) %7B%0A        super.update(player);%0A%0A        CompoundTag nbt = new CompoundTag();%0A%0A        saveNbt(nbt);%0A        player.sendBlockEntityChange(getBlock().getLocation(), GlowBlockEntity.FLOWER_POT, nbt);%0A    %7D
 %0A%7D%0A

Implement flower pot tile entity update method