From 46c305110f850ad4cdcf9c2fb672502610751964 Mon Sep 17 00:00:00 2001 From: LudoCrypt <60561627+LudoCrypt@users.noreply.github.com> Date: Sat, 9 Dec 2023 13:23:46 -0600 Subject: [PATCH] fixed build error --- .../limlib/impl/access/TagGroupLoaderAccess.java | 6 +++--- .../limlib/impl/mixin/TagGroupLoaderMixin.java | 12 ++++++------ .../limlib/impl/mixin/TagManagerLoaderMixin.java | 3 ++- .../limlib/impl/mixin/WorldSaveStorageMixin.java | 10 +++++----- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/main/java/net/ludocrypt/limlib/impl/access/TagGroupLoaderAccess.java b/src/main/java/net/ludocrypt/limlib/impl/access/TagGroupLoaderAccess.java index 33bae5b..8e3520d 100644 --- a/src/main/java/net/ludocrypt/limlib/impl/access/TagGroupLoaderAccess.java +++ b/src/main/java/net/ludocrypt/limlib/impl/access/TagGroupLoaderAccess.java @@ -7,10 +7,10 @@ import net.minecraft.registry.Registry; import net.minecraft.registry.RegistryKey; -public interface TagGroupLoaderAccess { +public interface TagGroupLoaderAccess { - public Optional>> getRegistryKey(); + public Optional>> getRegistryKey(); - public void setRegistryKey(@Nullable RegistryKey> key); + public void setRegistryKey(@Nullable RegistryKey> key); } diff --git a/src/main/java/net/ludocrypt/limlib/impl/mixin/TagGroupLoaderMixin.java b/src/main/java/net/ludocrypt/limlib/impl/mixin/TagGroupLoaderMixin.java index 960cce2..b57d851 100644 --- a/src/main/java/net/ludocrypt/limlib/impl/mixin/TagGroupLoaderMixin.java +++ b/src/main/java/net/ludocrypt/limlib/impl/mixin/TagGroupLoaderMixin.java @@ -34,18 +34,18 @@ import net.minecraft.util.Identifier; @Mixin(TagGroupLoader.class) -public class TagGroupLoaderMixin implements TagGroupLoaderAccess { +public class TagGroupLoaderMixin implements TagGroupLoaderAccess { @Shadow @Final Function> registryGetter; @Unique - Optional>> associatedRegistryKey = Optional.empty(); + Optional>> associatedRegistryKey = Optional.empty(); @SuppressWarnings("unchecked") @Inject(method = "Lnet/minecraft/registry/tag/TagGroupLoader;loadTags(Lnet/minecraft/resource/ResourceManager;)Ljava/util/Map;", at = @At(value = "INVOKE", target = "Ljava/util/Map;computeIfAbsent(Ljava/lang/Object;Ljava/util/function/Function;)Ljava/lang/Object;", shift = Shift.BEFORE), locals = LocalCapture.CAPTURE_FAILHARD) - private void limlib$loadTags(ResourceManager manager, + private void limlib$loadTags(ResourceManager manager, CallbackInfoReturnable>> ci, Map> map, ResourceFileNamespace resourceFileNamespace, Iterator>> itr, Map.Entry> entry, @@ -53,7 +53,7 @@ public class TagGroupLoaderMixin implements TagGroupLoaderAccess { JsonElement jsonElement) { if (this.getRegistryKey().isPresent()) { - TagKey key = (TagKey) TagKey.of(this.getRegistryKey().get(), identifier2); + TagKey key = TagKey.of(this.getRegistryKey().get(), identifier2); LimlibRegistryHooks.TAG_JSON_HOOKS .getOrDefault(key, Sets.newHashSet()) .forEach((hook) -> ((LimlibJsonTagHook) hook).register(manager, key, jsonElement)); @@ -62,12 +62,12 @@ public class TagGroupLoaderMixin implements TagGroupLoaderAccess { } @Override - public Optional>> getRegistryKey() { + public Optional>> getRegistryKey() { return this.associatedRegistryKey; } @Override - public void setRegistryKey(@Nullable RegistryKey> key) { + public void setRegistryKey(@Nullable RegistryKey> key) { this.associatedRegistryKey = Optional.ofNullable(key); } diff --git a/src/main/java/net/ludocrypt/limlib/impl/mixin/TagManagerLoaderMixin.java b/src/main/java/net/ludocrypt/limlib/impl/mixin/TagManagerLoaderMixin.java index b6aad6e..578d291 100644 --- a/src/main/java/net/ludocrypt/limlib/impl/mixin/TagManagerLoaderMixin.java +++ b/src/main/java/net/ludocrypt/limlib/impl/mixin/TagManagerLoaderMixin.java @@ -21,12 +21,13 @@ @Mixin(TagManagerLoader.class) public class TagManagerLoaderMixin { + @SuppressWarnings("unchecked") @Inject(method = "Lnet/minecraft/registry/tag/TagManagerLoader;buildGroup(Lnet/minecraft/resource/ResourceManager;Ljava/util/concurrent/Executor;Lnet/minecraft/registry/DynamicRegistryManager$RegistryEntry;)Ljava/util/concurrent/CompletableFuture;", at = @At("TAIL"), locals = LocalCapture.CAPTURE_FAILHARD) private void limlib$buildGroup(ResourceManager resourceManager, Executor prepareExecutor, DynamicRegistryManager.RegistryEntry registryEntry, CallbackInfoReturnable>> ci, RegistryKey> registryKey, Registry registry, TagGroupLoader> tagGroupLoader) { - ((TagGroupLoaderAccess) tagGroupLoader).setRegistryKey(registryKey); + ((TagGroupLoaderAccess) tagGroupLoader).setRegistryKey(registryKey); } } diff --git a/src/main/java/net/ludocrypt/limlib/impl/mixin/WorldSaveStorageMixin.java b/src/main/java/net/ludocrypt/limlib/impl/mixin/WorldSaveStorageMixin.java index 886628d..c2c8d8b 100644 --- a/src/main/java/net/ludocrypt/limlib/impl/mixin/WorldSaveStorageMixin.java +++ b/src/main/java/net/ludocrypt/limlib/impl/mixin/WorldSaveStorageMixin.java @@ -26,15 +26,15 @@ @Mixin(WorldSaveStorage.class) public class WorldSaveStorageMixin { - @ModifyVariable(method = "Lnet/minecraft/world/storage/WorldSaveStorage;method_54523(Lcom/mojang/serialization/Dynamic;Lnet/minecraft/server/world/FeatureAndDataSettings;Lnet/minecraft/registry/Registry;Lnet/minecraft/registry/DynamicRegistryManager$Frozen;)Lnet/minecraft/unmapped/C_qhzfxdhh;", at = @At(value = "STORE"), ordinal = 1) + @ModifyVariable(method = "Lnet/minecraft/world/storage/WorldSaveStorage;method_54523(Lcom/mojang/serialization/Dynamic;Lnet/minecraft/server/world/FeatureAndDataSettings;Lnet/minecraft/registry/Registry;Lnet/minecraft/registry/DynamicRegistryManager$Frozen;)Lnet/minecraft/unmapped/C_qhzfxdhh;", at = @At(value = "STORE"), ordinal = 2) private static Dynamic limlib$readGeneratorProperties$datafix(Dynamic in, Dynamic levelData, FeatureAndDataSettings featureAndDataSettings, Registry registry, DynamicRegistryManager.Frozen frozen) { Dynamic dynamic = in; -// for (Entry, LimlibWorld> entry : LimlibWorld.LIMLIB_WORLD.getEntries()) { -// dynamic = limlib$addDimension(entry.getKey(), entry.getValue(), dynamic, frozen); -// } + for (Entry, LimlibWorld> entry : LimlibWorld.LIMLIB_WORLD.getEntries()) { + dynamic = limlib$addDimension(entry.getKey(), entry.getValue(), dynamic, frozen); + } return dynamic; } @@ -63,7 +63,7 @@ public HolderProvider get(RegistryKey> key) { })) .result() .get())); - in = in.set("dimensions", in.createMap(dimensionsMap)); + return in.set("dimensions", in.createMap(dimensionsMap)); } return in;