java.lang.Object
com.hammy275.immersivemc.server.swap.Swap

public class Swap extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    doEnchanting(int slot, net.minecraft.core.BlockPos pos, net.minecraft.server.level.ServerPlayer player, net.minecraft.world.InteractionHand hand)
     
    static com.mojang.datafixers.util.Pair<net.minecraft.world.item.ItemStack,Integer>
    getAnvilOutput(net.minecraft.world.item.ItemStack left, net.minecraft.world.item.ItemStack mid, net.minecraft.server.level.ServerPlayer player)
     
    static net.minecraft.world.item.ItemStack
    getRecipeOutput(net.minecraft.server.level.ServerPlayer player, net.minecraft.world.item.ItemStack[] stacksIn)
     
    static net.minecraft.world.item.ItemStack
    getSmithingTableOutput(net.minecraft.world.item.ItemStack left, net.minecraft.world.item.ItemStack mid, net.minecraft.world.item.ItemStack right, net.minecraft.server.level.ServerPlayer player)
     
    static boolean
    handleAnvilCraft(AnvilStorage storage, net.minecraft.core.BlockPos pos, net.minecraft.server.level.ServerPlayer player, net.minecraft.world.InteractionHand hand)
     
    static void
    handleBackpackCraftingSwap(int slot, net.minecraft.world.InteractionHand hand, List<net.minecraft.world.item.ItemStack> items, net.minecraft.server.level.ServerPlayer player, ItemSwapAmount amount)
     
    static void
    handleChest(net.minecraft.world.level.block.entity.ChestBlockEntity chestIn, net.minecraft.server.level.ServerPlayer player, net.minecraft.world.InteractionHand hand, int slot)
     
    static @Nullable net.minecraft.world.item.ItemStack[]
    handleDoCraft(net.minecraft.server.level.ServerPlayer player, net.minecraft.world.item.ItemStack[] stacksIn, net.minecraft.core.BlockPos tablePos, ItemSwapAmount amount)
     
    static void
    handleEnderChest(net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand, int slot)
     
    static void
    handleInventorySwap(net.minecraft.world.entity.player.Player player, int slot, net.minecraft.world.InteractionHand hand)
     
    static boolean
    handleSmithingTableCraft(SmithingTableStorage storage, net.minecraft.core.BlockPos pos, net.minecraft.server.level.ServerPlayer player, net.minecraft.world.InteractionHand hand)
     
    static boolean
    itemStackArraysMatchBesidesCount(net.minecraft.world.item.ItemStack[] a, net.minecraft.world.item.ItemStack[] b, int numElements)
     
    static SwapResult
    swapItems(net.minecraft.world.item.ItemStack handStack, net.minecraft.world.item.ItemStack immersiveStack, ItemSwapAmount swapAmount, int forcedMaxImmersiveStackSize, net.minecraft.world.entity.player.Player player, @Nullable Consumer<Integer> itemCountIncrementer, @Nullable Consumer<Void> itemCountClearer)
    Swap items.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Swap

      public Swap()
  • Method Details

    • swapItems

      public static SwapResult swapItems(net.minecraft.world.item.ItemStack handStack, net.minecraft.world.item.ItemStack immersiveStack, ItemSwapAmount swapAmount, int forcedMaxImmersiveStackSize, net.minecraft.world.entity.player.Player player, @Nullable @Nullable Consumer<Integer> itemCountIncrementer, @Nullable @Nullable Consumer<Void> itemCountClearer)
      Swap items. This is the logic for ImmersiveLogicHelpers.swapItems(ItemStack, ItemStack, ItemSwapAmount, Player), but also has callbacks for incrementing or clearing the item counts for the purposes of ItemStorage. See the above-mentioned method for details of this method.
      Parameters:
      itemCountIncrementer - Callback to run when the amount of items in this Immersive is increased
      itemCountClearer - Callback to run when the amount of items in this Immersive is decreased
    • doEnchanting

      public static boolean doEnchanting(int slot, net.minecraft.core.BlockPos pos, net.minecraft.server.level.ServerPlayer player, net.minecraft.world.InteractionHand hand)
    • handleBackpackCraftingSwap

      public static void handleBackpackCraftingSwap(int slot, net.minecraft.world.InteractionHand hand, List<net.minecraft.world.item.ItemStack> items, net.minecraft.server.level.ServerPlayer player, ItemSwapAmount amount)
    • handleAnvilCraft

      public static boolean handleAnvilCraft(AnvilStorage storage, net.minecraft.core.BlockPos pos, net.minecraft.server.level.ServerPlayer player, net.minecraft.world.InteractionHand hand)
    • handleSmithingTableCraft

      public static boolean handleSmithingTableCraft(SmithingTableStorage storage, net.minecraft.core.BlockPos pos, net.minecraft.server.level.ServerPlayer player, net.minecraft.world.InteractionHand hand)
    • getRecipeOutput

      public static net.minecraft.world.item.ItemStack getRecipeOutput(net.minecraft.server.level.ServerPlayer player, net.minecraft.world.item.ItemStack[] stacksIn)
    • handleDoCraft

      @Nullable public static @Nullable net.minecraft.world.item.ItemStack[] handleDoCraft(net.minecraft.server.level.ServerPlayer player, net.minecraft.world.item.ItemStack[] stacksIn, net.minecraft.core.BlockPos tablePos, ItemSwapAmount amount)
    • handleInventorySwap

      public static void handleInventorySwap(net.minecraft.world.entity.player.Player player, int slot, net.minecraft.world.InteractionHand hand)
    • handleChest

      public static void handleChest(net.minecraft.world.level.block.entity.ChestBlockEntity chestIn, net.minecraft.server.level.ServerPlayer player, net.minecraft.world.InteractionHand hand, int slot)
    • handleEnderChest

      public static void handleEnderChest(net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand, int slot)
    • getAnvilOutput

      public static com.mojang.datafixers.util.Pair<net.minecraft.world.item.ItemStack,Integer> getAnvilOutput(net.minecraft.world.item.ItemStack left, net.minecraft.world.item.ItemStack mid, net.minecraft.server.level.ServerPlayer player)
    • getSmithingTableOutput

      public static net.minecraft.world.item.ItemStack getSmithingTableOutput(net.minecraft.world.item.ItemStack left, net.minecraft.world.item.ItemStack mid, net.minecraft.world.item.ItemStack right, net.minecraft.server.level.ServerPlayer player)
    • itemStackArraysMatchBesidesCount

      public static boolean itemStackArraysMatchBesidesCount(net.minecraft.world.item.ItemStack[] a, net.minecraft.world.item.ItemStack[] b, int numElements)