First we need add our liquid to out main mod class!
To do so we create two blocks:
public static Block scratchLiquidStill;
public static Block scratchLiquidFlowing;
Then we need to initialize our two blocks
we do this in our load method:
scratchLiquidStill = new BlockLiquidStill(2013).setBlockName("scratchLiquidStill");
scratchLiquidFlowing = new BlockLiquidFlowing(2012).setBlockName("scratchLiquidFlowing");
This give the game name(Not Display Name!) to our blocks and sets the blockID
To get the blocks registert in to the game we put in these lines in our load method:
This will add a name to our flowing scratchLiquidFlowing block, the name is in the string: "Scratch Liquid"
We don't need a name for the Still block because it will never be held in your hand
We have now completed the coding in our main mod file!
The rest will be to add the classes:
- BlockLiquidStill
- BlockLiquidFlowing
The BlockLiquidStill class
Now to create the still block, this is almost the same as the last one.
The constructor is protected and has the Parameter of a int.
We call this int for par1.
Then we call BlockStationary with the super(par1, Material.water);
Since we extends BlockStationary this is necessary.
The parameters of the super is our int form our constructor and a Material
Since we imported Material we can use this here.
Material.water is a custom Material that mojang uses for their water aswell.
We are also setting the block hardness to a ridiculous number.
A normal grass block is something like 1.5F :/
We are also setting the LightOpacity of our block, but instead of setting the creative tab, we are disabling the stats with: this.disableStats(); and make the block stop send blockupdates when it changes metadata with: this.setRequiresSelfNotify();
We will also need to set our texture file
To do so we use the method:
public String getTextureFile(){
return "/mod_terrain.png";
}
This will set the texture to a file called mod_terrain.png in minecraft.jar
Minecraft.jar is located at: mcp/jars/bin/minecraft.jar
Just drag and drop your texture into there.
The BlockLiquidFlowing class
Now to create the flowing block we first need to add some imports:
The constructor is protected and has the Parameter of a int.
We call this int for par1.
Then we call BlockFlowing with the super(par1, Material.water);
Since we extends BlockFlowing this is necessary.
The parameters of the super is our int form our constructor and a Material
Since we imported Material we can use this here.
Material.water is a custom Material that mojang uses for their water.
We are also setting the block hardness to a ridiculous number.
A normal grass block is something like 1.5F :/
We are also setting the LightOpacity of our block and the creativeTab
We will also need to set our texture file
To do so we use the method:
public String getTextureFile(){
return "/mod_terrain.png";
}
This will set the texture to a file called mod_terrain.png in minecraft.jar, just like above in the other Liquid class.
After all this you need to create your texture.
Your texture will be 256x256 and will have 5 water images at the same location as water is in the terrain.png.
terrain.png is also located in your minecraft.jar
Hope this helped you!
Be sure to subscribe and follow Link Removed!
Everything I have done is at my youtube channel!
Have any ideas? Please feel free to comment at any of my videos or in Link Removed! You can also email me at: [email protected]
All mods i am creating is working for 1.4.7! and contains video tutorial!
Uploading Modding Tutorials every single day!
Hit up my channel at http://youtube.com/ScratchForFun!
Today we creat our 'Custom Liquid' for 1.4.7!
Main class
To do so we create two blocks:
Then we need to initialize our two blocks
we do this in our load method:
This give the game name(Not Display Name!) to our blocks and sets the blockID
To get the blocks registert in to the game we put in these lines in our load method:
To set the ingame name / Display name to our block we write:
This will add a name to our flowing scratchLiquidFlowing block, the name is in the string: "Scratch Liquid"
We don't need a name for the Still block because it will never be held in your hand
We have now completed the coding in our main mod file!
The rest will be to add the classes:
- BlockLiquidStill
- BlockLiquidFlowing
The BlockLiquidStill class
We start by importing:
This will make us able to use content from both a custom class named BlockStationary and use some custom Materials.
Now, lets just jump right to it.
First our class needs to extends BlockStationary.
The line will look somthing like this:
Now we can use the content from BlockStationary and we can use it's 'super'.
So the constructor of this class will look something like this:
The constructor is protected and has the Parameter of a int.
We call this int for par1.
Then we call BlockStationary with the super(par1, Material.water);
Since we extends BlockStationary this is necessary.
The parameters of the super is our int form our constructor and a Material
Since we imported Material we can use this here.
Material.water is a custom Material that mojang uses for their water aswell.
We are also setting the block hardness to a ridiculous number.
A normal grass block is something like 1.5F :/
We are also setting the LightOpacity of our block, but instead of setting the creative tab, we are disabling the stats with: this.disableStats(); and make the block stop send blockupdates when it changes metadata with: this.setRequiresSelfNotify();
We will also need to set our texture file
To do so we use the method:
This will set the texture to a file called mod_terrain.png in minecraft.jar
Minecraft.jar is located at: mcp/jars/bin/minecraft.jar
Just drag and drop your texture into there.
The BlockLiquidFlowing class
This will make us able to use content from both a custom class named BlockFlowing and use some custom Materials.
Now, lets just jump right to it.
First our class needs to extends BlockFlowing.
The line will look somthing like this:
Now we can use the content from BlockFlowing and we can use it's 'super'.
So the constructor of this class will look something like this:
The constructor is protected and has the Parameter of a int.
We call this int for par1.
Then we call BlockFlowing with the super(par1, Material.water);
Since we extends BlockFlowing this is necessary.
The parameters of the super is our int form our constructor and a Material
Since we imported Material we can use this here.
Material.water is a custom Material that mojang uses for their water.
We are also setting the block hardness to a ridiculous number.
A normal grass block is something like 1.5F :/
We are also setting the LightOpacity of our block and the creativeTab
We will also need to set our texture file
To do so we use the method:
This will set the texture to a file called mod_terrain.png in minecraft.jar, just like above in the other Liquid class.
After all this you need to create your texture.
Your texture will be 256x256 and will have 5 water images at the same location as water is in the terrain.png.
terrain.png is also located in your minecraft.jar
Hope this helped you!
Be sure to subscribe and follow Link Removed!
Everything I have done is at my youtube channel!
Have any ideas? Please feel free to comment at any of my videos or in Link Removed! You can also email me at: [email protected]