diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 31e924c84..61bba1071 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -9,6 +9,8 @@ body: have found a defect, and you are able to point to where the problem is, you should not open an issue.

Additionally, please make sure you have done the following: + + - **Are you playing on a modern version of Minecraft?** We currently support 1.20.1 and 1.21.1. Older versions are no longer supported. - **Have you ensured that all of your mods (including Embeddium) are up-to-date?** The latest version of Embeddium can always be found [on Modrinth](https://modrinth.com/mod/embeddium). diff --git a/.github/workflows/build-snapshot.yml b/.github/workflows/build-snapshot.yml index dcf7f9344..f5a22b3b6 100644 --- a/.github/workflows/build-snapshot.yml +++ b/.github/workflows/build-snapshot.yml @@ -52,7 +52,7 @@ jobs: - name: Build artifacts run: ./gradlew reobfJarJar - name: Upload artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Embeddium path: build/libs @@ -61,7 +61,7 @@ jobs: with: run: ./gradlew runGameTestCiClient - name: Upload test artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 if: ${{ !cancelled() }} with: name: Embeddium-TestData diff --git a/src/mixin/java/me/jellysquid/mods/sodium/mixin/features/model/MultipartBakedModelMixin.java b/src/mixin/java/me/jellysquid/mods/sodium/mixin/features/model/MultipartBakedModelMixin.java index 08fece8dc..1e84812e8 100644 --- a/src/mixin/java/me/jellysquid/mods/sodium/mixin/features/model/MultipartBakedModelMixin.java +++ b/src/mixin/java/me/jellysquid/mods/sodium/mixin/features/model/MultipartBakedModelMixin.java @@ -125,7 +125,11 @@ public List getQuads(BlockState state, Direction face, RandomSource r random.setSeed(seed); // Embeddium: Filter render types as Forge does, but only if we actually need to do so. This avoids - // the overhead of getRenderTypes() for all vanilla models. + // the overhead of getRenderTypes() for all vanilla models. This optimization breaks mods that blindly call + // MultiPartBakedModel#getQuads() on all render types rather than just the ones returned by getRenderTypes(). + // The original implementation accidentally handled these as a result of doing the filtering in getQuads. + // We consider this a worthwhile tradeoff, because the API contract for chunk meshing requires iterating over + // the return value of getRenderTypes(). To date, only Windowlogged is known to be broken by this change. if (!checkSubmodelTypes || renderLayer == null || model.getRenderTypes(state, random, modelData).contains(renderLayer)) { List submodelQuads = model.getQuads(state, face, random, MultipartModelData.resolve(modelData, model), renderLayer); if(models.length == 1) { diff --git a/src/mixin/java/me/jellysquid/mods/sodium/mixin/features/model/SimpleBakedModelMixin.java b/src/mixin/java/me/jellysquid/mods/sodium/mixin/features/model/SimpleBakedModelMixin.java new file mode 100644 index 000000000..2ad124708 --- /dev/null +++ b/src/mixin/java/me/jellysquid/mods/sodium/mixin/features/model/SimpleBakedModelMixin.java @@ -0,0 +1,33 @@ +package me.jellysquid.mods.sodium.mixin.features.model; + +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.resources.model.SimpleBakedModel; +import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraftforge.client.extensions.IForgeBakedModel; +import net.minecraftforge.client.model.data.ModelData; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.spongepowered.asm.mixin.Intrinsic; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; + +import java.util.List; + +@Mixin(value = SimpleBakedModel.class, priority = 700) +public abstract class SimpleBakedModelMixin implements IForgeBakedModel { + @Shadow + public abstract List getQuads(@Nullable BlockState pState, @Nullable Direction pDirection, RandomSource pRandom); + + /** + * @author embeddedt + * @reason avoid interface dispatch on getQuads() from our block renderer + */ + @Intrinsic + @Override + public @NotNull List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull RandomSource rand, @NotNull ModelData data, @Nullable RenderType renderType) { + return this.getQuads(state, side, rand); + } +}