aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/dulkirmod/mixins/MixinGuiContainer.java24
-rw-r--r--src/main/kotlin/dulkirmod/DulkirMod.kt4
-rw-r--r--src/main/kotlin/dulkirmod/command/LeapNameCommand.kt25
-rw-r--r--src/main/kotlin/dulkirmod/config/Config.kt11
-rw-r--r--src/main/kotlin/dulkirmod/events/ChatEvent.kt15
-rw-r--r--src/main/kotlin/dulkirmod/events/caller.txt4
-rw-r--r--src/main/kotlin/dulkirmod/features/Croesus.kt59
-rw-r--r--src/main/kotlin/dulkirmod/features/DungeonLeap.kt57
-rw-r--r--src/main/kotlin/dulkirmod/forge/FMLLoadingPlugin.kt28
-rw-r--r--src/main/kotlin/dulkirmod/utils/ContainerNameUtil.kt21
10 files changed, 187 insertions, 61 deletions
diff --git a/src/main/java/dulkirmod/mixins/MixinGuiContainer.java b/src/main/java/dulkirmod/mixins/MixinGuiContainer.java
index 6796703..2ffa02d 100644
--- a/src/main/java/dulkirmod/mixins/MixinGuiContainer.java
+++ b/src/main/java/dulkirmod/mixins/MixinGuiContainer.java
@@ -4,7 +4,11 @@ import dulkirmod.features.Croesus;
import dulkirmod.features.DungeonLeap;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.init.Blocks;
import net.minecraft.inventory.Slot;
+import net.minecraft.item.EnumDyeColor;
+import net.minecraft.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@@ -18,7 +22,25 @@ public abstract class MixinGuiContainer extends GuiScreen {
ci.cancel();
}
if (DungeonLeap.Companion.inLeapMenu() && DungeonLeap.Companion.isHighlightedLeapPlayer(slotIn)) {
- // TODO
+ ci.cancel();
+
+ ItemStack stack = new ItemStack(Blocks.wool, 1, EnumDyeColor.GREEN.getMetadata());
+
+ this.zLevel = 100.0F;
+ this.itemRender.zLevel = 100.0F;
+
+ GlStateManager.enableDepth();
+ this.itemRender.renderItemAndEffectIntoGUI(
+ stack,
+ slotIn.xDisplayPosition,
+ slotIn.yDisplayPosition
+ );
+ this.itemRender.renderItemOverlayIntoGUI(this.fontRendererObj, stack,
+ slotIn.xDisplayPosition, slotIn.yDisplayPosition, ""
+ );
+
+ this.itemRender.zLevel = 0.0F;
+ this.zLevel = 0.0F;
}
}
}
diff --git a/src/main/kotlin/dulkirmod/DulkirMod.kt b/src/main/kotlin/dulkirmod/DulkirMod.kt
index 0273af4..0291226 100644
--- a/src/main/kotlin/dulkirmod/DulkirMod.kt
+++ b/src/main/kotlin/dulkirmod/DulkirMod.kt
@@ -4,6 +4,7 @@ import dulkirmod.command.*
import dulkirmod.config.Config
import dulkirmod.events.ChatEvent
import dulkirmod.features.*
+import dulkirmod.utils.ContainerNameUtil
import dulkirmod.utils.TitleUtils
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
@@ -49,6 +50,7 @@ class DulkirMod {
ClientCommandHandler.instance.registerCommand(FairyCommand())
ClientCommandHandler.instance.registerCommand(SettingsCommand())
ClientCommandHandler.instance.registerCommand(JoinDungeonCommand())
+ ClientCommandHandler.instance.registerCommand(LeapNameCommand())
}
@Mod.EventHandler
@@ -62,6 +64,8 @@ class DulkirMod {
MinecraftForge.EVENT_BUS.register(ArachneTimer())
MinecraftForge.EVENT_BUS.register(MatchoAlert())
MinecraftForge.EVENT_BUS.register(Croesus())
+ MinecraftForge.EVENT_BUS.register(ContainerNameUtil())
+ MinecraftForge.EVENT_BUS.register(DungeonLeap())
keyBinds.forEach(ClientRegistry::registerKeyBinding)
}
diff --git a/src/main/kotlin/dulkirmod/command/LeapNameCommand.kt b/src/main/kotlin/dulkirmod/command/LeapNameCommand.kt
new file mode 100644
index 0000000..3d7b4f2
--- /dev/null
+++ b/src/main/kotlin/dulkirmod/command/LeapNameCommand.kt
@@ -0,0 +1,25 @@
+package dulkirmod.command
+
+import dulkirmod.DulkirMod
+import dulkirmod.config.Config
+import net.minecraft.command.CommandException
+import net.minecraft.command.ICommandSender
+import net.minecraft.util.ChatComponentText
+
+class LeapNameCommand : ClientCommandBase("hl") {
+ @Throws(CommandException::class)
+ override fun processCommand(sender: ICommandSender, args: Array<String>) {
+ if (args.isEmpty()) {
+ DulkirMod.mc.thePlayer.addChatMessage(
+ ChatComponentText("${DulkirMod.CHAT_PREFIX} §6Please give a username argument (case sensitive) for who you want to be highlighted.")
+ )
+ return
+ }
+
+ val username = args[0]
+ Config.highlightLeapName = username
+ DulkirMod.mc.thePlayer.addChatMessage(
+ ChatComponentText("${DulkirMod.CHAT_PREFIX} §6Selected Leap Highlight for username: §f$username§6.")
+ )
+ }
+} \ 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 df69eca..d300b85 100644
--- a/src/main/kotlin/dulkirmod/config/Config.kt
+++ b/src/main/kotlin/dulkirmod/config/Config.kt
@@ -250,9 +250,17 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod", so
var hideOpenedChests = false
@Property(
+ type = PropertyType.SWITCH,
+ name = "Highlight custom player for leap in menu",
+ description = "changes texture to green wool!",
+ category = "Dungeons"
+ )
+ var highlightLeap = false
+
+ @Property(
type = PropertyType.TEXT,
name = "Highlighted player name",
- description = "Not case-sensitive",
+ description = "case-sensitive",
category = "Dungeons",
placeholder = "Dilkur",
protectedText = false
@@ -460,6 +468,7 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod", so
addDependency("throttleNotifierSpam", "throttleNotifier")
addDependency("bestiaryNotifVol", "bestiaryAlertSounds")
addDependency("demoVolume", "bestiaryAlertSounds")
+ addDependency("highlightLeapName", "highlightLeap")
setCategoryDescription(
"Custom Animations",
diff --git a/src/main/kotlin/dulkirmod/events/ChatEvent.kt b/src/main/kotlin/dulkirmod/events/ChatEvent.kt
index 290372a..3bddaea 100644
--- a/src/main/kotlin/dulkirmod/events/ChatEvent.kt
+++ b/src/main/kotlin/dulkirmod/events/ChatEvent.kt
@@ -13,7 +13,9 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class ChatEvent {
private val guildFormat = "^(§2Guild|§3Officer) > (?:\\S+ )?([\\w§]{3,18})(?: §[a-z0-9]\\[[A-Z]+])?§f: (\\w+) > .+".toRegex()
private val alternateFormat = "^(§2Guild|§3Officer) > (?:\\S+ )?([\\w§]{3,18})(?: §[a-z0-9]\\[[A-Z]+])?§f: (\\w+): .+".toRegex()
- private var lastThrottle : Long = 0;
+ private var lastThrottle : Long = 0
+ private var lastRing : Long = 0
+
@SubscribeEvent(receiveCanceled = true, priority = EventPriority.LOW)
fun onChat(event: ClientChatReceivedEvent) {
if (event.type == 2.toByte()) {
@@ -66,5 +68,16 @@ class ChatEvent {
).setChatStyle(event.message.siblings[1].chatStyle.createShallowCopy())
}
}
+
+ // DO NOT DISTURB FOR ABIPHONE
+ if (unformatted.equals("✆ \\w+ ✆".toRegex())) {
+ DulkirMod.mc.thePlayer.addChatMessage(
+ ChatComponentText("${DulkirMod.CHAT_PREFIX} §6Call blocked!")
+ )
+ event.isCanceled = true;
+ lastRing = System.currentTimeMillis()
+ }
+ if (unformatted.startsWith("✆ Ring...") && unformatted.endsWith("[PICK UP]") && System.currentTimeMillis() - lastRing < 4000)
+ event.isCanceled = true;
}
} \ No newline at end of file
diff --git a/src/main/kotlin/dulkirmod/events/caller.txt b/src/main/kotlin/dulkirmod/events/caller.txt
new file mode 100644
index 0000000..75ec9e9
--- /dev/null
+++ b/src/main/kotlin/dulkirmod/events/caller.txt
@@ -0,0 +1,4 @@
+✆ Aranya ✆
+§a✆ Ring... §2§l[PICK UP]
+§a✆ Ring... Ring... §2§l[PICK UP]
+§a✆ Ring... Ring... Ring... §2§l[PICK UP] \ No newline at end of file
diff --git a/src/main/kotlin/dulkirmod/features/Croesus.kt b/src/main/kotlin/dulkirmod/features/Croesus.kt
index 0ddfe9e..188c6a9 100644
--- a/src/main/kotlin/dulkirmod/features/Croesus.kt
+++ b/src/main/kotlin/dulkirmod/features/Croesus.kt
@@ -2,31 +2,60 @@ package dulkirmod.features
import dulkirmod.DulkirMod.Companion.mc
import dulkirmod.config.Config
+import dulkirmod.utils.ContainerNameUtil
import net.minecraft.client.gui.inventory.GuiChest
-import net.minecraft.inventory.ContainerChest
import net.minecraft.inventory.Slot
+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
+ @SubscribeEvent
+ fun onTick(event: TickEvent.ClientTickEvent) {
+ val lastInCroesus = inCroesusBool
+
+ if (!Config.hideOpenedChests) return
+ if (mc.currentScreen == null || !(mc.currentScreen is GuiChest)) {
+ inCroesusBool = false
+ return
+ }
+ inCroesusBool = (ContainerNameUtil.currentGuiChestName == "Croesus")
+
+ 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
+ if (stack.getSubCompound("display", true)?.getTagList("Lore", 8) == null) continue
+
+ val tagList: NBTTagList = stack.getSubCompound("display", true).getTagList("Lore", 8)
+ for (j in 0 until tagList.tagCount()) {
+ if (tagList.getStringTagAt(j) == "§aChests have been opened!") boolArray[i-9] = true
+ }
+ }
+ }
+ }
companion object {
- var currentlyOpenChestName = ""
+ var inCroesusBool : Boolean = false
+ var boolArray = BooleanArray(36) {false}
fun inCroesus(): Boolean {
- if (mc.currentScreen == null || !(mc.currentScreen is GuiChest)) return false
- val chest = mc.currentScreen as GuiChest
- val container = chest.inventorySlots as ContainerChest
- currentlyOpenChestName = container.lowerChestInventory.displayName.unformattedText
- if (currentlyOpenChestName == "Croesus") return true
- return false
+ return inCroesusBool
}
fun isChestOpened(slotIn: Slot): Boolean {
- if (!Config.hideOpenedChests) return false
- if (slotIn.stack?.getTooltip(mc.thePlayer, false) == null) return false
-
- var tooltip = slotIn.stack.getTooltip(mc.thePlayer, false)
- if (tooltip.contains("§5§o§aChests have been opened!")) return true
-
- return false
+ if (!inCroesusBool) 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/DungeonLeap.kt b/src/main/kotlin/dulkirmod/features/DungeonLeap.kt
index 54a304c..b8ce75e 100644
--- a/src/main/kotlin/dulkirmod/features/DungeonLeap.kt
+++ b/src/main/kotlin/dulkirmod/features/DungeonLeap.kt
@@ -1,32 +1,59 @@
package dulkirmod.features
import dulkirmod.DulkirMod
+import dulkirmod.DulkirMod.Companion.mc
import dulkirmod.config.Config
+import dulkirmod.utils.ContainerNameUtil
import dulkirmod.utils.Utils
import net.minecraft.client.gui.inventory.GuiChest
-import net.minecraft.inventory.ContainerChest
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 = DulkirMod.mc.thePlayer.openContainer.getSlot(i)
+
+ if (slotIn.stack == null) continue
+ val stack = slotIn.stack
+ if (Utils.stripColorCodes(stack.displayName) == Config.highlightLeapName) boolArray[i-11] = true
+ }
+ }
+ }
companion object {
+ var inLeapMenuBool : Boolean = false
+ var boolArray = BooleanArray(5) {false}
+
fun inLeapMenu(): Boolean {
- if (DulkirMod.mc.currentScreen == null || !(DulkirMod.mc.currentScreen is GuiChest)) return false
- val chest = DulkirMod.mc.currentScreen as GuiChest
- val container = chest.inventorySlots as ContainerChest
- Croesus.currentlyOpenChestName = container.lowerChestInventory.displayName.unformattedText
- if (Croesus.currentlyOpenChestName == "Spirit Leap") return true
- return false
+ return inLeapMenuBool
}
fun isHighlightedLeapPlayer(slotIn: Slot): Boolean {
- if (slotIn.stack?.getTooltip(DulkirMod.mc.thePlayer, false) == null) return false
-
- val tooltip = slotIn.stack.getTooltip(DulkirMod.mc.thePlayer, false)
- for (s in tooltip) {
- var t = Utils.stripColorCodes(s)
- if (t == Config.highlightLeapName) return true
- }
- return false
+ 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]
}
}
} \ No newline at end of file
diff --git a/src/main/kotlin/dulkirmod/forge/FMLLoadingPlugin.kt b/src/main/kotlin/dulkirmod/forge/FMLLoadingPlugin.kt
deleted file mode 100644
index ee21437..0000000
--- a/src/main/kotlin/dulkirmod/forge/FMLLoadingPlugin.kt
+++ /dev/null
@@ -1,28 +0,0 @@
-package dulkirmod.forge
-
-import net.minecraftforge.common.ForgeVersion
-import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin
-import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.MCVersion
-import org.spongepowered.asm.launch.MixinBootstrap
-import org.spongepowered.asm.mixin.MixinEnvironment
-import org.spongepowered.asm.mixin.Mixins
-
-@MCVersion(ForgeVersion.mcVersion)
-class FMLLoadingPlugin : IFMLLoadingPlugin {
-
- override fun getASMTransformerClass(): Array<String> = emptyArray()
-
- override fun getModContainerClass(): String? = null
-
- override fun getSetupClass(): String? = null
-
- override fun injectData(data: Map<String, Any>) {}
-
- override fun getAccessTransformerClass(): String? = null
-
- init {
- MixinBootstrap.init()
- Mixins.addConfiguration("mixins.dulkirmod.json")
- MixinEnvironment.getCurrentEnvironment().obfuscationContext = "searge"
- }
-}
diff --git a/src/main/kotlin/dulkirmod/utils/ContainerNameUtil.kt b/src/main/kotlin/dulkirmod/utils/ContainerNameUtil.kt
new file mode 100644
index 0000000..706bcea
--- /dev/null
+++ b/src/main/kotlin/dulkirmod/utils/ContainerNameUtil.kt
@@ -0,0 +1,21 @@
+package dulkirmod.utils
+
+import dulkirmod.DulkirMod.Companion.mc
+import net.minecraft.client.gui.inventory.GuiChest
+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
+ }
+
+ companion object {
+ var currentGuiChestName = ""
+ }
+} \ No newline at end of file