-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Directly implement getQuads extension on SimpleBakedModel
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
src/mixin/java/me/jellysquid/mods/sodium/mixin/features/model/SimpleBakedModelMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |