mirror of
https://github.com/TeamMidnightDust/CullLeaves.git
synced 2025-12-16 14:15:10 +01:00
CullLeaves 3.2.0 - Mangrove Root Culling & Sodium fix
- Added an option to cull Mangrove Roots (closes #47) - Fixed incompatibility with Sodium by removing a now obsolete feature - Add German translation by myself
This commit is contained in:
@@ -5,6 +5,6 @@ import eu.midnightdust.lib.config.MidnightConfig;
|
|||||||
public class CullLeavesConfig extends MidnightConfig {
|
public class CullLeavesConfig extends MidnightConfig {
|
||||||
@Entry // Enable/Disable the mod. Requires Chunk Reload (F3 + A).
|
@Entry // Enable/Disable the mod. Requires Chunk Reload (F3 + A).
|
||||||
public static boolean enabled = true;
|
public static boolean enabled = true;
|
||||||
@Entry // Fixes resourcepacks utilizing leaf culling flickering when using Sodium
|
@Entry // Enable/Disable culling on Mangrove Roots.
|
||||||
public static boolean sodiumBlockFaceCullingFix = true;
|
public static boolean cullRoots = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package eu.midnightdust.cullleaves.mixin;
|
||||||
|
|
||||||
|
import eu.midnightdust.cullleaves.config.CullLeavesConfig;
|
||||||
|
import net.fabricmc.api.EnvType;
|
||||||
|
import net.fabricmc.api.Environment;
|
||||||
|
import net.minecraft.block.*;
|
||||||
|
import net.minecraft.util.math.Direction;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
|
||||||
|
@Mixin(value = MangroveRootsBlock.class, priority = 1900)
|
||||||
|
@Environment(EnvType.CLIENT)
|
||||||
|
public abstract class MixinMangroveRootsBlock extends Block {
|
||||||
|
|
||||||
|
public MixinMangroveRootsBlock(Settings settings) {
|
||||||
|
super(settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public boolean isSideInvisible(BlockState state, BlockState neighborState, Direction offset) {
|
||||||
|
if (CullLeavesConfig.cullRoots) {
|
||||||
|
return neighborState.getBlock() instanceof MangroveRootsBlock;
|
||||||
|
}
|
||||||
|
else return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
package eu.midnightdust.cullleaves.mixin;
|
|
||||||
|
|
||||||
import eu.midnightdust.cullleaves.config.CullLeavesConfig;
|
|
||||||
import me.jellysquid.mods.sodium.client.gl.device.RenderDevice;
|
|
||||||
import me.jellysquid.mods.sodium.client.gl.util.ElementRange;
|
|
||||||
import me.jellysquid.mods.sodium.client.model.quad.properties.ModelQuadFacing;
|
|
||||||
import me.jellysquid.mods.sodium.client.render.chunk.*;
|
|
||||||
import me.jellysquid.mods.sodium.client.render.chunk.data.ChunkRenderBounds;
|
|
||||||
import me.jellysquid.mods.sodium.client.render.chunk.passes.BlockRenderPass;
|
|
||||||
import me.jellysquid.mods.sodium.client.render.vertex.type.ChunkVertexType;
|
|
||||||
import org.spongepowered.asm.mixin.Final;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Mixin(value = RegionChunkRenderer.class, remap = false, priority = 1100)
|
|
||||||
public abstract class MixinRegionChunkRenderer extends ShaderChunkRenderer {
|
|
||||||
@Shadow @Final private boolean isBlockFaceCullingEnabled;
|
|
||||||
@Shadow protected abstract void addDrawCall(ElementRange part, long baseIndexPointer, int baseVertexIndex);
|
|
||||||
|
|
||||||
public MixinRegionChunkRenderer(RenderDevice device, ChunkVertexType vertexType) {
|
|
||||||
super(device, vertexType);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject(method = "buildDrawBatches", locals = LocalCapture.CAPTURE_FAILSOFT, at = @At(value = "INVOKE", target = "Lme/jellysquid/mods/sodium/client/render/chunk/ChunkGraphicsState;getModelPart(Lme/jellysquid/mods/sodium/client/model/quad/properties/ModelQuadFacing;)Lme/jellysquid/mods/sodium/client/gl/util/ElementRange;", ordinal = 0))
|
|
||||||
public void cullleaves$fixTransparentBlockFaceCulling(List<RenderSection> sections, BlockRenderPass pass, ChunkCameraContext camera, CallbackInfoReturnable<Boolean> cir, Iterator var4, RenderSection render, ChunkGraphicsState state, ChunkRenderBounds bounds, long indexOffset, int baseVertex) {
|
|
||||||
if (pass.getAlphaCutoff() != 0 && CullLeavesConfig.enabled && CullLeavesConfig.sodiumBlockFaceCullingFix && this.isBlockFaceCullingEnabled) {
|
|
||||||
if (camera.posY <= bounds.y1) {
|
|
||||||
this.addDrawCall(state.getModelPart(ModelQuadFacing.UP), indexOffset, baseVertex);
|
|
||||||
}
|
|
||||||
if (camera.posY >= bounds.y2) {
|
|
||||||
this.addDrawCall(state.getModelPart(ModelQuadFacing.DOWN), indexOffset, baseVertex);
|
|
||||||
}
|
|
||||||
if (camera.posX <= bounds.x1) {
|
|
||||||
this.addDrawCall(state.getModelPart(ModelQuadFacing.EAST), indexOffset, baseVertex);
|
|
||||||
}
|
|
||||||
if (camera.posX >= bounds.x2) {
|
|
||||||
this.addDrawCall(state.getModelPart(ModelQuadFacing.WEST), indexOffset, baseVertex);
|
|
||||||
}
|
|
||||||
if (camera.posZ <= bounds.z1) {
|
|
||||||
this.addDrawCall(state.getModelPart(ModelQuadFacing.SOUTH), indexOffset, baseVertex);
|
|
||||||
}
|
|
||||||
if (camera.posZ >= bounds.z2) {
|
|
||||||
this.addDrawCall(state.getModelPart(ModelQuadFacing.NORTH), indexOffset, baseVertex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -36,6 +36,17 @@ public class MixinSodiumGameOptionPages {
|
|||||||
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
|
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
|
||||||
.setImpact(OptionImpact.MEDIUM)
|
.setImpact(OptionImpact.MEDIUM)
|
||||||
.build()
|
.build()
|
||||||
|
).add(OptionImpl.createBuilder(boolean.class, sodiumOpts)
|
||||||
|
.setName(Text.translatable("cullleaves.midnightconfig.cullRoots"))
|
||||||
|
.setTooltip(Text.translatable("cullleaves.midnightconfig.cullRoots.tooltip.sodium"))
|
||||||
|
.setControl(TickBoxControl::new)
|
||||||
|
.setBinding((opts, value) -> {
|
||||||
|
CullLeavesConfig.cullRoots = value;
|
||||||
|
CullLeavesConfig.write("cullleaves");
|
||||||
|
}, opts -> CullLeavesConfig.cullRoots)
|
||||||
|
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
|
||||||
|
.setImpact(OptionImpact.MEDIUM)
|
||||||
|
.build()
|
||||||
)
|
)
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
|
|||||||
9
common/src/main/resources/assets/cullleaves/lang/de_de.json
Executable file
9
common/src/main/resources/assets/cullleaves/lang/de_de.json
Executable file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"cullleaves.midnightconfig.title":"Cull Leaves Konfiguration",
|
||||||
|
"cullleaves.midnightconfig.enabled.tooltip":"Aktiviert Culling bei Blättern, was zu besserer Performance führt.\n§cNach dem Ändern dieser Option müssen alle Chunks neugeladen werden (F3 + A)",
|
||||||
|
"cullleaves.midnightconfig.enabled.tooltip.sodium":"Aktiviert Culling bei Blättern, was zu besserer Performance führt.",
|
||||||
|
"cullleaves.midnightconfig.enabled":"Aktiviere Culling von Blättern",
|
||||||
|
"cullleaves.midnightconfig.cullRoots.tooltip":"Aktiviert Culling von Mangrovenwurzeln.\n§cNach dem Ändern dieser Option müssen alle Chunks neugeladen werden (F3 + A)",
|
||||||
|
"cullleaves.midnightconfig.cullRoots.tooltip.sodium":"Aktiviert Culling von Mangrovenwurzeln.",
|
||||||
|
"cullleaves.midnightconfig.cullRoots":"Culling von Mangrovenwurzeln"
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
"cullleaves.midnightconfig.enabled.tooltip":"Enables culling for leaves, providing a nice performance boost.\n§cAfter changing this setting you have to reload all chunks (F3 + A)",
|
"cullleaves.midnightconfig.enabled.tooltip":"Enables culling for leaves, providing a nice performance boost.\n§cAfter changing this setting you have to reload all chunks (F3 + A)",
|
||||||
"cullleaves.midnightconfig.enabled.tooltip.sodium":"Enables culling for leaves, providing a nice performance boost",
|
"cullleaves.midnightconfig.enabled.tooltip.sodium":"Enables culling for leaves, providing a nice performance boost",
|
||||||
"cullleaves.midnightconfig.enabled":"Enable Leaf Culling",
|
"cullleaves.midnightconfig.enabled":"Enable Leaf Culling",
|
||||||
"cullleaves.midnightconfig.sodiumBlockFaceCullingFix.tooltip": "Fixes resourcepacks utilizing leaf culling flickering when using Sodium.\nYou probably want this to be enabled.",
|
"cullleaves.midnightconfig.cullRoots.tooltip":"Enables culling for mangrove roots.\n§cAfter changing this setting you have to reload all chunks (F3 + A)",
|
||||||
"cullleaves.midnightconfig.sodiumBlockFaceCullingFix": "Fix Sodium Block Face Culling on Leaves"
|
"cullleaves.midnightconfig.cullRoots.tooltip.sodium":"Enables culling for mangrove roots.",
|
||||||
|
"cullleaves.midnightconfig.cullRoots":"Enable Mangrove Root Culling"
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
"minVersion": "0.8",
|
"minVersion": "0.8",
|
||||||
"client": [
|
"client": [
|
||||||
"MixinLeavesBlock",
|
"MixinLeavesBlock",
|
||||||
"MixinRegionChunkRenderer",
|
"MixinMangroveRootsBlock",
|
||||||
"MixinSodiumGameOptionPages"
|
"MixinSodiumGameOptionPages"
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ dependencies {
|
|||||||
//modApi "dev.architectury:architectury-fabric:${rootProject.architectury_version}"
|
//modApi "dev.architectury:architectury-fabric:${rootProject.architectury_version}"
|
||||||
modImplementation "maven.modrinth:midnightlib:${rootProject.midnightlib_version}-fabric"
|
modImplementation "maven.modrinth:midnightlib:${rootProject.midnightlib_version}-fabric"
|
||||||
include "maven.modrinth:midnightlib:${rootProject.midnightlib_version}-fabric"
|
include "maven.modrinth:midnightlib:${rootProject.midnightlib_version}-fabric"
|
||||||
|
modRuntimeOnly "maven.modrinth:sodium:${rootProject.sodium_version}"
|
||||||
|
|
||||||
common(project(path: ":common", configuration: "namedElements")) { transitive false }
|
common(project(path: ":common", configuration: "namedElements")) { transitive false }
|
||||||
shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false }
|
shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false }
|
||||||
|
|||||||
@@ -5,12 +5,12 @@ yarn_mappings=1.20.1+build.9
|
|||||||
enabled_platforms=quilt,fabric,forge
|
enabled_platforms=quilt,fabric,forge
|
||||||
|
|
||||||
archives_base_name=cullleaves
|
archives_base_name=cullleaves
|
||||||
mod_version=3.1.0
|
mod_version=3.2.0
|
||||||
maven_group=eu.midnightdust
|
maven_group=eu.midnightdust
|
||||||
|
|
||||||
architectury_version=6.2.43
|
architectury_version=6.2.43
|
||||||
midnightlib_version=1.4.1
|
midnightlib_version=1.4.1
|
||||||
sodium_version=mc1.20-0.4.10
|
sodium_version=mc1.20.1-0.5.2
|
||||||
|
|
||||||
fabric_loader_version=0.14.21
|
fabric_loader_version=0.14.21
|
||||||
fabric_api_version=0.85.0+1.20.1
|
fabric_api_version=0.85.0+1.20.1
|
||||||
|
|||||||
Reference in New Issue
Block a user