diff options
Diffstat (limited to 'src/main')
3 files changed, 25 insertions, 18 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 1511f8db6..524616a5e 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -154,6 +154,7 @@ class SkyHanniMod { loadModule(GardenCropSpeed) loadModule(ProfileStorageData) loadModule(TitleData()) + loadModule(BlockData()) // APIs loadModule(BazaarApi()) diff --git a/src/main/java/at/hannibal2/skyhanni/data/BlockData.kt b/src/main/java/at/hannibal2/skyhanni/data/BlockData.kt new file mode 100644 index 000000000..0c45a7bb1 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/data/BlockData.kt @@ -0,0 +1,24 @@ +package at.hannibal2.skyhanni.data + +import at.hannibal2.skyhanni.events.PacketEvent +import at.hannibal2.skyhanni.events.ServerBlockChangeEvent +import net.minecraft.network.play.server.S22PacketMultiBlockChange +import net.minecraft.network.play.server.S23PacketBlockChange +import net.minecraftforge.fml.common.eventhandler.EventPriority +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class BlockData { + + @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true) + fun onChatPacket(event: PacketEvent.ReceiveEvent) { + val packet = event.packet + + if (packet is S23PacketBlockChange) { + ServerBlockChangeEvent(packet.blockPosition, packet.blockState).postAndCatch() + } else if (packet is S22PacketMultiBlockChange) { + for (block in packet.changedBlocks) { + ServerBlockChangeEvent(block.pos, block.blockState).postAndCatch() + } + } + } +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt index a450280f9..0077fc870 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt @@ -1,6 +1,5 @@ package at.hannibal2.skyhanni.features.rift.area.livingcave -import at.hannibal2.skyhanni.events.PacketEvent import at.hannibal2.skyhanni.events.ReceiveParticleEvent import at.hannibal2.skyhanni.events.ServerBlockChangeEvent import at.hannibal2.skyhanni.events.withAlpha @@ -18,11 +17,8 @@ import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText import at.hannibal2.skyhanni.utils.getLorenzVec import net.minecraft.client.Minecraft import net.minecraft.client.entity.EntityOtherPlayerMP -import net.minecraft.network.play.server.S22PacketMultiBlockChange -import net.minecraft.network.play.server.S23PacketBlockChange import net.minecraft.util.EnumParticleTypes import net.minecraftforge.client.event.RenderWorldLastEvent -import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class LivingCaveDefenseBlocks { @@ -87,20 +83,6 @@ class LivingCaveDefenseBlocks { } } - // TODO move to somewhere else - @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true) - fun onChatPacket(event: PacketEvent.ReceiveEvent) { - val packet = event.packet - - if (packet is S23PacketBlockChange) { - ServerBlockChangeEvent(packet.blockPosition, packet.blockState).postAndCatch() - } else if (packet is S22PacketMultiBlockChange) { - for (block in packet.changedBlocks) { - ServerBlockChangeEvent(block.pos, block.blockState).postAndCatch() - } - } - } - @SubscribeEvent fun onBlockChange(event: ServerBlockChangeEvent) { if (!isEnabled()) return |