aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/dulkirmod/mixins/MixinEntityLivingBase.java6
-rw-r--r--src/main/java/dulkirmod/mixins/MixinGuiContainer.java7
-rw-r--r--src/main/java/dulkirmod/mixins/MixinItemRenderer.java11
-rw-r--r--src/main/java/dulkirmod/mixins/MixinRendererManager.java28
-rw-r--r--src/main/java/dulkirmod/mixins/MixinWorld.java6
-rw-r--r--src/main/kotlin/dulkirmod/DulkirMod.kt31
-rw-r--r--src/main/kotlin/dulkirmod/config/Config.kt8
-rw-r--r--src/main/kotlin/dulkirmod/events/ChatEvent.kt2
-rw-r--r--src/main/kotlin/dulkirmod/features/AlarmClock.kt6
-rw-r--r--src/main/kotlin/dulkirmod/features/ArachneTimer.kt2
-rw-r--r--src/main/kotlin/dulkirmod/features/BrokenHypeNotif.kt4
-rw-r--r--src/main/kotlin/dulkirmod/features/Croesus.kt143
-rw-r--r--src/main/kotlin/dulkirmod/features/DragonTimer.kt235
-rw-r--r--src/main/kotlin/dulkirmod/features/DungeonLeap.kt90
-rw-r--r--src/main/kotlin/dulkirmod/features/GardenVisitorAlert.kt7
-rw-r--r--src/main/kotlin/dulkirmod/features/KeeperWaypoints.kt2
-rw-r--r--src/main/kotlin/dulkirmod/features/MatchoAlert.kt5
-rw-r--r--src/main/kotlin/dulkirmod/features/MemoryLeakFix.kt34
-rw-r--r--src/main/kotlin/dulkirmod/features/chat/AbiphoneDND.kt34
-rw-r--r--src/main/kotlin/dulkirmod/features/chat/FakeMsg.kt4
-rw-r--r--src/main/kotlin/dulkirmod/utils/ContainerNameUtil.kt20
-rw-r--r--src/main/kotlin/dulkirmod/utils/TitleUtils.kt2
-rw-r--r--src/main/kotlin/dulkirmod/utils/Utils.kt98
23 files changed, 398 insertions, 387 deletions
diff --git a/src/main/java/dulkirmod/mixins/MixinEntityLivingBase.java b/src/main/java/dulkirmod/mixins/MixinEntityLivingBase.java
index d746c23..bc9b48c 100644
--- a/src/main/java/dulkirmod/mixins/MixinEntityLivingBase.java
+++ b/src/main/java/dulkirmod/mixins/MixinEntityLivingBase.java
@@ -14,9 +14,11 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin({EntityLivingBase.class})
public abstract class MixinEntityLivingBase extends MixinEntity {
- @Shadow public abstract boolean isPotionActive(Potion potionIn);
+ @Shadow
+ public abstract boolean isPotionActive(Potion potionIn);
- @Shadow public abstract PotionEffect getActivePotionEffect(Potion potionIn);
+ @Shadow
+ public abstract PotionEffect getActivePotionEffect(Potion potionIn);
@Inject(method = "getArmSwingAnimationEnd()I", at = @At("HEAD"), cancellable = true)
public void adjustSwingLength(CallbackInfoReturnable<Integer> cir) {
diff --git a/src/main/java/dulkirmod/mixins/MixinGuiContainer.java b/src/main/java/dulkirmod/mixins/MixinGuiContainer.java
index 50118f1..97a4341 100644
--- a/src/main/java/dulkirmod/mixins/MixinGuiContainer.java
+++ b/src/main/java/dulkirmod/mixins/MixinGuiContainer.java
@@ -17,12 +17,12 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(GuiContainer.class)
public abstract class MixinGuiContainer extends GuiScreen {
- @Inject(method="drawSlot", at=@At("HEAD"), cancellable = true)
+ @Inject(method = "drawSlot", at = @At("HEAD"), cancellable = true)
public void drawSlot(Slot slotIn, CallbackInfo ci) {
- if (Croesus.Companion.inCroesus() && Croesus.Companion.isChestOpened(slotIn)) {
+ if (Croesus.inCroesus() && Croesus.isChestOpened(slotIn)) {
ci.cancel();
}
- if (DungeonLeap.Companion.inLeapMenu() && DungeonLeap.Companion.isHighlightedLeapPlayer(slotIn)) {
+ if (DungeonLeap.INSTANCE.getInLeapMenu() && DungeonLeap.INSTANCE.isHighlightedLeapPlayer(slotIn)) {
ci.cancel();
ItemStack stack = new ItemStack(Blocks.wool, 1, EnumDyeColor.GREEN.getMetadata());
@@ -44,6 +44,7 @@ public abstract class MixinGuiContainer extends GuiScreen {
this.zLevel = 0.0F;
}
}
+
@Inject(method = "onGuiClosed", at = @At("HEAD"))
private void onGuiClosed(CallbackInfo ci) {
// reset values here
diff --git a/src/main/java/dulkirmod/mixins/MixinItemRenderer.java b/src/main/java/dulkirmod/mixins/MixinItemRenderer.java
index 3620817..51742b2 100644
--- a/src/main/java/dulkirmod/mixins/MixinItemRenderer.java
+++ b/src/main/java/dulkirmod/mixins/MixinItemRenderer.java
@@ -15,9 +15,12 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(value = {ItemRenderer.class}, priority = 1010)
public class MixinItemRenderer {
- @Shadow @Final private RenderItem itemRenderer;
+ @Shadow
+ @Final
+ private RenderItem itemRenderer;
- @Shadow private ItemStack itemToRender;
+ @Shadow
+ private ItemStack itemToRender;
@Inject(method = "transformFirstPersonItem(FF)V", at = @At("HEAD"), cancellable = true)
public void itemTransform(float equipProgress, float swingProgress, CallbackInfo ci) {
@@ -25,11 +28,11 @@ public class MixinItemRenderer {
}
@Inject(method = "doItemUsedTransformations", at = @At("HEAD"), cancellable = true)
- public void useTransform(float swingProgress, CallbackInfo ci){
+ public void useTransform(float swingProgress, CallbackInfo ci) {
if (ItemAnimations.INSTANCE.scaledSwing(swingProgress)) ci.cancel();
}
- @Inject(method ="performDrinking", at = @At("HEAD"), cancellable = true)
+ @Inject(method = "performDrinking", at = @At("HEAD"), cancellable = true)
public void drinkTransform(AbstractClientPlayer clientPlayer, float partialTicks, CallbackInfo ci) {
if (ItemAnimations.INSTANCE.rotationlessDrink(clientPlayer, partialTicks)) ci.cancel();
if (ItemAnimations.INSTANCE.scaledDrinking(clientPlayer, partialTicks, itemToRender)) ci.cancel();
diff --git a/src/main/java/dulkirmod/mixins/MixinRendererManager.java b/src/main/java/dulkirmod/mixins/MixinRendererManager.java
index 964e690..d6e937e 100644
--- a/src/main/java/dulkirmod/mixins/MixinRendererManager.java
+++ b/src/main/java/dulkirmod/mixins/MixinRendererManager.java
@@ -1,5 +1,6 @@
package dulkirmod.mixins;
+import dulkirmod.DulkirMod;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityArmorStand;
@@ -10,42 +11,29 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
-import dulkirmod.DulkirMod;
@Mixin(RenderManager.class)
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
- ) {
+ 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) {
- if (((EntityArmorStand) entity).getHeldItem() != null && ((EntityArmorStand) entity).getHeldItem().getItem() == Items.skull) {
- ItemStack stack = ((EntityArmorStand) entity).getHeldItem();
+ 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")) {
- //if (properties.getTagList("textures", 10).tagCount() >= 1) {
- if ("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTZjM2UzMWNmYzY2NzMzMjc1YzQyZmNmYjVkOWE0NDM0MmQ2NDNiNTVjZDE0YzljNzdkMjczYTIzNTIifX19"
- .equals(properties.getTagList("textures", 10).getCompoundTagAt(0).getString("Value")))
+ String healerFairyTexture = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTZjM2UzMWNmYzY2NzMzMjc1YzQyZmNmYjVkOWE0NDM0MmQ2NDNiNTVjZDE0YzljNzdkMjczYTIzNTIifX19";
+ if (healerFairyTexture.equals(properties.getTagList("textures", 10).getCompoundTagAt(0).getString("Value"))) {
cir.cancel();
- //}
+ }
}
-
}
-
}
-
}
}
}
diff --git a/src/main/java/dulkirmod/mixins/MixinWorld.java b/src/main/java/dulkirmod/mixins/MixinWorld.java
index cdbe9ae..1c75281 100644
--- a/src/main/java/dulkirmod/mixins/MixinWorld.java
+++ b/src/main/java/dulkirmod/mixins/MixinWorld.java
@@ -1,6 +1,7 @@
package dulkirmod.mixins;
import dulkirmod.DulkirMod;
+import dulkirmod.features.DragonTimer;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@@ -11,9 +12,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
public class MixinWorld {
@Inject(method = "spawnParticle(IZDDDDDD[I)V", at = @At("HEAD"), cancellable = true)
- public void onInitGui(int particleID, boolean p_175720_2_, double xCoord, double yCoord, double zCoord,
- double xOffset, double yOffset, double zOffset, int[] p_175720_15_, CallbackInfo ci) {
- DulkirMod.Companion.getDragonTimer().handleNewParticle(particleID, xCoord, yCoord, zCoord);
+ public void onInitGui(int particleID, boolean p_175720_2_, double xCoord, double yCoord, double zCoord, double xOffset, double yOffset, double zOffset, int[] p_175720_15_, CallbackInfo ci) {
+ DragonTimer.INSTANCE.handleNewParticle(particleID, xCoord, yCoord, zCoord);
if (particleID == 25 && DulkirMod.Companion.getConfig().getHideEnchantRune()) {
ci.cancel();
diff --git a/src/main/kotlin/dulkirmod/DulkirMod.kt b/src/main/kotlin/dulkirmod/DulkirMod.kt
index dcf5718..6fd98f4 100644
--- a/src/main/kotlin/dulkirmod/DulkirMod.kt
+++ b/src/main/kotlin/dulkirmod/DulkirMod.kt
@@ -62,19 +62,20 @@ class DulkirMod {
// REGISTER Classes and such HERE
val mcBus = MinecraftForge.EVENT_BUS
mcBus.register(this)
- mcBus.register(ChatEvent())
+ mcBus.register(MemoryLeakFix)
+ mcBus.register(ChatEvent)
mcBus.register(NametagCleaner)
- mcBus.register(titleUtils)
- mcBus.register(ArachneTimer())
- mcBus.register(MatchoAlert())
- mcBus.register(Croesus())
- mcBus.register(ContainerNameUtil())
- mcBus.register(DungeonLeap())
- mcBus.register(AbiphoneDND())
- mcBus.register(KeeperWaypoints())
+ mcBus.register(TitleUtils)
+ mcBus.register(ArachneTimer)
+ mcBus.register(MatchoAlert)
+ mcBus.register(Croesus)
+ mcBus.register(ContainerNameUtil)
+ mcBus.register(DungeonLeap)
+ mcBus.register(AbiphoneDND)
+ mcBus.register(KeeperWaypoints)
mcBus.register(ScalableTooltips)
- mcBus.register(GardenVisitorAlert())
- mcBus.register(DragonTimer())
+ mcBus.register(GardenVisitorAlert)
+ mcBus.register(DragonTimer)
keyBinds.forEach(ClientRegistry::registerKeyBinding)
}
@@ -98,8 +99,7 @@ class DulkirMod {
if (currTime - lastLongUpdate > 1000) { // long update
alarmClock()
brokenHypeNotif()
- matchoAlert.alert()
- gardenVisitorAlert.alert()
+ GardenVisitorAlert.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()
@@ -130,11 +130,6 @@ class DulkirMod {
var config = Config
var display: GuiScreen? = null
val scope = CoroutineScope(EmptyCoroutineContext)
- val titleUtils = TitleUtils()
- val matchoAlert = MatchoAlert()
- val gardenVisitorAlert = GardenVisitorAlert()
- val DragonTimer = DragonTimer()
- var tabEntries: List<String?> = emptyList()
val keyBinds = arrayOf(
KeyBinding("Open Settings", Keyboard.KEY_RSHIFT, "Dulkir Mod"),
diff --git a/src/main/kotlin/dulkirmod/config/Config.kt b/src/main/kotlin/dulkirmod/config/Config.kt
index 8fe611d..1088ad1 100644
--- a/src/main/kotlin/dulkirmod/config/Config.kt
+++ b/src/main/kotlin/dulkirmod/config/Config.kt
@@ -13,6 +13,14 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod", so
@Property(
type = PropertyType.SWITCH,
+ name = "Patch Crimson Isle memory leak",
+ description = "This is a temporary fix for the memory leak on crimson isles. It will be removed when Hypixel fixes the issue.",
+ category = "General"
+ )
+ var crimsonIslesMemoryLeakPatch = true
+
+ @Property(
+ type = PropertyType.SWITCH,
name = "Hide Enchant Rune Particles",
description = "ugly go bye-bye",
category = "General"
diff --git a/src/main/kotlin/dulkirmod/events/ChatEvent.kt b/src/main/kotlin/dulkirmod/events/ChatEvent.kt
index 1b0f232..8a4065e 100644
--- a/src/main/kotlin/dulkirmod/events/ChatEvent.kt
+++ b/src/main/kotlin/dulkirmod/events/ChatEvent.kt
@@ -6,7 +6,7 @@ import net.minecraftforge.client.event.ClientChatReceivedEvent
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-class ChatEvent {
+object ChatEvent {
/**
* This is mostly the way it is to avoid having to run strip color codes a bunch of times
diff --git a/src/main/kotlin/dulkirmod/features/AlarmClock.kt b/src/main/kotlin/dulkirmod/features/AlarmClock.kt
index 0d3f51c..f4c11d4 100644
--- a/src/main/kotlin/dulkirmod/features/AlarmClock.kt
+++ b/src/main/kotlin/dulkirmod/features/AlarmClock.kt
@@ -1,9 +1,9 @@
package dulkirmod.features
-import dulkirmod.DulkirMod
import dulkirmod.DulkirMod.Companion.mc
import dulkirmod.config.Config
import dulkirmod.utils.ScoreBoardUtils
+import dulkirmod.utils.TitleUtils
import dulkirmod.utils.Utils
var lastUpdate: Long = 0
@@ -19,7 +19,7 @@ fun alarmClock() {
if (Config.notifyZombieVillager && l.contains("8:00pm") && (currTime - lastUpdate) > 15000) {
lastUpdate = currTime
val color = Utils.getColorString(Config.bestiaryNotifColor)
- DulkirMod.titleUtils.drawStringForTime("${color}Zombie Villager", 5000)
+ TitleUtils.drawStringForTime("${color}Zombie Villager", 5000)
if (Config.bestiaryAlertSounds)
mc.thePlayer.playSound("mob.villager.yes", 1f * Config.bestiaryNotifVol, 0f)
}
@@ -27,7 +27,7 @@ fun alarmClock() {
else if (Config.notifyGhast && l.contains("9:00pm") && (currTime - lastUpdate) > 15000) {
lastUpdate = currTime
val color = Utils.getColorString(Config.bestiaryNotifColor)
- DulkirMod.titleUtils.drawStringForTime("${color}Ghast", 5000)
+ TitleUtils.drawStringForTime("${color}Ghast", 5000)
if (Config.bestiaryAlertSounds)
mc.thePlayer.playSound("mob.ghast.scream", 1f * Config.bestiaryNotifVol, 1f)
}
diff --git a/src/main/kotlin/dulkirmod/features/ArachneTimer.kt b/src/main/kotlin/dulkirmod/features/ArachneTimer.kt
index 5c97c86..4cb63f9 100644
--- a/src/main/kotlin/dulkirmod/features/ArachneTimer.kt
+++ b/src/main/kotlin/dulkirmod/features/ArachneTimer.kt
@@ -10,7 +10,7 @@ import net.minecraftforge.client.event.RenderWorldLastEvent
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-class ArachneTimer {
+object ArachneTimer {
private var startmillis: Long = -1
private var endmillis: Long = -1
private var spawnmillis: Long = -1
diff --git a/src/main/kotlin/dulkirmod/features/BrokenHypeNotif.kt b/src/main/kotlin/dulkirmod/features/BrokenHypeNotif.kt
index 27225ff..589c046 100644
--- a/src/main/kotlin/dulkirmod/features/BrokenHypeNotif.kt
+++ b/src/main/kotlin/dulkirmod/features/BrokenHypeNotif.kt
@@ -1,9 +1,9 @@
package dulkirmod.features
-import dulkirmod.DulkirMod
import dulkirmod.DulkirMod.Companion.mc
import dulkirmod.config.Config
import dulkirmod.utils.TabListUtils
+import dulkirmod.utils.TitleUtils
import dulkirmod.utils.Utils
import net.minecraft.item.ItemStack
import net.minecraft.nbt.NBTTagCompound
@@ -61,7 +61,7 @@ fun brokenHypeNotif() {
if (oldKill != kill && oldChampionXp == championXp && TabListUtils.area != "Private Island") {
mc.thePlayer.playSound("random.anvil_land", 1f * Config.bestiaryNotifVol, 0f)
val color = Utils.getColorString(Config.bestiaryNotifColor)
- DulkirMod.titleUtils.drawStringForTime("${color}Hype Broken", 5000)
+ TitleUtils.drawStringForTime("${color}Hype Broken", 5000)
}
// update item regardless of whether it is bugged or not
oldKill = kill
diff --git a/src/main/kotlin/dulkirmod/features/Croesus.kt b/src/main/kotlin/dulkirmod/features/Croesus.kt
index 36bf3ee..ea8b022 100644
--- a/src/main/kotlin/dulkirmod/features/Croesus.kt
+++ b/src/main/kotlin/dulkirmod/features/Croesus.kt
@@ -9,75 +9,76 @@ import net.minecraft.nbt.NBTTagList
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
-class Croesus {
-
- var lastGuiOpenEvent: Long = 0
- var lastPageNumber = 1
-
- @SubscribeEvent
- fun onTick(event: TickEvent.ClientTickEvent) {
- val lastInCroesus = inCroesusBool
- var pageNumber = 1
-
- if (!Config.hideOpenedChests) return
- if (mc.currentScreen == null || !(mc.currentScreen is GuiChest)) {
- inCroesusBool = false
- return
- }
- inCroesusBool = (ContainerNameUtil.currentGuiChestName == "Croesus")
-
- if (inCroesusBool) {
- pageNumber = findPageNumber()
- }
-
- // weird way of detecting page turn
- if(lastPageNumber != pageNumber)
- lastGuiOpenEvent = System.currentTimeMillis()
-
- if (inCroesusBool && !lastInCroesus) {
- lastGuiOpenEvent = System.currentTimeMillis()
- }
-
- if (inCroesusBool && System.currentTimeMillis() - lastGuiOpenEvent < 300) {
- for (i in 9..44) {
- boolArray[i - 9] = false
- val slotIn = mc.thePlayer.openContainer.getSlot(i)
-
- if (slotIn.stack == null) continue
- val stack = slotIn.stack
-
- val tagList: NBTTagList = stack.getSubCompound("display", false)?.getTagList("Lore", 8) ?: continue
- for (j in 0 until tagList.tagCount()) {
- if (tagList.getStringTagAt(j) == "§aChests have been opened!") boolArray[i - 9] = true
- }
- }
- }
- }
-
- private fun findPageNumber(): Int {
- val stackPrev = mc.thePlayer.openContainer.getSlot(45).stack ?: return lastPageNumber
-
- val stackPrevLore = stackPrev.getSubCompound("display", false)?.getTagList("Lore", 8) ?: return 1
-
- if (stackPrevLore.getStringTagAt(0).contains("1")) return 2
-
- return 3
- }
-
- companion object {
- var inCroesusBool: Boolean = false
- var boolArray = BooleanArray(36) { false }
-
- fun inCroesus(): Boolean {
- return inCroesusBool
- }
-
- fun isChestOpened(slotIn: Slot): Boolean {
- if (!inCroesusBool) return false
- if (slotIn.inventory == mc.thePlayer.inventory) return false
- val slotindex = slotIn.slotIndex
- if (slotindex !in 9..44) return false
- return boolArray[slotindex - 9]
- }
- }
+object Croesus {
+
+ var lastGuiOpenEvent: Long = 0
+ var lastPageNumber = 1
+
+ @SubscribeEvent
+ fun onTick(event: TickEvent.ClientTickEvent) {
+ val lastInCroesus = inCroesusBool
+ var pageNumber = 1
+
+ if (!Config.hideOpenedChests) return
+ if (mc.currentScreen == null || !(mc.currentScreen is GuiChest)) {
+ inCroesusBool = false
+ return
+ }
+ inCroesusBool = (ContainerNameUtil.currentGuiChestName == "Croesus")
+
+ if (inCroesusBool) {
+ pageNumber = findPageNumber()
+ }
+
+ // weird way of detecting page turn
+ if (lastPageNumber != pageNumber)
+ lastGuiOpenEvent = System.currentTimeMillis()
+
+ if (inCroesusBool && !lastInCroesus) {
+ lastGuiOpenEvent = System.currentTimeMillis()
+ }
+
+ if (inCroesusBool && System.currentTimeMillis() - lastGuiOpenEvent < 300) {
+ for (i in 9..44) {
+ boolArray[i - 9] = false
+ val slotIn = mc.thePlayer.openContainer.getSlot(i)
+
+ if (slotIn.stack == null) continue
+ val stack = slotIn.stack
+
+ val tagList: NBTTagList = stack.getSubCompound("display", false)?.getTagList("Lore", 8) ?: continue
+ for (j in 0 until tagList.tagCount()) {
+ if (tagList.getStringTagAt(j) == "§aChests have been opened!") boolArray[i - 9] = true
+ }
+ }
+ }
+ }
+
+ private fun findPageNumber(): Int {
+ val stackPrev = mc.thePlayer.openContainer.getSlot(45).stack ?: return lastPageNumber
+
+ val stackPrevLore = stackPrev.getSubCompound("display", false)?.getTagList("Lore", 8) ?: return 1
+
+ if (stackPrevLore.getStringTagAt(0).contains("1")) return 2
+
+ return 3
+ }
+
+ var inCroesusBool: Boolean = false
+
+ var boolArray = BooleanArray(36) { false }
+
+ @JvmStatic
+ fun inCroesus(): Boolean {
+ return inCroesusBool
+ }
+
+ @JvmStatic
+ fun isChestOpened(slotIn: Slot): Boolean {
+ if (!inCroesusBool) return false
+ if (slotIn.inventory == mc.thePlayer.inventory) return false
+ val slotindex = slotIn.slotIndex
+ if (slotindex !in 9..44) return false
+ return boolArray[slotindex - 9]
+ }
} \ No newline at end of file
diff --git a/src/main/kotlin/dulkirmod/features/DragonTimer.kt b/src/main/kotlin/dulkirmod/features/DragonTimer.kt
index 0716cef..df1f12f 100644
--- a/src/main/kotlin/dulkirmod/features/DragonTimer.kt
+++ b/src/main/kotlin/dulkirmod/features/DragonTimer.kt
@@ -12,125 +12,118 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.awt.Color
import kotlin.math.max
-class DragonTimer {
- data class Dragon (val color: String, val pos: Vec3, var spawnTime: Long)
-
- companion object {
- var dragons = arrayOf(
- Dragon("orange", Vec3(84.0, 18.0, 56.0), 0),
- Dragon("red", Vec3(27.0, 18.0, 56.0), 0),
- Dragon("green", Vec3(26.0, 18.0, 95.0), 0),
- Dragon("purple", Vec3(57.0, 18.0, 125.0), 0),
- Dragon("blue", Vec3(84.0, 18.0, 95.0), 0)
- )
- }
-
- /**
- * Called from within the MixinWorld Class
- */
- fun handleNewParticle(particleID: Int, xCoord: Double, yCoord: Double, zCoord: Double) {
- if (particleID != 26) return
- if (!ScoreBoardUtils.isInM7) return
- if (!Config.dragonTimer) return
- //TextUtils.info("§6particle id ${particleID} 175 = $p_175720_2_")
-
- val particleVec = Vec3(xCoord, yCoord, zCoord)
- for (d in dragons) {
- if (inRangeOf(d.color, particleVec)) {
- if (System.currentTimeMillis() - d.spawnTime > 10000) {
- d.spawnTime = System.currentTimeMillis()
- }
- }
- }
- }
-
- @SubscribeEvent
- fun onRenderWorld(event: RenderWorldLastEvent) {
- val curTime: Long = System.currentTimeMillis()
- // for some reason this really doesn't like the syntax for (d in dragons)
- for (i in 0..4) {
- // d.spawnTime + 5000 is when dragon actually spawn
- val d = dragons[i]
- if (d.spawnTime + 5000 > curTime) {
- if (isDead(d.color))
- return
- val timeUntilSpawn: Float = ((d.spawnTime + 5000 - curTime).toFloat() / 1000f)
- val color = when {
- timeUntilSpawn <= 1 -> "§c"
- timeUntilSpawn <= 3 -> "§e"
- else -> "§a"
- }
- val playerVec = mc.thePlayer.positionVector
- val scale = max(1f, playerVec.distanceTo(d.pos).toFloat()/5f)
- WorldRenderUtils.renderString(d.pos, "${color}${String.format("%.2f", timeUntilSpawn)}",
- false, scale, true)
- }
- }
- }
-
- /**
- * true = dead
- */
- private fun isDead(color:String): Boolean {
- val world: World = mc.theWorld
- val pos = when (color) {
- "orange" -> BlockPos(90, 21, 56)
- "red" -> BlockPos(20,22,59)
- "green" -> BlockPos(22,21,94)
- "purple" -> BlockPos(56,20,130)
- "blue" -> BlockPos(89,21,94)
- else -> BlockPos(0,0,0)
- }
- return world.isAirBlock(pos)
- }
- private fun inRangeOf(color: String, pos: Vec3): Boolean {
- when (color) {
- "orange" -> {
- return (pos.xCoord.toInt() in 82..88
- && pos.yCoord.toInt() in 15..22
- && pos.zCoord.toInt() in 53..59)
- }
- "red" -> {
- return (pos.xCoord.toInt() in 24..30
- && pos.yCoord.toInt() in 15..22
- && pos.zCoord.toInt() in 56..62)
- }
- "green" -> {
- return (pos.xCoord.toInt() in 23..29
- && pos.yCoord.toInt() in 15..22
- && pos.zCoord.toInt() in 91..97)
- }
- "purple" -> {
- return (pos.xCoord.toInt() in 53..59
- && pos.yCoord.toInt() in 15..22
- && pos.zCoord.toInt() in 122..128)
- }
- "blue" -> {
- return (pos.xCoord.toInt() in 82..88
- && pos.yCoord.toInt() in 15..22
- && pos.zCoord.toInt() in 91..97)
- }
- else -> {
- return false
- }
- }
- }
-
- @SubscribeEvent
- fun dragonBoxes(event: RenderWorldLastEvent) {
- if (!Config.dragonKillBox) return
- if (!ScoreBoardUtils.isInM7) return
- if (mc.thePlayer.positionVector.yCoord > 45) return
- // Blue
- WorldRenderUtils.drawCustomBox(71.5, 25.0, 16.0, 10.0, 82.5, 25.0, Color(0, 170, 170, 255), 3f, phase = false)
- // Purple
- WorldRenderUtils.drawCustomBox(45.5, 23.0, 13.0, 10.0, 113.5, 23.0, Color(170, 0, 170, 255), 3f, phase = false)
- // Green
- WorldRenderUtils.drawCustomBox(7.0, 30.0, 8.0, 20.0, 80.0, 30.0, Color(85, 255, 85, 255), 3f, phase = false)
- // Red
- 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)
- }
-}
+object DragonTimer {
+ data class Dragon(val color: String, val pos: Vec3, var spawnTime: Long)
+ private val dragons = arrayOf(
+ Dragon("orange", Vec3(84.0, 18.0, 56.0), 0),
+ Dragon("red", Vec3(27.0, 18.0, 56.0), 0),
+ Dragon("green", Vec3(26.0, 18.0, 95.0), 0),
+ Dragon("purple", Vec3(57.0, 18.0, 125.0), 0),
+ Dragon("blue", Vec3(84.0, 18.0, 95.0), 0)
+ )
+
+ /**
+ * Called from within the MixinWorld Class
+ */
+ fun handleNewParticle(pID: Int, x: Double, y: Double, z: Double) {
+ if (!Config.dragonTimer) 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 {
+ if (System.currentTimeMillis() - it.spawnTime < 10000 || !inRangeOf(it.color, particleVec)) return@forEach
+ it.spawnTime = System.currentTimeMillis()
+ }
+ }
+
+ @SubscribeEvent
+ fun onRenderWorld(event: RenderWorldLastEvent) {
+ renderDragonBoxes()
+
+ if (!Config.dragonTimer) return
+ val curTime = System.currentTimeMillis()
+ dragons.forEach {
+ if (it.spawnTime + 5000 < curTime || isDead(it.color)) return@forEach
+ val timeUntilSpawn = (it.spawnTime + 5000 - curTime) / 1000f
+ val color = when {
+ timeUntilSpawn <= 1 -> "§c"
+ timeUntilSpawn <= 3 -> "§e"
+ else -> "§a"
+ }
+
+ val scale = max(1.0, mc.thePlayer.positionVector.distanceTo(it.pos) / 5.0).toFloat()
+
+ WorldRenderUtils.renderString(
+ it.pos, "${color}${String.format("%.2f", timeUntilSpawn)}", false, scale, true
+ )
+ }
+ }
+
+ /**
+ * true = dead
+ */
+ private fun isDead(color: String): Boolean {
+ val world: World = mc.theWorld
+ val pos = when (color) {
+ "orange" -> BlockPos(90, 21, 56)
+ "red" -> BlockPos(20, 22, 59)
+ "green" -> BlockPos(22, 21, 94)
+ "purple" -> BlockPos(56, 20, 130)
+ "blue" -> BlockPos(89, 21, 94)
+ else -> BlockPos(0, 0, 0)
+ }
+ return world.isAirBlock(pos)
+ }
+
+ private fun inRangeOf(color: String, pos: Vec3): Boolean {
+ val x = pos.xCoord.toInt()
+ val y = pos.yCoord.toInt()
+ val z = pos.zCoord.toInt()
+
+ return when (color) {
+ "orange" -> {
+ x in 82..88 && y in 15..22 && z in 53..59
+ }
+
+ "red" -> {
+ x in 24..30 && y in 15..22 && z in 56..62
+ }
+
+ "green" -> {
+ x in 23..29 && y in 15..22 && z in 91..97
+ }
+
+ "purple" -> {
+ x in 53..59 && y in 15..22 && z in 122..128
+ }
+
+ "blue" -> {
+ x in 82..88 && y in 15..22 && z in 91..97
+ }
+
+ else -> {
+ false
+ }
+ }
+ }
+
+ private fun renderDragonBoxes() {
+ if (!Config.dragonKillBox) return
+ if (!ScoreBoardUtils.isInM7) return
+ if (mc.thePlayer.positionVector.yCoord > 45) return
+ // Blue
+ WorldRenderUtils.drawCustomBox(71.5, 25.0, 16.0, 10.0, 82.5, 25.0, Color(0, 170, 170, 255), 3f, phase = false)
+ // Purple
+ WorldRenderUtils.drawCustomBox(45.5, 23.0, 13.0, 10.0, 113.5, 23.0, Color(170, 0, 170, 255), 3f, phase = false)
+ // Green
+ WorldRenderUtils.drawCustomBox(7.0, 30.0, 8.0, 20.0, 80.0, 30.0, Color(85, 255, 85, 255), 3f, phase = false)
+ // Red
+ 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
diff --git a/src/main/kotlin/dulkirmod/features/DungeonLeap.kt b/src/main/kotlin/dulkirmod/features/DungeonLeap.kt
index d1be829..bfbfe50 100644
--- a/src/main/kotlin/dulkirmod/features/DungeonLeap.kt
+++ b/src/main/kotlin/dulkirmod/features/DungeonLeap.kt
@@ -9,52 +9,46 @@ import net.minecraft.inventory.Slot
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
-class DungeonLeap {
-
-
- private var lastGuiOpenEvent: Long = 0
-
- @SubscribeEvent
- fun onTick(event: TickEvent.ClientTickEvent) {
- val lastInLeap = inLeapMenuBool
-
- if (!Config.highlightLeap) return
- if (mc.currentScreen == null || mc.currentScreen !is GuiChest) {
- inLeapMenuBool = false
- return
- }
- inLeapMenuBool = (ContainerNameUtil.currentGuiChestName == "Spirit Leap")
-
- if (inLeapMenuBool && !lastInLeap) {
- lastGuiOpenEvent = System.currentTimeMillis()
- }
-
- if (inLeapMenuBool && System.currentTimeMillis() - lastGuiOpenEvent < 300) {
- for (i in 11..15) {
- boolArray[i - 11] = false
- val slotIn = mc.thePlayer.openContainer.getSlot(i)
-
- if (slotIn.stack == null) continue
- val stack = slotIn.stack
- if (Utils.stripColorCodes(stack.displayName).lowercase() == Config.highlightLeapName.lowercase()) boolArray[i - 11] = true
- }
- }
- }
-
- companion object {
- var inLeapMenuBool: Boolean = false
- var boolArray = BooleanArray(5) { false }
-
- fun inLeapMenu(): Boolean {
- return inLeapMenuBool
- }
-
- fun isHighlightedLeapPlayer(slotIn: Slot): Boolean {
- if (!inLeapMenuBool) return false
- if (slotIn.inventory == mc.thePlayer.inventory) return false
- val slotIndex = slotIn.slotIndex
- if (slotIndex !in 11..15) return false
- return boolArray[slotIndex - 11]
- }
- }
+object DungeonLeap {
+ var inLeapMenu = false
+ var leapPlayers = BooleanArray(5) { false }
+
+ private var lastGuiOpenEvent = 0L
+
+ @SubscribeEvent
+ fun onTick(event: TickEvent.ClientTickEvent) {
+ val lastInLeap = inLeapMenu
+
+ if (!Config.highlightLeap) return
+ if (mc.currentScreen == null || mc.currentScreen !is GuiChest) {
+ inLeapMenu = false
+ return
+ }
+ inLeapMenu = (ContainerNameUtil.currentGuiChestName == "Spirit Leap")
+
+ if (inLeapMenu && !lastInLeap) {
+ lastGuiOpenEvent = System.currentTimeMillis()
+ }
+
+ if (inLeapMenu && System.currentTimeMillis() - lastGuiOpenEvent < 300) {
+ for (i in 11..15) {
+ leapPlayers[i - 11] = false
+ val slotIn = mc.thePlayer.openContainer.getSlot(i)
+
+ if (slotIn.stack == null) continue
+ val stack = slotIn.stack
+ if (Utils.stripColorCodes(stack.displayName).equals(Config.highlightLeapName, true)) {
+ leapPlayers[i - 11] = true
+ }
+ }
+ }
+ }
+
+ fun isHighlightedLeapPlayer(slotIn: Slot): Boolean {
+ if (!inLeapMenu) return false
+ if (slotIn.inventory == mc.thePlayer.inventory) return false
+ val slotIndex = slotIn.slotIndex
+ if (slotIndex !in 11..15) return false
+ return leapPlayers[slotIndex - 11]
+ }
} \ No newline at end of file
diff --git a/src/main/kotlin/dulkirmod/features/GardenVisitorAlert.kt b/src/main/kotlin/dulkirmod/features/GardenVisitorAlert.kt
index b3113bd..8bcd145 100644
--- a/src/main/kotlin/dulkirmod/features/GardenVisitorAlert.kt
+++ b/src/main/kotlin/dulkirmod/features/GardenVisitorAlert.kt
@@ -3,9 +3,10 @@ package dulkirmod.features
import dulkirmod.DulkirMod
import dulkirmod.config.Config
import dulkirmod.utils.TabListUtils
+import dulkirmod.utils.TitleUtils
import dulkirmod.utils.Utils
-class GardenVisitorAlert {
+object GardenVisitorAlert {
private var hasSentAlert = false
private var lastAlert = 0
@@ -19,7 +20,7 @@ class GardenVisitorAlert {
if (TabListUtils.maxVisitors && !hasSentAlert) {
val color = Utils.getColorString(Config.bestiaryNotifColor)
- DulkirMod.titleUtils.drawStringForTime("${color}Max Visitors", 5000)
+ TitleUtils.drawStringForTime("${color}Max Visitors", 5000)
DulkirMod.mc.thePlayer.playSound("note.pling", 1f * Config.bestiaryNotifVol, .3f)
DulkirMod.mc.thePlayer.playSound("note.pling", 1f * Config.bestiaryNotifVol, .6f)
DulkirMod.mc.thePlayer.playSound("note.pling", 1f * Config.bestiaryNotifVol, .9f)
@@ -32,7 +33,7 @@ class GardenVisitorAlert {
if (TabListUtils.maxVisitors && hasSentAlert && timeSinceLastAlert > 5000 && Config.persistentAlert) {
lastAlert = System.currentTimeMillis().toInt()
val color = Utils.getColorString(Config.bestiaryNotifColor)
- DulkirMod.titleUtils.drawStringForTime("${color}Max Visitors", 5000)
+ TitleUtils.drawStringForTime("${color}Max Visitors", 5000)
DulkirMod.mc.thePlayer.playSound("note.pling", 1f * Config.bestiaryNotifVol, .3f)
DulkirMod.mc.thePlayer.playSound("note.pling", 1f * Config.bestiaryNotifVol, .6f)
DulkirMod.mc.thePlayer.playSound("note.pling", 1f * Config.bestiaryNotifVol, .9f)
diff --git a/src/main/kotlin/dulkirmod/features/KeeperWaypoints.kt b/src/main/kotlin/dulkirmod/features/KeeperWaypoints.kt
index 6e47a59..c65b3dd 100644
--- a/src/main/kotlin/dulkirmod/features/KeeperWaypoints.kt
+++ b/src/main/kotlin/dulkirmod/features/KeeperWaypoints.kt
@@ -10,7 +10,7 @@ import net.minecraftforge.client.event.RenderWorldLastEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.math.max
-class KeeperWaypoints {
+object KeeperWaypoints {
@SubscribeEvent
fun onWorldRenderLast(event: RenderWorldLastEvent) {
if (!Config.keeperWaypoints) return
diff --git a/src/main/kotlin/dulkirmod/features/MatchoAlert.kt b/src/main/kotlin/dulkirmod/features/MatchoAlert.kt
index db51a48..50f433e 100644
--- a/src/main/kotlin/dulkirmod/features/MatchoAlert.kt
+++ b/src/main/kotlin/dulkirmod/features/MatchoAlert.kt
@@ -3,9 +3,10 @@ package dulkirmod.features
import dulkirmod.DulkirMod
import dulkirmod.config.Config
import dulkirmod.utils.TabListUtils
+import dulkirmod.utils.TitleUtils
import dulkirmod.utils.Utils
-class MatchoAlert {
+object MatchoAlert {
var hasSentAlert = false
@@ -19,7 +20,7 @@ class MatchoAlert {
if (TabListUtils.explosivity && !hasSentAlert) {
val color = Utils.getColorString(Config.bestiaryNotifColor)
- DulkirMod.titleUtils.drawStringForTime("${color}Matcho", 5000)
+ TitleUtils.drawStringForTime("${color}Matcho", 5000)
if (Config.bestiaryAlertSounds)
DulkirMod.mc.thePlayer.playSound("mob.villager.yes", 1f * Config.bestiaryNotifVol, 0f)
hasSentAlert = true
diff --git a/src/main/kotlin/dulkirmod/features/MemoryLeakFix.kt b/src/main/kotlin/dulkirmod/features/MemoryLeakFix.kt
new file mode 100644
index 0000000..a4dfc9b
--- /dev/null
+++ b/src/main/kotlin/dulkirmod/features/MemoryLeakFix.kt
@@ -0,0 +1,34 @@
+package dulkirmod.features
+
+import dulkirmod.DulkirMod.Companion.mc
+import dulkirmod.config.Config
+import net.minecraft.entity.Entity
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import net.minecraftforge.fml.common.gameevent.TickEvent
+
+object MemoryLeakFix {
+ var lastClear = System.currentTimeMillis()
+
+ @SubscribeEvent
+ fun onTick(event: TickEvent.ClientTickEvent) {
+ if (!Config.crimsonIslesMemoryLeakPatch) return
+
+ if (System.currentTimeMillis() - lastClear >= 30000L) {
+ val world = mc.theWorld ?: return
+ val currentEnts = world.playerEntities.toMutableList()
+ currentEnts.forEach {
+ if (it.isDead) {
+ world.playerEntities.remove(it)
+ }
+ if (isNullVec(it)) {
+ world.removeEntityFromWorld(it.entityId)
+ }
+ }
+ lastClear = System.currentTimeMillis()
+ }
+ }
+
+ private fun isNullVec(entity: Entity): Boolean {
+ return entity.posX == 0.0 && entity.posY == 0.0 && entity.posZ == 0.0
+ }
+} \ No newline at end of file
diff --git a/src/main/kotlin/dulkirmod/features/chat/AbiphoneDND.kt b/src/main/kotlin/dulkirmod/features/chat/AbiphoneDND.kt
index a6a0ab6..9b429cb 100644
--- a/src/main/kotlin/dulkirmod/features/chat/AbiphoneDND.kt
+++ b/src/main/kotlin/dulkirmod/features/chat/AbiphoneDND.kt
@@ -10,7 +10,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
private val abiphoneFormat = "✆ (\\w+) ✆ ".toRegex()
private var lastRing: Long = 0
-class AbiphoneDND {
+object AbiphoneDND {
//BLOCK ABIPHONE SOUNDS
@SubscribeEvent(receiveCanceled = false, priority = EventPriority.LOW)
fun onSound(event: PlaySoundEvent) {
@@ -22,24 +22,22 @@ class AbiphoneDND {
}
}
- companion object {
- fun handle(event: ClientChatReceivedEvent, unformatted: String) {
- if (!Config.abiDND) return
- if (unformatted matches abiphoneFormat) {
- val matchResult = abiphoneFormat.find(unformatted)
- event.isCanceled = true
- lastRing = System.currentTimeMillis()
- if (Config.abiCallerID) {
- val blocked = if (Math.random() < .001) "Breefing"
- else matchResult?.groups?.get(1)?.value
- TextUtils.info("§6Call blocked from $blocked!")
- }
- }
- if (unformatted.startsWith("✆ Ring...") && unformatted.endsWith("[PICK UP]")
- && System.currentTimeMillis() - lastRing < 5000
- ) {
- event.isCanceled = true
+ fun handle(event: ClientChatReceivedEvent, unformatted: String) {
+ if (!Config.abiDND) return
+ if (unformatted matches abiphoneFormat) {
+ val matchResult = abiphoneFormat.find(unformatted)
+ event.isCanceled = true
+ lastRing = System.currentTimeMillis()
+ if (Config.abiCallerID) {
+ val blocked = if (Math.random() < .001) "Breefing"
+ else matchResult?.groups?.get(1)?.value
+ TextUtils.info("§6Call blocked from $blocked!")
}
}
+ if (unformatted.startsWith("✆ Ring...") && unformatted.endsWith("[PICK UP]")
+ && System.currentTimeMillis() - lastRing < 5000
+ ) {
+ event.isCanceled = true
+ }
}
} \ No newline at end of file
diff --git a/src/main/kotlin/dulkirmod/features/chat/FakeMsg.kt b/src/main/kotlin/dulkirmod/features/chat/FakeMsg.kt
index 8e4d2dd..ca78dae 100644
--- a/src/main/kotlin/dulkirmod/features/chat/FakeMsg.kt
+++ b/src/main/kotlin/dulkirmod/features/chat/FakeMsg.kt
@@ -6,9 +6,9 @@ import net.minecraftforge.client.event.ClientChatReceivedEvent
object FakeMsg {
private val dulkirRegex = "^From \\[MVP(\\+|\\+\\+)] Dulkir: c:".toRegex()
fun handle(event: ClientChatReceivedEvent, unformatted: String) {
- if (dulkirRegex.matches(unformatted)) {
+ if (unformatted.contains(dulkirRegex)) {
event.isCanceled = true
- val message = unformatted.replace(dulkirRegex, "").replace("&", "§")
+ val message = unformatted.replace(dulkirRegex, "").replace("&", "§").trim()
TextUtils.info(message, false)
}
}
diff --git a/src/main/kotlin/dulkirmod/utils/ContainerNameUtil.kt b/src/main/kotlin/dulkirmod/utils/ContainerNameUtil.kt
index 706bcea..d067675 100644
--- a/src/main/kotlin/dulkirmod/utils/ContainerNameUtil.kt
+++ b/src/main/kotlin/dulkirmod/utils/ContainerNameUtil.kt
@@ -6,16 +6,14 @@ import net.minecraft.inventory.ContainerChest
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
-class ContainerNameUtil {
- @SubscribeEvent
- fun onTick(event: TickEvent.ClientTickEvent) {
- if (mc.currentScreen !is GuiChest) return
- val chest = mc.currentScreen as GuiChest
- val container = chest.inventorySlots as ContainerChest
- currentGuiChestName = container.lowerChestInventory.displayName.unformattedText
- }
+object ContainerNameUtil {
+ var currentGuiChestName = ""
- companion object {
- var currentGuiChestName = ""
- }
+ @SubscribeEvent
+ fun onTick(event: TickEvent.ClientTickEvent) {
+ val chest = mc.currentScreen
+ if (chest !is GuiChest) return
+ val container = chest.inventorySlots as ContainerChest
+ currentGuiChestName = container.lowerChestInventory.displayName.unformattedText
+ }
} \ No newline at end of file
diff --git a/src/main/kotlin/dulkirmod/utils/TitleUtils.kt b/src/main/kotlin/dulkirmod/utils/TitleUtils.kt
index b7399c3..8932878 100644
--- a/src/main/kotlin/dulkirmod/utils/TitleUtils.kt
+++ b/src/main/kotlin/dulkirmod/utils/TitleUtils.kt
@@ -8,7 +8,7 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.math.min
-class TitleUtils {
+object TitleUtils {
var curString = ""
var endTime: Long = 0
diff --git a/src/main/kotlin/dulkirmod/utils/Utils.kt b/src/main/kotlin/dulkirmod/utils/Utils.kt
index 2ae50cc..ce19b32 100644
--- a/src/main/kotlin/dulkirmod/utils/Utils.kt
+++ b/src/main/kotlin/dulkirmod/utils/Utils.kt
@@ -11,60 +11,54 @@ import java.awt.datatransfer.StringSelection
import java.util.*
object Utils {
- fun stripColorCodes(string: String): String {
- return string.replace("§.".toRegex(), "")
- }
+ fun stripColorCodes(string: String): String {
+ return string.replace("§.".toRegex(), "")
+ }
- fun animationConfigToString() {
- var s = ""
- var gson = Gson()
- var jsonString = gson.toJson(ConfigData())
- s = Base64.getEncoder().encodeToString(jsonString.toByteArray())
- // set clipboard
- val selection = StringSelection(s)
- val clipboard: Clipboard = Toolkit.getDefaultToolkit().systemClipboard
- clipboard.setContents(selection, selection)
- }
+ fun animationConfigToString() {
+ var s = ""
+ var gson = Gson()
+ var jsonString = gson.toJson(ConfigData())
+ s = Base64.getEncoder().encodeToString(jsonString.toByteArray())
+ // set clipboard
+ val selection = StringSelection(s)
+ val clipboard: Clipboard = Toolkit.getDefaultToolkit().systemClipboard
+ clipboard.setContents(selection, selection)
+ }
- fun animationStringtoConfig() {
- val gson = Gson()
- val clipboard: Clipboard = Toolkit.getDefaultToolkit().systemClipboard
- val base64 = clipboard.getData(DataFlavor.stringFlavor) as String
- try {
- val jsonString = String(Base64.getDecoder().decode(base64))
- val import = gson.fromJson(jsonString, ConfigData::class.java)
- Config.customSize = import.size
- Config.customSpeed = import.speed
- Config.doesScaleSwing = import.scaleSwing
- Config.customX = import.x
- Config.customY = import.y
- Config.customZ = import.z
- Config.customYaw = import.yaw
- Config.customPitch = import.pitch
- Config.customRoll = import.roll
- Config.drinkingSelector = import.drinkingFix
- Config.ignoreHaste = import.ignoreHaste
- } catch (e: Exception) {
- TextUtils.info("§6§lCurrent clipboard is not a recognizable Custom Animation Preset.")
- }
- mc.displayGuiScreen(null)
- }
+ fun animationStringtoConfig() {
+ val gson = Gson()
+ val clipboard = Toolkit.getDefaultToolkit().systemClipboard
+ val base64 = clipboard.getData(DataFlavor.stringFlavor) as String
+ try {
+ val jsonString = String(Base64.getDecoder().decode(base64))
+ val import = gson.fromJson(jsonString, ConfigData::class.java)
+ Config.customSize = import.size
+ Config.customSpeed = import.speed
+ Config.doesScaleSwing = import.scaleSwing
+ Config.customX = import.x
+ Config.customY = import.y
+ Config.customZ = import.z
+ Config.customYaw = import.yaw
+ Config.customPitch = import.pitch
+ Config.customRoll = import.roll
+ Config.drinkingSelector = import.drinkingFix
+ Config.ignoreHaste = import.ignoreHaste
+ } catch (e: Exception) {
+ TextUtils.info("§6§lCurrent clipboard is not a recognizable Custom Animation Preset.")
+ }
+ mc.displayGuiScreen(null)
+ }
- fun isInSkyblock(): Boolean {
- if ((mc.theWorld != null) && (mc.thePlayer != null)) {
- if (mc.isSingleplayer || mc.thePlayer.clientBrand == null ||
- !mc.thePlayer.clientBrand.lowercase(Locale.getDefault()).contains("hypixel")
- ) {
- return false
- }
- if (mc.thePlayer.worldScoreboard.getObjectiveInDisplaySlot(1) == null)
- return false
- return stripColorCodes(mc.thePlayer.worldScoreboard.getObjectiveInDisplaySlot(1).displayName).contains("SKYBLOCK")
- }
- return false
- }
+ fun isInSkyblock(): Boolean {
+ if (mc.theWorld == null || mc.thePlayer == null) return false
+ if (mc.isSingleplayer) return false
+ if (mc.thePlayer.clientBrand?.contains("hypixel", true) == false) return false
+ val objective = mc.thePlayer.worldScoreboard.getObjectiveInDisplaySlot(1) ?: return false
+ return stripColorCodes(objective.displayName).contains("skyblock", true)
+ }
- fun getColorString(int: Int): String {
- return if (int == 16) "§z" else EnumChatFormatting.values()[int].toString()
- }
+ fun getColorString(int: Int): String {
+ return if (int == 16) "§z" else EnumChatFormatting.values()[int].toString()
+ }
} \ No newline at end of file