Initial 1.21.9 support (Issues with entity model baking and F3 debug)

This commit is contained in:
mcrcortex
2025-10-01 16:08:10 +10:00
parent 1438c16558
commit da5d7bc95e
9 changed files with 71 additions and 36 deletions

View File

@@ -105,19 +105,19 @@ dependencies {
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
modRuntimeOnlyMsk "maven.modrinth:sodium:mc1.21.6-0.6.13-fabric"
modCompileOnly "maven.modrinth:sodium:mc1.21.6-0.6.13-fabric"
modRuntimeOnlyMsk "maven.modrinth:sodium:mc1.21.9-0.7.0-fabric"
modCompileOnly "maven.modrinth:sodium:mc1.21.9-0.7.0-fabric"
modImplementation("maven.modrinth:lithium:mc1.21.8-0.18.0-fabric")
modImplementation("maven.modrinth:lithium:mc1.21.9-0.19.0-fabric")
//modRuntimeOnlyMsk "drouarb:nvidium:0.4.1-beta4:1.21.6@jar"
modCompileOnly "drouarb:nvidium:0.4.1-beta4:1.21.6@jar"
modCompileOnly("maven.modrinth:modmenu:15.0.0-beta.3")
modRuntimeOnlyMsk("maven.modrinth:modmenu:15.0.0-beta.3")
modCompileOnly("maven.modrinth:modmenu:15.0.0")
//modRuntimeOnlyMsk("maven.modrinth:modmenu:15.0.0")
modCompileOnly("maven.modrinth:iris:1.9.1+1.21.7-fabric")
modRuntimeOnlyMsk("maven.modrinth:iris:1.9.1+1.21.7-fabric")
modCompileOnly("maven.modrinth:iris:1.9.3+1.21.9-fabric")
modRuntimeOnlyMsk("maven.modrinth:iris:1.9.3+1.21.9-fabric")
//modCompileOnly("maven.modrinth:starlight:1.1.3+1.20.4")
@@ -125,7 +125,7 @@ dependencies {
modCompileOnly("maven.modrinth:chunky:1.4.40-fabric")
modRuntimeOnlyMsk("maven.modrinth:chunky:1.4.40-fabric")
//modRuntimeOnlyMsk("maven.modrinth:chunky:1.4.40-fabric")
modRuntimeOnlyMsk("maven.modrinth:spark:1.10.139-fabric")
modRuntimeOnlyMsk("maven.modrinth:fabric-permissions-api:0.3.3")

View File

@@ -6,13 +6,14 @@ org.gradle.parallel=true
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.21.8
yarn_mappings=1.21.8+build.1
loader_version=0.16.14
minecraft_version=1.21.9
yarn_mappings=1.21.9+build.1
loader_version=0.17.2
loom_version=1.11-SNAPSHOT
# Fabric API
fabric_version=0.129.0+1.21.8
fabric_version=0.133.14+1.21.9
# Mod Properties
mod_version = 0.2.5-alpha

View File

@@ -100,10 +100,10 @@ public class VoxyCommands {
}
File dbFile_ = dbFile;
var engine = WorldIdentifier.ofEngine(MinecraftClient.getInstance().player.clientWorld);
var engine = WorldIdentifier.ofEngine(MinecraftClient.getInstance().world);
if (engine==null)return 1;
return instance.getImportManager().makeAndRunIfNone(engine, ()->
new DHImporter(dbFile_, engine, MinecraftClient.getInstance().player.clientWorld, instance.getThreadPool(), instance.savingServiceRateLimiter))?0:1;
new DHImporter(dbFile_, engine, MinecraftClient.getInstance().world, instance.getThreadPool(), instance.savingServiceRateLimiter))?0:1;
}
private static boolean fileBasedImporter(File directory) {
@@ -112,10 +112,10 @@ public class VoxyCommands {
return false;
}
var engine = WorldIdentifier.ofEngine(MinecraftClient.getInstance().player.clientWorld);
var engine = WorldIdentifier.ofEngine(MinecraftClient.getInstance().world);
if (engine==null) return false;
return instance.getImportManager().makeAndRunIfNone(engine, ()->{
var importer = new WorldImporter(engine, MinecraftClient.getInstance().player.clientWorld, instance.getThreadPool(), instance.savingServiceRateLimiter);
var importer = new WorldImporter(engine, MinecraftClient.getInstance().world, instance.getThreadPool(), instance.savingServiceRateLimiter);
importer.importRegionDirectoryAsync(directory);
return importer;
});
@@ -221,10 +221,10 @@ public class VoxyCommands {
}
String finalInnerDir = innerDir;
var engine = WorldIdentifier.ofEngine(MinecraftClient.getInstance().player.clientWorld);
var engine = WorldIdentifier.ofEngine(MinecraftClient.getInstance().world);
if (engine != null) {
return instance.getImportManager().makeAndRunIfNone(engine, () -> {
var importer = new WorldImporter(engine, MinecraftClient.getInstance().player.clientWorld, instance.getThreadPool(), instance.savingServiceRateLimiter);
var importer = new WorldImporter(engine, MinecraftClient.getInstance().world, instance.getThreadPool(), instance.savingServiceRateLimiter);
importer.importZippedRegionDirectoryAsync(zip, finalInnerDir);
return importer;
}) ? 0 : 1;
@@ -238,7 +238,7 @@ public class VoxyCommands {
ctx.getSource().sendError(Text.translatable("Voxy must be enabled in settings to use this"));
return 1;
}
var world = WorldIdentifier.ofEngineNullable(MinecraftClient.getInstance().player.clientWorld);
var world = WorldIdentifier.ofEngineNullable(MinecraftClient.getInstance().world);
if (world != null) {
return instance.getImportManager().cancelImport(world)?0:1;
}

View File

@@ -4,12 +4,32 @@ import me.cortex.voxy.common.Logger;
import net.minecraft.block.BlockEntityProvider;
import net.minecraft.block.BlockState;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.model.Model;
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.block.MovingBlockRenderState;
import net.minecraft.client.render.command.ModelCommandRenderer;
import net.minecraft.client.render.command.OrderedRenderCommandQueue;
import net.minecraft.client.render.command.OrderedRenderCommandQueueImpl;
import net.minecraft.client.render.command.RenderCommandQueue;
import net.minecraft.client.render.entity.state.EntityHitboxAndView;
import net.minecraft.client.render.entity.state.EntityRenderState;
import net.minecraft.client.render.item.ItemRenderState;
import net.minecraft.client.render.model.BakedQuad;
import net.minecraft.client.render.model.BlockStateModel;
import net.minecraft.client.render.state.CameraRenderState;
import net.minecraft.client.texture.Sprite;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.ItemDisplayContext;
import net.minecraft.text.OrderedText;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import org.jetbrains.annotations.Nullable;
import org.joml.Matrix4f;
import org.joml.Quaternionf;
import java.util.ArrayList;
import java.util.HashMap;
@@ -69,7 +89,17 @@ public class BakedBlockEntityModel {
entity.setWorld(MinecraftClient.getInstance().world);
if (renderer != null) {
try {
renderer.render(entity, 0.0f, new MatrixStack(), layer->map.computeIfAbsent(layer, rl -> new LayerConsumer(rl, new ReuseVertexConsumer().setDefaultMeta(getMetaFromLayer(rl)))).consumer, 0, 0, new Vec3d(0,0,0));
/*
var rt = renderer.createRenderState();
renderer.updateRenderState(entity, rt, 0.0f, new Vec3d(0,0,0), null);
//TODO: FIXME: FINISH
var cstate = new CameraRenderState();
var queue = new OrderedRenderCommandQueueImpl();
renderer.render(rt, new MatrixStack(), queue, cstate);
var qq = queue.getBatchingQueue(0);
*/
//renderer.render(entity, 0.0f, new MatrixStack(), layer->map.computeIfAbsent(layer, rl -> new LayerConsumer(rl, new ReuseVertexConsumer().setDefaultMeta(getMetaFromLayer(rl)))).consumer, 0, 0, new Vec3d(0,0,0));
} catch (Exception e) {
Logger.error("Unable to bake block entity: " + entity, e);
}

View File

@@ -33,10 +33,11 @@ public class MixinWorldRenderer {
boolean renderBlockOutline,
Camera camera,
Matrix4f positionMatrix,
Matrix4f basicProjectionMatrix,
Matrix4f projectionMatrix,
GpuBufferSlice fog,
GpuBufferSlice fogBuffer,
Vector4f fogColor,
boolean shouldRenderSky,
boolean renderSky,
CallbackInfo ci) {
if (IrisUtil.irisShaderPackEnabled()) {
var renderer = ((IGetVoxyRenderSystem) this).getVoxyRenderSystem();

View File

@@ -13,6 +13,8 @@ import java.util.List;
@Mixin(DebugHud.class)
public class MixinDebugHud {
//TODO: Fix this
/*
@Inject(method = "getRightText", at = @At("RETURN"))
private void injectDebug(CallbackInfoReturnable<List<String>> cir) {
var ret = cir.getReturnValue();
@@ -26,5 +28,5 @@ public class MixinDebugHud {
if (renderer != null) {
renderer.addDebugInfo(ret);
}
}
}*/
}

View File

@@ -22,7 +22,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(WorldRenderer.class)
public abstract class MixinWorldRenderer implements IGetVoxyRenderSystem {
@Shadow private Frustum frustum;
@Shadow private @Nullable ClientWorld world;
@Unique private VoxyRenderSystem renderer;

View File

@@ -23,10 +23,7 @@ import net.minecraft.util.collection.IndexedIterable;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeKeys;
import net.minecraft.world.chunk.ChunkNibbleArray;
import net.minecraft.world.chunk.ChunkStatus;
import net.minecraft.world.chunk.PalettedContainer;
import net.minecraft.world.chunk.ReadableContainer;
import net.minecraft.world.chunk.*;
import net.minecraft.world.storage.ChunkCompressionFormat;
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import org.apache.commons.compress.archivers.zip.ZipFile;
@@ -51,6 +48,7 @@ public class WorldImporter implements IDataImporter {
private final WorldEngine world;
private final ReadableContainer<RegistryEntry<Biome>> defaultBiomeProvider;
private final Codec<ReadableContainer<RegistryEntry<Biome>>> biomeCodec;
private final Codec<PalettedContainer<BlockState>> blockStateCodec;
private final AtomicInteger estimatedTotalChunks = new AtomicInteger();//Slowly converges to the true value
private final AtomicInteger totalChunks = new AtomicInteger();
private final AtomicInteger chunksProcessed = new AtomicInteger();
@@ -87,6 +85,11 @@ public class WorldImporter implements IDataImporter {
return 0;
}
@Override
public int getElementBits() {
return 0;
}
@Override
public boolean hasAny(Predicate<RegistryEntry<Biome>> predicate) {
return false;
@@ -108,14 +111,14 @@ public class WorldImporter implements IDataImporter {
}
@Override
public Serialized<RegistryEntry<Biome>> serialize(IndexedIterable<RegistryEntry<Biome>> idList, PalettedContainer.PaletteProvider paletteProvider) {
public Serialized<RegistryEntry<Biome>> serialize(PaletteProvider<RegistryEntry<Biome>> provider) {
return null;
}
};
this.biomeCodec = PalettedContainer.createReadableContainerCodec(
biomeRegistry.getIndexedEntries(), biomeRegistry.getEntryCodec(), PalettedContainer.PaletteProvider.BIOME, biomeRegistry.getOrThrow(BiomeKeys.PLAINS)
);
var factory = PalettesFactory.fromRegistryManager(mcWorld.getRegistryManager());
this.biomeCodec = factory.biomeContainerCodec();
this.blockStateCodec = factory.blockStatesContainerCodec();
}
@@ -460,7 +463,6 @@ public class WorldImporter implements IDataImporter {
private static final byte[] EMPTY = new byte[0];
private static final ThreadLocal<VoxelizedSection> SECTION_CACHE = ThreadLocal.withInitial(VoxelizedSection::createEmpty);
private static final Codec<PalettedContainer<BlockState>> BLOCK_STATE_CODEC = PalettedContainer.createPalettedContainerCodec(Block.STATE_IDS, BlockState.CODEC, PalettedContainer.PaletteProvider.BLOCK_STATE, Blocks.AIR.getDefaultState());
private void importSectionNBT(int x, int y, int z, NbtCompound section) {
if (section.getCompound("block_states").isEmpty()) {
return;
@@ -483,7 +485,7 @@ public class WorldImporter implements IDataImporter {
skyLight = null;
}
var blockStatesRes = BLOCK_STATE_CODEC.parse(NbtOps.INSTANCE, section.getCompound("block_states").get());
var blockStatesRes = blockStateCodec.parse(NbtOps.INSTANCE, section.getCompound("block_states").get());
if (!blockStatesRes.hasResultOrPartial()) {
//TODO: if its only partial, it means should try to upgrade the nbt format with datafixerupper probably
return;

View File

@@ -32,10 +32,10 @@
"common.voxy.mixins.json"
],
"depends": {
"minecraft": ["1.21.8","1.21.7","1.21.6"],
"minecraft": ["1.21.9"],
"fabricloader": ">=0.14.22",
"fabric-api": ">=0.91.1",
"sodium": ">=0.6.13"
"sodium": "=0.7.*"
},
"accessWidener": "voxy.accesswidener"
}