I'd like to request a modeling and rendering tutorial, if possible. The Human mobs in my Builders Mod can't wear hats, armor, capes, etc like the player can. I just want to create a Model and Render class that allows me to use player skins that include these things.
EDIT: Also, I have a quick question. What class contains the text for the tooltips that are used when highlighting items in your inventory?
I added the fixed chunkloader file for modloader and that got rid of that error but now one of my previous ones seams too have come back. So I just have one error now.
sources\minecraft\net\minecraft\src\mod_Lime.java:13: cannot find symbol
symbol : variable lime
location: class net.minecraft.src.Block
recipes.addRecipe(new ItemStack(Block.lime, 1), new Object[] {
I think its in this file
mod_Lime
package net.minecraft.src;
public class mod_Lime extends BaseMod
{
public static final Block lime;
static
{
lime = (new BlockLime(92, 18)).setHardness(2.0F).setResistance(10F).setStepSound(Block.soundStoneFootstep);
}
public void AddRecipes(CraftingManager recipes)
{
recipes.addRecipe(new ItemStack(Block.lime, 1), new Object[] {
"#", "X", Character.valueOf('#'), Block.sand, Character.valueOf('X'), Block.cobblestone,
});
}
}
But Just in case here is the other file
BlockLime
package net.minecraft.src;
import java.util.Random;
public class BlockLime extends Block
{
public BlockLime(int i, int j)
{
super(i, j, Material.sand);
}
public int idDropped(int i, Random random)
{
return 92;
}
}
Rollback Post to RevisionRollBack
Anything expressed above is purely my opinion, it may be right in some cases, it may be wrong in others.
Tarman wrote:
This is the nicest English-to-English translation work I've seen here in a while..."
@creapa, you should be able to decompile minecraft.jar with Modloader and Audiomod installed just fine. I think there are 2 errors from it but there are fixed files for those a page or two or three back.
It sounds like you're having a different issue... make sure your minecraft.jar is clean (mod-free) by redownloading it (< delete the version file in the same folder and start minecraft) and re-install modloader and try decompiling it again. Make sure you're following all of the instructions carefully, for everything.
Ok, I finally got it to work. What I was doing wrong apparently was coping ALL of the Modloader files into MCP/jars/minecraft.jar. It never occurred to me to only put BaseMod and Modloader. Sorry for any confusion and thanks for everyones help.
Ah ok. Glad you got it to work.
Quote from Trigonous »
Merging mods seems to be simple enough (compare mod a, b, c etc. to original .class file and combine) but I would also like a tutorial on it for those of us noobish programmers. It'd also help mod authors to have a "click here instead of bothering me about compatibility with x" button.
Yeah sounds like an alright idea for a tutorial, and for the most part it is easy. The problems come when the classes aren't decompiled correctly and require re-work to get them working.
Quote from pwndcube »
So, simo, you are awesome for keeping all of this updated and answering everyone's questions. I do not know how you do it. I do have one more question though, how would i go about making this mod have custom sounds? I have a few sound files in .ogg format already but i'm not sure why they aren't playing. Would I use risu's audiomod?
Using the audiomod would allow for better compatibility with other mods, but isn't required.
Quote from flip40 »
annoying error, taken mostly exact from your code with modifications that should be ok, but i keep getting this. I dont really know what this is wanting me to do. Im not much of a programmer (at least not java... havnt done this kinda stuff for quite some time) and just wanted something basic so please give a laymans explanation of why i keep getting this, thanks ;D heres the code in the two files... (this is from the make new item tut)
Thanks in advance,
Well as the error says, you don't have a return statement and the method declaration says you are meant to return an ItemStack... So the easiest way of satisfying this would be to return null;
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
{
return null;
}
Quote from thehippomaster21 »
Hello sorry I know there are a lot of questions here but I'm having problems with reobf.bat (again). When I use it, it says:
Make sure that you recompile first... then also make sure that all the files have the correct spelling and exist.
Quote from heromedel »
I still had two errors after changing to recipes.addrecipe So too make sure I didnt mess something up I started totally back over I deleted my MCP folder got a new clean .minecraft and started from scratch. I have gotten rid of all errors except one, the weird chunkloader error that I have no idea how I could have got.
here is what the recompiler says
sources\minecraft\net\minecraft\src\ChunkProviderLoadGenerate.java:139:
unreported exception java.io.IOException;
must be caught or declared to be thrown
chunkLoader.saveChunk(worldObj, chunk);
I tried researching IOExceptions but I wouldn't even know where or how the exception is happening.
I suppose I could take a look in ChunkProviderLoadGenerate.java but im going to wait too see what you guys say
I swear I haven't changed anything in that file or anything with the word chunk anywhere
thanks for all the help so far and I hope I/We can get this figured out, lol
That sounds weird then, sounds like something wasn't decompiled correctly or renamed correctly. Try running cleanup.bat, decompile.bat then updatenames.bat
The problem is do to a missing try-catch block which handles the exception, there is a master one in minecraft.class which sounds like it is missing, this should have covered the exception.
Quote from timboiscool »
Hey i made my own icon for the item and putted it in gui/items.png after the green disc but what iconindex does it have now?
Could someone maybe make a grid from the items.png but then with the indexs?
You could make a grid of it and post it here for us? =p
Basically the IDs range from 0 in the top left to 255 in the bottom right and the index increases from left to right, top to bottom.
Can't seem to get the recipe to work, and is there a way to change the texture of the blocK?
The texture of the block is set in the block declaration statement... I can't remember the method name, but the parameters are something like: (COL(int),ROW(int))...
Quote from natecat33 »
can someone use mpc to get block.java into its real name and tell me its real name (something like nt.class)
I still had two errors after changing to recipes.addrecipe So too make sure I didnt mess something up I started totally back over I deleted my MCP folder got a new clean .minecraft and started from scratch. I have gotten rid of all errors except one, the weird chunkloader error that I have no idea how I could have got.
here is what the recompiler says
sources\minecraft\net\minecraft\src\ChunkProviderLoadGenerate.java:139:
unreported exception java.io.IOException;
must be caught or declared to be thrown
chunkLoader.saveChunk(worldObj, chunk);
I tried researching IOExceptions but I wouldn't even know where or how the exception is happening.
I suppose I could take a look in ChunkProviderLoadGenerate.java but im going to wait too see what you guys say
I swear I haven't changed anything in that file or anything with the word chunk anywhere
thanks for all the help so far and I hope I/We can get this figured out, lol
I believe the issue you're having is fixed by Roundaround here: viewtopic.php?f=25&t=58464&p=1864175&hilit=mcp+problem#p1856049
The MCP causes an error in Audiomod, and in Modloader. So if you decompile with either of those installed, you need to replace their decompiled files with Roundaround's fixed versions.
If that's the only error you have left, then you should be able to reobfuscate it now! :smile.gif:
As Roundaround said.... Happy modding!
Ah ok, thanks for this information - it helps.
Quote from wingmnstr »
Quote from simo_415 »
Deployable House Example
So below I am going to provide an example of adding to our Example block class a feature that when the block is clicked it will create a basic house - this allows a simple way of creating a deployable house.
This code will need to be added to the BlockExample class.
public void onBlockClicked(World world, int i, int j, int k, EntityPlayer entityplayer)
{
// Basic Building
int block = Block.wood.blockID;
int size = 5;
for (int i1 = 0; i1 < size; i1++)
{
for (int j1 = 0; j1 < size; j1++)
{
//Walls
// i == ++ k == 0
world.setBlockWithNotify(i+i1,j+j1,k,block);
// i == ++ k == 4
world.setBlockWithNotify(i+i1,j+j1,k+(size-1),block);
// i == 0 k == ++
world.setBlockWithNotify(i,j+j1,k+i1,block);
// i == 4 k == ++
world.setBlockWithNotify(i+(size-1),j+j1,k+i1,block);
//Roof
world.setBlockWithNotify(i+i1,j+(size-1),k+j1,block);
//Floor
world.setBlockWithNotify(i+i1,j,k+j1,block);
}
}
//Door
world.setBlockWithNotify(i+1,j+2,k,0);
world.setBlockWithNotify(i+1,j+1,k,0);
//Windows
int offset = size % 2 == 0 ? (size / 2) - 1 : (size / 2);
world.setBlockWithNotify(i,j+offset,k+offset,Block.glass.blockID);
world.setBlockWithNotify(i+offset,j+offset,k,Block.glass.blockID);
world.setBlockWithNotify(i+(size-1),j+offset,k+offset,Block.glass.blockID);
world.setBlockWithNotify(i+offset,j+offset,k+(size-1),Block.glass.blockID);
//Utilities
world.setBlockWithNotify(i+1,j+1,k+(size-2),Block.crate.blockID);
world.setBlockWithNotify(i+(size-2),j+1,k+1,Block.workbench.blockID);
world.setBlockWithNotify(i+(size-2),j+1,k+(size-2),Block.stoneOvenIdle.blockID);
}
So, i added in, word for word, this code, and received this message in the recompile log:
[parsing started sources/minecraft/net/minecraft/src/BlockPopup.java]
sources/minecraft/net/minecraft/src/BlockPopup.java:17: class, interface, or enum expected
public void onBlockClicked(World world, int i, int j, int k, EntityPlayer entityplayer)
^
sources/minecraft/net/minecraft/src/BlockPopup.java:21: class, interface, or enum expected
int size = 5;
^
sources/minecraft/net/minecraft/src/BlockPopup.java:22: class, interface, or enum expected
for (int i1 = 0; i1 < size; i1++)
^
sources/minecraft/net/minecraft/src/BlockPopup.java:22: class, interface, or enum expected
for (int i1 = 0; i1 < size; i1++)
^
sources/minecraft/net/minecraft/src/BlockPopup.java:22: class, interface, or enum expected
for (int i1 = 0; i1 < size; i1++)
^
sources/minecraft/net/minecraft/src/BlockPopup.java:24: class, interface, or enum expected
for (int j1 = 0; j1 < size; j1++)
^
sources/minecraft/net/minecraft/src/BlockPopup.java:24: class, interface, or enum expected
for (int j1 = 0; j1 < size; j1++)
^
sources/minecraft/net/minecraft/src/BlockPopup.java:30: class, interface, or enum expected
World.setBlockWithNotify(i+i1,j+j1,k+(size-1),block);
^
sources/minecraft/net/minecraft/src/BlockPopup.java:32: class, interface, or enum expected
World.setBlockWithNotify(i,j+j1,k+i1,block);
^
sources/minecraft/net/minecraft/src/BlockPopup.java:34: class, interface, or enum expected
World.setBlockWithNotify(i+(size-1),j+j1,k+i1,block);
^
sources/minecraft/net/minecraft/src/BlockPopup.java:37: class, interface, or enum expected
World.setBlockWithNotify(i+i1,j+(size-1),k+j1,block);
^
sources/minecraft/net/minecraft/src/BlockPopup.java:40: class, interface, or enum expected
World.setBlockWithNotify(i+i1,j,k+j1,block);
^
sources/minecraft/net/minecraft/src/BlockPopup.java:41: class, interface, or enum expected
}
^
sources/minecraft/net/minecraft/src/BlockPopup.java:45: class, interface, or enum expected
World.setBlockWithNotify(i+1,j+1,k,0);
^
sources/minecraft/net/minecraft/src/BlockPopup.java:48: class, interface, or enum expected
int offset = size % 2 == 0 ? (size / 2) - 1 : (size / 2);
^
sources/minecraft/net/minecraft/src/BlockPopup.java:49: class, interface, or enum expected
World.setBlockWithNotify(i,j+offset,k+offset,Block.glass.blockID);
^
sources/minecraft/net/minecraft/src/BlockPopup.java:50: class, interface, or enum expected
World.setBlockWithNotify(i+offset,j+offset,k,Block.glass.blockID);
^
sources/minecraft/net/minecraft/src/BlockPopup.java:51: class, interface, or enum expected
World.setBlockWithNotify(i+(size-1),j+offset,k+offset,Block.glass.blockID);
^
sources/minecraft/net/minecraft/src/BlockPopup.java:52: class, interface, or enum expected
World.setBlockWithNotify(i+offset,j+offset,k+(size-1),Block.glass.blockID);
^
sources/minecraft/net/minecraft/src/BlockPopup.java:55: class, interface, or enum expected
World.setBlockWithNotify(i+1,j+1,k+(size-2),Block.crate.blockID);
^
sources/minecraft/net/minecraft/src/BlockPopup.java:56: class, interface, or enum expected
World.setBlockWithNotify(i+(size-2),j+1,k+1,Block.workbench.blockID);
^
sources/minecraft/net/minecraft/src/BlockPopup.java:57: class, interface, or enum expected
World.setBlockWithNotify(i+(size-2),j+1,k+(size-2),Block.stoneOvenIdle.blockID);
^
sources/minecraft/net/minecraft/src/BlockPopup.java:58: class, interface, or enum expected
}
^
i have tried several things, to no avail... please help, as i am very interested in moding/all coding, and this is one of my ways of learning. :happy.gif: (btw, i love the ssp commands mod)
Can you post the code of the class? It seems like you didn't declare it in a class...
Quote from Sploder »
It sounds like you just slapped the code onto the end, but it needs to be placed inside the class.
package net.minecraft.src;
import java.util.Random;
public class BlockExample extends Block
{
public BlockExample(int i, int j)
{
super(i, j, Material.rock);
}
public int idDropped(int i, Random random)
{
return 0;
}
// This is where you need to paste the extra code.
}
Thanks, that's what I was thinking =p
Quote from icantdoit »
I just downloaded the Minecraft Coder Pack, and I'm confused about this instruction:
- To test the modified game, start the "test_game.bat" script
I did that and nothing happened. Then I checked the log and there were 100 errors in files I hadn't even touched.
The only mods I have are MCMapper and Fancypack, in that order.
If it matters, the only change I made was to Fancypack's wall block, to make it solid. Literally one bit of difference.
It is best not to have any mods installed when you use MCP. If you are still having trouble on a vanilla version of MC try running update_names.bat after you decompile.
Quote from icantdoit »
I managed to change that bit in a roundabout way... it was the wrong one. That was scary.
But still, I want to know why I get these errors in files I never touched.
It's either because of the mods installed or some weird problem with MCP, using update_names.bat after running decompile.bat makes sure that everything was renamed correctly.
Quote from CosmicSpore »
Quote from icantdoit »
I managed to change that bit in a roundabout way... it was the wrong one. That was scary.
But still, I want to know why I get these errors in files I never touched.
I can't say for any errors you might be getting because of inexperienced code editing...
But it sounds like you may be getting a bunch of errors simply because you're trying to decompile the game with mods installed.
The problem with that is that the decompiler isn't really perfect in any way... so it can create errors during the decompiling process.
Likewise, you could have just screwed something up yourself. No one can say for sure because we weren't there when you did it.
My suggestion is just to try decompiling vanilla (non-modded) Minecraft if you actually want to mod.
You can also decompile minecraft + modloader and audiomod if you want your mods compatible... but I wouldn't go much further than that unless you understand how to get rid of decompiling errors.
I suppose it is the decompiler reacting to mods.
Just to be sure: is it normal for the source for ladders to mention workbenches, sheep and cacti?
Yeah this is normal.
Quote from blahthing »
Ughhh sorry for asking again
But what does it mean when it says a "reached end of file while parsing"
Happens when i try make a item, and its not a error
EDIT:
Fixed it somehow
Glad you fixed the problem =)
Quote from wingmnstr »
OK... bothering you all again... I created the mods, no issues or anything... but now, when i try to place the blocks i made, my game freezes up
any clues?
Is this using minecraft.jar or using test_game.bat?
Quote from fireclay »
*** Minecraft Coder Pack Version 2.6 ***
Finding javac.exe... if you want to speed this up, add it to your PATH
Path set.
MCP 2.6 running in C:\MCP
*** minecraft.jar was not found, skipping
*** minecraft_server.jar was not found, skipping
The system cannot find the path specified.
Renaming methods and fields
=== MCP 2.6 decompile script finished ===
Press any key to continue . . .
what do i do? it doesnt work
also i cant find sources/minecraft
You need to read the readme.txt file that comes with MCP... you didn't add the bin files by the sounds of it.
Quote from OgreSean »
I'd like to request a modeling and rendering tutorial, if possible. The Human mobs in my Builders Mod can't wear hats, armor, capes, etc like the player can. I just want to create a Model and Render class that allows me to use player skins that include these things.
EDIT: Also, I have a quick question. What class contains the text for the tooltips that are used when highlighting items in your inventory?
Hmm I could do a modelling and rendering tutorial, but it would be pretty full on... there is a bit of stuff in the NPC tutorial on it... but not really enough I guess.
The tooltips are added in the Block and Item classes using a key, ie: "grass". This key is then grabbed by the StringTranslate class which searches for the key in the en_US.lang file in minecraft.jar...
Quote from heromedel »
I added the fixed chunkloader file for modloader and that got rid of that error but now one of my previous ones seams too have come back. So I just have one error now.
sources\minecraft\net\minecraft\src\mod_Lime.java:13: cannot find symbol
symbol : variable lime
location: class net.minecraft.src.Block
recipes.addRecipe(new ItemStack(Block.lime, 1), new Object[] {
I think its in this file
mod_Lime
package net.minecraft.src;
public class mod_Lime extends BaseMod
{
public static final Block lime;
static
{
lime = (new BlockLime(92, 18)).setHardness(2.0F).setResistance(10F).setStepSound(Block.soundStoneFootstep);
}
public void AddRecipes(CraftingManager recipes)
{
recipes.addRecipe(new ItemStack(Block.lime, 1), new Object[] {
"#", "X", Character.valueOf('#'), Block.sand, Character.valueOf('X'), Block.cobblestone,
});
}
}
But Just in case here is the other file
BlockLime
package net.minecraft.src;
import java.util.Random;
public class BlockLime extends Block
{
public BlockLime(int i, int j)
{
super(i, j, Material.sand);
}
public int idDropped(int i, Random random)
{
return 92;
}
}
Hmm.. I haven't used ModLoader so I am not sure how it handles the recipes but this bit here is wrong:
new ItemStack(Block.lime, 1)
As lime hasn't been declared in the Block class. What you need to do is use this:
new ItemStack(this.lime, 1)
Quote from blahthing »
Is it possible to compile your game with modloader inside it?
When i try it gives an error from chunkproviderandloader.java
Apparently there is a fix for it on one of the threads.. not sure which one or where ask someone in this thread about where to get it from (I don't use ModLoader, sorry)..
Woah looking at that lime i learnt something, so you can put the recipe and the id in the itemBLAH.java!
package net.minecraft.src;
public class mod_Lime extends BaseMod
{
public static final Block lime;
static
{
lime = (new BlockLime(92, 18)).setHardness(2.0F).setResistance(10F).setStepSound(Block.soundStoneFootstep);
}
public void AddRecipes(CraftingManager recipes)
{
recipes.addRecipe(new ItemStack(Block.lime, 1), new Object[] {
"#", "X", Character.valueOf('#'), Block.sand, Character.valueOf('X'), Block.cobblestone,
});
}
}
Let me try!
package net.minecraft.src;
public class mod_Lime extends BaseMod // Uses modloader? I can see mod_Name, Question wouldnt it be mod_ItemLime?
{
public static final Block lime; // Erm Item name?
static
{
lime = (new BlockLime(92, 18)).setHardness(2.0F).setResistance(10F).setStepSound(Block.soundStoneFootstep); // Skip self explanatory, just put the routine from the item.java here instead
}
Where would we put the code for mod loader icon? LimeIndex = ModLoader.getUniqueSpriteIndex("/gui/lime.png");
Hmm..?
Heres what nohero said:
First, in your mod_Pyramidplunder or what u call it extend basemod. (you can look at my code for help!)
then create
public static int heartContainerIndex = ModLoader.getUniqueSpriteIndex("/gui/items.png");
basically create an item sprite. replace the heartContainer with what item you want.
Then create the item itself:
public static ee heartPiece = new ee(201).a(heartPieceIndex).a("Heart Piece");
(ee= item class) (201=item ID) (heartPieceIndex extends that first code) ("Heart Piece" makes the text description)
public mod_moreHealth()
{
ModLoader.AddName(heartContainer, "Heart Container");
ModLoader.AddName(heartPiece, "Heart Piece");
}
To add the name in game.
Then, for the sprites to work:
public void RegisterTextureOverrides()
{
ModLoader.addOverride("/gui/items.png", "/moreHealth/heart_container.png", heartContainerIndex);
ModLoader.addOverride("/gui/items.png", "/moreHealth/heartPiece.png", heartPieceIndex);
}
}
Create a folder called whatever you want. I called it moreHealth. In that folder place all the sprited, and basically the addOverride make the sprite in game! remember to replace the heartContainerIndex with your item! Then add the morehealth folder into your .jar.
Done!
Still needa get unconfused about this. Because for starters i dont have basemod?
Any help spwease?
Basemod is part of the modloader... that code that was written was for use with the modloader... therefore you need modloader installed for that code to work
To all of you telling me to decompile vanilla Minecraft, the file I'm trying to edit is itself a mod, so that's not an option. I need a way to decompile AND compile individual files, that doesn't have a limited number of uses like DJ decompiler.
To all of you telling me to decompile vanilla Minecraft, the file I'm trying to edit is itself a mod, so that's not an option. I need a way to decompile AND compile individual files, that doesn't have a limited number of uses like DJ decompiler.
For anyone trying to decompile with Modloader or Audiomod, the current test versions of MCP have errors in them that do not decompile them correctly. You WILL get errors.
Roundaround has fixed these errors, and so you need to fix the files manually yourself, or download his versions here: viewtopic.php?f=25&t=58464&p=1864175&hilit=mcp+problem#p1856049 and simply replace them with the decompiled files after running decompile.bat. (I did this myself, and they work perfectly. Thanks Roundaround!)
That should solve all errors you may have after decompiling with modloader. So unless you've changed something, you should have ZERO errors now. If you have any errors at all, before changing anything, then something did not decompile correctly. Run cleanup.bat and start over, and read the instructions carefully.
And @ simo_415, thanks for the tutorials. :wink.gif:
Good news and bad news, I got the mod working by changing Block.lime to This.lime, which makes perfect sense I am glad I learned about that now. I can get my classes and it works in minecraft, luckily I havent updated yet.
But when I run test.bat I get a white screen and the command prompt window seams to be showing errors.
(this is still working with Beta 1.1_02)
Good news and bad news, I got the mod working by changing Block.lime to This.lime, which makes perfect sense I am glad I learned about that now. I can get my classes and it works in minecraft, luckily I havent updated yet.
But when I run test.bat I get a white screen and the command prompt window seams to be showing errors.
(this is still working with Beta 1.1_02)
I'd like to request a modeling and rendering tutorial, if possible. The Human mobs in my Builders Mod can't wear hats, armor, capes, etc like the player can. I just want to create a Model and Render class that allows me to use player skins that include these things.
EDIT: Also, I have a quick question. What class contains the text for the tooltips that are used when highlighting items in your inventory?
Hmm I could do a modelling and rendering tutorial, but it would be pretty full on... there is a bit of stuff in the NPC tutorial on it... but not really enough I guess.
The tooltips are added in the Block and Item classes using a key, ie: "grass". This key is then grabbed by the StringTranslate class which searches for the key in the en_US.lang file in minecraft.jar...
Thanks for the help simo! I may try writing a modding tutorial to contribute to this thread, though I don't know much beyond making mobs. I could specify how I mod using a combination of Eclipse, MCP, and Modloader/Spawnlist, if that would help anyone. Basically, I type the java code in Eclipse, compile and reobfuscate the classes using MCP, then I just drag my class files into my Appdata's mincecraft.jar, which has Modloader and Spawnlist already installed (Also SinglePlayer Commands, which is awesome for mod testing). Then I just start up minecraft normally to test the mod. I can make a tutorial that goes into more detail if anyone is interested.
I do it this way because I had a lot of trouble trying to use Modloader with MCPs compile function when I first started modding.
Thanks for the great tutorials once again.
I am still working on the door thing but hopefully I will get it working soon.
I just need to wait for the latest version of MCP to come out.
Hey guys, I am currently modding the new squid to attack players, though it takes awhile since the code is obfuscated. I've had success with making the squid damage a player that moves near it, but I am still trying to figure out how to make it move toward a nearby player.
My attackSquid.class extends the EntitySquid class. I am trying to make its OnLivingUpdate function not call EntitySquid's OnLivingUpdate function, which controls all the random water movement. However, If I don't call that OnLivingUpdate function, then I also don't get EntityCreature's OnLivingUpdate function, which I need. The problem basically is that I need my attackSquid's OnLivingUpdate function to skip calling EntitySquid's OnLivingUpdate function, but still call EntityLiving's OnLivingUpdate. Since I can't just use super.super.OnLivingUpdate() to call it, I was wondering if anyone knew a way to call a method of the superclass of a superclass.
For anyone wondering, I used the (future?) MCP names of these classes in the paragraph above since I have manually de-obfuscated the EntitySeaCreature & EntitySquid classes. Well partially. I just decompiled them and added comments that identify obfuscated terms. For anyone else who wants to try modding the Squid before the next version of MCP comes out, I can provide the commented source code.
Hey guys, I am currently modding the new squid to attack players, though it takes awhile since the code is obfuscated. I've had success with making the squid damage a player that moves near it, but I am still trying to figure out how to make it move toward a nearby player.
My attackSquid.class extends the EntitySquid class. I am trying to make its OnLivingUpdate function not call EntitySquid's OnLivingUpdate function, which controls all the random water movement. However, If I don't call that OnLivingUpdate function, then I also don't get EntityCreature's OnLivingUpdate function, which I need. The problem basically is that I need my attackSquid's OnLivingUpdate function to skip calling EntitySquid's OnLivingUpdate function, but still call EntityLiving's OnLivingUpdate. Since I can't just use super.super.OnLivingUpdate() to call it, I was wondering if anyone knew a way to call a method of the superclass of a superclass.
For anyone wondering, I used the (future?) MCP names of these classes in the paragraph above since I have manually de-obfuscated the EntitySeaCreature & EntitySquid classes. Well partially. I just decompiled them and added comments that identify obfuscated terms. For anyone else who wants to try modding the Squid before the next version of MCP comes out, I can provide the commented source code.
Here is a quick and nasty way of doing it. Duplicate the EntitySquid code into a new class to your liking. Then extend the EntityMobs class rather than the EntityCreature class. This should allow the mob to automatically hurt and find the player without additional coding.
EDIT: Also, I have a quick question. What class contains the text for the tooltips that are used when highlighting items in your inventory?
Builder Mobs 0.53
My Other Mods Here
sources\minecraft\net\minecraft\src\mod_Lime.java:13: cannot find symbol
symbol : variable lime
location: class net.minecraft.src.Block
recipes.addRecipe(new ItemStack(Block.lime, 1), new Object[] {
I think its in this file
mod_Lime
But Just in case here is the other file
BlockLime
Tarman wrote:
This is the nicest English-to-English translation work I've seen here in a while..."
When i try it gives an error from chunkproviderandloader.java
Ah ok. Glad you got it to work.
Yeah sounds like an alright idea for a tutorial, and for the most part it is easy. The problems come when the classes aren't decompiled correctly and require re-work to get them working.
Using the audiomod would allow for better compatibility with other mods, but isn't required.
Well as the error says, you don't have a return statement and the method declaration says you are meant to return an ItemStack... So the easiest way of satisfying this would be to return null;
Make sure that you recompile first... then also make sure that all the files have the correct spelling and exist.
That sounds weird then, sounds like something wasn't decompiled correctly or renamed correctly. Try running cleanup.bat, decompile.bat then updatenames.bat
The problem is do to a missing try-catch block which handles the exception, there is a master one in minecraft.class which sounds like it is missing, this should have covered the exception.
You could make a grid of it and post it here for us? =p
Basically the IDs range from 0 in the top left to 255 in the bottom right and the index increases from left to right, top to bottom.
The texture of the block is set in the block declaration statement... I can't remember the method name, but the parameters are something like: (COL(int),ROW(int))...
http://www.tkte.ch/projects/pymy/?cver=1292920904000
Ah ok, thanks for this information - it helps.
Can you post the code of the class? It seems like you didn't declare it in a class...
Thanks, that's what I was thinking =p
It is best not to have any mods installed when you use MCP. If you are still having trouble on a vanilla version of MC try running update_names.bat after you decompile.
It's either because of the mods installed or some weird problem with MCP, using update_names.bat after running decompile.bat makes sure that everything was renamed correctly.
Thanks =)
Yeah this is normal.
Glad you fixed the problem =)
Is this using minecraft.jar or using test_game.bat?
You need to read the readme.txt file that comes with MCP... you didn't add the bin files by the sounds of it.
Hmm I could do a modelling and rendering tutorial, but it would be pretty full on... there is a bit of stuff in the NPC tutorial on it... but not really enough I guess.
The tooltips are added in the Block and Item classes using a key, ie: "grass". This key is then grabbed by the StringTranslate class which searches for the key in the en_US.lang file in minecraft.jar...
Hmm.. I haven't used ModLoader so I am not sure how it handles the recipes but this bit here is wrong:
As lime hasn't been declared in the Block class. What you need to do is use this:
Apparently there is a fix for it on one of the threads.. not sure which one or where ask someone in this thread about where to get it from (I don't use ModLoader, sorry)..
package net.minecraft.src;
public class mod_Lime extends BaseMod
{
public static final Block lime;
static
{
lime = (new BlockLime(92, 18)).setHardness(2.0F).setResistance(10F).setStepSound(Block.soundStoneFootstep);
}
public void AddRecipes(CraftingManager recipes)
{
recipes.addRecipe(new ItemStack(Block.lime, 1), new Object[] {
"#", "X", Character.valueOf('#'), Block.sand, Character.valueOf('X'), Block.cobblestone,
});
}
}
Let me try!
package net.minecraft.src;
public class mod_Lime extends BaseMod // Uses modloader? I can see mod_Name, Question wouldnt it be mod_ItemLime?
{
public static final Block lime; // Erm Item name?
static
{
lime = (new BlockLime(92, 18)).setHardness(2.0F).setResistance(10F).setStepSound(Block.soundStoneFootstep); // Skip self explanatory, just put the routine from the item.java here instead
}
public void AddRecipes(CraftingManager recipes)
{
recipes.addRecipe(new ItemStack(Block.lime, 1), new Object[] { // Skip...
"#", "X", Character.valueOf('#'), Block.sand, Character.valueOf('X'), Block.cobblestone,
});
}
}
Where would we put the code for mod loader icon? LimeIndex = ModLoader.getUniqueSpriteIndex("/gui/lime.png");
Hmm..?
Heres what nohero said:
First, in your mod_Pyramidplunder or what u call it extend basemod. (you can look at my code for help!)
then create
public static int heartContainerIndex = ModLoader.getUniqueSpriteIndex("/gui/items.png");
basically create an item sprite. replace the heartContainer with what item you want.
Then create the item itself:
public static ee heartPiece = new ee(201).a(heartPieceIndex).a("Heart Piece");
(ee= item class) (201=item ID) (heartPieceIndex extends that first code) ("Heart Piece" makes the text description)
public mod_moreHealth()
{
ModLoader.AddName(heartContainer, "Heart Container");
ModLoader.AddName(heartPiece, "Heart Piece");
}
To add the name in game.
Then, for the sprites to work:
public void RegisterTextureOverrides()
{
ModLoader.addOverride("/gui/items.png", "/moreHealth/heart_container.png", heartContainerIndex);
ModLoader.addOverride("/gui/items.png", "/moreHealth/heartPiece.png", heartPieceIndex);
}
}
Create a folder called whatever you want. I called it moreHealth. In that folder place all the sprited, and basically the addOverride make the sprite in game! remember to replace the heartContainerIndex with your item! Then add the morehealth folder into your .jar.
Done!
Still needa get unconfused about this. Because for starters i dont have basemod?
Any help spwease?
Cheers
Here's what my error log looks like.
It just goes on and on like this.
Lol, I've been waiting for months
Haha I totally forgot about it, you should have reminded me.
That means that minecraft.class wasn't decompiled correctly. Use the update_names.bat script then try again...
Roundaround has fixed these errors, and so you need to fix the files manually yourself, or download his versions here: viewtopic.php?f=25&t=58464&p=1864175&hilit=mcp+problem#p1856049 and simply replace them with the decompiled files after running decompile.bat. (I did this myself, and they work perfectly. Thanks Roundaround!)
That should solve all errors you may have after decompiling with modloader. So unless you've changed something, you should have ZERO errors now. If you have any errors at all, before changing anything, then something did not decompile correctly. Run cleanup.bat and start over, and read the instructions carefully.
And @ simo_415, thanks for the tutorials. :wink.gif:
But when I run test.bat I get a white screen and the command prompt window seams to be showing errors.
(this is still working with Beta 1.1_02)
here is a screenshot
http://img222.imageshack.us/i/testtl.jpg/
Anyway so yeah my mod works in mincecraft when I put it in the .jar myself just test.bat isn't working.
P.S. I hope updating to the new update won't be too hard.
Tarman wrote:
This is the nicest English-to-English translation work I've seen here in a while..."
You can't run the test game in MCP with modloader installed. I believe it says that in the instructions somewhere.
I know how to make swords/weapons
Thanks for the help simo! I may try writing a modding tutorial to contribute to this thread, though I don't know much beyond making mobs. I could specify how I mod using a combination of Eclipse, MCP, and Modloader/Spawnlist, if that would help anyone. Basically, I type the java code in Eclipse, compile and reobfuscate the classes using MCP, then I just drag my class files into my Appdata's mincecraft.jar, which has Modloader and Spawnlist already installed (Also SinglePlayer Commands, which is awesome for mod testing). Then I just start up minecraft normally to test the mod. I can make a tutorial that goes into more detail if anyone is interested.
I do it this way because I had a lot of trouble trying to use Modloader with MCPs compile function when I first started modding.
Builder Mobs 0.53
My Other Mods Here
Thanks for the great tutorials once again.
I am still working on the door thing but hopefully I will get it working soon.
I just need to wait for the latest version of MCP to come out.
Many thanks once again.
Ki113d.
My attackSquid.class extends the EntitySquid class. I am trying to make its OnLivingUpdate function not call EntitySquid's OnLivingUpdate function, which controls all the random water movement. However, If I don't call that OnLivingUpdate function, then I also don't get EntityCreature's OnLivingUpdate function, which I need. The problem basically is that I need my attackSquid's OnLivingUpdate function to skip calling EntitySquid's OnLivingUpdate function, but still call EntityLiving's OnLivingUpdate. Since I can't just use super.super.OnLivingUpdate() to call it, I was wondering if anyone knew a way to call a method of the superclass of a superclass.
For anyone wondering, I used the (future?) MCP names of these classes in the paragraph above since I have manually de-obfuscated the EntitySeaCreature & EntitySquid classes. Well partially. I just decompiled them and added comments that identify obfuscated terms. For anyone else who wants to try modding the Squid before the next version of MCP comes out, I can provide the commented source code.
Builder Mobs 0.53
My Other Mods Here
Here is a quick and nasty way of doing it. Duplicate the EntitySquid code into a new class to your liking. Then extend the EntityMobs class rather than the EntityCreature class. This should allow the mob to automatically hurt and find the player without additional coding.