public class EvilStairs extends BlockStairs {
public static final String name = ReferenceBlocks.EvilStairs;
private static class modelState implements IBlockState {
@Override
public Collection getPropertyNames() {
// TODO Auto-generated method stub
return null;
}
@Override
public Comparable getValue(IProperty property) {
// TODO Auto-generated method stub
return null;
}
@Override
public IBlockState withProperty(IProperty property, Comparable value) {
// TODO Auto-generated method stub
return null;
}
@Override
public IBlockState cycleProperty(IProperty property) {
// TODO Auto-generated method stub
return null;
}
@Override
public ImmutableMap getProperties() {
// TODO Auto-generated method stub
return null;
}
@Override
public Block getBlock() {
return IBlocks.EvilBlock;
}
};
private static IBlockState md = new modelState();
public EvilStairs() {
You will have some errors. To fix most of them import the required libraries (ctrl + shift + o), idea users your on your own with that. The next errors are where my references are. I have a reference file for all the names and the blocks themselves. It is up to you to fix these (read the preface). It really is just replacing them with your references or string (the former allows for easier mass editing).
This was copied directly from my working code, so if it doesn't work, it is on your end and not me.
You may have noticed the IBlockState and are wondering what that is, read below.
IBlockState Explaination:
I don't know.
From what I gathered from its name and code, it is an object that represents the blocks information. It seems to have a functional stairs, the code itself requires an IBlockState passed by the super. For my (and probably yours) purposes, you can leave all of it as is except the getBlock. For this just change the return to a reference to the block you want the block to look like.
Now the easy part is done. Time to make the json files.
Ok so you made the json files and placed the where they need to go (read preface)
Your json files conents will have to follow this format:
The _outer and _inner can either reference different Json file (by name) or you can set them all to the same Json (I assume this is for easier customization of stairs)
If you referenced other Jsons in you block state, they will have the same format.
And then save and run the game. It should be done.
There is only one flaw. These stairs will not transform into a corner piece. I believe this is not an error in this code, but because that is a different block altogether and requires different coding.
Actually...you just need to extend BlockStairs. In fact, you can just call the constructor for BlockStairs. The BlockStairs object is a fully implemented stair block that just needs a block state to base its properties on.
Block stairsMazewood = new BlockStairs(planksMazewood.getDefaultState())
An IBlockState is the Interface for block states. A block state is an object that stores IProperty's like "facing", "variant", etc.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumEdit:
This is an old post, may fix this later, but no need for now.
Here is the finished class
package com.zdoctor.pevil.blocks;
import java.util.Collection;
import com.google.common.collect.ImmutableMap;
import com.zdoctor.pevil.init.IBlocks;
import com.zdoctor.pevil.reference.Reference;
import com.zdoctor.pevil.reference.ReferenceBlocks;
import net.minecraft.block.Block;
import net.minecraft.block.BlockStairs;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraftforge.fml.common.registry.GameRegistry;
public class EvilStairs extends BlockStairs {
public static final String name = ReferenceBlocks.EvilStairs;
private static class modelState implements IBlockState {
@Override
public Collection getPropertyNames() {
// TODO Auto-generated method stub
return null;
}
@Override
public Comparable getValue(IProperty property) {
// TODO Auto-generated method stub
return null;
}
@Override
public IBlockState withProperty(IProperty property, Comparable value) {
// TODO Auto-generated method stub
return null;
}
@Override
public IBlockState cycleProperty(IProperty property) {
// TODO Auto-generated method stub
return null;
}
@Override
public ImmutableMap getProperties() {
// TODO Auto-generated method stub
return null;
}
@Override
public Block getBlock() {
return IBlocks.EvilBlock;
}
};
private static IBlockState md = new modelState();
public EvilStairs() {
super(md);
GameRegistry.registerBlock(this, name);
IBlocks.EvilStairs = this;
setUnlocalizedName(Reference.MODID + "_" + ReferenceBlocks.EvilStairs);
setCreativeTab(CreativeTabs.tabBlock);
}
}
You will have some errors. To fix most of them import the required libraries (ctrl + shift + o), idea users your on your own with that. The next errors are where my references are. I have a reference file for all the names and the blocks themselves. It is up to you to fix these (read the preface). It really is just replacing them with your references or string (the former allows for easier mass editing).
This was copied directly from my working code, so if it doesn't work, it is on your end and not me.
You may have noticed the IBlockState and are wondering what that is, read below.
IBlockState Explaination:
I don't know.
From what I gathered from its name and code, it is an object that represents the blocks information. It seems to have a functional stairs, the code itself requires an IBlockState passed by the super. For my (and probably yours) purposes, you can leave all of it as is except the getBlock. For this just change the return to a reference to the block you want the block to look like.
Now the easy part is done. Time to make the json files.
Ok so you made the json files and placed the where they need to go (read preface)
Your json files conents will have to follow this format:
BlockState:
{
"variants": {
"facing=east,half=bottom,shape=straight": { "model": "YourModID:YourJsonFileNamestairs" },
"facing=west,half=bottom,shape=straight": { "model": "YourModID:YourJsonFileNamestairs", "y": 180, "uvlock": true },
"facing=south,half=bottom,shape=straight": { "model": "YourModID:YourJsonFileNamestairs", "y": 90, "uvlock": true },
"facing=north,half=bottom,shape=straight": { "model": "YourModID:YourJsonFileNamestairs", "y": 270, "uvlock": true },
"facing=east,half=bottom,shape=outer_right": { "model": "YourModID:YourJsonFileName_outer" },
"facing=west,half=bottom,shape=outer_right": { "model": "YourModID:YourJsonFileName_outer", "y": 180, "uvlock": true },
"facing=south,half=bottom,shape=outer_right": { "model": "YourModID:YourJsonFileName_outer", "y": 90, "uvlock": true },
"facing=north,half=bottom,shape=outer_right": { "model": "YourModID:YourJsonFileName_outer", "y": 270, "uvlock": true },
"facing=east,half=bottom,shape=outer_left": { "model": "YourModID:YourJsonFileName_outer", "y": 270, "uvlock": true },
"facing=west,half=bottom,shape=outer_left": { "model": "YourModID:YourJsonFileName_outer", "y": 90, "uvlock": true },
"facing=south,half=bottom,shape=outer_left": { "model": "YourModID:YourJsonFileName_outer" },
"facing=north,half=bottom,shape=outer_left": { "model": "YourModID:YourJsonFileName_outer", "y": 180, "uvlock": true },
"facing=east,half=bottom,shape=inner_right": { "model": "YourModID:YourJsonFileNameinner_inner" },
"facing=west,half=bottom,shape=inner_right": { "model": "YourModID:YourJsonFileNameinner_inner", "y": 180, "uvlock": true },
"facing=south,half=bottom,shape=inner_right": { "model": "YourModID:YourJsonFileNameinner_inner", "y": 90, "uvlock": true },
"facing=north,half=bottom,shape=inner_right": { "model": "YourModID:YourJsonFileNameinner_inner", "y": 270, "uvlock": true },
"facing=east,half=bottom,shape=inner_left": { "model": "YourModID:YourJsonFileNameinner_inner", "y": 270, "uvlock": true },
"facing=west,half=bottom,shape=inner_left": { "model": "YourModID:YourJsonFileNameinner_inner", "y": 90, "uvlock": true },
"facing=south,half=bottom,shape=inner_left": { "model": "YourModID:YourJsonFileNameinner_inner" },
"facing=north,half=bottom,shape=inner_left": { "model": "YourModID:YourJsonFileNameinner_inner", "y": 180, "uvlock": true },
"facing=east,half=top,shape=straight": { "model": "YourModID:YourJsonFileNamestairs", "x": 180, "uvlock": true },
"facing=west,half=top,shape=straight": { "model": "YourModID:YourJsonFileNamestairs", "x": 180, "y": 180, "uvlock": true },
"facing=south,half=top,shape=straight": { "model": "YourModID:YourJsonFileNamestairs", "x": 180, "y": 90, "uvlock": true },
"facing=north,half=top,shape=straight": { "model": "YourModID:YourJsonFileNamestairs", "x": 180, "y": 270, "uvlock": true },
"facing=east,half=top,shape=outer_right": { "model": "YourModID:YourJsonFileName_outer", "x": 180, "uvlock": true },
"facing=west,half=top,shape=outer_right": { "model": "YourModID:YourJsonFileName_outer", "x": 180, "y": 180, "uvlock": true },
"facing=south,half=top,shape=outer_right": { "model": "YourModID:YourJsonFileName_outer", "x": 180, "y": 90, "uvlock": true },
"facing=north,half=top,shape=outer_right": { "model": "YourModID:YourJsonFileName_outer", "x": 180, "y": 270, "uvlock": true },
"facing=east,half=top,shape=outer_left": { "model": "YourModID:YourJsonFileName_outer", "x": 180, "y": 90, "uvlock": true },
"facing=west,half=top,shape=outer_left": { "model": "YourModID:YourJsonFileName_outer", "x": 180, "y": 270, "uvlock": true },
"facing=south,half=top,shape=outer_left": { "model": "YourModID:YourJsonFileName_outer", "x": 180, "y": 180, "uvlock": true },
"facing=north,half=top,shape=outer_left": { "model": "YourModID:YourJsonFileName_outer", "x": 180, "uvlock": true },
"facing=east,half=top,shape=inner_right": { "model": "YourModID:YourJsonFileNameinner_inner", "x": 180, "uvlock": true },
"facing=west,half=top,shape=inner_right": { "model": "YourModID:YourJsonFileNameinner_inner", "x": 180, "y": 180, "uvlock": true },
"facing=south,half=top,shape=inner_right": { "model": "YourModID:YourJsonFileNameinner_inner", "x": 180, "y": 90, "uvlock": true },
"facing=north,half=top,shape=inner_right": { "model": "YourModID:YourJsonFileNameinner_inner", "x": 180, "y": 270, "uvlock": true },
"facing=east,half=top,shape=inner_left": { "model": "YourModID:YourJsonFileNameinner_inner", "x": 180, "y": 90, "uvlock": true },
"facing=west,half=top,shape=inner_left": { "model": "YourModID:YourJsonFileNameinner_inner", "x": 180, "y": 270, "uvlock": true },
"facing=south,half=top,shape=inner_left": { "model": "YourModID:YourJsonFileNameinner_inner", "x": 180, "y": 180, "uvlock": true },
"facing=north,half=top,shape=inner_left": { "model": "YourModID:YourJsonFileNameinner_inner", "x": 180, "uvlock": true }
}
}
The _outer and _inner can either reference different Json file (by name) or you can set them all to the same Json (I assume this is for easier customization of stairs)
Item:
{
"parent": "YourModId:block/JsonInBlockFileName",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
},
"gui": {
"rotation": [ 0, 180, 0 ]
}
}
}
Block:
{
"parent": "block/stairs",
"textures": {
"bottom": "YourModId:blocks/TextureName",
"top": "YourModId:blocks/TextureName",
"side": "YourModID:blocks/Texturename"
}
}
If you referenced other Jsons in you block state, they will have the same format.
And then save and run the game. It should be done.
There is only one flaw. These stairs will not transform into a corner piece. I believe this is not an error in this code, but because that is a different block altogether and requires different coding.
My Mods:
- Happy Coding
-
Actually...you just need to extend BlockStairs. In fact, you can just call the constructor for BlockStairs. The BlockStairs object is a fully implemented stair block that just needs a block state to base its properties on.
An IBlockState is the Interface for block states. A block state is an object that stores IProperty's like "facing", "variant", etc.
Putting the CENDENT back in transcendent!