ai.txt 831 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. event.load("entity_join");
  2. event.load("living_pre_hurt");
  3. event.load("entity_click");
  4. ignore = set.new();
  5. set.add(ignore, "human");
  6. set.add(ignore, "ender_dragon");
  7. set.add(ignore, "villager");
  8. msg("dev", "§bAi §rloaded");
  9. @wait
  10. wait();
  11. ignoreGoto(event);
  12. goto("wait");
  13. @entity_join
  14. if(!isLiving(entity)) {
  15. goto("wait");
  16. }
  17. if(isPlayer(entity)) {
  18. goto("wait");
  19. }
  20. if(entity.hasTag(entity, "mod_spawned")) {
  21. goto("wait");
  22. }
  23. entity_type = entity.getType(entity);
  24. if(set.contains(ignore, entity_type)) {
  25. goto("wait");
  26. }
  27. entity.addTag(entity, "no_tick");
  28. goto("wait");
  29. @entity_click
  30. is(isLiving(entity)) {
  31. removeTag(entity);
  32. }
  33. goto("wait");
  34. @living_pre_hurt
  35. removeTag(living_entity);
  36. goto("wait");
  37. function removeTag(living_entity) {
  38. entity.removeTag(living_entity, "no_tick");
  39. }