-
Notifications
You must be signed in to change notification settings - Fork 1
/
TileEntityGraffitiBlock.java
111 lines (88 loc) · 2.21 KB
/
TileEntityGraffitiBlock.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
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
package net.minecraft.graffiti;
import java.io.DataOutputStream;
import java.io.IOException;
import com.google.common.io.ByteArrayDataInput;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.packet.Packet;
import net.minecraft.tileentity.TileEntity;
public class TileEntityGraffitiBlock extends TileEntity
{
private LinePointManager manager;
private boolean bCollision;
public TileEntityGraffitiBlock()
{
manager = new LinePointManager();
bCollision = false;
}
@Override
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readFromNBT(par1NBTTagCompound);
manager.readFromNBT(par1NBTTagCompound);
if(par1NBTTagCompound.hasKey("bCollision"))
{
bCollision = par1NBTTagCompound.getBoolean("bCollision");
}
}
@Override
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeToNBT(par1NBTTagCompound);
manager.writeToNBT(par1NBTTagCompound);
par1NBTTagCompound.setBoolean("bCollision", bCollision);
}
public boolean[] getSideArray()
{
return manager.getSideArray();
}
public void clickPos(float posXstart, float posYstart, float posZstart, float posXend, float posYend, float posZend, int side, int color, int size)
{
manager.addPoint(posXstart,posYstart,posZstart,posXend,posYend,posZend,side,color,size);
}
public void clickPos(LinePoint point)
{
manager.addPoint(point);
}
public boolean removePos()
{
return manager.removePoint();
}
public LinePoint[] getPoints()
{
return manager.getArray();
}
public void readToPacket(ByteArrayDataInput data)
{
manager.readToPacket(data);
try {
bCollision = data.readBoolean();
} catch (Exception e) {
e.printStackTrace();
bCollision = true;
}
}
public void writeToPacket(DataOutputStream dos)
{
manager.writeToPacket(dos);
try {
dos.writeBoolean(bCollision);
} catch (IOException e) {
e.printStackTrace();
}
}
public void changeCollision()
{
bCollision = !bCollision;
}
public boolean getCollision()
{
return bCollision;
}
@Override
public Packet getDescriptionPacket()
{
//パケットの取得
return PacketHandler.getPacket(this);
}
}