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

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

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

Slot.getSlotStackLimit介绍

暂无

代码示例

代码示例来源:origin: Vazkii/Botania

@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
  GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
  mc.getTextureManager().bindTexture(texture);
  drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
  for(int i1 = 0; i1 < 7; ++i1) {
    Slot slot = inventorySlots.inventorySlots.get(i1);
    if(slot.getHasStack() && slot.getSlotStackLimit() == 1)
      drawTexturedModalRect(guiLeft+slot.xPos, guiTop+slot.yPos, 200, 0, 16, 16);
  }
}

代码示例来源:origin: ForestryMC/ForestryMC

@Override
public int getSlotStackLimit() {
  if (stackLimit < 0) {
    return super.getSlotStackLimit();
  } else {
    return stackLimit;
  }
}

代码示例来源:origin: p455w0rd/WirelessCraftingTerminal

@Override
  public int getSlotStackLimit() {
    if (stackLimit < 0) {
      return super.getSlotStackLimit();
    }
    else {
      return stackLimit;
    }
  }
}

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

@Override
  public int getSlotStackLimit() {
    if (redirectCall) {
      return super.getSlotStackLimit();
    }
    return 0;
  }
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

if( !testA.isEmpty() && testA.getCount() > a.getSlotStackLimit() )
  testA.setCount( a.getSlotStackLimit() );
  testB = testA.copy();
if( !testB.isEmpty() && testB.getCount() > b.getSlotStackLimit() )
  testB.setCount( b.getSlotStackLimit() );
  testA = testB.copy();

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

if( theSlot.getSlotStackLimit() == 64 )

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

if( maxSize > d.getSlotStackLimit() )
    maxSize = d.getSlotStackLimit();
  if( d.getSlotStackLimit() < maxSize )
    maxSize = d.getSlotStackLimit();
if( maxSize > d.getSlotStackLimit() )
  maxSize = d.getSlotStackLimit();

代码示例来源:origin: GregTechCE/GregTech

private static void fillPhantomSlot(Slot slot, ItemStack stackHeld, int mouseButton) {
  if (stackHeld.isEmpty()) {
    slot.putStack(ItemStack.EMPTY);
    return;
  }
  int stackSize = mouseButton == 0 ? stackHeld.getCount() : 1;
  if (stackSize > slot.getSlotStackLimit()) {
    stackSize = slot.getSlotStackLimit();
  }
  ItemStack phantomStack = stackHeld.copy();
  phantomStack.setCount(stackSize);
  slot.putStack(phantomStack);
}

代码示例来源:origin: GregTechCE/GregTech

private static void adjustPhantomSlot(Slot slot, int mouseButton, ClickType clickTypeIn) {
  ItemStack stackSlot = slot.getStack();
  int stackSize;
  if (clickTypeIn == ClickType.QUICK_MOVE) {
    stackSize = mouseButton == 0 ? (stackSlot.getCount() + 1) / 2 : stackSlot.getCount() * 2;
  } else {
    stackSize = mouseButton == 0 ? stackSlot.getCount() - 1 : stackSlot.getCount() + 1;
  }
  if (stackSize > slot.getSlotStackLimit()) {
    stackSize = slot.getSlotStackLimit();
  }
  stackSlot.setCount(stackSize);
  slot.putStack(stackSlot);
}

代码示例来源:origin: Azanor/Baubles

@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
  GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
  this.mc.getTextureManager().bindTexture(background);
  int k = this.guiLeft;
  int l = this.guiTop;
  this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
  for (int i1 = 0; i1 < this.inventorySlots.inventorySlots.size(); ++i1)
  {
    Slot slot = (Slot)this.inventorySlots.inventorySlots.get(i1);
    if (slot.getHasStack() && slot.getSlotStackLimit()==1)
    {
      this.drawTexturedModalRect(k+slot.xPos, l+slot.yPos, 200, 0, 16, 16);
    }
  }
  GuiInventory.drawEntityOnScreen(k + 51, l + 75, 30, (float)(k + 51) - this.oldMouseX, (float)(l + 75 - 50) - this.oldMouseY, this.mc.player);
}

代码示例来源:origin: ForestryMC/ForestryMC

private static boolean shiftItemStackToRangeOpenSlots(List<Slot> inventorySlots, ItemStack stackToShift, int start, int count) {
  if (stackToShift.isEmpty()) {
    return false;
  }
  boolean changed = false;
  for (int slotIndex = start; !stackToShift.isEmpty() && slotIndex < start + count; slotIndex++) {
    Slot slot = inventorySlots.get(slotIndex);
    ItemStack stackInSlot = slot.getStack();
    if (stackInSlot.isEmpty()) {
      int max = Math.min(stackToShift.getMaxStackSize(), slot.getSlotStackLimit());
      stackInSlot = stackToShift.copy();
      stackInSlot.setCount(Math.min(stackToShift.getCount(), max));
      stackToShift.shrink(stackInSlot.getCount());
      slot.putStack(stackInSlot);
      slot.onSlotChanged();
      changed = true;
    }
  }
  return changed;
}

代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition

var11 = var10.getCount() - stack.getCount();
  var10.grow(stack.getCount());
  int var12 = Math.min(stack.getMaxStackSize(), var9.getSlotStackLimit());
  if (var11 <= var12) {
    stack.setCount(0);
var10 = var9.getStack();
if (var9.isItemValid(stack) && StackUtils.isNullOrEmpty(var10)) {
  var11 = var5 ? Math.min(stack.getMaxStackSize(), var9.getSlotStackLimit()) : var9.getSlotStackLimit();
  var10 = stack.splitStack(Math.min(stack.getCount(), var11));
  var9.putStack(var10);

代码示例来源:origin: ForestryMC/ForestryMC

private static boolean shiftItemStackToRangeMerge(List<Slot> inventorySlots, ItemStack stackToShift, int start, int count) {
  if (!stackToShift.isStackable() || stackToShift.isEmpty()) {
    return false;
  }
  boolean changed = false;
  for (int slotIndex = start; !stackToShift.isEmpty() && slotIndex < start + count; slotIndex++) {
    Slot slot = inventorySlots.get(slotIndex);
    ItemStack stackInSlot = slot.getStack();
    if (!stackInSlot.isEmpty() && ItemStackUtil.isIdenticalItem(stackInSlot, stackToShift)) {
      int resultingStackSize = stackInSlot.getCount() + stackToShift.getCount();
      int max = Math.min(stackToShift.getMaxStackSize(), slot.getSlotStackLimit());
      if (resultingStackSize <= max) {
        stackToShift.setCount(0);
        stackInSlot.setCount(resultingStackSize);
        slot.onSlotChanged();
        changed = true;
      } else if (stackInSlot.getCount() < max) {
        stackToShift.shrink(max - stackInSlot.getCount());
        stackInSlot.setCount(max);
        slot.onSlotChanged();
        changed = true;
      }
    }
  }
  return changed;
}

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

int maxStack = Math.min(stack.getMaxStackSize(), slot.getSlotStackLimit());
int rmv = Math.min(maxStack, stack.getCount());
int maxStack = Math.min(stack.getMaxStackSize(), slot.getSlotStackLimit());
int rmv = Math.min(maxStack, stack.getCount());

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

if (!to.getHasStack() && !ignoreEmpty && to.isItemValid(out)) {
  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);

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

int slotLimit = Math.min(stack.getMaxStackSize(), slot.getSlotStackLimit());
slot.putStack(ItemHelper.cloneStack(stack, Math.min(stack.getCount(), slot.getSlotStackLimit())));
slot.onSlotChanged();

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

int slotLimit = Math.min(stack.getMaxStackSize(), slot.getSlotStackLimit());
slot.putStack(ItemHelper.cloneStack(stack, Math.min(stack.getCount(), slot.getSlotStackLimit())));
slot.onSlotChanged();

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

int maxStackSize = Math.min(par1ItemStack.getMaxStackSize(), slot.getSlotStackLimit());
if (mergedSize <= maxStackSize) {
 par1ItemStack.setCount(0);
in.setCount(Math.min(in.getCount(), slot.getSlotStackLimit()));

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

slot = getSlot(targetSlot);
targetStack = slot.getStack();
maxStackSize = slot.getSlotStackLimit();

代码示例来源:origin: raoulvdberge/refinedstorage

@Override
protected void handleMouseClick(Slot slot, int slotId, int mouseButton, ClickType type) {
  boolean valid = type != ClickType.QUICK_MOVE && Minecraft.getMinecraft().player.inventory.getItemStack().isEmpty();
  if (valid && slot instanceof SlotFilter && slot.isEnabled() && ((SlotFilter) slot).isSizeAllowed()) {
    if (!slot.getStack().isEmpty()) {
      FMLClientHandler.instance().showGuiScreen(new GuiAmount(
        (GuiBase) Minecraft.getMinecraft().currentScreen,
        Minecraft.getMinecraft().player,
        slot.slotNumber,
        slot.getStack(),
        slot.getSlotStackLimit()
      ));
    }
  } else if (valid && slot instanceof SlotFilterFluid && slot.isEnabled() && ((SlotFilterFluid) slot).isSizeAllowed()) {
    FluidStack stack = ((SlotFilterFluid) slot).getFluidInventory().getFluid(slot.getSlotIndex());
    if (stack != null) {
      FMLClientHandler.instance().showGuiScreen(new GuiFluidAmount(
        (GuiBase) Minecraft.getMinecraft().currentScreen,
        Minecraft.getMinecraft().player,
        slot.slotNumber,
        stack,
        ((SlotFilterFluid) slot).getFluidInventory().getMaxAmount()
      ));
    } else {
      super.handleMouseClick(slot, slotId, mouseButton, type);
    }
  } else {
    super.handleMouseClick(slot, slotId, mouseButton, type);
  }
}

相关文章