Added Javadoc comments for Forge Event documentation.

This commit is contained in:
Alex committed 2014-07-06 18:41:11 -04:00
1 parent 0705670f1d
commit c410a2d9fc
38 files changed
+933 -26

No files matched your search

@@ -3,6 +3,15 @@ package net.minecraftforge.event.entity;
import cpw.mods.fml.common.eventhandler.Event;
import net.minecraft.entity.Entity;
/**
* EntityEvent is fired when an event involving any Entity occurs.<br>
* If a method utilizes this {@link Event} as its parameter, the method will
* receive every child event of this class.<br>
* <br>
* {@link #entity} contains the entity that caused this event to occur.<br>
* <br>
* All children of this event are fired on the {@link MinecraftForge#EVENT_BUS}.<br>
**/
public class EntityEvent extends Event
{
public final Entity entity;
@@ -11,7 +20,17 @@ public class EntityEvent extends Event
{
this.entity = entity;
}
/**
* EntityConstructing is fired when an Entity is being created. <br>
* This event is fired within the constructor of the Entity.<br>
* <br>
* This event is not {@link Cancelable}.<br>
* <br>
* This event does not have a result. {@link HasResult}<br>
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.<br>
**/
public static class EntityConstructing extends EntityEvent
{
public EntityConstructing(Entity entity)
@@ -20,6 +39,19 @@ 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 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>
* and the entity with then be updated.<br>
* <br>
* This event is not {@link Cancelable}.<br>
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.<br>
**/
public static class CanUpdate extends EntityEvent
{
public boolean canUpdate = false;
@@ -28,7 +60,18 @@ public class EntityEvent extends Event
super(entity);
}
}
/**
* EnteringChunk is fired when an Entity enters a chunk. <br>
* This event is fired whenever vanilla Minecraft determines that an entity <br>
* is entering a chunk in Chunk#addEntity(net.minecraft.entity.Entity) <br>
* <br>
* This event is not {@link Cancelable}.<br>
* <br>
* This event does not have a result. {@link HasResult}
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.<br>
**/
public static class EnteringChunk extends EntityEvent
{
public int newChunkX;
@@ -4,6 +4,20 @@ import cpw.mods.fml.common.eventhandler.Cancelable;
import net.minecraft.entity.Entity;
import net.minecraft.world.World;
/**
* EntityJoinWorldEvent is fired when an Entity joins the world. <br>
* This event is fired whenever an Entity is added to the world in
* World#addLoadedEntities(java.util.List), World#joinEntityInSurroundings(Entity), and World#spawnEntityInWorld(Entity). <br>
* <br>
* {@link #world} contains the world in which the entity is to join.<br>
* <br>
* This event is {@link Cancelable}.<br>
* If this event is canceled, the Entity is not added to the world.<br>
* <br>
* This event does not have a result. {@link HasResult}<br>
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/
@Cancelable
public class EntityJoinWorldEvent extends EntityEvent
{
@@ -4,6 +4,20 @@ import cpw.mods.fml.common.eventhandler.Cancelable;
import net.minecraft.entity.Entity;
import net.minecraft.entity.effect.EntityLightningBolt;
/**
* 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
* EntityLightningBolt#onUpdate() via {@link ForgeEventFactory#onEntityStruckByLightning(Entity, EntityLightningBolt)}.<br>
* <br>
* {@link #lightning} contains the instance of EntityLightningBolt attempting to strike an entity.<br>
* <br>
* This event is {@link Cancelable}.<br>
* If this event is canceled, the Entity is not struck by the lightening.<br>
* <br>
* This event does not have a result. {@link HasResult}<br>
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.<br>
**/
@Cancelable
public class EntityStruckByLightningEvent extends EntityEvent
{
@@ -3,6 +3,24 @@ package net.minecraftforge.event.entity;
import cpw.mods.fml.common.eventhandler.Cancelable;
import net.minecraft.entity.Entity;
/**
* 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
* EntityPlayerSP#playSound(String, float, float), World#playSoundAtEntity(Entity, String, float, float),
* and World#playerSoundToNearExcept(EntityPlayer, String, 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.<br>
* {@link #pitch} contains the pitch at which the sound is to be played.<br>
* Changing the {@link #name} field will cause the sound of this name to be played instead of the originally intended sound.<br>
* <br>
* This event is {@link Cancelable}.<br>
* If this event is canceled, the sound is not played.<br>
* <br>
* This event does not have a result. {@link HasResult} <br>
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.<br>
**/
@Cancelable
public class PlaySoundAtEntityEvent extends EntityEvent
{
@@ -4,6 +4,24 @@ import cpw.mods.fml.common.eventhandler.Cancelable;
import net.minecraft.util.DamageSource;
import net.minecraft.entity.EntityLivingBase;
/**
* LivingAttackEvent is fired when a living Entity is attacked. <br>
* This event is fired whenever an Entity is attacked in
* EntityLivingBase#attackEntityFrom(DamageSource, float) and
* EntityPlayer#attackEntityFrom(DamageSource, float). <br>
* <br>
* This event is fired via the {@link ForgeHooks#onLivingAttack(EntityLivingBase, 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>
* <br>
* This event is {@link Cancelable}.<br>
* If this event is canceled, the Entity does not take attack damage.<br>
* <br>
* This event does not have a result. {@link HasResult}<br>
*<br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/
@Cancelable
public class LivingAttackEvent extends LivingEvent
{
@@ -4,6 +4,24 @@ import cpw.mods.fml.common.eventhandler.Cancelable;
import net.minecraft.util.DamageSource;
import net.minecraft.entity.EntityLivingBase;
/**
* LivingDeathEvent is fired when an Entity dies. <br>
* This event is fired whenever an Entity dies in
* EntityLivingBase#onDeath(DamageSource),
* EntityPlayer#onDeath(DamageSource), and
* EntityPlayerMP#onDeath(DamageSource). <br>
* <br>
* This event is fired via the {@link ForgeHooks#onLivingDeath(EntityLivingBase, DamageSource)}.<br>
* <br>
* {@link #source} contains the DamageSource that caused the entity to die. <br>
* <br>
* This event is {@link Cancelable}.<br>
* If this event is canceled, the Entity does not die.<br>
* <br>
* This event does not have a result. {@link HasResult}<br>
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/
@Cancelable
public class LivingDeathEvent extends LivingEvent
{
@@ -13,5 +31,4 @@ public class LivingDeathEvent extends LivingEvent
super(entity);
this.source = source;
}
}
@@ -3,11 +3,30 @@ package net.minecraftforge.event.entity.living;
import java.util.ArrayList;
import cpw.mods.fml.common.eventhandler.Cancelable;
import net.minecraft.util.DamageSource;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.EntityLivingBase;
/**
* 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
* EntityLivingBase#onDeath(DamageSource).<br>
* <br>
* This event is fired via the {@link ForgeHooks#onLivingDrops(EntityLivingBase, DamageSource, ArrayList<EntityItem>, int, boolean, int)}.<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>
* {@link #lootingLevel} contains the amount of loot that will be dropped.<br>
* {@link #recentlyHit} determines whether the Entity doing the drop has recently been damaged.<br>
* {@link #specialDropValue} contains the special drop value for this even.<br>
* <br>
* This event is {@link Cancelable}.<br>
* If this event is canceled, the Entity does not drop anything.<br>
* <br>
* This event does not have a result. {@link HasResult}<br>
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/
@Cancelable
public class LivingDropsEvent extends LivingEvent
{
@@ -4,6 +4,13 @@ import cpw.mods.fml.common.eventhandler.Cancelable;
import net.minecraft.entity.EntityLivingBase;
import net.minecraftforge.event.entity.EntityEvent;
/**
* LivingEvent is fired whenever an event involving Living entities occurs.<br>
* 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>
**/
public class LivingEvent extends EntityEvent
{
public final EntityLivingBase entityLiving;
@@ -13,12 +20,40 @@ public class LivingEvent extends EntityEvent
entityLiving = entity;
}
/**
* LivingUpdateEvent is fired when an Entity is updated. <br>
* This event is fired whenever an Entity is updated in
* EntityLivingBase#onUpdate(). <br>
* <br>
* This event is fired via the {@link ForgeHooks#onLivingUpdate(EntityLivingBase)}.<br>
* <br>
* This event is {@link Cancelable}.<br>
* If this event is canceled, the Entity does not update.<br>
* <br>
* This event does not have a result. {@link HasResult}<br>
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/
@Cancelable
public static class LivingUpdateEvent extends LivingEvent
{
public LivingUpdateEvent(EntityLivingBase e){ super(e); }
}
/**
* LivingJumpEvent is fired when an Entity jumps.<br>
* This event is fired whenever an Entity jumps in
* EntityLivingBase#jump(), EntityMagmaCube#jump(),
* and EntityHorse#jump().<br>
* <br>
* This event is fired via the {@link ForgeHooks#onLivingJump(EntityLivingBase)}.<br>
* <br>
* This event is not {@link Cancelable}.<br>
* <br>
* This event does not have a result. {@link HasResult}<br>
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/
public static class LivingJumpEvent extends LivingEvent
{
public LivingJumpEvent(EntityLivingBase e){ super(e); }
@@ -3,6 +3,22 @@ package net.minecraftforge.event.entity.living;
import cpw.mods.fml.common.eventhandler.Cancelable;
import net.minecraft.entity.EntityLivingBase;
/**
* LivingFallEvent is fired when an Entity is set to be falling.<br>
* This event is fired whenever an Entity is set to fall in
* EntityLivingBase#fall(float).<br>
* <br>
* This event is fired via the {@link ForgeHooks#onLivingFall(EntityLivingBase, 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>
* This event is {@link Cancelable}.<br>
* If this event is canceled, the Entity does not fall.<br>
* <br>
* This event does not have a result. {@link HasResult}<br>
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/
@Cancelable
public class LivingFallEvent extends LivingEvent
{
@@ -4,6 +4,24 @@ import cpw.mods.fml.common.eventhandler.Cancelable;
import net.minecraft.util.DamageSource;
import net.minecraft.entity.EntityLivingBase;
/**
* LivingHurtEvent is fired when an Entity is set to be hurt. <br>
* This event is fired whenever an Entity is hurt in
* EntityLivingBase#damageEntity(DamageSource, float) and
* EntityPlayer#damageEntity(DamageSource, float).<br>
* <br>
* This event is fired via the {@link ForgeHooks#onLivingHurt(EntityLivingBase, 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>
* <br>
* This event is {@link Cancelable}.<br>
* If this event is canceled, the Entity is not hurt.<br>
* <br>
* This event does not have a result. {@link HasResult}<br>
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/
@Cancelable
public class LivingHurtEvent extends LivingEvent
{
@@ -2,6 +2,22 @@ package net.minecraftforge.event.entity.living;
import net.minecraft.entity.EntityLivingBase;
/**
* 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
* EntityLiving#setAttackTarget(EntityLivingBase) and
* EntityLivingBase#setRevengeTarget(EntityLivingBase).<br>
* <br>
* This event is fired via the {@link ForgeHooks#onLivingSetAttackTarget(EntityLivingBase, EntityLivingBase)}.<br>
* <br>
* {@link #target} contains the newly targeted Entity.<br>
* <br>
* This event is not {@link Cancelable}.<br>
* <br>
* This event does not have a result. {@link HasResult}<br>
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/
public class LivingSetAttackTargetEvent extends LivingEvent
{
@@ -1,9 +1,22 @@
package net.minecraftforge.event.entity.living;
import cpw.mods.fml.common.eventhandler.Cancelable;
import cpw.mods.fml.common.eventhandler.Event.HasResult;
import net.minecraft.entity.EntityLiving;
import net.minecraft.world.World;
/**
* LivingSpawnEvent is fired whenever a living Entity is spawned. <br>
* If a method utilizes this {@link 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>
* {@link #x} contains the x-coordinate this entity is being spawned at.<br>
* {@link #y} contains the y-coordinate this entity is being spawned at.<br>
* {@link #z} contains the z-coordinate this entity is being spawned at.<br>
* <br>
* All children of this event are fired on the {@link MinecraftForge#EVENT_BUS}.
**/
public class LivingSpawnEvent extends LivingEvent
{
public final World world;
@@ -38,6 +51,20 @@ public class LivingSpawnEvent extends LivingEvent
}
}
/**
* SpecialSpawn is fired when an Entity is to be spawned from a mob spawner.<br>
* This event is fired whenever an Entity is spawned in a mob spawner in<br>
* SpawnerAnimals#findChunksForSpawning(WorldServer, boolean, boolean, boolean).<br>
* <br>
* This event is fired via the {@link ForgeHooks#doSpecialSpawn(EntityLiving, World, float, float, float)}.<br>
* <br>
* This event is {@link Cancelable}.<br>
* If this event is canceled, the Entity is not spawned.<br>
* <br>
* This event does not have a result. {@link HasResult}<br>
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/
@Cancelable
public static class SpecialSpawn extends LivingSpawnEvent
{
@@ -1,10 +1,18 @@
package net.minecraftforge.event.entity.living;
import cpw.mods.fml.common.eventhandler.Event.HasResult;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.world.World;
import net.minecraftforge.event.entity.EntityEvent;
/**
* ZombieEvent is fired whenever a zombie is spawned for aid.
* If a method utilizes this {@link 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}.
**/
public class ZombieEvent extends EntityEvent {
public ZombieEvent(EntityZombie entity)
@@ -16,7 +24,30 @@ public class ZombieEvent extends EntityEvent {
{
return (EntityZombie) entity;
}
/**
* SummonAidEvent is fired when a Zombie Entity is summoned.
* This event is fired whenever a Zombie Entity is summoned in
* EntityZombie#attackEntityFrom(DamageSource, float).
*
* This event is fired via the {@link ForgeHooks#fireZombieSummonAid(EntityZombie, World, int, int, int, EntityLivingBase, 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.
* {@link #x} contains the x-coordinate at which this summoning event is occurring.
* {@link #y} contains the y-coordinate at which this summoning event is occurring.
* {@link #z} contains the z-coordinate at which this summoning event is occurring.
* {@link #attacker} contains the living Entity that attacked and caused this event to fire.
* {@link #summonChance} contains the likelihood that a Zombie would successfully be summoned.
*
* This event is not {@link Cancelable}.
*
* This event has a result. {@link HasResult}
* {@link Result#ALLOW} Zombie is summoned.
* {@link Result#DENY} Zombie is not summoned.
*
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/
@HasResult
public static class SummonAidEvent extends ZombieEvent {
/**
@@ -3,6 +3,19 @@ package net.minecraftforge.event.entity.minecart;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityMinecart;
/**
* MinecartCollisionEvent is fired when a minecart collides with an Entity.
* This event is fired whenever a minecraft collides in
* EntityMinecart#applyEntityCollision(Entity).
*
* {@link #collider} contains the Entity the Minecart collided with.
*
* This event is not {@link Cancelable}.
*
* This event does not have a result. {@link HasResult}
*
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/
public class MinecartCollisionEvent extends MinecartEvent
{
public final Entity collider;
@@ -3,6 +3,15 @@ package net.minecraftforge.event.entity.minecart;
import net.minecraft.entity.item.EntityMinecart;
import net.minecraftforge.event.entity.EntityEvent;
/**
* MinecartEvent is fired whenever an event involving minecart entities occurs. <br>
* If a method utilizes this {@link Event} as its parameter, the method will <br>
* receive every child event of this class.<br>
* <br>
* {@link #minecart} contains the minecart entity involved with this event.<br>
* <br>
* All children of this event are fired on the {@link MinecraftForge#EVENT_BUS}.<br>
**/
public class MinecartEvent extends EntityEvent
{
public final EntityMinecart minecart;
@@ -4,6 +4,23 @@ import cpw.mods.fml.common.eventhandler.Cancelable;
import net.minecraft.entity.item.EntityMinecart;
import net.minecraft.entity.player.EntityPlayer;
/**
* MinecartInteractEvent is fired when a player interacts with a minecart. <br>
* This event is fired whenever a player interacts with a minecart in
* EntityMinecartContainer#interactFirst(EntityPlayer),
* EntityMinecartEmpty#interactFirst(EntityPlayer)
* EntityMinecartFurnace#interactFirst(EntityPlayer)
* EntityMinecartHopper#interactFirst(EntityPlayer).<br>
* <br>
* {@link #player} contains the EntityPlayer that is involved with this minecart interaction.<br>
* <br>
* This event is {@link Cancelable}.<br>
* If this event is canceled, the player does not interact with the minecart.<br>
* <br>
* This event does not have a result. {@link HasResult}<br>
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/
@Cancelable
public class MinecartInteractEvent extends MinecartEvent
{
@@ -2,6 +2,21 @@ package net.minecraftforge.event.entity.minecart;
import net.minecraft.entity.item.EntityMinecart;
/**
* MinecartUpdateEvent is fired when a minecart is updated.<br>
* This event is fired whenever a minecart is updated in
* EntityMinecart#onUpdate().<br>
* <br>
* {@link #x} contains the x-coordinate of the minecart Entity.<br>
* {@link #y} contains the y-coordinate of the minecart Entity.<br>
* {@link #z} contains the z-coordinate of the minecart Entity.<br>
* <br>
* This event is not {@link Cancelable}.<br>
* <br>
* This event does not have a result. {@link HasResult}<br>
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/
public class MinecartUpdateEvent extends MinecartEvent
{
public final float x;
@@ -4,6 +4,21 @@ import cpw.mods.fml.common.eventhandler.Cancelable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
/**
* ArrowLooseEvent is fired when a player stops using a bow.<br>
* This event is fired whenever a player stops using a bow in
* ItemBow#onPlayerStoppedUsing(ItemStack, World, EntityPlayer, 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 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>
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/
@Cancelable
public class ArrowLooseEvent extends PlayerEvent
{
@@ -4,6 +4,20 @@ import cpw.mods.fml.common.eventhandler.Cancelable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
/**
* ArrowNockEvent is fired when a player begins using a bow.<br>
* This event is fired whenever a player begins using a bow in
* ItemBow#onItemRightClick(ItemStack, World, EntityPlayer).<br>
* <br>
* {@link #result} contains the resulting ItemStack due to the use of the bow. <br>
* <br>
* This event is {@link Cancelable}.<br>
* If this event is canceled, the player does not begin using the bow.<br>
* <br>
* This event does not have a result. {@link HasResult}<br>
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/
@Cancelable
public class ArrowNockEvent extends PlayerEvent
{
@@ -4,6 +4,20 @@ import cpw.mods.fml.common.eventhandler.Cancelable;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
/**
* AttackEntityEvent is fired when a player attacks an Entity.<br>
* This event is fired whenever a player attacks an Entity in
* EntityPlayer#attackTargetEntityWithCurrentItem(Entity).<br>
* <br>
* {@link #target} contains the Entity that was damaged by the player. <br>
* <br>
* This event is {@link Cancelable}.<br>
* If this event is canceled, the player does not attack the Entity.<br>
* <br>
* This event does not have a result. {@link HasResult}<br>
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/
@Cancelable
public class AttackEntityEvent extends PlayerEvent
{
@@ -1,9 +1,24 @@
package net.minecraftforge.event.entity.player;
import cpw.mods.fml.common.eventhandler.Cancelable;
import cpw.mods.fml.common.eventhandler.Event.HasResult;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
/**
* EntityInteractEvent is fired when a player interacts with an Entity.<br>
* This event is fired whenever a player interacts with an Entity in
* EntityPlayer#interactWith(Entity).<br>
* <br>
* {@link #target} contains the Entity the player interacted with. <br>
* <br>
* This event is {@link Cancelable}.<br>
* If this event is canceled, the player does not interact with the Entity.<br>
* <br>
* This event does not have a result. {@link HasResult}<br>
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/
@Cancelable
public class EntityInteractEvent extends PlayerEvent
{
@@ -1,8 +1,27 @@
package net.minecraftforge.event.entity.player;
import cpw.mods.fml.common.eventhandler.Cancelable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
/**
* PlayerDestroyItemEvent is fired when a player destroys an item.<br>
* This event is fired whenever a player destroys an item in
* PlayerControllerMP#onPlayerRightClick(EntityPlayer, World, ItemStack, int, int, int, int, Vec3),
* PlayerControllerMP#sendUseItem(EntityPlayer, World, ItemStack),
* EntityPlayer#destroyCurrentEquippedItem(),
* SlotCrafting#onPickupFromSlot(EntityPlayer, ItemStack),
* ItemInWorldManager#tryUseItem(EntityPlayer, World, ItemStack),
* and ItemInWorldManager#activateBlockOrUseItem(EntityPlayer, World, ItemStack, int, int, int, int, float, float, float).<br>
* <br>
* {@link #original} contains the original ItemStack before the item was destroyed. <br>
* <br>
* This event is not {@link Cancelable}.<br>
* <br>
* This event does not have a result. {@link HasResult}<br>
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/
public class PlayerDestroyItemEvent extends PlayerEvent
{
public final ItemStack original;
@@ -1,12 +1,20 @@
package net.minecraftforge.event.entity.player;
import java.io.File;
import cpw.mods.fml.common.eventhandler.Cancelable;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.event.entity.living.LivingEvent;
/**
* PlayerEvent is fired whenever an event involving Living entities occurs. <br>
* 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}.
**/
public class PlayerEvent extends LivingEvent
{
public final EntityPlayer entityPlayer;
@@ -16,6 +24,22 @@ public class PlayerEvent extends LivingEvent
entityPlayer = player;
}
/**
* 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
* EntityPlayer#canHarvestBlock(Block).<br>
* <br>
* This event is fired via the {@link ForgeEventFactory#doPlayerHarvestCheck(EntityPlayer, Block, boolean)}.<br>
* <br>
* {@link #block} contains the Block 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 Cancelable}.<br>
* <br>
* This event does not have a result. {@link HasResult}<br>
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/
public static class HarvestCheck extends PlayerEvent
{
public final Block block;
@@ -29,6 +53,28 @@ 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
* EntityPlayer#canHarvestBlock(Block).<br>
* <br>
* This event is fired via the {@link ForgeEventFactory#getBreakSpeed(EntityPlayer, Block, int, float, int, int, int)}.<br>
* <br>
* {@link #block} contains the block being broken. <br>
* {@link #metadata} contains the metadata of the block being broken. <br>
* {@link #originalSpeed} contains the original speed at which the player broke the block. <br>
* {@link #newSpeed} contains the newSpeed at which the player will break the block. <br>
* {@link #x} contains the x-coordinate at which this event is occurring. <br>
* {@link #y} contains the y-coordinate at which this event is occurring. <br>
* {@link #z} contains the z-coordinate at which this event is occurring. <br>
* <br>
* This event is {@link Cancelable}.<br>
* If it is canceled, the player is unable to break the block.<br>
* <br>
* This event does not have a result. {@link HasResult}<br>
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/
@Cancelable
public static class BreakSpeed extends PlayerEvent
{
@@ -59,6 +105,22 @@ 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
* EntityPlayer#getDisplayName() or EntityPlayer#refreshDisplayName().<br>
* <br>
* This event is fired via the {@link ForgeEventFactory#getPlayerDisplayName(EntityPlayer, String)}.<br>
* <br>
* {@link #username} contains the username of the player.
* {@link #displayname} contains the display name of the player.
* <br>
* This event is not {@link Cancelable}.
* <br>
* This event does not have a result. {@link HasResult}
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/
public static class NameFormat extends PlayerEvent
{
public final String username;
@@ -6,6 +6,31 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import cpw.mods.fml.common.eventhandler.Cancelable;
/**
* PlayerInteractEvent is fired when a player interacts in some way.
* <br>
* This event is fired whenever a player interacts in
* Minecraft#func_147121_ag(),
* NetHandlerPlayServer#processPlayerBlockPlacement(C08PacketPlayerBlockPlacement),
* ItemInWorldManager#activateBlockOrUseItem(EntityPlayer, World, ItemStack, int, int, int, int, float, float, float),
* ItemInWorldManager#onBlockClicked(int, int, int, int). <br>
* <br>
* This event is fired via the {@link ForgeEventFactory#onPlayerInteract(EntityPlayer, Action, int, int, int, int)}.
* <br>
* {@link #action} contains the Action the player performed durin this interaction. <br>
* {@link #x} contains the x-coordinate of where this event occurred. <br>
* {@link #y} contains the y-coordinate of where this event occurred. <br>
* {@link #z} contains the z-coordinate of where this event occurred. <br>
* {@link #face} contains the face of the block that was interacted with. <br>
* {@link #world} contains the world in which this event is occurring. <br>
* <br>
* This event is {@link Cancelable}.<br>
* If this event is canceled, the player does not interact.<br>
* <br>
* This event does not have a result. {@link HasResult}<br>
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/
@Cancelable
public class PlayerInteractEvent extends PlayerEvent
{
@@ -3,6 +3,20 @@ package net.minecraftforge.event.entity.player;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayer.EnumStatus;
/**
* PlayerSleepInBedEvent is fired when a player sleeps in a bed.
* <br>
* This event is fired whenever a player sleeps in a bed in
* EntityPlayer#sleepInBedAt(int, int, int).<br>
* <br>
* {@link #result} contains whether the player is able to sleep. <br>
* <br>
* This event is not {@link Cancelable}.
* <br>
* This event does not have a result. {@link HasResult}
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/
public class PlayerSleepInBedEvent extends PlayerEvent
{
public EnumStatus result = null;