当前位置: 首页>>代码示例>>Java>>正文


Java CraftContainer类代码示例

本文整理汇总了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);
}
 
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:23,代码来源:CraftHumanEntity.java

示例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);
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:15,代码来源:CraftHumanEntity.java

示例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);
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:15,代码来源:CraftHumanEntity.java

示例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);
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:15,代码来源:CraftHumanEntity.java

示例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);
}
 
开发者ID:agaricusb,项目名称:MCPBukkit,代码行数:15,代码来源:CraftHumanEntity.java


注:本文中的org.bukkit.craftbukkit.inventory.CraftContainer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。