alright i just keep haveing an issue with my script and im hopeing that some one can help,
Error from minecraft:
Mods loaded: 3
ModLoader 1.2.5
mod_Blocks WorldCraft Blocks V1 - MC 1.2.5
mod_DimensionAPI 1.5 for MC 1.2.5
Minecraft has crashed!
----------------------
Minecraft has stopped running because it encountered a problem.
--- BEGIN ERROR REPORT 8845ff11 --------
Generated 7/23/12 10:25 PM
Minecraft: Minecraft 1.2.5
OS: Windows 7 (amd64) version 6.1
Java: 1.7.0_04, Oracle Corporation
VM: Java HotSpot™ 64-Bit Server VM (mixed mode), Oracle Corporation
LWJGL: 2.4.2
OpenGL: GeForce GT 420/PCI/SSE2 version 4.0.0, NVIDIA Corporation
java.lang.NullPointerException
at net.minecraft.src.BlockSaphire.idDropped(BlockSaphire.java:15)
at net.minecraft.src.Block.dropBlockAsItemWithChance(Block.java:671)
at net.minecraft.src.Block.dropBlockAsItem(Block.java:649)
at net.minecraft.src.Block.harvestBlock(Block.java:1039)
at net.minecraft.src.PlayerControllerSP.onPlayerDestroyBlock(PlayerControllerSP.java:64)
at net.minecraft.src.PlayerControllerSP.onPlayerDamageBlock(PlayerControllerSP.java:140)
at net.minecraft.client.Minecraft.sendClickBlockToController(Minecraft.java:1338)
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1844)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:870)
at net.minecraft.client.Minecraft.run(Minecraft.java:801)
at java.lang.Thread.run(Unknown Source)
--- END ERROR REPORT d887993 ----------
public class BlockSaphire extends Block
{
EntityPlayer entityplayer;
protected BlockSaphire(int i, int j)
{
super(i,j,Material.rock);
}
public int idDropped(int i, Random random, int j)
{
if (entityplayer.getCurrentEquippedItem() != null && entityplayer.getCurrentEquippedItem().itemID == Item.pickaxeSteel.shiftedIndex)
{
return mod_Blocks.Saphire.blockID;
}
if (entityplayer.getCurrentEquippedItem() != null && entityplayer.getCurrentEquippedItem().itemID == Item.pickaxeDiamond.shiftedIndex)
{
return mod_Blocks.Saphire.blockID;
}
else
{
return 0;
}
}
public int quantityDropped(Random random)
{
return 1;
}
public String Version()
{
return "3.14159265";
}
}
Will some body please help, this has been driving me nuts for the past week!
i have done literally every thing i can with my very small knowledge of java codeing
--- BEGIN ERROR REPORT 8845ff11 -------- Generated 7/23/12 10:25 PM
Minecraft: Minecraft 1.2.5 OS: Windows 7 (amd64) version 6.1 Java: 1.7.0_04, Oracle Corporation VM: Java HotSpot™ 64-Bit Server VM (mixed mode), Oracle Corporation LWJGL: 2.4.2 OpenGL: GeForce GT 420/PCI/SSE2 version 4.0.0, NVIDIA Corporation
java.lang.NullPointerException at net.minecraft.src.BlockSaphire.idDropped(BlockSaphire.java:15) at net.minecraft.src.Block.dropBlockAsItemWithChance(Block.java:671) at net.minecraft.src.Block.dropBlockAsItem(Block.java:649) at net.minecraft.src.Block.harvestBlock(Block.java:1039) at net.minecraft.src.PlayerControllerSP.onPlayerDestroyBlock(PlayerControllerSP.java:64) at net.minecraft.src.PlayerControllerSP.onPlayerDamageBlock(PlayerControllerSP.java:140) at net.minecraft.client.Minecraft.sendClickBlockToController(Minecraft.java:1338) at net.minecraft.client.Minecraft.runTick(Minecraft.java:1844) at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:870) at net.minecraft.client.Minecraft.run(Minecraft.java:801) at java.lang.Thread.run(Unknown Source) --- END ERROR REPORT d887993 ----------
I've highlighted the important parts Lets have a look shall we?
First, the green. (The exception.) This is very important, it tells us essentially what went wrong. In this case, a NullPointer. Meaning, a pointer which doesnt exist. Which, in simple terms, means you're accessing something that doesnt exist.
Now, the Red is the only line that has your code in there . (Block.Saphire) And since Minecraft's code runs without error, unless you tampered with it, we can assume your problem is located here.
The Blue, is what caused the thing that triggered the error. Not the cause itself.The blue , in this case, is what happened before the error, that made the error happen.
EDIT - SO YA, I WAS OFF. I SHOULD PROBABLY GO STRAIGHT TO BED BUT HEY, ATLEAST THE FIRST BIT MIGHT BE A BIT EDUCATIONAL SHOULD YOU NOT KNOW HOW TO READ ERROR LOGS
Alright i have tried what i could understand form your posts and this is what i have now
Error:
Mods loaded: 3
ModLoader 1.2.5
mod_Blocks WorldCraft Blocks V1 - MC 1.2.5
mod_DimensionAPI 1.5 for MC 1.2.5
Minecraft has crashed!
----------------------
Minecraft has stopped running because it encountered a problem.
--- BEGIN ERROR REPORT 8845ff11 --------
Generated 7/24/12 9:13 AM
Minecraft: Minecraft 1.2.5
OS: Windows 7 (amd64) version 6.1
Java: 1.7.0_04, Oracle Corporation
VM: Java HotSpot™ 64-Bit Server VM (mixed mode), Oracle Corporation
LWJGL: 2.4.2
OpenGL: GeForce GT 420/PCI/SSE2 version 4.0.0, NVIDIA Corporation
java.lang.NullPointerException
at net.minecraft.src.BlockSaphire.idDropped(BlockSaphire.java:15)
at net.minecraft.src.Block.dropBlockAsItemWithChance(Block.java:671)
at net.minecraft.src.Block.dropBlockAsItem(Block.java:649)
at net.minecraft.src.Block.harvestBlock(Block.java:1039)
at net.minecraft.src.PlayerControllerSP.onPlayerDestroyBlock(PlayerControllerSP.java:64)
at net.minecraft.src.PlayerControllerSP.onPlayerDamageBlock(PlayerControllerSP.java:140)
at net.minecraft.client.Minecraft.sendClickBlockToController(Minecraft.java:1338)
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1844)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:870)
at net.minecraft.client.Minecraft.run(Minecraft.java:801)
at java.lang.Thread.run(Unknown Source)
--- END ERROR REPORT b358f006 ----------
[color=#282828][font=Verdana, Geneva, Tahoma, sans-serif][background=rgb(232, 239, 244)]doesn't this throw a null pointer anyway?[/background][/font][/color]
[background=rgb(232, 239, 244)][font=Verdana, Geneva, Tahoma, sans-serif][color=#282828]Why not just place it inside a Try/Catch?[/color][/font][/background]
sorry a what now? Im just a beginner to java this is literary my first mod from scratch
Try overriding the harvestBlock method instead of idDropped, that way you'll get the EntityPlayer that broke the block. Take a look at BlockLeaves for an example of how harvestBlock works, it drops a block only if the player used Shears.
Edit: on second thought, look at BlockDeadBush instead, it's less complicated than BlockLeaves.
Try overriding the harvestBlock method instead of idDropped, that way you'll get the EntityPlayer that broke the block. Take a look at BlockLeaves for an example of how harvestBlock works, it drops a block only if the player used Shears.
Edit: on second thought, look at BlockDeadBush instead, it's less complicated than BlockLeaves.
You are a life saver! thanks to the dead bush you can now mine it without crashing!, but now the issue is you can still mine it with any pick, but for one of the ores thats fine, you deserve a
You are a life saver! thanks to the dead bush you can now mine it without crashing!, but now the issue is you can still mine it with any pick, but for one of the ores thats fine, you deserve a
Error from minecraft:
Mods loaded: 3
ModLoader 1.2.5
mod_Blocks WorldCraft Blocks V1 - MC 1.2.5
mod_DimensionAPI 1.5 for MC 1.2.5
Minecraft has crashed!
----------------------
Minecraft has stopped running because it encountered a problem.
--- BEGIN ERROR REPORT 8845ff11 --------
Generated 7/23/12 10:25 PM
Minecraft: Minecraft 1.2.5
OS: Windows 7 (amd64) version 6.1
Java: 1.7.0_04, Oracle Corporation
VM: Java HotSpot™ 64-Bit Server VM (mixed mode), Oracle Corporation
LWJGL: 2.4.2
OpenGL: GeForce GT 420/PCI/SSE2 version 4.0.0, NVIDIA Corporation
java.lang.NullPointerException
at net.minecraft.src.BlockSaphire.idDropped(BlockSaphire.java:15)
at net.minecraft.src.Block.dropBlockAsItemWithChance(Block.java:671)
at net.minecraft.src.Block.dropBlockAsItem(Block.java:649)
at net.minecraft.src.Block.harvestBlock(Block.java:1039)
at net.minecraft.src.PlayerControllerSP.onPlayerDestroyBlock(PlayerControllerSP.java:64)
at net.minecraft.src.PlayerControllerSP.onPlayerDamageBlock(PlayerControllerSP.java:140)
at net.minecraft.client.Minecraft.sendClickBlockToController(Minecraft.java:1338)
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1844)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:870)
at net.minecraft.client.Minecraft.run(Minecraft.java:801)
at java.lang.Thread.run(Unknown Source)
--- END ERROR REPORT d887993 ----------
Script
package net.minecraft.src;
import java.util.Random;
public class BlockSaphire extends Block
{
EntityPlayer entityplayer;
protected BlockSaphire(int i, int j)
{
super(i,j,Material.rock);
}
public int idDropped(int i, Random random, int j)
{
if (entityplayer.getCurrentEquippedItem() != null && entityplayer.getCurrentEquippedItem().itemID == Item.pickaxeSteel.shiftedIndex)
{
return mod_Blocks.Saphire.blockID;
}
if (entityplayer.getCurrentEquippedItem() != null && entityplayer.getCurrentEquippedItem().itemID == Item.pickaxeDiamond.shiftedIndex)
{
return mod_Blocks.Saphire.blockID;
}
else
{
return 0;
}
}
public int quantityDropped(Random random)
{
return 1;
}
public String Version()
{
return "3.14159265";
}
}
Will some body please help, this has been driving me nuts for the past week!
i have done literally every thing i can with my very small knowledge of java codeing
First of all, lets look at the error.
--- BEGIN ERROR REPORT 8845ff11 --------
Generated 7/23/12 10:25 PM
Minecraft: Minecraft 1.2.5
OS: Windows 7 (amd64) version 6.1
Java: 1.7.0_04, Oracle Corporation
VM: Java HotSpot™ 64-Bit Server VM (mixed mode), Oracle Corporation
LWJGL: 2.4.2
OpenGL: GeForce GT 420/PCI/SSE2 version 4.0.0, NVIDIA Corporation
java.lang.NullPointerException
at net.minecraft.src.BlockSaphire.idDropped(BlockSaphire.java:15)
at net.minecraft.src.Block.dropBlockAsItemWithChance(Block.java:671)
at net.minecraft.src.Block.dropBlockAsItem(Block.java:649)
at net.minecraft.src.Block.harvestBlock(Block.java:1039)
at net.minecraft.src.PlayerControllerSP.onPlayerDestroyBlock(PlayerControllerSP.java:64)
at net.minecraft.src.PlayerControllerSP.onPlayerDamageBlock(PlayerControllerSP.java:140)
at net.minecraft.client.Minecraft.sendClickBlockToController(Minecraft.java:1338)
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1844)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:870)
at net.minecraft.client.Minecraft.run(Minecraft.java:801)
at java.lang.Thread.run(Unknown Source)
--- END ERROR REPORT d887993 ----------
I've highlighted the important parts
Lets have a look shall we?
First, the green. (The exception.) This is very important, it tells us
essentially what went wrong. In this case, a NullPointer. Meaning, a
pointer which doesnt exist. Which, in simple terms, means you're accessing
something that doesnt exist.
Now, the Red is the only line that has your code in there . (Block.Saphire)
And since Minecraft's code runs without error, unless you tampered with
it, we can assume your problem is located here.
The Blue, is what caused the thing that triggered the error. Not the cause
itself. The blue , in this case, is what happened before the error, that made
the error happen.
EDIT - SO YA, I WAS OFF. I SHOULD PROBABLY GO STRAIGHT TO BED
BUT HEY, ATLEAST THE FIRST BIT MIGHT BE A BIT EDUCATIONAL SHOULD
YOU NOT KNOW HOW TO READ ERROR LOGS
cheers
Try changing the following
to
Hopefully that'll help.
I think it's time for sleepy times..
Either way, thanks for pointing that out
I'm sure I would have just left the op terribly confused
And er, well it was declared, but not initialized .
Replace
public class BlockSaphire extends Block
{
EntityPlayer entityplayer;
With
public class BlockSaphire extends Block
{
EntityPlayer entityplayer = ModLoader.getMinecraftInstance().thePlayer;;
Its not necessary but it'll keep your code cleaner and less-buggy.
Cheers
Error:
Mods loaded: 3
ModLoader 1.2.5
mod_Blocks WorldCraft Blocks V1 - MC 1.2.5
mod_DimensionAPI 1.5 for MC 1.2.5
Minecraft has crashed!
----------------------
Minecraft has stopped running because it encountered a problem.
--- BEGIN ERROR REPORT 8845ff11 --------
Generated 7/24/12 9:13 AM
Minecraft: Minecraft 1.2.5
OS: Windows 7 (amd64) version 6.1
Java: 1.7.0_04, Oracle Corporation
VM: Java HotSpot™ 64-Bit Server VM (mixed mode), Oracle Corporation
LWJGL: 2.4.2
OpenGL: GeForce GT 420/PCI/SSE2 version 4.0.0, NVIDIA Corporation
java.lang.NullPointerException
at net.minecraft.src.BlockSaphire.idDropped(BlockSaphire.java:15)
at net.minecraft.src.Block.dropBlockAsItemWithChance(Block.java:671)
at net.minecraft.src.Block.dropBlockAsItem(Block.java:649)
at net.minecraft.src.Block.harvestBlock(Block.java:1039)
at net.minecraft.src.PlayerControllerSP.onPlayerDestroyBlock(PlayerControllerSP.java:64)
at net.minecraft.src.PlayerControllerSP.onPlayerDamageBlock(PlayerControllerSP.java:140)
at net.minecraft.client.Minecraft.sendClickBlockToController(Minecraft.java:1338)
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1844)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:870)
at net.minecraft.client.Minecraft.run(Minecraft.java:801)
at java.lang.Thread.run(Unknown Source)
--- END ERROR REPORT b358f006 ----------
Script:
package net.minecraft.src;
import java.util.Random;
public class BlockSaphire extends Block
{
EntityPlayer entityplayer = ModLoader.getMinecraftInstance().thePlayer;
protected BlockSaphire(int i, int j)
{
super(i,j,Material.rock);
}
public int idDropped(int i, Random random, int j)
{
if (entityplayer.getCurrentEquippedItem() != null && entityplayer.getCurrentEquippedItem().itemID == Item.pickaxeSteel.shiftedIndex)
{
return mod_Blocks.Saphire.blockID;
}
if (entityplayer.getCurrentEquippedItem() != null && entityplayer.getCurrentEquippedItem().itemID == Item.pickaxeDiamond.shiftedIndex)
{
return mod_Blocks.Saphire.blockID;
}
else
{
return 0;
}
}
public int quantityDropped(Random random)
{
return 1;
}
public String Version()
{
return "3.14159265";
}
}
doesn't this throw a null pointer anyway?
Why not just place it inside a Try/Catch?
sorry a what now? Im just a beginner to java this is literary my first mod from scratch
Thanks, ill try and understand what it is ill send you a message or a post saying weather or not it work, or if i still need help
Hah yeah i caught that too, just didn't think to mention it
its supposed to be saphire not sapphire, my mod my words >_>
Edit: on second thought, look at BlockDeadBush instead, it's less complicated than BlockLeaves.
You are a life saver! thanks to the dead bush you can now mine it without crashing!, but now the issue is you can still mine it with any pick, but for one of the ores thats fine, you deserve a
Glad I could help If you remove this part:
Then it won't drop anything unless the player was using the pickaxes you check for.
found that out 15 mins after posting the other comment