aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/com/ambientaddons/features/dungeon/CancelInteractions.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/com/ambientaddons/features/dungeon/CancelInteractions.kt')
-rw-r--r--src/main/kotlin/com/ambientaddons/features/dungeon/CancelInteractions.kt20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/main/kotlin/com/ambientaddons/features/dungeon/CancelInteractions.kt b/src/main/kotlin/com/ambientaddons/features/dungeon/CancelInteractions.kt
new file mode 100644
index 0000000..94626f8
--- /dev/null
+++ b/src/main/kotlin/com/ambientaddons/features/dungeon/CancelInteractions.kt
@@ -0,0 +1,20 @@
+package com.ambientaddons.features.dungeon
+
+import AmbientAddons.Companion.config
+import AmbientAddons.Companion.mc
+import com.ambientaddons.utils.LocationUtils
+import net.minecraft.init.Blocks
+import net.minecraftforge.event.entity.player.PlayerInteractEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+object CancelInteractions {
+ @SubscribeEvent
+ fun onPlayerInteract(event: PlayerInteractEvent) {
+ if (!config.cancelInteractions || LocationUtils.location == "Private Island") return
+ if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
+ if (mc.theWorld?.getBlockState(event.pos)?.block == Blocks.hopper) {
+ event.isCanceled = true
+ }
+ }
+ }
+} \ No newline at end of file