|
1 | 1 | package com.gregtechceu.gtceu.api.capability.recipe; |
2 | 2 |
|
3 | | -import com.gregtechceu.gtceu.GTCEu; |
4 | 3 | import com.gregtechceu.gtceu.api.machine.trait.RecipeHandlerList; |
5 | 4 |
|
6 | 5 | import it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap; |
|
10 | 9 | import java.util.Collections; |
11 | 10 | import java.util.List; |
12 | 11 | import java.util.Map; |
13 | | -import java.util.stream.Collectors; |
14 | 12 |
|
15 | 13 | public interface IRecipeCapabilityHolder { |
16 | 14 |
|
@@ -39,20 +37,6 @@ default List<IRecipeHandler<?>> getCapabilitiesFlat(IO io, RecipeCapability<?> c |
39 | 37 | default void addHandlerList(RecipeHandlerList handlerList) { |
40 | 38 | if (handlerList == RecipeHandlerList.NO_DATA) return; |
41 | 39 | IO io = handlerList.getHandlerIO(); |
42 | | - |
43 | | - var existingHandlers = getCapabilitiesProxy().getOrDefault(io, Collections.emptyList()).stream() |
44 | | - .flatMap(tempHandlerList -> tempHandlerList.getHandlersFlat().stream()) |
45 | | - .collect(Collectors.toSet()); |
46 | | - |
47 | | - for (var handler : handlerList.getHandlersFlat()) { |
48 | | - if (existingHandlers.contains(handler)) { |
49 | | - GTCEu.LOGGER.error("Do not add the same handler twice, as this could cause duplication bugs! " + |
50 | | - "Handler {} in List {}", |
51 | | - handler.getClass().getName(), |
52 | | - handlerList.getClass().getName()); |
53 | | - } |
54 | | - } |
55 | | - |
56 | 40 | getCapabilitiesProxy().computeIfAbsent(io, i -> new ArrayList<>()).add(handlerList); |
57 | 41 | var entrySet = handlerList.getHandlerMap().entrySet(); |
58 | 42 | var inner = getCapabilitiesFlat().computeIfAbsent(io, i -> new Reference2ObjectOpenHashMap<>(entrySet.size())); |
|
0 commit comments