diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/dulkirmod/mixins/MixinRendererManager.java | 26 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/DulkirMod.kt | 9 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/command/SpawnParticlesCommand.kt | 14 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/config/Config.kt | 6 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/features/DragonTimer.kt | 20 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/features/HideHealerFairy.kt | 36 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/features/MemoryLeakFix.kt | 2 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/utils/TextUtils.kt | 2 |
8 files changed, 66 insertions, 49 deletions
diff --git a/src/main/java/dulkirmod/mixins/MixinRendererManager.java b/src/main/java/dulkirmod/mixins/MixinRendererManager.java index d6e937e..2787f87 100644 --- a/src/main/java/dulkirmod/mixins/MixinRendererManager.java +++ b/src/main/java/dulkirmod/mixins/MixinRendererManager.java @@ -1,12 +1,8 @@ package dulkirmod.mixins; -import dulkirmod.DulkirMod; +import dulkirmod.features.HideHealerFairy; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.Entity; -import net.minecraft.entity.item.EntityArmorStand; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -17,24 +13,6 @@ public class MixinRendererManager { @Inject(method = "doRenderEntity", at = @At("HEAD"), cancellable = true) public void doRender(Entity entity, double x, double y, double z, float entityYaw, float partialTicks, boolean p_147939_10_, CallbackInfoReturnable<Boolean> cir) { - if (!DulkirMod.Companion.getConfig().getHideHealerFairy()) return; - if (entity instanceof EntityArmorStand) { - EntityArmorStand stand = (EntityArmorStand) entity; - if (stand.getHeldItem() != null && stand.getHeldItem().getItem() == Items.skull) { - ItemStack stack = stand.getHeldItem(); - if (stack.hasTagCompound() && stack.getTagCompound().hasKey("SkullOwner")) { - NBTTagCompound skullOwner = stack.getTagCompound().getCompoundTag("SkullOwner"); - if (skullOwner.hasKey("Properties")) { - NBTTagCompound properties = skullOwner.getCompoundTag("Properties"); - if (properties.hasKey("textures")) { - String healerFairyTexture = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTZjM2UzMWNmYzY2NzMzMjc1YzQyZmNmYjVkOWE0NDM0MmQ2NDNiNTVjZDE0YzljNzdkMjczYTIzNTIifX19"; - if (healerFairyTexture.equals(properties.getTagList("textures", 10).getCompoundTagAt(0).getString("Value"))) { - cir.cancel(); - } - } - } - } - } - } + HideHealerFairy.INSTANCE.handle(entity, cir); } }
\ No newline at end of file diff --git a/src/main/kotlin/dulkirmod/DulkirMod.kt b/src/main/kotlin/dulkirmod/DulkirMod.kt index 6fd98f4..3ce2c41 100644 --- a/src/main/kotlin/dulkirmod/DulkirMod.kt +++ b/src/main/kotlin/dulkirmod/DulkirMod.kt @@ -5,7 +5,10 @@ import dulkirmod.config.Config import dulkirmod.events.ChatEvent import dulkirmod.features.* import dulkirmod.features.chat.AbiphoneDND -import dulkirmod.utils.* +import dulkirmod.utils.ContainerNameUtil +import dulkirmod.utils.TabListUtils +import dulkirmod.utils.TextUtils +import dulkirmod.utils.TitleUtils import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch @@ -53,7 +56,6 @@ class DulkirMod { ClientCommandHandler.instance.registerCommand(LeapNameCommand()) ClientCommandHandler.instance.registerCommand(HurtCamCommand()) ClientCommandHandler.instance.registerCommand(FarmingControlSchemeCommand()) - ClientCommandHandler.instance.registerCommand(SpawnParticlesCommand()) } @Mod.EventHandler @@ -76,6 +78,7 @@ class DulkirMod { mcBus.register(ScalableTooltips) mcBus.register(GardenVisitorAlert) mcBus.register(DragonTimer) + mcBus.register(HideHealerFairy) keyBinds.forEach(ClientRegistry::registerKeyBinding) } @@ -100,10 +103,10 @@ class DulkirMod { alarmClock() brokenHypeNotif() GardenVisitorAlert.alert() + MatchoAlert.alert() // Now I don't have to fetch the entries for multiple things, this just updates and caches // the data structure on 1s cooldown TabListUtils.parseTabEntries() - ScoreBoardUtils.inM7() lastLongUpdate = currTime } } diff --git a/src/main/kotlin/dulkirmod/command/SpawnParticlesCommand.kt b/src/main/kotlin/dulkirmod/command/SpawnParticlesCommand.kt deleted file mode 100644 index 88358a6..0000000 --- a/src/main/kotlin/dulkirmod/command/SpawnParticlesCommand.kt +++ /dev/null @@ -1,14 +0,0 @@ -package dulkirmod.command - -import dulkirmod.utils.TextUtils -import net.minecraft.command.ICommandSender - -class SpawnParticlesCommand : ClientCommandBase("sp") { - override fun processCommand(sender: ICommandSender?, args: Array<out String>?) { - TextUtils.sendMessage("/particle flame 84 18 95 1 1 1 1 100") - TextUtils.sendMessage("/particle flame 57 18 125 1 1 1 1 100") - TextUtils.sendMessage("/particle flame 26 18 95 1 1 1 1 100") - TextUtils.sendMessage("/particle flame 27 18 60 1 1 1 1 100") - TextUtils.sendMessage("/particle flame 84 18 56 1 1 1 1 100") - } -}
\ No newline at end of file diff --git a/src/main/kotlin/dulkirmod/config/Config.kt b/src/main/kotlin/dulkirmod/config/Config.kt index 1088ad1..3745ee6 100644 --- a/src/main/kotlin/dulkirmod/config/Config.kt +++ b/src/main/kotlin/dulkirmod/config/Config.kt @@ -84,7 +84,7 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod", so @Property( type = PropertyType.SWITCH, name = "Hide Healer fairy", - description = "Probably disable when not in dungeons for now. Will fix later.", + description = "Now only runs in dungeons lol", category = "Dungeons" ) var hideHealerFairy = false @@ -100,7 +100,7 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod", so @Property( type = PropertyType.SWITCH, name = "Throttle Notifier", - description = "Making features out of bugs wow", + description = "Im pretty sure this is mostly patched? Idk I'm leaving it in", category = "Dungeons" ) var throttleNotifier = true @@ -134,7 +134,7 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod", so @Property( type = PropertyType.SWITCH, name = "M7 Dragon Timer", - description = "Helps u arrow stack ig", + description = "Large in-world text timers to help you see when dragons will spawn.", category = "Dungeons" ) var dragonTimer = true diff --git a/src/main/kotlin/dulkirmod/features/DragonTimer.kt b/src/main/kotlin/dulkirmod/features/DragonTimer.kt index df1f12f..b21574c 100644 --- a/src/main/kotlin/dulkirmod/features/DragonTimer.kt +++ b/src/main/kotlin/dulkirmod/features/DragonTimer.kt @@ -8,8 +8,11 @@ import net.minecraft.util.BlockPos import net.minecraft.util.Vec3 import net.minecraft.world.World import net.minecraftforge.client.event.RenderWorldLastEvent +import net.minecraftforge.event.world.WorldEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.awt.Color +import java.util.concurrent.Executors +import java.util.concurrent.TimeUnit import kotlin.math.max object DragonTimer { @@ -28,10 +31,9 @@ object DragonTimer { */ fun handleNewParticle(pID: Int, x: Double, y: Double, z: Double) { if (!Config.dragonTimer) return + if (!ScoreBoardUtils.isInM7) return if (pID != 26) return - // if (!TabListUtils.isInDungeons) return - //TextUtils.info("§6particle id ${particleID} 175 = $p_175720_2_") val particleVec = Vec3(x, y, z) dragons.forEach { @@ -45,6 +47,8 @@ object DragonTimer { renderDragonBoxes() if (!Config.dragonTimer) return + if (!ScoreBoardUtils.inM7()) return + val curTime = System.currentTimeMillis() dragons.forEach { if (it.spawnTime + 5000 < curTime || isDead(it.color)) return@forEach @@ -125,5 +129,13 @@ object DragonTimer { WorldRenderUtils.drawCustomBox(14.5, 25.0, 13.0, 15.0, 45.5, 25.0, Color(255, 85, 85, 255), 3f, phase = false) // Orange WorldRenderUtils.drawCustomBox(72.0, 30.0, 8.0, 20.0, 47.0, 30.0, Color(255, 170, 0, 255), 3f, phase = false) - } - }
\ No newline at end of file + } + + @SubscribeEvent + fun updateM7Check(event: WorldEvent.Load) { + val executor = Executors.newSingleThreadScheduledExecutor() + executor.schedule({ + ScoreBoardUtils.inM7() + }, 10, TimeUnit.SECONDS) + } +}
\ No newline at end of file diff --git a/src/main/kotlin/dulkirmod/features/HideHealerFairy.kt b/src/main/kotlin/dulkirmod/features/HideHealerFairy.kt new file mode 100644 index 0000000..43475b1 --- /dev/null +++ b/src/main/kotlin/dulkirmod/features/HideHealerFairy.kt @@ -0,0 +1,36 @@ +package dulkirmod.features + + +import dulkirmod.DulkirMod.Companion.config +import dulkirmod.utils.TabListUtils.isInDungeons +import net.minecraft.entity.Entity +import net.minecraft.entity.item.EntityArmorStand +import net.minecraft.init.Items +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable + +object HideHealerFairy { + fun handle(entity: Entity, cir: CallbackInfoReturnable<Boolean>) { + if (!config.hideHealerFairy) return + if (!isInDungeons) return + if (entity is EntityArmorStand) { + if (entity.heldItem != null && entity.heldItem.item === Items.skull) { + val stack = entity.heldItem + if (stack.hasTagCompound() && stack.tagCompound.hasKey("SkullOwner")) { + val skullOwner = stack.tagCompound.getCompoundTag("SkullOwner") + if (skullOwner.hasKey("Properties")) { + val properties = skullOwner.getCompoundTag("Properties") + if (properties.hasKey("textures")) { + val healerFairyTexture = + "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTZjM2UzMWNmYzY2NzMzMjc1YzQyZmNmYjVkOWE0NDM0MmQ2NDNiNTVjZDE0YzljNzdkMjczYTIzNTIifX19" + if (healerFairyTexture == properties.getTagList("textures", 10).getCompoundTagAt(0) + .getString("Value") + ) { + cir.cancel() + } + } + } + } + } + } + } +}
\ No newline at end of file diff --git a/src/main/kotlin/dulkirmod/features/MemoryLeakFix.kt b/src/main/kotlin/dulkirmod/features/MemoryLeakFix.kt index a4dfc9b..dd69f24 100644 --- a/src/main/kotlin/dulkirmod/features/MemoryLeakFix.kt +++ b/src/main/kotlin/dulkirmod/features/MemoryLeakFix.kt @@ -7,7 +7,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.gameevent.TickEvent object MemoryLeakFix { - var lastClear = System.currentTimeMillis() + private var lastClear = System.currentTimeMillis() @SubscribeEvent fun onTick(event: TickEvent.ClientTickEvent) { diff --git a/src/main/kotlin/dulkirmod/utils/TextUtils.kt b/src/main/kotlin/dulkirmod/utils/TextUtils.kt index 6da1dd8..54072bc 100644 --- a/src/main/kotlin/dulkirmod/utils/TextUtils.kt +++ b/src/main/kotlin/dulkirmod/utils/TextUtils.kt @@ -5,6 +5,8 @@ import net.minecraft.util.ChatComponentText object TextUtils { fun info(text: String, prefix: Boolean = true) { + if (DulkirMod.mc.thePlayer == null) return + val textPrefix = if (prefix) "${DulkirMod.CHAT_PREFIX} " else "" DulkirMod.mc.thePlayer.addChatMessage(ChatComponentText("$textPrefix$text§r")) } |