46 lines
		
	
	
	
		
			1.6 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
	
		
			1.6 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
| package net.minecraft.client.renderer.blockentity;
 | |
| 
 | |
| import com.mojang.blaze3d.vertex.PoseStack;
 | |
| import net.fabricmc.api.EnvType;
 | |
| import net.fabricmc.api.Environment;
 | |
| import net.minecraft.client.renderer.MultiBufferSource;
 | |
| import net.minecraft.world.level.block.entity.TestInstanceBlockEntity;
 | |
| import net.minecraft.world.phys.Vec3;
 | |
| 
 | |
| @Environment(EnvType.CLIENT)
 | |
| public class TestInstanceRenderer implements BlockEntityRenderer<TestInstanceBlockEntity> {
 | |
| 	private final BeaconRenderer<TestInstanceBlockEntity> beacon;
 | |
| 	private final BlockEntityWithBoundingBoxRenderer<TestInstanceBlockEntity> box;
 | |
| 
 | |
| 	public TestInstanceRenderer(BlockEntityRendererProvider.Context context) {
 | |
| 		this.beacon = new BeaconRenderer<>(context);
 | |
| 		this.box = new BlockEntityWithBoundingBoxRenderer<>(context);
 | |
| 	}
 | |
| 
 | |
| 	public void render(
 | |
| 		TestInstanceBlockEntity blockEntity,
 | |
| 		float partialTick,
 | |
| 		PoseStack poseStack,
 | |
| 		MultiBufferSource bufferSource,
 | |
| 		int packedLight,
 | |
| 		int packedOverlay,
 | |
| 		Vec3 cameraPos
 | |
| 	) {
 | |
| 		this.beacon.render(blockEntity, partialTick, poseStack, bufferSource, packedLight, packedOverlay, cameraPos);
 | |
| 		this.box.render(blockEntity, partialTick, poseStack, bufferSource, packedLight, packedOverlay, cameraPos);
 | |
| 	}
 | |
| 
 | |
| 	@Override
 | |
| 	public boolean shouldRenderOffScreen() {
 | |
| 		return this.beacon.shouldRenderOffScreen() || this.box.shouldRenderOffScreen();
 | |
| 	}
 | |
| 
 | |
| 	@Override
 | |
| 	public int getViewDistance() {
 | |
| 		return Math.max(this.beacon.getViewDistance(), this.box.getViewDistance());
 | |
| 	}
 | |
| 
 | |
| 	public boolean shouldRender(TestInstanceBlockEntity blockEntity, Vec3 cameraPos) {
 | |
| 		return this.beacon.shouldRender(blockEntity, cameraPos) || this.box.shouldRender(blockEntity, cameraPos);
 | |
| 	}
 | |
| }
 |