Update to 1.14.2

This commit is contained in:
LexManos authored and cpw committed 2019-06-07 16:50:47 -04:00
1 parent d3e8804dbf
commit a7df63e1a1
1010 files changed
+15254 -19520

No files matched your search

@@ -19,12 +19,14 @@
package net.minecraftforge.event.entity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntitySize;
import net.minecraft.entity.Pose;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraftforge.eventbus.api.Event;
import net.minecraft.entity.Entity;
/**
* EntityEvent is fired when an event involving any Entity occurs.<br>
@@ -135,4 +137,37 @@ public class EntityEvent extends Event
public int getOldChunkZ() { return oldChunkZ; }
public void setOldChunkZ(int oldChunkZ) { this.oldChunkZ = oldChunkZ; }
}
/**
* EyeHeight is fired when an Entity's eye height changes. <br>
* This event is fired whenever the {@link Pose} changes, and in a few other hardcoded scenarios.<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 EyeHeight extends EntityEvent
{
private final Pose pose;
private final EntitySize size;
private final float oldHeight;
private float newHeight;
public EyeHeight(Entity entity, Pose pose, EntitySize size, float defaultHeight)
{
super(entity);
this.pose = pose;
this.size = size;
this.oldHeight = defaultHeight;
this.newHeight = defaultHeight;
}
public Pose getPose() { return pose; }
public EntitySize getSize() { return size; }
public float getOldHeight() { return oldHeight; }
public float getNewHeight() { return newHeight; }
public void setNewHeight(float newSize) { this.newHeight = newSize; }
}
}
@@ -19,7 +19,6 @@
package net.minecraftforge.event.entity;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraft.entity.Entity;
@@ -30,7 +29,7 @@ import java.util.Collection;
/**
* 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 WorldServer#loadEntities(Collection)} {@link World#joinEntityInSurroundings(Entity)}, and {@link World#spawnEntity(Entity)}. <br>
* {@link World#loadEntities(Collection)}, {@link net.minecraft.world.ServerWorld#loadEntities(Collection)} {@link World#joinEntityInSurroundings(Entity)}, and {@link World#spawnEntity(Entity)}. <br>
* <br>
* {@link #world} contains the world in which the entity is to join.<br>
* <br>
@@ -23,7 +23,7 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.ForgeEventFactory;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraft.entity.Entity;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.effect.LightningBoltEntity;
/**
* EntityStruckByLightningEvent is fired when an Entity is about to be struck by lightening.<br>
@@ -42,15 +42,15 @@ import net.minecraft.entity.effect.EntityLightningBolt;
@net.minecraftforge.eventbus.api.Cancelable
public class EntityStruckByLightningEvent extends EntityEvent
{
private final EntityLightningBolt lightning;
private final LightningBoltEntity lightning;
public EntityStruckByLightningEvent(Entity entity, EntityLightningBolt lightning)
public EntityStruckByLightningEvent(Entity entity, LightningBoltEntity lightning)
{
super(entity);
this.lightning = lightning;
}
public EntityLightningBolt getLightning()
public LightningBoltEntity getLightning()
{
return lightning;
}
@@ -19,8 +19,8 @@
package net.minecraftforge.event.entity;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Cancelable;
@@ -31,7 +31,7 @@ import net.minecraft.util.SoundEvent;
/**
* 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 EntityPlayerSP#playSound(SoundEvent, float, float)} and {@link World#playSound(EntityPlayer, double, double, double, SoundEvent, SoundCategory, float, float)}.<br>
* {@link ClientPlayerEntity#playSound(SoundEvent, float, float)} and {@link World#playSound(PlayerEntity, double, double, double, SoundEvent, SoundCategory, 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>
@@ -20,9 +20,9 @@
package net.minecraftforge.event.entity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.entity.projectile.EntityFireball;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.entity.projectile.AbstractArrowEntity;
import net.minecraft.entity.projectile.DamagingProjectileEntity;
import net.minecraft.entity.projectile.ThrowableEntity;
import net.minecraft.util.math.RayTraceResult;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.ForgeEventFactory;
@@ -57,15 +57,15 @@ public class ProjectileImpactEvent extends EntityEvent
@Cancelable
public static class Arrow extends ProjectileImpactEvent
{
private final EntityArrow arrow;
private final AbstractArrowEntity arrow;
public Arrow(EntityArrow arrow, RayTraceResult ray)
public Arrow(AbstractArrowEntity arrow, RayTraceResult ray)
{
super(arrow, ray);
this.arrow = arrow;
}
public EntityArrow getArrow()
public AbstractArrowEntity getArrow()
{
return arrow;
}
@@ -74,15 +74,15 @@ public class ProjectileImpactEvent extends EntityEvent
@Cancelable
public static class Fireball extends ProjectileImpactEvent
{
private final EntityFireball fireball;
private final DamagingProjectileEntity fireball;
public Fireball(EntityFireball fireball, RayTraceResult ray)
public Fireball(DamagingProjectileEntity fireball, RayTraceResult ray)
{
super(fireball, ray);
this.fireball = fireball;
}
public EntityFireball getFireball()
public DamagingProjectileEntity getFireball()
{
return fireball;
}
@@ -91,15 +91,15 @@ public class ProjectileImpactEvent extends EntityEvent
@Cancelable
public static class Throwable extends ProjectileImpactEvent
{
private final EntityThrowable throwable;
private final ThrowableEntity throwable;
public Throwable(EntityThrowable throwable, RayTraceResult ray)
public Throwable(ThrowableEntity throwable, RayTraceResult ray)
{
super(throwable, ray);
this.throwable = throwable;
}
public EntityThrowable getThrowable()
public ThrowableEntity getThrowable()
{
return throwable;
}
@@ -19,7 +19,7 @@
package net.minecraftforge.event.entity.item;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.item.ItemEntity;
import net.minecraftforge.event.entity.EntityEvent;
/**
@@ -30,14 +30,14 @@ import net.minecraftforge.event.entity.EntityEvent;
*/
public class ItemEvent extends EntityEvent
{
private final EntityItem entityItem;
private final ItemEntity entityItem;
/**
* Creates a new event for an EntityItem.
*
* @param itemEntity The EntityItem for this event
*/
public ItemEvent(EntityItem itemEntity)
public ItemEvent(ItemEntity itemEntity)
{
super(itemEntity);
this.entityItem = itemEntity;
@@ -46,7 +46,7 @@ public class ItemEvent extends EntityEvent
/**
* The relevant EntityItem for this event, already cast for you.
*/
public EntityItem getEntityItem()
public ItemEntity getEntityItem()
{
return entityItem;
}
@@ -20,7 +20,7 @@
package net.minecraftforge.event.entity.item;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.item.ItemEntity;
/**
* Event that is fired when an EntityItem's age has reached its maximum
@@ -40,7 +40,7 @@ public class ItemExpireEvent extends ItemEvent
* @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)
public ItemExpireEvent(ItemEntity entityItem, int extraLife)
{
super(entityItem);
this.setExtraLife(extraLife);
@@ -20,8 +20,8 @@
package net.minecraftforge.event.entity.item;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.player.PlayerEntity;
/**
* Event that is fired whenever a player tosses (Q) an item or drag-n-drops a
@@ -33,7 +33,7 @@ import net.minecraft.entity.player.EntityPlayer;
public class ItemTossEvent extends ItemEvent
{
private final EntityPlayer player;
private final PlayerEntity player;
/**
* Creates a new event for EntityItems tossed by a player.
@@ -41,7 +41,7 @@ public class ItemTossEvent extends ItemEvent
* @param entityItem The EntityItem being tossed.
* @param player The player tossing the item.
*/
public ItemTossEvent(EntityItem entityItem, EntityPlayer player)
public ItemTossEvent(ItemEntity entityItem, PlayerEntity player)
{
super(entityItem);
this.player = player;
@@ -50,7 +50,7 @@ public class ItemTossEvent extends ItemEvent
/**
* The player tossing the item.
*/
public EntityPlayer getPlayer()
public PlayerEntity getPlayer()
{
return player;
}
@@ -19,8 +19,8 @@
package net.minecraftforge.event.entity.living;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.ForgeEventFactory;
import net.minecraftforge.eventbus.api.Cancelable;
@@ -35,22 +35,22 @@ import net.minecraftforge.eventbus.api.Cancelable;
@net.minecraftforge.eventbus.api.Cancelable
public class AnimalTameEvent extends LivingEvent
{
private final EntityAnimal animal;
private final EntityPlayer tamer;
private final AnimalEntity animal;
private final PlayerEntity tamer;
public AnimalTameEvent(EntityAnimal animal, EntityPlayer tamer)
public AnimalTameEvent(AnimalEntity animal, PlayerEntity tamer)
{
super(animal);
this.animal = animal;
this.tamer = tamer;
}
public EntityAnimal getAnimal()
public AnimalEntity getAnimal()
{
return animal;
}
public EntityPlayer getTamer()
public PlayerEntity getTamer()
{
return tamer;
}
@@ -19,15 +19,12 @@
package net.minecraftforge.event.entity.living;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.ai.EntityAIMate;
import net.minecraft.entity.ai.EntityAIVillagerMate;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.AgeableEntity;
import net.minecraft.entity.MobEntity;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraftforge.eventbus.api.Event;
import javax.annotation.Nullable;
/**
@@ -52,22 +49,22 @@ import javax.annotation.Nullable;
@Cancelable
public class BabyEntitySpawnEvent extends net.minecraftforge.eventbus.api.Event
{
private final EntityLiving parentA;
private final EntityLiving parentB;
private final EntityPlayer causedByPlayer;
private EntityAgeable child;
private final MobEntity parentA;
private final MobEntity parentB;
private final PlayerEntity causedByPlayer;
private AgeableEntity child;
public BabyEntitySpawnEvent(EntityLiving parentA, EntityLiving parentB, @Nullable EntityAgeable proposedChild)
public BabyEntitySpawnEvent(MobEntity parentA, MobEntity parentB, @Nullable AgeableEntity proposedChild)
{
//causedByPlayer calculated here to simplify the patch.
EntityPlayer causedByPlayer = null;
if (parentA instanceof EntityAnimal) {
causedByPlayer = ((EntityAnimal)parentA).getLoveCause();
PlayerEntity causedByPlayer = null;
if (parentA instanceof AnimalEntity) {
causedByPlayer = ((AnimalEntity)parentA).getLoveCause();
}
if (causedByPlayer == null && parentB instanceof EntityAnimal)
if (causedByPlayer == null && parentB instanceof AnimalEntity)
{
causedByPlayer = ((EntityAnimal)parentB).getLoveCause();
causedByPlayer = ((AnimalEntity)parentB).getLoveCause();
}
this.parentA = parentA;
@@ -76,29 +73,29 @@ public class BabyEntitySpawnEvent extends net.minecraftforge.eventbus.api.Event
this.child = proposedChild;
}
public EntityLiving getParentA()
public MobEntity getParentA()
{
return parentA;
}
public EntityLiving getParentB()
public MobEntity getParentB()
{
return parentB;
}
@Nullable
public EntityPlayer getCausedByPlayer()
public PlayerEntity getCausedByPlayer()
{
return causedByPlayer;
}
@Nullable
public EntityAgeable getChild()
public AgeableEntity getChild()
{
return child;
}
public void setChild(EntityAgeable proposedChild)
public void setChild(AgeableEntity proposedChild)
{
child = proposedChild;
}
@@ -20,7 +20,7 @@
package net.minecraftforge.event.entity.living;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.LivingEntity;
/**
* Event for when an Enderman/Shulker teleports or an ender pearl is used. Can be used to either modify the target position, or cancel the teleport outright.
@@ -36,7 +36,7 @@ public class EnderTeleportEvent extends LivingEvent
private double targetZ;
private float attackDamage;
public EnderTeleportEvent(EntityLivingBase entity, double targetX, double targetY, double targetZ, float attackDamage)
public EnderTeleportEvent(LivingEntity entity, double targetX, double targetY, double targetZ, float attackDamage)
{
super(entity);
this.setTargetX(targetX);
@@ -19,12 +19,11 @@
package net.minecraftforge.event.entity.living;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraft.util.DamageSource;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.LivingEntity;
/**
* LivingAttackEvent is fired when a living Entity is attacked. <br>
@@ -44,12 +43,12 @@ import net.minecraft.entity.EntityLivingBase;
*<br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/
@net.minecraftforge.eventbus.api.Cancelable
@Cancelable
public class LivingAttackEvent extends LivingEvent
{
private final DamageSource source;
private final float amount;
public LivingAttackEvent(EntityLivingBase entity, DamageSource source, float amount)
public LivingAttackEvent(LivingEntity entity, DamageSource source, float amount)
{
super(entity);
this.source = source;
@@ -19,11 +19,10 @@
package net.minecraftforge.event.entity.living;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraft.util.DamageSource;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.LivingEntity;
/**
* LivingDamageEvent is fired just before damage is applied to entity.<br>
@@ -49,7 +48,7 @@ public class LivingDamageEvent extends LivingEvent
{
private final DamageSource source;
private float amount;
public LivingDamageEvent(EntityLivingBase entity, DamageSource source, float amount)
public LivingDamageEvent(LivingEntity entity, DamageSource source, float amount)
{
super(entity);
this.source = source;
@@ -19,17 +19,15 @@
package net.minecraftforge.event.entity.living;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraft.util.DamageSource;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.LivingEntity;
/**
* LivingDeathEvent is fired when an Entity dies. <br>
* This event is fired whenever an Entity dies in
* This event is fired whenever an Entity dies in
* {@link EntityLivingBase#onDeath(DamageSource)},
* {@link EntityPlayer#onDeath(DamageSource)}, and
* {@link EntityPlayerMP#onDeath(DamageSource)}. <br>
@@ -49,7 +47,7 @@ import net.minecraft.entity.EntityLivingBase;
public class LivingDeathEvent extends LivingEvent
{
private final DamageSource source;
public LivingDeathEvent(EntityLivingBase entity, DamageSource source)
public LivingDeathEvent(LivingEntity entity, DamageSource source)
{
super(entity);
this.source = source;
@@ -20,9 +20,9 @@
package net.minecraftforge.event.entity.living;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Cancelable;
@@ -41,16 +41,16 @@ import net.minecraftforge.eventbus.api.Cancelable;
public class LivingDestroyBlockEvent extends LivingEvent
{
private final BlockPos pos;
private final IBlockState state;
private final BlockState state;
public LivingDestroyBlockEvent(EntityLivingBase entity, BlockPos pos, IBlockState state)
public LivingDestroyBlockEvent(LivingEntity entity, BlockPos pos, BlockState state)
{
super(entity);
this.pos = pos;
this.state = state;
}
public IBlockState getState()
public BlockState getState()
{
return state;
}
@@ -26,8 +26,8 @@ import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraft.util.DamageSource;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.LivingEntity;
/**
* LivingDropsEvent is fired when an Entity's death causes dropped items to appear.<br>
@@ -52,11 +52,11 @@ import net.minecraft.entity.EntityLivingBase;
public class LivingDropsEvent extends LivingEvent
{
private final DamageSource source;
private final Collection<EntityItem> drops;
private final Collection<ItemEntity> drops;
private final int lootingLevel;
private final boolean recentlyHit;
public LivingDropsEvent(EntityLivingBase entity, DamageSource source, Collection<EntityItem> drops, int lootingLevel, boolean recentlyHit)
public LivingDropsEvent(LivingEntity entity, DamageSource source, Collection<ItemEntity> drops, int lootingLevel, boolean recentlyHit)
{
super(entity);
this.source = source;
@@ -70,7 +70,7 @@ public class LivingDropsEvent extends LivingEvent
return source;
}
public Collection<EntityItem> getDrops()
public Collection<ItemEntity> getDrops()
{
return drops;
}
@@ -19,7 +19,7 @@
package net.minecraftforge.event.entity.living;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack;
import net.minecraftforge.eventbus.api.Cancelable;
@@ -30,7 +30,7 @@ public class LivingEntityUseItemEvent extends LivingEvent
private final ItemStack item;
private int duration;
private LivingEntityUseItemEvent(EntityLivingBase entity, @Nonnull ItemStack item, int duration)
private LivingEntityUseItemEvent(LivingEntity entity, @Nonnull ItemStack item, int duration)
{
super(entity);
this.item = item;
@@ -67,7 +67,7 @@ public class LivingEntityUseItemEvent extends LivingEvent
@Cancelable
public static class Start extends LivingEntityUseItemEvent
{
public Start(EntityLivingBase entity, @Nonnull ItemStack item, int duration)
public Start(LivingEntity entity, @Nonnull ItemStack item, int duration)
{
super(entity, item, duration);
}
@@ -82,7 +82,7 @@ public class LivingEntityUseItemEvent extends LivingEvent
@Cancelable
public static class Tick extends LivingEntityUseItemEvent
{
public Tick(EntityLivingBase entity, @Nonnull ItemStack item, int duration)
public Tick(LivingEntity entity, @Nonnull ItemStack item, int duration)
{
super(entity, item, duration);
}
@@ -103,7 +103,7 @@ public class LivingEntityUseItemEvent extends LivingEvent
@Cancelable
public static class Stop extends LivingEntityUseItemEvent
{
public Stop(EntityLivingBase entity, @Nonnull ItemStack item, int duration)
public Stop(LivingEntity entity, @Nonnull ItemStack item, int duration)
{
super(entity, item, duration);
}
@@ -124,7 +124,7 @@ public class LivingEntityUseItemEvent extends LivingEvent
public static class Finish extends LivingEntityUseItemEvent
{
private ItemStack result;
public Finish(EntityLivingBase entity, @Nonnull ItemStack item, int duration, @Nonnull ItemStack result)
public Finish(LivingEntity entity, @Nonnull ItemStack item, int duration, @Nonnull ItemStack result)
{
super(entity, item, duration);
this.setResultStack(result);
@@ -19,8 +19,8 @@
package net.minecraftforge.event.entity.living;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.entity.LivingEntity;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Cancelable;
@@ -45,11 +45,11 @@ import javax.annotation.Nonnull;
**/
public class LivingEquipmentChangeEvent extends LivingEvent
{
private final EntityEquipmentSlot slot;
private final EquipmentSlotType slot;
private final ItemStack from;
private final ItemStack to;
public LivingEquipmentChangeEvent(EntityLivingBase entity, EntityEquipmentSlot slot, @Nonnull ItemStack from, @Nonnull ItemStack to)
public LivingEquipmentChangeEvent(LivingEntity entity, EquipmentSlotType slot, @Nonnull ItemStack from, @Nonnull ItemStack to)
{
super(entity);
this.slot = slot;
@@ -57,7 +57,7 @@ public class LivingEquipmentChangeEvent extends LivingEvent
this.to = to;
}
public EntityEquipmentSlot getSlot() { return this.slot; }
public EquipmentSlotType getSlot() { return this.slot; }
@Nonnull
public ItemStack getFrom() { return this.from; }
@Nonnull
@@ -20,10 +20,7 @@
package net.minecraftforge.event.entity.living;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraftforge.eventbus.api.Event;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityMagmaCube;
import net.minecraft.entity.passive.EntityHorse;
import net.minecraft.entity.LivingEntity;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.EntityEvent;
@@ -37,21 +34,21 @@ import net.minecraftforge.event.entity.EntityEvent;
**/
public class LivingEvent extends EntityEvent
{
private final EntityLivingBase entityLiving;
public LivingEvent(EntityLivingBase entity)
private final LivingEntity entityLiving;
public LivingEvent(LivingEntity entity)
{
super(entity);
entityLiving = entity;
}
public EntityLivingBase getEntityLiving()
public LivingEntity getEntityLiving()
{
return entityLiving;
}
/**
* LivingUpdateEvent is fired when an Entity is updated. <br>
* This event is fired whenever an Entity is updated in
* This event is fired whenever an Entity is updated in
* {@link EntityLivingBase#onUpdate()}. <br>
* <br>
* This event is fired via the {@link ForgeHooks#onLivingUpdate(EntityLivingBase)}.<br>
@@ -66,12 +63,12 @@ public class LivingEvent extends EntityEvent
@Cancelable
public static class LivingUpdateEvent extends LivingEvent
{
public LivingUpdateEvent(EntityLivingBase e){ super(e); }
public LivingUpdateEvent(LivingEntity e){ super(e); }
}
/**
* LivingJumpEvent is fired when an Entity jumps.<br>
* This event is fired whenever an Entity jumps in
* This event is fired whenever an Entity jumps in
* {@link EntityLivingBase#jump()}, {@link EntityMagmaCube#jump()},
* and {@link EntityHorse#jump()}.<br>
* <br>
@@ -85,6 +82,6 @@ public class LivingEvent extends EntityEvent
**/
public static class LivingJumpEvent extends LivingEvent
{
public LivingJumpEvent(EntityLivingBase e){ super(e); }
public LivingJumpEvent(LivingEntity e){ super(e); }
}
}
@@ -19,8 +19,8 @@
package net.minecraftforge.event.entity.living;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraftforge.eventbus.api.Cancelable;
/**
@@ -31,12 +31,12 @@ import net.minecraftforge.eventbus.api.Cancelable;
@net.minecraftforge.eventbus.api.Cancelable
public class LivingExperienceDropEvent extends LivingEvent
{
private final EntityPlayer attackingPlayer;
private final PlayerEntity attackingPlayer;
private final int originalExperiencePoints;
private int droppedExperiencePoints;
public LivingExperienceDropEvent(EntityLivingBase entity, EntityPlayer attackingPlayer, int originalExperience)
public LivingExperienceDropEvent(LivingEntity entity, PlayerEntity attackingPlayer, int originalExperience)
{
super(entity);
@@ -54,7 +54,7 @@ public class LivingExperienceDropEvent extends LivingEvent
this.droppedExperiencePoints = droppedExperience;
}
public EntityPlayer getAttackingPlayer()
public PlayerEntity getAttackingPlayer()
{
return attackingPlayer;
}
@@ -22,7 +22,7 @@ package net.minecraftforge.event.entity.living;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.LivingEntity;
/**
* LivingFallEvent is fired when an Entity is set to be falling.<br>
@@ -45,7 +45,7 @@ public class LivingFallEvent extends LivingEvent
{
private float distance;
private float damageMultiplier;
public LivingFallEvent(EntityLivingBase entity, float distance, float damageMultiplier)
public LivingFallEvent(LivingEntity entity, float distance, float damageMultiplier)
{
super(entity);
this.setDistance(distance);
@@ -22,7 +22,7 @@ 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.entity.EntityLivingBase;
import net.minecraft.entity.LivingEntity;
/**
* LivingHealEvent is fired when an Entity is set to be healed. <br>
@@ -43,7 +43,7 @@ import net.minecraft.entity.EntityLivingBase;
public class LivingHealEvent extends LivingEvent
{
private float amount;
public LivingHealEvent(EntityLivingBase entity, float amount)
public LivingHealEvent(LivingEntity entity, float amount)
{
super(entity);
this.setAmount(amount);
@@ -19,16 +19,15 @@
package net.minecraftforge.event.entity.living;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraft.util.DamageSource;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.LivingEntity;
/**
* LivingHurtEvent is fired when an Entity is set to be hurt. <br>
* This event is fired whenever an Entity is hurt in
* This event is fired whenever an Entity is hurt in
* {@link EntityLivingBase#damageEntity(DamageSource, float)} and
* {@link EntityPlayer#damageEntity(DamageSource, float)}.<br>
* <br>
@@ -50,7 +49,7 @@ public class LivingHurtEvent extends LivingEvent
{
private final DamageSource source;
private float amount;
public LivingHurtEvent(EntityLivingBase entity, DamageSource source, float amount)
public LivingHurtEvent(LivingEntity entity, DamageSource source, float amount)
{
super(entity);
this.source = source;
@@ -20,9 +20,7 @@
package net.minecraftforge.event.entity.living;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.DamageSource;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
@@ -31,9 +29,9 @@ 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 EntityLivingBase#attackEntityFrom(DamageSource, float)},
* {@link EntityLivingBase#blockWithShield(EntityLivingBase)},
* {@link EntityMob#attackEntityAsMob(Entity)} and
* {@link EntityPlayer#attackTargetEntityWithCurrentItem(Entity)} <br>
* <br>
* This event is fired via {@link ForgeHooks#onLivingKnockBack(EntityLivingBase, Entity, float, double, double)}.<br>
@@ -60,7 +58,7 @@ public class LivingKnockBackEvent extends LivingEvent
protected final float originalStrength;
protected final double originalRatioX, originalRatioZ;
public LivingKnockBackEvent(EntityLivingBase target, Entity attacker, float strength, double ratioX, double ratioZ)
public LivingKnockBackEvent(LivingEntity target, Entity attacker, float strength, double ratioX, double ratioZ)
{
super(target);
this.attacker = this.originalAttacker = attacker;
@@ -20,14 +20,14 @@
package net.minecraftforge.event.entity.living;
import net.minecraftforge.eventbus.api.Event.HasResult;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.MobEntity;
@HasResult
public class LivingPackSizeEvent extends LivingEvent
{
private int maxPackSize;
public LivingPackSizeEvent(EntityLiving entity)
public LivingPackSizeEvent(MobEntity entity)
{
super(entity);
}
@@ -19,11 +19,9 @@
package net.minecraftforge.event.entity.living;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.LivingEntity;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Cancelable;
/**
* LivingSetAttackTargetEvent is fired when an Entity sets a target to attack.<br>
@@ -44,14 +42,14 @@ import net.minecraftforge.eventbus.api.Cancelable;
public class LivingSetAttackTargetEvent extends LivingEvent
{
private final EntityLivingBase target;
public LivingSetAttackTargetEvent(EntityLivingBase entity, EntityLivingBase target)
private final LivingEntity target;
public LivingSetAttackTargetEvent(LivingEntity entity, LivingEntity target)
{
super(entity);
this.target = target;
}
public EntityLivingBase getTarget()
public LivingEntity getTarget()
{
return target;
}
@@ -20,11 +20,11 @@
package net.minecraftforge.event.entity.living;
import javax.annotation.Nullable;
import net.minecraft.tileentity.MobSpawnerBaseLogic;
import net.minecraft.world.spawner.AbstractSpawner;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.ForgeEventFactory;
import net.minecraftforge.eventbus.api.Event;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.MobEntity;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
@@ -49,7 +49,7 @@ public class LivingSpawnEvent extends LivingEvent
private final double y;
private final double z;
public LivingSpawnEvent(EntityLiving entity, IWorld world, double x, double y, double z)
public LivingSpawnEvent(MobEntity entity, IWorld world, double x, double y, double z)
{
super(entity);
this.world = world;
@@ -75,7 +75,7 @@ public class LivingSpawnEvent extends LivingEvent
public static class CheckSpawn extends LivingSpawnEvent
{
@Nullable
private final MobSpawnerBaseLogic spawner;
private final AbstractSpawner spawner;
/**
* CheckSpawn is fired when an Entity is about to be spawned.
@@ -87,7 +87,7 @@ public class LivingSpawnEvent extends LivingEvent
* @param spawner position of the MobSpawner
* null if it this spawn is coming from a WorldSpawner
*/
public CheckSpawn(EntityLiving entity, IWorld world, double x, double y, double z, @Nullable MobSpawnerBaseLogic spawner)
public CheckSpawn(MobEntity entity, IWorld world, double x, double y, double z, @Nullable AbstractSpawner spawner)
{
super(entity, world, x, y, z);
this.spawner = spawner;
@@ -99,7 +99,7 @@ public class LivingSpawnEvent extends LivingEvent
}
@Nullable
public MobSpawnerBaseLogic getSpawner()
public AbstractSpawner getSpawner()
{
return spawner;
}
@@ -122,19 +122,19 @@ public class LivingSpawnEvent extends LivingEvent
public static class SpecialSpawn extends LivingSpawnEvent
{
@Nullable
private final MobSpawnerBaseLogic spawner;
private final AbstractSpawner spawner;
/**
* @param spawner the position of a tileentity or approximate position of an entity that initiated the spawn if any
*/
public SpecialSpawn(EntityLiving entity, World world, double x, double y, double z, @Nullable MobSpawnerBaseLogic spawner)
public SpecialSpawn(MobEntity entity, World world, double x, double y, double z, @Nullable AbstractSpawner spawner)
{
super(entity, world, x, y, z);
this.spawner = spawner;
}
@Nullable
public MobSpawnerBaseLogic getSpawner()
public AbstractSpawner getSpawner()
{
return spawner;
}
@@ -156,7 +156,7 @@ public class LivingSpawnEvent extends LivingEvent
@HasResult
public static class AllowDespawn extends LivingSpawnEvent
{
public AllowDespawn(EntityLiving entity)
public AllowDespawn(MobEntity entity)
{
super(entity, entity.world, entity.posX, entity.posY, entity.posZ);
}
@@ -19,7 +19,7 @@
package net.minecraftforge.event.entity.living;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.DamageSource;
public class LootingLevelEvent extends LivingEvent {
@@ -28,7 +28,7 @@ public class LootingLevelEvent extends LivingEvent {
private int lootingLevel;
public LootingLevelEvent(EntityLivingBase entity, DamageSource damageSource, int lootingLevel) {
public LootingLevelEvent(LivingEntity entity, DamageSource damageSource, int lootingLevel) {
super(entity);
this.damageSource = damageSource;
this.lootingLevel = lootingLevel;
@@ -21,8 +21,8 @@ package net.minecraftforge.event.entity.living;
import java.util.Collection;
import java.util.Collections;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.potion.PotionEffect;
import net.minecraft.entity.LivingEntity;
import net.minecraft.potion.EffectInstance;
/**
* Fires after Potion Color Calculation.
@@ -35,10 +35,10 @@ public class PotionColorCalculationEvent extends LivingEvent
{
private int color;
private boolean hideParticle;
private final Collection<PotionEffect> effectList;
private final Collection<EffectInstance> effectList;
public PotionColorCalculationEvent(EntityLivingBase entity, int color, boolean hideParticle,
Collection<PotionEffect> effectList)
public PotionColorCalculationEvent(LivingEntity entity, int color, boolean hideParticle,
Collection<EffectInstance> effectList)
{
super(entity);
this.color = color;
@@ -71,7 +71,7 @@ public class PotionColorCalculationEvent extends LivingEvent
*
* @return effects
*/
public Collection<PotionEffect> getEffects()
public Collection<EffectInstance> getEffects()
{
return Collections.unmodifiableCollection(effectList);
}
@@ -22,21 +22,23 @@ package net.minecraftforge.event.entity.living;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.entity.LivingEntity;
import net.minecraft.potion.Effect;
import net.minecraft.potion.EffectInstance;
import net.minecraftforge.common.MinecraftForge;
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>
*/
public class PotionEvent extends LivingEvent
{
@Nullable
protected final PotionEffect effect;
protected final EffectInstance effect;
public PotionEvent(EntityLivingBase living, PotionEffect effect)
public PotionEvent(LivingEntity living, EffectInstance effect)
{
super(living);
this.effect = effect;
@@ -45,7 +47,7 @@ public class PotionEvent extends LivingEvent
* Retuns the PotionEffect.
*/
@Nullable
public PotionEffect getPotionEffect()
public EffectInstance getPotionEffect()
{
return effect;
}
@@ -58,15 +60,15 @@ public class PotionEvent extends LivingEvent
@Cancelable
public static class PotionRemoveEvent extends PotionEvent
{
private final Potion potion;
private final Effect potion;
public PotionRemoveEvent(EntityLivingBase living, Potion potion)
public PotionRemoveEvent(LivingEntity living, Effect potion)
{
super(living, living.getActivePotionEffect(potion));
this.potion = potion;
}
public PotionRemoveEvent(EntityLivingBase living, PotionEffect effect)
public PotionRemoveEvent(LivingEntity living, EffectInstance effect)
{
super(living, effect);
this.potion = effect.getPotion();
@@ -75,7 +77,7 @@ public class PotionEvent extends LivingEvent
/**
* @return the Potion which is tried to remove from the Entity.
*/
public Potion getPotion()
public Effect getPotion()
{
return this.potion;
}
@@ -85,7 +87,7 @@ public class PotionEvent extends LivingEvent
*/
@Override
@Nullable
public PotionEffect getPotionEffect()
public EffectInstance getPotionEffect()
{
return super.getPotionEffect();
}
@@ -102,7 +104,7 @@ public class PotionEvent extends LivingEvent
@HasResult
public static class PotionApplicableEvent extends PotionEvent
{
public PotionApplicableEvent(EntityLivingBase living, PotionEffect effect)
public PotionApplicableEvent(LivingEntity living, EffectInstance effect)
{
super(living, effect);
}
@@ -112,7 +114,7 @@ public class PotionEvent extends LivingEvent
*/
@Override
@Nonnull
public PotionEffect getPotionEffect()
public EffectInstance getPotionEffect()
{
return super.getPotionEffect();
}
@@ -125,9 +127,9 @@ public class PotionEvent extends LivingEvent
*/
public static class PotionAddedEvent extends PotionEvent
{
private final PotionEffect oldEffect;
private final EffectInstance oldEffect;
public PotionAddedEvent(EntityLivingBase living, PotionEffect oldEffect, PotionEffect newEffect)
public PotionAddedEvent(LivingEntity living, EffectInstance oldEffect, EffectInstance newEffect)
{
super(living, newEffect);
this.oldEffect = oldEffect;
@@ -138,7 +140,7 @@ public class PotionEvent extends LivingEvent
*/
@Override
@Nonnull
public PotionEffect getPotionEffect()
public EffectInstance getPotionEffect()
{
return super.getPotionEffect();
}
@@ -147,7 +149,7 @@ public class PotionEvent extends LivingEvent
* @return the old PotionEffect. THis can be null if the entity did not have an effect of this kind before.
*/
@Nullable
public PotionEffect getOldPotionEffect()
public EffectInstance getOldPotionEffect()
{
return oldEffect;
}
@@ -160,7 +162,7 @@ public class PotionEvent extends LivingEvent
*/
public static class PotionExpiryEvent extends PotionEvent
{
public PotionExpiryEvent(EntityLivingBase living, PotionEffect effect)
public PotionExpiryEvent(LivingEntity living, EffectInstance effect)
{
super(living, effect);
}
@@ -19,8 +19,8 @@
package net.minecraftforge.event.entity.living;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.monster.ZombieEntity;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
@@ -40,14 +40,14 @@ import net.minecraftforge.eventbus.api.Event.HasResult;
**/
public class ZombieEvent extends EntityEvent {
public ZombieEvent(EntityZombie entity)
public ZombieEvent(ZombieEntity entity)
{
super(entity);
}
public EntityZombie getSummoner()
public ZombieEntity getSummoner()
{
return (EntityZombie) getEntity();
return (ZombieEntity) getEntity();
}
/**
@@ -75,16 +75,16 @@ public class ZombieEvent extends EntityEvent {
**/
@HasResult
public static class SummonAidEvent extends ZombieEvent {
private EntityZombie customSummonedAid;
private ZombieEntity customSummonedAid;
private final World world;
private final int x;
private final int y;
private final int z;
private final EntityLivingBase attacker;
private final LivingEntity attacker;
private final double summonChance;
public SummonAidEvent(EntityZombie entity, World world, int x, int y, int z, EntityLivingBase attacker, double summonChance)
public SummonAidEvent(ZombieEntity entity, World world, int x, int y, int z, LivingEntity attacker, double summonChance)
{
super(entity);
this.world = world;
@@ -98,13 +98,13 @@ public class ZombieEvent extends EntityEvent {
/**
* Populate this field to have a custom zombie instead of a normal zombie summoned
*/
public EntityZombie getCustomSummonedAid() { return customSummonedAid; }
public void setCustomSummonedAid(EntityZombie customSummonedAid) { this.customSummonedAid = customSummonedAid; }
public ZombieEntity getCustomSummonedAid() { return customSummonedAid; }
public void setCustomSummonedAid(ZombieEntity customSummonedAid) { this.customSummonedAid = customSummonedAid; }
public World getWorld() { return world; }
public int getX() { return x; }
public int getY() { return y; }
public int getZ() { return z; }
public EntityLivingBase getAttacker() { return attacker; }
public LivingEntity getAttacker() { return attacker; }
public double getSummonChance() { return summonChance; }
}
}
@@ -20,7 +20,7 @@
package net.minecraftforge.event.entity.player;
import net.minecraft.advancements.Advancement;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Cancelable;
@@ -37,7 +37,7 @@ public class AdvancementEvent extends PlayerEvent
{
private final Advancement advancement;
public AdvancementEvent(EntityPlayer player, Advancement advancement)
public AdvancementEvent(PlayerEntity player, Advancement advancement)
{
super(player);
this.advancement = advancement;
@@ -19,7 +19,7 @@
package net.minecraftforge.event.entity.player;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
@@ -41,7 +41,7 @@ public class AnvilRepairEvent extends PlayerEvent
private final ItemStack output; // Set this to set the output stack
private float breakChance; // Anvil's chance to break (reduced by 1 durability) when this is complete. Default is 12% (0.12f)
public AnvilRepairEvent(EntityPlayer player, @Nonnull ItemStack left, @Nonnull ItemStack right, @Nonnull ItemStack output)
public AnvilRepairEvent(PlayerEntity player, @Nonnull ItemStack left, @Nonnull ItemStack right, @Nonnull ItemStack output)
{
super(player);
this.output = output;
@@ -19,11 +19,9 @@
package net.minecraftforge.event.entity.player;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemBow;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
@@ -44,7 +42,7 @@ import javax.annotation.Nonnull;
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/
@net.minecraftforge.eventbus.api.Cancelable
@Cancelable
public class ArrowLooseEvent extends PlayerEvent
{
private final ItemStack bow;
@@ -52,7 +50,7 @@ public class ArrowLooseEvent extends PlayerEvent
private final boolean hasAmmo;
private int charge;
public ArrowLooseEvent(EntityPlayer player, @Nonnull ItemStack bow, World world, int charge, boolean hasAmmo)
public ArrowLooseEvent(PlayerEntity player, @Nonnull ItemStack bow, World world, int charge, boolean hasAmmo)
{
super(player);
this.bow = bow;
@@ -19,11 +19,10 @@
package net.minecraftforge.event.entity.player;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBow;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.Hand;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
@@ -39,12 +38,12 @@ import javax.annotation.Nonnull;
public class ArrowNockEvent extends PlayerEvent
{
private final ItemStack bow;
private final EnumHand hand;
private final Hand hand;
private final World world;
private final boolean hasAmmo;
private ActionResult<ItemStack> action;
public ArrowNockEvent(EntityPlayer player, @Nonnull ItemStack item, EnumHand hand, World world, boolean hasAmmo)
public ArrowNockEvent(PlayerEntity player, @Nonnull ItemStack item, Hand hand, World world, boolean hasAmmo)
{
super(player);
this.bow = item;
@@ -56,7 +55,7 @@ public class ArrowNockEvent extends PlayerEvent
@Nonnull
public ItemStack getBow() { return this.bow; }
public World getWorld() { return this.world; }
public EnumHand getHand() { return this.hand; }
public Hand getHand() { return this.hand; }
public boolean hasAmmo() { return this.hasAmmo; }
public ActionResult<ItemStack> getAction()
{
@@ -22,7 +22,7 @@ package net.minecraftforge.event.entity.player;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
/**
* AttackEntityEvent is fired when a player attacks an Entity.<br>
@@ -42,7 +42,7 @@ import net.minecraft.entity.player.EntityPlayer;
public class AttackEntityEvent extends PlayerEvent
{
private final Entity target;
public AttackEntityEvent(EntityPlayer player, Entity target)
public AttackEntityEvent(PlayerEntity player, Entity target)
{
super(player);
this.target = target;
@@ -20,8 +20,8 @@
package net.minecraftforge.event.entity.player;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -44,10 +44,10 @@ public class BonemealEvent extends PlayerEvent
private final World world;
private final BlockPos pos;
private final IBlockState block;
private final BlockState block;
private final ItemStack stack;
public BonemealEvent(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState block, @Nonnull ItemStack stack)
public BonemealEvent(@Nonnull PlayerEntity player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull BlockState block, @Nonnull ItemStack stack)
{
super(player);
this.world = world;
@@ -66,7 +66,7 @@ public class BonemealEvent extends PlayerEvent
return pos;
}
public IBlockState getBlock()
public BlockState getBlock()
{
return block;
}
@@ -23,7 +23,7 @@ import net.minecraftforge.eventbus.api.Event.HasResult;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraftforge.common.MinecraftForge;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
/**
* This event is fired whenever a player attacks an Entity in
@@ -46,7 +46,7 @@ public class CriticalHitEvent extends PlayerEvent
private final Entity target;
private final boolean vanillaCritical;
public CriticalHitEvent(EntityPlayer player, Entity target, float damageModifier, boolean vanillaCritical)
public CriticalHitEvent(PlayerEntity player, Entity target, float damageModifier, boolean vanillaCritical)
{
super(player);
this.target = target;
@@ -21,8 +21,8 @@ package net.minecraftforge.event.entity.player;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraftforge.eventbus.api.Event;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.player.PlayerEntity;
/**
* This event is called when a player collides with a EntityItem on the ground.
@@ -38,15 +38,15 @@ import net.minecraft.entity.player.EntityPlayer;
@Event.HasResult
public class EntityItemPickupEvent extends PlayerEvent
{
private final EntityItem item;
private final ItemEntity item;
public EntityItemPickupEvent(EntityPlayer player, EntityItem item)
public EntityItemPickupEvent(PlayerEntity player, ItemEntity item)
{
super(player);
this.item = item;
}
public EntityItem getItem()
public ItemEntity getItem()
{
return item;
}
@@ -21,7 +21,7 @@ package net.minecraftforge.event.entity.player;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraftforge.eventbus.api.Event;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
@@ -50,7 +50,7 @@ public class FillBucketEvent extends PlayerEvent
private ItemStack result;
public FillBucketEvent(EntityPlayer player, @Nonnull ItemStack current, World world, @Nullable RayTraceResult target)
public FillBucketEvent(PlayerEntity player, @Nonnull ItemStack current, World world, @Nullable RayTraceResult target)
{
super(player);
this.current = current;
@@ -20,7 +20,7 @@
package net.minecraftforge.event.entity.player;
import com.google.common.base.Preconditions;
import net.minecraft.entity.projectile.EntityFishHook;
import net.minecraft.entity.projectile.FishingBobberEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraftforge.eventbus.api.Cancelable;
@@ -39,10 +39,10 @@ import java.util.List;
public class ItemFishedEvent extends PlayerEvent
{
private final NonNullList<ItemStack> stacks = NonNullList.create();
private final EntityFishHook hook;
private final FishingBobberEntity hook;
private int rodDamage;
public ItemFishedEvent(List<ItemStack> stacks, int rodDamage, EntityFishHook hook)
public ItemFishedEvent(List<ItemStack> stacks, int rodDamage, FishingBobberEntity hook)
{
super(hook.getAngler());
this.stacks.addAll(stacks);
@@ -83,7 +83,7 @@ public class ItemFishedEvent extends PlayerEvent
/**
* Use this to stuff related to the hook itself, like the position of the bobber.
*/
public EntityFishHook getHookEntity()
public FishingBobberEntity getHookEntity()
{
return hook;
}
@@ -23,7 +23,7 @@ import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
@@ -41,7 +41,7 @@ public class ItemTooltipEvent extends PlayerEvent
* 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()}.
*/
public ItemTooltipEvent(@Nonnull ItemStack itemStack, @Nullable EntityPlayer entityPlayer, List<ITextComponent> list, ITooltipFlag flags)
public ItemTooltipEvent(@Nonnull ItemStack itemStack, @Nullable PlayerEntity entityPlayer, List<ITextComponent> list, ITooltipFlag flags)
{
super(entityPlayer);
this.itemStack = itemStack;
@@ -79,7 +79,7 @@ public class ItemTooltipEvent extends PlayerEvent
*/
@Override
@Nullable
public EntityPlayer getEntityPlayer()
public PlayerEntity getEntityPlayer()
{
return super.getEntityPlayer();
}
@@ -19,13 +19,13 @@
package net.minecraftforge.event.entity.player;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.container.Container;
public class PlayerContainerEvent extends PlayerEvent
{
private final Container container;
public PlayerContainerEvent(EntityPlayer player, Container container)
public PlayerContainerEvent(PlayerEntity player, Container container)
{
super(player);
this.container = container;
@@ -33,14 +33,14 @@ public class PlayerContainerEvent extends PlayerEvent
public static class Open extends PlayerContainerEvent
{
public Open(EntityPlayer player, Container container)
public Open(PlayerEntity player, Container container)
{
super(player, container);
}
}
public static class Close extends PlayerContainerEvent
{
public Close(EntityPlayer player, Container container)
public Close(PlayerEntity player, Container container)
{
super(player, container);
}
@@ -19,12 +19,11 @@
package net.minecraftforge.event.entity.player;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.multiplayer.PlayerControllerMP;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.client.multiplayer.PlayerController;
import net.minecraft.entity.Entity;
import net.minecraft.server.management.PlayerInteractionManager;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
@@ -32,9 +31,10 @@ import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.ForgeEventFactory;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
import net.minecraft.util.Hand;
import net.minecraft.util.Direction;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -42,15 +42,15 @@ 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 PlayerControllerMP#onPlayerDestroyBlock(BlockPos)},
* {@link PlayerControllerMP#processRightClick(EntityPlayer, World, EnumHand)},
* {@link PlayerControllerMP#processRightClickBlock(EntityPlayerSP, WorldClient, BlockPos, EnumFacing, Vec3d, EnumHand)},
* {@link EntityPlayer#attackTargetEntityWithCurrentItem(Entity)},
* {@link EntityPlayer#damageShield(float)},
* {@link EntityPlayer#interactOn(Entity, EnumHand)},
* {@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 ForgeHooks#getContainerItem(ItemStack)},
* {@link PlayerInteractionManager#processRightClick(EntityPlayer, World, ItemStack, EnumHand)},
* {@link PlayerInteractionManager#processRightClickBlock(EntityPlayer, World, ItemStack, EnumHand, BlockPos, EnumFacing, float, float, float)}
* {@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>
* <br>
* {@link #original} contains the original ItemStack before the item was destroyed. <br>
@@ -60,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(EntityPlayer, ItemStack, EnumHand)}.<br>
* This event is fired from {@link ForgeEventFactory#onPlayerDestroyItem(PlayerEntity, ItemStack, Hand)}.<br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/
public class PlayerDestroyItemEvent extends PlayerEvent
@@ -68,8 +68,8 @@ public class PlayerDestroyItemEvent extends PlayerEvent
@Nonnull
private final ItemStack original;
@Nullable
private final EnumHand hand; // May be null if this player destroys the item by any use besides holding it.
public PlayerDestroyItemEvent(EntityPlayer player, @Nonnull ItemStack original, @Nullable EnumHand hand)
private final Hand hand; // May be null if this player destroys the item by any use besides holding it.
public PlayerDestroyItemEvent(PlayerEntity player, @Nonnull ItemStack original, @Nullable Hand hand)
{
super(player);
this.original = original;
@@ -79,6 +79,6 @@ public class PlayerDestroyItemEvent extends PlayerEvent
@Nonnull
public ItemStack getOriginal() { return this.original; }
@Nullable
public EnumHand getHand() { return this.hand; }
public Hand getHand() { return this.hand; }
}
@@ -1,60 +0,0 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2019.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.event.entity.player;
import java.util.Collection;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.DamageSource;
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
{
private 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, Collection<EntityItem> drops, boolean recentlyHit)
{
super(entity, source, drops, ForgeHooks.getLootingLevel(entity, source.getTrueSource(), source), recentlyHit);
this.entityPlayer = entity;
}
public EntityPlayer getEntityPlayer()
{
return entityPlayer;
}
}
@@ -24,9 +24,9 @@ import java.io.File;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.ForgeEventFactory;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.event.entity.living.LivingEvent;
import net.minecraftforge.eventbus.api.Event;
@@ -40,14 +40,14 @@ import net.minecraftforge.eventbus.api.Event;
**/
public class PlayerEvent extends LivingEvent
{
private final EntityPlayer entityPlayer;
public PlayerEvent(EntityPlayer player)
private final PlayerEntity entityPlayer;
public PlayerEvent(PlayerEntity player)
{
super(player);
entityPlayer = player;
}
public EntityPlayer getEntityPlayer()
public PlayerEntity getEntityPlayer()
{
return entityPlayer;
}
@@ -70,17 +70,17 @@ public class PlayerEvent extends LivingEvent
**/
public static class HarvestCheck extends PlayerEvent
{
private final IBlockState state;
private final BlockState state;
private boolean success;
public HarvestCheck(EntityPlayer player, IBlockState state, boolean success)
public HarvestCheck(PlayerEntity player, BlockState state, boolean success)
{
super(player);
this.state = state;
this.success = success;
}
public IBlockState getTargetBlock() { return this.state; }
public BlockState getTargetBlock() { return this.state; }
public boolean canHarvest() { return this.success; }
public void setCanHarvest(boolean success){ this.success = success; }
}
@@ -107,12 +107,12 @@ public class PlayerEvent extends LivingEvent
@Cancelable
public static class BreakSpeed extends PlayerEvent
{
private final IBlockState state;
private final BlockState state;
private final float originalSpeed;
private float newSpeed = 0.0f;
private final BlockPos pos; // Y position of -1 notes unknown location
public BreakSpeed(EntityPlayer player, IBlockState state, float original, BlockPos pos)
public BreakSpeed(PlayerEntity player, BlockState state, float original, BlockPos pos)
{
super(player);
this.state = state;
@@ -121,7 +121,7 @@ public class PlayerEvent extends LivingEvent
this.pos = pos;
}
public IBlockState getState() { return state; }
public BlockState getState() { return state; }
public float getOriginalSpeed() { return originalSpeed; }
public float getNewSpeed() { return newSpeed; }
public void setNewSpeed(float newSpeed) { this.newSpeed = newSpeed; }
@@ -149,7 +149,7 @@ public class PlayerEvent extends LivingEvent
private final String username;
private String displayname;
public NameFormat(EntityPlayer player, String username) {
public NameFormat(PlayerEntity player, String username) {
super(player);
this.username = username;
this.setDisplayname(username);
@@ -177,10 +177,10 @@ public class PlayerEvent extends LivingEvent
*/
public static class Clone extends PlayerEvent
{
private final EntityPlayer original;
private final PlayerEntity original;
private final boolean wasDeath;
public Clone(EntityPlayer _new, EntityPlayer oldPlayer, boolean wasDeath)
public Clone(PlayerEntity _new, PlayerEntity oldPlayer, boolean wasDeath)
{
super(_new);
this.original = oldPlayer;
@@ -190,7 +190,7 @@ public class PlayerEvent extends LivingEvent
/**
* The old EntityPlayer that this new entity is a clone of.
*/
public EntityPlayer getOriginal()
public PlayerEntity getOriginal()
{
return original;
}
@@ -213,7 +213,7 @@ public class PlayerEvent extends LivingEvent
private final Entity target;
public StartTracking(EntityPlayer player, Entity target)
public StartTracking(PlayerEntity player, Entity target)
{
super(player);
this.target = target;
@@ -236,7 +236,7 @@ public class PlayerEvent extends LivingEvent
private final Entity target;
public StopTracking(EntityPlayer player, Entity target)
public StopTracking(PlayerEntity player, Entity target)
{
super(player);
this.target = target;
@@ -261,7 +261,7 @@ public class PlayerEvent extends LivingEvent
private final File playerDirectory;
private final String playerUUID;
public LoadFromFile(EntityPlayer player, File originDirectory, String playerUUID)
public LoadFromFile(PlayerEntity player, File originDirectory, String playerUUID)
{
super(player);
this.playerDirectory = originDirectory;
@@ -314,7 +314,7 @@ public class PlayerEvent extends LivingEvent
private final File playerDirectory;
private final String playerUUID;
public SaveToFile(EntityPlayer player, File originDirectory, String playerUUID)
public SaveToFile(PlayerEntity player, File originDirectory, String playerUUID)
{
super(player);
this.playerDirectory = originDirectory;
@@ -361,7 +361,7 @@ public class PlayerEvent extends LivingEvent
private double visibilityModifier = 1D;
public Visibility(EntityPlayer player)
public Visibility(PlayerEntity player)
{
super(player);
}
@@ -19,7 +19,7 @@
package net.minecraftforge.event.entity.player;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
/**
* Occurs when a player falls, but is able to fly. Doesn't need to be cancelable, this is mainly for notification purposes.
@@ -31,7 +31,7 @@ public class PlayerFlyableFallEvent extends PlayerEvent
private float distance;
private float multiplier;
public PlayerFlyableFallEvent(EntityPlayer player, float distance, float multiplier)
public PlayerFlyableFallEvent(PlayerEntity player, float distance, float multiplier)
{
super(player);
this.distance = distance;
@@ -21,11 +21,11 @@ package net.minecraftforge.event.entity.player;
import com.google.common.base.Preconditions;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
@@ -48,13 +48,13 @@ import net.minecraftforge.fml.LogicalSide;
**/
public class PlayerInteractEvent extends PlayerEvent
{
private final EnumHand hand;
private final Hand hand;
private final BlockPos pos;
@Nullable
private final EnumFacing face;
private EnumActionResult cancellationResult = EnumActionResult.PASS;
private final Direction face;
private ActionResultType cancellationResult = ActionResultType.PASS;
private PlayerInteractEvent(EntityPlayer player, EnumHand hand, BlockPos pos, @Nullable EnumFacing face)
private PlayerInteractEvent(PlayerEntity player, Hand hand, BlockPos pos, @Nullable Direction face)
{
super(Preconditions.checkNotNull(player, "Null player in PlayerInteractEvent!"));
this.hand = Preconditions.checkNotNull(hand, "Null hand in PlayerInteractEvent!");
@@ -77,7 +77,7 @@ public class PlayerInteractEvent extends PlayerEvent
private final Vec3d localPos;
private final Entity target;
public EntityInteractSpecific(EntityPlayer player, EnumHand hand, Entity target, Vec3d localPos)
public EntityInteractSpecific(PlayerEntity player, Hand hand, Entity target, Vec3d localPos)
{
super(player, hand, new BlockPos(target), null);
this.localPos = localPos;
@@ -117,7 +117,7 @@ public class PlayerInteractEvent extends PlayerEvent
{
private final Entity target;
public EntityInteract(EntityPlayer player, EnumHand hand, Entity target)
public EntityInteract(PlayerEntity player, Hand hand, Entity target)
{
super(player, hand, new BlockPos(target), null);
this.target = target;
@@ -146,19 +146,9 @@ public class PlayerInteractEvent extends PlayerEvent
{
private Result useBlock = DEFAULT;
private Result useItem = DEFAULT;
private final Vec3d hitVec;
public RightClickBlock(EntityPlayer player, EnumHand hand, BlockPos pos, EnumFacing face, Vec3d hitVec) {
public RightClickBlock(PlayerEntity player, Hand hand, BlockPos pos, Direction face) {
super(player, hand, pos, face);
this.hitVec = hitVec;
}
/**
* @return The hit vector of this click
*/
public Vec3d getHitVec()
{
return hitVec;
}
/**
@@ -219,7 +209,7 @@ public class PlayerInteractEvent extends PlayerEvent
@Cancelable
public static class RightClickItem extends PlayerInteractEvent
{
public RightClickItem(EntityPlayer player, EnumHand hand)
public RightClickItem(PlayerEntity player, Hand hand)
{
super(player, hand, new BlockPos(player), null);
}
@@ -232,7 +222,7 @@ public class PlayerInteractEvent extends PlayerEvent
*/
public static class RightClickEmpty extends PlayerInteractEvent
{
public RightClickEmpty(EntityPlayer player, EnumHand hand)
public RightClickEmpty(PlayerEntity player, Hand hand)
{
super(player, hand, new BlockPos(player), null);
}
@@ -255,20 +245,10 @@ public class PlayerInteractEvent extends PlayerEvent
{
private Result useBlock = DEFAULT;
private Result useItem = DEFAULT;
private final Vec3d hitVec;
public LeftClickBlock(EntityPlayer player, BlockPos pos, EnumFacing face, Vec3d hitVec)
public LeftClickBlock(PlayerEntity player, BlockPos pos, Direction face)
{
super(player, EnumHand.MAIN_HAND, pos, face);
this.hitVec = hitVec;
}
/**
* @return The local hit vector of this click
*/
public Vec3d getHitVec()
{
return hitVec;
super(player, Hand.MAIN_HAND, pos, face);
}
/**
@@ -316,9 +296,9 @@ public class PlayerInteractEvent extends PlayerEvent
*/
public static class LeftClickEmpty extends PlayerInteractEvent
{
public LeftClickEmpty(EntityPlayer player)
public LeftClickEmpty(PlayerEntity player)
{
super(player, EnumHand.MAIN_HAND, new BlockPos(player), null);
super(player, Hand.MAIN_HAND, new BlockPos(player), null);
}
}
@@ -326,7 +306,7 @@ public class PlayerInteractEvent extends PlayerEvent
* @return The hand involved in this interaction. Will never be null.
*/
@Nonnull
public EnumHand getHand()
public Hand getHand()
{
return hand;
}
@@ -357,7 +337,7 @@ public class PlayerInteractEvent extends PlayerEvent
* @return The face involved in this interaction. For all non-block interactions, this will return null.
*/
@Nullable
public EnumFacing getFace()
public Direction getFace()
{
return face;
}
@@ -383,7 +363,7 @@ public class PlayerInteractEvent extends PlayerEvent
* method of the event. By default, this is {@link EnumActionResult#PASS}, meaning cancelled events will cause
* the client to keep trying more interactions until something works.
*/
public EnumActionResult getCancellationResult()
public ActionResultType getCancellationResult()
{
return cancellationResult;
}
@@ -393,7 +373,7 @@ public class PlayerInteractEvent extends PlayerEvent
* method of the event.
* Note that this only has an effect on {@link RightClickBlock}, {@link RightClickItem}, {@link EntityInteract}, and {@link EntityInteractSpecific}.
*/
public void setCancellationResult(EnumActionResult result)
public void setCancellationResult(ActionResultType result)
{
this.cancellationResult = result;
}
@@ -20,8 +20,8 @@
package net.minecraftforge.event.entity.player;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraft.entity.item.EntityXPOrb;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.item.ExperienceOrbEntity;
import net.minecraft.entity.player.PlayerEntity;
/**
* This event is called when a player collides with a EntityXPOrb on the ground.
@@ -30,15 +30,15 @@ import net.minecraft.entity.player.EntityPlayer;
@Cancelable
public class PlayerPickupXpEvent extends PlayerEvent
{
private final EntityXPOrb orb;
private final ExperienceOrbEntity orb;
public PlayerPickupXpEvent(EntityPlayer player, EntityXPOrb orb)
public PlayerPickupXpEvent(PlayerEntity player, ExperienceOrbEntity orb)
{
super(player);
this.orb = orb;
}
public EntityXPOrb getOrb()
public ExperienceOrbEntity getOrb()
{
return orb;
}
@@ -20,7 +20,7 @@
package net.minecraftforge.event.entity.player;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.BlockPos;
@net.minecraftforge.eventbus.api.Cancelable
@@ -29,7 +29,7 @@ public class PlayerSetSpawnEvent extends PlayerEvent
private final boolean forced;
private final BlockPos newSpawn;
public PlayerSetSpawnEvent(EntityPlayer player, BlockPos newSpawn, boolean forced) {
public PlayerSetSpawnEvent(PlayerEntity player, BlockPos newSpawn, boolean forced) {
super(player);
this.newSpawn = newSpawn;
this.forced = forced;
@@ -19,12 +19,14 @@
package net.minecraftforge.event.entity.player;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayer.SleepResult;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerEntity.SleepResult;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Cancelable;
import java.util.Optional;
/**
* PlayerSleepInBedEvent is fired when a player sleeps in a bed.
* <br>
@@ -42,9 +44,9 @@ import net.minecraftforge.eventbus.api.Cancelable;
public class PlayerSleepInBedEvent extends PlayerEvent
{
private SleepResult result = null;
private final BlockPos pos;
private final Optional<BlockPos> pos;
public PlayerSleepInBedEvent(EntityPlayer player, BlockPos pos)
public PlayerSleepInBedEvent(PlayerEntity player, Optional<BlockPos> pos)
{
super(player);
this.pos = pos;
@@ -62,6 +64,11 @@ public class PlayerSleepInBedEvent extends PlayerEvent
public BlockPos getPos()
{
return pos.orElse(null);
}
public Optional<BlockPos> getOptionalPos() {
return pos;
}
}
@@ -19,7 +19,7 @@
package net.minecraftforge.event.entity.player;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
/**
* This event is fired when the player is waking up.<br/>
@@ -34,7 +34,7 @@ public class PlayerWakeUpEvent extends PlayerEvent
private final boolean setSpawn;
public PlayerWakeUpEvent(EntityPlayer player, boolean wakeImmediately, boolean updateWorld, boolean setSpawn)
public PlayerWakeUpEvent(PlayerEntity player, boolean wakeImmediately, boolean updateWorld, boolean setSpawn)
{
super(player);
this.wakeImmediately = wakeImmediately;
@@ -20,10 +20,10 @@
package net.minecraftforge.event.entity.player;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.event.entity.living.LivingEvent;
import net.minecraftforge.eventbus.api.Event.HasResult;
/**
@@ -36,12 +36,12 @@ import net.minecraftforge.eventbus.api.Event.HasResult;
* setResult(DEFAULT) causes game to check {@link Block#isBed(IBlockState, net.minecraft.world.IWorldReader, BlockPos, Entity)} instead
*/
@HasResult
public class SleepingLocationCheckEvent extends PlayerEvent
public class SleepingLocationCheckEvent extends LivingEvent
{
private final BlockPos sleepingLocation;
public SleepingLocationCheckEvent(EntityPlayer player, BlockPos sleepingLocation)
public SleepingLocationCheckEvent(LivingEntity player, BlockPos sleepingLocation)
{
super(player);
this.sleepingLocation = sleepingLocation;
@@ -19,11 +19,13 @@
package net.minecraftforge.event.entity.player;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.eventbus.api.Event.HasResult;
import java.util.Optional;
/**
* This event is fired when the game checks if players can sleep at this time.<br>
* Failing this check will cause sleeping players to wake up and prevent awake players from sleeping.<br>
@@ -36,9 +38,9 @@ import net.minecraftforge.eventbus.api.Event.HasResult;
@HasResult
public class SleepingTimeCheckEvent extends PlayerEvent
{
private final BlockPos sleepingLocation;
private final Optional<BlockPos> sleepingLocation;
public SleepingTimeCheckEvent(EntityPlayer player, BlockPos sleepingLocation)
public SleepingTimeCheckEvent(PlayerEntity player, Optional<BlockPos> sleepingLocation)
{
super(player);
this.sleepingLocation = sleepingLocation;
@@ -48,7 +50,7 @@ public class SleepingTimeCheckEvent extends PlayerEvent
* Note that the sleeping location may be an approximated one.
* @return The player's sleeping location.
*/
public BlockPos getSleepingLocation()
public Optional<BlockPos> getSleepingLocation()
{
return sleepingLocation;
}