aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorMy-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com>2021-04-26 21:26:04 -0400
committerMy-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com>2021-04-26 21:26:04 -0400
commit33a2814d54dfaee2accd0567548d06e707e7462b (patch)
tree389864954bef7be7acd1328818578f87cdb316df /src/main
parent565e61d7caa097a96a253381e09d4e43bb1a44e4 (diff)
downloadSkytilsMod-33a2814d54dfaee2accd0567548d06e707e7462b.tar.gz
SkytilsMod-33a2814d54dfaee2accd0567548d06e707e7462b.tar.bz2
SkytilsMod-33a2814d54dfaee2accd0567548d06e707e7462b.zip
Gaia Construct Hit Tracker
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/skytils/skytilsmod/mixins/AccessorMinecraft.java30
-rw-r--r--src/main/kotlin/skytils/skytilsmod/Skytils.kt2
-rw-r--r--src/main/kotlin/skytils/skytilsmod/core/Config.kt11
-rw-r--r--src/main/kotlin/skytils/skytilsmod/features/impl/events/MayorDiana.kt93
-rw-r--r--src/main/kotlin/skytils/skytilsmod/features/impl/trackers/MythologicalTracker.kt4
-rw-r--r--src/main/resources/mixins.skytils.json1
6 files changed, 138 insertions, 3 deletions
diff --git a/src/main/java/skytils/skytilsmod/mixins/AccessorMinecraft.java b/src/main/java/skytils/skytilsmod/mixins/AccessorMinecraft.java
new file mode 100644
index 00000000..abdf9b96
--- /dev/null
+++ b/src/main/java/skytils/skytilsmod/mixins/AccessorMinecraft.java
@@ -0,0 +1,30 @@
+/*
+ * Skytils - Hypixel Skyblock Quality of Life Mod
+ * Copyright (C) 2021 Skytils
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package skytils.skytilsmod.mixins;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.util.Timer;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.gen.Accessor;
+
+@Mixin(Minecraft.class)
+public interface AccessorMinecraft {
+ @Accessor("timer")
+ Timer getTimer();
+}
diff --git a/src/main/kotlin/skytils/skytilsmod/Skytils.kt b/src/main/kotlin/skytils/skytilsmod/Skytils.kt
index f7edc5e6..420f1c2a 100644
--- a/src/main/kotlin/skytils/skytilsmod/Skytils.kt
+++ b/src/main/kotlin/skytils/skytilsmod/Skytils.kt
@@ -52,6 +52,7 @@ import skytils.skytilsmod.features.impl.dungeons.*
import skytils.skytilsmod.features.impl.dungeons.solvers.*
import skytils.skytilsmod.features.impl.dungeons.solvers.terminals.*
import skytils.skytilsmod.features.impl.events.GriffinBurrows
+import skytils.skytilsmod.features.impl.events.MayorDiana
import skytils.skytilsmod.features.impl.events.MayorJerry
import skytils.skytilsmod.features.impl.events.TechnoMayor
import skytils.skytilsmod.features.impl.farming.FarmingFeatures
@@ -183,6 +184,7 @@ class Skytils {
MinecraftForge.EVENT_BUS.register(ItemFeatures())
MinecraftForge.EVENT_BUS.register(KeyShortcuts())
MinecraftForge.EVENT_BUS.register(LockOrb())
+ MinecraftForge.EVENT_BUS.register(MayorDiana())
MinecraftForge.EVENT_BUS.register(MayorJerry())
MinecraftForge.EVENT_BUS.register(MiningFeatures())
MinecraftForge.EVENT_BUS.register(MinionFeatures())
diff --git a/src/main/kotlin/skytils/skytilsmod/core/Config.kt b/src/main/kotlin/skytils/skytilsmod/core/Config.kt
index 671ff6e1..6725adf1 100644
--- a/src/main/kotlin/skytils/skytilsmod/core/Config.kt
+++ b/src/main/kotlin/skytils/skytilsmod/core/Config.kt
@@ -598,7 +598,7 @@ class Config : Vigilant(File("./config/skytils/config.toml"), "Skytils") {
@Property(
type = PropertyType.SWITCH,
name = "Burrow Particle Add-on",
- description = "§b[WIP] §rAdd-on for Show Griffin Burrows. Uses particles in addition to the API.\nIt's recommended you only use this feature when the API is not working.",
+ description = "Uses particles in addition to the API in order to locate burrows.\nThis feature will help find burrows when the API isn't working.",
category = "Events",
subcategory = "Mythological"
)
@@ -661,6 +661,15 @@ class Config : Vigilant(File("./config/skytils/config.toml"), "Skytils") {
@Property(
type = PropertyType.SWITCH,
+ name = "Display Gaia Construct Hits",
+ description = "Tracks the amount of times a Gaia Construct has been hit.",
+ category = "Events",
+ subcategory = "Mythological"
+ )
+ var trackGaiaHits = false
+
+ @Property(
+ type = PropertyType.SWITCH,
name = "Track Mythological Creatures",
description = "Tracks and saves drops from Mythological Creatures.",
category = "Events",
diff --git a/src/main/kotlin/skytils/skytilsmod/features/impl/events/MayorDiana.kt b/src/main/kotlin/skytils/skytilsmod/features/impl/events/MayorDiana.kt
new file mode 100644
index 00000000..e9386666
--- /dev/null
+++ b/src/main/kotlin/skytils/skytilsmod/features/impl/events/MayorDiana.kt
@@ -0,0 +1,93 @@
+/*
+ * Skytils - Hypixel Skyblock Quality of Life Mod
+ * Copyright (C) 2021 Skytils
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package skytils.skytilsmod.features.impl.events
+
+import net.minecraft.client.renderer.GlStateManager
+import net.minecraft.entity.monster.EntityIronGolem
+import net.minecraft.network.play.server.S29PacketSoundEffect
+import net.minecraft.util.BlockPos
+import net.minecraft.util.ChatComponentText
+import net.minecraft.util.Vec3
+import net.minecraftforge.client.event.RenderLivingEvent
+import net.minecraftforge.event.entity.living.LivingDeathEvent
+import net.minecraftforge.event.entity.living.LivingHurtEvent
+import net.minecraftforge.event.world.WorldEvent
+import net.minecraftforge.fml.common.eventhandler.Event
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import net.minecraftforge.fml.common.gameevent.TickEvent
+import skytils.skytilsmod.Skytils
+import skytils.skytilsmod.Skytils.Companion.mc
+import skytils.skytilsmod.events.PacketEvent
+import skytils.skytilsmod.mixins.AccessorMinecraft
+import skytils.skytilsmod.utils.RenderUtil
+import skytils.skytilsmod.utils.Utils
+import java.awt.Color
+
+class MayorDiana {
+
+ private val gaiaConstructHits = HashMap<EntityIronGolem, Int>()
+
+
+ @SubscribeEvent
+ fun onEvent(event: Event) {
+ if (!Utils.inSkyblock || !Skytils.config.trackGaiaHits) return
+ when (event) {
+ is TickEvent.ClientTickEvent -> {
+ if (event.phase == TickEvent.Phase.START) for (golem in gaiaConstructHits.keys) {
+ if (golem.hurtTime == 10) {
+ gaiaConstructHits[golem] = 0
+ }
+ }
+ }
+ is PacketEvent.ReceiveEvent -> {
+ if (event.packet is S29PacketSoundEffect) {
+ if (event.packet.volume == 0f) return
+ if (event.packet.volume == 0.8f && event.packet.soundName == "random.anvil_land") {
+ val pos = BlockPos(event.packet.x, event.packet.y, event.packet.z)
+ for (entity in mc.theWorld.loadedEntityList) {
+ if (entity is EntityIronGolem && entity.isEntityAlive && entity.getDistanceSq(pos) <= 2 * 2) {
+ gaiaConstructHits.compute(entity) { _: EntityIronGolem, i: Int? -> if (i == null) 1 else i + 1 }
+ break;
+ }
+ }
+ }
+ }
+ }
+ is RenderLivingEvent.Post<*> -> {
+ if (event.entity is EntityIronGolem) {
+ val golem = event.entity as EntityIronGolem
+ if (gaiaConstructHits.containsKey(golem)) {
+ GlStateManager.disableDepth()
+ RenderUtil.draw3DString(
+ Vec3(event.entity.posX, event.entity.posY + 2, event.entity.posZ),
+ "Hits: ${gaiaConstructHits.getOrDefault(event.entity, 0)}",
+ Color.RED,
+ (mc as AccessorMinecraft).timer.renderPartialTicks
+ )
+ GlStateManager.enableDepth()
+ }
+ }
+ }
+ }
+ }
+
+ fun onLoad(event: WorldEvent.Load) {
+ gaiaConstructHits.clear()
+ }
+} \ No newline at end of file
diff --git a/src/main/kotlin/skytils/skytilsmod/features/impl/trackers/MythologicalTracker.kt b/src/main/kotlin/skytils/skytilsmod/features/impl/trackers/MythologicalTracker.kt
index 14008461..4fd3e48d 100644
--- a/src/main/kotlin/skytils/skytilsmod/features/impl/trackers/MythologicalTracker.kt
+++ b/src/main/kotlin/skytils/skytilsmod/features/impl/trackers/MythologicalTracker.kt
@@ -115,14 +115,14 @@ class MythologicalTracker : PersistentSave(File(File(Skytils.modDir, "trackers")
@SubscribeEvent
fun onJoinWorld(event: EntityJoinWorldEvent) {
- if (Utils.inSkyblock && mc.thePlayer != null && Skytils.config.trackMythEvent && event.entity is EntityOtherPlayerMP && System.currentTimeMillis() - lastMinosChamp <= 2500 && event.entity.getDistanceSqToEntity(mc.thePlayer) < 10 * 10) {
+ if (Utils.inSkyblock && mc.thePlayer != null && Skytils.config.trackMythEvent && event.entity is EntityOtherPlayerMP && System.currentTimeMillis() - lastMinosChamp <= 2500 && event.entity.getDistanceSqToEntity(mc.thePlayer) < 5.5 * 5.5) {
if (event.entity.name == "Minos Champion") {
lastMinosChamp = 0L
BurrowMob.MINO.dugTimes++
} else if (event.entity.name == "Minos Inquisitor") {
lastMinosChamp = 0L
BurrowMob.INQUIS.dugTimes++
- mc.thePlayer.addChatMessage(ChatComponentText("§bSkytils:§eActually, you dug up a §2Minos Inquisitor§e!"))
+ mc.thePlayer.addChatMessage(ChatComponentText("§bSkytils: §eActually, you dug up a §2Minos Inquisitor§e!"))
}
}
}
diff --git a/src/main/resources/mixins.skytils.json b/src/main/resources/mixins.skytils.json
index d5387e98..790372a0 100644
--- a/src/main/resources/mixins.skytils.json
+++ b/src/main/resources/mixins.skytils.json
@@ -6,6 +6,7 @@
"AccessorCommandHandler",
"AccessorGuiEditSign",
"AccessorGuiNewChat",
+ "AccessorMinecraft",
"AccessorSettingsGui",
"MixinBlockRendererDispatcher",
"MixinBossStatus",