本文整理汇总了Java中cn.nukkit.nbt.NBTIO.getItemHelper方法的典型用法代码示例。如果您正苦于以下问题:Java NBTIO.getItemHelper方法的具体用法?Java NBTIO.getItemHelper怎么用?Java NBTIO.getItemHelper使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cn.nukkit.nbt.NBTIO
的用法示例。
在下文中一共展示了NBTIO.getItemHelper方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: BlockEntityChest
import cn.nukkit.nbt.NBTIO; //导入方法依赖的package包/类
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);
}
}
示例2: BlockEntityChest
import cn.nukkit.nbt.NBTIO; //导入方法依赖的package包/类
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 = (ListTag<CompoundTag>) this.namedTag.getList("Items");
for (CompoundTag compound : list.getAll()) {
Item item = NBTIO.getItemHelper(compound);
this.inventory.slots.put(compound.getByte("Slot"), item);
}
}
示例3: getItem
import cn.nukkit.nbt.NBTIO; //导入方法依赖的package包/类
@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);
}
}
示例4: initEntity
import cn.nukkit.nbt.NBTIO; //导入方法依赖的package包/类
@Override
protected void initEntity() {
super.initEntity();
this.setMaxHealth(5);
this.setHealth(this.namedTag.getShort("Health"));
if (this.namedTag.contains("Age")) {
this.age = this.namedTag.getShort("Age");
}
if (this.namedTag.contains("PickupDelay")) {
this.pickupDelay = this.namedTag.getShort("PickupDelay");
}
if (this.namedTag.contains("Owner")) {
this.owner = this.namedTag.getString("Owner");
}
if (this.namedTag.contains("Thrower")) {
this.thrower = this.namedTag.getString("Thrower");
}
if (!this.namedTag.contains("Item")) {
this.close();
return;
}
this.item = NBTIO.getItemHelper(this.namedTag.getCompound("Item"));
this.setDataFlag(DATA_FLAGS, DATA_FLAG_IMMOBILE, true);
this.server.getPluginManager().callEvent(new ItemSpawnEvent(this));
}
示例5: BlockEntityShulkerBox
import cn.nukkit.nbt.NBTIO; //导入方法依赖的package包/类
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 = (ListTag<CompoundTag>) this.namedTag.getList("Items");
for (CompoundTag compound : list.getAll()) {
Item item = NBTIO.getItemHelper(compound);
this.inventory.slots.put(compound.getByte("Slot"), item);
}
}
示例6: initEntity
import cn.nukkit.nbt.NBTIO; //导入方法依赖的package包/类
@Override
protected void initEntity() {
super.initEntity();
this.setMaxHealth(5);
this.setHealth(this.namedTag.getShort("Health"));
if (this.namedTag.contains("Age")) {
this.age = this.namedTag.getShort("Age");
}
if (this.namedTag.contains("PickupDelay")) {
this.pickupDelay = this.namedTag.getShort("PickupDelay");
}
if (this.namedTag.contains("Owner")) {
this.owner = this.namedTag.getString("Owner");
}
if (this.namedTag.contains("Thrower")) {
this.thrower = this.namedTag.getString("Thrower");
}
if (!this.namedTag.contains("Item")) {
this.close();
return;
}
this.item = NBTIO.getItemHelper(this.namedTag.getCompound("Item"));
this.server.getPluginManager().callEvent(new ItemSpawnEvent(this));
}
示例7: getItem
import cn.nukkit.nbt.NBTIO; //导入方法依赖的package包/类
public Item getItem() {
CompoundTag NBTTag = this.namedTag.getCompound("Item");
return NBTIO.getItemHelper(NBTTag);
}
示例8: getHand
import cn.nukkit.nbt.NBTIO; //导入方法依赖的package包/类
public Item getHand() {
return NBTIO.getItemHelper(this.namedTag.getCompound("HandItems"));
}
示例9: getChestPlate
import cn.nukkit.nbt.NBTIO; //导入方法依赖的package包/类
public Item getChestPlate() {
return NBTIO.getItemHelper(this.namedTag.getList("ArmorItems", CompoundTag.class).get(1));
}
示例10: BlockEntityJukebox
import cn.nukkit.nbt.NBTIO; //导入方法依赖的package包/类
public BlockEntityJukebox(FullChunk chunk, CompoundTag nbt) {
super(chunk, nbt);
this.recordItem = NBTIO.getItemHelper(nbt.getCompound("RecordItem"));
}