blob: d668b1c0cabe6ba2c6431b50fe16b151c9860704 (
plain)
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
|
package net.minecraft.server;
public class TileEntityRecordPlayer extends TileEntity {
private ItemStack record;
public TileEntityRecordPlayer() {}
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
if (nbttagcompound.hasKeyOfType("RecordItem", 10)) {
this.setRecord(ItemStack.createStack(nbttagcompound.getCompound("RecordItem")));
} else if (nbttagcompound.getInt("Record") > 0) {
this.setRecord(new ItemStack(Item.d(nbttagcompound.getInt("Record")), 1, 0));
}
}
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
if (this.getRecord() != null) {
nbttagcompound.set("RecordItem", this.getRecord().save(new NBTTagCompound()));
nbttagcompound.setInt("Record", Item.b(this.getRecord().getItem()));
}
}
public ItemStack getRecord() {
return this.record;
}
public void setRecord(ItemStack itemstack) {
// CraftBukkit start - There can only be one
if (itemstack != null) {
itemstack.count = 1;
}
// CraftBukkit end
this.record = itemstack;
this.update();
}
}
|