Merge branch '1.9.4'

This commit is contained in:
cpw committed 2016-05-31 00:34:03 -04:00
commit caa61e1be9
332 files changed
+3806 -3131

No files matched your search

@@ -14,7 +14,7 @@ import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayer.EnumStatus;
import net.minecraft.entity.player.EntityPlayer.SleepResult;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -35,7 +35,7 @@ import net.minecraft.world.Explosion;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraft.world.WorldSettings;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.chunk.ChunkPrimer;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.storage.IPlayerFileData;
@@ -135,6 +135,8 @@ public class ForgeEventFactory
public static Result canEntitySpawn(EntityLiving entity, World world, float x, float y, float z)
{
if (entity == null)
return Result.DEFAULT;
LivingSpawnEvent.CheckSpawn event = new LivingSpawnEvent.CheckSpawn(entity, world, x, y, z);
MinecraftForge.EVENT_BUS.post(event);
return event.getResult();
@@ -162,7 +164,7 @@ public class ForgeEventFactory
return event.getDroppedExperience();
}
public static List<BiomeGenBase.SpawnListEntry> getPotentialSpawns(WorldServer world, EnumCreatureType type, BlockPos pos, List<BiomeGenBase.SpawnListEntry> oldList)
public static List<Biome.SpawnListEntry> getPotentialSpawns(WorldServer world, EnumCreatureType type, BlockPos pos, List<Biome.SpawnListEntry> oldList)
{
WorldEvent.PotentialSpawns event = new WorldEvent.PotentialSpawns(world, type, pos, oldList);
if (MinecraftForge.EVENT_BUS.post(event))
@@ -308,7 +310,7 @@ public class ForgeEventFactory
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, event.getFilledBucket());
if (!player.inventory.addItemStackToInventory(event.getFilledBucket()))
player.dropPlayerItemWithRandomChoice(event.getFilledBucket(), false);
player.dropItem(event.getFilledBucket(), false);
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
}
@@ -369,7 +371,7 @@ public class ForgeEventFactory
return true;
}
public static EnumStatus onPlayerSleepInBed(EntityPlayer player, BlockPos pos)
public static SleepResult onPlayerSleepInBed(EntityPlayer player, BlockPos pos)
{
PlayerSleepInBedEvent event = new PlayerSleepInBedEvent(player, pos);
MinecraftForge.EVENT_BUS.post(event);
@@ -456,12 +458,12 @@ public class ForgeEventFactory
public static boolean renderFireOverlay(EntityPlayer player, float renderPartialTicks)
{
return renderBlockOverlay(player, renderPartialTicks, OverlayType.FIRE, Blocks.fire.getDefaultState(), new BlockPos(player));
return renderBlockOverlay(player, renderPartialTicks, OverlayType.FIRE, Blocks.FIRE.getDefaultState(), new BlockPos(player));
}
public static boolean renderWaterOverlay(EntityPlayer player, float renderPartialTicks)
{
return renderBlockOverlay(player, renderPartialTicks, OverlayType.WATER, Blocks.water.getDefaultState(), new BlockPos(player));
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)
@@ -10,8 +10,8 @@ import net.minecraft.entity.EntityLiving;
import net.minecraft.world.World;
/**
* LivingSpawnEvent is fired whenever a living Entity is spawned. <br>
* If a method utilizes this {@link Event} as its parameter, the method will
* LivingSpawnEvent is fired for any events associated with Living Enttnies spawn status. <br>
* If a method utilizes this {@link Event} as its parameter, the method will
* receive every child event of this class.<br>
* <br>
* {@link #world} contains the world in which this living Entity is being spawned.<br>
@@ -27,7 +27,7 @@ public class LivingSpawnEvent extends LivingEvent
private final float x;
private final float y;
private final float z;
public LivingSpawnEvent(EntityLiving entity, World world, float x, float y, float z)
{
super(entity);
@@ -43,7 +43,7 @@ public class LivingSpawnEvent extends LivingEvent
public float getZ() { return z; }
/**
* Fires before mob spawn events.
*
*
* Result is significant:
* DEFAULT: use vanilla spawn rules
* ALLOW: allow the spawn
@@ -60,9 +60,8 @@ public class LivingSpawnEvent extends LivingEvent
}
/**
* SpecialSpawn is fired when an Entity is to be spawned from a mob spawner.<br>
* This event is fired whenever an Entity is spawned in a mob spawner in<br>
* {@link WorldEntitySpawner#findChunksForSpawning(WorldServer, boolean, boolean, boolean)}.<br>
* SpecialSpawn is fired when an Entity is to be spawned.<br>
* This allows you to do special inializers in the new entity.<br>
* <br>
* This event is fired via the {@link ForgeEventFactory#doSpecialSpawn(EntityLiving, World, float, float, float)}.<br>
* <br>
@@ -81,17 +80,17 @@ public class LivingSpawnEvent extends LivingEvent
super(entity, world, x, y, z);
}
}
/**
* Fired each tick for despawnable mobs to allow control over despawning.
* {@link Result#DEFAULT} will pass the mob on to vanilla despawn mechanics.
* {@link Result#ALLOW} will force the mob to despawn.
* {@link Result#DENY} will force the mob to remain.
* This is fired every tick for every despawnable entity. Be efficient in your handlers.
*
*
* Note: this is not fired <em>if</em> the mob is definitely going to otherwise despawn. It is fired to check if
* the mob can be allowed to despawn. See {@link EntityLiving#despawnEntity}
*
*
* @author cpw
*
*/
@@ -102,6 +101,6 @@ public class LivingSpawnEvent extends LivingEvent
{
super(entity, entity.worldObj, (float)entity.posX, (float)entity.posY, (float)entity.posZ);
}
}
}
@@ -4,7 +4,7 @@ import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.multiplayer.PlayerControllerMP;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.network.NetHandlerPlayServer;
import net.minecraft.network.play.client.CPacketPlayerBlockPlacement;
import net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock;
import net.minecraft.network.play.client.CPacketPlayerTryUseItem;
import net.minecraft.server.management.PlayerInteractionManager;
import net.minecraft.util.EnumFacing;
@@ -27,8 +27,8 @@ import net.minecraft.util.EnumHand;
* {@link EntityPlayer#damageShield(float)},
* {@link ForgeHooks#getContainerItem(ItemStack)},
* {@link PlayerInteractionManager#processRightClick(EntityPlayer, World, ItemStack, EnumHand)},
* {@link NetHandlerPlayServer#processPlayerBlockPlacement(CPacketPlayerBlockPlacement)}
* and {@link NetHandlerPlayServer#processRightClickBlock(CPacketPlayerTryUseItem)}.<br>
* {@link NetHandlerPlayServer#processPlayerBlockPlacement(CPacketPlayerTryUseItem)}
* and {@link NetHandlerPlayServer#processRightClickBlock(CPacketPlayerTryUseItemOnBlock)}.<br>
* <br>
* {@link #original} contains the original ItemStack before the item was destroyed. <br>
* (@link #hand) contains the hand that the current item was held in.<br>
@@ -1,7 +1,7 @@
package net.minecraftforge.event.entity.player;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayer.EnumStatus;
import net.minecraft.entity.player.EntityPlayer.SleepResult;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
@@ -22,7 +22,7 @@ import net.minecraftforge.fml.common.eventhandler.Cancelable;
**/
public class PlayerSleepInBedEvent extends PlayerEvent
{
private EnumStatus result = null;
private SleepResult result = null;
private final BlockPos pos;
public PlayerSleepInBedEvent(EntityPlayer player, BlockPos pos)
@@ -31,12 +31,12 @@ public class PlayerSleepInBedEvent extends PlayerEvent
this.pos = pos;
}
public EnumStatus getResultStatus()
public SleepResult getResultStatus()
{
return result;
}
public void setResult(EnumStatus result)
public void setResult(SleepResult result)
{
this.result = result;
}
@@ -5,25 +5,26 @@ import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraft.block.state.IBlockState;
import net.minecraft.world.biome.BiomeDecorator;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
/**
* BiomeEvent is fired whenever an event involving biomes occurs.<br>
* If a method utilizes this {@link Event} as its parameter, the method will
* receive every child event of this class.<br>
* <br>
* All children of this event are fired on the {@link MinecraftForge#TERRAIN_GEN_BUS}.
* All children of this event are fired on the {@link MinecraftForge#TERRAIN_GEN_BUS}
* unless stated otherwise in their Javadocs.
**/
public class BiomeEvent extends Event
{
private final BiomeGenBase biome;
private final Biome biome;
public BiomeEvent(BiomeGenBase biome)
public BiomeEvent(Biome biome)
{
this.biome = biome;
}
public BiomeGenBase getBiome()
public Biome getBiome()
{
return biome;
}
@@ -47,7 +48,7 @@ public class BiomeEvent extends Event
private final BiomeDecorator originalBiomeDecorator;
private BiomeDecorator newBiomeDecorator;
public CreateDecorator(BiomeGenBase biome, BiomeDecorator original)
public CreateDecorator(Biome biome, BiomeDecorator original)
{
super(biome);
originalBiomeDecorator = original;
@@ -75,14 +76,14 @@ public class BiomeEvent extends Event
* If a method utilizes this {@link Event} as its parameter, the method will
* receive every child event of this class.<br>
* <br>
* All children of this event are fired on the {@link MinecraftForge#TERRAIN_GEN_BUS}.
* All children of this event are fired on the {@link MinecraftForge#EVENT_BUS}.
**/
public static class BiomeColor extends BiomeEvent
{
private final int originalColor;
private int newColor;
public BiomeColor(BiomeGenBase biome, int original)
public BiomeColor(Biome biome, int original)
{
super(biome);
originalColor = original;
@@ -117,7 +118,7 @@ public class BiomeEvent extends Event
private final IBlockState original;
private IBlockState replacement;
public GetVillageBlockID(BiomeGenBase biome, IBlockState original)
public GetVillageBlockID(Biome biome, IBlockState original)
{
super(biome);
this.original = original;
@@ -144,7 +145,7 @@ public class BiomeEvent extends Event
*/
public static class GetGrassColor extends BiomeColor
{
public GetGrassColor(BiomeGenBase biome, int original)
public GetGrassColor(Biome biome, int original)
{
super(biome, original);
}
@@ -155,7 +156,7 @@ public class BiomeEvent extends Event
*/
public static class GetFoliageColor extends BiomeColor
{
public GetFoliageColor(BiomeGenBase biome, int original)
public GetFoliageColor(Biome biome, int original)
{
super(biome, original);
}
@@ -166,7 +167,7 @@ public class BiomeEvent extends Event
*/
public static class GetWaterColor extends BiomeColor
{
public GetWaterColor(BiomeGenBase biome, int original)
public GetWaterColor(Biome biome, int original)
{
super(biome, original);
}
@@ -2,7 +2,7 @@ package net.minecraftforge.event.terraingen;
import java.util.Random;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
@@ -13,7 +13,7 @@ import net.minecraft.world.World;
/**DecorateBiomeEvent is fired when a BiomeDecorator is created.
* <br>
* This event is fired whenever a BiomeDecorator is created in
* {@link DeferredBiomeDecorator#fireCreateEventAndReplace(BiomeGenBase)}.<br>
* {@link DeferredBiomeDecorator#fireCreateEventAndReplace(Biome)}.<br>
* <br>
* {@link #world} contains the world that is being decorated. <br>
* {@link #rand} contains an instance of Random to be used. <br>
@@ -4,7 +4,7 @@ import java.util.Random;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeDecorator;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.common.MinecraftForge;
public class DeferredBiomeDecorator extends BiomeDecorator {
@@ -16,13 +16,13 @@ public class DeferredBiomeDecorator extends BiomeDecorator {
}
@Override
public void decorate(World par1World, Random par2Random, BiomeGenBase biome, BlockPos pos)
public void decorate(World par1World, Random par2Random, Biome biome, BlockPos pos)
{
fireCreateEventAndReplace(biome);
// On first call to decorate, we fire and substitute ourselves, if we haven't already done so
biome.theBiomeDecorator.decorate(par1World, par2Random, biome, pos);
}
public void fireCreateEventAndReplace(BiomeGenBase biome)
public void fireCreateEventAndReplace(Biome biome)
{
// Copy any configuration from us to the real instance.
wrapped.bigMushroomsPerChunk = bigMushroomsPerChunk;
@@ -101,13 +101,13 @@ public class BlockEvent extends Event
this.player = player;
if (state == null || !ForgeHooks.canHarvestBlock(state.getBlock(), player, world, pos) || // Handle empty block or player unable to break block scenario
(state.getBlock().canSilkHarvest(world, pos, world.getBlockState(pos), player) && EnchantmentHelper.getEnchantmentLevel(Enchantments.silkTouch, player.getHeldItemMainhand()) > 0)) // If the block is being silk harvested, the exp dropped is 0
(state.getBlock().canSilkHarvest(world, pos, world.getBlockState(pos), player) && EnchantmentHelper.getEnchantmentLevel(Enchantments.SILK_TOUCH, player.getHeldItemMainhand()) > 0)) // If the block is being silk harvested, the exp dropped is 0
{
this.exp = 0;
}
else
{
int bonusLevel = EnchantmentHelper.getEnchantmentLevel(Enchantments.fortune, player.getHeldItemMainhand());
int bonusLevel = EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, player.getHeldItemMainhand());
this.exp = state.getBlock().getExpDrop(state, world, pos, bonusLevel);
}
}
@@ -1,15 +1,15 @@
package net.minecraftforge.event.world;
import net.minecraft.server.management.PlayerManager;
import net.minecraft.server.management.PlayerChunkMapEntry;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.math.ChunkPos;
/**
* ChunkWatchEvent is fired when an event involving a chunk being watched occurs.<br>
* If a method utilizes this {@link Event} as its parameter, the method will
* If a method utilizes this {@link Event} as its parameter, the method will
* receive every child event of this class.<br>
* <br>
* {@link #chunk} contains the ChunkCoordIntPair of the Chunk this event is affecting.<br>
@@ -19,16 +19,16 @@ import net.minecraft.entity.player.EntityPlayerMP;
**/
public class ChunkWatchEvent extends Event
{
private final ChunkCoordIntPair chunk;
private final ChunkPos chunk;
private final EntityPlayerMP player;
public ChunkWatchEvent(ChunkCoordIntPair chunk, EntityPlayerMP player)
public ChunkWatchEvent(ChunkPos chunk, EntityPlayerMP player)
{
this.chunk = chunk;
this.player = player;
}
public ChunkCoordIntPair getChunk()
public ChunkPos getChunk()
{
return chunk;
}
@@ -51,13 +51,13 @@ public class ChunkWatchEvent extends Event
**/
public static class Watch extends ChunkWatchEvent
{
public Watch(ChunkCoordIntPair chunk, EntityPlayerMP player) { super(chunk, player); }
public Watch(ChunkPos chunk, EntityPlayerMP player) { super(chunk, player); }
}
/**
* ChunkWatchEvent.UnWatch is fired when an EntityPlayer stops watching a chunk.<br>
* This event is fired when a chunk is removed from the watched chunks of an EntityPlayer in
* {@link PlayerManager.PlayerInstance#removePlayer(EntityPlayerMP)}. <br>
* {@link PlayerChunkMapEntry#removePlayer(EntityPlayerMP)}. <br>
* <br>
* This event is not {@link Cancelable}.<br>
* <br>
@@ -67,6 +67,6 @@ public class ChunkWatchEvent extends Event
**/
public static class UnWatch extends ChunkWatchEvent
{
public UnWatch(ChunkCoordIntPair chunkLocation, EntityPlayerMP player) { super(chunkLocation, player); }
public UnWatch(ChunkPos chunkLocation, EntityPlayerMP player) { super(chunkLocation, player); }
}
}
@@ -17,11 +17,7 @@ import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraft.world.WorldSettings;
import net.minecraft.world.WorldType;
import net.minecraft.world.biome.BiomeGenBase.SpawnListEntry;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.ForgeInternalHandler;
import net.minecraftforge.common.MinecraftForge;
import net.minecraft.world.biome.Biome.SpawnListEntry;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;