Skip to content

Commit

Permalink
Allow configuring inventory transfer target slot count
Browse files Browse the repository at this point in the history
  • Loading branch information
Vazkii committed Feb 2, 2024
1 parent 96584d2 commit 9a8194c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ public class QuarkGeneralConfig {

@Config(description = "Set to false to disable the popup message telling you that you can config quark in the q menu")
public static boolean enableOnboarding = true;

@Config(description = "The amount of slots the chest button system should seek when trying to figure out if a container should be eligible for them.")
public static int chestButtonSlotTarget = 27;

private QuarkGeneralConfig() {
// NO-OP
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
package org.violetmoon.quark.base.handler;

import java.util.ArrayList;
import java.util.List;
import java.util.function.BiPredicate;

import org.apache.commons.lang3.tuple.Pair;
import org.jetbrains.annotations.NotNull;
import org.violetmoon.quark.api.IQuarkButtonAllowed;
import org.violetmoon.quark.api.ITransferManager;
import org.violetmoon.quark.api.QuarkCapabilities;
import org.violetmoon.quark.base.Quark;
import org.violetmoon.quark.base.config.QuarkGeneralConfig;
import org.violetmoon.quark.content.management.module.EasyTransferingModule;

import net.minecraft.world.Container;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player;
Expand All @@ -12,19 +25,6 @@
import net.minecraftforge.items.SlotItemHandler;
import net.minecraftforge.items.wrapper.InvWrapper;

import org.apache.commons.lang3.tuple.Pair;
import org.jetbrains.annotations.NotNull;

import org.violetmoon.quark.api.IQuarkButtonAllowed;
import org.violetmoon.quark.api.ITransferManager;
import org.violetmoon.quark.api.QuarkCapabilities;
import org.violetmoon.quark.base.Quark;
import org.violetmoon.quark.content.management.module.EasyTransferingModule;

import java.util.ArrayList;
import java.util.List;
import java.util.function.BiPredicate;

public class InventoryTransferHandler {

public static void transfer(Player player, boolean isRestock, boolean smart) {
Expand Down Expand Up @@ -81,7 +81,7 @@ public static boolean accepts(AbstractContainerMenu container, Player player) {
if(hasProvider(container))
return getProvider(container).acceptsTransfer(player);

return container instanceof IQuarkButtonAllowed || (container.slots.size() - player.getInventory().items.size() >= 27);
return container instanceof IQuarkButtonAllowed || (container.slots.size() - player.getInventory().items.size() >= QuarkGeneralConfig.chestButtonSlotTarget);
}

public static class Transfer {
Expand Down

0 comments on commit 9a8194c

Please sign in to comment.