public class railControlBlock extends Block implements ITileEntityProvider {
public static final PropertyEnum SHAPE = PropertyEnum.create("shape", BlockRailBase.EnumRailDirection.class);
@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
return new railControl();
}
public static String getName(){
return name;
}
public IProperty getShapeProperty()
{
return SHAPE;
}
public IBlockState getStateFromMeta(int meta)
{
return getDefaultState().withProperty(SHAPE, BlockRailBase.EnumRailDirection.byMetadata(meta));
}
public int getMetaFromState(IBlockState state)
{
return ((BlockRailBase.EnumRailDirection)state.getValue(SHAPE)).getMetadata();
}
protected BlockState createBlockState()
{
return new BlockState(this, new IProperty[] { SHAPE });
}
public boolean isOpaqueCube()
{
return false;
}
/**
* If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
*/
public boolean renderAsNormalBlock()
{
return false;
}
The Meaning of Life, the Universe, and Everything.
Location:
Pennsylvania
Join Date:
7/16/2015
Posts:
99
Location:
Pennsylvania
Minecraft:
UltraTechX
Member Details
ok, i will make this more clear, I created a new rail recently, and I want to add the auto-rotation like the original minecart rail, how would I do that?
Have you considered extending BlockRail or BlockRailBase? Most of the placement/rotation logic will be automatically handled for you.
BlockRailBase#canMakeSlopes determines whether a rail Block can slope up or down.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
The Meaning of Life, the Universe, and Everything.
Location:
Pennsylvania
Join Date:
7/16/2015
Posts:
99
Location:
Pennsylvania
Minecraft:
UltraTechX
Member Details
ok, so I set up BlockRail as an extender, and It worked! but one question, the train needs bigger turns than 1-block 90 degree angles, so how would I be able to say if it is in the small loop not to make a turn block?
BlockRailBase#isFlexibleRail determines whether the rail can be a corner at the specified position.
If you need custom rail shapes, I'm not entirely sure BlockRail will work for you.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
BlockRailBase#isFlexibleRail determines whether the rail can be a corner at the specified position.
If you need custom rail shapes, I'm not entirely sure BlockRail will work for you.
OK, so I changed it to extend BlockRailBase, and I used isFlexibleRail and it needs and IBlockAccess and BlockPos, but how would I get these in the constructor of the block?
so in my new track i am making I need it to work like a rail, only that I can not turn or ascend or descend, so its only north-south, and east-west.
How would I detect whether to go north south or east-west like a normal rail? Thanks in advance!
my block class:
ok, i will make this more clear, I created a new rail recently, and I want to add the auto-rotation like the original minecart rail, how would I do that?
Hope this helps!:D
Have you considered extending BlockRail or BlockRailBase? Most of the placement/rotation logic will be automatically handled for you.
BlockRailBase#canMakeSlopes determines whether a rail Block can slope up or down.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
ok, so I set up BlockRail as an extender, and It worked! but one question, the train needs bigger turns than 1-block 90 degree angles, so how would I be able to say if it is in the small loop not to make a turn block?
BlockRailBase#isFlexibleRail determines whether the rail can be a corner at the specified position.
If you need custom rail shapes, I'm not entirely sure BlockRail will work for you.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
OK, so I changed it to extend BlockRailBase, and I used isFlexibleRail and it needs and IBlockAccess and BlockPos, but how would I get these in the constructor of the block?
I figured it out! I just went into the blockstates and put the default blockstate for all the positions it could not do. Thanks for all your help!