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.SlimeModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.entity.layers.SlimeOuterLayer; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.world.entity.monster.Slime; @Environment(EnvType.CLIENT) public class SlimeRenderer extends MobRenderer> { private static final ResourceLocation SLIME_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/slime/slime.png"); public SlimeRenderer(EntityRendererProvider.Context context) { super(context, new SlimeModel<>(context.bakeLayer(ModelLayers.SLIME)), 0.25F); this.addLayer(new SlimeOuterLayer<>(this, context.getModelSet())); } public void render(Slime entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { this.shadowRadius = 0.25F * entity.getSize(); super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); } protected void scale(Slime livingEntity, PoseStack poseStack, float partialTickTime) { float f = 0.999F; poseStack.scale(0.999F, 0.999F, 0.999F); poseStack.translate(0.0F, 0.001F, 0.0F); float g = livingEntity.getSize(); float h = Mth.lerp(partialTickTime, livingEntity.oSquish, livingEntity.squish) / (g * 0.5F + 1.0F); float i = 1.0F / (h + 1.0F); poseStack.scale(i * g, 1.0F / i * g, i * g); } /** * Returns the location of an entity's texture. */ public ResourceLocation getTextureLocation(Slime entity) { return SLIME_LOCATION; } }