I will not continue to make or update any tutorials for now, so I declare this thread, DEAD...
Multi-Textured Block
I've looked around in the tutorials section and I figured that there weren't many good tutorials on making multi textured blocks so I decided to make my own :smile.gif:
NOTE: I recommend writing out the code manually so that you learn properly.
Just remember to click the on the tutorial that helped you!
Even though it may sound complicated it is really quite simple.
For this tutorial I will presume you already have your mod_YourBlock and the BlockYourBlock files.
So, lets cut to the chase. Here we just have a simple block:
package net.minecraft.src;
import java.util.Random;
public class mod_YourBlock extends BaseMod
{
public static final Block YourBlock = new BlockYourBlock(200, 0).setHardness(3.5F).setResistance(2.0F).setBlockName("yourBlock");
public static int YourBlockTop;
public static int YourBlockBottom;
public void load()
{
//Block Register
ModLoader.RegisterBlock(YourBlock);
//Texture
YourBlock.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/mod/yourblock.png");
YourBlockTop = ModLoader.addOverride("/terrain.png", "/mod/yourblocktop.png");
YourBlockBottom = ModLoader.addOverride("/terrain.png", "/mod/yourblockbottom.png");
//In-Game Names
ModLoader.AddName(YourBlock, "Awesome Block!");
}
public String getVersion()
{
return "Your Mod v0.1";
}
}
Now you should know everything up till here:
public static int YourBlockTop;
public static int YourBlockBottom;
This bit creates two intiger's for referencing to the bottom and top textures
This bit just makes it so that the intigers now have textures to reference to when we make the new block and stuff.
That all we need to do in mod_YourBlock.
Now for BlockYourBlock:
package net.minecraft.src;
import java.util.Random;
public class BlockYourBlock extends Block
{
public BlockYourBlock(int i, int j)
{
super(i, Material.ground);
j = blockIndexInTexture;
}
public int idDropped(int i, Random random)
{
return mod_YourBlock.YourBlock.blockID;
}
public int quantityDropped(Random random)
{
return 1;
}
public int getBlockTextureFromSide(int i)
{
if(i == 1)
{
return mod_YourBlock.YourBlockTop;
}
if(i == 0)
{
return mod_YourBlock.YourBlockBottom;
}else
{
return blockIndexInTexture;
}
}
}
The function getBlockTextureFromSide just makes it give different sides different textures depending on what you set it to.
In this bit:
if(i == 1)
The i represents the different sides of our block. The number 1 represents a certain side of our block:
0 - bottom
1 - top
2,3,4,5 - sides
The opposite sides make pairs like this:
2,3
4,5
So:
if(i == 1) //i = side 1 = top
{
return mod_YourBlock.YourBlockTop; //the texture to go on top
}
Also:
}else //if it encounters something different in this case another side
{
return blockIndexInTexture; //normal block texture
}
You can change the names of the textures, blocks and intigers as long as you dont change the meaning of the code
All you have left to do is make some images and test it out.
In this tutorial I will show you how to make a new bucket
Here we have a block and some bucket Items:
package net.minecraft.src;
import java.util.Random;
public class mod_YourBlock extends BaseMod
{
public static final Block YourBlock = new BlockYourBlock(200, 0).setHardness(3.5F).setResistance(2.0F).setBlockName("yourBlock");
public static int YourBlockTop;
public static int YourBlockBottom;
public static final Item newBucket = new ItemBucketNew(426, 0).setItemName("bucket");
public static final Item newBucketWater = new ItemBucketNew(427, Block.waterMoving.blockID).setItemName("bucketWater");
public static final Item newBucketLava = new ItemBucketNew(428, Block.lavaMoving.blockID).setItemName("bucketLava");
public void load()
{
//Block Register
ModLoader.RegisterBlock(YourBlock);
//Texture
YourBlock.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/mod/yourblock.png");
YourBlockTop = ModLoader.addOverride("/terrain.png", "/mod/yourblocktop.png");
YourBlockBottom = ModLoader.addOverride("/terrain.png", "/mod/yourblockbottom.png");
newBucket.iconIndex = ModLoader.addOverride("/gui/items.png", "/aluminium_mod/bucket.png");
newBucketWater.iconIndex = ModLoader.addOverride("/gui/items.png", "/mod/bucketWater.png");
newBucketLava.iconIndex = ModLoader.addOverride("/gui/items.png", "/mod/bucketLava.png");
//In-Game Names
ModLoader.AddName(YourBlock, "Awesome Block!");
ModLoader.AddName(newBucket, "Bucket");
ModLoader.AddName(newBucketWater, "Bucket of Water");
ModLoader.AddName(newBucketLava, "Bucket of Lava");
//Crafting recipes
ModLoader.AddRecipe(new ItemStack(newBucket, 1), new Object[] {
"I I", " I ", Character.valueOf('I'), Item.ingotGold
});
}
public String getVersion()
{
return "Your Mod v0.1";
}
}
Not much to explain here so lets move on to the ItemBucketNew class:
Basically its just name changing and it just states that when you click water it gives you a water bucket and when you click lava it gives you a lava bucket
Now recompile and obfuscate you should be done :smile.gif:
Currently there is an issue with the NPC tutorial where the mob doesn't move and I will try and fix this as soon as possible
In this tutorial I will show you how to make a simple NPC that spawns at night that has a human shape.
Make sure you've got this at the top of your mod_ file:
import java.util.*;
First off we need to add some methods to our constructor in mod_YourBlock:
Where it says EntityGuy.class, is where we state what entity it will be.
The three numbers in the middle represent the spawn rate. 1, 1, 1, would make only one spawn every chunk. 10, 10, 10, would make around ten or more spawn in every chunk.
Where it says EnumCreatureType.monster, we can change creature to either:
creature
monster
waterCreature
These determine whether (creature) your mob will spawn in the day, (monster) spawn at night, or (waterCreature) spawn in water.
Next outside of your constructor add this:
public void AddRenderer(Map map)
{
map.put(EntityGuy.class, new RenderBiped(new ModelBiped(), 0.5F));
}
This makes the game render your mob. We don't need to make a new render file or a new model file because we are using already created files.
Now we need to make a new file called EntityGuy:
package net.minecraft.src;
import java.util.*;
import net.minecraft.client.Minecraft;
public class EntityGuy extends EntityMob
{
public EntityGuy(World world)
{
super(world);
texture = "/mod/guy.png";
moveSpeed = 1.5F;
isImmuneToFire = true;
health = 20;
attackStrength = 10;
}
public int getMaxHealth()
{
return 20;
}
public boolean canBreatheUnderwater()
{
return false;
}
protected boolean canDespawn()
{
return false;
}
protected String getLivingSound()
{
return null;
}
protected String getHurtSound()
{
return null;
}
protected String getDeathSound()
{
return null;
}
protected float getSoundVolume()
{
return 0.4F;
}
public void onEntityDeath()
{
}
protected int getDropItemId()
{
return Item.appleGold.shiftedIndex;
}
public ItemStack getHeldItem()
{
return new ItemStack(Item.stick, 1);
}
public void onLivingUpdate()
{
}
protected void updateEntityActionState()
{
}
}
In this line notice how our mob extends EntityMob:
texture: Your mobs texture moveSpeed: The speed at which your mob will move around isImmuneToFire: Health health: Its amount of hearts attackStrength: (only if your mob is a monster) The damage you will take when it hits you
No I will explain these last bits quickly
Maximum health:
public int getMaxHealth()
{
return 20;
}
Can it breathe underwater:
public boolean canBreatheUnderwater()
{
return false;
}
Hi, if you wouldn't mind could you do a tutorial on a simple NPC (basically it spawns and when you kill the NPC it drops items of your choice, or basically a pig that makes no noises and gas a human body haha.) BTW your tutorials are so great and in depth :biggrin.gif:
Hi, if you wouldn't mind could you do a tutorial on a simple NPC (basically it spawns and when you kill the NPC it drops items of your choice, or basically a pig that makes no noises and gas a human body haha.) BTW your tutorials are so great and in depth :biggrin.gif:
Yes I could make a tutorial on a new NPC but it would be quite simple
Can you do a tutorial on making new ores and smelting them
I don't think i will. You see, there are heaps of tutorials on making new ores and Items and blocks out there, so I want to make tutorials that aren't very common. If you want a new ore check out the other awesome tutorials that have this stuff. Maybe when I've got some more time I'll make a new simple tutorials thread. :smile.gif:
Multi-Textured Block
I've looked around in the tutorials section and I figured that there weren't many good tutorials on making multi textured blocks so I decided to make my own :smile.gif:
Just remember to click the on the tutorial that helped you!
Even though it may sound complicated it is really quite simple.
For this tutorial I will presume you already have your mod_YourBlock and the BlockYourBlock files.
So, lets cut to the chase. Here we just have a simple block:
Now you should know everything up till here:
This bit creates two intiger's for referencing to the bottom and top textures
If we continue we will encounter this:
This bit just makes it so that the intigers now have textures to reference to when we make the new block and stuff.
That all we need to do in mod_YourBlock.
Now for BlockYourBlock:
The function getBlockTextureFromSide just makes it give different sides different textures depending on what you set it to.
In this bit:
The i represents the different sides of our block. The number 1 represents a certain side of our block:
The opposite sides make pairs like this:
So:
Also:
You can change the names of the textures, blocks and intigers as long as you dont change the meaning of the code
All you have left to do is make some images and test it out.
I hope it helps!
In this tutorial I will show you how to make a new bucket
Here we have a block and some bucket Items:
Not much to explain here so lets move on to the ItemBucketNew class:
The only important bit in here is this part:
Basically its just name changing and it just states that when you click water it gives you a water bucket and when you click lava it gives you a lava bucket
Now recompile and obfuscate you should be done :smile.gif:
In this tutorial I will show you how to add your custom blocks to the creative inventory without editing base files.
Make sure you add this to the top!:
This one is quite simple. In your mod constructor add this:
Out side of your mod constructor just paste this code in:
If you want to add more than 1 just keep adding them to the list:
If you want to add a block with multiple subtypes, you need to add this:
Now your finished code should look like this:
In this tutorial I will show you how to make an Item act as fuel.
Fist we start off by put this piece of code outside of our constructor:
This line determines what item will act as fuel:
And this one determines how long it wil burn for:
Coal lasts for 1600 and it smelts 8 items, so it is 200 per item you want smelted.
Full code:
And thats it :biggrin.gif:
I hope you liked my tutorial
In this tutorial I will show you how to make a simple NPC that spawns at night that has a human shape.
Make sure you've got this at the top of your mod_ file:
First off we need to add some methods to our constructor in mod_YourBlock:
Where it says EntityGuy.class, is where we state what entity it will be.
The three numbers in the middle represent the spawn rate. 1, 1, 1, would make only one spawn every chunk. 10, 10, 10, would make around ten or more spawn in every chunk.
Where it says EnumCreatureType.monster, we can change creature to either:
Next outside of your constructor add this:
This makes the game render your mob. We don't need to make a new render file or a new model file because we are using already created files.
Now we need to make a new file called EntityGuy:
In this line notice how our mob extends EntityMob:
This means it adopts the properties of Monsters.
Also if your mob is a monster:
Then your Entity must extend EntityMob
After this we some lines with some pretty self explanatory functions:
texture: Your mobs texture
moveSpeed: The speed at which your mob will move around
isImmuneToFire: Health
health: Its amount of hearts
attackStrength: (only if your mob is a monster) The damage you will take when it hits you
No I will explain these last bits quickly
Maximum health:
Can it breathe underwater:
Can it despan:
Space for putting in sounds
Sound Volume:
Doing stuff when it dies like explode:
Item dropped:
Make it hold an Item:
Doing stuff when its alive:
Updating its action state:
Now that you've finished your mob, save, recompile, reobfuscate and try him out
Making your Mob Follow you:
Don't forget to add this if you don't already have it:
To make your mob follow you add this to the public void onLivingUpdate() method:
Once you've got that in your mob should now follow you around :smile.gif:
Specific Biome Spawn
As the title says I wil show you how to make your mob spawn in a specific biome.
In your constuctor where you have your method ModLoader.AddSpawn you need to add this at the end:
If you want to add more than one just put a comma after the last biome and state the second one:
If you need to know the names of all the different biomes just look in BiomeGenBase.java
Coming soon!
It works fine for me, but I'll check it again later for errorsEDIT: you need to add this:
and:
ROOT folder/mcp50/bin/minecraft/<folder name> mod/image.pngEDIT: its this instead: ROOT folder/mcp50/bin/<folder name> mod/image.png
_______
Yes I could make a tutorial on a new NPC but it would be quite simple
I'm glad I could help :biggrin.gif:
First of all,great tutorials.
I can comfirm. Also getting the 'lastGuiOpen' error.
-LK
Blah Blah BlahUGHHH. How could I be so dumb I forgot to add this:
:tongue.gif: