Untitled

mail@pastecode.io avatar
unknown
javascript
2 years ago
2.5 kB
2
Indexable
Never
const reverse = !GlobalVars.getBoolean("Autodupe");
GlobalVars.putBoolean("Autodupe", reverse);
if (reverse) {
    Chat.log(Chat.createTextBuilder().append("[").withColor(0x7)
        .append("Autodupe").withColor(0xf)
        .append("]").withColor(0x7).append(" enabled").withColor(0xc)
        .build());
} else {
    Chat.log(Chat.createTextBuilder().append("[").withColor(0x7)
        .append("Autodupe").withColor(0xf)
        .append("]").withColor(0x7).append(" disabled").withColor(0xc)
        .build());
}

const color = 0x0000FF;
const fillColor = 0xFFFF00;
const blocksToFind = ["netherite_block"];

const worldScanner = World.getWorldScanner()
    .withStringBlockFilter().contains(...blocksToFind)
    .build();

const config = require('./config.json');

const checkInterval = config.checkInterval;
let playerSlot = config.playerSlot; // slot shulker should be in
 const blocks = worldScanner.scanAroundPlayer(0);
    const draw3d = Hud.createDraw3D();

 let pos = { x: 0, y: 0, z: 0 };
 playerPos = Player.getPlayer().getPos();
 while (GlobalVars.getBoolean("Autodupe")) {
 Hud.clearDraw3Ds();    
    

  /*  if(Player.rayTraceEntity().getType()==="minecraft:item_frame"){
     for (let i = 37 ; i <= 44; i++){
       if(Player.openInventory().getSlot(i).getItemId()==="minecraft:shulker_box"){
      Player.openInventory().setSelectedHotbarSlotIndex(2);
      }
    continue;
    }    
  }
*/
    for (let i = 0; i < blocks.length; i++) {
        const block = blocks[i];
        draw3d.addBox(
            block.x, block.y, block.z,
            block.x + 1, block.y + 1, block.z + 1,
            color, fillColor, false
        );
    }

    draw3d.register();
    Time.sleep(500);

    Hud.clearDraw3Ds();
    
    Time.sleep(50);
    if(Player.rayTraceEntity()===null){
      if(Player.openInventory().getSlot(36).getItemId()==="minecraft:item_frame"){
      Player.openInventory().setSelectedHotbarSlotIndex(0);
        if(Player.rayTraceBlock(2,false).getId()==="minecraft:netherite_block"){          
     Player.getPlayer().interact(true);
       }
     }
   }
   
    for (let j = 37 ; j < 45; j++){
       if(Player.openInventory().getSlot(j).getItemId()==="minecraft:shulker_box"){
               Client.waitTick(20);
               Player.openInventory().setSelectedHotbarSlotIndex(j-36);
               break;
              }
           }    


    Client.waitTick(20); // wait 1 second (synchronized to client ticks)
}