diff --git a/Blueberry-API/src/main/java/net/blueberrymc/client/BlueberryClient.java b/Blueberry-API/src/main/java/net/blueberrymc/client/BlueberryClient.java index c22746f..951a861 100644 --- a/Blueberry-API/src/main/java/net/blueberrymc/client/BlueberryClient.java +++ b/Blueberry-API/src/main/java/net/blueberrymc/client/BlueberryClient.java @@ -38,6 +38,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.io.File; import java.io.IOException; import java.time.Instant; import java.util.ArrayList; @@ -77,7 +78,7 @@ public void crash(@NotNull CrashReport crashReport) { Preconditions.checkNotNull(crashReport, "crashReport cannot be null"); Minecraft.fillReport(Minecraft.getInstance(), null, "unknown", null, crashReport); LOGGER.fatal(crashReport.getFriendlyReport()); - Minecraft.crash(crashReport); + Minecraft.crash(Minecraft.getInstance(), new File(Blueberry.getGameDir(), "crash-reports"), crashReport); } @Override @@ -192,7 +193,7 @@ public static boolean showIncompatibleWorldModScreen(@NotNull String levelId, @N } Minecraft.getInstance().setScreen(new MultiLineBackupConfirmScreen(null, (backup, eraseCache) -> { if (backup) { - EditWorldScreen.makeBackupAndShowToast(Minecraft.getInstance().getLevelSource(), levelId); + EditWorldScreen.makeBackupAndShowToast(levelStorageAccess); } runnable.run(); }, title, description, false, lines)); diff --git a/Blueberry-API/src/main/java/net/blueberrymc/client/commands/ClientCommandManager.java b/Blueberry-API/src/main/java/net/blueberrymc/client/commands/ClientCommandManager.java index 66e0c99..55f547e 100644 --- a/Blueberry-API/src/main/java/net/blueberrymc/client/commands/ClientCommandManager.java +++ b/Blueberry-API/src/main/java/net/blueberrymc/client/commands/ClientCommandManager.java @@ -14,7 +14,6 @@ import net.minecraft.ChatFormatting; import net.minecraft.SharedConstants; import net.minecraft.Util; -import net.minecraft.commands.CommandRuntimeException; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.SharedSuggestionProvider; import net.minecraft.network.chat.ClickEvent; @@ -181,8 +180,6 @@ public static int performCommand(@NotNull CommandSourceStack commandSourceStack, try { return DISPATCHER.execute(reader, commandSourceStack); - } catch (CommandRuntimeException commandRuntimeException) { - commandSourceStack.sendFailure(commandRuntimeException.getComponent()); } catch (CommandSyntaxException commandSyntaxException) { commandSourceStack.sendFailure(ComponentUtils.fromMessage(commandSyntaxException.getRawMessage())); if (commandSyntaxException.getInput() != null && commandSyntaxException.getCursor() >= 0) { diff --git a/Blueberry-API/src/main/java/net/blueberrymc/client/gui/components/ScrollableContainer.java b/Blueberry-API/src/main/java/net/blueberrymc/client/gui/components/ScrollableContainer.java index f32b413..0260b59 100644 --- a/Blueberry-API/src/main/java/net/blueberrymc/client/gui/components/ScrollableContainer.java +++ b/Blueberry-API/src/main/java/net/blueberrymc/client/gui/components/ScrollableContainer.java @@ -208,7 +208,7 @@ public void render(@NotNull GuiGraphics guiGraphics, int mouseX, int mouseY, flo if (this.renderBackground) { RenderSystem.setShaderColor(0.125F, 0.125F, 0.125F, 1.0F); int i5 = 32; - guiGraphics.blit(Screen.BACKGROUND_LOCATION, this.left, this.top, (float)this.right, (float)(this.bottom + (int)this.getScrollAmount()), this.right - this.left, this.bottom - this.top, 32, 32); + guiGraphics.blit(Screen.MENU_BACKGROUND, this.left, this.top, (float)this.right, (float)(this.bottom + (int)this.getScrollAmount()), this.right - this.left, this.bottom - this.top, 32, 32); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); } @@ -222,11 +222,11 @@ public void render(@NotNull GuiGraphics guiGraphics, int mouseX, int mouseY, flo this.renderList(guiGraphics, getRowLeft(), i6, mouseX, mouseY, deltaFrameTime); RenderSystem.disableScissor(); if (this.renderTopAndBottom) { - RenderSystem.setShaderTexture(0, Screen.BACKGROUND_LOCATION); + RenderSystem.setShaderTexture(0, Screen.MENU_BACKGROUND); int i8 = 32; RenderSystem.setShaderColor(0.25F, 0.25F, 0.25F, 1.0F); - guiGraphics.blit(Screen.BACKGROUND_LOCATION, this.left, 0, 0.0F, 0.0F, this.width, this.top, 32, 32); - guiGraphics.blit(Screen.BACKGROUND_LOCATION, this.left, this.bottom, 0.0F, (float)this.bottom, this.width, this.height - this.bottom, 32, 32); + guiGraphics.blit(Screen.MENU_BACKGROUND, this.left, 0, 0.0F, 0.0F, this.width, this.top, 32, 32); + guiGraphics.blit(Screen.MENU_BACKGROUND, this.left, this.bottom, 0.0F, (float)this.bottom, this.width, this.height - this.bottom, 32, 32); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); int i9 = 4; guiGraphics.fillGradient(this.left, this.top, this.right, this.top + 4, -16777216, 0); diff --git a/Blueberry-API/src/main/java/net/blueberrymc/client/gui/screens/FileDialogScreen.java b/Blueberry-API/src/main/java/net/blueberrymc/client/gui/screens/FileDialogScreen.java index f9c2ef5..f5676ed 100644 --- a/Blueberry-API/src/main/java/net/blueberrymc/client/gui/screens/FileDialogScreen.java +++ b/Blueberry-API/src/main/java/net/blueberrymc/client/gui/screens/FileDialogScreen.java @@ -112,7 +112,7 @@ class FileList extends ObjectSelectionList { private final Button selectButton; public FileList(@NotNull Minecraft minecraft) { - super(minecraft, FileDialogScreen.this.width, FileDialogScreen.this.height, 52, FileDialogScreen.this.height - 50, 18); + super(minecraft, FileDialogScreen.this.width, FileDialogScreen.this.height, 52, FileDialogScreen.this.height - 50/*, 18*/); if (FileUtil.isRoot(options.getInitialDirectory()) && FileUtil.hasMultipleRoots()) { for (File root : File.listRoots()) { @@ -196,14 +196,14 @@ public boolean isFocused() { } @Override - protected void renderList(@NotNull GuiGraphics guiGraphics, int mouseX, int mouseY, float deltaFrameTime) { - super.renderList(guiGraphics, mouseX, mouseY, deltaFrameTime); + protected void renderListItems(@NotNull GuiGraphics guiGraphics, int mouseX, int mouseY, float deltaFrameTime) { + super.renderListItems(guiGraphics, mouseX, mouseY, deltaFrameTime); int itemCount = this.getItemCount(); for (int itemIndex = 0; itemIndex < itemCount; ++itemIndex) { int rowTop = this.getRowTop(itemIndex); int rowBottom = this.getRowTop(itemIndex) + this.itemHeight; - if (rowBottom >= this.y0 && rowTop <= this.y1) { + if (rowBottom >= this.getY() && rowTop <= this.getBottom()) { Entry entry = this.getEntry(itemIndex); int rowWidth = this.getRowWidth(); if (this.isSelectedItem(itemIndex)) { diff --git a/Blueberry-API/src/main/java/net/blueberrymc/client/gui/screens/ModListScreen.java b/Blueberry-API/src/main/java/net/blueberrymc/client/gui/screens/ModListScreen.java index e58ffd8..e28a25e 100644 --- a/Blueberry-API/src/main/java/net/blueberrymc/client/gui/screens/ModListScreen.java +++ b/Blueberry-API/src/main/java/net/blueberrymc/client/gui/screens/ModListScreen.java @@ -279,7 +279,7 @@ public void render(@NotNull GuiGraphics guiGraphics , int i, int i2, float f) { class ModsList extends ObjectSelectionList { public ModsList(@NotNull Minecraft minecraft) { - super(minecraft, ModListScreen.this.width / 5, ModListScreen.this.height, 32, ModListScreen.this.height - 87 + 4, 18); + super(minecraft/*, ModListScreen.this.width / 5*/, ModListScreen.this.height, 32, ModListScreen.this.height - 87 + 4, 18); for(BlueberryMod mod : Blueberry.getModLoader().getLoadedMods()) { Entry entry = new Entry(mod); diff --git a/Blueberry-API/src/main/java/net/blueberrymc/client/gui/screens/MultiLineBackupConfirmScreen.java b/Blueberry-API/src/main/java/net/blueberrymc/client/gui/screens/MultiLineBackupConfirmScreen.java index 5e9908d..eb98bc0 100644 --- a/Blueberry-API/src/main/java/net/blueberrymc/client/gui/screens/MultiLineBackupConfirmScreen.java +++ b/Blueberry-API/src/main/java/net/blueberrymc/client/gui/screens/MultiLineBackupConfirmScreen.java @@ -56,7 +56,8 @@ protected void init() { this.addRenderableWidget(Button.builder(Component.translatable("selectWorld.backupJoinConfirmButton"), (button) -> this.listener.proceed(true, this.eraseCache.selected())).bounds(this.width / 2 - 155, 100 + y, 150, 20).build()); this.addRenderableWidget(Button.builder(Component.translatable("selectWorld.backupJoinSkipButton"), (button) -> this.listener.proceed(false, this.eraseCache.selected())).bounds(this.width / 2 - 155 + 160, 100 + y, 150, 20).build()); this.addRenderableWidget(Button.builder(CommonComponents.GUI_CANCEL, (button) -> Objects.requireNonNull(this.minecraft).setScreen(this.lastScreen)).bounds(this.width / 2 - 155 + 80, 124 + y, 150, 20).build()); - this.eraseCache = new Checkbox(this.width / 2 - 155 + 80, 76 + y, 150, 20, Component.translatable("selectWorld.backupEraseCache"), false); + this.eraseCache = Checkbox.builder(Component.translatable("selectWorld.backupEraseCache"), font).pos(this.width / 2 - 155 + 80, 76 + y).selected(false).build(); + //new Checkbox(, 150, 20, Component.translatable("selectWorld.backupEraseCache"), false); if (this.promptForCacheErase) { this.addRenderableWidget(this.eraseCache); } diff --git a/Blueberry-API/src/main/java/net/blueberrymc/command/BlueberryCommand.java b/Blueberry-API/src/main/java/net/blueberrymc/command/BlueberryCommand.java index 03cd299..0756c19 100644 --- a/Blueberry-API/src/main/java/net/blueberrymc/command/BlueberryCommand.java +++ b/Blueberry-API/src/main/java/net/blueberrymc/command/BlueberryCommand.java @@ -120,7 +120,7 @@ private static int executeTpsCommand(CommandSourceStack source) throws CommandSy server = util.asClient().getIntegratedServer(); } if (server == null) throw UNAVAILABLE_IN_THIS_ENVIRONMENT.create(); - long[] tickTimes = server.tickTimes; + long[] tickTimes = server.getTickTimesNanos(); double last100t = round(getAverageTPS(tickTimes)); double l100t = round(getLowestTPS(tickTimes)); double last20t = round(getAverageTPS(Arrays.stream(tickTimes).limit(20))); diff --git a/Blueberry-API/src/main/java/net/blueberrymc/common/bml/ModLoader.java b/Blueberry-API/src/main/java/net/blueberrymc/common/bml/ModLoader.java index 8875d73..ff62459 100644 --- a/Blueberry-API/src/main/java/net/blueberrymc/common/bml/ModLoader.java +++ b/Blueberry-API/src/main/java/net/blueberrymc/common/bml/ModLoader.java @@ -1,15 +1,16 @@ package net.blueberrymc.common.bml; import com.google.common.collect.ImmutableList; -import net.blueberrymc.common.Blueberry; import net.blueberrymc.common.DeprecatedReason; import net.blueberrymc.config.ModDescriptionFile; import net.blueberrymc.network.mod.ModInfo; -import net.blueberrymc.util.DetectedVersion; import net.minecraft.launchwrapper.LaunchClassLoader; import net.minecraft.network.chat.Component; +import net.minecraft.server.packs.PackLocationInfo; import net.minecraft.server.packs.PackResources; +import net.minecraft.server.packs.PackSelectionConfig; import net.minecraft.server.packs.PackType; +import net.minecraft.server.packs.repository.KnownPack; import net.minecraft.server.packs.repository.Pack; import net.minecraft.server.packs.repository.PackSource; import org.jetbrains.annotations.ApiStatus; @@ -20,7 +21,6 @@ import java.io.InputStream; import java.util.ArrayList; import java.util.List; -import java.util.Objects; import java.util.Optional; import java.util.function.Consumer; import java.util.function.Function; @@ -189,28 +189,23 @@ default void loadPacks(@NotNull Consumer consumer) { PackResources packResources = mod.getResourceManager().getPackResources(); var resourcesSupplier = new Pack.ResourcesSupplier() { @Override - public @NotNull PackResources openPrimary(@NotNull String s) { + public @NotNull PackResources openPrimary(@NotNull PackLocationInfo packLocationInfo) { return packResources; } @Override - public @NotNull PackResources openFull(@NotNull String s, Pack.@NotNull Info info) { + public @NotNull PackResources openFull(@NotNull PackLocationInfo packLocationInfo, Pack.@NotNull Metadata metadata) { return packResources; } }; - Pack.Info info = Pack.readPackInfo(mod.modId(), resourcesSupplier, Objects.requireNonNull(DetectedVersion.tryDetectVersion()).getPackVersion(PackType.CLIENT_RESOURCES)); - if (info == null) { - throw new RuntimeException("Failed to load mod pack info for " + mod.modId()); - } - Pack pack = Pack.create( + PackLocationInfo locationInfo = new PackLocationInfo( mod.getDescription().modId(), Component.literal(mod.name()), - true, - resourcesSupplier, - info, - Pack.Position.BOTTOM, - false, - PackSource.BUILT_IN); + PackSource.FEATURE, + Optional.of(KnownPack.vanilla(mod.getDescription().modId())) + ); + PackSelectionConfig config = new PackSelectionConfig(true, Pack.Position.BOTTOM, false); + Pack pack = Pack.readMetaAndCreate(locationInfo, resourcesSupplier, PackType.CLIENT_RESOURCES, config); consumer.accept(pack); } catch (IllegalArgumentException ex) { break; // resource manager has not been loaded yet diff --git a/Blueberry-API/src/main/java/net/blueberrymc/common/bml/client/gui/screens/ModLoadingProblemScreen.java b/Blueberry-API/src/main/java/net/blueberrymc/common/bml/client/gui/screens/ModLoadingProblemScreen.java index fda55fb..01ca271 100644 --- a/Blueberry-API/src/main/java/net/blueberrymc/common/bml/client/gui/screens/ModLoadingProblemScreen.java +++ b/Blueberry-API/src/main/java/net/blueberrymc/common/bml/client/gui/screens/ModLoadingProblemScreen.java @@ -75,7 +75,7 @@ public void render(@NotNull GuiGraphics guiGraphics, int i, int i2, float f) { class ProblemList extends ObjectSelectionList { public ProblemList(@NotNull Minecraft minecraft) { - super(minecraft, ModLoadingProblemScreen.this.width, ModLoadingProblemScreen.this.height, 32, ModLoadingProblemScreen.this.height - 65 + 4, 18); + super(minecraft/*, ModLoadingProblemScreen.this.width*/, ModLoadingProblemScreen.this.height, 32, ModLoadingProblemScreen.this.height - 65 + 4, 18); for (ModLoadingError error : ModLoadingErrors.getErrors()) { this.addEntry(new Entry(error)); diff --git a/Blueberry-API/src/main/java/net/blueberrymc/common/resources/BlueberryResourceManager.java b/Blueberry-API/src/main/java/net/blueberrymc/common/resources/BlueberryResourceManager.java index 3e3775b..6ea0f14 100644 --- a/Blueberry-API/src/main/java/net/blueberrymc/common/resources/BlueberryResourceManager.java +++ b/Blueberry-API/src/main/java/net/blueberrymc/common/resources/BlueberryResourceManager.java @@ -1,15 +1,20 @@ package net.blueberrymc.common.resources; import net.blueberrymc.common.bml.BlueberryMod; +import net.minecraft.network.chat.Component; +import net.minecraft.server.packs.PackLocationInfo; import net.minecraft.server.packs.PackResources; import net.minecraft.server.packs.PackType; import net.minecraft.server.packs.PathPackResources; +import net.minecraft.server.packs.repository.KnownPack; +import net.minecraft.server.packs.repository.PackSource; import net.minecraft.server.packs.resources.FallbackResourceManager; import net.minecraft.server.packs.resources.IoSupplier; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.io.InputStream; +import java.util.Optional; public class BlueberryResourceManager extends FallbackResourceManager { @NotNull private final BlueberryMod mod; @@ -19,7 +24,13 @@ public BlueberryResourceManager(@NotNull BlueberryMod mod) { super(PackType.CLIENT_RESOURCES, mod.getDescription().modId()); this.mod = mod; if (this.mod.getFile().isDirectory()) { - packResources = new PathPackResources("Mod Resources for " + mod.name() + " (Folder)", this.mod.getFile().toPath(), true) { + PackLocationInfo locationInfo = new PackLocationInfo( + mod.modId(), + Component.literal("Mod Resources for " + mod.name() + " (Folder)"), + PackSource.FEATURE, + Optional.of(KnownPack.vanilla(mod.modId())) + ); + packResources = new PathPackResources(locationInfo, this.mod.getFile().toPath()) { @Nullable @Override public IoSupplier getRootResource(String @NotNull ... paths) { diff --git a/Blueberry-API/src/main/java/net/blueberrymc/common/resources/BlueberryText.java b/Blueberry-API/src/main/java/net/blueberrymc/common/resources/BlueberryText.java index 561a6bf..b9c8254 100644 --- a/Blueberry-API/src/main/java/net/blueberrymc/common/resources/BlueberryText.java +++ b/Blueberry-API/src/main/java/net/blueberrymc/common/resources/BlueberryText.java @@ -144,6 +144,12 @@ public BlueberryText cloneWithArgs(@Nullable Object@Nullable... args) { return contentConsumer.accept(getContents()); } + @Override + public @NotNull Type type() { + // TODO + return new Type<>(null, "blueberry"); + } + @Override public @NotNull Optional visit(@NotNull FormattedText.StyledContentConsumer styledContentConsumer, @NotNull Style style) { return styledContentConsumer.accept(style, getContents()); diff --git a/Blueberry-API/src/main/java/net/blueberrymc/common/resources/ModPackResources.java b/Blueberry-API/src/main/java/net/blueberrymc/common/resources/ModPackResources.java index e0ab381..a961967 100644 --- a/Blueberry-API/src/main/java/net/blueberrymc/common/resources/ModPackResources.java +++ b/Blueberry-API/src/main/java/net/blueberrymc/common/resources/ModPackResources.java @@ -4,10 +4,14 @@ import com.mojang.logging.LogUtils; import net.blueberrymc.common.bml.BlueberryMod; import net.minecraft.DetectedVersion; +import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.AbstractPackResources; +import net.minecraft.server.packs.PackLocationInfo; import net.minecraft.server.packs.PackResources; import net.minecraft.server.packs.PackType; +import net.minecraft.server.packs.repository.KnownPack; +import net.minecraft.server.packs.repository.PackSource; import net.minecraft.server.packs.resources.IoSupplier; import org.apache.commons.io.IOUtils; import org.jetbrains.annotations.ApiStatus; @@ -20,9 +24,11 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; +import java.lang.ref.Cleaner; import java.nio.charset.StandardCharsets; import java.util.Enumeration; import java.util.Locale; +import java.util.Optional; import java.util.Set; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; @@ -34,7 +40,7 @@ public class ModPackResources extends AbstractPackResources { private final String prefix; public ModPackResources(BlueberryMod mod) { - super("Mod Resources for " + mod.name() + " (File)", true); + super(new PackLocationInfo(mod.modId(), Component.literal("Mod Resources for " + mod.name() + " (File)"), PackSource.FEATURE, Optional.of(KnownPack.vanilla(mod.modId())))); this.mod = mod; this.zipFileAccess = new SharedZipFileAccess(mod.getFile()); this.prefix = ""; @@ -178,6 +184,7 @@ static class SharedZipFileAccess implements AutoCloseable { SharedZipFileAccess(File file) { this.file = file; + Cleaner.create().register(this, () -> LOGGER.error("WARNING: SharedZipFileAccess " + file.getAbsolutePath() + " was not cleaned. This will cause problems.")); } @Nullable ZipFile getOrCreateZipFile() { @@ -205,11 +212,5 @@ public void close() { } } - - @Deprecated - protected void finalize() throws Throwable { - this.close(); - super.finalize(); - } } } diff --git a/Blueberry-API/src/main/java/net/blueberrymc/common/util/DiscordRPCTaskExecutor.java b/Blueberry-API/src/main/java/net/blueberrymc/common/util/DiscordRPCTaskExecutor.java index 2b20661..cc6165c 100644 --- a/Blueberry-API/src/main/java/net/blueberrymc/common/util/DiscordRPCTaskExecutor.java +++ b/Blueberry-API/src/main/java/net/blueberrymc/common/util/DiscordRPCTaskExecutor.java @@ -180,8 +180,8 @@ public void onActivityJoin(@NotNull String secret) { lobbyManager.openNetworkChannel(lobby, NETWORK_SYSTEM_MESSAGE_ID, true); var me = core.userManager().getCurrentUser(); var tag = me.getUsername() + "#" + me.getDiscriminator(); - // TODO: translate - byte[] data = Component.Serializer.toJson(Component.literal(tag + " joined the lobby!").withStyle(ChatFormatting.YELLOW)).getBytes(StandardCharsets.UTF_8); + // TODO: translate & fix nulls + byte[] data = Component.Serializer.toJson(Component.literal(tag + " joined the lobby!").withStyle(ChatFormatting.YELLOW), null).getBytes(StandardCharsets.UTF_8); for (DiscordUser user : lobbyManager.getMemberUsers(lobby)) { lobbyManager.sendNetworkMessage(lobby, user.getUserId(), NETWORK_SYSTEM_MESSAGE_ID, data); } @@ -193,7 +193,8 @@ public void onActivityJoin(@NotNull String secret) { public void onNetworkMessage(long lobbyId, long userId, byte channelId, byte @NotNull [] data) { if (channelId == NETWORK_SYSTEM_MESSAGE_ID) { try { - Component component = Component.Serializer.fromJson(new String(data)); + // TODO: fix null + Component component = Component.Serializer.fromJson(new String(data), null); if (component != null && currentUserId.get() == userId) { var player = Minecraft.getInstance().player; if (player != null) { diff --git a/Blueberry-API/src/main/java/net/blueberrymc/network/CustomComponentSerializer.java b/Blueberry-API/src/main/java/net/blueberrymc/network/CustomComponentSerializer.java index 597ac97..9acadad 100644 --- a/Blueberry-API/src/main/java/net/blueberrymc/network/CustomComponentSerializer.java +++ b/Blueberry-API/src/main/java/net/blueberrymc/network/CustomComponentSerializer.java @@ -5,17 +5,14 @@ import com.google.gson.JsonSerializationContext; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.ComponentContents; -import net.minecraft.network.chat.MutableComponent; import org.jetbrains.annotations.NotNull; import java.util.Map; -import java.util.Objects; import java.util.concurrent.ConcurrentHashMap; public interface CustomComponentSerializer { @NotNull Map, CustomComponentSerializer> SERIALIZERS = new ConcurrentHashMap<>(); - Component.Serializer COMPONENT_SERIALIZER = new Component.Serializer(); @NotNull @SuppressWarnings("unchecked") @@ -35,7 +32,8 @@ private JsonElement serializeUnchecked(@NotNull ComponentContents component, @No @NotNull default Object deserializeGlobal(@NotNull JsonElement element, @NotNull JsonDeserializationContext context) { - return COMPONENT_SERIALIZER.deserialize(element, element.getClass(), context); + // TODO + return Component.Serializer.fromJson(element, null); } static void registerSerializer(@NotNull Class componentClass, @NotNull CustomComponentSerializer componentSerializerClass) { diff --git a/Blueberry-API/src/main/java/net/blueberrymc/registry/BlueberryRegistries.java b/Blueberry-API/src/main/java/net/blueberrymc/registry/BlueberryRegistries.java index 9752066..d117da5 100644 --- a/Blueberry-API/src/main/java/net/blueberrymc/registry/BlueberryRegistries.java +++ b/Blueberry-API/src/main/java/net/blueberrymc/registry/BlueberryRegistries.java @@ -1,7 +1,7 @@ package net.blueberrymc.registry; import com.google.common.base.Preconditions; -import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import net.blueberrymc.client.EarlyLoadingMessageManager; import net.blueberrymc.client.renderer.blockentity.MinecraftBlockEntityRenderDispatcher; import net.blueberrymc.common.Blueberry; @@ -42,7 +42,6 @@ import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkGenerator; -import net.minecraft.world.level.chunk.ChunkStatus; import net.minecraft.world.level.gameevent.PositionSourceType; import net.minecraft.world.level.levelgen.carver.WorldCarver; import net.minecraft.world.level.levelgen.feature.Feature; @@ -97,7 +96,6 @@ public final class BlueberryRegistries { public static final BlueberryRegistries POTION = new BlueberryRegistries<>(BuiltInRegistries.POTION); public static final BlueberryRegistries> PARTICLE_TYPE = new BlueberryRegistries<>(BuiltInRegistries.PARTICLE_TYPE); public static final BlueberryRegistries CUSTOM_STAT = new BlueberryRegistries<>(BuiltInRegistries.CUSTOM_STAT); - public static final BlueberryRegistries CHUNK_STATUS = new BlueberryRegistries<>(BuiltInRegistries.CHUNK_STATUS); public static final BlueberryRegistries> RULE_TEST = new BlueberryRegistries<>(BuiltInRegistries.RULE_TEST); public static final BlueberryRegistries> POS_RULE_TEST = new BlueberryRegistries<>(BuiltInRegistries.POS_RULE_TEST); public static final BlueberryRegistries> RECIPE_TYPE = new BlueberryRegistries<>(BuiltInRegistries.RECIPE_TYPE); @@ -113,13 +111,13 @@ public final class BlueberryRegistries { public static final BlueberryRegistries SCHEDULE = new BlueberryRegistries<>(BuiltInRegistries.SCHEDULE); public static final BlueberryRegistries ACTIVITY = new BlueberryRegistries<>(BuiltInRegistries.ACTIVITY); public static final BlueberryRegistries LOOT_POOL_ENTRY_TYPE = new BlueberryRegistries<>(BuiltInRegistries.LOOT_POOL_ENTRY_TYPE); - public static final BlueberryRegistries LOOT_FUNCTION_TYPE = new BlueberryRegistries<>(BuiltInRegistries.LOOT_FUNCTION_TYPE); + public static final BlueberryRegistries> LOOT_FUNCTION_TYPE = new BlueberryRegistries<>(BuiltInRegistries.LOOT_FUNCTION_TYPE); public static final BlueberryRegistries LOOT_CONDITION_TYPE = new BlueberryRegistries<>(BuiltInRegistries.LOOT_CONDITION_TYPE); public static final BlueberryRegistries LOOT_NUMBER_PROVIDER_TYPE = new BlueberryRegistries<>(BuiltInRegistries.LOOT_NUMBER_PROVIDER_TYPE); public static final BlueberryRegistries LOOT_NBT_PROVIDER_TYPE = new BlueberryRegistries<>(BuiltInRegistries.LOOT_NBT_PROVIDER_TYPE); public static final BlueberryRegistries LOOT_SCORE_PROVIDER_TYPE = new BlueberryRegistries<>(BuiltInRegistries.LOOT_SCORE_PROVIDER_TYPE); - public static final BlueberryRegistries> BIOME_SOURCE = new BlueberryRegistries<>(BuiltInRegistries.BIOME_SOURCE); - public static final BlueberryRegistries> CHUNK_GENERATOR = new BlueberryRegistries<>(BuiltInRegistries.CHUNK_GENERATOR); + public static final BlueberryRegistries> BIOME_SOURCE = new BlueberryRegistries<>(BuiltInRegistries.BIOME_SOURCE); + public static final BlueberryRegistries> CHUNK_GENERATOR = new BlueberryRegistries<>(BuiltInRegistries.CHUNK_GENERATOR); public static final BlueberryRegistries> STRUCTURE_PROCESSOR = new BlueberryRegistries<>(BuiltInRegistries.STRUCTURE_PROCESSOR); public static final BlueberryRegistries> STRUCTURE_POOL_ELEMENT = new BlueberryRegistries<>(BuiltInRegistries.STRUCTURE_POOL_ELEMENT); public static final BlueberryRegistries> CARVER = new BlueberryRegistries<>(BuiltInRegistries.CARVER);