Search in sources :

Example 1 with RenderableCosmetic

use of gg.moonflower.pollen.core.client.entitlement.RenderableCosmetic in project pollen by MoonflowerTeam.

the class PollenCosmeticLayer method render.

@Override
public void render(PoseStack matrixStack, MultiBufferSource buffer, int packedLight, T entity, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) {
    if (GeometryTextureManager.isReloading() || GeometryModelManager.isReloading())
        return;
    EntitlementManager.getEntitlements(entity.getUUID()).forEach(entitlement -> {
        if (entitlement instanceof RenderableCosmetic) {
            RenderableCosmetic cosmetic = (RenderableCosmetic) entitlement;
            if (!cosmetic.isEnabled())
                return;
            ResourceLocation modelName = cosmetic.getModelKey();
            if (modelName == null)
                return;
            GeometryModel model = GeometryModelManager.getModel(modelName);
            ResourceLocation textureKey = cosmetic.getTextureKey();
            if (model == GeometryModel.EMPTY || textureKey == null)
                return;
            GeometryModelRenderer.copyModelAngles(this.getParentModel(), model);
            GeometryModelRenderer.render(model, textureKey, buffer, matrixStack, packedLight, OverlayTexture.NO_OVERLAY, cosmetic.getRed(), cosmetic.getGreen(), cosmetic.getBlue(), cosmetic.getAlpha());
        }
    });
}
Also used : GeometryModel(gg.moonflower.pollen.pinwheel.api.client.geometry.GeometryModel) ResourceLocation(net.minecraft.resources.ResourceLocation) RenderableCosmetic(gg.moonflower.pollen.core.client.entitlement.RenderableCosmetic)

Aggregations

RenderableCosmetic (gg.moonflower.pollen.core.client.entitlement.RenderableCosmetic)1 GeometryModel (gg.moonflower.pollen.pinwheel.api.client.geometry.GeometryModel)1 ResourceLocation (net.minecraft.resources.ResourceLocation)1