Search in sources :

Example 1 with ItemFlowerPot

use of cn.nukkit.item.ItemFlowerPot in project Nukkit by Nukkit.

the class BlockFlowerPot method getDrops.

@Override
public Item[] getDrops(Item item) {
    boolean dropInside = false;
    int insideID = 0;
    int insideMeta = 0;
    BlockEntity blockEntity = getLevel().getBlockEntity(this);
    if (blockEntity instanceof BlockEntityFlowerPot) {
        dropInside = true;
        insideID = blockEntity.namedTag.getShort("item");
        insideMeta = blockEntity.namedTag.getInt("data");
    }
    if (dropInside) {
        return new Item[] { new ItemFlowerPot(), Item.get(insideID, insideMeta, 1) };
    } else {
        return new Item[] { new ItemFlowerPot() };
    }
}
Also used : Item(cn.nukkit.item.Item) ItemFlowerPot(cn.nukkit.item.ItemFlowerPot) BlockEntity(cn.nukkit.blockentity.BlockEntity) BlockEntityFlowerPot(cn.nukkit.blockentity.BlockEntityFlowerPot)

Aggregations

BlockEntity (cn.nukkit.blockentity.BlockEntity)1 BlockEntityFlowerPot (cn.nukkit.blockentity.BlockEntityFlowerPot)1 Item (cn.nukkit.item.Item)1 ItemFlowerPot (cn.nukkit.item.ItemFlowerPot)1