Skip to content

Commit

Permalink
Merge pull request #408 from supsm/1.19
Browse files Browse the repository at this point in the history
Fix chisels n bits compatibility (#407)
  • Loading branch information
spiralhalo committed Oct 13, 2023
2 parents 5670866 + e42ace3 commit 11ba055
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/main/java/grondag/canvas/mixin/MixinModelBlockRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
package grondag.canvas.mixin;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
Expand All @@ -35,17 +37,13 @@

import grondag.canvas.apiimpl.rendercontext.CanvasBlockRenderContext;

// WIP: change this an inject with cancel so that mods that hook in here don't break directly - esp C&B
// WIP: move hooks upstream so that multi-consumer is available in more cases
@Mixin(ModelBlockRenderer.class)
public abstract class MixinModelBlockRenderer {
/**
* @author grondag
* @reason performance; less bad than inject and cancel at head
*/
@Overwrite
public void tesselateBlock(BlockAndTintGetter blockView, BakedModel model, BlockState state, BlockPos pos, PoseStack poseStack, VertexConsumer buffer, boolean checkSides, RandomSource randomSource, long seed, int overlay) {
@Inject(at = @At("HEAD"), method = "tesselateBlock", cancellable = true)
public void beforeTesselateBlock(BlockAndTintGetter blockView, BakedModel model, BlockState state, BlockPos pos, PoseStack poseStack, VertexConsumer buffer, boolean checkSides, RandomSource randomSource, long seed, int overlay, CallbackInfo ci) {
// PERF: try to avoid threadlocal lookup here
CanvasBlockRenderContext.get().render((ModelBlockRenderer) (Object) this, blockView, model, state, pos, poseStack, buffer, checkSides, seed, overlay);
ci.cancel();
}
}

0 comments on commit 11ba055

Please sign in to comment.