Guest User

Untitled

a guest
Oct 19th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. package net.minecraft.server;
  2.  
  3. import org.bukkit.event.block.NotePlayEvent; // CraftBukkit
  4.  
  5. public class TileEntityNote extends TileEntity {
  6.  
  7. public byte note = 0;
  8. public boolean b = false;
  9.  
  10. public TileEntityNote() {}
  11.  
  12. public void b(NBTTagCompound nbttagcompound) {
  13. super.b(nbttagcompound);
  14. nbttagcompound.setByte("note", this.note);
  15. }
  16.  
  17. public void a(NBTTagCompound nbttagcompound) {
  18. super.a(nbttagcompound);
  19. this.note = nbttagcompound.getByte("note");
  20. if (this.note < 0) {
  21. this.note = 0;
  22. }
  23.  
  24. if (this.note > 24) {
  25. this.note = 24;
  26. }
  27. }
  28.  
  29. public void c() {
  30. this.note = (byte) ((this.note + 1) % 25);
  31. this.update();
  32. }
  33.  
  34. public void play(World world, int i, int j, int k) {
  35. if (world.getMaterial(i, j + 1, k) == Material.AIR) {
  36. Material material = world.getMaterial(i, j - 1, k);
  37. byte b0 = 0;
  38.  
  39. if (material == Material.STONE) {
  40. b0 = 1;
  41. }
  42.  
  43. if (material == Material.SAND) {
  44. b0 = 2;
  45. }
  46.  
  47. if (material == Material.SHATTERABLE) {
  48. b0 = 3;
  49. }
  50.  
  51. if (material == Material.WOOD) {
  52. b0 = 4;
  53. }
  54.  
  55. // CraftBukkit start - NotePlayEvent
  56. NotePlayEvent event = new NotePlayEvent(this.world.getWorld().getBlockAt(x,y,z), org.bukkit.Instrument.getByType(b0), new org.bukkit.Note(note));
  57. org.bukkit.Bukkit.getPluginManager().callEvent(event);
  58.  
  59. if (!event.isCancelled()){
  60. world.playNote(i, j, k, event.getInstrument().getType(), event.getNote().getId());
  61. }
  62. // CraftBukkit end
  63. }
  64. }
  65. }
Add Comment
Please, Sign In to add comment