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