-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBlockCake.java
More file actions
157 lines (138 loc) · 4.21 KB
/
BlockCake.java
File metadata and controls
157 lines (138 loc) · 4.21 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
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 BlockCake extends Block
{
protected BlockCake(int i, int j)
{
super(i, j, Material.field_21150_y);
setTickOnLoad(true);
}
public void setBlockBoundsBasedOnState(IBlockAccess iblockaccess, int i, int j, int k)
{
int l = iblockaccess.getBlockMetadata(i, j, k);
float f = 0.0625F;
float f1 = (float)(1 + l * 2) / 16F;
float f2 = 0.5F;
setBlockBounds(f1, 0.0F, f, 1.0F - f, f2, 1.0F - f);
}
public void func_237_e()
{
float f = 0.0625F;
float f1 = 0.5F;
setBlockBounds(f, 0.0F, f, 1.0F - f, f1, 1.0F - f);
}
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k)
{
int l = world.getBlockMetadata(i, j, k);
float f = 0.0625F;
float f1 = (float)(1 + l * 2) / 16F;
float f2 = 0.5F;
return AxisAlignedBB.getBoundingBoxFromPool((float)i + f1, j, (float)k + f, (float)(i + 1) - f, ((float)j + f2) - f, (float)(k + 1) - f);
}
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int i, int j, int k)
{
int l = world.getBlockMetadata(i, j, k);
float f = 0.0625F;
float f1 = (float)(1 + l * 2) / 16F;
float f2 = 0.5F;
return AxisAlignedBB.getBoundingBoxFromPool((float)i + f1, j, (float)k + f, (float)(i + 1) - f, (float)j + f2, (float)(k + 1) - f);
}
public int getBlockTextureFromSideAndMetadata(int i, int j)
{
if(i == 1)
{
return blockIndexInTexture;
}
if(i == 0)
{
return blockIndexInTexture + 3;
}
if(j > 0 && i == 4)
{
return blockIndexInTexture + 2;
} else
{
return blockIndexInTexture + 1;
}
}
public int getBlockTextureFromSide(int i)
{
if(i == 1)
{
return blockIndexInTexture;
}
if(i == 0)
{
return blockIndexInTexture + 3;
} else
{
return blockIndexInTexture + 1;
}
}
public boolean renderAsNormalBlock()
{
return false;
}
public boolean isOpaqueCube()
{
return false;
}
public boolean blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer)
{
func_21029_c(world, i, j, k, entityplayer);
return true;
}
public void onBlockClicked(World world, int i, int j, int k, EntityPlayer entityplayer)
{
func_21029_c(world, i, j, k, entityplayer);
}
private void func_21029_c(World world, int i, int j, int k, EntityPlayer entityplayer)
{
if(entityplayer.health < 20)
{
entityplayer.heal(3);
int l = world.getBlockMetadata(i, j, k) + 1;
if(l >= 6)
{
world.setBlockWithNotify(i, j, k, 0);
} else
{
world.setBlockMetadataWithNotify(i, j, k, l);
world.markBlockAsNeedsUpdate(i, j, k);
}
}
}
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
if(!super.canPlaceBlockAt(world, i, j, k))
{
return false;
} else
{
return canBlockStay(world, i, j, k);
}
}
public void onNeighborBlockChange(World world, int i, int j, int k, int l)
{
if(!canBlockStay(world, i, j, k))
{
dropBlockAsItem(world, i, j, k, world.getBlockMetadata(i, j, k));
world.setBlockWithNotify(i, j, k, 0);
}
}
public boolean canBlockStay(World world, int i, int j, int k)
{
return world.getBlockMaterial(i, j - 1, k).isSolid();
}
public int quantityDropped(Random random)
{
return 0;
}
public int idDropped(int i, Random random)
{
return 0;
}
}