-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBlockRedstoneOre.java
More file actions
121 lines (106 loc) · 3.48 KB
/
BlockRedstoneOre.java
File metadata and controls
121 lines (106 loc) · 3.48 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
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 BlockRedstoneOre extends Block
{
public BlockRedstoneOre(int i, int j, boolean flag)
{
super(i, j, Material.rock);
if(flag)
{
setTickOnLoad(true);
}
field_468_a = flag;
}
public int tickRate()
{
return 30;
}
public void onBlockClicked(World world, int i, int j, int k, EntityPlayer entityplayer)
{
func_320_h(world, i, j, k);
super.onBlockClicked(world, i, j, k, entityplayer);
}
public void onEntityWalking(World world, int i, int j, int k, Entity entity)
{
func_320_h(world, i, j, k);
super.onEntityWalking(world, i, j, k, entity);
}
public boolean blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer)
{
func_320_h(world, i, j, k);
return super.blockActivated(world, i, j, k, entityplayer);
}
private void func_320_h(World world, int i, int j, int k)
{
func_319_i(world, i, j, k);
if(blockID == Block.oreRedstone.blockID)
{
world.setBlockWithNotify(i, j, k, Block.oreRedstoneGlowing.blockID);
}
}
public void updateTick(World world, int i, int j, int k, Random random)
{
if(blockID == Block.oreRedstoneGlowing.blockID)
{
world.setBlockWithNotify(i, j, k, Block.oreRedstone.blockID);
}
}
public int idDropped(int i, Random random)
{
return Item.redstone.shiftedIndex;
}
public int quantityDropped(Random random)
{
return 4 + random.nextInt(2);
}
public void randomDisplayTick(World world, int i, int j, int k, Random random)
{
if(field_468_a)
{
func_319_i(world, i, j, k);
}
}
private void func_319_i(World world, int i, int j, int k)
{
Random random = world.rand;
double d = 0.0625D;
for(int l = 0; l < 6; l++)
{
double d1 = (float)i + random.nextFloat();
double d2 = (float)j + random.nextFloat();
double d3 = (float)k + random.nextFloat();
if(l == 0 && !world.isBlockOpaqueCube(i, j + 1, k))
{
d2 = (double)(j + 1) + d;
}
if(l == 1 && !world.isBlockOpaqueCube(i, j - 1, k))
{
d2 = (double)(j + 0) - d;
}
if(l == 2 && !world.isBlockOpaqueCube(i, j, k + 1))
{
d3 = (double)(k + 1) + d;
}
if(l == 3 && !world.isBlockOpaqueCube(i, j, k - 1))
{
d3 = (double)(k + 0) - d;
}
if(l == 4 && !world.isBlockOpaqueCube(i + 1, j, k))
{
d1 = (double)(i + 1) + d;
}
if(l == 5 && !world.isBlockOpaqueCube(i - 1, j, k))
{
d1 = (double)(i + 0) - d;
}
if(d1 < (double)i || d1 > (double)(i + 1) || d2 < 0.0D || d2 > (double)(j + 1) || d3 < (double)k || d3 > (double)(k + 1))
{
world.spawnParticle("reddust", d1, d2, d3, 0.0D, 0.0D, 0.0D);
}
}
}
private boolean field_468_a;
}