This is a nice tutorial, however, it is not sufficient in order to make use of mod.loader instead. Since we also want to add our own images/icons. Need to find out how to compile this as a separate mod wrapper.
This is a nice tutorial, however, it is not sufficient in order to make use of mod.loader instead. Since we also want to add our own images/icons. Need to find out how to compile this as a separate mod wrapper.
This tutorial was aimed at showing how to mod minecraft.jar not specifically use toolkits or extensions - I was going to write it without the use of MCP but it is hard to teach something with obfuscated classes and decompiling stuff.
I will consider adding a tutorial for using the ModLoader, but it should have it's own tutorial about showing how to convert your mod into a modloader compatible one - therefore there isn't much point.
i think you mean set a pause on test-game.bat and not recompile.bat because recompile pauses.
sorry for the wierd languange (i am dutch) i will change it under it.
and i have my bootcamp on my I disk.
okay:
*** Minecraft Coder Pack Version 2.5 ***
Finding javac.exe... if you want to speed this up, add it to your PATH
I:\Documents wordt niet herkend als een interne
of externe opdracht, programma of batchbestand.
Path set.
Exception in thread "main" java.lang.NoClassDefFoundError: Start
Caused by: java.lang.ClassNotFoundException: Start
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: Start. Program will exit.
translate: (i use a translate machine it is a bit hard to translate so sorry for the wierd english).
I:\Documents wordt niet herkend als een interne
of externe opdracht, programma of batchbestand.
I:/Documents is not recognized as an internal
or external command, operable program or batch file.
Ah ok.
So the problem is that it can't find the main class to start minecraft, this could be due to multiple reasons -
1. The program wasn't compiled, or wasn't compiled successfully.
2. Cannot find the specific file.
3. JDK may not be setup correctly.
To check -
1. Check logs/minecraft_compile.log - if this doesn't exist JDK isn't installed properly or ^ can be found in it there are compile problems.
2. This might be due to having a space in the path, try using a path that doesn't have a space in it.
3. Add javac.exe and java.exe to the PATH
This is a nice tutorial, however, it is not sufficient in order to make use of mod.loader instead. Since we also want to add our own images/icons. Need to find out how to compile this as a separate mod wrapper.
This tutorial was aimed at showing how to mod minecraft.jar not specifically use toolkits or extensions - I was going to write it without the use of MCP but it is hard to teach something with obfuscated classes and decompiling stuff.
I will consider adding a tutorial for using the ModLoader, but it should have it's own tutorial about showing how to convert your mod into a modloader compatible one - therefore there isn't much point.
I fully understand that, and I just finished the compiling system and added a new block. Now all that is left is to official integrate it into the minecraft.jar system. That way, my new Ore will spawn just like the other ores. Then we finally have the achievement of making our own Ore/Ingots/Sources.
Quote from azwethinkweis »
I keep getting the same error when i try to make a new item in the Item.java file, here is the error
sources\minecraft\net\minecraft\src\Item.java:199: illegal start of expression
public static Item Wand = (new ItemWand (106, )).setIconIndex(53)
public static Item Wand = (new ItemWand (106, )).setIconIndex(53)
Your error is in the red area. Add a number next to that comma, preferably 1.
sources\minecraft\net\minecraft\src\Item.java:198: cannot find symbol
symbol : constructor ItemWand(int,int)
location: class net.minecraft.src.ItemWand
public static Item wand = (new ItemWand(106 , 1)).setIconIndex(53);
sources\minecraft\net\minecraft\src\Item.java:198: cannot find symbol
symbol : constructor ItemWand(int,int)
location: class net.minecraft.src.ItemWand
public static Item wand = (new ItemWand(106 , 1)).setIconIndex(53);
You need to have a matching constructor with two parameters...
I fully understand that, and I just finished the compiling system and added a new block. Now all that is left is to official integrate it into the minecraft.jar system. That way, my new Ore will spawn just like the other ores. Then we finally have the achievement of making our own Ore/Ingots/Sources.
Ok no worries.
To add the block to the spawning system you need to create a WorldGen class or add to an existing one, then using that class add it to the ChuckGenerator class. I will write a tutorial at a later point in time. Understanding the world gen classes is a little bit more complicated than the Item and Block classes so I want to spend some time making a good tutorial.
I fully understand that, and I just finished the compiling system and added a new block. Now all that is left is to official integrate it into the minecraft.jar system. That way, my new Ore will spawn just like the other ores. Then we finally have the achievement of making our own Ore/Ingots/Sources.
Ok no worries.
To add the block to the spawning system you need to create a WorldGen class or add to an existing one, then using that class add it to the ChuckGenerator class. I will write a tutorial at a later point in time. Understanding the world gen classes is a little bit more complicated than the Item and Block classes so I want to spend some time making a good tutorial.
Perfectly fine by me, man. Take your time, I figured half of this stuff on my own now. Plus I just wanted to ask if I may post how to add a Furnace-able Block into an Ingot or etc so to speak? I just managed to do that today.
I fully understand that, and I just finished the compiling system and added a new block. Now all that is left is to official integrate it into the minecraft.jar system. That way, my new Ore will spawn just like the other ores. Then we finally have the achievement of making our own Ore/Ingots/Sources.
Ok no worries.
To add the block to the spawning system you need to create a WorldGen class or add to an existing one, then using that class add it to the ChuckGenerator class. I will write a tutorial at a later point in time. Understanding the world gen classes is a little bit more complicated than the Item and Block classes so I want to spend some time making a good tutorial.
Perfectly fine by me, man. Take your time, I figured half of this stuff on my own now. Plus I just wanted to ask if I may post how to add a Furnace-able Block into an Ingot or etc so to speak? I just managed to do that today.
Sure, go ahead that would be great. I'll link to it in the original post.
Adding New Blocks to Furnace
The idea behind this is that you are able to use the new block you created and no mine-able in MineCraft as a Furnace-able object. You would first be required to add the Block to the Furnace category. If you made the block from the previous posts, then all you need to do is continue from this point on to get it to become a smelted product.
Step 1 - Find The Furnace Definitions
You must first locate the "TileEntityFurnace.java" in the MineCraft Src Folder. You will find it pretty far down, just before the end of the series. For easier access, press T.
Step 2 - Locate and Add The New Definition
You must then located "private int getSmeltingResultItem(int i)" in the "TileEntityFurnace.java". There you will add your new type of result for your smelted block. Since the block should already be defined everywhere else, all you must make sure of now is that the the resulting item is also defined as well. We will be using both previous examples as a result for this project.
Due to confusion the guide is based on the first three posted previously, the item name as well as the block name are essentially the same. To make things easier, they do not depend on each other as they are totally separate files and entity types. However, it is best to define them more appropriately when adding them. If you are creating blocks, always add Block before the names, same thing with items, add Item before their names. (EG: BlockBronze, ItemBronzeIngot)
If you missed the information, the above code was added to the Smelting Results code, this defines the Furnace to recognize the said Block "Example" to create the said Item "Example". Be sure to add the definition between the last "if", however, before the end of the "else" sequence.
Step 3 - Finished Product Using Realistic Names
Due the the example above using the term "Example" for both as Block name and Item name, we will repeat this in one entire step showing how it is done for better understanding. You will notice the first code represents the Block type, while the second code represents the Item. Be aware, that you must still repeat the variou steps explained in order to create a Block and Item separately.
We defined a new BlockOre type in Block.java:
public static final Block blockBronze;
In addition we defined the BlockOre type in Block.java with its attributes below after the static final Block:
blockBronze = (new BlockOre(92, 113)).setHardness(3F).setResistance(5F).setStepSound(soundStoneFootstep);
NOTICE: 92 is the ID, while 113 is the slot of the icon within the "/terrain.png". In this case, we did not add/create a separate Block.java file for this block type it is not necessary, but if you are creating a Modification instead of an add-on into MineCraft, you will be required to do so.
The New Block and Ingot of Bronze
We now have defined an Item type in Item.java:
public static Item ingotBronze = (new Item(95)).setIconIndex(60);
NOTICE: 95 is the ID, while 60 is the slot of the icon within the "/gui/items.png". In this case, we did not add/create a separate Item.java file for this item type it is not necessary, but if you are creating a Modification instead of an add-on into MineCraft, you will be required to do so.
Now that we have both installed and properly defined, the item can now be added. This should be much more clearer to users on how this was installed correctly for the Furnace to understand its objective.
Furnace Smelting a new Bronze Block into Bronze Ingots
We add the definition for the Furnace with these new Blocks and Items to TileEntityFurnace.java:
Added images and Preview of the new block and ingot in action. Now to add it the generator world, and then find out how to make weapons with specific class on durability and strength and managing those as well.
Could somebody use a decompiler like JD-GUI and give me the code for the basic block?
If you follow the instructions to set up the MCP, you can decompile and recompile MineCraft and get all the java files that you wish to edit or look at.
In this tutorial I will explain how to create custom block behavior rather than the default behavior. It all basically comes down to overwriting methods in Block.class. This can create blocks which when clicked - exhibit some behavior (see example below), having the block be a redstone power source, explode well... basically anything is possible..
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);
}
This will produce a house that looks like follows when clicked.
So like the above example you can create custom block behavior by overwriting methods found in the Block class to create some awesome functionality as seen above in the deployable house example.
In this tutorial I will explain how to create your own custom NPC. I must warn anyone who attempts this though - it is substantially more complex than adding a new block to the game. So in this example I am going to create a new NPC that is modelled off a cow - a mad cow, this mob will initially be friendly but I will also show you how to make it agressive.
To begin with you need to create the "logic" class, the logic for extended elements to the game is handled under the Entity classes. You can basically add anything to an entity class to achieve custom game behaviour. So lets create an entity class named EntityExample.java to make a new peaceful NPC.
The above code should be pretty self explanatory as to what it does but I will quickly go over the details.
getSoundVolume() returns a number from 0 - 1 which is the "volume" of the creatures sound. This can be translated into a percent by multiplying by 100.
getLivingSound, getHurtSound, getDeathSound return the location of the "track" to play when each of those things happen. The tracks can be found in the resources directory. For this example I am just going to copy another mobs
sounds rather than create my own.
read and write entity to NBT allows the creature to be saved and loaded from your save.
So the next step would be to make sure you have all the sounds and textures which are specified in your class, using NPC you need to add the sounds to: /jars/resources/newsound/mob/example.ogg and the texture needs to be added to: /temp/minecraft/mob/example.png
You can get my MadCow texture below:
The sound is just the cow sound copied and renamed to example.ogg.
This now means that the entity class is finished.
Next you need to create a Model class. A model class basically provides minecraft with the details required to generate the "model" of the entity within minecraft. So these details are dependent upon your example.png texture. Since I am modelling this example off a cow I will be using mostly the same details as the ModelCow
class.
So as seen above we specify postions and orientation of the new creature. To create a totally new creature with all new dimensions and orientation you would need to play around with these numbers in the constructor a bit.
After creating the Model class we need to create a Render class, the render class provides a way of linking the Model class to the Entity class. Therefore we will create a new class named RenderExample.java the code is pretty bare boned and all it basically does is overwrite doRender and func_171_a to specify the
specific Entity class.
Now we have created all the necessary classes for our new NPC so the next step is to let minecraft know about them so that they can be generated. To do this you need to add some code to RenderManager.java within the constructor at the bottom of the list.
entityRenderMap.put(EntityExample.class, new RenderExample(new ModelExample(),0.7F));
And you also need to add them to the necessary biome generator lists, this is done in the MobSpawnerBase class. Within the constructor add the Entity to the biomeCreature array.
EntityExample.class
After this is complete you can now compile and run your new NPC.
If you wish to create an aggressive NPC this is achieved by changing the Entity class slightly so that it extends EntityMobs instead of EntityAnimals. You will also need to change the MobSpawnerBase list if you want it to spawn at night rather than during the day.
Like the block class to achieve customisation of NPCs all that needs to be done is you need to overwrite the methods in the EntityCreature or EntityMobs classes this will allow the mobs to do basically anything.
Could you teach us that? I mean could you teach us to make an entirely new npc,(using spawnlist mod) with a new model, for example a frog (i know how to texture and model, just not how to make the animations work ingame and make it do stuff)
That would be more than awesome because then everyone can make custom npcs =D
Added.
I am only teaching how to add things using MCP, extra utilities and Modloaders I am not going to give instructions on as this should be covered in their respective threads. Using the instructions given on those threads you should be able to covert any of my tutorials to become compatible with their mods.
This tutorial was aimed at showing how to mod minecraft.jar not specifically use toolkits or extensions - I was going to write it without the use of MCP but it is hard to teach something with obfuscated classes and decompiling stuff.
I will consider adding a tutorial for using the ModLoader, but it should have it's own tutorial about showing how to convert your mod into a modloader compatible one - therefore there isn't much point.
Ah ok.
So the problem is that it can't find the main class to start minecraft, this could be due to multiple reasons -
1. The program wasn't compiled, or wasn't compiled successfully.
2. Cannot find the specific file.
3. JDK may not be setup correctly.
To check -
1. Check logs/minecraft_compile.log - if this doesn't exist JDK isn't installed properly or ^ can be found in it there are compile problems.
2. This might be due to having a space in the path, try using a path that doesn't have a space in it.
3. Add javac.exe and java.exe to the PATH
sources\minecraft\net\minecraft\src\Item.java:199: illegal start of expression
public static Item Wand = (new ItemWand (106, )).setIconIndex(53)
Support Kimba in getting him back on air!
http://www.minerwars.com/?aid=938
I fully understand that, and I just finished the compiling system and added a new block. Now all that is left is to official integrate it into the minecraft.jar system. That way, my new Ore will spawn just like the other ores. Then we finally have the achievement of making our own Ore/Ingots/Sources.
public static Item Wand = (new ItemWand (106, )).setIconIndex(53)
Your error is in the red area. Add a number next to that comma, preferably 1.
sources\minecraft\net\minecraft\src\Item.java:198: cannot find symbol
symbol : constructor ItemWand(int,int)
location: class net.minecraft.src.ItemWand
public static Item wand = (new ItemWand(106 , 1)).setIconIndex(53);
Support Kimba in getting him back on air!
http://www.minerwars.com/?aid=938
You need to have a matching constructor with two parameters...
Ok no worries.
To add the block to the spawning system you need to create a WorldGen class or add to an existing one, then using that class add it to the ChuckGenerator class. I will write a tutorial at a later point in time. Understanding the world gen classes is a little bit more complicated than the Item and Block classes so I want to spend some time making a good tutorial.
Perfectly fine by me, man. Take your time, I figured half of this stuff on my own now. Plus I just wanted to ask if I may post how to add a Furnace-able Block into an Ingot or etc so to speak? I just managed to do that today.
Sure, go ahead that would be great. I'll link to it in the original post.
The idea behind this is that you are able to use the new block you created and no mine-able in MineCraft as a Furnace-able object. You would first be required to add the Block to the Furnace category. If you made the block from the previous posts, then all you need to do is continue from this point on to get it to become a smelted product.
Step 1 - Find The Furnace Definitions
You must first locate the "TileEntityFurnace.java" in the MineCraft Src Folder. You will find it pretty far down, just before the end of the series. For easier access, press T.
Step 2 - Locate and Add The New Definition
You must then located "private int getSmeltingResultItem(int i)" in the "TileEntityFurnace.java". There you will add your new type of result for your smelted block. Since the block should already be defined everywhere else, all you must make sure of now is that the the resulting item is also defined as well. We will be using both previous examples as a result for this project.
Due to confusion the guide is based on the first three posted previously, the item name as well as the block name are essentially the same. To make things easier, they do not depend on each other as they are totally separate files and entity types. However, it is best to define them more appropriately when adding them. If you are creating blocks, always add Block before the names, same thing with items, add Item before their names. (EG: BlockBronze, ItemBronzeIngot)
If you missed the information, the above code was added to the Smelting Results code, this defines the Furnace to recognize the said Block "Example" to create the said Item "Example". Be sure to add the definition between the last "if", however, before the end of the "else" sequence.
Step 3 - Finished Product Using Realistic Names
Due the the example above using the term "Example" for both as Block name and Item name, we will repeat this in one entire step showing how it is done for better understanding. You will notice the first code represents the Block type, while the second code represents the Item. Be aware, that you must still repeat the variou steps explained in order to create a Block and Item separately.
We defined a new BlockOre type in Block.java:
In addition we defined the BlockOre type in Block.java with its attributes below after the static final Block:
NOTICE: 92 is the ID, while 113 is the slot of the icon within the "/terrain.png". In this case, we did not add/create a separate Block.java file for this block type it is not necessary, but if you are creating a Modification instead of an add-on into MineCraft, you will be required to do so.
The New Block and Ingot of Bronze
We now have defined an Item type in Item.java:
NOTICE: 95 is the ID, while 60 is the slot of the icon within the "/gui/items.png". In this case, we did not add/create a separate Item.java file for this item type it is not necessary, but if you are creating a Modification instead of an add-on into MineCraft, you will be required to do so.
Now that we have both installed and properly defined, the item can now be added. This should be much more clearer to users on how this was installed correctly for the Furnace to understand its objective.
Furnace Smelting a new Bronze Block into Bronze Ingots
We add the definition for the Furnace with these new Blocks and Items to TileEntityFurnace.java:
If you follow the instructions to set up the MCP, you can decompile and recompile MineCraft and get all the java files that you wish to edit or look at.
In this tutorial I will explain how to create custom block behavior rather than the default behavior. It all basically comes down to overwriting methods in Block.class. This can create blocks which when clicked - exhibit some behavior (see example below), having the block be a redstone power source, explode well... basically anything is possible..
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.
This will produce a house that looks like follows when clicked.
So like the above example you can create custom block behavior by overwriting methods found in the Block class to create some awesome functionality as seen above in the deployable house example.
In this tutorial I will explain how to create your own custom NPC. I must warn anyone who attempts this though - it is substantially more complex than adding a new block to the game. So in this example I am going to create a new NPC that is modelled off a cow - a mad cow, this mob will initially be friendly but I will also show you how to make it agressive.
To begin with you need to create the "logic" class, the logic for extended elements to the game is handled under the Entity classes. You can basically add anything to an entity class to achieve custom game behaviour. So lets create an entity class named EntityExample.java to make a new peaceful NPC.
The above code should be pretty self explanatory as to what it does but I will quickly go over the details.
getSoundVolume() returns a number from 0 - 1 which is the "volume" of the creatures sound. This can be translated into a percent by multiplying by 100.
getLivingSound, getHurtSound, getDeathSound return the location of the "track" to play when each of those things happen. The tracks can be found in the resources directory. For this example I am just going to copy another mobs
sounds rather than create my own.
read and write entity to NBT allows the creature to be saved and loaded from your save.
So the next step would be to make sure you have all the sounds and textures which are specified in your class, using NPC you need to add the sounds to:
/jars/resources/newsound/mob/example.ogg and the texture needs to be added to:
/temp/minecraft/mob/example.png
You can get my MadCow texture below:
The sound is just the cow sound copied and renamed to example.ogg.
This now means that the entity class is finished.
Next you need to create a Model class. A model class basically provides minecraft with the details required to generate the "model" of the entity within minecraft. So these details are dependent upon your example.png texture. Since I am modelling this example off a cow I will be using mostly the same details as the ModelCow
class.
So as seen above we specify postions and orientation of the new creature. To create a totally new creature with all new dimensions and orientation you would need to play around with these numbers in the constructor a bit.
After creating the Model class we need to create a Render class, the render class provides a way of linking the Model class to the Entity class. Therefore we will create a new class named RenderExample.java the code is pretty bare boned and all it basically does is overwrite doRender and func_171_a to specify the
specific Entity class.
Now we have created all the necessary classes for our new NPC so the next step is to let minecraft know about them so that they can be generated. To do this you need to add some code to RenderManager.java within the constructor at the bottom of the list.
And you also need to add them to the necessary biome generator lists, this is done in the MobSpawnerBase class. Within the constructor add the Entity to the biomeCreature array.
After this is complete you can now compile and run your new NPC.
If you wish to create an aggressive NPC this is achieved by changing the Entity class slightly so that it extends EntityMobs instead of EntityAnimals. You will also need to change the MobSpawnerBase list if you want it to spawn at night rather than during the day.
Like the block class to achieve customisation of NPCs all that needs to be done is you need to overwrite the methods in the EntityCreature or EntityMobs classes this will allow the mobs to do basically anything.
End Result:
Added.
I am only teaching how to add things using MCP, extra utilities and Modloaders I am not going to give instructions on as this should be covered in their respective threads. Using the instructions given on those threads you should be able to covert any of my tutorials to become compatible with their mods.
Good to hear =)
That error is usually due to the compiling failing - you have to compile start.java to get start.class