38 Commits

Author SHA1 Message Date
Martin Prokoph
7b4ecdc4e9 port: Chase the Skies (1.21.6) 2025-06-17 18:18:13 +02:00
Martin Prokoph
0d191e2888 port: Spring to Life (1.21.5) 2025-04-21 10:32:53 +02:00
Martin Prokoph
eef6c2aca0 Bump version (again) 2024-12-24 15:03:36 +01:00
Martin Prokoph
c0cdc982e7 Merge branch '1.21.4' of https://github.com/TeamMidnightDust/CullLeaves into 1.21.4 2024-12-24 15:01:41 +01:00
Martin Prokoph
796c2f246b Bump version 2024-12-24 15:01:21 +01:00
Martin Prokoph
e8b62d24e1 Merge pull request #57 from TeamMidnightDust/main
Also apply fixes to 1.21.4
2024-12-24 14:59:41 +01:00
Martin Prokoph
766693070a Some fixes
- Fix mixin apply error on NeoForge
- Only reload world renderer when actually in a world
2024-12-24 14:57:16 +01:00
Martin Prokoph
57613f465d Port to 1.21.4 2024-12-24 14:45:48 +01:00
Martin Prokoph
6c399af13a Merge pull request #52 from mpustovoi/main
Make the resourcepack's description translatable and update `ru_ru.json`
2024-12-24 14:02:36 +01:00
Martin Prokoph
13a6710ee1 Merge pull request #55 from NuruddinPlays/main
Add Malay and Malay (Jawi) translations
2024-12-24 14:01:50 +01:00
Martin Prokoph
b8d2e6b4ab Many QoL improvements & Resourcepack features
- Support Sodium 0.6+
- Allow resourcepacks to force culling and hide fully-encircled leaf blocks
- Force leaf culling when the smart leaves pack is enabled
- Reload world when the config changes
- Only apply Sodium mixins when Sodium is actually installed (Removes log spam)
2024-12-24 14:01:05 +01:00
NuruTheDoomer
5a3f687ae6 Add Malay and Malay (Jawi) translations 2024-12-03 23:41:08 +08:00
Korben
c555df0f4d Adjusted indents 2024-07-04 15:31:11 +03:00
Korben
4afbe3d740 Update ru_ru.json
Added missing lines
Added resourcepack description translation
2024-07-04 15:27:06 +03:00
Korben
3ac34a6f9b Update pack.mcmeta
Made the resourcepack translatable
2024-07-04 15:25:34 +03:00
Martin Prokoph
1ad05aa6bf 1.21 Port & Smart Azalea Leaves
- Closes #51
2024-06-18 20:08:31 +02:00
Martin Prokoph
3e24b1ac0a Automatically mark MidnightLib as dependency 2024-02-22 15:14:44 +01:00
Martin Prokoph
849e089ff2 Fix CurseForge publishing 2024-02-22 15:08:20 +01:00
Martin Prokoph
f3fb019bca Automatic upload using Unified Publishing 2024-02-22 15:01:05 +01:00
Martin Prokoph
41a4ddf633 Port to 1.20.4 & Migrate to NeoForge 2024-02-22 14:23:17 +01:00
Martin Prokoph
1877e7d65d Merge pull request #49 from HhiPyrene/zh_cn
Update zh_cn
2024-02-22 11:32:46 +01:00
HhiPyrene
2f89a3a0db zh_cn 2023-08-28 18:53:58 +08:00
Motschen
41efe55ea6 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
2023-08-24 15:40:01 +02:00
Motschen
6c3f8f369e Fix quilt.mod.json 2023-07-12 13:00:36 +02:00
Motschen
a293fdaeb3 Update pack.mcmeta 2023-07-12 12:39:50 +02:00
Motschen
5177f4897f CullLeaves 3.1.0 - Update to 1.20
- Update to 1.20
- Attempt to fix random BufferUnderflowExceptions with Sodium once and for all
2023-07-12 12:36:33 +02:00
Martin Prokoph
74f2efbc88 Merge pull request #39 from notlin4/patch-1
Add Traditional Chinese
2023-07-12 11:47:17 +02:00
Martin Prokoph
054f6f35e4 Merge pull request #41 from ImVietnam/patch-1
Create vi_vn.json
2023-07-12 11:46:20 +02:00
I_am_Vietnam
e4fbd0a8f5 Create vi_vn.json 2023-07-04 11:34:40 +07:00
notlin4
61e167198a Add Traditional Chinese 2023-05-26 17:55:19 +08:00
Motschen
4f70a32bee Stop game from launching with old Sodium versions 2023-02-11 17:23:36 +01:00
Martin Prokoph
a979e760c7 Merge pull request #36 from Diamondman121314/patch-1
Update to support Sodium 0.4.9
2023-02-11 16:57:40 +01:00
Martin Prokoph
d2b8a9dda5 Merge pull request #33 from HhiPyrene/main
i18n: zh_cn
2023-02-11 16:56:26 +01:00
Martin Prokoph
87fb2c8ed7 Merge pull request #30 from Altegar/patch-1
Create uk_ua.json
2023-02-11 16:55:58 +01:00
Terrence S
26fefced39 Update to support Sodium 0.4.9 2023-02-09 02:15:00 -05:00
HhiPyrene
6babf21877 i18n: zh_cn 2023-02-03 18:00:39 +08:00
Motschen
5f0cc2f27a Update everything to 1.19.3 2022-12-14 19:00:04 +01:00
Altegar
07ae6f47c0 Create uk_ua.json 2022-12-12 11:16:25 +02:00
52 changed files with 801 additions and 334 deletions

View File

@@ -1,6 +1,7 @@
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.0-SNAPSHOT" apply false
id "dev.architectury.loom" version "1.10-SNAPSHOT" apply false
id "me.shedaniel.unified-publishing" version "0.1.+" apply false
}
architectury {
@@ -18,7 +19,6 @@ subprojects {
apply plugin: "dev.architectury.loom"
loom {
silentMojangMappingsLicense()
}
dependencies {
@@ -26,7 +26,10 @@ subprojects {
// The following line declares the mojmap mappings, you may use other mappings as well
//mappings loom.officialMojangMappings()
// The following line declares the yarn mappings you may select this one as well.
mappings "net.fabricmc:yarn:1.19.2+build.3:v2"
mappings loom.layered {
it.mappings("net.fabricmc:yarn:$rootProject.yarn_mappings:v2")
it.mappings("dev.architectury:yarn-mappings-patch-neoforge:$rootProject.yarn_mappings_patch_neoforge_version")
}
}
}
@@ -47,9 +50,24 @@ allprojects {
// for more information about repositories.
}
tasks.withType(JavaCompile) {
tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
options.release = 17
options.release = 21
}
ext {
releaseChangelog = {
def changes = new StringBuilder()
changes << "## CullLeaves v$project.version for $project.minecraft_version\n[View the changelog](https://www.github.com/TeamMidnightDust/CullLeaves/commits/)"
def proc = "git log --max-count=200 --pretty=format:%s".execute()
proc.in.eachLine { line ->
def processedLine = line.toString()
if (!processedLine.contains("New translations") && !processedLine.contains("Merge") && !processedLine.contains("branch")) {
changes << "\n- ${processedLine.capitalize()}"
}
}
proc.waitFor()
return changes.toString()
}
}
java {

View File

@@ -3,8 +3,6 @@ architectury {
common(rootProject.enabled_platforms.split(","))
}
loom {
}
repositories {
maven { url "https://api.modrinth.com/maven" }
}
@@ -14,22 +12,6 @@ dependencies {
// Do NOT use other classes from fabric loader
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
modCompileOnlyApi "maven.modrinth:midnightlib:${rootProject.midnightlib_version}-fabric"
modCompileOnlyApi "maven.modrinth:sodium:${rootProject.sodium_version}"
// Remove the next line if you don't want to depend on the API
//modApi "dev.architectury:architectury:${rootProject.architectury_version}"
}
publishing {
publications {
mavenCommon(MavenPublication) {
artifactId = rootProject.archives_base_name
from components.java
}
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
}
}

View File

@@ -0,0 +1,78 @@
package eu.midnightdust.cullleaves;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import eu.midnightdust.cullleaves.config.CullLeavesConfig;
import net.minecraft.block.BlockState;
import net.minecraft.block.LeavesBlock;
import net.minecraft.block.MangroveRootsBlock;
import net.minecraft.resource.ResourceManager;
import net.minecraft.resource.SynchronousResourceReloader;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockView;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
public class CullLeavesClient {
public static final String MOD_ID = "cullleaves";
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
public static boolean forceLeafCulling = false;
public static boolean forceHideInnerLeaves = false;
public static boolean shouldHideBlock(BlockView world, BlockPos pos) {
if (CullLeavesClient.forceHideInnerLeaves) {
boolean shouldForceCull = true;
for (Direction dir : Direction.values()) {
BlockState otherState = world.getBlockState(pos.offset(dir));
if (!(otherState.getBlock() instanceof LeavesBlock) &&
!otherState.isSideSolidFullSquare(world, pos, dir.getOpposite())) {
shouldForceCull = false;
break;
}
}
return shouldForceCull;
}
return false;
}
public static boolean isLeafSideInvisible(BlockState neighborState) {
if (CullLeavesConfig.enabled || CullLeavesClient.forceLeafCulling) {
return neighborState.getBlock() instanceof LeavesBlock;
}
else return false;
}
public static boolean isRootSideInvisible(BlockState neighborState) {
if (CullLeavesConfig.cullRoots) {
return neighborState.getBlock() instanceof MangroveRootsBlock;
}
else return false;
}
public static class ReloadListener implements SynchronousResourceReloader {
public static final ReloadListener INSTANCE = new ReloadListener();
private ReloadListener() {}
@Override
public void reload(ResourceManager manager) {
CullLeavesClient.forceLeafCulling = false;
CullLeavesClient.forceHideInnerLeaves = false;
manager.findResources("options", path -> path.toString().startsWith("cullleaves") && path.toString().endsWith("options.json")).forEach((id, resource) -> {
try {
JsonObject json = JsonParser.parseReader(resource.getReader()).getAsJsonObject();
if (json.has("forceLeafCulling")) {
CullLeavesClient.forceLeafCulling = json.get("forceLeafCulling").getAsBoolean();
LOGGER.info("Forcing leaf culling as requested by resourcepack");
}
if (json.has("forceHideInnerLeaves")) {
CullLeavesClient.forceHideInnerLeaves = json.get("forceHideInnerLeaves").getAsBoolean();
LOGGER.info("Not rendering inner leaves as requested by resourcepack");
}
} catch (IOException e) { throw new RuntimeException(e); }
});
}
}
}

View File

@@ -0,0 +1,32 @@
package eu.midnightdust.cullleaves;
import eu.midnightdust.lib.util.PlatformFunctions;
import org.objectweb.asm.tree.ClassNode;
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
import java.util.List;
import java.util.Set;
public class CullLeavesMixinPlugin implements IMixinConfigPlugin {
private String mixinPackage;
@Override
public void onLoad(String mixinPackage) {
this.mixinPackage = mixinPackage + ".";
}
@Override
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
final String mixinName = mixinClassName.substring(this.mixinPackage.length());
if (mixinName.indexOf('.') < 0) return true;
return PlatformFunctions.isModLoaded(mixinName.substring(0, mixinName.indexOf('.')));
}
@Override public List<String> getMixins() { return null; }
@Override public String getRefMapperConfig() { return null; }
@Override public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) {}
@Override public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {}
@Override public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {}
}

View File

@@ -1,10 +1,18 @@
package eu.midnightdust.cullleaves.config;
import eu.midnightdust.lib.config.MidnightConfig;
import net.minecraft.client.MinecraftClient;
public class CullLeavesConfig extends MidnightConfig {
@Entry // Enable/Disable the mod. Requires Chunk Reload (F3 + A).
public static boolean enabled = true;
@Entry // Fixes resourcepacks utilizing leaf culling flickering when using Sodium
public static boolean sodiumBlockFaceCullingFix = true;
@Entry // Enable/Disable culling on Mangrove Roots.
public static boolean cullRoots = true;
@Override
public void writeChanges(String modid) {
var client = MinecraftClient.getInstance();
if (client.world != null) client.worldRenderer.reload();
super.writeChanges(modid);
}
}

View File

@@ -0,0 +1,26 @@
package eu.midnightdust.cullleaves.mixin;
import eu.midnightdust.cullleaves.CullLeavesClient;
import net.minecraft.block.BlockState;
import net.minecraft.block.LeavesBlock;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.block.BlockModelRenderer;
import net.minecraft.client.render.model.BlockModelPart;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.BlockRenderView;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.List;
@Mixin(BlockModelRenderer.class)
public class MixinBlockModelRenderer {
@Inject(at = @At("HEAD"), method = "render(Lnet/minecraft/world/BlockRenderView;Ljava/util/List;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;ZI)V", cancellable = true)
private void cullleaves$cancelRendering(BlockRenderView world, List<BlockModelPart> parts, BlockState state, BlockPos pos, MatrixStack matrices, VertexConsumer vertexConsumer, boolean cull, int overlay, CallbackInfo ci) {
if (state.getBlock() instanceof LeavesBlock &&
CullLeavesClient.shouldHideBlock(world, pos)) ci.cancel();
}
}

View File

@@ -1,6 +1,6 @@
package eu.midnightdust.cullleaves.mixin;
import eu.midnightdust.cullleaves.config.CullLeavesConfig;
import eu.midnightdust.cullleaves.CullLeavesClient;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.Block;
@@ -18,11 +18,7 @@ public abstract class MixinLeavesBlock extends Block {
}
@Override
@SuppressWarnings("deprecation")
public boolean isSideInvisible(BlockState state, BlockState neighborState, Direction offset) {
if (CullLeavesConfig.enabled) {
return neighborState.getBlock() instanceof LeavesBlock;
}
else return false;
return CullLeavesClient.isLeafSideInvisible(neighborState);
}
}

View File

@@ -0,0 +1,22 @@
package eu.midnightdust.cullleaves.mixin;
import eu.midnightdust.cullleaves.CullLeavesClient;
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
public boolean isSideInvisible(BlockState state, BlockState neighborState, Direction offset) {
return CullLeavesClient.isRootSideInvisible(neighborState);
}
}

View File

@@ -1,72 +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.model.vertex.type.ChunkVertexType;
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 org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
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);
@Unique private boolean doFix = false;
@Unique private ChunkCameraContext camera;
@Unique private ChunkRenderBounds bounds;
public MixinRegionChunkRenderer(RenderDevice device, ChunkVertexType vertexType) {
super(device, vertexType);
}
@Inject(method = "buildDrawBatches", at = @At(value = "INVOKE", target = "Lme/jellysquid/mods/sodium/client/render/chunk/RenderSection;getBounds()Lme/jellysquid/mods/sodium/client/render/chunk/data/ChunkRenderBounds;", ordinal = 0))
public void cullleaves$shouldApplyTransparentBlockFaceCullingFix(List<RenderSection> sections, BlockRenderPass pass, ChunkCameraContext camera, CallbackInfoReturnable<Boolean> cir) {
doFix = pass.getAlphaCutoff() != 0 && CullLeavesConfig.enabled && CullLeavesConfig.sodiumBlockFaceCullingFix && this.isBlockFaceCullingEnabled;
this.camera = camera;
}
@Redirect(method = "buildDrawBatches", at = @At(value = "INVOKE", target = "Lme/jellysquid/mods/sodium/client/render/chunk/RenderSection;getBounds()Lme/jellysquid/mods/sodium/client/render/chunk/data/ChunkRenderBounds;", ordinal = 0))
public ChunkRenderBounds cullleaves$getChunkRenderBounds(RenderSection instance) {
bounds = instance.getBounds();
return bounds;
}
@Redirect(method = "buildDrawBatches", 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 ElementRange cullleaves$fixTransparentBlockFaceCulling(ChunkGraphicsState state, ModelQuadFacing facing) {
if (doFix) {
long indexOffset = state.getIndexSegment().getOffset();
int baseVertex = state.getVertexSegment().getOffset() / this.vertexFormat.getStride();
if (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);
}
}
}
return state.getModelPart(ModelQuadFacing.UNASSIGNED);
}
}

View 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"
}

View File

@@ -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.sodium":"Enables culling for leaves, providing a nice performance boost",
"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.sodiumBlockFaceCullingFix": "Fix Sodium Block Face Culling on Leaves"
"cullleaves.midnightconfig.cullRoots.tooltip":"Enables culling for mangrove roots.\n§cAfter changing this setting you have to reload all chunks (F3 + A)",
"cullleaves.midnightconfig.cullRoots.tooltip.sodium":"Enables culling for mangrove roots.",
"cullleaves.midnightconfig.cullRoots":"Enable Mangrove Root Culling"
}

View File

@@ -0,0 +1,9 @@
{
"cullleaves.midnightconfig.title": "Konfigurasi Cull Leaves",
"cullleaves.midnightconfig.enabled.tooltip": "Mendayakan penyorokan daun yang memberikan peningkatan prestasi yang bagus\n§cSelepas menukar tetapan ini, anda perlu memuat semula semua cebisan (F3 + A)",
"cullleaves.midnightconfig.enabled.tooltip.sodium": "Mendayakan penyorokan daun yang memberikan peningkatan prestasi yang bagus",
"cullleaves.midnightconfig.enabled": "Dayakan Penyorokan Daun",
"cullleaves.midnightconfig.cullRoots.tooltip": "Mendayakan penyorokan akar bakau.\n§cSelepas menukar tetapan ini, anda perlu memuat semula semua cebisan (F3 + A)",
"cullleaves.midnightconfig.cullRoots.tooltip.sodium": "Mendayakan penyorokan akar bakau.",
"cullleaves.midnightconfig.cullRoots": "Dayakan Penyorokan Akar Bakau"
}

View File

@@ -1,5 +1,10 @@
{
"cullleaves.midnightconfig.title":"Настройки Cull Leaves",
"cullleaves.midnightconfig.enabled.tooltip":"После изменения этого параметра необходимо перезагрузить чанки (F3 + A)",
"cullleaves.midnightconfig.enabled":"Включён Cull Leaves"
"cullleaves.midnightconfig.title": "Настройки отбраковки листьев",
"cullleaves.midnightconfig.enabled.tooltip": "Включает отбраковку листьев, что значительно повышает производительность.\n§cПосле изменения этого параметра вам необходимо перезагрузить все чанки (F3 + A)",
"cullleaves.midnightconfig.enabled.tooltip.sodium": "Включает отбраковку листьев, что значительно повышает производительность",
"cullleaves.midnightconfig.enabled": "Включить отбраковку листьев",
"cullleaves.midnightconfig.cullRoots.tooltip": "Включает отбраковку мангровых корней.\n§cПосле изменения этого параметра вам необходимо перезагрузить все чанки (F3 + A)",
"cullleaves.midnightconfig.cullRoots.tooltip.sodium": "Включает отбраковку мангровых корней.",
"cullleaves.midnightconfig.cullRoots": "Включить отбраковку мангровых корней",
"cullleaves.resourcepack.name": "§2Делает листья идентичными 'умным листьям' в OptiFine"
}

View File

@@ -0,0 +1,8 @@
{
"cullleaves.midnightconfig.title":"Конфігурація Cull Leaves",
"cullleaves.midnightconfig.enabled.tooltip":"Вмикає вибраковування листя, забезпечуючи хороше підвищення продуктивності.\n§cПісля зміни цього параметра ви повинні перезавантажити всі чанки (F3 + A)",
"cullleaves.midnightconfig.enabled.tooltip.sodium":"Вмикає вибраковування листя, забезпечуючи хороше підвищення продуктивності",
"cullleaves.midnightconfig.enabled":"Увімкнути вибраковування листя",
"cullleaves.midnightconfig.sodiumBlockFaceCullingFix.tooltip": "Виправляє пакети ресурсів, які використовують мерехтіння вибраковування листя при використанні Sodium.\nЙмовірно, ви хочете, щоб це було ввімкнено.",
"cullleaves.midnightconfig.sodiumBlockFaceCullingFix": "Виправити для мода Sodium вибраковування сторін блоку для листя"
}

View File

@@ -0,0 +1,8 @@
{
"cullleaves.midnightconfig.title":"Cấu hình Cull Leaves",
"cullleaves.midnightconfig.enabled.tooltip":"Cho phép loại bỏ các lá, giúp tăng hiệu suất tốt.\n§cSau khi thay đổi cài đặt này, bạn phải tải lại tất cả các chunk (F3 + A)",
"cullleaves.midnightconfig.enabled.tooltip.sodium":"Cho phép loại bỏ lá, giúp tăng hiệu suất tốt",
"cullleaves.midnightconfig.enabled":"Kích hoạt loại bỏ lá",
"cullleaves.midnightconfig.sodiumBlockFaceCullingFix.tooltip": "Sửa các gói tài nguyên sử dụng loại bỏ lá nhấp nháy khi sử dụng Sodium.\nBạn có thể muốn kích hoạt tính năng này.",
"cullleaves.midnightconfig.sodiumBlockFaceCullingFix": "Khắc phục hiện tượng loại bỏ mặt khối của Sodium trên lá"
}

View File

@@ -0,0 +1,9 @@
{
"cullleaves.midnightconfig.title":"Cull Leaves 选项",
"cullleaves.midnightconfig.enabled.tooltip":"剔除树叶,提升性能\n§c更改此选项后须要重新加载全部区块F3 + A",
"cullleaves.midnightconfig.enabled.tooltip.sodium":"剔除树叶,提升性能",
"cullleaves.midnightconfig.enabled":"启用树叶剔除",
"cullleaves.midnightconfig.cullRoots.tooltip":"启用红树根剔除\n§c更改此选项后须要重新加载全部区块F3 + A",
"cullleaves.midnightconfig.cullRoots.tooltip.sodium":"启用红树根剔除",
"cullleaves.midnightconfig.cullRoots":"启用红树根剔除"
}

View File

@@ -0,0 +1,8 @@
{
"cullleaves.midnightconfig.title":"Cull Leaves 設定",
"cullleaves.midnightconfig.enabled.tooltip":"在樹葉上啟用剃除,獲得良好的效能提升。\n§c更改此設定後您需要重新載入所有區塊F3 + A",
"cullleaves.midnightconfig.enabled.tooltip.sodium":"啟用樹葉剔除,獲得良好的效能提升",
"cullleaves.midnightconfig.enabled":"啟用樹葉剔除",
"cullleaves.midnightconfig.sodiumBlockFaceCullingFix.tooltip": "修復使用 Sodium 的資源包在使用葉子剔除時閃爍的問題。\n您可能想要將此功能啟用。",
"cullleaves.midnightconfig.sodiumBlockFaceCullingFix": "修復 Sodium 在葉子上的啟用方塊表面剔除"
}

View File

@@ -0,0 +1,9 @@
{
"cullleaves.midnightconfig.title": "کونفيݢوراسي Cull Leaves",
"cullleaves.midnightconfig.enabled.tooltip": "منداياکن ڤڽوروقن داٴون يڠ ممبريکن ڤنيڠکتن ڤريستاسي يڠ باݢوس\n§cسلڤس منوکر تتڤن اين⹁ اندا ڤرلو مموات سمولا سموا چبيسن (F3 + A)",
"cullleaves.midnightconfig.enabled.tooltip.sodium": "منداياکن ڤڽوروقن داٴون يڠ ممبريکن ڤنيڠکتن ڤريستاسي يڠ باݢوس",
"cullleaves.midnightconfig.enabled": "داياکن ڤڽوروقن داٴون",
"cullleaves.midnightconfig.cullRoots.tooltip": "منداياکن ڤڽوروقن اکر باکاو.\n§cسلڤس منوکر تتڤن اين⹁ اندا ڤرلو مموات سمولا سموا چبيسن (F3 + A)",
"cullleaves.midnightconfig.cullRoots.tooltip.sodium": "منداياکن ڤڽوروقن اکر باکاو.",
"cullleaves.midnightconfig.cullRoots": "داياکن ڤڽوروقن اکر باکاو"
}

View File

@@ -4,9 +4,9 @@
"compatibilityLevel": "JAVA_17",
"minVersion": "0.8",
"client": [
"MixinBlockModelRenderer",
"MixinLeavesBlock",
"MixinRegionChunkRenderer",
"MixinSodiumGameOptionPages"
"MixinMangroveRootsBlock"
],
"injectors": {
"defaultRequire": 1

View File

@@ -0,0 +1,3 @@
{
"forceLeafCulling": true
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/leaves_notint",
"textures": {
"all": "minecraft:block/azalea_leaves"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/leaves_notint",
"textures": {
"all": "minecraft:block/flowering_azalea_leaves"
}
}

View File

@@ -0,0 +1,73 @@
{
"credit": "made by Motschen",
"parent": "block/block",
"textures": {
"particle": "#all"
},
"elements": [
{
"name": "main",
"from": [0, 0, 0],
"to": [16, 16, 16],
"faces": {
"north": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "north"},
"east": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "east"},
"south": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "south"},
"west": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "west"},
"up": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "up"},
"down": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "down"}
}
},
{
"name": "bottom",
"from": [0, 0.01, 0],
"to": [16, 0.01, 16],
"faces": {
"up": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "down"}
}
},
{
"name": "west",
"from": [0.01, 0, 0],
"to": [0.01, 16, 16],
"faces": {
"east": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "west"}
}
},
{
"name": "north",
"from": [0, 0, 0.01],
"to": [16, 16, 0.01],
"faces": {
"south": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "north"}
}
},
{
"name": "east",
"from": [15.99, 0, 0],
"to": [15.99, 16, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [23, 8, 8]},
"faces": {
"west": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "east"}
}
},
{
"name": "south",
"from": [0, 0, 15.99],
"to": [16, 16, 15.99],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 8, 23]},
"faces": {
"north": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "south"}
}
},
{
"name": "up",
"from": [0, 15.99, 0],
"to": [16, 15.99, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 23, 8]},
"faces": {
"down": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "up"}
}
}
]
}

View File

@@ -1,6 +1,10 @@
{
"pack": {
"pack_format": 9,
"description": "§2Makes leaves look identical to OptiFine's smart leaves"
"pack_format": 15,
"supported_formats": [15, 99],
"description": {
"translate": "cullleaves.resourcepack.name",
"fallback": "§2Makes leaves look identical to OptiFine's smart leaves"
}
}
}

View File

@@ -12,5 +12,5 @@ dependencies {
// Remove the next line if you don't want to depend on the API
//modApi "dev.architectury:architectury-fabric:${rootProject.architectury_version}"
compileClasspath(project(path: ":common", configuration: "namedElements")) { transitive false }
compileOnly(project(path: ":common", configuration: "namedElements")) { transitive false }
}

View File

@@ -1,5 +1,6 @@
plugins {
id "com.github.johnrengelman.shadow" version "7.1.2"
id "me.shedaniel.unified-publishing"
}
architectury {
@@ -8,8 +9,6 @@ architectury {
fabric()
}
loom {
}
repositories {
maven { url "https://api.modrinth.com/maven" }
}
@@ -28,8 +27,8 @@ dependencies {
modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
// Remove the next line if you don't want to depend on the API
//modApi "dev.architectury:architectury-fabric:${rootProject.architectury_version}"
modImplementation "maven.modrinth:midnightlib:${rootProject.midnightlib_version}-fabric"
include "maven.modrinth:midnightlib:${rootProject.midnightlib_version}-fabric"
modImplementation include ("maven.modrinth:midnightlib:${rootProject.midnightlib_version}-fabric")
modImplementation "maven.modrinth:sodium:${rootProject.sodium_version}-fabric"
common(project(path: ":common", configuration: "namedElements")) { transitive false }
shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false }
@@ -45,21 +44,18 @@ processResources {
}
}
shadowJar {
exclude "architectury.common.json"
configurations = [project.configurations.shadowCommon]
classifier "dev-shadow"
archiveClassifier = "dev-shadow"
}
remapJar {
injectAccessWidener = true
input.set shadowJar.archiveFile
dependsOn shadowJar
classifier null
}
jar {
classifier "dev"
}
sourcesJar {
@@ -74,16 +70,42 @@ components.java {
}
}
publishing {
publications {
mavenFabric(MavenPublication) {
artifactId = rootProject.archives_base_name + "-" + project.name
from components.java
unifiedPublishing {
project {
displayName = "CullLeaves v$project.version - Fabric $project.minecraft_version"
releaseType = "$project.release_type"
changelog = releaseChangelog()
gameVersions = []
gameLoaders = ["fabric","quilt"]
mainPublication remapJar
relations {
depends {
curseforge = "fabric-api"
modrinth = "fabric-api"
}
includes {
curseforge = "midnightlib"
modrinth = "midnightlib"
}
}
var CURSEFORGE_TOKEN = project.findProperty("CURSEFORGE_TOKEN") ?: System.getenv("CURSEFORGE_TOKEN")
if (CURSEFORGE_TOKEN != null) {
curseforge {
token = CURSEFORGE_TOKEN
id = rootProject.curseforge_id
gameVersions.addAll "Java 17", project.minecraft_version
}
}
var MODRINTH_TOKEN = project.findProperty("MODRINTH_TOKEN") ?: System.getenv("MODRINTH_TOKEN")
if (MODRINTH_TOKEN != null) {
modrinth {
token = MODRINTH_TOKEN
id = rootProject.modrinth_id
version = "$project.version-$project.name"
gameVersions.addAll project.minecraft_version
}
}
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
}
}
}

View File

@@ -1,19 +1,33 @@
package eu.midnightdust.cullleaves.fabric;
import eu.midnightdust.cullleaves.CullLeavesClient;
import eu.midnightdust.cullleaves.config.CullLeavesConfig;
import eu.midnightdust.lib.config.MidnightConfig;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.resource.ResourceManagerHelper;
import net.fabricmc.fabric.api.resource.ResourcePackActivationType;
import net.fabricmc.fabric.api.resource.SimpleSynchronousResourceReloadListener;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.resource.ResourceManager;
import net.minecraft.resource.ResourceType;
import net.minecraft.util.Identifier;
public class CullLeavesClientFabric implements ClientModInitializer {
@Override
public void onInitializeClient() {
MidnightConfig.init("cullleaves", CullLeavesConfig.class);
MidnightConfig.init(CullLeavesClient.MOD_ID, CullLeavesConfig.class);
FabricLoader.getInstance().getModContainer("cullleaves").ifPresent(modContainer -> {
ResourceManagerHelper.registerBuiltinResourcePack(new Identifier("cullleaves:smartleaves"), modContainer, ResourcePackActivationType.NORMAL);
ResourceManagerHelper.registerBuiltinResourcePack(Identifier.of(CullLeavesClient.MOD_ID,"smartleaves"), modContainer, ResourcePackActivationType.NORMAL);
});
ResourceManagerHelper.get(ResourceType.CLIENT_RESOURCES).registerReloadListener(new SimpleSynchronousResourceReloadListener() {
@Override
public Identifier getFabricId() {
return Identifier.of(CullLeavesClient.MOD_ID, "resourcepack_options");
}
@Override
public void reload(ResourceManager manager) {
CullLeavesClient.ReloadListener.INSTANCE.reload(manager);
}
});
}
}

View File

@@ -0,0 +1,22 @@
package eu.midnightdust.cullleaves.fabric.mixin.sodium;
import eu.midnightdust.cullleaves.CullLeavesClient;
import net.caffeinemc.mods.sodium.client.render.chunk.compile.pipeline.BlockRenderer;
import net.caffeinemc.mods.sodium.client.render.frapi.render.AbstractBlockRenderContext;
import net.minecraft.block.BlockState;
import net.minecraft.block.LeavesBlock;
import net.minecraft.client.render.model.BlockStateModel;
import net.minecraft.util.math.BlockPos;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(BlockRenderer.class)
public abstract class MixinBlockRenderer extends AbstractBlockRenderContext {
@Inject(at = @At("HEAD"), method = "renderModel", cancellable = true)
public void cullleaves$cancelRendering(BlockStateModel model, BlockState state, BlockPos pos, BlockPos origin, CallbackInfo ci) {
if (state.getBlock() instanceof LeavesBlock && CullLeavesClient.shouldHideBlock(this.level, pos))
ci.cancel();
}
}

View File

@@ -1,13 +1,12 @@
package eu.midnightdust.cullleaves.mixin;
package eu.midnightdust.cullleaves.fabric.mixin.sodium;
import eu.midnightdust.cullleaves.config.CullLeavesConfig;
import me.jellysquid.mods.sodium.client.gui.SodiumGameOptionPages;
import me.jellysquid.mods.sodium.client.gui.options.OptionFlag;
import me.jellysquid.mods.sodium.client.gui.options.OptionGroup;
import me.jellysquid.mods.sodium.client.gui.options.OptionImpact;
import me.jellysquid.mods.sodium.client.gui.options.OptionImpl;
import me.jellysquid.mods.sodium.client.gui.options.control.TickBoxControl;
import me.jellysquid.mods.sodium.client.gui.options.storage.SodiumOptionsStorage;
import net.caffeinemc.mods.sodium.client.gui.options.OptionFlag;
import net.caffeinemc.mods.sodium.client.gui.options.OptionGroup;
import net.caffeinemc.mods.sodium.client.gui.options.OptionImpact;
import net.caffeinemc.mods.sodium.client.gui.options.OptionImpl;
import net.caffeinemc.mods.sodium.client.gui.options.control.TickBoxControl;
import net.caffeinemc.mods.sodium.client.gui.options.storage.SodiumOptionsStorage;
import net.minecraft.text.Text;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
@@ -17,7 +16,7 @@ import org.spongepowered.asm.mixin.injection.ModifyVariable;
import java.util.List;
@Mixin(value = SodiumGameOptionPages.class, remap = false)
@Mixin(value = net.caffeinemc.mods.sodium.client.gui.SodiumGameOptionPages.class, remap = false)
public class MixinSodiumGameOptionPages {
@Shadow @Final private static SodiumOptionsStorage sodiumOpts;
@@ -36,6 +35,17 @@ public class MixinSodiumGameOptionPages {
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
.setImpact(OptionImpact.MEDIUM)
.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()
);

View File

@@ -0,0 +1,14 @@
{
"required": true,
"package": "eu.midnightdust.cullleaves.fabric.mixin",
"plugin": "eu.midnightdust.cullleaves.CullLeavesMixinPlugin",
"compatibilityLevel": "JAVA_17",
"minVersion": "0.8",
"client": [
"sodium.MixinBlockRenderer",
"sodium.MixinSodiumGameOptionPages"
],
"injectors": {
"defaultRequire": 1
}
}

View File

@@ -26,11 +26,15 @@
},
"depends": {
"fabric-resource-loader-v0": "*",
"minecraft": ">=1.16"
"midnightlib": "*",
"minecraft": ">=1.21"
},
"breaks": {
"sodium": "<0.6.0"
},
"mixins": [
"cullleaves.mixins.json"
"cullleaves.mixins.json",
"cullleaves-fabric.mixins.json"
]
}

View File

@@ -1,90 +0,0 @@
plugins {
id "com.github.johnrengelman.shadow" version "7.1.2"
}
architectury {
injectInjectables = false
platformSetupLoomIde()
forge()
}
loom {
forge {
mixinConfig "cullleaves.mixins.json"
}
}
repositories {
maven { url "https://api.modrinth.com/maven" }
}
configurations {
common
shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this.
compileClasspath.extendsFrom common
runtimeClasspath.extendsFrom common
developmentForge.extendsFrom common
archivesBaseName = rootProject.archives_base_name + "-forge"
}
dependencies {
forge "net.minecraftforge:forge:${rootProject.forge_version}"
// Remove the next line if you don't want to depend on the API
//modApi "dev.architectury:architectury-forge:${rootProject.architectury_version}"
modImplementation "maven.modrinth:midnightlib:${rootProject.midnightlib_version}-forge"
include "maven.modrinth:midnightlib:${rootProject.midnightlib_version}-forge"
common(project(path: ":common", configuration: "namedElements")) { transitive false }
shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { transitive = false }
}
processResources {
inputs.property "version", project.version
filesMatching("META-INF/mods.toml") {
expand "version": project.version
}
}
shadowJar {
exclude "fabric.mod.json"
exclude "architectury.common.json"
configurations = [project.configurations.shadowCommon]
classifier "dev-shadow"
}
remapJar {
input.set shadowJar.archiveFile
dependsOn shadowJar
classifier null
}
jar {
classifier "dev"
}
sourcesJar {
def commonSources = project(":common").sourcesJar
dependsOn commonSources
from commonSources.archiveFile.map { zipTree(it) }
}
components.java {
withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
skip()
}
}
publishing {
publications {
mavenForge(MavenPublication) {
artifactId = rootProject.archives_base_name + "-" + project.name
from components.java
}
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
}
}

View File

@@ -1 +0,0 @@
loom.platform=forge

View File

@@ -1,33 +0,0 @@
package eu.midnightdust.cullleaves.forge;
import net.minecraft.resource.*;
import net.minecraft.resource.metadata.PackResourceMetadata;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.event.AddPackFindersEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.ModList;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.forgespi.locating.IModFile;
import net.minecraftforge.resource.PathPackResources;
import java.io.IOException;
@Mod.EventBusSubscriber(modid = "cullleaves", bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
public class CullLeavesClientEvents {
@SubscribeEvent
public static void addPackFinders(AddPackFindersEvent event) {
if (event.getPackType() == ResourceType.CLIENT_RESOURCES) {
registerResourcePack(event, new Identifier("cullleaves", "smartleaves"), false);
}
}
private static void registerResourcePack(AddPackFindersEvent event, Identifier id, boolean alwaysEnabled) {
event.addRepositorySource(((profileAdder, factory) -> {
IModFile file = ModList.get().getModFileById(id.getNamespace()).getFile();
try (PathPackResources pack = new PathPackResources(id.toString(), file.findResource("resourcepacks/"+id.getPath()))) {
profileAdder.accept(new ResourcePackProfile(id.toString(), alwaysEnabled, () -> pack, Text.of(id.getNamespace()+"/"+id.getPath()), pack.parseMetadata(PackResourceMetadata.READER).getDescription().copy().append(" §7(built-in)"), ResourcePackCompatibility.COMPATIBLE, ResourcePackProfile.InsertionPosition.TOP, false, ResourcePackSource.PACK_SOURCE_BUILTIN, false));
} catch (IOException | NullPointerException e) {e.printStackTrace();}
}));
}
}

View File

@@ -1,21 +0,0 @@
package eu.midnightdust.cullleaves.forge;
import eu.midnightdust.cullleaves.config.CullLeavesConfig;
import eu.midnightdust.lib.config.MidnightConfig;
import net.minecraftforge.client.ConfigScreenHandler;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.IExtensionPoint;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.network.NetworkConstants;
@Mod("cullleaves")
public class CullLeavesClientForge {
public CullLeavesClientForge() {
MidnightConfig.init("cullleaves", CullLeavesConfig.class);
ModLoadingContext.get().registerExtensionPoint(IExtensionPoint.DisplayTest.class, () -> new IExtensionPoint.DisplayTest(() -> NetworkConstants.IGNORESERVERONLY, (remote, server) -> true));
ModLoadingContext.get().registerExtensionPoint(ConfigScreenHandler.ConfigScreenFactory.class, () ->
new ConfigScreenHandler.ConfigScreenFactory((client, parent) -> MidnightConfig.getScreen(parent, "cullleaves")));
MinecraftForge.EVENT_BUS.register(new CullLeavesClientEvents());
}
}

View File

@@ -1,20 +1,24 @@
org.gradle.jvmargs=-Xmx4096M
minecraft_version=1.19.2
enabled_platforms=quilt,fabric,forge
minecraft_version=1.21.6
yarn_mappings=1.21.6+build.1
enabled_platforms=fabric,neoforge
archives_base_name=cullleaves
mod_version=3.0.1
mod_version=4.0.5
maven_group=eu.midnightdust
release_type=release
curseforge_id=423254
modrinth_id=GNxdLCoP
architectury_version=6.2.43
midnightlib_version=1.0.0
sodium_version=mc1.19.2-0.4.4
midnightlib_version=1.7.4+1.21.6
sodium_version=mc1.21.6-0.6.13
fabric_loader_version=0.14.9
fabric_api_version=0.59.0+1.19.2
fabric_loader_version=0.16.14
fabric_api_version=0.127.0+1.21.6
forge_version=1.19.2-43.0.8
neoforge_version=21.6.0-beta
yarn_mappings_patch_neoforge_version = 1.21+build.4
quilt_loader_version=0.17.2-beta.3
quilt_fabric_api_version=4.0.0-beta.7+0.59.0-1.19.2
quilt_loader_version=0.18.9
quilt_fabric_api_version=7.0.6+0.85.0-1.20.1

Binary file not shown.

View File

@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

12
gradlew vendored
View File

@@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -80,10 +80,10 @@ do
esac
done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
@@ -143,12 +143,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac

1
gradlew.bat vendored
View File

@@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

118
neoforge/build.gradle Normal file
View File

@@ -0,0 +1,118 @@
plugins {
id "com.github.johnrengelman.shadow" version "7.1.2"
id "me.shedaniel.unified-publishing"
}
architectury {
injectInjectables = false
platformSetupLoomIde()
neoForge()
}
loom {}
repositories {
maven { url "https://api.modrinth.com/maven" }
maven { url "https://maven.neoforged.net/releases" }
maven { url "https://maven.pkg.github.com/ims212/ForgifiedFabricAPI"
credentials {
username = "IMS212"
// Read only token
password = "ghp_" + "DEuGv0Z56vnSOYKLCXdsS9svK4nb9K39C1Hn"
}
}
maven{ url "https://maven.su5ed.dev/releases" }
}
configurations {
common
shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this.
compileClasspath.extendsFrom common
runtimeClasspath.extendsFrom common
developmentForge.extendsFrom common
archivesBaseName = rootProject.archives_base_name + "-neoforge"
}
dependencies {
neoForge "net.neoforged:neoforge:${rootProject.neoforge_version}"
// Remove the next line if you don't want to depend on the API
//modApi "dev.architectury:architectury-forge:${rootProject.architectury_version}"
modImplementation "maven.modrinth:midnightlib:${rootProject.midnightlib_version}-neoforge"
modImplementation "maven.modrinth:sodium:${rootProject.sodium_version}-neoforge"
//include "maven.modrinth:midnightlib:${rootProject.midnightlib_version}-forge"
common(project(path: ":common", configuration: "namedElements")) { transitive false }
shadowCommon(project(path: ":common", configuration: "transformProductionNeoForge")) { transitive = false }
}
processResources {
inputs.property "version", project.version
filesMatching("META-INF/neoforge.mods.toml") {
expand "version": project.version
}
}
shadowJar {
exclude "fabric.mod.json"
exclude "architectury.common.json"
configurations = [project.configurations.shadowCommon]
archiveClassifier = "dev-shadow"
}
remapJar {
input.set shadowJar.archiveFile
dependsOn shadowJar
}
sourcesJar {
def commonSources = project(":common").sourcesJar
dependsOn commonSources
from commonSources.archiveFile.map { zipTree(it) }
}
components.java {
withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
skip()
}
}
unifiedPublishing {
project {
displayName = "CullLeaves v$project.version - NeoForge $project.minecraft_version"
releaseType = "$project.release_type"
changelog = releaseChangelog()
gameVersions = []
gameLoaders = ["neoforge"]
mainPublication remapJar
relations {
depends {
curseforge = "midnightlib"
modrinth = "midnightlib"
}
includes {}
}
var CURSEFORGE_TOKEN = project.findProperty("CURSEFORGE_TOKEN") ?: System.getenv("CURSEFORGE_TOKEN")
if (CURSEFORGE_TOKEN != null) {
curseforge {
token = CURSEFORGE_TOKEN
id = rootProject.curseforge_id
gameVersions.addAll "Java 17", project.minecraft_version
releaseType = "alpha"
}
}
var MODRINTH_TOKEN = project.findProperty("MODRINTH_TOKEN") ?: System.getenv("MODRINTH_TOKEN")
if (MODRINTH_TOKEN != null) {
modrinth {
token = MODRINTH_TOKEN
id = rootProject.modrinth_id
version = "$project.version-$project.name"
gameVersions.addAll project.minecraft_version
}
}
}
}

View File

@@ -0,0 +1 @@
loom.platform=neoforge

View File

@@ -0,0 +1,42 @@
package eu.midnightdust.cullleaves.neoforge;
import eu.midnightdust.cullleaves.CullLeavesClient;
import net.minecraft.resource.*;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.ModList;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.neoforge.client.event.AddClientReloadListenersEvent;
import net.neoforged.neoforge.event.AddPackFindersEvent;
import net.neoforged.neoforgespi.locating.IModFile;
import java.util.Optional;
@EventBusSubscriber(modid = CullLeavesClient.MOD_ID, bus = EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
public class CullLeavesClientEvents {
@SubscribeEvent
public static void addPackFinders(AddPackFindersEvent event) {
if (event.getPackType() == ResourceType.CLIENT_RESOURCES) {
registerResourcePack(event, Identifier.of(CullLeavesClient.MOD_ID, "smartleaves"), false);
}
}
private static void registerResourcePack(AddPackFindersEvent event, Identifier id, boolean alwaysEnabled) {
event.addRepositorySource(((profileAdder) -> {
IModFile file = ModList.get().getModFileById(id.getNamespace()).getFile();
try {
ResourcePackProfile.PackFactory pack = new DirectoryResourcePack.DirectoryBackedFactory(file.findResource("resourcepacks/" + id.getPath()));
ResourcePackInfo info = new ResourcePackInfo(id.toString(), Text.of(id.getNamespace()+"/"+id.getPath()), ResourcePackSource.BUILTIN, Optional.empty());
ResourcePackProfile packProfile = ResourcePackProfile.create(info, pack, ResourceType.CLIENT_RESOURCES, new ResourcePackPosition(alwaysEnabled, ResourcePackProfile.InsertionPosition.TOP, false));
if (packProfile != null) {
profileAdder.accept(packProfile);
}
} catch (NullPointerException e) {e.fillInStackTrace();}
}));
}
@SubscribeEvent
public static void onResourceReload(AddClientReloadListenersEvent event) {
event.addListener(Identifier.of(CullLeavesClient.MOD_ID, "resourcepack_options"), CullLeavesClient.ReloadListener.INSTANCE);
}
}

View File

@@ -0,0 +1,12 @@
package eu.midnightdust.cullleaves.neoforge;
import eu.midnightdust.cullleaves.config.CullLeavesConfig;
import eu.midnightdust.lib.config.MidnightConfig;
import net.neoforged.fml.common.Mod;
@Mod("cullleaves")
public class CullLeavesClientForge {
public CullLeavesClientForge() {
MidnightConfig.init("cullleaves", CullLeavesConfig.class);
}
}

View File

@@ -0,0 +1,26 @@
package eu.midnightdust.cullleaves.neoforge.mixin.sodium;
import eu.midnightdust.cullleaves.CullLeavesClient;
import net.caffeinemc.mods.sodium.client.render.chunk.compile.pipeline.BlockRenderer;
import net.minecraft.block.BlockState;
import net.minecraft.block.LeavesBlock;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.model.BlockStateModel;
import net.minecraft.util.math.BlockPos;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(BlockRenderer.class)
public abstract class MixinBlockRenderer {
// Unfortunately, we cannot use the level view from AbstractBlockRenderContext on NeoForge because of method conflicts
@Unique private static final MinecraftClient cullleaves$client = MinecraftClient.getInstance();
@Inject(at = @At("HEAD"), method = "renderModel", cancellable = true)
public void cullleaves$cancelRendering(BlockStateModel model, BlockState state, BlockPos pos, BlockPos origin, CallbackInfo ci) {
if (CullLeavesClient.forceHideInnerLeaves && state.getBlock() instanceof LeavesBlock && CullLeavesClient.shouldHideBlock(cullleaves$client.world, pos))
ci.cancel();
}
}

View File

@@ -0,0 +1,57 @@
package eu.midnightdust.cullleaves.neoforge.mixin.sodium;
import eu.midnightdust.cullleaves.CullLeavesClient;
import eu.midnightdust.cullleaves.config.CullLeavesConfig;
import net.caffeinemc.mods.sodium.client.gui.SodiumGameOptionPages;
import net.caffeinemc.mods.sodium.client.gui.options.OptionFlag;
import net.caffeinemc.mods.sodium.client.gui.options.OptionGroup;
import net.caffeinemc.mods.sodium.client.gui.options.OptionImpact;
import net.caffeinemc.mods.sodium.client.gui.options.OptionImpl;
import net.caffeinemc.mods.sodium.client.gui.options.control.TickBoxControl;
import net.caffeinemc.mods.sodium.client.gui.options.storage.SodiumOptionsStorage;
import net.minecraft.text.Text;
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.ModifyVariable;
import java.util.List;
@Mixin(value = SodiumGameOptionPages.class, remap = false)
public class MixinSodiumGameOptionPages {
@Shadow @Final private static SodiumOptionsStorage sodiumOpts;
@ModifyVariable(method = "performance", at = @At(value = "INVOKE", target = "Lcom/google/common/collect/ImmutableList;copyOf(Ljava/util/Collection;)Lcom/google/common/collect/ImmutableList;"))
private static List<OptionGroup> cullleaves$addCullLeavesOption(List<OptionGroup> groups) {
groups.add(OptionGroup.createBuilder()
.add(OptionImpl.createBuilder(boolean.class, sodiumOpts)
.setName(Text.translatable("cullleaves.midnightconfig.enabled"))
.setTooltip(Text.translatable("cullleaves.midnightconfig.enabled.tooltip.sodium"))
.setControl(TickBoxControl::new)
.setBinding((opts, value) -> {
CullLeavesConfig.enabled = value;
CullLeavesConfig.write(CullLeavesClient.MOD_ID);
}, opts -> CullLeavesConfig.enabled)
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
.setImpact(OptionImpact.MEDIUM)
.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(CullLeavesClient.MOD_ID);
}, opts -> CullLeavesConfig.cullRoots)
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
.setImpact(OptionImpact.MEDIUM)
.build()
)
.build()
);
return groups;
}
}

View File

@@ -1,5 +1,5 @@
modLoader = "javafml"
loaderVersion = "[43,)"
loaderVersion = "[1,)"
#issueTrackerURL = ""
license = "MIT License"
@@ -13,23 +13,29 @@ Adds culling to leaf blocks, providing a huge performance boost over vanilla.
'''
logoFile = "icon.png"
[[mixins]]
config = "cullleaves.mixins.json"
[[mixins]]
config = "cullleaves-neoforge.mixins.json"
[[dependencies.cullleaves]]
modId = "forge"
mandatory = true
versionRange = "[43,)"
modId = "neoforge"
required = true
versionRange = "[20.3,)"
ordering = "NONE"
side = "CLIENT"
[[dependencies.cullleaves]]
modId = "minecraft"
mandatory = true
versionRange = "[1.19.2,)"
required = true
versionRange = "[1.21,)"
ordering = "NONE"
side = "CLIENT"
[[dependencies.cullleaves]]
modId = "midnightlib"
mandatory = true
required = true
versionRange = "[1.0.0,)"
ordering = "BEFORE"
ordering = "AFTER"
side = "CLIENT"

View File

@@ -0,0 +1,13 @@
{
"required": true,
"package": "eu.midnightdust.cullleaves.neoforge.mixin",
"compatibilityLevel": "JAVA_17",
"minVersion": "0.8",
"client": [
"sodium.MixinBlockRenderer",
"sodium.MixinSodiumGameOptionPages"
],
"injectors": {
"defaultRequire": 1
}
}

View File

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@@ -4,21 +4,7 @@
"group": "${group}",
"id": "cullleaves",
"version": "${version}",
"name": "Cull Leaves",
"description": "Adds culling to leaf blocks, providing a huge performance boost over vanilla.",
"authors": [
"Motschen",
"TeamMidnightDust"
],
"contact": {
"homepage": "https://www.midnightdust.eu/",
"sources": "https://github.com/TeamMidnightDust/MidnightLib",
"issues": "https://github.com/TeamMidnightDust/MidnightLib/issues"
},
"license": "MIT",
"icon": "assets/cullleaves/icon.png",
"intermediate_mappings": "net.fabricmc:intermediary",
"environment": "client",
"entrypoints": {
"client_init": [
"eu.midnightdust.cullleaves.quilt.CullLeavesClientQuilt"
@@ -38,6 +24,12 @@
"version": "*"
}
],
"breaks": [
{
"id": "sodium",
"versions": "<0.4.9"
}
],
"metadata": {
"name": "Cull Leaves (Quilt)",
"description": "Adds culling to leaf blocks, providing a huge performance boost over vanilla.",
@@ -45,6 +37,7 @@
"Motschen": "Author",
"TeamMidnightDust": "Mascot"
},
"environment": "client",
"contact": {
"email": "mail@midnightdust.eu",
"homepage": "https://modrinth.com/mod/cullleaves",

View File

@@ -2,7 +2,7 @@ pluginManagement {
repositories {
maven { url "https://maven.fabricmc.net/" }
maven { url "https://maven.architectury.dev/" }
maven { url "https://maven.minecraftforge.net/" }
maven { url "https://maven.neoforged.net/releases" }
gradlePluginPortal()
}
}
@@ -10,7 +10,7 @@ pluginManagement {
include("common")
include("fabric-like")
include("fabric")
include("quilt")
include("forge")
//include("quilt")
include("neoforge")
rootProject.name = "cullleaves"