Guest User

Untitled

a guest
Aug 12th, 2025
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.44 KB | None | 0 0
  1. /// api_version=2
  2. var script = registerScript({
  3. name: "MegaWallsAutoAbility",
  4. version: "1.5",
  5. authors: ["qodo"],
  6. description: "Attempts multiple right-click simulation methods for Mega Walls ability."
  7. });
  8.  
  9. var lastActivation = 0;
  10. var prevExperience = 0;
  11. var prevLevel = 0;
  12.  
  13. function isSword(item) {
  14. if (!item) return false;
  15. var name = item.getUnlocalizedName();
  16. return name && name.toLowerCase().indexOf("sword") !== -1;
  17. }
  18.  
  19. function tryAllRightClickMethods(player, heldItem) {
  20. // Method 1: Simulate key press
  21. try {
  22. var KeyBinding = Java.type("net.minecraft.client.settings.KeyBinding");
  23. var keyBindUseItem = mc.gameSettings.keyBindUseItem;
  24. KeyBinding.onTick(keyBindUseItem.getKeyCode());
  25. Chat.print("Method 1: KeyBinding.onTick called.");
  26. } catch (e) {
  27. Chat.print("Method 1 failed: " + e);
  28. }
  29.  
  30. // Method 2: Use playerController
  31. try {
  32. mc.playerController.sendUseItem(player, mc.theWorld, heldItem);
  33. Chat.print("Method 2: playerController.sendUseItem called.");
  34. } catch (e) {
  35. Chat.print("Method 2 failed: " + e);
  36. }
  37.  
  38. // Method 3: Send use item packet at player's position
  39. try {
  40. var C08PacketPlayerBlockPlacement = Java.type("net.minecraft.network.play.client.C08PacketPlayerBlockPlacement");
  41. var BlockPos = Java.type("net.minecraft.util.BlockPos");
  42. var Vec3 = Java.type("net.minecraft.util.Vec3");
  43. var pos = new BlockPos(player.posX, player.posY - 1, player.posZ);
  44. var vec = new Vec3(player.posX, player.posY, player.posZ);
  45. mc.thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(pos, 255, heldItem, vec.xCoord, vec.yCoord, vec.zCoord));
  46. Chat.print("Method 3: C08PacketPlayerBlockPlacement sent.");
  47. } catch (e) {
  48. Chat.print("Method 3 failed: " + e);
  49. }
  50.  
  51. // Method 4: Swing item
  52. try {
  53. player.swingItem();
  54. Chat.print("Method 4: player.swingItem called.");
  55. } catch (e) {
  56. Chat.print("Method 4 failed: " + e);
  57. }
  58. }
  59.  
  60. script.registerModule({
  61. name: "MegaWallsAutoAbility",
  62. category: "Misc",
  63. description: "Attempts multiple right-click simulation methods for Mega Walls ability."
  64. }, function(module) {
  65. module.on("update", function() {
  66. var player = mc.thePlayer;
  67. if (!player) {
  68. prevExperience = 0;
  69. prevLevel = 0;
  70. return;
  71. }
  72.  
  73. // Only check every 2 ticks for performance
  74. if (player.ticksExisted % 2 !== 0) {
  75. prevExperience = player.experience;
  76. prevLevel = player.experienceLevel;
  77. return;
  78. }
  79.  
  80. // Detect the moment XP bar reaches 100 (from <1.0 to >=1.0 or level from <100 to 100)
  81. var xpBarJustFilled = prevExperience < 1.0 && player.experience >= 1.0;
  82. var xpLevelJustReached = prevLevel < 100 && player.experienceLevel == 100;
  83.  
  84. if (xpBarJustFilled || xpLevelJustReached) {
  85. Chat.print("MegaWallsAutoAbility: XP bar or level just reached 100!");
  86.  
  87. var heldItem = player.getHeldItem();
  88. if (!isSword(heldItem)) {
  89. Chat.print("MegaWallsAutoAbility: Not holding a sword.");
  90. prevExperience = player.experience;
  91. prevLevel = player.experienceLevel;
  92. return;
  93. }
  94.  
  95. // Remove all other safety checks for now
  96.  
  97. // Random delay (100–300ms)
  98. var now = java.lang.System.currentTimeMillis();
  99. if (now - lastActivation < 100) {
  100. Chat.print("MegaWallsAutoAbility: Too soon since last activation.");
  101. prevExperience = player.experience;
  102. prevLevel = player.experienceLevel;
  103. return; // Prevent spamming
  104. }
  105.  
  106. var delay = Math.floor(Math.random() * 201) + 100;
  107. Chat.print("MegaWallsAutoAbility: Scheduling all right-click methods in " + delay + "ms.");
  108. java.lang.Thread(function() {
  109. java.lang.Thread.sleep(delay);
  110. tryAllRightClickMethods(player, heldItem);
  111. lastActivation = java.lang.System.currentTimeMillis();
  112. Chat.print("MegaWallsAutoAbility: All right-click methods attempted.");
  113. }).start();
  114. }
  115.  
  116. prevExperience = player.experience;
  117. prevLevel = player.experienceLevel;
  118. });
  119. });
Advertisement
Add Comment
Please, Sign In to add comment