Hey DNORTH, After attempting to launch the startclient.bat, I am encountering a new error involving the png file for my new items. Did they change the method for overriding the textures?
Hey DNORTH, After attempting to launch the startclient.bat, I am encountering a new error involving the png file for my new items. Did they change the method for overriding the textures?
I would have to see the error, but I am using a different override since the last time I coded.
Example:
(all one line)
public static final Item cotton = (new Item(8276)).setItemName("cotton").setIconIndex(ModLoader.addOverride("/gui/items.png", "/Vegetation/cotton.png"));
A block would be /terrain.png instead of /gui/items.png
I'm thinking it's something to do with the texture being in there. the block you use only has 1 int in it I believe, which would be the Block ID. I've never done textures the way you're doing it, so I don't know if that's entirely true.
Also, When I get time, I'll redo every tutorial and make sure everything is fixed. I knew about the AddRecipe to addRecipe thing, but forgot to change that in the tutorial.
The Meaning of Life, the Universe, and Everything.
Join Date:
5/28/2012
Posts:
95
Member Details
Thank you Muserae for this excellent tutorial, it really does help to have these great resources and shows the warmth of the community when people go out of their way for the benefit of others. However, i tried copying and pasting your mod template into my eclipse and it immediately gave me errors with the red underlined static keyword in the below code. Please help lol, I am nowhere near the best coder. Thanks~
Thanks for the help Muserae, but I changed where the textures fit in, and it didn't work. Then I did a complete overhaul of my entire code, and I still get one error per flower I try to add. Let me know when you fix the flower code, and I will take a look at it
in the static method, that's where you'd put like
pencil = new ItemPencil etc etc, but ignore it. Give me a few hours and I'll have it fixed, and the template will be a lot easier imo. Instead of it being sorted by recipe, texture, etc, it'll be sorted by item and block
The Meaning of Life, the Universe, and Everything.
Join Date:
5/28/2012
Posts:
95
Member Details
Seriously, thanks a lot lol. Believe me, when I get my mod working, you guys will be the first to get a beta copy. And if you're into thaumcraft or stuff like that, you'll like it.
I eagerly await your update Muserae! Lemme know if you need anything tested. =D As far as topics go, I say do a new one, and link to the old one so people can see the Q's asked. I'd also recommend reserving several post spaces, so you can add all the tutorials to the beginning.
its me again with an update. i got my mod working. it turns out, the video i watched AND your code for generation are outdated. in 1.2.3 they changed GenerateSurface to generateSurface. with a lowercase G. hope this helps anyone who had problems with it. just comes to show how a single off letter can make a HUGE difference.
SINGLE GENERATION
public void generateSurface(World world, Random rand, int chunkX, int chunkZ)
{
for (int i=0; i < HOW_RARE; i++)
{
int randPosX = chunkX + rand.nextInt(VEIN_SIZE);
int randPosY = rand.nextInt(VEIN_HEIGHT);
int randPosZ = chunkZ + rand.nextInt(VEIN_SIZE);
(new WorldGenMinable(yourblock.blockID, VEIN_MAX_SIZE)).generate(world, rand, randPosX, randPosY, randPosZ);
}
}
MULTIPLE
//begin first
public void generateSurface(World world, Random rand, int chunkX, int chunkZ)
{
for (int i=0; i < HOW_RARE; i++)
{
int randPosX = chunkX + rand.nextInt(VEIN_SIZE);
int randPosY = rand.nextInt(VEIN_HEIGHT);
int randPosZ = chunkZ + rand.nextInt(VEIN_SIZE);
(new WorldGenMinable(yourblock.blockID, VEIN_MAX_SIZE)).generate(world, rand, randPosX, randPosY, randPosZ);
//end first.
//begin second
}
for (int i=0; i < HOW_RARE; i++)
{
int randPosX = chunkX + rand.nextInt(VEIN_SIZE);
int randPosY = rand.nextInt(VEIN_HEIGHT);
int randPosZ = chunkZ + rand.nextInt(VEIN_SIZE);
(new WorldGenMinable(yourblock.blockID, VEIN_MAX_SIZE)).generate(world, rand, randPosX, randPosY, randPosZ);
}
}
//end second
it would be good to also update your code on the Original Post muserae thanks for all the help youve given me with these tutorials
Seriously, thanks a lot lol. Believe me, when I get my mod working, you guys will be the first to get a beta copy. And if you're into thaumcraft or stuff like that, you'll like it.
Sweet
Send me a link to the thread when you set it up and I'll take a look
I eagerly await your update Muserae! Lemme know if you need anything tested. =D
I'm working on updating them right now. I think I have most of the day, if not all, free so I can get a lot done. There's a spam filter now so I can't just spam reserved posts. That's when mod powers come into play \o/
The topic is locked for now, but I'll unlock it once I get the tutorials fixed.
If you want, could you check and make sure I'm making the codes right? I don't really have the time to check if they work in game if I want to get all of these finished. I'm just checking to make sure there aren't any errors.
I just figured this out myself. You may want to mention that the folder for new images needs to go inside the minecraft.jar. The path is "mcp/jars/bin/minecraft.jar". Then just drag and drop your folder of .pngs into it.
I just figured this out myself. You may want to mention that the folder for new images needs to go inside the minecraft.jar. The path is "mcp/jars/bin/minecraft.jar". Then just drag and drop your folder of .pngs into it.
if your coding in eclipse you can run the client in it by putting them in eclipse/yourmodname/bin(i think if not then minecraft then bin)/your image here
so i have this gui code, how do i open it/code it to open with a key press?
package net.minecraft.src;
import org.lwjgl.opengl.GL11;
public class TimelapseGUI extends GuiScreen
{
int x = (width - 176 ) / 2;
int y = (height - 166) / 2;
private static String backgroundImg;
public TimelapseGUI()
{
super();
//Calls which image to display
backgroundImg = "/Folder/GuiImage.png";
}
//If false, won't pause the game when the GUI is open.
//If true, it will pause the game when open.
public boolean doesGuiPauseGame()
{
return false;
}
//When the GUI closes, x happens
public void onGuiClosed(){}
//This is where you put buttons
public void initGui()
{
controlList.clear();
}
//This is where buttons are told what to do when clicked
protected void actionPerformed(GuiButton guibutton)
{
}
//This is where it says what text and image to use
public void drawScreen(int i, int j, float f)
{
drawDefaultBackground();
try
{
int pic = mc.renderEngine.getTexture(backgroundImg);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture(pic);
drawTexturedModalRect(x, y, 0, 0, 176, 166);
}
finally
{
}
//This adds the text to the game. It will add whatever is within the " "
//width / 2 is the width location, height / 2 is the height location, and 0xffffff is the text color.
//If you wanted it centered, change drawString to drawCenteredString
drawString(fontRenderer, "GUI Open", (width / 2, height / 2 , 0xffffff);
super.drawScreen(i, j, f);
}
}
Ok, so far I've worked through the first Block example. For the mod_Tutorial file, it needs the
public String getVersion()
{
return "Tutorial Mod v1";
}
public void load()
{
}
added to the end of it for the file to work properly. Not sure if it was intentional for you to leave it off or not.
As for the BlockTutorial.java file, it worked like a charm. There are a few places where the indentation is not even, leaving a potential for confusion.
Speaking of charm, would you like me to throw together some tutorial textures for these? Then you can offer up a folder of png files to go with the tutorials, saving your followers the effort.
Also a Question for you Muserae, why do you use just "public static Block/Item Name = Blah" rather than "public static final Block/Item Name = Blahblah" ?
==============================================
Item tutorial complete. No errors of any sort.
Since you use the same name "tutorial" for the item tutorial AND the block tutorial, they both cannot be combined in the same mod. If I may humbly suggest, perhaps you might consider changing it to "tutorialblock" in the block tutorial, and "tutorialitem" in the item one? You could then follow up the second one with a blurp to show how to include multiple blocks/items in the same mod.
=============================================
Final Edit: Flower Tutorial
Complied fine, no errors. I would still suggest that "tutorial" name be changed to something else to allow the novice modder to include them all in the same mod without having to think for themselves.
so i have this gui code, how do i open it/code it to open with a key press?
I'll post my code, and I'll make a tutorial for it later. this will go in your mod_ file.
The code I have will allow you to push the button again to close the gui also. (without a part of the code there, you'd have to push esc to close the gui)
package net.minecraft.src;
import org.lwjgl.input.Keyboard;
import net.minecraft.client.Minecraft;
public class mod_PrecursorKeybind extends BaseMod
{
//the 46 is the button you have to push, here's a link to a keyboard with each key labeled
// http://i634.photobucket.com/albums/uu70/jik_ff/keyboardKEYnumbers.png
private KeyBinding key_statsGui = new KeyBinding("Character Stats", 46);
public static World world;
protected Minecraft mc;
public boolean charStatsShowing;
public mod_PrecursorKeybind()
{
mc = ModLoader.getMinecraftInstance();
ModLoader.registerKey(this, this.key_statsGui, false);
//addLocalization adds it to the controls option
ModLoader.addLocalization("Character Stats", "CharacterStats");
ModLoader.setInGameHook(this, true, false);
ModLoader.setInGUIHook(this, true, false);
}
public void keyboardEvent(KeyBinding keybinding)
{
isCharStat(keybinding);
}
public void isCharStat(KeyBinding keybinding)
{
if(keybinding == this.key_statsGui && charStatsShowing == true)
{
mc.displayGuiScreen(null);
charStatsShowing = false;
}
else if(keybinding == this.key_statsGui)
{
mc.displayGuiScreen(new PRGuiPlayerStats());
charStatsShowing = true;
}
}
public boolean statsGui;
public void KeyboardEvent(KeyBinding event)
{
if(event == this.key_statsGui)
{
mc.displayGuiScreen(new PRGuiPlayerStats());
ModLoader.getMinecraftInstance().displayGuiScreen(new PRGuiPlayerStats());
}
}
public String getVersion() {return "The Precursor v1";}
public void load(){}
}
1) Ya, I forgot to add the load and junk on the mod_ file. I'll do that after I post this
2) The tabs are deleted by the forums. I'm probably going to add a download to the java classes, that's the only way I can think of to keep the tabs there. Plus it'd actually be useful.
3) Tutorial textures would be great! That's my least favorite part about modding, making textures They don't have to be super detailed if you don't want to. PM me the images if you make them
4) public static Block and public static final Block are basically the same thing. The only difference, is final makes so it can't be changed. The reason I don't put final is because you can make a block onRightClick change hardness, for example.
5) I was going to do that when I was making the item tutorial, but I was too lazy xD
May 31, 2012 10:45:50 PM ModLoader init
FINE: ModLoader 1.2.5 Initializing...
May 31, 2012 10:45:50 PM ModLoader readFromClassPath
FINER: Adding mods from C:\Users\Mikael\AppData\Roaming\.minecraft\bin\minecraft.jar
May 31, 2012 10:45:50 PM ModLoader readFromClassPath
FINER: Zip found.
May 31, 2012 10:45:50 PM ModLoader readFromModFolder
FINER: Adding mods from C:\Users\Mikael\AppData\Roaming\.minecraft\mods\camerastudio
May 31, 2012 10:45:50 PM ModLoader readFromModFolder
FINER: Directory found.
May 31, 2012 10:45:50 PM ModLoader readFromModFolder
FINER: Adding mods from C:\Users\Mikael\AppData\Roaming\.minecraft\mods\sppcommands
May 31, 2012 10:45:50 PM ModLoader readFromModFolder
FINER: Directory found.
May 31, 2012 10:45:50 PM ModLoader readFromModFolder
FINER: Adding mods from C:\Users\Mikael\AppData\Roaming\.minecraft\mods\TimelapseGUI.zip
May 31, 2012 10:45:50 PM ModLoader readFromModFolder
FINER: Zip found.
May 31, 2012 10:45:50 PM ModLoader addMod
FINE: Failed to load mod from "mod_TimelapseGUI.class"
May 31, 2012 10:45:50 PM ModLoader addMod
FINER: THROW
java.lang.InstantiationException
at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at ModLoader.addMod(ModLoader.java:294)
at ModLoader.readFromModFolder(ModLoader.java:1276)
at ModLoader.init(ModLoader.java:887)
at ModLoader.addAllRenderers(ModLoader.java:189)
at ahu.<init>(ahu.java:77)
at ahu.<clinit>(ahu.java:8)
at net.minecraft.client.Minecraft.a(SourceFile:273)
at net.minecraft.client.Minecraft.run(SourceFile:657)
at java.lang.Thread.run(Unknown Source)
May 31, 2012 10:46:00 PM ModLoader addAllRenderers
FINE: Initialized
public mod_TimelapseGUI()
{
add
charStatsShowing = false;
If you meant this:
package net.minecraft.src;
import org.lwjgl.input.Keyboard;
import net.minecraft.client.Minecraft;
public abstract class mod_TimelapseGUI extends BaseMod
{
private KeyBinding key_GuiTimelapse = new KeyBinding("Timelapse GUI", 20);
public static World world;
protected Minecraft mc;
public boolean charStatsShowing;
public mod_TimelapseGUI()
{
mc = ModLoader.getMinecraftInstance();
charStatsShowing = false;
ModLoader.registerKey(this, this.key_GuiTimelapse, false);
//addLocalization adds it to the controls option
ModLoader.addLocalization("Timelapse GUI", "Timelapse GUI");
ModLoader.setInGameHook(this, true, false);
ModLoader.setInGUIHook(this, true, false);
}
public void isCharStat(KeyBinding keybinding)
{
if(keybinding == this.key_GuiTimelapse && charStatsShowing == true)
{
mc.displayGuiScreen(null);
}
else if(keybinding == this.key_GuiTimelapse)
{
mc.displayGuiScreen(new GuiTimelapse());
}
}
public void keyboardEvent(KeyBinding keybinding)
{
isCharStat(keybinding);
}
public boolean statsGui;
public void KeyboardEvent(KeyBinding event)
{
if(event == this.key_GuiTimelapse)
{
mc.displayGuiScreen(new GuiTimelapse());
ModLoader.getMinecraftInstance().displayGuiScreen(new GuiTimelapse());
}
}
public String getVersion() {
return "TimelapseGUI v1.0";
}
public boolean TimelapseGUI;
}
Well i got this:
Jun 01, 2012 12:39:56 AM ModLoader init
FINE: ModLoader 1.2.5 Initializing...
Jun 01, 2012 12:39:56 AM ModLoader readFromClassPath
FINER: Adding mods from C:\Users\Mikael\AppData\Roaming\.minecraft\bin\final_1.2.5_modloader.jar
Jun 01, 2012 12:39:56 AM ModLoader readFromClassPath
FINER: Zip found.
Jun 01, 2012 12:39:56 AM ModLoader readFromModFolder
FINER: Adding mods from C:\Users\Mikael\AppData\Roaming\.minecraft\mods\camerastudio
Jun 01, 2012 12:39:56 AM ModLoader readFromModFolder
FINER: Directory found.
Jun 01, 2012 12:39:56 AM ModLoader readFromModFolder
FINER: Adding mods from C:\Users\Mikael\AppData\Roaming\.minecraft\mods\sppcommands
Jun 01, 2012 12:39:56 AM ModLoader readFromModFolder
FINER: Directory found.
Jun 01, 2012 12:39:56 AM ModLoader readFromModFolder
FINER: Adding mods from C:\Users\Mikael\AppData\Roaming\.minecraft\mods\TimelapseGUI.zip
Jun 01, 2012 12:39:56 AM ModLoader readFromModFolder
FINER: Zip found.
Jun 01, 2012 12:39:56 AM ModLoader addMod
FINE: Failed to load mod from "mod_TimelapseGUI.class"
Jun 01, 2012 12:39:56 AM ModLoader addMod
FINER: THROW
java.lang.InstantiationException
at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at ModLoader.addMod(ModLoader.java:294)
at ModLoader.readFromModFolder(ModLoader.java:1276)
at ModLoader.init(ModLoader.java:887)
at ModLoader.addAllRenderers(ModLoader.java:189)
at ahu.<init>(ahu.java:77)
at ahu.<clinit>(ahu.java:8)
at net.minecraft.client.Minecraft.a(SourceFile:273)
at net.minecraft.client.Minecraft.run(SourceFile:657)
at java.lang.Thread.run(Unknown Source)
Jun 01, 2012 12:40:06 AM ModLoader addAllRenderers
FINE: Initialized
I would have to see the error, but I am using a different override since the last time I coded.
Example:
(all one line)
A block would be /terrain.png instead of /gui/items.png
I'm thinking it's something to do with the texture being in there. the block you use only has 1 int in it I believe, which would be the Block ID. I've never done textures the way you're doing it, so I don't know if that's entirely true.
Also, When I get time, I'll redo every tutorial and make sure everything is fixed. I knew about the AddRecipe to addRecipe thing, but forgot to change that in the tutorial.
in the static method, that's where you'd put like
pencil = new ItemPencil etc etc, but ignore it. Give me a few hours and I'll have it fixed, and the template will be a lot easier imo. Instead of it being sorted by recipe, texture, etc, it'll be sorted by item and block
I have a few hours, so I'll fix the flower code when I can. I'm going to do the main stuff first, then skip ahead to the flower.
SINGLE GENERATION
MULTIPLE
it would be good to also update your code on the Original Post muserae thanks for all the help youve given me with these tutorials
Sweet
Send me a link to the thread when you set it up and I'll take a look
I'm working on updating them right now. I think I have most of the day, if not all, free so I can get a lot done. There's a spam filter now so I can't just spam reserved posts. That's when mod powers come into play \o/
The topic is locked for now, but I'll unlock it once I get the tutorials fixed.
If you want, could you check and make sure I'm making the codes right? I don't really have the time to check if they work in game if I want to get all of these finished. I'm just checking to make sure there aren't any errors.
Thanks, I'm actually working on updating all of the tutorials. You finding this out makes it a lot easier on me when I get to this
if your coding in eclipse you can run the client in it by putting them in eclipse/yourmodname/bin(i think if not then minecraft then bin)/your image here
added to the end of it for the file to work properly. Not sure if it was intentional for you to leave it off or not.
As for the BlockTutorial.java file, it worked like a charm. There are a few places where the indentation is not even, leaving a potential for confusion.
Speaking of charm, would you like me to throw together some tutorial textures for these? Then you can offer up a folder of png files to go with the tutorials, saving your followers the effort.
reference link: http://www.minecraft...st__p__15292024
Also a Question for you Muserae, why do you use just "public static Block/Item Name = Blah" rather than "public static final Block/Item Name = Blahblah" ?
==============================================
Item tutorial complete. No errors of any sort.
Since you use the same name "tutorial" for the item tutorial AND the block tutorial, they both cannot be combined in the same mod. If I may humbly suggest, perhaps you might consider changing it to "tutorialblock" in the block tutorial, and "tutorialitem" in the item one? You could then follow up the second one with a blurp to show how to include multiple blocks/items in the same mod.
=============================================
Final Edit: Flower Tutorial
Complied fine, no errors. I would still suggest that "tutorial" name be changed to something else to allow the novice modder to include them all in the same mod without having to think for themselves.
I'll post my code, and I'll make a tutorial for it later. this will go in your mod_ file.
The code I have will allow you to push the button again to close the gui also. (without a part of the code there, you'd have to push esc to close the gui)
1) Ya, I forgot to add the load and junk on the mod_ file. I'll do that after I post this
2) The tabs are deleted by the forums. I'm probably going to add a download to the java classes, that's the only way I can think of to keep the tabs there. Plus it'd actually be useful.
3) Tutorial textures would be great! That's my least favorite part about modding, making textures They don't have to be super detailed if you don't want to. PM me the images if you make them
4) public static Block and public static final Block are basically the same thing. The only difference, is final makes so it can't be changed. The reason I don't put final is because you can make a block onRightClick change hardness, for example.
5) I was going to do that when I was making the item tutorial, but I was too lazy xD
Mod_:
Gui:
I'll have to see your error
Sorry it took so long, here it is:
May 31, 2012 10:45:50 PM ModLoader init
FINE: ModLoader 1.2.5 Initializing...
May 31, 2012 10:45:50 PM ModLoader readFromClassPath
FINER: Adding mods from C:\Users\Mikael\AppData\Roaming\.minecraft\bin\minecraft.jar
May 31, 2012 10:45:50 PM ModLoader readFromClassPath
FINER: Zip found.
May 31, 2012 10:45:50 PM ModLoader readFromModFolder
FINER: Adding mods from C:\Users\Mikael\AppData\Roaming\.minecraft\mods\camerastudio
May 31, 2012 10:45:50 PM ModLoader readFromModFolder
FINER: Directory found.
May 31, 2012 10:45:50 PM ModLoader readFromModFolder
FINER: Adding mods from C:\Users\Mikael\AppData\Roaming\.minecraft\mods\sppcommands
May 31, 2012 10:45:50 PM ModLoader readFromModFolder
FINER: Directory found.
May 31, 2012 10:45:50 PM ModLoader readFromModFolder
FINER: Adding mods from C:\Users\Mikael\AppData\Roaming\.minecraft\mods\TimelapseGUI.zip
May 31, 2012 10:45:50 PM ModLoader readFromModFolder
FINER: Zip found.
May 31, 2012 10:45:50 PM ModLoader addMod
FINE: Failed to load mod from "mod_TimelapseGUI.class"
May 31, 2012 10:45:50 PM ModLoader addMod
FINER: THROW
java.lang.InstantiationException
at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at ModLoader.addMod(ModLoader.java:294)
at ModLoader.readFromModFolder(ModLoader.java:1276)
at ModLoader.init(ModLoader.java:887)
at ModLoader.addAllRenderers(ModLoader.java:189)
at ahu.<init>(ahu.java:77)
at ahu.<clinit>(ahu.java:8)
at net.minecraft.client.Minecraft.a(SourceFile:273)
at net.minecraft.client.Minecraft.run(SourceFile:657)
at java.lang.Thread.run(Unknown Source)
May 31, 2012 10:46:00 PM ModLoader addAllRenderers
FINE: Initialized
That's my fault, I'm assuming you deleted '&& charStatsShowing'
Make it look like this again:
public void isCharStat(KeyBinding keybinding)
{
if(keybinding == this.key_statsGui && charStatsShowing == true)
And in your code, in the
public mod_TimelapseGUI()
{
add
charStatsShowing = false;
If you meant this:
Well i got this: