So here's how to make fences and stairs!
Fences are REALLY easy
FENCES
@Mod(modid = "YourMod", name = "Your Mod", version = "1.0")
public class YourModl {
public static Block YourFence
YourFence = new BlockFence(1000, "what you want it to be made of", Material.(putmaterialhere, no commas)).setHardness(3F).setUnlocalizedName("yourfence");
LanguageRegistry.addName(YourFence, "Your Fence")
GameRegistry.registerBlock(YourFence, "Your Fence")
The @Mod is just the starting of the mod
@Mod(modid = "YourMod", name = "Your Mod", version = "1.0")
the public static is adding the block instance
public static Block YourFence;
The "yourfence = yadadada" is defining the fence. You don't need a custom class, because the fence class allows you to make it have a custom texture
YourFence = new BlockFence(1000, "what you want it to be made of", Material.(putmaterialhere, no commas)).setHardness(3F).setUnlocalizedName("yourfence");
The "whatyouwantittobemadeof" is where you put the texture. It wraps the texture around the fence. Say you want diamond block. "blockDiamond" Say you want one of your blocks "yourtexturepath:YourBlock"
@Mod(modid = "YourMod", name = "Your Mod", version = "1.0")
public class YourModl {
public static Block YourStair
YourStair = new BlockYourStair(1000, Block., 0).setHardness(3F).setUnlocalizedName("yourfence");
LanguageRegistry.addName(YourStair, "Your Stair")
GameRegistry.registerBlock(YourStair, "Your Stair")
The @Mod is just the starting of the mod
@Mod(modid = "YourMod", name = "Your Mod", version = "1.0")
the public static is adding the block instance
public static Block YourStair;
The "yourstair = yadadada" is defining the stair. You need a custom class, because the stair class is protected
YourStair = new BlockYourStair(1000, Block., 0).setHardness(3F).setUnlocalizedName("yourfence");
The block. is saying "what block is the stair" say you want diamond. put block as; Block.blockDiamond
If you want one of your own blocks. just put the name of the block; YourBlock
(1000, Block.blockDiamond, 0) or (1000, YourBlock, 0)
The @Mod is just the starting of the mod the public static is adding the block instance The "yourfence = yadadada" is defining the fence. You don't need a custom class, because the fence class allows you to make it have a custom texture The "whatyouwantittobemadeof" is where you put the texture. It wraps the texture around the fence. Say you want diamond block. "blockDiamond" Say you want one of your blocks "yourtexturepath:YourBlock" The rest is just registering the block
Here, you could add the source code instead of just putting it in there, + adding like small code "stripes"
example:
public static Block yourfence;
Just some suggestions
alright just edited that! Thanks for the suggestion!
Np! Instead of a cookie, could I get you to click the little green thing? . I know I sound desperate..
Not at all! Upvotes are far better than cookies, I know! Clicked and clicked.
Edit: Maybe you can help with this; if not, that's cool, you've still been upvoted
I split out my block registry entries into a separate file - minehack.blocks.BlockReg and while BlockReg inits and everything else works just fine, it seems to have broken the public Icon getIcon deal in WallAntigonite.java -
public Icon getIcon(int par1, int par2)
{
return Minehack.BlockAntigonite.getBlockTexturefromSide(par1);
}
Eclipse tells me that BlockAntigonite cannot be resolved or is not a field. All of the registering entries that were in Minehack.java are now in the BlockReg.java which sits in minehack.blocks along with all the block and wall classes. It worked perfectly before the entries were moved, and I'm not sure if there's a way to fix this issue and still keep my BlockReg file. Is it doable? (And thank you again!)
I did try Jimmy's suggestion, but Eclipse gives me the same error. I'm not sure what else I can do from here; I've tried every combination of possible ____.BlockAntigonite that I can think of.
Edit: I ended up adding a field to the BlockReg file - public static Block BlockAntigonite - and it seems to have accepted that. I'll edit this again re: it working after I've tested it.
Edit2: Nope. Running that under 1.6.1 resulted in a Null Pointer Exception. Code is clean of syntactical errors, so I'll have to keep messing with the code until I get it figured out.
Can you explain this for 1.6? I tried and i kept getting problems, I finally got something going by copying the data from BlockWall, but I had to remove "public int getRenderType()" otherwise it would crash. I'm using custom blocks, so the fence method only woluld return vanilla textures.
My wall renders funny and looks like a solid block when i make a square of 4, not like the vanilla wall.
I would like to easily "extend" BlockWall, or something, but I'm stuck for the moment.
Fences are REALLY easy
FENCES
The @Mod is just the starting of the mod
the public static is adding the block instance
The "yourfence = yadadada" is defining the fence. You don't need a custom class, because the fence class allows you to make it have a custom texture
The "whatyouwantittobemadeof" is where you put the texture. It wraps the texture around the fence. Say you want diamond block. "blockDiamond" Say you want one of your blocks "yourtexturepath:YourBlock"
The rest is just registering the block
STAIR
MAIN CLASS
The @Mod is just the starting of the mod
the public static is adding the block instance
The "yourstair = yadadada" is defining the stair. You need a custom class, because the stair class is protected
The block. is saying "what block is the stair" say you want diamond. put block as; Block.blockDiamond
If you want one of your own blocks. just put the name of the block; YourBlock
The rest is just registering the block
BlockYourStair Class
public class is defining the class, extends is telling what it is mirroring
The part after is the constructor, is tells what the code should be if calling this class
If you have any errors, message them to me!
Visit my mod! http://www.planetminecraft.com/mod/morestuff-v1/
How do you think I should make it more organized?
Visit my mod! http://www.planetminecraft.com/mod/morestuff-v1/
alright just edited that! Thanks for the suggestion!
Visit my mod! http://www.planetminecraft.com/mod/morestuff-v1/
Is this with using modloader or forge?Just looked at the title
Not at all! Upvotes are far better than cookies, I know! Clicked and clicked.
Edit: Maybe you can help with this; if not, that's cool, you've still been upvoted
I split out my block registry entries into a separate file - minehack.blocks.BlockReg and while BlockReg inits and everything else works just fine, it seems to have broken the public Icon getIcon deal in WallAntigonite.java -
Eclipse tells me that BlockAntigonite cannot be resolved or is not a field. All of the registering entries that were in Minehack.java are now in the BlockReg.java which sits in minehack.blocks along with all the block and wall classes. It worked perfectly before the entries were moved, and I'm not sure if there's a way to fix this issue and still keep my BlockReg file. Is it doable? (And thank you again!)
Edit: I ended up adding a field to the BlockReg file - public static Block BlockAntigonite - and it seems to have accepted that. I'll edit this again re: it working after I've tested it.
Edit2: Nope. Running that under 1.6.1 resulted in a Null Pointer Exception. Code is clean of syntactical errors, so I'll have to keep messing with the code until I get it figured out.
My wall renders funny and looks like a solid block when i make a square of 4, not like the vanilla wall.
I would like to easily "extend" BlockWall, or something, but I'm stuck for the moment.
TheCountChuckula's Mods on CurseForge