Hey guys, in Volume 2, #3 -- Main Class, at this step it says to do this:
"Anyways, to set these initializations up, we need to create a few methods. A method is essentially a block of code where code gets run. Methods can be called by other methods, to actually get the code to be run. These initialization methods look like this, and go inside the class brackets:"
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event)
{
}
@Mod.EventHandler
public void init(FMLInitializationEvent event)
{
}
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent event)
{
}
Where the hell am I typing this in? It doesn't give any suggestion of what a class bracket is and where it is!
Hey guys, in Volume 2, #3 -- Main Class, at this step it says to do this:
"Anyways, to set these initializations up, we need to create a few methods. A method is essentially a block of code where code gets run. Methods can be called by other methods, to actually get the code to be run. These initialization methods look like this, and go inside the class brackets:"
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event)
{
}
@Mod.EventHandler
public void init(FMLInitializationEvent event)
{
}
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent event)
{
}
Where the hell am I typing this in? It doesn't give any suggestion of what a class bracket is and where it is!
Sorry for the problem spam guys, this is all just confusingly explained. It says this in Volume 2 #4:
Now, if you load up the game, you’ll notice your item does not appear in the tab. Even though we’ve written all of this code, none of it gets run because it is not being called in the main class. This point is something every beginner struggles with (and I even forget about calling things as well!). Jump into your main class, and inside the #preInit method, add this line of code:
ModItems.registerItems();
Now, if you run the game, your Item should appear in the tab, but it won’t have a texture - let’s fix that.
Did I miss a section where I had to link my eclipse file with my game? It doesn't seem to be showing up ingame...
In your ModItems.clas you should have this import:
import items.MyItem;
and this line NOT inside a method:
private Item myitem = new MyItem("myitemname", ToolMaterial.MyMaterial);
and this code in this method:
public void registerItems()
{
GameRegistry.registerItem(myitem, "myitemname");
}
That should be the correct layout, if there are any red lines hover over that thing and look at it's quick fix options, odds are one of those will fix the problem for you.
Ok, so for starting minecraft, should I be on my forge account? My regular account works, but my forge starts up but crashes before the Mojang screen...
The Meaning of Life, the Universe, and Everything.
Join Date:
9/24/2011
Posts:
270
Minecraft:
TheMysticalBard
Member Details
I am having a problem with the imports for the 1.7 tutorial #3, and was wondering what import to use for Reference in LogHelper? I tried all of the ones Eclipse listed but none of them have NAME specified. Thanks in advance!
Hey guys, in Volume 2, #3 -- Main Class, at this step it says to do this:
"Anyways, to set these initializations up, we need to create a few methods. A method is essentially a block of code where code gets run. Methods can be called by other methods, to actually get the code to be run. These initialization methods look like this, and go inside the class brackets:"
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event)
{
}
@Mod.EventHandler
public void init(FMLInitializationEvent event)
{
}
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent event)
{
}
Where the hell am I typing this in? It doesn't give any suggestion of what a class bracket is and where it is!
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumYou could have understood it if you knew what a
1. bracket and
2. class was.
http://pastebin.com/5uAX67Qf
Sorry for the problem spam guys, this is all just confusingly explained. It says this in Volume 2 #4:
Now, if you load up the game, you’ll notice your item does not appear in the tab. Even though we’ve written all of this code, none of it gets run because it is not being called in the main class. This point is something every beginner struggles with (and I even forget about calling things as well!). Jump into your main class, and inside the #preInit method, add this line of code:
ModItems.registerItems();
Now, if you run the game, your Item should appear in the tab, but it won’t have a texture - let’s fix that.
Did I miss a section where I had to link my eclipse file with my game? It doesn't seem to be showing up ingame...
-
View User Profile
-
View Posts
-
Send Message
Curse Premiumdid you set the creative tab?
before registering did you set Item myitem = new MyItem();?
did you import MyItem?
if you are missing any of those you will not see it. Actually it shouldn't even run without the second two.
Edit: the second two should take place inside your ModItems.class file.
Current Mod: Armerger | Light Drafter
So what exactly do I type where, and where would my item show up in game. (specific spot in creative inventory)
Also thanks for all of the help
-
View User Profile
-
View Posts
-
Send Message
Curse Premiumin your MyItem.class you should have a method that looks like this:
public MyItem(String name, ToolMaterial material)
{
setCreativeTab(CreativeTabs.<choose applicable tab>);
... more stuff
}
In your ModItems.clas you should have this import:
import items.MyItem;
and this line NOT inside a method:
private Item myitem = new MyItem("myitemname", ToolMaterial.MyMaterial);
and this code in this method:
public void registerItems()
{
GameRegistry.registerItem(myitem, "myitemname");
}
That should be the correct layout, if there are any red lines hover over that thing and look at it's quick fix options, odds are one of those will fix the problem for you.
Current Mod: Armerger | Light Drafter
None of those seem to be in the instructions... Im also confused on a few class files you're talking about. Here are some photos of my folders:
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumYou posted your Mystica class twice and not your ModItems class or your ItemMystica class.
You need to add an import for you ModItems class in your Mystica class(ctrl+shift+o should take care of that)
In your ModItems class you need to import both the RegistryHelper class and the ItemMystica class
Somewhere in ModItems(not inside a method) you should have something that looks like
private static Item itemmystica = newItemMystica(...);
In the registerItems() method of ModItems you should have a line like this:
RegistryHelper.registerItem(itemmystica);
In the public ItemMystica(...) method of the ItemMystica class you should have a line like this
this.setCreativeTab(CreativeTabs.<tab you want it to show in>);
If there are any red lines left under a method call(something.something) hit (ctrl+shift+o) while in that file
Edit: same thing for red lines under variable types ( Block block )
Current Mod: Armerger | Light Drafter
Here are the rest of the images:
Also what do I fill in for when you say (...)? Do i type the .. or leave it blank?
Thanks for your ongoing help
Ok, so for starting minecraft, should I be on my forge account? My regular account works, but my forge starts up but crashes before the Mojang screen...
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumOk, you have it set up slightly different than I normally do.
you can take the setCreativeTab method call out of the ItemMystica class and add it to the end of the line that has
public static Item dust = (stuff you have).setCreativeTab(CreativeTab.tabMisc);
you can leave the ... part as blank I put that there because I didn't know if your ItemMystica required anything to be passed to it.
It also doesn't seem like the imports are getting added.
Try right clicking on anything with a red line beneath it and there should be a quick fix option to add import.
Current Mod: Armerger | Light Drafter
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumI don't think he knows what importing is.
Plus, what the hell is a Forge account?
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumForge creates a generic user and doesn't actually connect to the minecraft user data base. You shouldn't need to do anything for the account.
can you post the information that shows up in your console?(make sure you post it in a spoiler or on pastebin)
Current Mod: Armerger | Light Drafter
Thank you SO much!
it worked perfectly, and I will now be able to keep working on my mod!
I think he means his forge profile in the launcher.
and please don't cuss
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumGlad I could help!
Current Mod: Armerger | Light Drafter
I am having a problem with the imports for the 1.7 tutorial #3, and was wondering what import to use for Reference in LogHelper? I tried all of the ones Eclipse listed but none of them have NAME specified. Thanks in advance!
http://strt.cc/?ref=ZGVhdGhseWFuZ2VsNDdAZ21haWwuY29t
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumThe file you import to use "Reference.NAME" is the file you made that has your NAME, MODID, VERSION variables in it.
Current Mod: Armerger | Light Drafter
Ah, this is my fault, I followed another tutorial for setup so I skipped the first two tutorials, thanks for the reply!
http://strt.cc/?ref=ZGVhdGhseWFuZ2VsNDdAZ21haWwuY29t
-
View User Profile
-
View Posts
-
Send Message
Curse Premium"Hell" isn't a swear word. Hence it's not censored.