本文整理汇总了Java中net.minecraft.network.play.server.SPacketSetSlot.getSlot方法的典型用法代码示例。如果您正苦于以下问题:Java SPacketSetSlot.getSlot方法的具体用法?Java SPacketSetSlot.getSlot怎么用?Java SPacketSetSlot.getSlot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.network.play.server.SPacketSetSlot
的用法示例。
在下文中一共展示了SPacketSetSlot.getSlot方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleSetSlot
import net.minecraft.network.play.server.SPacketSetSlot; //导入方法依赖的package包/类
/**
* Handles pickin up an ItemStack or dropping one in your inventory or an open (non-creative) container
*/
public void handleSetSlot(SPacketSetSlot packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
EntityPlayer entityplayer = this.gameController.player;
ItemStack itemstack = packetIn.getStack();
int i = packetIn.getSlot();
if (packetIn.getWindowId() == -1)
{
entityplayer.inventory.setItemStack(itemstack);
}
else if (packetIn.getWindowId() == -2)
{
entityplayer.inventory.setInventorySlotContents(i, itemstack);
}
else
{
boolean flag = false;
if (this.gameController.currentScreen instanceof GuiContainerCreative)
{
GuiContainerCreative guicontainercreative = (GuiContainerCreative)this.gameController.currentScreen;
flag = guicontainercreative.getSelectedTabIndex() != CreativeTabs.INVENTORY.getTabIndex();
}
if (packetIn.getWindowId() == 0 && packetIn.getSlot() >= 36 && i < 45)
{
if (!itemstack.func_190926_b())
{
ItemStack itemstack1 = entityplayer.inventoryContainer.getSlot(i).getStack();
if (itemstack1.func_190926_b() || itemstack1.func_190916_E() < itemstack.func_190916_E())
{
itemstack.func_190915_d(5);
}
}
entityplayer.inventoryContainer.putStackInSlot(i, itemstack);
}
else if (packetIn.getWindowId() == entityplayer.openContainer.windowId && (packetIn.getWindowId() != 0 || !flag))
{
entityplayer.openContainer.putStackInSlot(i, itemstack);
}
}
}
示例2: handleSetSlot
import net.minecraft.network.play.server.SPacketSetSlot; //导入方法依赖的package包/类
/**
* Handles pickin up an ItemStack or dropping one in your inventory or an open (non-creative) container
*/
public void handleSetSlot(SPacketSetSlot packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
EntityPlayer entityplayer = this.gameController.thePlayer;
if (packetIn.getWindowId() == -1)
{
entityplayer.inventory.setItemStack(packetIn.getStack());
}
else if (packetIn.getWindowId() == -2)
{
entityplayer.inventory.setInventorySlotContents(packetIn.getSlot(), packetIn.getStack());
}
else
{
boolean flag = false;
if (this.gameController.currentScreen instanceof GuiContainerCreative)
{
GuiContainerCreative guicontainercreative = (GuiContainerCreative)this.gameController.currentScreen;
flag = guicontainercreative.getSelectedTabIndex() != CreativeTabs.INVENTORY.getTabIndex();
}
if (packetIn.getWindowId() == 0 && packetIn.getSlot() >= 36 && packetIn.getSlot() < 45)
{
ItemStack itemstack = entityplayer.inventoryContainer.getSlot(packetIn.getSlot()).getStack();
if (packetIn.getStack() != null && (itemstack == null || itemstack.stackSize < packetIn.getStack().stackSize))
{
packetIn.getStack().animationsToGo = 5;
}
entityplayer.inventoryContainer.putStackInSlot(packetIn.getSlot(), packetIn.getStack());
}
else if (packetIn.getWindowId() == entityplayer.openContainer.windowId && (packetIn.getWindowId() != 0 || !flag))
{
entityplayer.openContainer.putStackInSlot(packetIn.getSlot(), packetIn.getStack());
}
}
}