Class MysteryBoxEvent.Open.Pre

java.lang.Object
net.minecraftforge.eventbus.api.Event
Enclosing class:
MysteryBoxEvent.Open

public static class MysteryBoxEvent.Open.Pre extends MysteryBoxEvent.Open
  • Constructor Details

    • Pre

      public Pre(MysteryBoxTileEntity box, net.minecraft.world.entity.player.Player player, net.minecraft.world.level.block.state.BlockState blockState, net.minecraft.world.item.ItemStack itemStack, boolean canOpen)
      Fired when a Mystery Box is about to be opened. Cancelable.
      Parameters:
      box - The Mystery Box tile entity.
      player - The player instigating this event.
      blockState - The block state of this Mystery Box.
      itemStack - The item stack being used in this interaction.
      canOpen - Whether the Mystery Box will open or not.
  • Method Details

    • canOpen

      public boolean canOpen()
      Whether the Mystery Box will open from this interaction or not.
      Returns:
      Whether the Mystery Box will open.
    • setCanOpen

      public void setCanOpen(boolean canOpen)
      Changes whether the Mystery Box will open from this interaction or not.
      Parameters:
      canOpen - Whether the Mystery Box will open.