-
Notifications
You must be signed in to change notification settings - Fork 754
/
WoodRail.java
57 lines (49 loc) · 1.73 KB
/
WoodRail.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package tconstruct.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.BlockRailBase;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.item.EntityMinecart;
import net.minecraft.init.Blocks;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class WoodRail extends BlockRailBase
{
@SideOnly(Side.CLIENT)
private IIcon theIcon;
public WoodRail()
{
super(false);
}
@SideOnly(Side.CLIENT)
/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
*/
public IIcon getIcon (int par1, int par2)
{
return par2 >= 6 ? this.theIcon : this.field_149761_L;
}
@SideOnly(Side.CLIENT)
/**
* When this method is called, your block should register all the icons it needs with the given IconRegister. This
* is the only chance you get to register icons.
*/
public void registerIcons (IIconRegister par1IconRegister)
{
this.field_149761_L = par1IconRegister.registerIcon("tinker:woodrail");
this.theIcon = par1IconRegister.registerIcon("tinker:woodrail_turn");
}
protected void func_94358_a (World par1World, int par2, int par3, int par4, int par5, int par6, Block par7)
{
if (par7 != Blocks.air && par7.func_149744_f() && (new BlockBaseRailLogic(this, par1World, par2, par3, par4)).getNumberOfAdjacentTracks() == 3)
{
this.refreshTrackShape(par1World, par2, par3, par4, false);
}
}
@Override
public float getRailMaxSpeed (World world, EntityMinecart cart, int y, int x, int z)
{
return 0.3f;
}
}