Search in sources :

Example 1 with IHasPlayerRenderer

use of crazypants.enderio.api.upgrades.IHasPlayerRenderer in project EnderIO by SleepyTrousers.

the class UpgradeRenderDispatcher method doRenderLayer.

@Override
public void doRenderLayer(@Nonnull AbstractClientPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
    NNList.of(EntityEquipmentSlot.class).apply(new Callback<EntityEquipmentSlot>() {

        @Override
        public void apply(@Nonnull EntityEquipmentSlot slot) {
            ItemStack item = player.getItemStackFromSlot(slot);
            if (item.getItem() instanceof IDarkSteelItem) {
                for (IDarkSteelUpgrade upgrade : UpgradeRegistry.getUpgrades()) {
                    if (upgrade instanceof IHasPlayerRenderer && upgrade.hasUpgrade(item)) {
                        ((IHasPlayerRenderer) upgrade).getRender().doRenderLayer(renderPlayer, slot, item, player, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale);
                    }
                }
            }
            if (item.getItem() instanceof IHasPlayerRenderer) {
                ((IHasPlayerRenderer) item.getItem()).getRender().doRenderLayer(renderPlayer, slot, item, player, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale);
            }
        }
    });
    IInventory baubles = BaublesUtil.instance().getBaubles(player);
    if (baubles != null) {
        for (int i = 0; i < baubles.getSizeInventory(); i++) {
            ItemStack piece = baubles.getStackInSlot(i);
            if (piece.getItem() instanceof IHasPlayerRenderer) {
                ((IHasPlayerRenderer) piece.getItem()).getRender().doRenderLayer(renderPlayer, null, piece, player, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale);
            }
        }
    }
}
Also used : IInventory(net.minecraft.inventory.IInventory) EntityEquipmentSlot(net.minecraft.inventory.EntityEquipmentSlot) IHasPlayerRenderer(crazypants.enderio.api.upgrades.IHasPlayerRenderer) ItemStack(net.minecraft.item.ItemStack) IDarkSteelUpgrade(crazypants.enderio.api.upgrades.IDarkSteelUpgrade) IDarkSteelItem(crazypants.enderio.api.upgrades.IDarkSteelItem)

Aggregations

IDarkSteelItem (crazypants.enderio.api.upgrades.IDarkSteelItem)1 IDarkSteelUpgrade (crazypants.enderio.api.upgrades.IDarkSteelUpgrade)1 IHasPlayerRenderer (crazypants.enderio.api.upgrades.IHasPlayerRenderer)1 EntityEquipmentSlot (net.minecraft.inventory.EntityEquipmentSlot)1 IInventory (net.minecraft.inventory.IInventory)1 ItemStack (net.minecraft.item.ItemStack)1