本文整理汇总了Java中cn.nukkit.Player.addWindow方法的典型用法代码示例。如果您正苦于以下问题:Java Player.addWindow方法的具体用法?Java Player.addWindow怎么用?Java Player.addWindow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cn.nukkit.Player
的用法示例。
在下文中一共展示了Player.addWindow方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onActivate
import cn.nukkit.Player; //导入方法依赖的package包/类
@Override
public boolean onActivate(Item item, Player player) {
BlockEntity blockEntity = this.level.getBlockEntity(this);
if (blockEntity instanceof BlockEntityHopper) {
return player.addWindow(((BlockEntityHopper) blockEntity).getInventory()) != -1;
}
return false;
}
示例2: onActivate
import cn.nukkit.Player; //导入方法依赖的package包/类
@Override
public boolean onActivate(Item item, Player player) {
if (player != null) {
player.addWindow(new AnvilInventory(this), Player.ANVIL_WINDOW_ID);
}
return true;
}
示例3: onActivate
import cn.nukkit.Player; //导入方法依赖的package包/类
@Override
public boolean onActivate(Item item, Player player) {
if (player != null) {
BlockEntity t = getLevel().getBlockEntity(this);
BlockEntityDispenser dispenser;
if (t instanceof BlockEntityDispenser) {
dispenser = (BlockEntityDispenser) t;
} else {
CompoundTag nbt = new CompoundTag()
.putList(new ListTag<>("Items"))
.putString("id", BlockEntity.DISPENSER)
.putInt("x", (int) this.x)
.putInt("y", (int) this.y)
.putInt("z", (int) this.z);
dispenser = new BlockEntityDispenser(this.getLevel().getChunk((int) (this.x) >> 4, (int) (this.z) >> 4), nbt);
}
if (dispenser.namedTag.contains("Lock") && dispenser.namedTag.get("Lock") instanceof StringTag) {
if (!dispenser.namedTag.getString("Lock").equals(item.getCustomName())) {
return false;
}
}
player.addWindow(dispenser.getInventory());
}
return true;
}
示例4: onActivate
import cn.nukkit.Player; //导入方法依赖的package包/类
@Override
public boolean onActivate(Item item, Player player) {
if (player != null) {
Block top = up();
if (!top.isTransparent()) {
return true;
}
BlockEntity t = this.getLevel().getBlockEntity(this);
BlockEntityShulkerBox shulkerBox;
if (t instanceof BlockEntityShulkerBox) {
shulkerBox = (BlockEntityShulkerBox) t;
} else {
CompoundTag nbt = new CompoundTag("")
.putString("id", BlockEntity.SHULKER_BOX)
.putInt("x", (int) this.x)
.putInt("y", (int) this.y)
.putInt("z", (int) this.z);
shulkerBox = new BlockEntityShulkerBox(this.getLevel().getChunk((int) (this.x) >> 4, (int) (this.z) >> 4), nbt);
}
if (shulkerBox.namedTag.contains("Lock") && shulkerBox.namedTag.get("Lock") instanceof StringTag) {
if (!shulkerBox.namedTag.getString("Lock").equals(item.getCustomName())) {
return true;
}
}
player.addWindow(shulkerBox.getInventory());
}
return true;
}
示例5: onActivate
import cn.nukkit.Player; //导入方法依赖的package包/类
@Override
public boolean onActivate(Item item, Player player) {
if (player != null) {
BlockEntity t = getLevel().getBlockEntity(this);
BlockEntityDropper dropper;
if (t instanceof BlockEntityDropper) {
dropper = (BlockEntityDropper) t;
} else {
CompoundTag nbt = new CompoundTag()
.putList(new ListTag<>("Items"))
.putString("id", BlockEntity.DROPPER)
.putInt("x", (int) this.x)
.putInt("y", (int) this.y)
.putInt("z", (int) this.z);
dropper = new BlockEntityDropper(this.getLevel().getChunk((int) (this.x) >> 4, (int) (this.z) >> 4), nbt);
}
if (dropper.namedTag.contains("Lock") && dropper.namedTag.get("Lock") instanceof StringTag) {
if (!dropper.namedTag.getString("Lock").equals(item.getCustomName())) {
return false;
}
}
player.addWindow(dropper.getInventory());
}
return true;
}
示例6: onActivate
import cn.nukkit.Player; //导入方法依赖的package包/类
@Override
public boolean onActivate(Item item, Player player) {
if (player != null) {
player.addWindow(new AnvilInventory(this));
}
return true;
}
示例7: onInteract
import cn.nukkit.Player; //导入方法依赖的package包/类
@Override
public boolean onInteract(Player player, Item item) {
player.addWindow(this.getInventory());
return true;
}
示例8: onActivate
import cn.nukkit.Player; //导入方法依赖的package包/类
@Override
public boolean onActivate(Item item, Player player) {
player.addWindow(new BeaconInventory(this));
return true;
}