本文整理汇总了Java中org.bukkit.craftbukkit.inventory.CraftContainer类的典型用法代码示例。如果您正苦于以下问题:Java CraftContainer类的具体用法?Java CraftContainer怎么用?Java CraftContainer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CraftContainer类属于org.bukkit.craftbukkit.inventory包,在下文中一共展示了CraftContainer类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: openCustomInventory
import org.bukkit.craftbukkit.inventory.CraftContainer; //导入依赖的package包/类
private void openCustomInventory(Inventory inventory, EntityPlayer player, String windowType) {
if (player.playerConnection == null) return;
Container container = new CraftContainer(inventory, this, player.nextContainerCounter());
container = CraftEventFactory.callInventoryOpenEvent(player, container);
if(container == null) return;
String title = container.getBukkitView().getTitle();
int size = container.getBukkitView().getTopInventory().getSize();
// Special cases
if (windowType.equals("minecraft:crafting_table")
|| windowType.equals("minecraft:anvil")
|| windowType.equals("minecraft:enchanting_table")
) {
size = 0;
}
player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, new ChatComponentText(title), size));
getHandle().activeContainer = container;
getHandle().activeContainer.addSlotListener(player);
}
示例2: openCustomInventory
import org.bukkit.craftbukkit.inventory.CraftContainer; //导入依赖的package包/类
private void openCustomInventory(Inventory inventory, net.minecraft.entity.player.EntityPlayerMP player, int windowType) {
if (player.playerNetServerHandler == null) return;
net.minecraft.inventory.Container container = new CraftContainer(inventory, this, player.nextContainerCounter());
container = CraftEventFactory.callInventoryOpenEvent(player, container);
if(container == null) return;
String title = container.getBukkitView().getTitle();
int size = container.getBukkitView().getTopInventory().getSize();
player.playerNetServerHandler.sendPacket(new net.minecraft.network.play.server.S2DPacketOpenWindow(container.windowId, windowType, title, size, true));
getHandle().openContainer = container;
getHandle().openContainer.addCraftingToCrafters(player);
}
示例3: openCustomInventory
import org.bukkit.craftbukkit.inventory.CraftContainer; //导入依赖的package包/类
private void openCustomInventory(Inventory inventory, EntityPlayer player, int windowType) {
if (player.playerConnection == null) return;
Container container = new CraftContainer(inventory, this, player.nextContainerCounter());
container = CraftEventFactory.callInventoryOpenEvent(player, container);
if(container == null) return;
String title = container.getBukkitView().getTitle();
int size = container.getBukkitView().getTopInventory().getSize();
player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, title, size, true));
getHandle().activeContainer = container;
getHandle().activeContainer.addSlotListener(player);
}
示例4: openCustomInventory
import org.bukkit.craftbukkit.inventory.CraftContainer; //导入依赖的package包/类
private void openCustomInventory(Inventory inventory, EntityPlayer player, int windowType) {
if (player.playerConnection == null) return;
Container container = new CraftContainer(inventory, this, player.nextContainerCounter());
container = CraftEventFactory.callInventoryOpenEvent(player, container);
if(container == null) return;
String title = container.getBukkitView().getTitle();
int size = container.getBukkitView().getTopInventory().getSize();
player.playerConnection.sendPacket(new Packet100OpenWindow(container.windowId, windowType, title, size, true));
getHandle().activeContainer = container;
getHandle().activeContainer.addSlotListener(player);
}
示例5: openCustomInventory
import org.bukkit.craftbukkit.inventory.CraftContainer; //导入依赖的package包/类
private void openCustomInventory(Inventory inventory, net.minecraft.entity.player.EntityPlayerMP player, int windowType) {
if (player.field_71135_a == null) return;
net.minecraft.inventory.Container container = new CraftContainer(inventory, this, player.nextContainerCounter());
container = CraftEventFactory.callInventoryOpenEvent(player, container);
if(container == null) return;
String title = container.getBukkitView().getTitle();
int size = container.getBukkitView().getTopInventory().getSize();
player.field_71135_a.func_72567_b(new net.minecraft.network.packet.Packet100OpenWindow(container.field_75152_c, windowType, title, size, true));
getHandle().field_71070_bA = container;
getHandle().field_71070_bA.func_75132_a(player);
}