diff options
| author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-07-12 06:39:15 +0200 |
|---|---|---|
| committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-07-12 06:39:15 +0200 |
| commit | c2a4208969d8f2ac18e8dcec1fb92fee08d2096f (patch) | |
| tree | 5afb35358eda84f084d672c1f6f7a64a763d2afb /src/main/java/at/hannibal2/skyhanni/data | |
| parent | 8e41ca93ab22eb4807beaa7447e19455f992ab76 (diff) | |
| download | skyhanni-c2a4208969d8f2ac18e8dcec1fb92fee08d2096f.tar.gz skyhanni-c2a4208969d8f2ac18e8dcec1fb92fee08d2096f.tar.bz2 skyhanni-c2a4208969d8f2ac18e8dcec1fb92fee08d2096f.zip | |
Created Block Data class
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/data')
| -rw-r--r-- | src/main/java/at/hannibal2/skyhanni/data/BlockData.kt | 24 |
1 files changed, 24 insertions, 0 deletions
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 |
