Update to 1.21

This commit is contained in:
mcrcortex
2024-06-29 22:00:01 +09:00
parent 16e37d9b77
commit 67edb4a44b
17 changed files with 67 additions and 145 deletions

View File

@@ -1,5 +1,5 @@
plugins { plugins {
id 'fabric-loom' version "1.5.7" id 'fabric-loom' version "1.7.1"
id 'maven-publish' id 'maven-publish'
} }
@@ -49,15 +49,15 @@ dependencies {
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
//TODO: this is to eventually not need sodium installed as atm its just used for parsing shaders //TODO: this is to eventually not need sodium installed as atm its just used for parsing shaders
modRuntimeOnly "maven.modrinth:sodium:mc1.20.4-0.5.8" modRuntimeOnly "maven.modrinth:sodium:mc1.21-0.5.9"
modCompileOnly "maven.modrinth:sodium:mc1.20.4-0.5.8" modCompileOnly "maven.modrinth:sodium:mc1.21-0.5.9"
//modRuntimeOnly "maven.modrinth:nvidium:0.2.6-beta" //modRuntimeOnly "maven.modrinth:nvidium:0.2.6-beta"
modCompileOnly "maven.modrinth:nvidium:0.2.6-beta" modCompileOnly "maven.modrinth:nvidium:0.2.8-beta"
modImplementation("maven.modrinth:cloth-config:13.0.121+fabric") modImplementation("maven.modrinth:cloth-config:13.0.121+fabric")
modImplementation("maven.modrinth:modmenu:9.0.0") modImplementation("maven.modrinth:modmenu:11.0.1")
modCompileOnly("maven.modrinth:iris:1.6.17+1.20.4") modCompileOnly("maven.modrinth:iris:1.7.1+1.21")
//modRuntimeOnly("maven.modrinth:iris:1.6.17+1.20.4") //modRuntimeOnly("maven.modrinth:iris:1.6.17+1.20.4")
modCompileOnly("maven.modrinth:starlight:1.1.3+1.20.4") modCompileOnly("maven.modrinth:starlight:1.1.3+1.20.4")
//modCompileOnly("maven.modrinth:immersiveportals:v5.1.7-mc1.20.4") //modCompileOnly("maven.modrinth:immersiveportals:v5.1.7-mc1.20.4")
@@ -67,7 +67,7 @@ dependencies {
} }
def targetJavaVersion = 17 def targetJavaVersion = 21
tasks.withType(JavaCompile).configureEach { tasks.withType(JavaCompile).configureEach {
// ensure that the encoding is set to UTF-8, no matter what the system default is // ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly // this fixes some edge cases with special characters not displaying correctly

View File

@@ -3,13 +3,13 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties # Fabric Properties
# check these on https://modmuss50.me/fabric.html # check these on https://modmuss50.me/fabric.html
minecraft_version=1.20.4 minecraft_version=1.21
yarn_mappings=1.20.4+build.1 yarn_mappings=1.21+build.2
loader_version=0.15.1 loader_version=0.15.11
# Mod Properties # Mod Properties
mod_version = 0.1.5-alpha mod_version = 0.1.6-alpha
maven_group = me.cortex maven_group = me.cortex
archives_base_name = voxy archives_base_name = voxy
fabric_version=0.91.1+1.20.4 fabric_version=0.100.1+1.21

View File

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

View File

@@ -1,25 +1,21 @@
package me.cortex.voxy.client.core; package me.cortex.voxy.client.core;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import me.cortex.voxy.client.Voxy; import me.cortex.voxy.client.Voxy;
import me.cortex.voxy.client.config.VoxyConfig; import me.cortex.voxy.client.config.VoxyConfig;
import me.cortex.voxy.client.core.rendering.*; import me.cortex.voxy.client.core.rendering.*;
import me.cortex.voxy.client.core.rendering.building.RenderGenerationService; import me.cortex.voxy.client.core.rendering.building.RenderGenerationService;
import me.cortex.voxy.client.core.rendering.post.PostProcessing; import me.cortex.voxy.client.core.rendering.post.PostProcessing;
import me.cortex.voxy.client.core.util.DebugUtil;
import me.cortex.voxy.client.core.util.IrisUtil; import me.cortex.voxy.client.core.util.IrisUtil;
import me.cortex.voxy.client.saver.ContextSelectionSystem; import me.cortex.voxy.client.saver.ContextSelectionSystem;
import me.cortex.voxy.common.world.WorldEngine; import me.cortex.voxy.common.world.WorldEngine;
import me.cortex.voxy.client.importers.WorldImporter; import me.cortex.voxy.client.importers.WorldImporter;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.hud.BossBarHud;
import net.minecraft.client.gui.hud.ClientBossBar; import net.minecraft.client.gui.hud.ClientBossBar;
import net.minecraft.client.render.Camera; import net.minecraft.client.render.Camera;
import net.minecraft.client.render.Frustum; import net.minecraft.client.render.Frustum;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.boss.BossBar; import net.minecraft.entity.boss.BossBar;
import net.minecraft.entity.boss.ServerBossBar;
import net.minecraft.registry.RegistryKeys; import net.minecraft.registry.RegistryKeys;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
@@ -32,7 +28,6 @@ import java.io.File;
import java.util.*; import java.util.*;
import static org.lwjgl.opengl.GL30C.GL_DRAW_FRAMEBUFFER_BINDING; import static org.lwjgl.opengl.GL30C.GL_DRAW_FRAMEBUFFER_BINDING;
import static org.lwjgl.opengl.GL30C.GL_FRAMEBUFFER;
//Core class that ingests new data from sources and updates the required systems //Core class that ingests new data from sources and updates the required systems
@@ -156,9 +151,9 @@ public class VoxelCore {
var projection = new Matrix4f(); var projection = new Matrix4f();
var client = MinecraftClient.getInstance(); var client = MinecraftClient.getInstance();
var gameRenderer = client.gameRenderer; var gameRenderer = client.gameRenderer;//tickCounter.getTickDelta(true);
float fov = (float) gameRenderer.getFov(gameRenderer.getCamera(), client.getTickDelta(), true); float fov = (float) gameRenderer.getFov(gameRenderer.getCamera(), client.getRenderTickCounter().getTickDelta(true), true);
projection.setPerspective(fov * 0.01745329238474369f, projection.setPerspective(fov * 0.01745329238474369f,
(float) client.getWindow().getFramebufferWidth() / (float)client.getWindow().getFramebufferHeight(), (float) client.getWindow().getFramebufferWidth() / (float)client.getWindow().getFramebufferHeight(),
@@ -178,7 +173,6 @@ public class VoxelCore {
} }
matrices.push(); matrices.push();
matrices.translate(-cameraX, -cameraY, -cameraZ); matrices.translate(-cameraX, -cameraY, -cameraZ);
DebugUtil.setPositionMatrix(matrices);
matrices.pop(); matrices.pop();
//this.renderer.getModelManager().updateEntry(0, Blocks.DIRT_PATH.getDefaultState()); //this.renderer.getModelManager().updateEntry(0, Blocks.DIRT_PATH.getDefaultState());

View File

@@ -18,6 +18,7 @@ import static org.lwjgl.opengl.GL11.glBindTexture;
public class BakedBlockEntityModel { public class BakedBlockEntityModel {
private static final class BakedVertices implements VertexConsumer { private static final class BakedVertices implements VertexConsumer {
private boolean makingVertex = false;
public final RenderLayer layer; public final RenderLayer layer;
private float cX, cY, cZ; private float cX, cY, cZ;
private int cR, cG, cB, cA; private int cR, cG, cB, cA;
@@ -30,10 +31,12 @@ public class BakedBlockEntityModel {
} }
@Override @Override
public VertexConsumer vertex(double x, double y, double z) { public VertexConsumer vertex(float x, float y, float z) {
this.cX = (float) x; this.next();
this.cY = (float) y; this.cX = x;
this.cZ = (float) z; this.cY = y;
this.cZ = z;
this.makingVertex = true;
return this; return this;
} }
@@ -68,30 +71,22 @@ public class BakedBlockEntityModel {
return this; return this;
} }
@Override private void next() {
public void fixedColor(int red, int green, int blue, int alpha) { if (this.makingVertex) {
this.makingVertex = false;
} this.vertices.add(new int[]{
Float.floatToIntBits(this.cX), Float.floatToIntBits(this.cY), Float.floatToIntBits(this.cZ),
@Override this.cR, this.cG, this.cB, this.cA,
public void unfixColor() { Float.floatToIntBits(this.cU), Float.floatToIntBits(this.cV)});
}
}
@Override
public void next() {
this.vertices.add(new int[]{
Float.floatToIntBits(this.cX), Float.floatToIntBits(this.cY), Float.floatToIntBits(this.cZ),
this.cR, this.cG, this.cB, this.cA,
Float.floatToIntBits(this.cU), Float.floatToIntBits(this.cV)});
} }
public void putInto(VertexConsumer vc) { public void putInto(VertexConsumer vc) {
this.next();
for (var vert : this.vertices) { for (var vert : this.vertices) {
vc.vertex(Float.intBitsToFloat(vert[0]), Float.intBitsToFloat(vert[1]), Float.intBitsToFloat(vert[2])) vc.vertex(Float.intBitsToFloat(vert[0]), Float.intBitsToFloat(vert[1]), Float.intBitsToFloat(vert[2]))
.color(vert[3], vert[4], vert[5], vert[6]) .color(vert[3], vert[4], vert[5], vert[6])
.texture(Float.intBitsToFloat(vert[7]), Float.intBitsToFloat(vert[8])) .texture(Float.intBitsToFloat(vert[7]), Float.intBitsToFloat(vert[8]));
.next();
} }
} }
} }
@@ -102,9 +97,9 @@ public class BakedBlockEntityModel {
} }
public void renderOut() { public void renderOut() {
var vc = Tessellator.getInstance().getBuffer(); var vc = Tessellator.getInstance();
for (var layer : this.layers) { for (var layer : this.layers) {
vc.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR_TEXTURE); var bb = vc.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE_COLOR);
if (layer.layer instanceof RenderLayer.MultiPhase mp) { if (layer.layer instanceof RenderLayer.MultiPhase mp) {
Identifier textureId = mp.phases.texture.getId().orElse(null); Identifier textureId = mp.phases.texture.getId().orElse(null);
if (textureId == null) { if (textureId == null) {
@@ -114,8 +109,8 @@ public class BakedBlockEntityModel {
glBindTexture(GL_TEXTURE_2D, texture.getGlId()); glBindTexture(GL_TEXTURE_2D, texture.getGlId());
} }
} }
layer.putInto(vc); layer.putInto(bb);
BufferRenderer.draw(vc.end()); BufferRenderer.draw(bb.end());
} }
} }

View File

@@ -171,7 +171,7 @@ public class ModelTextureBakery {
this.rasterShader.bind(); this.rasterShader.bind();
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
int texId = MinecraftClient.getInstance().getTextureManager().getTexture(new Identifier("minecraft", "textures/atlas/blocks.png")).getGlId(); int texId = MinecraftClient.getInstance().getTextureManager().getTexture(Identifier.of("minecraft", "textures/atlas/blocks.png")).getGlId();
GlUniform.uniform1(0, 0); GlUniform.uniform1(0, 0);
var faces = new ColourDepthTextureData[FACE_VIEWS.size()]; var faces = new ColourDepthTextureData[FACE_VIEWS.size()];
@@ -196,7 +196,7 @@ public class ModelTextureBakery {
private ColourDepthTextureData captureView(BlockState state, BakedModel model, BakedBlockEntityModel blockEntityModel, MatrixStack stack, long randomValue, int face, boolean renderFluid, int textureId) { private ColourDepthTextureData captureView(BlockState state, BakedModel model, BakedBlockEntityModel blockEntityModel, MatrixStack stack, long randomValue, int face, boolean renderFluid, int textureId) {
var vc = Tessellator.getInstance().getBuffer(); var vc = Tessellator.getInstance();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
float[] mat = new float[4*4]; float[] mat = new float[4*4];
@@ -208,9 +208,9 @@ public class ModelTextureBakery {
blockEntityModel.renderOut(); blockEntityModel.renderOut();
} }
vc.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR_TEXTURE); var bb = vc.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE_COLOR);
if (!renderFluid) { if (!renderFluid) {
renderQuads(vc, state, model, new MatrixStack(), randomValue); renderQuads(bb, state, model, new MatrixStack(), randomValue);
} else { } else {
MinecraftClient.getInstance().getBlockRenderManager().renderFluid(BlockPos.ORIGIN, new BlockRenderView() { MinecraftClient.getInstance().getBlockRenderManager().renderFluid(BlockPos.ORIGIN, new BlockRenderView() {
@Override @Override
@@ -277,12 +277,15 @@ public class ModelTextureBakery {
public int getBottomY() { public int getBottomY() {
return 0; return 0;
} }
}, vc, state, state.getFluidState()); }, bb, state, state.getFluidState());
} }
glBindTexture(GL_TEXTURE_2D, textureId); glBindTexture(GL_TEXTURE_2D, textureId);
BufferRenderer.draw(vc.end()); try {
BufferRenderer.draw(bb.end());
} catch (IllegalStateException e) {
System.err.println("Got empty buffer builder! for block " + state);
}
glMemoryBarrier(GL_FRAMEBUFFER_BARRIER_BIT); glMemoryBarrier(GL_FRAMEBUFFER_BARRIER_BIT);
int[] colourData = new int[this.width*this.height]; int[] colourData = new int[this.width*this.height];
@@ -298,7 +301,7 @@ public class ModelTextureBakery {
for (var quad : quads) { for (var quad : quads) {
//TODO: mark pixels that have //TODO: mark pixels that have
int meta = quad.hasColor()?1:0; int meta = quad.hasColor()?1:0;
builder.quad(stack.peek(), quad, (meta>>16)&0xff, (meta>>8)&0xff, meta&0xff, 0, 0); builder.quad(stack.peek(), quad, 255f/((meta>>16)&0xff), 255f/((meta>>8)&0xff), 255f/(meta&0xff), 1.0f, 0, 0);
} }
} }
} }

View File

@@ -106,7 +106,7 @@ public abstract class AbstractFarWorldRenderer <T extends Viewport, J extends Ab
while (!this.biomeUpdates.isEmpty()) { while (!this.biomeUpdates.isEmpty()) {
var update = this.biomeUpdates.pop(); var update = this.biomeUpdates.pop();
var biomeReg = MinecraftClient.getInstance().world.getRegistryManager().get(RegistryKeys.BIOME); var biomeReg = MinecraftClient.getInstance().world.getRegistryManager().get(RegistryKeys.BIOME);
this.models.addBiome(update.id, biomeReg.get(new Identifier(update.biome))); this.models.addBiome(update.id, biomeReg.get(Identifier.of(update.biome)));
didHaveBiomeChange = true; didHaveBiomeChange = true;
} }

View File

@@ -1,72 +0,0 @@
package me.cortex.voxy.client.core.util;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.render.*;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.Box;
import org.joml.Matrix4f;
public class DebugUtil {
public static Matrix4f positionMatrix = new Matrix4f().identity();
public static void setPositionMatrix(MatrixStack stack) {
positionMatrix = new Matrix4f(stack.peek().getPositionMatrix());
}
public static void renderAABB(Box aabb, int colour) {
renderAABB(aabb, (float)(colour>>>24)/255, (float)((colour>>>16)&0xFF)/255, (float)((colour>>>8)&0xFF)/255, (float)(colour&0xFF)/255);
}
public static void renderBox(int x, int y, int z, int size, float r, float g, float b) {
renderAABB(new Box(x, y, z, x+size, y+size, z+size), r, g, b, 1.0f);
}
public static void renderAABB(Box aabb, float r, float g, float b, float a) {
RenderSystem.setShaderFogEnd(9999999);
RenderSystem.setShader(GameRenderer::getPositionProgram);
RenderSystem.setShaderColor(r, g, b, a);
RenderSystem.enableBlend();
RenderSystem.disableCull();
RenderSystem.enableDepthTest();
//RenderSystem.depthMask(false);
var tessellator = RenderSystem.renderThreadTesselator();
var builder = tessellator.getBuffer();
builder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION);
builder.vertex(positionMatrix, (float) aabb.minX, (float) aabb.minY, (float) aabb.minZ).next();
builder.vertex(positionMatrix, (float) aabb.maxX, (float) aabb.minY, (float) aabb.minZ).next();
builder.vertex(positionMatrix, (float) aabb.maxX, (float) aabb.minY, (float) aabb.maxZ).next();
builder.vertex(positionMatrix, (float) aabb.minX, (float) aabb.minY, (float) aabb.maxZ).next();
builder.vertex(positionMatrix, (float) aabb.minX, (float) aabb.maxY, (float) aabb.minZ).next();
builder.vertex(positionMatrix, (float) aabb.maxX, (float) aabb.maxY, (float) aabb.minZ).next();
builder.vertex(positionMatrix, (float) aabb.maxX, (float) aabb.maxY, (float) aabb.maxZ).next();
builder.vertex(positionMatrix, (float) aabb.minX, (float) aabb.maxY, (float) aabb.maxZ).next();
builder.vertex(positionMatrix, (float) aabb.minX, (float) aabb.minY, (float) aabb.minZ).next();
builder.vertex(positionMatrix, (float) aabb.maxX, (float) aabb.minY, (float) aabb.minZ).next();
builder.vertex(positionMatrix, (float) aabb.maxX, (float) aabb.maxY, (float) aabb.minZ).next();
builder.vertex(positionMatrix, (float) aabb.minX, (float) aabb.maxY, (float) aabb.minZ).next();
builder.vertex(positionMatrix, (float) aabb.minX, (float) aabb.minY, (float) aabb.maxZ).next();
builder.vertex(positionMatrix, (float) aabb.maxX, (float) aabb.minY, (float) aabb.maxZ).next();
builder.vertex(positionMatrix, (float) aabb.maxX, (float) aabb.maxY, (float) aabb.maxZ).next();
builder.vertex(positionMatrix, (float) aabb.minX, (float) aabb.maxY, (float) aabb.maxZ).next();
builder.vertex(positionMatrix, (float) aabb.minX, (float) aabb.minY, (float) aabb.minZ).next();
builder.vertex(positionMatrix, (float) aabb.minX, (float) aabb.maxY, (float) aabb.minZ).next();
builder.vertex(positionMatrix, (float) aabb.minX, (float) aabb.maxY, (float) aabb.maxZ).next();
builder.vertex(positionMatrix, (float) aabb.minX, (float) aabb.minY, (float) aabb.maxZ).next();
builder.vertex(positionMatrix, (float) aabb.maxX, (float) aabb.minY, (float) aabb.minZ).next();
builder.vertex(positionMatrix, (float) aabb.maxX, (float) aabb.maxY, (float) aabb.minZ).next();
builder.vertex(positionMatrix, (float) aabb.maxX, (float) aabb.maxY, (float) aabb.maxZ).next();
builder.vertex(positionMatrix, (float) aabb.maxX, (float) aabb.minY, (float) aabb.maxZ).next();
tessellator.draw();
RenderSystem.disableBlend();
RenderSystem.enableCull();
RenderSystem.disableDepthTest();
RenderSystem.setShaderColor(1,1,1,1);
RenderSystem.depthMask(true);
}
}

View File

@@ -1,7 +1,7 @@
package me.cortex.voxy.client.core.util; package me.cortex.voxy.client.core.util;
import net.coderbot.iris.pipeline.ShadowRenderer;
import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.api.FabricLoader;
import net.irisshaders.iris.shadows.ShadowRenderer;
import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.Unique;
public class IrisUtil { public class IrisUtil {

View File

@@ -20,7 +20,7 @@ import net.minecraft.world.biome.BiomeKeys;
import net.minecraft.world.chunk.ChunkNibbleArray; import net.minecraft.world.chunk.ChunkNibbleArray;
import net.minecraft.world.chunk.PalettedContainer; import net.minecraft.world.chunk.PalettedContainer;
import net.minecraft.world.chunk.ReadableContainer; import net.minecraft.world.chunk.ReadableContainer;
import net.minecraft.world.storage.ChunkStreamVersion; import net.minecraft.world.storage.ChunkCompressionFormat;
import org.lwjgl.system.MemoryUtil; import org.lwjgl.system.MemoryUtil;
import java.io.*; import java.io.*;
@@ -94,7 +94,9 @@ public class WorldImporter {
} }
}; };
this.biomeCodec = PalettedContainer.createReadableContainerCodec(biomeRegistry.getIndexedEntries(), biomeRegistry.createEntryCodec(), PalettedContainer.PaletteProvider.BIOME, biomeRegistry.entryOf(BiomeKeys.PLAINS)); this.biomeCodec = PalettedContainer.createReadableContainerCodec(
biomeRegistry.getIndexedEntries(), biomeRegistry.getEntryCodec(), PalettedContainer.PaletteProvider.BIOME, biomeRegistry.entryOf(BiomeKeys.PLAINS)
);
} }
@@ -206,7 +208,7 @@ public class WorldImporter {
} }
private DataInputStream decompress(byte flags, InputStream stream) throws IOException { private DataInputStream decompress(byte flags, InputStream stream) throws IOException {
ChunkStreamVersion chunkStreamVersion = ChunkStreamVersion.get(flags); ChunkCompressionFormat chunkStreamVersion = ChunkCompressionFormat.get(flags);
if (chunkStreamVersion == null) { if (chunkStreamVersion == null) {
System.err.println("Chunk has invalid chunk stream version"); System.err.println("Chunk has invalid chunk stream version");
return null; return null;

View File

@@ -11,6 +11,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
public class MixinMinecraftClient { public class MixinMinecraftClient {
@Inject(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/resource/PeriodicNotificationManager;<init>(Lnet/minecraft/util/Identifier;Lit/unimi/dsi/fastutil/objects/Object2BooleanFunction;)V", shift = At.Shift.AFTER)) @Inject(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/resource/PeriodicNotificationManager;<init>(Lnet/minecraft/util/Identifier;Lit/unimi/dsi/fastutil/objects/Object2BooleanFunction;)V", shift = At.Shift.AFTER))
private void injectRenderDoc(RunArgs args, CallbackInfo ci) { private void injectRenderDoc(RunArgs args, CallbackInfo ci) {
//System.load("C:\\Program Files\\RenderDoc\\renderdoc.dll"); System.load("C:\\Program Files\\RenderDoc\\renderdoc.dll");
} }
} }

View File

@@ -25,14 +25,14 @@ public abstract class MixinWorldRenderer implements IGetVoxelCore {
@Unique private VoxelCore core; @Unique private VoxelCore core;
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;setupTerrain(Lnet/minecraft/client/render/Camera;Lnet/minecraft/client/render/Frustum;ZZ)V", shift = At.Shift.AFTER)) @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;setupTerrain(Lnet/minecraft/client/render/Camera;Lnet/minecraft/client/render/Frustum;ZZ)V", shift = At.Shift.AFTER))
private void injectSetup(MatrixStack matrices, float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f projectionMatrix, CallbackInfo ci) { private void injectSetup(RenderTickCounter tickCounter, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci) {
if (this.core != null) { if (this.core != null) {
this.core.renderSetup(this.frustum, camera); this.core.renderSetup(this.frustum, camera);
} }
} }
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;renderLayer(Lnet/minecraft/client/render/RenderLayer;Lnet/minecraft/client/util/math/MatrixStack;DDDLorg/joml/Matrix4f;)V", ordinal = 2, shift = At.Shift.AFTER)) @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;renderLayer(Lnet/minecraft/client/render/RenderLayer;DDDLorg/joml/Matrix4f;Lorg/joml/Matrix4f;)V", ordinal = 2, shift = At.Shift.AFTER))
private void injectOpaqueRender(MatrixStack matrices, float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f projectionMatrix, CallbackInfo ci) { private void injectOpaqueRender(RenderTickCounter tickCounter, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci) {
if (this.core != null) { if (this.core != null) {
var cam = camera.getPos(); var cam = camera.getPos();
//this.core.renderOpaque(matrices, cam.x, cam.y, cam.z); //this.core.renderOpaque(matrices, cam.x, cam.y, cam.z);

View File

@@ -9,7 +9,6 @@ import me.jellysquid.mods.sodium.client.render.chunk.lists.ChunkRenderListIterab
import me.jellysquid.mods.sodium.client.render.chunk.terrain.DefaultTerrainRenderPasses; import me.jellysquid.mods.sodium.client.render.chunk.terrain.DefaultTerrainRenderPasses;
import me.jellysquid.mods.sodium.client.render.chunk.terrain.TerrainRenderPass; import me.jellysquid.mods.sodium.client.render.chunk.terrain.TerrainRenderPass;
import me.jellysquid.mods.sodium.client.render.viewport.CameraTransform; import me.jellysquid.mods.sodium.client.render.viewport.CameraTransform;
import net.coderbot.iris.pipeline.ShadowRenderer;
import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;

View File

@@ -1,6 +1,7 @@
package me.cortex.voxy.client.mixin.sodium; package me.cortex.voxy.client.mixin.sodium;
import me.jellysquid.mods.sodium.client.render.SodiumWorldRenderer; import me.jellysquid.mods.sodium.client.render.SodiumWorldRenderer;
import me.jellysquid.mods.sodium.client.render.chunk.ChunkRenderMatrices;
import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
@@ -11,7 +12,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(value = SodiumWorldRenderer.class, remap = false) @Mixin(value = SodiumWorldRenderer.class, remap = false)
public class MixinSodiumWorldRender { public class MixinSodiumWorldRender {
@Inject(method = "drawChunkLayer", at = @At("HEAD"), cancellable = true, require = 0) @Inject(method = "drawChunkLayer", at = @At("HEAD"), cancellable = true, require = 0)
private void cancelRender(RenderLayer renderLayer, MatrixStack matrixStack, double x, double y, double z, CallbackInfo ci) { private void cancelRender(RenderLayer renderLayer, ChunkRenderMatrices matrices, double x, double y, double z, CallbackInfo ci) {
//ci.cancel(); //ci.cancel();
} }
} }

View File

@@ -8,7 +8,7 @@ import net.minecraft.block.Blocks;
import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtIo; import net.minecraft.nbt.NbtIo;
import net.minecraft.nbt.NbtOps; import net.minecraft.nbt.NbtOps;
import net.minecraft.nbt.NbtTagSizeTracker; import net.minecraft.nbt.NbtSizeTracker;
import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.util.Pair; import net.minecraft.util.Pair;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
@@ -290,11 +290,11 @@ public class Mapper {
public static StateEntry deserialize(int id, byte[] data) { public static StateEntry deserialize(int id, byte[] data) {
try { try {
var compound = NbtIo.readCompressed(new ByteArrayInputStream(data), NbtTagSizeTracker.ofUnlimitedBytes()); var compound = NbtIo.readCompressed(new ByteArrayInputStream(data), NbtSizeTracker.ofUnlimitedBytes());
if (compound.getInt("id") != id) { if (compound.getInt("id") != id) {
throw new IllegalStateException("Encoded id != expected id"); throw new IllegalStateException("Encoded id != expected id");
} }
BlockState state = BlockState.CODEC.parse(NbtOps.INSTANCE, compound.getCompound("block_state")).get().orThrow(); BlockState state = BlockState.CODEC.parse(NbtOps.INSTANCE, compound.getCompound("block_state")).getOrThrow();
return new StateEntry(id, state); return new StateEntry(id, state);
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
@@ -326,7 +326,7 @@ public class Mapper {
public static BiomeEntry deserialize(int id, byte[] data) { public static BiomeEntry deserialize(int id, byte[] data) {
try { try {
var compound = NbtIo.readCompressed(new ByteArrayInputStream(data), NbtTagSizeTracker.ofUnlimitedBytes()); var compound = NbtIo.readCompressed(new ByteArrayInputStream(data), NbtSizeTracker.ofUnlimitedBytes());
if (compound.getInt("id") != id) { if (compound.getInt("id") != id) {
throw new IllegalStateException("Encoded id != expected id"); throw new IllegalStateException("Encoded id != expected id");
} }

View File

@@ -1,8 +1,8 @@
#version 430 #version 430
layout(location=0) in vec3 pos; layout(location=0) in vec3 pos;
layout(location=1) in vec4 _metadata; layout(location=1) in vec2 uv;
layout(location=2) in vec2 uv; layout(location=2) in vec4 _metadata;
layout(location=1) uniform mat4 transform; layout(location=1) uniform mat4 transform;
out vec2 texCoord; out vec2 texCoord;

View File

@@ -27,7 +27,7 @@
"voxy.mixins.json" "voxy.mixins.json"
], ],
"depends": { "depends": {
"minecraft": "1.20.4", "minecraft": "1.21",
"fabricloader": ">=0.14.22", "fabricloader": ">=0.14.22",
"fabric-api": ">=0.91.1", "fabric-api": ">=0.91.1",
"cloth-config": ">=13", "cloth-config": ">=13",