本文整理了Java中net.minecraft.inventory.Slot.decrStackSize()
方法的一些代码示例,展示了Slot.decrStackSize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Slot.decrStackSize()
方法的具体详情如下:
包路径:net.minecraft.inventory.Slot
类名称:Slot
方法名:decrStackSize
暂无
代码示例来源:origin: TeamLapen/Vampirism
@Override
public ItemStack decrStackSize(int amount) {
if (this.getHasStack()) {
this.amountCrafted += Math.min(amount, this.getStack().getCount());
}
return super.decrStackSize(amount);
}
代码示例来源:origin: P3pp3rF1y/AncientWarfare2
/**
* Decrease the size of the stack in slot (first int arg) by the amount of the second int arg. Returns the new
* stack.
*/
public ItemStack decrStackSize(int amount) {
if (getHasStack()) {
amountCrafted += Math.min(amount, getStack().getCount());
}
return super.decrStackSize(amount);
}
代码示例来源:origin: Alex-the-666/Ice_and_Fire
@Override
public ItemStack decrStackSize(int amount) {
if (this.getHasStack()) {
this.field_75228_b += Math.min(amount, this.getStack().getCount());
}
return super.decrStackSize(amount);
}
代码示例来源:origin: mezz/JustEnoughItems
ItemStack removedItemStack = slot.decrStackSize(1);
foundItemsInSet.put(entry.getKey(), removedItemStack);
代码示例来源:origin: jabelar/ExampleMod-1.12
/**
* Decrease the size of the stack in slot by the amount of the int arg. Returns the new stack.
*
* @param parAmount
* the par amount
* @return the item stack
*/
@Override
public ItemStack decrStackSize(int parAmount)
{
if (getHasStack())
{
setNumOutput(getNumOutput() + Math.min(parAmount, getStack().getCount()));
}
return super.decrStackSize(parAmount);
}
代码示例来源:origin: mezz/JustEnoughItems
Slot craftingSlot = container.getSlot(craftingSlotNumber);
if (craftingSlot.getHasStack()) {
ItemStack craftingItem = craftingSlot.decrStackSize(Integer.MAX_VALUE);
clearedCraftingItems.add(craftingItem);
代码示例来源:origin: SleepyTrousers/EnderIO
private void createPrintout(@Nonnull EntityPlayerMP player, @Nonnull TelepadTarget telepadTarget, int paperSlot) {
if (telepadTarget.getDimension() != player.world.provider.getDimension()) {
return;
}
if (telepadTarget.getLocation().distanceSq(new BlockPos(player)) > 160 * 160) {
// ideally we'd want to raytrace this, but the difference between raytracing on the server and the client is just too big, especially over long
// distances...
return;
}
ItemStack invItem = player.inventoryContainer.inventorySlots.get(paperSlot).getStack();
if (Prep.isValid(invItem) && invItem.getItem() == Items.PAPER) {
player.inventoryContainer.inventorySlots.get(paperSlot).decrStackSize(1);
player.inventoryContainer.detectAndSendChanges();
ItemStack stack = new ItemStack(itemLocationPrintout.getItemNN());
telepadTarget.writeToNBT(stack);
if (!player.inventory.addItemStackToInventory(stack)) {
player.dropItem(stack, false);
}
}
}
代码示例来源:origin: RS485/LogisticsPipes
boolean remove = true;
if(out.getCount() > to.getSlotStackLimit()) {
out = from.decrStackSize(to.getSlotStackLimit());
remove = false;
int free = Math.min(to.getSlotStackLimit(), to.getStack().getMaxStackSize()) - to.getStack().getCount();
if(free > 0) {
ItemStack toInsert = from.decrStackSize(free);
toInsert = from.onTake(player, toInsert);
ItemStack toStack = to.getStack();
代码示例来源:origin: PenguinSquad/Harvest-Festival
inventoryplayer.setItemStack(slot7.decrStackSize(k2));
inSlot = slot7.decrStackSize(i2);
ItemStack itemstack5 = slot3.decrStackSize(dragType == 0 ? 1 : slot3.getStack().stackSize);
slot3.onPickupFromSlot(player, itemstack5);
player.dropItem(itemstack5, true);
ItemStack itemstack2 = slot8.decrStackSize(l);
itemstack4.stackSize += l;
代码示例来源:origin: CoFH/CoFHCore
if (itemstack4.isEmpty()) {
l1 = mouseButton == 0 ? itemstack3.getCount() : (itemstack3.getCount() + 1) / 2;
itemstack5 = slot2.decrStackSize(l1);
inventoryPlayer.setItemStack(itemstack5);
itemstack3 = slot2.decrStackSize(l1);
if (l1 > -1) {
inventoryPlayer.addItemStackToInventory(itemstack3);
slot2.decrStackSize(itemstack5.getCount());
slot2.putStack(ItemStack.EMPTY);
slot2.onTake(player, itemstack5);
slot2.decrStackSize(itemstack5.getCount());
slot2.putStack(itemstack3);
slot2.onTake(player, itemstack5);
itemstack3 = slot2.decrStackSize(mouseButton == 0 ? 1 : slot2.getStack().getCount());
slot2.onTake(player, itemstack3);
player.dropItem(itemstack3, true);
ItemStack itemstack2 = slot3.decrStackSize(k1);
itemstack3.grow(k1);
代码示例来源:origin: RS485/LogisticsPipes
} else {
int l2 = dragType == 0 ? itemstack8.getCount() : (itemstack8.getCount() + 1) / 2;
inventoryplayer.setItemStack(slot6.decrStackSize(l2));
itemstack8 = slot6.decrStackSize(j2);
ItemStack itemstack4 = slot2.decrStackSize(dragType == 0 ? 1 : slot2.getStack().getCount());
slot2.onTake(player, itemstack4);
player.dropItem(itemstack4, true);
ItemStack itemstack3 = slot1.decrStackSize(i1);
itemstack1.grow(i1);
内容来源于网络,如有侵权,请联系作者删除!