/* * Decompiled with CFR 0.152. * * Could not load the following classes: * org.joml.Quaternionfc * org.jspecify.annotations.Nullable */ package net.minecraft.client.renderer.blockentity; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.math.Axis; import net.minecraft.client.renderer.SubmitNodeCollector; import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; import net.minecraft.client.renderer.blockentity.TrialSpawnerRenderer; import net.minecraft.client.renderer.blockentity.state.SpawnerRenderState; import net.minecraft.client.renderer.entity.EntityRenderDispatcher; import net.minecraft.client.renderer.entity.state.EntityRenderState; import net.minecraft.client.renderer.feature.ModelFeatureRenderer; import net.minecraft.client.renderer.state.CameraRenderState; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.BaseSpawner; import net.minecraft.world.level.block.entity.SpawnerBlockEntity; import net.minecraft.world.phys.Vec3; import org.joml.Quaternionfc; import org.jspecify.annotations.Nullable; public class SpawnerRenderer implements BlockEntityRenderer { private final EntityRenderDispatcher entityRenderer; public SpawnerRenderer(BlockEntityRendererProvider.Context context) { this.entityRenderer = context.entityRenderer(); } @Override public SpawnerRenderState createRenderState() { return new SpawnerRenderState(); } @Override public void extractRenderState(SpawnerBlockEntity blockEntity, SpawnerRenderState state, float partialTicks, Vec3 cameraPosition, @Nullable ModelFeatureRenderer.CrumblingOverlay breakProgress) { BlockEntityRenderer.super.extractRenderState(blockEntity, state, partialTicks, cameraPosition, breakProgress); if (blockEntity.getLevel() == null) { return; } BaseSpawner spawner = blockEntity.getSpawner(); Entity displayEntity = spawner.getOrCreateDisplayEntity(blockEntity.getLevel(), blockEntity.getBlockPos()); TrialSpawnerRenderer.extractSpawnerData(state, partialTicks, displayEntity, this.entityRenderer, spawner.getOSpin(), spawner.getSpin()); } @Override public void submit(SpawnerRenderState state, PoseStack poseStack, SubmitNodeCollector submitNodeCollector, CameraRenderState camera) { if (state.displayEntity != null) { SpawnerRenderer.submitEntityInSpawner(poseStack, submitNodeCollector, state.displayEntity, this.entityRenderer, state.spin, state.scale, camera); } } public static void submitEntityInSpawner(PoseStack poseStack, SubmitNodeCollector submitNodeCollector, EntityRenderState displayEntity, EntityRenderDispatcher entityRenderer, float spin, float scale, CameraRenderState camera) { poseStack.pushPose(); poseStack.translate(0.5f, 0.4f, 0.5f); poseStack.mulPose((Quaternionfc)Axis.YP.rotationDegrees(spin)); poseStack.translate(0.0f, -0.2f, 0.0f); poseStack.mulPose((Quaternionfc)Axis.XP.rotationDegrees(-30.0f)); poseStack.scale(scale, scale, scale); entityRenderer.submit(displayEntity, camera, 0.0, 0.0, 0.0, poseStack, submitNodeCollector); poseStack.popPose(); } }