本文整理汇总了Java中net.minecraft.inventory.IInventory.getInventoryStackLimit方法的典型用法代码示例。如果您正苦于以下问题:Java IInventory.getInventoryStackLimit方法的具体用法?Java IInventory.getInventoryStackLimit怎么用?Java IInventory.getInventoryStackLimit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.inventory.IInventory
的用法示例。
在下文中一共展示了IInventory.getInventoryStackLimit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: pushItemIInventory
import net.minecraft.inventory.IInventory; //导入方法依赖的package包/类
protected boolean pushItemIInventory(IInventory inventory, int slot) {
if(inventory.getStackInSlot(slot) == null) {
if(debug)
FMLLog.log(Level.INFO, "F");
inventory.setInventorySlotContents(slot, blockItemStack.copy());
blockItemStack = null;
markDirty = true;
} else if(inventory.getStackInSlot(slot).getItem() == blockItemStack.getItem() && inventory.getStackInSlot(slot).stackSize < inventory.getInventoryStackLimit() && inventory.getStackInSlot(slot).stackSize < inventory.getStackInSlot(slot).getMaxStackSize()) {
if(debug)
FMLLog.log(Level.INFO, "G");
blockItemStack.stackSize = blockItemStack.stackSize + inventory.getStackInSlot(slot).stackSize;
inventory.setInventorySlotContents(slot, blockItemStack.copy());
blockItemStack = null;
markDirty = true;
} else {
if(debug)
FMLLog.log(Level.INFO, "Ga");
}
return markDirty;
}
示例2: pushItemIInventory
import net.minecraft.inventory.IInventory; //导入方法依赖的package包/类
protected boolean pushItemIInventory(IInventory inventory, int slot) {
if(blockItemStack.stackSize > 1) {
ItemStack oldStack = blockItemStack.copy();
ItemStack newStack = blockItemStack.splitStack(1);
if(inventory.getStackInSlot(slot) == null) {
if(debug)
FMLLog.log(Level.INFO, "fF");
inventory.setInventorySlotContents(slot, newStack.copy());
newStack = null;
markDirty = true;
} else if(inventory.getStackInSlot(slot).getItem() == newStack.getItem() && inventory.getStackInSlot(slot).stackSize < inventory.getInventoryStackLimit() && inventory.getStackInSlot(slot).stackSize < inventory.getStackInSlot(slot).getMaxStackSize()) {
if(debug)
FMLLog.log(Level.INFO, "fG");
newStack.stackSize += inventory.getStackInSlot(slot).stackSize;
inventory.setInventorySlotContents(slot, newStack.copy());
newStack = null;
markDirty = true;
} else {
if(debug)
FMLLog.log(Level.INFO, "fGa");
}
if(newStack == null || newStack.stackSize == 0) {
if(debug)
FMLLog.log(Level.INFO, "fDa");
markDirty = true;
} else {
blockItemStack = oldStack;
}
}
return markDirty;
}