Search in sources :

Example 1 with HopperInventory

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

the class BlockEntityHopper method initBlockEntity.

@Override
protected void initBlockEntity() {
    if (this.namedTag.contains("TransferCooldown")) {
        this.transferCooldown = this.namedTag.getInt("TransferCooldown");
    }
    this.inventory = new HopperInventory(this);
    if (!this.namedTag.contains("Items") || !(this.namedTag.get("Items") instanceof ListTag)) {
        this.namedTag.putList(new ListTag<CompoundTag>("Items"));
    }
    for (int i = 0; i < this.getSize(); i++) {
        this.inventory.setItem(i, this.getItem(i));
    }
    this.pickupArea = new SimpleAxisAlignedBB(this.x, this.y, this.z, this.x + 1, this.y + 2, this.z + 1);
    this.scheduleUpdate();
    super.initBlockEntity();
}
Also used : HopperInventory(cn.nukkit.inventory.HopperInventory) ListTag(cn.nukkit.nbt.tag.ListTag) SimpleAxisAlignedBB(cn.nukkit.math.SimpleAxisAlignedBB) CompoundTag(cn.nukkit.nbt.tag.CompoundTag)

Aggregations

HopperInventory (cn.nukkit.inventory.HopperInventory)1 SimpleAxisAlignedBB (cn.nukkit.math.SimpleAxisAlignedBB)1 CompoundTag (cn.nukkit.nbt.tag.CompoundTag)1 ListTag (cn.nukkit.nbt.tag.ListTag)1