diff options
-rw-r--r-- | src/features/bestiary/index.js | 67 | ||||
-rw-r--r-- | src/metadata.json | 4 |
2 files changed, 68 insertions, 3 deletions
diff --git a/src/features/bestiary/index.js b/src/features/bestiary/index.js index 14c00b1..0aa34c6 100644 --- a/src/features/bestiary/index.js +++ b/src/features/bestiary/index.js @@ -2,6 +2,7 @@ /// <reference lib="es2015" /> import Feature from "../../featureClass/class"; import { numberWithCommas } from "../../utils/numberUtils"; +import { drawBoxAtEntity } from "../../utils/renderUtils"; import { getBestiaryTier } from "../../utils/statUtils"; import { firstLetterWordCapital } from "../../utils/stringUtils"; import HudTextElement from "../hud/HudTextElement"; @@ -20,6 +21,12 @@ dontUseApi.add("magma_cube_boss") dontUseApi.add("headless_horseman") dontUseApi.add("dragon") +const EntityArmorStand = Java.type("net.minecraft.entity.item.EntityArmorStand") +const EntityPlayer = Java.type("net.minecraft.entity.player.EntityPlayer") +const EntityCaveSpider = Java.type("net.minecraft.entity.monster.EntityCaveSpider") +const EntitySkeleton = Java.type("net.minecraft.entity.monster.EntitySkeleton") +const EntitySpider = Java.type("net.minecraft.entity.monster.EntitySpider") +const EntityCreeper = Java.type("net.minecraft.entity.monster.EntityCreeper") class Bestiary extends Feature { constructor() { @@ -28,6 +35,8 @@ class Bestiary extends Feature { onEnable() { + this.bestiaryMobBox = new ToggleSetting("Box around bestiary mobs", "", false, "bestiary_box", this) + this.bestiaryStatTypes = { "barbarian_duke_x": "Barbarian Duke X" } @@ -106,10 +115,66 @@ class Bestiary extends Feature { } }) this.registerSoopy("apiLoad", this.apiLoad); + this.registerEvent("renderWorld", this.renderWorld) if (this.FeatureManager.features["dataLoader"].class.lastApiData.skyblock_raw) { this.apiLoad(this.FeatureManager.features["dataLoader"].class.lastApiData.skyblock_raw, "skyblock", false, true); } + + this.boxRendEs = [] + + this.registerStep(true, 1, this.updateMobs) + } + + updateMobs() { + this.boxRendEs = [] + + let entities = World.getAllEntitiesOfType(EntityArmorStand) + for (let entity of entities) { + let name = entity.getName() + let mcEntity = entity.entity + let entityClass = null + + let color = [0, 100, 100] + if (name.includes("Butterfly")) { + } else if (name.includes("Matcho")) { + entityClass = EntityPlayer + color = [75, 0, 130] + } else if (name.includes("Brood Mother")) { + entityClass = EntitySpider + color = [0, 0, 255] + } else if (name.includes("Arachne Keeper")) { + entityClass = EntityCaveSpider + color = [0, 0, 255] + } else if (name.includes("Sneaky Creeper")) { + entityClass = EntityCreeper + color = [0, 255, 0] + } else if (name.includes("Wither Skeleton")) { + entityClass = EntitySkeleton + color = [255, 255, 255] + } else { + // exit if no relevant name is detected + continue + } + // Get a list of entities near the detected armor stand and loop through them + let entityList = World.getWorld().func_72839_b(mcEntity, mcEntity.func_174813_aQ().func_72317_d(0, -1, 0)) + entityList.forEach((e) => { + // never highlight the player + if (e == Client.getMinecraft().field_71439_g) return + + // if we didn't specify a class to look for, highlight anything + // otherwise, check if it is the class + if (entityClass == null || e instanceof entityClass) { + this.boxRendEs.push([new Entity(e), color]) + } + }) + } + } + + renderWorld(ticks) { + for (let data of this.boxRendEs) { + drawBoxAtEntity(data[0], data[1][0], data[1][1], data[1][2], null, null, ticks) + } } getBestiaryCount(id) { @@ -191,4 +256,4 @@ class Bestiary extends Feature { } module.exports = { class: new Bestiary() -} +}
\ No newline at end of file diff --git a/src/metadata.json b/src/metadata.json index b251f46..7a0f74f 100644 --- a/src/metadata.json +++ b/src/metadata.json @@ -5,8 +5,8 @@ "entry": "index.js", "description": "SoopyV2", "name": "SoopyV2", - "version": "2.1.175", - "versionId": 302, + "version": "2.1.176", + "versionId": 303, "requires": [ "soopyApis", "soopyAddonsData", |