diff options
author | obnoxint <mail@obnoxint.net> | 2012-06-10 17:34:05 +0200 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2012-06-14 20:58:57 -0500 |
commit | 72d64b516cae5c6720c71e46289ec9996ded2db9 (patch) | |
tree | 2c960bc8f14904476976df6ece7929dd23d02aa9 /src/main/java/net/minecraft | |
parent | 90026906518ea79c2f143c959cb479e5e8200906 (diff) | |
download | craftbukkit-72d64b516cae5c6720c71e46289ec9996ded2db9.tar craftbukkit-72d64b516cae5c6720c71e46289ec9996ded2db9.tar.gz craftbukkit-72d64b516cae5c6720c71e46289ec9996ded2db9.tar.lz craftbukkit-72d64b516cae5c6720c71e46289ec9996ded2db9.tar.xz craftbukkit-72d64b516cae5c6720c71e46289ec9996ded2db9.zip |
Add TileEntityNote from mc-dev for diff visibility.
Diffstat (limited to 'src/main/java/net/minecraft')
-rw-r--r-- | src/main/java/net/minecraft/server/TileEntityNote.java | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/TileEntityNote.java b/src/main/java/net/minecraft/server/TileEntityNote.java new file mode 100644 index 00000000..684bbc6d --- /dev/null +++ b/src/main/java/net/minecraft/server/TileEntityNote.java @@ -0,0 +1,56 @@ +package net.minecraft.server; + +public class TileEntityNote extends TileEntity { + + public byte note = 0; + public boolean b = false; + + public TileEntityNote() {} + + public void b(NBTTagCompound nbttagcompound) { + super.b(nbttagcompound); + nbttagcompound.setByte("note", this.note); + } + + public void a(NBTTagCompound nbttagcompound) { + super.a(nbttagcompound); + this.note = nbttagcompound.getByte("note"); + if (this.note < 0) { + this.note = 0; + } + + if (this.note > 24) { + this.note = 24; + } + } + + public void c() { + this.note = (byte) ((this.note + 1) % 25); + this.update(); + } + + public void play(World world, int i, int j, int k) { + if (world.getMaterial(i, j + 1, k) == Material.AIR) { + Material material = world.getMaterial(i, j - 1, k); + byte b0 = 0; + + if (material == Material.STONE) { + b0 = 1; + } + + if (material == Material.SAND) { + b0 = 2; + } + + if (material == Material.SHATTERABLE) { + b0 = 3; + } + + if (material == Material.WOOD) { + b0 = 4; + } + + world.playNote(i, j, k, b0, this.note); + } + } +} |