FIX: Use correct priority increment amounts (#192)

Adds an overridable method to FCGuiAmount to allow subclasses to specify
increment values other than the default.

AE2 has config values to set how much each button in the priority screen
should increment a fluid storage bus's (or other's) priorty by. Prior to this
change, the priority interface on fluid storage bus' were using the
increment values for crafting, instead of those for priority.
This commit is contained in:
Michael Doyle authored and GitHub committed 2024-02-28 20:16:50 -06:00
1 parent 3e6ea173fc
commit 5cc8488928
2 files changed
+15 -4

No files matched your search

@@ -11,6 +11,7 @@ import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.loader.ItemAndBlockHolder;
import appeng.container.implementations.ContainerPriority;
import appeng.core.AEConfig;
import appeng.core.AELog;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
@@ -34,6 +35,11 @@ public class GuiFCPriority extends FCGuiAmount {
((ContainerPriority) this.inventorySlots).setTextField(this.amountBox);
}
@Override
protected int getIncrementQuantity(int i) {
return AEConfig.instance.priorityByStacksAmounts(i);
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.fontRendererObj.drawString(GuiText.Priority.getLocal(), 8, 6, 0x404040);
@@ -42,10 +42,11 @@ public abstract class FCGuiAmount extends AEBaseGui {
@SuppressWarnings("unchecked")
public void initGui() {
super.initGui();
final int a = AEConfig.instance.craftItemsByStackAmounts(0);
final int b = AEConfig.instance.craftItemsByStackAmounts(1);
final int c = AEConfig.instance.craftItemsByStackAmounts(2);
final int d = AEConfig.instance.craftItemsByStackAmounts(3);
final int a = getIncrementQuantity(0);
final int b = getIncrementQuantity(1);
final int c = getIncrementQuantity(2);
final int d = getIncrementQuantity(3);
this.buttonList.add(this.plus1 = new GuiButton(0, this.guiLeft + 20, this.guiTop + 26, 22, 20, "+" + a));
this.buttonList.add(this.plus10 = new GuiButton(0, this.guiLeft + 48, this.guiTop + 26, 28, 20, "+" + b));
@@ -85,6 +86,10 @@ public abstract class FCGuiAmount extends AEBaseGui {
this.amountBox.setFocused(true);
}
protected int getIncrementQuantity(int i) {
return AEConfig.instance.craftItemsByStackAmounts(i);
}
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.bindTexture(getBackground());