Skip to content

Commit

Permalink
Fixed startup crash with sugar block
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDarkDnKTv committed Aug 1, 2023
1 parent 537345e commit d93bade
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/main/java/gregtechmod/api/util/GT_RecipeRegistrator.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@
import gregtechmod.common.RecipeHandler.IRecipeMatcher;
import gregtechmod.common.RecipeHandler.InventoryRecipeMatcher;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.*;
import java.util.stream.Collectors;

import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
Expand Down Expand Up @@ -201,10 +198,18 @@ public static void registerBlockForcibly(OrePrefixes aPrefix, Materials aMateria
for (ItemStack a : unifiedStacks) {
ItemStack block = aMaterial.mSmallBlock ? GT_ModHandler.getRecipeOutput(a, a, null, a, a, null) : GT_ModHandler.getRecipeOutput(a, a, a, a, a, a, a, a, a);
if (block != null) {
Optional<String> optional = Arrays.stream(OreDictionary.getOreIDs(block))
.mapToObj(i -> OreDictionary.getOreName(i))
Set<String> names = Arrays.stream(OreDictionary.getOreIDs(block))
.mapToObj(OreDictionary::getOreName)
.collect(Collectors.toSet());

if (names.contains(aPrefix.get(aMaterial))) {
return;
}

Optional<String> optional = names.stream()
.filter(name -> name.startsWith(OrePrefixes.block.toString()))
.findAny();

if (!optional.isPresent() && !GregTech_API.sUnification.get(GT_ConfigCategories.forceoredict, block, dictName).equals("false")) {
GT_OreDictUnificator.set(dictName, block);
}
Expand Down

0 comments on commit d93bade

Please sign in to comment.