Search in sources :

Example 1 with ItemRevolver

use of blusunrize.immersiveengineering.common.items.ItemRevolver 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)

Example 2 with ItemRevolver

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

the class IEAchievements method init.

public static void init() {
    openManual = new AchievementIE("openManual", 0, 1, new ItemStack(IEContent.itemTool, 1, 3), null);
    craftHammer = new AchievementIE("craftHammer", 3, 2, IEContent.itemTool, openManual).setNormalCrafting();
    connectWire = new AchievementIE("connectWire", 0, -1, IEContent.itemWireCoil, openManual);
    blastfurnace = new AchievementIE("blastfurnace", 2, 1, new ItemStack(IEContent.blockStoneDevice, 1, BlockTypes_StoneDevices.BLAST_FURNACE.getMeta()), craftHammer);
    makeSteel = new AchievementIE("makeSteel", 2, -1, new ItemStack(IEContent.itemMetal, 1, 8), blastfurnace);
    placeConveyor = new AchievementIE("placeConveyor", 1, 3, ConveyorHandler.getConveyorStack(ImmersiveEngineering.MODID + ":conveyor"), openManual).setPlacement(new ItemStack(IEContent.blockConveyor));
    placeWindmill = new AchievementIE("placeWindmill", -1, 3, new ItemStack(IEContent.blockWoodenDevice1, 1, BlockTypes_WoodenDevice1.WINDMILL.getMeta()), openManual).setPlacement(new ItemStack(IEContent.blockWoodenDevice1, 1, BlockTypes_WoodenDevice1.WINDMILL.getMeta()), new ItemStack(IEContent.blockWoodenDevice1, 1, BlockTypes_WoodenDevice1.WINDMILL_ADVANCED.getMeta()));
    craftHeater = new AchievementIE("craftHeater", -2, 4, new ItemStack(IEContent.blockMetalDevice1, 1, BlockTypes_MetalDevice1.FURNACE_HEATER.getMeta()), openManual).setNormalCrafting();
    craftPump = new AchievementIE("craftPump", 2, 4, new ItemStack(IEContent.blockMetalDevice0, 1, BlockTypes_MetalDevice0.FLUID_PUMP.getMeta()), openManual).setNormalCrafting();
    placeFloodlight = new AchievementIE("placeFloodlight", -1, 5, new ItemStack(IEContent.blockMetalDevice1, 1, BlockTypes_MetalDevice1.FLOODLIGHT.getMeta()), openManual).setPlacement();
    mbImprovedBlastFurnace = new AchievementIE("mbImprovedBlastFurnace", 6, -3, new ItemStack(IEContent.blockStoneDevice, 1, BlockTypes_StoneDevices.BLAST_FURNACE_ADVANCED.getMeta()), makeSteel).setSpecial();
    mbMetalPress = new AchievementIE("mbMetalPress", 6, -2, new ItemStack(IEContent.blockMetalMultiblock, 1, BlockTypes_MetalMultiblock.METAL_PRESS.getMeta()), makeSteel).setSpecial();
    mbCrusher = new AchievementIE("mbCrusher", 6, -1, new ItemStack(IEContent.blockMetalMultiblock, 1, BlockTypes_MetalMultiblock.CRUSHER.getMeta()), makeSteel).setSpecial();
    mbSilo = new AchievementIE("mbSilo", 7, -2, new ItemStack(IEContent.blockMetalMultiblock, 1, BlockTypes_MetalMultiblock.SILO.getMeta()), craftHammer).setSpecial();
    mbDieselGen = new AchievementIE("mbDieselGen", 6, 0, new ItemStack(IEContent.blockMetalMultiblock, 1, BlockTypes_MetalMultiblock.DIESEL_GENERATOR.getMeta()), craftHammer).setSpecial();
    mbExcavator = new AchievementIE("mbExcavator", 6, 1, new ItemStack(IEContent.blockMetalMultiblock, 1, BlockTypes_MetalMultiblock.EXCAVATOR.getMeta()), craftHammer).setSpecial();
    mbArcFurnace = new AchievementIE("mbArcFurnace", 6, 2, new ItemStack(IEContent.blockMetalMultiblock, 1, BlockTypes_MetalMultiblock.ARC_FURNACE.getMeta()), craftHammer).setSpecial();
    craftWorkbench = new AchievementIE("craftWorkbench", 2, -3, new ItemStack(IEContent.blockWoodenDevice0, 1, BlockTypes_WoodenDevice0.WORKBENCH.getMeta()), makeSteel).setNormalCrafting();
    craftRevolver = new AchievementIE("craftRevolver", 3, -6, IEContent.itemRevolver, craftWorkbench).setNormalCrafting();
    ItemStack[] upgrades = new ItemStack[20];
    upgrades[18] = new ItemStack(IEContent.itemToolUpgrades, 1, 5);
    upgrades[19] = new ItemStack(IEContent.itemToolUpgrades, 1, 6);
    ItemStack revolver = new ItemStack(IEContent.itemRevolver);
    ((ItemRevolver) IEContent.itemRevolver).setContainedItems(revolver, upgrades);
    ((ItemRevolver) IEContent.itemRevolver).recalculateUpgrades(revolver);
    upgradeRevolver = new AchievementIE("upgradeRevolver", 4, -6, revolver, craftRevolver);
    if (!BulletHandler.homingCartridges.isEmpty())
        craftWolfPack = new AchievementIE("craftWolfPack", 4, -7, BulletHandler.getBulletStack("wolfpack"), craftRevolver).setCheckNBT(true).setBlueprintCrafting().setSpecial();
    ItemStack drill = new ItemStack(IEContent.itemDrill);
    ((ItemDrill) IEContent.itemDrill).setHead(drill, new ItemStack(IEContent.itemDrillhead));
    craftDrill = new AchievementIE("craftDrill", 1, -6, drill, craftWorkbench).setNormalCrafting();
    upgrades = new ItemStack[4];
    upgrades[0] = new ItemStack(IEContent.itemDrillhead);
    upgrades[1] = new ItemStack(IEContent.itemToolUpgrades, 1, 0);
    upgrades[2] = new ItemStack(IEContent.itemToolUpgrades, 1, 1);
    upgrades[3] = new ItemStack(IEContent.itemToolUpgrades, 3, 2);
    ItemStack drill2 = drill.copy();
    ((ItemDrill) IEContent.itemDrill).setContainedItems(drill2, upgrades);
    ((ItemDrill) IEContent.itemDrill).recalculateUpgrades(drill2);
    upgradeDrill = new AchievementIE("upgradeDrill", 0, -6, drill2, craftDrill);
    craftSkyhook = new AchievementIE("craftSkyhook", 1, -5, IEContent.itemSkyhook, craftWorkbench).setNormalCrafting();
    ItemStack hook = new ItemStack(IEContent.itemSkyhook);
    hook.addEnchantment(Enchantments.UNBREAKING, 1);
    //skyhookPro = new AchievementIE("skyhookPro", 0, -5, hook, craftSkyhook);
    craftChemthrower = new AchievementIE("craftChemthrower", 3, -5, IEContent.itemChemthrower, craftWorkbench).setNormalCrafting();
    craftRailgun = new AchievementIE("craftRailgun", 1, -7, IEContent.itemRailgun, craftWorkbench).setNormalCrafting();
    secret_birthdayParty = new AchievementIE("secret_birthdayParty", -4, -1, new ItemStack(IEContent.itemFakeIcons, 1, 0), null).setSpecial();
    secret_luckOfTheDraw = new AchievementIE("secret_luckOfTheDraw", -4, 1, new ItemStack(IEContent.itemFakeIcons, 1, 1), null).setSpecial();
    ieAchievementPage = new AchievementPage(ImmersiveEngineering.MODNAME, AchievementIE.achievements.toArray(new Achievement[AchievementIE.achievements.size()]));
    AchievementPage.registerAchievementPage(ieAchievementPage);
    statDistanceSkyhook = new StatBase("stat.skyhookOneCm", new TextComponentTranslation("stat.skyhookOneCm", new Object[0]), StatBase.distanceStatType) {

        @Override
        public StatBase registerStat() {
            super.registerStat();
            StatList.BASIC_STATS.add(12, this);
            return this;
        }
    }.initIndependentStat().registerStat();
}
Also used : ItemRevolver(blusunrize.immersiveengineering.common.items.ItemRevolver) TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation) AchievementPage(net.minecraftforge.common.AchievementPage) StatBase(net.minecraft.stats.StatBase) ItemStack(net.minecraft.item.ItemStack) ItemDrill(blusunrize.immersiveengineering.common.items.ItemDrill)

Example 3 with ItemRevolver

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

the class CommonProxy method getServerGuiElement.

@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
    if (ID >= Lib.GUIID_Base_Item) {
        EntityEquipmentSlot slot = EntityEquipmentSlot.values()[ID / 100];
        //Slot determined, get actual ID
        ID %= 100;
        ItemStack item = player.getItemStackFromSlot(slot);
        if (item != null && item.getItem() instanceof IGuiItem && ((IGuiItem) item.getItem()).getGuiID(item) == ID) {
            if (ID == Lib.GUIID_Revolver && item.getItem() instanceof ItemRevolver)
                return new ContainerRevolver(player.inventory, world, slot, item);
            if (ID == Lib.GUIID_Toolbox && item.getItem() instanceof ItemToolbox)
                return new ContainerToolbox(player.inventory, world, slot, item);
        }
    } else {
        TileEntity te = world.getTileEntity(new BlockPos(x, y, z));
        if (te instanceof IGuiTile) {
            Object gui = null;
            if (ID == Lib.GUIID_CokeOven && te instanceof TileEntityCokeOven)
                gui = new ContainerCokeOven(player.inventory, (TileEntityCokeOven) te);
            if (ID == Lib.GUIID_BlastFurnace && te instanceof TileEntityBlastFurnace)
                gui = new ContainerBlastFurnace(player.inventory, (TileEntityBlastFurnace) te);
            if (ID == Lib.GUIID_WoodenCrate && te instanceof TileEntityWoodenCrate)
                gui = new ContainerCrate(player.inventory, (TileEntityWoodenCrate) te);
            if (ID == Lib.GUIID_Workbench && te instanceof TileEntityModWorkbench)
                gui = new ContainerModWorkbench(player.inventory, (TileEntityModWorkbench) te);
            if (ID == Lib.GUIID_Sorter && te instanceof TileEntitySorter)
                gui = new ContainerSorter(player.inventory, (TileEntitySorter) te);
            if (ID == Lib.GUIID_Squeezer && te instanceof TileEntitySqueezer)
                gui = new ContainerSqueezer(player.inventory, (TileEntitySqueezer) te);
            if (ID == Lib.GUIID_Fermenter && te instanceof TileEntityFermenter)
                gui = new ContainerFermenter(player.inventory, (TileEntityFermenter) te);
            if (ID == Lib.GUIID_Refinery && te instanceof TileEntityRefinery)
                gui = new ContainerRefinery(player.inventory, (TileEntityRefinery) te);
            if (ID == Lib.GUIID_ArcFurnace && te instanceof TileEntityArcFurnace)
                gui = new ContainerArcFurnace(player.inventory, (TileEntityArcFurnace) te);
            if (ID == Lib.GUIID_Assembler && te instanceof TileEntityAssembler)
                gui = new ContainerAssembler(player.inventory, (TileEntityAssembler) te);
            if (ID == Lib.GUIID_AutoWorkbench && te instanceof TileEntityAutoWorkbench)
                gui = new ContainerAutoWorkbench(player.inventory, (TileEntityAutoWorkbench) te);
            if (ID == Lib.GUIID_Mixer && te instanceof TileEntityMixer)
                gui = new ContainerMixer(player.inventory, (TileEntityMixer) te);
            if (ID == Lib.GUIID_Turret && te instanceof TileEntityTurret)
                gui = new ContainerTurret(player.inventory, (TileEntityTurret) te);
            if (ID == Lib.GUIID_FluidSorter && te instanceof TileEntityFluidSorter)
                gui = new ContainerFluidSorter(player.inventory, (TileEntityFluidSorter) te);
            if (ID == Lib.GUIID_Belljar && te instanceof TileEntityBelljar)
                gui = new ContainerBelljar(player.inventory, (TileEntityBelljar) te);
            if (ID == Lib.GUIID_ToolboxBlock && te instanceof TileEntityToolbox)
                gui = new ContainerToolboxBlock(player.inventory, (TileEntityToolbox) te);
            if (gui != null)
                ((IGuiTile) te).onGuiOpened(player, false);
            return gui;
        }
    }
    return null;
}
Also used : TileEntityModWorkbench(blusunrize.immersiveengineering.common.blocks.wooden.TileEntityModWorkbench) EntityEquipmentSlot(net.minecraft.inventory.EntityEquipmentSlot) IGuiItem(blusunrize.immersiveengineering.common.items.IEItemInterfaces.IGuiItem) TileEntity(net.minecraft.tileentity.TileEntity) TileEntityCokeOven(blusunrize.immersiveengineering.common.blocks.stone.TileEntityCokeOven) TileEntitySorter(blusunrize.immersiveengineering.common.blocks.wooden.TileEntitySorter) TileEntityBlastFurnace(blusunrize.immersiveengineering.common.blocks.stone.TileEntityBlastFurnace) BlockPos(net.minecraft.util.math.BlockPos) TileEntityFluidSorter(blusunrize.immersiveengineering.common.blocks.wooden.TileEntityFluidSorter) ItemToolbox(blusunrize.immersiveengineering.common.items.ItemToolbox) IGuiTile(blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IGuiTile) TileEntityWoodenCrate(blusunrize.immersiveengineering.common.blocks.wooden.TileEntityWoodenCrate) ItemRevolver(blusunrize.immersiveengineering.common.items.ItemRevolver) ItemStack(net.minecraft.item.ItemStack)

Aggregations

ItemRevolver (blusunrize.immersiveengineering.common.items.ItemRevolver)3 ItemStack (net.minecraft.item.ItemStack)3 IGuiTile (blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IGuiTile)1 TileEntityBlastFurnace (blusunrize.immersiveengineering.common.blocks.stone.TileEntityBlastFurnace)1 TileEntityCokeOven (blusunrize.immersiveengineering.common.blocks.stone.TileEntityCokeOven)1 TileEntityFluidSorter (blusunrize.immersiveengineering.common.blocks.wooden.TileEntityFluidSorter)1 TileEntityModWorkbench (blusunrize.immersiveengineering.common.blocks.wooden.TileEntityModWorkbench)1 TileEntitySorter (blusunrize.immersiveengineering.common.blocks.wooden.TileEntitySorter)1 TileEntityWoodenCrate (blusunrize.immersiveengineering.common.blocks.wooden.TileEntityWoodenCrate)1 IGuiItem (blusunrize.immersiveengineering.common.items.IEItemInterfaces.IGuiItem)1 ItemDrill (blusunrize.immersiveengineering.common.items.ItemDrill)1 SpecialRevolver (blusunrize.immersiveengineering.common.items.ItemRevolver.SpecialRevolver)1 ItemToolbox (blusunrize.immersiveengineering.common.items.ItemToolbox)1 List (java.util.List)1 EntityItem (net.minecraft.entity.item.EntityItem)1 EntityEquipmentSlot (net.minecraft.inventory.EntityEquipmentSlot)1 StatBase (net.minecraft.stats.StatBase)1 TileEntity (net.minecraft.tileentity.TileEntity)1 BlockPos (net.minecraft.util.math.BlockPos)1 TextComponentTranslation (net.minecraft.util.text.TextComponentTranslation)1