const NBTTagString = Java.type('net.minecraft.nbt.NBTTagString'); let utils = { addLore: function(item, prefix, value){ const list = item .getNBT() .getCompoundTag("tag") .getCompoundTag("display") .getTagMap() .get("Lore") let done = false // Gets the current lore lines for (let i = 0; i < list.func_74745_c(); i++) { if (String(list.func_150307_f(i)).startsWith(prefix)){ list.func_150304_a(i, new NBTTagString(prefix+value)); done = true } } if(!done){ list.func_74742_a( new NBTTagString(prefix+value)) } item .getNBT() .getCompoundTag("tag") .getCompoundTag("display") .getRawNBT() .func_74782_a("Lore", list); }, getSBID: function(item){ return item?.getNBT()?.getCompoundTag("tag")?.getCompoundTag("ExtraAttributes")?.getString("id") || null }, calculateDistance: function(p1, p2) { var a = p2[0] - p1[0]; var b = p2[1] - p1[1]; var c = p2[2] - p1[2]; let ret = Math.hypot(a,b,c) if(ret<0){ ret *= -1 } return ret; }, calculateDistanceQuick: function(p1, p2) { var a = p2[0] - p1[0]; var b = p2[1] - p1[1]; var c = p2[2] - p1[2]; let ret = a * a + b * b + c * c if(ret<0){ ret *= -1 } return ret; }, /** * Please try not to use this * it has O(n!) * only use if points < 10 or something * D: * @param {*} startPoint * @param {*} points * @returns */ fastestPathThrough:function(startPoint, points){ let ret = [] while(ret.length{ return points[a] }) let len = 0 for(let i = 0;i