Jump to content

(Solved!) How should I make custom TNT?


DanielD34

Recommended Posts

I'm trying to make a really nice Minecraft 1.10 mod, and I'd like to give it some TNT, some that explode lava everywhere, and some that simply have bigger blast radii. How should I write the classes for the unprimed and primed versions of these? I already have basic coding knowledge and some textures.

 

Update: Thank you guys for making my modding easier! Sorry if some of my posts were rude before I fixed them; this was my first time on any forum.

Link to comment
Share on other sites

Check out BlockTNT.java and go from there. For making the one that shoots lava everywhere, try having it spawn falling blocks with the block set to lava, and having those blocks spawn just before the explosion to have them actually go everywhere.

I'm eager to learn and am prone to mistakes. Don't hesitate to tell me how I can improve.

Link to comment
Share on other sites

Check out BlockTNT.java and go from there. For making the one that shoots lava everywhere, try having it spawn falling blocks with the block set to lava, and having those blocks spawn just before the explosion to have them actually go everywhere.

How do I do that? While I do have basic knowledge of Java, I'm still fairly new to modding and don't wanna mess anything up with the game's code. Also, I use Eclipse if this helps you find a good response.
Link to comment
Share on other sites

and don't wanna mess anything up with the game's code

 

You can't. Literally.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

I think the book Minecraft Modding With Forge contains information about a custom TNT. I am not sure though. I know you need a TNT block class, a TileEntityTNT, a PrimedTNT entity, and something else I can't quite remember...

I don't feel like paying money for a book about modding, but thanks for the suggestion.

Check out BlockTNT.java and go from there. For making the one that shoots lava everywhere, try having it spawn falling blocks with the block set to lava, and having those blocks spawn just before the explosion to have them actually go everywhere.

Thanks for the tip, but how do I get into that TNT class?

and don't wanna mess anything up with the game's code

 

You can't. Literally.

Thanks. I should've known.
Link to comment
Share on other sites

Now, how do I get into that TNT class?

 

In Eclipse, under the Package Explorer, there should be a "folder" called Referenced Libraries (there might not be, in which case skip this).  Inside that will be a file called "forgeSrc-[mc version]-[forge version].jar"

 

You will be able to open up that jar file and brows the MC source code.  TNT will be down under:

- net.minecraft.blocks

- net.minecraft.entities

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Now, how do I get into that TNT class?

 

In Eclipse, under the Package Explorer, there should be a "folder" called Referenced Libraries (there might not be, in which case skip this).  Inside that will be a file called "forgeSrc-[mc version]-[forge version].jar"

 

You will be able to open up that jar file and brows the MC source code.  TNT will be down under:

- net.minecraft.blocks

- net.minecraft.entities

Thank you so much! That'll make modding SO much faster and easier!

Check out BlockTNT.java and go from there. For making the one that shoots lava everywhere, try having it spawn falling blocks with the block set to lava, and having those blocks spawn just before the explosion to have them actually go everywhere.

I'll keep that in mind. You both have my thanks.
Link to comment
Share on other sites

Now, how do I get into that TNT class?

In a tool as versatile as Eclipse-J, there's more than one way to move around. In the future, if you can't remember where to look for something (or can't guess which package you need even after remembering the lib), then try throwing a spurious declaration into a method in any class you're editing. Write something like: BlockTNT tnt;

 

At that point, Eclipse will underline BlockTNT, and hovering will raise a complaint that it's unresolved. Right-clicking then should offer you the option of importing the class from Minecraft (NB: A handful of classes, like "Block", have very common names, so you may be offered imports from weird places that are almost always not what you want, and you won't have their source code anyway). Once you do that, then you can select it and hit F3 to open it in a new tab. Then delete your spurious declaration and type ctrl-shift-o to fix your imports.

 

Once you get into even one vanilla java file near what you want to use or imitate, then you can select things in it and use F3 to open more files. You may also ask eclipse to show any of those classes to you in the package explorer, which will expand whatever package you need wherever it is. In that package you may see other classes that could be instructive.

 

And then there's "show references", which can show you how something is used.

 

General take away lesson: An IDE is a powerful tool. Learn its features and use them.

 

PS: For vanilla source to show up, one must have setup a decomp workspace. The dev workspace doesn't include the vanilla source. It doesn't seem to be as much of a problem as it was a few years ago, but there may still be some necrotic "how-to" articles on the web telling noobs to setup the dev workspace.

 

 

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

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.