Class MysteryBoxEvent.Activate
java.lang.Object
net.neoforged.bus.api.Event
com.pixelmonmod.pixelmon.api.events.blocks.MysteryBoxEvent
com.pixelmonmod.pixelmon.api.events.blocks.MysteryBoxEvent.Activate
- All Implemented Interfaces:
net.neoforged.bus.api.ICancellableEvent
- Enclosing class:
MysteryBoxEvent
public static class MysteryBoxEvent.Activate
extends MysteryBoxEvent
implements net.neoforged.bus.api.ICancellableEvent
-
Nested Class Summary
Nested classes/interfaces inherited from class com.pixelmonmod.pixelmon.api.events.blocks.MysteryBoxEvent
MysteryBoxEvent.Activate, MysteryBoxEvent.ComparatorPower, MysteryBoxEvent.Feed, MysteryBoxEvent.Open, MysteryBoxEvent.Tick
-
Constructor Summary
ConstructorsConstructorDescriptionActivate
(MysteryBoxTileEntity box, net.minecraft.world.entity.player.Player player, net.minecraft.world.level.block.state.BlockState blockState, net.minecraft.world.item.ItemStack itemStack, net.minecraft.world.item.Item acceptedItem) Fired when a Mystery Box is right-clicked by a player. -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.world.item.Item
The item which will be accepted as valid for this interaction.net.minecraft.world.item.ItemStack
Gets the item stack used in this interaction.net.minecraft.world.entity.player.Player
Gets the player who instigated this event.void
setAcceptedItem
(net.minecraft.world.item.Item acceptedItem) Changes the item which will be accepted as valid for this interaction.Methods inherited from class com.pixelmonmod.pixelmon.api.events.blocks.MysteryBoxEvent
getBlockState, getBox
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.neoforged.bus.api.ICancellableEvent
isCanceled, setCanceled
-
Constructor Details
-
Activate
public Activate(MysteryBoxTileEntity box, net.minecraft.world.entity.player.Player player, net.minecraft.world.level.block.state.BlockState blockState, net.minecraft.world.item.ItemStack itemStack, net.minecraft.world.item.Item acceptedItem) Fired when a Mystery Box is right-clicked by a player. 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.acceptedItem
- The item which this Mystery Box will accept as input.
-
-
Method Details
-
getPlayer
public net.minecraft.world.entity.player.Player getPlayer()Gets the player who instigated this event.- Returns:
- The player entity.
-
getItemStack
public net.minecraft.world.item.ItemStack getItemStack()Gets the item stack used in this interaction.- Returns:
- The item stack used.
-
getAcceptedItem
public net.minecraft.world.item.Item getAcceptedItem()The item which will be accepted as valid for this interaction.- Returns:
- The item required.
-
setAcceptedItem
public void setAcceptedItem(net.minecraft.world.item.Item acceptedItem) Changes the item which will be accepted as valid for this interaction.- Parameters:
acceptedItem
- The new item required.
-