package net.minecraft.client.renderer.entity; import com.mojang.blaze3d.vertex.PoseStack; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.CreeperModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.entity.layers.CreeperPowerLayer; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.world.entity.monster.Creeper; @Environment(EnvType.CLIENT) public class CreeperRenderer extends MobRenderer> { private static final ResourceLocation CREEPER_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/creeper/creeper.png"); public CreeperRenderer(EntityRendererProvider.Context context) { super(context, new CreeperModel<>(context.bakeLayer(ModelLayers.CREEPER)), 0.5F); this.addLayer(new CreeperPowerLayer(this, context.getModelSet())); } protected void scale(Creeper livingEntity, PoseStack poseStack, float partialTickTime) { float f = livingEntity.getSwelling(partialTickTime); float g = 1.0F + Mth.sin(f * 100.0F) * f * 0.01F; f = Mth.clamp(f, 0.0F, 1.0F); f *= f; f *= f; float h = (1.0F + f * 0.4F) * g; float i = (1.0F + f * 0.1F) / g; poseStack.scale(h, i, h); } protected float getWhiteOverlayProgress(Creeper livingEntity, float partialTicks) { float f = livingEntity.getSwelling(partialTicks); return (int)(f * 10.0F) % 2 == 0 ? 0.0F : Mth.clamp(f, 0.5F, 1.0F); } /** * Returns the location of an entity's texture. */ public ResourceLocation getTextureLocation(Creeper entity) { return CREEPER_LOCATION; } }