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

@@ -22,6 +22,12 @@ package net.minecraftforge.event;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.eventbus.api.GenericEvent;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
@@ -19,7 +19,7 @@
package net.minecraftforge.event;
import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.Difficulty;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Cancelable;
@@ -39,21 +39,21 @@ import net.minecraftforge.eventbus.api.Event.HasResult;
**/
public class DifficultyChangeEvent extends net.minecraftforge.eventbus.api.Event
{
private final EnumDifficulty difficulty;
private final EnumDifficulty oldDifficulty;
private final Difficulty difficulty;
private final Difficulty oldDifficulty;
public DifficultyChangeEvent(EnumDifficulty difficulty, EnumDifficulty oldDifficulty)
public DifficultyChangeEvent(Difficulty difficulty, Difficulty oldDifficulty)
{
this.difficulty = difficulty;
this.oldDifficulty = oldDifficulty;
}
public EnumDifficulty getDifficulty()
public Difficulty getDifficulty()
{
return difficulty;
}
public EnumDifficulty getOldDifficulty()
public Difficulty getOldDifficulty()
{
return oldDifficulty;
}
@@ -20,59 +20,57 @@
package net.minecraftforge.event;
import java.io.File;
import java.util.Collection;
import java.util.EnumSet;
import java.util.List;
import java.util.Random;
import java.util.*;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.block.BlockPortal;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.NetherPortalBlock;
import net.minecraft.block.BlockState;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.entity.IMerchant;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayer.SleepResult;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.entity.projectile.EntityFireball;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.init.Blocks;
import net.minecraft.entity.MobEntity;
import net.minecraft.entity.SpawnReason;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.EntityClassification;
import net.minecraft.entity.merchant.IMerchant;
import net.minecraft.entity.effect.LightningBoltEntity;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.monster.ZombieEntity;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerEntity.SleepResult;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.entity.projectile.AbstractArrowEntity;
import net.minecraft.entity.projectile.DamagingProjectileEntity;
import net.minecraft.entity.projectile.ThrowableEntity;
import net.minecraft.block.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.tileentity.MobSpawnerBaseLogic;
import net.minecraft.world.spawner.AbstractSpawner;
import net.minecraft.util.ActionResult;
import net.minecraft.util.DamageSource;
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.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.ChatType;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.village.MerchantRecipeList;
import net.minecraft.village.Village;
import net.minecraft.world.Explosion;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraft.world.ServerWorld;
import net.minecraft.world.WorldSettings;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.chunk.IChunk;
import net.minecraft.world.gen.IChunkGenerator;
import net.minecraft.world.gen.ChunkGenerator;
import net.minecraft.world.storage.IPlayerFileData;
import net.minecraft.world.storage.SaveHandler;
import net.minecraft.world.storage.loot.LootTable;
@@ -110,7 +108,6 @@ import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
import net.minecraftforge.event.entity.player.FillBucketEvent;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
import net.minecraftforge.event.entity.player.PlayerDropsEvent;
import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.event.entity.player.PlayerFlyableFallEvent;
import net.minecraftforge.event.entity.player.PlayerSetSpawnEvent;
@@ -120,13 +117,12 @@ import net.minecraftforge.event.entity.player.SleepingLocationCheckEvent;
import net.minecraftforge.event.entity.player.SleepingTimeCheckEvent;
import net.minecraftforge.event.entity.player.UseHoeEvent;
import net.minecraftforge.event.furnace.FurnaceFuelBurnTimeEvent;
import net.minecraftforge.event.terraingen.ChunkGeneratorEvent;
import net.minecraftforge.event.village.MerchantTradeOffersEvent;
import net.minecraftforge.event.world.BlockEvent;
import net.minecraftforge.event.world.BlockEvent.CreateFluidSourceEvent;
import net.minecraftforge.event.world.BlockEvent.EntityMultiPlaceEvent;
import net.minecraftforge.event.world.BlockEvent.EntityPlaceEvent;
import net.minecraftforge.event.world.BlockEvent.NeighborNotifyEvent;
import net.minecraftforge.event.world.ChunkWatchEvent;
import net.minecraftforge.event.world.ExplosionEvent;
import net.minecraftforge.event.world.GetCollisionBoxesEvent;
import net.minecraftforge.event.world.SaplingGrowTreeEvent;
@@ -137,47 +133,47 @@ import net.minecraftforge.eventbus.api.Event.Result;
public class ForgeEventFactory
{
public static boolean onMultiBlockPlace(@Nullable Entity entity, List<BlockSnapshot> blockSnapshots, EnumFacing direction)
public static boolean onMultiBlockPlace(@Nullable Entity entity, List<BlockSnapshot> blockSnapshots, Direction direction)
{
BlockSnapshot snap = blockSnapshots.get(0);
IBlockState placedAgainst = snap.getWorld().getBlockState(snap.getPos().offset(direction.getOpposite()));
BlockState placedAgainst = snap.getWorld().getBlockState(snap.getPos().offset(direction.getOpposite()));
EntityMultiPlaceEvent event = new EntityMultiPlaceEvent(blockSnapshots, placedAgainst, entity);
return MinecraftForge.EVENT_BUS.post(event);
}
public static boolean onBlockPlace(@Nullable Entity entity, @Nonnull BlockSnapshot blockSnapshot, @Nonnull EnumFacing direction)
public static boolean onBlockPlace(@Nullable Entity entity, @Nonnull BlockSnapshot blockSnapshot, @Nonnull Direction direction)
{
IBlockState placedAgainst = blockSnapshot.getWorld().getBlockState(blockSnapshot.getPos().offset(direction.getOpposite()));
BlockState placedAgainst = blockSnapshot.getWorld().getBlockState(blockSnapshot.getPos().offset(direction.getOpposite()));
EntityPlaceEvent event = new BlockEvent.EntityPlaceEvent(blockSnapshot, placedAgainst, entity);
return MinecraftForge.EVENT_BUS.post(event);
}
public static NeighborNotifyEvent onNeighborNotify(World world, BlockPos pos, IBlockState state, EnumSet<EnumFacing> notifiedSides, boolean forceRedstoneUpdate)
public static NeighborNotifyEvent onNeighborNotify(World world, BlockPos pos, BlockState state, EnumSet<Direction> notifiedSides, boolean forceRedstoneUpdate)
{
NeighborNotifyEvent event = new NeighborNotifyEvent(world, pos, state, notifiedSides, forceRedstoneUpdate);
MinecraftForge.EVENT_BUS.post(event);
return event;
}
public static boolean doPlayerHarvestCheck(EntityPlayer player, IBlockState state, boolean success)
public static boolean doPlayerHarvestCheck(PlayerEntity player, BlockState state, boolean success)
{
PlayerEvent.HarvestCheck event = new PlayerEvent.HarvestCheck(player, state, success);
MinecraftForge.EVENT_BUS.post(event);
return event.canHarvest();
}
public static float getBreakSpeed(EntityPlayer player, IBlockState state, float original, BlockPos pos)
public static float getBreakSpeed(PlayerEntity player, BlockState state, float original, BlockPos pos)
{
PlayerEvent.BreakSpeed event = new PlayerEvent.BreakSpeed(player, state, original, pos);
return (MinecraftForge.EVENT_BUS.post(event) ? -1 : event.getNewSpeed());
}
public static void onPlayerDestroyItem(EntityPlayer player, @Nonnull ItemStack stack, @Nullable EnumHand hand)
public static void onPlayerDestroyItem(PlayerEntity player, @Nonnull ItemStack stack, @Nullable Hand hand)
{
MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(player, stack, hand));
}
public static Result canEntitySpawn(EntityLiving entity, IWorld world, double x, double y, double z, MobSpawnerBaseLogic spawner)
public static Result canEntitySpawn(MobEntity entity, IWorld world, double x, double y, double z, AbstractSpawner spawner)
{
if (entity == null)
return Result.DEFAULT;
@@ -186,21 +182,21 @@ public class ForgeEventFactory
return event.getResult();
}
public static boolean canEntitySpawnSpawner(EntityLiving entity, World world, float x, float y, float z, MobSpawnerBaseLogic spawner)
public static boolean canEntitySpawnSpawner(MobEntity entity, World world, float x, float y, float z, AbstractSpawner spawner)
{
Result result = canEntitySpawn(entity, world, x, y, z, spawner);
if (result == Result.DEFAULT)
return entity.canSpawn(world, true) && entity.isNotColliding(); // vanilla logic
return entity.func_213380_a(world, SpawnReason.SPAWNER) || !entity.isNotColliding(world); // vanilla logic
else
return result == Result.ALLOW;
}
public static boolean doSpecialSpawn(EntityLiving entity, World world, float x, float y, float z, MobSpawnerBaseLogic spawner)
public static boolean doSpecialSpawn(MobEntity entity, World world, float x, float y, float z, AbstractSpawner spawner)
{
return MinecraftForge.EVENT_BUS.post(new LivingSpawnEvent.SpecialSpawn(entity, world, x, y, z, spawner));
}
public static Result canEntityDespawn(EntityLiving entity)
public static Result canEntityDespawn(MobEntity entity)
{
AllowDespawn event = new AllowDespawn(entity);
MinecraftForge.EVENT_BUS.post(event);
@@ -214,7 +210,7 @@ public class ForgeEventFactory
return event.getBurnTime();
}
public static int getExperienceDrop(EntityLivingBase entity, EntityPlayer attackingPlayer, int originalExperience)
public static int getExperienceDrop(LivingEntity entity, PlayerEntity attackingPlayer, int originalExperience)
{
LivingExperienceDropEvent event = new LivingExperienceDropEvent(entity, attackingPlayer, originalExperience);
if (MinecraftForge.EVENT_BUS.post(event))
@@ -225,110 +221,108 @@ public class ForgeEventFactory
}
@Nullable
public static List<Biome.SpawnListEntry> getPotentialSpawns(WorldServer world, EnumCreatureType type, BlockPos pos, List<Biome.SpawnListEntry> oldList)
public static List<Biome.SpawnListEntry> getPotentialSpawns(IWorld world, EntityClassification type, BlockPos pos, List<Biome.SpawnListEntry> oldList)
{
WorldEvent.PotentialSpawns event = new WorldEvent.PotentialSpawns(world, type, pos, oldList);
if (MinecraftForge.EVENT_BUS.post(event))
{
return null;
}
return Collections.emptyList();
return event.getList();
}
public static int getMaxSpawnPackSize(EntityLiving entity)
public static int getMaxSpawnPackSize(MobEntity entity)
{
LivingPackSizeEvent maxCanSpawnEvent = new LivingPackSizeEvent(entity);
MinecraftForge.EVENT_BUS.post(maxCanSpawnEvent);
return maxCanSpawnEvent.getResult() == Result.ALLOW ? maxCanSpawnEvent.getMaxPackSize() : entity.getMaxSpawnedInChunk();
}
public static String getPlayerDisplayName(EntityPlayer player, String username)
public static String getPlayerDisplayName(PlayerEntity player, String username)
{
PlayerEvent.NameFormat event = new PlayerEvent.NameFormat(player, username);
MinecraftForge.EVENT_BUS.post(event);
return event.getDisplayname();
}
public static float fireBlockHarvesting(NonNullList<ItemStack> drops, World world, BlockPos pos, IBlockState state, int fortune, float dropChance, boolean silkTouch, EntityPlayer player)
public static float fireBlockHarvesting(NonNullList<ItemStack> drops, World world, BlockPos pos, BlockState state, int fortune, float dropChance, boolean silkTouch, PlayerEntity player)
{
BlockEvent.HarvestDropsEvent event = new BlockEvent.HarvestDropsEvent(world, pos, state, fortune, dropChance, drops, player, silkTouch);
MinecraftForge.EVENT_BUS.post(event);
return event.getDropChance();
}
public static IBlockState fireFluidPlaceBlockEvent(World world, BlockPos pos, BlockPos liquidPos, IBlockState state)
public static BlockState fireFluidPlaceBlockEvent(World world, BlockPos pos, BlockPos liquidPos, BlockState state)
{
BlockEvent.FluidPlaceBlockEvent event = new BlockEvent.FluidPlaceBlockEvent(world, pos, liquidPos, state);
MinecraftForge.EVENT_BUS.post(event);
return event.getNewState();
}
public static ItemTooltipEvent onItemTooltip(ItemStack itemStack, @Nullable EntityPlayer entityPlayer, List<ITextComponent> list, ITooltipFlag flags)
public static ItemTooltipEvent onItemTooltip(ItemStack itemStack, @Nullable PlayerEntity entityPlayer, List<ITextComponent> list, ITooltipFlag flags)
{
ItemTooltipEvent event = new ItemTooltipEvent(itemStack, entityPlayer, list, flags);
MinecraftForge.EVENT_BUS.post(event);
return event;
}
public static SummonAidEvent fireZombieSummonAid(EntityZombie zombie, World world, int x, int y, int z, EntityLivingBase attacker, double summonChance)
public static SummonAidEvent fireZombieSummonAid(ZombieEntity zombie, World world, int x, int y, int z, LivingEntity attacker, double summonChance)
{
SummonAidEvent summonEvent = new SummonAidEvent(zombie, world, x, y, z, attacker, summonChance);
MinecraftForge.EVENT_BUS.post(summonEvent);
return summonEvent;
}
public static boolean onEntityStruckByLightning(Entity entity, EntityLightningBolt bolt)
public static boolean onEntityStruckByLightning(Entity entity, LightningBoltEntity bolt)
{
return MinecraftForge.EVENT_BUS.post(new EntityStruckByLightningEvent(entity, bolt));
}
public static int onItemUseStart(EntityLivingBase entity, ItemStack item, int duration)
public static int onItemUseStart(LivingEntity entity, ItemStack item, int duration)
{
LivingEntityUseItemEvent event = new LivingEntityUseItemEvent.Start(entity, item, duration);
return MinecraftForge.EVENT_BUS.post(event) ? -1 : event.getDuration();
}
public static int onItemUseTick(EntityLivingBase entity, ItemStack item, int duration)
public static int onItemUseTick(LivingEntity entity, ItemStack item, int duration)
{
LivingEntityUseItemEvent event = new LivingEntityUseItemEvent.Tick(entity, item, duration);
return MinecraftForge.EVENT_BUS.post(event) ? -1 : event.getDuration();
}
public static boolean onUseItemStop(EntityLivingBase entity, ItemStack item, int duration)
public static boolean onUseItemStop(LivingEntity entity, ItemStack item, int duration)
{
return MinecraftForge.EVENT_BUS.post(new LivingEntityUseItemEvent.Stop(entity, item, duration));
}
public static ItemStack onItemUseFinish(EntityLivingBase entity, ItemStack item, int duration, ItemStack result)
public static ItemStack onItemUseFinish(LivingEntity entity, ItemStack item, int duration, ItemStack result)
{
LivingEntityUseItemEvent.Finish event = new LivingEntityUseItemEvent.Finish(entity, item, duration, result);
MinecraftForge.EVENT_BUS.post(event);
return event.getResultStack();
}
public static void onStartEntityTracking(Entity entity, EntityPlayer player)
public static void onStartEntityTracking(Entity entity, PlayerEntity player)
{
MinecraftForge.EVENT_BUS.post(new PlayerEvent.StartTracking(player, entity));
}
public static void onStopEntityTracking(Entity entity, EntityPlayer player)
public static void onStopEntityTracking(Entity entity, PlayerEntity player)
{
MinecraftForge.EVENT_BUS.post(new PlayerEvent.StopTracking(player, entity));
}
public static void firePlayerLoadingEvent(EntityPlayer player, File playerDirectory, String uuidString)
public static void firePlayerLoadingEvent(PlayerEntity player, File playerDirectory, String uuidString)
{
MinecraftForge.EVENT_BUS.post(new PlayerEvent.LoadFromFile(player, playerDirectory, uuidString));
}
public static void firePlayerSavingEvent(EntityPlayer player, File playerDirectory, String uuidString)
public static void firePlayerSavingEvent(PlayerEntity player, File playerDirectory, String uuidString)
{
MinecraftForge.EVENT_BUS.post(new PlayerEvent.SaveToFile(player, playerDirectory, uuidString));
}
public static void firePlayerLoadingEvent(EntityPlayer player, IPlayerFileData playerFileData, String uuidString)
public static void firePlayerLoadingEvent(PlayerEntity player, IPlayerFileData playerFileData, String uuidString)
{
MinecraftForge.EVENT_BUS.post(new PlayerEvent.LoadFromFile(player, ((SaveHandler)playerFileData).playersDirectory, uuidString));
MinecraftForge.EVENT_BUS.post(new PlayerEvent.LoadFromFile(player, ((SaveHandler)playerFileData).getPlayerFolder(), uuidString));
}
@Nullable
@@ -351,14 +345,13 @@ public class ForgeEventFactory
if (MinecraftForge.EVENT_BUS.post(event)) return -1;
if (event.getResult() == Result.ALLOW)
{
context.getItem().damageItem(1, context.getPlayer());
context.getItem().func_222118_a(1, context.getPlayer(), player -> player.func_213334_d(context.func_221531_n()));
return 1;
}
return 0;
}
public static int onApplyBonemeal(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state, @Nonnull ItemStack stack)
public static int onApplyBonemeal(@Nonnull PlayerEntity player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull ItemStack stack)
{
BonemealEvent event = new BonemealEvent(player, world, pos, state, stack);
if (MinecraftForge.EVENT_BUS.post(event)) return -1;
@@ -372,24 +365,24 @@ public class ForgeEventFactory
}
@Nullable
public static ActionResult<ItemStack> onBucketUse(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull ItemStack stack, @Nullable RayTraceResult target)
public static ActionResult<ItemStack> onBucketUse(@Nonnull PlayerEntity player, @Nonnull World world, @Nonnull ItemStack stack, @Nullable RayTraceResult target)
{
FillBucketEvent event = new FillBucketEvent(player, stack, world, target);
if (MinecraftForge.EVENT_BUS.post(event)) return new ActionResult<ItemStack>(EnumActionResult.FAIL, stack);
if (MinecraftForge.EVENT_BUS.post(event)) return new ActionResult<ItemStack>(ActionResultType.FAIL, stack);
if (event.getResult() == Result.ALLOW)
{
if (player.abilities.isCreativeMode)
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
return new ActionResult<ItemStack>(ActionResultType.SUCCESS, stack);
stack.shrink(1);
if (stack.isEmpty())
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, event.getFilledBucket());
return new ActionResult<ItemStack>(ActionResultType.SUCCESS, event.getFilledBucket());
if (!player.inventory.addItemStackToInventory(event.getFilledBucket()))
player.dropItem(event.getFilledBucket(), false);
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
return new ActionResult<ItemStack>(ActionResultType.SUCCESS, stack);
}
return null;
}
@@ -408,7 +401,7 @@ public class ForgeEventFactory
return event;
}
public static int onItemExpire(EntityItem entity, @Nonnull ItemStack item)
public static int onItemExpire(ItemEntity entity, @Nonnull ItemStack item)
{
if (item.isEmpty()) return -1;
ItemExpireEvent event = new ItemExpireEvent(entity, (item.isEmpty() ? 6000 : item.getItem().getEntityLifespan(item, entity.world)));
@@ -416,21 +409,13 @@ public class ForgeEventFactory
return event.getExtraLife();
}
public static int onItemPickup(EntityItem entityItem, EntityPlayer player)
public static int onItemPickup(ItemEntity entityItem, PlayerEntity player)
{
Event event = new EntityItemPickupEvent(player, entityItem);
if (MinecraftForge.EVENT_BUS.post(event)) return -1;
return event.getResult() == Result.ALLOW ? 1 : 0;
}
public static void onPlayerDrops(EntityPlayer player, DamageSource cause, Collection<EntityItem> drops, boolean recentlyHit)
{
PlayerDropsEvent event = new PlayerDropsEvent(player, cause, drops, recentlyHit);
if (!MinecraftForge.EVENT_BUS.post(event)) {
drops.forEach(e -> player.dropItemAndGetStack(e));
}
}
public static boolean canMountEntity(Entity entityMounting, Entity entityBeingMounted, boolean isMounting)
{
boolean isCanceled = MinecraftForge.EVENT_BUS.post(new EntityMountEvent(entityMounting, entityBeingMounted, entityMounting.world, isMounting));
@@ -444,33 +429,33 @@ public class ForgeEventFactory
return true;
}
public static boolean onAnimalTame(EntityAnimal animal, EntityPlayer tamer)
public static boolean onAnimalTame(AnimalEntity animal, PlayerEntity tamer)
{
return MinecraftForge.EVENT_BUS.post(new AnimalTameEvent(animal, tamer));
}
public static SleepResult onPlayerSleepInBed(EntityPlayer player, BlockPos pos)
public static SleepResult onPlayerSleepInBed(PlayerEntity player, Optional<BlockPos> pos)
{
PlayerSleepInBedEvent event = new PlayerSleepInBedEvent(player, pos);
MinecraftForge.EVENT_BUS.post(event);
return event.getResultStatus();
}
public static void onPlayerWakeup(EntityPlayer player, boolean wakeImmediately, boolean updateWorldFlag, boolean setSpawn)
public static void onPlayerWakeup(PlayerEntity player, boolean wakeImmediately, boolean updateWorldFlag, boolean setSpawn)
{
MinecraftForge.EVENT_BUS.post(new PlayerWakeUpEvent(player, wakeImmediately, updateWorldFlag, setSpawn));
}
public static void onPlayerFall(EntityPlayer player, float distance, float multiplier)
public static void onPlayerFall(PlayerEntity player, float distance, float multiplier)
{
MinecraftForge.EVENT_BUS.post(new PlayerFlyableFallEvent(player, distance, multiplier));
}
public static boolean onPlayerSpawnSet(EntityPlayer player, BlockPos pos, boolean forced) {
public static boolean onPlayerSpawnSet(PlayerEntity player, BlockPos pos, boolean forced) {
return MinecraftForge.EVENT_BUS.post(new PlayerSetSpawnEvent(player, pos, forced));
}
public static void onPlayerClone(EntityPlayer player, EntityPlayer oldPlayer, boolean wasDeath)
public static void onPlayerClone(PlayerEntity player, PlayerEntity oldPlayer, boolean wasDeath)
{
MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerEvent.Clone(player, oldPlayer, wasDeath));
}
@@ -501,7 +486,7 @@ public class ForgeEventFactory
return MinecraftForge.EVENT_BUS.post(new WorldEvent.CreateSpawnPosition(world, settings));
}
public static float onLivingHeal(EntityLivingBase entity, float amount)
public static float onLivingHeal(LivingEntity entity, float amount)
{
LivingHealEvent event = new LivingHealEvent(entity, amount);
return (MinecraftForge.EVENT_BUS.post(event) ? 0 : event.getAmount());
@@ -534,22 +519,22 @@ public class ForgeEventFactory
MinecraftForge.EVENT_BUS.post(new PotionBrewEvent.Post(brewingItemStacks));
}
public static void onPlayerBrewedPotion(EntityPlayer player, ItemStack stack)
public static void onPlayerBrewedPotion(PlayerEntity player, ItemStack stack)
{
MinecraftForge.EVENT_BUS.post(new PlayerBrewedPotionEvent(player, stack));
}
public static boolean renderFireOverlay(EntityPlayer player, float renderPartialTicks)
public static boolean renderFireOverlay(PlayerEntity player, float renderPartialTicks)
{
return renderBlockOverlay(player, renderPartialTicks, OverlayType.FIRE, Blocks.FIRE.getDefaultState(), new BlockPos(player));
}
public static boolean renderWaterOverlay(EntityPlayer player, float renderPartialTicks)
public static boolean renderWaterOverlay(PlayerEntity player, float renderPartialTicks)
{
return renderBlockOverlay(player, renderPartialTicks, OverlayType.WATER, Blocks.WATER.getDefaultState(), new BlockPos(player));
}
public static boolean renderBlockOverlay(EntityPlayer player, float renderPartialTicks, OverlayType type, IBlockState block, BlockPos pos)
public static boolean renderBlockOverlay(PlayerEntity player, float renderPartialTicks, OverlayType type, BlockState block, BlockPos pos)
{
return MinecraftForge.EVENT_BUS.post(new RenderBlockOverlayEvent(player, renderPartialTicks, type, block, pos));
}
@@ -574,7 +559,7 @@ public class ForgeEventFactory
return event.getCapabilities().size() > 0 || parent != null ? new CapabilityDispatcher(event.getCapabilities(), event.getListeners(), parent) : null;
}
public static boolean fireSleepingLocationCheck(EntityPlayer player, BlockPos sleepingLocation)
public static boolean fireSleepingLocationCheck(LivingEntity player, BlockPos sleepingLocation)
{
SleepingLocationCheckEvent evt = new SleepingLocationCheckEvent(player, sleepingLocation);
MinecraftForge.EVENT_BUS.post(evt);
@@ -582,14 +567,16 @@ public class ForgeEventFactory
Result canContinueSleep = evt.getResult();
if (canContinueSleep == Result.DEFAULT)
{
IBlockState state = player.world.getBlockState(player.bedLocation);
return state.getBlock().isBed(state, player.world, player.bedLocation, player);
return player.func_213374_dv().map(pos-> {
BlockState state = player.world.getBlockState(pos);
return state.getBlock().isBed(state, player.world, pos, player);
}).orElse(false);
}
else
return canContinueSleep == Result.ALLOW;
}
public static boolean fireSleepingTimeCheck(EntityPlayer player, BlockPos sleepingLocation)
public static boolean fireSleepingTimeCheck(PlayerEntity player, Optional<BlockPos> sleepingLocation)
{
SleepingTimeCheckEvent evt = new SleepingTimeCheckEvent(player, sleepingLocation);
MinecraftForge.EVENT_BUS.post(evt);
@@ -601,15 +588,15 @@ public class ForgeEventFactory
return canContinueSleep == Result.ALLOW;
}
public static ActionResult<ItemStack> onArrowNock(ItemStack item, World world, EntityPlayer player, EnumHand hand, boolean hasAmmo)
public static ActionResult<ItemStack> onArrowNock(ItemStack item, World world, PlayerEntity player, Hand hand, boolean hasAmmo)
{
ArrowNockEvent event = new ArrowNockEvent(player, item, hand, world, hasAmmo);
if (MinecraftForge.EVENT_BUS.post(event))
return new ActionResult<ItemStack>(EnumActionResult.FAIL, item);
return new ActionResult<ItemStack>(ActionResultType.FAIL, item);
return event.getAction();
}
public static int onArrowLoose(ItemStack stack, World world, EntityPlayer player, int charge, boolean hasAmmo)
public static int onArrowLoose(ItemStack stack, World world, PlayerEntity player, int charge, boolean hasAmmo)
{
ArrowLooseEvent event = new ArrowLooseEvent(player, stack, world, charge, hasAmmo);
if (MinecraftForge.EVENT_BUS.post(event))
@@ -622,28 +609,21 @@ public class ForgeEventFactory
return MinecraftForge.EVENT_BUS.post(new ProjectileImpactEvent(entity, ray));
}
public static boolean onProjectileImpact(EntityArrow arrow, RayTraceResult ray)
public static boolean onProjectileImpact(AbstractArrowEntity arrow, RayTraceResult ray)
{
return MinecraftForge.EVENT_BUS.post(new ProjectileImpactEvent.Arrow(arrow, ray));
}
public static boolean onProjectileImpact(EntityFireball fireball, RayTraceResult ray)
public static boolean onProjectileImpact(DamagingProjectileEntity fireball, RayTraceResult ray)
{
return MinecraftForge.EVENT_BUS.post(new ProjectileImpactEvent.Fireball(fireball, ray));
}
public static boolean onProjectileImpact(EntityThrowable throwable, RayTraceResult ray)
public static boolean onProjectileImpact(ThrowableEntity throwable, RayTraceResult ray)
{
return MinecraftForge.EVENT_BUS.post(new ProjectileImpactEvent.Throwable(throwable, ray));
}
public static boolean onReplaceBiomeBlocks(IChunkGenerator<?> gen, IChunk chunk, IWorld world)
{
ChunkGeneratorEvent.ReplaceBiomeBlocks event = new ChunkGeneratorEvent.ReplaceBiomeBlocks(gen, chunk, world);
MinecraftForge.EVENT_BUS.post(event);
return event.getResult() != Event.Result.DENY;
}
public static LootTable loadLootTable(ResourceLocation name, LootTable table, LootTableManager lootTableManager)
{
LootTableLoadEvent event = new LootTableLoadEvent(name, table, lootTableManager);
@@ -652,7 +632,7 @@ public class ForgeEventFactory
return event.getTable();
}
public static boolean canCreateFluidSource(World world, BlockPos pos, IBlockState state, boolean def)
public static boolean canCreateFluidSource(World world, BlockPos pos, BlockState state, boolean def)
{
CreateFluidSourceEvent evt = new CreateFluidSourceEvent(world, pos, state);
MinecraftForge.EVENT_BUS.post(evt);
@@ -661,7 +641,7 @@ public class ForgeEventFactory
return result == Result.DEFAULT ? def : result == Result.ALLOW;
}
public static boolean onTrySpawnPortal(IWorld world, BlockPos pos, BlockPortal.Size size)
public static boolean onTrySpawnPortal(IWorld world, BlockPos pos, NetherPortalBlock.Size size)
{
return MinecraftForge.EVENT_BUS.post(new BlockEvent.PortalSpawnEvent(world, pos, world.getBlockState(pos), size));
}
@@ -673,7 +653,7 @@ public class ForgeEventFactory
return e.getLevel();
}
public static boolean onEntityDestroyBlock(EntityLivingBase entity, BlockPos pos, IBlockState state)
public static boolean onEntityDestroyBlock(LivingEntity entity, BlockPos pos, BlockState state)
{
return !MinecraftForge.EVENT_BUS.post(new LivingDestroyBlockEvent(entity, pos, state));
}
@@ -699,17 +679,12 @@ public class ForgeEventFactory
MinecraftForge.EVENT_BUS.post(event);
return event.getResult() != Result.DENY;
}
public static MerchantRecipeList listTradeOffers(IMerchant merchant, EntityPlayer player, @Nullable MerchantRecipeList list)
public static void fireChunkWatch(boolean watch, ServerPlayerEntity entity, ChunkPos chunkpos, ServerWorld world)
{
MerchantRecipeList dupeList = null;
if (list != null)
{
dupeList = new MerchantRecipeList();
dupeList.addAll(list);
}
MerchantTradeOffersEvent event = new MerchantTradeOffersEvent(merchant, player, dupeList);
MinecraftForge.EVENT_BUS.post(event);
return event.getList();
if (watch)
MinecraftForge.EVENT_BUS.post(new ChunkWatchEvent.Watch(entity, chunkpos, world));
else
MinecraftForge.EVENT_BUS.post(new ChunkWatchEvent.UnWatch(entity, chunkpos, world));
}
}
@@ -19,13 +19,11 @@
package net.minecraftforge.event;
import net.minecraft.network.NetHandlerPlayServer;
import net.minecraft.network.play.client.CPacketChatMessage;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraftforge.eventbus.api.Event;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Cancelable;
/**
* ServerChatEvent is fired whenever a C01PacketChatMessage is processed. <br>
@@ -48,9 +46,9 @@ import net.minecraft.util.text.ITextComponent;
public class ServerChatEvent extends net.minecraftforge.eventbus.api.Event
{
private final String message, username;
private final EntityPlayerMP player;
private final ServerPlayerEntity player;
private ITextComponent component;
public ServerChatEvent(EntityPlayerMP player, String message, ITextComponent component)
public ServerChatEvent(ServerPlayerEntity player, String message, ITextComponent component)
{
super();
this.message = message;
@@ -71,5 +69,5 @@ public class ServerChatEvent extends net.minecraftforge.eventbus.api.Event
public String getMessage() { return this.message; }
public String getUsername() { return this.username; }
public EntityPlayerMP getPlayer() { return this.player; }
public ServerPlayerEntity getPlayer() { return this.player; }
}
@@ -19,7 +19,7 @@
package net.minecraftforge.event.brewing;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraftforge.event.entity.player.PlayerEvent;
@@ -32,7 +32,7 @@ public class PlayerBrewedPotionEvent extends PlayerEvent
{
private final ItemStack stack;
public PlayerBrewedPotionEvent(EntityPlayer player, @Nonnull ItemStack stack)
public PlayerBrewedPotionEvent(PlayerEntity player, @Nonnull ItemStack stack)
{
super(player);
this.stack = stack;
@@ -20,7 +20,7 @@
package net.minecraftforge.event.brewing;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntityBrewingStand;
import net.minecraft.tileentity.BrewingStandTileEntity;
import net.minecraft.util.NonNullList;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Cancelable;
@@ -63,7 +63,7 @@ public class PotionBrewEvent extends Event
* PotionBrewEvent.Pre is fired before vanilla brewing takes place.
* All changes made to the event's array will be made to the TileEntity if the event is canceled.
* <br>
* The event is fired during the {@link TileEntityBrewingStand#brewPotions()} method invocation.<br>
* The event is fired during the {@link BrewingStandTileEntity#brewPotions()} method invocation.<br>
* <br>
* {@link #stacks} contains the itemstack array from the TileEntityBrewer holding all items in Brewer.<br>
* <br>
@@ -88,7 +88,7 @@ public class PotionBrewEvent extends Event
/**
* PotionBrewEvent.Post is fired when a potion is brewed in the brewing stand.
* <br>
* The event is fired during the {@link TileEntityBrewingStand#brewPotions()} method invocation.<br>
* The event is fired during the {@link BrewingStandTileEntity#brewPotions()} method invocation.<br>
* <br>
* {@link #stacks} contains the itemstack array from the TileEntityBrewer holding all items in Brewer.<br>
* <br>
@@ -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;
}
@@ -19,11 +19,13 @@
package net.minecraftforge.event.terraingen;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Event;
import net.minecraftforge.eventbus.api.Event.HasResult;
/**
* BiomeEvent is fired whenever an event involving biomes occurs.<br>
* If a method utilizes this {@link Event} as its parameter, the method will
@@ -90,26 +92,26 @@ public class BiomeEvent extends Event
@HasResult
public static class GetVillageBlockID extends BiomeEvent
{
private final IBlockState original;
private IBlockState replacement;
private final BlockState original;
private BlockState replacement;
public GetVillageBlockID(Biome biome, IBlockState original)
public GetVillageBlockID(Biome biome, BlockState original)
{
super(biome);
this.original = original;
}
public IBlockState getOriginal()
public BlockState getOriginal()
{
return original;
}
public IBlockState getReplacement()
public BlockState getReplacement()
{
return replacement;
}
public void setReplacement(IBlockState replacement)
public void setReplacement(BlockState replacement)
{
this.replacement = replacement;
}
@@ -1,104 +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.terraingen;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunk;
import net.minecraft.world.gen.IChunkGenerator;
import net.minecraftforge.eventbus.api.Event;
public class ChunkGeneratorEvent extends Event
{
private final IChunkGenerator<?> gen;
public ChunkGeneratorEvent(IChunkGenerator<?> gen)
{
this.gen = gen;
}
public IChunkGenerator<?> getGenerator() { return this.getGen(); }
public IChunkGenerator<?> getGen()
{
return gen;
}
/**
* This event is fired when a chunks blocks are replaced by a biomes top and
* filler blocks.
*
* You can set the result to DENY to prevent the default replacement.
*/
@HasResult
public static class ReplaceBiomeBlocks extends ChunkGeneratorEvent
{
private final IChunk chunk;
private final IWorld world; // CAN BE NULL
public ReplaceBiomeBlocks(IChunkGenerator<?> chunkProvider, IChunk chunk, IWorld world)
{
super(chunkProvider);
this.chunk = chunk;
this.world = world;
}
public IChunk getChunk() { return chunk; }
public IWorld getWorld() { return world; }
}
/**
* This event is fired before a chunks terrain noise field is initialized.
*
* You can set the result to DENY to substitute your own noise field.
*/
@HasResult
public static class InitNoiseField extends ChunkGeneratorEvent
{
private double[] noisefield;
private final int posX;
private final int posY;
private final int posZ;
private final int sizeX;
private final int sizeY;
private final int sizeZ;
public InitNoiseField(IChunkGenerator<?> chunkProvider, double[] noisefield, int posX, int posY, int posZ, int sizeX, int sizeY, int sizeZ)
{
super(chunkProvider);
this.setNoisefield(noisefield);
this.posX = posX;
this.posY = posY;
this.posZ = posZ;
this.sizeX = sizeX;
this.sizeY = sizeY;
this.sizeZ = sizeZ;
}
public double[] getNoisefield() { return noisefield; }
public void setNoisefield(double[] noisefield) { this.noisefield = noisefield; }
public int getPosX() { return posX; }
public int getPosY() { return posY; }
public int getPosZ() { return posZ; }
public int getSizeX() { return sizeX; }
public int getSizeY() { return sizeY; }
public int getSizeZ() { return sizeZ; }
}
}
@@ -1,126 +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.terraingen;
import java.util.Random;
import net.minecraft.world.IWorld;
import net.minecraft.world.gen.NoiseGeneratorOctaves;
import net.minecraft.world.gen.NoiseGeneratorPerlin;
import net.minecraftforge.event.world.WorldEvent;
public class InitNoiseGensEvent<T extends InitNoiseGensEvent.Context> extends WorldEvent
{
private final Random rand;
private final T original;
private T newValues;
@SuppressWarnings("unchecked")
public InitNoiseGensEvent(IWorld world, Random rand, T original)
{
super(world);
this.rand = rand;
this.original = original;
this.newValues = (T)original.clone();
}
public Random getRandom() { return this.rand; }
public T getOriginal() { return this.original; }
public T getNewValues() { return this.newValues; }
public static class Context
{
private NoiseGeneratorOctaves lperlin1;
private NoiseGeneratorOctaves lperlin2;
private NoiseGeneratorOctaves perlin;
private NoiseGeneratorOctaves scale;
private NoiseGeneratorOctaves depth;
public Context(NoiseGeneratorOctaves lperlin1, NoiseGeneratorOctaves lperlin2, NoiseGeneratorOctaves perlin,
NoiseGeneratorOctaves scale, NoiseGeneratorOctaves depth)
{
this.lperlin1 = lperlin1;
this.lperlin2 = lperlin2;
this.perlin = perlin;
this.scale = scale;
this.depth = depth;
}
public NoiseGeneratorOctaves getLPerlin1() { return lperlin1; }
public NoiseGeneratorOctaves getLPerlin2() { return lperlin2; }
public NoiseGeneratorOctaves getPerlin() { return perlin; }
public NoiseGeneratorOctaves getScale() { return scale; }
public NoiseGeneratorOctaves getDepth() { return depth; }
public void setLPerlin1(NoiseGeneratorOctaves value) { this.lperlin1 = value; }
public void getLPerlin2(NoiseGeneratorOctaves value) { this.lperlin2 = value; }
public void getPerlin (NoiseGeneratorOctaves value) { this.perlin = value; }
public void getScale (NoiseGeneratorOctaves value) { this.scale = value; }
public void getDepth (NoiseGeneratorOctaves value) { this.depth = value; }
@Override
public Context clone(){ return new Context(lperlin1, lperlin2, perlin, scale, depth); }
}
public static class ContextOverworld extends Context
{
private NoiseGeneratorPerlin height;
public ContextOverworld(NoiseGeneratorOctaves lperlin1, NoiseGeneratorOctaves lperlin2, NoiseGeneratorOctaves perlin,
NoiseGeneratorPerlin height, NoiseGeneratorOctaves scale, NoiseGeneratorOctaves depth)
{
super(lperlin1, lperlin2, perlin, scale, depth);
this.height = height;
}
@Override
public ContextOverworld clone() { return new ContextOverworld(getLPerlin1(), getLPerlin2(), getPerlin(), height, getScale(), getDepth()); }
public NoiseGeneratorPerlin getHeight() { return height; }
public void getHeight (NoiseGeneratorPerlin value) { this.height = value; }
}
public static class ContextEnd extends Context
{
private NoiseGeneratorPerlin island;
public ContextEnd(NoiseGeneratorOctaves lperlin1, NoiseGeneratorOctaves lperlin2, NoiseGeneratorOctaves perlin,
NoiseGeneratorOctaves scale, NoiseGeneratorOctaves depth, NoiseGeneratorPerlin field_205478_l)
{
super(lperlin1, lperlin2, perlin, scale, depth);
this.island = field_205478_l;
}
@Override
public ContextEnd clone() { return new ContextEnd(getLPerlin1(), getLPerlin2(), getPerlin(), getScale(), getDepth(), island); }
public NoiseGeneratorPerlin getIsland() { return island; }
public void getIsland (NoiseGeneratorPerlin value) { this.island = value; }
}
public static class ContextHell extends Context
{
private NoiseGeneratorOctaves perlin2;
public ContextHell(NoiseGeneratorOctaves lperlin1, NoiseGeneratorOctaves lperlin2, NoiseGeneratorOctaves perlin,
NoiseGeneratorOctaves perlin2, NoiseGeneratorOctaves scale, NoiseGeneratorOctaves depth)
{
super(lperlin1, lperlin2, perlin, scale, depth);
this.perlin2 = perlin2;
}
@Override
public ContextHell clone() { return new ContextHell(getLPerlin1(), getLPerlin2(), getPerlin(), perlin2, getScale(), getDepth()); }
public NoiseGeneratorOctaves getPerlin2() { return perlin2; }
public void getPerlin2 (NoiseGeneratorOctaves value) { this.perlin2 = value; }
}
}
@@ -1,35 +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.terraingen;
import java.util.Random;
import net.minecraft.world.IWorld;
import net.minecraftforge.common.MinecraftForge;
public abstract class TerrainGen
{
public static <T extends InitNoiseGensEvent.Context> T getModdedNoiseGenerators(IWorld world, Random rand, T original)
{
InitNoiseGensEvent<T> event = new InitNoiseGensEvent<>(world, rand, original);
MinecraftForge.EVENT_BUS.post(event);
return event.getNewValues();
}
}
@@ -21,7 +21,7 @@ package net.minecraftforge.event.terraingen;
import net.minecraft.world.WorldType;
import net.minecraft.world.biome.provider.BiomeProvider;
import net.minecraft.world.gen.layer.GenLayer;
import net.minecraft.world.gen.layer.Layer;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraftforge.eventbus.api.Event;
@@ -112,10 +112,10 @@ public class WorldTypeEvent extends Event
public static class InitBiomeGens extends WorldTypeEvent
{
private final long seed;
private final GenLayer[] originalBiomeGens;
private GenLayer[] newBiomeGens;
private final Layer[] originalBiomeGens;
private Layer[] newBiomeGens;
public InitBiomeGens(WorldType worldType, long seed, GenLayer[] original)
public InitBiomeGens(WorldType worldType, long seed, Layer[] original)
{
super(worldType);
this.seed = seed;
@@ -128,17 +128,17 @@ public class WorldTypeEvent extends Event
return seed;
}
public GenLayer[] getOriginalBiomeGens()
public Layer[] getOriginalBiomeGens()
{
return originalBiomeGens;
}
public GenLayer[] getNewBiomeGens()
public Layer[] getNewBiomeGens()
{
return newBiomeGens;
}
public void setNewBiomeGens(GenLayer[] newBiomeGens)
public void setNewBiomeGens(Layer[] newBiomeGens)
{
this.newBiomeGens = newBiomeGens;
}
@@ -1,80 +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.village;
import javax.annotation.Nullable;
import net.minecraft.entity.IMerchant;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.village.MerchantRecipeList;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraftforge.eventbus.api.Event;
/**
* MerchantTradeOffersEvent is fired when a list of villager trade offers is presented in
* {@link IMerchant#getRecipes(EntityPlayer)}, allowing mods to modify trade offers depending
* on the player. Be warned that this event is fired on both server and client; thus, modders
* should ensure that they sync the needed data for this event themselves.<br>
* <br>
* This event is not {@link Cancelable}.<br>
* <br>
* This event does not have a result. {@link HasResult}<br>
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
*/
public class MerchantTradeOffersEvent extends Event
{
private final IMerchant merchant;
private final EntityPlayer player;
private @Nullable MerchantRecipeList list;
public MerchantTradeOffersEvent(IMerchant merchant, EntityPlayer player, @Nullable MerchantRecipeList list)
{
this.merchant = merchant;
this.player = player;
this.list = list;
}
/**
* The recipe list (if not {@code null}) returned from this function may be modified.
* @return the recipe list
*/
public @Nullable MerchantRecipeList getList()
{
return list;
}
public void setList(@Nullable MerchantRecipeList list)
{
this.list = list;
}
public IMerchant getMerchant()
{
return merchant;
}
public EntityPlayer getPlayer()
{
return player;
}
}
@@ -19,9 +19,8 @@
package net.minecraftforge.event.village;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.Vec3d;
import net.minecraft.village.Village;
import net.minecraft.village.VillageSiege;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
@@ -43,16 +42,14 @@ public class VillageSiegeEvent extends Event
{
private final VillageSiege siege;
private final World world;
private final EntityPlayer player;
private final Village village;
private final PlayerEntity player;
private final Vec3d attemptedSpawnPos;
public VillageSiegeEvent(VillageSiege siege, World world, EntityPlayer player, Village village, Vec3d attemptedSpawnPos)
public VillageSiegeEvent(VillageSiege siege, World world, PlayerEntity player, Vec3d attemptedSpawnPos)
{
this.siege = siege;
this.world = world;
this.player = player;
this.village = village;
this.attemptedSpawnPos = attemptedSpawnPos;
}
@@ -66,16 +63,11 @@ public class VillageSiegeEvent extends Event
return world;
}
public EntityPlayer getPlayer()
public PlayerEntity getPlayer()
{
return player;
}
public Village getVillage()
{
return village;
}
public Vec3d getAttemptedSpawnPos()
{
return attemptedSpawnPos;
@@ -22,17 +22,16 @@ package net.minecraftforge.event.world;
import java.util.EnumSet;
import java.util.List;
import net.minecraft.block.BlockPortal;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.NetherPortalBlock;
import net.minecraft.block.BlockState;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Enchantments;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
@@ -53,8 +52,8 @@ public class BlockEvent extends Event
private final IWorld world;
private final BlockPos pos;
private final IBlockState state;
public BlockEvent(IWorld world, BlockPos pos, IBlockState state)
private final BlockState state;
public BlockEvent(IWorld world, BlockPos pos, BlockState state)
{
this.pos = pos;
this.world = world;
@@ -71,7 +70,7 @@ public class BlockEvent extends Event
return pos;
}
public IBlockState getState()
public BlockState getState()
{
return state;
}
@@ -93,9 +92,9 @@ public class BlockEvent extends Event
private final NonNullList<ItemStack> drops;
private final boolean isSilkTouching;
private float dropChance; // Change to e.g. 1.0f, if you manipulate the list and want to guarantee it always drops
private final EntityPlayer harvester; // May be null for non-player harvesting such as explosions or machines
private final PlayerEntity harvester; // May be null for non-player harvesting such as explosions or machines
public HarvestDropsEvent(World world, BlockPos pos, IBlockState state, int fortuneLevel, float dropChance, NonNullList<ItemStack> drops, EntityPlayer harvester, boolean isSilkTouching)
public HarvestDropsEvent(World world, BlockPos pos, BlockState state, int fortuneLevel, float dropChance, NonNullList<ItemStack> drops, PlayerEntity harvester, boolean isSilkTouching)
{
super(world, pos, state);
this.fortuneLevel = fortuneLevel;
@@ -110,7 +109,7 @@ public class BlockEvent extends Event
public boolean isSilkTouching() { return isSilkTouching; }
public float getDropChance() { return dropChance; }
public void setDropChance(float dropChance) { this.dropChance = dropChance; }
public EntityPlayer getHarvester() { return harvester; }
public PlayerEntity getHarvester() { return harvester; }
}
/**
@@ -121,27 +120,27 @@ public class BlockEvent extends Event
public static class BreakEvent extends BlockEvent
{
/** Reference to the Player who broke the block. If no player is available, use a EntityFakePlayer */
private final EntityPlayer player;
private final PlayerEntity player;
private int exp;
public BreakEvent(World world, BlockPos pos, IBlockState state, EntityPlayer player)
public BreakEvent(World world, BlockPos pos, BlockState state, PlayerEntity player)
{
super(world, pos, state);
this.player = player;
if (state == null || !ForgeHooks.canHarvestBlock(state, player, world, pos) || // Handle empty block or player unable to break block scenario
(state.canSilkHarvest(world, pos, player) && EnchantmentHelper.getEnchantmentLevel(Enchantments.SILK_TOUCH, player.getHeldItemMainhand()) > 0)) // If the block is being silk harvested, the exp dropped is 0
if (state == null || !ForgeHooks.canHarvestBlock(state, player, world, pos)) // Handle empty block or player unable to break block scenario
{
this.exp = 0;
}
else
{
int bonusLevel = EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, player.getHeldItemMainhand());
this.exp = state.getBlock().getExpDrop(state, world, pos, bonusLevel);
int silklevel = EnchantmentHelper.getEnchantmentLevel(Enchantments.SILK_TOUCH, player.getHeldItemMainhand());
this.exp = state.getExpDrop(world, pos, bonusLevel, silklevel);
}
}
public EntityPlayer getPlayer()
public PlayerEntity getPlayer()
{
return player;
}
@@ -177,15 +176,15 @@ public class BlockEvent extends Event
{
private final Entity entity;
private final BlockSnapshot blockSnapshot;
private final IBlockState placedBlock;
private final IBlockState placedAgainst;
private final BlockState placedBlock;
private final BlockState placedAgainst;
public EntityPlaceEvent(@Nonnull BlockSnapshot blockSnapshot, @Nonnull IBlockState placedAgainst, @Nullable Entity entity)
public EntityPlaceEvent(@Nonnull BlockSnapshot blockSnapshot, @Nonnull BlockState placedAgainst, @Nullable Entity entity)
{
super(blockSnapshot.getWorld(), blockSnapshot.getPos(), !(entity instanceof EntityPlayer) ? blockSnapshot.getReplacedBlock() : blockSnapshot.getCurrentBlock());
super(blockSnapshot.getWorld(), blockSnapshot.getPos(), !(entity instanceof PlayerEntity) ? blockSnapshot.getReplacedBlock() : blockSnapshot.getCurrentBlock());
this.entity = entity;
this.blockSnapshot = blockSnapshot;
this.placedBlock = !(entity instanceof EntityPlayer) ? blockSnapshot.getReplacedBlock() : blockSnapshot.getCurrentBlock();
this.placedBlock = !(entity instanceof PlayerEntity) ? blockSnapshot.getReplacedBlock() : blockSnapshot.getCurrentBlock();
this.placedAgainst = placedAgainst;
if (DEBUG)
@@ -197,8 +196,8 @@ public class BlockEvent extends Event
@Nullable
public Entity getEntity() { return entity; }
public BlockSnapshot getBlockSnapshot() { return blockSnapshot; }
public IBlockState getPlacedBlock() { return placedBlock; }
public IBlockState getPlacedAgainst() { return placedAgainst; }
public BlockState getPlacedBlock() { return placedBlock; }
public BlockState getPlacedAgainst() { return placedAgainst; }
}
/**
@@ -213,7 +212,7 @@ public class BlockEvent extends Event
{
private final List<BlockSnapshot> blockSnapshots;
public EntityMultiPlaceEvent(@Nonnull List<BlockSnapshot> blockSnapshots, @Nonnull IBlockState placedAgainst, @Nullable Entity entity) {
public EntityMultiPlaceEvent(@Nonnull List<BlockSnapshot> blockSnapshots, @Nonnull BlockState placedAgainst, @Nullable Entity entity) {
super(blockSnapshots.get(0), placedAgainst, entity);
this.blockSnapshots = ImmutableList.copyOf(blockSnapshots);
if (DEBUG)
@@ -242,10 +241,10 @@ public class BlockEvent extends Event
@Cancelable
public static class NeighborNotifyEvent extends BlockEvent
{
private final EnumSet<EnumFacing> notifiedSides;
private final EnumSet<Direction> notifiedSides;
private final boolean forceRedstoneUpdate;
public NeighborNotifyEvent(World world, BlockPos pos, IBlockState state, EnumSet<EnumFacing> notifiedSides, boolean forceRedstoneUpdate)
public NeighborNotifyEvent(World world, BlockPos pos, BlockState state, EnumSet<Direction> notifiedSides, boolean forceRedstoneUpdate)
{
super(world, pos, state);
this.notifiedSides = notifiedSides;
@@ -257,7 +256,7 @@ public class BlockEvent extends Event
*
* @return list of notified directions
*/
public EnumSet<EnumFacing> getNotifiedSides()
public EnumSet<Direction> getNotifiedSides()
{
return notifiedSides;
}
@@ -281,7 +280,7 @@ public class BlockEvent extends Event
@HasResult
public static class CreateFluidSourceEvent extends BlockEvent
{
public CreateFluidSourceEvent(World world, BlockPos pos, IBlockState state)
public CreateFluidSourceEvent(World world, BlockPos pos, BlockState state)
{
super(world, pos, state);
}
@@ -299,10 +298,10 @@ public class BlockEvent extends Event
public static class FluidPlaceBlockEvent extends BlockEvent
{
private final BlockPos liquidPos;
private IBlockState newState;
private IBlockState origState;
private BlockState newState;
private BlockState origState;
public FluidPlaceBlockEvent(World world, BlockPos pos, BlockPos liquidPos, IBlockState state)
public FluidPlaceBlockEvent(World world, BlockPos pos, BlockPos liquidPos, BlockState state)
{
super(world, pos, state);
this.liquidPos = liquidPos;
@@ -321,12 +320,12 @@ public class BlockEvent extends Event
/**
* @return The block state that will be placed after this event resolves.
*/
public IBlockState getNewState()
public BlockState getNewState()
{
return newState;
}
public void setNewState(IBlockState state)
public void setNewState(BlockState state)
{
this.newState = state;
}
@@ -334,7 +333,7 @@ public class BlockEvent extends Event
/**
* @return The state of the block to be changed before the event was fired.
*/
public IBlockState getOriginalState()
public BlockState getOriginalState()
{
return origState;
}
@@ -346,7 +345,7 @@ public class BlockEvent extends Event
*/
public static class CropGrowEvent extends BlockEvent
{
public CropGrowEvent(World world, BlockPos pos, IBlockState state)
public CropGrowEvent(World world, BlockPos pos, BlockState state)
{
super(world, pos, state);
}
@@ -365,7 +364,7 @@ public class BlockEvent extends Event
@HasResult
public static class Pre extends CropGrowEvent
{
public Pre(World world, BlockPos pos, IBlockState state)
public Pre(World world, BlockPos pos, BlockState state)
{
super(world, pos, state);
}
@@ -382,14 +381,14 @@ public class BlockEvent extends Event
*/
public static class Post extends CropGrowEvent
{
private final IBlockState originalState;
public Post(World world, BlockPos pos, IBlockState original, IBlockState state)
private final BlockState originalState;
public Post(World world, BlockPos pos, BlockState original, BlockState state)
{
super(world, pos, state);
originalState = original;
}
public IBlockState getOriginalState()
public BlockState getOriginalState()
{
return originalState;
}
@@ -407,7 +406,7 @@ public class BlockEvent extends Event
private final Entity entity;
private final float fallDistance;
public FarmlandTrampleEvent(World world, BlockPos pos, IBlockState state, float fallDistance, Entity entity)
public FarmlandTrampleEvent(World world, BlockPos pos, BlockState state, float fallDistance, Entity entity)
{
super(world, pos, state);
this.entity = entity;
@@ -432,15 +431,15 @@ public class BlockEvent extends Event
@Cancelable
public static class PortalSpawnEvent extends BlockEvent
{
private final BlockPortal.Size size;
private final NetherPortalBlock.Size size;
public PortalSpawnEvent(IWorld world, BlockPos pos, IBlockState state, BlockPortal.Size size)
public PortalSpawnEvent(IWorld world, BlockPos pos, BlockState state, NetherPortalBlock.Size size)
{
super(world, pos, state);
this.size = size;
}
public BlockPortal.Size getPortalSize()
public NetherPortalBlock.Size getPortalSize()
{
return size;
}
@@ -19,10 +19,10 @@
package net.minecraftforge.event.world;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.IChunk;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.chunk.storage.AnvilChunkLoader;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraftforge.eventbus.api.Event;
@@ -38,15 +38,15 @@ import net.minecraftforge.eventbus.api.Event;
**/
public class ChunkDataEvent extends ChunkEvent
{
private final NBTTagCompound data;
private final CompoundNBT data;
public ChunkDataEvent(IChunk chunk, NBTTagCompound data)
public ChunkDataEvent(IChunk chunk, CompoundNBT data)
{
super(chunk);
this.data = data;
}
public NBTTagCompound getData()
public CompoundNBT getData()
{
return data;
}
@@ -64,7 +64,7 @@ public class ChunkDataEvent extends ChunkEvent
**/
public static class Load extends ChunkDataEvent
{
public Load(IChunk chunk, NBTTagCompound data)
public Load(IChunk chunk, CompoundNBT data)
{
super(chunk, data);
}
@@ -83,7 +83,7 @@ public class ChunkDataEvent extends ChunkEvent
**/
public static class Save extends ChunkDataEvent
{
public Save(IChunk chunk, NBTTagCompound data)
public Save(IChunk chunk, CompoundNBT data)
{
super(chunk, data);
}
@@ -19,7 +19,6 @@
package net.minecraftforge.event.world;
import net.minecraft.client.multiplayer.ChunkProviderClient;
import net.minecraft.world.chunk.IChunk;
import net.minecraftforge.common.MinecraftForge;
@@ -19,9 +19,10 @@
package net.minecraftforge.event.world;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.ServerWorld;
import net.minecraftforge.eventbus.api.Event;
/**
* ChunkWatchEvent is fired when an event involving a chunk being watched occurs.<br>
@@ -36,20 +37,20 @@ import net.minecraft.world.chunk.Chunk;
* <br>
* All children of this event are fired on the {@link MinecraftForge#EVENT_BUS}.<br>
**/
public class ChunkWatchEvent extends ChunkEvent
public class ChunkWatchEvent extends Event
{
private final EntityPlayerMP player;
private final ServerWorld world;
private final ServerPlayerEntity player;
private final ChunkPos pos;
public ChunkWatchEvent(Chunk chunk, EntityPlayerMP player)
public ChunkWatchEvent(ServerPlayerEntity player, ChunkPos pos, ServerWorld world)
{
super(chunk);
this.player = player;
this.pos = chunk.getPos();
this.pos = pos;
this.world = world;
}
public EntityPlayerMP getPlayer()
public ServerPlayerEntity getPlayer()
{
return this.player;
}
@@ -59,6 +60,11 @@ public class ChunkWatchEvent extends ChunkEvent
return this.pos;
}
public ServerWorld getWorld()
{
return this.world;
}
/**
* ChunkWatchEvent.Watch is fired when an EntityPlayer begins watching a chunk.<br>
* This event is fired when a chunk is added to the watched chunks of an EntityPlayer in
@@ -72,7 +78,7 @@ public class ChunkWatchEvent extends ChunkEvent
**/
public static class Watch extends ChunkWatchEvent
{
public Watch(Chunk chunk, EntityPlayerMP player) {super(chunk, player);}
public Watch(ServerPlayerEntity player, ChunkPos pos, ServerWorld world) {super(player, pos, world);}
}
/**
@@ -88,6 +94,6 @@ public class ChunkWatchEvent extends ChunkEvent
**/
public static class UnWatch extends ChunkWatchEvent
{
public UnWatch(Chunk chunk, EntityPlayerMP player) {super(chunk, player);}
public UnWatch(ServerPlayerEntity player, ChunkPos pos, ServerWorld world) {super(player, pos, world);}
}
}
@@ -19,7 +19,7 @@
package net.minecraftforge.event.world;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.state.properties.NoteBlockInstrument;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -35,7 +35,7 @@ public class NoteBlockEvent extends BlockEvent
{
private int noteId;
protected NoteBlockEvent(World world, BlockPos pos, IBlockState state, int note)
protected NoteBlockEvent(World world, BlockPos pos, BlockState state, int note)
{
super(world, pos, state);
this.noteId = note;
@@ -89,7 +89,7 @@ public class NoteBlockEvent extends BlockEvent
{
private NoteBlockInstrument instrument;
public Play(World world, BlockPos pos, IBlockState state, int note, NoteBlockInstrument instrument)
public Play(World world, BlockPos pos, BlockState state, int note, NoteBlockInstrument instrument)
{
super(world, pos, state, note);
this.instrument = instrument;
@@ -116,7 +116,7 @@ public class NoteBlockEvent extends BlockEvent
private final Note oldNote;
private final Octave oldOctave;
public Change(World world, BlockPos pos, IBlockState state, int oldNote, int newNote)
public Change(World world, BlockPos pos, BlockState state, int oldNote, int newNote)
{
super(world, pos, state, newNote);
this.oldNote = Note.fromId(oldNote);
@@ -21,14 +21,11 @@ package net.minecraftforge.event.world;
import java.util.Random;
import net.minecraft.block.BlockSapling;
import net.minecraft.block.state.IBlockState;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraftforge.eventbus.api.Event.HasResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Event.HasResult;
/**
* SaplingGrowTreeEvent is fired when a sapling grows into a tree.<br>
@@ -20,22 +20,16 @@
package net.minecraftforge.event.world;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.network.NetHandlerPlayClient;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.entity.EntityClassification;
import net.minecraft.profiler.Profiler;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.integrated.IntegratedServer;
import net.minecraft.util.IProgressUpdate;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraft.world.WorldSettings;
import net.minecraft.world.biome.Biome.SpawnListEntry;
import net.minecraftforge.eventbus.api.Cancelable;
@@ -131,26 +125,22 @@ public class WorldEvent extends Event
@net.minecraftforge.eventbus.api.Cancelable
public static class PotentialSpawns extends WorldEvent
{
private final EnumCreatureType type;
private final EntityClassification type;
private final BlockPos pos;
private final List<SpawnListEntry> list;
public PotentialSpawns(IWorld world, EnumCreatureType type, BlockPos pos, List<SpawnListEntry> oldList)
public PotentialSpawns(IWorld world, EntityClassification type, BlockPos pos, List<SpawnListEntry> oldList)
{
super(world);
this.pos = pos;
this.type = type;
if (oldList != null)
{
this.list = new ArrayList<SpawnListEntry>(oldList);
}
else
{
this.list = new ArrayList<SpawnListEntry>();
}
}
public EnumCreatureType getType()
public EntityClassification getType()
{
return type;
}