Class Swap
java.lang.Object
com.hammy275.immersivemc.server.swap.Swap
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleandoEnchanting(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.ItemStackgetRecipeOutput(net.minecraft.server.level.ServerPlayer player, net.minecraft.world.item.ItemStack[] stacksIn) static net.minecraft.world.item.ItemStackgetSmithingTableOutput(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 booleanhandleAnvilCraft(AnvilStorage storage, net.minecraft.core.BlockPos pos, net.minecraft.server.level.ServerPlayer player, net.minecraft.world.InteractionHand hand) static voidhandleBackpackCraftingSwap(int slot, net.minecraft.world.InteractionHand hand, List<net.minecraft.world.item.ItemStack> items, net.minecraft.server.level.ServerPlayer player, ItemSwapAmount amount) static voidhandleChest(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 voidhandleEnderChest(net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand, int slot) static voidhandleInventorySwap(net.minecraft.world.entity.player.Player player, int slot, net.minecraft.world.InteractionHand hand) static booleanhandleSmithingTableCraft(SmithingTableStorage storage, net.minecraft.core.BlockPos pos, net.minecraft.server.level.ServerPlayer player, net.minecraft.world.InteractionHand hand) static booleanitemStackArraysMatchBesidesCount(net.minecraft.world.item.ItemStack[] a, net.minecraft.world.item.ItemStack[] b, int numElements) static SwapResultswapItems(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.
-
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 forImmersiveLogicHelpers.swapItems(ItemStack, ItemStack, ItemSwapAmount, Player), but also has callbacks for incrementing or clearing the item counts for the purposes ofItemStorage. See the above-mentioned method for details of this method.- Parameters:
itemCountIncrementer- Callback to run when the amount of items in this Immersive is increaseditemCountClearer- 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)
-