Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9dbb817

Browse files
committed
backport to 1.21.1
1 parent aa31478 commit 9dbb817

41 files changed

Lines changed: 571 additions & 357 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,11 @@
55
/run/
66
/out/
77
/logs/
8+
9+
bin/
10+
.classpath
11+
.project
12+
*.launch
13+
.settings/
14+
15+
.vscode/

build.gradle

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -106,29 +106,32 @@ dependencies {
106106
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
107107

108108
//TODO: this is to eventually not need sodium installed as atm its just used for parsing shaders
109-
modRuntimeOnlyMsk "maven.modrinth:sodium:mc1.21.10-0.7.2-fabric"
110-
modCompileOnly "maven.modrinth:sodium:mc1.21.10-0.7.2-fabric"
109+
modRuntimeOnlyMsk "maven.modrinth:sodium:mc1.21.1-0.6.13-fabric"
110+
modCompileOnly "maven.modrinth:sodium:mc1.21.1-0.6.13-fabric"
111111

112-
modImplementation("maven.modrinth:lithium:mc1.21.10-0.20.0-fabric")
112+
modImplementation("maven.modrinth:lithium:mc1.21.1-0.15.0-fabric")
113113

114-
//modRuntimeOnlyMsk "drouarb:nvidium:0.4.1-beta4:1.21.6@jar"
115-
modCompileOnly "drouarb:nvidium:0.4.1-beta4:1.21.6@jar"
114+
modRuntimeOnlyMsk "drouarb:nvidium:0.4.1-beta9:1.21-1.21.1@jar"
115+
modCompileOnly "drouarb:nvidium:0.4.1-beta9:1.21-1.21.1@jar"
116116

117-
modCompileOnly("maven.modrinth:modmenu:15.0.0")
118-
//modRuntimeOnlyMsk("maven.modrinth:modmenu:15.0.0")
117+
modCompileOnly("maven.modrinth:modmenu:11.0.3")
118+
modRuntimeOnlyMsk("maven.modrinth:modmenu:11.0.3")
119119

120-
modCompileOnly("maven.modrinth:iris:1.9.6+1.21.10-fabric")
121-
modRuntimeOnlyMsk("maven.modrinth:iris:1.9.6+1.21.10-fabric")
120+
modCompileOnly("maven.modrinth:iris:1.8.8+1.21.1-fabric")
121+
modRuntimeOnlyMsk("maven.modrinth:iris:1.8.8+1.21.1-fabric")
122+
// iris needs these for some reason
123+
modRuntimeOnlyMsk("io.github.douira:glsl-transformer:2.0.1")
124+
modRuntimeOnlyMsk("org.anarres:jcpp:1.4.14")
122125

123126
//modCompileOnly("maven.modrinth:starlight:1.1.3+1.20.4")
124127

125128
//modCompileOnly("maven.modrinth:immersiveportals:v5.1.7-mc1.20.4")
126129

127-
modCompileOnly("maven.modrinth:sodium-extra:mc1.21.10-0.7.1+fabric")
128-
modRuntimeOnlyMsk("maven.modrinth:sodium-extra:mc1.21.10-0.7.1+fabric")
130+
modCompileOnly("maven.modrinth:sodium-extra:mc1.21.1-0.6.0+fabric")
131+
modRuntimeOnlyMsk("maven.modrinth:sodium-extra:mc1.21.1-0.6.0+fabric")
129132

130-
modCompileOnly("maven.modrinth:chunky:1.4.40-fabric")
131-
//modRuntimeOnlyMsk("maven.modrinth:chunky:1.4.40-fabric")
133+
modCompileOnly("maven.modrinth:chunky:1.4.23-fabric")
134+
modRuntimeOnlyMsk("maven.modrinth:chunky:1.4.23-fabric")
132135

133136
modRuntimeOnlyMsk("maven.modrinth:spark:1.10.152-fabric")
134137
modRuntimeOnlyMsk("maven.modrinth:fabric-permissions-api:0.3.3")

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ org.gradle.daemon = false
77

88
# Fabric Properties
99
# check these on https://modmuss50.me/fabric.html
10-
minecraft_version=1.21.10
10+
minecraft_version=1.21.1
1111
loader_version=0.17.2
1212
loom_version=1.11-SNAPSHOT
1313

1414
# Fabric API
15-
fabric_version=0.134.1+1.21.10
15+
fabric_version=0.116.6+1.21.1
1616

1717

1818
# Mod Properties

src/main/java/me/cortex/voxy/client/VoxyClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import net.fabricmc.api.ClientModInitializer;
99
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
1010
import net.fabricmc.loader.api.FabricLoader;
11-
import net.minecraft.client.gui.components.debug.DebugScreenEntries;
11+
// import net.minecraft.client.gui.components.debug.DebugScreenEntries;
1212
import net.minecraft.resources.ResourceLocation;
1313
import java.util.HashSet;
1414
import java.util.function.Consumer;
@@ -39,7 +39,7 @@ public static void initVoxyClient() {
3939

4040
@Override
4141
public void onInitializeClient() {
42-
DebugScreenEntries.register(ResourceLocation.fromNamespaceAndPath("voxy","debug"), new VoxyDebugScreenEntry());
42+
// DebugScreenEntries.register(ResourceLocation.fromNamespaceAndPath("voxy","debug"), new VoxyDebugScreenEntry());
4343
ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> {
4444
if (VoxyCommon.isAvailable()) {
4545
dispatcher.register(VoxyCommands.register());
Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,50 @@
1-
package me.cortex.voxy.client;
2-
3-
import me.cortex.voxy.client.core.IGetVoxyRenderSystem;
4-
import me.cortex.voxy.client.core.VoxyRenderSystem;
5-
import me.cortex.voxy.commonImpl.VoxyCommon;
6-
import net.minecraft.ChatFormatting;
7-
import net.minecraft.client.Minecraft;
8-
import net.minecraft.client.gui.components.debug.DebugScreenDisplayer;
9-
import net.minecraft.client.gui.components.debug.DebugScreenEntry;
10-
import net.minecraft.resources.ResourceLocation;
11-
import net.minecraft.world.level.Level;
12-
import net.minecraft.world.level.chunk.LevelChunk;
13-
import org.jetbrains.annotations.Nullable;
14-
15-
import java.util.ArrayList;
16-
import java.util.List;
17-
18-
public class VoxyDebugScreenEntry implements DebugScreenEntry {
19-
@Override
20-
public void display(DebugScreenDisplayer lines, @Nullable Level world, @Nullable LevelChunk clientChunk, @Nullable LevelChunk chunk) {
21-
if (!VoxyCommon.isAvailable()) {
22-
lines.addLine(ChatFormatting.RED + "voxy-"+VoxyCommon.MOD_VERSION);//Voxy installed, not avalible
23-
return;
24-
}
25-
var instance = VoxyCommon.getInstance();
26-
if (instance == null) {
27-
lines.addLine(ChatFormatting.YELLOW + "voxy-" + VoxyCommon.MOD_VERSION);//Voxy avalible, no instance active
28-
return;
29-
}
30-
VoxyRenderSystem vrs = null;
31-
var wr = Minecraft.getInstance().levelRenderer;
32-
if (wr != null) vrs = ((IGetVoxyRenderSystem) wr).getVoxyRenderSystem();
33-
34-
//Voxy instance active
35-
lines.addLine((vrs==null?ChatFormatting.DARK_GREEN:ChatFormatting.GREEN)+"voxy-"+VoxyCommon.MOD_VERSION);
36-
37-
//lines.addLineToSection();
38-
List<String> instanceLines = new ArrayList<>();
39-
instance.addDebug(instanceLines);
40-
lines.addToGroup(ResourceLocation.fromNamespaceAndPath("voxy", "instance_debug"), instanceLines);
41-
42-
if (vrs != null) {
43-
List<String> renderLines = new ArrayList<>();
44-
vrs.addDebugInfo(renderLines);
45-
lines.addToGroup(ResourceLocation.fromNamespaceAndPath("voxy", "render_debug"), renderLines);
46-
}
47-
}
48-
49-
50-
}
1+
// package me.cortex.voxy.client;
2+
3+
// import me.cortex.voxy.client.core.IGetVoxyRenderSystem;
4+
// import me.cortex.voxy.client.core.VoxyRenderSystem;
5+
// import me.cortex.voxy.commonImpl.VoxyCommon;
6+
// import net.minecraft.ChatFormatting;
7+
// import net.minecraft.client.Minecraft;
8+
// import net.minecraft.client.gui.components.debug.DebugScreenDisplayer;
9+
// import net.minecraft.client.gui.components.debug.DebugScreenEntry;
10+
// import net.minecraft.resources.ResourceLocation;
11+
// import net.minecraft.world.level.Level;
12+
// import net.minecraft.world.level.chunk.LevelChunk;
13+
// import org.jetbrains.annotations.Nullable;
14+
15+
// import java.util.ArrayList;
16+
// import java.util.List;
17+
18+
// public class VoxyDebugScreenEntry implements DebugScreenEntry {
19+
// @Override
20+
// public void display(DebugScreenDisplayer lines, @Nullable Level world, @Nullable LevelChunk clientChunk, @Nullable LevelChunk chunk) {
21+
// if (!VoxyCommon.isAvailable()) {
22+
// lines.addLine(ChatFormatting.RED + "voxy-"+VoxyCommon.MOD_VERSION);//Voxy installed, not avalible
23+
// return;
24+
// }
25+
// var instance = VoxyCommon.getInstance();
26+
// if (instance == null) {
27+
// lines.addLine(ChatFormatting.YELLOW + "voxy-" + VoxyCommon.MOD_VERSION);//Voxy avalible, no instance active
28+
// return;
29+
// }
30+
// VoxyRenderSystem vrs = null;
31+
// var wr = Minecraft.getInstance().levelRenderer;
32+
// if (wr != null) vrs = ((IGetVoxyRenderSystem) wr).getVoxyRenderSystem();
33+
34+
// //Voxy instance active
35+
// lines.addLine((vrs==null?ChatFormatting.DARK_GREEN:ChatFormatting.GREEN)+"voxy-"+VoxyCommon.MOD_VERSION);
36+
37+
// //lines.addLineToSection();
38+
// List<String> instanceLines = new ArrayList<>();
39+
// instance.addDebug(instanceLines);
40+
// lines.addToGroup(ResourceLocation.fromNamespaceAndPath("voxy", "instance_debug"), instanceLines);
41+
42+
// if (vrs != null) {
43+
// List<String> renderLines = new ArrayList<>();
44+
// vrs.addDebugInfo(renderLines);
45+
// lines.addToGroup(ResourceLocation.fromNamespaceAndPath("voxy", "render_debug"), renderLines);
46+
// }
47+
// }
48+
49+
50+
// }
Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
11
package me.cortex.voxy.client.compat;
22

3-
import me.flashyreese.mods.sodiumextra.client.SodiumExtraClientMod;
43
import net.fabricmc.loader.api.FabricLoader;
54

65
public class SodiumExtra {
76
public static final boolean HAS_SODIUM_EXTRA = FabricLoader.getInstance().isModLoaded("sodium-extra");
87
public static boolean useSodiumExtraCulling() {
9-
if (!HAS_SODIUM_EXTRA) {
10-
return false;
11-
}
12-
return useSodiumExtraCulling0();
13-
}
14-
15-
private static boolean useSodiumExtraCulling0() {
16-
return !SodiumExtraClientMod.options().renderSettings.globalFog;
8+
return HAS_SODIUM_EXTRA;
179
}
1810
}

src/main/java/me/cortex/voxy/client/config/VoxyConfig.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ public class VoxyConfig implements OptionStorage<VoxyConfig> {
3131
public int serviceThreads = (int) Math.max(CpuLayout.getCoreCount()/1.5, 1);
3232
public float subDivisionSize = 64;
3333
public boolean renderVanillaFog = false;
34-
public boolean useEnvironmentalFog = false;
3534
public boolean renderStatistics = false;
3635
public boolean dontUseSodiumBuilderThreads = false;
3736

src/main/java/me/cortex/voxy/client/config/VoxyConfigScreenPages.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,6 @@ public static OptionPage page() {
136136
}, s -> s.sectionRenderDistance)
137137
.setImpact(OptionImpact.LOW)
138138
.build()
139-
).add(OptionImpl.createBuilder(boolean.class, storage)
140-
.setName(Component.translatable("voxy.config.general.environmental_fog"))
141-
.setTooltip(Component.translatable("voxy.config.general.environmental_fog.tooltip"))
142-
.setControl(TickBoxControl::new)
143-
.setImpact(OptionImpact.VARIES)
144-
.setBinding((s, v)-> s.useEnvironmentalFog = v, s -> s.useEnvironmentalFog)
145-
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
146-
.build()
147139
).add(OptionImpl.createBuilder(boolean.class, storage)
148140
.setName(Component.translatable("voxy.config.general.vanilla_fog"))
149141
.setTooltip(Component.translatable("voxy.config.general.vanilla_fog.tooltip"))

src/main/java/me/cortex/voxy/client/core/NormalRenderPipeline.java

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ public class NormalRenderPipeline extends AbstractRenderPipeline {
3939
private final GlFramebuffer fbSSAO = new GlFramebuffer();
4040
private final DepthFramebuffer fb = new DepthFramebuffer(GL_DEPTH24_STENCIL8);
4141

42-
private final boolean useEnvFog;
4342
private final FullscreenBlit finalBlit;
4443

4544
private final Shader ssaoCompute = Shader.make()
@@ -48,9 +47,8 @@ public class NormalRenderPipeline extends AbstractRenderPipeline {
4847

4948
protected NormalRenderPipeline(AsyncNodeManager nodeManager, NodeCleaner nodeCleaner, HierarchicalOcclusionTraverser traversal, BooleanSupplier frexSupplier) {
5049
super(nodeManager, nodeCleaner, traversal, frexSupplier);
51-
this.useEnvFog = VoxyConfig.CONFIG.useEnvironmentalFog;
5250
this.finalBlit = new FullscreenBlit("voxy:post/blit_texture_depth_cutout.frag",
53-
a->a.defineIf("USE_ENV_FOG", this.useEnvFog).define("EMIT_COLOUR"));
51+
a->a.define("EMIT_COLOUR"));
5452
}
5553

5654
@Override
@@ -105,19 +103,6 @@ protected void postOpaquePreTranslucent(Viewport<?> viewport) {
105103
@Override
106104
protected void finish(Viewport<?> viewport, int sourceFrameBuffer, int srcWidth, int srcHeight) {
107105
this.finalBlit.bind();
108-
if (this.useEnvFog) {
109-
float start = viewport.fogParameters.environmentalStart();
110-
float end = viewport.fogParameters.environmentalEnd();
111-
if (Math.abs(end-start)>1) {
112-
float invEndFogDelta = 1f / (end - start);
113-
float endDistance = (float) Math.sqrt(Math.pow(Minecraft.getInstance().gameRenderer.getRenderDistance(),2)*3);
114-
glUniform4f(4, invEndFogDelta, -start * invEndFogDelta, Math.min(1,endDistance/end),0);
115-
glUniform4f(5, viewport.fogParameters.red(), viewport.fogParameters.green(), viewport.fogParameters.blue(), viewport.fogParameters.alpha());
116-
} else {
117-
glUniform4f(4, 0, 0, 0, 0);
118-
glUniform4f(5, 0, 0, 0, 0);
119-
}
120-
}
121106

122107
glBindTextureUnit(3, this.colourSSAOTex.id);
123108

src/main/java/me/cortex/voxy/client/core/VoxyRenderSystem.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package me.cortex.voxy.client.core;
22

3-
import com.mojang.blaze3d.opengl.GlConst;
4-
import com.mojang.blaze3d.opengl.GlStateManager;
3+
import com.mojang.blaze3d.platform.GlConst;
4+
import com.mojang.blaze3d.platform.GlStateManager;
55
import me.cortex.voxy.client.TimingStatistics;
66
import me.cortex.voxy.client.VoxyClient;
77
import me.cortex.voxy.client.config.VoxyConfig;
@@ -33,7 +33,6 @@
3333
import me.cortex.voxy.common.world.WorldEngine;
3434
import me.cortex.voxy.commonImpl.VoxyCommon;
3535
import net.caffeinemc.mods.sodium.client.render.chunk.ChunkRenderMatrices;
36-
import net.caffeinemc.mods.sodium.client.util.FogParameters;
3736
import net.minecraft.client.Minecraft;
3837
import org.joml.Matrix4f;
3938
import org.joml.Matrix4fc;
@@ -43,8 +42,12 @@
4342
import java.util.List;
4443

4544
import static org.lwjgl.opengl.GL11.GL_VIEWPORT;
45+
import static org.lwjgl.opengl.GL11.glEnable;
46+
import static org.lwjgl.opengl.GL11.glFinish;
4647
import static org.lwjgl.opengl.GL11.glGetIntegerv;
48+
import static org.lwjgl.opengl.GL11.glViewport;
4749
import static org.lwjgl.opengl.GL11C.*;
50+
import static org.lwjgl.opengl.GL30.glGetIntegeri;
4851
import static org.lwjgl.opengl.GL30C.*;
4952
import static org.lwjgl.opengl.GL33.glBindSampler;
5053
import static org.lwjgl.opengl.GL43.GL_SHADER_STORAGE_BUFFER;
@@ -121,8 +124,8 @@ public VoxyRenderSystem(WorldEngine world, ServiceManager sm) {
121124
this.viewportSelector = new ViewportSelector<>(sectionRenderer::createViewport);
122125

123126
{
124-
int minSec = Minecraft.getInstance().level.getMinSectionY() >> 5;
125-
int maxSec = (Minecraft.getInstance().level.getMaxSectionY() - 1) >> 5;
127+
int minSec = Minecraft.getInstance().level.getMinSection() >> 5;
128+
int maxSec = (Minecraft.getInstance().level.getMaxSection() - 1) >> 5;
126129

127130
//Do some very cheeky stuff for MiB
128131
if (VoxyCommon.IS_MINE_IN_ABYSS) {//TODO: make this somehow configurable
@@ -159,7 +162,7 @@ public VoxyRenderSystem(WorldEngine world, ServiceManager sm) {
159162
}
160163

161164

162-
public Viewport<?> setupViewport(ChunkRenderMatrices matrices, FogParameters fogParameters, double cameraX, double cameraY, double cameraZ) {
165+
public Viewport<?> setupViewport(ChunkRenderMatrices matrices, double cameraX, double cameraY, double cameraZ) {
163166
var viewport = this.getViewport();
164167
if (viewport == null) {
165168
return null;
@@ -197,7 +200,6 @@ public Viewport<?> setupViewport(ChunkRenderMatrices matrices, FogParameters fog
197200
.setModelView(new Matrix4f(matrices.modelView()))
198201
.setCamera(cameraX, cameraY, cameraZ)
199202
.setScreenSize(width, height)
200-
.setFogParameters(fogParameters)
201203
.update();
202204

203205
if (VoxyClient.getOcclusionDebugState()==0) {
@@ -363,7 +365,7 @@ private static Matrix4f makeProjectionMatrix(float near, float far) {
363365
var client = Minecraft.getInstance();
364366
var gameRenderer = client.gameRenderer;//tickCounter.getTickDelta(true);
365367

366-
float fov = gameRenderer.getFov(gameRenderer.getMainCamera(), client.getDeltaTracker().getGameTimeDeltaPartialTick(true), true);
368+
float fov = (float)gameRenderer.getFov(gameRenderer.getMainCamera(), client.getTimer().getGameTimeDeltaPartialTick(true), true);
367369

368370
projection.setPerspective(fov * 0.01745329238474369f,
369371
(float) client.getWindow().getWidth() / (float)client.getWindow().getHeight(),

0 commit comments

Comments
 (0)