Search in sources :

Example 1 with Achievement

use of net.minecraft.stats.Achievement in project Minechem by iopleke.

the class AchievementRegistry method addAchievement.

/**
     * Creates and adds an {@link net.minecraft.stats.Achievement} to the {@link net.minecraftforge.common.AchievementPage} with given prerequisite {@link net.minecraft.stats.Achievement}
     *
     * @param name             the name for the achievement
     * @param row              the row to display
     * @param column           the column display
     * @param displayItemStack the {@link net.minecraft.item.ItemStack} to display
     * @param prerequisite     the prerequisite {@link net.minecraft.stats.Achievement}
     * @param isSpecial        is this a special {@link net.minecraft.stats.Achievement} ?
     * @return the added {@link net.minecraft.stats.Achievement}
     */
public Achievement addAchievement(String name, int row, int column, ItemStack displayItemStack, Achievement prerequisite, boolean isSpecial) {
    String statName = Compendium.Naming.id + "." + name;
    Achievement achievement = new Achievement("achievement." + statName, statName, column, row, displayItemStack, prerequisite);
    if (isSpecial) {
        achievement.setSpecial();
    }
    if (prerequisite == null) {
        achievement.initIndependentStat();
    }
    return addAchievement(achievement);
}
Also used : Achievement(net.minecraft.stats.Achievement) ElementAchievement(minechem.achievement.ElementAchievement)

Example 2 with Achievement

use of net.minecraft.stats.Achievement in project VoodooCraft by Mod-DevCafeTeam.

the class VCAchievements method registerAchievements.

public static void registerAchievements() {
    Achievement[] achievementArray = new Achievement[achievementList.size()];
    for (Achievement a : achievementList) {
        a.registerStat();
        achievementArray[achievementList.indexOf(a)] = a;
    }
    AchievementPage.registerAchievementPage(new AchievementPage(Reference.NAME, achievementArray));
}
Also used : AchievementPage(net.minecraftforge.common.AchievementPage) Achievement(net.minecraft.stats.Achievement)

Example 3 with Achievement

use of net.minecraft.stats.Achievement in project VoodooCraft by Mod-DevCafeTeam.

the class VCAchievements method createAchievement.

/**
     * There has to be a better way to do this. For now, this is what we will use to incorporate D.R.Y
     * @param name The name of the achievement
     * @param column What column on the page this achievement is
     * @param row What row on the page this achievement is
     * @param o The icon of the achievement (either item, itemstack, or block)
     * @param parent What achievement is required before this achievement can be activated
     * @return The achievement
     */
private static Achievement createAchievement(String name, int column, int row, Object o, Achievement parent) {
    Achievement a;
    if (o instanceof Item) {
        Item item = (Item) o;
        a = new Achievement("achievement." + name, name, column, row, item, parent);
        achievementList.add(a);
        return a;
    } else if (o instanceof Block) {
        Block block = (Block) o;
        a = new Achievement("achievement." + name, name, column, row, block, parent);
        achievementList.add(a);
        return a;
    } else if (o instanceof ItemStack) {
        ItemStack stack = (ItemStack) o;
        a = new Achievement("achievement." + name, name, column, row, stack, parent);
        achievementList.add(a);
        return a;
    } else {
        VoodooCraft.log.warn(o + " is not item, itemstack, nor block.");
        return null;
    }
}
Also used : Item(net.minecraft.item.Item) Block(net.minecraft.block.Block) Achievement(net.minecraft.stats.Achievement) ItemStack(net.minecraft.item.ItemStack)

Example 4 with Achievement

use of net.minecraft.stats.Achievement in project BuildCraft by BuildCraft.

the class BuildCraftEnergy method init.

@Mod.EventHandler
public void init(FMLInitializationEvent evt) {
    channels = NetworkRegistry.INSTANCE.newChannel(DefaultProps.NET_CHANNEL_NAME + "-ENERGY", new ChannelHandler(), new PacketHandler());
    NetworkRegistry.INSTANCE.registerGuiHandler(instance, new EnergyGuiHandler());
    StatementManager.registerTriggerProvider(new EnergyStatementProvider());
    if (BuildCraftCore.loadDefaultRecipes) {
        loadRecipes();
    }
    reloadConfig(RestartRequirement.GAME);
    BuildcraftRecipeRegistry.refinery.addRecipe("buildcraft:fuel", new FluidStack(oil.fluid, 1), new FluidStack(fuel.fluid, 1), 120, 1);
    double fuelOilMultiplier = BuildCraftCore.mainConfigManager.get("general", "fuel.oil.combustion").getDouble();
    double fuelFuelMultiplier = BuildCraftCore.mainConfigManager.get("general", "fuel.fuel.combustion").getDouble();
    int fuelOilEnergyOutput = BuildCraftCore.mainConfigManager.get("general", "fuel.oil.combustion.energyOutput").getInt();
    int fuelFuelEnergyOutput = BuildCraftCore.mainConfigManager.get("general", "fuel.fuel.combustion.energyOutput").getInt();
    if (!Loader.isModLoaded("BuildCraft|Factory")) {
        BuildcraftFuelRegistry.fuel.addFuel(oil.fluid, fuelOilEnergyOutput, (int) (5000 * fuelOilMultiplier));
        BuildcraftFuelRegistry.fuel.addFuel(fuel.fluid, fuelFuelEnergyOutput, (int) (25000 * fuelFuelMultiplier));
    }
    BuildcraftFuelRegistry.coolant.addCoolant(FluidRegistry.WATER, 0.0023f);
    BuildcraftFuelRegistry.coolant.addSolidCoolant(StackKey.stack(Blocks.ice), StackKey.fluid(FluidRegistry.WATER), 1.5f);
    BuildcraftFuelRegistry.coolant.addSolidCoolant(StackKey.stack(Blocks.packed_ice), StackKey.fluid(FluidRegistry.WATER), 2.0f);
    EnergyProxy.proxy.registerBlockRenderers();
    EnergyProxy.proxy.registerTileEntities();
    engineAchievement2 = BuildCraftCore.achievementManager.registerAchievement(new Achievement("buildcraft|energy:achievement.stirlingEngine", "engineAchievement2", 3, -2, new ItemStack(BuildCraftCore.engineBlock, 1, 1), BuildCraftCore.engineRedstoneAchievement));
    engineAchievement3 = BuildCraftCore.achievementManager.registerAchievement(new Achievement("buildcraft|energy:achievement.combustionEngine", "engineAchievement3", 5, -2, new ItemStack(BuildCraftCore.engineBlock, 1, 2), engineAchievement2));
}
Also used : PacketHandler(buildcraft.core.lib.network.base.PacketHandler) EnergyStatementProvider(buildcraft.energy.statements.EnergyStatementProvider) FluidStack(net.minecraftforge.fluids.FluidStack) ChannelHandler(buildcraft.core.lib.network.base.ChannelHandler) Achievement(net.minecraft.stats.Achievement) ItemStack(net.minecraft.item.ItemStack)

Example 5 with Achievement

use of net.minecraft.stats.Achievement in project BuildCraft by BuildCraft.

the class BuildCraftCore method init.

@Mod.EventHandler
public void init(FMLInitializationEvent evt) {
    BuildCraftAPI.fakePlayerProvider = CoreProxy.proxy;
    EntityRegistry.registerModEntity(EntityResizableCuboid.class, "bcResizCuboid", EntityIds.RESIZABLE_CUBOID, instance, 0, 100, false);
    ChannelHandler coreChannelHandler = new ChannelHandler();
    coreChannelHandler.registerPacketType(PacketTabletMessage.class);
    channels = NetworkRegistry.INSTANCE.newChannel(DefaultProps.NET_CHANNEL_NAME + "-CORE", coreChannelHandler, handler = new PacketHandler());
    achievementManager = new AchievementPageManager("BuildCraft");
    MinecraftForge.EVENT_BUS.register(achievementManager);
    woodenGearAchievement = achievementManager.registerAchievement(new Achievement("buildcraft|core:achievement.woodenGear", "woodenGearAchievement", 0, 0, woodenGearItem, null));
    stoneGearAchievement = achievementManager.registerAchievement(new Achievement("buildcraft|core:achievement.stoneGear", "stoneGearAchievement", 2, 0, stoneGearItem, woodenGearAchievement));
    ironGearAchievement = achievementManager.registerAchievement(new Achievement("buildcraft|core:achievement.ironGear", "ironGearAchievement", 4, 0, ironGearItem, stoneGearAchievement));
    goldGearAchievement = achievementManager.registerAchievement(new Achievement("buildcraft|core:achievement.goldGear", "goldGearAchievement", 6, 0, goldGearItem, ironGearAchievement));
    diamondGearAchievement = achievementManager.registerAchievement(new Achievement("buildcraft|core:achievement.diamondGear", "diamondGearAchievement", 8, 0, diamondGearItem, goldGearAchievement));
    wrenchAchievement = achievementManager.registerAchievement(new Achievement("buildcraft|core:achievement.wrench", "wrenchAchievement", 3, 2, wrenchItem, stoneGearAchievement));
    engineRedstoneAchievement = BuildCraftCore.achievementManager.registerAchievement(new Achievement("buildcraft|core:achievement.redstoneEngine", "engineAchievement1", 1, -2, new ItemStack(engineBlock, 1, 0), BuildCraftCore.woodenGearAchievement));
    StatementManager.registerParameterClass(StatementParameterItemStack.class);
    StatementManager.registerParameterClass(StatementParameterItemStackExact.class);
    StatementManager.registerParameterClass(StatementParameterDirection.class);
    StatementManager.registerParameterClass(StatementParamGateSideOnly.class);
    StatementManager.registerParameterClass(StatementParameterRedstoneLevel.class);
    StatementManager.registerTriggerProvider(new CoreTriggerProvider());
    StatementManager.registerActionProvider(new CoreActionProvider());
    if (BuildCraftCore.modifyWorld) {
        MinecraftForge.EVENT_BUS.register(new SpringPopulate());
    }
    if (mainConfiguration.hasChanged()) {
        mainConfiguration.save();
    }
    if (BuildCraftCore.loadDefaultRecipes) {
        loadRecipes();
    }
    BCCreativeTab.get("main").setIcon(new ItemStack(BuildCraftCore.wrenchItem, 1));
    EntityList.stringToClassMapping.remove("BuildCraft|Core.bcLaser");
    EntityList.stringToClassMapping.remove("BuildCraft|Core.bcEnergyLaser");
    BuilderAPI.schematicRegistry.registerSchematicBlock(engineBlock, SchematicEngine.class);
    CoreProxy.proxy.init();
    NetworkRegistry.INSTANCE.registerGuiHandler(instance, new CoreGuiHandler());
    MinecraftForge.EVENT_BUS.register(TabletManagerClient.INSTANCE);
    MinecraftForge.EVENT_BUS.register(TabletManagerServer.INSTANCE);
    MinecraftForge.EVENT_BUS.register(TickHandlerCore.INSTANCE);
    TabletAPI.registerProgram(new TabletProgramMenuFactory());
    // Create filler registry
    try {
        FillerManager.registry = new FillerRegistry();
        // INIT FILLER PATTERNS
        IFillerPattern[] patterns = { PatternFill.INSTANCE, PatternNone.INSTANCE, new PatternFlatten(), new PatternHorizon(), new PatternClear(), new PatternBox(), new PatternPyramid(), new PatternStairs(), new PatternCylinder(), new PatternFrame() };
        for (IFillerPattern pattern : patterns) {
            FillerManager.registry.addPattern(pattern);
        }
        ActionFiller.resetMap();
    } catch (Error error) {
        BCLog.logErrorAPI(error, IFillerPattern.class);
        throw error;
    }
    StatementManager.registerParameterClass(PatternParameterYDir.class);
    StatementManager.registerParameterClass(PatternParameterXZDir.class);
    StatementManager.registerParameterClass(PatternParameterCenter.class);
    StatementManager.registerParameterClass(PatternParameterHollow.class);
    ListRegistry.registerHandler(new ListMatchHandlerClass());
    ListRegistry.registerHandler(new ListMatchHandlerFluid());
    ListRegistry.registerHandler(new ListMatchHandlerTools());
    ListRegistry.registerHandler(new ListMatchHandlerArmor());
    // ListRegistry.registerHandler(new ListMatchHandler());
    ListRegistry.itemClassAsType.add(ItemFood.class);
    DebuggingTools.fmlInit();
}
Also used : IFillerPattern(buildcraft.api.filler.IFillerPattern) ChannelHandler(buildcraft.core.lib.network.base.ChannelHandler) SpringPopulate(buildcraft.core.gen.SpringPopulate) Achievement(net.minecraft.stats.Achievement) TabletProgramMenuFactory(buildcraft.core.tablet.TabletProgramMenuFactory) PacketHandler(buildcraft.core.lib.network.base.PacketHandler) ItemStack(net.minecraft.item.ItemStack)

Aggregations

Achievement (net.minecraft.stats.Achievement)15 ItemStack (net.minecraft.item.ItemStack)5 AchievementPage (net.minecraftforge.common.AchievementPage)4 ChannelHandler (buildcraft.core.lib.network.base.ChannelHandler)3 PacketHandler (buildcraft.core.lib.network.base.PacketHandler)3 ElementAchievement (minechem.achievement.ElementAchievement)3 ElementAchievementPage (minechem.achievement.ElementAchievementPage)2 IFillerPattern (buildcraft.api.filler.IFillerPattern)1 RealBlueprintDeployer (buildcraft.builders.blueprints.RealBlueprintDeployer)1 SpringPopulate (buildcraft.core.gen.SpringPopulate)1 TabletProgramMenuFactory (buildcraft.core.tablet.TabletProgramMenuFactory)1 EnergyStatementProvider (buildcraft.energy.statements.EnergyStatementProvider)1 FactoryGuiHandler (buildcraft.factory.FactoryGuiHandler)1 SiliconGuiHandler (buildcraft.silicon.SiliconGuiHandler)1 Player (com.minecolonies.api.colony.permissions.Player)1 Block (net.minecraft.block.Block)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 Item (net.minecraft.item.Item)1 FluidStack (net.minecraftforge.fluids.FluidStack)1 NotNull (org.jetbrains.annotations.NotNull)1