Fix broken Witch Water rendering

This commit is contained in:
thedarkcolour 2026-05-15 13:09:44 -07:00
parent 7a01d94f37
commit 3e1e44fb99
4 changed files with 34 additions and 34 deletions

View File

@ -21,24 +21,23 @@ package thedarkcolour.exdeorum.client;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.worldselection.CreateWorldScreen;
import net.minecraft.client.gui.screens.worldselection.WorldCreationUiState;
import net.minecraft.client.renderer.block.FluidModel;
import net.minecraft.client.resources.model.sprite.Material;
import net.minecraft.core.Holder;
import net.minecraft.core.registries.Registries;
import net.minecraft.server.packs.resources.ResourceManagerReloadListener;
import net.minecraft.world.level.levelgen.presets.WorldPreset;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.fml.ModList;
import net.neoforged.fml.event.config.ModConfigEvent;
import net.neoforged.fml.loading.FMLEnvironment;
import net.neoforged.neoforge.client.event.*;
import net.neoforged.neoforge.client.extensions.common.RegisterClientExtensionsEvent;
import net.neoforged.neoforge.common.NeoForge;
import net.minecraft.server.packs.resources.ResourceManagerReloadListener;
import net.neoforged.neoforge.server.ServerLifecycleHooks;
import thedarkcolour.exdeorum.ExDeorum;
import thedarkcolour.exdeorum.asm.ASMHooks;
import thedarkcolour.exdeorum.client.screen.MechanicalHammerScreen;
import thedarkcolour.exdeorum.client.screen.MechanicalSieveScreen;
import thedarkcolour.exdeorum.client.ter.*;
import thedarkcolour.exdeorum.compat.ModIds;
import thedarkcolour.exdeorum.config.EConfig;
import thedarkcolour.exdeorum.fluid.WitchWaterFluid;
import thedarkcolour.exdeorum.recipe.RecipeUtil;
@ -57,6 +56,7 @@ public class ClientHandler {
modBus.addListener(ClientHandler::registerMenuScreens);
modBus.addListener(ClientHandler::registerRenderers);
modBus.addListener(ClientHandler::registerClientExtensions);
modBus.addListener(ClientHandler::registerFluidModels);
modBus.addListener(ClientHandler::addClientReloadListeners);
modBus.addListener(ClientHandler::onConfigChanged);
fmlBus.addListener(ClientHandler::onPlayerRespawn);
@ -69,6 +69,19 @@ public class ClientHandler {
event.registerFluidType(WitchWaterFluid.createClientExtensions(), EFluids.WITCH_WATER_TYPE.get());
}
private static void registerFluidModels(RegisterFluidModelsEvent event) {
event.register(
new FluidModel.Unbaked(
new Material(WitchWaterFluid.STILL_TEXTURE),
new Material(WitchWaterFluid.FLOWING_TEXTURE),
new Material(WitchWaterFluid.OVERLAY_TEXTURE),
null
),
EFluids.WITCH_WATER,
EFluids.WITCH_WATER_FLOWING
);
}
private static void addClientReloadListeners(AddClientReloadListenersEvent event) {
event.addListener(ExDeorum.loc("render_util"), (ResourceManagerReloadListener) resourceManager -> RenderUtil.reload());
}

View File

@ -104,6 +104,22 @@ public abstract class BarrelMixingCategory<T> implements IRecipeCategory<T> {
public static class Fluids extends BarrelMixingCategory<BarrelFluidMixingRecipe> {
private static final Component CONTENTS_ARE_CONSUMED_TOOLTIP = Component.translatable(TranslationKeys.BARREL_FLUID_MIXING_CONTENTS_ARE_CONSUMED).withStyle(ChatFormatting.RED);
private static final IDrawable CONTENTS_ARE_CONSUMED_OVERLAY = new IDrawable() {
@Override
public int getWidth() {
return 16;
}
@Override
public int getHeight() {
return 16;
}
@Override
public void draw(GuiGraphicsExtractor guiGraphics, int xOffset, int yOffset) {
ClientXeiUtil.renderAsterisk(guiGraphics, xOffset, yOffset);
}
};
public Fluids(IGuiHelper helper, IDrawable plus, IDrawable arrow) {
super(helper, plus, arrow, TranslationKeys.BARREL_FLUID_MIXING_CATEGORY_TITLE, DefaultMaterials.STONE_BARREL.getItem());
@ -117,6 +133,7 @@ public abstract class BarrelMixingCategory<T> implements IRecipeCategory<T> {
.setFluidRenderer(1000, false, 16, 16);
if (recipe.consumesAdditive()) {
additiveSlot.addRichTooltipCallback((_, tooltip) -> tooltip.add(CONTENTS_ARE_CONSUMED_TOOLTIP));
additiveSlot.setOverlay(CONTENTS_ARE_CONSUMED_OVERLAY, 0, 0);
}
builder.addSlot(RecipeIngredientRole.OUTPUT, 79, 1).add(recipe.result().create());
}
@ -125,14 +142,5 @@ public abstract class BarrelMixingCategory<T> implements IRecipeCategory<T> {
public IRecipeType<BarrelFluidMixingRecipe> getRecipeType() {
return ExDeorumJeiPlugin.BARREL_FLUID_MIXING;
}
@Override
public void draw(BarrelFluidMixingRecipe recipe, IRecipeSlotsView recipeSlotsView, GuiGraphicsExtractor graphics, double mouseX, double mouseY) {
super.draw(recipe, recipeSlotsView, graphics, mouseX, mouseY);
if (recipe.consumesAdditive()) {
ClientXeiUtil.renderAsterisk(graphics, 18 + 3 + 3 + 8, 0);
}
}
}
}

View File

@ -54,18 +54,6 @@ public class WitchWaterFluid extends FluidType {
public static IClientFluidTypeExtensions createClientExtensions() {
return new IClientFluidTypeExtensions() {
public Identifier getStillTexture() {
return STILL_TEXTURE;
}
public Identifier getFlowingTexture() {
return FLOWING_TEXTURE;
}
public Identifier getOverlayTexture() {
return OVERLAY_TEXTURE;
}
@Override
public void modifyFogColor(Camera camera, float partialTick, ClientLevel level, int renderDistance, float darkenWorldAmount, Vector4f fluidFogColor) {
fluidFogColor.set(32f / 255f, 12f / 255f, 64f / 255f, fluidFogColor.w);

View File

@ -1,9 +0,0 @@
{
"sources": [
{
"type": "directory",
"source": "item/mesh",
"prefix": "item/mesh/"
}
]
}