package carpentersblocks.tileentity;

import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;

public class TECarpentersFlowerPot extends TEBase {

    public static final byte TAG_SOIL  = 0;
    public static final byte TAG_PLANT = 1;

    public ItemStack soil;
    public ItemStack plant;

    @Override
    public void readFromNBT(NBTTagCompound nbt)
    {
        super.readFromNBT(nbt);

        NBTTagList list = nbt.getTagList("pot_property", 10);

        soil = ItemStack.loadItemStackFromNBT(list.getCompoundTagAt(TAG_SOIL));
        plant = ItemStack.loadItemStackFromNBT(list.getCompoundTagAt(TAG_PLANT));
    }

    @Override
    public void writeToNBT(NBTTagCompound nbt)
    {
        super.writeToNBT(nbt);

        NBTTagList list = new NBTTagList();

        if (soil != null) {
            NBTTagCompound nbt1 = new NBTTagCompound();
            nbt1.setByte("soil", TAG_SOIL);
            soil.writeToNBT(nbt1);
            list.appendTag(nbt1);
        }
        if (plant != null) {
            NBTTagCompound nbt1 = new NBTTagCompound();
            nbt1.setByte("plant", TAG_PLANT);
            plant.writeToNBT(nbt1);
            list.appendTag(nbt1);
        }

        nbt.setTag("pot_property", list);
    }

}

@@ -201,34 +201,91 @@
 ase %7B%0A%0A    p
-ublic stat
+rivate final String TAG_PLANT_ITEMSTACKS = %22pot_property%22;%0A    publ
 ic final byt
@@ -277,28 +277,30 @@
 ublic final 
-byte
+String
  TAG_SOIL  =
@@ -300,17 +300,22 @@
 SOIL  = 
-0
+%22soil%22
 ;%0A    pu
@@ -323,25 +323,20 @@
 lic 
-static final byte
+final String
  TAG
@@ -344,17 +344,23 @@
 PLANT = 
-1
+%22plant%22
 ;%0A%0A    p
@@ -556,118 +556,378 @@
 ist(
-%22pot_property%22, 10);%0A%0A        soil = ItemStack.loadItemStackFromNBT(list.getCompoundTagAt(TAG_SOIL));%0A
+TAG_PLANT_ITEMSTACKS, 10);%0A%0A        soil = null;%0A        plant = null;%0A%0A        for (int idx = 0; idx %3C list.tagCount(); ++idx)%0A        %7B%0A            if ((list.getCompoundTagAt(idx)).hasKey(TAG_SOIL)) %7B%0A                soil = ItemStack.loadItemStackFromNBT(list.getCompoundTagAt(idx));%0A            %7D else if ((list.getCompoundTagAt(idx)).hasKey(TAG_PLANT)) %7B%0A   
         
 plan
@@ -914,32 +914,37 @@
 )) %7B%0A           
+     
 plant = ItemStac
@@ -992,20 +992,38 @@
 gAt(
-TAG_PLANT));
+idx));%0A            %7D%0A        %7D
 %0A   
@@ -1283,24 +1283,16 @@
 yte(
-%22soil%22, 
 TAG_SOIL
 );%0A 
@@ -1287,16 +1287,26 @@
 TAG_SOIL
+, (byte) 0
 );%0A     
@@ -1493,17 +1493,8 @@
 yte(
-%22plant%22, 
 TAG_
@@ -1498,16 +1498,26 @@
 AG_PLANT
+, (byte) 0
 );%0A     
@@ -1611,30 +1611,36 @@
 .setTag(
-%22pot_property%22
+TAG_PLANT_ITEMSTACKS
 , list);

Correct sloppy flower pot tile entity code.