Merge pull request #6898 from IThundxr/mc1.20.1/ponder-culling-fix

fix: items in ponders being culled incorrectly
This commit is contained in:
simibubi 2024-10-08 18:01:53 +02:00 committed by GitHub
commit f51c99e715
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions

View file

@ -233,7 +233,7 @@ public class BeltRenderer extends SafeBlockEntityRenderer<BeltBlockEntity> {
be.getBlockPos().getZ())
.add(offsetVec);
if (this.shouldCullItem(itemPos)) {
if (this.shouldCullItem(itemPos, be.getLevel())) {
continue;
}

View file

@ -2,10 +2,13 @@ package com.simibubi.create.foundation.blockEntity.renderer;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.foundation.ponder.PonderWorld;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
import net.minecraft.client.renderer.culling.Frustum;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.phys.AABB;
@ -28,7 +31,10 @@ public abstract class SafeBlockEntityRenderer<T extends BlockEntity> implements
.getBlock() == Blocks.AIR;
}
public boolean shouldCullItem(Vec3 itemPos) {
public boolean shouldCullItem(Vec3 itemPos, Level level) {
if (level instanceof PonderWorld)
return false;
Frustum frustum = Minecraft.getInstance().levelRenderer.capturedFrustum != null ?
Minecraft.getInstance().levelRenderer.capturedFrustum :
Minecraft.getInstance().levelRenderer.cullingFrustum;