diff options
| -rw-r--r-- | featureClass/class.js | 9 | ||||
| -rw-r--r-- | featureClass/featureManager.js | 1 | ||||
| -rw-r--r-- | features/changeLogGUI/index.js | 4 | ||||
| -rw-r--r-- | features/dungeonMap/index.js | 180 | ||||
| -rw-r--r-- | features/dungeonRoutes/index.js | 262 | ||||
| -rw-r--r-- | features/dungeonRoutes/routesData.json | 6543 | ||||
| -rw-r--r-- | features/dungeonSolvers/index.js | 69 | ||||
| -rw-r--r-- | features/fpsImproveGui/index.js | 58 | ||||
| -rw-r--r-- | features/fpsImproveGui/metadata.json | 8 | ||||
| -rw-r--r-- | features/globalSettings/index.js | 24 | ||||
| -rw-r--r-- | metadata.json | 4 | ||||
| -rw-r--r-- | socketConnection.js | 11 |
12 files changed, 879 insertions, 6294 deletions
diff --git a/featureClass/class.js b/featureClass/class.js index dc0ca27..22614b1 100644 --- a/featureClass/class.js +++ b/featureClass/class.js @@ -211,14 +211,19 @@ class Event { if (this.enabled) return this.enabled = true - this.actuallyRegister() + + delay(0, () => { + this.actuallyRegister() + }) } unregister() { if (!this.enabled) return this.enabled = false - this.actuallyUnregister() + delay(0, () => { + this.actuallyUnregister() + }) } actuallyRegister() { } diff --git a/featureClass/featureManager.js b/featureClass/featureManager.js index 9da76c7..0f0edeb 100644 --- a/featureClass/featureManager.js +++ b/featureClass/featureManager.js @@ -414,6 +414,7 @@ class FeatureManager { // } // }) // }else{ + this.eventObjects[event] = register(event, (...args) => { // let start = Date.now() this.triggerEvent(event, args) diff --git a/features/changeLogGUI/index.js b/features/changeLogGUI/index.js index 6b50fdb..d370b50 100644 --- a/features/changeLogGUI/index.js +++ b/features/changeLogGUI/index.js @@ -24,7 +24,7 @@ class ChangeLogGui extends Feature { onEnable() { this.initVariables() - + this.ChangelogPage = new ChangelogPage() this.latestAnnouncedVersion = this.ChangelogPage.currVersionId @@ -168,7 +168,7 @@ class ChangelogPage extends GuiPage { this.openSidebarPage(this.updatingSidebar) } - + downloadUpdate() { new Thread(() => { this.updatingSidebarConfirmPage.location.location.x.set(-1, 500) diff --git a/features/dungeonMap/index.js b/features/dungeonMap/index.js index 7a9b7cb..68adf7e 100644 --- a/features/dungeonMap/index.js +++ b/features/dungeonMap/index.js @@ -40,6 +40,7 @@ class DungeonMap extends Feature { this.mapBackground = new ToggleSetting("Map Background And Border", "Puts a grey background behind the map + Black border", true, "dmap_background", this) this.showMapInBoss = new ToggleSetting("Keep showing the map in the dungeon boss room", "This will center the map when in boss to still be usefull", true, "dmap_enable_boss", this) this.borderedHeads = new ToggleSetting("Add a black border around heads on map", "", false, "dmap_border_head", this) + this.roomsecrets = new ToggleSetting("Shows secretscompleted/total secrets in room", "(works best when all of party is using soopy map)", false, "roomsecrets", this) this.brBox = new ToggleSetting("Box around doors in br", "In map category because it uses map to find location (no esp)", true, "dmap_door", this) this.spiritLeapOverlay = new ToggleSetting("Spirit leap overlay", "Cool overlay for the spirit leap menu", true, "spirit_leap_overlay", this) // this.spiritLeapOverlay = new ToggleSetting("Spirit leap overlay", "Cool overlay for the spirit leap menu", true, "spirit_leap_overlay", this).requires(this.spiritLeapOverlay) @@ -61,6 +62,8 @@ class DungeonMap extends Feature { this.mortLocationOnMap = undefined this.brBoxLoc = undefined this.keys = 0 + + this.roomDataStuff = new Map() // this.invMapImage = new BufferedImage(128, 128, BufferedImage.TYPE_INT_ARGB) // this.renderImage = new BufferedImage(this.IMAGE_SIZE, this.IMAGE_SIZE, BufferedImage.TYPE_INT_ARGB) this.mapData = undefined @@ -177,8 +180,29 @@ class DungeonMap extends Feature { this.registerChat("&r&r&r &r&cThe Catacombs &r&8- &r&eFloor ${*} Stats&r", () => { this.puzzles = {} }) + + let lastXY = "" + let registerActionBar = this.registerCustom("actionbar", (curr, max) => { + let loc = this.getRoomXYWorld() + + if (lastXY !== loc.join(",")) { + lastXY = loc.join(",") + return + } + if (curr === max) curr = "&a" + curr + if (this.roomDataStuff.get(loc.join(",")) !== curr + " " + max) { + this.roomDataStuff.set(loc.join(","), curr + " " + max) + + socketConnection.sendDungeonData2(this.people, [loc.join(","), curr + " " + max]) + } + }) + registerActionBar.trigger.setCriteria('&7${curr}/${max} Secrets').setParameter('contains'); } + updateDungeonMapData2(data) { + // console.log("Recieved: " + JSON.stringify(data, undefined, 2)) + this.roomDataStuff.set(data[0], data[1]) + } worldLoad() { this.dungeonBrBoxElm.stopRender() this.mortLocation = undefined @@ -192,6 +216,7 @@ class DungeonMap extends Feature { this.bloodOpened = false this.keys = 0 this.idToPlayer = {} + this.roomDataStuff.clear() } renderOverlay() { @@ -285,11 +310,16 @@ class DungeonMap extends Feature { Client.getMinecraft().field_71460_t.func_147701_i().func_148250_a(this.mapData, true); GlStateManager.func_179121_F(); //GlStateManager.pop() } + try { + this.drawOtherMisc(x + xOff, y + yOff, size, scale) - this.drawOtherMisc(x + xOff, y + yOff, size, scale) - - this.drawPlayersLocations(x + xOff, y + yOff, size, scale) + this.drawPlayersLocations(x + xOff, y + yOff, size, scale) + this.drawOtherMisc2(x + xOff, y + yOff, size, scale) + } catch (e) { + console.error(e) + console.error(e.stack) + } renderLibs.stopScizzor() if (this.mapBackground.getValue()) Renderer.drawRect(Renderer.color(0, 0, 0), x, y, size, 2) @@ -300,7 +330,7 @@ class DungeonMap extends Feature { } } - drawOtherMisc(x2, y2, size2, scale) { + drawOtherMisc(x2, y2, size, scale) { if (this.currDungeonBossImage) return if (this.mapIcons.getValue()) { Object.keys(this.puzzles).forEach(loc => { @@ -320,6 +350,32 @@ class DungeonMap extends Feature { } } + drawOtherMisc2(x2, y2, size, scale) { + if (this.currDungeonBossImage) return + if (this.roomsecrets.getValue()) { + for (let ent of this.roomDataStuff.entries()) { + let [loc, val] = ent + let [x, y] = loc.split(",") + + let val2 = ChatLib.removeFormatting(val) + + let renderX = (parseInt(x) + 16) / this.mapScale / 128 * size + this.offset[0] / 128 * size + let renderY = (parseInt(y) + 16) / this.mapScale / 128 * size + this.offset[1] / 128 * size + + Renderer.translate(0, 0, 1000) + renderLibs.drawStringCentered("§0" + val2, x2 + renderX + scale * 1.25, y2 + renderY - 2 * scale * 1.25, scale * 1.25) + Renderer.translate(0, 0, 1000) + renderLibs.drawStringCentered("§0" + val2, x2 + renderX - scale * 1.25, y2 + renderY - 2 * scale * 1.25, scale * 1.25) + Renderer.translate(0, 0, 1000) + renderLibs.drawStringCentered("§0" + val2, x2 + renderX, y2 + renderY + scale * 1.25 - 2 * scale * 1.25, scale * 1.25) + Renderer.translate(0, 0, 1000) + renderLibs.drawStringCentered("§0" + val2, x2 + renderX, y2 + renderY - scale * 1.25 - 2 * scale * 1.25, scale * 1.25) + Renderer.translate(0, 0, 1000) + renderLibs.drawStringCentered("§f" + val, x2 + renderX, y2 + renderY - 2 * scale * 1.25, scale * 1.25) + } + } + } + drawPlayersLocations(x, y, size, scale) { let uuidToPlayer = {} @@ -381,6 +437,95 @@ class DungeonMap extends Feature { this.getImageForPlayer(uuid).draw(-5, -5, 10, 10) } + getRoomXYWorld() { + let roomData = this.getRoomWorldData() + if (roomData.rotation === 4) { + return [roomData.x, roomData.y + 32] + } + + return [roomData.x, roomData.y] + } + + getRotation(x, y, width, height, roofY) { + let one = this.getTopBlockAt(x + width / 2 + 1, y + height / 2, roofY) + let two = this.getTopBlockAt(x + width / 2 - 1, y + height / 2, roofY) + let three = this.getTopBlockAt(x + width / 2, y + height / 2 + 1, roofY) + let four = this.getTopBlockAt(x + width / 2, y + height / 2 - 1, roofY) + + if (one === 0 && three === 0) return 1 + if (two === 0 && three === 0) return 2 + if (one === 0 && four === 0) return 3 + if (two === 0 && four === 0) return 4 //4 IS SO TOXIK HGOLY HEL I HATE L SHAPE ROOMS WHY DO THIS TO ME + + return -1 + } + + getRoomWorldData() { + let x = Math.floor((Player.getX() + 8) / 32) * 32 - 8 + let y = Math.floor((Player.getZ() + 8) / 32) * 32 - 8 + let width = 30 + let height = 30 + + let roofY = this.getRoofAt(x, y) + + while (World.getBlockStateAt(new BlockPos(x - 1, roofY, y)).getBlockId() !== 0) { + x -= 32 + width += 32 + } + while (World.getBlockStateAt(new BlockPos(x, roofY, y - 1)).getBlockId() !== 0) { + y -= 32 + height += 32 + } + while (World.getBlockStateAt(new BlockPos(x - 1, roofY, y)).getBlockId() !== 0) { //second iteration incase of L shape + x -= 32 + width += 32 + } + while (World.getBlockStateAt(new BlockPos(x + width + 1, roofY, y)).getBlockId() !== 0) { + width += 32 + } + while (World.getBlockStateAt(new BlockPos(x, roofY, y + height + 1)).getBlockId() !== 0) { + height += 32 + } + while (World.getBlockStateAt(new BlockPos(x + width, roofY, y + height + 1)).getBlockId() !== 0) { //second iteration incase of L shape + height += 32 + } + while (World.getBlockStateAt(new BlockPos(x + width + 1, roofY, y + height)).getBlockId() !== 0) { //second iteration incase of L shape + width += 32 + } + while (World.getBlockStateAt(new BlockPos(x + width, roofY, y - 1)).getBlockId() !== 0) {//second iteration incase of L shape + y -= 32 + height += 32 + } + while (World.getBlockStateAt(new BlockPos(x - 1, roofY, y + height)).getBlockId() !== 0) { //third iteration incase of L shape + x -= 32 + width += 32 + } + + + return { + x, + y, + width, + height, + cx: x + width / 2, + cy: y + height / 2, + rotation: this.getRotation(x, y, width, height, roofY) + } + } + + getRoofAt(x, z) { + let y = 255 + while (y > 0 && World.getBlockStateAt(new BlockPos(x, y, z)).getBlockId() === 0) y-- + + return y + } + + getTopBlockAt(x, z, y) { + if (!y) y = this.getHeightAt(x, z) + + return World.getBlockStateAt(new BlockPos(x, y, z)).getBlockId() + } + step() { if (!World.getWorld()) return if (!this.isInDungeon()) return @@ -707,6 +852,32 @@ class DungeonMap extends Feature { }); } catch (e) { } } + + + if (this.offset && this.offset.length === 2) { + for (let ent of this.roomDataStuff.entries()) { + let [loc] = ent + let [x, y] = loc.split(",") + + let renderX = Math.round((parseInt(x) + 16) / this.mapScale + this.offset[0]) // / 128 * size + let renderY = Math.round((parseInt(y) + 16) / this.mapScale + this.offset[1])// / 128 * size + // console.log(renderX, renderY) + let isGreen = false + for (let i = 0; i < 10; i++) { + if (bytes[renderX + i + (renderY + i) * 128] === 30 + || bytes[renderX + i + 1 + (renderY + i) * 128] === 30) { + isGreen = true + } + } + console.log(ent[1], isGreen) + if (isGreen) { + let total = ent[1].split(" ")[1] + ent[1] = "&a" + total + " " + total + console.log(ent[1]) + } + console.log(ent[1], isGreen) + } + } // if (!this.renderImage) return // let newMapImageThing = new Image(this.renderImage) @@ -776,6 +947,7 @@ class DungeonMap extends Feature { this.dungeonBrBoxElm.stopRender() this.initVariables() this.running = false + this.roomDataStuff.clear() } } diff --git a/features/dungeonRoutes/index.js b/features/dungeonRoutes/index.js index 1c49dab..a7d8691 100644 --- a/features/dungeonRoutes/index.js +++ b/features/dungeonRoutes/index.js @@ -7,6 +7,7 @@ import SettingBase from "../settings/settingThings/settingBase"; const EntityItem = Java.type("net.minecraft.entity.item.EntityItem") +const EnumParticleTypes = Java.type('net.minecraft.util.EnumParticleTypes'); class DungeonRoutes extends Feature { constructor() { @@ -19,13 +20,8 @@ class DungeonRoutes extends Feature { return } - this.actionId = 0 - - this.recentEtherwarps = [] - this.recentMines = [] - this.recentLocations = [] - this.recentInteracts = [] - this.recentTnts = [] + this.recordingData = [] + this.currentActionIndex = 0 this.lastLocationUpdatedTime = Date.now() this.registerEvent("soundPlay", this.playSound) @@ -42,68 +38,69 @@ class DungeonRoutes extends Feature { let roomId = this.getCurrentRoomId() if (this.lastRoomId !== roomId) { this.lastRoomId = roomId - this.actionId = 0 - this.recentEtherwarps = [] - this.recentMines = [] - this.recentLocations = [] - this.recentTnts = [] - this.recentInteracts = [] + this.recordingData = [] this.currRoomData = this.getRoomWorldData() - this.currentRouteDisplay = this.routesIndexMap.get(this.fullRoomData[this.idMap.get(roomId)].index) + this.currentRouteDisplay = this.routesIndexMap.get(this.fullRoomData[this.idMap.get(roomId)].index)?.data ChatLib.chat(JSON.stringify(this.currentRouteDisplay, undefined, 2)) } if (!this.recordRoute) return - if (this.recentLocations.length === 0 - || Math.ceil(Player.getX()) !== this.recentLocations[this.recentLocations.length - 1].loc[0] - || Math.ceil(Player.getY()) !== this.recentLocations[this.recentLocations.length - 1].loc[1] - || Math.ceil(Player.getZ()) !== this.recentLocations[this.recentLocations.length - 1].loc[2]) { - - this.recentLocations.push({ loc: [Math.ceil(Player.getX()), Math.ceil(Player.getY()), Math.ceil(Player.getZ())], id: this.actionId++ }) + if (!this.recordingData[this.recordingData.length - 1]) return + let locs = this.recordingData[this.recordingData.length - 1].locations + if (locs.length === 0 + || Math.ceil(Player.getX()) !== locs[locs.length - 1][0] + || Math.ceil(Player.getY()) !== locs[locs.length - 1][1] + || Math.ceil(Player.getZ()) !== locs[locs.length - 1][2]) { + + this.addRecordingPoint("locations", [Math.ceil(Player.getX()), Math.ceil(Player.getY()), Math.ceil(Player.getZ())]) } }) this.registerEvent("renderWorld", () => { - this.recentEtherwarps.forEach(({ loc }) => { - drawFilledBox(loc.x, loc.y - 1, loc.z, 1, 1, 1, 0, 0, 50 / 255, true) - drawBoxAtBlock(loc.x - 0.5, loc.y - 1, loc.z - 0.5, 1, 0, 0, 1, 1, 1) - }) - this.recentMines.forEach(({ loc }) => { - drawFilledBox(loc.x, loc.y - 0.5, loc.z, 1, 1, 0, 1, 0, 50 / 255, true) - }) - this.recentTnts.forEach(({ loc }) => { - drawFilledBox(loc.x, loc.y - 0.5, loc.z, 1, 1, 1, 0, 0, 50 / 255, true) - }) - this.recentInteracts.forEach(({ loc }) => { - drawFilledBox(loc.x, loc.y, loc.z, 1, 1, 0, 0, 1, 50 / 255, true) - drawBoxAtBlock(loc.x - 0.5, loc.y, loc.z - 0.5, 0, 0, 1, 1, 1, 1) - }) - if (this.recentLocations.length >= 2) drawLinePoints(this.recentLocations.map(a => [a.loc[0] - 0.5, a.loc[1] + 0.1, a.loc[2] - 0.5]), 0, 0, 255, 2, false) + if (this.recordingData && this.recordingData[this.recordingData.length - 1]) { + this.recordingData[this.recordingData.length - 1].etherwarps.forEach((loc) => { + drawFilledBox(loc[0], loc[1] - 1, loc[2], 1, 1, 1, 0, 0, 50 / 255, true) + drawBoxAtBlock(loc[0] - 0.5, loc[1] - 1, loc[2] - 0.5, 1, 0, 0, 1, 1, 1) + }) + this.recordingData[this.recordingData.length - 1].mines.forEach((loc) => { + drawFilledBox(loc[0], loc[1] - 0.5, loc[2], 1, 1, 0, 1, 0, 50 / 255, true) + }) + this.recordingData[this.recordingData.length - 1].tnts.forEach((loc) => { + drawFilledBox(loc[0], loc[1] - 0.5, loc[2], 1, 1, 1, 0, 0, 50 / 255, true) + }) + this.recordingData[this.recordingData.length - 1].interacts.forEach(({ loc }) => { + drawFilledBox(loc[0], loc[1], loc[2], 1, 1, 0, 0, 1, 50 / 255, true) + drawBoxAtBlock(loc[0] - 0.5, loc[1], loc[2] - 0.5, 0, 0, 1, 1, 1, 1) + }) + let locs = this.recordingData[this.recordingData.length - 1].locations + if (locs.length >= 2) drawLinePoints(locs.map(a => [a[0] - 0.5, a[1] + 0.1, a[2] - 0.5]), 0, 0, 255, 2, false) + } if (this.currRoomData) { + drawBoxAtBlock(...this.toRoomCoordinates(0, 70, 0), 1, 0, 0, 1, 1, 1) if (this.currentRouteDisplay) { - this.currentRouteDisplay.etherwarps.forEach(loc => { + this.currentRouteDisplay[this.currentActionIndex].etherwarps.forEach(loc => { let coords = this.toRoomCoordinates(loc[0], loc[1] - 1, loc[2]) - drawFilledBox(coords[0] + 0.5, coords[1], coords[2] + 0.5, 1, 1, 1, 0, 0, 50 / 255, true) - drawBoxAtBlock(coords[0], coords[1], coords[2], 1, 0, 0, 1, 1, 1) + drawFilledBox(coords[0], coords[1], coords[2], 1, 1, 1, 0, 0, 50 / 255, true) + drawBoxAtBlock(coords[0] - 0.5, coords[1], coords[2] - 0.5, 1, 0, 0, 1, 1, 1) }) - this.currentRouteDisplay.mines.forEach(loc => { + this.currentRouteDisplay[this.currentActionIndex].mines.forEach(loc => { let coords = this.toRoomCoordinates(loc[0], loc[1] - 1, loc[2]) - drawFilledBox(coords[0] + 0.5, coords[1] + 0.5, coords[2] + 0.5, 1, 1, 0, 255, 0, 50 / 255, true) + drawFilledBox(coords[0], coords[1] + 0.5, coords[2], 1, 1, 0, 255, 0, 50 / 255, true) }) - this.currentRouteDisplay.tnts.forEach(loc => { + this.currentRouteDisplay[this.currentActionIndex].tnts.forEach(loc => { let coords = this.toRoomCoordinates(loc[0], loc[1] - 1, loc[2]) - drawFilledBox(coords[0] + 0.5, coords[1] + 0.5, coords[2] + 0.5, 1, 1, 255, 0, 0, 50 / 255, true) + drawFilledBox(coords[0], coords[1] + 0.5, coords[2] + 0.5, 1, 1, 255, 0, 0, 50 / 255, true) }) - this.currentRouteDisplay.interacts.forEach(loc => { - let coords = this.toRoomCoordinates(loc[0], loc[1], loc[2]) - drawFilledBox(coords[0] + 0.5, coords[1], coords[2] + 0.5, 1, 1, 0, 0, 1, 50 / 255, true) + this.currentRouteDisplay[this.currentActionIndex].interacts.forEach((data) => { + let coords = this.toRoomCoordinates(data.loc[0], data.loc[1], data.loc[2]) + drawFilledBox(coords[0], coords[1], coords[2], 1, 1, 0, 0, 1, 50 / 255, true) drawBoxAtBlock(coords[0], coords[1], coords[2], 0, 0, 1, 1, 1, 1) }) - if (this.currentRouteDisplay.locations.length >= 2) drawLinePoints(this.currentRouteDisplay.locations.map(a => this.toRoomCoordinates(...a)).map(a => [a[0] - 0.5, a[1] + 0.1, a[2] - 0.5]), 0, 0, 255, 2, false) + // if (this.currentRouteDisplay.locations.length >= 2) drawLinePoints(this.currentRouteDisplay.locations.map(a => this.toRoomCoordinates(...a)).map(a => [a[0] - 0.5, a[1] + 0.1, a[2] - 0.5]), 0, 0, 255, 2, false) } } @@ -138,28 +135,128 @@ class DungeonRoutes extends Feature { this.registerCommand("startroute", (...name) => { this.recordRoute = true - this.recentEtherwarps = [] - this.recentMines = [] - this.recentLocations = [] - this.recentInteracts = [] - this.recentTnts = [] + this.recordingData = [] + this.addRecordingPoint() ChatLib.chat(this.FeatureManager.messagePrefix + "Started recording route!") }) this.registerCommand("saveroute", () => { let data = { index: this.fullRoomData[this.idMap.get(this.lastRoomId)].index, - etherwarps: this.recentEtherwarps.map(ether => this.fromRoomCoordinates(ether.loc.x - 0.5, ether.loc.y, ether.loc.z - 0.5)), - mines: this.recentMines.map(ether => this.fromRoomCoordinates(ether.loc.x - 0.5, ether.loc.y, ether.loc.z - 0.5)), - locations: this.recentLocations.map(ether => this.fromRoomCoordinates(ether.loc[0], ether.loc[1], ether.loc[2])), - interacts: this.recentInteracts.map(ether => this.fromRoomCoordinates(ether.loc.x - 0.5, ether.loc.y, ether.loc.z - 0.5)), - tnts: this.recentTnts.map(ether => this.fromRoomCoordinates(ether.loc.x - 0.5, ether.loc.y, ether.loc.z - 0.5)), + data: this.recordingData.map(a => { + a.etherwarps = a.etherwarps.map(a => this.fromRoomCoordinates(a[0] + 0.5, a[1], a[2] + 0.5)) + a.mines = a.mines.map(a => this.fromRoomCoordinates(a[0] + 0.5, a[1], a[2] + 0.5)) + a.locations = a.locations.map(a => this.fromRoomCoordinates(...a)) + a.interacts = a.interacts.map(b => { + b.pos = this.fromRoomCoordinates(...b.pos) + return b + }) + a.tnts = a.tnts.map(a => this.fromRoomCoordinates(a[0] + 0.5, a[1], a[2] + 0.5)) + + return a + }) } + // this.recordingData.push({ + // etherwarps: [], + // mines: [], + // locations: [], + // interacts: [], + // tnts: [] + // }) ChatLib.chat(JSON.stringify(data, undefined, 4)) ChatLib.chat(this.FeatureManager.messagePrefix + "Saved route!") this.recordRoute = false }) + + this.registerStep(true, 5, () => { + if (this.currRoomData) { + if (this.currentRouteDisplay) { + // this.currentRouteDisplay.etherwarps.forEach(loc => { + // let coords = this.toRoomCoordinates(loc[0], loc[1] - 1, loc[2]) + // drawFilledBox(coords[0] + 0.5, coords[1], coords[2] + 0.5, 1, 1, 1, 0, 0, 50 / 255, true) + // drawBoxAtBlock(coords[0], coords[1], coords[2], 1, 0, 0, 1, 1, 1) + // }) + // this.currentRouteDisplay.mines.forEach(loc => { + // let coords = this.toRoomCoordinates(loc[0], loc[1] - 1, loc[2]) + // drawFilledBox(coords[0] + 0.5, coords[1] + 0.5, coords[2] + 0.5, 1, 1, 0, 255, 0, 50 / 255, true) + // }) + // this.currentRouteDisplay.tnts.forEach(loc => { + // let coords = this.toRoomCoordinates(loc[0], loc[1] - 1, loc[2]) + // drawFilledBox(coords[0] + 0.5, coords[1] + 0.5, coords[2] + 0.5, 1, 1, 255, 0, 0, 50 / 255, true) + // }) + // this.currentRouteDisplay.interacts.forEach(loc => { + // let coords = this.toRoomCoordinates(loc[0], loc[1], loc[2]) + // drawFilledBox(coords[0] + 0.5, coords[1], coords[2] + 0.5, 1, 1, 0, 0, 1, 50 / 255, true) + // drawBoxAtBlock(coords[0], coords[1], coords[2], 0, 0, 1, 1, 1, 1) + // }) + + if (this.currentRouteDisplay[this.currentActionIndex].locations.length >= 2) this.drawLineMultipleParticles(this.currentRouteDisplay[this.currentActionIndex].locations.map(a => this.toRoomCoordinates(a[0], a[1], a[2]))) + + } + } + }) + } + + addRecordingPoint(type, point) { + if (type) { + this.recordingData[this.recordingData.length - 1][type].push(point) + } + if (!type || type === "interact") { + this.recordingData.push({ + etherwarps: [], + mines: [], + locations: [], + interacts: [], + tnts: [] + }) + } + } + drawLineMultipleParticles(locations) { + let lastLoc = undefined + locations.forEach(loc => { + if (!lastLoc) { + lastLoc = loc + return + } + + this.drawLineParticles(lastLoc, loc) + lastLoc = loc + }) + } + + drawLineParticles(loc1, loc2) { + let distance = Math.hypot(...loc1.map((a, i) => a - loc2[i])) + let maxPoints = Math.ceil(distance * 1) + for (let i = 0; i < maxPoints; i++) { + let actualI = i + Math.random() + let a = actualI / maxPoints + let loc = [loc1[0] * a + loc2[0] * (1 - a) - 0.5, loc1[1] * a + loc2[1] * (1 - a) + 0.1, loc1[2] * a + loc2[2] * (1 - a) - 0.5] + + let a2 = (actualI + 0.02) / maxPoints + let loc3 = [loc1[0] * a2 + loc2[0] * (1 - a2) - 0.5, loc1[1] * a2 + loc2[1] * (1 - a2) + 0.1, loc1[2] * a2 + loc2[2] * (1 - a2) - 0.5] + loc3 = loc3.map((a, i) => loc[i] - a) + + this.spawnParticleAtLocation(loc, loc3, "FLAME") + } + } + + spawnParticleAtLocation(loc, velo, particle) { + let particleType = EnumParticleTypes.valueOf(particle); + let idField = particleType.getClass().getDeclaredField('field_179372_R'); + idField.setAccessible(true); + let id = idField.get(particleType); + + Client.getMinecraft().field_71438_f.func_174974_b( + id, // particleID + true, // shouldIgnoreRange + loc[0], // x + loc[1], // y + loc[2], // z + velo[0], // speedX + velo[1], // speedY + velo[2], // speedZ + ); } toRoomCoordinates(x, y, z) { //From relative coords to world coords @@ -208,14 +305,14 @@ class DungeonRoutes extends Feature { if (this.getTopBlockAt(x + width, y + height, roofY) === 11) return 3 if (this.getTopBlockAt(x, y + height, roofY) === 11) return 4 } else { - let one = this.getTopBlockAt(x + width / 2 + 1, y + height / 2, roofY) - let two = this.getTopBlockAt(x + width / 2 - 1, y + height / 2, roofY) - let three = this.getTopBlockAt(x + width / 2, y + height / 2 + 1, roofY) - let four = this.getTopBlockAt(x + width / 2, y + height / 2 - 1, roofY) + let one = this.getTopBlockAt2(x + width / 2 + 1, y + height / 2, roofY) + let two = this.getTopBlockAt2(x + width / 2 - 1, y + height / 2, roofY) + let three = this.getTopBlockAt2(x + width / 2, y + height / 2 + 1, roofY) + let four = this.getTopBlockAt2(x + width / 2, y + height / 2 - 1, roofY) if (one === 0 && three === 0) return 1 if (two === 0 && three === 0) return 2 - if (one === 0 && three === 0) return 3 + if (one === 0 && four === 0) return 3 if (two === 0 && four === 0) return 4 } @@ -251,6 +348,17 @@ class DungeonRoutes extends Feature { while (World.getBlockStateAt(new BlockPos(x + width, roofY, y + height + 1)).getBlockId() !== 0) { //second iteration incase of L shape height += 32 } + while (World.getBlockStateAt(new BlockPos(x + width + 1, roofY, y + height)).getBlockId() !== 0) { //second iteration incase of L shape + width += 32 + } + while (World.getBlockStateAt(new BlockPos(x + width, roofY, y - 1)).getBlockId() !== 0) {//second iteration incase of L shape + y -= 32 + height += 32 + } + while (World.getBlockStateAt(new BlockPos(x - 1, roofY, y + height)).getBlockId() !== 0) { //third iteration incase of L shape + x -= 32 + width += 32 + } return { @@ -276,6 +384,11 @@ class DungeonRoutes extends Feature { return World.getBlockStateAt(new BlockPos(x, y, z)).getMetadata() } + getTopBlockAt2(x, z, y) { + if (!y) y = this.getHeightAt(x, z) + + return World.getBlockStateAt(new BlockPos(x, y, z)).getBlockId() + } getCurrentRoomData() { let roomId = this.idMap.get(this.getCurrentRoomId()) @@ -291,11 +404,7 @@ class DungeonRoutes extends Feature { } worldLoad() { - this.recentEtherwarps = [] - this.recentMines = [] - this.recentLocations = [] - this.recentInteracts = [] - this.recentTnts = [] + } entityJoinWorldEvent(event) { @@ -315,7 +424,7 @@ class DungeonRoutes extends Feature { if (packetType === "S0DPacketCollectItem") { let pos = this.tempItemIdLocs.get(packet[m.getCollectedItemEntityID]()) - if (pos) this.recentInteracts.push({ loc: pos, id: this.actionId++ }) + if (pos) this.addRecordingPoint("interacts", { loc: pos, type: "item" }) } } @@ -328,29 +437,30 @@ class DungeonRoutes extends Feature { let id = Player.lookingAt().getType().getID() if (id !== 54 && id !== 144 && id !== 69) return - this.recentInteracts.push({ loc: pos, id: this.actionId++ }) + this.addRecordingPoint("interacts", { loc: pos, type: "interact" }) } playSound(pos, name, volume, pitch, categoryName, event) { if (!this.recordRoute) return + let loc = [pos.x, pos.y, pos.z] let nameSplitted = name.split(".") if (name === "mob.enderdragon.hit") { //etherwarp - this.recentEtherwarps.push({ loc: pos, id: this.actionId++ }) + this.addRecordingPoint("etherwarps", loc) } if (name === "random.explode" && pitch !== 1) { //tnt OR MIGHT BE spirit scepter - this.recentTnts.push({ loc: pos, id: this.actionId++ }) + this.addRecordingPoint("tnts", loc) } if (name === "mob.bat.death") { - this.recentInteracts.push({ loc: pos, id: this.actionId++ }) + this.addRecordingPoint("interacts", { loc: loc, type: "bat" }) } if (nameSplitted[0] === "dig") { //mining block - if (!this.recentMines.some(a => - a.loc.x === pos.x - && a.loc.y === pos.y - && a.loc.z === pos.z + if (!this.recordingData[this.recordingData.length - 1].mines.some(a => + a[0] === pos[0] + && a[1] === pos[1] + && a[2] === pos[2] )) { - this.recentMines.push({ loc: pos, id: this.actionId++ }) + this.addRecordingPoint("mines", loc) } } } diff --git a/features/dungeonRoutes/routesData.json b/features/dungeonRoutes/routesData.json index 2a6db6c..ed64acf 100644 --- a/features/dungeonRoutes/routesData.json +++ b/features/dungeonRoutes/routesData.json @@ -1,6200 +1,353 @@ [ { - "index": 0, - "etherwarps": [ - [ - -8, - 76, - 14 - ], - [ - -13, - 71, - 5 - ], - [ - 13, - 73, - 9 - ] + "index": 86, + "data": [ + { + "etherwarps": [ + [ + 10.5, + 82, + -20.5 + ], + [ + 8.5, + 82, + 19.5 + ], + [ + 12.5, + 93, + 21.5 + ] + ], + "mines": [ + [ + 4.5, + 82.5, + -19.5 + ] + ], + "locations": [ + [ + 18, + 69, + -25 + ], + [ + 16, + 69, + -24 + ], + [ + 15, + 69, + -24 + ], + [ + 14, + 69, + -24 + ], + [ + 14, + 67, + -24 + ], + [ + 14, + 64, + -24 + ], + [ + 14, + 61, + -24 + ], + [ + 11, + 82, + -20 + ], + [ + 10, + 82, + -20 + ], + [ + 9, + 82, + -20 + ], + [ + 8, + 82, + -19 + ], + [ + 7, + 82, + -19 + ], + [ + 6, + 82, + -19 + ], |
