mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-21 20:52:34 +00:00
[1.17.x Omnibus] Fix typos and javadocs across code base (#8144)
This commit is contained in:
1 parent
df8954869a
commit
b4feee8046
163 files changed
+708
-454
No files matched your search
@@ -23,6 +23,8 @@ import net.minecraft.core.SectionPos;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityDimensions;
|
||||
import net.minecraft.world.entity.Pose;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
|
||||
/**
|
||||
@@ -69,7 +71,7 @@ public class EntityEvent extends Event
|
||||
/**
|
||||
* CanUpdate is fired when an Entity is being created. <br>
|
||||
* This event is fired whenever vanilla Minecraft determines that an entity<br>
|
||||
* cannot update in {@link World#updateEntityWithOptionalForce(net.minecraft.entity.Entity, boolean)} <br>
|
||||
* cannot update in {@code World#updateEntityWithOptionalForce(net.minecraft.entity.Entity, boolean)} <br>
|
||||
* <br>
|
||||
* {@link CanUpdate#canUpdate} contains the boolean value of whether this entity can update.<br>
|
||||
* If the modder decides that this Entity can be updated, they may change canUpdate to true, <br>
|
||||
|
||||
@@ -21,12 +21,20 @@ package net.minecraftforge.event.entity;
|
||||
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||
import net.minecraft.world.level.chunk.LevelChunk;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
|
||||
/**
|
||||
* EntityJoinWorldEvent is fired when an Entity joins the world. <br>
|
||||
* This event is fired whenever an Entity is added to the world in
|
||||
* {@link World#loadEntities(Collection)}, {@link net.minecraft.world.ServerWorld#loadEntities(Collection)} {@link World#joinEntityInSurroundings(Entity)}, and {@link World#spawnEntity(Entity)}. <br>
|
||||
* <strong>Note:</strong> This event may be called before the underlying {@link net.minecraft.world.chunk.Chunk} is promoted to {@link net.minecraft.world.chunk.ChunkStatus#FULL}. You will cause chunk loading deadlocks if you don't delay your world interactions.<br>
|
||||
* {@code Level#loadEntities(Collection)},
|
||||
* {@code net.minecraft.world.ServerWorld#loadEntities(Collection)}
|
||||
* {@code World#joinEntityInSurroundings(Entity)}, and
|
||||
* {@code World#spawnEntity(Entity)}. <br>
|
||||
* <strong>Note:</strong> This event may be called before the underlying {@link LevelChunk} is promoted to {@link ChunkStatus#FULL}.
|
||||
* You will cause chunk loading deadlocks if you don't delay your world interactions.<br>
|
||||
* <br>
|
||||
* {@link #world} contains the world in which the entity is to join.<br>
|
||||
* <br>
|
||||
|
||||
@@ -19,13 +19,17 @@
|
||||
|
||||
package net.minecraftforge.event.entity;
|
||||
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
|
||||
/**
|
||||
* EntityLeaveWorldEvent is fired when an Entity leaves the world. <br>
|
||||
* This event is fired whenever an Entity is removed from the world in
|
||||
* {@link ClientWorld#removeEntity(Entity)}, {@link ServerWorld#removeEntityComplete(Entity,Boolean)}. <br>
|
||||
* {@link ClientLevel#removeEntity(int, Entity.RemovalReason)}, {@link ServerLevel#removeEntityComplete(Entity, boolean)}. <br>
|
||||
* <br>
|
||||
* {@link #world} contains the world from which the entity is removed. <br>
|
||||
* <br>
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
package net.minecraftforge.event.entity;
|
||||
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Event.HasResult;
|
||||
|
||||
/**
|
||||
@@ -27,9 +28,11 @@ import net.minecraftforge.eventbus.api.Event.HasResult;
|
||||
* This event is fired when ever the {@code mobGriefing} game rule is checked.<br>
|
||||
* <br>
|
||||
* This event has a {@link HasResult result}:
|
||||
* <ul>
|
||||
* <li>{@link Result#ALLOW} means this instance of mob griefing is allowed.</li>
|
||||
* <li>{@link Result#DEFAULT} means the {@code mobGriefing} game rule is used to determine the behaviour.</li>
|
||||
* <li>{@link Result#DENY} means this instance of mob griefing is not allowed.</li><br>
|
||||
* <li>{@link Result#DENY} means this instance of mob griefing is not allowed.</li>
|
||||
* </ul>
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
*/
|
||||
@HasResult
|
||||
|
||||
@@ -21,6 +21,7 @@ package net.minecraftforge.event.entity;
|
||||
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,11 +21,14 @@ package net.minecraftforge.event.entity;
|
||||
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LightningBolt;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.ForgeEventFactory;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
|
||||
/**
|
||||
* EntityStruckByLightningEvent is fired when an Entity is about to be struck by lightening.<br>
|
||||
* This event is fired whenever an EntityLightningBolt is updated to strike an Entity in
|
||||
* {@link EntityLightningBolt#onUpdate()} via {@link ForgeEventFactory#onEntityStruckByLightning(Entity, EntityLightningBolt)}.<br>
|
||||
* {@link LightningBolt#tick()} via {@link ForgeEventFactory#onEntityStruckByLightning(Entity, LightningBolt)}.<br>
|
||||
* <br>
|
||||
* {@link #lightning} contains the instance of EntityLightningBolt attempting to strike an entity.<br>
|
||||
* <br>
|
||||
|
||||
@@ -24,11 +24,14 @@ import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.projectile.ThrownEnderpearl;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
|
||||
/**
|
||||
* EntityTeleportEvent is fired when an event involving any teleportation of an Entity occurs.<br>
|
||||
* If a method utilizes this {@link net.minecraftforge.eventbus.api.Event} as its parameter, the method will
|
||||
* If a method utilizes this {@link Event} as its parameter, the method will
|
||||
* receive every child event of this class.<br>
|
||||
* <br>
|
||||
* {@link #getTarget()} contains the target destination.<br>
|
||||
@@ -64,16 +67,16 @@ public class EntityTeleportEvent extends EntityEvent
|
||||
|
||||
/**
|
||||
* EntityTeleportEvent.TeleportCommand is fired before a living entity is teleported
|
||||
* from use of {@link net.minecraft.command.impl.TeleportCommand}.
|
||||
* from use of {@link net.minecraft.server.commands.TeleportCommand}.
|
||||
* <br>
|
||||
* This event is {@link net.minecraftforge.eventbus.api.Cancelable}.<br>
|
||||
* This event is {@link Cancelable}.<br>
|
||||
* If the event is not canceled, the entity will be teleported.
|
||||
* <br>
|
||||
* This event does not have a result. {@link HasResult}<br>
|
||||
* <br>
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.<br>
|
||||
* <br>
|
||||
* This event is only fired on the {@link net.minecraftforge.fml.LogicalSide#SERVER} side.<br>
|
||||
* This event is only fired on the {@link LogicalSide#SERVER} side.<br>
|
||||
* <br>
|
||||
* If this event is canceled, the entity will not be teleported.
|
||||
*/
|
||||
@@ -88,16 +91,16 @@ public class EntityTeleportEvent extends EntityEvent
|
||||
|
||||
/**
|
||||
* EntityTeleportEvent.SpreadPlayersCommand is fired before a living entity is teleported
|
||||
* from use of {@link net.minecraft.command.impl.SpreadPlayersCommand}.
|
||||
* from use of {@link net.minecraft.server.commands.SpreadPlayersCommand}.
|
||||
* <br>
|
||||
* This event is {@link net.minecraftforge.eventbus.api.Cancelable}.<br>
|
||||
* This event is {@link Cancelable}.<br>
|
||||
* If the event is not canceled, the entity will be teleported.
|
||||
* <br>
|
||||
* This event does not have a result. {@link HasResult}<br>
|
||||
* <br>
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.<br>
|
||||
* <br>
|
||||
* This event is only fired on the {@link net.minecraftforge.fml.LogicalSide#SERVER} side.<br>
|
||||
* This event is only fired on the {@link LogicalSide#SERVER} side.<br>
|
||||
* <br>
|
||||
* If this event is canceled, the entity will not be teleported.
|
||||
*/
|
||||
@@ -113,14 +116,14 @@ public class EntityTeleportEvent extends EntityEvent
|
||||
/**
|
||||
* EntityTeleportEvent.EnderEntity is fired before an Enderman or Shulker randomly teleports.
|
||||
* <br>
|
||||
* This event is {@link net.minecraftforge.eventbus.api.Cancelable}.<br>
|
||||
* This event is {@link Cancelable}.<br>
|
||||
* If the event is not canceled, the entity will be teleported.
|
||||
* <br>
|
||||
* This event does not have a result. {@link HasResult}<br>
|
||||
* <br>
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.<br>
|
||||
* <br>
|
||||
* This event is only fired on the {@link net.minecraftforge.fml.LogicalSide#SERVER} side.<br>
|
||||
* This event is only fired on the {@link LogicalSide#SERVER} side.<br>
|
||||
* <br>
|
||||
* If this event is canceled, the entity will not be teleported.
|
||||
*/
|
||||
@@ -144,14 +147,14 @@ public class EntityTeleportEvent extends EntityEvent
|
||||
/**
|
||||
* EntityTeleportEvent.EnderPearl is fired before an Entity is teleported from an EnderPearlEntity.
|
||||
* <br>
|
||||
* This event is {@link net.minecraftforge.eventbus.api.Cancelable}.<br>
|
||||
* This event is {@link Cancelable}.<br>
|
||||
* If the event is not canceled, the entity will be teleported.
|
||||
* <br>
|
||||
* This event does not have a result. {@link HasResult}<br>
|
||||
* <br>
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.<br>
|
||||
* <br>
|
||||
* This event is only fired on the {@link net.minecraftforge.fml.LogicalSide#SERVER} side.<br>
|
||||
* This event is only fired on the {@link LogicalSide#SERVER} side.<br>
|
||||
* <br>
|
||||
* If this event is canceled, the entity will not be teleported.
|
||||
*/
|
||||
@@ -194,14 +197,14 @@ public class EntityTeleportEvent extends EntityEvent
|
||||
/**
|
||||
* EntityTeleportEvent.ChorusFruit is fired before a LivingEntity is teleported due to consuming Chorus Fruit.
|
||||
* <br>
|
||||
* This event is {@link net.minecraftforge.eventbus.api.Cancelable}.<br>
|
||||
* This event is {@link Cancelable}.<br>
|
||||
* If the event is not canceled, the entity will be teleported.
|
||||
* <br>
|
||||
* This event does not have a result. {@link HasResult}<br>
|
||||
* <br>
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.<br>
|
||||
* <br>
|
||||
* This event is only fired on the {@link net.minecraftforge.fml.LogicalSide#SERVER} side.<br>
|
||||
* This event is only fired on the {@link LogicalSide#SERVER} side.<br>
|
||||
* <br>
|
||||
* If this event is canceled, the entity will not be teleported.
|
||||
*/
|
||||
|
||||
@@ -22,6 +22,7 @@ package net.minecraftforge.event.entity;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,14 +19,20 @@
|
||||
|
||||
package net.minecraftforge.event.entity;
|
||||
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
|
||||
/**
|
||||
* PlaySoundAtEntityEvent is fired a sound is to be played at an Entity<br>
|
||||
* This event is fired whenever a sound is set to be played at an Entity such as in
|
||||
* {@link ClientPlayerEntity#playSound(SoundEvent, float, float)} and {@link World#playSound(PlayerEntity, double, double, double, SoundEvent, SoundCategory, float, float)}.<br>
|
||||
* {@link LocalPlayer#playSound(SoundEvent, float, float)} and
|
||||
* {@link Level#playSound(Player, double, double, double, SoundEvent, SoundSource, float, float)}.<br>
|
||||
* <br>
|
||||
* {@link #name} contains the name of the sound to be played at the Entity.<br>
|
||||
* {@link #volume} contains the volume at which the sound is to be played originally.<br>
|
||||
|
||||
@@ -21,11 +21,13 @@ package net.minecraftforge.event.entity.living;
|
||||
|
||||
import net.minecraft.world.entity.animal.Animal;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.ForgeEventFactory;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
|
||||
/**
|
||||
* This event is fired when an {@link EntityAnimal} is tamed. <br>
|
||||
* It is fired via {@link ForgeEventFactory#onAnimalTame(EntityAnimal, EntityPlayer)}.
|
||||
* This event is fired when an {@link Animal} is tamed. <br>
|
||||
* It is fired via {@link ForgeEventFactory#onAnimalTame(Animal, Player)}.
|
||||
* Forge fires this event for applicable vanilla animals, mods need to fire it themselves.
|
||||
* This event is {@link net.minecraftforge.eventbus.api.Cancelable}. If canceled, taming the animal will fail.
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
|
||||
@@ -19,18 +19,22 @@
|
||||
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.entity.AgeableMob;
|
||||
import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.entity.animal.Animal;
|
||||
import net.minecraft.world.entity.animal.Fox;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* BabyEntitySpawnEvent is fired just before a baby entity is about to be spawned. <br>
|
||||
* Parents will have disengaged their relationship. {@link @Cancelable} <br>
|
||||
* It is possible to change the child completely by using {@link #setChild(EntityAgeable)} <br>
|
||||
* This event is fired from {@link EntityAIMate#spawnBaby()} and {@link EntityAIVillagerMate#giveBirth()} <br>
|
||||
* Parents will have disengaged their relationship. {@link Cancelable} <br>
|
||||
* It is possible to change the child completely by using {@link #setChild(AgeableMob)} <br>
|
||||
* This event is fired from {@link Animal#spawnChildFromBreeding(ServerLevel, Animal)} and
|
||||
* {@link Fox#spawnChildFromBreeding(ServerLevel, Animal)} <br>
|
||||
* <br>
|
||||
* {@link #parentA} contains the initiating parent entity.<br>
|
||||
* {@link #parentB} contains the secondary parent entity.<br>
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
@@ -26,10 +29,10 @@ import net.minecraft.world.entity.LivingEntity;
|
||||
/**
|
||||
* LivingAttackEvent is fired when a living Entity is attacked. <br>
|
||||
* This event is fired whenever an Entity is attacked in
|
||||
* {@link EntityLivingBase#attackEntityFrom(DamageSource, float)} and
|
||||
* {@link EntityPlayer#attackEntityFrom(DamageSource, float)}. <br>
|
||||
* {@link LivingEntity#hurt(DamageSource, float)} and
|
||||
* {@link Player#hurt(DamageSource, float)}. <br>
|
||||
* <br>
|
||||
* This event is fired via the {@link ForgeHooks#onLivingAttack(EntityLivingBase, DamageSource, float)}.<br>
|
||||
* This event is fired via the {@link ForgeHooks#onLivingAttack(LivingEntity, DamageSource, float)}.<br>
|
||||
* <br>
|
||||
* {@link #source} contains the DamageSource of the attack. <br>
|
||||
* {@link #amount} contains the amount of damage dealt to the entity. <br>
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
@@ -28,15 +29,15 @@ import net.minecraft.world.entity.LivingEntity;
|
||||
* At this point armor, potion and absorption modifiers have already been applied to damage - this is FINAL value.<br>
|
||||
* Also note that appropriate resources (like armor durability and absorption extra hearths) have already been consumed.<br>
|
||||
* This event is fired whenever an Entity is damaged in
|
||||
* {@link EntityLivingBase#damageEntity(DamageSource, float)} and
|
||||
* {@link EntityPlayer#damageEntity(DamageSource, float)}.<br>
|
||||
* {@code LivingEntity#actuallyHurt(DamageSource, float)} and
|
||||
* {@code Player#actuallyHurt(DamageSource, float)}.<br>
|
||||
* <br>
|
||||
* This event is fired via the {@link ForgeHooks#onLivingDamage(EntityLivingBase, DamageSource, float)}.<br>
|
||||
* This event is fired via the {@link ForgeHooks#onLivingDamage(LivingEntity, DamageSource, float)}.<br>
|
||||
* <br>
|
||||
* {@link #source} contains the DamageSource that caused this Entity to be hurt. <br>
|
||||
* {@link #amount} contains the final amount of damage that will be dealt to entity. <br>
|
||||
* <br>
|
||||
* This event is {@link net.minecraftforge.eventbus.api.Cancelable}.<br>
|
||||
* This event is {@link Cancelable}.<br>
|
||||
* If this event is canceled, the Entity is not hurt. Used resources WILL NOT be restored.<br>
|
||||
* <br>
|
||||
* This event does not have a result. {@link HasResult}<br>
|
||||
|
||||
@@ -19,6 +19,10 @@
|
||||
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
@@ -26,11 +30,11 @@ import net.minecraft.world.entity.LivingEntity;
|
||||
/**
|
||||
* LivingDeathEvent is fired when an Entity dies. <br>
|
||||
* This event is fired whenever an Entity dies in
|
||||
* {@link EntityLivingBase#onDeath(DamageSource)},
|
||||
* {@link EntityPlayer#onDeath(DamageSource)}, and
|
||||
* {@link EntityPlayerMP#onDeath(DamageSource)}. <br>
|
||||
* {@link LivingEntity#die(DamageSource)},
|
||||
* {@link Player#die(DamageSource)}, and
|
||||
* {@link ServerPlayer#die(DamageSource)}. <br>
|
||||
* <br>
|
||||
* This event is fired via the {@link ForgeHooks#onLivingDeath(EntityLivingBase, DamageSource)}.<br>
|
||||
* This event is fired via the {@link ForgeHooks#onLivingDeath(LivingEntity, DamageSource)}.<br>
|
||||
* <br>
|
||||
* {@link #source} contains the DamageSource that caused the entity to die. <br>
|
||||
* <br>
|
||||
|
||||
@@ -19,15 +19,19 @@
|
||||
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
|
||||
/**
|
||||
* Fired when the ender dragon or wither attempts to destroy a block and when ever a zombie attempts to break a door. Basically a event version of {@link Block#canEntityDestroy(IBlockState, IBlockAccess, BlockPos, Entity)}<br>
|
||||
* Fired when the ender dragon or wither attempts to destroy a block and when ever a zombie attempts to break a door. Basically a event version of {@link Block#canEntityDestroy(BlockState, BlockGetter, BlockPos, Entity)}<br>
|
||||
* <br>
|
||||
* This event is {@link net.minecraftforge.eventbus.api.Cancelable}.<br>
|
||||
* This event is {@link Cancelable}.<br>
|
||||
* If this event is canceled, the block will not be destroyed.<br>
|
||||
* <br>
|
||||
* This event does not have a result. {@link HasResult}<br>
|
||||
|
||||
@@ -24,13 +24,16 @@ import java.util.Collection;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.item.ItemEntity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
|
||||
/**
|
||||
* LivingDropsEvent is fired when an Entity's death causes dropped items to appear.<br>
|
||||
* This event is fired whenever an Entity dies and drops items in
|
||||
* {@link EntityLivingBase#onDeath(DamageSource)}.<br>
|
||||
* {@link LivingEntity#die(DamageSource)}.<br>
|
||||
* <br>
|
||||
* This event is fired via the {@link ForgeHooks#onLivingDrops(EntityLivingBase, DamageSource, ArrayList, int, boolean)}.<br>
|
||||
* This event is fired via the {@link ForgeHooks#onLivingDrops(LivingEntity, DamageSource, Collection, int, boolean)} .<br>
|
||||
* <br>
|
||||
* {@link #source} contains the DamageSource that caused the drop to occur.<br>
|
||||
* {@link #drops} contains the ArrayList of EntityItems that will be dropped.<br>
|
||||
|
||||
@@ -61,7 +61,7 @@ public class LivingEntityUseItemEvent extends LivingEvent
|
||||
* Drinking Potions/Milk
|
||||
* Guarding with a sword
|
||||
*
|
||||
* Cancel the event, or set the duration or <= 0 to prevent it from processing.
|
||||
* Cancel the event, or set the duration or {@literal <=} 0 to prevent it from processing.
|
||||
*
|
||||
*/
|
||||
@Cancelable
|
||||
@@ -76,7 +76,7 @@ public class LivingEntityUseItemEvent extends LivingEvent
|
||||
/**
|
||||
* Fired every tick that a player is 'using' an item, see {@link Start} for info.
|
||||
*
|
||||
* Cancel the event, or set the duration or <= 0 to cause the player to stop using the item.
|
||||
* Cancel the event, or set the duration or {@literal <=} 0 to cause the player to stop using the item.
|
||||
*
|
||||
*/
|
||||
@Cancelable
|
||||
|
||||
+4
-2
@@ -22,16 +22,18 @@ package net.minecraftforge.event.entity.living;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* {@link LivingEquipmentChangeEvent} is fired when the Equipment of a Entity changes. <br>
|
||||
* This event is fired whenever changes in Equipment are detected in {@link EntityLivingBase#onUpdate()}. <br>
|
||||
* This event is fired whenever changes in Equipment are detected in {@link LivingEntity#tick()}. <br>
|
||||
* This also includes entities joining the World, as well as being cloned. <br>
|
||||
* This event is fired on server-side only. <br>
|
||||
* <br>
|
||||
* {@link #slot} contains the affected {@link EntityEquipmentSlot}. <br>
|
||||
* {@link #slot} contains the affected {@link EquipmentSlot}. <br>
|
||||
* {@link #from} contains the {@link ItemStack} that was equipped previously. <br>
|
||||
* {@link #to} contains the {@link ItemStack} that is equipped now. <br>
|
||||
* <br>
|
||||
|
||||
@@ -20,15 +20,18 @@
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraftforge.event.entity.EntityEvent;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* LivingEvent is fired whenever an event involving Living entities occurs.<br>
|
||||
* If a method utilizes this {@link net.minecraftforge.eventbus.api.Event} as its parameter, the method will
|
||||
* If a method utilizes this {@link Event} as its parameter, the method will
|
||||
* receive every child event of this class.<br>
|
||||
* <br>
|
||||
* All children of this event are fired on the {@link MinecraftForge#EVENT_BUS}.<br>
|
||||
@@ -50,9 +53,9 @@ public class LivingEvent extends EntityEvent
|
||||
/**
|
||||
* LivingUpdateEvent is fired when an Entity is updated. <br>
|
||||
* This event is fired whenever an Entity is updated in
|
||||
* {@link EntityLivingBase#onUpdate()}. <br>
|
||||
* {@link LivingEntity#tick()}. <br>
|
||||
* <br>
|
||||
* This event is fired via the {@link ForgeHooks#onLivingUpdate(EntityLivingBase)}.<br>
|
||||
* This event is fired via the {@link ForgeHooks#onLivingUpdate(LivingEntity)}.<br>
|
||||
* <br>
|
||||
* This event is {@link Cancelable}.<br>
|
||||
* If this event is canceled, the Entity does not update.<br>
|
||||
@@ -70,10 +73,10 @@ public class LivingEvent extends EntityEvent
|
||||
/**
|
||||
* LivingJumpEvent is fired when an Entity jumps.<br>
|
||||
* This event is fired whenever an Entity jumps in
|
||||
* {@link EntityLivingBase#jump()}, {@link EntityMagmaCube#jump()},
|
||||
* and {@link EntityHorse#jump()}.<br>
|
||||
* {@code LivingEntity#jumpFromGround()}, {@code MagmaCube#jumpFromGround()},
|
||||
* and {@code Horse#jumpFromGround()}.<br>
|
||||
* <br>
|
||||
* This event is fired via the {@link ForgeHooks#onLivingJump(EntityLivingBase)}.<br>
|
||||
* This event is fired via the {@link ForgeHooks#onLivingJump(LivingEntity)}.<br>
|
||||
* <br>
|
||||
* This event is not {@link Cancelable}.<br>
|
||||
* <br>
|
||||
|
||||
@@ -19,15 +19,18 @@
|
||||
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
|
||||
/**
|
||||
* LivingFallEvent is fired when an Entity is set to be falling.<br>
|
||||
* This event is fired whenever an Entity is set to fall in
|
||||
* {@link EntityLivingBase#fall(float, float)}.<br>
|
||||
* {@link LivingEntity#causeFallDamage(float, float, DamageSource)}.<br>
|
||||
* <br>
|
||||
* This event is fired via the {@link ForgeHooks#onLivingFall(EntityLivingBase, float, float)}.<br>
|
||||
* This event is fired via the {@link ForgeHooks#onLivingFall(LivingEntity, float, float)}.<br>
|
||||
* <br>
|
||||
* {@link #distance} contains the distance the Entity is to fall. If this event is canceled, this value is set to 0.0F.
|
||||
* <br>
|
||||
|
||||
@@ -19,14 +19,16 @@
|
||||
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.ForgeEventFactory;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
|
||||
/**
|
||||
* LivingHealEvent is fired when an Entity is set to be healed. <br>
|
||||
* This event is fired whenever an Entity is healed in {@link EntityLivingBase#heal(float)}<br>
|
||||
* This event is fired whenever an Entity is healed in {@link LivingEntity#heal(float)}<br>
|
||||
* <br>
|
||||
* This event is fired via the {@link ForgeEventFactory#onLivingHeal(EntityLivingBase, float)}.<br>
|
||||
* This event is fired via the {@link ForgeEventFactory#onLivingHeal(LivingEntity, float)}.<br>
|
||||
* <br>
|
||||
* {@link #amount} contains the amount of healing done to the Entity that was healed. <br>
|
||||
* <br>
|
||||
|
||||
@@ -21,14 +21,17 @@ package net.minecraftforge.event.entity.living;
|
||||
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
|
||||
/**
|
||||
* LivingHurtEvent is fired when an Entity is set to be hurt. <br>
|
||||
* This event is fired whenever an Entity is hurt in
|
||||
* {@link EntityLivingBase#damageEntity(DamageSource, float)} and
|
||||
* {@link EntityPlayer#damageEntity(DamageSource, float)}.<br>
|
||||
* {@code LivingEntity#actuallyHurt(DamageSource, float)} and
|
||||
* {@code Player#actuallyHurt(DamageSource, float)}.<br>
|
||||
* <br>
|
||||
* This event is fired via the {@link ForgeHooks#onLivingHurt(EntityLivingBase, DamageSource, float)}.<br>
|
||||
* This event is fired via the {@link ForgeHooks#onLivingHurt(LivingEntity, DamageSource, float)}.<br>
|
||||
* <br>
|
||||
* {@link #source} contains the DamageSource that caused this Entity to be hurt. <br>
|
||||
* {@link #amount} contains the amount of damage dealt to the Entity that was hurt. <br>
|
||||
|
||||
@@ -19,25 +19,30 @@
|
||||
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
|
||||
/**
|
||||
* LivingKnockBackEvent is fired when a living entity is about to be knocked back. <br>
|
||||
* This event is fired whenever an Entity is knocked back in
|
||||
* {@link EntityLivingBase#attackEntityFrom(DamageSource, float)},
|
||||
* {@link EntityLivingBase#blockWithShield(EntityLivingBase)},
|
||||
* {@link EntityMob#attackEntityAsMob(Entity)} and
|
||||
* {@link EntityPlayer#attackTargetEntityWithCurrentItem(Entity)} <br>
|
||||
* {@link LivingEntity#hurt(DamageSource, float)},
|
||||
* {@code LivingEntity#blockUsingShield(LivingEntity)},
|
||||
* {@link Mob#doHurtTarget(Entity)} and
|
||||
* {@link Player#attack(Entity)} <br>
|
||||
* <br>
|
||||
* This event is fired via {@link ForgeHooks#onLivingKnockBack(EntityLivingBase, Entity, float, double, double)}.<br>
|
||||
* This event is fired via {@link ForgeHooks#onLivingKnockBack(LivingEntity, float, double, double)} .<br>
|
||||
* <br>
|
||||
* {@link #attacker} contains the Entity that caused the knock back. <br>
|
||||
* {@link #strength} contains the strength of the knock back. <br>
|
||||
* {@link #ratioX} contains the x ratio of the knock back. <br>
|
||||
* {@link #ratioZ} contains the z ratio of the knock back. <br>
|
||||
* <br>
|
||||
* This event is {@link net.minecraftforge.eventbus.api.Cancelable}.<br>
|
||||
* This event is {@link Cancelable}.<br>
|
||||
* If this event is canceled, the entity is not knocked back.<br>
|
||||
* <br>
|
||||
* This event does not have a result. {@link HasResult}<br>
|
||||
|
||||
+5
-3
@@ -20,14 +20,16 @@
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.Mob;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
/**
|
||||
* LivingSetAttackTargetEvent is fired when an Entity sets a target to attack.<br>
|
||||
* This event is fired whenever an Entity sets a target to attack in
|
||||
* {@link EntityLiving#setAttackTarget(EntityLivingBase)} and
|
||||
* {@link EntityLivingBase#setRevengeTarget(EntityLivingBase)}.<br>
|
||||
* {@link Mob#setTarget(LivingEntity)}.<br>
|
||||
* <br>
|
||||
* This event is fired via the {@link ForgeHooks#onLivingSetAttackTarget(EntityLivingBase, EntityLivingBase)}.<br>
|
||||
* This event is fired via the {@link ForgeHooks#onLivingSetAttackTarget(LivingEntity, LivingEntity)}.<br>
|
||||
* <br>
|
||||
* {@link #target} contains the newly targeted Entity.<br>
|
||||
* <br>
|
||||
|
||||
@@ -20,17 +20,21 @@
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.level.BaseSpawner;
|
||||
import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.entity.MobSpawnType;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.ForgeEventFactory;
|
||||
import net.minecraftforge.eventbus.api.Event.HasResult;
|
||||
|
||||
/**
|
||||
* LivingSpawnEvent is fired for any events associated with Living Entities spawn status. <br>
|
||||
* If a method utilizes this {@link Event} as its parameter, the method will
|
||||
* If a method utilizes this event as its parameter, the method will
|
||||
* receive every child event of this class.<br>
|
||||
* <br>
|
||||
* {@link #world} contains the world in which this living Entity is being spawned.<br>
|
||||
@@ -114,7 +118,7 @@ public class LivingSpawnEvent extends LivingEvent
|
||||
* SpecialSpawn is fired when an Entity is to be spawned.<br>
|
||||
* This allows you to do special inializers in the new entity.<br>
|
||||
* <br>
|
||||
* This event is fired via the {@link ForgeEventFactory#doSpecialSpawn(EntityLiving, World, float, float, float)}.<br>
|
||||
* This event is fired via the {@link ForgeEventFactory#doSpecialSpawn(Mob, Level, float, float, float, BaseSpawner, MobSpawnType)}.<br>
|
||||
* <br>
|
||||
* This event is {@link net.minecraftforge.eventbus.api.Cancelable}.<br>
|
||||
* If this event is canceled, the Entity is not spawned.<br>
|
||||
@@ -160,7 +164,7 @@ public class LivingSpawnEvent extends LivingEvent
|
||||
* This is fired every tick for every despawnable entity. Be efficient in your handlers.
|
||||
*
|
||||
* Note: this is not fired <em>if</em> the mob is definitely going to otherwise despawn. It is fired to check if
|
||||
* the mob can be allowed to despawn. See {@link EntityLiving#despawnEntity}
|
||||
* the mob can be allowed to despawn. See {@link LivingEntity#checkDespawn()}
|
||||
*
|
||||
* @author cpw
|
||||
*
|
||||
|
||||
@@ -23,6 +23,8 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
|
||||
/**
|
||||
* Fires after Potion Color Calculation.
|
||||
|
||||
@@ -19,19 +19,18 @@
|
||||
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import net.minecraft.world.effect.MobEffect;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.effect.MobEffect;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
|
||||
import net.minecraftforge.eventbus.api.Event.HasResult;
|
||||
|
||||
/**
|
||||
* This Event and its subevents gets fired from {@link EntityLivingBase} on the {@link MinecraftForge#EVENT_BUS}.<br>
|
||||
* This Event and its subevents gets fired from {@link LivingEntity} on the {@link MinecraftForge#EVENT_BUS}.<br>
|
||||
*/
|
||||
public class PotionEvent extends LivingEvent
|
||||
{
|
||||
@@ -83,7 +82,7 @@ public class PotionEvent extends LivingEvent
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the PotionEffect. In the remove event this can be null if the Entity does not have a {@link Potion} of the right type active.
|
||||
* @return the PotionEffect. In the remove event this can be null if the Entity does not have a {@link MobEffect} of the right type active.
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
|
||||
@@ -22,13 +22,13 @@ package net.minecraftforge.event.entity.living;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.monster.Zombie;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.ForgeEventFactory;
|
||||
import net.minecraftforge.event.entity.EntityEvent;
|
||||
|
||||
import net.minecraftforge.eventbus.api.Event.HasResult;
|
||||
|
||||
/**
|
||||
* ZombieEvent is fired whenever a zombie is spawned for aid.
|
||||
* If a method utilizes this {@link Event} as its parameter, the method will
|
||||
* If a method utilizes this event as its parameter, the method will
|
||||
* receive every child event of this class.
|
||||
*
|
||||
* All children of this event are fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
@@ -48,9 +48,9 @@ public class ZombieEvent extends EntityEvent {
|
||||
/**
|
||||
* SummonAidEvent is fired when a Zombie Entity is summoned.
|
||||
* This event is fired whenever a Zombie Entity is summoned in
|
||||
* {@link EntityZombie#attackEntityFrom(DamageSource, float)}.
|
||||
* {@code Zombie#actuallyHurt(DamageSource, float)}.
|
||||
*
|
||||
* This event is fired via the {@link ForgeEventFactory#fireZombieSummonAid(EntityZombie, World, int, int, int, EntityLivingBase, double)}.
|
||||
* This event is fired via the {@link ForgeEventFactory#fireZombieSummonAid(Zombie, Level, int, int, int, LivingEntity, double)}.
|
||||
*
|
||||
* {@link #customSummonedAid} remains null, but can be populated with a custom EntityZombie which will be spawned.
|
||||
* {@link #world} contains the world that this summoning is occurring in.
|
||||
|
||||
@@ -21,6 +21,7 @@ package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.advancements.Advancement;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
/**
|
||||
* This event is fired when a player gets an advancement.
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.item.BowItem;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
@@ -29,12 +32,12 @@ import javax.annotation.Nonnull;
|
||||
/**
|
||||
* ArrowLooseEvent is fired when a player stops using a bow.<br>
|
||||
* This event is fired whenever a player stops using a bow in
|
||||
* {@link ItemBow#onPlayerStoppedUsing(ItemStack, World, EntityLivingBase, int)}.<br>
|
||||
* {@link BowItem#releaseUsing(ItemStack, Level, LivingEntity, int)}.<br>
|
||||
* <br>
|
||||
* {@link #bow} contains the ItemBow ItemStack that was used in this event.<br>
|
||||
* {@link #charge} contains the value for how much the player had charged before stopping the shot.<br>
|
||||
* <br>
|
||||
* This event is {@link net.minecraftforge.eventbus.api.Cancelable}.<br>
|
||||
* This event is {@link Cancelable}.<br>
|
||||
* If this event is canceled, the player does not stop using the bow.<br>
|
||||
* <br>
|
||||
* This event does not have a result. {@link HasResult}<br>
|
||||
|
||||
@@ -20,17 +20,19 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.BowItem;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* ArrowNockEvent is fired when a player begins using a bow.<br>
|
||||
* This event is fired whenever a player begins using a bow in
|
||||
* {@link ItemBow#onItemRightClick(World, EntityPlayer, EnumHand)}.<br>
|
||||
* {@link BowItem#use(Level, Player, InteractionHand)}.<br>
|
||||
* <br>
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
**/
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
@@ -26,7 +27,7 @@ import net.minecraft.world.entity.player.Player;
|
||||
/**
|
||||
* AttackEntityEvent is fired when a player attacks an Entity.<br>
|
||||
* This event is fired whenever a player attacks an Entity in
|
||||
* {@link EntityPlayer#attackTargetEntityWithCurrentItem(Entity)}.<br>
|
||||
* {@link Player#attack(Entity)}.<br>
|
||||
* <br>
|
||||
* {@link #target} contains the Entity that was damaged by the player. <br>
|
||||
* <br>
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event.HasResult;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
||||
@@ -21,6 +21,7 @@ package net.minecraftforge.event.entity.player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.world.item.TooltipFlag;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
@@ -37,8 +38,8 @@ public class ItemTooltipEvent extends PlayerEvent
|
||||
private final List<Component> toolTip;
|
||||
|
||||
/**
|
||||
* This event is fired in {@link ItemStack#getTooltip(EntityPlayer, ITooltipFlag)}, which in turn is called from it's respective GUIContainer.
|
||||
* Tooltips are also gathered with a null entityPlayer during startup by {@link Minecraft#populateSearchTreeManager()}.
|
||||
* This event is fired in {@link ItemStack#getTooltipLines(Player, TooltipFlag)}, which in turn is called from it's respective GUIContainer.
|
||||
* Tooltips are also gathered with a null entityPlayer during startup by {@link Minecraft#createSearchTrees()}.
|
||||
*/
|
||||
public ItemTooltipEvent(@Nonnull ItemStack itemStack, @Nullable Player entityPlayer, List<Component> list, TooltipFlag flags)
|
||||
{
|
||||
|
||||
@@ -19,9 +19,22 @@
|
||||
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.client.multiplayer.MultiPlayerGameMode;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.level.ServerPlayerGameMode;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.ForgeEventFactory;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
@@ -29,16 +42,16 @@ import javax.annotation.Nullable;
|
||||
/**
|
||||
* PlayerDestroyItemEvent is fired when a player destroys an item.<br>
|
||||
* This event is fired whenever a player destroys an item in
|
||||
* {@link PlayerController#onPlayerDestroyBlock(BlockPos)},
|
||||
* {@link PlayerController#processRightClick(PlayerEntity, World, Hand)},
|
||||
* {@link PlayerController#processRightClickBlock(ClientPlayerEntity, ClientWorld, BlockPos, Direction, Vec3d, Hand)},
|
||||
* {@link PlayerEntity#attackTargetEntityWithCurrentItem(Entity)},
|
||||
* {@link PlayerEntity#damageShield(float)},
|
||||
* {@link PlayerEntity#interactOn(Entity, Hand)},
|
||||
* {@link MultiPlayerGameMode#destroyBlock(BlockPos)},
|
||||
* {@link MultiPlayerGameMode#useItem(Player, Level, InteractionHand)},
|
||||
* {@link MultiPlayerGameMode#useItemOn(LocalPlayer, ClientLevel, InteractionHand, BlockHitResult)} ,
|
||||
* {@link Player#attack(Entity)},
|
||||
* {@code Player#hurtCurrentlyUsedShield(float)},
|
||||
* {@link Player#interactOn(Entity, InteractionHand)},
|
||||
* {@link ForgeHooks#getContainerItem(ItemStack)},
|
||||
* {@link PlayerInteractionManager#processRightClick(PlayerEntity, World, ItemStack, Hand)},
|
||||
* {@link PlayerInteractionManager#processRightClickBlock(PlayerEntity, World, ItemStack, Hand, BlockPos, Direction, float, float, float)}
|
||||
* and {@link PlayerInteractionManager#tryHarvestBlock(BlockPos)}.<br>
|
||||
* {@link ServerPlayerGameMode#useItem(ServerPlayer, Level, ItemStack, InteractionHand)} ,
|
||||
* {@link ServerPlayerGameMode#useItemOn(ServerPlayer, Level, ItemStack, InteractionHand, BlockHitResult)}
|
||||
* and {@link ServerPlayerGameMode#destroyBlock(BlockPos)}.<br>
|
||||
* <br>
|
||||
* {@link #original} contains the original ItemStack before the item was destroyed. <br>
|
||||
* (@link #hand) contains the hand that the current item was held in.<br>
|
||||
@@ -47,7 +60,7 @@ import javax.annotation.Nullable;
|
||||
* <br>
|
||||
* This event does not have a result. {@link HasResult}<br>
|
||||
* <br>
|
||||
* This event is fired from {@link ForgeEventFactory#onPlayerDestroyItem(PlayerEntity, ItemStack, Hand)}.<br>
|
||||
* 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
|
||||
|
||||
@@ -21,12 +21,15 @@ package net.minecraftforge.event.entity.player;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.item.ItemEntity;
|
||||
import net.minecraft.world.Container;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.world.level.GameType;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.ForgeEventFactory;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
@@ -61,11 +64,11 @@ public class PlayerEvent extends LivingEvent
|
||||
/**
|
||||
* HarvestCheck is fired when a player attempts to harvest a block.<br>
|
||||
* This event is fired whenever a player attempts to harvest a block in
|
||||
* {@link EntityPlayer#canHarvestBlock(IBlockState)}.<br>
|
||||
* {@link Player#hasCorrectToolForDrops(BlockState)}.<br>
|
||||
* <br>
|
||||
* This event is fired via the {@link ForgeEventFactory#doPlayerHarvestCheck(EntityPlayer, IBlockState, boolean)}.<br>
|
||||
* This event is fired via the {@link ForgeEventFactory#doPlayerHarvestCheck(Player, BlockState, boolean)}.<br>
|
||||
* <br>
|
||||
* {@link #state} contains the {@link IBlockState} that is being checked for harvesting. <br>
|
||||
* {@link #state} contains the {@link BlockState} that is being checked for harvesting. <br>
|
||||
* {@link #success} contains the boolean value for whether the Block will be successfully harvested. <br>
|
||||
* <br>
|
||||
* This event is not {@link net.minecraftforge.eventbus.api.Cancelable}.<br>
|
||||
@@ -94,9 +97,9 @@ public class PlayerEvent extends LivingEvent
|
||||
/**
|
||||
* BreakSpeed is fired when a player attempts to harvest a block.<br>
|
||||
* This event is fired whenever a player attempts to harvest a block in
|
||||
* {@link EntityPlayer#canHarvestBlock(IBlockState)}.<br>
|
||||
* {@link Player#getDigSpeed(BlockState, BlockPos)}.<br>
|
||||
* <br>
|
||||
* This event is fired via the {@link ForgeEventFactory#getBreakSpeed(EntityPlayer, IBlockState, float, BlockPos)}.<br>
|
||||
* This event is fired via the {@link ForgeEventFactory#getBreakSpeed(Player, BlockState, float, BlockPos)}.<br>
|
||||
* <br>
|
||||
* {@link #state} contains the block being broken. <br>
|
||||
* {@link #originalSpeed} contains the original speed at which the player broke the block. <br>
|
||||
@@ -137,9 +140,9 @@ public class PlayerEvent extends LivingEvent
|
||||
/**
|
||||
* NameFormat is fired when a player's display name is retrieved.<br>
|
||||
* This event is fired whenever a player's name is retrieved in
|
||||
* {@link EntityPlayer#getDisplayName()} or {@link EntityPlayer#refreshDisplayName()}.<br>
|
||||
* {@link Player#getDisplayName()} or {@link Player#refreshDisplayName()}.<br>
|
||||
* <br>
|
||||
* This event is fired via the {@link ForgeEventFactory#getPlayerDisplayName(EntityPlayer, String)}.<br>
|
||||
* This event is fired via the {@link ForgeEventFactory#getPlayerDisplayName(Player, Component)}.<br>
|
||||
* <br>
|
||||
* {@link #username} contains the username of the player.
|
||||
* {@link #displayname} contains the display name of the player.
|
||||
@@ -181,9 +184,9 @@ public class PlayerEvent extends LivingEvent
|
||||
/**
|
||||
* TabListNameFormat is fired when a player's display name for the tablist is retrieved.<br>
|
||||
* This event is fired whenever a player's display name for the tablist is retrieved in
|
||||
* {@link ServerPlayerEntity#getTabListDisplayName()} or {@link ServerPlayerEntity#refreshTabListName()}.<br>
|
||||
* {@link ServerPlayer#getTabListDisplayName()} or {@link ServerPlayer#refreshTabListName()}.<br>
|
||||
* <br>
|
||||
* This event is fired via the {@link ForgeEventFactory#getPlayerTabListDisplayName(PlayerEntity)}.<br>
|
||||
* This event is fired via the {@link ForgeEventFactory#getPlayerTabListDisplayName(Player)}.<br>
|
||||
* <br>
|
||||
* {@link #getDisplayName()} contains the display name of the player or null if the client should determine the display name itself.
|
||||
* <br>
|
||||
|
||||
@@ -21,15 +21,22 @@ package net.minecraftforge.event.entity.player;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.item.context.UseOnContext;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@@ -65,10 +72,10 @@ public class PlayerInteractEvent extends PlayerEvent
|
||||
* This event is fired on both sides whenever a player right clicks an entity.
|
||||
*
|
||||
* "Interact at" is an interact where the local vector (which part of the entity you clicked) is known.
|
||||
* The state of this event affects whether {@link Entity#applyPlayerInteraction} is called.
|
||||
* The state of this event affects whether {@link Entity#interactAt(Player, Vec3, InteractionHand)} is called.
|
||||
*
|
||||
* Let result be the return value of {@link Entity#applyPlayerInteraction}, or {@link #cancellationResult} if the event is cancelled.
|
||||
* If we are on the client and result is not {@link EnumActionResult#SUCCESS}, the client will then try {@link EntityInteract}.
|
||||
* Let result be the return value of {@link Entity#interactAt(Player, Vec3, InteractionHand)}, or {@link #cancellationResult} if the event is cancelled.
|
||||
* 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
|
||||
@@ -104,12 +111,14 @@ public class PlayerInteractEvent extends PlayerEvent
|
||||
* This event is fired on both sides when the player right clicks an entity.
|
||||
* It is responsible for all general entity interactions.
|
||||
*
|
||||
* This event is fired only if the result of the above {@link EntityInteractSpecific} is not {@link EnumActionResult#SUCCESS}.
|
||||
* This event's state affects whether {@link Entity#processInitialInteract} and {@link net.minecraft.item.Item#itemInteractionForEntity} are called.
|
||||
* This event is fired only if the result of the above {@link EntityInteractSpecific} is not {@link InteractionResult#SUCCESS}.
|
||||
* This event's state affects whether {@link Entity#interact(Player, InteractionHand)} and
|
||||
* {@link Item#interactLivingEntity(ItemStack, Player, LivingEntity, InteractionHand)} are called.
|
||||
*
|
||||
* Let result be {@link EnumActionResult#SUCCESS} if {@link Entity#processInitialInteract} or {@link net.minecraft.item.Item#itemInteractionForEntity} return true,
|
||||
* Let result be {@link InteractionResult#SUCCESS} if {@link Entity#interact(Player, InteractionHand)} or
|
||||
* {@link Item#interactLivingEntity(ItemStack, Player, LivingEntity, InteractionHand)} return true,
|
||||
* or {@link #cancellationResult} if the event is cancelled.
|
||||
* If we are on the client and result is not {@link EnumActionResult#SUCCESS}, the client will then try {@link RightClickItem}.
|
||||
* 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
|
||||
@@ -130,13 +139,13 @@ public class PlayerInteractEvent extends PlayerEvent
|
||||
|
||||
/**
|
||||
* This event is fired on both sides whenever the player right clicks while targeting a block. <br>
|
||||
* This event controls which of {@link Item#onItemUseFirst}, {@link Block#onBlockActivated}, and {@link Item#onItemUse}
|
||||
* will be called. <br>
|
||||
* This event controls which of {@link Item#onItemUseFirst}, {@link Block#use(BlockState, Level, BlockPos, Player, InteractionHand, BlockHitResult)},
|
||||
* and {@link Item#useOn(UseOnContext)} will be called. <br>
|
||||
* Canceling the event will cause none of the above three to be called. <br>
|
||||
* <br>
|
||||
* Let result be the first non-pass return value of the above three methods, or pass, if they all pass. <br>
|
||||
* Or {@link #cancellationResult} if the event is cancelled. <br>
|
||||
* If result equals {@link ActionResultType#PASS}, we proceed to {@link RightClickItem}. <br>
|
||||
* If result equals {@link InteractionResult#PASS}, we proceed to {@link RightClickItem}. <br>
|
||||
* <br>
|
||||
* There are various results to this event, see the getters below. <br>
|
||||
* Note that handling things differently on the client vs server may cause desynchronizations!
|
||||
@@ -154,7 +163,7 @@ public class PlayerInteractEvent extends PlayerEvent
|
||||
}
|
||||
|
||||
/**
|
||||
* @return If {@link net.minecraft.block.Block#onBlockActivated} should be called
|
||||
* @return If {@link Block#use(BlockState, Level, BlockPos, Player, InteractionHand, BlockHitResult)} should be called
|
||||
*/
|
||||
public Result getUseBlock()
|
||||
{
|
||||
@@ -162,7 +171,7 @@ public class PlayerInteractEvent extends PlayerEvent
|
||||
}
|
||||
|
||||
/**
|
||||
* @return If {@link net.minecraft.item.Item#onItemUseFirst} and {@link net.minecraft.item.Item#onItemUse} should be called
|
||||
* @return If {@link Item#onItemUseFirst} and {@link Item#useOn(UseOnContext)} should be called
|
||||
*/
|
||||
public Result getUseItem()
|
||||
{
|
||||
@@ -178,10 +187,10 @@ public class PlayerInteractEvent extends PlayerEvent
|
||||
}
|
||||
|
||||
/**
|
||||
* DENY: {@link Block#onBlockActivated} will never be called. <br>
|
||||
* DEFAULT: {@link Block#onBlockActivated} will be called if {@link Item#onItemUseFirst} passes. <br>
|
||||
* DENY: {@link Block#use(BlockState, Level, BlockPos, Player, InteractionHand, BlockHitResult)} will never be called. <br>
|
||||
* DEFAULT: {@link Block#use(BlockState, Level, BlockPos, Player, InteractionHand, BlockHitResult)} will be called if {@link Item#onItemUseFirst} passes. <br>
|
||||
* Note that default activation can be blocked if the user is sneaking and holding an item that does not return true to {@link Item#doesSneakBypassUse}. <br>
|
||||
* ALLOW: {@link Block#onBlockActivated} will always be called, unless {@link Item#onItemUseFirst} does not pass. <br>
|
||||
* ALLOW: {@link Block#updateOrDestroy(BlockState, BlockState, LevelAccessor, BlockPos, int, int)} will always be called, unless {@link Item#onItemUseFirst} does not pass. <br>
|
||||
*/
|
||||
public void setUseBlock(Result triggerBlock)
|
||||
{
|
||||
@@ -189,9 +198,9 @@ public class PlayerInteractEvent extends PlayerEvent
|
||||
}
|
||||
|
||||
/**
|
||||
* DENY: Neither {@link Item#onItemUse} or {@link Item#onItemUseFirst} will be called. <br>
|
||||
* DEFAULT: {@link Item#onItemUseFirst} will always be called, and {@link Item#onItemUse} will be called if the block passes. <br>
|
||||
* ALLOW: {@link Item#onItemUseFirst} will always be called, and {@link Item#onItemUse} will be called if the block passes, regardless of cooldowns or emptiness. <br>
|
||||
* DENY: Neither {@link Item#useOn(UseOnContext)} or {@link Item#onItemUseFirst} will be called. <br>
|
||||
* DEFAULT: {@link Item#onItemUseFirst} will always be called, and {@link Item#useOn(UseOnContext)} will be called if the block passes. <br>
|
||||
* ALLOW: {@link Item#onItemUseFirst} will always be called, and {@link Item#useOn(UseOnContext)} will be called if the block passes, regardless of cooldowns or emptiness. <br>
|
||||
*/
|
||||
public void setUseItem(Result triggerItem)
|
||||
{
|
||||
@@ -211,11 +220,11 @@ public class PlayerInteractEvent extends PlayerEvent
|
||||
}
|
||||
|
||||
/**
|
||||
* This event is fired on both sides before the player triggers {@link net.minecraft.item.Item#onItemRightClick}.
|
||||
* This event is fired on both sides before the player triggers {@link Item#use(Level, Player, InteractionHand)}.
|
||||
* Note that this is NOT fired if the player is targeting a block {@link RightClickBlock} or entity {@link EntityInteract} {@link EntityInteractSpecific}.
|
||||
*
|
||||
* Let result be the return value of {@link net.minecraft.item.Item#onItemRightClick}, or {@link #cancellationResult} if the event is cancelled.
|
||||
* If we are on the client and result is not {@link EnumActionResult#SUCCESS}, the client will then continue to other hands.
|
||||
* Let result be the return value of {@link Item#use(Level, Player, InteractionHand)}, or {@link #cancellationResult} if the event is cancelled.
|
||||
* 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
|
||||
@@ -241,7 +250,7 @@ public class PlayerInteractEvent extends PlayerEvent
|
||||
|
||||
/**
|
||||
* This event is fired when a player left clicks while targeting a block.
|
||||
* This event controls which of {@link net.minecraft.block.Block#onBlockClicked} and/or the item harvesting methods will be called
|
||||
* This event controls which of {@link Block#attack(BlockState, Level, BlockPos, Player)} and/or the item harvesting methods will be called
|
||||
* Canceling the event will cause none of the above noted methods to be called.
|
||||
* There are various results to this event, see the getters below.
|
||||
*
|
||||
@@ -263,7 +272,7 @@ public class PlayerInteractEvent extends PlayerEvent
|
||||
}
|
||||
|
||||
/**
|
||||
* @return If {@link net.minecraft.block.Block#onBlockClicked} should be called. Changing this has no effect in creative mode
|
||||
* @return If {@link Block#attack(BlockState, Level, BlockPos, Player)} should be called. Changing this has no effect in creative mode
|
||||
*/
|
||||
public Result getUseBlock()
|
||||
{
|
||||
@@ -370,8 +379,8 @@ public class PlayerInteractEvent extends PlayerEvent
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The EnumActionResult that will be returned to vanilla if the event is cancelled, instead of calling the relevant
|
||||
* method of the event. By default, this is {@link EnumActionResult#PASS}, meaning cancelled events will cause
|
||||
* @return The InteractionResult that will be returned to vanilla if the event is cancelled, instead of calling the relevant
|
||||
* method of the event. By default, this is {@link InteractionResult#PASS}, meaning cancelled events will cause
|
||||
* the client to keep trying more interactions until something works.
|
||||
*/
|
||||
public InteractionResult getCancellationResult()
|
||||
@@ -380,7 +389,7 @@ public class PlayerInteractEvent extends PlayerEvent
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the EnumActionResult that will be returned to vanilla if the event is cancelled, instead of calling the relevant
|
||||
* Set the InteractionResult that will be returned to vanilla if the event is cancelled, instead of calling the relevant
|
||||
* method of the event.
|
||||
* Note that this only has an effect on {@link RightClickBlock}, {@link RightClickItem}, {@link EntityInteract}, and {@link EntityInteractSpecific}.
|
||||
*/
|
||||
|
||||
@@ -22,6 +22,7 @@ package net.minecraftforge.event.entity.player;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.entity.player.Player.BedSleepingProblem;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@@ -29,7 +30,7 @@ import java.util.Optional;
|
||||
* PlayerSleepInBedEvent is fired when a player sleeps in a bed.
|
||||
* <br>
|
||||
* This event is fired whenever a player sleeps in a bed in
|
||||
* {@link EntityPlayer#trySleep(BlockPos)}.<br>
|
||||
* {@link Player#startSleeping(BlockPos)}.<br>
|
||||
* <br>
|
||||
* {@link #result} contains whether the player is able to sleep. <br>
|
||||
* <br>
|
||||
|
||||
@@ -21,6 +21,7 @@ package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.world.entity.ExperienceOrb;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
|
||||
/**
|
||||
@@ -62,7 +63,7 @@ public class PlayerXpEvent extends PlayerEvent
|
||||
}
|
||||
|
||||
/**
|
||||
* This event is fired when the player's experience changes through the {@link PlayerEntity#giveExperiencePoints} method.
|
||||
* This event is fired when the player's experience changes through the {@link Player#giveExperiencePoints(int)} method.
|
||||
* It can be cancelled, and no further processing will be done.
|
||||
*/
|
||||
@Cancelable
|
||||
@@ -90,7 +91,7 @@ public class PlayerXpEvent extends PlayerEvent
|
||||
}
|
||||
|
||||
/**
|
||||
* This event is fired when the player's experience level changes through the {@link PlayerEntity#addExperienceLevel} method.
|
||||
* This event is fired when the player's experience level changes through the {@link Player#giveExperienceLevels(int)} method.
|
||||
* It can be cancelled, and no further processing will be done.
|
||||
*/
|
||||
@Cancelable
|
||||
|
||||
+5
-1
@@ -19,8 +19,12 @@
|
||||
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent;
|
||||
import net.minecraftforge.eventbus.api.Event.HasResult;
|
||||
|
||||
@@ -31,7 +35,7 @@ import net.minecraftforge.eventbus.api.Event.HasResult;
|
||||
* This event has a result. {@link HasResult}<br>
|
||||
*
|
||||
* setResult(ALLOW) informs game that player is still "in bed"<br>
|
||||
* setResult(DEFAULT) causes game to check {@link Block#isBed(IBlockState, net.minecraft.world.IWorldReader, BlockPos, Entity)} instead
|
||||
* setResult(DEFAULT) causes game to check {@link Block#isBed(BlockState, BlockGetter, BlockPos, Entity)} instead
|
||||
*/
|
||||
@HasResult
|
||||
public class SleepingLocationCheckEvent extends LivingEvent
|
||||
|
||||
@@ -21,6 +21,7 @@ package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.eventbus.api.Event.HasResult;
|
||||
|
||||
import java.util.Optional;
|
||||
@@ -32,7 +33,7 @@ import java.util.Optional;
|
||||
* This event has a result. {@link HasResult}<br>
|
||||
*
|
||||
* setResult(ALLOW) informs game that player can sleep at this time.<br>
|
||||
* setResult(DEFAULT) causes game to check !{@link World#isDaytime()} instead.
|
||||
* setResult(DEFAULT) causes game to check !{@link Level#isDay()} instead.
|
||||
*/
|
||||
@HasResult
|
||||
public class SleepingTimeCheckEvent extends PlayerEvent
|
||||
|
||||
Reference in new issue
Block a user