Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix duplicate assembly line research entries #2584

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/gregtech/api/recipes/RecipeMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ public boolean removeRecipe(@NotNull Recipe recipe) {
* @see GTRecipeHandler#removeAllRecipes(RecipeMap)
*/
@ApiStatus.Internal
void removeAllRecipes() {
protected void removeAllRecipes() {
if (GroovyScriptModule.isCurrentlyRunning()) {
this.lookup.getRecipes(false).forEach(this.getGroovyScriptRecipeMap()::addBackup);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ public boolean removeRecipe(@NotNull Recipe recipe) {
return true;
}

@Override
protected void removeAllRecipes() {
super.removeAllRecipes();
researchEntries.clear();
}

@Override
public void addDataStickEntry(@NotNull String researchId, @NotNull Recipe recipe) {
if (researchId.contains("xmetaitem.")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
import gregtech.api.recipes.RecipeMaps;
import gregtech.api.recipes.machines.IResearchRecipeMap;
import gregtech.api.util.AssemblyLineManager;
import gregtech.api.util.ItemStackHashStrategy;

import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;

import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet;
import org.jetbrains.annotations.NotNull;

import java.util.Collection;
Expand Down Expand Up @@ -41,7 +42,7 @@ public void addInformation(@NotNull ItemStack itemStack, List<String> lines) {
.getDataStickEntry(researchId);
if (recipes != null && !recipes.isEmpty()) {
lines.add(I18n.format("behavior.data_item.assemblyline.title"));
Collection<ItemStack> added = new ObjectOpenHashSet<>();
Collection<ItemStack> added = new ObjectOpenCustomHashSet<>(ItemStackHashStrategy.comparingAllButCount());
for (Recipe recipe : recipes) {
ItemStack output = recipe.getOutputs().get(0);
if (added.add(output)) {
Expand Down