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

64 lines
2.4 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.renderer.SubmitNodeCollector;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.entity.TntMinecartRenderer;
import net.minecraft.client.renderer.entity.state.TntRenderState;
import net.minecraft.client.renderer.state.CameraRenderState;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.item.PrimedTnt;
import org.joml.Quaternionfc;
public class TntRenderer
extends EntityRenderer<PrimedTnt, TntRenderState> {
public TntRenderer(EntityRendererProvider.Context context) {
super(context);
this.shadowRadius = 0.5f;
}
@Override
public void submit(TntRenderState state, PoseStack poseStack, SubmitNodeCollector submitNodeCollector, CameraRenderState camera) {
poseStack.pushPose();
poseStack.translate(0.0f, 0.5f, 0.0f);
float fuse = state.fuseRemainingInTicks;
if (state.fuseRemainingInTicks < 10.0f) {
float g = 1.0f - state.fuseRemainingInTicks / 10.0f;
g = Mth.clamp(g, 0.0f, 1.0f);
g *= g;
g *= g;
float s = 1.0f + g * 0.3f;
poseStack.scale(s, s, s);
}
poseStack.mulPose((Quaternionfc)Axis.YP.rotationDegrees(-90.0f));
poseStack.translate(-0.5f, -0.5f, 0.5f);
poseStack.mulPose((Quaternionfc)Axis.YP.rotationDegrees(90.0f));
if (state.blockState != null) {
TntMinecartRenderer.submitWhiteSolidBlock(state.blockState, poseStack, submitNodeCollector, state.lightCoords, (int)fuse / 5 % 2 == 0, state.outlineColor);
}
poseStack.popPose();
super.submit(state, poseStack, submitNodeCollector, camera);
}
@Override
public TntRenderState createRenderState() {
return new TntRenderState();
}
@Override
public void extractRenderState(PrimedTnt entity, TntRenderState state, float partialTicks) {
super.extractRenderState(entity, state, partialTicks);
state.fuseRemainingInTicks = (float)entity.getFuse() - partialTicks + 1.0f;
state.blockState = entity.getBlockState();
}
}