-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBlockMinecartTrack.java
More file actions
135 lines (120 loc) · 3.56 KB
/
BlockMinecartTrack.java
File metadata and controls
135 lines (120 loc) · 3.56 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
package net.minecraft.src;
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode
import java.util.Random;
public class BlockMinecartTrack extends Block
{
protected BlockMinecartTrack(int i, int j)
{
super(i, j, Material.circuits);
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
}
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k)
{
return null;
}
public boolean isOpaqueCube()
{
return false;
}
public MovingObjectPosition collisionRayTrace(World world, int i, int j, int k, Vec3D vec3d, Vec3D vec3d1)
{
setBlockBoundsBasedOnState(world, i, j, k);
return super.collisionRayTrace(world, i, j, k, vec3d, vec3d1);
}
public void setBlockBoundsBasedOnState(IBlockAccess iblockaccess, int i, int j, int k)
{
int l = iblockaccess.getBlockMetadata(i, j, k);
if(l >= 2 && l <= 5)
{
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.625F, 1.0F);
} else
{
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
}
}
public int getBlockTextureFromSideAndMetadata(int i, int j)
{
if(j >= 6)
{
return blockIndexInTexture - 16;
} else
{
return blockIndexInTexture;
}
}
public boolean renderAsNormalBlock()
{
return false;
}
public int getRenderType()
{
return 9;
}
public int quantityDropped(Random random)
{
return 1;
}
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
return world.isBlockOpaqueCube(i, j - 1, k);
}
public void onBlockAdded(World world, int i, int j, int k)
{
if(!world.multiplayerWorld)
{
world.setBlockMetadataWithNotify(i, j, k, 15);
func_4031_h(world, i, j, k);
}
}
public void onNeighborBlockChange(World world, int i, int j, int k, int l)
{
if(world.multiplayerWorld)
{
return;
}
int i1 = world.getBlockMetadata(i, j, k);
boolean flag = false;
if(!world.isBlockOpaqueCube(i, j - 1, k))
{
flag = true;
}
if(i1 == 2 && !world.isBlockOpaqueCube(i + 1, j, k))
{
flag = true;
}
if(i1 == 3 && !world.isBlockOpaqueCube(i - 1, j, k))
{
flag = true;
}
if(i1 == 4 && !world.isBlockOpaqueCube(i, j, k - 1))
{
flag = true;
}
if(i1 == 5 && !world.isBlockOpaqueCube(i, j, k + 1))
{
flag = true;
}
if(flag)
{
dropBlockAsItem(world, i, j, k, world.getBlockMetadata(i, j, k));
world.setBlockWithNotify(i, j, k, 0);
} else
if(l > 0 && Block.blocksList[l].canProvidePower() && MinecartTrackLogic.getNAdjacentTracks(new MinecartTrackLogic(this, world, i, j, k)) == 3)
{
func_4031_h(world, i, j, k);
}
}
private void func_4031_h(World world, int i, int j, int k)
{
if(world.multiplayerWorld)
{
return;
} else
{
(new MinecartTrackLogic(this, world, i, j, k)).func_792_a(world.isBlockIndirectlyGettingPowered(i, j, k));
return;
}
}
}