Java 类net.minecraft.client.model.ModelElytra 实例源码

项目:MineLittlePony    文件:RenderPlayerModel.java   
protected LayerRenderer<EntityLivingBase> getElytraLayer() {
    final ModelElytra modelElytra = new ModelElytra();
    return new LayerRenderer<EntityLivingBase>() {
        @Override
        public void doRenderLayer(EntityLivingBase entityBase, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
            EntityPlayerModel entity = (EntityPlayerModel) entityBase;
            ItemStack itemstack = entity.getItemStackFromSlot(EntityEquipmentSlot.CHEST);

            if (itemstack.getItem() == Items.ELYTRA) {
                GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
                GlStateManager.enableBlend();
                GlStateManager.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);

                bindTexture(entity.getElytraTexture());

                GlStateManager.pushMatrix();
                GlStateManager.translate(0.0F, 0.0F, 0.125F);

                modelElytra.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entity);
                modelElytra.render(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);

                GlStateManager.disableBlend();
                GlStateManager.popMatrix();
            }
        }

        @Override
        public boolean shouldCombineTextures() {
            return false;
        }
    };
}