56 lines
1.6 KiB
Java
56 lines
1.6 KiB
Java
package net.minecraft.client.renderer.entity.layers;
|
|
|
|
import com.mojang.blaze3d.vertex.PoseStack;
|
|
import net.fabricmc.api.EnvType;
|
|
import net.fabricmc.api.Environment;
|
|
import net.minecraft.client.model.CatModel;
|
|
import net.minecraft.client.model.geom.EntityModelSet;
|
|
import net.minecraft.client.model.geom.ModelLayers;
|
|
import net.minecraft.client.renderer.MultiBufferSource;
|
|
import net.minecraft.client.renderer.entity.RenderLayerParent;
|
|
import net.minecraft.resources.ResourceLocation;
|
|
import net.minecraft.world.entity.animal.Cat;
|
|
|
|
@Environment(EnvType.CLIENT)
|
|
public class CatCollarLayer extends RenderLayer<Cat, CatModel<Cat>> {
|
|
private static final ResourceLocation CAT_COLLAR_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/cat/cat_collar.png");
|
|
private final CatModel<Cat> catModel;
|
|
|
|
public CatCollarLayer(RenderLayerParent<Cat, CatModel<Cat>> renderer, EntityModelSet modelSet) {
|
|
super(renderer);
|
|
this.catModel = new CatModel<>(modelSet.bakeLayer(ModelLayers.CAT_COLLAR));
|
|
}
|
|
|
|
public void render(
|
|
PoseStack poseStack,
|
|
MultiBufferSource buffer,
|
|
int packedLight,
|
|
Cat livingEntity,
|
|
float limbSwing,
|
|
float limbSwingAmount,
|
|
float partialTicks,
|
|
float ageInTicks,
|
|
float netHeadYaw,
|
|
float headPitch
|
|
) {
|
|
if (livingEntity.isTame()) {
|
|
int i = livingEntity.getCollarColor().getTextureDiffuseColor();
|
|
coloredCutoutModelCopyLayerRender(
|
|
this.getParentModel(),
|
|
this.catModel,
|
|
CAT_COLLAR_LOCATION,
|
|
poseStack,
|
|
buffer,
|
|
packedLight,
|
|
livingEntity,
|
|
limbSwing,
|
|
limbSwingAmount,
|
|
ageInTicks,
|
|
netHeadYaw,
|
|
headPitch,
|
|
partialTicks,
|
|
i
|
|
);
|
|
}
|
|
}
|
|
}
|