aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/com/ambientaddons/features/dungeon/CancelInteractions.kt
blob: 94626f844aa52b9873eb3eb2d861205d0bbed69b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
            }
        }
    }
}