diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch new file mode 100644 index 0000000000..425b4bd1b0 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -0,0 +1,1215 @@ +--- ../src-base/minecraft/net/minecraft/block/Block.java ++++ ../src-work/minecraft/net/minecraft/block/Block.java +@@ -38,8 +38,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(); + private CreativeTabs displayOnCreativeTab; + public static final Block.SoundType soundTypeStone = new Block.SoundType("stone", 1.0F, 1.0F); + public static final Block.SoundType soundTypeWood = new Block.SoundType("wood", 1.0F, 1.0F); +@@ -124,6 +125,9 @@ + private String unlocalizedName; + private static final String __OBFID = "CL_00000199"; + ++ 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); +@@ -137,7 +141,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) +@@ -308,7 +313,7 @@ + + public boolean isReplaceable(World worldIn, BlockPos pos) + { +- return false; ++ return getMaterial().isReplaceable(); + } + + public Block setHardness(float hardness) +@@ -345,9 +350,10 @@ + return this.needsRandomTick; + } + ++ @Deprecated //Forge: New State sensitive version. + public boolean hasTileEntity() + { +- return this.isBlockContainer; ++ return hasTileEntity(getDefaultState()); + } + + public final void setBlockBounds(float minX, float minY, float minZ, float maxX, float maxY, float maxZ) +@@ -364,13 +370,13 @@ + public int getMixedBrightnessForBlock(IBlockAccess worldIn, BlockPos pos) + { + Block block = worldIn.getBlockState(pos).getBlock(); +- int i = worldIn.getCombinedLight(pos, block.getLightValue()); ++ int i = worldIn.getCombinedLight(pos, block.getLightValue(worldIn, pos)); + + if (i == 0 && block instanceof BlockSlab) + { + pos = pos.down(); + block = worldIn.getBlockState(pos).getBlock(); +- return worldIn.getCombinedLight(pos, block.getLightValue()); ++ return worldIn.getCombinedLight(pos, block.getLightValue(worldIn, pos)); + } + else + { +@@ -458,6 +464,10 @@ + + public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + { ++ if (hasTileEntity(state) && !(this instanceof BlockContainer)) ++ { ++ worldIn.removeTileEntity(pos); ++ } + } + + public int quantityDropped(Random random) +@@ -472,8 +482,7 @@ + + public float getPlayerRelativeBlockHardness(EntityPlayer playerIn, World worldIn, BlockPos pos) + { +- float f = this.getBlockHardness(worldIn, pos); +- return f < 0.0F ? 0.0F : (!playerIn.canHarvestBlock(this) ? playerIn.getToolDigEfficiency(this) / f / 100.0F : playerIn.getToolDigEfficiency(this) / f / 30.0F); ++ return net.minecraftforge.common.ForgeHooks.blockStrength(worldIn.getBlockState(pos), playerIn, worldIn, pos); + } + + public final void dropBlockAsItem(World worldIn, BlockPos pos, IBlockState state, int forture) +@@ -483,20 +492,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); + } + } + } +@@ -504,8 +509,13 @@ + + public static void spawnAsEntity(World worldIn, BlockPos pos, ItemStack stack) + { +- if (!worldIn.isRemote && worldIn.getGameRules().getGameRuleBooleanValue("doTileDrops")) ++ if (!worldIn.isRemote && worldIn.getGameRules().getGameRuleBooleanValue("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; +@@ -692,7 +702,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, EnumFacing side, float hitX, float hitY, float hitZ) +@@ -804,25 +814,35 @@ + player.triggerAchievement(StatList.mineBlockStatArray[getIdFromBlock(this)]); + player.addExhaustion(0.025F); + +- if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player)) ++ if (this.canSilkHarvest(worldIn, pos, worldIn.getBlockState(pos), player) && EnchantmentHelper.getSilkTouchModifier(player)) + { ++ java.util.ArrayList 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, worldIn.getBlockState(pos), 0, 1.0f, true, player); ++ for (ItemStack stack : items) ++ { ++ spawnAsEntity(worldIn, pos, stack); ++ } + } + else + { ++ harvesters.set(player); + int i = EnchantmentHelper.getFortuneModifier(player); + this.dropBlockAsItem(worldIn, pos, state, i); ++ harvesters.set(null); + } + } + ++ @Deprecated //Forge: State sensitive version + protected boolean canSilkHarvest() + { +- return this.isFullCube() && !this.isBlockContainer; ++ return this.isFullCube() && !this.hasTileEntity(silk_check_state.get()); + } + + protected ItemStack createStackedBlock(IBlockState state) +@@ -1015,6 +1035,1033 @@ + 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 world The current world ++ * @param pos Block position in world ++ * @return The light value ++ */ ++ public int getLightValue(IBlockAccess world, BlockPos pos) ++ { ++ Block block = world.getBlockState(pos).getBlock(); ++ if (block != this) ++ { ++ return block.getLightValue(world, pos); ++ } ++ return getLightValue(); ++ } ++ ++ /** ++ * Checks if a player or entity can use this block to 'climb' like a ladder. ++ * ++ * @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(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 world The current world ++ * @param pos Block position in world ++ * @return True if the block is a full cube ++ */ ++ public boolean isNormalCube(IBlockAccess world, BlockPos pos) ++ { ++ return getMaterial().isOpaque() && isFullCube() && !canProvidePower(); ++ } ++ ++ /** ++ * Checks if the block is a solid face on the given side, used by placement logic. ++ * ++ * @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(IBlockAccess world, BlockPos pos, EnumFacing side) ++ { ++ IBlockState state = this.getActualState(world.getBlockState(pos), world, pos); ++ ++ if (this instanceof BlockSlab) ++ { ++ return isFullBlock() || (state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP && side == EnumFacing.UP); ++ } ++ 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 (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(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 world The current world ++ * @param pos Block position in world ++ * @return True if the block considered air ++ */ ++ public boolean isAir(IBlockAccess world, BlockPos pos) ++ { ++ return getMaterial() == 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 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(World world, BlockPos pos, EntityPlayer player, boolean willHarvest) ++ { ++ return world.setBlockToAir(pos); ++ } ++ ++ /** ++ * 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 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(IBlockAccess world, BlockPos pos, net.minecraft.entity.EntityLiving.SpawnPlacementType type) ++ { ++ IBlockState state = world.getBlockState(pos); ++ if (this instanceof BlockSlab) ++ { ++ return (isFullBlock() || state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP); ++ } ++ else if (this instanceof BlockStairs) ++ { ++ return state.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP; ++ } ++ return isSideSolid(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 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(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 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(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 world The current world ++ * @param pos Block position in world ++ * @return Bed direction ++ */ ++ public EnumFacing getBedDirection(IBlockAccess world, BlockPos pos) ++ { ++ return (EnumFacing)getActualState(world.getBlockState(pos), world, pos).getValue(BlockDirectional.FACING); ++ } ++ ++ /** ++ * 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 world The current world ++ * @param pos Block position in world ++ */ ++ public void beginLeavesDecay(World world, BlockPos pos){} ++ ++ /** ++ * Determines if this block can prevent leaves connected to it from decaying. ++ * ++ * @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(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 world The current world ++ * @param pos Block position in world ++ * @return true if this block is considered leaves. ++ */ ++ public boolean isLeaves(IBlockAccess world, BlockPos pos) ++ { ++ return getMaterial() == Material.leaves; ++ } ++ ++ /** ++ * Used during tree growth to determine if newly generated leaves can replace this block. ++ * ++ * @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(IBlockAccess world, BlockPos pos) ++ { ++ return !isFullBlock(); ++ } ++ ++ /** ++ * ++ * @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 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(World world, BlockPos pos, com.google.common.base.Predicate target) ++ { ++ return target.apply(world.getBlockState(pos)); ++ } ++ ++ /** ++ * 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 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(IBlockAccess world, BlockPos pos, EnumFacing side) ++ { ++ return canProvidePower() && 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 world The current world ++ * @param pos Block position in world ++ * @return True to allow the torch to be placed ++ */ ++ public boolean canPlaceTorchOnTop(IBlockAccess world, BlockPos pos) ++ { ++ if (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(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) ++ { ++ return getPickBlock(target, world, pos); ++ } ++ @Deprecated ++ public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos) ++ { ++ Item item = getItem(world, pos); ++ ++ if (item == null) ++ { ++ return null; ++ } ++ ++ Block block = item instanceof ItemBlock && !isFlowerPot() ? Block.getBlockFromItem(item) : this; ++ return new ItemStack(item, 1, block.getDamageValue(world, pos)); ++ } ++ ++ /** ++ * 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; ++ } ++ ++ /** ++ * 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 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(World worldObj, MovingObjectPosition 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 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(IBlockAccess world, BlockPos pos, EnumFacing direction, net.minecraftforge.common.IPlantable plantable) ++ { ++ IBlockState state = world.getBlockState(pos); ++ 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).canPlaceBlockOn(this)) ++ { ++ 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 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 getMaterial() == Material.water && ((Integer)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()).getBlock().getMaterial() == Material.water || ++ world.getBlockState(pos.west()).getBlock().getMaterial() == Material.water || ++ world.getBlockState(pos.north()).getBlock().getMaterial() == Material.water || ++ world.getBlockState(pos.south()).getBlock().getMaterial() == 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 world Current world ++ * @param pos Block position in world ++ * @param source Source plant's position in world ++ */ ++ public void onPlantGrow(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 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(IBlockAccess world, BlockPos pos) ++ { ++ return getLightOpacity(); ++ } ++ ++ /** ++ * Determines if this block is can be destroyed by the specified entities normal behavior. ++ * ++ * @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(IBlockAccess world, BlockPos pos, Entity entity) ++ { ++ if (entity instanceof net.minecraft.entity.boss.EntityWither) ++ { ++ return this != net.minecraft.init.Blocks.barrier && 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; ++ } ++ else 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.command_block; ++ } ++ ++ 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 : (java.util.Set)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 : (java.util.Set)state.getProperties().keySet()) ++ { ++ if (prop.getName().equals("facing") && prop.getValueClass() == EnumFacing.class) ++ { ++ 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 ++ */ ++ public boolean recolorBlock(World world, BlockPos pos, EnumFacing side, net.minecraft.item.EnumDyeColor color) ++ { ++ IBlockState state = world.getBlockState(pos); ++ for (IProperty prop : (java.util.Set)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 world The world ++ * @param pos Block position ++ * @param fortune ++ * @return Amount of XP from breaking this block. ++ */ ++ public int getExpDrop(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(IBlockAccess world, BlockPos pos, EnumFacing side) ++ { ++ return isNormalCube(); ++ } ++ ++ /** ++ * 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) ++ { ++ 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 getActualState(state, world, pos); ++ } ++ ++ /** ++ * 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(EnumWorldBlockLayer 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(); ++ } ++ } ++ /* ========================================= FORGE END ======================================*/ ++ + public static void registerBlocks() + { + registerBlock(0, AIR_ID, (new BlockAir()).setUnlocalizedName("air")); diff --git a/patches/minecraft/net/minecraft/block/BlockBush.java.patch b/patches/minecraft/net/minecraft/block/BlockBush.java.patch new file mode 100644 index 0000000000..ec228d6288 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockBush.java.patch @@ -0,0 +1,66 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockBush.java ++++ ../src-work/minecraft/net/minecraft/block/BlockBush.java +@@ -13,7 +13,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 + { + private static final String __OBFID = "CL_00000208"; + +@@ -38,7 +38,7 @@ + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { +- return super.canPlaceBlockAt(worldIn, pos) && this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); ++ return super.canPlaceBlockAt(worldIn, pos) && worldIn.getBlockState(pos.down()).getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this); + } + + protected boolean canPlaceBlockOn(Block ground) +@@ -68,7 +68,10 @@ + + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { +- return this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); ++ BlockPos down = pos.down(); ++ Block soil = worldIn.getBlockState(down).getBlock(); ++ if (state.getBlock() != this) return this.canPlaceBlockOn(soil); //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. ++ return soil.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, this); + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) +@@ -91,4 +94,33 @@ + { + return EnumWorldBlockLayer.CUTOUT; + } ++ ++ @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; ++ } + } diff --git a/patches/minecraft/net/minecraft/block/BlockButton.java.patch b/patches/minecraft/net/minecraft/block/BlockButton.java.patch new file mode 100644 index 0000000000..14114212fb --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockButton.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockButton.java ++++ ../src-work/minecraft/net/minecraft/block/BlockButton.java +@@ -75,8 +75,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 ? World.doesBlockHaveSolidTopSurface(p_181088_0_, blockpos) : p_181088_0_.getBlockState(blockpos).getBlock().isNormalCube(); ++ return p_181088_2_ == EnumFacing.UP && World.doesBlockHaveSolidTopSurface(p_181088_0_, p_181088_1_.down()) ? true : p_181088_0_.isSideSolid(p_181088_1_.offset(p_181088_2_.getOpposite()), p_181088_2_); + } + + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) diff --git a/patches/minecraft/net/minecraft/block/BlockCactus.java.patch b/patches/minecraft/net/minecraft/block/BlockCactus.java.patch new file mode 100644 index 0000000000..9de9be4606 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockCactus.java.patch @@ -0,0 +1,37 @@ +--- ../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); + private static final String __OBFID = "CL_00000210"; +@@ -110,7 +110,7 @@ + } + + Block block = worldIn.getBlockState(pos.down()).getBlock(); +- return block == Blocks.cactus || block == Blocks.sand; ++ return block.canSustainPlant(worldIn, pos.down(), EnumFacing.UP, this); + } + + public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) +@@ -138,4 +138,16 @@ + { + return new BlockState(this, new IProperty[] {AGE}); + } ++ ++ @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(); ++ } + } diff --git a/patches/minecraft/net/minecraft/block/BlockChest.java.patch b/patches/minecraft/net/minecraft/block/BlockChest.java.patch new file mode 100644 index 0000000000..8770eda2cd --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockChest.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockChest.java ++++ ../src-work/minecraft/net/minecraft/block/BlockChest.java +@@ -528,7 +528,7 @@ + + private boolean isBelowSolidBlock(World worldIn, BlockPos pos) + { +- return worldIn.getBlockState(pos.up()).getBlock().isNormalCube(); ++ return worldIn.isSideSolid(pos.up(), EnumFacing.DOWN, false); + } + + private boolean isOcelotSittingOnChest(World worldIn, BlockPos pos) diff --git a/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch b/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch new file mode 100644 index 0000000000..5a1871a28a --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch @@ -0,0 +1,27 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockCocoa.java ++++ ../src-work/minecraft/net/minecraft/block/BlockCocoa.java +@@ -138,6 +138,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; + +@@ -148,8 +155,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; + } + + @SideOnly(Side.CLIENT) diff --git a/patches/minecraft/net/minecraft/block/BlockCrops.java.patch b/patches/minecraft/net/minecraft/block/BlockCrops.java.patch new file mode 100644 index 0000000000..772607ab4e --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockCrops.java.patch @@ -0,0 +1,77 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockCrops.java ++++ ../src-work/minecraft/net/minecraft/block/BlockCrops.java +@@ -82,11 +82,11 @@ + float f1 = 0.0F; + IBlockState iblockstate = worldIn.getBlockState(blockpos.add(i, 0, j)); + +- if (iblockstate.getBlock() == Blocks.farmland) ++ if (iblockstate.getBlock().canSustainPlant(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; + } +@@ -127,7 +127,7 @@ + + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { +- return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); ++ return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && worldIn.getBlockState(pos.down()).getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this); + } + + protected Item getSeed() +@@ -143,24 +143,6 @@ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, 0); +- +- if (!worldIn.isRemote) +- { +- int i = ((Integer)state.getValue(AGE)).intValue(); +- +- if (i >= 7) +- { +- int j = 3 + fortune; +- +- for (int k = 0; k < j; ++k) +- { +- if (worldIn.rand.nextInt(15) <= i) +- { +- spawnAsEntity(worldIn, pos, new ItemStack(this.getSeed(), 1, 0)); +- } +- } +- } +- } + } + + public Item getItemDropped(IBlockState state, Random rand, int fortune) +@@ -203,4 +185,26 @@ + { + return new BlockState(this, new IProperty[] {AGE}); + } ++ ++ @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; ++ } + } diff --git a/patches/minecraft/net/minecraft/block/BlockDeadBush.java.patch b/patches/minecraft/net/minecraft/block/BlockDeadBush.java.patch new file mode 100644 index 0000000000..5bf52c67cf --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockDeadBush.java.patch @@ -0,0 +1,33 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockDeadBush.java ++++ ../src-work/minecraft/net/minecraft/block/BlockDeadBush.java +@@ -14,7 +14,7 @@ + import net.minecraft.util.BlockPos; + import net.minecraft.world.World; + +-public class BlockDeadBush extends BlockBush ++public class BlockDeadBush extends BlockBush implements net.minecraftforge.common.IShearable + { + private static final String __OBFID = "CL_00000224"; + +@@ -47,14 +47,15 @@ + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { +- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) + { +- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); +- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.deadbush, 1, 0)); +- } +- else +- { + super.harvestBlock(worldIn, player, pos, state, te); + } + } ++ ++ @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 new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(Blocks.deadbush))); ++ } + } diff --git a/patches/minecraft/net/minecraft/block/BlockDoor.java.patch b/patches/minecraft/net/minecraft/block/BlockDoor.java.patch new file mode 100644 index 0000000000..77dc1dd1a8 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockDoor.java.patch @@ -0,0 +1,20 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockDoor.java ++++ ../src-work/minecraft/net/minecraft/block/BlockDoor.java +@@ -155,7 +155,7 @@ + { + if (this.blockMaterial == Material.iron) + { +- return true; ++ return false; //Allow items to interact with the door + } + else + { +@@ -273,7 +273,7 @@ + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { +- return pos.getY() >= 255 ? false : World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up()); ++ return pos.getY() >= worldIn.getHeight() - 1 ? false : World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up()); + } + + public int getMobilityFlag() diff --git a/patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch b/patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch new file mode 100644 index 0000000000..7ffdec20b5 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch @@ -0,0 +1,89 @@ +--- ../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); +@@ -91,6 +91,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); +@@ -99,17 +101,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; +@@ -159,7 +157,6 @@ + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { +- if (worldIn.isRemote || player.getCurrentEquippedItem() == null || player.getCurrentEquippedItem().getItem() != Items.shears || state.getValue(HALF) != BlockDoublePlant.EnumBlockHalf.LOWER || !this.onHarvest(worldIn, pos, state, player)) + { + super.harvestBlock(worldIn, player, pos, state, te); + } +@@ -222,8 +219,6 @@ + else + { + player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(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; + } + } +@@ -294,6 +289,32 @@ + 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(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. ++ IBlockState state = world.getBlockState(pos); ++ 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/minecraft/net/minecraft/block/BlockFalling.java.patch b/patches/minecraft/net/minecraft/block/BlockFalling.java.patch new file mode 100644 index 0000000000..40b4107393 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockFalling.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockFalling.java ++++ ../src-work/minecraft/net/minecraft/block/BlockFalling.java +@@ -87,6 +87,7 @@ + + public static boolean canFallInto(World worldIn, BlockPos pos) + { ++ if (worldIn.isAirBlock(pos)) return true; + Block block = worldIn.getBlockState(pos).getBlock(); + Material material = block.blockMaterial; + return block == Blocks.fire || material == Material.air || material == Material.water || material == Material.lava; diff --git a/patches/minecraft/net/minecraft/block/BlockFarmland.java.patch b/patches/minecraft/net/minecraft/block/BlockFarmland.java.patch new file mode 100644 index 0000000000..4e0915fe15 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockFarmland.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockFarmland.java ++++ ../src-work/minecraft/net/minecraft/block/BlockFarmland.java +@@ -90,7 +90,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, pos, net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)block); + } + + private boolean hasWater(World worldIn, BlockPos pos) diff --git a/patches/minecraft/net/minecraft/block/BlockFire.java.patch b/patches/minecraft/net/minecraft/block/BlockFire.java.patch new file mode 100644 index 0000000000..3c4a9fb052 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockFire.java.patch @@ -0,0 +1,211 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockFire.java ++++ ../src-work/minecraft/net/minecraft/block/BlockFire.java +@@ -42,18 +42,24 @@ + int j = pos.getY(); + int k = pos.getZ(); + +- if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down())) ++ if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down(), EnumFacing.UP)) + { + boolean flag = (i + j + k & 1) == 1; + boolean flag1 = (i / 2 + j / 2 + k / 2 & 1) == 1; + int l = 0; + +- if (this.canCatchFire(worldIn, pos.up())) ++ if (this.canCatchFire(worldIn, pos.up(), EnumFacing.DOWN)) + { + l = flag ? 1 : 2; + } + +- return 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, Integer.valueOf(l)).withProperty(FLIP, Boolean.valueOf(flag1)).withProperty(ALT, Boolean.valueOf(flag)); ++ return state.withProperty(NORTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.north(), EnumFacing.SOUTH))) ++ .withProperty(EAST, Boolean.valueOf(this.canCatchFire(worldIn, pos.east(), EnumFacing.EAST ))) ++ .withProperty(SOUTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.south(), EnumFacing.NORTH))) ++ .withProperty(WEST, Boolean.valueOf(this.canCatchFire(worldIn, pos.west(), EnumFacing.EAST ))) ++ .withProperty(UPPER, Integer.valueOf(l)) ++ .withProperty(FLIP, Boolean.valueOf(flag1)) ++ .withProperty(ALT, Boolean.valueOf(flag)); + } + else + { +@@ -109,6 +115,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)); + } +@@ -148,13 +155,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; +- } +- + if (!flag && worldIn.isRaining() && this.canDie(worldIn, pos)) + { + worldIn.setBlockToAir(pos); +@@ -183,7 +185,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; +@@ -198,12 +200,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) + { +@@ -262,22 +264,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); +@@ -309,7 +319,7 @@ + { + for (EnumFacing enumfacing : EnumFacing.values()) + { +- if (this.canCatchFire(worldIn, pos.offset(enumfacing))) ++ if (this.canCatchFire(worldIn, pos.offset(enumfacing), enumfacing.getOpposite())) + { + return true; + } +@@ -330,7 +340,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; +@@ -342,9 +352,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) +@@ -383,9 +394,9 @@ + worldIn.playSound((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), "fire.fire", 1.0F + rand.nextFloat(), rand.nextFloat() * 0.7F + 0.3F, false); + } + +- if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down())) ++ if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down(), EnumFacing.UP)) + { +- if (Blocks.fire.canCatchFire(worldIn, pos.west())) ++ if (Blocks.fire.canCatchFire(worldIn, pos.west(), EnumFacing.EAST)) + { + for (int j = 0; j < 2; ++j) + { +@@ -396,7 +407,7 @@ + } + } + +- if (Blocks.fire.canCatchFire(worldIn, pos.east())) ++ if (Blocks.fire.canCatchFire(worldIn, pos.east(), EnumFacing.WEST)) + { + for (int k = 0; k < 2; ++k) + { +@@ -407,7 +418,7 @@ + } + } + +- if (Blocks.fire.canCatchFire(worldIn, pos.north())) ++ if (Blocks.fire.canCatchFire(worldIn, pos.north(), EnumFacing.SOUTH)) + { + for (int l = 0; l < 2; ++l) + { +@@ -418,7 +429,7 @@ + } + } + +- if (Blocks.fire.canCatchFire(worldIn, pos.south())) ++ if (Blocks.fire.canCatchFire(worldIn, pos.south(), EnumFacing.NORTH)) + { + for (int i1 = 0; i1 < 2; ++i1) + { +@@ -429,7 +440,7 @@ + } + } + +- if (Blocks.fire.canCatchFire(worldIn, pos.up())) ++ if (Blocks.fire.canCatchFire(worldIn, pos.up(), EnumFacing.DOWN)) + { + for (int j1 = 0; j1 < 2; ++j1) + { +@@ -477,4 +488,19 @@ + { + return new BlockState(this, new IProperty[] {AGE, NORTH, EAST, SOUTH, WEST, UPPER, FLIP, ALT}); + } ++ ++ /*================================= 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/minecraft/net/minecraft/block/BlockFlowerPot.java.patch b/patches/minecraft/net/minecraft/block/BlockFlowerPot.java.patch new file mode 100644 index 0000000000..faca3a6d86 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockFlowerPot.java.patch @@ -0,0 +1,48 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockFlowerPot.java ++++ ../src-work/minecraft/net/minecraft/block/BlockFlowerPot.java +@@ -170,13 +170,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); + } + +@@ -396,6 +389,31 @@ + return EnumWorldBlockLayer.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(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(world, pos, player, willHarvest); ++ } ++ @Override ++ public void harvestBlock(World world, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) ++ { ++ super.harvestBlock(world, player, pos, state, te); ++ world.setBlockToAir(pos); ++ } ++ /*===========================FORGE END==========================================*/ ++ + public static enum EnumFlowerType implements IStringSerializable + { + EMPTY("empty"), diff --git a/patches/minecraft/net/minecraft/block/BlockGrass.java.patch b/patches/minecraft/net/minecraft/block/BlockGrass.java.patch new file mode 100644 index 0000000000..632b06303e --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockGrass.java.patch @@ -0,0 +1,29 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockGrass.java ++++ ../src-work/minecraft/net/minecraft/block/BlockGrass.java +@@ -59,7 +59,7 @@ + { + if (!worldIn.isRemote) + { +- if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity() > 2) ++ if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity(worldIn, pos.up()) > 2) + { + worldIn.setBlockState(pos, Blocks.dirt.getDefaultState()); + } +@@ -73,7 +73,7 @@ + Block block = worldIn.getBlockState(blockpos.up()).getBlock(); + IBlockState iblockstate = worldIn.getBlockState(blockpos); + +- if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity() <= 2) ++ if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity(worldIn, blockpos.up()) <= 2) + { + worldIn.setBlockState(blockpos, Blocks.grass.getDefaultState()); + } +@@ -111,7 +111,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/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch b/patches/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch new file mode 100644 index 0000000000..4e6db9303c --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch @@ -0,0 +1,23 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockHugeMushroom.java ++++ ../src-work/minecraft/net/minecraft/block/BlockHugeMushroom.java +@@ -80,6 +80,20 @@ + return new BlockState(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/minecraft/net/minecraft/block/BlockIce.java.patch b/patches/minecraft/net/minecraft/block/BlockIce.java.patch new file mode 100644 index 0000000000..ebd4a9f128 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockIce.java.patch @@ -0,0 +1,35 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockIce.java ++++ ../src-work/minecraft/net/minecraft/block/BlockIce.java +@@ -40,14 +40,17 @@ + player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); + player.addExhaustion(0.025F); + +- if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player)) ++ if (this.canSilkHarvest(worldIn, pos, worldIn.getBlockState(pos), player) && EnchantmentHelper.getSilkTouchModifier(player)) + { ++ java.util.List items = new java.util.ArrayList(); + ItemStack itemstack = this.createStackedBlock(state); + +- if (itemstack != null) +- { +- spawnAsEntity(worldIn, pos, itemstack); +- } ++ if (itemstack != null) items.add(itemstack); ++ ++ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, worldIn.getBlockState(pos), 0, 1.0f, true, player); ++ ++ for (ItemStack is : items) ++ spawnAsEntity(worldIn, pos, is); + } + else + { +@@ -58,7 +61,9 @@ + } + + int i = EnchantmentHelper.getFortuneModifier(player); ++ harvesters.set(player); + this.dropBlockAsItem(worldIn, pos, state, i); ++ harvesters.set(null); + Material material = worldIn.getBlockState(pos.down()).getBlock().getMaterial(); + + if (material.blocksMovement() || material.isLiquid()) diff --git a/patches/minecraft/net/minecraft/block/BlockLadder.java.patch b/patches/minecraft/net/minecraft/block/BlockLadder.java.patch new file mode 100644 index 0000000000..6295206526 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockLadder.java.patch @@ -0,0 +1,30 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockLadder.java ++++ ../src-work/minecraft/net/minecraft/block/BlockLadder.java +@@ -79,7 +79,10 @@ + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { +- return worldIn.getBlockState(pos.west()).getBlock().isNormalCube() ? true : (worldIn.getBlockState(pos.east()).getBlock().isNormalCube() ? true : (worldIn.getBlockState(pos.north()).getBlock().isNormalCube() ? true : worldIn.getBlockState(pos.south()).getBlock().isNormalCube())); ++ return worldIn.isSideSolid(pos.west(), EnumFacing.EAST, true) || ++ worldIn.isSideSolid(pos.east(), EnumFacing.WEST, true) || ++ worldIn.isSideSolid(pos.north(), EnumFacing.SOUTH, true) || ++ worldIn.isSideSolid(pos.south(), EnumFacing.NORTH, true); + } + + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) +@@ -117,7 +120,7 @@ + + protected boolean canBlockStay(World worldIn, BlockPos pos, EnumFacing facing) + { +- return worldIn.getBlockState(pos.offset(facing.getOpposite())).getBlock().isNormalCube(); ++ return worldIn.isSideSolid(pos.offset(facing.getOpposite()), facing, true); + } + + public IBlockState getStateFromMeta(int meta) +@@ -147,4 +150,6 @@ + { + return new BlockState(this, new IProperty[] {FACING}); + } ++ ++ @Override public boolean isLadder(IBlockAccess world, BlockPos pos, EntityLivingBase entity) { return true; } + } diff --git a/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch b/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch new file mode 100644 index 0000000000..c1ec1e2efb --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch @@ -0,0 +1,126 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockLeaves.java ++++ ../src-work/minecraft/net/minecraft/block/BlockLeaves.java +@@ -18,7 +18,7 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +-public abstract class BlockLeaves extends BlockLeavesBase ++public abstract class BlockLeaves extends BlockLeavesBase implements net.minecraftforge.common.IShearable + { + public static final PropertyBool DECAYABLE = PropertyBool.create("decayable"); + public static final PropertyBool CHECK_DECAY = PropertyBool.create("check_decay"); +@@ -76,9 +76,9 @@ + BlockPos blockpos = pos.add(j1, k1, l1); + IBlockState iblockstate = worldIn.getBlockState(blockpos); + +- if (iblockstate.getBlock().getMaterial() == Material.leaves && !((Boolean)iblockstate.getValue(CHECK_DECAY)).booleanValue()) ++ if (iblockstate.getBlock().isLeaves(worldIn, blockpos)) + { +- worldIn.setBlockState(blockpos, iblockstate.withProperty(CHECK_DECAY, Boolean.valueOf(true)), 4); ++ iblockstate.getBlock().beginLeavesDecay(worldIn, blockpos); + } + } + } +@@ -118,9 +118,9 @@ + { + Block block = worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(k + i2, l + j2, i1 + k2)).getBlock(); + +- if (block != Blocks.log && block != Blocks.log2) ++ if (!block.canSustainLeaves(worldIn, blockpos$mutableblockpos.func_181079_c(k + i2, l + j2, i1 + k2))) + { +- if (block.getMaterial() == Material.leaves) ++ if (block.isLeaves(worldIn, blockpos$mutableblockpos.func_181079_c(k + i2, l + j2, i1 + k2))) + { + this.surroundings[(i2 + l1) * k1 + (j2 + l1) * j1 + k2 + l1] = -2; + } +@@ -227,40 +227,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) +@@ -297,4 +264,48 @@ + } + + public abstract BlockPlanks.EnumType getWoodType(int meta); ++ ++ @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; } ++ @Override public boolean isLeaves(IBlockAccess world, BlockPos pos){ return true; } ++ ++ @Override ++ public void beginLeavesDecay(World world, BlockPos pos) ++ { ++ IBlockState state = world.getBlockState(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; ++ } ++ + } diff --git a/patches/minecraft/net/minecraft/block/BlockLever.java.patch b/patches/minecraft/net/minecraft/block/BlockLever.java.patch new file mode 100644 index 0000000000..bd6ae7dcf7 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockLever.java.patch @@ -0,0 +1,15 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockLever.java ++++ ../src-work/minecraft/net/minecraft/block/BlockLever.java +@@ -238,6 +238,12 @@ + return new BlockState(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/minecraft/net/minecraft/block/BlockLog.java.patch b/patches/minecraft/net/minecraft/block/BlockLog.java.patch new file mode 100644 index 0000000000..fff237c53f --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockLog.java.patch @@ -0,0 +1,24 @@ +--- ../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.getBlock().getMaterial() == Material.leaves && !((Boolean)iblockstate.getValue(BlockLeaves.CHECK_DECAY)).booleanValue()) ++ if (iblockstate.getBlock().isLeaves(worldIn, blockpos)) + { +- worldIn.setBlockState(blockpos, iblockstate.withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(true)), 4); ++ iblockstate.getBlock().beginLeavesDecay(worldIn, blockpos); + } + } + } +@@ -47,6 +47,9 @@ + return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(LOG_AXIS, BlockLog.EnumAxis.fromFacingAxis(facing.getAxis())); + } + ++ @Override public boolean canSustainLeaves(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/minecraft/net/minecraft/block/BlockMobSpawner.java.patch b/patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch new file mode 100644 index 0000000000..c9b7f08e8f --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch @@ -0,0 +1,19 @@ +--- ../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(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ { ++ return 15 + RANDOM.nextInt(15) + RANDOM.nextInt(15); ++ } ++ + public boolean isOpaqueCube() + { + return false; diff --git a/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch b/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch new file mode 100644 index 0000000000..2937e59aee --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockMushroom.java ++++ ../src-work/minecraft/net/minecraft/block/BlockMushroom.java +@@ -73,7 +73,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.canPlaceBlockOn(iblockstate.getBlock())); ++ 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(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this)); + } + else + { diff --git a/patches/minecraft/net/minecraft/block/BlockMycelium.java.patch b/patches/minecraft/net/minecraft/block/BlockMycelium.java.patch new file mode 100644 index 0000000000..a22a27a48c --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockMycelium.java.patch @@ -0,0 +1,20 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockMycelium.java ++++ ../src-work/minecraft/net/minecraft/block/BlockMycelium.java +@@ -40,7 +40,7 @@ + { + if (!worldIn.isRemote) + { +- if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity() > 2) ++ if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity(worldIn, pos.up()) > 2) + { + worldIn.setBlockState(pos, Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT)); + } +@@ -54,7 +54,7 @@ + IBlockState iblockstate = worldIn.getBlockState(blockpos); + Block block = worldIn.getBlockState(blockpos.up()).getBlock(); + +- if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity() <= 2) ++ if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity(worldIn, blockpos.up()) <= 2) + { + worldIn.setBlockState(blockpos, this.getDefaultState()); + } diff --git a/patches/minecraft/net/minecraft/block/BlockNetherWart.java.patch b/patches/minecraft/net/minecraft/block/BlockNetherWart.java.patch new file mode 100644 index 0000000000..f036a71f54 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockNetherWart.java.patch @@ -0,0 +1,49 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockNetherWart.java ++++ ../src-work/minecraft/net/minecraft/block/BlockNetherWart.java +@@ -39,7 +39,7 @@ + + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { +- return this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); ++ return super.canBlockStay(worldIn, pos, state); + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) +@@ -55,9 +55,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; + +@@ -108,4 +110,24 @@ + { + return new BlockState(this, new IProperty[] {AGE}); + } ++ ++ @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; ++ } + } diff --git a/patches/minecraft/net/minecraft/block/BlockNewLeaf.java.patch b/patches/minecraft/net/minecraft/block/BlockNewLeaf.java.patch new file mode 100644 index 0000000000..57523ab344 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockNewLeaf.java.patch @@ -0,0 +1,24 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockNewLeaf.java ++++ ../src-work/minecraft/net/minecraft/block/BlockNewLeaf.java +@@ -101,14 +101,15 @@ + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { +- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) + { +- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); +- spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata() - 4)); +- } +- else +- { + super.harvestBlock(worldIn, player, pos, state, te); + } + } ++ ++ @Override ++ public List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ { ++ IBlockState state = world.getBlockState(pos); ++ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(this, 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata() - 4))); ++ } + } diff --git a/patches/minecraft/net/minecraft/block/BlockNote.java.patch b/patches/minecraft/net/minecraft/block/BlockNote.java.patch new file mode 100644 index 0000000000..fa6a2e571c --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockNote.java.patch @@ -0,0 +1,23 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockNote.java ++++ ../src-work/minecraft/net/minecraft/block/BlockNote.java +@@ -59,7 +59,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_181735_S); + } +@@ -99,6 +101,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.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "note." + this.getInstrument(eventID), 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/minecraft/net/minecraft/block/BlockOldLeaf.java.patch b/patches/minecraft/net/minecraft/block/BlockOldLeaf.java.patch new file mode 100644 index 0000000000..e1640524f4 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockOldLeaf.java.patch @@ -0,0 +1,21 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockOldLeaf.java ++++ ../src-work/minecraft/net/minecraft/block/BlockOldLeaf.java +@@ -144,11 +144,17 @@ + if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) + { + player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); +- spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata())); + } + else + { + super.harvestBlock(worldIn, player, pos, state, te); + } + } ++ ++ @Override ++ public List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) ++ { ++ IBlockState state = world.getBlockState(pos); ++ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(this, 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata()))); ++ } + } diff --git a/patches/minecraft/net/minecraft/block/BlockPane.java.patch b/patches/minecraft/net/minecraft/block/BlockPane.java.patch new file mode 100644 index 0000000000..bbfc1846f5 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockPane.java.patch @@ -0,0 +1,41 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockPane.java ++++ ../src-work/minecraft/net/minecraft/block/BlockPane.java +@@ -39,7 +39,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) +@@ -65,10 +68,10 @@ + + public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) + { +- boolean flag = this.canPaneConnectToBlock(worldIn.getBlockState(pos.north()).getBlock()); +- boolean flag1 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.south()).getBlock()); +- boolean flag2 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.west()).getBlock()); +- boolean flag3 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.east()).getBlock()); ++ boolean flag = this.canPaneConnectTo(worldIn, pos, EnumFacing.NORTH); ++ boolean flag1 = this.canPaneConnectTo(worldIn, pos, EnumFacing.SOUTH); ++ boolean flag2 = this.canPaneConnectTo(worldIn, pos, EnumFacing.WEST); ++ boolean flag3 = this.canPaneConnectTo(worldIn, pos, EnumFacing.EAST); + + if ((!flag2 || !flag3) && (flag2 || flag3 || flag || flag1)) + { +@@ -187,4 +190,11 @@ + { + return new BlockState(this, new IProperty[] {NORTH, EAST, WEST, SOUTH}); + } ++ ++ public boolean canPaneConnectTo(IBlockAccess world, BlockPos pos, EnumFacing dir) ++ { ++ BlockPos off = pos.offset(dir); ++ Block block = world.getBlockState(off).getBlock(); ++ return canPaneConnectToBlock(block) || block.isSideSolid(world, off, dir.getOpposite()); ++ } + } diff --git a/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch b/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch new file mode 100644 index 0000000000..5d7960d10b --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch @@ -0,0 +1,31 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockPistonBase.java ++++ ../src-work/minecraft/net/minecraft/block/BlockPistonBase.java +@@ -190,7 +190,7 @@ + } + } + +- if (!flag1 && block.getMaterial() != Material.air && canPush(block, worldIn, blockpos, enumfacing.getOpposite(), false) && (block.getMobilityFlag() == 0 || block == Blocks.piston || block == Blocks.sticky_piston)) ++ if (!flag1 && !block.isAir(worldIn, blockpos) && canPush(block, worldIn, blockpos, enumfacing.getOpposite(), false) && (block.getMobilityFlag() == 0 || block == Blocks.piston || block == Blocks.sticky_piston)) + { + this.doMove(worldIn, pos, enumfacing, false); + } +@@ -334,7 +334,7 @@ + return false; + } + +- return !(blockIn instanceof ITileEntityProvider); ++ return !(blockIn.hasTileEntity(worldIn.getBlockState(pos))); + } + else + { +@@ -372,7 +372,9 @@ + { + BlockPos blockpos = (BlockPos)list1.get(j); + Block block = worldIn.getBlockState(blockpos).getBlock(); +- block.dropBlockAsItem(worldIn, blockpos, worldIn.getBlockState(blockpos), 0); ++ //With our change to how snowballs are dropped this needs to disallow to mimic vanilla behavior. ++ float chance = block instanceof BlockSnow ? -1.0f : 1.0f; ++ block.dropBlockAsItemWithChance(worldIn, blockpos, worldIn.getBlockState(blockpos), chance, 0); + worldIn.setBlockToAir(blockpos); + --i; + ablock[i] = block; diff --git a/patches/minecraft/net/minecraft/block/BlockPistonMoving.java.patch b/patches/minecraft/net/minecraft/block/BlockPistonMoving.java.patch new file mode 100644 index 0000000000..679a458ffd --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockPistonMoving.java.patch @@ -0,0 +1,37 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockPistonMoving.java ++++ ../src-work/minecraft/net/minecraft/block/BlockPistonMoving.java +@@ -110,16 +110,7 @@ + + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { +- if (!worldIn.isRemote) +- { +- TileEntityPiston tileentitypiston = this.getTileEntity(worldIn, pos); +- +- if (tileentitypiston != null) +- { +- IBlockState iblockstate = tileentitypiston.getPistonState(); +- iblockstate.getBlock().dropBlockAsItem(worldIn, pos, iblockstate, 0); +- } +- } ++ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); + } + + public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) +@@ -283,4 +274,16 @@ + { + return new BlockState(this, new IProperty[] {FACING, TYPE}); + } ++ ++ @Override ++ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) ++ { ++ TileEntityPiston tileentitypiston = this.getTileEntity(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/minecraft/net/minecraft/block/BlockPotato.java.patch b/patches/minecraft/net/minecraft/block/BlockPotato.java.patch new file mode 100644 index 0000000000..afe064e2b7 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockPotato.java.patch @@ -0,0 +1,25 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockPotato.java ++++ ../src-work/minecraft/net/minecraft/block/BlockPotato.java +@@ -24,13 +24,14 @@ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); +- +- if (!worldIn.isRemote) +- { +- if (((Integer)state.getValue(AGE)).intValue() >= 7 && worldIn.rand.nextInt(50) == 0) +- { +- spawnAsEntity(worldIn, pos, new ItemStack(Items.poisonous_potato)); +- } +- } + } ++ @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); ++ java.util.Random rand = world instanceof World ? ((World)world).rand : new java.util.Random(); ++ if (((Integer)state.getValue(AGE)) >= 7 && rand.nextInt(50) == 0) ++ ret.add(new ItemStack(Items.poisonous_potato)); ++ return ret; ++ } + } diff --git a/patches/minecraft/net/minecraft/block/BlockPumpkin.java.patch b/patches/minecraft/net/minecraft/block/BlockPumpkin.java.patch new file mode 100644 index 0000000000..3e5e605936 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockPumpkin.java.patch @@ -0,0 +1,11 @@ +--- ../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() && World.doesBlockHaveSolidTopSurface(worldIn, pos.down()); ++ return worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos) && World.doesBlockHaveSolidTopSurface(worldIn, pos.down()); + } + + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) diff --git a/patches/minecraft/net/minecraft/block/BlockQuartz.java.patch b/patches/minecraft/net/minecraft/block/BlockQuartz.java.patch new file mode 100644 index 0000000000..7c75b6cdc8 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockQuartz.java.patch @@ -0,0 +1,29 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockQuartz.java ++++ ../src-work/minecraft/net/minecraft/block/BlockQuartz.java +@@ -91,6 +91,26 @@ + return new BlockState(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") && 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/minecraft/net/minecraft/block/BlockRailBase.java.patch b/patches/minecraft/net/minecraft/block/BlockRailBase.java.patch new file mode 100644 index 0000000000..800cc78f25 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockRailBase.java.patch @@ -0,0 +1,147 @@ +--- ../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) +@@ -176,6 +176,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 : (java.util.Set)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"), +@@ -248,6 +323,7 @@ + private final boolean isPowered; + private final List field_150657_g = Lists.newArrayList(); + private static final String __OBFID = "CL_00000196"; ++ private final boolean canMakeSlopes; + + public Rail(World worldIn, BlockPos pos, IBlockState state) + { +@@ -256,7 +332,8 @@ + this.state = state; + this.block = (BlockRailBase)state.getBlock(); + BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)state.getValue(BlockRailBase.this.getShapeProperty()); +- this.isPowered = this.block.isPowered; ++ this.isPowered = !this.block.isFlexibleRail(worldIn, pos); ++ canMakeSlopes = this.block.canMakeSlopes(worldIn, pos); + this.func_180360_a(blockrailbase$enumraildirection); + } + +@@ -442,7 +519,7 @@ + } + } + +- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH) ++ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes) + { + if (BlockRailBase.isRailBlock(this.world, blockpos.up())) + { +@@ -455,7 +532,7 @@ + } + } + +- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST) ++ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST && canMakeSlopes) + { + if (BlockRailBase.isRailBlock(this.world, blockpos3.up())) + { +@@ -598,7 +675,7 @@ + } + } + +- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH) ++ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes) + { + if (BlockRailBase.isRailBlock(this.world, blockpos.up())) + { +@@ -611,7 +688,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/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch b/patches/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch new file mode 100644 index 0000000000..4ffa619b93 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch @@ -0,0 +1,24 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneComparator.java ++++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneComparator.java +@@ -297,6 +297,21 @@ + return this.getDefaultState().withProperty(FACING, 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/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch b/patches/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch new file mode 100644 index 0000000000..28bdd60d72 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneDiode.java ++++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneDiode.java +@@ -199,6 +199,8 @@ + { + EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + 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/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch b/patches/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch new file mode 100644 index 0000000000..8acd40ee8d --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch @@ -0,0 +1,22 @@ +--- ../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(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ { ++ if (this.getItemDropped(world.getBlockState(pos), 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/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch b/patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch new file mode 100644 index 0000000000..6cc29f813a --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch @@ -0,0 +1,59 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneWire.java ++++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneWire.java +@@ -59,10 +59,10 @@ + BlockPos blockpos = pos.offset(direction); + Block block = worldIn.getBlockState(pos.offset(direction)).getBlock(); + +- if (!canConnectTo(worldIn.getBlockState(blockpos), direction) && (block.isSolidFullCube() || !canConnectUpwardsTo(worldIn.getBlockState(blockpos.down())))) ++ if (!canRestoneConnect(worldIn, blockpos, direction) && (block.isSolidFullCube() || !canRestoneConnect(worldIn, blockpos.down(), null))) + { + Block block1 = worldIn.getBlockState(pos.up()).getBlock(); +- return !block1.isSolidFullCube() && block.isSolidFullCube() && canConnectUpwardsTo(worldIn.getBlockState(blockpos.up())) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE; ++ return !block1.isSolidFullCube() && block.isSolidFullCube() && canRestoneConnect(worldIn, blockpos.up(), null) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE; + } + else + { +@@ -360,35 +360,24 @@ + Block block = iblockstate.getBlock(); + boolean flag = block.isNormalCube(); + boolean flag1 = worldIn.getBlockState(pos.up()).getBlock().isNormalCube(); +- return !flag1 && flag && canConnectUpwardsTo(worldIn, blockpos.up()) ? true : (canConnectTo(iblockstate, side) ? true : (block == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.FACING) == side ? true : !flag && canConnectUpwardsTo(worldIn, blockpos.down()))); ++ return !flag1 && flag && canRestoneConnect(worldIn, blockpos.up(), null) ? true : (canRestoneConnect(worldIn, blockpos, side) ? true : (block == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.FACING) == side ? true : !flag && canRestoneConnect(worldIn, blockpos.down(), null))); + } + +- protected static boolean canConnectUpwardsTo(IBlockAccess worldIn, BlockPos pos) ++ protected static boolean canRestoneConnect(IBlockAccess world, BlockPos pos, EnumFacing side) + { +- return canConnectUpwardsTo(worldIn.getBlockState(pos)); +- } +- +- protected static boolean canConnectUpwardsTo(IBlockState state) +- { +- return canConnectTo(state, (EnumFacing)null); +- } +- +- protected static boolean canConnectTo(IBlockState blockState, EnumFacing side) +- { +- Block block = blockState.getBlock(); +- +- if (block == Blocks.redstone_wire) ++ IBlockState state = world.getBlockState(pos); ++ if (state.getBlock() == Blocks.redstone_wire) + { + return true; + } +- else if (Blocks.unpowered_repeater.isAssociated(block)) ++ else if (Blocks.unpowered_repeater.isAssociated(state.getBlock())) + { +- EnumFacing enumfacing = (EnumFacing)blockState.getValue(BlockRedstoneRepeater.FACING); +- return enumfacing == side || enumfacing.getOpposite() == side; ++ EnumFacing direction = (EnumFacing)state.getValue(BlockRedstoneRepeater.FACING); ++ return direction == side || direction.getOpposite() == side; + } + else + { +- return block.canProvidePower() && side != null; ++ return state.getBlock().canConnectRedstone(world, pos, side); + } + } + diff --git a/patches/minecraft/net/minecraft/block/BlockReed.java.patch b/patches/minecraft/net/minecraft/block/BlockReed.java.patch new file mode 100644 index 0000000000..8c782fe46f --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockReed.java.patch @@ -0,0 +1,35 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockReed.java ++++ ../src-work/minecraft/net/minecraft/block/BlockReed.java +@@ -18,7 +18,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); + private static final String __OBFID = "CL_00000300"; +@@ -66,6 +66,7 @@ + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + Block block = worldIn.getBlockState(pos.down()).getBlock(); ++ if (block.canSustainPlant(worldIn, pos.down(), EnumFacing.UP, this)) return true; + + if (block == this) + { +@@ -165,4 +166,15 @@ + { + return new BlockState(this, new IProperty[] {AGE}); + } ++ ++ @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(); ++ } + } diff --git a/patches/minecraft/net/minecraft/block/BlockSapling.java.patch b/patches/minecraft/net/minecraft/block/BlockSapling.java.patch new file mode 100644 index 0000000000..eb550d0a5d --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockSapling.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockSapling.java ++++ ../src-work/minecraft/net/minecraft/block/BlockSapling.java +@@ -72,6 +72,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/minecraft/net/minecraft/block/BlockSkull.java.patch b/patches/minecraft/net/minecraft/block/BlockSkull.java.patch new file mode 100644 index 0000000000..d53f008379 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockSkull.java.patch @@ -0,0 +1,57 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockSkull.java ++++ ../src-work/minecraft/net/minecraft/block/BlockSkull.java +@@ -123,10 +123,6 @@ + return tileentity instanceof TileEntitySkull ? ((TileEntitySkull)tileentity).getSkullType() : super.getDamageValue(worldIn, pos); + } + +- 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) +@@ -134,13 +130,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()) + { +@@ -149,7 +150,7 @@ + if (tileentity instanceof TileEntitySkull) + { + TileEntitySkull tileentityskull = (TileEntitySkull)tileentity; +- ItemStack itemstack = new ItemStack(Items.skull, 1, this.getDamageValue(worldIn, pos)); ++ ItemStack itemstack = new ItemStack(Items.skull, 1, tileentityskull.getSkullType()); + + if (tileentityskull.getSkullType() == 3 && tileentityskull.getPlayerProfile() != null) + { +@@ -159,12 +160,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/minecraft/net/minecraft/block/BlockSnow.java.patch b/patches/minecraft/net/minecraft/block/BlockSnow.java.patch new file mode 100644 index 0000000000..a97fd22326 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockSnow.java.patch @@ -0,0 +1,53 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockSnow.java ++++ ../src-work/minecraft/net/minecraft/block/BlockSnow.java +@@ -80,7 +80,7 @@ + { + IBlockState iblockstate = worldIn.getBlockState(pos.down()); + Block block = iblockstate.getBlock(); +- return block != Blocks.ice && block != Blocks.packed_ice ? (block.getMaterial() == Material.leaves ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() >= 7 ? true : block.isOpaqueCube() && block.blockMaterial.blocksMovement())) : false; ++ return block != Blocks.ice && block != Blocks.packed_ice ? (block.isLeaves(worldIn, pos.down()) ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() == 7 ? true : block.isOpaqueCube() && block.blockMaterial.blocksMovement())) : false; + } + + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) +@@ -92,7 +92,6 @@ + { + if (!this.canPlaceBlockAt(worldIn, p_176314_2_)) + { +- this.dropBlockAsItem(worldIn, p_176314_2_, p_176314_3_, 0); + worldIn.setBlockToAir(p_176314_2_); + return false; + } +@@ -104,9 +103,8 @@ + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { +- spawnAsEntity(worldIn, pos, new ItemStack(Items.snowball, ((Integer)state.getValue(LAYERS)).intValue() + 1, 0)); ++ super.harvestBlock(worldIn, player, pos, state, te); + worldIn.setBlockToAir(pos); +- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); + } + + public Item getItemDropped(IBlockState state, Random rand, int fortune) +@@ -116,14 +114,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); + } + } +@@ -153,4 +150,6 @@ + { + return new BlockState(this, new IProperty[] {LAYERS}); + } ++ ++ @Override public int quantityDropped(IBlockState state, int fortune, Random random){ return ((Integer)state.getValue(LAYERS)) + 1; } + } diff --git a/patches/minecraft/net/minecraft/block/BlockStem.java.patch b/patches/minecraft/net/minecraft/block/BlockStem.java.patch new file mode 100644 index 0000000000..db0468600e --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockStem.java.patch @@ -0,0 +1,42 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockStem.java ++++ ../src-work/minecraft/net/minecraft/block/BlockStem.java +@@ -96,7 +96,7 @@ + pos = pos.offset(EnumFacing.Plane.HORIZONTAL.random(rand)); + Block block = worldIn.getBlockState(pos.down()).getBlock(); + +- if (worldIn.getBlockState(pos).getBlock().blockMaterial == Material.air && (block == Blocks.farmland || block == Blocks.dirt || block == Blocks.grass)) ++ if (worldIn.isAirBlock(pos) && (block.canSustainPlant(worldIn, pos.down(), EnumFacing.UP, this) || block == Blocks.dirt || block == Blocks.grass)) + { + worldIn.setBlockState(pos, this.crop.getDefaultState()); + } +@@ -150,8 +150,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(); + +@@ -161,13 +165,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/minecraft/net/minecraft/block/BlockTallGrass.java.patch b/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch new file mode 100644 index 0000000000..cd0915eb87 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch @@ -0,0 +1,66 @@ +--- ../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); + private static final String __OBFID = "CL_00000321"; +@@ -44,7 +44,7 @@ + + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { +- return this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); ++ return super.canBlockStay(worldIn, pos, state); + } + + public boolean isReplaceable(World worldIn, BlockPos pos) +@@ -54,7 +54,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) +@@ -64,13 +64,7 @@ + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { +- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) + { +- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); +- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 1, ((BlockTallGrass.EnumType)state.getValue(TYPE)).getMeta())); +- } +- else +- { + super.harvestBlock(worldIn, player, pos, state, te); + } + } +@@ -206,4 +200,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/minecraft/net/minecraft/block/BlockTorch.java.patch b/patches/minecraft/net/minecraft/block/BlockTorch.java.patch new file mode 100644 index 0000000000..c0f92632d6 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockTorch.java.patch @@ -0,0 +1,38 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockTorch.java ++++ ../src-work/minecraft/net/minecraft/block/BlockTorch.java +@@ -65,7 +65,7 @@ + else + { + Block block = worldIn.getBlockState(pos).getBlock(); +- return block instanceof BlockFence || block == Blocks.glass || block == Blocks.cobblestone_wall || block == Blocks.stained_glass; ++ return block.canPlaceTorchOnTop(worldIn, pos); + } + } + +@@ -86,7 +86,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) +@@ -99,7 +99,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); + } +@@ -132,7 +132,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), enumfacing1, true)) + { + flag = true; + } diff --git a/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch b/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch new file mode 100644 index 0000000000..e2c0c7b525 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch @@ -0,0 +1,43 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockTrapDoor.java ++++ ../src-work/minecraft/net/minecraft/block/BlockTrapDoor.java +@@ -25,6 +25,8 @@ + + public class BlockTrapDoor extends Block + { ++ /** Set this to allow trapdoors to remain free-floating */ ++ public static boolean disableValidation = false; + public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); + public static final PropertyBool OPEN = PropertyBool.create("open"); + public static final PropertyEnum HALF = PropertyEnum.create("half", BlockTrapDoor.DoorHalf.class); +@@ -141,9 +143,10 @@ + { + if (!worldIn.isRemote) + { ++ EnumFacing direction = (EnumFacing)state.getValue(FACING); + BlockPos blockpos = pos.offset(((EnumFacing)state.getValue(FACING)).getOpposite()); + +- if (!isValidSupportBlock(worldIn.getBlockState(blockpos).getBlock())) ++ if (!(isValidSupportBlock(worldIn.getBlockState(blockpos).getBlock()) || worldIn.isSideSolid(blockpos, direction, true))) + { + worldIn.setBlockToAir(pos); + this.dropBlockAsItem(worldIn, pos, state, 0); +@@ -187,7 +190,10 @@ + + public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) + { +- return !side.getAxis().isVertical() && isValidSupportBlock(worldIn.getBlockState(pos.offset(side.getOpposite())).getBlock()); ++ if (disableValidation) return true; ++ EnumFacing dir = side.getOpposite(); ++ pos = pos.offset(dir); ++ return !side.getAxis().isVertical() && (isValidSupportBlock(worldIn.getBlockState(pos).getBlock()) || worldIn.isSideSolid(pos, side, true)); + } + + protected static EnumFacing getFacing(int meta) +@@ -224,6 +230,7 @@ + + private static boolean isValidSupportBlock(Block blockIn) + { ++ if (disableValidation) return true; + return blockIn.blockMaterial.isOpaque() && blockIn.isFullCube() || blockIn == Blocks.glowstone || blockIn instanceof BlockSlab || blockIn instanceof BlockStairs; + } + diff --git a/patches/minecraft/net/minecraft/block/BlockTripWireHook.java.patch b/patches/minecraft/net/minecraft/block/BlockTripWireHook.java.patch new file mode 100644 index 0000000000..9150d02c9a --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockTripWireHook.java.patch @@ -0,0 +1,28 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockTripWireHook.java ++++ ../src-work/minecraft/net/minecraft/block/BlockTripWireHook.java +@@ -59,14 +59,14 @@ + + public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) + { +- return side.getAxis().isHorizontal() && worldIn.getBlockState(pos.offset(side.getOpposite())).getBlock().isNormalCube(); ++ return side.getAxis().isHorizontal() && worldIn.isSideSolid(pos.offset(side.getOpposite()), side, true); + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) + { +- if (worldIn.getBlockState(pos.offset(enumfacing)).getBlock().isNormalCube()) ++ if (worldIn.isSideSolid(pos.offset(enumfacing), enumfacing.getOpposite(), true)) + { + return true; + } +@@ -100,7 +100,7 @@ + { + EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + +- if (!worldIn.getBlockState(pos.offset(enumfacing.getOpposite())).getBlock().isNormalCube()) ++ if (!worldIn.isSideSolid(pos.offset(enumfacing.getOpposite()), enumfacing, true)) + { + this.dropBlockAsItem(worldIn, pos, state, 0); + worldIn.setBlockToAir(pos); diff --git a/patches/minecraft/net/minecraft/block/BlockVine.java.patch b/patches/minecraft/net/minecraft/block/BlockVine.java.patch new file mode 100644 index 0000000000..8194f2b6cf --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockVine.java.patch @@ -0,0 +1,40 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockVine.java ++++ ../src-work/minecraft/net/minecraft/block/BlockVine.java +@@ -25,7 +25,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"); +@@ -388,13 +388,7 @@ + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { +- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) + { +- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); +- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.vine, 1, 0)); +- } +- else +- { + super.harvestBlock(worldIn, player, pos, state, te); + } + } +@@ -475,4 +469,14 @@ + + return i; + } ++ /*************************FORGE START***********************************/ ++ @Override public boolean isLadder(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/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch b/patches/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch new file mode 100644 index 0000000000..aabc4ae426 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch @@ -0,0 +1,29 @@ +--- ../src-base/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java ++++ ../src-work/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java +@@ -79,7 +79,7 @@ + { + Block block = this.world.getBlockState(origin).getBlock(); + +- if (block.getMaterial() == Material.air) ++ if (block.isAir(world, origin)) + { + return true; + } +@@ -110,7 +110,7 @@ + BlockPos blockpos = origin.offset(this.moveDirection.getOpposite(), i); + block = this.world.getBlockState(blockpos).getBlock(); + +- if (block.getMaterial() == Material.air || !BlockPistonBase.canPush(block, this.world, blockpos, this.moveDirection, false) || blockpos.equals(this.pistonPos)) ++ if (block.isAir(world, blockpos)|| !BlockPistonBase.canPush(block, this.world, blockpos, this.moveDirection, false) || blockpos.equals(this.pistonPos)) + { + break; + } +@@ -157,7 +157,7 @@ + + block = this.world.getBlockState(blockpos1).getBlock(); + +- if (block.getMaterial() == Material.air) ++ if (block.isAir(world, blockpos1)) + { + return true; + } diff --git a/patches/minecraft/net/minecraft/block/state/BlockState.java.patch b/patches/minecraft/net/minecraft/block/state/BlockState.java.patch new file mode 100644 index 0000000000..e2a202b483 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/state/BlockState.java.patch @@ -0,0 +1,53 @@ +--- ../src-base/minecraft/net/minecraft/block/state/BlockState.java ++++ ../src-work/minecraft/net/minecraft/block/state/BlockState.java +@@ -40,6 +40,16 @@ + + public BlockState(Block blockIn, IProperty... properties) + { ++ this(blockIn, properties, null); ++ } ++ ++ protected StateImplementation createState(Block block, ImmutableMap properties, ImmutableMap unlistedProperties) ++ { ++ return new StateImplementation(block, properties); ++ } ++ ++ protected BlockState(Block blockIn, IProperty[] properties, ImmutableMap unlistedProperties) ++ { + this.block = blockIn; + Arrays.sort(properties, new Comparator() + { +@@ -56,7 +66,7 @@ + for (List list1 : Cartesian.cartesianProduct(this.getAllowedValues())) + { + Map map1 = MapPopulator.createMap(this.properties, list1); +- BlockState.StateImplementation blockstate$stateimplementation = new BlockState.StateImplementation(blockIn, ImmutableMap.copyOf(map1)); ++ BlockState.StateImplementation blockstate$stateimplementation = createState(blockIn, ImmutableMap.copyOf(map), unlistedProperties); + map.put(map1, blockstate$stateimplementation); + list.add(blockstate$stateimplementation); + } +@@ -136,6 +146,13 @@ + } + } + ++ protected StateImplementation(Block blockIn, ImmutableMap propertiesIn, ImmutableTable propertyValueTable) ++ { ++ this.block = blockIn; ++ this.properties = propertiesIn; ++ this.propertyValueTable = propertyValueTable; ++ } ++ + public , V extends T> IBlockState withProperty(IProperty property, V value) + { + if (!this.properties.containsKey(property)) +@@ -203,5 +220,10 @@ + map.put(property, value); + return map; + } ++ ++ public ImmutableTable getPropertyValueTable() ++ { ++ return propertyValueTable; ++ } + } + } diff --git a/patches/minecraft/net/minecraft/block/state/BlockStateBase.java.patch b/patches/minecraft/net/minecraft/block/state/BlockStateBase.java.patch new file mode 100644 index 0000000000..1aa5874a55 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/state/BlockStateBase.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/block/state/BlockStateBase.java ++++ ../src-work/minecraft/net/minecraft/block/state/BlockStateBase.java +@@ -69,4 +69,9 @@ + + return stringbuilder.toString(); + } ++ ++ public com.google.common.collect.ImmutableTable getPropertyValueTable() ++ { ++ return null; ++ } + } diff --git a/patches/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch b/patches/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch new file mode 100644 index 0000000000..d046aa4a52 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/ClientBrandRetriever.java ++++ ../src-work/minecraft/net/minecraft/client/ClientBrandRetriever.java +@@ -10,6 +10,6 @@ + + public static String getClientModName() + { +- return "vanilla"; ++ return net.minecraftforge.fml.common.FMLCommonHandler.instance().getModName(); + } + } diff --git a/patches/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch b/patches/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch new file mode 100644 index 0000000000..7afa2924d0 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/client/LoadingScreenRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/LoadingScreenRenderer.java +@@ -140,6 +140,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(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + this.mc.getTextureManager().bindTexture(Gui.optionsBackground); diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch new file mode 100644 index 0000000000..65b28301f9 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/Minecraft.java.patch @@ -0,0 +1,244 @@ +--- ../src-base/minecraft/net/minecraft/client/Minecraft.java ++++ ../src-work/minecraft/net/minecraft/client/Minecraft.java +@@ -302,7 +302,6 @@ + this.sessionService = (new YggdrasilAuthenticationService(gameConfig.userInfo.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; +@@ -416,10 +415,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.initStream(); + this.skinManager = new SkinManager(this.renderEngine, new File(this.fileAssets, "skins"), this.sessionService); + this.saveLoader = new AnvilSaveConverter(new File(this.mcDataDir, "saves")); +@@ -455,6 +454,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); +@@ -468,17 +469,21 @@ + 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); ++ bar.step("Loading Item Renderer"); + this.renderItem = new RenderItem(this.renderEngine, this.modelManager); + 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.gameSettings); +@@ -488,22 +493,25 @@ + 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); + ++ net.minecraftforge.fml.client.FMLClientHandler.instance().onInitializationComplete(); + if (this.gameSettings.fullScreen && !this.fullscreen) + { + this.toggleFullscreen(); +@@ -684,21 +692,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() +@@ -886,11 +896,6 @@ + + public void displayGuiScreen(GuiScreen guiScreenIn) + { +- if (this.currentScreen != null) +- { +- this.currentScreen.onGuiClosed(); +- } +- + if (guiScreenIn == null && this.theWorld == null) + { + guiScreenIn = new GuiMainMenu(); +@@ -900,6 +905,17 @@ + guiScreenIn = new GuiGameOver(); + } + ++ 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) + { + this.gameSettings.showDebugInfo = false; +@@ -1380,7 +1396,7 @@ + + if (this.theWorld.getBlockState(blockpos).getBlock().getMaterial() != Material.air && this.playerController.func_180512_c(blockpos, this.objectMouseOver.sideHit)) + { +- this.effectRenderer.addBlockHitEffects(blockpos, this.objectMouseOver.sideHit); ++ this.effectRenderer.addBlockHitEffects(blockpos, this.objectMouseOver); + this.thePlayer.swingItem(); + } + } +@@ -1601,6 +1617,8 @@ + --this.rightClickDelayTimer; + } + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPreClientTick(); ++ + this.mcProfiler.startSection("gui"); + + if (!this.isGamePaused) +@@ -1750,6 +1768,7 @@ + this.currentScreen.handleMouseInput(); + } + } ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().fireMouseInput(); + } + + if (this.leftClickCounter > 0) +@@ -1928,6 +1947,7 @@ + } + } + } ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().fireKeyInput(); + } + + for (int l = 0; l < 9; ++l) +@@ -2124,12 +2144,15 @@ + this.myNetworkManager.processReceivedPackets(); + } + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostClientTick(); ++ + this.mcProfiler.endSection(); + this.systemTime = getSystemTime(); + } + + 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); +@@ -2190,8 +2213,14 @@ + SocketAddress socketaddress = this.theIntegratedServer.getNetworkSystem().addLocalEndpoint(); + NetworkManager networkmanager = NetworkManager.provideLocalClient(socketaddress); + networkmanager.setNetHandler(new NetHandlerLoginClient(networkmanager, this, (GuiScreen)null)); +- networkmanager.sendPacket(new C00Handshake(47, socketaddress.toString(), 0, EnumConnectionState.LOGIN)); +- networkmanager.sendPacket(new C00PacketLoginStart(this.getSession().getProfile())); ++ networkmanager.sendPacket(new C00Handshake(47, 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 C00PacketLoginStart(gameProfile)); + this.myNetworkManager = networkmanager; + } + +@@ -2202,6 +2231,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(); +@@ -2215,6 +2246,18 @@ + { + this.theIntegratedServer.initiateShutdown(); + this.theIntegratedServer.setStaticInstance(); ++ 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; +@@ -2237,6 +2280,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(); diff --git a/patches/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch b/patches/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch new file mode 100644 index 0000000000..fe59438649 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java ++++ ../src-work/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java +@@ -129,6 +129,6 @@ + f *= 1.0F - f1 * 0.15F; + } + +- return f; ++ return net.minecraftforge.client.ForgeHooksClient.getOffsetFOV(this, f); + } + } diff --git a/patches/minecraft/net/minecraft/client/gui/FontRenderer.java.patch b/patches/minecraft/net/minecraft/client/gui/FontRenderer.java.patch new file mode 100644 index 0000000000..f3a13cdd9c --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/FontRenderer.java.patch @@ -0,0 +1,112 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/FontRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/gui/FontRenderer.java +@@ -58,7 +58,7 @@ + this.locationFontTexture = p_i1035_2_; + this.renderEngine = p_i1035_3_; + this.unicodeFlag = p_i1035_4_; +- p_i1035_3_.bindTexture(this.locationFontTexture); ++ bindTexture(this.locationFontTexture); + + for (int i = 0; i < 32; ++i) + { +@@ -98,6 +98,7 @@ + public void onResourceManagerReload(IResourceManager resourceManager) + { + this.readFontTexture(); ++ this.readGlyphSizes(); + } + + private void readFontTexture() +@@ -106,7 +107,7 @@ + + try + { +- bufferedimage = TextureUtil.readBufferedImage(Minecraft.getMinecraft().getResourceManager().getResource(this.locationFontTexture).getInputStream()); ++ bufferedimage = TextureUtil.readBufferedImage(getResourceInputStream(this.locationFontTexture)); + } + catch (IOException ioexception) + { +@@ -166,7 +167,7 @@ + + try + { +- inputstream = Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation("font/glyph_sizes.bin")).getInputStream(); ++ inputstream = getResourceInputStream(new ResourceLocation("font/glyph_sizes.bin")); + inputstream.read(this.glyphWidth); + } + catch (IOException ioexception) +@@ -225,7 +226,7 @@ + + private void loadGlyphTexture(int p_78257_1_) + { +- this.renderEngine.bindTexture(this.getUnicodePageLocation(p_78257_1_)); ++ bindTexture(this.getUnicodePageLocation(p_78257_1_)); + } + + protected float renderUnicodeChar(char p_78277_1_, boolean p_78277_2_) +@@ -272,7 +273,7 @@ + + public int drawString(String p_175065_1_, float p_175065_2_, float p_175065_3_, int p_175065_4_, boolean p_175065_5_) + { +- GlStateManager.enableAlpha(); ++ enableAlpha(); + this.resetStyles(); + int i; + +@@ -371,7 +372,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; +@@ -510,7 +511,7 @@ + this.blue = (float)(p_180455_4_ >> 8 & 255) / 255.0F; + this.green = (float)(p_180455_4_ & 255) / 255.0F; + this.alpha = (float)(p_180455_4_ >> 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 = p_180455_2_; + this.posY = p_180455_3_; + this.renderStringAtPos(p_180455_1_, p_180455_5_); +@@ -589,11 +590,6 @@ + int j = this.glyphWidth[p_78263_1_] >>> 4; + int k = this.glyphWidth[p_78263_1_] & 15; + +- if (k > 7) +- { +- k = 15; +- j = 0; +- } + + ++k; + return (k - j) / 2 + 1; +@@ -847,6 +843,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 InputStream getResourceInputStream(ResourceLocation location) throws IOException ++ { ++ return Minecraft.getMinecraft().getResourceManager().getResource(location).getInputStream(); ++ } ++ + public int getColorCode(char p_175064_1_) + { + return this.colorCode["0123456789abcdef".indexOf(p_175064_1_)]; diff --git a/patches/minecraft/net/minecraft/client/gui/GuiButton.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiButton.java.patch new file mode 100644 index 0000000000..b25e68b9a5 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/GuiButton.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiButton.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiButton.java +@@ -22,6 +22,7 @@ + public boolean visible; + protected boolean hovered; + private static final String __OBFID = "CL_00000668"; ++ public int packedFGColour; //FML + + public GuiButton(int buttonId, int x, int y, String buttonText) + { diff --git a/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch new file mode 100644 index 0000000000..fc33299291 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch @@ -0,0 +1,18 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiChat.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiChat.java +@@ -216,13 +216,14 @@ + this.mc.ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText(stringbuilder.toString()), 1); + } + +- this.inputField.writeText((String)this.foundPlayerNames.get(this.autocompleteIndex++)); ++ this.inputField.writeText(net.minecraft.util.EnumChatFormatting.getTextWithoutFormattingCodes((String)this.foundPlayerNames.get(this.autocompleteIndex++))); + } + + private void sendAutocompleteRequest(String p_146405_1_, String p_146405_2_) + { + if (p_146405_1_.length() >= 1) + { ++ net.minecraftforge.client.ClientCommandHandler.instance.autoComplete(p_146405_1_, p_146405_2_); + BlockPos blockpos = null; + + if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) diff --git a/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch new file mode 100644 index 0000000000..a5f273e6ca --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch @@ -0,0 +1,27 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiCreateWorld.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiCreateWorld.java +@@ -313,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); + } + } + } +@@ -372,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/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch new file mode 100644 index 0000000000..5f1c09f18c --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch @@ -0,0 +1,22 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiIngameMenu.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiIngameMenu.java +@@ -75,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/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch new file mode 100644 index 0000000000..b4563e39bf --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch @@ -0,0 +1,19 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiMultiplayer.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiMultiplayer.java +@@ -41,6 +41,7 @@ + public GuiMultiplayer(GuiScreen parentScreen) + { + this.parentScreen = parentScreen; ++ net.minecraftforge.fml.client.FMLClientHandler.instance().setupServerList(); + } + + public void initGui() +@@ -373,7 +374,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/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch new file mode 100644 index 0000000000..6017c729c0 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java +@@ -107,6 +107,9 @@ + { + BlockPos blockpos = new BlockPos(this.mc.getRenderViewEntity().posX, this.mc.getRenderViewEntity().getEntityBoundingBox().minY, this.mc.getRenderViewEntity().posZ); + ++ arraylist.add(""); ++ arraylist.addAll(net.minecraftforge.fml.common.FMLCommonHandler.instance().getBrandings(false)); ++ + if (this.isReducedDebug()) + { + return Lists.newArrayList(new String[] {"Minecraft 1.8.8 (" + this.mc.getVersion() + "/" + ClientBrandRetriever.getClientModName() + ")", this.mc.debug, this.mc.renderGlobal.getDebugInfoRenders(), this.mc.renderGlobal.getDebugInfoEntities(), "P: " + this.mc.effectRenderer.getStatistics() + ". T: " + this.mc.theWorld.getDebugLoadedEntities(), this.mc.theWorld.getProviderName(), "", String.format("Chunk-relative: %d %d %d", new Object[]{Integer.valueOf(blockpos.getX() & 15), Integer.valueOf(blockpos.getY() & 15), Integer.valueOf(blockpos.getZ() & 15)})}); diff --git a/patches/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch new file mode 100644 index 0000000000..83c8e4e056 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiSelectWorld.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiSelectWorld.java +@@ -187,7 +187,7 @@ + + if (this.mc.getSaveLoader().canLoadWorld(s)) + { +- this.mc.launchIntegratedServer(s, s1, (WorldSettings)null); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().tryLoadExistingWorld(this, s, s1); + } + } + } diff --git a/patches/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch new file mode 100644 index 0000000000..5df4b471ba --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiSleepMP.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiSleepMP.java +@@ -34,7 +34,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/minecraft/net/minecraft/client/gui/GuiSlot.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch new file mode 100644 index 0000000000..3cc9d27e2f --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch @@ -0,0 +1,22 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiSlot.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiSlot.java +@@ -459,4 +459,19 @@ + { + return this.slotHeight; + } ++ ++ protected void drawContainerBackground(Tessellator tessellator) ++ { ++ WorldRenderer worldrenderer = tessellator.getWorldRenderer(); ++ this.mc.getTextureManager().bindTexture(Gui.optionsBackground); ++ GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); ++ float f1 = 32.0F; ++ worldrenderer.startDrawingQuads(); ++ worldrenderer.setColorOpaque_I(2105376); ++ worldrenderer.addVertexWithUV((double)this.left, (double)this.bottom, 0.0D, (double)((float)this.left / f1), (double)((float)(this.bottom + (int)this.amountScrolled) / f1)); ++ worldrenderer.addVertexWithUV((double)this.right, (double)this.bottom, 0.0D, (double)((float)this.right / f1), (double)((float)(this.bottom + (int)this.amountScrolled) / f1)); ++ worldrenderer.addVertexWithUV((double)this.right, (double)this.top, 0.0D, (double)((float)this.right / f1), (double)((float)(this.top + (int)this.amountScrolled) / f1)); ++ worldrenderer.addVertexWithUV((double)this.left, (double)this.top, 0.0D, (double)((float)this.left / f1), (double)((float)(this.top + (int)this.amountScrolled) / f1)); ++ tessellator.draw(); ++ } + } diff --git a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch new file mode 100644 index 0000000000..782f2ce935 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch @@ -0,0 +1,104 @@ +--- ../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 boolean field_147057_D; + private CreativeCrafting field_147059_E; + private static final String __OBFID = "CL_00000752"; ++ private static int tabPage = 0; ++ private int maxPages = 0; + + public GuiContainerCreative(EntityPlayer p_i1088_1_) + { +@@ -260,6 +262,13 @@ + this.setCurrentCreativeTab(CreativeTabs.creativeTabArray[i]); + this.field_147059_E = new CreativeCrafting(this.mc); + this.mc.thePlayer.inventoryContainer.addCraftingToCrafters(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 + { +@@ -281,7 +290,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)) + { +@@ -366,7 +375,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); +@@ -414,11 +423,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; +@@ -484,12 +495,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 +@@ -658,6 +671,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) +@@ -790,6 +811,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/minecraft/net/minecraft/client/model/ModelBase.java.patch b/patches/minecraft/net/minecraft/client/model/ModelBase.java.patch new file mode 100644 index 0000000000..4f3c8aede2 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/model/ModelBase.java.patch @@ -0,0 +1,10 @@ +--- ../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/minecraft/net/minecraft/client/model/ModelBox.java.patch b/patches/minecraft/net/minecraft/client/model/ModelBox.java.patch new file mode 100644 index 0000000000..ed3cab955e --- /dev/null +++ b/patches/minecraft/net/minecraft/client/model/ModelBox.java.patch @@ -0,0 +1,18 @@ +--- ../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; +@@ -82,6 +81,7 @@ + } + } + ++ @SideOnly(Side.CLIENT) + public void render(WorldRenderer p_178780_1_, float p_178780_2_) + { + for (int i = 0; i < this.quadList.length; ++i) diff --git a/patches/minecraft/net/minecraft/client/model/ModelRenderer.java.patch b/patches/minecraft/net/minecraft/client/model/ModelRenderer.java.patch new file mode 100644 index 0000000000..d27fe0f0e7 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/model/ModelRenderer.java.patch @@ -0,0 +1,42 @@ +--- ../src-base/minecraft/net/minecraft/client/model/ModelRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/model/ModelRenderer.java +@@ -10,7 +10,6 @@ + import net.minecraftforge.fml.relauncher.SideOnly; + import org.lwjgl.opengl.GL11; + +-@SideOnly(Side.CLIENT) + public class ModelRenderer + { + public float textureWidth; +@@ -110,6 +109,7 @@ + this.rotationPointZ = p_78793_3_; + } + ++ @SideOnly(Side.CLIENT) + public void render(float p_78785_1_) + { + if (!this.isHidden) +@@ -191,6 +191,7 @@ + } + } + ++ @SideOnly(Side.CLIENT) + public void renderWithRotation(float p_78791_1_) + { + if (!this.isHidden) +@@ -226,6 +227,7 @@ + } + } + ++ @SideOnly(Side.CLIENT) + public void postRender(float p_78794_1_) + { + if (!this.isHidden) +@@ -267,6 +269,7 @@ + } + } + ++ @SideOnly(Side.CLIENT) + private void compileDisplayList(float p_78788_1_) + { + this.displayList = GLAllocation.generateDisplayLists(1); diff --git a/patches/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch b/patches/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch new file mode 100644 index 0000000000..c3d2571d6f --- /dev/null +++ b/patches/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch @@ -0,0 +1,13 @@ +--- ../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.Vec3; +-import net.minecraftforge.fml.relauncher.Side; +-import net.minecraftforge.fml.relauncher.SideOnly; + +-@SideOnly(Side.CLIENT) + public class PositionTextureVertex + { + public Vec3 vector3D; diff --git a/patches/minecraft/net/minecraft/client/model/TexturedQuad.java.patch b/patches/minecraft/net/minecraft/client/model/TexturedQuad.java.patch new file mode 100644 index 0000000000..321941a6b1 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/model/TexturedQuad.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/client/model/TexturedQuad.java ++++ ../src-work/minecraft/net/minecraft/client/model/TexturedQuad.java +@@ -4,10 +4,7 @@ + import net.minecraft.client.renderer.WorldRenderer; + import net.minecraft.client.renderer.vertex.DefaultVertexFormats; + import net.minecraft.util.Vec3; +-import net.minecraftforge.fml.relauncher.Side; +-import net.minecraftforge.fml.relauncher.SideOnly; + +-@SideOnly(Side.CLIENT) + public class TexturedQuad + { + public PositionTextureVertex[] vertexPositions; diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch new file mode 100644 index 0000000000..faf4f9779f --- /dev/null +++ b/patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java ++++ ../src-work/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java +@@ -56,6 +56,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/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch new file mode 100644 index 0000000000..76efc616e9 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java ++++ ../src-work/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java +@@ -69,7 +69,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(47, ip, port, EnumConnectionState.LOGIN)); ++ GuiConnecting.this.networkManager.sendPacket(new C00Handshake(47, ip, port, EnumConnectionState.LOGIN, true)); + GuiConnecting.this.networkManager.sendPacket(new C00PacketLoginStart(GuiConnecting.this.mc.getSession().getProfile())); + } + catch (UnknownHostException unknownhostexception) diff --git a/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch new file mode 100644 index 0000000000..2b34255d91 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch @@ -0,0 +1,48 @@ +--- ../src-base/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java ++++ ../src-work/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java +@@ -112,6 +112,12 @@ + } + } + ++ ItemStack stack = mc.thePlayer.getCurrentEquippedItem(); ++ if (stack != null && stack.getItem() != null && stack.getItem().onBlockStartBreak(stack, pos, mc.thePlayer)) ++ { ++ return false; ++ } ++ + if (this.currentGameType.isCreative() && this.mc.thePlayer.getHeldItem() != null && this.mc.thePlayer.getHeldItem().getItem() instanceof ItemSword) + { + return false; +@@ -357,11 +363,19 @@ + { + if (this.currentGameType != WorldSettings.GameType.SPECTATOR) + { ++ ++ if (p_178890_3_ != null && ++ p_178890_3_.getItem() != null && ++ p_178890_3_.getItem().onItemUseFirst(p_178890_3_, p_178890_1_, p_178890_2_, p_178890_4_, p_178890_5_, f, f1, f2)) ++ { ++ return true; ++ } ++ + IBlockState iblockstate = p_178890_2_.getBlockState(p_178890_4_); + +- if ((!p_178890_1_.isSneaking() || p_178890_1_.getHeldItem() == null) && iblockstate.getBlock().onBlockActivated(p_178890_2_, p_178890_4_, iblockstate, p_178890_1_, p_178890_5_, f, f1, f2)) ++ if ((!p_178890_1_.isSneaking() || p_178890_1_.getHeldItem() == null || p_178890_1_.getHeldItem().getItem().doesSneakBypassUse(p_178890_2_, p_178890_4_, p_178890_1_))) + { +- flag = true; ++ flag = iblockstate.getBlock().onBlockActivated(p_178890_2_, p_178890_4_, iblockstate, p_178890_1_, p_178890_5_, f, f1, f2); + } + + if (!flag && p_178890_3_ != null && p_178890_3_.getItem() instanceof ItemBlock) +@@ -394,7 +408,9 @@ + } + else + { +- return p_178890_3_.onItemUse(p_178890_1_, p_178890_2_, p_178890_4_, p_178890_5_, f, f1, f2); ++ if (!p_178890_3_.onItemUse(p_178890_1_, p_178890_2_, p_178890_4_, p_178890_5_, f, f1, f2)) return false; ++ if (p_178890_3_.stackSize <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_178890_1_, p_178890_3_); ++ return true; + } + } + else diff --git a/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch new file mode 100644 index 0000000000..c96066c548 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch @@ -0,0 +1,17 @@ +--- ../src-base/minecraft/net/minecraft/client/multiplayer/WorldClient.java ++++ ../src-work/minecraft/net/minecraft/client/multiplayer/WorldClient.java +@@ -53,12 +53,13 @@ + super(new SaveHandlerMP(), new WorldInfo(p_i45063_2_, "MpServer"), WorldProvider.getProviderForDimension(p_i45063_3_), p_i45063_5_, true); + 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/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch b/patches/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch new file mode 100644 index 0000000000..c84d9a2d24 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java ++++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java +@@ -24,6 +24,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/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch b/patches/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch new file mode 100644 index 0000000000..540435e485 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch @@ -0,0 +1,14 @@ +--- ../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(IChatComponent reason) diff --git a/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch b/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch new file mode 100644 index 0000000000..5fefba49c8 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch @@ -0,0 +1,62 @@ +--- ../src-base/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java ++++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java +@@ -247,7 +247,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(); +@@ -751,14 +751,16 @@ + public void handleChat(S02PacketChat packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); ++ net.minecraft.util.IChatComponent message = net.minecraftforge.event.ForgeEventFactory.onClientChat(packetIn.func_179841_c(), packetIn.func_148915_c()); ++ if (message == null) return; + + if (packetIn.func_179841_c() == 2) + { +- this.gameController.ingameGUI.func_175188_a(packetIn.func_148915_c(), false); ++ this.gameController.ingameGUI.func_175188_a(message, false); + } + else + { +- this.gameController.ingameGUI.getChatGUI().printChatMessage(packetIn.func_148915_c()); ++ this.gameController.ingameGUI.getChatGUI().printChatMessage(message); + } + } + +@@ -809,6 +811,11 @@ + float f = (float)(packetIn.func_149028_l() * 360) / 256.0F; + float f1 = (float)(packetIn.func_149030_m() * 360) / 256.0F; + EntityLivingBase entitylivingbase = (EntityLivingBase)EntityList.createEntityByID(packetIn.func_149025_e(), 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.func_149025_e(), d0, d1, d2); ++ return; ++ } + entitylivingbase.serverPosX = packetIn.func_149023_f(); + entitylivingbase.serverPosY = packetIn.func_149034_g(); + entitylivingbase.serverPosZ = packetIn.func_149029_h(); +@@ -1134,6 +1141,10 @@ + { + tileentity.readFromNBT(packetIn.getNbtCompound()); + } ++ else ++ { ++ tileentity.onDataPacket(netManager, packetIn); ++ } + } + } + +@@ -1342,7 +1353,7 @@ + + if (entity instanceof EntityLivingBase) + { +- PotionEffect potioneffect = new PotionEffect(packetIn.func_149427_e(), packetIn.func_180755_e(), packetIn.func_149428_f(), false, packetIn.func_179707_f()); ++ PotionEffect potioneffect = new PotionEffect(packetIn.func_149427_e() & 0xff, packetIn.func_180755_e(), packetIn.func_149428_f(), false, packetIn.func_179707_f()); + potioneffect.setPotionDurationMax(packetIn.func_149429_c()); + ((EntityLivingBase)entity).addPotionEffect(potioneffect); + } diff --git a/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch b/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch new file mode 100644 index 0000000000..3de2c7f1a6 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch @@ -0,0 +1,33 @@ +--- ../src-base/minecraft/net/minecraft/client/particle/EffectRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/particle/EffectRenderer.java +@@ -134,6 +134,7 @@ + + public void addEffect(EntityFX p_78873_1_) + { ++ if (p_78873_1_ == null) return; //Forge: Prevent modders from being bad and adding nulls causing untraceable NPEs. + int i = p_78873_1_.getFXLayer(); + int j = p_78873_1_.func_174838_j() != 1.0F ? 0 : 1; + +@@ -356,7 +357,7 @@ + + public void func_180533_a(BlockPos p_180533_1_, IBlockState p_180533_2_) + { +- if (p_180533_2_.getBlock().getMaterial() != Material.air) ++ if (!p_180533_2_.getBlock().isAir(worldObj, p_180533_1_) && !p_180533_2_.getBlock().addDestroyEffects(worldObj, p_180533_1_, this)) + { + p_180533_2_ = p_180533_2_.getBlock().getActualState(p_180533_2_, this.worldObj, p_180533_1_); + int i = 4; +@@ -462,4 +463,13 @@ + + return "" + i; + } ++ ++ public void addBlockHitEffects(BlockPos pos, net.minecraft.util.MovingObjectPosition target) ++ { ++ Block block = worldObj.getBlockState(pos).getBlock(); ++ if (block != null && !block.addHitEffects(worldObj, target, this)) ++ { ++ addBlockHitEffects(pos, target.sideHit); ++ } ++ } + } diff --git a/patches/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch b/patches/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch new file mode 100644 index 0000000000..75aa0918ad --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch @@ -0,0 +1,9 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/BlockModelShapes.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/BlockModelShapes.java +@@ -317,5 +317,6 @@ + return new ModelResourceLocation(s + "_double_slab", s1); + } + }); ++ net.minecraftforge.client.model.ModelLoader.onRegisterAllBlocks(this); + } + } diff --git a/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch new file mode 100644 index 0000000000..5890b09e30 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch @@ -0,0 +1,49 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java +@@ -24,7 +24,7 @@ + { + private BlockModelShapes blockModelShapes; + private final GameSettings gameSettings; +- private final BlockModelRenderer blockModelRenderer = new BlockModelRenderer(); ++ private final BlockModelRenderer blockModelRenderer = new net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer(); + private final ChestRenderer chestRenderer = new ChestRenderer(); + private final BlockFluidRenderer fluidRenderer = new BlockFluidRenderer(); + private static final String __OBFID = "CL_00002520"; +@@ -49,6 +49,24 @@ + { + p_175020_1_ = block.getActualState(p_175020_1_, p_175020_4_, p_175020_2_); + IBakedModel ibakedmodel = this.blockModelShapes.getModelForState(p_175020_1_); ++ ++ if(ibakedmodel instanceof net.minecraftforge.client.model.ISmartBlockModel) ++ { ++ IBlockState extendedState = block.getExtendedState(p_175020_1_, p_175020_4_, p_175020_2_); ++ for ( net.minecraft.util.EnumWorldBlockLayer layer : net.minecraft.util.EnumWorldBlockLayer.values() ) ++ { ++ if ( block.canRenderInLayer( layer ) ) ++ { ++ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(layer); ++ ++ IBakedModel targetLayer = ((net.minecraftforge.client.model.ISmartBlockModel)ibakedmodel).handleBlockState(extendedState); ++ IBakedModel damageModel = (new SimpleBakedModel.Builder(targetLayer, p_175020_3_)).makeBakedModel(); ++ this.blockModelRenderer.renderModel(p_175020_4_, damageModel, p_175020_1_, p_175020_2_, Tessellator.getInstance().getWorldRenderer()); ++ } ++ } ++ return; ++ } ++ + IBakedModel ibakedmodel1 = (new SimpleBakedModel.Builder(ibakedmodel, p_175020_3_)).makeBakedModel(); + this.blockModelRenderer.renderModel(p_175020_4_, ibakedmodel1, p_175020_1_, p_175020_2_, Tessellator.getInstance().getWorldRenderer()); + } +@@ -129,6 +147,12 @@ + ibakedmodel = ((WeightedBakedModel)ibakedmodel).getAlternativeModel(MathHelper.getPositionRandom(p_175022_3_)); + } + ++ if(ibakedmodel instanceof net.minecraftforge.client.model.ISmartBlockModel) ++ { ++ IBlockState extendedState = block.getExtendedState(p_175022_1_, p_175022_2_, p_175022_3_); ++ ibakedmodel = ((net.minecraftforge.client.model.ISmartBlockModel)ibakedmodel).handleBlockState(extendedState); ++ } ++ + return ibakedmodel; + } + diff --git a/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch new file mode 100644 index 0000000000..120177d619 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch @@ -0,0 +1,109 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/EntityRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/EntityRenderer.java +@@ -580,14 +580,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.FACING)).getHorizontalIndex(); +- GlStateManager.rotate((float)(j * 90), 0.0F, 1.0F, 0.0F); +- } +- + GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * p_78467_1_ + 180.0F, 0.0F, -1.0F, 0.0F); + GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * p_78467_1_, -1.0F, 0.0F, 0.0F); + } +@@ -654,17 +648,20 @@ + + if (!this.mc.gameSettings.debugCamEnable) + { +- GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * p_78467_1_, 1.0F, 0.0F, 0.0F); +- ++ float yaw = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * p_78467_1_ + 180.0F; ++ float pitch = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * p_78467_1_; ++ float roll = 0.0F; + if (entity instanceof EntityAnimal) + { + EntityAnimal entityanimal = (EntityAnimal)entity; +- GlStateManager.rotate(entityanimal.prevRotationYawHead + (entityanimal.rotationYawHead - entityanimal.prevRotationYawHead) * p_78467_1_ + 180.0F, 0.0F, 1.0F, 0.0F); ++ yaw = entityanimal.prevRotationYawHead + (entityanimal.rotationYawHead - entityanimal.prevRotationYawHead) * p_78467_1_ + 180.0F; + } +- else +- { +- GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * p_78467_1_ + 180.0F, 0.0F, 1.0F, 0.0F); +- } ++ Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, entity, p_78467_1_); ++ net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup event = new net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup(this, entity, block, p_78467_1_, 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); +@@ -1171,7 +1168,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 + { +@@ -1333,6 +1330,7 @@ + EntityPlayer entityplayer = (EntityPlayer)entity; + GlStateManager.disableAlpha(); + this.mc.mcProfiler.endStartSection("outline"); ++ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer, mc.objectMouseOver, 0, entityplayer.getHeldItem(), partialTicks)) + renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, partialTicks); + GlStateManager.enableAlpha(); + } +@@ -1399,8 +1397,12 @@ + 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 (!net.minecraftforge.client.ForgeHooksClient.renderFirstPersonHand(renderglobal, partialTicks, pass)) + if (this.renderHand) + { + GlStateManager.clear(256); +@@ -1837,6 +1839,13 @@ + this.fogColorBlue = f7; + } + ++ net.minecraftforge.client.event.EntityViewRenderEvent.FogColors event = new net.minecraftforge.client.event.EntityViewRenderEvent.FogColors(this, entity, block, 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); + } + +@@ -1855,6 +1864,10 @@ + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, entity, partialTicks); + ++ float hook = net.minecraftforge.client.ForgeHooksClient.getFogDensity(this, entity, block, partialTicks, 0.1F); ++ if (hook >= 0) ++ GlStateManager.setFogDensity(hook); ++ else + if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(Potion.blindness)) + { + float f1 = 5.0F; +@@ -1932,6 +1945,7 @@ + GlStateManager.setFogStart(f * 0.05F); + GlStateManager.setFogEnd(Math.min(f, 192.0F) * 0.5F); + } ++ net.minecraftforge.client.ForgeHooksClient.onFogRender(this, entity, block, partialTicks, p_78468_1_, f1); + } + + GlStateManager.enableColorMaterial(); diff --git a/patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch new file mode 100644 index 0000000000..9d58872a62 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java +@@ -81,6 +81,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)) continue; + String s1 = I18n.format(potion.getName(), new Object[0]); + + if (potioneffect.getAmplifier() == 1) diff --git a/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch b/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch new file mode 100644 index 0000000000..22fe8c9aff --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/ItemModelMesher.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/ItemModelMesher.java +@@ -51,6 +51,11 @@ + } + } + ++ if(ibakedmodel instanceof net.minecraftforge.client.model.ISmartItemModel) ++ { ++ ibakedmodel = ((net.minecraftforge.client.model.ISmartItemModel)ibakedmodel).handleItemState(stack); ++ } ++ + if (ibakedmodel == null) + { + ibakedmodel = this.modelManager.getMissingModel(); diff --git a/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch new file mode 100644 index 0000000000..bd6f7ee7fb --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch @@ -0,0 +1,46 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/ItemRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/ItemRenderer.java +@@ -314,7 +314,7 @@ + + if (this.itemToRender != null) + { +- if (this.itemToRender.getItem() == Items.filled_map) ++ if (this.itemToRender.getItem() instanceof net.minecraft.item.ItemMap) + { + this.func_178097_a(abstractclientplayer, f2, f, f1); + } +@@ -384,6 +384,7 @@ + + if (iblockstate.getBlock().getRenderType() != -1) + { ++ if (!net.minecraftforge.event.ForgeEventFactory.renderBlockOverlay(mc.thePlayer, p_78447_1_, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.BLOCK, iblockstate, blockpos)) + this.func_178108_a(p_78447_1_, this.mc.getBlockRendererDispatcher().getBlockModelShapes().getTexture(iblockstate)); + } + } +@@ -392,11 +393,13 @@ + { + if (this.mc.thePlayer.isInsideOfMaterial(Material.water)) + { ++ if (!net.minecraftforge.event.ForgeEventFactory.renderWaterOverlay(mc.thePlayer, p_78447_1_)) + this.renderWaterOverlayTexture(p_78447_1_); + } + + if (this.mc.thePlayer.isBurning()) + { ++ if (!net.minecraftforge.event.ForgeEventFactory.renderFireOverlay(mc.thePlayer, p_78447_1_)) + this.renderFireInFirstPerson(p_78447_1_); + } + } +@@ -513,6 +516,12 @@ + { + if (!this.itemToRender.getIsItemStackEqual(itemstack)) + { ++ if (!this.itemToRender.getItem().shouldCauseReequipAnimation(this.itemToRender, itemstack, equippedItemSlot != entityplayersp.inventory.currentItem)) ++ { ++ this.itemToRender = itemstack; ++ this.equippedItemSlot = entityplayersp.inventory.currentItem; ++ return; ++ } + flag = true; + } + } diff --git a/patches/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch b/patches/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch new file mode 100644 index 0000000000..b6bded7efb --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch @@ -0,0 +1,26 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/OpenGlHelper.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/OpenGlHelper.java +@@ -84,6 +84,10 @@ + public static int GL_STATIC_DRAW; + private static final String __OBFID = "CL_00001179"; + ++ /* 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(); +@@ -844,6 +848,12 @@ + { + GL13.glMultiTexCoord2f(p_77475_0_, p_77475_1_, p_77475_2_); + } ++ ++ if (p_77475_0_ == lightmapTexUnit) ++ { ++ lastBrightnessX = p_77475_1_; ++ lastBrightnessY = p_77475_2_; ++ } + } + + public static void glBlendFunc(int p_148821_0_, int p_148821_1_, int p_148821_2_, int p_148821_3_) diff --git a/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch b/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch new file mode 100644 index 0000000000..f1f271bb16 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch @@ -0,0 +1,70 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/RenderGlobal.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/RenderGlobal.java +@@ -526,8 +526,10 @@ + + public void renderEntities(Entity p_180446_1_, ICamera p_180446_2_, float partialTicks) + { ++ int pass = net.minecraftforge.client.MinecraftForgeClient.getRenderPass(); + if (this.renderEntitiesStartupCounter > 0) + { ++ if (pass > 0) return; + --this.renderEntitiesStartupCounter; + } + else +@@ -1162,6 +1164,12 @@ + + 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.getDimensionId() == 1) + { + this.renderSkyEnd(); +@@ -1379,6 +1387,12 @@ + + public void renderClouds(float p_180447_1_, int p_180447_2_) + { ++ net.minecraftforge.client.IRenderHandler renderer = this.mc.theWorld.provider.getCloudRenderer(); ++ if (renderer != null) ++ { ++ renderer.render(p_180447_1_, this.mc.theWorld, mc); ++ return; ++ } + if (this.mc.theWorld.provider.isSurfaceWorld()) + { + if (this.mc.gameSettings.func_181147_e() == 2) +@@ -1794,8 +1808,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) + { +@@ -1950,13 +1967,16 @@ + if (recordName != null) + { + ItemRecord itemrecord = ItemRecord.getRecord(recordName); ++ ResourceLocation resource = null; + + if (itemrecord != null) + { + this.mc.ingameGUI.setRecordPlayingMessage(itemrecord.getRecordNameLocal()); ++ resource = itemrecord.getRecordResource(recordName); + } + +- PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.create(new ResourceLocation(recordName), (float)blockPosIn.getX(), (float)blockPosIn.getY(), (float)blockPosIn.getZ()); ++ if (resource == null) resource = new ResourceLocation(recordName); ++ PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.create(resource, (float)blockPosIn.getX(), (float)blockPosIn.getY(), (float)blockPosIn.getZ()); + this.mapSoundPositions.put(blockPosIn, positionedsoundrecord); + this.mc.getSoundHandler().playSound(positionedsoundrecord); + } diff --git a/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch new file mode 100644 index 0000000000..8a9166d249 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch @@ -0,0 +1,17 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/WorldRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/WorldRenderer.java +@@ -580,6 +580,14 @@ + } + } + ++ public void checkAndGrow() ++ { ++ if (this.rawBufferIndex >= this.bufferSize - this.vertexFormat.getNextOffset()) ++ { ++ this.growBuffer(2097152); ++ } ++ } ++ + @SideOnly(Side.CLIENT) + public class State + { diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch new file mode 100644 index 0000000000..97dc4cd38c --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java +@@ -5,8 +5,9 @@ + import net.minecraftforge.fml.relauncher.SideOnly; + + @SideOnly(Side.CLIENT) +-public class BakedQuad ++public class BakedQuad implements net.minecraftforge.client.model.pipeline.IVertexProducer + { ++ @Override public void pipe(net.minecraftforge.client.model.pipeline.IVertexConsumer consumer) { net.minecraftforge.client.model.pipeline.LightUtil.putBakedQuad(consumer, this); } + protected final int[] vertexData; + protected final int tintIndex; + protected final EnumFacing face; diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch new file mode 100644 index 0000000000..0a53ccf646 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java +@@ -21,6 +21,11 @@ + + 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) ++ { + int[] aint = this.makeQuadVertexData(face, sprite, facing, this.getPositionsDiv16(posFrom, posTo), modelRotationIn, partRotation, uvLocked, shade); + EnumFacing enumfacing = getFacingFromVertexData(aint); + diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch new file mode 100644 index 0000000000..f38fed84cd --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java +@@ -10,7 +10,11 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + ++/* ++ * @deprecated use {@link net.minecraftforge.client.model.IPerspectiveAwareModel} instead ++ */ + @SideOnly(Side.CLIENT) ++@Deprecated + public class ItemCameraTransforms + { + public static final ItemCameraTransforms DEFAULT = new ItemCameraTransforms(); diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch new file mode 100644 index 0000000000..fc01e17a30 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch @@ -0,0 +1,18 @@ +--- ../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 net.minecraftforge.client.model.TRSRTransformation apply(net.minecraftforge.client.model.IModelPart part) { return new net.minecraftforge.client.model.TRSRTransformation(this); } + 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/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch new file mode 100644 index 0000000000..25284acf76 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch @@ -0,0 +1,29 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java +@@ -30,7 +30,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(Collection p_i46221_1_) +@@ -160,11 +160,17 @@ + return this.modelLocation; + } + ++ @Deprecated + public ModelRotation getRotation() + { + return this.modelRotation; + } + ++ public net.minecraftforge.client.model.IModelState getState() ++ { ++ return this.modelRotation; ++ } ++ + public boolean isUvLocked() + { + return this.uvLock; diff --git a/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch b/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch new file mode 100644 index 0000000000..dab1d3b246 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch @@ -0,0 +1,46 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java +@@ -159,7 +159,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); +@@ -190,6 +190,7 @@ + + aboolean[j] |= blockrendererdispatcher.renderBlock(iblockstate, blockpos$mutableblockpos, iblockaccess, worldrenderer); + } ++ } + } + + for (EnumWorldBlockLayer enumworldblocklayer : EnumWorldBlockLayer.values()) +@@ -386,6 +387,26 @@ + return this.needsUpdate; + } + ++ /* ======================================== 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 func_181701_a(EnumFacing p_181701_1_) + { + return (BlockPos)this.field_181702_p.get(p_181701_1_); diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch new file mode 100644 index 0000000000..fbe25532c1 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch @@ -0,0 +1,28 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java +@@ -158,4 +158,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/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch new file mode 100644 index 0000000000..1811392e25 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch @@ -0,0 +1,22 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderItem.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderItem.java +@@ -73,7 +73,7 @@ + public RenderItem(TextureManager textureManager, ModelManager modelManager) + { + this.textureManager = textureManager; +- this.itemModelMesher = new ItemModelMesher(modelManager); ++ this.itemModelMesher = new net.minecraftforge.client.ItemModelMesherForge(modelManager); + this.registerItems(); + } + +@@ -250,6 +250,10 @@ + { + GlStateManager.scale(2.0F, 2.0F, 2.0F); + } ++ else ++ { ++ modelresourcelocation = item.getModel(stack, entityplayer, entityplayer.getItemInUseCount()); ++ } + + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch new file mode 100644 index 0000000000..17df82b6bf --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch @@ -0,0 +1,25 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderManager.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderManager.java +@@ -194,6 +194,10 @@ + this.skinMap.put("default", this.field_178637_m); + this.skinMap.put("slim", new RenderPlayer(this, true)); + } ++ ++ public Map getSkinMap() { ++ return (Map) java.util.Collections.unmodifiableMap(skinMap); ++ } + + public void setRenderPosition(double p_178628_1_, double p_178628_3_, double p_178628_5_) + { +@@ -242,9 +246,9 @@ + IBlockState iblockstate = worldIn.getBlockState(new BlockPos(p_180597_3_)); + Block block = iblockstate.getBlock(); + +- if (block == Blocks.bed) ++ if (block.isBed(worldIn, new BlockPos(p_180597_3_), (EntityLivingBase)p_180597_3_)) + { +- int i = ((EnumFacing)iblockstate.getValue(BlockBed.FACING)).getHorizontalIndex(); ++ int i = block.getBedDirection(worldIn, new BlockPos(p_180597_3_)).getHorizontalIndex(); + this.playerViewY = (float)(i * 90 + 180); + this.playerViewX = 0.0F; + } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch new file mode 100644 index 0000000000..bc5b356d72 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java +@@ -62,6 +62,7 @@ + this.func_177137_d(entity); + super.doRender(entity, x, d0, z, p_76986_8_, partialTicks); + } ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Post(p_180596_1_, this, p_180596_9_, p_180596_2_, p_180596_4_, p_180596_6_)); + } + + private void func_177137_d(AbstractClientPlayer p_177137_1_) diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch new file mode 100644 index 0000000000..8441ac0fd2 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java +@@ -45,7 +45,7 @@ + case 4: + return butcherVillagerTextures; + default: +- return villagerTextures; ++ return net.minecraftforge.fml.common.registry.VillagerRegistry.getVillagerSkin(entity.getProfession(), villagerTextures); + } + } + diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch new file mode 100644 index 0000000000..8548073e1f --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch @@ -0,0 +1,36 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java +@@ -39,6 +39,9 @@ + protected boolean renderOutlines = false; + private static final String __OBFID = "CL_00001012"; + ++ public static float NAME_TAG_RANGE = 64.0f; ++ public static float NAME_TAG_RANGE_SNEAK = 32.0f; ++ + public RendererLivingEntity(RenderManager p_i46156_1_, ModelBase p_i46156_2_, float p_i46156_3_) + { + super(p_i46156_1_); +@@ -84,6 +87,7 @@ + + public void doRender(T entity, double x, double y, double z, float p_76986_8_, 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); +@@ -192,6 +196,7 @@ + { + super.doRender(entity, x, y, z, p_76986_8_, partialTicks); + } ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Post(entity, this, x, y, z)); + } + + protected boolean func_177088_c(T p_177088_1_) +@@ -519,6 +524,7 @@ + } + } + } ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Post(p_77033_1_, this, p_77033_2_, p_77033_4_, p_77033_6_)); + } + + protected boolean canRenderName(T entity) diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch new file mode 100644 index 0000000000..117c5c7c4b --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch @@ -0,0 +1,16 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java +@@ -136,11 +136,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_})}); diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch new file mode 100644 index 0000000000..931df54bb7 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch @@ -0,0 +1,19 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/texture/Stitcher.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/texture/Stitcher.java +@@ -74,6 +74,7 @@ + this.currentWidth = MathHelper.roundUpToPowerOfTwo(this.currentWidth); + this.currentHeight = MathHelper.roundUpToPowerOfTwo(this.currentHeight); + } ++ net.minecraftforge.fml.common.ProgressManager.pop(bar); + } + + public List getStichSlots() +@@ -262,7 +263,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/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch new file mode 100644 index 0000000000..f003a0c92c --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch @@ -0,0 +1,33 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java +@@ -404,4 +404,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/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch new file mode 100644 index 0000000000..9cbc2e7e70 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch @@ -0,0 +1,78 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureMap.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureMap.java +@@ -28,6 +28,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"); +@@ -39,6 +40,7 @@ + private int mipmapLevels; + private final TextureAtlasSprite missingImage; + private static final String __OBFID = "CL_00001058"; ++ private boolean skipFirst = false; + + public TextureMap(String p_i46099_1_) + { +@@ -167,6 +169,7 @@ + stitcher.addSprite(textureatlassprite); + } + ++ net.minecraftforge.fml.common.ProgressManager.pop(bar); + int j1 = Math.min(j, k); + int k1 = MathHelper.calculateLogBaseTwo(j1); + +@@ -217,9 +220,13 @@ + + this.missingImage.generateMipmaps(this.mipmapLevels); + stitcher.addSprite(this.missingImage); ++ net.minecraftforge.fml.common.ProgressManager.pop(bar); ++ skipFirst = false; ++ bar = net.minecraftforge.fml.common.ProgressManager.push("Texture creation", 3); + + try + { ++ bar.step("Stitching"); + stitcher.doStitch(); + } + catch (StitcherException stitcherexception) +@@ -323,4 +330,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/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch new file mode 100644 index 0000000000..12794639e5 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch @@ -0,0 +1,15 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java +@@ -198,9 +198,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) + { + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LEVEL, p_180600_1_); diff --git a/patches/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch b/patches/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch new file mode 100644 index 0000000000..2522c7399c --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch @@ -0,0 +1,31 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java +@@ -100,15 +100,18 @@ + GlStateManager.disableLighting(); + int i = p_82402_1_.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(p_82402_1_, 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; +@@ -166,6 +169,7 @@ + textureatlassprite.updateAnimation(); + } + } ++ } + + GlStateManager.enableLighting(); + GlStateManager.popMatrix(); diff --git a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch new file mode 100644 index 0000000000..9137aa3093 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java +@@ -79,6 +79,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(p_179022_1_.getItem(), p_179022_1_.getMetadata()); + else + { + TileEntityRendererDispatcher.instance.renderTileEntityAt(this.field_147717_b, 0.0D, 0.0D, 0.0D, 0.0F); diff --git a/patches/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch b/patches/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch new file mode 100644 index 0000000000..a013cf1da3 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/client/resources/AbstractResourcePack.java ++++ ../src-work/minecraft/net/minecraft/client/resources/AbstractResourcePack.java +@@ -59,7 +59,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/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch b/patches/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch new file mode 100644 index 0000000000..9ec768b73d --- /dev/null +++ b/patches/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch @@ -0,0 +1,10 @@ +--- ../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(p_110536_1_.toString()); + } + ++ @SuppressWarnings("resource") + protected InputStream getInputStream(ResourceLocation p_177245_1_, IResourcePack p_177245_2_) throws IOException + { + InputStream inputstream = p_177245_2_.getInputStream(p_177245_1_); diff --git a/patches/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch b/patches/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch new file mode 100644 index 0000000000..94444e80cf --- /dev/null +++ b/patches/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch @@ -0,0 +1,21 @@ +--- ../src-base/minecraft/net/minecraft/client/resources/model/IBakedModel.java ++++ ../src-work/minecraft/net/minecraft/client/resources/model/IBakedModel.java +@@ -8,7 +8,11 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + ++/* ++ * @deprecated use {@link net.minecraftforge.client.model.IFlexibleBakedModel}, {@link net.minecraftforge.client.model.IPerspectiveAwareModel} ++ */ + @SideOnly(Side.CLIENT) ++@Deprecated + public interface IBakedModel + { + List getFaceQuads(EnumFacing p_177551_1_); +@@ -23,5 +27,6 @@ + + TextureAtlasSprite getTexture(); + ++ @Deprecated + ItemCameraTransforms getItemCameraTransforms(); + } diff --git a/patches/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch b/patches/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch new file mode 100644 index 0000000000..cf85230f4d --- /dev/null +++ b/patches/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch @@ -0,0 +1,82 @@ +--- ../src-base/minecraft/net/minecraft/client/resources/model/ModelBakery.java ++++ ../src-work/minecraft/net/minecraft/client/resources/model/ModelBakery.java +@@ -115,7 +115,7 @@ + } + catch (Exception var6) + { +- LOGGER.warn("Unable to load variant: " + modelresourcelocation.getVariant() + " from " + modelresourcelocation); ++ LOGGER.warn("Unable to load variant: " + modelresourcelocation.getVariant() + " from " + modelresourcelocation, exception); + } + } + catch (Exception exception) +@@ -161,6 +161,7 @@ + } + } + } ++ catch (FileNotFoundException e) {} + catch (IOException ioexception) + { + throw new RuntimeException("Encountered an exception when loading model definition of model " + resourcelocation.toString(), ioexception); +@@ -295,6 +296,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"})); +@@ -337,6 +339,10 @@ + this.variantNames.put(Item.getItemFromBlock(Blocks.oak_fence_gate), Lists.newArrayList(new String[] {"oak_fence_gate"})); + 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"})); ++ for (Entry, Set> e : customVariantNames.entrySet()) ++ { ++ this.variantNames.put(e.getKey().get(), Lists.newArrayList(e.getValue().iterator())); ++ } + } + + protected List getVariantNames(Item p_177596_1_) +@@ -455,6 +461,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)).setTexture(textureatlassprite); + +@@ -481,6 +492,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); + } + +@@ -725,4 +741,19 @@ + MODEL_CLOCK.name = "class generation marker"; + MODEL_ENTITY.name = "block entity marker"; + } ++ ++ /*********************************************************** ++ * FML Start ++ ***********************************************************/ ++ private static Map, Set> customVariantNames = Maps.newHashMap(); ++ public static void addVariantName(Item item, String... names) ++ { ++ if (customVariantNames.containsKey(item.delegate)) ++ customVariantNames.get(item.delegate).addAll(Lists.newArrayList(names)); ++ else ++ customVariantNames.put(item.delegate, Sets.newHashSet(names)); ++ } ++ /*********************************************************** ++ * FML End ++ ***********************************************************/ + } diff --git a/patches/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch b/patches/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch new file mode 100644 index 0000000000..cdc1701f2a --- /dev/null +++ b/patches/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/client/resources/model/ModelManager.java ++++ ../src-work/minecraft/net/minecraft/client/resources/model/ModelManager.java +@@ -25,9 +25,10 @@ + + public void onResourceManagerReload(IResourceManager resourceManager) + { +- ModelBakery modelbakery = new ModelBakery(resourceManager, this.texMap, this.modelProvider); ++ ModelBakery modelbakery = 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/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch b/patches/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch new file mode 100644 index 0000000000..b32056ee84 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch @@ -0,0 +1,21 @@ +--- ../src-base/minecraft/net/minecraft/client/resources/model/ModelRotation.java ++++ ../src-work/minecraft/net/minecraft/client/resources/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), +@@ -117,4 +117,9 @@ + mapRotations.put(Integer.valueOf(modelrotation.combinedXY), modelrotation); + } + } ++ ++ public net.minecraftforge.client.model.TRSRTransformation apply(net.minecraftforge.client.model.IModelPart part) { return new net.minecraftforge.client.model.TRSRTransformation(getMatrix()); } ++ 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/minecraft/net/minecraft/client/settings/GameSettings.java.patch b/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch new file mode 100644 index 0000000000..8255b2b575 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/settings/GameSettings.java ++++ ../src-work/minecraft/net/minecraft/client/settings/GameSettings.java +@@ -983,6 +983,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/minecraft/net/minecraft/client/shader/Framebuffer.java.patch b/patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch new file mode 100644 index 0000000000..c8627e9df4 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch @@ -0,0 +1,57 @@ +--- ../src-base/minecraft/net/minecraft/client/shader/Framebuffer.java ++++ ../src-work/minecraft/net/minecraft/client/shader/Framebuffer.java +@@ -120,8 +120,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(); +@@ -281,4 +290,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/minecraft/net/minecraft/command/CommandEnchant.java.patch b/patches/minecraft/net/minecraft/command/CommandEnchant.java.patch new file mode 100644 index 0000000000..d321160922 --- /dev/null +++ b/patches/minecraft/net/minecraft/command/CommandEnchant.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/command/CommandEnchant.java ++++ ../src-work/minecraft/net/minecraft/command/CommandEnchant.java +@@ -95,7 +95,7 @@ + { + Enchantment enchantment2 = Enchantment.getEnchantmentById(l); + +- if (!enchantment2.canApplyTogether(enchantment1)) ++ if (!enchantment2.canApplyTogether(enchantment1) || !enchantment1.canApplyTogether(enchantment2)) //Forge BugFix: Let Both enchantments veto being together + { + throw new CommandException("commands.enchant.cantCombine", new Object[] {enchantment1.getTranslatedName(j), enchantment2.getTranslatedName(nbttaglist.getCompoundTagAt(k).getShort("lvl"))}); + } diff --git a/patches/minecraft/net/minecraft/command/CommandFill.java.patch b/patches/minecraft/net/minecraft/command/CommandFill.java.patch new file mode 100644 index 0000000000..8e20f92353 --- /dev/null +++ b/patches/minecraft/net/minecraft/command/CommandFill.java.patch @@ -0,0 +1,28 @@ +--- ../src-base/minecraft/net/minecraft/command/CommandFill.java ++++ ../src-work/minecraft/net/minecraft/command/CommandFill.java +@@ -50,6 +50,7 @@ + { + i = parseInt(args[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 (args.length >= 10 && block.hasTileEntity()) ++ if (args.length >= 10 && block.hasTileEntity(state)) + { + String s = getChatComponentFromNthArg(sender, args, 9).getUnformattedText(); + +@@ -118,7 +119,7 @@ + continue; + } + } +- else if (args[8].equals("replace") && !block.hasTileEntity()) ++ else if (args[8].equals("replace") && !block.hasTileEntity(state)) + { + if (args.length > 9) + { diff --git a/patches/minecraft/net/minecraft/command/CommandHandler.java.patch b/patches/minecraft/net/minecraft/command/CommandHandler.java.patch new file mode 100644 index 0000000000..5f0607c6e5 --- /dev/null +++ b/patches/minecraft/net/minecraft/command/CommandHandler.java.patch @@ -0,0 +1,19 @@ +--- ../src-base/minecraft/net/minecraft/command/CommandHandler.java ++++ ../src-work/minecraft/net/minecraft/command/CommandHandler.java +@@ -45,6 +45,16 @@ + } + else if (icommand.canCommandSenderUse(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 = PlayerSelector.matchEntities(sender, astring[i], Entity.class); diff --git a/patches/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch b/patches/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch new file mode 100644 index 0000000000..44ccb62901 --- /dev/null +++ b/patches/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch @@ -0,0 +1,20 @@ +--- ../src-base/minecraft/net/minecraft/command/server/CommandSetBlock.java ++++ ../src-work/minecraft/net/minecraft/command/server/CommandSetBlock.java +@@ -54,6 +54,8 @@ + i = parseInt(args[4], 0, 15); + } + ++ IBlockState state = block.getStateFromMeta(i); ++ + World world = sender.getEntityWorld(); + + if (!world.isBlockLoaded(blockpos)) +@@ -65,7 +67,7 @@ + NBTTagCompound nbttagcompound = new NBTTagCompound(); + boolean flag = false; + +- if (args.length >= 7 && block.hasTileEntity()) ++ if (args.length >= 7 && block.hasTileEntity(state)) + { + String s = getChatComponentFromNthArg(sender, args, 6).getUnformattedText(); + diff --git a/patches/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch b/patches/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch new file mode 100644 index 0000000000..69ac8d5849 --- /dev/null +++ b/patches/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch @@ -0,0 +1,11 @@ +--- ../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 (args.length >= 6 && block.hasTileEntity()) ++ if (args.length >= 6 && block.hasTileEntity(block.getStateFromMeta(i))) + { + String s = getChatComponentFromNthArg(sender, args, 5).getUnformattedText(); + diff --git a/patches/minecraft/net/minecraft/crash/CrashReport.java.patch b/patches/minecraft/net/minecraft/crash/CrashReport.java.patch new file mode 100644 index 0000000000..60537445f2 --- /dev/null +++ b/patches/minecraft/net/minecraft/crash/CrashReport.java.patch @@ -0,0 +1,19 @@ +--- ../src-base/minecraft/net/minecraft/crash/CrashReport.java ++++ ../src-work/minecraft/net/minecraft/crash/CrashReport.java +@@ -123,6 +123,7 @@ + return IntCache.getCacheSizes(); + } + }); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().enhanceCrashReport(this, this.theReportCategory); + } + + public String getDescription() +@@ -211,6 +212,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/minecraft/net/minecraft/crash/CrashReportCategory.java.patch b/patches/minecraft/net/minecraft/crash/CrashReportCategory.java.patch new file mode 100644 index 0000000000..6df8dd8097 --- /dev/null +++ b/patches/minecraft/net/minecraft/crash/CrashReportCategory.java.patch @@ -0,0 +1,16 @@ +--- ../src-base/minecraft/net/minecraft/crash/CrashReportCategory.java ++++ ../src-work/minecraft/net/minecraft/crash/CrashReportCategory.java +@@ -118,8 +118,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/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch b/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch new file mode 100644 index 0000000000..a9a51a63f9 --- /dev/null +++ b/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch @@ -0,0 +1,106 @@ +--- ../src-base/minecraft/net/minecraft/creativetab/CreativeTabs.java ++++ ../src-work/minecraft/net/minecraft/creativetab/CreativeTabs.java +@@ -138,8 +138,22 @@ + private ItemStack iconItemStack; + private static final String __OBFID = "CL_00000005"; + ++ 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; +@@ -222,12 +236,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; + } + +@@ -269,10 +291,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) +@@ -305,4 +334,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/minecraft/net/minecraft/enchantment/Enchantment.java.patch b/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch new file mode 100644 index 0000000000..a8e5b3f388 --- /dev/null +++ b/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/enchantment/Enchantment.java ++++ ../src-work/minecraft/net/minecraft/enchantment/Enchantment.java +@@ -62,7 +62,7 @@ + + if (enchantmentsList[enchID] != null) + { +- throw new IllegalArgumentException("Duplicate enchantment id!"); ++ throw new IllegalArgumentException("Duplicate enchantment id! " + this.getClass() + " and " + enchantmentsList[enchID].getClass() + " Enchantment ID:" + enchID); + } + else + { diff --git a/patches/minecraft/net/minecraft/entity/Entity.java.patch b/patches/minecraft/net/minecraft/entity/Entity.java.patch new file mode 100644 index 0000000000..befb40446d --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/Entity.java.patch @@ -0,0 +1,312 @@ +--- ../src-base/minecraft/net/minecraft/entity/Entity.java ++++ ../src-work/minecraft/net/minecraft/entity/Entity.java +@@ -130,6 +130,14 @@ + private final CommandResultStats cmdResultStats; + private static final String __OBFID = "CL_00001533"; + ++ /** 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 UUID persistentID; ++ ++ protected java.util.HashMap extendedProperties = new java.util.HashMap(); ++ + public int getEntityId() + { + return this.entityId; +@@ -173,6 +181,8 @@ + this.dataWatcher.addObject(2, ""); + this.dataWatcher.addObject(4, Byte.valueOf((byte)0)); + this.entityInit(); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EntityConstructing(this)); ++ for (net.minecraftforge.common.IExtendedEntityProperties props : extendedProperties.values()) props.init(this, worldIn); + } + + protected abstract void entityInit(); +@@ -999,10 +1009,7 @@ + + if (block.getMaterial() == 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 + { +@@ -1357,6 +1364,21 @@ + tagCompund.setBoolean("Silent", this.isSilent()); + } + ++ if (customEntityData != null) tagCompund.setTag("ForgeData", customEntityData); ++ for (String identifier : this.extendedProperties.keySet()) ++ { ++ try ++ { ++ net.minecraftforge.common.IExtendedEntityProperties props = this.extendedProperties.get(identifier); ++ props.saveNBTData(tagCompund); ++ } ++ catch (Throwable t) ++ { ++ net.minecraftforge.fml.common.FMLLog.severe("Failed to save extended properties for %s. This is a mod issue.", identifier); ++ t.printStackTrace(); ++ } ++ } ++ + this.writeEntityToNBT(tagCompund); + + if (this.ridingEntity != null) +@@ -1439,6 +1461,28 @@ + this.setAlwaysRenderNameTag(tagCompund.getBoolean("CustomNameVisible")); + this.cmdResultStats.func_179668_a(tagCompund); + this.setSilent(tagCompund.getBoolean("Silent")); ++ ++ if (tagCompund.hasKey("ForgeData")) customEntityData = tagCompund.getCompoundTag("ForgeData"); ++ for (String identifier : this.extendedProperties.keySet()) ++ { ++ try ++ { ++ net.minecraftforge.common.IExtendedEntityProperties props = this.extendedProperties.get(identifier); ++ props.loadNBTData(tagCompund); ++ } ++ catch (Throwable t) ++ { ++ net.minecraftforge.fml.common.FMLLog.severe("Failed to load extended properties for %s. This is a mod issue.", identifier); ++ t.printStackTrace(); ++ } ++ } ++ ++ //Rawr, legacy code, Vanilla added a UUID, keep this so older maps will convert properly ++ if (tagCompund.hasKey("PersistentIDMSB") && tagCompund.hasKey("PersistentIDLSB")) ++ { ++ this.entityUniqueID = new UUID(tagCompund.getLong("PersistentIDMSB"), tagCompund.getLong("PersistentIDLSB")); ++ } ++ + this.readEntityFromNBT(tagCompund); + + if (this.shouldSetPosAfterLoading()) +@@ -1513,7 +1557,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 +@@ -1656,6 +1703,7 @@ + + public void mountEntity(Entity entityIn) + { ++ if(!(this instanceof EntityLivingBase) && !net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, entityIn, true)){ return; } + this.entityRiderPitchDelta = 0.0D; + this.entityRiderYawDelta = 0.0D; + +@@ -1790,7 +1838,7 @@ + + public boolean isRiding() + { +- return this.ridingEntity != null; ++ return this.ridingEntity != null && ridingEntity.shouldRiderSit(); + } + + public boolean isSneaking() +@@ -2093,7 +2141,7 @@ + + public float getExplosionResistance(Explosion p_180428_1_, World worldIn, BlockPos p_180428_3_, IBlockState p_180428_4_) + { +- return p_180428_4_.getBlock().getExplosionResistance(this); ++ return p_180428_4_.getBlock().getExplosionResistance(worldIn, p_180428_3_.add(0, getEyeHeight(), 0), this, p_180428_1_); + } + + public boolean func_174816_a(Explosion p_174816_1_, World worldIn, BlockPos p_174816_3_, IBlockState p_174816_4_, float p_174816_5_) +@@ -2358,4 +2406,184 @@ + + EnchantmentHelper.func_151385_b(p_174815_1_, p_174815_2_); + } ++ ++ /* ================================== 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(MovingObjectPosition 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(net.minecraft.init.Items.boat); ++ } ++ else if (this instanceof net.minecraft.entity.item.EntityArmorStand) ++ { ++ return new ItemStack(net.minecraft.init.Items.armor_stand); ++ } ++ else ++ { ++ int id = EntityList.getEntityID(this); ++ if (id > 0 && EntityList.entityEggs.containsKey(id)) ++ { ++ return new ItemStack(net.minecraft.init.Items.spawn_egg, 1, id); ++ } ++ String name = EntityList.getEntityString(this); ++ if (name != null && net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().containsKey(name)) ++ { ++ ItemStack stack = new ItemStack(net.minecraft.init.Items.spawn_egg); ++ stack.setTagInfo("entity_name", new net.minecraft.nbt.NBTTagString(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()); ++ } ++ ++ /** ++ * Register the instance of IExtendedProperties into the entity's collection. ++ * @param identifier The identifier which you can use to retrieve these properties for the entity. ++ * @param properties The instanceof IExtendedProperties to register ++ * @return The identifier that was used to register the extended properties. Empty String indicates an error. If your requested key already existed, this will return a modified one that is unique. ++ */ ++ public String registerExtendedProperties(String identifier, net.minecraftforge.common.IExtendedEntityProperties properties) ++ { ++ if (identifier == null) ++ { ++ net.minecraftforge.fml.common.FMLLog.warning("Someone is attempting to register extended properties using a null identifier. This is not allowed. Aborting. This may have caused instability."); ++ return ""; ++ } ++ if (properties == null) ++ { ++ net.minecraftforge.fml.common.FMLLog.warning("Someone is attempting to register null extended properties. This is not allowed. Aborting. This may have caused instability."); ++ return ""; ++ } ++ ++ String baseIdentifier = identifier; ++ int identifierModCount = 1; ++ while (this.extendedProperties.containsKey(identifier)) ++ { ++ identifier = String.format("%s%d", baseIdentifier, identifierModCount++); ++ } ++ ++ if (baseIdentifier != identifier) ++ { ++ net.minecraftforge.fml.common.FMLLog.info("An attempt was made to register exended properties using an existing key. The duplicate identifier (%s) has been remapped to %s.", baseIdentifier, identifier); ++ } ++ ++ this.extendedProperties.put(identifier, properties); ++ return identifier; ++ } ++ ++ /** ++ * Gets the extended properties identified by the passed in key ++ * @param identifier The key that identifies the extended properties. ++ * @return The instance of IExtendedProperties that was found, or null. ++ */ ++ public net.minecraftforge.common.IExtendedEntityProperties getExtendedProperties(String identifier) ++ { ++ return this.extendedProperties.get(identifier); ++ } ++ ++ /** ++ * 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; ++ } ++ /* ================================== Forge End =====================================*/ + } diff --git a/patches/minecraft/net/minecraft/entity/EntityHanging.java.patch b/patches/minecraft/net/minecraft/entity/EntityHanging.java.patch new file mode 100644 index 0000000000..a9cab8a70a --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/EntityHanging.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/entity/EntityHanging.java ++++ ../src-work/minecraft/net/minecraft/entity/EntityHanging.java +@@ -124,6 +124,9 @@ + { + BlockPos blockpos1 = blockpos.offset(enumfacing, k).up(l); + Block block = this.worldObj.getBlockState(blockpos1).getBlock(); ++ ++ if ( block.isSideSolid( this.worldObj, blockpos1, this.field_174860_b )) ++ continue; + + if (!block.getMaterial().isSolid() && !BlockRedstoneDiode.isRedstoneRepeaterBlockID(block)) + { diff --git a/patches/minecraft/net/minecraft/entity/EntityList.java.patch b/patches/minecraft/net/minecraft/entity/EntityList.java.patch new file mode 100644 index 0000000000..de360280c0 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/EntityList.java.patch @@ -0,0 +1,56 @@ +--- ../src-base/minecraft/net/minecraft/entity/EntityList.java ++++ ../src-work/minecraft/net/minecraft/entity/EntityList.java +@@ -89,6 +89,7 @@ + + public static void addMapping(Class p_75618_0_, String p_75618_1_, int p_75618_2_) + { ++ if (p_75618_2_ < 0 || p_75618_2_ > 255) throw new IllegalArgumentException("Attempted to register a entity with invalid ID: " + p_75618_2_ + " Name: " + p_75618_1_ + " Class: " + p_75618_0_); + if (stringToClassMapping.containsKey(p_75618_1_)) + { + throw new IllegalArgumentException("ID is already registered: " + p_75618_1_); +@@ -168,7 +169,17 @@ + + if (entity != null) + { ++ try ++ { + entity.readFromNBT(p_75615_0_); ++ } ++ 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", ++ p_75615_0_.getString("id"), oclass.getName()); ++ entity = null; ++ } + } + else + { +@@ -344,7 +355,9 @@ + + public static class EntityEggInfo + { ++ @Deprecated // This is not always a valid number in the global ID list. + public final int spawnedID; ++ public final String name; + public final int primaryColor; + public final int secondaryColor; + public final StatBase field_151512_d; +@@ -358,6 +371,17 @@ + this.secondaryColor = p_i1583_3_; + this.field_151512_d = StatList.getStatKillEntity(this); + this.field_151513_e = StatList.getStatEntityKilledBy(this); ++ this.name = EntityList.getStringFromID(p_i1583_1_); + } ++ ++ public EntityEggInfo(String name, int primaryColor, int secondaryColor) ++ { ++ this.spawnedID = -1; ++ this.name = name; ++ this.primaryColor = primaryColor; ++ this.secondaryColor = secondaryColor; ++ this.field_151512_d = (new StatBase("stat.killEntity." + name, new net.minecraft.util.ChatComponentTranslation("stat.entityKill", new net.minecraft.util.ChatComponentTranslation("entity." + name + ".name")))).registerStat(); ++ this.field_151513_e = (new StatBase("stat.entityKilledBy." + name, new net.minecraft.util.ChatComponentTranslation("stat.entityKilledBy", new net.minecraft.util.ChatComponentTranslation("entity." + name + ".name")))).registerStat(); ++ } + } + } diff --git a/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch b/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch new file mode 100644 index 0000000000..58f9c41d69 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch @@ -0,0 +1,41 @@ +--- ../src-base/minecraft/net/minecraft/entity/EntityLiving.java ++++ ../src-work/minecraft/net/minecraft/entity/EntityLiving.java +@@ -122,6 +122,7 @@ + public void setAttackTarget(EntityLivingBase p_70624_1_) + { + this.attackTarget = p_70624_1_; ++ net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(this, p_70624_1_); + } + + public boolean canAttackClass(Class p_70686_1_) +@@ -499,10 +500,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); +@@ -622,7 +635,6 @@ + return this.worldObj.checkNoEntityCollision(this.getEntityBoundingBox(), this) && this.worldObj.getCollidingBoundingBoxes(this, this.getEntityBoundingBox()).isEmpty() && !this.worldObj.isAnyLiquid(this.getEntityBoundingBox()); + } + +- @SideOnly(Side.CLIENT) + public float getRenderSizeModifier() + { + return 1.0F; diff --git a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch new file mode 100644 index 0000000000..58a52ac434 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch @@ -0,0 +1,185 @@ +--- ../src-base/minecraft/net/minecraft/entity/EntityLivingBase.java ++++ ../src-work/minecraft/net/minecraft/entity/EntityLivingBase.java +@@ -381,6 +381,7 @@ + { + this.entityLivingToAttack = livingBase; + this.revengeTimer = this.ticksExisted; ++ net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(this, livingBase); + } + + public EntityLivingBase getLastAttacker() +@@ -664,7 +665,6 @@ + return this.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD; + } + +- @SideOnly(Side.CLIENT) + public void removePotionEffectClient(int p_70618_1_) + { + this.activePotionsMap.remove(Integer.valueOf(p_70618_1_)); +@@ -733,6 +733,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; +@@ -798,9 +799,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()) + { +@@ -884,6 +885,7 @@ + + public void onDeath(DamageSource cause) + { ++ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, cause)) return; + Entity entity = cause.getEntity(); + EntityLivingBase entitylivingbase = this.func_94060_bK(); + +@@ -909,6 +911,9 @@ + i = EnchantmentHelper.getLootingModifier((EntityLivingBase)entity); + } + ++ captureDrops = true; ++ capturedDrops.clear(); ++ + if (this.func_146066_aG() && this.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot")) + { + this.dropFewItems(this.recentlyHit > 0, i); +@@ -919,6 +924,16 @@ + this.addRandomArmor(); + } + } ++ ++ 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); +@@ -973,7 +988,7 @@ + int j = MathHelper.floor_double(this.getEntityBoundingBox().minY); + int k = MathHelper.floor_double(this.posZ); + Block block = this.worldObj.getBlockState(new BlockPos(i, j, k)).getBlock(); +- return (block == Blocks.ladder || block == Blocks.vine) && (!(this instanceof EntityPlayer) || !((EntityPlayer)this).isSpectator()); ++ return net.minecraftforge.common.ForgeHooks.isLivingOnLadder(block, worldObj, new BlockPos(i, j, k), this); + } + + public boolean isEntityAlive() +@@ -983,6 +998,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(Potion.jump); + float f = potioneffect != null ? (float)(potioneffect.getAmplifier() + 1) : 0.0F; +@@ -1095,6 +1113,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; +@@ -1143,6 +1163,11 @@ + + public void swingItem() + { ++ ItemStack stack = this.getHeldItem(); ++ 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; +@@ -1282,6 +1307,7 @@ + + public void dismountEntity(Entity p_110145_1_) + { ++ if(!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, p_110145_1_, false)){ return; } + double d0 = p_110145_1_.posX; + double d1 = p_110145_1_.getEntityBoundingBox().minY + (double)p_110145_1_.height; + double d2 = p_110145_1_.posZ; +@@ -1347,6 +1373,7 @@ + } + + this.isAirBorne = true; ++ net.minecraftforge.common.ForgeHooks.onLivingJump(this); + } + + protected void updateAITick() +@@ -1531,6 +1558,7 @@ + + public void onUpdate() + { ++ if (net.minecraftforge.common.ForgeHooks.onLivingUpdate(this)) return; + super.onUpdate(); + + if (!this.worldObj.isRemote) +@@ -1819,6 +1847,7 @@ + + public void mountEntity(Entity entityIn) + { ++ if(!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, entityIn, true)){ return; } + if (this.ridingEntity != null && entityIn == null) + { + if (!this.worldObj.isRemote) +@@ -2000,4 +2029,39 @@ + { + 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) ++ { ++ Iterator potionKey = activePotionsMap.keySet().iterator(); ++ if (worldObj.isRemote) return; ++ ++ while (potionKey.hasNext()) ++ { ++ Integer key = potionKey.next(); ++ PotionEffect effect = (PotionEffect)activePotionsMap.get(key); ++ ++ if (effect.isCurativeItem(curativeItem)) ++ { ++ potionKey.remove(); ++ onFinishedPotionEffect(effect); ++ 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; ++ } + } diff --git a/patches/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch b/patches/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch new file mode 100644 index 0000000000..ad187ed629 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java ++++ ../src-work/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java +@@ -111,6 +111,7 @@ + + public boolean interactFirst(EntityPlayer playerIn) + { ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; + this.commandBlockLogic.func_175574_a(playerIn); + return false; + } diff --git a/patches/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch b/patches/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch new file mode 100644 index 0000000000..7ca011b1ce --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch @@ -0,0 +1,15 @@ +--- ../src-base/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java ++++ ../src-work/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java +@@ -45,6 +45,12 @@ + return (EntityLiving.SpawnPlacementType)field_180110_a.get(p_180109_0_); + } + ++ public static void setPlacementType(Class entityClass, EntityLiving.SpawnPlacementType placementType) ++ { ++ if(!field_180110_a.containsKey(entityClass)) ++ field_180110_a.put(entityClass, placementType); ++ } ++ + static + { + field_180110_a.put(EntityBat.class, EntityLiving.SpawnPlacementType.ON_GROUND); diff --git a/patches/minecraft/net/minecraft/entity/EntityTracker.java.patch b/patches/minecraft/net/minecraft/entity/EntityTracker.java.patch new file mode 100644 index 0000000000..3af4d3ae8c --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/EntityTracker.java.patch @@ -0,0 +1,35 @@ +--- ../src-base/minecraft/net/minecraft/entity/EntityTracker.java ++++ ../src-work/minecraft/net/minecraft/entity/EntityTracker.java +@@ -57,6 +57,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); +@@ -333,4 +335,23 @@ + } + } + } ++ ++ /* ======================================== 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 =====================================*/ + } diff --git a/patches/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch b/patches/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch new file mode 100644 index 0000000000..2aaa262454 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch @@ -0,0 +1,42 @@ +--- ../src-base/minecraft/net/minecraft/entity/EntityTrackerEntry.java ++++ ../src-work/minecraft/net/minecraft/entity/EntityTrackerEntry.java +@@ -380,6 +380,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, p_73117_1_, this.encodedPosX, this.encodedPosY, this.encodedPosZ); ++ } ++ + if (this.sendVelocityUpdates && !(packet instanceof S0FPacketSpawnMob)) + { + p_73117_1_.playerNetServerHandler.sendPacket(new S12PacketEntityVelocity(this.trackedEntity.getEntityId(), this.trackedEntity.motionX, this.trackedEntity.motionY, this.trackedEntity.motionZ)); +@@ -427,12 +435,14 @@ + p_73117_1_.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(this.trackedEntity.getEntityId(), potioneffect)); + } + } ++ net.minecraftforge.event.ForgeEventFactory.onStartEntityTracking(trackedEntity, p_73117_1_); + } + } + else if (this.trackingPlayers.contains(p_73117_1_)) + { + this.trackingPlayers.remove(p_73117_1_); + p_73117_1_.func_152339_d(this.trackedEntity); ++ net.minecraftforge.event.ForgeEventFactory.onStopEntityTracking(trackedEntity, p_73117_1_); + } + } + } +@@ -464,6 +474,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 S0EPacketSpawnObject(this.trackedEntity, 2, 1); diff --git a/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch b/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch new file mode 100644 index 0000000000..6060c996e8 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch @@ -0,0 +1,46 @@ +--- ../src-base/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java ++++ ../src-work/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java +@@ -55,6 +55,19 @@ + } + else + { ++ if (canPenalize) ++ { ++ if (--this.field_75445_i <= 0) ++ { ++ this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase); ++ this.field_151497_i = 4 + this.attacker.getRNG().nextInt(7); ++ return this.entityPathEntity != null; ++ } ++ else ++ { ++ return true; ++ } ++ } + this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase); + return this.entityPathEntity != null; + } +@@ -92,6 +105,23 @@ + this.field_151496_k = entitylivingbase.posZ; + this.field_75445_i = 4 + this.attacker.getRNG().nextInt(7); + ++ if (this.canPenalize) ++ { ++ this.field_151497_i += 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.field_75445_i += 10; diff --git a/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch b/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch new file mode 100644 index 0000000000..21f789a2df --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/entity/boss/EntityDragon.java ++++ ../src-work/minecraft/net/minecraft/entity/boss/EntityDragon.java +@@ -480,9 +480,9 @@ + BlockPos blockpos = new BlockPos(k1, l1, i2); + Block block = this.worldObj.getBlockState(blockpos).getBlock(); + +- if (block.getMaterial() != Material.air) ++ if (!block.isAir(worldObj, new BlockPos(k1, l1, i2))) + { +- if (block != Blocks.barrier && block != Blocks.obsidian && block != Blocks.end_stone && block != Blocks.bedrock && block != Blocks.command_block && this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")) ++ if (block.canEntityDestroy(worldObj, new BlockPos(k1, l1, i2), this) && this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")) + { + flag1 = this.worldObj.setBlockToAir(blockpos) || flag1; + } diff --git a/patches/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch b/patches/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch new file mode 100644 index 0000000000..98bf842696 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/entity/boss/IBossDisplayData.java ++++ ../src-work/minecraft/net/minecraft/entity/boss/IBossDisplayData.java +@@ -4,7 +4,6 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +-@SideOnly(Side.CLIENT) + public interface IBossDisplayData + { + float getMaxHealth(); diff --git a/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch b/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch new file mode 100644 index 0000000000..124b743a54 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java ++++ ../src-work/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java +@@ -91,7 +91,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/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch new file mode 100644 index 0000000000..b8fbabec6a --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch @@ -0,0 +1,25 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityEnderPearl.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityEnderPearl.java +@@ -62,6 +62,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().getGameRuleBooleanValue("doMobSpawning")) + { + EntityEndermite entityendermite = new EntityEndermite(this.worldObj); +@@ -75,9 +78,10 @@ + entitylivingbase.mountEntity((Entity)null); + } + +- 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/minecraft/net/minecraft/entity/item/EntityItem.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch new file mode 100644 index 0000000000..d968e63eac --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch @@ -0,0 +1,94 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityItem.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityItem.java +@@ -30,6 +30,11 @@ + public float hoverStart; + private static final String __OBFID = "CL_00001669"; + ++ /** ++ * 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); +@@ -47,6 +52,7 @@ + { + this(worldIn, x, y, z); + this.setEntityItemStack(stack); ++ this.lifespan = (stack.getItem() == null ? 6000 : stack.getItem().getEntityLifespan(stack, worldIn)); + } + + protected boolean canTriggerWalking() +@@ -70,6 +76,8 @@ + + public void onUpdate() + { ++ ItemStack stack = this.getDataWatcher().getWatchableObjectItemStack(10); ++ if (stack != null && stack.getItem() != null && stack.getItem().onEntityItemUpdate(this)) return; + if (this.getEntityItem() == null) + { + this.setDead(); +@@ -130,8 +138,16 @@ + + this.handleWaterMovement(); + +- if (!this.worldObj.isRemote && this.age >= 6000) ++ ItemStack item = getDataWatcher().getWatchableObjectItemStack(10); ++ ++ 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(); + } + } +@@ -272,6 +288,7 @@ + tagCompound.setShort("Health", (short)((byte)this.health)); + tagCompound.setShort("Age", (short)this.age); + tagCompound.setShort("PickupDelay", (short)this.delayBeforeCanPickup); ++ tagCompound.setInteger("Lifespan", lifespan); + + if (this.getThrower() != null) + { +@@ -312,20 +329,23 @@ + NBTTagCompound nbttagcompound = tagCompund.getCompoundTag("Item"); + this.setEntityItemStack(ItemStack.loadItemStackFromNBT(nbttagcompound)); + +- if (this.getEntityItem() == null) +- { +- this.setDead(); +- } ++ ItemStack item = getDataWatcher().getWatchableObjectItemStack(10); ++ 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)) + { +@@ -362,6 +382,7 @@ + } + } + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerItemPickupEvent(entityIn, this); + if (!this.isSilent()) + { + this.worldObj.playSoundAtEntity(entityIn, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); diff --git a/patches/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch new file mode 100644 index 0000000000..3b105563fa --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityItemFrame.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityItemFrame.java +@@ -123,7 +123,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.playersVisibleOnMap.remove("frame-" + this.getEntityId()); diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch new file mode 100644 index 0000000000..b63ce43874 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch @@ -0,0 +1,389 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecart.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecart.java +@@ -51,6 +51,20 @@ + private double velocityZ; + private static final String __OBFID = "CL_00001670"; + ++ /* 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); +@@ -96,17 +110,19 @@ + + public AxisAlignedBB getCollisionBox(Entity entityIn) + { ++ if (getCollisionHandler() != null) return getCollisionHandler().getCollisionBox(this, entityIn); + return entityIn.canBePushed() ? entityIn.getEntityBoundingBox() : null; + } + + public AxisAlignedBB getBoundingBox() + { ++ if (getCollisionHandler() != null) return getCollisionHandler().getBoundingBox(this); + return null; + } + + public boolean canBePushed() + { +- return true; ++ return canBePushed; + } + + public EntityMinecart(World worldIn, double p_i1713_2_, double p_i1713_4_, double p_i1713_6_) +@@ -310,7 +326,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); + +@@ -368,6 +384,7 @@ + } + + this.handleWaterMovement(); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartUpdateEvent(this, this.getCurrentRailPosition())); + } + } + +@@ -382,10 +399,21 @@ + + protected void moveDerailedMinecart() + { +- double d0 = this.func_174898_m(); ++ double d0 = onGround ? this.func_174898_m() : 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; +@@ -393,13 +421,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(); + } + } + +@@ -482,7 +510,7 @@ + } + } + +- if (flag1) ++ if (flag1 && shouldDoRailFunctions()) + { + double d17 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); + +@@ -578,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) +@@ -818,13 +852,20 @@ + + 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 (entityIn != this.riddenByEntity) + { +- if (entityIn instanceof EntityLivingBase && !(entityIn instanceof EntityPlayer) && !(entityIn instanceof EntityIronGolem) && this.getMinecartType() == EntityMinecart.EnumMinecartType.RIDEABLE && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && this.riddenByEntity == null && entityIn.ridingEntity == null) ++ if (entityIn instanceof EntityLivingBase && !(entityIn instanceof EntityPlayer) && !(entityIn instanceof EntityIronGolem) && canBeRidden() && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && this.riddenByEntity == null && entityIn.ridingEntity == null) + { + entityIn.mountEntity(this); + } +@@ -870,7 +911,7 @@ + double d7 = entityIn.motionX + this.motionX; + double d8 = entityIn.motionZ + this.motionZ; + +- if (((EntityMinecart)entityIn).getMinecartType() == EntityMinecart.EnumMinecartType.FURNACE && this.getMinecartType() != EntityMinecart.EnumMinecartType.FURNACE) ++ if (((EntityMinecart)entityIn).isPoweredCart() && !isPoweredCart()) + { + this.motionX *= 0.20000000298023224D; + this.motionZ *= 0.20000000298023224D; +@@ -878,7 +919,7 @@ + entityIn.motionX *= 0.949999988079071D; + entityIn.motionZ *= 0.949999988079071D; + } +- else if (((EntityMinecart)entityIn).getMinecartType() != EntityMinecart.EnumMinecartType.FURNACE && this.getMinecartType() == EntityMinecart.EnumMinecartType.FURNACE) ++ else if (((EntityMinecart)entityIn).isPoweredCart() && isPoweredCart()) + { + entityIn.motionX *= 0.20000000298023224D; + entityIn.motionZ *= 0.20000000298023224D; +@@ -1043,6 +1084,221 @@ + } + } + ++ /* =================================== 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 func_174898_m(); ++ BlockPos pos = this.getCurrentRailPosition(); ++ IBlockState state = this.worldObj.getBlockState(pos); ++ if (!BlockRailBase.isRailBlock(state)) return func_174898_m(); ++ ++ 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.riddenByEntity != 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 getMinecartType() == EntityMinecart.EnumMinecartType.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.getMinecartType() == EntityMinecart.EnumMinecartType.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 EnumMinecartType + { + RIDEABLE(0, "MinecartRideable"), diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch new file mode 100644 index 0000000000..eac3dfcbde --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java +@@ -181,6 +181,7 @@ + + public boolean interactFirst(EntityPlayer playerIn) + { ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; + if (!this.worldObj.isRemote) + { + playerIn.displayGUIChest(this); diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch new file mode 100644 index 0000000000..729dcfd0ae --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java +@@ -20,6 +20,7 @@ + + public boolean interactFirst(EntityPlayer playerIn) + { ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; + if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != playerIn) + { + return true; diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch new file mode 100644 index 0000000000..46cb9f9303 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java +@@ -132,6 +132,7 @@ + + public boolean interactFirst(EntityPlayer playerIn) + { ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; + ItemStack itemstack = playerIn.inventory.getCurrentItem(); + + if (itemstack != null && itemstack.getItem() == Items.coal) diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch new file mode 100644 index 0000000000..9b0750816c --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java +@@ -55,6 +55,7 @@ + + public boolean interactFirst(EntityPlayer playerIn) + { ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; + if (!this.worldObj.isRemote) + { + playerIn.displayGUIChest(this); diff --git a/patches/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch new file mode 100644 index 0000000000..8b2d12c335 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityXPOrb.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityXPOrb.java +@@ -200,6 +200,7 @@ + { + if (this.field_70532_c == 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.playSoundAtEntity(entityIn, "random.orb", 0.1F, 0.5F * ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.8F)); + entityIn.onItemPickup(this, 1); diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch new file mode 100644 index 0000000000..148ad918a8 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch @@ -0,0 +1,21 @@ +--- ../src-base/minecraft/net/minecraft/entity/monster/EntityEnderman.java ++++ ../src-work/minecraft/net/minecraft/entity/monster/EntityEnderman.java +@@ -366,6 +366,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 this.dataWatcher.getWatchableObjectByte(18) > 0; diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch new file mode 100644 index 0000000000..b68b510e82 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java ++++ ../src-work/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java +@@ -105,6 +105,7 @@ + { + this.motionY = (double)(0.42F + (float)this.getSlimeSize() * 0.1F); + this.isAirBorne = true; ++ net.minecraftforge.common.ForgeHooks.onLivingJump(this); + } + + protected void func_180466_bG() diff --git a/patches/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch new file mode 100644 index 0000000000..9a88af07bc --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/entity/monster/EntitySlime.java ++++ ../src-work/minecraft/net/minecraft/entity/monster/EntitySlime.java +@@ -272,7 +272,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; + } diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch new file mode 100644 index 0000000000..f145665638 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch @@ -0,0 +1,51 @@ +--- ../src-base/minecraft/net/minecraft/entity/monster/EntityZombie.java ++++ ../src-work/minecraft/net/minecraft/entity/monster/EntityZombie.java +@@ -88,7 +88,7 @@ + this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(35.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23000000417232513D); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.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() +@@ -230,12 +230,25 @@ + entitylivingbase = (EntityLivingBase)source.getEntity(); + } + +- if (entitylivingbase != null && this.worldObj.getDifficulty() == EnumDifficulty.HARD && (double)this.rand.nextFloat() < this.getEntityAttribute(reinforcementChance).getAttributeValue()) ++ 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()) + { +- 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) + { +@@ -250,7 +263,7 @@ + if (!this.worldObj.func_175636_b((double)i1, (double)j1, (double)k1, 7.0D) && this.worldObj.checkNoEntityCollision(entityzombie.getEntityBoundingBox(), entityzombie) && this.worldObj.getCollidingBoundingBoxes(entityzombie, entityzombie.getEntityBoundingBox()).isEmpty() && !this.worldObj.isAnyLiquid(entityzombie.getEntityBoundingBox())) + { + this.worldObj.spawnEntityInWorld(entityzombie); +- entityzombie.setAttackTarget(entitylivingbase); ++ if (entitylivingbase != null) entityzombie.setAttackTarget(entitylivingbase); + entityzombie.func_180482_a(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)); diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch new file mode 100644 index 0000000000..797d03d7d0 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/entity/passive/EntityHorse.java ++++ ../src-work/minecraft/net/minecraft/entity/passive/EntityHorse.java +@@ -1249,6 +1249,7 @@ + } + + this.jumpPower = 0.0F; ++ net.minecraftforge.common.ForgeHooks.onLivingJump(this); + } + + this.stepHeight = 1.0F; diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch new file mode 100644 index 0000000000..f6bdbce108 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch @@ -0,0 +1,62 @@ +--- ../src-base/minecraft/net/minecraft/entity/passive/EntityMooshroom.java ++++ ../src-work/minecraft/net/minecraft/entity/passive/EntityMooshroom.java +@@ -9,7 +9,7 @@ + import net.minecraft.util.EnumParticleTypes; + import net.minecraft.world.World; + +-public class EntityMooshroom extends EntityCow ++public class EntityMooshroom extends EntityCow implements net.minecraftforge.common.IShearable + { + private static final String __OBFID = "CL_00001645"; + +@@ -20,6 +20,7 @@ + this.field_175506_bl = Blocks.mycelium; + } + ++ @SuppressWarnings("unused") + public boolean interact(EntityPlayer player) + { + ItemStack itemstack = player.inventory.getCurrentItem(); +@@ -39,7 +40,7 @@ + } + } + +- if (itemstack != null && itemstack.getItem() == Items.shears && this.getGrowingAge() >= 0) ++ if (false && itemstack != null && itemstack.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]); +@@ -79,4 +80,33 @@ + { + return new EntityMooshroom(this.worldObj); + } ++ ++ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.BlockPos pos){ return getGrowingAge() >= 0; } ++ @Override ++ public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.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.playSound("mob.sheep.shear", 1.0F, 1.0F); ++ return ret; ++ } + } diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch new file mode 100644 index 0000000000..993f395186 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/entity/passive/EntityOcelot.java ++++ ../src-work/minecraft/net/minecraft/entity/passive/EntityOcelot.java +@@ -280,7 +280,7 @@ + + Block block = this.worldObj.getBlockState(blockpos.down()).getBlock(); + +- if (block == Blocks.grass || block.getMaterial() == Material.leaves) ++ if (block == Blocks.grass || block.isLeaves(worldObj, blockpos.down())) + { + return true; + } diff --git a/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch new file mode 100644 index 0000000000..11dac94884 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch @@ -0,0 +1,45 @@ +--- ../src-base/minecraft/net/minecraft/entity/passive/EntitySheep.java ++++ ../src-work/minecraft/net/minecraft/entity/passive/EntitySheep.java +@@ -35,7 +35,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 final InventoryCrafting inventoryCrafting = new InventoryCrafting(new Container() + { +@@ -142,11 +142,12 @@ + } + } + ++ @SuppressWarnings("unused") + public boolean interact(EntityPlayer player) + { + ItemStack itemstack = player.inventory.getCurrentItem(); + +- if (itemstack != null && itemstack.getItem() == Items.shears && !this.getSheared() && !this.isChild()) ++ if (false && itemstack != null && itemstack.getItem() == Items.shears && !this.getSheared() && !this.isChild()) //Forge: Moved to onSheared + { + if (!this.worldObj.isRemote) + { +@@ -329,4 +330,19 @@ + field_175514_bm.put(EnumDyeColor.RED, new float[] {0.6F, 0.2F, 0.2F}); + field_175514_bm.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.playSound("mob.sheep.shear", 1.0F, 1.0F); ++ return ret; ++ } + } diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch new file mode 100644 index 0000000000..201f72c944 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch @@ -0,0 +1,36 @@ +--- ../src-base/minecraft/net/minecraft/entity/passive/EntityVillager.java ++++ ../src-work/minecraft/net/minecraft/entity/passive/EntityVillager.java +@@ -81,6 +81,7 @@ + private boolean isLookingForHome; + private boolean field_175564_by; + 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), 1, 0), 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_eye, new EntityVillager.PriceInfo(7, 11)), 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))}}}}; + private static final String __OBFID = "CL_00001707"; + +@@ -211,7 +212,7 @@ + ItemStack itemstack = player.inventory.getCurrentItem(); + boolean flag = itemstack != null && itemstack.getItem() == Items.spawn_egg; + +- if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild()) ++ if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild() && !player.isSneaking()) + { + if (!this.worldObj.isRemote && (this.buyingList == null || this.buyingList.size() > 0)) + { +@@ -636,6 +637,7 @@ + } + } + ++ //TODO: Hook into VillagerRegistry to get name + if (s1 != null) + { + ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("entity.Villager." + s1, new Object[0]); +@@ -698,7 +700,7 @@ + public IEntityLivingData func_180482_a(DifficultyInstance p_180482_1_, IEntityLivingData p_180482_2_) + { + p_180482_2_ = super.func_180482_a(p_180482_1_, p_180482_2_); +- this.setProfession(this.worldObj.rand.nextInt(5)); ++ net.minecraftforge.fml.common.registry.VillagerRegistry.setRandomProfession(this, this.worldObj.rand); + this.func_175552_ct(); + return p_180482_2_; + } diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch new file mode 100644 index 0000000000..dd00fa8f14 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch @@ -0,0 +1,66 @@ +--- ../src-base/minecraft/net/minecraft/entity/player/EntityPlayerMP.java ++++ ../src-work/minecraft/net/minecraft/entity/player/EntityPlayerMP.java +@@ -124,14 +124,15 @@ + public boolean playerConqueredTheEnd; + private static final String __OBFID = "CL_00001440"; + ++ @SuppressWarnings("unused") + public EntityPlayerMP(MinecraftServer server, WorldServer worldIn, GameProfile profile, ItemInWorldManager 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(5, server.getSpawnProtectionSize() - 6); + int j = MathHelper.floor_double(worldIn.getWorldBorder().getClosestDistance((double)blockpos.getX(), (double)blockpos.getZ())); +@@ -224,7 +225,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; +@@ -425,6 +426,7 @@ + + public void onDeath(DamageSource cause) + { ++ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, cause)) return; + if (this.worldObj.getGameRules().getGameRuleBooleanValue("showDeathMessages")) + { + Team team = this.getTeam(); +@@ -448,7 +450,20 @@ + + if (!this.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory")) + { ++ 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) ++ { ++ joinEntityItemWithWorld(item); ++ } ++ } + } + + for (ScoreObjective scoreobjective : this.worldObj.getScoreboard().getObjectivesFromCriteria(IScoreObjectiveCriteria.deathCount)) +@@ -832,6 +847,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.func_150871_b(this, stat, amount); + + for (ScoreObjective scoreobjective : this.getWorldScoreboard().getObjectivesFromCriteria(stat.func_150952_k())) diff --git a/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch new file mode 100644 index 0000000000..ac3aca4d5d --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch @@ -0,0 +1,17 @@ +--- ../src-base/minecraft/net/minecraft/entity/player/InventoryPlayer.java ++++ ../src-work/minecraft/net/minecraft/entity/player/InventoryPlayer.java +@@ -316,6 +316,14 @@ + this.mainInventory[i].updateAnimation(this.player.worldObj, this.player, i, this.currentItem == i); + } + } ++ ++ for (int i = 0; i < armorInventory.length; i++) ++ { ++ if (armorInventory[i] != null) ++ { ++ armorInventory[i].getItem().onArmorTick(player.worldObj, player, armorInventory[i]); ++ } ++ } + } + + public boolean consumeInventoryItem(Item p_146026_1_) diff --git a/patches/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch b/patches/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch new file mode 100644 index 0000000000..7f66e993b1 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch @@ -0,0 +1,22 @@ +--- ../src-base/minecraft/net/minecraft/entity/projectile/EntityFishHook.java ++++ ../src-work/minecraft/net/minecraft/entity/projectile/EntityFishHook.java +@@ -568,11 +568,19 @@ + } + } + ++ @SuppressWarnings("unused") + private ItemStack getFishingResult() + { + float f = this.worldObj.rand.nextFloat(); + int i = EnchantmentHelper.getLuckOfSeaModifier(this.angler); + int j = EnchantmentHelper.getLureModifier(this.angler); ++ ++ if (true) ++ { ++ this.angler.addStat(net.minecraftforge.common.FishingHooks.getFishableCategory(f, i, j).stat, 1); ++ return net.minecraftforge.common.FishingHooks.getRandomFishable(this.rand, f, i, j); ++ } ++ + float f1 = 0.1F - (float)i * 0.025F - (float)j * 0.01F; + float f2 = 0.05F + (float)i * 0.01F - (float)j * 0.01F; + f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); diff --git a/patches/minecraft/net/minecraft/init/Bootstrap.java.patch b/patches/minecraft/net/minecraft/init/Bootstrap.java.patch new file mode 100644 index 0000000000..5e3c960372 --- /dev/null +++ b/patches/minecraft/net/minecraft/init/Bootstrap.java.patch @@ -0,0 +1,19 @@ +--- ../src-base/minecraft/net/minecraft/init/Bootstrap.java ++++ ../src-work/minecraft/net/minecraft/init/Bootstrap.java +@@ -66,6 +66,7 @@ + return alreadyRegistered; + } + ++ @SuppressWarnings("unused") + static void registerDispenserBehaviors() + { + BlockDispenser.dispenseBehaviorRegistry.putObject(Items.arrow, new BehaviorProjectileDispense() +@@ -143,7 +144,7 @@ + double d0 = source.getX() + (double)enumfacing.getFrontOffsetX(); + double d1 = (double)((float)source.getBlockPos().getY() + 0.2F); + double d2 = source.getZ() + (double)enumfacing.getFrontOffsetZ(); +- Entity entity = ItemMonsterPlacer.spawnCreature(source.getWorld(), stack.getMetadata(), d0, d1, d2); ++ Entity entity = ItemMonsterPlacer.spawnCreature(source.getWorld(), ItemMonsterPlacer.getEntityName(stack), d0, d1, d2); + + if (entity instanceof EntityLivingBase && stack.hasDisplayName()) + { diff --git a/patches/minecraft/net/minecraft/inventory/Container.java.patch b/patches/minecraft/net/minecraft/inventory/Container.java.patch new file mode 100644 index 0000000000..a588231efa --- /dev/null +++ b/patches/minecraft/net/minecraft/inventory/Container.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/inventory/Container.java ++++ ../src-work/minecraft/net/minecraft/inventory/Container.java +@@ -609,7 +609,7 @@ + Slot slot1 = (Slot)this.inventorySlots.get(i); + ItemStack itemstack1 = slot1.getStack(); + +- if (itemstack1 == null) ++ if (itemstack1 == null && slot.isItemValid(stack)) // Forge: Make sure to respect isItemValid in the slot. + { + slot1.putStack(stack.copy()); + slot1.onSlotChanged(); diff --git a/patches/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch new file mode 100644 index 0000000000..ddd38b3221 --- /dev/null +++ b/patches/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/inventory/ContainerBeacon.java ++++ ../src-work/minecraft/net/minecraft/inventory/ContainerBeacon.java +@@ -146,7 +146,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/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch new file mode 100644 index 0000000000..1e81b6f651 --- /dev/null +++ b/patches/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch @@ -0,0 +1,29 @@ +--- ../src-base/minecraft/net/minecraft/inventory/ContainerBrewingStand.java ++++ ../src-work/minecraft/net/minecraft/inventory/ContainerBrewingStand.java +@@ -157,7 +157,7 @@ + + public boolean isItemValid(ItemStack stack) + { +- return stack != null ? stack.getItem().isPotionIngredient(stack) : false; ++ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(stack); + } + + public int getSlotStackLimit() +@@ -189,7 +189,7 @@ + + public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack) + { +- if (stack.getItem() == Items.potionitem && stack.getMetadata() > 0) ++ if (stack.getItem() instanceof net.minecraft.item.ItemPotion && stack.getMetadata() > 0) + { + this.player.triggerAchievement(AchievementList.potion); + } +@@ -199,7 +199,7 @@ + + public static boolean canHoldPotion(ItemStack p_75243_0_) + { +- return p_75243_0_ != null && (p_75243_0_.getItem() == Items.potionitem || p_75243_0_.getItem() == Items.glass_bottle); ++ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(p_75243_0_); + } + } + } diff --git a/patches/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch new file mode 100644 index 0000000000..35b99f86cb --- /dev/null +++ b/patches/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/inventory/ContainerPlayer.java ++++ ../src-work/minecraft/net/minecraft/inventory/ContainerPlayer.java +@@ -45,7 +45,8 @@ + } + public boolean isItemValid(ItemStack stack) + { +- return stack == null ? false : (stack.getItem() instanceof ItemArmor ? ((ItemArmor)stack.getItem()).armorType == k_f : (stack.getItem() != Item.getItemFromBlock(Blocks.pumpkin) && stack.getItem() != Items.skull ? false : k_f == 0)); ++ if (stack == null) return false; ++ return stack.getItem().isValidArmor(stack, k_f, thePlayer); + } + @SideOnly(Side.CLIENT) + public String getSlotTexture() diff --git a/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch new file mode 100644 index 0000000000..aeaba71150 --- /dev/null +++ b/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch @@ -0,0 +1,47 @@ +--- ../src-base/minecraft/net/minecraft/inventory/ContainerRepair.java ++++ ../src-work/minecraft/net/minecraft/inventory/ContainerRepair.java +@@ -73,6 +73,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) +@@ -97,7 +99,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; +@@ -175,6 +177,7 @@ + + if (itemstack2 != null) + { ++ if (!net.minecraftforge.common.ForgeHooks.onAnvilChange(this, itemstack, itemstack2, outputSlot, repairedItemName, i2)) return; + flag = itemstack2.getItem() == Items.enchanted_book && Items.enchanted_book.getEnchantments(itemstack2).tagCount() > 0; + + if (itemstack1.isItemStackDamageable() && itemstack1.getItem().getIsRepairable(itemstack, itemstack2)) +@@ -267,7 +270,8 @@ + { + int i4 = ((Integer)iterator.next()).intValue(); + +- if (i4 != i5 && !enchantment.canApplyTogether(Enchantment.getEnchantmentById(i4))) ++ Enchantment e2 = Enchantment.getEnchantmentById(i4); ++ if (i4 != i5 && !(enchantment.canApplyTogether(e2) && e2.canApplyTogether(enchantment))) //Forge BugFix: Let Both enchantments veto being together + { + flag1 = false; + ++l1; +@@ -318,6 +322,8 @@ + } + } + ++ if (flag && !itemstack1.getItem().isBookEnchantable(itemstack1, itemstack2)) itemstack1 = null; ++ + if (StringUtils.isBlank(this.repairedItemName)) + { + if (itemstack.hasDisplayName()) diff --git a/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch b/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch new file mode 100644 index 0000000000..61021f825a --- /dev/null +++ b/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/inventory/SlotCrafting.java ++++ ../src-work/minecraft/net/minecraft/inventory/SlotCrafting.java +@@ -113,8 +113,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/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch b/patches/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch new file mode 100644 index 0000000000..b1ada57ac0 --- /dev/null +++ b/patches/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java ++++ ../src-work/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java +@@ -82,6 +82,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.acquireIron); diff --git a/patches/minecraft/net/minecraft/item/Item.java.patch b/patches/minecraft/net/minecraft/item/Item.java.patch new file mode 100644 index 0000000000..f1b79c5908 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/Item.java.patch @@ -0,0 +1,97 @@ +--- ../src-base/minecraft/net/minecraft/item/Item.java ++++ ../src-work/minecraft/net/minecraft/item/Item.java +@@ -62,6 +62,9 @@ + private String unlocalizedName; + private static final String __OBFID = "CL_00000041"; + ++ 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); +@@ -127,6 +130,7 @@ + return stack; + } + ++ @Deprecated // Use ItemStack sensitive version below. + public int getItemStackLimit() + { + return this.maxStackSize; +@@ -240,6 +244,7 @@ + return this.containerItem; + } + ++ @Deprecated // Use ItemStack sensitive version below. + public boolean hasContainerItem() + { + return this.containerItem != null; +@@ -317,7 +322,7 @@ + + public boolean isItemTool(ItemStack stack) + { +- return this.getItemStackLimit() == 1 && this.isDamageable(); ++ return this.getItemStackLimit(stack) == 1 && this.isDamageable(); + } + + protected MovingObjectPosition getMovingObjectPositionFromPlayer(World worldIn, EntityPlayer playerIn, boolean useLiquids) +@@ -335,6 +340,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(); ++ } + Vec3 vec31 = vec3.addVector((double)f6 * d3, (double)f5 * d3, (double)f7 * d3); + return worldIn.rayTraceBlocks(vec3, vec31, useLiquids, !useLiquids, false); + } +@@ -874,6 +883,10 @@ + private final int enchantability; + private static final String __OBFID = "CL_00000042"; + ++ //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; +@@ -908,9 +921,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 == EMERALD ? 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 EMERALD: 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 == EMERALD) 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/minecraft/net/minecraft/item/ItemArmor.java.patch b/patches/minecraft/net/minecraft/item/ItemArmor.java.patch new file mode 100644 index 0000000000..1b2e521a5f --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemArmor.java.patch @@ -0,0 +1,47 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemArmor.java ++++ ../src-work/minecraft/net/minecraft/item/ItemArmor.java +@@ -38,7 +38,7 @@ + if (list.size() > 0) + { + EntityLivingBase entitylivingbase = (EntityLivingBase)list.get(0); +- int l = entitylivingbase instanceof EntityPlayer ? 1 : 0; ++ int l = 0;// Forge: We fix the indexes. Mojang Stop hard coding this! + int i1 = EntityLiving.getArmorPosition(stack); + ItemStack itemstack = stack.copy(); + itemstack.stackSize = 1; +@@ -192,7 +192,7 @@ + + if (itemstack == null) + { +- playerIn.setCurrentItemOrArmor(i, itemStackIn.copy()); ++ playerIn.setCurrentItemOrArmor(i + 1, itemStackIn.copy()); //Forge: Vanilla bug fix associated with fixed setCurrentItemOrArmor indexs for players. + itemStackIn.stackSize = 0; + } + +@@ -213,6 +213,9 @@ + private final int enchantability; + private static final String __OBFID = "CL_00001768"; + ++ //Added by forge for custom Armor materials. ++ public Item customCraftingMaterial = null; ++ + private ArmorMaterial(String name, int p_i45789_4_, int[] reductionAmounts, int enchantability) + { + this.name = name; +@@ -238,7 +241,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/minecraft/net/minecraft/item/ItemBlock.java.patch b/patches/minecraft/net/minecraft/item/ItemBlock.java.patch new file mode 100644 index 0000000000..1da8fecd80 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemBlock.java.patch @@ -0,0 +1,29 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemBlock.java ++++ ../src-work/minecraft/net/minecraft/item/ItemBlock.java +@@ -163,4 +163,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, pos, stack, player); ++ this.block.onBlockPlacedBy(world, pos, state, player, stack); ++ } ++ ++ return true; ++ } + } diff --git a/patches/minecraft/net/minecraft/item/ItemBow.java.patch b/patches/minecraft/net/minecraft/item/ItemBow.java.patch new file mode 100644 index 0000000000..9c80583a40 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemBow.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemBow.java ++++ ../src-work/minecraft/net/minecraft/item/ItemBow.java +@@ -105,6 +105,9 @@ + + public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) + { ++ net.minecraftforge.event.entity.player.ArrowNockEvent event = new net.minecraftforge.event.entity.player.ArrowNockEvent(playerIn, itemStackIn); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return event.result; ++ + if (playerIn.capabilities.isCreativeMode || playerIn.inventory.hasItem(Items.arrow)) + { + playerIn.setItemInUse(itemStackIn, this.getMaxItemUseDuration(itemStackIn)); diff --git a/patches/minecraft/net/minecraft/item/ItemBucket.java.patch b/patches/minecraft/net/minecraft/item/ItemBucket.java.patch new file mode 100644 index 0000000000..23bf6daf0b --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemBucket.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemBucket.java ++++ ../src-work/minecraft/net/minecraft/item/ItemBucket.java +@@ -37,6 +37,9 @@ + } + else + { ++ ItemStack ret = net.minecraftforge.event.ForgeEventFactory.onBucketUse(playerIn, worldIn, itemStackIn, movingobjectposition); ++ if (ret != null) return ret; ++ + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + { + BlockPos blockpos = movingobjectposition.getBlockPos(); diff --git a/patches/minecraft/net/minecraft/item/ItemBucketMilk.java.patch b/patches/minecraft/net/minecraft/item/ItemBucketMilk.java.patch new file mode 100644 index 0000000000..0e6f3935e8 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemBucketMilk.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemBucketMilk.java ++++ ../src-work/minecraft/net/minecraft/item/ItemBucketMilk.java +@@ -25,7 +25,7 @@ + + if (!worldIn.isRemote) + { +- playerIn.clearActivePotions(); ++ playerIn.curePotionEffects(stack); + } + + playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]); diff --git a/patches/minecraft/net/minecraft/item/ItemDye.java.patch b/patches/minecraft/net/minecraft/item/ItemDye.java.patch new file mode 100644 index 0000000000..4ae5b81101 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemDye.java.patch @@ -0,0 +1,56 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemDye.java ++++ ../src-work/minecraft/net/minecraft/item/ItemDye.java +@@ -48,7 +48,7 @@ + + if (enumdyecolor == EnumDyeColor.WHITE) + { +- if (applyBonemeal(stack, worldIn, pos)) ++ if (applyBonemeal(stack, worldIn, pos, playerIn)) + { + if (!worldIn.isRemote) + { +@@ -98,8 +98,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(); +@@ -133,7 +143,7 @@ + + Block block = worldIn.getBlockState(pos).getBlock(); + +- if (block.getMaterial() != Material.air) ++ if (block.isAir(worldIn, pos)) + { + block.setBlockBoundsBasedOnState(worldIn, pos); + +@@ -145,6 +155,16 @@ + worldIn.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, (double)((float)pos.getX() + itemRand.nextFloat()), (double)pos.getY() + (double)itemRand.nextFloat() * block.getBlockBoundsMaxY(), (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) diff --git a/patches/minecraft/net/minecraft/item/ItemEmptyMap.java.patch b/patches/minecraft/net/minecraft/item/ItemEmptyMap.java.patch new file mode 100644 index 0000000000..2e0696c645 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemEmptyMap.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemEmptyMap.java ++++ ../src-work/minecraft/net/minecraft/item/ItemEmptyMap.java +@@ -24,7 +24,7 @@ + worldIn.setItemData(s, mapdata); + mapdata.scale = 0; + mapdata.func_176054_a(playerIn.posX, playerIn.posZ, mapdata.scale); +- mapdata.dimension = (byte)worldIn.provider.getDimensionId(); ++ mapdata.dimension = worldIn.provider.getDimensionId(); + mapdata.markDirty(); + --itemStackIn.stackSize; + diff --git a/patches/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch b/patches/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch new file mode 100644 index 0000000000..92d47f90bd --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemFlintAndSteel.java ++++ ../src-work/minecraft/net/minecraft/item/ItemFlintAndSteel.java +@@ -29,7 +29,7 @@ + } + else + { +- if (worldIn.getBlockState(pos).getBlock().getMaterial() == Material.air) ++ if (worldIn.isAirBlock(pos)) + { + worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); + worldIn.setBlockState(pos, Blocks.fire.getDefaultState()); diff --git a/patches/minecraft/net/minecraft/item/ItemHoe.java.patch b/patches/minecraft/net/minecraft/item/ItemHoe.java.patch new file mode 100644 index 0000000000..7a27cbcb8b --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemHoe.java.patch @@ -0,0 +1,17 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemHoe.java ++++ ../src-work/minecraft/net/minecraft/item/ItemHoe.java +@@ -35,10 +35,13 @@ + } + else + { ++ int hook = net.minecraftforge.event.ForgeEventFactory.onHoeUse(stack, playerIn, worldIn, pos); ++ if (hook != 0) return hook > 0; ++ + IBlockState iblockstate = worldIn.getBlockState(pos); + Block block = iblockstate.getBlock(); + +- if (side != EnumFacing.DOWN && worldIn.getBlockState(pos.up()).getBlock().getMaterial() == Material.air) ++ if (side != EnumFacing.DOWN && worldIn.isAirBlock(pos.up())) + { + if (block == Blocks.grass) + { diff --git a/patches/minecraft/net/minecraft/item/ItemLilyPad.java.patch b/patches/minecraft/net/minecraft/item/ItemLilyPad.java.patch new file mode 100644 index 0000000000..6251c9d0f6 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemLilyPad.java.patch @@ -0,0 +1,17 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemLilyPad.java ++++ ../src-work/minecraft/net/minecraft/item/ItemLilyPad.java +@@ -51,7 +51,14 @@ + + if (iblockstate.getBlock().getMaterial() == 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 itemStackIn; ++ } + + if (!playerIn.capabilities.isCreativeMode) + { diff --git a/patches/minecraft/net/minecraft/item/ItemMap.java.patch b/patches/minecraft/net/minecraft/item/ItemMap.java.patch new file mode 100644 index 0000000000..98a20762f3 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemMap.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemMap.java ++++ ../src-work/minecraft/net/minecraft/item/ItemMap.java +@@ -59,7 +59,7 @@ + mapdata = new MapData(s); + mapdata.scale = 3; + mapdata.func_176054_a((double)worldIn.getWorldInfo().getSpawnX(), (double)worldIn.getWorldInfo().getSpawnZ(), mapdata.scale); +- mapdata.dimension = (byte)worldIn.provider.getDimensionId(); ++ mapdata.dimension = worldIn.provider.getDimensionId(); + mapdata.markDirty(); + worldIn.setItemData(s, mapdata); + } diff --git a/patches/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch b/patches/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch new file mode 100644 index 0000000000..9d23fda265 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch @@ -0,0 +1,67 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemMonsterPlacer.java ++++ ../src-work/minecraft/net/minecraft/item/ItemMonsterPlacer.java +@@ -38,7 +38,7 @@ + public String getItemStackDisplayName(ItemStack stack) + { + String s = ("" + StatCollector.translateToLocal(this.getUnlocalizedName() + ".name")).trim(); +- String s1 = EntityList.getStringFromID(stack.getMetadata()); ++ String s1 = ItemMonsterPlacer.getEntityName(stack); + + if (s1 != null) + { +@@ -76,7 +76,7 @@ + if (tileentity instanceof TileEntityMobSpawner) + { + MobSpawnerBaseLogic mobspawnerbaselogic = ((TileEntityMobSpawner)tileentity).getSpawnerBaseLogic(); +- mobspawnerbaselogic.setEntityName(EntityList.getStringFromID(stack.getMetadata())); ++ mobspawnerbaselogic.setEntityName(ItemMonsterPlacer.getEntityName(stack)); + tileentity.markDirty(); + worldIn.markBlockForUpdate(pos); + +@@ -97,7 +97,7 @@ + d0 = 0.5D; + } + +- Entity entity = spawnCreature(worldIn, stack.getMetadata(), (double)pos.getX() + 0.5D, (double)pos.getY() + d0, (double)pos.getZ() + 0.5D); ++ Entity entity = spawnCreature(worldIn, ItemMonsterPlacer.getEntityName(stack), (double)pos.getX() + 0.5D, (double)pos.getY() + d0, (double)pos.getZ() + 0.5D); + + if (entity != null) + { +@@ -148,7 +148,7 @@ + + if (worldIn.getBlockState(blockpos).getBlock() instanceof BlockLiquid) + { +- Entity entity = spawnCreature(worldIn, itemStackIn.getMetadata(), (double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D); ++ Entity entity = spawnCreature(worldIn, ItemMonsterPlacer.getEntityName(itemStackIn), (double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D); + + if (entity != null) + { +@@ -209,5 +209,28 @@ + { + subItems.add(new ItemStack(itemIn, 1, entitylist$entityegginfo.spawnedID)); + } ++ ++ for (String name : net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().keySet()) ++ { ++ ItemStack stack = new ItemStack(itemIn); ++ net.minecraft.nbt.NBTTagCompound nbt = new net.minecraft.nbt.NBTTagCompound(); ++ nbt.setString("entity_name", name); ++ stack.setTagCompound(nbt); ++ subItems.add(stack); ++ } + } ++ ++ public static String getEntityName(ItemStack stack) ++ { ++ if (stack.hasTagCompound() && stack.getTagCompound().hasKey("entity_name", 8)) ++ return stack.getTagCompound().getString("entity_name"); ++ return EntityList.getStringFromID(stack.getMetadata()); ++ } ++ ++ private static EntityList.EntityEggInfo getEggInfo(ItemStack stack) ++ { ++ if (stack.hasTagCompound() && stack.getTagCompound().hasKey("entity_name", 8)) ++ return net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(stack.getTagCompound().getString("entity_name")); ++ return (EntityList.EntityEggInfo)EntityList.entityEggs.get(stack.getMetadata()); ++ } + } diff --git a/patches/minecraft/net/minecraft/item/ItemRecord.java.patch b/patches/minecraft/net/minecraft/item/ItemRecord.java.patch new file mode 100644 index 0000000000..9bc2189e70 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemRecord.java.patch @@ -0,0 +1,18 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemRecord.java ++++ ../src-work/minecraft/net/minecraft/item/ItemRecord.java +@@ -77,4 +77,15 @@ + { + return (ItemRecord)RECORDS.get(name); + } ++ ++ /** ++ * 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); ++ } + } diff --git a/patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch b/patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch new file mode 100644 index 0000000000..a80f9b9203 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch @@ -0,0 +1,37 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemSeedFood.java ++++ ../src-work/minecraft/net/minecraft/item/ItemSeedFood.java +@@ -6,7 +6,7 @@ + import net.minecraft.util.EnumFacing; + 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; +@@ -29,7 +29,7 @@ + { + return false; + } +- else if (worldIn.getBlockState(pos).getBlock() == this.soilId && worldIn.isAirBlock(pos.up())) ++ else if (worldIn.getBlockState(pos).getBlock().canSustainPlant(worldIn, pos, EnumFacing.UP, this) && worldIn.isAirBlock(pos.up())) + { + worldIn.setBlockState(pos.up(), this.crops.getDefaultState()); + --stack.stackSize; +@@ -40,4 +40,16 @@ + return false; + } + } ++ ++ @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/minecraft/net/minecraft/item/ItemSeeds.java.patch b/patches/minecraft/net/minecraft/item/ItemSeeds.java.patch new file mode 100644 index 0000000000..ebdd88861d --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemSeeds.java.patch @@ -0,0 +1,37 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemSeeds.java ++++ ../src-work/minecraft/net/minecraft/item/ItemSeeds.java +@@ -7,7 +7,7 @@ + import net.minecraft.util.EnumFacing; + 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; +@@ -30,7 +30,7 @@ + { + return false; + } +- else if (worldIn.getBlockState(pos).getBlock() == this.soilBlockID && worldIn.isAirBlock(pos.up())) ++ else if (worldIn.getBlockState(pos).getBlock().canSustainPlant(worldIn, pos, EnumFacing.UP, this) && worldIn.isAirBlock(pos.up())) + { + worldIn.setBlockState(pos.up(), this.crops.getDefaultState()); + --stack.stackSize; +@@ -41,4 +41,16 @@ + return false; + } + } ++ ++ @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/minecraft/net/minecraft/item/ItemShears.java.patch b/patches/minecraft/net/minecraft/item/ItemShears.java.patch new file mode 100644 index 0000000000..921a20435e --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemShears.java.patch @@ -0,0 +1,89 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemShears.java ++++ ../src-work/minecraft/net/minecraft/item/ItemShears.java +@@ -21,13 +21,12 @@ + + public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) + { +- if (blockIn.getMaterial() != Material.leaves && blockIn != Blocks.web && blockIn != Blocks.tallgrass && blockIn != Blocks.vine && blockIn != Blocks.tripwire && blockIn != Blocks.wool) ++ if (blockIn.getMaterial() != Material.leaves && blockIn != Blocks.web && blockIn != Blocks.tallgrass && blockIn != Blocks.vine && blockIn != Blocks.tripwire && blockIn != Blocks.wool && !(blockIn instanceof net.minecraftforge.common.IShearable)) + { + return super.onBlockDestroyed(stack, worldIn, blockIn, pos, playerIn); + } + else + { +- stack.damageItem(1, playerIn); + return true; + } + } +@@ -41,4 +40,71 @@ + { + return block != Blocks.web && block.getMaterial() != Material.leaves ? (block == Blocks.wool ? 5.0F : super.getStrVsBlock(stack, block)) : 15.0F; + } ++ ++ ++ @Override ++ public boolean itemInteractionForEntity(ItemStack itemstack, net.minecraft.entity.player.EntityPlayer player, EntityLivingBase entity) ++ { ++ 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.enchantment.Enchantment.fortune.effectId, 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.enchantment.Enchantment.fortune.effectId, 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.addStat(net.minecraft.stats.StatList.mineBlockStatArray[Block.getIdFromBlock(block)], 1); ++ } ++ } ++ return false; ++ } + } diff --git a/patches/minecraft/net/minecraft/item/ItemSkull.java.patch b/patches/minecraft/net/minecraft/item/ItemSkull.java.patch new file mode 100644 index 0000000000..9c1921c954 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemSkull.java.patch @@ -0,0 +1,31 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemSkull.java ++++ ../src-work/minecraft/net/minecraft/item/ItemSkull.java +@@ -35,6 +35,11 @@ + + public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + { ++ if (worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos) && side != EnumFacing.DOWN) ++ { ++ side = EnumFacing.UP; ++ pos = pos.down(); ++ } + if (side == EnumFacing.DOWN) + { + return false; +@@ -47,7 +52,7 @@ + + if (!flag) + { +- if (!worldIn.getBlockState(pos).getBlock().getMaterial().isSolid()) ++ if (!worldIn.getBlockState(pos).getBlock().getMaterial().isSolid() && !worldIn.isSideSolid(pos, side, true)) + { + return false; + } +@@ -67,6 +72,7 @@ + { + if (!worldIn.isRemote) + { ++ if (!Blocks.skull.canPlaceBlockOnSide(worldIn, pos, side)) return false; + worldIn.setBlockState(pos, Blocks.skull.getDefaultState().withProperty(BlockSkull.FACING, side), 3); + int i = 0; + diff --git a/patches/minecraft/net/minecraft/item/ItemSnow.java.patch b/patches/minecraft/net/minecraft/item/ItemSnow.java.patch new file mode 100644 index 0000000000..a98b817dd5 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemSnow.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemSnow.java ++++ ../src-work/minecraft/net/minecraft/item/ItemSnow.java +@@ -69,4 +69,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/minecraft/net/minecraft/item/ItemStack.java.patch b/patches/minecraft/net/minecraft/item/ItemStack.java.patch new file mode 100644 index 0000000000..a52cb14333 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemStack.java.patch @@ -0,0 +1,131 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemStack.java ++++ ../src-work/minecraft/net/minecraft/item/ItemStack.java +@@ -50,6 +50,7 @@ + private boolean canPlaceOnCacheResult; + private static final String __OBFID = "CL_00000043"; + ++ private net.minecraftforge.fml.common.registry.RegistryDelegate delegate; + public ItemStack(Block blockIn) + { + this((Block)blockIn, 1); +@@ -81,7 +82,7 @@ + this.canDestroyCacheResult = false; + this.canPlaceOnCacheBlock = null; + this.canPlaceOnCacheResult = false; +- this.item = itemIn; ++ this.setItem(itemIn); + this.stackSize = amount; + this.itemDamage = meta; + +@@ -121,11 +122,12 @@ + + public Item getItem() + { +- return this.item; ++ return this.delegate != null ? this.delegate.get() : null; + } + + public boolean onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + { ++ if (!worldIn.isRemote) return net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(this, playerIn, worldIn, pos, side, hitX, hitY, hitZ); + boolean flag = this.getItem().onItemUse(this, playerIn, worldIn, pos, side, hitX, hitY, hitZ); + + if (flag) +@@ -170,11 +172,11 @@ + { + if (nbt.hasKey("id", 8)) + { +- this.item = Item.getByNameOrId(nbt.getString("id")); ++ this.setItem(Item.getByNameOrId(nbt.getString("id"))); + } + else + { +- this.item = Item.getItemById(nbt.getShort("id")); ++ this.setItem(Item.getItemById(nbt.getShort("id"))); + } + + this.stackSize = nbt.getByte("Count"); +@@ -198,7 +200,7 @@ + + public int getMaxStackSize() + { +- return this.getItem().getItemStackLimit(); ++ return this.getItem().getItemStackLimit(this); + } + + public boolean isStackable() +@@ -208,7 +210,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() +@@ -218,32 +220,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.getMaxDamage(); ++ return this.item.getMaxDamage(this); + } + + public boolean attemptDamageItem(int amount, Random rand) +@@ -275,8 +272,8 @@ + } + } + +- this.itemDamage += amount; +- return this.itemDamage > this.getMaxDamage(); ++ setItemDamage(getItemDamage() + amount); //Redirect through Item's callback if applicable. ++ return getItemDamage() > getMaxDamage(); + } + } + +@@ -335,7 +332,7 @@ + + public boolean canHarvestBlock(Block blockIn) + { +- return this.item.canHarvestBlock(blockIn); ++ return getItem().canHarvestBlock(blockIn, this); + } + + public boolean interactWithEntity(EntityPlayer playerIn, EntityLivingBase entityIn) +@@ -861,6 +858,7 @@ + + public void setItem(Item newItem) + { ++ this.delegate = newItem != null ? newItem.delegate : null; + this.item = newItem; + } + diff --git a/patches/minecraft/net/minecraft/item/ItemSword.java.patch b/patches/minecraft/net/minecraft/item/ItemSword.java.patch new file mode 100644 index 0000000000..8fc061c1e4 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemSword.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemSword.java ++++ ../src-work/minecraft/net/minecraft/item/ItemSword.java +@@ -102,7 +102,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() diff --git a/patches/minecraft/net/minecraft/item/ItemTool.java.patch b/patches/minecraft/net/minecraft/item/ItemTool.java.patch new file mode 100644 index 0000000000..0554e07a00 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemTool.java.patch @@ -0,0 +1,71 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemTool.java ++++ ../src-work/minecraft/net/minecraft/item/ItemTool.java +@@ -29,6 +29,18 @@ + this.efficiencyOnProperMaterial = material.getEfficiencyOnProperMaterial(); + this.damageVsEntity = attackDamage + material.getDamageVsEntity(); + this.setCreativeTab(CreativeTabs.tabTools); ++ if (this instanceof ItemPickaxe) ++ { ++ toolClass = "pickaxe"; ++ } ++ else if (this instanceof ItemAxe) ++ { ++ toolClass = "axe"; ++ } ++ else if (this instanceof ItemSpade) ++ { ++ toolClass = "shovel"; ++ } + } + + public float getStrVsBlock(ItemStack stack, Block block) +@@ -75,7 +87,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() +@@ -84,4 +98,38 @@ + multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(itemModifierUUID, "Tool modifier", (double)this.damageVsEntity, 0)); + 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); ++ } ++ ++ @Override ++ public float getDigSpeed(ItemStack stack, net.minecraft.block.state.IBlockState state) ++ { ++ for (String type : getToolClasses(stack)) ++ { ++ if (state.getBlock().isToolEffective(type, state)) ++ return efficiencyOnProperMaterial; ++ } ++ return super.getDigSpeed(stack, state); ++ } ++ /*===================================== FORGE END =================================*/ + } diff --git a/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch b/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch new file mode 100644 index 0000000000..f30470c7f9 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch @@ -0,0 +1,10 @@ +--- ../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)); + } diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch new file mode 100644 index 0000000000..4a6a9f32af --- /dev/null +++ b/patches/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch @@ -0,0 +1,15 @@ +--- ../src-base/minecraft/net/minecraft/item/crafting/RecipeFireworks.java ++++ ../src-work/minecraft/net/minecraft/item/crafting/RecipeFireworks.java +@@ -250,11 +250,7 @@ + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = p_179532_1_.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/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch new file mode 100644 index 0000000000..d5b3256fc0 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch @@ -0,0 +1,33 @@ +--- ../src-base/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java ++++ ../src-work/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java +@@ -27,7 +27,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; + } +@@ -54,7 +54,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; + } +@@ -104,11 +104,7 @@ + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = p_179532_1_.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/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch new file mode 100644 index 0000000000..afe3c87e46 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch @@ -0,0 +1,15 @@ +--- ../src-base/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java ++++ ../src-work/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java +@@ -148,11 +148,7 @@ + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = p_179532_1_.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/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch new file mode 100644 index 0000000000..cdc16e8002 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch @@ -0,0 +1,27 @@ +--- ../src-base/minecraft/net/minecraft/item/crafting/RecipesBanners.java ++++ ../src-work/minecraft/net/minecraft/item/crafting/RecipesBanners.java +@@ -139,11 +139,7 @@ + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = p_179532_1_.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; +@@ -362,9 +358,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/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch new file mode 100644 index 0000000000..5ad702f777 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch @@ -0,0 +1,15 @@ +--- ../src-base/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java ++++ ../src-work/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java +@@ -110,11 +110,7 @@ + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = p_179532_1_.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/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch b/patches/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch new file mode 100644 index 0000000000..02c3e7f16c --- /dev/null +++ b/patches/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch @@ -0,0 +1,15 @@ +--- ../src-base/minecraft/net/minecraft/item/crafting/ShapedRecipes.java ++++ ../src-work/minecraft/net/minecraft/item/crafting/ShapedRecipes.java +@@ -34,11 +34,7 @@ + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = p_179532_1_.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/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch b/patches/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch new file mode 100644 index 0000000000..1e679060ed --- /dev/null +++ b/patches/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch @@ -0,0 +1,15 @@ +--- ../src-base/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java ++++ ../src-work/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java +@@ -30,11 +30,7 @@ + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = p_179532_1_.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/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch b/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch new file mode 100644 index 0000000000..cd62e3604a --- /dev/null +++ b/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch @@ -0,0 +1,53 @@ +--- ../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 + { +@@ -55,7 +53,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"); +@@ -120,6 +117,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) + { +@@ -127,7 +125,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 +@@ -146,7 +145,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_)); +@@ -161,7 +159,6 @@ + } + } + +- @SideOnly(Side.CLIENT) + public static NBTTagCompound read(File p_74797_0_) throws IOException + { + if (!p_74797_0_.exists()) diff --git a/patches/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch b/patches/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch new file mode 100644 index 0000000000..e8342e7944 --- /dev/null +++ b/patches/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch @@ -0,0 +1,37 @@ +--- ../src-base/minecraft/net/minecraft/nbt/NBTSizeTracker.java ++++ ../src-work/minecraft/net/minecraft/nbt/NBTSizeTracker.java +@@ -27,4 +27,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/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch b/patches/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch new file mode 100644 index 0000000000..f2d5e57139 --- /dev/null +++ b/patches/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch @@ -0,0 +1,18 @@ +--- ../src-base/minecraft/net/minecraft/nbt/NBTTagCompound.java ++++ ../src-work/minecraft/net/minecraft/nbt/NBTTagCompound.java +@@ -398,6 +398,7 @@ + + private static byte readType(DataInput input, NBTSizeTracker sizeTracker) throws IOException + { ++ sizeTracker.read(8); + return input.readByte(); + } + +@@ -408,6 +409,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/minecraft/net/minecraft/nbt/NBTTagString.java.patch b/patches/minecraft/net/minecraft/nbt/NBTTagString.java.patch new file mode 100644 index 0000000000..de3e9ccbac --- /dev/null +++ b/patches/minecraft/net/minecraft/nbt/NBTTagString.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/nbt/NBTTagString.java ++++ ../src-work/minecraft/net/minecraft/nbt/NBTTagString.java +@@ -33,7 +33,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/minecraft/net/minecraft/network/NetworkManager.java.patch b/patches/minecraft/net/minecraft/network/NetworkManager.java.patch new file mode 100644 index 0000000000..3999ee6b3e --- /dev/null +++ b/patches/minecraft/net/minecraft/network/NetworkManager.java.patch @@ -0,0 +1,53 @@ +--- ../src-base/minecraft/net/minecraft/network/NetworkManager.java ++++ ../src-work/minecraft/net/minecraft/network/NetworkManager.java +@@ -97,6 +97,11 @@ + this.direction = packetDirection; + } + ++ public EnumPacketDirection getDirection() ++ { ++ return this.direction; ++ } ++ + public void channelActive(ChannelHandlerContext p_channelActive_1_) throws Exception + { + super.channelActive(p_channelActive_1_); +@@ -212,7 +217,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); +@@ -220,7 +225,7 @@ + + if (this.channel.eventLoop().inEventLoop()) + { +- if (enumconnectionstate != enumconnectionstate1) ++ if (enumconnectionstate != enumconnectionstate1 && !( inPacket instanceof net.minecraftforge.fml.common.network.internal.FMLProxyPacket)) + { + this.setConnectionState(enumconnectionstate); + } +@@ -241,7 +246,7 @@ + private static final String __OBFID = "CL_00002312"; + public void run() + { +- if (enumconnectionstate != enumconnectionstate1) ++ if (enumconnectionstate != enumconnectionstate1 && !( inPacket instanceof net.minecraftforge.fml.common.network.internal.FMLProxyPacket)) + { + NetworkManager.this.setConnectionState(enumconnectionstate); + } +@@ -462,6 +467,11 @@ + } + } + ++ public Channel channel() ++ { ++ return channel; ++ } ++ + static class InboundHandlerTuplePacketListener + { + private final Packet packet; diff --git a/patches/minecraft/net/minecraft/network/ServerStatusResponse.java.patch b/patches/minecraft/net/minecraft/network/ServerStatusResponse.java.patch new file mode 100644 index 0000000000..1acebaeb31 --- /dev/null +++ b/patches/minecraft/net/minecraft/network/ServerStatusResponse.java.patch @@ -0,0 +1,48 @@ +--- ../src-base/minecraft/net/minecraft/network/ServerStatusResponse.java ++++ ../src-work/minecraft/net/minecraft/network/ServerStatusResponse.java +@@ -30,6 +30,7 @@ + public void setServerDescription(IChatComponent motd) + { + this.serverMotd = motd; ++ invalidateJson(); + } + + public ServerStatusResponse.PlayerCountData getPlayerCountData() +@@ -40,6 +41,7 @@ + public void setPlayerCountData(ServerStatusResponse.PlayerCountData countData) + { + this.playerCount = countData; ++ invalidateJson(); + } + + public ServerStatusResponse.MinecraftProtocolVersionIdentifier getProtocolVersionInfo() +@@ -50,11 +52,13 @@ + public void setProtocolVersionInfo(ServerStatusResponse.MinecraftProtocolVersionIdentifier protocolVersionData) + { + this.protocolVersion = protocolVersionData; ++ invalidateJson(); + } + + public void setFavicon(String faviconBlob) + { + this.favicon = faviconBlob; ++ invalidateJson(); + } + + public String getFavicon() +@@ -224,6 +228,7 @@ + serverstatusresponse.setFavicon(JsonUtils.getJsonObjectStringFieldValue(jsonobject, "favicon")); + } + ++ net.minecraftforge.fml.client.FMLClientHandler.instance().captureAdditionalData(serverstatusresponse, jsonobject); + return serverstatusresponse; + } + +@@ -251,6 +256,7 @@ + jsonobject.addProperty("favicon", p_serialize_1_.getFavicon()); + } + ++ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.enhanceStatusQuery(jsonobject); + return jsonobject; + } + } diff --git a/patches/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch b/patches/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch new file mode 100644 index 0000000000..216e1eec3d --- /dev/null +++ b/patches/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch @@ -0,0 +1,48 @@ +--- ../src-base/minecraft/net/minecraft/network/handshake/client/C00Handshake.java ++++ ../src-work/minecraft/net/minecraft/network/handshake/client/C00Handshake.java +@@ -15,6 +15,7 @@ + private int port; + private EnumConnectionState requestedState; + private static final String __OBFID = "CL_00001372"; ++ private boolean hasFMLMarker = false; + + public C00Handshake() + { +@@ -29,18 +30,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()); + } +@@ -59,4 +68,9 @@ + { + return this.protocolVersion; + } ++ ++ public boolean hasFMLMarker() ++ { ++ return this.hasFMLMarker; ++ } + } diff --git a/patches/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch b/patches/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch new file mode 100644 index 0000000000..1da13e842e --- /dev/null +++ b/patches/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java ++++ ../src-work/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java +@@ -48,7 +48,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/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch b/patches/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch new file mode 100644 index 0000000000..819e5c062a --- /dev/null +++ b/patches/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java ++++ ../src-work/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.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(INetHandlerPlayClient handler) diff --git a/patches/minecraft/net/minecraft/potion/Potion.java.patch b/patches/minecraft/net/minecraft/potion/Potion.java.patch new file mode 100644 index 0000000000..8aad8a9e8f --- /dev/null +++ b/patches/minecraft/net/minecraft/potion/Potion.java.patch @@ -0,0 +1,30 @@ +--- ../src-base/minecraft/net/minecraft/potion/Potion.java ++++ ../src-work/minecraft/net/minecraft/potion/Potion.java +@@ -311,4 +311,27 @@ + { + return p_111183_2_.getAmount() * (double)(p_111183_1_ + 1); + } ++ ++ /* ======================================== FORGE START =====================================*/ ++ ++ /** ++ * 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) { } + } diff --git a/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch b/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch new file mode 100644 index 0000000000..eaa78b0a7f --- /dev/null +++ b/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch @@ -0,0 +1,91 @@ +--- ../src-base/minecraft/net/minecraft/potion/PotionEffect.java ++++ ../src-work/minecraft/net/minecraft/potion/PotionEffect.java +@@ -19,6 +19,8 @@ + private boolean isPotionDurationMax; + private boolean showParticles; + private static final String __OBFID = "CL_00001529"; ++ /** List of ItemStack that can cure the potion effect **/ ++ private java.util.List curativeItems; + + public PotionEffect(int id, int effectDuration) + { +@@ -37,6 +39,8 @@ + this.amplifier = effectAmplifier; + this.isAmbient = ambient; + this.showParticles = showParticles; ++ this.curativeItems = new java.util.ArrayList(); ++ this.curativeItems.add(new net.minecraft.item.ItemStack(net.minecraft.init.Items.milk_bucket)); + } + + public PotionEffect(PotionEffect other) +@@ -46,6 +50,7 @@ + this.amplifier = other.amplifier; + this.isAmbient = other.isAmbient; + this.showParticles = other.showParticles; ++ this.curativeItems = other.curativeItems; + } + + public void combine(PotionEffect other) +@@ -224,4 +229,62 @@ + { + 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() ++ { ++ 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) ++ { ++ boolean found = false; ++ for (net.minecraft.item.ItemStack curativeItem : this.curativeItems) ++ { ++ if (curativeItem.isItemEqual(stack)) ++ { ++ found = true; ++ } ++ } ++ ++ return found; ++ } ++ ++ /*** ++ * 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) ++ { ++ boolean found = false; ++ for (net.minecraft.item.ItemStack curativeItem : this.curativeItems) ++ { ++ if (curativeItem.isItemEqual(stack)) ++ { ++ found = true; ++ } ++ } ++ if (!found) ++ { ++ this.curativeItems.add(stack); ++ } ++ } + } diff --git a/patches/minecraft/net/minecraft/realms/RealmsConnect.java.patch b/patches/minecraft/net/minecraft/realms/RealmsConnect.java.patch new file mode 100644 index 0000000000..321fa089bd --- /dev/null +++ b/patches/minecraft/net/minecraft/realms/RealmsConnect.java.patch @@ -0,0 +1,19 @@ +--- ../src-base/minecraft/net/minecraft/realms/RealmsConnect.java ++++ ../src-work/minecraft/net/minecraft/realms/RealmsConnect.java +@@ -40,6 +40,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) +@@ -61,7 +62,7 @@ + return; + } + +- RealmsConnect.this.connection.sendPacket(new C00Handshake(47, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN)); ++ RealmsConnect.this.connection.sendPacket(new C00Handshake(47, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN, true)); + + if (RealmsConnect.this.aborted) + { diff --git a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch new file mode 100644 index 0000000000..319a317428 --- /dev/null +++ b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch @@ -0,0 +1,186 @@ +--- ../src-base/minecraft/net/minecraft/server/MinecraftServer.java ++++ ../src-work/minecraft/net/minecraft/server/MinecraftServer.java +@@ -98,7 +98,7 @@ + @SideOnly(Side.SERVER) + private String hostname; + private int serverPort = -1; +- public WorldServer[] worldServers; ++ public WorldServer[] worldServers = new WorldServer[0]; + private ServerConfigurationManager serverConfigManager; + private boolean serverRunning = true; + private boolean serverStopped; +@@ -115,7 +115,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; +@@ -229,8 +230,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(); +@@ -405,7 +404,7 @@ + + public void stopServer() + { +- if (!this.worldIsBeingDeleted) ++ if (!this.worldIsBeingDeleted && net.minecraftforge.fml.common.Loader.instance().hasReachedState(net.minecraftforge.fml.common.LoaderState.SERVER_STARTED) && !serverStopped) // make sure the save is valid and we don't save twice + { + logger.info("Stopping server"); + +@@ -429,8 +428,15 @@ + for (int i = 0; i < this.worldServers.length; ++i) + { + WorldServer worldserver = this.worldServers[i]; ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(worldserver)); + worldserver.flush(); + } ++ ++ WorldServer[] tmp = worldServers; ++ for (WorldServer world : tmp) ++ { ++ net.minecraftforge.common.DimensionManager.setWorld(world.provider.getDimensionId(), null); ++ } + } + + if (this.usageSnooper.isSnooperRunning()) +@@ -462,6 +468,7 @@ + { + if (this.startServer()) + { ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStarted(); + this.currentTime = getCurrentTimeMillis(); + long i = 0L; + this.statusResponse.setServerDescription(new ChatComponentText(this.motd)); +@@ -506,12 +513,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); +@@ -537,6 +552,7 @@ + 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 +@@ -552,6 +568,8 @@ + } + finally + { ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStopped(); ++ this.serverStopped = true; + this.systemExitNow(); + } + } +@@ -601,6 +619,7 @@ + public void tick() + { + long i = System.nanoTime(); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPreServerTick(); + ++this.tickCounter; + + if (this.startProfiling) +@@ -627,6 +646,7 @@ + + Collections.shuffle(Arrays.asList(agameprofile)); + this.statusResponse.getPlayerCountData().setPlayers(agameprofile); ++ this.statusResponse.invalidateJson(); + } + + if (this.tickCounter % 900 == 0) +@@ -654,6 +674,7 @@ + + this.theProfiler.endSection(); + this.theProfiler.endSection(); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostServerTick(); + } + + public void updateTimeLightAndEntities() +@@ -710,6 +731,7 @@ + throw new ReportedException(crashreport1); + } + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostWorldTick(worldserver); + this.theProfiler.endSection(); + this.theProfiler.startSection("tracker"); + worldserver.getEntityTracker().updateTrackedEntities(); +@@ -717,9 +739,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"); +@@ -741,6 +765,7 @@ + + public void startServerThread() + { ++ net.minecraftforge.fml.common.StartupQuery.reset(); + this.serverThread = new Thread(this, "Server thread"); + this.serverThread.start(); + } +@@ -757,7 +782,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() +@@ -787,7 +818,7 @@ + + public String getServerModName() + { +- return "vanilla"; ++ return net.minecraftforge.fml.common.FMLCommonHandler.instance().getModName(); + } + + public CrashReport addServerInfoToCrashReport(CrashReport report) +@@ -1000,6 +1031,7 @@ + + if (worldserver != null) + { ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(worldserver)); + worldserver.flush(); + } + } diff --git a/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch b/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch new file mode 100644 index 0000000000..df51ee2ecd --- /dev/null +++ b/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch @@ -0,0 +1,44 @@ +--- ../src-base/minecraft/net/minecraft/server/dedicated/DedicatedServer.java ++++ ../src-work/minecraft/net/minecraft/server/dedicated/DedicatedServer.java +@@ -49,6 +49,7 @@ + private boolean canSpawnStructures; + private WorldSettings.GameType gameType; + private boolean guiIsEnabled; ++ public static boolean allowPlayerLogins = false; + private static final String __OBFID = "CL_00001784"; + + public DedicatedServer(File workDir) +@@ -110,6 +111,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")); +@@ -201,6 +204,7 @@ + } + else + { ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onServerStarted(); + this.setConfigManager(new DedicatedPlayerList(this)); + long j = System.nanoTime(); + +@@ -247,6 +251,7 @@ + this.setBuildLimit((this.getBuildLimit() + 8) / 16 * 16); + this.setBuildLimit(MathHelper.clamp_int(this.getBuildLimit(), 64, 256)); + this.settings.setProperty("max-build-height", Integer.valueOf(this.getBuildLimit())); ++ 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; +@@ -275,7 +280,7 @@ + thread1.start(); + } + +- return true; ++ return net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStarting(this); + } + } + } diff --git a/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch b/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch new file mode 100644 index 0000000000..e2d5c01541 --- /dev/null +++ b/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch @@ -0,0 +1,24 @@ +--- ../src-base/minecraft/net/minecraft/server/gui/MinecraftServerGui.java ++++ ../src-work/minecraft/net/minecraft/server/gui/MinecraftServerGui.java +@@ -80,6 +80,7 @@ + System.exit(0); + } + }); ++ minecraftservergui.latch.countDown(); + } + + public MinecraftServerGui(DedicatedServer serverIn) +@@ -167,8 +168,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/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch b/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch new file mode 100644 index 0000000000..60e46c1f8f --- /dev/null +++ b/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch @@ -0,0 +1,31 @@ +--- ../src-base/minecraft/net/minecraft/server/integrated/IntegratedServer.java ++++ ../src-work/minecraft/net/minecraft/server/integrated/IntegratedServer.java +@@ -72,8 +72,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(); +@@ -142,9 +140,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() +@@ -217,6 +216,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/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch b/patches/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch new file mode 100644 index 0000000000..2a343d61e1 --- /dev/null +++ b/patches/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch @@ -0,0 +1,257 @@ +--- ../src-base/minecraft/net/minecraft/server/management/ItemInWorldManager.java ++++ ../src-work/minecraft/net/minecraft/server/management/ItemInWorldManager.java +@@ -22,6 +22,8 @@ + + public class ItemInWorldManager + { ++ /** Forge reach distance */ ++ private double blockReachDistance = 5.0d; + public World theWorld; + public EntityPlayerMP thisPlayerMP; + private WorldSettings.GameType gameType = WorldSettings.GameType.NOT_SET; +@@ -131,6 +133,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); ++ if (event.isCanceled()) ++ { ++ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); ++ return; ++ } ++ + if (this.isCreative()) + { + if (!this.theWorld.extinguishFire((EntityPlayer)null, pos, side)) +@@ -165,18 +175,35 @@ + } + } + +- this.theWorld.extinguishFire((EntityPlayer)null, pos, side); ++ // + this.initialDamage = this.curblockDamage; + float f = 1.0F; + +- if (block.getMaterial() != Material.air) ++ if (!block.isAir(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 S23PacketBlockChange(theWorld, pos)); ++ } + f = block.getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, pos); + } + +- if (block.getMaterial() != Material.air && f >= 1.0F) ++ if (event.useItem == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) + { ++ if (f >= 1.0F) ++ { ++ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); ++ } ++ return; ++ } ++ ++ if (!block.isAir(theWorld, pos) && f >= 1.0F) ++ { + this.tryHarvestBlock(pos); + } + else +@@ -197,7 +224,7 @@ + int i = this.curblockDamage - this.initialDamage; + Block block = this.theWorld.getBlockState(pos).getBlock(); + +- if (block.getMaterial() != Material.air) ++ if (!block.isAir(theWorld, pos)) + { + float f = block.getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, pos) * (float)(i + 1); + +@@ -226,9 +253,13 @@ + + 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(theWorld, pos, thisPlayerMP, canHarvest); + + if (flag) + { +@@ -240,7 +271,8 @@ + + public boolean tryHarvestBlock(BlockPos pos) + { +- if (this.gameType.isCreative() && this.thisPlayerMP.getHeldItem() != null && this.thisPlayerMP.getHeldItem().getItem() instanceof ItemSword) ++ int exp = net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(theWorld, gameType, thisPlayerMP, pos); ++ if (exp == -1) + { + return false; + } +@@ -249,40 +281,21 @@ + IBlockState iblockstate = this.theWorld.getBlockState(pos); + TileEntity tileentity = this.theWorld.getTileEntity(pos); + +- if (this.gameType.isAdventure()) +- { +- if (this.gameType == WorldSettings.GameType.SPECTATOR) +- { +- return false; +- } ++ ItemStack stack = thisPlayerMP.getCurrentEquippedItem(); ++ if (stack != null && stack.getItem().onBlockStartBreak(stack, pos, thisPlayerMP)) return false; + +- if (!this.thisPlayerMP.isAllowEdit()) +- { +- ItemStack itemstack = this.thisPlayerMP.getCurrentEquippedItem(); +- +- 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 S23PacketBlockChange(this.theWorld, pos)); + } + else + { + ItemStack itemstack1 = this.thisPlayerMP.getCurrentEquippedItem(); +- boolean flag = this.thisPlayerMP.canHarvestBlock(iblockstate.getBlock()); ++ boolean flag = iblockstate.getBlock().canHarvestBlock(theWorld, pos, thisPlayerMP); + + if (itemstack1 != null) + { +@@ -294,12 +307,18 @@ + } + } + ++ flag1 = this.removeBlock(pos, flag); + if (flag1 && flag) + { + iblockstate.getBlock().harvestBlock(this.theWorld, this.thisPlayerMP, pos, iblockstate, tileentity); + } + } + ++ // Drop experiance ++ if (!this.isCreative() && flag1 && exp > 0) ++ { ++ iblockstate.getBlock().dropXpOnBlockBreak(theWorld, pos, exp); ++ } + return flag1; + } + } +@@ -333,6 +352,7 @@ + if (itemstack.stackSize == 0) + { + player.inventory.mainInventory[player.inventory.currentItem] = null; ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, itemstack1); + } + + if (!player.isUsingItem()) +@@ -381,33 +401,51 @@ + } + else + { +- if (!player.isSneaking() || player.getHeldItem() == null) ++ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(player, ++ net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, worldIn, pos, side); ++ if (event.isCanceled()) + { +- IBlockState iblockstate = worldIn.getBlockState(pos); +- +- if (iblockstate.getBlock().onBlockActivated(worldIn, pos, iblockstate, player, side, p_180236_6_, p_180236_7_, p_180236_8_)) +- { +- return true; +- } ++ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); ++ return false; + } + +- if (stack == null) ++ if (stack != null && stack.getItem().onItemUseFirst(stack, player, worldIn, pos, side, p_180236_6_, p_180236_7_, p_180236_8_)) + { +- return false; ++ if (stack.stackSize <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(thisPlayerMP, stack); ++ return true; + } +- else if (this.isCreative()) ++ ++ IBlockState iblockstate = worldIn.getBlockState(pos); ++ boolean isAir = worldIn.isAirBlock(pos); ++ boolean useBlock = !player.isSneaking() || player.getHeldItem() == null; ++ if (!useBlock) useBlock = player.getHeldItem().getItem().doesSneakBypassUse(worldIn, pos, player); ++ boolean result = false; ++ ++ if (useBlock) + { +- int j = stack.getMetadata(); +- int i = stack.stackSize; +- boolean flag = stack.onItemUse(player, worldIn, pos, side, p_180236_6_, p_180236_7_, p_180236_8_); +- stack.setItemDamage(j); +- stack.stackSize = i; +- return flag; ++ if (event.useBlock != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) ++ { ++ result = iblockstate.getBlock().onBlockActivated(worldIn, pos, iblockstate, player, side, p_180236_6_, p_180236_7_, p_180236_8_); ++ } ++ else ++ { ++ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); ++ result = event.useItem != net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW; ++ } + } +- else ++ if (stack != null && !result && event.useItem != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) + { +- return stack.onItemUse(player, worldIn, pos, side, p_180236_6_, p_180236_7_, p_180236_8_); ++ int meta = stack.getMetadata(); ++ int size = stack.stackSize; ++ result = stack.onItemUse(player, worldIn, pos, side, p_180236_6_, p_180236_7_, p_180236_8_); ++ if (isCreative()) ++ { ++ stack.setItemDamage(meta); ++ stack.stackSize = size; ++ } ++ if (stack.stackSize <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(thisPlayerMP, stack); + } ++ return result; + } + } + +@@ -415,4 +453,13 @@ + { + this.theWorld = serverWorld; + } ++ ++ public double getBlockReachDistance() ++ { ++ return blockReachDistance; ++ } ++ public void setBlockReachDistance(double distance) ++ { ++ blockReachDistance = distance; ++ } + } diff --git a/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch b/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch new file mode 100644 index 0000000000..309ef6e220 --- /dev/null +++ b/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch @@ -0,0 +1,187 @@ +--- ../src-base/minecraft/net/minecraft/server/management/PlayerManager.java ++++ ../src-work/minecraft/net/minecraft/server/management/PlayerManager.java +@@ -118,15 +118,24 @@ + int j = (int)p_72683_1_.posZ >> 4; + p_72683_1_.managedPosX = p_72683_1_.posX; + p_72683_1_.managedPosZ = p_72683_1_.posZ; ++ // Load nearby chunks first ++ List chunkList = new ArrayList(); + + for (int k = i - this.playerViewRadius; k <= i + this.playerViewRadius; ++k) + { + for (int l = j - this.playerViewRadius; l <= j + this.playerViewRadius; ++l) + { +- this.getPlayerInstance(k, l, true).addPlayer(p_72683_1_); ++ chunkList.add(new ChunkCoordIntPair(k, l)); + } + } + ++ java.util.Collections.sort(chunkList, new net.minecraftforge.common.util.ChunkCoordComparator(p_72683_1_)); ++ ++ for (ChunkCoordIntPair pair : chunkList) ++ { ++ this.getPlayerInstance(pair.chunkXPos, pair.chunkZPos, true).addPlayer(p_72683_1_); ++ } ++ + this.players.add(p_72683_1_); + this.filterChunkLoadQueue(p_72683_1_); + } +@@ -226,6 +235,7 @@ + int i1 = this.playerViewRadius; + int j1 = i - k; + int k1 = j - l; ++ List chunksToLoad = new ArrayList(); + + if (j1 != 0 || k1 != 0) + { +@@ -235,7 +245,7 @@ + { + if (!this.overlaps(l1, i2, k, l, i1)) + { +- this.getPlayerInstance(l1, i2, true).addPlayer(p_72685_1_); ++ chunksToLoad.add(new ChunkCoordIntPair(l1, i2)); + } + + if (!this.overlaps(l1 - j1, i2 - k1, i, j, i1)) +@@ -253,6 +263,18 @@ + this.filterChunkLoadQueue(p_72685_1_); + p_72685_1_.managedPosX = p_72685_1_.posX; + p_72685_1_.managedPosZ = p_72685_1_.posZ; ++ // send nearest chunks first ++ java.util.Collections.sort(chunksToLoad, new net.minecraftforge.common.util.ChunkCoordComparator(p_72685_1_)); ++ ++ for (ChunkCoordIntPair pair : chunksToLoad) ++ { ++ this.getPlayerInstance(pair.chunkXPos, pair.chunkZPos, true).addPlayer(p_72685_1_); ++ } ++ ++ if (i1 > 1 || i1 < -1 || j1 > 1 || j1 < -1) ++ { ++ java.util.Collections.sort(p_72685_1_.loadedChunks, new net.minecraftforge.common.util.ChunkCoordComparator(p_72685_1_)); ++ } + } + } + } +@@ -323,12 +345,21 @@ + private int numBlocksToUpdate; + private int flagsYAreasToUpdate; + private long previousWorldTime; ++ private final java.util.HashMap players = new java.util.HashMap(); ++ private boolean loaded = false; ++ private Runnable loadedRunnable = new Runnable() ++ { ++ public void run() ++ { ++ PlayerInstance.this.loaded = true; ++ } ++ }; + private static final String __OBFID = "CL_00001435"; + + public PlayerInstance(int p_i1518_2_, int p_i1518_3_) + { + this.chunkCoords = new ChunkCoordIntPair(p_i1518_2_, p_i1518_3_); +- PlayerManager.this.getMinecraftServer().theChunkProviderServer.loadChunk(p_i1518_2_, p_i1518_3_); ++ PlayerManager.this.getMinecraftServer().theChunkProviderServer.loadChunk(p_i1518_2_, p_i1518_3_, this.loadedRunnable); + } + + public void addPlayer(EntityPlayerMP p_73255_1_) +@@ -345,7 +376,24 @@ + } + + this.playersWatchingChunk.add(p_73255_1_); ++ Runnable playerRunnable = null; ++ if (this.loaded) ++ { + p_73255_1_.loadedChunks.add(this.chunkCoords); ++ } ++ else ++ { ++ final EntityPlayerMP tmp = p_73255_1_; ++ playerRunnable = new Runnable() ++ { ++ public void run() ++ { ++ tmp.loadedChunks.add(PlayerInstance.this.chunkCoords); ++ } ++ }; ++ PlayerManager.this.getMinecraftServer().theChunkProviderServer.loadChunk(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos, playerRunnable); ++ } ++ this.players.put(p_73255_1_, playerRunnable); + } + } + +@@ -353,6 +401,24 @@ + { + if (this.playersWatchingChunk.contains(p_73252_1_)) + { ++ // If we haven't loaded yet don't load the chunk just so we can clean it up ++ if (!this.loaded) ++ { ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.dropQueuedChunkLoad(PlayerManager.this.getMinecraftServer(), this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos, this.players.get(p_73252_1_)); ++ this.playersWatchingChunk.remove(p_73252_1_); ++ this.players.remove(p_73252_1_); ++ ++ if (this.playersWatchingChunk.isEmpty()) ++ { ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.dropQueuedChunkLoad(PlayerManager.this.getMinecraftServer(), this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos, this.loadedRunnable); ++ long i = (long) this.chunkCoords.chunkXPos + 2147483647L | (long) this.chunkCoords.chunkZPos + 2147483647L << 32; ++ PlayerManager.this.playerInstances.remove(i); ++ PlayerManager.this.playerInstanceList.remove(this); ++ } ++ ++ return; ++ } ++ + Chunk chunk = PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos); + + if (chunk.isPopulated()) +@@ -360,9 +426,12 @@ + p_73252_1_.playerNetServerHandler.sendPacket(new S21PacketChunkData(chunk, true, 0)); + } + ++ this.players.remove(p_73252_1_); + this.playersWatchingChunk.remove(p_73252_1_); + p_73252_1_.loadedChunks.remove(this.chunkCoords); + ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.UnWatch(chunkCoords, p_73252_1_)); ++ + if (this.playersWatchingChunk.isEmpty()) + { + long i = (long)this.chunkCoords.chunkXPos + 2147483647L | (long)this.chunkCoords.chunkZPos + 2147483647L << 32; +@@ -400,7 +469,7 @@ + + this.flagsYAreasToUpdate |= 1 << (p_151253_2_ >> 4); + +- if (this.numBlocksToUpdate < 64) ++ //Forge; Cache everything, so always run + { + short short1 = (short)(p_151253_1_ << 12 | p_151253_3_ << 8 | p_151253_2_); + +@@ -412,6 +481,10 @@ + } + } + ++ if (numBlocksToUpdate == locationOfBlockChange.length) ++ { ++ locationOfBlockChange = java.util.Arrays.copyOf(locationOfBlockChange, locationOfBlockChange.length << 1); ++ } + this.locationOfBlockChange[this.numBlocksToUpdate++] = short1; + } + } +@@ -429,6 +502,7 @@ + } + } + ++ @SuppressWarnings("unused") + public void onUpdate() + { + if (this.numBlocksToUpdate != 0) +@@ -441,7 +515,7 @@ + BlockPos blockpos = new BlockPos(i, j, k); + this.sendToAllPlayersWatchingChunk(new S23PacketBlockChange(PlayerManager.this.theWorldServer, blockpos)); + +- if (PlayerManager.this.theWorldServer.getBlockState(blockpos).getBlock().hasTileEntity()) ++ if (PlayerManager.this.theWorldServer.getBlockState(blockpos).getBlock().hasTileEntity(PlayerManager.this.theWorldServer.getBlockState(blockpos))) + { + this.sendTileToAllPlayersWatchingChunk(PlayerManager.this.theWorldServer.getTileEntity(blockpos)); + } diff --git a/patches/minecraft/net/minecraft/server/management/PlayerProfileCache.java.patch b/patches/minecraft/net/minecraft/server/management/PlayerProfileCache.java.patch new file mode 100644 index 0000000000..c622cc325d --- /dev/null +++ b/patches/minecraft/net/minecraft/server/management/PlayerProfileCache.java.patch @@ -0,0 +1,23 @@ +--- ../src-base/minecraft/net/minecraft/server/management/PlayerProfileCache.java ++++ ../src-work/minecraft/net/minecraft/server/management/PlayerProfileCache.java +@@ -229,6 +229,20 @@ + { + IOUtils.closeQuietly((Reader)bufferedreader); + } ++ } ++ catch (FileNotFoundException filenotfoundexception) ++ { ++ ; ++ } ++ catch (com.google.gson.JsonParseException parsefail) ++ { ++ // No op - the cache can quietly rebuild if it's junk ++ } ++ finally ++ { ++ IOUtils.closeQuietly(bufferedreader); ++ } ++ } + } + + public void func_152658_c() diff --git a/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch b/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch new file mode 100644 index 0000000000..39f17339e3 --- /dev/null +++ b/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch @@ -0,0 +1,153 @@ +--- ../src-base/minecraft/net/minecraft/server/management/ServerConfigurationManager.java ++++ ../src-work/minecraft/net/minecraft/server/management/ServerConfigurationManager.java +@@ -100,7 +100,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(); +@@ -109,6 +109,17 @@ + playerprofilecache.func_152649_a(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"; + +@@ -122,7 +133,7 @@ + WorldInfo worldinfo = worldserver.getWorldInfo(); + BlockPos blockpos = worldserver.getSpawnPoint(); + this.func_72381_a(playerIn, (EntityPlayerMP)null, worldserver); +- NetHandlerPlayServer nethandlerplayserver = new NetHandlerPlayServer(this.mcServer, netManager, playerIn); ++ playerIn.playerNetServerHandler = nethandlerplayserver; + nethandlerplayserver.sendPacket(new S01PacketJoinGame(playerIn.getEntityId(), playerIn.theItemInWorldManager.getGameType(), worldinfo.isHardcoreModeEnabled(), worldserver.provider.getDimensionId(), worldserver.getDifficulty(), this.getMaxPlayers(), worldinfo.getTerrainType(), worldserver.getGameRules().getGameRuleBooleanValue("reducedDebugInfo"))); + nethandlerplayserver.sendPacket(new S3FPacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(this.getServerInstance().getServerModName()))); + nethandlerplayserver.sendPacket(new S41PacketServerDifficulty(worldinfo.getDifficulty(), worldinfo.isDifficultyLocked())); +@@ -162,6 +173,7 @@ + + playerIn.addSelfToInternalCraftingInventory(); + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerLoggedIn(playerIn); + if (nbttagcompound != null && nbttagcompound.hasKey("Riding", 10)) + { + Entity entity = EntityList.createEntityFromNBT(nbttagcompound.getCompoundTag("Riding"), worldserver); +@@ -264,6 +276,7 @@ + playerIn.readFromNBT(nbttagcompound); + nbttagcompound1 = nbttagcompound; + logger.debug("loading single player"); ++ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(playerIn, this.playerNBTManagerObj, playerIn.getUniqueID().toString()); + } + else + { +@@ -273,8 +286,23 @@ + 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()); + +@@ -290,6 +318,7 @@ + this.uuidToPlayerMap.put(playerIn.getUniqueID(), playerIn); + this.sendPacketToAllPlayers(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.ADD_PLAYER, new EntityPlayerMP[] {playerIn})); + WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension); ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.getCurrentPlayerCount()); + worldserver.spawnEntityInWorld(playerIn); + this.func_72375_a(playerIn, (WorldServer)null); + +@@ -307,6 +336,7 @@ + + public void playerLoggedOut(EntityPlayerMP playerIn) + { ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerLoggedOut(playerIn); + playerIn.triggerAchievement(StatList.leaveGameStat); + this.writePlayerData(playerIn); + WorldServer worldserver = playerIn.getServerForPlayer(); +@@ -495,17 +525,27 @@ + { + playerIn.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(playerIn.getEntityId(), potioneffect)); + } ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerChangedDimensionEvent(playerIn, j, dimension); + } + + 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) //Forge Kill it but dont comment out so we can rename it. + { + 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); +@@ -516,7 +556,7 @@ + p_82448_3_.updateEntityWithOptionalForce(entityIn, false); + } + } +- else if (entityIn.dimension == 0) ++ else if (false && entityIn.dimension == 0) //Forge Kill it but dont comment out so we can rename it. + { + 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); +@@ -527,7 +567,8 @@ + p_82448_3_.updateEntityWithOptionalForce(entityIn, false); + } + } +- else ++ ++ if (entityIn.dimension == 1) + { + BlockPos blockpos; + +@@ -562,7 +603,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/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch b/patches/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch new file mode 100644 index 0000000000..7c5e637060 --- /dev/null +++ b/patches/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java ++++ ../src-work/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java +@@ -72,7 +72,7 @@ + } + } + +- if (this.connectionTimer++ == 600) ++ if (this.connectionTimer++ == net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.LOGIN_TIMEOUT) + { + this.closeConnection("Took too long to log in"); + } diff --git a/patches/minecraft/net/minecraft/stats/StatList.java.patch b/patches/minecraft/net/minecraft/stats/StatList.java.patch new file mode 100644 index 0000000000..2da9679d1b --- /dev/null +++ b/patches/minecraft/net/minecraft/stats/StatList.java.patch @@ -0,0 +1,29 @@ +--- ../src-base/minecraft/net/minecraft/stats/StatList.java ++++ ../src-work/minecraft/net/minecraft/stats/StatList.java +@@ -110,7 +110,7 @@ + { + if (item != null) + { +- int i = Item.getIdFromItem(item); ++ int i = Item.getIdFromItem(item); //TODO: Hook FML's stat change event and re-assign these + String s = func_180204_a(item); + + if (s != null) +@@ -151,7 +151,7 @@ + { + if (item != null) + { +- int i = Item.getIdFromItem(item); ++ int i = Item.getIdFromItem(item); //TODO: Hook FML's stat change event and re-assign these + String s = func_180204_a(item); + + if (s != null) +@@ -175,7 +175,7 @@ + { + if (item != null) + { +- int i = Item.getIdFromItem(item); ++ int i = Item.getIdFromItem(item); //TODO: Hook FML's stat change event and re-assign these + String s = func_180204_a(item); + + if (s != null && item.isDamageable()) diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch new file mode 100644 index 0000000000..90194230c9 --- /dev/null +++ b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch @@ -0,0 +1,180 @@ +--- ../src-base/minecraft/net/minecraft/tileentity/TileEntity.java ++++ ../src-work/minecraft/net/minecraft/tileentity/TileEntity.java +@@ -60,6 +60,7 @@ + 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"); + } + + public void writeToNBT(NBTTagCompound compound) +@@ -76,6 +77,7 @@ + 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); + } + } + +@@ -103,7 +105,17 @@ + } + else + { ++ try ++ { + logger.warn("Skipping BlockEntity with id " + nbt.getString("id")); ++ } ++ catch (Exception ex) ++ { ++ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, ex, ++ "A TileEntity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author", ++ nbt.getString("id"), oclass.getName()); ++ tileentity = null; ++ } + } + + return tileentity; +@@ -135,7 +147,6 @@ + } + } + +- @SideOnly(Side.CLIENT) + public double getDistanceSq(double x, double y, double z) + { + double d0 = (double)this.pos.getX() + 0.5D - x; +@@ -283,4 +294,135 @@ + addMapping(TileEntityFlowerPot.class, "FlowerPot"); + addMapping(TileEntityBanner.class, "Banner"); + } ++ ++ // -- 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.S35PacketUpdateTileEntity 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, 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 oldID The old ID of the block ++ * @param newID The new ID of the block (May be the same) ++ * @return True to remove the old tile entity, false to keep it in tact {and create a new one if the new values specify to} ++ */ ++ public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newSate) ++ { ++ return !isVanilla || (oldState.getBlock() != newSate.getBlock()); ++ } ++ ++ 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.AxisAlignedBB INFINITE_EXTENT_AABB = new net.minecraft.util.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.AxisAlignedBB getRenderBoundingBox() ++ { ++ net.minecraft.util.AxisAlignedBB bb = INFINITE_EXTENT_AABB; ++ Block type = getBlockType(); ++ if (type == Blocks.enchanting_table) ++ { ++ bb = new net.minecraft.util.AxisAlignedBB(getPos(), getPos().add(1, 1, 1)); ++ } ++ else if (type == Blocks.chest || type == Blocks.trapped_chest) ++ { ++ bb = new net.minecraft.util.AxisAlignedBB(getPos().add(-1, 0, -1), getPos().add(2, 2, 2)); ++ } ++ else if (type != null && type != Blocks.beacon) ++ { ++ net.minecraft.util.AxisAlignedBB cbb = null; ++ try ++ { ++ cbb = type.getCollisionBoundingBox(worldObj, getPos(), worldObj.getBlockState(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.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; ++ } + } diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch new file mode 100644 index 0000000000..0943941938 --- /dev/null +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch @@ -0,0 +1,20 @@ +--- ../src-base/minecraft/net/minecraft/tileentity/TileEntityBeacon.java ++++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityBeacon.java +@@ -170,7 +170,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(l1, k1, j1), getPos())) + { + flag1 = false; + break; +@@ -369,7 +369,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/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch new file mode 100644 index 0000000000..4792a1dd67 --- /dev/null +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch @@ -0,0 +1,78 @@ +--- ../src-base/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java ++++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java +@@ -105,7 +105,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]; + +@@ -119,7 +119,7 @@ + + for (int i = 0; i < 3; ++i) + { +- if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() == Items.potionitem) ++ if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() instanceof ItemPotion) + { + int j = this.brewingItemStacks[i].getMetadata(); + int k = this.func_145936_c(j, itemstack); +@@ -146,19 +146,22 @@ + } + 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; + if (this.canBrew()) + { ++ net.minecraftforge.common.brewing.BrewingRecipeRegistry.brewPotions(brewingItemStacks, brewingItemStacks[3], outputSlots); + ItemStack itemstack = this.brewingItemStacks[3]; + ++ if (false) { // Code moved to net.minecraftforge.common.brewing.VanillaBrewingRecipe + for (int i = 0; i < 3; ++i) + { +- if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() == Items.potionitem) ++ if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() instanceof ItemPotion) + { + int j = this.brewingItemStacks[i].getMetadata(); + int k = this.func_145936_c(j, itemstack); +@@ -178,10 +181,11 @@ + } + } + } ++ } + +- if (itemstack.getItem().hasContainerItem()) ++ if (itemstack.getItem().hasContainerItem(itemstack)) + { +- this.brewingItemStacks[3] = new ItemStack(itemstack.getItem().getContainerItem()); ++ this.brewingItemStacks[3] = itemstack.getItem().getContainerItem(itemstack); + } + else + { +@@ -192,6 +196,7 @@ + this.brewingItemStacks[3] = null; + } + } ++ net.minecraftforge.event.ForgeEventFactory.onPotionBrewed(brewingItemStacks); + } + } + +@@ -311,7 +316,9 @@ + + public boolean isItemValidForSlot(int index, ItemStack stack) + { +- return index == 3 ? stack.getItem().isPotionIngredient(stack) : stack.getItem() == Items.potionitem || stack.getItem() == Items.glass_bottle; ++ if (index == 3 && net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(stack)) return true; ++ else if (index != 3 && net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(stack)) return true; ++ return false; + } + + public boolean[] func_174902_m() diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch new file mode 100644 index 0000000000..57b5373eea --- /dev/null +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch @@ -0,0 +1,51 @@ +--- ../src-base/minecraft/net/minecraft/tileentity/TileEntityFurnace.java ++++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityFurnace.java +@@ -224,8 +224,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]); + } + } + } +@@ -280,7 +279,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. + } + } + +@@ -296,7 +299,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) +@@ -343,7 +346,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_); + } + } + diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch new file mode 100644 index 0000000000..51de36d50b --- /dev/null +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/tileentity/TileEntityNote.java ++++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityNote.java +@@ -28,7 +28,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/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch new file mode 100644 index 0000000000..396abd4cfc --- /dev/null +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch @@ -0,0 +1,22 @@ +--- ../src-base/minecraft/net/minecraft/tileentity/TileEntityPiston.java ++++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityPiston.java +@@ -149,7 +149,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()); + } + } + } +@@ -167,7 +168,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/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch new file mode 100644 index 0000000000..8ffd40ff6e --- /dev/null +++ b/patches/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/tileentity/TileEntitySign.java ++++ ../src-work/minecraft/net/minecraft/tileentity/TileEntitySign.java +@@ -63,7 +63,7 @@ + } + public boolean canUseCommand(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/minecraft/net/minecraft/util/EnumFacing.java.patch b/patches/minecraft/net/minecraft/util/EnumFacing.java.patch new file mode 100644 index 0000000000..732263cef6 --- /dev/null +++ b/patches/minecraft/net/minecraft/util/EnumFacing.java.patch @@ -0,0 +1,67 @@ +--- ../src-base/minecraft/net/minecraft/util/EnumFacing.java ++++ ../src-work/minecraft/net/minecraft/util/EnumFacing.java +@@ -6,8 +6,6 @@ + import java.util.Iterator; + import java.util.Map; + import java.util.Random; +-import net.minecraftforge.fml.relauncher.Side; +-import net.minecraftforge.fml.relauncher.SideOnly; + + public enum EnumFacing implements IStringSerializable + { +@@ -61,7 +59,6 @@ + return getFront(this.opposite); + } + +- @SideOnly(Side.CLIENT) + public EnumFacing rotateAround(EnumFacing.Axis axis) + { + switch (axis) +@@ -112,7 +109,6 @@ + } + } + +- @SideOnly(Side.CLIENT) + private EnumFacing rotateX() + { + switch (this) +@@ -132,7 +128,6 @@ + } + } + +- @SideOnly(Side.CLIENT) + private EnumFacing rotateZ() + { + switch (this) +@@ -193,7 +188,6 @@ + return this.axis; + } + +- @SideOnly(Side.CLIENT) + public static EnumFacing byName(String name) + { + return name == null ? null : (EnumFacing)NAME_LOOKUP.get(name.toLowerCase()); +@@ -219,7 +213,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; +@@ -262,7 +255,6 @@ + throw new IllegalArgumentException("No such direction: " + p_181076_0_ + " " + p_181076_1_); + } + +- @SideOnly(Side.CLIENT) + public Vec3i getDirectionVec() + { + return this.directionVec; +@@ -299,7 +291,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/minecraft/net/minecraft/util/EnumWorldBlockLayer.java.patch b/patches/minecraft/net/minecraft/util/EnumWorldBlockLayer.java.patch new file mode 100644 index 0000000000..7bb192c6d1 --- /dev/null +++ b/patches/minecraft/net/minecraft/util/EnumWorldBlockLayer.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/util/EnumWorldBlockLayer.java ++++ ../src-work/minecraft/net/minecraft/util/EnumWorldBlockLayer.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 EnumWorldBlockLayer + { + SOLID("Solid"), diff --git a/patches/minecraft/net/minecraft/util/MessageSerializer.java.patch b/patches/minecraft/net/minecraft/util/MessageSerializer.java.patch new file mode 100644 index 0000000000..ea204cead6 --- /dev/null +++ b/patches/minecraft/net/minecraft/util/MessageSerializer.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/util/MessageSerializer.java ++++ ../src-work/minecraft/net/minecraft/util/MessageSerializer.java +@@ -49,7 +49,7 @@ + { + if (p_encode_2_ instanceof S0CPacketSpawnPlayer) + { +- p_encode_2_ = p_encode_2_; ++ //p_encode_2_ = p_encode_2_; FML: Kill warning + } + + p_encode_2_.writePacketData(packetbuffer); diff --git a/patches/minecraft/net/minecraft/util/MouseHelper.java.patch b/patches/minecraft/net/minecraft/util/MouseHelper.java.patch new file mode 100644 index 0000000000..a027a060e9 --- /dev/null +++ b/patches/minecraft/net/minecraft/util/MouseHelper.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/util/MouseHelper.java ++++ ../src-work/minecraft/net/minecraft/util/MouseHelper.java +@@ -14,6 +14,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/minecraft/net/minecraft/util/MovingObjectPosition.java.patch b/patches/minecraft/net/minecraft/util/MovingObjectPosition.java.patch new file mode 100644 index 0000000000..4dce21e9b4 --- /dev/null +++ b/patches/minecraft/net/minecraft/util/MovingObjectPosition.java.patch @@ -0,0 +1,15 @@ +--- ../src-base/minecraft/net/minecraft/util/MovingObjectPosition.java ++++ ../src-work/minecraft/net/minecraft/util/MovingObjectPosition.java +@@ -11,6 +11,12 @@ + public Entity entityHit; + private static final String __OBFID = "CL_00000610"; + ++ /** Used to determine what sub-segment is hit */ ++ public int subHit = -1; ++ ++ /** Used to add extra hit info */ ++ public Object hitInfo = null; ++ + public MovingObjectPosition(Vec3 p_i45551_1_, EnumFacing p_i45551_2_, BlockPos p_i45551_3_) + { + this(MovingObjectPosition.MovingObjectType.BLOCK, p_i45551_1_, p_i45551_2_, p_i45551_3_); diff --git a/patches/minecraft/net/minecraft/util/ResourceLocation.java.patch b/patches/minecraft/net/minecraft/util/ResourceLocation.java.patch new file mode 100644 index 0000000000..6cb2dd79b1 --- /dev/null +++ b/patches/minecraft/net/minecraft/util/ResourceLocation.java.patch @@ -0,0 +1,26 @@ +--- ../src-base/minecraft/net/minecraft/util/ResourceLocation.java ++++ ../src-work/minecraft/net/minecraft/util/ResourceLocation.java +@@ -1,7 +1,5 @@ + package net.minecraft.util; + +-import net.minecraftforge.fml.relauncher.Side; +-import net.minecraftforge.fml.relauncher.SideOnly; + import org.apache.commons.lang3.Validate; + + public class ResourceLocation +@@ -22,7 +20,6 @@ + this(0, func_177516_a(p_i1293_1_)); + } + +- @SideOnly(Side.CLIENT) + public ResourceLocation(String p_i1292_1_, String p_i1292_2_) + { + this(0, new String[] {p_i1292_1_, p_i1292_2_}); +@@ -51,7 +48,6 @@ + return this.resourcePath; + } + +- @SideOnly(Side.CLIENT) + public String getResourceDomain() + { + return this.resourceDomain; diff --git a/patches/minecraft/net/minecraft/util/Session.java.patch b/patches/minecraft/net/minecraft/util/Session.java.patch new file mode 100644 index 0000000000..a294c7feea --- /dev/null +++ b/patches/minecraft/net/minecraft/util/Session.java.patch @@ -0,0 +1,47 @@ +--- ../src-base/minecraft/net/minecraft/util/Session.java ++++ ../src-work/minecraft/net/minecraft/util/Session.java +@@ -16,9 +16,24 @@ + private final String token; + private final Session.Type sessionType; + private static final String __OBFID = "CL_00000659"; ++ /** 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"; ++ System.out.println("========================================================="); ++ System.out.println("Warning the username was not set for this session, typically"); ++ System.out.println("this means you installed Forge incorrectly. We have set your"); ++ System.out.println("name to \"MissingName\" and your session to nothing. Please"); ++ System.out.println("check your instllation and post a console log from the launcher"); ++ System.out.println("when asking for help!"); ++ System.out.println("========================================================="); ++ } ++ + this.username = usernameIn; + this.playerID = playerIDIn; + this.token = tokenIn; +@@ -63,6 +78,19 @@ + return this.sessionType; + } + ++ /* ======================================== 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/minecraft/net/minecraft/util/Vec3.java.patch b/patches/minecraft/net/minecraft/util/Vec3.java.patch new file mode 100644 index 0000000000..cd1142a157 --- /dev/null +++ b/patches/minecraft/net/minecraft/util/Vec3.java.patch @@ -0,0 +1,27 @@ +--- ../src-base/minecraft/net/minecraft/util/Vec3.java ++++ ../src-work/minecraft/net/minecraft/util/Vec3.java +@@ -1,8 +1,5 @@ + package net.minecraft.util; + +-import net.minecraftforge.fml.relauncher.Side; +-import net.minecraftforge.fml.relauncher.SideOnly; +- + public class Vec3 + { + public final double xCoord; +@@ -37,7 +34,6 @@ + this((double)p_i46377_1_.getX(), (double)p_i46377_1_.getY(), (double)p_i46377_1_.getZ()); + } + +- @SideOnly(Side.CLIENT) + public Vec3 subtractReverse(Vec3 vec) + { + return new Vec3(vec.xCoord - this.xCoord, vec.yCoord - this.yCoord, vec.zCoord - this.zCoord); +@@ -54,7 +50,6 @@ + return this.xCoord * vec.xCoord + this.yCoord * vec.yCoord + this.zCoord * vec.zCoord; + } + +- @SideOnly(Side.CLIENT) + public Vec3 crossProduct(Vec3 vec) + { + return new Vec3(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/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch b/patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch new file mode 100644 index 0000000000..2c02349446 --- /dev/null +++ b/patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch @@ -0,0 +1,22 @@ +--- ../src-base/minecraft/net/minecraft/util/WeightedRandomChestContent.java ++++ ../src-work/minecraft/net/minecraft/util/WeightedRandomChestContent.java +@@ -57,6 +57,19 @@ + } + } + ++ // -- Forge hooks ++ /** ++ * Allow a mod to submit a custom implementation that can delegate item stack generation beyond simple stack lookup ++ * ++ * @param random The current random for generation ++ * @param newInventory The inventory being generated (do not populate it, but you can refer to it) ++ * @return An array of {@link ItemStack} to put into the chest ++ */ ++ protected ItemStack[] generateChestContent(Random random, IInventory newInventory) ++ { ++ return net.minecraftforge.common.ChestGenHooks.generateStacks(random, theItemId, theMinimumChanceToGenerateItem, theMaximumChanceToGenerateItem); ++ } ++ + public static void generateDispenserContents(Random random, List p_177631_1_, TileEntityDispenser dispenser, int p_177631_3_) + { + for (int i = 0; i < p_177631_3_; ++i) diff --git a/patches/minecraft/net/minecraft/world/ChunkCache.java.patch b/patches/minecraft/net/minecraft/world/ChunkCache.java.patch new file mode 100644 index 0000000000..88dced0fda --- /dev/null +++ b/patches/minecraft/net/minecraft/world/ChunkCache.java.patch @@ -0,0 +1,61 @@ +--- ../src-base/minecraft/net/minecraft/world/ChunkCache.java ++++ ../src-work/minecraft/net/minecraft/world/ChunkCache.java +@@ -62,6 +62,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); + } + +@@ -85,6 +87,7 @@ + { + int i = (pos.getX() >> 4) - this.chunkX; + int j = (pos.getZ() >> 4) - this.chunkZ; ++ if (i < 0 || i >= chunkArray.length || j < 0 || i >= chunkArray[i].length) return Blocks.air.getDefaultState(); + + if (i >= 0 && i < this.chunkArray.length && j >= 0 && j < this.chunkArray[i].length) + { +@@ -140,6 +143,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); + } + } +@@ -151,7 +156,7 @@ + + public boolean isAirBlock(BlockPos pos) + { +- return this.getBlockState(pos).getBlock().getMaterial() == Material.air; ++ return this.getBlockState(pos).getBlock().isAir(this, pos); + } + + @SideOnly(Side.CLIENT) +@@ -161,6 +166,7 @@ + { + int i = (pos.getX() >> 4) - this.chunkX; + int j = (pos.getZ() >> 4) - this.chunkZ; ++ if (i < 0 || i >= chunkArray.length || j < 0 || i >= chunkArray[i].length) return p_175628_1_.defaultLightValue; + return this.chunkArray[i][j].getLightFor(p_175628_1_, pos); + } + else +@@ -180,4 +186,15 @@ + { + 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 || x >= chunkArray[x].length) return _default; ++ ++ return getBlockState(pos).getBlock().isSideSolid(this, pos, side); ++ } + } diff --git a/patches/minecraft/net/minecraft/world/Explosion.java.patch b/patches/minecraft/net/minecraft/world/Explosion.java.patch new file mode 100644 index 0000000000..6091867490 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/Explosion.java.patch @@ -0,0 +1,44 @@ +--- ../src-base/minecraft/net/minecraft/world/Explosion.java ++++ ../src-work/minecraft/net/minecraft/world/Explosion.java +@@ -39,6 +39,7 @@ + private final List affectedBlockPositions; + private final Map field_77288_k; + private static final String __OBFID = "CL_00000134"; ++ private final Vec3 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_) +@@ -66,6 +67,7 @@ + this.explosionZ = p_i45754_7_; + this.isFlaming = p_i45754_10_; + this.isSmoking = p_i45754_11_; ++ this.position = new Vec3(explosionX, explosionY, explosionZ); + } + + public void doExplosionA() +@@ -100,7 +102,7 @@ + + if (iblockstate.getBlock().getMaterial() != 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; + } + +@@ -214,8 +216,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); + } + } + } +@@ -251,4 +252,6 @@ + { + return this.affectedBlockPositions; + } ++ ++ public Vec3 getPosition(){ return this.position; } + } diff --git a/patches/minecraft/net/minecraft/world/IBlockAccess.java.patch b/patches/minecraft/net/minecraft/world/IBlockAccess.java.patch new file mode 100644 index 0000000000..7fb64f305a --- /dev/null +++ b/patches/minecraft/net/minecraft/world/IBlockAccess.java.patch @@ -0,0 +1,17 @@ +--- ../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/minecraft/net/minecraft/world/WorldProvider.java.patch b/patches/minecraft/net/minecraft/world/WorldProvider.java.patch new file mode 100644 index 0000000000..5b12536d94 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/WorldProvider.java.patch @@ -0,0 +1,367 @@ +--- ../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 WorldChunkManagerHell(BiomeGenBase.getBiomeFromBiomeList(flatgeneratorinfo.getBiome(), BiomeGenBase.field_180279_ad), 0.5F); +- } +- else if (worldtype == WorldType.DEBUG_WORLD) +- { +- this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.plains, 0.0F); +- } +- else +- { +- this.worldChunkMgr = new WorldChunkManager(this.worldObj); +- } ++ this.worldChunkMgr = terrainType.getChunkManager(worldObj); + } + + public IChunkProvider createChunkGenerator() + { +- return (IChunkProvider)(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 ChunkProviderGenerate(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : new ChunkProviderGenerate(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings)))); ++ return terrainType.getChunkGenerator(worldObj, generatorSettings); + } + + public boolean canCoordinateBeSpawn(int x, int z) +@@ -154,13 +140,13 @@ + + public static WorldProvider getProviderForDimension(int dimension) + { +- return (WorldProvider)(dimension == -1 ? new WorldProviderHell() : (dimension == 0 ? new WorldProviderSurface() : (dimension == 1 ? new WorldProviderEnd() : null))); ++ return net.minecraftforge.common.DimensionManager.createProviderFor(dimension); + } + + @SideOnly(Side.CLIENT) + public float getCloudHeight() + { +- return 128.0F; ++ return this.terrainType.getCloudHeight(); + } + + @SideOnly(Side.CLIENT) +@@ -224,4 +210,319 @@ + { + 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; ++ ++ /** ++ * Sets the providers current dimension ID, used in default getSaveFolder() ++ * Added to allow default providers to be registered for multiple dimensions. ++ * ++ * @param dim Dimension ID ++ */ ++ public void setDimension(int dim) ++ { ++ this.dimensionId = dim; ++ } ++ ++ /** ++ * 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 = terrainType.getSpawnFuzz(); ++ 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 Vec3 getSkyColor(net.minecraft.entity.Entity cameraEntity, float partialTicks) ++ { ++ return worldObj.getSkyColorBody(cameraEntity, partialTicks); ++ } ++ ++ @SideOnly(Side.CLIENT) ++ public Vec3 drawClouds(float partialTicks) ++ { ++ return worldObj.drawCloudsBody(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; ++ } + } diff --git a/patches/minecraft/net/minecraft/world/WorldServer.java.patch b/patches/minecraft/net/minecraft/world/WorldServer.java.patch new file mode 100644 index 0000000000..b78fe34d8f --- /dev/null +++ b/patches/minecraft/net/minecraft/world/WorldServer.java.patch @@ -0,0 +1,173 @@ +--- ../src-base/minecraft/net/minecraft/world/WorldServer.java ++++ ../src-work/minecraft/net/minecraft/world/WorldServer.java +@@ -95,30 +95,46 @@ + private List pendingTickListEntriesThisTick = Lists.newArrayList(); + private static final String __OBFID = "CL_00001437"; + ++ /** Stores the recently processed (lighting) chunks */ ++ protected Set doneChunks = new java.util.HashSet(); ++ public List customTeleporters = new ArrayList(); ++ private static boolean initChest = false; ++ public static void fillChestHook() ++ { ++ if (!initChest) ++ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.BONUS_CHEST, bonusChestContent, 10, 10); ++ initChest = true; ++ } ++ + public WorldServer(MinecraftServer server, ISaveHandler saveHandlerIn, WorldInfo info, int dimensionId, Profiler profilerIn) + { + super(saveHandlerIn, info, WorldProvider.getProviderForDimension(dimensionId), 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.dimensionId; + this.provider.registerWorld(this); ++ this.provider.dimensionId = 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); + } + + 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 + { +@@ -211,6 +227,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(); + } +@@ -269,10 +289,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() +@@ -350,7 +367,7 @@ + chunk.func_150804_b(false); + this.theProfiler.endStartSection("thunder"); + +- if (this.rand.nextInt(100000) == 0 && this.isRaining() && this.isThundering()) ++ if (this.provider.canDoLightning(chunk) && this.rand.nextInt(100000) == 0 && this.isRaining() && this.isThundering()) + { + this.updateLCG = this.updateLCG * 3 + 1013904223; + int i1 = this.updateLCG >> 2; +@@ -364,7 +381,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 k2 = this.updateLCG >> 2; +@@ -510,7 +527,7 @@ + + public void updateEntities() + { +- if (this.playerEntities.isEmpty()) ++ if (this.playerEntities.isEmpty() && getPersistentChunks().isEmpty()) + { + if (this.updateEntityTick++ >= 1200) + { +@@ -714,6 +731,10 @@ + + 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); + } + +@@ -779,6 +800,7 @@ + } + else + { ++ if (net.minecraftforge.event.ForgeEventFactory.onCreateWorldSpawn(this, p_73052_1_)) return; + this.findingSpawnPoint = true; + WorldChunkManager worldchunkmanager = this.provider.getWorldChunkManager(); + List list = worldchunkmanager.getBiomesToSpawnIn(); +@@ -824,7 +846,7 @@ + + protected void createBonusChest() + { +- WorldGeneratorBonusChest worldgeneratorbonuschest = new WorldGeneratorBonusChest(bonusChestContent, 10); ++ WorldGeneratorBonusChest worldgeneratorbonuschest = net.minecraftforge.common.ForgeHooks.getBonusChest(rand); + + for (int i = 0; i < 10; ++i) + { +@@ -894,6 +916,7 @@ + this.worldInfo.setBorderLerpTime(this.getWorldBorder().getTimeUntilTarget()); + this.saveHandler.saveWorldInfoWithPlayer(this.worldInfo, this.mcServer.getConfigurationManager().getHostPlayerData()); + this.mapStorage.saveAllData(); ++ this.perWorldStorage.saveAllData(); + } + + public void onEntityAdded(Entity p_72923_1_) +@@ -949,6 +972,7 @@ + public Explosion newExplosion(Entity p_72885_1_, double p_72885_2_, double p_72885_4_, double p_72885_6_, float p_72885_8_, boolean p_72885_9_, boolean p_72885_10_) + { + Explosion explosion = new Explosion(this, p_72885_1_, p_72885_2_, p_72885_4_, p_72885_6_, p_72885_8_, p_72885_9_, p_72885_10_); ++ if (net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this, explosion)) return explosion; + explosion.doExplosionA(); + explosion.doExplosionB(false); + +@@ -1028,19 +1052,23 @@ + this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.getDimensionId()); + } + ++ /* 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.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(2, 0.0F)); ++ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(2, 0.0F), this.provider.dimensionId); + } + else + { +- this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(1, 0.0F)); ++ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(1, 0.0F), this.provider.dimensionId); + } + +- this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(7, this.rainingStrength)); +- this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(8, this.thunderingStrength)); ++ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(7, this.rainingStrength), this.provider.dimensionId); ++ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.dimensionId); + } + } + diff --git a/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch b/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch new file mode 100644 index 0000000000..7bc1733448 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch @@ -0,0 +1,31 @@ +--- ../src-base/minecraft/net/minecraft/world/WorldServerMulti.java ++++ ../src-work/minecraft/net/minecraft/world/WorldServerMulti.java +@@ -11,13 +11,14 @@ + public class WorldServerMulti extends WorldServer + { + private WorldServer delegate; ++ private IBorderListener borderListener; + private static final String __OBFID = "CL_00001430"; + + 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() + { + private static final String __OBFID = "CL_00002273"; + public void onSizeChanged(WorldBorder border, double newSize) +@@ -75,4 +76,12 @@ + + return this; + } ++ ++ ++ @Override ++ public void flush() ++ { ++ super.flush(); ++ this.delegate.getWorldBorder().removeListener(this.borderListener); // Unlink ourselves, to prevent world leak. ++ } + } diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch new file mode 100644 index 0000000000..e76667c786 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/world/biome/BiomeColorHelper.java ++++ ../src-work/minecraft/net/minecraft/world/biome/BiomeColorHelper.java +@@ -29,7 +29,7 @@ + private static final String __OBFID = "CL_00002146"; + public int getColorAtPos(BiomeGenBase p_180283_1_, BlockPos blockPosition) + { +- return p_180283_1_.waterColorMultiplier; ++ return p_180283_1_.getWaterColorMultiplier(); + } + }; + private static final String __OBFID = "CL_00002149"; diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch new file mode 100644 index 0000000000..663692f46b --- /dev/null +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch @@ -0,0 +1,23 @@ +--- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenForest.java ++++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenForest.java +@@ -204,4 +204,20 @@ + }; + } + } ++ ++ @Override ++ public void addDefaultFlowers() ++ { ++ if (field_150632_aF != 1) ++ { ++ 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); ++ } ++ } + } diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch new file mode 100644 index 0000000000..69830eb5be --- /dev/null +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenHills.java ++++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenHills.java +@@ -50,7 +50,7 @@ + int i1 = p_180624_2_.nextInt(16); + BlockPos blockpos = p_180624_3_.add(k, l, i1); + +- if (worldIn.getBlockState(blockpos).getBlock() == Blocks.stone) ++ if (worldIn.getBlockState(blockpos).getBlock().isReplaceableOreGen(worldIn, blockpos, net.minecraft.block.state.pattern.BlockHelper.forBlock(Blocks.stone))) + { + worldIn.setBlockState(blockpos, Blocks.emerald_ore.getDefaultState(), 2); + } diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch new file mode 100644 index 0000000000..8bda59fbb3 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenJungle.java ++++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenJungle.java +@@ -69,7 +69,9 @@ + super.decorate(worldIn, p_180624_2_, p_180624_3_); + int i = p_180624_2_.nextInt(16) + 8; + int j = p_180624_2_.nextInt(16) + 8; +- int k = p_180624_2_.nextInt(worldIn.getHorizon(p_180624_3_.add(i, 0, j)).getY() * 2); ++ int height = worldIn.getHorizon(p_180624_3_.add(i, 0, j)).getY() * 2; // could == 0, which crashes nextInt ++ if (height < 1) height = 1; ++ int k = p_180624_2_.nextInt(height); + (new WorldGenMelon()).generate(worldIn, p_180624_2_, p_180624_3_.add(i, k, j)); + WorldGenVines worldgenvines = new WorldGenVines(); + diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch new file mode 100644 index 0000000000..08d52f9bfd --- /dev/null +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch @@ -0,0 +1,22 @@ +--- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenPlains.java ++++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenPlains.java +@@ -104,4 +104,19 @@ + biomegenplains.field_150609_ah = 14273354; + return biomegenplains; + } ++ ++ @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/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch new file mode 100644 index 0000000000..c4cea2dc19 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch @@ -0,0 +1,13 @@ +--- ../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/minecraft/net/minecraft/world/border/WorldBorder.java.patch b/patches/minecraft/net/minecraft/world/border/WorldBorder.java.patch new file mode 100644 index 0000000000..7e8a99b807 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/border/WorldBorder.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/world/border/WorldBorder.java ++++ ../src-work/minecraft/net/minecraft/world/border/WorldBorder.java +@@ -278,4 +278,9 @@ + iborderlistener.onWarningDistanceChanged(this, warningDistance); + } + } ++ ++ public void removeListener(IBorderListener listener) ++ { ++ this.listeners.remove(listener); ++ } + } diff --git a/patches/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch b/patches/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch new file mode 100644 index 0000000000..be3f87839b --- /dev/null +++ b/patches/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch @@ -0,0 +1,23 @@ +--- ../src-base/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java ++++ ../src-work/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java +@@ -22,18 +22,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); + } +- else if (provider instanceof WorldProviderEnd) +- { +- File file2 = new File(file1, "DIM1"); +- file2.mkdirs(); +- return new AnvilChunkLoader(file2); +- } + else + { + return new AnvilChunkLoader(file1); diff --git a/patches/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch b/patches/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch new file mode 100644 index 0000000000..7060465392 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch @@ -0,0 +1,42 @@ +--- ../src-base/minecraft/net/minecraft/world/chunk/storage/RegionFile.java ++++ ../src-work/minecraft/net/minecraft/world/chunk/storage/RegionFile.java +@@ -102,6 +102,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/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch b/patches/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch new file mode 100644 index 0000000000..8671a0f119 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch @@ -0,0 +1,80 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/MapGenRavine.java ++++ ../src-work/minecraft/net/minecraft/world/gen/MapGenRavine.java +@@ -129,7 +129,7 @@ + { + IBlockState iblockstate = p_180707_5_.getBlockState(j1, l1, k1); + +- if (iblockstate.getBlock() == Blocks.flowing_water || iblockstate.getBlock() == Blocks.water) ++ if (isOceanBlock(p_180707_5_, k2, i2, l2, p_180707_3_, p_180707_4_)) + { + flag2 = true; + } +@@ -222,4 +222,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.world.biome.BiomeGenBase.beach) return true; ++ if (biome == net.minecraft.world.biome.BiomeGenBase.desert) return true; ++ if (biome == net.minecraft.world.biome.BiomeGenBase.mushroomIsland) return true; ++ if (biome == net.minecraft.world.biome.BiomeGenBase.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 < 10) ++ { ++ data.setBlockState(x, y, z, Blocks.lava.getDefaultState()); ++ } ++ else ++ { ++ data.setBlockState(x, y, z, Blocks.air.getDefaultState()); ++ ++ if (foundTop && data.getBlockState(x, y - 1, z).getBlock() == filler.getBlock()) ++ { ++ data.setBlockState(x, y - 1, z, top.getBlock().getDefaultState()); ++ } ++ } ++ } ++ } + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch new file mode 100644 index 0000000000..c17ab4e675 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java +@@ -33,4 +33,10 @@ + this.func_175903_a(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(world, pos) || state.getBlock().isLeaves(world, pos) || state.getBlock().isWood(world, pos) || func_150523_a(state.getBlock()); ++ } + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch new file mode 100644 index 0000000000..2624e39011 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch @@ -0,0 +1,31 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java +@@ -283,6 +283,7 @@ + + if (!this.validTreeLocation()) + { ++ this.world = null; //Fix vanilla Mem leak, holds latest world + return false; + } + else +@@ -291,15 +292,18 @@ + this.func_175941_b(); + this.func_175942_c(); + this.func_175939_d(); ++ this.world = null; //Fix vanilla Mem leak, holds latest world + return true; + } + } + + private boolean validTreeLocation() + { +- Block block = this.world.getBlockState(this.field_175947_m.down()).getBlock(); ++ BlockPos down = this.field_175947_m.down(); ++ net.minecraft.block.state.IBlockState state = this.world.getBlockState(down); ++ boolean isSoil = state.getBlock().canSustainPlant(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/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch new file mode 100644 index 0000000000..f831c5456f --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch @@ -0,0 +1,17 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java +@@ -15,10 +15,12 @@ + { + Block block; + +- while (((block = worldIn.getBlockState(p_180709_3_).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && p_180709_3_.getY() > 0) ++ do + { ++ block = worldIn.getBlockState(p_180709_3_).getBlock(); ++ if (!block.isLeaves(worldIn, p_180709_3_) && !block.isLeaves(worldIn, p_180709_3_)) break; + p_180709_3_ = p_180709_3_.down(); +- } ++ } while (p_180709_3_.getY() > 0); + + for (int i = 0; i < 4; ++i) + { diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch new file mode 100644 index 0000000000..a25a63e453 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java +@@ -102,7 +102,7 @@ + BlockPos blockpos = new BlockPos(i3, i2, k1); + Block block = worldIn.getBlockState(blockpos).getBlock(); + +- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) ++ if (block.isAir(worldIn, blockpos1) || block.isLeaves(worldIn, blockpos1)) + { + this.func_175903_a(worldIn, blockpos, field_181630_b); + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch new file mode 100644 index 0000000000..6bfaaf13e1 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java +@@ -146,4 +146,10 @@ + } + } + } ++ ++ //Just a helper macro ++ private void onPlantGrow(World world, BlockPos pos, BlockPos source) ++ { ++ world.getBlockState(pos).getBlock().onPlantGrow(world, pos, source); ++ } + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch new file mode 100644 index 0000000000..f124d3f7b8 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java +@@ -132,4 +132,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) ++ { ++ net.minecraft.block.Block block = world.getBlockState(pos).getBlock(); ++ return block.isAir(world, pos) || block.isLeaves(world, pos); ++ } + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch new file mode 100644 index 0000000000..4d3c26db33 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch @@ -0,0 +1,31 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java +@@ -72,11 +72,13 @@ + } + else + { +- Block block = worldIn.getBlockState(p_180709_3_.down()).getBlock(); ++ BlockPos down = p_180709_3_.down(); ++ Block block = worldIn.getBlockState(down).getBlock(); ++ boolean isSoil = block.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); + +- if ((block == Blocks.grass || block == Blocks.dirt) && p_180709_3_.getY() < 256 - i - 1) ++ if (isSoil && p_180709_3_.getY() < 256 - i - 1) + { +- this.func_175921_a(worldIn, p_180709_3_.down()); ++ block.onPlantGrow(worldIn, down, p_180709_3_); + EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.random(p_180709_2_); + int k2 = i - p_180709_2_.nextInt(4) - 1; + int l2 = 3 - p_180709_2_.nextInt(3); +@@ -210,9 +212,9 @@ + + private void func_175924_b(World worldIn, BlockPos p_175924_2_) + { +- Material material = worldIn.getBlockState(p_175924_2_).getBlock().getMaterial(); ++ Block block = worldIn.getBlockState(p_175924_2_).getBlock(); + +- if (material == Material.air || material == Material.leaves) ++ if (block.isAir(worldIn, p_175924_2_) || block.isLeaves(worldIn, p_175924_2_)) + { + this.func_175903_a(worldIn, p_175924_2_, field_181644_b); + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch new file mode 100644 index 0000000000..a5d8a11a75 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch @@ -0,0 +1,22 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java +@@ -25,14 +25,16 @@ + { + Block block; + +- while (((block = worldIn.getBlockState(p_180709_3_).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && p_180709_3_.getY() > 0) ++ do + { ++ block = worldIn.getBlockState(p_180709_3_).getBlock(); ++ if (!block.isAir(worldIn, p_180709_3_) && !block.isLeaves(worldIn, p_180709_3_)) break; + p_180709_3_ = p_180709_3_.down(); +- } ++ } while (p_180709_3_.getY() > 0); + + Block block1 = worldIn.getBlockState(p_180709_3_).getBlock(); + +- if (block1 == Blocks.dirt || block1 == Blocks.grass) ++ if (block1.canSustainPlant(worldIn, p_180709_3_, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling))) + { + p_180709_3_ = p_180709_3_.up(); + this.func_175903_a(worldIn, p_180709_3_, this.field_150527_b); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch new file mode 100644 index 0000000000..b4a3e7320f --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch @@ -0,0 +1,17 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java +@@ -23,10 +23,12 @@ + { + Block block; + +- while (((block = worldIn.getBlockState(p_180709_3_).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && p_180709_3_.getY() > 0) ++ do + { ++ block = worldIn.getBlockState(p_180709_3_).getBlock(); ++ if (!block.isAir(worldIn, p_180709_3_) && !block.isLeaves(worldIn, p_180709_3_)) break; + p_180709_3_ = p_180709_3_.down(); +- } ++ } while (p_180709_3_.getY() > 0); + + for (int i = 0; i < 128; ++i) + { diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch new file mode 100644 index 0000000000..794ac79cd4 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java +@@ -114,7 +114,7 @@ + BlockPos blockpos = new BlockPos(k1, i3, i2); + Block block = worldIn.getBlockState(blockpos).getBlock(); + +- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves || block.getMaterial() == Material.vine) ++ if (block.isAir(worldIn, blockpos1) || block.isLeaves(worldIn, blockpos1) || block.getMaterial() == Material.vine) + { + this.func_175903_a(worldIn, blockpos, this.metaLeaves); + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch new file mode 100644 index 0000000000..e460969425 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch @@ -0,0 +1,17 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java +@@ -27,10 +27,12 @@ + { + Block block; + +- while (((block = worldIn.getBlockState(p_180709_3_).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && p_180709_3_.getY() > 1) ++ do + { ++ block = worldIn.getBlockState(p_180709_3_).getBlock(); ++ if (!block.isAir(worldIn, p_180709_3_) && !block.isLeaves(worldIn, p_180709_3_)) break; + p_180709_3_ = p_180709_3_.down(); +- } ++ } while (p_180709_3_.getY() > 0); + + if (p_180709_3_.getY() < 1) + { diff --git a/patches/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch new file mode 100644 index 0000000000..9c8ed27efe --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch @@ -0,0 +1,17 @@ +--- ../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.field_143029_e == null) + { +- this.field_143029_e = (MapGenStructureData)worldIn.loadItemData(MapGenStructureData.class, this.getStructureName()); ++ this.field_143029_e = (MapGenStructureData)worldIn.getPerWorldStorage().loadData(MapGenStructureData.class, this.getStructureName()); + + if (this.field_143029_e == null) + { + this.field_143029_e = new MapGenStructureData(this.getStructureName()); +- worldIn.setItemData(this.getStructureName(), this.field_143029_e); ++ worldIn.getPerWorldStorage().setData(this.getStructureName(), this.field_143029_e); + } + else + { diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch new file mode 100644 index 0000000000..f1ec9e6009 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureComponent.java ++++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureComponent.java +@@ -36,6 +36,10 @@ + + public NBTTagCompound func_143010_b() + { ++ if (MapGenStructureIO.func_143036_a(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.func_143036_a(this)); + nbttagcompound.setTag("BB", this.boundingBox.func_151535_h()); diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch new file mode 100644 index 0000000000..56202de91f --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch @@ -0,0 +1,20 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java ++++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java +@@ -156,7 +156,7 @@ + if (this.field_111021_b && p_74875_3_.func_175898_b(new BlockPos(this.getXWithOffset(3, 3), this.getYWithOffset(2), this.getZWithOffset(3, 3)))) + { + this.field_111021_b = false; +- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 3, 2, 3, field_111019_a, 2 + p_74875_2_.nextInt(4)); ++ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 3, 2, 3, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, p_74875_2_), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, p_74875_2_)); + } + + this.func_175804_a(worldIn, p_74875_3_, 0, 6, 0, 4, 6, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); +@@ -228,7 +228,7 @@ + if (this.field_111020_b && p_74875_3_.func_175898_b(new BlockPos(this.getXWithOffset(1, 3), this.getYWithOffset(2), this.getZWithOffset(1, 3)))) + { + this.field_111020_b = false; +- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 1, 2, 3, field_111019_a, 2 + p_74875_2_.nextInt(4)); ++ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 1, 2, 3, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, p_74875_2_), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, p_74875_2_)); + } + + this.func_175804_a(worldIn, p_74875_3_, 0, 6, 0, 4, 6, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch new file mode 100644 index 0000000000..1dd1abc4d6 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch @@ -0,0 +1,23 @@ +--- ../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 func_143021_a(int p_143021_1_, int p_143021_2_) + { ++ if (MapGenStructureIO.func_143033_a(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.func_143033_a(this)); + nbttagcompound.setInteger("ChunkX", p_143021_1_); +@@ -98,7 +102,8 @@ + + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { +- this.components.add(MapGenStructureIO.func_143032_b(nbttaglist.getCompoundTagAt(i), worldIn)); ++ StructureComponent tmp = MapGenStructureIO.func_143032_b(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.func_143017_b(p_143020_2_); diff --git a/patches/minecraft/net/minecraft/world/storage/MapData.java.patch b/patches/minecraft/net/minecraft/world/storage/MapData.java.patch new file mode 100644 index 0000000000..734f0896c4 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/storage/MapData.java.patch @@ -0,0 +1,48 @@ +--- ../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 byte scale; + public byte[] colors = new byte[16384]; + public List playersArrayList = Lists.newArrayList(); +@@ -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"); +@@ -86,7 +96,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); +@@ -165,7 +175,7 @@ + p_82567_8_ = p_82567_8_ + (p_82567_8_ < 0.0D ? -8.0D : 8.0D); + b2 = (byte)((int)(p_82567_8_ * 16.0D / 360.0D)); + +- if (this.dimension < 0) ++ if (worldIn.provider.shouldMapSpin(p_82567_3_, p_82567_4_, p_82567_6_, p_82567_8_)) + { + int k = (int)(worldIn.getWorldInfo().getWorldTime() / 10L); + b2 = (byte)(k * k * 34187121 + k * 121 >> 15 & 15); diff --git a/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch b/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch new file mode 100644 index 0000000000..356c561133 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch @@ -0,0 +1,59 @@ +--- ../src-base/minecraft/net/minecraft/world/storage/SaveHandler.java ++++ ../src-work/minecraft/net/minecraft/world/storage/SaveHandler.java +@@ -144,6 +144,8 @@ + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound1.setTag("Data", nbttagcompound); + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataSave(this, worldInformation, nbttagcompound2); ++ + try + { + File file1 = new File(this.worldDirectory, "level.dat_new"); +@@ -182,6 +184,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"); +@@ -230,6 +234,7 @@ + } + + file1.renameTo(file2); ++ net.minecraftforge.event.ForgeEventFactory.firePlayerSavingEvent(p_75753_1_, this.playersDirectory, p_75753_1_.getUniqueID().toString()); + } + catch (Exception var5) + { +@@ -260,6 +265,7 @@ + p_75752_1_.readFromNBT(nbttagcompound); + } + ++ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(p_75752_1_, playersDirectory, p_75752_1_.getUniqueID().toString()); + return nbttagcompound; + } + +@@ -301,4 +307,22 @@ + { + return this.saveDirectoryName; + } ++ ++ 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/minecraft/net/minecraft/world/storage/WorldInfo.java.patch b/patches/minecraft/net/minecraft/world/storage/WorldInfo.java.patch new file mode 100644 index 0000000000..7f2a2a3937 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/storage/WorldInfo.java.patch @@ -0,0 +1,35 @@ +--- ../src-base/minecraft/net/minecraft/world/storage/WorldInfo.java ++++ ../src-work/minecraft/net/minecraft/world/storage/WorldInfo.java +@@ -52,6 +52,7 @@ + private int borderWarningTime = 15; + private GameRules theGameRules = new GameRules(); + private static final String __OBFID = "CL_00000587"; ++ private java.util.Map additionalProperties; + + protected WorldInfo() + { +@@ -755,4 +756,24 @@ + } + }); + } ++ ++ /** ++ * 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; ++ } + } diff --git a/rejects/minecraft/net/minecraft/block/Block.java.patch.rej b/rejects/minecraft/net/minecraft/block/Block.java.patch.rej new file mode 100644 index 0000000000..1e00b0acd6 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/Block.java.patch.rej @@ -0,0 +1,56 @@ +++++ REJECTED PATCH 1 + 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(); + private CreativeTabs displayOnCreativeTab; + public static final Block.SoundType soundTypeStone = new Block.SoundType("stone", 1.0F, 1.0F); + public static final Block.SoundType soundTypeWood = new Block.SoundType("wood", 1.0F, 1.0F); +++++ END PATCH +++++ REJECTED PATCH 7 + + public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {} + +- public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {} ++ public void breakBlock(World worldIn, BlockPos pos, IBlockState state) ++ { ++ if (hasTileEntity(state) && !(this instanceof BlockContainer)) ++ { ++ worldIn.removeTileEntity(pos); ++ } ++ } + + public int quantityDropped(Random random) + { +++++ END PATCH +++++ REJECTED PATCH 9 + + 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 j = 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 k = 0; k < j; ++k) ++ 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); + } + } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockAir.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockAir.java.patch.rej new file mode 100644 index 0000000000..f1b988c21c --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockAir.java.patch.rej @@ -0,0 +1,8 @@ +++++ REJECTED PATCH 1 + } + + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) {} ++ ++ public boolean isReplaceable(World worldIn, BlockPos pos){ return true; } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockCocoa.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockCocoa.java.patch.rej new file mode 100644 index 0000000000..e0e0c7e85b --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockCocoa.java.patch.rej @@ -0,0 +1,15 @@ +++++ REJECTED PATCH 1 + + 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 j = ((Integer)state.getValue(AGE)).intValue(); + byte b0 = 1; + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockCrops.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockCrops.java.patch.rej new file mode 100644 index 0000000000..2119824f9e --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockCrops.java.patch.rej @@ -0,0 +1,26 @@ +++++ REJECTED PATCH 3 + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, 0); +- +- if (!worldIn.isRemote) +- { +- int j = ((Integer)state.getValue(AGE)).intValue(); +- +- if (j >= 7) +- { +- int k = 3 + fortune; +- +- for (int l = 0; l < k; ++l) +- { +- if (worldIn.rand.nextInt(15) <= j) +- { +- spawnAsEntity(worldIn, pos, new ItemStack(this.getSeed(), 1, 0)); +- } +- } +- } +- } + } + + public Item getItemDropped(IBlockState state, Random rand, int fortune) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockDoublePlant.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockDoublePlant.java.patch.rej new file mode 100644 index 0000000000..950d40f7e4 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockDoublePlant.java.patch.rej @@ -0,0 +1,40 @@ +++++ REJECTED PATCH 2 + Object object = flag ? this : worldIn.getBlockState(blockpos1).getBlock(); + Object object1 = flag ? worldIn.getBlockState(blockpos2).getBlock() : this; + ++ if (!flag) this.dropBlockAsItem(worldIn, pos, state, 0); //Forge move above the setting to air. ++ + if (object == this) + { + worldIn.setBlockState(blockpos1, Blocks.air.getDefaultState(), 3); +++++ END PATCH +++++ REJECTED PATCH 3 + if (object1 == this) + { + worldIn.setBlockState(blockpos2, Blocks.air.getDefaultState(), 3); +- +- if (!flag) +- { +- this.dropBlockAsItem(worldIn, blockpos2, 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; +++++ END PATCH +++++ REJECTED PATCH 5 + else + { + player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); +- int i = (enumplanttype == BlockDoublePlant.EnumPlantType.GRASS ? BlockTallGrass.EnumType.GRASS : BlockTallGrass.EnumType.FERN).getMeta(); +- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 2, i)); + return true; + } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockFire.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockFire.java.patch.rej new file mode 100644 index 0000000000..2bba49786c --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockFire.java.patch.rej @@ -0,0 +1,73 @@ +++++ REJECTED PATCH 5 + b0 = -50; + } + +- this.catchOnFire(worldIn, pos.east(), 300 + b0, rand, i); +- this.catchOnFire(worldIn, pos.west(), 300 + b0, rand, i); +- this.catchOnFire(worldIn, pos.down(), 250 + b0, rand, i); +- this.catchOnFire(worldIn, pos.up(), 250 + b0, rand, i); +- this.catchOnFire(worldIn, pos.north(), 300 + b0, rand, i); +- this.catchOnFire(worldIn, pos.south(), 300 + b0, rand, i); ++ this.tryCatchFire(worldIn, pos.east(), 300 + b0, rand, i, EnumFacing.WEST); ++ this.tryCatchFire(worldIn, pos.west(), 300 + b0, rand, i, EnumFacing.EAST); ++ this.tryCatchFire(worldIn, pos.down(), 250 + b0, rand, i, EnumFacing.UP); ++ this.tryCatchFire(worldIn, pos.up(), 250 + b0, rand, i, EnumFacing.DOWN); ++ this.tryCatchFire(worldIn, pos.north(), 300 + b0, rand, i, EnumFacing.SOUTH); ++ this.tryCatchFire(worldIn, pos.south(), 300 + b0, rand, i, EnumFacing.NORTH); + + for (int j = -1; j <= 1; ++j) + { +++++ END PATCH +++++ REJECTED PATCH 6 + 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 k = 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 k = worldIn.getBlockState(pos).getBlock().getFlammability(worldIn, pos, face); ++ + if (random.nextInt(chance) < k) + { + IBlockState iblockstate = worldIn.getBlockState(pos); +++++ END PATCH +++++ REJECTED PATCH 7 + { + EnumFacing enumfacing = aenumfacing[j]; + +- if (this.canCatchFire(worldIn, pos.offset(enumfacing))) ++ if (this.canCatchFire(worldIn, pos.offset(enumfacing), enumfacing.getOpposite())) + { + return true; + } +++++ END PATCH +++++ REJECTED PATCH 8 + for (int k = 0; k < j; ++k) + { + EnumFacing enumfacing = aenumfacing[k]; +- 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; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockGrass.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockGrass.java.patch.rej new file mode 100644 index 0000000000..2f7804379a --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockGrass.java.patch.rej @@ -0,0 +1,32 @@ +++++ REJECTED PATCH 2 + Block block = worldIn.getBlockState(blockpos1.up()).getBlock(); + IBlockState iblockstate1 = worldIn.getBlockState(blockpos1); + +- if (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos1.up()) >= 4 && block.getLightOpacity() <= 2) ++ if (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos1.up()) >= 4 && block.getLightOpacity(worldIn, blockpos1.up()) <= 2) + { + worldIn.setBlockState(blockpos1, Blocks.grass.getDefaultState()); + } +++++ END PATCH +++++ REJECTED PATCH 3 + continue; + } + } +- else if (worldIn.getBlockState(blockpos2).getBlock().blockMaterial == Material.air) ++ else if (worldIn.isAirBlock(blockpos2)) + { + if (rand.nextInt(8) == 0) + { +- BlockFlower.EnumFlowerType enumflowertype = worldIn.getBiomeGenForCoords(blockpos2).pickRandomFlower(rand, blockpos2); +- BlockFlower blockflower = enumflowertype.getBlockType().getBlock(); +- IBlockState iblockstate1 = blockflower.getDefaultState().withProperty(blockflower.getTypeProperty(), enumflowertype); +- +- if (blockflower.canBlockStay(worldIn, blockpos2, iblockstate1)) +- { +- worldIn.setBlockState(blockpos2, iblockstate1, 3); +- } ++ worldIn.getBiomeGenForCoords(blockpos2).plantFlower(worldIn, rand, blockpos2); + } + else + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockLadder.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockLadder.java.patch.rej new file mode 100644 index 0000000000..feee341b8d --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockLadder.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 3 + return new BlockState(this, new IProperty[] {FACING}); + } + ++ @Override public boolean isLadder(IBlockAccess world, BlockPos pos, EntityLivingBase entity) { return true; } ++ + static final class SwitchEnumFacing + { + static final int[] FACING_LOOKUP = new int[EnumFacing.values().length]; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockLeaves.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockLeaves.java.patch.rej new file mode 100644 index 0000000000..971ebede53 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockLeaves.java.patch.rej @@ -0,0 +1,73 @@ +++++ REJECTED PATCH 2 + BlockPos blockpos1 = pos.add(i1, j1, k1); + IBlockState iblockstate1 = worldIn.getBlockState(blockpos1); + +- if (iblockstate1.getBlock().getMaterial() == Material.leaves && !((Boolean)iblockstate1.getValue(CHECK_DECAY)).booleanValue()) ++ if (iblockstate1.getBlock().isLeaves(worldIn, blockpos1)) + { +- worldIn.setBlockState(blockpos1, iblockstate1.withProperty(CHECK_DECAY, Boolean.valueOf(true)), 4); ++ iblockstate1.getBlock().beginLeavesDecay(worldIn, blockpos1); + } + } + } +++++ END PATCH +++++ REJECTED PATCH 3 + { + for (i2 = -b0; i2 <= b0; ++i2) + { +- Block block = worldIn.getBlockState(new BlockPos(j + k1, k + l1, l + i2)).getBlock(); ++ BlockPos tmp = new BlockPos(j + k1, k + l1, l + i2); ++ Block block = worldIn.getBlockState(tmp).getBlock(); + +- if (block != Blocks.log && block != Blocks.log2) ++ if (!block.canSustainLeaves(worldIn, tmp)) + { +- if (block.getMaterial() == Material.leaves) ++ if (block.isLeaves(worldIn, tmp)) + { + this.surroundings[(k1 + j1) * i1 + (l1 + j1) * b1 + i2 + j1] = -2; + } +++++ END PATCH +++++ REJECTED PATCH 4 + + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { +- if (!worldIn.isRemote) +- { +- int j = this.getSaplingDropChance(state); +- +- if (fortune > 0) +- { +- j -= 2 << fortune; +- +- if (j < 10) +- { +- j = 10; +- } +- } +- +- if (worldIn.rand.nextInt(j) == 0) +- { +- Item item = this.getItemDropped(state, worldIn.rand, fortune); +- spawnAsEntity(worldIn, pos, new ItemStack(item, 1, this.damageDropped(state))); +- } +- +- j = 200; +- +- if (fortune > 0) +- { +- j -= 10 << fortune; +- +- if (j < 40) +- { +- j = 40; +- } +- } +- +- this.dropApple(worldIn, pos, state, j); +- } ++ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); + } + + protected void dropApple(World worldIn, BlockPos pos, IBlockState state, int chance) {} +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockLever.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockLever.java.patch.rej new file mode 100644 index 0000000000..259b2a5599 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockLever.java.patch.rej @@ -0,0 +1,55 @@ +++++ REJECTED PATCH 1 + + public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) + { +- return side == EnumFacing.UP && World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) ? true : this.canSustainLever(worldIn, pos.offset(side.getOpposite())); ++ return side == EnumFacing.UP && World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) ? true : worldIn.isSideSolid(pos.offset(side.getOpposite()), side); + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { +- return this.canSustainLever(worldIn, pos.west()) ? true : (this.canSustainLever(worldIn, pos.east()) ? true : (this.canSustainLever(worldIn, pos.north()) ? true : (this.canSustainLever(worldIn, pos.south()) ? true : (World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) ? true : this.canSustainLever(worldIn, pos.up()))))); ++ return worldIn.isSideSolid(pos.west(), EnumFacing.EAST ) || ++ worldIn.isSideSolid(pos.east(), EnumFacing.WEST ) || ++ worldIn.isSideSolid(pos.north(), EnumFacing.SOUTH) || ++ worldIn.isSideSolid(pos.south(), EnumFacing.NORTH) || ++ worldIn.isSideSolid(pos.down(), EnumFacing.UP ) || ++ worldIn.isSideSolid(pos.up(), EnumFacing.DOWN ); + } + +- protected boolean canSustainLever(World worldIn, BlockPos pos) +- { +- return worldIn.getBlockState(pos).getBlock().isNormalCube(); +- } +- + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + { + IBlockState iblockstate = this.getDefaultState().withProperty(POWERED, Boolean.valueOf(false)); + +- if (this.canSustainLever(worldIn, pos.offset(facing.getOpposite()))) ++ if (worldIn.isSideSolid(pos.offset(facing.getOpposite()), facing)) + { + return iblockstate.withProperty(FACING, BlockLever.EnumOrientation.forFacings(facing, placer.getHorizontalFacing())); + } +++++ END PATCH +++++ REJECTED PATCH 2 + + enumfacing1 = (EnumFacing)iterator.next(); + } +- while (enumfacing1 == facing || !this.canSustainLever(worldIn, pos.offset(enumfacing1.getOpposite()))); ++ while (enumfacing1 == facing || !worldIn.isSideSolid(pos.offset(enumfacing1.getOpposite()), enumfacing1)); + + return iblockstate.withProperty(FACING, BlockLever.EnumOrientation.forFacings(enumfacing1, placer.getHorizontalFacing())); + } +++++ END PATCH +++++ REJECTED PATCH 3 + + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { +- if (this.checkForDrop(worldIn, pos) && !this.canSustainLever(worldIn, pos.offset(((BlockLever.EnumOrientation)state.getValue(FACING)).getFacing().getOpposite()))) ++ EnumFacing dir = ((BlockLever.EnumOrientation)state.getValue(FACING)).getFacing(); ++ if (this.checkForDrop(worldIn, pos) && !worldIn.isSideSolid(pos.offset(dir.getOpposite()), dir)) + { + this.dropBlockAsItem(worldIn, pos, state, 0); + worldIn.setBlockToAir(pos); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockLog.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockLog.java.patch.rej new file mode 100644 index 0000000000..5579362ca8 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockLog.java.patch.rej @@ -0,0 +1,13 @@ +++++ REJECTED PATCH 1 + BlockPos blockpos1 = (BlockPos)iterator.next(); + IBlockState iblockstate1 = worldIn.getBlockState(blockpos1); + +- if (iblockstate1.getBlock().getMaterial() == Material.leaves && !((Boolean)iblockstate1.getValue(BlockLeaves.CHECK_DECAY)).booleanValue()) ++ if (iblockstate1.getBlock().isLeaves(worldIn, blockpos1)) + { +- worldIn.setBlockState(blockpos1, iblockstate1.withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(true)), 4); ++ iblockstate1.getBlock().beginLeavesDecay(worldIn, blockpos1); + } + } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockMobSpawner.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockMobSpawner.java.patch.rej new file mode 100644 index 0000000000..a32b52b1f2 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockMobSpawner.java.patch.rej @@ -0,0 +1,18 @@ +++++ REJECTED PATCH 1 + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); +- int j = 15 + worldIn.rand.nextInt(15) + worldIn.rand.nextInt(15); +- this.dropXpOnBlockBreak(worldIn, pos, j); + } + ++ @Override ++ public int getExpDrop(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ { ++ return 15 + RANDOM.nextInt(15) + RANDOM.nextInt(15); ++ } ++ + public boolean isOpaqueCube() + { + return false; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockMushroom.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockMushroom.java.patch.rej new file mode 100644 index 0000000000..f1b2e56024 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockMushroom.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + if (pos.getY() >= 0 && pos.getY() < 256) + { + IBlockState iblockstate1 = worldIn.getBlockState(pos.down()); +- return iblockstate1.getBlock() == Blocks.mycelium ? true : (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && this.canPlaceBlockOn(iblockstate1.getBlock())); ++ return iblockstate1.getBlock() == Blocks.mycelium ? true : (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && iblockstate1.getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this)); + } + else + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockMycelium.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockMycelium.java.patch.rej new file mode 100644 index 0000000000..6899945c5d --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockMycelium.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 2 + IBlockState iblockstate1 = worldIn.getBlockState(blockpos1); + Block block = worldIn.getBlockState(blockpos1.up()).getBlock(); + +- if (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos1.up()) >= 4 && block.getLightOpacity() <= 2) ++ if (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos1.up()) >= 4 && block.getLightOpacity(worldIn, blockpos1.up()) <= 2) + { + worldIn.setBlockState(blockpos1, this.getDefaultState()); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockPistonBase.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockPistonBase.java.patch.rej new file mode 100644 index 0000000000..86af25d331 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockPistonBase.java.patch.rej @@ -0,0 +1,22 @@ +++++ REJECTED PATCH 1 + } + } + +- if (!flag1 && block.getMaterial() != Material.air && canPush(block, worldIn, blockpos1, enumfacing.getOpposite(), false) && (block.getMobilityFlag() == 0 || block == Blocks.piston || block == Blocks.sticky_piston)) ++ if (!flag1 && !block.isAir(worldIn, blockpos1) && canPush(block, worldIn, blockpos1, enumfacing.getOpposite(), false) && (block.getMobilityFlag() == 0 || block == Blocks.piston || block == Blocks.sticky_piston)) + { + this.doMove(worldIn, pos, enumfacing, false); + } +++++ END PATCH +++++ REJECTED PATCH 3 + { + blockpos1 = (BlockPos)list1.get(j); + Block block = worldIn.getBlockState(blockpos1).getBlock(); +- block.dropBlockAsItem(worldIn, blockpos1, worldIn.getBlockState(blockpos1), 0); ++ //With our change to how snowballs are dropped this needs to disallow to mimic vanilla behavior. ++ float chance = block instanceof BlockSnow ? -1.0f : 1.0f; ++ block.dropBlockAsItemWithChance(worldIn, blockpos1, worldIn.getBlockState(blockpos1), chance, 0); + worldIn.setBlockToAir(blockpos1); + --i; + ablock[i] = block; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockPistonMoving.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockPistonMoving.java.patch.rej new file mode 100644 index 0000000000..e76f9ae9da --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockPistonMoving.java.patch.rej @@ -0,0 +1,19 @@ +++++ REJECTED PATCH 1 + + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { +- if (!worldIn.isRemote) +- { +- TileEntityPiston tileentitypiston = this.getTileEntity(worldIn, pos); +- +- if (tileentitypiston != null) +- { +- IBlockState iblockstate1 = tileentitypiston.getPistonState(); +- iblockstate1.getBlock().dropBlockAsItem(worldIn, pos, iblockstate1, 0); +- } +- } ++ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); + } + + public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockRailBase.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockRailBase.java.patch.rej new file mode 100644 index 0000000000..bbd6693673 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockRailBase.java.patch.rej @@ -0,0 +1,134 @@ +++++ REJECTED PATCH 2 + } + + 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 : (java.util.Set)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"), +++++ END PATCH +++++ REJECTED PATCH 4 + this.state = state; + this.block = (BlockRailBase)state.getBlock(); + BlockRailBase.EnumRailDirection enumraildirection = (BlockRailBase.EnumRailDirection)state.getValue(BlockRailBase.this.getShapeProperty()); +- this.isPowered = this.block.isPowered; ++ this.isPowered = !this.block.isFlexibleRail(worldIn, pos); ++ canMakeSlopes = this.block.canMakeSlopes(worldIn, pos); + this.func_180360_a(enumraildirection); + } + +++++ END PATCH +++++ REJECTED PATCH 5 + } + } + +- if (enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH) ++ if (enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes) + { + if (BlockRailBase.isRailBlock(this.world, blockpos.up())) + { +++++ END PATCH +++++ REJECTED PATCH 6 + } + } + +- if (enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST) ++ if (enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST && canMakeSlopes) + { + if (BlockRailBase.isRailBlock(this.world, blockpos3.up())) + { +++++ END PATCH +++++ REJECTED PATCH 7 + } + } + +- if (enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH) ++ if (enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes) + { + if (BlockRailBase.isRailBlock(this.world, blockpos.up())) + { +++++ END PATCH +++++ REJECTED PATCH 8 + } + } + +- if (enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST) ++ if (enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST && canMakeSlopes) + { + if (BlockRailBase.isRailBlock(this.world, blockpos3.up())) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch.rej new file mode 100644 index 0000000000..51dca115b0 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + { + EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + BlockPos blockpos1 = 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(blockpos1, this); + worldIn.notifyNeighborsOfStateExcept(blockpos1, this, enumfacing); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch.rej new file mode 100644 index 0000000000..98688e8d03 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch.rej @@ -0,0 +1,21 @@ +++++ REJECTED PATCH 1 + 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(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ { ++ if (this.getItemDropped(world.getBlockState(pos), RANDOM, fortune) != Item.getItemFromBlock(this)) + { +- int j = 1 + worldIn.rand.nextInt(5); +- this.dropXpOnBlockBreak(worldIn, pos, j); ++ return 1 + RANDOM.nextInt(5); + } ++ return 0; + } + + @SideOnly(Side.CLIENT) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch.rej new file mode 100644 index 0000000000..cd65ac08d7 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch.rej @@ -0,0 +1,59 @@ +++++ REJECTED PATCH 1 + BlockPos blockpos1 = pos.offset(direction); + Block block = worldIn.getBlockState(pos.offset(direction)).getBlock(); + +- if (!canConnectTo(worldIn.getBlockState(blockpos1), direction) && (block.isSolidFullCube() || !canConnectUpwardsTo(worldIn.getBlockState(blockpos1.down())))) ++ if (!canRestoneConnect(worldIn, blockpos1, direction) && (block.isSolidFullCube() || !canRestoneConnect(worldIn, blockpos1.down(), null))) + { + Block block1 = worldIn.getBlockState(pos.up()).getBlock(); +- return !block1.isSolidFullCube() && block.isSolidFullCube() && canConnectUpwardsTo(worldIn.getBlockState(blockpos1.up())) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE; ++ return !block1.isSolidFullCube() && block.isSolidFullCube() && canRestoneConnect(worldIn, blockpos1.up(), null) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE; + } + else + { +++++ END PATCH +++++ REJECTED PATCH 2 + Block block = iblockstate.getBlock(); + boolean flag = block.isNormalCube(); + boolean flag1 = worldIn.getBlockState(pos.up()).getBlock().isNormalCube(); +- return !flag1 && flag && canConnectUpwardsTo(worldIn, blockpos1.up()) ? true : (canConnectTo(iblockstate, side) ? true : (block == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.FACING) == side ? true : !flag && canConnectUpwardsTo(worldIn, blockpos1.down()))); ++ return !flag1 && flag && canRestoneConnect(worldIn, blockpos1.up(), null) ? true : (canRestoneConnect(worldIn, blockpos1, side) ? true : (block == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.FACING) == side ? true : !flag && canRestoneConnect(worldIn, blockpos1.down(), null))); + } + +- protected static boolean canConnectUpwardsTo(IBlockAccess worldIn, BlockPos pos) ++ protected static boolean canRestoneConnect(IBlockAccess world, BlockPos pos, EnumFacing side) + { +- return canConnectUpwardsTo(worldIn.getBlockState(pos)); +- } ++ IBlockState state = world.getBlockState(pos); + +- protected static boolean canConnectUpwardsTo(IBlockState state) +- { +- return canConnectTo(state, (EnumFacing)null); +- } +- +- protected static boolean canConnectTo(IBlockState blockState, EnumFacing side) +- { +- Block block = blockState.getBlock(); +- +- if (block == Blocks.redstone_wire) ++ if (state.getBlock() == Blocks.redstone_wire) + { + return true; + } +- else if (Blocks.unpowered_repeater.isAssociated(block)) ++ else if (Blocks.unpowered_repeater.isAssociated(state.getBlock())) + { +- EnumFacing enumfacing1 = (EnumFacing)blockState.getValue(BlockRedstoneRepeater.FACING); +- return enumfacing1 == side || enumfacing1.getOpposite() == side; ++ EnumFacing direction = (EnumFacing)state.getValue(BlockRedstoneRepeater.FACING); ++ return direction == side || direction.getOpposite() == side; + } + else + { +- return block.canProvidePower() && side != null; ++ return state.getBlock().canConnectRedstone(world, pos, side); + } + } + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockSapling.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockSapling.java.patch.rej new file mode 100644 index 0000000000..921d4a4e19 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockSapling.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 1 + + public void generateTree(World worldIn, BlockPos pos, IBlockState state, Random rand) + { ++ if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(worldIn, rand, pos)) return; + Object object = rand.nextInt(10) == 0 ? new WorldGenBigTree(true) : new WorldGenTrees(true); + int i = 0; + int j = 0; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockSkull.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockSkull.java.patch.rej new file mode 100644 index 0000000000..b9f4f54a4f --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockSkull.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + return tileentity instanceof TileEntitySkull ? ((TileEntitySkull)tileentity).getSkullType() : super.getDamageValue(worldIn, pos); + } + +- 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) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockSnow.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockSnow.java.patch.rej new file mode 100644 index 0000000000..be9e93d09e --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockSnow.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + { + IBlockState iblockstate = worldIn.getBlockState(pos.down()); + Block block = iblockstate.getBlock(); +- return block != Blocks.ice && block != Blocks.packed_ice ? (block.getMaterial() == Material.leaves ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() == 7 ? true : block.isOpaqueCube() && block.blockMaterial.blocksMovement())) : false; ++ return block != Blocks.ice && block != Blocks.packed_ice ? (block.isLeaves(worldIn, pos.down()) ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() == 7 ? true : block.isOpaqueCube() && block.blockMaterial.blocksMovement())) : false; + } + + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockStem.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockStem.java.patch.rej new file mode 100644 index 0000000000..1b9e859f13 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockStem.java.patch.rej @@ -0,0 +1,18 @@ +++++ REJECTED PATCH 3 + + for (int k = 0; k < 3; ++k) + { +- if (worldIn.rand.nextInt(15) <= j) ++ if (RANDOM.nextInt(15) <= j) + { +- spawnAsEntity(worldIn, pos, new ItemStack(item)); ++ ret.add(new ItemStack(item)); + } + } + } + } ++ return ret; + } + + protected Item getSeedItem() +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockTorch.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockTorch.java.patch.rej new file mode 100644 index 0000000000..2fd87d5049 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockTorch.java.patch.rej @@ -0,0 +1,30 @@ +++++ REJECTED PATCH 2 + { + BlockPos blockpos1 = pos.offset(facing.getOpposite()); + boolean flag = facing.getAxis().isHorizontal(); +- return flag && worldIn.isBlockNormalCube(blockpos1, true) || facing.equals(EnumFacing.UP) && this.canPlaceOn(worldIn, blockpos1); ++ return flag && worldIn.isSideSolid(blockpos1, facing, true) || facing.equals(EnumFacing.UP) && this.canPlaceOn(worldIn, blockpos1); + } + + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) +++++ END PATCH +++++ REJECTED PATCH 3 + + enumfacing1 = (EnumFacing)iterator.next(); + } +- while (!worldIn.isBlockNormalCube(pos.offset(enumfacing1.getOpposite()), true)); ++ while (!worldIn.isSideSolid(pos.offset(enumfacing1.getOpposite()), enumfacing1, true)); + + return this.getDefaultState().withProperty(FACING, enumfacing1); + } +++++ END PATCH +++++ REJECTED PATCH 4 + EnumFacing enumfacing1 = enumfacing.getOpposite(); + boolean flag = false; + +- if (axis.isHorizontal() && !worldIn.isBlockNormalCube(pos.offset(enumfacing1), true)) ++ if (axis.isHorizontal() && !worldIn.isSideSolid(pos.offset(enumfacing1), enumfacing1, true)) + { + flag = true; + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockTrapDoor.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockTrapDoor.java.patch.rej new file mode 100644 index 0000000000..3b8cb207bd --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockTrapDoor.java.patch.rej @@ -0,0 +1,13 @@ +++++ REJECTED PATCH 2 + { + if (!worldIn.isRemote) + { ++ EnumFacing direction = (EnumFacing)state.getValue(FACING); + BlockPos blockpos1 = pos.offset(((EnumFacing)state.getValue(FACING)).getOpposite()); + +- if (!isValidSupportBlock(worldIn.getBlockState(blockpos1).getBlock())) ++ if (!(isValidSupportBlock(worldIn.getBlockState(blockpos1).getBlock()) || worldIn.isSideSolid(blockpos1, direction, true))) + { + worldIn.setBlockToAir(pos); + this.dropBlockAsItem(worldIn, pos, state, 0); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockTripWireHook.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockTripWireHook.java.patch.rej new file mode 100644 index 0000000000..94dd081821 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockTripWireHook.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 2 + + enumfacing = (EnumFacing)iterator.next(); + } +- while (!worldIn.getBlockState(pos.offset(enumfacing)).getBlock().isNormalCube()); ++ while (!worldIn.isSideSolid(pos.offset(enumfacing), enumfacing.getOpposite(), true)); + + return true; + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockVine.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockVine.java.patch.rej new file mode 100644 index 0000000000..e891e578dc --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockVine.java.patch.rej @@ -0,0 +1,18 @@ +++++ REJECTED PATCH 3 + return i; + } + ++ /*************************FORGE START***********************************/ ++ @Override public boolean isLadder(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***********************************/ ++ + static final class SwitchEnumFacing + { + static final int[] FACING_LOOKUP = new int[EnumFacing.values().length]; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch.rej b/rejects/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch.rej new file mode 100644 index 0000000000..6d2f2b55c9 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 2 + BlockPos blockpos1 = origin.offset(this.moveDirection.getOpposite(), i); + block = this.world.getBlockState(blockpos1).getBlock(); + +- if (block.getMaterial() == Material.air || !BlockPistonBase.canPush(block, this.world, blockpos1, this.moveDirection, false) || blockpos1.equals(this.pistonPos)) ++ if (block.isAir(world, blockpos1)|| !BlockPistonBase.canPush(block, this.world, blockpos1, this.moveDirection, false) || blockpos1.equals(this.pistonPos)) + { + break; + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/state/BlockState.java.patch.rej b/rejects/minecraft/net/minecraft/block/state/BlockState.java.patch.rej new file mode 100644 index 0000000000..2be0164379 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/state/BlockState.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 2 + { + List list = (List)iterator.next(); + Map map = MapPopulator.createMap(this.properties, list); +- BlockState.StateImplementation stateimplementation = new BlockState.StateImplementation(blockIn, ImmutableMap.copyOf(map), null); ++ BlockState.StateImplementation stateimplementation = createState(blockIn, ImmutableMap.copyOf(map), unlistedProperties); + linkedhashmap.put(map, stateimplementation); + arraylist.add(stateimplementation); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch.rej b/rejects/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch.rej new file mode 100644 index 0000000000..c574d7bf30 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch.rej @@ -0,0 +1,14 @@ +++++ REJECTED PATCH 2 + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + this.mc.fontRendererObj.drawStringWithShadow(this.currentlyDisplayedText, (float)((l - this.mc.fontRendererObj.getStringWidth(this.currentlyDisplayedText)) / 2), (float)(i1 / 2 - 4 - 16), 16777215); + this.mc.fontRendererObj.drawStringWithShadow(this.message, (float)((l - this.mc.fontRendererObj.getStringWidth(this.message)) / 2), (float)(i1 / 2 - 4 + 8), 16777215); ++ } ++ } ++ catch (java.io.IOException e) ++ { ++ com.google.common.base.Throwables.propagate(e); ++ } //FML End + this.framebuffer.unbindFramebuffer(); + + if (OpenGlHelper.isFramebufferEnabled()) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/Minecraft.java.patch.rej b/rejects/minecraft/net/minecraft/client/Minecraft.java.patch.rej new file mode 100644 index 0000000000..77b54313dd --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/Minecraft.java.patch.rej @@ -0,0 +1,240 @@ +++++ REJECTED PATCH 9 + { + while (!this.scheduledTasks.isEmpty()) + { +- ((FutureTask)this.scheduledTasks.poll()).run(); ++ net.minecraftforge.fml.common.FMLCommonHandler.callFuture(((FutureTask)this.scheduledTasks.poll())); + } + } + +++++ END PATCH +++++ REJECTED PATCH 10 + + if (!this.skipRenderWorld) + { ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onRenderTickStart(this.timer.renderPartialTicks); + this.mcProfiler.endStartSection("gameRenderer"); + this.entityRenderer.updateCameraAndRender(this.timer.renderPartialTicks); + this.mcProfiler.endSection(); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onRenderTickEnd(this.timer.renderPartialTicks); + } + + this.mcProfiler.endSection(); +++++ END PATCH +++++ REJECTED PATCH 12 + case 2: + BlockPos blockpos = this.objectMouseOver.getBlockPos(); + +- if (this.theWorld.getBlockState(blockpos).getBlock().getMaterial() != Material.air) ++ if (!this.theWorld.isAirBlock(blockpos)) + { + int i = itemstack != null ? itemstack.stackSize : 0; + ++ ++ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(thePlayer, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, this.theWorld, blockpos, this.objectMouseOver.sideHit).isCanceled(); ++ if (result) { //Forge: Kept separate to simplify patch + if (this.playerController.func_178890_a(this.thePlayer, this.theWorld, itemstack, blockpos, this.objectMouseOver.sideHit, this.objectMouseOver.hitVec)) + { + flag = false; + this.thePlayer.swingItem(); + } ++ } + + if (itemstack == null) + { +++++ END PATCH +++++ REJECTED PATCH 13 + { + ItemStack itemstack1 = this.thePlayer.inventory.getCurrentItem(); + +- if (itemstack1 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, itemstack1)) ++ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(thePlayer, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_AIR, theWorld, null, null).isCanceled(); ++ if (result && itemstack1 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, itemstack1)) + { + this.entityRenderer.itemRenderer.resetEquippedProgress2(); + } +++++ END PATCH +++++ REJECTED PATCH 15 + + while (Mouse.next()) + { ++ if (net.minecraftforge.client.ForgeHooksClient.postMouseEvent()) continue; ++ + i = Mouse.getEventButton(); + KeyBinding.setKeyBindState(i - 100, Mouse.getEventButtonState()); + +++++ END PATCH +++++ REJECTED PATCH 19 + + while (!this.theIntegratedServer.serverIsInRunLoop()) + { ++ if (!net.minecraftforge.fml.common.StartupQuery.check()) ++ { ++ loadWorld(null); ++ displayGuiScreen(null); ++ return; ++ } + String s2 = this.theIntegratedServer.getUserMessage(); + + if (s2 != null) +++++ END PATCH +++++ REJECTED PATCH 24 + if (this.objectMouseOver != null) + { + boolean flag = this.thePlayer.capabilities.isCreativeMode; +- int i = 0; +- boolean flag1 = false; +- TileEntity tileentity = null; +- Object object; + +- if (this.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) +- { +- BlockPos blockpos = this.objectMouseOver.getBlockPos(); +- Block block = this.theWorld.getBlockState(blockpos).getBlock(); +- +- if (block.getMaterial() == Material.air) +- { +- return; +- } +- +- object = block.getItem(this.theWorld, blockpos); +- +- if (object == null) +- { +- return; +- } +- +- if (flag && GuiScreen.isCtrlKeyDown()) +- { +- tileentity = this.theWorld.getTileEntity(blockpos); +- } +- +- Block block1 = object instanceof ItemBlock && !block.isFlowerPot() ? Block.getBlockFromItem((Item)object) : block; +- i = block1.getDamageValue(this.theWorld, blockpos); +- flag1 = ((Item)object).getHasSubtypes(); +- } +- else +- { +- if (this.objectMouseOver.typeOfHit != MovingObjectPosition.MovingObjectType.ENTITY || this.objectMouseOver.entityHit == null || !flag) +- { +- return; +- } +- +- if (this.objectMouseOver.entityHit instanceof EntityPainting) +- { +- object = Items.painting; +- } +- else if (this.objectMouseOver.entityHit instanceof EntityLeashKnot) +- { +- object = Items.lead; +- } +- else if (this.objectMouseOver.entityHit instanceof EntityItemFrame) +- { +- EntityItemFrame entityitemframe = (EntityItemFrame)this.objectMouseOver.entityHit; +- ItemStack itemstack = entityitemframe.getDisplayedItem(); +- +- if (itemstack == null) +- { +- object = Items.item_frame; +- } +- else +- { +- object = itemstack.getItem(); +- i = itemstack.getMetadata(); +- flag1 = true; +- } +- } +- else if (this.objectMouseOver.entityHit instanceof EntityMinecart) +- { +- EntityMinecart entityminecart = (EntityMinecart)this.objectMouseOver.entityHit; +- +- switch (Minecraft.SwitchEnumMinecartType.field_178901_b[entityminecart.getMinecartType().ordinal()]) +- { +- case 1: +- object = Items.furnace_minecart; +- break; +- case 2: +- object = Items.chest_minecart; +- break; +- case 3: +- object = Items.tnt_minecart; +- break; +- case 4: +- object = Items.hopper_minecart; +- break; +- case 5: +- object = Items.command_block_minecart; +- break; +- default: +- object = Items.minecart; +- } +- } +- else if (this.objectMouseOver.entityHit instanceof EntityBoat) +- { +- object = Items.boat; +- } +- else if (this.objectMouseOver.entityHit instanceof EntityArmorStand) +- { +- object = Items.armor_stand; +- } +- else +- { +- object = Items.spawn_egg; +- i = EntityList.getEntityID(this.objectMouseOver.entityHit); +- flag1 = true; +- +- if (!EntityList.entityEggs.containsKey(Integer.valueOf(i))) +- { +- return; +- } +- } +- } +- + InventoryPlayer inventoryplayer = this.thePlayer.inventory; + +- if (tileentity == null) +- { +- inventoryplayer.setCurrentItem((Item)object, i, flag1, flag); +- } +- else +- { +- NBTTagCompound nbttagcompound1 = new NBTTagCompound(); +- tileentity.writeToNBT(nbttagcompound1); +- ItemStack itemstack1 = new ItemStack((Item)object, 1, i); +- itemstack1.setTagInfo("BlockEntityTag", nbttagcompound1); +- NBTTagCompound nbttagcompound = new NBTTagCompound(); +- NBTTagList nbttaglist = new NBTTagList(); +- nbttaglist.appendTag(new NBTTagString("(+NBT)")); +- nbttagcompound.setTag("Lore", nbttaglist); +- itemstack1.setTagInfo("display", nbttagcompound); +- inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, itemstack1); +- } +- ++ if (!net.minecraftforge.common.ForgeHooks.onPickBlock(this.objectMouseOver, this.thePlayer, this.theWorld)) return; ++ // We delete this code wholly instead of commenting it out, to make sure we detect changes in it between MC versions + if (flag) + { + int j = this.thePlayer.inventoryContainer.inventorySlots.size() - 9 + inventoryplayer.currentItem; +++++ END PATCH +++++ REJECTED PATCH 25 + + public static int getGLMaximumTextureSize() + { +- for (int i = 16384; i > 0; i >>= 1) +- { +- GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)null); +- int j = GL11.glGetTexLevelParameteri(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH); +- +- 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() +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/FontRenderer.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/FontRenderer.java.patch.rej new file mode 100644 index 0000000000..c45fe36d93 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/gui/FontRenderer.java.patch.rej @@ -0,0 +1,47 @@ +++++ REJECTED PATCH 5 + float f = (float)(p_78266_1_ % 16 * 8); + float f1 = (float)(p_78266_1_ / 16 * 8); + float f2 = p_78266_2_ ? 1.0F : 0.0F; +- this.renderEngine.bindTexture(this.locationFontTexture); ++ bindTexture(this.locationFontTexture); + float f3 = (float)this.charWidth[p_78266_1_] - 0.01F; + GL11.glBegin(GL11.GL_TRIANGLE_STRIP); + GL11.glTexCoord2f(f / 128.0F, f1 / 128.0F); +++++ END PATCH +++++ REJECTED PATCH 8 + + k = this.colorCode[j]; + this.textColor = k; +- GlStateManager.color((float)(k >> 16) / 255.0F, (float)(k >> 8 & 255) / 255.0F, (float)(k & 255) / 255.0F, this.alpha); ++ setColor((float)(k >> 16) / 255.0F, (float)(k >> 8 & 255) / 255.0F, (float)(k & 255) / 255.0F, this.alpha); + } + else if (j == 16) + { +++++ END PATCH +++++ REJECTED PATCH 10 + j = k; + } + +- float f1 = this.unicodeFlag ? 0.5F : 1.0F; ++ float f1 = getCharWidth(c0) / 32f; + boolean flag1 = (c0 == 0 || j == -1 || this.unicodeFlag) && p_78255_2_; + + if (flag1) +++++ END PATCH +++++ REJECTED PATCH 11 + ++f; + } + ++ doDraw(f); ++ } ++ } ++ } ++ ++ protected void doDraw(float f) ++ { ++ { ++ { + Tessellator tessellator; + WorldRenderer worldrenderer; + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/GuiButton.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/GuiButton.java.patch.rej new file mode 100644 index 0000000000..59560fdc25 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/gui/GuiButton.java.patch.rej @@ -0,0 +1,15 @@ +++++ REJECTED PATCH 2 + this.mouseDragged(mc, mouseX, mouseY); + int l = 14737632; + +- if (!this.enabled) ++ if (packedFGColour != 0) + { ++ l = packedFGColour; ++ } ++ else if (!this.enabled) ++ { + l = 10526880; + } + else if (this.hovered) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/GuiChat.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/GuiChat.java.patch.rej new file mode 100644 index 0000000000..632b6e2437 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/gui/GuiChat.java.patch.rej @@ -0,0 +1,15 @@ +++++ REJECTED PATCH 2 + String[] astring1 = p_146406_1_; + int i = p_146406_1_.length; + ++ String[] complete = net.minecraftforge.client.ClientCommandHandler.instance.latestAutoComplete; ++ if (complete != null) ++ { ++ astring1 = com.google.common.collect.ObjectArrays.concat(complete, astring1, String.class); ++ i = astring1.length; ++ } ++ + for (int j = 0; j < i; ++j) + { + String s = astring1[j]; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch.rej new file mode 100644 index 0000000000..2cfa568eca --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + } + } + ++ WorldType.worldTypes[this.selectedIndex].onGUICreateWorldPress(); ++ + WorldSettings.GameType gametype = WorldSettings.GameType.getByName(this.field_146342_r); + WorldSettings worldsettings = new WorldSettings(i, gametype, this.field_146341_s, this.field_146337_w, WorldType.worldTypes[this.selectedIndex]); + worldsettings.setWorldName(this.chunkProviderSettingsJson); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch.rej new file mode 100644 index 0000000000..e8e38dc2a9 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch.rej @@ -0,0 +1,12 @@ +++++ REJECTED PATCH 1 + + this.buttonList.add(new GuiButton(4, this.width / 2 - 100, this.height / 4 + 24 + b0, I18n.format("menu.returnToGame", new Object[0]))); + this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + b0, 98, 20, I18n.format("menu.options", new Object[0]))); ++ this.buttonList.add(new GuiButton(12, this.width / 2 + 2, this.height / 4 + 96 + b0, 98, 20, I18n.format("fml.menu.modoptions"))); + GuiButton guibutton; +- this.buttonList.add(guibutton = new GuiButton(7, this.width / 2 + 2, this.height / 4 + 96 + b0, 98, 20, I18n.format("menu.shareToLan", new Object[0]))); ++ this.buttonList.add(guibutton = new GuiButton(7, this.width / 2 - 100, this.height / 4 + 72 + b0, 200, 20, I18n.format("menu.shareToLan", new Object[0]))); + this.buttonList.add(new GuiButton(5, this.width / 2 - 100, this.height / 4 + 48 + b0, 98, 20, I18n.format("gui.achievements", new Object[0]))); + this.buttonList.add(new GuiButton(6, this.width / 2 + 2, this.height / 4 + 48 + b0, 98, 20, I18n.format("gui.stats", new Object[0]))); + guibutton.enabled = this.mc.isSingleplayer() && !this.mc.getIntegratedServer().getPublic(); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/GuiSlot.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/GuiSlot.java.patch.rej new file mode 100644 index 0000000000..79869a7b44 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/gui/GuiSlot.java.patch.rej @@ -0,0 +1,19 @@ +++++ REJECTED PATCH 1 + GlStateManager.disableFog(); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); +- this.mc.getTextureManager().bindTexture(Gui.optionsBackground); +- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); +- float f1 = 32.0F; +- worldrenderer.startDrawingQuads(); +- worldrenderer.setColorOpaque_I(2105376); +- worldrenderer.addVertexWithUV((double)this.left, (double)this.bottom, 0.0D, (double)((float)this.left / f1), (double)((float)(this.bottom + (int)this.amountScrolled) / f1)); +- worldrenderer.addVertexWithUV((double)this.right, (double)this.bottom, 0.0D, (double)((float)this.right / f1), (double)((float)(this.bottom + (int)this.amountScrolled) / f1)); +- worldrenderer.addVertexWithUV((double)this.right, (double)this.top, 0.0D, (double)((float)this.right / f1), (double)((float)(this.top + (int)this.amountScrolled) / f1)); +- worldrenderer.addVertexWithUV((double)this.left, (double)this.top, 0.0D, (double)((float)this.left / f1), (double)((float)(this.top + (int)this.amountScrolled) / f1)); +- tessellator.draw(); ++ this.drawContainerBackground(tessellator); + int i1 = this.left + this.width / 2 - this.getListWidth() / 2 + 2; + int j1 = this.top + 4 - (int)this.amountScrolled; + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch.rej new file mode 100644 index 0000000000..3b5b991095 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch.rej @@ -0,0 +1,23 @@ +++++ REJECTED PATCH 1 + boolean flag2 = this.field_148301_e.version < 47; + boolean flag3 = flag1 || flag2; + this.field_148300_d.fontRendererObj.drawString(this.field_148301_e.serverName, x + 32 + 3, y + 1, 16777215); +- List list = this.field_148300_d.fontRendererObj.listFormattedStringToWidth(this.field_148301_e.serverMOTD, listWidth - 32 - 2); ++ List list = this.field_148300_d.fontRendererObj.listFormattedStringToWidth(net.minecraftforge.fml.client.FMLClientHandler.instance().fixDescription(this.field_148301_e.serverMOTD), listWidth - 48 - 2); + + for (int l1 = 0; l1 < Math.min(list.size(), 2); ++l1) + { +++++ END PATCH +++++ REJECTED PATCH 2 + int k2 = mouseX - x; + int l2 = mouseY - y; + ++ String tooltip = net.minecraftforge.fml.client.FMLClientHandler.instance().enhanceServerListEntry(this, this.field_148301_e, x, listWidth, y, k2, l2); ++ if (tooltip != null) ++ { ++ this.field_148303_c.func_146793_a(tooltip); ++ } else + if (k2 >= listWidth - 15 && k2 <= listWidth - 5 && l2 >= 0 && l2 <= 8) + { + this.field_148303_c.func_146793_a(s1); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch.rej new file mode 100644 index 0000000000..79ff66de36 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch.rej @@ -0,0 +1,19 @@ +++++ REJECTED PATCH 1 + super(mcIn, GuiStats.this.width, GuiStats.this.height, 32, GuiStats.this.height - 64, GuiStats.this.fontRendererObj.FONT_HEIGHT * 4); + this.setShowSelectionBox(false); + Iterator iterator = EntityList.entityEggs.values().iterator(); ++ iterator = com.google.common.collect.Iterators.concat(iterator, net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().values().iterator()); + + while (iterator.hasNext()) + { +++++ END PATCH +++++ REJECTED PATCH 2 + protected void drawSlot(int entryID, int p_180791_2_, int p_180791_3_, int p_180791_4_, int p_180791_5_, int p_180791_6_) + { + EntityList.EntityEggInfo entityegginfo = (EntityList.EntityEggInfo)this.field_148222_l.get(entryID); +- String s = I18n.format("entity." + EntityList.getStringFromID(entityegginfo.spawnedID) + ".name", new Object[0]); ++ String s = I18n.format("entity." + entityegginfo.name + ".name", new Object[0]); + int k1 = GuiStats.this.field_146546_t.readStat(entityegginfo.field_151512_d); + int l1 = GuiStats.this.field_146546_t.readStat(entityegginfo.field_151513_e); + String s1 = I18n.format("stat.entityKills", new Object[] {Integer.valueOf(k1), s}); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch.rej new file mode 100644 index 0000000000..4db04b1028 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch.rej @@ -0,0 +1,171 @@ +++++ REJECTED PATCH 2 + return; + } + +- if (itemstack1 != null && itemstack2 != null && itemstack1.isItemEqual(itemstack2)) ++ if (itemstack1 != null && itemstack2 != null && itemstack1.isItemEqual(itemstack2) && ItemStack.areItemStackTagsEqual(itemstack1, itemstack2)) //Forge: Bugfix, Compare NBT data, allow for deletion of enchanted books, MC-12770 + { + if (clickedButton == 0) + { +++++ END PATCH +++++ REJECTED PATCH 5 + { + GuiContainerCreative.ContainerCreative containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots; + containercreative.itemList.clear(); ++ ++ CreativeTabs tab = CreativeTabs.creativeTabArray[selectedTabIndex]; ++ if (tab.hasSearchBar() && tab != CreativeTabs.tabAllSearch) ++ { ++ tab.displayAllReleventItems(containercreative.itemList); ++ updateFilteredItems(containercreative); ++ return; ++ } ++ + Iterator iterator = Item.itemRegistry.iterator(); + + while (iterator.hasNext()) +++++ END PATCH +++++ REJECTED PATCH 6 + item.getSubItems(item, (CreativeTabs)null, containercreative.itemList); + } + } ++ updateFilteredItems(containercreative); ++ } + ++ //split from above for custom search tabs ++ private void updateFilteredItems(GuiContainerCreative.ContainerCreative containercreative) ++ { ++ Iterator iterator; + Enchantment[] aenchantment = Enchantment.enchantmentsBookList; + int j = aenchantment.length; + ++ if (CreativeTabs.creativeTabArray[selectedTabIndex] != CreativeTabs.tabAllSearch) j = 0; //Forge: Don't add enchants to custom tabs. + for (int i = 0; i < j; ++i) + { + Enchantment enchantment = aenchantment[i]; +++++ END PATCH +++++ REJECTED PATCH 8 + { + CreativeTabs creativetabs = acreativetabs[k1]; + +- if (this.func_147049_a(creativetabs, l, i1)) ++ if (creativetabs != null && this.func_147049_a(creativetabs, l, i1)) + { + this.setCurrentCreativeTab(creativetabs); + return; +++++ END PATCH +++++ REJECTED PATCH 11 + + super.drawScreen(mouseX, mouseY, partialTicks); + CreativeTabs[] acreativetabs = CreativeTabs.creativeTabArray; +- int i2 = acreativetabs.length; ++ int start = tabPage * 10; ++ int i2 = Math.min(acreativetabs.length, ((tabPage + 1) * 10) + 2); ++ if (tabPage != 0) start += 2; ++ boolean rendered = false; + +- for (int j2 = 0; j2 < i2; ++j2) ++ for (int j2 = start; j2 < i2; ++j2) + { + CreativeTabs creativetabs = acreativetabs[j2]; + ++ 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(); + } +++++ END PATCH +++++ REJECTED PATCH 12 + int k = acreativetabs.length; + int l; + +- for (l = 0; l < k; ++l) ++ int start = tabPage * 10; ++ k = Math.min(acreativetabs.length, ((tabPage + 1) * 10 + 2)); ++ if (tabPage != 0) start += 2; ++ ++ for (l = start; l < k; ++l) + { + CreativeTabs creativetabs1 = acreativetabs[l]; + 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(); +++++ END PATCH +++++ REJECTED PATCH 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 k = p_147049_1_.getTabColumn(); + int l = 28 * k; + byte b0 = 0; +++++ END PATCH +++++ REJECTED PATCH 15 + } + + 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, b0); + this.zLevel = 100.0F; + this.itemRender.zLevel = 100.0F; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch.rej b/rejects/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch.rej new file mode 100644 index 0000000000..db68c865e1 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch.rej @@ -0,0 +1,23 @@ +++++ REJECTED PATCH 2 + else + { + worldclient.playAuxSFX(2001, pos, Block.getStateId(iblockstate)); +- boolean flag = worldclient.setBlockToAir(pos); ++ boolean flag = block1.removedByPlayer(worldclient, pos, mc.thePlayer, false); + + if (flag) + { +++++ END PATCH +++++ REJECTED PATCH 5 + { + playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = itemstack1; + +- if (itemstack1.stackSize == 0) ++ if (itemstack1.stackSize <= 0) + { + playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = null; ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(playerIn, itemstack1); + } + + return true; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch.rej b/rejects/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch.rej new file mode 100644 index 0000000000..682151693c --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch.rej @@ -0,0 +1,11 @@ +++++ REJECTED PATCH 2 + public void handleSpawnExperienceOrb(S11PacketSpawnExperienceOrb packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); +- EntityXPOrb entityxporb = new EntityXPOrb(this.clientWorldController, (double)packetIn.func_148984_d(), (double)packetIn.func_148983_e(), (double)packetIn.func_148982_f(), packetIn.func_148986_g()); ++ EntityXPOrb entityxporb = new EntityXPOrb(this.clientWorldController, (double)packetIn.func_148984_d() / 32.0D, (double)packetIn.func_148983_e() / 32.0D, (double)packetIn.func_148982_f() / 32.0D, packetIn.func_148986_g()); ++ // FORGE: BugFix MC-12013 Wrong XP orb clientside spawn position + entityxporb.serverPosX = packetIn.func_148984_d(); + entityxporb.serverPosY = packetIn.func_148983_e(); + entityxporb.serverPosZ = packetIn.func_148982_f(); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/network/OldServerPinger.java.patch.rej b/rejects/minecraft/net/minecraft/client/network/OldServerPinger.java.patch.rej new file mode 100644 index 0000000000..0d7f4a3ed9 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/network/OldServerPinger.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 1 + server.setBase64EncodedIconData((String)null); + } + ++ net.minecraftforge.fml.client.FMLClientHandler.instance().bindServerListData(server, serverstatusresponse); + this.field_175092_e = Minecraft.getSystemTime(); + networkmanager.sendPacket(new C01PacketPing(this.field_175092_e)); + this.field_147403_d = true; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch.rej new file mode 100644 index 0000000000..6b6d1c44d8 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 1 + return new ModelResourceLocation(s + "_double_slab", s1); + } + }); ++ net.minecraftforge.client.model.ModelLoader.onRegisterAllBlocks(this); + } + + @SideOnly(Side.CLIENT) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch.rej new file mode 100644 index 0000000000..6113b99db1 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch.rej @@ -0,0 +1,73 @@ +++++ REJECTED PATCH 1 + + if (d3 < d2 || d2 == 0.0D) + { +- if (entity1 == entity.ridingEntity) ++ if (entity1 == entity.ridingEntity && !entity.canRiderInteract()) + { + if (d2 == 0.0D) + { +++++ END PATCH +++++ REJECTED PATCH 4 + + try + { +- this.mc.currentScreen.drawScreen(l, i1, partialTicks); ++ net.minecraftforge.client.ForgeHooksClient.drawScreen(this.mc.currentScreen, l, i1, partialTicks); + } + catch (Throwable throwable) + { +++++ END PATCH +++++ REJECTED PATCH 6 + GlStateManager.pushMatrix(); + RenderHelper.enableStandardItemLighting(); + this.mc.mcProfiler.endStartSection("entities"); ++ net.minecraftforge.client.ForgeHooksClient.setRenderPass(0); + renderglobal.renderEntities(entity, frustum, partialTicks); ++ net.minecraftforge.client.ForgeHooksClient.setRenderPass(0); + RenderHelper.disableStandardItemLighting(); + this.disableLightmap(); + GlStateManager.matrixMode(5888); +++++ END PATCH +++++ REJECTED PATCH 8 + entityplayer = (EntityPlayer)entity; + GlStateManager.disableAlpha(); + this.mc.mcProfiler.endStartSection("outline"); ++ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer, mc.objectMouseOver, 0, entityplayer.getHeldItem(), partialTicks)) + renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, partialTicks); + GlStateManager.enableAlpha(); + } +++++ END PATCH +++++ REJECTED PATCH 9 + renderglobal.renderBlockLayer(EnumWorldBlockLayer.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, frustum, partialTicks); ++ net.minecraftforge.client.ForgeHooksClient.setRenderPass(-1); ++ RenderHelper.disableStandardItemLighting(); ++ } ++ + GlStateManager.shadeModel(7424); + GlStateManager.depthMask(true); + GlStateManager.enableCull(); +++++ END PATCH +++++ REJECTED PATCH 11 + + 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 f1 = this.mc.theWorld.getRainStrength(partialTicks); + + if (f1 > 0.0F) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch.rej new file mode 100644 index 0000000000..eb1f673306 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch.rej @@ -0,0 +1,21 @@ +++++ REJECTED PATCH 2 + + if (this.mc.thePlayer.isEntityInsideOpaqueBlock()) + { +- IBlockState iblockstate = this.mc.theWorld.getBlockState(new BlockPos(this.mc.thePlayer)); ++ BlockPos blockpos = new BlockPos(this.mc.thePlayer); ++ IBlockState iblockstate = this.mc.theWorld.getBlockState(blockpos); + EntityPlayerSP entityplayersp = this.mc.thePlayer; + + for (int i = 0; i < 8; ++i) +++++ END PATCH +++++ REJECTED PATCH 3 + double d0 = entityplayersp.posX + (double)(((float)((i >> 0) % 2) - 0.5F) * entityplayersp.width * 0.8F); + double d1 = entityplayersp.posY + (double)(((float)((i >> 1) % 2) - 0.5F) * 0.1F); + double d2 = entityplayersp.posZ + (double)(((float)((i >> 2) % 2) - 0.5F) * entityplayersp.width * 0.8F); +- BlockPos blockpos = new BlockPos(d0, d1 + (double)entityplayersp.getEyeHeight(), d2); ++ blockpos = new BlockPos(d0, d1 + (double)entityplayersp.getEyeHeight(), d2); + IBlockState iblockstate1 = this.mc.theWorld.getBlockState(blockpos); + + if (iblockstate1.getBlock().isVisuallyOpaque()) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch.rej new file mode 100644 index 0000000000..d5840df65c --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch.rej @@ -0,0 +1,70 @@ +++++ REJECTED PATCH 2 + 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) // no indentation to shrink patch ++ { + this.countEntitiesTotal = 0; + this.countEntitiesRendered = 0; + this.countEntitiesHidden = 0; ++ } + Entity entity1 = this.mc.getRenderViewEntity(); + double d3 = entity1.lastTickPosX + (entity1.posX - entity1.lastTickPosX) * (double)partialTicks; + double d4 = entity1.lastTickPosY + (entity1.posY - entity1.lastTickPosY) * (double)partialTicks; +++++ END PATCH +++++ REJECTED PATCH 3 + this.mc.entityRenderer.enableLightmap(); + this.theWorld.theProfiler.endStartSection("global"); + List list = this.theWorld.getLoadedEntityList(); ++ if (pass == 0) // no indentation to shrink patch ++ { + this.countEntitiesTotal = list.size(); ++ } + int i; + Entity entity2; + + for (i = 0; i < this.theWorld.weatherEffects.size(); ++i) + { + entity2 = (Entity)this.theWorld.weatherEffects.get(i); ++ if (!entity2.shouldRenderInPass(pass)) continue; + ++this.countEntitiesRendered; + + if (entity2.isInRangeToRender3d(d0, d1, d2)) +++++ END PATCH +++++ REJECTED PATCH 4 + for (i = 0; i < list.size(); ++i) + { + entity2 = (Entity)list.get(i); ++ if (!entity2.shouldRenderInPass(pass)) continue; + boolean flag = this.mc.getRenderViewEntity() instanceof EntityLivingBase && ((EntityLivingBase)this.mc.getRenderViewEntity()).isPlayerSleeping(); + boolean flag1 = entity2.isInRangeToRender3d(d0, d1, d2) && (entity2.ignoreFrustumCheck || p_180446_2_.isBoundingBoxInFrustum(entity2.getEntityBoundingBox()) || entity2.riddenByEntity == this.mc.thePlayer) && entity2 instanceof EntityPlayer; + +++++ END PATCH +++++ REJECTED PATCH 5 + while (iterator2.hasNext()) + { + Entity entity3 = (Entity)iterator2.next(); ++ if (!entity3.shouldRenderInPass(pass)) continue; + boolean flag2 = this.renderManager.shouldRender(entity3, p_180446_2_, d0, d1, d2) || entity3.riddenByEntity == this.mc.thePlayer; + + if (flag2) +++++ END PATCH +++++ REJECTED PATCH 6 + while (iterator1.hasNext()) + { + tileentity = (TileEntity)iterator1.next(); ++ if (!tileentity.shouldRenderInPass(pass) || !p_180446_2_.isBoundingBoxInFrustum(tileentity.getRenderBoundingBox())) continue; + TileEntityRendererDispatcher.instance.renderTileEntity(tileentity, partialTicks, -1); + } + } +++++ END PATCH +++++ REJECTED PATCH 7 + + Block block = this.theWorld.getBlockState(blockpos).getBlock(); + +- if (tileentity != null && (block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull)) ++ if (tileentity != null && tileentity.shouldRenderInPass(pass) && tileentity.canRenderBreaking() && p_180446_2_.isBoundingBoxInFrustum(tileentity.getRenderBoundingBox())) + { + TileEntityRendererDispatcher.instance.renderTileEntity(tileentity, partialTicks, destroyblockprogress.getPartialBlockDamage()); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch.rej new file mode 100644 index 0000000000..0d3d3d9fa8 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch.rej @@ -0,0 +1,70 @@ +++++ REJECTED PATCH 1 + + while (iterator.hasNext()) + { ++ // moved to VertexFormatElement.preDraw + vertexformatelement = (VertexFormatElement)iterator.next(); +- enumusage = vertexformatelement.getUsage(); +- k = vertexformatelement.getType().getGlConstant(); +- int l = vertexformatelement.getIndex(); +- +- switch (WorldVertexBufferUploader.SwitchEnumUsage.VALUES[enumusage.ordinal()]) +- { +- case 1: +- bytebuffer.position(vertexformatelement.getOffset()); +- GL11.glVertexPointer(vertexformatelement.getElementCount(), k, j, bytebuffer); +- GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); +- break; +- case 2: +- bytebuffer.position(vertexformatelement.getOffset()); +- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + l); +- GL11.glTexCoordPointer(vertexformatelement.getElementCount(), k, j, bytebuffer); +- GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); +- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); +- break; +- case 3: +- bytebuffer.position(vertexformatelement.getOffset()); +- GL11.glColorPointer(vertexformatelement.getElementCount(), k, j, bytebuffer); +- GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); +- break; +- case 4: +- bytebuffer.position(vertexformatelement.getOffset()); +- GL11.glNormalPointer(k, j, bytebuffer); +- GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY); +- } ++ vertexformatelement.getUsage().preDraw(vertexformatelement, j, bytebuffer); + } + + GL11.glDrawArrays(p_178177_1_.getDrawMode(), 0, p_178177_1_.getVertexCount()); +++++ END PATCH +++++ REJECTED PATCH 2 + + while (iterator.hasNext()) + { ++ // moved to VertexFormatElement.postDraw + vertexformatelement = (VertexFormatElement)iterator.next(); +- enumusage = vertexformatelement.getUsage(); +- k = vertexformatelement.getIndex(); +- +- switch (WorldVertexBufferUploader.SwitchEnumUsage.VALUES[enumusage.ordinal()]) +- { +- case 1: +- GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); +- break; +- case 2: +- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + k); +- GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); +- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); +- break; +- case 3: +- GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); +- GlStateManager.resetColor(); +- break; +- case 4: +- GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY); +- } ++ vertexformatelement.getUsage().postDraw(vertexformatelement, j, bytebuffer); + } + } + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch.rej new file mode 100644 index 0000000000..a93e375041 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch.rej @@ -0,0 +1,57 @@ +++++ REJECTED PATCH 2 + this.func_178408_a(aint, enumfacing1); + } + ++ net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, enumfacing1); + return new BakedQuad(aint, face.tintIndex, enumfacing1); + } + + private int[] makeQuadVertexData(BlockPartFace p_178405_1_, TextureAtlasSprite p_178405_2_, EnumFacing p_178405_3_, float[] p_178405_4_, ModelRotation p_178405_5_, BlockPartRotation p_178405_6_, boolean p_178405_7_, boolean shade) + { ++ return makeQuadVertexData(p_178405_1_, p_178405_2_, p_178405_3_, p_178405_4_, (net.minecraftforge.client.model.ITransformation)p_178405_5_, p_178405_6_, p_178405_7_, shade); ++ } ++ ++ private int[] makeQuadVertexData(BlockPartFace p_178405_1_, TextureAtlasSprite p_178405_2_, EnumFacing p_178405_3_, float[] p_178405_4_, net.minecraftforge.client.model.ITransformation p_178405_5_, BlockPartRotation p_178405_6_, boolean p_178405_7_, boolean shade) ++ { + int[] aint = new int[28]; + + for (int i = 0; i < 4; ++i) +++++ END PATCH +++++ REJECTED PATCH 3 + + private void fillVertexData(int[] faceData, int vertexIndex, EnumFacing facing, BlockPartFace partFace, float[] p_178402_5_, TextureAtlasSprite sprite, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) + { +- EnumFacing enumfacing1 = modelRotationIn.rotateFace(facing); ++ fillVertexData(faceData, vertexIndex, facing, partFace, p_178402_5_, sprite, (net.minecraftforge.client.model.ITransformation)modelRotationIn, partRotation, uvLocked, shade); ++ } ++ ++ private void fillVertexData(int[] faceData, int vertexIndex, EnumFacing facing, BlockPartFace partFace, float[] p_178402_5_, TextureAtlasSprite sprite, net.minecraftforge.client.model.ITransformation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) ++ { ++ EnumFacing enumfacing1 = modelRotationIn.rotate(facing); + int j = shade ? this.getFaceShadeColor(enumfacing1) : -1; + EnumFaceDirection.VertexInformation vertexinformation = EnumFaceDirection.getFacing(facing).func_179025_a(vertexIndex); + Vector3d vector3d = new Vector3d((double)p_178402_5_[vertexinformation.field_179184_a], (double)p_178402_5_[vertexinformation.field_179182_b], (double)p_178402_5_[vertexinformation.field_179183_c]); +++++ END PATCH +++++ REJECTED PATCH 4 + + public int rotateVertex(Vector3d position, EnumFacing facing, int vertexIndex, ModelRotation modelRotationIn, boolean uvLocked) + { ++ return rotateVertex(position, facing, vertexIndex, (net.minecraftforge.client.model.ITransformation)modelRotationIn, uvLocked); ++ } ++ ++ public int rotateVertex(Vector3d position, EnumFacing facing, int vertexIndex, net.minecraftforge.client.model.ITransformation modelRotationIn, boolean uvLocked) ++ { + if (modelRotationIn == ModelRotation.X0_Y0) + { + return vertexIndex; + } + else + { +- this.rotateScale(position, new Vector3d(0.5D, 0.5D, 0.5D), modelRotationIn.getMatrix4d(), new Vector3d(1.0D, 1.0D, 1.0D)); +- return modelRotationIn.rotateVertex(facing, vertexIndex); ++ net.minecraftforge.client.ForgeHooksClient.transform(position, modelRotationIn.getMatrix()); ++ return modelRotationIn.rotate(facing, vertexIndex); + } + } + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch.rej new file mode 100644 index 0000000000..c1c645ac6a --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + } + else + { +- s = this.property.getName((Comparable)linkedhashmap.remove(this.property)); ++ s = String.format("%s:%s", ((ResourceLocation)Block.blockRegistry.getNameForObject(p_178132_1_.getBlock())).getResourceDomain(), this.property.getName((Comparable)linkedhashmap.remove(this.property))); + } + + if (this.suffix != null) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch.rej new file mode 100644 index 0000000000..73ee667f88 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch.rej @@ -0,0 +1,22 @@ +++++ REJECTED PATCH 1 + return; + } + +- regionrendercache = new RegionRenderCache(this.world, blockpos.add(-1, -1, -1), blockpos1.add(1, 1, 1), 1); ++ regionrendercache = createRegionRenderCache(this.world, blockpos.add(-1, -1, -1), blockpos1.add(1, 1, 1), 1); + p_178581_4_.setCompiledChunk(compiledchunk); + } + finally +++++ END PATCH +++++ REJECTED PATCH 3 + } + } + +- EnumWorldBlockLayer enumworldblocklayer1 = block.getBlockLayer(); ++ for(EnumWorldBlockLayer enumworldblocklayer1 : EnumWorldBlockLayer.values()) { ++ if(!block.canRenderInLayer(enumworldblocklayer1)) continue; ++ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(enumworldblocklayer1); + int i = enumworldblocklayer1.ordinal(); + + if (block.getRenderType() != -1) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch.rej new file mode 100644 index 0000000000..06899dd6ee --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch.rej @@ -0,0 +1,26 @@ +++++ REJECTED PATCH 1 + boolean flag = p_177077_9_.isGui3d(); + int i = this.func_177078_a(itemstack); + float f1 = 0.25F; +- float f2 = MathHelper.sin(((float)p_177077_1_.getAge() + p_177077_8_) / 10.0F + p_177077_1_.hoverStart) * 0.1F + 0.1F; ++ float f2 = shouldBob() ? MathHelper.sin(((float)p_177077_1_.getAge() + p_177077_8_) / 10.0F + p_177077_1_.hoverStart) * 0.1F + 0.1F : 0.0F; + GlStateManager.translate((float)p_177077_2_, (float)p_177077_4_ + f2 + 0.25F, (float)p_177077_6_); + float f3; + +++++ END PATCH +++++ REJECTED PATCH 2 + } + else + { ++ // Makes items offset when in 3D, like when in 2D, looks much better. Considered a vanilla bug... ++ if (j > 0 && shouldSpreadItems()) ++ { ++ float f2 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; ++ float f3 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; ++ float f4 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; ++ GlStateManager.translate(f2, f3, 0); ++ } + this.field_177080_a.renderItem(itemstack, ibakedmodel); + GlStateManager.translate(0.0F, 0.0F, 0.046875F); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch.rej new file mode 100644 index 0000000000..4bf581bd06 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch.rej @@ -0,0 +1,113 @@ +++++ REJECTED PATCH 2 + BakedQuad bakedquad; + int j; + +- for (Iterator iterator = quads.iterator(); iterator.hasNext(); this.renderQuad(renderer, bakedquad, j)) ++ for (Iterator iterator = quads.iterator(); iterator.hasNext(); net.minecraftforge.client.model.pipeline.LightUtil.renderQuadColor(renderer, bakedquad, j)) + { + bakedquad = (BakedQuad)iterator.next(); + j = color; +++++ END PATCH +++++ REJECTED PATCH 4 + + protected void applyTransform(ItemTransformVec3f transform) + { ++ applyVanillaTransform(transform); ++ } ++ ++ public static void applyVanillaTransform(ItemTransformVec3f transform) ++ { + if (transform != ItemTransformVec3f.DEFAULT) + { + GlStateManager.translate(transform.translation.x + debugItemOffsetX, transform.translation.y + debugItemOffsetY, transform.translation.z + debugItemOffsetZ); +++++ END PATCH +++++ REJECTED PATCH 5 + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.pushMatrix(); + +- switch (RenderItem.SwitchTransformType.TRANSFORM_LOOKUP[cameraTransformType.ordinal()]) +- { +- case 1: +- default: +- break; +- case 2: +- this.applyTransform(model.getItemCameraTransforms().thirdPerson); +- break; +- case 3: +- this.applyTransform(model.getItemCameraTransforms().firstPerson); +- break; +- case 4: +- this.applyTransform(model.getItemCameraTransforms().head); +- break; +- case 5: +- this.applyTransform(model.getItemCameraTransforms().gui); +- } ++ model = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(model, cameraTransformType); + + this.renderItem(stack, model); + GlStateManager.popMatrix(); +++++ END PATCH +++++ REJECTED PATCH 6 + GlStateManager.blendFunc(770, 771); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.setupGuiTransform(x, y, ibakedmodel.isGui3d()); +- this.applyTransform(ibakedmodel.getItemCameraTransforms().gui); ++ ibakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GUI); + this.renderItem(stack, ibakedmodel); + GlStateManager.disableAlpha(); + GlStateManager.disableRescaleNormal(); +++++ END PATCH +++++ REJECTED PATCH 7 + GlStateManager.enableDepth(); + } + +- if (stack.isItemDamaged()) ++ if (stack.getItem().showDurabilityBar(stack)) + { +- int j1 = (int)Math.round(13.0D - (double)stack.getItemDamage() * 13.0D / (double)stack.getMaxDamage()); +- int k = (int)Math.round(255.0D - (double)stack.getItemDamage() * 255.0D / (double)stack.getMaxDamage()); ++ double health = stack.getItem().getDurabilityForDisplay(stack); ++ int j1 = (int)Math.round(13.0D - health * 13.0D); ++ int k = (int)Math.round(255.0D - health * 255.0D); + GlStateManager.disableLighting(); + GlStateManager.disableDepth(); + GlStateManager.disableTexture2D(); +++++ END PATCH +++++ REJECTED PATCH 8 + this.drawRect(worldrenderer, xPosition + 2, yPosition + 13, 13, 2, 0); + this.drawRect(worldrenderer, xPosition + 2, yPosition + 13, 12, 1, i1); + this.drawRect(worldrenderer, xPosition + 2, yPosition + 13, j1, 1, l); +- GlStateManager.enableBlend(); ++ //GlStateManager.enableBlend(); // Forge: Disable Bled because it screws with a lot of things down the line. + GlStateManager.enableAlpha(); + GlStateManager.enableTexture2D(); + GlStateManager.enableLighting(); +++++ END PATCH +++++ REJECTED PATCH 9 + this.registerBlock(Blocks.brown_mushroom_block, BlockHugeMushroom.EnumType.ALL_INSIDE.getMetadata(), "brown_mushroom_block"); + this.registerBlock(Blocks.red_mushroom_block, BlockHugeMushroom.EnumType.ALL_INSIDE.getMetadata(), "red_mushroom_block"); + this.registerBlock(Blocks.dragon_egg, "dragon_egg"); ++ net.minecraftforge.client.model.ModelLoader.onRegisterItems(this.itemModelMesher); + } + + public void onResourceManagerReload(IResourceManager resourceManager) + { + this.itemModelMesher.rebuildCache(); + } ++ /*==================================== FORGE START ===========================================* / ++ private static RenderItem instance; ++ /** ++ * Returns a single lazy loaded instance of RenderItem, for use in mods who ++ * don't care about the interaction of other objects on the current state of the RenderItem they are using. ++ * @return A global instance of RenderItem ++ * / ++ public static RenderItem getInstance() ++ { ++ if (instance == null) instance = new RenderItem(); ++ return instance; ++ } ++ /*==================================== FORGE END =============================================*/ + + @SideOnly(Side.CLIENT) + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch.rej new file mode 100644 index 0000000000..1cd962de4b --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 1 + + public void func_180596_a(AbstractClientPlayer p_180596_1_, double p_180596_2_, double p_180596_4_, double p_180596_6_, float p_180596_8_, float p_180596_9_) + { ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Pre(p_180596_1_, this, p_180596_9_, p_180596_2_, p_180596_4_, p_180596_6_))) return; + if (!p_180596_1_.isUser() || this.renderManager.livingPlayer == p_180596_1_) + { + double d3 = p_180596_4_; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch.rej new file mode 100644 index 0000000000..6d8c9bea47 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch.rej @@ -0,0 +1,14 @@ +++++ REJECTED PATCH 4 + + public void passSpecialRender(EntityLivingBase p_77033_1_, double p_77033_2_, double p_77033_4_, double p_77033_6_) + { ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Pre(p_77033_1_, this, p_77033_2_, p_77033_4_, p_77033_6_))) return; + if (this.canRenderName(p_77033_1_)) + { + double d3 = p_77033_1_.getDistanceSqToEntity(this.renderManager.livingPlayer); +- float f = p_77033_1_.isSneaking() ? 32.0F : 64.0F; ++ float f = p_77033_1_.isSneaking() ? NAME_TAG_RANGE_SNEAK : NAME_TAG_RANGE; + + if (d3 < (double)(f * f)) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch.rej new file mode 100644 index 0000000000..e50d4cdfc2 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch.rej @@ -0,0 +1,88 @@ +++++ REJECTED PATCH 1 + ModelBase modelbase = this.func_177175_a(p_177182_9_); + modelbase.setModelAttributes(this.field_177190_a.getMainModel()); + modelbase.setLivingAnimations(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_4_); ++ modelbase = net.minecraftforge.client.ForgeHooksClient.getArmorModel(p_177182_1_, itemstack, p_177182_9_, modelbase); + this.func_177179_a(modelbase, p_177182_9_); + boolean flag = this.func_177180_b(p_177182_9_); +- this.field_177190_a.bindTexture(this.getArmorResource(itemarmor, flag)); ++ this.field_177190_a.bindTexture(this.getArmorResource(p_177182_1_, itemstack, flag ? 2 : 1, null)); + +- switch (LayerArmorBase.SwitchArmorMaterial.field_178747_a[itemarmor.getArmorMaterial().ordinal()]) + { +- case 1: +- int j = itemarmor.getColor(itemstack); ++ int j = itemarmor.getColor(itemstack); ++ if (j != -1) //Allow this for anything, not only cloth. ++ { + float f7 = (float)(j >> 16 & 255) / 255.0F; + float f8 = (float)(j >> 8 & 255) / 255.0F; + float f9 = (float)(j & 255) / 255.0F; + GlStateManager.color(this.field_177184_f * f7, this.field_177185_g * f8, this.field_177192_h * f9, this.field_177187_e); + modelbase.render(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); +- this.field_177190_a.bindTexture(this.getArmorResource(itemarmor, flag, "overlay")); +- case 2: +- case 3: +- case 4: +- case 5: ++ this.field_177190_a.bindTexture(this.getArmorResource(p_177182_1_, itemstack, flag ? 2 : 1, "overlay")); ++ } ++ { // Non-cloth + GlStateManager.color(this.field_177184_f, this.field_177185_g, this.field_177192_h, this.field_177187_e); + modelbase.render(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); +- default: ++ } ++ { // Default, Why is this a switch? there were no breaks. + if (!this.field_177193_i && itemstack.isItemEnchanted()) + { + this.func_177183_a(p_177182_1_, modelbase, p_177182_2_, p_177182_3_, p_177182_4_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); + } ++ } + } + } + } +++++ END PATCH +++++ REJECTED PATCH 3 + + protected abstract void func_177179_a(ModelBase p_177179_1_, int p_177179_2_); + ++ /*=================================== FORGE START =========================================*/ ++ /** ++ * 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, int slot, String type) ++ { ++ ItemArmor item = (ItemArmor)stack.getItem(); ++ String texture = ((ItemArmor)stack.getItem()).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, (slot == 2 ? 2 : 1), type == null ? "" : String.format("_%s", type)); ++ ++ s1 = net.minecraftforge.client.ForgeHooksClient.getArmorTexture(entity, stack, s1, slot, type); ++ ResourceLocation resourcelocation = (ResourceLocation)field_177191_j.get(s1); ++ ++ if (resourcelocation == null) ++ { ++ resourcelocation = new ResourceLocation(s1); ++ field_177191_j.put(s1, resourcelocation); ++ } ++ ++ return resourcelocation; ++ } ++ /*=================================== FORGE END ===========================================*/ ++ + @SideOnly(Side.CLIENT) + + static final class SwitchArmorMaterial +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch.rej new file mode 100644 index 0000000000..6f2b2d715f --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch.rej @@ -0,0 +1,25 @@ +++++ REJECTED PATCH 1 + public void doStitch() + { + Stitcher.Holder[] aholder = (Stitcher.Holder[])this.setStitchHolders.toArray(new Stitcher.Holder[this.setStitchHolders.size()]); ++ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Texture stitching", aholder.length); + Arrays.sort(aholder); + Stitcher.Holder[] aholder1 = aholder; + int i = aholder.length; +++++ END PATCH +++++ REJECTED PATCH 2 + for (int j = 0; j < i; ++j) + { + Stitcher.Holder holder = aholder1[j]; ++ bar.step(holder.getAtlasSprite().getIconName()); + + if (!this.allocateSlot(holder)) + { + String s = String.format("Unable to fit: %s - size: %dx%d - Maybe try a lowerresolution resourcepack?", new Object[] {holder.getAtlasSprite().getIconName(), Integer.valueOf(holder.getAtlasSprite().getIconWidth()), Integer.valueOf(holder.getAtlasSprite().getIconHeight())}); ++ net.minecraftforge.fml.common.FMLLog.info(s); ++ for (Stitcher.Holder h : aholder) ++ net.minecraftforge.fml.common.FMLLog.info(" %s", h); + throw new StitcherException(holder, s); + } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch.rej new file mode 100644 index 0000000000..9d314e062c --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch.rej @@ -0,0 +1,17 @@ +++++ REJECTED PATCH 1 + + 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); + Iterator iterator = this.mapTextureObjects.entrySet().iterator(); + + while (iterator.hasNext()) + { + Entry entry = (Entry)iterator.next(); ++ bar.step(entry.getKey().toString()); + this.loadTexture((ResourceLocation)entry.getKey(), (ITextureObject)entry.getValue()); + } ++ net.minecraftforge.fml.common.ProgressManager.pop(bar); + } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch.rej new file mode 100644 index 0000000000..05280aa760 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch.rej @@ -0,0 +1,118 @@ +++++ REJECTED PATCH 3 + + 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() +++++ END PATCH +++++ REJECTED PATCH 4 + this.listAnimatedSprites.clear(); + 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()); + Iterator iterator = this.mapRegisteredSprites.entrySet().iterator(); + +- while (iterator.hasNext()) ++ while (!skipFirst && iterator.hasNext()) + { + Entry entry = (Entry)iterator.next(); + TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)entry.getValue(); + ResourceLocation resourcelocation = new ResourceLocation(textureatlassprite.getIconName()); + ResourceLocation resourcelocation1 = this.completeResourceLocation(resourcelocation, 0); ++ bar.step(resourcelocation1.getResourcePath()); + ++ if (textureatlassprite.hasCustomLoader(resourceManager, resourcelocation)) ++ { ++ if (!textureatlassprite.load(resourceManager, resourcelocation)) ++ { ++ j = Math.min(j, Math.min(textureatlassprite.getIconWidth(), textureatlassprite.getIconHeight())); ++ stitcher.addSprite(textureatlassprite); ++ } ++ continue; ++ } ++ + try + { + IResource iresource = resourceManager.getResource(resourcelocation1); +++++ END PATCH +++++ REJECTED PATCH 5 + } + catch (RuntimeException runtimeexception) + { +- logger.error("Unable to parse metadata from " + resourcelocation1, runtimeexception); ++ //logger.error("Unable to parse metadata from " + resourcelocation1, runtimeexception); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().trackBrokenTexture(resourcelocation1, runtimeexception.getMessage()); + continue; + } + catch (IOException ioexception1) + { +- logger.error("Using missing texture, unable to load " + resourcelocation1, ioexception1); ++ //logger.error("Using missing texture, unable to load " + resourcelocation1, ioexception1); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().trackMissingTexture(resourcelocation1); + continue; + } + +++++ END PATCH +++++ REJECTED PATCH 7 + } + + Iterator iterator1 = this.mapRegisteredSprites.values().iterator(); ++ bar = net.minecraftforge.fml.common.ProgressManager.push("Mipmap generation", skipFirst ? 0 : this.mapRegisteredSprites.size()); + +- while (iterator1.hasNext()) ++ while (!skipFirst && iterator1.hasNext()) + { + final TextureAtlasSprite textureatlassprite1 = (TextureAtlasSprite)iterator1.next(); ++ bar.step(textureatlassprite1.getIconName()); + + try + { +++++ END PATCH +++++ REJECTED PATCH 9 + } + + 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()); + HashMap hashmap = Maps.newHashMap(this.mapRegisteredSprites); + Iterator iterator2 = stitcher.getStichSlots().iterator(); + TextureAtlasSprite textureatlassprite2; + ++ bar.step("Uploading GL texture"); + while (iterator2.hasNext()) + { + textureatlassprite2 = (TextureAtlasSprite)iterator2.next(); +++++ END PATCH +++++ REJECTED PATCH 10 + textureatlassprite2.copyFrom(this.missingImage); + } + ++ net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPost(this); ++ ++ 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 ResourceLocation completeResourceLocation(ResourceLocation location, int p_147634_2_) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch.rej new file mode 100644 index 0000000000..3bb0ba7b25 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch.rej @@ -0,0 +1,49 @@ +++++ REJECTED PATCH 1 + @SideOnly(Side.CLIENT) + public static enum EnumType + { +- FLOAT(4, "Float", 5126), +- UBYTE(1, "Unsigned Byte", 5121), +- BYTE(1, "Byte", 5120), +- USHORT(2, "Unsigned Short", 5123), +- SHORT(2, "Short", 5122), +- UINT(4, "Unsigned Int", 5125), +- INT(4, "Int", 5124); ++ FLOAT(4, "Float", org.lwjgl.opengl.GL11.GL_FLOAT), ++ UBYTE(1, "Unsigned Byte", org.lwjgl.opengl.GL11.GL_UNSIGNED_BYTE), ++ BYTE(1, "Byte", org.lwjgl.opengl.GL11.GL_BYTE), ++ USHORT(2, "Unsigned Short", org.lwjgl.opengl.GL11.GL_UNSIGNED_SHORT), ++ SHORT(2, "Short", org.lwjgl.opengl.GL11.GL_SHORT), ++ UINT(4, "Unsigned Int", org.lwjgl.opengl.GL11.GL_UNSIGNED_INT), ++ INT(4, "Int", org.lwjgl.opengl.GL11.GL_INT); ++ // Commented for now, might be added in the future if anyone needs them ++ //HALF_FLOAT(2, "Half Float", org.lwjgl.opengl.GL30.GL_HALF_FLOAT), ++ //DOUBLE(8, "Double", org.lwjgl.opengl.GL11.GL_DOUBLE), ++ //INT_2_10_10_10_REV(4, "Int 2-10-10-10 reversed", org.lwjgl.opengl.GL33.GL_INT_2_10_10_10_REV), ++ //UINT_2_10_10_10_REV(4, "Unsigned Int 2-10-10-10 reversed", org.lwjgl.opengl.GL12.GL_UNSIGNED_INT_2_10_10_10_REV), ++ //UINT_10F_11F_11F_REV(4, "Unsigned Int 10F 11F 11F reversed", GL_UNSIGNED_INT_10F_11F_11F_REV); ++ + private final int size; + private final String displayName; + private final int glConstant; +++++ END PATCH +++++ REJECTED PATCH 2 + NORMAL("Normal"), + COLOR("Vertex Color"), + UV("UV"), ++ // As of 1.8 - unused in vanilla; use GENERIC for now ++ @Deprecated + MATRIX("Bone Matrix"), ++ @Deprecated + BLEND_WEIGHT("Blend Weight"), +- PADDING("Padding"); ++ PADDING("Padding"), ++ GENERIC("Generic Attribute"); ++ ++ public void preDraw(VertexFormatElement element, int stride, java.nio.ByteBuffer buffer) { net.minecraftforge.client.ForgeHooksClient.preDraw(this, element, stride, buffer); } ++ public void postDraw(VertexFormatElement element, int stride, java.nio.ByteBuffer buffer) { net.minecraftforge.client.ForgeHooksClient.postDraw(this, element, stride, buffer); } ++ + private final String displayName; + + private static final String __OBFID = "CL_00002397"; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/resources/LanguageManager.java.patch.rej b/rejects/minecraft/net/minecraft/client/resources/LanguageManager.java.patch.rej new file mode 100644 index 0000000000..5a48fdf7a9 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/resources/LanguageManager.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 1 + } + + currentLocale.loadLocaleDataFiles(resourceManager, arraylist); ++ net.minecraftforge.fml.common.registry.LanguageRegistry.instance().mergeLanguageTable(currentLocale.properties, this.currentLanguage); + StringTranslate.replaceWith(currentLocale.properties); + } + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/resources/Locale.java.patch.rej b/rejects/minecraft/net/minecraft/client/resources/Locale.java.patch.rej new file mode 100644 index 0000000000..f93346344b --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/resources/Locale.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + + 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; + Iterator iterator = IOUtils.readLines(p_135021_1_, Charsets.UTF_8).iterator(); + + while (iterator.hasNext()) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch.rej b/rejects/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch.rej new file mode 100644 index 0000000000..ba37e24167 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch.rej @@ -0,0 +1,46 @@ +++++ REJECTED PATCH 1 + 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() + { + private static final String __OBFID = "CL_00001092"; +++++ END PATCH +++++ REJECTED PATCH 2 + while (iterator.hasNext()) + { + IResourcePack iresourcepack = (IResourcePack)iterator.next(); ++ resReload.step(iresourcepack.getPackName()); + this.reloadResourcePack(iresourcepack); + } + ++ resReload.step("Reloading listeners"); + this.notifyReloadListeners(); ++ net.minecraftforge.fml.common.ProgressManager.pop(resReload); + } + + public void registerReloadListener(IResourceManagerReloadListener p_110542_1_) + { + this.reloadListeners.add(p_110542_1_); ++ net.minecraftforge.fml.common.ProgressManager.ProgressBar resReload = net.minecraftforge.fml.common.ProgressManager.push("Loading Resource", 1); ++ resReload.step(p_110542_1_.getClass()); + p_110542_1_.onResourceManagerReload(this); ++ net.minecraftforge.fml.common.ProgressManager.pop(resReload); + } + + private void notifyReloadListeners() + { + Iterator iterator = this.reloadListeners.iterator(); + ++ net.minecraftforge.fml.common.ProgressManager.ProgressBar resReload = net.minecraftforge.fml.common.ProgressManager.push("Reloading", this.reloadListeners.size()); + while (iterator.hasNext()) + { + IResourceManagerReloadListener iresourcemanagerreloadlistener = (IResourceManagerReloadListener)iterator.next(); ++ resReload.step(iresourcemanagerreloadlistener.getClass()); + iresourcemanagerreloadlistener.onResourceManagerReload(this); + } ++ net.minecraftforge.fml.common.ProgressManager.pop(resReload); + } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/resources/SkinManager.java.patch.rej b/rejects/minecraft/net/minecraft/client/resources/SkinManager.java.patch.rej new file mode 100644 index 0000000000..7dc5509d7c --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/resources/SkinManager.java.patch.rej @@ -0,0 +1,12 @@ +++++ REJECTED PATCH 1 + + if (hashmap.isEmpty() && p_152790_1_.getId().equals(Minecraft.getMinecraft().getSession().getProfile().getId())) + { +- hashmap.putAll(SkinManager.this.sessionService.getTextures(SkinManager.this.sessionService.fillProfileProperties(p_152790_1_, false), false)); ++ // FORGE: Use already filled profile from session rather ++ // than getting rate limited by filling the input profile ++ hashmap.putAll(SkinManager.this.sessionService.getTextures(Minecraft.getMinecraft().getSession().getProfile(), false)); + } + + Minecraft.getMinecraft().addScheduledTask(new Runnable() +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch.rej b/rejects/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch.rej new file mode 100644 index 0000000000..76cbbcd2d7 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch.rej @@ -0,0 +1,17 @@ +++++ REJECTED PATCH 6 + 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())) + { + builder.addGeneralQuad(this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); + } + else + { +- builder.addFaceQuad(modelRotationIn.rotateFace(blockpartface.cullFace), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); ++ builder.addFaceQuad(modelRotationIn.rotate(blockpartface.cullFace), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); + } + } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch.rej b/rejects/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch.rej new file mode 100644 index 0000000000..a8730e0540 --- /dev/null +++ b/rejects/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch.rej @@ -0,0 +1,21 @@ +++++ REJECTED PATCH 3 + while (iterator.hasNext()) + { + Item item = (Item)iterator.next(); ++ if (item == null) ++ { ++ continue; ++ } + +- if (item != null && item.getCreativeTab() == this) ++ for (CreativeTabs tab : item.getCreativeTabs()) + { +- item.getSubItems(item, this, p_78018_1_); ++ if (tab == this) ++ { ++ item.getSubItems(item, this, p_78018_1_); ++ } + } + } + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/enchantment/Enchantment.java.patch.rej b/rejects/minecraft/net/minecraft/enchantment/Enchantment.java.patch.rej new file mode 100644 index 0000000000..d074e8eaac --- /dev/null +++ b/rejects/minecraft/net/minecraft/enchantment/Enchantment.java.patch.rej @@ -0,0 +1,55 @@ +++++ REJECTED PATCH 2 + + public boolean canApply(ItemStack stack) + { +- return this.type.canEnchantItem(stack.getItem()); ++ return canApplyAtEnchantingTable(stack); + } + + public void onEntityDamaged(EntityLivingBase user, Entity target, int level) {} + + public void onUserHurt(EntityLivingBase user, Entity attacker, int level) {} + ++ /** ++ * 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()); ++ } ++ ++ private static final java.lang.reflect.Field bookSetter = Enchantment.class.getDeclaredFields()[1]; ++ /** ++ * Add to the list of enchantments applicable by the anvil from a book ++ * ++ * @param enchantment ++ */ ++ public static void addToBookList(Enchantment enchantment) ++ { ++ try ++ { ++ net.minecraftforge.common.util.EnumHelper.setFailsafeFieldValue(bookSetter, null, ++ com.google.common.collect.ObjectArrays.concat(enchantmentsBookList, enchantment)); ++ } ++ catch (Exception e) ++ { ++ throw new RuntimeException(e); //Rethrow see what happens ++ } ++ } ++ ++ /** ++ * Is this enchantment allowed to be enchanted on books via Enchantment Table ++ * @return false to disable the vanilla feature ++ */ ++ public boolean isAllowedOnBooks() ++ { ++ return true; ++ } ++ + static + { + ArrayList var0 = Lists.newArrayList(); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch.rej b/rejects/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch.rej new file mode 100644 index 0000000000..974dff0f71 --- /dev/null +++ b/rejects/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch.rej @@ -0,0 +1,43 @@ +++++ REJECTED PATCH 1 + 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 k = item.getItemEnchantability(); ++ int k = item.getItemEnchantability(p_77514_3_); + + if (k <= 0) + { +++++ END PATCH +++++ REJECTED PATCH 2 + public static List buildEnchantmentList(Random p_77513_0_, ItemStack p_77513_1_, int p_77513_2_) + { + Item item = p_77513_1_.getItem(); +- int j = item.getItemEnchantability(); ++ int j = item.getItemEnchantability(p_77513_1_); + + if (j <= 0) + { +++++ END PATCH +++++ REJECTED PATCH 3 + { + EnchantmentData enchantmentdata1 = (EnchantmentData)iterator1.next(); + +- if (enchantmentdata1.enchantmentobj.canApplyTogether(Enchantment.getEnchantmentById(integer.intValue()))) ++ Enchantment e1 = enchantmentdata1.enchantmentobj; ++ Enchantment e2 = Enchantment.getEnchantmentById(integer.intValue()); ++ if (e1.canApplyTogether(e2) && e2.canApplyTogether(e1)) //Forge BugFix: Let Both enchantments veto being together + { + continue; + } +++++ END PATCH +++++ REJECTED PATCH 4 + { + Enchantment enchantment = aenchantment[k]; + +- if (enchantment != null && (enchantment.type.canEnchantItem(item) || flag)) ++ if (enchantment == null) continue; ++ if (enchantment.canApplyAtEnchantingTable(p_77505_1_) || ((item == Items.book) && enchantment.isAllowedOnBooks())) + { + for (int l = enchantment.getMinLevel(); l <= enchantment.getMaxLevel(); ++l) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/EntityList.java.patch.rej b/rejects/minecraft/net/minecraft/entity/EntityList.java.patch.rej new file mode 100644 index 0000000000..84a4fc1ab3 --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/EntityList.java.patch.rej @@ -0,0 +1,13 @@ +++++ REJECTED PATCH 2 + p_75615_0_.removeTag("Type"); + } + ++ Class oclass = null; + try + { +- Class oclass = (Class)stringToClassMapping.get(p_75615_0_.getString("id")); ++ oclass = (Class)stringToClassMapping.get(p_75615_0_.getString("id")); + + if (oclass != null) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/EntityLivingBase.java.patch.rej b/rejects/minecraft/net/minecraft/entity/EntityLivingBase.java.patch.rej new file mode 100644 index 0000000000..3399d9aee2 --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/EntityLivingBase.java.patch.rej @@ -0,0 +1,30 @@ +++++ REJECTED PATCH 1 + } + } + +- if (!this.worldObj.isRemote && this.isRiding() && this.ridingEntity instanceof EntityLivingBase) ++ if (!this.worldObj.isRemote && this.isRiding() && this.ridingEntity != null && ridingEntity.shouldDismountInWater(this)) + { + this.mountEntity((Entity)null); + } +++++ END PATCH +++++ REJECTED PATCH 2 + if (!this.worldObj.isRemote && (this.recentlyHit > 0 || this.isPlayer()) && this.func_146066_aG() && this.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot")) + { + i = this.getExperiencePoints(this.attackingPlayer); +- ++ i = net.minecraftforge.event.ForgeEventFactory.getExperienceDrop(this, this.attackingPlayer, i); + while (i > 0) + { + int j = EntityXPOrb.getXPSplit(i); +++++ END PATCH +++++ REJECTED PATCH 5 + + public void heal(float healAmount) + { ++ healAmount = net.minecraftforge.event.ForgeEventFactory.onLivingHeal(this, healAmount); ++ if (healAmount <= 0) return; + float f1 = this.getHealth(); + + if (f1 > 0.0F) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch.rej b/rejects/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch.rej new file mode 100644 index 0000000000..6ae31bd0f5 --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch.rej @@ -0,0 +1,16 @@ +++++ REJECTED PATCH 1 + private double field_151495_j; + private double field_151496_k; + private static final String __OBFID = "CL_00001595"; ++ private int failedPathFindingPenalty = 0; ++ private boolean canPenalize = false; + + public EntityAIAttackOnCollide(EntityCreature p_i1635_1_, Class p_i1635_2_, double p_i1635_3_, boolean p_i1635_5_) + { + this(p_i1635_1_, p_i1635_3_, p_i1635_5_); + this.classTarget = p_i1635_2_; ++ canPenalize = classTarget == null || !net.minecraft.entity.player.EntityPlayer.class.isAssignableFrom(classTarget); //Only enable delaying when not targeting players. + } + + public EntityAIAttackOnCollide(EntityCreature p_i1636_1_, double p_i1636_2_, boolean p_i1636_4_) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/boss/EntityWither.java.patch.rej b/rejects/minecraft/net/minecraft/entity/boss/EntityWither.java.patch.rej new file mode 100644 index 0000000000..30937f47eb --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/boss/EntityWither.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + int l = j1 + i2; + Block block = this.worldObj.getBlockState(new BlockPos(j2, k, l)).getBlock(); + +- if (block.getMaterial() != Material.air && block != Blocks.bedrock && block != Blocks.end_portal && block != Blocks.end_portal_frame && block != Blocks.command_block && block != Blocks.barrier) ++ if (!block.isAir(worldObj, new BlockPos(j2, k, l)) && block.canEntityDestroy(worldObj, new BlockPos(j2, k, l), this)) + { + flag = this.worldObj.destroyBlock(new BlockPos(j2, k, l), true) || flag; + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch.rej b/rejects/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch.rej new file mode 100644 index 0000000000..a4efeca136 --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch.rej @@ -0,0 +1,68 @@ +++++ REJECTED PATCH 4 + } + + this.setRotation(this.rotationYaw, this.rotationPitch); +- Iterator iterator = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().expand(0.20000000298023224D, 0.0D, 0.20000000298023224D)).iterator(); ++ AxisAlignedBB box; ++ if (getCollisionHandler() != null) box = this.getCollisionHandler().getMinecartCollisionBox(this); ++ else box = this.getEntityBoundingBox().expand(0.20000000298023224D, 0.0D, 0.20000000298023224D); ++ Iterator iterator = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, box).iterator(); + + while (iterator.hasNext()) + { +++++ END PATCH +++++ REJECTED PATCH 8 + flag1 = !flag; + } + +- double d0 = 0.0078125D; ++ double slopeAdjustment = getSlopeAdjustment(); + BlockRailBase.EnumRailDirection enumraildirection = (BlockRailBase.EnumRailDirection)p_180460_2_.getValue(blockrailbase.getShapeProperty()); + + switch (EntityMinecart.SwitchEnumMinecartType.RAIL_SHAPE_LOOKUP[enumraildirection.ordinal()]) + { + case 1: +- this.motionX -= 0.0078125D; ++ this.motionX -= slopeAdjustment; + ++this.posY; + break; + case 2: +- this.motionX += 0.0078125D; ++ this.motionX += slopeAdjustment; + ++this.posY; + break; + case 3: +- this.motionZ += 0.0078125D; ++ this.motionZ += slopeAdjustment; + ++this.posY; + break; + case 4: +- this.motionZ -= 0.0078125D; ++ this.motionZ -= slopeAdjustment; + ++this.posY; + } + +++++ END PATCH +++++ REJECTED PATCH 10 + this.posX = d7 + d1 * d6; + this.posZ = d8 + d2 * d6; + this.setPosition(this.posX, this.posY, this.posZ); +- d11 = this.motionX; +- d12 = this.motionZ; ++ this.moveMinecartOnRail(p_180460_1_); + +- if (this.riddenByEntity != null) +- { +- d11 *= 0.75D; +- d12 *= 0.75D; +- } +- +- double d13 = this.func_174898_m(); +- d11 = MathHelper.clamp_double(d11, -d13, d13); +- d12 = MathHelper.clamp_double(d12, -d13, d13); +- this.moveEntity(d11, 0.0D, d12); +- + if (aint[0][1] != 0 && MathHelper.floor_double(this.posX) - p_180460_1_.getX() == aint[0][0] && MathHelper.floor_double(this.posZ) - p_180460_1_.getZ() == aint[0][2]) + { + this.setPosition(this.posX, this.posY + (double)aint[0][1], this.posZ); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch.rej b/rejects/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch.rej new file mode 100644 index 0000000000..e32f40b662 --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch.rej @@ -0,0 +1,19 @@ +++++ REJECTED PATCH 1 + + protected boolean teleportTo(double p_70825_1_, double p_70825_3_, double p_70825_5_) + { ++ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(this, p_70825_1_, p_70825_3_, p_70825_5_, 0); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return false; + double d3 = this.posX; + double d4 = this.posY; + double d5 = this.posZ; +- this.posX = p_70825_1_; +- this.posY = p_70825_3_; +- this.posZ = p_70825_5_; ++ this.posX = event.targetX; ++ this.posY = event.targetY; ++ this.posZ = event.targetZ; + boolean flag = false; + BlockPos blockpos = new BlockPos(this.posX, this.posY, this.posZ); + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch.rej b/rejects/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch.rej new file mode 100644 index 0000000000..ed935ae5ff --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 4 + + if (p_180482_2_1 == null) + { +- p_180482_2_1 = new EntityZombie.GroupData(this.worldObj.rand.nextFloat() < 0.05F, this.worldObj.rand.nextFloat() < 0.05F, null); ++ p_180482_2_1 = new EntityZombie.GroupData(this.worldObj.rand.nextFloat() < net.minecraftforge.common.ForgeModContainer.zombieBabyChance, this.worldObj.rand.nextFloat() < 0.05F, null); + } + + if (p_180482_2_1 instanceof EntityZombie.GroupData) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch.rej b/rejects/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch.rej new file mode 100644 index 0000000000..4eec41fb90 --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 3 + + private void populateBuyingList() + { ++ //TODO: Hook into VillagerRegistry + EntityVillager.ITradeList[][][] aitradelist = DEFAULT_TRADE_LIST_MAP[this.getProfession()]; + + if (this.careerId != 0 && this.careerLevel != 0) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch.rej b/rejects/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch.rej new file mode 100644 index 0000000000..fcdb363652 --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch.rej @@ -0,0 +1,29 @@ +++++ REJECTED PATCH 3 + if (chunk.isPopulated()) + { + arraylist.add(chunk); +- arraylist1.addAll(((WorldServer)this.worldObj).func_147486_a(chunkcoordintpair.chunkXPos * 16, 0, chunkcoordintpair.chunkZPos * 16, chunkcoordintpair.chunkXPos * 16 + 16, 256, chunkcoordintpair.chunkZPos * 16 + 16)); ++ arraylist1.addAll(((WorldServer)this.worldObj).func_147486_a(chunkcoordintpair.chunkXPos * 16, 0, chunkcoordintpair.chunkZPos * 16, chunkcoordintpair.chunkXPos * 16 + 15, 256, chunkcoordintpair.chunkZPos * 16 + 15)); ++ //BugFix: 16 makes it load an extra chunk, which isn't associated with a player, which makes it not unload unless a player walks near it. + iterator1.remove(); + } + } +++++ END PATCH +++++ REJECTED PATCH 4 + { + chunk = (Chunk)iterator2.next(); + this.getServerForPlayer().getEntityTracker().func_85172_a(this, chunk); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.Watch(chunk.getChunkCoordIntPair(), this)); + } + } + } +++++ END PATCH +++++ REJECTED PATCH 7 + if (entitylivingbase != null) + { + EntityList.EntityEggInfo entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(EntityList.getEntityID(entitylivingbase))); ++ if (entityegginfo == null) entityegginfo = net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(EntityList.getEntityString(entitylivingbase)); + + if (entityegginfo != null) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/init/Bootstrap.java.patch.rej b/rejects/minecraft/net/minecraft/init/Bootstrap.java.patch.rej new file mode 100644 index 0000000000..5897ff2747 --- /dev/null +++ b/rejects/minecraft/net/minecraft/init/Bootstrap.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 3 + } + } + }); ++ if (false){ //Forge: Removed, Fixes MC-75630 - Exploit with signs and command blocks + BlockDispenser.dispenseBehaviorRegistry.putObject(Item.getItemFromBlock(Blocks.command_block), new BehaviorDefaultDispenseItem() + { + private static final String __OBFID = "CL_00002276"; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch.rej b/rejects/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch.rej new file mode 100644 index 0000000000..dee299c5fe --- /dev/null +++ b/rejects/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch.rej @@ -0,0 +1,11 @@ +++++ REJECTED PATCH 1 + } + public boolean isItemValid(ItemStack stack) + { +- return stack == null ? false : (stack.getItem() instanceof ItemArmor ? ((ItemArmor)stack.getItem()).armorType == k : (stack.getItem() != Item.getItemFromBlock(Blocks.pumpkin) && stack.getItem() != Items.skull ? false : k == 0)); ++ if (stack == null) return false; ++ return stack.getItem().isValidArmor(stack, k, thePlayer); + } + @SideOnly(Side.CLIENT) + public String getSlotTexture() +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/inventory/ContainerRepair.java.patch.rej b/rejects/minecraft/net/minecraft/inventory/ContainerRepair.java.patch.rej new file mode 100644 index 0000000000..26181b054b --- /dev/null +++ b/rejects/minecraft/net/minecraft/inventory/ContainerRepair.java.patch.rej @@ -0,0 +1,20 @@ +++++ REJECTED PATCH 3 + + if (itemstack2 != null) + { ++ if (!net.minecraftforge.common.ForgeHooks.onAnvilChange(this, itemstack, itemstack2, outputSlot, repairedItemName, i2)) return; + flag7 = itemstack2.getItem() == Items.enchanted_book && Items.enchanted_book.getEnchantments(itemstack2).tagCount() > 0; + int k; + int l; +++++ END PATCH +++++ REJECTED PATCH 4 + { + int l1 = ((Integer)iterator.next()).intValue(); + +- if (l1 != l && !enchantment.canApplyTogether(Enchantment.getEnchantmentById(l1))) ++ Enchantment e2 = Enchantment.getEnchantmentById(l1); ++ if (l1 != l && !(enchantment.canApplyTogether(e2) && e2.canApplyTogether(enchantment))) //Forge BugFix: Let Both enchantments veto being together + { + flag8 = false; + ++i; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/Item.java.patch.rej b/rejects/minecraft/net/minecraft/item/Item.java.patch.rej new file mode 100644 index 0000000000..459b12091a --- /dev/null +++ b/rejects/minecraft/net/minecraft/item/Item.java.patch.rej @@ -0,0 +1,593 @@ +++++ REJECTED PATCH 1 + + 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(); + protected static final UUID itemModifierUUID = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); + private CreativeTabs tabToDisplayOn; + protected static Random itemRand = new Random(); +++++ END PATCH +++++ REJECTED PATCH 7 + return false; + } + ++ @Deprecated // Use ItemStack sensitive version below. + public Multimap getItemAttributeModifiers() + { + return HashMultimap.create(); + } + ++ /* ======================================== FORGE START =====================================*/ ++ /** ++ * ItemStack sensitive version of getItemAttributeModifiers ++ */ ++ public Multimap getAttributeModifiers(ItemStack stack) ++ { ++ return this.getItemAttributeModifiers(); ++ } ++ ++ /** ++ * 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; ++ } ++ ++ /** ++ * 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 ++ * @return Return true to prevent any further processing. ++ */ ++ public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) ++ { ++ return false; ++ } ++ ++ /** ++ * Metadata-sensitive version of getStrVsBlock ++ * @param itemstack The Item Stack ++ * @param state The block state ++ * @return The damage strength ++ */ ++ public float getDigSpeed(ItemStack itemstack, net.minecraft.block.state.IBlockState state) ++ { ++ return getStrVsBlock(itemstack, state.getBlock()); ++ } ++ ++ ++ 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, EntityPlayer 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; ++ } ++ ++ /** ++ * Player, Render pass, and item usage sensitive version of getIconIndex. ++ * ++ * @param stack The item stack to get the icon for. ++ * @param player The player holding the item ++ * @param useRemaining The ticks remaining for the active item. ++ * @return Null to use default model, or a custom ModelResourceLocation for the stage of use. ++ */ ++ @SideOnly(Side.CLIENT) ++ public net.minecraft.client.resources.model.ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) ++ { ++ return null; ++ } ++ ++ /** ++ * 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. ++ } ++ ++ /** ++ * Return the correct icon for rendering based on the supplied ItemStack and render pass. ++ * ++ * Defers to {@link #getIconFromDamageForRenderPass(int, int)} ++ * @param stack to render for ++ * @param pass the multi-render pass ++ * @return the icon ++ * / ++ public IIcon getIcon(ItemStack stack, int pass) ++ { ++ return func_77618_c(stack.getMetadata(), pass); ++ } ++ */ ++ ++ /** ++ * Generates the base Random item for a specific instance of the chest gen, ++ * Enchanted books use this to pick a random enchantment. ++ * ++ * @param chest The chest category to generate for ++ * @param rnd World RNG ++ * @param original Original result registered with the chest gen hooks. ++ * @return New values to use as the random item, typically this will be original ++ */ ++ public net.minecraft.util.WeightedRandomChestContent getChestGenBase(net.minecraftforge.common.ChestGenHooks chest, Random rnd, net.minecraft.util.WeightedRandomChestContent original) ++ { ++ if (this instanceof ItemEnchantedBook) ++ { ++ return ((ItemEnchantedBook)this).getRandom(rnd, ++ original.theMinimumChanceToGenerateItem, ++ original.theMaximumChanceToGenerateItem, original.itemWeight); ++ } ++ return original; ++ } ++ ++ /** ++ * ++ * 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(World 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, int armorType, Entity entity) ++ { ++ if (this instanceof ItemArmor) ++ { ++ return ((ItemArmor)this).armorType == armorType; ++ } ++ ++ if (armorType == 0) ++ { ++ return this == Item.getItemFromBlock(Blocks.pumpkin) || this == Items.skull; ++ } ++ ++ return false; ++ } ++ ++ /** ++ * 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, int 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 0=head, 1=torso, 2=legs, 3=feet ++ * ++ * @return A ModelBiped to render instead of the default ++ */ ++ @SideOnly(Side.CLIENT) ++ public net.minecraft.client.model.ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) ++ { ++ 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(Block)} ++ * @param par1Block The block trying to harvest ++ * @param itemStack The itemstack used to harvest the block ++ * @return true if can harvest the block ++ */ ++ public boolean canHarvestBlock(Block par1Block, ItemStack itemStack) ++ { ++ return canHarvestBlock(par1Block); ++ } ++ ++ /** ++ * 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); ++ } ++ /* ======================================== FORGE END =====================================*/ ++ ++ + public static void registerItems() + { + registerItemBlock(Blocks.stone, (new ItemMultiTexture(Blocks.stone, Blocks.stone, new Function() +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemBlock.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemBlock.java.patch.rej new file mode 100644 index 0000000000..a25b08932e --- /dev/null +++ b/rejects/minecraft/net/minecraft/item/ItemBlock.java.patch.rej @@ -0,0 +1,45 @@ +++++ REJECTED PATCH 1 + int i = this.getMetadata(stack.getMetadata()); + IBlockState iblockstate1 = this.block.onBlockPlaced(worldIn, pos, side, hitX, hitY, hitZ, i, playerIn); + +- if (worldIn.setBlockState(pos, iblockstate1, 3)) ++ if (placeBlockAt(stack, playerIn, worldIn, pos, side, hitX, hitY, hitZ, iblockstate1)) + { +- iblockstate1 = worldIn.getBlockState(pos); +- +- if (iblockstate1.getBlock() == this.block) +- { +- setTileEntityNBT(worldIn, pos, stack); +- this.block.onBlockPlacedBy(worldIn, pos, iblockstate1, playerIn, stack); +- } +- + worldIn.playSoundEffect((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), this.block.stepSound.getPlaceSound(), (this.block.stepSound.getVolume() + 1.0F) / 2.0F, this.block.stepSound.getFrequency() * 0.8F); + --stack.stackSize; + } +++++ END PATCH +++++ REJECTED PATCH 2 + } + } + ++ @Deprecated //Use player sensitive version + public static boolean setTileEntityNBT(World worldIn, BlockPos pos, ItemStack stack) + { ++ return setTileEntityNBT(worldIn, pos, stack, null); ++ } ++ public static boolean setTileEntityNBT(World worldIn, BlockPos pos, ItemStack stack, EntityPlayer player) ++ { + if (stack.hasTagCompound() && stack.getTagCompound().hasKey("BlockEntityTag", 10)) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity != null) + { ++ //Forge: Fixes MC-75630 - Exploit with signs and command blocks ++ final net.minecraft.server.MinecraftServer server = net.minecraft.server.MinecraftServer.getServer(); ++ if (!worldIn.isRemote && tileentity.restrictNBTCopy() && ++ (server == null || !server.getConfigurationManager().canSendCommands(player.getGameProfile()))) ++ return false; + NBTTagCompound nbttagcompound = new NBTTagCompound(); + NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbttagcompound.copy(); + tileentity.writeToNBT(nbttagcompound); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemBow.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemBow.java.patch.rej new file mode 100644 index 0000000000..4da43f9422 --- /dev/null +++ b/rejects/minecraft/net/minecraft/item/ItemBow.java.patch.rej @@ -0,0 +1,18 @@ +++++ REJECTED PATCH 1 + + public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityPlayer playerIn, int timeLeft) + { ++ int j = this.getMaxItemUseDuration(stack) - timeLeft; ++ net.minecraftforge.event.entity.player.ArrowLooseEvent event = new net.minecraftforge.event.entity.player.ArrowLooseEvent(playerIn, stack, j); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return; ++ j = event.charge; ++ + boolean flag = playerIn.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0; + + if (flag || playerIn.inventory.hasItem(Items.arrow)) + { +- int j = this.getMaxItemUseDuration(stack) - timeLeft; + float f = (float)j / 20.0F; + f = (f * f + f * 2.0F) / 3.0F; + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch.rej new file mode 100644 index 0000000000..b28b8be6a9 --- /dev/null +++ b/rejects/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch.rej @@ -0,0 +1,42 @@ +++++ REJECTED PATCH 2 + @SideOnly(Side.CLIENT) + public int getColorFromItemStack(ItemStack stack, int renderPass) + { +- EntityList.EntityEggInfo entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(stack.getMetadata())); ++ EntityList.EntityEggInfo entityegginfo = ItemMonsterPlacer.getEggInfo(stack); + return entityegginfo != null ? (renderPass == 0 ? entityegginfo.primaryColor : entityegginfo.secondaryColor) : 16777215; + } + +++++ END PATCH +++++ REJECTED PATCH 6 + } + } + ++ @Deprecated // Use string version below. + public static Entity spawnCreature(World worldIn, int entityID, double x, double y, double z) + { + if (!EntityList.entityEggs.containsKey(Integer.valueOf(entityID))) + { + return null; + } ++ return spawnCreature(worldIn, EntityList.getStringFromID(entityID), x, y, z); ++ } ++ ++ public static Entity spawnCreature(World worldIn, String name, double x, double y, double z) ++ { ++ if (!EntityList.stringToClassMapping.containsKey(name)) ++ { ++ return null; ++ } + else + { + Entity entity = null; + + for (int j = 0; j < 1; ++j) + { +- entity = EntityList.createEntityByID(entityID, worldIn); ++ entity = EntityList.createEntityByName(name, worldIn); + + if (entity instanceof EntityLivingBase) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemReed.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemReed.java.patch.rej new file mode 100644 index 0000000000..8281b9838c --- /dev/null +++ b/rejects/minecraft/net/minecraft/item/ItemReed.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + + if (iblockstate1.getBlock() == this.block) + { +- ItemBlock.setTileEntityNBT(worldIn, pos, stack); ++ ItemBlock.setTileEntityNBT(worldIn, pos, stack, playerIn); + iblockstate1.getBlock().onBlockPlacedBy(worldIn, pos, iblockstate1, playerIn, stack); + } + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemSign.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemSign.java.patch.rej new file mode 100644 index 0000000000..790c3449eb --- /dev/null +++ b/rejects/minecraft/net/minecraft/item/ItemSign.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + --stack.stackSize; + TileEntity tileentity = worldIn.getTileEntity(pos); + +- if (tileentity instanceof TileEntitySign && !ItemBlock.setTileEntityNBT(worldIn, pos, stack)) ++ if (tileentity instanceof TileEntitySign && !ItemBlock.setTileEntityNBT(worldIn, pos, stack, playerIn)) + { + playerIn.openEditSign((TileEntitySign)tileentity); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemStack.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemStack.java.patch.rej new file mode 100644 index 0000000000..eee0c26428 --- /dev/null +++ b/rejects/minecraft/net/minecraft/item/ItemStack.java.patch.rej @@ -0,0 +1,20 @@ +++++ REJECTED PATCH 10 + } + } + ++ net.minecraftforge.event.ForgeEventFactory.onItemTooltip(this, playerIn, arraylist, advanced); ++ + return arraylist; + } + +++++ END PATCH +++++ REJECTED PATCH 11 + } + else + { +- object = this.getItem().getItemAttributeModifiers(); ++ object = this.getItem().getAttributeModifiers(this); + } + + return (Multimap)object; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch.rej b/rejects/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch.rej new file mode 100644 index 0000000000..5dfe144dfa --- /dev/null +++ b/rejects/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch.rej @@ -0,0 +1,11 @@ +++++ REJECTED PATCH 2 + + public float getSmeltingExperience(ItemStack stack) + { ++ float ret = stack.getItem().getSmeltingExperience(stack); ++ if (ret != -1) return ret; ++ + Iterator iterator = this.experienceList.entrySet().iterator(); + Entry entry; + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch.rej b/rejects/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch.rej new file mode 100644 index 0000000000..c5f4d4693e --- /dev/null +++ b/rejects/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch.rej @@ -0,0 +1,23 @@ +++++ REJECTED PATCH 1 + { + this.field_92102_a = new ItemStack(Items.fireworks); + ++ nbttagcompound = new NBTTagCompound(); + if (l > 0) + { +- nbttagcompound = new NBTTagCompound(); + nbttagcompound1 = new NBTTagCompound(); + NBTTagList nbttaglist = new NBTTagList(); + +++++ END PATCH +++++ REJECTED PATCH 2 + nbttagcompound1.setTag("Explosions", nbttaglist); + nbttagcompound1.setByte("Flight", (byte)j); + nbttagcompound.setTag("Fireworks", nbttagcompound1); +- this.field_92102_a.setTagCompound(nbttagcompound); + } ++ this.field_92102_a.setTagCompound(nbttagcompound); //Forge BugFix: NPE Protection + + return true; + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch.rej b/rejects/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch.rej new file mode 100644 index 0000000000..bb4871784e --- /dev/null +++ b/rejects/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 3 + ItemStack itemstack2 = (ItemStack)arraylist.get(0); + itemstack = (ItemStack)arraylist.get(1); + +- if (itemstack2.getItem() == itemstack.getItem() && itemstack2.stackSize == 1 && itemstack.stackSize == 1 && itemstack2.getItem().isDamageable()) ++ if (itemstack2.getItem() == itemstack.getItem() && itemstack2.stackSize == 1 && itemstack.stackSize == 1 && itemstack2.getItem().isRepairable()) + { + Item item = itemstack2.getItem(); + int j = item.getMaxDamage() - itemstack2.getItemDamage(); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/nbt/NBTTagByteArray.java.patch.rej b/rejects/minecraft/net/minecraft/nbt/NBTTagByteArray.java.patch.rej new file mode 100644 index 0000000000..2f48a9fbbb --- /dev/null +++ b/rejects/minecraft/net/minecraft/nbt/NBTTagByteArray.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 1 + + void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException + { ++ sizeTracker.read(32); //Forge: Count the length as well + int j = input.readInt(); + sizeTracker.read((long)(8 * j)); + this.data = new byte[j]; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch.rej b/rejects/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch.rej new file mode 100644 index 0000000000..2873b145b7 --- /dev/null +++ b/rejects/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + while ((b0 = readType(input, sizeTracker)) != 0) + { + String s = readKey(input, sizeTracker); +- sizeTracker.read((long)(16 * s.length())); ++ NBTSizeTracker.readUTF(sizeTracker, s); // Forge: Correctly read String length including header. + NBTBase nbtbase = readNBT(b0, s, input, depth + 1, sizeTracker); + this.tagMap.put(s, nbtbase); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/nbt/NBTTagIntArray.java.patch.rej b/rejects/minecraft/net/minecraft/nbt/NBTTagIntArray.java.patch.rej new file mode 100644 index 0000000000..8911767290 --- /dev/null +++ b/rejects/minecraft/net/minecraft/nbt/NBTTagIntArray.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 1 + + void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException + { ++ sizeTracker.read(32); //Forge: Count the length as well + int j = input.readInt(); + sizeTracker.read((long)(32 * j)); + this.intArray = new int[j]; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/nbt/NBTTagList.java.patch.rej b/rejects/minecraft/net/minecraft/nbt/NBTTagList.java.patch.rej new file mode 100644 index 0000000000..40455e2117 --- /dev/null +++ b/rejects/minecraft/net/minecraft/nbt/NBTTagList.java.patch.rej @@ -0,0 +1,15 @@ +++++ REJECTED PATCH 1 + { + sizeTracker.read(8L); + this.tagType = input.readByte(); ++ sizeTracker.read(32); //Forge: Count the length as well + int j = input.readInt(); + this.tagList = Lists.newArrayList(); + + for (int k = 0; k < j; ++k) + { ++ sizeTracker.read(32); //Forge: 4 extra bytes for the object allocation. + NBTBase nbtbase = NBTBase.createNewByType(this.tagType); + nbtbase.read(input, depth + 1, sizeTracker); + this.tagList.add(nbtbase); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/network/NetworkSystem.java.patch.rej b/rejects/minecraft/net/minecraft/network/NetworkSystem.java.patch.rej new file mode 100644 index 0000000000..ef370c5516 --- /dev/null +++ b/rejects/minecraft/net/minecraft/network/NetworkSystem.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + ; + } + +- p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new PingResponseHandler(NetworkSystem.this)).addLast("splitter", new MessageDeserializer2()).addLast("decoder", new MessageDeserializer(EnumPacketDirection.SERVERBOUND)).addLast("prepender", new MessageSerializer2()).addLast("encoder", new MessageSerializer(EnumPacketDirection.CLIENTBOUND)); ++ p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.READ_TIMEOUT)).addLast("legacy_query", new PingResponseHandler(NetworkSystem.this)).addLast("splitter", new MessageDeserializer2()).addLast("decoder", new MessageDeserializer(EnumPacketDirection.SERVERBOUND)).addLast("prepender", new MessageSerializer2()).addLast("encoder", new MessageSerializer(EnumPacketDirection.CLIENTBOUND)); + NetworkManager networkmanager = new NetworkManager(EnumPacketDirection.SERVERBOUND); + NetworkSystem.this.networkManagers.add(networkmanager); + p_initChannel_1_.pipeline().addLast("packet_handler", networkmanager); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/network/ServerStatusResponse.java.patch.rej b/rejects/minecraft/net/minecraft/network/ServerStatusResponse.java.patch.rej new file mode 100644 index 0000000000..e909ac525f --- /dev/null +++ b/rejects/minecraft/net/minecraft/network/ServerStatusResponse.java.patch.rej @@ -0,0 +1,45 @@ +++++ REJECTED PATCH 6 + return this.serialize((ServerStatusResponse)p_serialize_1_, p_serialize_2_, p_serialize_3_); + } + } ++ ++ 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.S00PacketServerInfo.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; ++ } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/network/play/client/C12PacketUpdateSign.java.patch.rej b/rejects/minecraft/net/minecraft/network/play/client/C12PacketUpdateSign.java.patch.rej new file mode 100644 index 0000000000..1a76b2f19b --- /dev/null +++ b/rejects/minecraft/net/minecraft/network/play/client/C12PacketUpdateSign.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + + for (int i = 0; i < 4; ++i) + { +- this.lines[i] = buf.readChatComponent(); ++ this.lines[i] = IChatComponent.Serializer.jsonToComponent(buf.readStringFromBuffer(384)); + } + } + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch.rej b/rejects/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch.rej new file mode 100644 index 0000000000..a1201ecf76 --- /dev/null +++ b/rejects/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + + public void writePacketData(PacketBuffer buf) throws IOException + { +- buf.writeString(GSON.toJson(this.response)); ++ buf.writeString(this.response.getJson()); + } + + public void processPacket(INetHandlerStatusClient handler) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/potion/PotionEffect.java.patch.rej b/rejects/minecraft/net/minecraft/potion/PotionEffect.java.patch.rej new file mode 100644 index 0000000000..af2f103586 --- /dev/null +++ b/rejects/minecraft/net/minecraft/potion/PotionEffect.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 4 + + public static PotionEffect readCustomPotionEffectFromNBT(NBTTagCompound nbt) + { +- byte b0 = nbt.getByte("Id"); ++ int b0 = nbt.getByte("Id") & 0xff; + + if (b0 >= 0 && b0 < Potion.potionTypes.length && Potion.potionTypes[b0] != null) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/server/MinecraftServer.java.patch.rej b/rejects/minecraft/net/minecraft/server/MinecraftServer.java.patch.rej new file mode 100644 index 0000000000..cfdcbd57e2 --- /dev/null +++ b/rejects/minecraft/net/minecraft/server/MinecraftServer.java.patch.rej @@ -0,0 +1,127 @@ +++++ REJECTED PATCH 4 + worldsettings = new WorldSettings(worldinfo); + } + +- for (int j = 0; j < this.worldServers.length; ++j) ++ 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()) + { +- byte b0 = 0; ++ WorldServer world = (dim == 0 ? overWorld : (WorldServer)new WorldServerMulti(this, isavehandler, dim, overWorld, theProfiler).init()); ++ world.addWorldAccess(new WorldManager(this, world)); + +- if (j == 1) +- { +- b0 = -1; +- } +- +- if (j == 2) +- { +- b0 = 1; +- } +- +- if (j == 0) +- { +- if (this.isDemo()) +- { +- this.worldServers[j] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, b0, this.theProfiler)).init(); +- } +- else +- { +- this.worldServers[j] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, b0, this.theProfiler)).init(); +- } +- +- this.worldServers[j].initialize(worldsettings); +- } +- else +- { +- this.worldServers[j] = (WorldServer)(new WorldServerMulti(this, isavehandler, b0, this.worldServers[0], this.theProfiler)).init(); +- } +- +- this.worldServers[j].addWorldAccess(new WorldManager(this, this.worldServers[j])); +- + if (!this.isSinglePlayer()) + { +- this.worldServers[j].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(); + } +++++ END PATCH +++++ REJECTED PATCH 5 + this.setUserMessage("menu.generatingTerrain"); + byte b0 = 0; + logger.info("Preparing start region for level " + b0); +- WorldServer worldserver = this.worldServers[b0]; ++ WorldServer worldserver = net.minecraftforge.common.DimensionManager.getWorld(b0); + BlockPos blockpos = worldserver.getSpawnPoint(); + long j = getCurrentTimeMillis(); + +++++ END PATCH +++++ REJECTED PATCH 6 + if (!this.worldIsBeingDeleted) + { + WorldServer[] aworldserver = this.worldServers; ++ if (aworldserver == null) return; //Forge: Just in case, NPE protection as it has been encountered. + int i = aworldserver.length; + + for (int j = 0; j < i; ++j) +++++ END PATCH +++++ REJECTED PATCH 16 + { + try + { +- ((FutureTask)this.futureTaskQueue.poll()).run(); ++ net.minecraftforge.fml.common.FMLCommonHandler.callFuture(((FutureTask)this.futureTaskQueue.poll())); + } + catch (Throwable throwable2) + { +++++ END PATCH +++++ REJECTED PATCH 17 + } + + this.theProfiler.endStartSection("levels"); ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.tick(); + int j; + +- for (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) +++++ END PATCH +++++ REJECTED PATCH 18 + } + + this.theProfiler.startSection("tick"); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPreWorldTick(worldserver); + CrashReport crashreport; + + try +++++ END PATCH +++++ REJECTED PATCH 25 + this.serverPort = port; + } + +- @SideOnly(Side.SERVER) + public boolean isServerStopped() + { + return this.serverStopped; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch.rej b/rejects/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch.rej new file mode 100644 index 0000000000..6fffb6baf9 --- /dev/null +++ b/rejects/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch.rej @@ -0,0 +1,68 @@ +++++ REJECTED PATCH 2 + { + worldinfo.setWorldName(p_71247_2_); + } ++ 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 j = 0; j < this.worldServers.length; ++j) ++ for (int dim : net.minecraftforge.common.DimensionManager.getStaticDimensionIDs()) + { +- byte b0 = 0; + +- if (j == 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()) + { +- b0 = -1; ++ world.getWorldInfo().setGameType(getGameType()); + } +- +- if (j == 2) +- { +- b0 = 1; +- } +- +- if (j == 0) +- { +- if (this.isDemo()) +- { +- this.worldServers[j] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, b0, this.theProfiler)).init(); +- } +- else +- { +- this.worldServers[j] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, b0, this.theProfiler)).init(); +- } +- +- this.worldServers[j].initialize(this.theWorldSettings); +- } +- else +- { +- this.worldServers[j] = (WorldServer)(new WorldServerMulti(this, isavehandler, b0, this.worldServers[0], this.theProfiler)).init(); +- } +- +- this.worldServers[j].addWorldAccess(new WorldManager(this, this.worldServers[j])); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(world)); + } + +- this.getConfigurationManager().setPlayerManager(this.worldServers); ++ this.getConfigurationManager().setPlayerManager(new WorldServer[]{ overWorld }); + +- if (this.worldServers[0].getWorldInfo().getDifficulty() == null) ++ if (overWorld.getWorldInfo().getDifficulty() == null) + { + this.setDifficultyForAllWorlds(this.mc.gameSettings.difficulty); + } +++++ END PATCH +++++ REJECTED PATCH 4 + { + try + { +- ((FutureTask)this.futureTaskQueue.poll()).run(); ++ net.minecraftforge.fml.common.FMLCommonHandler.callFuture(((FutureTask)this.futureTaskQueue.poll())); + } + catch (Throwable throwable) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/server/management/PlayerManager.java.patch.rej b/rejects/minecraft/net/minecraft/server/management/PlayerManager.java.patch.rej new file mode 100644 index 0000000000..fa38e8910b --- /dev/null +++ b/rejects/minecraft/net/minecraft/server/management/PlayerManager.java.patch.rej @@ -0,0 +1,40 @@ +++++ REJECTED PATCH 13 + { + int i1; + +- if (this.numBlocksToUpdate == 64) ++ if (this.numBlocksToUpdate >= net.minecraftforge.common.ForgeModContainer.clumpingThreshold) + { + i = this.chunkCoords.chunkXPos * 16; + j = this.chunkCoords.chunkZPos * 16; + this.sendToAllPlayersWatchingChunk(new S21PacketChunkData(PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos), false, this.flagsYAreasToUpdate)); + +- for (k = 0; k < 16; ++k) ++ // Forge: Grabs ALL tile entities is costly on a modded server, only send needed ones ++ for (k = 0; false && k < 16; ++k) + { + if ((this.flagsYAreasToUpdate & 1 << k) != 0) + { +++++ END PATCH +++++ REJECTED PATCH 14 + else + { + this.sendToAllPlayersWatchingChunk(new S22PacketMultiBlockChange(this.numBlocksToUpdate, this.locationOfBlockChange, PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos))); ++ } + ++ { //Forge: Send only the tile entities that are updated, Adding this brace lets us keep the indent and the patch small ++ WorldServer world = PlayerManager.this.theWorldServer; + for (i = 0; i < this.numBlocksToUpdate; ++i) + { + j = (this.locationOfBlockChange[i] >> 12 & 15) + this.chunkCoords.chunkXPos * 16; +++++ END PATCH +++++ REJECTED PATCH 15 + i1 = (this.locationOfBlockChange[i] >> 8 & 15) + this.chunkCoords.chunkZPos * 16; + BlockPos blockpos1 = new BlockPos(j, k, i1); + +- if (PlayerManager.this.theWorldServer.getBlockState(blockpos1).getBlock().hasTileEntity()) ++ if (world.getBlockState(blockpos1).getBlock().hasTileEntity(world.getBlockState(blockpos1))) + { + this.sendTileToAllPlayersWatchingChunk(PlayerManager.this.theWorldServer.getTileEntity(blockpos1)); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/server/management/PlayerProfileCache.java.patch.rej b/rejects/minecraft/net/minecraft/server/management/PlayerProfileCache.java.patch.rej new file mode 100644 index 0000000000..5572fafa51 --- /dev/null +++ b/rejects/minecraft/net/minecraft/server/management/PlayerProfileCache.java.patch.rej @@ -0,0 +1,28 @@ +++++ REJECTED PATCH 1 + { + List list = null; + BufferedReader bufferedreader = null; +- label64: + { + try + { + bufferedreader = Files.newReader(this.usercacheFile, Charsets.UTF_8); + list = (List)this.gson.fromJson(bufferedreader, field_152666_h); +- break label64; +- } +- catch (FileNotFoundException filenotfoundexception) +- { +- ; +- } +- finally +- { +- IOUtils.closeQuietly(bufferedreader); +- } + +- return; +- } +- + if (list != null) + { + this.field_152661_c.clear(); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch.rej b/rejects/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch.rej new file mode 100644 index 0000000000..29f9d27b39 --- /dev/null +++ b/rejects/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch.rej @@ -0,0 +1,74 @@ +++++ REJECTED PATCH 9 + this.playerEntityList.remove(playerIn); + this.uuidToPlayerMap.remove(playerIn.getUniqueID()); + this.playerStatFiles.remove(playerIn.getUniqueID()); ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.getCurrentPlayerCount()); + this.sendPacketToAllPlayers(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.REMOVE_PLAYER, new EntityPlayerMP[] {playerIn})); + } + +++++ END PATCH +++++ REJECTED PATCH 10 + + 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().getPlayerManager().removePlayer(playerIn); + this.playerEntityList.remove(playerIn); + this.mcServer.worldServerForDimension(playerIn.dimension).removePlayerEntityDangerously(playerIn); +- BlockPos blockpos = playerIn.getBedLocation(); +- boolean flag1 = playerIn.isSpawnForced(); ++ BlockPos blockpos = playerIn.getBedLocation(dimension); ++ boolean flag1 = playerIn.isSpawnForced(dimension); + playerIn.dimension = dimension; + Object object; + +++++ END PATCH +++++ REJECTED PATCH 11 + EntityPlayerMP entityplayermp1 = new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(playerIn.dimension), playerIn.getGameProfile(), (ItemInWorldManager)object); + entityplayermp1.playerNetServerHandler = playerIn.playerNetServerHandler; + entityplayermp1.clonePlayer(playerIn, conqueredEnd); ++ entityplayermp1.dimension = dimension; + entityplayermp1.setEntityId(playerIn.getEntityId()); + entityplayermp1.func_174817_o(playerIn); + WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension); +++++ END PATCH +++++ REJECTED PATCH 12 + this.uuidToPlayerMap.put(entityplayermp1.getUniqueID(), entityplayermp1); + entityplayermp1.addSelfToInternalCraftingInventory(); + entityplayermp1.setHealth(entityplayermp1.getHealth()); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerRespawnEvent(entityplayermp1); + return entityplayermp1; + } + + public void transferPlayerToDimension(EntityPlayerMP playerIn, int dimension) + { ++ transferPlayerToDimension(playerIn, dimension, mcServer.worldServerForDimension(dimension).getDefaultTeleporter()); ++ } ++ ++ public void transferPlayerToDimension(EntityPlayerMP playerIn, int dimension, net.minecraft.world.Teleporter teleporter) ++ { + int j = playerIn.dimension; + WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension); + playerIn.dimension = dimension; + WorldServer worldserver1 = this.mcServer.worldServerForDimension(playerIn.dimension); +- playerIn.playerNetServerHandler.sendPacket(new S07PacketRespawn(playerIn.dimension, playerIn.worldObj.getDifficulty(), playerIn.worldObj.getWorldInfo().getTerrainType(), playerIn.theItemInWorldManager.getGameType())); ++ playerIn.playerNetServerHandler.sendPacket(new S07PacketRespawn(playerIn.dimension, worldserver1.getDifficulty(), worldserver1.getWorldInfo().getTerrainType(), playerIn.theItemInWorldManager.getGameType())); // Forge: Use new dimensions information + worldserver.removePlayerEntityDangerously(playerIn); + playerIn.isDead = false; +- this.transferEntityToWorld(playerIn, j, worldserver, worldserver1); ++ this.transferEntityToWorld(playerIn, j, worldserver, worldserver1, teleporter); + this.func_72375_a(playerIn, worldserver); + playerIn.playerNetServerHandler.setPlayerLocation(playerIn.posX, playerIn.posY, playerIn.posZ, playerIn.rotationYaw, playerIn.rotationPitch); + playerIn.theItemInWorldManager.setWorld(worldserver1); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch.rej b/rejects/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch.rej new file mode 100644 index 0000000000..8e844f9132 --- /dev/null +++ b/rejects/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + + public void processHandshake(C00Handshake packetIn) + { ++ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerHandshake(packetIn, this.networkManager)) return; ++ + switch (NetHandlerHandshakeTCP.SwitchEnumConnectionState.VALUES[packetIn.getRequestedState().ordinal()]) + { + case 1: +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch.rej b/rejects/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch.rej new file mode 100644 index 0000000000..6b058fdfe3 --- /dev/null +++ b/rejects/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 2 + } + + this.networkManager.sendPacket(new S02PacketLoginSuccess(this.loginGameProfile)); +- this.server.getConfigurationManager().initializeConnectionToPlayer(this.networkManager, this.server.getConfigurationManager().createPlayerForUser(this.loginGameProfile)); ++ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlServerHandshake(this.server.getConfigurationManager(), this.networkManager, this.server.getConfigurationManager().createPlayerForUser(this.loginGameProfile)); + } + } + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/stats/StatList.java.patch.rej b/rejects/minecraft/net/minecraft/stats/StatList.java.patch.rej new file mode 100644 index 0000000000..ccf2102862 --- /dev/null +++ b/rejects/minecraft/net/minecraft/stats/StatList.java.patch.rej @@ -0,0 +1,15 @@ +++++ REJECTED PATCH 2 + while (iterator.hasNext()) + { + Block block = (Block)iterator.next(); +- Item item = Item.getItemFromBlock(block); ++ Item item = Item.getItemFromBlock(block); //TODO: Hook FML's stat change event and re-assign these + + if (item != null) + { +- int i = Block.getIdFromBlock(block); ++ int i = Block.getIdFromBlock(block); //TODO: Hook FML's stat change event and re-assign these + String s = func_180204_a(item); + + if (s != null && block.getEnableStats()) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/tileentity/TileEntity.java.patch.rej b/rejects/minecraft/net/minecraft/tileentity/TileEntity.java.patch.rej new file mode 100644 index 0000000000..7a2b4ecfd6 --- /dev/null +++ b/rejects/minecraft/net/minecraft/tileentity/TileEntity.java.patch.rej @@ -0,0 +1,13 @@ +++++ REJECTED PATCH 3 + { + TileEntity tileentity = null; + ++ Class oclass = null; + try + { +- Class oclass = (Class)nameToClassMap.get(nbt.getString("id")); ++ oclass = (Class)nameToClassMap.get(nbt.getString("id")); + + if (oclass != null) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch.rej b/rejects/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch.rej new file mode 100644 index 0000000000..5e7eb1c9e1 --- /dev/null +++ b/rejects/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch.rej @@ -0,0 +1,39 @@ +++++ REJECTED PATCH 1 + + if (itemstack1 == null) + { +- p_174916_0_.setInventorySlotContents(p_174916_2_, p_174916_1_); +- p_174916_1_ = null; ++ //Forge: BUGFIX: Again, make things respect max stack sizes. ++ int max = Math.min(p_174916_1_.getMaxStackSize(), p_174916_0_.getInventoryStackLimit()); ++ if (max >= p_174916_1_.stackSize) ++ { ++ p_174916_0_.setInventorySlotContents(p_174916_2_, p_174916_1_); ++ p_174916_1_ = null; ++ } ++ else ++ { ++ p_174916_0_.setInventorySlotContents(p_174916_2_, p_174916_1_.splitStack(max)); ++ } + flag = true; + } + else if (canCombine(itemstack1, p_174916_1_)) + { +- int j = p_174916_1_.getMaxStackSize() - itemstack1.stackSize; +- int k = Math.min(p_174916_1_.stackSize, j); +- p_174916_1_.stackSize -= k; +- itemstack1.stackSize += k; +- flag = k > 0; ++ //Forge: BUGFIX: Again, make things respect max stack sizes. ++ int max = Math.min(p_174916_1_.getMaxStackSize(), p_174916_0_.getInventoryStackLimit()); ++ if (max > itemstack1.stackSize) ++ { ++ int size = Math.min(p_174916_1_.stackSize, max - itemstack1.stackSize); ++ p_174916_1_.stackSize -= size; ++ itemstack1.stackSize += size; ++ flag = size > 0; ++ } + } + + if (flag) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/util/EnumChatFormatting.java.patch.rej b/rejects/minecraft/net/minecraft/util/EnumChatFormatting.java.patch.rej new file mode 100644 index 0000000000..3a2334006e --- /dev/null +++ b/rejects/minecraft/net/minecraft/util/EnumChatFormatting.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 1 + return this.controlString; + } + +- @SideOnly(Side.CLIENT) + public static String getTextWithoutFormattingCodes(String text) + { + return text == null ? null : formattingCodePattern.matcher(text).replaceAll(""); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/util/EnumFacing.java.patch.rej b/rejects/minecraft/net/minecraft/util/EnumFacing.java.patch.rej new file mode 100644 index 0000000000..81b2d786d3 --- /dev/null +++ b/rejects/minecraft/net/minecraft/util/EnumFacing.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 9 + } + } + +- public static enum Plane implements Predicate, Iterable { ++ public static enum Plane implements Predicate, Iterable { //Forge re-add generic because it just makes life easier. + HORIZONTAL, + VERTICAL; + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/util/Session.java.patch.rej b/rejects/minecraft/net/minecraft/util/Session.java.patch.rej new file mode 100644 index 0000000000..11b745c241 --- /dev/null +++ b/rejects/minecraft/net/minecraft/util/Session.java.patch.rej @@ -0,0 +1,17 @@ +++++ REJECTED PATCH 2 + 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 illegalargumentexception) + { +- return new GameProfile((UUID)null, this.getUsername()); ++ return new GameProfile(net.minecraft.entity.player.EntityPlayer.getUUID(new GameProfile((UUID)null, this.getUsername())), this.getUsername()); + } + } + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/util/StringTranslate.java.patch.rej b/rejects/minecraft/net/minecraft/util/StringTranslate.java.patch.rej new file mode 100644 index 0000000000..b552d24084 --- /dev/null +++ b/rejects/minecraft/net/minecraft/util/StringTranslate.java.patch.rej @@ -0,0 +1,64 @@ +++++ REJECTED PATCH 1 + { + private static final Pattern numericVariablePattern = Pattern.compile("%(\\d+\\$)?[\\d\\.]*[df]"); + private static final Splitter equalSignSplitter = Splitter.on('=').limit(2); ++ private final Map languageList; + private static StringTranslate instance = new StringTranslate(); +- private final Map languageList = Maps.newHashMap(); + private long lastUpdateTimeInMilliseconds; + private static final String __OBFID = "CL_00001212"; + + public StringTranslate() + { ++ InputStream inputstream = StringTranslate.class.getResourceAsStream("/assets/minecraft/lang/en_US.lang"); ++ languageList = Maps.newHashMap(); ++ inject(this, inputstream); ++ } ++ ++ public static void inject(InputStream inputstream) ++ { ++ inject(instance, inputstream); ++ } ++ ++ private static void inject(StringTranslate inst, InputStream inputstream) ++ { ++ java.util.HashMap map = parseLangFile(inputstream); ++ inst.languageList.putAll(map); ++ inst.lastUpdateTimeInMilliseconds = System.currentTimeMillis(); ++ } ++ ++ public static java.util.HashMap parseLangFile(InputStream inputstream) ++ { ++ java.util.HashMap table = Maps.newHashMap(); + try + { +- InputStream inputstream = StringTranslate.class.getResourceAsStream("/assets/minecraft/lang/en_US.lang"); ++ inputstream = net.minecraftforge.fml.common.FMLCommonHandler.instance().loadLanguage(table, inputstream); ++ if (inputstream == null) return table; ++ + Iterator iterator = IOUtils.readLines(inputstream, Charsets.UTF_8).iterator(); + + while (iterator.hasNext()) +++++ END PATCH +++++ REJECTED PATCH 2 + { + 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 ioexception) ++ catch (Exception ioexception) + { + ; + } ++ return table; + } + + static StringTranslate getInstance() +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch.rej b/rejects/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch.rej new file mode 100644 index 0000000000..4220361664 --- /dev/null +++ b/rejects/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch.rej @@ -0,0 +1,54 @@ +++++ REJECTED PATCH 1 + for (int j = 0; j < p_177630_3_; ++j) + { + WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(random, p_177630_1_); +- int k = weightedrandomchestcontent.theMinimumChanceToGenerateItem + random.nextInt(weightedrandomchestcontent.theMaximumChanceToGenerateItem - weightedrandomchestcontent.theMinimumChanceToGenerateItem + 1); ++ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(random, p_177630_2_); + +- if (weightedrandomchestcontent.theItemId.getMaxStackSize() >= k) ++ for (ItemStack itemstack : stacks) + { +- ItemStack itemstack = weightedrandomchestcontent.theItemId.copy(); +- itemstack.stackSize = k; + p_177630_2_.setInventorySlotContents(random.nextInt(p_177630_2_.getSizeInventory()), itemstack); + } +- else +- { +- for (int l = 0; l < k; ++l) +- { +- ItemStack itemstack1 = weightedrandomchestcontent.theItemId.copy(); +- itemstack1.stackSize = 1; +- p_177630_2_.setInventorySlotContents(random.nextInt(p_177630_2_.getSizeInventory()), itemstack1); +- } +- } + } + } + +++++ END PATCH +++++ REJECTED PATCH 2 + for (int j = 0; j < p_177631_3_; ++j) + { + WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(random, p_177631_1_); +- int k = weightedrandomchestcontent.theMinimumChanceToGenerateItem + random.nextInt(weightedrandomchestcontent.theMaximumChanceToGenerateItem - weightedrandomchestcontent.theMinimumChanceToGenerateItem + 1); ++ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(random, dispenser); + +- if (weightedrandomchestcontent.theItemId.getMaxStackSize() >= k) ++ for (ItemStack itemstack : stacks) + { +- ItemStack itemstack = weightedrandomchestcontent.theItemId.copy(); +- itemstack.stackSize = k; + dispenser.setInventorySlotContents(random.nextInt(dispenser.getSizeInventory()), itemstack); + } +- else +- { +- for (int l = 0; l < k; ++l) +- { +- ItemStack itemstack1 = weightedrandomchestcontent.theItemId.copy(); +- itemstack1.stackSize = 1; +- dispenser.setInventorySlotContents(random.nextInt(dispenser.getSizeInventory()), itemstack1); +- } +- } + } + } + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/Explosion.java.patch.rej b/rejects/minecraft/net/minecraft/world/Explosion.java.patch.rej new file mode 100644 index 0000000000..2cd87d5d33 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/Explosion.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 4 + int k1 = MathHelper.floor_double(this.explosionZ - (double)f3 - 1.0D); + int i1 = MathHelper.floor_double(this.explosionZ + (double)f3 + 1.0D); + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this.exploder, new AxisAlignedBB((double)j, (double)j1, (double)k1, (double)k, (double)l, (double)i1)); ++ net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.worldObj, this, list, f3); + Vec3 vec3 = new Vec3(this.explosionX, this.explosionY, this.explosionZ); + + for (int l1 = 0; l1 < list.size(); ++l1) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/WorldProvider.java.patch.rej b/rejects/minecraft/net/minecraft/world/WorldProvider.java.patch.rej new file mode 100644 index 0000000000..909aac6376 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/WorldProvider.java.patch.rej @@ -0,0 +1,17 @@ +++++ REJECTED PATCH 3 + + public int getAverageGroundLevel() + { +- return this.terrainType == WorldType.FLAT ? 4 : 64; ++ 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) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/WorldServer.java.patch.rej b/rejects/minecraft/net/minecraft/world/WorldServer.java.patch.rej new file mode 100644 index 0000000000..e14cede12e --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/WorldServer.java.patch.rej @@ -0,0 +1,90 @@ +++++ REJECTED PATCH 3 + public BiomeGenBase.SpawnListEntry func_175734_a(EnumCreatureType p_175734_1_, BlockPos p_175734_2_) + { + List list = this.getChunkProvider().func_177458_a(p_175734_1_, p_175734_2_); ++ list = net.minecraftforge.event.ForgeEventFactory.getPotentialSpawns(this, p_175734_1_, p_175734_2_, list); + return list != null && !list.isEmpty() ? (BiomeGenBase.SpawnListEntry)WeightedRandom.getRandomItem(this.rand, list) : null; + } + +++++ END PATCH +++++ REJECTED PATCH 7 + if (p_175654_2_.requiresUpdates()) + { + b0 = 8; ++ //Keeping here as a note for future when it may be restored. ++ boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(nextticklistentry.position.getX() >> 4, nextticklistentry.position.getZ() >> 4)); ++ b0 = (byte)(isForced ? 0 : 8); + + if (this.isAreaLoaded(nextticklistentry.position.add(-b0, -b0, -b0), nextticklistentry.position.add(b0, b0, b0))) + { +++++ END PATCH +++++ REJECTED PATCH 9 + { + nextticklistentry = (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; + byte b0 = 0; + + if (this.isAreaLoaded(nextticklistentry.position.add(-b0, -b0, -b0), nextticklistentry.position.add(b0, b0, b0))) +++++ END PATCH +++++ REJECTED PATCH 10 + { + ArrayList arraylist = Lists.newArrayList(); + +- for (int k1 = 0; k1 < this.loadedTileEntityList.size(); ++k1) ++ //Forge: Optomize this loop to only grab from the chunks it needs ++ for (int x = (p_147486_1_ >> 4); x <= (p_147486_4_ >> 4); x++) + { +- TileEntity tileentity = (TileEntity)this.loadedTileEntityList.get(k1); +- BlockPos blockpos = tileentity.getPos(); +- +- if (blockpos.getX() >= p_147486_1_ && blockpos.getY() >= p_147486_2_ && blockpos.getZ() >= p_147486_3_ && blockpos.getX() < p_147486_4_ && blockpos.getY() < p_147486_5_ && blockpos.getZ() < p_147486_6_) ++ for (int z = (p_147486_3_ >> 4); z <= (p_147486_6_ >> 4); z++) + { +- arraylist.add(tileentity); ++ Chunk chunk = this.getChunkFromChunkCoords(x, z); ++ if (chunk != null) ++ { ++ for (Object obj : chunk.getTileEntityMap().values()) ++ { ++ TileEntity entity = (TileEntity)obj; ++ if (!entity.isInvalid()) ++ { ++ BlockPos pos = entity.getPos(); ++ if (pos.getX() >= p_147486_1_ && pos.getY() >= p_147486_2_ && pos.getZ() >= p_147486_3_ && ++ pos.getX() <= p_147486_4_ && pos.getY() <= p_147486_5_ && pos.getZ() <= p_147486_6_) ++ { ++ arraylist.add(entity); ++ } ++ ++ } ++ } ++ } + } + } + +++++ END PATCH +++++ REJECTED PATCH 14 + } + + this.chunkProvider.saveChunks(p_73044_1_, p_73044_2_); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Save(this)); + List list = this.theChunkProviderServer.func_152380_a(); + Iterator iterator = list.iterator(); + +++++ END PATCH +++++ REJECTED PATCH 18 + return this.mcServer.isCallingFromMinecraftThread(); + } + ++ public java.io.File getChunkSaveLocation() ++ { ++ return ((net.minecraft.world.chunk.storage.AnvilChunkLoader)theChunkProviderServer.chunkLoader).chunkSaveLocation; ++ } ++ + static class ServerBlockEventList extends ArrayList + { + private static final String __OBFID = "CL_00001439"; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/WorldServerMulti.java.patch.rej b/rejects/minecraft/net/minecraft/world/WorldServerMulti.java.patch.rej new file mode 100644 index 0000000000..d7ea32b1c6 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/WorldServerMulti.java.patch.rej @@ -0,0 +1,32 @@ +++++ REJECTED PATCH 2 + { + WorldServerMulti.this.getWorldBorder().setDamageBuffer(newSize); + } +- }); ++ }; ++ this.delegate.getWorldBorder().addListener(this.borderListener); + } + +- protected void saveLevel() throws MinecraftException {} ++ protected void saveLevel() throws MinecraftException ++ { ++ this.perWorldStorage.saveAllData(); ++ } + + public World init() + { + this.mapStorage = this.delegate.getMapStorage(); + this.worldScoreboard = this.delegate.getScoreboard(); + 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 + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch.rej b/rejects/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch.rej new file mode 100644 index 0000000000..c9c7d3934f --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + int i1 = p_180624_2_.nextInt(16); + BlockPos blockpos1 = p_180624_3_.add(k, l, i1); + +- if (worldIn.getBlockState(blockpos1).getBlock() == Blocks.stone) ++ if (worldIn.getBlockState(blockpos1).getBlock().isReplaceableOreGen(worldIn, blockpos1, net.minecraft.block.state.pattern.BlockHelper.forBlock(Blocks.stone))) + { + worldIn.setBlockState(blockpos1, Blocks.emerald_ore.getDefaultState(), 2); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch.rej b/rejects/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch.rej new file mode 100644 index 0000000000..911c315e6f --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch.rej @@ -0,0 +1,22 @@ +++++ REJECTED PATCH 1 + File file1 = this.getWorldDirectory(); + File file2; + +- if (provider instanceof WorldProviderHell) ++ if (provider.getSaveFolder() != null) + { +- file2 = new File(file1, "DIM-1"); ++ file2 = new File(file1, provider.getSaveFolder()); + file2.mkdirs(); + return new AnvilChunkLoader(file2); + } +- else if (provider instanceof WorldProviderEnd) +- { +- file2 = new File(file1, "DIM1"); +- file2.mkdirs(); +- return new AnvilChunkLoader(file2); +- } + else + { + return new AnvilChunkLoader(file1); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch.rej b/rejects/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch.rej new file mode 100644 index 0000000000..89b9cdc9ac --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + + 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 iblockstate1 = this.get(x, y, z); + Block block = iblockstate1.getBlock(); + Block block1 = state.getBlock(); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch.rej new file mode 100644 index 0000000000..091395f9c1 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch.rej @@ -0,0 +1,31 @@ +++++ REJECTED PATCH 2 + { + IBlockState iblockstate1 = p_180707_5_.getBlockState(k2, j3, j4); + +- if (iblockstate1.getBlock() == Blocks.grass) ++ if (isTopBlock(p_180707_5_, k2, j3, j4, p_180707_3_, p_180707_4_)) + { + flag = true; + } + +- if (iblockstate1.getBlock() == Blocks.stone || iblockstate1.getBlock() == Blocks.dirt || iblockstate1.getBlock() == Blocks.grass) +- { +- if (j3 - 1 < 10) +- { +- p_180707_5_.setBlockState(k2, j3, j4, Blocks.flowing_lava.getDefaultState()); +- } +- else +- { +- p_180707_5_.setBlockState(k2, j3, j4, Blocks.air.getDefaultState()); +- +- if (flag && p_180707_5_.getBlockState(k2, j3 - 1, j4).getBlock() == Blocks.dirt) +- { +- p_180707_5_.setBlockState(k2, j3 - 1, j4, this.worldObj.getBiomeGenForCoords(new BlockPos(k2 + p_180707_3_ * 16, 0, j4 + p_180707_4_ * 16)).topBlock); +- } +- } +- } ++ digBlock(p_180707_5_, k2, j3, j4, p_180707_3_, p_180707_4_, flag); + } + } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch.rej new file mode 100644 index 0000000000..9f4017dba1 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch.rej @@ -0,0 +1,38 @@ +++++ REJECTED PATCH 1 + { + if (k >= 0 && k < 256) + { +- Block block = worldIn.getBlockState(new BlockPos(l, k, i1)).getBlock(); ++ BlockPos pos = new BlockPos(l, k, i1); ++ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(pos); + +- if (block.getMaterial() != Material.air && block.getMaterial() != Material.leaves) ++ if (!state.getBlock().isAir(worldIn, pos) && !state.getBlock().isLeaves(worldIn, pos)) + { + flag = false; + } +++++ END PATCH +++++ REJECTED PATCH 2 + { + BlockPos blockpos1 = new BlockPos(i2, l, j1); + +- if (!worldIn.getBlockState(blockpos1).getBlock().isFullBlock()) ++ if (worldIn.getBlockState(blockpos1).getBlock().canBeReplacedByLeaves(worldIn, blockpos1)) + { + this.func_175905_a(worldIn, blockpos1, Block.getBlockById(Block.getIdFromBlock(Blocks.brown_mushroom_block) + i), k1); + } +++++ END PATCH +++++ REJECTED PATCH 3 + + for (l = 0; l < j; ++l) + { +- Block block2 = worldIn.getBlockState(p_180709_3_.up(l)).getBlock(); ++ BlockPos upN = p_180709_3_.up(l); ++ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(upN); + +- if (!block2.isFullBlock()) ++ if (state.getBlock().canBeReplacedByLeaves(worldIn, upN)) + { + this.func_175905_a(worldIn, p_180709_3_.up(l), Block.getBlockById(Block.getIdFromBlock(Blocks.brown_mushroom_block) + i), 10); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch.rej new file mode 100644 index 0000000000..442445d1e6 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch.rej @@ -0,0 +1,23 @@ +++++ REJECTED PATCH 1 + if (Math.pow((double)Math.abs(j) + 0.5D, 2.0D) + Math.pow((double)Math.abs(k) + 0.5D, 2.0D) <= (double)(p_180712_2_ * p_180712_2_)) + { + BlockPos blockpos1 = p_180712_1_.add(j, 0, k); +- Material material = this.world.getBlockState(blockpos1).getBlock().getMaterial(); ++ net.minecraft.block.state.IBlockState state = this.world.getBlockState(blockpos1); + +- if (material == Material.air || material == Material.leaves) ++ if (state.getBlock().isAir(this.world, blockpos1) || state.getBlock().isLeaves(this.world, blockpos1)) + { + this.func_175905_a(this.world, blockpos1, p_180712_3_, 0); + } +++++ END PATCH +++++ REJECTED PATCH 2 + { + BlockPos blockpos3 = p_175936_1_.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(blockpos3).getBlock())) ++ if (!this.isReplaceable(world, blockpos3)) + { + return j; + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch.rej new file mode 100644 index 0000000000..d0aa9d3298 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch.rej @@ -0,0 +1,69 @@ +++++ REJECTED PATCH 1 + { + if (j >= 0 && j < 256) + { +- if (!this.func_150523_a(worldIn.getBlockState(new BlockPos(k, j, l)).getBlock())) ++ if (!this.isReplaceable(worldIn, new BlockPos(k, j, l))) + { + flag = false; + } +++++ END PATCH +++++ REJECTED PATCH 2 + } + else + { +- Block block = worldIn.getBlockState(p_180709_3_.down()).getBlock(); ++ BlockPos down = p_180709_3_.down(); ++ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(down); ++ boolean isSoil = state.getBlock().canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); + +- if ((block == Blocks.grass || block == Blocks.dirt) && p_180709_3_.getY() < 256 - i - 1) ++ if (isSoil && p_180709_3_.getY() < 256 - i - 1) + { +- this.func_175921_a(worldIn, p_180709_3_.down()); +- this.func_175921_a(worldIn, p_180709_3_.add(1, -1, 0)); +- this.func_175921_a(worldIn, p_180709_3_.add(1, -1, 1)); +- this.func_175921_a(worldIn, p_180709_3_.add(0, -1, 1)); ++ this.onPlantGrow(worldIn, p_180709_3_.down(), p_180709_3_); ++ this.onPlantGrow(worldIn, p_180709_3_.add(1, -1, 0), p_180709_3_); ++ this.onPlantGrow(worldIn, p_180709_3_.add(1, -1, 1), p_180709_3_); ++ this.onPlantGrow(worldIn, p_180709_3_.add(0, -1, 1), p_180709_3_); + EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.random(p_180709_2_); + k = i - p_180709_2_.nextInt(4); + l = 2 - p_180709_2_.nextInt(3); +++++ END PATCH +++++ REJECTED PATCH 3 + } + + BlockPos blockpos1 = new BlockPos(i1, i2, j1); +- Material material = worldIn.getBlockState(blockpos1).getBlock().getMaterial(); ++ state = worldIn.getBlockState(blockpos1); + +- if (material == Material.air || material == Material.leaves) ++ if (state.getBlock().isAir(worldIn, blockpos1) || state.getBlock().isLeaves(worldIn, blockpos1)) + { + this.func_175905_a(worldIn, blockpos1, Blocks.log2, BlockPlanks.EnumType.DARK_OAK.getMetadata() - 4); + this.func_175905_a(worldIn, blockpos1.east(), Blocks.log2, BlockPlanks.EnumType.DARK_OAK.getMetadata() - 4); +++++ END PATCH +++++ REJECTED PATCH 4 + + private void func_150526_a(World worldIn, int p_150526_2_, int p_150526_3_, int p_150526_4_) + { +- Block block = worldIn.getBlockState(new BlockPos(p_150526_2_, p_150526_3_, p_150526_4_)).getBlock(); ++ BlockPos pos = new BlockPos(p_150526_2_, p_150526_3_, p_150526_4_); ++ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(pos); + +- if (block.getMaterial() == Material.air) ++ if (state.getBlock().isAir(worldIn, pos)) + { + this.func_175905_a(worldIn, new BlockPos(p_150526_2_, p_150526_3_, p_150526_4_), Blocks.leaves2, 1); + } + } ++ ++ //Just a helper macro ++ private void onPlantGrow(World world, BlockPos pos, BlockPos source) ++ { ++ world.getBlockState(pos).getBlock().onPlantGrow(world, pos, source); ++ } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch.rej new file mode 100644 index 0000000000..a002246145 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch.rej @@ -0,0 +1,42 @@ +++++ REJECTED PATCH 1 + { + if (j >= 0 && j < 256) + { +- if (!this.func_150523_a(worldIn.getBlockState(new BlockPos(k, j, l)).getBlock())) ++ if (!this.isReplaceable(worldIn, new BlockPos(k, j, l))) + { + flag = false; + } +++++ END PATCH +++++ REJECTED PATCH 2 + } + else + { +- Block block1 = worldIn.getBlockState(p_180709_3_.down()).getBlock(); ++ BlockPos down = p_180709_3_.down(); ++ Block block1 = worldIn.getBlockState(down).getBlock(); ++ boolean isSoil = block1.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); + +- if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland) && p_180709_3_.getY() < 256 - i - 1) ++ if (isSoil && p_180709_3_.getY() < 256 - i - 1) + { +- this.func_175921_a(worldIn, p_180709_3_.down()); ++ block1.onPlantGrow(worldIn, down, p_180709_3_); + int i2; + + for (i2 = p_180709_3_.getY() - 3 + i; i2 <= p_180709_3_.getY() + i; ++i2) +++++ END PATCH +++++ REJECTED PATCH 4 + + for (i2 = 0; i2 < i; ++i2) + { +- Block block2 = worldIn.getBlockState(p_180709_3_.up(i2)).getBlock(); ++ BlockPos upN = p_180709_3_.up(i2); ++ Block block2 = worldIn.getBlockState(upN).getBlock(); + +- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves) ++ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN)) + { + this.func_175905_a(worldIn, p_180709_3_.up(i2), Blocks.log, BlockPlanks.EnumType.BIRCH.getMetadata()); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch.rej new file mode 100644 index 0000000000..967d42121c --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch.rej @@ -0,0 +1,57 @@ +++++ REJECTED PATCH 1 + { + for (int l = -b0; l <= b0 && flag; ++l) + { +- if (p_175926_2_.getY() + j < 0 || p_175926_2_.getY() + j >= 256 || !this.func_150523_a(worldIn.getBlockState(p_175926_2_.add(k, j, l)).getBlock())) ++ if (p_175926_2_.getY() + j < 0 || p_175926_2_.getY() + j >= 256 || !this.isReplaceable(worldIn, p_175926_2_.add(k, j, l))) + { + flag = false; + } +++++ END PATCH +++++ REJECTED PATCH 2 + { + BlockPos blockpos1 = p_175927_1_.down(); + Block block = worldIn.getBlockState(blockpos1).getBlock(); ++ boolean isSoil = block.canSustainPlant(worldIn, blockpos1, 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, blockpos1); +- this.func_175921_a(worldIn, blockpos1.east()); +- this.func_175921_a(worldIn, blockpos1.south()); +- this.func_175921_a(worldIn, blockpos1.south().east()); ++ this.onPlantGrow(worldIn, blockpos1, p_175927_1_); ++ this.onPlantGrow(worldIn, blockpos1.east(), p_175927_1_); ++ this.onPlantGrow(worldIn, blockpos1.south(), p_175927_1_); ++ this.onPlantGrow(worldIn, blockpos1.south().east(), p_175927_1_); + return true; + } + else +++++ END PATCH +++++ REJECTED PATCH 3 + if (k * k + l * l <= j || i1 * i1 + j1 * j1 <= j || k * k + j1 * j1 <= j || i1 * i1 + l * l <= j) + { + BlockPos blockpos1 = p_175925_2_.add(k, 0, l); +- Material material = worldIn.getBlockState(blockpos1).getBlock().getMaterial(); ++ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(blockpos1); + +- if (material == Material.air || material == Material.leaves) ++ if (state.getBlock().isAir(worldIn, blockpos1) || state.getBlock().isLeaves(worldIn, blockpos1)) + { + this.func_175905_a(worldIn, blockpos1, Blocks.leaves, this.leavesMetadata); + } +++++ END PATCH +++++ REJECTED PATCH 4 + if (k * k + l * l <= j) + { + BlockPos blockpos1 = p_175928_2_.add(k, 0, l); +- Material material = worldIn.getBlockState(blockpos1).getBlock().getMaterial(); ++ Block block = worldIn.getBlockState(blockpos1).getBlock(); + +- if (material == Material.air || material == Material.leaves) ++ if (block.isAir(worldIn, blockpos1) || block.isLeaves(worldIn, blockpos1)) + { + this.func_175905_a(worldIn, blockpos1, Blocks.leaves, this.leavesMetadata); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch.rej new file mode 100644 index 0000000000..9b9e63413a --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch.rej @@ -0,0 +1,53 @@ +++++ REJECTED PATCH 1 + { + BlockPos blockpos1 = p_180709_3_.up(i2); + +- if (this.func_175931_a(worldIn.getBlockState(blockpos1).getBlock().getMaterial())) ++ if (this.isAirLeaves(worldIn, blockpos1)) + { + this.func_175905_a(worldIn, blockpos1, Blocks.log, this.woodMetadata); + +++++ END PATCH +++++ REJECTED PATCH 2 + { + BlockPos blockpos2 = blockpos1.east(); + +- if (this.func_175931_a(worldIn.getBlockState(blockpos2).getBlock().getMaterial())) ++ if (this.isAirLeaves(worldIn, blockpos2)) + { + this.func_175905_a(worldIn, blockpos2, Blocks.log, this.woodMetadata); + +++++ END PATCH +++++ REJECTED PATCH 3 + + BlockPos blockpos3 = blockpos1.south().east(); + +- if (this.func_175931_a(worldIn.getBlockState(blockpos3).getBlock().getMaterial())) ++ if (this.isAirLeaves(worldIn, blockpos3)) + { + this.func_175905_a(worldIn, blockpos3, Blocks.log, this.woodMetadata); + +++++ END PATCH +++++ REJECTED PATCH 4 + + BlockPos blockpos4 = blockpos1.south(); + +- if (this.func_175931_a(worldIn.getBlockState(blockpos4).getBlock().getMaterial())) ++ if (this.isAirLeaves(worldIn, blockpos4)) + { + this.func_175905_a(worldIn, blockpos4, Blocks.log, this.woodMetadata); + +++++ END PATCH +++++ REJECTED PATCH 5 + } + } + +- private boolean func_175931_a(Material p_175931_1_) +- { +- return p_175931_1_ == Material.air || p_175931_1_ == Material.leaves; +- } +- + private void func_175932_b(World worldIn, Random p_175932_2_, BlockPos p_175932_3_, int p_175932_4_) + { + if (p_175932_2_.nextInt(3) > 0 && worldIn.isAirBlock(p_175932_3_)) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch.rej new file mode 100644 index 0000000000..5fcea52b7f --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch.rej @@ -0,0 +1,65 @@ +++++ REJECTED PATCH 1 + + for (int j = 0; j < i; ++j) + { +- Block block = worldIn.getBlockState(p_180709_3_.up(j)).getBlock(); +- +- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) ++ if (this.isAirLeaves(worldIn, p_180709_3_.up(j))) + { + this.func_175905_a(worldIn, p_180709_3_.up(j), Blocks.log, this.woodMetadata); + } + + if (j < i - 1) + { +- block = worldIn.getBlockState(p_180709_3_.add(1, j, 0)).getBlock(); +- +- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) ++ if (this.isAirLeaves(worldIn, p_180709_3_.add(1, j, 0))) + { + this.func_175905_a(worldIn, p_180709_3_.add(1, j, 0), Blocks.log, this.woodMetadata); + } + +- block = worldIn.getBlockState(p_180709_3_.add(1, j, 1)).getBlock(); +- +- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) ++ if (this.isAirLeaves(worldIn, p_180709_3_.add(1, j, 1))) + { + this.func_175905_a(worldIn, p_180709_3_.add(1, j, 1), Blocks.log, this.woodMetadata); + } + +- block = worldIn.getBlockState(p_180709_3_.add(0, j, 1)).getBlock(); +- +- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) ++ if (this.isAirLeaves(worldIn, p_180709_3_.add(0, j, 1))) + { + this.func_175905_a(worldIn, p_180709_3_.add(0, j, 1), Blocks.log, this.woodMetadata); + } +++++ END PATCH +++++ REJECTED PATCH 2 + BlockPos blockpos1 = p_175934_2_.up(i); + Block block = worldIn.getBlockState(blockpos1).getBlock(); + +- if (block == Blocks.grass || block == Blocks.dirt) ++ if (block.canSustainPlant(worldIn, blockpos1, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling))) + { + this.func_175905_a(worldIn, blockpos1, Blocks.dirt, BlockDirt.DirtType.PODZOL.getMetadata()); + break; + } + +- if (block.getMaterial() != Material.air && i < 0) ++ if (!block.isAir(worldIn, blockpos1) && i < 0) + { + break; + } + } + } ++ ++ //Helper macro ++ private boolean isAirLeaves(World world, BlockPos pos) ++ { ++ net.minecraft.block.Block block = world.getBlockState(pos).getBlock(); ++ return block.isAir(world, pos) || block.isLeaves(world, pos); ++ } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch.rej new file mode 100644 index 0000000000..a059962ccf --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + { + BlockPos blockpos1 = new BlockPos(l1, i2, j2); + +- if (this.field_175919_c.apply(worldIn.getBlockState(blockpos1))) ++ if (worldIn.getBlockState(blockpos1).getBlock().isReplaceableOreGen(worldIn, blockpos1, this.field_175919_c)) + { + worldIn.setBlockState(blockpos1, this.oreBlock, 2); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch.rej new file mode 100644 index 0000000000..bdaa224b72 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch.rej @@ -0,0 +1,36 @@ +++++ REJECTED PATCH 1 + { + if (j >= 0 && j < 256) + { +- if (!this.func_150523_a(worldIn.getBlockState(new BlockPos(k, j, l)).getBlock())) ++ if (!this.isReplaceable(worldIn, new BlockPos(k, j, l))) + { + flag = false; + } +++++ END PATCH +++++ REJECTED PATCH 3 + } + + BlockPos blockpos1 = new BlockPos(i1, i2, j1); +- Material material = worldIn.getBlockState(blockpos1).getBlock().getMaterial(); ++ block = worldIn.getBlockState(blockpos1).getBlock(); + +- if (material == Material.air || material == Material.leaves) ++ if (block.isAir(worldIn, blockpos1) || block.isLeaves(worldIn, blockpos1)) + { + this.func_175905_a(worldIn, blockpos1, Blocks.log2, BlockPlanks.EnumType.ACACIA.getMetadata() - 4); + k1 = i2; +++++ END PATCH +++++ REJECTED PATCH 4 + i1 += enumfacing1.getFrontOffsetX(); + j1 += enumfacing1.getFrontOffsetZ(); + BlockPos blockpos2 = new BlockPos(i1, j2, j1); +- Material material1 = worldIn.getBlockState(blockpos2).getBlock().getMaterial(); ++ block = worldIn.getBlockState(blockpos2).getBlock(); + +- if (material1 == Material.air || material1 == Material.leaves) ++ if (block.isAir(worldIn, blockpos2) || block.isLeaves(worldIn, blockpos2)) + { + this.func_175905_a(worldIn, blockpos2, Blocks.log2, BlockPlanks.EnumType.ACACIA.getMetadata() - 4); + k1 = j2; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch.rej new file mode 100644 index 0000000000..dc7aec5a21 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 2 + { + BlockPos blockpos1 = new BlockPos(l, i, j1); + +- if (!worldIn.getBlockState(blockpos1).getBlock().isFullBlock()) ++ if (worldIn.getBlockState(blockpos1).getBlock().canBeReplacedByLeaves(worldIn, blockpos1)) + { + this.func_175905_a(worldIn, blockpos1, Blocks.leaves, this.field_150528_a); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch.rej new file mode 100644 index 0000000000..61f1d8a607 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch.rej @@ -0,0 +1,102 @@ +++++ REJECTED PATCH 1 + { + if (j >= 0 && j < 256) + { +- Block block = worldIn.getBlockState(new BlockPos(k, j, l)).getBlock(); ++ BlockPos pos = new BlockPos(k, j, l); ++ Block block = worldIn.getBlockState(pos).getBlock(); + +- if (block.getMaterial() != Material.air && block.getMaterial() != Material.leaves) ++ if (!block.isAir(worldIn, pos) && !block.isLeaves(worldIn, pos)) + { + if (block != Blocks.water && block != Blocks.flowing_water) + { +++++ END PATCH +++++ REJECTED PATCH 2 + } + else + { +- Block block1 = worldIn.getBlockState(p_180709_3_.down()).getBlock(); ++ BlockPos down = p_180709_3_.down(); ++ Block block1 = worldIn.getBlockState(down).getBlock(); ++ boolean isSoil = block1.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); + +- if ((block1 == Blocks.grass || block1 == Blocks.dirt) && p_180709_3_.getY() < 256 - i - 1) ++ if (isSoil && p_180709_3_.getY() < 256 - i - 1) + { +- this.func_175921_a(worldIn, p_180709_3_.down()); ++ block1.onPlantGrow(worldIn, down, p_180709_3_); + int i1; + BlockPos blockpos1; + int l1; +++++ END PATCH +++++ REJECTED PATCH 3 + { + blockpos1 = new BlockPos(i2, l1, j1); + +- if (!worldIn.getBlockState(blockpos1).getBlock().isFullBlock()) ++ if (worldIn.getBlockState(blockpos1).getBlock().canBeReplacedByLeaves(worldIn, blockpos1)) + { + this.func_175906_a(worldIn, blockpos1, Blocks.leaves); + } +++++ END PATCH +++++ REJECTED PATCH 4 + + for (l1 = 0; l1 < i; ++l1) + { +- Block block2 = worldIn.getBlockState(p_180709_3_.up(l1)).getBlock(); ++ BlockPos upN = p_180709_3_.up(l1); ++ Block block2 = worldIn.getBlockState(upN).getBlock(); + +- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves || block2 == Blocks.flowing_water || block2 == Blocks.water) ++ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN) || block2 == Blocks.flowing_water || block2 == Blocks.water) + { + this.func_175906_a(worldIn, p_180709_3_.up(l1), Blocks.log); + } +++++ END PATCH +++++ REJECTED PATCH 5 + { + BlockPos blockpos4 = new BlockPos(i2, l1, i1); + +- if (worldIn.getBlockState(blockpos4).getBlock().getMaterial() == Material.leaves) ++ if (worldIn.getBlockState(blockpos4).getBlock().isLeaves(worldIn, blockpos4)) + { + BlockPos blockpos5 = blockpos4.west(); + blockpos1 = blockpos4.east(); + BlockPos blockpos2 = blockpos4.north(); + BlockPos blockpos3 = blockpos4.south(); + +- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos5).getBlock().getMaterial() == Material.air) ++ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos5).getBlock().isAir(worldIn, blockpos5)) + { + this.func_175922_a(worldIn, blockpos5, BlockVine.EAST_FLAG); + } + +- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().getMaterial() == Material.air) ++ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().isAir(worldIn, blockpos1)) + { + this.func_175922_a(worldIn, blockpos1, BlockVine.WEST_FLAG); + } + +- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().getMaterial() == Material.air) ++ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().isAir(worldIn, blockpos2)) + { + this.func_175922_a(worldIn, blockpos2, BlockVine.SOUTH_FLAG); + } + +- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).getBlock().getMaterial() == Material.air) ++ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).getBlock().isAir(worldIn, blockpos3)) + { + this.func_175922_a(worldIn, blockpos3, BlockVine.NORTH_FLAG); + } +++++ END PATCH +++++ REJECTED PATCH 6 + this.func_175905_a(worldIn, p_175922_2_, Blocks.vine, p_175922_3_); + int j = 4; + +- for (p_175922_2_ = p_175922_2_.down(); worldIn.getBlockState(p_175922_2_).getBlock().getMaterial() == Material.air && j > 0; --j) ++ for (p_175922_2_ = p_175922_2_.down(); worldIn.getBlockState(p_175922_2_).getBlock().isAir(worldIn, p_175922_2_) && j > 0; --j) + { + this.func_175905_a(worldIn, p_175922_2_, Blocks.vine, p_175922_3_); + p_175922_2_ = p_175922_2_.down(); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch.rej new file mode 100644 index 0000000000..349fa3cca1 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch.rej @@ -0,0 +1,52 @@ +++++ REJECTED PATCH 1 + { + if (i1 >= 0 && i1 < 256) + { +- if (!this.func_150523_a(worldIn.getBlockState(new BlockPos(j1, i1, k1)).getBlock())) ++ if (!this.isReplaceable(worldIn, new BlockPos(j1, i1, k1))) + { + flag = false; + } +++++ END PATCH +++++ REJECTED PATCH 2 + } + else + { +- Block block = worldIn.getBlockState(p_180709_3_.down()).getBlock(); ++ BlockPos down = p_180709_3_.down(); ++ Block block = worldIn.getBlockState(down).getBlock(); ++ boolean isSoil = block.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.sapling); + +- if ((block == Blocks.grass || block == Blocks.dirt) && p_180709_3_.getY() < 256 - i - 1) ++ if (isSoil && p_180709_3_.getY() < 256 - i - 1) + { +- this.func_175921_a(worldIn, p_180709_3_.down()); ++ block.onPlantGrow(worldIn, down, p_180709_3_); + k2 = 0; + + for (j1 = p_180709_3_.getY() + i; j1 >= p_180709_3_.getY() + j; --j1) +++++ END PATCH +++++ REJECTED PATCH 3 + { + BlockPos blockpos1 = new BlockPos(k1, j1, i2); + +- if (!worldIn.getBlockState(blockpos1).getBlock().isFullBlock()) ++ if (worldIn.getBlockState(blockpos1).getBlock().canBeReplacedByLeaves(worldIn, blockpos1)) + { + this.func_175905_a(worldIn, blockpos1, Blocks.leaves, BlockPlanks.EnumType.SPRUCE.getMetadata()); + } +++++ END PATCH +++++ REJECTED PATCH 4 + + for (j1 = 0; j1 < i - 1; ++j1) + { +- Block block1 = worldIn.getBlockState(p_180709_3_.up(j1)).getBlock(); ++ BlockPos upN = p_180709_3_.up(j1); ++ Block block1 = worldIn.getBlockState(upN).getBlock(); + +- if (block1.getMaterial() == Material.air || block1.getMaterial() == Material.leaves) ++ if (block1.isAir(worldIn, upN) || block1.isLeaves(worldIn, upN)) + { + this.func_175905_a(worldIn, p_180709_3_.up(j1), Blocks.log, BlockPlanks.EnumType.SPRUCE.getMetadata()); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch.rej new file mode 100644 index 0000000000..677e44789c --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch.rej @@ -0,0 +1,56 @@ +++++ REJECTED PATCH 1 + { + if (i1 >= 0 && i1 < 256) + { +- Block block = worldIn.getBlockState(new BlockPos(j1, i1, k1)).getBlock(); ++ BlockPos off = new BlockPos(j1, i1, k1); ++ Block block = worldIn.getBlockState(off).getBlock(); + +- if (block.getMaterial() != Material.air && block.getMaterial() != Material.leaves) ++ if (!block.isAir(worldIn, off) && !block.isLeaves(worldIn, off)) + { + flag = false; + } +++++ END PATCH +++++ REJECTED PATCH 2 + } + else + { +- Block block1 = worldIn.getBlockState(p_180709_3_.down()).getBlock(); ++ BlockPos down = p_180709_3_.down(); ++ Block block1 = worldIn.getBlockState(down).getBlock(); ++ boolean isSoil = block1.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.sapling); + +- if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland) && p_180709_3_.getY() < 256 - i - 1) ++ if (isSoil && p_180709_3_.getY() < 256 - i - 1) + { +- this.func_175921_a(worldIn, p_180709_3_.down()); ++ block1.onPlantGrow(worldIn, down, p_180709_3_); + i3 = p_180709_2_.nextInt(2); + j1 = 1; + byte b0 = 0; +++++ END PATCH +++++ REJECTED PATCH 3 + { + BlockPos blockpos1 = new BlockPos(i2, l1, k2); + +- if (!worldIn.getBlockState(blockpos1).getBlock().isFullBlock()) ++ if (worldIn.getBlockState(blockpos1).getBlock().canBeReplacedByLeaves(worldIn, blockpos1)) + { + this.func_175905_a(worldIn, blockpos1, Blocks.leaves, BlockPlanks.EnumType.SPRUCE.getMetadata()); + } +++++ END PATCH +++++ REJECTED PATCH 4 + + for (l1 = 0; l1 < i - j3; ++l1) + { +- Block block2 = worldIn.getBlockState(p_180709_3_.up(l1)).getBlock(); ++ BlockPos upN = p_180709_3_.up(l1); ++ Block block2 = worldIn.getBlockState(upN).getBlock(); + +- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves) ++ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN)) + { + this.func_175905_a(worldIn, p_180709_3_.up(l1), Blocks.log, BlockPlanks.EnumType.SPRUCE.getMetadata()); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch.rej new file mode 100644 index 0000000000..6cd81a5814 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch.rej @@ -0,0 +1,88 @@ +++++ REJECTED PATCH 1 + { + if (j >= 0 && j < 256) + { +- if (!this.func_150523_a(worldIn.getBlockState(new BlockPos(k, j, l)).getBlock())) ++ if (!this.isReplaceable(worldIn, new BlockPos(k, j, l))) + { + flag = false; + } +++++ END PATCH +++++ REJECTED PATCH 2 + } + else + { +- Block block1 = worldIn.getBlockState(p_180709_3_.down()).getBlock(); ++ BlockPos down = p_180709_3_.down(); ++ Block block1 = worldIn.getBlockState(down).getBlock(); ++ boolean isSoil = block1.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.sapling); + +- if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland) && p_180709_3_.getY() < 256 - i - 1) ++ if (isSoil && p_180709_3_.getY() < 256 - i - 1) + { +- this.func_175921_a(worldIn, p_180709_3_.down()); ++ block1.onPlantGrow(worldIn, down, p_180709_3_); + b0 = 3; + byte b1 = 0; + int i1; +++++ END PATCH +++++ REJECTED PATCH 4 + + for (l = 0; l < i; ++l) + { +- Block block2 = worldIn.getBlockState(p_180709_3_.up(l)).getBlock(); ++ BlockPos upN = p_180709_3_.up(l); ++ Block block2 = worldIn.getBlockState(upN).getBlock(); + +- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves || block2.getMaterial() == Material.vine) ++ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN) || block2.getMaterial() == Material.vine) + { + this.func_175905_a(worldIn, p_180709_3_.up(l), Blocks.log, this.metaWood); + +++++ END PATCH +++++ REJECTED PATCH 5 + { + BlockPos blockpos3 = new BlockPos(k1, l, l1); + +- if (worldIn.getBlockState(blockpos3).getBlock().getMaterial() == Material.leaves) ++ if (worldIn.getBlockState(blockpos3).getBlock().isLeaves(worldIn, blockpos3)) + { + BlockPos blockpos4 = blockpos3.west(); + blockpos1 = blockpos3.east(); + BlockPos blockpos5 = blockpos3.north(); + BlockPos blockpos2 = blockpos3.south(); + +- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getBlock().getMaterial() == Material.air) ++ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getBlock().isAir(worldIn, blockpos4)) + { + this.func_175923_a(worldIn, blockpos4, BlockVine.EAST_FLAG); + } + +- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().getMaterial() == Material.air) ++ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().isAir(worldIn, blockpos1)) + { + this.func_175923_a(worldIn, blockpos1, BlockVine.WEST_FLAG); + } + +- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos5).getBlock().getMaterial() == Material.air) ++ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos5).getBlock().isAir(worldIn, blockpos5)) + { + this.func_175923_a(worldIn, blockpos5, BlockVine.SOUTH_FLAG); + } + +- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().getMaterial() == Material.air) ++ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().isAir(worldIn, blockpos2)) + { + this.func_175923_a(worldIn, blockpos2, BlockVine.NORTH_FLAG); + } +++++ END PATCH +++++ REJECTED PATCH 6 + this.func_175905_a(worldIn, p_175923_2_, Blocks.vine, p_175923_3_); + int j = 4; + +- for (p_175923_2_ = p_175923_2_.down(); worldIn.getBlockState(p_175923_2_).getBlock().getMaterial() == Material.air && j > 0; --j) ++ for (p_175923_2_ = p_175923_2_.down(); worldIn.getBlockState(p_175923_2_).getBlock().isAir(worldIn, p_175923_2_) && j > 0; --j) + { + this.func_175905_a(worldIn, p_175923_2_, Blocks.vine, p_175923_3_); + p_175923_2_ = p_175923_2_.down(); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch.rej new file mode 100644 index 0000000000..35b8bd6db0 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch.rej @@ -0,0 +1,21 @@ +++++ REJECTED PATCH 1 + { + BiomeGenBase biomegenbase = abiomegenbase[j]; + +- if (biomegenbase != null && biomegenbase.minHeight > 0.0F) ++ if (biomegenbase != null && biomegenbase.minHeight > 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_) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch.rej new file mode 100644 index 0000000000..8cb954dc58 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 3 + abstract static class Piece extends StructureComponent + { + protected static final List field_111019_a = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.diamond, 0, 1, 3, 5), new WeightedRandomChestContent(Items.iron_ingot, 0, 1, 5, 5), new WeightedRandomChestContent(Items.gold_ingot, 0, 1, 3, 15), new WeightedRandomChestContent(Items.golden_sword, 0, 1, 1, 5), new WeightedRandomChestContent(Items.golden_chestplate, 0, 1, 1, 5), new WeightedRandomChestContent(Items.flint_and_steel, 0, 1, 1, 5), new WeightedRandomChestContent(Items.nether_wart, 0, 3, 7, 5), new WeightedRandomChestContent(Items.saddle, 0, 1, 1, 10), new WeightedRandomChestContent(Items.golden_horse_armor, 0, 1, 1, 8), new WeightedRandomChestContent(Items.iron_horse_armor, 0, 1, 1, 5), new WeightedRandomChestContent(Items.diamond_horse_armor, 0, 1, 1, 3), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.obsidian), 0, 2, 4, 2)}); ++ static { net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, field_111019_a, 2, 5); } + private static final String __OBFID = "CL_00000466"; + + public Piece() {} +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/storage/SaveHandler.java.patch.rej b/rejects/minecraft/net/minecraft/world/storage/SaveHandler.java.patch.rej new file mode 100644 index 0000000000..5c25036b46 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/storage/SaveHandler.java.patch.rej @@ -0,0 +1,48 @@ +++++ REJECTED PATCH 1 + NBTTagCompound nbttagcompound; + NBTTagCompound nbttagcompound1; + ++ WorldInfo worldInfo = null; ++ + if (file1.exists()) + { + try + { + nbttagcompound = CompressedStreamTools.readCompressed(new FileInputStream(file1)); + nbttagcompound1 = nbttagcompound.getCompoundTag("Data"); +- return new WorldInfo(nbttagcompound1); ++ worldInfo = new WorldInfo(nbttagcompound1); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound); ++ return worldInfo; + } ++ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e) ++ { ++ throw e; ++ } + catch (Exception exception1) + { + exception1.printStackTrace(); + } + } + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().confirmBackupLevelDatUse(this); + file1 = new File(this.worldDirectory, "level.dat_old"); + + if (file1.exists()) +++++ END PATCH +++++ REJECTED PATCH 2 + { + nbttagcompound = CompressedStreamTools.readCompressed(new FileInputStream(file1)); + nbttagcompound1 = nbttagcompound.getCompoundTag("Data"); +- return new WorldInfo(nbttagcompound1); ++ worldInfo = new WorldInfo(nbttagcompound1); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound); ++ return worldInfo; ++ } ++ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e) ++ { ++ throw e; + } + catch (Exception exception) + { +++++ END PATCH