blob: 5f82207bb5aca1fdbd6097f5693be405448f16ee (
plain)
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
|
package at.hannibal2.skyhanni.features.dungeon
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.data.EntityMovementData
import at.hannibal2.skyhanni.events.*
import at.hannibal2.skyhanni.utils.ItemUtils.cleanName
import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture
import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.getLorenzVec
import net.minecraft.entity.item.EntityArmorStand
import net.minecraft.entity.item.EntityItem
import net.minecraft.util.EnumParticleTypes
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class DungeonHideItems {
private val hideParticles = mutableMapOf<EntityArmorStand, Long>()
private val movingSkeletonSkulls = mutableMapOf<EntityArmorStand, Long>()
private val blessingTexture =
"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZTkzZTIwNjg2MTc4NzJjNTQyZWNkYTFkMjdkZjRlY2U5MWM2OTk5MDdiZjMyN2M0ZGRiODUzMDk0MTJkMzkzOSJ9fX0="
private val reviveStoneTexture =
"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjZhNzZjYzIyZTdjMmFiOWM1NDBkMTI0NGVhZGJhNTgxZjVkZDllMThmOWFkYWNmMDUyODBhNWI0OGI4ZjYxOCJ9fX0K"
private val premiumFleshTexture =
"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMWE3NWU4YjA0NGM3MjAxYTRiMmU4NTZiZTRmYzMxNmE1YWFlYzY2NTc2MTY5YmFiNTg3MmE4ODUzNGI4MDI1NiJ9fX0K"
private val abilityOrbTexture =
"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZTAxZTA0MGNiMDFjZjJjY2U0NDI4MzU4YWUzMWQyZTI2NjIwN2M0N2NiM2FkMTM5NzA5YzYyMDEzMGRjOGFkNCJ9fX0="
private val supportOrbTexture =
"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMTMxYTRmYWIyZjg3ZGI1NDMzMDEzNjUxN2I0NTNhYWNiOWQ3YzBmZTc4NDMwMDcwOWU5YjEwOWNiYzUxNGYwMCJ9fX0="
private val damageOrbTexture =
"eyJ0aW1lc3RhbXAiOjE1NzQ5NTEzMTkwNDQsInByb2ZpbGVJZCI6IjE5MjUyMWI0ZWZkYjQyNWM4OTMxZjAyYTg0OTZlMTFiIiwicHJvZmlsZU5hbWUiOiJTZXJpYWxpemFibGUiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2FiODZkYTJlMjQzYzA1ZGMwODk4YjBjYzVkM2U2NDg3NzE3MzE3N2UwYTIzOTQ0MjVjZWMxMDAyNTljYjQ1MjYifX19"
private val healerFairyTexture =
"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTZjM2UzMWNmYzY2NzMzMjc1YzQyZmNmYjVkOWE0NDM0MmQ2NDNiNTVjZDE0YzljNzdkMjczYTIzNTIifX19"
private fun isSkeletonSkull(entity: EntityArmorStand): Boolean {
val itemStack = entity.inventory[4]
if (itemStack != null) {
if (itemStack.cleanName() == "Skeleton Skull") {
return true
}
}
return false
}
@SubscribeEvent
fun onCheckRender(event: CheckRenderEntityEvent<*>) {
if (!LorenzUtils.inDungeons) return
val entity = event.entity
if (entity is EntityItem) {
val stack = entity.entityItem
if (SkyHanniMod.feature.dungeon.hideReviveStone) {
if (stack.cleanName() == "Revive Stone") {
event.isCanceled = true
}
}
if (SkyHanniMod.feature.dungeon.hideJournalEntry) {
if (stack.cleanName() == "Journal Entry") {
event.isCanceled = true
}
}
}
if (entity !is EntityArmorStand) return
if (SkyHanniMod.feature.dungeon.hideSuperboomTNT) {
if (entity.name.startsWith("§9Superboom TNT")) {
event.isCanceled = true
}
val itemStack = entity.inventory[4]
if (itemStack != null) {
if (itemStack.cleanName() == "Superboom TNT") {
event.isCanceled = true
hideParticles[entity] = System.currentTimeMillis()
}
}
}
if (SkyHanniMod.feature.dungeon.hideBlessing) {
if (entity.name.startsWith("§dBlessing of ")) {
event.isCanceled = true
}
val itemStack = entity.inventory[4]
if (itemStack != null) {
if (itemStack.getSkullTexture() == blessingTexture) {
event.isCanceled = true
}
}
}
if (SkyHanniMod.feature.dungeon.hideReviveStone) {
if (entity.name == "§6Revive Stone") {
event.isCanceled = true
}
val itemStack = entity.inventory[4]
if (itemStack != null) {
if (itemStack.getSkullTexture() == reviveStoneTexture) {
event.isCanceled = true
hideParticles[entity] = System.currentTimeMillis()
}
}
}
if (SkyHanniMod.feature.dungeon.hidePremiumFlesh) {
if (entity.name == "§9Premium Flesh") {
event.isCanceled = true
hideParticles[entity] = System.currentTimeMillis()
}
val itemStack = entity.inventory[4]
if (itemStack != null) {
if (itemStack.getSkullTexture() == premiumFleshTexture) {
event.isCanceled = true
}
}
}
if (isSkeletonSkull(entity)) {
EntityMovementData.addToTrack(entity)
if (SkyHanniMod.feature.dungeon.hideSkeletonSkull) {
val lastMove = movingSkeletonSkulls.getOrDefault(entity, 0)
if (lastMove + 100 > System.currentTimeMillis()) {
return
}
event.isCanceled = true
}
}
if (SkyHanniMod.feature.dungeon.hideHealerOrbs) {
when {
entity.name.startsWith("§c§lDAMAGE §e") -> event.isCanceled = true
entity.name.startsWith("§c§lABILITY DAMAGE §e") -> event.isCanceled = true
entity.name.startsWith("§a§lDEFENSE §e") -> event.isCanceled = true
}
val itemStack = entity.inventory[4]
if (itemStack != null) {
when (itemStack.getSkullTexture()) {
abilityOrbTexture,
supportOrbTexture,
damageOrbTexture,
-> {
event.isCanceled = true
hideParticles[entity] = System.currentTimeMillis()
return
}
}
}
}
if (SkyHanniMod.feature.dungeon.hideHealerFairy) {
val itemStack = entity.inventory[0]
if (itemStack != null) {
if (itemStack.getSkullTexture() == healerFairyTexture) {
event.isCanceled = true
return
}
}
}
}
@SubscribeEvent
fun onReceivePacket(event: ReceiveParticleEvent) {
if (!LorenzUtils.inDungeons) return
if (!SkyHanniMod.feature.dungeon.hideSuperboomTNT && !SkyHanniMod.feature.dungeon.hideReviveStone) return
val packetLocation = event.location
for (armorStand in hideParticles.filter { it.value + 100 > System.currentTimeMillis() }.map { it.key }) {
val distance = packetLocation.distance(armorStand.getLorenzVec())
if (distance < 2) {
if (event.type == EnumParticleTypes.FIREWORKS_SPARK) {
event.isCanceled = true
}
if (event.type == EnumParticleTypes.REDSTONE) {
event.isCanceled = true
}
}
}
}
@SubscribeEvent
fun onEntityMove(event: EntityMoveEvent) {
if (!LorenzUtils.inDungeons) return
val entity = event.entity
if (entity !is EntityArmorStand) return
if (isSkeletonSkull(entity)) {
movingSkeletonSkulls[entity] = System.currentTimeMillis()
}
}
@SubscribeEvent
fun onRenderMobColored(event: RenderMobColoredEvent) {
if (!LorenzUtils.inDungeons) return
if (!SkyHanniMod.feature.dungeon.highlightSkeletonSkull) return
val entity = event.entity
if (entity is EntityArmorStand) {
if (isSkeletonSkull(entity)) {
val lastMove = movingSkeletonSkulls.getOrDefault(entity, 0)
if (lastMove + 200 > System.currentTimeMillis()) {
event.color = LorenzColor.GOLD.toColor().withAlpha(60)
}
}
}
}
@SubscribeEvent
fun onResetEntityHurtTime(event: ResetEntityHurtEvent) {
if (!LorenzUtils.inDungeons) return
if (!SkyHanniMod.feature.dungeon.highlightSkeletonSkull) return
val entity = event.entity
if (entity is EntityArmorStand) {
if (isSkeletonSkull(entity)) {
val lastMove = movingSkeletonSkulls.getOrDefault(entity, 0)
if (lastMove + 200 > System.currentTimeMillis()) {
event.shouldReset = true
}
}
|