• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Slot类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.minecraft.server.Slot的典型用法代码示例。如果您正苦于以下问题:Java Slot类的具体用法?Java Slot怎么用?Java Slot使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Slot类属于net.minecraft.server包,在下文中一共展示了Slot类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: handleEditBookEvent

import net.minecraft.server.Slot; //导入依赖的package包/类
public static void handleEditBookEvent(EntityPlayer player, ItemStack newBookItem) {
    int itemInHandIndex = player.inventory.itemInHandIndex;

    PlayerEditBookEvent editBookEvent = new PlayerEditBookEvent(player.getBukkitEntity(), player.inventory.itemInHandIndex, (BookMeta) CraftItemStack.getItemMeta(player.inventory.getItemInHand()), (BookMeta) CraftItemStack.getItemMeta(newBookItem), newBookItem.getItem() == Items.WRITTEN_BOOK);
    player.world.getServer().getPluginManager().callEvent(editBookEvent);
    ItemStack itemInHand = player.inventory.getItem(itemInHandIndex);

    // If they've got the same item in their hand, it'll need to be updated.
    if (itemInHand != null && itemInHand.getItem() == Items.BOOK_AND_QUILL) {
        if (!editBookEvent.isCancelled()) {
            CraftItemStack.setItemMeta(itemInHand, editBookEvent.getNewBookMeta());
            if (editBookEvent.isSigning()) {
                itemInHand.setItem(Items.WRITTEN_BOOK);
            }
        }

        // Client will have updated its idea of the book item; we need to overwrite that
        Slot slot = player.activeContainer.getSlot(player.inventory, itemInHandIndex);
        player.playerConnection.sendPacket(new PacketPlayOutSetSlot(player.activeContainer.windowId, slot.rawSlotIndex, itemInHand));
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:22,代码来源:CraftEventFactory.java


示例2: setupChest

import net.minecraft.server.Slot; //导入依赖的package包/类
private void setupChest(IInventory top, IInventory bottom) {
    int rows = top.getSize() / 9;
    int row;
    int col;
    // This code copied from ContainerChest
    int i = (rows - 4) * 18;
    for (row = 0; row < rows; ++row) {
        for (col = 0; col < 9; ++col) {
            this.a(new Slot(top, col + row * 9, 8 + col * 18, 18 + row * 18));
        }
    }

    for (row = 0; row < 3; ++row) {
        for (col = 0; col < 9; ++col) {
            this.a(new Slot(bottom, col + row * 9 + 9, 8 + col * 18, 103 + row * 18 + i));
        }
    }

    for (col = 0; col < 9; ++col) {
        this.a(new Slot(bottom, col, 8 + col * 18, 161 + i));
    }
    // End copy from ContainerChest
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:24,代码来源:CraftContainer.java


示例3: setupWorkbench

import net.minecraft.server.Slot; //导入依赖的package包/类
private void setupWorkbench(IInventory top, IInventory bottom) {
    // This code copied from ContainerWorkbench
    this.a(new Slot(top, 0, 124, 35));

    int row;
    int col;

    for (row = 0; row < 3; ++row) {
        for (col = 0; col < 3; ++col) {
            this.a(new Slot(top, 1 + col + row * 3, 30 + col * 18, 17 + row * 18));
        }
    }

    for (row = 0; row < 3; ++row) {
        for (col = 0; col < 9; ++col) {
            this.a(new Slot(bottom, col + row * 9 + 9, 8 + col * 18, 84 + row * 18));
        }
    }

    for (col = 0; col < 9; ++col) {
        this.a(new Slot(bottom, col, 8 + col * 18, 142));
    }
    // End copy from ContainerWorkbench
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:25,代码来源:CraftContainer.java


示例4: setupFurnace

import net.minecraft.server.Slot; //导入依赖的package包/类
private void setupFurnace(IInventory top, IInventory bottom) {
    // This code copied from ContainerFurnace
    this.a(new Slot(top, 0, 56, 17));
    this.a(new Slot(top, 1, 56, 53));
    this.a(new Slot(top, 2, 116, 35));

    int row;
    int col;

    for (row = 0; row < 3; ++row) {
        for (col = 0; col < 9; ++col) {
            this.a(new Slot(bottom, col + row * 9 + 9, 8 + col * 18, 84 + row * 18));
        }
    }

    for (col = 0; col < 9; ++col) {
        this.a(new Slot(bottom, col, 8 + col * 18, 142));
    }
    // End copy from ContainerFurnace
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:21,代码来源:CraftContainer.java


示例5: setupDispenser

import net.minecraft.server.Slot; //导入依赖的package包/类
private void setupDispenser(IInventory top, IInventory bottom) {
    // This code copied from ContainerDispenser
    int row;
    int col;

    for (row = 0; row < 3; ++row) {
        for (col = 0; col < 3; ++col) {
            this.a(new Slot(top, col + row * 3, 61 + col * 18, 17 + row * 18));
        }
    }

    for (row = 0; row < 3; ++row) {
        for (col = 0; col < 9; ++col) {
            this.a(new Slot(bottom, col + row * 9 + 9, 8 + col * 18, 84 + row * 18));
        }
    }

    for (col = 0; col < 9; ++col) {
        this.a(new Slot(bottom, col, 8 + col * 18, 142));
    }
    // End copy from ContainerDispenser
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:23,代码来源:CraftContainer.java


示例6: setupEnchanting

import net.minecraft.server.Slot; //导入依赖的package包/类
private void setupEnchanting(IInventory top, IInventory bottom) {
    // This code copied from ContainerEnchantTable
    this.a((new Slot(top, 0, 25, 47)));

    int row;

    for (row = 0; row < 3; ++row) {
        for (int i1 = 0; i1 < 9; ++i1) {
            this.a(new Slot(bottom, i1 + row * 9 + 9, 8 + i1 * 18, 84 + row * 18));
        }
    }

    for (row = 0; row < 9; ++row) {
        this.a(new Slot(bottom, row, 8 + row * 18, 142));
    }
    // End copy from ContainerEnchantTable
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:18,代码来源:CraftContainer.java


示例7: setupBrewing

import net.minecraft.server.Slot; //导入依赖的package包/类
private void setupBrewing(IInventory top, IInventory bottom) {
    // This code copied from ContainerBrewingStand
    this.a(new Slot(top, 0, 56, 46));
    this.a(new Slot(top, 1, 79, 53));
    this.a(new Slot(top, 2, 102, 46));
    this.a(new Slot(top, 3, 79, 17));

    int i;

    for (i = 0; i < 3; ++i) {
        for (int j = 0; j < 9; ++j) {
            this.a(new Slot(bottom, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
        }
    }

    for (i = 0; i < 9; ++i) {
        this.a(new Slot(bottom, i, 8 + i * 18, 142));
    }
    // End copy from ContainerBrewingStand
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:21,代码来源:CraftContainer.java


示例8: setupHopper

import net.minecraft.server.Slot; //导入依赖的package包/类
private void setupHopper(IInventory top, IInventory bottom) {
    // This code copied from ContainerHopper
    byte b0 = 51;

    int i;

    for (i = 0; i < top.getSize(); ++i) {
        this.a(new Slot(top, i, 44 + i * 18, 20));
    }

    for (i = 0; i < 3; ++i) {
        for (int j = 0; j < 9; ++j) {
            this.a(new Slot(bottom, j + i * 9 + 9, 8 + j * 18, i * 18 + b0));
        }
    }

    for (i = 0; i < 9; ++i) {
        this.a(new Slot(bottom, i, 8 + i * 18, 58 + b0));
    }
    // End copy from ContainerHopper
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:22,代码来源:CraftContainer.java


示例9: handleEditBookEvent

import net.minecraft.server.Slot; //导入依赖的package包/类
public static void handleEditBookEvent(EntityPlayer player, ItemStack newBookItem) {
    int itemInHandIndex = player.inventory.itemInHandIndex;

    PlayerEditBookEvent editBookEvent = new PlayerEditBookEvent(player.getBukkitEntity(), player.inventory.itemInHandIndex, (BookMeta) CraftItemStack.getItemMeta(player.inventory.getItemInHand()), (BookMeta) CraftItemStack.getItemMeta(newBookItem), newBookItem.id == Item.WRITTEN_BOOK.id);
    player.world.getServer().getPluginManager().callEvent(editBookEvent);
    ItemStack itemInHand = player.inventory.getItem(itemInHandIndex);

    // If they've got the same item in their hand, it'll need to be updated.
    if (itemInHand.id == Item.BOOK_AND_QUILL.id) {
        if (!editBookEvent.isCancelled()) {
            CraftItemStack.setItemMeta(itemInHand, editBookEvent.getNewBookMeta());
            if (editBookEvent.isSigning()) {
                itemInHand.id = Item.WRITTEN_BOOK.id;
            }
        }

        // Client will have updated its idea of the book item; we need to overwrite that
        Slot slot = player.activeContainer.a((IInventory) player.inventory, itemInHandIndex);
        player.playerConnection.sendPacket(new Packet103SetSlot(player.activeContainer.windowId, slot.g, itemInHand));
    }
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:22,代码来源:CraftEventFactory.java


示例10: setupEnchanting

import net.minecraft.server.Slot; //导入依赖的package包/类
private void setupEnchanting(IInventory top, IInventory bottom) {
    // This code copied from ContainerEnchantTable
    this.a((new Slot(top, 0, 15, 47)));
    this.a((new Slot(top, 0, 35, 47)));

    int row;

    for (row = 0; row < 3; ++row) {
        for (int i1 = 0; i1 < 9; ++i1) {
            this.a(new Slot(bottom, i1 + row * 9 + 9, 8 + i1 * 18, 84 + row * 18));
        }
    }

    for (row = 0; row < 9; ++row) {
        this.a(new Slot(bottom, row, 8 + row * 18, 142));
    }
    // End copy from ContainerEnchantTable
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:19,代码来源:CraftContainer.java


示例11: setupBrewing

import net.minecraft.server.Slot; //导入依赖的package包/类
private void setupBrewing(IInventory top, IInventory bottom) {
    // This code copied from ContainerBrewingStand
    this.a(new Slot(top, 0, 56, 46));
    this.a(new Slot(top, 1, 79, 53));
    this.a(new Slot(top, 2, 102, 46));
    this.a(new Slot(top, 3, 79, 17));
    this.a(new Slot(top, 4, 17, 17));

    int i;
    for (i = 0; i < 3; ++i) {
        for (int j = 0; j < 9; ++j) {
            this.a(new Slot(bottom, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
        }
    }

    for (i = 0; i < 9; ++i) {
        this.a(new Slot(bottom, i, 8 + i * 18, 142));
    }
    // End copy from ContainerBrewingStand
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:21,代码来源:CraftContainer.java


示例12: setupAnvil

import net.minecraft.server.Slot; //导入依赖的package包/类
private void setupAnvil(IInventory top, IInventory bottom) {
    // This code copied from ContainerAnvil
    this.a(new Slot(top, 0, 27, 47));
    this.a(new Slot(top, 1, 76, 47));
    this.a(new Slot(top, 2, 134, 47));

    int i;

    for (i = 0; i < 3; ++i) {
        for (int j = 0; j < 9; ++j) {
            this.a(new Slot(bottom, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
        }
    }

    for (i = 0; i < 9; ++i) {
        this.a(new Slot(bottom, i, 8 + i * 18, 142));
    }
    // End copy from ContainerAnvil
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:20,代码来源:CraftContainer.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MobileApplication类代码示例发布时间:2022-05-23
下一篇:
Java MessageType类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap