pjc21

raytrace.zs

Feb 20th, 2021 (edited)
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. #priority 500
  2.  
  3. import crafttweaker.entity.IEntityLivingBase;
  4. import crafttweaker.player.IPlayer;
  5. import crafttweaker.world.IRayTraceResult;
  6. import crafttweaker.entity.IEntity;
  7. import crafttweaker.event.PlayerTickEvent;
  8.  
  9.  
  10. function checkEntity(playerRay as IRayTraceResult) {
  11.  
  12. if (playerRay.isMiss) == true {
  13. print("Is Miss");
  14. }
  15.  
  16. if (playerRay.isBlock) == true {
  17. print("Is Block");
  18. }
  19.  
  20. if (playerRay.isEntity) == true {
  21. print("Is Entity");
  22. }
  23.  
  24. if !(isNull(playerRay.entity)) {
  25. print("Entity Found");
  26. }
  27. }
  28.  
  29. events.onPlayerTick(function (event as PlayerTickEvent) {
  30.  
  31. if (event.phase == "START") {
  32. val player as IEntityLivingBase = event.player;
  33.  
  34. val playerRay as IRayTraceResult = player.getRayTrace(20.0, 10);
  35.  
  36. if !(isNull(playerRay)) {
  37. checkEntity(playerRay);
  38. }
  39. }
  40. });
Add Comment
Please, Sign In to add comment