aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--features/cosmetics/index.js146
-rw-r--r--features/dungeonRoutes/index.js57
-rw-r--r--features/dungeonRoutes/metadata.json2
-rw-r--r--features/dungeonSolvers/index.js2
-rw-r--r--utils/renderUtils.js20
5 files changed, 142 insertions, 85 deletions
diff --git a/features/cosmetics/index.js b/features/cosmetics/index.js
index 98a848e..ffe25dc 100644
--- a/features/cosmetics/index.js
+++ b/features/cosmetics/index.js
@@ -12,14 +12,14 @@ class Cosmetics extends Feature {
super()
}
- onEnable(){
+ onEnable() {
this.initVariables()
this.loadedCosmetics = []
this.uuidToCosmetic = {}
this.uuidToCosmeticDirect = {}
this.cosmeticsData = {}
-
+
this.hiddenEssentialCosmetics = []
this.cosmeticsList = {
@@ -32,7 +32,7 @@ class Cosmetics extends Feature {
this.lessFirstPersonVisable = new Toggle("Make cosmetics less visable in first person mode", "", true, "cosmetics_first_person_less_visable", this).requires(this.firstPersonVisable)
this.ownCosmeticAudio = new Toggle("Audio for own cosmetics", "", false, "cosmetics_own_audio", this)
- this.dragon_wings_enabled = new Toggle("Dragon Wings Toggle", "", true, "cosmetic_dragon_wings_toggle", this).requires(new FakeRequireToggle(false)).onchange(this, ()=>{
+ this.dragon_wings_enabled = new Toggle("Dragon Wings Toggle", "", true, "cosmetic_dragon_wings_toggle", this).requires(new FakeRequireToggle(false)).onchange(this, () => {
global.soopyV2Server.updateCosmeticsData({
cosmetic: "dragon_wings",
type: this.dragon_wings_enabled.getValue() ? "enable" : "disable"
@@ -51,8 +51,8 @@ class Cosmetics extends Feature {
this.registerEvent("playerLeft", this.playerLeft)
this.registerEvent("worldLoad", this.worldLoad)
this.registerStep(false, 2, this.step)
- this.registerEvent('gameUnload', ()=>{
- if(this.postRenderEntityTrigger){
+ this.registerEvent('gameUnload', () => {
+ if (this.postRenderEntityTrigger) {
this.postRenderEntityTrigger.unregister()
this.postRenderEntityTrigger = undefined
}
@@ -62,38 +62,38 @@ class Cosmetics extends Feature {
// })
// this.registerEvent("renderEntity", this.renderEntity)
- if(global.soopyV2Server && global.soopyV2Server.userCosmeticPermissions){
+ if (global.soopyV2Server && global.soopyV2Server.userCosmeticPermissions) {
this.updateUserCosmeticPermissionSettings()
}
}
- updateUserCosmeticPermissionSettings(){
- if(!this.enabled) return
+ updateUserCosmeticPermissionSettings() {
+ if (!this.enabled) return
- if(global.soopyV2Server.userCosmeticPermissions === "*" || global.soopyV2Server.userCosmeticPermissions.dragon_wings){
+ if (global.soopyV2Server.userCosmeticPermissions === "*" || global.soopyV2Server.userCosmeticPermissions.dragon_wings) {
this.dragon_wings_enabled.requiresO.set(true)
- }else{
+ } else {
this.dragon_wings_enabled.requiresO.set(false)
}
}
- renderWorld(ticks){
- for(let i = 0;i<this.loadedCosmetics.length;i++){
+ renderWorld(ticks) {
+ for (let i = 0; i < this.loadedCosmetics.length; i++) {
this.loadedCosmetics[i].onRenderEntity(ticks, false)
}
}
- loadCosmeticsData(){
- fetch("http://soopymc.my.to/api/soopyv2/cosmetics.json").json(data=>{
+ loadCosmeticsData() {
+ fetch("http://soopymc.my.to/api/soopyv2/cosmetics.json").json(data => {
this.cosmeticsData = data
- this.playerHasACosmeticA = !!data[Player.getUUID().toString().replace(/-/g,"")]
- if(this.playerHasACosmeticA && !this.postRenderEntityTrigger){
+ this.playerHasACosmeticA = !!data[Player.getUUID().toString().replace(/-/g, "")]
+ if (this.playerHasACosmeticA && !this.postRenderEntityTrigger) {
// this.registerEvent("postRenderEntity", this.renderEntity)
- this.postRenderEntityTrigger = register("postRenderEntity", (entity, pos, ticks, event)=>{
- if(ticks !== 1) return
- if(this.uuidToCosmeticDirect[entity.getUUID().toString().replace(/-/g,"")]){
- let cosmetics = Object.values(this.uuidToCosmeticDirect[entity.getUUID().toString().replace(/-/g,"")])
- for(let cosmetic of cosmetics){
+ this.postRenderEntityTrigger = register("postRenderEntity", (entity, pos, ticks, event) => {
+ if (ticks !== 1) return
+ if (this.uuidToCosmeticDirect[entity.getUUID().toString().replace(/-/g, "")]) {
+ let cosmetics = Object.values(this.uuidToCosmeticDirect[entity.getUUID().toString().replace(/-/g, "")])
+ for (let cosmetic of cosmetics) {
cosmetic.onRenderEntity(ticks, true)
}
}
@@ -104,68 +104,68 @@ class Cosmetics extends Feature {
})
}
- setUserCosmeticsInformation(uuid, cosmetics){
- if(!this.enabled) return
- uuid = uuid.replace(/-/g,"")
+ setUserCosmeticsInformation(uuid, cosmetics) {
+ if (!this.enabled) return
+ uuid = uuid.replace(/-/g, "")
- this.loadedCosmetics = this.loadedCosmetics.filter(cosmetic=>{
- if(cosmetic.player.getUUID().toString().replace(/-/g,"") === uuid){
+ this.loadedCosmetics = this.loadedCosmetics.filter(cosmetic => {
+ if (cosmetic.player.getUUID().toString().replace(/-/g, "") === uuid) {
return false
}
return true
})
- Object.keys(this.uuidToCosmetic).forEach(cosmeticName=>{
+ Object.keys(this.uuidToCosmetic).forEach(cosmeticName => {
delete this.uuidToCosmetic[cosmeticName][uuid]
})
delete this.uuidToCosmeticDirect[uuid]
- if(!cosmetics){
+ if (!cosmetics) {
delete this.cosmeticsData[uuid]
return
}
this.cosmeticsData[uuid] = cosmetics
-
+
this.scanForNewCosmetics()
}
- step(){
+ step() {
this.scanForNewCosmetics()
this.filterUnloadedCosmetics(false)
this.restoreEssentialCosmetics()
- this.loadedCosmetics.forEach(c=>{
+ this.loadedCosmetics.forEach(c => {
c.removeEssentialCosmetics()
})
}
- scanForNewCosmetics(){
+ scanForNewCosmetics() {
this.loadCosmeticsForPlayer(Player)
- World.getAllPlayers().forEach(p=>{
- if(p.getUUID().toString().replace(/-/g,"") === Player.getUUID().toString().replace(/-/g,"")) return
+ World.getAllPlayers().forEach(p => {
+ if (p.getUUID().toString().replace(/-/g, "") === Player.getUUID().toString().replace(/-/g, "")) return
this.loadCosmeticsForPlayer(p)
})
}
- loadCosmeticsForPlayer(player){
- Object.keys(this.cosmeticsList).forEach(cosmeticName=>{
- if(!this.uuidToCosmetic[cosmeticName]) this.uuidToCosmetic[cosmeticName] = {}
+ loadCosmeticsForPlayer(player) {
+ Object.keys(this.cosmeticsList).forEach(cosmeticName => {
+ if (!this.uuidToCosmetic[cosmeticName]) this.uuidToCosmetic[cosmeticName] = {}
- if(this.uuidToCosmetic[cosmeticName][player.getUUID().toString().replace(/-/g,"")]) return
+ if (this.uuidToCosmetic[cosmeticName][player.getUUID().toString().replace(/-/g, "")]) return
- if(this.shouldPlayerHaveCosmetic(player, cosmeticName)){
+ if (this.shouldPlayerHaveCosmetic(player, cosmeticName)) {
let cosmetic = new (this.cosmeticsList[cosmeticName])(player, this)
this.loadedCosmetics.push(cosmetic)
- this.uuidToCosmetic[cosmeticName][player.getUUID().toString().replace(/-/g,"")] = cosmetic
-
- if(!this.uuidToCosmeticDirect[player.getUUID.toString()]) this.uuidToCosmeticDirect[player.getUUID().toString().replace(/-/g,"")] = {}
- this.uuidToCosmeticDirect[player.getUUID().toString().replace(/-/g,"")][cosmeticName] = cosmetic
+ this.uuidToCosmetic[cosmeticName][player.getUUID().toString().replace(/-/g, "")] = cosmetic
+
+ if (!this.uuidToCosmeticDirect[player.getUUID.toString()]) this.uuidToCosmeticDirect[player.getUUID().toString().replace(/-/g, "")] = {}
+ this.uuidToCosmeticDirect[player.getUUID().toString().replace(/-/g, "")][cosmeticName] = cosmetic
}
})
}
- worldLoad(){
+ worldLoad() {
this.loadedCosmetics = []
this.uuidToCosmetic = {}
this.uuidToCosmeticDirect = {}
@@ -174,64 +174,64 @@ class Cosmetics extends Feature {
this.scanForNewCosmetics()
}
- playerJoined(player){
- if(player.getUUID().toString().replace(/-/g,"") === Player.getUUID().toString().replace(/-/g,"")) return
-
+ playerJoined(player) {
+ if (player.getUUID().toString().replace(/-/g, "") === Player.getUUID().toString().replace(/-/g, "")) return
+
this.loadCosmeticsForPlayer(player)
}
- playerLeft(playerName){
- this.loadedCosmetics= this.loadedCosmetics.filter(cosmetic=>{
- if(cosmetic.player.getUUID().toString().replace(/-/g,"") === Player.getUUID().toString().replace(/-/g,"")) return true
- if(cosmetic.player.getName() === playerName){
- this.uuidToCosmetic[cosmetic.id][cosmetic.player.getUUID().toString().replace(/-/g,"")] = undefined
-
- this.uuidToCosmeticDirect[cosmetic.player.getUUID().toString().replace(/-/g,"")] = undefined
+ playerLeft(playerName) {
+ this.loadedCosmetics = this.loadedCosmetics.filter(cosmetic => {
+ if (cosmetic.player.getUUID().toString().replace(/-/g, "") === Player.getUUID().toString().replace(/-/g, "")) return true
+ if (cosmetic.player.getName() === playerName) {
+ this.uuidToCosmetic[cosmetic.id][cosmetic.player.getUUID().toString().replace(/-/g, "")] = undefined
+
+ this.uuidToCosmeticDirect[cosmetic.player.getUUID().toString().replace(/-/g, "")] = undefined
return false
}
return true
})
}
- shouldPlayerHaveCosmetic(player, cosmetic){
- if(!!this.cosmeticsData[player.getUUID().toString().replace(/-/g,"")]?.[cosmetic]){
- if(!this.getPlayerCosmeticSettings(player, cosmetic).enabled) return false
+ shouldPlayerHaveCosmetic(player, cosmetic) {
+ if (!!this.cosmeticsData[player.getUUID().toString().replace(/-/g, "")]?.[cosmetic]) {
+ if (!this.getPlayerCosmeticSettings(player, cosmetic).enabled) return false
return true
}
return false
}
- getPlayerCosmeticSettings(player, cosmetic){
- return this.cosmeticsData[player.getUUID().toString().replace(/-/g,"")]?.[cosmetic]
+ getPlayerCosmeticSettings(player, cosmetic) {
+ return this.cosmeticsData[player.getUUID().toString().replace(/-/g, "")]?.[cosmetic]
}
- filterUnloadedCosmetics(tick=false){
+ filterUnloadedCosmetics(tick = false) {
this.loadedCosmetics = this.loadedCosmetics.filter(cosmetic => {
- if(tick) cosmetic.onTick()
- if(cosmetic.player.getUUID().toString().replace(/-/g,"") === Player.getUUID().toString().replace(/-/g,"")) return true
- if(cosmetic.player.getPlayer()[f.isDead]){ //filter out players that are no longer loaded
- this.uuidToCosmetic[cosmetic.id][cosmetic.player.getUUID().toString().replace(/-/g,"")] = undefined
-
- this.uuidToCosmeticDirect[cosmetic.player.getUUID().toString().replace(/-/g,"")] = undefined
+ if (tick) cosmetic.onTick()
+ if (cosmetic.player.getUUID().toString().replace(/-/g, "") === Player.getUUID().toString().replace(/-/g, "")) return true
+ if (cosmetic.player.getPlayer()[f.isDead]) { //filter out players that are no longer loaded
+ this.uuidToCosmetic[cosmetic.id][cosmetic.player.getUUID().toString().replace(/-/g, "")] = undefined
+
+ this.uuidToCosmeticDirect[cosmetic.player.getUUID().toString().replace(/-/g, "")] = undefined
return false
}
return true
})
}
- tick(){
- for(let cosmetic of this.loadedCosmetics){
+ tick() {
+ for (let cosmetic of this.loadedCosmetics) {
cosmetic.onTick()
}
}
- restoreEssentialCosmetics(){
- this.hiddenEssentialCosmetics.forEach(cosmetic=>{
+ restoreEssentialCosmetics() {
+ this.hiddenEssentialCosmetics.forEach(cosmetic => {
cosmetic.isHidden = false
})
this.hiddenEssentialCosmetics = []
}
- initVariables(){
+ initVariables() {
this.loadedCosmetics = undefined
this.uuidToCosmetic = undefined
this.uuidToCosmeticDirect = {}
@@ -242,9 +242,9 @@ class Cosmetics extends Feature {
this.cosmeticsList = undefined
}
- onDisable(){
+ onDisable() {
- if(this.postRenderEntityTrigger){
+ if (this.postRenderEntityTrigger) {
this.postRenderEntityTrigger.unregister()
this.postRenderEntityTrigger = undefined
}
diff --git a/features/dungeonRoutes/index.js b/features/dungeonRoutes/index.js
index 9cfbd88..f2d6757 100644
--- a/features/dungeonRoutes/index.js
+++ b/features/dungeonRoutes/index.js
@@ -1,6 +1,7 @@
/// <reference types="../../../CTAutocomplete" />
/// <reference lib="es2015" />
import Feature from "../../featureClass/class";
+import { drawBoxAtBlock, drawFilledBox, drawLinePoints } from "../../utils/renderUtils";
import SettingBase from "../settings/settingThings/settingBase";
@@ -14,6 +15,62 @@ class DungeonRoutes extends Feature {
new SettingBase("Coming soontm", "maby", undefined, "coming_soontm", this)
return
}
+
+ this.actionId = 0
+
+ this.recentEtherwarps = []
+ this.recentMines = []
+ this.recentLocations = []
+ this.lastLocationUpdatedTime = Date.now()
+
+ this.registerEvent("soundPlay", this.playSound)
+ this.registerEvent("worldLoad", this.worldLoad)
+
+ this.registerStep(true, 5, () => {
+ if (this.recentLocations.length === 0
+ || Math.trunc(Player.getX()) !== this.recentLocations[this.recentLocations.length - 1].loc[0]
+ || Math.trunc(Player.getY()) !== this.recentLocations[this.recentLocations.length - 1].loc[1]
+ || Math.trunc(Player.getZ()) !== this.recentLocations[this.recentLocations.length - 1].loc[2]) {
+
+ this.recentLocations.push({ loc: [Math.trunc(Player.getX()), Math.trunc(Player.getY()), Math.trunc(Player.getZ())], id: this.actionId++ })
+
+ if (this.recentLocations.length > 50) this.recentLocations.shift()
+ }
+ })
+
+ 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)
+ })
+ 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, true)
+ })
+ }
+
+ worldLoad() {
+ this.recentEtherwarps = []
+ this.recentMines = []
+ }
+
+ playSound(pos, name, volume, pitch, categoryName, event) {
+ let nameSplitted = name.split(".")
+ if (name === "mob.enderdragon.hit") { //etherwarp
+ this.recentEtherwarps.push({ loc: pos, id: this.actionId++ })
+ if (this.recentEtherwarps.length > 10) this.recentEtherwarps.shift()
+ }
+ 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
+ )) {
+ this.recentMines.push({ loc: pos, id: this.actionId++ })
+ if (this.recentMines.length > 10) this.recentMines.shift()
+ }
+ }
}
onDisable() {
diff --git a/features/dungeonRoutes/metadata.json b/features/dungeonRoutes/metadata.json
index 783bdd8..c2f2a63 100644
--- a/features/dungeonRoutes/metadata.json
+++ b/features/dungeonRoutes/metadata.json
@@ -1,7 +1,7 @@
{
"name": "Dungeon Routes",
"description": "Routes for dungeons (Coming soontm maby)",
- "isHidden": true,
+ "isHidden": false,
"isTogglable": true,
"defaultEnabled": true,
"sortA": 0
diff --git a/features/dungeonSolvers/index.js b/features/dungeonSolvers/index.js
index 02e59cb..898dbda 100644
--- a/features/dungeonSolvers/index.js
+++ b/features/dungeonSolvers/index.js
@@ -203,7 +203,7 @@ class DungeonSolvers extends Feature {
}
}
}
- }).registeredWhen(() => this.isInDungeon())
+ })
let mimicDeadMessages = ["$SKYTILS-DUNGEON-SCORE-MIMIC$", "Mimic Killed!", "Mimic Dead!", "Mimic dead!"]
this.registerChat("&r&9Party &8> ${msg}", (msg) => {
mimicDeadMessages.forEach(dmsg => {
diff --git a/utils/renderUtils.js b/utils/renderUtils.js
index 6ddb143..b6228ff 100644
--- a/utils/renderUtils.js
+++ b/utils/renderUtils.js
@@ -49,7 +49,7 @@ let ret = {
GL11.glDepthMask(false);
GlStateManager.func_179094_E();
- Tessellator.begin(2).colorize(r, g, b);
+ Tessellator.begin(GL11.GL_LINE_STRIP).colorize(r, g, b);
Tessellator.pos(x, y, z);
Tessellator.pos(x2, y2, z2);
@@ -72,7 +72,7 @@ let ret = {
GL11.glDepthMask(false);
GlStateManager.func_179094_E();
- Tessellator.begin(2).colorize(r, g, b);
+ Tessellator.begin(GL11.GL_LINE_STRIP).colorize(r, g, b);
Tessellator.pos(x, y, z);
Tessellator.pos(x2, y2, z2);
@@ -101,22 +101,22 @@ let ret = {
},
drawLineSmall: function (x, y, z, x2, y2, z2, r, g, b) {
- Tessellator.begin(2).colorize(r, g, b);
+ Tessellator.begin(GL11.GL_LINE_STRIP).colorize(r, g, b);
Tessellator.pos(x, y, z);
Tessellator.pos(x2, y2, z2);
Tessellator.draw();
},
- drawLinePoints: function (locations, r, g, b, thickness = 1) {
+ drawLinePoints: function (locations, r, g, b, thickness = 1, phase = false) {
GL11.glBlendFunc(770, 771);
GL11.glEnable(GL11.GL_BLEND);
GL11.glLineWidth(thickness);
GL11.glDisable(GL11.GL_TEXTURE_2D);
- GL11.glDepthMask(false);
+ if (!phase) GL11.glDepthMask(false);
GlStateManager.func_179094_E();
- Tessellator.begin(2).colorize(r, g, b);
+ Tessellator.begin(GL11.GL_LINE_STRIP).colorize(r, g, b);
locations.forEach(loc => {
Tessellator.pos(...loc);
@@ -127,7 +127,7 @@ let ret = {
GlStateManager.func_179121_F();
GL11.glEnable(GL11.GL_TEXTURE_2D);
- GL11.glDepthMask(true);
+ if (!phase) GL11.glDepthMask(true);
GL11.glDisable(GL11.GL_BLEND);
},
drawBoxAtBlockNotVisThruWalls: function (x, y, z, colorR, colorG, colorB, w = 1, h = 1, a = 1) {
@@ -143,7 +143,7 @@ let ret = {
w += 0.01
h += 0.01
- Tessellator.begin(2).colorize(colorR, colorG, colorB, a);
+ Tessellator.begin(GL11.GL_LINE_STRIP).colorize(colorR, colorG, colorB, a);
Tessellator.pos(x + w, y + h, z + w);
Tessellator.pos(x + w, y + h, z);
@@ -182,7 +182,7 @@ let ret = {
GlStateManager[m.pushMatrix]()
- Tessellator.begin(2).colorize(colorR, colorG, colorB, a);
+ Tessellator.begin(GL11.GL_LINE_STRIP).colorize(colorR, colorG, colorB, a);
Tessellator.pos(x + w, y + h, z + w);
Tessellator.pos(x + w, y + h, z);
@@ -233,7 +233,7 @@ let ret = {
GlStateManager.func_179094_E();
- Tessellator.begin(2).colorize(colorR, colorG, colorB, 1);
+ Tessellator.begin(GL11.GL_LINE_STRIP).colorize(colorR, colorG, colorB, 1);
Tessellator.pos(x + width, y + height, z + width);
Tessellator.pos(x + width, y + height, z - width);