From 6f7cabf7a6f842c4422cbd05fd87efe79430d31d Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Tue, 24 Dec 2024 17:50:15 -0800 Subject: [PATCH] better support for future direct buildables --- .../paper/registry/PaperRegistryBuilderFactory.java | 11 +++++------ .../papermc/paper/registry/WritableCraftRegistry.java | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/paper-server/src/main/java/io/papermc/paper/registry/PaperRegistryBuilderFactory.java b/paper-server/src/main/java/io/papermc/paper/registry/PaperRegistryBuilderFactory.java index 0f0f8d1c7e..296d603b0a 100644 --- a/paper-server/src/main/java/io/papermc/paper/registry/PaperRegistryBuilderFactory.java +++ b/paper-server/src/main/java/io/papermc/paper/registry/PaperRegistryBuilderFactory.java @@ -2,7 +2,6 @@ package io.papermc.paper.registry; import io.papermc.paper.adventure.PaperAdventure; import io.papermc.paper.registry.data.util.Conversions; -import io.papermc.paper.registry.entry.RegistryEntryMeta; import java.util.function.Function; import net.minecraft.resources.ResourceLocation; import org.bukkit.Keyed; @@ -11,13 +10,13 @@ import org.jspecify.annotations.Nullable; public class PaperRegistryBuilderFactory> implements RegistryBuilderFactory { // TODO remove Keyed private final Conversions conversions; - private final RegistryEntryMeta.Buildable meta; + private final PaperRegistryBuilder.Filler builderFiller; private final Function existingValueGetter; private @Nullable B builder; - public PaperRegistryBuilderFactory(final Conversions conversions, final RegistryEntryMeta.Buildable meta, final Function existingValueGetter) { + public PaperRegistryBuilderFactory(final Conversions conversions, final PaperRegistryBuilder.Filler builderFiller, final Function existingValueGetter) { this.conversions = conversions; - this.meta = meta; + this.builderFiller = builderFiller; this.existingValueGetter = existingValueGetter; } @@ -37,7 +36,7 @@ public class PaperRegistryBuilderFactory key, final Consumer> value, final Conversions conversions) { final ResourceKey resourceKey = PaperRegistries.toNms(key); this.registry.validateWrite(resourceKey); - final PaperRegistryBuilderFactory builderFactory = new PaperRegistryBuilderFactory<>(conversions, this.meta, this.registry.temporaryUnfrozenMap::get); + final PaperRegistryBuilderFactory builderFactory = new PaperRegistryBuilderFactory<>(conversions, this.meta.builderFiller(), this.registry.temporaryUnfrozenMap::get); value.accept(builderFactory); PaperRegistryListenerManager.INSTANCE.registerWithListeners( this.registry,