partial 1.21.3 update

This commit is contained in:
mcrcortex
2024-11-17 21:09:31 +10:00
parent 0a7c0c573c
commit 5e5d0c8051
28 changed files with 90 additions and 130 deletions

View File

@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version "1.7.1"
id 'fabric-loom' version "1.8.11"
id 'maven-publish'
}
@@ -56,35 +56,33 @@ dependencies {
modImplementation(fabricApi.module("fabric-rendering-fluids-v1", project.fabric_version))
modImplementation(fabricApi.module("fabric-resource-loader-v0", project.fabric_version))
modImplementation(fabricApi.module("fabric-command-api-v2", project.fabric_version))
modImplementation("net.fabricmc.fabric-api:fabric-rendering-data-attachment-v1:0.3.38+73761d2e9a")
//modImplementation("net.fabricmc.fabric-api:fabric-rendering-data-attachment-v1:0.3.38+73761d2e9a")
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
modRuntimeOnly "maven.modrinth:sodium:mc1.21-0.5.9"
modCompileOnly "maven.modrinth:sodium:mc1.21-0.5.9"
modRuntimeOnly "maven.modrinth:sodium:mc1.21.3-0.6.0-fabric"
modCompileOnly "maven.modrinth:sodium:mc1.21.3-0.6.0-fabric"
//modRuntimeOnly "maven.modrinth:nvidium:0.2.6-beta"
modCompileOnly "maven.modrinth:nvidium:0.2.8-beta"
modImplementation("maven.modrinth:cloth-config:15.0.127+fabric")
modImplementation("maven.modrinth:cloth-config:16.0.141+fabric")
modImplementation("maven.modrinth:modmenu:11.0.1")
modImplementation("maven.modrinth:modmenu:12.0.0-beta.1")
modCompileOnly("maven.modrinth:iris:1.7.3+1.21")
modCompileOnly("maven.modrinth:iris:1.8.0+1.21.3-fabric")
//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:vivecraft:1.20.4-1.1.6-fabric")
modCompileOnly("maven.modrinth:vivecraft:1.21.1-1.1.14-b2-fabric")
modCompileOnly("maven.modrinth:chunky:1.4.16-fabric")
modRuntimeOnly("maven.modrinth:chunky:1.4.16-fabric")
modCompileOnly("maven.modrinth:chunky:1.4.27-fabric")
modRuntimeOnly("maven.modrinth:chunky:1.4.27-fabric")
modRuntimeOnly("maven.modrinth:spark:1.10.73-fabric")
modRuntimeOnly("maven.modrinth:spark:1.10.115-fabric")
modRuntimeOnly("maven.modrinth:fabric-permissions-api:0.3.1")
//modRuntimeOnly("maven.modrinth:nsight-loader:1.2.0")

View File

@@ -3,13 +3,14 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.21
yarn_mappings=1.21+build.2
loader_version=0.16.5
minecraft_version=1.21.3
yarn_mappings=1.21.3+build.2
loader_version=0.16.9
# Fabric API
fabric_version=0.108.0+1.21.3
# Mod Properties
mod_version = 0.1.6-alpha
mod_version = 0.2.0-alpha
maven_group = me.cortex
archives_base_name = voxy
fabric_version=0.100.1+1.21

View File

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

View File

@@ -96,7 +96,7 @@ public class VoxelCore {
var client = MinecraftClient.getInstance();
var gameRenderer = client.gameRenderer;//tickCounter.getTickDelta(true);
float fov = (float) gameRenderer.getFov(gameRenderer.getCamera(), client.getRenderTickCounter().getTickDelta(true), true);
float fov = gameRenderer.getFov(gameRenderer.getCamera(), client.getRenderTickCounter().getTickDelta(true), true);
projection.setPerspective(fov * 0.01745329238474369f,
(float) client.getWindow().getFramebufferWidth() / (float)client.getWindow().getFramebufferHeight(),

View File

@@ -1,7 +1,8 @@
package me.cortex.voxy.client.core.gl.shader;
import me.jellysquid.mods.sodium.client.gl.shader.ShaderConstants;
import me.jellysquid.mods.sodium.client.gl.shader.ShaderParser;
import net.caffeinemc.mods.sodium.client.gl.shader.ShaderConstants;
import net.caffeinemc.mods.sodium.client.gl.shader.ShaderParser;
public class ShaderLoader {
public static String parse(String id) {

View File

@@ -58,7 +58,7 @@ public class ModelBakerySubsystem {
//Upload all biomes
while (!this.biomeQueue.isEmpty()) {
var biome = this.biomeQueue.poll();
var biomeReg = MinecraftClient.getInstance().world.getRegistryManager().get(RegistryKeys.BIOME);
var biomeReg = MinecraftClient.getInstance().world.getRegistryManager().getOrThrow(RegistryKeys.BIOME);
this.factory.addBiome(biome.id, biomeReg.get(Identifier.of(biome.biome)));
}

View File

@@ -71,7 +71,7 @@ public class ModelFactory {
}
}
private final Biome DEFAULT_BIOME = MinecraftClient.getInstance().world.getRegistryManager().get(RegistryKeys.BIOME).get(BiomeKeys.PLAINS);
private final Biome DEFAULT_BIOME = MinecraftClient.getInstance().world.getRegistryManager().getOrThrow(RegistryKeys.BIOME).get(BiomeKeys.PLAINS);
public final ModelTextureBakery bakery;

View File

@@ -1,6 +1,6 @@
package me.cortex.voxy.client.core.model;
import me.jellysquid.mods.sodium.client.util.color.ColorSRGB;
import net.caffeinemc.mods.sodium.client.util.color.ColorSRGB;
import net.minecraft.util.math.ColorHelper;
//Texturing utils to manipulate data from the model bakery
@@ -183,8 +183,8 @@ public class TextureUtils {
//TODO: FIXME!!! ITS READING IT AS ABGR??? isnt the format RGBA??
private static int weightedAverageColor(int one, int two) {
int alphaOne = ColorHelper.Abgr.getAlpha(one);
int alphaTwo = ColorHelper.Abgr.getAlpha(two);
int alphaOne = ColorHelper.getAlpha(one);
int alphaTwo = ColorHelper.getAlpha(two);
if (alphaOne == alphaTwo) {
return averageRgb(one, two, alphaOne);
} else if (alphaOne == 0) {
@@ -195,12 +195,12 @@ public class TextureUtils {
float scale = 1.0F / (float)(alphaOne + alphaTwo);
float relativeWeightOne = (float)alphaOne * scale;
float relativeWeightTwo = (float)alphaTwo * scale;
float oneR = ColorSRGB.srgbToLinear(ColorHelper.Abgr.getRed(one)) * relativeWeightOne;
float oneG = ColorSRGB.srgbToLinear(ColorHelper.Abgr.getGreen(one)) * relativeWeightOne;
float oneB = ColorSRGB.srgbToLinear(ColorHelper.Abgr.getBlue(one)) * relativeWeightOne;
float twoR = ColorSRGB.srgbToLinear(ColorHelper.Abgr.getRed(two)) * relativeWeightTwo;
float twoG = ColorSRGB.srgbToLinear(ColorHelper.Abgr.getGreen(two)) * relativeWeightTwo;
float twoB = ColorSRGB.srgbToLinear(ColorHelper.Abgr.getBlue(two)) * relativeWeightTwo;
float oneR = ColorSRGB.srgbToLinear(ColorHelper.getRed(one)) * relativeWeightOne;
float oneG = ColorSRGB.srgbToLinear(ColorHelper.getGreen(one)) * relativeWeightOne;
float oneB = ColorSRGB.srgbToLinear(ColorHelper.getBlue(one)) * relativeWeightOne;
float twoR = ColorSRGB.srgbToLinear(ColorHelper.getRed(two)) * relativeWeightTwo;
float twoG = ColorSRGB.srgbToLinear(ColorHelper.getGreen(two)) * relativeWeightTwo;
float twoB = ColorSRGB.srgbToLinear(ColorHelper.getBlue(two)) * relativeWeightTwo;
float linearR = oneR + twoR;
float linearG = oneG + twoG;
float linearB = oneB + twoB;
@@ -210,12 +210,12 @@ public class TextureUtils {
}
private static int averageRgb(int a, int b, int alpha) {
float ar = ColorSRGB.srgbToLinear(ColorHelper.Abgr.getRed(a));
float ag = ColorSRGB.srgbToLinear(ColorHelper.Abgr.getGreen(a));
float ab = ColorSRGB.srgbToLinear(ColorHelper.Abgr.getBlue(a));
float br = ColorSRGB.srgbToLinear(ColorHelper.Abgr.getRed(b));
float bg = ColorSRGB.srgbToLinear(ColorHelper.Abgr.getGreen(b));
float bb = ColorSRGB.srgbToLinear(ColorHelper.Abgr.getBlue(b));
float ar = ColorSRGB.srgbToLinear(ColorHelper.getRed(a));
float ag = ColorSRGB.srgbToLinear(ColorHelper.getGreen(a));
float ab = ColorSRGB.srgbToLinear(ColorHelper.getBlue(a));
float br = ColorSRGB.srgbToLinear(ColorHelper.getRed(b));
float bg = ColorSRGB.srgbToLinear(ColorHelper.getGreen(b));
float bb = ColorSRGB.srgbToLinear(ColorHelper.getBlue(b));
return ColorSRGB.linearToSrgb((ar + br) * 0.5F, (ag + bg) * 0.5F, (ab + bb) * 0.5F, alpha);
}
}

View File

@@ -47,7 +47,7 @@ public class RenderService<T extends AbstractSectionRenderer<J, ?>, J extends Vi
//Max sections: ~500k
//Max geometry: 1 gb
this.sectionRenderer = (T) createSectionRenderer(this.modelService.getStore(),1<<19, (1L<<30)-1024);
this.sectionRenderer = (T) createSectionRenderer(this.modelService.getStore(),1<<19, (1L<<31)-1024);
//Do something incredibly hacky, we dont need to keep the reference to this around, so just connect and discard
var router = new SectionUpdateRouter();
@@ -95,7 +95,7 @@ public class RenderService<T extends AbstractSectionRenderer<J, ?>, J extends Vi
}
public void renderFarAwayOpaque(J viewport) {
LightMapHelper.tickLightmap();
//LightMapHelper.tickLightmap();
//Render previous geometry with the abstract renderer
//Execute the hieracial selector

View File

@@ -11,7 +11,7 @@ import me.cortex.voxy.client.core.rendering.util.UploadStream;
import me.cortex.voxy.client.core.util.ExpandingObjectAllocationList;
import me.cortex.voxy.common.Logger;
import me.cortex.voxy.common.world.WorldEngine;
import me.jellysquid.mods.sodium.client.util.MathUtil;
import net.caffeinemc.mods.sodium.client.util.MathUtil;
import org.lwjgl.system.MemoryUtil;
import static me.cortex.voxy.client.core.rendering.hierachical2.NodeStore.EMPTY_GEOMETRY_ID;

View File

@@ -116,7 +116,7 @@ public class HierarchicalOcclusionTraverser {
MemoryUtil.memPutInt(ptr, (int) (this.renderList.size()/4-1)); ptr += 4;
//Screen space size for descending
MemoryUtil.memPutFloat(ptr, 150*150); ptr += 4;
MemoryUtil.memPutFloat(ptr, 100*100); ptr += 4;
}
private void bindings() {

View File

@@ -11,7 +11,7 @@ import me.cortex.voxy.client.core.rendering.util.UploadStream;
import me.cortex.voxy.client.core.util.ExpandingObjectAllocationList;
import me.cortex.voxy.common.Logger;
import me.cortex.voxy.common.world.WorldEngine;
import me.jellysquid.mods.sodium.client.util.MathUtil;
import net.caffeinemc.mods.sodium.client.util.MathUtil;
import java.util.List;

View File

@@ -1,7 +1,7 @@
package me.cortex.voxy.client.core.rendering.section;
import me.cortex.voxy.client.core.rendering.building.BuiltSection;
import me.jellysquid.mods.sodium.client.util.MathUtil;
import net.caffeinemc.mods.sodium.client.util.MathUtil;
import java.util.function.Consumer;

View File

@@ -5,6 +5,8 @@ import it.unimi.dsi.fastutil.ints.IntArrayList;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL13.GL_ACTIVE_TEXTURE;
import static org.lwjgl.opengl.GL13.glActiveTexture;
import static org.lwjgl.opengl.GL13C.GL_TEXTURE0;
import static org.lwjgl.opengl.GL33.glBindSampler;
public class GlStateCapture {
private final int[] capabilityIds;
@@ -40,6 +42,7 @@ public class GlStateCapture {
//Capture all the texture data
for (int i = 1; i < this.textures.length; i++) {
glActiveTexture(this.textureUnits[i]);
//glBindSampler(this.textureUnits[i]-GL_TEXTURE0, 0);
glBindTexture(GL_TEXTURE_2D, this.textures[i]);
}
//Reset the original active texture

View File

@@ -56,8 +56,8 @@ public class WorldImporter {
this.world = worldEngine;
this.threadPool = servicePool.createService("World importer", 1, ()-> ()->jobQueue.poll().run(), ()->this.world.savingService.getTaskCount() < 4000);
var biomeRegistry = mcWorld.getRegistryManager().get(RegistryKeys.BIOME);
var defaultBiome = biomeRegistry.entryOf(BiomeKeys.PLAINS);
var biomeRegistry = mcWorld.getRegistryManager().getOrThrow(RegistryKeys.BIOME);
var defaultBiome = biomeRegistry.getOrThrow(BiomeKeys.PLAINS);
this.defaultBiomeProvider = new ReadableContainer<RegistryEntry<Biome>>() {
@Override
public RegistryEntry<Biome> get(int x, int y, int z) {
@@ -89,6 +89,11 @@ public class WorldImporter {
}
@Override
public PalettedContainer<RegistryEntry<Biome>> copy() {
return null;
}
@Override
public PalettedContainer<RegistryEntry<Biome>> slice() {
return null;
@@ -101,7 +106,7 @@ public class WorldImporter {
};
this.biomeCodec = PalettedContainer.createReadableContainerCodec(
biomeRegistry.getIndexedEntries(), biomeRegistry.getEntryCodec(), PalettedContainer.PaletteProvider.BIOME, biomeRegistry.entryOf(BiomeKeys.PLAINS)
biomeRegistry.getIndexedEntries(), biomeRegistry.getEntryCodec(), PalettedContainer.PaletteProvider.BIOME, biomeRegistry.getOrThrow(BiomeKeys.PLAINS)
);
}

View File

@@ -15,6 +15,7 @@ import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.ChunkStatus;
import net.minecraft.world.chunk.WorldChunk;
import org.joml.Matrix4f;
import org.popcraft.chunky.mixin.ServerChunkCacheMixin;
import org.popcraft.chunky.platform.FabricWorld;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
@@ -28,9 +29,9 @@ import java.util.function.BiConsumer;
@Mixin(FabricWorld.class)
public class MixinFabricWorld {
@WrapOperation(method = "getChunkAtAsync", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/world/ChunkHolder;load(Lnet/minecraft/world/chunk/ChunkStatus;Lnet/minecraft/server/world/ServerChunkLoadingManager;)Ljava/util/concurrent/CompletableFuture;"))
private CompletableFuture<OptionalChunk<Chunk>> captureGeneratedChunk(ChunkHolder instance, ChunkStatus chunkStatus, ServerChunkLoadingManager serverChunkLoadingManager, Operation<CompletableFuture<OptionalChunk<Chunk>>> original) {
var future = original.call(instance, chunkStatus, serverChunkLoadingManager);
@WrapOperation(method = "getChunkAtAsync", at = @At(value = "INVOKE", target = "Lorg/popcraft/chunky/mixin/ServerChunkCacheMixin;invokeGetChunkFutureMainThread(IILnet/minecraft/world/chunk/ChunkStatus;Z)Ljava/util/concurrent/CompletableFuture;"))
private CompletableFuture<OptionalChunk<Chunk>> captureGeneratedChunk(ServerChunkCacheMixin instance, int i, int j, ChunkStatus chunkStatus, boolean b, Operation<CompletableFuture<OptionalChunk<Chunk>>> original) {
var future = original.call(instance, i, j, chunkStatus, b);
return future.thenApplyAsync(res->{
res.ifPresent(chunk -> {
var core = ((IGetVoxelCore)(MinecraftClient.getInstance().worldRenderer)).getVoxelCore();

View File

@@ -15,6 +15,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
/*
@Mixin(ClientChunkManager.class)
public class MixinClientChunkManager {
@Shadow @Final ClientWorld world;
@@ -27,3 +28,4 @@ public class MixinClientChunkManager {
}
}
}
*/

View File

@@ -5,6 +5,7 @@ import me.cortex.voxy.client.core.IGetVoxelCore;
import me.cortex.voxy.client.config.VoxyConfig;
import me.cortex.voxy.client.core.VoxelCore;
import net.minecraft.client.render.*;
import net.minecraft.client.util.ObjectAllocator;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.world.ClientWorld;
import org.jetbrains.annotations.Nullable;
@@ -25,20 +26,12 @@ public abstract class MixinWorldRenderer implements IGetVoxelCore {
@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))
private void injectSetup(RenderTickCounter tickCounter, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci) {
private void injectSetup(ObjectAllocator allocator, RenderTickCounter tickCounter, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f positionMatrix, Matrix4f projectionMatrix, CallbackInfo ci) {
if (this.core != null) {
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;DDDLorg/joml/Matrix4f;Lorg/joml/Matrix4f;)V", ordinal = 2, shift = At.Shift.AFTER))
private void injectOpaqueRender(RenderTickCounter tickCounter, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci) {
if (this.core != null) {
var cam = camera.getPos();
//this.core.renderOpaque(matrices, cam.x, cam.y, cam.z);
}
}
@Unique
public void populateCore() {
if (this.core != null) {

View File

@@ -3,9 +3,6 @@ package me.cortex.voxy.client.mixin.nvidium;
import me.cortex.nvidium.RenderPipeline;
import me.cortex.voxy.client.config.VoxyConfig;
import me.cortex.voxy.client.core.IGetVoxelCore;
import me.jellysquid.mods.sodium.client.render.chunk.ChunkRenderMatrices;
import me.jellysquid.mods.sodium.client.render.chunk.terrain.DefaultTerrainRenderPasses;
import me.jellysquid.mods.sodium.client.render.viewport.Viewport;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.util.math.MatrixStack;
import org.joml.Matrix4f;
@@ -16,6 +13,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(value = RenderPipeline.class, remap = false)
public class MixinRenderPipeline {
/*
@Inject(method = "renderFrame", at = @At("RETURN"))
private void injectVoxyRender(Viewport frustum, ChunkRenderMatrices crm, double px, double py, double pz, CallbackInfo ci) {
var core = ((IGetVoxelCore) MinecraftClient.getInstance().worldRenderer).getVoxelCore();
@@ -25,5 +23,5 @@ public class MixinRenderPipeline {
stack.multiplyPositionMatrix(new Matrix4f(crm.modelView()));
core.renderOpaque(stack, px, py, pz);
}
}
}*/
}

View File

@@ -2,13 +2,13 @@ package me.cortex.voxy.client.mixin.sodium;
import me.cortex.voxy.client.core.IGetVoxelCore;
import me.cortex.voxy.client.core.util.IrisUtil;
import me.jellysquid.mods.sodium.client.gl.device.CommandList;
import me.jellysquid.mods.sodium.client.render.chunk.ChunkRenderMatrices;
import me.jellysquid.mods.sodium.client.render.chunk.DefaultChunkRenderer;
import me.jellysquid.mods.sodium.client.render.chunk.lists.ChunkRenderListIterable;
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.viewport.CameraTransform;
import net.caffeinemc.mods.sodium.client.gl.device.CommandList;
import net.caffeinemc.mods.sodium.client.render.chunk.ChunkRenderMatrices;
import net.caffeinemc.mods.sodium.client.render.chunk.DefaultChunkRenderer;
import net.caffeinemc.mods.sodium.client.render.chunk.lists.ChunkRenderListIterable;
import net.caffeinemc.mods.sodium.client.render.chunk.terrain.DefaultTerrainRenderPasses;
import net.caffeinemc.mods.sodium.client.render.chunk.terrain.TerrainRenderPass;
import net.caffeinemc.mods.sodium.client.render.viewport.CameraTransform;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.util.math.MatrixStack;
@@ -23,7 +23,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(value = DefaultChunkRenderer.class, remap = false)
public class MixinDefaultChunkRenderer {
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lme/jellysquid/mods/sodium/client/render/chunk/ShaderChunkRenderer;end(Lme/jellysquid/mods/sodium/client/render/chunk/terrain/TerrainRenderPass;)V", shift = At.Shift.BEFORE))
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/caffeinemc/mods/sodium/client/render/chunk/ShaderChunkRenderer;end(Lnet/caffeinemc/mods/sodium/client/render/chunk/terrain/TerrainRenderPass;)V", shift = At.Shift.BEFORE))
private void injectRender(ChunkRenderMatrices matrices, CommandList commandList, ChunkRenderListIterable renderLists, TerrainRenderPass renderPass, CameraTransform camera, CallbackInfo ci) {
if (renderPass == DefaultTerrainRenderPasses.CUTOUT) {
var core = ((IGetVoxelCore) MinecraftClient.getInstance().worldRenderer).getVoxelCore();

View File

@@ -2,7 +2,7 @@ package me.cortex.voxy.client.mixin.sodium;
import me.cortex.voxy.client.config.VoxyConfig;
import me.cortex.voxy.client.core.IGetVoxelCore;
import me.jellysquid.mods.sodium.client.render.chunk.RenderSectionManager;
import net.caffeinemc.mods.sodium.client.render.chunk.RenderSectionManager;
import net.minecraft.client.world.ClientWorld;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
@@ -13,13 +13,14 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(value = RenderSectionManager.class, remap = false)
public class MixinRenderSectionManager {
@Shadow @Final private ClientWorld world;
@Shadow @Final private ClientWorld level;
@Inject(method = "onChunkRemoved", at = @At("HEAD"))
private void injectIngest(int x, int z, CallbackInfo ci) {
var core = ((IGetVoxelCore)(this.world.worldRenderer)).getVoxelCore();
var core = ((IGetVoxelCore)(this.level.worldRenderer)).getVoxelCore();
if (core != null && VoxyConfig.CONFIG.ingestEnabled) {
core.enqueueIngest(this.world.getChunk(x, z));
core.enqueueIngest(this.level.getChunk(x, z));
}
}
}

View File

@@ -1,23 +0,0 @@
package me.cortex.voxy.client.mixin.sodium;
import me.jellysquid.mods.sodium.client.gl.shader.ShaderParser;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import java.util.Collection;
import java.util.List;
@Mixin(value = ShaderParser.class, remap = false)
public class MixinShaderParser {
/*
@Redirect(method = "parseShader(Ljava/lang/String;)Ljava/util/List;", at = @At(value = "INVOKE", target = "Ljava/util/List;addAll(Ljava/util/Collection;)Z"))
private static boolean injectLineNumbers(List<String> lines, Collection<? extends String> add) {
lines.add("#line 1");
int cc = lines.size();
lines.addAll(add);
lines.add("#line " + cc);
return true;
}
*/
}

View File

@@ -1,18 +0,0 @@
package me.cortex.voxy.client.mixin.sodium;
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.util.math.MatrixStack;
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(value = SodiumWorldRenderer.class, remap = false)
public class MixinSodiumWorldRender {
@Inject(method = "drawChunkLayer", at = @At("HEAD"), cancellable = true, require = 0)
private void cancelRender(RenderLayer renderLayer, ChunkRenderMatrices matrices, double x, double y, double z, CallbackInfo ci) {
//ci.cancel();
}
}

View File

@@ -72,7 +72,7 @@ public class ServiceSlice extends TrackedObject {
} catch (Exception e) {
System.err.println("Unexpected error occurred while executing a service job, expect things to break badly");
e.printStackTrace();
MinecraftClient.getInstance().execute(()->MinecraftClient.getInstance().player.sendMessage(Text.literal("A voxy service had an exception while executing please check logs and report error")));
MinecraftClient.getInstance().execute(()->MinecraftClient.getInstance().player.sendMessage(Text.literal("A voxy service had an exception while executing please check logs and report error"), true));
} finally {
if (this.activeCount.decrementAndGet() < 0) {
throw new IllegalStateException("Alive count negative!");

View File

@@ -33,7 +33,7 @@ public class SectionSavingService {
saveData.free();
} catch (Exception e) {
e.printStackTrace();
MinecraftClient.getInstance().executeSync(()->MinecraftClient.getInstance().player.sendMessage(Text.literal("Voxy saver had an exception while executing please check logs and report error")));
MinecraftClient.getInstance().executeSync(()->MinecraftClient.getInstance().player.sendMessage(Text.literal("Voxy saver had an exception while executing please check logs and report error"), true));
}
section.release();
}

View File

@@ -5,15 +5,12 @@
"client": [
"chunky.MixinFabricWorld",
"joml.AccessFrustumIntersection",
"minecraft.MixinClientChunkManager",
"minecraft.MixinDebugHud",
"minecraft.MixinMinecraftClient",
"minecraft.MixinWorldRenderer",
"nvidium.MixinRenderPipeline",
"sodium.MixinDefaultChunkRenderer",
"sodium.MixinRenderSectionManager",
"sodium.MixinSodiumWorldRender",
"sodium.MixinShaderParser"
"sodium.MixinRenderSectionManager"
],
"injectors": {
"defaultRequire": 1

View File

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

View File

@@ -5,7 +5,6 @@ accessible class net/minecraft/client/render/RenderLayer$MultiPhaseParameters
accessible field net/minecraft/client/texture/SpriteContents image Lnet/minecraft/client/texture/NativeImage;
accessible field net/minecraft/client/render/Frustum frustumIntersection Lorg/joml/FrustumIntersection;
accessible field net/minecraft/client/render/LightmapTextureManager texture Lnet/minecraft/client/texture/NativeImageBackedTexture;
accessible field net/minecraft/client/color/block/BlockColors providers Lnet/minecraft/util/collection/IdList;
accessible field net/minecraft/client/render/GameRenderer zoomX F
accessible field net/minecraft/client/render/GameRenderer zoomY F
@@ -19,5 +18,7 @@ accessible field net/minecraft/client/render/RenderLayer$MultiPhaseParameters te
accessible field net/minecraft/client/render/RenderLayer$MultiPhase phases Lnet/minecraft/client/render/RenderLayer$MultiPhaseParameters;
accessible field net/minecraft/client/network/ClientPlayerInteractionManager networkHandler Lnet/minecraft/client/network/ClientPlayNetworkHandler;
accessible method net/minecraft/client/render/GameRenderer getFov (Lnet/minecraft/client/render/Camera;FZ)D
accessible method net/minecraft/client/render/GameRenderer getFov (Lnet/minecraft/client/render/Camera;FZ)F
accessible method net/minecraft/client/render/RenderPhase$TextureBase getId ()Ljava/util/Optional;
accessible field net/minecraft/client/render/LightmapTextureManager lightmapFramebuffer Lnet/minecraft/client/gl/SimpleFramebuffer;