@Mod(modid = Base_Upgrades.modid, name = "Upgrades Mod", version = "1.0.1")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class Base_Upgrades {
public static final String modid = "mod_upgrades";
//Blocks
public static Block UpgemOre;
//Items
public static Item Upgem;
public static Item UpgemMix;
public static Item BottledUpgemConcentrate;
public static Item UpgemMetal;
public static Item UpFuel;
public static Item UpDiamond;
public static Item UpDiamondPick;
public static Item UpDiamondHoe;
public static Item UpDiamondAxe;
public static Item UpDiamondSword;
public static Item UpDiamondSpade;
//Achievements and Achievement Pages
public static Achievement UpgemGet;
public static Achievement UpMetalMake;
public static AchievementPage UpgradesPage;
//Creative Tab(s)
public static CreativeTabs UpgradesTab = new CreativeTabs("tGM_UpgradesTab"){
public ItemStack getIconItemStack(){
return new ItemStack(Upgem);
}
};
@EventHandler
public void load(FMLInitializationEvent event){
/*Fills in information for achievements
* Only put here to load in Custom Icons
*/
UpgemGet = (new Achievement(300, "upgemGet", 0, 0, Upgem, (Achievement)null)).setIndependent().registerAchievement().setSpecial();
UpMetalMake = (new Achievement(301, "upmetalMake", 2, 0, UpgemMetal, UpgemGet)).registerAchievement();
UpgradesPage = new AchievementPage("Upgrades", UpgemGet, UpMetalMake);
AchievementPage.registerAchievementPage(UpgradesPage);
public void addAchievementLocalizations(){
addAchievementName("upmetalMake", "Oooh Shiny");
addAchievementDescription("upmetalMake", "Craft an Upgem Metal");
addAchievementName("upgemGet", "New Beginnings");
addAchievementDescription("upgemGet", "Harvest an Upgem");
}
The code didn't change for 1.6.2, make sure you followed the tutorial properly
I did. I double checked and made sure that all that I left out was the @Override in PickupNotifier, but when I re-added it, it didn't fix anything. Are you sure nothing changed in 1.6.2?
I did. I double checked and made sure that all that I left out was the @Override in PickupNotifier, but when I re-added it, it didn't fix anything. Are you sure nothing changed in 1.6.2?
Positive, updated the tutorial yesterday and everything still works for me. Send me your code and I'll see if I can figure it out.
Here's the Main Class, My Pickup Handler, and the Item being used (Just in case). I tested out the Crafting Handler before and it worked, so I'm really unsure about this error because it is not picked up by eclipse as a coding error.
Main Class - http://pastebin.com/T856nmPv
Pickup Handler - http://pastebin.com/YhiwMbZW
Item being used - http://pastebin.com/dL3n6wRm
Here's the Main Class, My Pickup Handler, and the Item being used (Just in case). I tested out the Crafting Handler before and it worked, so I'm really unsure about this error because it is not picked up by eclipse as a coding error.
Main Class - http://pastebin.com/T856nmPv
Pickup Handler - http://pastebin.com/YhiwMbZW
Item being used - http://pastebin.com/dL3n6wRm
Some things were just ordered incorrectly. If you ever have this issue again, make sure you have them ordered the way they are in the tutorial. Heres the fixed mod file:
package mod_Upgrades.common;
import net.minecraft.block.Block;
import net.minecraft.block.StepSound;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.Achievement;
import net.minecraft.stats.AchievementList;
import net.minecraftforge.common.AchievementPage;
import net.minecraftforge.common.EnumHelper;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
@Mod(modid = Base_Upgrades.modid, name = "Upgrades Mod", version = "1.0.1")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class Base_Upgrades {
public static final String modid = "mod_upgrades";
//Blocks
public static Block UpgemOre;
//Items
public static Item Upgem;
public static Item UpgemMix;
public static Item BottledUpgemConcentrate;
public static Item UpgemMetal;
public static Item UpFuel;
public static Item UpDiamond;
public static Item UpDiamondPick;
public static Item UpDiamondHoe;
public static Item UpDiamondAxe;
public static Item UpDiamondSword;
public static Item UpDiamondSpade;
//Achievements and Achievement Pages
public static Achievement UpgemGet;
public static Achievement UpMetalMake;
public static AchievementPage UpgradesPage;
//Tool Materials
public static EnumToolMaterial UPDIAMOND = EnumHelper.addToolMaterial("UPDIAMOND", 3, 3122, 16.0F, 6.0F, 20);
//Creative Tab(s)
public static CreativeTabs UpgradesTab = new CreativeTabs("tGM_UpgradesTab"){
public ItemStack getIconItemStack(){
return new ItemStack(Upgem);
}
};
@EventHandler
public void load(FMLInitializationEvent event)
{
//Upgem Ore
//UpgemOre = new UpgemOre(550, "upgemOre").setUnlocalizedName("upgemOre").setCreativeTab(UpgradesTab).setHardness(1.0F).setResistance(3.5F).setStepSound(Block.soundStoneFootstep);
//registerBlock(UpgemOre, "Upgem Ore", UpgemOre.getUnlocalizedName());
//Upgem
Upgem = new Upgem(1000, "upgem").setCreativeTab(UpgradesTab).setUnlocalizedName("upgem");
registerItem(Upgem, "Upgem", Upgem.getUnlocalizedName());
//Upgem Mix
//UpgemMix = new UpgemMix(1001, "upgem_mix").setCreativeTab(UpgradesTab).setUnlocalizedName("upgem_mix");
//registerItem(UpgemMix, "Upgem Mix", UpgemMix.getUnlocalizedName());
//Bottled Upgem Concentrate
//BottledUpgemConcentrate = new BottledUpgemConcentrate(1002, "upgem_bottle").setCreativeTab(UpgradesTab).setUnlocalizedName("upgem_bottle");
//registerItem(BottledUpgemConcentrate, "Bottled Upgem Concentrate", BottledUpgemConcentrate.getUnlocalizedName());
//Upgem Metal
UpgemMetal = new Upgem(1003, "upgem_metal").setCreativeTab(UpgradesTab).setUnlocalizedName("upgem_metal");
registerItem(UpgemMetal, "Upgem Metal", UpgemMetal.getUnlocalizedName());
//Upgraded Fuel
//UpFuel = new UpgradedFuel(1004, "upfuel").setUnlocalizedName("upfuel").setCreativeTab(UpgradesTab);
//registerItem(UpFuel, "Upgraded Fuel", UpFuel.getUnlocalizedName());
//Upgraded Diamond
//UpDiamond = new UpgradedDiamond(1005, "updiamond").setUnlocalizedName("updiamond").setCreativeTab(UpgradesTab);
//registerItem(UpDiamond, "Upgraded Diamond", UpDiamond.getUnlocalizedName());
//Upgraded Diamond Pickaxe
//UpDiamondPick = new UpDiamondPick(1006, UPDIAMOND, "updiamondpick").setUnlocalizedName("updiamondpick").setCreativeTab(UpgradesTab);
//registerItem(UpDiamondPick, "Upgraded Diamond Pickaxe", UpDiamondPick.getUnlocalizedName());
//Upgraded Diamond Sword
//UpDiamondSword = new UpDiamondSword(1007, UPDIAMOND, "updiamondsword").setUnlocalizedName("updiamondsword").setCreativeTab(UpgradesTab);
//registerItem(UpDiamondSword, "Upgraded Diamond Sword", UpDiamondSword.getUnlocalizedName());
//Upgraded Diamond Axe
//UpDiamondAxe = new UpDiamondAxe(1008, UPDIAMOND, "updiamondaxe").setUnlocalizedName("updiamondaxe").setCreativeTab(UpgradesTab);
//registerItem(UpDiamondAxe, "Upgraded Diamond Axe", UpDiamondAxe.getUnlocalizedName());
//Upgraded Diamond Hoe
//UpDiamondHoe = new UpDiamondHoe(1009, UPDIAMOND, "updiamondhoe").setUnlocalizedName("updiamondhoe").setCreativeTab(UpgradesTab);
//registerItem(UpDiamondHoe, "Upgraded Diamond Hoe", UpDiamondHoe.getUnlocalizedName());
//Upgraded Diamond Shovel
//UpDiamondSpade = new UpDiamondSpade(1010, UPDIAMOND, "updiamondspade").setUnlocalizedName("updiamondspade").setCreativeTab(UpgradesTab);
//registerItem(UpDiamondSpade, "Upgraded Diamond Shovel", UpDiamondSpade.getUnlocalizedName());
//Calls the recipes to be loaded
//craftingRecipes();
//smeltingRecipes();
//Registers Mod World Generator
//GameRegistry.registerWorldGenerator(new WorldGeneratorUpgrades());
//Registers tool specifically
MinecraftForge.setToolClass(UpDiamondPick, "pickaxe", 3);
MinecraftForge.setToolClass(UpDiamondSword, "sword", 3);
MinecraftForge.setToolClass(UpDiamondAxe, "axe", 3);
MinecraftForge.setToolClass(UpDiamondHoe, "hoe", 3);
MinecraftForge.setToolClass(UpDiamondSpade, "spade", 3);
//Names Creative Tabs
LanguageRegistry.instance().addStringLocalization("itemGroup.tGM_UpgradesTab", "Upgrades");
//Fills in information for achievements
//Only put here to load in Custom Icons
UpgemGet = (new Achievement(300, "UpgemGet", 0, 0, Upgem, null)).setSpecial().registerAchievement();
UpMetalMake = (new Achievement(301, "UpMetalMake", 0, 2, UpgemMetal, UpgemGet)).setSpecial().registerAchievement();
//Adds Achievements
addAchievementLocalizations();
UpgradesPage = new AchievementPage("Upgrades", UpgemGet, UpMetalMake);
AchievementPage.registerAchievementPage(UpgradesPage);
//Registers Handlers
//GameRegistry.registerCraftingHandler(new UpgradesCraftingHandler());
GameRegistry.registerPickupHandler(new UpgradesPickupHandler());
//GameRegistry.registerFuelHandler(new UpgradesFuelHandler());
}
public void addAchievementLocalizations()
{
addAchievementName("UpmetalMake", "Oooh Shiny");
addAchievementDescription("UpMetalMake", "Craft an Upgem Metal");
addAchievementName("UpgemGet", "New Beginnings");
addAchievementDescription("UpgemGet", "Harvest an Upgem");
}
public void addAchievementDescription(String par1String, String par2String)
{
LanguageRegistry.instance().addStringLocalization("achievement." + par1String + ".desc", "en_US", par2String);
}
public void addAchievementName(String par1String, String par2String)
{
LanguageRegistry.instance().addStringLocalization("achievement." + par1String, "en_US", par2String);
}
//registers recipes
private static void craftingRecipes(){
//Upgem Mix Recipe
GameRegistry.addRecipe(new ItemStack(UpgemMix, 1), new Object[]{
"SUS", " S ",
'S', Block.sand,
'U', Upgem
});
//Upgraded Fuel
GameRegistry.addRecipe(new ItemStack(UpFuel, 1), new Object[]{
" U ", "MCM", " U ",
'M', UpgemMetal,
'U', Upgem,
'C', Item.coal
});
//Upgraded Fuel
GameRegistry.addRecipe(new ItemStack(UpFuel, 1), new Object[]{
" U ", "MCM", " U ",
'M', UpgemMetal,
'U', Upgem,
'C', new ItemStack(Item.coal, 1, 1)
});
//Upgem Metal Recipe
GameRegistry.addRecipe(new ItemStack(UpgemMetal, 1), new Object[]{
"III", "IBI", "III",
'I', Item.ingotIron,
'B', BottledUpgemConcentrate
});
//Upgraded Diamond Recipe
GameRegistry.addRecipe(new ItemStack(UpDiamond, 1), new Object[]{
"MUM", "MDM", "MUM",
'M', UpgemMetal,
'U', Upgem,
'D', Item.diamond
});
//Upgraded Diamond Pickaxe Recipe
GameRegistry.addRecipe(new ItemStack(UpDiamondPick, 1), new Object[]{
"UUU", " S ", " S ",
'U', UpDiamond,
'S', Item.stick
});
}
//registers smelting
private static void smeltingRecipes(){
GameRegistry.addSmelting(UpgemMix.itemID, new ItemStack(BottledUpgemConcentrate, 2), 0F);
}
//Lets you register blocks easily
public static void registerBlock(Block block, String name, String unlocalizedName){
GameRegistry.registerBlock(block, Base_Upgrades.modid + unlocalizedName);
LanguageRegistry.addName(block, name);
}
//Lets you register items easily
public static void registerItem(Item item, String name, String unlocalizedName){
GameRegistry.registerItem(item, Base_Upgrades.modid + unlocalizedName);
LanguageRegistry.addName(item, name);
}
}
I commented out a lot of things because I didn't have those files but if you just uncomment them it should still work fine. I also changed UpgemMetal to reference the 'Upgem' file, but you can just change that back as well.
Some things were just ordered incorrectly. If you ever have this issue again, make sure you have them ordered the way they are in the tutorial. Heres the fixed mod file:
Thanks a lot man. I really appreciate the help. I'm definitely looking forward to any more tutorials you post in the future :3.
And by the way, I realized that the order of the code wasn't messed up. It was when I was defining UpgemGet, because after the line of code I not only put .setSpecial() and .registerAchievement(), but I had also put .setIndependent(). Before I had come to you I found a tutorial only about Crafting Handlers, not Pickup Handlers. They had said that .setIndependent() (AND the null area) was for if you wanted to create a stand-alone achievement, so I had used that part of his tutorial and then came here for the Pickup Handler, without changing previous code.
Thanks a lot man. I really appreciate the help. I'm definitely looking forward to any more tutorials you post in the future :3.
And by the way, I realized that the order of the code wasn't messed up. It was when I was defining UpgemGet, because after the line of code I not only put .setSpecial() and .registerAchievement(), but I had also put .setIndependent(). Before I had come to you I found a tutorial only about Crafting Handlers, not Pickup Handlers. They had said that .setIndependent() (AND the null area) was for if you wanted to create a stand-alone achievement, so I had used that part of his tutorial and then came here for the Pickup Handler, without changing previous code.
Oh thats right, yeah I deleted that part too I just forgot to tell you.
How to: Trigger a achievement when you have crafted 10 diamond pickaxes for example?
I dont know java too well so i cant figure out trough coding blankly, but i have other stuff
Maybe its possible to get data from the stats? So when you have Diamond Pickaxe : Crafted = 10 - The achievement will trigger?
Or
Maybe its possible to somehow have the game have something, and crafting a diamond pickaxe adds like "+1" on it, and when it reaches 10 the achievement triggers?
How to: Trigger a achievement when you have crafted 10 diamond pickaxes for example?
I dont know java too well so i cant figure out trough coding blankly, but i have other stuff
Maybe its possible to get data from the stats? So when you have Diamond Pickaxe : Crafted = 10 - The achievement will trigger?
Or
Maybe its possible to somehow have the game have something, and crafting a diamond pickaxe adds like "+1" on it, and when it reaches 10 the achievement triggers?
You could probably just set an int and add 1 to it every time a pickaxe is crafted, and also upon it being crafted have it check that int to see if it is equal to 1.
It would look something like this:
package mods.AchievementTutorial;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.ICraftingHandler;
public class CraftingHandler implements ICraftingHandler
{
public int pickaxesCrafted = 0;
@Override
public void onCrafting(EntityPlayer player, ItemStack item, IInventory craftMatrix)
{
if (item.itemID == Item.pickaxeDiamond.itemID)
{
pickaxesCrafted = pickaxesCrafted + 1;
if(pickaxesCrafted == 10)
{
player.addStat(AchievementMod.Tutorial, 1);
}
}
}
}
You could probably just set an int and add 1 to it every time a pickaxe is crafted, and also upon it being crafted have it check that int to see if it is equal to 1.
It would look something like this:
package mods.AchievementTutorial;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.ICraftingHandler;
public class CraftingHandler implements ICraftingHandler
{
public int pickaxesCrafted = 0;
@Override
public void onCrafting(EntityPlayer player, ItemStack item, IInventory craftMatrix)
{
if (item.itemID == Item.pickaxeDiamond.itemID)
{
pickaxesCrafted = pickaxesCrafted + 1;
if(pickaxesCrafted == 10)
{
player.addStat(AchievementMod.Tutorial, 1);
}
}
}
}
Haven't tried it though so I'm not quite sure.
It worked! Right of the bat! Thank you a TON!
Should definatly add that to your tutorial
-snip- also still wondering on that biome thing too
I don't think Forge has a listener for the biome that someone's in, but I know Minecraft does... Just find the code for the debug screen (the F3 GUI) in Minecraft.java, then look at how it obtains the information for which biome the player is in. create your own listener off of that, and then make that trigger the achievement when the player enters a certain biome. For example...
public String biomeAchievementTrigger = "river";
public void testForTrigger()
{
if(this.getPlayer().getLocation().getBiome() == this.biomeAchievementTrigger)
{
this.triggerAchievement();
}
}
Mind you that this is just an example, I haven't tested, nor did I look up all the methods I used in the example. I just used those names to give you an idea of what you're looking for.
I had that white screen to but you said it goes normal when you ad more achievements?
if did for me, but i think i changed a little tiny thing or somethin that i don't remember at the moment.... it shouldn't madder how many achievements you have.. it should still show up...
The code didn't change for 1.6.2, make sure you followed the tutorial properly
I did. I double checked and made sure that all that I left out was the @Override in PickupNotifier, but when I re-added it, it didn't fix anything. Are you sure nothing changed in 1.6.2?
Positive, updated the tutorial yesterday and everything still works for me. Send me your code and I'll see if I can figure it out.
Okay. Should I do what I did last time with the spoilers? Or should I send you it in like pastebin or something?
Preferably something like pastebin
Main Class - http://pastebin.com/T856nmPv
Pickup Handler - http://pastebin.com/YhiwMbZW
Item being used - http://pastebin.com/dL3n6wRm
Some things were just ordered incorrectly. If you ever have this issue again, make sure you have them ordered the way they are in the tutorial. Heres the fixed mod file:
I commented out a lot of things because I didn't have those files but if you just uncomment them it should still work fine. I also changed UpgemMetal to reference the 'Upgem' file, but you can just change that back as well.
Thanks a lot man. I really appreciate the help. I'm definitely looking forward to any more tutorials you post in the future :3.
And by the way, I realized that the order of the code wasn't messed up. It was when I was defining UpgemGet, because after the line of code I not only put .setSpecial() and .registerAchievement(), but I had also put .setIndependent(). Before I had come to you I found a tutorial only about Crafting Handlers, not Pickup Handlers. They had said that .setIndependent() (AND the null area) was for if you wanted to create a stand-alone achievement, so I had used that part of his tutorial and then came here for the Pickup Handler, without changing previous code.
Oh thats right, yeah I deleted that part too I just forgot to tell you.
I dont know java too well so i cant figure out trough coding blankly, but i have other stuff
Maybe its possible to get data from the stats? So when you have Diamond Pickaxe : Crafted = 10 - The achievement will trigger?
Or
Maybe its possible to somehow have the game have something, and crafting a diamond pickaxe adds like "+1" on it, and when it reaches 10 the achievement triggers?
You could probably just set an int and add 1 to it every time a pickaxe is crafted, and also upon it being crafted have it check that int to see if it is equal to 1.
It would look something like this:
Haven't tried it though so I'm not quite sure.
It worked! Right of the bat! Thank you a TON!
Should definatly add that to your tutorial
Thanks for testing! I'll add it
Can you help me to find out if you can make achievements for entering a new biome or dying certain way? It would be really helpfull!
Bye
The achievements are there, but since it's all white, it's hard to find them....
and i was wondering the exact same thing too!
EDIT: o.O.. ok it worked now, XD idk what i did... i did add some more achievements, but it..works....lol
also still wondering on that biome thing too
E
I don't think Forge has a listener for the biome that someone's in, but I know Minecraft does... Just find the code for the debug screen (the F3 GUI) in Minecraft.java, then look at how it obtains the information for which biome the player is in. create your own listener off of that, and then make that trigger the achievement when the player enters a certain biome. For example...
Mind you that this is just an example, I haven't tested, nor did I look up all the methods I used in the example. I just used those names to give you an idea of what you're looking for.
I had that white screen to but you said it goes normal when you ad more achievements?
if did for me, but i think i changed a little tiny thing or somethin that i don't remember at the moment.... it shouldn't madder how many achievements you have.. it should still show up...
E
Having trouble setting up forge for 1.7.2, but if anyone would like to help I could get these updated much faster, as well as the rest of my mods.