Skip to content

Commit

Permalink
Fix serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
emilyploszaj committed Aug 8, 2024
1 parent 7e446bc commit 0fc9a1a
Showing 1 changed file with 0 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package dev.emi.emi.api.stack.serializer;

import com.mojang.serialization.DynamicOps;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

Expand All @@ -22,16 +21,6 @@ public interface EmiStackSerializer<T extends EmiStack> extends EmiIngredientSer

EmiStack create(Identifier id, NbtCompound nbt, long amount);

private static <T> DynamicOps<T> withRegistryAccess(DynamicOps<T> ops) {
MinecraftClient instance = MinecraftClient.getInstance();
if (instance == null || instance.world == null) {
//Note: instance can be null in datagen, just fall back to a variant that doesn't have registry access
// as in the majority of cases this will work fine
return ops;
}
return instance.world.getRegistryManager().getOps(ops);
}

@Override
default EmiIngredient deserialize(JsonElement element) {
Identifier id = null;
Expand Down

0 comments on commit 0fc9a1a

Please sign in to comment.