From b65cc6ed026593a5a7c198a5a8928017bd9a97d4 Mon Sep 17 00:00:00 2001 From: unilock Date: Tue, 12 Nov 2024 06:27:46 -0500 Subject: [PATCH 1/2] Properly mark some mixins as client-side Silences some warnings in dedicated server logs --- src/mod/resources/connector.mixins.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mod/resources/connector.mixins.json b/src/mod/resources/connector.mixins.json index aafd140d..1b1f2922 100644 --- a/src/mod/resources/connector.mixins.json +++ b/src/mod/resources/connector.mixins.json @@ -13,15 +13,12 @@ "item.IItemExtensionMixin", "item.ItemStackMixin", "network.StreamCodecMixin", - "recipebook.RecipeBookCategoriesAccessor", - "recipebook.RecipeBookCategoriesMixin", "recipebook.RecipeBookManagerMixin", "registries.DataPackRegistriesHooksAccessor", "registries.MappedRegistryAccessor", "registries.NeoForgeRegistriesSetupAccessor", "registries.BuiltInRegistriesMixin", "registries.EntityDataSerializersMixin", - "registries.ItemBlockRenderTypesMixin", "registries.NeoForgeRegistriesSetupMixin", "registries.NetworkRegistryMixin", "registries.PoiTypesMixin", @@ -34,7 +31,10 @@ "client.ItemColorsMixin", "client.ItemOverridesMixin", "client.KeyMappingMixin", - "client.ParticleEngineMixin" + "client.ParticleEngineMixin", + "recipebook.RecipeBookCategoriesAccessor", + "recipebook.RecipeBookCategoriesMixin", + "registries.ItemBlockRenderTypesMixin" ], "server": [ "boot.ServerMainMixin" From 0a733c37ecc2e9ba1fcd9e179328c56d5d95f5f7 Mon Sep 17 00:00:00 2001 From: unilock Date: Tue, 12 Nov 2024 07:12:50 -0500 Subject: [PATCH 2/2] Move FluidRenderHandlerRegistry access to FluidHandlerCompatClient --- .../connector/mod/compat/FluidHandlerCompat.java | 15 ++------------- .../mod/compat/FluidHandlerCompatClient.java | 3 ++- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/mod/java/org/sinytra/connector/mod/compat/FluidHandlerCompat.java b/src/mod/java/org/sinytra/connector/mod/compat/FluidHandlerCompat.java index 0697f99f..a56a6eaa 100644 --- a/src/mod/java/org/sinytra/connector/mod/compat/FluidHandlerCompat.java +++ b/src/mod/java/org/sinytra/connector/mod/compat/FluidHandlerCompat.java @@ -1,8 +1,6 @@ package org.sinytra.connector.mod.compat; import com.mojang.logging.LogUtils; -import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandler; -import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandlerRegistry; import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant; import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariantAttributes; import net.minecraft.core.registries.BuiltInRegistries; @@ -16,7 +14,6 @@ import net.neoforged.neoforge.fluids.FluidType; import net.neoforged.neoforge.registries.NeoForgeRegistries; import net.neoforged.neoforge.registries.RegisterEvent; -import org.jetbrains.annotations.Nullable; import org.sinytra.connector.ConnectorEarlyLoader; import org.slf4j.Logger; @@ -51,8 +48,7 @@ private static void initFabricFluidTypes() { ResourceKey key = entry.getKey(); Fluid fluid = entry.getValue(); if (ModList.get().getModContainerById(key.location().getNamespace()).map(c -> ConnectorEarlyLoader.isConnectorMod(c.getModId())).orElse(false)) { - FluidRenderHandler renderHandler = FluidRenderHandlerRegistry.INSTANCE.get(fluid); - FluidType type = new FabricFluidType(FluidType.Properties.create(), fluid, renderHandler); + FluidType type = new FabricFluidType(FluidType.Properties.create(), fluid); FABRIC_FLUID_TYPES.put(fluid, type); FABRIC_FLUID_TYPES_BY_NAME.put(key.location(), type); } @@ -64,20 +60,13 @@ private static void onRegisterFluids(RegisterEvent event) { } static class FabricFluidType extends FluidType { - @Nullable - private final FluidRenderHandler renderHandler; private final Component name; - public FabricFluidType(Properties properties, Fluid fluid, @Nullable FluidRenderHandler renderHandler) { + public FabricFluidType(Properties properties, Fluid fluid) { super(properties); - this.renderHandler = renderHandler; this.name = FluidVariantAttributes.getName(FluidVariant.of(fluid)); } - public FluidRenderHandler getRenderHandler() { - return renderHandler; - } - @Override public Component getDescription() { return this.name.copy(); diff --git a/src/mod/java/org/sinytra/connector/mod/compat/FluidHandlerCompatClient.java b/src/mod/java/org/sinytra/connector/mod/compat/FluidHandlerCompatClient.java index aecd5154..11dc2e1e 100644 --- a/src/mod/java/org/sinytra/connector/mod/compat/FluidHandlerCompatClient.java +++ b/src/mod/java/org/sinytra/connector/mod/compat/FluidHandlerCompatClient.java @@ -1,6 +1,7 @@ package org.sinytra.connector.mod.compat; import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandler; +import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandlerRegistry; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.core.BlockPos; import net.minecraft.resources.ResourceLocation; @@ -14,7 +15,7 @@ public final class FluidHandlerCompatClient { public static void onRegisterClientExtensions(RegisterClientExtensionsEvent event) { FluidHandlerCompat.getFabricFluidTypes().forEach((fluid, type) -> { - FluidRenderHandler renderHandler = ((FluidHandlerCompat.FabricFluidType) type).getRenderHandler(); + FluidRenderHandler renderHandler = FluidRenderHandlerRegistry.INSTANCE.get(fluid); event.registerFluidType(new IClientFluidTypeExtensions() { private TextureAtlasSprite[] getSprites() { return renderHandler.getFluidSprites(null, null, fluid.defaultFluidState());