Skip to content

Commit

Permalink
Update to 25w07a
Browse files Browse the repository at this point in the history
  • Loading branch information
IMS212 committed Feb 15, 2025
1 parent 0642e95 commit e4c58ab
Show file tree
Hide file tree
Showing 42 changed files with 152 additions and 415 deletions.
6 changes: 3 additions & 3 deletions buildSrc/src/main/kotlin/BuildConfig.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import org.gradle.api.Project

object BuildConfig {
val MINECRAFT_VERSION: String = "1.21.4"
val MINECRAFT_VERSION: String = "25w07a"
val NEOFORGE_VERSION: String = "21.4.88-beta"
val FABRIC_LOADER_VERSION: String = "0.16.9"
val FABRIC_LOADER_VERSION: String = "0.16.10"
val FABRIC_API_VERSION: String = "0.112.1+1.21.4"

// This value can be set to null to disable Parchment.
val PARCHMENT_VERSION: String? = "2025.01.19"
val PARCHMENT_VERSION: String? = null

// https://semver.org/
var MOD_VERSION: String = "0.7.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import net.caffeinemc.mods.sodium.client.gl.tessellation.*;
import net.caffeinemc.mods.sodium.client.gl.util.EnumBitField;
import org.lwjgl.opengl.*;
import com.mojang.blaze3d.vertex.BufferUploader;

import java.nio.ByteBuffer;

public class GLRenderDevice implements RenderDevice {
Expand All @@ -34,8 +34,6 @@ public void makeActive() {
return;
}

BufferUploader.reset();

this.stateTracker.clear();
this.isActive = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import net.caffeinemc.mods.sodium.client.render.chunk.translucent_sorting.TranslucentGeometryCollector;
import net.caffeinemc.mods.sodium.client.world.LevelSlice;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.client.renderer.block.model.BlockStateModel;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.state.BlockState;
import org.joml.Vector3f;
Expand All @@ -17,7 +17,7 @@ public class BlockRenderContext {
private final Vector3f origin = new Vector3f();

private BlockState state;
private BakedModel model;
private BlockStateModel model;

private long seed;

Expand All @@ -27,7 +27,7 @@ public BlockRenderContext(LevelSlice slice, TranslucentGeometryCollector collect
this.collector = collector;
}

public void update(BlockPos pos, BlockPos origin, BlockState state, BakedModel model, long seed) {
public void update(BlockPos pos, BlockPos origin, BlockState state, BlockStateModel model, long seed) {
this.pos.set(pos);
this.origin.set(origin.getX(), origin.getY(), origin.getZ());

Expand Down Expand Up @@ -68,7 +68,7 @@ public BlockState state() {
/**
* @return The model used for this block
*/
public BakedModel model() {
public BlockStateModel model() {
return this.model;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
import net.fabricmc.fabric.api.util.TriState;
import net.minecraft.client.renderer.ItemBlockRenderTypes;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.block.model.BlockStateModel;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.SingleThreadedRandomSource;
Expand Down Expand Up @@ -80,7 +80,7 @@ public void release() {
this.slice = null;
}

public void renderModel(BakedModel model, BlockState state, BlockPos pos, BlockPos origin) {
public void renderModel(BlockStateModel model, BlockState state, BlockPos pos, BlockPos origin) {
this.state = state;
this.pos = pos;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private boolean isSideExposed(BlockAndTintGetter world, int x, int y, int z, Dir

VoxelShape threshold = Shapes.box(0.0D, 0.0D, 0.0D, 1.0D, height, 1.0D);

return !Shapes.blockOccudes(threshold, shape, dir);
return !Shapes.blockOccludes(threshold, shape, dir);
}

return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap;
import net.caffeinemc.mods.sodium.client.SodiumClientMod;
import net.caffeinemc.mods.sodium.client.render.chunk.ExtendedBlockEntityType;
import net.caffeinemc.mods.sodium.client.render.chunk.DefaultChunkRenderer;
import net.caffeinemc.mods.sodium.client.render.chunk.ExtendedBlockEntityType;
import net.caffeinemc.mods.sodium.client.render.chunk.RenderSection;
import net.caffeinemc.mods.sodium.client.render.chunk.compile.ChunkBuildBuffers;
import net.caffeinemc.mods.sodium.client.render.chunk.compile.ChunkBuildContext;
Expand All @@ -29,9 +29,9 @@
import net.minecraft.CrashReportCategory;
import net.minecraft.ReportedException;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.BlockStateModel;
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
import net.minecraft.client.renderer.chunk.VisGraph;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.core.BlockPos;
import net.minecraft.util.profiling.Profiler;
import net.minecraft.util.profiling.ProfilerFiller;
Expand Down Expand Up @@ -112,7 +112,7 @@ public ChunkBuildOutput execute(ChunkBuildContext buildContext, CancellationToke
modelOffset.set(x & 15, y & 15, z & 15);

if (blockState.getRenderShape() == RenderShape.MODEL) {
BakedModel model = cache.getBlockModels()
BlockStateModel model = cache.getBlockModels()
.getBlockModel(blockState);
blockRenderer.renderModel(model, blockState, blockPos, modelOffset);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package net.caffeinemc.mods.sodium.client.render.chunk.shader;

import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.textures.GpuTexture;
import net.caffeinemc.mods.sodium.client.gl.shader.uniform.GlUniformFloat2v;
import net.caffeinemc.mods.sodium.client.gl.shader.uniform.GlUniformFloat3v;
import net.caffeinemc.mods.sodium.client.gl.shader.uniform.GlUniformInt;
Expand Down Expand Up @@ -51,8 +52,8 @@ public DefaultShaderInterface(ShaderBindingContext context, ChunkShaderOptions o
@Override // the shader interface should not modify pipeline state
public void setupState() {
// TODO: Bind to these textures directly rather than using fragile RenderSystem state
this.bindTexture(ChunkShaderTextureSlot.BLOCK, TextureUtil.getBlockTextureId());
this.bindTexture(ChunkShaderTextureSlot.LIGHT, TextureUtil.getLightTextureId());
this.bindTexture(ChunkShaderTextureSlot.BLOCK, TextureUtil.getBlockTexture());
this.bindTexture(ChunkShaderTextureSlot.LIGHT, TextureUtil.getLightTexture());

var textureAtlas = (TextureAtlasAccessor) Minecraft.getInstance()
.getTextureManager()
Expand All @@ -78,9 +79,9 @@ public void resetState() {
}

@Deprecated(forRemoval = true) // should be handled properly in GFX instead.
private void bindTexture(ChunkShaderTextureSlot slot, int textureId) {
private void bindTexture(ChunkShaderTextureSlot slot, GpuTexture textureId) {
GlStateManager._activeTexture(GL32C.GL_TEXTURE0 + slot.ordinal());
GlStateManager._bindTexture(textureId);
textureId.bind();

var uniform = this.uniformTextures.get(slot);
uniform.setInt(slot.ordinal());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import net.fabricmc.fabric.api.renderer.v1.mesh.QuadTransform;
import net.fabricmc.fabric.api.renderer.v1.mesh.QuadView;
import net.fabricmc.fabric.api.renderer.v1.model.SpriteFinder;
import net.minecraft.client.renderer.LightTexture;
import net.fabricmc.fabric.api.util.TriState;
import net.minecraft.client.renderer.LightTexture;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.core.Direction;
Expand Down Expand Up @@ -292,41 +292,41 @@ public final MutableQuadViewImpl fromVanilla(int[] quadData, int startIndex) {

@Override
public final MutableQuadViewImpl fromVanilla(BakedQuad quad, RenderMaterial material, @Nullable Direction cullFace) {
fromVanillaInternal(quad.getVertices(), 0);
fromVanillaInternal(quad.vertices(), 0);
data[baseIndex + HEADER_BITS] = EncodingFormat.cullFace(0, cullFace);
nominalFace(quad.getDirection());
tintIndex(quad.getTintIndex());
nominalFace(quad.direction());
tintIndex(quad.tintIndex());

// TODO: Is this the same as hasShade?
if (!((BakedQuadView) quad).hasShade()) {
if (!((BakedQuadView) (Object) quad).hasShade()) {
material = RenderMaterialImpl.setDisableDiffuse((RenderMaterialImpl) material, true);
}

if (material.ambientOcclusion().orElse(true) && !((BakedQuadView) quad).hasAO()) {
if (material.ambientOcclusion().orElse(true) && !((BakedQuadView) (Object) quad).hasAO()) {
material = RenderMaterialImpl.setAmbientOcclusion((RenderMaterialImpl) material, TriState.FALSE);
}

material(material);
tag(0);

// Copy geometry cached inside the quad
BakedQuadView bakedView = (BakedQuadView) quad;
BakedQuadView bakedView = (BakedQuadView) (Object) quad;
NormI8.unpack(bakedView.getFaceNormal(), faceNormal);
data[baseIndex + HEADER_FACE_NORMAL] = bakedView.getFaceNormal();
int headerBits = EncodingFormat.lightFace(data[baseIndex + HEADER_BITS], bakedView.getLightFace());
headerBits = EncodingFormat.normalFace(headerBits, bakedView.getNormalFace());
data[baseIndex + HEADER_BITS] = EncodingFormat.geometryFlags(headerBits, bakedView.getFlags());
isGeometryInvalid = false;

int lightEmission = quad.getLightEmission();
int lightEmission = quad.lightEmission();

if (lightEmission > 0) {
for (int i = 0; i < 4; i++) {
lightmap(i, LightTexture.lightCoordsWithEmission(lightmap(i), lightEmission));
}
}

cachedSprite(quad.getSprite());
cachedSprite(quad.sprite());
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@
import net.minecraft.client.renderer.LightTexture;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.client.renderer.block.model.BlockStateModel;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.util.RandomSource;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.level.BlockAndTintGetter;
import net.minecraft.world.level.block.state.BlockState;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -66,7 +65,7 @@ public class BlockEmitter extends MutableQuadViewImpl {
clear();
}

public void bufferDefaultModel(BakedModel model, BlockState state, Predicate<Direction> cullTest) {
public void bufferDefaultModel(BlockStateModel model, BlockState state, Predicate<Direction> cullTest) {
AbstractBlockRenderContext.this.bufferDefaultModel(model, state, cullTest);
}

Expand Down Expand Up @@ -207,7 +206,7 @@ protected void shadeQuad(MutableQuadViewImpl quad, LightMode lightMode, boolean
}

/* Handling of vanilla models - this is the hot path for non-modded models */
public void bufferDefaultModel(BakedModel model, @Nullable BlockState state, Predicate<Direction> cullTest) {
public void bufferDefaultModel(BlockStateModel model, @Nullable BlockState state, Predicate<Direction> cullTest) {
MutableQuadViewImpl editorQuad = this.editorQuad;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.Sheets;
import net.minecraft.client.renderer.block.model.BlockStateModel;
import net.minecraft.client.renderer.entity.ItemRenderer;
import net.minecraft.client.renderer.item.ItemStackRenderState;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.util.RandomSource;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.level.block.state.BlockState;
Expand All @@ -64,7 +64,7 @@ public class ItemEmitter extends MutableQuadViewImpl {
clear();
}

public void bufferDefaultModel(BakedModel model) {
public void bufferDefaultModel(BlockStateModel model) {
ItemRenderContext.this.bufferDefaultModel(this, model, null);
}

Expand Down Expand Up @@ -115,7 +115,7 @@ public QuadEmitter getEmitter() {
return editorQuad;
}

public void renderModel(ItemDisplayContext transformMode, PoseStack poseStack, MultiBufferSource bufferSource, int lightmap, int overlay, BakedModel model, int[] colors, RenderType layer, ItemStackRenderState.FoilType glint) {
public void renderModel(ItemDisplayContext transformMode, PoseStack poseStack, MultiBufferSource bufferSource, int lightmap, int overlay, BlockStateModel model, int[] colors, RenderType layer, ItemStackRenderState.FoilType glint) {
this.transformMode = transformMode;
this.poseStack = poseStack;
matPosition = poseStack.last().pose();
Expand Down Expand Up @@ -243,7 +243,7 @@ private VertexConsumer createVertexConsumer(RenderType type, ItemStackRenderStat
return ItemRenderer.getFoilBuffer(bufferSource, type, true, glint != ItemStackRenderState.FoilType.NONE);
}

public void bufferDefaultModel(QuadEmitter quadEmitter, BakedModel model, @Nullable BlockState state) {
public void bufferDefaultModel(QuadEmitter quadEmitter, BlockStateModel model, @Nullable BlockState state) {
if (vanillaBufferer == null) {
VanillaModelEncoder.emitItemQuads(quadEmitter, model, null, randomSupplier);
} else {
Expand All @@ -268,6 +268,6 @@ public void bufferDefaultModel(QuadEmitter quadEmitter, BakedModel model, @Nulla
/** used to accept a method reference from the ItemRenderer. */
@FunctionalInterface
public interface VanillaModelBufferer {
void accept(BakedModel model, int[] colirs, int color, int overlay, PoseStack matrixStack, VertexConsumer buffer);
void accept(BlockStateModel model, int[] colirs, int color, int overlay, PoseStack matrixStack, VertexConsumer buffer);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import net.fabricmc.fabric.api.util.TriState;
import net.minecraft.client.color.block.BlockColors;
import net.minecraft.client.renderer.ItemBlockRenderTypes;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.client.renderer.block.model.BlockStateModel;
import net.minecraft.core.BlockPos;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.BlockAndTintGetter;
Expand All @@ -56,7 +56,7 @@ public NonTerrainBlockRenderContext(BlockColors colorMap) {
this.lighters = new LightPipelineProvider(this.lightDataCache);
}

public void renderModel(BlockAndTintGetter blockView, BakedModel model, BlockState state, BlockPos pos, PoseStack poseStack, VertexConsumer buffer, boolean cull, RandomSource random, long seed, int overlay) {
public void renderModel(BlockAndTintGetter blockView, BlockStateModel model, BlockState state, BlockPos pos, PoseStack poseStack, VertexConsumer buffer, boolean cull, RandomSource random, long seed, int overlay) {
this.level = blockView;
this.state = state;
this.pos = pos;
Expand Down
Loading

0 comments on commit e4c58ab

Please sign in to comment.