Java Code Examples for cn.nukkit.nbt.NBTIO#getItemHelper()

The following examples show how to use cn.nukkit.nbt.NBTIO#getItemHelper() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BlockEntityChest.java    From Jupiter with GNU General Public License v3.0 6 votes vote down vote up
public BlockEntityChest(FullChunk chunk, CompoundTag nbt) {
    super(chunk, nbt);
    this.inventory = new ChestInventory(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));
    } */

    ListTag<CompoundTag> list = this.namedTag.getList("Items", CompoundTag.class);
    for (CompoundTag compound : list.getAll()) {
        Item item = NBTIO.getItemHelper(compound);
        this.inventory.slots.put(compound.getByte("Slot"), item);
    }
}
 
Example 2
Source File: BlockEntityFurnace.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Item getItem(int index) {
    int i = this.getSlotIndex(index);
    if (i < 0) {
        return new ItemBlock(new BlockAir(), 0, 0);
    } else {
        CompoundTag data = (CompoundTag) this.namedTag.getList("Items").get(i);
        return NBTIO.getItemHelper(data);
    }
}
 
Example 3
Source File: BlockEntityChest.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Item getItem(int index) {
    int i = this.getSlotIndex(index);
    if (i < 0) {
        return new ItemBlock(Block.get(BlockID.AIR), 0, 0);
    } else {
        CompoundTag data = (CompoundTag) this.namedTag.getList("Items").get(i);
        return NBTIO.getItemHelper(data);
    }
}
 
Example 4
Source File: BlockEntityShulkerBox.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Item getItem(int index) {
    int i = this.getSlotIndex(index);
    if (i < 0) {
        return new ItemBlock(Block.get(BlockID.AIR), 0, 0);
    } else {
        CompoundTag data = (CompoundTag) this.namedTag.getList("Items").get(i);
        return NBTIO.getItemHelper(data);
    }
}
 
Example 5
Source File: BlockEntityChest.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Item getItem(int index) {
    int i = this.getSlotIndex(index);
    if (i < 0) {
        return new ItemBlock(new BlockAir(), 0, 0);
    } else {
        CompoundTag data = (CompoundTag) this.namedTag.getList("Items").get(i);
        return NBTIO.getItemHelper(data);
    }
}
 
Example 6
Source File: BlockEntityDispenser.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Item getItem(int index) {
    int i = this.getSlotIndex(index);
    if (i < 0) {
        return new ItemBlock(new BlockAir(), 0, 0);
    } else {
        CompoundTag data = (CompoundTag) this.namedTag.getList("Items").get(i);
        return NBTIO.getItemHelper(data);
    }
}
 
Example 7
Source File: BlockEntityFurnace.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Item getItem(int index) {
    int i = this.getSlotIndex(index);
    if (i < 0) {
        return new ItemBlock(new BlockAir(), 0, 0);
    } else {
        CompoundTag data = (CompoundTag) this.namedTag.getList("Items").get(i);
        return NBTIO.getItemHelper(data);
    }
}
 
Example 8
Source File: BlockEntityBrewingStand.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Item getItem(int index) {
    int i = this.getSlotIndex(index);
    if (i < 0) {
        return new ItemBlock(new BlockAir(), 0, 0);
    } else {
        CompoundTag data = (CompoundTag) this.namedTag.getList("Items").get(i);
        return NBTIO.getItemHelper(data);
    }
}
 
Example 9
Source File: BlockEntityHopper.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Item getItem(int index) {
    int i = this.getSlotIndex(index);
    if (i < 0) {
        return new ItemBlock(new BlockAir(), 0, 0);
    } else {
        CompoundTag data = (CompoundTag) this.namedTag.getList("Items").get(i);
        return NBTIO.getItemHelper(data);
    }
}
 
Example 10
Source File: BlockEntityShulkerBox.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Item getItem(int index) {
    int i = this.getSlotIndex(index);
    if (i < 0) {
        return new ItemBlock(new BlockAir(), 0, 0);
    } else {
        CompoundTag data = (CompoundTag) this.namedTag.getList("Items").get(i);
        return NBTIO.getItemHelper(data);
    }
}
 
Example 11
Source File: BlockEntityShulkerBox.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
public BlockEntityShulkerBox(FullChunk chunk, CompoundTag nbt) {
    super(chunk, nbt);
    this.inventory = new ShulkerBoxInventory(this);

    if (!this.namedTag.contains("Items") || !(this.namedTag.get("Items") instanceof ListTag)) {
        this.namedTag.putList(new ListTag<CompoundTag>("Items"));
    }

    ListTag<CompoundTag> list = this.namedTag.getList("Items", CompoundTag.class);
    for (CompoundTag compound : list.getAll()) {
        Item item = NBTIO.getItemHelper(compound);
        this.inventory.slots.put(compound.getByte("Slot"), item);
    }
}
 
Example 12
Source File: BlockEntityHopper.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Item getItem(int index) {
    int i = this.getSlotIndex(index);
    if (i < 0) {
        return new ItemBlock(new BlockAir(), 0, 0);
    } else {
        CompoundTag data = (CompoundTag) this.namedTag.getList("Items").get(i);
        return NBTIO.getItemHelper(data);
    }
}
 
Example 13
Source File: BlockEntityDropper.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Item getItem(int index) {
    int i = this.getSlotIndex(index);
    if (i < 0) {
        return new ItemBlock(new BlockAir(), 0, 0);
    } else {
        CompoundTag data = (CompoundTag) this.namedTag.getList("Items").get(i);
        return NBTIO.getItemHelper(data);
    }
}
 
Example 14
Source File: BlockEntityItemFrame.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public Item getItem() {
    CompoundTag NBTTag = this.namedTag.getCompound("Item");
    return NBTIO.getItemHelper(NBTTag);
}
 
Example 15
Source File: EntityArmorStand.java    From Jupiter with GNU General Public License v3.0 4 votes vote down vote up
public Item getBoots() {
	return NBTIO.getItemHelper(this.namedTag.getList("ArmorItems", CompoundTag.class).get(3));
}
 
Example 16
Source File: EntityArmorStand.java    From Jupiter with GNU General Public License v3.0 4 votes vote down vote up
public Item getLeggins() {
	return NBTIO.getItemHelper(this.namedTag.getList("ArmorItems", CompoundTag.class).get(2));
}
 
Example 17
Source File: EntityArmorStand.java    From Jupiter with GNU General Public License v3.0 4 votes vote down vote up
public Item getChestPlate() {
	return NBTIO.getItemHelper(this.namedTag.getList("ArmorItems", CompoundTag.class).get(1));
}
 
Example 18
Source File: BlockEntityItemFrame.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public Item getItem() {
    CompoundTag NBTTag = this.namedTag.getCompound("Item");
    return NBTIO.getItemHelper(NBTTag);
}
 
Example 19
Source File: EntityArmorStand.java    From Jupiter with GNU General Public License v3.0 4 votes vote down vote up
public Item getHelmet() {
	return NBTIO.getItemHelper(this.namedTag.getList("ArmorItems", CompoundTag.class).get(0));
}
 
Example 20
Source File: EntityArmorStand.java    From Jupiter with GNU General Public License v3.0 4 votes vote down vote up
public Item getHand() {
	return NBTIO.getItemHelper(this.namedTag.getCompound("HandItems"));
}