minecraft-src/net/minecraft/client/renderer/entity/layers/IronGolemCrackinessLayer.java
2025-07-04 01:41:11 +03:00

50 lines
1.9 KiB
Java

package net.minecraft.client.renderer.entity.layers;
import com.google.common.collect.ImmutableMap;
import com.mojang.blaze3d.vertex.PoseStack;
import java.util.Map;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.model.IronGolemModel;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.entity.RenderLayerParent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Crackiness;
import net.minecraft.world.entity.animal.IronGolem;
@Environment(EnvType.CLIENT)
public class IronGolemCrackinessLayer extends RenderLayer<IronGolem, IronGolemModel<IronGolem>> {
private static final Map<Crackiness.Level, ResourceLocation> resourceLocations = ImmutableMap.of(
Crackiness.Level.LOW,
ResourceLocation.withDefaultNamespace("textures/entity/iron_golem/iron_golem_crackiness_low.png"),
Crackiness.Level.MEDIUM,
ResourceLocation.withDefaultNamespace("textures/entity/iron_golem/iron_golem_crackiness_medium.png"),
Crackiness.Level.HIGH,
ResourceLocation.withDefaultNamespace("textures/entity/iron_golem/iron_golem_crackiness_high.png")
);
public IronGolemCrackinessLayer(RenderLayerParent<IronGolem, IronGolemModel<IronGolem>> renderer) {
super(renderer);
}
public void render(
PoseStack poseStack,
MultiBufferSource buffer,
int packedLight,
IronGolem livingEntity,
float limbSwing,
float limbSwingAmount,
float partialTicks,
float ageInTicks,
float netHeadYaw,
float headPitch
) {
if (!livingEntity.isInvisible()) {
Crackiness.Level level = livingEntity.getCrackiness();
if (level != Crackiness.Level.NONE) {
ResourceLocation resourceLocation = (ResourceLocation)resourceLocations.get(level);
renderColoredCutoutModel(this.getParentModel(), resourceLocation, poseStack, buffer, packedLight, livingEntity, -1);
}
}
}
}