本文整理汇总了Java中net.minecraft.inventory.Container.getSlot方法的典型用法代码示例。如果您正苦于以下问题:Java Container.getSlot方法的具体用法?Java Container.getSlot怎么用?Java Container.getSlot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.inventory.Container
的用法示例。
在下文中一共展示了Container.getSlot方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendSlotContents
import net.minecraft.inventory.Container; //导入方法依赖的package包/类
@Override
public void sendSlotContents(Container containerToSend, int slotInd, ItemStack stack) {
Slot slot = containerToSend.getSlot(slotInd);
boolean charge = true;
if (slot != null) {
if (slot.inventory instanceof InventoryPlayer) {
// We don't charge for changes to the player's inventory.
charge = false;
}
}
System.out.println("Send slot contents for "+slotInd+":");
if (stack == null)
System.out.println(" - No contents");
else
System.out.println(" - "+stack.stackSize+" "+stack.getDisplayName());
if (charge) {
System.out.println("Charging a fee for data transfer...");
this.chargeForAccess(1);
}
}
示例2: sendSlotContents
import net.minecraft.inventory.Container; //导入方法依赖的package包/类
/**
* Sends the contents of an inventory slot to the client-side Container. This doesn't have to match the actual
* contents of that slot. Args: Container, slot number, slot contents
*/
public void sendSlotContents(Container containerToSend, int slotInd, ItemStack stack)
{
if (!(containerToSend.getSlot(slotInd) instanceof SlotCrafting))
{
if (!this.isChangingQuantityOnly)
{
this.playerNetServerHandler.sendPacket(new S2FPacketSetSlot(containerToSend.windowId, slotInd, stack));
}
}
}
示例3: sendSlotContents
import net.minecraft.inventory.Container; //导入方法依赖的package包/类
/**
* Sends the contents of an inventory slot to the client-side Container. This doesn't have to match the actual
* contents of that slot.
*/
public void sendSlotContents(Container containerToSend, int slotInd, ItemStack stack)
{
if (!(containerToSend.getSlot(slotInd) instanceof SlotCrafting))
{
if (!this.isChangingQuantityOnly)
{
this.connection.sendPacket(new SPacketSetSlot(containerToSend.windowId, slotInd, stack));
}
}
}