net.minecraft.inventory.Slot.decrStackSize()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(4.4k)|赞(0)|评价(0)|浏览(154)

本文整理了Java中net.minecraft.inventory.Slot.decrStackSize()方法的一些代码示例,展示了Slot.decrStackSize()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Slot.decrStackSize()方法的具体详情如下:
包路径:net.minecraft.inventory.Slot
类名称:Slot
方法名:decrStackSize

Slot.decrStackSize介绍

暂无

代码示例

代码示例来源:origin: TeamLapen/Vampirism

  1. @Override
  2. public ItemStack decrStackSize(int amount) {
  3. if (this.getHasStack()) {
  4. this.amountCrafted += Math.min(amount, this.getStack().getCount());
  5. }
  6. return super.decrStackSize(amount);
  7. }

代码示例来源:origin: P3pp3rF1y/AncientWarfare2

  1. /**
  2. * Decrease the size of the stack in slot (first int arg) by the amount of the second int arg. Returns the new
  3. * stack.
  4. */
  5. public ItemStack decrStackSize(int amount) {
  6. if (getHasStack()) {
  7. amountCrafted += Math.min(amount, getStack().getCount());
  8. }
  9. return super.decrStackSize(amount);
  10. }

代码示例来源:origin: Alex-the-666/Ice_and_Fire

  1. @Override
  2. public ItemStack decrStackSize(int amount) {
  3. if (this.getHasStack()) {
  4. this.field_75228_b += Math.min(amount, this.getStack().getCount());
  5. }
  6. return super.decrStackSize(amount);
  7. }

代码示例来源:origin: mezz/JustEnoughItems

  1. ItemStack removedItemStack = slot.decrStackSize(1);
  2. foundItemsInSet.put(entry.getKey(), removedItemStack);

代码示例来源:origin: jabelar/ExampleMod-1.12

  1. /**
  2. * Decrease the size of the stack in slot by the amount of the int arg. Returns the new stack.
  3. *
  4. * @param parAmount
  5. * the par amount
  6. * @return the item stack
  7. */
  8. @Override
  9. public ItemStack decrStackSize(int parAmount)
  10. {
  11. if (getHasStack())
  12. {
  13. setNumOutput(getNumOutput() + Math.min(parAmount, getStack().getCount()));
  14. }
  15. return super.decrStackSize(parAmount);
  16. }

代码示例来源:origin: mezz/JustEnoughItems

  1. Slot craftingSlot = container.getSlot(craftingSlotNumber);
  2. if (craftingSlot.getHasStack()) {
  3. ItemStack craftingItem = craftingSlot.decrStackSize(Integer.MAX_VALUE);
  4. clearedCraftingItems.add(craftingItem);

代码示例来源:origin: SleepyTrousers/EnderIO

  1. private void createPrintout(@Nonnull EntityPlayerMP player, @Nonnull TelepadTarget telepadTarget, int paperSlot) {
  2. if (telepadTarget.getDimension() != player.world.provider.getDimension()) {
  3. return;
  4. }
  5. if (telepadTarget.getLocation().distanceSq(new BlockPos(player)) > 160 * 160) {
  6. // 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
  7. // distances...
  8. return;
  9. }
  10. ItemStack invItem = player.inventoryContainer.inventorySlots.get(paperSlot).getStack();
  11. if (Prep.isValid(invItem) && invItem.getItem() == Items.PAPER) {
  12. player.inventoryContainer.inventorySlots.get(paperSlot).decrStackSize(1);
  13. player.inventoryContainer.detectAndSendChanges();
  14. ItemStack stack = new ItemStack(itemLocationPrintout.getItemNN());
  15. telepadTarget.writeToNBT(stack);
  16. if (!player.inventory.addItemStackToInventory(stack)) {
  17. player.dropItem(stack, false);
  18. }
  19. }
  20. }

代码示例来源:origin: RS485/LogisticsPipes

  1. boolean remove = true;
  2. if(out.getCount() > to.getSlotStackLimit()) {
  3. out = from.decrStackSize(to.getSlotStackLimit());
  4. remove = false;
  5. int free = Math.min(to.getSlotStackLimit(), to.getStack().getMaxStackSize()) - to.getStack().getCount();
  6. if(free > 0) {
  7. ItemStack toInsert = from.decrStackSize(free);
  8. toInsert = from.onTake(player, toInsert);
  9. ItemStack toStack = to.getStack();

代码示例来源:origin: PenguinSquad/Harvest-Festival

  1. inventoryplayer.setItemStack(slot7.decrStackSize(k2));
  2. inSlot = slot7.decrStackSize(i2);
  3. ItemStack itemstack5 = slot3.decrStackSize(dragType == 0 ? 1 : slot3.getStack().stackSize);
  4. slot3.onPickupFromSlot(player, itemstack5);
  5. player.dropItem(itemstack5, true);
  6. ItemStack itemstack2 = slot8.decrStackSize(l);
  7. itemstack4.stackSize += l;

代码示例来源:origin: CoFH/CoFHCore

  1. if (itemstack4.isEmpty()) {
  2. l1 = mouseButton == 0 ? itemstack3.getCount() : (itemstack3.getCount() + 1) / 2;
  3. itemstack5 = slot2.decrStackSize(l1);
  4. inventoryPlayer.setItemStack(itemstack5);
  5. itemstack3 = slot2.decrStackSize(l1);
  6. if (l1 > -1) {
  7. inventoryPlayer.addItemStackToInventory(itemstack3);
  8. slot2.decrStackSize(itemstack5.getCount());
  9. slot2.putStack(ItemStack.EMPTY);
  10. slot2.onTake(player, itemstack5);
  11. slot2.decrStackSize(itemstack5.getCount());
  12. slot2.putStack(itemstack3);
  13. slot2.onTake(player, itemstack5);
  14. itemstack3 = slot2.decrStackSize(mouseButton == 0 ? 1 : slot2.getStack().getCount());
  15. slot2.onTake(player, itemstack3);
  16. player.dropItem(itemstack3, true);
  17. ItemStack itemstack2 = slot3.decrStackSize(k1);
  18. itemstack3.grow(k1);

代码示例来源:origin: RS485/LogisticsPipes

  1. } else {
  2. int l2 = dragType == 0 ? itemstack8.getCount() : (itemstack8.getCount() + 1) / 2;
  3. inventoryplayer.setItemStack(slot6.decrStackSize(l2));
  4. itemstack8 = slot6.decrStackSize(j2);
  5. ItemStack itemstack4 = slot2.decrStackSize(dragType == 0 ? 1 : slot2.getStack().getCount());
  6. slot2.onTake(player, itemstack4);
  7. player.dropItem(itemstack4, true);
  8. ItemStack itemstack3 = slot1.decrStackSize(i1);
  9. itemstack1.grow(i1);

相关文章