Java 类net.minecraft.client.renderer.entity.layers.LayerArmorBase 实例源码

项目:blockbuster    文件:LayerElytra.java   
@Override
public void doRenderLayer(EntityLivingBase entity, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale)
{
    ItemStack itemstack = entity.getItemStackFromSlot(EntityEquipmentSlot.CHEST);

    if (itemstack != null && itemstack.getItem() == Items.ELYTRA)
    {
        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);

        this.renderPlayer.bindTexture(TEXTURE_ELYTRA);

        GlStateManager.pushMatrix();
        GlStateManager.translate(0.0F, 0.0F, 0.125F);
        this.modelElytra.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entity);
        this.modelElytra.render(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);

        if (itemstack.isItemEnchanted())
        {
            LayerArmorBase.renderEnchantedGlint(this.renderPlayer, entity, this.modelElytra, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale);
        }

        GlStateManager.popMatrix();
    }
}
项目:MineLittlePony    文件:LayerPonyElytra.java   
@Override
public void doPonyRender(@Nonnull EntityLivingBase entity, float swing, float swingAmount, float ticks, float age, float yaw, float head, float scale) {

    AbstractPonyModel model = ((IRenderPony) this.getRenderer()).getPony().getModel();

    ItemStack itemstack = entity.getItemStackFromSlot(EntityEquipmentSlot.CHEST);

    if (itemstack.getItem() == Items.ELYTRA) {
        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);

        if (entity instanceof AbstractClientPlayer) {

            AbstractClientPlayer player = (AbstractClientPlayer) entity;
            if (player.isPlayerInfoSet() && player.getLocationElytra() != null) {
                this.getRenderer().bindTexture(player.getLocationElytra());
            } else if (player.hasPlayerInfo() && player.getLocationCape() != null && player.isWearing(EnumPlayerModelParts.CAPE)) {
                this.getRenderer().bindTexture(player.getLocationCape());
            } else {
                this.getRenderer().bindTexture(TEXTURE_ELYTRA);
            }
        } else {
            this.getRenderer().bindTexture(TEXTURE_ELYTRA);
        }

        GlStateManager.pushMatrix();
        GlStateManager.translate(0.0F, 0.25F, 0.125F);
        model.transform(BodyPart.BODY);
        this.modelElytra.setRotationAngles(swing, swingAmount, age, yaw, head, scale, entity);
        this.modelElytra.render(entity, swing, swingAmount, age, yaw, head, scale);

        if (itemstack.isItemEnchanted()) {
            LayerArmorBase.renderEnchantedGlint(this.getRenderer(), entity, this.modelElytra, swing, swingAmount, ticks, age, yaw, head, scale);
        }

        GlStateManager.popMatrix();
    }
}
项目:Alchemy    文件:ExMobends.java   
@Hook("net.gobbob.mobends.client.renderer.entity.layers.LayerBendsElytra#func_177141_a")
public static Hook.Result doRenderLayer_elytra(LayerBendsElytra layer, AbstractClientPlayer player, float limbSwing, float limbSwingAmount,
        float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
    ItemStack item = ExItemElytra.getInInventoryBauble(player);
    if (item != null) {
        {
            GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
            GlStateManager.enableBlend();

            if (player.isPlayerInfoSet() && player.getLocationElytra() != null)
                renderPlayer.get(layer).bindTexture(player.getLocationElytra());
            else if (player.hasPlayerInfo() && player.getLocationCape() != null && player.isWearing(EnumPlayerModelParts.CAPE))
                renderPlayer.get(layer).bindTexture(player.getLocationCape());
            else
                renderPlayer.get(layer).bindTexture(LayerElytra.TEXTURE_ELYTRA);

            GlStateManager.pushMatrix();
            renderPlayer.get(layer).getMainModel().bipedBody.postRender(scale);
            GlStateManager.translate(0.0F, -12.0F * scale, 0.125F);
            modelElytra.get(layer).setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, player);
            modelElytra.get(layer).render(player, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);

            if (item.isItemEnchanted())
                LayerArmorBase.renderEnchantedGlint(renderPlayer.get(layer), player, modelElytra.get(layer), limbSwing, limbSwingAmount,
                        partialTicks, ageInTicks, netHeadYaw, headPitch, scale);

            GlStateManager.popMatrix();
        }
        return Hook.Result.NULL;
    }
    return Hook.Result.VOID;
}
项目:Alchemy    文件:ExItemElytra.java   
@Hook("net.minecraft.client.renderer.entity.layers.LayerElytra#func_177141_a")
public static Hook.Result doRenderLayer_elytra(LayerElytra layer, EntityLivingBase living, float limbSwing, float limbSwingAmount,
        float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
    ItemStack item = getFormLiving0(living);
    if (item.getItem() == Items.ELYTRA) {
        {
            GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
            GlStateManager.enableBlend();
            GlStateManager.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);

            if (living instanceof AbstractClientPlayer) {
                AbstractClientPlayer player = (AbstractClientPlayer) living;
                if (player.isPlayerInfoSet() && player.getLocationElytra() != null)
                    layer.renderPlayer.bindTexture(player.getLocationElytra());
                else if (player.hasPlayerInfo() && player.getLocationCape() != null && player.isWearing(EnumPlayerModelParts.CAPE))
                    layer.renderPlayer.bindTexture(player.getLocationCape());
                else
                    layer.renderPlayer.bindTexture(LayerElytra.TEXTURE_ELYTRA);
            } else
                layer.renderPlayer.bindTexture(LayerElytra.TEXTURE_ELYTRA);

            GlStateManager.pushMatrix();
            GlStateManager.translate(0.0F, 0.0F, 0.125F);
            layer.modelElytra.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, living);
            layer.modelElytra.render(living, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);

            if (item.isItemEnchanted())
                LayerArmorBase.renderEnchantedGlint(layer.renderPlayer, living, layer.modelElytra, limbSwing, limbSwingAmount,
                        partialTicks, ageInTicks, netHeadYaw, headPitch, scale);

            GlStateManager.disableBlend();
            GlStateManager.popMatrix();
        }
        return Hook.Result.NULL;
    }
    return Hook.Result.VOID;
}
项目:Battlegear2    文件:BattlegearRenderHelper.java   
public static Pair<Boolean, ModelBiped> getEquippedModel(EntityPlayer player, RenderPlayer render, EntityEquipmentSlot slot) {
    ItemStack equip = player.getItemStackFromSlot(slot);
    boolean hasEquip = !equip.isEmpty();
    if (hasEquip) {
        for (Object object : render.layerRenderers) {
            if (object instanceof LayerArmorBase && ((LayerArmorBase) object).getModelFromSlot(slot) instanceof ModelBiped) {
                return Pair.of(true, ForgeHooksClient.getArmorModel(player, equip, slot, (ModelBiped)((LayerArmorBase) object).getModelFromSlot(slot)));
            }
        }
    }
    return Pair.of(hasEquip, null);
}
项目:EnderIO    文件:ElytraUpgradeLayer.java   
@Override
public void doRenderLayer(@Nonnull RenderPlayer renderPlayer, EntityEquipmentSlot equipmentSlot, @Nonnull ItemStack piece,
    @Nonnull AbstractClientPlayer entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw,
    float headPitch, float scale) {
  if (equipmentSlot != EntityEquipmentSlot.CHEST) {
    return;
  }

  GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
  GlStateManager.enableBlend();

  final ResourceLocation locationElytra = entitylivingbaseIn.getLocationElytra();
  if (entitylivingbaseIn.isPlayerInfoSet() && locationElytra != null) {
    renderPlayer.bindTexture(locationElytra);
  } else {
    final ResourceLocation locationCape = entitylivingbaseIn.getLocationCape();
    if (entitylivingbaseIn.hasPlayerInfo() && locationCape != null && entitylivingbaseIn.isWearing(EnumPlayerModelParts.CAPE)) {
      renderPlayer.bindTexture(locationCape);
    } else {
      renderPlayer.bindTexture(TEXTURE_ELYTRA);
    }
  }

  GlStateManager.pushMatrix();
  GlStateManager.translate(0.0F, 0.0F, 0.125F);
  modelElytra.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entitylivingbaseIn);
  modelElytra.render(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);

  if (piece.isItemEnchanted()) {
    LayerArmorBase.renderEnchantedGlint(renderPlayer, entitylivingbaseIn, modelElytra, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw,
        headPitch, scale);
  }

  GlStateManager.popMatrix();
}
项目:CrystalMod    文件:LayerExtendedPlayerInventory.java   
@Override
public void doRenderLayer(AbstractClientPlayer entity, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
    if(entity.isInvisible())return;
    ItemStack backpack = BackpackUtil.getBackpackOnBack(entity);
    if(ItemStackTools.isValid(backpack)){
        IBackpack type = BackpackUtil.getType(backpack);
        if(type !=null){
            ResourceLocation res = type.getTexture(backpack, 1);
            if(res == null){
                res = TextureMap.LOCATION_MISSING_TEXTURE;
            }
            GlStateManager.pushMatrix();
            GlStateManager.color(1, 1, 1, 1);
            playerRenderer.bindTexture(res);
            this.backpackModel.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entity);
            GlStateManager.pushMatrix();
            GlStateManager.scale(0.7, 0.7, 0.7);
            GlStateManager.translate(0, 0.05, 0);
               this.backpackModel.render(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
               boolean enchanted = false;
               if (enchanted) {
                   LayerArmorBase.renderEnchantedGlint(this.playerRenderer, entity, this.backpackModel, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale);
               }
               GlStateManager.popMatrix();
            if(type instanceof IBackpackInventory){
                IBackpackInventory inv = (IBackpackInventory)type;
                InventoryBackpack inventory = inv.getInventory(backpack);
                InventoryBackpackUpgrades upgradeInv = type.getUpgradeInventory(backpack);
                if(inventory !=null && upgradeInv !=null){
                    if(upgradeInv.hasUpgrade(BackpackUpgrade.POCKETS)){
                        if(inventory instanceof NormalInventoryBackpack){
                            NormalInventoryBackpack normalInv = (NormalInventoryBackpack)inventory;
                            ItemStack weapon = normalInv.getToolStack(0);
                            ItemStack tool = normalInv.getToolStack(1);
                            if(ItemStackTools.isValid(weapon)){
                                GlStateManager.pushMatrix();
                                GlStateManager.translate(0.3, 0.3, 0.3);
                                GlStateManager.rotate(90, 0, 1, 0);
                                GlStateManager.rotate(-45, 0, 0, 1);
                                GlStateManager.scale(0.5, 0.5, 0.5);
                                RenderUtil.renderItem(weapon, TransformType.FIXED);
                                GlStateManager.popMatrix();
                            }
                            if(ItemStackTools.isValid(tool)){
                                GlStateManager.pushMatrix();
                                GlStateManager.translate(-0.3, 0.3, 0.3);
                                GlStateManager.rotate(90, 0, 1, 0);
                                GlStateManager.rotate(135, 0, 0, 1);
                                GlStateManager.scale(0.5, 0.5, 0.5);
                                RenderUtil.renderItem(tool, TransformType.FIXED);
                                GlStateManager.popMatrix();
                            }
                        }
                    }
                }
            }
            GlStateManager.popMatrix();
        }
    }
}
项目:wolfarmor    文件:LayerWolfArmor.java   
/**
 * Renders this layer.
 *
 * @param entityWolf      The wolf to render.  If it is not am EntityWolfArmored, the layer will not render.
 * @param limbSwing       The entity's limb swing progress.
 * @param limbSwingAmount The entity's limb swing progress amount.
 * @param partialTicks    The current game tick.
 * @param ageInTicks      The entity's age.
 * @param netHeadYaw      The yaw of the entity's head.
 * @param headPitch       The pitch of the entity's head.
 * @param scale           The scale at which to render the layer.
 */
@Override
public void doRenderLayer(@Nonnull EntityWolf entityWolf,
                          float limbSwing,
                          float limbSwingAmount,
                          float partialTicks,
                          float ageInTicks,
                          float netHeadYaw,
                          float headPitch,
                          float scale) {
    if (!WolfArmorMod.getConfiguration().getIsWolfArmorRenderEnabled()) {
        return;
    }

    IWolfArmorCapability wolfArmor = entityWolf.getCapability(CapabilityWolfArmor.WOLF_ARMOR_CAPABILITY, null);
    if(wolfArmor == null) {
        return;
    }

    ItemStack itemStack = wolfArmor.getArmorItemStack();

    if (!itemStack.isEmpty() && itemStack.getItem() instanceof ItemWolfArmor) {
        ItemWolfArmor armorItem = (ItemWolfArmor) itemStack.getItem();

        for (int layer = 0; layer < modelWolfArmors.length; layer++) {
            ModelWolfArmor model = modelWolfArmors[layer];
            model = getArmorModelForLayer(entityWolf, itemStack, layer, model);

            model.setModelAttributes(this.renderer.getMainModel());
            model.setLivingAnimations(entityWolf, limbSwing, limbSwingAmount, partialTicks);

            this.renderer.bindTexture(this.getArmorResource(entityWolf, itemStack, layer, null));

            int color = armorItem.getColor(itemStack);

            if (color != 0xFFFFFFFF) {
                float r = (color >> 16 & 0xFF) / 255F;
                float g = (color >> 8 & 0xFF) / 255F;
                float b = (color & 0xFF) / 255F;
                GlStateManager.color(getColorRed() * r, getColorGreen() * g, getColorBlue() * b, getAlpha());
            } else {
                GlStateManager.color(getColorRed(), getColorGreen(), getColorBlue(), getAlpha());
            }

            model.render(entityWolf, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);

            GlStateManager.color(getColorRed(), getColorGreen(), getColorBlue(), getAlpha());

            if (armorItem.getHasOverlay(itemStack)) {
                this.renderer.bindTexture(this.getArmorResource(entityWolf, itemStack, layer, "overlay"));
                model.render(entityWolf, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
            }

            if (!getShouldSkipArmorGlint() && itemStack.hasEffect()) {
                LayerArmorBase.renderEnchantedGlint(renderer, entityWolf, model, limbSwing, limbSwingAmount, partialTicks,
                        ageInTicks, netHeadYaw, headPitch, scale);
            }
        }
    }
}