diff --git a/patches.mcp/minecraft/net/minecraft/block/Block.java.patch b/patches.mcp/minecraft/net/minecraft/block/Block.java.patch deleted file mode 100644 index 6cf1659ec..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/Block.java.patch +++ /dev/null @@ -1,1365 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/Block.java -+++ ../src-work/minecraft/net/minecraft/block/Block.java -@@ -46,8 +46,9 @@ - public class Block - { - private static final ResourceLocation AIR_ID = new ResourceLocation("air"); -- public static final RegistryNamespacedDefaultedByKey blockRegistry = new RegistryNamespacedDefaultedByKey(AIR_ID); -- public static final ObjectIntIdentityMap BLOCK_STATE_IDS = new ObjectIntIdentityMap(); -+ public static final RegistryNamespacedDefaultedByKey blockRegistry = net.minecraftforge.fml.common.registry.GameData.getBlockRegistry(); -+ @Deprecated //Modders: DO NOT use this! Use GameRegistry -+ public static final ObjectIntIdentityMap BLOCK_STATE_IDS = net.minecraftforge.fml.common.registry.GameData.getBlockStateIDMap(); - public static final AxisAlignedBB field_185505_j = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); - public static final AxisAlignedBB field_185506_k = null; - private CreativeTabs displayOnCreativeTab; -@@ -70,6 +71,9 @@ - private IBlockState defaultBlockState; - private String unlocalizedName; - -+ public final net.minecraftforge.fml.common.registry.RegistryDelegate delegate = -+ ((net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry)blockRegistry).getDelegate(this, Block.class); -+ - public static int getIdFromBlock(Block blockIn) - { - return blockRegistry.getIDForObject(blockIn); -@@ -83,7 +87,8 @@ - - public static Block getBlockById(int id) - { -- return (Block)blockRegistry.getObjectById(id); -+ Block ret = (Block)blockRegistry.getObjectById(id); -+ return ret == null ? net.minecraft.init.Blocks.air : ret; - } - - public static IBlockState getStateById(int id) -@@ -268,7 +273,7 @@ - - public boolean isReplaceable(IBlockAccess worldIn, BlockPos pos) - { -- return false; -+ return worldIn.getBlockState(pos).func_185904_a().isReplaceable(); - } - - public Block setHardness(float hardness) -@@ -305,9 +310,10 @@ - return this.needsRandomTick; - } - -+ @Deprecated //Forge: New State sensitive version. - public boolean hasTileEntity() - { -- return this.isBlockContainer; -+ return hasTileEntity(getDefaultState()); - } - - public AxisAlignedBB func_185496_a(IBlockState p_185496_1_, IBlockAccess p_185496_2_, BlockPos p_185496_3_) -@@ -346,13 +352,13 @@ - @SideOnly(Side.CLIENT) - public int func_185484_c(IBlockState p_185484_1_, IBlockAccess p_185484_2_, BlockPos p_185484_3_) - { -- int i = p_185484_2_.getCombinedLight(p_185484_3_, p_185484_1_.func_185906_d()); -+ int i = p_185484_2_.getCombinedLight(p_185484_3_, p_185484_1_.getLightValue(p_185484_2_, p_185484_3_)); - - if (i == 0 && p_185484_1_.getBlock() instanceof BlockSlab) - { - p_185484_3_ = p_185484_3_.down(); - p_185484_1_ = p_185484_2_.getBlockState(p_185484_3_); -- return p_185484_2_.getCombinedLight(p_185484_3_, p_185484_1_.func_185906_d()); -+ return p_185484_2_.getCombinedLight(p_185484_3_, p_185484_1_.getLightValue(p_185484_2_, p_185484_3_)); - } - else - { -@@ -415,7 +421,7 @@ - } - } - -- return !pos.getBlockState(side.offset(p_176225_4_)).func_185914_p(); -+ return !pos.getBlockState(side.offset(p_176225_4_)).doesSideBlockRendering(pos, side.offset(p_176225_4_), p_176225_4_.getOpposite()); - } - - @SideOnly(Side.CLIENT) -@@ -472,6 +478,10 @@ - - public void breakBlock(World worldIn, BlockPos pos, IBlockState state) - { -+ if (hasTileEntity(state) && !(this instanceof BlockContainer)) -+ { -+ worldIn.removeTileEntity(pos); -+ } - } - - public int quantityDropped(Random random) -@@ -486,8 +496,7 @@ - - public float getPlayerRelativeBlockHardness(IBlockState playerIn, EntityPlayer worldIn, World pos, BlockPos p_180647_4_) - { -- float f = playerIn.func_185887_b(pos, p_180647_4_); -- return f < 0.0F ? 0.0F : (!worldIn.func_184823_b(playerIn) ? worldIn.func_184813_a(playerIn) / f / 100.0F : worldIn.func_184813_a(playerIn) / f / 30.0F); -+ return net.minecraftforge.common.ForgeHooks.blockStrength(playerIn, worldIn, pos, p_180647_4_); - } - - public final void dropBlockAsItem(World worldIn, BlockPos pos, IBlockState state, int forture) -@@ -497,20 +506,16 @@ - - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { -- if (!worldIn.isRemote) -+ if (!worldIn.isRemote && !worldIn.restoringBlockSnapshots) // do not drop items while restoring blockstates, prevents item dupe - { -- int i = this.quantityDroppedWithBonus(fortune, worldIn.rand); -+ java.util.List items = getDrops(worldIn, pos, state, fortune); -+ chance = net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, state, fortune, chance, false, harvesters.get()); - -- for (int j = 0; j < i; ++j) -+ for (ItemStack item : items) - { - if (worldIn.rand.nextFloat() <= chance) - { -- Item item = this.getItemDropped(state, worldIn.rand, fortune); -- -- if (item != null) -- { -- spawnAsEntity(worldIn, pos, new ItemStack(item, 1, this.damageDropped(state))); -- } -+ spawnAsEntity(worldIn, pos, item); - } - } - } -@@ -518,8 +523,13 @@ - - public static void spawnAsEntity(World worldIn, BlockPos pos, ItemStack stack) - { -- if (!worldIn.isRemote && worldIn.getGameRules().getBoolean("doTileDrops")) -+ if (!worldIn.isRemote && worldIn.getGameRules().getBoolean("doTileDrops") && !worldIn.restoringBlockSnapshots) // do not drop items while restoring blockstates, prevents item dupe - { -+ if (captureDrops.get()) -+ { -+ capturedDrops.get().add(stack); -+ return; -+ } - float f = 0.5F; - double d0 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; - double d1 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; -@@ -588,7 +598,7 @@ - - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) - { -- return worldIn.getBlockState(pos).getBlock().blockMaterial.isReplaceable(); -+ return worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos); - } - - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand side, ItemStack hitX, EnumFacing hitY, float hitZ, float p_180639_9_, float p_180639_10_) -@@ -638,25 +648,35 @@ - player.triggerAchievement(StatList.func_188055_a(this)); - player.addExhaustion(0.025F); - -- if (this.canSilkHarvest() && EnchantmentHelper.getEnchantmentLevel(Enchantments.field_185306_r, p_180657_6_) > 0) -+ if (this.canSilkHarvest(worldIn, pos, state, player) && EnchantmentHelper.getEnchantmentLevel(Enchantments.field_185306_r, p_180657_6_) > 0) - { -+ java.util.List items = new java.util.ArrayList(); - ItemStack itemstack = this.createStackedBlock(state); - - if (itemstack != null) - { -- spawnAsEntity(worldIn, pos, itemstack); -+ items.add(itemstack); - } -+ -+ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, state, 0, 1.0f, true, player); -+ for (ItemStack stack : items) -+ { -+ spawnAsEntity(worldIn, pos, stack); -+ } - } - else - { -+ harvesters.set(player); - int i = EnchantmentHelper.getEnchantmentLevel(Enchantments.field_185308_t, p_180657_6_); - this.dropBlockAsItem(worldIn, pos, state, i); -+ harvesters.set(null); - } - } - -+ @Deprecated //Forge: State sensitive version - protected boolean canSilkHarvest() - { -- return this.getDefaultState().func_185917_h() && !this.isBlockContainer; -+ return this.getDefaultState().func_185917_h() && !this.hasTileEntity(silk_check_state.get()); - } - - protected ItemStack createStackedBlock(IBlockState state) -@@ -747,6 +767,7 @@ - entityIn.motionY = 0.0D; - } - -+ @Deprecated // Forge: Use more sensitive version below: getPickBlock - public ItemStack func_185473_a(World p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_) - { - return new ItemStack(Item.getItemFromBlock(this), 1, this.damageDropped(p_185473_3_)); -@@ -844,6 +865,1166 @@ - return "Block{" + blockRegistry.getNameForObject(this) + "}"; - } - -+ /* ======================================== FORGE START =====================================*/ -+ //For ForgeInternal use Only! -+ protected ThreadLocal harvesters = new ThreadLocal(); -+ private ThreadLocal silk_check_state = new ThreadLocal(); -+ protected static java.util.Random RANDOM = new java.util.Random(); // Useful for random things without a seed. -+ /** -+ * Get a light value for the block at the specified coordinates, normal ranges are between 0 and 15 -+ * -+ * @param state Block state -+ * @param world The current world -+ * @param pos Block position in world -+ * @return The light value -+ */ -+ public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) -+ { -+ IBlockState other = world.getBlockState(pos); -+ if (other.getBlock() != this) -+ { -+ return other.getLightValue(world, pos); -+ } -+ return state.func_185906_d(); -+ } -+ -+ /** -+ * Checks if a player or entity can use this block to 'climb' like a ladder. -+ * -+ * @param state The current state -+ * @param world The current world -+ * @param pos Block position in world -+ * @param entity The entity trying to use the ladder, CAN be null. -+ * @return True if the block should act like a ladder -+ */ -+ public boolean isLadder(IBlockState state, IBlockAccess world, BlockPos pos, EntityLivingBase entity) { return false; } -+ -+ /** -+ * Return true if the block is a normal, solid cube. This -+ * determines indirect power state, entity ejection from blocks, and a few -+ * others. -+ * -+ * @param state The current state -+ * @param world The current world -+ * @param pos Block position in world -+ * @return True if the block is a full cube -+ */ -+ public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) -+ { -+ return state.func_185904_a().isOpaque() && state.func_185917_h() && !state.func_185897_m(); -+ } -+ -+ /** -+ * Check if the face of a block should block rendering. -+ * -+ * Faces which are fully opaque should return true, faces with transparency -+ * or faces which do not span the full size of the block should return false. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param side The side to check -+ * @return True if the block is opaque on the specified side. -+ */ -+ public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face) -+ { -+ return state.func_185914_p(); -+ } -+ -+ /** -+ * Checks if the block is a solid face on the given side, used by placement logic. -+ * -+ * @param base_state The base state, getActualState should be called first -+ * @param world The current world -+ * @param pos Block position in world -+ * @param side The side to check -+ * @return True if the block is solid on the specified side. -+ */ -+ public boolean isSideSolid(IBlockState base_state, IBlockAccess world, BlockPos pos, EnumFacing side) -+ { -+ if (base_state.func_185896_q()) // Short circuit to vanilla function if its true -+ return true; -+ -+ IBlockState state = this.getActualState(base_state, world, pos); -+ -+ if (this instanceof BlockSlab) -+ { -+ return base_state.func_185913_b() -+ || (state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP && side == EnumFacing.UP ) -+ || (state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM && side == EnumFacing.DOWN); -+ } -+ else if (this instanceof BlockFarmland) -+ { -+ return (side != EnumFacing.DOWN && side != EnumFacing.UP); -+ } -+ else if (this instanceof BlockStairs) -+ { -+ boolean flipped = state.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP; -+ BlockStairs.EnumShape shape = (BlockStairs.EnumShape)state.getValue(BlockStairs.SHAPE); -+ EnumFacing facing = (EnumFacing)state.getValue(BlockStairs.FACING); -+ if (side == EnumFacing.UP) return flipped; -+ if (side == EnumFacing.DOWN) return !flipped; -+ if (facing == side) return true; -+ if (flipped) -+ { -+ if (shape == BlockStairs.EnumShape.INNER_LEFT ) return side == facing.rotateYCCW(); -+ if (shape == BlockStairs.EnumShape.INNER_RIGHT) return side == facing.rotateY(); -+ } -+ else -+ { -+ if (shape == BlockStairs.EnumShape.INNER_LEFT ) return side == facing.rotateY(); -+ if (shape == BlockStairs.EnumShape.INNER_RIGHT) return side == facing.rotateYCCW(); -+ } -+ return false; -+ } -+ else if (this instanceof BlockSnow) -+ { -+ return ((Integer)state.getValue(BlockSnow.LAYERS)) >= 8; -+ } -+ else if (this instanceof BlockHopper && side == EnumFacing.UP) -+ { -+ return true; -+ } -+ else if (this instanceof BlockCompressedPowered) -+ { -+ return true; -+ } -+ return isNormalCube(state, world, pos); -+ } -+ -+ /** -+ * Determines if this block should set fire and deal fire damage -+ * to entities coming into contact with it. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @return True if the block should deal damage -+ */ -+ public boolean isBurning(IBlockAccess world, BlockPos pos) -+ { -+ return false; -+ } -+ -+ /** -+ * Determines this block should be treated as an air block -+ * by the rest of the code. This method is primarily -+ * useful for creating pure logic-blocks that will be invisible -+ * to the player and otherwise interact as air would. -+ * -+ * @param sata The current state -+ * @param world The current world -+ * @param pos Block position in world -+ * @return True if the block considered air -+ */ -+ public boolean isAir(IBlockState state, IBlockAccess world, BlockPos pos) -+ { -+ return state.func_185904_a() == Material.air; -+ } -+ -+ /** -+ * Determines if the player can harvest this block, obtaining it's drops when the block is destroyed. -+ * -+ * @param player The player damaging the block, may be null -+ * @param meta The block's current metadata -+ * @return True to spawn the drops -+ */ -+ public boolean canHarvestBlock(IBlockAccess world, BlockPos pos, EntityPlayer player) -+ { -+ return net.minecraftforge.common.ForgeHooks.canHarvestBlock(this, player, world, pos); -+ } -+ -+ /** -+ * Called when a player removes a block. This is responsible for -+ * actually destroying the block, and the block is intact at time of call. -+ * This is called regardless of whether the player can harvest the block or -+ * not. -+ * -+ * Return true if the block is actually destroyed. -+ * -+ * Note: When used in multiplayer, this is called on both client and -+ * server sides! -+ * -+ * @param state The current state. -+ * @param world The current world -+ * @param player The player damaging the block, may be null -+ * @param pos Block position in world -+ * @param willHarvest True if Block.harvestBlock will be called after this, if the return in true. -+ * Can be useful to delay the destruction of tile entities till after harvestBlock -+ * @return True if the block is actually destroyed. -+ */ -+ public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) -+ { -+ this.onBlockHarvested(world, pos, state, player); -+ return world.setBlockState(pos, net.minecraft.init.Blocks.air.getDefaultState(), world.isRemote ? 11 : 3); -+ } -+ -+ /** -+ * Chance that fire will spread and consume this block. -+ * 300 being a 100% chance, 0, being a 0% chance. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param face The face that the fire is coming from -+ * @return A number ranging from 0 to 300 relating used to determine if the block will be consumed by fire -+ */ -+ public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face) -+ { -+ return net.minecraft.init.Blocks.fire.getFlammability(this); -+ } -+ -+ /** -+ * Called when fire is updating, checks if a block face can catch fire. -+ * -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param face The face that the fire is coming from -+ * @return True if the face can be on fire, false otherwise. -+ */ -+ public boolean isFlammable(IBlockAccess world, BlockPos pos, EnumFacing face) -+ { -+ return getFlammability(world, pos, face) > 0; -+ } -+ -+ /** -+ * Called when fire is updating on a neighbor block. -+ * The higher the number returned, the faster fire will spread around this block. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param face The face that the fire is coming from -+ * @return A number that is used to determine the speed of fire growth around the block -+ */ -+ public int getFireSpreadSpeed(IBlockAccess world, BlockPos pos, EnumFacing face) -+ { -+ return net.minecraft.init.Blocks.fire.getEncouragement(this); -+ } -+ -+ /** -+ * Currently only called by fire when it is on top of this block. -+ * Returning true will prevent the fire from naturally dying during updating. -+ * Also prevents firing from dying from rain. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param metadata The blocks current metadata -+ * @param side The face that the fire is coming from -+ * @return True if this block sustains fire, meaning it will never go out. -+ */ -+ public boolean isFireSource(World world, BlockPos pos, EnumFacing side) -+ { -+ if (this == net.minecraft.init.Blocks.netherrack && side == EnumFacing.UP) -+ { -+ return true; -+ } -+ if ((world.provider instanceof net.minecraft.world.WorldProviderEnd) && this == net.minecraft.init.Blocks.bedrock && side == EnumFacing.UP) -+ { -+ return true; -+ } -+ return false; -+ } -+ -+ private boolean isTileProvider = this instanceof ITileEntityProvider; -+ /** -+ * Called throughout the code as a replacement for block instanceof BlockContainer -+ * Moving this to the Block base class allows for mods that wish to extend vanilla -+ * blocks, and also want to have a tile entity on that block, may. -+ * -+ * Return true from this function to specify this block has a tile entity. -+ * -+ * @param state State of the current block -+ * @return True if block has a tile entity, false otherwise -+ */ -+ public boolean hasTileEntity(IBlockState state) -+ { -+ return isTileProvider; -+ } -+ -+ /** -+ * Called throughout the code as a replacement for ITileEntityProvider.createNewTileEntity -+ * Return the same thing you would from that function. -+ * This will fall back to ITileEntityProvider.createNewTileEntity(World) if this block is a ITileEntityProvider -+ * -+ * @param metadata The Metadata of the current block -+ * @return A instance of a class extending TileEntity -+ */ -+ public TileEntity createTileEntity(World world, IBlockState state) -+ { -+ if (isTileProvider) -+ { -+ return ((ITileEntityProvider)this).createNewTileEntity(world, getMetaFromState(state)); -+ } -+ return null; -+ } -+ -+ /** -+ * State and fortune sensitive version, this replaces the old (int meta, Random rand) -+ * version in 1.1. -+ * -+ * @param state Current state -+ * @param fortune Current item fortune level -+ * @param random Random number generator -+ * @return The number of items to drop -+ */ -+ public int quantityDropped(IBlockState state, int fortune, Random random) -+ { -+ return quantityDroppedWithBonus(fortune, random); -+ } -+ -+ /** -+ * This returns a complete list of items dropped from this block. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param state Current state -+ * @param fortune Breakers fortune level -+ * @return A ArrayList containing all items this block drops -+ */ -+ public List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ List ret = new java.util.ArrayList(); -+ -+ Random rand = world instanceof World ? ((World)world).rand : RANDOM; -+ -+ int count = quantityDropped(state, fortune, rand); -+ for(int i = 0; i < count; i++) -+ { -+ Item item = this.getItemDropped(state, rand, fortune); -+ if (item != null) -+ { -+ ret.add(new ItemStack(item, 1, this.damageDropped(state))); -+ } -+ } -+ return ret; -+ } -+ -+ /** -+ * Return true from this function if the player with silk touch can harvest this block directly, and not it's normal drops. -+ * -+ * @param world The world -+ * @param pos Block position in world -+ * @param state current block state -+ * @param player The player doing the harvesting -+ * @return True if the block can be directly harvested using silk touch -+ */ -+ public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player) -+ { -+ silk_check_state.set(state);; -+ boolean ret = this.canSilkHarvest(); -+ silk_check_state.set(null); -+ return ret; -+ } -+ -+ /** -+ * Determines if a specified mob type can spawn on this block, returning false will -+ * prevent any mob from spawning on the block. -+ * -+ * @param state The current state -+ * @param world The current world -+ * @param pos Block position in world -+ * @param type The Mob Category Type -+ * @return True to allow a mob of the specified category to spawn, false to prevent it. -+ */ -+ public boolean canCreatureSpawn(IBlockState state, IBlockAccess world, BlockPos pos, net.minecraft.entity.EntityLiving.SpawnPlacementType type) -+ { -+ return isSideSolid(state, world, pos, EnumFacing.UP); -+ } -+ -+ /** -+ * Determines if this block is classified as a Bed, Allowing -+ * players to sleep in it, though the block has to specifically -+ * perform the sleeping functionality in it's activated event. -+ * -+ * @param state The current state -+ * @param world The current world -+ * @param pos Block position in world -+ * @param player The player or camera entity, null in some cases. -+ * @return True to treat this as a bed -+ */ -+ public boolean isBed(IBlockState state, IBlockAccess world, BlockPos pos, Entity player) -+ { -+ return this == net.minecraft.init.Blocks.bed; -+ } -+ -+ /** -+ * Returns the position that the player is moved to upon -+ * waking up, or respawning at the bed. -+ * -+ * @param state The current state -+ * @param world The current world -+ * @param pos Block position in world -+ * @param player The player or camera entity, null in some cases. -+ * @return The spawn position -+ */ -+ public BlockPos getBedSpawnPosition(IBlockState state, IBlockAccess world, BlockPos pos, EntityPlayer player) -+ { -+ if (world instanceof World) -+ return BlockBed.getSafeExitLocation((World)world, pos, 0); -+ return null; -+ } -+ -+ /** -+ * Called when a user either starts or stops sleeping in the bed. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param player The player or camera entity, null in some cases. -+ * @param occupied True if we are occupying the bed, or false if they are stopping use of the bed -+ */ -+ public void setBedOccupied(IBlockAccess world, BlockPos pos, EntityPlayer player, boolean occupied) -+ { -+ if (world instanceof World) -+ { -+ IBlockState state = world.getBlockState(pos); -+ state = state.getBlock().getActualState(state, world, pos); -+ state = state.withProperty(BlockBed.OCCUPIED, true); -+ ((World)world).setBlockState(pos, state, 4); -+ } -+ } -+ -+ /** -+ * Returns the direction of the block. Same values that -+ * are returned by BlockDirectional -+ * -+ * @param state The current state -+ * @param world The current world -+ * @param pos Block position in world -+ * @return Bed direction -+ */ -+ public EnumFacing getBedDirection(IBlockState state, IBlockAccess world, BlockPos pos) -+ { -+ return (EnumFacing)getActualState(state, world, pos).getValue(BlockHorizontal.field_185512_D); -+ } -+ -+ /** -+ * Determines if the current block is the foot half of the bed. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @return True if the current block is the foot side of a bed. -+ */ -+ public boolean isBedFoot(IBlockAccess world, BlockPos pos) -+ { -+ return getActualState(world.getBlockState(pos), world, pos).getValue(BlockBed.PART) == BlockBed.EnumPartType.FOOT; -+ } -+ -+ /** -+ * Called when a leaf should start its decay process. -+ * -+ * @param state The current state -+ * @param world The current world -+ * @param pos Block position in world -+ */ -+ public void beginLeavesDecay(IBlockState state, World world, BlockPos pos){} -+ -+ /** -+ * Determines if this block can prevent leaves connected to it from decaying. -+ * @param state The current state -+ * @param world The current world -+ * @param pos Block position in world -+ * @return true if the presence this block can prevent leaves from decaying. -+ */ -+ public boolean canSustainLeaves(IBlockState state, IBlockAccess world, BlockPos pos) -+ { -+ return false; -+ } -+ -+ /** -+ * Determines if this block is considered a leaf block, used to apply the leaf decay and generation system. -+ * -+ * @param state The current state -+ * @param world The current world -+ * @param pos Block position in world -+ * @return true if this block is considered leaves. -+ */ -+ public boolean isLeaves(IBlockState state, IBlockAccess world, BlockPos pos) -+ { -+ return state.func_185904_a() == Material.leaves; -+ } -+ -+ /** -+ * Used during tree growth to determine if newly generated leaves can replace this block. -+ * -+ * @param state The current state -+ * @param world The current world -+ * @param pos Block position in world -+ * @return true if this block can be replaced by growing leaves. -+ */ -+ public boolean canBeReplacedByLeaves(IBlockState state, IBlockAccess world, BlockPos pos) -+ { -+ return !state.func_185913_b(); -+ } -+ -+ /** -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @return true if the block is wood (logs) -+ */ -+ public boolean isWood(IBlockAccess world, BlockPos pos) -+ { -+ return false; -+ } -+ -+ /** -+ * Determines if the current block is replaceable by Ore veins during world generation. -+ * -+ * @param state The current state -+ * @param world The current world -+ * @param pos Block position in world -+ * @param target The generic target block the gen is looking for, Standards define stone -+ * for overworld generation, and neatherack for the nether. -+ * @return True to allow this block to be replaced by a ore -+ */ -+ public boolean isReplaceableOreGen(IBlockState state, IBlockAccess world, BlockPos pos, com.google.common.base.Predicate target) -+ { -+ return target.apply(state); -+ } -+ -+ /** -+ * Location sensitive version of getExplosionRestance -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param exploder The entity that caused the explosion, can be null -+ * @param explosion The explosion -+ * @return The amount of the explosion absorbed. -+ */ -+ public float getExplosionResistance(World world, BlockPos pos, Entity exploder, Explosion explosion) -+ { -+ return getExplosionResistance(exploder); -+ } -+ -+ /** -+ * Called when the block is destroyed by an explosion. -+ * Useful for allowing the block to take into account tile entities, -+ * state, etc. when exploded, before it is removed. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param Explosion The explosion instance affecting the block -+ */ -+ public void onBlockExploded(World world, BlockPos pos, Explosion explosion) -+ { -+ world.setBlockToAir(pos); -+ onBlockDestroyedByExplosion(world, pos, explosion); -+ } -+ -+ /** -+ * Determine if this block can make a redstone connection on the side provided, -+ * Useful to control which sides are inputs and outputs for redstone wires. -+ * -+ * @param state The current state -+ * @param world The current world -+ * @param pos Block position in world -+ * @param side The side that is trying to make the connection, CAN BE NULL -+ * @return True to make the connection -+ */ -+ public boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) -+ { -+ return state.func_185897_m() && side != null; -+ } -+ -+ /** -+ * Determines if a torch can be placed on the top surface of this block. -+ * Useful for creating your own block that torches can be on, such as fences. -+ * -+ * @param state The current state -+ * @param world The current world -+ * @param pos Block position in world -+ * @return True to allow the torch to be placed -+ */ -+ public boolean canPlaceTorchOnTop(IBlockState state, IBlockAccess world, BlockPos pos) -+ { -+ if (state.isSideSolid(world, pos, EnumFacing.UP)) -+ { -+ return true; -+ } -+ else -+ { -+ return this instanceof BlockFence || this == net.minecraft.init.Blocks.glass || this == net.minecraft.init.Blocks.cobblestone_wall || this == net.minecraft.init.Blocks.stained_glass; -+ } -+ } -+ -+ /** Dont think this exists in 1.8 anymore -+ /** -+ * Determines if this block should render in this pass. -+ * -+ * @param pass The pass in question -+ * @return True to render -+ * / -+ public boolean canRenderInPass(int pass) -+ { -+ return pass == func_149701_w(); -+ } -+ */ -+ -+ /** -+ * Called when a user uses the creative pick block button on this block -+ * -+ * @param target The full target the player is looking at -+ * @return A ItemStack to add to the player's inventory, Null if nothing should be added. -+ */ -+ public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) -+ { -+ return func_185473_a(world, pos, state); -+ } -+ -+ /** -+ * Used by getTopSolidOrLiquidBlock while placing biome decorations, villages, etc -+ * Also used to determine if the player can spawn on this block. -+ * -+ * @return False to disallow spawning -+ */ -+ public boolean isFoliage(IBlockAccess world, BlockPos pos) -+ { -+ return false; -+ } -+ -+ /** -+ * Allows a block to override the standard EntityLivingBase.updateFallState -+ * particles, this is a server side method that spawns particles with -+ * WorldServer.spawnParticle -+ * -+ * @param world The current Server world -+ * @param blockPosition of the block that the entity landed on. -+ * @param iblockstate State at the specific world/pos -+ * @param entity the entity that hit landed on the block. -+ * @param numberOfParticles that vanilla would have spawned. -+ * @return True to prevent vanilla landing particles form spawning. -+ */ -+ public boolean addLandingEffects(IBlockState state, net.minecraft.world.WorldServer worldObj, BlockPos blockPosition, IBlockState iblockstate, EntityLivingBase entity, int numberOfParticles ) -+ { -+ return false; -+ } -+ -+ /** -+ * Spawn a digging particle effect in the world, this is a wrapper -+ * around EffectRenderer.addBlockHitEffects to allow the block more -+ * control over the particles. Useful when you have entirely different -+ * texture sheets for different sides/locations in the world. -+ * -+ * @param state The current state -+ * @param world The current world -+ * @param target The target the player is looking at {x/y/z/side/sub} -+ * @param effectRenderer A reference to the current effect renderer. -+ * @return True to prevent vanilla digging particles form spawning. -+ */ -+ @SideOnly(Side.CLIENT) -+ public boolean addHitEffects(IBlockState state, World worldObj, RayTraceResult target, net.minecraft.client.particle.EffectRenderer effectRenderer) -+ { -+ return false; -+ } -+ -+ /** -+ * Spawn particles for when the block is destroyed. Due to the nature -+ * of how this is invoked, the x/y/z locations are not always guaranteed -+ * to host your block. So be sure to do proper sanity checks before assuming -+ * that the location is this block. -+ * -+ * @param world The current world -+ * @param pos Position to spawn the particle -+ * @param effectRenderer A reference to the current effect renderer. -+ * @return True to prevent vanilla break particles from spawning. -+ */ -+ @SideOnly(Side.CLIENT) -+ public boolean addDestroyEffects(World world, BlockPos pos, net.minecraft.client.particle.EffectRenderer effectRenderer) -+ { -+ return false; -+ } -+ -+ /** -+ * Determines if this block can support the passed in plant, allowing it to be planted and grow. -+ * Some examples: -+ * Reeds check if its a reed, or if its sand/dirt/grass and adjacent to water -+ * Cacti checks if its a cacti, or if its sand -+ * Nether types check for soul sand -+ * Crops check for tilled soil -+ * Caves check if it's a solid surface -+ * Plains check if its grass or dirt -+ * Water check if its still water -+ * -+ * @param state The Current state -+ * @param world The current world -+ * @param pos Block position in world -+ * @param direction The direction relative to the given position the plant wants to be, typically its UP -+ * @param plantable The plant that wants to check -+ * @return True to allow the plant to be planted/stay. -+ */ -+ public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, net.minecraftforge.common.IPlantable plantable) -+ { -+ IBlockState plant = plantable.getPlant(world, pos.offset(direction)); -+ net.minecraftforge.common.EnumPlantType plantType = plantable.getPlantType(world, pos.offset(direction)); -+ -+ if (plant.getBlock() == net.minecraft.init.Blocks.cactus && this == net.minecraft.init.Blocks.cactus) -+ { -+ return true; -+ } -+ -+ if (plant.getBlock() == net.minecraft.init.Blocks.reeds && this == net.minecraft.init.Blocks.reeds) -+ { -+ return true; -+ } -+ -+ if (plantable instanceof BlockBush && ((BlockBush)plantable).func_185514_i(state)) -+ { -+ return true; -+ } -+ -+ switch (plantType) -+ { -+ case Desert: return this == net.minecraft.init.Blocks.sand || this == net.minecraft.init.Blocks.hardened_clay || this == net.minecraft.init.Blocks.stained_hardened_clay || this == net.minecraft.init.Blocks.dirt; -+ case Nether: return this == net.minecraft.init.Blocks.soul_sand; -+ case Crop: return this == net.minecraft.init.Blocks.farmland; -+ case Cave: return state.isSideSolid(world, pos, EnumFacing.UP); -+ case Plains: return this == net.minecraft.init.Blocks.grass || this == net.minecraft.init.Blocks.dirt || this == net.minecraft.init.Blocks.farmland; -+ case Water: return state.func_185904_a() == Material.water && state.getValue(BlockLiquid.LEVEL) == 0; -+ case Beach: -+ boolean isBeach = this == net.minecraft.init.Blocks.grass || this == net.minecraft.init.Blocks.dirt || this == net.minecraft.init.Blocks.sand; -+ boolean hasWater = (world.getBlockState(pos.east()).func_185904_a() == Material.water || -+ world.getBlockState(pos.west()).func_185904_a() == Material.water || -+ world.getBlockState(pos.north()).func_185904_a() == Material.water || -+ world.getBlockState(pos.south()).func_185904_a() == Material.water); -+ return isBeach && hasWater; -+ } -+ -+ return false; -+ } -+ -+ /** -+ * Called when a plant grows on this block, only implemented for saplings using the WorldGen*Trees classes right now. -+ * Modder may implement this for custom plants. -+ * This does not use ForgeDirection, because large/huge trees can be located in non-representable direction, -+ * so the source location is specified. -+ * Currently this just changes the block to dirt if it was grass. -+ * -+ * Note: This happens DURING the generation, the generation may not be complete when this is called. -+ * -+ * @param state The current state -+ * @param world Current world -+ * @param pos Block position in world -+ * @param source Source plant's position in world -+ */ -+ public void onPlantGrow(IBlockState state, World world, BlockPos pos, BlockPos source) -+ { -+ if (this == net.minecraft.init.Blocks.grass || this == net.minecraft.init.Blocks.farmland) -+ { -+ world.setBlockState(pos, net.minecraft.init.Blocks.dirt.getDefaultState(), 2); -+ } -+ } -+ -+ /** -+ * Checks if this soil is fertile, typically this means that growth rates -+ * of plants on this soil will be slightly sped up. -+ * Only vanilla case is tilledField when it is within range of water. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @return True if the soil should be considered fertile. -+ */ -+ public boolean isFertile(World world, BlockPos pos) -+ { -+ if (this == net.minecraft.init.Blocks.farmland) -+ { -+ return ((Integer)world.getBlockState(pos).getValue(BlockFarmland.MOISTURE)) > 0; -+ } -+ -+ return false; -+ } -+ -+ /** -+ * Location aware and overrideable version of the lightOpacity array, -+ * return the number to subtract from the light value when it passes through this block. -+ * -+ * This is not guaranteed to have the tile entity in place before this is called, so it is -+ * Recommended that you have your tile entity call relight after being placed if you -+ * rely on it for light info. -+ * -+ * @param state The Block state -+ * @param world The current world -+ * @param pos Block position in world -+ * @return The amount of light to block, 0 for air, 255 for fully opaque. -+ */ -+ public int getLightOpacity(IBlockState state, IBlockAccess world, BlockPos pos) -+ { -+ return state.func_185891_c(); -+ } -+ -+ /** -+ * Determines if this block is can be destroyed by the specified entities normal behavior. -+ * -+ * @param state The current state -+ * @param world The current world -+ * @param pos Block position in world -+ * @return True to allow the ender dragon to destroy this block -+ */ -+ public boolean canEntityDestroy(IBlockState state, IBlockAccess world, BlockPos pos, Entity entity) -+ { -+ if (entity instanceof net.minecraft.entity.boss.EntityDragon) -+ { -+ return this != net.minecraft.init.Blocks.barrier && -+ this != net.minecraft.init.Blocks.obsidian && -+ this != net.minecraft.init.Blocks.end_stone && -+ this != net.minecraft.init.Blocks.bedrock && -+ this != net.minecraft.init.Blocks.end_portal && -+ this != net.minecraft.init.Blocks.end_portal_frame && -+ this != net.minecraft.init.Blocks.command_block && -+ this != net.minecraft.init.Blocks.field_185776_dc && -+ this != net.minecraft.init.Blocks.field_185777_dd && -+ this != net.minecraft.init.Blocks.iron_bars && -+ this != net.minecraft.init.Blocks.field_185775_db; -+ } -+ else if (entity instanceof net.minecraft.entity.boss.EntityWither) -+ { -+ return net.minecraft.entity.boss.EntityWither.func_181033_a(this); -+ } -+ -+ return true; -+ } -+ -+ /** -+ * Determines if this block can be used as the base of a beacon. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param beacon Beacon position in world -+ * @return True, to support the beacon, and make it active with this block. -+ */ -+ public boolean isBeaconBase(IBlockAccess worldObj, BlockPos pos, BlockPos beacon) -+ { -+ return this == net.minecraft.init.Blocks.emerald_block || this == net.minecraft.init.Blocks.gold_block || this == net.minecraft.init.Blocks.diamond_block || this == net.minecraft.init.Blocks.iron_block; -+ } -+ -+ /** -+ * Rotate the block. For vanilla blocks this rotates around the axis passed in (generally, it should be the "face" that was hit). -+ * Note: for mod blocks, this is up to the block and modder to decide. It is not mandated that it be a rotation around the -+ * face, but could be a rotation to orient *to* that face, or a visiting of possible rotations. -+ * The method should return true if the rotation was successful though. -+ * -+ * @param world The world -+ * @param pos Block position in world -+ * @param axis The axis to rotate around -+ * @return True if the rotation was successful, False if the rotation failed, or is not possible -+ */ -+ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) -+ { -+ IBlockState state = world.getBlockState(pos); -+ for (IProperty prop : state.getProperties().keySet()) -+ { -+ if (prop.getName().equals("facing") || prop.getName().equals("rotation")) -+ { -+ world.setBlockState(pos, state.cycleProperty(prop)); -+ return true; -+ } -+ } -+ return false; -+ } -+ -+ /** -+ * Get the rotations that can apply to the block at the specified coordinates. Null means no rotations are possible. -+ * Note, this is up to the block to decide. It may not be accurate or representative. -+ * @param world The world -+ * @param pos Block position in world -+ * @return An array of valid axes to rotate around, or null for none or unknown -+ */ -+ public EnumFacing[] getValidRotations(World world, BlockPos pos) -+ { -+ IBlockState state = world.getBlockState(pos); -+ for (IProperty prop : state.getProperties().keySet()) -+ { -+ if (prop.getName().equals("facing") && prop.getValueClass() == EnumFacing.class) -+ { -+ @SuppressWarnings("unchecked") -+ java.util.Collection values = ((java.util.Collection)prop.getAllowedValues()); -+ return values.toArray(new EnumFacing[values.size()]); -+ } -+ } -+ return null; -+ } -+ -+ /** -+ * Determines the amount of enchanting power this block can provide to an enchanting table. -+ * @param world The World -+ * @param pos Block position in world -+ * @return The amount of enchanting power this block produces. -+ */ -+ public float getEnchantPowerBonus(World world, BlockPos pos) -+ { -+ return this == net.minecraft.init.Blocks.bookshelf ? 1 : 0; -+ } -+ -+ /** -+ * Common way to recolor a block with an external tool -+ * @param world The world -+ * @param pos Block position in world -+ * @param side The side hit with the coloring tool -+ * @param color The color to change to -+ * @return If the recoloring was successful -+ */ -+ @SuppressWarnings({ "unchecked", "rawtypes" }) -+ public boolean recolorBlock(World world, BlockPos pos, EnumFacing side, net.minecraft.item.EnumDyeColor color) -+ { -+ IBlockState state = world.getBlockState(pos); -+ for (IProperty prop : state.getProperties().keySet()) -+ { -+ if (prop.getName().equals("color") && prop.getValueClass() == net.minecraft.item.EnumDyeColor.class) -+ { -+ net.minecraft.item.EnumDyeColor current = (net.minecraft.item.EnumDyeColor)state.getValue(prop); -+ if (current != color) -+ { -+ world.setBlockState(pos, state.withProperty(prop, color)); -+ return true; -+ } -+ } -+ } -+ return false; -+ } -+ -+ /** -+ * Gathers how much experience this block drops when broken. -+ * -+ * @param state The current state -+ * @param world The world -+ * @param pos Block position -+ * @param fortune -+ * @return Amount of XP from breaking this block. -+ */ -+ public int getExpDrop(IBlockState state, IBlockAccess world, BlockPos pos, int fortune) -+ { -+ return 0; -+ } -+ -+ /** -+ * Called when a tile entity on a side of this block changes is created or is destroyed. -+ * @param world The world -+ * @param pos Block position in world -+ * @param neighbor Block position of neighbor -+ */ -+ public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor){} -+ -+ /** -+ * Called to determine whether to allow the a block to handle its own indirect power rather than using the default rules. -+ * @param world The world -+ * @param pos Block position in world -+ * @param side The INPUT side of the block to be powered - ie the opposite of this block's output side -+ * @return Whether Block#isProvidingWeakPower should be called when determining indirect power -+ */ -+ public boolean shouldCheckWeakPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) -+ { -+ return state.func_185915_l(); -+ } -+ -+ /** -+ * If this block should be notified of weak changes. -+ * Weak changes are changes 1 block away through a solid block. -+ * Similar to comparators. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param side The side to check -+ * @return true To be notified of changes -+ */ -+ public boolean getWeakChanges(IBlockAccess world, BlockPos pos) -+ { -+ return false; -+ } -+ -+ private String[] harvestTool = new String[16];; -+ private int[] harvestLevel = new int[]{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; -+ /** -+ * Sets or removes the tool and level required to harvest this block. -+ * -+ * @param toolClass Class -+ * @param level Harvest level: -+ * Wood: 0 -+ * Stone: 1 -+ * Iron: 2 -+ * Diamond: 3 -+ * Gold: 0 -+ */ -+ public void setHarvestLevel(String toolClass, int level) -+ { -+ java.util.Iterator itr = getBlockState().getValidStates().iterator(); -+ while (itr.hasNext()) -+ { -+ setHarvestLevel(toolClass, level, itr.next()); -+ } -+ } -+ -+ /** -+ * Sets or removes the tool and level required to harvest this block. -+ * -+ * @param toolClass Class -+ * @param level Harvest level: -+ * Wood: 0 -+ * Stone: 1 -+ * Iron: 2 -+ * Diamond: 3 -+ * Gold: 0 -+ * @param state The specific state. -+ */ -+ public void setHarvestLevel(String toolClass, int level, IBlockState state) -+ { -+ int idx = this.getMetaFromState(state); -+ this.harvestTool[idx] = toolClass; -+ this.harvestLevel[idx] = level; -+ } -+ -+ /** -+ * Queries the class of tool required to harvest this block, if null is returned -+ * we assume that anything can harvest this block. -+ */ -+ public String getHarvestTool(IBlockState state) -+ { -+ return harvestTool[getMetaFromState(state)]; -+ } -+ -+ /** -+ * Queries the harvest level of this item stack for the specified tool class, -+ * Returns -1 if this tool is not of the specified type -+ * -+ * @param stack This item stack instance -+ * @return Harvest level, or -1 if not the specified tool type. -+ */ -+ public int getHarvestLevel(IBlockState state) -+ { -+ return harvestLevel[getMetaFromState(state)]; -+ } -+ -+ /** -+ * Checks if the specified tool type is efficient on this block, -+ * meaning that it digs at full speed. -+ */ -+ public boolean isToolEffective(String type, IBlockState state) -+ { -+ if ("pickaxe".equals(type) && (this == net.minecraft.init.Blocks.redstone_ore || this == net.minecraft.init.Blocks.lit_redstone_ore || this == net.minecraft.init.Blocks.obsidian)) -+ return false; -+ return type != null && type.equals(getHarvestTool(state)); -+ } -+ -+ /** -+ * Can return IExtendedBlockState -+ */ -+ public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) -+ { -+ return state; -+ } -+ -+ /** -+ * Called when the entity is inside this block, may be used to determined if the entity can breathing, -+ * display material overlays, or if the entity can swim inside a block. -+ * -+ * @param world that is being tested. -+ * @param blockpos position thats being tested. -+ * @param iblockstate state at world/blockpos -+ * @param entity that is being tested. -+ * @param yToTest, primarily for testingHead, which sends the the eye level of the entity, other wise it sends a y that can be tested vs liquid height. -+ * @param materialIn to test for. -+ * @param testingHead when true, its testing the entities head for vision, breathing ect... otherwise its testing the body, for swimming and movement adjustment. -+ * @return null for default behavior, true if the entity is within the material, false if it was not. -+ */ -+ public Boolean isEntityInsideMaterial(IBlockAccess world, BlockPos blockpos, IBlockState iblockstate, Entity entity, double yToTest, Material materialIn, boolean testingHead) -+ { -+ return null; -+ } -+ -+ /** -+ * Called when boats or fishing hooks are inside the block to check if they are inside -+ * the material requested. -+ * -+ * @param world world that is being tested. -+ * @param pos block thats being tested. -+ * @param boundingBox box to test, generally the bounds of an entity that are besting tested. -+ * @param materialIn to check for. -+ * @return null for default behavior, true if the box is within the material, false if it was not. -+ */ -+ public Boolean isAABBInsideMaterial(World world, BlockPos pos, AxisAlignedBB boundingBox, Material materialIn) -+ { -+ return null; -+ } -+ -+ /** -+ * Queries if this block should render in a given layer. -+ * ISmartBlockModel can use MinecraftForgeClient.getRenderLayer to alter their model based on layer -+ */ -+ public boolean canRenderInLayer(BlockRenderLayer layer) -+ { -+ return getBlockLayer() == layer; -+ } -+ -+ // For Internal use only to capture droped items inside getDrops -+ protected static ThreadLocal captureDrops = new ThreadLocal() -+ { -+ @Override protected Boolean initialValue() { return false; } -+ }; -+ protected static ThreadLocal> capturedDrops = new ThreadLocal>() -+ { -+ @Override protected List initialValue() { return new java.util.ArrayList(); } -+ }; -+ protected List captureDrops(boolean start) -+ { -+ if (start) -+ { -+ captureDrops.set(true); -+ capturedDrops.get().clear(); -+ return null; -+ } -+ else -+ { -+ captureDrops.set(false); -+ return capturedDrops.get(); -+ } -+ } -+ -+ private ResourceLocation registryName = null; -+ /** -+ * Sets a unique name for this Block. This should be used for uniquely identify the instance of the Block. -+ * This is the valid replacement for the atrocious 'getUnlocalizedName().substring(6)' stuff that everyone does. -+ * Unlocalized names have NOTHING to do with unique identifiers. As demonstrated by vanilla blocks and items. -+ * -+ * The supplied name will be prefixed with the currently active mod's modId. -+ * If the supplied name already has a prefix that is different, it will be used and a warning will be logged. -+ * -+ * If a name already exists, or this Block is already registered in a registry, then an IllegalStateException is thrown. -+ * -+ * Returns 'this' to allow for chaining. -+ * -+ * @param name Unique registry name -+ * @return This instance -+ */ -+ public final Block setRegistryName(String name) -+ { -+ if (getRegistryName() != null) -+ throw new IllegalStateException("Attempted to set registry name on block with exisiting registry name! New: " + name + " Old: " + getRegistryName()); -+ int index = name.lastIndexOf(':'); -+ String oldPrefix = index == -1 ? "" : name.substring(0, index); -+ name = index == -1 ? name : name.substring(index + 1); -+ net.minecraftforge.fml.common.ModContainer mc = net.minecraftforge.fml.common.Loader.instance().activeModContainer(); -+ String prefix = mc == null ? "minecraft" : mc.getModId(); -+ if (!oldPrefix.equals(prefix) && oldPrefix.length() > 0) -+ { -+ net.minecraftforge.fml.common.FMLLog.bigWarning("Dangerous alternative prefix %s for name %s, invalid registry invocation/invalid name?", oldPrefix, name); -+ prefix = oldPrefix; -+ } -+ this.registryName = new ResourceLocation(prefix, name); -+ return this; -+ } -+ public final Block setRegistryName(ResourceLocation name){ return setRegistryName(name.toString()); } -+ public final Block setRegistryName(String modID, String name){ return setRegistryName(modID + ":" + name); } -+ -+ /** -+ * A unique identifier for this block, if this block is registered in the game registry it will return that name. -+ * Otherwise it will return the name set in setRegistryName(). -+ * If neither are valid null is returned. -+ * -+ * @return Unique identifier or null. -+ */ -+ public final String getRegistryName() -+ { -+ if (delegate.getResourceName() != null) return delegate.getResourceName().toString(); -+ return registryName != null ? registryName.toString() : null; -+ } -+ /* ========================================= FORGE END ======================================*/ -+ - public static void registerBlocks() - { - registerBlock(0, AIR_ID, (new BlockAir()).setUnlocalizedName("air")); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockBanner.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockBanner.java.patch deleted file mode 100644 index 6a8da5c92..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockBanner.java.patch +++ /dev/null @@ -1,46 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockBanner.java -+++ ../src-work/minecraft/net/minecraft/block/BlockBanner.java -@@ -104,14 +104,7 @@ - - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { -- ItemStack itemstack = this.func_185549_e(worldIn, pos, state); -- -- if (itemstack != null) - { -- spawnAsEntity(worldIn, pos, itemstack); -- } -- else -- { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); - } - } -@@ -138,6 +131,28 @@ - } - } - -+ @Override -+ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ TileEntity te = world.getTileEntity(pos); -+ -+ java.util.List ret = new java.util.ArrayList(); -+ if (te instanceof TileEntityBanner) -+ { -+ TileEntityBanner banner = (TileEntityBanner)te; -+ ItemStack item = new ItemStack(Items.banner, 1, banner.getBaseColor()); -+ NBTTagCompound nbt = new NBTTagCompound(); -+ TileEntityBanner.func_181020_a(nbt, banner.getBaseColor(), banner.func_181021_d()); -+ item.setTagInfo("BlockEntityTag", nbt); -+ ret.add(item); -+ } -+ else -+ { -+ ret.add(new ItemStack(Items.banner, 1, 0)); -+ } -+ return ret; -+ } -+ - public static class BlockBannerHanging extends BlockBanner - { - protected static final AxisAlignedBB field_185551_d = new AxisAlignedBB(0.0D, 0.0D, 0.875D, 1.0D, 0.78125D, 1.0D); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockBush.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockBush.java.patch deleted file mode 100644 index ec7e1b328..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockBush.java.patch +++ /dev/null @@ -1,69 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockBush.java -+++ ../src-work/minecraft/net/minecraft/block/BlockBush.java -@@ -14,7 +14,7 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --public class BlockBush extends Block -+public class BlockBush extends Block implements net.minecraftforge.common.IPlantable - { - protected static final AxisAlignedBB field_185515_b = new AxisAlignedBB(0.30000001192092896D, 0.0D, 0.30000001192092896D, 0.699999988079071D, 0.6000000238418579D, 0.699999988079071D); - -@@ -37,7 +37,8 @@ - - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) - { -- return super.canPlaceBlockAt(worldIn, pos) && this.func_185514_i(worldIn.getBlockState(pos.down())); -+ IBlockState soil = worldIn.getBlockState(pos.down()); -+ return super.canPlaceBlockAt(worldIn, pos) && soil.getBlock().canSustainPlant(soil, worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this); - } - - protected boolean func_185514_i(IBlockState p_185514_1_) -@@ -67,6 +68,11 @@ - - public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) - { -+ if (state.getBlock() == this) //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check. -+ { -+ IBlockState soil = worldIn.getBlockState(pos.down()); -+ return soil.getBlock().canSustainPlant(soil, worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this); -+ } - return this.func_185514_i(worldIn.getBlockState(pos.down())); - } - -@@ -90,6 +96,35 @@ - return false; - } - -+ @Override -+ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) -+ { -+ if (this == Blocks.wheat) return net.minecraftforge.common.EnumPlantType.Crop; -+ if (this == Blocks.carrots) return net.minecraftforge.common.EnumPlantType.Crop; -+ if (this == Blocks.potatoes) return net.minecraftforge.common.EnumPlantType.Crop; -+ if (this == Blocks.melon_stem) return net.minecraftforge.common.EnumPlantType.Crop; -+ if (this == Blocks.pumpkin_stem) return net.minecraftforge.common.EnumPlantType.Crop; -+ if (this == Blocks.deadbush) return net.minecraftforge.common.EnumPlantType.Desert; -+ if (this == Blocks.waterlily) return net.minecraftforge.common.EnumPlantType.Water; -+ if (this == Blocks.red_mushroom) return net.minecraftforge.common.EnumPlantType.Cave; -+ if (this == Blocks.brown_mushroom) return net.minecraftforge.common.EnumPlantType.Cave; -+ if (this == Blocks.nether_wart) return net.minecraftforge.common.EnumPlantType.Nether; -+ if (this == Blocks.sapling) return net.minecraftforge.common.EnumPlantType.Plains; -+ if (this == Blocks.tallgrass) return net.minecraftforge.common.EnumPlantType.Plains; -+ if (this == Blocks.double_plant) return net.minecraftforge.common.EnumPlantType.Plains; -+ if (this == Blocks.red_flower) return net.minecraftforge.common.EnumPlantType.Plains; -+ if (this == Blocks.yellow_flower) return net.minecraftforge.common.EnumPlantType.Plains; -+ return net.minecraftforge.common.EnumPlantType.Plains; -+ } -+ -+ @Override -+ public IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos) -+ { -+ IBlockState state = world.getBlockState(pos); -+ if (state.getBlock() != this) return getDefaultState(); -+ return state; -+ } -+ - @SideOnly(Side.CLIENT) - public BlockRenderLayer getBlockLayer() - { diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockButton.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockButton.java.patch deleted file mode 100644 index 965be0f0c..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockButton.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockButton.java -+++ ../src-work/minecraft/net/minecraft/block/BlockButton.java -@@ -89,7 +89,7 @@ - protected static boolean func_181088_a(World p_181088_0_, BlockPos p_181088_1_, EnumFacing p_181088_2_) - { - BlockPos blockpos = p_181088_1_.offset(p_181088_2_); -- return p_181088_2_ == EnumFacing.DOWN ? p_181088_0_.getBlockState(blockpos).func_185896_q() : p_181088_0_.getBlockState(blockpos).func_185915_l(); -+ return p_181088_0_.getBlockState(blockpos).isSideSolid(p_181088_0_, blockpos, p_181088_2_.getOpposite()); - } - - public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockCactus.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockCactus.java.patch deleted file mode 100644 index c6b8cd71c..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockCactus.java.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockCactus.java -+++ ../src-work/minecraft/net/minecraft/block/BlockCactus.java -@@ -18,7 +18,7 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --public class BlockCactus extends Block -+public class BlockCactus extends Block implements net.minecraftforge.common.IPlantable - { - public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 15); - protected static final AxisAlignedBB field_185593_b = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 0.9375D, 0.9375D); -@@ -110,8 +110,8 @@ - } - } - -- Block block = worldIn.getBlockState(pos.down()).getBlock(); -- return block == Blocks.cactus || block == Blocks.sand && !worldIn.getBlockState(pos.up()).func_185904_a().isLiquid(); -+ IBlockState state = worldIn.getBlockState(pos.down()); -+ return state.getBlock().canSustainPlant(state, worldIn, pos, EnumFacing.UP, this) && !worldIn.getBlockState(pos.up()).func_185904_a().isLiquid(); - } - - public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) -@@ -135,6 +135,18 @@ - return ((Integer)state.getValue(AGE)).intValue(); - } - -+ @Override -+ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) -+ { -+ return net.minecraftforge.common.EnumPlantType.Desert; -+ } -+ -+ @Override -+ public IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos) -+ { -+ return getDefaultState(); -+ } -+ - protected BlockStateContainer createBlockState() - { - return new BlockStateContainer(this, new IProperty[] {AGE}); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockChest.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockChest.java.patch deleted file mode 100644 index 80f84aa25..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockChest.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockChest.java -+++ ../src-work/minecraft/net/minecraft/block/BlockChest.java -@@ -506,7 +506,7 @@ - - private boolean isBelowSolidBlock(World worldIn, BlockPos pos) - { -- return worldIn.getBlockState(pos.up()).func_185915_l(); -+ return worldIn.getBlockState(pos.up()).isSideSolid(worldIn, pos, EnumFacing.DOWN); - } - - private boolean isOcelotSittingOnChest(World worldIn, BlockPos pos) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockCocoa.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockCocoa.java.patch deleted file mode 100644 index b3bd5f03e..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockCocoa.java.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockCocoa.java -+++ ../src-work/minecraft/net/minecraft/block/BlockCocoa.java -@@ -131,6 +131,13 @@ - - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { -+ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); -+ } -+ -+ @Override -+ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ java.util.List dropped = super.getDrops(world, pos, state, fortune); - int i = ((Integer)state.getValue(AGE)).intValue(); - int j = 1; - -@@ -141,8 +148,9 @@ - - for (int k = 0; k < j; ++k) - { -- spawnAsEntity(worldIn, pos, new ItemStack(Items.dye, 1, EnumDyeColor.BROWN.getDyeDamage())); -+ dropped.add(new ItemStack(Items.dye, 1, EnumDyeColor.BROWN.getDyeDamage())); - } -+ return dropped; - } - - public ItemStack func_185473_a(World p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockCrops.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockCrops.java.patch deleted file mode 100644 index 07b5ee304..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockCrops.java.patch +++ /dev/null @@ -1,61 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockCrops.java -+++ ../src-work/minecraft/net/minecraft/block/BlockCrops.java -@@ -116,11 +116,11 @@ - float f1 = 0.0F; - IBlockState iblockstate = worldIn.getBlockState(blockpos.add(i, 0, j)); - -- if (iblockstate.getBlock() == Blocks.farmland) -+ if (iblockstate.getBlock().canSustainPlant(iblockstate, worldIn, blockpos.add(i, 0, j), net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)blockIn)) - { - f1 = 1.0F; - -- if (((Integer)iblockstate.getValue(BlockFarmland.MOISTURE)).intValue() > 0) -+ if (iblockstate.getBlock().isFertile(worldIn, blockpos.add(i, 0, j))) - { - f1 = 3.0F; - } -@@ -161,7 +161,8 @@ - - public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) - { -- return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && this.func_185514_i(worldIn.getBlockState(pos.down())); -+ IBlockState soil = worldIn.getBlockState(pos.down()); -+ return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && soil.getBlock().canSustainPlant(soil, worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this); - } - - protected Item getSeed() -@@ -174,11 +175,33 @@ - return Items.wheat; - } - -+ @Override -+ public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ java.util.List ret = super.getDrops(world, pos, state, fortune); -+ int age = ((Integer)state.getValue(AGE)).intValue(); -+ Random rand = world instanceof World ? ((World)world).rand : new Random(); -+ -+ if (age >= 7) -+ { -+ int k = 3 + fortune; -+ -+ for (int i = 0; i < 3 + fortune; ++i) -+ { -+ if (rand.nextInt(15) <= age) -+ { -+ ret.add(new ItemStack(this.getSeed(), 1, 0)); -+ } -+ } -+ } -+ return ret; -+ } -+ - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, 0); - -- if (!worldIn.isRemote) -+ if (false && !worldIn.isRemote) // Forge: NOP all this. - { - int i = this.func_185527_x(state); - diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockDeadBush.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockDeadBush.java.patch deleted file mode 100644 index 6e163176e..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockDeadBush.java.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockDeadBush.java -+++ ../src-work/minecraft/net/minecraft/block/BlockDeadBush.java -@@ -16,7 +16,7 @@ - import net.minecraft.world.IBlockAccess; - import net.minecraft.world.World; - --public class BlockDeadBush extends BlockBush -+public class BlockDeadBush extends BlockBush implements net.minecraftforge.common.IShearable - { - protected static final AxisAlignedBB field_185516_a = new AxisAlignedBB(0.09999999403953552D, 0.0D, 0.09999999403953552D, 0.8999999761581421D, 0.800000011920929D, 0.8999999761581421D); - -@@ -57,7 +57,7 @@ - - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack p_180657_6_) - { -- if (!worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears) -+ if (false && !worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears) // Forge: Noop - { - player.triggerAchievement(StatList.func_188055_a(this)); - spawnAsEntity(worldIn, pos, new ItemStack(Blocks.deadbush, 1, 0)); -@@ -67,4 +67,11 @@ - super.harvestBlock(worldIn, player, pos, state, te, p_180657_6_); - } - } -+ -+ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; } -+ @Override -+ public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) -+ { -+ return java.util.Arrays.asList(new ItemStack(Blocks.deadbush)); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockDoor.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockDoor.java.patch deleted file mode 100644 index f0c530774..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockDoor.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockDoor.java -+++ ../src-work/minecraft/net/minecraft/block/BlockDoor.java -@@ -107,7 +107,7 @@ - { - if (this.blockMaterial == Material.iron) - { -- return true; -+ return false; //Allow items to interact with the door - } - else - { -@@ -219,7 +219,7 @@ - - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) - { -- return pos.getY() >= 255 ? false : worldIn.getBlockState(pos.down()).func_185896_q() && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up()); -+ return pos.getY() >= worldIn.getHeight() - 1 ? false : worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos.down(), EnumFacing.UP) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up()); - } - - public EnumPushReaction getMobilityFlag(IBlockState p_149656_1_) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockDoublePlant.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockDoublePlant.java.patch deleted file mode 100644 index f63ceb176..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockDoublePlant.java.patch +++ /dev/null @@ -1,90 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockDoublePlant.java -+++ ../src-work/minecraft/net/minecraft/block/BlockDoublePlant.java -@@ -25,7 +25,7 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --public class BlockDoublePlant extends BlockBush implements IGrowable -+public class BlockDoublePlant extends BlockBush implements IGrowable, net.minecraftforge.common.IShearable - { - public static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockDoublePlant.EnumPlantType.class); - public static final PropertyEnum HALF = PropertyEnum.create("half", BlockDoublePlant.EnumBlockHalf.class); -@@ -88,6 +88,8 @@ - Block block = (Block)(flag ? this : worldIn.getBlockState(blockpos).getBlock()); - Block block1 = (Block)(flag ? worldIn.getBlockState(blockpos1).getBlock() : this); - -+ if (!flag) this.dropBlockAsItem(worldIn, pos, state, 0); //Forge move above the setting to air. -+ - if (block == this) - { - worldIn.setBlockState(blockpos, Blocks.air.getDefaultState(), 2); -@@ -96,17 +98,13 @@ - if (block1 == this) - { - worldIn.setBlockState(blockpos1, Blocks.air.getDefaultState(), 3); -- -- if (!flag) -- { -- this.dropBlockAsItem(worldIn, blockpos1, state, 0); -- } - } - } - } - - public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) - { -+ if (state.getBlock() != this) return super.canBlockStay(worldIn, pos, state); //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check. - if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER) - { - return worldIn.getBlockState(pos.down()).getBlock() == this; -@@ -149,7 +147,6 @@ - - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack p_180657_6_) - { -- if (worldIn.isRemote || p_180657_6_ == null || p_180657_6_.getItem() != Items.shears || state.getValue(HALF) != BlockDoublePlant.EnumBlockHalf.LOWER || !this.onHarvest(worldIn, pos, state, player)) - { - super.harvestBlock(worldIn, player, pos, state, te, p_180657_6_); - } -@@ -212,8 +209,6 @@ - else - { - player.triggerAchievement(StatList.func_188055_a(this)); -- int i = (blockdoubleplant$enumplanttype == BlockDoublePlant.EnumPlantType.GRASS ? BlockTallGrass.EnumType.GRASS : BlockTallGrass.EnumType.FERN).getMeta(); -- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 2, i)); - return true; - } - } -@@ -284,6 +279,33 @@ - return Block.EnumOffsetType.XZ; - } - -+ @Override -+ public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos) -+ { -+ IBlockState state = world.getBlockState(pos); -+ EnumPlantType type = (EnumPlantType)state.getValue(VARIANT); -+ return state.getValue(HALF) == EnumBlockHalf.LOWER && (type == EnumPlantType.FERN || type == EnumPlantType.GRASS); -+ } -+ -+ @Override -+ public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) -+ { -+ java.util.List ret = new java.util.ArrayList(); -+ EnumPlantType type = (EnumPlantType)world.getBlockState(pos).getValue(VARIANT); -+ if (type == EnumPlantType.FERN) ret.add(new ItemStack(Blocks.tallgrass, 2, BlockTallGrass.EnumType.FERN.getMeta())); -+ if (type == EnumPlantType.GRASS) ret.add(new ItemStack(Blocks.tallgrass, 2, BlockTallGrass.EnumType.GRASS.getMeta())); -+ return ret; -+ } -+ -+ @Override -+ public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) -+ { -+ //Forge: Break both parts on the client to prevent the top part flickering as default type for a few frames. -+ if (state.getBlock() == this && state.getValue(HALF) == EnumBlockHalf.LOWER && world.getBlockState(pos.up()).getBlock() == this) -+ world.setBlockToAir(pos.up()); -+ return world.setBlockToAir(pos); -+ } -+ - public static enum EnumBlockHalf implements IStringSerializable - { - UPPER, diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockDragonEgg.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockDragonEgg.java.patch deleted file mode 100644 index 537d71b3f..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockDragonEgg.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockDragonEgg.java -+++ ../src-work/minecraft/net/minecraft/block/BlockDragonEgg.java -@@ -48,7 +48,7 @@ - - private void checkFall(World worldIn, BlockPos pos) - { -- if (BlockFalling.func_185759_i(worldIn.getBlockState(pos.down())) && pos.getY() >= 0) -+ if (worldIn.isAirBlock(pos.down()) && BlockFalling.func_185759_i(worldIn.getBlockState(pos.down())) && pos.getY() >= 0) - { - int i = 32; - -@@ -61,7 +61,7 @@ - worldIn.setBlockToAir(pos); - BlockPos blockpos; - -- for (blockpos = pos; BlockFalling.func_185759_i(worldIn.getBlockState(blockpos)) && blockpos.getY() > 0; blockpos = blockpos.down()) -+ for (blockpos = pos; worldIn.isAirBlock(blockpos) && BlockFalling.func_185759_i(worldIn.getBlockState(blockpos)) && blockpos.getY() > 0; blockpos = blockpos.down()) - { - ; - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockDropper.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockDropper.java.patch deleted file mode 100644 index 20608bde1..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockDropper.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockDropper.java -+++ ../src-work/minecraft/net/minecraft/block/BlockDropper.java -@@ -43,7 +43,7 @@ - { - ItemStack itemstack = tileentitydispenser.getStackInSlot(i); - -- if (itemstack != null) -+ if (itemstack != null && net.minecraftforge.items.VanillaInventoryCodeHooks.dropperInsertHook(worldIn, pos, tileentitydispenser, i, itemstack)) - { - EnumFacing enumfacing = (EnumFacing)worldIn.getBlockState(pos).getValue(FACING); - BlockPos blockpos = pos.offset(enumfacing); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockFalling.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockFalling.java.patch deleted file mode 100644 index 1df616bba..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockFalling.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockFalling.java -+++ ../src-work/minecraft/net/minecraft/block/BlockFalling.java -@@ -44,7 +44,7 @@ - - private void checkFallable(World worldIn, BlockPos pos) - { -- if (func_185759_i(worldIn.getBlockState(pos.down())) && pos.getY() >= 0) -+ if (worldIn.isAirBlock(pos) && func_185759_i(worldIn.getBlockState(pos.down())) && pos.getY() >= 0) - { - int i = 32; - -@@ -62,7 +62,7 @@ - worldIn.setBlockToAir(pos); - BlockPos blockpos; - -- for (blockpos = pos.down(); func_185759_i(worldIn.getBlockState(blockpos)) && blockpos.getY() > 0; blockpos = blockpos.down()) -+ for (blockpos = pos.down(); worldIn.isAirBlock(blockpos) && func_185759_i(worldIn.getBlockState(blockpos)) && blockpos.getY() > 0; blockpos = blockpos.down()) - { - ; - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockFarmland.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockFarmland.java.patch deleted file mode 100644 index a41931a44..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockFarmland.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockFarmland.java -+++ ../src-work/minecraft/net/minecraft/block/BlockFarmland.java -@@ -87,7 +87,7 @@ - private boolean hasCrops(World worldIn, BlockPos pos) - { - Block block = worldIn.getBlockState(pos.up()).getBlock(); -- return block instanceof BlockCrops || block instanceof BlockStem; -+ return block instanceof net.minecraftforge.common.IPlantable && canSustainPlant(worldIn.getBlockState(pos), worldIn, pos, net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)block); - } - - private boolean hasWater(World worldIn, BlockPos pos) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockFire.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockFire.java.patch deleted file mode 100644 index d8ce1b5fa..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockFire.java.patch +++ /dev/null @@ -1,209 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockFire.java -+++ ../src-work/minecraft/net/minecraft/block/BlockFire.java -@@ -37,7 +37,15 @@ - - public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) - { -- return !worldIn.getBlockState(pos.down()).func_185896_q() && !Blocks.fire.canCatchFire(worldIn, pos.down()) ? state.withProperty(NORTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.north()))).withProperty(EAST, Boolean.valueOf(this.canCatchFire(worldIn, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.south()))).withProperty(WEST, Boolean.valueOf(this.canCatchFire(worldIn, pos.west()))).withProperty(UPPER, Boolean.valueOf(this.canCatchFire(worldIn, pos.up()))) : this.getDefaultState(); -+ if (!worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos.down(), EnumFacing.UP) && !Blocks.fire.canCatchFire(worldIn, pos.down(), EnumFacing.UP)) -+ { -+ return state.withProperty(NORTH, this.canCatchFire(worldIn, pos.north(), EnumFacing.SOUTH)) -+ .withProperty(EAST, this.canCatchFire(worldIn, pos.east(), EnumFacing.WEST)) -+ .withProperty(SOUTH, this.canCatchFire(worldIn, pos.south(), EnumFacing.NORTH)) -+ .withProperty(WEST, this.canCatchFire(worldIn, pos.west(), EnumFacing.EAST)) -+ .withProperty(UPPER, this.canCatchFire(worldIn, pos.up(), EnumFacing.DOWN)); -+ } -+ return this.getDefaultState(); - } - - protected BlockFire() -@@ -90,6 +98,7 @@ - - public void setFireInfo(Block blockIn, int encouragement, int flammability) - { -+ if (blockIn == Blocks.air) throw new IllegalArgumentException("Tried to set air on fire... This is bad."); - this.encouragements.put(blockIn, Integer.valueOf(encouragement)); - this.flammabilities.put(blockIn, Integer.valueOf(flammability)); - } -@@ -129,13 +138,8 @@ - } - - Block block = worldIn.getBlockState(pos.down()).getBlock(); -- boolean flag = block == Blocks.netherrack; -+ boolean flag = block.isFireSource(worldIn, pos.down(), EnumFacing.UP); - -- if (worldIn.provider instanceof WorldProviderEnd && block == Blocks.bedrock) -- { -- flag = true; -- } -- - int i = ((Integer)state.getValue(AGE)).intValue(); - - if (!flag && worldIn.isRaining() && this.canDie(worldIn, pos) && rand.nextFloat() < 0.2F + (float)i * 0.03F) -@@ -156,7 +160,7 @@ - { - if (!this.canNeighborCatchFire(worldIn, pos)) - { -- if (!worldIn.getBlockState(pos.down()).func_185896_q() || i > 3) -+ if (!worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos.down(), EnumFacing.UP) || i > 3) - { - worldIn.setBlockToAir(pos); - } -@@ -164,7 +168,7 @@ - return; - } - -- if (!this.canCatchFire(worldIn, pos.down()) && i == 15 && rand.nextInt(4) == 0) -+ if (!this.canCatchFire(worldIn, pos.down(), EnumFacing.UP) && i == 15 && rand.nextInt(4) == 0) - { - worldIn.setBlockToAir(pos); - return; -@@ -179,12 +183,12 @@ - j = -50; - } - -- this.catchOnFire(worldIn, pos.east(), 300 + j, rand, i); -- this.catchOnFire(worldIn, pos.west(), 300 + j, rand, i); -- this.catchOnFire(worldIn, pos.down(), 250 + j, rand, i); -- this.catchOnFire(worldIn, pos.up(), 250 + j, rand, i); -- this.catchOnFire(worldIn, pos.north(), 300 + j, rand, i); -- this.catchOnFire(worldIn, pos.south(), 300 + j, rand, i); -+ this.tryCatchFire(worldIn, pos.east(), 300 + j, rand, i, EnumFacing.WEST); -+ this.tryCatchFire(worldIn, pos.west(), 300 + j, rand, i, EnumFacing.EAST); -+ this.tryCatchFire(worldIn, pos.down(), 250 + j, rand, i, EnumFacing.UP); -+ this.tryCatchFire(worldIn, pos.up(), 250 + j, rand, i, EnumFacing.DOWN); -+ this.tryCatchFire(worldIn, pos.north(), 300 + j, rand, i, EnumFacing.SOUTH); -+ this.tryCatchFire(worldIn, pos.south(), 300 + j, rand, i, EnumFacing.NORTH); - - for (int k = -1; k <= 1; ++k) - { -@@ -243,22 +247,30 @@ - return false; - } - -+ @Deprecated // Use Block.getFlammability - public int getFlammability(Block blockIn) - { - Integer integer = (Integer)this.flammabilities.get(blockIn); - return integer == null ? 0 : integer.intValue(); - } - -+ @Deprecated // Use Block.getFlammability - public int getEncouragement(Block blockIn) - { - Integer integer = (Integer)this.encouragements.get(blockIn); - return integer == null ? 0 : integer.intValue(); - } - -+ @Deprecated // Use tryCatchFire with face below - private void catchOnFire(World worldIn, BlockPos pos, int chance, Random random, int age) - { -- int i = this.getFlammability(worldIn.getBlockState(pos).getBlock()); -+ this.tryCatchFire(worldIn, pos, chance, random, age, EnumFacing.UP); -+ } - -+ private void tryCatchFire(World worldIn, BlockPos pos, int chance, Random random, int age, EnumFacing face) -+ { -+ int i = worldIn.getBlockState(pos).getBlock().getFlammability(worldIn, pos, face); -+ - if (random.nextInt(chance) < i) - { - IBlockState iblockstate = worldIn.getBlockState(pos); -@@ -290,7 +302,7 @@ - { - for (EnumFacing enumfacing : EnumFacing.values()) - { -- if (this.canCatchFire(worldIn, pos.offset(enumfacing))) -+ if (this.canCatchFire(worldIn, pos.offset(enumfacing), enumfacing.getOpposite())) - { - return true; - } -@@ -311,7 +323,7 @@ - - for (EnumFacing enumfacing : EnumFacing.values()) - { -- i = Math.max(this.getEncouragement(worldIn.getBlockState(pos.offset(enumfacing)).getBlock()), i); -+ i = Math.max(worldIn.getBlockState(pos.offset(enumfacing)).getBlock().getFlammability(worldIn, pos.offset(enumfacing), enumfacing.getOpposite()), i); - } - - return i; -@@ -323,9 +335,10 @@ - return false; - } - -+ @Deprecated // Use canCatchFire with face sensitive version below - public boolean canCatchFire(IBlockAccess worldIn, BlockPos pos) - { -- return this.getEncouragement(worldIn.getBlockState(pos).getBlock()) > 0; -+ return canCatchFire(worldIn, pos, EnumFacing.UP); - } - - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) -@@ -364,9 +377,9 @@ - pos.func_184134_a((double)((float)state.getX() + 0.5F), (double)((float)state.getY() + 0.5F), (double)((float)state.getZ() + 0.5F), SoundEvents.field_187643_bs, SoundCategory.BLOCKS, 1.0F + rand.nextFloat(), rand.nextFloat() * 0.7F + 0.3F, false); - } - -- if (!pos.getBlockState(state.down()).func_185896_q() && !Blocks.fire.canCatchFire(pos, state.down())) -+ if (!pos.getBlockState(state.down()).isSideSolid(pos, state.down(), EnumFacing.UP) && !Blocks.fire.canCatchFire(pos, state.down(), EnumFacing.UP)) - { -- if (Blocks.fire.canCatchFire(pos, state.west())) -+ if (Blocks.fire.canCatchFire(pos, state.west(), EnumFacing.EAST)) - { - for (int j = 0; j < 2; ++j) - { -@@ -377,7 +390,7 @@ - } - } - -- if (Blocks.fire.canCatchFire(pos, state.east())) -+ if (Blocks.fire.canCatchFire(pos, state.east(), EnumFacing.WEST)) - { - for (int k = 0; k < 2; ++k) - { -@@ -388,7 +401,7 @@ - } - } - -- if (Blocks.fire.canCatchFire(pos, state.north())) -+ if (Blocks.fire.canCatchFire(pos, state.north(), EnumFacing.SOUTH)) - { - for (int l = 0; l < 2; ++l) - { -@@ -399,7 +412,7 @@ - } - } - -- if (Blocks.fire.canCatchFire(pos, state.south())) -+ if (Blocks.fire.canCatchFire(pos, state.south(), EnumFacing.NORTH)) - { - for (int i1 = 0; i1 < 2; ++i1) - { -@@ -410,7 +423,7 @@ - } - } - -- if (Blocks.fire.canCatchFire(pos, state.up())) -+ if (Blocks.fire.canCatchFire(pos, state.up(), EnumFacing.DOWN)) - { - for (int j1 = 0; j1 < 2; ++j1) - { -@@ -458,4 +471,19 @@ - { - return new BlockStateContainer(this, new IProperty[] {AGE, NORTH, EAST, SOUTH, WEST, UPPER}); - } -+ -+ /*================================= Forge Start ======================================*/ -+ /** -+ * Side sensitive version that calls the block function. -+ * -+ * @param world The current world -+ * @param pos Block position -+ * @param face The side the fire is coming from -+ * @return True if the face can catch fire. -+ */ -+ public boolean canCatchFire(IBlockAccess world, BlockPos pos, EnumFacing face) -+ { -+ return world.getBlockState(pos).getBlock().isFlammable(world, pos, face); -+ } -+ /*================================= Forge Start ======================================*/ - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockFlowerPot.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockFlowerPot.java.patch deleted file mode 100644 index 0e6bf83a5..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockFlowerPot.java.patch +++ /dev/null @@ -1,48 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockFlowerPot.java -+++ ../src-work/minecraft/net/minecraft/block/BlockFlowerPot.java -@@ -148,13 +148,6 @@ - - public void breakBlock(World worldIn, BlockPos pos, IBlockState state) - { -- TileEntityFlowerPot tileentityflowerpot = this.getTileEntity(worldIn, pos); -- -- if (tileentityflowerpot != null && tileentityflowerpot.getFlowerPotItem() != null) -- { -- spawnAsEntity(worldIn, pos, new ItemStack(tileentityflowerpot.getFlowerPotItem(), 1, tileentityflowerpot.getFlowerPotData())); -- } -- - super.breakBlock(worldIn, pos, state); - } - -@@ -374,6 +367,31 @@ - return BlockRenderLayer.CUTOUT; - } - -+ -+ /*============================FORGE START=====================================*/ -+ @Override -+ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ java.util.List ret = super.getDrops(world, pos, state, fortune); -+ TileEntityFlowerPot te = world.getTileEntity(pos) instanceof TileEntityFlowerPot ? (TileEntityFlowerPot)world.getTileEntity(pos) : null; -+ if (te != null && te.getFlowerPotItem() != null) -+ ret.add(new ItemStack(te.getFlowerPotItem(), 1, te.getFlowerPotData())); -+ return ret; -+ } -+ @Override -+ public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) -+ { -+ if (willHarvest) return true; //If it will harvest, delay deletion of the block until after getDrops -+ return super.removedByPlayer(state, world, pos, player, willHarvest); -+ } -+ @Override -+ public void harvestBlock(World world, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack tool) -+ { -+ super.harvestBlock(world, player, pos, state, te, tool); -+ world.setBlockToAir(pos); -+ } -+ /*===========================FORGE END==========================================*/ -+ - public static enum EnumFlowerType implements IStringSerializable - { - EMPTY("empty"), diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockGrass.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockGrass.java.patch deleted file mode 100644 index 6ead8373d..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockGrass.java.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockGrass.java -+++ ../src-work/minecraft/net/minecraft/block/BlockGrass.java -@@ -38,7 +38,7 @@ - { - if (!worldIn.isRemote) - { -- if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).func_185891_c() > 2) -+ if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getLightOpacity(worldIn, pos.up()) > 2) - { - worldIn.setBlockState(pos, Blocks.dirt.getDefaultState()); - } -@@ -58,7 +58,7 @@ - IBlockState iblockstate = worldIn.getBlockState(blockpos.up()); - IBlockState iblockstate1 = worldIn.getBlockState(blockpos); - -- if (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && iblockstate.func_185891_c() <= 2) -+ if (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && iblockstate.getLightOpacity(worldIn, pos.up()) <= 2) - { - worldIn.setBlockState(blockpos, Blocks.grass.getDefaultState()); - } -@@ -96,7 +96,7 @@ - { - if (j >= i / 16) - { -- if (worldIn.getBlockState(blockpos1).getBlock().blockMaterial == Material.air) -+ if (worldIn.isAirBlock(blockpos1)) - { - if (rand.nextInt(8) == 0) - { diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch deleted file mode 100644 index 063f3fcbf..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockHugeMushroom.java -+++ ../src-work/minecraft/net/minecraft/block/BlockHugeMushroom.java -@@ -221,6 +221,20 @@ - return new BlockStateContainer(this, new IProperty[] {VARIANT}); - } - -+ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) -+ { -+ IBlockState state = world.getBlockState(pos); -+ for (IProperty prop : (java.util.Set>)state.getProperties().keySet()) -+ { -+ if (prop.getName().equals("variant")) -+ { -+ world.setBlockState(pos, state.cycleProperty(prop)); -+ return true; -+ } -+ } -+ return false; -+ } -+ - public static enum EnumType implements IStringSerializable - { - NORTH_WEST(1, "north_west"), diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockIce.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockIce.java.patch deleted file mode 100644 index 4ecf2b559..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockIce.java.patch +++ /dev/null @@ -1,34 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockIce.java -+++ ../src-work/minecraft/net/minecraft/block/BlockIce.java -@@ -40,14 +40,19 @@ - player.triggerAchievement(StatList.func_188055_a(this)); - player.addExhaustion(0.025F); - -- if (this.canSilkHarvest() && EnchantmentHelper.getEnchantmentLevel(Enchantments.field_185306_r, p_180657_6_) > 0) -+ if (this.canSilkHarvest(worldIn, pos, state, player) && EnchantmentHelper.getEnchantmentLevel(Enchantments.field_185306_r, p_180657_6_) > 0) - { -+ java.util.List items = new java.util.ArrayList(); - ItemStack itemstack = this.createStackedBlock(state); - - if (itemstack != null) - { -- spawnAsEntity(worldIn, pos, itemstack); -+ items.add(itemstack); - } -+ -+ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, state, 0, 1.0f, true, player); -+ for (ItemStack is : items) -+ spawnAsEntity(worldIn, pos, is); - } - else - { -@@ -58,7 +63,9 @@ - } - - int i = EnchantmentHelper.getEnchantmentLevel(Enchantments.field_185308_t, p_180657_6_); -+ harvesters.set(player); - this.dropBlockAsItem(worldIn, pos, state, i); -+ harvesters.set(null); - Material material = worldIn.getBlockState(pos.down()).func_185904_a(); - - if (material.blocksMovement() || material.isLiquid()) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockLadder.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockLadder.java.patch deleted file mode 100644 index ce3dc11dd..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockLadder.java.patch +++ /dev/null @@ -1,30 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockLadder.java -+++ ../src-work/minecraft/net/minecraft/block/BlockLadder.java -@@ -61,7 +61,10 @@ - - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) - { -- return worldIn.getBlockState(pos.west()).func_185915_l() ? true : (worldIn.getBlockState(pos.east()).func_185915_l() ? true : (worldIn.getBlockState(pos.north()).func_185915_l() ? true : worldIn.getBlockState(pos.south()).func_185915_l())); -+ return worldIn.getBlockState(pos.west()).isSideSolid(worldIn, pos.west(), EnumFacing.EAST) || -+ worldIn.getBlockState(pos.east()).isSideSolid(worldIn, pos.east(), EnumFacing.WEST) || -+ worldIn.getBlockState(pos.north()).isSideSolid(worldIn, pos.north(), EnumFacing.SOUTH) || -+ worldIn.getBlockState(pos.south()).isSideSolid(worldIn, pos.south(), EnumFacing.NORTH); - } - - public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) -@@ -99,7 +102,7 @@ - - protected boolean canBlockStay(World worldIn, BlockPos pos, EnumFacing facing) - { -- return worldIn.getBlockState(pos.offset(facing.getOpposite())).func_185915_l(); -+ return worldIn.getBlockState(pos.offset(facing.getOpposite())).isSideSolid(worldIn, pos.offset(facing.getOpposite()), facing); - } - - public IBlockState getStateFromMeta(int meta) -@@ -139,4 +142,6 @@ - { - return new BlockStateContainer(this, new IProperty[] {FACING}); - } -+ -+ @Override public boolean isLadder(IBlockState state, IBlockAccess world, BlockPos pos, EntityLivingBase entity) { return true; } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockLeaves.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockLeaves.java.patch deleted file mode 100644 index 41697f0af..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockLeaves.java.patch +++ /dev/null @@ -1,127 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockLeaves.java -+++ ../src-work/minecraft/net/minecraft/block/BlockLeaves.java -@@ -17,7 +17,7 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --public abstract class BlockLeaves extends Block -+public abstract class BlockLeaves extends Block implements net.minecraftforge.common.IShearable - { - public static final PropertyBool DECAYABLE = PropertyBool.create("decayable"); - public static final PropertyBool CHECK_DECAY = PropertyBool.create("check_decay"); -@@ -53,9 +53,9 @@ - BlockPos blockpos = pos.add(j1, k1, l1); - IBlockState iblockstate = worldIn.getBlockState(blockpos); - -- if (iblockstate.func_185904_a() == Material.leaves && !((Boolean)iblockstate.getValue(CHECK_DECAY)).booleanValue()) -+ if (iblockstate.getBlock().isLeaves(iblockstate, worldIn, blockpos)) - { -- worldIn.setBlockState(blockpos, iblockstate.withProperty(CHECK_DECAY, Boolean.valueOf(true)), 4); -+ iblockstate.getBlock().beginLeavesDecay(iblockstate, worldIn, blockpos); - } - } - } -@@ -96,9 +96,9 @@ - IBlockState iblockstate = worldIn.getBlockState(blockpos$mutableblockpos.set(k + i2, l + j2, i1 + k2)); - Block block = iblockstate.getBlock(); - -- if (block != Blocks.log && block != Blocks.log2) -+ if (!block.canSustainLeaves(iblockstate, worldIn, blockpos$mutableblockpos.set(k + i2, l + j2, i1 + k2))) - { -- if (iblockstate.func_185904_a() == Material.leaves) -+ if (block.isLeaves(iblockstate, worldIn, blockpos$mutableblockpos.set(k + i2, l + j2, i1 + k2))) - { - this.surroundings[(i2 + l1) * k1 + (j2 + l1) * j1 + k2 + l1] = -2; - } -@@ -205,40 +205,7 @@ - - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { -- if (!worldIn.isRemote) -- { -- int i = this.getSaplingDropChance(state); -- -- if (fortune > 0) -- { -- i -= 2 << fortune; -- -- if (i < 10) -- { -- i = 10; -- } -- } -- -- if (worldIn.rand.nextInt(i) == 0) -- { -- Item item = this.getItemDropped(state, worldIn.rand, fortune); -- spawnAsEntity(worldIn, pos, new ItemStack(item, 1, this.damageDropped(state))); -- } -- -- i = 200; -- -- if (fortune > 0) -- { -- i -= 10 << fortune; -- -- if (i < 40) -- { -- i = 40; -- } -- } -- -- this.dropApple(worldIn, pos, state, i); -- } -+ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); - } - - protected void dropApple(World worldIn, BlockPos pos, IBlockState state, int chance) -@@ -274,6 +241,49 @@ - - public abstract BlockPlanks.EnumType getWoodType(int meta); - -+ @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; } -+ @Override public boolean isLeaves(IBlockState state, IBlockAccess world, BlockPos pos){ return true; } -+ -+ @Override -+ public void beginLeavesDecay(IBlockState state, World world, BlockPos pos) -+ { -+ if (!(Boolean)state.getValue(CHECK_DECAY)) -+ { -+ world.setBlockState(pos, state.withProperty(CHECK_DECAY, true), 4); -+ } -+ } -+ -+ @Override -+ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ java.util.List ret = new java.util.ArrayList(); -+ Random rand = world instanceof World ? ((World)world).rand : new Random(); -+ int chance = this.getSaplingDropChance(state); -+ -+ if (fortune > 0) -+ { -+ chance -= 2 << fortune; -+ if (chance < 10) chance = 10; -+ } -+ -+ if (rand.nextInt(chance) == 0) -+ ret.add(new ItemStack(getItemDropped(state, rand, fortune), 1, damageDropped(state))); -+ -+ chance = 200; -+ if (fortune > 0) -+ { -+ chance -= 10 << fortune; -+ if (chance < 40) chance = 40; -+ } -+ -+ this.captureDrops(true); -+ if (world instanceof World) -+ this.dropApple((World)world, pos, state, chance); // Dammet mojang -+ ret.addAll(this.captureDrops(false)); -+ return ret; -+ } -+ -+ - @SideOnly(Side.CLIENT) - public boolean shouldSideBeRendered(IBlockState worldIn, IBlockAccess pos, BlockPos side, EnumFacing p_176225_4_) - { diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockLever.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockLever.java.patch deleted file mode 100644 index 66b146bb0..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockLever.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockLever.java -+++ ../src-work/minecraft/net/minecraft/block/BlockLever.java -@@ -295,6 +295,12 @@ - return new BlockStateContainer(this, new IProperty[] {FACING, POWERED}); - } - -+ -+ private boolean canAttach(World world, BlockPos pos, EnumFacing side) -+ { -+ return world.isSideSolid(pos, side); -+ } -+ - public static enum EnumOrientation implements IStringSerializable - { - DOWN_X(0, "down_x", EnumFacing.DOWN), diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockLog.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockLog.java.patch deleted file mode 100644 index 1476f2050..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockLog.java.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockLog.java -+++ ../src-work/minecraft/net/minecraft/block/BlockLog.java -@@ -34,9 +34,9 @@ - { - IBlockState iblockstate = worldIn.getBlockState(blockpos); - -- if (iblockstate.func_185904_a() == Material.leaves && !((Boolean)iblockstate.getValue(BlockLeaves.CHECK_DECAY)).booleanValue()) -+ if (iblockstate.getBlock().isLeaves(iblockstate, worldIn, blockpos)) - { -- worldIn.setBlockState(blockpos, iblockstate.withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(true)), 4); -+ iblockstate.getBlock().beginLeavesDecay(iblockstate, worldIn, blockpos); - } - } - } -@@ -69,6 +69,9 @@ - } - } - -+ @Override public boolean canSustainLeaves(IBlockState state, net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; } -+ @Override public boolean isWood(net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; } -+ - public static enum EnumAxis implements IStringSerializable - { - X("x"), diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockMobSpawner.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockMobSpawner.java.patch deleted file mode 100644 index ecb65c7e0..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockMobSpawner.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockMobSpawner.java -+++ ../src-work/minecraft/net/minecraft/block/BlockMobSpawner.java -@@ -39,10 +39,14 @@ - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); -- int i = 15 + worldIn.rand.nextInt(15) + worldIn.rand.nextInt(15); -- this.dropXpOnBlockBreak(worldIn, pos, i); - } - -+ @Override -+ public int getExpDrop(IBlockState state, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) -+ { -+ return 15 + RANDOM.nextInt(15) + RANDOM.nextInt(15); -+ } -+ - public boolean isOpaqueCube(IBlockState p_149662_1_) - { - return false; diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockMushroom.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockMushroom.java.patch deleted file mode 100644 index ce3f419f5..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockMushroom.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockMushroom.java -+++ ../src-work/minecraft/net/minecraft/block/BlockMushroom.java -@@ -78,7 +78,7 @@ - if (pos.getY() >= 0 && pos.getY() < 256) - { - IBlockState iblockstate = worldIn.getBlockState(pos.down()); -- return iblockstate.getBlock() == Blocks.mycelium ? true : (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && this.func_185514_i(iblockstate)); -+ return iblockstate.getBlock() == Blocks.mycelium ? true : (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && iblockstate.getBlock().canSustainPlant(iblockstate, worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this)); - } - else - { diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockMycelium.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockMycelium.java.patch deleted file mode 100644 index 985648601..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockMycelium.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockMycelium.java -+++ ../src-work/minecraft/net/minecraft/block/BlockMycelium.java -@@ -39,7 +39,7 @@ - { - if (!worldIn.isRemote) - { -- if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).func_185891_c() > 2) -+ if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getLightOpacity(worldIn, pos.up()) > 2) - { - worldIn.setBlockState(pos, Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT)); - } -@@ -53,7 +53,7 @@ - IBlockState iblockstate = worldIn.getBlockState(blockpos); - IBlockState iblockstate1 = worldIn.getBlockState(blockpos.up()); - -- if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && iblockstate1.func_185891_c() <= 2) -+ if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && iblockstate1.getLightOpacity(worldIn, blockpos.up()) <= 2) - { - worldIn.setBlockState(blockpos, this.getDefaultState()); - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockNetherWart.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockNetherWart.java.patch deleted file mode 100644 index b266cf7bd..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockNetherWart.java.patch +++ /dev/null @@ -1,51 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockNetherWart.java -+++ ../src-work/minecraft/net/minecraft/block/BlockNetherWart.java -@@ -42,7 +42,7 @@ - - public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) - { -- return this.func_185514_i(worldIn.getBlockState(pos.down())); -+ return super.canBlockStay(worldIn, pos, state); - } - - public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) -@@ -58,9 +58,11 @@ - super.updateTick(worldIn, pos, state, rand); - } - -+ @SuppressWarnings("unused") - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { -- if (!worldIn.isRemote) -+ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); -+ if (false && !worldIn.isRemote) - { - int i = 1; - -@@ -106,6 +108,26 @@ - return ((Integer)state.getValue(AGE)).intValue(); - } - -+ @Override -+ public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ java.util.List ret = new java.util.ArrayList(); -+ Random rand = world instanceof World ? ((World)world).rand : new Random(); -+ int count = 1; -+ -+ if (((Integer)state.getValue(AGE)) >= 3) -+ { -+ count = 2 + rand.nextInt(3) + (fortune > 0 ? rand.nextInt(fortune + 1) : 0); -+ } -+ -+ for (int i = 0; i < count; i++) -+ { -+ ret.add(new ItemStack(Items.nether_wart)); -+ } -+ -+ return ret; -+ } -+ - protected BlockStateContainer createBlockState() - { - return new BlockStateContainer(this, new IProperty[] {AGE}); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockNewLeaf.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockNewLeaf.java.patch deleted file mode 100644 index d40cba379..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockNewLeaf.java.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockNewLeaf.java -+++ ../src-work/minecraft/net/minecraft/block/BlockNewLeaf.java -@@ -98,7 +98,7 @@ - - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack p_180657_6_) - { -- if (!worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears) -+ if (false && !worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears) //Forge: Noop this - { - player.triggerAchievement(StatList.func_188055_a(this)); - spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata() - 4)); -@@ -108,4 +108,10 @@ - super.harvestBlock(worldIn, player, pos, state, te, p_180657_6_); - } - } -+ -+ @Override -+ public List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) -+ { -+ return java.util.Arrays.asList(new ItemStack(this, 1, world.getBlockState(pos).getValue(VARIANT).getMetadata() - 4)); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockNote.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockNote.java.patch deleted file mode 100644 index ac733338c..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockNote.java.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockNote.java -+++ ../src-work/minecraft/net/minecraft/block/BlockNote.java -@@ -64,7 +64,9 @@ - if (tileentity instanceof TileEntityNote) - { - TileEntityNote tileentitynote = (TileEntityNote)tileentity; -+ int old = tileentitynote.note; - tileentitynote.changePitch(); -+ if (old == tileentitynote.note) return false; - tileentitynote.triggerNote(worldIn, pos); - playerIn.triggerAchievement(StatList.field_188087_U); - } -@@ -104,6 +106,10 @@ - - public boolean onBlockEventReceived(World worldIn, BlockPos pos, IBlockState state, int eventID, int eventParam) - { -+ net.minecraftforge.event.world.NoteBlockEvent.Play e = new net.minecraftforge.event.world.NoteBlockEvent.Play(worldIn, pos, state, eventParam, eventID); -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(e)) return false; -+ eventID = e.instrument.ordinal(); -+ eventParam = e.getVanillaNoteId(); - float f = (float)Math.pow(2.0D, (double)(eventParam - 12) / 12.0D); - worldIn.func_184133_a((EntityPlayer)null, pos, this.func_185576_e(eventID), SoundCategory.BLOCKS, 3.0F, f); - worldIn.spawnParticle(EnumParticleTypes.NOTE, (double)pos.getX() + 0.5D, (double)pos.getY() + 1.2D, (double)pos.getZ() + 0.5D, (double)eventParam / 24.0D, 0.0D, 0.0D, new int[0]); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockOldLeaf.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockOldLeaf.java.patch deleted file mode 100644 index 8cbcaa92a..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockOldLeaf.java.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockOldLeaf.java -+++ ../src-work/minecraft/net/minecraft/block/BlockOldLeaf.java -@@ -14,6 +14,7 @@ - import net.minecraft.stats.StatList; - import net.minecraft.tileentity.TileEntity; - import net.minecraft.util.math.BlockPos; -+import net.minecraft.world.IBlockAccess; - import net.minecraft.world.World; - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; -@@ -103,11 +104,16 @@ - if (!worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears) - { - player.triggerAchievement(StatList.func_188055_a(this)); -- spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata())); - } - else - { - super.harvestBlock(worldIn, player, pos, state, te, p_180657_6_); - } - } -+ -+ @Override -+ public List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) -+ { -+ return java.util.Arrays.asList(new ItemStack(this, 1, world.getBlockState(pos).getValue(VARIANT).getMetadata())); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockOre.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockOre.java.patch deleted file mode 100644 index 7e269a4d5..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockOre.java.patch +++ /dev/null @@ -1,50 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockOre.java -+++ ../src-work/minecraft/net/minecraft/block/BlockOre.java -@@ -59,34 +59,39 @@ - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); -- -- if (this.getItemDropped(state, worldIn.rand, fortune) != Item.getItemFromBlock(this)) -+ } -+ @Override -+ public int getExpDrop(IBlockState state, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) -+ { -+ Random rand = world instanceof World ? ((World)world).rand : new Random(); -+ if (this.getItemDropped(state, rand, fortune) != Item.getItemFromBlock(this)) - { - int i = 0; - - if (this == Blocks.coal_ore) - { -- i = MathHelper.getRandomIntegerInRange(worldIn.rand, 0, 2); -+ i = MathHelper.getRandomIntegerInRange(rand, 0, 2); - } - else if (this == Blocks.diamond_ore) - { -- i = MathHelper.getRandomIntegerInRange(worldIn.rand, 3, 7); -+ i = MathHelper.getRandomIntegerInRange(rand, 3, 7); - } - else if (this == Blocks.emerald_ore) - { -- i = MathHelper.getRandomIntegerInRange(worldIn.rand, 3, 7); -+ i = MathHelper.getRandomIntegerInRange(rand, 3, 7); - } - else if (this == Blocks.lapis_ore) - { -- i = MathHelper.getRandomIntegerInRange(worldIn.rand, 2, 5); -+ i = MathHelper.getRandomIntegerInRange(rand, 2, 5); - } - else if (this == Blocks.quartz_ore) - { -- i = MathHelper.getRandomIntegerInRange(worldIn.rand, 2, 5); -+ i = MathHelper.getRandomIntegerInRange(rand, 2, 5); - } - -- this.dropXpOnBlockBreak(worldIn, pos, i); -+ return i; - } -+ return 0; - } - - public ItemStack func_185473_a(World p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockPane.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockPane.java.patch deleted file mode 100644 index aed4a64de..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockPane.java.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockPane.java -+++ ../src-work/minecraft/net/minecraft/block/BlockPane.java -@@ -105,7 +105,10 @@ - - public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) - { -- return state.withProperty(NORTH, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.north()).getBlock()))).withProperty(SOUTH, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.south()).getBlock()))).withProperty(WEST, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.west()).getBlock()))).withProperty(EAST, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.east()).getBlock()))); -+ return state.withProperty(NORTH, canPaneConnectTo(worldIn, pos, EnumFacing.NORTH)) -+ .withProperty(SOUTH, canPaneConnectTo(worldIn, pos, EnumFacing.SOUTH)) -+ .withProperty(WEST, canPaneConnectTo(worldIn, pos, EnumFacing.WEST)) -+ .withProperty(EAST, canPaneConnectTo(worldIn, pos, EnumFacing.EAST)); - } - - public Item getItemDropped(IBlockState state, Random rand, int fortune) -@@ -182,4 +185,11 @@ - { - return new BlockStateContainer(this, new IProperty[] {NORTH, EAST, WEST, SOUTH}); - } -+ -+ public boolean canPaneConnectTo(IBlockAccess world, BlockPos pos, EnumFacing dir) -+ { -+ BlockPos off = pos.offset(dir); -+ IBlockState state = world.getBlockState(off); -+ return canPaneConnectToBlock(state.getBlock()) || state.isSideSolid(world, off, dir.getOpposite()); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockPistonBase.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockPistonBase.java.patch deleted file mode 100644 index 450fc6460..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockPistonBase.java.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockPistonBase.java -+++ ../src-work/minecraft/net/minecraft/block/BlockPistonBase.java -@@ -235,7 +235,7 @@ - } - } - -- if (!flag1 && iblockstate.func_185904_a() != Material.air && func_185646_a(iblockstate, worldIn, blockpos, enumfacing.getOpposite(), false) && (iblockstate.func_185905_o() == EnumPushReaction.NORMAL || block == Blocks.piston || block == Blocks.sticky_piston)) -+ if (!flag1 && !iblockstate.getBlock().isAir(iblockstate, worldIn, blockpos) && func_185646_a(iblockstate, worldIn, blockpos, enumfacing.getOpposite(), false) && (iblockstate.func_185905_o() == EnumPushReaction.NORMAL || block == Blocks.piston || block == Blocks.sticky_piston)) - { - this.doMove(worldIn, pos, enumfacing, false); - } -@@ -320,7 +320,7 @@ - return false; - } - -- return !block.hasTileEntity(); -+ return !block.hasTileEntity(p_185646_0_); - } - else - { -@@ -366,7 +366,9 @@ - { - BlockPos blockpos1 = (BlockPos)list2.get(j); - IBlockState iblockstate = worldIn.getBlockState(blockpos1); -- iblockstate.getBlock().dropBlockAsItem(worldIn, blockpos1, iblockstate, 0); -+ // Forge: With our change to how snowballs are dropped this needs to disallow to mimic vanilla behavior. -+ float chance = iblockstate.getBlock() instanceof BlockSnow ? -1.0f : 1.0f; -+ iblockstate.getBlock().dropBlockAsItemWithChance(worldIn, blockpos1, iblockstate, chance, 0); - worldIn.setBlockToAir(blockpos1); - --k; - aiblockstate[k] = iblockstate; diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockPistonMoving.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockPistonMoving.java.patch deleted file mode 100644 index 38167e9bf..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockPistonMoving.java.patch +++ /dev/null @@ -1,36 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockPistonMoving.java -+++ ../src-work/minecraft/net/minecraft/block/BlockPistonMoving.java -@@ -110,7 +110,7 @@ - - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { -- if (!worldIn.isRemote) -+ if (false && !worldIn.isRemote) // Forge: Noop this out - { - TileEntityPiston tileentitypiston = this.func_185589_c(worldIn, pos); - -@@ -120,6 +120,7 @@ - iblockstate.getBlock().dropBlockAsItem(worldIn, pos, iblockstate, 0); - } - } -+ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); - } - - public RayTraceResult collisionRayTrace(IBlockState worldIn, World pos, BlockPos start, Vec3d end, Vec3d p_180636_5_) -@@ -190,4 +191,16 @@ - { - return new BlockStateContainer(this, new IProperty[] {FACING, TYPE}); - } -+ -+ @Override -+ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ TileEntityPiston tileentitypiston = this.func_185589_c(world, pos); -+ if (tileentitypiston != null) -+ { -+ IBlockState pushed = tileentitypiston.getPistonState(); -+ return pushed.getBlock().getDrops(world, pos, pushed, fortune); -+ } -+ return new java.util.ArrayList(); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockPotato.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockPotato.java.patch deleted file mode 100644 index adc939eba..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockPotato.java.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockPotato.java -+++ ../src-work/minecraft/net/minecraft/block/BlockPotato.java -@@ -27,7 +27,7 @@ - { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); - -- if (!worldIn.isRemote) -+ if (false && !worldIn.isRemote) //Forge: Moved to getDrops - { - if (this.func_185525_y(state) && worldIn.rand.nextInt(50) == 0) - { -@@ -40,4 +40,13 @@ - { - return field_185534_a[((Integer)p_185496_1_.getValue(this.func_185524_e())).intValue()]; - } -+ -+ @Override -+ public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ java.util.List ret = super.getDrops(world, pos, state, fortune); -+ if (this.func_185525_y(state) && RANDOM.nextInt(50) == 0) -+ ret.add(new ItemStack(Items.poisonous_potato)); -+ return ret; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockPumpkin.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockPumpkin.java.patch deleted file mode 100644 index 06903e2d8..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockPumpkin.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockPumpkin.java -+++ ../src-work/minecraft/net/minecraft/block/BlockPumpkin.java -@@ -117,7 +117,7 @@ - - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) - { -- return worldIn.getBlockState(pos).getBlock().blockMaterial.isReplaceable() && worldIn.getBlockState(pos.down()).func_185896_q(); -+ return worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos) && worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos, EnumFacing.UP); - } - - public IBlockState func_185499_a(IBlockState p_185499_1_, Rotation p_185499_2_) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockQuartz.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockQuartz.java.patch deleted file mode 100644 index ba67d27d5..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockQuartz.java.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockQuartz.java -+++ ../src-work/minecraft/net/minecraft/block/BlockQuartz.java -@@ -113,6 +113,26 @@ - return new BlockStateContainer(this, new IProperty[] {VARIANT}); - } - -+ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) -+ { -+ IBlockState state = world.getBlockState(pos); -+ for (IProperty prop : state.getProperties().keySet()) -+ { -+ if (prop.getName().equals("variant") && prop.getValueClass() == EnumType.class) -+ { -+ EnumType current = (EnumType)state.getValue(prop); -+ EnumType next = current == EnumType.LINES_X ? EnumType.LINES_Y : -+ current == EnumType.LINES_Y ? EnumType.LINES_Z : -+ current == EnumType.LINES_Z ? EnumType.LINES_X : current; -+ if (next == current) -+ return false; -+ world.setBlockState(pos, state.withProperty(prop, next)); -+ return true; -+ } -+ } -+ return false; -+ } -+ - public static enum EnumType implements IStringSerializable - { - DEFAULT(0, "default", "default"), diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockRailBase.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRailBase.java.patch deleted file mode 100644 index bc05960c5..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockRailBase.java.patch +++ /dev/null @@ -1,186 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockRailBase.java -+++ ../src-work/minecraft/net/minecraft/block/BlockRailBase.java -@@ -32,7 +32,7 @@ - public static boolean isRailBlock(IBlockState state) - { - Block block = state.getBlock(); -- return block == Blocks.rail || block == Blocks.golden_rail || block == Blocks.detector_rail || block == Blocks.activator_rail; -+ return block instanceof BlockRailBase; - } - - protected BlockRailBase(boolean isPowered) -@@ -65,7 +65,7 @@ - - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) - { -- return worldIn.getBlockState(pos.down()).func_185896_q(); -+ return worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos, EnumFacing.UP); - } - - public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) -@@ -88,24 +88,24 @@ - BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)state.getValue(this.getShapeProperty()); - boolean flag = false; - -- if (!worldIn.getBlockState(pos.down()).func_185896_q()) -+ if (!worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos.down(), EnumFacing.UP)) - { - flag = true; - } - -- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_EAST && !worldIn.getBlockState(pos.east()).func_185896_q()) -+ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_EAST && !worldIn.getBlockState(pos.east()).isSideSolid(worldIn, pos.east(), EnumFacing.UP)) - { - flag = true; - } -- else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_WEST && !worldIn.getBlockState(pos.west()).func_185896_q()) -+ else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_WEST && !worldIn.getBlockState(pos.west()).isSideSolid(worldIn, pos.west(), EnumFacing.UP)) - { - flag = true; - } -- else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_NORTH && !worldIn.getBlockState(pos.north()).func_185896_q()) -+ else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_NORTH && !worldIn.getBlockState(pos.north()).isSideSolid(worldIn, pos.north(), EnumFacing.UP)) - { - flag = true; - } -- else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_SOUTH && !worldIn.getBlockState(pos.south()).func_185896_q()) -+ else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_SOUTH && !worldIn.getBlockState(pos.south()).isSideSolid(worldIn, pos.south(), EnumFacing.UP)) - { - flag = true; - } -@@ -160,6 +160,81 @@ - - public abstract IProperty getShapeProperty(); - -+ /* ======================================== FORGE START =====================================*/ -+ /** -+ * Return true if the rail can make corners. -+ * Used by placement logic. -+ * @param world The world. -+ * @param pod Block's position in world -+ * @return True if the rail can make corners. -+ */ -+ public boolean isFlexibleRail(IBlockAccess world, BlockPos pos) -+ { -+ return !this.isPowered; -+ } -+ -+ /** -+ * Returns true if the rail can make up and down slopes. -+ * Used by placement logic. -+ * @param world The world. -+ * @param pod Block's position in world -+ * @return True if the rail can make slopes. -+ */ -+ public boolean canMakeSlopes(IBlockAccess world, BlockPos pos) -+ { -+ return true; -+ } -+ -+ /** -+ * Returns the max speed of the rail at the specified position. -+ * @param world The world. -+ * @param cart The cart on the rail, may be null. -+ * @param pod Block's position in world -+ * @return The max speed of the current rail. -+ */ -+ public float getRailMaxSpeed(World world, net.minecraft.entity.item.EntityMinecart cart, BlockPos pos) -+ { -+ return 0.4f; -+ } -+ -+ /** -+ * This function is called by any minecart that passes over this rail. -+ * It is called once per update tick that the minecart is on the rail. -+ * @param world The world. -+ * @param cart The cart on the rail. -+ * @param pod Block's position in world -+ */ -+ public void onMinecartPass(World world, net.minecraft.entity.item.EntityMinecart cart, BlockPos pos) -+ { -+ } -+ -+ /** -+ * Rotate the block. For vanilla blocks this rotates around the axis passed in (generally, it should be the "face" that was hit). -+ * Note: for mod blocks, this is up to the block and modder to decide. It is not mandated that it be a rotation around the -+ * face, but could be a rotation to orient *to* that face, or a visiting of possible rotations. -+ * The method should return true if the rotation was successful though. -+ * -+ * @param world The world -+ * @param pos Block position in world -+ * @param axis The axis to rotate around -+ * @return True if the rotation was successful, False if the rotation failed, or is not possible -+ */ -+ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) -+ { -+ IBlockState state = world.getBlockState(pos); -+ for (IProperty prop : state.getProperties().keySet()) -+ { -+ if (prop.getName().equals("shape")) -+ { -+ world.setBlockState(pos, state.cycleProperty(prop)); -+ return true; -+ } -+ } -+ return false; -+ } -+ -+ /* ======================================== FORGE END =====================================*/ -+ - public static enum EnumRailDirection implements IStringSerializable - { - NORTH_SOUTH(0, "north_south"), -@@ -230,6 +305,7 @@ - private IBlockState state; - private final boolean isPowered; - private final List field_150657_g = Lists.newArrayList(); -+ private final boolean canMakeSlopes; - - public Rail(World worldIn, BlockPos pos, IBlockState state) - { -@@ -238,7 +314,8 @@ - this.state = state; - this.block = (BlockRailBase)state.getBlock(); - BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)state.getValue(this.block.getShapeProperty()); -- this.isPowered = this.block.isPowered; -+ this.isPowered = !this.block.isFlexibleRail(worldIn, pos); -+ this.canMakeSlopes = this.block.canMakeSlopes(worldIn, pos); - this.func_180360_a(blockrailbase$enumraildirection); - } - -@@ -429,7 +506,7 @@ - } - } - -- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH) -+ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes) - { - if (BlockRailBase.isRailBlock(this.world, blockpos.up())) - { -@@ -442,7 +519,7 @@ - } - } - -- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST) -+ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST && canMakeSlopes) - { - if (BlockRailBase.isRailBlock(this.world, blockpos3.up())) - { -@@ -585,7 +662,7 @@ - } - } - -- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH) -+ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes) - { - if (BlockRailBase.isRailBlock(this.world, blockpos.up())) - { -@@ -598,7 +675,7 @@ - } - } - -- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST) -+ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST && canMakeSlopes) - { - if (BlockRailBase.isRailBlock(this.world, blockpos3.up())) - { diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch deleted file mode 100644 index 68cb20384..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockRedstoneComparator.java -+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneComparator.java -@@ -310,6 +310,21 @@ - return this.getDefaultState().withProperty(field_185512_D, placer.getHorizontalFacing().getOpposite()).withProperty(POWERED, Boolean.valueOf(false)).withProperty(MODE, BlockRedstoneComparator.Mode.COMPARE); - } - -+ @Override -+ public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor) -+ { -+ if (pos.getY() == neighbor.getY() && world instanceof World) -+ { -+ onNeighborBlockChange((World)world, pos, world.getBlockState(pos), world.getBlockState(neighbor).getBlock()); -+ } -+ } -+ -+ @Override -+ public boolean getWeakChanges(IBlockAccess world, BlockPos pos) -+ { -+ return true; -+ } -+ - public static enum Mode implements IStringSerializable - { - COMPARE("compare"), diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch deleted file mode 100644 index 0b5a25490..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockRedstoneDiode.java -+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneDiode.java -@@ -204,6 +204,8 @@ - { - EnumFacing enumfacing = (EnumFacing)state.getValue(field_185512_D); - BlockPos blockpos = pos.offset(enumfacing.getOpposite()); -+ if(net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(worldIn, pos, worldIn.getBlockState(pos), java.util.EnumSet.of(enumfacing.getOpposite())).isCanceled()) -+ return; - worldIn.notifyBlockOfStateChange(blockpos, this); - worldIn.notifyNeighborsOfStateExcept(blockpos, this, enumfacing); - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch deleted file mode 100644 index 7ef87d176..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockRedstoneOre.java -+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneOre.java -@@ -92,12 +92,16 @@ - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); -+ } - -- if (this.getItemDropped(state, worldIn.rand, fortune) != Item.getItemFromBlock(this)) -+ @Override -+ public int getExpDrop(IBlockState state, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) -+ { -+ if (this.getItemDropped(state, RANDOM, fortune) != Item.getItemFromBlock(this)) - { -- int i = 1 + worldIn.rand.nextInt(5); -- this.dropXpOnBlockBreak(worldIn, pos, i); -+ return 1 + RANDOM.nextInt(5); - } -+ return 0; - } - - @SideOnly(Side.CLIENT) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch deleted file mode 100644 index 0862f370a..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch +++ /dev/null @@ -1,55 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockRedstoneWire.java -+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneWire.java -@@ -97,15 +97,15 @@ - BlockPos blockpos = pos.offset(direction); - IBlockState iblockstate = worldIn.getBlockState(pos.offset(direction)); - -- if (!canConnectTo(worldIn.getBlockState(blockpos), direction) && (iblockstate.func_185915_l() || !canConnectUpwardsTo(worldIn.getBlockState(blockpos.down())))) -+ if (!canConnectTo(worldIn.getBlockState(blockpos), direction, worldIn, blockpos) && (iblockstate.func_185915_l() || !canConnectUpwardsTo(worldIn, blockpos.down()))) - { - IBlockState iblockstate1 = worldIn.getBlockState(pos.up()); - - if (!iblockstate1.func_185915_l()) - { -- boolean flag = worldIn.getBlockState(blockpos).func_185896_q() || worldIn.getBlockState(blockpos).getBlock() == Blocks.glowstone; -+ boolean flag = worldIn.getBlockState(blockpos).isSideSolid(worldIn, blockpos, EnumFacing.UP) || worldIn.getBlockState(blockpos).getBlock() == Blocks.glowstone; - -- if (flag && canConnectUpwardsTo(worldIn.getBlockState(blockpos.up()))) -+ if (flag && canConnectUpwardsTo(worldIn, blockpos.up())) - { - if (iblockstate.func_185898_k()) - { -@@ -406,21 +406,16 @@ - IBlockState iblockstate = worldIn.getBlockState(blockpos); - boolean flag = iblockstate.func_185915_l(); - boolean flag1 = worldIn.getBlockState(pos.up()).func_185915_l(); -- return !flag1 && flag && canConnectUpwardsTo(worldIn, blockpos.up()) ? true : (canConnectTo(iblockstate, side) ? true : (iblockstate.getBlock() == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.field_185512_D) == side ? true : !flag && canConnectUpwardsTo(worldIn, blockpos.down()))); -+ return !flag1 && flag && canConnectUpwardsTo(worldIn, blockpos.up()) ? true : (canConnectTo(iblockstate, side, worldIn, pos) ? true : (iblockstate.getBlock() == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.field_185512_D) == side ? true : !flag && canConnectUpwardsTo(worldIn, blockpos.down()))); - } - - protected static boolean canConnectUpwardsTo(IBlockAccess worldIn, BlockPos pos) - { -- return canConnectUpwardsTo(worldIn.getBlockState(pos)); -+ return canConnectTo(worldIn.getBlockState(pos), null, worldIn, pos); - } - -- protected static boolean canConnectUpwardsTo(IBlockState state) -+ protected static boolean canConnectTo(IBlockState blockState, EnumFacing side, IBlockAccess world, BlockPos pos) - { -- return canConnectTo(state, (EnumFacing)null); -- } -- -- protected static boolean canConnectTo(IBlockState blockState, EnumFacing side) -- { - Block block = blockState.getBlock(); - - if (block == Blocks.redstone_wire) -@@ -434,7 +429,7 @@ - } - else - { -- return blockState.func_185897_m() && side != null; -+ return blockState.getBlock().canConnectRedstone(blockState, world, pos, side); - } - } - diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockReed.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockReed.java.patch deleted file mode 100644 index 904112b90..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockReed.java.patch +++ /dev/null @@ -1,40 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockReed.java -+++ ../src-work/minecraft/net/minecraft/block/BlockReed.java -@@ -19,7 +19,7 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --public class BlockReed extends Block -+public class BlockReed extends Block implements net.minecraftforge.common.IPlantable - { - public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 15); - protected static final AxisAlignedBB field_185701_b = new AxisAlignedBB(0.125D, 0.0D, 0.125D, 0.875D, 1.0D, 0.875D); -@@ -69,7 +69,9 @@ - - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) - { -- Block block = worldIn.getBlockState(pos.down()).getBlock(); -+ IBlockState state = worldIn.getBlockState(pos.down()); -+ Block block = state.getBlock(); -+ if (block.canSustainPlant(state, worldIn, pos.down(), EnumFacing.UP, this)) return true; - - if (block == this) - { -@@ -162,6 +164,17 @@ - return ((Integer)state.getValue(AGE)).intValue(); - } - -+ @Override -+ public net.minecraftforge.common.EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) -+ { -+ return net.minecraftforge.common.EnumPlantType.Beach; -+ } -+ @Override -+ public IBlockState getPlant(IBlockAccess world, BlockPos pos) -+ { -+ return this.getDefaultState(); -+ } -+ - protected BlockStateContainer createBlockState() - { - return new BlockStateContainer(this, new IProperty[] {AGE}); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch deleted file mode 100644 index 75bcd35ce..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockRotatedPillar.java -+++ ../src-work/minecraft/net/minecraft/block/BlockRotatedPillar.java -@@ -28,6 +28,21 @@ - super(p_i46385_1_, p_i46385_2_); - } - -+ @Override -+ public boolean rotateBlock(net.minecraft.world.World world, BlockPos pos, EnumFacing axis) -+ { -+ net.minecraft.block.state.IBlockState state = world.getBlockState(pos); -+ for (net.minecraft.block.properties.IProperty prop : state.getProperties().keySet()) -+ { -+ if (prop.getName().equals("axis")) -+ { -+ world.setBlockState(pos, state.cycleProperty(prop)); -+ return true; -+ } -+ } -+ return false; -+ } -+ - public IBlockState func_185499_a(IBlockState p_185499_1_, Rotation p_185499_2_) - { - switch (p_185499_2_) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockSapling.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockSapling.java.patch deleted file mode 100644 index 559b05cb5..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockSapling.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockSapling.java -+++ ../src-work/minecraft/net/minecraft/block/BlockSapling.java -@@ -77,6 +77,7 @@ - - public void generateTree(World worldIn, BlockPos pos, IBlockState state, Random rand) - { -+ if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(worldIn, rand, pos)) return; - WorldGenerator worldgenerator = (WorldGenerator)(rand.nextInt(10) == 0 ? new WorldGenBigTree(true) : new WorldGenTrees(true)); - int i = 0; - int j = 0; diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockSkull.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockSkull.java.patch deleted file mode 100644 index 9aeff23d6..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockSkull.java.patch +++ /dev/null @@ -1,57 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockSkull.java -+++ ../src-work/minecraft/net/minecraft/block/BlockSkull.java -@@ -116,10 +116,6 @@ - return new ItemStack(Items.skull, 1, i); - } - -- public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) -- { -- } -- - public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) - { - if (player.capabilities.isCreativeMode) -@@ -127,13 +123,18 @@ - state = state.withProperty(NODROP, Boolean.valueOf(true)); - worldIn.setBlockState(pos, state, 4); - } -+ this.dropBlockAsItem(worldIn, pos, state, 0); - - super.onBlockHarvested(worldIn, pos, state, player); - } - - public void breakBlock(World worldIn, BlockPos pos, IBlockState state) - { -- if (!worldIn.isRemote) -+ super.breakBlock(worldIn, pos, state); -+ } -+ public java.util.List getDrops(IBlockAccess worldIn, BlockPos pos, IBlockState state, int fortune) -+ { -+ java.util.List ret = new java.util.ArrayList(); - { - if (!((Boolean)state.getValue(NODROP)).booleanValue()) - { -@@ -142,7 +143,7 @@ - if (tileentity instanceof TileEntitySkull) - { - TileEntitySkull tileentityskull = (TileEntitySkull)tileentity; -- ItemStack itemstack = this.func_185473_a(worldIn, pos, state); -+ ItemStack itemstack = new ItemStack(Items.skull, 1, tileentityskull.getSkullType()); - - if (tileentityskull.getSkullType() == 3 && tileentityskull.getPlayerProfile() != null) - { -@@ -152,12 +153,11 @@ - itemstack.getTagCompound().setTag("SkullOwner", nbttagcompound); - } - -- spawnAsEntity(worldIn, pos, itemstack); -+ ret.add(itemstack); - } - } -- -- super.breakBlock(worldIn, pos, state); - } -+ return ret; - } - - public Item getItemDropped(IBlockState state, Random rand, int fortune) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockSlab.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockSlab.java.patch deleted file mode 100644 index 3091b3bbe..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockSlab.java.patch +++ /dev/null @@ -1,36 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockSlab.java -+++ ../src-work/minecraft/net/minecraft/block/BlockSlab.java -@@ -50,6 +50,17 @@ - return this.isDouble(); - } - -+ @Override -+ public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face) -+ { -+ if ( state.func_185914_p() ) -+ return true; -+ -+ // face is on the block being rendered, not this block. -+ EnumBlockHalf side = world.getBlockState(pos).getValue(HALF); -+ return (side == EnumBlockHalf.TOP && face == EnumFacing.DOWN) || (side == EnumBlockHalf.BOTTOM && face == EnumFacing.UP); -+ } -+ - public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) - { - IBlockState iblockstate = super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM); -@@ -77,13 +88,14 @@ - { - return false; - } -- else -+ else if (false) // Forge: Additional logic breaks doesSideBlockRendering and is no longer useful. - { - IBlockState iblockstate = pos.getBlockState(side.offset(p_176225_4_)); - boolean flag = func_185675_i(iblockstate) && iblockstate.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP; - boolean flag1 = func_185675_i(worldIn) && worldIn.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP; - return flag1 ? (p_176225_4_ == EnumFacing.DOWN ? true : (p_176225_4_ == EnumFacing.UP && super.shouldSideBeRendered(worldIn, pos, side, p_176225_4_) ? true : !func_185675_i(iblockstate) || !flag)) : (p_176225_4_ == EnumFacing.UP ? true : (p_176225_4_ == EnumFacing.DOWN && super.shouldSideBeRendered(worldIn, pos, side, p_176225_4_) ? true : !func_185675_i(iblockstate) || flag)); - } -+ return super.shouldSideBeRendered(worldIn, pos, side, p_176225_4_); - } - - @SideOnly(Side.CLIENT) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockSnow.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockSnow.java.patch deleted file mode 100644 index c8f2925fe..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockSnow.java.patch +++ /dev/null @@ -1,55 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockSnow.java -+++ ../src-work/minecraft/net/minecraft/block/BlockSnow.java -@@ -73,7 +73,7 @@ - { - IBlockState iblockstate = worldIn.getBlockState(pos.down()); - Block block = iblockstate.getBlock(); -- return block != Blocks.ice && block != Blocks.packed_ice ? (iblockstate.func_185904_a() == Material.leaves ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() >= 7 ? true : iblockstate.func_185914_p() && iblockstate.func_185904_a().blocksMovement())) : false; -+ return block != Blocks.ice && block != Blocks.packed_ice ? (iblockstate.getBlock().isLeaves(iblockstate, worldIn, pos.down()) ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() >= 7 ? true : iblockstate.func_185914_p() && iblockstate.func_185904_a().blocksMovement())) : false; - } - - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) -@@ -85,7 +85,6 @@ - { - if (!this.canPlaceBlockAt(worldIn, pos)) - { -- this.dropBlockAsItem(worldIn, pos, state, 0); - worldIn.setBlockToAir(pos); - return false; - } -@@ -97,9 +96,8 @@ - - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack p_180657_6_) - { -- spawnAsEntity(worldIn, pos, new ItemStack(Items.snowball, ((Integer)state.getValue(LAYERS)).intValue() + 1, 0)); -+ super.harvestBlock(worldIn, player, pos, state, te, p_180657_6_); - worldIn.setBlockToAir(pos); -- player.triggerAchievement(StatList.func_188055_a(this)); - } - - public Item getItemDropped(IBlockState state, Random rand, int fortune) -@@ -109,14 +107,13 @@ - - public int quantityDropped(Random random) - { -- return 0; -+ return 1; - } - - public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) - { - if (worldIn.getLightFor(EnumSkyBlock.BLOCK, pos) > 11) - { -- this.dropBlockAsItem(worldIn, pos, worldIn.getBlockState(pos), 0); - worldIn.setBlockToAir(pos); - } - } -@@ -150,6 +147,8 @@ - return ((Integer)state.getValue(LAYERS)).intValue() - 1; - } - -+ @Override public int quantityDropped(IBlockState state, int fortune, Random random){ return ((Integer)state.getValue(LAYERS)) + 1; } -+ - protected BlockStateContainer createBlockState() - { - return new BlockStateContainer(this, new IProperty[] {LAYERS}); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockStairs.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockStairs.java.patch deleted file mode 100644 index be4923a13..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockStairs.java.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockStairs.java -+++ ../src-work/minecraft/net/minecraft/block/BlockStairs.java -@@ -443,6 +443,19 @@ - return new BlockStateContainer(this, new IProperty[] {FACING, HALF, SHAPE}); - } - -+ @Override -+ public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face) -+ { -+ if ( state.func_185914_p() ) -+ return true; -+ -+ // face is on the block being rendered, not this block. -+ IBlockState iblockstate = world.getBlockState(pos); -+ EnumHalf half = iblockstate.getValue(HALF); -+ EnumFacing side = iblockstate.getValue(FACING); -+ return side == face.getOpposite() || (half == EnumHalf.TOP && face == EnumFacing.DOWN) || (half == EnumHalf.BOTTOM && face == EnumFacing.UP); -+ } -+ - public static enum EnumHalf implements IStringSerializable - { - TOP("top"), diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockStaticLiquid.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockStaticLiquid.java.patch deleted file mode 100644 index bbc3288ce..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockStaticLiquid.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockStaticLiquid.java -+++ ../src-work/minecraft/net/minecraft/block/BlockStaticLiquid.java -@@ -52,7 +52,7 @@ - { - blockpos = blockpos.add(rand.nextInt(3) - 1, 1, rand.nextInt(3) - 1); - -- if (blockpos.getY() >= 0 && blockpos.getY() < 256 && !worldIn.isBlockLoaded(blockpos)) -+ if (blockpos.getY() >= 0 && blockpos.getY() < worldIn.getHeight() && !worldIn.isBlockLoaded(blockpos)) - { - return; - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockStem.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockStem.java.patch deleted file mode 100644 index 66121bb00..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockStem.java.patch +++ /dev/null @@ -1,46 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockStem.java -+++ ../src-work/minecraft/net/minecraft/block/BlockStem.java -@@ -89,9 +89,10 @@ - } - - pos = pos.offset(EnumFacing.Plane.HORIZONTAL.random(rand)); -- Block block = worldIn.getBlockState(pos.down()).getBlock(); -+ IBlockState soil = worldIn.getBlockState(pos.down()); -+ Block block = soil.getBlock(); - -- if (worldIn.getBlockState(pos).getBlock().blockMaterial == Material.air && (block == Blocks.farmland || block == Blocks.dirt || block == Blocks.grass)) -+ if (worldIn.isAirBlock(pos) && (block.canSustainPlant(soil, worldIn, pos.down(), EnumFacing.UP, this) || block == Blocks.dirt || block == Blocks.grass)) - { - worldIn.setBlockState(pos, this.crop.getDefaultState()); - } -@@ -109,8 +110,12 @@ - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); -+ } - -- if (!worldIn.isRemote) -+ @Override -+ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ java.util.List ret = new java.util.ArrayList(); - { - Item item = this.getSeedItem(); - -@@ -120,13 +125,14 @@ - - for (int j = 0; j < 3; ++j) - { -- if (worldIn.rand.nextInt(15) <= i) -+ if (RANDOM.nextInt(15) <= i) - { -- spawnAsEntity(worldIn, pos, new ItemStack(item)); -+ ret.add(new ItemStack(item)); - } - } - } - } -+ return ret; - } - - protected Item getSeedItem() diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockTallGrass.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockTallGrass.java.patch deleted file mode 100644 index 3698569fb..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockTallGrass.java.patch +++ /dev/null @@ -1,61 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockTallGrass.java -+++ ../src-work/minecraft/net/minecraft/block/BlockTallGrass.java -@@ -23,7 +23,7 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --public class BlockTallGrass extends BlockBush implements IGrowable -+public class BlockTallGrass extends BlockBush implements IGrowable, net.minecraftforge.common.IShearable - { - public static final PropertyEnum TYPE = PropertyEnum.create("type", BlockTallGrass.EnumType.class); - protected static final AxisAlignedBB field_185522_c = new AxisAlignedBB(0.09999999403953552D, 0.0D, 0.09999999403953552D, 0.8999999761581421D, 0.800000011920929D, 0.8999999761581421D); -@@ -41,7 +41,7 @@ - - public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) - { -- return this.func_185514_i(worldIn.getBlockState(pos.down())); -+ return super.canBlockStay(worldIn, pos, state); - } - - public boolean isReplaceable(IBlockAccess worldIn, BlockPos pos) -@@ -51,7 +51,7 @@ - - public Item getItemDropped(IBlockState state, Random rand, int fortune) - { -- return rand.nextInt(8) == 0 ? Items.wheat_seeds : null; -+ return null; - } - - public int quantityDroppedWithBonus(int fortune, Random random) -@@ -61,7 +61,7 @@ - - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack p_180657_6_) - { -- if (!worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears) -+ if (false && !worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears) // Forge: Noop Taken care of by IShearable - { - player.triggerAchievement(StatList.func_188055_a(this)); - spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 1, ((BlockTallGrass.EnumType)state.getValue(TYPE)).getMeta())); -@@ -181,4 +181,22 @@ - } - } - } -+ -+ @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; } -+ @Override -+ public List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) -+ { -+ List ret = new java.util.ArrayList(); -+ ret.add(new ItemStack(Blocks.tallgrass, 1, ((BlockTallGrass.EnumType)world.getBlockState(pos).getValue(TYPE)).getMeta())); -+ return ret; -+ } -+ @Override -+ public List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ List ret = new java.util.ArrayList(); -+ if (RANDOM.nextInt(8) != 0) return ret; -+ ItemStack seed = net.minecraftforge.common.ForgeHooks.getGrassSeed(RANDOM); -+ if (seed != null) ret.add(seed); -+ return ret; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockTorch.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockTorch.java.patch deleted file mode 100644 index 44dde7755..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockTorch.java.patch +++ /dev/null @@ -1,47 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockTorch.java -+++ ../src-work/minecraft/net/minecraft/block/BlockTorch.java -@@ -79,14 +79,14 @@ - - private boolean canPlaceOn(World worldIn, BlockPos pos) - { -- if (worldIn.getBlockState(pos).func_185896_q()) -+ IBlockState state = worldIn.getBlockState(pos); -+ if (state.isSideSolid(worldIn, pos, EnumFacing.UP)) - { - return true; - } - else - { -- Block block = worldIn.getBlockState(pos).getBlock(); -- return block instanceof BlockFence || block == Blocks.glass || block == Blocks.cobblestone_wall || block == Blocks.stained_glass; -+ return state.getBlock().canPlaceTorchOnTop(state, worldIn, pos); - } - } - -@@ -107,7 +107,7 @@ - { - BlockPos blockpos = pos.offset(facing.getOpposite()); - boolean flag = facing.getAxis().isHorizontal(); -- return flag && worldIn.isBlockNormalCube(blockpos, true) || facing.equals(EnumFacing.UP) && this.canPlaceOn(worldIn, blockpos); -+ return flag && worldIn.isSideSolid(blockpos, facing, true) || facing.equals(EnumFacing.UP) && this.canPlaceOn(worldIn, blockpos); - } - - public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) -@@ -120,7 +120,7 @@ - { - for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) - { -- if (worldIn.isBlockNormalCube(pos.offset(enumfacing.getOpposite()), true)) -+ if (worldIn.isSideSolid(pos.offset(enumfacing.getOpposite()), enumfacing, true)) - { - return this.getDefaultState().withProperty(FACING, enumfacing); - } -@@ -153,7 +153,7 @@ - EnumFacing enumfacing1 = enumfacing.getOpposite(); - boolean flag = false; - -- if (enumfacing$axis.isHorizontal() && !worldIn.isBlockNormalCube(pos.offset(enumfacing1), true)) -+ if (enumfacing$axis.isHorizontal() && !worldIn.isSideSolid(pos.offset(enumfacing1), enumfacing, true)) - { - flag = true; - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockTrapDoor.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockTrapDoor.java.patch deleted file mode 100644 index e2af917e9..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockTrapDoor.java.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockTrapDoor.java -+++ ../src-work/minecraft/net/minecraft/block/BlockTrapDoor.java -@@ -241,6 +241,18 @@ - return new BlockStateContainer(this, new IProperty[] {FACING, OPEN, HALF}); - } - -+ @Override -+ public boolean isLadder(IBlockState state, IBlockAccess world, BlockPos pos, EntityLivingBase entity) -+ { -+ if (state.getValue(OPEN)) -+ { -+ IBlockState down = world.getBlockState(pos.down()); -+ if (down.getBlock() == net.minecraft.init.Blocks.ladder) -+ return down.getValue(BlockLadder.FACING) == state.getValue(FACING); -+ } -+ return false; -+ } -+ - public static enum DoorHalf implements IStringSerializable - { - TOP("top"), diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockTripWireHook.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockTripWireHook.java.patch deleted file mode 100644 index 8f71d8c09..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockTripWireHook.java.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockTripWireHook.java -+++ ../src-work/minecraft/net/minecraft/block/BlockTripWireHook.java -@@ -77,14 +77,14 @@ - - public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) - { -- return side.getAxis().isHorizontal() && worldIn.getBlockState(pos.offset(side.getOpposite())).func_185915_l(); -+ return side.getAxis().isHorizontal() && worldIn.getBlockState(pos.offset(side.getOpposite())).isSideSolid(worldIn, pos.offset(side.getOpposite()), side); - } - - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) - { - for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) - { -- if (worldIn.getBlockState(pos.offset(enumfacing)).func_185915_l()) -+ if (worldIn.getBlockState(pos.offset(enumfacing)).isSideSolid(worldIn, pos.offset(enumfacing), enumfacing.getOpposite())) - { - return true; - } -@@ -118,7 +118,7 @@ - { - EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); - -- if (!worldIn.getBlockState(pos.offset(enumfacing.getOpposite())).func_185915_l()) -+ if (!worldIn.getBlockState(pos.offset(enumfacing.getOpposite())).isSideSolid(worldIn, pos.offset(enumfacing.getOpposite()), enumfacing)) - { - this.dropBlockAsItem(worldIn, pos, state, 0); - worldIn.setBlockToAir(pos); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockVine.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockVine.java.patch deleted file mode 100644 index d2eff4f1e..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockVine.java.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockVine.java -+++ ../src-work/minecraft/net/minecraft/block/BlockVine.java -@@ -26,7 +26,7 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --public class BlockVine extends Block -+public class BlockVine extends Block implements net.minecraftforge.common.IShearable - { - public static final PropertyBool UP = PropertyBool.create("up"); - public static final PropertyBool NORTH = PropertyBool.create("north"); -@@ -342,7 +342,7 @@ - - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack p_180657_6_) - { -- if (!worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears) -+ if (false && !worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears) // Forge: Noop, Covered by IShearable - { - player.triggerAchievement(StatList.func_188055_a(this)); - spawnAsEntity(worldIn, pos, new ItemStack(Blocks.vine, 1, 0)); -@@ -457,4 +457,14 @@ - - return i; - } -+ /*************************FORGE START***********************************/ -+ @Override public boolean isLadder(IBlockState state, IBlockAccess world, BlockPos pos, EntityLivingBase entity){ return true; } -+ @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; } -+ @Override -+ public java.util.List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) -+ { -+ return java.util.Arrays.asList(new ItemStack(this, 1)); -+ } -+ /*************************FORGE END***********************************/ -+ - } diff --git a/patches.mcp/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch b/patches.mcp/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch deleted file mode 100644 index a84700605..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java -+++ ../src-work/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java -@@ -80,7 +80,7 @@ - IBlockState iblockstate = this.world.getBlockState(origin); - Block block = iblockstate.getBlock(); - -- if (iblockstate.func_185904_a() == Material.air) -+ if (iblockstate.getBlock().isAir(iblockstate, this.world, origin)) - { - return true; - } -@@ -112,7 +112,7 @@ - iblockstate = this.world.getBlockState(blockpos); - block = iblockstate.getBlock(); - -- if (iblockstate.func_185904_a() == Material.air || !BlockPistonBase.func_185646_a(iblockstate, this.world, blockpos, this.moveDirection, false) || blockpos.equals(this.pistonPos)) -+ if (iblockstate.getBlock().isAir(iblockstate, this.world, blockpos) || !BlockPistonBase.func_185646_a(iblockstate, this.world, blockpos, this.moveDirection, false) || blockpos.equals(this.pistonPos)) - { - break; - } -@@ -159,7 +159,7 @@ - - iblockstate = this.world.getBlockState(blockpos1); - -- if (iblockstate.func_185904_a() == Material.air) -+ if (iblockstate.getBlock().isAir(iblockstate, this.world, blockpos1)) - { - return true; - } diff --git a/patches.mcp/minecraft/net/minecraft/block/state/BlockStateBase.java.patch b/patches.mcp/minecraft/net/minecraft/block/state/BlockStateBase.java.patch deleted file mode 100644 index e6d4fff7f..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/state/BlockStateBase.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/state/BlockStateBase.java -+++ ../src-work/minecraft/net/minecraft/block/state/BlockStateBase.java -@@ -71,4 +71,9 @@ - - return stringbuilder.toString(); - } -+ -+ public com.google.common.collect.ImmutableTable, Comparable, IBlockState> getPropertyValueTable() -+ { -+ return null; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/state/BlockStateContainer.java.patch b/patches.mcp/minecraft/net/minecraft/block/state/BlockStateContainer.java.patch deleted file mode 100644 index 3342a4b24..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/state/BlockStateContainer.java.patch +++ /dev/null @@ -1,77 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/state/BlockStateContainer.java -+++ ../src-work/minecraft/net/minecraft/block/state/BlockStateContainer.java -@@ -55,6 +55,16 @@ - - public BlockStateContainer(Block blockIn, IProperty... properties) - { -+ this(blockIn, properties, null); -+ } -+ -+ protected StateImplementation createState(Block block, ImmutableMap, Comparable> properties, ImmutableMap, com.google.common.base.Optional> unlistedProperties) -+ { -+ return new StateImplementation(block, properties); -+ } -+ -+ protected BlockStateContainer(Block blockIn, IProperty[] properties, ImmutableMap, com.google.common.base.Optional> unlistedProperties) -+ { - this.block = blockIn; - Map < String, IProperty> map = Maps. < String, IProperty> newHashMap(); - -@@ -71,7 +81,7 @@ - for (List < Comparable> list : Cartesian.cartesianProduct(this.getAllowedValues())) - { - Map < IProperty, Comparable> map1 = MapPopulator. < IProperty, Comparable> createMap(this.properties.values(), list); -- BlockStateContainer.StateImplementation blockstatecontainer$stateimplementation = new BlockStateContainer.StateImplementation(blockIn, ImmutableMap.copyOf(map1)); -+ BlockStateContainer.StateImplementation blockstatecontainer$stateimplementation = createState(blockIn, ImmutableMap.copyOf(map1), unlistedProperties); - map2.put(map1, blockstatecontainer$stateimplementation); - list1.add(blockstatecontainer$stateimplementation); - } -@@ -163,6 +173,13 @@ - this.properties = propertiesIn; - } - -+ protected StateImplementation(Block blockIn, ImmutableMap, Comparable> propertiesIn, ImmutableTable, Comparable, IBlockState> propertyValueTable) -+ { -+ this.block = blockIn; -+ this.properties = propertiesIn; -+ this.propertyValueTable = propertyValueTable; -+ } -+ - public Collection < IProperty> getPropertyNames() - { - return Collections. < IProperty> unmodifiableCollection(this.properties.keySet()); -@@ -414,5 +431,34 @@ - { - return this.block.func_185481_k(this); - } -+ -+ //Forge Start -+ public ImmutableTable, Comparable, IBlockState> getPropertyValueTable() -+ { -+ return propertyValueTable; -+ } -+ -+ @Override -+ public int getLightOpacity(IBlockAccess world, BlockPos pos) -+ { -+ return this.block.getLightOpacity(this, world, pos); -+ } -+ -+ @Override -+ public int getLightValue(IBlockAccess world, BlockPos pos) -+ { -+ return this.block.getLightValue(this, world, pos); -+ } -+ -+ public boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side) -+ { -+ return this.block.isSideSolid(this, world, pos, side); -+ } -+ -+ @Override -+ public boolean doesSideBlockRendering(IBlockAccess world, BlockPos pos, EnumFacing side) -+ { -+ return this.block.doesSideBlockRendering(this, world, pos, side); -+ } - } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/state/IBlockProperties.java.patch b/patches.mcp/minecraft/net/minecraft/block/state/IBlockProperties.java.patch deleted file mode 100644 index e90318ea8..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/state/IBlockProperties.java.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/state/IBlockProperties.java -+++ ../src-work/minecraft/net/minecraft/block/state/IBlockProperties.java -@@ -25,9 +25,13 @@ - - boolean func_185913_b(); - -+ @Deprecated //Forge location aware version below - int func_185891_c(); -+ int getLightOpacity(IBlockAccess world, BlockPos pos); - -+ @Deprecated //Forge location aware version below - int func_185906_d(); -+ int getLightValue(IBlockAccess world, BlockPos pos); - - @SideOnly(Side.CLIENT) - boolean func_185895_e(); -@@ -88,5 +92,10 @@ - - RayTraceResult func_185910_a(World p_185910_1_, BlockPos p_185910_2_, Vec3d p_185910_3_, Vec3d p_185910_4_); - -+ @Deprecated // Forge: Use isSideSolid(IBlockAccess, BlockPos, EnumFacing.UP) instead - boolean func_185896_q(); -+ -+ //Forge added functions -+ boolean doesSideBlockRendering(IBlockAccess world, BlockPos pos, EnumFacing side); -+ boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side); - } diff --git a/patches.mcp/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch b/patches.mcp/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch deleted file mode 100644 index e666d37fe..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/ClientBrandRetriever.java -+++ ../src-work/minecraft/net/minecraft/client/ClientBrandRetriever.java -@@ -8,6 +8,6 @@ - { - public static String getClientModName() - { -- return "vanilla"; -+ return net.minecraftforge.fml.common.FMLCommonHandler.instance().getModName(); - } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch deleted file mode 100644 index c4f3c5cdb..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/LoadingScreenRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/LoadingScreenRenderer.java -@@ -139,6 +139,10 @@ - GlStateManager.clear(16640); - } - -+ try -+ { -+ if (!net.minecraftforge.fml.client.FMLClientHandler.instance().handleLoadingScreen(scaledresolution)) //FML Don't render while FML's pre-screen is rendering -+ { - Tessellator tessellator = Tessellator.getInstance(); - VertexBuffer vertexbuffer = tessellator.getWorldRenderer(); - this.mc.getTextureManager().bindTexture(Gui.optionsBackground); -@@ -174,6 +178,12 @@ - GlStateManager.func_187428_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); - this.mc.fontRendererObj.drawStringWithShadow(this.currentlyDisplayedText, (float)((k - this.mc.fontRendererObj.getStringWidth(this.currentlyDisplayedText)) / 2), (float)(l / 2 - 4 - 16), 16777215); - this.mc.fontRendererObj.drawStringWithShadow(this.message, (float)((k - this.mc.fontRendererObj.getStringWidth(this.message)) / 2), (float)(l / 2 - 4 + 8), 16777215); -+ } -+ } -+ catch (java.io.IOException e) -+ { -+ com.google.common.base.Throwables.propagate(e); -+ } //FML End - this.framebuffer.unbindFramebuffer(); - - if (OpenGlHelper.isFramebufferEnabled()) diff --git a/patches.mcp/minecraft/net/minecraft/client/Minecraft.java.patch b/patches.mcp/minecraft/net/minecraft/client/Minecraft.java.patch deleted file mode 100644 index 4bfb84b46..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/Minecraft.java.patch +++ /dev/null @@ -1,476 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/Minecraft.java -+++ ../src-work/minecraft/net/minecraft/client/Minecraft.java -@@ -318,7 +318,6 @@ - this.sessionService = (new YggdrasilAuthenticationService(this.proxy, UUID.randomUUID().toString())).createMinecraftSessionService(); - this.session = gameConfig.userInfo.session; - logger.info("Setting user: " + this.session.getUsername()); -- logger.info("(Session ID is " + this.session.getSessionID() + ")"); - this.isDemo = gameConfig.gameInfo.isDemo; - this.displayWidth = gameConfig.displayInfo.width > 0 ? gameConfig.displayInfo.width : 1; - this.displayHeight = gameConfig.displayInfo.height > 0 ? gameConfig.displayInfo.height : 1; -@@ -432,10 +431,10 @@ - this.mcResourceManager = new SimpleReloadableResourceManager(this.metadataSerializer_); - this.mcLanguageManager = new LanguageManager(this.metadataSerializer_, this.gameSettings.language); - this.mcResourceManager.registerReloadListener(this.mcLanguageManager); -- this.refreshResources(); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().beginMinecraftLoading(this, this.defaultResourcePacks, this.mcResourceManager); - this.renderEngine = new TextureManager(this.mcResourceManager); - this.mcResourceManager.registerReloadListener(this.renderEngine); -- this.drawSplashScreen(this.renderEngine); -+ net.minecraftforge.fml.client.SplashProgress.drawVanillaScreen(this.renderEngine); - this.skinManager = new SkinManager(this.renderEngine, new File(this.fileAssets, "skins"), this.sessionService); - this.saveLoader = new AnvilSaveConverter(new File(this.mcDataDir, "saves"), this.field_184131_U); - this.mcSoundHandler = new SoundHandler(this.mcResourceManager, this.gameSettings); -@@ -469,6 +468,8 @@ - } - }); - this.mouseHelper = new MouseHelper(); -+ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar= net.minecraftforge.fml.common.ProgressManager.push("Rendering Setup", 5, true); -+ bar.step("GL Setup"); - this.checkGLError("Pre startup"); - GlStateManager.enableTexture2D(); - GlStateManager.shadeModel(7425); -@@ -482,19 +483,23 @@ - GlStateManager.loadIdentity(); - GlStateManager.matrixMode(5888); - this.checkGLError("Startup"); -- this.textureMapBlocks = new TextureMap("textures"); -+ bar.step("Loading Texture Map"); -+ this.textureMapBlocks = new TextureMap("textures", true); - this.textureMapBlocks.setMipmapLevels(this.gameSettings.mipmapLevels); - this.renderEngine.loadTickableTexture(TextureMap.locationBlocksTexture, this.textureMapBlocks); - this.renderEngine.bindTexture(TextureMap.locationBlocksTexture); - this.textureMapBlocks.setBlurMipmapDirect(false, this.gameSettings.mipmapLevels > 0); -+ bar.step("Loading Model Manager"); - this.modelManager = new ModelManager(this.textureMapBlocks); - this.mcResourceManager.registerReloadListener(this.modelManager); - this.field_184127_aH = BlockColors.func_186723_a(); - this.field_184128_aI = ItemColors.func_186729_a(this.field_184127_aH); -+ bar.step("Loading Item Renderer"); - this.renderItem = new RenderItem(this.renderEngine, this.modelManager, this.field_184128_aI); - this.renderManager = new RenderManager(this.renderEngine, this.renderItem); - this.itemRenderer = new ItemRenderer(this); - this.mcResourceManager.registerReloadListener(this.renderItem); -+ bar.step("Loading Entity Renderer"); - this.entityRenderer = new EntityRenderer(this, this.mcResourceManager); - this.mcResourceManager.registerReloadListener(this.entityRenderer); - this.blockRenderDispatcher = new BlockRendererDispatcher(this.modelManager.getBlockModelShapes(), this.field_184127_aH); -@@ -504,23 +509,26 @@ - this.guiAchievement = new GuiAchievement(this); - GlStateManager.viewport(0, 0, this.displayWidth, this.displayHeight); - this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine); -+ net.minecraftforge.fml.common.ProgressManager.pop(bar); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().finishMinecraftLoading(); - this.checkGLError("Post startup"); -- this.ingameGUI = new GuiIngame(this); -+ this.ingameGUI = new net.minecraftforge.client.GuiIngameForge(this); - - if (this.serverName != null) - { -- this.displayGuiScreen(new GuiConnecting(new GuiMainMenu(), this, this.serverName, this.serverPort)); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().connectToServerAtStartup(this.serverName, this.serverPort); - } - else - { - this.displayGuiScreen(new GuiMainMenu()); - } - -- this.renderEngine.deleteTexture(this.mojangLogo); -+ net.minecraftforge.fml.client.SplashProgress.clearVanillaResources(renderEngine, mojangLogo); - this.mojangLogo = null; - this.loadingScreen = new LoadingScreenRenderer(this); - this.field_184132_p = new DebugRenderer(this); - -+ net.minecraftforge.fml.client.FMLClientHandler.instance().onInitializationComplete(); - if (this.gameSettings.fullScreen && !this.fullscreen) - { - this.toggleFullscreen(); -@@ -692,21 +700,23 @@ - File file2 = new File(file1, "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-client.txt"); - Bootstrap.printToSYSOUT(crashReportIn.getCompleteReport()); - -+ int retVal; - if (crashReportIn.getFile() != null) - { - Bootstrap.printToSYSOUT("#@!@# Game crashed! Crash report saved to: #@!@# " + crashReportIn.getFile()); -- System.exit(-1); -+ retVal = -1; - } - else if (crashReportIn.saveToFile(file2)) - { - Bootstrap.printToSYSOUT("#@!@# Game crashed! Crash report saved to: #@!@# " + file2.getAbsolutePath()); -- System.exit(-1); -+ retVal = -1; - } - else - { - Bootstrap.printToSYSOUT("#@?@# Game crashed! Crash report could not be saved. #@?@#"); -- System.exit(-2); -+ retVal = -2; - } -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleExit(retVal); - } - - public boolean isUnicode() -@@ -899,11 +909,6 @@ - - public void displayGuiScreen(GuiScreen guiScreenIn) - { -- if (this.currentScreen != null) -- { -- this.currentScreen.onGuiClosed(); -- } -- - if (guiScreenIn == null && this.theWorld == null) - { - guiScreenIn = new GuiMainMenu(); -@@ -913,6 +918,17 @@ - guiScreenIn = new GuiGameOver((ITextComponent)null); - } - -+ GuiScreen old = this.currentScreen; -+ net.minecraftforge.client.event.GuiOpenEvent event = new net.minecraftforge.client.event.GuiOpenEvent(guiScreenIn); -+ -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return; -+ -+ guiScreenIn = event.gui; -+ if (old != null && guiScreenIn != old) -+ { -+ old.onGuiClosed(); -+ } -+ - if (guiScreenIn instanceof GuiMainMenu || guiScreenIn instanceof GuiMultiplayer) - { - this.gameSettings.showDebugInfo = false; -@@ -1051,9 +1067,11 @@ - - if (!this.skipRenderWorld) - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onRenderTickStart(this.timer.renderPartialTicks); - this.mcProfiler.endStartSection("gameRenderer"); - this.entityRenderer.updateCameraAndRender(this.timer.renderPartialTicks, i); - this.mcProfiler.endSection(); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onRenderTickEnd(this.timer.renderPartialTicks); - } - - this.mcProfiler.endSection(); -@@ -1393,9 +1411,9 @@ - { - BlockPos blockpos = this.objectMouseOver.getBlockPos(); - -- if (this.theWorld.getBlockState(blockpos).func_185904_a() != Material.air && this.playerController.onPlayerDamageBlock(blockpos, this.objectMouseOver.sideHit)) -+ if (!this.theWorld.isAirBlock(blockpos) && this.playerController.onPlayerDamageBlock(blockpos, this.objectMouseOver.sideHit)) - { -- this.effectRenderer.addBlockHitEffects(blockpos, this.objectMouseOver.sideHit); -+ this.effectRenderer.addBlockHitEffects(blockpos, this.objectMouseOver); - this.thePlayer.func_184609_a(EnumHand.MAIN_HAND); - } - } -@@ -1429,7 +1447,7 @@ - case BLOCK: - BlockPos blockpos = this.objectMouseOver.getBlockPos(); - -- if (this.theWorld.getBlockState(blockpos).func_185904_a() != Material.air) -+ if (!this.theWorld.isAirBlock(blockpos)) - { - this.playerController.clickBlock(blockpos, this.objectMouseOver.sideHit); - break; -@@ -1623,6 +1641,8 @@ - --this.rightClickDelayTimer; - } - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPreClientTick(); -+ - this.mcProfiler.startSection("gui"); - - if (!this.isGamePaused) -@@ -1734,6 +1754,7 @@ - this.joinPlayerCounter = 0; - this.theWorld.joinEntityInSurroundings(this.thePlayer); - } -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().fireMouseInput(); - } - - this.mcProfiler.endStartSection("gameRenderer"); -@@ -1821,6 +1842,7 @@ - this.myNetworkManager.processReceivedPackets(); - } - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostClientTick(); - this.mcProfiler.endSection(); - this.systemTime = getSystemTime(); - } -@@ -1926,6 +1948,7 @@ - this.gameSettings.showLagometer = this.gameSettings.showDebugInfo && GuiScreen.isAltKeyDown(); - } - } -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().fireKeyInput(); - } - } - -@@ -2166,6 +2189,8 @@ - { - while (Mouse.next()) - { -+ if (net.minecraftforge.client.ForgeHooksClient.postMouseEvent()) continue; -+ - int i = Mouse.getEventButton(); - KeyBinding.setKeyBindState(i - 100, Mouse.getEventButtonState()); - -@@ -2231,6 +2256,7 @@ - - public void launchIntegratedServer(String folderName, String worldName, WorldSettings worldSettingsIn) - { -+ net.minecraftforge.fml.client.FMLClientHandler.instance().startIntegratedServer(folderName, worldName, worldSettingsIn); - this.loadWorld((WorldClient)null); - System.gc(); - ISaveHandler isavehandler = this.saveLoader.getSaveLoader(folderName, false); -@@ -2273,6 +2299,12 @@ - - while (!this.theIntegratedServer.serverIsInRunLoop()) - { -+ if (!net.minecraftforge.fml.common.StartupQuery.check()) -+ { -+ loadWorld(null); -+ displayGuiScreen(null); -+ return; -+ } - String s = this.theIntegratedServer.getUserMessage(); - - if (s != null) -@@ -2298,8 +2330,14 @@ - SocketAddress socketaddress = this.theIntegratedServer.getNetworkSystem().addLocalEndpoint(); - NetworkManager networkmanager = NetworkManager.provideLocalClient(socketaddress); - networkmanager.setNetHandler(new NetHandlerLoginClient(networkmanager, this, (GuiScreen)null)); -- networkmanager.sendPacket(new C00Handshake(107, socketaddress.toString(), 0, EnumConnectionState.LOGIN)); -- networkmanager.sendPacket(new CPacketLoginStart(this.getSession().getProfile())); -+ networkmanager.sendPacket(new C00Handshake(107, socketaddress.toString(), 0, EnumConnectionState.LOGIN, true)); -+ com.mojang.authlib.GameProfile gameProfile = this.getSession().getProfile(); -+ if (!this.getSession().hasCachedProperties()) -+ { -+ gameProfile = sessionService.fillProfileProperties(gameProfile, true); //Forge: Fill profile properties upon game load. Fixes MC-52974. -+ this.getSession().setProperties(gameProfile.getProperties()); -+ } -+ networkmanager.sendPacket(new CPacketLoginStart(gameProfile)); - this.myNetworkManager = networkmanager; - } - -@@ -2310,6 +2348,8 @@ - - public void loadWorld(WorldClient worldClientIn, String loadingMessage) - { -+ if (theWorld != null) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(theWorld)); -+ - if (worldClientIn == null) - { - NetHandlerPlayClient nethandlerplayclient = this.getNetHandler(); -@@ -2322,6 +2362,18 @@ - if (this.theIntegratedServer != null && this.theIntegratedServer.isAnvilFileSet()) - { - this.theIntegratedServer.initiateShutdown(); -+ if (loadingScreen != null) -+ { -+ this.loadingScreen.displayLoadingString(I18n.format("forge.client.shutdown.internal")); -+ } -+ while (!theIntegratedServer.isServerStopped()) -+ { -+ try -+ { -+ Thread.sleep(10); -+ } -+ catch (InterruptedException ie) {} -+ } - } - - this.theIntegratedServer = null; -@@ -2345,6 +2397,7 @@ - this.ingameGUI.func_181029_i(); - this.setServerData((ServerData)null); - this.integratedServerIsRunning = false; -+ net.minecraftforge.fml.client.FMLClientHandler.instance().handleClientWorldClosing(this.theWorld); - } - - this.mcSoundHandler.stopSounds(); -@@ -2461,159 +2514,8 @@ - { - if (this.objectMouseOver != null && this.objectMouseOver.typeOfHit != RayTraceResult.Type.MISS) - { -- boolean flag = this.thePlayer.capabilities.isCreativeMode; -- TileEntity tileentity = null; -- ItemStack itemstack; -- -- if (this.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK) -- { -- BlockPos blockpos = this.objectMouseOver.getBlockPos(); -- IBlockState iblockstate = this.theWorld.getBlockState(blockpos); -- Block block = iblockstate.getBlock(); -- -- if (iblockstate.func_185904_a() == Material.air) -- { -- return; -- } -- -- itemstack = block.func_185473_a(this.theWorld, blockpos, iblockstate); -- -- if (itemstack == null) -- { -- return; -- } -- -- if (flag && GuiScreen.isCtrlKeyDown() && block.hasTileEntity()) -- { -- tileentity = this.theWorld.getTileEntity(blockpos); -- } -- } -- else -- { -- if (this.objectMouseOver.typeOfHit != RayTraceResult.Type.ENTITY || this.objectMouseOver.entityHit == null || !flag) -- { -- return; -- } -- -- if (this.objectMouseOver.entityHit instanceof EntityPainting) -- { -- itemstack = new ItemStack(Items.painting); -- } -- else if (this.objectMouseOver.entityHit instanceof EntityLeashKnot) -- { -- itemstack = new ItemStack(Items.lead); -- } -- else if (this.objectMouseOver.entityHit instanceof EntityItemFrame) -- { -- EntityItemFrame entityitemframe = (EntityItemFrame)this.objectMouseOver.entityHit; -- ItemStack itemstack1 = entityitemframe.getDisplayedItem(); -- -- if (itemstack1 == null) -- { -- itemstack = new ItemStack(Items.item_frame); -- } -- else -- { -- itemstack = ItemStack.copyItemStack(itemstack1); -- } -- } -- else if (this.objectMouseOver.entityHit instanceof EntityMinecart) -- { -- EntityMinecart entityminecart = (EntityMinecart)this.objectMouseOver.entityHit; -- Item item; -- -- switch (entityminecart.func_184264_v()) -- { -- case FURNACE: -- item = Items.furnace_minecart; -- break; -- case CHEST: -- item = Items.chest_minecart; -- break; -- case TNT: -- item = Items.tnt_minecart; -- break; -- case HOPPER: -- item = Items.hopper_minecart; -- break; -- case COMMAND_BLOCK: -- item = Items.command_block_minecart; -- break; -- default: -- item = Items.minecart; -- } -- -- itemstack = new ItemStack(item); -- } -- else if (this.objectMouseOver.entityHit instanceof EntityBoat) -- { -- itemstack = new ItemStack(((EntityBoat)this.objectMouseOver.entityHit).func_184455_j()); -- } -- else if (this.objectMouseOver.entityHit instanceof EntityArmorStand) -- { -- itemstack = new ItemStack(Items.armor_stand); -- } -- else if (this.objectMouseOver.entityHit instanceof EntityEnderCrystal) -- { -- itemstack = new ItemStack(Items.field_185158_cP); -- } -- else -- { -- String s = EntityList.getEntityString(this.objectMouseOver.entityHit); -- -- if (!EntityList.entityEggs.containsKey(s)) -- { -- return; -- } -- -- itemstack = new ItemStack(Items.spawn_egg); -- ItemMonsterPlacer.func_185078_a(itemstack, s); -- } -- } -- -- if (itemstack.getItem() == null) -- { -- String s1 = ""; -- -- if (this.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK) -- { -- s1 = ((ResourceLocation)Block.blockRegistry.getNameForObject(this.theWorld.getBlockState(this.objectMouseOver.getBlockPos()).getBlock())).toString(); -- } -- else if (this.objectMouseOver.typeOfHit == RayTraceResult.Type.ENTITY) -- { -- s1 = EntityList.getEntityString(this.objectMouseOver.entityHit); -- } -- -- logger.warn("Picking on: [{}] {} gave null item", new Object[] {this.objectMouseOver.typeOfHit, s1}); -- } -- else -- { -- InventoryPlayer inventoryplayer = this.thePlayer.inventory; -- -- if (tileentity != null) -- { -- this.func_184119_a(itemstack, tileentity); -- } -- -- int i = inventoryplayer.func_184429_b(itemstack); -- -- if (flag) -- { -- inventoryplayer.func_184434_a(itemstack); -- this.playerController.sendSlotPacket(this.thePlayer.func_184586_b(EnumHand.MAIN_HAND), 36 + inventoryplayer.currentItem); -- } -- else if (i != -1) -- { -- if (InventoryPlayer.func_184435_e(i)) -- { -- inventoryplayer.currentItem = i; -- } -- else -- { -- this.playerController.func_187100_a(i); -- } -- } -- } -+ net.minecraftforge.common.ForgeHooks.onPickBlock(this.objectMouseOver, this.thePlayer, this.theWorld); -+ // We delete this code wholly instead of commenting it out, to make sure we detect changes in it between MC versions - } - } - -@@ -2909,18 +2811,8 @@ - - public static int getGLMaximumTextureSize() - { -- for (int i = 16384; i > 0; i >>= 1) -- { -- GlStateManager.func_187419_a(32868, 0, 6408, i, i, 0, 6408, 5121, (IntBuffer)null); -- int j = GlStateManager.func_187411_c(32868, 0, 4096); -- -- if (j != 0) -- { -- return i; -- } -- } -- -- return -1; -+ //Forge we redirect this to our code which caches the value before any splash screen stuff is done. -+ return net.minecraftforge.fml.client.SplashProgress.getMaxTextureSize(); - } - - public boolean isSnooperEnabled() diff --git a/patches.mcp/minecraft/net/minecraft/client/audio/SoundManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/audio/SoundManager.java.patch deleted file mode 100644 index a4124c09a..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/audio/SoundManager.java.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/audio/SoundManager.java -+++ ../src-work/minecraft/net/minecraft/client/audio/SoundManager.java -@@ -76,6 +76,7 @@ - { - SoundSystemConfig.addLibrary(LibraryLWJGLOpenAL.class); - SoundSystemConfig.setCodec("ogg", CodecJOrbis.class); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.SoundSetupEvent(this)); - } - catch (SoundSystemException soundsystemexception) - { -@@ -100,6 +101,7 @@ - - this.unloadSoundSystem(); - this.loadSoundSystem(); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.SoundLoadEvent(this)); - } - - private synchronized void loadSoundSystem() -@@ -350,6 +352,9 @@ - } - else - { -+ p_sound = net.minecraftforge.client.ForgeHooksClient.playSound(this, p_sound); -+ if (p_sound == null) return; -+ - if (!this.field_188777_o.isEmpty()) - { - for (ISoundEventListener isoundeventlistener : this.field_188777_o) -@@ -400,10 +405,12 @@ - if (sound.func_188723_h()) - { - this.sndSystem.newStreamingSource(false, s, getURLForSoundResource(resourcelocation1), resourcelocation1.toString(), flag, p_sound.getXPosF(), p_sound.getYPosF(), p_sound.getZPosF(), p_sound.getAttenuationType().getTypeInt(), f); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlayStreamingSourceEvent(this, p_sound, s)); - } - else - { - this.sndSystem.newSource(false, s, getURLForSoundResource(resourcelocation1), resourcelocation1.toString(), flag, p_sound.getXPosF(), p_sound.getYPosF(), p_sound.getZPosF(), p_sound.getAttenuationType().getTypeInt(), f); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlaySoundSourceEvent(this, p_sound, s)); - } - - logger.debug(LOG_MARKER, "Playing sound {} for event {} as channel {}", new Object[] {sound.func_188719_a(), resourcelocation1, s}); diff --git a/patches.mcp/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch b/patches.mcp/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch deleted file mode 100644 index 74fca0297..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java -+++ ../src-work/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java -@@ -148,6 +148,6 @@ - f *= 1.0F - f1 * 0.15F; - } - -- return f; -+ return net.minecraftforge.client.ForgeHooksClient.getOffsetFOV(this, f); - } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch b/patches.mcp/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch deleted file mode 100644 index 161906573..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch +++ /dev/null @@ -1,73 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/entity/EntityPlayerSP.java -+++ ../src-work/minecraft/net/minecraft/client/entity/EntityPlayerSP.java -@@ -400,6 +400,15 @@ - this.mc.ingameGUI.getChatGUI().printChatMessage(chatComponent); - } - -+ private boolean isHeadspaceFree(BlockPos pos, int height) -+ { -+ for (int y = 0; y < height; y++) -+ { -+ if (isOpenBlockSpace(pos.add(0, y, 0))) return false; -+ } -+ return true; -+ } -+ - protected boolean pushOutOfBlocks(double x, double y, double z) - { - if (this.noClip) -@@ -412,30 +421,34 @@ - double d0 = x - (double)blockpos.getX(); - double d1 = z - (double)blockpos.getZ(); - -- if (!this.isOpenBlockSpace(blockpos)) -+ int entHeight = Math.max(Math.round(this.height), 1); -+ -+ boolean inTranslucentBlock = this.isHeadspaceFree(blockpos, entHeight); -+ -+ if (inTranslucentBlock) - { - int i = -1; - double d2 = 9999.0D; - -- if (this.isOpenBlockSpace(blockpos.west()) && d0 < d2) -+ if (!this.isHeadspaceFree(blockpos.west(), entHeight) && d0 < d2) - { - d2 = d0; - i = 0; - } - -- if (this.isOpenBlockSpace(blockpos.east()) && 1.0D - d0 < d2) -+ if (!this.isHeadspaceFree(blockpos.east(), entHeight) && 1.0D - d0 < d2) - { - d2 = 1.0D - d0; - i = 1; - } - -- if (this.isOpenBlockSpace(blockpos.north()) && d1 < d2) -+ if (!this.isHeadspaceFree(blockpos.north(), entHeight) && d1 < d2) - { - d2 = d1; - i = 4; - } - -- if (this.isOpenBlockSpace(blockpos.south()) && 1.0D - d1 < d2) -+ if (!this.isHeadspaceFree(blockpos.south(), entHeight) && 1.0D - d1 < d2) - { - d2 = 1.0D - d1; - i = 5; -@@ -515,7 +528,13 @@ - - public void func_184185_a(SoundEvent p_184185_1_, float p_184185_2_, float p_184185_3_) - { -- this.worldObj.func_184134_a(this.posX, this.posY, this.posZ, p_184185_1_, this.func_184176_by(), p_184185_2_, p_184185_3_, false); -+ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, p_184185_1_, this.func_184176_by(), p_184185_2_, p_184185_3_); -+ if (event.isCanceled() || event.getSound() == null) return; -+ p_184185_1_ = event.getSound(); -+ p_184185_2_ = event.getVolume(); -+ p_184185_3_ = event.getPitch(); -+ -+ this.worldObj.func_184134_a(this.posX, this.posY, this.posZ, p_184185_1_, event.getCategory(), p_184185_2_, p_184185_3_, false); - } - - public boolean isServerWorld() diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/FontRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/FontRenderer.java.patch deleted file mode 100644 index 2d53a7f25..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/FontRenderer.java.patch +++ /dev/null @@ -1,144 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/FontRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/gui/FontRenderer.java -@@ -57,7 +57,7 @@ - this.locationFontTexture = location; - this.renderEngine = textureManagerIn; - this.unicodeFlag = unicode; -- textureManagerIn.bindTexture(this.locationFontTexture); -+ bindTexture(this.locationFontTexture); - - for (int i = 0; i < 32; ++i) - { -@@ -97,6 +97,7 @@ - public void onResourceManagerReload(IResourceManager resourceManager) - { - this.readFontTexture(); -+ this.readGlyphSizes(); - } - - private void readFontTexture() -@@ -106,7 +107,7 @@ - - try - { -- iresource = Minecraft.getMinecraft().getResourceManager().getResource(this.locationFontTexture); -+ iresource = getResource(this.locationFontTexture); - bufferedimage = TextureUtil.readBufferedImage(iresource.getInputStream()); - } - catch (IOException ioexception) -@@ -171,7 +172,7 @@ - - try - { -- iresource = Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation("font/glyph_sizes.bin")); -+ iresource = getResource(new ResourceLocation("font/glyph_sizes.bin")); - iresource.getInputStream().read(this.glyphWidth); - } - catch (IOException ioexception) -@@ -202,7 +203,7 @@ - int i = ch % 16 * 8; - int j = ch / 16 * 8; - int k = italic ? 1 : 0; -- this.renderEngine.bindTexture(this.locationFontTexture); -+ bindTexture(this.locationFontTexture); - int l = this.charWidth[ch]; - float f = (float)l - 0.01F; - GlStateManager.func_187447_r(5); -@@ -230,7 +231,7 @@ - - private void loadGlyphTexture(int page) - { -- this.renderEngine.bindTexture(this.getUnicodePageLocation(page)); -+ bindTexture(this.getUnicodePageLocation(page)); - } - - protected float renderUnicodeChar(char ch, boolean italic) -@@ -279,7 +280,7 @@ - - public int drawString(String text, float x, float y, int color, boolean dropShadow) - { -- GlStateManager.enableAlpha(); -+ enableAlpha(); - this.resetStyles(); - int i; - -@@ -349,7 +350,7 @@ - - int j1 = this.colorCode[i1]; - this.textColor = j1; -- GlStateManager.color((float)(j1 >> 16) / 255.0F, (float)(j1 >> 8 & 255) / 255.0F, (float)(j1 & 255) / 255.0F, this.alpha); -+ setColor((float)(j1 >> 16) / 255.0F, (float)(j1 >> 8 & 255) / 255.0F, (float)(j1 & 255) / 255.0F, this.alpha); - } - else if (i1 == 16) - { -@@ -378,7 +379,7 @@ - this.strikethroughStyle = false; - this.underlineStyle = false; - this.italicStyle = false; -- GlStateManager.color(this.red, this.blue, this.green, this.alpha); -+ setColor(this.red, this.blue, this.green, this.alpha); - } - - ++i; -@@ -406,7 +407,7 @@ - c0 = c1; - } - -- float f1 = this.unicodeFlag ? 0.5F : 1.0F; -+ float f1 = j == -1 || this.unicodeFlag ? 0.5f : 1f; - boolean flag = (c0 == 0 || j == -1 || this.unicodeFlag) && shadow; - - if (flag) -@@ -444,7 +445,16 @@ - - ++f; - } -+ doDraw(f); -+ } -+ } -+ } - -+ protected void doDraw(float f) -+ { -+ { -+ { -+ - if (this.strikethroughStyle) - { - Tessellator tessellator = Tessellator.getInstance(); -@@ -517,7 +527,7 @@ - this.blue = (float)(color >> 8 & 255) / 255.0F; - this.green = (float)(color & 255) / 255.0F; - this.alpha = (float)(color >> 24 & 255) / 255.0F; -- GlStateManager.color(this.red, this.blue, this.green, this.alpha); -+ setColor(this.red, this.blue, this.green, this.alpha); - this.posX = x; - this.posY = y; - this.renderStringAtPos(text, dropShadow); -@@ -848,6 +858,26 @@ - return this.bidiFlag; - } - -+ protected void setColor(float r, float g, float b, float a) -+ { -+ GlStateManager.color(r,g,b,a); -+ } -+ -+ protected void enableAlpha() -+ { -+ GlStateManager.enableAlpha(); -+ } -+ -+ protected void bindTexture(ResourceLocation location) -+ { -+ renderEngine.bindTexture(location); -+ } -+ -+ protected IResource getResource(ResourceLocation location) throws IOException -+ { -+ return Minecraft.getMinecraft().getResourceManager().getResource(location); -+ } -+ - public int getColorCode(char character) - { - int i = "0123456789abcdef".indexOf(character); diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiButton.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiButton.java.patch deleted file mode 100644 index fa7fb1ca1..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiButton.java.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiButton.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiButton.java -@@ -22,6 +22,7 @@ - public boolean enabled; - public boolean visible; - protected boolean hovered; -+ public int packedFGColour; //FML - - public GuiButton(int buttonId, int x, int y, String buttonText) - { -@@ -75,6 +76,11 @@ - this.mouseDragged(mc, mouseX, mouseY); - int j = 14737632; - -+ if (packedFGColour != 0) -+ { -+ j = packedFGColour; -+ } -+ else - if (!this.enabled) - { - j = 10526880; diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiChat.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiChat.java.patch deleted file mode 100644 index e3b570782..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiChat.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiChat.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiChat.java -@@ -250,6 +250,7 @@ - - public BlockPos func_186839_b() - { -+ - BlockPos blockpos = null; - - if (this.field_186853_g.objectMouseOver != null && this.field_186853_g.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK) diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch deleted file mode 100644 index 420742007..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch +++ /dev/null @@ -1,36 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiCreateWorld.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiCreateWorld.java -@@ -205,6 +205,8 @@ - } - } - -+ WorldType.worldTypes[this.selectedIndex].onGUICreateWorldPress(); -+ - WorldSettings worldsettings = new WorldSettings(i, WorldSettings.GameType.getByName(this.gameMode), this.field_146341_s, this.field_146337_w, WorldType.worldTypes[this.selectedIndex]); - worldsettings.setWorldName(this.chunkProviderSettingsJson); - -@@ -311,14 +313,7 @@ - } - else if (button.id == 8) - { -- if (WorldType.worldTypes[this.selectedIndex] == WorldType.FLAT) -- { -- this.mc.displayGuiScreen(new GuiCreateFlatWorld(this, this.chunkProviderSettingsJson)); -- } -- else -- { -- this.mc.displayGuiScreen(new GuiCustomizeWorldScreen(this, this.chunkProviderSettingsJson)); -- } -+ WorldType.worldTypes[this.selectedIndex].onCustomizeButton(mc, this); - } - } - } -@@ -370,7 +365,7 @@ - this.btnBonusItems.visible = this.field_146344_y; - this.btnMapType.visible = this.field_146344_y; - this.btnAllowCommands.visible = this.field_146344_y; -- this.btnCustomizeType.visible = this.field_146344_y && (WorldType.worldTypes[this.selectedIndex] == WorldType.FLAT || WorldType.worldTypes[this.selectedIndex] == WorldType.CUSTOMIZED); -+ this.btnCustomizeType.visible = this.field_146344_y && WorldType.worldTypes[this.selectedIndex].isCustomizable(); - } - - this.func_146319_h(); diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiIngame.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiIngame.java.patch deleted file mode 100644 index 2b9853f16..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiIngame.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiIngame.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiIngame.java -@@ -360,7 +360,8 @@ - - BlockPos blockpos = raytraceresult.getBlockPos(); - -- if (!this.mc.theWorld.getBlockState(blockpos).getBlock().hasTileEntity() || !(this.mc.theWorld.getTileEntity(blockpos) instanceof IInventory)) -+ net.minecraft.block.state.IBlockState state = this.mc.theWorld.getBlockState(blockpos); -+ if (!state.getBlock().hasTileEntity(state) || !(this.mc.theWorld.getTileEntity(blockpos) instanceof IInventory)) - { - return; - } diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch deleted file mode 100644 index aef607d2c..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiIngameMenu.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiIngameMenu.java -@@ -30,8 +30,9 @@ - - this.buttonList.add(new GuiButton(4, this.width / 2 - 100, this.height / 4 + 24 + i, I18n.format("menu.returnToGame", new Object[0]))); - this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + i, 98, 20, I18n.format("menu.options", new Object[0]))); -+ this.buttonList.add(new GuiButton(12, this.width / 2 + 2, this.height / 4 + 96 + i, 98, 20, I18n.format("fml.menu.modoptions"))); - GuiButton guibutton; -- this.buttonList.add(guibutton = new GuiButton(7, this.width / 2 + 2, this.height / 4 + 96 + i, 98, 20, I18n.format("menu.shareToLan", new Object[0]))); -+ this.buttonList.add(guibutton = new GuiButton(7, this.width / 2 - 100, this.height / 4 + 72 + i, 200, 20, I18n.format("menu.shareToLan", new Object[0]))); - this.buttonList.add(new GuiButton(5, this.width / 2 - 100, this.height / 4 + 48 + i, 98, 20, I18n.format("gui.achievements", new Object[0]))); - this.buttonList.add(new GuiButton(6, this.width / 2 + 2, this.height / 4 + 48 + i, 98, 20, I18n.format("gui.stats", new Object[0]))); - guibutton.enabled = this.mc.isSingleplayer() && !this.mc.getIntegratedServer().getPublic(); -@@ -74,13 +75,19 @@ - this.mc.setIngameFocus(); - break; - case 5: -+ if (this.mc.thePlayer != null) - this.mc.displayGuiScreen(new GuiAchievements(this, this.mc.thePlayer.getStatFileWriter())); - break; - case 6: -+ if (this.mc.thePlayer != null) - this.mc.displayGuiScreen(new GuiStats(this, this.mc.thePlayer.getStatFileWriter())); - break; - case 7: - this.mc.displayGuiScreen(new GuiShareToLan(this)); -+ break; -+ case 12: -+ net.minecraftforge.fml.client.FMLClientHandler.instance().showInGameModOptions(this); -+ break; - } - } - diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiListWorldSelectionEntry.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiListWorldSelectionEntry.java.patch deleted file mode 100644 index 3731eb657..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiListWorldSelectionEntry.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiListWorldSelectionEntry.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiListWorldSelectionEntry.java -@@ -242,7 +242,7 @@ - - if (this.field_186784_e.getSaveLoader().canLoadWorld(this.field_186786_g.getFileName())) - { -- this.field_186784_e.launchIntegratedServer(this.field_186786_g.getFileName(), this.field_186786_g.getDisplayName(), (WorldSettings)null); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().tryLoadExistingWorld(field_186785_f, this.field_186786_g); - } - } - diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch deleted file mode 100644 index 74df3b87b..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch +++ /dev/null @@ -1,42 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiMainMenu.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiMainMenu.java -@@ -216,7 +216,8 @@ - { - this.buttonList.add(new GuiButton(1, this.width / 2 - 100, p_73969_1_, I18n.format("menu.singleplayer", new Object[0]))); - this.buttonList.add(new GuiButton(2, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 1, I18n.format("menu.multiplayer", new Object[0]))); -- this.buttonList.add(this.realmsButton = new GuiButton(14, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 2, I18n.format("menu.online", new Object[0]))); -+ this.buttonList.add(this.realmsButton = new GuiButton(14, this.width / 2 + 2, p_73969_1_ + p_73969_2_ * 2, 98, 20, I18n.format("menu.online", new Object[0]).replace("Minecraft", "").trim())); -+ this.buttonList.add(new GuiButton(6, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 2, 98, 20, I18n.format("fml.menu.mods"))); - } - - private void addDemoButtons(int p_73972_1_, int p_73972_2_) -@@ -264,6 +265,11 @@ - this.mc.shutdown(); - } - -+ if (button.id == 6) -+ { -+ this.mc.displayGuiScreen(new net.minecraftforge.fml.client.GuiModList(this)); -+ } -+ - if (button.id == 11) - { - this.mc.launchIntegratedServer("Demo_World", "Demo_World", DemoWorldServer.demoWorldSettings); -@@ -512,7 +518,16 @@ - s = s + ("release".equalsIgnoreCase(this.mc.func_184123_d()) ? "" : "/" + this.mc.func_184123_d()); - } - -- this.drawString(this.fontRendererObj, s, 2, this.height - 10, -1); -+ java.util.List brandings = com.google.common.collect.Lists.reverse(net.minecraftforge.fml.common.FMLCommonHandler.instance().getBrandings(true)); -+ for (int brdline = 0; brdline < brandings.size(); brdline++) -+ { -+ String brd = brandings.get(brdline); -+ if (!com.google.common.base.Strings.isNullOrEmpty(brd)) -+ { -+ this.drawString(this.fontRendererObj, brd, 2, this.height - ( 10 + brdline * (this.fontRendererObj.FONT_HEIGHT + 1)), 16777215); -+ } -+ } -+ net.minecraftforge.client.ForgeHooksClient.renderMainMenu(this, this.fontRendererObj, this.width, this.height); - String s1 = "Copyright Mojang AB. Do not distribute!"; - this.drawString(this.fontRendererObj, s1, this.width - this.fontRendererObj.getStringWidth(s1) - 2, this.height - 10, -1); - diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch deleted file mode 100644 index 4e8b2f3eb..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiMultiplayer.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiMultiplayer.java -@@ -40,6 +40,7 @@ - public GuiMultiplayer(GuiScreen parentScreen) - { - this.parentScreen = parentScreen; -+ net.minecraftforge.fml.client.FMLClientHandler.instance().setupServerList(); - } - - public void initGui() -@@ -372,7 +373,7 @@ - - private void connectToServer(ServerData server) - { -- this.mc.displayGuiScreen(new GuiConnecting(this, this.mc, server)); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().connectToServer(this, server); - } - - public void selectServer(int index) diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch deleted file mode 100644 index 179cfc568..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java -@@ -190,6 +190,9 @@ - long l = j - k; - List list = Lists.newArrayList(new String[] {String.format("Java: %s %dbit", new Object[]{System.getProperty("java.version"), Integer.valueOf(this.mc.isJava64bit() ? 64 : 32)}), String.format("Mem: % 2d%% %03d/%03dMB", new Object[]{Long.valueOf(l * 100L / i), Long.valueOf(bytesToMb(l)), Long.valueOf(bytesToMb(i))}), String.format("Allocated: % 2d%% %03dMB", new Object[]{Long.valueOf(j * 100L / i), Long.valueOf(bytesToMb(j))}), "", String.format("CPU: %s", new Object[]{OpenGlHelper.getCpu()}), "", String.format("Display: %dx%d (%s)", new Object[]{Integer.valueOf(Display.getWidth()), Integer.valueOf(Display.getHeight()), GlStateManager.func_187416_u(7936)}), GlStateManager.func_187416_u(7937), GlStateManager.func_187416_u(7938)}); - -+ list.add(""); -+ list.addAll(net.minecraftforge.fml.common.FMLCommonHandler.instance().getBrandings(false)); -+ - if (this.isReducedDebug()) - { - return list; diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiScreen.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiScreen.java.patch deleted file mode 100644 index 302b4e3bb..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiScreen.java.patch +++ /dev/null @@ -1,107 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiScreen.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiScreen.java -@@ -141,7 +141,8 @@ - } - } - -- this.drawHoveringText(list, x, y); -+ FontRenderer font = stack.getItem().getFontRenderer(stack); -+ this.drawHoveringText(list, x, y, (font == null ? fontRendererObj : font)); - } - - protected void drawCreativeTabHoveringText(String tabName, int mouseX, int mouseY) -@@ -151,6 +152,11 @@ - - protected void drawHoveringText(List textLines, int x, int y) - { -+ drawHoveringText(textLines, x, y, fontRendererObj); -+ } -+ -+ protected void drawHoveringText(List textLines, int x, int y, FontRenderer font) -+ { - if (!textLines.isEmpty()) - { - GlStateManager.disableRescaleNormal(); -@@ -161,7 +167,7 @@ - - for (String s : textLines) - { -- int j = this.fontRendererObj.getStringWidth(s); -+ int j = font.getStringWidth(s); - - if (j > i) - { -@@ -206,7 +212,7 @@ - for (int k1 = 0; k1 < textLines.size(); ++k1) - { - String s1 = (String)textLines.get(k1); -- this.fontRendererObj.drawStringWithShadow(s1, (float)l1, (float)i2, -1); -+ font.drawStringWithShadow(s1, (float)l1, (float)i2, -1); - - if (k1 == 0) - { -@@ -421,6 +427,7 @@ - { - this.mc.ingameGUI.getChatGUI().addToSentMessages(msg); - } -+ if (net.minecraftforge.client.ClientCommandHandler.instance.executeCommand(mc.thePlayer, msg) != 0) return; - - this.mc.thePlayer.sendChatMessage(msg); - } -@@ -435,9 +442,15 @@ - - if (guibutton.mousePressed(this.mc, mouseX, mouseY)) - { -+ net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent.Pre event = new net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent.Pre(this, guibutton, this.buttonList); -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) -+ break; -+ guibutton = event.button; - this.selectedButton = guibutton; - guibutton.playPressSound(this.mc.getSoundHandler()); - this.actionPerformed(guibutton); -+ if (this.equals(this.mc.currentScreen)) -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent.Post(this, event.button, this.buttonList)); - } - } - } -@@ -467,8 +480,12 @@ - this.fontRendererObj = mc.fontRendererObj; - this.width = width; - this.height = height; -+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Pre(this, this.buttonList))) -+ { - this.buttonList.clear(); - this.initGui(); -+ } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Post(this, this.buttonList)); - } - - public void func_183500_a(int p_183500_1_, int p_183500_2_) -@@ -487,7 +504,9 @@ - { - while (Mouse.next()) - { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.MouseInputEvent.Pre(this))) continue; - this.handleMouseInput(); -+ if (this.equals(this.mc.currentScreen)) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.MouseInputEvent.Post(this)); - } - } - -@@ -495,7 +514,9 @@ - { - while (Keyboard.next()) - { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.KeyboardInputEvent.Pre(this))) continue; - this.handleKeyboardInput(); -+ if (this.equals(this.mc.currentScreen)) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.KeyboardInputEvent.Post(this)); - } - } - } -@@ -557,6 +578,7 @@ - public void drawDefaultBackground() - { - this.drawWorldBackground(0); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.BackgroundDrawnEvent(this)); - } - - public void drawWorldBackground(int tint) diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch deleted file mode 100644 index a179369e2..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiSleepMP.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiSleepMP.java -@@ -32,7 +32,7 @@ - - if (!s.isEmpty()) - { -- this.mc.thePlayer.sendChatMessage(s); -+ this.sendChatMessage(s); // Forge: fix vanilla not adding messages to the sent list while sleeping - } - - this.inputField.setText(""); diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiSlot.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiSlot.java.patch deleted file mode 100644 index 852133385..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiSlot.java.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiSlot.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiSlot.java -@@ -181,15 +181,8 @@ - GlStateManager.disableFog(); - Tessellator tessellator = Tessellator.getInstance(); - VertexBuffer vertexbuffer = tessellator.getWorldRenderer(); -- this.mc.getTextureManager().bindTexture(Gui.optionsBackground); -- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); -- float f = 32.0F; -- vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); -- vertexbuffer.pos((double)this.left, (double)this.bottom, 0.0D).func_187315_a((double)((float)this.left / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); -- vertexbuffer.pos((double)this.right, (double)this.bottom, 0.0D).func_187315_a((double)((float)this.right / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); -- vertexbuffer.pos((double)this.right, (double)this.top, 0.0D).func_187315_a((double)((float)this.right / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); -- vertexbuffer.pos((double)this.left, (double)this.top, 0.0D).func_187315_a((double)((float)this.left / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); -- tessellator.draw(); -+ // Forge: background rendering moved into separate method. -+ this.drawContainerBackground(tessellator); - int k = this.left + this.width / 2 - this.getListWidth() / 2 + 2; - int l = this.top + 4 - (int)this.amountScrolled; - -@@ -458,4 +451,18 @@ - { - return this.slotHeight; - } -+ -+ protected void drawContainerBackground(Tessellator tessellator) -+ { -+ VertexBuffer buffer = tessellator.getWorldRenderer(); -+ this.mc.getTextureManager().bindTexture(Gui.optionsBackground); -+ GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); -+ float f = 32.0F; -+ buffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); -+ buffer.pos((double)this.left, (double)this.bottom, 0.0D).func_187315_a((double)((float)this.left / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); -+ buffer.pos((double)this.right, (double)this.bottom, 0.0D).func_187315_a((double)((float)this.right / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); -+ buffer.pos((double)this.right, (double)this.top, 0.0D).func_187315_a((double)((float)this.right / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); -+ buffer.pos((double)this.left, (double)this.top, 0.0D).func_187315_a((double)((float)this.left / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); -+ tessellator.draw(); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java.patch deleted file mode 100644 index 94e88d2d3..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java -@@ -73,6 +73,7 @@ - s3 = s4; - } - -+ s3 = FontRenderer.getFormatFromString(s2) + s3; //Forge: Fix chat formatting not surviving line wrapping. - TextComponentString textcomponentstring2 = new TextComponentString(s3); - textcomponentstring2.setChatStyle(itextcomponent1.getChatStyle().createShallowCopy()); - list1.add(j + 1, textcomponentstring2); diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch deleted file mode 100644 index 9a197d392..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java -+++ ../src-work/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java -@@ -82,7 +82,7 @@ - boolean flag1 = this.field_148301_e.version < 107; - boolean flag2 = flag || flag1; - this.mc.fontRendererObj.drawString(this.field_148301_e.serverName, x + 32 + 3, y + 1, 16777215); -- List list = this.mc.fontRendererObj.listFormattedStringToWidth(this.field_148301_e.serverMOTD, listWidth - 32 - 2); -+ List list = this.mc.fontRendererObj.listFormattedStringToWidth(net.minecraftforge.fml.client.FMLClientHandler.instance().fixDescription(this.field_148301_e.serverMOTD), listWidth - 48 - 2); - - for (int i = 0; i < Math.min(list.size(), 2); ++i) - { -@@ -176,6 +176,11 @@ - int i1 = mouseX - x; - int j1 = mouseY - y; - -+ String tooltip = net.minecraftforge.fml.client.FMLClientHandler.instance().enhanceServerListEntry(this, this.field_148301_e, x, listWidth, y, i1, j1); -+ if (tooltip != null) -+ { -+ this.field_148303_c.setHoveringText(tooltip); -+ } else - if (i1 >= listWidth - 15 && i1 <= listWidth - 5 && j1 >= 0 && j1 <= 8) - { - this.field_148303_c.setHoveringText(s1); diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch deleted file mode 100644 index 7efb6b7a7..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch +++ /dev/null @@ -1,116 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java -+++ ../src-work/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java -@@ -49,6 +49,10 @@ - private StatFileWriter statFileWriter; - private boolean loadingAchievements = true; - -+ private int currentPage = -1; -+ private GuiButton button; -+ private java.util.LinkedList minecraftAchievements = new java.util.LinkedList(); -+ - public GuiAchievements(GuiScreen parentScreenIn, StatFileWriter statFileWriterIn) - { - this.parentScreen = parentScreenIn; -@@ -57,6 +61,14 @@ - int j = 141; - this.field_146569_s = this.field_146567_u = this.field_146565_w = (double)(AchievementList.field_187982_f.displayColumn * 24 - i / 2 - 12); - this.field_146568_t = this.field_146566_v = this.field_146573_x = (double)(AchievementList.field_187982_f.displayRow * 24 - j / 2); -+ minecraftAchievements.clear(); -+ for (Achievement achievement : AchievementList.field_187981_e) -+ { -+ if (!net.minecraftforge.common.AchievementPage.isAchievementInPages(achievement)) -+ { -+ minecraftAchievements.add(achievement); -+ } -+ } - } - - public void initGui() -@@ -64,6 +76,7 @@ - this.mc.getNetHandler().addToSendQueue(new CPacketClientStatus(CPacketClientStatus.State.REQUEST_STATS)); - this.buttonList.clear(); - this.buttonList.add(new GuiOptionButton(1, this.width / 2 + 24, this.height / 2 + 74, 80, 20, I18n.format("gui.done", new Object[0]))); -+ this.buttonList.add(button = new GuiButton(2, (width - field_146555_f) / 2 + 24, height / 2 + 74, 125, 20, net.minecraftforge.common.AchievementPage.getTitle(currentPage))); - } - - protected void actionPerformed(GuiButton button) throws IOException -@@ -74,6 +87,16 @@ - { - this.mc.displayGuiScreen(this.parentScreen); - } -+ -+ if (button.id == 2) -+ { -+ currentPage++; -+ if (currentPage >= net.minecraftforge.common.AchievementPage.getAchievementPages().size()) -+ { -+ currentPage = -1; -+ } -+ this.button.displayString = net.minecraftforge.common.AchievementPage.getTitle(currentPage); -+ } - } - } - -@@ -257,7 +280,9 @@ - GlStateManager.depthFunc(518); - GlStateManager.pushMatrix(); - GlStateManager.translate((float)i1, (float)j1, -200.0F); -- GlStateManager.scale(1.0F / this.field_146570_r, 1.0F / this.field_146570_r, 0.0F); -+ // FIXES models rendering weirdly in the acheivements pane -+ // see https://github.com/MinecraftForge/MinecraftForge/commit/1b7ce7592caafb760ec93066184182ae0711e793#commitcomment-10512284 -+ GlStateManager.scale(1.0F / this.field_146570_r, 1.0F / this.field_146570_r, 1.0F); - GlStateManager.enableTexture2D(); - GlStateManager.disableLighting(); - GlStateManager.enableRescaleNormal(); -@@ -331,11 +356,12 @@ - GlStateManager.depthFunc(515); - this.mc.getTextureManager().bindTexture(ACHIEVEMENT_BACKGROUND); - -- for (int j5 = 0; j5 < AchievementList.field_187981_e.size(); ++j5) -+ java.util.List achievementList = (currentPage == -1 ? minecraftAchievements : net.minecraftforge.common.AchievementPage.getAchievementPage(currentPage).getAchievements()); -+ for (int j5 = 0; j5 < achievementList.size(); ++j5) - { - Achievement achievement1 = (Achievement)AchievementList.field_187981_e.get(j5); - -- if (achievement1.parentAchievement != null) -+ if (achievement1.parentAchievement != null && achievementList.contains(achievement1.parentAchievement)) - { - int k5 = achievement1.displayColumn * 24 - i + 11; - int l5 = achievement1.displayRow * 24 - j + 11; -@@ -389,9 +415,9 @@ - GlStateManager.enableRescaleNormal(); - GlStateManager.enableColorMaterial(); - -- for (int i6 = 0; i6 < AchievementList.field_187981_e.size(); ++i6) -+ for (int i6 = 0; i6 < achievementList.size(); ++i6) - { -- Achievement achievement2 = (Achievement)AchievementList.field_187981_e.get(i6); -+ Achievement achievement2 = achievementList.get(i6); - int l6 = achievement2.displayColumn * 24 - i; - int j7 = achievement2.displayRow * 24 - j; - -@@ -432,6 +458,7 @@ - - this.mc.getTextureManager().bindTexture(ACHIEVEMENT_BACKGROUND); - -+ GlStateManager.enableBlend(); // Forge: Specifically enable blend because it is needed here. And we fix Generic RenderItem's leakage of it. - if (achievement2.getSpecial()) - { - this.drawTexturedModalRect(l6 - 2, j7 - 2, 26, 202, 26, 26); -@@ -440,6 +467,7 @@ - { - this.drawTexturedModalRect(l6 - 2, j7 - 2, 0, 202, 26, 26); - } -+ GlStateManager.disableBlend(); //Forge: Cleanup states we set. - - if (!this.statFileWriter.canUnlockAchievement(achievement2)) - { -@@ -448,7 +476,7 @@ - this.itemRender.func_175039_a(false); - } - -- GlStateManager.enableLighting(); -+ GlStateManager.disableLighting(); //Forge: Make sure Lighting is disabled. Fixes MC-33065 - GlStateManager.enableCull(); - this.itemRender.renderItemAndEffectIntoGUI(achievement2.theItemStack, l6 + 3, j7 + 3); - GlStateManager.func_187401_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch deleted file mode 100644 index 7e30615cf..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch +++ /dev/null @@ -1,70 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java -+++ ../src-work/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java -@@ -176,8 +176,11 @@ - GlStateManager.translate(0.0F, 0.0F, 32.0F); - this.zLevel = 200.0F; - this.itemRender.zLevel = 200.0F; -+ net.minecraft.client.gui.FontRenderer font = null; -+ if (stack != null) font = stack.getItem().getFontRenderer(stack); -+ if (font == null) font = fontRendererObj; - this.itemRender.renderItemAndEffectIntoGUI(stack, x, y); -- this.itemRender.renderItemOverlayIntoGUI(this.fontRendererObj, stack, x, y - (this.draggedStack == null ? 0 : 8), altText); -+ this.itemRender.renderItemOverlayIntoGUI(font, stack, x, y - (this.draggedStack == null ? 0 : 8), altText); - this.zLevel = 0.0F; - this.itemRender.zLevel = 0.0F; - } -@@ -240,13 +243,12 @@ - - if (itemstack == null && slotIn.canBeHovered()) - { -- String s1 = slotIn.getSlotTexture(); -+ TextureAtlasSprite textureatlassprite = slotIn.getBackgroundSprite(); - -- if (s1 != null) -+ if (textureatlassprite != null) - { -- TextureAtlasSprite textureatlassprite = this.mc.getTextureMapBlocks().getAtlasSprite(s1); - GlStateManager.disableLighting(); -- this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); -+ this.mc.getTextureManager().bindTexture(slotIn.getBackgroundLocation()); - this.drawTexturedModalRect(i, j, textureatlassprite, 16, 16); - GlStateManager.enableLighting(); - flag1 = true; -@@ -327,6 +329,7 @@ - int j = this.guiLeft; - int k = this.guiTop; - boolean flag1 = mouseX < j || mouseY < k || mouseX >= j + this.xSize || mouseY >= k + this.ySize; -+ if (slot != null) flag1 = false; // Forge, prevent dropping of items through slots outside of GUI boundaries - int l = -1; - - if (slot != null) -@@ -464,10 +467,12 @@ - - protected void mouseReleased(int mouseX, int mouseY, int state) - { -+ super.mouseReleased(mouseX, mouseY, state); //Forge, Call parent to release buttons - Slot slot = this.getSlotAtPosition(mouseX, mouseY); - int i = this.guiLeft; - int j = this.guiTop; - boolean flag = mouseX < i || mouseY < j || mouseX >= i + this.xSize || mouseY >= j + this.ySize; -+ if (slot != null) flag = false; // Forge, prevent dropping of items through slots outside of GUI boundaries - int k = -1; - - if (slot != null) -@@ -686,4 +691,16 @@ - this.mc.thePlayer.closeScreen(); - } - } -+ -+ /* ======================================== FORGE START =====================================*/ -+ -+ /** -+ * Returns the slot that is currently displayed under the mouse. -+ */ -+ public Slot getSlotUnderMouse() -+ { -+ return this.theSlot; -+ } -+ -+ /* ======================================== FORGE END =====================================*/ - } diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch deleted file mode 100644 index 58c34c352..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch +++ /dev/null @@ -1,256 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java -+++ ../src-work/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java -@@ -49,6 +49,8 @@ - private Slot field_147064_C; - private boolean field_147057_D; - private CreativeCrafting field_147059_E; -+ private static int tabPage = 0; -+ private int maxPages = 0; - - public GuiContainerCreative(EntityPlayer p_i1088_1_) - { -@@ -258,6 +260,13 @@ - this.setCurrentCreativeTab(CreativeTabs.creativeTabArray[i]); - this.field_147059_E = new CreativeCrafting(this.mc); - this.mc.thePlayer.inventoryContainer.onCraftGuiOpened(this.field_147059_E); -+ int tabCount = CreativeTabs.creativeTabArray.length; -+ if (tabCount > 12) -+ { -+ buttonList.add(new GuiButton(101, guiLeft, guiTop - 50, 20, 20, "<")); -+ buttonList.add(new GuiButton(102, guiLeft + xSize - 20, guiTop - 50, 20, 20, ">")); -+ maxPages = ((tabCount - 12) / 10) + 1; -+ } - } - else - { -@@ -279,7 +288,7 @@ - - protected void keyTyped(char typedChar, int keyCode) throws IOException - { -- if (selectedTabIndex != CreativeTabs.tabAllSearch.getTabIndex()) -+ if (!CreativeTabs.creativeTabArray[selectedTabIndex].hasSearchBar()) - { - if (GameSettings.isKeyDown(this.mc.gameSettings.keyBindChat)) - { -@@ -317,6 +326,14 @@ - GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots; - guicontainercreative$containercreative.itemList.clear(); - -+ CreativeTabs tab = CreativeTabs.creativeTabArray[selectedTabIndex]; -+ if (tab.hasSearchBar() && tab != CreativeTabs.tabAllSearch) -+ { -+ tab.displayAllReleventItems(guicontainercreative$containercreative.itemList); -+ updateFilteredItems(guicontainercreative$containercreative); -+ return; -+ } -+ - for (Item item : Item.itemRegistry) - { - if (item != null && item.getCreativeTab() != null) -@@ -324,7 +341,13 @@ - item.getSubItems(item, (CreativeTabs)null, guicontainercreative$containercreative.itemList); - } - } -+ updateFilteredItems(guicontainercreative$containercreative); -+ } - -+ //split from above for custom search tabs -+ private void updateFilteredItems(GuiContainerCreative.ContainerCreative guicontainercreative$containercreative) -+ { -+ if (CreativeTabs.creativeTabArray[selectedTabIndex] == CreativeTabs.tabAllSearch) // FORGE: Only add enchanted books to the regular search - for (Enchantment enchantment : Enchantment.field_185264_b) - { - if (enchantment != null && enchantment.type != null) -@@ -332,7 +355,6 @@ - Items.enchanted_book.getAll(enchantment, guicontainercreative$containercreative.itemList); - } - } -- - Iterator iterator = guicontainercreative$containercreative.itemList.iterator(); - String s1 = this.searchField.getText().toLowerCase(); - -@@ -364,7 +386,7 @@ - { - CreativeTabs creativetabs = CreativeTabs.creativeTabArray[selectedTabIndex]; - -- if (creativetabs.drawInForegroundOfTab()) -+ if (creativetabs != null && creativetabs.drawInForegroundOfTab()) - { - GlStateManager.disableBlend(); - this.fontRendererObj.drawString(I18n.format(creativetabs.getTranslatedTabLabel(), new Object[0]), 8, 6, 4210752); -@@ -399,7 +421,7 @@ - - for (CreativeTabs creativetabs : CreativeTabs.creativeTabArray) - { -- if (this.func_147049_a(creativetabs, i, j)) -+ if (creativetabs != null && this.func_147049_a(creativetabs, i, j)) - { - this.setCurrentCreativeTab(creativetabs); - return; -@@ -412,11 +434,13 @@ - - private boolean needsScrollBars() - { -+ if (CreativeTabs.creativeTabArray[selectedTabIndex] == null) return false; - return selectedTabIndex != CreativeTabs.tabInventory.getTabIndex() && CreativeTabs.creativeTabArray[selectedTabIndex].shouldHidePlayerInventory() && ((GuiContainerCreative.ContainerCreative)this.inventorySlots).func_148328_e(); - } - - private void setCurrentCreativeTab(CreativeTabs p_147050_1_) - { -+ if (p_147050_1_ == null) return; - int i = selectedTabIndex; - selectedTabIndex = p_147050_1_.getTabIndex(); - GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots; -@@ -487,12 +511,14 @@ - - if (this.searchField != null) - { -- if (p_147050_1_ == CreativeTabs.tabAllSearch) -+ if (p_147050_1_.hasSearchBar()) - { - this.searchField.setVisible(true); - this.searchField.setCanLoseFocus(false); - this.searchField.setFocused(true); - this.searchField.setText(""); -+ this.searchField.width = p_147050_1_.getSearchbarWidth(); -+ this.searchField.xPosition = this.guiLeft + (82 /*default left*/ + 89 /*default width*/) - this.searchField.width; - this.updateCreativeSearch(); - } - else -@@ -562,20 +588,43 @@ - } - - super.drawScreen(mouseX, mouseY, partialTicks); -+ int start = tabPage * 10; -+ int end = Math.min(CreativeTabs.creativeTabArray.length, ((tabPage + 1) * 10) + 2); -+ if (tabPage != 0) start += 2; -+ boolean rendered = false; - -- for (CreativeTabs creativetabs : CreativeTabs.creativeTabArray) -+ for (CreativeTabs creativetabs : java.util.Arrays.copyOfRange(CreativeTabs.creativeTabArray,start,end)) - { -+ if (creativetabs == null) continue; - if (this.renderCreativeInventoryHoveringText(creativetabs, mouseX, mouseY)) - { -+ rendered = true; - break; - } - } - -+ if (!rendered && renderCreativeInventoryHoveringText(CreativeTabs.tabAllSearch, mouseX, mouseY)) -+ { -+ renderCreativeInventoryHoveringText(CreativeTabs.tabInventory, mouseX, mouseY); -+ } -+ - if (this.field_147064_C != null && selectedTabIndex == CreativeTabs.tabInventory.getTabIndex() && this.isPointInRegion(this.field_147064_C.xDisplayPosition, this.field_147064_C.yDisplayPosition, 16, 16, mouseX, mouseY)) - { - this.drawCreativeTabHoveringText(I18n.format("inventory.binSlot", new Object[0]), mouseX, mouseY); - } - -+ if (maxPages != 0) -+ { -+ String page = String.format("%d / %d", tabPage + 1, maxPages + 1); -+ int width = fontRendererObj.getStringWidth(page); -+ GlStateManager.disableLighting(); -+ this.zLevel = 300.0F; -+ itemRender.zLevel = 300.0F; -+ fontRendererObj.drawString(page, guiLeft + (xSize / 2) - (width / 2), guiTop - 44, -1); -+ this.zLevel = 0.0F; -+ itemRender.zLevel = 0.0F; -+ } -+ - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - GlStateManager.disableLighting(); - } -@@ -637,16 +686,35 @@ - RenderHelper.enableGUIStandardItemLighting(); - CreativeTabs creativetabs = CreativeTabs.creativeTabArray[selectedTabIndex]; - -- for (CreativeTabs creativetabs1 : CreativeTabs.creativeTabArray) -+ int start = tabPage * 10; -+ int end = Math.min(CreativeTabs.creativeTabArray.length, ((tabPage + 1) * 10 + 2)); -+ if (tabPage != 0) start += 2; -+ -+ for (CreativeTabs creativetabs1 : java.util.Arrays.copyOfRange(CreativeTabs.creativeTabArray,start,end)) - { - this.mc.getTextureManager().bindTexture(creativeInventoryTabs); - -+ if (creativetabs1 == null) continue; - if (creativetabs1.getTabIndex() != selectedTabIndex) - { - this.func_147051_a(creativetabs1); - } - } - -+ if (tabPage != 0) -+ { -+ if (creativetabs != CreativeTabs.tabAllSearch) -+ { -+ this.mc.getTextureManager().bindTexture(creativeInventoryTabs); -+ func_147051_a(CreativeTabs.tabAllSearch); -+ } -+ if (creativetabs != CreativeTabs.tabInventory) -+ { -+ this.mc.getTextureManager().bindTexture(creativeInventoryTabs); -+ func_147051_a(CreativeTabs.tabInventory); -+ } -+ } -+ - this.mc.getTextureManager().bindTexture(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + creativetabs.getBackgroundImageName())); - this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize); - this.searchField.drawTextBox(); -@@ -661,6 +729,14 @@ - this.drawTexturedModalRect(i, j + (int)((float)(k - j - 17) * this.currentScroll), 232 + (this.needsScrollBars() ? 0 : 12), 0, 12, 15); - } - -+ if (creativetabs == null || creativetabs.getTabPage() != tabPage) -+ { -+ if (creativetabs != CreativeTabs.tabAllSearch && creativetabs != CreativeTabs.tabInventory) -+ { -+ return; -+ } -+ } -+ - this.func_147051_a(creativetabs); - - if (creativetabs == CreativeTabs.tabInventory) -@@ -671,6 +747,14 @@ - - protected boolean func_147049_a(CreativeTabs p_147049_1_, int p_147049_2_, int p_147049_3_) - { -+ if (p_147049_1_.getTabPage() != tabPage) -+ { -+ if (p_147049_1_ != CreativeTabs.tabAllSearch && p_147049_1_ != CreativeTabs.tabInventory) -+ { -+ return false; -+ } -+ } -+ - int i = p_147049_1_.getTabColumn(); - int j = 28 * i; - int k = 0; -@@ -767,6 +851,8 @@ - } - - GlStateManager.disableLighting(); -+ GlStateManager.color(1F, 1F, 1F); //Forge: Reset color in case Items change it. -+ GlStateManager.enableBlend(); //Forge: Make sure blend is enabled else tabs show a white border. - this.drawTexturedModalRect(l, i1, j, k, 28, j1); - this.zLevel = 100.0F; - this.itemRender.zLevel = 100.0F; -@@ -793,6 +879,15 @@ - { - this.mc.displayGuiScreen(new GuiStats(this, this.mc.thePlayer.getStatFileWriter())); - } -+ -+ if (button.id == 101) -+ { -+ tabPage = Math.max(tabPage - 1, 0); -+ } -+ else if (button.id == 102) -+ { -+ tabPage = Math.min(tabPage + 1, maxPages); -+ } - } - - public int getSelectedTabIndex() diff --git a/patches.mcp/minecraft/net/minecraft/client/model/ModelBase.java.patch b/patches.mcp/minecraft/net/minecraft/client/model/ModelBase.java.patch deleted file mode 100644 index 4f3c8aede..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/model/ModelBase.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/model/ModelBase.java -+++ ../src-work/minecraft/net/minecraft/client/model/ModelBase.java -@@ -10,7 +10,6 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --@SideOnly(Side.CLIENT) - public abstract class ModelBase - { - public float swingProgress; diff --git a/patches.mcp/minecraft/net/minecraft/client/model/ModelBox.java.patch b/patches.mcp/minecraft/net/minecraft/client/model/ModelBox.java.patch deleted file mode 100644 index 5cacc5fd4..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/model/ModelBox.java.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/model/ModelBox.java -+++ ../src-work/minecraft/net/minecraft/client/model/ModelBox.java -@@ -4,7 +4,6 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --@SideOnly(Side.CLIENT) - public class ModelBox - { - private PositionTextureVertex[] vertexPositions; -@@ -81,6 +80,7 @@ - } - } - -+ @SideOnly(Side.CLIENT) - public void render(VertexBuffer renderer, float scale) - { - for (int i = 0; i < this.quadList.length; ++i) diff --git a/patches.mcp/minecraft/net/minecraft/client/model/ModelRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/model/ModelRenderer.java.patch deleted file mode 100644 index 5e9ccffa8..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/model/ModelRenderer.java.patch +++ /dev/null @@ -1,42 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/model/ModelRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/model/ModelRenderer.java -@@ -9,7 +9,6 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --@SideOnly(Side.CLIENT) - public class ModelRenderer - { - public float textureWidth; -@@ -108,6 +107,7 @@ - this.rotationPointZ = rotationPointZIn; - } - -+ @SideOnly(Side.CLIENT) - public void render(float p_78785_1_) - { - if (!this.isHidden) -@@ -189,6 +189,7 @@ - } - } - -+ @SideOnly(Side.CLIENT) - public void renderWithRotation(float p_78791_1_) - { - if (!this.isHidden) -@@ -224,6 +225,7 @@ - } - } - -+ @SideOnly(Side.CLIENT) - public void postRender(float scale) - { - if (!this.isHidden) -@@ -265,6 +267,7 @@ - } - } - -+ @SideOnly(Side.CLIENT) - private void compileDisplayList(float scale) - { - this.displayList = GLAllocation.generateDisplayLists(1); diff --git a/patches.mcp/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch b/patches.mcp/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch deleted file mode 100644 index 1552e73aa..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/model/PositionTextureVertex.java -+++ ../src-work/minecraft/net/minecraft/client/model/PositionTextureVertex.java -@@ -1,10 +1,7 @@ - package net.minecraft.client.model; - - import net.minecraft.util.math.Vec3d; --import net.minecraftforge.fml.relauncher.Side; --import net.minecraftforge.fml.relauncher.SideOnly; - --@SideOnly(Side.CLIENT) - public class PositionTextureVertex - { - public Vec3d vector3D; diff --git a/patches.mcp/minecraft/net/minecraft/client/model/TexturedQuad.java.patch b/patches.mcp/minecraft/net/minecraft/client/model/TexturedQuad.java.patch deleted file mode 100644 index 1048fc20c..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/model/TexturedQuad.java.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/model/TexturedQuad.java -+++ ../src-work/minecraft/net/minecraft/client/model/TexturedQuad.java -@@ -7,7 +7,6 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --@SideOnly(Side.CLIENT) - public class TexturedQuad - { - public PositionTextureVertex[] vertexPositions; -@@ -43,6 +42,7 @@ - this.vertexPositions = apositiontexturevertex; - } - -+ @SideOnly(Side.CLIENT) - public void draw(VertexBuffer renderer, float scale) - { - Vec3d vec3d = this.vertexPositions[1].vector3D.subtractReverse(this.vertexPositions[0].vector3D); diff --git a/patches.mcp/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch b/patches.mcp/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch deleted file mode 100644 index 2fbae2903..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java -+++ ../src-work/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java -@@ -52,6 +52,7 @@ - Chunk chunk = new Chunk(this.worldObj, p_73158_1_, p_73158_2_); - this.chunkMapping.add(ChunkCoordIntPair.chunkXZ2Int(p_73158_1_, p_73158_2_), chunk); - this.chunkListing.add(chunk); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Load(chunk)); - chunk.setChunkLoaded(true); - return chunk; - } diff --git a/patches.mcp/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch b/patches.mcp/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch deleted file mode 100644 index 8a4f63a24..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java -+++ ../src-work/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java -@@ -67,7 +67,7 @@ - inetaddress = InetAddress.getByName(ip); - GuiConnecting.this.networkManager = NetworkManager.func_181124_a(inetaddress, port, GuiConnecting.this.mc.gameSettings.func_181148_f()); - GuiConnecting.this.networkManager.setNetHandler(new NetHandlerLoginClient(GuiConnecting.this.networkManager, GuiConnecting.this.mc, GuiConnecting.this.previousGuiScreen)); -- GuiConnecting.this.networkManager.sendPacket(new C00Handshake(107, ip, port, EnumConnectionState.LOGIN)); -+ GuiConnecting.this.networkManager.sendPacket(new C00Handshake(107, ip, port, EnumConnectionState.LOGIN, true)); - GuiConnecting.this.networkManager.sendPacket(new CPacketLoginStart(GuiConnecting.this.mc.getSession().getProfile())); - } - catch (UnknownHostException unknownhostexception) diff --git a/patches.mcp/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch b/patches.mcp/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch deleted file mode 100644 index f19ab2b40..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch +++ /dev/null @@ -1,93 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java -+++ ../src-work/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java -@@ -121,6 +121,12 @@ - } - } - -+ ItemStack stack = mc.thePlayer.func_184614_ca(); -+ if (stack != null && stack.getItem() != null && stack.getItem().onBlockStartBreak(stack, p_187103_1_, mc.thePlayer)) -+ { -+ return false; -+ } -+ - if (this.currentGameType.isCreative() && this.mc.thePlayer.func_184614_ca() != null && this.mc.thePlayer.func_184614_ca().getItem() instanceof ItemSword) - { - return false; -@@ -142,14 +148,7 @@ - else - { - world.playAuxSFX(2001, p_187103_1_, Block.getStateId(iblockstate)); -- block.onBlockHarvested(world, p_187103_1_, iblockstate, this.mc.thePlayer); -- boolean flag = world.setBlockState(p_187103_1_, Blocks.air.getDefaultState(), 11); - -- if (flag) -- { -- block.onBlockDestroyedByPlayer(world, p_187103_1_, iblockstate); -- } -- - this.currentBlock = new BlockPos(this.currentBlock.getX(), -1, this.currentBlock.getZ()); - - if (!this.currentGameType.isCreative()) -@@ -160,13 +159,20 @@ - { - itemstack1.onBlockDestroyed(world, iblockstate, p_187103_1_, this.mc.thePlayer); - -- if (itemstack1.stackSize == 0) -+ if (itemstack1.stackSize <= 0) - { -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.mc.thePlayer, itemstack1, EnumHand.MAIN_HAND); - this.mc.thePlayer.func_184611_a(EnumHand.MAIN_HAND, (ItemStack)null); - } - } - } - -+ boolean flag = block.removedByPlayer(iblockstate, world, p_187103_1_, mc.thePlayer, false); -+ -+ if (flag) -+ { -+ block.onBlockDestroyedByPlayer(world, p_187103_1_, iblockstate); -+ } - return flag; - } - } -@@ -373,11 +379,15 @@ - { - if (this.currentGameType != WorldSettings.GameType.SPECTATOR) - { -+ net.minecraft.item.Item item = p_187099_3_ == null ? null : p_187099_3_.getItem(); -+ EnumActionResult ret = item == null ? EnumActionResult.PASS : item.onItemUseFirst(p_187099_3_, p_187099_1_, p_187099_2_, p_187099_4_, p_187099_5_, f, f1, f2, p_187099_7_); -+ if (ret != EnumActionResult.PASS) return ret; -+ - IBlockState iblockstate = p_187099_2_.getBlockState(p_187099_4_); - -- if ((!p_187099_1_.isSneaking() || p_187099_1_.func_184614_ca() == null && p_187099_1_.func_184592_cb() == null) && iblockstate.getBlock().onBlockActivated(p_187099_2_, p_187099_4_, iblockstate, p_187099_1_, p_187099_7_, p_187099_3_, p_187099_5_, f, f1, f2)) -+ if ((!p_187099_1_.isSneaking() || (p_187099_1_.func_184614_ca() == null || item.doesSneakBypassUse(p_187099_3_, p_187099_2_, p_187099_4_, p_187099_1_)) && p_187099_1_.func_184592_cb() == null)) - { -- flag = true; -+ flag = iblockstate.getBlock().onBlockActivated(p_187099_2_, p_187099_4_, iblockstate, p_187099_1_, p_187099_7_, p_187099_3_, p_187099_5_, f, f1, f2); - } - - if (!flag && p_187099_3_ != null && p_187099_3_.getItem() instanceof ItemBlock) -@@ -418,7 +428,9 @@ - } - else - { -- return p_187099_3_.onItemUse(p_187099_1_, p_187099_2_, p_187099_4_, p_187099_7_, p_187099_5_, f, f1, f2); -+ EnumActionResult ret = p_187099_3_.onItemUse(p_187099_1_, p_187099_2_, p_187099_4_, p_187099_7_, p_187099_5_, f, f1, f2); -+ if (p_187099_3_.stackSize <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_187099_1_, p_187099_3_, p_187099_7_); -+ return ret; - } - } - else -@@ -453,9 +465,10 @@ - { - p_187101_1_.func_184611_a(p_187101_4_, itemstack); - -- if (itemstack.stackSize == 0) -+ if (itemstack.stackSize <= 0) - { - p_187101_1_.func_184611_a(p_187101_4_, (ItemStack)null); -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_187101_1_, itemstack, p_187101_4_); - } - } - diff --git a/patches.mcp/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch b/patches.mcp/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch deleted file mode 100644 index 2d73af707..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/multiplayer/WorldClient.java -+++ ../src-work/minecraft/net/minecraft/client/multiplayer/WorldClient.java -@@ -63,12 +63,13 @@ - this.field_184157_a = Sets.newHashSet(); - this.sendQueue = p_i45063_1_; - this.getWorldInfo().setDifficulty(p_i45063_4_); -- this.setSpawnPoint(new BlockPos(8, 64, 8)); - this.provider.registerWorld(this); -+ this.setSpawnPoint(new BlockPos(8, 64, 8)); //Forge: Moved below registerWorld to prevent NPE in our redirect. - this.chunkProvider = this.createChunkProvider(); - this.mapStorage = new SaveDataMemoryStorage(); - this.calculateInitialSkylight(); - this.calculateInitialWeather(); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(this)); - } - - public void tick() diff --git a/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch b/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch deleted file mode 100644 index e1acbc07d..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java -+++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java -@@ -23,6 +23,7 @@ - - public void processHandshake(C00Handshake packetIn) - { -+ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerHandshake(packetIn, this.networkManager)) return; - this.networkManager.setConnectionState(packetIn.getRequestedState()); - this.networkManager.setNetHandler(new NetHandlerLoginServer(this.mcServer, this.networkManager)); - } diff --git a/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch b/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch deleted file mode 100644 index 2aff2e5ca..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java -+++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java -@@ -106,7 +106,10 @@ - { - this.gameProfile = packetIn.getProfile(); - this.networkManager.setConnectionState(EnumConnectionState.PLAY); -- this.networkManager.setNetHandler(new NetHandlerPlayClient(this.mc, this.previousGuiScreen, this.networkManager, this.gameProfile)); -+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlClientHandshake(this.networkManager); -+ NetHandlerPlayClient nhpc = new NetHandlerPlayClient(this.mc, this.previousGuiScreen, this.networkManager, this.gameProfile); -+ this.networkManager.setNetHandler(nhpc); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().setPlayClient(nhpc); - } - - public void onDisconnect(ITextComponent reason) diff --git a/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch b/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch deleted file mode 100644 index fcb57fff8..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch +++ /dev/null @@ -1,62 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java -+++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java -@@ -267,7 +267,7 @@ - { - PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); - this.gameController.playerController = new PlayerControllerMP(this.gameController, this); -- this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), packetIn.getDimension(), packetIn.getDifficulty(), this.gameController.mcProfiler); -+ this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.get(getNetworkManager()).getOverrideDimension(packetIn), packetIn.getDifficulty(), this.gameController.mcProfiler); - this.gameController.gameSettings.difficulty = packetIn.getDifficulty(); - this.gameController.loadWorld(this.clientWorldController); - this.gameController.thePlayer.dimension = packetIn.getDimension(); -@@ -785,14 +785,16 @@ - public void handleChat(SPacketChat packetIn) - { - PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); -+ net.minecraft.util.text.ITextComponent message = net.minecraftforge.event.ForgeEventFactory.onClientChat(packetIn.getType(), packetIn.getChatComponent()); -+ if (message == null) return; - - if (packetIn.getType() == 2) - { -- this.gameController.ingameGUI.setRecordPlaying(packetIn.getChatComponent(), false); -+ this.gameController.ingameGUI.setRecordPlaying(message, false); - } - else - { -- this.gameController.ingameGUI.getChatGUI().printChatMessage(packetIn.getChatComponent()); -+ this.gameController.ingameGUI.getChatGUI().printChatMessage(message); - } - } - -@@ -848,6 +850,11 @@ - float f = (float)(packetIn.getYaw() * 360) / 256.0F; - float f1 = (float)(packetIn.getPitch() * 360) / 256.0F; - EntityLivingBase entitylivingbase = (EntityLivingBase)EntityList.createEntityByID(packetIn.getEntityType(), this.gameController.theWorld); -+ if (entitylivingbase == null) -+ { -+ net.minecraftforge.fml.common.FMLLog.info("Server attempted to spawn an unknown entity using ID: {0} at ({1}, {2}, {3}) Skipping!", packetIn.getEntityType(), d0, d1, d2); -+ return; -+ } - EntityTracker.func_187254_a(entitylivingbase, d0, d1, d2); - entitylivingbase.renderYawOffset = entitylivingbase.rotationYawHead = (float)(packetIn.getHeadPitch() * 360) / 256.0F; - Entity[] aentity = entitylivingbase.getParts(); -@@ -1179,6 +1186,10 @@ - { - tileentity.readFromNBT(packetIn.getNbtCompound()); - } -+ else -+ { -+ tileentity.onDataPacket(netManager, packetIn); -+ } - - if (flag && this.gameController.currentScreen instanceof GuiCommandBlock) - { -@@ -1378,7 +1389,7 @@ - - if (entity instanceof EntityLivingBase) - { -- Potion potion = Potion.func_188412_a(packetIn.getEffectId()); -+ Potion potion = Potion.func_188412_a(packetIn.getEffectId() & 0xFF); - - if (potion != null) - { diff --git a/patches.mcp/minecraft/net/minecraft/client/network/ServerPinger.java.patch b/patches.mcp/minecraft/net/minecraft/client/network/ServerPinger.java.patch deleted file mode 100644 index 932389231..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/network/ServerPinger.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/network/ServerPinger.java -+++ ../src-work/minecraft/net/minecraft/client/network/ServerPinger.java -@@ -150,6 +150,7 @@ - server.setBase64EncodedIconData((String)null); - } - -+ net.minecraftforge.fml.client.FMLClientHandler.instance().bindServerListData(server, serverstatusresponse); - this.field_175092_e = Minecraft.getSystemTime(); - networkmanager.sendPacket(new CPacketPing(this.field_175092_e)); - this.field_147403_d = true; diff --git a/patches.mcp/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch deleted file mode 100644 index b41676c70..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/particle/EffectRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/particle/EffectRenderer.java -@@ -3,6 +3,9 @@ - import com.google.common.collect.Lists; - import com.google.common.collect.Maps; - import com.google.common.collect.Queues; -+ -+import akka.actor.FSM.State; -+ - import java.util.ArrayDeque; - import java.util.Iterator; - import java.util.List; -@@ -143,6 +146,7 @@ - - public void addEffect(EntityFX effect) - { -+ if (effect == null) return; //Forge: Prevent modders from being bad and adding nulls causing untraceable NPEs. - this.field_187241_h.add(effect); - } - -@@ -376,7 +380,7 @@ - - public void addBlockDestroyEffects(BlockPos pos, IBlockState state) - { -- if (state.func_185904_a() != Material.air) -+ if (state.getBlock().isAir(state, worldObj, pos) && !state.getBlock().addDestroyEffects(worldObj, pos, this)) - { - state = state.func_185899_b(this.worldObj, pos); - int i = 4; -@@ -460,4 +464,13 @@ - - return "" + i; - } -+ -+ public void addBlockHitEffects(BlockPos pos, net.minecraft.util.math.RayTraceResult target) -+ { -+ IBlockState state = worldObj.getBlockState(pos); -+ if (state != null && !state.getBlock().addHitEffects(state, worldObj, target, this)) -+ { -+ addBlockHitEffects(pos, target.sideHit); -+ } -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch deleted file mode 100644 index 6ff9d53b7..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch +++ /dev/null @@ -1,9 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/BlockModelShapes.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/BlockModelShapes.java -@@ -307,5 +307,6 @@ - return new ModelResourceLocation(s + "_double_slab", s1); - } - }); -+ net.minecraftforge.client.model.ModelLoader.onRegisterAllBlocks(this); - } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch deleted file mode 100644 index 527de782e..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java -@@ -29,7 +29,7 @@ - public BlockRendererDispatcher(BlockModelShapes p_i46577_1_, BlockColors p_i46577_2_) - { - this.blockModelShapes = p_i46577_1_; -- this.blockModelRenderer = new BlockModelRenderer(p_i46577_2_); -+ this.blockModelRenderer = new net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer(p_i46577_2_); - this.fluidRenderer = new BlockFluidRenderer(p_i46577_2_); - } - -@@ -44,7 +44,7 @@ - { - state = state.func_185899_b(blockAccess, pos); - IBakedModel ibakedmodel = this.blockModelShapes.getModelForState(state); -- IBakedModel ibakedmodel1 = (new SimpleBakedModel.Builder(state, ibakedmodel, texture, pos)).makeBakedModel(); -+ IBakedModel ibakedmodel1 = net.minecraftforge.client.ForgeHooksClient.getDamageModel(ibakedmodel, texture, state, blockAccess, pos); - this.blockModelRenderer.renderModel(blockAccess, ibakedmodel1, state, pos, Tessellator.getInstance().getWorldRenderer(), true); - } - } -@@ -76,7 +76,9 @@ - switch (enumblockrendertype) - { - case MODEL: -- return this.blockModelRenderer.renderModel(blockAccess, this.func_184389_a(state), state, pos, worldRendererIn, true); -+ IBakedModel model = this.func_184389_a(state); -+ state = state.getBlock().getExtendedState(state, blockAccess, pos); -+ return this.blockModelRenderer.renderModel(blockAccess, model, state, pos, worldRendererIn, true); - case ENTITYBLOCK_ANIMATED: - return false; - case LIQUID: diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch deleted file mode 100644 index d19583066..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch +++ /dev/null @@ -1,191 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/EntityRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/EntityRenderer.java -@@ -207,6 +207,7 @@ - { - this.loadShader(new ResourceLocation("shaders/post/invert.json")); - } -+ else net.minecraftforge.client.ForgeHooksClient.loadEntityShader(entityIn, this); - } - } - -@@ -398,7 +399,7 @@ - - if (d3 < d2 || d2 == 0.0D) - { -- if (entity1.func_184208_bv() == entity.func_184208_bv()) -+ if (entity1.func_184208_bv() == entity.func_184208_bv() && !entity.canRiderInteract()) - { - if (d2 == 0.0D) - { -@@ -491,7 +492,7 @@ - f = f * 60.0F / 70.0F; - } - -- return f; -+ return net.minecraftforge.client.ForgeHooksClient.getFOVModifier(this, entity, iblockstate, partialTicks, f); - } - } - -@@ -555,14 +556,8 @@ - { - BlockPos blockpos = new BlockPos(entity); - IBlockState iblockstate = this.mc.theWorld.getBlockState(blockpos); -- Block block = iblockstate.getBlock(); -+ net.minecraftforge.client.ForgeHooksClient.orientBedCamera(this.mc.theWorld, blockpos, iblockstate, entity); - -- if (block == Blocks.bed) -- { -- int j = ((EnumFacing)iblockstate.getValue(BlockBed.field_185512_D)).getHorizontalIndex(); -- GlStateManager.rotate((float)(j * 90), 0.0F, 1.0F, 0.0F); -- } -- - GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks + 180.0F, 0.0F, -1.0F, 0.0F); - GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, -1.0F, 0.0F, 0.0F); - } -@@ -629,17 +624,20 @@ - - if (!this.mc.gameSettings.debugCamEnable) - { -- GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, 1.0F, 0.0F, 0.0F); -- -+ float yaw = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks + 180.0F; -+ float pitch = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks; -+ float roll = 0.0F; - if (entity instanceof EntityAnimal) - { - EntityAnimal entityanimal = (EntityAnimal)entity; -- GlStateManager.rotate(entityanimal.prevRotationYawHead + (entityanimal.rotationYawHead - entityanimal.prevRotationYawHead) * partialTicks + 180.0F, 0.0F, 1.0F, 0.0F); -+ yaw = entityanimal.prevRotationYawHead + (entityanimal.rotationYawHead - entityanimal.prevRotationYawHead) * partialTicks + 180.0F; - } -- else -- { -- GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks + 180.0F, 0.0F, 1.0F, 0.0F); -- } -+ IBlockState state = ActiveRenderInfo.func_186703_a(this.mc.theWorld, entity, partialTicks); -+ net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup event = new net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup(this, entity, state, partialTicks, yaw, pitch, roll); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ GlStateManager.rotate(event.roll, 0.0F, 0.0F, 1.0F); -+ GlStateManager.rotate(event.pitch, 1.0F, 0.0F, 0.0F); -+ GlStateManager.rotate(event.yaw, 0.0F, 1.0F, 0.0F); - } - - GlStateManager.translate(0.0F, -f, 0.0F); -@@ -757,6 +755,7 @@ - - boolean flag = this.mc.getRenderViewEntity() instanceof EntityLivingBase && ((EntityLivingBase)this.mc.getRenderViewEntity()).isPlayerSleeping(); - -+ if (!net.minecraftforge.client.ForgeHooksClient.renderFirstPersonHand(mc.renderGlobal, partialTicks, xOffset)) - if (this.mc.gameSettings.thirdPersonView == 0 && !flag && !this.mc.gameSettings.hideGUI && !this.mc.playerController.isSpectator()) - { - this.enableLightmap(); -@@ -1092,7 +1091,7 @@ - - try - { -- this.mc.currentScreen.drawScreen(k1, l1, p_181560_1_); -+ net.minecraftforge.client.ForgeHooksClient.drawScreen(this.mc.currentScreen, k1, l1, p_181560_1_); - } - catch (Throwable throwable) - { -@@ -1187,7 +1186,7 @@ - - if (this.mc.playerController.getCurrentGameType() == WorldSettings.GameType.SPECTATOR) - { -- flag = block.hasTileEntity() && this.mc.theWorld.getTileEntity(blockpos) instanceof IInventory; -+ flag = block.hasTileEntity(this.mc.theWorld.getBlockState(blockpos)) && this.mc.theWorld.getTileEntity(blockpos) instanceof IInventory; - } - else - { -@@ -1312,7 +1311,9 @@ - GlStateManager.pushMatrix(); - RenderHelper.enableStandardItemLighting(); - this.mc.mcProfiler.endStartSection("entities"); -+ net.minecraftforge.client.ForgeHooksClient.setRenderPass(0); - renderglobal.renderEntities(entity, icamera, partialTicks); -+ net.minecraftforge.client.ForgeHooksClient.setRenderPass(0); - RenderHelper.disableStandardItemLighting(); - this.disableLightmap(); - } -@@ -1325,6 +1326,7 @@ - EntityPlayer entityplayer = (EntityPlayer)entity; - GlStateManager.disableAlpha(); - this.mc.mcProfiler.endStartSection("outline"); -+ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer, mc.objectMouseOver, 0, partialTicks)) - renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, partialTicks); - GlStateManager.enableAlpha(); - } -@@ -1366,6 +1368,17 @@ - GlStateManager.shadeModel(7425); - this.mc.mcProfiler.endStartSection("translucent"); - renderglobal.renderBlockLayer(BlockRenderLayer.TRANSLUCENT, (double)partialTicks, pass, entity); -+ if (!this.debugView) //Only render if render pass 0 happens as well. -+ { -+ RenderHelper.enableStandardItemLighting(); -+ this.mc.mcProfiler.endStartSection("entities"); -+ net.minecraftforge.client.ForgeHooksClient.setRenderPass(1); -+ renderglobal.renderEntities(entity, icamera, partialTicks); -+ // restore blending function changed by RenderGlobal.preRenderDamagedBlocks -+ GlStateManager.func_187428_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); -+ net.minecraftforge.client.ForgeHooksClient.setRenderPass(-1); -+ RenderHelper.disableStandardItemLighting(); -+ } - GlStateManager.shadeModel(7424); - GlStateManager.depthMask(true); - GlStateManager.enableCull(); -@@ -1378,6 +1391,9 @@ - this.renderCloudsCheck(renderglobal, partialTicks, pass); - } - -+ this.mc.mcProfiler.endStartSection("forge_render_last"); -+ net.minecraftforge.client.ForgeHooksClient.dispatchRenderLast(renderglobal, partialTicks); -+ - this.mc.mcProfiler.endStartSection("hand"); - - if (this.renderHand) -@@ -1490,6 +1506,13 @@ - - protected void renderRainSnow(float partialTicks) - { -+ net.minecraftforge.client.IRenderHandler renderer = this.mc.theWorld.provider.getWeatherRenderer(); -+ if (renderer != null) -+ { -+ renderer.render(partialTicks, this.mc.theWorld, mc); -+ return; -+ } -+ - float f = this.mc.theWorld.getRainStrength(partialTicks); - - if (f > 0.0F) -@@ -1820,6 +1843,13 @@ - this.fogColorBlue = f7; - } - -+ net.minecraftforge.client.event.EntityViewRenderEvent.FogColors event = new net.minecraftforge.client.event.EntityViewRenderEvent.FogColors(this, entity, iblockstate, partialTicks, this.fogColorRed, this.fogColorGreen, this.fogColorBlue); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ -+ this.fogColorRed = event.red; -+ this.fogColorGreen = event.green; -+ this.fogColorBlue = event.blue; -+ - GlStateManager.clearColor(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 0.0F); - } - -@@ -1830,7 +1860,9 @@ - GlStateManager.func_187432_a(0.0F, -1.0F, 0.0F); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - IBlockState iblockstate = ActiveRenderInfo.func_186703_a(this.mc.theWorld, entity, partialTicks); -- -+ float hook = net.minecraftforge.client.ForgeHooksClient.getFogDensity(this, entity, iblockstate, partialTicks, 0.1F); -+ if (hook >= 0) GlStateManager.setFogDensity(hook); -+ else - if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(MobEffects.blindness)) - { - float f1 = 5.0F; -@@ -1915,6 +1947,7 @@ - GlStateManager.setFogStart(f * 0.05F); - GlStateManager.setFogEnd(Math.min(f, 192.0F) * 0.5F); - } -+ net.minecraftforge.client.ForgeHooksClient.onFogRender(this, entity, iblockstate, partialTicks, p_78468_1_, f); - } - - GlStateManager.enableColorMaterial(); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch deleted file mode 100644 index 2ac9eee59..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java -@@ -28,7 +28,12 @@ - - protected void updateActivePotionEffects() - { -- if (!this.mc.thePlayer.getActivePotionEffects().isEmpty()) -+ boolean hasVisibleEffect = false; -+ for(PotionEffect potioneffect : this.mc.thePlayer.getActivePotionEffects()) { -+ Potion potion = potioneffect.func_188419_a(); -+ if(potion.shouldRender(potioneffect)) { hasVisibleEffect = true; break; } -+ } -+ if (!this.mc.thePlayer.getActivePotionEffects().isEmpty() && hasVisibleEffect) - { - this.guiLeft = 160 + (this.width - this.xSize - 200) / 2; - this.hasActivePotionEffects = true; -@@ -71,6 +76,7 @@ - for (PotionEffect potioneffect : Ordering.natural().sortedCopy(collection)) - { - Potion potion = potioneffect.func_188419_a(); -+ if(!potion.shouldRender(potioneffect)) continue; - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.getTextureManager().bindTexture(inventoryBackground); - this.drawTexturedModalRect(i, j, 0, 166, 140, 32); -@@ -81,6 +87,8 @@ - this.drawTexturedModalRect(i + 6, j + 7, 0 + i1 % 8 * 18, 198 + i1 / 8 * 18, 18, 18); - } - -+ potion.renderInventoryEffect(i, j, potioneffect, mc); -+ if (!potion.shouldRenderInvText(potioneffect)) { j += l; continue; } - String s1 = I18n.format(potion.getName(), new Object[0]); - - if (potioneffect.getAmplifier() == 1) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch deleted file mode 100644 index 2870d8d28..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/ItemModelMesher.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/ItemModelMesher.java -@@ -32,7 +32,9 @@ - - public TextureAtlasSprite getParticleIcon(Item item, int meta) - { -- return this.getItemModel(new ItemStack(item, 1, meta)).getParticleTexture(); -+ ItemStack stack = new ItemStack(item, 1, meta); -+ IBakedModel model = this.getItemModel(stack); -+ return model.func_188617_f().handleItemState(model, stack, null, null).getParticleTexture(); - } - - public IBakedModel getItemModel(ItemStack stack) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch deleted file mode 100644 index ec372f4e7..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch +++ /dev/null @@ -1,58 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/ItemRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/ItemRenderer.java -@@ -360,7 +360,7 @@ - this.func_187456_a(p_187457_7_, p_187457_5_, enumhandside); - } - } -- else if (p_187457_6_.getItem() == Items.filled_map) -+ else if (p_187457_6_.getItem() instanceof net.minecraft.item.ItemMap) - { - if (flag && this.field_187468_e == null) - { -@@ -444,6 +444,7 @@ - if (this.mc.thePlayer.isEntityInsideOpaqueBlock()) - { - IBlockState iblockstate = this.mc.theWorld.getBlockState(new BlockPos(this.mc.thePlayer)); -+ BlockPos overlayPos = new BlockPos(this.mc.thePlayer); - EntityPlayer entityplayer = this.mc.thePlayer; - - for (int i = 0; i < 8; ++i) -@@ -457,11 +458,13 @@ - if (iblockstate1.getBlock().isVisuallyOpaque()) - { - iblockstate = iblockstate1; -+ overlayPos = blockpos; - } - } - - if (iblockstate.func_185901_i() != EnumBlockRenderType.INVISIBLE) - { -+ if (!net.minecraftforge.event.ForgeEventFactory.renderBlockOverlay(mc.thePlayer, partialTicks, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.BLOCK, iblockstate, overlayPos)) - this.func_178108_a(partialTicks, this.mc.getBlockRendererDispatcher().getBlockModelShapes().getTexture(iblockstate)); - } - } -@@ -470,11 +473,13 @@ - { - if (this.mc.thePlayer.isInsideOfMaterial(Material.water)) - { -+ if (!net.minecraftforge.event.ForgeEventFactory.renderWaterOverlay(mc.thePlayer, partialTicks)) - this.renderWaterOverlayTexture(partialTicks); - } - - if (this.mc.thePlayer.isBurning()) - { -+ if (!net.minecraftforge.event.ForgeEventFactory.renderFireOverlay(mc.thePlayer, partialTicks)) - this.renderFireInFirstPerson(partialTicks); - } - } -@@ -596,8 +601,8 @@ - else - { - float f = entityplayersp.func_184825_o(1.0F); -- this.field_187469_f += MathHelper.clamp_float((Objects.equal(this.field_187467_d, itemstack) ? f * f * f : 0.0F) - this.field_187469_f, -0.4F, 0.4F); -- this.field_187471_h += MathHelper.clamp_float((float)(Objects.equal(this.field_187468_e, itemstack1) ? 1 : 0) - this.field_187471_h, -0.4F, 0.4F); -+ this.field_187469_f += MathHelper.clamp_float((net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.field_187467_d, itemstack, entityplayersp.inventory.currentItem) ? f * f * f : 0.0F) - this.field_187469_f, -0.4F, 0.4F); -+ this.field_187471_h += MathHelper.clamp_float((float)(net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.field_187468_e, itemstack1, -1) ? 1 : 0) - this.field_187471_h, -0.4F, 0.4F); - } - - if (this.field_187469_f < 0.1F) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch deleted file mode 100644 index 4dddb2648..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/OpenGlHelper.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/OpenGlHelper.java -@@ -92,6 +92,10 @@ - public static int GL_ARRAY_BUFFER; - public static int GL_STATIC_DRAW; - -+ /* Stores the last values sent into setLightmapTextureCoords */ -+ public static float lastBrightnessX = 0.0f; -+ public static float lastBrightnessY = 0.0f; -+ - public static void initializeTextures() - { - ContextCapabilities contextcapabilities = GLContext.getCapabilities(); -@@ -852,6 +856,12 @@ - { - GL13.glMultiTexCoord2f(target, p_77475_1_, p_77475_2_); - } -+ -+ if (target == lightmapTexUnit) -+ { -+ lastBrightnessX = p_77475_1_; -+ lastBrightnessY = p_77475_2_; -+ } - } - - public static void glBlendFunc(int sFactorRGB, int dFactorRGB, int sfactorAlpha, int dfactorAlpha) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch deleted file mode 100644 index ed75c81f4..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch +++ /dev/null @@ -1,127 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/RenderGlobal.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/RenderGlobal.java -@@ -547,8 +547,10 @@ - - public void renderEntities(Entity renderViewEntity, ICamera camera, float partialTicks) - { -+ int pass = net.minecraftforge.client.MinecraftForgeClient.getRenderPass(); - if (this.renderEntitiesStartupCounter > 0) - { -+ if (pass > 0) return; - --this.renderEntitiesStartupCounter; - } - else -@@ -559,9 +561,12 @@ - this.theWorld.theProfiler.startSection("prepare"); - TileEntityRendererDispatcher.instance.cacheActiveRenderInfo(this.theWorld, this.mc.getTextureManager(), this.mc.fontRendererObj, this.mc.getRenderViewEntity(), partialTicks); - this.renderManager.cacheActiveRenderInfo(this.theWorld, this.mc.fontRendererObj, this.mc.getRenderViewEntity(), this.mc.pointedEntity, this.mc.gameSettings, partialTicks); -+ if(pass == 0) -+ { - this.countEntitiesTotal = 0; - this.countEntitiesRendered = 0; - this.countEntitiesHidden = 0; -+ } - Entity entity = this.mc.getRenderViewEntity(); - double d3 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks; - double d4 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks; -@@ -573,11 +578,15 @@ - this.mc.entityRenderer.enableLightmap(); - this.theWorld.theProfiler.endStartSection("global"); - List list = this.theWorld.getLoadedEntityList(); -+ if (pass == 0) -+ { - this.countEntitiesTotal = list.size(); -+ } - - for (int i = 0; i < this.theWorld.weatherEffects.size(); ++i) - { - Entity entity1 = (Entity)this.theWorld.weatherEffects.get(i); -+ if (!entity1.shouldRenderInPass(pass)) continue; - ++this.countEntitiesRendered; - - if (entity1.isInRangeToRender3d(d0, d1, d2)) -@@ -599,6 +608,7 @@ - { - for (Entity entity2 : classinheritancemultimap) - { -+ if(!entity2.shouldRenderInPass(pass)) continue; - boolean flag = this.renderManager.shouldRender(entity2, camera, d0, d1, d2) || entity2.func_184215_y(this.mc.thePlayer); - - if (flag) -@@ -672,6 +682,7 @@ - this.theWorld.theProfiler.endStartSection("blockentities"); - RenderHelper.enableStandardItemLighting(); - -+ TileEntityRendererDispatcher.instance.preDrawBatch(); - for (RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation1 : this.renderInfos) - { - List list3 = renderglobal$containerlocalrenderinformation1.renderChunk.getCompiledChunk().getTileEntities(); -@@ -680,6 +691,7 @@ - { - for (TileEntity tileentity2 : list3) - { -+ if (!tileentity2.shouldRenderInPass(pass) || !camera.isBoundingBoxInFrustum(tileentity2.getRenderBoundingBox())) continue; - TileEntityRendererDispatcher.instance.renderTileEntity(tileentity2, partialTicks, -1); - } - } -@@ -689,9 +701,11 @@ - { - for (TileEntity tileentity : this.setTileEntities) - { -+ if (!tileentity.shouldRenderInPass(pass) || !camera.isBoundingBoxInFrustum(tileentity.getRenderBoundingBox())) continue; - TileEntityRendererDispatcher.instance.renderTileEntity(tileentity, partialTicks, -1); - } - } -+ TileEntityRendererDispatcher.instance.drawBatch(pass); - - this.preRenderDamagedBlocks(); - -@@ -718,7 +732,7 @@ - - Block block = this.theWorld.getBlockState(blockpos).getBlock(); - -- if (tileentity1 != null && (block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull)) -+ if (tileentity1 != null && tileentity1.shouldRenderInPass(pass) && tileentity1.canRenderBreaking() && camera.isBoundingBoxInFrustum(tileentity1.getRenderBoundingBox())) - { - TileEntityRendererDispatcher.instance.renderTileEntity(tileentity1, partialTicks, destroyblockprogress.getPartialBlockDamage()); - } -@@ -1210,6 +1224,13 @@ - - public void renderSky(float partialTicks, int pass) - { -+ net.minecraftforge.client.IRenderHandler renderer = this.theWorld.provider.getSkyRenderer(); -+ if (renderer != null) -+ { -+ renderer.render(partialTicks, theWorld, mc); -+ return; -+ } -+ - if (this.mc.theWorld.provider.func_186058_p().func_186068_a() == 1) - { - this.renderSkyEnd(); -@@ -1427,6 +1448,12 @@ - - public void renderClouds(float partialTicks, int pass) - { -+ net.minecraftforge.client.IRenderHandler renderer = this.mc.theWorld.provider.getCloudRenderer(); -+ if (renderer != null) -+ { -+ renderer.render(partialTicks, this.mc.theWorld, mc); -+ return; -+ } - if (this.mc.theWorld.provider.isSurfaceWorld()) - { - if (this.mc.gameSettings.func_181147_e() == 2) -@@ -1854,8 +1881,11 @@ - double d4 = (double)blockpos.getY() - d1; - double d5 = (double)blockpos.getZ() - d2; - Block block = this.theWorld.getBlockState(blockpos).getBlock(); -+ TileEntity te = this.theWorld.getTileEntity(blockpos); -+ boolean hasBreak = block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull; -+ if (!hasBreak) hasBreak = te != null && te.canRenderBreaking(); - -- if (!(block instanceof BlockChest) && !(block instanceof BlockEnderChest) && !(block instanceof BlockSign) && !(block instanceof BlockSkull)) -+ if (!hasBreak) - { - if (d3 * d3 + d4 * d4 + d5 * d5 > 1024.0D) - { diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/RenderItem.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/RenderItem.java.patch deleted file mode 100644 index 4b085ab17..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/RenderItem.java.patch +++ /dev/null @@ -1,97 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/RenderItem.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/RenderItem.java -@@ -71,7 +71,7 @@ - public RenderItem(TextureManager p_i46552_1_, ModelManager p_i46552_2_, ItemColors p_i46552_3_) - { - this.textureManager = p_i46552_1_; -- this.itemModelMesher = new ItemModelMesher(p_i46552_2_); -+ this.itemModelMesher = new net.minecraftforge.client.ItemModelMesherForge(p_i46552_2_); - this.registerItems(); - this.field_184395_f = p_i46552_3_; - } -@@ -223,7 +223,7 @@ - k = k | -16777216; - } - -- this.renderQuad(renderer, bakedquad, k); -+ net.minecraftforge.client.model.pipeline.LightUtil.renderQuadColor(renderer, bakedquad, k); - } - } - -@@ -245,17 +245,7 @@ - public IBakedModel func_184393_a(ItemStack p_184393_1_, World p_184393_2_, EntityLivingBase p_184393_3_) - { - IBakedModel ibakedmodel = this.itemModelMesher.getItemModel(p_184393_1_); -- Item item = p_184393_1_.getItem(); -- -- if (item != null && item.func_185040_i()) -- { -- ResourceLocation resourcelocation = ibakedmodel.func_188617_f().func_188021_a(p_184393_1_, p_184393_2_, p_184393_3_); -- return resourcelocation == null ? ibakedmodel : this.itemModelMesher.getModelManager().getModel(new ModelResourceLocation(resourcelocation, "inventory")); -- } -- else -- { -- return ibakedmodel; -- } -+ return ibakedmodel.func_188617_f().handleItemState(ibakedmodel, p_184393_1_, p_184393_2_, p_184393_3_); - } - - public void func_184392_a(ItemStack p_184392_1_, EntityLivingBase p_184392_2_, ItemCameraTransforms.TransformType p_184392_3_, boolean p_184392_4_) -@@ -279,14 +269,9 @@ - GlStateManager.enableBlend(); - GlStateManager.func_187428_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); - GlStateManager.pushMatrix(); -- ItemCameraTransforms itemcameratransforms = p_184394_2_.getItemCameraTransforms(); -- ItemCameraTransforms.func_188034_a(itemcameratransforms.getTransform(p_184394_3_), p_184394_4_); -+ // TODO: check if negative scale is a thing -+ p_184394_2_ = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(p_184394_2_, p_184394_3_, p_184394_4_); - -- if (this.func_183005_a(itemcameratransforms.getTransform(p_184394_3_))) -- { -- GlStateManager.func_187407_a(GlStateManager.CullFace.FRONT); -- } -- - this.renderItem(p_184394_1_, p_184394_2_); - GlStateManager.func_187407_a(GlStateManager.CullFace.BACK); - GlStateManager.popMatrix(); -@@ -319,7 +304,7 @@ - GlStateManager.func_187401_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - this.setupGuiTransform(p_184390_2_, p_184390_3_, p_184390_4_.isGui3d()); -- p_184390_4_.getItemCameraTransforms().applyTransform(ItemCameraTransforms.TransformType.GUI); -+ p_184390_4_ = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(p_184390_4_, ItemCameraTransforms.TransformType.GUI, false); - this.renderItem(p_184390_1_, p_184390_4_); - GlStateManager.disableAlpha(); - GlStateManager.disableRescaleNormal(); -@@ -426,10 +411,11 @@ - GlStateManager.enableDepth(); - } - -- if (stack.isItemDamaged()) -+ if (stack.getItem().showDurabilityBar(stack)) - { -- int j = (int)Math.round(13.0D - (double)stack.getItemDamage() * 13.0D / (double)stack.getMaxDamage()); -- int i = (int)Math.round(255.0D - (double)stack.getItemDamage() * 255.0D / (double)stack.getMaxDamage()); -+ double health = stack.getItem().getDurabilityForDisplay(stack); -+ int j = (int)Math.round(13.0D - health * 13.0D); -+ int i = (int)Math.round(255.0D - health * 255.0D); - GlStateManager.disableLighting(); - GlStateManager.disableDepth(); - GlStateManager.disableTexture2D(); -@@ -440,7 +426,7 @@ - this.func_181565_a(vertexbuffer, xPosition + 2, yPosition + 13, 13, 2, 0, 0, 0, 255); - this.func_181565_a(vertexbuffer, xPosition + 2, yPosition + 13, 12, 1, (255 - i) / 4, 64, 0, 255); - this.func_181565_a(vertexbuffer, xPosition + 2, yPosition + 13, j, 1, 255 - i, i, 0, 255); -- GlStateManager.enableBlend(); -+ //GlStateManager.enableBlend(); // Forge: Disable Blend because it screws with a lot of things down the line. - GlStateManager.enableAlpha(); - GlStateManager.enableTexture2D(); - GlStateManager.enableLighting(); -@@ -1053,6 +1039,7 @@ - this.registerBlock(Blocks.field_185779_df, TileEntityStructure.Mode.LOAD.func_185110_a(), "structure_block"); - this.registerBlock(Blocks.field_185779_df, TileEntityStructure.Mode.CORNER.func_185110_a(), "structure_block"); - this.registerBlock(Blocks.field_185779_df, TileEntityStructure.Mode.DATA.func_185110_a(), "structure_block"); -+ net.minecraftforge.client.model.ModelLoader.onRegisterItems(this.itemModelMesher); - } - - public void onResourceManagerReload(IResourceManager resourceManager) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/VertexBuffer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/VertexBuffer.java.patch deleted file mode 100644 index e8a03041f..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/VertexBuffer.java.patch +++ /dev/null @@ -1,34 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/VertexBuffer.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/VertexBuffer.java -@@ -510,15 +510,15 @@ - break; - case USHORT: - case SHORT: -- this.byteBuffer.putShort(i, (short)((int)p_181663_1_ * 32767 & 65535)); -- this.byteBuffer.putShort(i + 2, (short)((int)p_181663_2_ * 32767 & 65535)); -- this.byteBuffer.putShort(i + 4, (short)((int)p_181663_3_ * 32767 & 65535)); -+ this.byteBuffer.putShort(i, (short)((int)(p_181663_1_ * 32767) & 65535)); -+ this.byteBuffer.putShort(i + 2, (short)((int)(p_181663_2_ * 32767) & 65535)); -+ this.byteBuffer.putShort(i + 4, (short)((int)(p_181663_3_ * 32767) & 65535)); - break; - case UBYTE: - case BYTE: -- this.byteBuffer.put(i, (byte)((int)p_181663_1_ * 127 & 255)); -- this.byteBuffer.put(i + 1, (byte)((int)p_181663_2_ * 127 & 255)); -- this.byteBuffer.put(i + 2, (byte)((int)p_181663_3_ * 127 & 255)); -+ this.byteBuffer.put(i, (byte)((int)(p_181663_1_ * 127) & 255)); -+ this.byteBuffer.put(i + 1, (byte)((int)(p_181663_2_ * 127) & 255)); -+ this.byteBuffer.put(i + 2, (byte)((int)(p_181663_3_ * 127) & 255)); - } - - this.nextVertexFormatIndex(); -@@ -609,4 +609,9 @@ - return this.stateVertexFormat; - } - } -+ -+ public boolean isColorDisabled() -+ { -+ return noColor; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch deleted file mode 100644 index 8d2a98861..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch +++ /dev/null @@ -1,57 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java -@@ -28,26 +28,8 @@ - int l = vertexformatelement.getIndex(); - bytebuffer.position(vertexformat.func_181720_d(j)); - -- switch (vertexformatelement$enumusage) -- { -- case POSITION: -- GlStateManager.func_187427_b(vertexformatelement.getElementCount(), k, i, bytebuffer); -- GlStateManager.func_187410_q(32884); -- break; -- case UV: -- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + l); -- GlStateManager.func_187404_a(vertexformatelement.getElementCount(), k, i, bytebuffer); -- GlStateManager.func_187410_q(32888); -- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); -- break; -- case COLOR: -- GlStateManager.func_187400_c(vertexformatelement.getElementCount(), k, i, bytebuffer); -- GlStateManager.func_187410_q(32886); -- break; -- case NORMAL: -- GlStateManager.func_187446_a(k, i, bytebuffer); -- GlStateManager.func_187410_q(32885); -- } -+ // moved to VertexFormatElement.preDraw -+ vertexformatelement.getUsage().preDraw(vertexformat, j, i, bytebuffer); - } - - GlStateManager.func_187439_f(p_181679_1_.getDrawMode(), 0, p_181679_1_.getVertexCount()); -@@ -59,23 +41,8 @@ - VertexFormatElement.EnumUsage vertexformatelement$enumusage1 = vertexformatelement1.getUsage(); - int k1 = vertexformatelement1.getIndex(); - -- switch (vertexformatelement$enumusage1) -- { -- case POSITION: -- GlStateManager.func_187429_p(32884); -- break; -- case UV: -- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + k1); -- GlStateManager.func_187429_p(32888); -- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); -- break; -- case COLOR: -- GlStateManager.func_187429_p(32886); -- GlStateManager.resetColor(); -- break; -- case NORMAL: -- GlStateManager.func_187429_p(32885); -- } -+ // moved to VertexFormatElement.postDraw -+ vertexformatelement1.getUsage().postDraw(vertexformat, i1, i, bytebuffer); - } - } - diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch deleted file mode 100644 index 8d8d18d4e..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch +++ /dev/null @@ -1,47 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java -@@ -6,15 +6,25 @@ - import net.minecraftforge.fml.relauncher.SideOnly; - - @SideOnly(Side.CLIENT) --public class BakedQuad -+public class BakedQuad implements net.minecraftforge.client.model.pipeline.IVertexProducer - { - protected final int[] vertexData; - protected final int tintIndex; - protected final EnumFacing face; - protected final TextureAtlasSprite field_187509_d; - -+ /** -+ * @deprecated Use constructor with the format argument. -+ */ -+ @Deprecated - public BakedQuad(int[] p_i46574_1_, int p_i46574_2_, EnumFacing p_i46574_3_, TextureAtlasSprite p_i46574_4_) - { -+ this(p_i46574_1_, p_i46574_2_, p_i46574_3_, p_i46574_4_, net.minecraft.client.renderer.vertex.DefaultVertexFormats.ITEM); -+ } -+ -+ public BakedQuad(int[] p_i46574_1_, int p_i46574_2_, EnumFacing p_i46574_3_, TextureAtlasSprite p_i46574_4_, net.minecraft.client.renderer.vertex.VertexFormat format) -+ { -+ this.format = format; - this.vertexData = p_i46574_1_; - this.tintIndex = p_i46574_2_; - this.face = p_i46574_3_; -@@ -45,4 +55,17 @@ - { - return this.face; - } -+ -+ private final net.minecraft.client.renderer.vertex.VertexFormat format; -+ -+ @Override -+ public void pipe(net.minecraftforge.client.model.pipeline.IVertexConsumer consumer) -+ { -+ net.minecraftforge.client.model.pipeline.LightUtil.putBakedQuad(consumer, this); -+ } -+ -+ public net.minecraft.client.renderer.vertex.VertexFormat getFormat() -+ { -+ return format; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch deleted file mode 100644 index ade098feb..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch +++ /dev/null @@ -1,93 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java -@@ -48,14 +48,20 @@ - - public BakedQuad makeBakedQuad(Vector3f posFrom, Vector3f posTo, BlockPartFace face, TextureAtlasSprite sprite, EnumFacing facing, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) - { -+ return makeBakedQuad(posFrom, posTo, face, sprite, facing, (net.minecraftforge.client.model.ITransformation)modelRotationIn, partRotation, uvLocked, shade); -+ } -+ -+ public BakedQuad makeBakedQuad(Vector3f posFrom, Vector3f posTo, BlockPartFace face, TextureAtlasSprite sprite, EnumFacing facing, net.minecraftforge.client.model.ITransformation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) -+ { - BlockFaceUV blockfaceuv = face.blockFaceUV; - - if (uvLocked) - { -- blockfaceuv = this.func_188010_a(face.blockFaceUV, facing, modelRotationIn); -+ // TODO fix uvlock for custom rotations -+ //blockfaceuv = this.func_188010_a(face.blockFaceUV, facing, modelRotationIn); - } - -- int[] aint = this.func_188012_a(blockfaceuv, sprite, facing, this.getPositionsDiv16(posFrom, posTo), modelRotationIn, partRotation, shade); -+ int[] aint = this.makeQuadVertexData(blockfaceuv, sprite, facing, this.getPositionsDiv16(posFrom, posTo), modelRotationIn, partRotation, shade); - EnumFacing enumfacing = getFacingFromVertexData(aint); - - if (partRotation == null) -@@ -63,6 +69,7 @@ - this.func_178408_a(aint, enumfacing); - } - -+ net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, enumfacing); - return new BakedQuad(aint, face.tintIndex, enumfacing, sprite); - } - -@@ -73,11 +80,16 @@ - - private int[] func_188012_a(BlockFaceUV p_188012_1_, TextureAtlasSprite p_188012_2_, EnumFacing p_188012_3_, float[] p_188012_4_, ModelRotation p_188012_5_, BlockPartRotation p_188012_6_, boolean p_188012_7_) - { -+ return makeQuadVertexData(p_188012_1_, p_188012_2_, p_188012_3_, p_188012_4_, (net.minecraftforge.client.model.ITransformation)p_188012_5_, p_188012_6_, p_188012_7_); -+ } -+ -+ private int[] makeQuadVertexData(BlockFaceUV p_188012_1_, TextureAtlasSprite p_188012_2_, EnumFacing p_188012_3_, float[] p_188012_4_, net.minecraftforge.client.model.ITransformation p_188012_5_, BlockPartRotation p_188012_6_, boolean p_188012_7_) -+ { - int[] aint = new int[28]; - - for (int i = 0; i < 4; ++i) - { -- this.func_188015_a(aint, i, p_188012_3_, p_188012_1_, p_188012_4_, p_188012_2_, p_188012_5_, p_188012_6_, p_188012_7_); -+ this.fillVertexData(aint, i, p_188012_3_, p_188012_1_, p_188012_4_, p_188012_2_, p_188012_5_, p_188012_6_, p_188012_7_); - } - - return aint; -@@ -123,12 +135,17 @@ - - private void func_188015_a(int[] p_188015_1_, int p_188015_2_, EnumFacing p_188015_3_, BlockFaceUV p_188015_4_, float[] p_188015_5_, TextureAtlasSprite p_188015_6_, ModelRotation p_188015_7_, BlockPartRotation p_188015_8_, boolean p_188015_9_) - { -- EnumFacing enumfacing = p_188015_7_.rotateFace(p_188015_3_); -+ fillVertexData(p_188015_1_, p_188015_2_, p_188015_3_, p_188015_4_, p_188015_5_, p_188015_6_, (net.minecraftforge.client.model.ITransformation)p_188015_7_, p_188015_8_, p_188015_9_); -+ } -+ -+ private void fillVertexData(int[] p_188015_1_, int p_188015_2_, EnumFacing p_188015_3_, BlockFaceUV p_188015_4_, float[] p_188015_5_, TextureAtlasSprite p_188015_6_, net.minecraftforge.client.model.ITransformation p_188015_7_, BlockPartRotation p_188015_8_, boolean p_188015_9_) -+ { -+ EnumFacing enumfacing = p_188015_7_.rotate(p_188015_3_); - int i = p_188015_9_ ? this.getFaceShadeColor(enumfacing) : -1; - EnumFaceDirection.VertexInformation enumfacedirection$vertexinformation = EnumFaceDirection.getFacing(p_188015_3_).func_179025_a(p_188015_2_); - Vector3f vector3f = new Vector3f(p_188015_5_[enumfacedirection$vertexinformation.field_179184_a], p_188015_5_[enumfacedirection$vertexinformation.field_179182_b], p_188015_5_[enumfacedirection$vertexinformation.field_179183_c]); - this.func_178407_a(vector3f, p_188015_8_); -- int j = this.func_188011_a(vector3f, p_188015_3_, p_188015_2_, p_188015_7_); -+ int j = this.rotateVertex(vector3f, p_188015_3_, p_188015_2_, p_188015_7_); - this.storeVertexData(p_188015_1_, j, p_188015_2_, vector3f, i, p_188015_6_, p_188015_4_); - } - -@@ -189,14 +206,19 @@ - - public int func_188011_a(Vector3f p_188011_1_, EnumFacing p_188011_2_, int p_188011_3_, ModelRotation p_188011_4_) - { -+ return rotateVertex(p_188011_1_, p_188011_2_, p_188011_3_, (net.minecraftforge.client.model.ITransformation)p_188011_4_); -+ } -+ -+ public int rotateVertex(Vector3f p_188011_1_, EnumFacing p_188011_2_, int p_188011_3_, net.minecraftforge.client.model.ITransformation p_188011_4_) -+ { - if (p_188011_4_ == ModelRotation.X0_Y0) - { - return p_188011_3_; - } - else - { -- this.rotateScale(p_188011_1_, new Vector3f(0.5F, 0.5F, 0.5F), p_188011_4_.getMatrix4d(), new Vector3f(1.0F, 1.0F, 1.0F)); -- return p_188011_4_.rotateVertex(p_188011_2_, p_188011_3_); -+ net.minecraftforge.client.ForgeHooksClient.transform(p_188011_1_, p_188011_4_.getMatrix()); -+ return p_188011_4_.rotate(p_188011_2_, p_188011_3_); - } - } - diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/IBakedModel.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/IBakedModel.java.patch deleted file mode 100644 index b346a5891..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/IBakedModel.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/block/model/IBakedModel.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/IBakedModel.java -@@ -20,6 +20,7 @@ - - TextureAtlasSprite getParticleTexture(); - -+ @Deprecated - ItemCameraTransforms getItemCameraTransforms(); - - ItemOverrideList func_188617_f(); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch deleted file mode 100644 index 26b790331..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch +++ /dev/null @@ -1,45 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java -@@ -12,6 +12,9 @@ - import net.minecraftforge.fml.relauncher.SideOnly; - import org.lwjgl.util.vector.Quaternion; - -+/* -+ * @deprecated use {@link net.minecraftforge.client.model.IPerspectiveAwareModel} instead -+ */ - @SideOnly(Side.CLIENT) - public class ItemCameraTransforms - { -@@ -39,6 +42,7 @@ - this(ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT); - } - -+ @Deprecated - public ItemCameraTransforms(ItemCameraTransforms p_i46443_1_) - { - this.field_188036_k = p_i46443_1_.field_188036_k; -@@ -51,6 +55,7 @@ - this.fixed = p_i46443_1_.fixed; - } - -+ @Deprecated - public ItemCameraTransforms(ItemTransformVec3f p_i46569_1_, ItemTransformVec3f p_i46569_2_, ItemTransformVec3f p_i46569_3_, ItemTransformVec3f p_i46569_4_, ItemTransformVec3f p_i46569_5_, ItemTransformVec3f p_i46569_6_, ItemTransformVec3f p_i46569_7_, ItemTransformVec3f p_i46569_8_) - { - this.field_188036_k = p_i46569_1_; -@@ -103,6 +108,7 @@ - return new Quaternion(f3 * f6 * f8 + f4 * f5 * f7, f4 * f5 * f8 - f3 * f6 * f7, f3 * f5 * f8 + f4 * f6 * f7, f4 * f6 * f8 - f3 * f5 * f7); - } - -+ @Deprecated - public ItemTransformVec3f getTransform(ItemCameraTransforms.TransformType p_181688_1_) - { - switch (p_181688_1_) -@@ -169,7 +175,7 @@ - } - - @SideOnly(Side.CLIENT) -- public static enum TransformType -+ public static enum TransformType implements net.minecraftforge.client.model.IModelPart - { - NONE, - THIRD_PERSON_LEFT_HAND, diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java.patch deleted file mode 100644 index 5f9bcf1aa..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java.patch +++ /dev/null @@ -1,40 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java -@@ -1,7 +1,10 @@ - package net.minecraft.client.renderer.block.model; - - import com.google.common.collect.Lists; -+ - import java.util.List; -+ -+import net.minecraft.client.Minecraft; - import net.minecraft.entity.EntityLivingBase; - import net.minecraft.item.ItemStack; - import net.minecraft.util.ResourceLocation; -@@ -27,6 +30,7 @@ - } - } - -+ @Deprecated - public ResourceLocation func_188021_a(ItemStack p_188021_1_, World p_188021_2_, EntityLivingBase p_188021_3_) - { - if (!this.field_188023_b.isEmpty()) -@@ -42,4 +46,18 @@ - - return null; - } -+ -+ public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity) -+ { -+ net.minecraft.item.Item item = stack.getItem(); -+ if (item != null && item.func_185040_i()) -+ { -+ ResourceLocation location = func_188021_a(stack, world, entity); -+ if (location != null) -+ { -+ return Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getModelManager().getModel(new ModelResourceLocation(location, "inventory")); -+ } -+ } -+ return originalModel; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch deleted file mode 100644 index 8e3564b56..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java -@@ -13,9 +13,14 @@ - import net.minecraftforge.fml.relauncher.SideOnly; - import org.lwjgl.util.vector.Vector3f; - -+/* -+ * @deprecated use {@link net.minecraftforge.client.model.IModelState} and {@link net.minecraftforge.client.model.TRSRTransformation} -+ */ - @SideOnly(Side.CLIENT) --public class ItemTransformVec3f -+@Deprecated -+public class ItemTransformVec3f implements net.minecraftforge.client.model.IModelState - { -+ public com.google.common.base.Optional apply(com.google.common.base.Optional part) { return net.minecraftforge.client.ForgeHooksClient.applyTransform(this, part); } - public static final ItemTransformVec3f DEFAULT = new ItemTransformVec3f(new Vector3f(), new Vector3f(), new Vector3f(1.0F, 1.0F, 1.0F)); - public final Vector3f rotation; - public final Vector3f translation; diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch deleted file mode 100644 index ebdfd263f..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java.patch +++ /dev/null @@ -1,107 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java -@@ -132,7 +132,7 @@ - { - if (!modelblockdefinition.func_188002_b()) - { -- LOGGER.warn("Unable to load variant: " + modelresourcelocation.getVariant() + " from " + modelresourcelocation); -+ LOGGER.warn("Unable to load variant: " + modelresourcelocation.getVariant() + " from " + modelresourcelocation, var12); - } - } - } -@@ -370,6 +370,7 @@ - - protected void registerVariantNames() - { -+ this.variantNames.clear(); //FML clear this to prevent double ups. - this.variantNames.put(Item.getItemFromBlock(Blocks.stone), Lists.newArrayList(new String[] {"stone", "granite", "granite_smooth", "diorite", "diorite_smooth", "andesite", "andesite_smooth"})); - this.variantNames.put(Item.getItemFromBlock(Blocks.dirt), Lists.newArrayList(new String[] {"dirt", "coarse_dirt", "podzol"})); - this.variantNames.put(Item.getItemFromBlock(Blocks.planks), Lists.newArrayList(new String[] {"oak_planks", "spruce_planks", "birch_planks", "jungle_planks", "acacia_planks", "dark_oak_planks"})); -@@ -413,6 +414,10 @@ - this.variantNames.put(Item.getItemFromBlock(Blocks.oak_fence), Lists.newArrayList(new String[] {"oak_fence"})); - this.variantNames.put(Items.oak_door, Lists.newArrayList(new String[] {"oak_door"})); - this.variantNames.put(Items.boat, Lists.newArrayList(new String[] {"oak_boat"})); -+ for (Entry, Set> e : customVariantNames.entrySet()) -+ { -+ this.variantNames.put(e.getKey().get(), Lists.newArrayList(e.getValue().iterator())); -+ } - } - - protected List getVariantNames(Item p_177596_1_) -@@ -429,7 +434,7 @@ - - protected ResourceLocation getItemLocation(String p_177583_1_) - { -- ResourceLocation resourcelocation = new ResourceLocation(p_177583_1_); -+ ResourceLocation resourcelocation = new ResourceLocation(p_177583_1_.replaceAll("#.*", "")); - return new ResourceLocation(resourcelocation.getResourceDomain(), "item/" + resourcelocation.getResourcePath()); - } - -@@ -536,7 +541,7 @@ - for (Entry entry : this.itemLocations.entrySet()) - { - ResourceLocation resourcelocation = (ResourceLocation)entry.getValue(); -- ModelResourceLocation modelresourcelocation = new ModelResourceLocation((String)entry.getKey(), "inventory"); -+ ModelResourceLocation modelresourcelocation = net.minecraftforge.client.model.ModelLoader.getInventoryVariant(entry.getKey()); - ModelBlock modelblock = (ModelBlock)this.models.get(resourcelocation); - - if (modelblock != null && modelblock.isResolved()) -@@ -623,6 +628,11 @@ - - private IBakedModel bakeModel(ModelBlock modelBlockIn, ModelRotation modelRotationIn, boolean uvLocked) - { -+ return bakeModel(modelBlockIn, (net.minecraftforge.client.model.ITransformation)modelRotationIn, uvLocked); -+ } -+ -+ protected IBakedModel bakeModel(ModelBlock modelBlockIn, net.minecraftforge.client.model.ITransformation modelRotationIn, boolean uvLocked) -+ { - TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName("particle"))); - SimpleBakedModel.Builder simplebakedmodel$builder = (new SimpleBakedModel.Builder(modelBlockIn, modelBlockIn.func_187967_g())).setTexture(textureatlassprite); - -@@ -639,13 +649,13 @@ - BlockPartFace blockpartface = (BlockPartFace)blockpart.mapFaces.get(enumfacing); - TextureAtlasSprite textureatlassprite1 = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName(blockpartface.texture))); - -- if (blockpartface.cullFace == null) -+ if (blockpartface.cullFace == null || !net.minecraftforge.client.model.TRSRTransformation.isInteger(modelRotationIn.getMatrix())) - { - simplebakedmodel$builder.addGeneralQuad(this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); - } - else - { -- simplebakedmodel$builder.addFaceQuad(modelRotationIn.rotateFace(blockpartface.cullFace), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); -+ simplebakedmodel$builder.addFaceQuad(modelRotationIn.rotate(blockpartface.cullFace), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); - } - } - } -@@ -656,6 +666,11 @@ - - private BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, ModelRotation p_177589_5_, boolean p_177589_6_) - { -+ return makeBakedQuad(p_177589_1_, p_177589_2_, p_177589_3_, p_177589_4_, (net.minecraftforge.client.model.ITransformation)p_177589_5_, p_177589_6_); -+ } -+ -+ protected BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, net.minecraftforge.client.model.ITransformation p_177589_5_, boolean p_177589_6_) -+ { - return this.faceBakery.makeBakedQuad(p_177589_1_.positionFrom, p_177589_1_.positionTo, p_177589_2_, p_177589_3_, p_177589_4_, p_177589_5_, p_177589_1_.partRotation, p_177589_6_, p_177589_1_.shade); - } - -@@ -878,4 +893,18 @@ - MODEL_GENERATED.name = "generation marker"; - MODEL_ENTITY.name = "block entity marker"; - } -+ -+ private static Map, Set> customVariantNames = Maps.newHashMap(); -+ -+ public static void registerItemVariants(Item item, ResourceLocation... names) -+ { -+ if (!customVariantNames.containsKey(item.delegate)) -+ { -+ customVariantNames.put(item.delegate, Sets.newHashSet()); -+ } -+ for(ResourceLocation name : names) -+ { -+ customVariantNames.get(item.delegate).add(name.toString()); -+ } -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch deleted file mode 100644 index 5b8ebe4cd..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java -@@ -31,7 +31,7 @@ - - public static ModelBlockDefinition parseFromReader(Reader p_178331_0_) - { -- return (ModelBlockDefinition)GSON.fromJson(p_178331_0_, ModelBlockDefinition.class); -+ return net.minecraftforge.client.model.BlockStateLoader.load(p_178331_0_, GSON); - } - - public ModelBlockDefinition(Map p_i46572_1_, Multipart p_i46572_2_) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java.patch deleted file mode 100644 index 54256d1f3..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java -@@ -24,9 +24,11 @@ - - public void onResourceManagerReload(IResourceManager resourceManager) - { -- ModelBakery modelbakery = new ModelBakery(resourceManager, this.texMap, this.modelProvider); -+ // FIXME: reenable after ModelLoader is fixed -+ ModelBakery modelbakery = new ModelBakery(resourceManager, this.texMap, this.modelProvider); //new net.minecraftforge.client.model.ModelLoader(resourceManager, this.texMap, this.modelProvider); - this.modelRegistry = modelbakery.setupModelRegistry(); - this.defaultModel = (IBakedModel)this.modelRegistry.getObject(ModelBakery.MODEL_MISSING); -+ //net.minecraftforge.client.ForgeHooksClient.onModelBake(this, this.modelRegistry, modelbakery); - this.modelProvider.reloadModels(); - } - diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelRotation.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelRotation.java.patch deleted file mode 100644 index cef4d35bb..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelRotation.java.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ModelRotation.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelRotation.java -@@ -10,7 +10,7 @@ - import org.lwjgl.util.vector.Vector3f; - - @SideOnly(Side.CLIENT) --public enum ModelRotation -+public enum ModelRotation implements net.minecraftforge.client.model.IModelState, net.minecraftforge.client.model.ITransformation - { - X0_Y0(0, 0), - X0_Y90(0, 90), -@@ -116,4 +116,9 @@ - mapRotations.put(Integer.valueOf(modelrotation.combinedXY), modelrotation); - } - } -+ -+ public com.google.common.base.Optional apply(com.google.common.base.Optional part) { return net.minecraftforge.client.ForgeHooksClient.applyTransform(getMatrix(), part); } -+ public javax.vecmath.Matrix4f getMatrix() { return net.minecraftforge.client.ForgeHooksClient.getMatrix(this); } -+ public EnumFacing rotate(EnumFacing facing) { return rotateFace(facing); } -+ public int rotate(EnumFacing facing, int vertexIndex) { return rotateVertex(facing, vertexIndex); } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/Variant.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/Variant.java.patch deleted file mode 100644 index 51f084a94..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/Variant.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/block/model/Variant.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/Variant.java -@@ -32,11 +32,17 @@ - return this.field_188050_a; - } - -+ @Deprecated - public ModelRotation func_188048_b() - { - return this.field_188051_b; - } - -+ public net.minecraftforge.client.model.IModelState getState() -+ { -+ return this.field_188051_b; -+ } -+ - public boolean func_188049_c() - { - return this.field_188052_c; diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch deleted file mode 100644 index 3d5288e13..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java -@@ -38,7 +38,7 @@ - } - else - { -- s = this.func_187490_a(this.name, map); -+ s = String.format("%s:%s", Block.blockRegistry.getNameForObject(state.getBlock()).getResourceDomain(), this.func_187490_a(this.name, map)); - } - - if (this.suffix != null) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch deleted file mode 100644 index 3db0e8b9a..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch +++ /dev/null @@ -1,68 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java -@@ -133,7 +133,9 @@ - return; - } - -- iblockaccess = new RegionRenderCache(this.world, blockpos.add(-1, -1, -1), blockpos1.add(1, 1, 1), 1); -+ RegionRenderCache cache = createRegionRenderCache(this.world, blockpos.add(-1, -1, -1), blockpos1.add(1, 1, 1), 1); -+ net.minecraftforge.client.MinecraftForgeClient.onRebuildChunk(world, position, cache); -+ iblockaccess = cache; - generator.setCompiledChunk(compiledchunk); - } - finally -@@ -160,7 +162,7 @@ - lvt_10_1_.func_178606_a(blockpos$mutableblockpos); - } - -- if (block.hasTileEntity()) -+ if (block.hasTileEntity(iblockstate)) - { - TileEntity tileentity = iblockaccess.getTileEntity(new BlockPos(blockpos$mutableblockpos)); - TileEntitySpecialRenderer tileentityspecialrenderer = TileEntityRendererDispatcher.instance.getSpecialRenderer(tileentity); -@@ -176,7 +178,9 @@ - } - } - -- BlockRenderLayer blockrenderlayer1 = block.getBlockLayer(); -+ for(BlockRenderLayer blockrenderlayer1 : BlockRenderLayer.values()) { -+ if(!block.canRenderInLayer(blockrenderlayer1)) continue; -+ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(blockrenderlayer1); - int j = blockrenderlayer1.ordinal(); - - if (block.getDefaultState().func_185901_i() != EnumBlockRenderType.INVISIBLE) -@@ -191,6 +195,7 @@ - - aboolean[j] |= blockrendererdispatcher.renderBlock(iblockstate, blockpos$mutableblockpos, iblockaccess, vertexbuffer); - } -+ } - } - - for (BlockRenderLayer blockrenderlayer : BlockRenderLayer.values()) -@@ -413,6 +418,26 @@ - return this.needsUpdate && this.field_188284_q; - } - -+ /* ======================================== FORGE START =====================================*/ -+ /** -+ * Creates a new RegionRenderCache instance.
-+ * Extending classes can change the behavior of the cache, allowing to visually change -+ * blocks (schematics etc). -+ * -+ * @see RegionRenderCache -+ * @param world The world to cache. -+ * @param from The starting position of the chunk minus one on each axis. -+ * @param to The ending position of the chunk plus one on each axis. -+ * @param subtract Padding used internally by the RegionRenderCache constructor to make -+ * the cache a 20x20x20 cube, for a total of 8000 states in the cache. -+ * @return new RegionRenderCache instance -+ */ -+ protected RegionRenderCache createRegionRenderCache(World world, BlockPos from, BlockPos to, int subtract) -+ { -+ return new RegionRenderCache(world, from, to, subtract); -+ } -+ /* ========================================= FORGE END ======================================*/ -+ - public BlockPos getBlockPosOffset16(EnumFacing p_181701_1_) - { - return (BlockPos)this.mapEnumFacing.get(p_181701_1_); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch deleted file mode 100644 index b58a69c6d..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch +++ /dev/null @@ -1,83 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java -@@ -44,7 +44,7 @@ - boolean flag = p_177077_9_.isGui3d(); - int i = this.func_177078_a(itemstack); - float f = 0.25F; -- float f1 = MathHelper.sin(((float)itemIn.getAge() + p_177077_8_) / 10.0F + itemIn.hoverStart) * 0.1F + 0.1F; -+ float f1 = shouldBob() ? MathHelper.sin(((float)itemIn.getAge() + p_177077_8_) / 10.0F + itemIn.hoverStart) * 0.1F + 0.1F : 0; - float f2 = p_177077_9_.getItemCameraTransforms().getTransform(ItemCameraTransforms.TransformType.GROUND).scale.y; - GlStateManager.translate((float)p_177077_2_, (float)p_177077_4_ + f1 + 0.25F * f2, (float)p_177077_6_); - -@@ -114,16 +114,13 @@ - GlStateManager.pushMatrix(); - IBakedModel ibakedmodel = this.itemRenderer.func_184393_a(itemstack, entity.worldObj, (EntityLivingBase)null); - int j = this.func_177077_a(entity, x, y, z, partialTicks, ibakedmodel); -- float f = ibakedmodel.getItemCameraTransforms().ground.scale.x; -- float f1 = ibakedmodel.getItemCameraTransforms().ground.scale.y; -- float f2 = ibakedmodel.getItemCameraTransforms().ground.scale.z; - boolean flag1 = ibakedmodel.isGui3d(); - - if (!flag1) - { -- float f3 = -0.0F * (float)(j - 1) * 0.5F * f; -- float f4 = -0.0F * (float)(j - 1) * 0.5F * f1; -- float f5 = -0.09375F * (float)(j - 1) * 0.5F * f2; -+ float f3 = -0.0F * (float)(j - 1) * 0.5F; -+ float f4 = -0.0F * (float)(j - 1) * 0.5F; -+ float f5 = -0.09375F * (float)(j - 1) * 0.5F; - GlStateManager.translate(f3, f4, f5); - } - -@@ -144,10 +141,10 @@ - float f7 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; - float f9 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; - float f6 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; -- GlStateManager.translate(f7, f9, f6); -+ GlStateManager.translate(shouldSpreadItems() ? f7 : 0, shouldSpreadItems() ? f9 : 0, f6); - } - -- ibakedmodel.getItemCameraTransforms().applyTransform(ItemCameraTransforms.TransformType.GROUND); -+ ibakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GROUND, false); - this.itemRenderer.renderItem(itemstack, ibakedmodel); - GlStateManager.popMatrix(); - } -@@ -162,10 +159,10 @@ - GlStateManager.translate(f8, f10, 0.0F); - } - -- ibakedmodel.getItemCameraTransforms().applyTransform(ItemCameraTransforms.TransformType.GROUND); -+ ibakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GROUND, false); - this.itemRenderer.renderItem(itemstack, ibakedmodel); - GlStateManager.popMatrix(); -- GlStateManager.translate(0.0F * f, 0.0F * f1, 0.09375F * f2); -+ GlStateManager.translate(0.0F, 0.0F, 0.09375F); - } - } - -@@ -192,4 +189,25 @@ - { - return TextureMap.locationBlocksTexture; - } -+ -+ /*==================================== FORGE START ===========================================*/ -+ -+ /** -+ * Items should spread out when rendered in 3d? -+ * @return -+ */ -+ public boolean shouldSpreadItems() -+ { -+ return true; -+ } -+ -+ /** -+ * Items should have a bob effect -+ * @return -+ */ -+ public boolean shouldBob() -+ { -+ return true; -+ } -+ /*==================================== FORGE END =============================================*/ - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderLivingBase.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderLivingBase.java.patch deleted file mode 100644 index a044bc481..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderLivingBase.java.patch +++ /dev/null @@ -1,64 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderLivingBase.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderLivingBase.java -@@ -32,6 +32,9 @@ - protected List> layerRenderers = Lists.>newArrayList(); - protected boolean field_188323_j = false; - -+ public static float NAME_TAG_RANGE = 64.0f; -+ public static float NAME_TAG_RANGE_SNEAK = 32.0f; -+ - public RenderLivingBase(RenderManager renderManagerIn, ModelBase modelBaseIn, float shadowSizeIn) - { - super(renderManagerIn); -@@ -77,10 +80,12 @@ - - public void doRender(T entity, double x, double y, double z, float entityYaw, float partialTicks) - { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Pre(entity, this, x, y, z))) return; - GlStateManager.pushMatrix(); - GlStateManager.disableCull(); - this.mainModel.swingProgress = this.getSwingProgress(entity, partialTicks); -- this.mainModel.isRiding = entity.func_184218_aH(); -+ boolean shouldSit = entity.func_184218_aH() && (entity.func_184187_bx() != null && entity.func_184187_bx().shouldRiderSit()); -+ this.mainModel.isRiding = shouldSit; - this.mainModel.isChild = entity.isChild(); - - try -@@ -89,7 +94,7 @@ - float f1 = this.interpolateRotation(entity.prevRotationYawHead, entity.rotationYawHead, partialTicks); - float f2 = f1 - f; - -- if (entity.func_184218_aH() && entity.func_184187_bx() instanceof EntityLivingBase) -+ if (shouldSit && entity.func_184187_bx() instanceof EntityLivingBase) - { - EntityLivingBase entitylivingbase = (EntityLivingBase)entity.func_184187_bx(); - f = this.interpolateRotation(entitylivingbase.prevRenderYawOffset, entitylivingbase.renderYawOffset, partialTicks); -@@ -197,6 +202,7 @@ - GlStateManager.enableCull(); - GlStateManager.popMatrix(); - super.doRender(entity, x, y, z, entityYaw, partialTicks); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Post(entity, this, x, y, z)); - } - - public float func_188322_c(T p_188322_1_, float p_188322_2_) -@@ -452,10 +458,11 @@ - - public void renderName(T entity, double x, double y, double z) - { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Pre(entity, this, x, y, z))) return; - if (this.canRenderName(entity)) - { - double d0 = entity.getDistanceSqToEntity(this.renderManager.livingPlayer); -- float f = entity.isSneaking() ? 32.0F : 64.0F; -+ float f = entity.isSneaking() ? NAME_TAG_RANGE_SNEAK : NAME_TAG_RANGE; - - if (d0 < (double)(f * f)) - { -@@ -464,6 +471,7 @@ - this.func_188296_a(entity, x, y, z, s, d0); - } - } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Post(entity, this, x, y, z)); - } - - protected boolean canRenderName(T entity) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch deleted file mode 100644 index 208c386cd..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderManager.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderManager.java -@@ -204,8 +204,13 @@ - this.playerRenderer = new RenderPlayer(this); - this.skinMap.put("default", this.playerRenderer); - this.skinMap.put("slim", new RenderPlayer(this, true)); -+ net.minecraftforge.fml.client.registry.RenderingRegistry.loadEntityRenderers(this, this.entityRenderMap); - } - -+ public Map getSkinMap() { -+ return (Map) java.util.Collections.unmodifiableMap(skinMap); -+ } -+ - public void setRenderPosition(double renderPosXIn, double renderPosYIn, double renderPosZIn) - { - this.renderPosX = renderPosXIn; -@@ -253,9 +258,9 @@ - IBlockState iblockstate = worldIn.getBlockState(new BlockPos(livingPlayerIn)); - Block block = iblockstate.getBlock(); - -- if (block == Blocks.bed) -+ if (block.isBed(iblockstate, worldIn, new BlockPos(livingPlayerIn), (EntityLivingBase)livingPlayerIn)) - { -- int i = ((EnumFacing)iblockstate.getValue(BlockBed.field_185512_D)).getHorizontalIndex(); -+ int i = block.getBedDirection(iblockstate, worldIn, new BlockPos(livingPlayerIn)).getHorizontalIndex(); - this.playerViewY = (float)(i * 90 + 180); - this.playerViewX = 0.0F; - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch deleted file mode 100644 index 77c0de3c6..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java -@@ -55,6 +55,7 @@ - - public void doRender(AbstractClientPlayer entity, double x, double y, double z, float entityYaw, float partialTicks) - { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Pre(entity, this, partialTicks, x, y, z))) return; - if (!entity.isUser() || this.renderManager.livingPlayer == entity) - { - double d0 = y; -@@ -69,6 +70,7 @@ - super.doRender(entity, x, d0, z, entityYaw, partialTicks); - GlStateManager.func_187440_b(GlStateManager.Profile.PLAYER_SKIN); - } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Post(entity, this, partialTicks, x, y, z)); - } - - private void setModelVisibilities(AbstractClientPlayer clientPlayer) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch deleted file mode 100644 index e4a92b81b..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java -@@ -44,7 +44,7 @@ - case 4: - return butcherVillagerTextures; - default: -- return villagerTextures; -+ return net.minecraftforge.fml.common.registry.VillagerRegistry.getVillagerSkin(entity.getProfession(), villagerTextures); - } - } - diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch deleted file mode 100644 index 5ba4fa140..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch +++ /dev/null @@ -1,106 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java -@@ -59,29 +59,27 @@ - T t = this.func_188360_a(p_188361_9_); - t.setModelAttributes(this.renderer.getMainModel()); - t.setLivingAnimations(p_188361_1_, p_188361_2_, p_188361_3_, p_188361_4_); -+ t = getArmorModelHook(p_188361_1_, itemstack, p_188361_9_, t); - this.func_188359_a(t, p_188361_9_); - boolean flag = this.func_188363_b(p_188361_9_); -- this.renderer.bindTexture(this.getArmorResource(itemarmor, flag)); -+ this.renderer.bindTexture(this.getArmorResource(p_188361_1_, itemstack, p_188361_9_, null)); - -- switch (itemarmor.getArmorMaterial()) -- { -- case LEATHER: - int i = itemarmor.getColor(itemstack); -+ { -+ if (i != 0xFFFFFF) // Allow this for anything, not only cloth -+ { - float f = (float)(i >> 16 & 255) / 255.0F; - float f1 = (float)(i >> 8 & 255) / 255.0F; - float f2 = (float)(i & 255) / 255.0F; - GlStateManager.color(this.colorR * f, this.colorG * f1, this.colorB * f2, this.alpha); - t.render(p_188361_1_, p_188361_2_, p_188361_3_, p_188361_5_, p_188361_6_, p_188361_7_, p_188361_8_); -- this.renderer.bindTexture(this.getArmorResource(itemarmor, flag, "overlay")); -- case CHAIN: -- case IRON: -- case GOLD: -- case DIAMOND: -+ this.renderer.bindTexture(this.getArmorResource(p_188361_1_, itemstack, p_188361_9_, "overlay")); -+ } -+ { // Non-colored - GlStateManager.color(this.colorR, this.colorG, this.colorB, this.alpha); - t.render(p_188361_1_, p_188361_2_, p_188361_3_, p_188361_5_, p_188361_6_, p_188361_7_, p_188361_8_); -- default: -- -- if (!this.field_177193_i && itemstack.isItemEnchanted()) -+ } // Default -+ if (!this.field_177193_i && itemstack.hasEffect()) - { - func_188364_a(this.renderer, p_188361_1_, t, p_188361_2_, p_188361_3_, p_188361_4_, p_188361_5_, p_188361_6_, p_188361_7_, p_188361_8_); - } -@@ -140,11 +138,13 @@ - GlStateManager.disableBlend(); - } - -+ @Deprecated //Use the more sensitive version getArmorResource below - private ResourceLocation getArmorResource(ItemArmor p_177181_1_, boolean p_177181_2_) - { - return this.getArmorResource(p_177181_1_, p_177181_2_, (String)null); - } - -+ @Deprecated //Use the more sensitive version getArmorResource below - private ResourceLocation getArmorResource(ItemArmor p_177178_1_, boolean p_177178_2_, String p_177178_3_) - { - String s = String.format("textures/models/armor/%s_layer_%d%s.png", new Object[] {p_177178_1_.getArmorMaterial().getName(), Integer.valueOf(p_177178_2_ ? 2 : 1), p_177178_3_ == null ? "" : String.format("_%s", new Object[]{p_177178_3_})}); -@@ -162,4 +162,49 @@ - protected abstract void initArmor(); - - protected abstract void func_188359_a(T p_188359_1_, EntityEquipmentSlot p_188359_2_); -+ -+ /*=================================== FORGE START =========================================*/ -+ -+ /** -+ * Hook to allow item-sensitive armor model. for LayerBipedArmor. -+ */ -+ protected T getArmorModelHook(EntityLivingBase entity, ItemStack itemStack, EntityEquipmentSlot slot, T model) -+ { -+ return model; -+ } -+ -+ /** -+ * More generic ForgeHook version of the above function, it allows for Items to have more control over what texture they provide. -+ * -+ * @param entity Entity wearing the armor -+ * @param stack ItemStack for the armor -+ * @param slot Slot ID that the item is in -+ * @param type Subtype, can be null or "overlay" -+ * @return ResourceLocation pointing at the armor's texture -+ */ -+ public ResourceLocation getArmorResource(net.minecraft.entity.Entity entity, ItemStack stack, EntityEquipmentSlot slot, String type) -+ { -+ ItemArmor item = (ItemArmor)stack.getItem(); -+ String texture = item.getArmorMaterial().getName(); -+ String domain = "minecraft"; -+ int idx = texture.indexOf(':'); -+ if (idx != -1) -+ { -+ domain = texture.substring(0, idx); -+ texture = texture.substring(idx + 1); -+ } -+ String s1 = String.format("%s:textures/models/armor/%s_layer_%d%s.png", domain, texture, (func_188363_b(slot) ? 2 : 1), type == null ? "" : String.format("_%s", type)); -+ -+ s1 = net.minecraftforge.client.ForgeHooksClient.getArmorTexture(entity, stack, s1, slot, type); -+ ResourceLocation resourcelocation = (ResourceLocation)ARMOR_TEXTURE_RES_MAP.get(s1); -+ -+ if (resourcelocation == null) -+ { -+ resourcelocation = new ResourceLocation(s1); -+ ARMOR_TEXTURE_RES_MAP.put(s1, resourcelocation); -+ } -+ -+ return resourcelocation; -+ } -+ /*=================================== FORGE END ===========================================*/ - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch deleted file mode 100644 index 854dd052a..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java -@@ -51,4 +51,10 @@ - { - p_177194_1_.setInvisible(false); - } -+ -+ @Override -+ protected ModelBiped getArmorModelHook(net.minecraft.entity.EntityLivingBase entity, net.minecraft.item.ItemStack itemStack, EntityEquipmentSlot slot, ModelBiped model) -+ { -+ return net.minecraftforge.client.ForgeHooksClient.getArmorModel(entity, itemStack, slot, model); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch deleted file mode 100644 index 7b10c36b2..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch +++ /dev/null @@ -1,36 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/texture/Stitcher.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/texture/Stitcher.java -@@ -56,18 +56,24 @@ - { - Stitcher.Holder[] astitcher$holder = (Stitcher.Holder[])this.setStitchHolders.toArray(new Stitcher.Holder[this.setStitchHolders.size()]); - Arrays.sort((Object[])astitcher$holder); -+ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Texture stitching", astitcher$holder.length); - - for (Stitcher.Holder stitcher$holder : astitcher$holder) - { -+ bar.step(stitcher$holder.getAtlasSprite().getIconName()); - if (!this.allocateSlot(stitcher$holder)) - { - String s = String.format("Unable to fit: %s - size: %dx%d - Maybe try a lowerresolution resourcepack?", new Object[] {stitcher$holder.getAtlasSprite().getIconName(), Integer.valueOf(stitcher$holder.getAtlasSprite().getIconWidth()), Integer.valueOf(stitcher$holder.getAtlasSprite().getIconHeight())}); -+ net.minecraftforge.fml.common.FMLLog.info(s); -+ for (Stitcher.Holder h : astitcher$holder) -+ net.minecraftforge.fml.common.FMLLog.info(" %s", h); - throw new StitcherException(stitcher$holder, s); - } - } - - this.currentWidth = MathHelper.roundUpToPowerOfTwo(this.currentWidth); - this.currentHeight = MathHelper.roundUpToPowerOfTwo(this.currentHeight); -+ net.minecraftforge.fml.common.ProgressManager.pop(bar); - } - - public List getStichSlots() -@@ -238,7 +244,7 @@ - - public String toString() - { -- return "Holder{width=" + this.width + ", height=" + this.height + '}'; -+ return "Holder{width=" + this.width + ", height=" + this.height + ", name=" + this.theTexture.getIconName() + '}'; - } - - public int compareTo(Stitcher.Holder p_compareTo_1_) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch deleted file mode 100644 index 8ca6b9f2f..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java -@@ -398,4 +398,30 @@ - { - return "TextureAtlasSprite{name=\'" + this.iconName + '\'' + ", frameCount=" + this.framesTextureData.size() + ", rotated=" + this.rotated + ", x=" + this.originX + ", y=" + this.originY + ", height=" + this.height + ", width=" + this.width + ", u0=" + this.minU + ", u1=" + this.maxU + ", v0=" + this.minV + ", v1=" + this.maxV + '}'; - } -+ -+ /*===================================== FORGE START =====================================*/ -+ /** -+ * The result of this function determines is the below 'load' function is called, and the -+ * default vanilla loading code is bypassed completely. -+ * @param manager -+ * @param location -+ * @return True to use your own custom load code and bypass vanilla loading. -+ */ -+ public boolean hasCustomLoader(net.minecraft.client.resources.IResourceManager manager, net.minecraft.util.ResourceLocation location) -+ { -+ return false; -+ } -+ -+ /** -+ * Load the specified resource as this sprite's data. -+ * Returning false from this function will prevent this icon from being stitched onto the master texture. -+ * @param manager Main resource manager -+ * @param location File resource location -+ * @return False to prevent this Icon from being stitched -+ */ -+ public boolean load(net.minecraft.client.resources.IResourceManager manager, net.minecraft.util.ResourceLocation location) -+ { -+ return true; -+ } -+ /*===================================== FORGE END ======================================*/ - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch deleted file mode 100644 index 62022a2a2..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureManager.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureManager.java -@@ -137,9 +137,12 @@ - - public void onResourceManagerReload(IResourceManager resourceManager) - { -+ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Reloading Texture Manager", this.mapTextureObjects.keySet().size(), true); - for (Entry entry : this.mapTextureObjects.entrySet()) - { -+ bar.step(entry.getKey().toString()); - this.loadTexture((ResourceLocation)entry.getKey(), (ITextureObject)entry.getValue()); - } -+ net.minecraftforge.fml.common.ProgressManager.pop(bar); - } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch deleted file mode 100644 index 7d50d7685..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch +++ /dev/null @@ -1,176 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureMap.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureMap.java -@@ -26,6 +26,7 @@ - @SideOnly(Side.CLIENT) - public class TextureMap extends AbstractTexture implements ITickableTextureObject - { -+ private static final boolean ENABLE_SKIP = Boolean.parseBoolean(System.getProperty("fml.skipFirstTextureLoad", "true")); - private static final Logger logger = LogManager.getLogger(); - public static final ResourceLocation LOCATION_MISSING_TEXTURE = new ResourceLocation("missingno"); - public static final ResourceLocation locationBlocksTexture = new ResourceLocation("textures/atlas/blocks.png"); -@@ -36,6 +37,7 @@ - private final IIconCreator iconCreator; - private int mipmapLevels; - private final TextureAtlasSprite missingImage; -+ private boolean skipFirst = false; - - public TextureMap(String p_i46099_1_) - { -@@ -44,12 +46,23 @@ - - public TextureMap(String p_i46100_1_, IIconCreator iconCreatorIn) - { -+ this(p_i46100_1_, iconCreatorIn, false); -+ } -+ -+ public TextureMap(String p_i46100_1_, boolean skipFirst) -+ { -+ this(p_i46100_1_, null, skipFirst); -+ } -+ -+ public TextureMap(String p_i46100_1_, IIconCreator iconCreatorIn, boolean skipFirst) -+ { - this.listAnimatedSprites = Lists.newArrayList(); - this.mapRegisteredSprites = Maps.newHashMap(); - this.mapUploadedSprites = Maps.newHashMap(); - this.missingImage = new TextureAtlasSprite("missingno"); - this.basePath = p_i46100_1_; - this.iconCreator = iconCreatorIn; -+ this.skipFirst = skipFirst && ENABLE_SKIP; - } - - private void initMissingImage() -@@ -88,12 +101,26 @@ - int j = Integer.MAX_VALUE; - int k = 1 << this.mipmapLevels; - -+ net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPre(this); -+ net.minecraftforge.fml.common.FMLLog.info("Max texture size: %d", i); -+ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Texture stitching", skipFirst ? 0 : this.mapRegisteredSprites.size()); -+ -+ if(!skipFirst) - for (Entry entry : this.mapRegisteredSprites.entrySet()) - { - TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)entry.getValue(); - ResourceLocation resourcelocation = this.func_184396_a(textureatlassprite); -+ bar.step(resourcelocation.getResourcePath()); - IResource iresource = null; - -+ if (textureatlassprite.hasCustomLoader(resourceManager, resourcelocation)) -+ { -+ if (textureatlassprite.load(resourceManager, resourcelocation)) -+ { -+ continue; -+ } -+ } -+ else - try - { - PngSizeInfo pngsizeinfo = PngSizeInfo.func_188532_a(resourceManager.getResource(resourcelocation)); -@@ -103,12 +130,14 @@ - } - catch (RuntimeException runtimeexception) - { -- logger.error((String)("Unable to parse metadata from " + resourcelocation), (Throwable)runtimeexception); -+ //logger.error((String)("Unable to parse metadata from " + resourcelocation), (Throwable)runtimeexception); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().trackBrokenTexture(resourcelocation, runtimeexception.getMessage()); - continue; - } - catch (IOException ioexception) - { -- logger.error((String)("Using missing texture, unable to load " + resourcelocation), (Throwable)ioexception); -+ //logger.error((String)("Using missing texture, unable to load " + resourcelocation), (Throwable)ioexception); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().trackMissingTexture(resourcelocation); - continue; - } - finally -@@ -128,6 +157,7 @@ - stitcher.addSprite(textureatlassprite); - } - -+ net.minecraftforge.fml.common.ProgressManager.pop(bar); - int l = Math.min(j, k); - int i1 = MathHelper.calculateLogBaseTwo(l); - -@@ -139,9 +169,12 @@ - - this.missingImage.generateMipmaps(this.mipmapLevels); - stitcher.addSprite(this.missingImage); -+ skipFirst = false; -+ bar = net.minecraftforge.fml.common.ProgressManager.push("Texture creation", 2); - - try - { -+ bar.step("Stitching"); - stitcher.doStitch(); - } - catch (StitcherException stitcherexception) -@@ -150,11 +183,16 @@ - } - - logger.info("Created: {}x{} {}-atlas", new Object[] {Integer.valueOf(stitcher.getCurrentWidth()), Integer.valueOf(stitcher.getCurrentHeight()), this.basePath}); -+ bar.step("Allocating GL texture"); - TextureUtil.allocateTextureImpl(this.getGlTextureId(), this.mipmapLevels, stitcher.getCurrentWidth(), stitcher.getCurrentHeight()); - Map map = Maps.newHashMap(this.mapRegisteredSprites); - -+ net.minecraftforge.fml.common.ProgressManager.pop(bar); -+ bar = net.minecraftforge.fml.common.ProgressManager.push("Texture mipmap and upload", stitcher.getStichSlots().size()); -+ - for (TextureAtlasSprite textureatlassprite1 : stitcher.getStichSlots()) - { -+ bar.step(textureatlassprite1.getIconName()); - if (textureatlassprite1 == this.missingImage || this.func_184397_a(resourceManager, textureatlassprite1)) - { - String s = textureatlassprite1.getIconName(); -@@ -185,6 +223,13 @@ - { - textureatlassprite2.copyFrom(this.missingImage); - } -+ -+ net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPost(this); -+ -+ // TextureUtil.saveGlTexture is gone, FIXME -+ //if (!net.minecraftforge.common.ForgeModContainer.disableStitchedFileSaving) -+ //TextureUtil.saveGlTexture(this.basePath.replaceAll("/", "_"), this.getGlTextureId(), this.mipmapLevels, stitcher.getCurrentWidth(), stitcher.getCurrentHeight()); -+ net.minecraftforge.fml.common.ProgressManager.pop(bar); - } - - private boolean func_184397_a(IResourceManager p_184397_1_, final TextureAtlasSprite p_184397_2_) -@@ -317,4 +362,37 @@ - { - return this.missingImage; - } -+ -+ //=================================================================================================== -+ // Forge Start -+ //=================================================================================================== -+ /** -+ * Grabs the registered entry for the specified name, returning null if there was not a entry. -+ * Opposed to registerIcon, this will not instantiate the entry, useful to test if a mapping exists. -+ * -+ * @param name The name of the entry to find -+ * @return The registered entry, null if nothing was registered. -+ */ -+ public TextureAtlasSprite getTextureExtry(String name) -+ { -+ return (TextureAtlasSprite)mapRegisteredSprites.get(name); -+ } -+ -+ /** -+ * Adds a texture registry entry to this map for the specified name if one does not already exist. -+ * Returns false if the map already contains a entry for the specified name. -+ * -+ * @param name Entry name -+ * @param entry Entry instance -+ * @return True if the entry was added to the map, false otherwise. -+ */ -+ public boolean setTextureEntry(String name, TextureAtlasSprite entry) -+ { -+ if (!mapRegisteredSprites.containsKey(name)) -+ { -+ mapRegisteredSprites.put(name, entry); -+ return true; -+ } -+ return false; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch deleted file mode 100644 index b561d5a3d..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java -@@ -202,9 +202,11 @@ - - public static void allocateTextureImpl(int p_180600_0_, int p_180600_1_, int p_180600_2_, int p_180600_3_) - { -+ synchronized (net.minecraftforge.fml.client.SplashProgress.class) -+ { - deleteTexture(p_180600_0_); - bindTexture(p_180600_0_); -- -+ } - if (p_180600_1_ >= 0) - { - GlStateManager.func_187421_b(3553, 33085, p_180600_1_); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch deleted file mode 100644 index 0b6520ff8..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java -@@ -105,15 +105,18 @@ - GlStateManager.disableLighting(); - int i = itemFrame.getRotation(); - -- if (item == Items.filled_map) -+ if (item instanceof net.minecraft.item.ItemMap) - { - i = i % 4 * 2; - } - - GlStateManager.rotate((float)i * 360.0F / 8.0F, 0.0F, 0.0F, 1.0F); - -- if (item == Items.filled_map) -+ net.minecraftforge.client.event.RenderItemInFrameEvent event = new net.minecraftforge.client.event.RenderItemInFrameEvent(itemFrame, this); -+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) - { -+ if (item instanceof net.minecraft.item.ItemMap) -+ { - this.renderManager.renderEngine.bindTexture(mapBackgroundTextures); - GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); - float f = 0.0078125F; -@@ -142,6 +145,7 @@ - RenderHelper.disableStandardItemLighting(); - GlStateManager.popAttrib(); - } -+ } - - GlStateManager.enableLighting(); - GlStateManager.popMatrix(); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch deleted file mode 100644 index bd351608e..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java -@@ -98,6 +98,7 @@ - { - TileEntityRendererDispatcher.instance.renderTileEntityAt(this.field_147718_c, 0.0D, 0.0D, 0.0D, 0.0F); - } -+ else if (block != Blocks.chest) net.minecraftforge.client.ForgeHooksClient.renderTileItem(itemStackIn.getItem(), itemStackIn.getMetadata()); - else - { - TileEntityRendererDispatcher.instance.renderTileEntityAt(this.field_147717_b, 0.0D, 0.0D, 0.0D, 0.0F); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityPistonRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityPistonRenderer.java.patch deleted file mode 100644 index c78c4ad82..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityPistonRenderer.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/TileEntityPistonRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/TileEntityPistonRenderer.java -@@ -23,10 +23,11 @@ - @SideOnly(Side.CLIENT) - public class TileEntityPistonRenderer extends TileEntitySpecialRenderer - { -- private final BlockRendererDispatcher blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher(); -+ private BlockRendererDispatcher blockRenderer; - - public void renderTileEntityAt(TileEntityPiston te, double x, double y, double z, float partialTicks, int destroyStage) - { -+ if(blockRenderer == null) blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher(); - BlockPos blockpos = te.getPos(); - IBlockState iblockstate = te.getPistonState(); - Block block = iblockstate.getBlock(); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch deleted file mode 100644 index d6b642afd..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch +++ /dev/null @@ -1,79 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java -@@ -106,11 +106,14 @@ - { - if (tileentityIn.getDistanceSq(this.entityX, this.entityY, this.entityZ) < tileentityIn.getMaxRenderDistanceSquared()) - { -+ if(!tileentityIn.hasFastRenderer()) -+ { - int i = this.worldObj.getCombinedLight(tileentityIn.getPos(), 0); - int j = i % 65536; - int k = i / 65536; - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j, (float)k); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); -+ } - BlockPos blockpos = tileentityIn.getPos(); - this.renderTileEntityAt(tileentityIn, (double)blockpos.getX() - staticPlayerX, (double)blockpos.getY() - staticPlayerY, (double)blockpos.getZ() - staticPlayerZ, partialTicks, destroyStage); - } -@@ -129,6 +132,11 @@ - { - try - { -+ if(tileEntityIn.hasFastRenderer()) -+ { -+ tileentityspecialrenderer.renderTileEntityFast(tileEntityIn, x, y, z, partialTicks, destroyStage, batchBuffer.getWorldRenderer()); -+ } -+ else - tileentityspecialrenderer.renderTileEntityAt(tileEntityIn, x, y, z, partialTicks, destroyStage); - } - catch (Throwable throwable) -@@ -155,4 +163,49 @@ - { - return this.fontRenderer; - } -+ -+ /* ======================================== FORGE START =====================================*/ -+ /** -+ * Buffer used for batched TESRs -+ */ -+ private net.minecraft.client.renderer.Tessellator batchBuffer = new net.minecraft.client.renderer.Tessellator(0x200000); -+ -+ /** -+ * Prepare for a batched TESR rendering. -+ * You probably shouldn't call this manually. -+ */ -+ public void preDrawBatch() -+ { -+ batchBuffer.getWorldRenderer().begin(org.lwjgl.opengl.GL11.GL_QUADS, net.minecraft.client.renderer.vertex.DefaultVertexFormats.BLOCK); -+ } -+ -+ /** -+ * Render all TESRs batched so far. -+ * You probably shouldn't call this manually. -+ */ -+ public void drawBatch(int pass) -+ { -+ renderEngine.bindTexture(net.minecraft.client.renderer.texture.TextureMap.locationBlocksTexture); -+ net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting(); -+ GlStateManager.blendFunc(org.lwjgl.opengl.GL11.GL_SRC_ALPHA, org.lwjgl.opengl.GL11.GL_ONE_MINUS_SRC_ALPHA); -+ GlStateManager.enableBlend(); -+ GlStateManager.disableCull(); -+ -+ if (net.minecraft.client.Minecraft.isAmbientOcclusionEnabled()) -+ { -+ GlStateManager.shadeModel(org.lwjgl.opengl.GL11.GL_SMOOTH); -+ } -+ else -+ { -+ GlStateManager.shadeModel(org.lwjgl.opengl.GL11.GL_FLAT); -+ } -+ -+ if(pass > 0) -+ { -+ batchBuffer.getWorldRenderer().sortVertexData((float)staticPlayerX, (float)staticPlayerY, (float)staticPlayerZ); -+ } -+ batchBuffer.draw(); -+ -+ net.minecraft.client.renderer.RenderHelper.enableStandardItemLighting(); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer.java.patch deleted file mode 100644 index adf45bb4c..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer.java.patch +++ /dev/null @@ -1,9 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer.java -@@ -45,4 +45,6 @@ - { - return false; - } -+ -+ public void renderTileEntityFast(T te, double x, double y, double z, float partialTicks, int destroyStage, net.minecraft.client.renderer.VertexBuffer buffer) {} - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch deleted file mode 100644 index 664239ceb..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java -@@ -142,10 +142,17 @@ - NORMAL("Normal"), - COLOR("Vertex Color"), - UV("UV"), -+ // As of 1.8.8 - unused in vanilla; use GENERIC for now -+ @Deprecated - MATRIX("Bone Matrix"), -+ @Deprecated - BLEND_WEIGHT("Blend Weight"), -- PADDING("Padding"); -+ PADDING("Padding"), -+ GENERIC("Generic"); - -+ public void preDraw(VertexFormat format, int element, int stride, java.nio.ByteBuffer buffer) { net.minecraftforge.client.ForgeHooksClient.preDraw(this, format, element, stride, buffer); } -+ public void postDraw(VertexFormat format, int element, int stride, java.nio.ByteBuffer buffer) { net.minecraftforge.client.ForgeHooksClient.postDraw(this, format, element, stride, buffer); } -+ - private final String displayName; - - private EnumUsage(String displayNameIn) diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch deleted file mode 100644 index 2e4117099..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/resources/AbstractResourcePack.java -+++ ../src-work/minecraft/net/minecraft/client/resources/AbstractResourcePack.java -@@ -58,7 +58,7 @@ - - protected void logNameNotLowercase(String p_110594_1_) - { -- resourceLog.warn("ResourcePack: ignored non-lowercase namespace: %s in %s", new Object[] {p_110594_1_, this.resourcePackFile}); -+ resourceLog.warn("ResourcePack: ignored non-lowercase namespace: {} in {}", new Object[] {p_110594_1_, this.resourcePackFile}); - } - - public T getPackMetadata(IMetadataSerializer p_135058_1_, String p_135058_2_) throws IOException diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch deleted file mode 100644 index 89b1adcad..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/resources/FallbackResourceManager.java -+++ ../src-work/minecraft/net/minecraft/client/resources/FallbackResourceManager.java -@@ -68,6 +68,7 @@ - throw new FileNotFoundException(location.toString()); - } - -+ @SuppressWarnings("resource") - protected InputStream getInputStream(ResourceLocation location, IResourcePack resourcePack) throws IOException - { - InputStream inputstream = resourcePack.getInputStream(location); diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/LanguageManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/LanguageManager.java.patch deleted file mode 100644 index e4bd44cd8..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/resources/LanguageManager.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/resources/LanguageManager.java -+++ ../src-work/minecraft/net/minecraft/client/resources/LanguageManager.java -@@ -73,6 +73,7 @@ - } - - currentLocale.loadLocaleDataFiles(resourceManager, list); -+ net.minecraftforge.fml.common.registry.LanguageRegistry.instance().mergeLanguageTable(currentLocale.properties, this.currentLanguage); - LanguageMap.replaceWith(currentLocale.properties); - } - diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/Locale.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/Locale.java.patch deleted file mode 100644 index c6fcea8cd..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/resources/Locale.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/resources/Locale.java -+++ ../src-work/minecraft/net/minecraft/client/resources/Locale.java -@@ -95,6 +95,8 @@ - - private void loadLocaleData(InputStream p_135021_1_) throws IOException - { -+ p_135021_1_ = net.minecraftforge.fml.common.FMLCommonHandler.instance().loadLanguage(properties, p_135021_1_); -+ if (p_135021_1_ == null) return; - for (String s : IOUtils.readLines(p_135021_1_, Charsets.UTF_8)) - { - if (!s.isEmpty() && s.charAt(0) != 35) diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch deleted file mode 100644 index 061a43cc3..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java -+++ ../src-work/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java -@@ -92,6 +92,7 @@ - public void reloadResources(List p_110541_1_) - { - this.clearResources(); -+ net.minecraftforge.fml.common.ProgressManager.ProgressBar resReload = net.minecraftforge.fml.common.ProgressManager.push("Loading Resources", p_110541_1_.size()+1, true); - logger.info("Reloading ResourceManager: " + joinerResourcePacks.join(Iterables.transform(p_110541_1_, new Function() - { - public String apply(IResourcePack p_apply_1_) -@@ -102,23 +103,32 @@ - - for (IResourcePack iresourcepack : p_110541_1_) - { -+ resReload.step(iresourcepack.getPackName()); - this.reloadResourcePack(iresourcepack); - } - -+ resReload.step("Reloading listeners"); - this.notifyReloadListeners(); -+ net.minecraftforge.fml.common.ProgressManager.pop(resReload); - } - - public void registerReloadListener(IResourceManagerReloadListener reloadListener) - { -+ net.minecraftforge.fml.common.ProgressManager.ProgressBar resReload = net.minecraftforge.fml.common.ProgressManager.push("Loading Resource", 1); -+ resReload.step(reloadListener.getClass()); - this.reloadListeners.add(reloadListener); - reloadListener.onResourceManagerReload(this); -+ net.minecraftforge.fml.common.ProgressManager.pop(resReload); - } - - private void notifyReloadListeners() - { -+ net.minecraftforge.fml.common.ProgressManager.ProgressBar resReload = net.minecraftforge.fml.common.ProgressManager.push("Reloading", this.reloadListeners.size()); - for (IResourceManagerReloadListener iresourcemanagerreloadlistener : this.reloadListeners) - { -+ resReload.step(iresourcemanagerreloadlistener.getClass()); - iresourcemanagerreloadlistener.onResourceManagerReload(this); - } -+ net.minecraftforge.fml.common.ProgressManager.pop(resReload); - } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/settings/GameSettings.java.patch b/patches.mcp/minecraft/net/minecraft/client/settings/GameSettings.java.patch deleted file mode 100644 index df746d5ea..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/settings/GameSettings.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/settings/GameSettings.java -+++ ../src-work/minecraft/net/minecraft/client/settings/GameSettings.java -@@ -887,6 +887,7 @@ - - public void saveOptions() - { -+ if (net.minecraftforge.fml.client.FMLClientHandler.instance().isLoading()) return; - try - { - PrintWriter printwriter = new PrintWriter(new FileWriter(this.optionsFile)); diff --git a/patches.mcp/minecraft/net/minecraft/client/shader/Framebuffer.java.patch b/patches.mcp/minecraft/net/minecraft/client/shader/Framebuffer.java.patch deleted file mode 100644 index a32bd143c..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/shader/Framebuffer.java.patch +++ /dev/null @@ -1,57 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/shader/Framebuffer.java -+++ ../src-work/minecraft/net/minecraft/client/shader/Framebuffer.java -@@ -118,8 +118,17 @@ - if (this.useDepth) - { - OpenGlHelper.glBindRenderbuffer(OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer); -+ if (!this.stencilEnabled) -+ { - OpenGlHelper.glRenderbufferStorage(OpenGlHelper.GL_RENDERBUFFER, 33190, this.framebufferTextureWidth, this.framebufferTextureHeight); - OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_DEPTH_ATTACHMENT, OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer); -+ } -+ else -+ { -+ OpenGlHelper.glRenderbufferStorage(OpenGlHelper.GL_RENDERBUFFER, org.lwjgl.opengl.EXTPackedDepthStencil.GL_DEPTH24_STENCIL8_EXT, this.framebufferTextureWidth, this.framebufferTextureHeight); -+ OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, org.lwjgl.opengl.EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer); -+ OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, org.lwjgl.opengl.EXTFramebufferObject.GL_STENCIL_ATTACHMENT_EXT, OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer); -+ } - } - - this.framebufferClear(); -@@ -279,4 +288,36 @@ - GlStateManager.clear(i); - this.unbindFramebuffer(); - } -+ -+ /*================================ FORGE START ================================================*/ -+ private boolean stencilEnabled = false; -+ /** -+ * Attempts to enabled 8 bits of stencil buffer on this FrameBuffer. -+ * Modders must call this directly to set things up. -+ * This is to prevent the default cause where graphics cards do not support stencil bits. -+ * Modders should check the below 'isStencilEnabled' to check if another modder has already enabled them. -+ * -+ * Note: -+ * As of now the only thing that is checked is if FBOs are supported entirely, in the future -+ * we may expand to check for errors. -+ * -+ * @return True if the FBO was re-initialized with stencil bits. -+ */ -+ public boolean enableStencil() -+ { -+ if (!OpenGlHelper.isFramebufferEnabled()) return false; -+ stencilEnabled = true; -+ this.createBindFramebuffer(framebufferWidth, framebufferHeight); -+ return true; //TODO: Find a way to detect if this failed? -+ } -+ -+ /** -+ * Returns wither or not this FBO has been successfully initialized with stencil bits. -+ * If not, and a modder wishes it to be, they must call enableStencil. -+ */ -+ public boolean isStencilEnabled() -+ { -+ return this.stencilEnabled; -+ } -+ /*================================ FORGE END ================================================*/ - } diff --git a/patches.mcp/minecraft/net/minecraft/command/CommandBase.java.patch b/patches.mcp/minecraft/net/minecraft/command/CommandBase.java.patch deleted file mode 100644 index 008a1bb21..000000000 --- a/patches.mcp/minecraft/net/minecraft/command/CommandBase.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/command/CommandBase.java -+++ ../src-work/minecraft/net/minecraft/command/CommandBase.java -@@ -369,7 +369,7 @@ - itextcomponent.appendText(" "); - } - -- ITextComponent itextcomponent1 = new TextComponentString(args[i]); -+ ITextComponent itextcomponent1 = net.minecraftforge.common.ForgeHooks.newChatWithLinks(args[i]); // Forge: links for messages - - if (p_147176_3_) - { diff --git a/patches.mcp/minecraft/net/minecraft/command/CommandEnchant.java.patch b/patches.mcp/minecraft/net/minecraft/command/CommandEnchant.java.patch deleted file mode 100644 index 20f6093fd..000000000 --- a/patches.mcp/minecraft/net/minecraft/command/CommandEnchant.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/command/CommandEnchant.java -+++ ../src-work/minecraft/net/minecraft/command/CommandEnchant.java -@@ -85,7 +85,7 @@ - { - Enchantment enchantment1 = Enchantment.func_185262_c(k); - -- if (!enchantment.canApplyTogether(enchantment1)) -+ if (!enchantment.canApplyTogether(enchantment1) || !enchantment1.canApplyTogether(enchantment)) //Forge BugFix: Let Both enchantments veto being together - { - throw new CommandException("commands.enchant.cantCombine", new Object[] {enchantment.getTranslatedName(i), enchantment1.getTranslatedName(nbttaglist.getCompoundTagAt(j).getShort("lvl"))}); - } diff --git a/patches.mcp/minecraft/net/minecraft/command/CommandFill.java.patch b/patches.mcp/minecraft/net/minecraft/command/CommandFill.java.patch deleted file mode 100644 index 94ffd1431..000000000 --- a/patches.mcp/minecraft/net/minecraft/command/CommandFill.java.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/command/CommandFill.java -+++ ../src-work/minecraft/net/minecraft/command/CommandFill.java -@@ -50,6 +50,7 @@ - { - i = parseInt(p_184881_3_[7], 0, 15); - } -+ IBlockState state = block.getStateFromMeta(i); - - BlockPos blockpos2 = new BlockPos(Math.min(blockpos.getX(), blockpos1.getX()), Math.min(blockpos.getY(), blockpos1.getY()), Math.min(blockpos.getZ(), blockpos1.getZ())); - BlockPos blockpos3 = new BlockPos(Math.max(blockpos.getX(), blockpos1.getX()), Math.max(blockpos.getY(), blockpos1.getY()), Math.max(blockpos.getZ(), blockpos1.getZ())); -@@ -77,7 +78,7 @@ - NBTTagCompound nbttagcompound = new NBTTagCompound(); - boolean flag = false; - -- if (p_184881_3_.length >= 10 && block.hasTileEntity()) -+ if (p_184881_3_.length >= 10 && block.hasTileEntity(state)) - { - String s = getChatComponentFromNthArg(p_184881_2_, p_184881_3_, 9).getUnformattedText(); - -@@ -118,7 +119,7 @@ - continue; - } - } -- else if (p_184881_3_[8].equals("replace") && !block.hasTileEntity()) -+ else if (p_184881_3_[8].equals("replace") && !block.hasTileEntity(state)) - { - if (p_184881_3_.length > 9) - { diff --git a/patches.mcp/minecraft/net/minecraft/command/CommandHandler.java.patch b/patches.mcp/minecraft/net/minecraft/command/CommandHandler.java.patch deleted file mode 100644 index 7afcafd3c..000000000 --- a/patches.mcp/minecraft/net/minecraft/command/CommandHandler.java.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/command/CommandHandler.java -+++ ../src-work/minecraft/net/minecraft/command/CommandHandler.java -@@ -46,6 +46,16 @@ - } - else if (icommand.func_184882_a(this.func_184879_a(), sender)) - { -+ net.minecraftforge.event.CommandEvent event = new net.minecraftforge.event.CommandEvent(icommand, sender, astring); -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) -+ { -+ if (event.exception != null) -+ { -+ com.google.common.base.Throwables.propagateIfPossible(event.exception); -+ } -+ return 1; -+ } -+ - if (i > -1) - { - List list = EntitySelector.matchEntities(sender, astring[i], Entity.class); -@@ -109,7 +119,7 @@ - TextComponentTranslation textcomponenttranslation = new TextComponentTranslation("commands.generic.exception", new Object[0]); - textcomponenttranslation.getChatStyle().setColor(TextFormatting.RED); - sender.addChatMessage(textcomponenttranslation); -- logger.warn("Couldn\'t process command: \'" + input + "\'"); -+ logger.warn("Couldn\'t process command: \'" + input + "\'", var9); - } - - return false; diff --git a/patches.mcp/minecraft/net/minecraft/command/EntitySelector.java.patch b/patches.mcp/minecraft/net/minecraft/command/EntitySelector.java.patch deleted file mode 100644 index 0d8cb8557..000000000 --- a/patches.mcp/minecraft/net/minecraft/command/EntitySelector.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/command/EntitySelector.java -+++ ../src-work/minecraft/net/minecraft/command/EntitySelector.java -@@ -36,9 +36,9 @@ - - public class EntitySelector - { -- private static final Pattern tokenPattern = Pattern.compile("^@([pare])(?:\\[([\\w=,!-]*)\\])?$"); -+ private static final Pattern tokenPattern = Pattern.compile("^@([pare])(?:\\[([\\w\\.=,!-]*)\\])?$"); // FORGE: allow . in entity selectors - private static final Pattern intListPattern = Pattern.compile("\\G([-!]?[\\w-]*)(?:$|,)"); -- private static final Pattern keyValueListPattern = Pattern.compile("\\G(\\w+)=([-!]?[\\w-]*)(?:$|,)"); -+ private static final Pattern keyValueListPattern = Pattern.compile("\\G(\\w+)=([-!]?[\\w\\.-]*)(?:$|,)"); // FORGE: allow . in entity selectors - private static final Set WORLD_BINDING_ARGS = Sets.newHashSet(new String[] {"x", "y", "z", "dx", "dy", "dz", "rm", "r"}); - - public static EntityPlayerMP matchOnePlayer(ICommandSender sender, String token) diff --git a/patches.mcp/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch b/patches.mcp/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch deleted file mode 100644 index 07a4ff394..000000000 --- a/patches.mcp/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/command/server/CommandSetBlock.java -+++ ../src-work/minecraft/net/minecraft/command/server/CommandSetBlock.java -@@ -54,6 +54,8 @@ - i = parseInt(p_184881_3_[4], 0, 15); - } - -+ IBlockState state = block.getStateFromMeta(i); -+ - World world = p_184881_2_.getEntityWorld(); - - if (!world.isBlockLoaded(blockpos)) -@@ -65,7 +67,7 @@ - NBTTagCompound nbttagcompound = new NBTTagCompound(); - boolean flag = false; - -- if (p_184881_3_.length >= 7 && block.hasTileEntity()) -+ if (p_184881_3_.length >= 7 && block.hasTileEntity(state)) - { - String s = getChatComponentFromNthArg(p_184881_2_, p_184881_3_, 6).getUnformattedText(); - diff --git a/patches.mcp/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch b/patches.mcp/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch deleted file mode 100644 index e5f4feaa6..000000000 --- a/patches.mcp/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/command/server/CommandTestForBlock.java -+++ ../src-work/minecraft/net/minecraft/command/server/CommandTestForBlock.java -@@ -72,7 +72,7 @@ - NBTTagCompound nbttagcompound = new NBTTagCompound(); - boolean flag = false; - -- if (p_184881_3_.length >= 6 && block.hasTileEntity()) -+ if (p_184881_3_.length >= 6 && block.hasTileEntity(block.getStateFromMeta(i))) - { - String s = getChatComponentFromNthArg(p_184881_2_, p_184881_3_, 5).getUnformattedText(); - diff --git a/patches.mcp/minecraft/net/minecraft/crash/CrashReport.java.patch b/patches.mcp/minecraft/net/minecraft/crash/CrashReport.java.patch deleted file mode 100644 index 2ad18820d..000000000 --- a/patches.mcp/minecraft/net/minecraft/crash/CrashReport.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/crash/CrashReport.java -+++ ../src-work/minecraft/net/minecraft/crash/CrashReport.java -@@ -115,6 +115,7 @@ - return IntCache.getCacheSizes(); - } - }); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().enhanceCrashReport(this, this.theReportCategory); - } - - public String getDescription() -@@ -203,6 +204,8 @@ - { - StringBuilder stringbuilder = new StringBuilder(); - stringbuilder.append("---- Minecraft Crash Report ----\n"); -+ net.minecraftforge.fml.common.asm.transformers.BlamingTransformer.onCrash(stringbuilder); -+ net.minecraftforge.fml.relauncher.CoreModManager.onCrash(stringbuilder); - stringbuilder.append("// "); - stringbuilder.append(getWittyComment()); - stringbuilder.append("\n\n"); diff --git a/patches.mcp/minecraft/net/minecraft/crash/CrashReportCategory.java.patch b/patches.mcp/minecraft/net/minecraft/crash/CrashReportCategory.java.patch deleted file mode 100644 index babe95608..000000000 --- a/patches.mcp/minecraft/net/minecraft/crash/CrashReportCategory.java.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/crash/CrashReportCategory.java -+++ ../src-work/minecraft/net/minecraft/crash/CrashReportCategory.java -@@ -122,8 +122,11 @@ - } - else - { -- this.stackTrace = new StackTraceElement[astacktraceelement.length - 3 - size]; -- System.arraycopy(astacktraceelement, 3 + size, this.stackTrace, 0, this.stackTrace.length); -+ int len = astacktraceelement.length - 3 - size; -+ // Really Mojang, Still, god damn... -+ if (len <= 0) len = astacktraceelement.length; -+ this.stackTrace = new StackTraceElement[len]; -+ System.arraycopy(astacktraceelement, astacktraceelement.length - len, this.stackTrace, 0, this.stackTrace.length); - return this.stackTrace.length; - } - } diff --git a/patches.mcp/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch b/patches.mcp/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch deleted file mode 100644 index 83ecfbcea..000000000 --- a/patches.mcp/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch +++ /dev/null @@ -1,106 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/creativetab/CreativeTabs.java -+++ ../src-work/minecraft/net/minecraft/creativetab/CreativeTabs.java -@@ -125,8 +125,22 @@ - @SideOnly(Side.CLIENT) - private ItemStack iconItemStack; - -+ public CreativeTabs(String label) -+ { -+ this(getNextID(), label); -+ } -+ - public CreativeTabs(int index, String label) - { -+ if (index >= creativeTabArray.length) -+ { -+ CreativeTabs[] tmp = new CreativeTabs[index + 1]; -+ for (int x = 0; x < creativeTabArray.length; x++) -+ { -+ tmp[x] = creativeTabArray[x]; -+ } -+ creativeTabArray = tmp; -+ } - this.tabIndex = index; - this.tabLabel = label; - creativeTabArray[index] = this; -@@ -209,12 +223,20 @@ - @SideOnly(Side.CLIENT) - public int getTabColumn() - { -+ if (tabIndex > 11) -+ { -+ return ((tabIndex - 12) % 10) % 5; -+ } - return this.tabIndex % 6; - } - - @SideOnly(Side.CLIENT) - public boolean isTabInFirstRow() - { -+ if (tabIndex > 11) -+ { -+ return ((tabIndex - 12) % 10) < 5; -+ } - return this.tabIndex < 6; - } - -@@ -256,10 +278,17 @@ - { - for (Item item : Item.itemRegistry) - { -- if (item != null && item.getCreativeTab() == this) -+ if (item == null) - { -- item.getSubItems(item, this, p_78018_1_); -+ continue; - } -+ for (CreativeTabs tab : item.getCreativeTabs()) -+ { -+ if (tab == this) -+ { -+ item.getSubItems(item, this, p_78018_1_); -+ } -+ } - } - - if (this.getRelevantEnchantmentTypes() != null) -@@ -292,4 +321,39 @@ - } - } - } -+ -+ public int getTabPage() -+ { -+ if (tabIndex > 11) -+ { -+ return ((tabIndex - 12) / 10) + 1; -+ } -+ return 0; -+ } -+ -+ public static int getNextID() -+ { -+ return creativeTabArray.length; -+ } -+ -+ /** -+ * Determines if the search bar should be shown for this tab. -+ * -+ * @return True to show the bar -+ */ -+ public boolean hasSearchBar() -+ { -+ return tabIndex == CreativeTabs.tabAllSearch.tabIndex; -+ } -+ -+ /** -+ * Gets the width of the search bar of the creative tab, use this if your -+ * creative tab name overflows together with a custom texture. -+ * -+ * @return The width of the search bar, 89 by default -+ */ -+ public int getSearchbarWidth() -+ { -+ return 89; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/enchantment/Enchantment.java.patch b/patches.mcp/minecraft/net/minecraft/enchantment/Enchantment.java.patch deleted file mode 100644 index d6bac4889..000000000 --- a/patches.mcp/minecraft/net/minecraft/enchantment/Enchantment.java.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/enchantment/Enchantment.java -+++ ../src-work/minecraft/net/minecraft/enchantment/Enchantment.java -@@ -118,7 +118,7 @@ - - public boolean canApply(ItemStack stack) - { -- return this.type.canEnchantItem(stack.getItem()); -+ return canApplyAtEnchantingTable(stack); - } - - public void onEntityDamaged(EntityLivingBase user, Entity target, int level) -@@ -134,6 +134,26 @@ - return false; - } - -+ /** -+ * This applies specifically to applying at the enchanting table. The other method {@link #canApply(ItemStack)} -+ * applies for all possible enchantments. -+ * @param stack -+ * @return -+ */ -+ public boolean canApplyAtEnchantingTable(ItemStack stack) -+ { -+ return this.type.canEnchantItem(stack.getItem()); -+ } -+ -+ /** -+ * Is this enchantment allowed to be enchanted on books via Enchantment Table -+ * @return false to disable the vanilla feature -+ */ -+ public boolean isAllowedOnBooks() -+ { -+ return true; -+ } -+ - public static void func_185257_f() - { - EntityEquipmentSlot[] aentityequipmentslot = new EntityEquipmentSlot[] {EntityEquipmentSlot.HEAD, EntityEquipmentSlot.CHEST, EntityEquipmentSlot.LEGS, EntityEquipmentSlot.FEET}; diff --git a/patches.mcp/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch b/patches.mcp/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch deleted file mode 100644 index cf49768b5..000000000 --- a/patches.mcp/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/enchantment/EnchantmentHelper.java -+++ ../src-work/minecraft/net/minecraft/enchantment/EnchantmentHelper.java -@@ -292,7 +292,7 @@ - public static int calcItemStackEnchantability(Random p_77514_0_, int p_77514_1_, int p_77514_2_, ItemStack p_77514_3_) - { - Item item = p_77514_3_.getItem(); -- int i = item.getItemEnchantability(); -+ int i = item.getItemEnchantability(p_77514_3_); - - if (i <= 0) - { -@@ -339,7 +339,7 @@ - { - List list = Lists.newArrayList(); - Item item = itemStackIn.getItem(); -- int i = item.getItemEnchantability(); -+ int i = item.getItemEnchantability(itemStackIn); - - if (i <= 0) - { -@@ -380,7 +380,8 @@ - - while (iterator.hasNext()) - { -- if (!p_185282_1_.enchantmentobj.canApplyTogether(((EnchantmentData)iterator.next()).enchantmentobj)) -+ Enchantment e2 = iterator.next().enchantmentobj; -+ if (!p_185282_1_.enchantmentobj.canApplyTogether(e2) || !e2.canApplyTogether(p_185282_1_.enchantmentobj)) //Forge BugFix: Let Both enchantments veto being together - { - iterator.remove(); - } -@@ -395,7 +396,7 @@ - - for (Enchantment enchantment : Enchantment.field_185264_b) - { -- if ((!enchantment.func_185261_e() || p_185291_2_) && (enchantment.type.canEnchantItem(item) || flag)) -+ if ((!enchantment.func_185261_e() || p_185291_2_) && (enchantment.canApplyAtEnchantingTable(p_185291_1_) || (flag || enchantment.isAllowedOnBooks()))) - { - for (int i = enchantment.getMaxLevel(); i > enchantment.getMinLevel() - 1; --i) - { diff --git a/patches.mcp/minecraft/net/minecraft/entity/Entity.java.patch b/patches.mcp/minecraft/net/minecraft/entity/Entity.java.patch deleted file mode 100644 index 652a2ff6e..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/Entity.java.patch +++ /dev/null @@ -1,268 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/Entity.java -+++ ../src-work/minecraft/net/minecraft/entity/Entity.java -@@ -76,7 +76,7 @@ - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - --public abstract class Entity implements ICommandSender -+public abstract class Entity implements ICommandSender, net.minecraftforge.common.capabilities.ICapabilitySerializable - { - private static final Logger field_184243_a = LogManager.getLogger(); - private static final AxisAlignedBB ZERO_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); -@@ -195,8 +195,16 @@ - this.dataWatcher.func_187214_a(field_184242_az, ""); - this.dataWatcher.func_187214_a(field_184234_aB, Boolean.valueOf(false)); - this.entityInit(); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EntityConstructing(this)); -+ capabilities = net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(this); - } - -+ /** Forge: Used to store custom data for each entity. */ -+ private NBTTagCompound customEntityData; -+ public boolean captureDrops = false; -+ public java.util.ArrayList capturedDrops = new java.util.ArrayList(); -+ private net.minecraftforge.common.capabilities.CapabilityDispatcher capabilities; -+ - public int getEntityId() - { - return this.entityId; -@@ -1134,12 +1142,12 @@ - BlockPos blockpos = new BlockPos(this.posX, d0, this.posZ); - IBlockState iblockstate = this.worldObj.getBlockState(blockpos); - -+ Boolean result = iblockstate.getBlock().isEntityInsideMaterial(this.worldObj, blockpos, iblockstate, this, d0, materialIn, true); -+ if (result != null) return result; -+ - if (iblockstate.func_185904_a() == materialIn) - { -- float f = BlockLiquid.getLiquidHeightPercent(iblockstate.getBlock().getMetaFromState(iblockstate)) - 0.11111111F; -- float f1 = (float)(blockpos.getY() + 1) - f; -- boolean flag = d0 < (double)f1; -- return !flag && this instanceof EntityPlayer ? false : flag; -+ return net.minecraftforge.common.ForgeHooks.isInsideOfMaterial(materialIn, this, blockpos); - } - else - { -@@ -1534,6 +1542,9 @@ - tagCompund.setTag("Tags", nbttaglist); - } - -+ if (customEntityData != null) tagCompund.setTag("ForgeData", customEntityData); -+ if (this.capabilities != null) tagCompund.setTag("ForgeCaps", this.capabilities.serializeNBT()); -+ - this.writeEntityToNBT(tagCompund); - - if (this.func_184207_aI()) -@@ -1629,6 +1640,9 @@ - this.setSilent(tagCompund.getBoolean("Silent")); - this.func_184195_f(tagCompund.getBoolean("Glowing")); - -+ if (tagCompund.hasKey("ForgeData")) customEntityData = tagCompund.getCompoundTag("ForgeData"); -+ if (this.capabilities != null && tagCompund.hasKey("ForgeCaps")) this.capabilities.deserializeNBT(tagCompund.getCompoundTag("ForgeCaps")); -+ - if (tagCompund.hasKey("Tags", 9)) - { - this.field_184236_aF.clear(); -@@ -1715,7 +1729,10 @@ - { - EntityItem entityitem = new EntityItem(this.worldObj, this.posX, this.posY + (double)offsetY, this.posZ, itemStackIn); - entityitem.setDefaultPickupDelay(); -- this.worldObj.spawnEntityInWorld(entityitem); -+ if (captureDrops) -+ this.capturedDrops.add(entityitem); -+ else -+ this.worldObj.spawnEntityInWorld(entityitem); - return entityitem; - } - else -@@ -1824,6 +1841,7 @@ - - public boolean func_184205_a(Entity p_184205_1_, boolean p_184205_2_) - { -+ if (!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, p_184205_1_, true)) return false; - if (p_184205_2_ || this.func_184228_n(p_184205_1_) && p_184205_1_.func_184219_q(this)) - { - if (this.func_184218_aH()) -@@ -2279,6 +2297,7 @@ - { - if (!this.worldObj.isRemote && !this.isDead) - { -+ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_184204_1_)) return null; - this.worldObj.theProfiler.startSection("changeDimension"); - MinecraftServer minecraftserver = this.func_184102_h(); - int i = this.dimension; -@@ -2372,7 +2391,7 @@ - - public float getExplosionResistance(Explosion explosionIn, World worldIn, BlockPos pos, IBlockState blockStateIn) - { -- return blockStateIn.getBlock().getExplosionResistance(this); -+ return blockStateIn.getBlock().getExplosionResistance(worldIn, pos, this, explosionIn); - } - - public boolean verifyExplosion(Explosion explosionIn, World worldIn, BlockPos pos, IBlockState blockStateIn, float p_174816_5_) -@@ -2662,6 +2681,165 @@ - EnchantmentHelper.applyArthropodEnchantments(entityLivingBaseIn, entityIn); - } - -+ /* ================================== Forge Start =====================================*/ -+ /** -+ * Returns a NBTTagCompound that can be used to store custom data for this entity. -+ * It will be written, and read from disc, so it persists over world saves. -+ * @return A NBTTagCompound -+ */ -+ public NBTTagCompound getEntityData() -+ { -+ if (customEntityData == null) -+ { -+ customEntityData = new NBTTagCompound(); -+ } -+ return customEntityData; -+ } -+ -+ /** -+ * Used in model rendering to determine if the entity riding this entity should be in the 'sitting' position. -+ * @return false to prevent an entity that is mounted to this entity from displaying the 'sitting' animation. -+ */ -+ public boolean shouldRiderSit() -+ { -+ return true; -+ } -+ -+ /** -+ * Called when a user uses the creative pick block button on this entity. -+ * -+ * @param target The full target the player is looking at -+ * @return A ItemStack to add to the player's inventory, Null if nothing should be added. -+ */ -+ public ItemStack getPickedResult(RayTraceResult target) -+ { -+ if (this instanceof net.minecraft.entity.item.EntityPainting) -+ { -+ return new ItemStack(net.minecraft.init.Items.painting); -+ } -+ else if (this instanceof EntityLeashKnot) -+ { -+ return new ItemStack(net.minecraft.init.Items.lead); -+ } -+ else if (this instanceof net.minecraft.entity.item.EntityItemFrame) -+ { -+ ItemStack held = ((net.minecraft.entity.item.EntityItemFrame)this).getDisplayedItem(); -+ if (held == null) -+ { -+ return new ItemStack(net.minecraft.init.Items.item_frame); -+ } -+ else -+ { -+ return held.copy(); -+ } -+ } -+ else if (this instanceof net.minecraft.entity.item.EntityMinecart) -+ { -+ return ((net.minecraft.entity.item.EntityMinecart)this).getCartItem(); -+ } -+ else if (this instanceof net.minecraft.entity.item.EntityBoat) -+ { -+ return new ItemStack(((EntityBoat)this).func_184455_j()); -+ } -+ else if (this instanceof net.minecraft.entity.item.EntityArmorStand) -+ { -+ return new ItemStack(net.minecraft.init.Items.armor_stand); -+ } -+ else if (this instanceof net.minecraft.entity.item.EntityEnderCrystal) -+ { -+ return new ItemStack(net.minecraft.init.Items.field_185158_cP); -+ } -+ else -+ { -+ String name = EntityList.getEntityString(this); -+ if (EntityList.entityEggs.containsKey(name)) -+ { -+ ItemStack stack = new ItemStack(net.minecraft.init.Items.spawn_egg); -+ net.minecraft.item.ItemMonsterPlacer.func_185078_a(stack, name); -+ return stack; -+ } -+ } -+ return null; -+ } -+ -+ public UUID getPersistentID() -+ { -+ return entityUniqueID; -+ } -+ -+ /** -+ * Reset the entity ID to a new value. Not to be used from Mod code -+ */ -+ public final void resetEntityId() -+ { -+ this.entityId = nextEntityID++; -+ } -+ -+ public boolean shouldRenderInPass(int pass) -+ { -+ return pass == 0; -+ } -+ -+ /** -+ * Returns true if the entity is of the @link{EnumCreatureType} provided -+ * @param type The EnumCreatureType type this entity is evaluating -+ * @param forSpawnCount If this is being invoked to check spawn count caps. -+ * @return If the creature is of the type provided -+ */ -+ public boolean isCreatureType(EnumCreatureType type, boolean forSpawnCount) -+ { -+ if (forSpawnCount && (this instanceof EntityLiving) && ((EntityLiving)this).isNoDespawnRequired()) return false; -+ return type.getCreatureClass().isAssignableFrom(this.getClass()); -+ } -+ -+ /** -+ * If a rider of this entity can interact with this entity. Should return true on the -+ * ridden entity if so. -+ * -+ * @return if the entity can be interacted with from a rider -+ */ -+ public boolean canRiderInteract() -+ { -+ return false; -+ } -+ -+ /** -+ * If the rider should be dismounted from the entity when the entity goes under water -+ * -+ * @param rider The entity that is riding -+ * @return if the entity should be dismounted when under water -+ */ -+ public boolean shouldDismountInWater(Entity rider) -+ { -+ return this instanceof EntityLivingBase; -+ } -+ -+ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) -+ { -+ if (getCapability(capability, facing) != null) -+ return true; -+ return capabilities == null ? false : capabilities.hasCapability(capability, facing); -+ } -+ -+ public T getCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) -+ { -+ return capabilities == null ? null : capabilities.getCapability(capability, facing); -+ } -+ -+ public void deserializeNBT(NBTTagCompound nbt) -+ { -+ this.readFromNBT(nbt); -+ } -+ -+ public NBTTagCompound serializeNBT() -+ { -+ NBTTagCompound ret = new NBTTagCompound(); -+ ret.setString("id", this.getEntityString()); -+ this.writeToNBT(ret); -+ return ret; -+ } -+ /* ================================== Forge End =====================================*/ -+ - public void func_184178_b(EntityPlayerMP p_184178_1_) - { - } diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityHanging.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityHanging.java.patch deleted file mode 100644 index e92e37ef7..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/EntityHanging.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/EntityHanging.java -+++ ../src-work/minecraft/net/minecraft/entity/EntityHanging.java -@@ -139,6 +139,9 @@ - BlockPos blockpos1 = blockpos.offset(enumfacing, k + i1).up(l + j1); - IBlockState iblockstate = this.worldObj.getBlockState(blockpos1); - -+ if (iblockstate.isSideSolid(this.worldObj, blockpos1, this.facingDirection)) -+ continue; -+ - if (!iblockstate.func_185904_a().isSolid() && !BlockRedstoneDiode.func_185546_B(iblockstate)) - { - return false; diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityList.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityList.java.patch deleted file mode 100644 index a795edd30..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/EntityList.java.patch +++ /dev/null @@ -1,40 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/EntityList.java -+++ ../src-work/minecraft/net/minecraft/entity/EntityList.java -@@ -91,6 +91,7 @@ - - public static void addMapping(Class entityClass, String entityName, int id) - { -+ if (id < 0 || id > 255) throw new IllegalArgumentException("Attempted to register a entity with invalid ID: " + id + " Name: " + entityName + " Class: " + entityClass); - if (stringToClassMapping.containsKey(entityName)) - { - throw new IllegalArgumentException("ID is already registered: " + entityName); -@@ -148,9 +149,10 @@ - { - Entity entity = null; - -+ Class oclass = null; - try - { -- Class oclass = (Class)stringToClassMapping.get(nbt.getString("id")); -+ oclass = stringToClassMapping.get(nbt.getString("id")); - - if (oclass != null) - { -@@ -164,7 +166,17 @@ - - if (entity != null) - { -+ try -+ { - entity.readFromNBT(nbt); -+ } -+ catch (Exception e) -+ { -+ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e, -+ "An Entity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author", -+ nbt.getString("id"), oclass.getName()); -+ entity = null; -+ } - } - else - { diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityLiving.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityLiving.java.patch deleted file mode 100644 index ab82bb636..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/EntityLiving.java.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/EntityLiving.java -+++ ../src-work/minecraft/net/minecraft/entity/EntityLiving.java -@@ -171,6 +171,7 @@ - public void setAttackTarget(EntityLivingBase entitylivingbaseIn) - { - this.attackTarget = entitylivingbaseIn; -+ net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(this, entitylivingbaseIn); - } - - public boolean canAttackClass(Class cls) -@@ -699,10 +700,22 @@ - - protected void despawnEntity() - { -+ net.minecraftforge.fml.common.eventhandler.Event.Result result = null; - if (this.persistenceRequired) - { - this.entityAge = 0; - } -+ else if ((this.entityAge & 0x1F) == 0x1F && (result = net.minecraftforge.event.ForgeEventFactory.canEntityDespawn(this)) != net.minecraftforge.fml.common.eventhandler.Event.Result.DEFAULT) -+ { -+ if (result == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) -+ { -+ this.entityAge = 0; -+ } -+ else -+ { -+ this.setDead(); -+ } -+ } - else - { - Entity entity = this.worldObj.getClosestPlayerToEntity(this, -1.0D); -@@ -835,7 +848,6 @@ - return !this.worldObj.isAnyLiquid(this.getEntityBoundingBox()) && this.worldObj.func_184144_a(this, this.getEntityBoundingBox()).isEmpty() && this.worldObj.checkNoEntityCollision(this.getEntityBoundingBox(), this); - } - -- @SideOnly(Side.CLIENT) - public float getRenderSizeModifier() - { - return 1.0F; diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch deleted file mode 100644 index b27b6a34c..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch +++ /dev/null @@ -1,286 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/EntityLivingBase.java -+++ ../src-work/minecraft/net/minecraft/entity/EntityLivingBase.java -@@ -190,9 +190,11 @@ - float f = (float)MathHelper.ceiling_float_int(this.fallDistance - 3.0F); - - if (p_184231_4_.func_185904_a() != Material.air) -+ if (p_184231_4_.getBlock().isAir(p_184231_4_, worldObj, p_184231_5_)) - { - double d0 = Math.min((double)(0.2F + f / 15.0F), 2.5D); - int i = (int)(150.0D * d0); -+ if (!p_184231_4_.getBlock().addLandingEffects(p_184231_4_, (WorldServer)this.worldObj, p_184231_5_, p_184231_4_, this, i)) - ((WorldServer)this.worldObj).spawnParticle(EnumParticleTypes.BLOCK_DUST, this.posX, this.posY, this.posZ, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, new int[] {Block.getStateId(p_184231_4_)}); - } - } -@@ -264,7 +266,7 @@ - } - } - -- if (!this.worldObj.isRemote && this.func_184218_aH() && this.func_184187_bx() instanceof EntityLivingBase) -+ if (!this.worldObj.isRemote && this.func_184218_aH() && this.func_184187_bx() != null && this.func_184187_bx().shouldDismountInWater(this)) - { - this.func_184210_p(); - } -@@ -363,7 +365,7 @@ - if (!this.worldObj.isRemote && (this.isPlayer() || this.recentlyHit > 0 && this.canDropLoot() && this.worldObj.getGameRules().getBoolean("doMobLoot"))) - { - int i = this.getExperiencePoints(this.attackingPlayer); -- -+ i = net.minecraftforge.event.ForgeEventFactory.getExperienceDrop(this, this.attackingPlayer, i); - while (i > 0) - { - int j = EntityXPOrb.getXPSplit(i); -@@ -424,6 +426,7 @@ - { - this.entityLivingToAttack = livingBase; - this.revengeTimer = this.ticksExisted; -+ net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(this, livingBase); - } - - public EntityLivingBase getLastAttacker() -@@ -775,6 +778,8 @@ - - public void heal(float healAmount) - { -+ healAmount = net.minecraftforge.event.ForgeEventFactory.onLivingHeal(this, healAmount); -+ if (healAmount <= 0) return; - float f = this.getHealth(); - - if (f > 0.0F) -@@ -795,6 +800,7 @@ - - public boolean attackEntityFrom(DamageSource source, float amount) - { -+ if (!net.minecraftforge.common.ForgeHooks.onLivingAttack(this, source, amount)) return false; - if (this.isEntityInvulnerable(source)) - { - return false; -@@ -883,9 +889,9 @@ - this.recentlyHit = 100; - this.attackingPlayer = (EntityPlayer)entity; - } -- else if (entity instanceof EntityWolf) -+ else if (entity instanceof net.minecraft.entity.passive.EntityTameable) - { -- EntityWolf entitywolf = (EntityWolf)entity; -+ net.minecraft.entity.passive.EntityTameable entitywolf = (net.minecraft.entity.passive.EntityTameable)entity; - - if (entitywolf.isTamed()) - { -@@ -1007,6 +1013,7 @@ - - public void onDeath(DamageSource cause) - { -+ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, cause)) return; - if (!this.dead) - { - Entity entity = cause.getEntity(); -@@ -1034,11 +1041,24 @@ - i = EnchantmentHelper.func_185283_h((EntityLivingBase)entity); - } - -+ captureDrops = true; -+ capturedDrops.clear(); -+ - if (this.canDropLoot() && this.worldObj.getGameRules().getBoolean("doMobLoot")) - { - boolean flag = this.recentlyHit > 0; - this.func_184610_a(flag, i, cause); - } -+ -+ captureDrops = false; -+ -+ if (!net.minecraftforge.common.ForgeHooks.onLivingDrops(this, cause, capturedDrops, i, recentlyHit > 0)) -+ { -+ for (EntityItem item : capturedDrops) -+ { -+ worldObj.spawnEntityInWorld(item); -+ } -+ } - } - - this.worldObj.setEntityState(this, (byte)3); -@@ -1113,7 +1133,7 @@ - BlockPos blockpos = new BlockPos(i, j, k); - IBlockState iblockstate = this.worldObj.getBlockState(blockpos); - Block block = iblockstate.getBlock(); -- return block != Blocks.ladder && block != Blocks.vine ? block instanceof BlockTrapDoor && this.func_184604_a(blockpos, iblockstate) : true; -+ return net.minecraftforge.common.ForgeHooks.isLivingOnLadder(iblockstate, worldObj, new BlockPos(i, j, k), this); - } - } - -@@ -1139,6 +1159,9 @@ - - public void fall(float distance, float damageMultiplier) - { -+ float[] ret = net.minecraftforge.common.ForgeHooks.onLivingFall(this, distance, damageMultiplier); -+ if (ret == null) return; -+ distance = ret[0]; damageMultiplier = ret[1]; - super.fall(distance, damageMultiplier); - PotionEffect potioneffect = this.getActivePotionEffect(MobEffects.jump); - float f = potioneffect == null ? 0.0F : (float)(potioneffect.getAmplifier() + 1); -@@ -1231,6 +1254,8 @@ - { - if (!this.isEntityInvulnerable(damageSrc)) - { -+ damageAmount = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, damageSrc, damageAmount); -+ if (damageAmount <= 0) return; - damageAmount = this.applyArmorCalculations(damageSrc, damageAmount); - damageAmount = this.applyPotionDamageCalculations(damageSrc, damageAmount); - float f = damageAmount; -@@ -1279,6 +1304,11 @@ - - public void func_184609_a(EnumHand p_184609_1_) - { -+ ItemStack stack = this.func_184586_b(p_184609_1_); -+ if (stack != null && stack.getItem() != null) -+ { -+ if (stack.getItem().onEntitySwing(this, stack)) return; -+ } - if (!this.isSwingInProgress || this.swingProgressInt >= this.getArmSwingAnimationEnd() / 2 || this.swingProgressInt < 0) - { - this.swingProgressInt = -1; -@@ -1476,6 +1506,7 @@ - - public void dismountEntity(Entity p_110145_1_) - { -+ if (!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, p_110145_1_, false)) return; - if (!(p_110145_1_ instanceof EntityBoat) && !(p_110145_1_ instanceof EntityHorse)) - { - double d1 = p_110145_1_.posX; -@@ -1500,7 +1531,7 @@ - - if (!this.worldObj.func_184143_b(axisalignedbb1)) - { -- if (this.worldObj.getBlockState(new BlockPos(d11, this.posY, d12)).func_185896_q()) -+ if (this.worldObj.getBlockState(new BlockPos(d11, this.posY, d12)).isSideSolid(worldObj, new BlockPos(d11, this.posY, d12), EnumFacing.UP)) - { - this.setPositionAndUpdate(d11, this.posY + 1.0D, d12); - return; -@@ -1508,14 +1539,14 @@ - - BlockPos blockpos = new BlockPos(d11, this.posY - 1.0D, d12); - -- if (this.worldObj.getBlockState(blockpos).func_185896_q() || this.worldObj.getBlockState(blockpos).func_185904_a() == Material.water) -+ if (this.worldObj.getBlockState(blockpos).isSideSolid(worldObj, blockpos, EnumFacing.UP) || this.worldObj.getBlockState(blockpos).func_185904_a() == Material.water) - { - d1 = d11; - d13 = this.posY + 1.0D; - d14 = d12; - } - } -- else if (!this.worldObj.func_184143_b(axisalignedbb1.offset(0.0D, 1.0D, 0.0D)) && this.worldObj.getBlockState(new BlockPos(d11, this.posY + 1.0D, d12)).func_185896_q()) -+ else if (!this.worldObj.func_184143_b(axisalignedbb1.offset(0.0D, 1.0D, 0.0D)) && this.worldObj.getBlockState(new BlockPos(d11, this.posY + 1.0D, d12)).isSideSolid(worldObj, new BlockPos(d11, this.posY + 1.0D, d12), EnumFacing.UP)) - { - d1 = d11; - d13 = this.posY + 2.0D; -@@ -1586,6 +1617,7 @@ - } - - this.isAirBorne = true; -+ net.minecraftforge.common.ForgeHooks.onLivingJump(this); - } - - protected void updateAITick() -@@ -1845,6 +1877,7 @@ - - public void onUpdate() - { -+ if (net.minecraftforge.common.ForgeHooks.onLivingUpdate(this)) return; - super.onUpdate(); - this.func_184608_ct(); - -@@ -2351,6 +2384,40 @@ - this.potionsNeedUpdate = true; - } - -+ /*** -+ * Removes all potion effects that have curativeItem as a curative item for its effect -+ * @param curativeItem The itemstack we are using to cure potion effects -+ */ -+ public void curePotionEffects(ItemStack curativeItem) -+ { -+ if (worldObj.isRemote) return; -+ Iterator iterator = this.activePotionsMap.values().iterator(); -+ -+ while (iterator.hasNext()) -+ { -+ PotionEffect effect = iterator.next(); -+ -+ if (effect.isCurativeItem(curativeItem)) -+ { -+ onFinishedPotionEffect(effect); -+ iterator.remove(); -+ this.potionsNeedUpdate = true; -+ } -+ } -+ } -+ -+ /** -+ * Returns true if the entity's rider (EntityPlayer) should face forward when mounted. -+ * currently only used in vanilla code by pigs. -+ * -+ * @param player The player who is riding the entity. -+ * @return If the player should orient the same direction as this entity. -+ */ -+ public boolean shouldRiderFaceForward(EntityPlayer player) -+ { -+ return this instanceof net.minecraft.entity.passive.EntityPig; -+ } -+ - public abstract EnumHandSide func_184591_cq(); - - public boolean func_184587_cr() -@@ -2371,6 +2438,14 @@ - - if (itemstack == this.field_184627_bm) - { -+ field_184628_bn = net.minecraftforge.event.ForgeEventFactory.onItemUseTick(this, field_184627_bm, field_184628_bn); -+ if (field_184628_bn <= 0) -+ { -+ this.onItemUseFinish(); -+ } -+ else -+ { // Forge Keep unindented to lower patch -+ field_184627_bm.getItem().onUsingTick(field_184627_bm, this, field_184628_bn); //Forge Added - if (this.func_184605_cv() <= 25 && this.func_184605_cv() % 4 == 0) - { - this.func_184584_a(this.field_184627_bm, 5); -@@ -2380,6 +2455,7 @@ - { - this.onItemUseFinish(); - } -+ } - } - else - { -@@ -2394,8 +2470,10 @@ - - if (itemstack != null && !this.func_184587_cr()) - { -+ int duration = net.minecraftforge.event.ForgeEventFactory.onItemUseStart(this, itemstack, itemstack.getMaxItemUseDuration()); -+ if (duration <= 0) return; - this.field_184627_bm = itemstack; -- this.field_184628_bn = itemstack.getMaxItemUseDuration(); -+ this.field_184628_bn = duration; - - if (!this.worldObj.isRemote) - { -@@ -2478,6 +2556,8 @@ - this.func_184584_a(this.field_184627_bm, 16); - ItemStack itemstack = this.field_184627_bm.onItemUseFinish(this.worldObj, this); - -+ itemstack = net.minecraftforge.event.ForgeEventFactory.onItemUseFinish(this, field_184627_bm, func_184605_cv(), itemstack); -+ - if (itemstack != null && itemstack.stackSize == 0) - { - itemstack = null; -@@ -2508,6 +2588,8 @@ - if (this.field_184627_bm != null) - { - this.field_184627_bm.onPlayerStoppedUsing(this.worldObj, this, this.func_184605_cv()); -+ if (!net.minecraftforge.event.ForgeEventFactory.onUseItemStop(this, field_184627_bm, this.func_184605_cv())) -+ this.field_184627_bm.onPlayerStoppedUsing(this.worldObj, this, this.func_184605_cv()); - } - - this.func_184602_cy(); diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch deleted file mode 100644 index 0e8f1cf59..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java -+++ ../src-work/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java -@@ -44,6 +44,12 @@ - return (EntityLiving.SpawnPlacementType)ENTITY_PLACEMENTS.get(entityClass); - } - -+ public static void setPlacementType(Class entityClass, EntityLiving.SpawnPlacementType placementType) -+ { -+ if(!ENTITY_PLACEMENTS.containsKey(entityClass)) -+ ENTITY_PLACEMENTS.put(entityClass, placementType); -+ } -+ - static - { - ENTITY_PLACEMENTS.put(EntityBat.class, EntityLiving.SpawnPlacementType.ON_GROUND); diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityTracker.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityTracker.java.patch deleted file mode 100644 index 8901784d4..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/EntityTracker.java.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/EntityTracker.java -+++ ../src-work/minecraft/net/minecraft/entity/EntityTracker.java -@@ -75,6 +75,8 @@ - - public void trackEntity(Entity p_72786_1_) - { -+ if (net.minecraftforge.fml.common.registry.EntityRegistry.instance().tryTrackingEntity(this, p_72786_1_)) return; -+ - if (p_72786_1_ instanceof EntityPlayerMP) - { - this.trackEntity(p_72786_1_, 512, 2); -@@ -329,6 +331,25 @@ - } - } - -+ /* ======================================== FORGE START =====================================*/ -+ -+ // don't expose the EntityTrackerEntry directly so mods can't mess with the data in there as easily -+ /** -+ * Get all players tracking the given Entity. The Entity must be part of the World that this Tracker belongs to. -+ * @param entity the Entity -+ * @return all players tracking the Entity -+ */ -+ public Set getTrackingPlayers(Entity entity) -+ { -+ EntityTrackerEntry entry = (EntityTrackerEntry) trackedEntityHashTable.lookup(entity.getEntityId()); -+ if (entry == null) -+ return java.util.Collections.emptySet(); -+ else -+ return java.util.Collections.unmodifiableSet(entry.trackingPlayers); -+ } -+ -+ /* ======================================== FORGE END =====================================*/ -+ - public void func_151248_b(Entity entityIn, Packet p_151248_2_) - { - EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry)this.trackedEntityHashTable.lookup(entityIn.getEntityId()); diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch deleted file mode 100644 index 42d43da73..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/EntityTrackerEntry.java -+++ ../src-work/minecraft/net/minecraft/entity/EntityTrackerEntry.java -@@ -398,6 +398,14 @@ - this.lastTrackedEntityMotionY = this.trackedEntity.motionY; - this.motionZ = this.trackedEntity.motionZ; - -+ int posX = MathHelper.floor_double(this.trackedEntity.posX * 32.0D); -+ int posY = MathHelper.floor_double(this.trackedEntity.posY * 32.0D); -+ int posZ = MathHelper.floor_double(this.trackedEntity.posZ * 32.0D); -+ if (posX != this.encodedPosX || posY != this.encodedPosY || posZ != this.encodedPosZ) -+ { -+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.makeEntitySpawnAdjustment(this.trackedEntity, playerMP, this.encodedPosX, this.encodedPosY, this.encodedPosZ); -+ } -+ - if (flag && !(packet instanceof SPacketSpawnMob)) - { - playerMP.playerNetServerHandler.sendPacket(new SPacketEntityVelocity(this.trackedEntity.getEntityId(), this.trackedEntity.motionX, this.trackedEntity.motionY, this.trackedEntity.motionZ)); -@@ -438,6 +446,7 @@ - - this.trackedEntity.func_184178_b(playerMP); - playerMP.func_184848_d(this.trackedEntity); -+ net.minecraftforge.event.ForgeEventFactory.onStartEntityTracking(trackedEntity, playerMP); - } - } - else if (this.trackingPlayers.contains(playerMP)) -@@ -445,6 +454,7 @@ - this.trackingPlayers.remove(playerMP); - this.trackedEntity.func_184203_c(playerMP); - playerMP.removeEntity(this.trackedEntity); -+ net.minecraftforge.event.ForgeEventFactory.onStopEntityTracking(trackedEntity, playerMP); - } - } - } -@@ -477,6 +487,9 @@ - logger.warn("Fetching addPacket for removed entity"); - } - -+ Packet pkt = net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.getEntitySpawningPacket(this.trackedEntity); -+ if (pkt != null) return pkt; -+ - if (this.trackedEntity instanceof EntityItem) - { - return new SPacketSpawnObject(this.trackedEntity, 2, 1); diff --git a/patches.mcp/minecraft/net/minecraft/entity/ai/EntityAIAttackMelee.java.patch b/patches.mcp/minecraft/net/minecraft/entity/ai/EntityAIAttackMelee.java.patch deleted file mode 100644 index df4bcbc3d..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/ai/EntityAIAttackMelee.java.patch +++ /dev/null @@ -1,55 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/ai/EntityAIAttackMelee.java -+++ ../src-work/minecraft/net/minecraft/entity/ai/EntityAIAttackMelee.java -@@ -21,6 +21,8 @@ - private double targetY; - private double targetZ; - protected final int field_188493_g = 20; -+ private int failedPathFindingPenalty = 0; -+ private boolean canPenalize = false; - - public EntityAIAttackMelee(EntityCreature creature, double speedIn, boolean useLongMemory) - { -@@ -45,6 +47,19 @@ - } - else - { -+ if (canPenalize) -+ { -+ if (--this.delayCounter <= 0) -+ { -+ this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase); -+ this.targetX = 4 + this.attacker.getRNG().nextInt(7); -+ return this.entityPathEntity != null; -+ } -+ else -+ { -+ return true; -+ } -+ } - this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase); - return this.entityPathEntity != null; - } -@@ -89,6 +104,23 @@ - this.targetZ = entitylivingbase.posZ; - this.delayCounter = 4 + this.attacker.getRNG().nextInt(7); - -+ if (this.canPenalize) -+ { -+ this.targetX += failedPathFindingPenalty; -+ if (this.attacker.getNavigator().getPath() != null) -+ { -+ net.minecraft.pathfinding.PathPoint finalPathPoint = this.attacker.getNavigator().getPath().getFinalPathPoint(); -+ if (finalPathPoint != null && entitylivingbase.getDistanceSq(finalPathPoint.xCoord, finalPathPoint.yCoord, finalPathPoint.zCoord) < 1) -+ failedPathFindingPenalty = 0; -+ else -+ failedPathFindingPenalty += 10; -+ } -+ else -+ { -+ failedPathFindingPenalty += 10; -+ } -+ } -+ - if (d0 > 1024.0D) - { - this.delayCounter += 10; diff --git a/patches.mcp/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch b/patches.mcp/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch deleted file mode 100644 index f8d066e7e..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/boss/EntityDragon.java -+++ ../src-work/minecraft/net/minecraft/entity/boss/EntityDragon.java -@@ -474,13 +474,13 @@ - IBlockState iblockstate = this.worldObj.getBlockState(blockpos); - Block block = iblockstate.getBlock(); - -- if (iblockstate.func_185904_a() != Material.air && iblockstate.func_185904_a() != Material.fire) -+ if (!block.isAir(iblockstate, this.worldObj, blockpos) && iblockstate.func_185904_a() != Material.fire) - { - if (!this.worldObj.getGameRules().getBoolean("mobGriefing")) - { - flag = true; - } -- else if (block != Blocks.barrier && block != Blocks.obsidian && block != Blocks.end_stone && block != Blocks.bedrock && block != Blocks.end_portal && block != Blocks.end_portal_frame) -+ else if (block.canEntityDestroy(iblockstate, this.worldObj, blockpos, this)) - { - if (block != Blocks.command_block && block != Blocks.field_185776_dc && block != Blocks.field_185777_dd && block != Blocks.iron_bars && block != Blocks.field_185775_db) - { diff --git a/patches.mcp/minecraft/net/minecraft/entity/boss/EntityWither.java.patch b/patches.mcp/minecraft/net/minecraft/entity/boss/EntityWither.java.patch deleted file mode 100644 index 8936ecdcb..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/boss/EntityWither.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/boss/EntityWither.java -+++ ../src-work/minecraft/net/minecraft/entity/boss/EntityWither.java -@@ -365,7 +365,7 @@ - IBlockState iblockstate = this.worldObj.getBlockState(blockpos); - Block block = iblockstate.getBlock(); - -- if (iblockstate.func_185904_a() != Material.air && func_181033_a(block)) -+ if (!block.isAir(iblockstate, this.worldObj, blockpos)) - { - flag = this.worldObj.destroyBlock(blockpos, true) || flag; - } diff --git a/patches.mcp/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch b/patches.mcp/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch deleted file mode 100644 index e461fad3c..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java -+++ ../src-work/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java -@@ -104,7 +104,8 @@ - for (int i = 0; i < list.size(); ++i) - { - Entity entity = (Entity)list.get(i); -- entity.onStruckByLightning(this); -+ if (!net.minecraftforge.event.ForgeEventFactory.onEntityStruckByLightning(entity, this)) -+ entity.onStruckByLightning(this); - } - } - } diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch deleted file mode 100644 index 4244d1376..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/item/EntityEnderPearl.java -+++ ../src-work/minecraft/net/minecraft/entity/item/EntityEnderPearl.java -@@ -84,6 +84,9 @@ - - if (entityplayermp.playerNetServerHandler.getNetworkManager().isChannelOpen() && entityplayermp.worldObj == this.worldObj && !entityplayermp.isPlayerSleeping()) - { -+ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(entityplayermp, this.posX, this.posY, this.posZ, 5.0F); -+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) -+ { // Don't indent to lower patch size - if (this.rand.nextFloat() < 0.05F && this.worldObj.getGameRules().getBoolean("doMobSpawning")) - { - EntityEndermite entityendermite = new EntityEndermite(this.worldObj); -@@ -97,9 +100,10 @@ - this.func_184210_p(); - } - -- entitylivingbase.setPositionAndUpdate(this.posX, this.posY, this.posZ); -+ entitylivingbase.setPositionAndUpdate(event.targetX, event.targetY, event.targetZ); - entitylivingbase.fallDistance = 0.0F; -- entitylivingbase.attackEntityFrom(DamageSource.fall, 5.0F); -+ entitylivingbase.attackEntityFrom(DamageSource.fall, event.attackDamage); -+ } - } - } - else if (entitylivingbase != null) diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityFallingBlock.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityFallingBlock.java.patch deleted file mode 100644 index fca72641b..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityFallingBlock.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/item/EntityFallingBlock.java -+++ ../src-work/minecraft/net/minecraft/entity/item/EntityFallingBlock.java -@@ -129,6 +129,7 @@ - { - IBlockState iblockstate = this.worldObj.getBlockState(blockpos1); - -+ if (this.worldObj.isAirBlock(new BlockPos(this.posX, this.posY - 0.009999999776482582D, this.posZ))) //Forge: Don't indent below. - if (BlockFalling.func_185759_i(this.worldObj.getBlockState(new BlockPos(this.posX, this.posY - 0.009999999776482582D, this.posZ)))) - { - this.onGround = false; diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityItem.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityItem.java.patch deleted file mode 100644 index 5562fd646..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityItem.java.patch +++ /dev/null @@ -1,114 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/item/EntityItem.java -+++ ../src-work/minecraft/net/minecraft/entity/item/EntityItem.java -@@ -37,6 +37,11 @@ - private String owner; - public float hoverStart; - -+ /** -+ * The maximum age of this EntityItem. The item is expired once this is reached. -+ */ -+ public int lifespan = 6000; -+ - public EntityItem(World worldIn, double x, double y, double z) - { - super(worldIn); -@@ -54,6 +59,7 @@ - { - this(worldIn, x, y, z); - this.setEntityItemStack(stack); -+ this.lifespan = (stack.getItem() == null ? 6000 : stack.getItem().getEntityLifespan(stack, worldIn)); - } - - protected boolean canTriggerWalking() -@@ -77,6 +83,8 @@ - - public void onUpdate() - { -+ ItemStack stack = this.func_184212_Q().func_187225_a(field_184533_c).orNull(); -+ if (stack != null && stack.getItem() != null && stack.getItem().onEntityItemUpdate(this)) return; - if (this.getEntityItem() == null) - { - this.setDead(); -@@ -137,8 +145,16 @@ - - this.handleWaterMovement(); - -- if (!this.worldObj.isRemote && this.age >= 6000) -+ ItemStack item = this.func_184212_Q().func_187225_a(field_184533_c).orNull(); -+ -+ if (!this.worldObj.isRemote && this.age >= lifespan) - { -+ int hook = net.minecraftforge.event.ForgeEventFactory.onItemExpire(this, item); -+ if (hook < 0) this.setDead(); -+ else this.lifespan += hook; -+ } -+ if (item != null && item.stackSize <= 0) -+ { - this.setDead(); - } - } -@@ -279,6 +295,7 @@ - tagCompound.setShort("Health", (short)this.health); - tagCompound.setShort("Age", (short)this.age); - tagCompound.setShort("PickupDelay", (short)this.delayBeforeCanPickup); -+ tagCompound.setInteger("Lifespan", lifespan); - - if (this.getThrower() != null) - { -@@ -319,20 +336,23 @@ - NBTTagCompound nbttagcompound = tagCompund.getCompoundTag("Item"); - this.setEntityItemStack(ItemStack.loadItemStackFromNBT(nbttagcompound)); - -- if (this.getEntityItem() == null) -- { -- this.setDead(); -- } -+ ItemStack item = this.func_184212_Q().func_187225_a(field_184533_c).orNull(); -+ if (item == null || item.stackSize <= 0) this.setDead(); -+ if (tagCompund.hasKey("Lifespan")) lifespan = tagCompund.getInteger("Lifespan"); - } - - public void onCollideWithPlayer(EntityPlayer entityIn) - { - if (!this.worldObj.isRemote) - { -+ if (this.delayBeforeCanPickup > 0) return; - ItemStack itemstack = this.getEntityItem(); - int i = itemstack.stackSize; - -- if (this.delayBeforeCanPickup == 0 && (this.owner == null || 6000 - this.age <= 200 || this.owner.equals(entityIn.getName())) && entityIn.inventory.addItemStackToInventory(itemstack)) -+ int hook = net.minecraftforge.event.ForgeEventFactory.onItemPickup(this, entityIn, itemstack); -+ if (hook < 0) return; -+ -+ if (this.delayBeforeCanPickup <= 0 && (this.owner == null || lifespan - this.age <= 200 || this.owner.equals(entityIn.getName())) && (hook == 1 || i <= 0 || entityIn.inventory.addItemStackToInventory(itemstack))) - { - if (itemstack.getItem() == Item.getItemFromBlock(Blocks.log)) - { -@@ -369,6 +389,7 @@ - } - } - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerItemPickupEvent(entityIn, this); - if (!this.isSilent()) - { - this.worldObj.func_184148_a((EntityPlayer)null, entityIn.posX, entityIn.posY, entityIn.posZ, SoundEvents.field_187638_cR, SoundCategory.PLAYERS, 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); -@@ -414,11 +435,6 @@ - - if (itemstack == null) - { -- if (this.worldObj != null) -- { -- logger.error("Item entity " + this.getEntityId() + " has no item?!"); -- } -- - return new ItemStack(Blocks.stone); - } - else -@@ -492,6 +508,6 @@ - public void func_174870_v() - { - this.setInfinitePickupDelay(); -- this.age = 5999; -+ this.age = getEntityItem().getItem().getEntityLifespan(getEntityItem(), worldObj) - 1; - } - } diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch deleted file mode 100644 index a01a4c93a..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/item/EntityItemFrame.java -+++ ../src-work/minecraft/net/minecraft/entity/item/EntityItemFrame.java -@@ -137,7 +137,7 @@ - { - if (p_110131_1_ != null) - { -- if (p_110131_1_.getItem() == Items.filled_map) -+ if (p_110131_1_.getItem() instanceof net.minecraft.item.ItemMap) - { - MapData mapdata = ((ItemMap)p_110131_1_.getItem()).getMapData(p_110131_1_, this.worldObj); - mapdata.mapDecorations.remove("frame-" + this.getEntityId()); diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch deleted file mode 100644 index a9e284240..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch +++ /dev/null @@ -1,439 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecart.java -+++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecart.java -@@ -54,6 +54,20 @@ - @SideOnly(Side.CLIENT) - private double velocityZ; - -+ /* Forge: Minecart Compatibility Layer Integration. */ -+ public static float defaultMaxSpeedAirLateral = 0.4f; -+ public static float defaultMaxSpeedAirVertical = -1f; -+ public static double defaultDragAir = 0.94999998807907104D; -+ protected boolean canUseRail = true; -+ protected boolean canBePushed = true; -+ private static net.minecraftforge.common.IMinecartCollisionHandler collisionHandler = null; -+ -+ /* Instance versions of the above physics properties */ -+ private float currentSpeedRail = getMaxCartSpeedOnRail(); -+ protected float maxSpeedAirLateral = defaultMaxSpeedAirLateral; -+ protected float maxSpeedAirVertical = defaultMaxSpeedAirVertical; -+ protected double dragAir = defaultDragAir; -+ - public EntityMinecart(World worldIn) - { - super(worldIn); -@@ -99,17 +113,19 @@ - - public AxisAlignedBB getCollisionBox(Entity entityIn) - { -+ if (getCollisionHandler() != null) return getCollisionHandler().getCollisionBox(this, entityIn); - return entityIn.canBePushed() ? entityIn.getEntityBoundingBox() : null; - } - - public AxisAlignedBB getCollisionBoundingBox() - { -+ if (getCollisionHandler() != null) return getCollisionHandler().getBoundingBox(this); - return null; - } - - public boolean canBePushed() - { -- return true; -+ return canBePushed; - } - - public EntityMinecart(World worldIn, double x, double y, double z) -@@ -315,7 +331,7 @@ - BlockPos blockpos = new BlockPos(k, l, i1); - IBlockState iblockstate = this.worldObj.getBlockState(blockpos); - -- if (BlockRailBase.isRailBlock(iblockstate)) -+ if (canUseRail() && BlockRailBase.isRailBlock(iblockstate)) - { - this.func_180460_a(blockpos, iblockstate); - -@@ -354,7 +370,10 @@ - - this.setRotation(this.rotationYaw, this.rotationPitch); - -- for (Entity entity : this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().expand(0.20000000298023224D, 0.0D, 0.20000000298023224D))) -+ AxisAlignedBB box; -+ if (getCollisionHandler() != null) box = getCollisionHandler().getMinecartCollisionBox(this); -+ else box = this.getEntityBoundingBox().expand(0.20000000298023224D, 0.0D, 0.20000000298023224D); -+ for (Entity entity : this.worldObj.getEntitiesWithinAABBExcludingEntity(this, box)) - { - if (!this.func_184196_w(entity) && entity.canBePushed() && entity instanceof EntityMinecart) - { -@@ -363,6 +382,7 @@ - } - - this.handleWaterMovement(); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartUpdateEvent(this, this.getCurrentRailPosition())); - } - } - -@@ -377,10 +397,21 @@ - - protected void moveDerailedMinecart() - { -- double d0 = this.getMaximumSpeed(); -+ double d0 = onGround ? this.getMaximumSpeed() : getMaxSpeedAirLateral(); - this.motionX = MathHelper.clamp_double(this.motionX, -d0, d0); - this.motionZ = MathHelper.clamp_double(this.motionZ, -d0, d0); - -+ double moveY = motionY; -+ if(getMaxSpeedAirVertical() > 0 && motionY > getMaxSpeedAirVertical()) -+ { -+ moveY = getMaxSpeedAirVertical(); -+ if(Math.abs(motionX) < 0.3f && Math.abs(motionZ) < 0.3f) -+ { -+ moveY = 0.15f; -+ motionY = moveY; -+ } -+ } -+ - if (this.onGround) - { - this.motionX *= 0.5D; -@@ -388,13 +419,13 @@ - this.motionZ *= 0.5D; - } - -- this.moveEntity(this.motionX, this.motionY, this.motionZ); -+ this.moveEntity(this.motionX, moveY, this.motionZ); - - if (!this.onGround) - { -- this.motionX *= 0.949999988079071D; -- this.motionY *= 0.949999988079071D; -- this.motionZ *= 0.949999988079071D; -+ this.motionX *= getDragAir(); -+ this.motionY *= getDragAir(); -+ this.motionZ *= getDragAir(); - } - } - -@@ -414,25 +445,25 @@ - flag1 = !flag; - } - -- double d0 = 0.0078125D; -+ double slopeAdjustment = getSlopeAdjustment(); - BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)p_180460_2_.getValue(blockrailbase.getShapeProperty()); - - switch (blockrailbase$enumraildirection) - { - case ASCENDING_EAST: -- this.motionX -= 0.0078125D; -+ this.motionX -= slopeAdjustment; - ++this.posY; - break; - case ASCENDING_WEST: -- this.motionX += 0.0078125D; -+ this.motionX += slopeAdjustment; - ++this.posY; - break; - case ASCENDING_NORTH: -- this.motionZ += 0.0078125D; -+ this.motionZ += slopeAdjustment; - ++this.posY; - break; - case ASCENDING_SOUTH: -- this.motionZ -= 0.0078125D; -+ this.motionZ -= slopeAdjustment; - ++this.posY; - } - -@@ -478,7 +509,7 @@ - } - } - -- if (flag1) -+ if (flag1 && shouldDoRailFunctions()) - { - double d17 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); - -@@ -526,6 +557,7 @@ - this.setPosition(this.posX, this.posY, this.posZ); - double d22 = this.motionX; - double d23 = this.motionZ; -+ this.moveMinecartOnRail(p_180460_1_); - - if (this.func_184207_aI()) - { -@@ -574,8 +606,14 @@ - this.motionZ = d5 * (double)(i - p_180460_1_.getZ()); - } - -- if (flag) -+ -+ if(shouldDoRailFunctions()) - { -+ ((BlockRailBase)p_180460_2_.getBlock()).onMinecartPass(worldObj, this, p_180460_1_); -+ } -+ -+ if (flag && shouldDoRailFunctions()) -+ { - double d15 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); - - if (d15 > 0.01D) -@@ -795,13 +833,19 @@ - - public void applyEntityCollision(Entity entityIn) - { -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartCollisionEvent(this, entityIn)); -+ if (getCollisionHandler() != null) -+ { -+ getCollisionHandler().onEntityCollision(this, entityIn); -+ return; -+ } - if (!this.worldObj.isRemote) - { - if (!entityIn.noClip && !this.noClip) - { - if (!this.func_184196_w(entityIn)) - { -- if (entityIn instanceof EntityLivingBase && this.func_184264_v() == EntityMinecart.Type.RIDEABLE && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && !(entityIn instanceof EntityPlayer) && !(entityIn instanceof EntityIronGolem) && !this.func_184207_aI() && !entityIn.func_184218_aH()) -+ if (entityIn instanceof EntityLivingBase && canBeRidden() && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && !(entityIn instanceof EntityPlayer) && !(entityIn instanceof EntityIronGolem) && !this.func_184207_aI() && !entityIn.func_184218_aH()) - { - entityIn.func_184220_m(this); - } -@@ -847,7 +891,7 @@ - double d7 = entityIn.motionX + this.motionX; - double d8 = entityIn.motionZ + this.motionZ; - -- if (((EntityMinecart)entityIn).func_184264_v() == EntityMinecart.Type.FURNACE && this.func_184264_v() != EntityMinecart.Type.FURNACE) -+ if (((EntityMinecart)entityIn).isPoweredCart() && !isPoweredCart()) - { - this.motionX *= 0.20000000298023224D; - this.motionZ *= 0.20000000298023224D; -@@ -855,7 +899,7 @@ - entityIn.motionX *= 0.949999988079071D; - entityIn.motionZ *= 0.949999988079071D; - } -- else if (((EntityMinecart)entityIn).func_184264_v() != EntityMinecart.Type.FURNACE && this.func_184264_v() == EntityMinecart.Type.FURNACE) -+ else if (!((EntityMinecart)entityIn).isPoweredCart() && isPoweredCart()) - { - entityIn.motionX *= 0.20000000298023224D; - entityIn.motionZ *= 0.20000000298023224D; -@@ -982,6 +1026,221 @@ - this.func_184212_Q().func_187227_b(field_184270_f, Boolean.valueOf(p_94096_1_)); - } - -+ /* =================================== FORGE START ===========================================*/ -+ private BlockPos getCurrentRailPosition() -+ { -+ int x = MathHelper.floor_double(this.posX); -+ int y = MathHelper.floor_double(this.posY); -+ int z = MathHelper.floor_double(this.posZ); -+ -+ if (BlockRailBase.isRailBlock(this.worldObj, new BlockPos(x, y - 1, z))) y--; -+ return new BlockPos(x, y, z); -+ } -+ -+ protected double getMaxSpeed() -+ { -+ if (!canUseRail()) return getMaximumSpeed(); -+ BlockPos pos = this.getCurrentRailPosition(); -+ IBlockState state = this.worldObj.getBlockState(pos); -+ if (!BlockRailBase.isRailBlock(state)) return getMaximumSpeed(); -+ -+ float railMaxSpeed = ((BlockRailBase)state.getBlock()).getRailMaxSpeed(worldObj, this, pos); -+ return Math.min(railMaxSpeed, getCurrentCartSpeedCapOnRail()); -+ } -+ -+ /** -+ * Moved to allow overrides. -+ * This code handles minecart movement and speed capping when on a rail. -+ */ -+ public void moveMinecartOnRail(BlockPos pos) -+ { -+ double mX = this.motionX; -+ double mZ = this.motionZ; -+ -+ if (this.func_184187_bx() != null) -+ { -+ mX *= 0.75D; -+ mZ *= 0.75D; -+ } -+ -+ double max = this.getMaxSpeed(); -+ mX = MathHelper.clamp_double(mX, -max, max); -+ mZ = MathHelper.clamp_double(mZ, -max, max); -+ this.moveEntity(mX, 0.0D, mZ); -+ } -+ -+ /** -+ * Gets the current global Minecart Collision handler if none -+ * is registered, returns null -+ * @return The collision handler or null -+ */ -+ public static net.minecraftforge.common.IMinecartCollisionHandler getCollisionHandler() -+ { -+ return collisionHandler; -+ } -+ -+ /** -+ * Sets the global Minecart Collision handler, overwrites any -+ * that is currently set. -+ * @param handler The new handler -+ */ -+ public static void setCollisionHandler(net.minecraftforge.common.IMinecartCollisionHandler handler) -+ { -+ collisionHandler = handler; -+ } -+ -+ /** -+ * This function returns an ItemStack that represents this cart. -+ * This should be an ItemStack that can be used by the player to place the cart, -+ * but is not necessary the item the cart drops when destroyed. -+ * @return An ItemStack that can be used to place the cart. -+ */ -+ public ItemStack getCartItem() -+ { -+ if (this instanceof EntityMinecartFurnace) -+ { -+ return new ItemStack(Items.furnace_minecart); -+ } -+ else if (this instanceof EntityMinecartChest) -+ { -+ return new ItemStack(Items.chest_minecart); -+ } -+ else if (this instanceof EntityMinecartTNT) -+ { -+ return new ItemStack(Items.tnt_minecart); -+ } -+ else if (this instanceof EntityMinecartHopper) -+ { -+ return new ItemStack(Items.hopper_minecart); -+ } -+ else if (this instanceof EntityMinecartCommandBlock) -+ { -+ return new ItemStack(Items.command_block_minecart); -+ } -+ return new ItemStack(Items.minecart); -+ } -+ -+ /** -+ * Returns true if this cart can currently use rails. -+ * This function is mainly used to gracefully detach a minecart from a rail. -+ * @return True if the minecart can use rails. -+ */ -+ public boolean canUseRail() -+ { -+ return canUseRail; -+ } -+ -+ /** -+ * Set whether the minecart can use rails. -+ * This function is mainly used to gracefully detach a minecart from a rail. -+ * @param use Whether the minecart can currently use rails. -+ */ -+ public void setCanUseRail(boolean use) -+ { -+ canUseRail = use; -+ } -+ -+ /** -+ * Return false if this cart should not call onMinecartPass() and should ignore Powered Rails. -+ * @return True if this cart should call onMinecartPass(). -+ */ -+ public boolean shouldDoRailFunctions() -+ { -+ return true; -+ } -+ -+ /** -+ * Returns true if this cart is self propelled. -+ * @return True if powered. -+ */ -+ public boolean isPoweredCart() -+ { -+ return func_184264_v() == EntityMinecart.Type.FURNACE; -+ } -+ -+ /** -+ * Returns true if this cart can be ridden by an Entity. -+ * @return True if this cart can be ridden. -+ */ -+ public boolean canBeRidden() -+ { -+ return this.func_184264_v() == EntityMinecart.Type.RIDEABLE; -+ } -+ -+ /** -+ * Getters/setters for physics variables -+ */ -+ -+ /** -+ * Returns the carts max speed when traveling on rails. Carts going faster -+ * than 1.1 cause issues with chunk loading. Carts cant traverse slopes or -+ * corners at greater than 0.5 - 0.6. This value is compared with the rails -+ * max speed and the carts current speed cap to determine the carts current -+ * max speed. A normal rail's max speed is 0.4. -+ * -+ * @return Carts max speed. -+ */ -+ public float getMaxCartSpeedOnRail() -+ { -+ return 1.2f; -+ } -+ -+ /** -+ * Returns the current speed cap for the cart when traveling on rails. This -+ * functions differs from getMaxCartSpeedOnRail() in that it controls -+ * current movement and cannot be overridden. The value however can never be -+ * higher than getMaxCartSpeedOnRail(). -+ * -+ * @return -+ */ -+ public final float getCurrentCartSpeedCapOnRail() -+ { -+ return currentSpeedRail; -+ } -+ -+ public final void setCurrentCartSpeedCapOnRail(float value) -+ { -+ value = Math.min(value, getMaxCartSpeedOnRail()); -+ currentSpeedRail = value; -+ } -+ -+ public float getMaxSpeedAirLateral() -+ { -+ return maxSpeedAirLateral; -+ } -+ -+ public void setMaxSpeedAirLateral(float value) -+ { -+ maxSpeedAirLateral = value; -+ } -+ -+ public float getMaxSpeedAirVertical() -+ { -+ return maxSpeedAirVertical; -+ } -+ -+ public void setMaxSpeedAirVertical(float value) -+ { -+ maxSpeedAirVertical = value; -+ } -+ -+ public double getDragAir() -+ { -+ return dragAir; -+ } -+ -+ public void setDragAir(double value) -+ { -+ dragAir = value; -+ } -+ -+ public double getSlopeAdjustment() -+ { -+ return 0.0078125D; -+ } -+ -+ /* =================================== FORGE END ===========================================*/ -+ - public static enum Type - { - RIDEABLE(0, "MinecartRideable"), diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartCommandBlock.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartCommandBlock.java.patch deleted file mode 100644 index 028fa17b8..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartCommandBlock.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartCommandBlock.java -+++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartCommandBlock.java -@@ -122,6 +122,7 @@ - - public boolean func_184230_a(EntityPlayer p_184230_1_, ItemStack p_184230_2_, EnumHand p_184230_3_) - { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_184230_1_, p_184230_2_, p_184230_3_))) return true; - this.commandBlockLogic.tryOpenEditCommandBlock(p_184230_1_); - return false; - } diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch deleted file mode 100644 index 0663f08f1..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java -+++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java -@@ -200,6 +200,7 @@ - - public boolean func_184230_a(EntityPlayer p_184230_1_, ItemStack p_184230_2_, EnumHand p_184230_3_) - { -+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_184230_1_, p_184230_2_, p_184230_3_))) return true; - if (!this.worldObj.isRemote) - { - p_184230_1_.displayGUIChest(this); -@@ -279,6 +280,24 @@ - } - } - -+ public net.minecraftforge.items.IItemHandler itemHandler = new net.minecraftforge.items.wrapper.InvWrapper(this); -+ -+ @Override -+ public T getCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) -+ { -+ if (capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) -+ { -+ return (T) itemHandler; -+ } -+ return super.getCapability(capability, facing); -+ } -+ -+ @Override -+ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) -+ { -+ return capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing); -+ } -+ - public void clear() - { - this.func_184288_f((EntityPlayer)null); diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch deleted file mode 100644 index 4239cd058..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java -+++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java -@@ -19,6 +19,8 @@ - - public boolean func_184230_a(EntityPlayer p_184230_1_, ItemStack p_184230_2_, EnumHand p_184230_3_) - { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_184230_1_, p_184230_2_, p_184230_3_))) return true; -+ - if (p_184230_1_.isSneaking()) - { - return false; diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch deleted file mode 100644 index e80c6fb49..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java -+++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java -@@ -136,6 +136,8 @@ - - public boolean func_184230_a(EntityPlayer p_184230_1_, ItemStack p_184230_2_, EnumHand p_184230_3_) - { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_184230_1_, p_184230_2_, p_184230_3_))) return true; -+ - if (p_184230_2_ != null && p_184230_2_.getItem() == Items.coal && this.fuel + 3600 <= 32000) - { - if (!p_184230_1_.capabilities.isCreativeMode) diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch deleted file mode 100644 index 3fbedf27b..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java -+++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java -@@ -56,6 +56,7 @@ - - public boolean func_184230_a(EntityPlayer p_184230_1_, ItemStack p_184230_2_, EnumHand p_184230_3_) - { -+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_184230_1_, p_184230_2_, p_184230_3_))) return true; - if (!this.worldObj.isRemote) - { - p_184230_1_.displayGUIChest(this); diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch deleted file mode 100644 index 733ef2982..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/item/EntityXPOrb.java -+++ ../src-work/minecraft/net/minecraft/entity/item/EntityXPOrb.java -@@ -204,6 +204,7 @@ - { - if (this.delayBeforeCanPickup == 0 && entityIn.xpCooldown == 0) - { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerPickupXpEvent(entityIn, this))) return; - entityIn.xpCooldown = 2; - this.worldObj.func_184148_a((EntityPlayer)null, entityIn.posX, entityIn.posY, entityIn.posZ, SoundEvents.field_187607_bg, SoundCategory.PLAYERS, 0.1F, 0.5F * ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.8F)); - entityIn.onItemPickup(this, 1); diff --git a/patches.mcp/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch b/patches.mcp/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch deleted file mode 100644 index dcd8ee527..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/monster/EntityEnderman.java -+++ ../src-work/minecraft/net/minecraft/entity/monster/EntityEnderman.java -@@ -259,7 +259,9 @@ - - private boolean teleportTo(double x, double y, double z) - { -- boolean flag = this.func_184595_k(x, y, z); -+ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(this, x, y, z, 0); -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return false; -+ boolean flag = this.func_184595_k(event.targetX, event.targetY, event.targetZ); - - if (flag) - { -@@ -342,6 +344,18 @@ - } - } - -+ /*===================================== Forge Start ==============================*/ -+ public static void setCarriable(Block block, boolean canCarry) -+ { -+ if (canCarry) carriableBlocks.add(block); -+ else carriableBlocks.remove(block); -+ } -+ public static boolean getCarriable(Block block) -+ { -+ return carriableBlocks.contains(block); -+ } -+ /*===================================== Forge End ==============================*/ -+ - public boolean isScreaming() - { - return ((Boolean)this.dataWatcher.func_187225_a(field_184719_bw)).booleanValue(); diff --git a/patches.mcp/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch b/patches.mcp/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch deleted file mode 100644 index a8959be68..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java -+++ ../src-work/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java -@@ -86,6 +86,7 @@ - { - this.motionY = (double)(0.42F + (float)this.getSlimeSize() * 0.1F); - this.isAirBorne = true; -+ net.minecraftforge.common.ForgeHooks.onLivingJump(this); - } - - protected void handleJumpLava() diff --git a/patches.mcp/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch b/patches.mcp/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch deleted file mode 100644 index 07ef5a464..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/monster/EntitySlime.java -+++ ../src-work/minecraft/net/minecraft/entity/monster/EntitySlime.java -@@ -125,7 +125,7 @@ - if (this.onGround && !this.wasOnGround) - { - int i = this.getSlimeSize(); -- -+ if (spawnCustomParticles()) { i = 0; } // don't spawn particles if it's handled by the implementation itself - for (int j = 0; j < i * 8; ++j) - { - float f = this.rand.nextFloat() * ((float)Math.PI * 2F); -@@ -291,7 +291,7 @@ - BlockPos blockpos = new BlockPos(MathHelper.floor_double(this.posX), 0, MathHelper.floor_double(this.posZ)); - Chunk chunk = this.worldObj.getChunkFromBlockCoords(blockpos); - -- if (this.worldObj.getWorldInfo().getTerrainType() == WorldType.FLAT && this.rand.nextInt(4) != 1) -+ if (this.worldObj.getWorldInfo().getTerrainType().handleSlimeSpawnReduction(rand, worldObj)) - { - return false; - } -@@ -356,6 +356,14 @@ - return this.func_189101_db() ? SoundEvents.field_189110_fE : SoundEvents.field_187882_fq; - } - -+ /* ======================================== FORGE START =====================================*/ -+ /** -+ * Called when the slime spawns particles on landing, see onUpdate. -+ * Return true to prevent the spawning of the default particles. -+ */ -+ protected boolean spawnCustomParticles() { return false; } -+ /* ======================================== FORGE END =====================================*/ -+ - static class AISlimeAttack extends EntityAIBase - { - private EntitySlime slime; diff --git a/patches.mcp/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch b/patches.mcp/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch deleted file mode 100644 index 47b77b262..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch +++ /dev/null @@ -1,67 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/monster/EntityZombie.java -+++ ../src-work/minecraft/net/minecraft/entity/monster/EntityZombie.java -@@ -101,7 +101,7 @@ - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23000000417232513D); - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D); - this.getEntityAttribute(SharedMonsterAttributes.field_188791_g).setBaseValue(2.0D); -- this.getAttributeMap().registerAttribute(reinforcementChance).setBaseValue(this.rand.nextDouble() * 0.10000000149011612D); -+ this.getAttributeMap().registerAttribute(reinforcementChance).setBaseValue(this.rand.nextDouble() * net.minecraftforge.common.ForgeModContainer.zombieSummonBaseChance); - } - - protected void entityInit() -@@ -259,12 +259,24 @@ - entitylivingbase = (EntityLivingBase)source.getEntity(); - } - -- if (entitylivingbase != null && this.worldObj.getDifficulty() == EnumDifficulty.HARD && (double)this.rand.nextFloat() < this.getEntityAttribute(reinforcementChance).getAttributeValue() && this.worldObj.getGameRules().getBoolean("doMobSpawning")) -+ int i = MathHelper.floor_double(this.posX); -+ int j = MathHelper.floor_double(this.posY); -+ int k = MathHelper.floor_double(this.posZ); -+ net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent summonAid = net.minecraftforge.event.ForgeEventFactory.fireZombieSummonAid(this, worldObj, i, j, k, entitylivingbase, this.getEntityAttribute(reinforcementChance).getAttributeValue()); -+ if (summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return true; -+ -+ if (summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW || -+ entitylivingbase != null && this.worldObj.getDifficulty() == EnumDifficulty.HARD && (double)this.rand.nextFloat() < this.getEntityAttribute(reinforcementChance).getAttributeValue() && this.worldObj.getGameRules().getBoolean("doMobSpawning")) - { -- int i = MathHelper.floor_double(this.posX); -- int j = MathHelper.floor_double(this.posY); -- int k = MathHelper.floor_double(this.posZ); -- EntityZombie entityzombie = new EntityZombie(this.worldObj); -+ EntityZombie entityzombie; -+ if (summonAid.customSummonedAid != null && summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW) -+ { -+ entityzombie = summonAid.customSummonedAid; -+ } -+ else -+ { -+ entityzombie = new EntityZombie(this.worldObj); -+ } - - for (int l = 0; l < 50; ++l) - { -@@ -272,14 +284,14 @@ - int j1 = j + MathHelper.getRandomIntegerInRange(this.rand, 7, 40) * MathHelper.getRandomIntegerInRange(this.rand, -1, 1); - int k1 = k + MathHelper.getRandomIntegerInRange(this.rand, 7, 40) * MathHelper.getRandomIntegerInRange(this.rand, -1, 1); - -- if (this.worldObj.getBlockState(new BlockPos(i1, j1 - 1, k1)).func_185896_q() && this.worldObj.getLightFromNeighbors(new BlockPos(i1, j1, k1)) < 10) -+ if (this.worldObj.getBlockState(new BlockPos(i1, j1 - 1, k1)).isSideSolid(this.worldObj, new BlockPos(i1, j1 - 1, k1), net.minecraft.util.EnumFacing.UP) && this.worldObj.getLightFromNeighbors(new BlockPos(i1, j1, k1)) < 10) - { - entityzombie.setPosition((double)i1, (double)j1, (double)k1); - - if (!this.worldObj.isAnyPlayerWithinRangeAt((double)i1, (double)j1, (double)k1, 7.0D) && this.worldObj.checkNoEntityCollision(entityzombie.getEntityBoundingBox(), entityzombie) && this.worldObj.func_184144_a(entityzombie, entityzombie.getEntityBoundingBox()).isEmpty() && !this.worldObj.isAnyLiquid(entityzombie.getEntityBoundingBox())) - { - this.worldObj.spawnEntityInWorld(entityzombie); -- entityzombie.setAttackTarget(entitylivingbase); -+ if (entitylivingbase != null) entityzombie.setAttackTarget(entitylivingbase); - entityzombie.onInitialSpawn(this.worldObj.getDifficultyForLocation(new BlockPos(entityzombie)), (IEntityLivingData)null); - this.getEntityAttribute(reinforcementChance).applyModifier(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0)); - entityzombie.getEntityAttribute(reinforcementChance).applyModifier(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, 0)); -@@ -483,7 +495,7 @@ - - if (livingdata == null) - { -- livingdata = new EntityZombie.GroupData(this.worldObj.rand.nextFloat() < 0.05F, this.worldObj.rand.nextFloat() < 0.05F); -+ livingdata = new EntityZombie.GroupData(this.worldObj.rand.nextFloat() < net.minecraftforge.common.ForgeModContainer.zombieBabyChance, this.worldObj.rand.nextFloat() < 0.05F); - } - - if (livingdata instanceof EntityZombie.GroupData) diff --git a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch deleted file mode 100644 index 23074bd5b..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/passive/EntityHorse.java -+++ ../src-work/minecraft/net/minecraft/entity/passive/EntityHorse.java -@@ -1200,6 +1200,7 @@ - } - - this.jumpPower = 0.0F; -+ net.minecraftforge.common.ForgeHooks.onLivingJump(this); - } - - this.stepHeight = 1.0F; diff --git a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch deleted file mode 100644 index 47493b569..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch +++ /dev/null @@ -1,64 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/passive/EntityMooshroom.java -+++ ../src-work/minecraft/net/minecraft/entity/passive/EntityMooshroom.java -@@ -13,7 +13,7 @@ - import net.minecraft.world.World; - import net.minecraft.world.storage.loot.LootTableList; - --public class EntityMooshroom extends EntityCow -+public class EntityMooshroom extends EntityCow implements net.minecraftforge.common.IShearable - { - public EntityMooshroom(World worldIn) - { -@@ -22,6 +22,7 @@ - this.spawnableBlock = Blocks.mycelium; - } - -+ @SuppressWarnings("unused") - public boolean func_184645_a(EntityPlayer p_184645_1_, EnumHand p_184645_2_, ItemStack p_184645_3_) - { - if (p_184645_3_ != null && p_184645_3_.getItem() == Items.bowl && this.getGrowingAge() >= 0 && !p_184645_1_.capabilities.isCreativeMode) -@@ -37,7 +38,7 @@ - - return true; - } -- else if (p_184645_3_ != null && p_184645_3_.getItem() == Items.shears && this.getGrowingAge() >= 0) -+ else if (false && p_184645_3_ != null && p_184645_3_.getItem() == Items.shears && this.getGrowingAge() >= 0) //Forge Disable, Moved to onSheared - { - this.setDead(); - this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY + (double)(this.height / 2.0F), this.posZ, 0.0D, 0.0D, 0.0D, new int[0]); -@@ -78,6 +79,35 @@ - return new EntityMooshroom(this.worldObj); - } - -+ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.math.BlockPos pos){ return getGrowingAge() >= 0; } -+ @Override -+ public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.math.BlockPos pos, int fortune) -+ { -+ this.setDead(); -+ this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY + (double)(this.height / 2.0F), this.posZ, 0.0D, 0.0D, 0.0D, new int[0]); -+ -+ EntityCow entitycow = new EntityCow(this.worldObj); -+ entitycow.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); -+ entitycow.setHealth(this.getHealth()); -+ entitycow.renderYawOffset = this.renderYawOffset; -+ -+ if (this.hasCustomName()) -+ { -+ entitycow.setCustomNameTag(this.getCustomNameTag()); -+ } -+ -+ this.worldObj.spawnEntityInWorld(entitycow); -+ -+ java.util.List ret = new java.util.ArrayList(); -+ for (int i = 0; i < 5; ++i) -+ { -+ ret.add(new ItemStack(Blocks.red_mushroom)); -+ } -+ -+ this.func_184185_a(SoundEvents.field_187784_dt, 1.0F, 1.0F); -+ return ret; -+ } -+ - protected ResourceLocation func_184647_J() - { - return LootTableList.field_186400_H; diff --git a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch deleted file mode 100644 index 0a74cfc61..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/passive/EntityOcelot.java -+++ ../src-work/minecraft/net/minecraft/entity/passive/EntityOcelot.java -@@ -285,7 +285,7 @@ - IBlockState iblockstate = this.worldObj.getBlockState(blockpos.down()); - Block block = iblockstate.getBlock(); - -- if (block == Blocks.grass || iblockstate.func_185904_a() == Material.leaves) -+ if (block == Blocks.grass || block.isLeaves(iblockstate, this.worldObj, blockpos.down())) - { - return true; - } diff --git a/patches.mcp/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch b/patches.mcp/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch deleted file mode 100644 index d8b60f959..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/passive/EntitySheep.java -+++ ../src-work/minecraft/net/minecraft/entity/passive/EntitySheep.java -@@ -42,7 +42,7 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --public class EntitySheep extends EntityAnimal -+public class EntitySheep extends EntityAnimal implements net.minecraftforge.common.IShearable - { - private static final DataParameter field_184774_bv = EntityDataManager.func_187226_a(EntitySheep.class, DataSerializers.field_187191_a); - private final InventoryCrafting inventoryCrafting = new InventoryCrafting(new Container() -@@ -171,9 +171,10 @@ - } - } - -+ @SuppressWarnings("unused") - public boolean func_184645_a(EntityPlayer p_184645_1_, EnumHand p_184645_2_, ItemStack p_184645_3_) - { -- if (p_184645_3_ != null && p_184645_3_.getItem() == Items.shears && !this.getSheared() && !this.isChild()) -+ if (false && p_184645_3_ != null && p_184645_3_.getItem() == Items.shears && !this.getSheared() && !this.isChild()) //Forge: Moved to onSheared - { - if (!this.worldObj.isRemote) - { -@@ -356,4 +357,19 @@ - DYE_TO_RGB.put(EnumDyeColor.RED, new float[] {0.6F, 0.2F, 0.2F}); - DYE_TO_RGB.put(EnumDyeColor.BLACK, new float[] {0.1F, 0.1F, 0.1F}); - } -+ -+ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos){ return !this.getSheared() && !this.isChild(); } -+ @Override -+ public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) -+ { -+ this.setSheared(true); -+ int i = 1 + this.rand.nextInt(3); -+ -+ java.util.List ret = new java.util.ArrayList(); -+ for (int j = 0; j < i; ++j) -+ ret.add(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, this.getFleeceColor().getMetadata())); -+ -+ this.func_184185_a(SoundEvents.field_187763_eJ, 1.0F, 1.0F); -+ return ret; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch deleted file mode 100644 index d2209ab8a..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/passive/EntityVillager.java -+++ ../src-work/minecraft/net/minecraft/entity/passive/EntityVillager.java -@@ -90,6 +90,7 @@ - private boolean isLookingForHome; - private boolean areAdditionalTasksSet; - private InventoryBasic villagerInventory; -+ @Deprecated //Use VillagerRegistry - private static final EntityVillager.ITradeList[][][][] DEFAULT_TRADE_LIST_MAP = new EntityVillager.ITradeList[][][][] {{{{new EntityVillager.EmeraldForItems(Items.wheat, new EntityVillager.PriceInfo(18, 22)), new EntityVillager.EmeraldForItems(Items.potato, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.EmeraldForItems(Items.carrot, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.ListItemForEmeralds(Items.bread, new EntityVillager.PriceInfo(-4, -2))}, {new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.pumpkin), new EntityVillager.PriceInfo(8, 13)), new EntityVillager.ListItemForEmeralds(Items.pumpkin_pie, new EntityVillager.PriceInfo(-3, -2))}, {new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.melon_block), new EntityVillager.PriceInfo(7, 12)), new EntityVillager.ListItemForEmeralds(Items.apple, new EntityVillager.PriceInfo(-5, -7))}, {new EntityVillager.ListItemForEmeralds(Items.cookie, new EntityVillager.PriceInfo(-6, -10)), new EntityVillager.ListItemForEmeralds(Items.cake, new EntityVillager.PriceInfo(1, 1))}}, {{new EntityVillager.EmeraldForItems(Items.string, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ItemAndEmeraldToItem(Items.fish, new EntityVillager.PriceInfo(6, 6), Items.cooked_fish, new EntityVillager.PriceInfo(6, 6))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.fishing_rod, new EntityVillager.PriceInfo(7, 8))}}, {{new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.wool), new EntityVillager.PriceInfo(16, 22)), new EntityVillager.ListItemForEmeralds(Items.shears, new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool)), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 1), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 2), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 3), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 4), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 5), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 6), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 7), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 8), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 9), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 10), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 11), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 12), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 13), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 14), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 15), new EntityVillager.PriceInfo(1, 2))}}, {{new EntityVillager.EmeraldForItems(Items.string, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.ListItemForEmeralds(Items.arrow, new EntityVillager.PriceInfo(-12, -8))}, {new EntityVillager.ListItemForEmeralds(Items.bow, new EntityVillager.PriceInfo(2, 3)), new EntityVillager.ItemAndEmeraldToItem(Item.getItemFromBlock(Blocks.gravel), new EntityVillager.PriceInfo(10, 10), Items.flint, new EntityVillager.PriceInfo(6, 10))}}}, {{{new EntityVillager.EmeraldForItems(Items.paper, new EntityVillager.PriceInfo(24, 36)), new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.EmeraldForItems(Items.book, new EntityVillager.PriceInfo(8, 10)), new EntityVillager.ListItemForEmeralds(Items.compass, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.bookshelf), new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.EmeraldForItems(Items.written_book, new EntityVillager.PriceInfo(2, 2)), new EntityVillager.ListItemForEmeralds(Items.clock, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.glass), new EntityVillager.PriceInfo(-5, -3))}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListItemForEmeralds(Items.name_tag, new EntityVillager.PriceInfo(20, 22))}}}, {{{new EntityVillager.EmeraldForItems(Items.rotten_flesh, new EntityVillager.PriceInfo(36, 40)), new EntityVillager.EmeraldForItems(Items.gold_ingot, new EntityVillager.PriceInfo(8, 10))}, {new EntityVillager.ListItemForEmeralds(Items.redstone, new EntityVillager.PriceInfo(-4, -1)), new EntityVillager.ListItemForEmeralds(new ItemStack(Items.dye, 1, EnumDyeColor.BLUE.getDyeDamage()), new EntityVillager.PriceInfo(-2, -1))}, {new EntityVillager.ListItemForEmeralds(Items.ender_pearl, new EntityVillager.PriceInfo(4, 7)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.glowstone), new EntityVillager.PriceInfo(-3, -1))}, {new EntityVillager.ListItemForEmeralds(Items.experience_bottle, new EntityVillager.PriceInfo(3, 11))}}}, {{{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.iron_helmet, new EntityVillager.PriceInfo(4, 6))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListItemForEmeralds(Items.iron_chestplate, new EntityVillager.PriceInfo(10, 14))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_chestplate, new EntityVillager.PriceInfo(16, 19))}, {new EntityVillager.ListItemForEmeralds(Items.chainmail_boots, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.chainmail_leggings, new EntityVillager.PriceInfo(9, 11)), new EntityVillager.ListItemForEmeralds(Items.chainmail_helmet, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.chainmail_chestplate, new EntityVillager.PriceInfo(11, 15))}}, {{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.iron_axe, new EntityVillager.PriceInfo(6, 8))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_sword, new EntityVillager.PriceInfo(9, 10))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_sword, new EntityVillager.PriceInfo(12, 15)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_axe, new EntityVillager.PriceInfo(9, 12))}}, {{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_shovel, new EntityVillager.PriceInfo(5, 7))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_pickaxe, new EntityVillager.PriceInfo(9, 11))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_pickaxe, new EntityVillager.PriceInfo(12, 15))}}}, {{{new EntityVillager.EmeraldForItems(Items.porkchop, new EntityVillager.PriceInfo(14, 18)), new EntityVillager.EmeraldForItems(Items.chicken, new EntityVillager.PriceInfo(14, 18))}, {new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.cooked_porkchop, new EntityVillager.PriceInfo(-7, -5)), new EntityVillager.ListItemForEmeralds(Items.cooked_chicken, new EntityVillager.PriceInfo(-8, -6))}}, {{new EntityVillager.EmeraldForItems(Items.leather, new EntityVillager.PriceInfo(9, 12)), new EntityVillager.ListItemForEmeralds(Items.leather_leggings, new EntityVillager.PriceInfo(2, 4))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.leather_chestplate, new EntityVillager.PriceInfo(7, 12))}, {new EntityVillager.ListItemForEmeralds(Items.saddle, new EntityVillager.PriceInfo(8, 10))}}}}; - - public EntityVillager(World worldIn) -@@ -221,7 +222,7 @@ - { - boolean flag = p_184645_3_ != null && p_184645_3_.getItem() == Items.spawn_egg; - -- if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild()) -+ if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild() && !p_184645_1_.isSneaking()) - { - if (!this.worldObj.isRemote && (this.buyingList == null || !this.buyingList.isEmpty())) - { -@@ -533,6 +534,7 @@ - - private void populateBuyingList() - { -+ //TODO: Hook into VillagerRegistry - EntityVillager.ITradeList[][][] aentityvillager$itradelist = DEFAULT_TRADE_LIST_MAP[this.getProfession()]; - - if (this.careerId != 0 && this.careerLevel != 0) -@@ -647,6 +649,7 @@ - } - } - -+ //TODO: Hook into VillagerRegistry to get name - if (s1 != null) - { - TextComponentTranslation textcomponenttranslation = new TextComponentTranslation("entity.Villager." + s1, new Object[0]); -@@ -708,7 +711,7 @@ - public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata) - { - livingdata = super.onInitialSpawn(difficulty, livingdata); -- this.setProfession(this.worldObj.rand.nextInt(5)); -+ net.minecraftforge.fml.common.registry.VillagerRegistry.setRandomProfession(this, this.worldObj.rand); - this.setAdditionalAItasks(); - return livingdata; - } diff --git a/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch b/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch deleted file mode 100644 index e34743688..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch +++ /dev/null @@ -1,540 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/player/EntityPlayer.java -+++ ../src-work/minecraft/net/minecraft/entity/player/EntityPlayer.java -@@ -93,6 +93,11 @@ - @SuppressWarnings("incomplete-switch") - public abstract class EntityPlayer extends EntityLivingBase - { -+ public static final String PERSISTED_NBT_TAG = "PlayerPersisted"; -+ private java.util.HashMap spawnChunkMap = new java.util.HashMap(); -+ private java.util.HashMap spawnForcedMap = new java.util.HashMap(); -+ public float eyeHeight = this.getDefaultEyeHeight(); -+ - private static final DataParameter field_184829_a = EntityDataManager.func_187226_a(EntityPlayer.class, DataSerializers.field_187193_c); - private static final DataParameter field_184830_b = EntityDataManager.func_187226_a(EntityPlayer.class, DataSerializers.field_187192_b); - protected static final DataParameter field_184827_bp = EntityDataManager.func_187226_a(EntityPlayer.class, DataSerializers.field_187191_a); -@@ -174,6 +179,7 @@ - - public void onUpdate() - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPlayerPreTick(this); - this.noClip = this.isSpectator(); - - if (this.isSpectator()) -@@ -219,7 +225,7 @@ - - super.onUpdate(); - -- if (!this.worldObj.isRemote && this.openContainer != null && !this.openContainer.canInteractWith(this)) -+ if (!this.worldObj.isRemote && this.openContainer != null && !net.minecraftforge.common.ForgeHooks.canInteractWith(this, this.openContainer)) - { - this.closeScreen(); - this.openContainer = this.inventoryContainer; -@@ -360,6 +366,7 @@ - this.setSize(f, f1); - } - } -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPlayerPostTick(this); - } - - public int getMaxInPortalTime() -@@ -442,11 +449,11 @@ - this.cameraYaw = 0.0F; - this.addMountedMovementStat(this.posX - d0, this.posY - d1, this.posZ - d2); - -- if (this.func_184187_bx() instanceof EntityPig) -+ if (this.func_184187_bx() instanceof EntityLivingBase && ((EntityLivingBase)this.func_94060_bK()).shouldRiderFaceForward(this)) - { - this.rotationPitch = f1; - this.rotationYaw = f; -- this.renderYawOffset = ((EntityPig)this.func_184187_bx()).renderYawOffset; -+ this.renderYawOffset = ((EntityLivingBase)this.func_184187_bx()).renderYawOffset; - } - } - } -@@ -576,11 +583,15 @@ - - public void onDeath(DamageSource cause) - { -+ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, cause)) return; - super.onDeath(cause); - this.setSize(0.2F, 0.2F); - this.setPosition(this.posX, this.posY, this.posZ); - this.motionY = 0.10000000149011612D; - -+ captureDrops = true; -+ capturedDrops.clear(); -+ - if (this.getName().equals("Notch")) - { - this.dropItem(new ItemStack(Items.apple, 1), true, false); -@@ -591,6 +602,9 @@ - this.inventory.dropAllItems(); - } - -+ captureDrops = false; -+ if (!worldObj.isRemote) net.minecraftforge.event.ForgeEventFactory.onPlayerDrops(this, cause, capturedDrops, recentlyHit > 0); -+ - if (cause != null) - { - this.motionX = (double)(-MathHelper.cos((this.attackedAtYaw + this.rotationYaw) * 0.017453292F) * 0.1F); -@@ -678,12 +692,25 @@ - - public EntityItem dropOneItem(boolean dropAll) - { -- return this.dropItem(this.inventory.decrStackSize(this.inventory.currentItem, dropAll && this.inventory.getCurrentItem() != null ? this.inventory.getCurrentItem().stackSize : 1), false, true); -+ ItemStack stack = inventory.getCurrentItem(); -+ -+ if (stack == null) -+ { -+ return null; -+ } -+ -+ if (stack.getItem().onDroppedByPlayer(stack, this)) -+ { -+ int count = dropAll && this.inventory.getCurrentItem() != null ? this.inventory.getCurrentItem().stackSize : 1; -+ return net.minecraftforge.common.ForgeHooks.onPlayerTossEvent(this, inventory.decrStackSize(inventory.currentItem, count), true); -+ } -+ -+ return null; - } - - public EntityItem dropPlayerItemWithRandomChoice(ItemStack itemStackIn, boolean unused) - { -- return this.dropItem(itemStackIn, false, false); -+ return net.minecraftforge.common.ForgeHooks.onPlayerTossEvent(this, itemStackIn, false); - } - - public EntityItem dropItem(ItemStack droppedItem, boolean dropAround, boolean traceItem) -@@ -746,15 +773,22 @@ - - public ItemStack func_184816_a(EntityItem p_184816_1_) - { -+ if (captureDrops) capturedDrops.add(p_184816_1_); -+ else // Forge: Don't indent to keep patch smaller. - this.worldObj.spawnEntityInWorld(p_184816_1_); - ItemStack itemstack = p_184816_1_.getEntityItem(); - return itemstack; - } - -+ @Deprecated //Use location sensitive version below - public float func_184813_a(IBlockState p_184813_1_) - { -- float f = this.inventory.func_184438_a(p_184813_1_); -+ return getBreakSpeed(p_184813_1_, new BlockPos(0, -1, 0)); -+ } - -+ public float getBreakSpeed(IBlockState state, BlockPos pos) -+ { -+ float f = this.inventory.func_184438_a(state); - if (f > 1.0F) - { - int i = EnchantmentHelper.func_185293_e(this); -@@ -804,12 +838,13 @@ - f /= 5.0F; - } - -- return f; -+ f = net.minecraftforge.event.ForgeEventFactory.getBreakSpeed(this, state, f, pos); -+ return (f < 0 ? 0 : f); - } - - public boolean func_184823_b(IBlockState p_184823_1_) - { -- return this.inventory.func_184432_b(p_184823_1_); -+ return net.minecraftforge.event.ForgeEventFactory.doPlayerHarvestCheck(this, p_184823_1_, this.inventory.func_184432_b(p_184823_1_)); - } - - public void readEntityFromNBT(NBTTagCompound tagCompund) -@@ -845,6 +880,16 @@ - this.spawnForced = tagCompund.getBoolean("SpawnForced"); - } - -+ NBTTagList spawnlist = null; -+ spawnlist = tagCompund.getTagList("Spawns", 10); -+ for (int i = 0; i < spawnlist.tagCount(); i++) -+ { -+ NBTTagCompound spawndata = (NBTTagCompound)spawnlist.getCompoundTagAt(i); -+ int spawndim = spawndata.getInteger("Dim"); -+ this.spawnChunkMap.put(spawndim, new BlockPos(spawndata.getInteger("SpawnX"), spawndata.getInteger("SpawnY"), spawndata.getInteger("SpawnZ"))); -+ this.spawnForcedMap.put(spawndim, spawndata.getBoolean("SpawnForced")); -+ } -+ - this.foodStats.readNBT(tagCompund); - this.capabilities.readCapabilitiesFromNBT(tagCompund); - -@@ -877,6 +922,23 @@ - tagCompound.setBoolean("SpawnForced", this.spawnForced); - } - -+ NBTTagList spawnlist = new NBTTagList(); -+ for (java.util.Map.Entry entry : this.spawnChunkMap.entrySet()) -+ { -+ BlockPos spawn = entry.getValue(); -+ if (spawn == null) continue; -+ Boolean forced = spawnForcedMap.get(entry.getKey()); -+ if (forced == null) forced = false; -+ NBTTagCompound spawndata = new NBTTagCompound(); -+ spawndata.setInteger("Dim", entry.getKey()); -+ spawndata.setInteger("SpawnX", spawn.getX()); -+ spawndata.setInteger("SpawnY", spawn.getY()); -+ spawndata.setInteger("SpawnZ", spawn.getZ()); -+ spawndata.setBoolean("SpawnForced", forced); -+ spawnlist.appendTag(spawndata); -+ } -+ tagCompound.setTag("Spawns", spawnlist); -+ - this.foodStats.writeNBT(tagCompound); - this.capabilities.writeCapabilitiesToNBT(tagCompound); - tagCompound.setTag("EnderItems", this.theInventoryEnderChest.saveInventoryToNBT()); -@@ -884,6 +946,7 @@ - - public boolean attackEntityFrom(DamageSource source, float amount) - { -+ if (!net.minecraftforge.common.ForgeHooks.onLivingAttack(this, source, amount)) return false; - if (this.isEntityInvulnerable(source)) - { - return false; -@@ -966,6 +1029,7 @@ - if (this.field_184627_bm.stackSize <= 0) - { - EnumHand enumhand = this.func_184600_cs(); -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, this.field_184627_bm, enumhand); - - if (enumhand == EnumHand.MAIN_HAND) - { -@@ -1001,8 +1065,12 @@ - { - if (!this.isEntityInvulnerable(damageSrc)) - { -+ damageAmount = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, damageSrc, damageAmount); -+ if (damageAmount <= 0) return; - damageAmount = this.applyArmorCalculations(damageSrc, damageAmount); - damageAmount = this.applyPotionDamageCalculations(damageSrc, damageAmount); -+ damageAmount = net.minecraftforge.common.ISpecialArmor.ArmorProperties.applyArmor(this, inventory.armorInventory, damageSrc, damageAmount); -+ if (damageAmount <= 0) return; - float f = damageAmount; - damageAmount = Math.max(damageAmount - this.getAbsorptionAmount(), 0.0F); - this.setAbsorptionAmount(this.getAbsorptionAmount() - (f - damageAmount)); -@@ -1067,6 +1135,7 @@ - } - else - { -+ if (!net.minecraftforge.event.ForgeEventFactory.canInteractWith(this, p_184822_1_, p_184822_2_, p_184822_3_)) return EnumActionResult.PASS; - ItemStack itemstack = p_184822_2_ != null ? p_184822_2_.copy() : null; - - if (!p_184822_1_.func_184230_a(this, p_184822_2_, p_184822_3_)) -@@ -1123,6 +1192,7 @@ - - public void attackTargetEntityWithCurrentItem(Entity targetEntity) - { -+ if (!net.minecraftforge.common.ForgeHooks.onPlayerAttackTarget(this, targetEntity)) return; - if (targetEntity.canAttackWithItem()) - { - if (!targetEntity.hitByEntity(this)) -@@ -1410,6 +1480,8 @@ - - public EntityPlayer.EnumStatus trySleep(BlockPos bedLocation) - { -+ EntityPlayer.EnumStatus ret = net.minecraftforge.event.ForgeEventFactory.onPlayerSleepInBed(this, bedLocation); -+ if (ret != null) return ret; - if (!this.worldObj.isRemote) - { - if (this.isPlayerSleeping() || !this.isEntityAlive()) -@@ -1449,9 +1521,10 @@ - - this.setSize(0.2F, 0.2F); - -- if (this.worldObj.isBlockLoaded(bedLocation)) -- { -- EnumFacing enumfacing = (EnumFacing)this.worldObj.getBlockState(bedLocation).getValue(BlockHorizontal.field_185512_D); -+ IBlockState state = null; -+ if (this.worldObj.isBlockLoaded(bedLocation)) state = this.worldObj.getBlockState(bedLocation); -+ if (state != null && state.getBlock().isBed(state, this.worldObj, bedLocation, this)) { -+ EnumFacing enumfacing = state.getBlock().getBedDirection(state, this.worldObj, bedLocation); - float f = 0.5F; - float f1 = 0.5F; - -@@ -1514,13 +1587,14 @@ - - public void wakeUpPlayer(boolean p_70999_1_, boolean updateWorldFlag, boolean setSpawn) - { -+ net.minecraftforge.event.ForgeEventFactory.onPlayerWakeup(this, p_70999_1_, updateWorldFlag, setSpawn); - this.setSize(0.6F, 1.8F); - IBlockState iblockstate = this.worldObj.getBlockState(this.playerLocation); - -- if (this.playerLocation != null && iblockstate.getBlock() == Blocks.bed) -+ if (this.playerLocation != null && iblockstate.getBlock().isBed(iblockstate, worldObj, playerLocation, this)) - { -- this.worldObj.setBlockState(this.playerLocation, iblockstate.withProperty(BlockBed.OCCUPIED, Boolean.valueOf(false)), 4); -- BlockPos blockpos = BlockBed.getSafeExitLocation(this.worldObj, this.playerLocation, 0); -+ iblockstate.getBlock().setBedOccupied(worldObj, playerLocation, this, false); -+ BlockPos blockpos = iblockstate.getBlock().getBedSpawnPosition(iblockstate, worldObj, playerLocation, this); - - if (blockpos == null) - { -@@ -1529,6 +1603,10 @@ - - this.setPosition((double)((float)blockpos.getX() + 0.5F), (double)((float)blockpos.getY() + 0.1F), (double)((float)blockpos.getZ() + 0.5F)); - } -+ else -+ { -+ setSpawn = false; -+ } - - this.sleeping = false; - -@@ -1547,14 +1625,15 @@ - - private boolean isInBed() - { -- return this.worldObj.getBlockState(this.playerLocation).getBlock() == Blocks.bed; -+ return net.minecraftforge.event.ForgeEventFactory.fireSleepingLocationCheck(this, playerLocation); - } - - public static BlockPos getBedSpawnLocation(World worldIn, BlockPos bedLocation, boolean forceSpawn) - { -- Block block = worldIn.getBlockState(bedLocation).getBlock(); -+ IBlockState state = worldIn.getBlockState(bedLocation); -+ Block block = state.getBlock(); - -- if (block != Blocks.bed) -+ if (!block.isBed(state, worldIn, bedLocation, null)) - { - if (!forceSpawn) - { -@@ -1569,16 +1648,17 @@ - } - else - { -- return BlockBed.getSafeExitLocation(worldIn, bedLocation, 0); -+ return block.getBedSpawnPosition(state, worldIn, bedLocation, null); - } - } - - @SideOnly(Side.CLIENT) - public float getBedOrientationInDegrees() - { -- if (this.playerLocation != null) -+ IBlockState state = this.playerLocation == null ? null : this.worldObj.getBlockState(playerLocation); -+ if (state != null && state.getBlock().isBed(state, worldObj, playerLocation, this)) - { -- EnumFacing enumfacing = (EnumFacing)this.worldObj.getBlockState(this.playerLocation).getValue(BlockHorizontal.field_185512_D); -+ EnumFacing enumfacing = state.getBlock().getBedDirection(state, worldObj, playerLocation); - - switch (enumfacing) - { -@@ -1618,16 +1698,24 @@ - - public BlockPos getBedLocation() - { -- return this.spawnChunk; -+ return getBedLocation(this.dimension); - } - -+ @Deprecated // Use dimension-sensitive version. - public boolean isSpawnForced() - { -- return this.spawnForced; -+ return isSpawnForced(this.dimension); - } - - public void setSpawnPoint(BlockPos pos, boolean forced) - { -+ if(net.minecraftforge.event.ForgeEventFactory.onPlayerSpawnSet(this, pos, forced)) return; -+ if (this.dimension != 0) -+ { -+ setSpawnChunk(pos, forced, this.dimension); -+ return; -+ } -+ - if (pos != null) - { - this.spawnChunk = pos; -@@ -1822,6 +1910,10 @@ - - super.fall(distance, damageMultiplier); - } -+ else -+ { -+ net.minecraftforge.event.ForgeEventFactory.onPlayerFall(this, distance, damageMultiplier); -+ } - } - - protected void resetHeight() -@@ -2022,6 +2114,18 @@ - this.xpSeed = oldPlayer.xpSeed; - this.theInventoryEnderChest = oldPlayer.theInventoryEnderChest; - this.func_184212_Q().func_187227_b(field_184827_bp, oldPlayer.func_184212_Q().func_187225_a(field_184827_bp)); -+ -+ this.spawnChunkMap = oldPlayer.spawnChunkMap; -+ this.spawnForcedMap = oldPlayer.spawnForcedMap; -+ -+ //Copy over a section of the Entity Data from the old player. -+ //Allows mods to specify data that persists after players respawn. -+ NBTTagCompound old = oldPlayer.getEntityData(); -+ if (old.hasKey(PERSISTED_NBT_TAG)) -+ { -+ getEntityData().setTag(PERSISTED_NBT_TAG, old.getCompoundTag(PERSISTED_NBT_TAG)); -+ } -+ net.minecraftforge.event.ForgeEventFactory.onPlayerClone(this, oldPlayer, !respawnFromEnd); - } - - protected boolean canTriggerWalking() -@@ -2120,7 +2224,10 @@ - - public ITextComponent getDisplayName() - { -- ITextComponent itextcomponent = new TextComponentString(ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getName())); -+ ITextComponent itextcomponent = new TextComponentString(""); -+ if (!prefixes.isEmpty()) for (ITextComponent prefix : prefixes) itextcomponent.appendSibling(prefix); -+ itextcomponent.appendSibling(new TextComponentString(ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getName()))); -+ if (!suffixes.isEmpty()) for (ITextComponent suffix : suffixes) itextcomponent.appendSibling(suffix); - itextcomponent.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/msg " + this.getName() + " ")); - itextcomponent.getChatStyle().setChatHoverEvent(this.getHoverEvent()); - itextcomponent.getChatStyle().setInsertion(this.getName()); -@@ -2129,7 +2236,7 @@ - - public float getEyeHeight() - { -- float f = 1.62F; -+ float f = eyeHeight; - - if (this.isPlayerSleeping()) - { -@@ -2340,6 +2447,136 @@ - return (float)this.getEntityAttribute(SharedMonsterAttributes.field_188792_h).getAttributeValue(); - } - -+ /** -+ * Opens a GUI with this player, uses FML's IGuiHandler system. -+ * Allows for extension by modders. -+ * -+ * @param mod The mod trying to open a GUI -+ * @param modGuiId GUI ID -+ * @param world Current World -+ * @param x Passed directly to IGuiHandler, data meaningless Typically world X position -+ * @param y Passed directly to IGuiHandler, data meaningless Typically world Y position -+ * @param z Passed directly to IGuiHandler, data meaningless Typically world Z position -+ */ -+ public void openGui(Object mod, int modGuiId, World world, int x, int y, int z) -+ { -+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.openGui(this, mod, modGuiId, world, x, y, z); -+ } -+ -+ -+ /* ======================================== FORGE START =====================================*/ -+ /** -+ * A dimension aware version of getBedLocation. -+ * @param dimension The dimension to get the bed spawn for -+ * @return The player specific spawn location for the dimension. May be null. -+ */ -+ public BlockPos getBedLocation(int dimension) -+ { -+ return dimension == 0 ? spawnChunk : spawnChunkMap.get(dimension); -+ } -+ -+ /** -+ * A dimension aware version of isSpawnForced. -+ * Noramally isSpawnForced is used to determine if the respawn system should check for a bed or not. -+ * This just extends that to be dimension aware. -+ * @param dimension The dimension to get whether to check for a bed before spawning for -+ * @return The player specific spawn location for the dimension. May be null. -+ */ -+ public boolean isSpawnForced(int dimension) -+ { -+ if (dimension == 0) return this.spawnForced; -+ Boolean forced = this.spawnForcedMap.get(dimension); -+ return forced == null ? false : forced; -+ } -+ -+ /** -+ * A dimension aware version of setSpawnChunk. -+ * This functions identically, but allows you to specify which dimension to affect, rather than affecting the player's current dimension. -+ * @param pos The spawn point to set as the player-specific spawn point for the dimension -+ * @param forced Whether or not the respawn code should check for a bed at this location (true means it won't check for a bed) -+ * @param dimension Which dimension to apply the player-specific respawn point to -+ */ -+ public void setSpawnChunk(BlockPos pos, boolean forced, int dimension) -+ { -+ if (dimension == 0) -+ { -+ if (pos != null) -+ { -+ spawnChunk = pos; -+ spawnForced = forced; -+ } -+ else -+ { -+ spawnChunk = null; -+ spawnForced = false; -+ } -+ return; -+ } -+ -+ if (pos != null) -+ { -+ spawnChunkMap.put(dimension, pos); -+ spawnForcedMap.put(dimension, forced); -+ } -+ else -+ { -+ spawnChunkMap.remove(dimension); -+ spawnForcedMap.remove(dimension); -+ } -+ } -+ -+ private String displayname; -+ -+ /** -+ * Returns the default eye height of the player -+ * @return player default eye height -+ */ -+ public float getDefaultEyeHeight() -+ { -+ return 1.62F; -+ } -+ -+ /** -+ * Get the currently computed display name, cached for efficiency. -+ * @return the current display name -+ */ -+ public String getDisplayNameString() -+ { -+ if(this.displayname == null) -+ { -+ this.displayname = net.minecraftforge.event.ForgeEventFactory.getPlayerDisplayName(this, this.getName()); -+ } -+ return this.displayname; -+ } -+ -+ /** -+ * Force the displayed name to refresh -+ */ -+ public void refreshDisplayName() -+ { -+ this.displayname = net.minecraftforge.event.ForgeEventFactory.getPlayerDisplayName(this, this.getName()); -+ } -+ -+ private final java.util.Collection prefixes = new java.util.LinkedList(); -+ private final java.util.Collection suffixes = new java.util.LinkedList(); -+ -+ /** -+ * Add a prefix to the player's username in chat -+ * @param prefix The prefix -+ */ -+ public void addPrefix(ITextComponent prefix) { prefixes.add(prefix); } -+ -+ /** -+ * Add a suffix to the player's username in chat -+ * @param suffix The suffix -+ */ -+ public void addSuffix(ITextComponent suffix) { suffixes.add(suffix); } -+ -+ public java.util.Collection getPrefixes() { return this.prefixes; } -+ public java.util.Collection getSuffixes() { return this.suffixes; } -+ -+ /* ======================================== FORGE END =====================================*/ -+ - public static enum EnumChatVisibility - { - FULL(0, "options.chat.visibility.full"), diff --git a/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch b/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch deleted file mode 100644 index 08230f74a..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch +++ /dev/null @@ -1,83 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/player/EntityPlayerMP.java -+++ ../src-work/minecraft/net/minecraft/entity/player/EntityPlayerMP.java -@@ -134,14 +134,15 @@ - public int ping; - public boolean playerConqueredTheEnd; - -+ @SuppressWarnings("unused") - public EntityPlayerMP(MinecraftServer server, WorldServer worldIn, GameProfile profile, PlayerInteractionManager interactionManager) - { - super(worldIn, profile); - interactionManager.thisPlayerMP = this; - this.theItemInWorldManager = interactionManager; -- BlockPos blockpos = worldIn.getSpawnPoint(); -+ BlockPos blockpos = worldIn.provider.getRandomizedSpawnPoint(); - -- if (!worldIn.provider.getHasNoSky() && worldIn.getWorldInfo().getGameType() != WorldSettings.GameType.ADVENTURE) -+ if (false && !worldIn.provider.getHasNoSky() && worldIn.getWorldInfo().getGameType() != WorldSettings.GameType.ADVENTURE) - { - int i = Math.max(0, server.func_184108_a(worldIn)); - int j = MathHelper.floor_double(worldIn.getWorldBorder().getClosestDistance((double)blockpos.getX(), (double)blockpos.getZ())); -@@ -250,7 +251,7 @@ - - this.openContainer.detectAndSendChanges(); - -- if (!this.worldObj.isRemote && !this.openContainer.canInteractWith(this)) -+ if (!this.worldObj.isRemote && !net.minecraftforge.common.ForgeHooks.canInteractWith(this, this.openContainer)) - { - this.closeScreen(); - this.openContainer = this.inventoryContainer; -@@ -433,6 +434,7 @@ - - public void onDeath(DamageSource cause) - { -+ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, cause)) return; - boolean flag = this.worldObj.getGameRules().getBoolean("showDeathMessages"); - this.playerNetServerHandler.sendPacket(new SPacketCombatEvent(this.getCombatTracker(), SPacketCombatEvent.Event.ENTITY_DIED, flag)); - -@@ -459,7 +461,20 @@ - - if (!this.worldObj.getGameRules().getBoolean("keepInventory") && !this.isSpectator()) - { -+ captureDrops = true; -+ capturedDrops.clear(); -+ - this.inventory.dropAllItems(); -+ -+ captureDrops = false; -+ net.minecraftforge.event.entity.player.PlayerDropsEvent event = new net.minecraftforge.event.entity.player.PlayerDropsEvent(this, cause, capturedDrops, recentlyHit > 0); -+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) -+ { -+ for (net.minecraft.entity.item.EntityItem item : capturedDrops) -+ { -+ this.worldObj.spawnEntityInWorld(item); -+ } -+ } - } - - for (ScoreObjective scoreobjective : this.worldObj.getScoreboard().getObjectivesFromCriteria(IScoreCriteria.deathCount)) -@@ -540,6 +555,7 @@ - - public Entity func_184204_a(int p_184204_1_) - { -+ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_184204_1_)) return this; - this.field_184851_cj = true; - - if (this.dimension == 1 && p_184204_1_ == 1) -@@ -697,7 +713,7 @@ - BlockPos blockpos = new BlockPos(i, j, k); - IBlockState iblockstate = this.worldObj.getBlockState(blockpos); - -- if (iblockstate.func_185904_a() == Material.air) -+ if (iblockstate.getBlock().isAir(iblockstate, this.worldObj, blockpos)) - { - BlockPos blockpos1 = blockpos.down(); - IBlockState iblockstate1 = this.worldObj.getBlockState(blockpos1); -@@ -921,6 +937,7 @@ - { - if (stat != null) - { -+ if (stat.isAchievement() && net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.AchievementEvent(this, (net.minecraft.stats.Achievement) stat))) return; - this.statsFile.increaseStat(this, stat, amount); - - for (ScoreObjective scoreobjective : this.getWorldScoreboard().getObjectivesFromCriteria(stat.func_150952_k())) diff --git a/patches.mcp/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch b/patches.mcp/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch deleted file mode 100644 index 8f0f421e9..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/player/InventoryPlayer.java -+++ ../src-work/minecraft/net/minecraft/entity/player/InventoryPlayer.java -@@ -270,13 +270,8 @@ - - if (itemstack == null) - { -- itemstack = new ItemStack(item, 0, itemStackIn.getMetadata()); -- -- if (itemStackIn.hasTagCompound()) -- { -- itemstack.setTagCompound((NBTTagCompound)itemStackIn.getTagCompound().copy()); -- } -- -+ itemstack = itemStackIn.copy(); // Forge: Replace Item clone above to preserve item capabilities when picking the item up. -+ itemstack.stackSize = 0; - this.setInventorySlotContents(j, itemstack); - } - -@@ -344,6 +339,14 @@ - } - } - } -+ -+ for (int i = 0; i < armorInventory.length; i++) -+ { -+ if (armorInventory[i] != null) -+ { -+ armorInventory[i].getItem().onArmorTick(player.worldObj, player, armorInventory[i]); -+ } -+ } - } - - public boolean addItemStackToInventory(final ItemStack itemStackIn) diff --git a/patches.mcp/minecraft/net/minecraft/init/Bootstrap.java.patch b/patches.mcp/minecraft/net/minecraft/init/Bootstrap.java.patch deleted file mode 100644 index 7033d745a..000000000 --- a/patches.mcp/minecraft/net/minecraft/init/Bootstrap.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/init/Bootstrap.java -+++ ../src-work/minecraft/net/minecraft/init/Bootstrap.java -@@ -74,6 +74,7 @@ - return alreadyRegistered; - } - -+ @SuppressWarnings("unused") - static void registerDispenserBehaviors() - { - BlockDispenser.dispenseBehaviorRegistry.putObject(Items.arrow, new BehaviorProjectileDispense() diff --git a/patches.mcp/minecraft/net/minecraft/inventory/Container.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/Container.java.patch deleted file mode 100644 index 0c7a86b06..000000000 --- a/patches.mcp/minecraft/net/minecraft/inventory/Container.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/Container.java -+++ ../src-work/minecraft/net/minecraft/inventory/Container.java -@@ -646,7 +646,7 @@ - Slot slot1 = (Slot)this.inventorySlots.get(i); - ItemStack itemstack1 = slot1.getStack(); - -- if (itemstack1 == null) -+ if (itemstack1 == null && slot1.isItemValid(stack)) // Forge: Make sure to respect isItemValid in the slot. - { - slot1.putStack(stack.copy()); - slot1.onSlotChanged(); diff --git a/patches.mcp/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch deleted file mode 100644 index d8b6bd0eb..000000000 --- a/patches.mcp/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/ContainerBeacon.java -+++ ../src-work/minecraft/net/minecraft/inventory/ContainerBeacon.java -@@ -143,7 +143,7 @@ - - public boolean isItemValid(ItemStack stack) - { -- return stack == null ? false : stack.getItem() == Items.emerald || stack.getItem() == Items.diamond || stack.getItem() == Items.gold_ingot || stack.getItem() == Items.iron_ingot; -+ return stack == null ? false : stack.getItem().isBeaconPayment(stack); - } - - public int getSlotStackLimit() diff --git a/patches.mcp/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch deleted file mode 100644 index 2ff5ecea8..000000000 --- a/patches.mcp/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/ContainerBrewingStand.java -+++ ../src-work/minecraft/net/minecraft/inventory/ContainerBrewingStand.java -@@ -196,7 +196,7 @@ - - public boolean isItemValid(ItemStack stack) - { -- return stack != null && PotionHelper.func_185205_a(stack); -+ return stack != null && net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(stack); - } - - public int getSlotStackLimit() -@@ -243,8 +243,7 @@ - } - else - { -- Item item = stack.getItem(); -- return item == Items.potionitem || item == Items.glass_bottle || item == Items.field_185155_bH || item == Items.field_185156_bI; -+ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(stack); - } - } - } diff --git a/patches.mcp/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch deleted file mode 100644 index 41a1e9c6f..000000000 --- a/patches.mcp/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch +++ /dev/null @@ -1,77 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/ContainerEnchantment.java -+++ ../src-work/minecraft/net/minecraft/inventory/ContainerEnchantment.java -@@ -68,9 +68,12 @@ - }); - this.addSlotToContainer(new Slot(this.tableInventory, 1, 35, 47) - { -+ java.util.List ores = net.minecraftforge.oredict.OreDictionary.getOres("gemLapis"); - public boolean isItemValid(ItemStack stack) - { -- return stack.getItem() == Items.dye && EnumDyeColor.byDyeDamage(stack.getMetadata()) == EnumDyeColor.BLUE; -+ for (ItemStack ore : ores) -+ if (net.minecraftforge.oredict.OreDictionary.itemMatches(ore, stack, false)) return true; -+ return false; - } - }); - -@@ -155,6 +158,7 @@ - if (!this.worldPointer.isRemote) - { - int l = 0; -+ float power = 0; - - for (int j = -1; j <= 1; ++j) - { -@@ -162,37 +166,14 @@ - { - if ((j != 0 || k != 0) && this.worldPointer.isAirBlock(this.position.add(k, 0, j)) && this.worldPointer.isAirBlock(this.position.add(k, 1, j))) - { -- if (this.worldPointer.getBlockState(this.position.add(k * 2, 0, j * 2)).getBlock() == Blocks.bookshelf) -- { -- ++l; -- } -- -- if (this.worldPointer.getBlockState(this.position.add(k * 2, 1, j * 2)).getBlock() == Blocks.bookshelf) -- { -- ++l; -- } -- -+ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k * 2, 0, j * 2)); -+ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k * 2, 1, j * 2)); - if (k != 0 && j != 0) - { -- if (this.worldPointer.getBlockState(this.position.add(k * 2, 0, j)).getBlock() == Blocks.bookshelf) -- { -- ++l; -- } -- -- if (this.worldPointer.getBlockState(this.position.add(k * 2, 1, j)).getBlock() == Blocks.bookshelf) -- { -- ++l; -- } -- -- if (this.worldPointer.getBlockState(this.position.add(k, 0, j * 2)).getBlock() == Blocks.bookshelf) -- { -- ++l; -- } -- -- if (this.worldPointer.getBlockState(this.position.add(k, 1, j * 2)).getBlock() == Blocks.bookshelf) -- { -- ++l; -- } -+ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k * 2, 0, j)); -+ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k * 2, 1, j)); -+ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k, 0, j * 2)); -+ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k, 1, j * 2)); - } - } - } -@@ -202,7 +183,7 @@ - - for (int i1 = 0; i1 < 3; ++i1) - { -- this.enchantLevels[i1] = EnchantmentHelper.calcItemStackEnchantability(this.rand, i1, l, itemstack); -+ this.enchantLevels[i1] = EnchantmentHelper.calcItemStackEnchantability(this.rand, i1, (int)power, itemstack); - this.field_185001_h[i1] = -1; - this.field_185002_i[i1] = -1; - diff --git a/patches.mcp/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch deleted file mode 100644 index 729349b46..000000000 --- a/patches.mcp/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/ContainerPlayer.java -+++ ../src-work/minecraft/net/minecraft/inventory/ContainerPlayer.java -@@ -48,8 +48,7 @@ - } - else - { -- EntityEquipmentSlot entityequipmentslot1 = EntityLiving.func_184640_d(stack); -- return entityequipmentslot1 == entityequipmentslot; -+ return stack.getItem().isValidArmor(stack, entityequipmentslot, thePlayer); - } - } - @SideOnly(Side.CLIENT) diff --git a/patches.mcp/minecraft/net/minecraft/inventory/ContainerRepair.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/ContainerRepair.java.patch deleted file mode 100644 index 4fe5a03f0..000000000 --- a/patches.mcp/minecraft/net/minecraft/inventory/ContainerRepair.java.patch +++ /dev/null @@ -1,52 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/ContainerRepair.java -+++ ../src-work/minecraft/net/minecraft/inventory/ContainerRepair.java -@@ -69,6 +69,8 @@ - playerIn.addExperienceLevel(-ContainerRepair.this.maximumCost); - } - -+ float breakChance = net.minecraftforge.common.ForgeHooks.onAnvilRepair(playerIn, stack, ContainerRepair.this.inputSlots.getStackInSlot(0), ContainerRepair.this.inputSlots.getStackInSlot(1)); -+ - ContainerRepair.this.inputSlots.setInventorySlotContents(0, (ItemStack)null); - - if (ContainerRepair.this.materialCost > 0) -@@ -93,7 +95,7 @@ - ContainerRepair.this.maximumCost = 0; - IBlockState iblockstate = worldIn.getBlockState(blockPosIn); - -- if (!playerIn.capabilities.isCreativeMode && !worldIn.isRemote && iblockstate.getBlock() == Blocks.anvil && playerIn.getRNG().nextFloat() < 0.12F) -+ if (!playerIn.capabilities.isCreativeMode && !worldIn.isRemote && iblockstate.getBlock() == Blocks.anvil && playerIn.getRNG().nextFloat() < breakChance) - { - int l = ((Integer)iblockstate.getValue(BlockAnvil.DAMAGE)).intValue(); - ++l; -@@ -160,10 +162,12 @@ - Map map = EnchantmentHelper.getEnchantments(itemstack1); - j = j + itemstack.getRepairCost() + (itemstack2 == null ? 0 : itemstack2.getRepairCost()); - this.materialCost = 0; -+ boolean flag = false; - - if (itemstack2 != null) - { -- boolean flag = itemstack2.getItem() == Items.enchanted_book && !Items.enchanted_book.getEnchantments(itemstack2).hasNoTags(); -+ if (!net.minecraftforge.common.ForgeHooks.onAnvilChange(this, itemstack, itemstack2, outputSlot, repairedItemName, j)) return; -+ flag = itemstack2.getItem() == Items.enchanted_book && !Items.enchanted_book.getEnchantments(itemstack2).hasNoTags(); - - if (itemstack1.isItemStackDamageable() && itemstack1.getItem().getIsRepairable(itemstack, itemstack2)) - { -@@ -235,7 +239,7 @@ - - for (Enchantment enchantment : map.keySet()) - { -- if (enchantment != enchantment1 && !enchantment1.canApplyTogether(enchantment)) -+ if (enchantment != enchantment1 && !(enchantment1.canApplyTogether(enchantment) && enchantment.canApplyTogether(enchantment1))) //Forge BugFix: Let Both enchantments veto being together - { - flag1 = false; - ++i; -@@ -279,6 +283,8 @@ - } - } - -+ if (flag && !itemstack1.getItem().isBookEnchantable(itemstack1, itemstack2)) itemstack1 = null; -+ - if (StringUtils.isBlank(this.repairedItemName)) - { - if (itemstack.hasDisplayName()) diff --git a/patches.mcp/minecraft/net/minecraft/inventory/Slot.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/Slot.java.patch deleted file mode 100644 index 543b01f37..000000000 --- a/patches.mcp/minecraft/net/minecraft/inventory/Slot.java.patch +++ /dev/null @@ -1,75 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/Slot.java -+++ ../src-work/minecraft/net/minecraft/inventory/Slot.java -@@ -89,7 +89,7 @@ - @SideOnly(Side.CLIENT) - public String getSlotTexture() - { -- return null; -+ return backgroundName; - } - - public ItemStack decrStackSize(int amount) -@@ -112,4 +112,63 @@ - { - return true; - } -+ -+ /*========================================= FORGE START =====================================*/ -+ protected String backgroundName = null; -+ protected net.minecraft.util.ResourceLocation backgroundLocation = null; -+ protected Object backgroundMap; -+ /** -+ * Gets the path of the texture file to use for the background image of this slot when drawing the GUI. -+ * @return The resource location for the background image -+ */ -+ @SideOnly(Side.CLIENT) -+ public net.minecraft.util.ResourceLocation getBackgroundLocation() -+ { -+ return (backgroundLocation == null ? net.minecraft.client.renderer.texture.TextureMap.locationBlocksTexture : backgroundLocation); -+ } -+ -+ /** -+ * Sets the texture file to use for the background image of the slot when it's empty. -+ * @param texture the resourcelocation for the texture -+ */ -+ @SideOnly(Side.CLIENT) -+ public void setBackgroundLocation(net.minecraft.util.ResourceLocation texture) -+ { -+ this.backgroundLocation = texture; -+ } -+ -+ /** -+ * Sets which icon index to use as the background image of the slot when it's empty. -+ * @param name The icon to use, null for none -+ */ -+ public void setBackgroundName(String name) -+ { -+ this.backgroundName = name; -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public net.minecraft.client.renderer.texture.TextureAtlasSprite getBackgroundSprite() -+ { -+ String name = getSlotTexture(); -+ return name == null ? null : getBackgroundMap().getAtlasSprite(name); -+ } -+ -+ @SideOnly(Side.CLIENT) -+ protected net.minecraft.client.renderer.texture.TextureMap getBackgroundMap() -+ { -+ if (backgroundMap == null) backgroundMap = net.minecraft.client.Minecraft.getMinecraft().getTextureMapBlocks(); -+ return (net.minecraft.client.renderer.texture.TextureMap)backgroundMap; -+ } -+ -+ /** -+ * Retrieves the index in the inventory for this slot, this value should typically not -+ * be used, but can be useful for some occasions. -+ * -+ * @return Index in associated inventory for this slot. -+ */ -+ public int getSlotIndex() -+ { -+ return slotIndex; -+ } -+ /*========================================= FORGE END =====================================*/ - } diff --git a/patches.mcp/minecraft/net/minecraft/inventory/SlotCrafting.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/SlotCrafting.java.patch deleted file mode 100644 index e4aff0d46..000000000 --- a/patches.mcp/minecraft/net/minecraft/inventory/SlotCrafting.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/SlotCrafting.java -+++ ../src-work/minecraft/net/minecraft/inventory/SlotCrafting.java -@@ -107,8 +107,11 @@ - - public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack) - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerCraftingEvent(playerIn, stack, craftMatrix); - this.onCrafting(stack); -+ net.minecraftforge.common.ForgeHooks.setCraftingPlayer(playerIn); - ItemStack[] aitemstack = CraftingManager.getInstance().func_180303_b(this.craftMatrix, playerIn.worldObj); -+ net.minecraftforge.common.ForgeHooks.setCraftingPlayer(null); - - for (int i = 0; i < aitemstack.length; ++i) - { diff --git a/patches.mcp/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch deleted file mode 100644 index c184789a0..000000000 --- a/patches.mcp/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java -+++ ../src-work/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java -@@ -81,6 +81,8 @@ - - this.field_75228_b = 0; - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerSmeltedEvent(thePlayer, stack); -+ - if (stack.getItem() == Items.iron_ingot) - { - this.thePlayer.triggerAchievement(AchievementList.field_187987_k); diff --git a/patches.mcp/minecraft/net/minecraft/item/Item.java.patch b/patches.mcp/minecraft/net/minecraft/item/Item.java.patch deleted file mode 100644 index b8507eda8..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/Item.java.patch +++ /dev/null @@ -1,697 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/Item.java -+++ ../src-work/minecraft/net/minecraft/item/Item.java -@@ -58,8 +58,8 @@ - - public class Item - { -- public static final RegistryNamespaced itemRegistry = new RegistryNamespaced(); -- private static final Map BLOCK_TO_ITEM = Maps.newHashMap(); -+ public static final RegistryNamespaced itemRegistry = net.minecraftforge.fml.common.registry.GameData.getItemRegistry();; -+ private static final Map BLOCK_TO_ITEM = net.minecraftforge.fml.common.registry.GameData.getBlockItemMap(); - private static final IItemPropertyGetter field_185046_b = new IItemPropertyGetter() - { - @SideOnly(Side.CLIENT) -@@ -104,6 +104,9 @@ - private Item containerItem; - private String unlocalizedName; - -+ public final net.minecraftforge.fml.common.registry.RegistryDelegate delegate = -+ ((net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry)itemRegistry).getDelegate(this, Item.class); -+ - public static int getIdFromItem(Item itemIn) - { - return itemIn == null ? 0 : itemRegistry.getIDForObject(itemIn); -@@ -192,6 +195,7 @@ - return stack; - } - -+ @Deprecated // Use ItemStack sensitive version below. - public int getItemStackLimit() - { - return this.maxStackSize; -@@ -312,6 +316,7 @@ - return this.containerItem; - } - -+ @Deprecated // Use ItemStack sensitive version below. - public boolean hasContainerItem() - { - return this.containerItem != null; -@@ -367,7 +372,7 @@ - - public boolean isItemTool(ItemStack stack) - { -- return this.getItemStackLimit() == 1 && this.isDamageable(); -+ return this.getItemStackLimit(stack) == 1 && this.isDamageable(); - } - - protected RayTraceResult getMovingObjectPositionFromPlayer(World worldIn, EntityPlayer playerIn, boolean useLiquids) -@@ -385,6 +390,10 @@ - float f6 = f3 * f4; - float f7 = f2 * f4; - double d3 = 5.0D; -+ if (playerIn instanceof net.minecraft.entity.player.EntityPlayerMP) -+ { -+ d3 = ((net.minecraft.entity.player.EntityPlayerMP)playerIn).theItemInWorldManager.getBlockReachDistance(); -+ } - Vec3d vec3d1 = vec3d.addVector((double)f6 * d3, (double)f5 * d3, (double)f7 * d3); - return worldIn.rayTraceBlocks(vec3d, vec3d1, useLiquids, !useLiquids, false); - } -@@ -422,11 +431,588 @@ - return false; - } - -+ @Deprecated // Use ItemStack sensitive version below. - public Multimap getItemAttributeModifiers(EntityEquipmentSlot p_111205_1_) - { - return HashMultimap.create(); - } - -+ /* ======================================== FORGE START =====================================*/ -+ /** -+ * ItemStack sensitive version of getItemAttributeModifiers -+ */ -+ public Multimap getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack) -+ { -+ return this.getItemAttributeModifiers(slot); -+ } -+ -+ /** -+ * Called when a player drops the item into the world, -+ * returning false from this will prevent the item from -+ * being removed from the players inventory and spawning -+ * in the world -+ * -+ * @param player The player that dropped the item -+ * @param item The item stack, before the item is removed. -+ */ -+ public boolean onDroppedByPlayer(ItemStack item, EntityPlayer player) -+ { -+ return true; -+ } -+ -+ /** -+ * Allow the item one last chance to modify its name used for the -+ * tool highlight useful for adding something extra that can't be removed -+ * by a user in the displayed name, such as a mode of operation. -+ * -+ * @param item the ItemStack for the item. -+ * @param displayName the name that will be displayed unless it is changed in this method. -+ */ -+ public String getHighlightTip( ItemStack item, String displayName ) -+ { -+ return displayName; -+ } -+ -+ /** -+ * This is called when the item is used, before the block is activated. -+ * @param stack The Item Stack -+ * @param player The Player that used the item -+ * @param world The Current World -+ * @param pos Target position -+ * @param side The side of the target hit -+ * @param hand Which hand the item is being held in. -+ * @return Return PASS to allow vanilla handling, any other to skip normal code. -+ */ -+ public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) -+ { -+ return EnumActionResult.PASS; -+ } -+ -+ protected boolean canRepair = true; -+ /** -+ * Called by CraftingManager to determine if an item is reparable. -+ * @return True if reparable -+ */ -+ public boolean isRepairable() -+ { -+ return canRepair && isDamageable(); -+ } -+ -+ /** -+ * Call to disable repair recipes. -+ * @return The current Item instance -+ */ -+ public Item setNoRepair() -+ { -+ canRepair = false; -+ return this; -+ } -+ -+ /** -+ * Called before a block is broken. Return true to prevent default block harvesting. -+ * -+ * Note: In SMP, this is called on both client and server sides! -+ * -+ * @param itemstack The current ItemStack -+ * @param pos Block's position in world -+ * @param player The Player that is wielding the item -+ * @return True to prevent harvesting, false to continue as normal -+ */ -+ public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player) -+ { -+ return false; -+ } -+ -+ /** -+ * Called each tick while using an item. -+ * @param stack The Item being used -+ * @param player The Player using the item -+ * @param count The amount of time in tick the item has been used for continuously -+ */ -+ public void onUsingTick(ItemStack stack, EntityLivingBase player, int count) -+ { -+ } -+ -+ /** -+ * Called when the player Left Clicks (attacks) an entity. -+ * Processed before damage is done, if return value is true further processing is canceled -+ * and the entity is not attacked. -+ * -+ * @param stack The Item being used -+ * @param player The player that is attacking -+ * @param entity The entity being attacked -+ * @return True to cancel the rest of the interaction. -+ */ -+ public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) -+ { -+ return false; -+ } -+ -+ /** -+ * ItemStack sensitive version of getContainerItem. -+ * Returns a full ItemStack instance of the result. -+ * -+ * @param itemStack The current ItemStack -+ * @return The resulting ItemStack -+ */ -+ public ItemStack getContainerItem(ItemStack itemStack) -+ { -+ if (!hasContainerItem(itemStack)) -+ { -+ return null; -+ } -+ return new ItemStack(getContainerItem()); -+ } -+ -+ /** -+ * ItemStack sensitive version of hasContainerItem -+ * @param stack The current item stack -+ * @return True if this item has a 'container' -+ */ -+ public boolean hasContainerItem(ItemStack stack) -+ { -+ return hasContainerItem(); -+ } -+ -+ /** -+ * Retrieves the normal 'lifespan' of this item when it is dropped on the ground as a EntityItem. -+ * This is in ticks, standard result is 6000, or 5 mins. -+ * -+ * @param itemStack The current ItemStack -+ * @param world The world the entity is in -+ * @return The normal lifespan in ticks. -+ */ -+ public int getEntityLifespan(ItemStack itemStack, World world) -+ { -+ return 6000; -+ } -+ -+ /** -+ * Determines if this Item has a special entity for when they are in the world. -+ * Is called when a EntityItem is spawned in the world, if true and Item#createCustomEntity -+ * returns non null, the EntityItem will be destroyed and the new Entity will be added to the world. -+ * -+ * @param stack The current item stack -+ * @return True of the item has a custom entity, If true, Item#createCustomEntity will be called -+ */ -+ public boolean hasCustomEntity(ItemStack stack) -+ { -+ return false; -+ } -+ -+ /** -+ * This function should return a new entity to replace the dropped item. -+ * Returning null here will not kill the EntityItem and will leave it to function normally. -+ * Called when the item it placed in a world. -+ * -+ * @param world The world object -+ * @param location The EntityItem object, useful for getting the position of the entity -+ * @param itemstack The current item stack -+ * @return A new Entity object to spawn or null -+ */ -+ public Entity createEntity(World world, Entity location, ItemStack itemstack) -+ { -+ return null; -+ } -+ -+ /** -+ * Called by the default implemetation of EntityItem's onUpdate method, allowing for cleaner -+ * control over the update of the item without having to write a subclass. -+ * -+ * @param entityItem The entity Item -+ * @return Return true to skip any further update code. -+ */ -+ public boolean onEntityItemUpdate(net.minecraft.entity.item.EntityItem entityItem) -+ { -+ return false; -+ } -+ -+ /** -+ * Gets a list of tabs that items belonging to this class can display on, -+ * combined properly with getSubItems allows for a single item to span -+ * many sub-items across many tabs. -+ * -+ * @return A list of all tabs that this item could possibly be one. -+ */ -+ public CreativeTabs[] getCreativeTabs() -+ { -+ return new CreativeTabs[]{ getCreativeTab() }; -+ } -+ -+ /** -+ * Determines the base experience for a player when they remove this item from a furnace slot. -+ * This number must be between 0 and 1 for it to be valid. -+ * This number will be multiplied by the stack size to get the total experience. -+ * -+ * @param item The item stack the player is picking up. -+ * @return The amount to award for each item. -+ */ -+ public float getSmeltingExperience(ItemStack item) -+ { -+ return -1; //-1 will default to the old lookups. -+ } -+ -+ /** -+ * -+ * Should this item, when held, allow sneak-clicks to pass through to the underlying block? -+ * -+ * @param world The world -+ * @param pos Block position in world -+ * @param player The Player that is wielding the item -+ * @return -+ */ -+ public boolean doesSneakBypassUse(ItemStack stack, net.minecraft.world.IBlockAccess world, BlockPos pos, EntityPlayer player) -+ { -+ return false; -+ } -+ -+ /** -+ * Called to tick armor in the armor slot. Override to do something -+ */ -+ public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack){} -+ -+ /** -+ * Determines if the specific ItemStack can be placed in the specified armor slot. -+ * -+ * @param stack The ItemStack -+ * @param armorType Armor slot ID: 0: Helmet, 1: Chest, 2: Legs, 3: Boots -+ * @param entity The entity trying to equip the armor -+ * @return True if the given ItemStack can be inserted in the slot -+ */ -+ public boolean isValidArmor(ItemStack stack, EntityEquipmentSlot armorType, Entity entity) -+ { -+ return net.minecraft.entity.EntityLiving.func_184640_d(stack) == armorType; -+ } -+ -+ /** -+ * Allow or forbid the specific book/item combination as an anvil enchant -+ * -+ * @param stack The item -+ * @param book The book -+ * @return if the enchantment is allowed -+ */ -+ public boolean isBookEnchantable(ItemStack stack, ItemStack book) -+ { -+ return true; -+ } -+ -+ /** -+ * Called by RenderBiped and RenderPlayer to determine the armor texture that -+ * should be use for the currently equipped item. -+ * This will only be called on instances of ItemArmor. -+ * -+ * Returning null from this function will use the default value. -+ * -+ * @param stack ItemStack for the equipped armor -+ * @param entity The entity wearing the armor -+ * @param slot The slot the armor is in -+ * @param type The subtype, can be null or "overlay" -+ * @return Path of texture to bind, or null to use default -+ */ -+ public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) -+ { -+ return null; -+ } -+ -+ /** -+ * Returns the font renderer used to render tooltips and overlays for this item. -+ * Returning null will use the standard font renderer. -+ * -+ * @param stack The current item stack -+ * @return A instance of FontRenderer or null to use default -+ */ -+ @SideOnly(Side.CLIENT) -+ public net.minecraft.client.gui.FontRenderer getFontRenderer(ItemStack stack) -+ { -+ return null; -+ } -+ -+ /** -+ * Override this method to have an item handle its own armor rendering. -+ * -+ * @param entityLiving The entity wearing the armor -+ * @param itemStack The itemStack to render the model of -+ * @param armorSlot The slot the armor is in -+ * @param _default Original armor model. Will have attributes set. -+ * @return A ModelBiped to render instead of the default -+ */ -+ @SideOnly(Side.CLIENT) -+ public net.minecraft.client.model.ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, net.minecraft.client.model.ModelBiped _default) -+ { -+ return null; -+ } -+ -+ /** -+ * Called when a entity tries to play the 'swing' animation. -+ * -+ * @param entityLiving The entity swinging the item. -+ * @param stack The Item stack -+ * @return True to cancel any further processing by EntityLiving -+ */ -+ public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack) -+ { -+ return false; -+ } -+ -+ /** -+ * Called when the client starts rendering the HUD, for whatever item the player currently has as a helmet. -+ * This is where pumpkins would render there overlay. -+ * -+ * @param stack The ItemStack that is equipped -+ * @param player Reference to the current client entity -+ * @param resolution Resolution information about the current viewport and configured GUI Scale -+ * @param partialTicks Partial ticks for the renderer, useful for interpolation -+ */ -+ @SideOnly(Side.CLIENT) -+ public void renderHelmetOverlay(ItemStack stack, EntityPlayer player, net.minecraft.client.gui.ScaledResolution resolution, float partialTicks){} -+ -+ /** -+ * Return the itemDamage represented by this ItemStack. Defaults to the itemDamage field on ItemStack, but can be overridden here for other sources such as NBT. -+ * -+ * @param stack The itemstack that is damaged -+ * @return the damage value -+ */ -+ public int getDamage(ItemStack stack) -+ { -+ return stack.itemDamage; -+ } -+ -+ /** -+ * This used to be 'display damage' but its really just 'aux' data in the ItemStack, usually shares the same variable as damage. -+ * @param stack -+ * @return -+ */ -+ public int getMetadata(ItemStack stack) -+ { -+ return stack.itemDamage; -+ } -+ -+ /** -+ * Determines if the durability bar should be rendered for this item. -+ * Defaults to vanilla stack.isDamaged behavior. -+ * But modders can use this for any data they wish. -+ * -+ * @param stack The current Item Stack -+ * @return True if it should render the 'durability' bar. -+ */ -+ public boolean showDurabilityBar(ItemStack stack) -+ { -+ return stack.isItemDamaged(); -+ } -+ -+ /** -+ * Queries the percentage of the 'Durability' bar that should be drawn. -+ * -+ * @param stack The current ItemStack -+ * @return 1.0 for 100% 0 for 0% -+ */ -+ public double getDurabilityForDisplay(ItemStack stack) -+ { -+ return (double)stack.getItemDamage() / (double)stack.getMaxDamage(); -+ } -+ -+ /** -+ * Return the maxDamage for this ItemStack. Defaults to the maxDamage field in this item, -+ * but can be overridden here for other sources such as NBT. -+ * -+ * @param stack The itemstack that is damaged -+ * @return the damage value -+ */ -+ public int getMaxDamage(ItemStack stack) -+ { -+ return getMaxDamage(); -+ } -+ -+ /** -+ * Return if this itemstack is damaged. Note only called if {@link #isDamageable()} is true. -+ * @param stack the stack -+ * @return if the stack is damaged -+ */ -+ public boolean isDamaged(ItemStack stack) -+ { -+ return stack.itemDamage > 0; -+ } -+ -+ /** -+ * Set the damage for this itemstack. Note, this method is responsible for zero checking. -+ * @param stack the stack -+ * @param damage the new damage value -+ */ -+ public void setDamage(ItemStack stack, int damage) -+ { -+ stack.itemDamage = damage; -+ -+ if (stack.itemDamage < 0) -+ { -+ stack.itemDamage = 0; -+ } -+ } -+ -+ /** -+ * ItemStack sensitive version of {@link #canHarvestBlock(IBlockState)} -+ * @param state The block trying to harvest -+ * @param stack The itemstack used to harvest the block -+ * @return true if can harvest the block -+ */ -+ public boolean canHarvestBlock(IBlockState state, ItemStack stack) -+ { -+ return canHarvestBlock(state); -+ } -+ -+ /** -+ * Gets the maximum number of items that this stack should be able to hold. -+ * This is a ItemStack (and thus NBT) sensitive version of Item.getItemStackLimit() -+ * -+ * @param stack The ItemStack -+ * @return The maximum number this item can be stacked to -+ */ -+ public int getItemStackLimit(ItemStack stack) -+ { -+ return this.getItemStackLimit(); -+ } -+ -+ private java.util.Map toolClasses = new java.util.HashMap(); -+ /** -+ * Sets or removes the harvest level for the specified tool class. -+ * -+ * @param toolClass Class -+ * @param level Harvest level: -+ * Wood: 0 -+ * Stone: 1 -+ * Iron: 2 -+ * Diamond: 3 -+ * Gold: 0 -+ */ -+ public void setHarvestLevel(String toolClass, int level) -+ { -+ if (level < 0) -+ toolClasses.remove(toolClass); -+ else -+ toolClasses.put(toolClass, level); -+ } -+ -+ public java.util.Set getToolClasses(ItemStack stack) -+ { -+ return toolClasses.keySet(); -+ } -+ -+ /** -+ * Queries the harvest level of this item stack for the specifred tool class, -+ * Returns -1 if this tool is not of the specified type -+ * -+ * @param stack This item stack instance -+ * @param toolClass Tool Class -+ * @return Harvest level, or -1 if not the specified tool type. -+ */ -+ public int getHarvestLevel(ItemStack stack, String toolClass) -+ { -+ Integer ret = toolClasses.get(toolClass); -+ return ret == null ? -1 : ret; -+ } -+ -+ /** -+ * ItemStack sensitive version of getItemEnchantability -+ * -+ * @param stack The ItemStack -+ * @return the item echantability value -+ */ -+ public int getItemEnchantability(ItemStack stack) -+ { -+ return getItemEnchantability(); -+ } -+ -+ /** -+ * Whether this Item can be used as a payment to activate the vanilla beacon. -+ * @param stack the ItemStack -+ * @return true if this Item can be used -+ */ -+ public boolean isBeaconPayment(ItemStack stack) -+ { -+ return this == Items.emerald || this == Items.diamond || this == Items.gold_ingot || this == Items.iron_ingot; -+ } -+ -+ /** -+ * Determine if the player switching between these two item stacks -+ * @param oldStack The old stack that was equipped -+ * @param newStack The new stack -+ * @param slotChanged If the current equipped slot was changed, -+ * Vanilla does not play the animation if you switch between two -+ * slots that hold the exact same item. -+ * @return True to play the item change animation -+ */ -+ public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) -+ { -+ return !ItemStack.areItemStacksEqual(oldStack, newStack); -+ } -+ -+ private ResourceLocation registryName = null; -+ /** -+ * Sets a unique name for this Item. This should be used for uniquely identify the instance of the Item. -+ * This is the valid replacement for the atrocious 'getUnlocalizedName().substring(6)' stuff that everyone does. -+ * Unlocalized names have NOTHING to do with unique identifiers. As demonstrated by vanilla blocks and items. -+ * -+ * The supplied name will be prefixed with the currently active mod's modId. -+ * If the supplied name already has a prefix that is different, it will be used and a warning will be logged. -+ * -+ * If a name already exists, or this Item is already registered in a registry, then an IllegalStateException is thrown. -+ * -+ * Returns 'this' to allow for chaining. -+ * -+ * @param name Unique registry name -+ * @return This instance -+ */ -+ public final Item setRegistryName(String name) -+ { -+ if (getRegistryName() != null) -+ throw new IllegalStateException("Attempted to set registry name on block with exisiting registry name! New: " + name + " Old: " + getRegistryName()); -+ int index = name.lastIndexOf(':'); -+ String oldPrefix = index == -1 ? "" : name.substring(0, index); -+ name = index == -1 ? name : name.substring(index + 1); -+ net.minecraftforge.fml.common.ModContainer mc = net.minecraftforge.fml.common.Loader.instance().activeModContainer(); -+ String prefix = mc == null ? "minecraft" : mc.getModId(); -+ if (!oldPrefix.equals(prefix) && oldPrefix.length() > 0) -+ { -+ net.minecraftforge.fml.common.FMLLog.bigWarning("Dangerous alternative prefix %s for name %s, invalid registry invocation/invalid name?", oldPrefix, name); -+ prefix = oldPrefix; -+ } -+ this.registryName = new ResourceLocation(prefix, name); -+ return this; -+ } -+ public final Item setRegistryName(ResourceLocation name){ return setRegistryName(name.toString()); } -+ public final Item setRegistryName(String modID, String name){ return setRegistryName(modID + ":" + name); } -+ -+ /** -+ * A unique identifier for this block, if this block is registered in the game registry it will return that name. -+ * Otherwise it will return the name set in setRegistryName(). -+ * If neither are valid null is returned. -+ * -+ * @return Unique identifier or null. -+ */ -+ public final String getRegistryName() -+ { -+ if (delegate.getResourceName() != null) return delegate.getResourceName().toString(); -+ return registryName != null ? registryName.toString() : null; -+ } -+ -+ /** -+ * Called from ItemStack.setItem, will hold extra data for the life of this ItemStack. -+ * Can be retrieved from stack.getCapabilities() -+ * The NBT can be null if this is not called from readNBT or if the item the stack is -+ * changing FROM is different then this item, or the previous item had no capabilities. -+ * -+ * This is called BEFORE the stacks item is set so you can use stack.getItem() to see the OLD item. -+ * Remember that getItem CAN return null. -+ * -+ * @param stack The ItemStack -+ * @param nbt NBT of this item serialized, or null. -+ * @return A holder instance associated with this ItemStack where you can hold capabilities for the life of this item. -+ */ -+ public net.minecraftforge.common.capabilities.ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt) -+ { -+ return null; -+ } -+ /* ======================================== FORGE END =====================================*/ -+ - public static void registerItems() - { - registerItemBlock(Blocks.stone, (new ItemMultiTexture(Blocks.stone, Blocks.stone, new Function() -@@ -935,6 +1521,10 @@ - private final float damageVsEntity; - private final int enchantability; - -+ //Added by forge for custom Tool materials. -+ @Deprecated public Item customCraftingMaterial = null; // Remote in 1.8.1 -+ private ItemStack repairMaterial = null; -+ - private ToolMaterial(int harvestLevel, int maxUses, float efficiency, float damageVsEntity, int enchantability) - { - this.harvestLevel = harvestLevel; -@@ -969,9 +1559,36 @@ - return this.enchantability; - } - -+ @Deprecated // Use getRepairItemStack below - public Item getRepairItem() - { -- return this == WOOD ? Item.getItemFromBlock(Blocks.planks) : (this == STONE ? Item.getItemFromBlock(Blocks.cobblestone) : (this == GOLD ? Items.gold_ingot : (this == IRON ? Items.iron_ingot : (this == DIAMOND ? Items.diamond : null)))); -+ switch (this) -+ { -+ case WOOD: return Item.getItemFromBlock(Blocks.planks); -+ case STONE: return Item.getItemFromBlock(Blocks.cobblestone); -+ case GOLD: return Items.gold_ingot; -+ case IRON: return Items.iron_ingot; -+ case DIAMOND: return Items.diamond; -+ default: return customCraftingMaterial; -+ } - } -+ -+ public ToolMaterial setRepairItem(ItemStack stack) -+ { -+ if (this.repairMaterial != null || customCraftingMaterial != null) throw new RuntimeException("Can not change already set repair material"); -+ if (this == WOOD || this == STONE || this == GOLD || this == IRON || this == DIAMOND) throw new RuntimeException("Can not change vanilla tool repair materials"); -+ this.repairMaterial = stack; -+ this.customCraftingMaterial = stack.getItem(); -+ return this; -+ } -+ -+ public ItemStack getRepairItemStack() -+ { -+ if (repairMaterial != null) return repairMaterial; -+ Item ret = this.getRepairItem(); -+ if (ret == null) return null; -+ repairMaterial = new ItemStack(ret, 1, net.minecraftforge.oredict.OreDictionary.WILDCARD_VALUE); -+ return repairMaterial; -+ } - } - } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemArmor.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemArmor.java.patch deleted file mode 100644 index 25d1f23e5..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemArmor.java.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemArmor.java -+++ ../src-work/minecraft/net/minecraft/item/ItemArmor.java -@@ -235,6 +235,8 @@ - private final int[] damageReductionAmountArray; - private final int enchantability; - private final SoundEvent field_185020_j; -+ //Added by forge for custom Armor materials. -+ public Item customCraftingMaterial = null; - - private ArmorMaterial(String p_i46796_3_, int p_i46796_4_, int[] p_i46796_5_, int p_i46796_6_, SoundEvent p_i46796_7_) - { -@@ -267,7 +269,15 @@ - - public Item getRepairItem() - { -- return this == LEATHER ? Items.leather : (this == CHAIN ? Items.iron_ingot : (this == GOLD ? Items.gold_ingot : (this == IRON ? Items.iron_ingot : (this == DIAMOND ? Items.diamond : null)))); -+ switch (this) -+ { -+ case LEATHER: return Items.leather; -+ case CHAIN: return Items.iron_ingot; -+ case GOLD: return Items.gold_ingot; -+ case IRON: return Items.iron_ingot; -+ case DIAMOND: return Items.diamond; -+ default: return customCraftingMaterial; -+ } - } - - @SideOnly(Side.CLIENT) diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemBlock.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemBlock.java.patch deleted file mode 100644 index 06dca5610..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemBlock.java.patch +++ /dev/null @@ -1,56 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemBlock.java -+++ ../src-work/minecraft/net/minecraft/item/ItemBlock.java -@@ -50,16 +50,8 @@ - int i = this.getMetadata(stack.getMetadata()); - IBlockState iblockstate1 = this.block.onBlockPlaced(worldIn, pos, hitX, hitY, hitZ, p_180614_9_, i, playerIn); - -- if (worldIn.setBlockState(pos, iblockstate1, 11)) -+ if (placeBlockAt(stack, playerIn, worldIn, pos, hitX, hitY, hitZ, p_180614_9_, iblockstate1)) - { -- iblockstate1 = worldIn.getBlockState(pos); -- -- if (iblockstate1.getBlock() == this.block) -- { -- setTileEntityNBT(worldIn, playerIn, pos, stack); -- this.block.onBlockPlacedBy(worldIn, pos, iblockstate1, playerIn, stack); -- } -- - SoundType soundtype = this.block.func_185467_w(); - worldIn.func_184133_a(playerIn, pos, soundtype.func_185841_e(), SoundCategory.BLOCKS, (soundtype.func_185843_a() + 1.0F) / 2.0F, soundtype.func_185847_b() * 0.8F); - --stack.stackSize; -@@ -121,7 +113,7 @@ - { - Block block = worldIn.getBlockState(pos).getBlock(); - -- if (block == Blocks.snow_layer) -+ if (block == Blocks.snow_layer && block.isReplaceable(worldIn, pos)) - { - side = EnumFacing.UP; - } -@@ -159,4 +151,26 @@ - { - return this.block; - } -+ -+ /** -+ * Called to actually place the block, after the location is determined -+ * and all permission checks have been made. -+ * -+ * @param stack The item stack that was used to place the block. This can be changed inside the method. -+ * @param player The player who is placing the block. Can be null if the block is not being placed by a player. -+ * @param side The side the player (or machine) right-clicked on. -+ */ -+ public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState) -+ { -+ if (!world.setBlockState(pos, newState, 3)) return false; -+ -+ IBlockState state = world.getBlockState(pos); -+ if (state.getBlock() == this.block) -+ { -+ setTileEntityNBT(world, player, pos, stack); -+ this.block.onBlockPlacedBy(world, pos, state, player, stack); -+ } -+ -+ return true; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemBow.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemBow.java.patch deleted file mode 100644 index 01c1117e7..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemBow.java.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemBow.java -+++ ../src-work/minecraft/net/minecraft/item/ItemBow.java -@@ -90,6 +90,10 @@ - boolean flag = entityplayer.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantments.field_185312_x, stack) > 0; - ItemStack itemstack = this.func_185060_a(entityplayer); - -+ int i = this.getMaxItemUseDuration(stack) - timeLeft; -+ i = net.minecraftforge.event.ForgeEventFactory.onArrowLoose(stack, worldIn, (EntityPlayer)playerIn, i, itemstack != null || flag); -+ if (i < 0) return; -+ - if (itemstack != null || flag) - { - if (itemstack == null) -@@ -97,7 +101,6 @@ - itemstack = new ItemStack(Items.arrow); - } - -- int i = this.getMaxItemUseDuration(stack) - timeLeft; - float f = func_185059_b(i); - - if ((double)f >= 0.1D) -@@ -189,6 +192,9 @@ - { - boolean flag = this.func_185060_a(playerIn) != null; - -+ ActionResult ret = net.minecraftforge.event.ForgeEventFactory.onArrowNock(itemStackIn, worldIn, playerIn, p_77659_4_, flag); -+ if (ret != null) return ret; -+ - if (!playerIn.capabilities.isCreativeMode && !flag) - { - return !flag ? new ActionResult(EnumActionResult.FAIL, itemStackIn) : new ActionResult(EnumActionResult.PASS, itemStackIn); diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemBucket.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemBucket.java.patch deleted file mode 100644 index d2254fe35..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemBucket.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemBucket.java -+++ ../src-work/minecraft/net/minecraft/item/ItemBucket.java -@@ -36,6 +36,8 @@ - { - boolean flag = this.isFull == Blocks.air; - RayTraceResult raytraceresult = this.getMovingObjectPositionFromPlayer(worldIn, playerIn, flag); -+ ActionResult ret = net.minecraftforge.event.ForgeEventFactory.onBucketUse(playerIn, worldIn, itemStackIn, raytraceresult); -+ if (ret != null) return ret; - - if (raytraceresult == null) - { diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemBucketMilk.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemBucketMilk.java.patch deleted file mode 100644 index 02318fa88..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemBucketMilk.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemBucketMilk.java -+++ ../src-work/minecraft/net/minecraft/item/ItemBucketMilk.java -@@ -27,7 +27,7 @@ - - if (!worldIn.isRemote) - { -- playerIn.clearActivePotions(); -+ playerIn.curePotionEffects(stack); - } - - if (playerIn instanceof EntityPlayer) diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemDye.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemDye.java.patch deleted file mode 100644 index 94f89322f..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemDye.java.patch +++ /dev/null @@ -1,47 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemDye.java -+++ ../src-work/minecraft/net/minecraft/item/ItemDye.java -@@ -50,7 +50,7 @@ - - if (enumdyecolor == EnumDyeColor.WHITE) - { -- if (applyBonemeal(stack, worldIn, pos)) -+ if (applyBonemeal(stack, worldIn, pos, playerIn)) - { - if (!worldIn.isRemote) - { -@@ -97,8 +97,18 @@ - - public static boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos target) - { -+ if (worldIn instanceof net.minecraft.world.WorldServer) -+ return applyBonemeal(stack, worldIn, target, net.minecraftforge.common.util.FakePlayerFactory.getMinecraft((net.minecraft.world.WorldServer)worldIn)); -+ return false; -+ } -+ -+ public static boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos target, EntityPlayer player) -+ { - IBlockState iblockstate = worldIn.getBlockState(target); - -+ int hook = net.minecraftforge.event.ForgeEventFactory.onApplyBonemeal(player, worldIn, target, iblockstate, stack); -+ if (hook != 0) return hook > 0; -+ - if (iblockstate.getBlock() instanceof IGrowable) - { - IGrowable igrowable = (IGrowable)iblockstate.getBlock(); -@@ -142,6 +152,16 @@ - worldIn.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, (double)((float)pos.getX() + itemRand.nextFloat()), (double)pos.getY() + (double)itemRand.nextFloat() * iblockstate.func_185900_c(worldIn, pos).maxY, (double)((float)pos.getZ() + itemRand.nextFloat()), d0, d1, d2, new int[0]); - } - } -+ else -+ { -+ for (int i1 = 0; i1 < amount; ++i1) -+ { -+ double d0 = itemRand.nextGaussian() * 0.02D; -+ double d1 = itemRand.nextGaussian() * 0.02D; -+ double d2 = itemRand.nextGaussian() * 0.02D; -+ worldIn.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, (double)((float)pos.getX() + itemRand.nextFloat()), (double)pos.getY() + (double)itemRand.nextFloat() * 1.0f, (double)((float)pos.getZ() + itemRand.nextFloat()), d0, d1, d2, new int[0]); -+ } -+ } - } - - public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer playerIn, EntityLivingBase target, EnumHand p_111207_4_) diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemEmptyMap.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemEmptyMap.java.patch deleted file mode 100644 index 03387eb42..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemEmptyMap.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemEmptyMap.java -+++ ../src-work/minecraft/net/minecraft/item/ItemEmptyMap.java -@@ -25,7 +25,7 @@ - worldIn.setItemData(s, mapdata); - mapdata.scale = 0; - mapdata.calculateMapCenter(playerIn.posX, playerIn.posZ, mapdata.scale); -- mapdata.dimension = (byte)worldIn.provider.func_186058_p().func_186068_a(); -+ mapdata.dimension = worldIn.provider.func_186058_p().func_186068_a(); - mapdata.field_186210_e = true; - mapdata.markDirty(); - --itemStackIn.stackSize; diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch deleted file mode 100644 index 69f342f8b..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemFlintAndSteel.java -+++ ../src-work/minecraft/net/minecraft/item/ItemFlintAndSteel.java -@@ -31,7 +31,7 @@ - } - else - { -- if (worldIn.getBlockState(pos).func_185904_a() == Material.air) -+ if (worldIn.isAirBlock(pos)) - { - worldIn.func_184133_a(playerIn, pos, SoundEvents.field_187649_bu, SoundCategory.BLOCKS, 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); - worldIn.setBlockState(pos, Blocks.fire.getDefaultState(), 11); diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemHoe.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemHoe.java.patch deleted file mode 100644 index f721d1fc7..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemHoe.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemHoe.java -+++ ../src-work/minecraft/net/minecraft/item/ItemHoe.java -@@ -45,10 +45,13 @@ - } - else - { -+ int hook = net.minecraftforge.event.ForgeEventFactory.onHoeUse(stack, playerIn, worldIn, pos); -+ if (hook != 0) return hook > 0 ? EnumActionResult.SUCCESS : EnumActionResult.FAIL; -+ - IBlockState iblockstate = worldIn.getBlockState(pos); - Block block = iblockstate.getBlock(); - -- if (hitX != EnumFacing.DOWN && worldIn.getBlockState(pos.up()).func_185904_a() == Material.air) -+ if (hitX != EnumFacing.DOWN && worldIn.isAirBlock(pos.up())) - { - if (block == Blocks.grass || block == Blocks.field_185774_da) - { diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemLilyPad.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemLilyPad.java.patch deleted file mode 100644 index 5c669d0a7..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemLilyPad.java.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemLilyPad.java -+++ ../src-work/minecraft/net/minecraft/item/ItemLilyPad.java -@@ -47,6 +47,15 @@ - - if (iblockstate.func_185904_a() == Material.water && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0 && worldIn.isAirBlock(blockpos1)) - { -+ // special case for handling block placement with water lilies -+ net.minecraftforge.common.util.BlockSnapshot blocksnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(worldIn, blockpos1); -+ worldIn.setBlockState(blockpos1, Blocks.waterlily.getDefaultState()); -+ if (net.minecraftforge.event.ForgeEventFactory.onPlayerBlockPlace(playerIn, blocksnapshot, net.minecraft.util.EnumFacing.UP).isCanceled()) -+ { -+ blocksnapshot.restore(true, false); -+ return new ActionResult(EnumActionResult.FAIL, itemStackIn); -+ } -+ - worldIn.setBlockState(blockpos1, Blocks.waterlily.getDefaultState(), 11); - - if (!playerIn.capabilities.isCreativeMode) diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemMap.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemMap.java.patch deleted file mode 100644 index 763a91d25..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemMap.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemMap.java -+++ ../src-work/minecraft/net/minecraft/item/ItemMap.java -@@ -57,7 +57,7 @@ - mapdata = new MapData(s); - mapdata.scale = 3; - mapdata.calculateMapCenter((double)worldIn.getWorldInfo().getSpawnX(), (double)worldIn.getWorldInfo().getSpawnZ(), mapdata.scale); -- mapdata.dimension = (byte)worldIn.provider.func_186058_p().func_186068_a(); -+ mapdata.dimension = worldIn.provider.func_186058_p().func_186068_a(); - mapdata.markDirty(); - worldIn.setItemData(s, mapdata); - } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch deleted file mode 100644 index d9e451c9f..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemMonsterPlacer.java -+++ ../src-work/minecraft/net/minecraft/item/ItemMonsterPlacer.java -@@ -88,7 +88,7 @@ - pos = pos.offset(hitX); - double d0 = 0.0D; - -- if (hitX == EnumFacing.UP && iblockstate instanceof BlockFence) -+ if (hitX == EnumFacing.UP && iblockstate.getBlock() instanceof BlockFence) //Forge: Fix Vanilla bug comparing state instead of block - { - d0 = 0.5D; - } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemRecord.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemRecord.java.patch deleted file mode 100644 index 16e050b5b..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemRecord.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemRecord.java -+++ ../src-work/minecraft/net/minecraft/item/ItemRecord.java -@@ -73,6 +73,17 @@ - return EnumRarity.RARE; - } - -+ /** -+ * Retrieves the resource location of the sound to play for this record. -+ * -+ * @param name The name of the record to play -+ * @return The resource location for the audio, null to use default. -+ */ -+ public net.minecraft.util.ResourceLocation getRecordResource(String name) -+ { -+ return new net.minecraft.util.ResourceLocation(name); -+ } -+ - @SideOnly(Side.CLIENT) - public static ItemRecord func_185074_a(SoundEvent p_185074_0_) - { diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemSeedFood.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemSeedFood.java.patch deleted file mode 100644 index 1425a3d9c..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemSeedFood.java.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemSeedFood.java -+++ ../src-work/minecraft/net/minecraft/item/ItemSeedFood.java -@@ -8,7 +8,7 @@ - import net.minecraft.util.math.BlockPos; - import net.minecraft.world.World; - --public class ItemSeedFood extends ItemFood -+public class ItemSeedFood extends ItemFood implements net.minecraftforge.common.IPlantable - { - private Block crops; - private Block soilId; -@@ -22,7 +22,8 @@ - - public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand side, EnumFacing hitX, float hitY, float hitZ, float p_180614_9_) - { -- if (hitX == EnumFacing.UP && playerIn.canPlayerEdit(pos.offset(hitX), hitX, stack) && worldIn.getBlockState(pos).getBlock() == this.soilId && worldIn.isAirBlock(pos.up())) -+ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(pos); -+ if (hitX == EnumFacing.UP && playerIn.canPlayerEdit(pos.offset(hitX), hitX, stack) && state.getBlock().canSustainPlant(state, worldIn, pos, EnumFacing.UP, this) && worldIn.isAirBlock(pos.up())) - { - worldIn.setBlockState(pos.up(), this.crops.getDefaultState(), 11); - --stack.stackSize; -@@ -33,4 +34,16 @@ - return EnumActionResult.FAIL; - } - } -+ -+ @Override -+ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) -+ { -+ return net.minecraftforge.common.EnumPlantType.Crop; -+ } -+ -+ @Override -+ public net.minecraft.block.state.IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos) -+ { -+ return this.crops.getDefaultState(); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemSeeds.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemSeeds.java.patch deleted file mode 100644 index b176b6576..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemSeeds.java.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemSeeds.java -+++ ../src-work/minecraft/net/minecraft/item/ItemSeeds.java -@@ -9,7 +9,7 @@ - import net.minecraft.util.math.BlockPos; - import net.minecraft.world.World; - --public class ItemSeeds extends Item -+public class ItemSeeds extends Item implements net.minecraftforge.common.IPlantable - { - private Block crops; - private Block soilBlockID; -@@ -23,7 +23,8 @@ - - public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand side, EnumFacing hitX, float hitY, float hitZ, float p_180614_9_) - { -- if (hitX == EnumFacing.UP && playerIn.canPlayerEdit(pos.offset(hitX), hitX, stack) && worldIn.getBlockState(pos).getBlock() == this.soilBlockID && worldIn.isAirBlock(pos.up())) -+ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(pos); -+ if (hitX == EnumFacing.UP && playerIn.canPlayerEdit(pos.offset(hitX), hitX, stack) && state.getBlock().canSustainPlant(state, worldIn, pos, EnumFacing.UP, this) && worldIn.isAirBlock(pos.up())) - { - worldIn.setBlockState(pos.up(), this.crops.getDefaultState()); - --stack.stackSize; -@@ -34,4 +35,16 @@ - return EnumActionResult.FAIL; - } - } -+ -+ @Override -+ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) -+ { -+ return this.crops == net.minecraft.init.Blocks.nether_wart ? net.minecraftforge.common.EnumPlantType.Nether : net.minecraftforge.common.EnumPlantType.Crop; -+ } -+ -+ @Override -+ public net.minecraft.block.state.IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos) -+ { -+ return this.crops.getDefaultState(); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemShears.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemShears.java.patch deleted file mode 100644 index e317586a7..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemShears.java.patch +++ /dev/null @@ -1,91 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemShears.java -+++ ../src-work/minecraft/net/minecraft/item/ItemShears.java -@@ -6,6 +6,7 @@ - import net.minecraft.creativetab.CreativeTabs; - import net.minecraft.entity.EntityLivingBase; - import net.minecraft.init.Blocks; -+import net.minecraft.util.EnumHand; - import net.minecraft.util.math.BlockPos; - import net.minecraft.world.World; - -@@ -22,7 +23,7 @@ - { - stack.damageItem(1, playerIn); - Block block = blockIn.getBlock(); -- return blockIn.func_185904_a() != Material.leaves && block != Blocks.web && block != Blocks.tallgrass && block != Blocks.vine && block != Blocks.tripwire && block != Blocks.wool ? super.onBlockDestroyed(stack, worldIn, blockIn, pos, playerIn) : true; -+ return blockIn.func_185904_a() != Material.leaves && block != Blocks.web && block != Blocks.tallgrass && block != Blocks.vine && block != Blocks.tripwire && block != Blocks.wool && !(blockIn instanceof net.minecraftforge.common.IShearable) ? super.onBlockDestroyed(stack, worldIn, blockIn, pos, playerIn) : true; - } - - public boolean canHarvestBlock(IBlockState blockIn) -@@ -36,4 +37,71 @@ - Block block = state.getBlock(); - return block != Blocks.web && state.func_185904_a() != Material.leaves ? (block == Blocks.wool ? 5.0F : super.getStrVsBlock(stack, state)) : 15.0F; - } -+ -+ -+ @Override -+ public boolean itemInteractionForEntity(ItemStack itemstack, net.minecraft.entity.player.EntityPlayer player, EntityLivingBase entity, EnumHand hand) -+ { -+ if (entity.worldObj.isRemote) -+ { -+ return false; -+ } -+ if (entity instanceof net.minecraftforge.common.IShearable) -+ { -+ net.minecraftforge.common.IShearable target = (net.minecraftforge.common.IShearable)entity; -+ BlockPos pos = new BlockPos(entity.posX, entity.posY, entity.posZ); -+ if (target.isShearable(itemstack, entity.worldObj, pos)) -+ { -+ java.util.List drops = target.onSheared(itemstack, entity.worldObj, pos, -+ net.minecraft.enchantment.EnchantmentHelper.getEnchantmentLevel(net.minecraft.init.Enchantments.field_185308_t, itemstack)); -+ -+ java.util.Random rand = new java.util.Random(); -+ for(ItemStack stack : drops) -+ { -+ net.minecraft.entity.item.EntityItem ent = entity.entityDropItem(stack, 1.0F); -+ ent.motionY += rand.nextFloat() * 0.05F; -+ ent.motionX += (rand.nextFloat() - rand.nextFloat()) * 0.1F; -+ ent.motionZ += (rand.nextFloat() - rand.nextFloat()) * 0.1F; -+ } -+ itemstack.damageItem(1, entity); -+ } -+ return true; -+ } -+ return false; -+ } -+ -+ @Override -+ public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, net.minecraft.entity.player.EntityPlayer player) -+ { -+ if (player.worldObj.isRemote || player.capabilities.isCreativeMode) -+ { -+ return false; -+ } -+ Block block = player.worldObj.getBlockState(pos).getBlock(); -+ if (block instanceof net.minecraftforge.common.IShearable) -+ { -+ net.minecraftforge.common.IShearable target = (net.minecraftforge.common.IShearable)block; -+ if (target.isShearable(itemstack, player.worldObj, pos)) -+ { -+ java.util.List drops = target.onSheared(itemstack, player.worldObj, pos, -+ net.minecraft.enchantment.EnchantmentHelper.getEnchantmentLevel(net.minecraft.init.Enchantments.field_185308_t, itemstack)); -+ java.util.Random rand = new java.util.Random(); -+ -+ for(ItemStack stack : drops) -+ { -+ float f = 0.7F; -+ double d = (double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; -+ double d1 = (double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; -+ double d2 = (double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; -+ net.minecraft.entity.item.EntityItem entityitem = new net.minecraft.entity.item.EntityItem(player.worldObj, (double)pos.getX() + d, (double)pos.getY() + d1, (double)pos.getZ() + d2, stack); -+ entityitem.setDefaultPickupDelay(); -+ player.worldObj.spawnEntityInWorld(entityitem); -+ } -+ -+ itemstack.damageItem(1, player); -+ player.triggerAchievement(net.minecraft.stats.StatList.func_188055_a(block)); -+ } -+ } -+ return false; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemSkull.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemSkull.java.patch deleted file mode 100644 index d30bce76e..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemSkull.java.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemSkull.java -+++ ../src-work/minecraft/net/minecraft/item/ItemSkull.java -@@ -42,13 +42,18 @@ - } - else - { -+ if (worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos)) -+ { -+ hitX = EnumFacing.UP; -+ pos = pos.down(); -+ } - IBlockState iblockstate = worldIn.getBlockState(pos); - Block block = iblockstate.getBlock(); - boolean flag = block.isReplaceable(worldIn, pos); - - if (!flag) - { -- if (!worldIn.getBlockState(pos).func_185904_a().isSolid()) -+ if (!worldIn.getBlockState(pos).func_185904_a().isSolid() && !worldIn.isSideSolid(pos, hitX, true)) - { - return EnumActionResult.FAIL; - } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemSnow.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemSnow.java.patch deleted file mode 100644 index 951947b54..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemSnow.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemSnow.java -+++ ../src-work/minecraft/net/minecraft/item/ItemSnow.java -@@ -68,4 +68,10 @@ - { - return damage; - } -+ -+ public boolean canPlaceBlockOnSide(World world, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack) -+ { -+ IBlockState state = world.getBlockState(pos); -+ return (state.getBlock() != net.minecraft.init.Blocks.snow_layer || ((Integer)state.getValue(BlockSnow.LAYERS)) > 7) ? super.canPlaceBlockOnSide(world, pos, side, player, stack) : true; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemStack.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemStack.java.patch deleted file mode 100644 index f955a53d7..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemStack.java.patch +++ /dev/null @@ -1,229 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemStack.java -+++ ../src-work/minecraft/net/minecraft/item/ItemStack.java -@@ -41,7 +41,7 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --public final class ItemStack -+public final class ItemStack implements net.minecraftforge.common.capabilities.ICapabilitySerializable - { - public static final DecimalFormat DECIMALFORMAT = new DecimalFormat("#.##"); - public int stackSize; -@@ -55,6 +55,10 @@ - private Block canPlaceOnCacheBlock; - private boolean canPlaceOnCacheResult; - -+ private net.minecraftforge.fml.common.registry.RegistryDelegate delegate; -+ private net.minecraftforge.common.capabilities.CapabilityDispatcher capabilities; -+ private NBTTagCompound capNBT; -+ - public ItemStack(Block blockIn) - { - this((Block)blockIn, 1); -@@ -80,13 +84,15 @@ - this((Item)itemIn, amount, 0); - } - -- public ItemStack(Item itemIn, int amount, int meta) -+ public ItemStack(Item itemIn, int amount, int meta) { this (itemIn, amount, meta, null); } -+ public ItemStack(Item itemIn, int amount, int meta, NBTTagCompound capNBT) - { -+ this.capNBT = capNBT; - this.canDestroyCacheBlock = null; - this.canDestroyCacheResult = false; - this.canPlaceOnCacheBlock = null; - this.canPlaceOnCacheResult = false; -- this.item = itemIn; -+ this.setItem(itemIn); - this.stackSize = amount; - this.itemDamage = meta; - -@@ -114,7 +120,7 @@ - public ItemStack splitStack(int amount) - { - amount = Math.min(amount, this.stackSize); -- ItemStack itemstack = new ItemStack(this.item, amount, this.itemDamage); -+ ItemStack itemstack = new ItemStack(this.item, amount, this.itemDamage, this.capabilities != null ? this.capabilities.serializeNBT() : null); - - if (this.stackTagCompound != null) - { -@@ -127,11 +133,12 @@ - - public Item getItem() - { -- return this.item; -+ return this.delegate != null ? this.delegate.get() : null; - } - - public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand side, EnumFacing hitX, float hitY, float hitZ, float p_179546_8_) - { -+ if (!worldIn.isRemote) return net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(this, playerIn, worldIn, pos, hitX, hitY, hitZ, p_179546_8_, side); - EnumActionResult enumactionresult = this.getItem().onItemUse(this, playerIn, worldIn, pos, side, hitX, hitY, hitZ, p_179546_8_); - - if (enumactionresult == EnumActionResult.SUCCESS) -@@ -169,12 +176,16 @@ - nbt.setTag("tag", this.stackTagCompound); - } - -+ if (this.capabilities != null) nbt.setTag("ForgeCaps", this.capabilities.serializeNBT()); -+ - return nbt; - } - - public void readFromNBT(NBTTagCompound nbt) - { -- this.item = Item.getByNameOrId(nbt.getString("id")); -+ this.capNBT = nbt.hasKey("ForgeCaps") ? nbt.getCompoundTag("ForgeCaps") : null; -+ this.setItem(Item.getByNameOrId(nbt.getString("id"))); -+ this.capNBT = null; - this.stackSize = nbt.getByte("Count"); - this.itemDamage = nbt.getShort("Damage"); - -@@ -196,7 +207,7 @@ - - public int getMaxStackSize() - { -- return this.getItem().getItemStackLimit(); -+ return this.getItem().getItemStackLimit(this); - } - - public boolean isStackable() -@@ -206,7 +217,7 @@ - - public boolean isItemStackDamageable() - { -- return this.item == null ? false : (this.item.getMaxDamage() <= 0 ? false : !this.hasTagCompound() || !this.getTagCompound().getBoolean("Unbreakable")); -+ return this.item == null ? false : (this.item.getMaxDamage(this) <= 0 ? false : !this.hasTagCompound() || !this.getTagCompound().getBoolean("Unbreakable")); - } - - public boolean getHasSubtypes() -@@ -216,32 +227,27 @@ - - public boolean isItemDamaged() - { -- return this.isItemStackDamageable() && this.itemDamage > 0; -+ return this.isItemStackDamageable() && getItem().isDamaged(this); - } - - public int getItemDamage() - { -- return this.itemDamage; -+ return getItem().getDamage(this); - } - - public int getMetadata() - { -- return this.itemDamage; -+ return getItem().getMetadata(this); - } - - public void setItemDamage(int meta) - { -- this.itemDamage = meta; -- -- if (this.itemDamage < 0) -- { -- this.itemDamage = 0; -- } -+ getItem().setDamage(this, meta); - } - - public int getMaxDamage() - { -- return this.item == null ? 0 : this.item.getMaxDamage(); -+ return this.item == null ? 0 : this.item.getMaxDamage(this); - } - - public boolean attemptDamageItem(int amount, Random rand) -@@ -273,8 +279,8 @@ - } - } - -- this.itemDamage += amount; -- return this.itemDamage > this.getMaxDamage(); -+ setItemDamage(getItemDamage() + amount); //Redirect through Item's callback if applicable. -+ return getItemDamage() > getMaxDamage(); - } - } - -@@ -328,7 +334,7 @@ - - public boolean canHarvestBlock(IBlockState blockIn) - { -- return this.item.canHarvestBlock(blockIn); -+ return getItem().canHarvestBlock(blockIn, this); - } - - public boolean interactWithEntity(EntityPlayer playerIn, EntityLivingBase entityIn, EnumHand p_111282_3_) -@@ -338,7 +344,7 @@ - - public ItemStack copy() - { -- ItemStack itemstack = new ItemStack(this.item, this.stackSize, this.itemDamage); -+ ItemStack itemstack = new ItemStack(this.item, this.stackSize, this.itemDamage, this.capabilities != null ? this.capabilities.serializeNBT() : null); - - if (this.stackTagCompound != null) - { -@@ -759,6 +765,7 @@ - } - } - -+ net.minecraftforge.event.ForgeEventFactory.onItemTooltip(this, playerIn, list, advanced); - return list; - } - -@@ -869,7 +876,7 @@ - } - else - { -- multimap = this.getItem().getItemAttributeModifiers(p_111283_1_); -+ multimap = this.getItem().getAttributeModifiers(p_111283_1_, this); - } - - return multimap; -@@ -901,6 +908,18 @@ - - public void setItem(Item newItem) - { -+ if (newItem == this.item && item != null && this.capabilities != null) //Item Didn't change but refreshed -+ { -+ net.minecraftforge.common.capabilities.ICapabilityProvider parent = item.initCapabilities(this, this.capabilities.serializeNBT()); -+ this.capabilities = net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(item, this, parent); -+ } -+ else if (newItem != this.item && newItem != null) // Item Changed -+ { -+ net.minecraftforge.common.capabilities.ICapabilityProvider parent = newItem.initCapabilities(this, this.capNBT); -+ this.capabilities = net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(newItem, this, parent); -+ } -+ if (this.capNBT != null && this.capabilities != null) this.capabilities.deserializeNBT(this.capNBT); -+ this.delegate = newItem != null ? newItem.delegate : null; - this.item = newItem; - } - -@@ -987,4 +1006,26 @@ - return false; - } - } -+ -+ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) -+ { -+ return this.capabilities == null ? false : this.capabilities.hasCapability(capability, facing); -+ } -+ -+ public T getCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) -+ { -+ return this.capabilities == null ? null : this.capabilities.getCapability(capability, facing); -+ } -+ -+ public void deserializeNBT(NBTTagCompound nbt) -+ { -+ this.readFromNBT(nbt); -+ } -+ -+ public NBTTagCompound serializeNBT() -+ { -+ NBTTagCompound ret = new NBTTagCompound(); -+ this.writeToNBT(ret); -+ return ret; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemSword.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemSword.java.patch deleted file mode 100644 index f52fd5942..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemSword.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemSword.java -+++ ../src-work/minecraft/net/minecraft/item/ItemSword.java -@@ -88,7 +88,9 @@ - - public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) - { -- return this.material.getRepairItem() == repair.getItem() ? true : super.getIsRepairable(toRepair, repair); -+ ItemStack mat = this.material.getRepairItemStack(); -+ if (mat != null && net.minecraftforge.oredict.OreDictionary.itemMatches(mat, repair, false)) return true; -+ return super.getIsRepairable(toRepair, repair); - } - - public Multimap getItemAttributeModifiers(EntityEquipmentSlot p_111205_1_) diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemTool.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemTool.java.patch deleted file mode 100644 index 958fe75f3..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemTool.java.patch +++ /dev/null @@ -1,72 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemTool.java -+++ ../src-work/minecraft/net/minecraft/item/ItemTool.java -@@ -33,6 +33,18 @@ - this.damageVsEntity = p_i46745_1_ + p_i46745_3_.getDamageVsEntity(); - this.field_185065_c = p_i46745_2_; - this.setCreativeTab(CreativeTabs.tabTools); -+ if (this instanceof ItemPickaxe) -+ { -+ toolClass = "pickaxe"; -+ } -+ else if (this instanceof ItemAxe) -+ { -+ toolClass = "axe"; -+ } -+ else if (this instanceof ItemSpade) -+ { -+ toolClass = "shovel"; -+ } - } - - protected ItemTool(Item.ToolMaterial p_i46746_1_, Set p_i46746_2_) -@@ -42,6 +54,11 @@ - - public float getStrVsBlock(ItemStack stack, IBlockState state) - { -+ for (String type : getToolClasses(stack)) -+ { -+ if (state.getBlock().isToolEffective(type, state)) -+ return efficiencyOnProperMaterial; -+ } - return this.effectiveBlocks.contains(state.getBlock()) ? this.efficiencyOnProperMaterial : 1.0F; - } - -@@ -84,7 +101,9 @@ - - public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) - { -- return this.toolMaterial.getRepairItem() == repair.getItem() ? true : super.getIsRepairable(toRepair, repair); -+ ItemStack mat = this.toolMaterial.getRepairItemStack(); -+ if (mat != null && net.minecraftforge.oredict.OreDictionary.itemMatches(mat, repair, false)) return true; -+ return super.getIsRepairable(toRepair, repair); - } - - public Multimap getItemAttributeModifiers(EntityEquipmentSlot p_111205_1_) -@@ -99,4 +118,27 @@ - - return multimap; - } -+ -+ /*===================================== FORGE START =================================*/ -+ private String toolClass; -+ @Override -+ public int getHarvestLevel(ItemStack stack, String toolClass) -+ { -+ int level = super.getHarvestLevel(stack, toolClass); -+ if (level == -1 && toolClass != null && toolClass.equals(this.toolClass)) -+ { -+ return this.toolMaterial.getHarvestLevel(); -+ } -+ else -+ { -+ return level; -+ } -+ } -+ -+ @Override -+ public Set getToolClasses(ItemStack stack) -+ { -+ return toolClass != null ? com.google.common.collect.ImmutableSet.of(toolClass) : super.getToolClasses(stack); -+ } -+ /*===================================== FORGE END =================================*/ - } diff --git a/patches.mcp/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch deleted file mode 100644 index 5f38ff604..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java -+++ ../src-work/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java -@@ -73,6 +73,7 @@ - - public void addSmeltingRecipe(ItemStack input, ItemStack stack, float experience) - { -+ if (getSmeltingResult(input) != null) { net.minecraftforge.fml.common.FMLLog.info("Ignored smelting recipe with conflicting input: " + input + " = " + stack); return; } - this.smeltingList.put(input, stack); - this.experienceList.put(stack, Float.valueOf(experience)); - } -@@ -102,6 +103,9 @@ - - public float getSmeltingExperience(ItemStack stack) - { -+ float ret = stack.getItem().getSmeltingExperience(stack); -+ if (ret != -1) return ret; -+ - for (Entry entry : this.experienceList.entrySet()) - { - if (this.compareItemStacks(stack, (ItemStack)entry.getKey())) diff --git a/patches.mcp/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch deleted file mode 100644 index 359c3119c..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/crafting/RecipeFireworks.java -+++ ../src-work/minecraft/net/minecraft/item/crafting/RecipeFireworks.java -@@ -86,9 +86,9 @@ - { - this.field_92102_a = new ItemStack(Items.fireworks); - -+ NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - if (l > 0) - { -- NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - NBTTagCompound nbttagcompound3 = new NBTTagCompound(); - NBTTagList nbttaglist = new NBTTagList(); - -@@ -105,9 +105,9 @@ - nbttagcompound3.setTag("Explosions", nbttaglist); - nbttagcompound3.setByte("Flight", (byte)j); - nbttagcompound1.setTag("Fireworks", nbttagcompound3); -- this.field_92102_a.setTagCompound(nbttagcompound1); - } - -+ this.field_92102_a.setTagCompound(nbttagcompound1); //Forge BugFix: NPE Protection - return true; - } - else if (j == 1 && i == 0 && l == 0 && k > 0 && j1 <= 1) -@@ -249,11 +249,7 @@ - for (int i = 0; i < aitemstack.length; ++i) - { - ItemStack itemstack = inv.getStackInSlot(i); -- -- if (itemstack != null && itemstack.getItem().hasContainerItem()) -- { -- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); -- } -+ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); - } - - return aitemstack; diff --git a/patches.mcp/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch deleted file mode 100644 index b3ad23a68..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch +++ /dev/null @@ -1,42 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java -+++ ../src-work/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java -@@ -25,7 +25,7 @@ - { - ItemStack itemstack1 = (ItemStack)list.get(0); - -- if (itemstack.getItem() != itemstack1.getItem() || itemstack1.stackSize != 1 || itemstack.stackSize != 1 || !itemstack1.getItem().isDamageable()) -+ if (itemstack.getItem() != itemstack1.getItem() || itemstack1.stackSize != 1 || itemstack.stackSize != 1 || !itemstack1.getItem().isRepairable()) - { - return false; - } -@@ -52,7 +52,7 @@ - { - ItemStack itemstack1 = (ItemStack)list.get(0); - -- if (itemstack.getItem() != itemstack1.getItem() || itemstack1.stackSize != 1 || itemstack.stackSize != 1 || !itemstack1.getItem().isDamageable()) -+ if (itemstack.getItem() != itemstack1.getItem() || itemstack1.stackSize != 1 || itemstack.stackSize != 1 || !itemstack1.getItem().isRepairable()) - { - return null; - } -@@ -65,7 +65,7 @@ - ItemStack itemstack2 = (ItemStack)list.get(0); - ItemStack itemstack3 = (ItemStack)list.get(1); - -- if (itemstack2.getItem() == itemstack3.getItem() && itemstack2.stackSize == 1 && itemstack3.stackSize == 1 && itemstack2.getItem().isDamageable()) -+ if (itemstack2.getItem() == itemstack3.getItem() && itemstack2.stackSize == 1 && itemstack3.stackSize == 1 && itemstack2.getItem().isRepairable()) - { - Item item = itemstack2.getItem(); - int j = item.getMaxDamage() - itemstack2.getItemDamage(); -@@ -102,11 +102,7 @@ - for (int i = 0; i < aitemstack.length; ++i) - { - ItemStack itemstack = inv.getStackInSlot(i); -- -- if (itemstack != null && itemstack.getItem().hasContainerItem()) -- { -- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); -- } -+ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); - } - - return aitemstack; diff --git a/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch deleted file mode 100644 index 799b450b6..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java -+++ ../src-work/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java -@@ -146,11 +146,7 @@ - for (int i = 0; i < aitemstack.length; ++i) - { - ItemStack itemstack = inv.getStackInSlot(i); -- -- if (itemstack != null && itemstack.getItem().hasContainerItem()) -- { -- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); -- } -+ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); - } - - return aitemstack; diff --git a/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch deleted file mode 100644 index 2deece974..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/crafting/RecipesBanners.java -+++ ../src-work/minecraft/net/minecraft/item/crafting/RecipesBanners.java -@@ -135,11 +135,7 @@ - for (int i = 0; i < aitemstack.length; ++i) - { - ItemStack itemstack = inv.getStackInSlot(i); -- -- if (itemstack != null && itemstack.getItem().hasContainerItem()) -- { -- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); -- } -+ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); - } - - return aitemstack; -@@ -356,9 +352,9 @@ - - if (itemstack != null) - { -- if (itemstack.getItem().hasContainerItem()) -+ if (itemstack.getItem().hasContainerItem(itemstack)) - { -- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); -+ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); - } - else if (itemstack.hasTagCompound() && TileEntityBanner.getPatterns(itemstack) > 0) - { diff --git a/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch deleted file mode 100644 index 9cf0ab197..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java -+++ ../src-work/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java -@@ -108,11 +108,7 @@ - for (int i = 0; i < aitemstack.length; ++i) - { - ItemStack itemstack = inv.getStackInSlot(i); -- -- if (itemstack != null && itemstack.getItem().hasContainerItem()) -- { -- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); -- } -+ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); - } - - return aitemstack; diff --git a/patches.mcp/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch deleted file mode 100644 index d6265c91a..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/crafting/ShapedRecipes.java -+++ ../src-work/minecraft/net/minecraft/item/crafting/ShapedRecipes.java -@@ -33,11 +33,7 @@ - for (int i = 0; i < aitemstack.length; ++i) - { - ItemStack itemstack = inv.getStackInSlot(i); -- -- if (itemstack != null && itemstack.getItem().hasContainerItem()) -- { -- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); -- } -+ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); - } - - return aitemstack; diff --git a/patches.mcp/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch deleted file mode 100644 index 2241e2699..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java -+++ ../src-work/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java -@@ -29,11 +29,7 @@ - for (int i = 0; i < aitemstack.length; ++i) - { - ItemStack itemstack = inv.getStackInSlot(i); -- -- if (itemstack != null && itemstack.getItem().hasContainerItem()) -- { -- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); -- } -+ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); - } - - return aitemstack; diff --git a/patches.mcp/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch b/patches.mcp/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch deleted file mode 100644 index 76f2e6739..000000000 --- a/patches.mcp/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/nbt/CompressedStreamTools.java -+++ ../src-work/minecraft/net/minecraft/nbt/CompressedStreamTools.java -@@ -17,8 +17,6 @@ - import net.minecraft.crash.CrashReport; - import net.minecraft.crash.CrashReportCategory; - import net.minecraft.util.ReportedException; --import net.minecraftforge.fml.relauncher.Side; --import net.minecraftforge.fml.relauncher.SideOnly; - - public class CompressedStreamTools - { -@@ -53,7 +51,6 @@ - } - } - -- @SideOnly(Side.CLIENT) - public static void safeWrite(NBTTagCompound p_74793_0_, File p_74793_1_) throws IOException - { - File file1 = new File(p_74793_1_.getAbsolutePath() + "_tmp"); -@@ -118,6 +115,7 @@ - private static NBTBase func_152455_a(DataInput p_152455_0_, int p_152455_1_, NBTSizeTracker p_152455_2_) throws IOException - { - byte b0 = p_152455_0_.readByte(); -+ p_152455_2_.read(8); // Forge: Count everything! - - if (b0 == 0) - { -@@ -125,7 +123,8 @@ - } - else - { -- p_152455_0_.readUTF(); -+ NBTSizeTracker.readUTF(p_152455_2_, p_152455_0_.readUTF()); //Forge: Count this string. -+ p_152455_2_.read(32); //Forge: 4 extra bytes for the object allocation. - NBTBase nbtbase = NBTBase.createNewByType(b0); - - try -@@ -144,7 +143,6 @@ - } - } - -- @SideOnly(Side.CLIENT) - public static void write(NBTTagCompound p_74795_0_, File p_74795_1_) throws IOException - { - DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(p_74795_1_)); -@@ -159,7 +157,6 @@ - } - } - -- @SideOnly(Side.CLIENT) - public static NBTTagCompound read(File p_74797_0_) throws IOException - { - if (!p_74797_0_.exists()) diff --git a/patches.mcp/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch b/patches.mcp/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch deleted file mode 100644 index 078cb5b16..000000000 --- a/patches.mcp/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/nbt/NBTSizeTracker.java -+++ ../src-work/minecraft/net/minecraft/nbt/NBTSizeTracker.java -@@ -25,4 +25,34 @@ - throw new RuntimeException("Tried to read NBT tag that was too big; tried to allocate: " + this.read + "bytes where max allowed: " + this.max); - } - } -+ -+ /* -+ * UTF8 is not a simple encoding system, each character can be either -+ * 1, 2, or 3 bytes. Depending on where it's numerical value falls. -+ * We have to count up each character individually to see the true -+ * length of the data. -+ * -+ * Basic concept is that it uses the MSB of each byte as a 'read more' signal. -+ * So it has to shift each 7-bit segment. -+ * -+ * This will accurately count the correct byte length to encode this string, plus the 2 bytes for it's length prefix. -+ */ -+ public static void readUTF(NBTSizeTracker tracker, String data) -+ { -+ tracker.read(16); //Header length -+ if (data == null) -+ return; -+ -+ int len = data.length(); -+ int utflen = 0; -+ -+ for (int i = 0; i < len; i++) -+ { -+ int c = data.charAt(i); -+ if ((c >= 0x0001) && (c <= 0x007F)) utflen += 1; -+ else if (c > 0x07FF) utflen += 3; -+ else utflen += 2; -+ } -+ tracker.read(8 * utflen); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch b/patches.mcp/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch deleted file mode 100644 index 8b17ab96c..000000000 --- a/patches.mcp/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/nbt/NBTTagCompound.java -+++ ../src-work/minecraft/net/minecraft/nbt/NBTTagCompound.java -@@ -454,6 +454,7 @@ - - private static byte readType(DataInput input, NBTSizeTracker sizeTracker) throws IOException - { -+ sizeTracker.read(8); - return input.readByte(); - } - -@@ -464,6 +465,7 @@ - - static NBTBase readNBT(byte id, String key, DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException - { -+ sizeTracker.read(32); //Forge: 4 extra bytes for the object allocation. - NBTBase nbtbase = NBTBase.createNewByType(id); - - try diff --git a/patches.mcp/minecraft/net/minecraft/nbt/NBTTagString.java.patch b/patches.mcp/minecraft/net/minecraft/nbt/NBTTagString.java.patch deleted file mode 100644 index c8ca6ca1a..000000000 --- a/patches.mcp/minecraft/net/minecraft/nbt/NBTTagString.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/nbt/NBTTagString.java -+++ ../src-work/minecraft/net/minecraft/nbt/NBTTagString.java -@@ -32,7 +32,7 @@ - { - sizeTracker.read(288L); - this.data = input.readUTF(); -- sizeTracker.read((long)(16 * this.data.length())); -+ NBTSizeTracker.readUTF(sizeTracker, data); // Forge: Correctly read String length including header. - } - - public byte getId() diff --git a/patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch b/patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch deleted file mode 100644 index 2facd3bb9..000000000 --- a/patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch +++ /dev/null @@ -1,68 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/network/NetHandlerPlayServer.java -+++ ../src-work/minecraft/net/minecraft/network/NetHandlerPlayServer.java -@@ -612,7 +612,10 @@ - double d2 = this.playerEntity.posZ - ((double)blockpos.getZ() + 0.5D); - double d3 = d0 * d0 + d1 * d1 + d2 * d2; - -- if (d3 > 36.0D) -+ double dist = playerEntity.theItemInWorldManager.getBlockReachDistance() + 1; -+ dist *= dist; -+ -+ if (d3 > dist) - { - return; - } -@@ -670,7 +673,9 @@ - - if (blockpos.getY() < this.serverController.getBuildLimit() - 1 || enumfacing != EnumFacing.UP && blockpos.getY() < this.serverController.getBuildLimit()) - { -- if (this.field_184362_y == null && this.playerEntity.getDistanceSq((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D) < 64.0D && !this.serverController.isBlockProtected(worldserver, blockpos, this.playerEntity) && worldserver.getWorldBorder().contains(blockpos)) -+ double dist = playerEntity.theItemInWorldManager.getBlockReachDistance() + 3; -+ dist *= dist; -+ if (this.field_184362_y == null && this.playerEntity.getDistanceSq((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D) < dist && !this.serverController.isBlockProtected(worldserver, blockpos, this.playerEntity) && worldserver.getWorldBorder().contains(blockpos)) - { - this.playerEntity.theItemInWorldManager.func_187251_a(this.playerEntity, worldserver, itemstack, enumhand, blockpos, enumfacing, p_184337_1_.func_187026_d(), p_184337_1_.func_187025_e(), p_184337_1_.func_187020_f()); - } -@@ -689,6 +694,7 @@ - if (itemstack != null && itemstack.stackSize == 0) - { - this.playerEntity.func_184611_a(enumhand, (ItemStack)null); -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.playerEntity, itemstack, enumhand); - itemstack = null; - } - } -@@ -703,12 +709,14 @@ - - if (itemstack != null) - { -+ //TODO: Hook interact event here... we don't know the type of itneration tho... - this.playerEntity.theItemInWorldManager.func_187250_a(this.playerEntity, worldserver, itemstack, enumhand); - itemstack = this.playerEntity.func_184586_b(enumhand); - - if (itemstack != null && itemstack.stackSize == 0) - { - this.playerEntity.func_184611_a(enumhand, (ItemStack)null); -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.playerEntity, itemstack, enumhand); - itemstack = null; - } - } -@@ -888,7 +896,9 @@ - } - else - { -- ITextComponent itextcomponent = new TextComponentTranslation("chat.type.text", new Object[] {this.playerEntity.getDisplayName(), s}); -+ ITextComponent itextcomponent = new TextComponentTranslation("chat.type.text", this.playerEntity.getDisplayName(), net.minecraftforge.common.ForgeHooks.newChatWithLinks(s)); -+ itextcomponent = net.minecraftforge.common.ForgeHooks.onServerChatEvent(this, s, itextcomponent); -+ if (itextcomponent == null) return; - this.serverController.func_184103_al().sendChatMsgImpl(itextcomponent, false); - } - -@@ -1057,7 +1067,7 @@ - return; - } - -- this.playerEntity = this.serverController.func_184103_al().recreatePlayerEntity(this.playerEntity, 0, false); -+ this.playerEntity = this.serverController.func_184103_al().recreatePlayerEntity(this.playerEntity, playerEntity.dimension, false); - - if (this.serverController.isHardcore()) - { diff --git a/patches.mcp/minecraft/net/minecraft/network/NetworkManager.java.patch b/patches.mcp/minecraft/net/minecraft/network/NetworkManager.java.patch deleted file mode 100644 index 454485ec4..000000000 --- a/patches.mcp/minecraft/net/minecraft/network/NetworkManager.java.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/network/NetworkManager.java -+++ ../src-work/minecraft/net/minecraft/network/NetworkManager.java -@@ -89,6 +89,11 @@ - this.direction = packetDirection; - } - -+ public EnumPacketDirection getDirection() -+ { -+ return this.direction; -+ } -+ - public void channelActive(ChannelHandlerContext p_channelActive_1_) throws Exception - { - super.channelActive(p_channelActive_1_); -@@ -205,7 +210,7 @@ - final EnumConnectionState enumconnectionstate = EnumConnectionState.getFromPacket(inPacket); - final EnumConnectionState enumconnectionstate1 = (EnumConnectionState)this.channel.attr(attrKeyConnectionState).get(); - -- if (enumconnectionstate1 != enumconnectionstate) -+ if (enumconnectionstate1 != enumconnectionstate && !( inPacket instanceof net.minecraftforge.fml.common.network.internal.FMLProxyPacket)) - { - logger.debug("Disabled auto read"); - this.channel.config().setAutoRead(false); -@@ -213,7 +218,7 @@ - - if (this.channel.eventLoop().inEventLoop()) - { -- if (enumconnectionstate != enumconnectionstate1) -+ if (enumconnectionstate != enumconnectionstate1 && !( inPacket instanceof net.minecraftforge.fml.common.network.internal.FMLProxyPacket)) - { - this.setConnectionState(enumconnectionstate); - } -@@ -233,7 +238,7 @@ - { - public void run() - { -- if (enumconnectionstate != enumconnectionstate1) -+ if (enumconnectionstate != enumconnectionstate1 && !( inPacket instanceof net.minecraftforge.fml.common.network.internal.FMLProxyPacket)) - { - NetworkManager.this.setConnectionState(enumconnectionstate); - } -@@ -452,6 +457,11 @@ - } - } - -+ public Channel channel() -+ { -+ return channel; -+ } -+ - static class InboundHandlerTuplePacketListener - { - private final Packet packet; diff --git a/patches.mcp/minecraft/net/minecraft/network/NetworkSystem.java.patch b/patches.mcp/minecraft/net/minecraft/network/NetworkSystem.java.patch deleted file mode 100644 index 2f2e97b70..000000000 --- a/patches.mcp/minecraft/net/minecraft/network/NetworkSystem.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/network/NetworkSystem.java -+++ ../src-work/minecraft/net/minecraft/network/NetworkSystem.java -@@ -111,7 +111,7 @@ - ; - } - -- p_initChannel_1_.pipeline().addLast((String)"timeout", (ChannelHandler)(new ReadTimeoutHandler(30))).addLast((String)"legacy_query", (ChannelHandler)(new LegacyPingHandler(NetworkSystem.this))).addLast((String)"splitter", (ChannelHandler)(new NettyVarint21FrameDecoder())).addLast((String)"decoder", (ChannelHandler)(new NettyPacketDecoder(EnumPacketDirection.SERVERBOUND))).addLast((String)"prepender", (ChannelHandler)(new NettyVarint21FrameEncoder())).addLast((String)"encoder", (ChannelHandler)(new NettyPacketEncoder(EnumPacketDirection.CLIENTBOUND))); -+ p_initChannel_1_.pipeline().addLast((String)"timeout", (ChannelHandler)(new ReadTimeoutHandler(net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.READ_TIMEOUT))).addLast((String)"legacy_query", (ChannelHandler)(new LegacyPingHandler(NetworkSystem.this))).addLast((String)"splitter", (ChannelHandler)(new NettyVarint21FrameDecoder())).addLast((String)"decoder", (ChannelHandler)(new NettyPacketDecoder(EnumPacketDirection.SERVERBOUND))).addLast((String)"prepender", (ChannelHandler)(new NettyVarint21FrameEncoder())).addLast((String)"encoder", (ChannelHandler)(new NettyPacketEncoder(EnumPacketDirection.CLIENTBOUND))); - NetworkManager networkmanager = new NetworkManager(EnumPacketDirection.SERVERBOUND); - NetworkSystem.this.networkManagers.add(networkmanager); - p_initChannel_1_.pipeline().addLast((String)"packet_handler", (ChannelHandler)networkmanager); diff --git a/patches.mcp/minecraft/net/minecraft/network/ServerStatusResponse.java.patch b/patches.mcp/minecraft/net/minecraft/network/ServerStatusResponse.java.patch deleted file mode 100644 index ce50f6b63..000000000 --- a/patches.mcp/minecraft/net/minecraft/network/ServerStatusResponse.java.patch +++ /dev/null @@ -1,91 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/network/ServerStatusResponse.java -+++ ../src-work/minecraft/net/minecraft/network/ServerStatusResponse.java -@@ -29,6 +29,7 @@ - public void setServerDescription(ITextComponent motd) - { - this.serverMotd = motd; -+ invalidateJson(); - } - - public ServerStatusResponse.Players getPlayerCountData() -@@ -39,6 +40,7 @@ - public void setPlayerCountData(ServerStatusResponse.Players countData) - { - this.playerCount = countData; -+ invalidateJson(); - } - - public ServerStatusResponse.Version getProtocolVersionInfo() -@@ -49,11 +51,13 @@ - public void setProtocolVersionInfo(ServerStatusResponse.Version protocolVersionData) - { - this.protocolVersion = protocolVersionData; -+ invalidateJson(); - } - - public void setFavicon(String faviconBlob) - { - this.favicon = faviconBlob; -+ invalidateJson(); - } - - public String getFavicon() -@@ -176,6 +180,7 @@ - serverstatusresponse.setFavicon(JsonUtils.getString(jsonobject, "favicon")); - } - -+ net.minecraftforge.fml.client.FMLClientHandler.instance().captureAdditionalData(serverstatusresponse, jsonobject); - return serverstatusresponse; - } - -@@ -203,10 +208,50 @@ - jsonobject.addProperty("favicon", p_serialize_1_.getFavicon()); - } - -+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.enhanceStatusQuery(jsonobject); - return jsonobject; - } - } - -+ private java.util.concurrent.Semaphore mutex = new java.util.concurrent.Semaphore(1); -+ private String json = null; -+ /** -+ * Returns this object as a Json string. -+ * Converting to JSON if a cached version is not available. -+ * -+ * Also to prevent potentially large memory allocations on the server -+ * this is moved from the S00PacketServerInfo writePacket function -+ * -+ * As this method is called from the network threads thread safety is important! -+ * -+ * @return -+ */ -+ public String getJson() -+ { -+ String ret = this.json; -+ if (ret == null) -+ { -+ mutex.acquireUninterruptibly(); -+ ret = this.json; -+ if (ret == null) -+ { -+ ret = net.minecraft.network.status.server.SPacketServerInfo.GSON.toJson(this); -+ this.json = ret; -+ } -+ mutex.release(); -+ } -+ return ret; -+ } -+ -+ /** -+ * Invalidates the cached json, causing the next call to getJson to rebuild it. -+ * This is needed externally because PlayerCountData.setPlayer's is public. -+ */ -+ public void invalidateJson() -+ { -+ this.json = null; -+ } -+ - public static class Version - { - private final String name; diff --git a/patches.mcp/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch b/patches.mcp/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch deleted file mode 100644 index dbeee89f6..000000000 --- a/patches.mcp/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch +++ /dev/null @@ -1,48 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/network/handshake/client/C00Handshake.java -+++ ../src-work/minecraft/net/minecraft/network/handshake/client/C00Handshake.java -@@ -14,6 +14,7 @@ - private String ip; - private int port; - private EnumConnectionState requestedState; -+ private boolean hasFMLMarker = false; - - public C00Handshake() - { -@@ -28,18 +29,26 @@ - this.requestedState = requestedState; - } - -+ public C00Handshake(int protocol, String address, int port, EnumConnectionState state, boolean addFMLMarker) -+ { -+ this(protocol, address, port, state); -+ this.hasFMLMarker = addFMLMarker; -+ } -+ - public void readPacketData(PacketBuffer buf) throws IOException - { - this.protocolVersion = buf.readVarIntFromBuffer(); - this.ip = buf.readStringFromBuffer(255); - this.port = buf.readUnsignedShort(); - this.requestedState = EnumConnectionState.getById(buf.readVarIntFromBuffer()); -+ this.hasFMLMarker = this.ip.contains("\0FML\0"); -+ this.ip = this.ip.split("\0")[0]; - } - - public void writePacketData(PacketBuffer buf) throws IOException - { - buf.writeVarIntToBuffer(this.protocolVersion); -- buf.writeString(this.ip); -+ buf.writeString(this.ip + "\0FML\0"); - buf.writeShort(this.port); - buf.writeVarIntToBuffer(this.requestedState.getId()); - } -@@ -58,4 +67,9 @@ - { - return this.protocolVersion; - } -+ -+ public boolean hasFMLMarker() -+ { -+ return this.hasFMLMarker; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/network/play/client/CPacketCustomPayload.java.patch b/patches.mcp/minecraft/net/minecraft/network/play/client/CPacketCustomPayload.java.patch deleted file mode 100644 index 1e6382e7d..000000000 --- a/patches.mcp/minecraft/net/minecraft/network/play/client/CPacketCustomPayload.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/network/play/client/CPacketCustomPayload.java -+++ ../src-work/minecraft/net/minecraft/network/play/client/CPacketCustomPayload.java -@@ -47,7 +47,11 @@ - public void writePacketData(PacketBuffer buf) throws IOException - { - buf.writeString(this.channel); -+ synchronized(this.data) { //This may be access multiple times, from multiple threads, lets be safe. -+ this.data.markReaderIndex(); - buf.writeBytes((ByteBuf)this.data); -+ this.data.resetReaderIndex(); -+ } - } - - public void processPacket(INetHandlerPlayServer handler) diff --git a/patches.mcp/minecraft/net/minecraft/network/play/server/SPacketCustomPayload.java.patch b/patches.mcp/minecraft/net/minecraft/network/play/server/SPacketCustomPayload.java.patch deleted file mode 100644 index 3ec2e8b49..000000000 --- a/patches.mcp/minecraft/net/minecraft/network/play/server/SPacketCustomPayload.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/network/play/server/SPacketCustomPayload.java -+++ ../src-work/minecraft/net/minecraft/network/play/server/SPacketCustomPayload.java -@@ -46,7 +46,11 @@ - public void writePacketData(PacketBuffer buf) throws IOException - { - buf.writeString(this.channel); -+ synchronized(this.data) { //This may be access multiple times, from multiple threads, lets be safe. -+ this.data.markReaderIndex(); - buf.writeBytes((ByteBuf)this.data); -+ this.data.resetReaderIndex(); -+ } - } - - public void processPacket(INetHandlerPlayClient handler) diff --git a/patches.mcp/minecraft/net/minecraft/potion/Potion.java.patch b/patches.mcp/minecraft/net/minecraft/potion/Potion.java.patch deleted file mode 100644 index dc766effa..000000000 --- a/patches.mcp/minecraft/net/minecraft/potion/Potion.java.patch +++ /dev/null @@ -1,57 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/potion/Potion.java -+++ ../src-work/minecraft/net/minecraft/potion/Potion.java -@@ -23,7 +23,7 @@ - - public class Potion - { -- public static final RegistryNamespaced field_188414_b = new RegistryNamespaced(); -+ public static final RegistryNamespaced field_188414_b = net.minecraftforge.fml.common.registry.GameData.getPotionRegistry(); - private final Map attributeModifierMap = Maps.newHashMap(); - private final boolean isBadEffect; - private final int liquidColor; -@@ -195,7 +195,6 @@ - return this.statusIconIndex; - } - -- @SideOnly(Side.CLIENT) - public boolean isBadEffect() - { - return this.isBadEffect; -@@ -266,7 +265,37 @@ - return modifier.getAmount() * (double)(p_111183_1_ + 1); - } - -+ /* ======================================== FORGE START =====================================*/ -+ -+ /** -+ * If the Potion effect should be displayed in the players inventory -+ * @param effect the active PotionEffect -+ * @return true to display it (default), false to hide it. -+ */ -+ public boolean shouldRender(PotionEffect effect) { return true; } -+ -+ /** -+ * If the standard PotionEffect text (name and duration) should be drawn when this potion is active. -+ * @param effect the active PotionEffect -+ * @return true to draw the standard text -+ */ -+ public boolean shouldRenderInvText(PotionEffect effect) -+ { -+ return true; -+ } -+ -+ /** -+ * Called to draw the this Potion onto the player's inventory when it's active. -+ * This can be used to e.g. render Potion icons from your own texture. -+ * @param x the x coordinate -+ * @param y the y coordinate -+ * @param effect the active PotionEffect -+ * @param mc the Minecraft instance, for convenience -+ */ - @SideOnly(Side.CLIENT) -+ public void renderInventoryEffect(int x, int y, PotionEffect effect, net.minecraft.client.Minecraft mc) { } -+ -+ @SideOnly(Side.CLIENT) - public boolean func_188408_i() - { - return this.field_188415_h; diff --git a/patches.mcp/minecraft/net/minecraft/potion/PotionEffect.java.patch b/patches.mcp/minecraft/net/minecraft/potion/PotionEffect.java.patch deleted file mode 100644 index c89501ebf..000000000 --- a/patches.mcp/minecraft/net/minecraft/potion/PotionEffect.java.patch +++ /dev/null @@ -1,87 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/potion/PotionEffect.java -+++ ../src-work/minecraft/net/minecraft/potion/PotionEffect.java -@@ -19,6 +19,8 @@ - @SideOnly(Side.CLIENT) - private boolean isPotionDurationMax; - private boolean field_188421_h; -+ /** List of ItemStack that can cure the potion effect **/ -+ private java.util.List curativeItems; - - public PotionEffect(Potion p_i46811_1_) - { -@@ -51,6 +53,7 @@ - this.amplifier = other.amplifier; - this.isAmbient = other.isAmbient; - this.field_188421_h = other.field_188421_h; -+ this.curativeItems = other.curativeItems; - } - - public void combine(PotionEffect other) -@@ -200,7 +203,7 @@ - - public static PotionEffect readCustomPotionEffectFromNBT(NBTTagCompound nbt) - { -- int i = nbt.getByte("Id"); -+ int i = nbt.getByte("Id") & 0xFF; - Potion potion = Potion.func_188412_a(i); - - if (potion == null) -@@ -240,4 +243,58 @@ - { - return this.isPotionDurationMax; - } -+ -+ /* ======================================== FORGE START =====================================*/ -+ /*** -+ * Returns a list of curative items for the potion effect -+ * @return The list (ItemStack) of curative items for the potion effect -+ */ -+ public java.util.List getCurativeItems() -+ { -+ if (this.curativeItems == null) //Lazy load this so that we don't create a circular dep on Items. -+ { -+ this.curativeItems = new java.util.ArrayList(); -+ this.curativeItems.add(new net.minecraft.item.ItemStack(net.minecraft.init.Items.milk_bucket)); -+ } -+ return this.curativeItems; -+ } -+ -+ /*** -+ * Checks the given ItemStack to see if it is in the list of curative items for the potion effect -+ * @param stack The ItemStack being checked against the list of curative items for the potion effect -+ * @return true if the given ItemStack is in the list of curative items for the potion effect, false otherwise -+ */ -+ public boolean isCurativeItem(net.minecraft.item.ItemStack stack) -+ { -+ for (net.minecraft.item.ItemStack curativeItem : this.getCurativeItems()) -+ { -+ if (curativeItem.isItemEqual(stack)) -+ { -+ return true; -+ } -+ } -+ -+ return false; -+ } -+ -+ /*** -+ * Sets the array of curative items for the potion effect -+ * @param curativeItems The list of ItemStacks being set to the potion effect -+ */ -+ public void setCurativeItems(java.util.List curativeItems) -+ { -+ this.curativeItems = curativeItems; -+ } -+ -+ /*** -+ * Adds the given stack to list of curative items for the potion effect -+ * @param stack The ItemStack being added to the curative item list -+ */ -+ public void addCurativeItem(net.minecraft.item.ItemStack stack) -+ { -+ if (!this.isCurativeItem(stack)) -+ { -+ this.getCurativeItems().add(stack); -+ } -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/realms/RealmsConnect.java.patch b/patches.mcp/minecraft/net/minecraft/realms/RealmsConnect.java.patch deleted file mode 100644 index 8fa2dc50d..000000000 --- a/patches.mcp/minecraft/net/minecraft/realms/RealmsConnect.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/realms/RealmsConnect.java -+++ ../src-work/minecraft/net/minecraft/realms/RealmsConnect.java -@@ -38,6 +38,7 @@ - - try - { -+ net.minecraftforge.fml.client.FMLClientHandler.instance().connectToRealmsServer(p_connect_1_, p_connect_2_); - inetaddress = InetAddress.getByName(p_connect_1_); - - if (RealmsConnect.this.aborted) -@@ -59,7 +60,7 @@ - return; - } - -- RealmsConnect.this.connection.sendPacket(new C00Handshake(107, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN)); -+ RealmsConnect.this.connection.sendPacket(new C00Handshake(107, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN, true)); - - if (RealmsConnect.this.aborted) - { diff --git a/patches.mcp/minecraft/net/minecraft/server/MinecraftServer.java.patch b/patches.mcp/minecraft/net/minecraft/server/MinecraftServer.java.patch deleted file mode 100644 index 25a020376..000000000 --- a/patches.mcp/minecraft/net/minecraft/server/MinecraftServer.java.patch +++ /dev/null @@ -1,273 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/MinecraftServer.java -+++ ../src-work/minecraft/net/minecraft/server/MinecraftServer.java -@@ -100,7 +100,7 @@ - @SideOnly(Side.SERVER) - private String hostname; - private int serverPort = -1; -- public WorldServer[] worldServers; -+ public WorldServer[] worldServers = new WorldServer[0]; - private PlayerList serverConfigManager; - private boolean serverRunning = true; - private boolean serverStopped; -@@ -117,7 +117,8 @@ - private int buildLimit; - private int maxPlayerIdleMinutes = 0; - public final long[] tickTimeArray = new long[100]; -- public long[][] timeOfLastDimensionTick; -+ //public long[][] timeOfLastDimensionTick; -+ public java.util.Hashtable worldTickTimes = new java.util.Hashtable(); - private KeyPair serverKeyPair; - private String serverOwner; - private String folderName; -@@ -215,8 +216,6 @@ - { - this.convertMapIfNeeded(p_71247_1_); - this.setUserMessage("menu.loadingLevel"); -- this.worldServers = new WorldServer[3]; -- this.timeOfLastDimensionTick = new long[this.worldServers.length][100]; - ISaveHandler isavehandler = this.anvilConverterForAnvilFile.getSaveLoader(p_71247_1_, true); - this.setResourcePackFromWorld(this.getFolderName(), isavehandler); - WorldInfo worldinfo = isavehandler.loadWorldInfo(); -@@ -247,47 +246,21 @@ - worldsettings = new WorldSettings(worldinfo); - } - -- for (int i = 0; i < this.worldServers.length; ++i) -+ WorldServer overWorld = (WorldServer)(isDemo() ? new DemoWorldServer(this, isavehandler, worldinfo, 0, theProfiler).init() : new WorldServer(this, isavehandler, worldinfo, 0, theProfiler).init()); -+ overWorld.initialize(worldsettings); -+ for (int dim : net.minecraftforge.common.DimensionManager.getStaticDimensionIDs()) - { -- int j = 0; -+ WorldServer world = (dim == 0 ? overWorld : (WorldServer)new WorldServerMulti(this, isavehandler, dim, overWorld, theProfiler).init()); -+ world.addWorldAccess(new WorldManager(this, world)); - -- if (i == 1) -- { -- j = -1; -- } -- -- if (i == 2) -- { -- j = 1; -- } -- -- if (i == 0) -- { -- if (this.isDemo()) -- { -- this.worldServers[i] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init(); -- } -- else -- { -- this.worldServers[i] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init(); -- } -- -- this.worldServers[i].initialize(worldsettings); -- } -- else -- { -- this.worldServers[i] = (WorldServer)(new WorldServerMulti(this, isavehandler, j, this.worldServers[0], this.theProfiler)).init(); -- } -- -- this.worldServers[i].addWorldAccess(new WorldManager(this, this.worldServers[i])); -- - if (!this.isSinglePlayer()) - { -- this.worldServers[i].getWorldInfo().setGameType(this.getGameType()); -+ world.getWorldInfo().setGameType(this.getGameType()); - } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(world)); - } - -- this.serverConfigManager.setPlayerManager(this.worldServers); -+ this.serverConfigManager.setPlayerManager(new WorldServer[]{ overWorld }); - this.setDifficultyForAllWorlds(this.getDifficulty()); - this.initialWorldChunkLoad(); - } -@@ -302,7 +275,7 @@ - this.setUserMessage("menu.generatingTerrain"); - int j1 = 0; - logger.info("Preparing start region for level " + j1); -- WorldServer worldserver = this.worldServers[j1]; -+ WorldServer worldserver = net.minecraftforge.common.DimensionManager.getWorld(j1); - BlockPos blockpos = worldserver.getSpawnPoint(); - long k1 = getCurrentTimeMillis(); - -@@ -420,9 +393,15 @@ - { - if (this.worldServers[j] != null) - { -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(this.worldServers[j])); } - this.worldServers[j].flush(); -- } - } -+ -+ WorldServer[] tmp = worldServers; -+ for (WorldServer world : tmp) -+ { -+ net.minecraftforge.common.DimensionManager.setWorld(world.provider.getDimension(), null, this); -+ } - } - - if (this.usageSnooper.isSnooperRunning()) -@@ -447,6 +426,7 @@ - { - if (this.startServer()) - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStarted(); - this.currentTime = getCurrentTimeMillis(); - long i = 0L; - this.statusResponse.setServerDescription(new TextComponentString(this.motd)); -@@ -491,12 +471,20 @@ - Thread.sleep(Math.max(1L, 50L - i)); - this.serverIsRunning = true; - } -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStopping(); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions - } - else - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions - this.finalTick((CrashReport)null); - } - } -+ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e) -+ { -+ // ignore silently -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions -+ } - catch (Throwable throwable1) - { - logger.error("Encountered an unexpected exception", throwable1); -@@ -522,14 +510,15 @@ - logger.error("We were unable to save this crash report to disk."); - } - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions - this.finalTick(crashreport); - } - finally - { - try - { -- this.serverStopped = true; - this.stopServer(); -+ this.serverStopped = true; - } - catch (Throwable throwable) - { -@@ -537,6 +526,8 @@ - } - finally - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStopped(); -+ this.serverStopped = true; - this.systemExitNow(); - } - } -@@ -604,6 +595,7 @@ - public void tick() - { - long i = System.nanoTime(); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPreServerTick(); - ++this.tickCounter; - - if (this.startProfiling) -@@ -630,6 +622,7 @@ - - Collections.shuffle(Arrays.asList(agameprofile)); - this.statusResponse.getPlayerCountData().setPlayers(agameprofile); -+ this.statusResponse.invalidateJson(); - } - - if (this.tickCounter % 900 == 0) -@@ -657,6 +650,7 @@ - - this.theProfiler.endSection(); - this.theProfiler.endSection(); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostServerTick(); - } - - public void updateTimeLightAndEntities() -@@ -672,14 +666,17 @@ - } - - this.theProfiler.endStartSection("levels"); -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.tick(); - -- for (int j = 0; j < this.worldServers.length; ++j) -+ Integer[] ids = net.minecraftforge.common.DimensionManager.getIDs(this.tickCounter % 200 == 0); -+ for (int x = 0; x < ids.length; x++) - { -+ int id = ids[x]; - long i = System.nanoTime(); - -- if (j == 0 || this.getAllowNether()) -+ if (id == 0 || this.getAllowNether()) - { -- WorldServer worldserver = this.worldServers[j]; -+ WorldServer worldserver = net.minecraftforge.common.DimensionManager.getWorld(id); - this.theProfiler.startSection(worldserver.getWorldInfo().getWorldName()); - - if (this.tickCounter % 20 == 0) -@@ -690,6 +687,7 @@ - } - - this.theProfiler.startSection("tick"); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPreWorldTick(worldserver); - - try - { -@@ -713,6 +711,7 @@ - throw new ReportedException(crashreport1); - } - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostWorldTick(worldserver); - this.theProfiler.endSection(); - this.theProfiler.startSection("tracker"); - worldserver.getEntityTracker().updateTrackedEntities(); -@@ -720,9 +719,11 @@ - this.theProfiler.endSection(); - } - -- this.timeOfLastDimensionTick[j][this.tickCounter % 100] = System.nanoTime() - i; -+ worldTickTimes.get(id)[this.tickCounter % 100] = System.nanoTime() - i; - } - -+ this.theProfiler.endStartSection("dim_unloading"); -+ net.minecraftforge.common.DimensionManager.unloadWorlds(worldTickTimes); - this.theProfiler.endStartSection("connection"); - this.getNetworkSystem().networkTick(); - this.theProfiler.endStartSection("players"); -@@ -744,6 +745,7 @@ - - public void startServerThread() - { -+ net.minecraftforge.fml.common.StartupQuery.reset(); - this.serverThread = new Thread(this, "Server thread"); - this.serverThread.start(); - } -@@ -760,7 +762,13 @@ - - public WorldServer worldServerForDimension(int dimension) - { -- return dimension == -1 ? this.worldServers[1] : (dimension == 1 ? this.worldServers[2] : this.worldServers[0]); -+ WorldServer ret = net.minecraftforge.common.DimensionManager.getWorld(dimension); -+ if (ret == null) -+ { -+ net.minecraftforge.common.DimensionManager.initDimension(dimension); -+ ret = net.minecraftforge.common.DimensionManager.getWorld(dimension); -+ } -+ return ret; - } - - public String getMinecraftVersion() -@@ -790,7 +798,7 @@ - - public String getServerModName() - { -- return "vanilla"; -+ return net.minecraftforge.fml.common.FMLCommonHandler.instance().getModName(); - } - - public CrashReport addServerInfoToCrashReport(CrashReport report) diff --git a/patches.mcp/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch b/patches.mcp/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch deleted file mode 100644 index 4e1062e8a..000000000 --- a/patches.mcp/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch +++ /dev/null @@ -1,62 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/dedicated/DedicatedServer.java -+++ ../src-work/minecraft/net/minecraft/server/dedicated/DedicatedServer.java -@@ -56,6 +56,7 @@ - private boolean canSpawnStructures; - private WorldSettings.GameType gameType; - private boolean guiIsEnabled; -+ public static boolean allowPlayerLogins = false; - - public DedicatedServer(File p_i47086_1_, DataFixer p_i47086_2_, YggdrasilAuthenticationService p_i47086_3_, MinecraftSessionService p_i47086_4_, GameProfileRepository p_i47086_5_, PlayerProfileCache p_i47086_6_) - { -@@ -89,6 +90,7 @@ - { - public void run() - { -+ if (net.minecraftforge.server.console.TerminalHandler.handleCommands(DedicatedServer.this)) return; - BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in)); - String s4; - -@@ -114,6 +116,8 @@ - logger.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); - } - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onServerStart(this); -+ - logger.info("Loading properties"); - this.settings = new PropertyManager(new File("server.properties")); - this.eula = new ServerEula(new File("eula.txt")); -@@ -205,6 +209,7 @@ - } - else - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onServerStarted(); - this.func_184105_a(new DedicatedPlayerList(this)); - long j = System.nanoTime(); - -@@ -254,6 +259,7 @@ - TileEntitySkull.func_184293_a(this.getPlayerProfileCache()); - TileEntitySkull.func_184294_a(this.getMinecraftSessionService()); - PlayerProfileCache.func_187320_a(this.isServerInOnlineMode()); -+ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerAboutToStart(this)) return false; - logger.info("Preparing level \"" + this.getFolderName() + "\""); - this.loadAllWorlds(this.getFolderName(), this.getFolderName(), k, worldtype, s2); - long i1 = System.nanoTime() - j; -@@ -282,7 +288,7 @@ - thread1.start(); - } - -- return true; -+ return net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStarting(this); - } - } - } -@@ -580,6 +586,9 @@ - return this.settings.getIntProperty("network-compression-threshold", super.getNetworkCompressionTreshold()); - } - -+ //Forge: Enable formated text for colors in console. -+ @Override public void addChatMessage(net.minecraft.util.text.ITextComponent message) { logger.info(message.getFormattedText()); } -+ - protected boolean convertFiles() throws IOException - { - boolean flag = false; diff --git a/patches.mcp/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java.patch b/patches.mcp/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java.patch deleted file mode 100644 index 10a8b960a..000000000 --- a/patches.mcp/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java -+++ ../src-work/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java -@@ -22,6 +22,7 @@ - private static final Logger LOGGER = LogManager.getLogger(); - private final DedicatedServer server; - private final long maxTickTime; -+ private boolean firstRun = true; - - public ServerHangWatchdog(DedicatedServer server) - { -@@ -37,7 +38,7 @@ - long j = MinecraftServer.getCurrentTimeMillis(); - long k = j - i; - -- if (k > this.maxTickTime) -+ if (k > this.maxTickTime && !this.firstRun) - { - LOGGER.fatal("A single server tick took " + String.format("%.2f", new Object[] {Float.valueOf((float)k / 1000.0F)}) + " seconds (should be max " + String.format("%.2f", new Object[] {Float.valueOf(0.05F)}) + ")"); - LOGGER.fatal("Considering it to be crashed, server will forcibly shutdown."); -@@ -75,6 +76,8 @@ - this.scheduleHalt(); - } - -+ this.firstRun = false; -+ - try - { - Thread.sleep(i + this.maxTickTime - j); diff --git a/patches.mcp/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch b/patches.mcp/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch deleted file mode 100644 index 36c615763..000000000 --- a/patches.mcp/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/gui/MinecraftServerGui.java -+++ ../src-work/minecraft/net/minecraft/server/gui/MinecraftServerGui.java -@@ -77,6 +77,7 @@ - System.exit(0); - } - }); -+ minecraftservergui.latch.countDown(); - } - - public MinecraftServerGui(DedicatedServer serverIn) -@@ -161,8 +162,13 @@ - return jpanel; - } - -+ private java.util.concurrent.CountDownLatch latch = new java.util.concurrent.CountDownLatch(1); - public void func_164247_a(final JTextArea p_164247_1_, final JScrollPane p_164247_2_, final String p_164247_3_) - { -+ try -+ { -+ latch.await(); -+ } catch (InterruptedException e){} //Prevent logging until after constructor has ended. - if (!SwingUtilities.isEventDispatchThread()) - { - SwingUtilities.invokeLater(new Runnable() diff --git a/patches.mcp/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch b/patches.mcp/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch deleted file mode 100644 index e83ac8ccb..000000000 --- a/patches.mcp/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch +++ /dev/null @@ -1,87 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/integrated/IntegratedServer.java -+++ ../src-work/minecraft/net/minecraft/server/integrated/IntegratedServer.java -@@ -68,8 +68,6 @@ - protected void loadAllWorlds(String p_71247_1_, String p_71247_2_, long seed, WorldType type, String p_71247_6_) - { - this.convertMapIfNeeded(p_71247_1_); -- this.worldServers = new WorldServer[3]; -- this.timeOfLastDimensionTick = new long[this.worldServers.length][100]; - ISaveHandler isavehandler = this.getActiveAnvilConverter().getSaveLoader(p_71247_1_, true); - this.setResourcePackFromWorld(this.getFolderName(), isavehandler); - WorldInfo worldinfo = isavehandler.loadWorldInfo(); -@@ -83,44 +81,23 @@ - worldinfo.setWorldName(p_71247_2_); - } - -- for (int i = 0; i < this.worldServers.length; ++i) -+ WorldServer overWorld = (isDemo() ? (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, 0, this.theProfiler)).init() : -+ (WorldServer)(new WorldServer(this, isavehandler, worldinfo, 0, this.theProfiler)).init()); -+ overWorld.initialize(this.theWorldSettings); -+ for (int dim : net.minecraftforge.common.DimensionManager.getStaticDimensionIDs()) - { -- int j = 0; -- -- if (i == 1) -+ WorldServer world = (dim == 0 ? overWorld : (WorldServer)(new WorldServerMulti(this, isavehandler, dim, overWorld, this.theProfiler)).init()); -+ world.addWorldAccess(new WorldManager(this, world)); -+ if (!this.isSinglePlayer()) - { -- j = -1; -+ world.getWorldInfo().setGameType(getGameType()); - } -- -- if (i == 2) -- { -- j = 1; -- } -- -- if (i == 0) -- { -- if (this.isDemo()) -- { -- this.worldServers[i] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init(); -- } -- else -- { -- this.worldServers[i] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init(); -- } -- -- this.worldServers[i].initialize(this.theWorldSettings); -- } -- else -- { -- this.worldServers[i] = (WorldServer)(new WorldServerMulti(this, isavehandler, j, this.worldServers[0], this.theProfiler)).init(); -- } -- -- this.worldServers[i].addWorldAccess(new WorldManager(this, this.worldServers[i])); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(world)); - } - -- this.func_184103_al().setPlayerManager(this.worldServers); -+ this.func_184103_al().setPlayerManager(new WorldServer[]{ overWorld }); - -- if (this.worldServers[0].getWorldInfo().getDifficulty() == null) -+ if (overWorld.getWorldInfo().getDifficulty() == null) - { - this.setDifficultyForAllWorlds(this.mc.gameSettings.difficulty); - } -@@ -138,9 +115,10 @@ - this.setAllowFlight(true); - logger.info("Generating keypair"); - this.setKeyPair(CryptManager.generateKeyPair()); -+ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerAboutToStart(this)) return false; - this.loadAllWorlds(this.getFolderName(), this.getWorldName(), this.theWorldSettings.getSeed(), this.theWorldSettings.getTerrainType(), this.theWorldSettings.getWorldName()); - this.setMOTD(this.getServerOwner() + " - " + this.worldServers[0].getWorldInfo().getWorldName()); -- return true; -+ return net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStarting(this); - } - - public void tick() -@@ -213,6 +191,7 @@ - - public EnumDifficulty getDifficulty() - { -+ if (this.mc.theWorld == null) return this.mc.gameSettings.difficulty; // Fix NPE just in case. - return this.mc.theWorld.getWorldInfo().getDifficulty(); - } - diff --git a/patches.mcp/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch b/patches.mcp/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch deleted file mode 100644 index 3111f6a97..000000000 --- a/patches.mcp/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch +++ /dev/null @@ -1,213 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/management/PlayerInteractionManager.java -+++ ../src-work/minecraft/net/minecraft/server/management/PlayerInteractionManager.java -@@ -27,6 +27,8 @@ - - public class PlayerInteractionManager - { -+ /** Forge reach distance */ -+ private double blockReachDistance = 5.0d; - public World theWorld; - public EntityPlayerMP thisPlayerMP; - private WorldSettings.GameType gameType = WorldSettings.GameType.NOT_SET; -@@ -88,7 +90,7 @@ - IBlockState iblockstate = this.theWorld.getBlockState(this.field_180241_i); - Block block = iblockstate.getBlock(); - -- if (iblockstate.func_185904_a() == Material.air) -+ if (block.isAir(iblockstate, theWorld, field_180241_i)) - { - this.receivedFinishDiggingPacket = false; - } -@@ -115,7 +117,7 @@ - IBlockState iblockstate1 = this.theWorld.getBlockState(this.field_180240_f); - Block block1 = iblockstate1.getBlock(); - -- if (iblockstate1.func_185904_a() == Material.air) -+ if (block1.isAir(iblockstate1, theWorld, field_180240_f)) - { - this.theWorld.sendBlockBreakProgress(this.thisPlayerMP.getEntityId(), this.field_180240_f, -1); - this.durabilityRemainingOnBlock = -1; -@@ -124,7 +126,7 @@ - else - { - int k = this.curblockDamage - this.initialDamage; -- float f1 = iblockstate1.func_185903_a(this.thisPlayerMP, this.thisPlayerMP.worldObj, this.field_180241_i) * (float)(k + 1); -+ float f1 = iblockstate1.func_185903_a(this.thisPlayerMP, this.thisPlayerMP.worldObj, this.field_180240_f) * (float)(k + 1); // Forge: Fix network break progress using wrong position - int l = (int)(f1 * 10.0F); - - if (l != this.durabilityRemainingOnBlock) -@@ -138,6 +140,14 @@ - - public void onBlockClicked(BlockPos pos, EnumFacing side) - { -+ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(thisPlayerMP, -+ net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.LEFT_CLICK_BLOCK, theWorld, pos, side, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(thisPlayerMP, getBlockReachDistance() + 1)); -+ if (event.isCanceled()) -+ { -+ thisPlayerMP.playerNetServerHandler.sendPacket(new SPacketBlockChange(theWorld, pos)); -+ return; -+ } -+ - if (this.isCreative()) - { - if (!this.theWorld.extinguishFire((EntityPlayer)null, pos, side)) -@@ -173,17 +183,32 @@ - } - } - -- this.theWorld.extinguishFire((EntityPlayer)null, pos, side); - this.initialDamage = this.curblockDamage; - float f = 1.0F; - -- if (iblockstate.func_185904_a() != Material.air) -+ if (!iblockstate.getBlock().isAir(iblockstate, theWorld, pos)) - { -- block.onBlockClicked(this.theWorld, pos, this.thisPlayerMP); -+ if (event.useBlock != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) -+ { -+ block.onBlockClicked(this.theWorld, pos, this.thisPlayerMP); -+ this.theWorld.extinguishFire((EntityPlayer)null, pos, side); -+ } -+ else -+ { -+ thisPlayerMP.playerNetServerHandler.sendPacket(new SPacketBlockChange(theWorld, pos)); -+ } - f = iblockstate.func_185903_a(this.thisPlayerMP, this.thisPlayerMP.worldObj, pos); - } -+ if (event.useItem == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) -+ { -+ if (f >= 1.0F) -+ { -+ thisPlayerMP.playerNetServerHandler.sendPacket(new SPacketBlockChange(theWorld, pos)); -+ } -+ return; -+ } - -- if (iblockstate.func_185904_a() != Material.air && f >= 1.0F) -+ if (iblockstate.getBlock().isAir(iblockstate, theWorld, pos) && f >= 1.0F) - { - this.tryHarvestBlock(pos); - } -@@ -205,7 +230,7 @@ - int i = this.curblockDamage - this.initialDamage; - IBlockState iblockstate = this.theWorld.getBlockState(pos); - -- if (iblockstate.func_185904_a() != Material.air) -+ if (iblockstate.getBlock().isAir(iblockstate, theWorld, pos)) - { - float f = iblockstate.func_185903_a(this.thisPlayerMP, this.thisPlayerMP.worldObj, pos) * (float)(i + 1); - -@@ -234,9 +259,14 @@ - - private boolean removeBlock(BlockPos pos) - { -+ return removeBlock(pos, false); -+ } -+ -+ private boolean removeBlock(BlockPos pos, boolean canHarvest) -+ { - IBlockState iblockstate = this.theWorld.getBlockState(pos); - iblockstate.getBlock().onBlockHarvested(this.theWorld, pos, iblockstate, this.thisPlayerMP); -- boolean flag = this.theWorld.setBlockToAir(pos); -+ boolean flag = iblockstate.getBlock().removedByPlayer(iblockstate, theWorld, pos, thisPlayerMP, canHarvest); - - if (flag) - { -@@ -248,7 +278,8 @@ - - public boolean tryHarvestBlock(BlockPos pos) - { -- if (this.gameType.isCreative() && this.thisPlayerMP.func_184614_ca() != null && this.thisPlayerMP.func_184614_ca().getItem() instanceof ItemSword) -+ int exp = net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(theWorld, gameType, thisPlayerMP, pos); -+ if (exp == -1) - { - return false; - } -@@ -264,41 +295,22 @@ - } - else - { -- if (this.gameType.isAdventure()) -- { -- if (this.gameType == WorldSettings.GameType.SPECTATOR) -- { -- return false; -- } -+ ItemStack stack = thisPlayerMP.func_184614_ca(); -+ if (stack != null && stack.getItem().onBlockStartBreak(stack, pos, thisPlayerMP)) return false; - -- if (!this.thisPlayerMP.isAllowEdit()) -- { -- ItemStack itemstack = this.thisPlayerMP.func_184614_ca(); -- -- if (itemstack == null) -- { -- return false; -- } -- -- if (!itemstack.canDestroy(iblockstate.getBlock())) -- { -- return false; -- } -- } -- } -- - this.theWorld.playAuxSFXAtEntity(this.thisPlayerMP, 2001, pos, Block.getStateId(iblockstate)); -- boolean flag1 = this.removeBlock(pos); -+ boolean flag1 = false; - - if (this.isCreative()) - { -+ flag1 = this.removeBlock(pos); - this.thisPlayerMP.playerNetServerHandler.sendPacket(new SPacketBlockChange(this.theWorld, pos)); - } - else - { - ItemStack itemstack1 = this.thisPlayerMP.func_184614_ca(); - ItemStack itemstack2 = itemstack1 == null ? null : itemstack1.copy(); -- boolean flag = this.thisPlayerMP.func_184823_b(iblockstate); -+ boolean flag = iblockstate.getBlock().canHarvestBlock(theWorld, pos, thisPlayerMP); - - if (itemstack1 != null) - { -@@ -310,12 +322,18 @@ - } - } - -+ flag1 = this.removeBlock(pos, flag); - if (flag1 && flag) - { - iblockstate.getBlock().harvestBlock(this.theWorld, this.thisPlayerMP, pos, iblockstate, tileentity, itemstack2); - } - } - -+ // Drop experience -+ if (!this.isCreative() && flag1 && exp > 0) -+ { -+ iblockstate.getBlock().dropXpOnBlockBreak(theWorld, pos, exp); -+ } - return flag1; - } - } -@@ -359,6 +377,7 @@ - if (itemstack.stackSize == 0) - { - p_187250_1_.func_184611_a(p_187250_4_, (ItemStack)null); -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_187250_1_, itemstack, p_187250_4_); - } - - if (!p_187250_1_.func_184587_cr()) -@@ -445,4 +464,13 @@ - { - this.theWorld = serverWorld; - } -+ -+ public double getBlockReachDistance() -+ { -+ return blockReachDistance; -+ } -+ public void setBlockReachDistance(double distance) -+ { -+ blockReachDistance = distance; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/server/management/PlayerList.java.patch b/patches.mcp/minecraft/net/minecraft/server/management/PlayerList.java.patch deleted file mode 100644 index 8ee09c07a..000000000 --- a/patches.mcp/minecraft/net/minecraft/server/management/PlayerList.java.patch +++ /dev/null @@ -1,229 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/management/PlayerList.java -+++ ../src-work/minecraft/net/minecraft/server/management/PlayerList.java -@@ -101,7 +101,7 @@ - this.maxPlayers = 8; - } - -- public void initializeConnectionToPlayer(NetworkManager netManager, EntityPlayerMP playerIn) -+ public void initializeConnectionToPlayer(NetworkManager netManager, EntityPlayerMP playerIn, NetHandlerPlayServer nethandlerplayserver) - { - GameProfile gameprofile = playerIn.getGameProfile(); - PlayerProfileCache playerprofilecache = this.mcServer.getPlayerProfileCache(); -@@ -110,6 +110,17 @@ - playerprofilecache.addEntry(gameprofile); - NBTTagCompound nbttagcompound = this.readPlayerDataFromFile(playerIn); - playerIn.setWorld(this.mcServer.worldServerForDimension(playerIn.dimension)); -+ -+ World playerWorld = this.mcServer.worldServerForDimension(playerIn.dimension); -+ if (playerWorld == null) -+ { -+ playerIn.dimension = 0; -+ playerWorld = this.mcServer.worldServerForDimension(0); -+ BlockPos spawnPoint = playerWorld.provider.getRandomizedSpawnPoint(); -+ playerIn.setPosition(spawnPoint.getX(), spawnPoint.getY(), spawnPoint.getZ()); -+ } -+ -+ playerIn.setWorld(playerWorld); - playerIn.theItemInWorldManager.setWorld((WorldServer)playerIn.worldObj); - String s1 = "local"; - -@@ -123,7 +134,7 @@ - WorldInfo worldinfo = worldserver.getWorldInfo(); - BlockPos blockpos = worldserver.getSpawnPoint(); - this.setPlayerGameTypeBasedOnOther(playerIn, (EntityPlayerMP)null, worldserver); -- NetHandlerPlayServer nethandlerplayserver = new NetHandlerPlayServer(this.mcServer, netManager, playerIn); -+ playerIn.playerNetServerHandler = nethandlerplayserver; - nethandlerplayserver.sendPacket(new SPacketJoinGame(playerIn.getEntityId(), playerIn.theItemInWorldManager.getGameType(), worldinfo.isHardcoreModeEnabled(), worldserver.provider.func_186058_p().func_186068_a(), worldserver.getDifficulty(), this.getMaxPlayers(), worldinfo.getTerrainType(), worldserver.getGameRules().getBoolean("reducedDebugInfo"))); - nethandlerplayserver.sendPacket(new SPacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(this.getServerInstance().getServerModName()))); - nethandlerplayserver.sendPacket(new SPacketServerDifficulty(worldinfo.getDifficulty(), worldinfo.isDifficultyLocked())); -@@ -213,6 +224,7 @@ - } - - playerIn.addSelfToInternalCraftingInventory(); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerLoggedIn(playerIn); - } - - protected void sendScoreboard(ServerScoreboard scoreboardIn, EntityPlayerMP playerIn) -@@ -302,6 +314,7 @@ - nbttagcompound1 = this.mcServer.func_184110_aI().func_188257_a(FixTypes.PLAYER, nbttagcompound); - playerIn.readFromNBT(nbttagcompound1); - logger.debug("loading single player"); -+ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(playerIn, this.playerNBTManagerObj, playerIn.getUniqueID().toString()); - } - else - { -@@ -311,8 +324,24 @@ - return nbttagcompound1; - } - -+ public NBTTagCompound getPlayerNBT(EntityPlayerMP player) -+ { -+ // Hacky method to allow loading the NBT for a player prior to login -+ NBTTagCompound nbttagcompound = this.mcServer.worldServers[0].getWorldInfo().getPlayerNBTTagCompound(); -+ if (player.getName().equals(this.mcServer.getServerOwner()) && nbttagcompound != null) -+ { -+ return nbttagcompound; -+ } -+ else -+ { -+ return ((net.minecraft.world.storage.SaveHandler)this.playerNBTManagerObj).getPlayerNBT(player); -+ } -+ } -+ - protected void writePlayerData(EntityPlayerMP playerIn) - { -+ if (playerIn.playerNetServerHandler == null) return; -+ - this.playerNBTManagerObj.writePlayerData(playerIn); - StatisticsFile statisticsfile = (StatisticsFile)this.playerStatFiles.get(playerIn.getUniqueID()); - -@@ -334,6 +363,7 @@ - playerIn.playerNetServerHandler.sendPacket(new SPacketPlayerListItem(SPacketPlayerListItem.Action.ADD_PLAYER, new EntityPlayerMP[] {(EntityPlayerMP)this.playerEntityList.get(i)})); - } - -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.getCurrentPlayerCount()); - worldserver.spawnEntityInWorld(playerIn); - this.preparePlayer(playerIn, (WorldServer)null); - } -@@ -345,6 +375,7 @@ - - public void playerLoggedOut(EntityPlayerMP playerIn) - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerLoggedOut(playerIn); - WorldServer worldserver = playerIn.getServerForPlayer(); - playerIn.triggerAchievement(StatList.leaveGameStat); - this.writePlayerData(playerIn); -@@ -379,6 +410,7 @@ - this.uuidToPlayerMap.remove(uuid); - this.playerStatFiles.remove(uuid); - } -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.getCurrentPlayerCount()); - - this.sendPacketToAllPlayers(new SPacketPlayerListItem(SPacketPlayerListItem.Action.REMOVE_PLAYER, new EntityPlayerMP[] {playerIn})); - } -@@ -462,13 +494,23 @@ - - public EntityPlayerMP recreatePlayerEntity(EntityPlayerMP playerIn, int dimension, boolean conqueredEnd) - { -+ World world = mcServer.worldServerForDimension(dimension); -+ if (world == null) -+ { -+ dimension = 0; -+ } -+ else if (!world.provider.canRespawnHere()) -+ { -+ dimension = world.provider.getRespawnDimension(playerIn); -+ } -+ - playerIn.getServerForPlayer().getEntityTracker().removePlayerFromTrackers(playerIn); - playerIn.getServerForPlayer().getEntityTracker().untrackEntity(playerIn); - playerIn.getServerForPlayer().func_184164_w().removePlayer(playerIn); - this.playerEntityList.remove(playerIn); - this.mcServer.worldServerForDimension(playerIn.dimension).removePlayerEntityDangerously(playerIn); -- BlockPos blockpos = playerIn.getBedLocation(); -- boolean flag = playerIn.isSpawnForced(); -+ BlockPos blockpos = playerIn.getBedLocation(dimension); -+ boolean flag = playerIn.isSpawnForced(dimension); - playerIn.dimension = dimension; - PlayerInteractionManager playerinteractionmanager; - -@@ -484,7 +526,8 @@ - EntityPlayerMP entityplayermp = new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(playerIn.dimension), playerIn.getGameProfile(), playerinteractionmanager); - entityplayermp.playerNetServerHandler = playerIn.playerNetServerHandler; - entityplayermp.clonePlayer(playerIn, conqueredEnd); -- entityplayermp.setEntityId(playerIn.getEntityId()); -+ entityplayermp.dimension = dimension; -+ entityplayermp.setEntityId(playerIn.getEntityId()); - entityplayermp.func_174817_o(playerIn); - entityplayermp.func_184819_a(playerIn.func_184591_cq()); - -@@ -531,6 +574,7 @@ - this.uuidToPlayerMap.put(entityplayermp.getUniqueID(), entityplayermp); - entityplayermp.addSelfToInternalCraftingInventory(); - entityplayermp.setHealth(entityplayermp.getHealth()); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerRespawnEvent(entityplayermp); - return entityplayermp; - } - -@@ -545,15 +589,20 @@ - - public void func_187242_a(EntityPlayerMP p_187242_1_, int p_187242_2_) - { -+ transferPlayerToDimension(p_187242_1_, p_187242_2_, mcServer.worldServerForDimension(p_187242_2_).getDefaultTeleporter()); -+ } -+ -+ public void transferPlayerToDimension(EntityPlayerMP p_187242_1_, int p_187242_2_, net.minecraft.world.Teleporter teleporter) -+ { - int i = p_187242_1_.dimension; - WorldServer worldserver = this.mcServer.worldServerForDimension(p_187242_1_.dimension); - p_187242_1_.dimension = p_187242_2_; - WorldServer worldserver1 = this.mcServer.worldServerForDimension(p_187242_1_.dimension); -- p_187242_1_.playerNetServerHandler.sendPacket(new SPacketRespawn(p_187242_1_.dimension, p_187242_1_.worldObj.getDifficulty(), p_187242_1_.worldObj.getWorldInfo().getTerrainType(), p_187242_1_.theItemInWorldManager.getGameType())); -+ p_187242_1_.playerNetServerHandler.sendPacket(new SPacketRespawn(p_187242_1_.dimension, worldserver1.getDifficulty(), worldserver1.getWorldInfo().getTerrainType(), p_187242_1_.theItemInWorldManager.getGameType())); - this.func_187243_f(p_187242_1_); - worldserver.removePlayerEntityDangerously(p_187242_1_); - p_187242_1_.isDead = false; -- this.transferEntityToWorld(p_187242_1_, i, worldserver, worldserver1); -+ this.transferEntityToWorld(p_187242_1_, i, worldserver, worldserver1, teleporter); - this.preparePlayer(p_187242_1_, worldserver); - p_187242_1_.playerNetServerHandler.setPlayerLocation(p_187242_1_.posX, p_187242_1_.posY, p_187242_1_.posZ, p_187242_1_.rotationYaw, p_187242_1_.rotationPitch); - p_187242_1_.theItemInWorldManager.setWorld(worldserver1); -@@ -565,17 +614,27 @@ - { - p_187242_1_.playerNetServerHandler.sendPacket(new SPacketEntityEffect(p_187242_1_.getEntityId(), potioneffect)); - } -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerChangedDimensionEvent(p_187242_1_, i, p_187242_2_); - } - - public void transferEntityToWorld(Entity entityIn, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_) - { -- double d0 = entityIn.posX; -- double d1 = entityIn.posZ; -+ transferEntityToWorld(entityIn, p_82448_2_, p_82448_3_, p_82448_4_, p_82448_4_.getDefaultTeleporter()); -+ } -+ -+ @SuppressWarnings("unused") -+ public void transferEntityToWorld(Entity entityIn, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_, net.minecraft.world.Teleporter teleporter) -+ { -+ net.minecraft.world.WorldProvider pOld = p_82448_3_.provider; -+ net.minecraft.world.WorldProvider pNew = p_82448_4_.provider; -+ double moveFactor = pOld.getMovementFactor() / pNew.getMovementFactor(); -+ double d0 = entityIn.posX * moveFactor; -+ double d1 = entityIn.posZ * moveFactor; - double d2 = 8.0D; - float f = entityIn.rotationYaw; - p_82448_3_.theProfiler.startSection("moving"); - -- if (entityIn.dimension == -1) -+ if (false && entityIn.dimension == -1) - { - d0 = MathHelper.clamp_double(d0 / d2, p_82448_4_.getWorldBorder().minX() + 16.0D, p_82448_4_.getWorldBorder().maxX() - 16.0D); - d1 = MathHelper.clamp_double(d1 / d2, p_82448_4_.getWorldBorder().minZ() + 16.0D, p_82448_4_.getWorldBorder().maxZ() - 16.0D); -@@ -586,7 +645,7 @@ - p_82448_3_.updateEntityWithOptionalForce(entityIn, false); - } - } -- else if (entityIn.dimension == 0) -+ else if (false && entityIn.dimension == 0) - { - d0 = MathHelper.clamp_double(d0 * d2, p_82448_4_.getWorldBorder().minX() + 16.0D, p_82448_4_.getWorldBorder().maxX() - 16.0D); - d1 = MathHelper.clamp_double(d1 * d2, p_82448_4_.getWorldBorder().minZ() + 16.0D, p_82448_4_.getWorldBorder().maxZ() - 16.0D); -@@ -597,7 +656,8 @@ - p_82448_3_.updateEntityWithOptionalForce(entityIn, false); - } - } -- else -+ -+ if (entityIn.dimension == 1) - { - BlockPos blockpos; - -@@ -632,7 +692,7 @@ - if (entityIn.isEntityAlive()) - { - entityIn.setLocationAndAngles(d0, entityIn.posY, d1, entityIn.rotationYaw, entityIn.rotationPitch); -- p_82448_4_.getDefaultTeleporter().placeInPortal(entityIn, f); -+ teleporter.placeInPortal(entityIn, f); - p_82448_4_.spawnEntityInWorld(entityIn); - p_82448_4_.updateEntityWithOptionalForce(entityIn, false); - } diff --git a/patches.mcp/minecraft/net/minecraft/server/management/PlayerManager.java.patch b/patches.mcp/minecraft/net/minecraft/server/management/PlayerManager.java.patch deleted file mode 100644 index a4e954195..000000000 --- a/patches.mcp/minecraft/net/minecraft/server/management/PlayerManager.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/management/PlayerManager.java -+++ ../src-work/minecraft/net/minecraft/server/management/PlayerManager.java -@@ -338,6 +338,7 @@ - int i1 = this.playerViewRadius; - int j1 = i - k; - int k1 = j - l; -+ List chunksToLoad = Lists.newArrayList(); - - if (j1 != 0 || k1 != 0) - { diff --git a/patches.mcp/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch b/patches.mcp/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch deleted file mode 100644 index 6c4b46942..000000000 --- a/patches.mcp/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java -+++ ../src-work/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java -@@ -22,6 +22,8 @@ - - public void processHandshake(C00Handshake packetIn) - { -+ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerHandshake(packetIn, this.networkManager)) return; -+ - switch (packetIn.getRequestedState()) - { - case LOGIN: diff --git a/patches.mcp/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch b/patches.mcp/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch deleted file mode 100644 index eab396c8e..000000000 --- a/patches.mcp/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java -+++ ../src-work/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java -@@ -66,7 +66,7 @@ - if (entityplayermp == null) - { - this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT; -- this.server.func_184103_al().initializeConnectionToPlayer(this.networkManager, this.field_181025_l); -+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlServerHandshake(this.server.func_184103_al(), this.networkManager, this.field_181025_l); - this.field_181025_l = null; - } - } -@@ -130,7 +130,7 @@ - } - else - { -- this.server.func_184103_al().initializeConnectionToPlayer(this.networkManager, this.server.func_184103_al().createPlayerForUser(this.loginGameProfile)); -+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlServerHandshake(this.server.func_184103_al(), this.networkManager, this.server.func_184103_al().createPlayerForUser(this.loginGameProfile)); - } - } - } diff --git a/patches.mcp/minecraft/net/minecraft/stats/StatList.java.patch b/patches.mcp/minecraft/net/minecraft/stats/StatList.java.patch deleted file mode 100644 index e925f22b9..000000000 --- a/patches.mcp/minecraft/net/minecraft/stats/StatList.java.patch +++ /dev/null @@ -1,101 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/stats/StatList.java -+++ ../src-work/minecraft/net/minecraft/stats/StatList.java -@@ -155,7 +155,7 @@ - } - } - -- replaceAllSimilarBlocks(field_188066_af); -+ replaceAllSimilarBlocks(field_188066_af, true); - } - - private static void initMiningStats() -@@ -177,7 +177,7 @@ - } - } - -- replaceAllSimilarBlocks(field_188065_ae); -+ replaceAllSimilarBlocks(field_188065_ae, false); - } - - private static void initStats() -@@ -201,7 +201,7 @@ - } - } - -- replaceAllSimilarBlocks(objectUseStats); -+ replaceAllSimilarBlocks(objectUseStats, true); - } - - private static void initItemDepleteStats() -@@ -220,7 +220,7 @@ - } - } - -- replaceAllSimilarBlocks(objectBreakStats); -+ replaceAllSimilarBlocks(objectBreakStats, true); - } - - private static void func_188054_f() -@@ -240,7 +240,7 @@ - } - } - -- replaceAllSimilarBlocks(objectBreakStats); -+ replaceAllSimilarBlocks(objectBreakStats, true); - } - - private static String func_180204_a(Item p_180204_0_) -@@ -249,28 +249,35 @@ - return resourcelocation != null ? resourcelocation.toString().replace(':', '.') : null; - } - -- private static void replaceAllSimilarBlocks(StatBase[] p_75924_0_) -+ private static void replaceAllSimilarBlocks(StatBase[] p_75924_0_, boolean useItemIds) - { -- mergeStatBases(p_75924_0_, Blocks.water, Blocks.flowing_water); -- mergeStatBases(p_75924_0_, Blocks.lava, Blocks.flowing_lava); -- mergeStatBases(p_75924_0_, Blocks.lit_pumpkin, Blocks.pumpkin); -- mergeStatBases(p_75924_0_, Blocks.lit_furnace, Blocks.furnace); -- mergeStatBases(p_75924_0_, Blocks.lit_redstone_ore, Blocks.redstone_ore); -- mergeStatBases(p_75924_0_, Blocks.powered_repeater, Blocks.unpowered_repeater); -- mergeStatBases(p_75924_0_, Blocks.powered_comparator, Blocks.unpowered_comparator); -- mergeStatBases(p_75924_0_, Blocks.redstone_torch, Blocks.unlit_redstone_torch); -- mergeStatBases(p_75924_0_, Blocks.lit_redstone_lamp, Blocks.redstone_lamp); -- mergeStatBases(p_75924_0_, Blocks.double_stone_slab, Blocks.stone_slab); -- mergeStatBases(p_75924_0_, Blocks.double_wooden_slab, Blocks.wooden_slab); -- mergeStatBases(p_75924_0_, Blocks.double_stone_slab2, Blocks.stone_slab2); -- mergeStatBases(p_75924_0_, Blocks.grass, Blocks.dirt); -- mergeStatBases(p_75924_0_, Blocks.farmland, Blocks.dirt); -+ mergeStatBases(p_75924_0_, Blocks.water, Blocks.flowing_water, useItemIds); -+ mergeStatBases(p_75924_0_, Blocks.lava, Blocks.flowing_lava, useItemIds); -+ mergeStatBases(p_75924_0_, Blocks.lit_pumpkin, Blocks.pumpkin, useItemIds); -+ mergeStatBases(p_75924_0_, Blocks.lit_furnace, Blocks.furnace, useItemIds); -+ mergeStatBases(p_75924_0_, Blocks.lit_redstone_ore, Blocks.redstone_ore, useItemIds); -+ mergeStatBases(p_75924_0_, Blocks.powered_repeater, Blocks.unpowered_repeater, useItemIds); -+ mergeStatBases(p_75924_0_, Blocks.powered_comparator, Blocks.unpowered_comparator, useItemIds); -+ mergeStatBases(p_75924_0_, Blocks.redstone_torch, Blocks.unlit_redstone_torch, useItemIds); -+ mergeStatBases(p_75924_0_, Blocks.lit_redstone_lamp, Blocks.redstone_lamp, useItemIds); -+ mergeStatBases(p_75924_0_, Blocks.double_stone_slab, Blocks.stone_slab, useItemIds); -+ mergeStatBases(p_75924_0_, Blocks.double_wooden_slab, Blocks.wooden_slab, useItemIds); -+ mergeStatBases(p_75924_0_, Blocks.double_stone_slab2, Blocks.stone_slab2, useItemIds); -+ mergeStatBases(p_75924_0_, Blocks.grass, Blocks.dirt, useItemIds); -+ mergeStatBases(p_75924_0_, Blocks.farmland, Blocks.dirt, useItemIds); - } - -- private static void mergeStatBases(StatBase[] statBaseIn, Block p_151180_1_, Block p_151180_2_) -+ private static void mergeStatBases(StatBase[] statBaseIn, Block p_151180_1_, Block p_151180_2_, boolean useItemIds) - { -- int i = Block.getIdFromBlock(p_151180_1_); -- int j = Block.getIdFromBlock(p_151180_2_); -+ int i; -+ int j; -+ if (useItemIds) { -+ i = Item.getIdFromItem(Item.getItemFromBlock(p_151180_1_)); -+ j = Item.getIdFromItem(Item.getItemFromBlock(p_151180_2_)); -+ } else { -+ i = Block.getIdFromBlock(p_151180_1_); -+ j = Block.getIdFromBlock(p_151180_2_); -+ } - - if (statBaseIn[i] != null && statBaseIn[j] == null) - { diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntity.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntity.java.patch deleted file mode 100644 index 2f9115e8d..000000000 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntity.java.patch +++ /dev/null @@ -1,256 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntity.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntity.java -@@ -18,7 +18,7 @@ - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - --public abstract class TileEntity -+public abstract class TileEntity implements net.minecraftforge.common.capabilities.ICapabilitySerializable - { - private static final Logger logger = LogManager.getLogger(); - private static Map < String, Class > nameToClassMap = Maps. < String, Class > newHashMap(); -@@ -60,6 +60,8 @@ - public void readFromNBT(NBTTagCompound compound) - { - this.pos = new BlockPos(compound.getInteger("x"), compound.getInteger("y"), compound.getInteger("z")); -+ if (compound.hasKey("ForgeData")) this.customTileData = compound.getCompoundTag("ForgeData"); -+ if (this.capabilities != null && compound.hasKey("ForgeCaps")) this.capabilities.deserializeNBT(compound.getCompoundTag("ForgeCaps")); - } - - public void writeToNBT(NBTTagCompound compound) -@@ -76,6 +78,8 @@ - compound.setInteger("x", this.pos.getX()); - compound.setInteger("y", this.pos.getY()); - compound.setInteger("z", this.pos.getZ()); -+ if (this.customTileData != null) compound.setTag("ForgeData", this.customTileData); -+ if (this.capabilities != null) compound.setTag("ForgeCaps", this.capabilities.serializeNBT()); - } - } - -@@ -83,10 +87,11 @@ - { - TileEntity tileentity = null; - String s = p_184246_1_.getString("id"); -+ Class oclass = null; - - try - { -- Class oclass = (Class)nameToClassMap.get(s); -+ oclass = (Class)nameToClassMap.get(s); - - if (oclass != null) - { -@@ -96,6 +101,9 @@ - catch (Throwable throwable1) - { - logger.error("Failed to create block entity " + s, throwable1); -+ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, throwable1, -+ "A TileEntity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author", -+ s, oclass.getName()); - } - - if (tileentity != null) -@@ -107,6 +115,9 @@ - catch (Throwable throwable) - { - logger.error("Failed to load data for block entity " + s, throwable); -+ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, throwable, -+ "A TileEntity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author", -+ s, oclass.getName()); - tileentity = null; - } - } -@@ -144,7 +155,6 @@ - } - } - -- @SideOnly(Side.CLIENT) - public double getDistanceSq(double x, double y, double z) - { - double d0 = (double)this.pos.getX() + 0.5D - x; -@@ -271,6 +281,185 @@ - return false; - } - -+ // -- BEGIN FORGE PATCHES -- -+ /** -+ * Called when you receive a TileEntityData packet for the location this -+ * TileEntity is currently in. On the client, the NetworkManager will always -+ * be the remote server. On the server, it will be whomever is responsible for -+ * sending the packet. -+ * -+ * @param net The NetworkManager the packet originated from -+ * @param pkt The data packet -+ */ -+ public void onDataPacket(net.minecraft.network.NetworkManager net, net.minecraft.network.play.server.SPacketUpdateTileEntity pkt) -+ { -+ } -+ -+ /** -+ * Called when the chunk this TileEntity is on is Unloaded. -+ */ -+ public void onChunkUnload() -+ { -+ } -+ -+ private boolean isVanilla = getClass().getName().startsWith("net.minecraft."); -+ /** -+ * Called from Chunk.setBlockIDWithMetadata and Chunk.fillChunk, determines if this tile entity should be re-created when the ID, or Metadata changes. -+ * Use with caution as this will leave straggler TileEntities, or create conflicts with other TileEntities if not used properly. -+ * -+ * @param world Current world -+ * @param pos Tile's world position -+ * @param oldState The old ID of the block -+ * @param newState The new ID of the block (May be the same) -+ * @return true forcing the invalidation of the existing TE, false not to invalidate the existing TE -+ */ -+ public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newSate) -+ { -+ return isVanilla ? (oldState.getBlock() != newSate.getBlock()) : oldState != newSate; -+ } -+ -+ public boolean shouldRenderInPass(int pass) -+ { -+ return pass == 0; -+ } -+ -+ /** -+ * Sometimes default render bounding box: infinite in scope. Used to control rendering on {@link TileEntitySpecialRenderer}. -+ */ -+ public static final net.minecraft.util.math.AxisAlignedBB INFINITE_EXTENT_AABB = new net.minecraft.util.math.AxisAlignedBB(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY); -+ /** -+ * Return an {@link AxisAlignedBB} that controls the visible scope of a {@link TileEntitySpecialRenderer} associated with this {@link TileEntity} -+ * Defaults to the collision bounding box {@link Block#getCollisionBoundingBoxFromPool(World, int, int, int)} associated with the block -+ * at this location. -+ * -+ * @return an appropriately size {@link AxisAlignedBB} for the {@link TileEntity} -+ */ -+ @SideOnly(Side.CLIENT) -+ public net.minecraft.util.math.AxisAlignedBB getRenderBoundingBox() -+ { -+ net.minecraft.util.math.AxisAlignedBB bb = INFINITE_EXTENT_AABB; -+ Block type = getBlockType(); -+ if (type == Blocks.enchanting_table) -+ { -+ bb = new net.minecraft.util.math.AxisAlignedBB(getPos(), getPos().add(1, 1, 1)); -+ } -+ else if (type == Blocks.chest || type == Blocks.trapped_chest) -+ { -+ bb = new net.minecraft.util.math.AxisAlignedBB(getPos().add(-1, 0, -1), getPos().add(2, 2, 2)); -+ } -+ else if (type != null && type != Blocks.beacon) -+ { -+ net.minecraft.util.math.AxisAlignedBB cbb = null; -+ try -+ { -+ cbb = worldObj.getBlockState(getPos()).func_185890_d(worldObj, getPos()); -+ } -+ catch (Exception e) -+ { -+ // We have to capture any exceptions that may occur here because BUKKIT servers like to send -+ // the tile entity data BEFORE the chunk data, you know, the OPPOSITE of what vanilla does! -+ // So we can not GARENTEE that the world state is the real state for the block... -+ // So, once again in the long line of US having to accommodate BUKKIT breaking things, -+ // here it is, assume that the TE is only 1 cubic block. Problem with this is that it may -+ // cause the TileEntity renderer to error further down the line! But alas, nothing we can do. -+ cbb = new net.minecraft.util.math.AxisAlignedBB(getPos().add(-1, 0, -1), getPos().add(1, 1, 1)); -+ } -+ if (cbb != null) bb = cbb; -+ } -+ return bb; -+ } -+ -+ /** -+ * Checks if this tile entity knows how to render its 'breaking' overlay effect. -+ * If this returns true, The TileEntitySpecialRenderer will be called again with break progress set. -+ * @return True to re-render tile with breaking effect. -+ */ -+ public boolean canRenderBreaking() -+ { -+ Block block = this.getBlockType(); -+ return (block instanceof net.minecraft.block.BlockChest || -+ block instanceof net.minecraft.block.BlockEnderChest || -+ block instanceof net.minecraft.block.BlockSign || -+ block instanceof net.minecraft.block.BlockSkull); -+ } -+ -+ private NBTTagCompound customTileData; -+ -+ /** -+ * Gets a {@link NBTTagCompound} that can be used to store custom data for this tile entity. -+ * It will be written, and read from disc, so it persists over world saves. -+ * -+ * @return A compound tag for custom data -+ */ -+ public NBTTagCompound getTileData() -+ { -+ if (this.customTileData == null) -+ { -+ this.customTileData = new NBTTagCompound(); -+ } -+ return this.customTileData; -+ } -+ -+ /** -+ * Determines if the player can overwrite the NBT data of this tile entity while they place it using a ItemStack. -+ * Added as a fix for MC-75630 - Exploit with signs and command blocks -+ * @return True to prevent NBT copy, false to allow. -+ */ -+ public boolean restrictNBTCopy() -+ { -+ return this instanceof TileEntityCommandBlock || -+ this instanceof TileEntityMobSpawner || -+ this instanceof TileEntitySign; -+ } -+ -+ -+ /** -+ * Called from the Chunk when this is first added to the world. Override instead of adding -+ * if (firstTick) stuff in update. Happens after validate and after it has been placed into the Chunk tileEntity -+ * map. -+ */ -+ public void onLoad() -+ { -+ // NOOP -+ } -+ -+ /** -+ * If the TileEntitySpecialRenderer associated with this TileEntity can be batched in with another renderers, and won't access the GL state. -+ * If TileEntity returns true, then TESR should have the same functionality as (and probably extend) the FastTESR class. -+ */ -+ public boolean hasFastRenderer() -+ { -+ return false; -+ } -+ -+ private net.minecraftforge.common.capabilities.CapabilityDispatcher capabilities; -+ public TileEntity() -+ { -+ capabilities = net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(this); -+ } -+ -+ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) -+ { -+ return capabilities == null ? false : capabilities.hasCapability(capability, facing); -+ } -+ -+ public T getCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) -+ { -+ return capabilities == null ? null : capabilities.getCapability(capability, facing); -+ } -+ -+ public void deserializeNBT(NBTTagCompound nbt) -+ { -+ this.readFromNBT(nbt); -+ } -+ -+ public NBTTagCompound serializeNBT() -+ { -+ NBTTagCompound ret = new NBTTagCompound(); -+ this.writeToNBT(ret); -+ return ret; -+ } -+ - static - { - addMapping(TileEntityFurnace.class, "Furnace"); diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch deleted file mode 100644 index 9323da9f2..000000000 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntityBeacon.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityBeacon.java -@@ -179,7 +179,7 @@ - { - Block block = this.worldObj.getBlockState(new BlockPos(j1, i2, k1)).getBlock(); - -- if (block != Blocks.emerald_block && block != Blocks.gold_block && block != Blocks.diamond_block && block != Blocks.iron_block) -+ if (!block.isBeaconBase(this.worldObj, new BlockPos(j1, i2, k1), getPos())) - { - flag1 = false; - break; -@@ -371,7 +371,7 @@ - - public boolean isItemValidForSlot(int index, ItemStack stack) - { -- return stack.getItem() == Items.emerald || stack.getItem() == Items.diamond || stack.getItem() == Items.gold_ingot || stack.getItem() == Items.iron_ingot; -+ return stack.getItem() != null && stack.getItem().isBeaconPayment(stack); - } - - public String getGuiID() diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch deleted file mode 100644 index b70efb228..000000000 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch +++ /dev/null @@ -1,86 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java -@@ -140,7 +140,7 @@ - - private boolean canBrew() - { -- if (this.brewingItemStacks[3] != null && this.brewingItemStacks[3].stackSize > 0) -+ if (this.brewingItemStacks[3] != null && this.brewingItemStacks[3].stackSize > 0 && false) // Code moved to net.minecraftforge.common.brewing.VanillaBrewingRecipe - { - ItemStack itemstack = this.brewingItemStacks[3]; - -@@ -165,25 +165,23 @@ - } - else - { -- return false; -+ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.canBrew(brewingItemStacks, brewingItemStacks[3], outputSlots); - } - } - - private void brewPotions() - { -+ if (net.minecraftforge.event.ForgeEventFactory.onPotionAttemptBreaw(brewingItemStacks)) return; - ItemStack itemstack = this.brewingItemStacks[3]; - -- for (int i = 0; i < 3; ++i) -- { -- this.brewingItemStacks[i] = PotionHelper.func_185212_d(itemstack, this.brewingItemStacks[i]); -- } -+ net.minecraftforge.common.brewing.BrewingRecipeRegistry.brewPotions(brewingItemStacks, brewingItemStacks[3], outputSlots); - - --itemstack.stackSize; - BlockPos blockpos = this.getPos(); - -- if (itemstack.getItem().hasContainerItem()) -+ if (itemstack.getItem().hasContainerItem(itemstack)) - { -- ItemStack itemstack1 = new ItemStack(itemstack.getItem().getContainerItem()); -+ ItemStack itemstack1 = itemstack.getItem().getContainerItem(itemstack); - - if (itemstack.stackSize <= 0) - { -@@ -202,6 +200,7 @@ - - this.brewingItemStacks[3] = itemstack; - this.worldObj.playAuxSFX(1035, blockpos, 0); -+ net.minecraftforge.event.ForgeEventFactory.onPotionBrewed(brewingItemStacks); - } - - public void readFromNBT(NBTTagCompound compound) -@@ -303,12 +302,12 @@ - { - if (index == 3) - { -- return PotionHelper.func_185205_a(stack); -+ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(stack); - } - else - { - Item item = stack.getItem(); -- return index == 4 ? item == Items.blaze_powder : item == Items.potionitem || item == Items.field_185155_bH || item == Items.field_185156_bI || item == Items.glass_bottle; -+ return index == 4 ? item == Items.blaze_powder : net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(stack); - } - } - -@@ -362,6 +361,20 @@ - } - } - -+ net.minecraftforge.items.IItemHandler handlerInput = new net.minecraftforge.items.wrapper.SidedInvWrapper(this, net.minecraft.util.EnumFacing.UP); -+ net.minecraftforge.items.IItemHandler handlerOutput = new net.minecraftforge.items.wrapper.SidedInvWrapper(this, net.minecraft.util.EnumFacing.DOWN); -+ -+ @Override -+ public T getCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) -+ { -+ if (facing != null && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) -+ if (facing == EnumFacing.UP) -+ return (T) handlerInput; -+ else -+ return (T) handlerOutput; -+ return super.getCapability(capability, facing); -+ } -+ - public int getFieldCount() - { - return 2; diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityChest.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityChest.java.patch deleted file mode 100644 index 7fb580f30..000000000 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityChest.java.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntityChest.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityChest.java -@@ -171,6 +171,7 @@ - { - super.updateContainingBlockInfo(); - this.adjacentChestChecked = false; -+ doubleChestHandler = null; - } - - @SuppressWarnings("incomplete-switch") -@@ -457,6 +458,26 @@ - } - } - -+ public net.minecraftforge.items.VanillaDoubleChestItemHandler doubleChestHandler; -+ -+ @Override -+ public T getCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) -+ { -+ if (capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) -+ { -+ if(doubleChestHandler == null || doubleChestHandler.needsRefresh()) -+ doubleChestHandler = net.minecraftforge.items.VanillaDoubleChestItemHandler.get(this); -+ if (doubleChestHandler != null && doubleChestHandler != net.minecraftforge.items.VanillaDoubleChestItemHandler.NO_ADJACENT_CHESTS_INSTANCE) -+ return (T) doubleChestHandler; -+ } -+ return super.getCapability(capability, facing); -+ } -+ -+ public net.minecraftforge.items.IItemHandler getSingleChestHandler() -+ { -+ return super.getCapability(net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); -+ } -+ - public void func_184287_a(ResourceLocation p_184287_1_, long p_184287_2_) - { - this.field_184284_m = p_184287_1_; diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch deleted file mode 100644 index 32746de74..000000000 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch +++ /dev/null @@ -1,99 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntityFurnace.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityFurnace.java -@@ -110,9 +110,9 @@ - } - } - -- this.furnaceBurnTime = compound.getShort("BurnTime"); -- this.cookTime = compound.getShort("CookTime"); -- this.totalCookTime = compound.getShort("CookTimeTotal"); -+ this.furnaceBurnTime = compound.getInteger("BurnTime"); -+ this.cookTime = compound.getInteger("CookTime"); -+ this.totalCookTime = compound.getInteger("CookTimeTotal"); - this.currentItemBurnTime = getItemBurnTime(this.furnaceItemStacks[1]); - - if (compound.hasKey("CustomName", 8)) -@@ -124,9 +124,9 @@ - public void writeToNBT(NBTTagCompound compound) - { - super.writeToNBT(compound); -- compound.setShort("BurnTime", (short)this.furnaceBurnTime); -- compound.setShort("CookTime", (short)this.cookTime); -- compound.setShort("CookTimeTotal", (short)this.totalCookTime); -+ compound.setInteger("BurnTime", this.furnaceBurnTime); -+ compound.setInteger("CookTime", this.cookTime); -+ compound.setInteger("CookTimeTotal", this.totalCookTime); - NBTTagList nbttaglist = new NBTTagList(); - - for (int i = 0; i < this.furnaceItemStacks.length; ++i) -@@ -192,8 +192,7 @@ - - if (this.furnaceItemStacks[1].stackSize == 0) - { -- Item item = this.furnaceItemStacks[1].getItem().getContainerItem(); -- this.furnaceItemStacks[1] = item != null ? new ItemStack(item) : null; -+ this.furnaceItemStacks[1] = furnaceItemStacks[1].getItem().getContainerItem(furnaceItemStacks[1]); - } - } - } -@@ -248,7 +247,11 @@ - else - { - ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(this.furnaceItemStacks[0]); -- return itemstack == null ? false : (this.furnaceItemStacks[2] == null ? true : (!this.furnaceItemStacks[2].isItemEqual(itemstack) ? false : (this.furnaceItemStacks[2].stackSize < this.getInventoryStackLimit() && this.furnaceItemStacks[2].stackSize < this.furnaceItemStacks[2].getMaxStackSize() ? true : this.furnaceItemStacks[2].stackSize < itemstack.getMaxStackSize()))); -+ if (itemstack == null) return false; -+ if (this.furnaceItemStacks[2] == null) return true; -+ if (!this.furnaceItemStacks[2].isItemEqual(itemstack)) return false; -+ int result = furnaceItemStacks[2].stackSize + itemstack.stackSize; -+ return result <= getInventoryStackLimit() && result <= this.furnaceItemStacks[2].getMaxStackSize(); //Forge BugFix: Make it respect stack sizes properly. - } - } - -@@ -264,7 +267,7 @@ - } - else if (this.furnaceItemStacks[2].getItem() == itemstack.getItem()) - { -- ++this.furnaceItemStacks[2].stackSize; -+ this.furnaceItemStacks[2].stackSize += itemstack.stackSize; // Forge BugFix: Results may have multiple items - } - - if (this.furnaceItemStacks[0].getItem() == Item.getItemFromBlock(Blocks.sponge) && this.furnaceItemStacks[0].getMetadata() == 1 && this.furnaceItemStacks[1] != null && this.furnaceItemStacks[1].getItem() == Items.bucket) -@@ -311,7 +314,15 @@ - } - } - -- return item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD") ? 200 : (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD") ? 200 : (item instanceof ItemHoe && ((ItemHoe)item).getMaterialName().equals("WOOD") ? 200 : (item == Items.stick ? 100 : (item == Items.coal ? 1600 : (item == Items.lava_bucket ? 20000 : (item == Item.getItemFromBlock(Blocks.sapling) ? 100 : (item == Items.blaze_rod ? 2400 : 0))))))); -+ if (item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD")) return 200; -+ if (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD")) return 200; -+ if (item instanceof ItemHoe && ((ItemHoe)item).getMaterialName().equals("WOOD")) return 200; -+ if (item == Items.stick) return 100; -+ if (item == Items.coal) return 1600; -+ if (item == Items.lava_bucket) return 20000; -+ if (item == Item.getItemFromBlock(Blocks.sapling)) return 100; -+ if (item == Items.blaze_rod) return 2400; -+ return net.minecraftforge.fml.common.registry.GameRegistry.getFuelValue(p_145952_0_); - } - } - -@@ -432,4 +443,21 @@ - this.furnaceItemStacks[i] = null; - } - } -+ -+ net.minecraftforge.items.IItemHandler handlerTop = new net.minecraftforge.items.wrapper.SidedInvWrapper(this, net.minecraft.util.EnumFacing.UP); -+ net.minecraftforge.items.IItemHandler handlerBottom = new net.minecraftforge.items.wrapper.SidedInvWrapper(this, net.minecraft.util.EnumFacing.DOWN); -+ net.minecraftforge.items.IItemHandler handlerSide = new net.minecraftforge.items.wrapper.SidedInvWrapper(this, net.minecraft.util.EnumFacing.WEST); -+ -+ @Override -+ public T getCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) -+ { -+ if (facing != null && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) -+ if (facing == EnumFacing.DOWN) -+ return (T) handlerBottom; -+ else if (facing == EnumFacing.UP) -+ return (T) handlerTop; -+ else -+ return (T) handlerSide; -+ return super.getCapability(capability, facing); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch deleted file mode 100644 index 2b856f03d..000000000 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch +++ /dev/null @@ -1,62 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntityHopper.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityHopper.java -@@ -237,6 +237,7 @@ - - private boolean transferItemsOut() - { -+ if (net.minecraftforge.items.VanillaInventoryCodeHooks.insertHook(this)) { return true; } - IInventory iinventory = this.getInventoryForHopperTransfer(); - - if (iinventory == null) -@@ -343,6 +344,7 @@ - - public static boolean captureDroppedItems(IHopper p_145891_0_) - { -+ if (net.minecraftforge.items.VanillaInventoryCodeHooks.extractHook(p_145891_0_)) { return true; } - IInventory iinventory = getHopperInventory(p_145891_0_); - - if (iinventory != null) -@@ -492,17 +494,31 @@ - - if (itemstack == null) - { -+ //Forge: BUGFIX: Again, make things respect max stack sizes. -+ int max = Math.min(stack.getMaxStackSize(), inventoryIn.getInventoryStackLimit()); -+ if (max >= stack.stackSize) -+ { - inventoryIn.setInventorySlotContents(index, stack); - stack = null; -+ } -+ else -+ { -+ inventoryIn.setInventorySlotContents(index, stack.splitStack(max)); -+ } - flag = true; - } - else if (canCombine(itemstack, stack)) - { -- int i = stack.getMaxStackSize() - itemstack.stackSize; -+ //Forge: BUGFIX: Again, make things respect max stack sizes. -+ int max = Math.min(stack.getMaxStackSize(), inventoryIn.getInventoryStackLimit()); -+ if (max > itemstack.stackSize) -+ { -+ int i = max - itemstack.stackSize; - int j = Math.min(stack.stackSize, i); - stack.stackSize -= j; - itemstack.stackSize += j; - flag = j > 0; -+ } - } - - if (flag) -@@ -648,4 +664,10 @@ - this.inventory[i] = null; - } - } -+ -+ -+ protected net.minecraftforge.items.IItemHandler createUnSidedHandler() -+ { -+ return new net.minecraftforge.items.VanillaHopperItemHandler(this); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityLockable.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityLockable.java.patch deleted file mode 100644 index 1c12efd06..000000000 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityLockable.java.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntityLockable.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityLockable.java -@@ -47,4 +47,25 @@ - { - return (ITextComponent)(this.hasCustomName() ? new TextComponentString(this.getName()) : new TextComponentTranslation(this.getName(), new Object[0])); - } -+ -+ private net.minecraftforge.items.IItemHandler itemHandler; -+ -+ protected net.minecraftforge.items.IItemHandler createUnSidedHandler() -+ { -+ return new net.minecraftforge.items.wrapper.InvWrapper(this); -+ } -+ -+ @Override -+ public T getCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) -+ { -+ if (capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) -+ return (T) (itemHandler == null ? (itemHandler = createUnSidedHandler()) : itemHandler); -+ return super.getCapability(capability, facing); -+ } -+ -+ @Override -+ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing) -+ { -+ return capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch deleted file mode 100644 index b1c9e4aa4..000000000 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntityNote.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityNote.java -@@ -29,7 +29,9 @@ - - public void changePitch() - { -+ byte old = note; - this.note = (byte)((this.note + 1) % 25); -+ if (!net.minecraftforge.common.ForgeHooks.onNoteChange(this, old)) return; - this.markDirty(); - } - diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch deleted file mode 100644 index d57143640..000000000 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntityPiston.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityPiston.java -@@ -201,7 +201,8 @@ - if (this.worldObj.getBlockState(this.pos).getBlock() == Blocks.piston_extension) - { - this.worldObj.setBlockState(this.pos, this.pistonState, 3); -- this.worldObj.notifyBlockOfStateChange(this.pos, this.pistonState.getBlock()); -+ if(!net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(worldObj, pos, worldObj.getBlockState(pos), java.util.EnumSet.noneOf(EnumFacing.class)).isCanceled()) -+ this.worldObj.notifyBlockOfStateChange(this.pos, this.pistonState.getBlock()); - } - } - } -@@ -219,7 +220,8 @@ - if (this.worldObj.getBlockState(this.pos).getBlock() == Blocks.piston_extension) - { - this.worldObj.setBlockState(this.pos, this.pistonState, 3); -- this.worldObj.notifyBlockOfStateChange(this.pos, this.pistonState.getBlock()); -+ if(!net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(worldObj, pos, worldObj.getBlockState(pos), java.util.EnumSet.noneOf(EnumFacing.class)).isCanceled()) -+ this.worldObj.notifyBlockOfStateChange(this.pos, this.pistonState.getBlock()); - } - } - else diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch deleted file mode 100644 index 4c4f169df..000000000 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntitySign.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntitySign.java -@@ -60,7 +60,7 @@ - } - public boolean canCommandSenderUseCommand(int permLevel, String commandName) - { -- return true; -+ return permLevel <= 2; //Forge: Fixes MC-75630 - Exploit with signs and command blocks - } - public BlockPos getPosition() - { diff --git a/patches.mcp/minecraft/net/minecraft/util/ActionResult.java.patch b/patches.mcp/minecraft/net/minecraft/util/ActionResult.java.patch deleted file mode 100644 index 28c5a82cf..000000000 --- a/patches.mcp/minecraft/net/minecraft/util/ActionResult.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/ActionResult.java -+++ ../src-work/minecraft/net/minecraft/util/ActionResult.java -@@ -20,4 +20,10 @@ - { - return this.field_188400_b; - } -+ -+ //Just a generic helper function to make typecasing easier... -+ public static ActionResult newResult(EnumActionResult result, T value) -+ { -+ return new ActionResult(result, value); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/util/BlockRenderLayer.java.patch b/patches.mcp/minecraft/net/minecraft/util/BlockRenderLayer.java.patch deleted file mode 100644 index 80055839a..000000000 --- a/patches.mcp/minecraft/net/minecraft/util/BlockRenderLayer.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/BlockRenderLayer.java -+++ ../src-work/minecraft/net/minecraft/util/BlockRenderLayer.java -@@ -1,9 +1,5 @@ - package net.minecraft.util; - --import net.minecraftforge.fml.relauncher.Side; --import net.minecraftforge.fml.relauncher.SideOnly; -- --@SideOnly(Side.CLIENT) - public enum BlockRenderLayer - { - SOLID("Solid"), diff --git a/patches.mcp/minecraft/net/minecraft/util/EnumFacing.java.patch b/patches.mcp/minecraft/net/minecraft/util/EnumFacing.java.patch deleted file mode 100644 index 2102e3cc9..000000000 --- a/patches.mcp/minecraft/net/minecraft/util/EnumFacing.java.patch +++ /dev/null @@ -1,67 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/EnumFacing.java -+++ ../src-work/minecraft/net/minecraft/util/EnumFacing.java -@@ -8,8 +8,6 @@ - import java.util.Random; - import net.minecraft.util.math.MathHelper; - import net.minecraft.util.math.Vec3i; --import net.minecraftforge.fml.relauncher.Side; --import net.minecraftforge.fml.relauncher.SideOnly; - - public enum EnumFacing implements IStringSerializable - { -@@ -62,7 +60,6 @@ - return getFront(this.opposite); - } - -- @SideOnly(Side.CLIENT) - public EnumFacing rotateAround(EnumFacing.Axis axis) - { - switch (axis) -@@ -113,7 +110,6 @@ - } - } - -- @SideOnly(Side.CLIENT) - private EnumFacing rotateX() - { - switch (this) -@@ -133,7 +129,6 @@ - } - } - -- @SideOnly(Side.CLIENT) - private EnumFacing rotateZ() - { - switch (this) -@@ -194,7 +189,6 @@ - return this.axis; - } - -- @SideOnly(Side.CLIENT) - public static EnumFacing byName(String name) - { - return name == null ? null : (EnumFacing)NAME_LOOKUP.get(name.toLowerCase()); -@@ -225,7 +219,6 @@ - return values()[rand.nextInt(values().length)]; - } - -- @SideOnly(Side.CLIENT) - public static EnumFacing getFacingFromVector(float p_176737_0_, float p_176737_1_, float p_176737_2_) - { - EnumFacing enumfacing = NORTH; -@@ -268,7 +261,6 @@ - throw new IllegalArgumentException("No such direction: " + p_181076_0_ + " " + p_181076_1_); - } - -- @SideOnly(Side.CLIENT) - public Vec3i getDirectionVec() - { - return this.directionVec; -@@ -304,7 +296,6 @@ - this.plane = plane; - } - -- @SideOnly(Side.CLIENT) - public static EnumFacing.Axis byName(String name) - { - return name == null ? null : (EnumFacing.Axis)NAME_LOOKUP.get(name.toLowerCase()); diff --git a/patches.mcp/minecraft/net/minecraft/util/IntIdentityHashBiMap.java.patch b/patches.mcp/minecraft/net/minecraft/util/IntIdentityHashBiMap.java.patch deleted file mode 100644 index 2b9932be9..000000000 --- a/patches.mcp/minecraft/net/minecraft/util/IntIdentityHashBiMap.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/IntIdentityHashBiMap.java -+++ ../src-work/minecraft/net/minecraft/util/IntIdentityHashBiMap.java -@@ -166,7 +166,6 @@ - return Iterators.filter(Iterators.forArray(this.field_186820_d), Predicates.notNull()); - } - -- @SideOnly(Side.CLIENT) - public void func_186812_a() - { - Arrays.fill(this.field_186818_b, (Object)null); diff --git a/patches.mcp/minecraft/net/minecraft/util/MouseHelper.java.patch b/patches.mcp/minecraft/net/minecraft/util/MouseHelper.java.patch deleted file mode 100644 index 7c04c7919..000000000 --- a/patches.mcp/minecraft/net/minecraft/util/MouseHelper.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/MouseHelper.java -+++ ../src-work/minecraft/net/minecraft/util/MouseHelper.java -@@ -13,6 +13,7 @@ - - public void grabMouseCursor() - { -+ if (Boolean.parseBoolean(System.getProperty("fml.noGrab","false"))) return; - Mouse.setGrabbed(true); - this.deltaX = 0; - this.deltaY = 0; diff --git a/patches.mcp/minecraft/net/minecraft/util/Session.java.patch b/patches.mcp/minecraft/net/minecraft/util/Session.java.patch deleted file mode 100644 index cd6f37383..000000000 --- a/patches.mcp/minecraft/net/minecraft/util/Session.java.patch +++ /dev/null @@ -1,68 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/Session.java -+++ ../src-work/minecraft/net/minecraft/util/Session.java -@@ -5,6 +5,8 @@ - import com.mojang.util.UUIDTypeAdapter; - import java.util.Map; - import java.util.UUID; -+ -+import net.minecraftforge.fml.common.FMLLog; - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - -@@ -15,9 +17,24 @@ - private final String playerID; - private final String token; - private final Session.Type sessionType; -+ /** Forge: Cache of the local session's GameProfile properties. */ -+ private com.mojang.authlib.properties.PropertyMap properties; - - public Session(String usernameIn, String playerIDIn, String tokenIn, String sessionTypeIn) - { -+ if (usernameIn == null || usernameIn.isEmpty()) -+ { -+ usernameIn = "MissingName"; -+ playerIDIn = tokenIn = "NotValid"; -+ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "========================================================="); -+ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "WARNING!! the username was not set for this session, typically"); -+ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "this means you installed Forge incorrectly. We have set your"); -+ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "name to \"MissingName\" and your session to nothing. Please"); -+ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "check your installation and post a console log from the launcher"); -+ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "when asking for help!"); -+ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "========================================================="); -+ } -+ - this.username = usernameIn; - this.playerID = playerIDIn; - this.token = tokenIn; -@@ -49,14 +66,29 @@ - try - { - UUID uuid = UUIDTypeAdapter.fromString(this.getPlayerID()); -- return new GameProfile(uuid, this.getUsername()); -+ GameProfile ret = new GameProfile(uuid, this.getUsername()); //Forge: Adds cached GameProfile properties to returned GameProfile. -+ if (properties != null) ret.getProperties().putAll(properties); // Helps to cut down on calls to the session service, -+ return ret; // which helps to fix MC-52974. - } - catch (IllegalArgumentException var2) - { -- return new GameProfile((UUID)null, this.getUsername()); -+ return new GameProfile(net.minecraft.entity.player.EntityPlayer.getUUID(new GameProfile((UUID)null, this.getUsername())), this.getUsername()); - } - } - -+ /* ======================================== FORGE START ===================================== */ -+ //For internal use only. Modders should never need to use this. -+ public void setProperties(com.mojang.authlib.properties.PropertyMap properties) -+ { -+ if(this.properties == null) this.properties = properties; -+ } -+ -+ public boolean hasCachedProperties() -+ { -+ return properties != null; -+ } -+ /* ========================================= FORGE END ====================================== */ -+ - @SideOnly(Side.CLIENT) - public static enum Type - { diff --git a/patches.mcp/minecraft/net/minecraft/util/TabCompleter.java.patch b/patches.mcp/minecraft/net/minecraft/util/TabCompleter.java.patch deleted file mode 100644 index 0d235578f..000000000 --- a/patches.mcp/minecraft/net/minecraft/util/TabCompleter.java.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/TabCompleter.java -+++ ../src-work/minecraft/net/minecraft/util/TabCompleter.java -@@ -53,13 +53,14 @@ - this.field_186844_a.deleteFromCursor(i - this.field_186844_a.getCursorPosition()); - } - -- this.field_186844_a.writeText((String)this.field_186849_f.get(this.field_186848_e++)); -+ this.field_186844_a.writeText(net.minecraft.util.text.TextFormatting.getTextWithoutFormattingCodes(this.field_186849_f.get(this.field_186848_e++))); - } - - private void func_186838_a(String p_186838_1_) - { - if (p_186838_1_.length() >= 1) - { -+ net.minecraftforge.client.ClientCommandHandler.instance.autoComplete(p_186838_1_); - Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new CPacketTabComplete(p_186838_1_, this.func_186839_b(), this.field_186845_b)); - this.field_186847_d = true; - } -@@ -74,6 +75,12 @@ - this.field_186846_c = false; - this.field_186849_f.clear(); - -+ String[] complete = net.minecraftforge.client.ClientCommandHandler.instance.latestAutoComplete; -+ if (complete != null) -+ { -+ p_186840_1_ = com.google.common.collect.ObjectArrays.concat(complete, p_186840_1_, String.class); -+ } -+ - for (String s : p_186840_1_) - { - if (!s.isEmpty()) -@@ -84,6 +91,7 @@ - - String s1 = this.field_186844_a.getText().substring(this.field_186844_a.func_146197_a(-1, this.field_186844_a.getCursorPosition(), false)); - String s2 = org.apache.commons.lang3.StringUtils.getCommonPrefix(p_186840_1_); -+ s2 = net.minecraft.util.text.TextFormatting.getTextWithoutFormattingCodes(s2); - - if (!s2.isEmpty() && !s1.equalsIgnoreCase(s2)) - { diff --git a/patches.mcp/minecraft/net/minecraft/util/math/BlockPos.java.patch b/patches.mcp/minecraft/net/minecraft/util/math/BlockPos.java.patch deleted file mode 100644 index 5c3362674..000000000 --- a/patches.mcp/minecraft/net/minecraft/util/math/BlockPos.java.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/math/BlockPos.java -+++ ../src-work/minecraft/net/minecraft/util/math/BlockPos.java -@@ -270,6 +270,21 @@ - }; - } - -+ /** -+ * Returns a version of this BlockPos that is guaranteed to be Immutable. -+ * In most cases this will return 'this', but if 'this' is an instance of -+ * MutableBlockPos it will return a new instance of BlockPos with the same values. -+ * -+ * When storing a parameter given to you for an extended period of time, make sure you -+ * use this in case the value is changed internally. -+ * -+ * @return An immutable BlockPos. -+ */ -+ public BlockPos getImmutable() -+ { -+ return this; -+ } -+ - public static final class MutableBlockPos extends BlockPos - { - private int x; -@@ -333,6 +348,8 @@ - { - return new BlockPos(this); - } -+ -+ @Override public BlockPos getImmutable() { return new BlockPos(this); } - } - - public static final class PooledMutableBlockPos extends BlockPos -@@ -443,5 +460,7 @@ - { - return this.func_185343_d(this.field_185347_c + p_185341_1_.getFrontOffsetX(), this.field_185348_d + p_185341_1_.getFrontOffsetY(), this.field_185349_e + p_185341_1_.getFrontOffsetZ()); - } -+ -+ @Override public BlockPos getImmutable() { return new BlockPos(this); } - } - } diff --git a/patches.mcp/minecraft/net/minecraft/util/math/RayTraceResult.java.patch b/patches.mcp/minecraft/net/minecraft/util/math/RayTraceResult.java.patch deleted file mode 100644 index 4f56eb74e..000000000 --- a/patches.mcp/minecraft/net/minecraft/util/math/RayTraceResult.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/math/RayTraceResult.java -+++ ../src-work/minecraft/net/minecraft/util/math/RayTraceResult.java -@@ -5,6 +5,12 @@ - - public class RayTraceResult - { -+ /** Used to determine what sub-segment is hit */ -+ public int subHit = -1; -+ -+ /** Used to add extra hit info */ -+ public Object hitInfo = null; -+ - private BlockPos blockPos; - public RayTraceResult.Type typeOfHit; - public EnumFacing sideHit; diff --git a/patches.mcp/minecraft/net/minecraft/util/math/Vec3d.java.patch b/patches.mcp/minecraft/net/minecraft/util/math/Vec3d.java.patch deleted file mode 100644 index 6f9856cfe..000000000 --- a/patches.mcp/minecraft/net/minecraft/util/math/Vec3d.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/math/Vec3d.java -+++ ../src-work/minecraft/net/minecraft/util/math/Vec3d.java -@@ -1,8 +1,5 @@ - package net.minecraft.util.math; - --import net.minecraftforge.fml.relauncher.Side; --import net.minecraftforge.fml.relauncher.SideOnly; -- - public class Vec3d - { - public static final Vec3d field_186680_a = new Vec3d(0.0D, 0.0D, 0.0D); -@@ -53,7 +50,6 @@ - return this.xCoord * vec.xCoord + this.yCoord * vec.yCoord + this.zCoord * vec.zCoord; - } - -- @SideOnly(Side.CLIENT) - public Vec3d crossProduct(Vec3d vec) - { - return new Vec3d(this.yCoord * vec.zCoord - this.zCoord * vec.yCoord, this.zCoord * vec.xCoord - this.xCoord * vec.zCoord, this.xCoord * vec.yCoord - this.yCoord * vec.xCoord); diff --git a/patches.mcp/minecraft/net/minecraft/util/registry/RegistryNamespacedDefaultedByKey.java.patch b/patches.mcp/minecraft/net/minecraft/util/registry/RegistryNamespacedDefaultedByKey.java.patch deleted file mode 100644 index ad6c8d499..000000000 --- a/patches.mcp/minecraft/net/minecraft/util/registry/RegistryNamespacedDefaultedByKey.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/registry/RegistryNamespacedDefaultedByKey.java -+++ ../src-work/minecraft/net/minecraft/util/registry/RegistryNamespacedDefaultedByKey.java -@@ -57,4 +57,11 @@ - V v = super.func_186801_a(p_186801_1_); - return (V)(v == null ? this.defaultValue : v); - } -+ -+ //Bypass functions to allow querying this registry WITHOUT getting the defaulted value. -+ // MODDERS DO NOT USE THIS IS FOR FORGE INTERNAL CHECKS -+ public int getIDForObjectBypass(V bypass) { return super.getIDForObject(bypass); } -+ public K getNameForObjectBypass(V value) { return super.getNameForObject(value); } -+ public V getObjectBypass(K name) { return super.getObject(name); } -+ public V getObjectByIdBypass(int id){ return super.getObjectById(id); } - } diff --git a/patches.mcp/minecraft/net/minecraft/util/text/ITextComponent.java.patch b/patches.mcp/minecraft/net/minecraft/util/text/ITextComponent.java.patch deleted file mode 100644 index d5497dbbc..000000000 --- a/patches.mcp/minecraft/net/minecraft/util/text/ITextComponent.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/text/ITextComponent.java -+++ ../src-work/minecraft/net/minecraft/util/text/ITextComponent.java -@@ -33,7 +33,6 @@ - - String getUnformattedText(); - -- @SideOnly(Side.CLIENT) - String getFormattedText(); - - List getSiblings(); diff --git a/patches.mcp/minecraft/net/minecraft/util/text/Style.java.patch b/patches.mcp/minecraft/net/minecraft/util/text/Style.java.patch deleted file mode 100644 index 8a3317bdc..000000000 --- a/patches.mcp/minecraft/net/minecraft/util/text/Style.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/text/Style.java -+++ ../src-work/minecraft/net/minecraft/util/text/Style.java -@@ -229,7 +229,6 @@ - return this; - } - -- @SideOnly(Side.CLIENT) - public String getFormattingCode() - { - if (this.isEmpty()) diff --git a/patches.mcp/minecraft/net/minecraft/util/text/TextComponentBase.java.patch b/patches.mcp/minecraft/net/minecraft/util/text/TextComponentBase.java.patch deleted file mode 100644 index e2a95ad34..000000000 --- a/patches.mcp/minecraft/net/minecraft/util/text/TextComponentBase.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/text/TextComponentBase.java -+++ ../src-work/minecraft/net/minecraft/util/text/TextComponentBase.java -@@ -74,7 +74,6 @@ - return stringbuilder.toString(); - } - -- @SideOnly(Side.CLIENT) - public final String getFormattedText() - { - StringBuilder stringbuilder = new StringBuilder(); diff --git a/patches.mcp/minecraft/net/minecraft/util/text/translation/LanguageMap.java.patch b/patches.mcp/minecraft/net/minecraft/util/text/translation/LanguageMap.java.patch deleted file mode 100644 index 332e5a6ed..000000000 --- a/patches.mcp/minecraft/net/minecraft/util/text/translation/LanguageMap.java.patch +++ /dev/null @@ -1,54 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/text/translation/LanguageMap.java -+++ ../src-work/minecraft/net/minecraft/util/text/translation/LanguageMap.java -@@ -23,9 +23,29 @@ - - public LanguageMap() - { -+ InputStream inputstream = LanguageMap.class.getResourceAsStream("/assets/minecraft/lang/en_US.lang"); -+ inject(this, inputstream); -+ } -+ -+ public static void inject(InputStream inputstream) -+ { -+ inject(instance, inputstream); -+ } -+ -+ private static void inject(LanguageMap inst, InputStream inputstream) -+ { -+ Map map = parseLangFile(inputstream); -+ inst.languageList.putAll(map); -+ inst.lastUpdateTimeInMilliseconds = System.currentTimeMillis(); -+ } -+ -+ public static Map parseLangFile(InputStream inputstream) -+ { -+ Map table = Maps.newHashMap(); - try - { -- InputStream inputstream = LanguageMap.class.getResourceAsStream("/assets/minecraft/lang/en_US.lang"); -+ inputstream = net.minecraftforge.fml.common.FMLCommonHandler.instance().loadLanguage(table, inputstream); -+ if (inputstream == null) return table; - - for (String s : IOUtils.readLines(inputstream, Charsets.UTF_8)) - { -@@ -37,17 +57,18 @@ - { - String s1 = astring[0]; - String s2 = numericVariablePattern.matcher(astring[1]).replaceAll("%$1s"); -- this.languageList.put(s1, s2); -+ table.put(s1, s2); - } - } - } - -- this.lastUpdateTimeInMilliseconds = System.currentTimeMillis(); - } - catch (IOException var7) - { - ; - } -+ catch (Exception ex) {} -+ return table; - } - - static LanguageMap getInstance() diff --git a/patches.mcp/minecraft/net/minecraft/world/ChunkCache.java.patch b/patches.mcp/minecraft/net/minecraft/world/ChunkCache.java.patch deleted file mode 100644 index 014ea8af2..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/ChunkCache.java.patch +++ /dev/null @@ -1,56 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/ChunkCache.java -+++ ../src-work/minecraft/net/minecraft/world/ChunkCache.java -@@ -61,6 +61,8 @@ - { - int i = (pos.getX() >> 4) - this.chunkX; - int j = (pos.getZ() >> 4) - this.chunkZ; -+ if (i < 0 || i >= chunkArray.length || j < 0 || j >= chunkArray[i].length) return null; -+ if (chunkArray[i][j] == null) return null; - return this.chunkArray[i][j].getTileEntity(pos, Chunk.EnumCreateEntityType.IMMEDIATE); - } - -@@ -139,6 +141,8 @@ - { - int i = (pos.getX() >> 4) - this.chunkX; - int j = (pos.getZ() >> 4) - this.chunkZ; -+ if (i < 0 || i >= chunkArray.length || j < 0 || j >= chunkArray[i].length) return p_175629_1_.defaultLightValue; -+ if (chunkArray[i][j] == null) return p_175629_1_.defaultLightValue; - return this.chunkArray[i][j].getLightFor(p_175629_1_, pos); - } - } -@@ -150,7 +154,8 @@ - - public boolean isAirBlock(BlockPos pos) - { -- return this.getBlockState(pos).func_185904_a() == Material.air; -+ IBlockState state = this.getBlockState(pos); -+ return state.getBlock().isAir(state, this, pos); - } - - @SideOnly(Side.CLIENT) -@@ -160,6 +165,7 @@ - { - int i = (pos.getX() >> 4) - this.chunkX; - int j = (pos.getZ() >> 4) - this.chunkZ; -+ if (i < 0 || i >= chunkArray.length || j < 0 || j >= chunkArray[i].length) return p_175628_1_.defaultLightValue; - return this.chunkArray[i][j].getLightFor(p_175628_1_, pos); - } - else -@@ -178,4 +184,17 @@ - { - return this.worldObj.getWorldType(); - } -+ -+ @Override -+ public boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default) -+ { -+ int x = (pos.getX() >> 4) - this.chunkX; -+ int z = (pos.getZ() >> 4) - this.chunkZ; -+ if (pos.getY() >= 0 && pos.getY() < 256) return _default; -+ if (x < 0 || x >= chunkArray.length || z < 0 || z >= chunkArray[x].length) return _default; -+ if (chunkArray[x][z] == null) return _default; -+ -+ IBlockState state = getBlockState(pos); -+ return state.getBlock().isSideSolid(state, this, pos, side); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/Explosion.java.patch b/patches.mcp/minecraft/net/minecraft/world/Explosion.java.patch deleted file mode 100644 index 75563e98a..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/Explosion.java.patch +++ /dev/null @@ -1,52 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/Explosion.java -+++ ../src-work/minecraft/net/minecraft/world/Explosion.java -@@ -40,6 +40,7 @@ - private final float explosionSize; - private final List affectedBlockPositions; - private final Map playerKnockbackMap; -+ private final Vec3d position; - - @SideOnly(Side.CLIENT) - public Explosion(World worldIn, Entity p_i45752_2_, double p_i45752_3_, double p_i45752_5_, double p_i45752_7_, float p_i45752_9_, List p_i45752_10_) -@@ -67,6 +68,7 @@ - this.explosionZ = p_i45754_7_; - this.isFlaming = p_i45754_10_; - this.isSmoking = p_i45754_11_; -+ this.position = new Vec3d(explosionX, explosionY, explosionZ); - } - - public void doExplosionA() -@@ -101,7 +103,7 @@ - - if (iblockstate.func_185904_a() != Material.air) - { -- float f2 = this.exploder != null ? this.exploder.getExplosionResistance(this, this.worldObj, blockpos, iblockstate) : iblockstate.getBlock().getExplosionResistance((Entity)null); -+ float f2 = this.exploder != null ? this.exploder.getExplosionResistance(this, this.worldObj, blockpos, iblockstate) : iblockstate.getBlock().getExplosionResistance(worldObj, blockpos, (Entity)null, this); - f -= (f2 + 0.3F) * 0.3F; - } - -@@ -128,6 +130,7 @@ - int j2 = MathHelper.floor_double(this.explosionZ - (double)f3 - 1.0D); - int j1 = MathHelper.floor_double(this.explosionZ + (double)f3 + 1.0D); - List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this.exploder, new AxisAlignedBB((double)k1, (double)i2, (double)j2, (double)l1, (double)i1, (double)j1)); -+ net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.worldObj, this, list, f3); - Vec3d vec3d = new Vec3d(this.explosionX, this.explosionY, this.explosionZ); - - for (int k2 = 0; k2 < list.size(); ++k2) -@@ -227,8 +230,7 @@ - block.dropBlockAsItemWithChance(this.worldObj, blockpos, this.worldObj.getBlockState(blockpos), 1.0F / this.explosionSize, 0); - } - -- this.worldObj.setBlockState(blockpos, Blocks.air.getDefaultState(), 3); -- block.onBlockDestroyedByExplosion(this.worldObj, blockpos, this); -+ block.onBlockExploded(this.worldObj, blockpos, this); - } - } - } -@@ -264,4 +266,6 @@ - { - return this.affectedBlockPositions; - } -+ -+ public Vec3d getPosition(){ return this.position; } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/IBlockAccess.java.patch b/patches.mcp/minecraft/net/minecraft/world/IBlockAccess.java.patch deleted file mode 100644 index 7fb64f305..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/IBlockAccess.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/IBlockAccess.java -+++ ../src-work/minecraft/net/minecraft/world/IBlockAccess.java -@@ -29,4 +29,14 @@ - - @SideOnly(Side.CLIENT) - WorldType getWorldType(); -+ -+ /** -+ * FORGE: isSideSolid, pulled up from {@link World} -+ * -+ * @param pos Position -+ * @param side Side -+ * @param _default default return value -+ * @return if the block is solid on the side -+ */ -+ boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default); - } diff --git a/patches.mcp/minecraft/net/minecraft/world/World.java.patch b/patches.mcp/minecraft/net/minecraft/world/World.java.patch deleted file mode 100644 index b06145937..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/World.java.patch +++ /dev/null @@ -1,882 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/World.java -+++ ../src-work/minecraft/net/minecraft/world/World.java -@@ -60,6 +60,13 @@ - - public abstract class World implements IBlockAccess - { -+ /** -+ * Used in the getEntitiesWithinAABB functions to expand the search area for entities. -+ * Modders should change this variable to a higher value if it is less then the radius -+ * of one of there entities. -+ */ -+ public static double MAX_ENTITY_RADIUS = 2.0D; -+ - private int seaLevel = 63; - protected boolean scheduledUpdatesAreImmediate; - public final List loadedEntityList = Lists.newArrayList(); -@@ -101,6 +108,10 @@ - private final WorldBorder worldBorder; - int[] lightUpdateBlockList; - -+ public boolean restoringBlockSnapshots = false; -+ public boolean captureBlockSnapshots = false; -+ public java.util.ArrayList capturedBlockSnapshots = new java.util.ArrayList(); -+ - protected World(ISaveHandler saveHandlerIn, WorldInfo info, WorldProvider providerIn, Profiler profilerIn, boolean client) - { - this.worldAccesses = Lists.newArrayList(new IWorldEventListener[] {this.field_184152_t}); -@@ -115,6 +126,7 @@ - this.provider = providerIn; - this.isRemote = client; - this.worldBorder = providerIn.getWorldBorder(); -+ perWorldStorage = new MapStorage((ISaveHandler)null); - } - - public World init() -@@ -124,6 +136,11 @@ - - public BiomeGenBase getBiomeGenForCoords(final BlockPos pos) - { -+ return this.provider.getBiomeGenForCoords(pos); -+ } -+ -+ public BiomeGenBase getBiomeGenForCoordsBody(final BlockPos pos) -+ { - if (this.isBlockLoaded(pos)) - { - Chunk chunk = this.getChunkFromBlockCoords(pos); -@@ -194,7 +211,7 @@ - - public boolean isAirBlock(BlockPos pos) - { -- return this.getBlockState(pos).func_185904_a() == Material.air; -+ return this.getBlockState(pos).getBlock().isAir(this.getBlockState(pos), this, pos); - } - - public boolean isBlockLoaded(BlockPos pos) -@@ -291,23 +308,49 @@ - { - Chunk chunk = this.getChunkFromBlockCoords(pos); - Block block = newState.getBlock(); -+ -+ net.minecraftforge.common.util.BlockSnapshot blockSnapshot = null; -+ if (this.captureBlockSnapshots && !this.isRemote) -+ { -+ blockSnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(this, pos, flags); -+ this.capturedBlockSnapshots.add(blockSnapshot); -+ } -+ IBlockState oldState = getBlockState(pos); -+ int oldLight = oldState.getLightValue(this, pos); -+ int oldOpacity = oldState.getLightOpacity(this, pos); -+ - IBlockState iblockstate = chunk.setBlockState(pos, newState); - - if (iblockstate == null) - { -+ if (blockSnapshot != null) this.capturedBlockSnapshots.remove(blockSnapshot); - return false; - } - else - { -- if (newState.func_185891_c() != iblockstate.func_185891_c() || newState.func_185906_d() != iblockstate.func_185906_d()) -+ if (newState.getLightOpacity(this, pos) != oldOpacity || newState.getLightValue(this, pos) != oldLight) - { - this.theProfiler.startSection("checkLight"); - this.checkLight(pos); - this.theProfiler.endSection(); - } - -- if ((flags & 2) != 0 && (!this.isRemote || (flags & 4) == 0) && chunk.isPopulated()) -+ if (blockSnapshot == null) // Don't notify clients or update physics while capturing blockstates - { -+ this.markAndNotifyBlock(pos, chunk, iblockstate, newState, flags); -+ } -+ return true; -+ } -+ } -+ } -+ -+ // Split off from original setBlockState(BlockPos, IBlockState, int) method in order to directly send client and physic updates -+ public void markAndNotifyBlock(BlockPos pos, Chunk chunk, IBlockState iblockstate, IBlockState newState, int flags) -+ { -+ { -+ { -+ if ((flags & 2) != 0 && (!this.isRemote || (flags & 4) == 0) && (chunk == null || chunk.isPopulated())) -+ { - this.func_184138_a(pos, iblockstate, newState, flags); - } - -@@ -317,11 +360,9 @@ - - if (newState.func_185912_n()) - { -- this.updateComparatorOutputLevel(pos, block); -+ this.updateComparatorOutputLevel(pos, newState.getBlock()); - } - } -- -- return true; - } - } - } -@@ -336,7 +377,7 @@ - IBlockState iblockstate = this.getBlockState(pos); - Block block = iblockstate.getBlock(); - -- if (iblockstate.func_185904_a() == Material.air) -+ if (block.isAir(iblockstate, this, pos)) - { - return false; - } -@@ -409,6 +450,9 @@ - - public void notifyNeighborsOfStateChange(BlockPos pos, Block blockType) - { -+ if(net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, pos, this.getBlockState(pos), java.util.EnumSet.allOf(EnumFacing.class)).isCanceled()) -+ return; -+ - this.notifyBlockOfStateChange(pos.west(), blockType); - this.notifyBlockOfStateChange(pos.east(), blockType); - this.notifyBlockOfStateChange(pos.down(), blockType); -@@ -419,6 +463,11 @@ - - public void notifyNeighborsOfStateExcept(BlockPos pos, Block blockType, EnumFacing skipSide) - { -+ java.util.EnumSet directions = java.util.EnumSet.allOf(EnumFacing.class); -+ directions.remove(skipSide); -+ if(net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, pos, this.getBlockState(pos), directions).isCanceled()) -+ return; -+ - if (skipSide != EnumFacing.WEST) - { - this.notifyBlockOfStateChange(pos.west(), blockType); -@@ -514,7 +563,7 @@ - { - IBlockState iblockstate = this.getBlockState(blockpos); - -- if (iblockstate.func_185891_c() > 0 && !iblockstate.func_185904_a().isLiquid()) -+ if (iblockstate.getBlock().getLightOpacity(iblockstate, this, blockpos) > 0 && !iblockstate.func_185904_a().isLiquid()) - { - return false; - } -@@ -782,7 +831,7 @@ - - public boolean isDaytime() - { -- return this.skylightSubtracted < 4; -+ return this.provider.isDaytime(); - } - - public RayTraceResult rayTraceBlocks(Vec3d p_72933_1_, Vec3d p_72933_2_) -@@ -982,6 +1031,13 @@ - - public void func_184148_a(EntityPlayer p_184148_1_, double p_184148_2_, double p_184148_4_, double p_184148_6_, SoundEvent p_184148_8_, SoundCategory p_184148_9_, float p_184148_10_, float p_184148_11_) - { -+ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_184148_1_, p_184148_8_, p_184148_9_, p_184148_10_, p_184148_11_); -+ if (event.isCanceled() || event.getSound() == null) return; -+ p_184148_8_ = event.getSound(); -+ p_184148_9_ = event.getCategory(); -+ p_184148_10_ = event.getVolume(); -+ p_184148_11_ = event.getPitch(); -+ - for (int i = 0; i < this.worldAccesses.size(); ++i) - { - ((IWorldEventListener)this.worldAccesses.get(i)).func_184375_a(p_184148_1_, p_184148_8_, p_184148_9_, p_184148_2_, p_184148_4_, p_184148_6_, p_184148_10_, p_184148_11_); -@@ -1027,6 +1083,9 @@ - - public boolean spawnEntityInWorld(Entity entityIn) - { -+ // do not drop any items while restoring blocksnapshots. Prevents dupes -+ if (!this.isRemote && (entityIn == null || (entityIn instanceof net.minecraft.entity.item.EntityItem && this.restoringBlockSnapshots))) return false; -+ - int i = MathHelper.floor_double(entityIn.posX / 16.0D); - int j = MathHelper.floor_double(entityIn.posZ / 16.0D); - boolean flag = entityIn.forceSpawn; -@@ -1049,6 +1108,8 @@ - this.updateAllPlayersSleepingFlag(); - } - -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(entityIn, this)) && !flag) return false; -+ - this.getChunkFromChunkCoords(i, j).addEntity(entityIn); - this.loadedEntityList.add(entityIn); - this.onEntityAdded(entityIn); -@@ -1285,7 +1346,6 @@ - return list; - } - -- @SideOnly(Side.CLIENT) - public void removeWorldAccess(IWorldEventListener worldAccess) - { - this.worldAccesses.remove(worldAccess); -@@ -1348,19 +1408,38 @@ - - public int calculateSkylightSubtracted(float p_72967_1_) - { -+ float f = provider.getSunBrightnessFactor(p_72967_1_); -+ f = 1 - f; -+ return (int)(f * 11); -+ } -+ -+ /** -+ * The current sun brightness factor for this dimension. -+ * 0.0f means no light at all, and 1.0f means maximum sunlight. -+ * Highly recommended for sunlight detection like solar panel. -+ * -+ * @return The current brightness factor -+ * */ -+ public float getSunBrightnessFactor(float p_72967_1_) -+ { - float f = this.getCelestialAngle(p_72967_1_); - float f1 = 1.0F - (MathHelper.cos(f * ((float)Math.PI * 2F)) * 2.0F + 0.5F); - f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); - f1 = 1.0F - f1; - f1 = (float)((double)f1 * (1.0D - (double)(this.getRainStrength(p_72967_1_) * 5.0F) / 16.0D)); - f1 = (float)((double)f1 * (1.0D - (double)(this.getThunderStrength(p_72967_1_) * 5.0F) / 16.0D)); -- f1 = 1.0F - f1; -- return (int)(f1 * 11.0F); -+ return f1; - } - - @SideOnly(Side.CLIENT) - public float getSunBrightness(float p_72971_1_) - { -+ return this.provider.getSunBrightness(p_72971_1_); -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public float getSunBrightnessBody(float p_72971_1_) -+ { - float f = this.getCelestialAngle(p_72971_1_); - float f1 = 1.0F - (MathHelper.cos(f * ((float)Math.PI * 2F)) * 2.0F + 0.2F); - f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); -@@ -1373,6 +1452,12 @@ - @SideOnly(Side.CLIENT) - public Vec3d getSkyColor(Entity entityIn, float partialTicks) - { -+ return this.provider.getSkyColor(entityIn, partialTicks); -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public Vec3d getSkyColorBody(Entity entityIn, float partialTicks) -+ { - float f = this.getCelestialAngle(partialTicks); - float f1 = MathHelper.cos(f * ((float)Math.PI * 2F)) * 2.0F + 0.5F; - f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); -@@ -1380,9 +1465,7 @@ - int j = MathHelper.floor_double(entityIn.posY); - int k = MathHelper.floor_double(entityIn.posZ); - BlockPos blockpos = new BlockPos(i, j, k); -- BiomeGenBase biomegenbase = this.getBiomeGenForCoords(blockpos); -- float f2 = biomegenbase.getFloatTemperature(blockpos); -- int l = biomegenbase.getSkyColorByTemp(f2); -+ int l = net.minecraftforge.client.ForgeHooksClient.getSkyBlendColour(this, blockpos); - float f3 = (float)(l >> 16 & 255) / 255.0F; - float f4 = (float)(l >> 8 & 255) / 255.0F; - float f5 = (float)(l & 255) / 255.0F; -@@ -1442,6 +1525,11 @@ - - public float getCurrentMoonPhaseFactor() - { -+ return provider.getCurrentMoonPhaseFactor(); -+ } -+ -+ public float getCurrentMoonPhaseFactorBody() -+ { - return WorldProvider.moonPhaseFactors[this.provider.getMoonPhase(this.worldInfo.getWorldTime())]; - } - -@@ -1454,6 +1542,12 @@ - @SideOnly(Side.CLIENT) - public Vec3d getCloudColour(float partialTicks) - { -+ return this.provider.getCloudColor(partialTicks); -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public Vec3d getCloudColorBody(float partialTicks) -+ { - float f = this.getCelestialAngle(partialTicks); - float f1 = MathHelper.cos(f * ((float)Math.PI * 2F)) * 2.0F + 0.5F; - f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); -@@ -1509,9 +1603,9 @@ - for (blockpos = new BlockPos(pos.getX(), chunk.getTopFilledSegment() + 16, pos.getZ()); blockpos.getY() >= 0; blockpos = blockpos1) - { - blockpos1 = blockpos.down(); -- Material material = chunk.getBlockState(blockpos1).func_185904_a(); -+ IBlockState state = chunk.getBlockState(blockpos1); - -- if (material.blocksMovement() && material != Material.leaves) -+ if (state.func_185904_a().blocksMovement() && !state.getBlock().isLeaves(state, this, blockpos1) && !state.getBlock().isFoliage(this, blockpos1)) - { - break; - } -@@ -1523,6 +1617,12 @@ - @SideOnly(Side.CLIENT) - public float getStarBrightness(float partialTicks) - { -+ return this.provider.getStarBrightness(partialTicks); -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public float getStarBrightnessBody(float partialTicks) -+ { - float f = this.getCelestialAngle(partialTicks); - float f1 = 1.0F - (MathHelper.cos(f * ((float)Math.PI * 2F)) * 2.0F + 0.25F); - f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); -@@ -1574,6 +1674,12 @@ - entity.addEntityCrashInfo(crashreportcategory); - } - -+ if (net.minecraftforge.common.ForgeModContainer.removeErroringEntities) -+ { -+ net.minecraftforge.fml.common.FMLLog.severe(crashreport.getCompleteReport()); -+ removeEntity(entity); -+ } -+ else - throw new ReportedException(crashreport); - } - -@@ -1635,6 +1741,12 @@ - CrashReport crashreport1 = CrashReport.makeCrashReport(throwable1, "Ticking entity"); - CrashReportCategory crashreportcategory1 = crashreport1.makeCategory("Entity being ticked"); - entity2.addEntityCrashInfo(crashreportcategory1); -+ if (net.minecraftforge.common.ForgeModContainer.removeErroringEntities) -+ { -+ net.minecraftforge.fml.common.FMLLog.severe(crashreport1.getCompleteReport()); -+ removeEntity(entity2); -+ } -+ else - throw new ReportedException(crashreport1); - } - } -@@ -1684,6 +1796,13 @@ - CrashReport crashreport2 = CrashReport.makeCrashReport(throwable, "Ticking block entity"); - CrashReportCategory crashreportcategory2 = crashreport2.makeCategory("Block entity being ticked"); - tileentity.addInfoToCrashReport(crashreportcategory2); -+ if (net.minecraftforge.common.ForgeModContainer.removeErroringTileEntities) -+ { -+ net.minecraftforge.fml.common.FMLLog.severe(crashreport2.getCompleteReport()); -+ tileentity.invalidate(); -+ this.removeTileEntity(tileentity.getPos()); -+ } -+ else - throw new ReportedException(crashreport2); - } - } -@@ -1701,15 +1820,20 @@ - } - } - -- this.processingLoadedTiles = false; -- - if (!this.tileEntitiesToBeRemoved.isEmpty()) - { -+ for (Object tile : tileEntitiesToBeRemoved) -+ { -+ ((TileEntity)tile).onChunkUnload(); -+ } -+ - this.tickableTileEntities.removeAll(this.tileEntitiesToBeRemoved); - this.loadedTileEntityList.removeAll(this.tileEntitiesToBeRemoved); - this.tileEntitiesToBeRemoved.clear(); - } - -+ this.processingLoadedTiles = false; //FML Move below remove to prevent CMEs -+ - this.theProfiler.endStartSection("pendingBlockEntities"); - - if (!this.addedTileEntityList.isEmpty()) -@@ -1748,7 +1872,8 @@ - - public boolean addTileEntity(TileEntity tile) - { -- boolean flag = this.loadedTileEntityList.add(tile); -+ List dest = processingLoadedTiles ? addedTileEntityList : loadedTileEntityList; -+ boolean flag = dest.add(tile); - - if (flag && tile instanceof ITickable) - { -@@ -1782,9 +1907,13 @@ - { - int i = MathHelper.floor_double(entityIn.posX); - int j = MathHelper.floor_double(entityIn.posZ); -- int k = 32; -+ boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(i >> 4, j >> 4)); -+ int k = isForced ? 0 : 32; -+ boolean canUpdate = !forceUpdate || this.isAreaLoaded(i - k, 0, j - k, i + k, 0, j + k, true); - -- if (!forceUpdate || this.isAreaLoaded(i - k, 0, j - k, i + k, 0, j + k, true)) -+ if (!canUpdate) canUpdate = net.minecraftforge.event.ForgeEventFactory.canEntityUpdate(entityIn); -+ -+ if (canUpdate) - { - entityIn.lastTickPosX = entityIn.posX; - entityIn.lastTickPosY = entityIn.posY; -@@ -1913,7 +2042,7 @@ - { - IBlockState iblockstate = this.getBlockState(blockpos$pooledmutableblockpos.func_185343_d(k1, l1, i2)); - -- if (iblockstate.func_185904_a() != Material.air) -+ if (iblockstate.getBlock().isAir(iblockstate, this, new BlockPos(k1, l1, i2))) - { - blockpos$pooledmutableblockpos.func_185344_t(); - return true; -@@ -1983,6 +2112,10 @@ - blockpos$pooledmutableblockpos.func_185344_t(); - return true; - } -+ else if (block.isBurning(this, new BlockPos(k1, l1, i2))) -+ { -+ return true; -+ } - } - } - } -@@ -2022,6 +2155,16 @@ - IBlockState iblockstate = this.getBlockState(blockpos$pooledmutableblockpos); - Block block = iblockstate.getBlock(); - -+ Boolean result = block.isEntityInsideMaterial(this, blockpos$pooledmutableblockpos, iblockstate, entityIn, (double)l, materialIn, false); -+ if (result != null && result == true) -+ { -+ // Forge: When requested call blocks modifyAcceleration method, and more importantly cause this method to return true, which results in an entity being "inWater" -+ flag = true; -+ vec3d = block.modifyAcceleration(this, blockpos$pooledmutableblockpos, entityIn, vec3d); -+ continue; -+ } -+ else if (result != null && result == false) continue; -+ - if (iblockstate.func_185904_a() == materialIn) - { - double d0 = (double)((float)(l1 + 1) - BlockLiquid.getLiquidHeightPercent(((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue())); -@@ -2098,6 +2241,9 @@ - { - IBlockState iblockstate = this.getBlockState(blockpos$pooledmutableblockpos.func_185343_d(k1, l1, i2)); - -+ Boolean result = iblockstate.getBlock().isAABBInsideMaterial(this, blockpos$pooledmutableblockpos, bb, materialIn); -+ if (result != null) return result; -+ - if (iblockstate.func_185904_a() == materialIn) - { - int j2 = ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue(); -@@ -2130,6 +2276,7 @@ - public Explosion newExplosion(Entity entityIn, double x, double y, double z, float strength, boolean isFlaming, boolean isSmoking) - { - Explosion explosion = new Explosion(this, entityIn, x, y, z, strength, isFlaming, isSmoking); -+ if (net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this, explosion)) return explosion; - explosion.doExplosionA(); - explosion.doExplosionB(true); - return explosion; -@@ -2276,19 +2423,27 @@ - else - { - this.addTileEntity(tileEntityIn); -- this.getChunkFromBlockCoords(pos).addTileEntity(pos, tileEntityIn); -+ Chunk chunk = this.getChunkFromBlockCoords(pos); //Forge add NPE protection -+ if (chunk != null) chunk.addTileEntity(pos, tileEntityIn); - } -+ this.updateComparatorOutputLevel(pos, getBlockState(pos).getBlock()); //Notify neighbors of changes - } - } - - public void removeTileEntity(BlockPos pos) - { -+ //Chunk chunk = this.getChunkFromBlockCoords(pos); -+ //if (chunk != null) chunk.removeTileEntity(pos); -+ //Forge ToDO: Are these patches needed anymore? -+ - TileEntity tileentity = this.getTileEntity(pos); - - if (tileentity != null && this.processingLoadedTiles) - { - tileentity.invalidate(); - this.addedTileEntityList.remove(tileentity); -+ if (!(tileentity instanceof ITickable)) //Forge: If they are not tickable they wont be removed in the update loop. -+ this.loadedTileEntityList.remove(tileentity); - } - else - { -@@ -2301,6 +2456,7 @@ - - this.getChunkFromBlockCoords(pos).removeTileEntity(pos); - } -+ this.updateComparatorOutputLevel(pos, getBlockState(pos).getBlock()); //Notify neighbors of changes - } - - public void markTileEntityForRemoval(TileEntity tileEntityIn) -@@ -2327,7 +2483,7 @@ - if (chunk != null && !chunk.isEmpty()) - { - IBlockState iblockstate = this.getBlockState(pos); -- return iblockstate.func_185904_a().isOpaque() && iblockstate.func_185917_h(); -+ return iblockstate.getBlock().isNormalCube(iblockstate, this, pos); - } - else - { -@@ -2350,6 +2506,7 @@ - { - this.spawnHostileMobs = hostile; - this.spawnPeacefulMobs = peaceful; -+ this.provider.setAllowedSpawnTypes(hostile, peaceful); - } - - public void tick() -@@ -2359,6 +2516,11 @@ - - protected void calculateInitialWeather() - { -+ this.provider.calculateInitialWeather(); -+ } -+ -+ public void calculateInitialWeatherBody() -+ { - if (this.worldInfo.isRaining()) - { - this.rainingStrength = 1.0F; -@@ -2372,6 +2534,11 @@ - - protected void updateWeather() - { -+ this.provider.updateWeather(); -+ } -+ -+ public void updateWeatherBody() -+ { - if (!this.provider.getHasNoSky()) - { - if (!this.isRemote) -@@ -2491,6 +2658,11 @@ - - public boolean canBlockFreeze(BlockPos pos, boolean noWaterAdj) - { -+ return this.provider.canBlockFreeze(pos, noWaterAdj); -+ } -+ -+ public boolean canBlockFreezeBody(BlockPos pos, boolean noWaterAdj) -+ { - BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos); - float f = biomegenbase.getFloatTemperature(pos); - -@@ -2532,6 +2704,11 @@ - - public boolean canSnowAt(BlockPos pos, boolean checkLight) - { -+ return this.provider.canSnowAt(pos, checkLight); -+ } -+ -+ public boolean canSnowAtBody(BlockPos pos, boolean checkLight) -+ { - BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos); - float f = biomegenbase.getFloatTemperature(pos); - -@@ -2549,7 +2726,7 @@ - { - IBlockState iblockstate = this.getBlockState(pos); - -- if (iblockstate.func_185904_a() == Material.air && Blocks.snow_layer.canPlaceBlockAt(this, pos)) -+ if (iblockstate.getBlock().isAir(iblockstate, this, pos) && Blocks.snow_layer.canPlaceBlockAt(this, pos)) - { - return true; - } -@@ -2581,10 +2758,11 @@ - else - { - IBlockState iblockstate = this.getBlockState(pos); -- int i = lightType == EnumSkyBlock.SKY ? 0 : iblockstate.func_185906_d(); -- int j = iblockstate.func_185891_c(); -+ int blockLight = iblockstate.getBlock().getLightValue(iblockstate, this, pos); -+ int i = lightType == EnumSkyBlock.SKY ? 0 : blockLight; -+ int j = iblockstate.getBlock().getLightOpacity(iblockstate, this, pos); - -- if (j >= 15 && iblockstate.func_185906_d() > 0) -+ if (j >= 15 && blockLight > 0) - { - j = 1; - } -@@ -2683,7 +2861,7 @@ - int j4 = j2 + enumfacing.getFrontOffsetY(); - int k4 = k2 + enumfacing.getFrontOffsetZ(); - blockpos$pooledmutableblockpos.func_185343_d(i4, j4, k4); -- int l4 = Math.max(1, this.getBlockState(blockpos$pooledmutableblockpos).func_185891_c()); -+ int l4 = Math.max(1, this.getBlockState(blockpos$pooledmutableblockpos).getBlock().getLightOpacity(this.getBlockState(blockpos$pooledmutableblockpos), this, blockpos$pooledmutableblockpos)); - i3 = this.getLightFor(lightType, blockpos$pooledmutableblockpos); - - if (i3 == l2 - l4 && j < this.lightUpdateBlockList.length) -@@ -2789,10 +2967,10 @@ - public List getEntitiesInAABBexcluding(Entity entityIn, AxisAlignedBB boundingBox, Predicate predicate) - { - List list = Lists.newArrayList(); -- int i = MathHelper.floor_double((boundingBox.minX - 2.0D) / 16.0D); -- int j = MathHelper.floor_double((boundingBox.maxX + 2.0D) / 16.0D); -- int k = MathHelper.floor_double((boundingBox.minZ - 2.0D) / 16.0D); -- int l = MathHelper.floor_double((boundingBox.maxZ + 2.0D) / 16.0D); -+ int i = MathHelper.floor_double((boundingBox.minX - MAX_ENTITY_RADIUS) / 16.0D); -+ int j = MathHelper.floor_double((boundingBox.maxX + MAX_ENTITY_RADIUS) / 16.0D); -+ int k = MathHelper.floor_double((boundingBox.minZ - MAX_ENTITY_RADIUS) / 16.0D); -+ int l = MathHelper.floor_double((boundingBox.maxZ + MAX_ENTITY_RADIUS) / 16.0D); - - for (int i1 = i; i1 <= j; ++i1) - { -@@ -2845,10 +3023,10 @@ - - public List getEntitiesWithinAABB(Class clazz, AxisAlignedBB aabb, Predicate filter) - { -- int i = MathHelper.floor_double((aabb.minX - 2.0D) / 16.0D); -- int j = MathHelper.ceiling_double_int((aabb.maxX + 2.0D) / 16.0D); -- int k = MathHelper.floor_double((aabb.minZ - 2.0D) / 16.0D); -- int l = MathHelper.ceiling_double_int((aabb.maxZ + 2.0D) / 16.0D); -+ int i = MathHelper.floor_double((aabb.minX - MAX_ENTITY_RADIUS) / 16.0D); -+ int j = MathHelper.ceiling_double_int((aabb.maxX + MAX_ENTITY_RADIUS) / 16.0D); -+ int k = MathHelper.floor_double((aabb.minZ - MAX_ENTITY_RADIUS) / 16.0D); -+ int l = MathHelper.ceiling_double_int((aabb.maxZ + MAX_ENTITY_RADIUS) / 16.0D); - List list = Lists.newArrayList(); - - for (int i1 = i; i1 < j; ++i1) -@@ -2926,11 +3104,13 @@ - - public void loadEntities(Collection entityCollection) - { -- this.loadedEntityList.addAll(entityCollection); -- - for (Entity entity : entityCollection) - { -- this.onEntityAdded(entity); -+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(entity, this))) -+ { -+ loadedEntityList.add(entity); -+ this.onEntityAdded(entity); -+ } - } - } - -@@ -2943,7 +3123,7 @@ - { - IBlockState iblockstate = this.getBlockState(pos); - AxisAlignedBB axisalignedbb = p_175716_3_ ? null : blockIn.getDefaultState().func_185890_d(this, pos); -- return axisalignedbb != Block.field_185506_k && !this.checkNoEntityCollision(axisalignedbb.func_186670_a(pos), entityIn) ? false : (iblockstate.func_185904_a() == Material.circuits && blockIn == Blocks.anvil ? true : iblockstate.func_185904_a().isReplaceable() && blockIn.canReplace(this, pos, side, itemStackIn)); -+ return axisalignedbb != Block.field_185506_k && !this.checkNoEntityCollision(axisalignedbb.func_186670_a(pos), entityIn) ? false : (iblockstate.func_185904_a() == Material.circuits && blockIn == Blocks.anvil ? true : iblockstate.getBlock().isReplaceable(this, pos) && blockIn.canReplace(this, pos, side, itemStackIn)); - } - - public int getSeaLevel() -@@ -3026,7 +3206,7 @@ - public int getRedstonePower(BlockPos pos, EnumFacing facing) - { - IBlockState iblockstate = this.getBlockState(pos); -- return iblockstate.func_185915_l() ? this.getStrongPower(pos) : iblockstate.func_185911_a(this, pos, facing); -+ return iblockstate.getBlock().shouldCheckWeakPower(iblockstate, this, pos, facing) ? this.getStrongPower(pos) : iblockstate.func_185911_a(this, pos, facing); - } - - public boolean isBlockPowered(BlockPos pos) -@@ -3215,7 +3395,7 @@ - - public long getSeed() - { -- return this.worldInfo.getSeed(); -+ return this.provider.getSeed(); - } - - public long getTotalWorldTime() -@@ -3225,17 +3405,17 @@ - - public long getWorldTime() - { -- return this.worldInfo.getWorldTime(); -+ return this.provider.getWorldTime(); - } - - public void setWorldTime(long time) - { -- this.worldInfo.setWorldTime(time); -+ this.provider.setWorldTime(time); - } - - public BlockPos getSpawnPoint() - { -- BlockPos blockpos = new BlockPos(this.worldInfo.getSpawnX(), this.worldInfo.getSpawnY(), this.worldInfo.getSpawnZ()); -+ BlockPos blockpos = this.provider.getSpawnPoint(); - - if (!this.getWorldBorder().contains(blockpos)) - { -@@ -3247,7 +3427,7 @@ - - public void setSpawnPoint(BlockPos pos) - { -- this.worldInfo.setSpawn(pos); -+ this.provider.setSpawnPoint(pos); - } - - @SideOnly(Side.CLIENT) -@@ -3267,12 +3447,18 @@ - - if (!this.loadedEntityList.contains(entityIn)) - { -+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(entityIn, this))) - this.loadedEntityList.add(entityIn); - } - } - - public boolean isBlockModifiable(EntityPlayer player, BlockPos pos) - { -+ return this.provider.canMineBlock(player, pos); -+ } -+ -+ public boolean canMineBlockBody(EntityPlayer player, BlockPos pos) -+ { - return true; - } - -@@ -3366,8 +3552,7 @@ - - public boolean isBlockinHighHumidity(BlockPos pos) - { -- BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos); -- return biomegenbase.isHighHumidity(); -+ return this.provider.isBlockHighHumidity(pos); - } - - public MapStorage getMapStorage() -@@ -3426,12 +3611,12 @@ - - public int getHeight() - { -- return 256; -+ return this.provider.getHeight(); - } - - public int getActualHeight() - { -- return this.provider.getHasNoSky() ? 128 : 256; -+ return this.provider.getActualHeight(); - } - - public Random setRandomSeed(int p_72843_1_, int p_72843_2_, int p_72843_3_) -@@ -3481,7 +3666,7 @@ - @SideOnly(Side.CLIENT) - public double getHorizon() - { -- return this.worldInfo.getTerrainType() == WorldType.FLAT ? 0.0D : 63.0D; -+ return provider.getHorizon(); - } - - public void sendBlockBreakProgress(int breakerId, BlockPos pos, int progress) -@@ -3515,7 +3700,7 @@ - - public void updateComparatorOutputLevel(BlockPos pos, Block blockIn) - { -- for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) -+ for (EnumFacing enumfacing : EnumFacing.VALUES) - { - BlockPos blockpos = pos.offset(enumfacing); - -@@ -3523,18 +3708,14 @@ - { - IBlockState iblockstate = this.getBlockState(blockpos); - -- if (Blocks.unpowered_comparator.func_185547_C(iblockstate)) -+ iblockstate.getBlock().onNeighborChange(this, blockpos, pos); -+ if (iblockstate.getBlock().isNormalCube(iblockstate, this, blockpos)) - { -- iblockstate.getBlock().onNeighborBlockChange(this, blockpos, iblockstate, blockIn); -- } -- else if (iblockstate.func_185915_l()) -- { - blockpos = blockpos.offset(enumfacing); - iblockstate = this.getBlockState(blockpos); -- -- if (Blocks.unpowered_comparator.func_185547_C(iblockstate)) -+ if (iblockstate.getBlock().getWeakChanges(this, blockpos)) - { -- iblockstate.getBlock().onNeighborBlockChange(this, blockpos, iblockstate, blockIn); -+ iblockstate.getBlock().onNeighborChange(this, blockpos, pos); - } - } - } -@@ -3600,6 +3781,87 @@ - return i >= -k && i <= k && j >= -k && j <= k; - } - -+ /* ======================================== FORGE START =====================================*/ -+ /** -+ * Determine if the given block is considered solid on the -+ * specified side. Used by placement logic. -+ * -+ * @param pos Block Position -+ * @param side The Side in question -+ * @return True if the side is solid -+ */ -+ public boolean isSideSolid(BlockPos pos, EnumFacing side) -+ { -+ return isSideSolid(pos, side, false); -+ } -+ -+ /** -+ * Determine if the given block is considered solid on the -+ * specified side. Used by placement logic. -+ * -+ * @param pos Block Position -+ * @param side The Side in question -+ * @param _default The default to return if the block doesn't exist. -+ * @return True if the side is solid -+ */ -+ @Override -+ public boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default) -+ { -+ if (!this.isValid(pos)) return _default; -+ -+ Chunk chunk = getChunkFromBlockCoords(pos); -+ if (chunk == null || chunk.isEmpty()) return _default; -+ return getBlockState(pos).isSideSolid(this, pos, side); -+ } -+ -+ /** -+ * Get the persistent chunks for this world -+ * -+ * @return -+ */ -+ public com.google.common.collect.ImmutableSetMultimap getPersistentChunks() -+ { -+ return net.minecraftforge.common.ForgeChunkManager.getPersistentChunksFor(this); -+ } -+ -+ public Iterator getPersistentChunkIterable(Iterator chunkIterator) -+ { -+ return net.minecraftforge.common.ForgeChunkManager.getPersistentChunksIterableFor(this, chunkIterator); -+ } -+ /** -+ * Readded as it was removed, very useful helper function -+ * -+ * @param pos Block position -+ * @return The blocks light opacity -+ */ -+ public int getBlockLightOpacity(BlockPos pos) -+ { -+ if (!this.isValid(pos)) return 0; -+ return getChunkFromBlockCoords(pos).getBlockLightOpacity(pos); -+ } -+ -+ /** -+ * Returns a count of entities that classify themselves as the specified creature type. -+ */ -+ public int countEntities(net.minecraft.entity.EnumCreatureType type, boolean forSpawnCount) -+ { -+ int count = 0; -+ for (int x = 0; x < loadedEntityList.size(); x++) -+ { -+ if (((Entity)loadedEntityList.get(x)).isCreatureType(type, forSpawnCount)) -+ { -+ count++; -+ } -+ } -+ return count; -+ } -+ -+ protected MapStorage perWorldStorage; //Moved to a getter to simulate final without being final so we can load in subclasses. -+ public MapStorage getPerWorldStorage() -+ { -+ return perWorldStorage; -+ } -+ - public void func_184135_a(Packet p_184135_1_) - { - throw new UnsupportedOperationException("Can\'t send packets to server unless you\'re on the client."); diff --git a/patches.mcp/minecraft/net/minecraft/world/WorldEntitySpawner.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldEntitySpawner.java.patch deleted file mode 100644 index 4e7af7416..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/WorldEntitySpawner.java.patch +++ /dev/null @@ -1,54 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/WorldEntitySpawner.java -+++ ../src-work/minecraft/net/minecraft/world/WorldEntitySpawner.java -@@ -77,15 +77,17 @@ - { - if ((!enumcreaturetype.getPeacefulCreature() || spawnPeacefulMobs) && (enumcreaturetype.getPeacefulCreature() || spawnHostileMobs) && (!enumcreaturetype.getAnimal() || p_77192_4_)) - { -- int k4 = worldServerIn.countEntities(enumcreaturetype.getCreatureClass()); -+ int k4 = worldServerIn.countEntities(enumcreaturetype, true); - int l4 = enumcreaturetype.getMaxNumberOfCreature() * i / MOB_COUNT_DIV; - - if (k4 <= l4) - { -+ java.util.ArrayList shuffled = com.google.common.collect.Lists.newArrayList(this.eligibleChunksForSpawning); -+ java.util.Collections.shuffle(shuffled); - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); - label415: - -- for (ChunkCoordIntPair chunkcoordintpair1 : this.eligibleChunksForSpawning) -+ for (ChunkCoordIntPair chunkcoordintpair1 : shuffled) - { - BlockPos blockpos = getRandomChunkPosition(worldServerIn, chunkcoordintpair1.chunkXPos, chunkcoordintpair1.chunkZPos); - int k1 = blockpos.getX(); -@@ -144,8 +146,10 @@ - - entityliving.setLocationAndAngles((double)f, (double)i3, (double)f1, worldServerIn.rand.nextFloat() * 360.0F, 0.0F); - -- if (entityliving.getCanSpawnHere() && entityliving.isNotColliding()) -+ net.minecraftforge.fml.common.eventhandler.Event.Result canSpawn = net.minecraftforge.event.ForgeEventFactory.canEntitySpawn(entityliving, worldServerIn, f, i3, f1); -+ if (canSpawn == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW || (canSpawn == net.minecraftforge.fml.common.eventhandler.Event.Result.DEFAULT && (entityliving.getCanSpawnHere() && entityliving.isNotColliding()))) - { -+ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(entityliving, worldServerIn, f, l3, f1)) - ientitylivingdata = entityliving.onInitialSpawn(worldServerIn.getDifficultyForLocation(new BlockPos(entityliving)), ientitylivingdata); - - if (entityliving.isNotColliding()) -@@ -158,7 +162,7 @@ - entityliving.setDead(); - } - -- if (j2 >= entityliving.getMaxSpawnedInChunk()) -+ if (i2 >= net.minecraftforge.event.ForgeEventFactory.getMaxSpawnPackSize(entityliving)) - { - continue label415; - } -@@ -211,8 +215,9 @@ - else - { - BlockPos blockpos = pos.down(); -+ IBlockState state = worldIn.getBlockState(blockpos); - -- if (!worldIn.getBlockState(blockpos).func_185896_q()) -+ if (!state.getBlock().canCreatureSpawn(state, worldIn, blockpos, spawnPlacementTypeIn)) - { - return false; - } diff --git a/patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch deleted file mode 100644 index e30b71087..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch +++ /dev/null @@ -1,384 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/WorldProvider.java -+++ ../src-work/minecraft/net/minecraft/world/WorldProvider.java -@@ -52,26 +52,12 @@ - - protected void registerWorldChunkManager() - { -- WorldType worldtype = this.worldObj.getWorldInfo().getTerrainType(); -- -- if (worldtype == WorldType.FLAT) -- { -- FlatGeneratorInfo flatgeneratorinfo = FlatGeneratorInfo.createFlatGeneratorFromString(this.worldObj.getWorldInfo().getGeneratorOptions()); -- this.worldChunkMgr = new BiomeProviderSingle(BiomeGenBase.getBiomeFromBiomeList(flatgeneratorinfo.getBiome(), Biomes.field_180279_ad)); -- } -- else if (worldtype == WorldType.DEBUG_WORLD) -- { -- this.worldChunkMgr = new BiomeProviderSingle(Biomes.plains); -- } -- else -- { -- this.worldChunkMgr = new BiomeProvider(this.worldObj.getWorldInfo()); -- } -+ this.worldChunkMgr = terrainType.getBiomeProvider(worldObj); - } - - public IChunkGenerator func_186060_c() - { -- return (IChunkGenerator)(this.terrainType == WorldType.FLAT ? new ChunkProviderFlat(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : (this.terrainType == WorldType.DEBUG_WORLD ? new ChunkProviderDebug(this.worldObj) : (this.terrainType == WorldType.CUSTOMIZED ? new ChunkProviderOverworld(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : new ChunkProviderOverworld(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings)))); -+ return terrainType.getChunkGenerator(worldObj, generatorSettings); - } - - public boolean canCoordinateBeSpawn(int x, int z) -@@ -156,7 +142,7 @@ - @SideOnly(Side.CLIENT) - public float getCloudHeight() - { -- return 128.0F; -+ return this.terrainType.getCloudHeight(); - } - - @SideOnly(Side.CLIENT) -@@ -172,13 +158,13 @@ - - public int getAverageGroundLevel() - { -- return this.terrainType == WorldType.FLAT ? 4 : this.worldObj.getSeaLevel() + 1; -+ return this.terrainType.getMinimumSpawnHeight(this.worldObj); - } - - @SideOnly(Side.CLIENT) - public double getVoidFogYFactor() - { -- return this.terrainType == WorldType.FLAT ? 1.0D : 0.03125D; -+ return this.terrainType.voidFadeMagnitude(); - } - - @SideOnly(Side.CLIENT) -@@ -212,6 +198,327 @@ - return new WorldBorder(); - } - -+ /*======================================= Forge Start =========================================*/ -+ private net.minecraftforge.client.IRenderHandler skyRenderer = null; -+ private net.minecraftforge.client.IRenderHandler cloudRenderer = null; -+ private net.minecraftforge.client.IRenderHandler weatherRenderer = null; -+ private int dimensionId; -+ -+ /** -+ * Sets the providers current dimension ID, used in default getSaveFolder() -+ * Added to allow default providers to be registered for multiple dimensions. -+ * This is to denote the exact dimension ID opposed to the 'type' in WorldType -+ * -+ * @param dim Dimension ID -+ */ -+ public void setDimension(int dim) -+ { -+ this.dimensionId = dim; -+ } -+ public int getDimension() -+ { -+ return this.dimensionId; -+ } -+ -+ /** -+ * Returns the sub-folder of the world folder that this WorldProvider saves to. -+ * EXA: DIM1, DIM-1 -+ * @return The sub-folder name to save this world's chunks to. -+ */ -+ public String getSaveFolder() -+ { -+ return (dimensionId == 0 ? null : "DIM" + dimensionId); -+ } -+ -+ /** -+ * A message to display to the user when they transfer to this dimension. -+ * -+ * @return The message to be displayed -+ */ -+ public String getWelcomeMessage() -+ { -+ if (this instanceof WorldProviderEnd) -+ { -+ return "Entering the End"; -+ } -+ else if (this instanceof WorldProviderHell) -+ { -+ return "Entering the Nether"; -+ } -+ return null; -+ } -+ -+ /** -+ * A Message to display to the user when they transfer out of this dismension. -+ * -+ * @return The message to be displayed -+ */ -+ public String getDepartMessage() -+ { -+ if (this instanceof WorldProviderEnd) -+ { -+ return "Leaving the End"; -+ } -+ else if (this instanceof WorldProviderHell) -+ { -+ return "Leaving the Nether"; -+ } -+ return null; -+ } -+ -+ /** -+ * The dimensions movement factor. Relative to normal overworld. -+ * It is applied to the players position when they transfer dimensions. -+ * Exa: Nether movement is 8.0 -+ * @return The movement factor -+ */ -+ public double getMovementFactor() -+ { -+ if (this instanceof WorldProviderHell) -+ { -+ return 8.0; -+ } -+ return 1.0; -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public net.minecraftforge.client.IRenderHandler getSkyRenderer() -+ { -+ return this.skyRenderer; -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public void setSkyRenderer(net.minecraftforge.client.IRenderHandler skyRenderer) -+ { -+ this.skyRenderer = skyRenderer; -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public net.minecraftforge.client.IRenderHandler getCloudRenderer() -+ { -+ return cloudRenderer; -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public void setCloudRenderer(net.minecraftforge.client.IRenderHandler renderer) -+ { -+ cloudRenderer = renderer; -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public net.minecraftforge.client.IRenderHandler getWeatherRenderer() -+ { -+ return weatherRenderer; -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public void setWeatherRenderer(net.minecraftforge.client.IRenderHandler renderer) -+ { -+ weatherRenderer = renderer; -+ } -+ -+ public BlockPos getRandomizedSpawnPoint() -+ { -+ BlockPos ret = this.worldObj.getSpawnPoint(); -+ -+ boolean isAdventure = worldObj.getWorldInfo().getGameType() == WorldSettings.GameType.ADVENTURE; -+ int spawnFuzz = this.worldObj instanceof WorldServer ? terrainType.getSpawnFuzz((WorldServer)this.worldObj, this.worldObj.getMinecraftServer()) : 1; -+ int border = MathHelper.floor_double(worldObj.getWorldBorder().getClosestDistance(ret.getX(), ret.getZ())); -+ if (border < spawnFuzz) spawnFuzz = border; -+ if (spawnFuzz < 1) spawnFuzz = 1; -+ int spawnFuzzHalf = spawnFuzz / 2; -+ -+ if (!getHasNoSky() && !isAdventure) -+ { -+ ret = worldObj.getTopSolidOrLiquidBlock(ret.add(worldObj.rand.nextInt(spawnFuzzHalf) - spawnFuzz, 0, worldObj.rand.nextInt(spawnFuzzHalf) - spawnFuzz)); -+ } -+ -+ return ret; -+ } -+ /** -+ * Determine if the cursor on the map should 'spin' when rendered, like it does for the player in the nether. -+ * -+ * @param entity The entity holding the map, playername, or frame-ENTITYID -+ * @param x X Position -+ * @param y Y Position -+ * @param z Z Position -+ * @return True to 'spin' the cursor -+ */ -+ public boolean shouldMapSpin(String entity, double x, double y, double z) -+ { -+ return dimensionId < 0; -+ } -+ -+ /** -+ * Determines the dimension the player will be respawned in, typically this brings them back to the overworld. -+ * -+ * @param player The player that is respawning -+ * @return The dimension to respawn the player in -+ */ -+ public int getRespawnDimension(net.minecraft.entity.player.EntityPlayerMP player) -+ { -+ return 0; -+ } -+ -+ /*======================================= Start Moved From World =========================================*/ -+ -+ public BiomeGenBase getBiomeGenForCoords(BlockPos pos) -+ { -+ return worldObj.getBiomeGenForCoordsBody(pos); -+ } -+ -+ public boolean isDaytime() -+ { -+ return worldObj.getSkylightSubtracted() < 4; -+ } -+ -+ /** -+ * The current sun brightness factor for this dimension. -+ * 0.0f means no light at all, and 1.0f means maximum sunlight. -+ * This will be used for the "calculateSkylightSubtracted" -+ * which is for Sky light value calculation. -+ * -+ * @return The current brightness factor -+ * */ -+ public float getSunBrightnessFactor(float par1) -+ { -+ return worldObj.getSunBrightnessFactor(par1); -+ } -+ -+ /** -+ * Calculates the current moon phase factor. -+ * This factor is effective for slimes. -+ * (This method do not affect the moon rendering) -+ * */ -+ public float getCurrentMoonPhaseFactor() -+ { -+ return worldObj.getCurrentMoonPhaseFactorBody(); -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public Vec3d getSkyColor(net.minecraft.entity.Entity cameraEntity, float partialTicks) -+ { -+ return worldObj.getSkyColorBody(cameraEntity, partialTicks); -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public Vec3d getCloudColor(float partialTicks) -+ { -+ return worldObj.getCloudColorBody(partialTicks); -+ } -+ -+ /** -+ * Gets the Sun Brightness for rendering sky. -+ * */ -+ @SideOnly(Side.CLIENT) -+ public float getSunBrightness(float par1) -+ { -+ return worldObj.getSunBrightnessBody(par1); -+ } -+ -+ /** -+ * Gets the Star Brightness for rendering sky. -+ * */ -+ @SideOnly(Side.CLIENT) -+ public float getStarBrightness(float par1) -+ { -+ return worldObj.getStarBrightnessBody(par1); -+ } -+ -+ public void setAllowedSpawnTypes(boolean allowHostile, boolean allowPeaceful) -+ { -+ worldObj.spawnHostileMobs = allowHostile; -+ worldObj.spawnPeacefulMobs = allowPeaceful; -+ } -+ -+ public void calculateInitialWeather() -+ { -+ worldObj.calculateInitialWeatherBody(); -+ } -+ -+ public void updateWeather() -+ { -+ worldObj.updateWeatherBody(); -+ } -+ -+ public boolean canBlockFreeze(BlockPos pos, boolean byWater) -+ { -+ return worldObj.canBlockFreezeBody(pos, byWater); -+ } -+ -+ public boolean canSnowAt(BlockPos pos, boolean checkLight) -+ { -+ return worldObj.canSnowAtBody(pos, checkLight); -+ } -+ public void setWorldTime(long time) -+ { -+ worldObj.worldInfo.setWorldTime(time); -+ } -+ -+ public long getSeed() -+ { -+ return worldObj.worldInfo.getSeed(); -+ } -+ -+ public long getWorldTime() -+ { -+ return worldObj.worldInfo.getWorldTime(); -+ } -+ -+ public BlockPos getSpawnPoint() -+ { -+ net.minecraft.world.storage.WorldInfo info = worldObj.worldInfo; -+ return new BlockPos(info.getSpawnX(), info.getSpawnY(), info.getSpawnZ()); -+ } -+ -+ public void setSpawnPoint(BlockPos pos) -+ { -+ worldObj.worldInfo.setSpawn(pos); -+ } -+ -+ public boolean canMineBlock(net.minecraft.entity.player.EntityPlayer player, BlockPos pos) -+ { -+ return worldObj.canMineBlockBody(player, pos); -+ } -+ -+ public boolean isBlockHighHumidity(BlockPos pos) -+ { -+ return worldObj.getBiomeGenForCoords(pos).isHighHumidity(); -+ } -+ -+ public int getHeight() -+ { -+ return 256; -+ } -+ -+ public int getActualHeight() -+ { -+ return hasNoSky ? 128 : 256; -+ } -+ -+ public double getHorizon() -+ { -+ return worldObj.worldInfo.getTerrainType().getHorizon(worldObj); -+ } -+ -+ public void resetRainAndThunder() -+ { -+ worldObj.worldInfo.setRainTime(0); -+ worldObj.worldInfo.setRaining(false); -+ worldObj.worldInfo.setThunderTime(0); -+ worldObj.worldInfo.setThundering(false); -+ } -+ -+ public boolean canDoLightning(net.minecraft.world.chunk.Chunk chunk) -+ { -+ return true; -+ } -+ -+ public boolean canDoRainSnowIce(net.minecraft.world.chunk.Chunk chunk) -+ { -+ return true; -+ } -+ - public void func_186061_a(EntityPlayerMP p_186061_1_) - { - } diff --git a/patches.mcp/minecraft/net/minecraft/world/WorldProviderSurface.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldProviderSurface.java.patch deleted file mode 100644 index d9aeb58c8..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/WorldProviderSurface.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/WorldProviderSurface.java -+++ ../src-work/minecraft/net/minecraft/world/WorldProviderSurface.java -@@ -9,6 +9,6 @@ - - public boolean func_186056_c(int p_186056_1_, int p_186056_2_) - { -- return !this.worldObj.isSpawnChunk(p_186056_1_, p_186056_2_); -+ return !this.worldObj.isSpawnChunk(p_186056_1_, p_186056_2_) || !net.minecraftforge.common.DimensionManager.shouldLoadSpawn(this.worldObj.provider.getDimension()); - } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch deleted file mode 100644 index 3c4eda114..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch +++ /dev/null @@ -1,258 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/WorldServer.java -+++ ../src-work/minecraft/net/minecraft/world/WorldServer.java -@@ -97,30 +97,39 @@ - private int blockEventCacheIndex; - private List pendingTickListEntriesThisTick = Lists.newArrayList(); - -+ /** Stores the recently processed (lighting) chunks */ -+ protected Set doneChunks = new java.util.HashSet(); -+ public List customTeleporters = new ArrayList(); -+ - public WorldServer(MinecraftServer server, ISaveHandler saveHandlerIn, WorldInfo info, int dimensionId, Profiler profilerIn) - { - super(saveHandlerIn, info, DimensionType.func_186069_a(dimensionId).func_186070_d(), profilerIn, false); - this.mcServer = server; - this.theEntityTracker = new EntityTracker(this); - this.thePlayerManager = new PlayerManager(this); -+ // Guarantee the dimension ID was not reset by the provider -+ int providerDim = this.provider.getDimension(); - this.provider.registerWorld(this); -+ this.provider.setDimension(providerDim); - this.chunkProvider = this.createChunkProvider(); -+ perWorldStorage = new MapStorage(new net.minecraftforge.common.WorldSpecificSaveHandler((WorldServer)this, saveHandlerIn)); - this.worldTeleporter = new Teleporter(this); - this.calculateInitialSkylight(); - this.calculateInitialWeather(); - this.getWorldBorder().setSize(server.getMaxWorldSize()); -+ net.minecraftforge.common.DimensionManager.setWorld(dimensionId, this, mcServer); - } - - public World init() - { - this.mapStorage = new MapStorage(this.saveHandler); - String s = VillageCollection.fileNameForProvider(this.provider); -- VillageCollection villagecollection = (VillageCollection)this.mapStorage.loadData(VillageCollection.class, s); -+ VillageCollection villagecollection = (VillageCollection)this.perWorldStorage.loadData(VillageCollection.class, s); - - if (villagecollection == null) - { - this.villageCollectionObj = new VillageCollection(this); -- this.mapStorage.setData(s, this.villageCollectionObj); -+ this.perWorldStorage.setData(s, this.villageCollectionObj); - } - else - { -@@ -214,6 +223,10 @@ - this.villageSiege.tick(); - this.theProfiler.endStartSection("portalForcer"); - this.worldTeleporter.removeStalePortalLocations(this.getTotalWorldTime()); -+ for (Teleporter tele : customTeleporters) -+ { -+ tele.removeStalePortalLocations(getTotalWorldTime()); -+ } - this.theProfiler.endSection(); - this.sendQueuedBlockEvents(); - } -@@ -221,12 +234,14 @@ - public BiomeGenBase.SpawnListEntry getSpawnListEntryForTypeAt(EnumCreatureType creatureType, BlockPos pos) - { - List list = this.getChunkProvider().getPossibleCreatures(creatureType, pos); -+ list = net.minecraftforge.event.ForgeEventFactory.getPotentialSpawns(this, creatureType, pos, list); - return list != null && !list.isEmpty() ? (BiomeGenBase.SpawnListEntry)WeightedRandom.getRandomItem(this.rand, list) : null; - } - - public boolean canCreatureTypeSpawnHere(EnumCreatureType creatureType, BiomeGenBase.SpawnListEntry spawnListEntry, BlockPos pos) - { - List list = this.getChunkProvider().getPossibleCreatures(creatureType, pos); -+ list = net.minecraftforge.event.ForgeEventFactory.getPotentialSpawns(this, creatureType, pos, list); - return list != null && !list.isEmpty() ? list.contains(spawnListEntry) : false; - } - -@@ -272,10 +287,7 @@ - - private void resetRainAndThunder() - { -- this.worldInfo.setRainTime(0); -- this.worldInfo.setRaining(false); -- this.worldInfo.setThunderTime(0); -- this.worldInfo.setThundering(false); -+ this.provider.resetRainAndThunder(); - } - - public boolean areAllPlayersAsleep() -@@ -368,7 +380,7 @@ - boolean flag1 = this.isThundering(); - this.theProfiler.startSection("pollingChunks"); - -- for (Iterator iterator = this.thePlayerManager.func_187300_b(); iterator.hasNext(); this.theProfiler.endSection()) -+ for (Iterator iterator = getPersistentChunkIterable(this.thePlayerManager.func_187300_b()); iterator.hasNext(); this.theProfiler.endSection()) - { - this.theProfiler.startSection("getChunk"); - Chunk chunk = (Chunk)iterator.next(); -@@ -380,7 +392,7 @@ - chunk.func_150804_b(false); - this.theProfiler.endStartSection("thunder"); - -- if (flag && flag1 && this.rand.nextInt(100000) == 0) -+ if (this.provider.canDoLightning(chunk) && flag && flag1 && this.rand.nextInt(100000) == 0) - { - this.updateLCG = this.updateLCG * 3 + 1013904223; - int l = this.updateLCG >> 2; -@@ -409,7 +421,7 @@ - - this.theProfiler.endStartSection("iceandsnow"); - -- if (this.rand.nextInt(16) == 0) -+ if (this.provider.canDoRainSnowIce(chunk) && this.rand.nextInt(16) == 0) - { - this.updateLCG = this.updateLCG * 3 + 1013904223; - int j2 = this.updateLCG >> 2; -@@ -527,6 +539,9 @@ - if (blockIn.requiresUpdates()) - { - i = 8; -+ //Keeping here as a note for future when it may be restored. -+ boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(pos.getX() >> 4, pos.getZ() >> 4)); -+ i = isForced ? 0 : 8; - - if (this.isAreaLoaded(pos.add(-i, -i, -i), pos.add(i, i, i))) - { -@@ -588,7 +603,7 @@ - - public void updateEntities() - { -- if (this.playerEntities.isEmpty()) -+ if (this.playerEntities.isEmpty() && getPersistentChunks().isEmpty()) - { - if (this.updateEntityTick++ >= 300) - { -@@ -712,6 +727,9 @@ - { - NextTickListEntry nextticklistentry1 = (NextTickListEntry)iterator.next(); - iterator.remove(); -+ //Keeping here as a note for future when it may be restored. -+ //boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(nextticklistentry.xCoord >> 4, nextticklistentry.zCoord >> 4)); -+ //byte b0 = isForced ? 0 : 8; - int k = 0; - - if (this.isAreaLoaded(nextticklistentry1.position.add(-k, -k, -k), nextticklistentry1.position.add(k, k, k))) -@@ -838,22 +856,40 @@ - { - List list = Lists.newArrayList(); - -- for (int i = 0; i < this.loadedTileEntityList.size(); ++i) -+ //Forge: Optimize this loop to only grab from the chunks it needs -+ for (int x = (minX & ~0x0F); x < maxX; x += 16) - { -- TileEntity tileentity = (TileEntity)this.loadedTileEntityList.get(i); -- BlockPos blockpos = tileentity.getPos(); -- -- if (blockpos.getX() >= minX && blockpos.getY() >= minY && blockpos.getZ() >= minZ && blockpos.getX() < maxX && blockpos.getY() < maxY && blockpos.getZ() < maxZ) -+ for (int z = (minZ & ~0x0F); z < maxZ; z += 16) // & ~0xF Floors it by 16. Yay bitmath! - { -- list.add(tileentity); -+ if (!this.isChunkLoaded(x >> 4, z >> 4, true)) continue; //Prevent loading extra chunks to just read data. This causes orphaned chunks that never unload. -+ Chunk chunk = this.getChunkFromChunkCoords(x >> 4, z >> 4); -+ if (chunk != null && !chunk.isEmpty()) -+ { -+ for (TileEntity entity : chunk.getTileEntityMap().values()) -+ { -+ if (!entity.isInvalid()) -+ { -+ BlockPos pos = entity.getPos(); -+ if (pos.getX() >= minX && pos.getY() >= minY && pos.getZ() >= minZ && -+ pos.getX() < maxX && pos.getY() < maxY && pos.getZ() < maxZ) -+ { -+ list.add(entity); -+ } -+ -+ } -+ } -+ } - } - } -- - return list; - } - - public boolean isBlockModifiable(EntityPlayer player, BlockPos pos) - { -+ return super.isBlockModifiable(player, pos); -+ } -+ public boolean canMineBlockBody(EntityPlayer player, BlockPos pos) -+ { - return !this.mcServer.isBlockProtected(this, pos, player) && this.getWorldBorder().contains(pos); - } - -@@ -919,6 +955,7 @@ - } - else - { -+ if (net.minecraftforge.event.ForgeEventFactory.onCreateWorldSpawn(this, p_73052_1_)) return; - this.findingSpawnPoint = true; - BiomeProvider biomeprovider = this.provider.getWorldChunkManager(); - List list = biomeprovider.getBiomesToSpawnIn(); -@@ -1003,6 +1040,7 @@ - } - - chunkproviderserver.func_186027_a(p_73044_1_); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Save(this)); - - for (Chunk chunk : Lists.newArrayList(chunkproviderserver.func_152380_a())) - { -@@ -1047,6 +1085,7 @@ - this.worldInfo.setBorderLerpTime(this.getWorldBorder().getTimeUntilTarget()); - this.saveHandler.saveWorldInfoWithPlayer(this.worldInfo, this.mcServer.func_184103_al().getHostPlayerData()); - this.mapStorage.saveAllData(); -+ this.perWorldStorage.saveAllData(); - } - - public boolean spawnEntityInWorld(Entity entityIn) -@@ -1161,6 +1200,7 @@ - public Explosion newExplosion(Entity entityIn, double x, double y, double z, float strength, boolean isFlaming, boolean isSmoking) - { - Explosion explosion = new Explosion(this, entityIn, x, y, z, strength, isFlaming, isSmoking); -+ if (net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this, explosion)) return explosion; - explosion.doExplosionA(); - explosion.doExplosionB(false); - -@@ -1240,19 +1280,23 @@ - this.mcServer.func_184103_al().sendPacketToAllPlayersInDimension(new SPacketChangeGameState(8, this.thunderingStrength), this.provider.func_186058_p().func_186068_a()); - } - -+ /* The function in use here has been replaced in order to only send the weather info to players in the correct dimension, -+ * rather than to all players on the server. This is what causes the client-side rain, as the -+ * client believes that it has started raining locally, rather than in another dimension. -+ */ - if (flag != this.isRaining()) - { - if (flag) - { -- this.mcServer.func_184103_al().sendPacketToAllPlayers(new SPacketChangeGameState(2, 0.0F)); -+ this.mcServer.func_184103_al().sendPacketToAllPlayersInDimension(new SPacketChangeGameState(2, 0.0F), this.provider.getDimension()); - } - else - { -- this.mcServer.func_184103_al().sendPacketToAllPlayers(new SPacketChangeGameState(1, 0.0F)); -+ this.mcServer.func_184103_al().sendPacketToAllPlayersInDimension(new SPacketChangeGameState(1, 0.0F), this.provider.getDimension()); - } - -- this.mcServer.func_184103_al().sendPacketToAllPlayers(new SPacketChangeGameState(7, this.rainingStrength)); -- this.mcServer.func_184103_al().sendPacketToAllPlayers(new SPacketChangeGameState(8, this.thunderingStrength)); -+ this.mcServer.func_184103_al().sendPacketToAllPlayersInDimension(new SPacketChangeGameState(7, this.rainingStrength), this.provider.getDimension()); -+ this.mcServer.func_184103_al().sendPacketToAllPlayersInDimension(new SPacketChangeGameState(8, this.thunderingStrength), this.provider.getDimension()); - } - } - -@@ -1329,6 +1373,11 @@ - return this.mcServer.isCallingFromMinecraftThread(); - } - -+ public java.io.File getChunkSaveLocation() -+ { -+ return ((net.minecraft.world.chunk.storage.AnvilChunkLoader)getChunkProvider().chunkLoader).chunkSaveLocation; -+ } -+ - static class ServerBlockEventList extends ArrayList - { - private ServerBlockEventList() diff --git a/patches.mcp/minecraft/net/minecraft/world/WorldServerMulti.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldServerMulti.java.patch deleted file mode 100644 index e99624d76..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/WorldServerMulti.java.patch +++ /dev/null @@ -1,62 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/WorldServerMulti.java -+++ ../src-work/minecraft/net/minecraft/world/WorldServerMulti.java -@@ -11,12 +11,13 @@ - public class WorldServerMulti extends WorldServer - { - private WorldServer delegate; -+ private IBorderListener borderListener; - - public WorldServerMulti(MinecraftServer server, ISaveHandler saveHandlerIn, int dimensionId, WorldServer delegate, Profiler profilerIn) - { - super(server, saveHandlerIn, new DerivedWorldInfo(delegate.getWorldInfo()), dimensionId, profilerIn); - this.delegate = delegate; -- delegate.getWorldBorder().addListener(new IBorderListener() -+ this.borderListener = new IBorderListener() - { - public void onSizeChanged(WorldBorder border, double newSize) - { -@@ -46,11 +47,13 @@ - { - WorldServerMulti.this.getWorldBorder().setDamageBuffer(newSize); - } -- }); -+ }; -+ this.delegate.getWorldBorder().addListener(this.borderListener); - } - - protected void saveLevel() throws MinecraftException - { -+ this.perWorldStorage.saveAllData(); - } - - public World init() -@@ -59,12 +62,12 @@ - this.worldScoreboard = this.delegate.getScoreboard(); - this.field_184151_B = this.delegate.func_184146_ak(); - String s = VillageCollection.fileNameForProvider(this.provider); -- VillageCollection villagecollection = (VillageCollection)this.mapStorage.loadData(VillageCollection.class, s); -+ VillageCollection villagecollection = (VillageCollection)this.perWorldStorage.loadData(VillageCollection.class, s); - - if (villagecollection == null) - { - this.villageCollectionObj = new VillageCollection(this); -- this.mapStorage.setData(s, this.villageCollectionObj); -+ this.perWorldStorage.setData(s, this.villageCollectionObj); - } - else - { -@@ -75,6 +78,14 @@ - return this; - } - -+ -+ @Override -+ public void flush() -+ { -+ super.flush(); -+ this.delegate.getWorldBorder().removeListener(this.borderListener); // Unlink ourselves, to prevent world leak. -+ } -+ - public void func_184166_c() - { - this.provider.func_186057_q(); diff --git a/patches.mcp/minecraft/net/minecraft/world/WorldType.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldType.java.patch deleted file mode 100644 index a727426d4..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/WorldType.java.patch +++ /dev/null @@ -1,166 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/WorldType.java -+++ ../src-work/minecraft/net/minecraft/world/WorldType.java -@@ -1,5 +1,9 @@ - package net.minecraft.world; - -+import net.minecraft.world.chunk.IChunkGenerator; -+import net.minecraft.world.gen.ChunkProviderDebug; -+import net.minecraft.world.gen.ChunkProviderFlat; -+import net.minecraft.world.gen.ChunkProviderOverworld; - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - -@@ -27,6 +31,7 @@ - - private WorldType(int id, String name, int version) - { -+ if (name.length() > 16 && DEBUG_WORLD != null) throw new IllegalArgumentException("World type names must not be longer then 16: " + name); - this.worldType = name; - this.generatorVersion = version; - this.canBeCreated = true; -@@ -113,4 +118,145 @@ - this.hasNotificationData = true; - return this; - } -+ -+ public net.minecraft.world.biome.BiomeProvider getBiomeProvider(World world) -+ { -+ if (this == FLAT) -+ { -+ net.minecraft.world.gen.FlatGeneratorInfo flatgeneratorinfo = net.minecraft.world.gen.FlatGeneratorInfo.createFlatGeneratorFromString(world.getWorldInfo().getGeneratorOptions()); -+ return new net.minecraft.world.biome.BiomeProviderSingle(net.minecraft.world.biome.BiomeGenBase.getBiomeFromBiomeList(flatgeneratorinfo.getBiome(), net.minecraft.init.Biomes.field_180279_ad)); -+ } -+ else if (this == DEBUG_WORLD) -+ { -+ return new net.minecraft.world.biome.BiomeProviderSingle(net.minecraft.init.Biomes.plains); -+ } -+ else -+ { -+ return new net.minecraft.world.biome.BiomeProvider(world.getWorldInfo()); -+ } -+ } -+ -+ public net.minecraft.world.chunk.IChunkGenerator getChunkGenerator(World world, String generatorOptions) -+ { -+ if (this == FLAT) return new net.minecraft.world.gen.ChunkProviderFlat(world, world.getSeed(), world.getWorldInfo().isMapFeaturesEnabled(), generatorOptions); -+ if (this == DEBUG_WORLD) return new net.minecraft.world.gen.ChunkProviderDebug(world); -+ if (this == CUSTOMIZED) return new net.minecraft.world.gen.ChunkProviderOverworld(world, world.getSeed(), world.getWorldInfo().isMapFeaturesEnabled(), generatorOptions); -+ return new net.minecraft.world.gen.ChunkProviderOverworld(world, world.getSeed(), world.getWorldInfo().isMapFeaturesEnabled(), generatorOptions); -+ } -+ -+ public int getMinimumSpawnHeight(World world) -+ { -+ return this == FLAT ? 4 : 64; -+ } -+ -+ public double getHorizon(World world) -+ { -+ return this == FLAT ? 0.0D : 63.0D; -+ } -+ -+ public double voidFadeMagnitude() -+ { -+ return this == FLAT ? 1.0D : 0.03125D; -+ } -+ -+ public boolean handleSlimeSpawnReduction(java.util.Random random, World world) -+ { -+ return this == FLAT ? random.nextInt(4) != 1 : false; -+ } -+ -+ /*=================================================== FORGE START ======================================*/ -+ private static int getNextID() -+ { -+ for (int x = 0; x < worldTypes.length; x++) -+ { -+ if (worldTypes[x] == null) -+ { -+ return x; -+ } -+ } -+ -+ int oldLen = worldTypes.length; -+ worldTypes = java.util.Arrays.copyOf(worldTypes, oldLen + 16); -+ return oldLen; -+ } -+ -+ /** -+ * Creates a new world type, the ID is hidden and should not be referenced by modders. -+ * It will automatically expand the underlying workdType array if there are no IDs left. -+ * @param name -+ */ -+ public WorldType(String name) -+ { -+ this(getNextID(), name); -+ } -+ -+ /** -+ * Called when 'Create New World' button is pressed before starting game -+ */ -+ public void onGUICreateWorldPress() { } -+ -+ /** -+ * Gets the spawn fuzz for players who join the world. -+ * Useful for void world types. -+ * @return Fuzz for entity initial spawn in blocks. -+ */ -+ public int getSpawnFuzz(WorldServer world, net.minecraft.server.MinecraftServer server) -+ { -+ return Math.max(0, server.func_184108_a(world)); -+ } -+ -+ /** -+ * Called when the 'Customize' button is pressed on world creation GUI -+ * @param mc The Minecraft instance -+ * @param guiCreateWorld the createworld GUI -+ */ -+ @SideOnly(Side.CLIENT) -+ public void onCustomizeButton(net.minecraft.client.Minecraft mc, net.minecraft.client.gui.GuiCreateWorld guiCreateWorld) -+ { -+ if (this == WorldType.FLAT) -+ { -+ mc.displayGuiScreen(new net.minecraft.client.gui.GuiCreateFlatWorld(guiCreateWorld, guiCreateWorld.chunkProviderSettingsJson)); -+ } -+ else if (this == WorldType.CUSTOMIZED) -+ { -+ mc.displayGuiScreen(new net.minecraft.client.gui.GuiCustomizeWorldScreen(guiCreateWorld, guiCreateWorld.chunkProviderSettingsJson)); -+ } -+ } -+ -+ /** -+ * Should world creation GUI show 'Customize' button for this world type? -+ * @return if this world type has customization parameters -+ */ -+ public boolean isCustomizable() -+ { -+ return this == FLAT || this == WorldType.CUSTOMIZED; -+ } -+ -+ -+ /** -+ * Get the height to render the clouds for this world type -+ * @return The height to render clouds at -+ */ -+ public float getCloudHeight() -+ { -+ return 128.0F; -+ } -+ -+ /** -+ * Creates the GenLayerBiome used for generating the world with the specified ChunkProviderSettings JSON String -+ * *IF AND ONLY IF* this WorldType == WorldType.CUSTOMIZED. -+ * -+ * -+ * @param worldSeed The world seed -+ * @param parentLayer The parent layer to feed into any layer you return -+ * @param chunkProviderSettingsJson The JSON string to use when initializing ChunkProviderSettings.Factory -+ * @return A GenLayer that will return ints representing the Biomes to be generated, see GenLayerBiome -+ */ -+ public net.minecraft.world.gen.layer.GenLayer getBiomeLayer(long worldSeed, net.minecraft.world.gen.layer.GenLayer parentLayer, String chunkProviderSettingsJson) -+ { -+ net.minecraft.world.gen.layer.GenLayer ret = new net.minecraft.world.gen.layer.GenLayerBiome(200L, parentLayer, this, chunkProviderSettingsJson); -+ ret = net.minecraft.world.gen.layer.GenLayerZoom.magnify(1000L, ret, 2); -+ ret = new net.minecraft.world.gen.layer.GenLayerBiomeEdge(1000L, ret); -+ return ret; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch deleted file mode 100644 index 9a93d4f6d..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch +++ /dev/null @@ -1,167 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeDecorator.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeDecorator.java -@@ -91,8 +91,10 @@ - - protected void genDecorations(BiomeGenBase biomeGenBaseIn, World p_150513_2_, Random p_150513_3_) - { -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Pre(p_150513_2_, p_150513_3_, field_180294_c)); - this.generateOres(p_150513_2_, p_150513_3_); - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SAND)) - for (int i = 0; i < this.sandPerChunk2; ++i) - { - int j = p_150513_3_.nextInt(16) + 8; -@@ -100,6 +102,7 @@ - this.sandGen.generate(p_150513_2_, p_150513_3_, p_150513_2_.getTopSolidOrLiquidBlock(this.field_180294_c.add(j, 0, k))); - } - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.CLAY)) - for (int i1 = 0; i1 < this.clayPerChunk; ++i1) - { - int l1 = p_150513_3_.nextInt(16) + 8; -@@ -107,6 +110,7 @@ - this.clayGen.generate(p_150513_2_, p_150513_3_, p_150513_2_.getTopSolidOrLiquidBlock(this.field_180294_c.add(l1, 0, i6))); - } - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SAND_PASS2)) - for (int j1 = 0; j1 < this.sandPerChunk; ++j1) - { - int i2 = p_150513_3_.nextInt(16) + 8; -@@ -121,6 +125,7 @@ - ++k1; - } - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.TREE)) - for (int j2 = 0; j2 < k1; ++j2) - { - int k6 = p_150513_3_.nextInt(16) + 8; -@@ -135,6 +140,7 @@ - } - } - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.BIG_SHROOM)) - for (int k2 = 0; k2 < this.bigMushroomsPerChunk; ++k2) - { - int l6 = p_150513_3_.nextInt(16) + 8; -@@ -142,6 +148,7 @@ - this.bigMushroomGen.generate(p_150513_2_, p_150513_3_, p_150513_2_.getHeight(this.field_180294_c.add(l6, 0, k10))); - } - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.FLOWERS)) - for (int l2 = 0; l2 < this.flowersPerChunk; ++l2) - { - int i7 = p_150513_3_.nextInt(16) + 8; -@@ -163,6 +170,7 @@ - } - } - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.GRASS)) - for (int i3 = 0; i3 < this.grassPerChunk; ++i3) - { - int j7 = p_150513_3_.nextInt(16) + 8; -@@ -176,6 +184,7 @@ - } - } - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.DEAD_BUSH)) - for (int j3 = 0; j3 < this.deadBushPerChunk; ++j3) - { - int k7 = p_150513_3_.nextInt(16) + 8; -@@ -189,6 +198,7 @@ - } - } - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.LILYPAD)) - for (int k3 = 0; k3 < this.waterlilyPerChunk; ++k3) - { - int l7 = p_150513_3_.nextInt(16) + 8; -@@ -215,6 +225,8 @@ - } - } - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SHROOM)) -+ { - for (int l3 = 0; l3 < this.mushroomsPerChunk; ++l3) - { - if (p_150513_3_.nextInt(4) == 0) -@@ -265,7 +277,9 @@ - this.mushroomRedGen.generate(p_150513_2_, p_150513_3_, this.field_180294_c.add(j4, l15, l8)); - } - } -- -+ } // End of Mushroom generation -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.REED)) -+ { - for (int k4 = 0; k4 < this.reedsPerChunk; ++k4) - { - int i9 = p_150513_3_.nextInt(16) + 8; -@@ -291,7 +305,8 @@ - this.reedGen.generate(p_150513_2_, p_150513_3_, this.field_180294_c.add(j9, i19, i13)); - } - } -- -+ } // End of Reed generation -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.PUMPKIN)) - if (p_150513_3_.nextInt(32) == 0) - { - int i5 = p_150513_3_.nextInt(16) + 8; -@@ -305,6 +320,7 @@ - } - } - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.CACTUS)) - for (int j5 = 0; j5 < this.cactiPerChunk; ++j5) - { - int l9 = p_150513_3_.nextInt(16) + 8; -@@ -320,6 +336,7 @@ - - if (this.generateLakes) - { -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.LAKE_WATER)) - for (int k5 = 0; k5 < 50; ++k5) - { - int i10 = p_150513_3_.nextInt(16) + 8; -@@ -334,6 +351,7 @@ - } - } - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.LAKE_LAVA)) - for (int l5 = 0; l5 < 20; ++l5) - { - int j10 = p_150513_3_.nextInt(16) + 8; -@@ -343,21 +361,35 @@ - (new WorldGenLiquids(Blocks.flowing_lava)).generate(p_150513_2_, p_150513_3_, blockpos3); - } - } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Post(p_150513_2_, p_150513_3_, field_180294_c)); - } - - protected void generateOres(World p_76797_1_, Random p_76797_2_) - { -+ net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Pre(p_76797_1_, p_76797_2_, field_180294_c)); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, dirtGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIRT)) - this.genStandardOre1(p_76797_1_, p_76797_2_, this.chunkProviderSettings.dirtCount, this.dirtGen, this.chunkProviderSettings.dirtMinHeight, this.chunkProviderSettings.dirtMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, gravelGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GRAVEL)) - this.genStandardOre1(p_76797_1_, p_76797_2_, this.chunkProviderSettings.gravelCount, this.gravelGen, this.chunkProviderSettings.gravelMinHeight, this.chunkProviderSettings.gravelMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, dioriteGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIORITE)) - this.genStandardOre1(p_76797_1_, p_76797_2_, this.chunkProviderSettings.dioriteCount, this.dioriteGen, this.chunkProviderSettings.dioriteMinHeight, this.chunkProviderSettings.dioriteMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, graniteGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GRANITE)) - this.genStandardOre1(p_76797_1_, p_76797_2_, this.chunkProviderSettings.graniteCount, this.graniteGen, this.chunkProviderSettings.graniteMinHeight, this.chunkProviderSettings.graniteMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, andesiteGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.ANDESITE)) - this.genStandardOre1(p_76797_1_, p_76797_2_, this.chunkProviderSettings.andesiteCount, this.andesiteGen, this.chunkProviderSettings.andesiteMinHeight, this.chunkProviderSettings.andesiteMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, coalGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.COAL)) - this.genStandardOre1(p_76797_1_, p_76797_2_, this.chunkProviderSettings.coalCount, this.coalGen, this.chunkProviderSettings.coalMinHeight, this.chunkProviderSettings.coalMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, ironGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.IRON)) - this.genStandardOre1(p_76797_1_, p_76797_2_, this.chunkProviderSettings.ironCount, this.ironGen, this.chunkProviderSettings.ironMinHeight, this.chunkProviderSettings.ironMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, goldGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GOLD)) - this.genStandardOre1(p_76797_1_, p_76797_2_, this.chunkProviderSettings.goldCount, this.goldGen, this.chunkProviderSettings.goldMinHeight, this.chunkProviderSettings.goldMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, redstoneGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.REDSTONE)) - this.genStandardOre1(p_76797_1_, p_76797_2_, this.chunkProviderSettings.redstoneCount, this.redstoneGen, this.chunkProviderSettings.redstoneMinHeight, this.chunkProviderSettings.redstoneMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, diamondGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIAMOND)) - this.genStandardOre1(p_76797_1_, p_76797_2_, this.chunkProviderSettings.diamondCount, this.diamondGen, this.chunkProviderSettings.diamondMinHeight, this.chunkProviderSettings.diamondMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, lapisGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.LAPIS)) - this.genStandardOre2(p_76797_1_, p_76797_2_, this.chunkProviderSettings.lapisCount, this.lapisGen, this.chunkProviderSettings.lapisCenterHeight, this.chunkProviderSettings.lapisSpread); -+ net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Post(p_76797_1_, p_76797_2_, field_180294_c)); - } - - protected void genStandardOre1(World blockCount, Random generator, int minHeight, WorldGenerator maxHeight, int p_76795_5_, int p_76795_6_) diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch deleted file mode 100644 index 826d96b12..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch +++ /dev/null @@ -1,127 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenBase.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenBase.java -@@ -70,7 +70,7 @@ - protected static final WorldGenTrees worldGeneratorTrees = new WorldGenTrees(false); - protected static final WorldGenBigTree worldGeneratorBigTree = new WorldGenBigTree(false); - protected static final WorldGenSwamp worldGeneratorSwamp = new WorldGenSwamp(); -- public static final RegistryNamespaced field_185377_q = new RegistryNamespaced(); -+ public static final RegistryNamespaced field_185377_q = net.minecraftforge.fml.common.registry.GameData.getBiomeRegistry(); - private final String biomeName; - private final float minHeight; - private final float maxHeight; -@@ -128,11 +128,12 @@ - this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityWitch.class, 5, 1, 1)); - this.spawnableWaterCreatureList.add(new BiomeGenBase.SpawnListEntry(EntitySquid.class, 10, 4, 4)); - this.spawnableCaveCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityBat.class, 10, 8, 8)); -+ this.addDefaultFlowers(); - } - - public BiomeDecorator createBiomeDecorator() - { -- return new BiomeDecorator(); -+ return getModdedBiomeDecorator(new BiomeDecorator()); - } - - public boolean func_185363_b() -@@ -228,7 +229,7 @@ - { - double d0 = (double)MathHelper.clamp_float(this.getFloatTemperature(pos), 0.0F, 1.0F); - double d1 = (double)MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F); -- return ColorizerGrass.getGrassColor(d0, d1); -+ return getModdedBiomeGrassColor(ColorizerGrass.getGrassColor(d0, d1)); - } - - public final void generateBiomeTerrain(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int p_180628_4_, int p_180628_5_, double p_180628_6_) -@@ -321,7 +322,7 @@ - { - double d0 = (double)MathHelper.clamp_float(this.getFloatTemperature(pos), 0.0F, 1.0F); - double d1 = (double)MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F); -- return ColorizerFoliage.getFoliageColor(d0, d1); -+ return getModdedBiomeFoliageColor(ColorizerFoliage.getFoliageColor(d0, d1)); - } - - public Class getBiomeClass() -@@ -386,6 +387,83 @@ - return this.enableSnow; - } - -+ /* ========================================= FORGE START ======================================*/ -+ protected List flowers = new java.util.ArrayList(); -+ -+ public BiomeDecorator getModdedBiomeDecorator(BiomeDecorator original) -+ { -+ return new net.minecraftforge.event.terraingen.DeferredBiomeDecorator(original); -+ } -+ -+ public int getWaterColorMultiplier() -+ { -+ net.minecraftforge.event.terraingen.BiomeEvent.GetWaterColor event = new net.minecraftforge.event.terraingen.BiomeEvent.GetWaterColor(this, waterColorMultiplier); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ return event.newColor; -+ } -+ -+ public int getModdedBiomeGrassColor(int original) -+ { -+ net.minecraftforge.event.terraingen.BiomeEvent.GetGrassColor event = new net.minecraftforge.event.terraingen.BiomeEvent.GetGrassColor(this, original); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ return event.newColor; -+ } -+ -+ public int getModdedBiomeFoliageColor(int original) -+ { -+ net.minecraftforge.event.terraingen.BiomeEvent.GetFoliageColor event = new net.minecraftforge.event.terraingen.BiomeEvent.GetFoliageColor(this, original); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ return event.newColor; -+ } -+ -+ /** -+ * Weighted random holder class used to hold possible flowers -+ * that can spawn in this biome when bonemeal is used on grass. -+ */ -+ public static class FlowerEntry extends WeightedRandom.Item -+ { -+ public final net.minecraft.block.state.IBlockState state; -+ public FlowerEntry(net.minecraft.block.state.IBlockState state, int weight) -+ { -+ super(weight); -+ this.state = state; -+ } -+ } -+ -+ /** -+ * Adds the default flowers, as of 1.7, it is 2 yellow, and 1 red. I chose 10 to allow some wiggle room in the numbers. -+ */ -+ public void addDefaultFlowers() -+ { -+ addFlower(Blocks.yellow_flower.getDefaultState().withProperty(Blocks.yellow_flower.getTypeProperty(), BlockFlower.EnumFlowerType.DANDELION), 20); -+ addFlower(Blocks.red_flower.getDefaultState().withProperty(Blocks.red_flower.getTypeProperty(), BlockFlower.EnumFlowerType.POPPY), 20); -+ } -+ -+ /** Register a new plant to be planted when bonemeal is used on grass. -+ * @param state The block to place. -+ * @param weight The weight of the plant, where red flowers are -+ * 10 and yellow flowers are 20. -+ */ -+ public void addFlower(IBlockState state, int weight) -+ { -+ this.flowers.add(new FlowerEntry(state, weight)); -+ } -+ -+ public void plantFlower(World world, Random rand, BlockPos pos) -+ { -+ FlowerEntry flower = (FlowerEntry)WeightedRandom.getRandomItem(rand, flowers); -+ if (flower == null || flower.state == null || -+ (flower.state.getBlock() instanceof net.minecraft.block.BlockBush && -+ !((net.minecraft.block.BlockBush)flower.state.getBlock()).canBlockStay(world, pos, flower.state))) -+ { -+ return; -+ } -+ -+ world.setBlockState(pos, flower.state, 3); -+ } -+ -+ /* ========================================= FORGE END ======================================*/ -+ - public static void func_185358_q() - { - func_185354_a(0, "ocean", new BiomeGenOcean((new BiomeGenBase.BiomeProperties("Ocean")).func_185398_c(-1.0F).func_185400_d(0.1F))); diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch deleted file mode 100644 index 7785a8e11..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenForest.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenForest.java -@@ -147,6 +147,22 @@ - } - } - -+ @Override -+ public void addDefaultFlowers() -+ { -+ if (field_150632_aF != BiomeGenForest.Type.FLOWER) -+ { -+ super.addDefaultFlowers(); -+ return; -+ } -+ for (BlockFlower.EnumFlowerType type : BlockFlower.EnumFlowerType.values()) -+ { -+ if (type.getBlockType() == BlockFlower.EnumFlowerColor.YELLOW) continue; -+ if (type == BlockFlower.EnumFlowerType.BLUE_ORCHID) type = BlockFlower.EnumFlowerType.POPPY; -+ addFlower(net.minecraft.init.Blocks.red_flower.getDefaultState().withProperty(net.minecraft.init.Blocks.red_flower.getTypeProperty(), type), 10); -+ } -+ } -+ - public Class getBiomeClass() - { - return BiomeGenForest.class; diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch deleted file mode 100644 index 031f46cf6..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch +++ /dev/null @@ -1,63 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenHills.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenHills.java -@@ -37,28 +37,20 @@ - public void decorate(World worldIn, Random rand, BlockPos pos) - { - super.decorate(worldIn, rand, pos); -- int i = 3 + rand.nextInt(6); -+ net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Pre(worldIn, rand, pos)); -+ WorldGenerator emeralds = new EmeraldGenerator(); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(worldIn, rand, emeralds, pos, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.EMERALD)) -+ emeralds.generate(worldIn, rand, pos); - -- for (int j = 0; j < i; ++j) -+ for (int i = 0; i < 7; ++i) - { -- int k = rand.nextInt(16); -- int l = rand.nextInt(28) + 4; -- int i1 = rand.nextInt(16); -- BlockPos blockpos = pos.add(k, l, i1); -- -- if (worldIn.getBlockState(blockpos).getBlock() == Blocks.stone) -- { -- worldIn.setBlockState(blockpos, Blocks.emerald_ore.getDefaultState(), 2); -- } -- } -- -- for (i = 0; i < 7; ++i) -- { - int j1 = rand.nextInt(16); - int k1 = rand.nextInt(64); - int l1 = rand.nextInt(16); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(worldIn, rand, theWorldGenerator, pos.add(j1, k1, l1), net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.SILVERFISH)) - this.theWorldGenerator.generate(worldIn, rand, pos.add(j1, k1, l1)); - } -+ net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Post(worldIn, rand, pos)); - } - - public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int p_180622_4_, int p_180622_5_, double p_180622_6_) -@@ -86,4 +78,24 @@ - EXTRA_TREES, - MUTATED; - } -+ -+ private static class EmeraldGenerator extends WorldGenerator -+ { -+ @Override -+ public boolean generate(World worldIn, Random rand, BlockPos pos) -+ { -+ int count = 3 + rand.nextInt(6); -+ for (int i = 0; i < count; i++) -+ { -+ BlockPos blockpos = pos.add(rand.nextInt(16), rand.nextInt(28) + 4, rand.nextInt(16)); -+ -+ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(blockpos); -+ if (state.getBlock().isReplaceableOreGen(state, worldIn, blockpos, net.minecraft.block.state.pattern.BlockMatcher.forBlock(Blocks.stone))) -+ { -+ worldIn.setBlockState(blockpos, Blocks.emerald_ore.getDefaultState(), 2); -+ } -+ } -+ return true; -+ } -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch deleted file mode 100644 index d078f7459..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenJungle.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenJungle.java -@@ -68,7 +68,9 @@ - super.decorate(worldIn, rand, pos); - int i = rand.nextInt(16) + 8; - int j = rand.nextInt(16) + 8; -- int k = rand.nextInt(worldIn.getHeight(pos.add(i, 0, j)).getY() * 2); -+ int height = worldIn.getHeight(pos.add(i, 0, j)).getY() * 2; // could == 0, which crashes nextInt -+ if (height < 1) height = 1; -+ int k = rand.nextInt(height); - (new WorldGenMelon()).generate(worldIn, rand, pos.add(i, k, j)); - WorldGenVines worldgenvines = new WorldGenVines(); - diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch deleted file mode 100644 index af1488b9c..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenPlains.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenPlains.java -@@ -92,4 +92,19 @@ - - super.decorate(worldIn, rand, pos); - } -+ -+ @Override -+ public void addDefaultFlowers() -+ { -+ BlockFlower red = net.minecraft.init.Blocks.red_flower; -+ BlockFlower yel = net.minecraft.init.Blocks.yellow_flower; -+ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.ORANGE_TULIP), 3); -+ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.RED_TULIP), 3); -+ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.PINK_TULIP), 3); -+ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.WHITE_TULIP), 3); -+ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.POPPY), 20); -+ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.HOUSTONIA), 20); -+ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.OXEYE_DAISY), 20); -+ addFlower(yel.getDefaultState().withProperty(yel.getTypeProperty(), BlockFlower.EnumFlowerType.DANDELION), 30); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch deleted file mode 100644 index c4cea2dc1..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java -@@ -86,4 +86,10 @@ - { - return 6975545; - } -+ -+ @Override -+ public void addDefaultFlowers() -+ { -+ addFlower(Blocks.red_flower.getDefaultState().withProperty(Blocks.red_flower.getTypeProperty(), BlockFlower.EnumFlowerType.BLUE_ORCHID), 10); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeProvider.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeProvider.java.patch deleted file mode 100644 index a1f44da1d..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeProvider.java.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeProvider.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeProvider.java -@@ -15,6 +15,7 @@ - - public class BiomeProvider - { -+ public static List allowedBiomes = Lists.newArrayList(Biomes.forest, Biomes.plains, Biomes.taiga, Biomes.taigaHills, Biomes.forestHills, Biomes.jungle, Biomes.jungleHills); - private GenLayer genBiomes; - private GenLayer biomeIndexLayer; - private final BiomeCache biomeCache; -@@ -23,13 +24,14 @@ - protected BiomeProvider() - { - this.biomeCache = new BiomeCache(this); -- this.biomesToSpawnIn = Lists.newArrayList(new BiomeGenBase[] {Biomes.forest, Biomes.plains, Biomes.taiga, Biomes.taigaHills, Biomes.forestHills, Biomes.jungle, Biomes.jungleHills}); -+ this.biomesToSpawnIn = Lists.newArrayList(allowedBiomes); - } - - private BiomeProvider(long seed, WorldType p_i45744_3_, String p_i45744_4_) - { - this(); - GenLayer[] agenlayer = GenLayer.initializeAllBiomeGenerators(seed, p_i45744_3_, p_i45744_4_); -+ agenlayer = getModdedBiomeGenerators(p_i45744_3_, seed, agenlayer); - this.genBiomes = agenlayer[0]; - this.biomeIndexLayer = agenlayer[1]; - } -@@ -196,4 +198,11 @@ - { - this.biomeCache.cleanupCache(); - } -+ -+ public GenLayer[] getModdedBiomeGenerators(WorldType worldType, long seed, GenLayer[] original) -+ { -+ net.minecraftforge.event.terraingen.WorldTypeEvent.InitBiomeGens event = new net.minecraftforge.event.terraingen.WorldTypeEvent.InitBiomeGens(worldType, seed, original); -+ net.minecraftforge.common.MinecraftForge.TERRAIN_GEN_BUS.post(event); -+ return event.newBiomeGens; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/border/WorldBorder.java.patch b/patches.mcp/minecraft/net/minecraft/world/border/WorldBorder.java.patch deleted file mode 100644 index 154d87191..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/border/WorldBorder.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/border/WorldBorder.java -+++ ../src-work/minecraft/net/minecraft/world/border/WorldBorder.java -@@ -277,4 +277,9 @@ - iborderlistener.onWarningDistanceChanged(this, warningDistance); - } - } -+ -+ public void removeListener(IBorderListener listener) -+ { -+ this.listeners.remove(listener); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/chunk/Chunk.java.patch b/patches.mcp/minecraft/net/minecraft/world/chunk/Chunk.java.patch deleted file mode 100644 index c44a0d49f..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/chunk/Chunk.java.patch +++ /dev/null @@ -1,294 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/chunk/Chunk.java -+++ ../src-work/minecraft/net/minecraft/world/chunk/Chunk.java -@@ -175,7 +175,7 @@ - { - IBlockState iblockstate = this.func_186032_a(j, l - 1, k); - -- if (iblockstate.func_185891_c() != 0) -+ if (iblockstate.getLightOpacity(this.worldObj, new BlockPos(j, l - 1, k)) != 0) - { - this.heightMap[k << 4 | j] = l; - -@@ -448,12 +448,12 @@ - - public int getBlockLightOpacity(BlockPos pos) - { -- return this.getBlockState(pos).func_185891_c(); -+ return this.getBlockState(pos).getLightOpacity(this.worldObj, pos); - } - - private int getBlockLightOpacity(int x, int y, int z) - { -- return this.func_186032_a(x, y, z).func_185891_c(); -+ return this.func_186032_a(x, y, z).getLightOpacity(this.worldObj, new BlockPos(x, y, z)); - } - - public IBlockState getBlockState(BlockPos pos) -@@ -534,6 +534,7 @@ - { - Block block = state.getBlock(); - Block block1 = iblockstate.getBlock(); -+ int k1 = iblockstate.getLightOpacity(this.worldObj, pos); // Relocate old light value lookup here, so that it is called before TE is removed. - ExtendedBlockStorage extendedblockstorage = this.storageArrays[j >> 4]; - boolean flag = false; - -@@ -550,14 +551,19 @@ - - extendedblockstorage.set(i, j & 15, k, state); - -- if (block1 != block) -+ //if (block1 != block) - { - if (!this.worldObj.isRemote) - { -+ if (block1 != block) //Only fire block breaks when the block changes. - block1.breakBlock(this.worldObj, pos, iblockstate); -+ TileEntity te = this.getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK); -+ if (te != null && te.shouldRefresh(this.worldObj, pos, iblockstate, state)) this.worldObj.removeTileEntity(pos); - } -- else if (block1 instanceof ITileEntityProvider) -+ else if (block1.hasTileEntity(iblockstate)) - { -+ TileEntity te = this.getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK); -+ if (te != null && te.shouldRefresh(this.worldObj, pos, iblockstate, state)) - this.worldObj.removeTileEntity(pos); - } - } -@@ -574,8 +580,7 @@ - } - else - { -- int j1 = state.func_185891_c(); -- int k1 = iblockstate.func_185891_c(); -+ int j1 = state.getLightOpacity(this.worldObj, pos); - - if (j1 > 0) - { -@@ -595,28 +600,18 @@ - } - } - -- if (block1 instanceof ITileEntityProvider) -- { -- TileEntity tileentity = this.getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK); -- -- if (tileentity != null) -- { -- tileentity.updateContainingBlockInfo(); -- } -- } -- - if (!this.worldObj.isRemote && block1 != block) - { - block.onBlockAdded(this.worldObj, pos, state); - } - -- if (block instanceof ITileEntityProvider) -+ if (block.hasTileEntity(state)) - { - TileEntity tileentity1 = this.getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK); - - if (tileentity1 == null) - { -- tileentity1 = ((ITileEntityProvider)block).createNewTileEntity(this.worldObj, block.getMetaFromState(state)); -+ tileentity1 = block.createTileEntity(this.worldObj, state); - this.worldObj.setTileEntity(pos, tileentity1); - } - -@@ -719,6 +714,7 @@ - k = this.entityLists.length - 1; - } - -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EnteringChunk(entityIn, this.xPosition, this.zPosition, entityIn.chunkCoordX, entityIn.chunkCoordZ)); - entityIn.addedToChunk = true; - entityIn.chunkCoordX = this.xPosition; - entityIn.chunkCoordY = k; -@@ -758,13 +754,19 @@ - { - IBlockState iblockstate = this.getBlockState(pos); - Block block = iblockstate.getBlock(); -- return !block.hasTileEntity() ? null : ((ITileEntityProvider)block).createNewTileEntity(this.worldObj, iblockstate.getBlock().getMetaFromState(iblockstate)); -+ return !block.hasTileEntity(iblockstate) ? null : block.createTileEntity(this.worldObj, iblockstate); - } - - public TileEntity getTileEntity(BlockPos pos, Chunk.EnumCreateEntityType p_177424_2_) - { - TileEntity tileentity = (TileEntity)this.chunkTileEntityMap.get(pos); - -+ if (tileentity != null && tileentity.isInvalid()) -+ { -+ chunkTileEntityMap.remove(pos); -+ tileentity = null; -+ } -+ - if (tileentity == null) - { - if (p_177424_2_ == Chunk.EnumCreateEntityType.IMMEDIATE) -@@ -774,14 +776,9 @@ - } - else if (p_177424_2_ == Chunk.EnumCreateEntityType.QUEUED) - { -- this.tileEntityPosQueue.add(pos); -+ this.tileEntityPosQueue.add(pos.getImmutable()); - } - } -- else if (tileentity.isInvalid()) -- { -- this.chunkTileEntityMap.remove(pos); -- return null; -- } - - return tileentity; - } -@@ -801,7 +798,7 @@ - tileEntityIn.setWorldObj(this.worldObj); - tileEntityIn.setPos(pos); - -- if (this.getBlockState(pos).getBlock() instanceof ITileEntityProvider) -+ if (this.getBlockState(pos).getBlock().hasTileEntity(this.getBlockState(pos))) - { - if (this.chunkTileEntityMap.containsKey(pos)) - { -@@ -810,6 +807,7 @@ - - tileEntityIn.validate(); - this.chunkTileEntityMap.put(pos, tileEntityIn); -+ tileEntityIn.onLoad(); - } - } - -@@ -838,8 +836,9 @@ - entity.onChunkLoad(); - } - -- this.worldObj.loadEntities(this.entityLists[i]); -+ this.worldObj.loadEntities(com.google.common.collect.ImmutableList.copyOf(this.entityLists[i])); - } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Load(this)); - } - - public void onChunkUnload() -@@ -855,6 +854,7 @@ - { - this.worldObj.unloadEntities(this.entityLists[i]); - } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Unload(this)); - } - - public void setChunkModified() -@@ -864,8 +864,8 @@ - - public void getEntitiesWithinAABBForEntity(Entity entityIn, AxisAlignedBB aabb, List listToFill, Predicate p_177414_4_) - { -- int i = MathHelper.floor_double((aabb.minY - 2.0D) / 16.0D); -- int j = MathHelper.floor_double((aabb.maxY + 2.0D) / 16.0D); -+ int i = MathHelper.floor_double((aabb.minY - World.MAX_ENTITY_RADIUS) / 16.0D); -+ int j = MathHelper.floor_double((aabb.maxY + World.MAX_ENTITY_RADIUS) / 16.0D); - i = MathHelper.clamp_int(i, 0, this.entityLists.length - 1); - j = MathHelper.clamp_int(j, 0, this.entityLists.length - 1); - -@@ -904,8 +904,8 @@ - - public void getEntitiesOfTypeWithinAAAB(Class entityClass, AxisAlignedBB aabb, List listToFill, Predicate p_177430_4_) - { -- int i = MathHelper.floor_double((aabb.minY - 2.0D) / 16.0D); -- int j = MathHelper.floor_double((aabb.maxY + 2.0D) / 16.0D); -+ int i = MathHelper.floor_double((aabb.minY - World.MAX_ENTITY_RADIUS) / 16.0D); -+ int j = MathHelper.floor_double((aabb.maxY + World.MAX_ENTITY_RADIUS) / 16.0D); - i = MathHelper.clamp_int(i, 0, this.entityLists.length - 1); - j = MathHelper.clamp_int(j, 0, this.entityLists.length - 1); - -@@ -994,6 +994,7 @@ - { - this.func_150809_p(); - p_186034_1_.func_185931_b(this.xPosition, this.zPosition); -+ net.minecraftforge.fml.common.registry.GameRegistry.generateWorld(this.xPosition, this.zPosition, this.worldObj, p_186034_1_, this.worldObj.getChunkProvider()); - this.setChunkModified(); - } - } -@@ -1050,7 +1051,7 @@ - { - BlockPos blockpos = (BlockPos)this.tileEntityPosQueue.poll(); - -- if (this.getTileEntity(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && this.getBlockState(blockpos).getBlock().hasTileEntity()) -+ if (this.getTileEntity(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && this.getBlockState(blockpos).getBlock().hasTileEntity(this.getBlockState(blockpos))) - { - TileEntity tileentity = this.createNewTileEntity(blockpos); - this.worldObj.setTileEntity(blockpos, tileentity); -@@ -1114,6 +1115,13 @@ - @SideOnly(Side.CLIENT) - public void func_186033_a(PacketBuffer p_186033_1_, int p_186033_2_, boolean p_186033_3_) - { -+ for(TileEntity tileEntity : chunkTileEntityMap.values()) -+ { -+ tileEntity.updateContainingBlockInfo(); -+ tileEntity.getBlockMetadata(); -+ tileEntity.getBlockType(); -+ } -+ - boolean flag = !this.worldObj.provider.getHasNoSky(); - - for (int i = 0; i < this.storageArrays.length; ++i) -@@ -1162,10 +1170,16 @@ - this.isTerrainPopulated = true; - this.generateHeightMap(); - -+ List invalidList = new java.util.ArrayList(); -+ - for (TileEntity tileentity : this.chunkTileEntityMap.values()) - { -+ if (tileentity.shouldRefresh(this.worldObj, tileentity.getPos(), tileentity.getBlockType().getStateFromMeta(tileentity.getBlockMetadata()), getBlockState(tileentity.getPos()))) -+ invalidList.add(tileentity); - tileentity.updateContainingBlockInfo(); - } -+ -+ for (TileEntity te : invalidList) te.invalidate(); - } - - public BiomeGenBase getBiome(BlockPos pos, BiomeProvider chunkManager) -@@ -1233,13 +1247,13 @@ - BlockPos blockpos1 = blockpos.add(k, (j << 4) + i1, l); - boolean flag = i1 == 0 || i1 == 15 || k == 0 || k == 15 || l == 0 || l == 15; - -- if (this.storageArrays[j] == field_186036_a && flag || this.storageArrays[j] != field_186036_a && this.storageArrays[j].get(k, i1, l).func_185904_a() == Material.air) -+ if (this.storageArrays[j] == field_186036_a && flag || this.storageArrays[j] != field_186036_a && this.storageArrays[j].get(k, i1, l).getBlock().isAir(this.storageArrays[j].get(k, i1, l), this.worldObj, blockpos1)) - { - for (EnumFacing enumfacing : EnumFacing.values()) - { - BlockPos blockpos2 = blockpos1.offset(enumfacing); - -- if (this.worldObj.getBlockState(blockpos2).func_185906_d() > 0) -+ if (this.worldObj.getBlockState(blockpos2).getLightValue(this.worldObj, blockpos2) > 0) - { - this.worldObj.checkLight(blockpos2); - } -@@ -1370,7 +1384,7 @@ - { - blockpos$mutableblockpos.set(blockpos$mutableblockpos.getX(), l, blockpos$mutableblockpos.getZ()); - -- if (this.getBlockState(blockpos$mutableblockpos).func_185906_d() > 0) -+ if (this.getBlockState(blockpos$mutableblockpos).getLightValue(this.worldObj, blockpos$mutableblockpos) > 0) - { - this.worldObj.checkLight(blockpos$mutableblockpos); - } -@@ -1481,4 +1495,20 @@ - QUEUED, - CHECK; - } -+ -+ /** -+ * Removes the tile entity at the specified position, only if it's -+ * marked as invalid. -+ */ -+ public void removeInvalidTileEntity(BlockPos pos) -+ { -+ if (isChunkLoaded) -+ { -+ TileEntity entity = (TileEntity)chunkTileEntityMap.get(pos); -+ if (entity != null && entity.isInvalid()) -+ { -+ chunkTileEntityMap.remove(pos); -+ } -+ } -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch b/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch deleted file mode 100644 index 46e4f5f77..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch +++ /dev/null @@ -1,161 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java -+++ ../src-work/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java -@@ -46,8 +46,41 @@ - this.field_186055_e = p_i46673_2_; - } - -+ public boolean chunkExists(World world, int x, int z) -+ { -+ ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(x, z); -+ -+ if (this.pendingAnvilChunksCoordinates.contains(chunkcoordintpair)) -+ { -+ for(ChunkCoordIntPair pendingChunkCoord : this.chunksToRemove.keySet()) -+ { -+ if (pendingChunkCoord.equals(chunkcoordintpair)) -+ { -+ return true; -+ } -+ } -+ } -+ -+ return RegionFileCache.createOrLoadRegionFile(this.chunkSaveLocation, x, z).chunkExists(x & 31, z & 31); -+ } -+ - public Chunk loadChunk(World worldIn, int x, int z) throws IOException - { -+ Object[] data = this.loadChunk__Async(worldIn, x, z); -+ -+ if (data != null) -+ { -+ Chunk chunk = (Chunk) data[0]; -+ NBTTagCompound nbttagcompound = (NBTTagCompound) data[1]; -+ this.loadEntities(worldIn, nbttagcompound.getCompoundTag("Level"), chunk); -+ return chunk; -+ } -+ -+ return null; -+ } -+ -+ public Object[] loadChunk__Async(World worldIn, int x, int z) throws IOException -+ { - ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(x, z); - NBTTagCompound nbttagcompound = (NBTTagCompound)this.chunksToRemove.get(chunkcoordintpair); - -@@ -63,11 +96,17 @@ - nbttagcompound = this.field_186055_e.func_188257_a(FixTypes.CHUNK, CompressedStreamTools.read(datainputstream)); - } - -- return this.checkedReadChunkFromNBT(worldIn, x, z, nbttagcompound); -+ return this.checkedReadChunkFromNBT__Async(worldIn, x, z, nbttagcompound); - } - - protected Chunk checkedReadChunkFromNBT(World worldIn, int x, int z, NBTTagCompound p_75822_4_) - { -+ Object[] data = this.checkedReadChunkFromNBT__Async(worldIn, x, z, p_75822_4_); -+ return data != null ? (Chunk)data[0] : null; -+ } -+ -+ protected Object[] checkedReadChunkFromNBT__Async(World worldIn, int x, int z, NBTTagCompound p_75822_4_) -+ { - if (!p_75822_4_.hasKey("Level", 10)) - { - logger.error("Chunk file at " + x + "," + z + " is missing level data, skipping"); -@@ -91,10 +130,29 @@ - logger.error("Chunk file at " + x + "," + z + " is in the wrong location; relocating. (Expected " + x + ", " + z + ", got " + chunk.xPosition + ", " + chunk.zPosition + ")"); - nbttagcompound.setInteger("xPos", x); - nbttagcompound.setInteger("zPos", z); -+ -+ // Have to move tile entities since we don't load them at this stage -+ NBTTagList _tileEntities = nbttagcompound.getTagList("TileEntities", 10); -+ -+ if (_tileEntities != null) -+ { -+ for (int te = 0; te < _tileEntities.tagCount(); te++) -+ { -+ NBTTagCompound _nbt = (NBTTagCompound) _tileEntities.getCompoundTagAt(te); -+ _nbt.setInteger("x", x * 16 + (_nbt.getInteger("x") - chunk.xPosition * 16)); -+ _nbt.setInteger("z", z * 16 + (_nbt.getInteger("z") - chunk.zPosition * 16)); -+ } -+ } -+ - chunk = this.readChunkFromNBT(worldIn, nbttagcompound); - } - -- return chunk; -+ Object[] data = new Object[2]; -+ data[0] = chunk; -+ data[1] = p_75822_4_; -+ // event is fired in ChunkIOProvider.callStage2 since it must be fired after TE's load. -+ // MinecraftForge.EVENT_BUS.post(new ChunkDataEvent.Load(chunk, par4NBTTagCompound)); -+ return data; - } - } - } -@@ -110,6 +168,7 @@ - nbttagcompound.setTag("Level", nbttagcompound1); - nbttagcompound.setInteger("DataVersion", 169); - this.writeChunkToNBT(chunkIn, worldIn, nbttagcompound1); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkDataEvent.Save(chunkIn, nbttagcompound)); - this.addChunkToPending(chunkIn.getChunkCoordIntPair(), nbttagcompound); - } - catch (Exception exception) -@@ -265,8 +324,17 @@ - - if (entity.writeToNBTOptional(nbttagcompound2)) - { -+ try -+ { - chunkIn.setHasEntities(true); - nbttaglist1.appendTag(nbttagcompound2); -+ } -+ catch (Exception e) -+ { -+ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e, -+ "An Entity type %s has thrown an exception trying to write state. It will not persist. Report this to the mod author", -+ entity.getClass().getName()); -+ } - } - } - } -@@ -276,9 +344,18 @@ - - for (TileEntity tileentity : chunkIn.getTileEntityMap().values()) - { -+ try -+ { - NBTTagCompound nbttagcompound3 = new NBTTagCompound(); - tileentity.writeToNBT(nbttagcompound3); - nbttaglist2.appendTag(nbttagcompound3); -+ } -+ catch (Exception e) -+ { -+ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e, -+ "A TileEntity type %s has throw an exception trying to write state. It will not persist. Report this to the mod author", -+ tileentity.getClass().getName()); -+ } - } - - p_75820_3_.setTag("TileEntities", nbttaglist2); -@@ -347,6 +424,12 @@ - chunk.setBiomeArray(p_75823_2_.getByteArray("Biomes")); - } - -+ // End this method here and split off entity loading to another method -+ return chunk; -+ } -+ -+ public void loadEntities(World worldIn, NBTTagCompound p_75823_2_, Chunk chunk) -+ { - NBTTagList nbttaglist1 = p_75823_2_.getTagList("Entities", 10); - - if (nbttaglist1 != null) -@@ -399,8 +482,6 @@ - } - } - } -- -- return chunk; - } - - public static Entity func_186050_a(NBTTagCompound p_186050_0_, World p_186050_1_, Chunk p_186050_2_) diff --git a/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch b/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch deleted file mode 100644 index 401ade530..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java -+++ ../src-work/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java -@@ -21,18 +21,12 @@ - { - File file1 = this.getWorldDirectory(); - -- if (provider instanceof WorldProviderHell) -+ if (provider.getSaveFolder() != null) - { -- File file3 = new File(file1, "DIM-1"); -+ File file3 = new File(file1, provider.getSaveFolder()); - file3.mkdirs(); - return new AnvilChunkLoader(file3, this.field_186341_a); - } -- else if (provider instanceof WorldProviderEnd) -- { -- File file2 = new File(file1, "DIM1"); -- file2.mkdirs(); -- return new AnvilChunkLoader(file2, this.field_186341_a); -- } - else - { - return new AnvilChunkLoader(file1, this.field_186341_a); diff --git a/patches.mcp/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch b/patches.mcp/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch deleted file mode 100644 index 62b0bdc26..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java -+++ ../src-work/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java -@@ -34,6 +34,8 @@ - - public void set(int x, int y, int z, IBlockState state) - { -+ if (state instanceof net.minecraftforge.common.property.IExtendedBlockState) -+ state = ((net.minecraftforge.common.property.IExtendedBlockState) state).getClean(); - IBlockState iblockstate = this.get(x, y, z); - Block block = iblockstate.getBlock(); - Block block1 = state.getBlock(); diff --git a/patches.mcp/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch b/patches.mcp/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch deleted file mode 100644 index bb5d0c211..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch +++ /dev/null @@ -1,42 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/chunk/storage/RegionFile.java -+++ ../src-work/minecraft/net/minecraft/world/chunk/storage/RegionFile.java -@@ -94,6 +94,39 @@ - } - } - -+ // This is a copy (sort of) of the method below it, make sure they stay in sync -+ public synchronized boolean chunkExists(int x, int z) -+ { -+ if (this.outOfBounds(x, z)) return false; -+ -+ try -+ { -+ int offset = this.getOffset(x, z); -+ -+ if (offset == 0) return false; -+ -+ int sectorNumber = offset >> 8; -+ int numSectors = offset & 255; -+ -+ if (sectorNumber + numSectors > this.sectorFree.size()) return false; -+ -+ this.dataFile.seek((long)(sectorNumber * 4096)); -+ int length = this.dataFile.readInt(); -+ -+ if (length > 4096 * numSectors || length <= 0) return false; -+ -+ byte version = this.dataFile.readByte(); -+ -+ if (version == 1 || version == 2) return true; -+ } -+ catch (IOException ioexception) -+ { -+ return false; -+ } -+ -+ return false; -+ } -+ - public synchronized DataInputStream getChunkDataInputStream(int x, int z) - { - if (this.outOfBounds(x, z)) diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch deleted file mode 100644 index 827e84f8b..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch +++ /dev/null @@ -1,72 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java -+++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java -@@ -39,6 +39,9 @@ - double[] field_185967_f; - double[] field_185968_g; - private final WorldGenEndIsland field_185975_r = new WorldGenEndIsland(); -+ // temporary variables used during event handling -+ private int chunkX = 0; -+ private int chunkZ = 0; - - public ChunkProviderEnd(World p_i46667_1_, boolean p_i46667_2_, long p_i46667_3_) - { -@@ -51,6 +54,16 @@ - this.noiseGen5 = new NoiseGeneratorOctaves(this.rand, 10); - this.noiseGen6 = new NoiseGeneratorOctaves(this.rand, 16); - this.field_185973_o = new NoiseGeneratorSimplex(this.rand); -+ -+ net.minecraftforge.event.terraingen.InitNoiseGensEvent.ContextEnd ctx = -+ new net.minecraftforge.event.terraingen.InitNoiseGensEvent.ContextEnd(field_185969_i, field_185970_j, field_185971_k, noiseGen5, noiseGen6, field_185973_o); -+ ctx = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(p_i46667_1_, this.rand, ctx); -+ this.field_185969_i = ctx.getLPerlin1(); -+ this.field_185970_j = ctx.getLPerlin2(); -+ this.field_185971_k = ctx.getPerlin(); -+ this.noiseGen5 = ctx.getDepth(); -+ this.noiseGen6 = ctx.getScale(); -+ this.field_185973_o = ctx.getIsland(); - } - - public void setBlocksInChunk(int p_180518_1_, int p_180518_2_, ChunkPrimer p_180518_3_) -@@ -123,6 +136,7 @@ - - public void func_185962_a(ChunkPrimer p_185962_1_) - { -+ if (!net.minecraftforge.event.ForgeEventFactory.onReplaceBiomeBlocks(this, this.chunkX, this.chunkZ, p_185962_1_, this.worldObj)) return; - for (int i = 0; i < 16; ++i) - { - for (int j = 0; j < 16; ++j) -@@ -174,6 +188,7 @@ - - public Chunk func_185932_a(int p_185932_1_, int p_185932_2_) - { -+ this.chunkX = p_185932_1_; this.chunkZ = p_185932_2_; - this.rand.setSeed((long)p_185932_1_ * 341873128712L + (long)p_185932_2_ * 132897987541L); - ChunkPrimer chunkprimer = new ChunkPrimer(); - this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, p_185932_1_ * 16, p_185932_2_ * 16, 16, 16); -@@ -255,6 +270,10 @@ - - private double[] func_185963_a(double[] p_185963_1_, int p_185963_2_, int p_185963_3_, int p_185963_4_, int p_185963_5_, int p_185963_6_, int p_185963_7_) - { -+ net.minecraftforge.event.terraingen.ChunkGeneratorEvent.InitNoiseField event = new net.minecraftforge.event.terraingen.ChunkGeneratorEvent.InitNoiseField(this, p_185963_1_, p_185963_2_, p_185963_3_, p_185963_4_, p_185963_5_, p_185963_6_, p_185963_7_); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return event.noisefield; -+ - if (p_185963_1_ == null) - { - p_185963_1_ = new double[p_185963_5_ * p_185963_6_ * p_185963_7_]; -@@ -327,6 +346,7 @@ - public void func_185931_b(int p_185931_1_, int p_185931_2_) - { - BlockFalling.fallInstantly = true; -+ net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(true, this, this.worldObj, p_185931_1_, p_185931_2_, false); - BlockPos blockpos = new BlockPos(p_185931_1_ * 16, 0, p_185931_2_ * 16); - - if (this.mapFeaturesEnabled) -@@ -374,6 +394,7 @@ - } - } - -+ net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(false, this, this.worldObj, p_185931_1_, p_185931_2_, false); - BlockFalling.fallInstantly = false; - } - diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch deleted file mode 100644 index b0983b7e3..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch +++ /dev/null @@ -1,104 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderHell.java -+++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderHell.java -@@ -76,6 +76,19 @@ - this.field_185946_g = new NoiseGeneratorOctaves(this.field_185954_p, 10); - this.field_185947_h = new NoiseGeneratorOctaves(this.field_185954_p, 16); - worldIn.setSeaLevel(63); -+ -+ net.minecraftforge.event.terraingen.InitNoiseGensEvent.ContextHell ctx = -+ new net.minecraftforge.event.terraingen.InitNoiseGensEvent.ContextHell(field_185957_u, field_185958_v, field_185959_w, slowsandGravelNoiseGen, netherrackExculsivityNoiseGen, field_185946_g, field_185947_h); -+ ctx = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(worldIn, this.field_185954_p, ctx); -+ this.field_185957_u = ctx.getLPerlin1(); -+ this.field_185958_v = ctx.getLPerlin2(); -+ this.field_185959_w = ctx.getPerlin(); -+ this.slowsandGravelNoiseGen = ctx.getPerlin2(); -+ this.netherrackExculsivityNoiseGen = ctx.getPerlin3(); -+ this.field_185946_g = ctx.getScale(); -+ this.field_185947_h = ctx.getDepth(); -+ this.genNetherBridge = (MapGenNetherBridge)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(genNetherBridge, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.NETHER_BRIDGE); -+ this.field_185939_I = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_185939_I, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.NETHER_CAVE); - } - - public void func_185936_a(int p_185936_1_, int p_185936_2_, ChunkPrimer p_185936_3_) -@@ -154,6 +167,7 @@ - - public void func_185937_b(int p_185937_1_, int p_185937_2_, ChunkPrimer p_185937_3_) - { -+ if (!net.minecraftforge.event.ForgeEventFactory.onReplaceBiomeBlocks(this, p_185937_1_, p_185937_2_, p_185937_3_, this.field_185952_n)) return; - int i = this.field_185952_n.getSeaLevel() + 1; - double d0 = 0.03125D; - this.slowsandNoise = this.slowsandGravelNoiseGen.generateNoiseOctaves(this.slowsandNoise, p_185937_1_ * 16, p_185937_2_ * 16, 0, 16, 16, 1, d0, d0, 1.0D); -@@ -276,6 +290,10 @@ - p_185938_1_ = new double[p_185938_5_ * p_185938_6_ * p_185938_7_]; - } - -+ net.minecraftforge.event.terraingen.ChunkGeneratorEvent.InitNoiseField event = new net.minecraftforge.event.terraingen.ChunkGeneratorEvent.InitNoiseField(this, p_185938_1_, p_185938_2_, p_185938_3_, p_185938_4_, p_185938_5_, p_185938_6_, p_185938_7_); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return event.noisefield; -+ - double d0 = 684.412D; - double d1 = 2053.236D; - this.noiseData4 = this.field_185946_g.generateNoiseOctaves(this.noiseData4, p_185938_2_, p_185938_3_, p_185938_4_, p_185938_5_, 1, p_185938_7_, 1.0D, 0.0D, 1.0D); -@@ -357,20 +375,25 @@ - public void func_185931_b(int p_185931_1_, int p_185931_2_) - { - BlockFalling.fallInstantly = true; -+ net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(true, this, this.field_185952_n, p_185931_1_, p_185931_2_, false); - BlockPos blockpos = new BlockPos(p_185931_1_ * 16, 0, p_185931_2_ * 16); - ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_185931_1_, p_185931_2_); - this.genNetherBridge.generateStructure(this.field_185952_n, this.field_185954_p, chunkcoordintpair); - -+ if (net.minecraftforge.event.terraingen.TerrainGen.populate(this, this.field_185952_n, this.field_185954_p, p_185931_1_, p_185931_2_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.NETHER_LAVA)) - for (int i = 0; i < 8; ++i) - { - this.field_177472_y.generate(this.field_185952_n, this.field_185954_p, blockpos.add(this.field_185954_p.nextInt(16) + 8, this.field_185954_p.nextInt(120) + 4, this.field_185954_p.nextInt(16) + 8)); - } - -+ if (net.minecraftforge.event.terraingen.TerrainGen.populate(this, this.field_185952_n, this.field_185954_p, p_185931_1_, p_185931_2_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.FIRE)) - for (int j = 0; j < this.field_185954_p.nextInt(this.field_185954_p.nextInt(10) + 1) + 1; ++j) - { - this.field_177470_t.generate(this.field_185952_n, this.field_185954_p, blockpos.add(this.field_185954_p.nextInt(16) + 8, this.field_185954_p.nextInt(120) + 4, this.field_185954_p.nextInt(16) + 8)); - } - -+ if (net.minecraftforge.event.terraingen.TerrainGen.populate(this, this.field_185952_n, this.field_185954_p, p_185931_1_, p_185931_2_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.GLOWSTONE)) -+ { - for (int k = 0; k < this.field_185954_p.nextInt(this.field_185954_p.nextInt(10) + 1); ++k) - { - this.field_177469_u.generate(this.field_185952_n, this.field_185954_p, blockpos.add(this.field_185954_p.nextInt(16) + 8, this.field_185954_p.nextInt(120) + 4, this.field_185954_p.nextInt(16) + 8)); -@@ -380,7 +403,13 @@ - { - this.field_177468_v.generate(this.field_185952_n, this.field_185954_p, blockpos.add(this.field_185954_p.nextInt(16) + 8, this.field_185954_p.nextInt(128), this.field_185954_p.nextInt(16) + 8)); - } -+ }//Forge: End doGLowstone - -+ net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(false, this, this.field_185952_n, p_185931_1_, p_185931_2_, false); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Pre(this.field_185952_n, this.field_185954_p, blockpos)); -+ -+ if (net.minecraftforge.event.terraingen.TerrainGen.decorate(this.field_185952_n, this.field_185954_p, blockpos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SHROOM)) -+ { - if (this.field_185954_p.nextBoolean()) - { - this.field_177471_z.generate(this.field_185952_n, this.field_185954_p, blockpos.add(this.field_185954_p.nextInt(16) + 8, this.field_185954_p.nextInt(128), this.field_185954_p.nextInt(16) + 8)); -@@ -390,17 +419,22 @@ - { - this.field_177465_A.generate(this.field_185952_n, this.field_185954_p, blockpos.add(this.field_185954_p.nextInt(16) + 8, this.field_185954_p.nextInt(128), this.field_185954_p.nextInt(16) + 8)); - } -+ } - -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(this.field_185952_n, this.field_185954_p, field_177467_w, blockpos, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.QUARTZ)) - for (int i1 = 0; i1 < 16; ++i1) - { - this.field_177467_w.generate(this.field_185952_n, this.field_185954_p, blockpos.add(this.field_185954_p.nextInt(16), this.field_185954_p.nextInt(108) + 10, this.field_185954_p.nextInt(16))); - } - -+ if (net.minecraftforge.event.terraingen.TerrainGen.populate(this, this.field_185952_n, this.field_185954_p, p_185931_1_, p_185931_2_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.NETHER_LAVA2)) - for (int j1 = 0; j1 < 16; ++j1) - { - this.field_177473_x.generate(this.field_185952_n, this.field_185954_p, blockpos.add(this.field_185954_p.nextInt(16), this.field_185954_p.nextInt(108) + 10, this.field_185954_p.nextInt(16))); - } - -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Post(this.field_185952_n, this.field_185954_p, blockpos)); -+ - BlockFalling.fallInstantly = false; - } - diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderOverworld.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderOverworld.java.patch deleted file mode 100644 index a7478f321..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderOverworld.java.patch +++ /dev/null @@ -1,101 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderOverworld.java -+++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderOverworld.java -@@ -59,6 +59,15 @@ - - public ChunkProviderOverworld(World p_i46668_1_, long p_i46668_2_, boolean p_i46668_4_, String p_i46668_5_) - { -+ { -+ field_186003_v = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_186003_v, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.CAVE); -+ field_186004_w = (MapGenStronghold)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_186004_w, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.STRONGHOLD); -+ field_186005_x = (MapGenVillage)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_186005_x, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.VILLAGE); -+ field_186006_y = (MapGenMineshaft)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_186006_y, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.MINESHAFT); -+ field_186007_z = (MapGenScatteredFeature)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_186007_z, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.SCATTERED_FEATURE); -+ field_185979_A = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_185979_A, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.RAVINE); -+ field_185980_B = (StructureOceanMonument)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_185980_B, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.OCEAN_MONUMENT); -+ } - this.field_185995_n = p_i46668_1_; - this.field_185996_o = p_i46668_4_; - this.field_185997_p = p_i46668_1_.getWorldInfo().getTerrainType(); -@@ -88,6 +97,17 @@ - this.field_186001_t = this.field_186000_s.useLavaOceans ? Blocks.lava.getDefaultState() : Blocks.water.getDefaultState(); - p_i46668_1_.setSeaLevel(this.field_186000_s.seaLevel); - } -+ -+ net.minecraftforge.event.terraingen.InitNoiseGensEvent.ContextOverworld ctx = -+ new net.minecraftforge.event.terraingen.InitNoiseGensEvent.ContextOverworld(field_185991_j, field_185992_k, field_185993_l, field_185994_m, field_185983_b, field_185984_c, field_185985_d); -+ ctx = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(p_i46668_1_, this.field_185990_i, ctx); -+ this.field_185991_j = ctx.getLPerlin1(); -+ this.field_185992_k = ctx.getLPerlin2(); -+ this.field_185993_l = ctx.getPerlin(); -+ this.field_185994_m = ctx.getHeight(); -+ this.field_185983_b = ctx.getScale(); -+ this.field_185984_c = ctx.getDepth(); -+ this.field_185985_d = ctx.getForest(); - } - - public void func_185976_a(int p_185976_1_, int p_185976_2_, ChunkPrimer p_185976_3_) -@@ -161,6 +181,7 @@ - - public void func_185977_a(int p_185977_1_, int p_185977_2_, ChunkPrimer p_185977_3_, BiomeGenBase[] p_185977_4_) - { -+ if (!net.minecraftforge.event.ForgeEventFactory.onReplaceBiomeBlocks(this, p_185977_1_, p_185977_2_, p_185977_3_, this.field_185995_n)) return; - double d0 = 0.03125D; - this.field_186002_u = this.field_185994_m.func_151599_a(this.field_186002_u, (double)(p_185977_1_ * 16), (double)(p_185977_2_ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D); - -@@ -365,6 +386,8 @@ - boolean flag = false; - ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_185931_1_, p_185931_2_); - -+ net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(true, this, this.field_185995_n, p_185931_1_, p_185931_2_, flag); -+ - if (this.field_185996_o) - { - if (this.field_186000_s.useMineShafts) -@@ -394,6 +417,7 @@ - } - - if (biomegenbase != Biomes.desert && biomegenbase != Biomes.desertHills && this.field_186000_s.useWaterLakes && !flag && this.field_185990_i.nextInt(this.field_186000_s.waterLakeChance) == 0) -+ if (net.minecraftforge.event.terraingen.TerrainGen.populate(this, this.field_185995_n, this.field_185990_i, p_185931_1_, p_185931_2_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAKE)) - { - int i1 = this.field_185990_i.nextInt(16) + 8; - int j1 = this.field_185990_i.nextInt(256); -@@ -402,6 +426,7 @@ - } - - if (!flag && this.field_185990_i.nextInt(this.field_186000_s.lavaLakeChance / 10) == 0 && this.field_186000_s.useLavaLakes) -+ if (net.minecraftforge.event.terraingen.TerrainGen.populate(this, this.field_185995_n, this.field_185990_i, p_185931_1_, p_185931_2_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAVA)) - { - int i2 = this.field_185990_i.nextInt(16) + 8; - int l2 = this.field_185990_i.nextInt(this.field_185990_i.nextInt(248) + 8); -@@ -414,6 +439,7 @@ - } - - if (this.field_186000_s.useDungeons) -+ if (net.minecraftforge.event.terraingen.TerrainGen.populate(this, this.field_185995_n, this.field_185990_i, p_185931_1_, p_185931_2_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.DUNGEON)) - { - for (int j2 = 0; j2 < this.field_186000_s.dungeonChance; ++j2) - { -@@ -425,9 +451,12 @@ - } - - biomegenbase.decorate(this.field_185995_n, this.field_185990_i, new BlockPos(i, 0, j)); -+ if (net.minecraftforge.event.terraingen.TerrainGen.populate(this, this.field_185995_n, this.field_185990_i, p_185931_1_, p_185931_2_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ANIMALS)) - WorldEntitySpawner.performWorldGenSpawning(this.field_185995_n, biomegenbase, i + 8, j + 8, 16, 16, this.field_185990_i); - blockpos = blockpos.add(8, 0, 8); - -+ if (net.minecraftforge.event.terraingen.TerrainGen.populate(this, this.field_185995_n, this.field_185990_i, p_185931_1_, p_185931_2_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ICE)) -+ { - for (int k2 = 0; k2 < 16; ++k2) - { - for (int j3 = 0; j3 < 16; ++j3) -@@ -446,7 +475,10 @@ - } - } - } -+ }//Forge: End ICE - -+ net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(false, this, this.field_185995_n, p_185931_1_, p_185931_2_, flag); -+ - BlockFalling.fallInstantly = false; - } - diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch deleted file mode 100644 index fe5a8cf44..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch +++ /dev/null @@ -1,110 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderServer.java -+++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderServer.java -@@ -33,6 +33,7 @@ - public final LongHashMap id2ChunkMap = new LongHashMap(); - public final List loadedChunks = Lists.newArrayList(); - public final WorldServer worldObj; -+ private Set loadingChunks = com.google.common.collect.Sets.newHashSet(); - - public ChunkProviderServer(WorldServer p_i46838_1_, IChunkLoader p_i46838_2_, IChunkGenerator p_i46838_3_) - { -@@ -92,14 +93,65 @@ - - public Chunk func_186025_d(int p_186025_1_, int p_186025_2_) - { -+ return loadChunk(p_186025_1_, p_186025_2_, null); -+ } -+ -+ public Chunk loadChunk(int X, int Z, Runnable runnable) -+ { -+ long pos = ChunkCoordIntPair.chunkXZ2Int(X, Z); -+ this.droppedChunksSet.remove(Long.valueOf(pos)); -+ Chunk chunk = this.id2ChunkMap.getValueByKey(pos); -+ net.minecraft.world.chunk.storage.AnvilChunkLoader loader = null; -+ -+ if (this.chunkLoader instanceof net.minecraft.world.chunk.storage.AnvilChunkLoader) -+ { -+ loader = (net.minecraft.world.chunk.storage.AnvilChunkLoader) this.chunkLoader; -+ } -+ -+ // We can only use the queue for already generated chunks -+ if (chunk == null && loader != null && loader.chunkExists(this.worldObj, X, Z)) -+ { -+ if (runnable != null) -+ { -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.queueChunkLoad(this.worldObj, loader, this, X, Z, runnable); -+ return null; -+ } -+ else -+ { -+ chunk = net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(this.worldObj, loader, this, X, Z); -+ } -+ } -+ else if (chunk == null) -+ { -+ chunk = this.originalLoadChunk(X, Z); -+ } -+ -+ // If we didn't load the chunk async and have a callback run it now -+ if (runnable != null) -+ { -+ runnable.run(); -+ } -+ -+ return chunk; -+ } -+ -+ public Chunk originalLoadChunk(int p_186025_1_, int p_186025_2_) -+ { - Chunk chunk = this.func_186028_c(p_186025_1_, p_186025_2_); - - if (chunk == null) - { - long i = ChunkCoordIntPair.chunkXZ2Int(p_186025_1_, p_186025_2_); -- chunk = this.loadChunkFromFile(p_186025_1_, p_186025_2_); -+ if (!loadingChunks.add(i)) -+ { -+ net.minecraftforge.fml.common.FMLLog.bigWarning("There is an attempt to load a chunk (%d,%d) in di >mension %d that is already being loaded. This will cause weird chunk breakages.", p_186025_1_, p_186025_2_, worldObj.provider.getDimension()); -+ } -+ chunk = net.minecraftforge.common.ForgeChunkManager.fetchDormantChunk(i, this.worldObj); - - if (chunk == null) -+ chunk = this.loadChunkFromFile(p_186025_1_, p_186025_2_); -+ -+ if (chunk == null) - { - try - { -@@ -118,6 +170,7 @@ - - this.id2ChunkMap.add(i, chunk); - this.loadedChunks.add(chunk); -+ loadingChunks.remove(i); - chunk.onChunkLoad(); - chunk.func_186030_a(this, this.field_186029_c); - } -@@ -214,6 +267,11 @@ - { - if (!this.worldObj.disableLevelSaving) - { -+ for (ChunkCoordIntPair forced : this.worldObj.getPersistentChunks().keySet()) -+ { -+ this.droppedChunksSet.remove(ChunkCoordIntPair.chunkXZ2Int(forced.chunkXPos, forced.chunkZPos)); -+ } -+ - for (int i = 0; i < 100; ++i) - { - if (!this.droppedChunksSet.isEmpty()) -@@ -228,6 +286,12 @@ - this.saveChunkExtraData(chunk); - this.id2ChunkMap.remove(olong.longValue()); - this.loadedChunks.remove(chunk); -+ net.minecraftforge.common.ForgeChunkManager.putDormantChunk(ChunkCoordIntPair.chunkXZ2Int(chunk.xPosition, chunk.zPosition), chunk); -+ if(loadedChunks.size() == 0 && net.minecraftforge.common.ForgeChunkManager.getPersistentChunksFor(this.worldObj).size() == 0 && !net.minecraftforge.common.DimensionManager.shouldLoadSpawn(this.worldObj.provider.getDimension())){ -+ net.minecraftforge.common.DimensionManager.unloadWorld(this.worldObj.provider.getDimension()); -+ return false; -+ } -+ - } - - this.droppedChunksSet.remove(olong); diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch deleted file mode 100644 index 7d067708c..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch +++ /dev/null @@ -1,121 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/MapGenCaves.java -+++ ../src-work/minecraft/net/minecraft/world/gen/MapGenCaves.java -@@ -141,9 +141,7 @@ - { - if (l1 >= 0 && l1 < 256) - { -- IBlockState iblockstate = p_180702_5_.getBlockState(j1, l1, k1); -- -- if (iblockstate.getBlock() == Blocks.flowing_water || iblockstate.getBlock() == Blocks.water) -+ if (isOceanBlock(p_180702_5_, j1, l1, k1, p_180702_3_, p_180702_4_)) - { - flag3 = true; - } -@@ -181,33 +179,12 @@ - IBlockState iblockstate1 = p_180702_5_.getBlockState(j3, j2, i2); - IBlockState iblockstate2 = (IBlockState)Objects.firstNonNull(p_180702_5_.getBlockState(j3, j2 + 1, i2), field_186127_b); - -- if (iblockstate1.getBlock() == Blocks.grass || iblockstate1.getBlock() == Blocks.mycelium) -+ if (isTopBlock(p_180702_5_, j3, j2, i2, p_180702_3_, p_180702_4_)) - { - flag1 = true; - } - -- if (this.func_175793_a(iblockstate1, iblockstate2)) -- { -- if (j2 - 1 < 10) -- { -- p_180702_5_.setBlockState(j3, j2, i2, field_186126_a); -- } -- else -- { -- p_180702_5_.setBlockState(j3, j2, i2, field_186127_b); -- -- if (iblockstate2.getBlock() == Blocks.sand) -- { -- p_180702_5_.setBlockState(j3, j2 + 1, i2, iblockstate2.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND ? field_186129_d : field_186128_c); -- } -- -- if (flag1 && p_180702_5_.getBlockState(j3, j2 - 1, i2).getBlock() == Blocks.dirt) -- { -- blockpos$mutableblockpos.set(j3 + p_180702_3_ * 16, 0, i2 + p_180702_4_ * 16); -- p_180702_5_.setBlockState(j3, j2 - 1, i2, this.worldObj.getBiomeGenForCoords(blockpos$mutableblockpos).topBlock.getBlock().getDefaultState()); -- } -- } -- } -+ digBlock(p_180702_5_, j3, j2, i2, p_180702_3_, p_180702_4_, flag1, iblockstate1, iblockstate2); - } - } - } -@@ -266,4 +243,71 @@ - } - } - } -+ -+ protected boolean isOceanBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) -+ { -+ net.minecraft.block.Block block = data.getBlockState(x, y, z).getBlock(); -+ return block== Blocks.flowing_water || block == Blocks.water; -+ } -+ -+ //Exception biomes to make sure we generate like vanilla -+ private boolean isExceptionBiome(net.minecraft.world.biome.BiomeGenBase biome) -+ { -+ if (biome == net.minecraft.init.Biomes.beach) return true; -+ if (biome == net.minecraft.init.Biomes.desert) return true; -+ return false; -+ } -+ -+ //Determine if the block at the specified location is the top block for the biome, we take into account -+ //Vanilla bugs to make sure that we generate the map the same way vanilla does. -+ private boolean isTopBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) -+ { -+ net.minecraft.world.biome.BiomeGenBase biome = worldObj.getBiomeGenForCoords(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); -+ IBlockState state = data.getBlockState(x, y, z); -+ return (isExceptionBiome(biome) ? state.getBlock() == Blocks.grass : state.getBlock() == biome.topBlock); -+ } -+ -+ /** -+ * Digs out the current block, default implementation removes stone, filler, and top block -+ * Sets the block to lava if y is less then 10, and air other wise. -+ * If setting to air, it also checks to see if we've broken the surface and if so -+ * tries to make the floor the biome's top block -+ * -+ * @param data Block data array -+ * @param index Pre-calculated index into block data -+ * @param x local X position -+ * @param y local Y position -+ * @param z local Z position -+ * @param chunkX Chunk X position -+ * @param chunkZ Chunk Y position -+ * @param foundTop True if we've encountered the biome's top block. Ideally if we've broken the surface. -+ */ -+ protected void digBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ, boolean foundTop, IBlockState state, IBlockState up) -+ { -+ net.minecraft.world.biome.BiomeGenBase biome = worldObj.getBiomeGenForCoords(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); -+ IBlockState top = biome.topBlock; -+ IBlockState filler = biome.fillerBlock; -+ -+ if (this.func_175793_a(state, up) || state.getBlock() == top.getBlock() || state.getBlock() == filler.getBlock()) -+ { -+ if (y - 1 < 10) -+ { -+ data.setBlockState(x, y, z, field_186126_a); -+ } -+ else -+ { -+ data.setBlockState(x, y, z, field_186127_b); -+ -+ if (up.getBlock() == Blocks.sand) -+ { -+ data.setBlockState(x, y + 1, z, up.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND ? field_186129_d : field_186128_c); -+ } -+ -+ if (foundTop && data.getBlockState(x, y - 1, z).getBlock() == filler.getBlock()) -+ { -+ data.setBlockState(x, y - 1, z, top.getBlock().getDefaultState()); -+ } -+ } -+ } -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch deleted file mode 100644 index ce7bbd4f6..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch +++ /dev/null @@ -1,124 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/MapGenRavine.java -+++ ../src-work/minecraft/net/minecraft/world/gen/MapGenRavine.java -@@ -128,9 +128,7 @@ - { - if (l1 >= 0 && l1 < 256) - { -- IBlockState iblockstate = p_180707_5_.getBlockState(j1, l1, k1); -- -- if (iblockstate.getBlock() == Blocks.flowing_water || iblockstate.getBlock() == Blocks.water) -+ if (isOceanBlock(p_180707_5_, j1, l1, k1, p_180707_3_, p_180707_4_)) - { - flag2 = true; - } -@@ -146,8 +144,6 @@ - - if (!flag2) - { -- BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); -- - for (int j3 = k2; j3 < k; ++j3) - { - double d10 = ((double)(j3 + p_180707_3_ * 16) + 0.5D - p_180707_6_) / d9; -@@ -165,30 +161,12 @@ - - if ((d10 * d10 + d7 * d7) * (double)this.field_75046_d[j2 - 1] + d8 * d8 / 6.0D < 1.0D) - { -- IBlockState iblockstate1 = p_180707_5_.getBlockState(j3, j2, i2); -- -- if (iblockstate1.getBlock() == Blocks.grass) -+ if (isTopBlock(p_180707_5_, j3, j2, i2, p_180707_3_, p_180707_4_)) - { - flag = true; - } - -- if (iblockstate1.getBlock() == Blocks.stone || iblockstate1.getBlock() == Blocks.dirt || iblockstate1.getBlock() == Blocks.grass) -- { -- if (j2 - 1 < 10) -- { -- p_180707_5_.setBlockState(j3, j2, i2, field_186135_a); -- } -- else -- { -- p_180707_5_.setBlockState(j3, j2, i2, field_186136_b); -- -- if (flag && p_180707_5_.getBlockState(j3, j2 - 1, i2).getBlock() == Blocks.dirt) -- { -- blockpos$mutableblockpos.set(j3 + p_180707_3_ * 16, 0, i2 + p_180707_4_ * 16); -- p_180707_5_.setBlockState(j3, j2 - 1, i2, this.worldObj.getBiomeGenForCoords(blockpos$mutableblockpos).topBlock); -- } -- } -- } -+ digBlock(p_180707_5_, j3, j2, i2, p_180707_3_, p_180707_4_, flag); - } - } - } -@@ -223,4 +201,68 @@ - } - } - } -+ protected boolean isOceanBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) -+ { -+ net.minecraft.block.Block block = data.getBlockState(x, y, z).getBlock(); -+ return block== Blocks.flowing_water || block == Blocks.water; -+ } -+ -+ //Exception biomes to make sure we generate like vanilla -+ private boolean isExceptionBiome(net.minecraft.world.biome.BiomeGenBase biome) -+ { -+ if (biome == net.minecraft.init.Biomes.beach) return true; -+ if (biome == net.minecraft.init.Biomes.desert) return true; -+ if (biome == net.minecraft.init.Biomes.mushroomIsland) return true; -+ if (biome == net.minecraft.init.Biomes.mushroomIslandShore) return true; -+ return false; -+ } -+ -+ //Determine if the block at the specified location is the top block for the biome, we take into account -+ //Vanilla bugs to make sure that we generate the map the same way vanilla does. -+ private boolean isTopBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) -+ { -+ net.minecraft.world.biome.BiomeGenBase biome = worldObj.getBiomeGenForCoords(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); -+ IBlockState state = data.getBlockState(x, y, z); -+ return (isExceptionBiome(biome) ? state.getBlock() == Blocks.grass : state.getBlock() == biome.topBlock); -+ } -+ -+ /** -+ * Digs out the current block, default implementation removes stone, filler, and top block -+ * Sets the block to lava if y is less then 10, and air other wise. -+ * If setting to air, it also checks to see if we've broken the surface and if so -+ * tries to make the floor the biome's top block -+ * -+ * @param data Block data array -+ * @param index Pre-calculated index into block data -+ * @param x local X position -+ * @param y local Y position -+ * @param z local Z position -+ * @param chunkX Chunk X position -+ * @param chunkZ Chunk Y position -+ * @param foundTop True if we've encountered the biome's top block. Ideally if we've broken the surface. -+ */ -+ protected void digBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ, boolean foundTop) -+ { -+ net.minecraft.world.biome.BiomeGenBase biome = worldObj.getBiomeGenForCoords(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); -+ IBlockState state = data.getBlockState(x, y, z); -+ IBlockState top = isExceptionBiome(biome) ? Blocks.grass.getDefaultState() : biome.topBlock; -+ IBlockState filler = isExceptionBiome(biome) ? Blocks.dirt.getDefaultState() : biome.fillerBlock; -+ -+ if (state.getBlock() == Blocks.stone || state.getBlock() == top.getBlock() || state.getBlock() == filler.getBlock()) -+ { -+ if (y - 1 < 10) -+ { -+ data.setBlockState(x, y, z, field_186135_a); -+ } -+ else -+ { -+ data.setBlockState(x, y, z, field_186136_b); -+ -+ if (foundTop && data.getBlockState(x, y - 1, z).getBlock() == filler.getBlock()) -+ { -+ data.setBlockState(x, y - 1, z, top.getBlock().getDefaultState()); -+ } -+ } -+ } -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch deleted file mode 100644 index aa33cb607..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java -@@ -31,4 +31,10 @@ - this.setBlockAndNotifyAdequately(worldIn, p_175921_2_, Blocks.dirt.getDefaultState()); - } - } -+ -+ public boolean isReplaceable(World world, BlockPos pos) -+ { -+ net.minecraft.block.state.IBlockState state = world.getBlockState(pos); -+ return state.getBlock().isAir(state, world, pos) || state.getBlock().isLeaves(state, world, pos) || state.getBlock().isWood(world, pos) || func_150523_a(state.getBlock()); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch deleted file mode 100644 index 72784ad60..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch +++ /dev/null @@ -1,34 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java -@@ -56,9 +56,9 @@ - { - if (j >= 0 && j < 256) - { -- Material material = worldIn.getBlockState(blockpos$mutableblockpos.set(l, j, i1)).func_185904_a(); -+ IBlockState state = worldIn.getBlockState(blockpos$mutableblockpos.set(l, j, i1)); - -- if (material != Material.air && material != Material.leaves) -+ if (!state.getBlock().isAir(state, worldIn, blockpos$mutableblockpos) && !state.getBlock().isLeaves(state, worldIn, blockpos$mutableblockpos)) - { - flag = false; - } -@@ -193,8 +193,9 @@ - if (position.getY() >= position.getY() + i - 1 || blockhugemushroom$enumtype != BlockHugeMushroom.EnumType.ALL_INSIDE) - { - BlockPos blockpos = new BlockPos(l1, l2, i2); -+ IBlockState state = worldIn.getBlockState(blockpos); - -- if (!worldIn.getBlockState(blockpos).func_185913_b()) -+ if (state.getBlock().canBeReplacedByLeaves(state, worldIn, blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, block.getDefaultState().withProperty(BlockHugeMushroom.VARIANT, blockhugemushroom$enumtype)); - } -@@ -207,7 +208,7 @@ - { - IBlockState iblockstate = worldIn.getBlockState(position.up(i3)); - -- if (!iblockstate.func_185913_b()) -+ if (iblockstate.getBlock().canBeReplacedByLeaves(iblockstate, worldIn, position.up(i3))) - { - this.setBlockAndNotifyAdequately(worldIn, position.up(i3), block.getDefaultState().withProperty(BlockHugeMushroom.VARIANT, BlockHugeMushroom.EnumType.STEM)); - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch deleted file mode 100644 index 81386001d..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch +++ /dev/null @@ -1,52 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java -@@ -99,9 +99,9 @@ - if (Math.pow((double)Math.abs(j) + 0.5D, 2.0D) + Math.pow((double)Math.abs(k) + 0.5D, 2.0D) <= (double)(p_181631_2_ * p_181631_2_)) - { - BlockPos blockpos = p_181631_1_.add(j, 0, k); -- Material material = this.world.getBlockState(blockpos).func_185904_a(); -+ IBlockState state = this.world.getBlockState(blockpos); - -- if (material == Material.air || material == Material.leaves) -+ if (state.getBlock().isAir(state, world, blockpos) || state.getBlock().isLeaves(state, world, blockpos)) - { - this.setBlockAndNotifyAdequately(this.world, blockpos, p_181631_3_); - } -@@ -254,7 +254,7 @@ - { - BlockPos blockpos1 = posOne.add((double)(0.5F + (float)j * f), (double)(0.5F + (float)j * f1), (double)(0.5F + (float)j * f2)); - -- if (!this.func_150523_a(this.world.getBlockState(blockpos1).getBlock())) -+ if (!this.isReplaceable(world, blockpos1)) - { - return j; - } -@@ -282,6 +282,7 @@ - - if (!this.validTreeLocation()) - { -+ this.world = null; //Fix vanilla Mem leak, holds latest world - return false; - } - else -@@ -290,15 +291,18 @@ - this.generateLeaves(); - this.generateTrunk(); - this.generateLeafNodeBases(); -+ this.world = null; //Fix vanilla Mem leak, holds latest world - return true; - } - } - - private boolean validTreeLocation() - { -- Block block = this.world.getBlockState(this.basePos.down()).getBlock(); -+ BlockPos down = this.basePos.down(); -+ net.minecraft.block.state.IBlockState state = this.world.getBlockState(down); -+ boolean isSoil = state.getBlock().canSustainPlant(state, this.world, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); - -- if (block != Blocks.dirt && block != Blocks.grass && block != Blocks.farmland) -+ if (!isSoil) - { - return false; - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBirchTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBirchTree.java.patch deleted file mode 100644 index f92c104f1..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBirchTree.java.patch +++ /dev/null @@ -1,64 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenBirchTree.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBirchTree.java -@@ -8,6 +8,7 @@ - import net.minecraft.block.material.Material; - import net.minecraft.block.state.IBlockState; - import net.minecraft.init.Blocks; -+import net.minecraft.util.EnumFacing; - import net.minecraft.util.math.BlockPos; - import net.minecraft.world.World; - -@@ -56,9 +57,9 @@ - { - for (int i1 = position.getZ() - k; i1 <= position.getZ() + k && flag; ++i1) - { -- if (j >= 0 && j < 256) -+ if (j >= 0 && j < worldIn.getHeight()) - { -- if (!this.func_150523_a(worldIn.getBlockState(blockpos$mutableblockpos.set(l, j, i1)).getBlock())) -+ if (!this.isReplaceable(worldIn, blockpos$mutableblockpos.set(l, j, i1))) - { - flag = false; - } -@@ -77,11 +78,13 @@ - } - else - { -- Block block = worldIn.getBlockState(position.down()).getBlock(); -+ BlockPos down = position.down(); -+ IBlockState state = worldIn.getBlockState(down); -+ boolean isSoil = state.getBlock().canSustainPlant(state, worldIn, down, EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.sapling); - -- if ((block == Blocks.grass || block == Blocks.dirt || block == Blocks.farmland) && position.getY() < 256 - i - 1) -+ if (isSoil && position.getY() < worldIn.getHeight() - i - 1) - { -- this.func_175921_a(worldIn, position.down()); -+ state.getBlock().onPlantGrow(state, worldIn, down, position); - - for (int i2 = position.getY() - 3 + i; i2 <= position.getY() + i; ++i2) - { -@@ -99,9 +102,9 @@ - if (Math.abs(j1) != l2 || Math.abs(l1) != l2 || rand.nextInt(2) != 0 && k2 != 0) - { - BlockPos blockpos = new BlockPos(i3, i2, k1); -- Material material = worldIn.getBlockState(blockpos).func_185904_a(); -+ IBlockState state2 = worldIn.getBlockState(blockpos); - -- if (material == Material.air || material == Material.leaves) -+ if (state2.getBlock().isAir(state2, worldIn, blockpos) || state2.getBlock().isAir(state2, worldIn, blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181630_b); - } -@@ -112,9 +115,10 @@ - - for (int j2 = 0; j2 < i; ++j2) - { -- Material material1 = worldIn.getBlockState(position.up(j2)).func_185904_a(); -+ BlockPos upN = position.up(j2); -+ IBlockState state2 = worldIn.getBlockState(upN); - -- if (material1 == Material.air || material1 == Material.leaves) -+ if (state2.getBlock().isAir(state2, worldIn, upN) || state2.getBlock().isLeaves(state2, worldIn, upN)) - { - this.setBlockAndNotifyAdequately(worldIn, position.up(j2), field_181629_a); - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBush.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBush.java.patch deleted file mode 100644 index 294966585..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBush.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenBush.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBush.java -@@ -20,7 +20,7 @@ - { - BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), rand.nextInt(4) - rand.nextInt(4), rand.nextInt(8) - rand.nextInt(8)); - -- if (worldIn.isAirBlock(blockpos) && (!worldIn.provider.getHasNoSky() || blockpos.getY() < 255) && this.field_175908_a.canBlockStay(worldIn, blockpos, this.field_175908_a.getDefaultState())) -+ if (worldIn.isAirBlock(blockpos) && (!worldIn.provider.getHasNoSky() || blockpos.getY() < worldIn.getHeight() - 1) && this.field_175908_a.canBlockStay(worldIn, blockpos, this.field_175908_a.getDefaultState())) - { - worldIn.setBlockState(blockpos, this.field_175908_a.getDefaultState(), 2); - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch deleted file mode 100644 index 41b7963de..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch +++ /dev/null @@ -1,72 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java -@@ -33,9 +33,10 @@ - if (k >= 1 && k + i + 1 < 256) - { - BlockPos blockpos = position.down(); -- Block block = worldIn.getBlockState(blockpos).getBlock(); -+ IBlockState state = worldIn.getBlockState(blockpos); -+ boolean isSoil = state.getBlock().canSustainPlant(state, worldIn, blockpos, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); - -- if (block != Blocks.grass && block != Blocks.dirt) -+ if (!(isSoil && position.getY() < worldIn.getHeight() - i - 1)) - { - return false; - } -@@ -45,10 +46,10 @@ - } - else - { -- this.func_175921_a(worldIn, blockpos); -- this.func_175921_a(worldIn, blockpos.east()); -- this.func_175921_a(worldIn, blockpos.south()); -- this.func_175921_a(worldIn, blockpos.south().east()); -+ this.onPlantGrow(worldIn, blockpos, position); -+ this.onPlantGrow(worldIn, blockpos.east(), position); -+ this.onPlantGrow(worldIn, blockpos.south(), position); -+ this.onPlantGrow(worldIn, blockpos.south().east(), position); - EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.random(rand); - int i1 = i - rand.nextInt(4); - int j1 = 2 - rand.nextInt(3); -@@ -67,9 +68,9 @@ - - int k2 = k + j2; - BlockPos blockpos1 = new BlockPos(k1, k2, l1); -- Material material = worldIn.getBlockState(blockpos1).func_185904_a(); -+ state = worldIn.getBlockState(blockpos1); - -- if (material == Material.air || material == Material.leaves) -+ if (state.getBlock().isAir(state, worldIn, blockpos1) || state.getBlock().isLeaves(state, worldIn, blockpos1)) - { - this.func_181639_b(worldIn, blockpos1); - this.func_181639_b(worldIn, blockpos1.east()); -@@ -187,7 +188,7 @@ - { - for (int k1 = -i1; k1 <= i1; ++k1) - { -- if (!this.func_150523_a(p_181638_1_.getBlockState(blockpos$mutableblockpos.set(i + j1, j + l, k + k1)).getBlock())) -+ if (!this.isReplaceable(p_181638_1_, blockpos$mutableblockpos.set(i + j1, j + l, k + k1))) - { - return false; - } -@@ -209,11 +210,18 @@ - private void func_150526_a(World worldIn, int p_150526_2_, int p_150526_3_, int p_150526_4_) - { - BlockPos blockpos = new BlockPos(p_150526_2_, p_150526_3_, p_150526_4_); -- Material material = worldIn.getBlockState(blockpos).func_185904_a(); -+ IBlockState state = worldIn.getBlockState(blockpos); - -- if (material == Material.air) -+ if (state.getBlock().isAir(state, worldIn, blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181641_b); - } - } -+ -+ //Just a helper macro -+ private void onPlantGrow(World world, BlockPos pos, BlockPos source) -+ { -+ IBlockState state = world.getBlockState(pos); -+ state.getBlock().onPlantGrow(state, world, pos, source); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch deleted file mode 100644 index da651f127..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java -@@ -11,12 +11,12 @@ - { - public boolean generate(World worldIn, Random rand, BlockPos position) - { -- IBlockState iblockstate; -- -- while (((iblockstate = worldIn.getBlockState(position)).func_185904_a() == Material.air || iblockstate.func_185904_a() == Material.leaves) && position.getY() > 0) -+ do - { -+ IBlockState state = worldIn.getBlockState(position); -+ if (!state.getBlock().isAir(state, worldIn, position) && !state.getBlock().isLeaves(state, worldIn, position)) break; - position = position.down(); -- } -+ } while (position.getY() > 0); - - for (int i = 0; i < 4; ++i) - { diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch deleted file mode 100644 index 1986b2cd5..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java -@@ -154,6 +154,6 @@ - - private String pickMobSpawner(Random p_76543_1_) - { -- return SPAWNERTYPES[p_76543_1_.nextInt(SPAWNERTYPES.length)]; -+ return net.minecraftforge.common.DungeonHooks.getRandomDungeonMob(p_76543_1_); - } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone1.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone1.java.patch deleted file mode 100644 index 3108f459f..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone1.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone1.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone1.java -@@ -27,7 +27,7 @@ - { - BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), -rand.nextInt(12), rand.nextInt(8) - rand.nextInt(8)); - -- if (worldIn.getBlockState(blockpos).func_185904_a() == Material.air) -+ if (worldIn.isAirBlock(blockpos)) - { - int j = 0; - diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone2.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone2.java.patch deleted file mode 100644 index 649c43e9b..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone2.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone2.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone2.java -@@ -27,7 +27,7 @@ - { - BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), -rand.nextInt(12), rand.nextInt(8) - rand.nextInt(8)); - -- if (worldIn.getBlockState(blockpos).func_185904_a() == Material.air) -+ if (worldIn.isAirBlock(blockpos)) - { - int j = 0; - diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHellLava.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHellLava.java.patch deleted file mode 100644 index 2b60c9804..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHellLava.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenHellLava.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenHellLava.java -@@ -24,7 +24,7 @@ - { - return false; - } -- else if (worldIn.getBlockState(position).func_185904_a() != Material.air && worldIn.getBlockState(position).getBlock() != Blocks.netherrack) -+ else if (!worldIn.isAirBlock(position) && worldIn.getBlockState(position).getBlock() != Blocks.netherrack) - { - return false; - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch deleted file mode 100644 index 4a87bd380..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch +++ /dev/null @@ -1,69 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java -@@ -59,7 +59,7 @@ - { - for (int l = -j; l <= j && flag; ++l) - { -- if (p_175926_2_.getY() + i < 0 || p_175926_2_.getY() + i >= 256 || !this.func_150523_a(worldIn.getBlockState(p_175926_2_.add(k, i, l)).getBlock())) -+ if (p_175926_2_.getY() + i < 0 || p_175926_2_.getY() + i >= 256 || !this.isReplaceable(worldIn,p_175926_2_.add(k, i, l))) - { - flag = false; - } -@@ -78,14 +78,15 @@ - private boolean func_175927_a(BlockPos p_175927_1_, World worldIn) - { - BlockPos blockpos = p_175927_1_.down(); -- Block block = worldIn.getBlockState(blockpos).getBlock(); -+ IBlockState state = worldIn.getBlockState(blockpos); -+ boolean isSoil = state.getBlock().canSustainPlant(state, worldIn, blockpos, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); - -- if ((block == Blocks.grass || block == Blocks.dirt) && p_175927_1_.getY() >= 2) -+ if (isSoil && p_175927_1_.getY() >= 2) - { -- this.func_175921_a(worldIn, blockpos); -- this.func_175921_a(worldIn, blockpos.east()); -- this.func_175921_a(worldIn, blockpos.south()); -- this.func_175921_a(worldIn, blockpos.south().east()); -+ this.onPlantGrow(worldIn, blockpos, p_175927_1_); -+ this.onPlantGrow(worldIn, blockpos.east(), p_175927_1_); -+ this.onPlantGrow(worldIn, blockpos.south(), p_175927_1_); -+ this.onPlantGrow(worldIn, blockpos.south().east(), p_175927_1_); - return true; - } - else -@@ -113,9 +114,9 @@ - if (j * j + k * k <= i || l * l + i1 * i1 <= i || j * j + i1 * i1 <= i || l * l + k * k <= i) - { - BlockPos blockpos = p_175925_2_.add(j, 0, k); -- Material material = worldIn.getBlockState(blockpos).func_185904_a(); -+ IBlockState state = worldIn.getBlockState(blockpos); - -- if (material == Material.air || material == Material.leaves) -+ if (state.getBlock().isAir(state, worldIn, blockpos) || state.getBlock().isLeaves(state, worldIn, blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata); - } -@@ -135,9 +136,9 @@ - if (j * j + k * k <= i) - { - BlockPos blockpos = p_175928_2_.add(j, 0, k); -- Material material = worldIn.getBlockState(blockpos).func_185904_a(); -+ IBlockState state = worldIn.getBlockState(blockpos); - -- if (material == Material.air || material == Material.leaves) -+ if (state.getBlock().isAir(state, worldIn, blockpos) || state.getBlock().isLeaves(state, worldIn, blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata); - } -@@ -145,4 +146,11 @@ - } - } - } -+ -+ //Just a helper macro -+ private void onPlantGrow(World world, BlockPos pos, BlockPos source) -+ { -+ IBlockState state = world.getBlockState(pos); -+ state.getBlock().onPlantGrow(state, world, pos, source); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenIceSpike.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenIceSpike.java.patch deleted file mode 100644 index e3a442962..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenIceSpike.java.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenIceSpike.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenIceSpike.java -@@ -51,7 +51,7 @@ - IBlockState iblockstate = worldIn.getBlockState(position.add(i1, k, j1)); - Block block = iblockstate.getBlock(); - -- if (iblockstate.func_185904_a() == Material.air || block == Blocks.dirt || block == Blocks.snow || block == Blocks.ice) -+ if (iblockstate.getBlock().isAir(iblockstate, worldIn, position.add(i1, k, j1)) || block == Blocks.dirt || block == Blocks.snow || block == Blocks.ice) - { - this.setBlockAndNotifyAdequately(worldIn, position.add(i1, k, j1), Blocks.packed_ice.getDefaultState()); - } -@@ -61,7 +61,7 @@ - iblockstate = worldIn.getBlockState(position.add(i1, -k, j1)); - block = iblockstate.getBlock(); - -- if (iblockstate.func_185904_a() == Material.air || block == Blocks.dirt || block == Blocks.snow || block == Blocks.ice) -+ if (iblockstate.getBlock().isAir(iblockstate, worldIn, position.add(i1, -k, j1)) || block == Blocks.dirt || block == Blocks.snow || block == Blocks.ice) - { - this.setBlockAndNotifyAdequately(worldIn, position.add(i1, -k, j1), Blocks.packed_ice.getDefaultState()); - } -@@ -99,7 +99,7 @@ - IBlockState iblockstate1 = worldIn.getBlockState(blockpos); - Block block1 = iblockstate1.getBlock(); - -- if (iblockstate1.func_185904_a() != Material.air && block1 != Blocks.dirt && block1 != Blocks.snow && block1 != Blocks.ice && block1 != Blocks.packed_ice) -+ if (!iblockstate1.getBlock().isAir(iblockstate1, worldIn, blockpos) && block1 != Blocks.dirt && block1 != Blocks.snow && block1 != Blocks.ice && block1 != Blocks.packed_ice) - { - break; - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenLiquids.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenLiquids.java.patch deleted file mode 100644 index 36c45d5d3..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenLiquids.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenLiquids.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenLiquids.java -@@ -26,7 +26,7 @@ - { - return false; - } -- else if (worldIn.getBlockState(position).func_185904_a() != Material.air && worldIn.getBlockState(position).getBlock() != Blocks.stone) -+ else if (!worldIn.isAirBlock(position) && worldIn.getBlockState(position).getBlock() != Blocks.stone) - { - return false; - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch deleted file mode 100644 index 54882ef4d..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch +++ /dev/null @@ -1,50 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java -@@ -55,7 +55,7 @@ - { - BlockPos blockpos = position.up(i2); - -- if (this.func_150523_a(worldIn.getBlockState(blockpos).getBlock())) -+ if (this.isAirLeaves(worldIn,blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, this.woodMetadata); - -@@ -70,7 +70,7 @@ - { - BlockPos blockpos1 = blockpos.east(); - -- if (this.func_150523_a(worldIn.getBlockState(blockpos1).getBlock())) -+ if (this.isAirLeaves(worldIn,blockpos1)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos1, this.woodMetadata); - -@@ -83,7 +83,7 @@ - - BlockPos blockpos2 = blockpos.south().east(); - -- if (this.func_150523_a(worldIn.getBlockState(blockpos2).getBlock())) -+ if (this.isAirLeaves(worldIn,blockpos2)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos2, this.woodMetadata); - -@@ -96,7 +96,7 @@ - - BlockPos blockpos3 = blockpos.south(); - -- if (this.func_150523_a(worldIn.getBlockState(blockpos3).getBlock())) -+ if (this.isAirLeaves(worldIn,blockpos3)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos3, this.woodMetadata); - -@@ -130,4 +130,11 @@ - this.func_175925_a(worldIn, p_175930_2_.up(j), p_175930_3_ + 1 - j); - } - } -+ -+ //Helper macro -+ private boolean isAirLeaves(World world, BlockPos pos) -+ { -+ IBlockState state = world.getBlockState(pos); -+ return state.getBlock().isAir(state, world, pos) || state.getBlock().isLeaves(state, world, pos); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch deleted file mode 100644 index da814bc5c..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch +++ /dev/null @@ -1,60 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java -@@ -41,32 +41,25 @@ - - for (int j = 0; j < i; ++j) - { -- IBlockState iblockstate = worldIn.getBlockState(position.up(j)); -- -- if (iblockstate.func_185904_a() == Material.air || iblockstate.func_185904_a() == Material.leaves) -+ if (isAirLeaves(worldIn, position.up(j))) - { - this.setBlockAndNotifyAdequately(worldIn, position.up(j), this.woodMetadata); - } - - if (j < i - 1) - { -- iblockstate = worldIn.getBlockState(position.add(1, j, 0)); -- -- if (iblockstate.func_185904_a() == Material.air || iblockstate.func_185904_a() == Material.leaves) -+ if (isAirLeaves(worldIn, position.add(1, j, 0))) - { - this.setBlockAndNotifyAdequately(worldIn, position.add(1, j, 0), this.woodMetadata); - } - -- iblockstate = worldIn.getBlockState(position.add(1, j, 1)); -- -- if (iblockstate.func_185904_a() == Material.air || iblockstate.func_185904_a() == Material.leaves) -+ if (isAirLeaves(worldIn, position.add(1, j, 1))) - { - this.setBlockAndNotifyAdequately(worldIn, position.add(1, j, 1), this.woodMetadata); - } - -- iblockstate = worldIn.getBlockState(position.add(0, j, 1)); - -- if (iblockstate.func_185904_a() == Material.air || iblockstate.func_185904_a() == Material.leaves) -+ if (isAirLeaves(worldIn, position.add(0, j, 1))) - { - this.setBlockAndNotifyAdequately(worldIn, position.add(0, j, 1), this.woodMetadata); - } -@@ -133,7 +126,7 @@ - IBlockState iblockstate = worldIn.getBlockState(blockpos); - Block block = iblockstate.getBlock(); - -- if (block == Blocks.grass || block == Blocks.dirt) -+ if (block.canSustainPlant(iblockstate, worldIn, blockpos, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling))) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181635_g); - break; -@@ -145,4 +138,11 @@ - } - } - } -+ -+ //Helper macro -+ private boolean isAirLeaves(World world, BlockPos pos) -+ { -+ IBlockState state = world.getBlockState(pos); -+ return state.getBlock().isAir(state, world, pos) || state.getBlock().isLeaves(state, world, pos); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch deleted file mode 100644 index bc5a4713c..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java -@@ -73,7 +73,8 @@ - { - BlockPos blockpos = new BlockPos(l1, i2, j2); - -- if (this.predicate.apply(worldIn.getBlockState(blockpos))) -+ IBlockState state = worldIn.getBlockState(blockpos); -+ if (state.getBlock().isReplaceableOreGen(state, worldIn, blockpos, this.predicate)) - { - worldIn.setBlockState(blockpos, this.oreBlock, 2); - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch deleted file mode 100644 index 50dad44e1..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch +++ /dev/null @@ -1,64 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java -@@ -52,7 +52,7 @@ - { - if (j >= 0 && j < 256) - { -- if (!this.func_150523_a(worldIn.getBlockState(blockpos$mutableblockpos.set(l, j, i1)).getBlock())) -+ if (!this.isReplaceable(worldIn,blockpos$mutableblockpos.set(l, j, i1))) - { - flag = false; - } -@@ -71,11 +71,13 @@ - } - else - { -- Block block = worldIn.getBlockState(position.down()).getBlock(); -+ BlockPos down = position.down(); -+ IBlockState state = worldIn.getBlockState(down); -+ boolean isSoil = state.getBlock().canSustainPlant(state, worldIn, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); - -- if ((block == Blocks.grass || block == Blocks.dirt) && position.getY() < 256 - i - 1) -+ if (isSoil && position.getY() < worldIn.getHeight() - i - 1) - { -- this.func_175921_a(worldIn, position.down()); -+ state.getBlock().onPlantGrow(state, worldIn, down, position); - EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.random(rand); - int k2 = i - rand.nextInt(4) - 1; - int l2 = 3 - rand.nextInt(3); -@@ -95,9 +97,9 @@ - } - - BlockPos blockpos = new BlockPos(i3, i2, j1); -- Material material = worldIn.getBlockState(blockpos).func_185904_a(); -+ state = worldIn.getBlockState(blockpos); - -- if (material == Material.air || material == Material.leaves) -+ if (state.getBlock().isAir(state, worldIn, blockpos) || state.getBlock().isLeaves(state, worldIn, blockpos)) - { - this.func_181642_b(worldIn, blockpos); - k1 = i2; -@@ -149,9 +151,9 @@ - i3 += enumfacing1.getFrontOffsetX(); - j1 += enumfacing1.getFrontOffsetZ(); - BlockPos blockpos1 = new BlockPos(i3, j2, j1); -- Material material1 = worldIn.getBlockState(blockpos1).func_185904_a(); -+ state = worldIn.getBlockState(blockpos1); - -- if (material1 == Material.air || material1 == Material.leaves) -+ if (state.getBlock().isAir(state, worldIn, blockpos1) || state.getBlock().isLeaves(state, worldIn, blockpos1)) - { - this.func_181642_b(worldIn, blockpos1); - k1 = j2; -@@ -209,9 +211,9 @@ - - private void func_175924_b(World worldIn, BlockPos p_175924_2_) - { -- Material material = worldIn.getBlockState(p_175924_2_).func_185904_a(); -+ IBlockState state = worldIn.getBlockState(p_175924_2_); - -- if (material == Material.air || material == Material.leaves) -+ if (state.getBlock().isAir(state, worldIn, p_175924_2_) || state.getBlock().isLeaves(state, worldIn, p_175924_2_)) - { - this.setBlockAndNotifyAdequately(worldIn, p_175924_2_, field_181644_b); - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch deleted file mode 100644 index b5fb60579..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java -@@ -22,16 +22,16 @@ - - public boolean generate(World worldIn, Random rand, BlockPos position) - { -- IBlockState iblockstate; -- -- while (((iblockstate = worldIn.getBlockState(position)).func_185904_a() == Material.air || iblockstate.func_185904_a() == Material.leaves) && position.getY() > 0) -+ do - { -+ IBlockState state = worldIn.getBlockState(position); -+ if (!state.getBlock().isLeaves(state, worldIn, position) && !state.getBlock().isLeaves(state, worldIn, position)) break; - position = position.down(); -- } -+ } while (position.getY() > 0); - -- Block block = worldIn.getBlockState(position).getBlock(); -+ IBlockState state = worldIn.getBlockState(position); - -- if (block == Blocks.dirt || block == Blocks.grass) -+ if (state.getBlock().canSustainPlant(state, worldIn, position, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling))) - { - position = position.up(); - this.setBlockAndNotifyAdequately(worldIn, position, this.woodMetadata); -@@ -52,9 +52,9 @@ - if (Math.abs(i1) != k || Math.abs(k1) != k || rand.nextInt(2) != 0) - { - BlockPos blockpos = new BlockPos(l, i, j1); -- Material material = worldIn.getBlockState(blockpos).func_185904_a(); -+ state = worldIn.getBlockState(blockpos); - -- if (material == Material.air || material == Material.leaves) -+ if (state.getBlock().canBeReplacedByLeaves(state, worldIn, blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata); - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch deleted file mode 100644 index 1adcecd9c..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch +++ /dev/null @@ -1,98 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java -@@ -61,7 +61,7 @@ - IBlockState iblockstate = worldIn.getBlockState(blockpos$mutableblockpos.set(l, j, i1)); - Block block = iblockstate.getBlock(); - -- if (iblockstate.func_185904_a() != Material.air && iblockstate.func_185904_a() != Material.leaves) -+ if (!iblockstate.getBlock().isAir(iblockstate, worldIn, blockpos$mutableblockpos.set(l, j, i1)) && !iblockstate.getBlock().isLeaves(iblockstate, worldIn, blockpos$mutableblockpos.set(l, j, i1))) - { - if (block != Blocks.water && block != Blocks.flowing_water) - { -@@ -87,11 +87,13 @@ - } - else - { -- Block block1 = worldIn.getBlockState(position.down()).getBlock(); -+ BlockPos down = position.down(); -+ IBlockState state = worldIn.getBlockState(down); -+ boolean isSoil = state.getBlock().canSustainPlant(state, worldIn, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); - -- if ((block1 == Blocks.grass || block1 == Blocks.dirt) && position.getY() < 256 - i - 1) -+ if (isSoil && position.getY() < worldIn.getHeight() - i - 1) - { -- this.func_175921_a(worldIn, position.down()); -+ state.getBlock().onPlantGrow(state, worldIn, position.down(),position); - - for (int k1 = position.getY() - 3 + i; k1 <= position.getY() + i; ++k1) - { -@@ -109,8 +111,9 @@ - if (Math.abs(k3) != l2 || Math.abs(j1) != l2 || rand.nextInt(2) != 0 && j2 != 0) - { - BlockPos blockpos = new BlockPos(j3, k1, i4); -+ state = worldIn.getBlockState(blockpos); - -- if (!worldIn.getBlockState(blockpos).func_185913_b()) -+ if (state.getBlock().canBeReplacedByLeaves(state, worldIn, blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181649_b); - } -@@ -121,10 +124,11 @@ - - for (int l1 = 0; l1 < i; ++l1) - { -- IBlockState iblockstate1 = worldIn.getBlockState(position.up(l1)); -+ BlockPos upN = position.up(l1); -+ IBlockState iblockstate1 = worldIn.getBlockState(upN); - Block block2 = iblockstate1.getBlock(); - -- if (iblockstate1.func_185904_a() == Material.air || iblockstate1.func_185904_a() == Material.leaves || block2 == Blocks.flowing_water || block2 == Blocks.water) -+ if (block2.isAir(iblockstate1, worldIn, upN) || block2.isLeaves(iblockstate1, worldIn, upN) || block2 == Blocks.flowing_water || block2 == Blocks.water) - { - this.setBlockAndNotifyAdequately(worldIn, position.up(l1), field_181648_a); - } -@@ -149,22 +153,22 @@ - BlockPos blockpos1 = blockpos$mutableblockpos1.north(); - BlockPos blockpos2 = blockpos$mutableblockpos1.south(); - -- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).func_185904_a() == Material.air) -+ if (rand.nextInt(4) == 0 && isAir(worldIn, blockpos3)) - { - this.func_181647_a(worldIn, blockpos3, BlockVine.EAST); - } - -- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).func_185904_a() == Material.air) -+ if (rand.nextInt(4) == 0 && isAir(worldIn, blockpos4)) - { - this.func_181647_a(worldIn, blockpos4, BlockVine.WEST); - } - -- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).func_185904_a() == Material.air) -+ if (rand.nextInt(4) == 0 && isAir(worldIn, blockpos1)) - { - this.func_181647_a(worldIn, blockpos1, BlockVine.SOUTH); - } - -- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).func_185904_a() == Material.air) -+ if (rand.nextInt(4) == 0 && isAir(worldIn, blockpos2)) - { - this.func_181647_a(worldIn, blockpos2, BlockVine.NORTH); - } -@@ -193,10 +197,16 @@ - this.setBlockAndNotifyAdequately(p_181647_1_, p_181647_2_, iblockstate); - int i = 4; - -- for (p_181647_2_ = p_181647_2_.down(); p_181647_1_.getBlockState(p_181647_2_).func_185904_a() == Material.air && i > 0; --i) -+ for (p_181647_2_ = p_181647_2_.down(); isAir(p_181647_1_, p_181647_2_) && i > 0; --i) - { - this.setBlockAndNotifyAdequately(p_181647_1_, p_181647_2_, iblockstate); - p_181647_2_ = p_181647_2_.down(); - } - } -+ -+ private boolean isAir(World world, BlockPos pos) -+ { -+ IBlockState state = world.getBlockState(pos); -+ return state.getBlock().isAir(state, world, pos); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch deleted file mode 100644 index fba5e3c2c..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch +++ /dev/null @@ -1,52 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java -@@ -53,7 +53,7 @@ - { - if (i1 >= 0 && i1 < 256) - { -- if (!this.func_150523_a(worldIn.getBlockState(blockpos$mutableblockpos.set(k1, i1, l1)).getBlock())) -+ if (!this.isReplaceable(worldIn,blockpos$mutableblockpos.set(k1, i1, l1))) - { - flag = false; - } -@@ -72,11 +72,13 @@ - } - else - { -- Block block = worldIn.getBlockState(position.down()).getBlock(); -+ BlockPos down = position.down(); -+ IBlockState state = worldIn.getBlockState(down); -+ boolean isSoil = state.getBlock().canSustainPlant(state, worldIn, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.sapling); - -- if ((block == Blocks.grass || block == Blocks.dirt) && position.getY() < 256 - i - 1) -+ if (isSoil && position.getY() < 256 - i - 1) - { -- this.func_175921_a(worldIn, position.down()); -+ state.getBlock().onPlantGrow(state, worldIn, down, position); - int k2 = 0; - - for (int l2 = position.getY() + i; l2 >= position.getY() + j; --l2) -@@ -92,8 +94,9 @@ - if (Math.abs(k3) != k2 || Math.abs(j2) != k2 || k2 <= 0) - { - BlockPos blockpos = new BlockPos(j3, l2, i2); -+ state = worldIn.getBlockState(blockpos); - -- if (!worldIn.getBlockState(blockpos).func_185913_b()) -+ if (state.getBlock().canBeReplacedByLeaves(state, worldIn, blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181637_b); - } -@@ -113,9 +116,10 @@ - - for (int i3 = 0; i3 < i - 1; ++i3) - { -- Material material = worldIn.getBlockState(position.up(i3)).func_185904_a(); -+ BlockPos upN = position.up(i3); -+ state = worldIn.getBlockState(upN); - -- if (material == Material.air || material == Material.leaves) -+ if (state.getBlock().isAir(state, worldIn, upN) || state.getBlock().isLeaves(state, worldIn, upN)) - { - this.setBlockAndNotifyAdequately(worldIn, position.up(i3), field_181636_a); - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch deleted file mode 100644 index e4b0a43f8..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch +++ /dev/null @@ -1,66 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java -@@ -30,7 +30,7 @@ - int l = 2 + rand.nextInt(2); - boolean flag = true; - -- if (position.getY() >= 1 && position.getY() + i + 1 <= 256) -+ if (position.getY() >= 1 && position.getY() + i + 1 <= worldIn.getHeight()) - { - for (int i1 = position.getY(); i1 <= position.getY() + 1 + i && flag; ++i1) - { -@@ -51,11 +51,11 @@ - { - for (int l1 = position.getZ() - j1; l1 <= position.getZ() + j1 && flag; ++l1) - { -- if (i1 >= 0 && i1 < 256) -+ if (i1 >= 0 && i1 < worldIn.getHeight()) - { -- Material material = worldIn.getBlockState(blockpos$mutableblockpos.set(k1, i1, l1)).func_185904_a(); -+ IBlockState state = worldIn.getBlockState(blockpos$mutableblockpos.set(k1, i1, l1)); - -- if (material != Material.air && material != Material.leaves) -+ if (!state.getBlock().isAir(state, worldIn, blockpos$mutableblockpos.set(k1, i1, l1)) && !state.getBlock().isLeaves(state, worldIn, blockpos$mutableblockpos.set(k1, i1, l1))) - { - flag = false; - } -@@ -74,11 +74,12 @@ - } - else - { -- Block block = worldIn.getBlockState(position.down()).getBlock(); -+ BlockPos down = position.down(); -+ IBlockState state = worldIn.getBlockState(down); - -- if ((block == Blocks.grass || block == Blocks.dirt || block == Blocks.farmland) && position.getY() < 256 - i - 1) -+ if (state.getBlock().canSustainPlant(state, worldIn, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.sapling) && position.getY() < worldIn.getHeight() - i - 1) - { -- this.func_175921_a(worldIn, position.down()); -+ state.getBlock().onPlantGrow(state, worldIn, down, position); - int i3 = rand.nextInt(2); - int j3 = 1; - int k3 = 0; -@@ -98,8 +99,9 @@ - if (Math.abs(j2) != i3 || Math.abs(l2) != i3 || i3 <= 0) - { - BlockPos blockpos = new BlockPos(i2, j4, k2); -+ state = worldIn.getBlockState(blockpos); - -- if (!worldIn.getBlockState(blockpos).func_185913_b()) -+ if (state.getBlock().canBeReplacedByLeaves(state, worldIn, blockpos)) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181646_b); - } -@@ -128,9 +130,10 @@ - - for (int k4 = 0; k4 < i - i4; ++k4) - { -- Material material1 = worldIn.getBlockState(position.up(k4)).func_185904_a(); -+ BlockPos upN = position.up(k4); -+ state = worldIn.getBlockState(upN); - -- if (material1 == Material.air || material1 == Material.leaves) -+ if (state.getBlock().isAir(state, worldIn, upN) || state.getBlock().isLeaves(state, worldIn, upN)) - { - this.setBlockAndNotifyAdequately(worldIn, position.up(k4), field_181645_a); - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch deleted file mode 100644 index 0dafce754..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java -@@ -19,12 +19,12 @@ - - public boolean generate(World worldIn, Random rand, BlockPos position) - { -- IBlockState iblockstate; -- -- while (((iblockstate = worldIn.getBlockState(position)).func_185904_a() == Material.air || iblockstate.func_185904_a() == Material.leaves) && position.getY() > 0) -+ do - { -+ IBlockState state = worldIn.getBlockState(position); -+ if (!state.getBlock().isAir(state, worldIn, position) && !state.getBlock().isLeaves(state, worldIn, position)) break; - position = position.down(); -- } -+ } while (position.getY() > 0); - - for (int i = 0; i < 128; ++i) - { diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch deleted file mode 100644 index 4b2a82109..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch +++ /dev/null @@ -1,105 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java -@@ -44,7 +44,7 @@ - int i = rand.nextInt(3) + this.minTreeHeight; - boolean flag = true; - -- if (position.getY() >= 1 && position.getY() + i + 1 <= 256) -+ if (position.getY() >= 1 && position.getY() + i + 1 <= worldIn.getHeight()) - { - for (int j = position.getY(); j <= position.getY() + 1 + i; ++j) - { -@@ -66,9 +66,9 @@ - { - for (int i1 = position.getZ() - k; i1 <= position.getZ() + k && flag; ++i1) - { -- if (j >= 0 && j < 256) -+ if (j >= 0 && j < worldIn.getHeight()) - { -- if (!this.func_150523_a(worldIn.getBlockState(blockpos$mutableblockpos.set(l, j, i1)).getBlock())) -+ if (!this.isReplaceable(worldIn,blockpos$mutableblockpos.set(l, j, i1))) - { - flag = false; - } -@@ -87,9 +87,9 @@ - } - else - { -- Block block = worldIn.getBlockState(position.down()).getBlock(); -+ IBlockState state = worldIn.getBlockState(position.down()); - -- if ((block == Blocks.grass || block == Blocks.dirt || block == Blocks.farmland) && position.getY() < 256 - i - 1) -+ if (state.getBlock().canSustainPlant(state, worldIn, position.down(), net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.sapling) && position.getY() < worldIn.getHeight() - i - 1) - { - this.func_175921_a(worldIn, position.down()); - int k2 = 3; -@@ -111,9 +111,9 @@ - if (Math.abs(l1) != j1 || Math.abs(j2) != j1 || rand.nextInt(2) != 0 && i4 != 0) - { - BlockPos blockpos = new BlockPos(k1, i3, i2); -- Material material = worldIn.getBlockState(blockpos).func_185904_a(); -+ state = worldIn.getBlockState(blockpos); - -- if (material == Material.air || material == Material.leaves || material == Material.vine) -+ if (state.getBlock().isAir(state, worldIn, blockpos) || state.getBlock().isLeaves(state, worldIn, blockpos) || state.func_185904_a() == Material.vine) - { - this.setBlockAndNotifyAdequately(worldIn, blockpos, this.metaLeaves); - } -@@ -124,9 +124,10 @@ - - for (int j3 = 0; j3 < i; ++j3) - { -- Material material1 = worldIn.getBlockState(position.up(j3)).func_185904_a(); -+ BlockPos upN = position.up(j3); -+ state = worldIn.getBlockState(upN); - -- if (material1 == Material.air || material1 == Material.leaves || material1 == Material.vine) -+ if (state.getBlock().isAir(state, worldIn, upN) || state.getBlock().isLeaves(state, worldIn, upN) || state.func_185904_a() == Material.vine) - { - this.setBlockAndNotifyAdequately(worldIn, position.up(j3), this.metaWood); - -@@ -169,29 +170,30 @@ - { - blockpos$mutableblockpos1.set(l4, k3, i5); - -- if (worldIn.getBlockState(blockpos$mutableblockpos1).func_185904_a() == Material.leaves) -+ state = worldIn.getBlockState(blockpos$mutableblockpos1); -+ if (state.getBlock().isLeaves(state, worldIn, blockpos$mutableblockpos1)) - { - BlockPos blockpos2 = blockpos$mutableblockpos1.west(); - BlockPos blockpos3 = blockpos$mutableblockpos1.east(); - BlockPos blockpos4 = blockpos$mutableblockpos1.north(); - BlockPos blockpos1 = blockpos$mutableblockpos1.south(); - -- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).func_185904_a() == Material.air) -+ if (rand.nextInt(4) == 0 && worldIn.isAirBlock(blockpos2)) - { - this.func_181650_b(worldIn, blockpos2, BlockVine.EAST); - } - -- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).func_185904_a() == Material.air) -+ if (rand.nextInt(4) == 0 && worldIn.isAirBlock(blockpos3)) - { - this.func_181650_b(worldIn, blockpos3, BlockVine.WEST); - } - -- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).func_185904_a() == Material.air) -+ if (rand.nextInt(4) == 0 && worldIn.isAirBlock(blockpos4)) - { - this.func_181650_b(worldIn, blockpos4, BlockVine.SOUTH); - } - -- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).func_185904_a() == Material.air) -+ if (rand.nextInt(4) == 0 && worldIn.isAirBlock(blockpos1)) - { - this.func_181650_b(worldIn, blockpos1, BlockVine.NORTH); - } -@@ -245,7 +247,7 @@ - this.func_181651_a(p_181650_1_, p_181650_2_, p_181650_3_); - int i = 4; - -- for (p_181650_2_ = p_181650_2_.down(); p_181650_1_.getBlockState(p_181650_2_).func_185904_a() == Material.air && i > 0; --i) -+ for (p_181650_2_ = p_181650_2_.down(); p_181650_1_.isAirBlock(p_181650_2_) && i > 0; --i) - { - this.func_181651_a(p_181650_1_, p_181650_2_, p_181650_3_); - p_181650_2_ = p_181650_2_.down(); diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch deleted file mode 100644 index 9ff41f8ec..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch +++ /dev/null @@ -1,55 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java -@@ -14,12 +14,12 @@ - { - public boolean generate(World worldIn, Random rand, BlockPos position) - { -- IBlockState iblockstate; -- -- while (((iblockstate = worldIn.getBlockState(position)).func_185904_a() == Material.air || iblockstate.func_185904_a() == Material.leaves) && position.getY() > 1) -+ do - { -+ IBlockState state = worldIn.getBlockState(position); -+ if (!state.getBlock().isAir(state, worldIn, position) && !state.getBlock().isLeaves(state, worldIn, position)) break; - position = position.down(); -- } -+ } while (position.getY() > 0); - - if (position.getY() < 1) - { -@@ -33,7 +33,7 @@ - { - BlockPos blockpos = position.add(rand.nextInt(4) - rand.nextInt(4), rand.nextInt(3) - rand.nextInt(3), rand.nextInt(4) - rand.nextInt(4)); - -- if (worldIn.isAirBlock(blockpos) && worldIn.getBlockState(blockpos.down()).func_185896_q()) -+ if (worldIn.isAirBlock(blockpos) && worldIn.getBlockState(blockpos.down()).isSideSolid(worldIn, blockpos.down(), net.minecraft.util.EnumFacing.UP)) - { - worldIn.setBlockState(blockpos, Blocks.chest.getDefaultState(), 2); - TileEntity tileentity = worldIn.getTileEntity(blockpos); -@@ -48,22 +48,22 @@ - BlockPos blockpos3 = blockpos.north(); - BlockPos blockpos4 = blockpos.south(); - -- if (worldIn.isAirBlock(blockpos2) && worldIn.getBlockState(blockpos2.down()).func_185896_q()) -+ if (worldIn.isAirBlock(blockpos2) && worldIn.getBlockState(blockpos2.down()).isSideSolid(worldIn, blockpos2.down(), net.minecraft.util.EnumFacing.UP)) - { - worldIn.setBlockState(blockpos2, Blocks.torch.getDefaultState(), 2); - } - -- if (worldIn.isAirBlock(blockpos1) && worldIn.getBlockState(blockpos1.down()).func_185896_q()) -+ if (worldIn.isAirBlock(blockpos1) && worldIn.getBlockState(blockpos1.down()).isSideSolid(worldIn, blockpos1.down(), net.minecraft.util.EnumFacing.UP)) - { - worldIn.setBlockState(blockpos1, Blocks.torch.getDefaultState(), 2); - } - -- if (worldIn.isAirBlock(blockpos3) && worldIn.getBlockState(blockpos3.down()).func_185896_q()) -+ if (worldIn.isAirBlock(blockpos3) && worldIn.getBlockState(blockpos3.down()).isSideSolid(worldIn, blockpos3.down(), net.minecraft.util.EnumFacing.UP)) - { - worldIn.setBlockState(blockpos3, Blocks.torch.getDefaultState(), 2); - } - -- if (worldIn.isAirBlock(blockpos4) && worldIn.getBlockState(blockpos4.down()).func_185896_q()) -+ if (worldIn.isAirBlock(blockpos4) && worldIn.getBlockState(blockpos4.down()).isSideSolid(worldIn, blockpos4.down(), net.minecraft.util.EnumFacing.UP)) - { - worldIn.setBlockState(blockpos4, Blocks.torch.getDefaultState(), 2); - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch deleted file mode 100644 index 2538914b0..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch +++ /dev/null @@ -1,56 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/layer/GenLayer.java -+++ ../src-work/minecraft/net/minecraft/world/gen/layer/GenLayer.java -@@ -49,12 +49,12 @@ - i = 6; - } - -+ i = getModdedBiomeSize(p_180781_2_, i); -+ - GenLayer lvt_8_1_ = GenLayerZoom.magnify(1000L, genlayer4, 0); - GenLayerRiverInit genlayerriverinit = new GenLayerRiverInit(100L, lvt_8_1_); -- GenLayerBiome lvt_9_1_ = new GenLayerBiome(200L, genlayer4, p_180781_2_, p_180781_3_); -- GenLayer genlayer6 = GenLayerZoom.magnify(1000L, lvt_9_1_, 2); -- GenLayerBiomeEdge genlayerbiomeedge = new GenLayerBiomeEdge(1000L, genlayer6); - GenLayer lvt_10_1_ = GenLayerZoom.magnify(1000L, genlayerriverinit, 2); -+ GenLayer genlayerbiomeedge = p_180781_2_.getBiomeLayer(seed, genlayer4, p_180781_3_); - GenLayer genlayerhills = new GenLayerHills(1000L, genlayerbiomeedge, lvt_10_1_); - GenLayer genlayer5 = GenLayerZoom.magnify(1000L, genlayerriverinit, 2); - genlayer5 = GenLayerZoom.magnify(1000L, genlayer5, j); -@@ -158,8 +158,7 @@ - - protected static boolean isBiomeOceanic(int p_151618_0_) - { -- BiomeGenBase biomegenbase = BiomeGenBase.getBiome(p_151618_0_); -- return biomegenbase == Biomes.ocean || biomegenbase == Biomes.deepOcean || biomegenbase == Biomes.frozenOcean; -+ return net.minecraftforge.common.BiomeManager.oceanBiomes.contains(BiomeGenBase.getBiome(p_151618_0_)); - } - - protected int selectRandom(int... p_151619_1_) -@@ -171,4 +170,27 @@ - { - return p_151617_2_ == p_151617_3_ && p_151617_3_ == p_151617_4_ ? p_151617_2_ : (p_151617_1_ == p_151617_2_ && p_151617_1_ == p_151617_3_ ? p_151617_1_ : (p_151617_1_ == p_151617_2_ && p_151617_1_ == p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_3_ && p_151617_1_ == p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_2_ && p_151617_3_ != p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_3_ && p_151617_2_ != p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_4_ && p_151617_2_ != p_151617_3_ ? p_151617_1_ : (p_151617_2_ == p_151617_3_ && p_151617_1_ != p_151617_4_ ? p_151617_2_ : (p_151617_2_ == p_151617_4_ && p_151617_1_ != p_151617_3_ ? p_151617_2_ : (p_151617_3_ == p_151617_4_ && p_151617_1_ != p_151617_2_ ? p_151617_3_ : this.selectRandom(new int[] {p_151617_1_, p_151617_2_, p_151617_3_, p_151617_4_})))))))))); - } -+ -+ /* ======================================== FORGE START =====================================*/ -+ protected long nextLong(long par1) -+ { -+ long j = (this.chunkSeed >> 24) % par1; -+ -+ if (j < 0) -+ { -+ j += par1; -+ } -+ -+ this.chunkSeed *= this.chunkSeed * 6364136223846793005L + 1442695040888963407L; -+ this.chunkSeed += this.worldGenSeed; -+ return j; -+ } -+ -+ public static int getModdedBiomeSize(WorldType worldType, int original) -+ { -+ net.minecraftforge.event.terraingen.WorldTypeEvent.BiomeSize event = new net.minecraftforge.event.terraingen.WorldTypeEvent.BiomeSize(worldType, original); -+ net.minecraftforge.common.MinecraftForge.TERRAIN_GEN_BUS.post(event); -+ return event.newSize; -+ } -+ /* ========================================= FORGE END ======================================*/ - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch deleted file mode 100644 index adc74b8ea..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch +++ /dev/null @@ -1,93 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java -+++ ../src-work/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java -@@ -7,10 +7,8 @@ - - public class GenLayerBiome extends GenLayer - { -- private BiomeGenBase[] field_151623_c = new BiomeGenBase[] {Biomes.desert, Biomes.desert, Biomes.desert, Biomes.savanna, Biomes.savanna, Biomes.plains}; -- private BiomeGenBase[] field_151621_d = new BiomeGenBase[] {Biomes.forest, Biomes.roofedForest, Biomes.extremeHills, Biomes.plains, Biomes.birchForest, Biomes.swampland}; -- private BiomeGenBase[] field_151622_e = new BiomeGenBase[] {Biomes.forest, Biomes.extremeHills, Biomes.taiga, Biomes.plains}; -- private BiomeGenBase[] field_151620_f = new BiomeGenBase[] {Biomes.icePlains, Biomes.icePlains, Biomes.icePlains, Biomes.coldTaiga}; -+ @SuppressWarnings("unchecked") -+ private java.util.List[] biomes = new java.util.ArrayList[net.minecraftforge.common.BiomeManager.BiomeType.values().length]; - private final ChunkProviderSettings field_175973_g; - - public GenLayerBiome(long p_i45560_1_, GenLayer p_i45560_3_, WorldType p_i45560_4_, String p_i45560_5_) -@@ -18,9 +16,30 @@ - super(p_i45560_1_); - this.parent = p_i45560_3_; - -+ for (net.minecraftforge.common.BiomeManager.BiomeType type : net.minecraftforge.common.BiomeManager.BiomeType.values()) -+ { -+ com.google.common.collect.ImmutableList biomesToAdd = net.minecraftforge.common.BiomeManager.getBiomes(type); -+ int idx = type.ordinal(); -+ -+ if (biomes[idx] == null) biomes[idx] = new java.util.ArrayList(); -+ if (biomesToAdd != null) biomes[idx].addAll(biomesToAdd); -+ } -+ -+ int desertIdx = net.minecraftforge.common.BiomeManager.BiomeType.DESERT.ordinal(); -+ -+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.desert, 30)); -+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.savanna, 20)); -+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.plains, 10)); -+ - if (p_i45560_4_ == WorldType.DEFAULT_1_1) - { -- this.field_151623_c = new BiomeGenBase[] {Biomes.desert, Biomes.forest, Biomes.extremeHills, Biomes.swampland, Biomes.plains, Biomes.taiga}; -+ biomes[desertIdx].clear(); -+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.desert, 10)); -+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.forest, 10)); -+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.extremeHills, 10)); -+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.swampland, 10)); -+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.plains, 10)); -+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.taiga, 10)); - this.field_175973_g = null; - } - else if (p_i45560_4_ == WorldType.CUSTOMIZED) -@@ -74,7 +93,7 @@ - } - else - { -- aint1[j + i * areaWidth] = BiomeGenBase.func_185362_a(this.field_151623_c[this.nextInt(this.field_151623_c.length)]); -+ aint1[k + i * areaWidth] = BiomeGenBase.func_185362_a(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.DESERT).biome); - } - } - else if (k == 2) -@@ -85,7 +104,7 @@ - } - else - { -- aint1[j + i * areaWidth] = BiomeGenBase.func_185362_a(this.field_151621_d[this.nextInt(this.field_151621_d.length)]); -+ aint1[j + i * areaWidth] = BiomeGenBase.func_185362_a(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.WARM).biome); - } - } - else if (k == 3) -@@ -96,12 +115,12 @@ - } - else - { -- aint1[j + i * areaWidth] = BiomeGenBase.func_185362_a(this.field_151622_e[this.nextInt(this.field_151622_e.length)]); -+ aint1[j + i * areaWidth] = BiomeGenBase.func_185362_a(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.COOL).biome); - } - } - else if (k == 4) - { -- aint1[j + i * areaWidth] = BiomeGenBase.func_185362_a(this.field_151620_f[this.nextInt(this.field_151620_f.length)]); -+ aint1[j + i * areaWidth] = BiomeGenBase.func_185362_a(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.ICY).biome); - } - else - { -@@ -112,4 +131,12 @@ - - return aint1; - } -+ -+ protected net.minecraftforge.common.BiomeManager.BiomeEntry getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType type) -+ { -+ java.util.List biomeList = biomes[type.ordinal()]; -+ int totalWeight = net.minecraft.util.WeightedRandom.getTotalWeight(biomeList); -+ int weight = net.minecraftforge.common.BiomeManager.isTypeListModded(type)?nextInt(totalWeight):nextInt(totalWeight / 10) * 10; -+ return (net.minecraftforge.common.BiomeManager.BiomeEntry)net.minecraft.util.WeightedRandom.getRandomItem(biomeList, weight); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch deleted file mode 100644 index 81289f936..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java -@@ -28,11 +28,19 @@ - - for (BiomeGenBase biomegenbase : BiomeGenBase.field_185377_q) - { -- if (biomegenbase != null && biomegenbase.func_185355_j() > 0.0F) -+ if (biomegenbase != null && biomegenbase.func_185355_j() > 0.0F && !net.minecraftforge.common.BiomeManager.strongHoldBiomesBlackList.contains(biomegenbase)) - { - this.field_151546_e.add(biomegenbase); - } - } -+ -+ for (BiomeGenBase biome : net.minecraftforge.common.BiomeManager.strongHoldBiomes) -+ { -+ if (!this.field_151546_e.contains(biome)) -+ { -+ this.field_151546_e.add(biome); -+ } -+ } - } - - public MapGenStronghold(Map p_i2068_1_) diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch deleted file mode 100644 index ee60e931b..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java -@@ -221,12 +221,12 @@ - { - if (this.structureData == null) - { -- this.structureData = (MapGenStructureData)worldIn.loadItemData(MapGenStructureData.class, this.getStructureName()); -+ this.structureData = (MapGenStructureData)worldIn.getPerWorldStorage().loadData(MapGenStructureData.class, this.getStructureName()); - - if (this.structureData == null) - { - this.structureData = new MapGenStructureData(this.getStructureName()); -- worldIn.setItemData(this.getStructureName(), this.structureData); -+ worldIn.getPerWorldStorage().setData(this.getStructureName(), this.structureData); - } - else - { diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch deleted file mode 100644 index 53fa790ae..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureComponent.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureComponent.java -@@ -38,6 +38,10 @@ - - public final NBTTagCompound createStructureBaseNBT() - { -+ if (MapGenStructureIO.getStructureComponentName(this) == null) // Friendlier error then the Null String error below. -+ { -+ throw new RuntimeException("StructureComponent \"" + this.getClass().getName() + "\" missing ID Mapping, Modder see MapGenStructureIO"); -+ } - NBTTagCompound nbttagcompound = new NBTTagCompound(); - nbttagcompound.setString("id", MapGenStructureIO.getStructureComponentName(this)); - nbttagcompound.setTag("BB", this.boundingBox.toNBTTagIntArray()); diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch deleted file mode 100644 index 1d7352db0..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureStart.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureStart.java -@@ -63,6 +63,10 @@ - - public NBTTagCompound writeStructureComponentsToNBT(int chunkX, int chunkZ) - { -+ if (MapGenStructureIO.getStructureStartName(this) == null) // This is just a more friendly error instead of the 'Null String' below -+ { -+ throw new RuntimeException("StructureStart \"" + this.getClass().getName() + "\" missing ID Mapping, Modder see MapGenStructureIO"); -+ } - NBTTagCompound nbttagcompound = new NBTTagCompound(); - nbttagcompound.setString("id", MapGenStructureIO.getStructureStartName(this)); - nbttagcompound.setInteger("ChunkX", chunkX); -@@ -98,7 +102,8 @@ - - for (int i = 0; i < nbttaglist.tagCount(); ++i) - { -- this.components.add(MapGenStructureIO.getStructureComponent(nbttaglist.getCompoundTagAt(i), worldIn)); -+ StructureComponent tmp = MapGenStructureIO.getStructureComponent(nbttaglist.getCompoundTagAt(i), worldIn); -+ if (tmp != null) this.components.add(tmp); //Forge: Prevent NPEs further down the line when a componenet can't be loaded. - } - - this.readFromNBT(tagCompound); diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch deleted file mode 100644 index e861158b7..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch +++ /dev/null @@ -1,63 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java -@@ -58,6 +58,7 @@ - list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.Field2.class, 3, MathHelper.getRandomIntegerInRange(random, 2 + p_75084_1_, 4 + p_75084_1_ * 2))); - list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House2.class, 15, MathHelper.getRandomIntegerInRange(random, 0, 1 + p_75084_1_))); - list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House3.class, 8, MathHelper.getRandomIntegerInRange(random, 0 + p_75084_1_, 3 + p_75084_1_ * 2))); -+ net.minecraftforge.fml.common.registry.VillagerRegistry.addExtraVillageComponents(list, random, p_75084_1_); - Iterator iterator = list.iterator(); - - while (iterator.hasNext()) -@@ -130,6 +131,10 @@ - { - structurevillagepieces$village = StructureVillagePieces.House3.func_175849_a(start, p_176065_2_, rand, p_176065_4_, p_176065_5_, p_176065_6_, facing, p_176065_8_); - } -+ else -+ { -+ structurevillagepieces$village = net.minecraftforge.fml.common.registry.VillagerRegistry.getVillageComponent(weight, start , p_176065_2_, rand, p_176065_4_, p_176065_5_, p_176065_6_, facing, p_176065_8_); -+ } - - return structurevillagepieces$village; - } -@@ -1447,6 +1452,7 @@ - public List structureVillageWeightedPieceList; - public List field_74932_i = Lists.newArrayList(); - public List field_74930_j = Lists.newArrayList(); -+ public BiomeGenBase biome; - - public Start() - { -@@ -1460,6 +1466,7 @@ - this.terrainType = p_i2104_7_; - BiomeGenBase biomegenbase = chunkManagerIn.getBiomeGenerator(new BlockPos(p_i2104_4_, 0, p_i2104_5_), Biomes.field_180279_ad); - this.inDesert = biomegenbase == Biomes.desert || biomegenbase == Biomes.desertHills; -+ this.biome = biomegenbase; - this.func_175846_a(this.inDesert); - } - -@@ -1520,6 +1527,7 @@ - protected int field_143015_k = -1; - private int villagersSpawned; - private boolean isDesertVillage; -+ private StructureVillagePieces.Start startPiece; - - public Village() - { -@@ -1532,6 +1540,7 @@ - if (start != null) - { - this.isDesertVillage = start.inDesert; -+ startPiece = start; - } - } - -@@ -1660,6 +1669,9 @@ - - protected IBlockState func_175847_a(IBlockState p_175847_1_) - { -+ net.minecraftforge.event.terraingen.BiomeEvent.GetVillageBlockID event = new net.minecraftforge.event.terraingen.BiomeEvent.GetVillageBlockID(startPiece == null ? null : startPiece.biome, p_175847_1_); -+ net.minecraftforge.common.MinecraftForge.TERRAIN_GEN_BUS.post(event); -+ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return event.replacement; - if (this.isDesertVillage) - { - if (p_175847_1_.getBlock() == Blocks.log || p_175847_1_.getBlock() == Blocks.log2) diff --git a/patches.mcp/minecraft/net/minecraft/world/storage/MapData.java.patch b/patches.mcp/minecraft/net/minecraft/world/storage/MapData.java.patch deleted file mode 100644 index cf7f4d15e..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/storage/MapData.java.patch +++ /dev/null @@ -1,48 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/storage/MapData.java -+++ ../src-work/minecraft/net/minecraft/world/storage/MapData.java -@@ -21,7 +21,7 @@ - { - public int xCenter; - public int zCenter; -- public byte dimension; -+ public int dimension; //FML byte -> int - public boolean field_186210_e; - public byte scale; - public byte[] colors = new byte[16384]; -@@ -45,7 +45,17 @@ - - public void readFromNBT(NBTTagCompound nbt) - { -- this.dimension = nbt.getByte("dimension"); -+ net.minecraft.nbt.NBTBase dimension = nbt.getTag("dimension"); -+ -+ if (dimension instanceof net.minecraft.nbt.NBTTagByte) -+ { -+ this.dimension = ((net.minecraft.nbt.NBTTagByte)dimension).getByte(); -+ } -+ else -+ { -+ this.dimension = ((net.minecraft.nbt.NBTTagInt)dimension).getInt(); -+ } -+ - this.xCenter = nbt.getInteger("xCenter"); - this.zCenter = nbt.getInteger("zCenter"); - this.scale = nbt.getByte("scale"); -@@ -96,7 +106,7 @@ - - public void writeToNBT(NBTTagCompound nbt) - { -- nbt.setByte("dimension", this.dimension); -+ nbt.setInteger("dimension", this.dimension); - nbt.setInteger("xCenter", this.xCenter); - nbt.setInteger("zCenter", this.zCenter); - nbt.setByte("scale", this.scale); -@@ -176,7 +186,7 @@ - rotation = rotation + (rotation < 0.0D ? -8.0D : 8.0D); - b2 = (byte)((int)(rotation * 16.0D / 360.0D)); - -- if (this.dimension < 0) -+ if (worldIn.provider.shouldMapSpin(entityIdentifier, worldX, worldZ, rotation)) - { - int k = (int)(worldIn.getWorldInfo().getWorldTime() / 10L); - b2 = (byte)(k * k * 34187121 + k * 121 >> 15 & 15); diff --git a/patches.mcp/minecraft/net/minecraft/world/storage/SaveFormatOld.java.patch b/patches.mcp/minecraft/net/minecraft/world/storage/SaveFormatOld.java.patch deleted file mode 100644 index c1fec8d2c..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/storage/SaveFormatOld.java.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/storage/SaveFormatOld.java -+++ ../src-work/minecraft/net/minecraft/world/storage/SaveFormatOld.java -@@ -106,6 +106,24 @@ - } - } - -+ //Forge: Special version of the above that runs during actual world loading and not metadata gathering. -+ public static WorldInfo loadAndFix(File file, DataFixer fixer, SaveHandler save) -+ { -+ try -+ { -+ NBTTagCompound nbt = CompressedStreamTools.readCompressed(new FileInputStream(file)); -+ WorldInfo info = new WorldInfo(fixer.func_188257_a(FixTypes.LEVEL, nbt.getCompoundTag("Data"))); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(save, info, nbt); -+ return info; -+ } -+ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e) { throw e; } -+ catch (Exception exception) -+ { -+ logger.error((String)("Exception reading " + file), (Throwable)exception); -+ return null; -+ } -+ } -+ - @SideOnly(Side.CLIENT) - public void renameWorld(String dirName, String newName) - { diff --git a/patches.mcp/minecraft/net/minecraft/world/storage/SaveHandler.java.patch b/patches.mcp/minecraft/net/minecraft/world/storage/SaveHandler.java.patch deleted file mode 100644 index aba3075c0..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/storage/SaveHandler.java.patch +++ /dev/null @@ -1,70 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/storage/SaveHandler.java -+++ ../src-work/minecraft/net/minecraft/world/storage/SaveHandler.java -@@ -117,7 +117,7 @@ - - if (file1.exists()) - { -- WorldInfo worldinfo = SaveFormatOld.func_186353_a(file1, this.field_186341_a); -+ WorldInfo worldinfo = SaveFormatOld.loadAndFix(file1, this.field_186341_a, this); - - if (worldinfo != null) - { -@@ -125,8 +125,9 @@ - } - } - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().confirmBackupLevelDatUse(this); - file1 = new File(this.worldDirectory, "level.dat_old"); -- return file1.exists() ? SaveFormatOld.func_186353_a(file1, this.field_186341_a) : null; -+ return file1.exists() ? SaveFormatOld.loadAndFix(file1, this.field_186341_a, this) : null; - } - - public void saveWorldInfoWithPlayer(WorldInfo worldInformation, NBTTagCompound tagCompound) -@@ -135,6 +136,8 @@ - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - nbttagcompound1.setTag("Data", nbttagcompound); - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataSave(this, worldInformation, nbttagcompound1); -+ - try - { - File file1 = new File(this.worldDirectory, "level.dat_new"); -@@ -188,6 +191,7 @@ - } - - file1.renameTo(file2); -+ net.minecraftforge.event.ForgeEventFactory.firePlayerSavingEvent(player, this.playersDirectory, player.getUniqueID().toString()); - } - catch (Exception var5) - { -@@ -218,6 +222,7 @@ - player.readFromNBT(this.field_186341_a.func_188257_a(FixTypes.PLAYER, nbttagcompound)); - } - -+ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(player, playersDirectory, player.getUniqueID().toString()); - return nbttagcompound; - } - -@@ -259,4 +264,22 @@ - { - return this.field_186342_h; - } -+ -+ public NBTTagCompound getPlayerNBT(net.minecraft.entity.player.EntityPlayerMP player) -+ { -+ try -+ { -+ File file1 = new File(this.playersDirectory, player.getUniqueID().toString() + ".dat"); -+ -+ if (file1.exists() && file1.isFile()) -+ { -+ return CompressedStreamTools.readCompressed(new FileInputStream(file1)); -+ } -+ } -+ catch (Exception exception) -+ { -+ logger.warn("Failed to load player data for " + player.getName()); -+ } -+ return null; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/storage/WorldInfo.java.patch b/patches.mcp/minecraft/net/minecraft/world/storage/WorldInfo.java.patch deleted file mode 100644 index f0459b69c..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/storage/WorldInfo.java.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/storage/WorldInfo.java -+++ ../src-work/minecraft/net/minecraft/world/storage/WorldInfo.java -@@ -60,6 +60,7 @@ - private int borderWarningTime = 15; - private final Map field_186348_N = Maps.newEnumMap(DimensionType.class); - private GameRules theGameRules = new GameRules(); -+ private java.util.Map additionalProperties; - - protected WorldInfo() - { -@@ -785,6 +786,26 @@ - }); - } - -+ /** -+ * Allow access to additional mod specific world based properties -+ * Used by FML to store mod list associated with a world, and maybe an id map -+ * Used by Forge to store the dimensions available to a world -+ * @param additionalProperties -+ */ -+ public void setAdditionalProperties(java.util.Map additionalProperties) -+ { -+ // one time set for this -+ if (this.additionalProperties == null) -+ { -+ this.additionalProperties = additionalProperties; -+ } -+ } -+ -+ public net.minecraft.nbt.NBTBase getAdditionalProperty(String additionalProperty) -+ { -+ return this.additionalProperties!=null? this.additionalProperties.get(additionalProperty) : null; -+ } -+ - public NBTTagCompound func_186347_a(DimensionType p_186347_1_) - { - NBTTagCompound nbttagcompound = (NBTTagCompound)this.field_186348_N.get(p_186347_1_);