Skip to content

Commit

Permalink
fix beacon beam clipping. remove block entity rendering filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
qouteall committed Jan 13, 2024
1 parent 39e5878 commit ac0489a
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,42 +17,42 @@

@Mixin(BlockEntityRenderDispatcher.class)
public class MixinBlockEntityRenderDispatcher {
@Inject(
method = "Lnet/minecraft/client/renderer/blockentity/BlockEntityRenderDispatcher;render(Lnet/minecraft/world/level/block/entity/BlockEntity;FLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;)V",
at = @At("HEAD"),
cancellable = true
)
private <E extends BlockEntity> void onRenderBlockEntity(
E blockEntity,
float tickDelta,
PoseStack matrix,
MultiBufferSource vertexConsumerProvider,
CallbackInfo ci
) {
if (IrisInterface.invoker.isRenderingShadowMap()) {
return;
}
if (PortalRendering.isRendering()) {
PortalLike renderingPortal = PortalRendering.getRenderingPortal();
Plane innerClipping = renderingPortal.getInnerClipping();
if (innerClipping != null) {
AABB box = new AABB(blockEntity.getBlockPos());
double furthestX = innerClipping.normal().x > 0 ? box.maxX : box.minX;
double furthestY = innerClipping.normal().y > 0 ? box.maxY : box.minY;
double furthestZ = innerClipping.normal().z > 0 ? box.maxZ : box.minZ;
boolean canRender = innerClipping.isPointOnPositiveSide(
new Vec3(furthestX, furthestY, furthestZ)
);
if (!canRender) {
ci.cancel();
}
}
}
}
// @Inject(
// method = "Lnet/minecraft/client/renderer/blockentity/BlockEntityRenderDispatcher;render(Lnet/minecraft/world/level/block/entity/BlockEntity;FLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;)V",
// at = @At("HEAD"),
// cancellable = true
// )
// private <E extends BlockEntity> void onRenderBlockEntity(
// E blockEntity,
// float tickDelta,
// PoseStack matrix,
// MultiBufferSource vertexConsumerProvider,
// CallbackInfo ci
// ) {
// if (IrisInterface.invoker.isRenderingShadowMap()) {
// return;
// }
// if (PortalRendering.isRendering()) {
// PortalLike renderingPortal = PortalRendering.getRenderingPortal();
// Plane innerClipping = renderingPortal.getInnerClipping();
//
// if (innerClipping != null) {
// AABB box = new AABB(blockEntity.getBlockPos());
//
// double furthestX = innerClipping.normal().x > 0 ? box.maxX : box.minX;
// double furthestY = innerClipping.normal().y > 0 ? box.maxY : box.minY;
// double furthestZ = innerClipping.normal().z > 0 ? box.maxZ : box.minZ;
//
// boolean canRender = innerClipping.isPointOnPositiveSide(
// new Vec3(furthestX, furthestY, furthestZ)
// );
//
// if (!canRender) {
// ci.cancel();
// }
// }
//
//
// }
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ private void onMyBeforeTranslucentRendering(
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/MultiBufferSource$BufferSource;endLastBatch()V",
ordinal = 1
ordinal = 1,
shift = At.Shift.AFTER
)
)
private void onEndRenderingEntities(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
"rendertype_entity_translucent_cull",
"rendertype_entity_translucent",
"rendertype_entity_smooth_cutout",
"rendertype_beacon_beam",
"rendertype_entity_translucent_emissive",
"portal_area",
"particle"
],
Expand Down

0 comments on commit ac0489a

Please sign in to comment.