Search in sources :

Example 1 with BrewingInventory

use of cn.nukkit.inventory.BrewingInventory in project Nukkit by Nukkit.

the class BlockEntityBrewingStand method initBlockEntity.

@Override
protected void initBlockEntity() {
    inventory = new BrewingInventory(this);
    if (!namedTag.contains("Items") || !(namedTag.get("Items") instanceof ListTag)) {
        namedTag.putList(new ListTag<CompoundTag>("Items"));
    }
    for (int i = 0; i < getSize(); i++) {
        inventory.setItem(i, this.getItem(i));
    }
    if (!namedTag.contains("CookTime") || namedTag.getShort("CookTime") > MAX_BREW_TIME) {
        this.brewTime = MAX_BREW_TIME;
    } else {
        this.brewTime = namedTag.getShort("CookTime");
    }
    this.fuelAmount = namedTag.getShort("FuelAmount");
    this.fuelTotal = namedTag.getShort("FuelTotal");
    if (brewTime < MAX_BREW_TIME) {
        this.scheduleUpdate();
    }
    super.initBlockEntity();
}
Also used : BrewingInventory(cn.nukkit.inventory.BrewingInventory) ListTag(cn.nukkit.nbt.tag.ListTag) CompoundTag(cn.nukkit.nbt.tag.CompoundTag)

Aggregations

BrewingInventory (cn.nukkit.inventory.BrewingInventory)1 CompoundTag (cn.nukkit.nbt.tag.CompoundTag)1 ListTag (cn.nukkit.nbt.tag.ListTag)1