Skip to content

Commit

Permalink
fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
brachy84 committed Jun 10, 2024
1 parent cdf8c86 commit 0fe1583
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.cleanroommc.groovyscript.api.IObjectParser;
import com.cleanroommc.groovyscript.api.Result;
import com.cleanroommc.groovyscript.compat.mods.GroovyContainer;
import com.cleanroommc.groovyscript.compat.mods.ModPropertyContainer;
import com.cleanroommc.groovyscript.compat.mods.GroovyPropertyContainer;
import com.cleanroommc.groovyscript.core.mixin.CreativeTabsAccessor;
import com.cleanroommc.groovyscript.core.mixin.OreDictionaryAccessor;
import com.cleanroommc.groovyscript.helper.ingredient.OreDictIngredient;
Expand Down Expand Up @@ -38,7 +38,7 @@ public class ObjectMapperManager {

private static final Map<String, ObjectMapper<?>> handlers = new Object2ObjectOpenHashMap<>();
private static final Map<String, List<ObjectMapper<?>>> handlerConflicts = new Object2ObjectOpenHashMap<>();
private static final Map<Class<? extends ModPropertyContainer>, Map<String, ObjectMapper<?>>> modHandlers = new Object2ObjectOpenHashMap<>();
private static final Map<Class<? extends GroovyPropertyContainer>, Map<String, ObjectMapper<?>>> modHandlers = new Object2ObjectOpenHashMap<>();
public static final String EMPTY = "empty";
public static final String WILDCARD = "*";
public static final String SPLITTER = ":";
Expand All @@ -62,7 +62,7 @@ static void registerObjectMapper(GroovyContainer<?> container, ObjectMapper<?> g
handlers.put(key, goh);
}
if (container != null) {
ModPropertyContainer propertyContainer = container.get();
GroovyPropertyContainer propertyContainer = container.get();
var map = modHandlers.computeIfAbsent(propertyContainer.getClass(), k -> new Object2ObjectOpenHashMap<>());
if (map.containsKey(key)) {
throw new IllegalStateException("There already is a ObjectMapper with name '" + key + "' in mod " + container.getContainerName());
Expand Down Expand Up @@ -194,7 +194,7 @@ public static List<ObjectMapper<?>> getConflicts(String key) {
}

public static ObjectMapper<?> getObjectMapper(Class<?> containerClass, String key) {
if (!ModPropertyContainer.class.isAssignableFrom(containerClass)) return null;
if (!GroovyPropertyContainer.class.isAssignableFrom(containerClass)) return null;
var map = modHandlers.get(containerClass);
return map != null ? map.get(key) : null;
}
Expand Down

0 comments on commit 0fe1583

Please sign in to comment.