diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-07-11 23:56:23 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-07-11 23:56:23 +0200 |
commit | 407221c659f4cee2c81fbd50eaeaca77481cc6c6 (patch) | |
tree | bd6b9af62dcc4b1132b7af01ec66626de416a29e /src/main/java/at/hannibal2/skyhanni/events | |
parent | f8281e39dd0d74162b7fa4d5ad876f0d2bfd5394 (diff) | |
download | skyhanni-407221c659f4cee2c81fbd50eaeaca77481cc6c6.tar.gz skyhanni-407221c659f4cee2c81fbd50eaeaca77481cc6c6.tar.bz2 skyhanni-407221c659f4cee2c81fbd50eaeaca77481cc6c6.zip |
preparing living cave defence blocks
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/events')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/events/ServerBlockChangeEvent.kt | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/events/ServerBlockChangeEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/ServerBlockChangeEvent.kt new file mode 100644 index 000000000..41d8ea946 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/events/ServerBlockChangeEvent.kt @@ -0,0 +1,25 @@ +package at.hannibal2.skyhanni.events + +import at.hannibal2.skyhanni.utils.BlockUtils.getBlockAt +import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher +import at.hannibal2.skyhanni.utils.toLorenzVec +import net.minecraft.block.state.IBlockState +import net.minecraft.util.BlockPos + +class ServerBlockChangeEvent(val pos: BlockPos, val blockState: IBlockState) : LorenzEvent() { + val location by lazy { pos.toLorenzVec() } + val old by lazy { location.getBlockAt().toString().getName() } + val new by lazy { blockState.block.toString().getName() } + + companion object { + val pattern = "Block\\{minecraft:(?<name>.*)}".toPattern() + + private fun String.getName() = pattern.matchMatcher(this) { + group("name") + } ?: this + + } + +} + + |