本文整理匯總了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));
}
}
}