Jump to content

Recommended Posts

Posted

Big image warning, ~1080p

 

GWVqJ.jpg

 

Hey guys, I've been following MrCrayfish's modding tutorial (awesome for beginners) and upon completing all but the armor and compiling episodes I had a question. If you look at the picture in the spoiler above, you will see that in the variable definition section...

	
public static Item itemThing;
public static Block blockThing;
public static Item itemThingSoup;
public static Item itemBurntSoup;
public static Item thingSpear;
public static Item itemSpearHead;

I have added 1 Block and 5 Items to a fairly useless mod intended to get me into modding.

 

However, if you look at the package explorer on the left side, there are only three classes, which is a bit puzzling to me because nothing is significantly different between those with classes and those without.

 

I'm new to java so please be patient with me, but is there a way to easily generate classes for all my blocks and items? I tried doing it manually which didn't change my in-game item whatsoever. Sorry if I left anything important out, I'm thoroughly confused.

 

Feel free to ask if you need more info. Also, did I do this wrong or did I just leave out a step?

Posted

I am not being rude here, but this forum is not for Java-begginers. You have lack of exp with Java, not just modding.

 

Short response:

 

Class is just a "structure" which you can use to define new Objects (Item) that will use this class as a template.

Simpliest way I can explain. Please before getting into moddin you need to understand how objects work in Java and most basic concepts.

1.7.10 is no longer supported by forge, you are on your own.

Posted

Okay the most important rule in programming is that you need to look very carefully to ensure things are EXACTLY the same as you expect.

 

If you look at your package explorer, it has BlockThing with a capital "B" and capital "T" but in the code that you circled it is blockThing only with capital "T".  So from a programming perspective those are not the same thing, even if you maybe wanted them to be.  Computer compilers are very literal -- even one little difference will have a different meeting.

 

Based on your question, I have to suggest you need to learn some general Java programming first before you do Minecraft modding.  I suggest getting a book called Java in Easy Steps as it is a book that can get you started on the main ideas of the programming language.

 

Back to your specific question, in the code you circled at the right, you are basically "declaring" some fields to represent blocks and items.  However, in that circled part at the top they are not actually set to anything because they are not initialized -- you need to assign them to a new instance of an appropriate class.  The initialization comes down below where you have the = new ItemThing() and stuff.  So that part is okay.

 

Now you asked why the number of items/blocks doesn't match.  Well if you look at where you assign the new instances, for things like ItemThingSoup you are making it a new ItemFood.  ItemFood is a vanilla class so you don't need it in your own source.

 

Depending on the way the classes are written, you may or may not be able to create more variations than classes.  Like with ItemFood, you only need one ItemFood class but can make lots of different food items by changing the values you pass in the constructor and changing the texture name and such.

 

You only need to create a new class if your functionality is different such that you can't use the customizations provided.

 

But basically what you're asking about is basic Java programming and so you should take some time to read about that before trying to do much more modding.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted
items.png

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.

Posted

So I'm gonna learn some basic java (again) but I have some quick questions. My brain learns better by doing and actually modding got me farther than any previous attempt at learning java did. As stupid as my mod is, I'm still rather proud that I did it within about 3 hours total on my first real attempt.

So my question is, can anyone suggest a java course online thats free? Is there anything like codecademy for java? Also how far should I go in the course? Thanks sorry if I've been an annoyance

Posted

[lmgtfy]java tutorial[/lmgtfy]

larsgerrits with those "lmgtfy"s! Always fun with those :D

I'm back from being gone for... I think its been about a year. I'm pretty sure nobody remembers me, but hello anybody who does!

Posted

[lmgtfy]java tutorial[/lmgtfy]

larsgerrits with those "lmgtfy"s! Always fun with those :D

Yeah, I do that when people ask on this forum for stuff which you can find in 2 seconds on google...

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

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.