1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
/// <reference types="../../../CTAutocomplete" />
/// <reference lib="es2015" />
import Feature from "../../featureClass/class";
import { drawBoxAtBlock, drawFilledBox, drawLinePoints } from "../../utils/renderUtils";
import SettingBase from "../settings/settingThings/settingBase";
class DungeonRoutes extends Feature {
constructor() {
super()
}
onEnable() {
if (Player.getUUID().toString() !== "dc8c3964-7b29-4e03-ae9e-d13ebd65dd29") {
new SettingBase("Coming soontm", "maby", undefined, "coming_soontm", this)
return
}
this.actionId = 0
this.recentEtherwarps = []
this.recentMines = []
this.recentLocations = []
this.recentTnts = []
this.lastLocationUpdatedTime = Date.now()
this.registerEvent("soundPlay", this.playSound)
this.registerEvent("worldLoad", this.worldLoad)
this.registerStep(true, 5, () => {
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++ })
this.checkForRemove()
}
})
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)
})
let roomData = {}
this.registerCommand("roomname", (...name) => {
name = name.join(" ")
})
}
worldLoad() {
this.recentEtherwarps = []
this.recentMines = []
this.recentLocations = []
this.recentTnts = []
}
checkForRemove() {
if (this.recentLocations.length + this.recentMines.length + this.recentEtherwarps.length + this.recentTnts.length > 50) {
let arrs = [this.recentLocations, this.recentMines, this.recentEtherwarps, this.recentTnts]
let smallestArr = undefined
if (this.recentLocations[0].id < this.recentMines[0].id && this.recentLocations[0].id < this.recentEtherwarps[0].id) {
this.recentLocations.shift()
return
}
if (this.recentMines[0].id < this.recentLocations[0].id && this.recentMines[0].id < this.recentEtherwarps[0].id) {
this.recentMines.shift()
return
}
if (this.recentEtherwarps[0].id < this.recentMines[0].id && this.recentEtherwarps[0].id < this.recentLocations[0].id) {
this.recentEtherwarps.shift()
return
}
}
}
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++ })
this.checkForRemove()
}
if (name === "random.explode") { //etherwarp
this.recentTnts.push({ loc: pos, id: this.actionId++ })
this.checkForRemove()
}
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++ })
this.checkForRemove()
}
}
}
onDisable() {
}
}
module.exports = {
class: new DungeonRoutes()
}
|