Hi! I am trying to make a streetcar track as a part of my European cities mod (basically the track is a whole block instead of on top of another block). I have tried a LOT of stuff and finally succesfully changed the collision box BUT, It still doesn't render correctly. I use the code I usually use for multi-textured blocks. The issue is just that the game STILL thinks it is a normal track. (I have changed the renderType to zero). The reason I have set isOpaqueCube() and renderAsNormalBlock() false is because otherwise it looks even more messed up. I guess I will just change that back if I get this working.
public class Test extends BlockRailBase {
@SideOnly(Side.CLIENT)
private Icon theIcon;
@SideOnly(Side.CLIENT)
private int renderType = 0;
@SideOnly(Side.CLIENT)
public static Icon topIcon;
@SideOnly(Side.CLIENT)
public static Icon bottomIcon;
@SideOnly(Side.CLIENT)
public static Icon sideIcon;
@Override
@SideOnly(Side.CLIENT)
public void setRenderType(int value)
{
setRenderType(0);
}
public boolean isBlockSolid() {
return true;
}
@Override
public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
int l = par1IBlockAccess.getBlockMetadata(1, 1, 1);
if (l >= 2 && l <= 5)
{
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
else
{
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
}
protected Test(int par1)
{
super(3512, false);
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
public Icon getIcon(int par1, int par2)
{
if(par1 == 0) {
return bottomIcon;
} else if(par1 == 1) {
return topIcon;
} else {
return sideIcon;
}
}
public void registerIcons(IconRegister par1IconRegister)
{
super.registerIcons(par1IconRegister);
this.theIcon = par1IconRegister.registerIcon(this.getTextureName() + "curve");
topIcon = par1IconRegister.registerIcon(Path);
bottomIcon = par1IconRegister.registerIcon(Path);
sideIcon = par1IconRegister.registerIcon(Path);
}
protected void func_94358_a(World par1World, int par2, int par3, int par4, int par5, int par6, int par7)
{
if (par7 > 0 && Block.blocksList[par7].canProvidePower() && (new BlockBaseRailLogic(this, par1World, par2, par3, par4)).getNumberOfAdjacentTracks() == 3)
{
this.refreshTrackShape(par1World, par2, par3, par4, false);
}
}
public float getRailMaxSpeed(World world, EntityMinecart cart, int y, int x, int z)
{
return 0.4f;
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
}