aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-03-21 20:08:26 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-03-21 20:08:26 +0100
commit415c54df96ba46744a524715f10ff26962929903 (patch)
tree6def645d1ca21ae355487d4007b20108f8ab41cd /src/main/java/at/hannibal2/skyhanni/utils
parent8dcd991f418b8027b9e42b3afb87f28fbbe9c19a (diff)
downloadskyhanni-415c54df96ba46744a524715f10ff26962929903.tar.gz
skyhanni-415c54df96ba46744a524715f10ff26962929903.tar.bz2
skyhanni-415c54df96ba46744a524715f10ff26962929903.zip
Added wrong fungi cutter mode warning
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/BlockUtils.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt8
2 files changed, 13 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/BlockUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/BlockUtils.kt
index 776ba7f6c..5138ebf35 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/BlockUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/BlockUtils.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.utils
import net.minecraft.block.Block
+import net.minecraft.block.state.IBlockState
import net.minecraft.client.Minecraft
import net.minecraft.tileentity.TileEntitySkull
import net.minecraft.util.BlockPos
@@ -9,7 +10,10 @@ import net.minecraftforge.common.util.Constants
object BlockUtils {
fun LorenzVec.getBlockAt(): Block =
- Minecraft.getMinecraft().theWorld.getBlockState(toBlocPos()).block
+ getBlockStateAt().block
+
+ fun LorenzVec.getBlockStateAt(): IBlockState =
+ Minecraft.getMinecraft().theWorld.getBlockState(toBlocPos())
fun LorenzVec.isInLoadedChunk(): Boolean =
Minecraft.getMinecraft().theWorld.chunkProvider.provideChunk(toBlocPos()).isLoaded
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt
index 1fb107375..26f06df29 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt
@@ -14,6 +14,14 @@ object SoundUtils {
try {
Minecraft.getMinecraft().soundHandler.playSound(this)
} catch (e: Exception) {
+ if (e is IllegalArgumentException) {
+ e.message?.let {
+ if (it.startsWith("value already present:")) {
+ println("SkyHanni Sound error: $it")
+ return
+ }
+ }
+ }
e.printStackTrace()
}
gameSettings.setSoundLevel(SoundCategory.PLAYERS, oldLevel)