本文整理汇总了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));
}
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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));
}
}
示例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
}
示例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
}
示例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
}