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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 interface net.fabricmc.fabric.api.event.player.PlayerBlockBreakEvents.Before
      Parameters:
      world - world event is happening in
      player - player breaking the block
      blockPos - block position of the block being broken
      blockState - blockstate of the block being broken
      blockEntity - block entity if block contains it
      Returns:
      true if player can break the block, otherwise false