mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-22 13:09:59 +00:00
Seal most event hierarchies (#10515)
Most events in Forge are not designed to be extended by mod devs but technically allowed it before this PR, leading to a risk of unintentional breaking changes for those that do. If you need to extend a Forge event, please let us know so that we can explicitly support that and design it with extending in mind. Note that this change does not affect making your own events that directly extend from EventBus' `Event` class.
This commit is contained in:
1 parent
81f7f029c3
commit
504dcad849
174 files changed
+371
-371
No files matched your search
@@ -16,7 +16,7 @@ import java.util.function.Consumer;
|
||||
/**
|
||||
* Fired on {@link PackRepository} creation to allow mods to add new pack finders.
|
||||
*/
|
||||
public class AddPackFindersEvent extends Event implements IModBusEvent {
|
||||
public final class AddPackFindersEvent extends Event implements IModBusEvent {
|
||||
private final PackType packType;
|
||||
private final Consumer<RepositorySource> sources;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ import java.util.concurrent.Executor;
|
||||
* The event is fired on each reload and lets modders add their own ReloadListeners, for server-side resources.
|
||||
* The event is fired on the {@link MinecraftForge#EVENT_BUS}
|
||||
*/
|
||||
public class AddReloadListenerEvent extends Event {
|
||||
public final class AddReloadListenerEvent extends Event {
|
||||
private final List<PreparableReloadListener> listeners = new ArrayList<>();
|
||||
private final ReloadableServerResources serverResources;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
* if the output is empty, and the event is not canceled, vanilla behavior will execute. <br>
|
||||
*/
|
||||
@Cancelable
|
||||
public class AnvilUpdateEvent extends Event {
|
||||
public final class AnvilUpdateEvent extends Event {
|
||||
private final ItemStack left;
|
||||
private final ItemStack right;
|
||||
private final String name;
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
* only on the {@linkplain LogicalSide#SERVER logical server}.
|
||||
**/
|
||||
@Cancelable
|
||||
public class CommandEvent extends Event
|
||||
public final class CommandEvent extends Event
|
||||
{
|
||||
private ParseResults<CommandSourceStack> parse;
|
||||
@Nullable
|
||||
|
||||
@@ -19,7 +19,7 @@ import net.minecraftforge.eventbus.api.Event;
|
||||
* <br>
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
**/
|
||||
public class DifficultyChangeEvent extends Event {
|
||||
public final class DifficultyChangeEvent extends Event {
|
||||
private final Difficulty difficulty;
|
||||
private final Difficulty oldDifficulty;
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import net.minecraftforge.eventbus.api.Event;
|
||||
*
|
||||
* @author Curle
|
||||
*/
|
||||
public class GameShuttingDownEvent extends Event
|
||||
public final class GameShuttingDownEvent extends Event
|
||||
{
|
||||
public GameShuttingDownEvent() {}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ import javax.annotation.Nullable;
|
||||
Where all the events fore Gathering Components will exist.
|
||||
*/
|
||||
|
||||
public abstract class GatherComponentsEvent extends Event {
|
||||
public abstract sealed class GatherComponentsEvent extends Event {
|
||||
private final DataComponentMap.Builder components = DataComponentMap.builder();
|
||||
private final DataComponentMap originalComponents;
|
||||
private final Object owner;
|
||||
@@ -54,7 +54,7 @@ public abstract class GatherComponentsEvent extends Event {
|
||||
*
|
||||
* References in {@link net.minecraft.world.item.Items} may not be valid at the current time.
|
||||
*/
|
||||
public static class Item extends GatherComponentsEvent {
|
||||
public static final class Item extends GatherComponentsEvent {
|
||||
public Item(net.minecraft.world.item.Item item, DataComponentMap dataComponents) {
|
||||
super(item, dataComponents);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
|
||||
public abstract class GrindstoneEvent extends Event
|
||||
public abstract sealed class GrindstoneEvent extends Event
|
||||
{
|
||||
private final ItemStack top;
|
||||
private final ItemStack bottom;
|
||||
@@ -79,7 +79,7 @@ public abstract class GrindstoneEvent extends Event
|
||||
* </ul>
|
||||
*/
|
||||
@Cancelable
|
||||
public static class OnPlaceItem extends GrindstoneEvent
|
||||
public static final class OnPlaceItem extends GrindstoneEvent
|
||||
{
|
||||
private ItemStack output;
|
||||
|
||||
@@ -119,7 +119,7 @@ public abstract class GrindstoneEvent extends Event
|
||||
* if the amount of experience is larger than or equal 0, the vanilla behavior for calculating experience will not run. <br>
|
||||
*/
|
||||
@Cancelable
|
||||
public static class OnTakeItem extends GrindstoneEvent
|
||||
public static final class OnTakeItem extends GrindstoneEvent
|
||||
{
|
||||
private ItemStack newTop = ItemStack.EMPTY;
|
||||
private ItemStack newBottom = ItemStack.EMPTY;
|
||||
|
||||
@@ -34,7 +34,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
* This also means that the two vanilla checks described above will not be called.
|
||||
*/
|
||||
@Cancelable
|
||||
public class ItemStackedOnOtherEvent extends Event
|
||||
public final class ItemStackedOnOtherEvent extends Event
|
||||
{
|
||||
private final ItemStack carriedItem;
|
||||
private final ItemStack stackedOnItem;
|
||||
|
||||
@@ -24,7 +24,7 @@ import net.minecraftforge.fml.LogicalSide;
|
||||
* only on the {@linkplain LogicalSide#SERVER logical server}.</p>
|
||||
*/
|
||||
@Cancelable
|
||||
public class LootTableLoadEvent extends Event
|
||||
public final class LootTableLoadEvent extends Event
|
||||
{
|
||||
private final ResourceLocation name;
|
||||
private LootTable table;
|
||||
|
||||
@@ -39,7 +39,7 @@ import java.util.stream.Stream;
|
||||
* <p>This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus},
|
||||
* on both {@linkplain LogicalSide logical sides}.</p>
|
||||
*/
|
||||
public class ModMismatchEvent extends Event implements IModBusEvent
|
||||
public final class ModMismatchEvent extends Event implements IModBusEvent
|
||||
{
|
||||
/**
|
||||
* The level being loaded. Useful for things like {@link net.minecraft.world.level.storage.DimensionDataStorage}
|
||||
|
||||
@@ -17,7 +17,7 @@ import java.util.List;
|
||||
* before tags and crafting recipes are sent to the client. Send datapack data
|
||||
* to clients when this event fires.
|
||||
*/
|
||||
public class OnDatapackSyncEvent extends Event {
|
||||
public final class OnDatapackSyncEvent extends Event {
|
||||
private final PlayerList playerList;
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -38,7 +38,7 @@ import java.util.Objects;
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
*/
|
||||
@Cancelable
|
||||
public class PlayLevelSoundEvent extends Event {
|
||||
public sealed class PlayLevelSoundEvent extends Event {
|
||||
private final Level level;
|
||||
private final float originalVolume;
|
||||
private final float originalPitch;
|
||||
@@ -149,7 +149,7 @@ public class PlayLevelSoundEvent extends Event {
|
||||
* <p>
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
*/
|
||||
public static class AtEntity extends PlayLevelSoundEvent {
|
||||
public static final class AtEntity extends PlayLevelSoundEvent {
|
||||
private final Entity entity;
|
||||
|
||||
public AtEntity(Level level, @Nullable Entity entity, Holder<SoundEvent> sound, SoundSource source, float volume, float pitch) {
|
||||
@@ -176,7 +176,7 @@ public class PlayLevelSoundEvent extends Event {
|
||||
* <p>
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
*/
|
||||
public static class AtPosition extends PlayLevelSoundEvent {
|
||||
public static final class AtPosition extends PlayLevelSoundEvent {
|
||||
private final Vec3 position;
|
||||
|
||||
public AtPosition(Level level, Vec3 position, Holder<SoundEvent> sound, SoundSource source, float volume, float pitch) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import net.minecraft.commands.Commands;
|
||||
*
|
||||
* The event is fired on the {@link MinecraftForge#EVENT_BUS}
|
||||
*/
|
||||
public class RegisterCommandsEvent extends Event
|
||||
public final class RegisterCommandsEvent extends Event
|
||||
{
|
||||
private final CommandDispatcher<CommandSourceStack> dispatcher;
|
||||
private final Commands.CommandSelection environment;
|
||||
|
||||
@@ -35,7 +35,7 @@ import com.google.common.base.Preconditions;
|
||||
* @see StructuresBecomeConfiguredFix
|
||||
* @see #register(String, StructuresBecomeConfiguredFix.Conversion)
|
||||
*/
|
||||
public class RegisterStructureConversionsEvent extends Event
|
||||
public final class RegisterStructureConversionsEvent extends Event
|
||||
{
|
||||
private final Map<String, StructuresBecomeConfiguredFix.Conversion> map;
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
* only on the {@linkplain LogicalSide#SERVER logical server}.
|
||||
**/
|
||||
@Cancelable
|
||||
public class ServerChatEvent extends Event {
|
||||
public final class ServerChatEvent extends Event {
|
||||
private final ServerPlayer player;
|
||||
private final String username;
|
||||
private final String rawText;
|
||||
|
||||
@@ -11,7 +11,7 @@ import net.minecraftforge.eventbus.api.Event;
|
||||
/**
|
||||
* Fired when tags are updated on either server or client. This event can be used to refresh data that depends on tags.
|
||||
*/
|
||||
public class TagsUpdatedEvent extends Event
|
||||
public final class TagsUpdatedEvent extends Event
|
||||
{
|
||||
private final RegistryAccess registryAccess;
|
||||
private final UpdateCause updateCause;
|
||||
|
||||
@@ -16,13 +16,13 @@ import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
|
||||
public class TickEvent extends Event {
|
||||
public sealed class TickEvent extends Event {
|
||||
public enum Type {
|
||||
LEVEL, PLAYER, CLIENT, SERVER, RENDER;
|
||||
LEVEL, PLAYER, CLIENT, SERVER, RENDER
|
||||
}
|
||||
|
||||
public enum Phase {
|
||||
START, END;
|
||||
START, END
|
||||
}
|
||||
|
||||
public final Type type;
|
||||
@@ -35,7 +35,7 @@ public class TickEvent extends Event {
|
||||
this.phase = phase;
|
||||
}
|
||||
|
||||
public static class ServerTickEvent extends TickEvent {
|
||||
public static sealed class ServerTickEvent extends TickEvent {
|
||||
private final BooleanSupplier haveTime;
|
||||
private final MinecraftServer server;
|
||||
|
||||
@@ -61,38 +61,38 @@ public class TickEvent extends Event {
|
||||
return server;
|
||||
}
|
||||
|
||||
public static class Pre extends ServerTickEvent {
|
||||
public static final class Pre extends ServerTickEvent {
|
||||
public Pre(BooleanSupplier haveTime, MinecraftServer server) {
|
||||
super(haveTime, server, Phase.START);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Post extends ServerTickEvent {
|
||||
public static final class Post extends ServerTickEvent {
|
||||
public Post(BooleanSupplier haveTime, MinecraftServer server) {
|
||||
super(haveTime, server, Phase.END);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class ClientTickEvent extends TickEvent {
|
||||
public static sealed class ClientTickEvent extends TickEvent {
|
||||
protected ClientTickEvent(Phase phase) {
|
||||
super(Type.CLIENT, LogicalSide.CLIENT, phase);
|
||||
}
|
||||
|
||||
public static class Pre extends ClientTickEvent {
|
||||
public static final class Pre extends ClientTickEvent {
|
||||
public Pre() {
|
||||
super(Phase.START);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Post extends ClientTickEvent {
|
||||
public static final class Post extends ClientTickEvent {
|
||||
public Post() {
|
||||
super(Phase.END);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class LevelTickEvent extends TickEvent {
|
||||
public static sealed class LevelTickEvent extends TickEvent {
|
||||
public final Level level;
|
||||
private final BooleanSupplier haveTime;
|
||||
|
||||
@@ -112,20 +112,20 @@ public class TickEvent extends Event {
|
||||
return this.haveTime.getAsBoolean();
|
||||
}
|
||||
|
||||
public static class Pre extends LevelTickEvent {
|
||||
public static final class Pre extends LevelTickEvent {
|
||||
public Pre(LogicalSide side, Level level, BooleanSupplier haveTime) {
|
||||
super(side, level, haveTime, Phase.START);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Post extends LevelTickEvent {
|
||||
public static final class Post extends LevelTickEvent {
|
||||
public Post(LogicalSide side, Level level, BooleanSupplier haveTime) {
|
||||
super(side, level, haveTime, Phase.END);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class PlayerTickEvent extends TickEvent {
|
||||
public static sealed class PlayerTickEvent extends TickEvent {
|
||||
public final Player player;
|
||||
|
||||
protected PlayerTickEvent(Player player, Phase phase) {
|
||||
@@ -133,20 +133,20 @@ public class TickEvent extends Event {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
public static class Pre extends PlayerTickEvent {
|
||||
public static final class Pre extends PlayerTickEvent {
|
||||
public Pre(Player player) {
|
||||
super(player, Phase.START);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Post extends PlayerTickEvent {
|
||||
public static final class Post extends PlayerTickEvent {
|
||||
public Post(Player player) {
|
||||
super(player, Phase.END);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class RenderTickEvent extends TickEvent {
|
||||
public static sealed class RenderTickEvent extends TickEvent {
|
||||
private final DeltaTracker timer;
|
||||
|
||||
private RenderTickEvent(Phase phase, DeltaTracker timer) {
|
||||
@@ -158,13 +158,13 @@ public class TickEvent extends Event {
|
||||
return this.timer;
|
||||
}
|
||||
|
||||
public static class Pre extends RenderTickEvent {
|
||||
public static final class Pre extends RenderTickEvent {
|
||||
public Pre(DeltaTracker timer) {
|
||||
super(Phase.START, timer);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Post extends RenderTickEvent {
|
||||
public static final class Post extends RenderTickEvent {
|
||||
public Post(DeltaTracker timer) {
|
||||
super(Phase.END, timer);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
* Cancel this event to prevent Vanilla from posting the {@link GameEvent} to all nearby {@link net.minecraft.world.level.gameevent.GameEventListener GameEventListeners}.
|
||||
**/
|
||||
@Cancelable
|
||||
public class VanillaGameEvent extends Event
|
||||
public final class VanillaGameEvent extends Event
|
||||
{
|
||||
private final Level level;
|
||||
private final GameEvent vanillaEvent;
|
||||
|
||||
@@ -15,7 +15,7 @@ import net.minecraftforge.common.brewing.BrewingRecipe;
|
||||
import net.minecraftforge.common.brewing.IBrewingRecipe;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
|
||||
public class BrewingRecipeRegisterEvent extends Event {
|
||||
public final class BrewingRecipeRegisterEvent extends Event {
|
||||
private final PotionBrewing.Builder builder;
|
||||
private final FeatureFlagSet features;
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* This event is called when a player picks up a potion from a brewing stand.
|
||||
*/
|
||||
public class PlayerBrewedPotionEvent extends PlayerEvent
|
||||
public final class PlayerBrewedPotionEvent extends PlayerEvent
|
||||
{
|
||||
private final ItemStack stack;
|
||||
|
||||
|
||||
@@ -12,9 +12,9 @@ import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class PotionBrewEvent extends Event
|
||||
public sealed class PotionBrewEvent extends Event
|
||||
{
|
||||
private NonNullList<ItemStack> stacks;
|
||||
private final NonNullList<ItemStack> stacks;
|
||||
|
||||
protected PotionBrewEvent(NonNullList<ItemStack> stacks)
|
||||
{
|
||||
@@ -59,7 +59,7 @@ public class PotionBrewEvent extends Event
|
||||
* If this event is canceled, and items have been modified, PotionBrewEvent.Post will automatically be fired.
|
||||
**/
|
||||
@Cancelable
|
||||
public static class Pre extends PotionBrewEvent
|
||||
public static final class Pre extends PotionBrewEvent
|
||||
{
|
||||
public Pre(NonNullList<ItemStack> stacks)
|
||||
{
|
||||
@@ -80,7 +80,7 @@ public class PotionBrewEvent extends Event
|
||||
* <br>
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.<br>
|
||||
**/
|
||||
public static class Post extends PotionBrewEvent
|
||||
public static final class Post extends PotionBrewEvent
|
||||
{
|
||||
public Post(NonNullList<ItemStack> stacks)
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
* from 0-15 and indicates how many bookshelves surround the enchanting table. The {@link #itemStack} representing the item being
|
||||
* enchanted is also available.
|
||||
*/
|
||||
public class EnchantmentLevelSetEvent extends net.minecraftforge.eventbus.api.Event
|
||||
public final class EnchantmentLevelSetEvent extends net.minecraftforge.eventbus.api.Event
|
||||
{
|
||||
private final Level level;
|
||||
private final BlockPos pos;
|
||||
|
||||
@@ -21,7 +21,7 @@ import net.minecraftforge.fml.event.IModBusEvent;
|
||||
* <br>
|
||||
* Fired on the Mod bus {@link IModBusEvent}.<br>
|
||||
**/
|
||||
public class EntityAttributeCreationEvent extends Event implements IModBusEvent {
|
||||
public final class EntityAttributeCreationEvent extends Event implements IModBusEvent {
|
||||
private final Map<EntityType<? extends LivingEntity>, AttributeSupplier> map;
|
||||
|
||||
public EntityAttributeCreationEvent(Map<EntityType<? extends LivingEntity>, AttributeSupplier> map) {
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.util.stream.Collectors;
|
||||
* <br>
|
||||
* Fired on the Mod bus {@link IModBusEvent}.<br>
|
||||
**/
|
||||
public class EntityAttributeModificationEvent extends Event implements IModBusEvent {
|
||||
public final class EntityAttributeModificationEvent extends Event implements IModBusEvent {
|
||||
private final Map<EntityType<? extends LivingEntity>, AttributeSupplier.Builder> entityAttributes;
|
||||
private final List<EntityType<? extends LivingEntity>> entityTypes;
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ public class EntityEvent extends Event {
|
||||
* <br>
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.<br>
|
||||
**/
|
||||
public static class EntityConstructing extends EntityEvent {
|
||||
public static final class EntityConstructing extends EntityEvent {
|
||||
public EntityConstructing(Entity entity) {
|
||||
super(entity);
|
||||
}
|
||||
@@ -58,7 +58,7 @@ public class EntityEvent extends Event {
|
||||
* <br>
|
||||
* This event is fired on the {@link net.minecraftforge.common.MinecraftForge#EVENT_BUS}.<br>
|
||||
**/
|
||||
public static class EnteringSection extends EntityEvent {
|
||||
public static final class EnteringSection extends EntityEvent {
|
||||
private final long packedOldPos;
|
||||
private final long packedNewPos;
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import net.minecraftforge.fml.LogicalSide;
|
||||
* on both logical sides.
|
||||
**/
|
||||
@Cancelable
|
||||
public class EntityJoinLevelEvent extends EntityEvent {
|
||||
public final class EntityJoinLevelEvent extends EntityEvent {
|
||||
private final Level level;
|
||||
private final boolean loadedFromDisk;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import net.minecraftforge.eventbus.api.Cancelable;
|
||||
* This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}
|
||||
* on both logical sides.
|
||||
**/
|
||||
public class EntityLeaveLevelEvent extends EntityEvent {
|
||||
public final class EntityLeaveLevelEvent extends EntityEvent {
|
||||
private final Level level;
|
||||
|
||||
public EntityLeaveLevelEvent(Entity entity, Level level) {
|
||||
|
||||
@@ -22,7 +22,7 @@ import net.minecraftforge.eventbus.api.Event.HasResult;
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
*/
|
||||
@HasResult
|
||||
public class EntityMobGriefingEvent extends EntityEvent
|
||||
public final class EntityMobGriefingEvent extends EntityEvent
|
||||
{
|
||||
public EntityMobGriefingEvent(Entity entity)
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@ import net.minecraftforge.eventbus.api.Cancelable;
|
||||
*/
|
||||
|
||||
@Cancelable
|
||||
public class EntityMountEvent extends EntityEvent
|
||||
public final class EntityMountEvent extends EntityEvent
|
||||
{
|
||||
|
||||
private final Entity entityMounting;
|
||||
|
||||
@@ -26,7 +26,7 @@ import net.minecraftforge.eventbus.api.Cancelable;
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.<br>
|
||||
**/
|
||||
@net.minecraftforge.eventbus.api.Cancelable
|
||||
public class EntityStruckByLightningEvent extends EntityEvent
|
||||
public final class EntityStruckByLightningEvent extends EntityEvent
|
||||
{
|
||||
private final LightningBolt lightning;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
* All children of this event are fired on the {@link MinecraftForge#EVENT_BUS}.<br>
|
||||
**/
|
||||
@Cancelable
|
||||
public class EntityTeleportEvent extends EntityEvent
|
||||
public sealed class EntityTeleportEvent extends EntityEvent
|
||||
{
|
||||
protected double targetX;
|
||||
protected double targetY;
|
||||
@@ -70,7 +70,7 @@ public class EntityTeleportEvent extends EntityEvent
|
||||
* If this event is canceled, the entity will not be teleported.
|
||||
*/
|
||||
@Cancelable
|
||||
public static class TeleportCommand extends EntityTeleportEvent
|
||||
public static final class TeleportCommand extends EntityTeleportEvent
|
||||
{
|
||||
public TeleportCommand(Entity entity, double targetX, double targetY, double targetZ)
|
||||
{
|
||||
@@ -94,7 +94,7 @@ public class EntityTeleportEvent extends EntityEvent
|
||||
* If this event is canceled, the entity will not be teleported.
|
||||
*/
|
||||
@Cancelable
|
||||
public static class SpreadPlayersCommand extends EntityTeleportEvent
|
||||
public static final class SpreadPlayersCommand extends EntityTeleportEvent
|
||||
{
|
||||
public SpreadPlayersCommand(Entity entity, double targetX, double targetY, double targetZ)
|
||||
{
|
||||
@@ -117,7 +117,7 @@ public class EntityTeleportEvent extends EntityEvent
|
||||
* If this event is canceled, the entity will not be teleported.
|
||||
*/
|
||||
@Cancelable
|
||||
public static class EnderEntity extends EntityTeleportEvent
|
||||
public static final class EnderEntity extends EntityTeleportEvent
|
||||
{
|
||||
private final LivingEntity entityLiving;
|
||||
|
||||
@@ -148,7 +148,7 @@ public class EntityTeleportEvent extends EntityEvent
|
||||
* If this event is canceled, the entity will not be teleported.
|
||||
*/
|
||||
@Cancelable
|
||||
public static class EnderPearl extends EntityTeleportEvent
|
||||
public static final class EnderPearl extends EntityTeleportEvent
|
||||
{
|
||||
private final ServerPlayer player;
|
||||
private final ThrownEnderpearl pearlEntity;
|
||||
@@ -207,7 +207,7 @@ public class EntityTeleportEvent extends EntityEvent
|
||||
* If this event is canceled, the entity will not be teleported.
|
||||
*/
|
||||
@Cancelable
|
||||
public static class ChorusFruit extends EntityTeleportEvent
|
||||
public static final class ChorusFruit extends EntityTeleportEvent
|
||||
{
|
||||
private final LivingEntity entityLiving;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import net.minecraftforge.eventbus.api.Cancelable;
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.<br>
|
||||
**/
|
||||
@Cancelable
|
||||
public class EntityTravelToDimensionEvent extends EntityEvent
|
||||
public final class EntityTravelToDimensionEvent extends EntityEvent
|
||||
{
|
||||
private final ResourceKey<Level> dimension;
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.Objects;
|
||||
* You can also directly set the {@link ImpactResult} to change the impact behaviour.
|
||||
* @see #setImpactResult(ImpactResult)
|
||||
*/
|
||||
public class ProjectileImpactEvent extends EntityEvent {
|
||||
public final class ProjectileImpactEvent extends EntityEvent {
|
||||
private final HitResult ray;
|
||||
private final Projectile projectile;
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
*
|
||||
* Fired on the Mod bus {@link IModBusEvent}.<br>
|
||||
*/
|
||||
public class SpawnPlacementRegisterEvent extends Event implements IModBusEvent {
|
||||
public final class SpawnPlacementRegisterEvent extends Event implements IModBusEvent {
|
||||
private final Map<EntityType<?>, MergedSpawnPredicate<?>> map;
|
||||
|
||||
@ApiStatus.Internal
|
||||
|
||||
@@ -15,7 +15,7 @@ import net.minecraft.world.entity.item.ItemEntity;
|
||||
* it will add more time to the entities life equal to extraLife.
|
||||
*/
|
||||
@Cancelable
|
||||
public class ItemExpireEvent extends ItemEvent
|
||||
public final class ItemExpireEvent extends ItemEvent
|
||||
{
|
||||
|
||||
private int extraLife;
|
||||
|
||||
@@ -16,7 +16,7 @@ import net.minecraft.world.entity.player.Player;
|
||||
* removed from the inventory - and thus removed from the system.
|
||||
*/
|
||||
@Cancelable
|
||||
public class ItemTossEvent extends ItemEvent
|
||||
public final class ItemTossEvent extends ItemEvent
|
||||
{
|
||||
|
||||
private final Player player;
|
||||
|
||||
@@ -19,7 +19,7 @@ import net.minecraftforge.eventbus.api.Cancelable;
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
*/
|
||||
@Cancelable
|
||||
public class AnimalTameEvent extends LivingEvent
|
||||
public final class AnimalTameEvent extends LivingEvent
|
||||
{
|
||||
private final Animal animal;
|
||||
private final Player tamer;
|
||||
|
||||
@@ -38,7 +38,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
**/
|
||||
@Cancelable
|
||||
public class BabyEntitySpawnEvent extends Event {
|
||||
public final class BabyEntitySpawnEvent extends Event {
|
||||
private final Mob parentA;
|
||||
private final Mob parentB;
|
||||
private final Player causedByPlayer;
|
||||
|
||||
@@ -31,7 +31,7 @@ import net.minecraft.world.entity.LivingEntity;
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
**/
|
||||
@Cancelable
|
||||
public class LivingAttackEvent extends LivingEvent
|
||||
public final class LivingAttackEvent extends LivingEvent
|
||||
{
|
||||
private final DamageSource source;
|
||||
private final float amount;
|
||||
|
||||
@@ -23,7 +23,7 @@ import net.minecraftforge.eventbus.api.Cancelable;
|
||||
* <br>
|
||||
* This event is fired on {@link MinecraftForge#EVENT_BUS}
|
||||
*/
|
||||
public class LivingBreatheEvent extends LivingEvent {
|
||||
public final class LivingBreatheEvent extends LivingEvent {
|
||||
private boolean canBreathe;
|
||||
private boolean canRefillAir;
|
||||
private int consumeAirAmount;
|
||||
|
||||
@@ -34,7 +34,7 @@ import net.minecraftforge.eventbus.api.Cancelable;
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
*/
|
||||
@Cancelable
|
||||
public class LivingChangeTargetEvent extends LivingEvent {
|
||||
public final class LivingChangeTargetEvent extends LivingEvent {
|
||||
private final ILivingTargetType targetType;
|
||||
private final LivingEntity originalTarget;
|
||||
private LivingEntity newTarget;
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.function.Consumer;
|
||||
* Tadpole -> Frog when it grows up
|
||||
* Mushroom Cow -> Cow when sheared
|
||||
*/
|
||||
public class LivingConversionEvent extends LivingEvent {
|
||||
public sealed class LivingConversionEvent extends LivingEvent {
|
||||
public LivingConversionEvent(LivingEntity entity) {
|
||||
super(entity);
|
||||
}
|
||||
@@ -42,7 +42,7 @@ public class LivingConversionEvent extends LivingEvent {
|
||||
* If cancelled, the replacement will not occur
|
||||
*/
|
||||
@Cancelable
|
||||
public static class Pre extends LivingConversionEvent {
|
||||
public static final class Pre extends LivingConversionEvent {
|
||||
private final EntityType<? extends LivingEntity> outcome;
|
||||
private final Consumer<Integer> timer;
|
||||
|
||||
@@ -79,7 +79,7 @@ public class LivingConversionEvent extends LivingEvent {
|
||||
* itself with another entity.
|
||||
* The old living entity is likely to be removed right after this event.
|
||||
*/
|
||||
public static class Post extends LivingConversionEvent {
|
||||
public static final class Post extends LivingConversionEvent {
|
||||
private final LivingEntity outcome;
|
||||
|
||||
public Post(LivingEntity entity, LivingEntity outcome) {
|
||||
|
||||
@@ -30,7 +30,7 @@ import net.minecraft.world.entity.LivingEntity;
|
||||
* @see LivingHurtEvent
|
||||
**/
|
||||
@Cancelable
|
||||
public class LivingDamageEvent extends LivingEvent
|
||||
public final class LivingDamageEvent extends LivingEvent
|
||||
{
|
||||
private final DamageSource source;
|
||||
private float amount;
|
||||
|
||||
@@ -32,7 +32,7 @@ import net.minecraft.world.entity.LivingEntity;
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
**/
|
||||
@Cancelable
|
||||
public class LivingDeathEvent extends LivingEvent
|
||||
public final class LivingDeathEvent extends LivingEvent
|
||||
{
|
||||
private final DamageSource source;
|
||||
public LivingDeathEvent(LivingEntity entity, DamageSource source)
|
||||
|
||||
@@ -25,7 +25,7 @@ import net.minecraftforge.eventbus.api.Cancelable;
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
**/
|
||||
@Cancelable
|
||||
public class LivingDestroyBlockEvent extends LivingEvent
|
||||
public final class LivingDestroyBlockEvent extends LivingEvent
|
||||
{
|
||||
private final BlockPos pos;
|
||||
private final BlockState state;
|
||||
|
||||
@@ -34,7 +34,7 @@ import net.minecraftforge.eventbus.api.Cancelable;
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
**/
|
||||
@net.minecraftforge.eventbus.api.Cancelable
|
||||
public class LivingDropsEvent extends LivingEvent {
|
||||
public final class LivingDropsEvent extends LivingEvent {
|
||||
private final DamageSource source;
|
||||
private final Collection<ItemEntity> drops;
|
||||
private final boolean recentlyHit;
|
||||
|
||||
@@ -26,7 +26,7 @@ import net.minecraftforge.eventbus.api.Cancelable;
|
||||
* This event is fired on {@link MinecraftForge#EVENT_BUS}
|
||||
**/
|
||||
@Cancelable
|
||||
public class LivingDrownEvent extends LivingEvent {
|
||||
public final class LivingDrownEvent extends LivingEvent {
|
||||
private boolean isDrowning;
|
||||
private float damageAmount;
|
||||
private int bubbleCount;
|
||||
|
||||
@@ -10,7 +10,7 @@ import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class LivingEntityUseItemEvent extends LivingEvent
|
||||
public sealed class LivingEntityUseItemEvent extends LivingEvent
|
||||
{
|
||||
private final ItemStack item;
|
||||
private int duration;
|
||||
@@ -50,7 +50,7 @@ public class LivingEntityUseItemEvent extends LivingEvent
|
||||
*
|
||||
*/
|
||||
@Cancelable
|
||||
public static class Start extends LivingEntityUseItemEvent
|
||||
public static final class Start extends LivingEntityUseItemEvent
|
||||
{
|
||||
public Start(LivingEntity entity, @NotNull ItemStack item, int duration)
|
||||
{
|
||||
@@ -65,7 +65,7 @@ public class LivingEntityUseItemEvent extends LivingEvent
|
||||
*
|
||||
*/
|
||||
@Cancelable
|
||||
public static class Tick extends LivingEntityUseItemEvent
|
||||
public static final class Tick extends LivingEntityUseItemEvent
|
||||
{
|
||||
public Tick(LivingEntity entity, @NotNull ItemStack item, int duration)
|
||||
{
|
||||
@@ -86,7 +86,7 @@ public class LivingEntityUseItemEvent extends LivingEvent
|
||||
* The only vanilla item this would effect are bows, and it would cause them NOT to fire there arrow.
|
||||
*/
|
||||
@Cancelable
|
||||
public static class Stop extends LivingEntityUseItemEvent
|
||||
public static final class Stop extends LivingEntityUseItemEvent
|
||||
{
|
||||
public Stop(LivingEntity entity, @NotNull ItemStack item, int duration)
|
||||
{
|
||||
@@ -106,7 +106,7 @@ public class LivingEntityUseItemEvent extends LivingEvent
|
||||
* The result item stack is the stack that is placed in the player's inventory in replacement of the stack that is currently being used.
|
||||
*
|
||||
*/
|
||||
public static class Finish extends LivingEntityUseItemEvent
|
||||
public static final class Finish extends LivingEntityUseItemEvent
|
||||
{
|
||||
private ItemStack result;
|
||||
public Finish(LivingEntity entity, @NotNull ItemStack item, int duration, @NotNull ItemStack result)
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
* <br>
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
**/
|
||||
public class LivingEquipmentChangeEvent extends LivingEvent {
|
||||
public final class LivingEquipmentChangeEvent extends LivingEvent {
|
||||
private final EquipmentSlot slot;
|
||||
private final ItemStack from;
|
||||
private final ItemStack to;
|
||||
|
||||
@@ -51,7 +51,7 @@ public class LivingEvent extends EntityEvent
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
**/
|
||||
@Cancelable
|
||||
public static class LivingTickEvent extends LivingEvent
|
||||
public static final class LivingTickEvent extends LivingEvent
|
||||
{
|
||||
public LivingTickEvent(LivingEntity e){ super(e); }
|
||||
}
|
||||
@@ -70,12 +70,12 @@ public class LivingEvent extends EntityEvent
|
||||
* <br>
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
**/
|
||||
public static class LivingJumpEvent extends LivingEvent
|
||||
public static final class LivingJumpEvent extends LivingEvent
|
||||
{
|
||||
public LivingJumpEvent(LivingEntity e){ super(e); }
|
||||
}
|
||||
|
||||
public static class LivingVisibilityEvent extends LivingEvent
|
||||
public static final class LivingVisibilityEvent extends LivingEvent
|
||||
{
|
||||
private double visibilityModifier;
|
||||
@Nullable
|
||||
|
||||
@@ -16,7 +16,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
* by canceling the event.
|
||||
*/
|
||||
@Cancelable
|
||||
public class LivingExperienceDropEvent extends LivingEvent
|
||||
public final class LivingExperienceDropEvent extends LivingEvent
|
||||
{
|
||||
@Nullable private final Player attackingPlayer;
|
||||
private final int originalExperiencePoints;
|
||||
|
||||
@@ -28,7 +28,7 @@ import net.minecraft.world.entity.LivingEntity;
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
**/
|
||||
@Cancelable
|
||||
public class LivingFallEvent extends LivingEvent {
|
||||
public final class LivingFallEvent extends LivingEvent {
|
||||
private double distance;
|
||||
private float damageMultiplier;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import net.minecraft.world.item.ItemStack;
|
||||
* <p>
|
||||
* This event is fired on the {@link net.minecraftforge.common.MinecraftForge#EVENT_BUS}.
|
||||
*/
|
||||
public class LivingGetProjectileEvent extends LivingEvent
|
||||
public final class LivingGetProjectileEvent extends LivingEvent
|
||||
{
|
||||
private final ItemStack projectileWeaponItemStack;
|
||||
private ItemStack projectileItemStack;
|
||||
|
||||
@@ -26,7 +26,7 @@ import net.minecraft.world.entity.LivingEntity;
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
**/
|
||||
@Cancelable
|
||||
public class LivingHealEvent extends LivingEvent
|
||||
public final class LivingHealEvent extends LivingEvent
|
||||
{
|
||||
private float amount;
|
||||
public LivingHealEvent(LivingEntity entity, float amount)
|
||||
|
||||
@@ -31,7 +31,7 @@ import net.minecraftforge.eventbus.api.Cancelable;
|
||||
* @see LivingDamageEvent
|
||||
**/
|
||||
@net.minecraftforge.eventbus.api.Cancelable
|
||||
public class LivingHurtEvent extends LivingEvent
|
||||
public final class LivingHurtEvent extends LivingEvent
|
||||
{
|
||||
private final DamageSource source;
|
||||
private float amount;
|
||||
|
||||
@@ -31,7 +31,7 @@ import net.minecraftforge.eventbus.api.Cancelable;
|
||||
* <br>
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
**/
|
||||
public class LivingMakeBrainEvent extends LivingEvent
|
||||
public final class LivingMakeBrainEvent extends LivingEvent
|
||||
{
|
||||
private final BrainBuilder<?> brainBuilder;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import net.minecraftforge.eventbus.api.Event.HasResult;
|
||||
import net.minecraft.world.entity.Mob;
|
||||
|
||||
@HasResult
|
||||
public class LivingPackSizeEvent extends LivingEvent
|
||||
public final class LivingPackSizeEvent extends LivingEvent
|
||||
{
|
||||
private int maxPackSize;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
public class LivingSwapItemsEvent extends LivingEvent
|
||||
public sealed class LivingSwapItemsEvent extends LivingEvent
|
||||
{
|
||||
|
||||
@ApiStatus.Internal
|
||||
@@ -27,7 +27,7 @@ public class LivingSwapItemsEvent extends LivingEvent
|
||||
* <p>This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.
|
||||
*/
|
||||
@Cancelable
|
||||
public static class Hands extends LivingSwapItemsEvent
|
||||
public static final class Hands extends LivingSwapItemsEvent
|
||||
{
|
||||
private ItemStack toMainHand;
|
||||
private ItemStack toOffHand;
|
||||
|
||||
@@ -23,7 +23,7 @@ import net.minecraftforge.fml.LogicalSide;
|
||||
* only on the {@linkplain LogicalSide#SERVER logical server}.</p>
|
||||
*/
|
||||
@Cancelable
|
||||
public class LivingUseTotemEvent extends LivingEvent
|
||||
public final class LivingUseTotemEvent extends LivingEvent
|
||||
{
|
||||
private final DamageSource source;
|
||||
private final ItemStack totem;
|
||||
|
||||
@@ -10,7 +10,7 @@ import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class LootingLevelEvent extends LivingEvent {
|
||||
public final class LootingLevelEvent extends LivingEvent {
|
||||
|
||||
@Nullable
|
||||
private final DamageSource damageSource;
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
* <p>
|
||||
* All children of this event are fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
*/
|
||||
public class MobEffectEvent extends LivingEvent {
|
||||
public sealed class MobEffectEvent extends LivingEvent {
|
||||
@Nullable
|
||||
protected final MobEffectInstance effectInstance;
|
||||
|
||||
@@ -40,7 +40,7 @@ public class MobEffectEvent extends LivingEvent {
|
||||
* This Event does not have a result.
|
||||
*/
|
||||
@Cancelable
|
||||
public static class Remove extends MobEffectEvent {
|
||||
public static final class Remove extends MobEffectEvent {
|
||||
private final MobEffect effect;
|
||||
|
||||
public Remove(LivingEntity living, MobEffect effect) {
|
||||
@@ -80,7 +80,7 @@ public class MobEffectEvent extends LivingEvent {
|
||||
* {@link Result#DEFAULT DEFAULT} will run vanilla logic to determine if this mob effect is applicable in {@link LivingEntity#canBeAffected}.
|
||||
*/
|
||||
@HasResult
|
||||
public static class Applicable extends MobEffectEvent {
|
||||
public static final class Applicable extends MobEffectEvent {
|
||||
public Applicable(LivingEntity living, @NotNull MobEffectInstance effectInstance) {
|
||||
super(living, effectInstance);
|
||||
}
|
||||
@@ -98,7 +98,7 @@ public class MobEffectEvent extends LivingEvent {
|
||||
* This event is not {@link Cancelable}.
|
||||
* This event does not have a result.
|
||||
*/
|
||||
public static class Added extends MobEffectEvent {
|
||||
public static final class Added extends MobEffectEvent {
|
||||
private final MobEffectInstance oldEffectInstance;
|
||||
private final Entity source;
|
||||
|
||||
@@ -139,7 +139,7 @@ public class MobEffectEvent extends LivingEvent {
|
||||
* This event is not {@link Cancelable}.
|
||||
* This event does not have a result.
|
||||
*/
|
||||
public static class Expired extends MobEffectEvent {
|
||||
public static final class Expired extends MobEffectEvent {
|
||||
public Expired(LivingEntity living, MobEffectInstance effect) {
|
||||
super(living, effect);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ import net.minecraftforge.fml.LogicalSide;
|
||||
* <p>
|
||||
* {@link AllowDespawn} is not related to the mob spawn event flow, as it fires when a despawn is attempted.
|
||||
*/
|
||||
public abstract class MobSpawnEvent extends EntityEvent {
|
||||
public abstract sealed class MobSpawnEvent extends EntityEvent {
|
||||
private final ServerLevelAccessor level;
|
||||
private final double x;
|
||||
private final double y;
|
||||
@@ -104,7 +104,7 @@ public abstract class MobSpawnEvent extends EntityEvent {
|
||||
* @see SpawnPlacementRegisterEvent
|
||||
*/
|
||||
@HasResult
|
||||
public static class SpawnPlacementCheck extends Event {
|
||||
public static final class SpawnPlacementCheck extends Event {
|
||||
private final EntityType<?> entityType;
|
||||
private final ServerLevelAccessor level;
|
||||
private final EntitySpawnReason spawnReason;
|
||||
@@ -201,7 +201,7 @@ public abstract class MobSpawnEvent extends EntityEvent {
|
||||
* @see {@link SpawnPlacementCheck} To modify the result of spawn placements at runtime.
|
||||
*/
|
||||
@HasResult
|
||||
public static class PositionCheck extends MobSpawnEvent {
|
||||
public static final class PositionCheck extends MobSpawnEvent {
|
||||
@Nullable
|
||||
private final BaseSpawner spawner;
|
||||
private final EntitySpawnReason spawnReason;
|
||||
@@ -245,7 +245,7 @@ public abstract class MobSpawnEvent extends EntityEvent {
|
||||
* @apiNote Callers do not need to check if the entity's spawn was cancelled, as the spawn will be blocked by Forge.
|
||||
*/
|
||||
@Cancelable
|
||||
public static class FinalizeSpawn extends MobSpawnEvent {
|
||||
public static final class FinalizeSpawn extends MobSpawnEvent {
|
||||
private final EntitySpawnReason spawnReason;
|
||||
@Nullable
|
||||
private final BaseSpawner spawner;
|
||||
@@ -383,7 +383,7 @@ public abstract class MobSpawnEvent extends EntityEvent {
|
||||
// TODO: 1.20 Move to standalone class, as it is unrelated to the complex mob spawning flow.
|
||||
// Such a refactor will allow the BaseSpawner and MobSpawnType params to be hoisted to MobSpawnEvent.
|
||||
@HasResult
|
||||
public static class AllowDespawn extends MobSpawnEvent {
|
||||
public static final class AllowDespawn extends MobSpawnEvent {
|
||||
public AllowDespawn(Mob mob, ServerLevelAccessor level) {
|
||||
super(mob, level, mob.getX(), mob.getY(), mob.getZ());
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import net.minecraftforge.eventbus.api.Cancelable;
|
||||
* This event does not have a {@link Result}.
|
||||
*/
|
||||
@Cancelable
|
||||
public class MonsterDisguiseEvent extends LivingEvent {
|
||||
public final class MonsterDisguiseEvent extends LivingEvent {
|
||||
private final Player player;
|
||||
|
||||
public MonsterDisguiseEvent(Monster monster, Player player) {
|
||||
|
||||
@@ -19,7 +19,7 @@ import net.minecraftforge.eventbus.api.Cancelable;
|
||||
* at least for players.
|
||||
*/
|
||||
@Cancelable
|
||||
public class ShieldBlockEvent extends LivingEvent {
|
||||
public final class ShieldBlockEvent extends LivingEvent {
|
||||
private final DamageSource source;
|
||||
private final float originalBlocked;
|
||||
private float dmgBlocked;
|
||||
|
||||
@@ -20,7 +20,7 @@ import net.minecraftforge.eventbus.api.Cancelable;
|
||||
*
|
||||
* All children of this event are fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
**/
|
||||
public class ZombieEvent extends EntityEvent {
|
||||
public sealed class ZombieEvent extends EntityEvent {
|
||||
private final Zombie zombie;
|
||||
|
||||
public ZombieEvent(Zombie zombie)
|
||||
@@ -59,7 +59,7 @@ public class ZombieEvent extends EntityEvent {
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
**/
|
||||
@HasResult
|
||||
public static class SummonAidEvent extends ZombieEvent {
|
||||
public static final class SummonAidEvent extends ZombieEvent {
|
||||
private Zombie customSummonedAid;
|
||||
|
||||
private final Level level;
|
||||
|
||||
@@ -16,7 +16,7 @@ import net.minecraftforge.common.MinecraftForge;
|
||||
* @see AdvancementEarnEvent
|
||||
* @see AdvancementProgressEvent
|
||||
*/
|
||||
public class AdvancementEvent extends PlayerEvent {
|
||||
public sealed class AdvancementEvent extends PlayerEvent {
|
||||
private final AdvancementHolder advancement;
|
||||
|
||||
public AdvancementEvent(Player player, AdvancementHolder advancement) {
|
||||
@@ -41,7 +41,7 @@ public class AdvancementEvent extends PlayerEvent {
|
||||
*
|
||||
* @see AdvancementProgress#isDone()
|
||||
*/
|
||||
public static class AdvancementEarnEvent extends AdvancementEvent {
|
||||
public static final class AdvancementEarnEvent extends AdvancementEvent {
|
||||
public AdvancementEarnEvent(Player player, AdvancementHolder earned) {
|
||||
super(player, earned);
|
||||
}
|
||||
@@ -59,7 +59,7 @@ public class AdvancementEvent extends PlayerEvent {
|
||||
* @see net.minecraft.server.PlayerAdvancements#award(Advancement, String)
|
||||
* @see net.minecraft.server.PlayerAdvancements#revoke(Advancement, String)
|
||||
*/
|
||||
public static class AdvancementProgressEvent extends AdvancementEvent {
|
||||
public static final class AdvancementProgressEvent extends AdvancementEvent {
|
||||
private final AdvancementProgress advancementProgress;
|
||||
private final String criterionName;
|
||||
private final AdvancementEvent.AdvancementProgressEvent.ProgressType progressType;
|
||||
|
||||
@@ -16,7 +16,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
*
|
||||
* ItemStacks are the inputs/output from the anvil. They cannot be edited.
|
||||
*/
|
||||
public class AnvilRepairEvent extends PlayerEvent
|
||||
public final class AnvilRepairEvent extends PlayerEvent
|
||||
{
|
||||
@NotNull
|
||||
private final ItemStack left; // The left side of the input
|
||||
|
||||
@@ -31,7 +31,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
**/
|
||||
@Cancelable
|
||||
public class ArrowLooseEvent extends PlayerEvent
|
||||
public final class ArrowLooseEvent extends PlayerEvent
|
||||
{
|
||||
private final ItemStack bow;
|
||||
private final Level level;
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
* <br>
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
**/
|
||||
public class ArrowNockEvent extends PlayerEvent {
|
||||
public final class ArrowNockEvent extends PlayerEvent {
|
||||
private final ItemStack bow;
|
||||
private final InteractionHand hand;
|
||||
private final Level level;
|
||||
|
||||
@@ -25,7 +25,7 @@ import net.minecraft.world.entity.player.Player;
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
**/
|
||||
@Cancelable
|
||||
public class AttackEntityEvent extends PlayerEvent
|
||||
public final class AttackEntityEvent extends PlayerEvent
|
||||
{
|
||||
private final Entity target;
|
||||
public AttackEntityEvent(Player player, Entity target)
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
@Cancelable
|
||||
@HasResult
|
||||
// TODO: Redesign BonemealEvent the whole thing, it doens't make sense.
|
||||
public class BonemealEvent extends PlayerEvent {
|
||||
public final class BonemealEvent extends PlayerEvent {
|
||||
private final Level level;
|
||||
private final BlockPos pos;
|
||||
private final BlockState block;
|
||||
|
||||
@@ -25,7 +25,7 @@ import net.minecraft.world.entity.player.Player;
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
**/
|
||||
@HasResult
|
||||
public class CriticalHitEvent extends PlayerEvent
|
||||
public final class CriticalHitEvent extends PlayerEvent
|
||||
{
|
||||
private float damageModifier;
|
||||
private final float oldDamageModifier;
|
||||
|
||||
@@ -22,7 +22,7 @@ import net.minecraft.world.entity.player.Player;
|
||||
*/
|
||||
@Cancelable
|
||||
@Event.HasResult
|
||||
public class EntityItemPickupEvent extends PlayerEvent
|
||||
public final class EntityItemPickupEvent extends PlayerEvent
|
||||
{
|
||||
private final ItemEntity item;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
@Cancelable
|
||||
@Event.HasResult
|
||||
public class FillBucketEvent extends PlayerEvent
|
||||
public final class FillBucketEvent extends PlayerEvent
|
||||
{
|
||||
|
||||
private final ItemStack current;
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.List;
|
||||
* The hook will still take the damage specified
|
||||
*/
|
||||
@Cancelable
|
||||
public class ItemFishedEvent extends PlayerEvent {
|
||||
public final class ItemFishedEvent extends PlayerEvent {
|
||||
private final NonNullList<ItemStack> stacks = NonNullList.create();
|
||||
private final FishingHook hook;
|
||||
private int rodDamage;
|
||||
|
||||
@@ -15,7 +15,7 @@ import net.minecraft.network.chat.Component;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class ItemTooltipEvent extends PlayerEvent
|
||||
public final class ItemTooltipEvent extends PlayerEvent
|
||||
{
|
||||
private final TooltipFlag flags;
|
||||
@NotNull
|
||||
|
||||
@@ -14,7 +14,7 @@ import net.minecraftforge.eventbus.api.Cancelable;
|
||||
* This event is cancelable which will stop the op or deop from happening.
|
||||
*/
|
||||
@Cancelable
|
||||
public class PermissionsChangedEvent extends PlayerEvent
|
||||
public final class PermissionsChangedEvent extends PlayerEvent
|
||||
{
|
||||
private final int newLevel;
|
||||
private final int oldLevel;
|
||||
|
||||
@@ -8,7 +8,7 @@ package net.minecraftforge.event.entity.player;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||
|
||||
public class PlayerContainerEvent extends PlayerEvent
|
||||
public sealed class PlayerContainerEvent extends PlayerEvent
|
||||
{
|
||||
private final AbstractContainerMenu container;
|
||||
public PlayerContainerEvent(Player player, AbstractContainerMenu container)
|
||||
@@ -17,14 +17,14 @@ public class PlayerContainerEvent extends PlayerEvent
|
||||
this.container = container;
|
||||
}
|
||||
|
||||
public static class Open extends PlayerContainerEvent
|
||||
public static final class Open extends PlayerContainerEvent
|
||||
{
|
||||
public Open(Player player, AbstractContainerMenu container)
|
||||
{
|
||||
super(player, container);
|
||||
}
|
||||
}
|
||||
public static class Close extends PlayerContainerEvent
|
||||
public static final class Close extends PlayerContainerEvent
|
||||
{
|
||||
public Close(Player player, AbstractContainerMenu container)
|
||||
{
|
||||
|
||||
@@ -48,7 +48,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
* This event is fired from {@link ForgeEventFactory#onPlayerDestroyItem(Player, ItemStack, InteractionHand)}.<br>
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
**/
|
||||
public class PlayerDestroyItemEvent extends PlayerEvent {
|
||||
public final class PlayerDestroyItemEvent extends PlayerEvent {
|
||||
@NotNull
|
||||
private final ItemStack original;
|
||||
@Nullable
|
||||
|
||||
@@ -66,7 +66,7 @@ public class PlayerEvent extends LivingEvent
|
||||
* <br>
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
**/
|
||||
public static class HarvestCheck extends PlayerEvent
|
||||
public static final class HarvestCheck extends PlayerEvent
|
||||
{
|
||||
private final BlockState state;
|
||||
private boolean success;
|
||||
@@ -103,7 +103,7 @@ public class PlayerEvent extends LivingEvent
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
**/
|
||||
@Cancelable
|
||||
public static class BreakSpeed extends PlayerEvent
|
||||
public static final class BreakSpeed extends PlayerEvent
|
||||
{
|
||||
private static final BlockPos LEGACY_UNKNOWN = new BlockPos(0, -1, 0);
|
||||
private final BlockState state;
|
||||
@@ -143,7 +143,7 @@ public class PlayerEvent extends LivingEvent
|
||||
* <br>
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
**/
|
||||
public static class NameFormat extends PlayerEvent
|
||||
public static final class NameFormat extends PlayerEvent
|
||||
{
|
||||
private final Component username;
|
||||
private Component displayname;
|
||||
@@ -186,7 +186,7 @@ public class PlayerEvent extends LivingEvent
|
||||
* <br>
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
**/
|
||||
public static class TabListNameFormat extends PlayerEvent
|
||||
public static final class TabListNameFormat extends PlayerEvent
|
||||
{
|
||||
@Nullable
|
||||
private Component displayName;
|
||||
@@ -212,7 +212,7 @@ public class PlayerEvent extends LivingEvent
|
||||
* Fired when the EntityPlayer is cloned, typically caused by the impl sending a RESPAWN_PLAYER event.
|
||||
* Either caused by death, or by traveling from the End to the overworld.
|
||||
*/
|
||||
public static class Clone extends PlayerEvent
|
||||
public static final class Clone extends PlayerEvent
|
||||
{
|
||||
private final Player original;
|
||||
private final boolean wasDeath;
|
||||
@@ -246,7 +246,7 @@ public class PlayerEvent extends LivingEvent
|
||||
* Fired when an Entity is started to be "tracked" by this player (the player receives updates about this entity, e.g. motion).
|
||||
*
|
||||
*/
|
||||
public static class StartTracking extends PlayerEvent {
|
||||
public static final class StartTracking extends PlayerEvent {
|
||||
|
||||
private final Entity target;
|
||||
|
||||
@@ -269,7 +269,7 @@ public class PlayerEvent extends LivingEvent
|
||||
* Fired when an Entity is stopped to be "tracked" by this player (the player no longer receives updates about this entity, e.g. motion).
|
||||
*
|
||||
*/
|
||||
public static class StopTracking extends PlayerEvent {
|
||||
public static final class StopTracking extends PlayerEvent {
|
||||
|
||||
private final Entity target;
|
||||
|
||||
@@ -294,7 +294,7 @@ public class PlayerEvent extends LivingEvent
|
||||
* allow mods to load an additional file from the players directory
|
||||
* containing additional mod related player data.
|
||||
*/
|
||||
public static class LoadFromFile extends PlayerEvent {
|
||||
public static final class LoadFromFile extends PlayerEvent {
|
||||
private final File playerDirectory;
|
||||
private final String playerUUID;
|
||||
|
||||
@@ -346,7 +346,7 @@ public class PlayerEvent extends LivingEvent
|
||||
* <em>WARNING</em>: Do not overwrite the player's .dat file here. You will
|
||||
* corrupt the world state.
|
||||
*/
|
||||
public static class SaveToFile extends PlayerEvent {
|
||||
public static final class SaveToFile extends PlayerEvent {
|
||||
private final File playerDirectory;
|
||||
private final String playerUUID;
|
||||
|
||||
@@ -386,7 +386,7 @@ public class PlayerEvent extends LivingEvent
|
||||
}
|
||||
}
|
||||
|
||||
public static class ItemPickupEvent extends PlayerEvent {
|
||||
public static final class ItemPickupEvent extends PlayerEvent {
|
||||
/**
|
||||
* Original EntityItem with current remaining stack size
|
||||
*/
|
||||
@@ -411,7 +411,7 @@ public class PlayerEvent extends LivingEvent
|
||||
}
|
||||
}
|
||||
|
||||
public static class ItemCraftedEvent extends PlayerEvent {
|
||||
public static final class ItemCraftedEvent extends PlayerEvent {
|
||||
@NotNull
|
||||
private final ItemStack crafting;
|
||||
private final Container craftMatrix;
|
||||
@@ -434,7 +434,7 @@ public class PlayerEvent extends LivingEvent
|
||||
}
|
||||
}
|
||||
|
||||
public static class ItemSmeltedEvent extends PlayerEvent {
|
||||
public static final class ItemSmeltedEvent extends PlayerEvent {
|
||||
@NotNull
|
||||
private final ItemStack smelting;
|
||||
public ItemSmeltedEvent(Player player, @NotNull ItemStack crafting)
|
||||
@@ -450,21 +450,21 @@ public class PlayerEvent extends LivingEvent
|
||||
}
|
||||
}
|
||||
|
||||
public static class PlayerLoggedInEvent extends PlayerEvent {
|
||||
public static final class PlayerLoggedInEvent extends PlayerEvent {
|
||||
public PlayerLoggedInEvent(Player player)
|
||||
{
|
||||
super(player);
|
||||
}
|
||||
}
|
||||
|
||||
public static class PlayerLoggedOutEvent extends PlayerEvent {
|
||||
public static final class PlayerLoggedOutEvent extends PlayerEvent {
|
||||
public PlayerLoggedOutEvent(Player player)
|
||||
{
|
||||
super(player);
|
||||
}
|
||||
}
|
||||
|
||||
public static class PlayerRespawnEvent extends PlayerEvent {
|
||||
public static final class PlayerRespawnEvent extends PlayerEvent {
|
||||
private final boolean endConquered;
|
||||
|
||||
public PlayerRespawnEvent(Player player, boolean endConquered)
|
||||
@@ -485,7 +485,7 @@ public class PlayerEvent extends LivingEvent
|
||||
|
||||
}
|
||||
|
||||
public static class PlayerChangedDimensionEvent extends PlayerEvent {
|
||||
public static final class PlayerChangedDimensionEvent extends PlayerEvent {
|
||||
private final ResourceKey<Level> fromDim;
|
||||
private final ResourceKey<Level> toDim;
|
||||
public PlayerChangedDimensionEvent(Player player, ResourceKey<Level> fromDim, ResourceKey<Level> toDim)
|
||||
@@ -511,7 +511,7 @@ public class PlayerEvent extends LivingEvent
|
||||
* If the event is cancelled the game mode of the player is not changed and the value of <code>newGameMode</code> is ignored.
|
||||
*/
|
||||
@Cancelable
|
||||
public static class PlayerChangeGameModeEvent extends PlayerEvent
|
||||
public static final class PlayerChangeGameModeEvent extends PlayerEvent
|
||||
{
|
||||
private final GameType currentGameMode;
|
||||
private GameType newGameMode;
|
||||
|
||||
@@ -12,7 +12,7 @@ import net.minecraft.world.entity.player.Player;
|
||||
* @author Mithion
|
||||
*
|
||||
*/
|
||||
public class PlayerFlyableFallEvent extends PlayerEvent
|
||||
public final class PlayerFlyableFallEvent extends PlayerEvent
|
||||
{
|
||||
private float distance;
|
||||
private float multiplier;
|
||||
|
||||
@@ -37,7 +37,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
* All subclasses are fired on {@link MinecraftForge#EVENT_BUS}.
|
||||
* See the individual documentation on each subevent for more details.
|
||||
**/
|
||||
public class PlayerInteractEvent extends PlayerEvent {
|
||||
public sealed class PlayerInteractEvent extends PlayerEvent {
|
||||
private final InteractionHand hand;
|
||||
private final BlockPos pos;
|
||||
@Nullable
|
||||
@@ -61,7 +61,7 @@ public class PlayerInteractEvent extends PlayerEvent {
|
||||
* If we are on the client and result is not {@link InteractionResult#SUCCESS}, the client will then try {@link EntityInteract}.
|
||||
*/
|
||||
@Cancelable
|
||||
public static class EntityInteractSpecific extends PlayerInteractEvent {
|
||||
public static final class EntityInteractSpecific extends PlayerInteractEvent {
|
||||
private final Vec3 localPos;
|
||||
private final Entity target;
|
||||
|
||||
@@ -100,7 +100,7 @@ public class PlayerInteractEvent extends PlayerEvent {
|
||||
* If we are on the client and result is not {@link InteractionResult#SUCCESS}, the client will then try {@link RightClickItem}.
|
||||
*/
|
||||
@Cancelable
|
||||
public static class EntityInteract extends PlayerInteractEvent {
|
||||
public static final class EntityInteract extends PlayerInteractEvent {
|
||||
private final Entity target;
|
||||
|
||||
public EntityInteract(Player player, InteractionHand hand, Entity target) {
|
||||
@@ -127,10 +127,10 @@ public class PlayerInteractEvent extends PlayerEvent {
|
||||
* Note that handling things differently on the client vs server may cause desynchronizations!
|
||||
*/
|
||||
@Cancelable
|
||||
public static class RightClickBlock extends PlayerInteractEvent {
|
||||
public static final class RightClickBlock extends PlayerInteractEvent {
|
||||
private Result useBlock = Result.DEFAULT;
|
||||
private Result useItem = Result.DEFAULT;
|
||||
private BlockHitResult hitVec;
|
||||
private final BlockHitResult hitVec;
|
||||
|
||||
public RightClickBlock(Player player, InteractionHand hand, BlockPos pos, BlockHitResult hitVec) {
|
||||
super(player, hand, pos, hitVec.getDirection());
|
||||
@@ -195,7 +195,7 @@ public class PlayerInteractEvent extends PlayerEvent {
|
||||
* If we are on the client and result is not {@link InteractionResult#SUCCESS}, the client will then continue to other hands.
|
||||
*/
|
||||
@Cancelable
|
||||
public static class RightClickItem extends PlayerInteractEvent {
|
||||
public static final class RightClickItem extends PlayerInteractEvent {
|
||||
public RightClickItem(Player player, InteractionHand hand) {
|
||||
super(player, hand, player.blockPosition(), null);
|
||||
}
|
||||
@@ -206,7 +206,7 @@ public class PlayerInteractEvent extends PlayerEvent {
|
||||
* The server is not aware of when the client right clicks empty space with an empty hand, you will need to tell the server yourself.
|
||||
* This event cannot be canceled.
|
||||
*/
|
||||
public static class RightClickEmpty extends PlayerInteractEvent {
|
||||
public static final class RightClickEmpty extends PlayerInteractEvent {
|
||||
public RightClickEmpty(Player player, InteractionHand hand) {
|
||||
super(player, hand, player.blockPosition(), null);
|
||||
}
|
||||
@@ -228,7 +228,7 @@ public class PlayerInteractEvent extends PlayerEvent {
|
||||
* Therefore, in creative mode, {@link #setUseBlock} and {@link #setUseItem} have no effect.
|
||||
*/
|
||||
@Cancelable
|
||||
public static class LeftClickBlock extends PlayerInteractEvent {
|
||||
public static final class LeftClickBlock extends PlayerInteractEvent {
|
||||
private Result useBlock = Result.DEFAULT;
|
||||
private Result useItem = Result.DEFAULT;
|
||||
private final Action action;
|
||||
@@ -313,7 +313,7 @@ public class PlayerInteractEvent extends PlayerEvent {
|
||||
* The server is not aware of when the client left clicks empty space, you will need to tell the server yourself.
|
||||
* This event cannot be canceled.
|
||||
*/
|
||||
public static class LeftClickEmpty extends PlayerInteractEvent {
|
||||
public static final class LeftClickEmpty extends PlayerInteractEvent {
|
||||
public LeftClickEmpty(Player player) {
|
||||
super(player, InteractionHand.MAIN_HAND, player.blockPosition(), null);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
* The event can be canceled, which will prevent the spawn point from being changed.
|
||||
*/
|
||||
@Cancelable
|
||||
public class PlayerSetSpawnEvent extends PlayerEvent {
|
||||
public final class PlayerSetSpawnEvent extends PlayerEvent {
|
||||
private final @Nullable ServerPlayer.RespawnConfig config;
|
||||
|
||||
@Deprecated(forRemoval = true, since = "1.21.5")
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.Optional;
|
||||
* <br>
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
**/
|
||||
public class PlayerSleepInBedEvent extends PlayerEvent
|
||||
public final class PlayerSleepInBedEvent extends PlayerEvent
|
||||
{
|
||||
private BedSleepingProblem result = null;
|
||||
private final Optional<BlockPos> pos;
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
* @see PlayerSpawnPhantomsEvent#setResult for the effects of each result.
|
||||
*/
|
||||
@Event.HasResult
|
||||
public class PlayerSpawnPhantomsEvent extends PlayerEvent {
|
||||
public final class PlayerSpawnPhantomsEvent extends PlayerEvent {
|
||||
private int phantomsToSpawn;
|
||||
|
||||
public PlayerSpawnPhantomsEvent(Player player, int phantomsToSpawn) {
|
||||
|
||||
@@ -12,7 +12,7 @@ import net.minecraft.world.entity.player.Player;
|
||||
* This is merely for purposes of listening for this to happen.<br/>
|
||||
* There is nothing that can be manipulated with this event.
|
||||
*/
|
||||
public class PlayerWakeUpEvent extends PlayerEvent
|
||||
public final class PlayerWakeUpEvent extends PlayerEvent
|
||||
{
|
||||
private final boolean wakeImmediately;
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import net.minecraftforge.eventbus.api.Cancelable;
|
||||
* <br>
|
||||
* All children of this event are fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
*/
|
||||
public class PlayerXpEvent extends PlayerEvent {
|
||||
public sealed class PlayerXpEvent extends PlayerEvent {
|
||||
public PlayerXpEvent(Player player) {
|
||||
super(player);
|
||||
}
|
||||
@@ -27,7 +27,7 @@ public class PlayerXpEvent extends PlayerEvent {
|
||||
* It can be cancelled, and no further processing will be done.
|
||||
*/
|
||||
@Cancelable
|
||||
public static class PickupXp extends PlayerXpEvent {
|
||||
public static final class PickupXp extends PlayerXpEvent {
|
||||
private final ExperienceOrb orb;
|
||||
|
||||
public PickupXp(Player player, ExperienceOrb orb) {
|
||||
@@ -45,7 +45,7 @@ public class PlayerXpEvent extends PlayerEvent {
|
||||
* It can be cancelled, and no further processing will be done.
|
||||
*/
|
||||
@Cancelable
|
||||
public static class XpChange extends PlayerXpEvent {
|
||||
public static final class XpChange extends PlayerXpEvent {
|
||||
private int amount;
|
||||
|
||||
public XpChange(Player player, int amount) {
|
||||
@@ -67,7 +67,7 @@ public class PlayerXpEvent extends PlayerEvent {
|
||||
* It can be cancelled, and no further processing will be done.
|
||||
*/
|
||||
@Cancelable
|
||||
public static class LevelChange extends PlayerXpEvent {
|
||||
public static final class LevelChange extends PlayerXpEvent {
|
||||
private int levels;
|
||||
|
||||
public LevelChange(Player player, int levels) {
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ import net.minecraftforge.eventbus.api.Event.HasResult;
|
||||
* setResult(DEFAULT) causes game to check {@link Block#isBed(BlockState, BlockGetter, BlockPos, Entity)} instead
|
||||
*/
|
||||
@HasResult
|
||||
public class SleepingLocationCheckEvent extends LivingEvent
|
||||
public final class SleepingLocationCheckEvent extends LivingEvent
|
||||
{
|
||||
|
||||
private final BlockPos sleepingLocation;
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.Optional;
|
||||
* setResult(DEFAULT) causes game to check !{@link Level#isDay()} instead.
|
||||
*/
|
||||
@HasResult
|
||||
public class SleepingTimeCheckEvent extends PlayerEvent
|
||||
public final class SleepingTimeCheckEvent extends PlayerEvent
|
||||
{
|
||||
private final Optional<BlockPos> sleepingLocation;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#SERVER logical server}.</p>
|
||||
*/
|
||||
public class TradeWithVillagerEvent extends PlayerEvent
|
||||
public final class TradeWithVillagerEvent extends PlayerEvent
|
||||
{
|
||||
private final MerchantOffer offer;
|
||||
private final AbstractVillager abstractVillager;
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
**/
|
||||
@Cancelable
|
||||
public class FurnaceFuelBurnTimeEvent extends Event
|
||||
public final class FurnaceFuelBurnTimeEvent extends Event
|
||||
{
|
||||
@NotNull
|
||||
private final ItemStack itemStack;
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
* This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}
|
||||
* only on the {@linkplain net.minecraftforge.fml.LogicalSide#SERVER logical server}.
|
||||
*/
|
||||
public class AlterGroundEvent extends Event {
|
||||
public final class AlterGroundEvent extends Event {
|
||||
private final LevelSimulatedReader level;
|
||||
private final RandomSource random;
|
||||
private final BlockPos pos;
|
||||
|
||||
@@ -64,7 +64,7 @@ public class BlockEvent extends Event {
|
||||
* Canceling this event will prevent the Block from being broken.
|
||||
*/
|
||||
@Cancelable
|
||||
public static class BreakEvent extends BlockEvent {
|
||||
public static final class BreakEvent extends BlockEvent {
|
||||
/** Reference to the Player who broke the block. If no player is available, use a EntityFakePlayer */
|
||||
private final Player player;
|
||||
private int exp;
|
||||
@@ -113,7 +113,7 @@ public class BlockEvent extends Event {
|
||||
* If a Block Place event is cancelled, the block will not be placed.
|
||||
*/
|
||||
@Cancelable
|
||||
public static class EntityPlaceEvent extends BlockEvent {
|
||||
public static sealed class EntityPlaceEvent extends BlockEvent {
|
||||
private final Entity entity;
|
||||
private final BlockSnapshot blockSnapshot;
|
||||
private final BlockState placedBlock;
|
||||
@@ -146,7 +146,7 @@ public class BlockEvent extends Event {
|
||||
* block.
|
||||
*/
|
||||
@Cancelable
|
||||
public static class EntityMultiPlaceEvent extends EntityPlaceEvent {
|
||||
public static final class EntityMultiPlaceEvent extends EntityPlaceEvent {
|
||||
private final List<BlockSnapshot> blockSnapshots;
|
||||
|
||||
public EntityMultiPlaceEvent(@NotNull List<BlockSnapshot> blockSnapshots, @NotNull BlockState placedAgainst, @Nullable Entity entity) {
|
||||
@@ -174,7 +174,7 @@ public class BlockEvent extends Event {
|
||||
* does. This event is only called on the server.
|
||||
*/
|
||||
@Cancelable
|
||||
public static class NeighborNotifyEvent extends BlockEvent {
|
||||
public static final class NeighborNotifyEvent extends BlockEvent {
|
||||
private final EnumSet<Direction> notifiedSides;
|
||||
private final boolean forceRedstoneUpdate;
|
||||
|
||||
@@ -209,7 +209,7 @@ public class BlockEvent extends Event {
|
||||
* even if the liquid usually does do that (like water).
|
||||
*/
|
||||
@HasResult
|
||||
public static class CreateFluidSourceEvent extends Event {
|
||||
public static final class CreateFluidSourceEvent extends Event {
|
||||
private final Level level;
|
||||
private final BlockPos pos;
|
||||
private final BlockState state;
|
||||
@@ -242,10 +242,10 @@ public class BlockEvent extends Event {
|
||||
* {@link #getPos()} will return the position of the block to be changed.
|
||||
*/
|
||||
@Cancelable
|
||||
public static class FluidPlaceBlockEvent extends BlockEvent {
|
||||
public static final class FluidPlaceBlockEvent extends BlockEvent {
|
||||
private final BlockPos liquidPos;
|
||||
private BlockState newState;
|
||||
private BlockState origState;
|
||||
private final BlockState origState;
|
||||
|
||||
public FluidPlaceBlockEvent(LevelAccessor level, BlockPos pos, BlockPos liquidPos, BlockState state) {
|
||||
super(level, pos, state);
|
||||
@@ -284,7 +284,7 @@ public class BlockEvent extends Event {
|
||||
* Fired when a crop block grows. See subevents.
|
||||
*
|
||||
*/
|
||||
public static class CropGrowEvent extends BlockEvent {
|
||||
public static sealed class CropGrowEvent extends BlockEvent {
|
||||
public CropGrowEvent(Level level, BlockPos pos, BlockState state) {
|
||||
super(level, pos, state);
|
||||
}
|
||||
@@ -301,7 +301,7 @@ public class BlockEvent extends Event {
|
||||
* <br>
|
||||
*/
|
||||
@HasResult
|
||||
public static class Pre extends CropGrowEvent {
|
||||
public static final class Pre extends CropGrowEvent {
|
||||
public Pre(Level level, BlockPos pos, BlockState state) {
|
||||
super(level, pos, state);
|
||||
}
|
||||
@@ -316,7 +316,7 @@ public class BlockEvent extends Event {
|
||||
* <br>
|
||||
* This event does not have a result. {@link HasResult}<br>
|
||||
*/
|
||||
public static class Post extends CropGrowEvent {
|
||||
public static final class Post extends CropGrowEvent {
|
||||
private final BlockState originalState;
|
||||
|
||||
public Post(Level level, BlockPos pos, BlockState original, BlockState state) {
|
||||
@@ -335,7 +335,7 @@ public class BlockEvent extends Event {
|
||||
* This event is {@link Cancelable}
|
||||
*/
|
||||
@Cancelable
|
||||
public static class FarmlandTrampleEvent extends BlockEvent {
|
||||
public static final class FarmlandTrampleEvent extends BlockEvent {
|
||||
private final Entity entity;
|
||||
private final double fallDistance;
|
||||
|
||||
@@ -361,7 +361,7 @@ public class BlockEvent extends Event {
|
||||
* If cancelled, the portal will not be spawned.
|
||||
*/
|
||||
@Cancelable
|
||||
public static class PortalSpawnEvent extends BlockEvent {
|
||||
public static final class PortalSpawnEvent extends BlockEvent {
|
||||
private final PortalShape size;
|
||||
|
||||
public PortalSpawnEvent(LevelAccessor level, BlockPos pos, BlockState state, PortalShape size) {
|
||||
@@ -385,7 +385,7 @@ public class BlockEvent extends Event {
|
||||
* from changing the block's state.
|
||||
*/
|
||||
@Cancelable
|
||||
public static class BlockToolModificationEvent extends BlockEvent {
|
||||
public static final class BlockToolModificationEvent extends BlockEvent {
|
||||
private final UseOnContext context;
|
||||
private final ToolAction toolAction;
|
||||
private final boolean simulate;
|
||||
|
||||
@@ -25,7 +25,7 @@ import net.minecraftforge.eventbus.api.Event;
|
||||
* <br>
|
||||
* All children of this event are fired on the {@link MinecraftForge#EVENT_BUS}.<br>
|
||||
**/
|
||||
public class ChunkDataEvent extends ChunkEvent {
|
||||
public sealed class ChunkDataEvent extends ChunkEvent {
|
||||
private final SerializableChunkData data;
|
||||
|
||||
public ChunkDataEvent(ChunkAccess chunk, SerializableChunkData data) {
|
||||
@@ -53,8 +53,8 @@ public class ChunkDataEvent extends ChunkEvent {
|
||||
* <br>
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.<br>
|
||||
**/
|
||||
public static class Load extends ChunkDataEvent {
|
||||
private ChunkType status;
|
||||
public static final class Load extends ChunkDataEvent {
|
||||
private final ChunkType status;
|
||||
|
||||
public Load(ChunkAccess chunk, SerializableChunkData data, ChunkType status) {
|
||||
super(chunk, data);
|
||||
@@ -77,7 +77,7 @@ public class ChunkDataEvent extends ChunkEvent {
|
||||
* <br>
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.<br>
|
||||
**/
|
||||
public static class Save extends ChunkDataEvent {
|
||||
public static final class Save extends ChunkDataEvent {
|
||||
public Save(ChunkAccess chunk, LevelAccessor world, SerializableChunkData data) {
|
||||
super(chunk, world, data);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class ChunkEvent extends LevelEvent
|
||||
* <br>
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.<br>
|
||||
**/
|
||||
public static class Load extends ChunkEvent
|
||||
public static final class Load extends ChunkEvent
|
||||
{
|
||||
private final boolean newChunk;
|
||||
|
||||
@@ -91,7 +91,7 @@ public class ChunkEvent extends LevelEvent
|
||||
* <br>
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.<br>
|
||||
**/
|
||||
public static class Unload extends ChunkEvent
|
||||
public static final class Unload extends ChunkEvent
|
||||
{
|
||||
public Unload(ChunkAccess chunk)
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
* This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}
|
||||
* only on the {@linkplain LogicalSide#SERVER logical server}.
|
||||
**/
|
||||
public class ChunkTicketLevelUpdatedEvent extends Event
|
||||
public final class ChunkTicketLevelUpdatedEvent extends Event
|
||||
{
|
||||
private final ServerLevel level;
|
||||
private final long chunkPos;
|
||||
|
||||
@@ -25,7 +25,7 @@ import net.minecraftforge.fml.LogicalSide;
|
||||
* This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}
|
||||
* only on the {@linkplain LogicalSide#SERVER logical server}.
|
||||
**/
|
||||
public class ChunkWatchEvent extends Event {
|
||||
public sealed class ChunkWatchEvent extends Event {
|
||||
private final ServerLevel level;
|
||||
private final ServerPlayer player;
|
||||
private final ChunkPos pos;
|
||||
@@ -67,7 +67,7 @@ public class ChunkWatchEvent extends Event {
|
||||
* This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}
|
||||
* only on the {@linkplain LogicalSide#SERVER logical server}.
|
||||
**/
|
||||
public static class Watch extends ChunkWatchEvent {
|
||||
public static final class Watch extends ChunkWatchEvent {
|
||||
private final LevelChunk chunk;
|
||||
|
||||
public Watch(ServerPlayer player, LevelChunk chunk, ServerLevel level) {
|
||||
@@ -88,7 +88,7 @@ public class ChunkWatchEvent extends Event {
|
||||
* This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}
|
||||
* only on the {@linkplain LogicalSide#SERVER logical server}.
|
||||
**/
|
||||
public static class UnWatch extends ChunkWatchEvent {
|
||||
public static final class UnWatch extends ChunkWatchEvent {
|
||||
public UnWatch(ServerPlayer player, ChunkPos pos, ServerLevel level) {
|
||||
super(player, pos, level);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import net.minecraft.world.level.Level;
|
||||
* Children do not use {@link HasResult}.<br>
|
||||
* Children of this event are fired on the {@link MinecraftForge#EVENT_BUS}.<br>
|
||||
*/
|
||||
public class ExplosionEvent extends Event {
|
||||
public sealed class ExplosionEvent extends Event {
|
||||
private final Level level;
|
||||
private final Explosion explosion;
|
||||
|
||||
@@ -49,7 +49,7 @@ public class ExplosionEvent extends Event {
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.<br>
|
||||
*/
|
||||
@Cancelable
|
||||
public static class Start extends ExplosionEvent {
|
||||
public static final class Start extends ExplosionEvent {
|
||||
public Start(Level level, Explosion explosion) {
|
||||
super(level, explosion);
|
||||
}
|
||||
@@ -61,7 +61,7 @@ public class ExplosionEvent extends Event {
|
||||
* This event does not use {@link HasResult}.<br>
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.<br>
|
||||
*/
|
||||
public static class Detonate extends ExplosionEvent {
|
||||
public static final class Detonate extends ExplosionEvent {
|
||||
private final List<BlockPos> blocks;
|
||||
private final List<Entity> entityList;
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ public class LevelEvent extends Event {
|
||||
* This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}
|
||||
* on both logical sides.
|
||||
**/
|
||||
public static class Load extends LevelEvent {
|
||||
public static final class Load extends LevelEvent {
|
||||
public Load(LevelAccessor level) { super(level); }
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ public class LevelEvent extends Event {
|
||||
* This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}
|
||||
* on both logical sides.
|
||||
**/
|
||||
public static class Unload extends LevelEvent {
|
||||
public static final class Unload extends LevelEvent {
|
||||
public Unload(LevelAccessor level) { super(level); }
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ public class LevelEvent extends Event {
|
||||
* This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}
|
||||
* only on the {@linkplain LogicalSide#SERVER logical server}.
|
||||
**/
|
||||
public static class Save extends LevelEvent {
|
||||
public static final class Save extends LevelEvent {
|
||||
public Save(LevelAccessor level) { super(level); }
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ public class LevelEvent extends Event {
|
||||
* @see ServerLevelData#isInitialized()
|
||||
*/
|
||||
@Cancelable
|
||||
public static class CreateSpawnPosition extends LevelEvent {
|
||||
public static final class CreateSpawnPosition extends LevelEvent {
|
||||
private final ServerLevelData settings;
|
||||
|
||||
public CreateSpawnPosition(LevelAccessor level, ServerLevelData settings) {
|
||||
@@ -133,7 +133,7 @@ public class LevelEvent extends Event {
|
||||
* Canceling the event will result in an empty list, meaning no entity will be spawned.</p>
|
||||
*/
|
||||
@Cancelable
|
||||
public static class PotentialSpawns extends LevelEvent {
|
||||
public static final class PotentialSpawns extends LevelEvent {
|
||||
private final MobCategory mobcategory;
|
||||
private final BlockPos pos;
|
||||
private final List<Weighted<MobSpawnSettings.SpawnerData>> list;
|
||||
|
||||
Loaded 100 of 174 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user