Search in sources :

Example 1 with SpecialRevolver

use of blusunrize.immersiveengineering.common.items.ItemRevolver.SpecialRevolver in project ImmersiveEngineering by BluSunrize.

the class BotaniaHelper method onPotatoRender.

@SubscribeEvent()
@SideOnly(Side.CLIENT)
public void onPotatoRender(TinyPotatoRenderEvent event) {
    if (event.tile.getWorld() == null)
        return;
    if (revolverEntity == null) {
        revolverEntity = new EntityItem(event.tile.getWorld(), 0.0D, 0.0D, 0.0D, new ItemStack(IEContent.itemRevolver));
        revolverEntity.hoverStart = 0;
    }
    try {
        String formattedName = event.name.replace("_", " ");
        ItemRevolver.SpecialRevolver special = null;
        if (formattedName.equalsIgnoreCase("Mr Damien Hazard") || formattedName.equalsIgnoreCase("Mr Hazard"))
            special = ItemRevolver.specialRevolversByTag.get("dev");
        else if (event.name.equalsIgnoreCase("BluSunrize"))
            special = ItemRevolver.specialRevolversByTag.get("fenrir");
        else {
            if (nameToSpecial.containsKey(event.name.toLowerCase(Locale.ENGLISH))) {
                List<SpecialRevolver> list = nameToSpecial.get(event.name.toLowerCase(Locale.ENGLISH));
                if (list != null && list.size() > 0) {
                    long ticks = event.tile.getWorld() != null ? event.tile.getWorld().getTotalWorldTime() / 100 : 0;
                    special = list.get((int) (ticks % list.size()));
                }
            }
        }
        if (special != null) {
            GlStateManager.pushMatrix();
            ((ItemRevolver) IEContent.itemRevolver).applySpecialCrafting(revolverEntity.getEntityItem(), special);
            GlStateManager.translate(-.16, 1.45, -.2);
            GlStateManager.rotate(-90, 0, 1, 0);
            GlStateManager.rotate(15, 0, 0, 1);
            GlStateManager.rotate(180, 1, 0, 0);
            GlStateManager.scale(.625f, .625f, .625f);
            ClientUtils.mc().getRenderManager().doRenderEntity(revolverEntity, 0, 0, 0, 0, 0, false);
            GlStateManager.popMatrix();
        }
    } catch (Exception e) {
    }
}
Also used : ItemRevolver(blusunrize.immersiveengineering.common.items.ItemRevolver) SpecialRevolver(blusunrize.immersiveengineering.common.items.ItemRevolver.SpecialRevolver) List(java.util.List) ItemStack(net.minecraft.item.ItemStack) EntityItem(net.minecraft.entity.item.EntityItem) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

ItemRevolver (blusunrize.immersiveengineering.common.items.ItemRevolver)1 SpecialRevolver (blusunrize.immersiveengineering.common.items.ItemRevolver.SpecialRevolver)1 List (java.util.List)1 EntityItem (net.minecraft.entity.item.EntityItem)1 ItemStack (net.minecraft.item.ItemStack)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1