當前位置: 首頁>>代碼示例>>Java>>正文


Java Container.getSlot方法代碼示例

本文整理匯總了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);
	}
	
}
 
開發者ID:astronautlabs,項目名稱:rezolve,代碼行數:26,代碼來源:RemoteShellEntity.java

示例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));
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:15,代碼來源:EntityPlayerMP.java

示例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));
        }
    }
}
 
開發者ID:NSExceptional,項目名稱:Zombe-Modpack,代碼行數:15,代碼來源:EntityPlayerMP.java


注:本文中的net.minecraft.inventory.Container.getSlot方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。