mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-22 13:09:59 +00:00
Step 2: The Reformation
This commit is contained in:
1 parent
9332673944
commit
797399ff7f
198 files changed
+24
-10
No files matched your search
@@ -0,0 +1,49 @@
|
||||
package net.minecraftforge.event.entity;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.Event;
|
||||
|
||||
public class EntityEvent extends Event
|
||||
{
|
||||
public final Entity entity;
|
||||
|
||||
public EntityEvent(Entity entity)
|
||||
{
|
||||
this.entity = entity;
|
||||
}
|
||||
|
||||
public static class EntityConstructing extends EntityEvent
|
||||
{
|
||||
public EntityConstructing(Entity entity)
|
||||
{
|
||||
super(entity);
|
||||
}
|
||||
}
|
||||
|
||||
public static class CanUpdate extends EntityEvent
|
||||
{
|
||||
public boolean canUpdate = false;
|
||||
public CanUpdate(Entity entity)
|
||||
{
|
||||
super(entity);
|
||||
}
|
||||
}
|
||||
|
||||
public static class EnteringChunk extends EntityEvent
|
||||
{
|
||||
public int newChunkX;
|
||||
public int newChunkZ;
|
||||
public int oldChunkX;
|
||||
public int oldChunkZ;
|
||||
|
||||
public EnteringChunk(Entity entity, int newChunkX, int newChunkZ, int oldChunkX, int oldChunkZ)
|
||||
{
|
||||
super(entity);
|
||||
this.newChunkX = newChunkX;
|
||||
this.newChunkZ = newChunkZ;
|
||||
this.oldChunkX = oldChunkX;
|
||||
this.oldChunkZ = oldChunkZ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package net.minecraftforge.event.entity;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
|
||||
@Cancelable
|
||||
public class EntityJoinWorldEvent extends EntityEvent
|
||||
{
|
||||
|
||||
public final World world;
|
||||
|
||||
public EntityJoinWorldEvent(Entity entity, World world)
|
||||
{
|
||||
super(entity);
|
||||
this.world = world;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package net.minecraftforge.event.entity;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
|
||||
@Cancelable
|
||||
public class EntityStruckByLightningEvent extends EntityEvent
|
||||
{
|
||||
public final EntityLightningBolt lightning;
|
||||
|
||||
public EntityStruckByLightningEvent(Entity entity, EntityLightningBolt lightning)
|
||||
{
|
||||
super(entity);
|
||||
this.lightning = lightning;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package net.minecraftforge.event.entity;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
|
||||
@Cancelable
|
||||
public class PlaySoundAtEntityEvent extends EntityEvent
|
||||
{
|
||||
public String name;
|
||||
public final float volume;
|
||||
public final float pitch;
|
||||
|
||||
public PlaySoundAtEntityEvent(Entity entity, String name, float volume, float pitch)
|
||||
{
|
||||
super(entity);
|
||||
this.name = name;
|
||||
this.volume = volume;
|
||||
this.pitch = pitch;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package net.minecraftforge.event.entity.item;
|
||||
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraftforge.event.entity.EntityEvent;
|
||||
|
||||
/**
|
||||
* Base class for all EntityItem events. Contains a reference to the
|
||||
* EntityItem of interest. For most EntityItem events, there's little to no
|
||||
* additional useful data from the firing method that isn't already contained
|
||||
* within the EntityItem instance.
|
||||
*/
|
||||
public class ItemEvent extends EntityEvent
|
||||
{
|
||||
/**
|
||||
* The relevant EntityItem for this event, already cast for you.
|
||||
*/
|
||||
public final EntityItem entityItem;
|
||||
|
||||
/**
|
||||
* Creates a new event for an EntityItem.
|
||||
*
|
||||
* @param itemEntity The EntityItem for this event
|
||||
*/
|
||||
public ItemEvent(EntityItem itemEntity)
|
||||
{
|
||||
super(itemEntity);
|
||||
this.entityItem = itemEntity;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package net.minecraftforge.event.entity.item;
|
||||
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
import net.minecraftforge.event.entity.EntityEvent;
|
||||
|
||||
/**
|
||||
* Event that is fired when an EntityItem's age has reached its maximum
|
||||
* lifespan. Canceling this event will prevent the EntityItem from being
|
||||
* flagged as dead, thus staying it's removal from the world. If canceled
|
||||
* it will add more time to the entitie's life equal to extraLife.
|
||||
*/
|
||||
@Cancelable
|
||||
public class ItemExpireEvent extends ItemEvent
|
||||
{
|
||||
|
||||
public int extraLife;
|
||||
|
||||
/**
|
||||
* Creates a new event for an expiring EntityItem.
|
||||
*
|
||||
* @param entityItem The EntityItem being deleted.
|
||||
* @param extraLife The amount of time to be added to this entities lifespan if the event is canceled.
|
||||
*/
|
||||
public ItemExpireEvent(EntityItem entityItem, int extraLife)
|
||||
{
|
||||
super(entityItem);
|
||||
this.extraLife = extraLife;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package net.minecraftforge.event.entity.item;
|
||||
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
import net.minecraftforge.event.entity.EntityEvent;
|
||||
|
||||
/**
|
||||
* Event that is fired whenever a player tosses (Q) an item or drag-n-drops a
|
||||
* stack of items outside the inventory GUI screens. Canceling the event will
|
||||
* stop the items from entering the world, but will not prevent them being
|
||||
* removed from the inventory - and thus removed from the system.
|
||||
*/
|
||||
@Cancelable
|
||||
public class ItemTossEvent extends ItemEvent
|
||||
{
|
||||
|
||||
/**
|
||||
* The player tossing the item.
|
||||
*/
|
||||
public final EntityPlayer player;
|
||||
|
||||
/**
|
||||
* Creates a new event for EntityItems tossed by a player.
|
||||
*
|
||||
* @param entityItem The EntityItem being tossed.
|
||||
* @param player The player tossing the item.
|
||||
*/
|
||||
public ItemTossEvent(EntityItem entityItem, EntityPlayer player)
|
||||
{
|
||||
super(entityItem);
|
||||
this.player = player;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
import net.minecraftforge.event.Event;
|
||||
|
||||
/**
|
||||
* Event for when an Enderman teleports or an ender pearl is used. Can be used to either modify the target position, or cancel the teleport outright.
|
||||
* @author Mithion
|
||||
*
|
||||
*/
|
||||
@Cancelable
|
||||
public class EnderTeleportEvent extends LivingEvent
|
||||
{
|
||||
|
||||
public double targetX;
|
||||
public double targetY;
|
||||
public double targetZ;
|
||||
public float attackDamage;
|
||||
|
||||
public EnderTeleportEvent(EntityLivingBase entity, double targetX, double targetY, double targetZ, float attackDamage)
|
||||
{
|
||||
super(entity);
|
||||
this.targetX = targetX;
|
||||
this.targetY = targetY;
|
||||
this.targetZ = targetZ;
|
||||
this.attackDamage = attackDamage;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
|
||||
@Cancelable
|
||||
public class LivingAttackEvent extends LivingEvent
|
||||
{
|
||||
public final DamageSource source;
|
||||
public final float ammount;
|
||||
public LivingAttackEvent(EntityLivingBase entity, DamageSource source, float ammount)
|
||||
{
|
||||
super(entity);
|
||||
this.source = source;
|
||||
this.ammount = ammount;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
|
||||
@Cancelable
|
||||
public class LivingDeathEvent extends LivingEvent
|
||||
{
|
||||
public final DamageSource source;
|
||||
public LivingDeathEvent(EntityLivingBase entity, DamageSource source)
|
||||
{
|
||||
super(entity);
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
|
||||
@Cancelable
|
||||
public class LivingDropsEvent extends LivingEvent
|
||||
{
|
||||
public final DamageSource source;
|
||||
public final ArrayList<EntityItem> drops;
|
||||
public final int lootingLevel;
|
||||
public final boolean recentlyHit;
|
||||
public final int specialDropValue;
|
||||
|
||||
public LivingDropsEvent(EntityLivingBase entity, DamageSource source, ArrayList<EntityItem> drops, int lootingLevel, boolean recentlyHit, int specialDropValue)
|
||||
{
|
||||
super(entity);
|
||||
this.source = source;
|
||||
this.drops = drops;
|
||||
this.lootingLevel = lootingLevel;
|
||||
this.recentlyHit = recentlyHit;
|
||||
this.specialDropValue = specialDropValue;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
import net.minecraftforge.event.entity.EntityEvent;
|
||||
|
||||
public class LivingEvent extends EntityEvent
|
||||
{
|
||||
public final EntityLivingBase entityLiving;
|
||||
public LivingEvent(EntityLivingBase entity)
|
||||
{
|
||||
super(entity);
|
||||
entityLiving = entity;
|
||||
}
|
||||
|
||||
@Cancelable
|
||||
public static class LivingUpdateEvent extends LivingEvent
|
||||
{
|
||||
public LivingUpdateEvent(EntityLivingBase e){ super(e); }
|
||||
}
|
||||
|
||||
public static class LivingJumpEvent extends LivingEvent
|
||||
{
|
||||
public LivingJumpEvent(EntityLivingBase e){ super(e); }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
|
||||
@Cancelable
|
||||
public class LivingFallEvent extends LivingEvent
|
||||
{
|
||||
public float distance;
|
||||
public LivingFallEvent(EntityLivingBase entity, float distance)
|
||||
{
|
||||
super(entity);
|
||||
this.distance = distance;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
|
||||
@Cancelable
|
||||
public class LivingHurtEvent extends LivingEvent
|
||||
{
|
||||
public final DamageSource source;
|
||||
public float ammount;
|
||||
public LivingHurtEvent(EntityLivingBase entity, DamageSource source, float ammount)
|
||||
{
|
||||
super(entity);
|
||||
this.source = source;
|
||||
this.ammount = ammount;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraftforge.event.Event.HasResult;
|
||||
|
||||
@HasResult
|
||||
public class LivingPackSizeEvent extends LivingEvent
|
||||
{
|
||||
/**
|
||||
* This event is fired when the spawning system determines the
|
||||
* maximum amount of the selected entity that can spawn at the same
|
||||
* time.
|
||||
*
|
||||
* If you set the result to 'ALLOW', it means that you want to return
|
||||
* the value of maxPackSize as the maximum pack size for current entity.
|
||||
*/
|
||||
public int maxPackSize;
|
||||
|
||||
public LivingPackSizeEvent(EntityLiving entity)
|
||||
{
|
||||
super(entity);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
||||
public class LivingSetAttackTargetEvent extends LivingEvent
|
||||
{
|
||||
|
||||
public final EntityLivingBase target;
|
||||
public LivingSetAttackTargetEvent(EntityLivingBase entity, EntityLivingBase target)
|
||||
{
|
||||
super(entity);
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
import net.minecraftforge.event.Event.HasResult;
|
||||
|
||||
public class LivingSpawnEvent extends LivingEvent
|
||||
{
|
||||
public final World world;
|
||||
public final float x;
|
||||
public final float y;
|
||||
public final float z;
|
||||
|
||||
public LivingSpawnEvent(EntityLiving entity, World world, float x, float y, float z)
|
||||
{
|
||||
super(entity);
|
||||
this.world = world;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires before mob spawn events.
|
||||
*
|
||||
* Result is significant:
|
||||
* DEFAULT: use vanilla spawn rules
|
||||
* ALLOW: allow the spawn
|
||||
* DENY: deny the spawn
|
||||
*
|
||||
*/
|
||||
@HasResult
|
||||
public static class CheckSpawn extends LivingSpawnEvent
|
||||
{
|
||||
public CheckSpawn(EntityLiving entity, World world, float x, float y, float z)
|
||||
{
|
||||
super(entity, world, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
@Cancelable
|
||||
public static class SpecialSpawn extends LivingSpawnEvent
|
||||
{
|
||||
public SpecialSpawn(EntityLiving entity, World world, float x, float y, float z)
|
||||
{
|
||||
super(entity, world, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired each tick for despawnable mobs to allow control over despawning.
|
||||
* {@link Result#DEFAULT} will pass the mob on to vanilla despawn mechanics.
|
||||
* {@link Result#ALLOW} will force the mob to despawn.
|
||||
* {@link Result#DENY} will force the mob to remain.
|
||||
* 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}
|
||||
*
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
@HasResult
|
||||
public static class AllowDespawn extends LivingSpawnEvent
|
||||
{
|
||||
public AllowDespawn(EntityLiving entity)
|
||||
{
|
||||
super(entity, entity.worldObj, (float)entity.posX, (float)entity.posY, (float)entity.posZ);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.monster.EntityZombie;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
import net.minecraftforge.event.entity.EntityEvent;
|
||||
|
||||
public class ZombieEvent extends EntityEvent {
|
||||
|
||||
public ZombieEvent(EntityZombie entity)
|
||||
{
|
||||
super(entity);
|
||||
}
|
||||
|
||||
public EntityZombie getSummoner()
|
||||
{
|
||||
return (EntityZombie) entity;
|
||||
}
|
||||
|
||||
@HasResult
|
||||
public static class SummonAidEvent extends ZombieEvent {
|
||||
/**
|
||||
* Populate this field to have a custom zombie instead of a normal zombie summoned
|
||||
*/
|
||||
public EntityZombie customSummonedAid;
|
||||
|
||||
public final World world;
|
||||
public final int x;
|
||||
public final int y;
|
||||
public final int z;
|
||||
public final EntityLivingBase attacker;
|
||||
public final double summonChance;
|
||||
|
||||
public SummonAidEvent(EntityZombie entity, World world, int x, int y, int z, EntityLivingBase attacker, double summonChance)
|
||||
{
|
||||
super(entity);
|
||||
this.world = world;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.attacker = attacker;
|
||||
this.summonChance = summonChance;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package net.minecraftforge.event.entity.minecart;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityMinecart;
|
||||
|
||||
public class MinecartCollisionEvent extends MinecartEvent
|
||||
{
|
||||
public final Entity collider;
|
||||
|
||||
public MinecartCollisionEvent(EntityMinecart minecart, Entity collider)
|
||||
{
|
||||
super(minecart);
|
||||
this.collider = collider;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package net.minecraftforge.event.entity.minecart;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityMinecart;
|
||||
import net.minecraftforge.event.entity.EntityEvent;
|
||||
|
||||
public class MinecartEvent extends EntityEvent
|
||||
{
|
||||
public final EntityMinecart minecart;
|
||||
|
||||
public MinecartEvent(EntityMinecart minecart)
|
||||
{
|
||||
super(minecart);
|
||||
this.minecart = minecart;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package net.minecraftforge.event.entity.minecart;
|
||||
|
||||
import net.minecraft.entity.item.EntityMinecart;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
|
||||
@Cancelable
|
||||
public class MinecartInteractEvent extends MinecartEvent
|
||||
{
|
||||
public final EntityPlayer player;
|
||||
|
||||
public MinecartInteractEvent(EntityMinecart minecart, EntityPlayer player)
|
||||
{
|
||||
super(minecart);
|
||||
this.player = player;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package net.minecraftforge.event.entity.minecart;
|
||||
|
||||
import net.minecraft.entity.item.EntityMinecart;
|
||||
|
||||
public class MinecartUpdateEvent extends MinecartEvent
|
||||
{
|
||||
public final float x;
|
||||
public final float y;
|
||||
public final float z;
|
||||
|
||||
public MinecartUpdateEvent(EntityMinecart minecart, float x, float y, float z)
|
||||
{
|
||||
super(minecart);
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
|
||||
@Cancelable
|
||||
public class ArrowLooseEvent extends PlayerEvent
|
||||
{
|
||||
public final ItemStack bow;
|
||||
public int charge;
|
||||
|
||||
public ArrowLooseEvent(EntityPlayer player, ItemStack bow, int charge)
|
||||
{
|
||||
super(player);
|
||||
this.bow = bow;
|
||||
this.charge = charge;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
|
||||
@Cancelable
|
||||
public class ArrowNockEvent extends PlayerEvent
|
||||
{
|
||||
public ItemStack result;
|
||||
|
||||
public ArrowNockEvent(EntityPlayer player, ItemStack result)
|
||||
{
|
||||
super(player);
|
||||
this.result = result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
|
||||
@Cancelable
|
||||
public class AttackEntityEvent extends PlayerEvent
|
||||
{
|
||||
public final Entity target;
|
||||
public AttackEntityEvent(EntityPlayer player, Entity target)
|
||||
{
|
||||
super(player);
|
||||
this.target = target;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
import net.minecraftforge.event.Event;
|
||||
|
||||
@Cancelable
|
||||
@Event.HasResult
|
||||
public class BonemealEvent extends PlayerEvent
|
||||
{
|
||||
/**
|
||||
* This event is called when a player attempts to use Bonemeal on a block.
|
||||
* It can be canceled to completely prevent any further processing.
|
||||
*
|
||||
* You can also set the result to ALLOW to mark the event as processed
|
||||
* and use up a bonemeal from the stack but do no further processing.
|
||||
*
|
||||
* setResult(ALLOW) is the same as the old setHandeled()
|
||||
*/
|
||||
|
||||
public final World world;
|
||||
public final int ID;
|
||||
public final int X;
|
||||
public final int Y;
|
||||
public final int Z;
|
||||
|
||||
public BonemealEvent(EntityPlayer player, World world, int id, int x, int y, int z)
|
||||
{
|
||||
super(player);
|
||||
this.world = world;
|
||||
this.ID = id;
|
||||
this.X = x;
|
||||
this.Y = y;
|
||||
this.Z = z;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
|
||||
@Cancelable
|
||||
public class EntityInteractEvent extends PlayerEvent
|
||||
{
|
||||
public final Entity target;
|
||||
public EntityInteractEvent(EntityPlayer player, Entity target)
|
||||
{
|
||||
super(player);
|
||||
this.target = target;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
import net.minecraftforge.event.Event;
|
||||
|
||||
@Cancelable
|
||||
@Event.HasResult
|
||||
public class EntityItemPickupEvent extends PlayerEvent
|
||||
{
|
||||
/**
|
||||
* This event is called when a player collides with a EntityItem on the ground.
|
||||
* The event can be canceled, and no further processing will be done.
|
||||
*
|
||||
* You can set the result of this event to ALLOW which will trigger the
|
||||
* processing of achievements, FML's event, play the sound, and kill the
|
||||
* entity if all the items are picked up.
|
||||
*
|
||||
* setResult(ALLOW) is the same as the old setHandled()
|
||||
*/
|
||||
|
||||
public final EntityItem item;
|
||||
private boolean handled = false;
|
||||
|
||||
public EntityItemPickupEvent(EntityPlayer player, EntityItem item)
|
||||
{
|
||||
super(player);
|
||||
this.item = item;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
import net.minecraftforge.event.Event;
|
||||
|
||||
@Cancelable
|
||||
@Event.HasResult
|
||||
public class FillBucketEvent extends PlayerEvent
|
||||
{
|
||||
/**
|
||||
* This event is fired when a player attempts to use a Empty bucket, it
|
||||
* can be canceled to completely prevent any further processing.
|
||||
*
|
||||
* If you set the result to 'ALLOW', it means that you have processed
|
||||
* the event and wants the basic functionality of adding the new
|
||||
* ItemStack to your inventory and reducing the stack size to process.
|
||||
* setResult(ALLOW) is the same as the old setHandeled();
|
||||
*/
|
||||
|
||||
public final ItemStack current;
|
||||
public final World world;
|
||||
public final MovingObjectPosition target;
|
||||
|
||||
public ItemStack result;
|
||||
|
||||
public FillBucketEvent(EntityPlayer player, ItemStack current, World world, MovingObjectPosition target)
|
||||
{
|
||||
super(player);
|
||||
this.current = current;
|
||||
this.world = world;
|
||||
this.target = target;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import java.util.List;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemTooltipEvent extends PlayerEvent
|
||||
{
|
||||
/**
|
||||
* Whether the advanced information on item tooltips is being shown, toggled by F3+H.
|
||||
*/
|
||||
public final boolean showAdvancedItemTooltips;
|
||||
/**
|
||||
* The {@link ItemStack} with the tooltip.
|
||||
*/
|
||||
public final ItemStack itemStack;
|
||||
/**
|
||||
* The {@link ItemStack} tooltip.
|
||||
*/
|
||||
public final List<String> toolTip;
|
||||
|
||||
/**
|
||||
* This event is fired in {@link ItemStack#getTooltip(EntityPlayer, boolean)}, which in turn is called from it's respective GUIContainer.
|
||||
*/
|
||||
public ItemTooltipEvent(ItemStack itemStack, EntityPlayer entityPlayer, List<String> toolTip, boolean showAdvancedItemTooltips)
|
||||
{
|
||||
super(entityPlayer);
|
||||
this.itemStack = itemStack;
|
||||
this.toolTip = toolTip;
|
||||
this.showAdvancedItemTooltips = showAdvancedItemTooltips;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class PlayerDestroyItemEvent extends PlayerEvent
|
||||
{
|
||||
public final ItemStack original;
|
||||
public PlayerDestroyItemEvent(EntityPlayer player, ItemStack original)
|
||||
{
|
||||
super(player);
|
||||
this.original = original;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
||||
|
||||
/**
|
||||
* Child class of LivingDropEvent that is fired specifically when a
|
||||
* player dies. Canceling the event will prevent ALL drops from entering the
|
||||
* world.
|
||||
*/
|
||||
@Cancelable
|
||||
public class PlayerDropsEvent extends LivingDropsEvent
|
||||
{
|
||||
public final EntityPlayer entityPlayer;
|
||||
|
||||
/**
|
||||
* Creates a new event containing all the items that will drop into the
|
||||
* world when a player dies.
|
||||
* @param entity The dying player.
|
||||
* @param source The source of the damage which is killing the player.
|
||||
* @param drops List of all drops entering the world.
|
||||
*/
|
||||
public PlayerDropsEvent(EntityPlayer entity, DamageSource source, ArrayList<EntityItem> drops, boolean recentlyHit)
|
||||
{
|
||||
super(entity, source, drops,
|
||||
(source.getEntity() instanceof EntityPlayer) ?
|
||||
EnchantmentHelper.getLootingModifier(((EntityPlayer)source.getEntity())) : 0,
|
||||
recentlyHit, 0);
|
||||
|
||||
this.entityPlayer = entity;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent;
|
||||
|
||||
public class PlayerEvent extends LivingEvent
|
||||
{
|
||||
public final EntityPlayer entityPlayer;
|
||||
public PlayerEvent(EntityPlayer player)
|
||||
{
|
||||
super(player);
|
||||
entityPlayer = player;
|
||||
}
|
||||
|
||||
public static class HarvestCheck extends PlayerEvent
|
||||
{
|
||||
public final Block block;
|
||||
public boolean success;
|
||||
|
||||
public HarvestCheck(EntityPlayer player, Block block, boolean success)
|
||||
{
|
||||
super(player);
|
||||
this.block = block;
|
||||
this.success = success;
|
||||
}
|
||||
}
|
||||
|
||||
@Cancelable
|
||||
public static class BreakSpeed extends PlayerEvent
|
||||
{
|
||||
public final Block block;
|
||||
public final int metadata;
|
||||
public final float originalSpeed;
|
||||
public float newSpeed = 0.0f;
|
||||
|
||||
public BreakSpeed(EntityPlayer player, Block block, int metadata, float original)
|
||||
{
|
||||
super(player);
|
||||
this.block = block;
|
||||
this.metadata = metadata;
|
||||
this.originalSpeed = original;
|
||||
this.newSpeed = original;
|
||||
}
|
||||
}
|
||||
|
||||
public static class NameFormat extends PlayerEvent
|
||||
{
|
||||
public final String username;
|
||||
public String displayname;
|
||||
|
||||
public NameFormat(EntityPlayer player, String username) {
|
||||
super(player);
|
||||
this.username = username;
|
||||
this.displayname = username;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
|
||||
/**
|
||||
* Occurs when a player falls, but is able to fly. Doesn't need to be cancelable, this is mainly for notification purposes.
|
||||
* @author Mithion
|
||||
*
|
||||
*/
|
||||
public class PlayerFlyableFallEvent extends PlayerEvent
|
||||
{
|
||||
|
||||
public float distance;
|
||||
|
||||
public PlayerFlyableFallEvent(EntityPlayer player, float f)
|
||||
{
|
||||
super(player);
|
||||
this.distance = f;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
import net.minecraftforge.event.Event;
|
||||
import static net.minecraftforge.event.Event.Result;
|
||||
import static net.minecraftforge.event.Event.Result.*;
|
||||
|
||||
@Cancelable
|
||||
public class PlayerInteractEvent extends PlayerEvent
|
||||
{
|
||||
public static enum Action
|
||||
{
|
||||
RIGHT_CLICK_AIR,
|
||||
RIGHT_CLICK_BLOCK,
|
||||
LEFT_CLICK_BLOCK
|
||||
}
|
||||
|
||||
public final Action action;
|
||||
public final int x;
|
||||
public final int y;
|
||||
public final int z;
|
||||
public final int face;
|
||||
|
||||
public Result useBlock = DEFAULT;
|
||||
public Result useItem = DEFAULT;
|
||||
|
||||
public PlayerInteractEvent(EntityPlayer player, Action action, int x, int y, int z, int face)
|
||||
{
|
||||
super(player);
|
||||
this.action = action;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.face = face;
|
||||
if (face == -1) useBlock = DENY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCanceled(boolean cancel)
|
||||
{
|
||||
super.setCanceled(cancel);
|
||||
useBlock = (cancel ? DENY : useBlock == DENY ? DEFAULT : useBlock);
|
||||
useItem = (cancel ? DENY : useItem == DENY ? DEFAULT : useItem);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraftforge.event.Event.HasResult;
|
||||
|
||||
@HasResult
|
||||
public class PlayerOpenContainerEvent extends PlayerEvent
|
||||
{
|
||||
|
||||
public final boolean canInteractWith;
|
||||
|
||||
/**
|
||||
* This event is fired when a player attempts to view a container during
|
||||
* player tick.
|
||||
*
|
||||
* setResult ALLOW to allow the container to stay open
|
||||
* setResult DENY to force close the container (denying access)
|
||||
*
|
||||
* DEFAULT is vanilla behaviour
|
||||
*
|
||||
*/
|
||||
|
||||
public PlayerOpenContainerEvent(EntityPlayer player, Container openContainer)
|
||||
{
|
||||
super(player);
|
||||
this.canInteractWith = openContainer.canInteractWith(player);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EnumStatus;
|
||||
|
||||
public class PlayerSleepInBedEvent extends PlayerEvent
|
||||
{
|
||||
public EnumStatus result = null;
|
||||
public final int x;
|
||||
public final int y;
|
||||
public final int z;
|
||||
|
||||
public PlayerSleepInBedEvent(EntityPlayer player, int x, int y, int z)
|
||||
{
|
||||
super(player);
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
import net.minecraftforge.event.Event;
|
||||
|
||||
@Cancelable
|
||||
@Event.HasResult
|
||||
public class UseHoeEvent extends PlayerEvent
|
||||
{
|
||||
/**
|
||||
* This event is fired when a player attempts to use a Hoe on a block, it
|
||||
* can be canceled to completely prevent any further processing.
|
||||
*
|
||||
* You can also set the result to ALLOW to mark the event as processed
|
||||
* and damage the hoe.
|
||||
*
|
||||
* setResult(ALLOW) is the same as the old setHandeled();
|
||||
*/
|
||||
|
||||
public final ItemStack current;
|
||||
public final World world;
|
||||
public final int x;
|
||||
public final int y;
|
||||
public final int z;
|
||||
|
||||
private boolean handeled = false;
|
||||
|
||||
public UseHoeEvent(EntityPlayer player, ItemStack current, World world, int x, int y, int z)
|
||||
{
|
||||
super(player);
|
||||
this.current = current;
|
||||
this.world = world;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user