当前位置: 首页>>代码示例>>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;未经允许,请勿转载。