Awesome tutorial! Noticed a lot of things that I could do better in my own code, thanks for this. However I noticed that you never delete the entity out of the world by calling func_395_F() (which is in the entity class). Without calling it I think (I could be wrong) the entity stays in the world whether it is active or not. This will also allow you to not have to check to see whether it has exploded or not as the entity will be gone.
Thanks again,
Quatham
The explosion from itself should kill it though it might not but yeah that function deletes it and using it in the next tutorial.
Quote from zlyfire »
any chance of you showing us how to make a stronger grenade? so we can have a grenade and a Holy Hand Grenade?
And getting it so we can make an item texture and tell it to use that instead of a premade texture?
In the explode function the last argument to createExplosion is the force. TNT uses 4 while I have the grenades using 2. To use your own item texture you can edit the item.png and change your index to where you placed it in there. I will look at writing that up in the next tutorial.
Rollback Post to RevisionRollBack
You're a lone commando tasked to destroy the Nazi Zombie Federation's dam.
Haha I just made the grenade explode with 10F force. NEVER do this with MiningTNT mod installed :biggrin.gif: The number of blocks lying around made my java crash
I don't think the explosion actually kills it. If you look at EntityTNTPrimed it calls the explosion then deletes itself. So I don't know but anyway awesome tutorial again!
I modify code in EntityGrenade, so you can change explosion power at visual:
private void explode() {
float f = 2F; // Power of detonation (2 is 50% of normal TNT)
if(!exploded) {
exploded = true;
worldObj_11.createExplosion(null, posX, posY, posZ, f);
}
}
Next, i changed Explosion.java file at sample of code at "if(l4 > 0)" block:
From:
This code call block "fire_01" to any block, which was covered by explosion. Positive effect: No slow fps from dropped blocks. Negative: all dropped blocks will be ignited and burned. But, if you have fast computer, you can test power of explosion up to 100+ (at 512f (hic! its Nuke! ) my computer is freeze).
If you want more fun - you can modify "BlockFire.java" file. For example i add this string to file
setBurnRate(Block.sand_00.blockID, 1024, 4096);
and sand were able to ignite.
1st argument (1024)- how fast fire moving from one block to another; {IMHO}
2nd argument (4096) - how fast block was burned. {IMHO}
Now you can see this wall of text in action:
Rollback Post to RevisionRollBack
Beauty and the carpet bombing will save the world. ^^
Hmm. I get the same error as Zaraza107 when trying to recompile Start2.java. Same with the jump block :sad.gif:. Could you perhaps make a video tutorial on how to get them working :biggrin.gif:. I'm sure I'm missing something obvious, but just can't see it :sad.gif:
hey so this looks really cool but i dont know mcp is and i dont know java (yet) so can you make a video tut based on your written tut on this page? thanks
I cant seem to be able to compile the Start2.java file
it says i cannot find the ItemGrenade Symbol.
Rollback Post to RevisionRollBack
Everyone is entitled to their own opinion, an opinion cant be awful. Its an opinion. Its your opinion that his opinion is awful.
- A Knowledgeable Poster
I cant seem to be able to compile the Start2.java file
it says i cannot find the ItemGrenade Symbol.
This is due to when you used "recompile.bat" it did not compile correctly, looking at the "mcp\logs\minecraft_compile.log" and searching for the name of the modded block/item/entity will help find the problem.
I did all of the tutorial correctly, all of the code except I changed the iron ingots to sticks and the gunpowder to coal. I ran it as Start and it worked fine, but it didn't craft (this was expected). When I configured it to run start2 (with all the correct code), it said:
Exception in thread "main" java.lang.ExceptionInInitializerError
at net.minecraft.src.StatList.<clinit>(StatList.java:230)
at net.minecraft.src.Block.<clinit>(Block.java:831)
at net.minecraft.src.ItemSpade.<clinit>(ItemSpade.java:33)
at net.minecraft.src.Item.<clinit>(Item.java:334)
at Start2.main(Start2.java:13)
Caused by: java.lang.NullPointerException
at net.minecraft.src.ItemStack.<init>(ItemStack.java:32)
at net.minecraft.src.Achievement.<init>(Achievement.java:18)
at net.minecraft.src.AchievementList.<clinit>(AchievementList.java:53)
... 5 more
The explosion from itself should kill it though it might not but yeah that function deletes it and using it in the next tutorial.
In the explode function the last argument to createExplosion is the force. TNT uses 4 while I have the grenades using 2. To use your own item texture you can edit the item.png and change your index to where you placed it in there. I will look at writing that up in the next tutorial.
I don't think the explosion actually kills it. If you look at EntityTNTPrimed it calls the explosion then deletes itself. So I don't know but anyway awesome tutorial again!
Next, i changed Explosion.java file at sample of code at "if(l4 > 0)" block:
From:
To code:
This code call block "fire_01" to any block, which was covered by explosion. Positive effect: No slow fps from dropped blocks. Negative: all dropped blocks will be ignited and burned. But, if you have fast computer, you can test power of explosion up to 100+ (at 512f (hic! its Nuke! ) my computer is freeze).
If you want more fun - you can modify "BlockFire.java" file. For example i add this string to file
and sand were able to ignite.
1st argument (1024)- how fast fire moving from one block to another; {IMHO}
2nd argument (4096) - how fast block was burned. {IMHO}
Now you can see this wall of text in action:
Other than that, great tutorial. I already had grenades but used your code to add bounce to em.
My anvil mechanics tutorial: http://www.minecraftforum.net/topic/1524823-anvil-mechanics-in-depth/
it says i cannot find the ItemGrenade Symbol.
- A Knowledgeable Poster
This is due to when you used "recompile.bat" it did not compile correctly, looking at the "mcp\logs\minecraft_compile.log" and searching for the name of the modded block/item/entity will help find the problem.
Exception in thread "main" java.lang.ExceptionInInitializerError
at net.minecraft.src.StatList.<clinit>(StatList.java:230)
at net.minecraft.src.Block.<clinit>(Block.java:831)
at net.minecraft.src.ItemSpade.<clinit>(ItemSpade.java:33)
at net.minecraft.src.Item.<clinit>(Item.java:334)
at Start2.main(Start2.java:13)
Caused by: java.lang.NullPointerException
at net.minecraft.src.ItemStack.<init>(ItemStack.java:32)
at net.minecraft.src.Achievement.<init>(Achievement.java:18)
at net.minecraft.src.AchievementList.<clinit>(AchievementList.java:53)
... 5 more
What do I do?