Script Examples - Zergatul/cheatutils GitHub Wiki

Villager Roller script from tutorial

float perc = 100.0 * villagerRoller.getPrice() / villagerRoller.getMinPrice();

string textcolor = "#FFFFFF";
if (!villagerRoller.isMaxLevel()) {
    textcolor = "#A0A0A0"; // grey
} else if (perc == 100) {
    textcolor = "#00FF1D"; // bright green
} else {
    // gradient from green (at 100%) to red (at 200% or more)
    textcolor = color.gradient("#7FFF8E", "#FF7F7F", (perc - 100) / 100);
}

main.systemMessage("#0094FF", "[Roller]",
    textcolor,
    villagerRoller.getEnchantmentName() + " " + 
    convert.toString(villagerRoller.getLevel()) + " @ " +
    convert.toString(villagerRoller.getPrice()) + " --- " +
    convert.toString(perc, 0) + "%");

boolean skip =
    // curses
    villagerRoller.getEnchantmentName() == "Curse of Vanishing" ||
    villagerRoller.getEnchantmentName() == "Curse of Binding" ||
    // protections
    villagerRoller.getEnchantmentName() == "Fire Protection" ||
    villagerRoller.getEnchantmentName() == "Blast Protection";

if (!skip && villagerRoller.isMaxLevel() && villagerRoller.isBestPrice()) {
    villagerRoller.stop();
}

Villager Roller part for Status Overlay script from tutorial video:

if (villagerRoller.isActive()) {
    main.setOverlayHorizontalPosition("center");
    main.setOverlayVerticalPosition("middle");
    main.addText(villagerRoller.getState());
}

Show message in chat when Block ESP sees new blocks in render distance

Script for Events Scripting. shulker_box should be added to Block ESP (possibly part of the group):

static boolean SkipShulkerMessage = false;
static int LastShulkerAmount = 0;

events.onTickEnd(() => {
    int currentShulkerAmount = blocks.getCount("minecraft:shulker_box");
    if (currentShulkerAmount > LastShulkerAmount && !SkipShulkerMessage) {
        main.systemMessage("New shulkers!");

        SkipShulkerMessage = true;
        delayed.run(20 * 5, () => {
            SkipShulkerMessage = false;
        });
    }
    
    LastShulkerAmount = currentShulkerAmount;
});

Turn off Kill Aura once you leave your farm or get teleported

For Events Scripting module:

events.onTickEnd(() => {
    if (killAura.isEnabled()) {
        float playerX = player.getX();
        float playerY = player.getY();
        float playerZ = player.getZ();
        
        float farmX = 123;
        float farmY = 100;
        float farmZ = 456;
        float radius = 10;
        
        float dx = farmX - playerX;
        float dy = farmY - playerY;
        float dz = farmZ - playerZ;
        
        if (dx * dx + dy * dy + dz * dz > radius * radius) {
            main.systemMessage("#FF0000", "Leaving farm area detected, Kill Aura disabled");
            killAura.disable();
        }
    }
});

Automatic wheat farm for Block Automation

int x = currentBlock.getX();
int y = currentBlock.getY();
int z = currentBlock.getZ();

if (game.blocks.canBeReplaced(x, y, z)) {
    if (game.blocks.getId(x, y - 1, z) == "minecraft:farmland") {
        blockAutomation.useItem("wheat_seeds", "from-top");
    }
}

if (game.blocks.getId(x, y, z) == "minecraft:wheat") {
    if (game.blocks.getIntegerTag(x, y, z, "age") == 7) {
        blockAutomation.breakBlock();
    }
}

Trigger Bot

events.onTickEnd(() => {
   if (player.target.hasEntity()) {
        int entityId = player.target.getEntityId();
        if (game.entities.getType(entityId) == "minecraft:zombie") {
            if (player.getAttackCooldown() == 0) {
                player.attack(entityId);
            }
        }
    }
});