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

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

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

Slot.onSlotChange介绍

暂无

代码示例

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

public static ItemStack transferStackInSlot(List<Slot> inventorySlots, EntityPlayer player, int slotIndex) {
  Slot slot = inventorySlots.get(slotIndex);
  if (slot == null || !slot.getHasStack()) {
    return ItemStack.EMPTY;
  }
  boolean fromCraftingSlot = slot instanceof SlotCrafting || slot instanceof SlotCrafter;
  int numSlots = inventorySlots.size();
  ItemStack stackInSlot = slot.getStack();
  ItemStack originalStack = stackInSlot.copy();
  if (!shiftItemStack(inventorySlots, stackInSlot, slotIndex, numSlots, fromCraftingSlot)) {
    return ItemStack.EMPTY;
  }
  slot.onSlotChange(stackInSlot, originalStack);
  if (stackInSlot.isEmpty()) {
    slot.putStack(ItemStack.EMPTY);
  } else {
    slot.onSlotChanged();
  }
  if (stackInSlot.getCount() == originalStack.getCount()) {
    return ItemStack.EMPTY;
  }
  slot.onTake(player, stackInSlot);
  return originalStack;
}

代码示例来源:origin: SonarSonic/Calculator

@Override
public void onSlotChange(ItemStack stack1, ItemStack stack2) {
  super.onSlotChange(stack1, stack2);
  if (player != null) {
    /*
    int[] unblocked = entity.unblockedList();
    if (entity.isBlocked(entity.lastResearch) && entity.lastResearch != 0) {
      if (CalculatorRecipes.recipes().discovery(unblocked, entity.lastResearch)) {
        FontHelper.sendMessage(FontHelper.translate("research.recipeNew"), entity.getWorld(), player);
      }
    }
    */
    entity.markBlockForUpdate();
    entity.getWorld().addBlockEvent(entity.getPos(), entity.getBlockType(), 1, 0);
  }
}

代码示例来源:origin: SonarSonic/Calculator

@Nonnull
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int id) {
  ItemStack itemstack = ItemStack.EMPTY;
  Slot slot = this.inventorySlots.get(id);
  if (slot != null && slot.getHasStack()) {
    ItemStack itemstack1 = slot.getStack();
    itemstack = itemstack1.copy();
    if (id < INV_START) {
      if (!this.mergeItemStack(itemstack1, INV_START, HOTBAR_END + 1, true)) {
        return ItemStack.EMPTY;
      }
      slot.onSlotChange(itemstack1, itemstack);
    } else {
      if (!this.mergeItemStack(itemstack1, 0, INV_START, false)) {
        return ItemStack.EMPTY;
      }
    }
    if (itemstack1.getCount() == 0) {
      slot.putStack(ItemStack.EMPTY);
    } else {
      slot.onSlotChanged();
    }
    if (itemstack1.getCount() == itemstack.getCount()) {
      return ItemStack.EMPTY;
    }
    slot.onTake(player, itemstack1);
  }
  return itemstack;
}

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

@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) {
  if (!supportsShiftClick(player, slotIndex)) {
    return ItemStack.EMPTY;
  }
  ItemStack stack = ItemStack.EMPTY;
  Slot slot = inventorySlots.get(slotIndex);
  if (slot != null && slot.getHasStack()) {
    ItemStack stackInSlot = slot.getStack();
    stack = stackInSlot.copy();
    if (!performMerge(player, slotIndex, stackInSlot)) {
      return ItemStack.EMPTY;
    }
    slot.onSlotChange(stackInSlot, stack);
    if (stackInSlot.getCount() <= 0) {
      slot.putStack(ItemStack.EMPTY);
    } else {
      slot.putStack(stackInSlot);
    }
    if (stackInSlot.getCount() == stack.getCount()) {
      return ItemStack.EMPTY;
    }
    slot.onTake(player, stackInSlot);
  }
  return stack;
}

代码示例来源:origin: JurassiCraftTeam/JurassiCraft2

slot.onSlotChange(itemstack1, stack);
} else if (index >= 26 && index < 53) {
  if (!this.mergeItemStack(itemstack1, 53, 62, false)) {

代码示例来源:origin: SonarSonic/Calculator

return ItemStack.EMPTY;
  slot.onSlotChange(itemstack1, itemstack);
} else {

代码示例来源:origin: coolAlias/Tutorial-Demo

slot.onSlotChange(itemstack1, itemstack);

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

slot.onSlotChange(itemstack1, itemstack);
} else if (index >= 17 && index < 44) {
  if (!this.mergeItemStack(itemstack1, 44, 53, false)) {

代码示例来源:origin: WayofTime/BloodMagic

slot.onSlotChange(itemstack1, itemstack);
} else if (index > 0) {

代码示例来源:origin: SonarSonic/Calculator

return ItemStack.EMPTY;
  slot.onSlotChange(itemstack1, itemstack);
} else {
  int current = this.getCurrentUsage();

代码示例来源:origin: Esteemed-Innovation/Esteemed-Innovation

slot.onSlotChange(itemstack1, itemstack);
} else if (par2 != 0 && par2 != 1) {
  if (par2 >= 3 && par2 < 39 && !this.mergeItemStack(itemstack1, 0, 2, false)) {

代码示例来源:origin: WayofTime/BloodMagic

slot.onSlotChange(itemstack1, itemstack);
} else if (index > 8) {
  if (itemstack1.getItem() instanceof IBloodOrb) {

代码示例来源:origin: WayofTime/BloodMagic

slot.onSlotChange(itemstack1, itemstack);
} else if (index > 5) {
  if (itemstack1.getItem() instanceof IDemonWill || itemstack1.getItem() instanceof IDemonWillGem) {

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

slot.onSlotChange(itemstack1, itemstack);
} else if (index != 1 && index != 0) {
 if (TileEntityFurnace.isItemFuel(itemstack1) && mergeItemStack(inv, itemstack1, 1, 2, false)) { // HL: added this case

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

slot.onSlotChange(origStack, copystack);

代码示例来源:origin: vadis365/TheErebus

if (!mergeItemStack(itemstack1, 3, 39, true))
    return ItemStack.EMPTY;
  slot.onSlotChange(itemstack1, itemstack);
} else if (slotIndex != 1 && slotIndex != 0) {
  if (!ComposterRegistry.isCompostable(itemstack1).isEmpty()) {

代码示例来源:origin: PrinceOfAmber/Cyclic

itemstack1.getItem().onCreated(itemstack1, playerIn.world, playerIn);
if (!this.mergeItemStack(itemstack1, 10, 46, true)) return ItemStack.EMPTY;
slot.onSlotChange(itemstack1, itemstack);

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

slot.onSlotChange(itemstack1, itemstack);
} else if (index != 1 && index != 0) {
  if (!itemstack1.isEmpty() && itemstack1.getItem() == ModItems.bestiary) {

代码示例来源:origin: Ellpeck/ActuallyAdditions

return StackUtil.getEmpty();
theSlot.onSlotChange(newStack, currentStack);

代码示例来源:origin: Ellpeck/ActuallyAdditions

theSlot.onSlotChange(newStack, currentStack);

相关文章