Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/20.1/forge' into 19.2/modernized
Browse files Browse the repository at this point in the history
  • Loading branch information
embeddedt committed Sep 12, 2024
2 parents 7d9fa7e + cbe3c9b commit d9e9e83
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
<br><br>
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).
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,11 @@ public List<BakedQuad> 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<BakedQuad> submodelQuads = model.getQuads(state, face, random, MultipartModelData.resolve(modelData, model), renderLayer);
if(models.length == 1) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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<BakedQuad> 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<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull RandomSource rand, @NotNull ModelData data, @Nullable RenderType renderType) {
return this.getQuads(state, side, rand);
}
}

0 comments on commit d9e9e83

Please sign in to comment.