Skip to content

Commit

Permalink
3.3.8 changes to block entity rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
qouteall committed Jan 12, 2024
1 parent 64a09c1 commit 39e5878
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 10 deletions.
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Possibly fix crash on Exaroton.
Possibly fix clipping of block entity rendering.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ org.gradle.jvmargs=-Xmx2G
org.gradle.parallel=false

# Mod Properties
mod_version=3.3.7
mod_version=3.3.8
maven_group=qouteall
archives_base_name=immersive-portals

Expand All @@ -16,7 +16,7 @@ iris_path=maven.modrinth:iris:1.6.11+1.20.1
gravity_changer_version=v1.1.1-mc1.20.1
pehkui_version=3.7.5
enable_sodium=true
enable_iris=true
enable_iris=false
enable_pehkui=true
enable_gravity_changer=false
enable_test_mod=false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -12,6 +13,7 @@
import qouteall.imm_ptl.core.compat.iris_compatibility.IrisInterface;
import qouteall.imm_ptl.core.portal.PortalLike;
import qouteall.imm_ptl.core.render.context_management.PortalRendering;
import qouteall.q_misc_util.my_util.Plane;

@Mixin(BlockEntityRenderDispatcher.class)
public class MixinBlockEntityRenderDispatcher {
Expand All @@ -32,13 +34,25 @@ private <E extends BlockEntity> void onRenderBlockEntity(
}
if (PortalRendering.isRendering()) {
PortalLike renderingPortal = PortalRendering.getRenderingPortal();
boolean canRender = renderingPortal.isOnDestinationSide(
Vec3.atCenterOf(blockEntity.getBlockPos()),
-0.1
);
if (!canRender) {
ci.cancel();
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 @@ -180,7 +180,8 @@ private void onMyBeforeTranslucentRendering(
method = "renderLevel",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/MultiBufferSource$BufferSource;endLastBatch()V"
target = "Lnet/minecraft/client/renderer/MultiBufferSource$BufferSource;endLastBatch()V",
ordinal = 1
)
)
private void onEndRenderingEntities(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci) {
Expand Down

0 comments on commit 39e5878

Please sign in to comment.