aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt26
-rw-r--r--src/main/java/at/hannibal2/skyhanni/events/BlockClickEvent.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/events/ItemClickInHandEvent.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHighlightClickedBlocks.kt18
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt22
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt14
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt63
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt4
9 files changed, 72 insertions, 90 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java b/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java
index 641cd581d..92363b971 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java
@@ -94,5 +94,5 @@ public class Slayer {
@Expose
@ConfigOption(name = "Quest Warning", desc = "Warning when wrong slayer quest is selected, or killing mobs for the wrong slayer.")
@ConfigEditorBoolean
- public boolean questWarning = false;
+ public boolean questWarning = true;
}
diff --git a/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt b/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt
index b7dccd76b..a2a22a865 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt
@@ -1,9 +1,13 @@
package at.hannibal2.skyhanni.data
+import at.hannibal2.skyhanni.events.BlockClickEvent
import at.hannibal2.skyhanni.events.EntityClickEvent
-import at.hannibal2.skyhanni.events.ItemClickInHandEvent
+import at.hannibal2.skyhanni.events.PacketEvent
import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.toLorenzVec
import net.minecraft.client.Minecraft
+import net.minecraft.network.play.client.C07PacketPlayerDigging
+import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.InputEvent
import org.lwjgl.input.Mouse
@@ -11,17 +15,17 @@ import org.lwjgl.input.Mouse
class ItemClickData {
@SubscribeEvent
- fun onClick(event: InputEvent.MouseInputEvent) {
- if (!Mouse.getEventButtonState()) return
-
- val clickType = when (Mouse.getEventButton()) {
- 0 -> ClickType.LEFT_CLICK
- 1 -> ClickType.RIGHT_CLICK
- else -> return
+ fun onItemClickSend(event: PacketEvent.SendEvent) {
+ val packet = event.packet
+ if (packet is C08PacketPlayerBlockPlacement) {
+ val position = packet.position.toLorenzVec()
+ BlockClickEvent(ClickType.RIGHT_CLICK, position, packet.stack).postAndCatch()
+ }
+ if (packet is C07PacketPlayerDigging && packet.status == C07PacketPlayerDigging.Action.START_DESTROY_BLOCK) {
+ val position = packet.position.toLorenzVec()
+ val itemInHand = Minecraft.getMinecraft().thePlayer.heldItem
+ BlockClickEvent(ClickType.LEFT_CLICK, position, itemInHand).postAndCatch()
}
-
- val itemStack = Minecraft.getMinecraft().thePlayer.heldItem
- ItemClickInHandEvent(clickType, itemStack).postAndCatch()
}
@SubscribeEvent
diff --git a/src/main/java/at/hannibal2/skyhanni/events/BlockClickEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/BlockClickEvent.kt
new file mode 100644
index 000000000..eca74c707
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/events/BlockClickEvent.kt
@@ -0,0 +1,7 @@
+package at.hannibal2.skyhanni.events
+
+import at.hannibal2.skyhanni.data.ClickType
+import at.hannibal2.skyhanni.utils.LorenzVec
+import net.minecraft.item.ItemStack
+
+class BlockClickEvent(val clickType: ClickType, val position: LorenzVec, val itemInHand: ItemStack?) : LorenzEvent() \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/events/ItemClickInHandEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/ItemClickInHandEvent.kt
deleted file mode 100644
index a328e599e..000000000
--- a/src/main/java/at/hannibal2/skyhanni/events/ItemClickInHandEvent.kt
+++ /dev/null
@@ -1,6 +0,0 @@
-package at.hannibal2.skyhanni.events
-
-import at.hannibal2.skyhanni.data.ClickType
-import net.minecraft.item.ItemStack
-
-class ItemClickInHandEvent(val clickType: ClickType, val itemInHand: ItemStack?): LorenzEvent() \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHighlightClickedBlocks.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHighlightClickedBlocks.kt
index e634cb375..3807c3ab1 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHighlightClickedBlocks.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHighlightClickedBlocks.kt
@@ -1,14 +1,17 @@
package at.hannibal2.skyhanni.features.dungeon
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.ClickType
+import at.hannibal2.skyhanni.events.BlockClickEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
-import at.hannibal2.skyhanni.events.PacketEvent
-import at.hannibal2.skyhanni.utils.*
+import at.hannibal2.skyhanni.utils.BlockUtils
import at.hannibal2.skyhanni.utils.BlockUtils.getBlockAt
+import at.hannibal2.skyhanni.utils.LorenzColor
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.RenderUtils.drawColor
import at.hannibal2.skyhanni.utils.RenderUtils.drawString
import net.minecraft.init.Blocks
-import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement
import net.minecraftforge.client.event.RenderWorldLastEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@@ -36,15 +39,13 @@ class DungeonHighlightClickedBlocks {
}
@SubscribeEvent
- fun onSendPacket(event: PacketEvent.SendEvent) {
+ fun onBlockClick(event: BlockClickEvent) {
if (!SkyHanniMod.feature.dungeon.highlightClickedBlocks) return
if (!LorenzUtils.inDungeons) return
if (DungeonData.inBossRoom) return
- if (event.packet !is C08PacketPlayerBlockPlacement) return
- if (event.packet.stack == null) return
-
- val position = event.packet.position.toLorenzVec()
+ if (event.clickType != ClickType.RIGHT_CLICK) return
+ val position = event.position
if (blocks.any { it.position == position }) return
val type: ClickedBlockType = when (position.getBlockAt()) {
@@ -64,6 +65,7 @@ class DungeonHighlightClickedBlocks {
}
}
+ // TODO hide in water room
// if (nearWaterRoom() && type == ClickedBlockType.LEVER) return
val color = getNextColor()
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt
index c1a0c1a8b..cfcb4244a 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt
@@ -2,20 +2,14 @@ package at.hannibal2.skyhanni.features.event.diana
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.data.IslandType
-import at.hannibal2.skyhanni.events.BurrowDetectEvent
-import at.hannibal2.skyhanni.events.BurrowDugEvent
-import at.hannibal2.skyhanni.events.LorenzChatEvent
-import at.hannibal2.skyhanni.events.PacketEvent
+import at.hannibal2.skyhanni.events.*
import at.hannibal2.skyhanni.utils.BlockUtils.getBlockAt
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.toLorenzVec
-import net.minecraft.client.Minecraft
import net.minecraft.init.Blocks
import net.minecraft.item.ItemStack
-import net.minecraft.network.play.client.C07PacketPlayerDigging
-import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement
import net.minecraft.network.play.server.S2APacketParticles
import net.minecraftforge.event.world.WorldEvent
import net.minecraftforge.fml.common.eventhandler.EventPriority
@@ -176,20 +170,14 @@ class GriffinBurrowParticleFinder {
}
@SubscribeEvent
- fun onSendPacket(event: PacketEvent.SendEvent) {
+ fun onBlockClick(event: BlockClickEvent) {
if (!LorenzUtils.inSkyBlock) return
if (!SkyHanniMod.feature.diana.burrowsSoopyGuess) return
if (LorenzUtils.skyBlockIsland != IslandType.HUB) return
- val packet = event.packet
- val pos = when {
- packet is C07PacketPlayerDigging && packet.status == C07PacketPlayerDigging.Action.START_DESTROY_BLOCK -> {
- packet.position
- }
- packet is C08PacketPlayerBlockPlacement && packet.stack != null -> packet.position
- else -> return
- }.toLorenzVec()
- if (Minecraft.getMinecraft().thePlayer.heldItem?.isSpade != true || pos.getBlockAt() !== Blocks.grass) return
+ val pos = event.position
+ if (event.itemInHand?.isSpade != true || pos.getBlockAt() !== Blocks.grass) return
+
if (burrows.containsKey(pos)) {
lastDugParticleBurrow = pos
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt
index 115d9733b..96d1bb74f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt
@@ -2,7 +2,7 @@ package at.hannibal2.skyhanni.features.itemabilities
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.data.ClickType
-import at.hannibal2.skyhanni.events.ItemClickInHandEvent
+import at.hannibal2.skyhanni.events.BlockClickEvent
import at.hannibal2.skyhanni.events.ReceiveParticleEvent
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.LorenzUtils
@@ -30,15 +30,15 @@ class FireVeilWandParticles {
}
@SubscribeEvent
- fun onItemClick(event: ItemClickInHandEvent) {
+ fun onBlockClick(event: BlockClickEvent) {
if (!LorenzUtils.inSkyBlock) return
- if (event.clickType != ClickType.RIGHT_CLICK) return
- val itemInHand = event.itemInHand ?: return
+ if (event.clickType == ClickType.RIGHT_CLICK) {
+ val internalName = event.itemInHand?.getInternalName() ?: return
- val internalName = itemInHand.getInternalName()
- if (internalName == "FIRE_VEIL_WAND") {
- lastClick = System.currentTimeMillis()
+ if (internalName == "FIRE_VEIL_WAND") {
+ lastClick = System.currentTimeMillis()
+ }
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt
index 152acf692..f96fce3f1 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt
@@ -2,8 +2,8 @@ package at.hannibal2.skyhanni.features.itemabilities.abilitycooldown
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.data.ItemRenderBackground.Companion.background
+import at.hannibal2.skyhanni.events.BlockClickEvent
import at.hannibal2.skyhanni.events.LorenzActionBarEvent
-import at.hannibal2.skyhanni.events.PacketEvent
import at.hannibal2.skyhanni.events.PlaySoundEvent
import at.hannibal2.skyhanni.events.RenderItemTipEvent
import at.hannibal2.skyhanni.utils.ItemUtils
@@ -14,8 +14,6 @@ import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.between
import net.minecraft.client.Minecraft
import net.minecraft.item.ItemStack
-import net.minecraft.network.play.client.C07PacketPlayerDigging
-import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
@@ -27,51 +25,40 @@ class ItemAbilityCooldown {
@SubscribeEvent
fun onSoundEvent(event: PlaySoundEvent) {
- if (event.soundName == "mob.zombie.remedy") {
- if (event.pitch == 0.6984127f && event.volume == 1f) {
- ItemAbility.HYPERION.sound()
- }
+ if (event.soundName == "mob.zombie.remedy") {
+ if (event.pitch == 0.6984127f && event.volume == 1f) {
+ ItemAbility.HYPERION.sound()
}
- if (event.soundName == "mob.enderdragon.growl") {
- if (event.pitch == 1f && event.volume == 1f) {
- ItemAbility.ICE_SPRAY_WAND.sound()
- }
+ }
+ if (event.soundName == "mob.enderdragon.growl") {
+ if (event.pitch == 1f && event.volume == 1f) {
+ ItemAbility.ICE_SPRAY_WAND.sound()
}
- if (event.soundName == "mob.endermen.portal") {
- if (event.pitch == 0.61904764f && event.volume == 1f) {
- ItemAbility.GYROKINETIC_WAND.sound()
- }
+ }
+ if (event.soundName == "mob.endermen.portal") {
+ if (event.pitch == 0.61904764f && event.volume == 1f) {
+ ItemAbility.GYROKINETIC_WAND.sound()
}
- if (event.soundName == "random.anvil_land") {
- if (event.pitch == 0.4920635f && event.volume == 1f) {
- ItemAbility.GIANTS_SWORD.sound()
- }
+ }
+ if (event.soundName == "random.anvil_land") {
+ if (event.pitch == 0.4920635f && event.volume == 1f) {
+ ItemAbility.GIANTS_SWORD.sound()
}
- if (event.soundName == "mob.ghast.affectionate_scream") {
- if (event.pitch == 0.4920635f && event.volume == 0.15f) {
- ItemAbility.ATOMSPLIT_KATANA.sound()
- }
+ }
+ if (event.soundName == "mob.ghast.affectionate_scream") {
+ if (event.pitch == 0.4920635f && event.volume == 0.15f) {
+ ItemAbility.ATOMSPLIT_KATANA.sound()
}
+ }
}
@SubscribeEvent
- fun onItemClickSend(event: PacketEvent.SendEvent) {
+ fun onItemClickSend(event: BlockClickEvent) {
if (!LorenzUtils.inSkyBlock) return
+ val heldItem = event.itemInHand ?: return
- val packet = event.packet
- if (packet is C07PacketPlayerDigging) {
- if (packet.status == C07PacketPlayerDigging.Action.START_DESTROY_BLOCK) {
- val heldItem = Minecraft.getMinecraft().thePlayer.heldItem ?: return
- val internalName = heldItem.getInternalName()
- ItemAbility.getByInternalName(internalName)?.newClick()
-// println("internalName: $internalName")
- }
- }
- if (packet is C08PacketPlayerBlockPlacement) {
- val heldItem = Minecraft.getMinecraft().thePlayer.heldItem ?: return
- val internalName = heldItem.getInternalName()
- ItemAbility.getByInternalName(internalName)?.newClick()
- }
+ val internalName = heldItem.getInternalName()
+ ItemAbility.getByInternalName(internalName)?.newClick()
}
@SubscribeEvent
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt
index b39c85928..fe16ed426 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt
@@ -3,7 +3,7 @@ package at.hannibal2.skyhanni.features.slayer.blaze
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.config.core.util.render.TextRenderUtils
import at.hannibal2.skyhanni.data.ClickType
-import at.hannibal2.skyhanni.events.ItemClickInHandEvent
+import at.hannibal2.skyhanni.events.BlockClickEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.PacketEvent
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
@@ -204,7 +204,7 @@ class BlazeSlayerDaggerHelper {
}
@SubscribeEvent
- fun onItemClick(event: ItemClickInHandEvent) {
+ fun onBlockClick(event: BlockClickEvent) {
if (!isEnabled()) return
if (clientSideClicked) return
if (event.clickType != ClickType.RIGHT_CLICK) return