修改雷达的渲染距离

This commit is contained in:
Atsuihsio 2024-12-30 16:52:58 +08:00
parent c95aee214e
commit f4052e7041
2 changed files with 15 additions and 1 deletions

View file

@ -12,6 +12,7 @@ import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
import net.minecraft.client.renderer.entity.ItemRenderer;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@ -38,4 +39,18 @@ public class FuMO25BlockEntityRenderer implements BlockEntityRenderer<FuMO25Bloc
pPoseStack.popPose();
}
@Override
public boolean shouldRenderOffScreen(FuMO25BlockEntity pBlockEntity) {
return true;
}
@Override
public boolean shouldRender(FuMO25BlockEntity pBlockEntity, Vec3 pCameraPos) {
return Vec3.atCenterOf(pBlockEntity.getBlockPos()).multiply(1.0, 0.0, 1.0).closerThan(pCameraPos.multiply(1.0, 0.0, 1.0), (double)this.getViewDistance());
}
@Override
public int getViewDistance() {
return 192;
}
}

View file

@ -78,7 +78,6 @@ public class SeekTool {
.filter(e -> e.distanceToSqr(pos.getX(), pos.getY(), pos.getZ()) <= range * range
&& e.isAlive()
&& !(e instanceof ItemEntity || e instanceof ExperienceOrb || e instanceof HangingEntity || e instanceof ProjectileEntity || e instanceof Projectile || e instanceof ArmorStand)
&& (e instanceof LivingEntity || e instanceof VehicleEntity)
&& !(e instanceof Player player && player.isSpectator()))
.toList();
}