Skip to content

Commit

Permalink
Add config
Browse files Browse the repository at this point in the history
  • Loading branch information
shartte committed Dec 8, 2024
1 parent c5e59b8 commit 4c7f91b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/java/appeng/core/AEConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,10 @@ public boolean isEnableFacadeRecipesInRecipeViewer() {
return client.enableFacadeRecipesInRecipeViewer.getAsBoolean();
}

public boolean isExposeNetworkInventoryToEmi() {
return client.exposeNetworkInventoryToEmi.getAsBoolean();
}

public int getCraftingCalculationTimePerTick() {
return common.craftingCalculationTimePerTick.get();
}
Expand Down Expand Up @@ -424,6 +428,7 @@ private static class ClientConfig {
public final BooleanValue disableColoredCableRecipesInRecipeViewer;
public final BooleanValue enableFacadesInRecipeViewer;
public final BooleanValue enableFacadeRecipesInRecipeViewer;
public final BooleanValue exposeNetworkInventoryToEmi;
public final EnumValue<PowerUnit> selectedPowerUnit;
public final BooleanValue debugGuiOverlays;
public final BooleanValue showPlacementPreview;
Expand Down Expand Up @@ -458,6 +463,8 @@ public ClientConfig() {
"Show facades in REI/JEI/EMI item list");
this.enableFacadeRecipesInRecipeViewer = define(builder, "enableFacadeRecipesInRecipeViewer", true,
"Show facade recipes in REI/JEI/EMI for supported blocks");
this.exposeNetworkInventoryToEmi = define(builder, "provideNetworkInventoryToEmi", false,
"Expose the full network inventory to EMI, which might cause performance problems.");
builder.pop();

builder.push("client");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

import appeng.api.stacks.AEKey;
import appeng.api.stacks.GenericStack;
import appeng.core.AEConfig;
import appeng.integration.modules.itemlists.EncodingHelper;
import appeng.integration.modules.itemlists.TransferHelper;
import appeng.menu.AEBaseMenu;
Expand Down Expand Up @@ -75,6 +76,10 @@ public List<Slot> getCraftingSlots(T menu) {

@Override
public EmiPlayerInventory getInventory(AbstractContainerScreen<T> screen) {
if (!AEConfig.instance().isExposeNetworkInventoryToEmi()) {
return StandardRecipeHandler.super.getInventory(screen);
}

var list = new ArrayList<EmiStack>();

for (Slot slot : getInputSources(screen.getMenu())) {
Expand All @@ -86,6 +91,9 @@ public EmiPlayerInventory getInventory(AbstractContainerScreen<T> screen) {

if (repo != null) {
for (var entry : repo.getAllEntries()) {
if (entry.getStoredAmount() <= 0) {
continue; // Skip items that are only craftable
}
list.add(EmiStackHelper.toEmiStack(new GenericStack(entry.getWhat(), entry.getStoredAmount())));
}
}
Expand Down

0 comments on commit 4c7f91b

Please sign in to comment.