Test.txt 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. event.load("projectile_hit");
  2. event.load("block_click");
  3. event.load("player_drop");
  4. event.load("player_teleport");
  5. //event.load("player_item_held");
  6. event.load("missing_command");
  7. event.load("missing_perm");
  8. event.load("player_elytra_start");
  9. //event.load("entity_click");
  10. //event.load("entity_damage");
  11. item_list = list.new();
  12. list.add(item_list, material.get("SNOWBALL"));
  13. list.add(item_list, material.get("EGG"));
  14. list.add(item_list, material.get("FISHING_ROD"));
  15. list.add(item_list, material.get("TRIDENT"));
  16. list.add(item_list, material.get("SPLASH_POTION"));
  17. Particle_Soul = particle.get("SOUL_FIRE_FLAME");
  18. Particle_Table = particle.get("ENCHANTMENT_TABLE");
  19. Particle_Smoke = particle.get("CAMPFIRE_COSY_SMOKE");
  20. Particle_Slime = particle.get("SLIME");
  21. Slime_Itemstack = item.new("SLIME_BALL", 1);
  22. Small_Slime = "SLIME";
  23. Sound_Slimeblock_place = sound.get("BLOCK_SLIME_BLOCK_PLACE");
  24. Sound_Cat_Hostile = sound.getCategory("HOSTILE");
  25. @wait
  26. wait();
  27. if(event == "block_click") {
  28. if(action != "RIGHT_CLICK_AIR"){
  29. goto("wait");
  30. }
  31. player_name = player.getName(player);
  32. if(player_name == "SirTerence7" || player_name == "marvinius" || player_name == "Mareeeen" || player_name == "fireeagle013"){
  33. }else{
  34. goto("wait");
  35. }
  36. equip = living.getEquip(player, hand);
  37. Item_Type = item.getType(equip);
  38. if(list.contains(item_list, Item_Type)){
  39. player_look = entity.getLook(player);
  40. player_motion = entity.getMotion(player);
  41. x = player_motion[0] - 0.025*player_look[0];
  42. z = player_motion[2] - 0.025*player_look[2];
  43. entity.setMotion(player, x, player_motion[1], z);
  44. goto("wait");
  45. }
  46. if(Item_Type == "SLIME_BALL"){
  47. player_loc = player.getLocation(player);
  48. player_look = entity.getLook(player);
  49. player_motion = entity.getMotion(player);
  50. Slime = entity.spawn(player_loc, Small_Slime);
  51. x = player_motion[0] + player_look[0];
  52. y = player_motion[1] + player_look[1];
  53. z = player_motion[2] + player_look[2];
  54. entity.setMotion(Slime, x,y,z);
  55. sound.spawn(player_loc, Sound_Slimeblock_place, Sound_Cat_Hostile, 1, 1);
  56. particle.spawn(player_loc, Particle_Slime, 3, 0.1, 0.125, 1.2, 0.125);
  57. }
  58. goto("wait");
  59. }
  60. if(event == "entity_damage"){
  61. if(entity.getType(entity) != Slime){
  62. goto("wait");
  63. }
  64. if(cause != "FALL"){
  65. goto("wait");
  66. }
  67. cancel = true;
  68. }
  69. if(event == "entity_click"){
  70. player_name = player.getName(player);
  71. if(player_name == "SirTerence7" || player_name == "marvinius" || player_name == "Mareeeen" || player_name == "fireeagle013"){
  72. }else{
  73. goto("wait");
  74. }
  75. entity_Type = entity.getType(entity);
  76. if(entity_Type == Slime){
  77. entity_loc = entity.getLocation(entity);
  78. entity.remove(entity);
  79. sound.spawn(player_loc, Sound_Slimeblock_place, Sound_Cat_Hostile, 1, 1);
  80. item.drop(Slime_Itemstack, entity_loc);
  81. }
  82. goto("wait");
  83. }
  84. if(event == "player_drop"){
  85. player_name = player.getName(player);
  86. if(player_name == "SirTerence7" || player_name == "marvinius" || player_name == "Mareeeen" || player_name == "fireeagle013"){
  87. }else{
  88. goto("wait");
  89. }
  90. amount = item.getAmount(item.entity.get(item_entity));
  91. strength = 0.05 * (1+math.log(amount)/math.log(1.5));
  92. player_look = entity.getLook(player);
  93. player_motion = entity.getMotion(player);
  94. x = player_motion[0] - strength*player_look[0];
  95. z = player_motion[2] - strength*player_look[2];
  96. entity.setMotion(player, x, player_motion[1], z);
  97. goto("wait");
  98. }
  99. if(event == "projectile_hit") {
  100. if(shooter == null) {
  101. goto("wait");
  102. }
  103. if(entity_hit == null) {
  104. goto("wait");
  105. }
  106. if(!isPlayer(entity_hit)){
  107. goto("wait");
  108. }
  109. if(!isPlayer(shooter)){
  110. goto("wait");
  111. }
  112. if(shooter == entity_hit){
  113. goto("wait");
  114. }
  115. entity_hit_name = player.getName(entity_hit);
  116. if(entity_hit_name == "SirTerence7" || entity_hit_name == "marvinius" || entity_hit_name == "Mareeeen" || entity_hit_name == "fireeagle013"){
  117. }else{
  118. goto("wait");
  119. }
  120. shooter_loc = entity.getLocation(shooter);
  121. hit_player_loc = entity.getLocation(entity_hit);
  122. if(loc.getWorld(shooter_loc) != loc.getWorld(hit_player_loc)){
  123. goto("wait");
  124. }
  125. shooter_loc_X = loc.GetX(shooter_loc);
  126. shooter_loc_Y = loc.GetY(shooter_loc);
  127. shooter_loc_Z = loc.GetZ(shooter_loc);
  128. hit_player_loc_X = loc.GetX(hit_player_loc);
  129. hit_player_loc_Y = loc.GetY(hit_player_loc);
  130. hit_player_loc_Z = loc.GetZ(hit_player_loc);
  131. entity_hit_motion = entity.getMotion(entity_hit);
  132. distance = math.abs(loc.distance(shooter_loc, hit_player_loc));
  133. x = entity_hit_motion[0] + (hit_player_loc_X - shooter_loc_X+1)/math.pow(distance+1,2);
  134. y = entity_hit_motion[1] + 0.25*(hit_player_loc_Y - shooter_loc_Y+1)/math.pow(distance+1,2);
  135. z = entity_hit_motion[2] + (hit_player_loc_Z - shooter_loc_Z+1)/math.pow(distance+1,2);
  136. entity.setMotion(entity_hit, x, y, z);
  137. goto("wait");
  138. }
  139. if(event == "player_teleport"){
  140. player_name = player.getName(player);
  141. if(player_name == "SirTerence7" || player_name == "marvinius" || player_name == "Mareeeen" || player_name == "fireeagle013"){
  142. }else{
  143. goto("wait");
  144. }
  145. particle.spawn(from, Particle_Table, 25, 0.125, 0.25, 0.5, 0.25);
  146. particle.spawn(to, Particle_Soul, 7, 0.5, 0.25, 0.5, 0.25);
  147. particle.spawn(to, Particle_Table, 25, 0.5, 0.5, 0.75, 0.5);
  148. living.addEffect(player, "BLINDNESS", 20, 1, false);
  149. //living.addEffect(player, "CONFUSION", 100, 5, false);
  150. //living.addEffect(player, "LEVITATION", 5, 255, false);
  151. goto("wait");
  152. }
  153. if(event == "player_item_held"){
  154. player_name = player.getName(player);
  155. if(player_name == "SirTerence7" || player_name == "marvinius" || player_name == "Mareeeen" || player_name == "fireeagle013"){
  156. }else{
  157. goto("wait");
  158. }
  159. inv = player.getInv(player);
  160. item1 = inv.getItem(inv, from);
  161. item2 = inv.getItem(inv, to);
  162. inv.setItem(inv, to, item1);
  163. inv.setItem(inv, from, item2);
  164. }
  165. if(event == "player_elytra_start"){
  166. player_name = player.getName(player);
  167. if(player_name == "SirTerence7" || player_name == "marvinius" || player_name == "Mareeeen" || player_name == "fireeagle013"){
  168. }else{
  169. goto("wait");
  170. }
  171. if(!player.isSneaking(player)){
  172. goto("wait");
  173. }
  174. player_look = entity.getLook(player);
  175. player_motion = entity.getMotion(player);
  176. x = player_motion[0] + 0.25*player_look[0];
  177. z = player_motion[2] + 0.25*player_look[2];
  178. y = math.abs(player_motion[1]) + 0.0125*math.abs(player_look[1]) + 0.5*(math.abs(x) + math.abs(z));
  179. entity.setMotion(player, x, y, z);
  180. }
  181. if(event == "missing_perm"){
  182. player_name = player.getName(sender);
  183. if(player_name == "SirTerence7" || player_name == "marvinius" || player_name == "Mareeeen" || player_name == "fireeagle013"){
  184. }else{
  185. goto("wait");
  186. }
  187. particle.spawn(entity.getLocation(sender), Particle_Smoke, 7, 0.1, 0.125, 1.2, 0.125);
  188. }
  189. if(event == "missing_command"){
  190. player_name = player.getName(sender);
  191. if(player_name == "SirTerence7" || player_name == "marvinius" || player_name == "Mareeeen" || player_name == "fireeagle013"){
  192. }else{
  193. goto("wait");
  194. }
  195. particle.spawn(entity.getLocation(sender), Particle_Smoke, 7, 0.1, 0.125, 1.2, 0.125);
  196. }
  197. goto("wait");