package net.minecraft.client.renderer.entity; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.math.Axis; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.projectile.FireworkRocketEntity; import net.minecraft.world.item.ItemDisplayContext; @Environment(EnvType.CLIENT) public class FireworkEntityRenderer extends EntityRenderer { private final ItemRenderer itemRenderer; public FireworkEntityRenderer(EntityRendererProvider.Context context) { super(context); this.itemRenderer = context.getItemRenderer(); } public void render(FireworkRocketEntity entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { poseStack.pushPose(); poseStack.mulPose(this.entityRenderDispatcher.cameraOrientation()); if (entity.isShotAtAngle()) { poseStack.mulPose(Axis.ZP.rotationDegrees(180.0F)); poseStack.mulPose(Axis.YP.rotationDegrees(180.0F)); poseStack.mulPose(Axis.XP.rotationDegrees(90.0F)); } this.itemRenderer .renderStatic(entity.getItem(), ItemDisplayContext.GROUND, packedLight, OverlayTexture.NO_OVERLAY, poseStack, buffer, entity.level(), entity.getId()); poseStack.popPose(); super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); } /** * Returns the location of an entity's texture. */ public ResourceLocation getTextureLocation(FireworkRocketEntity entity) { return TextureAtlas.LOCATION_BLOCKS; } }