Jump to content

Recommended Posts

Posted

Hello, I seem to be having a problem with my custom achievement page. I looked on another post that had exactly the same crash and was resolved by initializing the achievements in Init  and registering the page in PostInit. Unfortunately that did not resolve my crash and still gets the same error. Link to that post: http://www.minecraftforge.net/forum/index.php?topic=16909.0

 

Here is my code

 

Mod Class

    @EventHandler
    public void load(FMLInitializationEvent event) {
FurnitureAchievements.loadAchievements();
    }

    @EventHandler
    public void postInit(FMLPostInitializationEvent event) {
FurnitureAchievements.registerPage();
    }

 

Achievement Class

package com.mrcrayfish.furniture;

public class FurnitureAchievements {
    public static Map<String, Achievement> achievements = new HashMap<String, Achievement>();

    public static Achievement installMod;
    public static Achievement mineKea;
    public static Achievement placeTree;
    public static Achievement unwrapPresent;
    public static Achievement houseParty;
    public static Achievement applianceCity;
    public static Achievement cookItem;
    public static Achievement buyItem;
    public static Achievement freezeItem;
    public static Achievement copyItem;
    public static Achievement whatDidYouEat;
    public static Achievement mailBox;
    public static Achievement sendMail;
    public static Achievement firstMail;
    public static Achievement donator;
    public static Achievement privacy;
    public static Achievement tapped;
    public static Achievement heyeyey;
    public static Achievement dingDong;
    public static Achievement careful;
    public static Achievement allClean;
    public static Achievement modernTechnology;
    public static Achievement gardening;
    public static Achievement bathroom;

    public static AchievementPage page;

    public static void loadAchievements() {
registerIndependantAchievement(installMod, "install", 0, 0, new ItemStack(MrCrayfishFurnitureMod.itemCrayfish));

registerAchievement(mineKea, "minekea", 2, 0, new ItemStack(MrCrayfishFurnitureMod.itemChairWood), installMod);
registerAchievement(placeTree, "placetree", 3, 1, new ItemStack(MrCrayfishFurnitureMod.itemTree), mineKea);
registerAchievement(unwrapPresent, "unwrappresent", 4, 2, new ItemStack(MrCrayfishFurnitureMod.itemPresentRed), placeTree);
registerAchievement(privacy, "privacy", 4, 0, new ItemStack(MrCrayfishFurnitureMod.itemCurtains), mineKea);

registerAchievement(applianceCity, "appliancecity", 1, 2, new ItemStack(MrCrayfishFurnitureMod.itemOven), installMod);
registerAchievement(cookItem, "cookitem", 2, 3, new ItemStack(Items.cooked_chicken), applianceCity);
registerAchievement(freezeItem, "freezeitem", 0, 3, new ItemStack(Blocks.ice), applianceCity);

registerAchievement(modernTechnology, "moderntechnology", -3, 2, new ItemStack(MrCrayfishFurnitureMod.itemComputer), installMod);
registerAchievement(buyItem, "buyitem", -2, 1, new ItemStack(Items.emerald), modernTechnology);
registerAchievement(copyItem, "copyitem", -4, 1, new ItemStack(Items.book), modernTechnology);
registerAchievement(houseParty, "houseparty", -3, 0, new ItemStack(MrCrayfishFurnitureMod.itemStereo), modernTechnology);
registerAchievement(heyeyey, "heyeyey", -4, 3, new ItemStack(MrCrayfishFurnitureMod.itemTV), modernTechnology);
registerAchievement(dingDong, "dingdong", -3, 4, new ItemStack(MrCrayfishFurnitureMod.itemDoorBell), modernTechnology);
registerAchievement(careful, "careful", -2, 3, new ItemStack(MrCrayfishFurnitureMod.itemElectricFence), modernTechnology);

registerAchievement(gardening, "gardening", -2, -2, new ItemStack(MrCrayfishFurnitureMod.itemHedgeBasic), installMod);
registerAchievement(mailBox, "mailbox", -3, -3, new ItemStack(MrCrayfishFurnitureMod.itemMailBox), gardening);
registerAchievement(sendMail, "sendmail", -4, -4, new ItemStack(MrCrayfishFurnitureMod.itemEnvelope), mailBox);
registerAchievement(firstMail, "firstmail", -4, -2, new ItemStack(MrCrayfishFurnitureMod.itemPackage), mailBox);
registerAchievement(tapped, "tapped", -1, -3, new ItemStack(MrCrayfishFurnitureMod.itemTap), gardening);
registerAchievement(donator, "donator", -1, -4, new ItemStack(MrCrayfishFurnitureMod.itemDollar), gardening);

registerAchievement(bathroom, "bathroom", 2, -2, new ItemStack(MrCrayfishFurnitureMod.itemBasin), installMod);
registerAchievement(whatDidYouEat, "whatdidyoueat", 3, -3, new ItemStack(MrCrayfishFurnitureMod.itemToilet), bathroom);
registerAchievement(allClean, "allclean", 1, -3, new ItemStack(MrCrayfishFurnitureMod.itemShower), bathroom);

page = new AchievementPage("MrCrayfish's Furniture Mod", installMod, mineKea, placeTree, unwrapPresent, privacy, applianceCity, cookItem, freezeItem, modernTechnology, buyItem, copyItem, houseParty, heyeyey, dingDong, careful, gardening, mailBox, sendMail, firstMail, tapped, donator, bathroom, whatDidYouEat, allClean);
    }

    public static void registerAchievement(Achievement achieve, String name, int iconX, int iconY, ItemStack displayItem, Achievement parent) {
achieve = new Achievement("achievement." + name, name, iconX, iconY, displayItem, parent).registerStat();
achievements.put(name, achieve);
    }

    public static void registerIndependantAchievement(Achievement achieve, String name, int iconX, int iconY, ItemStack displayItem) {
achieve = new Achievement("achievement." + name, name, iconX, iconY, displayItem, null).initIndependentStat().registerStat();
achievements.put(name, achieve);
    }

    public static void registerPage() {
AchievementPage.registerAchievementPage(page);
    }

    public static void triggerAchievement(EntityPlayer player, String name) {
player.triggerAchievement(achievements.get(name));
    }
}

 

Error

---- Minecraft Crash Report ----
// Hi. I'm Minecraft, and I'm a crashaholic.

Time: 7/4/14 3:28 PM
Description: Rendering screen

java.lang.NullPointerException: Rendering screen
at net.minecraft.client.gui.achievement.GuiAchievements.func_146552_b(GuiAchievements.java:385)
at net.minecraft.client.gui.achievement.GuiAchievements.drawScreen(GuiAchievements.java:219)
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1209)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1063)
at net.minecraft.client.Minecraft.run(Minecraft.java:951)
at net.minecraft.client.main.Main.main(Main.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Stacktrace:
at net.minecraft.client.gui.achievement.GuiAchievements.func_146552_b(GuiAchievements.java:385)
at net.minecraft.client.gui.achievement.GuiAchievements.drawScreen(GuiAchievements.java:219)

-- Screen render details --
Details:
Screen name: net.minecraft.client.gui.achievement.GuiAchievements
Mouse location: Scaled: (290, 264). Absolute: (581, 190)
Screen size: Scaled: (640, 360). Absolute: (1280, 720). Scale factor of 2

-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityClientPlayerMP['Player363'/209, l='MpServer', x=-763.98, y=5.62, z=-499.21]]
Chunk stats: MultiplayerChunkCache: 225, 225
Level seed: 0
Level generator: ID 01 - flat, ver 0. Features enabled: false
Level generator options: 
Level spawn location: World: (-773,4,-373), Chunk: (at 11,0,11 in -49,-24; contains blocks -784,0,-384 to -769,255,-369), Region: (-2,-1; contains chunks -64,-32 to -33,-1, blocks -1024,0,-512 to -513,255,-1)
Level time: 139213 game time, 6000 day time
Level dimension: 0
Level storage version: 0x00000 - Unknown?
Level weather: Rain time: 0 (now: true), thunder time: 0 (now: false)
Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
Forced entities: 23 total; [EntityClientPlayerMP['Player363'/209, l='MpServer', x=-763.98, y=5.62, z=-499.21], EntitySheep['Sheep'/64, l='MpServer', x=-840.78, y=4.00, z=-446.34], EntitySheep['Sheep'/79, l='MpServer', x=-822.50, y=4.00, z=-449.78], EntityHorse['Horse'/152, l='MpServer', x=-688.16, y=4.00, z=-467.53], EntityPig['Pig'/116, l='MpServer', x=-798.13, y=4.00, z=-427.38], EntityChicken['Chicken'/81, l='MpServer', x=-826.41, y=4.00, z=-438.63], EntityChicken['Chicken'/115, l='MpServer', x=-788.47, y=4.00, z=-435.66], EntitySheep['Sheep'/80, l='MpServer', x=-819.09, y=4.00, z=-448.28], EntityPig['Pig'/114, l='MpServer', x=-790.78, y=4.00, z=-464.47], EntityChicken['Chicken'/113, l='MpServer', x=-792.56, y=4.00, z=-489.47], EntitySheep['Sheep'/82, l='MpServer', x=-826.18, y=4.00, z=-434.34], EntityChicken['Chicken'/112, l='MpServer', x=-794.44, y=4.00, z=-491.81], EntitySheep['Sheep'/59, l='MpServer', x=-843.94, y=4.00, z=-456.09], EntityChicken['Chicken'/127, l='MpServer', x=-783.47, y=4.00, z=-437.53], EntityPig['Pig'/93, l='MpServer', x=-805.34, y=4.00, z=-443.88], EntityChicken['Chicken'/92, l='MpServer', x=-802.47, y=4.00, z=-468.56], EntitySheep['Sheep'/63, l='MpServer', x=-833.22, y=4.00, z=-437.78], EntitySheep['Sheep'/62, l='MpServer', x=-838.22, y=4.00, z=-436.13], EntityChicken['Chicken'/149, l='MpServer', x=-711.81, y=4.00, z=-467.78], EntitySheep['Sheep'/61, l='MpServer', x=-844.94, y=4.00, z=-469.94], EntityPig['Pig'/91, l='MpServer', x=-810.13, y=4.00, z=-554.63], EntitySheep['Sheep'/60, l='MpServer', x=-836.25, y=4.00, z=-455.84], EntityChicken['Chicken'/151, l='MpServer', x=-700.47, y=4.00, z=-487.44]]
Retry entities: 0 total; []
Server brand: fml,forge
Server type: Integrated singleplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:418)
at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2556)
at net.minecraft.client.Minecraft.run(Minecraft.java:973)
at net.minecraft.client.main.Main.main(Main.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

 

Hopefully you can point out where I am going wrong. I am sure I had it working before or I wouldn't have released the mod to the public already.

 

Thank you,

MrCrayfish

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.