aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/com/ambientaddons/features/misc/CancelInteractions.kt
blob: 3deff1749bc2749a6ca2a1f6f7f9d92cc9e91c7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package com.ambientaddons.features.misc

import AmbientAddons.Companion.config
import AmbientAddons.Companion.mc
import com.ambientaddons.utils.Area
import com.ambientaddons.utils.SBLocation
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 (!SBLocation.inSkyblock) return
        if (!config.cancelInteractions || SBLocation.area == Area.PrivateIsland) return
        if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
            if (mc.theWorld?.getBlockState(event.pos)?.block == Blocks.hopper) {
                event.isCanceled = true
            }
        }
    }
}