Skip to content

Commit

Permalink
Mesoglea liquid rendering optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
Treetrain1 committed May 16, 2024
1 parent 172b3a5 commit a9df9ce
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ public final class WilderWildClient implements ClientModInitializer {
public static final ModelLayerLocation OSTRICH_SADDLE = new ModelLayerLocation(WilderSharedConstants.id("ostrich"), "saddle");
public static final ModelLayerLocation SCORCHED = new ModelLayerLocation(WilderSharedConstants.id("scorched"), "main");

public static volatile boolean MESOGLEA_LIQUID = false;

@Override
public void onInitializeClient() {
SplashTextAPI.addSplashLocation(WilderSharedConstants.id("texts/splashes.txt"));
Expand Down Expand Up @@ -381,7 +383,7 @@ private static void setupMesogleaRendering() { // Credit to embeddedt: https://g
var customWaterHandler = new FluidRenderHandler() {

private boolean isSingleTexture(@Nullable BlockAndTintGetter view, @Nullable BlockPos pos) {
if (view != null && pos != null && BlockConfig.get().mesoglea.mesogleaLiquid) {
if (view != null && pos != null && MESOGLEA_LIQUID) {
BlockState state = view.getBlockState(pos);
return state.is(WilderBlockTags.MESOGLEA) && state.hasProperty(BlockStateProperties.WATERLOGGED) && state.getValue(BlockStateProperties.WATERLOGGED);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@
package net.frozenblock.wilderwild.config;

import me.shedaniel.autoconfig.annotation.ConfigEntry.Gui.CollapsibleObject;
import net.fabricmc.api.EnvType;
import net.fabricmc.loader.api.FabricLoader;
import net.frozenblock.lib.config.api.instance.Config;
import net.frozenblock.lib.config.api.instance.json.JsonConfig;
import net.frozenblock.lib.config.api.instance.json.JsonType;
import net.frozenblock.lib.config.api.registry.ConfigRegistry;
import net.frozenblock.lib.config.api.sync.SyncBehavior;
import net.frozenblock.lib.config.api.sync.annotation.EntrySyncData;
import net.frozenblock.wilderwild.WilderWildClient;
import net.frozenblock.wilderwild.block.impl.SnowloggingUtils;
import static net.frozenblock.wilderwild.misc.WilderSharedConstants.MOD_ID;
import static net.frozenblock.wilderwild.misc.WilderSharedConstants.configPath;
Expand All @@ -50,6 +53,9 @@ public void onSave() throws Exception {
public void onSync(BlockConfig syncInstance) {
var config = this.config();
SnowloggingUtils.SNOWLOGGING = config.snowlogging.snowlogging;
if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) {
WilderWildClient.MESOGLEA_LIQUID = config.mesoglea.mesogleaLiquid;
}
}
}
);
Expand Down

0 comments on commit a9df9ce

Please sign in to comment.