Update to 1.17

Update to Official classnames
Patchwork
Make the game compile and run
Merge in the new HUD overlay API
Merge in the new render properties API
PEEL
Use Gradle 7.2 snapshot to fix eclipse integration bug in 7.1, Would use 7.0 but FG needs 7.1 for some reason.
New FML installer
Update to 1.17.1

Co-authored-by: LexManos <[email protected]>
Co-authored-by: SizableShrimp <[email protected]>
Co-authored-by: cpw <[email protected]>
Co-authored-by: Curle <[email protected]>
Co-authored-by: Unnoen <[email protected]>
Co-authored-by: covers1624 <[email protected]>
Co-authored-by: DaemonUmbra <[email protected]>
Co-authored-by: gigaherz <[email protected]>
Signed-off-by: SizableShrimp <[email protected]>
This commit is contained in:
authored and Curle committed 2021-07-22 19:57:02 +01:00
1 parent 064ae6961b
commit be5446b91c
1990 files changed
+35661 -37544

No files matched your search

@@ -21,12 +21,12 @@ package net.minecraftforge.event.entity;
import java.util.Map;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.entity.ai.attributes.GlobalEntityTypeAttributes;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
import net.minecraft.world.entity.ai.attributes.DefaultAttributes;
import net.minecraftforge.eventbus.api.Event;
import net.minecraftforge.fml.event.lifecycle.IModBusEvent;
import net.minecraftforge.fml.event.IModBusEvent;
/**
* EntityAttributeCreationEvent.<br>
@@ -37,16 +37,16 @@ import net.minecraftforge.fml.event.lifecycle.IModBusEvent;
**/
public class EntityAttributeCreationEvent extends Event implements IModBusEvent
{
private final Map<EntityType<? extends LivingEntity>, AttributeModifierMap> map;
private final Map<EntityType<? extends LivingEntity>, AttributeSupplier> map;
public EntityAttributeCreationEvent(Map<EntityType<? extends LivingEntity>, AttributeModifierMap> map)
public EntityAttributeCreationEvent(Map<EntityType<? extends LivingEntity>, AttributeSupplier> map)
{
this.map = map;
}
public void put(EntityType<? extends LivingEntity> entity, AttributeModifierMap map)
public void put(EntityType<? extends LivingEntity> entity, AttributeSupplier map)
{
if (GlobalEntityTypeAttributes.hasSupplier(entity))
if (DefaultAttributes.hasSupplier(entity))
throw new IllegalStateException("Duplicate GlobalEntityTypeAttributes entry: " + entity);
this.map.put(entity, map);
}
@@ -20,13 +20,13 @@
package net.minecraftforge.event.entity;
import com.google.common.collect.ImmutableList;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.Attribute;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.entity.ai.attributes.GlobalEntityTypeAttributes;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.ai.attributes.Attribute;
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
import net.minecraft.world.entity.ai.attributes.DefaultAttributes;
import net.minecraftforge.eventbus.api.Event;
import net.minecraftforge.fml.event.lifecycle.IModBusEvent;
import net.minecraftforge.fml.event.IModBusEvent;
import net.minecraftforge.registries.ForgeRegistries;
import java.util.List;
@@ -42,16 +42,16 @@ import java.util.stream.Collectors;
**/
public class EntityAttributeModificationEvent extends Event implements IModBusEvent
{
private final Map<EntityType<? extends LivingEntity>, AttributeModifierMap.MutableAttribute> entityAttributes;
private final Map<EntityType<? extends LivingEntity>, AttributeSupplier.Builder> entityAttributes;
private final List<EntityType<? extends LivingEntity>> entityTypes;
@SuppressWarnings("unchecked")
public EntityAttributeModificationEvent(Map<EntityType<? extends LivingEntity>, AttributeModifierMap.MutableAttribute> mapIn)
public EntityAttributeModificationEvent(Map<EntityType<? extends LivingEntity>, AttributeSupplier.Builder> mapIn)
{
this.entityAttributes = mapIn;
this.entityTypes = ImmutableList.copyOf(
ForgeRegistries.ENTITIES.getValues().stream()
.filter(GlobalEntityTypeAttributes::hasSupplier)
.filter(DefaultAttributes::hasSupplier)
.map(entityType -> (EntityType<? extends LivingEntity>) entityType)
.collect(Collectors.toList())
);
@@ -59,8 +59,8 @@ public class EntityAttributeModificationEvent extends Event implements IModBusEv
public void add(EntityType<? extends LivingEntity> entityType, Attribute attribute, double value)
{
AttributeModifierMap.MutableAttribute attributes = entityAttributes.computeIfAbsent(entityType,
(type) -> new AttributeModifierMap.MutableAttribute());
AttributeSupplier.Builder attributes = entityAttributes.computeIfAbsent(entityType,
(type) -> new AttributeSupplier.Builder());
attributes.add(attribute, value);
}
@@ -71,7 +71,7 @@ public class EntityAttributeModificationEvent extends Event implements IModBusEv
public boolean has(EntityType<? extends LivingEntity> entityType, Attribute attribute)
{
AttributeModifierMap globalMap = GlobalEntityTypeAttributes.getSupplier(entityType);
AttributeSupplier globalMap = DefaultAttributes.getSupplier(entityType);
return globalMap.hasAttribute(attribute) || (entityAttributes.get(entityType) != null && entityAttributes.get(entityType).hasAttribute(attribute));
}
@@ -19,13 +19,9 @@
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.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityDimensions;
import net.minecraft.world.entity.Pose;
import net.minecraftforge.eventbus.api.Event;
/**
@@ -100,43 +96,6 @@ public class EntityEvent extends Event
this.canUpdate = canUpdate;
}
}
/**
* EnteringChunk is fired when an Entity enters a chunk. <br>
* This event is fired whenever vanilla Minecraft determines that an entity <br>
* is entering a chunk in {@link Chunk#addEntity(net.minecraft.entity.Entity)} <br>
* <br>
* This event is not {@link Cancelable}.<br>
* <br>
* This event does not have a result. {@link HasResult}
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.<br>
**/
public static class EnteringChunk extends EntityEvent
{
private int newChunkX;
private int newChunkZ;
private int oldChunkX;
private int oldChunkZ;
public EnteringChunk(Entity entity, int newChunkX, int newChunkZ, int oldChunkX, int oldChunkZ)
{
super(entity);
this.setNewChunkX(newChunkX);
this.setNewChunkZ(newChunkZ);
this.setOldChunkX(oldChunkX);
this.setOldChunkZ(oldChunkZ);
}
public int getNewChunkX() { return newChunkX; }
public void setNewChunkX(int newChunkX) { this.newChunkX = newChunkX; }
public int getNewChunkZ() { return newChunkZ; }
public void setNewChunkZ(int newChunkZ) { this.newChunkZ = newChunkZ; }
public int getOldChunkX() { return oldChunkX; }
public void setOldChunkX(int oldChunkX) { this.oldChunkX = oldChunkX; }
public int getOldChunkZ() { return oldChunkZ; }
public void setOldChunkZ(int oldChunkZ) { this.oldChunkZ = oldChunkZ; }
}
/**
* This event is fired whenever the {@link Pose} changes, and in a few other hardcoded scenarios.<br>
@@ -152,17 +111,17 @@ public class EntityEvent extends Event
public static class Size extends EntityEvent
{
private final Pose pose;
private final EntitySize oldSize;
private EntitySize newSize;
private final EntityDimensions oldSize;
private EntityDimensions newSize;
private final float oldEyeHeight;
private float newEyeHeight;
public Size(Entity entity, Pose pose, EntitySize size, float defaultEyeHeight)
public Size(Entity entity, Pose pose, EntityDimensions size, float defaultEyeHeight)
{
this(entity, pose, size, size, defaultEyeHeight, defaultEyeHeight);
}
public Size(Entity entity, Pose pose, EntitySize oldSize, EntitySize newSize, float oldEyeHeight, float newEyeHeight)
public Size(Entity entity, Pose pose, EntityDimensions oldSize, EntityDimensions newSize, float oldEyeHeight, float newEyeHeight)
{
super(entity);
this.pose = pose;
@@ -174,9 +133,9 @@ public class EntityEvent extends Event
public Pose getPose() { return pose; }
public EntitySize getOldSize() { return oldSize; }
public EntitySize getNewSize() { return newSize; }
public void setNewSize(EntitySize size)
public EntityDimensions getOldSize() { return oldSize; }
public EntityDimensions getNewSize() { return newSize; }
public void setNewSize(EntityDimensions size)
{
setNewSize(size, false);
}
@@ -184,7 +143,7 @@ public class EntityEvent extends Event
/**
* Set the new size of the entity. Set updateEyeHeight to true to also update the eye height according to the new size.
*/
public void setNewSize(EntitySize size, boolean updateEyeHeight)
public void setNewSize(EntityDimensions size, boolean updateEyeHeight)
{
this.newSize = size;
if (updateEyeHeight)
@@ -19,12 +19,8 @@
package net.minecraftforge.event.entity;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraft.entity.Entity;
import net.minecraft.world.World;
import java.util.Collection;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.Level;
/**
* EntityJoinWorldEvent is fired when an Entity joins the world. <br>
@@ -45,15 +41,15 @@ import java.util.Collection;
public class EntityJoinWorldEvent extends EntityEvent
{
private final World world;
private final Level world;
public EntityJoinWorldEvent(Entity entity, World world)
public EntityJoinWorldEvent(Entity entity, Level world)
{
super(entity);
this.world = world;
}
public World getWorld()
public Level getWorld()
{
return world;
}
@@ -19,12 +19,8 @@
package net.minecraftforge.event.entity;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.world.server.ServerWorld;
import net.minecraft.entity.Entity;
import net.minecraft.world.World;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.Level;
/**
* EntityLeaveWorldEvent is fired when an Entity leaves the world. <br>
@@ -42,15 +38,15 @@ import net.minecraft.world.World;
public class EntityLeaveWorldEvent extends EntityEvent
{
private final World world;
private final Level world;
public EntityLeaveWorldEvent(Entity entity, World world)
public EntityLeaveWorldEvent(Entity entity, Level world)
{
super(entity);
this.world = world;
}
public World getWorld()
public Level getWorld()
{
return world;
}
@@ -19,8 +19,7 @@
package net.minecraftforge.event.entity;
import net.minecraft.entity.Entity;
import net.minecraftforge.common.MinecraftForge;
import net.minecraft.world.entity.Entity;
import net.minecraftforge.eventbus.api.Event.HasResult;
/**
@@ -19,11 +19,9 @@
package net.minecraftforge.event.entity;
import net.minecraft.entity.Entity;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.Level;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraftforge.eventbus.api.Event.HasResult;
/**
* This event gets fired whenever a entity mounts/dismounts another entity.<br>
@@ -45,11 +43,11 @@ public class EntityMountEvent extends EntityEvent
private final Entity entityMounting;
private final Entity entityBeingMounted;
private final World worldObj;
private final Level worldObj;
private final boolean isMounting;
public EntityMountEvent(Entity entityMounting, Entity entityBeingMounted, World entityWorld, boolean isMounting)
public EntityMountEvent(Entity entityMounting, Entity entityBeingMounted, Level entityWorld, boolean isMounting)
{
super(entityMounting);
this.entityMounting = entityMounting;
@@ -78,7 +76,7 @@ public class EntityMountEvent extends EntityEvent
return entityBeingMounted;
}
public World getWorldObj()
public Level getWorldObj()
{
return worldObj;
}
@@ -19,11 +19,8 @@
package net.minecraftforge.event.entity;
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.LightningBoltEntity;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LightningBolt;
/**
* EntityStruckByLightningEvent is fired when an Entity is about to be struck by lightening.<br>
@@ -42,15 +39,15 @@ import net.minecraft.entity.effect.LightningBoltEntity;
@net.minecraftforge.eventbus.api.Cancelable
public class EntityStruckByLightningEvent extends EntityEvent
{
private final LightningBoltEntity lightning;
private final LightningBolt lightning;
public EntityStruckByLightningEvent(Entity entity, LightningBoltEntity lightning)
public EntityStruckByLightningEvent(Entity entity, LightningBolt lightning)
{
super(entity);
this.lightning = lightning;
}
public LightningBoltEntity getLightning()
public LightningBolt getLightning()
{
return lightning;
}
@@ -17,15 +17,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.event.entity.living;
package net.minecraftforge.event.entity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.item.EnderPearlEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.EntityEvent;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.projectile.ThrownEnderpearl;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.eventbus.api.Cancelable;
/**
@@ -38,6 +36,7 @@ import net.minecraftforge.eventbus.api.Cancelable;
* <br>
* All children of this event are fired on the {@link MinecraftForge#EVENT_BUS}.<br>
**/
@Cancelable
public class EntityTeleportEvent extends EntityEvent
{
protected double targetX;
@@ -57,11 +56,11 @@ public class EntityTeleportEvent extends EntityEvent
public void setTargetY(double targetY) { this.targetY = targetY; }
public double getTargetZ() { return targetZ; }
public void setTargetZ(double targetZ) { this.targetZ = targetZ; }
public Vector3d getTarget() { return new Vector3d(this.targetX, this.targetY, this.targetZ); }
public Vec3 getTarget() { return new Vec3(this.targetX, this.targetY, this.targetZ); }
public double getPrevX() { return getEntity().getX(); }
public double getPrevY() { return getEntity().getY(); }
public double getPrevZ() { return getEntity().getZ(); }
public Vector3d getPrev() { return getEntity().position(); }
public Vec3 getPrev() { return getEntity().position(); }
/**
* EntityTeleportEvent.TeleportCommand is fired before a living entity is teleported
@@ -159,11 +158,11 @@ public class EntityTeleportEvent extends EntityEvent
@Cancelable
public static class EnderPearl extends EntityTeleportEvent
{
private final ServerPlayerEntity player;
private final EnderPearlEntity pearlEntity;
private final ServerPlayer player;
private final ThrownEnderpearl pearlEntity;
private float attackDamage;
public EnderPearl(ServerPlayerEntity entity, double targetX, double targetY, double targetZ, EnderPearlEntity pearlEntity, float attackDamage)
public EnderPearl(ServerPlayer entity, double targetX, double targetY, double targetZ, ThrownEnderpearl pearlEntity, float attackDamage)
{
super(entity, targetX, targetY, targetZ);
this.pearlEntity = pearlEntity;
@@ -171,12 +170,12 @@ public class EntityTeleportEvent extends EntityEvent
this.attackDamage = attackDamage;
}
public EnderPearlEntity getPearlEntity()
public ThrownEnderpearl getPearlEntity()
{
return pearlEntity;
}
public ServerPlayerEntity getPlayer()
public ServerPlayer getPlayer()
{
return player;
}
@@ -19,12 +19,10 @@
package net.minecraftforge.event.entity;
import net.minecraft.entity.Entity;
import net.minecraft.util.RegistryKey;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraft.world.entity.Entity;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.level.Level;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraftforge.eventbus.api.Event.HasResult;
/**
* EntityTravelToDimensionEvent is fired before an Entity travels to a dimension.<br>
@@ -41,15 +39,15 @@ import net.minecraftforge.eventbus.api.Event.HasResult;
@Cancelable
public class EntityTravelToDimensionEvent extends EntityEvent
{
private final RegistryKey<World> dimension;
private final ResourceKey<Level> dimension;
public EntityTravelToDimensionEvent(Entity entity, RegistryKey<World> dimension)
public EntityTravelToDimensionEvent(Entity entity, ResourceKey<Level> dimension)
{
super(entity);
this.dimension = dimension;
}
public RegistryKey<World> getDimension()
public ResourceKey<Level> getDimension()
{
return dimension;
}
@@ -19,14 +19,9 @@
package net.minecraftforge.event.entity;
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;
import net.minecraft.entity.Entity;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvent;
import net.minecraft.world.entity.Entity;
import net.minecraft.sounds.SoundSource;
import net.minecraft.sounds.SoundEvent;
/**
* PlaySoundAtEntityEvent is fired a sound is to be played at an Entity<br>
@@ -51,13 +46,13 @@ import net.minecraft.util.SoundEvent;
public class PlaySoundAtEntityEvent extends EntityEvent
{
private SoundEvent name;
private SoundCategory category;
private SoundSource category;
private final float volume;
private final float pitch;
private float newVolume;
private float newPitch;
public PlaySoundAtEntityEvent(Entity entity, SoundEvent name, SoundCategory category, float volume, float pitch)
public PlaySoundAtEntityEvent(Entity entity, SoundEvent name, SoundSource category, float volume, float pitch)
{
super(entity);
this.name = name;
@@ -69,13 +64,13 @@ public class PlaySoundAtEntityEvent extends EntityEvent
}
public SoundEvent getSound() { return this.name; }
public SoundCategory getCategory() { return this.category; }
public SoundSource getCategory() { return this.category; }
public float getDefaultVolume() { return this.volume; }
public float getDefaultPitch() { return this.pitch; }
public float getVolume() { return this.newVolume; }
public float getPitch() { return this.newPitch; }
public void setSound(SoundEvent value) { this.name = value; }
public void setCategory(SoundCategory category) { this.category = category; }
public void setCategory(SoundSource category) { this.category = category; }
public void setVolume(float value) { this.newVolume = value; }
public void setPitch(float value) { this.newPitch = value; }
}
@@ -19,131 +19,41 @@
package net.minecraftforge.event.entity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.projectile.AbstractArrowEntity;
import net.minecraft.entity.projectile.DamagingProjectileEntity;
import net.minecraft.entity.projectile.FireworkRocketEntity;
import net.minecraft.entity.projectile.FishingBobberEntity;
import net.minecraft.entity.projectile.ThrowableEntity;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.entity.projectile.Projectile;
import net.minecraft.world.phys.HitResult;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.ForgeEventFactory;
import net.minecraftforge.eventbus.api.Cancelable;
/**
* This event is fired when a projectile entity impacts something.
* This event is fired via {@link ForgeEventFactory#onProjectileImpact(Entity, RayTraceResult)}
* Subclasses of this event exist for more specific types of projectile.
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.<br>
* This event is fired when a projectile entity impacts something.<br>
* This event is fired via {@link ForgeEventFactory#onProjectileImpact(Projectile, HitResult)}
* This event is fired for all vanilla projectiles by Forge,
* custom projectiles should fire this event and check the result in a similar fashion.
* This event is cancelable. When canceled, the impact will not be processed.
* This event is cancelable. When canceled, the impact will not be processed and the projectile will continue flying.
* Killing or other handling of the entity after event cancellation is up to the modder.
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
*/
@Cancelable
public class ProjectileImpactEvent extends EntityEvent
public class ProjectileImpactEvent<T extends Projectile> extends EntityEvent
{
private final RayTraceResult ray;
private final HitResult ray;
private final T projectile;
public ProjectileImpactEvent(Entity entity, RayTraceResult ray)
public ProjectileImpactEvent(T projectile, HitResult ray)
{
super(entity);
super(projectile);
this.ray = ray;
this.projectile = projectile;
}
public RayTraceResult getRayTraceResult()
public HitResult getRayTraceResult()
{
return ray;
}
@Cancelable
public static class Arrow extends ProjectileImpactEvent
public T getProjectile()
{
private final AbstractArrowEntity arrow;
public Arrow(AbstractArrowEntity arrow, RayTraceResult ray)
{
super(arrow, ray);
this.arrow = arrow;
}
public AbstractArrowEntity getArrow()
{
return arrow;
}
}
@Cancelable
public static class Fireball extends ProjectileImpactEvent
{
private final DamagingProjectileEntity fireball;
public Fireball(DamagingProjectileEntity fireball, RayTraceResult ray)
{
super(fireball, ray);
this.fireball = fireball;
}
public DamagingProjectileEntity getFireball()
{
return fireball;
}
}
@Cancelable
public static class Throwable extends ProjectileImpactEvent
{
private final ThrowableEntity throwable;
public Throwable(ThrowableEntity throwable, RayTraceResult ray)
{
super(throwable, ray);
this.throwable = throwable;
}
public ThrowableEntity getThrowable()
{
return throwable;
}
}
/**
* Event is cancellable, causes firework to ignore the current hit and continue on its journey.
*/
@Cancelable
public static class FireworkRocket extends ProjectileImpactEvent
{
private final FireworkRocketEntity fireworkRocket;
public FireworkRocket(FireworkRocketEntity fireworkRocket, RayTraceResult ray)
{
super(fireworkRocket, ray);
this.fireworkRocket = fireworkRocket;
}
public FireworkRocketEntity getFireworkRocket()
{
return fireworkRocket;
}
}
/**
* Event is cancellable, causes bobber to ignore the current hit and continue on its journey.
*/
@Cancelable
public static class FishingBobber extends ProjectileImpactEvent
{
private final FishingBobberEntity fishingBobber;
public FishingBobber(FishingBobberEntity fishingBobber, RayTraceResult ray)
{
super(fishingBobber, ray);
this.fishingBobber = fishingBobber;
}
public FishingBobberEntity getFishingBobber()
{
return fishingBobber;
}
return projectile;
}
}
@@ -19,7 +19,7 @@
package net.minecraftforge.event.entity.item;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraftforge.event.entity.EntityEvent;
/**
@@ -20,7 +20,7 @@
package net.minecraftforge.event.entity.item;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.world.entity.item.ItemEntity;
/**
* Event that is fired when an EntityItem's age has reached its maximum
@@ -20,8 +20,8 @@
package net.minecraftforge.event.entity.item;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.entity.player.Player;
/**
* 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.PlayerEntity;
public class ItemTossEvent extends ItemEvent
{
private final PlayerEntity player;
private final Player 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(ItemEntity entityItem, PlayerEntity player)
public ItemTossEvent(ItemEntity entityItem, Player player)
{
super(entityItem);
this.player = player;
@@ -50,7 +50,7 @@ public class ItemTossEvent extends ItemEvent
/**
* The player tossing the item.
*/
public PlayerEntity getPlayer()
public Player getPlayer()
{
return player;
}
@@ -19,10 +19,8 @@
package net.minecraftforge.event.entity.living;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.ForgeEventFactory;
import net.minecraft.world.entity.animal.Animal;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.eventbus.api.Cancelable;
/**
@@ -35,22 +33,22 @@ import net.minecraftforge.eventbus.api.Cancelable;
@Cancelable
public class AnimalTameEvent extends LivingEvent
{
private final AnimalEntity animal;
private final PlayerEntity tamer;
private final Animal animal;
private final Player tamer;
public AnimalTameEvent(AnimalEntity animal, PlayerEntity tamer)
public AnimalTameEvent(Animal animal, Player tamer)
{
super(animal);
this.animal = animal;
this.tamer = tamer;
}
public AnimalEntity getAnimal()
public Animal getAnimal()
{
return animal;
}
public PlayerEntity getTamer()
public Player getTamer()
{
return tamer;
}
@@ -19,11 +19,10 @@
package net.minecraftforge.event.entity.living;
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.minecraft.world.entity.AgeableMob;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.animal.Animal;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.eventbus.api.Cancelable;
import javax.annotation.Nullable;
@@ -49,22 +48,22 @@ import javax.annotation.Nullable;
@Cancelable
public class BabyEntitySpawnEvent extends net.minecraftforge.eventbus.api.Event
{
private final MobEntity parentA;
private final MobEntity parentB;
private final PlayerEntity causedByPlayer;
private AgeableEntity child;
private final Mob parentA;
private final Mob parentB;
private final Player causedByPlayer;
private AgeableMob child;
public BabyEntitySpawnEvent(MobEntity parentA, MobEntity parentB, @Nullable AgeableEntity proposedChild)
public BabyEntitySpawnEvent(Mob parentA, Mob parentB, @Nullable AgeableMob proposedChild)
{
//causedByPlayer calculated here to simplify the patch.
PlayerEntity causedByPlayer = null;
if (parentA instanceof AnimalEntity) {
causedByPlayer = ((AnimalEntity)parentA).getLoveCause();
Player causedByPlayer = null;
if (parentA instanceof Animal) {
causedByPlayer = ((Animal)parentA).getLoveCause();
}
if (causedByPlayer == null && parentB instanceof AnimalEntity)
if (causedByPlayer == null && parentB instanceof Animal)
{
causedByPlayer = ((AnimalEntity)parentB).getLoveCause();
causedByPlayer = ((Animal)parentB).getLoveCause();
}
this.parentA = parentA;
@@ -73,29 +72,29 @@ public class BabyEntitySpawnEvent extends net.minecraftforge.eventbus.api.Event
this.child = proposedChild;
}
public MobEntity getParentA()
public Mob getParentA()
{
return parentA;
}
public MobEntity getParentB()
public Mob getParentB()
{
return parentB;
}
@Nullable
public PlayerEntity getCausedByPlayer()
public Player getCausedByPlayer()
{
return causedByPlayer;
}
@Nullable
public AgeableEntity getChild()
public AgeableMob getChild()
{
return child;
}
public void setChild(AgeableEntity proposedChild)
public void setChild(AgeableMob proposedChild)
{
child = proposedChild;
}
@@ -1,57 +0,0 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2021.
*
* 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.living;
import net.minecraftforge.eventbus.api.Cancelable;
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.
* @author Mithion
* @deprecated Use {@link EntityTeleportEvent.EnderEntity} or {@link EntityTeleportEvent.EnderPearl}.
*/
@Deprecated //TODO Forge: Remove in 1.17
@Cancelable
public class EnderTeleportEvent extends LivingEvent
{
private double targetX;
private double targetY;
private double targetZ;
private float attackDamage;
public EnderTeleportEvent(LivingEntity entity, double targetX, double targetY, double targetZ, float attackDamage)
{
super(entity);
this.setTargetX(targetX);
this.setTargetY(targetY);
this.setTargetZ(targetZ);
this.setAttackDamage(attackDamage);
}
public double getTargetX() { return targetX; }
public void setTargetX(double targetX) { this.targetX = targetX; }
public double getTargetY() { return targetY; }
public void setTargetY(double targetY) { this.targetY = targetY; }
public double getTargetZ() { return targetZ; }
public void setTargetZ(double targetZ) { this.targetZ = targetZ; }
public float getAttackDamage() { return attackDamage; }
public void setAttackDamage(float attackDamage) { this.attackDamage = attackDamage; }
}
@@ -19,11 +19,9 @@
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.util.DamageSource;
import net.minecraft.entity.LivingEntity;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.LivingEntity;
/**
* LivingAttackEvent is fired when a living Entity is attacked. <br>
@@ -19,8 +19,8 @@
package net.minecraftforge.event.entity.living;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraftforge.eventbus.api.Cancelable;
import java.util.function.Consumer;
@@ -19,10 +19,9 @@
package net.minecraftforge.event.entity.living;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraft.util.DamageSource;
import net.minecraft.entity.LivingEntity;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.LivingEntity;
/**
* LivingDamageEvent is fired just before damage is applied to entity.<br>
@@ -19,11 +19,9 @@
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.util.DamageSource;
import net.minecraft.entity.LivingEntity;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.LivingEntity;
/**
* LivingDeathEvent is fired when an Entity dies. <br>
@@ -19,12 +19,9 @@
package net.minecraftforge.event.entity.living;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.common.MinecraftForge;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.core.BlockPos;
import net.minecraftforge.eventbus.api.Cancelable;
/**
@@ -19,15 +19,11 @@
package net.minecraftforge.event.entity.living;
import java.util.ArrayList;
import java.util.Collection;
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.ItemEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.entity.LivingEntity;
/**
* LivingDropsEvent is fired when an Entity's death causes dropped items to appear.<br>
@@ -19,8 +19,8 @@
package net.minecraftforge.event.entity.living;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.eventbus.api.Cancelable;
import javax.annotation.Nonnull;
@@ -19,11 +19,9 @@
package net.minecraftforge.event.entity.living;
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;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.item.ItemStack;
import javax.annotation.Nonnull;
@@ -45,11 +43,11 @@ import javax.annotation.Nonnull;
**/
public class LivingEquipmentChangeEvent extends LivingEvent
{
private final EquipmentSlotType slot;
private final EquipmentSlot slot;
private final ItemStack from;
private final ItemStack to;
public LivingEquipmentChangeEvent(LivingEntity entity, EquipmentSlotType slot, @Nonnull ItemStack from, @Nonnull ItemStack to)
public LivingEquipmentChangeEvent(LivingEntity entity, EquipmentSlot slot, @Nonnull ItemStack from, @Nonnull ItemStack to)
{
super(entity);
this.slot = slot;
@@ -57,7 +55,7 @@ public class LivingEquipmentChangeEvent extends LivingEvent
this.to = to;
}
public EquipmentSlotType getSlot() { return this.slot; }
public EquipmentSlot getSlot() { return this.slot; }
@Nonnull
public ItemStack getFrom() { return this.from; }
@Nonnull
@@ -19,11 +19,9 @@
package net.minecraftforge.event.entity.living;
import net.minecraft.entity.Entity;
import net.minecraft.world.entity.Entity;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraft.entity.LivingEntity;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraft.world.entity.LivingEntity;
import net.minecraftforge.event.entity.EntityEvent;
import javax.annotation.Nullable;
@@ -19,8 +19,8 @@
package net.minecraftforge.event.entity.living;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.eventbus.api.Cancelable;
/**
@@ -31,12 +31,12 @@ import net.minecraftforge.eventbus.api.Cancelable;
@Cancelable
public class LivingExperienceDropEvent extends LivingEvent
{
private final PlayerEntity attackingPlayer;
private final Player attackingPlayer;
private final int originalExperiencePoints;
private int droppedExperiencePoints;
public LivingExperienceDropEvent(LivingEntity entity, PlayerEntity attackingPlayer, int originalExperience)
public LivingExperienceDropEvent(LivingEntity entity, Player attackingPlayer, int originalExperience)
{
super(entity);
@@ -54,7 +54,7 @@ public class LivingExperienceDropEvent extends LivingEvent
this.droppedExperiencePoints = droppedExperience;
}
public PlayerEntity getAttackingPlayer()
public Player getAttackingPlayer()
{
return attackingPlayer;
}
@@ -19,10 +19,8 @@
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.LivingEntity;
import net.minecraft.world.entity.LivingEntity;
/**
* LivingFallEvent is fired when an Entity is set to be falling.<br>
@@ -19,10 +19,8 @@
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.LivingEntity;
import net.minecraft.world.entity.LivingEntity;
/**
* LivingHealEvent is fired when an Entity is set to be healed. <br>
@@ -19,11 +19,8 @@
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.util.DamageSource;
import net.minecraft.entity.LivingEntity;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.LivingEntity;
/**
* LivingHurtEvent is fired when an Entity is set to be hurt. <br>
@@ -19,11 +19,7 @@
package net.minecraftforge.event.entity.living;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.DamageSource;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraft.world.entity.LivingEntity;
import net.minecraftforge.eventbus.api.Cancelable;
/**
@@ -20,14 +20,14 @@
package net.minecraftforge.event.entity.living;
import net.minecraftforge.eventbus.api.Event.HasResult;
import net.minecraft.entity.MobEntity;
import net.minecraft.world.entity.Mob;
@HasResult
public class LivingPackSizeEvent extends LivingEvent
{
private int maxPackSize;
public LivingPackSizeEvent(MobEntity entity)
public LivingPackSizeEvent(Mob entity)
{
super(entity);
}
@@ -19,9 +19,7 @@
package net.minecraftforge.event.entity.living;
import net.minecraft.entity.LivingEntity;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraft.world.entity.LivingEntity;
/**
* LivingSetAttackTargetEvent is fired when an Entity sets a target to attack.<br>
@@ -20,14 +20,11 @@
package net.minecraftforge.event.entity.living;
import javax.annotation.Nullable;
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.MobEntity;
import net.minecraft.entity.SpawnReason;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import net.minecraft.world.level.BaseSpawner;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.MobSpawnType;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.Level;
import net.minecraftforge.eventbus.api.Event.HasResult;
@@ -45,12 +42,12 @@ import net.minecraftforge.eventbus.api.Event.HasResult;
**/
public class LivingSpawnEvent extends LivingEvent
{
private final IWorld world;
private final LevelAccessor world;
private final double x;
private final double y;
private final double z;
public LivingSpawnEvent(MobEntity entity, IWorld world, double x, double y, double z)
public LivingSpawnEvent(Mob entity, LevelAccessor world, double x, double y, double z)
{
super(entity);
this.world = world;
@@ -59,7 +56,7 @@ public class LivingSpawnEvent extends LivingEvent
this.z = z;
}
public IWorld getWorld() { return world; }
public LevelAccessor getWorld() { return world; }
public double getX() { return x; }
public double getY() { return y; }
public double getZ() { return z; }
@@ -76,8 +73,8 @@ public class LivingSpawnEvent extends LivingEvent
public static class CheckSpawn extends LivingSpawnEvent
{
@Nullable
private final AbstractSpawner spawner;
private final SpawnReason spawnReason;
private final BaseSpawner spawner;
private final MobSpawnType spawnReason;
/**
* CheckSpawn is fired when an Entity is about to be spawned.
@@ -89,7 +86,7 @@ public class LivingSpawnEvent extends LivingEvent
* @param spawner position of the MobSpawner
* null if it this spawn is coming from a WorldSpawner
*/
public CheckSpawn(MobEntity entity, IWorld world, double x, double y, double z, @Nullable AbstractSpawner spawner, SpawnReason spawnReason)
public CheckSpawn(Mob entity, LevelAccessor world, double x, double y, double z, @Nullable BaseSpawner spawner, MobSpawnType spawnReason)
{
super(entity, world, x, y, z);
this.spawner = spawner;
@@ -102,12 +99,12 @@ public class LivingSpawnEvent extends LivingEvent
}
@Nullable
public AbstractSpawner getSpawner()
public BaseSpawner getSpawner()
{
return spawner;
}
public SpawnReason getSpawnReason()
public MobSpawnType getSpawnReason()
{
return spawnReason;
}
@@ -130,13 +127,13 @@ public class LivingSpawnEvent extends LivingEvent
public static class SpecialSpawn extends LivingSpawnEvent
{
@Nullable
private final AbstractSpawner spawner;
private final SpawnReason spawnReason;
private final BaseSpawner spawner;
private final MobSpawnType spawnReason;
/**
* @param spawner the position of a tileentity or approximate position of an entity that initiated the spawn if any
*/
public SpecialSpawn(MobEntity entity, World world, double x, double y, double z, @Nullable AbstractSpawner spawner, SpawnReason spawnReason)
public SpecialSpawn(Mob entity, Level world, double x, double y, double z, @Nullable BaseSpawner spawner, MobSpawnType spawnReason)
{
super(entity, world, x, y, z);
this.spawner = spawner;
@@ -144,12 +141,12 @@ public class LivingSpawnEvent extends LivingEvent
}
@Nullable
public AbstractSpawner getSpawner()
public BaseSpawner getSpawner()
{
return spawner;
}
public SpawnReason getSpawnReason()
public MobSpawnType getSpawnReason()
{
return spawnReason;
}
@@ -171,7 +168,7 @@ public class LivingSpawnEvent extends LivingEvent
@HasResult
public static class AllowDespawn extends LivingSpawnEvent
{
public AllowDespawn(MobEntity entity)
public AllowDespawn(Mob entity)
{
super(entity, entity.level, entity.getX(), entity.getY(), entity.getZ());
}
@@ -19,8 +19,8 @@
package net.minecraftforge.event.entity.living;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.DamageSource;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.damagesource.DamageSource;
public class LootingLevelEvent extends LivingEvent {
@@ -21,8 +21,8 @@ package net.minecraftforge.event.entity.living;
import java.util.Collection;
import java.util.Collections;
import net.minecraft.entity.LivingEntity;
import net.minecraft.potion.EffectInstance;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.effect.MobEffectInstance;
/**
* Fires after Potion Color Calculation.
@@ -35,10 +35,10 @@ public class PotionColorCalculationEvent extends LivingEvent
{
private int color;
private boolean hideParticle;
private final Collection<EffectInstance> effectList;
private final Collection<MobEffectInstance> effectList;
public PotionColorCalculationEvent(LivingEntity entity, int color, boolean hideParticle,
Collection<EffectInstance> effectList)
Collection<MobEffectInstance> effectList)
{
super(entity);
this.color = color;
@@ -71,7 +71,7 @@ public class PotionColorCalculationEvent extends LivingEvent
*
* @return effects
*/
public Collection<EffectInstance> getEffects()
public Collection<MobEffectInstance> getEffects()
{
return Collections.unmodifiableCollection(effectList);
}
@@ -22,10 +22,9 @@ package net.minecraftforge.event.entity.living;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.entity.LivingEntity;
import net.minecraft.potion.Effect;
import net.minecraft.potion.EffectInstance;
import net.minecraftforge.common.MinecraftForge;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraftforge.eventbus.api.Event.HasResult;
@@ -36,9 +35,9 @@ import net.minecraftforge.eventbus.api.Event.HasResult;
public class PotionEvent extends LivingEvent
{
@Nullable
protected final EffectInstance effect;
protected final MobEffectInstance effect;
public PotionEvent(LivingEntity living, EffectInstance effect)
public PotionEvent(LivingEntity living, MobEffectInstance effect)
{
super(living);
this.effect = effect;
@@ -47,7 +46,7 @@ public class PotionEvent extends LivingEvent
* Retuns the PotionEffect.
*/
@Nullable
public EffectInstance getPotionEffect()
public MobEffectInstance getPotionEffect()
{
return effect;
}
@@ -60,15 +59,15 @@ public class PotionEvent extends LivingEvent
@Cancelable
public static class PotionRemoveEvent extends PotionEvent
{
private final Effect potion;
private final MobEffect potion;
public PotionRemoveEvent(LivingEntity living, Effect potion)
public PotionRemoveEvent(LivingEntity living, MobEffect potion)
{
super(living, living.getEffect(potion));
this.potion = potion;
}
public PotionRemoveEvent(LivingEntity living, EffectInstance effect)
public PotionRemoveEvent(LivingEntity living, MobEffectInstance effect)
{
super(living, effect);
this.potion = effect.getEffect();
@@ -77,7 +76,7 @@ public class PotionEvent extends LivingEvent
/**
* @return the Potion which is tried to remove from the Entity.
*/
public Effect getPotion()
public MobEffect getPotion()
{
return this.potion;
}
@@ -87,7 +86,7 @@ public class PotionEvent extends LivingEvent
*/
@Override
@Nullable
public EffectInstance getPotionEffect()
public MobEffectInstance getPotionEffect()
{
return super.getPotionEffect();
}
@@ -104,7 +103,7 @@ public class PotionEvent extends LivingEvent
@HasResult
public static class PotionApplicableEvent extends PotionEvent
{
public PotionApplicableEvent(LivingEntity living, EffectInstance effect)
public PotionApplicableEvent(LivingEntity living, MobEffectInstance effect)
{
super(living, effect);
}
@@ -114,7 +113,7 @@ public class PotionEvent extends LivingEvent
*/
@Override
@Nonnull
public EffectInstance getPotionEffect()
public MobEffectInstance getPotionEffect()
{
return super.getPotionEffect();
}
@@ -127,9 +126,9 @@ public class PotionEvent extends LivingEvent
*/
public static class PotionAddedEvent extends PotionEvent
{
private final EffectInstance oldEffect;
private final MobEffectInstance oldEffect;
public PotionAddedEvent(LivingEntity living, EffectInstance oldEffect, EffectInstance newEffect)
public PotionAddedEvent(LivingEntity living, MobEffectInstance oldEffect, MobEffectInstance newEffect)
{
super(living, newEffect);
this.oldEffect = oldEffect;
@@ -140,7 +139,7 @@ public class PotionEvent extends LivingEvent
*/
@Override
@Nonnull
public EffectInstance getPotionEffect()
public MobEffectInstance getPotionEffect()
{
return super.getPotionEffect();
}
@@ -149,7 +148,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 EffectInstance getOldPotionEffect()
public MobEffectInstance getOldPotionEffect()
{
return oldEffect;
}
@@ -162,7 +161,7 @@ public class PotionEvent extends LivingEvent
*/
public static class PotionExpiryEvent extends PotionEvent
{
public PotionExpiryEvent(LivingEntity living, EffectInstance effect)
public PotionExpiryEvent(LivingEntity living, MobEffectInstance effect)
{
super(living, effect);
}
@@ -19,15 +19,10 @@
package net.minecraftforge.event.entity.living;
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;
import net.minecraftforge.event.ForgeEventFactory;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.monster.Zombie;
import net.minecraft.world.level.Level;
import net.minecraftforge.event.entity.EntityEvent;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraftforge.eventbus.api.Event;
import net.minecraftforge.eventbus.api.Event.HasResult;
@@ -40,14 +35,14 @@ import net.minecraftforge.eventbus.api.Event.HasResult;
**/
public class ZombieEvent extends EntityEvent {
public ZombieEvent(ZombieEntity entity)
public ZombieEvent(Zombie entity)
{
super(entity);
}
public ZombieEntity getSummoner()
public Zombie getSummoner()
{
return (ZombieEntity) getEntity();
return (Zombie) getEntity();
}
/**
@@ -75,16 +70,16 @@ public class ZombieEvent extends EntityEvent {
**/
@HasResult
public static class SummonAidEvent extends ZombieEvent {
private ZombieEntity customSummonedAid;
private Zombie customSummonedAid;
private final World world;
private final Level world;
private final int x;
private final int y;
private final int z;
private final LivingEntity attacker;
private final double summonChance;
public SummonAidEvent(ZombieEntity entity, World world, int x, int y, int z, LivingEntity attacker, double summonChance)
public SummonAidEvent(Zombie entity, Level world, int x, int y, int z, LivingEntity attacker, double summonChance)
{
super(entity);
this.world = world;
@@ -98,9 +93,9 @@ public class ZombieEvent extends EntityEvent {
/**
* Populate this field to have a custom zombie instead of a normal zombie summoned
*/
public ZombieEntity getCustomSummonedAid() { return customSummonedAid; }
public void setCustomSummonedAid(ZombieEntity customSummonedAid) { this.customSummonedAid = customSummonedAid; }
public World getWorld() { return world; }
public Zombie getCustomSummonedAid() { return customSummonedAid; }
public void setCustomSummonedAid(Zombie customSummonedAid) { this.customSummonedAid = customSummonedAid; }
public Level getWorld() { return world; }
public int getX() { return x; }
public int getY() { return y; }
public int getZ() { return z; }
@@ -20,8 +20,7 @@
package net.minecraftforge.event.entity.player;
import net.minecraft.advancements.Advancement;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraftforge.common.MinecraftForge;
import net.minecraft.world.entity.player.Player;
/**
* This event is fired when a player gets an advancement.
@@ -36,7 +35,7 @@ public class AdvancementEvent extends PlayerEvent
{
private final Advancement advancement;
public AdvancementEvent(PlayerEntity player, Advancement advancement)
public AdvancementEvent(Player player, Advancement advancement)
{
super(player);
this.advancement = advancement;
@@ -19,8 +19,8 @@
package net.minecraftforge.event.entity.player;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.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(PlayerEntity player, @Nonnull ItemStack left, @Nonnull ItemStack right, @Nonnull ItemStack output)
public AnvilRepairEvent(Player player, @Nonnull ItemStack left, @Nonnull ItemStack right, @Nonnull ItemStack output)
{
super(player);
this.output = output;
@@ -19,11 +19,10 @@
package net.minecraftforge.event.entity.player;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import javax.annotation.Nonnull;
@@ -46,11 +45,11 @@ import javax.annotation.Nonnull;
public class ArrowLooseEvent extends PlayerEvent
{
private final ItemStack bow;
private final World world;
private final Level world;
private final boolean hasAmmo;
private int charge;
public ArrowLooseEvent(PlayerEntity player, @Nonnull ItemStack bow, World world, int charge, boolean hasAmmo)
public ArrowLooseEvent(Player player, @Nonnull ItemStack bow, Level world, int charge, boolean hasAmmo)
{
super(player);
this.bow = bow;
@@ -61,7 +60,7 @@ public class ArrowLooseEvent extends PlayerEvent
@Nonnull
public ItemStack getBow() { return this.bow; }
public World getWorld() { return this.world; }
public Level getWorld() { return this.world; }
public boolean hasAmmo() { return this.hasAmmo; }
public int getCharge() { return this.charge; }
public void setCharge(int charge) { this.charge = charge; }
@@ -19,12 +19,11 @@
package net.minecraftforge.event.entity.player;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.InteractionResultHolder;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.level.Level;
import javax.annotation.Nonnull;
@@ -38,12 +37,12 @@ import javax.annotation.Nonnull;
public class ArrowNockEvent extends PlayerEvent
{
private final ItemStack bow;
private final Hand hand;
private final World world;
private final InteractionHand hand;
private final Level world;
private final boolean hasAmmo;
private ActionResult<ItemStack> action;
private InteractionResultHolder<ItemStack> action;
public ArrowNockEvent(PlayerEntity player, @Nonnull ItemStack item, Hand hand, World world, boolean hasAmmo)
public ArrowNockEvent(Player player, @Nonnull ItemStack item, InteractionHand hand, Level world, boolean hasAmmo)
{
super(player);
this.bow = item;
@@ -54,15 +53,15 @@ public class ArrowNockEvent extends PlayerEvent
@Nonnull
public ItemStack getBow() { return this.bow; }
public World getWorld() { return this.world; }
public Hand getHand() { return this.hand; }
public Level getWorld() { return this.world; }
public InteractionHand getHand() { return this.hand; }
public boolean hasAmmo() { return this.hasAmmo; }
public ActionResult<ItemStack> getAction()
public InteractionResultHolder<ItemStack> getAction()
{
return this.action;
}
public void setAction(ActionResult<ItemStack> action)
public void setAction(InteractionResultHolder<ItemStack> action)
{
this.action = action;
}
@@ -19,10 +19,9 @@
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.PlayerEntity;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player;
/**
* AttackEntityEvent is fired when a player attacks an Entity.<br>
@@ -42,7 +41,7 @@ import net.minecraft.entity.player.PlayerEntity;
public class AttackEntityEvent extends PlayerEvent
{
private final Entity target;
public AttackEntityEvent(PlayerEntity player, Entity target)
public AttackEntityEvent(Player player, Entity target)
{
super(player);
this.target = target;
@@ -20,11 +20,11 @@
package net.minecraftforge.event.entity.player;
import net.minecraftforge.eventbus.api.Cancelable;
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;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.Level;
import javax.annotation.Nonnull;
@@ -42,12 +42,12 @@ import javax.annotation.Nonnull;
public class BonemealEvent extends PlayerEvent
{
private final World world;
private final Level world;
private final BlockPos pos;
private final BlockState block;
private final ItemStack stack;
public BonemealEvent(@Nonnull PlayerEntity player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull BlockState block, @Nonnull ItemStack stack)
public BonemealEvent(@Nonnull Player player, @Nonnull Level world, @Nonnull BlockPos pos, @Nonnull BlockState block, @Nonnull ItemStack stack)
{
super(player);
this.world = world;
@@ -56,7 +56,7 @@ public class BonemealEvent extends PlayerEvent
this.stack = stack;
}
public World getWorld()
public Level getWorld()
{
return world;
}
@@ -20,10 +20,8 @@
package net.minecraftforge.event.entity.player;
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.PlayerEntity;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player;
/**
* This event is fired whenever a player attacks an Entity in
@@ -46,7 +44,7 @@ public class CriticalHitEvent extends PlayerEvent
private final Entity target;
private final boolean vanillaCritical;
public CriticalHitEvent(PlayerEntity player, Entity target, float damageModifier, boolean vanillaCritical)
public CriticalHitEvent(Player 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.ItemEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.entity.player.Player;
/**
* This event is called when a player collides with a EntityItem on the ground.
@@ -40,7 +40,7 @@ public class EntityItemPickupEvent extends PlayerEvent
{
private final ItemEntity item;
public EntityItemPickupEvent(PlayerEntity player, ItemEntity item)
public EntityItemPickupEvent(Player player, ItemEntity item)
{
super(player);
this.item = item;
@@ -21,10 +21,10 @@ package net.minecraftforge.event.entity.player;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraftforge.eventbus.api.Event;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.level.Level;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -44,13 +44,13 @@ public class FillBucketEvent extends PlayerEvent
{
private final ItemStack current;
private final World world;
private final Level world;
@Nullable
private final RayTraceResult target;
private final HitResult target;
private ItemStack result;
public FillBucketEvent(PlayerEntity player, @Nonnull ItemStack current, World world, @Nullable RayTraceResult target)
public FillBucketEvent(Player player, @Nonnull ItemStack current, Level world, @Nullable HitResult target)
{
super(player);
this.current = current;
@@ -60,9 +60,9 @@ public class FillBucketEvent extends PlayerEvent
@Nonnull
public ItemStack getEmptyBucket() { return this.current; }
public World getWorld(){ return this.world; }
public Level getWorld(){ return this.world; }
@Nullable
public RayTraceResult getTarget() { return this.target; }
public HitResult getTarget() { return this.target; }
@Nonnull
public ItemStack getFilledBucket() { return this.result; }
public void setFilledBucket(@Nonnull ItemStack bucket) { this.result = bucket; }
@@ -20,9 +20,9 @@
package net.minecraftforge.event.entity.player;
import com.google.common.base.Preconditions;
import net.minecraft.entity.projectile.FishingBobberEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.world.entity.projectile.FishingHook;
import net.minecraft.world.item.ItemStack;
import net.minecraft.core.NonNullList;
import net.minecraftforge.eventbus.api.Cancelable;
import javax.annotation.Nonnegative;
@@ -39,10 +39,10 @@ import java.util.List;
public class ItemFishedEvent extends PlayerEvent
{
private final NonNullList<ItemStack> stacks = NonNullList.create();
private final FishingBobberEntity hook;
private final FishingHook hook;
private int rodDamage;
public ItemFishedEvent(List<ItemStack> stacks, int rodDamage, FishingBobberEntity hook)
public ItemFishedEvent(List<ItemStack> stacks, int rodDamage, FishingHook hook)
{
super(hook.getPlayerOwner());
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 FishingBobberEntity getHookEntity()
public FishingHook getHookEntity()
{
return hook;
}
@@ -21,27 +21,26 @@ package net.minecraftforge.event.entity.player;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.network.chat.Component;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class ItemTooltipEvent extends PlayerEvent
{
private final ITooltipFlag flags;
private final TooltipFlag flags;
@Nonnull
private final ItemStack itemStack;
private final List<ITextComponent> toolTip;
private final List<Component> toolTip;
/**
* This event is fired in {@link ItemStack#getTooltip(EntityPlayer, ITooltipFlag)}, which in turn is called from it's respective GUIContainer.
* Tooltips are also gathered with a null entityPlayer during startup by {@link Minecraft#populateSearchTreeManager()}.
*/
public ItemTooltipEvent(@Nonnull ItemStack itemStack, @Nullable PlayerEntity entityPlayer, List<ITextComponent> list, ITooltipFlag flags)
public ItemTooltipEvent(@Nonnull ItemStack itemStack, @Nullable Player entityPlayer, List<Component> list, TooltipFlag flags)
{
super(entityPlayer);
this.itemStack = itemStack;
@@ -52,7 +51,7 @@ public class ItemTooltipEvent extends PlayerEvent
/**
* Use to determine if the advanced information on item tooltips is being shown, toggled by F3+H.
*/
public ITooltipFlag getFlags()
public TooltipFlag getFlags()
{
return flags;
}
@@ -69,7 +68,7 @@ public class ItemTooltipEvent extends PlayerEvent
/**
* The {@link ItemStack} tooltip.
*/
public List<ITextComponent> getToolTip()
public List<Component> getToolTip()
{
return toolTip;
}
@@ -79,7 +78,7 @@ public class ItemTooltipEvent extends PlayerEvent
*/
@Override
@Nullable
public PlayerEntity getPlayer()
public Player getPlayer()
{
return super.getPlayer();
}
@@ -19,13 +19,13 @@
package net.minecraftforge.event.entity.player;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.container.Container;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu;
public class PlayerContainerEvent extends PlayerEvent
{
private final Container container;
public PlayerContainerEvent(PlayerEntity player, Container container)
private final AbstractContainerMenu container;
public PlayerContainerEvent(Player player, AbstractContainerMenu container)
{
super(player);
this.container = container;
@@ -33,20 +33,20 @@ public class PlayerContainerEvent extends PlayerEvent
public static class Open extends PlayerContainerEvent
{
public Open(PlayerEntity player, Container container)
public Open(Player player, AbstractContainerMenu container)
{
super(player, container);
}
}
public static class Close extends PlayerContainerEvent
{
public Close(PlayerEntity player, Container container)
public Close(Player player, AbstractContainerMenu container)
{
super(player, container);
}
}
public Container getContainer()
public AbstractContainerMenu getContainer()
{
return container;
}
@@ -19,21 +19,9 @@
package net.minecraftforge.event.entity.player;
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.math.BlockPos;
import net.minecraft.world.World;
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.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Hand;
import net.minecraft.util.Direction;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.InteractionHand;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -67,8 +55,8 @@ public class PlayerDestroyItemEvent extends PlayerEvent
@Nonnull
private final ItemStack original;
@Nullable
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)
private final InteractionHand hand; // May be null if this player destroys the item by any use besides holding it.
public PlayerDestroyItemEvent(Player player, @Nonnull ItemStack original, @Nullable InteractionHand hand)
{
super(player);
this.original = original;
@@ -78,6 +66,6 @@ public class PlayerDestroyItemEvent extends PlayerEvent
@Nonnull
public ItemStack getOriginal() { return this.original; }
@Nullable
public Hand getHand() { return this.hand; }
public InteractionHand getHand() { return this.hand; }
}
@@ -21,23 +21,19 @@ package net.minecraftforge.event.entity.player;
import java.io.File;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.RegistryKey;
import net.minecraft.world.GameType;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.ForgeEventFactory;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.Container;
import net.minecraft.world.item.ItemStack;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.level.GameType;
import net.minecraft.world.level.Level;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraftforge.event.entity.living.LivingEvent;
import net.minecraftforge.eventbus.api.Event;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -51,8 +47,8 @@ import javax.annotation.Nullable;
**/
public class PlayerEvent extends LivingEvent
{
private final PlayerEntity entityPlayer;
public PlayerEvent(PlayerEntity player)
private final Player entityPlayer;
public PlayerEvent(Player player)
{
super(player);
entityPlayer = player;
@@ -61,7 +57,7 @@ public class PlayerEvent extends LivingEvent
/**
* @return Player
*/
public PlayerEntity getPlayer() { return entityPlayer; }
public Player getPlayer() { return entityPlayer; }
/**
* HarvestCheck is fired when a player attempts to harvest a block.<br>
* This event is fired whenever a player attempts to harvest a block in
@@ -83,7 +79,7 @@ public class PlayerEvent extends LivingEvent
private final BlockState state;
private boolean success;
public HarvestCheck(PlayerEntity player, BlockState state, boolean success)
public HarvestCheck(Player player, BlockState state, boolean success)
{
super(player);
this.state = state;
@@ -122,7 +118,7 @@ public class PlayerEvent extends LivingEvent
private float newSpeed = 0.0f;
private final BlockPos pos; // Y position of -1 notes unknown location
public BreakSpeed(PlayerEntity player, BlockState state, float original, BlockPos pos)
public BreakSpeed(Player player, BlockState state, float original, BlockPos pos)
{
super(player);
this.state = state;
@@ -156,27 +152,27 @@ public class PlayerEvent extends LivingEvent
**/
public static class NameFormat extends PlayerEvent
{
private final ITextComponent username;
private ITextComponent displayname;
private final Component username;
private Component displayname;
public NameFormat(PlayerEntity player, ITextComponent username)
public NameFormat(Player player, Component username)
{
super(player);
this.username = username;
this.setDisplayname(username);
}
public ITextComponent getUsername()
public Component getUsername()
{
return username;
}
public ITextComponent getDisplayname()
public Component getDisplayname()
{
return displayname;
}
public void setDisplayname(ITextComponent displayname)
public void setDisplayname(Component displayname)
{
this.displayname = displayname;
}
@@ -200,20 +196,20 @@ public class PlayerEvent extends LivingEvent
public static class TabListNameFormat extends PlayerEvent
{
@Nullable
private ITextComponent displayName;
private Component displayName;
public TabListNameFormat(PlayerEntity player)
public TabListNameFormat(Player player)
{
super(player);
}
@Nullable
public ITextComponent getDisplayName()
public Component getDisplayName()
{
return displayName;
}
public void setDisplayName(@Nullable ITextComponent displayName)
public void setDisplayName(@Nullable Component displayName)
{
this.displayName = displayName;
}
@@ -225,10 +221,10 @@ public class PlayerEvent extends LivingEvent
*/
public static class Clone extends PlayerEvent
{
private final PlayerEntity original;
private final Player original;
private final boolean wasDeath;
public Clone(PlayerEntity _new, PlayerEntity oldPlayer, boolean wasDeath)
public Clone(Player _new, Player oldPlayer, boolean wasDeath)
{
super(_new);
this.original = oldPlayer;
@@ -238,7 +234,7 @@ public class PlayerEvent extends LivingEvent
/**
* The old EntityPlayer that this new entity is a clone of.
*/
public PlayerEntity getOriginal()
public Player getOriginal()
{
return original;
}
@@ -261,7 +257,7 @@ public class PlayerEvent extends LivingEvent
private final Entity target;
public StartTracking(PlayerEntity player, Entity target)
public StartTracking(Player player, Entity target)
{
super(player);
this.target = target;
@@ -284,7 +280,7 @@ public class PlayerEvent extends LivingEvent
private final Entity target;
public StopTracking(PlayerEntity player, Entity target)
public StopTracking(Player player, Entity target)
{
super(player);
this.target = target;
@@ -309,7 +305,7 @@ public class PlayerEvent extends LivingEvent
private final File playerDirectory;
private final String playerUUID;
public LoadFromFile(PlayerEntity player, File originDirectory, String playerUUID)
public LoadFromFile(Player player, File originDirectory, String playerUUID)
{
super(player);
this.playerDirectory = originDirectory;
@@ -362,7 +358,7 @@ public class PlayerEvent extends LivingEvent
private final File playerDirectory;
private final String playerUUID;
public SaveToFile(PlayerEntity player, File originDirectory, String playerUUID)
public SaveToFile(Player player, File originDirectory, String playerUUID)
{
super(player);
this.playerDirectory = originDirectory;
@@ -399,40 +395,6 @@ public class PlayerEvent extends LivingEvent
}
}
/**
* TODO 1.17 remove, unused
* Fired when the world checks if a player is near enough to be attacked by an entity.
* The resulting visibility modifier is multiplied by the one calculated by Minecraft (based on sneaking and more) and used to calculate the radius a player has to be in (targetDistance*modifier).
* This can also be used to increase the visibility of a player, if it was decreased by Minecraft or other mods. But the resulting value cannot be higher than the standard target distance.
*/
@Deprecated
public static class Visibility extends PlayerEvent
{
private double visibilityModifier = 1D;
public Visibility(PlayerEntity player)
{
super(player);
}
/**
* @param mod Is multiplied with the current modifier
*/
public void modifyVisibility(double mod)
{
visibilityModifier *= mod;
}
/**
* @return The current modifier
*/
public double getVisibilityModifier()
{
return visibilityModifier;
}
}
public static class ItemPickupEvent extends PlayerEvent {
/**
* Original EntityItem with current remaining stack size
@@ -442,7 +404,7 @@ public class PlayerEvent extends LivingEvent
* Clone item stack, containing the item and amount picked up
*/
private final ItemStack stack;
public ItemPickupEvent(PlayerEntity player, ItemEntity entPickedUp, ItemStack stack)
public ItemPickupEvent(Player player, ItemEntity entPickedUp, ItemStack stack)
{
super(player);
this.originalEntity = entPickedUp;
@@ -461,8 +423,8 @@ public class PlayerEvent extends LivingEvent
public static class ItemCraftedEvent extends PlayerEvent {
@Nonnull
private final ItemStack crafting;
private final IInventory craftMatrix;
public ItemCraftedEvent(PlayerEntity player, @Nonnull ItemStack crafting, IInventory craftMatrix)
private final Container craftMatrix;
public ItemCraftedEvent(Player player, @Nonnull ItemStack crafting, Container craftMatrix)
{
super(player);
this.crafting = crafting;
@@ -475,7 +437,7 @@ public class PlayerEvent extends LivingEvent
return this.crafting;
}
public IInventory getInventory()
public Container getInventory()
{
return this.craftMatrix;
}
@@ -484,7 +446,7 @@ public class PlayerEvent extends LivingEvent
public static class ItemSmeltedEvent extends PlayerEvent {
@Nonnull
private final ItemStack smelting;
public ItemSmeltedEvent(PlayerEntity player, @Nonnull ItemStack crafting)
public ItemSmeltedEvent(Player player, @Nonnull ItemStack crafting)
{
super(player);
this.smelting = crafting;
@@ -498,14 +460,14 @@ public class PlayerEvent extends LivingEvent
}
public static class PlayerLoggedInEvent extends PlayerEvent {
public PlayerLoggedInEvent(PlayerEntity player)
public PlayerLoggedInEvent(Player player)
{
super(player);
}
}
public static class PlayerLoggedOutEvent extends PlayerEvent {
public PlayerLoggedOutEvent(PlayerEntity player)
public PlayerLoggedOutEvent(Player player)
{
super(player);
}
@@ -514,7 +476,7 @@ public class PlayerEvent extends LivingEvent
public static class PlayerRespawnEvent extends PlayerEvent {
private final boolean endConquered;
public PlayerRespawnEvent(PlayerEntity player, boolean endConquered)
public PlayerRespawnEvent(Player player, boolean endConquered)
{
super(player);
this.endConquered = endConquered;
@@ -533,21 +495,21 @@ public class PlayerEvent extends LivingEvent
}
public static class PlayerChangedDimensionEvent extends PlayerEvent {
private final RegistryKey<World> fromDim;
private final RegistryKey<World> toDim;
public PlayerChangedDimensionEvent(PlayerEntity player, RegistryKey<World> fromDim, RegistryKey<World> toDim)
private final ResourceKey<Level> fromDim;
private final ResourceKey<Level> toDim;
public PlayerChangedDimensionEvent(Player player, ResourceKey<Level> fromDim, ResourceKey<Level> toDim)
{
super(player);
this.fromDim = fromDim;
this.toDim = toDim;
}
public RegistryKey<World> getFrom()
public ResourceKey<Level> getFrom()
{
return this.fromDim;
}
public RegistryKey<World> getTo()
public ResourceKey<Level> getTo()
{
return this.toDim;
}
@@ -563,7 +525,7 @@ public class PlayerEvent extends LivingEvent
private final GameType currentGameMode;
private GameType newGameMode;
public PlayerChangeGameModeEvent(PlayerEntity player, GameType currentGameMode, GameType newGameMode)
public PlayerChangeGameModeEvent(Player player, GameType currentGameMode, GameType newGameMode)
{
super(player);
this.currentGameMode = currentGameMode;
@@ -19,7 +19,7 @@
package net.minecraftforge.event.entity.player;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.world.entity.player.Player;
/**
* 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(PlayerEntity player, float distance, float multiplier)
public PlayerFlyableFallEvent(Player player, float distance, float multiplier)
{
super(player);
this.distance = distance;
@@ -20,19 +20,16 @@
package net.minecraftforge.event.entity.player;
import com.google.common.base.Preconditions;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
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.BlockRayTraceResult;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.InteractionResult;
import net.minecraft.core.Direction;
import net.minecraft.world.InteractionHand;
import net.minecraft.core.BlockPos;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.level.Level;
import net.minecraftforge.eventbus.api.Cancelable;
import javax.annotation.Nonnull;
@@ -50,13 +47,13 @@ import net.minecraftforge.fml.LogicalSide;
**/
public class PlayerInteractEvent extends PlayerEvent
{
private final Hand hand;
private final InteractionHand hand;
private final BlockPos pos;
@Nullable
private final Direction face;
private ActionResultType cancellationResult = ActionResultType.PASS;
private InteractionResult cancellationResult = InteractionResult.PASS;
private PlayerInteractEvent(PlayerEntity player, Hand hand, BlockPos pos, @Nullable Direction face)
private PlayerInteractEvent(Player player, InteractionHand hand, BlockPos pos, @Nullable Direction face)
{
super(Preconditions.checkNotNull(player, "Null player in PlayerInteractEvent!"));
this.hand = Preconditions.checkNotNull(hand, "Null hand in PlayerInteractEvent!");
@@ -76,10 +73,10 @@ public class PlayerInteractEvent extends PlayerEvent
@Cancelable
public static class EntityInteractSpecific extends PlayerInteractEvent
{
private final Vector3d localPos;
private final Vec3 localPos;
private final Entity target;
public EntityInteractSpecific(PlayerEntity player, Hand hand, Entity target, Vector3d localPos)
public EntityInteractSpecific(Player player, InteractionHand hand, Entity target, Vec3 localPos)
{
super(player, hand, target.blockPosition(), null);
this.localPos = localPos;
@@ -92,7 +89,7 @@ public class PlayerInteractEvent extends PlayerEvent
* [-width / 2, width / 2] while Y values will be in the range [0, height]
* @return The local position
*/
public Vector3d getLocalPos()
public Vec3 getLocalPos()
{
return localPos;
}
@@ -119,7 +116,7 @@ public class PlayerInteractEvent extends PlayerEvent
{
private final Entity target;
public EntityInteract(PlayerEntity player, Hand hand, Entity target)
public EntityInteract(Player player, InteractionHand hand, Entity target)
{
super(player, hand, target.blockPosition(), null);
this.target = target;
@@ -149,14 +146,9 @@ public class PlayerInteractEvent extends PlayerEvent
{
private Result useBlock = DEFAULT;
private Result useItem = DEFAULT;
private BlockRayTraceResult hitVec;
private BlockHitResult hitVec;
@Deprecated //Use RayTraceResult version. TODO: Remove 1.17
public RightClickBlock(PlayerEntity player, Hand hand, BlockPos pos, Direction face) {
super(player, hand, pos, face);
}
public RightClickBlock(PlayerEntity player, Hand hand, BlockPos pos, BlockRayTraceResult hitVec) {
public RightClickBlock(Player player, InteractionHand hand, BlockPos pos, BlockHitResult hitVec) {
super(player, hand, pos, hitVec.getDirection());
this.hitVec = hitVec;
}
@@ -180,7 +172,7 @@ public class PlayerInteractEvent extends PlayerEvent
/**
* @return The ray trace result targeting the block.
*/
public BlockRayTraceResult getHitVec()
public BlockHitResult getHitVec()
{
return hitVec;
}
@@ -228,7 +220,7 @@ public class PlayerInteractEvent extends PlayerEvent
@Cancelable
public static class RightClickItem extends PlayerInteractEvent
{
public RightClickItem(PlayerEntity player, Hand hand)
public RightClickItem(Player player, InteractionHand hand)
{
super(player, hand, player.blockPosition(), null);
}
@@ -241,7 +233,7 @@ public class PlayerInteractEvent extends PlayerEvent
*/
public static class RightClickEmpty extends PlayerInteractEvent
{
public RightClickEmpty(PlayerEntity player, Hand hand)
public RightClickEmpty(Player player, InteractionHand hand)
{
super(player, hand, player.blockPosition(), null);
}
@@ -265,9 +257,9 @@ public class PlayerInteractEvent extends PlayerEvent
private Result useBlock = DEFAULT;
private Result useItem = DEFAULT;
public LeftClickBlock(PlayerEntity player, BlockPos pos, Direction face)
public LeftClickBlock(Player player, BlockPos pos, Direction face)
{
super(player, Hand.MAIN_HAND, pos, face);
super(player, InteractionHand.MAIN_HAND, pos, face);
}
/**
@@ -315,9 +307,9 @@ public class PlayerInteractEvent extends PlayerEvent
*/
public static class LeftClickEmpty extends PlayerInteractEvent
{
public LeftClickEmpty(PlayerEntity player)
public LeftClickEmpty(Player player)
{
super(player, Hand.MAIN_HAND, player.blockPosition(), null);
super(player, InteractionHand.MAIN_HAND, player.blockPosition(), null);
}
}
@@ -325,7 +317,7 @@ public class PlayerInteractEvent extends PlayerEvent
* @return The hand involved in this interaction. Will never be null.
*/
@Nonnull
public Hand getHand()
public InteractionHand getHand()
{
return hand;
}
@@ -364,7 +356,7 @@ public class PlayerInteractEvent extends PlayerEvent
/**
* @return Convenience method to get the world of this interaction.
*/
public World getWorld()
public Level getWorld()
{
return getPlayer().getCommandSenderWorld();
}
@@ -382,7 +374,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 ActionResultType getCancellationResult()
public InteractionResult getCancellationResult()
{
return cancellationResult;
}
@@ -392,7 +384,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(ActionResultType result)
public void setCancellationResult(InteractionResult result)
{
this.cancellationResult = result;
}
@@ -19,10 +19,10 @@
package net.minecraftforge.event.entity.player;
import net.minecraft.util.RegistryKey;
import net.minecraft.world.World;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.level.Level;
import net.minecraft.world.entity.player.Player;
import net.minecraft.core.BlockPos;
import net.minecraftforge.eventbus.api.Cancelable;
import javax.annotation.Nullable;
@@ -34,12 +34,12 @@ import javax.annotation.Nullable;
@Cancelable
public class PlayerSetSpawnEvent extends PlayerEvent
{
private final RegistryKey<World> spawnWorld;
private final ResourceKey<Level> spawnWorld;
private final boolean forced;
@Nullable
private final BlockPos newSpawn;
public PlayerSetSpawnEvent(PlayerEntity player, RegistryKey<World> spawnWorld, @Nullable BlockPos newSpawn, boolean forced)
public PlayerSetSpawnEvent(Player player, ResourceKey<Level> spawnWorld, @Nullable BlockPos newSpawn, boolean forced)
{
super(player);
this.spawnWorld = spawnWorld;
@@ -61,7 +61,7 @@ public class PlayerSetSpawnEvent extends PlayerEvent
return newSpawn;
}
public RegistryKey<World> getSpawnWorld()
public ResourceKey<Level> getSpawnWorld()
{
return spawnWorld;
}
@@ -19,10 +19,9 @@
package net.minecraftforge.event.entity.player;
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.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.player.Player.BedSleepingProblem;
import net.minecraft.core.BlockPos;
import java.util.Optional;
@@ -40,21 +39,21 @@ import java.util.Optional;
**/
public class PlayerSleepInBedEvent extends PlayerEvent
{
private SleepResult result = null;
private BedSleepingProblem result = null;
private final Optional<BlockPos> pos;
public PlayerSleepInBedEvent(PlayerEntity player, Optional<BlockPos> pos)
public PlayerSleepInBedEvent(Player player, Optional<BlockPos> pos)
{
super(player);
this.pos = pos;
}
public SleepResult getResultStatus()
public BedSleepingProblem getResultStatus()
{
return result;
}
public void setResult(SleepResult result)
public void setResult(BedSleepingProblem result)
{
this.result = result;
}
@@ -19,7 +19,7 @@
package net.minecraftforge.event.entity.player;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.world.entity.player.Player;
/**
* This event is fired when the player is waking up.<br/>
@@ -32,7 +32,7 @@ public class PlayerWakeUpEvent extends PlayerEvent
private final boolean updateWorld;
public PlayerWakeUpEvent(PlayerEntity player, boolean wakeImmediately, boolean updateWorld)
public PlayerWakeUpEvent(Player player, boolean wakeImmediately, boolean updateWorld)
{
super(player);
this.wakeImmediately = wakeImmediately;
@@ -19,9 +19,8 @@
package net.minecraftforge.event.entity.player;
import net.minecraft.entity.item.ExperienceOrbEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraftforge.common.MinecraftForge;
import net.minecraft.world.entity.ExperienceOrb;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.eventbus.api.Cancelable;
/**
@@ -34,7 +33,7 @@ import net.minecraftforge.eventbus.api.Cancelable;
public class PlayerXpEvent extends PlayerEvent
{
public PlayerXpEvent(PlayerEntity player)
public PlayerXpEvent(Player player)
{
super(player);
}
@@ -47,15 +46,15 @@ public class PlayerXpEvent extends PlayerEvent
public static class PickupXp extends PlayerXpEvent
{
private final ExperienceOrbEntity orb;
private final ExperienceOrb orb;
public PickupXp(PlayerEntity player, ExperienceOrbEntity orb)
public PickupXp(Player player, ExperienceOrb orb)
{
super(player);
this.orb = orb;
}
public ExperienceOrbEntity getOrb()
public ExperienceOrb getOrb()
{
return orb;
}
@@ -72,7 +71,7 @@ public class PlayerXpEvent extends PlayerEvent
private int amount;
public XpChange(PlayerEntity player, int amount)
public XpChange(Player player, int amount)
{
super(player);
this.amount = amount;
@@ -100,7 +99,7 @@ public class PlayerXpEvent extends PlayerEvent
private int levels;
public LevelChange(PlayerEntity player, int levels)
public LevelChange(Player player, int levels)
{
super(player);
this.levels = levels;
@@ -19,10 +19,8 @@
package net.minecraftforge.event.entity.player;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.core.BlockPos;
import net.minecraftforge.event.entity.living.LivingEvent;
import net.minecraftforge.eventbus.api.Event.HasResult;
@@ -19,9 +19,8 @@
package net.minecraftforge.event.entity.player;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.entity.player.Player;
import net.minecraft.core.BlockPos;
import net.minecraftforge.eventbus.api.Event.HasResult;
import java.util.Optional;
@@ -40,7 +39,7 @@ public class SleepingTimeCheckEvent extends PlayerEvent
{
private final Optional<BlockPos> sleepingLocation;
public SleepingTimeCheckEvent(PlayerEntity player, Optional<BlockPos> sleepingLocation)
public SleepingTimeCheckEvent(Player player, Optional<BlockPos> sleepingLocation)
{
super(player);
this.sleepingLocation = sleepingLocation;
@@ -19,7 +19,7 @@
package net.minecraftforge.event.entity.player;
import net.minecraft.item.ItemUseContext;
import net.minecraft.world.item.context.UseOnContext;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraftforge.eventbus.api.Event.HasResult;
@@ -41,16 +41,16 @@ import javax.annotation.Nonnull;
@Deprecated
public class UseHoeEvent extends PlayerEvent
{
private final ItemUseContext context;;
private final UseOnContext context;;
public UseHoeEvent(ItemUseContext context)
public UseHoeEvent(UseOnContext context)
{
super(context.getPlayer());
this.context = context;
}
@Nonnull
public ItemUseContext getContext()
public UseOnContext getContext()
{
return context;
}