1560 lines
44 KiB
JavaScript
1560 lines
44 KiB
JavaScript
/*global GlobalVars, Chat, Player, JsMacros, Time, World, PositionCommon, Client, KeyBind*/
|
|
|
|
let globQuant;
|
|
|
|
function quantify(inv) {
|
|
let allitems = {};
|
|
for (let i = 0; i < inv.getTotalSlots(); i++) {
|
|
if (
|
|
inv.getLocation(i) === "main" ||
|
|
inv.getLocation(i) === "hotbar" ||
|
|
inv.getLocation(i) === "input"
|
|
) {
|
|
let itemid = inv.getSlot(i).getItemId();
|
|
|
|
if (!allitems[itemid]) allitems[itemid] = 0;
|
|
allitems[itemid] += inv.getSlot(i).getCount();
|
|
}
|
|
}
|
|
return allitems;
|
|
}
|
|
|
|
function compare(inv1, inv2) {
|
|
let ids = {};
|
|
for (let i in inv1) {
|
|
ids[i] = true;
|
|
}
|
|
for (let i in inv2) {
|
|
ids[i] = true;
|
|
}
|
|
|
|
for (let i in ids) {
|
|
if (!inv1[i]) inv1[i] = 0;
|
|
if (!inv2[i]) inv2[i] = 0;
|
|
if (inv1[i] > inv2[i]) {
|
|
const number = inv1[i] - inv2[i];
|
|
let counters = GlobalVars.getString("itemcounter");
|
|
let itemcounter_tmp = JSON.parse(counters);
|
|
let itemcounter = {};
|
|
for (let j in itemcounter_tmp) {
|
|
itemcounter[j] = itemcounter_tmp[j];
|
|
}
|
|
let counter = itemcounter["T2_" + i.substring(10)] || 0;
|
|
const started = GlobalVars.getInt("started");
|
|
const now = Math.floor(Date.now() / 1000);
|
|
const timePassed = now - started;
|
|
counter += number;
|
|
const itemsPerSecond = counter / timePassed;
|
|
itemcounter["T2_" + i.substring(10)] = counter;
|
|
GlobalVars.putString("itemcounter", JSON.stringify(itemcounter));
|
|
Chat.log(number + " " + i.substring(10) + " placed");
|
|
|
|
Chat.log(
|
|
Chat.createTextBuilder()
|
|
.append("( total:" + counter + " / ")
|
|
.append(
|
|
Math.floor(itemsPerSecond * 60 * 60 * 100) / 100 + ""
|
|
)
|
|
.withColor(0x5)
|
|
.append(
|
|
" per hour / active for: " +
|
|
Math.floor((timePassed / 6) * 10) / 100 +
|
|
" minutes )"
|
|
)
|
|
.build()
|
|
);
|
|
}
|
|
if (inv1[i] < inv2[i]) {
|
|
const number = inv2[i] - inv1[i];
|
|
let counters = GlobalVars.getString("itemcounter");
|
|
let itemcounter_tmp = JSON.parse(counters);
|
|
let itemcounter = {};
|
|
for (let j in itemcounter_tmp) {
|
|
itemcounter[j] = itemcounter_tmp[j];
|
|
}
|
|
let counter = itemcounter["T_" + i.substring(10)] || 0;
|
|
const started = GlobalVars.getInt("started");
|
|
const now = Math.floor(Date.now() / 1000);
|
|
const timePassed = now - started;
|
|
counter += number;
|
|
const itemsPerSecond = counter / timePassed;
|
|
itemcounter["T_" + i.substring(10)] = counter;
|
|
GlobalVars.putString("itemcounter", JSON.stringify(itemcounter));
|
|
Chat.log(number + " " + i.substring(10) + " taken");
|
|
|
|
Chat.log(
|
|
Chat.createTextBuilder()
|
|
.append("( total:" + counter + " / ")
|
|
.append(
|
|
Math.floor(itemsPerSecond * 60 * 60 * 100) / 100 + ""
|
|
)
|
|
.withColor(0xd)
|
|
.append(
|
|
" per hour / active for: " +
|
|
Math.floor((timePassed / 6) * 10) / 100 +
|
|
" minutes )"
|
|
)
|
|
.build()
|
|
);
|
|
}
|
|
}
|
|
}
|
|
function compareT(inv1, inv2) {
|
|
let ids = {};
|
|
for (let i in inv1) {
|
|
ids[i] = true;
|
|
}
|
|
for (let i in inv2) {
|
|
ids[i] = true;
|
|
}
|
|
|
|
let trade_from = "";
|
|
let trade_to = "";
|
|
let trade_from_count = 0;
|
|
let trade_to_count = 0;
|
|
|
|
for (let i in ids) {
|
|
if (!inv1[i]) inv1[i] = 0;
|
|
if (!inv2[i]) inv2[i] = 0;
|
|
}
|
|
for (let i in ids) {
|
|
if (inv1[i] > inv2[i]) {
|
|
trade_from = i.substring(10);
|
|
trade_from_count = inv1[i] - inv2[i];
|
|
}
|
|
}
|
|
for (let i in ids) {
|
|
if (inv1[i] < inv2[i]) {
|
|
trade_to = i.substring(10);
|
|
trade_to_count = inv2[i] - inv1[i];
|
|
}
|
|
}
|
|
|
|
if (trade_to_count > 0) {
|
|
const trade_name = trade_from + "_to_" + trade_to;
|
|
const counters = GlobalVars.getString("itemcounterT");
|
|
const itemcounter_tmp = JSON.parse(counters);
|
|
let itemcounter = {};
|
|
for (let j in itemcounter_tmp) {
|
|
itemcounter[j] = itemcounter_tmp[j];
|
|
}
|
|
let counter = itemcounter[trade_name] || 0;
|
|
const started = GlobalVars.getInt("started");
|
|
const now = Math.floor(Date.now() / 1000);
|
|
const timePassed = now - started;
|
|
counter += trade_to_count;
|
|
const itemsPerSecond = counter / timePassed;
|
|
itemcounter[trade_name] = counter;
|
|
GlobalVars.putString("itemcounterT", JSON.stringify(itemcounter));
|
|
Chat.log(
|
|
"traded " +
|
|
trade_from_count +
|
|
" " +
|
|
trade_from +
|
|
" for " +
|
|
trade_to_count +
|
|
" " +
|
|
trade_to
|
|
);
|
|
let color = 0xd;
|
|
if (trade_name === "glass_bottle_to_emerald") color = 0xc; //l red
|
|
if (trade_name === "emerald_to_glass") color = 0xe; //yellow
|
|
if (trade_name === "paper_to_emerald") color = 0xa; //l green
|
|
if (trade_name === "flesh_to_emerald") color = 0xb; //cyan
|
|
if (trade_name === "emerald_to_redstone") color = 0x9; //l blue
|
|
if (trade_name === "emerald_to_experience_bottle") color = 0x2; //d green
|
|
|
|
Chat.log(
|
|
Chat.createTextBuilder()
|
|
.append("( total:" + counter + " / ")
|
|
.append(Math.floor(itemsPerSecond * 60 * 60 * 100) / 100 + "")
|
|
.withColor(color)
|
|
.append(
|
|
" per hour / active for: " +
|
|
Math.floor((timePassed / 6) * 10) / 100 +
|
|
" minutes )"
|
|
)
|
|
.build()
|
|
);
|
|
} else {
|
|
Chat.log("empty trade");
|
|
}
|
|
}
|
|
|
|
function take(x, y, z) {
|
|
let player = Player.getPlayer();
|
|
player.interactBlock(x, y, z, 0, false, true);
|
|
JsMacros.waitForEvent("OpenContainer").context.releaseLock();
|
|
const inv = Player.openInventory();
|
|
|
|
Time.sleep(120);
|
|
const before = quantify(inv);
|
|
for (let i = 0; i < inv.getTotalSlots(); i++) {
|
|
if (inv.getLocation(i) === "container") inv.quickAll(i);
|
|
}
|
|
compare(before, quantify(inv));
|
|
|
|
globQuant = quantify(inv);
|
|
inv.close();
|
|
}
|
|
|
|
function takeStacks(x, y, z, item, amount) {
|
|
let player = Player.getPlayer();
|
|
let toTake = amount;
|
|
player.interactBlock(x, y, z, 0, false, true);
|
|
JsMacros.waitForEvent("OpenContainer").context.releaseLock();
|
|
const inv = Player.openInventory();
|
|
|
|
Time.sleep(120);
|
|
const before = quantify(inv);
|
|
for (let i = 0; i < inv.getTotalSlots(); i++) {
|
|
if (inv.getLocation(i) === "container") {
|
|
if (inv.getSlot(i).getItemId() === item) {
|
|
if (toTake > 0) {
|
|
inv.quick(i);
|
|
toTake--;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
compare(before, quantify(inv));
|
|
|
|
globQuant = quantify(inv);
|
|
inv.close();
|
|
} /*
|
|
function takeItems(x,y,z,item,amount){
|
|
let player = Player.getPlayer();
|
|
let toTake = amount;
|
|
player.interactBlock(x, y, z, 0, false, true);
|
|
JsMacros.waitForEvent('OpenContainer').context.releaseLock();
|
|
const inv = Player.openInventory();
|
|
|
|
Time.sleep(200);
|
|
const before = quantify(inv);
|
|
for(var i=0;i<inv.getTotalSlots();i++){
|
|
if(inv.getLocation(i) == 'container'){
|
|
if(inv.getSlot(i).getItemId() == item){
|
|
if(toTake > 0){
|
|
inv.quick(i);
|
|
toTake--;
|
|
}
|
|
}
|
|
}
|
|
};
|
|
compare(before,quantify(inv));
|
|
|
|
globQuant = quantify(inv);
|
|
inv.close();
|
|
}
|
|
*/
|
|
|
|
function craft(x, y, z, item) {
|
|
let player = Player.getPlayer();
|
|
player.interactBlock(x, y, z, 0, false, true);
|
|
JsMacros.waitForEvent("OpenContainer").context.releaseLock();
|
|
const inv2 = Player.openInventory();
|
|
Time.sleep(120);
|
|
|
|
let found;
|
|
do {
|
|
found = false;
|
|
let recip = null;
|
|
if (inv2.getCraftableRecipes)
|
|
for (let rec of inv2.getCraftableRecipes()) {
|
|
// Chat.log(rec.getId());
|
|
if (rec.getId() === "minecraft:" + item) {
|
|
recip = rec;
|
|
found = true;
|
|
}
|
|
}
|
|
if (found === true) {
|
|
Chat.log("crafting " + item + " ...");
|
|
recip.craft(true);
|
|
inv2.quick(0);
|
|
}
|
|
Time.sleep(120);
|
|
} while (found === true);
|
|
|
|
globQuant = quantify(inv2);
|
|
inv2.close();
|
|
}
|
|
function craft_num(x, y, z, item, num) {
|
|
if (num > 0) {
|
|
let player = Player.getPlayer();
|
|
player.interactBlock(x, y, z, 0, false, true);
|
|
JsMacros.waitForEvent("OpenContainer").context.releaseLock();
|
|
const inv2 = Player.openInventory();
|
|
Time.sleep(120);
|
|
|
|
Chat.log("crafting " + num + " " + item + " ...");
|
|
|
|
let recip = null;
|
|
let found = false;
|
|
for (let rec of inv2.getCraftableRecipes()) {
|
|
if (rec.getId() === "minecraft:" + item) {
|
|
recip = rec;
|
|
found = true;
|
|
}
|
|
}
|
|
|
|
do {
|
|
if (found === true) {
|
|
recip.craft(false);
|
|
inv2.quick(0);
|
|
}
|
|
} while (--num > 0);
|
|
|
|
Time.sleep(120);
|
|
|
|
globQuant = quantify(inv2);
|
|
inv2.close();
|
|
}
|
|
}
|
|
function craftSpecial(x, y, z) {
|
|
let player = Player.getPlayer();
|
|
player.interactBlock(x, y, z, 0, false, true);
|
|
JsMacros.waitForEvent("OpenContainer").context.releaseLock();
|
|
const inv2 = Player.openInventory();
|
|
Time.sleep(200);
|
|
|
|
let filled3 = false;
|
|
let filled5 = false;
|
|
let filled6 = false;
|
|
let filled9 = false;
|
|
|
|
for (let i = 10; i < inv2.getTotalSlots(); i++) {
|
|
// Chat.log(i+' '+inv2.getLocation(i));
|
|
if (!filled3) {
|
|
if (inv2.getSlot(i).getItemId() === "minecraft:gunpowder") {
|
|
inv2.swap(i, 3);
|
|
filled3 = true;
|
|
}
|
|
} else if (!filled6) {
|
|
if (inv2.getSlot(i).getItemId() === "minecraft:gunpowder") {
|
|
inv2.swap(i, 6);
|
|
filled6 = true;
|
|
}
|
|
} else if (!filled9) {
|
|
if (inv2.getSlot(i).getItemId() === "minecraft:gunpowder") {
|
|
inv2.swap(i, 9);
|
|
filled9 = true;
|
|
}
|
|
}
|
|
if (!filled5) {
|
|
if (inv2.getSlot(i).getItemId() === "minecraft:paper") {
|
|
inv2.swap(i, 5);
|
|
filled5 = true;
|
|
}
|
|
}
|
|
/*
|
|
if((inv2.getLocation(i) == 'main')||(inv3.getLocation(i) == 'hotbar')){
|
|
if(inv3.getSlot(i).getItemId() == 'minecraft:'+item){
|
|
inv3.quickAll(i);
|
|
break;
|
|
}
|
|
}*/
|
|
}
|
|
|
|
inv2.quickAll(0);
|
|
|
|
globQuant = quantify(inv2);
|
|
inv2.close();
|
|
}
|
|
|
|
function put(x, y, z, item) {
|
|
let player = Player.getPlayer();
|
|
player.interactBlock(x, y, z, 0, false, true);
|
|
JsMacros.waitForEvent("OpenContainer").context.releaseLock();
|
|
const inv3 = Player.openInventory();
|
|
Time.sleep(200);
|
|
|
|
const before = quantify(inv3);
|
|
for (let i = 0; i < inv3.getTotalSlots(); i++) {
|
|
if (
|
|
inv3.getLocation(i) === "main" ||
|
|
inv3.getLocation(i) === "hotbar"
|
|
) {
|
|
if (inv3.getSlot(i).getItemId() === "minecraft:" + item) {
|
|
inv3.quickAll(i);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
compare(before, quantify(inv3));
|
|
globQuant = quantify(inv3);
|
|
inv3.close();
|
|
}
|
|
|
|
function trade(tradepos, tradelane, reach) {
|
|
let trade_good_flesh = GlobalVars.getBoolean("trade_good_flesh");
|
|
let trade_good_bottle = GlobalVars.getBoolean("trade_good_bottle");
|
|
let trade_good_paper = GlobalVars.getBoolean("trade_good_paper");
|
|
|
|
let emerald = GlobalVars.getInt("emerald");
|
|
let redstone = GlobalVars.getInt("redstone");
|
|
let paper = GlobalVars.getInt("paper");
|
|
let xp = GlobalVars.getInt("xp");
|
|
let glass = GlobalVars.getInt("glass");
|
|
let flesh = GlobalVars.getInt("flesh");
|
|
const bottle = GlobalVars.getInt("bottle");
|
|
let mode = "none";
|
|
|
|
/* for(const e of World.getEntities()){
|
|
if(e.getPos().toVector(PositionCommon.createPos(947,75.5,11850.5)).getMagnitude() < 0.2){
|
|
if(e.getType() == 'minecraft:item_frame'){
|
|
mode = e.getItem().getItemId().substring(10);
|
|
GlobalVars.putString('trade_item',mode);
|
|
}
|
|
}
|
|
}
|
|
*/
|
|
//GlobalVars.putString('trade_item','experience_bottle');
|
|
//mode = 'experience_bottle';
|
|
//GlobalVars.putString('trade_item','emerald');
|
|
//mode = 'emerald';
|
|
GlobalVars.putString("trade_item", "glass");
|
|
mode = "glass";
|
|
//GlobalVars.putString("trade_item", "redstone");
|
|
//mode = "redstone";
|
|
|
|
if (
|
|
!(
|
|
mode !== "emerald" &&
|
|
mode !== "redstone" &&
|
|
mode !== "glass" &&
|
|
mode !== "experience_bottle"
|
|
)
|
|
) {
|
|
for (const e of World.getEntities()) {
|
|
if (
|
|
trade_good_bottle ||
|
|
mode === "emerald" ||
|
|
mode === "glass" ||
|
|
(mode === "redstone" && emerald < 256) ||
|
|
(mode === "experience_bottle" && emerald < 256)
|
|
) {
|
|
/*if(e.getPos().toVector(player.getPos()).getMagnitude() < 3){
|
|
if(e.getType() == 'minecraft:villager'){
|
|
Chat.log(e.getPos());
|
|
}
|
|
|
|
}*/
|
|
if (
|
|
e
|
|
.getPos()
|
|
.toVector(
|
|
PositionCommon.createPos(
|
|
937.5 + tradelane,
|
|
70,
|
|
11852.5 - tradepos * 2
|
|
)
|
|
)
|
|
.getMagnitude() < 1
|
|
) {
|
|
if (e.getType() === "minecraft:villager") {
|
|
const uuid = e.getUUID();
|
|
const epos = e.getPos();
|
|
player.lookAt(
|
|
epos.x,
|
|
epos.y + e.getEyeHeight(),
|
|
epos.z
|
|
);
|
|
const old_uuid = GlobalVars.getString("last_lib");
|
|
if (old_uuid === uuid) {
|
|
//skip
|
|
} else {
|
|
GlobalVars.putString("last_lib", uuid);
|
|
player.interactEntity(e, false, true);
|
|
const ev = JsMacros.waitForEvent("OpenContainer");
|
|
ev.context.releaseLock();
|
|
let inv = Player.openInventory();
|
|
Time.sleep(200);
|
|
|
|
//const inv = ev.event.inventory;
|
|
const trades = inv.getTrades();
|
|
let found = false;
|
|
let index = 0;
|
|
for (const tr in trades) {
|
|
if (
|
|
trades[tr].getInput()[0].getItemId() ===
|
|
"minecraft:paper"
|
|
) {
|
|
if (trades[tr].isAvailable() === true) {
|
|
if (
|
|
trades[tr]
|
|
.getInput()[0]
|
|
.getCount() <= 4
|
|
) {
|
|
if (
|
|
emerald < 256 ||
|
|
mode === "emerald"
|
|
) {
|
|
if (paper >= 16) {
|
|
found = true;
|
|
index = tr;
|
|
}
|
|
if (!trade_good_paper) {
|
|
GlobalVars.putBoolean(
|
|
"trade_good_paper",
|
|
true
|
|
);
|
|
trade_good_paper = true;
|
|
}
|
|
}
|
|
//Chat.log("paper");
|
|
} else {
|
|
//Chat.log("paper too expensive:" + trades[tr].getInput()[0].getCount());
|
|
}
|
|
} else {
|
|
//Chat.log("paper no stock");
|
|
}
|
|
}
|
|
}
|
|
if (found === true) {
|
|
const before1 = quantify(inv);
|
|
inv.selectTrade(index);
|
|
for (let i = 0; i < inv.getTotalSlots(); i++) {
|
|
if (inv.getLocation(i) === "output") {
|
|
inv.quickAll(i);
|
|
}
|
|
}
|
|
compareT(before1, quantify(inv));
|
|
}
|
|
found = false;
|
|
if (glass < 576)
|
|
for (const tr in trades) {
|
|
if (
|
|
trades[tr].getOutput().getItemId() ===
|
|
"minecraft:glass"
|
|
) {
|
|
if (trades[tr].isAvailable() === true) {
|
|
if (
|
|
trades[tr]
|
|
.getInput()[0]
|
|
.getCount() === 1
|
|
) {
|
|
if (
|
|
mode === "glass" ||
|
|
(trade_good_bottle &&
|
|
bottle < 128)
|
|
) {
|
|
if (emerald >= 16) {
|
|
found = true;
|
|
index = tr;
|
|
}
|
|
}
|
|
} else {
|
|
//Chat.log('glass too expensive');
|
|
}
|
|
} else {
|
|
//Chat.log('glass no stock');
|
|
}
|
|
}
|
|
}
|
|
if (found === true) {
|
|
const before1 = quantify(inv);
|
|
inv.selectTrade(index);
|
|
for (let i = 0; i < inv.getTotalSlots(); i++) {
|
|
if (inv.getLocation(i) === "output") {
|
|
inv.quickAll(i);
|
|
}
|
|
}
|
|
const after = quantify(inv);
|
|
compareT(before1, after);
|
|
globQuant = after;
|
|
}
|
|
if (!globQuant) globQuant = quantify(inv);
|
|
const before = globQuant;
|
|
|
|
inv.close();
|
|
if (!before["minecraft:emerald"])
|
|
before["minecraft:emerald"] = 0;
|
|
if (!before["minecraft:glass_bottle"])
|
|
before["minecraft:glass_bottle"] = 0;
|
|
if (!before["minecraft:rotten_flesh"])
|
|
before["minecraft:rotten_flesh"] = 0;
|
|
if (!before["minecraft:redstone"])
|
|
before["minecraft:redstone"] = 0;
|
|
if (!before["minecraft:paper"])
|
|
before["minecraft:paper"] = 0;
|
|
if (!before["minecraft:glass"])
|
|
before["minecraft:glass"] = 0;
|
|
GlobalVars.putInt(
|
|
"glass",
|
|
before["minecraft:glass"]
|
|
);
|
|
glass = before["minecraft:glass"];
|
|
GlobalVars.putInt(
|
|
"paper",
|
|
before["minecraft:paper"]
|
|
);
|
|
paper = before["minecraft:paper"];
|
|
GlobalVars.putInt(
|
|
"emerald",
|
|
before["minecraft:emerald"]
|
|
);
|
|
emerald = before["minecraft:emerald"];
|
|
GlobalVars.putInt(
|
|
"redstone",
|
|
before["minecraft:redstone"]
|
|
);
|
|
redstone = before["minecraft:redstone"];
|
|
flesh = before["minecraft:rotten_flesh"];
|
|
GlobalVars.putInt(
|
|
"bottle",
|
|
before["minecraft:glass_bottle"]
|
|
);
|
|
GlobalVars.putInt(
|
|
"flesh",
|
|
before["minecraft:rotten_flesh"]
|
|
);
|
|
Time.sleep(100);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (false)
|
|
if (
|
|
e
|
|
.getPos()
|
|
.toVector(
|
|
PositionCommon.createPos(
|
|
941.5 + tradelane,
|
|
70,
|
|
11852.5 - tradepos * 2
|
|
)
|
|
)
|
|
.getMagnitude() < 1
|
|
) {
|
|
if (e.getType() === "minecraft:villager") {
|
|
const uuid = e.getUUID();
|
|
const epos = e.getPos();
|
|
player.lookAt(
|
|
epos.x,
|
|
epos.y + e.getEyeHeight(),
|
|
epos.z
|
|
);
|
|
const old_uuid = GlobalVars.getString("last_cleric");
|
|
if (old_uuid === uuid) {
|
|
//skip
|
|
} else {
|
|
GlobalVars.putString("last_cleric", uuid);
|
|
player.interactEntity(e, false, true);
|
|
const ev = JsMacros.waitForEvent("OpenContainer");
|
|
ev.context.releaseLock();
|
|
let inv = Player.openInventory();
|
|
Time.sleep(200);
|
|
//const inv = ev.event.inventory;
|
|
const trades = inv.getTrades ? inv.getTrades() : [];
|
|
let found = false;
|
|
let index = 0;
|
|
if (emerald < 256 || mode === "emerald") {
|
|
for (const tr in trades) {
|
|
if (
|
|
trades[tr].getInput()[0].getItemId() ===
|
|
"minecraft:rotten_flesh"
|
|
) {
|
|
if (trades[tr].isAvailable() === true) {
|
|
if (
|
|
trades[tr]
|
|
.getInput()[0]
|
|
.getCount() < 9
|
|
) {
|
|
if (flesh >= 16) {
|
|
found = true;
|
|
index = tr;
|
|
}
|
|
if (!trade_good_flesh) {
|
|
GlobalVars.putBoolean(
|
|
"trade_good_flesh",
|
|
true
|
|
);
|
|
trade_good_flesh = true;
|
|
}
|
|
} else {
|
|
//Chat.log('flesh too expensive');
|
|
}
|
|
} else {
|
|
//Chat.log('flesh no stock');
|
|
}
|
|
}
|
|
}
|
|
if (found === true) {
|
|
const before1 = quantify(inv);
|
|
inv.selectTrade(index);
|
|
for (
|
|
let i = 0;
|
|
i < inv.getTotalSlots();
|
|
i++
|
|
) {
|
|
if (inv.getLocation(i) === "output") {
|
|
inv.quickAll(i);
|
|
}
|
|
}
|
|
compareT(before1, quantify(inv));
|
|
}
|
|
found = false;
|
|
}
|
|
if (mode === "redstone" && emerald >= 12) {
|
|
for (const tr in trades) {
|
|
if (
|
|
trades[tr].getOutput().getItemId() ===
|
|
"minecraft:redstone"
|
|
) {
|
|
if (trades[tr].isAvailable() === true) {
|
|
if (
|
|
trades[tr]
|
|
.getInput()[0]
|
|
.getCount() < 3
|
|
) {
|
|
if (emerald >= 12) {
|
|
found = true;
|
|
index = tr;
|
|
}
|
|
} else {
|
|
//Chat.log('redstone too expensive');
|
|
}
|
|
} else {
|
|
//Chat.log('redstone no stock');
|
|
}
|
|
}
|
|
}
|
|
if (found === true) {
|
|
const before1 = quantify(inv);
|
|
inv.selectTrade(index);
|
|
for (
|
|
let i = 0;
|
|
i < inv.getTotalSlots();
|
|
i++
|
|
) {
|
|
if (inv.getLocation(i) === "output") {
|
|
inv.quickAll(i);
|
|
//Chat.log('** redstone traded');
|
|
}
|
|
}
|
|
compareT(before1, quantify(inv));
|
|
}
|
|
found = false;
|
|
}
|
|
if (mode === "experience_bottle" && emerald >= 16) {
|
|
for (const tr in trades) {
|
|
if (
|
|
trades[tr].getOutput().getItemId() ===
|
|
"minecraft:experience_bottle"
|
|
) {
|
|
if (trades[tr].isAvailable() === true) {
|
|
if (
|
|
trades[tr]
|
|
.getInput()[0]
|
|
.getCount() <= 2
|
|
) {
|
|
//maximum xp bottle price (3 == 1100)
|
|
if (emerald >= 12) {
|
|
found = true;
|
|
index = tr;
|
|
}
|
|
} else {
|
|
//Chat.log('xp too expensive');
|
|
}
|
|
} else {
|
|
//Chat.log('xp no stock');
|
|
}
|
|
}
|
|
}
|
|
if (found === true) {
|
|
const before1 = quantify(inv);
|
|
inv.selectTrade(index);
|
|
for (
|
|
let i = 0;
|
|
i < inv.getTotalSlots();
|
|
i++
|
|
) {
|
|
if (inv.getLocation(i) === "output") {
|
|
inv.quickAll(i);
|
|
//Chat.log('** redstone traded');
|
|
}
|
|
}
|
|
compareT(before1, quantify(inv));
|
|
}
|
|
found = false;
|
|
}
|
|
e;
|
|
if (emerald < 256 || mode === "emerald") {
|
|
for (const tr in trades) {
|
|
if (
|
|
trades[tr].getInput()[0].getItemId() ===
|
|
"minecraft:glass_bottle"
|
|
) {
|
|
if (trades[tr].isAvailable() === true) {
|
|
if (
|
|
trades[tr]
|
|
.getInput()[0]
|
|
.getCount() === 1
|
|
) {
|
|
if (bottle > 16) {
|
|
found = true;
|
|
index = tr;
|
|
}
|
|
if (!trade_good_bottle) {
|
|
GlobalVars.putBoolean(
|
|
"trade_good_bottle",
|
|
true
|
|
);
|
|
trade_good_bottle = true;
|
|
}
|
|
} else {
|
|
//Chat.log('bottle too expensive');
|
|
}
|
|
} else {
|
|
//Chat.log('bottle no stock');
|
|
}
|
|
}
|
|
}
|
|
if (found === true) {
|
|
const before1 = quantify(inv);
|
|
inv.selectTrade(index);
|
|
for (
|
|
let i = 0;
|
|
i < inv.getTotalSlots();
|
|
i++
|
|
) {
|
|
if (inv.getLocation(i) === "output") {
|
|
inv.quickAll(i);
|
|
}
|
|
}
|
|
compareT(before1, quantify(inv));
|
|
}
|
|
}
|
|
if (inv && inv.close) {
|
|
const before = quantify(inv);
|
|
globQuant = before;
|
|
|
|
inv.close();
|
|
|
|
if (!before["minecraft:experience_bottle"])
|
|
before["minecraft:experience_bottle"] = 0;
|
|
if (!before["minecraft:emerald"])
|
|
before["minecraft:emerald"] = 0;
|
|
if (!before["minecraft:glass_bottle"])
|
|
before["minecraft:glass_bottle"] = 0;
|
|
if (!before["minecraft:rotten_flesh"])
|
|
before["minecraft:rotten_flesh"] = 0;
|
|
if (!before["minecraft:redstone"])
|
|
before["minecraft:redstone"] = 0;
|
|
if (!before["minecraft:paper"])
|
|
before["minecraft:paper"] = 0;
|
|
if (!before["minecraft:glass"])
|
|
before["minecraft:glass"] = 0;
|
|
GlobalVars.putInt(
|
|
"glass",
|
|
before["minecraft:glass"]
|
|
);
|
|
glass = before["minecraft:glass"];
|
|
GlobalVars.putInt(
|
|
"paper",
|
|
before["minecraft:paper"]
|
|
);
|
|
paper = before["minecraft:paper"];
|
|
GlobalVars.putInt(
|
|
"emerald",
|
|
before["minecraft:emerald"]
|
|
);
|
|
emerald = before["minecraft:emerald"];
|
|
GlobalVars.putInt(
|
|
"redstone",
|
|
before["minecraft:redstone"]
|
|
);
|
|
redstone = before["minecraft:redstone"];
|
|
flesh = before["minecraft:rotten_flesh"];
|
|
xp = before["minecraft:experience_bottle"];
|
|
GlobalVars.putInt(
|
|
"bottle",
|
|
before["minecraft:glass_bottle"]
|
|
);
|
|
GlobalVars.putInt(
|
|
"flesh",
|
|
before["minecraft:rotten_flesh"]
|
|
);
|
|
GlobalVars.putInt(
|
|
"xp",
|
|
before["minecraft:experience_bottle"]
|
|
);
|
|
Time.sleep(100);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (reach) {
|
|
if (mode === "emerald") {
|
|
if (emerald > 88 && tradepos === 1 && tradelane === 0) {
|
|
//if(((bottle >=64)&&(trade_good_bottle))||(!trade_good_bottle)){
|
|
//Chat.log('should put away blocks');
|
|
craft(
|
|
938 + tradelane,
|
|
72,
|
|
11851 - tradepos * 2,
|
|
"emerald_block"
|
|
);
|
|
//only put when crafting successful
|
|
put(940, 71, 11852, "emerald_block");
|
|
const inv = Player.openInventory();
|
|
const before = quantify(inv);
|
|
if (!before["minecraft:emerald"])
|
|
before["minecraft:emerald"] = 0;
|
|
GlobalVars.putInt("emerald", before["minecraft:emerald"]);
|
|
emerald = before["minecraft:emerald"];
|
|
globQuant = quantify(inv);
|
|
inv.close();
|
|
|
|
//}
|
|
}
|
|
}
|
|
if (redstone > 88) {
|
|
craft(
|
|
938 + tradelane,
|
|
72,
|
|
11851 - tradepos * 2,
|
|
"redstone_block"
|
|
);
|
|
}
|
|
if (tradepos === 1 && tradelane === 0) {
|
|
put(940, 71, 11852, "redstone_block");
|
|
}
|
|
if (xp > 88 && tradepos === 1 && tradelane === 0) {
|
|
put(940, 71, 11852, "experience_bottle");
|
|
}
|
|
if (paper < 32 && trade_good_paper) {
|
|
//Chat.log('should take paper');
|
|
takeStacks(
|
|
938,
|
|
72,
|
|
11852 - tradepos * 2,
|
|
"minecraft:sugar_cane",
|
|
3
|
|
);
|
|
//return count from takeStacks and only craft when sugar_cane found
|
|
craft(938 + tradelane, 72, 11851 - tradepos * 2, "paper");
|
|
|
|
const inv = Player.openInventory();
|
|
const before = quantify(inv);
|
|
if (!before["minecraft:paper"]) before["minecraft:paper"] = 0;
|
|
GlobalVars.putInt("paper", before["minecraft:paper"]);
|
|
paper = before["minecraft:paper"];
|
|
globQuant = quantify(inv);
|
|
inv.close();
|
|
}
|
|
//if (bottle < 32 && trade_good_bottle) {
|
|
if (mode === "glass" && tradepos === 1 && tradelane === 0) {
|
|
//craft(
|
|
// 938 + tradelane,
|
|
// 72,
|
|
// 11851 - tradepos * 2,
|
|
// "glass_bottle"
|
|
//);
|
|
//GlobalVars.putInt("glass", 0);
|
|
put(940, 71, 11852, "glass");
|
|
}
|
|
//}
|
|
// if (glass > 0 && tradepos === 1) {
|
|
// if (mode === "glass") {
|
|
// put(940, 71, 11852, "glass");
|
|
// }
|
|
// }
|
|
if (flesh < 128 && trade_good_flesh) {
|
|
//Chat.log('should take flesh');
|
|
//takeStacks(946,74,11849,'minecraft:rotten_flesh',3);
|
|
}
|
|
if (
|
|
(mode === "experience_bottle" || mode === "glass") &&
|
|
emerald < 32
|
|
) {
|
|
//Chat.log('should take emerald');
|
|
//takeStacks(946,74,11849,'minecraft:emerald_block',1);
|
|
//return count from takeStacks and only craft when blocks found
|
|
//craft(946,75,11847,'emerald');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
let player = Player.getPlayer();
|
|
const dim = World.getDimension();
|
|
|
|
let farm = "none";
|
|
|
|
let pdetect = false;
|
|
for (const e of World.getEntities()) {
|
|
if (e.getType() === "minecraft:player") {
|
|
let name = e.getName().getString();
|
|
if (
|
|
!(
|
|
name === "DLuKz_" ||
|
|
name === "sebgreenbus" ||
|
|
name === "craftery85" ||
|
|
name === "Thuxx_"
|
|
)
|
|
) {
|
|
Chat.log("presence detected: " + name);
|
|
pdetect = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (
|
|
player
|
|
.getPos()
|
|
.toVector(PositionCommon.createPos(180, 85, 247))
|
|
.getMagnitude() < 20
|
|
) {
|
|
const testBlock = World.getBlock(180, 85, 247).getId();
|
|
if (testBlock === "minecraft:terracotta") {
|
|
Chat.log("lobby");
|
|
KeyBind.key("key.keyboard.1", true);
|
|
Client.waitTick();
|
|
player.attack();
|
|
JsMacros.waitForEvent("OpenContainer").context.releaseLock();
|
|
const inv2 = Player.openInventory();
|
|
Time.sleep(200);
|
|
for (let i = 0; i < inv2.getTotalSlots(); i++) {
|
|
if (inv2.getSlot(i).getItemId() === "minecraft:oak_sapling") {
|
|
inv2.click(i);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (pdetect === false) {
|
|
if (dim === "minecraft:overworld") {
|
|
if (
|
|
player
|
|
.getPos()
|
|
.toVector(PositionCommon.createPos(883, 72, 11797))
|
|
.getMagnitude() < 1.5
|
|
) {
|
|
farm = "terracotta";
|
|
if (event.eventName === "t2000") {
|
|
Chat.log(
|
|
Chat.createTextBuilder()
|
|
.append("[")
|
|
.withColor(0x7)
|
|
.append("MacroBot")
|
|
.withColor(0x2)
|
|
.append("]")
|
|
.withColor(0x7)
|
|
.build()
|
|
);
|
|
take(883, 73, 11795);
|
|
craft(883, 74, 11795, "clay");
|
|
put(882, 74, 11794, "clay");
|
|
}
|
|
}
|
|
if (
|
|
player
|
|
.getPos()
|
|
.toVector(PositionCommon.createPos(-764.5, 71, -2308))
|
|
.getMagnitude() < 1.5
|
|
) {
|
|
farm = "iron";
|
|
if (event.eventName === "t2000") {
|
|
Chat.log(
|
|
Chat.createTextBuilder()
|
|
.append("[")
|
|
.withColor(0x7)
|
|
.append("MacroBot")
|
|
.withColor(0x2)
|
|
.append("]")
|
|
.withColor(0x7)
|
|
.build()
|
|
);
|
|
take(-767, 71, -2309);
|
|
craft(-765, 70, -2310, "iron_block");
|
|
//put(-767,74,-2308,'iron_block');
|
|
}
|
|
}
|
|
if (
|
|
player
|
|
.getPos()
|
|
.toVector(PositionCommon.createPos(-733, 71, -2219))
|
|
.getMagnitude() < 1.5
|
|
) {
|
|
//farm = 'bonemeal';
|
|
//if(event.eventName == 't2000'){
|
|
// Chat.log(Chat.createTextBuilder().append("[").withColor(0x7).append("MacroBot").withColor(0x2).append("]").withColor(0x7).build());
|
|
// take(-732,71,-2218);
|
|
// craft(-735,71,-2218,'bone_block');
|
|
// put(-734,72,-2217,'bone_block');
|
|
//}
|
|
}
|
|
if (
|
|
player
|
|
.getPos()
|
|
.toVector(PositionCommon.createPos(37.5, 81, 11930.5))
|
|
.getMagnitude() < 1.5
|
|
) {
|
|
farm = "blue";
|
|
if (event.eventName === "t2000") {
|
|
Chat.log(
|
|
Chat.createTextBuilder()
|
|
.append("[")
|
|
.withColor(0x7)
|
|
.append("MacroBot")
|
|
.withColor(0x2)
|
|
.append("]")
|
|
.withColor(0x7)
|
|
.build()
|
|
);
|
|
take(35, 81, 11930);
|
|
craft(35, 81, 11931, "blue_dye_from_cornflower");
|
|
put(36, 81, 11928, "blue_dye");
|
|
}
|
|
}
|
|
if (
|
|
player
|
|
.getPos()
|
|
.toVector(PositionCommon.createPos(981.1, 70, 11895.5))
|
|
.getMagnitude() < 0.4
|
|
) {
|
|
//let autocraft = GlobalVars.getBoolean('autocraft');
|
|
//if(autocraft){
|
|
// if(! player.isSleeping()){
|
|
if (player.getMainHand().getItemId() === "minecraft:elytra") {
|
|
farm = "autocraft";
|
|
if (event.eventName === "t200") {
|
|
//takeStacks(983,72,11897,'minecraft:bone_meal',10);
|
|
//put(978,71,11896,'gray_dye');
|
|
|
|
takeStacks(983, 72, 11897, "minecraft:bone", 9);
|
|
craft(979, 70, 11894, "bone_meal");
|
|
craft(979, 70, 11894, "bone_block");
|
|
|
|
/*
|
|
takeStacks(983,72,11897,'minecraft:gunpowder',9);
|
|
takeStacks(978,72,11897,'minecraft:sugar_cane',3);
|
|
craft(979,70,11894,'paper');
|
|
craftSpecial(979,70,11894);
|
|
craftSpecial(979,70,11894);
|
|
craftSpecial(979,70,11894);
|
|
*/
|
|
|
|
//put(978,71,11896,'lime_dye');
|
|
//craft(979,70,11894,'yellow_dye_from_sunflower');
|
|
//craft(979,70,11894,'red_dye_from_rose_bush');
|
|
//craft(979,70,11894,'black_dye_from_wither_rose');
|
|
//craft(979,70,11894,'gray_dye');
|
|
//craft(979,70,11894,'light_gray_dye_from_gray_white_dye');
|
|
//craft(979,70,11894,'yellow_dye_from_sunflower');
|
|
//craft(979,70,11894,'orange_dye_from_red_yellow');
|
|
|
|
//put(978,71,11896,'firework_rocket');
|
|
|
|
put(978, 71, 11896, "bone_block");
|
|
|
|
// if(player.getPos().toVector(GlobalVars.getObject('autocraft_player')).getMagnitude() < 1){
|
|
// let input = GlobalVars.getObject('autocraft_input');
|
|
// let output = GlobalVars.getObject('autocraft_output');
|
|
// let craftB = GlobalVars.getObject('autocraft_craft');
|
|
// take(input.getX(),input.getY(),input.getZ());
|
|
// craft(craftB.getX(),craftB.getY(),craftB.getZ(),GlobalVars.getString('autocraft_recipe').substring(10));
|
|
// put(output.getX(),output.getY(),output.getZ(),GlobalVars.getString('autocraft_result').substring(10));
|
|
// }
|
|
}
|
|
} else {
|
|
farm = "autocraft_nosword";
|
|
// GlobalVars.putBoolean('autocraft',false);
|
|
// Chat.log('ending autocraft - no diamond_sword');
|
|
}
|
|
}
|
|
|
|
if (
|
|
player
|
|
.getPos()
|
|
.toVector(PositionCommon.createPos(-11523.5, 268, -3583))
|
|
.getMagnitude() < 0.4
|
|
) {
|
|
let armor = false;
|
|
for (const e of World.getEntities()) {
|
|
if (e.getType() === "minecraft:armor_stand") {
|
|
armor = true;
|
|
}
|
|
}
|
|
if (!armor) {
|
|
Chat.log("dispensing armor stand");
|
|
player.interactBlock(-11525, 270, -3583, 2, false, true);
|
|
}
|
|
}
|
|
|
|
if (
|
|
player
|
|
.getPos()
|
|
.toVector(PositionCommon.createPos(887, 70, 11828.5))
|
|
.getMagnitude() < 0.4
|
|
) {
|
|
farm = "masscraft";
|
|
if (
|
|
event.eventName === "t200" &&
|
|
GlobalVars.getBoolean("craft_lock") === false
|
|
) {
|
|
GlobalVars.putBoolean("craft_lock", true);
|
|
/*put(884, 71, 11830, "dispenser");
|
|
if (!globQuant["minecraft:cobblestone"] || globQuant["minecraft:cobblestone"] < 112) {
|
|
if (!globQuant["minecraft:cobblestone"] || globQuant["minecraft:cobblestone"] > 48) {
|
|
takeStacks(889, 71, 11826, "minecraft:cobblestone", 1);
|
|
} else {
|
|
takeStacks(889, 71, 11826, "minecraft:cobblestone", 2);
|
|
}
|
|
}
|
|
if (!globQuant["minecraft:cobblestone"] || globQuant["minecraft:cobblestone"] < 112) {
|
|
takeStacks(889, 71, 11826, "minecraft:cobblestone", 2);
|
|
}
|
|
if (!globQuant["minecraft:redstone"] || globQuant["minecraft:redstone"] < 16) {
|
|
takeStacks(884, 71, 11826, "minecraft:redstone", 1);
|
|
}
|
|
if (!globQuant["minecraft:string"] || globQuant["minecraft:string"] < 48) {
|
|
takeStacks(889, 71, 11830, "minecraft:string", 1);
|
|
}
|
|
if (!globQuant["minecraft:stick"] || globQuant["minecraft:stick"] < 48) {
|
|
takeStacks(889, 71, 11830, "minecraft:oak_log", 1);
|
|
craft(886, 71, 11830, "oak_planks");
|
|
craft(886, 71, 11830, "stick");
|
|
}
|
|
var bows = globQuant["minecraft:bow"] || 0;
|
|
craft_num(886, 71, 11830, "bow", 8 - bows);
|
|
craft_num(886, 71, 11830, "dispenser", 8);
|
|
bows = globQuant["minecraft:bow"] || 0;
|
|
put(884, 71, 11830, "dispenser");*/
|
|
|
|
/* put(884,71,11830,'dropper');
|
|
takeStacks(889,71,11826,'minecraft:cobblestone',9);
|
|
if(! globQuant['minecraft:redstone'] || globQuant['minecraft:redstone'] < 83){
|
|
takeStacks(884,71,11826,'minecraft:redstone',2);
|
|
}
|
|
craft(886,71,11830,'dropper');
|
|
put(884,71,11830,'dropper');
|
|
*/
|
|
|
|
/*
|
|
put(884, 71, 11830, 'piston');
|
|
if (!globQuant['minecraft:birch_planks'] || globQuant['minecraft:birch_planks'] < (64*3)) {
|
|
takeStacks(889, 71, 11830, 'minecraft:birch_log', 1);
|
|
craft(886, 71, 11830, 'birch_planks');
|
|
}
|
|
takeStacks(889, 71, 11826, "minecraft:cobblestone", 4);
|
|
takeStacks(884, 71, 11826, "minecraft:redstone", 1);
|
|
if (!globQuant['minecraft:iron_ingot'] || globQuant['minecraft:iron_ingot'] < 64) {
|
|
takeStacks(887, 72, 11824, 'minecraft:iron_ingot',1);
|
|
}
|
|
if (!globQuant['minecraft:iron_ingot'] || globQuant['minecraft:iron_ingot'] < 64) {
|
|
takeStacks(888, 72, 11824, 'minecraft:iron_block', 1);
|
|
craft(886, 71, 11830, 'iron_ingot_from_iron_block');
|
|
put(887, 72, 11824, 'iron_ingot');
|
|
}
|
|
if (!globQuant['minecraft:iron_ingot'] || globQuant['minecraft:iron_ingot'] < 64) {
|
|
takeStacks(887, 72, 11824, 'minecraft:iron_ingot',1);
|
|
}
|
|
|
|
craft(886,71,11830,'piston');
|
|
put(884,71,11830,'piston');
|
|
|
|
|
|
*/
|
|
/*
|
|
put(884, 71, 11830, 'observer');
|
|
if (!globQuant["minecraft:cobblestone"] || globQuant["minecraft:cobblestone"] < (64 * 18)) {
|
|
takeStacks(889, 71, 11826, "minecraft:cobblestone", 18);
|
|
}
|
|
if (!globQuant["minecraft:redstone"] || globQuant["minecraft:redstone"] < (64 * 6)) {
|
|
takeStacks(884, 71, 11826, "minecraft:redstone", 6);
|
|
}
|
|
if (!globQuant["minecraft:quartz"] || globQuant["minecraft:quartz"] < (64 * 3)) {
|
|
takeStacks(889, 71, 11830, 'minecraft:quartz', 3);
|
|
}
|
|
if (!globQuant["minecraft:cobblestone"] || globQuant["minecraft:cobblestone"] < (64 * 18)) {
|
|
takeStacks(889, 71, 11826, "minecraft:cobblestone", Math.round(((64*18)-globQuant["minecraft:cobblestone"])/64));
|
|
}
|
|
if (!globQuant["minecraft:redstone"] || globQuant["minecraft:redstone"] < (64 * 6)) {
|
|
takeStacks(884, 71, 11826, "minecraft:redstone", Math.round(((64 * 6) - globQuant["minecraft:redstone"]) / 64));
|
|
}
|
|
craft(886,71,11830,'observer');
|
|
put(884,71,11830,'observer');
|
|
*/
|
|
|
|
/*takeStacks(884, 71, 11826, "minecraft:redstone_block", 3);
|
|
craft(886, 71, 11830, "redstone");
|
|
put(884, 71, 11830, "redstone");
|
|
*/
|
|
|
|
/* put(884, 71, 11830, 'repeater');
|
|
if (!globQuant["minecraft:stone"] || globQuant["minecraft:stone"] < (64 * 9)) {
|
|
takeStacks(889, 71, 11826, "minecraft:stone", 9);
|
|
}
|
|
if (!globQuant["minecraft:redstone"] || globQuant["minecraft:redstone"] < (64 * 9)) {
|
|
Chat.log(Math.round(((64 * 9) - (globQuant["minecraft:redstone"]||0)) / 64));
|
|
takeStacks(884, 71, 11826, "minecraft:redstone", Math.round(((64 * 9) - (globQuant["minecraft:redstone"]||0)) / 64));
|
|
}
|
|
if (!globQuant["minecraft:redstone_torch"] || globQuant["minecraft:redstone_torch"] < (64 * 6)) {
|
|
if (!globQuant["minecraft:stick"] || globQuant["minecraft:stick"] < (64 * 6)) {
|
|
if (!globQuant["minecraft:birch_planks"] || globQuant["minecraft:birch_planks"] < (64 * 4s)) {
|
|
if (!globQuant["minecraft:birch_log"] || globQuant["minecraft:birch_log"] < (64)) {
|
|
takeStacks(889, 71, 11830, "minecraft:birch_log", 1);
|
|
}
|
|
craft(886, 71, 11830, "birch_planks");
|
|
}
|
|
craft(886, 71, 11830, "stick");
|
|
}
|
|
craft(886, 71, 11830, "redstone_torch");
|
|
}
|
|
craft(886, 71, 11830, "repeater");
|
|
put(884, 71, 11830, 'repeater');*/
|
|
/*
|
|
put(884, 71, 11830, "comparator");
|
|
|
|
if (!globQuant["minecraft:stone"] || globQuant["minecraft:stone"] < 64 * 9) {
|
|
takeStacks(889, 71, 11826, "minecraft:stone", 9);
|
|
}
|
|
if (!globQuant["minecraft:redstone_torch"] || globQuant["minecraft:redstone_torch"] < 64 * 9) {
|
|
takeStacks(884, 71, 11826, "minecraft:redstone_torch", 9);
|
|
}
|
|
if (!globQuant["minecraft:quartz"] || globQuant["minecraft:quartz"] < (64*3)) {
|
|
takeStacks(889, 71, 11830, "minecraft:quartz", 3);
|
|
}
|
|
|
|
craft(886, 71, 11830, "comparator");
|
|
put(884, 71, 11830, "comparator");
|
|
*/
|
|
|
|
/*put(884, 71, 11830, "chest");
|
|
takeStacks(889, 71, 11830, "minecraft:crimson_stem", 9);
|
|
craft(886, 71, 11830, "crimson_planks");
|
|
craft(886, 71, 11830, "chest");
|
|
put(884, 71, 11830, "chest");*/
|
|
|
|
put(884, 71, 11830, "hopper");
|
|
if (
|
|
!globQuant["minecraft:chest"] ||
|
|
globQuant["minecraft:chest"] < 64 * 3
|
|
) {
|
|
takeStacks(889, 71, 11830, "minecraft:chest", 3);
|
|
}
|
|
if (
|
|
!globQuant["minecraft:iron_ingot"] ||
|
|
globQuant["minecraft:iron_ingot"] < 64 * 15
|
|
) {
|
|
if (
|
|
!globQuant["minecraft:iron_block"] ||
|
|
globQuant["minecraft:iron_block"] < 64 * 2
|
|
) {
|
|
takeStacks(884, 71, 11826, "minecraft:iron_block", 2);
|
|
}
|
|
craft(886, 71, 11830, "iron_ingot_from_iron_block");
|
|
}
|
|
craft(886, 71, 11830, "hopper");
|
|
|
|
put(884, 71, 11830, "hopper");
|
|
|
|
/*put(884, 71, 11830, "redstone_torch");
|
|
if (!globQuant["minecraft:redstone"] || globQuant["minecraft:redstone"] < 64 * 9) {
|
|
takeStacks(884, 71, 11826, "minecraft:redstone", Math.round((64 * 9 - (globQuant["minecraft:redstone"] || 0)) / 64));
|
|
}
|
|
if (!globQuant["minecraft:stick"] || globQuant["minecraft:stick"] < 64 * 9) {
|
|
if (!globQuant["minecraft:birch_planks"] || globQuant["minecraft:birch_planks"] < 64 * 5) {
|
|
if (!globQuant["minecraft:birch_log"] || globQuant["minecraft:birch_log"] < 64) {
|
|
takeStacks(889, 71, 11830, "minecraft:birch_log", 2);
|
|
}
|
|
craft(886, 71, 11830, "birch_planks");
|
|
}
|
|
craft(886, 71, 11830, "stick");
|
|
}
|
|
craft(886, 71, 11830, "redstone_torch");
|
|
put(884, 71, 11830, "redstone_torch");*/
|
|
|
|
/*put(884, 71, 11830, "target");
|
|
if (!globQuant["minecraft:hay_block"]) {
|
|
takeStacks(889, 71, 11830, "minecraft:hay_block", 4);
|
|
}
|
|
if (globQuant["minecraft:hay_block"] < 256) {
|
|
takeStacks(889, 71, 11830, "minecraft:hay_block", Math.round((256 - globQuant["minecraft:hay_block"]) / 64));
|
|
}
|
|
if (!globQuant["minecraft:redstone"]) {
|
|
takeStacks(884, 71, 11826, "minecraft:redstone", 16);
|
|
}
|
|
if (globQuant["minecraft:redstone"] < 1024) {
|
|
takeStacks(884, 71, 11826, "minecraft:redstone", Math.round((1024 - globQuant["minecraft:redstone"]) / 64));
|
|
}
|
|
if (globQuant["minecraft:redstone"] < 1024) {
|
|
takeStacks(884, 71, 11826, "minecraft:redstone", Math.round((1024 - globQuant["minecraft:redstone"]) / 64));
|
|
}
|
|
craft(886, 71, 11830, "target");
|
|
put(884, 71, 11830, "target");*/
|
|
|
|
GlobalVars.putBoolean("craft_lock", false);
|
|
}
|
|
}
|
|
|
|
if (
|
|
player
|
|
.getPos()
|
|
.toVector(PositionCommon.createPos(-703.5, 70, -2221.5))
|
|
.getMagnitude() < 0.6
|
|
) {
|
|
farm = "lava";
|
|
const cState = World.getBlock(-708, 71, -2222).getId();
|
|
if (cState === "minecraft:lava_cauldron") {
|
|
if (player.getMainHand().getItemId() === "minecraft:bucket")
|
|
player.interactBlock(-708, 71, -2222, 4, false);
|
|
}
|
|
}
|
|
|
|
if (
|
|
player.getZ() > 11800 &&
|
|
player.getZ() < 11853 &&
|
|
player.getY() >= 69 &&
|
|
player.getY() < 71 &&
|
|
player.getX() > 938 &&
|
|
player.getX() < 946
|
|
) {
|
|
farm = "trade";
|
|
let tradelane = 0;
|
|
if (player.getX() > 944) {
|
|
tradelane = 6;
|
|
}
|
|
|
|
let last_trade_pos = GlobalVars.getInt("last_trade_pos");
|
|
let last_tradelane = GlobalVars.getInt("last_tradelane");
|
|
let z = player.getZ();
|
|
let x = player.getX();
|
|
let y = player.getY();
|
|
let trade_pos = (11852 - Math.floor(z)) / 2;
|
|
let diff = Math.abs(11852 - trade_pos * 2 - z + 0.5);
|
|
//Chat.log(trade_pos+' '+x+' '+y+' '+diff+' '+last_trade_pos);
|
|
|
|
if (
|
|
trade_pos % 2 === 1 &&
|
|
(Math.abs(939.5 - x) < 0.2 || Math.abs(945.5 - x) < 0.2) &&
|
|
y > 70.1 &&
|
|
y < 70.6 &&
|
|
diff < 0.4 &&
|
|
(last_trade_pos !== trade_pos || last_tradelane !== tradelane)
|
|
) {
|
|
//Chat.log(trade_pos);
|
|
GlobalVars.putInt("last_trade_pos", trade_pos);
|
|
GlobalVars.putInt("last_tradelane", tradelane);
|
|
|
|
//if(GlobalVars.getBoolean('trade_lock') == true){
|
|
//}else{
|
|
// GlobalVars.putBoolean('trade_lock',true);
|
|
GlobalVars.putInt("trade_pos", trade_pos);
|
|
if ((trade_pos + 1) % 4 === 0) {
|
|
trade(trade_pos, tradelane, true);
|
|
trade(trade_pos + 1, tradelane, false);
|
|
} else {
|
|
trade(trade_pos + 1, tradelane, false);
|
|
trade(trade_pos, tradelane, true);
|
|
}
|
|
|
|
//trade(trade_pos+1,false);
|
|
// GlobalVars.putBoolean('trade_lock',false);
|
|
//}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (dim === "minecraft:the_nether") {
|
|
if (
|
|
player
|
|
.getPos()
|
|
.toVector(PositionCommon.createPos(80.5, 246, -94))
|
|
.getMagnitude() < 1.5
|
|
) {
|
|
farm = "bartering";
|
|
if (event.eventName === "t2000") {
|
|
Chat.log(
|
|
Chat.createTextBuilder()
|
|
.append("[")
|
|
.withColor(0x7)
|
|
.append("MacroBot")
|
|
.withColor(0x2)
|
|
.append("]")
|
|
.withColor(0x7)
|
|
.build()
|
|
);
|
|
take(78, 246, -95);
|
|
craft(78, 247, -96, "gold_ingot_from_nuggets");
|
|
put(78, 246, -96, "gold_ingot");
|
|
//craft(78,247,-96,'gold_block');
|
|
//put(79,246,-97,'gold_block');
|
|
}
|
|
}
|
|
if (
|
|
player
|
|
.getPos()
|
|
.toVector(PositionCommon.createPos(-1438.5, 250, -448))
|
|
.getMagnitude() < 1.0
|
|
) {
|
|
farm = "bartering2";
|
|
if (event.eventName === "t200") {
|
|
Chat.log(
|
|
Chat.createTextBuilder()
|
|
.append("[")
|
|
.withColor(0x7)
|
|
.append("MacroBot")
|
|
.withColor(0x2)
|
|
.append("]")
|
|
.withColor(0x7)
|
|
.build()
|
|
);
|
|
player.lookAt(0, -8);
|
|
craft(-1439, 251, -446, "gold_ingot_from_nuggets");
|
|
player.interactBlock(-1439, 251, -446, 0, false, true);
|
|
JsMacros.waitForEvent("OpenContainer").context.releaseLock();
|
|
const inv3 = Player.openInventory();
|
|
Time.sleep(200);
|
|
const before = quantify(inv3);
|
|
let closed = false;
|
|
for (let i = 0; i < inv3.getTotalSlots(); i++) {
|
|
if (
|
|
inv3.getLocation(i) === "main" ||
|
|
inv3.getLocation(i) === "hotbar"
|
|
) {
|
|
if (
|
|
inv3.getSlot(i).getItemId() ===
|
|
"minecraft:gold_ingot"
|
|
) {
|
|
inv3.grabAll(i);
|
|
compare(before, quantify(inv3));
|
|
globQuant = quantify(inv3);
|
|
inv3.closeAndDrop();
|
|
closed = true;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
if (!closed) {
|
|
inv3.close();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
let farm_old = GlobalVars.getString("detected");
|
|
|
|
GlobalVars.putString("detected", farm);
|
|
|
|
if (farm !== farm_old) {
|
|
GlobalVars.putBoolean("craft_lock", false);
|
|
GlobalVars.putInt("started", Math.floor(Date.now() / 1000));
|
|
GlobalVars.putString("itemcounter", JSON.stringify("{}"));
|
|
GlobalVars.putString("itemcounterT", JSON.stringify("{}"));
|
|
|
|
//reset trade state
|
|
GlobalVars.putBoolean("trade_good_flesh", false);
|
|
GlobalVars.putBoolean("trade_good_bottle", false);
|
|
GlobalVars.putBoolean("trade_good_paper", false);
|
|
|
|
//Chat.log('reset timers');
|
|
}
|
|
}
|