Skip to content

Commit

Permalink
Fix Sponge client registry rework related changes
Browse files Browse the repository at this point in the history
  • Loading branch information
aromaa committed Mar 9, 2025
1 parent 46f542b commit 9f2a749
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public void freezeSpongeDynamicRegistries(final boolean force) {
final net.minecraft.core.Registry<net.minecraft.core.Registry<?>> registry = this.roots.get(RegistryRoots.SPONGE);
registry.stream()
.filter(r -> force || (((WritableRegistryBridge<?>) r).bridge$eventCalled() && ((WritableRegistryBridge<?>) r).bridge$pendingDependencies()
.allMatch(t -> this.findRegistry(t).map(v -> ((MappedRegistryAccessor<?>) v).accessor$frozen() || ((WritableRegistryBridge<?>) v).bridge$eventCalled()).orElse(false))))
.allMatch(t -> this.findRegistry(t).map(v -> ((MappedRegistryAccessor<?>) v).accessor$frozen() && ((WritableRegistryBridge<?>) v).bridge$eventCalled()).orElse(false))))
.forEach(r -> dependencies.addEntry(
((Registry<?>) r).type(), new SpongeRegistryDependencyEntry<>(r, ((WritableRegistryBridge<?>) r).bridge$pendingDependencies().toList())));
dependencies.orderByDependencies(($, v) -> v.cookie().freeze());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,11 @@ public class RegistryDataLoaderMixin {
@WrapOperation(method = "load(Lnet/minecraft/resources/RegistryDataLoader$LoadingFunction;Ljava/util/List;Ljava/util/List;)Lnet/minecraft/core/RegistryAccess$Frozen;",
at = @At(value = "INVOKE", target = "Ljava/util/List;forEach(Ljava/util/function/Consumer;)V", ordinal = 1))
private static void impl$onLoad(final List<RegistryDataLoader_LoaderAccessor<?>> instance, final Consumer<?> consumer, final Operation<Void> original) {
// TODO: Remote layer
final DependencySorter<RegistryType<?>, SpongeRegistryDependencyEntry<RegistryDataLoader_LoaderAccessor<?>>> dependencies = new DependencySorter<>();
final Lifecycle lifecycle = Launch.instance().lifecycle();
instance.stream()
.filter(l -> ((RegistryDataLoader_LoaderBridge) l).bridge$registryHolder() != null)
.collect(Collectors.groupingBy(l -> ((RegistryDataLoader_LoaderBridge) l).bridge$registryHolder(), Collectors.toSet()))
.forEach((k, v) -> {
((SpongeRegistryHolder) k).setRootMinecraftRegistry(new RegistryAccess.ImmutableRegistryAccess(
Expand Down

0 comments on commit 9f2a749

Please sign in to comment.