diff options
author | Lorenz <lo.scherf@gmail.com> | 2022-09-07 11:42:48 +0200 |
---|---|---|
committer | Lorenz <lo.scherf@gmail.com> | 2022-09-07 11:42:48 +0200 |
commit | 163cc857b0b1e6f52d56e663b8cb1c55f5e1bff2 (patch) | |
tree | 27a128342125bade370c1fdf8b5ef0166d86a881 /src | |
parent | 2d0f63b156f936e9f056537a67eaa13bffa54c27 (diff) | |
download | skyhanni-163cc857b0b1e6f52d56e663b8cb1c55f5e1bff2.tar.gz skyhanni-163cc857b0b1e6f52d56e663b8cb1c55f5e1bff2.tar.bz2 skyhanni-163cc857b0b1e6f52d56e663b8cb1c55f5e1bff2.zip |
Hiding the flame particles when using the Fire Veil Wand ability.
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java | 4 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/Abilities.java | 5 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt (renamed from src/main/java/at/hannibal2/skyhanni/data/EntityMovementHelper.kt) | 2 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt | 32 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/events/ItemClickInHandEvent.kt | 10 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/FireVeilWandParticles.kt | 50 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/diana/GriffinBurrowFinder.kt | 5 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt | 8 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt | 5 |
9 files changed, 110 insertions, 11 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index 353a00614..51dcd490a 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -60,7 +60,8 @@ public class SkyHanniMod { registerEvent(new SeaCreatureManager()); registerEvent(new ItemRenderBackground()); registerEvent(new EntityData()); - registerEvent(new EntityMovementHelper()); + registerEvent(new EntityMovementData()); + registerEvent(new ItemClickData()); registerEvent(new BazaarOrderHelper()); registerEvent(new ChatFilter()); @@ -107,6 +108,7 @@ public class SkyHanniMod { registerEvent(new DungeonHideItems()); registerEvent(new DungeonCopilot()); registerEvent(new EndermanSlayerBeacon()); + registerEvent(new FireVeilWandParticles()); Commands.init(); diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Abilities.java b/src/main/java/at/hannibal2/skyhanni/config/features/Abilities.java index a6c9c50f4..4e93679d4 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Abilities.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Abilities.java @@ -50,4 +50,9 @@ public class Abilities { @ConfigEditorBoolean @ConfigAccordionId(id = 0) public boolean summoningMobColored = false; + + @Expose + @ConfigOption(name = "Fire Veil Particles", desc = "Hiding the flame particles when using the Fire Veil Wand ability.") + @ConfigEditorBoolean + public boolean fireVeilWandHider = false; } diff --git a/src/main/java/at/hannibal2/skyhanni/data/EntityMovementHelper.kt b/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt index 908aae388..1e07a6eaa 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/EntityMovementHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt @@ -9,7 +9,7 @@ import net.minecraftforge.event.world.WorldEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.gameevent.TickEvent -class EntityMovementHelper { +class EntityMovementData { companion object { private val entityLocation = mutableMapOf<Entity, LorenzVec>() diff --git a/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt b/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt new file mode 100644 index 000000000..e359c619e --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt @@ -0,0 +1,32 @@ +package at.hannibal2.skyhanni.data + +import at.hannibal2.skyhanni.events.ItemClickInHandEvent +import net.minecraft.client.Minecraft +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraftforge.fml.common.gameevent.InputEvent +import org.lwjgl.input.Mouse + +class ItemClickData { + + @SubscribeEvent + fun onClick(event: InputEvent.MouseInputEvent) { + if (!Mouse.getEventButtonState()) return + + val clickType = when (Mouse.getEventButton()) { + 0 -> { + ItemClickInHandEvent.ClickType.LEFT_CLICK + } + + 1 -> { + ItemClickInHandEvent.ClickType.RIGHT_CLICK + } + + else -> { + return + } + } + + val itemStack = Minecraft.getMinecraft().thePlayer.heldItem + ItemClickInHandEvent(clickType, itemStack).postAndCatch() + } +}
\ 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 new file mode 100644 index 000000000..e1271b0a3 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/events/ItemClickInHandEvent.kt @@ -0,0 +1,10 @@ +package at.hannibal2.skyhanni.events + +import net.minecraft.item.ItemStack + +class ItemClickInHandEvent(val clickType: ClickType, val itemInHand: ItemStack?): LorenzEvent() { + + enum class ClickType { + LEFT_CLICK, RIGHT_CLICK + } +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/FireVeilWandParticles.kt b/src/main/java/at/hannibal2/skyhanni/features/FireVeilWandParticles.kt new file mode 100644 index 000000000..1205c202b --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/FireVeilWandParticles.kt @@ -0,0 +1,50 @@ +package at.hannibal2.skyhanni.features + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.ItemClickInHandEvent +import at.hannibal2.skyhanni.events.PacketEvent +import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName +import at.hannibal2.skyhanni.utils.LorenzUtils +import net.minecraft.network.play.server.S2APacketParticles +import net.minecraft.util.EnumParticleTypes +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class FireVeilWandParticles { + + var lastClick = 0L + + @SubscribeEvent + fun onChatPacket(event: PacketEvent.ReceiveEvent) { + if (!isEnabled()) return + + val packet = event.packet + if (packet !is S2APacketParticles) return + + if (System.currentTimeMillis() > lastClick + 5_500) return + + if (packet.particleType == EnumParticleTypes.FLAME && packet.particleCount == 1 && packet.particleSpeed == 0f && + packet.xOffset == 0f && + packet.yOffset == 0f && + packet.zOffset == 0f + ) { + event.isCanceled = true + } + } + + @SubscribeEvent + fun onItemClick(event: ItemClickInHandEvent) { + if (!isEnabled()) return + if (event.clickType != ItemClickInHandEvent.ClickType.RIGHT_CLICK) return + + val itemInHand = event.itemInHand ?: return + + val internalName = itemInHand.getInternalName() + if (internalName == "FIRE_VEIL_WAND") { + lastClick = System.currentTimeMillis() + } + } + + private fun isEnabled(): Boolean { + return LorenzUtils.inSkyblock && SkyHanniMod.feature.abilities.fireVeilWandHider + } +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/diana/GriffinBurrowFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/diana/GriffinBurrowFinder.kt index d98f46100..524a94259 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/diana/GriffinBurrowFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/diana/GriffinBurrowFinder.kt @@ -71,10 +71,7 @@ class GriffinBurrowFinder { fun onChatPacket(event: PacketEvent.ReceiveEvent) { val packet = event.packet if (packet is S2APacketParticles) { - val x = packet.xCoordinate - val y = packet.yCoordinate - val z = packet.zCoordinate - val distance = LorenzVec(x, y, z).distance(LocationUtils.playerLocation()) + val distance = packet.toLorenzVec().distance(LocationUtils.playerLocation()) if (distance < 20) { // LorenzDebug.log("") // LorenzDebug.log("S2APacketParticles close") diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt index faf48e95c..acc0de8a0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt @@ -1,14 +1,14 @@ package at.hannibal2.skyhanni.features.dungeon import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.data.EntityMovementHelper +import at.hannibal2.skyhanni.data.EntityMovementData import at.hannibal2.skyhanni.events.* import at.hannibal2.skyhanni.utils.ItemUtils.cleanName import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.getLorenzVec +import at.hannibal2.skyhanni.utils.toLorenzVec import net.minecraft.entity.item.EntityArmorStand import net.minecraft.entity.item.EntityItem import net.minecraft.network.play.server.S2APacketParticles @@ -121,7 +121,7 @@ class DungeonHideItems { } if (isSkeletonSkull(entity)) { - EntityMovementHelper.addToTrack(entity) + EntityMovementData.addToTrack(entity) if (SkyHanniMod.feature.dungeon.hideSkeletonSkull) { val lastMove = movingSkeletonSkulls.getOrDefault(entity, 0) if (lastMove + 100 > System.currentTimeMillis()) { @@ -139,7 +139,7 @@ class DungeonHideItems { val packet = event.packet if (packet is S2APacketParticles) { - val packetLocation = LorenzVec(packet.xCoordinate, packet.yCoordinate, packet.zCoordinate) + val packetLocation = packet.toLorenzVec() for (armorStand in hideParticles.filter { it.value + 100 > System.currentTimeMillis() }.map { it.key }) { val distance = packetLocation.distance(armorStand.getLorenzVec()) if (distance < 2) { diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt index 95ab29433..117a35f77 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.utils import net.minecraft.entity.Entity +import net.minecraft.network.play.server.S2APacketParticles import net.minecraft.util.BlockPos import net.minecraft.util.Rotations import net.minecraft.util.Vec3 @@ -107,4 +108,6 @@ fun Entity.getLorenzVec(): LorenzVec = LorenzVec(posX, posY, posZ) fun Vec3.toLorenzVec(): LorenzVec = LorenzVec(xCoord, yCoord, zCoord) -fun Rotations.toLorenzVec(): LorenzVec = LorenzVec(x, y, z)
\ No newline at end of file +fun Rotations.toLorenzVec(): LorenzVec = LorenzVec(x, y, z) + +fun S2APacketParticles.toLorenzVec(): LorenzVec = LorenzVec(xCoordinate, yCoordinate, zCoordinate)
\ No newline at end of file |