WitherBossRenderer .java

net.minecraft.client.renderer.entity.WitherBossRenderer (class): members: WITHER_INVULNERABLE_LOCATION, WITHER_LOCATION, getBlockLightLevel, scale.

net.minecraft.client.renderer.entityclass56 linesclientextends MobRenderer<WitherBoss2.4 KB

API Surface (5)

int getBlockLightLevel(final WitherBoss entity, final BlockPos blockPos)
Identifier getTextureLocation(final WitherRenderState state)
WitherRenderState createRenderState()
void scale(final WitherRenderState state, final PoseStack poseStack)
void extractRenderState(final WitherBoss entity, final WitherRenderState state, final float partialTicks)

Fields & Constants (2)

WITHER_INVULNERABLE_LOCATION
WITHER_LOCATION

String literals (2)

"textures/entity/wither/wither_invulnerable.png"
"textures/entity/wither/wither.png"

Full Source

WitherBossRenderer.java56 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.client.renderer.entity;
2
3
import com.mojang.blaze3d.vertex.PoseStack;
4
import net.fabricmc.api.EnvType;
5
import net.fabricmc.api.Environment;
6
import net.minecraft.client.model.geom.ModelLayers;
7
import net.minecraft.client.model.monster.wither.WitherBossModel;
8
import net.minecraft.client.renderer.entity.layers.WitherArmorLayer;
9
import net.minecraft.client.renderer.entity.state.WitherRenderState;
10
import net.minecraft.core.BlockPos;
11
import net.minecraft.resources.Identifier;
12
import net.minecraft.util.Mth;
13
import net.minecraft.world.entity.boss.wither.WitherBoss;
14
15
@Environment(EnvType.CLIENT)
16
public class WitherBossRenderer extends MobRenderer<WitherBoss, WitherRenderState, WitherBossModel> {
17
	private static final Identifier WITHER_INVULNERABLE_LOCATION = Identifier.withDefaultNamespace("textures/entity/wither/wither_invulnerable.png");
18
	private static final Identifier WITHER_LOCATION = Identifier.withDefaultNamespace("textures/entity/wither/wither.png");
19
20
	public WitherBossRenderer(final EntityRendererProvider.Context context) {
21
		super(context, new WitherBossModel(context.bakeLayer(ModelLayers.WITHER)), 1.0F);
22
		this.addLayer(new WitherArmorLayer(this, context.getModelSet()));
23
	}
24
25
	protected int getBlockLightLevel(final WitherBoss entity, final BlockPos blockPos) {
26
		return 15;
27
	}
28
29
	public Identifier getTextureLocation(final WitherRenderState state) {
30
		int invulnerableTicks = Mth.floor(state.invulnerableTicks);
31
		return invulnerableTicks > 0 && (invulnerableTicks > 80 || invulnerableTicks / 5 % 2 != 1) ? WITHER_INVULNERABLE_LOCATION : WITHER_LOCATION;
32
	}
33
34
	public WitherRenderState createRenderState() {
35
		return new WitherRenderState();
36
	}
37
38
	protected void scale(final WitherRenderState state, final PoseStack poseStack) {
39
		float scale = 2.0F;
40
		if (state.invulnerableTicks > 0.0F) {
41
			scale -= state.invulnerableTicks / 220.0F * 0.5F;
42
		}
43
44
		poseStack.scale(scale, scale, scale);
45
	}
46
47
	public void extractRenderState(final WitherBoss entity, final WitherRenderState state, final float partialTicks) {
48
		super.extractRenderState(entity, state, partialTicks);
49
		int invulnerableTicks = entity.getInvulnerableTicks();
50
		state.invulnerableTicks = invulnerableTicks > 0 ? invulnerableTicks - partialTicks : 0.0F;
51
		System.arraycopy(entity.getHeadXRots(), 0, state.xHeadRots, 0, state.xHeadRots.length);
52
		System.arraycopy(entity.getHeadYRots(), 0, state.yHeadRots, 0, state.yHeadRots.length);
53
		state.isPowered = entity.isPowered();
54
	}
55
}
56

Decompiled Minecraft 26.3 source of WitherBossRenderer (net/minecraft/client/renderer/entity/WitherBossRenderer.java) with Mojang official mappings, stored verbatim on the site.