Skip to content

Commit

Permalink
fix: fix item group name not displayed
Browse files Browse the repository at this point in the history
  • Loading branch information
ybw0014 committed May 2, 2024
1 parent f833e43 commit 99dd8be
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public final class FastMachineCache {
private Map<IRecipe, Integer> outputs;
private int page = -1;
private ItemStack choice;
private boolean crafting = false;

@ParametersAreNonnullByDefault
public FastMachineCache(AbstractFastMachine machine, BlockMenu menu) {
Expand Down Expand Up @@ -80,7 +81,12 @@ private void init() {
amount = 1;
}
}
if (crafting) {
return false;
}
crafting = true;
craft(player, amount);
crafting = false;
return false;
});
}
Expand All @@ -99,16 +105,15 @@ public void tick() {
*/
private void findAvailableOutputs() {
Map<ItemStack, Integer> machineInputs = MachineUtils.getMachineInputAmount(menu, INPUT_SLOTS);
if (machineInputs.isEmpty()) {
return;
}
int currentInputChecksum = MachineUtils.checksum(machineInputs);
if (currentInputChecksum == inputChecksum) {
return;
}
inputChecksum = currentInputChecksum;
outputs = new LinkedHashMap<>();

if (machineInputs.isEmpty()) {
return;
}
Map<IRecipe, Integer> newOutputs = new LinkedHashMap<>();

FastMachines.debug("current machine: {0}, location: {1}", machine.getClass().getSimpleName(), blockPosition);
FastMachines.debug("machine inputs: {0}", machineInputs);
Expand Down Expand Up @@ -147,11 +152,12 @@ private void findAvailableOutputs() {
// this recipe is available
if (outputAmount > 0) {
FastMachines.debug("recipe is available, output amount: {0}", outputAmount);
outputs.put(recipe, outputAmount);
newOutputs.put(recipe, outputAmount);
}
}

FastMachines.debug("outputs: " + outputs);
FastMachines.debug("outputs: " + newOutputs);
outputs = newOutputs;
}

private void updateMenu() {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/guizhanss/fastmachines/setup/Groups.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public final class Groups {
public static final SubItemGroup MATERIALS = new SubItemGroup(
Keys.get("materials"),
MAIN,
FastMachines.getLocalization().getItemGroupItem(
FastMachines.getLocalization().getItem(
"MATERIALS",
Material.DIAMOND
)
Expand All @@ -33,7 +33,7 @@ public final class Groups {
public static final SubItemGroup MACHINES = new SubItemGroup(
Keys.get("machines"),
MAIN,
FastMachines.getLocalization().getItemGroupItem(
FastMachines.getLocalization().getItem(
"MACHINES",
Heads.MAIN.getTexture()
)
Expand Down

0 comments on commit 99dd8be

Please sign in to comment.