2025-11-24 22:52:51 +03:00

72 lines
3.2 KiB
Java

/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* org.joml.Quaternionfc
*/
package net.minecraft.client.renderer.entity;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Axis;
import net.minecraft.client.model.ShulkerBulletModel;
import net.minecraft.client.model.geom.ModelLayers;
import net.minecraft.client.renderer.SubmitNodeCollector;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.entity.state.ShulkerBulletRenderState;
import net.minecraft.client.renderer.rendertype.RenderType;
import net.minecraft.client.renderer.rendertype.RenderTypes;
import net.minecraft.client.renderer.state.CameraRenderState;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.core.BlockPos;
import net.minecraft.resources.Identifier;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.projectile.ShulkerBullet;
import org.joml.Quaternionfc;
public class ShulkerBulletRenderer
extends EntityRenderer<ShulkerBullet, ShulkerBulletRenderState> {
private static final Identifier TEXTURE_LOCATION = Identifier.withDefaultNamespace("textures/entity/shulker/spark.png");
private static final RenderType RENDER_TYPE = RenderTypes.entityTranslucent(TEXTURE_LOCATION);
private final ShulkerBulletModel model;
public ShulkerBulletRenderer(EntityRendererProvider.Context context) {
super(context);
this.model = new ShulkerBulletModel(context.bakeLayer(ModelLayers.SHULKER_BULLET));
}
@Override
protected int getBlockLightLevel(ShulkerBullet entity, BlockPos blockPos) {
return 15;
}
@Override
public void submit(ShulkerBulletRenderState state, PoseStack poseStack, SubmitNodeCollector submitNodeCollector, CameraRenderState camera) {
poseStack.pushPose();
float tc = state.ageInTicks;
poseStack.translate(0.0f, 0.15f, 0.0f);
poseStack.mulPose((Quaternionfc)Axis.YP.rotationDegrees(Mth.sin(tc * 0.1f) * 180.0f));
poseStack.mulPose((Quaternionfc)Axis.XP.rotationDegrees(Mth.cos(tc * 0.1f) * 180.0f));
poseStack.mulPose((Quaternionfc)Axis.ZP.rotationDegrees(Mth.sin(tc * 0.15f) * 360.0f));
poseStack.scale(-0.5f, -0.5f, 0.5f);
submitNodeCollector.submitModel(this.model, state, poseStack, this.model.renderType(TEXTURE_LOCATION), state.lightCoords, OverlayTexture.NO_OVERLAY, state.outlineColor, null);
poseStack.scale(1.5f, 1.5f, 1.5f);
submitNodeCollector.order(1).submitModel(this.model, state, poseStack, RENDER_TYPE, state.lightCoords, OverlayTexture.NO_OVERLAY, 0x26FFFFFF, null, state.outlineColor, null);
poseStack.popPose();
super.submit(state, poseStack, submitNodeCollector, camera);
}
@Override
public ShulkerBulletRenderState createRenderState() {
return new ShulkerBulletRenderState();
}
@Override
public void extractRenderState(ShulkerBullet entity, ShulkerBulletRenderState state, float partialTicks) {
super.extractRenderState(entity, state, partialTicks);
state.yRot = entity.getYRot(partialTicks);
state.xRot = entity.getXRot(partialTicks);
}
}