Skip to content

Commit

Permalink
Add option to restrict inscriber input slot stack size (#7462)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sea-Kerman authored Nov 10, 2023
1 parent 0184529 commit 28687a4
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 2 deletions.
10 changes: 8 additions & 2 deletions guidebook/items-blocks-machines/inscriber.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ It can accept either AE2's power (AE) or Fabric/Forge Energy (E/FE). It can be s
inserts them into different slots in its inventory. To facilitate this, it can be rotated with a <ItemLink id="certus_quartz_wrench" />.
It can also be set to push the results of crafts to adjacent inventories.

The size of the input buffer can be adjusted. For example, if you want to feed from one inventory into a big array of inscribers,
you want a small buffer so that the materials are distributed between the inscribers more optimally (instead of the first
inscriber filling up to 64 and the rest being empty).

The 4 circuit presses are used to craft [processors](processors.md)

<Row>
Expand All @@ -37,9 +41,11 @@ While the name press can be used to name blocks similar to an anvil, useful for

## Settings

* The inscriber can be set to be sided (as explained below) or allow inputs to any slot from any side, with an internal filter deciding
* The inscriber can be set to be sided (as explained below) or allow inputs to any slot from any side, with an internal filter deciding
what goes where. While in non-sided mode, items cannot be extracted from the top and bottom slots.
* The inscriber can be set to push items into adjacent inventories.
* The inscriber can be set to push items into adjacent inventories.
* The size of the input buffer can be adjusted, the large option is for a standalone inscriber you feed manually, the
small option is to make large parallelized setups more viable.

## The GUI And Sidedness

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/appeng/api/config/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ private synchronized static <T extends Enum<T>> Setting<T> register(String name,
YesNo.YES);
public static final Setting<YesNo> AUTO_EXPORT = register("auto_export", YesNo.NO, YesNo.YES);

public static final Setting<YesNo> INSCRIBER_BUFFER_SIZE = register("inscriber_buffer_size", YesNo.NO, YesNo.YES);

public static Setting<?> getOrThrow(String name) {
var setting = SETTINGS.get(name);
if (setting == null) {
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/appeng/blockentity/misc/InscriberBlockEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ public InscriberBlockEntity(BlockEntityType<?> blockEntityType, BlockPos pos, Bl
this.configManager = new ConfigManager(this::onConfigChanged);
this.configManager.registerSetting(Settings.INSCRIBER_SEPARATE_SIDES, YesNo.NO);
this.configManager.registerSetting(Settings.AUTO_EXPORT, YesNo.NO);
this.configManager.registerSetting(Settings.INSCRIBER_BUFFER_SIZE, YesNo.YES);

var automationFilter = new AutomationFilter();
this.topItemHandlerExtern = new FilteredInternalInventory(this.topItemHandler, automationFilter);
Expand Down Expand Up @@ -458,6 +459,18 @@ private void onConfigChanged(IConfigManager manager, Setting<?> setting) {
markForUpdate();
}

if (setting == Settings.INSCRIBER_BUFFER_SIZE) {
if (configManager.getSetting(Settings.INSCRIBER_BUFFER_SIZE) == YesNo.YES) {
topItemHandler.setMaxStackSize(0, 64);
sideItemHandler.setMaxStackSize(0, 64);
bottomItemHandler.setMaxStackSize(0, 64);
} else {
topItemHandler.setMaxStackSize(0, 4);
sideItemHandler.setMaxStackSize(0, 4);
bottomItemHandler.setMaxStackSize(0, 4);
}
}

saveChanges();
}

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/appeng/client/gui/Icon.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ public enum Icon {
INSCRIBER_COMBINED_SIDES(96, 96),
AUTO_EXPORT_OFF(112, 96),
AUTO_EXPORT_ON(128, 96),
INSCRIBER_BUFFER_LOW(144, 96),
INSCRIBER_BUFFER_HIGH(160, 96),
BACKGROUND_WIRELESS_BOOSTER(240, 96),

// ROW 7
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class InscriberScreen extends UpgradeableScreen<InscriberMenu> {
private final ProgressBar pb;
private final SettingToggleButton<YesNo> separateSidesBtn;
private final SettingToggleButton<YesNo> autoExportBtn;
private final SettingToggleButton<YesNo> bufferSizeBtn;

public InscriberScreen(InscriberMenu menu, Inventory playerInventory, Component title,
ScreenStyle style) {
Expand All @@ -48,6 +49,9 @@ public InscriberScreen(InscriberMenu menu, Inventory playerInventory, Component

this.autoExportBtn = new ServerSettingToggleButton<>(Settings.AUTO_EXPORT, YesNo.NO);
this.addToLeftToolbar(autoExportBtn);

this.bufferSizeBtn = new ServerSettingToggleButton<>(Settings.INSCRIBER_BUFFER_SIZE, YesNo.YES);
this.addToLeftToolbar(bufferSizeBtn);
}

@Override
Expand All @@ -59,5 +63,6 @@ protected void updateBeforeRender() {

this.separateSidesBtn.set(getMenu().getSeparateSides());
this.autoExportBtn.set(getMenu().getAutoExport());
this.bufferSizeBtn.set(getMenu().getBufferSize());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,13 @@ public SettingToggleButton(Setting<T> setting, T val, Predicate<T> isValidValue,
registerApp(Icon.AUTO_EXPORT_OFF, Settings.AUTO_EXPORT, YesNo.NO,
ButtonToolTips.AutoExport,
ButtonToolTips.AutoExportOff);

registerApp(Icon.INSCRIBER_BUFFER_HIGH, Settings.INSCRIBER_BUFFER_SIZE, YesNo.YES,
ButtonToolTips.InscriberBufferSize,
ButtonToolTips.InscriberBufferHigh);
registerApp(Icon.INSCRIBER_BUFFER_LOW, Settings.INSCRIBER_BUFFER_SIZE, YesNo.NO,
ButtonToolTips.InscriberBufferSize,
ButtonToolTips.InscriberBufferLow);
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/appeng/core/localization/ButtonToolTips.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ public enum ButtonToolTips implements LocalizationEnum {
"Try to use fluids instead of items.\nSubstitutable ingredients are marked in green."),
FuzzyMode("Fuzzy Comparison"),
IOMode("Input/Output Mode"),
InscriberBufferSize("Input Slot Stack Size"),
InscriberBufferLow("Stack to 4"),
InscriberBufferHigh("Stack to 64"),
InscriberSideness("Automation Access Mode"),
InscriberSidenessCombined("Automation can access any slot from any side. Input slots cannot be extracted from."),
InscriberSidenessSeparate(
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/appeng/menu/implementations/InscriberMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public class InscriberMenu extends UpgradeableMenu<InscriberBlockEntity> impleme
public YesNo separateSides = YesNo.NO;
@GuiSync(8)
public YesNo autoExport = YesNo.NO;
@GuiSync(9)
public YesNo bufferSize = YesNo.YES;

public InscriberMenu(int id, Inventory ip, InscriberBlockEntity host) {
super(TYPE, id, ip, host);
Expand Down Expand Up @@ -98,6 +100,7 @@ public InscriberMenu(int id, Inventory ip, InscriberBlockEntity host) {
protected void loadSettingsFromHost(IConfigManager cm) {
this.separateSides = getHost().getConfigManager().getSetting(Settings.INSCRIBER_SEPARATE_SIDES);
this.autoExport = getHost().getConfigManager().getSetting(Settings.AUTO_EXPORT);
this.bufferSize = getHost().getConfigManager().getSetting(Settings.INSCRIBER_BUFFER_SIZE);
}

@Override
Expand Down Expand Up @@ -159,4 +162,8 @@ public YesNo getSeparateSides() {
public YesNo getAutoExport() {
return autoExport;
}

public YesNo getBufferSize() {
return bufferSize;
}
}
Binary file modified src/main/resources/assets/ae2/textures/guis/states.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 28687a4

Please sign in to comment.