本文整理匯總了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;
}