aboutsummaryrefslogtreecommitdiff
path: root/features
diff options
context:
space:
mode:
authorSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2022-01-29 06:56:21 +0800
committerSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2022-01-29 06:56:21 +0800
commit42b7d4ff248e3832c792d37034fad076861dac28 (patch)
tree62d9bcc1e3525d3721d606a0960521c8e5fee2a5 /features
parentdc4a2cb096b3fd7ddb7d133853f6a5436026b2ca (diff)
downloadSoopyV2-42b7d4ff248e3832c792d37034fad076861dac28.tar.gz
SoopyV2-42b7d4ff248e3832c792d37034fad076861dac28.tar.bz2
SoopyV2-42b7d4ff248e3832c792d37034fad076861dac28.zip
blaze solver + make spotify box go to width of the max scroll + normalise text on spotify overlay so it doesent render an invalid caracter when the text has a dialect or something
Diffstat (limited to 'features')
-rw-r--r--features/dungeonSolvers/index.js140
-rw-r--r--features/hud/HudTextElement.js19
-rw-r--r--features/hud/index.js3
-rw-r--r--features/settings/settingThings/location.js10
4 files changed, 161 insertions, 11 deletions
diff --git a/features/dungeonSolvers/index.js b/features/dungeonSolvers/index.js
index 2d47441..c7eb329 100644
--- a/features/dungeonSolvers/index.js
+++ b/features/dungeonSolvers/index.js
@@ -4,10 +4,15 @@ import { f, m } from "../../../mappings/mappings";
import Feature from "../../featureClass/class";
import { numberWithCommas } from "../../utils/numberUtils";
import * as renderUtils from "../../utils/renderUtils";
+import { drawLine } from "../../utils/renderUtils";
import HudTextElement from "../hud/HudTextElement";
import LocationSetting from "../settings/settingThings/location";
import ToggleSetting from "../settings/settingThings/toggle";
+const EntityArrow = Java.type("net.minecraft.entity.projectile.EntityArrow")
+const EntityBlaze = Java.type("net.minecraft.entity.monster.EntityBlaze")
+const AxisAlignedBB = Java.type("net.minecraft.util.AxisAlignedBB")
+
class DungeonSolvers extends Feature {
constructor() {
super();
@@ -54,6 +59,8 @@ class DungeonSolvers extends Feature {
this.hudElements.push(this.runSpeedRatesElement);
+ this.blazeSolver = new ToggleSetting("Blaze Puzzle Solver", "Shows what order to kill the blazes in", true, "blaze_solver", this);
+
this.lastDungFinishes = [];
this.lastDungExps = [];
this.registerChat("${start}+&r&3${exp} Catacombs Experience&r", (start, exp) => {
@@ -101,6 +108,11 @@ class DungeonSolvers extends Feature {
this.ping = 0;
this.pingI = 0;
+ this.arrows = []
+ this.blazes = []
+ this.blazeX = -1;
+ this.blazeY = -1;
+
this.registerStep(true, 2, this.step);
this.registerStep(true, 10, this.step2);
this.registerEvent("worldLoad", this.onWorldLoad);
@@ -126,10 +138,20 @@ class DungeonSolvers extends Feature {
this.registerForge(net.minecraftforge.event.entity.EntityJoinWorldEvent, this.entityJoinWorldEvent);
// this.registerEvent("renderEntity", this.renderEntity)
this.renderEntityEvent = undefined;
+
+ this.onWorldLoad();
}
entityJoinWorldEvent(event) {
if (this.bloodCampAssist.getValue()) this.todoE.push(event.entity);
+
+ // if(event.entity instanceof EntityArrow){
+ // this.arrows.push(new Entity(event.entity))
+ // }
+ if(event.entity instanceof EntityBlaze){
+ console.log("Blaze joined world")
+ this.addBlaze(new Entity(event.entity))
+ }
}
renderWorld(ticks) {
@@ -174,6 +196,18 @@ class DungeonSolvers extends Feature {
}
});
}
+
+ if(this.blazeX !== -1 && this.blazes.length > 0){
+ renderUtils.drawBoxAtEntity(this.blazes[0], 255, 0, 0, 1, 2, ticks, 2)
+
+ let lastLoc = [this.blazes[0].getX(), this.blazes[0].getY()+1.5, this.blazes[0].getZ()]
+ this.blazes.forEach((blaze, i) => {
+ if(i<3 && i!==0){
+ drawLine(lastLoc[0], lastLoc[1], lastLoc[2], blaze.getX(), blaze.getY()+1.5, blaze.getZ(), i===1?0:255, i===1?255:0, 0, 3/i)
+ lastLoc = [blaze.getX(), blaze.getY()+1.5,blaze.getZ()]
+ }
+ })
+ }
}
renderEntity(entity, position, ticks, event) {
@@ -205,12 +239,22 @@ class DungeonSolvers extends Feature {
this.eMovingThing = {};
this.bloodX = -1;
this.bloodY = -1;
+ this.blazeX = -1;
+ this.blazeY = -1;
this.skulls = [];
+ this.arrows = []
+ this.blazes = []
World.getAllEntitiesOfType(net.minecraft.entity.item.EntityArmorStand).forEach((e) => {
- if (e.getEntity()[m.getEquipmentInSlot](4) && e.getEntity()[m.getEquipmentInSlot](4)[m.getDisplayName.ItemStack]().endsWith("Head")) {
- this.addSkull(e);
- }
+ if (e.getEntity()[m.getEquipmentInSlot](4) && e.getEntity()[m.getEquipmentInSlot](4)[m.getDisplayName.ItemStack]().endsWith("Head")) {
+ this.addSkull(e);
+ }
+ });
+ World.getAllEntitiesOfType(EntityBlaze).forEach((e) => {
+ this.addBlaze(e)
});
+ // World.getAllEntitiesOfType(EntityArrow).forEach((e) => {
+ // this.arrows.push(e)
+ // });
}
step2() {
@@ -282,6 +326,52 @@ class DungeonSolvers extends Feature {
}
});
}
+
+ if(this.blazeX !== -1){
+ this.blazes = this.blazes.filter(e=>!e.getEntity()[f.isDead])
+
+ this.blazes.sort((a, b)=>a.getEntity().func_110143_aJ()-b.getEntity().func_110143_aJ())
+ if(World.getBlockAt(this.blazeX+17, 18, this.blazeY+16).getType().getID() === 9){
+ this.blazes = this.blazes.reverse()
+ }
+ }
+
+ // this.arrows = this.arrows.filter(e=>{
+ // let x = e.getX()
+ // let y = e.getY()
+ // let z = e.getZ()
+
+ // let mX = e.getMotionX()
+ // let mY = e.getMotionY()
+ // let mZ = e.getMotionZ()
+
+ // for(let i = 0;i<100;i++){
+ // x+=mX
+ // y+=mY
+ // z+=mZ
+
+ // mX*=0.99
+ // mY*=0.99
+ // mZ*=0.99
+
+ // mY-=0.05
+
+ // this.blazes = this.blazes.filter(e1=>{
+ // let boundingBox = e1.getEntity().func_174813_aQ()
+
+ // if(boundingBox.intersectsWith(new AxisAlignedBB(x-e.getEntity().field_70130_N/2,y,z-e.getEntity().field_70130_N/2,x+e.getEntity().field_70130_N/2,y+e.getEntity().field_70131_O,z+e.getEntity().field_70130_N/2))){
+ // return false
+ // }
+ // return true
+ // })
+
+ // if(World.getBlockAt(x, y, z).getType().getID() !== 0){
+ // break;
+ // }
+ // }
+
+ // return !e.getEntity()[f.isDead]
+ // })
}
addSkull(skull) {
@@ -306,6 +396,50 @@ class DungeonSolvers extends Feature {
this.skulls.push(skull);
}
+ addBlaze(blaze){
+ if(!this.FeatureManager.features["dataLoader"].class.dungeonFloor) return
+ if(this.blazeX === -1){
+ this.blazes.push(blaze)
+ let locs = {}
+
+ this.blazes.forEach(b=>{
+ if(!locs[(b.getX()-b.getX()%32)+"_"+(b.getZ()-b.getZ()%32)])locs[(b.getX()-b.getX()%32)+"_"+(b.getZ()-b.getZ()%32)] = 0
+ locs[(b.getX()-b.getX()%32)+"_"+(b.getZ()-b.getZ()%32)]++
+ })
+
+ Object.keys(locs).forEach(k=>{
+ if(locs[k] === 4){
+ [this.blazeX, this.blazeY] = k.split("_").map(a=>~~a)
+ }
+ })
+
+ if(this.blazeX !== -1){
+ this.blazes = []
+ World.getAllEntitiesOfType(EntityBlaze).forEach((e)=>{
+ if(e.getX()-e.getX()%32 === this.blazeX && e.getZ()-e.getZ()%32 === this.blazeY){
+ this.blazes.push(e)
+ }
+ })
+ }
+ }else{
+ if(blaze.getX()-blaze.getX()%32 === this.blazeX && blaze.getZ()-blaze.getZ()%32 === this.blazeY){
+ this.blazes.push(blaze)
+ this.blazes.sort((a, b)=>a.getEntity().func_110143_aJ()-b.getEntity().func_110143_aJ())
+ if(World.getBlockAt(this.blazeX+17, 18, this.blazeY+16).getType().getID() === 9){
+ this.blazes = this.blazes.reverse()
+ }
+
+ let lastHp = -1
+ this.blazes.forEach(b=>{
+ if(b.getEntity().func_110143_aJ() === lastHp){
+ ChatLib.chat(this.FeatureManager.messagePrefix + "&cWARNING: Detected 2 blazes with the same hp.")
+ }
+ lastHp = b.getEntity().func_110143_aJ()
+ })
+ }
+ }
+ }
+
step() {
//2fps
if (this.lividFindEnabled.getValue() && (this.FeatureManager.features["dataLoader"].class.dungeonFloor === "F5" || this.FeatureManager.features["dataLoader"].class.dungeonFloor === "M5")) {
diff --git a/features/hud/HudTextElement.js b/features/hud/HudTextElement.js
index 5599b5c..8177c43 100644
--- a/features/hud/HudTextElement.js
+++ b/features/hud/HudTextElement.js
@@ -10,9 +10,22 @@ class HudTextElement{
this.editTempTimeV = 0
this.editTempTextV = undefined
+ this.editBaseWidth = undefined
+ this.editBaseHeight = undefined
+
this.tempDisableTime = 0
}
+ setBaseEditWidth(width){
+ this.editBaseWidth = width
+ return this
+ }
+
+ setBaseEditHeight(height){
+ this.editBaseHeight = height
+ return this
+ }
+
setText(text){
this.text = text
@@ -42,10 +55,12 @@ class HudTextElement{
this.renderRaw()
}
- getWidth(){
+ getWidth(locationBox=false){
+ if(locationBox && this.editBaseWidth) return this.editBaseWidth
return Math.max(...(this.getText()[0].map(a=>Renderer.getStringWidth(ChatLib.removeFormatting(a)))))
}
- getHeight(){
+ getHeight(locationBox=false){
+ if(locationBox && this.editBaseHeight) return this.editBaseHeight
return 9*this.getText()[0].length
}
diff --git a/features/hud/index.js b/features/hud/index.js
index accd1ef..d256d41 100644
--- a/features/hud/index.js
+++ b/features/hud/index.js
@@ -113,6 +113,7 @@ class Hud extends Feature {
this.showSpotifyPlaying = new ToggleSetting("Show Current Playing Spotify Song", "(Only tested with spotify from windows store)", false, "spotify_now_playing", this)
this.spotifyElement = new HudTextElement()
.setText("&6Spotify&7> ")
+ .setBaseEditWidth(Renderer.getStringWidth("Spotify> ")+150)
.setToggleSetting(this.showSpotifyPlaying)
.setLocationSetting(new LocationSetting("Spotify Location", "Allows you to edit the location of the spotify text", "spotify_now_playing_location", this, [10, 80, 1, 1])
.requires(this.showSpotifyPlaying)
@@ -527,7 +528,7 @@ class Hud extends Feature {
process.waitFor();
}
- this.spotifyElement2.setText(currentSong)
+ this.spotifyElement2.setText(currentSong.normalize("NFD").replace(/[\u0300-\u036f]/g, ""))
}
updateHudThingos(){
diff --git a/features/settings/settingThings/location.js b/features/settings/settingThings/location.js
index 9655764..b158e03 100644
--- a/features/settings/settingThings/location.js
+++ b/features/settings/settingThings/location.js
@@ -166,7 +166,7 @@ class LocationSetting extends ButtonSetting {
clicked(mouseX, mouseY){
let width = this.getWidth()
- let height = this.parent.getHeight()
+ let height = this.parent.getHeight(true)
let locations = [[this.x, this.y], [this.x+width*this.scale, this.y], [this.x, this.y+height*this.scale], [this.x+width*this.scale, this.y+height*this.scale]]
@@ -195,12 +195,12 @@ class LocationSetting extends ButtonSetting {
}
getWidth(){
- return this.parent.getWidth()
+ return this.parent.getWidth(true)
}
updateLocation(mouseX, mouseY, drawCollidingBox){
let width = this.getWidth()
- let height = this.parent.getHeight()
+ let height = this.parent.getHeight(true)
if(this.dragging){
this.x = mouseX+this.dragOffset[0]
@@ -283,7 +283,7 @@ class LocationSetting extends ButtonSetting {
}
let width = this.getWidth()
- let height = this.parent.getHeight()
+ let height = this.parent.getHeight(true)
this.updateLocation(mouseX, mouseY, true)
@@ -313,7 +313,7 @@ class LocationSetting extends ButtonSetting {
renderBox(drawHandles){
let width = this.getWidth()
- let height = this.parent.getHeight()
+ let height = this.parent.getHeight(true)
Renderer.drawRect(Renderer.color(255, 255, 255), this.x, this.y, width*this.scale, 1)
Renderer.drawRect(Renderer.color(255, 255, 255), this.x, this.y, 1, height*this.scale)