From 1adbf277eefc4a542d67acca3e94aea3b3f0e6ef Mon Sep 17 00:00:00 2001 From: PepperCode1 <44146161+peppercode1@users.noreply.github.com> Date: Thu, 23 Feb 2023 10:13:38 +0000 Subject: [PATCH 01/14] Indigo shade related fixes and other changes (#2898) * Apply disabled shade from vanilla quads directly to material - Remove QuadViewImpl.shade * Fix enhanced AO calculation and respect non-terrain culling state - Fix AoCalculator using AO face data computed with a potentially different shade state - Move non-cached computation code to separate method in AoCalculator - Turn AoCalculator's brightnessFunc and aoFunc into abstract methods - Do not check null check world in non-terrain AO calculation since it cannot be null - Pass through lightFace and shade state as method arguments in AoCalculator methods to prevent additional lookups - Do not check for the axis aligned flag in AbstractQuadRenderer.shadeFlatQuad - Respect cull parameter passed to non-terrain rendering by merging TerrainBlockRenderInfo into BlockRenderInfo - Use reusable search pos when calling Block.shouldDrawSide to prevent additional BlockPos allocation - Change BlockRenderContext.render and TerrainRenderContext.tessellateBlock to return void since return value is no longer used - Remove QuadViewImpl.vertexStart since it is unused * Add suggestions - Mark Direction parameter to BlockRenderInfo.shouldDrawFace as Nullable - Reuse MaterialFinder in FrameBakedModel (cherry picked from commit 3a95925af4ebaa352fcf631b9b3e6f99b14062b3) --- .../simple/client/FrameBakedModel.java | 11 +- .../indigo/renderer/RenderMaterialImpl.java | 8 + .../indigo/renderer/aocalc/AoCalculator.java | 330 +++++++++--------- .../renderer/mesh/MutableQuadViewImpl.java | 7 +- .../indigo/renderer/mesh/QuadViewImpl.java | 12 +- .../renderer/render/AbstractQuadRenderer.java | 7 +- .../renderer/render/BlockRenderContext.java | 36 +- .../renderer/render/BlockRenderInfo.java | 39 ++- .../render/TerrainBlockRenderInfo.java | 56 --- .../renderer/render/TerrainRenderContext.java | 21 +- .../renderer/BlockModelRendererMixin.java | 5 +- 11 files changed, 246 insertions(+), 286 deletions(-) delete mode 100644 fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/render/TerrainBlockRenderInfo.java diff --git a/fabric-renderer-api-v1/src/testmod/java/net/fabricmc/fabric/test/renderer/simple/client/FrameBakedModel.java b/fabric-renderer-api-v1/src/testmod/java/net/fabricmc/fabric/test/renderer/simple/client/FrameBakedModel.java index c1133d982c..1417e313ea 100644 --- a/fabric-renderer-api-v1/src/testmod/java/net/fabricmc/fabric/test/renderer/simple/client/FrameBakedModel.java +++ b/fabric-renderer-api-v1/src/testmod/java/net/fabricmc/fabric/test/renderer/simple/client/FrameBakedModel.java @@ -34,12 +34,12 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; -import net.minecraft.world.BlockRenderView; import net.minecraft.util.math.random.Random; +import net.minecraft.world.BlockRenderView; -import net.fabricmc.fabric.api.renderer.v1.Renderer; import net.fabricmc.fabric.api.renderer.v1.RendererAccess; import net.fabricmc.fabric.api.renderer.v1.material.BlendMode; +import net.fabricmc.fabric.api.renderer.v1.material.MaterialFinder; import net.fabricmc.fabric.api.renderer.v1.material.RenderMaterial; import net.fabricmc.fabric.api.renderer.v1.mesh.Mesh; import net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel; @@ -57,9 +57,10 @@ final class FrameBakedModel implements BakedModel, FabricBakedModel { this.frameMesh = frameMesh; this.frameSprite = frameSprite; - Renderer renderer = RendererAccess.INSTANCE.getRenderer(); - this.translucentMaterial = renderer.materialFinder().blendMode(0, BlendMode.TRANSLUCENT).find(); - this.translucentEmissiveMaterial = renderer.materialFinder().blendMode(0, BlendMode.TRANSLUCENT).emissive(0, true).find(); + MaterialFinder finder = RendererAccess.INSTANCE.getRenderer().materialFinder(); + this.translucentMaterial = finder.blendMode(0, BlendMode.TRANSLUCENT).find(); + finder.clear(); + this.translucentEmissiveMaterial = finder.blendMode(0, BlendMode.TRANSLUCENT).emissive(0, true).find(); } @Override diff --git a/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/RenderMaterialImpl.java b/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/RenderMaterialImpl.java index 0f56530455..4e86f40e0c 100644 --- a/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/RenderMaterialImpl.java +++ b/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/RenderMaterialImpl.java @@ -52,6 +52,14 @@ public static RenderMaterialImpl.Value byIndex(int index) { return VALUES[index]; } + public static Value setDisableDiffuse(Value material, int textureIndex, boolean disable) { + if (material.disableDiffuse(textureIndex) != disable) { + return byIndex(disable ? (material.bits | DIFFUSE_FLAG) : (material.bits & ~DIFFUSE_FLAG)); + } + + return material; + } + protected int bits; public BlendMode blendMode(int textureIndex) { diff --git a/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/aocalc/AoCalculator.java b/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/aocalc/AoCalculator.java index 016b4aff71..7ca73c7d7f 100644 --- a/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/aocalc/AoCalculator.java +++ b/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/aocalc/AoCalculator.java @@ -40,8 +40,6 @@ import net.minecraft.util.math.Vec3f; import net.minecraft.world.BlockRenderView; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; import net.fabricmc.fabric.impl.client.indigo.Indigo; import net.fabricmc.fabric.impl.client.indigo.renderer.aocalc.AoFace.WeightFunction; import net.fabricmc.fabric.impl.client.indigo.renderer.mesh.EncodingFormat; @@ -52,19 +50,7 @@ /** * Adaptation of inner, non-static class in BlockModelRenderer that serves same purpose. */ -@Environment(EnvType.CLIENT) -public class AoCalculator { - @FunctionalInterface - public interface BrightnessFunc { - int apply(BlockPos pos, BlockState state); - } - - /** Used to receive a method reference in constructor for ao value lookup. */ - @FunctionalInterface - public interface AoFunc { - float apply(BlockPos pos, BlockState state); - } - +public abstract class AoCalculator { /** * Vanilla models with cubic quads have vertices in a certain order, which allows * us to map them using a lookup. Adapted from enum in vanilla AoCalculator. @@ -84,12 +70,14 @@ public interface AoFunc { private final BlockModelRenderer.AmbientOcclusionCalculator vanillaCalc; private final BlockPos.Mutable lightPos = new BlockPos.Mutable(); private final BlockPos.Mutable searchPos = new BlockPos.Mutable(); - private final BlockRenderInfo blockInfo; - private final BrightnessFunc brightnessFunc; - private final AoFunc aoFunc; + protected final BlockRenderInfo blockInfo; + + public abstract int light(BlockPos pos, BlockState state); + + public abstract float ao(BlockPos pos, BlockState state); /** caches results of {@link #computeFace(Direction, boolean, boolean)} for the current block. */ - private final AoFaceData[] faceData = new AoFaceData[12]; + private final AoFaceData[] faceData = new AoFaceData[24]; /** indicates which elements of {@link #faceData} have been computed for the current block. */ private int completionFlags = 0; @@ -101,13 +89,11 @@ public interface AoFunc { public final float[] ao = new float[4]; public final int[] light = new int[4]; - public AoCalculator(BlockRenderInfo blockInfo, BrightnessFunc brightnessFunc, AoFunc aoFunc) { + public AoCalculator(BlockRenderInfo blockInfo) { this.blockInfo = blockInfo; - this.brightnessFunc = brightnessFunc; - this.aoFunc = aoFunc; this.vanillaCalc = new BlockModelRenderer.AmbientOcclusionCalculator(); - for (int i = 0; i < 12; i++) { + for (int i = 0; i < 24; i++) { faceData[i] = new AoFaceData(); } } @@ -183,11 +169,11 @@ private void calcVanilla(MutableQuadViewImpl quad) { private void calcVanilla(MutableQuadViewImpl quad, float[] aoDest, int[] lightDest) { vanillaAoControlBits.clear(); - final Direction face = quad.lightFace(); + final Direction lightFace = quad.lightFace(); quad.toVanilla(0, vertexData, 0, false); - VanillaAoHelper.updateShape(blockInfo.blockView, blockInfo.blockState, blockInfo.blockPos, vertexData, face, vanillaAoData, vanillaAoControlBits); - vanillaCalc.apply(blockInfo.blockView, blockInfo.blockState, blockInfo.blockPos, quad.lightFace(), vanillaAoData, vanillaAoControlBits, quad.hasShade()); + VanillaAoHelper.updateShape(blockInfo.blockView, blockInfo.blockState, blockInfo.blockPos, vertexData, lightFace, vanillaAoData, vanillaAoControlBits); + vanillaCalc.apply(blockInfo.blockView, blockInfo.blockState, blockInfo.blockPos, lightFace, vanillaAoData, vanillaAoControlBits, quad.hasShade()); System.arraycopy(vanillaCalc.brightness, 0, aoDest, 0, 4); System.arraycopy(vanillaCalc.light, 0, lightDest, 0, 4); @@ -202,9 +188,9 @@ private void calcFastVanilla(MutableQuadViewImpl quad) { } if ((flags & CUBIC_FLAG) == 0) { - vanillaPartialFace(quad, (flags & LIGHT_FACE_FLAG) != 0); + vanillaPartialFace(quad, quad.lightFace(), (flags & LIGHT_FACE_FLAG) != 0, quad.hasShade()); } else { - vanillaFullFace(quad, (flags & LIGHT_FACE_FLAG) != 0); + vanillaFullFace(quad, quad.lightFace(), (flags & LIGHT_FACE_FLAG) != 0, quad.hasShade()); } } @@ -212,28 +198,26 @@ private void calcEnhanced(MutableQuadViewImpl quad) { switch (quad.geometryFlags()) { case AXIS_ALIGNED_FLAG | CUBIC_FLAG | LIGHT_FACE_FLAG: case AXIS_ALIGNED_FLAG | LIGHT_FACE_FLAG: - vanillaPartialFace(quad, true); + vanillaPartialFace(quad, quad.lightFace(), true, quad.hasShade()); break; case AXIS_ALIGNED_FLAG | CUBIC_FLAG: case AXIS_ALIGNED_FLAG: - blendedPartialFace(quad); + blendedPartialFace(quad, quad.lightFace(), quad.hasShade()); break; default: - irregularFace(quad); + irregularFace(quad, quad.hasShade()); break; } } - private void vanillaFullFace(QuadViewImpl quad, boolean isOnLightFace) { - final Direction lightFace = quad.lightFace(); - computeFace(lightFace, isOnLightFace, quad.hasShade()).toArray(ao, light, VERTEX_MAP[lightFace.getId()]); + private void vanillaFullFace(QuadViewImpl quad, Direction lightFace, boolean isOnLightFace, boolean shade) { + computeFace(lightFace, isOnLightFace, shade).toArray(ao, light, VERTEX_MAP[lightFace.getId()]); } - private void vanillaPartialFace(QuadViewImpl quad, boolean isOnLightFace) { - final Direction lightFace = quad.lightFace(); - AoFaceData faceData = computeFace(lightFace, isOnLightFace, quad.hasShade()); + private void vanillaPartialFace(QuadViewImpl quad, Direction lightFace, boolean isOnLightFace, boolean shade) { + AoFaceData faceData = computeFace(lightFace, isOnLightFace, shade); final WeightFunction wFunc = AoFace.get(lightFace).weightFunc; final float[] w = this.w; @@ -244,36 +228,35 @@ private void vanillaPartialFace(QuadViewImpl quad, boolean isOnLightFace) { } } - /** used in {@link #blendedInsetFace(QuadViewImpl quad, int vertexIndex, Direction lightFace)} as return variable to avoid new allocation. */ + /** used in {@link #blendedInsetFace(QuadViewImpl quad, int vertexIndex, Direction lightFace, boolean shade)} as return variable to avoid new allocation. */ AoFaceData tmpFace = new AoFaceData(); /** Returns linearly interpolated blend of outer and inner face based on depth of vertex in face. */ - private AoFaceData blendedInsetFace(QuadViewImpl quad, int vertexIndex, Direction lightFace) { + private AoFaceData blendedInsetFace(QuadViewImpl quad, int vertexIndex, Direction lightFace, boolean shade) { final float w1 = AoFace.get(lightFace).depthFunc.apply(quad, vertexIndex); final float w0 = 1 - w1; - return AoFaceData.weightedMean(computeFace(lightFace, true, quad.hasShade()), w0, computeFace(lightFace, false, quad.hasShade()), w1, tmpFace); + return AoFaceData.weightedMean(computeFace(lightFace, true, shade), w0, computeFace(lightFace, false, shade), w1, tmpFace); } /** - * Like {@link #blendedInsetFace(QuadViewImpl quad, int vertexIndex, Direction lightFace)} but optimizes if depth is 0 or 1. + * Like {@link #blendedInsetFace(QuadViewImpl quad, int vertexIndex, Direction lightFace, boolean shade)} but optimizes if depth is 0 or 1. * Used for irregular faces when depth varies by vertex to avoid unneeded interpolation. */ - private AoFaceData gatherInsetFace(QuadViewImpl quad, int vertexIndex, Direction lightFace) { + private AoFaceData gatherInsetFace(QuadViewImpl quad, int vertexIndex, Direction lightFace, boolean shade) { final float w1 = AoFace.get(lightFace).depthFunc.apply(quad, vertexIndex); if (MathHelper.approximatelyEquals(w1, 0)) { - return computeFace(lightFace, true, quad.hasShade()); + return computeFace(lightFace, true, shade); } else if (MathHelper.approximatelyEquals(w1, 1)) { - return computeFace(lightFace, false, quad.hasShade()); + return computeFace(lightFace, false, shade); } else { final float w0 = 1 - w1; - return AoFaceData.weightedMean(computeFace(lightFace, true, quad.hasShade()), w0, computeFace(lightFace, false, quad.hasShade()), w1, tmpFace); + return AoFaceData.weightedMean(computeFace(lightFace, true, shade), w0, computeFace(lightFace, false, shade), w1, tmpFace); } } - private void blendedPartialFace(QuadViewImpl quad) { - final Direction lightFace = quad.lightFace(); - AoFaceData faceData = blendedInsetFace(quad, 0, lightFace); + private void blendedPartialFace(QuadViewImpl quad, Direction lightFace, boolean shade) { + AoFaceData faceData = blendedInsetFace(quad, 0, lightFace, shade); final WeightFunction wFunc = AoFace.get(lightFace).weightFunc; for (int i = 0; i < 4; i++) { @@ -286,7 +269,7 @@ private void blendedPartialFace(QuadViewImpl quad) { /** used exclusively in irregular face to avoid new heap allocations each call. */ private final Vec3f vertexNormal = new Vec3f(); - private void irregularFace(MutableQuadViewImpl quad) { + private void irregularFace(MutableQuadViewImpl quad, boolean shade) { final Vec3f faceNorm = quad.faceNormal(); Vec3f normal; final float[] w = this.w; @@ -302,7 +285,7 @@ private void irregularFace(MutableQuadViewImpl quad) { if (!MathHelper.approximatelyEquals(0f, x)) { final Direction face = x > 0 ? Direction.EAST : Direction.WEST; - final AoFaceData fd = gatherInsetFace(quad, i, face); + final AoFaceData fd = gatherInsetFace(quad, i, face, shade); AoFace.get(face).weightFunc.apply(quad, i, w); final float n = x * x; final float a = fd.weigtedAo(w); @@ -320,7 +303,7 @@ private void irregularFace(MutableQuadViewImpl quad) { if (!MathHelper.approximatelyEquals(0f, y)) { final Direction face = y > 0 ? Direction.UP : Direction.DOWN; - final AoFaceData fd = gatherInsetFace(quad, i, face); + final AoFaceData fd = gatherInsetFace(quad, i, face, shade); AoFace.get(face).weightFunc.apply(quad, i, w); final float n = y * y; final float a = fd.weigtedAo(w); @@ -338,7 +321,7 @@ private void irregularFace(MutableQuadViewImpl quad) { if (!MathHelper.approximatelyEquals(0f, z)) { final Direction face = z > 0 ? Direction.SOUTH : Direction.NORTH; - final AoFaceData fd = gatherInsetFace(quad, i, face); + final AoFaceData fd = gatherInsetFace(quad, i, face, shade); AoFace.get(face).weightFunc.apply(quad, i, w); final float n = z * z; final float a = fd.weigtedAo(w); @@ -357,6 +340,19 @@ private void irregularFace(MutableQuadViewImpl quad) { } } + private AoFaceData computeFace(Direction lightFace, boolean isOnBlockFace, boolean shade) { + final int faceDataIndex = shade ? (isOnBlockFace ? lightFace.getId() : lightFace.getId() + 6) : (isOnBlockFace ? lightFace.getId() + 12 : lightFace.getId() + 18); + final int mask = 1 << faceDataIndex; + final AoFaceData result = faceData[faceDataIndex]; + + if ((completionFlags & mask) == 0) { + completionFlags |= mask; + computeFace(result, lightFace, isOnBlockFace, shade); + } + + return result; + } + /** * Computes smoothed brightness and Ao shading for four corners of a block face. * Outer block face is what you normally see and what you get when the second @@ -365,155 +361,145 @@ private void irregularFace(MutableQuadViewImpl quad) { * in vanilla logic for some blocks that aren't full opaque cubes. * Except for parameterization, the logic itself is practically identical to vanilla. */ - private AoFaceData computeFace(Direction lightFace, boolean isOnBlockFace, boolean shade) { - final int faceDataIndex = isOnBlockFace ? lightFace.getId() : lightFace.getId() + 6; - final int mask = 1 << faceDataIndex; - final AoFaceData result = faceData[faceDataIndex]; - - if ((completionFlags & mask) == 0) { - completionFlags |= mask; - - final BlockRenderView world = blockInfo.blockView; - final BlockPos pos = blockInfo.blockPos; - final BlockState blockState = blockInfo.blockState; - final BlockPos.Mutable lightPos = this.lightPos; - final BlockPos.Mutable searchPos = this.searchPos; - BlockState searchState; + private void computeFace(AoFaceData result, Direction lightFace, boolean isOnBlockFace, boolean shade) { + final BlockRenderView world = blockInfo.blockView; + final BlockPos pos = blockInfo.blockPos; + final BlockState blockState = blockInfo.blockState; + final BlockPos.Mutable lightPos = this.lightPos; + final BlockPos.Mutable searchPos = this.searchPos; + BlockState searchState; + + if (isOnBlockFace) { + lightPos.set(pos, lightFace); + } else { + lightPos.set(pos); + } - if (isOnBlockFace) { - lightPos.set(pos, lightFace); - } else { - lightPos.set(pos); - } + AoFace aoFace = AoFace.get(lightFace); - AoFace aoFace = AoFace.get(lightFace); + // Vanilla was further offsetting the positions for opaque block checks in the + // direction of the light face, but it was actually mis-sampling and causing + // visible artifacts in certain situations - // Vanilla was further offsetting the positions for opaque block checks in the - // direction of the light face, but it was actually mis-sampling and causing - // visible artifacts in certain situations + searchPos.set(lightPos, aoFace.neighbors[0]); + searchState = world.getBlockState(searchPos); + final int light0 = light(searchPos, searchState); + final float ao0 = ao(searchPos, searchState); - searchPos.set(lightPos, aoFace.neighbors[0]); + if (!Indigo.FIX_SMOOTH_LIGHTING_OFFSET) { + searchPos.move(lightFace); searchState = world.getBlockState(searchPos); - final int light0 = brightnessFunc.apply(searchPos, searchState); - final float ao0 = aoFunc.apply(searchPos, searchState); + } - if (!Indigo.FIX_SMOOTH_LIGHTING_OFFSET) { - searchPos.move(lightFace); - searchState = world.getBlockState(searchPos); - } + final boolean isClear0 = !searchState.shouldBlockVision(world, searchPos) || searchState.getOpacity(world, searchPos) == 0; - final boolean isClear0 = !searchState.shouldBlockVision(world, searchPos) || searchState.getOpacity(world, searchPos) == 0; + searchPos.set(lightPos, aoFace.neighbors[1]); + searchState = world.getBlockState(searchPos); + final int light1 = light(searchPos, searchState); + final float ao1 = ao(searchPos, searchState); - searchPos.set(lightPos, aoFace.neighbors[1]); + if (!Indigo.FIX_SMOOTH_LIGHTING_OFFSET) { + searchPos.move(lightFace); searchState = world.getBlockState(searchPos); - final int light1 = brightnessFunc.apply(searchPos, searchState); - final float ao1 = aoFunc.apply(searchPos, searchState); + } - if (!Indigo.FIX_SMOOTH_LIGHTING_OFFSET) { - searchPos.move(lightFace); - searchState = world.getBlockState(searchPos); - } + final boolean isClear1 = !searchState.shouldBlockVision(world, searchPos) || searchState.getOpacity(world, searchPos) == 0; - final boolean isClear1 = !searchState.shouldBlockVision(world, searchPos) || searchState.getOpacity(world, searchPos) == 0; + searchPos.set(lightPos, aoFace.neighbors[2]); + searchState = world.getBlockState(searchPos); + final int light2 = light(searchPos, searchState); + final float ao2 = ao(searchPos, searchState); - searchPos.set(lightPos, aoFace.neighbors[2]); + if (!Indigo.FIX_SMOOTH_LIGHTING_OFFSET) { + searchPos.move(lightFace); searchState = world.getBlockState(searchPos); - final int light2 = brightnessFunc.apply(searchPos, searchState); - final float ao2 = aoFunc.apply(searchPos, searchState); + } - if (!Indigo.FIX_SMOOTH_LIGHTING_OFFSET) { - searchPos.move(lightFace); - searchState = world.getBlockState(searchPos); - } + final boolean isClear2 = !searchState.shouldBlockVision(world, searchPos) || searchState.getOpacity(world, searchPos) == 0; - final boolean isClear2 = !searchState.shouldBlockVision(world, searchPos) || searchState.getOpacity(world, searchPos) == 0; + searchPos.set(lightPos, aoFace.neighbors[3]); + searchState = world.getBlockState(searchPos); + final int light3 = light(searchPos, searchState); + final float ao3 = ao(searchPos, searchState); - searchPos.set(lightPos, aoFace.neighbors[3]); + if (!Indigo.FIX_SMOOTH_LIGHTING_OFFSET) { + searchPos.move(lightFace); searchState = world.getBlockState(searchPos); - final int light3 = brightnessFunc.apply(searchPos, searchState); - final float ao3 = aoFunc.apply(searchPos, searchState); - - if (!Indigo.FIX_SMOOTH_LIGHTING_OFFSET) { - searchPos.move(lightFace); - searchState = world.getBlockState(searchPos); - } + } - final boolean isClear3 = !searchState.shouldBlockVision(world, searchPos) || searchState.getOpacity(world, searchPos) == 0; + final boolean isClear3 = !searchState.shouldBlockVision(world, searchPos) || searchState.getOpacity(world, searchPos) == 0; - // c = corner - values at corners of face - int cLight0, cLight1, cLight2, cLight3; - float cAo0, cAo1, cAo2, cAo3; + // c = corner - values at corners of face + int cLight0, cLight1, cLight2, cLight3; + float cAo0, cAo1, cAo2, cAo3; - // If neighbors on both sides of the corner are opaque, then apparently we use the light/shade - // from one of the sides adjacent to the corner. If either neighbor is clear (no light subtraction) - // then we use values from the outwardly diagonal corner. (outwardly = position is one more away from light face) - if (!isClear2 && !isClear0) { - cAo0 = ao0; - cLight0 = light0; - } else { - searchPos.set(lightPos).move(aoFace.neighbors[0]).move(aoFace.neighbors[2]); - searchState = world.getBlockState(searchPos); - cAo0 = aoFunc.apply(searchPos, searchState); - cLight0 = brightnessFunc.apply(searchPos, searchState); - } - - if (!isClear3 && !isClear0) { - cAo1 = ao0; - cLight1 = light0; - } else { - searchPos.set(lightPos).move(aoFace.neighbors[0]).move(aoFace.neighbors[3]); - searchState = world.getBlockState(searchPos); - cAo1 = aoFunc.apply(searchPos, searchState); - cLight1 = brightnessFunc.apply(searchPos, searchState); - } + // If neighbors on both sides of the corner are opaque, then apparently we use the light/shade + // from one of the sides adjacent to the corner. If either neighbor is clear (no light subtraction) + // then we use values from the outwardly diagonal corner. (outwardly = position is one more away from light face) + if (!isClear2 && !isClear0) { + cAo0 = ao0; + cLight0 = light0; + } else { + searchPos.set(lightPos).move(aoFace.neighbors[0]).move(aoFace.neighbors[2]); + searchState = world.getBlockState(searchPos); + cAo0 = ao(searchPos, searchState); + cLight0 = light(searchPos, searchState); + } - if (!isClear2 && !isClear1) { - cAo2 = ao1; - cLight2 = light1; - } else { - searchPos.set(lightPos).move(aoFace.neighbors[1]).move(aoFace.neighbors[2]); - searchState = world.getBlockState(searchPos); - cAo2 = aoFunc.apply(searchPos, searchState); - cLight2 = brightnessFunc.apply(searchPos, searchState); - } + if (!isClear3 && !isClear0) { + cAo1 = ao0; + cLight1 = light0; + } else { + searchPos.set(lightPos).move(aoFace.neighbors[0]).move(aoFace.neighbors[3]); + searchState = world.getBlockState(searchPos); + cAo1 = ao(searchPos, searchState); + cLight1 = light(searchPos, searchState); + } - if (!isClear3 && !isClear1) { - cAo3 = ao1; - cLight3 = light1; - } else { - searchPos.set(lightPos).move(aoFace.neighbors[1]).move(aoFace.neighbors[3]); - searchState = world.getBlockState(searchPos); - cAo3 = aoFunc.apply(searchPos, searchState); - cLight3 = brightnessFunc.apply(searchPos, searchState); - } + if (!isClear2 && !isClear1) { + cAo2 = ao1; + cLight2 = light1; + } else { + searchPos.set(lightPos).move(aoFace.neighbors[1]).move(aoFace.neighbors[2]); + searchState = world.getBlockState(searchPos); + cAo2 = ao(searchPos, searchState); + cLight2 = light(searchPos, searchState); + } - // If on block face or neighbor isn't occluding, "center" will be neighbor brightness - // Doesn't use light pos because logic not based solely on this block's geometry - int lightCenter; - searchPos.set(pos, lightFace); + if (!isClear3 && !isClear1) { + cAo3 = ao1; + cLight3 = light1; + } else { + searchPos.set(lightPos).move(aoFace.neighbors[1]).move(aoFace.neighbors[3]); searchState = world.getBlockState(searchPos); + cAo3 = ao(searchPos, searchState); + cLight3 = light(searchPos, searchState); + } - if (isOnBlockFace || !searchState.isOpaqueFullCube(world, searchPos)) { - lightCenter = brightnessFunc.apply(searchPos, searchState); - } else { - lightCenter = brightnessFunc.apply(pos, blockState); - } + // If on block face or neighbor isn't occluding, "center" will be neighbor brightness + // Doesn't use light pos because logic not based solely on this block's geometry + int lightCenter; + searchPos.set(pos, lightFace); + searchState = world.getBlockState(searchPos); - float aoCenter = aoFunc.apply(lightPos, world.getBlockState(lightPos)); - float worldBrightness = world.getBrightness(lightFace, shade); + if (isOnBlockFace || !searchState.isOpaqueFullCube(world, searchPos)) { + lightCenter = light(searchPos, searchState); + } else { + lightCenter = light(pos, blockState); + } - result.a0 = ((ao3 + ao0 + cAo1 + aoCenter) * 0.25F) * worldBrightness; - result.a1 = ((ao2 + ao0 + cAo0 + aoCenter) * 0.25F) * worldBrightness; - result.a2 = ((ao2 + ao1 + cAo2 + aoCenter) * 0.25F) * worldBrightness; - result.a3 = ((ao3 + ao1 + cAo3 + aoCenter) * 0.25F) * worldBrightness; + float aoCenter = ao(lightPos, world.getBlockState(lightPos)); + float worldBrightness = world.getBrightness(lightFace, shade); - result.l0(meanBrightness(light3, light0, cLight1, lightCenter)); - result.l1(meanBrightness(light2, light0, cLight0, lightCenter)); - result.l2(meanBrightness(light2, light1, cLight2, lightCenter)); - result.l3(meanBrightness(light3, light1, cLight3, lightCenter)); - } + result.a0 = ((ao3 + ao0 + cAo1 + aoCenter) * 0.25F) * worldBrightness; + result.a1 = ((ao2 + ao0 + cAo0 + aoCenter) * 0.25F) * worldBrightness; + result.a2 = ((ao2 + ao1 + cAo2 + aoCenter) * 0.25F) * worldBrightness; + result.a3 = ((ao3 + ao1 + cAo3 + aoCenter) * 0.25F) * worldBrightness; - return result; + result.l0(meanBrightness(light3, light0, cLight1, lightCenter)); + result.l1(meanBrightness(light2, light0, cLight0, lightCenter)); + result.l2(meanBrightness(light2, light1, cLight2, lightCenter)); + result.l3(meanBrightness(light3, light1, cLight3, lightCenter)); } /** diff --git a/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/mesh/MutableQuadViewImpl.java b/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/mesh/MutableQuadViewImpl.java index c02113a369..60e40ec7c5 100644 --- a/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/mesh/MutableQuadViewImpl.java +++ b/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/mesh/MutableQuadViewImpl.java @@ -38,6 +38,7 @@ import net.fabricmc.fabric.api.renderer.v1.material.RenderMaterial; import net.fabricmc.fabric.api.renderer.v1.mesh.QuadEmitter; import net.fabricmc.fabric.impl.client.indigo.renderer.IndigoRenderer; +import net.fabricmc.fabric.impl.client.indigo.renderer.RenderMaterialImpl; import net.fabricmc.fabric.impl.client.indigo.renderer.RenderMaterialImpl.Value; import net.fabricmc.fabric.impl.client.indigo.renderer.helper.NormalHelper; import net.fabricmc.fabric.impl.client.indigo.renderer.helper.TextureHelper; @@ -116,9 +117,13 @@ public final MutableQuadViewImpl fromVanilla(BakedQuad quad, RenderMaterial mate data[baseIndex + HEADER_BITS] = EncodingFormat.cullFace(0, cullFace); nominalFace(quad.getFace()); colorIndex(quad.getColorIndex()); + + if (!quad.hasShade()) { + material = RenderMaterialImpl.setDisableDiffuse((Value) material, 0, true); + } + material(material); tag(0); - shade(quad.hasShade()); isGeometryInvalid = true; return this; } diff --git a/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/mesh/QuadViewImpl.java b/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/mesh/QuadViewImpl.java index c386e3a39b..2e940f88bf 100644 --- a/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/mesh/QuadViewImpl.java +++ b/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/mesh/QuadViewImpl.java @@ -18,7 +18,6 @@ import static net.fabricmc.fabric.impl.client.indigo.renderer.mesh.EncodingFormat.HEADER_BITS; import static net.fabricmc.fabric.impl.client.indigo.renderer.mesh.EncodingFormat.HEADER_COLOR_INDEX; -import static net.fabricmc.fabric.impl.client.indigo.renderer.mesh.EncodingFormat.HEADER_STRIDE; import static net.fabricmc.fabric.impl.client.indigo.renderer.mesh.EncodingFormat.HEADER_TAG; import static net.fabricmc.fabric.impl.client.indigo.renderer.mesh.EncodingFormat.QUAD_STRIDE; import static net.fabricmc.fabric.impl.client.indigo.renderer.mesh.EncodingFormat.VERTEX_COLOR; @@ -52,7 +51,6 @@ public class QuadViewImpl implements QuadView { /** True when geometry flags or light face may not match geometry. */ protected boolean isGeometryInvalid = true; protected final Vec3f faceNormal = new Vec3f(); - private boolean shade = true; /** Size and where it comes from will vary in subtypes. But in all cases quad is fully encoded to array. */ protected int[] data; @@ -268,15 +266,7 @@ public float spriteV(int vertexIndex, int spriteIndex) { return Float.intBitsToFloat(data[baseIndex + vertexIndex * VERTEX_STRIDE + VERTEX_V]); } - public int vertexStart() { - return baseIndex + HEADER_STRIDE; - } - public boolean hasShade() { - return shade && !material().disableDiffuse(0); - } - - public void shade(boolean shade) { - this.shade = shade; + return !material().disableDiffuse(0); } } diff --git a/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/render/AbstractQuadRenderer.java b/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/render/AbstractQuadRenderer.java index 2fb815bd10..e0fd7dddcf 100644 --- a/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/render/AbstractQuadRenderer.java +++ b/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/render/AbstractQuadRenderer.java @@ -36,7 +36,6 @@ import net.fabricmc.fabric.impl.client.indigo.renderer.RenderMaterialImpl; import net.fabricmc.fabric.impl.client.indigo.renderer.aocalc.AoCalculator; import net.fabricmc.fabric.impl.client.indigo.renderer.helper.ColorHelper; -import net.fabricmc.fabric.impl.client.indigo.renderer.helper.GeometryHelper; import net.fabricmc.fabric.impl.client.indigo.renderer.mesh.MutableQuadViewImpl; /** @@ -234,9 +233,9 @@ int flatBrightness(MutableQuadViewImpl quad, BlockState blockState, BlockPos pos * even for un-shaded quads. These are also applied with AO shading but that is done in AO calculator. */ private void shadeFlatQuad(MutableQuadViewImpl quad) { - if ((quad.geometryFlags() & GeometryHelper.AXIS_ALIGNED_FLAG) == 0 || quad.hasVertexNormals()) { - // Quads that aren't direction-aligned or that have vertex normals need to be shaded - // using interpolation - vanilla can't handle them. Generally only applies to modded models. + if (quad.hasVertexNormals()) { + // Quads that have vertex normals need to be shaded using interpolation - vanilla can't + // handle them. Generally only applies to modded models. final float faceShade = blockInfo.blockView.getBrightness(quad.lightFace(), quad.hasShade()); for (int i = 0; i < 4; i++) { diff --git a/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/render/BlockRenderContext.java b/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/render/BlockRenderContext.java index 52f24d0e9f..0eedbea171 100644 --- a/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/render/BlockRenderContext.java +++ b/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/render/BlockRenderContext.java @@ -20,7 +20,6 @@ import java.util.function.Supplier; import net.minecraft.block.BlockState; -import net.minecraft.client.render.LightmapTextureManager; import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.WorldRenderer; @@ -43,10 +42,20 @@ */ public class BlockRenderContext extends AbstractRenderContext { private final BlockRenderInfo blockInfo = new BlockRenderInfo(); - private final AoCalculator aoCalc = new AoCalculator(blockInfo, this::brightness, this::aoLevel); + + private final AoCalculator aoCalc = new AoCalculator(blockInfo) { + @Override + public int light(BlockPos pos, BlockState state) { + return WorldRenderer.getLightmapCoordinates(blockInfo.blockView, state, pos); + } + + @Override + public float ao(BlockPos pos, BlockState state) { + return AoLuminanceFix.INSTANCE.apply(blockInfo.blockView, pos, state); + } + }; private VertexConsumer bufferBuilder; - private boolean didOutput = false; // These are kept as fields to avoid the heap allocation for a supplier. // BlockModelRenderer allows the caller to supply both the random object and seed. private Random random; @@ -94,25 +103,11 @@ protected int overlay() { } }; - private int brightness(BlockPos pos, BlockState state) { - if (blockInfo.blockView == null) { - return LightmapTextureManager.MAX_LIGHT_COORDINATE; - } - - return WorldRenderer.getLightmapCoordinates(blockInfo.blockView, state, pos); - } - - private float aoLevel(BlockPos pos, BlockState state) { - final BlockRenderView blockView = blockInfo.blockView; - return blockView == null ? 1f : AoLuminanceFix.INSTANCE.apply(blockView, pos, state); - } - private VertexConsumer outputBuffer(RenderLayer renderLayer) { - didOutput = true; return bufferBuilder; } - public boolean render(BlockRenderView blockView, BakedModel model, BlockState state, BlockPos pos, MatrixStack matrixStack, VertexConsumer buffer, Random random, long seed, int overlay) { + public void render(BlockRenderView blockView, BakedModel model, BlockState state, BlockPos pos, MatrixStack matrixStack, VertexConsumer buffer, boolean cull, Random random, long seed, int overlay) { this.bufferBuilder = buffer; this.matrix = matrixStack.peek().getPositionMatrix(); this.normalMatrix = matrixStack.peek().getNormalMatrix(); @@ -120,9 +115,8 @@ public boolean render(BlockRenderView blockView, BakedModel model, BlockState st this.seed = seed; this.overlay = overlay; - this.didOutput = false; aoCalc.clear(); - blockInfo.setBlockView(blockView); + blockInfo.prepareForWorld(blockView, cull); blockInfo.prepareForBlock(state, pos, model.useAmbientOcclusion()); ((FabricBakedModel) model).emitBlockQuads(blockView, state, pos, randomSupplier, this); @@ -131,8 +125,6 @@ public boolean render(BlockRenderView blockView, BakedModel model, BlockState st this.bufferBuilder = null; this.random = null; this.seed = seed; - - return didOutput; } @Override diff --git a/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/render/BlockRenderInfo.java b/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/render/BlockRenderInfo.java index 6577786304..9da40417cd 100644 --- a/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/render/BlockRenderInfo.java +++ b/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/render/BlockRenderInfo.java @@ -18,6 +18,9 @@ import java.util.function.Supplier; +import org.jetbrains.annotations.Nullable; + +import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.client.MinecraftClient; import net.minecraft.client.color.block.BlockColors; @@ -25,8 +28,8 @@ import net.minecraft.client.render.RenderLayers; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; -import net.minecraft.world.BlockRenderView; import net.minecraft.util.math.random.Random; +import net.minecraft.world.BlockRenderView; import net.fabricmc.fabric.api.renderer.v1.material.BlendMode; @@ -39,6 +42,7 @@ */ public class BlockRenderInfo { private final BlockColors blockColorMap = MinecraftClient.getInstance().getBlockColors(); + private final BlockPos.Mutable searchPos = new BlockPos.Mutable(); private final Random random = Random.create(); public BlockRenderView blockView; public BlockPos blockPos; @@ -47,6 +51,10 @@ public class BlockRenderInfo { boolean defaultAo; RenderLayer defaultLayer; + private boolean enableCulling; + private int cullCompletionFlags; + private int cullResultFlags; + public final Supplier randomSupplier = () -> { final Random result = random; long seed = this.seed; @@ -60,18 +68,22 @@ public class BlockRenderInfo { return result; }; - public void setBlockView(BlockRenderView blockView) { + public void prepareForWorld(BlockRenderView blockView, boolean enableCulling) { this.blockView = blockView; + this.enableCulling = enableCulling; } public void prepareForBlock(BlockState blockState, BlockPos blockPos, boolean modelAO) { this.blockPos = blockPos; this.blockState = blockState; - // in the unlikely case seed actually matches this, we'll simply retrieve it more than one + // in the unlikely case seed actually matches this, we'll simply retrieve it more than once seed = -1L; defaultAo = modelAO && MinecraftClient.isAmbientOcclusionEnabled() && blockState.getLuminance() == 0; defaultLayer = RenderLayers.getBlockLayer(blockState); + + cullCompletionFlags = 0; + cullResultFlags = 0; } public void release() { @@ -83,8 +95,25 @@ int blockColor(int colorIndex) { return 0xFF000000 | blockColorMap.getColor(blockState, blockView, blockPos, colorIndex); } - boolean shouldDrawFace(Direction face) { - return true; + boolean shouldDrawFace(@Nullable Direction face) { + if (face == null || !enableCulling) { + return true; + } + + final int mask = 1 << face.getId(); + + if ((cullCompletionFlags & mask) == 0) { + cullCompletionFlags |= mask; + + if (Block.shouldDrawSide(blockState, blockView, blockPos, face, searchPos.set(blockPos, face))) { + cullResultFlags |= mask; + return true; + } else { + return false; + } + } else { + return (cullResultFlags & mask) != 0; + } } RenderLayer effectiveRenderLayer(BlendMode blendMode) { diff --git a/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/render/TerrainBlockRenderInfo.java b/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/render/TerrainBlockRenderInfo.java deleted file mode 100644 index c7404ea4bc..0000000000 --- a/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/render/TerrainBlockRenderInfo.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2016, 2017, 2018, 2019 FabricMC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.fabricmc.fabric.impl.client.indigo.renderer.render; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; - -public class TerrainBlockRenderInfo extends BlockRenderInfo { - private int cullCompletionFlags; - private int cullResultFlags; - - @Override - public void prepareForBlock(BlockState blockState, BlockPos blockPos, boolean modelAO) { - super.prepareForBlock(blockState, blockPos, modelAO); - cullCompletionFlags = 0; - cullResultFlags = 0; - } - - @Override - boolean shouldDrawFace(Direction face) { - if (face == null) { - return true; - } - - final int mask = 1 << face.getId(); - - if ((cullCompletionFlags & mask) == 0) { - cullCompletionFlags |= mask; - - if (Block.shouldDrawSide(blockState, blockView, blockPos, face, blockPos.offset(face))) { - cullResultFlags |= mask; - return true; - } else { - return false; - } - } else { - return (cullResultFlags & mask) != 0; - } - } -} diff --git a/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/render/TerrainRenderContext.java b/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/render/TerrainRenderContext.java index 59165b6f24..290717fb64 100644 --- a/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/render/TerrainRenderContext.java +++ b/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/render/TerrainRenderContext.java @@ -47,9 +47,19 @@ public class TerrainRenderContext extends AbstractRenderContext { public static final ThreadLocal POOL = ThreadLocal.withInitial(TerrainRenderContext::new); - private final TerrainBlockRenderInfo blockInfo = new TerrainBlockRenderInfo(); + private final BlockRenderInfo blockInfo = new BlockRenderInfo(); private final ChunkRenderInfo chunkInfo = new ChunkRenderInfo(); - private final AoCalculator aoCalc = new AoCalculator(blockInfo, chunkInfo::cachedBrightness, chunkInfo::cachedAoLevel); + private final AoCalculator aoCalc = new AoCalculator(blockInfo) { + @Override + public int light(BlockPos pos, BlockState state) { + return chunkInfo.cachedBrightness(pos, state); + } + + @Override + public float ao(BlockPos pos, BlockState state) { + return chunkInfo.cachedAoLevel(pos, state); + } + }; private final AbstractMeshConsumer meshConsumer = new AbstractMeshConsumer(blockInfo, chunkInfo::getInitializedBuffer, aoCalc, this::transform) { @Override @@ -86,7 +96,7 @@ protected Matrix3f normalMatrix() { }; public void prepare(ChunkRendererRegion blockView, BuiltChunk chunkRenderer, BuiltChunk.RebuildTask.RenderData renderData, BlockBufferBuilderStorage builders, Set initializedLayers) { - blockInfo.setBlockView(blockView); + blockInfo.prepareForWorld(blockView, true); chunkInfo.prepare(blockView, chunkRenderer, renderData, builders, initializedLayers); } @@ -96,7 +106,7 @@ public void release() { } /** Called from chunk renderer hook. */ - public boolean tessellateBlock(BlockState blockState, BlockPos blockPos, final BakedModel model, MatrixStack matrixStack) { + public void tessellateBlock(BlockState blockState, BlockPos blockPos, final BakedModel model, MatrixStack matrixStack) { this.matrix = matrixStack.peek().getPositionMatrix(); this.normalMatrix = matrixStack.peek().getNormalMatrix(); @@ -110,9 +120,6 @@ public boolean tessellateBlock(BlockState blockState, BlockPos blockPos, final B CrashReportSection.addBlockInfo(crashReportSection, chunkInfo.blockView, blockPos, blockState); throw new CrashException(crashReport); } - - // false because we've already marked the chunk as populated - caller doesn't need to - return false; } @Override diff --git a/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/mixin/client/indigo/renderer/BlockModelRendererMixin.java b/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/mixin/client/indigo/renderer/BlockModelRendererMixin.java index 196dd78f56..f0c88c5981 100644 --- a/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/mixin/client/indigo/renderer/BlockModelRendererMixin.java +++ b/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/mixin/client/indigo/renderer/BlockModelRendererMixin.java @@ -41,11 +41,10 @@ public abstract class BlockModelRendererMixin { private final ThreadLocal fabric_contexts = ThreadLocal.withInitial(BlockRenderContext::new); @Inject(at = @At("HEAD"), method = "render(Lnet/minecraft/world/BlockRenderView;Lnet/minecraft/client/render/model/BakedModel;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;ZLnet/minecraft/util/math/random/Random;JI)V", cancellable = true) - private void hookRender(BlockRenderView blockView, BakedModel model, BlockState state, BlockPos pos, MatrixStack matrix, VertexConsumer buffer, boolean checkSides, Random rand, long seed, int overlay, CallbackInfo ci) { + private void hookRender(BlockRenderView blockView, BakedModel model, BlockState state, BlockPos pos, MatrixStack matrix, VertexConsumer buffer, boolean cull, Random rand, long seed, int overlay, CallbackInfo ci) { if (!((FabricBakedModel) model).isVanillaAdapter()) { BlockRenderContext context = fabric_contexts.get(); - // Note that we do not support face-culling here (so checkSides is ignored) - context.render(blockView, model, state, pos, matrix, buffer, rand, seed, overlay); + context.render(blockView, model, state, pos, matrix, buffer, cull, rand, seed, overlay); ci.cancel(); } } From e500c1746f1d54d6fbdaa09fd2c585e0c3f98fc7 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Thu, 23 Feb 2023 12:58:58 +0000 Subject: [PATCH 02/14] Bump version --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index e2462cf142..22bb2fc1af 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ org.gradle.jvmargs=-Xmx2560M org.gradle.parallel=true -version=0.73.2 +version=0.75.0 minecraft_version=1.19.2 yarn_version=+build.17 loader_version=0.14.9 @@ -44,7 +44,7 @@ fabric-particles-v1-version=1.0.14 fabric-recipe-api-v1-version=1.0.1 fabric-registry-sync-v0-version=0.9.32 fabric-renderer-api-v1-version=1.2.1 -fabric-renderer-indigo-version=0.7.1 +fabric-renderer-indigo-version=0.8.0 fabric-renderer-registries-v1-version=3.2.24 fabric-rendering-data-attachment-v1-version=0.3.19 fabric-rendering-fluids-v1-version=3.0.11 From cafc6e8e14d284346d816f5d5b40f5311690f02f Mon Sep 17 00:00:00 2001 From: Technici4n <13494793+Technici4n@users.noreply.github.com> Date: Fri, 24 Feb 2023 10:50:39 +0100 Subject: [PATCH 03/14] Fix #2925: deprecate item functions in BlockRenderLayerMap (#2930) (cherry picked from commit c2e6f6742472b8e360403f3eea579de3648ddcc7) (cherry picked from commit 928d44d5ce2b50f4420a03825465b42a62823b53) --- .../v1/BlockRenderLayerMap.java | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/fabric-blockrenderlayer-v1/src/client/java/net/fabricmc/fabric/api/blockrenderlayer/v1/BlockRenderLayerMap.java b/fabric-blockrenderlayer-v1/src/client/java/net/fabricmc/fabric/api/blockrenderlayer/v1/BlockRenderLayerMap.java index 08b2211be0..f0467234f4 100644 --- a/fabric-blockrenderlayer-v1/src/client/java/net/fabricmc/fabric/api/blockrenderlayer/v1/BlockRenderLayerMap.java +++ b/fabric-blockrenderlayer-v1/src/client/java/net/fabricmc/fabric/api/blockrenderlayer/v1/BlockRenderLayerMap.java @@ -18,6 +18,7 @@ import net.minecraft.block.Block; import net.minecraft.client.render.RenderLayer; +import net.minecraft.client.render.RenderLayers; import net.minecraft.fluid.Fluid; import net.minecraft.item.Item; @@ -25,10 +26,9 @@ /** * Use to associate blocks or fluids with block render layer other than default. - * Replaces the {@code renderLayer} property previously on {@code Block}. * - *

{@code BlockRenderLayer} controls how sprite pixels for fluids and blocks are blended - * with the scene. Consult the vanilla {@code BlockRenderLayer} implementation for examples. + *

{@link RenderLayers} control how sprite pixels for fluids and blocks are blended + * with the scene. Consult the vanilla {@link RenderLayers} implementation for examples. * *

The Fabric Renderer API can be used to control this at a per-quad level at the code * via {@code BlendMode}. @@ -57,21 +57,17 @@ public interface BlockRenderLayerMap { void putBlocks(RenderLayer renderLayer, Block... blocks); /** - * Map (or re-map) an item with a render layer. Re-mapping is not recommended but if done, last one in wins. - * Must be called from client thread prior to world load/rendering. Best practice will be to call from mod's client initializer. - * - * @param item Identifies item to be mapped. - * @param renderLayer Render layer. Should be one of the layers used for entity rendering. + * @deprecated For blocks, calling {@link #putBlock(Block, RenderLayer)} is enough. + * Other items always use a translucent render layer. */ + @Deprecated(forRemoval = true) void putItem(Item item, RenderLayer renderLayer); /** - * Map (or re-map) multiple items with a render layer. Re-mapping is not recommended but if done, last one in wins. - * Must be called from client thread prior to world load/rendering. Best practice will be to call from mod's client initializer. - * - * @param renderLayer Render layer. Should be one of the layers used for entity rendering. - * @param items Identifies items to be mapped. + * @deprecated For blocks, calling {@link #putBlocks(RenderLayer, Block...)} is enough. + * Other items always use a translucent render layer. */ + @Deprecated(forRemoval = true) void putItems(RenderLayer renderLayer, Item... items); /** From cb8186d4a3eac1277bdccc0953651945fea0ee97 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Fri, 24 Feb 2023 10:05:25 +0000 Subject: [PATCH 04/14] Bump version --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 22bb2fc1af..bfe8b6617a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ org.gradle.jvmargs=-Xmx2560M org.gradle.parallel=true -version=0.75.0 +version=0.75.1 minecraft_version=1.19.2 yarn_version=+build.17 loader_version=0.14.9 @@ -13,7 +13,7 @@ fabric-api-base-version=0.4.15 fabric-api-lookup-api-v1-version=1.6.14 fabric-biome-api-v1-version=9.1.0 fabric-block-api-v1-version=1.0.2 -fabric-blockrenderlayer-v1-version=1.1.24 +fabric-blockrenderlayer-v1-version=1.1.25 fabric-command-api-v1-version=1.2.16 fabric-command-api-v2-version=2.2.1 fabric-commands-v0-version=0.2.33 From e960d55b0d9f4e5134e9d173d1693880b8bbabaa Mon Sep 17 00:00:00 2001 From: Madis Otenurm Date: Wed, 15 Mar 2023 11:24:41 +0200 Subject: [PATCH 05/14] Update et_ee.json (#2894) (cherry picked from commit 09aba064e4948e7329e3a4d21703076b915176e0) --- .../assets/fabric-resource-loader-v0/lang/et_ee.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fabric-resource-loader-v0/src/main/resources/assets/fabric-resource-loader-v0/lang/et_ee.json b/fabric-resource-loader-v0/src/main/resources/assets/fabric-resource-loader-v0/lang/et_ee.json index b1db01da89..57b78d2a05 100644 --- a/fabric-resource-loader-v0/src/main/resources/assets/fabric-resource-loader-v0/lang/et_ee.json +++ b/fabric-resource-loader-v0/src/main/resources/assets/fabric-resource-loader-v0/lang/et_ee.json @@ -1,4 +1,6 @@ { "pack.source.fabricmod": "Fabricu mod", - "pack.source.builtinMod": "sisseeh.: %s" + "pack.source.builtinMod": "sisseeh.: %s", + "pack.name.fabricMod": "Fabricu mod \"%s\"", + "pack.name.fabricMods": "Fabricu modid" } From 68a20504eea1a8e5f2b1e02ddbdc41fb6e07a263 Mon Sep 17 00:00:00 2001 From: Michael <53499406+TheDeathlyCow@users.noreply.github.com> Date: Wed, 15 Mar 2023 22:35:58 +1300 Subject: [PATCH 06/14] Add 'Windswept Hills' biome convention tag (#2878) * add windswept biome tag * change windswept tag to windswept hills * list out biomes and revert name change (cherry picked from commit 1b664772cf24b8f3cdf19121d4b9b773ed5c2fbd) --- .../convention/datagen/generators/BiomeTagGenerator.java | 5 +++++ .../resources/data/c/tags/worldgen/biome/windswept.json | 9 +++++++++ .../api/tag/convention/v1/ConventionalBiomeTags.java | 1 + 3 files changed, 15 insertions(+) create mode 100644 fabric-convention-tags-v1/src/generated/resources/data/c/tags/worldgen/biome/windswept.json diff --git a/fabric-convention-tags-v1/src/datagen/java/net/fabricmc/fabric/impl/tag/convention/datagen/generators/BiomeTagGenerator.java b/fabric-convention-tags-v1/src/datagen/java/net/fabricmc/fabric/impl/tag/convention/datagen/generators/BiomeTagGenerator.java index 9965392ced..444f5bfb72 100644 --- a/fabric-convention-tags-v1/src/datagen/java/net/fabricmc/fabric/impl/tag/convention/datagen/generators/BiomeTagGenerator.java +++ b/fabric-convention-tags-v1/src/datagen/java/net/fabricmc/fabric/impl/tag/convention/datagen/generators/BiomeTagGenerator.java @@ -87,6 +87,11 @@ private void generateCategoryTags() { getOrCreateTagBuilder(ConventionalBiomeTags.EXTREME_HILLS) .add(BiomeKeys.WINDSWEPT_GRAVELLY_HILLS) .add(BiomeKeys.WINDSWEPT_HILLS); + getOrCreateTagBuilder(ConventionalBiomeTags.WINDSWEPT) + .add(BiomeKeys.WINDSWEPT_HILLS) + .add(BiomeKeys.WINDSWEPT_GRAVELLY_HILLS) + .add(BiomeKeys.WINDSWEPT_FOREST) + .add(BiomeKeys.WINDSWEPT_SAVANNA); getOrCreateTagBuilder(ConventionalBiomeTags.JUNGLE) .addOptionalTag(BiomeTags.IS_JUNGLE); getOrCreateTagBuilder(ConventionalBiomeTags.MESA) diff --git a/fabric-convention-tags-v1/src/generated/resources/data/c/tags/worldgen/biome/windswept.json b/fabric-convention-tags-v1/src/generated/resources/data/c/tags/worldgen/biome/windswept.json new file mode 100644 index 0000000000..8df5621ae5 --- /dev/null +++ b/fabric-convention-tags-v1/src/generated/resources/data/c/tags/worldgen/biome/windswept.json @@ -0,0 +1,9 @@ +{ + "replace": false, + "values": [ + "minecraft:windswept_hills", + "minecraft:windswept_gravelly_hills", + "minecraft:windswept_forest", + "minecraft:windswept_savanna" + ] +} \ No newline at end of file diff --git a/fabric-convention-tags-v1/src/main/java/net/fabricmc/fabric/api/tag/convention/v1/ConventionalBiomeTags.java b/fabric-convention-tags-v1/src/main/java/net/fabricmc/fabric/api/tag/convention/v1/ConventionalBiomeTags.java index bad9f64d81..f01b13e42c 100644 --- a/fabric-convention-tags-v1/src/main/java/net/fabricmc/fabric/api/tag/convention/v1/ConventionalBiomeTags.java +++ b/fabric-convention-tags-v1/src/main/java/net/fabricmc/fabric/api/tag/convention/v1/ConventionalBiomeTags.java @@ -46,6 +46,7 @@ private ConventionalBiomeTags() { public static final TagKey IN_NETHER = register("in_nether"); public static final TagKey TAIGA = register("taiga"); public static final TagKey EXTREME_HILLS = register("extreme_hills"); + public static final TagKey WINDSWEPT = register("windswept"); public static final TagKey JUNGLE = register("jungle"); public static final TagKey MESA = register("mesa"); /** From 16f1e31314bfc31e6bba7390c45f580c0d19860a Mon Sep 17 00:00:00 2001 From: TelepathicGrunt <40846040+telepathicgrunt@users.noreply.github.com> Date: Wed, 15 Mar 2023 09:13:42 +0000 Subject: [PATCH 07/14] Fixed end biome source injection (#2940) (cherry picked from commit 348a9c64868dc3aee365d4ecd9831d5ab2d7d656) (cherry picked from commit f1c68e5823942c9ceee6d5c519f4a92b99a6c395) --- .../fabric/mixin/biome/TheEndBiomeSourceMixin.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/mixin/biome/TheEndBiomeSourceMixin.java b/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/mixin/biome/TheEndBiomeSourceMixin.java index 36a31e314f..68bae7de75 100644 --- a/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/mixin/biome/TheEndBiomeSourceMixin.java +++ b/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/mixin/biome/TheEndBiomeSourceMixin.java @@ -43,6 +43,9 @@ public class TheEndBiomeSourceMixin extends BiomeSourceMixin { @Unique private boolean biomeSetModified = false; + @Unique + private boolean hasCheckedForModifiedSet = false; + @Inject(method = "", at = @At("RETURN")) private void init(Registry biomeRegistry, CallbackInfo ci) { overrides = Suppliers.memoize(() -> TheEndBiomeData.createOverrides(biomeRegistry)); @@ -55,8 +58,12 @@ private void getWeightedEndBiome(int biomeX, int biomeY, int biomeZ, MultiNoiseU @Override protected void fabric_modifyBiomeSet(Set> biomes) { - if (!biomeSetModified) { - biomeSetModified = true; + if (!hasCheckedForModifiedSet) { + hasCheckedForModifiedSet = true; + biomeSetModified = !overrides.get().customBiomes.isEmpty(); + } + + if (biomeSetModified) { biomes.addAll(overrides.get().customBiomes); } } From b7d188881d13fd06d42a721c8ddc1e55ab48b4de Mon Sep 17 00:00:00 2001 From: Juuz <6596629+Juuxel@users.noreply.github.com> Date: Wed, 15 Mar 2023 11:14:00 +0200 Subject: [PATCH 08/14] EquipmentSlotProvider: Add javadoc link to getPreferredEquipmentSlot (#2935) (cherry picked from commit 09a3510c696d9c503f2c4b302bd0a791897bc91d) (cherry picked from commit 71b82573d8a27d8cc57b3e7a3d4e02f64545240a) --- .../net/fabricmc/fabric/api/item/v1/EquipmentSlotProvider.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/EquipmentSlotProvider.java b/fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/EquipmentSlotProvider.java index 241264fcf2..c4d0f9ea58 100644 --- a/fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/EquipmentSlotProvider.java +++ b/fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/EquipmentSlotProvider.java @@ -24,6 +24,9 @@ * This can be used to give non-armor items, such as blocks, * an armor slot that they can go in. * + *

The preferred requipment slot of an item stack can be queried using + * {@link net.minecraft.entity.LivingEntity#getPreferredEquipmentSlot(ItemStack) LivingEntity.getPreferredEquipmentSlot()}. + * *

Equipment slot providers can be set with {@link FabricItemSettings#equipmentSlot(EquipmentSlotProvider)}. * *

Note that items extending {@link net.minecraft.item.ArmorItem} don't need to use this From 4bc6e26285677c5dca67509ddba8fad6afa30c3a Mon Sep 17 00:00:00 2001 From: Maity <47220489+maityyy@users.noreply.github.com> Date: Wed, 15 Mar 2023 12:19:29 +0300 Subject: [PATCH 09/14] Conventional Biome Tags tweaks (#2955) * Birch Forest Tag #2330 * Fix #2649 * Run datagen (cherry picked from commit 315602f6c2ca35ef43f018d24d6896f9da332928) (cherry picked from commit 521b5c52a5d65ffa4d30b5ac9b2616a06efa2a24) --- .../convention/datagen/generators/BiomeTagGenerator.java | 4 ++++ .../resources/data/c/tags/worldgen/biome/birch_forest.json | 7 +++++++ .../resources/data/c/tags/worldgen/biome/climate_cold.json | 1 + .../api/tag/convention/v1/ConventionalBiomeTags.java | 1 + 4 files changed, 13 insertions(+) create mode 100644 fabric-convention-tags-v1/src/generated/resources/data/c/tags/worldgen/biome/birch_forest.json diff --git a/fabric-convention-tags-v1/src/datagen/java/net/fabricmc/fabric/impl/tag/convention/datagen/generators/BiomeTagGenerator.java b/fabric-convention-tags-v1/src/datagen/java/net/fabricmc/fabric/impl/tag/convention/datagen/generators/BiomeTagGenerator.java index 444f5bfb72..2b1d9695d2 100644 --- a/fabric-convention-tags-v1/src/datagen/java/net/fabricmc/fabric/impl/tag/convention/datagen/generators/BiomeTagGenerator.java +++ b/fabric-convention-tags-v1/src/datagen/java/net/fabricmc/fabric/impl/tag/convention/datagen/generators/BiomeTagGenerator.java @@ -123,6 +123,9 @@ private void generateCategoryTags() { .add(BiomeKeys.STONY_SHORE); getOrCreateTagBuilder(ConventionalBiomeTags.FOREST) .addOptionalTag(BiomeTags.IS_FOREST); + getOrCreateTagBuilder(ConventionalBiomeTags.BIRCH_FOREST) + .add(BiomeKeys.BIRCH_FOREST) + .add(BiomeKeys.OLD_GROWTH_BIRCH_FOREST); getOrCreateTagBuilder(ConventionalBiomeTags.OCEAN) .addOptionalTag(ConventionalBiomeTags.DEEP_OCEAN) .addOptionalTag(ConventionalBiomeTags.SHALLOW_OCEAN) @@ -167,6 +170,7 @@ private void generateOtherBiomeTypes() { private void generateClimateAndVegetationTags() { getOrCreateTagBuilder(ConventionalBiomeTags.CLIMATE_COLD) + .add(BiomeKeys.SNOWY_PLAINS) .add(BiomeKeys.GROVE) .add(BiomeKeys.JAGGED_PEAKS) .add(BiomeKeys.TAIGA).add(BiomeKeys.SNOWY_TAIGA) diff --git a/fabric-convention-tags-v1/src/generated/resources/data/c/tags/worldgen/biome/birch_forest.json b/fabric-convention-tags-v1/src/generated/resources/data/c/tags/worldgen/biome/birch_forest.json new file mode 100644 index 0000000000..0389e9f8e1 --- /dev/null +++ b/fabric-convention-tags-v1/src/generated/resources/data/c/tags/worldgen/biome/birch_forest.json @@ -0,0 +1,7 @@ +{ + "replace": false, + "values": [ + "minecraft:birch_forest", + "minecraft:old_growth_birch_forest" + ] +} \ No newline at end of file diff --git a/fabric-convention-tags-v1/src/generated/resources/data/c/tags/worldgen/biome/climate_cold.json b/fabric-convention-tags-v1/src/generated/resources/data/c/tags/worldgen/biome/climate_cold.json index 8be4aa1f95..876b1995ea 100644 --- a/fabric-convention-tags-v1/src/generated/resources/data/c/tags/worldgen/biome/climate_cold.json +++ b/fabric-convention-tags-v1/src/generated/resources/data/c/tags/worldgen/biome/climate_cold.json @@ -1,6 +1,7 @@ { "replace": false, "values": [ + "minecraft:snowy_plains", "minecraft:grove", "minecraft:jagged_peaks", "minecraft:taiga", diff --git a/fabric-convention-tags-v1/src/main/java/net/fabricmc/fabric/api/tag/convention/v1/ConventionalBiomeTags.java b/fabric-convention-tags-v1/src/main/java/net/fabricmc/fabric/api/tag/convention/v1/ConventionalBiomeTags.java index f01b13e42c..aab2928800 100644 --- a/fabric-convention-tags-v1/src/main/java/net/fabricmc/fabric/api/tag/convention/v1/ConventionalBiomeTags.java +++ b/fabric-convention-tags-v1/src/main/java/net/fabricmc/fabric/api/tag/convention/v1/ConventionalBiomeTags.java @@ -73,6 +73,7 @@ private ConventionalBiomeTags() { * Biomes densely populated with deciduous trees. */ public static final TagKey FOREST = register("forest"); + public static final TagKey BIRCH_FOREST = register("birch_forest"); public static final TagKey OCEAN = register("ocean"); public static final TagKey DESERT = register("desert"); public static final TagKey RIVER = register("river"); From 1e4447c7e02db41a0ffdea2994991056e6c99684 Mon Sep 17 00:00:00 2001 From: Yoosk Date: Wed, 15 Mar 2023 09:24:06 +0000 Subject: [PATCH 10/14] Update pl_pl.json (#2929) (cherry picked from commit 36d2fcce10df040cef9dfa72ae6c7cafbafd6108) (cherry picked from commit 8368a8beca7e3894a6eefa59859b8330490acec7) --- .../assets/fabric-resource-loader-v0/lang/pl_pl.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fabric-resource-loader-v0/src/main/resources/assets/fabric-resource-loader-v0/lang/pl_pl.json b/fabric-resource-loader-v0/src/main/resources/assets/fabric-resource-loader-v0/lang/pl_pl.json index 990c564beb..05cd06912d 100644 --- a/fabric-resource-loader-v0/src/main/resources/assets/fabric-resource-loader-v0/lang/pl_pl.json +++ b/fabric-resource-loader-v0/src/main/resources/assets/fabric-resource-loader-v0/lang/pl_pl.json @@ -1,4 +1,7 @@ { + "pack.description.modResources": "Zasoby modów.", "pack.source.fabricmod": "Mod Fabric", - "pack.source.builtinMod": "wbudowana: %s" + "pack.source.builtinMod": "wbudowana: %s", + "pack.name.fabricMod": "Mod Fabric \"%s\"", + "pack.name.fabricMods": "Mody Fabric" } From dd83229e614aa8ad81bb38219020eaa697966655 Mon Sep 17 00:00:00 2001 From: Alpha Date: Wed, 15 Mar 2023 19:33:35 +0900 Subject: [PATCH 11/14] Update ko_kr.json (#2927) (#2941) * Update ko_kr.json * fix typo (cherry picked from commit 930b8d421f40b93dc59032826df9563a901e18b4) (cherry picked from commit eeb6cf31c4af4e35a2ddc9126a1b55f2b27b781b) --- .../assets/fabric-resource-loader-v0/lang/ko_kr.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fabric-resource-loader-v0/src/main/resources/assets/fabric-resource-loader-v0/lang/ko_kr.json b/fabric-resource-loader-v0/src/main/resources/assets/fabric-resource-loader-v0/lang/ko_kr.json index c41044959b..bcf6893210 100644 --- a/fabric-resource-loader-v0/src/main/resources/assets/fabric-resource-loader-v0/lang/ko_kr.json +++ b/fabric-resource-loader-v0/src/main/resources/assets/fabric-resource-loader-v0/lang/ko_kr.json @@ -1,4 +1,7 @@ { + "pack.description.modResources": "모드 리소스.", "pack.source.fabricmod": "Fabric 모드", - "pack.source.builtinMod": "%s에 내장" + "pack.source.builtinMod": "%s 에 내장됨", + "pack.name.fabricMod": "\"%s\" Fabric 모드", + "pack.name.fabricMods": "Fabric 모드" } From b643d3a3ec7e9d077962b6ad3847731e49c8e0ad Mon Sep 17 00:00:00 2001 From: RawDiamondMC Date: Wed, 15 Mar 2023 18:33:56 +0800 Subject: [PATCH 12/14] Create zh_cn.json (#2945) (cherry picked from commit 9af20fd751efe6888fb07cb23aab69819e39a785) (cherry picked from commit 93582b958ac8d20d858af593bccd9504fccc2337) --- .../assets/fabric-resource-loader-v0/lang/zh_cn.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 fabric-resource-loader-v0/src/main/resources/assets/fabric-resource-loader-v0/lang/zh_cn.json diff --git a/fabric-resource-loader-v0/src/main/resources/assets/fabric-resource-loader-v0/lang/zh_cn.json b/fabric-resource-loader-v0/src/main/resources/assets/fabric-resource-loader-v0/lang/zh_cn.json new file mode 100644 index 0000000000..6d81ff1e7b --- /dev/null +++ b/fabric-resource-loader-v0/src/main/resources/assets/fabric-resource-loader-v0/lang/zh_cn.json @@ -0,0 +1,7 @@ +{ + "pack.description.modResources": "模组资源。", + "pack.source.fabricmod": "Fabric 模组", + "pack.source.builtinMod": "内置: %s", + "pack.name.fabricMod": "Fabric 模组 \"%s\"", + "pack.name.fabricMods": "Fabric 模组" +} From edbdcddb992c1ede03b100fde7fa81215bae893f Mon Sep 17 00:00:00 2001 From: Julian Burner <48808497+NebelNidas@users.noreply.github.com> Date: Wed, 15 Mar 2023 11:50:54 +0100 Subject: [PATCH 13/14] Fix Programmer Art resource pack injection support (#2956) --- .../fabric/impl/resource/loader/ModResourcePackUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fabric-resource-loader-v0/src/main/java/net/fabricmc/fabric/impl/resource/loader/ModResourcePackUtil.java b/fabric-resource-loader-v0/src/main/java/net/fabricmc/fabric/impl/resource/loader/ModResourcePackUtil.java index b27f0c5985..847fbd7b76 100644 --- a/fabric-resource-loader-v0/src/main/java/net/fabricmc/fabric/impl/resource/loader/ModResourcePackUtil.java +++ b/fabric-resource-loader-v0/src/main/java/net/fabricmc/fabric/impl/resource/loader/ModResourcePackUtil.java @@ -62,7 +62,7 @@ public static void appendModResourcePacks(List packs, ResourceT continue; } - ModResourcePack pack = ModNioResourcePack.create(new Identifier("fabric", container.getMetadata().getId()), getName(container.getMetadata()), container, null, type, ResourcePackActivationType.ALWAYS_ENABLED); + ModResourcePack pack = ModNioResourcePack.create(new Identifier("fabric", container.getMetadata().getId()), getName(container.getMetadata()), container, subPath, type, ResourcePackActivationType.ALWAYS_ENABLED); if (pack != null) { packs.add(pack); From 982df14ab93552feac25b597792ae73f4f670555 Mon Sep 17 00:00:00 2001 From: Amirhan-Taipovjan-Greatest-I <51203385+amirhan-taipovjan-greatest-i@users.noreply.github.com> Date: Wed, 15 Mar 2023 10:33:10 +0000 Subject: [PATCH 14/14] Bump version --- gradle.properties | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/gradle.properties b/gradle.properties index bfe8b6617a..92afe7fba6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ org.gradle.jvmargs=-Xmx2560M org.gradle.parallel=true -version=0.75.1 +version=0.76.0 minecraft_version=1.19.2 yarn_version=+build.17 loader_version=0.14.9 @@ -11,35 +11,35 @@ prerelease=false # Do not manually update, use the bumpversions task: fabric-api-base-version=0.4.15 fabric-api-lookup-api-v1-version=1.6.14 -fabric-biome-api-v1-version=9.1.0 +fabric-biome-api-v1-version=9.1.1 fabric-block-api-v1-version=1.0.2 fabric-blockrenderlayer-v1-version=1.1.25 fabric-command-api-v1-version=1.2.16 fabric-command-api-v2-version=2.2.1 fabric-commands-v0-version=0.2.33 fabric-containers-v0-version=0.1.41 -fabric-content-registries-v0-version=3.5.1 +fabric-content-registries-v0-version=3.5.2 fabric-crash-report-info-v1-version=0.2.8 -fabric-data-generation-api-v1-version=5.3.7 +fabric-data-generation-api-v1-version=5.3.8 fabric-dimensions-v1-version=2.1.35 fabric-entity-events-v1-version=1.5.4 fabric-events-interaction-v0-version=0.4.34 -fabric-events-lifecycle-v0-version=0.2.35 +fabric-events-lifecycle-v0-version=0.2.36 fabric-game-rule-api-v1-version=1.0.24 -fabric-gametest-api-v1-version=1.1.7 -fabric-item-api-v1-version=1.6.5 -fabric-item-groups-v0-version=0.3.38 +fabric-gametest-api-v1-version=1.1.8 +fabric-item-api-v1-version=1.6.6 +fabric-item-groups-v0-version=0.3.39 fabric-key-binding-api-v1-version=1.0.25 fabric-keybindings-v0-version=0.2.23 fabric-lifecycle-events-v1-version=2.2.4 -fabric-loot-api-v2-version=1.1.12 -fabric-loot-tables-v1-version=1.1.15 +fabric-loot-api-v2-version=1.1.13 +fabric-loot-tables-v1-version=1.1.16 fabric-message-api-v1-version=5.0.7 -fabric-mining-level-api-v1-version=2.1.23 +fabric-mining-level-api-v1-version=2.1.24 fabric-models-v0-version=0.3.21 fabric-networking-api-v1-version=1.2.11 fabric-networking-v0-version=0.3.28 -fabric-object-builder-api-v1-version=4.2.1 +fabric-object-builder-api-v1-version=4.2.2 fabric-particles-v1-version=1.0.14 fabric-recipe-api-v1-version=1.0.1 fabric-registry-sync-v0-version=0.9.32 @@ -51,12 +51,12 @@ fabric-rendering-fluids-v1-version=3.0.11 fabric-rendering-v0-version=1.1.27 fabric-rendering-v1-version=1.12.1 fabric-resource-conditions-api-v1-version=2.1.2 -fabric-resource-loader-v0-version=0.8.3 +fabric-resource-loader-v0-version=0.8.4 fabric-screen-api-v1-version=1.0.32 fabric-screen-handler-api-v1-version=1.3.7 fabric-sound-api-v1-version=1.0.2 fabric-textures-v0-version=1.0.24 fabric-transfer-api-v1-version=2.1.6 fabric-transitive-access-wideners-v1-version=1.3.3 -fabric-convention-tags-v1-version=1.2.2 +fabric-convention-tags-v1-version=1.3.0 fabric-client-tags-api-v1-version=1.0.5