ZidMC
Would you like to react to this message? Create an account in a few clicks or log in to continue.

[Solved] Minecraft crashes when trying to mine anything, please help!

5 posters

Go down

[Solved] Minecraft crashes when trying to mine anything, please help! Empty [Solved] Minecraft crashes when trying to mine anything, please help!

Post by DRRichard Tue May 03, 2011 11:02 am

...any block with my new tool. :O

To learn the modloader basics I've been doing your (Zid's) ModLoader tutorials at the forums, and I've been wrestling with a little problem.
Allright, I'll try to explain it as clear as possible:

So far I've made:
1. Aurantium Ore.
2. Aurantium Block.
3. Aurantium (=Item).
4. Aurantium Tools.

Now, everything went allright until I got to the tools. I made the tools and it worked great, but then I thought; "hm, why not make it so you can mine the ore and block with JUST the diamond and Aurantium tools?", so I tried making that but my minecraft crashed on the moment I wanted to harvest ANY BLOCK with it, after adding effectivity of Pickaxes;

Main Question: I just want pickaxes to become more effective on those two ores. What to do? :O

The error I got was:

Code:
[16:36] java.lang.NullPointerException
[16:36] at net.minecraft.src.ItemTool.getStrVsBlock(ItemTool.java:29)
[16:36] at net.minecraft.src.ItemStack.getStrVsBlock(ItemStack.java:87)
[16:36] at net.minecraft.src.InventoryPlayer.getStrVsBlock(InventoryPlayer.java:
233)
[16:36] at net.minecraft.src.EntityPlayer.getCurrentPlayerStrVsBlock(EntityPlaye
r.java:316)
[16:36] at net.minecraft.src.Block.blockStrength(Block.java:262)
[16:36] at net.minecraft.src.PlayerControllerSP.clickBlock(PlayerControllerSP.ja
va:64)
[16:36] at net.minecraft.client.Minecraft.clickMouse(Minecraft.java:757)
[16:36] at net.minecraft.client.Minecraft.runTick(Minecraft.java:985)
[16:36] at net.minecraft.client.Minecraft.run(Minecraft.java:451)
[16:36] at java.lang.Thread.run(Thread.java:722)
[16:36] Stopping!

Before continuing to adding to block to the world generation, I'd love having this fixed. Any quick help would be appreciated.

These are the NEW files so far:

mod_Aurantium.java

Code:
package net.minecraft.src;

public class mod_Aurantium extends BaseMod {
   
    public static final Block aurantiumOre = new BlockAurantiumOre(232, 0).setHardness(3.0F).setResistance(20F).setLightValue(0.8F).setBlockName("aurantiumOre");
    public static final Block aurantiumBlock = new BlockAurantium(233, 0).setHardness(2.0F).setResistance(40F).setLightValue(1.0F).setBlockName("aurantiumBlock");
    public static final Item aurantiumItem = new Item(1188).setItemName("aurantiumItem");
    public static final Item aurantiumAxe = new ItemAxe(1189, EnumToolMaterial.AURANTIUM).setItemName("aurantiumAxe");
    public static final Item aurantiumHoe = new ItemHoe(1190, EnumToolMaterial.AURANTIUM).setItemName("aurantiumHoe");
    public static final Item aurantiumPick = new ItemPickaxe(1191, EnumToolMaterial.AURANTIUM).setItemName("aurantiumPick");
    public static final Item aurantiumShovel = new ItemSpade(1192, EnumToolMaterial.AURANTIUM).setItemName("aurantiumShovel");
    public static final Item aurantiumSword = new ItemSword(1193, EnumToolMaterial.AURANTIUM).setItemName("aurantiumSword");
       
    public mod_Aurantium()
    {
        ModLoader.RegisterBlock(aurantiumOre);
        ModLoader.RegisterBlock(aurantiumBlock);
        aurantiumOre.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/AurantiumMod/Ore.png");
        aurantiumBlock.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/AurantiumMod/Block.png");
        aurantiumItem.iconIndex = ModLoader.addOverride("/gui/items.png", "/AurantiumMod/Item.png");
        aurantiumAxe.iconIndex = ModLoader.addOverride("/gui/items.png", "/AurantiumMod/Axe.png");
        aurantiumHoe.iconIndex = ModLoader.addOverride("/gui/items.png", "/AurantiumMod/Hoe.png");
        aurantiumPick.iconIndex = ModLoader.addOverride("/gui/items.png", "/AurantiumMod/Pickaxe.png");
        aurantiumShovel.iconIndex = ModLoader.addOverride("/gui/items.png", "/AurantiumMod/Shovel.png");
        aurantiumSword.iconIndex = ModLoader.addOverride("/gui/items.png", "/AurantiumMod/Sword.png");
        ModLoader.AddName(aurantiumOre, "Aurantium Ore");
        ModLoader.AddName(aurantiumBlock, "Aurantium Block");
        ModLoader.AddName(aurantiumItem, "Aurantium");
        ModLoader.AddName(aurantiumAxe, "Aurantium Axe");
        ModLoader.AddName(aurantiumHoe, "Aurantium Hoe");
        ModLoader.AddName(aurantiumPick, "Aurantium Pickaxe");
        ModLoader.AddName(aurantiumShovel, "Aurantium Shovel");
        ModLoader.AddName(aurantiumSword, "Aurantium Sword");
        ModLoader.AddRecipe(new ItemStack(aurantiumAxe, 1), new Object[] {
            "XX ", "X| ", " | ", Character.valueOf('X'), aurantiumItem, Character.valueOf('|'), Item.stick
        });
        ModLoader.AddRecipe(new ItemStack(aurantiumHoe, 1), new Object[] {
            "XX ", " | ", " | ", Character.valueOf('X'), aurantiumItem, Character.valueOf('|'), Item.stick
        });
        ModLoader.AddRecipe(new ItemStack(aurantiumPick, 1), new Object[] {
            "XXX", " | ", " | ", Character.valueOf('X'), aurantiumItem, Character.valueOf('|'), Item.stick
        });
        ModLoader.AddRecipe(new ItemStack(aurantiumShovel, 1), new Object[] {
            "X", "|", "|", Character.valueOf('X'), aurantiumItem, Character.valueOf('|'), Item.stick
        });
        ModLoader.AddRecipe(new ItemStack(aurantiumSword, 1), new Object[] {
            "X", "X", "|", Character.valueOf('X'), aurantiumItem, Character.valueOf('|'), Item.stick
        });
        ModLoader.AddRecipe(new ItemStack(aurantiumBlock, 1), new Object[] {
            "XXX", "XXX", "XXX", Character.valueOf('X'), aurantiumItem
        });
        ModLoader.AddRecipe(new ItemStack(aurantiumOre, 16), new Object[] {
            "X X", "  ", "X X", Character.valueOf('X'), Block.dirt
        });
        ModLoader.AddRecipe(new ItemStack(Item.pickaxeDiamond, 1), new Object[] {
            "XXX", " X ", " X ", Character.valueOf('X'), Block.dirt
        });
    }
   
    public String Version()
    {
        return "1.5_01";
    }
}


BlockAurantiumOre.java

Code:
package net.minecraft.src;
import java.util.Random;

public class BlockAurantiumOre extends Block
{
    protected BlockAurantiumOre(int i, int j)
    {
        super(i, j, Material.iron);
    }
   
    public int idDropped(int i, Random random)
    {
        return mod_Aurantium.aurantiumItem.shiftedIndex;
    }
   
    public int quantityDropped(Random random)
    {
        return 2 + random.nextInt(2);
    }
}

BlockAurantium.java

Code:
package net.minecraft.src;
import java.util.Random;

public class BlockAurantium extends Block
{
    protected BlockAurantium(int i, int j)
    {
        super(i, j, Material.iron);
    }
   
    public int idDropped(int i, Random random)
    {
        return mod_Aurantium.aurantiumItem.shiftedIndex;
    }
   
    public int quantityDropped(Random random)
    {
        return 9;
    }
}

ItemAurantium.java

Code:
package net.minecraft.src;

public class ItemAurantium extends Item
{
    public ItemAurantium(int i)
    {
        super(i);
        maxStackSize = 64;
    }
}

To EnumToolMaterial.java I've added:

Code:
    WOOD("WOOD", 0, 0, 59, 2.0F, 0),
    STONE("STONE", 1, 1, 131, 4F, 1),
    IRON("IRON", 2, 2, 250, 6F, 2),
    EMERALD("EMERALD", 3, 3, 1561, 8F, 3),
    GOLD("GOLD", 4, 0, 32, 12F, 0),
    AURANTIUM("AURANTIUM", 5, 4, 3321, 16F, 3);

To ItemPickaxe.java I've added:

Code:

        if(block == mod_Aurantium.aurantiumBlock || block == mod_Aurantium.aurantiumOre)
        {
            return toolMaterial.getHarvestLevel() >= 3;
        }
        if(block == Block.obsidian)
        {
            return toolMaterial.getHarvestLevel() >= 3;
        }

[b]AND[/b]

mod_Aurantium.aurantiumOre, mod_Aurantium.aurantiumBlock

After adding that 'mod_Aurantium.aurantiumOre, mod_Aurantium.aurantiumBlock' to the end of that file, right after 'Block.blockLapis' in the 'blocksEffectiveAgainst' array, it started crashing. Before that it worked perfectly fine!


Last edited by DRRichard on Wed May 04, 2011 6:42 am; edited 2 times in total (Reason for editing : Problem solved. Thanks.)
DRRichard
DRRichard
Recruit

Posts : 6
Join date : 2011-05-02
Age : 30
Location : The Netherlands

Back to top Go down

[Solved] Minecraft crashes when trying to mine anything, please help! Empty Re: [Solved] Minecraft crashes when trying to mine anything, please help!

Post by Kyle_Katarn Tue May 03, 2011 2:01 pm

Test it out in Test_Game.bat. (Paste all your new textures in their proper folders in the /temp/ folder) See if it will work then, I have a feeling you're getting the same Error as I am.

Kyle_Katarn
Iron Miner

Posts : 35
Join date : 2011-04-26

Back to top Go down

[Solved] Minecraft crashes when trying to mine anything, please help! Empty Re: [Solved] Minecraft crashes when trying to mine anything, please help!

Post by DRRichard Tue May 03, 2011 4:02 pm

Kyle_Katarn wrote:Test it out in Test_Game.bat. (Paste all your new textures in their proper folders in the /temp/ folder) See if it will work then, I have a feeling you're getting the same Error as I am.

Did that already. Didn't work. :O
No, it's something with the code.

Plus, I'm using MCP v3.1 so for me it's 'startclient.bat', I believe. :O
I'm not sure though...

Any other ideas? Neutral

I'll post this thread at the official forum too, just to see if I get more responses. :O
DRRichard
DRRichard
Recruit

Posts : 6
Join date : 2011-05-02
Age : 30
Location : The Netherlands

Back to top Go down

[Solved] Minecraft crashes when trying to mine anything, please help! Empty Re: [Solved] Minecraft crashes when trying to mine anything, please help!

Post by rockymc Tue May 03, 2011 6:48 pm

Make their hardness minus one level from Obsidian. Solved. Delete the event.

rockymc
Gold Miner

Posts : 102
Join date : 2011-05-01
Age : 43
Location : Brazil

Back to top Go down

[Solved] Minecraft crashes when trying to mine anything, please help! Empty Re: [Solved] Minecraft crashes when trying to mine anything, please help!

Post by DRRichard Wed May 04, 2011 6:04 am

rockymc wrote:Make their hardness minus one level from Obsidian. Solved. Delete the event.

Euuhm, no. This way it takes quite long to harvest the block, it will only be harvest-able with the diamond and 'aurantium' pickaxes, but even with those it'll take quite long.
Thanks for the help though, but what I want to find out is how to make ModLoader tools become effective against blocks without the full thing crashing.

If I'd done this without ModLoader I'm pretty sure it would've worked fine. I just need a way around this, or something that can recreate the same effect. :O (Which could be lowering hardness but you'd still mine the specific ModLoader block very slow, even with the effective tools.)
DRRichard
DRRichard
Recruit

Posts : 6
Join date : 2011-05-02
Age : 30
Location : The Netherlands

Back to top Go down

[Solved] Minecraft crashes when trying to mine anything, please help! Empty Re: [Solved] Minecraft crashes when trying to mine anything, please help!

Post by Ziddia Wed May 04, 2011 6:10 am

You have to use ToolUtils, it's impossible otherwise, unless you want the way rocky said.

Ziddia
Admin
Admin

Posts : 168
Join date : 2011-04-22

https://zidmc.forumotion.com

Back to top Go down

[Solved] Minecraft crashes when trying to mine anything, please help! Empty Re: [Solved] Minecraft crashes when trying to mine anything, please help!

Post by DRRichard Wed May 04, 2011 6:33 am

Ziddia wrote:You have to use ToolUtils, it's impossible otherwise, unless you want the way rocky said.

Thank you sir, that did the trick, just to be sure I didn't mess up anything; could you please give me an example of what rocky actually wanted me to do? It's possible I didn't really understand what he was saying. :O

Nvm, I've got it. Smile
Thanks for all the help!

Lock/Trash this thread please, problem solved. Smile


Last edited by DRRichard on Wed May 04, 2011 6:39 am; edited 1 time in total
DRRichard
DRRichard
Recruit

Posts : 6
Join date : 2011-05-02
Age : 30
Location : The Netherlands

Back to top Go down

[Solved] Minecraft crashes when trying to mine anything, please help! Empty Re: [Solved] Minecraft crashes when trying to mine anything, please help!

Post by Ziddia Wed May 04, 2011 6:39 am

I'm not sure I assume it works though.

Ziddia
Admin
Admin

Posts : 168
Join date : 2011-04-22

https://zidmc.forumotion.com

Back to top Go down

[Solved] Minecraft crashes when trying to mine anything, please help! Empty Re: [Solved] Minecraft crashes when trying to mine anything, please help!

Post by DRRichard Wed May 04, 2011 6:41 am

Ziddia wrote:I'm not sure I assume it works though.

Well it was a bit ... slow, but just lowering the Hardness did the trick.
I've just got to deal with it for now, I guess.

Thanks, though.
DRRichard
DRRichard
Recruit

Posts : 6
Join date : 2011-05-02
Age : 30
Location : The Netherlands

Back to top Go down

[Solved] Minecraft crashes when trying to mine anything, please help! Empty Re: [Solved] Minecraft crashes when trying to mine anything, please help!

Post by shoopdawhoop23 Wed May 04, 2011 7:26 am

ToolUtils hasn't been updated since 1.3. I don't know what you can do.

shoopdawhoop23
Moderator
Moderator

Posts : 56
Join date : 2011-04-22

Back to top Go down

[Solved] Minecraft crashes when trying to mine anything, please help! Empty Re: [Solved] Minecraft crashes when trying to mine anything, please help!

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum