Advertisement
Guest User

Untitled

a guest
Feb 17th, 2020
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. global_target = l('L');
  2. global_test = 5;
  3.  
  4. __on_player_attacks_entity(player, entity) -> (
  5. holds = query(player, 'holds', 'mainhand');
  6. if (holds,
  7. l(what, count, nbt) = holds;
  8. if (what == 'emerald' && nbt ~ 'Player Tracker' && query(entity, 'type') == 'player',
  9. //If the item in the player's hand is a compass named “Player Tracker” and
  10. //the entity is a player, then the entity becomes the player's global_target.
  11. replaceList(global_target,entity,0);
  12. print('Now tracking: '+global_target:0);
  13. //global_test = global_test + 1;
  14. //print('Now tracking: '+global_test);
  15. )
  16. )
  17. );
  18.  
  19. replaceList(list, what, index) -> (
  20. put(list, index, what, 'replace');
  21. );
  22.  
  23. __on_tick() -> (
  24. print(global_target:0);
  25.  
  26. //11.25 degrees per texture
  27. tX = query(player(global_target), 'x');
  28. uX = query(player(),'x');
  29. tZ = query(player(global_target), 'z');
  30. uZ = query(player(),'z');
  31. uYaw = query(player(), 'yaw');
  32.  
  33. //texture = (round(((uYaw - atan(abs((tX-uX)/(tZ-uZ))))-5.625)/11.25));
  34. //print('hi '+global_target);
  35. //print(texture);
  36. //variable texture will give the number of which texture should be displayed
  37. //i.e. if global_target is directly in front of tracker, texture 0 will be displayed
  38. //if global_target is directly behind tracker, texture 16 will be displayed
  39.  
  40. slot = 0;
  41. for(l('mainhand', 'offhand'),
  42. holds = query(player(), 'holds', _);
  43. if (holds == 0,
  44. l(what, count, nbt) = holds;
  45. if (what == 'emerald',
  46. if (nbt ~ 'display:{Name:`{"text":"Player Tracker"}`}',
  47. inventory_set(player(), slot, count, what, '{CustomModelData:'+texture+'}');
  48. slot = slot - 1;
  49. )
  50. )
  51. )
  52. )
  53. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement