Exemplo n.º 1
0
 @Override
 public void update() {
   super.update();
   TileEntityPower powerSource = getPowerSource();
   if (getStackInSlot(0) != null && !spinning.equals("spinning") && powerSource.getPower() > 600) {
     System.out.println("Attempting Spin");
     grow(powerSource);
   }
 }
Exemplo n.º 2
0
 @Override
 public void readFromNBT(NBTTagCompound tagCompound) {
   super.readFromNBT(tagCompound);
   NBTTagList tagList = tagCompound.getTagList("Inventory", 10);
   for (int i = 0; i < tagList.tagCount(); i++) {
     NBTTagCompound tag = tagList.getCompoundTagAt(i);
     byte slot = tag.getByte("Slot");
     if (slot >= 0 && slot < this.chestContents.length)
       this.chestContents[slot] = ItemStack.loadItemStackFromNBT(tag);
   }
   spinning = tagCompound.getString("Spinning");
 }
Exemplo n.º 3
0
  @Override
  public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
    super.writeToNBT(tagCompound);
    NBTTagList itemList = new NBTTagList();
    for (int i = 0; i < this.chestContents.length; i++) {
      ItemStack stack = this.chestContents[i];
      if (stack != null) {
        NBTTagCompound tag = new NBTTagCompound();
        tag.setByte("Slot", (byte) i);
        stack.writeToNBT(tag);
        itemList.appendTag(tag);
      }
    }
    tagCompound.setTag("Inventory", itemList);
    tagCompound.setString("Spinning", spinning);

    return tagCompound;
  }