-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBlockSign.java
More file actions
136 lines (123 loc) · 3.57 KB
/
BlockSign.java
File metadata and controls
136 lines (123 loc) · 3.57 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
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 BlockSign extends BlockContainer
{
protected BlockSign(int i, Class class1, boolean flag)
{
super(i, Material.wood);
isFreestanding = flag;
blockIndexInTexture = 4;
signEntityClass = class1;
float f = 0.25F;
float f1 = 1.0F;
setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f);
}
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k)
{
return null;
}
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int i, int j, int k)
{
setBlockBoundsBasedOnState(world, i, j, k);
return super.getSelectedBoundingBoxFromPool(world, i, j, k);
}
public void setBlockBoundsBasedOnState(IBlockAccess iblockaccess, int i, int j, int k)
{
if(isFreestanding)
{
return;
}
int l = iblockaccess.getBlockMetadata(i, j, k);
float f = 0.28125F;
float f1 = 0.78125F;
float f2 = 0.0F;
float f3 = 1.0F;
float f4 = 0.125F;
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
if(l == 2)
{
setBlockBounds(f2, f, 1.0F - f4, f3, f1, 1.0F);
}
if(l == 3)
{
setBlockBounds(f2, f, 0.0F, f3, f1, f4);
}
if(l == 4)
{
setBlockBounds(1.0F - f4, f, f2, 1.0F, f1, f3);
}
if(l == 5)
{
setBlockBounds(0.0F, f, f2, f4, f1, f3);
}
}
public int getRenderType()
{
return -1;
}
public boolean renderAsNormalBlock()
{
return false;
}
public boolean isOpaqueCube()
{
return false;
}
protected TileEntity getBlockEntity()
{
try
{
return (TileEntity)signEntityClass.newInstance();
}
catch(Exception exception)
{
throw new RuntimeException(exception);
}
}
public int idDropped(int i, Random random)
{
return Item.sign.shiftedIndex;
}
public void onNeighborBlockChange(World world, int i, int j, int k, int l)
{
boolean flag = false;
if(isFreestanding)
{
if(!world.getBlockMaterial(i, j - 1, k).isSolid())
{
flag = true;
}
} else
{
int i1 = world.getBlockMetadata(i, j, k);
flag = true;
if(i1 == 2 && world.getBlockMaterial(i, j, k + 1).isSolid())
{
flag = false;
}
if(i1 == 3 && world.getBlockMaterial(i, j, k - 1).isSolid())
{
flag = false;
}
if(i1 == 4 && world.getBlockMaterial(i + 1, j, k).isSolid())
{
flag = false;
}
if(i1 == 5 && world.getBlockMaterial(i - 1, j, k).isSolid())
{
flag = false;
}
}
if(flag)
{
dropBlockAsItem(world, i, j, k, world.getBlockMetadata(i, j, k));
world.setBlockWithNotify(i, j, k, 0);
}
super.onNeighborBlockChange(world, i, j, k, l);
}
private Class signEntityClass;
private boolean isFreestanding;
}