If anyone is interested to see my latest mod, you can check it out here!
Welcome!
Welcome to my tutorial thread! My aim for this is to educate people on how to make many different things with modloader. If you have any questions, problems or tutorial requests then feel free to post them as it will be definately looked at! Enjoy :biggrin.gif:
Modloader Modding Starter's Guide
If you are new to modding, this is the guide for you. I don't recommend starting my tutorials unless you have read this guide first. Please note that if you need any help at all, feel free to post on the thread or if you don't want other people to know/see then send me a private message. Let's begin!
Step 1: Understanding the mod_Namehere file
What is this "mod_Namehere" file you might ask? Well, it's the very base and core of your mods and it holds a lot of the important information for them. It's like having vanilla ice-cream and making a chocolate ice-cream that is based off the vanilla one, you need a base. Let's take a look at the basic structure of it:
package net.minecraft.src;
public class mod_Namehere extends BaseMod
{
public mod_Namehere()
{
}
public String Version()
{
return "1.8.1";
}
}
Seems pretty simple, no? If not, I'm going to break it down for you. Firstly, at the top where it has a "package", that just tells the computer to group all of the minecraft's coding together in one...package. After that there is a line that has
public class mod_Namehere extends BaseMod
this means; the code is public, so it can be referenced from another "class", it is a class, it's called "mod_Namehere" and it extends this other class called "BaseMod". BaseMod is one of the ModLoader class files, which means that the "mod_Namehere" file uses the rules and ideas of that "BaseMod" class.
Then we have another "public" part. Notice it doesn't have the "class" word in it, as we have already defined that. This is the section that you put all of your ModLoader statements in. Now there's just one thing left, the version. As you can see it has the word "String" in it, all this means is that it will return some sort of text (In this case it's "1.8.1"). You can put absolutely whatever you please in between those speech marks. The only time you will see that "1.8.1" is when your mod crashes the game, it will show up in the modloader.txt file which tells you the error(s).
That's it for the basic "mod_Namehere" file! (Don't forget you can change the "Namehere" to whatever you want (Froot loopies!).
Step 2: Using the mod_Namehere file
The basic "mod_Namehere" might seem all fine and dandy to you, but now it's time to see what it looks like when you add in some code for a block (NOTE: This isn't the only file you need for a block!).
package net.minecraft.src;
public class mod_Namehere extends BaseMod
{
public static Block Namehere = new BlockNamehere(184, 0).setHardness(1.0F).setResistance(6000.0F).setLightValue(1.0F).setBlockName("Namehere");
public mod_Namehere()
{
ModLoader.RegisterBlock(Namehere);
Namehere.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Namehere.png");
ModLoader.AddName(Namehere, "Nameingamehere");
ModLoader.AddRecipe(new ItemStack(Namehere, 1), new Object[]{
"###", "###", "###", Character.valueOf('#'), Item.redstone
});
}
public String Version()
{
return "1.8.1";
}
}
I won't explain all of this as it is explained better in the "Block" tutorial. So basically the first long line "public static..." is outside those curly braces for the "public mod_Namehere()" section. That is all of the basic information on the block, like hardness etc. In the "public mod_Namehere()" section you have all of the ModLoader functions. Registering your block, giving your block a texture name and location, giving the block a name in-game and giving it a crafting recipe. That wasn't too hard now was it?
Step 2: Extra info. on the mod_Namehere file
This stuff I have just showed you isn't all the "mod_Namehere" file has to offer, oh no. There are many other things that you can do with it from other ModLoader functions to using to make properties files and generating your blocks. Go forth and don't be afraid to try new things other than just copy/pasting my tutorial's code!
Tutorial Request
If you want to see a certain tutorial here, then post it and I will add it to the list.
If you're having problems when running your mod on minecraft, then run this instead of minecraft.
How to copy an error log
1. Please put your code in-between
[code][/code.]
so it's easy to read.
(Don't use that ".")
2. When copying the error log, right click the recompile window and press "select all".
3. Then press enter, and copy it into a post (using step 1.) on my thread here.
Current tutorials are:
Block
Item
Tree + Sapling
Armor + Overlay + Effects
Sugarcane-like Plant
Advanced Block
Generating Properties File
Human NPC + Extras
Throwable Explosive e.g a grenade
Generating Ores
Liquid
Advanced Item
Crop
Explosive Block e.g TNT
Generation
Custom Mob
Throwable Item
Dimension e.g the Nether
Helpers
Anybody who I have seen helping a fair amount or giving good help will be put on this list. These are the rank levels, the diamond being the best and so on.
Current helpers are:
Rabisu (Thank you very much for helping when I'm not around!)
Groxmapper (Very informative help you have been giving)
Modloader Modding Setup
Things to get:
Minecraft Coders Pack
Notepad++
Java JDK
A brain
Modloader
7zip/WinRAR
Part 1
First of all we need to set up JDK,
1. Go to start, and right click on My Computer. Then click properties. Then advanced computer settings.
Click environmental variables
2. Is there a Path variable at the top? As the value does it say "C:\Program Files\Java\jdk1.6.0_24\bin", or something
like that? (If it does then you can skip this setup guide.)
3. Open your web browser, and download JDK SE. NOT JDK EE!
4. Once that downloads, and you set it up, open C:\Program Files\java\jdk1.6.0_24\bin, if the location is a bit different
that's OK, this is why we are doing this, to make sure we have the right location. You should see a heap of files with
the ".exe" extension. Right click on any one of them, and click properties, then copy the location.
5. Now navigate back to environmental variables(the first 2 steps) Click new, type "Path" (the capitalization matters)
as the name. Paste the location as the value.
You are now finished setting up JDK!
If you wanna make sure you did this properly, search CMD, hit enter, and type in "javac", push enter. If it gives you an error, then you did something wrong, if it gives you a long list of commands then, YAY! You did it!
--------------------------------------------------------------------------------------------------------------------------------------------
Part 2
Next, we need to set up MCP (Minecraft Coders Pack)
1. Download the latest MCP, and extract it to a folder on your desktop (doesn't have to be desktop, but it's just easier).
2. Now type in the search bar %appdata%, and hit enter. Look in your ".minecraft" folder and copy your "bin"
and "resources" folders. Go into your MCP folder and paste them into the "jars" folder.
3. (In MCP folder) Enter the bin folder and use 7zip to open "minecraft.jar" there should be a heap of files in it.
Keep that window open, now open the modloader file you downloaded, highlight all the files in it and drag 'n' drop them
into the "minecraft.jar" window. (Don't forget to delete the "META-INF" folder!)
4. Now run "decompile.bat" It should bring up a black window. Wait until it says "press any key to continue..." and do it.
(If it says something like "2 HUNKS OUT OF 2 FAILED" don't worry, it doesn't mean anything!
You have now finished setting up MCP!
SMP Modloader Modding Setup
Still yet to start this.
Java Tutorials
Before you go any further, you need to get Eclipse Classic (SDK) to make things 100 times easier! Why you ask? Because it has it's own built in compiler to test your code easily! Read on!
Chapter 1 - Understanding Java
Before you get any further in learning java, you need to understand the fundamentals.
Java symbols
Basic language definitions
Symbols
; Semi-colon, You put these at the end of every complete java statement.
* Multiply
/ Divide
! Not
<> Diamond operators
== Equals
!= Not equal to
>= Greater than or equal to
<= Smaller than or equal to
|| Or
&& And
++ and -- Increment operators, by using these you can tell the computer to either add one or minus one to whatever you use it with. (Explained properly later)
{} Curly brackets, these are the glue that holds together your code. They don't just make code look fancy but they also make it easier to understand for both you and your computer. Without these, the computer wouldn't be able to make sense of your code.
Language Definitions
Keyword A keyword is a word that has its own special meaning in the java programming language, and that meaning doesn't change from one program to another. Examples of keywords in java include if, else, and do.
Identifier An identifier is a name for something. The identifier's meaning can change from one program to another, but some identifiers meanings tend to change more. You can use your own meanings for your own words.
Float Can store 32 bits of information when it stores a variables values.
Double Can store 64 bits of information when it stores a variables values. The main difference between the two is how accurately it can display a number. Generally the better of the two which you will use more is double.
Byte, short, int, long Java has four types of whole numbers. Unlike float and double, the only thing that matters for these is the size of the number that you're trying to store. Below is the range of values that these words can use.
Byte - -128 to 127
Short - -32,768 to 32,767
Int - -2,147,483,648 to 2,147,483,647
Long - -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
boolean Put simply, a boolean just means that something can return either true or false instead of numbers or letters.
There is still alot of different things that I haven't covered. This is just basic stuff.
Chapter 2 - Starting out
In this chapter, I will ease you into making your first java program. Using the information from chapter 1 things should be a bit easier to understand.
"Hello World!" Program
Break down and explain the program
Hello World!
class Helloworld
{
public static void main(String args[])
{
System.out.println("Hello World!");
}
}
What this does is print Hello World! on the screen. "This seems like alot of work to print two words on the screen..." you say. Yes it is, but it will get easier. Still in progress.
Support
If you feel that my tutorials have helped you etc. Then please feel free to put this into your signature. (It will look like the banner at the top of this post)
package net.minecraft.src;
import java.util.Random;
public class BlockNamehere extends Block
{
public BlockNamehere(int i, int j)
{
super(i, j, Material.ground);
}
public int idDropped(int i, Random random)
{
return mod_Namehere.Namehere.blockID;
}
public int quantityDropped(Random random)
{
return 3;
}
}
mod_Namehere
package net.minecraft.src;
public class mod_Namehere extends BaseMod
{
public static Block Namehere = new BlockNamehere(190, 0).setHardness(1.0F).setResistance(6000.0F).setLightValue(1.0F).setBlockName("Namehere");
public String Version()
{
return "1.8.1";
}
public mod_Namehere()
{
ModLoader.RegisterBlock(Namehere);
Namehere.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Namehere.png");
ModLoader.AddName(Namehere, "Namehere");
ModLoader.AddRecipe(new ItemStack(Namehere, 1), new Object[] {
"###", "###", "###", Character.valueOf('#'), Item.redstone
});
}
}
Help: BlockNamehere
- Firstly, if you want to use some functions for your block, then have a look in "Block.java".
1. The line with this:
super(i, j, Material.ground);
. All you need to focus on is the "Material.ground" part. It can be any of the following:
//FOR MORE STATS ON THESE MATERIALS, LOOK AT THE BOTTOM OF "Material.java".
Material air; //You probably shouldn't use this one.
Material grass; //Pretty much the same as ground.
Material ground; //The block can be harvested when broken using this one.
Material wood; //It can be set on fire.
Material rock; // It can only be harvested with a pickaxe.
Material iron; // Can only be harvested with an iron pick or better.
Material water; //You probably shouldn't use this one.
Material lava; //You probably shouldn't use this one.
Material leaves; //It can burn.
Material plants; //You probably shouldn't use this one.
Material vine; //It can burn.
Material sponge; //You probably shouldn't use this one.
Material cloth; //It can burn.
Material fire; //You probably shouldn't use this one.
Material sand; //You probably shouldn't use this one.
Material circuits; //You probably shouldn't use this one.
Material glass; //You probably shouldn't use this one.
Material tnt; //You probably shouldn't use this one.
Material unused; //You probably shouldn't use this one.
Material ice; //You probably shouldn't use this one.
Material snow; //You probably shouldn't use this one.
Material craftedSnow; //You probably shouldn't use this one.
Material cactus; //You probably shouldn't use this one.
Material clay; //You probably shouldn't use this one.
Material pumpkin; //You probably shouldn't use this one.
Material portal; //You probably shouldn't use this one.
Material cakeMaterial; //You probably shouldn't use this one.
Material web; //You probably shouldn't use this one. Means it isn't solid.
Material piston; //You probably shouldn't use this one.
The main ones you need should use are the ground, rock and iron ones.
2. At this part:
return mod_Namehere.Namehere.blockID;
. If you leave it as it is now, it will drop the block you are making. If you want it to drop an item that is already part of the game, make it something like this:
return Item.redstone.shiftedIndex;
. For a block:
return Block.dirt.blockID;
3. For the bit like this:
return 3;
. You can make it drop more than one just by changing the "3" to whatever you want.
4. Navigate to this sort of path: "MCP\src\minecraft\net\minecraft\src" and save a copy of your file in there with the ".java" extension.
Help: mod_Namehere
1. This bit:
new BlockNamehere(190,
The 190 is the "ID" of your block. Block ID's can only go up to 255! Change it to an ID that isn't above 255 and isn't taken already by a block in the game.
2.
.setHardness(1.0F)
Is how hard it is to mine. For reference, dirt is 0.5F and stone is 1.5F.
3.
.setResistance(6000.0F)
Is how resistant to TNT the block is. For reference, all of the ores are 5.0F and obsidian is 2000.0F.
4.
.setLightValue(1.0F)
Is how much light you want it to give off (NOTE: The highest it can go is 1.0F!). For reference, torches are 0.9375F and redstone torches are 0.5F.
5.
.setBlockName("Namehere")
Is the name that it will look for in your code as the "code name".
6. At this part:
return "1.8.1";
in the version method, you can make that whatever you want in-between the " marks. It will show up in the modloader error log so people know what version it's made for.
Is where your texture is found and what it is called. Change the "/Namehere.png" to what it's called. If you wanted to be able to find it in a folder of the minecraft.jar, make it something like this: "/My Folder!/Namehere.png".
9.
ModLoader.AddName(Namehere, "Nameingamehere");
Is what it is called in-game. Make the first "Namehere" what you called the block in the ".setBlockName("Namehere")" part. The second "Namehere" is what it's called in-game.
10. To explain the "ModLoader.AddRecipe" part. The "Namehere" word is what you get from crafting it, and the 1 is how many of it you get. Each set of "###" bits are 3 spaces across in the crafting grid. Then it's saying that "If the character is the # symbol, make it equal to redstone for when crafting".
package net.minecraft.src;
import java.util.Random;
public class BlockNamehereWood extends Block
{
protected BlockNamehereWood(int i, int j)
{
super(i, j, Material.wood);
baseIndexInPNG = j;
}
public int quantityDropped(Random random)
{
return 1;
}
public int idDropped(int i, Random random)
{
return mod_NamehereTree.NamehereWood.blockID;
}
public int getBlockTextureFromSide(int i)
{
if(i == 1 || i == 0)
{
return 21;
} else
{
return baseIndexInPNG;
}
}
private int baseIndexInPNG;
}
mod_NamehereTree
package net.minecraft.src;
import java.util.Random;
public class mod_NamehereTree extends BaseMod
{
public String Version()
{
return "1.7.3";
}
public mod_NamehereTree()
{
ModLoader.AddName(NamehereLeaves, "Namehere Leaves");
ModLoader.AddName(NamehereWood, "Namehere Wood");
ModLoader.RegisterBlock(NamehereLeaves);
ModLoader.RegisterBlock(NamehereWood);
ModLoader.AddRecipe(new ItemStack(Block.planks, 4), new Object[] {
"#", Character.valueOf('#'), NamehereWood
});
ModLoader.AddSmelting(NamehereWood.blockID, new ItemStack(Item.coal, 1, 1));
}
public void GenerateSurface(World world, Random random, int i, int j)
{
BiomeGenBase biomegenbase = world.getWorldChunkManager().getBiomeGenAt(i, j);
WorldGenNamehereTrees worldgennameheretrees = new WorldGenNamehereTrees();
if((biomegenbase instanceof BiomeGenForest) || (biomegenbase instanceof BiomeGenForest))
{
int k = i + random.nextInt(16) + 8;
int l = j + random.nextInt(16) + 8;
int i1 = world.getHeightValue(k, l);
worldgennameheretrees.func_517_a(1.0D, 1.0D, 1.0D);
worldgennameheretrees.generate(world, random, k, i1, l);
}
}
public static final Block NamehereLeaves;
public static final Block NamehereWood;
static
{
NamehereLeaves = (new BlockNamehereLeaves(124, ModLoader.addOverride("/terrain.png", "/NamehereLeaves.png"))).setHardness(0.2F).setLightOpacity(1).setStepSound(Block.soundGrassFootstep).setBlockName("NamehereLeaves").disableStats();
NamehereWood = (new BlockNamehereWood(125, ModLoader.addOverride("/terrain.png", "/NamehereWood.png"))).setHardness(2.0F).setStepSound(Block.soundWoodFootstep).setBlockName("NamehereWood");
}
}
package net.minecraft.src;
import java.util.Random;
public class BlockNameheresapling extends BlockFlower
{
protected BlockNameheresapling(int i, int j)
{
super(i, j);
float f = 0.4F;
setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f);
}
public void updateTick(World world, int i, int j, int k, Random random)
{
if(world.multiplayerWorld)
{
return;
}
super.updateTick(world, i, j, k, random);
if(world.getBlockLightValue(i, j + 1, k) >= 9 && random.nextInt(30) == 0)
{
int l = world.getBlockMetadata(i, j, k);
if((l & 8) == 0)
{
world.setBlockMetadataWithNotify(i, j, k, l | 8);
} else
{
growTree(world, i, j, k, random);
}
}
}
public void growTree(World world, int i, int j, int k, Random random)
{
int l = world.getBlockMetadata(i, j, k) & 3;
world.setBlock(i, j, k, 0);
Object obj = null;
if(l == 1)
{
obj = new WorldGenTaiga2();
} else
if(l == 2)
{
obj = new WorldGenForest();
} else
{
obj = new WorldGenNamehereTrees();
if(random.nextInt(10) == 0)
{
obj = new WorldGenBigTree();
}
}
if(!((WorldGenerator) (obj)).generate(world, random, i, j, k))
{
world.setBlockAndMetadata(i, j, k, blockID, l);
}
}
public int idDropped(int i, Random random)
{
return mod_NamehereTree.Nameheresapling.blockID;
}
}
Help: BlockNamehereLeaves
1. READ THE BLOCK TUTORIAL FIRST!
1.5. For the ID dropped part, change the 3 to how rare you want your block/item to drop from leaves. Leave the rest of that Id dropped part.
2. At the public void updateblabla, fill in all the Namehere's.
3. Leave the rest of this file.
Help: BlockNamehereWood
1. Just change names that need to be changed.
2. Ignore all the other stuff.
Help: mod_NamehereTree
1. If you've read the block tutorial, then you will know just about all of this.
2. At the public generate surfacce whatever bit, where it has the int's and the (16)'s
mess around with this to change how it generates, I'm not too sure just yet.
Help: WorldGenNamehereTrees
1. All you have to do for this is change the Namehere's and so on.
2. More experienced modders can mess with it to try something different.
package net.minecraft.src;
import java.util.Random;
public class BlockNamehere extends Block
{
protected BlockNamehere(int i, int j)
{
super(i, Material.plants);
blockIndexInTexture = j;
float f = 0.375F;
setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 1.0F, 0.5F + f);
setTickOnLoad(true);
}
public void updateTick(World world, int i, int j, int k, Random random)
{
if(world.isAirBlock(i, j + 1, k))
{
int l;
for(l = 1; world.getBlockId(i, j - l, k) == blockID; l++) { }
if(l < 3)
{
int i1 = world.getBlockMetadata(i, j, k);
if(i1 == 15)
{
world.setBlockWithNotify(i, j + 1, k, blockID);
world.setBlockMetadataWithNotify(i, j, k, 0);
} else
{
world.setBlockMetadataWithNotify(i, j, k, i1 + 1);
}
}
}
}
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
int l = world.getBlockId(i, j - 1, k);
if(l == blockID)
{
return true;
}
return l == Block.grass.blockID || l == Block.dirt.blockID;
}
public void onNeighborBlockChange(World world, int i, int j, int k, int l)
{
checkBlockCoordValid(world, i, j, k);
}
protected final void checkBlockCoordValid(World world, int i, int j, int k)
{
if(!canBlockStay(world, i, j, k))
{
dropBlockAsItem(world, i, j, k, world.getBlockMetadata(i, j, k));
world.setBlockWithNotify(i, j, k, 0);
}
}
public boolean canBlockStay(World world, int i, int j, int k)
{
return canPlaceBlockAt(world, i, j, k);
}
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k)
{
return null;
}
public int idDropped(int i, Random random)
{
return mod_Namehere.Namehere.blockID;
}
public boolean isOpaqueCube()
{
return false;
}
public boolean renderAsNormalBlock()
{
return false;
}
public int getRenderType()
{
return 1;
}
}
Help: mod_Namehere
1. Where it has all of this stuff, (4 parts to it)
You can copy paste more onto the end to make it grow to a bigger height. Of course, you need to change some numbers around. Just look for the pattern.
Help: BlockNamehere
1. At this bit:
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
int l = world.getBlockId(i, j - 1, k);
if(l == blockID)
{
return true;
}
return l == Block.grass.blockID || l == Block.dirt.blockID;
You can change it or add more blocks to what you want it to be able to be placed on.
2. Your sugarcane-like plant will spawn on grass/dirt but for some reason it won't be beside water.
public BlockNamehere(int i, int j)
{
super(i, j, Material.ground);
slipperiness = 1.5F;
}
Bouncy Block
1. Add this to your BlockNamehere:
public void onEntityWalking(World world, int x, int y, int z, Entity entity)
{
entity.motionY += 2.0;
}
so it would go here:
public int idDropped(int i, Random random)
{
return mod_Namehere.Namehere.blockID;
}
public void onEntityWalking(World world, int x, int y, int z, Entity entity)
{
entity.motionY += 2.0;
}
public int quantityDropped(Random random)
{
return 1;
}
}
Change the 2 to whatever you want, 5 will shoot you sky high!
Damage on contact
1. Put this in your BlockNamehere:
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k)
{
float f = 0.0625F;
return AxisAlignedBB.getBoundingBoxFromPool((float)i + f, j, (float)k + f, (float)(i + 1) - f, (float)(j + 1) - f, (float)(k + 1) - f);
}
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int i, int j, int k)
{
float f = 0.0625F;
return AxisAlignedBB.getBoundingBoxFromPool((float)i + f, j, (float)k + f, (float)(i + 1) - f, j + 1, (float)(k + 1) - f);
}
public void onEntityCollidedWithBlock(World world, int i, int j, int k, Entity entity)
{
entity.attackEntityFrom(null, 4);
}
So it would fit in here:
public int quantityDropped(Random random)
{
return 1;
}
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k)
{
float f = 0.0625F;
return AxisAlignedBB.getBoundingBoxFromPool((float)i + f, j, (float)k + f, (float)(i + 1) - f, (float)(j + 1) - f, (float)(k + 1) - f);
}
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int i, int j, int k)
{
float f = 0.0625F;
return AxisAlignedBB.getBoundingBoxFromPool((float)i + f, j, (float)k + f, (float)(i + 1) - f, j + 1, (float)(k + 1) - f);
}
public void onEntityCollidedWithBlock(World world, int i, int j, int k, Entity entity)
{
entity.attackEntityFrom(DamageSource.causeThrownDamage(entity, entity), 4);
}
}
2. The 4 at the bottom is how many half-hearts of damage it does when you walk into it.
3. If you want it to heal you on contact, then change it to something like this:
entity.attackEntityFrom(null, -4);
4. The only downside to the heal block is the player still makes the hurt sounds...
Redstone Activation
1. All you do differently in the mod_* file is in the static the block has "false" in it. That is what it's normal state is.
mod_Namehere
package net.minecraft.src;
public class mod_Namehere extends BaseMod
{
public static Block Namehere;
public mod_Namehere()
{
ModLoader.AddName(Namehere, "Namehere");
ModLoader.RegisterBlock(Namehere);
}
public String Version()
{
return "1.8.1";
}
static
{
Namehere = (new BlockNamehere(233, ModLoader.addOverride("/terrain.png", "/Namehere.png"), false)).setHardness(0.2F).setBlockName("Namehere");
}
}
BlockNamehere
package net.minecraft.src;
import java.util.Random;
public class BlockNamehere extends Block
{
public BlockNamehere(int i, int j, boolean flag)
{
super(i, Material.ground);
blockIndexInTexture = j;
}
public int idDropped(int i, Random random)
{
return mod_Namehere.Namehere.blockID;
}
public void onNeighborBlockChange(World world, int i, int j, int k, int l)
{
if(world.isBlockIndirectlyGettingPowered(i, j, k))
{
world.setBlockWithNotify(i, j + 1, k, Block.fire.blockID);
} else
{
world.setBlockWithNotify(i, j + 1, k, 0);
}
}
}
1. Everything is the same as normal up until the "onNeighborBlockChange" method.
2. Basically what it's saying it "If I'm getting powered, put a block of fire above me and if not, then put nothing there."
3. Refer to the "Structure Maker" tutorial for more help.
Heal on contact
1. Add this to your BlockNamehere file:
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k)
{
float f = 0.0625F;
return AxisAlignedBB.getBoundingBoxFromPool((float)i + f, j, (float)k + f, (float)(i + 1) - f, (float)(j + 1) - f, (float)(k + 1) - f);
}
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int i, int j, int k)
{
float f = 0.0625F;
return AxisAlignedBB.getBoundingBoxFromPool((float)i + f, j, (float)k + f, (float)(i + 1) - f, j + 1, (float)(k + 1) - f);
}
public void onEntityCollidedWithBlock(World world, int i, int j, int k, Entity entity)
{
if(ModLoader.getMinecraftInstance().thePlayer.health < 20)
{
ModLoader.getMinecraftInstance().thePlayer.heal(4);
}
}
2. Change the 4 at the bottom to how many half hearts you want it to heal you.
3. NOTE: It heals you very fast!
Structure Maker
mod_Namehere
package net.minecraft.src;
public class mod_Namehere extends BaseMod
{
public static final Block Namehere;
public mod_Namehere()
{
ModLoader.AddName(Namehere, "Namehere Block");
ModLoader.RegisterBlock(Namehere);
}
public String Version()
{
return "1.8.1";
}
static
{
Namehere = (new BlockNamehere(181, ModLoader.addOverride("/terrain.png", "/Namehere.png"))).setHardness(0.0F).setBlockName("Namehere");
}
}
BlockNamehere
package net.minecraft.src;
public class BlockNamehere extends Block
{
private World worldObj;
protected BlockNamehere(int i, int j)
{
super(i, j, Material.ground);
}
public void onBlockClicked(World world, int i, int j, int k, EntityPlayer entityplayer)
{
world.setBlockWithNotify(i, j + 1, k, Block.dirt.blockID);
world.setBlockWithNotify(i, j + 2, k, Block.dirt.blockID);
world.setBlockWithNotify(i, j + 3, k, Block.dirt.blockID);
world.setBlockWithNotify(i, j + 4, k, Block.dirt.blockID);
world.setBlockWithNotify(i, j + 5, k, Block.dirt.blockID);
world.setBlockWithNotify(i, j + 6, k, Block.dirt.blockID);
world.setBlockWithNotify(i, j + 7, k, Block.dirt.blockID);
world.setBlockWithNotify(i, j + 8, k, Block.dirt.blockID);
}
}
Help: mod_Namehere
1. Note: The way the code is done in this may look different but it makes things
Help: BlockNamehere
1. Everything is same as normal except for the "onBlockClicked" method.
2. In the "world.setBlockWithNotify" statements, the i, j, k letters stand for the coordinates x, y, z. After that it is saying what block it will put at those coordinates.
3. Optionally, if you are using the same block over and over and want to make it easier to write, you could set an integer like this:
package net.minecraft.src;
import java.io.*;
import java.util.Map;
import java.util.Random;
import net.minecraft.client.Minecraft;
public class mod_Namehere extends BaseMod
{
public mod_Namehere()
{
NamehereProperties namehereproperties = new NamehereProperties();
try
{
File file = new File((new StringBuilder()).append(Minecraft.getMinecraftDir()).append("/Namehere.properties").toString());
boolean flag = file.createNewFile();
if(flag)
{
FileOutputStream fileoutputstream = new FileOutputStream(file);
namehereproperties.setProperty("idNamehere", Integer.toString(defaultNamehere));
namehereproperties.store(fileoutputstream, "fglkjdgflgksdf");
fileoutputstream.close();
}
namehereproperties.load(new FileInputStream((new StringBuilder()).append(Minecraft.getMinecraftDir()).append("/Namehere.properties").toString()));
idNamehere = Integer.parseInt(namehereproperties.getProperty("idNamehere"));
}
catch(IOException ioexception)
{
ioexception.printStackTrace();
}
Block Namehere = (new BlockNamehere(idNamehere, 0)).setLightValue(1.0F).setHardness(3F).setResistance(0F).setBlockName("Namehere");
ModLoader.RegisterBlock(Namehere);
Namehere.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Namehere.png");
ModLoader.AddName(Namehere, "Namehere");
ModLoader.AddRecipe(new ItemStack(Namehere, 1), new Object[] {
"XXX", "XXX", "XXX", Character.valueOf('X'), Block.dirt
});
}
public String Version()
{
return "1.7.3";
}
public static Block Namehere;
public static int idNamehere;
public static int defaultNamehere = 109;
}
BlockNamehere
package net.minecraft.src;
import java.util.Random;
public class BlockNamehere extends Block
{
protected BlockNamehere(int i, int j)
{
super(i, j, Material.ground);
}
public int idDropped(int i, Random random)
{
return mod_Namehere.Namehere.blockID;
}
}
NamehereProperties
package net.minecraft.src;
import java.util.*;
public class NamehereProperties extends Properties
{
public NamehereProperties()
{
}
public synchronized Enumeration keys()
{
Enumeration enumeration = super.keys();
Vector vector = new Vector();
for(; enumeration.hasMoreElements(); vector.add(enumeration.nextElement())) { }
Collections.sort(vector);
return vector.elements();
}
}
Help: mod_Namehere
1. Some of the stuff at the very top I don't think you need but it doesn't matter.
2. At the but that says this:
File file = new File((new StringBuilder()).append(Minecraft.getMinecraftDir()).append("/Namehere.properties").toString());
for the ("/Namehere.properties") This is where you will find the generated properties file. So in this case it will just be in the .minecraft folder.
3. Keep changing the Namehere's up until this bit:
you change the namehere at the start of it and the random jumble of letters is what it will say in the properties file if you wanted to put a message in.
4. Keep changing all the Namehere's and... recompile + reob. Mod your minecraft, start the game, close it and have a look in .minecraft! There is your properties file!! Yay!
Help: BlockNamehere
1. Same as normal...
Help: NamehereProperties
1. Leave everything here except for changing the Namehere's.
package net.minecraft.src;
public class EntityNamehere extends EntityCreature
{
public EntityNamehere(World world)
{
super(world);
texture = "/Namehere.png";
moveSpeed = 0.5F;
attackStrength = 2;
isImmuneToFire = false;
}
protected int getDropItemId()
{
return Item.swordStone.shiftedIndex;
}
public boolean canBreatheUnderwater()
{
return false;
}
protected boolean canDespawn()
{
return false;
}
public void onEntityDeath()
{
//If you know what you're doing, you can make it
//do cool things. e.g. explode like creeper.
}
}
mod_Namehere
package net.minecraft.src;
import java.lang.reflect.Method;
import java.util.Map;
public class mod_Namehere extends BaseMod
{
public mod_Namehere()
{
ModLoader.RegisterEntityID(EntityNamehere.class, "Namehere", ModLoader.getUniqueEntityId());
ModLoader.AddSpawn(EntityNamehere.class, 8, 4, 10, EnumCreatureType.creature);
}
public void AddRenderer(Map map)
{
map.put(EntityNamehere.class, new RenderBiped(new ModelBiped(), 0.5F));
}
public String Version()
{
return "1.7.3";
}
}
Help: EntityNamehere
1. At the top, you can make it extend any of these: EntityCreature, EntityMob, EntityWaterMob. This changes the way it moves and it's behaviour.
2. Change whatever you want at the top like movespeed etc. The attack strength is how many half hearts of damage it does. If you want it immune to fire then make it "true".
3. The rest is self explaining. The texture is the exact same as what you'd use as your own skin.
4. Make the canBreatheUnderwater "true" if you want it to well...breathe underwater.
5. If you never want it to despawn other than by being killed, set the canDespawn to "true".
6. Take out the attackStrength if it isn't a hostile mob.
Help: mod_Namehere
1. At this part, change the Namehere between these " symbols to what you want it to be called in-game.
2. The 8 on the next line is the probability of the amount being spawned. If you have other NPC's in the same mod_Namehere file, think of it as a pie chart. Say one has 4 and one has 7, it will divide the total (11) between them. So the one with 4 has a probability of 4/11 chance of spawning.
2.1. The 4 is the minimum spawned per chunk.
2.2. The 10 is the max spawned per chunk.
3. For the enumcreatureblabla, you can make it one of these: monster, creature, waterCreature. This is how/where it spawns.
Making it Hold Something
1. If you want it to hold something, then make your EntityNamehere like this:
package net.minecraft.src;
public class EntityNamehere extends EntityCreature
{
public EntityNamehere(World world)
{
super(world);
texture = "/Namehere.png";
}
protected int getDropItemId()
{
return Item.swordStone.shiftedIndex;
}
public ItemStack getHeldItem()
{
return defaultHeldItem;
}
private static final ItemStack defaultHeldItem;
static
{
defaultHeldItem = new ItemStack(Item.swordStone, 1);
}
}
2. Just change the Item.swordStone to whatever you want.
Making it say something (right click)
1. To make it say something on right click add this to your EntityNamehere file:
public boolean interact(EntityPlayer entityplayer)
{
ModLoader.getMinecraftInstance().thePlayer.addChatMessage("Hello there!");
return true;
}
2. You can duplicate this ModLoader line to make it say other stuff on new lines.
Displaying a Name Above It
- This is to make your NPC have a name displayed above it's head.
mod_Namehere
package net.minecraft.src;
import java.lang.reflect.Method;
import java.util.Map;
public class mod_Namehere extends BaseMod
{
public mod_Namehere()
{
ModLoader.RegisterEntityID(EntityNamehere.class, "Namehere", ModLoader.getUniqueEntityId());
ModLoader.AddSpawn(EntityNamehere.class, 8, 4, 10, EnumCreatureType.creature);
}
public void AddRenderer(Map map)
{
map.put(EntityNamehere.class, new RenderNamehere(new ModelBiped(), 0.5F));
}
public String Version()
{
return "1.7.3";
}
}
EntityNamehere
package net.minecraft.src;
public class EntityNamehere extends EntityCreature
{
public EntityNamehere(World world)
{
super(world);
texture = "/Namehere.png";
moveSpeed = 0.5F;
isImmuneToFire = false;
npcName = "Evil Strength";
}
protected int getDropItemId()
{
return Item.swordStone.shiftedIndex;
}
public boolean canBreatheUnderwater()
{
return false;
}
protected boolean canDespawn()
{
return false;
}
public void onEntityDeath()
{
//If you know what you're doing, you can make it
//do cool things. e.g. explode like creeper.
}
public String npcName;
}
1. All the same as normal Human NPC, just that it has "RenderNamehere" instead of "Biped".
Help: EntityNamehere
1. Same. Just change the "Evil Strength" in this part at the top:
npcName = "Evil Strength";
Help: RenderNamehere
1. NOTE: Capitalization matters!
2. Just name changing in here except for the "preRenderScale" method, you can change those 1.0F bits to mess with the size of the name.
3. Make sure you leave the "A" on the bits that need it. It can be anything you want just as long as it's not the same as the other names like just "RenderNamehere".
Don't forget to add this to the top of your mod_Namehere file:
import java.util.*;
So it would fit like this:
package net.minecraft.src;
import java.util.*;
public class mod_Namehere extends BaseMod
mod_Namehere
public void GenerateSurface(World world, Random rand, int chunkX, int chunkZ)
{
for(int i = 0; i < RARITY; i++)
{
int randPosX = chunkX + rand.nextInt(16);
int randPosY = rand.nextInt(HEIGHT ABOVE BEDROCK);
int randPosZ = chunkZ + rand.nextInt(16);
(new WorldGenMinable(mod_Namehere.Namehere.blockID, VEIN SIZE)).generate(world, rand, randPosX, randPosY, randPosZ);
}
}
Help: mod_Namehere
1. Put this bit of code outside all of the modloader stuff.
2. RARITY is... how rare it is. For reference coal is 20.
3. HEIGHT ABOVE BEDROCK is self explanatory. If you set it to 20, you can find it generating 20 levels above bedrock.
4. VEIN SIZE is the max amount that it generates together.
5. The mod_Namehere.Namehere.blockID is what block it generates.
package net.minecraft.src;
public class mod_Namehere extends BaseMod
{
public static final Block NamehereliquidMoving = new BlockFlowingNamehere(233, Material.water).setHardness(100F).setLightOpacity(3).setBlockName("Namehere").disableStats().setRequiresSelfNotify();
public static final Block NamehereliquidStill = new BlockStationaryNamehere(234, Material.water).setHardness(100F).setLightOpacity(3).setBlockName("Namehere").disableStats().setRequiresSelfNotify();
public mod_Namehere()
{
ModLoader.RegisterBlock(NamehereliquidMoving);
ModLoader.RegisterBlock(NamehereliquidStill);
ModLoader.AddName(NamehereliquidMoving, "Namehere Moving");
ModLoader.AddName(NamehereliquidStill, "Namehere Still");
}
public String Version()
{
return "1.8.1";
}
}
BlockFlowingNamehere
package net.minecraft.src;
import java.util.Random;
public class BlockFlowingNamehere extends BlockFluid
{
protected BlockFlowingNamehere(int i, Material material)
{
super(i, material);
numAdjacentSources = 0;
isOptimalFlowDirection = new boolean[4];
flowCost = new int[4];
}
public int colorMultiplier(IBlockAccess iblockaccess, int i, int j, int k)
{
return 0xffffff;
}
private void func_30003_j(World world, int i, int j, int k)
{
int l = world.getBlockMetadata(i, j, k);
world.setBlockAndMetadata(i, j, k, blockID + 1, l);
world.markBlocksDirty(i, j, k, i, j, k);
world.markBlockNeedsUpdate(i, j, k);
}
public void updateTick(World world, int i, int j, int k, Random random)
{
int l = getFlowDecay(world, i, j, k);
byte byte0 = 1;
if(blockMaterial == Material.lava && !world.worldProvider.isHellWorld)
{
byte0 = 2;
}
boolean flag = true;
if(l > 0)
{
int i1 = -100;
numAdjacentSources = 0;
i1 = getSmallestFlowDecay(world, i - 1, j, k, i1);
i1 = getSmallestFlowDecay(world, i + 1, j, k, i1);
i1 = getSmallestFlowDecay(world, i, j, k - 1, i1);
i1 = getSmallestFlowDecay(world, i, j, k + 1, i1);
int j1 = i1 + byte0;
if(j1 >= 8 || i1 < 0)
{
j1 = -1;
}
if(getFlowDecay(world, i, j + 1, k) >= 0)
{
int l1 = getFlowDecay(world, i, j + 1, k);
if(l1 >= 8)
{
j1 = l1;
} else
{
j1 = l1 + 8;
}
}
if(numAdjacentSources >= 2 && blockMaterial == Material.water)
{
if(world.getBlockMaterial(i, j - 1, k).isSolid())
{
j1 = 0;
} else
if(world.getBlockMaterial(i, j - 1, k) == blockMaterial && world.getBlockMetadata(i, j, k) == 0)
{
j1 = 0;
}
}
if(blockMaterial == Material.lava && l < 8 && j1 < 8 && j1 > l && random.nextInt(4) != 0)
{
j1 = l;
flag = false;
}
if(j1 != l)
{
l = j1;
if(l < 0)
{
world.setBlockWithNotify(i, j, k, 0);
} else
{
world.setBlockMetadataWithNotify(i, j, k, l);
world.scheduleBlockUpdate(i, j, k, blockID, tickRate());
world.notifyBlocksOfNeighborChange(i, j, k, blockID);
}
} else
if(flag)
{
func_30003_j(world, i, j, k);
}
} else
{
func_30003_j(world, i, j, k);
}
if(liquidCanDisplaceBlock(world, i, j - 1, k))
{
if(l >= 8)
{
world.setBlockAndMetadataWithNotify(i, j - 1, k, blockID, l);
} else
{
world.setBlockAndMetadataWithNotify(i, j - 1, k, blockID, l + 8);
}
} else
if(l >= 0 && (l == 0 || blockBlocksFlow(world, i, j - 1, k)))
{
boolean aflag[] = getOptimalFlowDirections(world, i, j, k);
int k1 = l + byte0;
if(l >= 8)
{
k1 = 1;
}
if(k1 >= 8)
{
return;
}
if(aflag[0])
{
flowIntoBlock(world, i - 1, j, k, k1);
}
if(aflag[1])
{
flowIntoBlock(world, i + 1, j, k, k1);
}
if(aflag[2])
{
flowIntoBlock(world, i, j, k - 1, k1);
}
if(aflag[3])
{
flowIntoBlock(world, i, j, k + 1, k1);
}
}
}
private void flowIntoBlock(World world, int i, int j, int k, int l)
{
if(liquidCanDisplaceBlock(world, i, j, k))
{
int i1 = world.getBlockId(i, j, k);
if(i1 > 0)
{
if(blockMaterial == Material.lava)
{
triggerLavaMixEffects(world, i, j, k);
} else
{
Block.blocksList[i1].dropBlockAsItem(world, i, j, k, world.getBlockMetadata(i, j, k));
}
}
world.setBlockAndMetadataWithNotify(i, j, k, blockID, l);
}
}
private int calculateFlowCost(World world, int i, int j, int k, int l, int i1)
{
int j1 = 1000;
for(int k1 = 0; k1 < 4; k1++)
{
if(k1 == 0 && i1 == 1 || k1 == 1 && i1 == 0 || k1 == 2 && i1 == 3 || k1 == 3 && i1 == 2)
{
continue;
}
int l1 = i;
int i2 = j;
int j2 = k;
if(k1 == 0)
{
l1--;
}
if(k1 == 1)
{
l1++;
}
if(k1 == 2)
{
j2--;
}
if(k1 == 3)
{
j2++;
}
if(blockBlocksFlow(world, l1, i2, j2) || world.getBlockMaterial(l1, i2, j2) == blockMaterial && world.getBlockMetadata(l1, i2, j2) == 0)
{
continue;
}
if(!blockBlocksFlow(world, l1, i2 - 1, j2))
{
return l;
}
if(l >= 4)
{
continue;
}
int k2 = calculateFlowCost(world, l1, i2, j2, l + 1, k1);
if(k2 < j1)
{
j1 = k2;
}
}
return j1;
}
private boolean[] getOptimalFlowDirections(World world, int i, int j, int k)
{
for(int l = 0; l < 4; l++)
{
flowCost[l] = 1000;
int j1 = i;
int i2 = j;
int j2 = k;
if(l == 0)
{
j1--;
}
if(l == 1)
{
j1++;
}
if(l == 2)
{
j2--;
}
if(l == 3)
{
j2++;
}
if(blockBlocksFlow(world, j1, i2, j2) || world.getBlockMaterial(j1, i2, j2) == blockMaterial && world.getBlockMetadata(j1, i2, j2) == 0)
{
continue;
}
if(!blockBlocksFlow(world, j1, i2 - 1, j2))
{
flowCost[l] = 0;
} else
{
flowCost[l] = calculateFlowCost(world, j1, i2, j2, 1, l);
}
}
int i1 = flowCost[0];
for(int k1 = 1; k1 < 4; k1++)
{
if(flowCost[k1] < i1)
{
i1 = flowCost[k1];
}
}
for(int l1 = 0; l1 < 4; l1++)
{
isOptimalFlowDirection[l1] = flowCost[l1] == i1;
}
return isOptimalFlowDirection;
}
private boolean blockBlocksFlow(World world, int i, int j, int k)
{
int l = world.getBlockId(i, j, k);
if(l == Block.doorWood.blockID || l == Block.doorSteel.blockID || l == Block.signPost.blockID || l == Block.ladder.blockID || l == Block.reed.blockID)
{
return true;
}
if(l == 0)
{
return false;
}
Material material = Block.blocksList[l].blockMaterial;
return material.getIsSolid();
}
protected int getSmallestFlowDecay(World world, int i, int j, int k, int l)
{
int i1 = getFlowDecay(world, i, j, k);
if(i1 < 0)
{
return l;
}
if(i1 == 0)
{
numAdjacentSources++;
}
if(i1 >= 8)
{
i1 = 0;
}
return l >= 0 && i1 >= l ? l : i1;
}
private boolean liquidCanDisplaceBlock(World world, int i, int j, int k)
{
Material material = world.getBlockMaterial(i, j, k);
if(material == blockMaterial)
{
return false;
}
if(material == Material.lava)
{
return false;
} else
{
return !blockBlocksFlow(world, i, j, k);
}
}
public void onBlockAdded(World world, int i, int j, int k)
{
super.onBlockAdded(world, i, j, k);
if(world.getBlockId(i, j, k) == blockID)
{
world.scheduleBlockUpdate(i, j, k, blockID, tickRate());
}
}
int numAdjacentSources;
boolean isOptimalFlowDirection[];
int flowCost[];
}
BlockStationaryNamehere
package net.minecraft.src;
import java.util.Random;
public class BlockStationaryNamehere extends BlockFluid
{
protected BlockStationaryNamehere(int i, Material material)
{
super(i, material);
setTickOnLoad(false);
if(material == Material.lava)
{
setTickOnLoad(true);
}
}
public int colorMultiplier(IBlockAccess iblockaccess, int i, int j, int k)
{
return 0xffffff;
}
public void onNeighborBlockChange(World world, int i, int j, int k, int l)
{
super.onNeighborBlockChange(world, i, j, k, l);
if(world.getBlockId(i, j, k) == blockID)
{
func_30004_j(world, i, j, k);
}
}
private void func_30004_j(World world, int i, int j, int k)
{
int l = world.getBlockMetadata(i, j, k);
world.editingBlocks = true;
world.setBlockAndMetadata(i, j, k, blockID - 1, l);
world.markBlocksDirty(i, j, k, i, j, k);
world.scheduleBlockUpdate(i, j, k, blockID - 1, tickRate());
world.editingBlocks = false;
}
public void updateTick(World world, int i, int j, int k, Random random)
{
if(blockMaterial == Material.lava)
{
int l = random.nextInt(3);
for(int i1 = 0; i1 < l; i1++)
{
i += random.nextInt(3) - 1;
j++;
k += random.nextInt(3) - 1;
int j1 = world.getBlockId(i, j, k);
if(j1 == 0)
{
if(func_301_k(world, i - 1, j, k) || func_301_k(world, i + 1, j, k) || func_301_k(world, i, j, k - 1) || func_301_k(world, i, j, k + 1) || func_301_k(world, i, j - 1, k) || func_301_k(world, i, j + 1, k))
{
world.setBlockWithNotify(i, j, k, Block.fire.blockID);
return;
}
continue;
}
if(Block.blocksList[j1].blockMaterial.getIsSolid())
{
return;
}
}
}
}
private boolean func_301_k(World world, int i, int j, int k)
{
return world.getBlockMaterial(i, j, k).getBurning();
}
}
Help: mod_Namehere
1. The two statements at the top where it says "material.water", you can make that either water or lava.
2. The ".setLightOpacity" is how easily light can shine through the liquid.
3. Everything is same as normal.
Help: BlockFlowingNamehere
1. Don't change anything besides what I tell you to unless you know what you're doing.
2. The colorMultiplier part at the top, you can change what it returns to a color code. This determines the color of your liquid.
Help: BlockStationaryNamehere
1. Same as above, Have a look in the BlockFluid etc. files in minecraft to see more.
package net.minecraft.src;
import java.util.*;
public class ItemNamehere extends Item
{
public ItemNamehere(int i)
{
super(i);
maxStackSize = 1;
setMaxDamage(40);
}
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
{
if(itemstack.getItemDamage() == 0)
{
itemstack.damageItem(40, entityplayer);
}
return itemstack;
}
public void onUpdate(ItemStack itemstack, World world, Entity entity, int i, boolean flag)
{
if(itemstack.getItemDamage() != 0)
{
itemstack.damageItem(-1, entity);
}
}
}
mod_Namehere
package net.minecraft.src;
public class mod_Namehere extends BaseMod
{
public static Item Namehere = (new ItemNamehere(30438)).setItemName("Namehere");
public mod_Namehere()
{
Namehere.iconIndex = ModLoader.addOverride("/gui/items.png", "/Namehere.png");
ModLoader.AddName(Namehere, "Namehere");
}
public String Version()
{
return "1.8.1";
}
}
Help: ItemNamehere
1. Change the 40 in "setMaxDamage(40);" to whatever number you want. This will be how much/long it has to recharge.
2. Again, change the 40 in "itemstack.damageItem(40, entityplayer);" to the number you put in step 1. This is how much the recharge bar goes down on use.
3. Leave everything else as is.
Help: mod_Namehere
1. Same as normal.
Food
mod_Namehere
package net.minecraft.src;
public class mod_Namehere extends BaseMod
{
public static Item Namehere = (new ItemFood(28000, 4, 1F, false)).setItemName("Namehere");
public mod_Namehere()
{
Namehere.iconIndex = ModLoader.addOverride("/gui/items.png", "/Namehere.png");
ModLoader.AddName(Namehere, "Namehere");
}
public String Version()
{
return "1.8.1";
}
}
Help: mod_Namehere
1. Everything is the same as normal except for the line towards the top. (public static Item Namehere = Bla...)
2. The 4 in that line is the amount of hunger it heals you by. (1 = Half of one icon)
3. The "1F" is left unchanged.
4. The "false" is to tell whether or not it can be eaten by a wolf.
Spawning Mobs
ItemNamehere
package net.minecraft.src;
import java.util.*;
public class ItemNamehere extends Item
{
private World worldObj;
public ItemNamehere (int i)
{
super(i);
maxStackSize = 1;
}
public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l)
{
if(!world.multiplayerWorld)
{
ModLoader.getMinecraftInstance().thePlayer.addChatMessage("Summoned a pig!");
EntityLiving entityliving = (EntityLiving)EntityList.createEntityInWorld("Pig", entityplayer.worldObj);
entityliving.setLocationAndAngles(i, j + 1, k, 0F, 0F);
entityplayer.worldObj.entityJoinedWorld(entityliving);
entityplayer.swingItem();
}
return true;
}
}
mod_Namehere
package net.minecraft.src;
public class mod_Namehere extends BaseMod
{
public static Item Namehere = (new ItemNamehere(30439)).setItemName("Namehere");
public mod_Namehere()
{
Namehere.iconIndex = ModLoader.addOverride("/gui/items.png", "/Namehere.png");
ModLoader.AddName(Namehere, "Namehere");
}
public String Version()
{
return "1.8.1";
}
}
Help: ItemNamehere
1. See the bit at the top where it says "private World worldObj;"? That is just declaring a variable for the worldObj function. You may not need it but I prefer to keep it anyway.
2. Setting the max stack size to 1..
3. Then in the right click method it is saying that if the world is not equal to a multiplayer world, then execute this code.
4. The first line in there is making a chat message come up on the screen saying that a pig has been spawned. That's simple enough.
5. Next line down, where it has "Pig" in it. You change that to whatever you want it to spawn. It can even work with your own custom mobs.
6. The third line is where it spawns in relation to where you clicked. It will spawn on the "y-axis" high by one block. This means it will spawn above the block you clicked.
7. The line after that should be left untouched, but the last one means that you will swing the item instead of it doing nothing.
package net.minecraft.src;
public class ItemNamehere extends Item
{
public ItemNamehere(int i, int j)
{
super(i);
field_318_a = j;
}
public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l)
{
if(l != 1)
{
return false;
}
if(!entityplayer.func_35190_e(i, j, k) || !entityplayer.func_35190_e(i, j + 1, k))
{
return false;
}
int i1 = world.getBlockId(i, j, k);
if(i1 == Block.tilledField.blockID && world.isAirBlock(i, j + 1, k))
{
world.setBlockWithNotify(i, j + 1, k, field_318_a);
itemstack.stackSize--;
return true;
} else
{
return false;
}
}
private int field_318_a;
}
mod_Namehere
package net.minecraft.src;
import java.util.*;
public class mod_Namehere extends BaseMod
{
public static int growNamehere1 = ModLoader.addOverride("/terrain.png", "/growNamehere1.png");
public static int growNamehere2 = ModLoader.addOverride("/terrain.png", "/growNamehere2.png");
public static int growNamehere3 = ModLoader.addOverride("/terrain.png", "/growNamehere3.png");
public static int growNamehere4 = ModLoader.addOverride("/terrain.png", "/growNamehere4.png");
public static int growNamehere5 = ModLoader.addOverride("/terrain.png", "/growNamehere5.png");
public static int growNamehere6 = ModLoader.addOverride("/terrain.png", "/growNamehere6.png");
public static int growNamehere7 = ModLoader.addOverride("/terrain.png", "/growNamehere7.png");
public static int growNamehere8 = ModLoader.addOverride("/terrain.png", "/growNamehere8.png");
public static final Block Nameherecrop = new BlockNameherecrop(200, 0).setBlockName("Nameherecrop");
public static final Item Namehere = new ItemNamehere(4000, mod_Namehere.Nameherecrop.blockID).setItemName("Namehere");
public mod_Namehere()
{
ModLoader.AddName(Nameherecrop, "Namehere Crop");
Nameherecrop.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Nameherecrop.png");
ModLoader.AddName(Namehere, "Namehere");
Namehere.iconIndex = ModLoader.addOverride("/gui/items.png", "/Namehere.png");
}
public String Version()
{
return "1.8.1";
}
}
BlockNameherecrop
package net.minecraft.src;
import java.util.Random;
public class BlockNameherecrop extends BlockFlower
{
protected BlockNameherecrop(int i, int j)
{
super(i, j);
blockIndexInTexture = j;
setTickOnLoad(true);
float f = 0.5F;
setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f);
}
protected boolean canThisPlantGrowOnThisBlockID(int i)
{
return i == Block.tilledField.blockID;
}
public void updateTick(World world, int i, int j, int k, Random random)
{
super.updateTick(world, i, j, k, random);
if(world.getBlockLightValue(i, j + 1, k) >= 9)
{
int l = world.getBlockMetadata(i, j, k);
if(l < 7)
{
float f = getGrowthRate(world, i, j, k);
if(random.nextInt((int)(100F / f)) == 0)
{
l++;
world.setBlockMetadataWithNotify(i, j, k, l);
}
}
}
}
public void fertilize(World world, int i, int j, int k)
{
world.setBlockMetadataWithNotify(i, j, k, 7);
}
private float getGrowthRate(World world, int i, int j, int k)
{
float f = 1.0F;
int l = world.getBlockId(i, j, k - 1);
int i1 = world.getBlockId(i, j, k + 1);
int j1 = world.getBlockId(i - 1, j, k);
int k1 = world.getBlockId(i + 1, j, k);
int l1 = world.getBlockId(i - 1, j, k - 1);
int i2 = world.getBlockId(i + 1, j, k - 1);
int j2 = world.getBlockId(i + 1, j, k + 1);
int k2 = world.getBlockId(i - 1, j, k + 1);
boolean flag = j1 == blockID || k1 == blockID;
boolean flag1 = l == blockID || i1 == blockID;
boolean flag2 = l1 == blockID || i2 == blockID || j2 == blockID || k2 == blockID;
for(int l2 = i - 1; l2 <= i + 1; l2++)
{
for(int i3 = k - 1; i3 <= k + 1; i3++)
{
int j3 = world.getBlockId(l2, j - 1, i3);
float f1 = 0.0F;
if(j3 == Block.tilledField.blockID)
{
f1 = 1.0F;
if(world.getBlockMetadata(l2, j - 1, i3) > 0)
{
f1 = 3F;
}
}
if(l2 != i || i3 != k)
{
f1 /= 4F;
}
f += f1;
}
}
if(flag2 || flag && flag1)
{
f /= 2.0F;
}
return f;
}
public int getBlockTextureFromSideAndMetadata(int i, int j)
{
if(j == 0)
{
return blockIndexInTexture;
}
if(j == 1)
{
return mod_Namehere.growNamehere1;
}
if(j == 2)
{
return mod_Namehere.growNamehere2;
}
if(j == 3)
{
return mod_Namehere.growNamehere3;
}
if(j == 4)
{
return mod_Namehere.growNamehere4;
}
if(j == 5)
{
return mod_Namehere.growNamehere5;
}
if(j == 6)
{
return mod_Namehere.growNamehere6;
}
if(j == 7)
{
return mod_Namehere.growNamehere7;
}
if(j == 8)
{
return mod_Namehere.growNamehere8;
}
return j;
}
public int getRenderType()
{
return 6;
}
public int idDropped(int i, Random random)
{
if(i == 5)
{
return Item.redstone.shiftedIndex;
} else
{
return -1;
}
}
public int quantityDropped(Random random)
{
return 1;
}
}
Help: ItemNamehere
1. Just leave everything here as is. You can use this exact same code for any different seeds you want to do.
Help: mod_Namehere
1. All of the "public static int" parts at the top for textures means that you are just registering the textures for the stages in the crop's growth.
2. For the "public static final Item Namehere", after the ID you change the "mod_Blabla" to what crop you want it to place when you use it on the tilled field.
3. You should know the rest, refer to "Block" tutorial for more help on the basics.
Help: BlockNameherecrop
1. The "canThisPlantGrowOnThisBlockID" part is self explaining, this is what you want it to be able to grow on.
2. A little bit further down it has this line "if(world.getBlockLightValue(i, j + 1, k) >= 9)", change the ">= 9" to what ever light level you want it to grow in (Highest light level is 15, that's the brightest the sun goes). That part means that it will grow in a light level of either 9 or higher. You could also make it grow in a light value of say 6 or lower ("<= 6").
3. In the "getGrowthRate" you can change this part "float f = 1.0F;" to how fast you want it to grow.
4. The "getBlockTextureFromSideAndMetadata" part is just saying what textures it will use at what growth level.
5. In the "idDropped" bit, the 5 is how rare a chance it is of getting the redstone dust. (Higher the number, more rare of a drop it is)
6. "quantityDropped" is self explanatory, change it to how much of the block/item you want it to drop when it does.
package net.minecraft.src;
import java.util.*;
public class mod_Namehere extends BaseMod
{
public static final Block Namehere;
public mod_Namehere()
{
ModLoader.AddName(Namehere, "Namehere Explosive");
ModLoader.RegisterBlock(Namehere);
}
public void AddRenderer(Map map)
{
map.put(net.minecraft.src.EntityNameherePrimed.class, new RenderNameherePrimed());
}
public String Version()
{
return "1.8.1";
}
static
{
Namehere = (new BlockNamehere(170, ModLoader.addOverride("/terrain.png", "/Namehere.png"))).setHardness(0.0F).setStepSound(Block.soundGrassFootstep).setBlockName("Namehere");
}
}
BlockNamehere
package net.minecraft.src;
import java.util.Random;
public class BlockNamehere extends Block
{
public BlockNamehere(int i, int j)
{
super(i, j, Material.tnt);
}
public void onBlockAdded(World world, int i, int j, int k)
{
super.onBlockAdded(world, i, j, k);
if(world.isBlockIndirectlyGettingPowered(i, j, k))
{
onBlockDestroyedByPlayer(world, i, j, k, 1);
world.setBlockWithNotify(i, j, k, 0);
}
}
public void onNeighborBlockChange(World world, int i, int j, int k, int l)
{
if(l > 0 && Block.blocksList[l].canProvidePower() && world.isBlockIndirectlyGettingPowered(i, j, k))
{
onBlockDestroyedByPlayer(world, i, j, k, 1);
world.setBlockWithNotify(i, j, k, 0);
}
}
public int quantityDropped(Random random)
{
return 0;
}
public void onBlockDestroyedByExplosion(World world, int i, int j, int k)
{
EntityNameherePrimed entitynamehereprimed = new EntityNameherePrimed(world, (float)i + 0.5F, (float)j + 0.5F, (float)k + 0.5F);
entitynamehereprimed.fuse = world.rand.nextInt(entitynamehereprimed.fuse / 4) + entitynamehereprimed.fuse / 8;
world.entityJoinedWorld(entitynamehereprimed);
}
public void onBlockDestroyedByPlayer(World world, int i, int j, int k, int l)
{
if(world.multiplayerWorld)
{
return;
}
if((l & 1) == 0)
{
dropBlockAsItem_do(world, i, j, k, new ItemStack(mod_Namehere.Namehere.blockID, 1, 0));
} else
{
EntityNameherePrimed entitynamehereprimed = new EntityNameherePrimed(world, (float)i + 0.5F, (float)j + 0.5F, (float)k + 0.5F);
world.entityJoinedWorld(entitynamehereprimed);
world.playSoundAtEntity(entitynamehereprimed, "random.fuse", 1.0F, 1.0F);
}
}
public void onBlockClicked(World world, int i, int j, int k, EntityPlayer entityplayer)
{
if(entityplayer.getCurrentEquippedItem() != null && entityplayer.getCurrentEquippedItem().itemID == Item.flintAndSteel.shiftedIndex)
{
world.setBlockMetadata(i, j, k, 1);
}
super.onBlockClicked(world, i, j, k, entityplayer);
}
public boolean blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer)
{
return super.blockActivated(world, i, j, k, entityplayer);
}
}
2. The "AddRenderer" is just a way of making sure it loads the texture when the block is primed.
Help: BlockNamehere
1. Nothing important in here. Just change the "Namehere" parts.
2. Almost all of this code is just about it activating from redstone or switches etc.
Help: EntityNameherePrimed
1. A little bit in it has this: "fuse = 80;" Don't change the first one you see, change this one. This is how long it takes after activated to explode.
2. Scroll down the the "private void explode()" method. Change the 9F to how big you want it to explode.
3. Leave everything else unless you know what you're doing.
Help: RenderNameherePrimed
1. Everything here is just name-changing except for one thing.
2. Don't change the "loadTexture" part, as everything still works fine without changing it.
package net.minecraft.src;
import java.util.Random;
public class mod_Namehere extends BaseMod
{
public static int rarity = 600;
public mod_Namehere()
{
}
public void GenerateSurface(World world, Random rand, int i, int j)
{
for(int k = 0; k < rarity; k++)
{
int RandPosX = i + rand.nextInt(16);
int RandPosY = rand.nextInt(128);
int RandPosZ = j + rand.nextInt(16);
(new WorldGenNamehere()).generate(world, rand, RandPosX, RandPosY, RandPosZ);
}
}
public String Version()
{
return "1.8.1";
}
}
2. Change the 600 rarity at the top for how common you want it to be. (600 = Very common, 50 = Rareish)
3. Change the name of the "WorldGenNamehere" on this line to whatever yours is called.
(new WorldGenNamehere()).generate(world, rand, RandPosX, RandPosY, RandPosZ);
Help: WorldGenNamehere
1. For more help see the "Structure Maker" tutorial in "Advanced Block"
2. The if statement is just saying that "if the block to generate on is not sand and the block above it is not air, then don't generate. If they are equal, generate a mossy cobblestone tower 17 blocks high."
Chests
mod_Namehere
package net.minecraft.src;
import java.util.Random;
public class mod_Namehere extends BaseMod
{
public static int rarity = 600;
public mod_Namehere()
{
}
public void GenerateSurface(World world, Random rand, int i, int j)
{
for(int k = 0; k < rarity; k++)
{
int RandPosX = i + rand.nextInt(16);
int RandPosY = rand.nextInt(128);
int RandPosZ = j + rand.nextInt(16);
(new WorldGenNamehere()).generate(world, rand, RandPosX, RandPosY, RandPosZ);
}
}
public String Version()
{
return "1.8.1";
}
}
WorldGenNamehere
package net.minecraft.src;
import java.util.Random;
public class WorldGenNamehere extends WorldGenerator
{
public WorldGenNamehere()
{
}
public boolean generate(World world, Random rand, int i, int j, int k)
{
world.setBlockWithNotify(i, j + 1, k, Block.chest.blockID);
TileEntityChest tileentitychest = (TileEntityChest)world.getBlockTileEntity(i, j + 1, k);
if(tileentitychest != null && tileentitychest.getSizeInventory() > 0)
{
ItemStack itemstack = new ItemStack(Item.redstone, 3);
tileentitychest.setInventorySlotContents(0, itemstack);
ItemStack itemstack1 = new ItemStack(Item.diamond, 17);
tileentitychest.setInventorySlotContents(1, itemstack1);
ItemStack itemstack2 = new ItemStack(Item.swordStone, 17);
tileentitychest.setInventorySlotContents(2, itemstack2);
}
return true;
}
}
Help: mod_Namehere
1. Same as normal.
2. Change the 600 rarity at the top for how common you want it to be. (600 = Very common, 50 = Rareish)
3. Change the name of the "WorldGenNamehere" on this line to whatever yours is called.
(new WorldGenNamehere()).generate(world, rand, RandPosX, RandPosY, RandPosZ);
Help: WorldGenNamehere
1. This seems like a lot of code, but don't worry as it's easy to understand. First of all we are putting a chest 1 block above ground.
All you need to change on that line is the bit at the end with the "+ 1", you need to make sure that it corresponds with the place you put for the chest.
3. Notice on the lines like this, their pattern for adding new items.
ItemStack itemstack = new ItemStack(Item.redstone, 3);
tileentitychest.setInventorySlotContents(0, itemstack);
The first line is what you're putting in it and how much of that thing. The second line, the 0 is what slot it goes in (in this case the top left) and then "itemstack".
4. Please note the numbers added to some of the names like "itemstack1" as you need to put a new number on it for each thing you put in.
Mob Spawners
mod_Namehere
package net.minecraft.src;
import java.util.Random;
public class mod_Namehere extends BaseMod
{
public static int rarity = 600;
public mod_Namehere()
{
}
public void GenerateSurface(World world, Random rand, int i, int j)
{
for(int k = 0; k < rarity; k++)
{
int RandPosX = i + rand.nextInt(16);
int RandPosY = rand.nextInt(128);
int RandPosZ = j + rand.nextInt(16);
(new WorldGenNamehere()).generate(world, rand, RandPosX, RandPosY, RandPosZ);
}
}
public String Version()
{
return "1.8.1";
}
}
WorldGenNamehere
package net.minecraft.src;
import java.util.Random;
public class WorldGenNamehere extends WorldGenerator
{
public WorldGenNamehere()
{
}
public boolean generate(World world, Random rand, int i, int j, int k)
{
world.setBlockWithNotify(i, j + 1, k, Block.mobSpawner.blockID);
TileEntityMobSpawner tileentitymobspawner = (TileEntityMobSpawner)world.getBlockTileEntity(i, j + 1, k);
tileentitymobspawner.setMobID("Zombie");
return true;
}
}
Help: mod_Namehere
1. Same as normal.
2. Change the 600 rarity at the top for how common you want it to be. (600 = Very common, 50 = Rareish)
3. Change the name of the "WorldGenNamehere" on this line to whatever yours is called.
(new WorldGenNamehere()).generate(world, rand, RandPosX, RandPosY, RandPosZ);
Help: WorldGenNamehere
1. Placing a mob spawner one block above ground, next line make sure to correspond to the spawner to where it is placed (see chest tutorial above for more info).
2. Change the ID where it says "Zombie" to whatever you want it to spawn. (also works on custom made mobs)
Note: You will need a thing called fernflower.jar for this to work. You can get it here. Put it in runtime/bin along with the other .jar's. Then put ShockahPI in your normal jar where you put modloader and decompile.
mod_Namehere
package net.minecraft.src;
public class mod_Namehere extends BaseMod
{
public mod_Namehere()
{
new DimensionNamehere().name = "Namehere";
ModLoader.RegisterBlock(NameherePortal);
ModLoader.RegisterBlock(NamehereStone);
ModLoader.RegisterBlock(NamehereDirt);
ModLoader.RegisterBlock(NamehereGrass);
ModLoader.RegisterBlock(BlockNameherePortalStarter);
ModLoader.AddName(PortalStarterNamehere, "Namehere Portal Starter");
ModLoader.AddName(NamehereStone, "Namehere Stone");
ModLoader.AddName(NamehereDirt, "Namehere Dirt");
ModLoader.AddName(NamehereGrass, "Namehere Grass");
NamehereStoneTexture = ModLoader.addOverride("/terrain.png", "/Myfolder/NamehereStone.png");
NamehereGrassTexture = ModLoader.addOverride("/terrain.png", "/Myfolder/NamehereGrass.png");
NamehereDirtTexture = ModLoader.addOverride("/terrain.png", "/Myfolder/NamehereDirt.png");
NamehereGrass.blockIndexInTexture = NamehereGrassTexture;
NamehereStone.blockIndexInTexture = NamehereStoneTexture;
NamehereDirt.blockIndexInTexture = NamehereDirtTexture;
ToolBase.Shovel.mineBlocks.add(new BlockHarvestPower(NamehereDirt.blockID, 0.0F));
ToolBase.Shovel.mineBlocks.add(new BlockHarvestPower(NamehereGrass.blockID, 0.0F));
ToolBase.Pickaxe.mineBlocks.add(new BlockHarvestPower(NamehereStone.blockID, 0.0F));
}
public static final BlockPortalNamehere NameherePortal;
public static final Item PortalStarterNamehere;
public static final Block BlockNameherePortalStarter;
public static final Block NamehereStone;
public static final Block NamehereGrass;
public static final Block NamehereDirt;
public static int NamehereStoneTexture;
public static int NamehereGrassTexture;
public static int NamehereDirtTexture;
static
{
NameherePortal = (BlockPortalNamehere)(new BlockPortalNamehere(234, ModLoader.getUniqueSpriteIndex("/terrain.png"))).setHardness(-1F).setStepSound(Block.soundGlassFootstep).setLightValue(0.75F).setBlockName("NameherePortal");
PortalStarterNamehere = new ItemNameherePortalStarter(1987).setIconCoord(5, 0).setItemName("NameherePortalStarter");
BlockNameherePortalStarter = new BlockNameherePortalStarter(235, 1, Material.sponge).setHardness(0.0F).disableStats().disableNeighborNotifyOnMetadataChange().setBlockName("BlockNameherePortalStarter");
NamehereStone = (new BlockNamehereStone(236, 1)).setHardness(1.5F).setResistance(10F).setStepSound(Block.soundStoneFootstep).setBlockName("NamehereStone");
NamehereGrass = (Block)(new BlockNamehereGrass(237, 1)).setHardness(0.6F).setStepSound(Block.soundGrassFootstep).setBlockName("NamehereGrass");
NamehereDirt = (new BlockNamehereDirt(238, 1)).setHardness(0.5F).setStepSound(Block.soundGravelFootstep).setBlockName("NamehereDirt");
}
public String Version()
{
return "1.7.3";
}
}
BlockNamehereDirt
package net.minecraft.src;
public class BlockNamehereDirt extends Block
{
protected BlockNamehereDirt(int i, int j)
{
super(i, j, Material.ground);
}
public int idDropped(int i, Random random)
{
return mod_Namehere.NamehereDirt.blockID;
}
}
BlockNamehereGrass
package net.minecraft.src;
import java.util.Random;
public class BlockNamehereGrass extends Block
{
protected BlockNamehereGrass(int i, int j)
{
super(i, Material.grassMaterial);
blockIndexInTexture = j;
setTickOnLoad(true);
}
public int getBlockTexture(IBlockAccess iblockaccess, int i, int j, int k, int l)
{
if(l == 1)
{
return 0;
}
if(l == 0)
{
return 2;
}
Material material = iblockaccess.getBlockMaterial(i, j + 1, k);
return material != Material.snow && material != Material.builtSnow ? 3 : 68;
}
public int colorMultiplier(IBlockAccess iblockaccess, int i, int j, int k)
{
iblockaccess.getWorldChunkManager().func_4069_a(i, k, 1, 1);
double d = iblockaccess.getWorldChunkManager().temperature[0];
double d1 = iblockaccess.getWorldChunkManager().humidity[0];
return ColorizerGrass.getGrassColor(d, d1);
}
public void updateTick(World world, int i, int j, int k, Random random)
{
if(world.multiplayerWorld)
{
return;
}
if(world.getBlockLightValue(i, j + 1, k) < 4 && Block.lightOpacity[world.getBlockId(i, j + 1, k)] > 2)
{
if(random.nextInt(4) != 0)
{
return;
}
world.setBlockWithNotify(i, j, k, mod_Namehere.NamehereDirt.blockID);
} else
if(world.getBlockLightValue(i, j + 1, k) >= 9)
{
int l = (i + random.nextInt(3)) - 1;
int i1 = (j + random.nextInt(5)) - 3;
int j1 = (k + random.nextInt(3)) - 1;
int k1 = world.getBlockId(l, i1 + 1, j1);
if(world.getBlockId(l, i1, j1) == mod_Namehere.NamehereDirt.blockID && world.getBlockLightValue(l, i1 + 1, j1) >= 4 && Block.lightOpacity[k1] <= 2)
{
world.setBlockWithNotify(l, i1, j1, mod_Namehere.NamehereGrass.blockID);
}
}
}
public int idDropped(int i, Random random)
{
return mod_Namehere.NamehereDirt.idDropped(0, random);
}
}
BlockNamehereStone
package net.minecraft.src;
import java.util.Random;
public class BlockNamehereStone extends Block
{
public BlockNamehereStone(int i, int j)
{
super(i, j, Material.rock);
}
public int idDropped(int i, Random random)
{
return mod_Namehere.NamehereStone.blockID;
}
}
BlockNameherePortalStarter
package net.minecraft.src;
public class BlockNameherePortalStarter extends Block
{
public BlockNameherePortalStarter(int i, int j, Material material)
{
super(i, j, material);
}
public void onBlockAdded(World world, int i, int j, int k){
if(world.getBlockId(i, j - 1, k) == Block.dirt.blockID && mod_Namehere.NameherePortal.tryToCreatePortal(world, i, j, k))
{
return;
}else {
world.setBlockWithNotify(i, j, k, 0);
}
}
}
BlockPortalNamehere
package net.minecraft.src;
import java.util.Random;
public class BlockPortalNamehere extends BlockBreakable
{
public BlockPortalNamehere(int i, int j)
{
super(i, j, Material.portal, false);
}
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k)
{
return null;
}
public void setBlockBoundsBasedOnState(IBlockAccess iblockaccess, int i, int j, int k)
{
if(iblockaccess.getBlockId(i - 1, j, k) == blockID || iblockaccess.getBlockId(i + 1, j, k) == blockID)
{
float f = 0.5F;
float f2 = 0.125F;
setBlockBounds(0.5F - f, 0.0F, 0.5F - f2, 0.5F + f, 1.0F, 0.5F + f2);
} else
{
float f1 = 0.125F;
float f3 = 0.5F;
setBlockBounds(0.5F - f1, 0.0F, 0.5F - f3, 0.5F + f1, 1.0F, 0.5F + f3);
}
}
public boolean isOpaqueCube()
{
return false;
}
public boolean renderAsNormalBlock()
{
return false;
}
public boolean tryToCreatePortal(World world, int i, int j, int k)
{
int l = 0;
int i1 = 0;
if(world.getBlockId(i - 1, j, k) == Block.dirt.blockID || world.getBlockId(i + 1, j, k) == Block.dirt.blockID)
{
l = 1;
}
if(world.getBlockId(i, j, k - 1) == Block.dirt.blockID || world.getBlockId(i, j, k + 1) == Block.dirt.blockID)
{
i1 = 1;
}
if(l == i1)
{
return false;
}
if(world.getBlockId(i - l, j, k - i1) == 0)
{
i -= l;
k -= i1;
}
for(int l1 = -1; l1 <= 2; l1++)
{
for(int j1 = -1; j1 <= 3; j1++)
{
boolean flag = l1 == -1 || l1 == 2 || j1 == -1 || j1 == 3;
if(l1 != -1 && l1 != 2 || j1 != -1 && j1 != 3)
{
int j2 = world.getBlockId(i + l * l1, j + j1, k + i1 * l1);
if(flag)
{
if(j2 != Block.dirt.blockID)
{
return false;
}
} else
if(j2 != 0 && j2 != mod_Namehere.NameherePortal.blockID)
{
return false;
}
}
}
}
world.editingBlocks = true;
for(int i2 = 0; i2 < 2; i2++)
{
for(int k1 = 0; k1 < 3; k1++)
{
world.setBlockWithNotify(i + l * i2, j + k1, k + i1 * i2, mod_Namehere.NameherePortal.blockID);
}
}
world.editingBlocks = false;
return true;
}
public void onNeighborBlockChange(World world, int i, int j, int k, int l)
{
int i1 = 0;
int j1 = 1;
if(world.getBlockId(i - 1, j, k) == blockID || world.getBlockId(i + 1, j, k) == blockID)
{
i1 = 1;
j1 = 0;
}
int k1;
for(k1 = j; world.getBlockId(i, k1 - 1, k) == blockID; k1--) { }
if(world.getBlockId(i, k1 - 1, k) != Block.dirt.blockID)
{
world.setBlockWithNotify(i, j, k, 0);
return;
}
int l1;
for(l1 = 1; l1 < 4 && world.getBlockId(i, k1 + l1, k) == blockID; l1++) { }
if(l1 != 3 || world.getBlockId(i, k1 + l1, k) != Block.dirt.blockID)
{
world.setBlockWithNotify(i, j, k, 0);
return;
}
boolean flag = world.getBlockId(i - 1, j, k) == blockID || world.getBlockId(i + 1, j, k) == blockID;
boolean flag1 = world.getBlockId(i, j, k - 1) == blockID || world.getBlockId(i, j, k + 1) == blockID;
if(flag && flag1)
{
world.setBlockWithNotify(i, j, k, 0);
return;
}
if((world.getBlockId(i + i1, j, k + j1) != Block.dirt.blockID || world.getBlockId(i - i1, j, k - j1) != blockID) && (world.getBlockId(i - i1, j, k - j1) != Block.dirt.blockID || world.getBlockId(i + i1, j, k + j1) != blockID))
{
world.setBlockWithNotify(i, j, k, 0);
return;
} else
{
return;
}
}
public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
{
if(iblockaccess.getBlockId(i, j, k) == blockID)
{
return false;
}
boolean flag = iblockaccess.getBlockId(i - 1, j, k) == blockID && iblockaccess.getBlockId(i - 2, j, k) != blockID;
boolean flag1 = iblockaccess.getBlockId(i + 1, j, k) == blockID && iblockaccess.getBlockId(i + 2, j, k) != blockID;
boolean flag2 = iblockaccess.getBlockId(i, j, k - 1) == blockID && iblockaccess.getBlockId(i, j, k - 2) != blockID;
boolean flag3 = iblockaccess.getBlockId(i, j, k + 1) == blockID && iblockaccess.getBlockId(i, j, k + 2) != blockID;
boolean flag4 = flag || flag1;
boolean flag5 = flag2 || flag3;
if(flag4 && l == 4)
{
return true;
}
if(flag4 && l == 5)
{
return true;
}
if(flag5 && l == 2)
{
return true;
}
return flag5 && l == 3;
}
public int quantityDropped(Random random)
{
return 0;
}
public int getRenderBlockPass()
{
return 1;
}
public void onEntityCollidedWithBlock(World world, int i, int j, int k, Entity entity)
{
if(entity.ridingEntity == null && entity.riddenByEntity == null)
{
if(entity instanceof EntityPlayerSP)
{
EntityPlayerSP entityplayersp = (EntityPlayerSP)entity;
entityplayersp.portal = getDimNumber();
}
entity.setInPortal();
}
}
public void randomDisplayTick(World world, int i, int j, int k, Random random)
{
if(random.nextInt(100) == 0)
{
world.playSoundEffect((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D, "portal.portal", 1.0F, random.nextFloat() * 0.4F + 0.8F);
}
for(int l = 0; l < 4; l++)
{
double d = (float)i + random.nextFloat();
double d1 = (float)j + random.nextFloat();
double d2 = (float)k + random.nextFloat();
double d3 = 0.0D;
double d4 = 0.0D;
double d5 = 0.0D;
int i1 = random.nextInt(2) * 2 - 1;
d3 = ((double)random.nextFloat() - 0.5D) * 0.5D;
d4 = ((double)random.nextFloat() - 0.5D) * 0.5D;
d5 = ((double)random.nextFloat() - 0.5D) * 0.5D;
if(world.getBlockId(i - 1, j, k) == blockID || world.getBlockId(i + 1, j, k) == blockID)
{
d2 = (double)k + 0.5D + 0.25D * (double)i1;
d5 = random.nextFloat() * 2.0F * (float)i1;
} else
{
d = (double)i + 0.5D + 0.25D * (double)i1;
d3 = random.nextFloat() * 2.0F * (float)i1;
}
world.spawnParticle("portal", d, d1, d2, d3, d4, d5);
}
}
public int getDimNumber()
{
return 1001;
}
}
ChunkProviderNamehere
package net.minecraft.src;
import java.util.Random;
public class ChunkProviderNamehere
implements IChunkProvider
{
public ChunkProviderNamehere(World world, long l)
{
field_28079_r = new double[256];
field_28078_s = new double[256];
field_28077_t = new double[256];
field_28076_u = new MapGenCavesNamehere();
field_28088_i = new int[32][32];
field_28081_p = world;
field_28087_j = new Random(l);
field_28086_k = new NoiseGeneratorOctaves(field_28087_j, 16);
field_28085_l = new NoiseGeneratorOctaves(field_28087_j, 16);
field_28084_m = new NoiseGeneratorOctaves(field_28087_j, 8);
field_28083_n = new NoiseGeneratorOctaves(field_28087_j, 4);
field_28082_o = new NoiseGeneratorOctaves(field_28087_j, 4);
field_28096_a = new NoiseGeneratorOctaves(field_28087_j, 10);
field_28095_b = new NoiseGeneratorOctaves(field_28087_j, 16);
field_28094_c = new NoiseGeneratorOctaves(field_28087_j, 8);
}
public void func_28071_a(int i, int j, byte abyte0[], BiomeGenBase abiomegenbase[], double ad[])
{
byte byte0 = 2;
int k = byte0 + 1;
byte byte1 = 33;
int l = byte0 + 1;
field_28080_q = func_28073_a(field_28080_q, i * byte0, 0, j * byte0, k, byte1, l);
for(int i1 = 0; i1 < byte0; i1++)
{
for(int j1 = 0; j1 < byte0; j1++)
{
for(int k1 = 0; k1 < 32; k1++)
{
double d = 0.25D;
double d1 = field_28080_q[((i1 + 0) * l + (j1 + 0)) * byte1 + (k1 + 0)];
double d2 = field_28080_q[((i1 + 0) * l + (j1 + 1)) * byte1 + (k1 + 0)];
double d3 = field_28080_q[((i1 + 1) * l + (j1 + 0)) * byte1 + (k1 + 0)];
double d4 = field_28080_q[((i1 + 1) * l + (j1 + 1)) * byte1 + (k1 + 0)];
double d5 = (field_28080_q[((i1 + 0) * l + (j1 + 0)) * byte1 + (k1 + 1)] - d1) * d;
double d6 = (field_28080_q[((i1 + 0) * l + (j1 + 1)) * byte1 + (k1 + 1)] - d2) * d;
double d7 = (field_28080_q[((i1 + 1) * l + (j1 + 0)) * byte1 + (k1 + 1)] - d3) * d;
double d8 = (field_28080_q[((i1 + 1) * l + (j1 + 1)) * byte1 + (k1 + 1)] - d4) * d;
for(int l1 = 0; l1 < 4; l1++)
{
double d9 = 0.125D;
double d10 = d1;
double d11 = d2;
double d12 = (d3 - d1) * d9;
double d13 = (d4 - d2) * d9;
for(int i2 = 0; i2 < 8; i2++)
{
int j2 = i2 + i1 * 8 << 11 | 0 + j1 * 8 << 7 | k1 * 4 + l1;
char c = '\200';
double d14 = 0.125D;
double d15 = d10;
double d16 = (d11 - d10) * d14;
for(int k2 = 0; k2 < 8; k2++)
{
int l2 = 0;
if(d15 > 0.0D)
{
l2 = mod_Namehere.NamehereStone.blockID;
}
abyte0[j2] = (byte)l2;
j2 += c;
d15 += d16;
}
d10 += d12;
d11 += d13;
}
d1 += d5;
d2 += d6;
d3 += d7;
d4 += d8;
}
}
}
}
}
public void func_28072_a(int i, int j, byte abyte0[], BiomeGenBase abiomegenbase[])
{
double d = 0.03125D;
field_28079_r = field_28083_n.generateNoiseOctaves(field_28079_r, i * 16, j * 16, 0.0D, 16, 16, 1, d, d, 1.0D);
field_28078_s = field_28083_n.generateNoiseOctaves(field_28078_s, i * 16, 109.0134D, j * 16, 16, 1, 16, d, 1.0D, d);
field_28077_t = field_28082_o.generateNoiseOctaves(field_28077_t, i * 16, j * 16, 0.0D, 16, 16, 1, d * 2D, d * 2D, d * 2D);
for(int k = 0; k < 16; k++)
{
for(int l = 0; l < 16; l++)
{
BiomeGenBase biomegenbase = abiomegenbase[k + l * 16];
int i1 = (int)(field_28077_t[k + l * 16] / 3D + 3D + field_28087_j.nextDouble() * 0.25D);
int j1 = -1;
byte byte0 = (byte)mod_Namehere.NamehereGrass.blockID;
byte byte1 = (byte)mod_Namehere.NamehereDirt.blockID;
for(int k1 = 127; k1 >= 0; k1--)
{
int l1 = (l * 16 + k) * 128 + k1;
byte byte2 = abyte0[l1];
if(byte2 == 0)
{
j1 = -1;
continue;
}
if(byte2 != (byte)mod_Namehere.NamehereStone.blockID)
{
continue;
}
if(j1 == -1)
{
if(i1 <= 0)
{
byte0 = 0;
byte1 = (byte)mod_Namehere.NamehereStone.blockID;
}
j1 = i1;
if(k1 >= 0)
{
abyte0[l1] = byte0;
} else
{
abyte0[l1] = byte1;
}
continue;
}
if(j1 <= 0)
{
continue;
}
j1--;
abyte0[l1] = byte1;
if(j1 == 0 && byte1 == Block.sand.blockID)
{
j1 = field_28087_j.nextInt(4);
byte1 = (byte)Block.sandStone.blockID;
}
}
}
}
}
public Chunk prepareChunk(int i, int j)
{
return provideChunk(i, j);
}
public Chunk provideChunk(int i, int j)
{
field_28087_j.setSeed((long)i * 0x4f9939f508L + (long)j * 0x1ef1565bd5L);
byte abyte0[] = new byte[32768];
Chunk chunk = new Chunk(field_28081_p, abyte0, i, j);
field_28075_v = field_28081_p.getWorldChunkManager().loadBlockGeneratorData(field_28075_v, i * 16, j * 16, 16, 16);
double ad[] = field_28081_p.getWorldChunkManager().temperature;
func_28071_a(i, j, abyte0, field_28075_v, ad);
func_28072_a(i, j, abyte0, field_28075_v);
field_28076_u.func_867_a(this, field_28081_p, i, j, abyte0);
chunk.func_1024_c();
return chunk;
}
private double[] func_28073_a(double ad[], int i, int j, int k, int l, int i1, int j1)
{
if(ad == null)
{
ad = new double[l * i1 * j1];
}
double d = 684.41200000000003D;
double d1 = 684.41200000000003D;
double ad1[] = field_28081_p.getWorldChunkManager().temperature;
double ad2[] = field_28081_p.getWorldChunkManager().humidity;
field_28090_g = field_28096_a.func_4109_a(field_28090_g, i, k, l, j1, 1.121D, 1.121D, 0.5D);
field_28089_h = field_28095_b.func_4109_a(field_28089_h, i, k, l, j1, 200D, 200D, 0.5D);
d *= 2D;
field_28093_d = field_28084_m.generateNoiseOctaves(field_28093_d, i, j, k, l, i1, j1, d / 80D, d1 / 160D, d / 80D);
field_28092_e = field_28086_k.generateNoiseOctaves(field_28092_e, i, j, k, l, i1, j1, d, d1, d);
field_28091_f = field_28085_l.generateNoiseOctaves(field_28091_f, i, j, k, l, i1, j1, d, d1, d);
int k1 = 0;
int l1 = 0;
int i2 = 16 / l;
for(int j2 = 0; j2 < l; j2++)
{
int k2 = j2 * i2 + i2 / 2;
for(int l2 = 0; l2 < j1; l2++)
{
int i3 = l2 * i2 + i2 / 2;
double d2 = ad1[k2 * 16 + i3];
double d3 = ad2[k2 * 16 + i3] * d2;
double d4 = 1.0D - d3;
d4 *= d4;
d4 *= d4;
d4 = 1.0D - d4;
double d5 = (field_28090_g[l1] + 256D) / 512D;
d5 *= d4;
if(d5 > 1.0D)
{
d5 = 1.0D;
}
double d6 = field_28089_h[l1] / 8000D;
if(d6 < 0.0D)
{
d6 = -d6 * 0.29999999999999999D;
}
d6 = d6 * 3D - 2D;
if(d6 > 1.0D)
{
d6 = 1.0D;
}
d6 /= 8D;
d6 = 0.0D;
if(d5 < 0.0D)
{
d5 = 0.0D;
}
d5 += 0.5D;
d6 = (d6 * (double)i1) / 16D;
l1++;
double d7 = (double)i1 / 2D;
for(int j3 = 0; j3 < i1; j3++)
{
double d8 = 0.0D;
double d9 = (((double)j3 - d7) * 8D) / d5;
if(d9 < 0.0D)
{
d9 *= -1D;
}
double d10 = field_28092_e[k1] / 512D;
double d11 = field_28091_f[k1] / 512D;
double d12 = (field_28093_d[k1] / 10D + 1.0D) / 2D;
if(d12 < 0.0D)
{
d8 = d10;
} else
if(d12 > 1.0D)
{
d8 = d11;
} else
{
d8 = d10 + (d11 - d10) * d12;
}
d8 -= 8D;
int k3 = 32;
if(j3 > i1 - k3)
{
double d13 = (float)(j3 - (i1 - k3)) / ((float)k3 - 1.0F);
d8 = d8 * (1.0D - d13) + -30D * d13;
}
k3 = 8;
if(j3 < k3)
{
double d14 = (float)(k3 - j3) / ((float)k3 - 1.0F);
d8 = d8 * (1.0D - d14) + -30D * d14;
}
ad[k1] = d8;
k1++;
}
}
}
return ad;
}
public boolean chunkExists(int i, int j)
{
return true;
}
public void populate(IChunkProvider ichunkprovider, int i, int j)
{
BlockSand.fallInstantly = true;
int k = i * 16;
int l = j * 16;
BiomeGenBase biomegenbase = field_28081_p.getWorldChunkManager().getBiomeGenAt(k + 16, l + 16);
field_28087_j.setSeed(field_28081_p.getRandomSeed());
long l1 = (field_28087_j.nextLong() / 2L) * 2L + 1L;
long l2 = (field_28087_j.nextLong() / 2L) * 2L + 1L;
field_28087_j.setSeed((long)i * l1 + (long)j * l2 ^ field_28081_p.getRandomSeed());
double d = 0.25D;
if(field_28087_j.nextInt(4) == 0)
{
int i1 = k + field_28087_j.nextInt(16) + 8;
int l4 = field_28087_j.nextInt(128);
int i8 = l + field_28087_j.nextInt(16) + 8;
(new WorldGenLakes(Block.waterStill.blockID)).generate(field_28081_p, field_28087_j, i1, l4, i8);
}
if(field_28087_j.nextInt(8) == 0)
{
int j1 = k + field_28087_j.nextInt(16) + 8;
int i5 = field_28087_j.nextInt(field_28087_j.nextInt(120) + 8);
int j8 = l + field_28087_j.nextInt(16) + 8;
if(i5 < 64 || field_28087_j.nextInt(10) == 0)
{
(new WorldGenLakes(Block.lavaStill.blockID)).generate(field_28081_p, field_28087_j, j1, i5, j8);
}
}
for(int k1 = 0; k1 < 8; k1++)
{
int j5 = k + field_28087_j.nextInt(16) + 8;
int k8 = field_28087_j.nextInt(128);
int i13 = l + field_28087_j.nextInt(16) + 8;
(new WorldGenDungeons()).generate(field_28081_p, field_28087_j, j5, k8, i13);
}
for(int i2 = 0; i2 < 10; i2++)
{
int k5 = k + field_28087_j.nextInt(16);
int l8 = field_28087_j.nextInt(128);
int j13 = l + field_28087_j.nextInt(16);
(new WorldGenClay(32)).generate(field_28081_p, field_28087_j, k5, l8, j13);
}
for(int j2 = 0; j2 < 20; j2++)
{
int l5 = k + field_28087_j.nextInt(16);
int i9 = field_28087_j.nextInt(128);
int k13 = l + field_28087_j.nextInt(16);
(new WorldGenMinable(Block.dirt.blockID, 32)).generate(field_28081_p, field_28087_j, l5, i9, k13);
}
for(int k2 = 0; k2 < 10; k2++)
{
int i6 = k + field_28087_j.nextInt(16);
int j9 = field_28087_j.nextInt(128);
int l13 = l + field_28087_j.nextInt(16);
(new WorldGenMinable(Block.gravel.blockID, 32)).generate(field_28081_p, field_28087_j, i6, j9, l13);
}
for(int i3 = 0; i3 < 20; i3++)
{
int j6 = k + field_28087_j.nextInt(16);
int k9 = field_28087_j.nextInt(128);
int i14 = l + field_28087_j.nextInt(16);
(new WorldGenMinable(Block.oreCoal.blockID, 16)).generate(field_28081_p, field_28087_j, j6, k9, i14);
}
for(int j3 = 0; j3 < 20; j3++)
{
int k6 = k + field_28087_j.nextInt(16);
int l9 = field_28087_j.nextInt(64);
int j14 = l + field_28087_j.nextInt(16);
(new WorldGenMinable(Block.oreIron.blockID, 8)).generate(field_28081_p, field_28087_j, k6, l9, j14);
}
for(int k3 = 0; k3 < 2; k3++)
{
int l6 = k + field_28087_j.nextInt(16);
int i10 = field_28087_j.nextInt(32);
int k14 = l + field_28087_j.nextInt(16);
(new WorldGenMinable(Block.oreGold.blockID, 8)).generate(field_28081_p, field_28087_j, l6, i10, k14);
}
for(int l3 = 0; l3 < 8; l3++)
{
int i7 = k + field_28087_j.nextInt(16);
int j10 = field_28087_j.nextInt(16);
int l14 = l + field_28087_j.nextInt(16);
(new WorldGenMinable(Block.oreRedstone.blockID, 7)).generate(field_28081_p, field_28087_j, i7, j10, l14);
}
for(int i4 = 0; i4 < 1; i4++)
{
int j7 = k + field_28087_j.nextInt(16);
int k10 = field_28087_j.nextInt(16);
int i15 = l + field_28087_j.nextInt(16);
(new WorldGenMinable(Block.oreDiamond.blockID, 7)).generate(field_28081_p, field_28087_j, j7, k10, i15);
}
for(int j4 = 0; j4 < 1; j4++)
{
int k7 = k + field_28087_j.nextInt(16);
int l10 = field_28087_j.nextInt(16) + field_28087_j.nextInt(16);
int j15 = l + field_28087_j.nextInt(16);
(new WorldGenMinable(Block.oreLapis.blockID, 6)).generate(field_28081_p, field_28087_j, k7, l10, j15);
}
d = 0.5D;
int k4 = (int)((field_28094_c.func_806_a((double)k * d, (double)l * d) / 8D + field_28087_j.nextDouble() * 4D + 4D) / 3D);
int l7 = 0;
if(field_28087_j.nextInt(10) == 0)
{
l7++;
}
if(biomegenbase == BiomeGenBase.forest)
{
l7 += k4 + 5;
}
if(biomegenbase == BiomeGenBase.rainforest)
{
l7 += k4 + 5;
}
if(biomegenbase == BiomeGenBase.seasonalForest)
{
//l7 += k4 + 2;
l7 += k4 + 5;
}
if(biomegenbase == BiomeGenBase.taiga)
{
l7 += k4 + 5;
}
if(biomegenbase == BiomeGenBase.desert)
{
//l7 -= 20;
l7 += k4 + 5;
}
if(biomegenbase == BiomeGenBase.tundra)
{
//l7 -= 20;
l7 += k4 + 5;
}
if(biomegenbase == BiomeGenBase.plains)
{
//l7 -= 20;
l7 += k4 + 5;
}
for(int i11 = 0; i11 < l7; i11++)
{
int k15 = k + field_28087_j.nextInt(16) + 8;
int j18 = l + field_28087_j.nextInt(16) + 8;
WorldGenerator worldgenerator = biomegenbase.getRandomWorldGenForTrees(field_28087_j);
worldgenerator.func_517_a(1.0D, 1.0D, 1.0D);
worldgenerator.generate(field_28081_p, field_28087_j, k15, field_28081_p.getHeightValue(k15, j18), j18);
}
for(int i11 = 0; i11 < l7; i11++){
int k15 = k + field_28087_j.nextInt(16) + 8;
int j18 = l + field_28087_j.nextInt(16) + 8;
WorldGenTreesNamehere treeGen = new WorldGenTreesNamehere();
treeGen.generate(field_28081_p, field_28087_j, k15, field_28081_p.getHeightValue(k15, j18), j18);
}
for(int j11 = 0; j11 < 2; j11++)
{
int l15 = k + field_28087_j.nextInt(16) + 8;
int k18 = field_28087_j.nextInt(128);
int i21 = l + field_28087_j.nextInt(16) + 8;
(new WorldGenFlowers(Block.plantYellow.blockID)).generate(field_28081_p, field_28087_j, l15, k18, i21);
}
if(field_28087_j.nextInt(2) == 0)
{
int k11 = k + field_28087_j.nextInt(16) + 8;
int i16 = field_28087_j.nextInt(128);
int l18 = l + field_28087_j.nextInt(16) + 8;
(new WorldGenFlowers(Block.plantRed.blockID)).generate(field_28081_p, field_28087_j, k11, i16, l18);
}
if(field_28087_j.nextInt(4) == 0)
{
int l11 = k + field_28087_j.nextInt(16) + 8;
int j16 = field_28087_j.nextInt(128);
int i19 = l + field_28087_j.nextInt(16) + 8;
(new WorldGenFlowers(Block.mushroomBrown.blockID)).generate(field_28081_p, field_28087_j, l11, j16, i19);
}
if(field_28087_j.nextInt(8) == 0)
{
int i12 = k + field_28087_j.nextInt(16) + 8;
int k16 = field_28087_j.nextInt(128);
int j19 = l + field_28087_j.nextInt(16) + 8;
(new WorldGenFlowers(Block.mushroomRed.blockID)).generate(field_28081_p, field_28087_j, i12, k16, j19);
}
for(int j12 = 0; j12 < 10; j12++)
{
int l16 = k + field_28087_j.nextInt(16) + 8;
int k19 = field_28087_j.nextInt(128);
int j21 = l + field_28087_j.nextInt(16) + 8;
(new WorldGenReed()).generate(field_28081_p, field_28087_j, l16, k19, j21);
}
if(field_28087_j.nextInt(32) == 0)
{
int k12 = k + field_28087_j.nextInt(16) + 8;
int i17 = field_28087_j.nextInt(128);
int l19 = l + field_28087_j.nextInt(16) + 8;
(new WorldGenPumpkin()).generate(field_28081_p, field_28087_j, k12, i17, l19);
}
int l12 = 0;
if(biomegenbase == BiomeGenBase.desert)
{
l12 += 10;
}
for(int j17 = 0; j17 < l12; j17++)
{
int i20 = k + field_28087_j.nextInt(16) + 8;
int k21 = field_28087_j.nextInt(128);
int k22 = l + field_28087_j.nextInt(16) + 8;
(new WorldGenCactus()).generate(field_28081_p, field_28087_j, i20, k21, k22);
}
for(int k17 = 0; k17 < 50; k17++)
{
int j20 = k + field_28087_j.nextInt(16) + 8;
int l21 = field_28087_j.nextInt(field_28087_j.nextInt(120) + 8);
int l22 = l + field_28087_j.nextInt(16) + 8;
(new WorldGenLiquids(Block.waterMoving.blockID)).generate(field_28081_p, field_28087_j, j20, l21, l22);
}
for(int l17 = 0; l17 < 20; l17++)
{
int k20 = k + field_28087_j.nextInt(16) + 8;
int i22 = field_28087_j.nextInt(field_28087_j.nextInt(field_28087_j.nextInt(112) + 8) + 8);
int i23 = l + field_28087_j.nextInt(16) + 8;
(new WorldGenLiquids(Block.lavaMoving.blockID)).generate(field_28081_p, field_28087_j, k20, i22, i23);
}*/
field_28074_w = field_28081_p.getWorldChunkManager().getTemperatures(field_28074_w, k + 8, l + 8, 16, 16);
for(int i18 = k + 8; i18 < k + 8 + 16; i18++)
{
for(int l20 = l + 8; l20 < l + 8 + 16; l20++)
{
int j22 = i18 - (k + 8);
int j23 = l20 - (l + 8);
int k23 = field_28081_p.findTopSolidBlock(i18, l20);
double d1 = field_28074_w[j22 * 16 + j23] - ((double)(k23 - 64) / 64D) * 0.29999999999999999D;
if(d1 < 0.5D && k23 > 0 && k23 < 128 && field_28081_p.isAirBlock(i18, k23, l20) && field_28081_p.getBlockMaterial(i18, k23 - 1, l20).getIsSolid() && field_28081_p.getBlockMaterial(i18, k23 - 1, l20) != Material.ice)
{
field_28081_p.setBlockWithNotify(i18, k23, l20, Block.snow.blockID);
}
}
}
BlockSand.fallInstantly = false;
}
public boolean saveChunks(boolean flag, IProgressUpdate iprogressupdate)
{
return true;
}
public boolean unload100OldestChunks()
{
return false;
}
public boolean canSave()
{
return true;
}
public String makeString()
{
return "RandomLevelSource";
}
private Random field_28087_j;
private NoiseGeneratorOctaves field_28086_k;
private NoiseGeneratorOctaves field_28085_l;
private NoiseGeneratorOctaves field_28084_m;
private NoiseGeneratorOctaves field_28083_n;
private NoiseGeneratorOctaves field_28082_o;
public NoiseGeneratorOctaves field_28096_a;
public NoiseGeneratorOctaves field_28095_b;
public NoiseGeneratorOctaves field_28094_c;
private World field_28081_p;
private double field_28080_q[];
private double field_28079_r[];
private double field_28078_s[];
private double field_28077_t[];
private MapGenBase field_28076_u;
private BiomeGenBase field_28075_v[];
double field_28093_d[];
double field_28092_e[];
double field_28091_f[];
double field_28090_g[];
double field_28089_h[];
int field_28088_i[][];
private double field_28074_w[];
}
DimensionNamehere
package net.minecraft.src;
public class DimensionNamehere extends DimensionBase
{
public DimensionNamehere()
{
super(1001,WorldProviderNamehere.class,TeleporterNamehere.class);
}
}
ItemNameherePortalStarter
package net.minecraft.src;
public class ItemNameherePortalStarter extends Item
{
public ItemNameherePortalStarter(int i)
{
super(i);
}
public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l)
{
if(l == 0)
{
j--;
}
if(l == 1)
{
j++;
}
if(l == 2)
{
k--;
}
if(l == 3)
{
k++;
}
if(l == 4)
{
i--;
}
if(l == 5)
{
i++;
}
int i1 = world.getBlockId(i, j, k);
if(i1 == 0)
{
world.playSoundEffect((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
world.setBlockWithNotify(i, j, k, mod_Namehere.BlockNameherePortalStarter.blockID);
}
itemstack.damageItem(1, entityplayer);
return true;
}
}
If you would like to support me without donating, please register and try out this game via this link and this link only!: http://heroesofnewerth.com/ref.php?r=3D7Y2RQ8
If anyone is interested to see my latest mod, you can check it out here!
Seems pretty simple, no? If not, I'm going to break it down for you. Firstly, at the top where it has a "package", that just tells the computer to group all of the minecraft's coding together in one...package. After that there is a line that has this means; the code is public, so it can be referenced from another "class", it is a class, it's called "mod_Namehere" and it extends this other class called "BaseMod". BaseMod is one of the ModLoader class files, which means that the "mod_Namehere" file uses the rules and ideas of that "BaseMod" class.
Then we have another "public" part. Notice it doesn't have the "class" word in it, as we have already defined that. This is the section that you put all of your ModLoader statements in. Now there's just one thing left, the version. As you can see it has the word "String" in it, all this means is that it will return some sort of text (In this case it's "1.8.1"). You can put absolutely whatever you please in between those speech marks. The only time you will see that "1.8.1" is when your mod crashes the game, it will show up in the modloader.txt file which tells you the error(s).
That's it for the basic "mod_Namehere" file! (Don't forget you can change the "Namehere" to whatever you want (Froot loopies!).
The basic "mod_Namehere" might seem all fine and dandy to you, but now it's time to see what it looks like when you add in some code for a block (NOTE: This isn't the only file you need for a block!).
I won't explain all of this as it is explained better in the "Block" tutorial. So basically the first long line "public static..." is outside those curly braces for the "public mod_Namehere()" section. That is all of the basic information on the block, like hardness etc. In the "public mod_Namehere()" section you have all of the ModLoader functions. Registering your block, giving your block a texture name and location, giving the block a name in-game and giving it a crafting recipe. That wasn't too hard now was it?
This stuff I have just showed you isn't all the "mod_Namehere" file has to offer, oh no. There are many other things that you can do with it from other ModLoader functions to using to make properties files and generating your blocks. Go forth and don't be afraid to try new things other than just copy/pasting my tutorial's code!
If you want to see a certain tutorial here, then post it and I will add it to the list.
Up to date! If you want a complete pack of the current tutorials, then you can can it here:
http://dl.dropbox.com/u/28729068/Strength's Tutorials.zip
If you're having problems when running your mod on minecraft, then run this instead of minecraft.
1. Please put your code in-between so it's easy to read.
(Don't use that ".")
2. When copying the error log, right click the recompile window and press "select all".
3. Then press enter, and copy it into a post (using step 1.) on my thread here.
Current tutorials are:
Anybody who I have seen helping a fair amount or giving good help will be put on this list. These are the rank levels, the diamond being the best and so on.
Current helpers are:
Rabisu (Thank you very much for helping when I'm not around!)
Groxmapper (Very informative help you have been giving)
Things to get:
Part 1
First of all we need to set up JDK,
1. Go to start, and right click on My Computer. Then click properties. Then advanced computer settings.
Click environmental variables
2. Is there a Path variable at the top? As the value does it say "C:\Program Files\Java\jdk1.6.0_24\bin", or something
like that? (If it does then you can skip this setup guide.)
3. Open your web browser, and download JDK SE. NOT JDK EE!
4. Once that downloads, and you set it up, open C:\Program Files\java\jdk1.6.0_24\bin, if the location is a bit different
that's OK, this is why we are doing this, to make sure we have the right location. You should see a heap of files with
the ".exe" extension. Right click on any one of them, and click properties, then copy the location.
5. Now navigate back to environmental variables(the first 2 steps) Click new, type "Path" (the capitalization matters)
as the name. Paste the location as the value.
You are now finished setting up JDK!
If you wanna make sure you did this properly, search CMD, hit enter, and type in "javac", push enter. If it gives you an error, then you did something wrong, if it gives you a long list of commands then, YAY! You did it!
--------------------------------------------------------------------------------------------------------------------------------------------
Part 2
Next, we need to set up MCP (Minecraft Coders Pack)
1. Download the latest MCP, and extract it to a folder on your desktop (doesn't have to be desktop, but it's just easier).
2. Now type in the search bar %appdata%, and hit enter. Look in your ".minecraft" folder and copy your "bin"
and "resources" folders. Go into your MCP folder and paste them into the "jars" folder.
3. (In MCP folder) Enter the bin folder and use 7zip to open "minecraft.jar" there should be a heap of files in it.
Keep that window open, now open the modloader file you downloaded, highlight all the files in it and drag 'n' drop them
into the "minecraft.jar" window. (Don't forget to delete the "META-INF" folder!)
4. Now run "decompile.bat" It should bring up a black window. Wait until it says "press any key to continue..." and do it.
(If it says something like "2 HUNKS OUT OF 2 FAILED" don't worry, it doesn't mean anything!
You have now finished setting up MCP!
Chapter 1 - Understanding Java
Before you get any further in learning java, you need to understand the fundamentals.
; Semi-colon, You put these at the end of every complete java statement.
* Multiply
/ Divide
! Not
<> Diamond operators
== Equals
!= Not equal to
>= Greater than or equal to
<= Smaller than or equal to
|| Or
&& And
++ and -- Increment operators, by using these you can tell the computer to either add one or minus one to whatever you use it with. (Explained properly later)
{} Curly brackets, these are the glue that holds together your code. They don't just make code look fancy but they also make it easier to understand for both you and your computer. Without these, the computer wouldn't be able to make sense of your code.
Language Definitions
Keyword A keyword is a word that has its own special meaning in the java programming language, and that meaning doesn't change from one program to another. Examples of keywords in java include if, else, and do.
Identifier An identifier is a name for something. The identifier's meaning can change from one program to another, but some identifiers meanings tend to change more. You can use your own meanings for your own words.
Float Can store 32 bits of information when it stores a variables values.
Double Can store 64 bits of information when it stores a variables values. The main difference between the two is how accurately it can display a number. Generally the better of the two which you will use more is double.
Byte, short, int, long Java has four types of whole numbers. Unlike float and double, the only thing that matters for these is the size of the number that you're trying to store. Below is the range of values that these words can use.
Byte - -128 to 127
Short - -32,768 to 32,767
Int - -2,147,483,648 to 2,147,483,647
Long - -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
boolean Put simply, a boolean just means that something can return either true or false instead of numbers or letters.
There is still alot of different things that I haven't covered. This is just basic stuff.
Chapter 2 - Starting out
In this chapter, I will ease you into making your first java program. Using the information from chapter 1 things should be a bit easier to understand.
Hello World!
What this does is print Hello World! on the screen. "This seems like alot of work to print two words on the screen..." you say. Yes it is, but it will get easier. Still in progress.
If you feel that my tutorials have helped you etc. Then please feel free to put this into your signature. (It will look like the banner at the top of this post)
- Firstly, if you want to use some functions for your block, then have a look in "Block.java".
1. The line with this: . All you need to focus on is the "Material.ground" part. It can be any of the following:
The main ones you need should use are the ground, rock and iron ones.
2. At this part: . If you leave it as it is now, it will drop the block you are making. If you want it to drop an item that is already part of the game, make it something like this: . For a block:
3. For the bit like this: . You can make it drop more than one just by changing the "3" to whatever you want.
4. Navigate to this sort of path: "MCP\src\minecraft\net\minecraft\src" and save a copy of your file in there with the ".java" extension.
1. This bit: The 190 is the "ID" of your block. Block ID's can only go up to 255! Change it to an ID that isn't above 255 and isn't taken already by a block in the game.
2. Is how hard it is to mine. For reference, dirt is 0.5F and stone is 1.5F.
3. Is how resistant to TNT the block is. For reference, all of the ores are 5.0F and obsidian is 2000.0F.
4. Is how much light you want it to give off (NOTE: The highest it can go is 1.0F!). For reference, torches are 0.9375F and redstone torches are 0.5F.
5. Is the name that it will look for in your code as the "code name".
6. At this part: in the version method, you can make that whatever you want in-between the " marks. It will show up in the modloader error log so people know what version it's made for.
7. Is telling modloader to well, register the block.
8. Is where your texture is found and what it is called. Change the "/Namehere.png" to what it's called. If you wanted to be able to find it in a folder of the minecraft.jar, make it something like this: "/My Folder!/Namehere.png".
9. Is what it is called in-game. Make the first "Namehere" what you called the block in the ".setBlockName("Namehere")" part. The second "Namehere" is what it's called in-game.
10. To explain the "ModLoader.AddRecipe" part. The "Namehere" word is what you get from crafting it, and the 1 is how many of it you get. Each set of "###" bits are 3 spaces across in the crafting grid. Then it's saying that "If the character is the # symbol, make it equal to redstone for when crafting".
1. This file is very simple, the only thing you need to know about is the stacksize which is a no--brainer...
1. In the "public static final" part, the 30,000 is the ID for it and it's different to blocks. Item ID's can go up to 32,000!
2. "setitemname blablabla" is the name for it in the coding, not in-game.
3. "Namehere.iconIndex etc." at the end of it is your item's name.
4. "Modloader.AddName" the first Namehere is the name you use in the coding, and the second one is the name in-game.
5. For the version thing, you can change the 1.7.3 to what ever you want. It will show up in the modloader error log.
1.5. For the ID dropped part, change the 3 to how rare you want your block/item to drop from leaves. Leave the rest of that Id dropped part.
2. At the public void updateblabla, fill in all the Namehere's.
3. Leave the rest of this file.
2. Ignore all the other stuff.
2. At the public generate surfacce whatever bit, where it has the int's and the (16)'s
mess around with this to change how it generates, I'm not too sure just yet.
2. More experienced modders can mess with it to try something different.
1. Where it says this:
That just means; "if the light value above this block is greater than or equal to 9 then start randomly trying to make the tree grow"
2. You can change the 30 in that line to whatever you want. The lower the number, generally the faster it will grow after placing it.
3. At this bit: You make only this worldgen your own one for the tree.
4. Change what you want it to drop to whatever suits you.
1. You should have read the other tutorials and know it all up to the bottom part.
2. The 261? after new ItemArmor is the ID.
3. After that, the 3 is the material I'm pretty sure.
4. The 0, 1, 2, 3 is armor types. Leave them as they are.
5. After modloader.addarmor, the NamehereArmor is what your
???_1 and ???_2 are called.
6. It reads those files from the armor file in the jar.
7. That's it! Oh, and don't forget to make those armor textures!
0. First, put this under all of your recipes etc.
1. Then you can add this to your mod_Namehere file:
2. So it would fit in like this:
3. This means that when your armor set is worn, you will have infinite breath.
4. To have another armor effect for different armor, you can make it something like this:
That's it! Enjoy your new armor with effects!
1. You know everything up till this bit:
Change the NamehereHelmet at the end of it to what you want the overlay to be used for.
2. Just underneath that is this:
Leave that %blur% at the front of it, and the Namehereoverlay is what it uses when you wear the helmet.
3. Leave the other stuff as is.
4. The overlay's dimensions that you make should be 512x512.
1. Where it has all of this stuff, (4 parts to it)
You can copy paste more onto the end to make it grow to a bigger height. Of course, you need to change some numbers around. Just look for the pattern.
1. At this bit:
You can change it or add more blocks to what you want it to be able to be placed on.
2. Your sugarcane-like plant will spawn on grass/dirt but for some reason it won't be beside water.
1. Add this to your BlockNamehere:
so it would fit in here:
1. Add this to your BlockNamehere:
so it would go here:
Change the 2 to whatever you want, 5 will shoot you sky high!
So it would fit in here:
2. The 4 at the bottom is how many half-hearts of damage it does when you walk into it.
3. If you want it to heal you on contact, then change it to something like this:
4. The only downside to the heal block is the player still makes the hurt sounds...
1. All you do differently in the mod_* file is in the static the block has "false" in it. That is what it's normal state is.
1. Everything is the same as normal up until the "onNeighborBlockChange" method.
2. Basically what it's saying it "If I'm getting powered, put a block of fire above me and if not, then put nothing there."
3. Refer to the "Structure Maker" tutorial for more help.
1. Add this to your BlockNamehere file:
2. Change the 4 at the bottom to how many half hearts you want it to heal you.
3. NOTE: It heals you very fast!
1. Note: The way the code is done in this may look different but it makes things
1. Everything is same as normal except for the "onBlockClicked" method.
2. In the "world.setBlockWithNotify" statements, the i, j, k letters stand for the coordinates x, y, z. After that it is saying what block it will put at those coordinates.
3. Optionally, if you are using the same block over and over and want to make it easier to write, you could set an integer like this:
Then you would only have to write "block" to make it use dirt.
There you have it, a nice easy way to make a house or any structure you want!
1. Some of the stuff at the very top I don't think you need but it doesn't matter.
2. At the but that says this:
for the ("/Namehere.properties") This is where you will find the generated properties file. So in this case it will just be in the .minecraft folder.
3. Keep changing the Namehere's up until this bit:
you change the namehere at the start of it and the random jumble of letters is what it will say in the properties file if you wanted to put a message in.
4. Keep changing all the Namehere's and... recompile + reob. Mod your minecraft, start the game, close it and have a look in .minecraft! There is your properties file!! Yay!
1. Same as normal...
1. Leave everything here except for changing the Namehere's.
1. At the top, you can make it extend any of these: EntityCreature, EntityMob, EntityWaterMob. This changes the way it moves and it's behaviour.
2. Change whatever you want at the top like movespeed etc. The attack strength is how many half hearts of damage it does. If you want it immune to fire then make it "true".
3. The rest is self explaining. The texture is the exact same as what you'd use as your own skin.
4. Make the canBreatheUnderwater "true" if you want it to well...breathe underwater.
5. If you never want it to despawn other than by being killed, set the canDespawn to "true".
6. Take out the attackStrength if it isn't a hostile mob.
1. At this part, change the Namehere between these " symbols to what you want it to be called in-game.
2. The 8 on the next line is the probability of the amount being spawned. If you have other NPC's in the same mod_Namehere file, think of it as a pie chart. Say one has 4 and one has 7, it will divide the total (11) between them. So the one with 4 has a probability of 4/11 chance of spawning.
2.1. The 4 is the minimum spawned per chunk.
2.2. The 10 is the max spawned per chunk.
3. For the enumcreatureblabla, you can make it one of these: monster, creature, waterCreature. This is how/where it spawns.
1. If you want it to hold something, then make your EntityNamehere like this:
2. Just change the Item.swordStone to whatever you want.
1. To make it say something on right click add this to your EntityNamehere file:
2. You can duplicate this ModLoader line to make it say other stuff on new lines.
- This is to make your NPC have a name displayed above it's head.
1. All the same as normal Human NPC, just that it has "RenderNamehere" instead of "Biped".
1. Same. Just change the "Evil Strength" in this part at the top:
1. NOTE: Capitalization matters!
2. Just name changing in here except for the "preRenderScale" method, you can change those 1.0F bits to mess with the size of the name.
3. Make sure you leave the "A" on the bits that need it. It can be anything you want just as long as it's not the same as the other names like just "RenderNamehere".
1. No helper given. Just name changing.
1. Everything here is the same as normal.
1. Same as normal, change all the Namehere's.
1. I won't explain everything here, as after looking at it closely you should understand the idea of it.
2. First off, change the bounce factor at the top to whatever you want.
3. More advanced modders can mess around with the other stuff.
4. Towards the bottom where it has this:
change the 5F to how big you want the explosion to be.
5. Leave the rest and...Done! Enjoy your new throwable explosive!
So it would fit like this:
1. Put this bit of code outside all of the modloader stuff.
2. RARITY is... how rare it is. For reference coal is 20.
3. HEIGHT ABOVE BEDROCK is self explanatory. If you set it to 20, you can find it generating 20 levels above bedrock.
4. VEIN SIZE is the max amount that it generates together.
5. The mod_Namehere.Namehere.blockID is what block it generates.
6. Enjoy your new generating ore!
1. The two statements at the top where it says "material.water", you can make that either water or lava.
2. The ".setLightOpacity" is how easily light can shine through the liquid.
3. Everything is same as normal.
1. Don't change anything besides what I tell you to unless you know what you're doing.
2. The colorMultiplier part at the top, you can change what it returns to a color code. This determines the color of your liquid.
1. Same as above, Have a look in the BlockFluid etc. files in minecraft to see more.
1. Change the 40 in "setMaxDamage(40);" to whatever number you want. This will be how much/long it has to recharge.
2. Again, change the 40 in "itemstack.damageItem(40, entityplayer);" to the number you put in step 1. This is how much the recharge bar goes down on use.
3. Leave everything else as is.
1. Same as normal.
1. Everything is the same as normal except for the line towards the top. (public static Item Namehere = Bla...)
2. The 4 in that line is the amount of hunger it heals you by. (1 = Half of one icon)
3. The "1F" is left unchanged.
4. The "false" is to tell whether or not it can be eaten by a wolf.
1. See the bit at the top where it says "private World worldObj;"? That is just declaring a variable for the worldObj function. You may not need it but I prefer to keep it anyway.
2. Setting the max stack size to 1..
3. Then in the right click method it is saying that if the world is not equal to a multiplayer world, then execute this code.
4. The first line in there is making a chat message come up on the screen saying that a pig has been spawned. That's simple enough.
5. Next line down, where it has "Pig" in it. You change that to whatever you want it to spawn. It can even work with your own custom mobs.
6. The third line is where it spawns in relation to where you clicked. It will spawn on the "y-axis" high by one block. This means it will spawn above the block you clicked.
7. The line after that should be left untouched, but the last one means that you will swing the item instead of it doing nothing.
1. Same as normal.
1. Just leave everything here as is. You can use this exact same code for any different seeds you want to do.
1. All of the "public static int" parts at the top for textures means that you are just registering the textures for the stages in the crop's growth.
2. For the "public static final Item Namehere", after the ID you change the "mod_Blabla" to what crop you want it to place when you use it on the tilled field.
3. You should know the rest, refer to "Block" tutorial for more help on the basics.
1. The "canThisPlantGrowOnThisBlockID" part is self explaining, this is what you want it to be able to grow on.
2. A little bit further down it has this line "if(world.getBlockLightValue(i, j + 1, k) >= 9)", change the ">= 9" to what ever light level you want it to grow in (Highest light level is 15, that's the brightest the sun goes). That part means that it will grow in a light level of either 9 or higher. You could also make it grow in a light value of say 6 or lower ("<= 6").
3. In the "getGrowthRate" you can change this part "float f = 1.0F;" to how fast you want it to grow.
4. The "getBlockTextureFromSideAndMetadata" part is just saying what textures it will use at what growth level.
5. In the "idDropped" bit, the 5 is how rare a chance it is of getting the redstone dust. (Higher the number, more rare of a drop it is)
6. "quantityDropped" is self explanatory, change it to how much of the block/item you want it to drop when it does.
7. That's it! Enjoy making your new crops!
1. Everything here is the same as normal.
2. The "AddRenderer" is just a way of making sure it loads the texture when the block is primed.
1. Nothing important in here. Just change the "Namehere" parts.
2. Almost all of this code is just about it activating from redstone or switches etc.
1. A little bit in it has this: "fuse = 80;" Don't change the first one you see, change this one. This is how long it takes after activated to explode.
2. Scroll down the the "private void explode()" method. Change the 9F to how big you want it to explode.
3. Leave everything else unless you know what you're doing.
1. Everything here is just name-changing except for one thing.
2. Don't change the "loadTexture" part, as everything still works fine without changing it.
1. Same as normal.
2. Change the 600 rarity at the top for how common you want it to be. (600 = Very common, 50 = Rareish)
3. Change the name of the "WorldGenNamehere" on this line to whatever yours is called.
1. For more help see the "Structure Maker" tutorial in "Advanced Block"
2. The if statement is just saying that "if the block to generate on is not sand and the block above it is not air, then don't generate. If they are equal, generate a mossy cobblestone tower 17 blocks high."
1. Same as normal.
2. Change the 600 rarity at the top for how common you want it to be. (600 = Very common, 50 = Rareish)
3. Change the name of the "WorldGenNamehere" on this line to whatever yours is called.
1. This seems like a lot of code, but don't worry as it's easy to understand. First of all we are putting a chest 1 block above ground.
2. After that it has this:
All you need to change on that line is the bit at the end with the "+ 1", you need to make sure that it corresponds with the place you put for the chest.
3. Notice on the lines like this, their pattern for adding new items.
The first line is what you're putting in it and how much of that thing. The second line, the 0 is what slot it goes in (in this case the top left) and then "itemstack".
4. Please note the numbers added to some of the names like "itemstack1" as you need to put a new number on it for each thing you put in.
1. Same as normal.
2. Change the 600 rarity at the top for how common you want it to be. (600 = Very common, 50 = Rareish)
3. Change the name of the "WorldGenNamehere" on this line to whatever yours is called.
1. Placing a mob spawner one block above ground, next line make sure to correspond to the spawner to where it is placed (see chest tutorial above for more info).
2. Change the ID where it says "Zombie" to whatever you want it to spawn. (also works on custom made mobs)
1. Same as normal, read the "Human NPC" tutorial for more information on this sort of mod.
1. Same as normal, read the "Human NPC" tutorial for more information on this sort of mod.
2. If you want it to make a sound change the "null" parts at the bottom to whatever you want. See other Entity* mob files for more help on the sounds.
I don't recommend using the Render file that techne makes for you as it is a bit broken.
1. Nothing but name-changing here.
1. You don't need to change anything but names here as techne generates it for you with everything you wanted.
NOTE: This tutorial is still sort of being fixed, so no help will be given just yet.
1.
1.
1.
1.
No help will be given for quite a long time as this is really advanced stuff. Do not attempt this unless you know how it works.
EDIT!: First Post :smile.gif: