Package org.samo_lego.golfiv.event
Class IllegalBlockBreakCheck
java.lang.Object
org.samo_lego.golfiv.event.IllegalBlockBreakCheck
- All Implemented Interfaces:
net.fabricmc.fabric.api.event.player.PlayerBlockBreakEvents.Before
public class IllegalBlockBreakCheck
extends Object
implements net.fabricmc.fabric.api.event.player.PlayerBlockBreakEvents.Before
Handles player trying to break the block while having inventory open.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
beforeBlockBreak
(net.minecraft.world.World world, net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.math.BlockPos blockPos, net.minecraft.block.BlockState blockState, net.minecraft.block.entity.BlockEntity blockEntity) Disables breaking blocks if player has GUI open.
-
Constructor Details
-
IllegalBlockBreakCheck
public IllegalBlockBreakCheck()
-
-
Method Details
-
beforeBlockBreak
public boolean beforeBlockBreak(net.minecraft.world.World world, net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.math.BlockPos blockPos, net.minecraft.block.BlockState blockState, net.minecraft.block.entity.BlockEntity blockEntity) Disables breaking blocks if player has GUI open.- Specified by:
beforeBlockBreak
in interfacenet.fabricmc.fabric.api.event.player.PlayerBlockBreakEvents.Before
- Parameters:
world
- world event is happening inplayer
- player breaking the blockblockPos
- block position of the block being brokenblockState
- blockstate of the block being brokenblockEntity
- block entity if block contains it- Returns:
- true if player can break the block, otherwise false
-