diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index cf7783440..e0f482cf5 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -1,20 +1,20 @@ --- ../src-base/minecraft/net/minecraft/block/Block.java +++ ../src-work/minecraft/net/minecraft/block/Block.java -@@ -1,15 +1,22 @@ - package net.minecraft.block; - --import cpw.mods.fml.relauncher.Side; --import cpw.mods.fml.relauncher.SideOnly; -+import static net.minecraftforge.common.ForgeDirection.DOWN; -+import static net.minecraftforge.common.ForgeDirection.UP; +@@ -3,24 +3,36 @@ + import cpw.mods.fml.common.registry.GameData; + import cpw.mods.fml.relauncher.Side; + import cpw.mods.fml.relauncher.SideOnly; + +import java.util.ArrayList; ++import java.util.HashMap; + import java.util.Iterator; import java.util.List; import java.util.Random; + + import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; +import net.minecraft.client.particle.EffectRenderer; - import net.minecraft.client.renderer.texture.IconRegister; + import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; @@ -25,181 +25,174 @@ import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityXPOrb; import net.minecraft.entity.player.EntityPlayer; -@@ -26,8 +33,10 @@ - import net.minecraft.item.ItemSnow; ++import net.minecraft.init.Blocks; + import net.minecraft.item.Item; ++import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.stats.StatList; +import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntitySign; import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.ChunkCoordinates; - import net.minecraft.util.Icon; + import net.minecraft.util.IIcon; import net.minecraft.util.MovingObjectPosition; - import net.minecraft.util.StatCollector; -@@ -35,9 +44,20 @@ + import net.minecraft.util.RegistryNamespaced; +@@ -30,6 +42,15 @@ import net.minecraft.world.Explosion; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraft.world.WorldProviderEnd; +import net.minecraftforge.common.EnumPlantType; -+import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.ForgeHooks; +import net.minecraftforge.common.IPlantable; -+import net.minecraftforge.common.RotationHelper; ++import net.minecraftforge.common.MinecraftForge; ++import net.minecraftforge.common.util.ForgeDirection; ++import net.minecraftforge.common.util.RotationHelper; +import net.minecraftforge.event.ForgeEventFactory; -+import cpw.mods.fml.relauncher.Side; -+import cpw.mods.fml.relauncher.SideOnly; ++import static net.minecraftforge.common.util.ForgeDirection.*; public class Block { -+ protected static int[] blockFireSpreadSpeed = new int[4096]; -+ protected static int[] blockFlammability = new int[4096]; - /** - * used as foreach item, if item.tab = current tab, display it on the screen - */ -@@ -460,9 +480,10 @@ - return this.needsRandomTick; +@@ -110,7 +131,8 @@ + + public static Block func_149729_e(int p_149729_0_) + { +- return (Block)field_149771_c.func_148754_a(p_149729_0_); ++ Block ret = (Block)field_149771_c.func_148754_a(p_149729_0_); ++ return ret == null ? Blocks.air : ret; + } + + public static Block func_149634_a(Item p_149634_0_) +@@ -481,9 +503,10 @@ + return this.field_149789_z; } + @Deprecated //Forge: New Metadata sensitive version. - public boolean hasTileEntity() + public boolean func_149716_u() { -- return this.isBlockContainer; +- return this.field_149758_A; + return hasTileEntity(0); } - /** -@@ -485,7 +506,7 @@ - */ - public float getBlockBrightness(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + protected final void func_149676_a(float p_149676_1_, float p_149676_2_, float p_149676_3_, float p_149676_4_, float p_149676_5_, float p_149676_6_) +@@ -500,13 +523,13 @@ + public int func_149677_c(IBlockAccess p_149677_1_, int p_149677_2_, int p_149677_3_, int p_149677_4_) { -- return par1IBlockAccess.getBrightness(par2, par3, par4, lightValue[par1IBlockAccess.getBlockId(par2, par3, par4)]); -+ return par1IBlockAccess.getBrightness(par2, par3, par4, getLightValue(par1IBlockAccess, par2, par3, par4)); - } + Block block = p_149677_1_.func_147439_a(p_149677_2_, p_149677_3_, p_149677_4_); +- int l = p_149677_1_.getLightBrightnessForSkyBlocks(p_149677_2_, p_149677_3_, p_149677_4_, block.func_149750_m()); ++ int l = p_149677_1_.getLightBrightnessForSkyBlocks(p_149677_2_, p_149677_3_, p_149677_4_, block.getLightValue(p_149677_1_, p_149677_2_, p_149677_3_, p_149677_4_)); - @SideOnly(Side.CLIENT) -@@ -495,7 +516,7 @@ - */ - public int getMixedBrightnessForBlock(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) - { -- return par1IBlockAccess.getLightBrightnessForSkyBlocks(par2, par3, par4, lightValue[par1IBlockAccess.getBlockId(par2, par3, par4)]); -+ return par1IBlockAccess.getLightBrightnessForSkyBlocks(par2, par3, par4, getLightValue(par1IBlockAccess, par2, par3, par4)); - } + if (l == 0 && block instanceof BlockSlab) + { + --p_149677_3_; + block = p_149677_1_.func_147439_a(p_149677_2_, p_149677_3_, p_149677_4_); +- return p_149677_1_.getLightBrightnessForSkyBlocks(p_149677_2_, p_149677_3_, p_149677_4_, block.func_149750_m()); ++ return p_149677_1_.getLightBrightnessForSkyBlocks(p_149677_2_, p_149677_3_, p_149677_4_, block.getLightValue(p_149677_1_, p_149677_2_, p_149677_3_, p_149677_4_)); + } + else + { +@@ -595,7 +618,13 @@ - @SideOnly(Side.CLIENT) -@@ -648,7 +669,13 @@ - * different metadata value, but before the new metadata value is set. Args: World, x, y, z, old block ID, old - * metadata - */ -- public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) {} -+ public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) + public void func_149726_b(World p_149726_1_, int p_149726_2_, int p_149726_3_, int p_149726_4_) {} + +- public void func_149749_a(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) {} ++ public void func_149749_a(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) + { -+ if (hasTileEntity(par6) && !(this instanceof BlockContainer)) ++ if (hasTileEntity(p_149749_6_) && !(this instanceof BlockContainer)) + { -+ par1World.removeBlockTileEntity(par2, par3, par4); ++ p_149749_1_.func_147475_p(p_149749_2_, p_149749_3_, p_149749_4_); + } + } - /** - * Returns the quantity of items to drop on block destruction. -@@ -673,7 +700,7 @@ - public float getPlayerRelativeBlockHardness(EntityPlayer par1EntityPlayer, World par2World, int par3, int par4, int par5) + public int func_149745_a(Random p_149745_1_) { - float f = this.getBlockHardness(par2World, par3, par4, par5); -- return f < 0.0F ? 0.0F : (!par1EntityPlayer.canHarvestBlock(this) ? par1EntityPlayer.getCurrentPlayerStrVsBlock(this, false) / f / 100.0F : par1EntityPlayer.getCurrentPlayerStrVsBlock(this, true) / f / 30.0F); -+ return ForgeHooks.blockStrength(this, par1EntityPlayer, par2World, par3, par4, par5); +@@ -609,8 +638,7 @@ + + public float func_149737_a(EntityPlayer p_149737_1_, World p_149737_2_, int p_149737_3_, int p_149737_4_, int p_149737_5_) + { +- float f = this.func_149712_f(p_149737_2_, p_149737_3_, p_149737_4_, p_149737_5_); +- return f < 0.0F ? 0.0F : (!p_149737_1_.func_146099_a(this) ? p_149737_1_.func_146096_a(this, false) / f / 100.0F : p_149737_1_.func_146096_a(this, true) / f / 30.0F); ++ return ForgeHooks.blockStrength(this, p_149737_1_, p_149737_2_, p_149737_3_, p_149737_4_, p_149737_5_); } - /** -@@ -691,18 +718,14 @@ + public final void func_149697_b(World p_149697_1_, int p_149697_2_, int p_149697_3_, int p_149697_4_, int p_149697_5_, int p_149697_6_) +@@ -622,18 +650,14 @@ { - if (!par1World.isRemote) + if (!p_149690_1_.isRemote) { -- int j1 = this.quantityDroppedWithBonus(par7, par1World.rand); -- +- int j1 = this.func_149679_a(p_149690_7_, p_149690_1_.rand); ++ ArrayList items = getDrops(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_7_); ++ p_149690_6_ = ForgeEventFactory.fireBlockHarvesting(items, p_149690_1_, this, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_7_, p_149690_6_, false, harvesters.get()); + - for (int k1 = 0; k1 < j1; ++k1) -+ ArrayList items = getBlockDropped(par1World, par2, par3, par4, par5, par7); -+ par6 = ForgeEventFactory.fireBlockHarvesting(items, par1World, this, par2, par3, par4, par5, par7, par6, false, harvesters.get()); -+ + for (ItemStack item : items) { - if (par1World.rand.nextFloat() <= par6) + if (p_149690_1_.rand.nextFloat() <= p_149690_6_) { -- int l1 = this.idDropped(par5, par1World.rand, par7); +- Item item = this.func_149650_a(p_149690_5_, p_149690_1_.rand, p_149690_7_); - -- if (l1 > 0) +- if (item != null) - { -- this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(l1, 1, this.damageDropped(par5))); +- this.func_149642_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, new ItemStack(item, 1, this.func_149692_a(p_149690_5_))); - } -+ this.dropBlockAsItem_do(par1World, par2, par3, par4, item); ++ this.func_149642_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, item); } } } -@@ -935,7 +958,8 @@ - public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) +@@ -827,7 +851,7 @@ + + public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) { - int l = par1World.getBlockId(par2, par3, par4); -- return l == 0 || blocksList[l].blockMaterial.isReplaceable(); -+ Block block = Block.blocksList[l]; -+ return block == null || block.isBlockReplaceable(par1World, par2, par3, par4); +- return p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_).field_149764_J.isReplaceable(); ++ return p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_).isReplaceable(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_); } - /** -@@ -1086,6 +1110,7 @@ - */ - public void setBlockBoundsForItemRender() {} + public boolean func_149727_a(World p_149727_1_, int p_149727_2_, int p_149727_3_, int p_149727_4_, EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) +@@ -920,25 +944,34 @@ + p_149636_2_.addStat(StatList.mineBlockStatArray[func_149682_b(this)], 1); + p_149636_2_.addExhaustion(0.025F); -+ private ThreadLocal harvesters = new ThreadLocal(); - /** - * Called when the player destroys a block with an item that can harvest it. (i, j, k) are the coordinates of the - * block and l is the block's subtype/damage. -@@ -1095,28 +1120,37 @@ - par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); - par2EntityPlayer.addExhaustion(0.025F); - -- if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(par2EntityPlayer)) -+ if (this.canSilkHarvest(par1World, par2EntityPlayer, par3, par4, par5, par6) && EnchantmentHelper.getSilkTouchModifier(par2EntityPlayer)) +- if (this.func_149700_E() && EnchantmentHelper.getSilkTouchModifier(p_149636_2_)) ++ if (this.canSilkHarvest(p_149636_1_, p_149636_2_, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_) && EnchantmentHelper.getSilkTouchModifier(p_149636_2_)) { + ArrayList items = new ArrayList(); - ItemStack itemstack = this.createStackedBlock(par6); + ItemStack itemstack = this.func_149644_j(p_149636_6_); if (itemstack != null) { -- this.dropBlockAsItem_do(par1World, par3, par4, par5, itemstack); +- this.func_149642_a(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, itemstack); + items.add(itemstack); } -+ ForgeEventFactory.fireBlockHarvesting(items, par1World, this, par3, par4, par5, par6, 0, 1.0f, true, par2EntityPlayer); ++ ++ ForgeEventFactory.fireBlockHarvesting(items, p_149636_1_, this, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_, 0, 1.0f, true, p_149636_2_); + for (ItemStack is : items) + { -+ this.dropBlockAsItem_do(par1World, par3, par4, par5, is); ++ this.func_149642_a(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, is); + } } else { -+ harvesters.set(par2EntityPlayer); - int i1 = EnchantmentHelper.getFortuneModifier(par2EntityPlayer); - this.dropBlockAsItem(par1World, par3, par4, par5, par6, i1); ++ harvesters.set(p_149636_2_); + int i1 = EnchantmentHelper.getFortuneModifier(p_149636_2_); + this.func_149697_b(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_, i1); + harvesters.set(null); } } -+ private int silk_check_meta = -1; //Dirty hack to stop us from needing to special case the silk check hook. - /** - * Return true if a player with Silk Touch can harvest this block directly, and not its normal drops. - */ - protected boolean canSilkHarvest() + protected boolean func_149700_E() { -- return this.renderAsNormalBlock() && !this.isBlockContainer; -+ return this.renderAsNormalBlock() && !this.hasTileEntity(silk_check_meta); +- return this.func_149686_d() && !this.field_149758_A; ++ return this.func_149686_d() && !this.hasTileEntity(silk_check_meta.get()); } - /** -@@ -1457,4 +1491,1001 @@ - canBlockGrass[0] = true; - StatList.initBreakableStats(); + protected ItemStack func_149644_j(int p_149644_1_) +@@ -1114,6 +1147,1062 @@ + return null; } -+ -+ /* =================================================== FORGE START =====================================*/ + ++ /* ======================================== FORGE START =====================================*/ ++ private ThreadLocal harvesters = new ThreadLocal(); ++ private ThreadLocal silk_check_meta = new ThreadLocal(); + /** + * Get a light value for the block at the specified coordinates, normal ranges are between 0 and 15 + * @@ -211,12 +204,12 @@ + */ + public int getLightValue(IBlockAccess world, int x, int y, int z) + { -+ Block block = blocksList[world.getBlockId(x, y, z)]; -+ if (block != null && block != this) ++ Block block = world.func_147439_a(x, y, z); ++ if (block != this) + { + return block.getLightValue(world, x, y, z); + } -+ return lightValue[blockID]; ++ return func_149750_m(); + } + + /** @@ -229,7 +222,7 @@ + * @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(World world, int x, int y, int z, EntityLivingBase entity) ++ public boolean isLadder(IBlockAccess world, int x, int y, int z, EntityLivingBase entity) + { + return false; + } @@ -245,9 +238,9 @@ + * @param z Z position + * @return True if the block is a full cube + */ -+ public boolean isBlockNormalCube(World world, int x, int y, int z) ++ public boolean isNormalCube(IBlockAccess world, int x, int y, int z) + { -+ return blockMaterial.isOpaque() && renderAsNormalBlock() && !canProvidePower(); ++ return func_149688_o().isOpaque() && func_149686_d() && !func_149744_f(); + } + + /** @@ -260,12 +253,13 @@ + * @param side The side to check + * @return True if the block is solid on the specified side. + */ -+ public boolean isBlockSolidOnSide(World world, int x, int y, int z, ForgeDirection side) ++ public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) + { + int meta = world.getBlockMetadata(x, y, z); -+ if (this instanceof BlockHalfSlab) ++ ++ if (this instanceof BlockSlab) + { -+ return (((meta & 8) == 8 && (side == UP)) || isOpaqueCube()); ++ return (((meta & 8) == 8 && (side == UP)) || func_149730_j()); + } + else if (this instanceof BlockFarmland) + { @@ -276,15 +270,19 @@ + boolean flipped = ((meta & 4) != 0); + return ((meta & 3) + side.ordinal() == 5) || (side == UP && flipped); + } ++ else if (this instanceof BlockSnow) ++ { ++ return (meta & 7) == 7; ++ } + else if (this instanceof BlockHopper && side == UP) + { + return true; + } -+ else if (this instanceof BlockPoweredOre) ++ else if (this instanceof BlockCompressedPowered) + { + return true; + } -+ return isBlockNormalCube(world, x, y, z); ++ return isNormalCube(world, x, y, z); + } + + /** @@ -297,9 +295,9 @@ + * @param z Z position + * @return True if the block is replaceable by another block + */ -+ public boolean isBlockReplaceable(World world, int x, int y, int z) ++ public boolean isReplaceable(IBlockAccess world, int x, int y, int z) + { -+ return blockMaterial.isReplaceable(); ++ return field_149764_J.isReplaceable(); + } + + /** @@ -312,7 +310,7 @@ + * @param z Z position + * @return True if the block should deal damage + */ -+ public boolean isBlockBurning(World world, int x, int y, int z) ++ public boolean isBurning(IBlockAccess world, int x, int y, int z) + { + return false; + } @@ -329,9 +327,9 @@ + * @param z Z position + * @return True if the block considered air + */ -+ public boolean isAirBlock(World world, int x, int y, int z) ++ public boolean isAir(IBlockAccess world, int x, int y, int z) + { -+ return false; ++ return func_149688_o() == Material.field_151579_a; + } + + /** @@ -364,21 +362,9 @@ + * @param z Z position + * @return True if the block is actually destroyed. + */ -+ public boolean removeBlockByPlayer(World world, EntityPlayer player, int x, int y, int z) -+ { -+ return world.setBlockToAir(x, y, z); -+ } -+ -+ /** -+ * Called when a new CreativeContainer is opened, populate the list -+ * with all of the items for this block you want a player in creative mode -+ * to have access to. -+ * -+ * @param itemList The list of items to display on the creative inventory. -+ */ -+ @Deprecated -+ public void addCreativeItems(ArrayList itemList) ++ public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) + { ++ return world.func_147468_f(x, y, z); + } + + /** @@ -389,13 +375,12 @@ + * @param x The blocks X position + * @param y The blocks Y position + * @param z The blocks Z position -+ * @param metadata The blocks current metadata + * @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, int x, int y, int z, int metadata, ForgeDirection face) ++ public int getFlammability(IBlockAccess world, int x, int y, int z, ForgeDirection face) + { -+ return blockFlammability[blockID]; ++ return Blocks.fire.getFlammability(this); + } + + /** @@ -406,13 +391,12 @@ + * @param x The blocks X position + * @param y The blocks Y position + * @param z The blocks Z position -+ * @param metadata The blocks current metadata + * @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, int x, int y, int z, int metadata, ForgeDirection face) ++ public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face) + { -+ return getFlammability(world, x, y, z, metadata, face) > 0; ++ return getFlammability(world, x, y, z, face) > 0; + } + + /** @@ -423,13 +407,12 @@ + * @param x The blocks X position + * @param y The blocks Y position + * @param z The blocks Z position -+ * @param metadata The blocks current metadata + * @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(World world, int x, int y, int z, int metadata, ForgeDirection face) ++ public int getFireSpreadSpeed(IBlockAccess world, int x, int y, int z, ForgeDirection face) + { -+ return blockFireSpreadSpeed[blockID]; ++ return Blocks.fire.getEncouragement(this); + } + + /** @@ -445,35 +428,23 @@ + * @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, int x, int y, int z, int metadata, ForgeDirection side) ++ public boolean isFireSource(World world, int x, int y, int z, ForgeDirection side) + { -+ if (blockID == Block.netherrack.blockID && side == UP) ++ if (this == Blocks.netherrack && side == UP) + { + return true; + } -+ if ((world.provider instanceof WorldProviderEnd) && blockID == Block.bedrock.blockID && side == UP) ++ if ((world.provider instanceof WorldProviderEnd) && this == Blocks.bedrock && side == UP) + { + return true; + } + return false; + } + -+ /** -+ * Called by BlockFire to setup the burn values of vanilla blocks. -+ * @param id The block id -+ * @param encouragement How much the block encourages fire to spread -+ * @param flammability how easy a block is to catch fire -+ */ -+ public static void setBurnProperties(int id, int encouragement, int flammability) -+ { -+ blockFireSpreadSpeed[id] = encouragement; -+ blockFlammability[id] = flammability; -+ } -+ + 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 vinella ++ * 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. @@ -498,7 +469,7 @@ + { + if (isTileProvider) + { -+ return ((ITileEntityProvider)this).createNewTileEntity(world); ++ return ((ITileEntityProvider)this).func_149915_a(world, metadata); + } + return null; + } @@ -514,7 +485,7 @@ + */ + public int quantityDropped(int meta, int fortune, Random random) + { -+ return quantityDroppedWithBonus(fortune, random); ++ return func_149679_a(fortune, random); + } + + /** @@ -528,17 +499,17 @@ + * @param fortune Breakers fortune level + * @return A ArrayList containing all items this block drops + */ -+ public ArrayList getBlockDropped(World world, int x, int y, int z, int metadata, int fortune) ++ public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) + { + ArrayList ret = new ArrayList(); + + int count = quantityDropped(metadata, fortune, world.rand); + for(int i = 0; i < count; i++) + { -+ int id = idDropped(metadata, world.rand, fortune); -+ if (id > 0) ++ Item item = func_149650_a(metadata, world.rand, fortune); ++ if (item != null) + { -+ ret.add(new ItemStack(id, 1, damageDropped(metadata))); ++ ret.add(new ItemStack(item, 1, func_149692_a(metadata))); + } + } + return ret; @@ -557,9 +528,9 @@ + */ + public boolean canSilkHarvest(World world, EntityPlayer player, int x, int y, int z, int metadata) + { -+ silk_check_meta = metadata; -+ boolean ret = this.canSilkHarvest(); -+ silk_check_meta = 0; ++ silk_check_meta.set(metadata);; ++ boolean ret = this.func_149700_E(); ++ silk_check_meta.set(null); + return ret; + } + @@ -574,18 +545,18 @@ + * @param z The Z Position + * @return True to allow a mob of the specified category to spawn, false to prevent it. + */ -+ public boolean canCreatureSpawn(EnumCreatureType type, World world, int x, int y, int z) ++ public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) + { + int meta = world.getBlockMetadata(x, y, z); -+ if (this instanceof BlockStep) ++ if (this instanceof BlockSlab) + { -+ return (((meta & 8) == 8) || isOpaqueCube()); ++ return (((meta & 8) == 8) || func_149730_j()); + } + else if (this instanceof BlockStairs) + { + return ((meta & 4) != 0); + } -+ return isBlockSolidOnSide(world, x, y, z, UP); ++ return isSideSolid(world, x, y, z, UP); + } + + /** @@ -600,9 +571,9 @@ + * @param player The player or camera entity, null in some cases. + * @return True to treat this as a bed + */ -+ public boolean isBed(World world, int x, int y, int z, EntityLivingBase player) ++ public boolean isBed(IBlockAccess world, int x, int y, int z, EntityLivingBase player) + { -+ return blockID == Block.bed.blockID; ++ return this == Blocks.bed; + } + + /** @@ -616,9 +587,11 @@ + * @param player The player or camera entity, null in some cases. + * @return The spawn position + */ -+ public ChunkCoordinates getBedSpawnPosition(World world, int x, int y, int z, EntityPlayer player) ++ public ChunkCoordinates getBedSpawnPosition(IBlockAccess world, int x, int y, int z, EntityPlayer player) + { -+ return BlockBed.getNearestEmptyChunkCoordinates(world, x, y, z, 0); ++ if (world instanceof World) ++ return BlockBed.func_149977_a((World)world, x, y, z, 0); ++ return null; + } + + /** @@ -631,9 +604,10 @@ + * @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(World world, int x, int y, int z, EntityPlayer player, boolean occupied) ++ public void setBedOccupied(IBlockAccess world, int x, int y, int z, EntityPlayer player, boolean occupied) + { -+ BlockBed.setBedOccupied(world, x, y, z, occupied); ++ if (world instanceof World) ++ BlockBed.func_149979_a((World)world, x, y, z, occupied); + } + + /** @@ -648,7 +622,7 @@ + */ + public int getBedDirection(IBlockAccess world, int x, int y, int z) + { -+ return BlockBed.getDirection(world.getBlockMetadata(x, y, z)); ++ return BlockBed.func_149895_l(world.getBlockMetadata(x, y, z)); + } + + /** @@ -662,7 +636,7 @@ + */ + public boolean isBedFoot(IBlockAccess world, int x, int y, int z) + { -+ return BlockBed.isBlockHeadOfBed(world.getBlockMetadata(x, y, z)); ++ return BlockBed.func_149975_b(world.getBlockMetadata(x, y, z)); + } + + /** @@ -684,7 +658,7 @@ + * @param z Z Position + * @return true if the presence this block can prevent leaves from decaying. + */ -+ public boolean canSustainLeaves(World world, int x, int y, int z) ++ public boolean canSustainLeaves(IBlockAccess world, int x, int y, int z) + { + return false; + } @@ -698,9 +672,9 @@ + * @param z Z Position + * @return true if this block is considered leaves. + */ -+ public boolean isLeaves(World world, int x, int y, int z) ++ public boolean isLeaves(IBlockAccess world, int x, int y, int z) + { -+ return false; ++ return func_149688_o() == Material.field_151584_j; + } + + /** @@ -712,9 +686,9 @@ + * @param z Z Position + * @return true if this block can be replaced by growing leaves. + */ -+ public boolean canBeReplacedByLeaves(World world, int x, int y, int z) ++ public boolean canBeReplacedByLeaves(IBlockAccess world, int x, int y, int z) + { -+ return !Block.opaqueCubeLookup[this.blockID]; ++ return func_149730_j(); + } + + /** @@ -725,7 +699,7 @@ + * @param z Z Position + * @return true if the block is wood (logs) + */ -+ public boolean isWood(World world, int x, int y, int z) ++ public boolean isWood(IBlockAccess world, int x, int y, int z) + { + return false; + } @@ -741,9 +715,9 @@ + * for overworld generation, and neatherack for the nether. + * @return True to allow this block to be replaced by a ore + */ -+ public boolean isGenMineableReplaceable(World world, int x, int y, int z, int target) ++ public boolean isReplaceableOreGen(World world, int x, int y, int z, Block target) + { -+ return blockID == target; ++ return this == target; + } + + /** @@ -761,7 +735,7 @@ + */ + public float getExplosionResistance(Entity par1Entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ) + { -+ return getExplosionResistance(par1Entity); ++ return func_149638_a(par1Entity); + } + + /** @@ -777,8 +751,8 @@ + */ + public void onBlockExploded(World world, int x, int y, int z, Explosion explosion) + { -+ world.setBlockToAir(x, y, z); -+ onBlockDestroyedByExplosion(world, x, y, z, explosion); ++ world.func_147468_f(x, y, z); ++ func_149723_a(world, x, y, z, explosion); + } + + /** @@ -801,7 +775,7 @@ + */ + public boolean canConnectRedstone(IBlockAccess world, int x, int y, int z, int side) + { -+ return Block.blocksList[blockID].canProvidePower() && side != -1; ++ return func_149744_f() && side != -1; + } + + /** @@ -816,18 +790,16 @@ + */ + public boolean canPlaceTorchOnTop(World world, int x, int y, int z) + { -+ if (world.doesBlockHaveSolidTopSurface(x, y, z)) ++ if (isSideSolid(world, x, y, z, UP)) + { + return true; + } + else + { -+ int id = world.getBlockId(x, y, z); -+ return id == Block.fence.blockID || id == Block.netherFence.blockID || id == Block.glass.blockID || id == Block.cobblestoneWall.blockID; ++ return this == Blocks.fence || this == Blocks.nether_brick_fence || this == Blocks.glass || this == Blocks.cobblestone_wall; + } + } + -+ + /** + * Determines if this block should render in this pass. + * @@ -836,7 +808,7 @@ + */ + public boolean canRenderInPass(int pass) + { -+ return pass == getRenderBlockPass(); ++ return pass == func_149701_w(); + } + + /** @@ -847,20 +819,15 @@ + */ + public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) + { -+ int id = idPicked(world, x, y, z); ++ Item item = func_149694_d(world, x, y, z); + -+ if (id == 0) -+ { -+ return null; -+ } -+ -+ Item item = Item.itemsList[id]; + if (item == null) + { + return null; + } + -+ return new ItemStack(id, 1, getDamageValue(world, x, y, z)); ++ Block block = item instanceof ItemBlock && !func_149648_K() ? Block.func_149634_a(item) : this; ++ return new ItemStack(item, 1, block.func_149643_k(world, x, y, z)); + } + + /** @@ -869,7 +836,7 @@ + * + * @return False to disallow spawning + */ -+ public boolean isBlockFoliage(World world, int x, int y, int z) ++ public boolean isFoliage(IBlockAccess world, int x, int y, int z) + { + return false; + } @@ -886,7 +853,7 @@ + * @return True to prevent vanilla digging particles form spawning. + */ + @SideOnly(Side.CLIENT) -+ public boolean addBlockHitEffects(World worldObj, MovingObjectPosition target, EffectRenderer effectRenderer) ++ public boolean addHitEffects(World worldObj, MovingObjectPosition target, EffectRenderer effectRenderer) + { + return false; + } @@ -906,7 +873,7 @@ + * @return True to prevent vanilla break particles from spawning. + */ + @SideOnly(Side.CLIENT) -+ public boolean addBlockDestroyEffects(World world, int x, int y, int z, int meta, EffectRenderer effectRenderer) ++ public boolean addDestroyEffects(World world, int x, int y, int z, int meta, EffectRenderer effectRenderer) + { + return false; + } @@ -927,43 +894,43 @@ + * @param y Y Position + * @param z Z position + * @param direction The direction relative to the given position the plant wants to be, typically its UP -+ * @param plant The plant that wants to check ++ * @param plantable The plant that wants to check + * @return True to allow the plant to be planted/stay. + */ -+ public boolean canSustainPlant(World world, int x, int y, int z, ForgeDirection direction, IPlantable plant) ++ public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable) + { -+ int plantID = plant.getPlantID(world, x, y + 1, z); -+ EnumPlantType plantType = plant.getPlantType(world, x, y + 1, z); ++ Block plant = plantable.getPlant(world, x, y + 1, z); ++ EnumPlantType plantType = plantable.getPlantType(world, x, y + 1, z); + -+ if (plantID == cactus.blockID && blockID == cactus.blockID) ++ if (plant == Blocks.cactus && this == Blocks.cactus) + { + return true; + } + -+ if (plantID == reed.blockID && blockID == reed.blockID) ++ if (plant == Blocks.reeds && this == Blocks.reeds) + { + return true; + } + -+ if (plant instanceof BlockFlower && ((BlockFlower)plant).canThisPlantGrowOnThisBlockID(blockID)) ++ if (plantable instanceof BlockBush && ((BlockBush)plantable).func_149854_a(this)) + { + return true; + } + + switch (plantType) + { -+ case Desert: return blockID == sand.blockID; -+ case Nether: return blockID == slowSand.blockID; -+ case Crop: return blockID == tilledField.blockID; -+ case Cave: return isBlockSolidOnSide(world, x, y, z, UP); -+ case Plains: return blockID == grass.blockID || blockID == dirt.blockID; -+ case Water: return world.getBlockMaterial(x, y, z) == Material.water && world.getBlockMetadata(x, y, z) == 0; ++ case Desert: return this == Blocks.sand; ++ case Nether: return this == Blocks.soul_sand; ++ case Crop: return this == Blocks.farmland; ++ case Cave: return isSideSolid(world, x, y, z, UP); ++ case Plains: return this == Blocks.grass || this == Blocks.dirt; ++ case Water: return world.func_147439_a(x, y, z).func_149688_o() == Material.field_151586_h && world.getBlockMetadata(x, y, z) == 0; + case Beach: -+ boolean isBeach = (blockID == Block.grass.blockID || blockID == Block.dirt.blockID || blockID == Block.sand.blockID); -+ boolean hasWater = (world.getBlockMaterial(x - 1, y, z ) == Material.water || -+ world.getBlockMaterial(x + 1, y, z ) == Material.water || -+ world.getBlockMaterial(x, y, z - 1) == Material.water || -+ world.getBlockMaterial(x, y, z + 1) == Material.water); ++ boolean isBeach = this == Blocks.grass || this == Blocks.dirt || this == Blocks.sand; ++ boolean hasWater = (world.func_147439_a(x - 1, y, z ).func_149688_o() == Material.field_151586_h || ++ world.func_147439_a(x + 1, y, z ).func_149688_o() == Material.field_151586_h || ++ world.func_147439_a(x, y, z - 1).func_149688_o() == Material.field_151586_h || ++ world.func_147439_a(x, y, z + 1).func_149688_o() == Material.field_151586_h); + return isBeach && hasWater; + } + @@ -989,9 +956,9 @@ + */ + public void onPlantGrow(World world, int x, int y, int z, int sourceX, int sourceY, int sourceZ) + { -+ if (blockID == grass.blockID) ++ if (this == Blocks.grass || this == Blocks.farmland) + { -+ world.setBlock(x, y, z, dirt.blockID, 0, 2); ++ world.func_147465_d(x, y, z, Blocks.dirt, 0, 2); + } + } + @@ -1008,7 +975,7 @@ + */ + public boolean isFertile(World world, int x, int y, int z) + { -+ if (blockID == tilledField.blockID) ++ if (this == Blocks.farmland) + { + return world.getBlockMetadata(x, y, z) > 0; + } @@ -1030,9 +997,9 @@ + * @param z Z position + * @return The amount of light to block, 0 for air, 255 for fully opaque. + */ -+ public int getLightOpacity(World world, int x, int y, int z) ++ public int getLightOpacity(IBlockAccess world, int x, int y, int z) + { -+ return lightOpacity[blockID]; ++ return func_149717_k(); + } + + /** @@ -1044,24 +1011,19 @@ + * @param z Z position + * @return True to allow the ender dragon to destroy this block + */ -+ public boolean canEntityDestroy(World world, int x, int y, int z, Entity entity) ++ public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity) + { + if (entity instanceof EntityWither) + { -+ return blockID != Block.bedrock.blockID && blockID != Block.endPortal.blockID && blockID != Block.endPortalFrame.blockID; ++ return this != Blocks.bedrock && this != Blocks.end_portal && this != Blocks.end_portal_frame && this != Blocks.command_block; + } + else if (entity instanceof EntityDragon) + { -+ return canDragonDestroy(world, x, y, z); ++ return this != Blocks.obsidian && this != Blocks.end_stone && this != Blocks.bedrock; + } + + return true; + } -+ @Deprecated -+ public boolean canDragonDestroy(World world, int x, int y, int z) -+ { -+ return blockID != obsidian.blockID && blockID != whiteStone.blockID && blockID != bedrock.blockID; -+ } + + /** + * Determines if this block can be used as the base of a beacon. @@ -1075,9 +1037,9 @@ + * @param beaconZ Beacons Z Position + * @return True, to support the beacon, and make it active with this block. + */ -+ public boolean isBeaconBase(World worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) ++ public boolean isBeaconBase(IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) + { -+ return (blockID == blockEmerald.blockID || blockID == blockGold.blockID || blockID == blockDiamond.blockID || blockID == blockIron.blockID); ++ return this == Blocks.emerald_block || this == Blocks.gold_block || this == Blocks.diamond_block || this == Blocks.iron_block; + } + + /** @@ -1122,8 +1084,9 @@ + */ + public float getEnchantPowerBonus(World world, int x, int y, int z) + { -+ return blockID == bookShelf.blockID ? 1 : 0; ++ return this == Blocks.bookshelf ? 1 : 0; + } ++ + /** + * Common way to recolour a block with an external tool + * @param world The world @@ -1136,7 +1099,7 @@ + */ + public boolean recolourBlock(World world, int x, int y, int z, ForgeDirection side, int colour) + { -+ if (blockID == cloth.blockID) ++ if (this == Blocks.wool) + { + int meta = world.getBlockMetadata(x, y, z); + if (meta != colour) @@ -1149,13 +1112,18 @@ + } + + /** -+ * @return the amount of XP that this block should drop when it is broken ++ * Gathers how much experience this block drops when broken. ++ * ++ * @param world The world ++ * @param metadata ++ * @param fortune ++ * @return Amount of XP from breaking this block. + */ -+ public int getExpDrop(World world, int data, int enchantmentLevel) ++ public int getExpDrop(IBlockAccess world, int metadata, 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 @@ -1166,17 +1134,9 @@ + * @param tileY The y position of the tile that changed + * @param tileZ The z position of the tile that changed + */ -+ public void onNeighborTileChange(World world, int x, int y, int z, int tileX, int tileY, int tileZ) ++ public void onNeighborChange(IBlockAccess world, int x, int y, int z, int tileX, int tileY, int tileZ) + { + } -+ -+ /** -+ * @return true if this block is to be notified of TileEntity changes directly through one solid block like comparators -+ */ -+ public boolean weakTileChanges() -+ { -+ return false; -+ } + + /** + * Called to determine whether to allow the a block to handle its own indirect power rather than using the default rules. @@ -1187,12 +1147,105 @@ + * @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(World world, int x, int y, int z, int side) ++ public boolean shouldCheckWeakPower(IBlockAccess world, int x, int y, int z, int side) + { -+ return !this.isNormalCube(world.getBlockId(x, y, z)); ++ return func_149721_r(); + } + -+ @Deprecated //Implemented here as we changed the IFluidBlock interface, and this allows us to do so without breaking exisitng mods. -+ // To be removed next MC version {1.6.3+} -+ public float getFilledPercentage(World world, int x, int y, int z){ return 1; } - } ++ /** ++ * 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 x X Position ++ * @param y Y position ++ * @param z Z position ++ * @param side The side to check ++ * @return true To be notified of changes ++ */ ++ public boolean getWeakChanges(IBlockAccess world, int x, int y, int z) ++ { ++ 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 ++ * Iton: 2 ++ * Diamond: 3 ++ * Gold: 0 ++ */ ++ public void setHarvestLevel(String toolClass, int level) ++ { ++ for (int m = 0; m < 16; m++) ++ { ++ setHarvestLevel(toolClass, level, m); ++ } ++ } ++ /** ++ * Sets or removes the tool and level required to harvest this block. ++ * ++ * @param toolClass Class ++ * @param level Harvest level: ++ * Wood: 0 ++ * Stone: 1 ++ * Iton: 2 ++ * Diamond: 3 ++ * Gold: 0 ++ * @param metadata The specific metadata to set ++ */ ++ public void setHarvestLevel(String toolClass, int level, int metadata) ++ { ++ this.harvestTool[metadata] = toolClass; ++ this.harvestLevel[metadata] = level; ++ } ++ ++ /** ++ * Queries the class of tool required to harvest this block, if null is returned ++ * we assume that anything can harvest this block. ++ * ++ * @param metadata ++ * @return ++ */ ++ public String getHarvestTool(int metadata) ++ { ++ return harvestTool[metadata]; ++ } ++ ++ /** ++ * 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 ++ * @return Harvest level, or -1 if not the specified tool type. ++ */ ++ public int getHarvestLevel(int metadata) ++ { ++ return harvestLevel[metadata]; ++ } ++ ++ /** ++ * Checks if the specified tool type is efficient on this block, ++ * meaning that it digs at full speed. ++ * ++ * @param type ++ * @param metadata ++ * @return ++ */ ++ public boolean isToolEffective(String type, int metadata) ++ { ++ if (harvestTool[metadata] == null) return true; ++ return harvestTool[metadata].equals(type); ++ } ++ /* ========================================= FORGE END ======================================*/ ++ + public static class SoundType + { + public final String field_150501_a; diff --git a/patches/minecraft/net/minecraft/block/BlockBaseRailLogic.java.patch b/patches/minecraft/net/minecraft/block/BlockBaseRailLogic.java.patch deleted file mode 100644 index a91ce10cf..000000000 --- a/patches/minecraft/net/minecraft/block/BlockBaseRailLogic.java.patch +++ /dev/null @@ -1,69 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockBaseRailLogic.java -+++ ../src-work/minecraft/net/minecraft/block/BlockBaseRailLogic.java -@@ -16,6 +16,8 @@ - /** The chunk position the rail is at. */ - private List railChunkPosition; - -+ private final boolean canMakeSlopes; -+ - final BlockRailBase theRail; - - public BlockBaseRailLogic(BlockRailBase par1BlockRailBase, World par2World, int par3, int par4, int par5) -@@ -27,17 +29,11 @@ - this.railY = par4; - this.railZ = par5; - int l = par2World.getBlockId(par3, par4, par5); -- int i1 = par2World.getBlockMetadata(par3, par4, par5); - -- if (((BlockRailBase)Block.blocksList[l]).isPowered) -- { -- this.isStraightRail = true; -- i1 &= -9; -- } -- else -- { -- this.isStraightRail = false; -- } -+ BlockRailBase target = (BlockRailBase)Block.blocksList[l]; -+ int i1 = target.getBasicRailMetadata(par2World, null, par3, par4, par5); -+ isStraightRail = !target.isFlexibleRail(par2World, par3, par4, par5); -+ canMakeSlopes = target.canMakeSlopes(par2World, par3, par4, par5); - - this.setBasicRail(i1); - } -@@ -232,7 +228,7 @@ - } - } - -- if (b0 == 0) -+ if (b0 == 0 && canMakeSlopes) - { - if (BlockRailBase.isRailBlockAt(this.logicWorld, this.railX, this.railY + 1, this.railZ - 1)) - { -@@ -245,7 +241,7 @@ - } - } - -- if (b0 == 1) -+ if (b0 == 1 && canMakeSlopes) - { - if (BlockRailBase.isRailBlockAt(this.logicWorld, this.railX + 1, this.railY + 1, this.railZ)) - { -@@ -390,7 +386,7 @@ - } - } - -- if (b0 == 0) -+ if (b0 == 0 && canMakeSlopes) - { - if (BlockRailBase.isRailBlockAt(this.logicWorld, this.railX, this.railY + 1, this.railZ - 1)) - { -@@ -403,7 +399,7 @@ - } - } - -- if (b0 == 1) -+ if (b0 == 1 && canMakeSlopes) - { - if (BlockRailBase.isRailBlockAt(this.logicWorld, this.railX + 1, this.railY + 1, this.railZ)) - { 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 000000000..44c76036b --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockBush.java.patch @@ -0,0 +1,73 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockBush.java ++++ ../src-work/minecraft/net/minecraft/block/BlockBush.java +@@ -6,8 +6,13 @@ + import net.minecraft.init.Blocks; + import net.minecraft.util.AxisAlignedBB; + import net.minecraft.world.World; ++import net.minecraft.world.IBlockAccess; ++import net.minecraftforge.common.EnumPlantType; ++import net.minecraftforge.common.util.ForgeDirection; ++import net.minecraftforge.common.IPlantable; ++import static net.minecraftforge.common.EnumPlantType.*; + +-public class BlockBush extends Block ++public class BlockBush extends Block implements IPlantable + { + private static final String __OBFID = "CL_00000208"; + +@@ -27,7 +32,7 @@ + + public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) + { +- return super.func_149742_c(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_) && this.func_149854_a(p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_ - 1, p_149742_4_)); ++ return super.func_149742_c(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_) && this.func_149718_j(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_); + } + + protected boolean func_149854_a(Block p_149854_1_) +@@ -57,7 +62,7 @@ + + public boolean func_149718_j(World p_149718_1_, int p_149718_2_, int p_149718_3_, int p_149718_4_) + { +- return this.func_149854_a(p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_ - 1, p_149718_4_)); ++ return p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_ - 1, p_149718_4_).canSustainPlant(p_149718_1_, p_149718_2_, p_149718_3_ - 1, p_149718_4_, ForgeDirection.UP, this); + } + + public AxisAlignedBB func_149668_a(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) +@@ -79,4 +84,37 @@ + { + return 1; + } ++ ++ @Override ++ public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z) ++ { ++ if (this == Blocks.wheat) return Crop; ++ if (this == Blocks.carrots) return Crop; ++ if (this == Blocks.potatoes) return Crop; ++ if (this == Blocks.melon_stem) return Crop; ++ if (this == Blocks.pumpkin_stem) return Crop; ++ if (this == Blocks.deadbush) return Desert; ++ if (this == Blocks.waterlily) return Water; ++ if (this == Blocks.red_mushroom) return Cave; ++ if (this == Blocks.brown_mushroom) return Cave; ++ if (this == Blocks.nether_wart) return Nether; ++ if (this == Blocks.sapling) return Plains; ++ if (this == Blocks.tallgrass) return Plains; ++ if (this == Blocks.double_plant) return Plains; ++ if (this == Blocks.red_flower) return Plains; ++ if (this == Blocks.yellow_flower) return Plains; ++ return Plains; ++ } ++ ++ @Override ++ public Block getPlant(IBlockAccess world, int x, int y, int z) ++ { ++ return this; ++ } ++ ++ @Override ++ public int getPlantMetadata(IBlockAccess world, int x, int y, int z) ++ { ++ return world.getBlockMetadata(x, y, z); ++ } + } diff --git a/patches/minecraft/net/minecraft/block/BlockButton.java.patch b/patches/minecraft/net/minecraft/block/BlockButton.java.patch index 6ddf25f9b..0d0518b52 100644 --- a/patches/minecraft/net/minecraft/block/BlockButton.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockButton.java.patch @@ -4,101 +4,97 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -+import net.minecraftforge.common.ForgeDirection; -+import static net.minecraftforge.common.ForgeDirection.*; ++import net.minecraftforge.common.util.ForgeDirection; ++import static net.minecraftforge.common.util.ForgeDirection.*; + public abstract class BlockButton extends Block { - /** Whether this button is sensible to arrows, used by wooden buttons. */ -@@ -66,7 +69,11 @@ - */ - public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5) + private final boolean field_150047_a; +@@ -49,12 +52,19 @@ + + public boolean func_149707_d(World p_149707_1_, int p_149707_2_, int p_149707_3_, int p_149707_4_, int p_149707_5_) { -- return par5 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1) ? true : (par5 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : (par5 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : par5 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4))); -+ ForgeDirection dir = ForgeDirection.getOrientation(par5); -+ return (dir == NORTH && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH)) || -+ (dir == SOUTH && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH)) || -+ (dir == WEST && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST)) || -+ (dir == EAST && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST)); +- return p_149707_5_ == 2 && p_149707_1_.func_147439_a(p_149707_2_, p_149707_3_, p_149707_4_ + 1).func_149721_r() ? true : (p_149707_5_ == 3 && p_149707_1_.func_147439_a(p_149707_2_, p_149707_3_, p_149707_4_ - 1).func_149721_r() ? true : (p_149707_5_ == 4 && p_149707_1_.func_147439_a(p_149707_2_ + 1, p_149707_3_, p_149707_4_).func_149721_r() ? true : p_149707_5_ == 5 && p_149707_1_.func_147439_a(p_149707_2_ - 1, p_149707_3_, p_149707_4_).func_149721_r())); ++ ForgeDirection dir = ForgeDirection.getOrientation(p_149707_5_); ++ return (dir == NORTH && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_, p_149707_4_ + 1, NORTH)) || ++ (dir == SOUTH && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_, p_149707_4_ - 1, SOUTH)) || ++ (dir == WEST && p_149707_1_.isSideSolid(p_149707_2_ + 1, p_149707_3_, p_149707_4_, WEST)) || ++ (dir == EAST && p_149707_1_.isSideSolid(p_149707_2_ - 1, p_149707_3_, p_149707_4_, EAST)); } - /** -@@ -74,7 +81,10 @@ - */ - public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) { -- return par1World.isBlockNormalCube(par2 - 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : par1World.isBlockNormalCube(par2, par3, par4 + 1))); -+ return (par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST)) || -+ (par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST)) || -+ (par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH)) || -+ (par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH)); +- return p_149742_1_.func_147439_a(p_149742_2_ - 1, p_149742_3_, p_149742_4_).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_ + 1, p_149742_3_, p_149742_4_).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_ - 1).func_149721_r() ? true : p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_ + 1).func_149721_r())); ++ return (p_149742_1_.isSideSolid(p_149742_2_ - 1, p_149742_3_, p_149742_4_, EAST)) || ++ (p_149742_1_.isSideSolid(p_149742_2_ + 1, p_149742_3_, p_149742_4_, WEST)) || ++ (p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ - 1, SOUTH)) || ++ (p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ + 1, NORTH)); } - /** -@@ -86,19 +96,22 @@ + public int func_149660_a(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_) +@@ -63,19 +73,21 @@ int k1 = j1 & 8; j1 &= 7; -- if (par5 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1)) +- if (p_149660_5_ == 2 && p_149660_1_.func_147439_a(p_149660_2_, p_149660_3_, p_149660_4_ + 1).func_149721_r()) ++ ForgeDirection dir = ForgeDirection.getOrientation(p_149660_5_); + -+ ForgeDirection dir = ForgeDirection.getOrientation(par5); -+ -+ if (dir == NORTH && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH)) ++ if (dir == NORTH && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ + 1, NORTH)) { j1 = 4; } -- else if (par5 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1)) -+ else if (dir == SOUTH && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH)) +- else if (p_149660_5_ == 3 && p_149660_1_.func_147439_a(p_149660_2_, p_149660_3_, p_149660_4_ - 1).func_149721_r()) ++ else if (dir == SOUTH && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ - 1, SOUTH)) { j1 = 3; } -- else if (par5 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4)) -+ else if (dir == WEST && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST)) +- else if (p_149660_5_ == 4 && p_149660_1_.func_147439_a(p_149660_2_ + 1, p_149660_3_, p_149660_4_).func_149721_r()) ++ else if (dir == WEST && p_149660_1_.isSideSolid(p_149660_2_ + 1, p_149660_3_, p_149660_4_, WEST)) { j1 = 2; } -- else if (par5 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4)) -+ else if (dir == EAST && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST)) +- else if (p_149660_5_ == 5 && p_149660_1_.func_147439_a(p_149660_2_ - 1, p_149660_3_, p_149660_4_).func_149721_r()) ++ else if (dir == EAST && p_149660_1_.isSideSolid(p_149660_2_ - 1, p_149660_3_, p_149660_4_, EAST)) { j1 = 1; } -@@ -115,7 +128,11 @@ - */ - private int getOrientation(World par1World, int par2, int par3, int par4) +@@ -89,7 +101,11 @@ + + private int func_150045_e(World p_150045_1_, int p_150045_2_, int p_150045_3_, int p_150045_4_) { -- return par1World.isBlockNormalCube(par2 - 1, par3, par4) ? 1 : (par1World.isBlockNormalCube(par2 + 1, par3, par4) ? 2 : (par1World.isBlockNormalCube(par2, par3, par4 - 1) ? 3 : (par1World.isBlockNormalCube(par2, par3, par4 + 1) ? 4 : 1))); -+ if (par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST)) return 1; -+ if (par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST)) return 2; -+ if (par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH)) return 3; -+ if (par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH)) return 4; +- return p_150045_1_.func_147439_a(p_150045_2_ - 1, p_150045_3_, p_150045_4_).func_149721_r() ? 1 : (p_150045_1_.func_147439_a(p_150045_2_ + 1, p_150045_3_, p_150045_4_).func_149721_r() ? 2 : (p_150045_1_.func_147439_a(p_150045_2_, p_150045_3_, p_150045_4_ - 1).func_149721_r() ? 3 : (p_150045_1_.func_147439_a(p_150045_2_, p_150045_3_, p_150045_4_ + 1).func_149721_r() ? 4 : 1))); ++ if (p_150045_1_.isSideSolid(p_150045_2_ - 1, p_150045_3_, p_150045_4_, EAST)) return 1; ++ if (p_150045_1_.isSideSolid(p_150045_2_ + 1, p_150045_3_, p_150045_4_, WEST)) return 2; ++ if (p_150045_1_.isSideSolid(p_150045_2_, p_150045_3_, p_150045_4_ - 1, SOUTH)) return 3; ++ if (p_150045_1_.isSideSolid(p_150045_2_, p_150045_3_, p_150045_4_ + 1, NORTH)) return 4; + return 1; } - /** -@@ -129,22 +146,22 @@ - int i1 = par1World.getBlockMetadata(par2, par3, par4) & 7; + public void func_149695_a(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_) +@@ -99,22 +115,22 @@ + int l = p_149695_1_.getBlockMetadata(p_149695_2_, p_149695_3_, p_149695_4_) & 7; boolean flag = false; -- if (!par1World.isBlockNormalCube(par2 - 1, par3, par4) && i1 == 1) -+ if (!par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST) && i1 == 1) +- if (!p_149695_1_.func_147439_a(p_149695_2_ - 1, p_149695_3_, p_149695_4_).func_149721_r() && l == 1) ++ if (!p_149695_1_.isSideSolid(p_149695_2_ - 1, p_149695_3_, p_149695_4_, EAST) && l == 1) { flag = true; } -- if (!par1World.isBlockNormalCube(par2 + 1, par3, par4) && i1 == 2) -+ if (!par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST) && i1 == 2) +- if (!p_149695_1_.func_147439_a(p_149695_2_ + 1, p_149695_3_, p_149695_4_).func_149721_r() && l == 2) ++ if (!p_149695_1_.isSideSolid(p_149695_2_ + 1, p_149695_3_, p_149695_4_, WEST) && l == 2) { flag = true; } -- if (!par1World.isBlockNormalCube(par2, par3, par4 - 1) && i1 == 3) -+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH) && i1 == 3) +- if (!p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_, p_149695_4_ - 1).func_149721_r() && l == 3) ++ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_, p_149695_4_ - 1, SOUTH) && l == 3) { flag = true; } -- if (!par1World.isBlockNormalCube(par2, par3, par4 + 1) && i1 == 4) -+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH) && i1 == 4) +- if (!p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_, p_149695_4_ + 1).func_149721_r() && l == 4) ++ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_, p_149695_4_ + 1, NORTH) && l == 4) { flag = true; } diff --git a/patches/minecraft/net/minecraft/block/BlockCactus.java.patch b/patches/minecraft/net/minecraft/block/BlockCactus.java.patch index 12800190c..f18d66ae8 100644 --- a/patches/minecraft/net/minecraft/block/BlockCactus.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockCactus.java.patch @@ -1,46 +1,48 @@ --- ../src-base/minecraft/net/minecraft/block/BlockCactus.java +++ ../src-work/minecraft/net/minecraft/block/BlockCactus.java -@@ -12,7 +12,11 @@ - import net.minecraft.util.Icon; +@@ -11,9 +11,13 @@ + import net.minecraft.util.AxisAlignedBB; + import net.minecraft.util.DamageSource; + import net.minecraft.util.IIcon; ++import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; ++import net.minecraftforge.common.EnumPlantType; ++import net.minecraftforge.common.util.ForgeDirection; ++import net.minecraftforge.common.IPlantable; -public class BlockCactus extends Block -+import net.minecraftforge.common.EnumPlantType; -+import net.minecraftforge.common.ForgeDirection; -+import net.minecraftforge.common.IPlantable; -+ +public class BlockCactus extends Block implements IPlantable { @SideOnly(Side.CLIENT) - private Icon cactusTopIcon; -@@ -158,7 +162,7 @@ + private IIcon field_150041_a; +@@ -125,7 +129,7 @@ else { - int l = par1World.getBlockId(par2, par3 - 1, par4); -- return l == Block.cactus.blockID || l == Block.sand.blockID; -+ return blocksList[l] != null && blocksList[l].canSustainPlant(par1World, par2, par3 - 1, par4, ForgeDirection.UP, this); + Block block = p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_ - 1, p_149718_4_); +- return block == Blocks.cactus || block == Blocks.sand; ++ return block.canSustainPlant(p_149718_1_, p_149718_2_, p_149718_3_ - 1, p_149718_4_, ForgeDirection.UP, this); } } -@@ -182,4 +186,22 @@ - this.cactusTopIcon = par1IconRegister.registerIcon(this.getTextureName() + "_top"); - this.cactusBottomIcon = par1IconRegister.registerIcon(this.getTextureName() + "_bottom"); +@@ -141,4 +145,22 @@ + this.field_150041_a = p_149651_1_.registerIcon(this.func_149641_N() + "_top"); + this.field_150040_b = p_149651_1_.registerIcon(this.func_149641_N() + "_bottom"); } + + @Override -+ public EnumPlantType getPlantType(World world, int x, int y, int z) ++ public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z) + { + return EnumPlantType.Desert; + } + + @Override -+ public int getPlantID(World world, int x, int y, int z) ++ public Block getPlant(IBlockAccess world, int x, int y, int z) + { -+ return blockID; ++ return this; + } + + @Override -+ public int getPlantMetadata(World world, int x, int y, int z) ++ public int getPlantMetadata(IBlockAccess world, int x, int y, int z) + { + return -1; + } diff --git a/patches/minecraft/net/minecraft/block/BlockChest.java.patch b/patches/minecraft/net/minecraft/block/BlockChest.java.patch index f0b35a447..baac7a2db 100644 --- a/patches/minecraft/net/minecraft/block/BlockChest.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockChest.java.patch @@ -4,41 +4,41 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -+import static net.minecraftforge.common.ForgeDirection.*; ++import static net.minecraftforge.common.util.ForgeDirection.*; + public class BlockChest extends BlockContainer { - private final Random random = new Random(); -@@ -446,7 +448,7 @@ + private final Random field_149955_b = new Random(); +@@ -407,7 +409,7 @@ { return null; } -- else if (par1World.isBlockNormalCube(par2, par3 + 1, par4)) -+ else if (par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN)) +- else if (p_149951_1_.func_147439_a(p_149951_2_, p_149951_3_ + 1, p_149951_4_).func_149721_r()) ++ else if (p_149951_1_.isSideSolid(p_149951_2_, p_149951_3_ + 1, p_149951_4_, DOWN)) { return null; } -@@ -454,19 +456,19 @@ +@@ -415,19 +417,19 @@ { return null; } -- else if (par1World.getBlockId(par2 - 1, par3, par4) == this.blockID && (par1World.isBlockNormalCube(par2 - 1, par3 + 1, par4) || isOcelotBlockingChest(par1World, par2 - 1, par3, par4))) -+ else if (par1World.getBlockId(par2 - 1, par3, par4) == this.blockID && (par1World.isBlockSolidOnSide(par2 - 1, par3 + 1, par4, DOWN) || isOcelotBlockingChest(par1World, par2 - 1, par3, par4))) +- else if (p_149951_1_.func_147439_a(p_149951_2_ - 1, p_149951_3_, p_149951_4_) == this && (p_149951_1_.func_147439_a(p_149951_2_ - 1, p_149951_3_ + 1, p_149951_4_).func_149721_r() || func_149953_o(p_149951_1_, p_149951_2_ - 1, p_149951_3_, p_149951_4_))) ++ else if (p_149951_1_.func_147439_a(p_149951_2_ - 1, p_149951_3_, p_149951_4_) == this && (p_149951_1_.isSideSolid(p_149951_2_ - 1, p_149951_3_ + 1, p_149951_4_, DOWN) || func_149953_o(p_149951_1_, p_149951_2_ - 1, p_149951_3_, p_149951_4_))) { return null; } -- else if (par1World.getBlockId(par2 + 1, par3, par4) == this.blockID && (par1World.isBlockNormalCube(par2 + 1, par3 + 1, par4) || isOcelotBlockingChest(par1World, par2 + 1, par3, par4))) -+ else if (par1World.getBlockId(par2 + 1, par3, par4) == this.blockID && (par1World.isBlockSolidOnSide(par2 + 1, par3 + 1, par4, DOWN) || isOcelotBlockingChest(par1World, par2 + 1, par3, par4))) +- else if (p_149951_1_.func_147439_a(p_149951_2_ + 1, p_149951_3_, p_149951_4_) == this && (p_149951_1_.func_147439_a(p_149951_2_ + 1, p_149951_3_ + 1, p_149951_4_).func_149721_r() || func_149953_o(p_149951_1_, p_149951_2_ + 1, p_149951_3_, p_149951_4_))) ++ else if (p_149951_1_.func_147439_a(p_149951_2_ + 1, p_149951_3_, p_149951_4_) == this && (p_149951_1_.isSideSolid(p_149951_2_ + 1, p_149951_3_ + 1, p_149951_4_, DOWN) || func_149953_o(p_149951_1_, p_149951_2_ + 1, p_149951_3_, p_149951_4_))) { return null; } -- else if (par1World.getBlockId(par2, par3, par4 - 1) == this.blockID && (par1World.isBlockNormalCube(par2, par3 + 1, par4 - 1) || isOcelotBlockingChest(par1World, par2, par3, par4 - 1))) -+ else if (par1World.getBlockId(par2, par3, par4 - 1) == this.blockID && (par1World.isBlockSolidOnSide(par2, par3 + 1, par4 - 1, DOWN) || isOcelotBlockingChest(par1World, par2, par3, par4 - 1))) +- else if (p_149951_1_.func_147439_a(p_149951_2_, p_149951_3_, p_149951_4_ - 1) == this && (p_149951_1_.func_147439_a(p_149951_2_, p_149951_3_ + 1, p_149951_4_ - 1).func_149721_r() || func_149953_o(p_149951_1_, p_149951_2_, p_149951_3_, p_149951_4_ - 1))) ++ else if (p_149951_1_.func_147439_a(p_149951_2_, p_149951_3_, p_149951_4_ - 1) == this && (p_149951_1_.isSideSolid(p_149951_2_, p_149951_3_ + 1, p_149951_4_ - 1, DOWN) || func_149953_o(p_149951_1_, p_149951_2_, p_149951_3_, p_149951_4_ - 1))) { return null; } -- else if (par1World.getBlockId(par2, par3, par4 + 1) == this.blockID && (par1World.isBlockNormalCube(par2, par3 + 1, par4 + 1) || isOcelotBlockingChest(par1World, par2, par3, par4 + 1))) -+ else if (par1World.getBlockId(par2, par3, par4 + 1) == this.blockID && (par1World.isBlockSolidOnSide(par2, par3 + 1, par4 + 1, DOWN) || isOcelotBlockingChest(par1World, par2, par3, par4 + 1))) +- else if (p_149951_1_.func_147439_a(p_149951_2_, p_149951_3_, p_149951_4_ + 1) == this && (p_149951_1_.func_147439_a(p_149951_2_, p_149951_3_ + 1, p_149951_4_ + 1).func_149721_r() || func_149953_o(p_149951_1_, p_149951_2_, p_149951_3_, p_149951_4_ + 1))) ++ else if (p_149951_1_.func_147439_a(p_149951_2_, p_149951_3_, p_149951_4_ + 1) == this && (p_149951_1_.isSideSolid(p_149951_2_, p_149951_3_ + 1, p_149951_4_ + 1, DOWN) || func_149953_o(p_149951_1_, p_149951_2_, p_149951_3_, p_149951_4_ + 1))) { return null; } diff --git a/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch b/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch index 72f73f8a2..f86562fba 100644 --- a/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch @@ -1,49 +1,46 @@ --- ../src-base/minecraft/net/minecraft/block/BlockCocoa.java +++ ../src-work/minecraft/net/minecraft/block/BlockCocoa.java -@@ -2,6 +2,8 @@ +@@ -2,6 +2,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -+ +import java.util.ArrayList; import java.util.Random; import net.minecraft.block.material.Material; - import net.minecraft.client.renderer.texture.IconRegister; -@@ -201,7 +203,14 @@ - */ - public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) + import net.minecraft.client.renderer.texture.IIconRegister; +@@ -160,6 +161,13 @@ + + public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_) { -- int j1 = func_72219_c(par5); -+ super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0); ++ super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, p_149690_7_); + } + + @Override -+ public ArrayList getBlockDropped(World world, int x, int y, int z, int metadata, int fortune) ++ public ArrayList getDrops(World world, int x, int y, int z, int p_149690_5_, int fortune) + { -+ ArrayList dropped = super.getBlockDropped(world, x, y, z, metadata, fortune); -+ int j1 = func_72219_c(metadata); ++ ArrayList dropped = super.getDrops(world, x, y, z, p_149690_5_, fortune); + int j1 = func_149987_c(p_149690_5_); byte b0 = 1; - if (j1 >= 2) -@@ -211,8 +220,9 @@ +@@ -170,8 +178,9 @@ for (int k1 = 0; k1 < b0; ++k1) { -- this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(Item.dyePowder, 1, 3)); -+ dropped.add(new ItemStack(Item.dyePowder, 1, 3)); +- this.func_149642_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, new ItemStack(Items.dye, 1, 3)); ++ dropped.add(new ItemStack(Items.dye, 1, 3)); } + return dropped; } @SideOnly(Side.CLIENT) -@@ -248,4 +258,10 @@ - this.iconArray[i] = par1IconRegister.registerIcon(this.getTextureName() + "_stage_" + i); - } +@@ -216,4 +225,10 @@ + ++j1; + p_149853_1_.setBlockMetadataWithNotify(p_149853_3_, p_149853_4_, p_149853_5_, j1 << 2 | i1, 2); } + + @Override -+ public int idDropped(int par1, Random par2Random, int par3) ++ public Item func_149650_a(int par1, Random par2Random, int par3) + { -+ return 0; ++ return null; + } } diff --git a/patches/minecraft/net/minecraft/block/BlockComparator.java.patch b/patches/minecraft/net/minecraft/block/BlockComparator.java.patch deleted file mode 100644 index 2ef2cfe25..000000000 --- a/patches/minecraft/net/minecraft/block/BlockComparator.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockComparator.java -+++ ../src-work/minecraft/net/minecraft/block/BlockComparator.java -@@ -268,4 +268,17 @@ - { - return new TileEntityComparator(); - } -+ -+ @Override -+ public void onNeighborTileChange(World world, int x, int y, int z, int tileX, int tileY, int tileZ) -+ { -+ if(y == tileY) -+ onNeighborBlockChange(world, x, y, z, world.getBlockId(tileX, tileY, tileZ)); -+ } -+ -+ @Override -+ public boolean weakTileChanges() -+ { -+ return true; -+ } - } diff --git a/patches/minecraft/net/minecraft/block/BlockCrops.java.patch b/patches/minecraft/net/minecraft/block/BlockCrops.java.patch index 7c1b02adf..46bab1750 100644 --- a/patches/minecraft/net/minecraft/block/BlockCrops.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockCrops.java.patch @@ -6,62 +6,74 @@ import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; import java.util.Random; - import net.minecraft.client.renderer.texture.IconRegister; + import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; -@@ -10,6 +11,7 @@ - import net.minecraft.util.Icon; +@@ -12,6 +13,7 @@ + import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; -+import net.minecraftforge.common.ForgeDirection; ++import net.minecraftforge.common.util.ForgeDirection; - public class BlockCrops extends BlockFlower + public class BlockCrops extends BlockBush implements IGrowable { -@@ -103,11 +105,11 @@ - int j3 = par1World.getBlockId(l2, par3 - 1, i3); +@@ -89,11 +91,11 @@ + { float f1 = 0.0F; -- if (j3 == Block.tilledField.blockID) -+ if (blocksList[j3] != null && blocksList[j3].canSustainPlant(par1World, l2, par3 - 1, i3, ForgeDirection.UP, this)) +- if (p_149864_1_.func_147439_a(l, p_149864_3_ - 1, i1) == Blocks.farmland) ++ if (p_149864_1_.func_147439_a(l, p_149864_3_ - 1, i1).canSustainPlant(p_149864_1_, l, p_149864_3_ - 1, i1, ForgeDirection.UP, this)) { f1 = 1.0F; -- if (par1World.getBlockMetadata(l2, par3 - 1, i3) > 0) -+ if (blocksList[j3].isFertile(par1World, l2, par3 - 1, i3)) +- if (p_149864_1_.getBlockMetadata(l, p_149864_3_ - 1, i1) > 0) ++ if (p_149864_1_.func_147439_a(l, p_149864_3_ - 1, i1).isFertile(p_149864_1_, l, p_149864_3_ - 1, i1)) { f1 = 3.0F; } -@@ -175,22 +177,25 @@ - public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) +@@ -145,22 +147,6 @@ + public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_) { - super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0); -+ } - -- if (!par1World.isRemote) -+ @Override -+ public ArrayList getBlockDropped(World world, int x, int y, int z, int metadata, int fortune) -+ { -+ ArrayList ret = super.getBlockDropped(world, x, y, z, metadata, fortune); -+ -+ if (metadata >= 7) - { -- if (par5 >= 7) -+ for (int n = 0; n < 3 + fortune; n++) - { -- int j1 = 3 + par7; + super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, 0); +- +- if (!p_149690_1_.isRemote) +- { +- if (p_149690_5_ >= 7) +- { +- int j1 = 3 + p_149690_7_; - - for (int k1 = 0; k1 < j1; ++k1) -+ if (world.rand.nextInt(15) <= metadata) - { -- if (par1World.rand.nextInt(15) <= par5) +- { +- if (p_149690_1_.rand.nextInt(15) <= p_149690_5_) - { -- this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(this.getSeedItem(), 1, 0)); +- this.func_149642_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, new ItemStack(this.func_149866_i(), 1, 0)); - } -+ ret.add(new ItemStack(this.getSeedItem(), 1, 0)); - } - } - } -+ -+ return ret; +- } +- } +- } } - /** + public Item func_149650_a(int p_149650_1_, Random p_149650_2_, int p_149650_3_) +@@ -204,4 +190,23 @@ + { + this.func_149863_m(p_149853_1_, p_149853_3_, p_149853_4_, p_149853_5_); + } ++ ++ @Override ++ public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) ++ { ++ ArrayList ret = new ArrayList(); ++ ++ if (metadata >= 7) ++ { ++ for (int i = 0; i < 3 + fortune; ++i) ++ { ++ if (world.rand.nextInt(15) <= metadata) ++ { ++ ret.add(new ItemStack(this.func_149866_i(), 1, 0)); ++ } ++ } ++ } ++ ++ return ret; ++ } + } diff --git a/patches/minecraft/net/minecraft/block/BlockDoor.java.patch b/patches/minecraft/net/minecraft/block/BlockDoor.java.patch index ce2adce93..c3c475130 100644 --- a/patches/minecraft/net/minecraft/block/BlockDoor.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockDoor.java.patch @@ -1,8 +1,8 @@ --- ../src-base/minecraft/net/minecraft/block/BlockDoor.java +++ ../src-work/minecraft/net/minecraft/block/BlockDoor.java -@@ -290,7 +290,7 @@ +@@ -249,7 +249,7 @@ { - if (this.blockMaterial == Material.iron) + if (this.field_149764_J == Material.field_151573_f) { - return true; + return false; //Allow items to interact with the door 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 000000000..c38ada9c6 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockFalling.java.patch @@ -0,0 +1,19 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockFalling.java ++++ ../src-work/minecraft/net/minecraft/block/BlockFalling.java +@@ -84,7 +84,7 @@ + { + Block block = p_149831_0_.func_147439_a(p_149831_1_, p_149831_2_, p_149831_3_); + +- if (block.field_149764_J == Material.field_151579_a) ++ if (block.isAir(p_149831_0_, p_149831_1_, p_149831_2_, p_149831_3_)) + { + return true; + } +@@ -94,6 +94,7 @@ + } + else + { ++ //TODO: King, take a look here when doing liquids! + Material material = block.field_149764_J; + return material == Material.field_151586_h ? true : material == Material.field_151587_i; + } diff --git a/patches/minecraft/net/minecraft/block/BlockFarmland.java.patch b/patches/minecraft/net/minecraft/block/BlockFarmland.java.patch index 90859cbee..ace4d430f 100644 --- a/patches/minecraft/net/minecraft/block/BlockFarmland.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockFarmland.java.patch @@ -1,22 +1,20 @@ --- ../src-base/minecraft/net/minecraft/block/BlockFarmland.java +++ ../src-work/minecraft/net/minecraft/block/BlockFarmland.java -@@ -11,6 +11,9 @@ - import net.minecraft.util.Icon; +@@ -12,6 +12,8 @@ + import net.minecraft.util.AxisAlignedBB; + import net.minecraft.util.IIcon; import net.minecraft.world.World; - -+import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.IPlantable; -+ ++import net.minecraftforge.common.util.ForgeDirection; + public class BlockFarmland extends Block { - @SideOnly(Side.CLIENT) -@@ -115,7 +118,8 @@ +@@ -94,7 +96,7 @@ { - int j1 = par1World.getBlockId(l, par3 + 1, i1); + Block block = p_149822_1_.func_147439_a(l, p_149822_3_ + 1, i1); -- if (j1 == Block.crops.blockID || j1 == Block.melonStem.blockID || j1 == Block.pumpkinStem.blockID || j1 == Block.potato.blockID || j1 == Block.carrot.blockID) -+ Block plant = blocksList[j1]; -+ if (plant instanceof IPlantable && canSustainPlant(par1World, par2, par3, par4, ForgeDirection.UP, (IPlantable)plant)) +- if (block == Blocks.wheat || block == Blocks.melon_stem || block == Blocks.pumpkin_stem || block == Blocks.potatoes || block == Blocks.carrots) ++ if (block instanceof IPlantable && canSustainPlant(p_149822_1_, p_149822_2_, p_149822_3_, p_149822_4_, ForgeDirection.UP, (IPlantable)block)) { return true; } diff --git a/patches/minecraft/net/minecraft/block/BlockFire.java.patch b/patches/minecraft/net/minecraft/block/BlockFire.java.patch index 54dc6e33a..e438d98ee 100644 --- a/patches/minecraft/net/minecraft/block/BlockFire.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockFire.java.patch @@ -1,215 +1,275 @@ --- ../src-base/minecraft/net/minecraft/block/BlockFire.java +++ ../src-work/minecraft/net/minecraft/block/BlockFire.java -@@ -11,6 +11,9 @@ +@@ -2,7 +2,10 @@ + + import cpw.mods.fml.relauncher.Side; + import cpw.mods.fml.relauncher.SideOnly; ++import java.util.IdentityHashMap; ++import java.util.Map.Entry; + import java.util.Random; ++import com.google.common.collect.Maps; + import net.minecraft.block.material.MapColor; + import net.minecraft.block.material.Material; + import net.minecraft.client.renderer.texture.IIconRegister; +@@ -12,11 +15,15 @@ + import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraft.world.WorldProviderEnd; ++import net.minecraftforge.common.util.ForgeDirection; ++import static net.minecraftforge.common.util.ForgeDirection.*; -+import net.minecraftforge.common.ForgeDirection; -+import static net.minecraftforge.common.ForgeDirection.*; -+ public class BlockFire extends Block { - /** The chance this block will encourage nearby blocks to catch on fire */ -@@ -36,6 +39,8 @@ - */ - public void initializeBlock() +- private int[] field_149849_a = new int[256]; +- private int[] field_149848_b = new int[256]; ++ @Deprecated ++ private int[] field_149849_a = new int[4096]; ++ @Deprecated ++ private int[] field_149848_b = new int[4096]; + @SideOnly(Side.CLIENT) + private IIcon[] field_149850_M; + private static final String __OBFID = "CL_00000245"; +@@ -56,8 +63,7 @@ + + public void func_149842_a(int p_149842_1_, int p_149842_2_, int p_149842_3_) { -+ abilityToCatchFire = Block.blockFlammability; -+ chanceToEncourageFire = Block.blockFireSpreadSpeed; - this.setBurnRate(Block.planks.blockID, 5, 20); - this.setBurnRate(Block.woodDoubleSlab.blockID, 5, 20); - this.setBurnRate(Block.woodSingleSlab.blockID, 5, 20); -@@ -62,8 +67,7 @@ - */ - private void setBurnRate(int par1, int par2, int par3) - { -- this.chanceToEncourageFire[par1] = par2; -- this.abilityToCatchFire[par1] = par3; -+ Block.setBurnProperties(par1, par2, par3); +- this.field_149849_a[p_149842_1_] = p_149842_2_; +- this.field_149848_b[p_149842_1_] = p_149842_3_; ++ this.setFireInfo((Block)Block.field_149771_c.getObject(p_149842_1_), p_149842_2_, p_149842_3_); } - /** -@@ -123,13 +127,9 @@ + public AxisAlignedBB func_149668_a(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) +@@ -94,13 +100,8 @@ { - if (par1World.getGameRules().getGameRuleBooleanValue("doFireTick")) + if (p_149674_1_.getGameRules().getGameRuleBooleanValue("doFireTick")) { -- boolean flag = par1World.getBlockId(par2, par3 - 1, par4) == Block.netherrack.blockID; -+ Block base = Block.blocksList[par1World.getBlockId(par2, par3 - 1, par4)]; -+ boolean flag = (base != null && base.isFireSource(par1World, par2, par3 - 1, par4, par1World.getBlockMetadata(par2, par3 - 1, par4), UP)); +- boolean flag = p_149674_1_.func_147439_a(p_149674_2_, p_149674_3_ - 1, p_149674_4_) == Blocks.netherrack; ++ boolean flag = p_149674_1_.func_147439_a(p_149674_2_, p_149674_3_ - 1, p_149674_4_).isFireSource(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_, UP); -- if (par1World.provider instanceof WorldProviderEnd && par1World.getBlockId(par2, par3 - 1, par4) == Block.bedrock.blockID) +- if (p_149674_1_.provider instanceof WorldProviderEnd && p_149674_1_.func_147439_a(p_149674_2_, p_149674_3_ - 1, p_149674_4_) == Blocks.bedrock) - { - flag = true; - } - - if (!this.canPlaceBlockAt(par1World, par2, par3, par4)) + if (!this.func_149742_c(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_)) { - par1World.setBlockToAir(par2, par3, par4); -@@ -157,7 +157,7 @@ - par1World.setBlockToAir(par2, par3, par4); + p_149674_1_.func_147468_f(p_149674_2_, p_149674_3_, p_149674_4_); +@@ -128,7 +129,7 @@ + p_149674_1_.func_147468_f(p_149674_2_, p_149674_3_, p_149674_4_); } } -- else if (!flag && !this.canBlockCatchFire(par1World, par2, par3 - 1, par4) && l == 15 && par5Random.nextInt(4) == 0) -+ else if (!flag && !this.canBlockCatchFire(par1World, par2, par3 - 1, par4, UP) && l == 15 && par5Random.nextInt(4) == 0) +- else if (!flag && !this.func_149844_e(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_) && l == 15 && p_149674_5_.nextInt(4) == 0) ++ else if (!flag && !this.canCatchFire(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_, UP) && l == 15 && p_149674_5_.nextInt(4) == 0) { - par1World.setBlockToAir(par2, par3, par4); + p_149674_1_.func_147468_f(p_149674_2_, p_149674_3_, p_149674_4_); } -@@ -171,12 +171,12 @@ +@@ -142,12 +143,12 @@ b0 = -50; } -- this.tryToCatchBlockOnFire(par1World, par2 + 1, par3, par4, 300 + b0, par5Random, l); -- this.tryToCatchBlockOnFire(par1World, par2 - 1, par3, par4, 300 + b0, par5Random, l); -- this.tryToCatchBlockOnFire(par1World, par2, par3 - 1, par4, 250 + b0, par5Random, l); -- this.tryToCatchBlockOnFire(par1World, par2, par3 + 1, par4, 250 + b0, par5Random, l); -- this.tryToCatchBlockOnFire(par1World, par2, par3, par4 - 1, 300 + b0, par5Random, l); -- this.tryToCatchBlockOnFire(par1World, par2, par3, par4 + 1, 300 + b0, par5Random, l); -+ this.tryToCatchBlockOnFire(par1World, par2 + 1, par3, par4, 300 + b0, par5Random, l, WEST ); -+ this.tryToCatchBlockOnFire(par1World, par2 - 1, par3, par4, 300 + b0, par5Random, l, EAST ); -+ this.tryToCatchBlockOnFire(par1World, par2, par3 - 1, par4, 250 + b0, par5Random, l, UP ); -+ this.tryToCatchBlockOnFire(par1World, par2, par3 + 1, par4, 250 + b0, par5Random, l, DOWN ); -+ this.tryToCatchBlockOnFire(par1World, par2, par3, par4 - 1, 300 + b0, par5Random, l, SOUTH); -+ this.tryToCatchBlockOnFire(par1World, par2, par3, par4 + 1, 300 + b0, par5Random, l, NORTH); +- this.func_149841_a(p_149674_1_, p_149674_2_ + 1, p_149674_3_, p_149674_4_, 300 + b0, p_149674_5_, l); +- this.func_149841_a(p_149674_1_, p_149674_2_ - 1, p_149674_3_, p_149674_4_, 300 + b0, p_149674_5_, l); +- this.func_149841_a(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_, 250 + b0, p_149674_5_, l); +- this.func_149841_a(p_149674_1_, p_149674_2_, p_149674_3_ + 1, p_149674_4_, 250 + b0, p_149674_5_, l); +- this.func_149841_a(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_ - 1, 300 + b0, p_149674_5_, l); +- this.func_149841_a(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_ + 1, 300 + b0, p_149674_5_, l); ++ this.tryCatchFire(p_149674_1_, p_149674_2_ + 1, p_149674_3_, p_149674_4_, 300 + b0, p_149674_5_, l, WEST ); ++ this.tryCatchFire(p_149674_1_, p_149674_2_ - 1, p_149674_3_, p_149674_4_, 300 + b0, p_149674_5_, l, EAST ); ++ this.tryCatchFire(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_, 250 + b0, p_149674_5_, l, UP ); ++ this.tryCatchFire(p_149674_1_, p_149674_2_, p_149674_3_ + 1, p_149674_4_, 250 + b0, p_149674_5_, l, DOWN ); ++ this.tryCatchFire(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_ - 1, 300 + b0, p_149674_5_, l, SOUTH); ++ this.tryCatchFire(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_ + 1, 300 + b0, p_149674_5_, l, NORTH); - for (int i1 = par2 - 1; i1 <= par2 + 1; ++i1) + for (int i1 = p_149674_2_ - 1; i1 <= p_149674_2_ + 1; ++i1) { -@@ -230,10 +230,21 @@ +@@ -201,10 +202,16 @@ return false; } + @Deprecated - private void tryToCatchBlockOnFire(World par1World, int par2, int par3, int par4, int par5, Random par6Random, int par7) + private void func_149841_a(World p_149841_1_, int p_149841_2_, int p_149841_3_, int p_149841_4_, int p_149841_5_, Random p_149841_6_, int p_149841_7_) { -- int j1 = this.abilityToCatchFire[par1World.getBlockId(par2, par3, par4)]; -+ tryToCatchBlockOnFire(par1World, par2, par3, par4, par5, par6Random, par7, UP); +- int j1 = this.field_149848_b[Block.func_149682_b(p_149841_1_.func_147439_a(p_149841_2_, p_149841_3_, p_149841_4_))]; ++ this.tryCatchFire(p_149841_1_, p_149841_2_, p_149841_3_, p_149841_4_, p_149841_5_, p_149841_6_, p_149841_7_, UP); + } -+ private void tryToCatchBlockOnFire(World par1World, int par2, int par3, int par4, int par5, Random par6Random, int par7, ForgeDirection face) ++ private void tryCatchFire(World p_149841_1_, int p_149841_2_, int p_149841_3_, int p_149841_4_, int p_149841_5_, Random p_149841_6_, int p_149841_7_, ForgeDirection face) + { -+ int j1 = 0; -+ Block block = Block.blocksList[par1World.getBlockId(par2, par3, par4)]; -+ if (block != null) -+ { -+ j1 = block.getFlammability(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), face); -+ } ++ int j1 = p_149841_1_.func_147439_a(p_149841_2_, p_149841_3_, p_149841_4_).getFlammability(p_149841_1_, p_149841_2_, p_149841_3_, p_149841_4_, face); + - if (par6Random.nextInt(par5) < j1) + if (p_149841_6_.nextInt(p_149841_5_) < j1) { - boolean flag = par1World.getBlockId(par2, par3, par4) == Block.tnt.blockID; -@@ -266,7 +277,12 @@ - */ - private boolean canNeighborBurn(World par1World, int par2, int par3, int par4) + boolean flag = p_149841_1_.func_147439_a(p_149841_2_, p_149841_3_, p_149841_4_) == Blocks.tnt; +@@ -234,7 +241,12 @@ + + private boolean func_149847_e(World p_149847_1_, int p_149847_2_, int p_149847_3_, int p_149847_4_) { -- return this.canBlockCatchFire(par1World, par2 + 1, par3, par4) ? true : (this.canBlockCatchFire(par1World, par2 - 1, par3, par4) ? true : (this.canBlockCatchFire(par1World, par2, par3 - 1, par4) ? true : (this.canBlockCatchFire(par1World, par2, par3 + 1, par4) ? true : (this.canBlockCatchFire(par1World, par2, par3, par4 - 1) ? true : this.canBlockCatchFire(par1World, par2, par3, par4 + 1))))); -+ return canBlockCatchFire(par1World, par2 + 1, par3, par4, WEST ) || -+ canBlockCatchFire(par1World, par2 - 1, par3, par4, EAST ) || -+ canBlockCatchFire(par1World, par2, par3 - 1, par4, UP ) || -+ canBlockCatchFire(par1World, par2, par3 + 1, par4, DOWN ) || -+ canBlockCatchFire(par1World, par2, par3, par4 - 1, SOUTH) || -+ canBlockCatchFire(par1World, par2, par3, par4 + 1, NORTH); +- return this.func_149844_e(p_149847_1_, p_149847_2_ + 1, p_149847_3_, p_149847_4_) ? true : (this.func_149844_e(p_149847_1_, p_149847_2_ - 1, p_149847_3_, p_149847_4_) ? true : (this.func_149844_e(p_149847_1_, p_149847_2_, p_149847_3_ - 1, p_149847_4_) ? true : (this.func_149844_e(p_149847_1_, p_149847_2_, p_149847_3_ + 1, p_149847_4_) ? true : (this.func_149844_e(p_149847_1_, p_149847_2_, p_149847_3_, p_149847_4_ - 1) ? true : this.func_149844_e(p_149847_1_, p_149847_2_, p_149847_3_, p_149847_4_ + 1))))); ++ return this.canCatchFire(p_149847_1_, p_149847_2_ + 1, p_149847_3_, p_149847_4_, WEST ) || ++ this.canCatchFire(p_149847_1_, p_149847_2_ - 1, p_149847_3_, p_149847_4_, EAST ) || ++ this.canCatchFire(p_149847_1_, p_149847_2_, p_149847_3_ - 1, p_149847_4_, UP ) || ++ this.canCatchFire(p_149847_1_, p_149847_2_, p_149847_3_ + 1, p_149847_4_, DOWN ) || ++ this.canCatchFire(p_149847_1_, p_149847_2_, p_149847_3_, p_149847_4_ - 1, SOUTH) || ++ this.canCatchFire(p_149847_1_, p_149847_2_, p_149847_3_, p_149847_4_ + 1, NORTH); } - /** -@@ -282,12 +298,12 @@ + private int func_149845_m(World p_149845_1_, int p_149845_2_, int p_149845_3_, int p_149845_4_) +@@ -247,12 +259,13 @@ } else { -- int l = this.getChanceToEncourageFire(par1World, par2 + 1, par3, par4, b0); -- l = this.getChanceToEncourageFire(par1World, par2 - 1, par3, par4, l); -- l = this.getChanceToEncourageFire(par1World, par2, par3 - 1, par4, l); -- l = this.getChanceToEncourageFire(par1World, par2, par3 + 1, par4, l); -- l = this.getChanceToEncourageFire(par1World, par2, par3, par4 - 1, l); -- l = this.getChanceToEncourageFire(par1World, par2, par3, par4 + 1, l); -+ int l = this.getChanceToEncourageFire(par1World, par2 + 1, par3, par4, b0, WEST); -+ l = this.getChanceToEncourageFire(par1World, par2 - 1, par3, par4, l, EAST); -+ l = this.getChanceToEncourageFire(par1World, par2, par3 - 1, par4, l, UP); -+ l = this.getChanceToEncourageFire(par1World, par2, par3 + 1, par4, l, DOWN); -+ l = this.getChanceToEncourageFire(par1World, par2, par3, par4 - 1, l, SOUTH); -+ l = this.getChanceToEncourageFire(par1World, par2, par3, par4 + 1, l, NORTH); +- int l = this.func_149846_a(p_149845_1_, p_149845_2_ + 1, p_149845_3_, p_149845_4_, b0); +- l = this.func_149846_a(p_149845_1_, p_149845_2_ - 1, p_149845_3_, p_149845_4_, l); +- l = this.func_149846_a(p_149845_1_, p_149845_2_, p_149845_3_ - 1, p_149845_4_, l); +- l = this.func_149846_a(p_149845_1_, p_149845_2_, p_149845_3_ + 1, p_149845_4_, l); +- l = this.func_149846_a(p_149845_1_, p_149845_2_, p_149845_3_, p_149845_4_ - 1, l); +- l = this.func_149846_a(p_149845_1_, p_149845_2_, p_149845_3_, p_149845_4_ + 1, l); ++ int l = b0; ++ l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_ + 1, p_149845_3_, p_149845_4_, l, WEST ); ++ l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_ - 1, p_149845_3_, p_149845_4_, l, EAST ); ++ l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_, p_149845_3_ - 1, p_149845_4_, l, UP ); ++ l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_, p_149845_3_ + 1, p_149845_4_, l, DOWN ); ++ l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_, p_149845_3_, p_149845_4_ - 1, l, SOUTH); ++ l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_, p_149845_3_, p_149845_4_ + 1, l, NORTH); return l; } } -@@ -302,21 +318,24 @@ - - /** - * Checks the specified block coordinate to see if it can catch fire. Args: blockAccess, x, y, z -+ * Deprecated for a side-sensitive version - */ -+ @Deprecated - public boolean canBlockCatchFire(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) - { -- return this.chanceToEncourageFire[par1IBlockAccess.getBlockId(par2, par3, par4)] > 0; -+ return canBlockCatchFire(par1IBlockAccess, par2, par3, par4, UP); +@@ -262,15 +275,16 @@ + return false; } - /** - * Retrieves a specified block's chance to encourage their neighbors to burn and if the number is greater than the - * current number passed in it will return its number instead of the passed in one. Args: world, x, y, z, - * curChanceToEncourageFire -+ * Deprecated for a side-sensitive version - */ + @Deprecated - public int getChanceToEncourageFire(World par1World, int par2, int par3, int par4, int par5) + public boolean func_149844_e(IBlockAccess p_149844_1_, int p_149844_2_, int p_149844_3_, int p_149844_4_) { -- int i1 = this.chanceToEncourageFire[par1World.getBlockId(par2, par3, par4)]; -- return i1 > par5 ? i1 : par5; -+ return getChanceToEncourageFire(par1World, par2, par3, par4, par5, UP); +- return this.field_149849_a[Block.func_149682_b(p_149844_1_.func_147439_a(p_149844_2_, p_149844_3_, p_149844_4_))] > 0; ++ return canCatchFire(p_149844_1_, p_149844_2_, p_149844_3_, p_149844_4_, UP); } - /** -@@ -374,9 +393,9 @@ ++ @Deprecated + public int func_149846_a(World p_149846_1_, int p_149846_2_, int p_149846_3_, int p_149846_4_, int p_149846_5_) + { +- int i1 = this.field_149849_a[Block.func_149682_b(p_149846_1_.func_147439_a(p_149846_2_, p_149846_3_, p_149846_4_))]; +- return i1 > p_149846_5_ ? i1 : p_149846_5_; ++ return getChanceToEncourageFire(p_149846_1_, p_149846_2_, p_149846_3_, p_149846_4_, p_149846_5_, UP); + } + + public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) +@@ -314,9 +328,9 @@ float f1; float f2; -- if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && !Block.fire.canBlockCatchFire(par1World, par2, par3 - 1, par4)) -+ if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && !Block.fire.canBlockCatchFire(par1World, par2, par3 - 1, par4, UP)) +- if (!World.func_147466_a(p_149734_1_, p_149734_2_, p_149734_3_ - 1, p_149734_4_) && !Blocks.fire.func_149844_e(p_149734_1_, p_149734_2_, p_149734_3_ - 1, p_149734_4_)) ++ if (!World.func_147466_a(p_149734_1_, p_149734_2_, p_149734_3_ - 1, p_149734_4_) && !Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_ - 1, p_149734_4_, UP)) { -- if (Block.fire.canBlockCatchFire(par1World, par2 - 1, par3, par4)) -+ if (Block.fire.canBlockCatchFire(par1World, par2 - 1, par3, par4, EAST)) +- if (Blocks.fire.func_149844_e(p_149734_1_, p_149734_2_ - 1, p_149734_3_, p_149734_4_)) ++ if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_ - 1, p_149734_3_, p_149734_4_, EAST)) { for (l = 0; l < 2; ++l) { -@@ -387,7 +406,7 @@ +@@ -327,7 +341,7 @@ } } -- if (Block.fire.canBlockCatchFire(par1World, par2 + 1, par3, par4)) -+ if (Block.fire.canBlockCatchFire(par1World, par2 + 1, par3, par4, WEST)) +- if (Blocks.fire.func_149844_e(p_149734_1_, p_149734_2_ + 1, p_149734_3_, p_149734_4_)) ++ if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_ + 1, p_149734_3_, p_149734_4_, WEST)) { for (l = 0; l < 2; ++l) { -@@ -398,7 +417,7 @@ +@@ -338,7 +352,7 @@ } } -- if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 - 1)) -+ if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 - 1, SOUTH)) +- if (Blocks.fire.func_149844_e(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_ - 1)) ++ if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_ - 1, SOUTH)) { for (l = 0; l < 2; ++l) { -@@ -409,7 +428,7 @@ +@@ -349,7 +363,7 @@ } } -- if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 + 1)) -+ if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 + 1, NORTH)) +- if (Blocks.fire.func_149844_e(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_ + 1)) ++ if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_ + 1, NORTH)) { for (l = 0; l < 2; ++l) { -@@ -420,7 +439,7 @@ +@@ -360,7 +374,7 @@ } } -- if (Block.fire.canBlockCatchFire(par1World, par2, par3 + 1, par4)) -+ if (Block.fire.canBlockCatchFire(par1World, par2, par3 + 1, par4, DOWN)) +- if (Blocks.fire.func_149844_e(p_149734_1_, p_149734_2_, p_149734_3_ + 1, p_149734_4_)) ++ if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_ + 1, p_149734_4_, DOWN)) { for (l = 0; l < 2; ++l) { -@@ -469,4 +488,46 @@ +@@ -405,4 +419,100 @@ { - return this.iconArray[0]; + return MapColor.field_151656_f; } -+ ++ ++ /*================================= Forge Start ======================================*/ ++ private static class FireInfo ++ { ++ private int encouragement = 0; ++ private int flammibility = 0; ++ } ++ private IdentityHashMap blockInfo = Maps.newIdentityHashMap(); ++ ++ public void setFireInfo(Block block, int encouragement, int flammibility) ++ { ++ int id = Block.func_149682_b(block); ++ this.field_149849_a[id] = encouragement; ++ this.field_149848_b[id] = flammibility; ++ ++ FireInfo info = getInfo(block, true); ++ info.encouragement = encouragement; ++ info.flammibility = flammibility; ++ } ++ ++ private FireInfo getInfo(Block block, boolean garentee) ++ { ++ FireInfo ret = blockInfo.get(block); ++ if (ret == null && garentee) ++ { ++ ret = new FireInfo(); ++ blockInfo.put(block, ret); ++ } ++ return ret; ++ } ++ ++ public void rebuildFireInfo() ++ { ++ for (int x = 0; x < 4096; x++) ++ { ++ //If we care.. we could detect changes in here and make sure we keep them, however ++ //it's my thinking that anyone who hacks into the private variables should DIAF and we don't care about them. ++ field_149849_a[x] = 0; ++ field_149848_b[x] = 0; ++ } ++ ++ for (Entry e : blockInfo.entrySet()) ++ { ++ int id = Block.func_149682_b(e.getKey()); ++ if (id >= 0 && id < 4096) ++ { ++ field_149849_a[id] = e.getValue().encouragement; ++ field_149848_b[id] = e.getValue().flammibility; ++ } ++ } ++ } ++ ++ public int getFlammability(Block block) ++ { ++ int id = Block.func_149682_b(block); ++ return id >= 0 && id < 4096 ? field_149848_b[id] : 0; ++ } ++ ++ public int getEncouragement(Block block) ++ { ++ int id = Block.func_149682_b(block); ++ return id >= 0 && id < 4096 ? field_149849_a[id] : 0; ++ } ++ + /** + * Side sensitive version that calls the block function. + * @@ -220,14 +280,9 @@ + * @param face The side the fire is coming from + * @return True if the face can catch fire. + */ -+ public boolean canBlockCatchFire(IBlockAccess world, int x, int y, int z, ForgeDirection face) ++ public boolean canCatchFire(IBlockAccess world, int x, int y, int z, ForgeDirection face) + { -+ Block block = Block.blocksList[world.getBlockId(x, y, z)]; -+ if (block != null) -+ { -+ return block.isFlammable(world, x, y, z, world.getBlockMetadata(x, y, z), face); -+ } -+ return false; ++ return world.func_147439_a(x, y, z).isFlammable(world, x, y, z, face); + } + + /** @@ -241,14 +296,10 @@ + * @param face The side the fire is coming from + * @return The chance of the block catching fire, or oldChance if it is higher + */ -+ public int getChanceToEncourageFire(World world, int x, int y, int z, int oldChance, ForgeDirection face) ++ public int getChanceToEncourageFire(IBlockAccess world, int x, int y, int z, int oldChance, ForgeDirection face) + { -+ int newChance = 0; -+ Block block = Block.blocksList[world.getBlockId(x, y, z)]; -+ if (block != null) -+ { -+ newChance = block.getFireSpreadSpeed(world, x, y, z, world.getBlockMetadata(x, y, z), face); -+ } ++ int newChance = world.func_147439_a(x, y, z).getFireSpreadSpeed(world, x, y, z, face); + return (newChance > oldChance ? newChance : oldChance); + } ++ /*================================= Forge Start ======================================*/ } diff --git a/patches/minecraft/net/minecraft/block/BlockFlower.java.patch b/patches/minecraft/net/minecraft/block/BlockFlower.java.patch deleted file mode 100644 index 25ccf6831..000000000 --- a/patches/minecraft/net/minecraft/block/BlockFlower.java.patch +++ /dev/null @@ -1,69 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockFlower.java -+++ ../src-work/minecraft/net/minecraft/block/BlockFlower.java -@@ -6,7 +6,12 @@ - import net.minecraft.util.AxisAlignedBB; - import net.minecraft.world.World; - --public class BlockFlower extends Block -+import net.minecraftforge.common.EnumPlantType; -+import net.minecraftforge.common.ForgeDirection; -+import net.minecraftforge.common.IPlantable; -+import static net.minecraftforge.common.EnumPlantType.*; -+ -+public class BlockFlower extends Block implements IPlantable - { - protected BlockFlower(int par1, Material par2Material) - { -@@ -27,7 +32,7 @@ - */ - public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) - { -- return super.canPlaceBlockAt(par1World, par2, par3, par4) && this.canThisPlantGrowOnThisBlockID(par1World.getBlockId(par2, par3 - 1, par4)); -+ return super.canPlaceBlockAt(par1World, par2, par3, par4) && canBlockStay(par1World, par2, par3, par4); - } - - /** -@@ -71,7 +76,9 @@ - */ - public boolean canBlockStay(World par1World, int par2, int par3, int par4) - { -- return (par1World.getFullBlockLightValue(par2, par3, par4) >= 8 || par1World.canBlockSeeTheSky(par2, par3, par4)) && this.canThisPlantGrowOnThisBlockID(par1World.getBlockId(par2, par3 - 1, par4)); -+ Block soil = blocksList[par1World.getBlockId(par2, par3 - 1, par4)]; -+ return (par1World.getFullBlockLightValue(par2, par3, par4) >= 8 || par1World.canBlockSeeTheSky(par2, par3, par4)) && -+ (soil != null && soil.canSustainPlant(par1World, par2, par3 - 1, par4, ForgeDirection.UP, this)); - } - - /** -@@ -107,4 +114,32 @@ - { - return 1; - } -+ -+ @Override -+ public EnumPlantType getPlantType(World world, int x, int y, int z) -+ { -+ if (blockID == crops.blockID ) return Crop; -+ if (blockID == deadBush.blockID ) return Desert; -+ if (blockID == waterlily.blockID ) return Water; -+ if (blockID == mushroomRed.blockID ) return Cave; -+ if (blockID == mushroomBrown.blockID) return Cave; -+ if (blockID == netherStalk.blockID ) return Nether; -+ if (blockID == sapling.blockID ) return Plains; -+ if (blockID == melonStem.blockID ) return Crop; -+ if (blockID == pumpkinStem.blockID ) return Crop; -+ if (blockID == tallGrass.blockID ) return Plains; -+ return Plains; -+ } -+ -+ @Override -+ public int getPlantID(World world, int x, int y, int z) -+ { -+ return blockID; -+ } -+ -+ @Override -+ public int getPlantMetadata(World world, int x, int y, int z) -+ { -+ return world.getBlockMetadata(x, y, z); -+ } - } diff --git a/patches/minecraft/net/minecraft/block/BlockFlowing.java.patch b/patches/minecraft/net/minecraft/block/BlockFlowing.java.patch deleted file mode 100644 index e4bd1e372..000000000 --- a/patches/minecraft/net/minecraft/block/BlockFlowing.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockFlowing.java -+++ ../src-work/minecraft/net/minecraft/block/BlockFlowing.java -@@ -206,7 +206,7 @@ - { - this.triggerLavaMixEffects(par1World, par2, par3, par4); - } -- else -+ else if (i1 != Block.snow.blockID)//Forge: Damn snow. - { - Block.blocksList[i1].dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); - } diff --git a/patches/minecraft/net/minecraft/block/BlockFluid.java.patch b/patches/minecraft/net/minecraft/block/BlockFluid.java.patch deleted file mode 100644 index 67010a533..000000000 --- a/patches/minecraft/net/minecraft/block/BlockFluid.java.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockFluid.java -+++ ../src-work/minecraft/net/minecraft/block/BlockFluid.java -@@ -59,7 +59,7 @@ - { - for (int l1 = -1; l1 <= 1; ++l1) - { -- int i2 = par1IBlockAccess.getBiomeGenForCoords(par2 + l1, par4 + k1).waterColorMultiplier; -+ int i2 = par1IBlockAccess.getBiomeGenForCoords(par2 + l1, par4 + k1).getWaterColorMultiplier(); - l += (i2 & 16711680) >> 16; - i1 += (i2 & 65280) >> 8; - j1 += i2 & 255; -@@ -83,6 +83,13 @@ - return (float)(par0 + 1) / 9.0F; - } - -+ -+ @Deprecated //Implemented here for compatibility, need to change this when we make vanilla fluids use our fluid methods. -+ public float getFilledPercentage(IBlockAccess world, int x, int y, int z) -+ { -+ return 1 - BlockFluid.getFluidHeightPercent(world.getBlockMetadata(x, y, z)); -+ } -+ - @SideOnly(Side.CLIENT) - - /** diff --git a/patches/minecraft/net/minecraft/block/BlockGrass.java.patch b/patches/minecraft/net/minecraft/block/BlockGrass.java.patch index 4ce69db5b..74b705ed7 100644 --- a/patches/minecraft/net/minecraft/block/BlockGrass.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockGrass.java.patch @@ -1,20 +1,45 @@ --- ../src-base/minecraft/net/minecraft/block/BlockGrass.java +++ ../src-work/minecraft/net/minecraft/block/BlockGrass.java -@@ -44,7 +44,7 @@ - { - if (!par1World.isRemote) - { -- if (par1World.getBlockLightValue(par2, par3 + 1, par4) < 4 && Block.lightOpacity[par1World.getBlockId(par2, par3 + 1, par4)] > 2) -+ if (par1World.getBlockLightValue(par2, par3 + 1, par4) < 4 && par1World.getBlockLightOpacity(par2, par3 + 1, par4) > 2) - { - par1World.setBlock(par2, par3, par4, Block.dirt.blockID); - } -@@ -57,7 +57,7 @@ - int k1 = par4 + par5Random.nextInt(3) - 1; - int l1 = par1World.getBlockId(i1, j1 + 1, k1); +@@ -12,6 +12,7 @@ + import net.minecraft.world.ColorizerGrass; + import net.minecraft.world.IBlockAccess; + import net.minecraft.world.World; ++import net.minecraftforge.common.ForgeHooks; + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; -- if (par1World.getBlockId(i1, j1, k1) == Block.dirt.blockID && par1World.getBlockLightValue(i1, j1 + 1, k1) >= 4 && Block.lightOpacity[l1] <= 2) -+ if (par1World.getBlockId(i1, j1, k1) == Block.dirt.blockID && par1World.getBlockLightValue(i1, j1 + 1, k1) >= 4 && par1World.getBlockLightOpacity(i1, j1 + 1, k1) <= 2) +@@ -43,7 +44,7 @@ + { + if (!p_149674_1_.isRemote) + { +- if (p_149674_1_.getBlockLightValue(p_149674_2_, p_149674_3_ + 1, p_149674_4_) < 4 && p_149674_1_.func_147439_a(p_149674_2_, p_149674_3_ + 1, p_149674_4_).func_149717_k() > 2) ++ if (p_149674_1_.getBlockLightValue(p_149674_2_, p_149674_3_ + 1, p_149674_4_) < 4 && p_149674_1_.getBlockLightOpacity(p_149674_2_, p_149674_3_ + 1, p_149674_4_) > 2) + { + p_149674_1_.func_147449_b(p_149674_2_, p_149674_3_, p_149674_4_, Blocks.dirt); + } +@@ -56,7 +57,7 @@ + int k1 = p_149674_4_ + p_149674_5_.nextInt(3) - 1; + Block block = p_149674_1_.func_147439_a(i1, j1 + 1, k1); + +- if (p_149674_1_.func_147439_a(i1, j1, k1) == Blocks.dirt && p_149674_1_.getBlockMetadata(i1, j1, k1) == 0 && p_149674_1_.getBlockLightValue(i1, j1 + 1, k1) >= 4 && block.func_149717_k() <= 2) ++ if (p_149674_1_.func_147439_a(i1, j1, k1) == Blocks.dirt && p_149674_1_.getBlockMetadata(i1, j1, k1) == 0 && p_149674_1_.getBlockLightValue(i1, j1 + 1, k1) >= 4 && p_149674_1_.getBlockLightOpacity(i1, j1 + 1, k1) <= 2) { - par1World.setBlock(i1, j1, k1, Block.grass.blockID); + p_149674_1_.func_147449_b(i1, j1, k1, Blocks.grass); } +@@ -184,15 +185,7 @@ + } + else + { +- String s = p_149853_1_.getBiomeGenForCoords(i1, k1).func_150572_a(p_149853_2_, i1, j1, k1); +- field_149992_a.debug("Flower in " + p_149853_1_.getBiomeGenForCoords(i1, k1).biomeName + ": " + s); +- BlockFlower blockflower = BlockFlower.func_149857_e(s); +- +- if (blockflower != null && blockflower.func_149718_j(p_149853_1_, i1, j1, k1)) +- { +- int i2 = BlockFlower.func_149856_f(s); +- p_149853_1_.func_147465_d(i1, j1, k1, blockflower, i2, 3); +- } ++ ForgeHooks.plantGrass(p_149853_1_, p_149853_2_, i1, j1, k1); + } + } + diff --git a/patches/minecraft/net/minecraft/block/BlockLadder.java.patch b/patches/minecraft/net/minecraft/block/BlockLadder.java.patch index 374ea1450..c7a892903 100644 --- a/patches/minecraft/net/minecraft/block/BlockLadder.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockLadder.java.patch @@ -9,85 +9,84 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -+import net.minecraftforge.common.ForgeDirection; -+import static net.minecraftforge.common.ForgeDirection.*; ++import net.minecraftforge.common.util.ForgeDirection; ++import static net.minecraftforge.common.util.ForgeDirection.*; + public class BlockLadder extends Block { - protected BlockLadder(int par1) -@@ -104,7 +108,10 @@ - */ - public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + private static final String __OBFID = "CL_00000262"; +@@ -79,29 +83,32 @@ + + public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) { -- return par1World.isBlockNormalCube(par2 - 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : par1World.isBlockNormalCube(par2, par3, par4 + 1))); -+ return par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST ) || -+ par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST ) || -+ par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH) || -+ par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH); +- return p_149742_1_.func_147439_a(p_149742_2_ - 1, p_149742_3_, p_149742_4_).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_ + 1, p_149742_3_, p_149742_4_).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_ - 1).func_149721_r() ? true : p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_ + 1).func_149721_r())); ++ return p_149742_1_.isSideSolid(p_149742_2_ - 1, p_149742_3_, p_149742_4_, EAST ) || ++ p_149742_1_.isSideSolid(p_149742_2_ + 1, p_149742_3_, p_149742_4_, WEST ) || ++ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ - 1, SOUTH) || ++ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ + 1, NORTH); } - /** -@@ -114,22 +121,22 @@ + public int func_149660_a(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_) { - int j1 = par9; + int j1 = p_149660_9_; -- if ((par9 == 0 || par5 == 2) && par1World.isBlockNormalCube(par2, par3, par4 + 1)) -+ if ((j1 == 0 || par5 == 2) && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH)) +- if ((p_149660_9_ == 0 || p_149660_5_ == 2) && p_149660_1_.func_147439_a(p_149660_2_, p_149660_3_, p_149660_4_ + 1).func_149721_r()) ++ if ((p_149660_9_ == 0 || p_149660_5_ == 2) && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ + 1, NORTH)) { j1 = 2; } -- if ((j1 == 0 || par5 == 3) && par1World.isBlockNormalCube(par2, par3, par4 - 1)) -+ if ((j1 == 0 || par5 == 3) && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH)) +- if ((j1 == 0 || p_149660_5_ == 3) && p_149660_1_.func_147439_a(p_149660_2_, p_149660_3_, p_149660_4_ - 1).func_149721_r()) ++ if ((j1 == 0 || p_149660_5_ == 3) && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ - 1, SOUTH)) { j1 = 3; } -- if ((j1 == 0 || par5 == 4) && par1World.isBlockNormalCube(par2 + 1, par3, par4)) -+ if ((j1 == 0 || par5 == 4) && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST)) +- if ((j1 == 0 || p_149660_5_ == 4) && p_149660_1_.func_147439_a(p_149660_2_ + 1, p_149660_3_, p_149660_4_).func_149721_r()) ++ if ((j1 == 0 || p_149660_5_ == 4) && p_149660_1_.isSideSolid(p_149660_2_ + 1, p_149660_3_, p_149660_4_, WEST)) { j1 = 4; } -- if ((j1 == 0 || par5 == 5) && par1World.isBlockNormalCube(par2 - 1, par3, par4)) -+ if ((j1 == 0 || par5 == 5) && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST)) +- if ((j1 == 0 || p_149660_5_ == 5) && p_149660_1_.func_147439_a(p_149660_2_ - 1, p_149660_3_, p_149660_4_).func_149721_r()) ++ if ((j1 == 0 || p_149660_5_ == 5) && p_149660_1_.isSideSolid(p_149660_2_ - 1, p_149660_3_, p_149660_4_, EAST)) { j1 = 5; } -@@ -146,22 +153,22 @@ - int i1 = par1World.getBlockMetadata(par2, par3, par4); +@@ -114,22 +121,22 @@ + int l = p_149695_1_.getBlockMetadata(p_149695_2_, p_149695_3_, p_149695_4_); boolean flag = false; -- if (i1 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1)) -+ if (i1 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH)) +- if (l == 2 && p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_, p_149695_4_ + 1).func_149721_r()) ++ if (l == 2 && p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_, p_149695_4_ + 1, NORTH)) { flag = true; } -- if (i1 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1)) -+ if (i1 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH)) +- if (l == 3 && p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_, p_149695_4_ - 1).func_149721_r()) ++ if (l == 3 && p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_, p_149695_4_ - 1, SOUTH)) { flag = true; } -- if (i1 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4)) -+ if (i1 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST)) +- if (l == 4 && p_149695_1_.func_147439_a(p_149695_2_ + 1, p_149695_3_, p_149695_4_).func_149721_r()) ++ if (l == 4 && p_149695_1_.isSideSolid(p_149695_2_ + 1, p_149695_3_, p_149695_4_, WEST)) { flag = true; } -- if (i1 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4)) -+ if (i1 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST)) +- if (l == 5 && p_149695_1_.func_147439_a(p_149695_2_ - 1, p_149695_3_, p_149695_4_).func_149721_r()) ++ if (l == 5 && p_149695_1_.isSideSolid(p_149695_2_ - 1, p_149695_3_, p_149695_4_, EAST)) { flag = true; } -@@ -182,4 +189,10 @@ +@@ -147,4 +154,10 @@ { return 1; } + + @Override -+ public boolean isLadder(World world, int x, int y, int z, EntityLivingBase entity) ++ public boolean isLadder(IBlockAccess world, int x, int y, int z, EntityLivingBase entity) + { + return true; + } diff --git a/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch b/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch index ee66cbc55..cfdc443d8 100644 --- a/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch @@ -1,84 +1,78 @@ --- ../src-base/minecraft/net/minecraft/block/BlockLeaves.java +++ ../src-work/minecraft/net/minecraft/block/BlockLeaves.java -@@ -2,6 +2,8 @@ +@@ -2,6 +2,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -+ +import java.util.ArrayList; - import java.util.List; import java.util.Random; import net.minecraft.block.material.Material; -@@ -16,7 +18,9 @@ + import net.minecraft.creativetab.CreativeTabs; +@@ -15,8 +16,9 @@ + import net.minecraft.world.ColorizerFoliage; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; - --public class BlockLeaves extends BlockLeavesBase +import net.minecraftforge.common.IShearable; -+ -+public class BlockLeaves extends BlockLeavesBase implements IShearable - { - public static final String[] LEAF_TYPES = new String[] {"oak", "spruce", "birch", "jungle"}; - public static final String[][] field_94396_b = new String[][] {{"leaves_oak", "leaves_spruce", "leaves_birch", "leaves_jungle"}, {"leaves_oak_opaque", "leaves_spruce_opaque", "leaves_birch_opaque", "leaves_jungle_opaque"}}; -@@ -111,10 +115,9 @@ - { - int j2 = par1World.getBlockId(par2 + k1, par3 + l1, par4 + i2); -- if (j2 == Block.leaves.blockID) -+ if (Block.blocksList[j2] != null) +-public abstract class BlockLeaves extends BlockLeavesBase ++public abstract class BlockLeaves extends BlockLeavesBase implements IShearable + { + int[] field_150128_a; + @SideOnly(Side.CLIENT) +@@ -82,10 +84,10 @@ + { + for (int l1 = -b0; l1 <= b0; ++l1) + { +- if (p_149749_1_.func_147439_a(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1).func_149688_o() == Material.field_151584_j) ++ Block block = p_149749_1_.func_147439_a(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1); ++ if (block.isLeaves(p_149749_1_, p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1)) { -- int k2 = par1World.getBlockMetadata(par2 + k1, par3 + l1, par4 + i2); -- par1World.setBlockMetadataWithNotify(par2 + k1, par3 + l1, par4 + i2, k2 | 8, 4); -+ Block.blocksList[j2].beginLeavesDecay(par1World, par2 + k1, par3 + l1, par4 + i2); +- int i2 = p_149749_1_.getBlockMetadata(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1); +- p_149749_1_.setBlockMetadataWithNotify(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1, i2 | 8, 4); ++ block.beginLeavesDecay(p_149749_1_, p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1); } } } -@@ -160,11 +163,13 @@ +@@ -127,9 +129,9 @@ { - k2 = par1World.getBlockId(par2 + l1, par3 + i2, par4 + j2); + Block block = p_149674_1_.func_147439_a(p_149674_2_ + l1, p_149674_3_ + i2, p_149674_4_ + j2); -- if (k2 == Block.wood.blockID) -+ Block block = Block.blocksList[k2]; -+ -+ if (block != null && block.canSustainLeaves(par1World, par2 + l1, par3 + i2, par4 + j2)) +- if (block != Blocks.log && block != Blocks.log2) ++ if (!block.canSustainLeaves(p_149674_1_, p_149674_2_ + l1, p_149674_3_ + i2, p_149674_4_ + j2)) { - this.adjacentTreeBlocks[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = 0; - } -- else if (k2 == Block.leaves.blockID) -+ else if (block != null && block.isLeaves(par1World, par2 + l1, par3 + i2, par4 + j2)) - { - this.adjacentTreeBlocks[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2; - } -@@ -329,15 +334,7 @@ - */ - public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) +- if (block.func_149688_o() == Material.field_151584_j) ++ if (block.isLeaves(p_149674_1_, p_149674_2_ + l1, p_149674_3_ + i2, p_149674_4_ + j2)) + { + this.field_150128_a[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2; + } +@@ -281,13 +283,7 @@ + + public void func_149636_a(World p_149636_1_, EntityPlayer p_149636_2_, int p_149636_3_, int p_149636_4_, int p_149636_5_, int p_149636_6_) { -- if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.itemID) -- { -- par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); -- this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(Block.leaves.blockID, 1, par6 & 3)); +- if (!p_149636_1_.isRemote && p_149636_2_.getCurrentEquippedItem() != null && p_149636_2_.getCurrentEquippedItem().getItem() == Items.shears) + { +- p_149636_2_.addStat(StatList.mineBlockStatArray[Block.func_149682_b(this)], 1); +- this.func_149642_a(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, new ItemStack(Item.func_150898_a(this), 1, p_149636_6_ & 3)); - } - else - { -- super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); -- } -+ super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); - } - - /** -@@ -418,4 +415,30 @@ - } + super.func_149636_a(p_149636_1_, p_149636_2_, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_); } } +@@ -318,4 +314,38 @@ + } + + public abstract String[] func_150125_e(); ++ + + @Override -+ public boolean isShearable(ItemStack item, World world, int x, int y, int z) ++ public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z) + { + return true; + } + + @Override -+ public ArrayList onSheared(ItemStack item, World world, int x, int y, int z, int fortune) ++ public ArrayList onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune) + { + ArrayList ret = new ArrayList(); + ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 3)); @@ -88,11 +82,18 @@ + @Override + public void beginLeavesDecay(World world, int x, int y, int z) + { ++ ++ int i2 = world.getBlockMetadata(x, y, z); ++ ++ if ((i2 & 8) == 0) ++ { ++ world.setBlockMetadataWithNotify(x, y, z, i2 | 8, 4); ++ } + world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z) | 8, 4); + } + + @Override -+ public boolean isLeaves(World world, int x, int y, int z) ++ public boolean isLeaves(IBlockAccess world, int x, int y, int z) + { + return true; + } diff --git a/patches/minecraft/net/minecraft/block/BlockLever.java.patch b/patches/minecraft/net/minecraft/block/BlockLever.java.patch index bb54ee524..66da5652b 100644 --- a/patches/minecraft/net/minecraft/block/BlockLever.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockLever.java.patch @@ -4,128 +4,125 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -+import net.minecraftforge.common.ForgeDirection; -+import static net.minecraftforge.common.ForgeDirection.*; ++import net.minecraftforge.common.util.ForgeDirection; ++import static net.minecraftforge.common.util.ForgeDirection.*; + public class BlockLever extends Block { - protected BlockLever(int par1) -@@ -57,7 +60,13 @@ - */ - public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5) + private static final String __OBFID = "CL_00000264"; +@@ -42,12 +45,23 @@ + + public boolean func_149707_d(World p_149707_1_, int p_149707_2_, int p_149707_3_, int p_149707_4_, int p_149707_5_) { -- return par5 == 0 && par1World.isBlockNormalCube(par2, par3 + 1, par4) ? true : (par5 == 1 && par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) ? true : (par5 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1) ? true : (par5 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : (par5 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : par5 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4))))); -+ ForgeDirection dir = ForgeDirection.getOrientation(par5); -+ return (dir == DOWN && par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN )) || -+ (dir == UP && par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP )) || -+ (dir == NORTH && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH)) || -+ (dir == SOUTH && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH)) || -+ (dir == WEST && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST )) || -+ (dir == EAST && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST )); +- return p_149707_5_ == 0 && p_149707_1_.func_147439_a(p_149707_2_, p_149707_3_ + 1, p_149707_4_).func_149721_r() ? true : (p_149707_5_ == 1 && World.func_147466_a(p_149707_1_, p_149707_2_, p_149707_3_ - 1, p_149707_4_) ? true : (p_149707_5_ == 2 && p_149707_1_.func_147439_a(p_149707_2_, p_149707_3_, p_149707_4_ + 1).func_149721_r() ? true : (p_149707_5_ == 3 && p_149707_1_.func_147439_a(p_149707_2_, p_149707_3_, p_149707_4_ - 1).func_149721_r() ? true : (p_149707_5_ == 4 && p_149707_1_.func_147439_a(p_149707_2_ + 1, p_149707_3_, p_149707_4_).func_149721_r() ? true : p_149707_5_ == 5 && p_149707_1_.func_147439_a(p_149707_2_ - 1, p_149707_3_, p_149707_4_).func_149721_r())))); ++ ForgeDirection dir = ForgeDirection.getOrientation(p_149707_5_); ++ return (dir == DOWN && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_ + 1, p_149707_4_, DOWN )) || ++ (dir == UP && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_ - 1, p_149707_4_, UP )) || ++ (dir == NORTH && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_, p_149707_4_ + 1, NORTH)) || ++ (dir == SOUTH && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_, p_149707_4_ - 1, SOUTH)) || ++ (dir == WEST && p_149707_1_.isSideSolid(p_149707_2_ + 1, p_149707_3_, p_149707_4_, WEST )) || ++ (dir == EAST && p_149707_1_.isSideSolid(p_149707_2_ - 1, p_149707_3_, p_149707_4_, EAST )); } - /** -@@ -65,7 +74,12 @@ - */ - public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) { -- return par1World.isBlockNormalCube(par2 - 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : (par1World.isBlockNormalCube(par2, par3, par4 + 1) ? true : (par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) ? true : par1World.isBlockNormalCube(par2, par3 + 1, par4))))); -+ return par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST ) || -+ par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST ) || -+ par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH) || -+ par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH) || -+ par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP ) || -+ par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN ); +- return p_149742_1_.func_147439_a(p_149742_2_ - 1, p_149742_3_, p_149742_4_).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_ + 1, p_149742_3_, p_149742_4_).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_ - 1).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_ + 1).func_149721_r() ? true : (World.func_147466_a(p_149742_1_, p_149742_2_, p_149742_3_ - 1, p_149742_4_) ? true : p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_ + 1, p_149742_4_).func_149721_r())))); ++ return p_149742_1_.isSideSolid(p_149742_2_ - 1, p_149742_3_, p_149742_4_, EAST ) || ++ p_149742_1_.isSideSolid(p_149742_2_ + 1, p_149742_3_, p_149742_4_, WEST ) || ++ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ - 1, SOUTH) || ++ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ + 1, NORTH) || ++ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_ - 1, p_149742_4_, UP ) || ++ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_ + 1, p_149742_4_, DOWN ); } - /** -@@ -77,32 +91,32 @@ - int k1 = par9 & 7; + public int func_149660_a(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_) +@@ -56,32 +70,32 @@ + int j1 = p_149660_9_ & 7; byte b0 = -1; -- if (par5 == 0 && par1World.isBlockNormalCube(par2, par3 + 1, par4)) -+ if (par5 == 0 && par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN)) +- if (p_149660_5_ == 0 && p_149660_1_.func_147439_a(p_149660_2_, p_149660_3_ + 1, p_149660_4_).func_149721_r()) ++ if (p_149660_5_ == 0 && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_ + 1, p_149660_4_, DOWN)) { b0 = 0; } -- if (par5 == 1 && par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4)) -+ if (par5 == 1 && par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP)) +- if (p_149660_5_ == 1 && World.func_147466_a(p_149660_1_, p_149660_2_, p_149660_3_ - 1, p_149660_4_)) ++ if (p_149660_5_ == 1 && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_ - 1, p_149660_4_, UP)) { b0 = 5; } -- if (par5 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1)) -+ if (par5 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH)) +- if (p_149660_5_ == 2 && p_149660_1_.func_147439_a(p_149660_2_, p_149660_3_, p_149660_4_ + 1).func_149721_r()) ++ if (p_149660_5_ == 2 && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ + 1, NORTH)) { b0 = 4; } -- if (par5 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1)) -+ if (par5 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH)) +- if (p_149660_5_ == 3 && p_149660_1_.func_147439_a(p_149660_2_, p_149660_3_, p_149660_4_ - 1).func_149721_r()) ++ if (p_149660_5_ == 3 && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ - 1, SOUTH)) { b0 = 3; } -- if (par5 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4)) -+ if (par5 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST)) +- if (p_149660_5_ == 4 && p_149660_1_.func_147439_a(p_149660_2_ + 1, p_149660_3_, p_149660_4_).func_149721_r()) ++ if (p_149660_5_ == 4 && p_149660_1_.isSideSolid(p_149660_2_ + 1, p_149660_3_, p_149660_4_, WEST)) { b0 = 2; } -- if (par5 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4)) -+ if (par5 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST)) +- if (p_149660_5_ == 5 && p_149660_1_.func_147439_a(p_149660_2_ - 1, p_149660_3_, p_149660_4_).func_149721_r()) ++ if (p_149660_5_ == 5 && p_149660_1_.isSideSolid(p_149660_2_ - 1, p_149660_3_, p_149660_4_, EAST)) { b0 = 1; } -@@ -178,42 +192,42 @@ - int i1 = par1World.getBlockMetadata(par2, par3, par4) & 7; +@@ -147,42 +161,42 @@ + int l = p_149695_1_.getBlockMetadata(p_149695_2_, p_149695_3_, p_149695_4_) & 7; boolean flag = false; -- if (!par1World.isBlockNormalCube(par2 - 1, par3, par4) && i1 == 1) -+ if (!par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST) && i1 == 1) +- if (!p_149695_1_.func_147439_a(p_149695_2_ - 1, p_149695_3_, p_149695_4_).func_149721_r() && l == 1) ++ if (!p_149695_1_.isSideSolid(p_149695_2_ - 1, p_149695_3_, p_149695_4_, EAST) && l == 1) { flag = true; } -- if (!par1World.isBlockNormalCube(par2 + 1, par3, par4) && i1 == 2) -+ if (!par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST) && i1 == 2) +- if (!p_149695_1_.func_147439_a(p_149695_2_ + 1, p_149695_3_, p_149695_4_).func_149721_r() && l == 2) ++ if (!p_149695_1_.isSideSolid(p_149695_2_ + 1, p_149695_3_, p_149695_4_, WEST) && l == 2) { flag = true; } -- if (!par1World.isBlockNormalCube(par2, par3, par4 - 1) && i1 == 3) -+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH) && i1 == 3) +- if (!p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_, p_149695_4_ - 1).func_149721_r() && l == 3) ++ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_, p_149695_4_ - 1, SOUTH) && l == 3) { flag = true; } -- if (!par1World.isBlockNormalCube(par2, par3, par4 + 1) && i1 == 4) -+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH) && i1 == 4) +- if (!p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_, p_149695_4_ + 1).func_149721_r() && l == 4) ++ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_, p_149695_4_ + 1, NORTH) && l == 4) { flag = true; } -- if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && i1 == 5) -+ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP) && i1 == 5) +- if (!World.func_147466_a(p_149695_1_, p_149695_2_, p_149695_3_ - 1, p_149695_4_) && l == 5) ++ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_ - 1, p_149695_4_, UP) && l == 5) { flag = true; } -- if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && i1 == 6) -+ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP) && i1 == 6) +- if (!World.func_147466_a(p_149695_1_, p_149695_2_, p_149695_3_ - 1, p_149695_4_) && l == 6) ++ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_ - 1, p_149695_4_, UP) && l == 6) { flag = true; } -- if (!par1World.isBlockNormalCube(par2, par3 + 1, par4) && i1 == 0) -+ if (!par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN) && i1 == 0) +- if (!p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_ + 1, p_149695_4_).func_149721_r() && l == 0) ++ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_ + 1, p_149695_4_, DOWN) && l == 0) { flag = true; } -- if (!par1World.isBlockNormalCube(par2, par3 + 1, par4) && i1 == 7) -+ if (!par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN) && i1 == 7) +- if (!p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_ + 1, p_149695_4_).func_149721_r() && l == 7) ++ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_ + 1, p_149695_4_, DOWN) && l == 7) { flag = true; } diff --git a/patches/minecraft/net/minecraft/block/BlockLiquid.java.patch b/patches/minecraft/net/minecraft/block/BlockLiquid.java.patch new file mode 100644 index 000000000..617a5b12a --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockLiquid.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockLiquid.java ++++ ../src-work/minecraft/net/minecraft/block/BlockLiquid.java +@@ -67,7 +67,7 @@ + { + for (int l1 = -1; l1 <= 1; ++l1) + { +- int i2 = p_149720_1_.getBiomeGenForCoords(p_149720_2_ + l1, p_149720_4_ + k1).waterColorMultiplier; ++ int i2 = p_149720_1_.getBiomeGenForCoords(p_149720_2_ + l1, p_149720_4_ + k1).getWaterColorMultiplier(); + l += (i2 & 16711680) >> 16; + i1 += (i2 & 65280) >> 8; + j1 += i2 & 255; diff --git a/patches/minecraft/net/minecraft/block/BlockLog.java.patch b/patches/minecraft/net/minecraft/block/BlockLog.java.patch index c42f76120..4fcb9497a 100644 --- a/patches/minecraft/net/minecraft/block/BlockLog.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockLog.java.patch @@ -1,35 +1,44 @@ --- ../src-base/minecraft/net/minecraft/block/BlockLog.java +++ ../src-work/minecraft/net/minecraft/block/BlockLog.java -@@ -62,14 +62,9 @@ - { - int j2 = par1World.getBlockId(par2 + k1, par3 + l1, par4 + i2); +@@ -7,6 +7,7 @@ + import net.minecraft.creativetab.CreativeTabs; + import net.minecraft.item.Item; + import net.minecraft.util.IIcon; ++import net.minecraft.world.IBlockAccess; + import net.minecraft.world.World; -- if (j2 == Block.leaves.blockID) -+ if (Block.blocksList[j2] != null) + public abstract class BlockLog extends BlockRotatedPillar +@@ -53,14 +54,10 @@ + { + for (int l1 = -b0; l1 <= b0; ++l1) + { +- if (p_149749_1_.func_147439_a(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1).func_149688_o() == Material.field_151584_j) ++ Block block = p_149749_1_.func_147439_a(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1); ++ if (block.isLeaves(p_149749_1_, p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1)) { -- int k2 = par1World.getBlockMetadata(par2 + k1, par3 + l1, par4 + i2); +- int i2 = p_149749_1_.getBlockMetadata(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1); - -- if ((k2 & 8) == 0) +- if ((i2 & 8) == 0) - { -- par1World.setBlockMetadataWithNotify(par2 + k1, par3 + l1, par4 + i2, k2 | 8, 4); +- p_149749_1_.setBlockMetadataWithNotify(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1, i2 | 8, 4); - } -+ Block.blocksList[j2].beginLeavesDecay(par1World, par2 + k1, par3 + l1, par4 + i2); ++ block.beginLeavesDecay(p_149749_1_, p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1); } } } -@@ -135,4 +130,16 @@ - this.tree_top[i] = par1IconRegister.registerIcon(this.getTextureName() + "_" + woodType[i] + "_top"); - } +@@ -79,4 +76,16 @@ + { + return this.field_150166_b[p_150161_1_ % this.field_150166_b.length]; } + + @Override -+ public boolean canSustainLeaves(World world, int x, int y, int z) ++ public boolean canSustainLeaves(IBlockAccess world, int x, int y, int z) + { + return true; + } + + @Override -+ public boolean isWood(World world, int x, int y, int z) ++ public boolean isWood(IBlockAccess world, int x, int y, int z) + { + return true; + } diff --git a/patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch b/patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch index 284ad7b45..aaed558ab 100644 --- a/patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch @@ -1,18 +1,28 @@ --- ../src-base/minecraft/net/minecraft/block/BlockMobSpawner.java +++ ../src-work/minecraft/net/minecraft/block/BlockMobSpawner.java -@@ -45,9 +45,13 @@ - public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) - { - super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, par7); -- int j1 = 15 + par1World.rand.nextInt(15) + par1World.rand.nextInt(15); -- this.dropXpOnBlockBreak(par1World, par2, par3, par4, j1); - } -+ -+ @Override -+ public int getExpDrop(World world, int data, int enchantmentLevel) -+ { -+ return 15 + world.rand.nextInt(15) + world.rand.nextInt(15); -+ } +@@ -7,6 +7,7 @@ + import net.minecraft.item.Item; + import net.minecraft.tileentity.TileEntity; + import net.minecraft.tileentity.TileEntityMobSpawner; ++import net.minecraft.world.IBlockAccess; + import net.minecraft.world.World; - /** - * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + public class BlockMobSpawner extends BlockContainer +@@ -36,10 +37,15 @@ + public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_) + { + super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, p_149690_7_); +- int j1 = 15 + p_149690_1_.rand.nextInt(15) + p_149690_1_.rand.nextInt(15); +- this.func_149657_c(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, j1); + } + ++ private Random rand = new Random(); ++ @Override ++ public int getExpDrop(IBlockAccess world, int metadata, int fortune) ++ { ++ return 15 + rand.nextInt(15) + rand.nextInt(15); ++ } ++ + public boolean func_149662_c() + { + return false; diff --git a/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch b/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch index 00928c9b5..a2f893272 100644 --- a/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch @@ -1,22 +1,19 @@ --- ../src-base/minecraft/net/minecraft/block/BlockMushroom.java +++ ../src-work/minecraft/net/minecraft/block/BlockMushroom.java -@@ -4,6 +4,8 @@ +@@ -4,6 +4,7 @@ + import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenBigMushroom; ++import net.minecraftforge.common.util.ForgeDirection; -+import net.minecraftforge.common.ForgeDirection; -+ - public class BlockMushroom extends BlockFlower + public class BlockMushroom extends BlockBush implements IGrowable { - protected BlockMushroom(int par1) -@@ -96,7 +98,9 @@ - if (par3 >= 0 && par3 < 256) +@@ -85,7 +86,7 @@ + if (p_149718_3_ >= 0 && p_149718_3_ < 256) { - int l = par1World.getBlockId(par2, par3 - 1, par4); -- return l == Block.mycelium.blockID || par1World.getFullBlockLightValue(par2, par3, par4) < 13 && this.canThisPlantGrowOnThisBlockID(l); -+ Block soil = Block.blocksList[l]; -+ return (l == Block.mycelium.blockID || par1World.getFullBlockLightValue(par2, par3, par4) < 13) && -+ (soil != null && soil.canSustainPlant(par1World, par2, par3 - 1, par4, ForgeDirection.UP, this)); + Block block = p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_ - 1, p_149718_4_); +- return block == Blocks.mycelium || block == Blocks.dirt && p_149718_1_.getBlockMetadata(p_149718_2_, p_149718_3_ - 1, p_149718_4_) == 2 || p_149718_1_.getFullBlockLightValue(p_149718_2_, p_149718_3_, p_149718_4_) < 13 && this.func_149854_a(block); ++ return block == Blocks.mycelium || block == Blocks.dirt && p_149718_1_.getBlockMetadata(p_149718_2_, p_149718_3_ - 1, p_149718_4_) == 2 || p_149718_1_.getFullBlockLightValue(p_149718_2_, p_149718_3_, p_149718_4_) < 13 && block.canSustainPlant(p_149718_1_, p_149718_2_, p_149718_3_ - 1, p_149718_4_, ForgeDirection.UP, this); } else { diff --git a/patches/minecraft/net/minecraft/block/BlockMycelium.java.patch b/patches/minecraft/net/minecraft/block/BlockMycelium.java.patch index 253912a33..5f1559f17 100644 --- a/patches/minecraft/net/minecraft/block/BlockMycelium.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockMycelium.java.patch @@ -1,20 +1,20 @@ --- ../src-base/minecraft/net/minecraft/block/BlockMycelium.java +++ ../src-work/minecraft/net/minecraft/block/BlockMycelium.java -@@ -41,7 +41,7 @@ +@@ -37,7 +37,7 @@ { - if (!par1World.isRemote) + if (!p_149674_1_.isRemote) { -- if (par1World.getBlockLightValue(par2, par3 + 1, par4) < 4 && Block.lightOpacity[par1World.getBlockId(par2, par3 + 1, par4)] > 2) -+ if (par1World.getBlockLightValue(par2, par3 + 1, par4) < 4 && par1World.getBlockLightOpacity(par2, par3 + 1, par4) > 2) +- if (p_149674_1_.getBlockLightValue(p_149674_2_, p_149674_3_ + 1, p_149674_4_) < 4 && p_149674_1_.func_147439_a(p_149674_2_, p_149674_3_ + 1, p_149674_4_).func_149717_k() > 2) ++ if (p_149674_1_.getBlockLightValue(p_149674_2_, p_149674_3_ + 1, p_149674_4_) < 4 && p_149674_1_.getBlockLightOpacity(p_149674_2_, p_149674_3_ + 1, p_149674_4_) > 2) { - par1World.setBlock(par2, par3, par4, Block.dirt.blockID); + p_149674_1_.func_147449_b(p_149674_2_, p_149674_3_, p_149674_4_, Blocks.dirt); } -@@ -54,7 +54,7 @@ - int k1 = par4 + par5Random.nextInt(3) - 1; - int l1 = par1World.getBlockId(i1, j1 + 1, k1); +@@ -50,7 +50,7 @@ + int k1 = p_149674_4_ + p_149674_5_.nextInt(3) - 1; + Block block = p_149674_1_.func_147439_a(i1, j1 + 1, k1); -- if (par1World.getBlockId(i1, j1, k1) == Block.dirt.blockID && par1World.getBlockLightValue(i1, j1 + 1, k1) >= 4 && Block.lightOpacity[l1] <= 2) -+ if (par1World.getBlockId(i1, j1, k1) == Block.dirt.blockID && par1World.getBlockLightValue(i1, j1 + 1, k1) >= 4 && par1World.getBlockLightOpacity(i1, j1 + 1, k1) <= 2) +- if (p_149674_1_.func_147439_a(i1, j1, k1) == Blocks.dirt && p_149674_1_.getBlockMetadata(i1, j1, k1) == 0 && p_149674_1_.getBlockLightValue(i1, j1 + 1, k1) >= 4 && block.func_149717_k() <= 2) ++ if (p_149674_1_.func_147439_a(i1, j1, k1) == Blocks.dirt && p_149674_1_.getBlockMetadata(i1, j1, k1) == 0 && p_149674_1_.getBlockLightValue(i1, j1 + 1, k1) >= 4 && p_149674_1_.getBlockLightOpacity(i1, j1 + 1, k1) <= 2) { - par1World.setBlock(i1, j1, k1, this.blockID); + p_149674_1_.func_147449_b(i1, j1, k1, this); } diff --git a/patches/minecraft/net/minecraft/block/BlockNetherStalk.java.patch b/patches/minecraft/net/minecraft/block/BlockNetherStalk.java.patch deleted file mode 100644 index c5cf5a164..000000000 --- a/patches/minecraft/net/minecraft/block/BlockNetherStalk.java.patch +++ /dev/null @@ -1,80 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockNetherStalk.java -+++ ../src-work/minecraft/net/minecraft/block/BlockNetherStalk.java -@@ -2,6 +2,8 @@ - - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; -+ -+import java.util.ArrayList; - import java.util.Random; - import net.minecraft.client.renderer.texture.IconRegister; - import net.minecraft.creativetab.CreativeTabs; -@@ -9,6 +11,7 @@ - import net.minecraft.item.ItemStack; - import net.minecraft.util.Icon; - import net.minecraft.world.World; -+import net.minecraftforge.common.ForgeDirection; - - public class BlockNetherStalk extends BlockFlower - { -@@ -38,7 +41,8 @@ - */ - public boolean canBlockStay(World par1World, int par2, int par3, int par4) - { -- return this.canThisPlantGrowOnThisBlockID(par1World.getBlockId(par2, par3 - 1, par4)); -+ Block block = Block.blocksList[par1World.getBlockId(par2, par3 - 1, par4)]; -+ return (block != null && block.canSustainPlant(par1World, par2, par3 - 1, par4, ForgeDirection.UP, this)); - } - - /** -@@ -80,25 +84,7 @@ - */ - public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) - { -- if (!par1World.isRemote) -- { -- int j1 = 1; -- -- if (par5 >= 3) -- { -- j1 = 2 + par1World.rand.nextInt(3); -- -- if (par7 > 0) -- { -- j1 += par1World.rand.nextInt(par7 + 1); -- } -- } -- -- for (int k1 = 0; k1 < j1; ++k1) -- { -- this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(Item.netherStalkSeeds)); -- } -- } -+ super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, par7); - } - - /** -@@ -142,4 +128,23 @@ - this.iconArray[i] = par1IconRegister.registerIcon(this.getTextureName() + "_stage_" + i); - } - } -+ -+ @Override -+ public ArrayList getBlockDropped(World world, int x, int y, int z, int metadata, int fortune) -+ { -+ ArrayList ret = new ArrayList(); -+ int count = 1; -+ -+ if (metadata >= 3) -+ { -+ count = 2 + world.rand.nextInt(3) + (fortune > 0 ? world.rand.nextInt(fortune + 1) : 0); -+ } -+ -+ for (int i = 0; i < count; i++) -+ { -+ ret.add(new ItemStack(Item.netherStalkSeeds)); -+ } -+ -+ return ret; -+ } - } 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 000000000..6fe1cb8f3 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockNetherWart.java.patch @@ -0,0 +1,68 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockNetherWart.java ++++ ../src-work/minecraft/net/minecraft/block/BlockNetherWart.java +@@ -2,6 +2,7 @@ + + import cpw.mods.fml.relauncher.Side; + import cpw.mods.fml.relauncher.SideOnly; ++import java.util.ArrayList; + import java.util.Random; + import net.minecraft.client.renderer.texture.IIconRegister; + import net.minecraft.creativetab.CreativeTabs; +@@ -11,6 +12,7 @@ + import net.minecraft.item.ItemStack; + import net.minecraft.util.IIcon; + import net.minecraft.world.World; ++import net.minecraftforge.common.util.ForgeDirection; + + public class BlockNetherWart extends BlockBush + { +@@ -33,7 +35,7 @@ + + public boolean func_149718_j(World p_149718_1_, int p_149718_2_, int p_149718_3_, int p_149718_4_) + { +- return this.func_149854_a(p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_ - 1, p_149718_4_)); ++ return super.func_149718_j(p_149718_1_, p_149718_2_, p_149718_3_, p_149718_4_); + } + + public void func_149674_a(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_) +@@ -62,6 +64,8 @@ + + public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_) + { ++ super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, p_149690_7_); ++ /* + if (!p_149690_1_.isRemote) + { + int j1 = 1; +@@ -81,6 +85,7 @@ + this.func_149642_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, new ItemStack(Items.nether_wart)); + } + } ++ */ + } + + public Item func_149650_a(int p_149650_1_, Random p_149650_2_, int p_149650_3_) +@@ -109,4 +114,23 @@ + this.field_149883_a[i] = p_149651_1_.registerIcon(this.func_149641_N() + "_stage_" + i); + } + } ++ ++ @Override ++ public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) ++ { ++ ArrayList ret = new ArrayList(); ++ int count = 1; ++ ++ if (metadata >= 3) ++ { ++ count = 2 + world.rand.nextInt(3) + (fortune > 0 ? world.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/BlockOre.java.patch b/patches/minecraft/net/minecraft/block/BlockOre.java.patch index 88432eeb7..c61ae24c3 100644 --- a/patches/minecraft/net/minecraft/block/BlockOre.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockOre.java.patch @@ -1,27 +1,58 @@ --- ../src-base/minecraft/net/minecraft/block/BlockOre.java +++ ../src-work/minecraft/net/minecraft/block/BlockOre.java -@@ -60,6 +60,11 @@ - { - super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, par7); +@@ -7,6 +7,7 @@ + import net.minecraft.init.Items; + import net.minecraft.item.Item; + import net.minecraft.util.MathHelper; ++import net.minecraft.world.IBlockAccess; + import net.minecraft.world.World; + public class BlockOre extends Block +@@ -51,34 +52,40 @@ + public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_) + { + super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, p_149690_7_); + } -+ + +- if (this.func_149650_a(p_149690_5_, p_149690_1_.rand, p_149690_7_) != Item.func_150898_a(this)) ++ private Random rand = new Random(); + @Override -+ public int getExpDrop(World par1World, int par5, int par7) ++ public int getExpDrop(IBlockAccess p_149690_1_, int p_149690_5_, int p_149690_7_) + { - if (this.idDropped(par5, par1World.rand, par7) != this.blockID) ++ if (this.func_149650_a(p_149690_5_, rand, p_149690_7_) != Item.func_150898_a(this)) { int j1 = 0; -@@ -84,9 +89,10 @@ + + if (this == Blocks.coal_ore) { - j1 = MathHelper.getRandomIntegerInRange(par1World.rand, 2, 5); +- j1 = MathHelper.getRandomIntegerInRange(p_149690_1_.rand, 0, 2); ++ j1 = MathHelper.getRandomIntegerInRange(rand, 0, 2); } -- -- this.dropXpOnBlockBreak(par1World, par2, par3, par4, j1); + else if (this == Blocks.diamond_ore) + { +- j1 = MathHelper.getRandomIntegerInRange(p_149690_1_.rand, 3, 7); ++ j1 = MathHelper.getRandomIntegerInRange(rand, 3, 7); + } + else if (this == Blocks.emerald_ore) + { +- j1 = MathHelper.getRandomIntegerInRange(p_149690_1_.rand, 3, 7); ++ j1 = MathHelper.getRandomIntegerInRange(rand, 3, 7); + } + else if (this == Blocks.lapis_ore) + { +- j1 = MathHelper.getRandomIntegerInRange(p_149690_1_.rand, 2, 5); ++ j1 = MathHelper.getRandomIntegerInRange(rand, 2, 5); + } + else if (this == Blocks.quartz_ore) + { +- j1 = MathHelper.getRandomIntegerInRange(p_149690_1_.rand, 2, 5); ++ j1 = MathHelper.getRandomIntegerInRange(rand, 2, 5); + } + +- this.func_149657_c(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, j1); + return j1; } -+ + return 0; } - /** + public int func_149692_a(int p_149692_1_) diff --git a/patches/minecraft/net/minecraft/block/BlockPane.java.patch b/patches/minecraft/net/minecraft/block/BlockPane.java.patch index 4018305a9..7f4f37247 100644 --- a/patches/minecraft/net/minecraft/block/BlockPane.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockPane.java.patch @@ -1,51 +1,52 @@ --- ../src-base/minecraft/net/minecraft/block/BlockPane.java +++ ../src-work/minecraft/net/minecraft/block/BlockPane.java -@@ -13,6 +13,7 @@ - import net.minecraft.util.Icon; +@@ -15,6 +15,8 @@ + import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -+import net.minecraftforge.common.ForgeDirection; ++import net.minecraftforge.common.util.ForgeDirection; ++import static net.minecraftforge.common.util.ForgeDirection.*; public class BlockPane extends Block { -@@ -90,10 +91,10 @@ - */ - public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) +@@ -62,10 +64,10 @@ + + public void func_149743_a(World p_149743_1_, int p_149743_2_, int p_149743_3_, int p_149743_4_, AxisAlignedBB p_149743_5_, List p_149743_6_, Entity p_149743_7_) { -- boolean flag = this.canThisPaneConnectToThisBlockID(par1World.getBlockId(par2, par3, par4 - 1)); -- boolean flag1 = this.canThisPaneConnectToThisBlockID(par1World.getBlockId(par2, par3, par4 + 1)); -- boolean flag2 = this.canThisPaneConnectToThisBlockID(par1World.getBlockId(par2 - 1, par3, par4)); -- boolean flag3 = this.canThisPaneConnectToThisBlockID(par1World.getBlockId(par2 + 1, par3, par4)); -+ boolean flag = this.canPaneConnectTo(par1World,par2, par3, par4,ForgeDirection.NORTH); -+ boolean flag1 = this.canPaneConnectTo(par1World,par2, par3, par4,ForgeDirection.SOUTH); -+ boolean flag2 = this.canPaneConnectTo(par1World,par2, par3, par4,ForgeDirection.WEST); -+ boolean flag3 = this.canPaneConnectTo(par1World,par2, par3, par4,ForgeDirection.EAST); +- boolean flag = this.func_150098_a(p_149743_1_.func_147439_a(p_149743_2_, p_149743_3_, p_149743_4_ - 1)); +- boolean flag1 = this.func_150098_a(p_149743_1_.func_147439_a(p_149743_2_, p_149743_3_, p_149743_4_ + 1)); +- boolean flag2 = this.func_150098_a(p_149743_1_.func_147439_a(p_149743_2_ - 1, p_149743_3_, p_149743_4_)); +- boolean flag3 = this.func_150098_a(p_149743_1_.func_147439_a(p_149743_2_ + 1, p_149743_3_, p_149743_4_)); ++ boolean flag = this.canPaneConnectTo(p_149743_1_, p_149743_2_, p_149743_3_, p_149743_4_ - 1, NORTH); ++ boolean flag1 = this.canPaneConnectTo(p_149743_1_, p_149743_2_, p_149743_3_, p_149743_4_ + 1, SOUTH); ++ boolean flag2 = this.canPaneConnectTo(p_149743_1_, p_149743_2_ - 1, p_149743_3_, p_149743_4_, WEST ); ++ boolean flag3 = this.canPaneConnectTo(p_149743_1_, p_149743_2_ + 1, p_149743_3_, p_149743_4_, EAST ); if ((!flag2 || !flag3) && (flag2 || flag3 || flag || flag1)) { -@@ -151,10 +152,10 @@ +@@ -117,10 +119,10 @@ float f1 = 0.5625F; float f2 = 0.4375F; float f3 = 0.5625F; -- boolean flag = this.canThisPaneConnectToThisBlockID(par1IBlockAccess.getBlockId(par2, par3, par4 - 1)); -- boolean flag1 = this.canThisPaneConnectToThisBlockID(par1IBlockAccess.getBlockId(par2, par3, par4 + 1)); -- boolean flag2 = this.canThisPaneConnectToThisBlockID(par1IBlockAccess.getBlockId(par2 - 1, par3, par4)); -- boolean flag3 = this.canThisPaneConnectToThisBlockID(par1IBlockAccess.getBlockId(par2 + 1, par3, par4)); -+ boolean flag = this.canPaneConnectTo(par1IBlockAccess,par2, par3, par4,ForgeDirection.NORTH); -+ boolean flag1 = this.canPaneConnectTo(par1IBlockAccess,par2, par3, par4,ForgeDirection.SOUTH); -+ boolean flag2 = this.canPaneConnectTo(par1IBlockAccess,par2, par3, par4,ForgeDirection.WEST); -+ boolean flag3 = this.canPaneConnectTo(par1IBlockAccess,par2, par3, par4,ForgeDirection.EAST); +- boolean flag = this.func_150098_a(p_149719_1_.func_147439_a(p_149719_2_, p_149719_3_, p_149719_4_ - 1)); +- boolean flag1 = this.func_150098_a(p_149719_1_.func_147439_a(p_149719_2_, p_149719_3_, p_149719_4_ + 1)); +- boolean flag2 = this.func_150098_a(p_149719_1_.func_147439_a(p_149719_2_ - 1, p_149719_3_, p_149719_4_)); +- boolean flag3 = this.func_150098_a(p_149719_1_.func_147439_a(p_149719_2_ + 1, p_149719_3_, p_149719_4_)); ++ boolean flag = this.canPaneConnectTo(p_149719_1_, p_149719_2_, p_149719_3_, p_149719_4_ - 1, NORTH); ++ boolean flag1 = this.canPaneConnectTo(p_149719_1_, p_149719_2_, p_149719_3_, p_149719_4_ + 1, SOUTH); ++ boolean flag2 = this.canPaneConnectTo(p_149719_1_, p_149719_2_ - 1, p_149719_3_, p_149719_4_, WEST ); ++ boolean flag3 = this.canPaneConnectTo(p_149719_1_, p_149719_2_ + 1, p_149719_3_, p_149719_4_, EAST ); if ((!flag2 || !flag3) && (flag2 || flag3 || flag || flag1)) { -@@ -240,4 +241,10 @@ - this.blockIcon = par1IconRegister.registerIcon(this.field_94402_c); - this.theIcon = par1IconRegister.registerIcon(this.sideTextureIndex); +@@ -186,4 +188,10 @@ + this.field_149761_L = p_149651_1_.registerIcon(this.field_150101_M); + this.field_150102_N = p_149651_1_.registerIcon(this.field_150100_a); } + -+ // FORGE START -+ public boolean canPaneConnectTo(IBlockAccess access, int x, int y, int z, ForgeDirection dir) ++ public boolean canPaneConnectTo(IBlockAccess world, int x, int y, int z, ForgeDirection dir) + { -+ return canThisPaneConnectToThisBlockID(access.getBlockId(x+dir.offsetX, y+dir.offsetY, z+dir.offsetZ)) || access.isBlockSolidOnSide(x+dir.offsetX, y+dir.offsetY, z+dir.offsetZ, dir.getOpposite(), false); ++ return func_150098_a(world.func_147439_a(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ)) || ++ world.isSideSolid(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir.getOpposite(), false); + } } diff --git a/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch b/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch index 42f0bb457..458395a7d 100644 --- a/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch @@ -1,56 +1,65 @@ --- ../src-base/minecraft/net/minecraft/block/BlockPistonBase.java +++ ../src-work/minecraft/net/minecraft/block/BlockPistonBase.java -@@ -439,7 +439,7 @@ +@@ -11,6 +11,7 @@ + import net.minecraft.entity.player.EntityPlayer; + import net.minecraft.init.Blocks; + import net.minecraft.item.ItemStack; ++import net.minecraft.server.management.PlayerManager; + import net.minecraft.tileentity.TileEntity; + import net.minecraft.tileentity.TileEntityPiston; + import net.minecraft.util.AxisAlignedBB; +@@ -360,7 +361,8 @@ return false; } -- return !(Block.blocksList[par0] instanceof ITileEntityProvider); -+ return !par1World.blockHasTileEntity(par2, par3, par4); +- return !(p_150080_0_ instanceof ITileEntityProvider); ++ return !(p_150080_1_.func_147439_a(p_150080_2_, p_150080_3_, p_150080_4_).hasTileEntity(p_150080_1_.getBlockMetadata(p_150080_2_, p_150080_3_, p_150080_4_))); ++ } } -@@ -457,14 +457,14 @@ +@@ -375,14 +377,14 @@ { if (l1 < 13) { - if (j1 <= 0 || j1 >= 255) -+ if (j1 <= 0 || j1 >= par0World.getHeight() - 1) ++ if (j1 <= 0 || j1 >= p_150077_0_.getHeight()) { return false; } - int i2 = par0World.getBlockId(i1, j1, k1); + Block block = p_150077_0_.func_147439_a(i1, j1, k1); -- if (i2 != 0) -+ if (!par0World.isAirBlock(i1, j1, k1)) +- if (block.func_149688_o() != Material.field_151579_a) ++ if (block.isAir(p_150077_0_, i1, j1, k1)) { - if (!canPushBlock(i2, par0World, i1, j1, k1, true)) + if (!func_150080_a(block, p_150077_0_, i1, j1, k1, true)) { -@@ -507,14 +507,14 @@ - +@@ -420,14 +422,14 @@ + { if (l1 < 13) { - if (j1 <= 0 || j1 >= 255) -+ if (j1 <= 0 || j1 >= par1World.getHeight() - 1) ++ if (j1 <= 0 || j1 >= p_150079_1_.getHeight()) { return false; } - i2 = par1World.getBlockId(i1, j1, k1); + Block block = p_150079_1_.func_147439_a(i1, j1, k1); -- if (i2 != 0) -+ if (!par1World.isAirBlock(i1, j1, k1)) +- if (block.func_149688_o() != Material.field_151579_a) ++ if (block.isAir(p_150079_1_, i1, j1, k1)) { - if (!canPushBlock(i2, par1World, i1, j1, k1, true)) + if (!func_150080_a(block, p_150079_1_, i1, j1, k1, true)) { -@@ -535,7 +535,9 @@ +@@ -448,7 +450,9 @@ continue; } -- Block.blocksList[i2].dropBlockAsItem(par1World, i1, j1, k1, par1World.getBlockMetadata(i1, j1, k1), 0); +- block.func_149697_b(p_150079_1_, i1, j1, k1, p_150079_1_.getBlockMetadata(i1, j1, k1), 0); + //With our change to how snowballs are dropped this needs to disallow to mimic vanilla behavior. -+ float chance = (Block.blocksList[i2] instanceof BlockSnow ? -1.0f : 1.0f); -+ Block.blocksList[i2].dropBlockAsItemWithChance(par1World, i1, j1, k1, par1World.getBlockMetadata(i1, j1, k1), chance, 0); - par1World.setBlockToAir(i1, j1, k1); ++ float chance = block instanceof BlockSnow ? -1.0f : 1.0f; ++ block.func_149690_a(p_150079_1_, i1, j1, k1, p_150079_1_.getBlockMetadata(i1, j1, k1), chance, 0); + p_150079_1_.func_147468_f(i1, j1, k1); } } diff --git a/patches/minecraft/net/minecraft/block/BlockPortal.java.patch b/patches/minecraft/net/minecraft/block/BlockPortal.java.patch deleted file mode 100644 index 810e69653..000000000 --- a/patches/minecraft/net/minecraft/block/BlockPortal.java.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockPortal.java -+++ ../src-work/minecraft/net/minecraft/block/BlockPortal.java -@@ -118,7 +118,7 @@ - } - else - { -- if (par1World.getBlockId(par2 - b0, par3, par4 - b1) == 0) -+ if (par1World.isAirBlock(par2 - b0, par3, par4 - b1)) - { - par2 -= b0; - par4 -= b1; -@@ -136,6 +136,7 @@ - if (l != -1 && l != 2 || i1 != -1 && i1 != 3) - { - int j1 = par1World.getBlockId(par2 + b0 * l, par3 + i1, par4 + b1 * l); -+ boolean isAirBlock = par1World.isAirBlock(par2 + b0 * l, par3 + i1, par4 + b1 * l); - - if (flag) - { -@@ -144,7 +145,7 @@ - return false; - } - } -- else if (j1 != 0 && j1 != Block.fire.blockID) -+ else if (!isAirBlock && j1 != Block.fire.blockID) - { - return false; - } diff --git a/patches/minecraft/net/minecraft/block/BlockPumpkin.java.patch b/patches/minecraft/net/minecraft/block/BlockPumpkin.java.patch index d45d46b90..8d652a060 100644 --- a/patches/minecraft/net/minecraft/block/BlockPumpkin.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockPumpkin.java.patch @@ -1,12 +1,11 @@ --- ../src-base/minecraft/net/minecraft/block/BlockPumpkin.java +++ ../src-work/minecraft/net/minecraft/block/BlockPumpkin.java -@@ -123,7 +123,8 @@ - public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) +@@ -113,7 +113,7 @@ + + public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) { - int l = par1World.getBlockId(par2, par3, par4); -- return (l == 0 || Block.blocksList[l].blockMaterial.isReplaceable()) && par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4); -+ Block block = Block.blocksList[l]; -+ return (block == null || block.isBlockReplaceable(par1World, par2, par3, par4)) && par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4); +- return p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_).field_149764_J.isReplaceable() && World.func_147466_a(p_149742_1_, p_149742_2_, p_149742_3_ - 1, p_149742_4_); ++ return p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_).isReplaceable(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_) && World.func_147466_a(p_149742_1_, p_149742_2_, p_149742_3_ - 1, p_149742_4_); } - /** + public void func_149689_a(World p_149689_1_, int p_149689_2_, int p_149689_3_, int p_149689_4_, EntityLivingBase p_149689_5_, ItemStack p_149689_6_) diff --git a/patches/minecraft/net/minecraft/block/BlockRailBase.java.patch b/patches/minecraft/net/minecraft/block/BlockRailBase.java.patch index 0be618f58..d7b071a23 100644 --- a/patches/minecraft/net/minecraft/block/BlockRailBase.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockRailBase.java.patch @@ -1,37 +1,37 @@ --- ../src-base/minecraft/net/minecraft/block/BlockRailBase.java +++ ../src-work/minecraft/net/minecraft/block/BlockRailBase.java -@@ -3,6 +3,7 @@ +@@ -5,6 +5,7 @@ import java.util.Random; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.item.EntityMinecart; + import net.minecraft.init.Blocks; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.MovingObjectPosition; - import net.minecraft.util.Vec3; -@@ -28,7 +29,7 @@ - */ - public static final boolean isRailBlock(int par0) +@@ -25,7 +26,7 @@ + + public static final boolean func_150051_a(Block p_150051_0_) { -- return par0 == Block.rail.blockID || par0 == Block.railPowered.blockID || par0 == Block.railDetector.blockID || par0 == Block.railActivator.blockID; -+ return Block.blocksList[par0] instanceof BlockRailBase; +- return p_150051_0_ == Blocks.rail || p_150051_0_ == Blocks.golden_rail || p_150051_0_ == Blocks.detector_rail || p_150051_0_ == Blocks.activator_rail; ++ return p_150051_0_ instanceof BlockRailBase; } - protected BlockRailBase(int par1, boolean par2) -@@ -105,7 +106,7 @@ - */ - public int getRenderType() + protected BlockRailBase(boolean p_i45389_1_) +@@ -78,7 +79,7 @@ + + public int func_149645_b() { - return 9; + return renderType; } - /** -@@ -244,4 +245,107 @@ - par1World.notifyBlocksOfNeighborChange(par2, par3 - 1, par4, par5); + public int func_149745_a(Random p_149745_1_) +@@ -193,6 +194,111 @@ } } -+ -+ /** + ++ /* ======================================== FORGE START =====================================*/ ++ /** + * Return true if the rail can make corners. + * Used by placement logic. + * @param world The world. @@ -40,9 +40,9 @@ + * @param z The rail Z coordinate. + * @return True if the rail can make corners. + */ -+ public boolean isFlexibleRail(World world, int y, int x, int z) ++ public boolean isFlexibleRail(IBlockAccess world, int y, int x, int z) + { -+ return !isPowered; ++ return !func_150050_e(); + } + + /** @@ -54,7 +54,7 @@ + * @param z The rail Z coordinate. + * @return True if the rail can make slopes. + */ -+ public boolean canMakeSlopes(World world, int x, int y, int z) ++ public boolean canMakeSlopes(IBlockAccess world, int x, int y, int z) + { + return true; + } @@ -87,7 +87,7 @@ + public int getBasicRailMetadata(IBlockAccess world, EntityMinecart cart, int x, int y, int z) + { + int meta = world.getBlockMetadata(x, y, z); -+ if(isPowered) ++ if(func_150050_e()) + { + meta = meta & 7; + } @@ -133,4 +133,76 @@ + { + renderType = value; + } - } ++ /* ======================================== FORGE END =====================================*/ ++ + public class Rail + { + private World field_150660_b; +@@ -202,6 +308,7 @@ + private final boolean field_150656_f; + private List field_150657_g = new ArrayList(); + private static final String __OBFID = "CL_00000196"; ++ private final boolean canMakeSlopes; + + public Rail(World p_i45388_2_, int p_i45388_3_, int p_i45388_4_, int p_i45388_5_) + { +@@ -209,19 +316,10 @@ + this.field_150661_c = p_i45388_3_; + this.field_150658_d = p_i45388_4_; + this.field_150659_e = p_i45388_5_; +- Block block = p_i45388_2_.func_147439_a(p_i45388_3_, p_i45388_4_, p_i45388_5_); +- int l = p_i45388_2_.getBlockMetadata(p_i45388_3_, p_i45388_4_, p_i45388_5_); +- +- if (((BlockRailBase)block).field_150053_a) +- { +- this.field_150656_f = true; +- l &= -9; +- } +- else +- { +- this.field_150656_f = false; +- } +- ++ BlockRailBase block = (BlockRailBase)p_i45388_2_.func_147439_a(p_i45388_3_, p_i45388_4_, p_i45388_5_); ++ int l = block.getBasicRailMetadata(p_i45388_2_, null, p_i45388_3_, p_i45388_4_, p_i45388_5_); ++ this.field_150656_f = block.isFlexibleRail(p_i45388_2_, p_i45388_3_, p_i45388_4_, p_i45388_5_); ++ canMakeSlopes = block.canMakeSlopes(p_i45388_2_, p_i45388_3_, p_i45388_4_, p_i45388_5_); + this.func_150648_a(l); + } + +@@ -412,7 +510,7 @@ + } + } + +- if (b0 == 0) ++ if (b0 == 0 && canMakeSlopes) + { + if (BlockRailBase.func_150049_b_(this.field_150660_b, this.field_150661_c, this.field_150658_d + 1, this.field_150659_e - 1)) + { +@@ -425,7 +523,7 @@ + } + } + +- if (b0 == 1) ++ if (b0 == 1 && canMakeSlopes) + { + if (BlockRailBase.func_150049_b_(this.field_150660_b, this.field_150661_c + 1, this.field_150658_d + 1, this.field_150659_e)) + { +@@ -570,7 +668,7 @@ + } + } + +- if (b0 == 0) ++ if (b0 == 0 && canMakeSlopes) + { + if (BlockRailBase.func_150049_b_(this.field_150660_b, this.field_150661_c, this.field_150658_d + 1, this.field_150659_e - 1)) + { +@@ -583,7 +681,7 @@ + } + } + +- if (b0 == 1) ++ if (b0 == 1 && canMakeSlopes) + { + if (BlockRailBase.func_150049_b_(this.field_150660_b, this.field_150661_c + 1, this.field_150658_d + 1, this.field_150659_e)) + { 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 000000000..706b86c32 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch @@ -0,0 +1,22 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneComparator.java ++++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneComparator.java +@@ -228,4 +228,19 @@ + { + return new TileEntityComparator(); + } ++ ++ @Override ++ public void onNeighborChange(IBlockAccess world, int x, int y, int z, int tileX, int tileY, int tileZ) ++ { ++ if (y == tileY && world instanceof World) ++ { ++ func_149695_a((World)world, x, y, z, world.func_147439_a(tileX, tileY, tileZ)); ++ } ++ } ++ ++ @Override ++ public boolean getWeakChanges(IBlockAccess world, int x, int y, int z) ++ { ++ return true; ++ } + } diff --git a/patches/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch b/patches/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch index cc76bd5fe..115d778ce 100644 --- a/patches/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch @@ -1,19 +1,29 @@ --- ../src-base/minecraft/net/minecraft/block/BlockRedstoneOre.java +++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneOre.java -@@ -116,11 +116,17 @@ - { - super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, par7); +@@ -10,6 +10,7 @@ + import net.minecraft.init.Items; + import net.minecraft.item.Item; + import net.minecraft.item.ItemStack; ++import net.minecraft.world.IBlockAccess; + import net.minecraft.world.World; + public class BlockRedstoneOre extends Block +@@ -88,12 +89,17 @@ + public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_) + { + super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, p_149690_7_); + } -+ -+ @Override -+ public int getExpDrop(World par1World, int par5, int par7) + +- if (this.func_149650_a(p_149690_5_, p_149690_1_.rand, p_149690_7_) != Item.func_150898_a(this)) ++ private Random rand = new Random(); ++ @Override // World, meta, fortune ++ public int getExpDrop(IBlockAccess p_149690_1_, int p_149690_5_, int p_149690_7_) + { - if (this.idDropped(par5, par1World.rand, par7) != this.blockID) ++ if (this.func_149650_a(p_149690_5_, rand, p_149690_7_) != Item.func_150898_a(this)) { - int j1 = 1 + par1World.rand.nextInt(5); -- this.dropXpOnBlockBreak(par1World, par2, par3, par4, j1); -+ return j1; +- int j1 = 1 + p_149690_1_.rand.nextInt(5); +- this.func_149657_c(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, j1); ++ return 1 + rand.nextInt(5); } + return 0; } diff --git a/patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch b/patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch index 2b66e7721..fbee8cc97 100644 --- a/patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/block/BlockRedstoneWire.java +++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneWire.java -@@ -475,7 +475,7 @@ +@@ -405,7 +405,7 @@ } - else if (!Block.redstoneRepeaterIdle.func_94487_f(i1)) + else if (!Blocks.unpowered_repeater.func_149907_e(block)) { -- return Block.blocksList[i1].canProvidePower() && par4 != -1; -+ return (Block.blocksList[i1] != null && Block.blocksList[i1].canConnectRedstone(par0IBlockAccess, par1, par2, par3, par4)); +- return block.func_149744_f() && p_150174_4_ != -1; ++ return block.canConnectRedstone(p_150174_0_, p_150174_1_, p_150174_2_, p_150174_3_, p_150174_4_); } else { diff --git a/patches/minecraft/net/minecraft/block/BlockReed.java.patch b/patches/minecraft/net/minecraft/block/BlockReed.java.patch index ca73e896d..6719a85c3 100644 --- a/patches/minecraft/net/minecraft/block/BlockReed.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockReed.java.patch @@ -1,48 +1,46 @@ --- ../src-base/minecraft/net/minecraft/block/BlockReed.java +++ ../src-work/minecraft/net/minecraft/block/BlockReed.java -@@ -8,7 +8,11 @@ - import net.minecraft.util.AxisAlignedBB; +@@ -11,7 +11,11 @@ + import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -public class BlockReed extends Block +import net.minecraftforge.common.EnumPlantType; -+import net.minecraftforge.common.ForgeDirection; ++import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.common.IPlantable; + +public class BlockReed extends Block implements IPlantable { - protected BlockReed(int par1) + private static final String __OBFID = "CL_00000300"; + +@@ -57,7 +61,7 @@ + public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) { -@@ -54,8 +58,8 @@ - */ - public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) - { -- int l = par1World.getBlockId(par2, par3 - 1, par4); -- return l == this.blockID ? true : (l != Block.grass.blockID && l != Block.dirt.blockID && l != Block.sand.blockID ? false : (par1World.getBlockMaterial(par2 - 1, par3 - 1, par4) == Material.water ? true : (par1World.getBlockMaterial(par2 + 1, par3 - 1, par4) == Material.water ? true : (par1World.getBlockMaterial(par2, par3 - 1, par4 - 1) == Material.water ? true : par1World.getBlockMaterial(par2, par3 - 1, par4 + 1) == Material.water)))); -+ Block block = Block.blocksList[par1World.getBlockId(par2, par3 - 1, par4)]; -+ return (block != null && block.canSustainPlant(par1World, par2, par3 - 1, par4, ForgeDirection.UP, this)); + Block block = p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_ - 1, p_149742_4_); +- return block == this ? true : (block != Blocks.grass && block != Blocks.dirt && block != Blocks.sand ? false : (p_149742_1_.func_147439_a(p_149742_2_ - 1, p_149742_3_ - 1, p_149742_4_).func_149688_o() == Material.field_151586_h ? true : (p_149742_1_.func_147439_a(p_149742_2_ + 1, p_149742_3_ - 1, p_149742_4_).func_149688_o() == Material.field_151586_h ? true : (p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_ - 1, p_149742_4_ - 1).func_149688_o() == Material.field_151586_h ? true : p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_ - 1, p_149742_4_ + 1).func_149688_o() == Material.field_151586_h)))); ++ return block.canSustainPlant(p_149742_1_, p_149742_2_, p_149742_3_ - 1, p_149742_4_, ForgeDirection.UP, this); } - /** -@@ -138,4 +142,22 @@ + public void func_149695_a(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_) +@@ -120,4 +124,22 @@ { - return Item.reed.itemID; + return p_149720_1_.getBiomeGenForCoords(p_149720_2_, p_149720_4_).func_150558_b(p_149720_2_, p_149720_3_, p_149720_4_); } + + @Override -+ public EnumPlantType getPlantType(World world, int x, int y, int z) ++ public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z) + { + return EnumPlantType.Beach; + } + + @Override -+ public int getPlantID(World world, int x, int y, int z) ++ public Block getPlant(IBlockAccess world, int x, int y, int z) + { -+ return blockID; ++ return this; + } + + @Override -+ public int getPlantMetadata(World world, int x, int y, int z) ++ public int getPlantMetadata(IBlockAccess world, int x, int y, int z) + { + return world.getBlockMetadata(x, y, z); + } diff --git a/patches/minecraft/net/minecraft/block/BlockSand.java.patch b/patches/minecraft/net/minecraft/block/BlockSand.java.patch deleted file mode 100644 index dd3b3749d..000000000 --- a/patches/minecraft/net/minecraft/block/BlockSand.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockSand.java -+++ ../src-work/minecraft/net/minecraft/block/BlockSand.java -@@ -105,7 +105,7 @@ - { - int l = par0World.getBlockId(par1, par2, par3); - -- if (l == 0) -+ if (par0World.isAirBlock(par1, par2, par3)) - { - return true; - } diff --git a/patches/minecraft/net/minecraft/block/BlockSapling.java.patch b/patches/minecraft/net/minecraft/block/BlockSapling.java.patch index 4997497db..37d9701c8 100644 --- a/patches/minecraft/net/minecraft/block/BlockSapling.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockSapling.java.patch @@ -1,20 +1,10 @@ --- ../src-base/minecraft/net/minecraft/block/BlockSapling.java +++ ../src-work/minecraft/net/minecraft/block/BlockSapling.java -@@ -16,6 +16,8 @@ - import net.minecraft.world.gen.feature.WorldGenTrees; - import net.minecraft.world.gen.feature.WorldGenerator; +@@ -71,6 +71,7 @@ -+import net.minecraftforge.event.terraingen.TerrainGen; -+ - public class BlockSapling extends BlockFlower - { - public static final String[] WOOD_TYPES = new String[] {"oak", "spruce", "birch", "jungle"}; -@@ -76,6 +78,8 @@ - */ - public void growTree(World par1World, int par2, int par3, int par4, Random par5Random) + public void func_149878_d(World p_149878_1_, int p_149878_2_, int p_149878_3_, int p_149878_4_, Random p_149878_5_) { -+ if (!TerrainGen.saplingGrowTree(par1World, par5Random, par2, par3, par4)) return; -+ - int l = par1World.getBlockMetadata(par2, par3, par4) & 3; - Object object = null; ++ if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(p_149878_1_, p_149878_5_, p_149878_2_, p_149878_3_, p_149878_4_)) return; + int l = p_149878_1_.getBlockMetadata(p_149878_2_, p_149878_3_, p_149878_4_) & 7; + Object object = p_149878_5_.nextInt(10) == 0 ? new WorldGenBigTree(true) : new WorldGenTrees(true); int i1 = 0; diff --git a/patches/minecraft/net/minecraft/block/BlockSkull.java.patch b/patches/minecraft/net/minecraft/block/BlockSkull.java.patch index f50966366..f35f577cc 100644 --- a/patches/minecraft/net/minecraft/block/BlockSkull.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockSkull.java.patch @@ -1,77 +1,62 @@ --- ../src-base/minecraft/net/minecraft/block/BlockSkull.java +++ ../src-work/minecraft/net/minecraft/block/BlockSkull.java -@@ -2,6 +2,8 @@ +@@ -2,6 +2,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -+ +import java.util.ArrayList; + import java.util.Iterator; import java.util.Random; import net.minecraft.block.material.Material; - import net.minecraft.client.renderer.texture.IconRegister; -@@ -135,11 +137,6 @@ +@@ -108,8 +109,6 @@ + return p_149692_1_; } - /** -- * Drops the block items with a specified chance of dropping the specified items -- */ -- public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) {} +- public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_) {} - -- /** - * Called when the block is attempted to be harvested - */ - public void onBlockHarvested(World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer) -@@ -150,6 +147,8 @@ - par1World.setBlockMetadataWithNotify(par2, par3, par4, par5, 4); + public void func_149681_a(World p_149681_1_, int p_149681_2_, int p_149681_3_, int p_149681_4_, int p_149681_5_, EntityPlayer p_149681_6_) + { + if (p_149681_6_.capabilities.isCreativeMode) +@@ -118,29 +117,38 @@ + p_149681_1_.setBlockMetadataWithNotify(p_149681_2_, p_149681_3_, p_149681_4_, p_149681_5_, 4); } -+ dropBlockAsItem(par1World, par2, par3, par4, par5, 0); ++ this.func_149697_b(p_149681_1_, p_149681_2_, p_149681_3_, p_149681_4_, p_149681_5_, 0); + - super.onBlockHarvested(par1World, par2, par3, par4, par5, par6EntityPlayer); + super.func_149681_a(p_149681_1_, p_149681_2_, p_149681_3_, p_149681_4_, p_149681_5_, p_149681_6_); } -@@ -160,24 +159,30 @@ - */ - public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) + public void func_149749_a(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) { -- if (!par1World.isRemote) -+ super.breakBlock(par1World, par2, par3, par4, par5, par6); +- if (!p_149749_1_.isRemote) ++ super.func_149749_a(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); + } + + @Override -+ public ArrayList getBlockDropped(World world, int x, int y, int z, int metadata, int fortune) ++ public ArrayList getDrops(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, int p_149749_6_, int fortune) + { -+ ArrayList drops = new ArrayList(); -+ if ((metadata & 8) == 0) ++ ArrayList ret = new ArrayList(); { -- if ((par6 & 8) == 0) -- { -- ItemStack itemstack = new ItemStack(Item.skull.itemID, 1, this.getDamageValue(par1World, par2, par3, par4)); -- TileEntitySkull tileentityskull = (TileEntitySkull)par1World.getBlockTileEntity(par2, par3, par4); -+ ItemStack itemstack = new ItemStack(Item.skull.itemID, 1, this.getDamageValue(world, x, y, z)); -+ TileEntitySkull tileentityskull = (TileEntitySkull)world.getBlockTileEntity(x, y, z); + if ((p_149749_6_ & 8) == 0) + { + ItemStack itemstack = new ItemStack(Items.skull, 1, this.func_149643_k(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_)); + TileEntitySkull tileentityskull = (TileEntitySkull)p_149749_1_.func_147438_o(p_149749_2_, p_149749_3_, p_149749_4_); -- if (tileentityskull.getSkullType() == 3 && tileentityskull.getExtraType() != null && tileentityskull.getExtraType().length() > 0) -- { -- itemstack.setTagCompound(new NBTTagCompound()); -- itemstack.getTagCompound().setString("SkullOwner", tileentityskull.getExtraType()); -- } -- -- this.dropBlockAsItem_do(par1World, par2, par3, par4, itemstack); -+ if (tileentityskull == null) -+ { -+ return drops; ++ if (tileentityskull == null) return ret; ++ + if (tileentityskull.func_145904_a() == 3 && tileentityskull.func_145907_c() != null && tileentityskull.func_145907_c().length() > 0) + { + itemstack.setTagCompound(new NBTTagCompound()); + itemstack.getTagCompound().setString("SkullOwner", tileentityskull.func_145907_c()); + } + +- this.func_149642_a(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, itemstack); ++ ret.add(itemstack); } - -- super.breakBlock(par1World, par2, par3, par4, par5, par6); -+ if (tileentityskull.getSkullType() == 3 && tileentityskull.getExtraType() != null && tileentityskull.getExtraType().length() > 0) -+ { -+ itemstack.setTagCompound(new NBTTagCompound()); -+ itemstack.getTagCompound().setString("SkullOwner", tileentityskull.getExtraType()); -+ } -+ drops.add(itemstack); +- super.func_149749_a(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); } -+ return drops; ++ return ret; } - /** + public Item func_149650_a(int p_149650_1_, Random p_149650_2_, int p_149650_3_) diff --git a/patches/minecraft/net/minecraft/block/BlockSnow.java.patch b/patches/minecraft/net/minecraft/block/BlockSnow.java.patch index 25c8dc508..8cd05fd1c 100644 --- a/patches/minecraft/net/minecraft/block/BlockSnow.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockSnow.java.patch @@ -1,64 +1,64 @@ --- ../src-base/minecraft/net/minecraft/block/BlockSnow.java +++ ../src-work/minecraft/net/minecraft/block/BlockSnow.java -@@ -96,8 +96,12 @@ - */ - public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) +@@ -73,7 +73,7 @@ + public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) { -- int l = par1World.getBlockId(par2, par3 - 1, par4); -- return l == 0 ? false : (l == this.blockID && (par1World.getBlockMetadata(par2, par3 - 1, par4) & 7) == 7 ? true : (l != Block.leaves.blockID && !Block.blocksList[l].isOpaqueCube() ? false : par1World.getBlockMaterial(par2, par3 - 1, par4).blocksMovement())); -+ int l = par1World.getBlockId(par2, par3 - 1, par4); -+ Block block = Block.blocksList[l]; -+ if (block == null) return false; -+ if (block == this && (par1World.getBlockMetadata(par2, par3 - 1, par4) & 7) == 7) return true; -+ if (!block.isLeaves(par1World, par2, par3 - 1, par4) && !Block.blocksList[l].isOpaqueCube()) return false; -+ return par1World.getBlockMaterial(par2, par3 - 1, par4).blocksMovement(); + Block block = p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_ - 1, p_149742_4_); +- return block != Blocks.ice && block != Blocks.packed_ice ? (block.func_149688_o() == Material.field_151584_j ? true : (block == this && (p_149742_1_.getBlockMetadata(p_149742_2_, p_149742_3_ - 1, p_149742_4_) & 7) == 7 ? true : block.func_149662_c() && block.field_149764_J.blocksMovement())) : false; ++ return block != Blocks.ice && block != Blocks.packed_ice ? (block.isLeaves(p_149742_1_, p_149742_2_, p_149742_3_ - 1, p_149742_4_) ? true : (block == this && (p_149742_1_.getBlockMetadata(p_149742_2_, p_149742_3_ - 1, p_149742_4_) & 7) == 7 ? true : block.func_149662_c() && block.field_149764_J.blocksMovement())) : false; } - /** -@@ -116,7 +120,6 @@ + public void func_149695_a(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_) +@@ -85,7 +85,6 @@ { - if (!this.canPlaceBlockAt(par1World, par2, par3, par4)) + if (!this.func_149742_c(p_150155_1_, p_150155_2_, p_150155_3_, p_150155_4_)) { -- this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); - par1World.setBlockToAir(par2, par3, par4); +- this.func_149697_b(p_150155_1_, p_150155_2_, p_150155_3_, p_150155_4_, p_150155_1_.getBlockMetadata(p_150155_2_, p_150155_3_, p_150155_4_), 0); + p_150155_1_.func_147468_f(p_150155_2_, p_150155_3_, p_150155_4_); return false; } -@@ -132,11 +135,8 @@ - */ - public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) +@@ -97,10 +96,8 @@ + + public void func_149636_a(World p_149636_1_, EntityPlayer p_149636_2_, int p_149636_3_, int p_149636_4_, int p_149636_5_, int p_149636_6_) { -- int i1 = Item.snowball.itemID; -- int j1 = par6 & 7; -- this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(i1, j1 + 1, 0)); -+ super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); - par1World.setBlockToAir(par3, par4, par5); -- par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); +- int i1 = p_149636_6_ & 7; +- this.func_149642_a(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, new ItemStack(Items.snowball, i1 + 1, 0)); ++ super.func_149636_a(p_149636_1_, p_149636_2_, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_); + p_149636_1_.func_147468_f(p_149636_3_, p_149636_4_, p_149636_5_); +- p_149636_2_.addStat(StatList.mineBlockStatArray[Block.func_149682_b(this)], 1); } - /** -@@ -152,7 +152,7 @@ - */ - public int quantityDropped(Random par1Random) + public Item func_149650_a(int p_149650_1_, Random p_149650_2_, int p_149650_3_) +@@ -110,14 +107,13 @@ + + public int func_149745_a(Random p_149745_1_) { - return 0; + return 1; } - /** -@@ -162,7 +162,6 @@ + public void func_149674_a(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_) { - if (par1World.getSavedLightValue(EnumSkyBlock.Block, par2, par3, par4) > 11) + if (p_149674_1_.getSavedLightValue(EnumSkyBlock.Block, p_149674_2_, p_149674_3_, p_149674_4_) > 11) { -- this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); - par1World.setBlockToAir(par2, par3, par4); +- this.func_149697_b(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_, p_149674_4_), 0); + p_149674_1_.func_147468_f(p_149674_2_, p_149674_3_, p_149674_4_); } } -@@ -177,4 +176,27 @@ +@@ -127,4 +123,34 @@ { - return par5 == 1 ? true : super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5); + return p_149646_5_ == 1 ? true : super.func_149646_a(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_); } + -+ @Override ++ /** ++ * Metadata and fortune sensitive version, this replaces the old (int meta, Random rand) ++ * version in 1.1. ++ * ++ * @param meta Blocks Metadata ++ * @param fortune Current item fortune level ++ * @param random Random number generator ++ * @return The number of items to drop ++ */ + public int quantityDropped(int meta, int fortune, Random random) + { + return (meta & 7) + 1; @@ -74,10 +74,9 @@ + * @param z Z position + * @return True if the block is replaceable by another block + */ -+ @Override -+ public boolean isBlockReplaceable(World world, int x, int y, int z) ++ public boolean isReplaceable(IBlockAccess world, int x, int y, int z) + { + int meta = world.getBlockMetadata(x, y, z); -+ return (meta >= 7 ? false : blockMaterial.isReplaceable()); ++ return meta >= 7 ? false : field_149764_J.isReplaceable(); + } } diff --git a/patches/minecraft/net/minecraft/block/BlockStem.java.patch b/patches/minecraft/net/minecraft/block/BlockStem.java.patch index 90c93767c..321156215 100644 --- a/patches/minecraft/net/minecraft/block/BlockStem.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockStem.java.patch @@ -1,85 +1,80 @@ --- ../src-base/minecraft/net/minecraft/block/BlockStem.java +++ ../src-work/minecraft/net/minecraft/block/BlockStem.java -@@ -2,6 +2,8 @@ +@@ -2,6 +2,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -+ +import java.util.ArrayList; import java.util.Random; - import net.minecraft.client.renderer.texture.IconRegister; - import net.minecraft.creativetab.CreativeTabs; -@@ -12,6 +14,8 @@ + import net.minecraft.block.material.Material; + import net.minecraft.client.renderer.texture.IIconRegister; +@@ -14,6 +15,7 @@ + import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; ++import static net.minecraftforge.common.util.ForgeDirection.*; -+import net.minecraftforge.common.ForgeDirection; -+ - public class BlockStem extends BlockFlower + public class BlockStem extends BlockBush implements IGrowable { - /** Defines if it is a Melon or a Pumpkin that the stem is producing. */ -@@ -106,7 +110,8 @@ +@@ -101,7 +103,7 @@ - int l1 = par1World.getBlockId(j1, par3 - 1, k1); + Block block = p_149674_1_.func_147439_a(j1, p_149674_3_ - 1, k1); -- if (par1World.getBlockId(j1, par3, k1) == 0 && (l1 == Block.tilledField.blockID || l1 == Block.dirt.blockID || l1 == Block.grass.blockID)) -+ boolean isSoil = (blocksList[l1] != null && blocksList[l1].canSustainPlant(par1World, j1, par3 - 1, k1, ForgeDirection.UP, this)); -+ if (par1World.isAirBlock(j1, par3, k1) && (isSoil || l1 == Block.dirt.blockID || l1 == Block.grass.blockID)) +- if (p_149674_1_.func_147439_a(j1, p_149674_3_, k1).field_149764_J == Material.field_151579_a && (block == Blocks.farmland || block == Blocks.dirt || block == Blocks.grass)) ++ if (p_149674_1_.func_147437_c(j1, p_149674_3_, k1) && (block.canSustainPlant(p_149674_1_, j1, p_149674_3_ - 1, k1, UP, this) || block == Blocks.dirt || block == Blocks.grass)) { - par1World.setBlock(j1, par3, k1, this.fruitType.blockID); + p_149674_1_.func_147449_b(j1, p_149674_3_, k1, this.field_149877_a); } -@@ -149,11 +154,11 @@ - int j3 = par1World.getBlockId(l2, par3 - 1, i3); +@@ -144,11 +146,11 @@ + Block block8 = p_149875_1_.func_147439_a(l, p_149875_3_ - 1, i1); float f1 = 0.0F; -- if (j3 == Block.tilledField.blockID) -+ if (blocksList[j3] != null && blocksList[j3].canSustainPlant(par1World, l2, par3 - 1, i3, ForgeDirection.UP, this)) +- if (block8 == Blocks.farmland) ++ if (block8.canSustainPlant(p_149875_1_, l, p_149875_3_ - 1, i1, UP, this)) { f1 = 1.0F; -- if (par1World.getBlockMetadata(l2, par3 - 1, i3) > 0) -+ if (blocksList[j3].isFertile(par1World, l2, par3 - 1, i3)) +- if (p_149875_1_.getBlockMetadata(l, p_149875_3_ - 1, i1) > 0) ++ if (block8.isFertile(p_149875_1_, l, p_149875_3_ - 1, i1)) { f1 = 3.0F; } -@@ -245,29 +250,22 @@ - public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) +@@ -215,6 +217,7 @@ { - super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, par7); -+ } + super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, p_149690_7_); -- if (!par1World.isRemote) -- { -- Item item = null; -+ @Override -+ public ArrayList getBlockDropped(World world, int x, int y, int z, int metadata, int fortune) -+ { -+ ArrayList ret = new ArrayList(); - -- if (this.fruitType == Block.pumpkin) -+ for (int i = 0; i < 3; i++) -+ { -+ if (world.rand.nextInt(15) <= metadata) - { -- item = Item.pumpkinSeeds; -+ ret.add(new ItemStack(fruitType == pumpkin ? Item.pumpkinSeeds : Item.melonSeeds)); ++ /* + if (!p_149690_1_.isRemote) + { + Item item = null; +@@ -237,6 +240,7 @@ + } } -- -- if (this.fruitType == Block.melon) -- { -- item = Item.melonSeeds; -- } -- -- for (int j1 = 0; j1 < 3; ++j1) -- { -- if (par1World.rand.nextInt(15) <= par5) -- { -- this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(item)); -- } -- } } -+ -+ return ret; ++ */ } - /** + public Item func_149650_a(int p_149650_1_, Random p_149650_2_, int p_149650_3_) +@@ -282,4 +286,22 @@ + { + this.func_149874_m(p_149853_1_, p_149853_3_, p_149853_4_, p_149853_5_); + } ++ ++ ++ @Override ++ public ArrayList getDrops(World world, int x, int y, int z, int meta, int fortune) ++ { ++ ArrayList ret = new ArrayList(); ++ ++ Item item = null; ++ item = field_149877_a == Blocks.pumpkin ? Items.pumpkin_seeds : item; ++ item = field_149877_a == Blocks.melon_block ? Items.melon_seeds : item; ++ ++ for (int i = 0; item != null && i < 3; i++) ++ { ++ ret.add(new ItemStack(item)); ++ } ++ ++ return ret; ++ } + } diff --git a/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch b/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch index 2f91f9511..b3680e9de 100644 --- a/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch @@ -1,82 +1,71 @@ --- ../src-base/minecraft/net/minecraft/block/BlockTallGrass.java +++ ../src-work/minecraft/net/minecraft/block/BlockTallGrass.java -@@ -2,6 +2,8 @@ +@@ -2,6 +2,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -+ +import java.util.ArrayList; import java.util.List; import java.util.Random; import net.minecraft.block.material.Material; -@@ -17,7 +19,10 @@ +@@ -17,8 +18,10 @@ + import net.minecraft.world.ColorizerGrass; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; - --public class BlockTallGrass extends BlockFlower +import net.minecraftforge.common.ForgeHooks; +import net.minecraftforge.common.IShearable; -+ -+public class BlockTallGrass extends BlockFlower implements IShearable + +-public class BlockTallGrass extends BlockBush implements IGrowable ++public class BlockTallGrass extends BlockBush implements IGrowable, IShearable { - private static final String[] grassTypes = new String[] {"deadbush", "tallgrass", "fern"}; + private static final String[] field_149871_a = new String[] {"deadbush", "tallgrass", "fern"}; @SideOnly(Side.CLIENT) -@@ -50,7 +55,7 @@ - */ - public int idDropped(int par1, Random par2Random, int par3) +@@ -71,7 +74,7 @@ + + public Item func_149650_a(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { -- return par2Random.nextInt(8) == 0 ? Item.seeds.itemID : -1; -+ return -1; +- return p_149650_2_.nextInt(8) == 0 ? Items.wheat_seeds : null; ++ return null; } - /** -@@ -67,15 +72,7 @@ - */ - public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) + public int func_149679_a(int p_149679_1_, Random p_149679_2_) +@@ -81,13 +84,7 @@ + + public void func_149636_a(World p_149636_1_, EntityPlayer p_149636_2_, int p_149636_3_, int p_149636_4_, int p_149636_5_, int p_149636_6_) { -- if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.itemID) -- { -- par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); -- this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(Block.tallGrass, 1, par6)); +- if (!p_149636_1_.isRemote && p_149636_2_.getCurrentEquippedItem() != null && p_149636_2_.getCurrentEquippedItem().getItem() == Items.shears) + { +- p_149636_2_.addStat(StatList.mineBlockStatArray[Block.func_149682_b(this)], 1); +- this.func_149642_a(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, new ItemStack(Blocks.tallgrass, 1, p_149636_6_)); - } - else - { -- super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); -- } -+ super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); + super.func_149636_a(p_149636_1_, p_149636_2_, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_); + } } - - @SideOnly(Side.CLIENT) -@@ -144,4 +141,35 @@ - this.iconArray[i] = par1IconRegister.registerIcon(grassTypes[i]); +@@ -143,4 +140,28 @@ + Blocks.double_plant.func_149889_c(p_149853_1_, p_149853_3_, p_149853_4_, p_149853_5_, b0, 2); } } + + @Override -+ public ArrayList getBlockDropped(World world, int x, int y, int z, int meta, int fortune) ++ public ArrayList getDrops(World world, int x, int y, int z, int meta, int fortune) + { + ArrayList ret = new ArrayList(); -+ if (world.rand.nextInt(8) != 0) -+ { -+ return ret; -+ } -+ -+ ItemStack item = ForgeHooks.getGrassSeed(world); -+ if (item != null) -+ { -+ ret.add(item); -+ } ++ if (world.rand.nextInt(8) != 0) return ret; ++ ItemStack seed = ForgeHooks.getGrassSeed(world); ++ if (seed != null) ret.add(seed); + return ret; + } + + @Override -+ public boolean isShearable(ItemStack item, World world, int x, int y, int z) ++ public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z) + { + return true; + } + + @Override -+ public ArrayList onSheared(ItemStack item, World world, int x, int y, int z, int fortune) ++ public ArrayList onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune) + { + ArrayList ret = new ArrayList(); + ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z))); diff --git a/patches/minecraft/net/minecraft/block/BlockTorch.java.patch b/patches/minecraft/net/minecraft/block/BlockTorch.java.patch index a674a9aaa..f4663e01e 100644 --- a/patches/minecraft/net/minecraft/block/BlockTorch.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockTorch.java.patch @@ -1,112 +1,108 @@ --- ../src-base/minecraft/net/minecraft/block/BlockTorch.java +++ ../src-work/minecraft/net/minecraft/block/BlockTorch.java -@@ -10,6 +10,9 @@ +@@ -10,6 +10,7 @@ + import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; ++import static net.minecraftforge.common.util.ForgeDirection.*; -+import net.minecraftforge.common.ForgeDirection; -+import static net.minecraftforge.common.ForgeDirection.*; -+ public class BlockTorch extends Block { - protected BlockTorch(int par1) -@@ -65,7 +68,7 @@ +@@ -51,13 +52,17 @@ else { - int l = par1World.getBlockId(par2, par3, par4); -- return l == Block.fence.blockID || l == Block.netherFence.blockID || l == Block.glass.blockID || l == Block.cobblestoneWall.blockID; -+ return (Block.blocksList[l] != null && Block.blocksList[l].canPlaceTorchOnTop(par1World, par2, par3, par4)); + Block block = p_150107_1_.func_147439_a(p_150107_2_, p_150107_3_, p_150107_4_); +- return block == Blocks.fence || block == Blocks.nether_brick_fence || block == Blocks.glass || block == Blocks.cobblestone_wall; ++ return block.canPlaceTorchOnTop(p_150107_1_, p_150107_2_, p_150107_3_, p_150107_4_); } } -@@ -74,7 +77,11 @@ - */ - public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) { -- return par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true) ? true : (par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true) ? true : (par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true) ? true : (par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true) ? true : this.canPlaceTorchOn(par1World, par2, par3 - 1, par4)))); -+ return par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST, true) || -+ par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST, true) || -+ par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH, true) || -+ par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH, true) || -+ canPlaceTorchOn(par1World, par2, par3 - 1, par4); +- return p_149742_1_.func_147445_c(p_149742_2_ - 1, p_149742_3_, p_149742_4_, true) ? true : (p_149742_1_.func_147445_c(p_149742_2_ + 1, p_149742_3_, p_149742_4_, true) ? true : (p_149742_1_.func_147445_c(p_149742_2_, p_149742_3_, p_149742_4_ - 1, true) ? true : (p_149742_1_.func_147445_c(p_149742_2_, p_149742_3_, p_149742_4_ + 1, true) ? true : this.func_150107_m(p_149742_1_, p_149742_2_, p_149742_3_ - 1, p_149742_4_)))); ++ return p_149742_1_.isSideSolid(p_149742_2_ - 1, p_149742_3_, p_149742_4_, EAST, true) || ++ p_149742_1_.isSideSolid(p_149742_2_ + 1, p_149742_3_, p_149742_4_, WEST, true) || ++ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ - 1, SOUTH, true) || ++ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ + 1, NORTH, true) || ++ func_150107_m(p_149742_1_, p_149742_2_, p_149742_3_ - 1, p_149742_4_); } - /** -@@ -89,22 +96,22 @@ + public int func_149660_a(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_) +@@ -69,22 +74,22 @@ j1 = 5; } -- if (par5 == 2 && par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true)) -+ if (par5 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH, true)) +- if (p_149660_5_ == 2 && p_149660_1_.func_147445_c(p_149660_2_, p_149660_3_, p_149660_4_ + 1, true)) ++ if (p_149660_5_ == 2 && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ + 1, NORTH, true)) { j1 = 4; } -- if (par5 == 3 && par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true)) -+ if (par5 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH, true)) +- if (p_149660_5_ == 3 && p_149660_1_.func_147445_c(p_149660_2_, p_149660_3_, p_149660_4_ - 1, true)) ++ if (p_149660_5_ == 3 && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ - 1, SOUTH, true)) { j1 = 3; } -- if (par5 == 4 && par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true)) -+ if (par5 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST, true)) +- if (p_149660_5_ == 4 && p_149660_1_.func_147445_c(p_149660_2_ + 1, p_149660_3_, p_149660_4_, true)) ++ if (p_149660_5_ == 4 && p_149660_1_.isSideSolid(p_149660_2_ + 1, p_149660_3_, p_149660_4_, WEST, true)) { j1 = 2; } -- if (par5 == 5 && par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true)) -+ if (par5 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST, true)) +- if (p_149660_5_ == 5 && p_149660_1_.func_147445_c(p_149660_2_ - 1, p_149660_3_, p_149660_4_, true)) ++ if (p_149660_5_ == 5 && p_149660_1_.isSideSolid(p_149660_2_ - 1, p_149660_3_, p_149660_4_, EAST, true)) { j1 = 1; } -@@ -132,19 +139,19 @@ +@@ -106,19 +111,19 @@ { - if (par1World.getBlockMetadata(par2, par3, par4) == 0) + if (p_149726_1_.getBlockMetadata(p_149726_2_, p_149726_3_, p_149726_4_) == 0) { -- if (par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true)) -+ if (par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST, true)) +- if (p_149726_1_.func_147445_c(p_149726_2_ - 1, p_149726_3_, p_149726_4_, true)) ++ if (p_149726_1_.isSideSolid(p_149726_2_ - 1, p_149726_3_, p_149726_4_, EAST, true)) { - par1World.setBlockMetadataWithNotify(par2, par3, par4, 1, 2); + p_149726_1_.setBlockMetadataWithNotify(p_149726_2_, p_149726_3_, p_149726_4_, 1, 2); } -- else if (par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true)) -+ else if (par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST, true)) +- else if (p_149726_1_.func_147445_c(p_149726_2_ + 1, p_149726_3_, p_149726_4_, true)) ++ else if (p_149726_1_.isSideSolid(p_149726_2_ + 1, p_149726_3_, p_149726_4_, WEST, true)) { - par1World.setBlockMetadataWithNotify(par2, par3, par4, 2, 2); + p_149726_1_.setBlockMetadataWithNotify(p_149726_2_, p_149726_3_, p_149726_4_, 2, 2); } -- else if (par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true)) -+ else if (par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH, true)) +- else if (p_149726_1_.func_147445_c(p_149726_2_, p_149726_3_, p_149726_4_ - 1, true)) ++ else if (p_149726_1_.isSideSolid(p_149726_2_, p_149726_3_, p_149726_4_ - 1, SOUTH, true)) { - par1World.setBlockMetadataWithNotify(par2, par3, par4, 3, 2); + p_149726_1_.setBlockMetadataWithNotify(p_149726_2_, p_149726_3_, p_149726_4_, 3, 2); } -- else if (par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true)) -+ else if (par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH, true)) +- else if (p_149726_1_.func_147445_c(p_149726_2_, p_149726_3_, p_149726_4_ + 1, true)) ++ else if (p_149726_1_.isSideSolid(p_149726_2_, p_149726_3_, p_149726_4_ + 1, NORTH, true)) { - par1World.setBlockMetadataWithNotify(par2, par3, par4, 4, 2); + p_149726_1_.setBlockMetadataWithNotify(p_149726_2_, p_149726_3_, p_149726_4_, 4, 2); } -@@ -173,22 +180,22 @@ - int i1 = par1World.getBlockMetadata(par2, par3, par4); +@@ -143,22 +148,22 @@ + int l = p_150108_1_.getBlockMetadata(p_150108_2_, p_150108_3_, p_150108_4_); boolean flag = false; -- if (!par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true) && i1 == 1) -+ if (!par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST, true) && i1 == 1) +- if (!p_150108_1_.func_147445_c(p_150108_2_ - 1, p_150108_3_, p_150108_4_, true) && l == 1) ++ if (!p_150108_1_.isSideSolid(p_150108_2_ - 1, p_150108_3_, p_150108_4_, EAST, true) && l == 1) { flag = true; } -- if (!par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true) && i1 == 2) -+ if (!par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST, true) && i1 == 2) +- if (!p_150108_1_.func_147445_c(p_150108_2_ + 1, p_150108_3_, p_150108_4_, true) && l == 2) ++ if (!p_150108_1_.isSideSolid(p_150108_2_ + 1, p_150108_3_, p_150108_4_, WEST, true) && l == 2) { flag = true; } -- if (!par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true) && i1 == 3) -+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH, true) && i1 == 3) +- if (!p_150108_1_.func_147445_c(p_150108_2_, p_150108_3_, p_150108_4_ - 1, true) && l == 3) ++ if (!p_150108_1_.isSideSolid(p_150108_2_, p_150108_3_, p_150108_4_ - 1, SOUTH, true) && l == 3) { flag = true; } -- if (!par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true) && i1 == 4) -+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH, true) && i1 == 4) +- if (!p_150108_1_.func_147445_c(p_150108_2_, p_150108_3_, p_150108_4_ + 1, true) && l == 4) ++ if (!p_150108_1_.isSideSolid(p_150108_2_, p_150108_3_, p_150108_4_ + 1, NORTH, true) && l == 4) { flag = true; } diff --git a/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch b/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch index 481eb4014..1fef2c474 100644 --- a/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch @@ -1,56 +1,49 @@ --- ../src-base/minecraft/net/minecraft/block/BlockTrapDoor.java +++ ../src-work/minecraft/net/minecraft/block/BlockTrapDoor.java -@@ -11,8 +11,13 @@ +@@ -11,9 +11,12 @@ + import net.minecraft.util.Vec3; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; ++import net.minecraftforge.common.util.ForgeDirection; -+import net.minecraftforge.common.ForgeDirection; -+ public class BlockTrapDoor extends Block { + /** Set this to allow trapdoors to remain free-floating */ + public static boolean disableValidation = false; -+ - protected BlockTrapDoor(int par1, Material par2Material) - { - super(par1, par2Material); -@@ -194,7 +199,7 @@ - --j1; + private static final String __OBFID = "CL_00000327"; + + protected BlockTrapDoor(Material p_i45434_1_) +@@ -163,7 +166,7 @@ + --i1; } -- if (!isValidSupportBlock(par1World.getBlockId(j1, par3, k1))) -+ if (!(isValidSupportBlock(par1World.getBlockId(j1, par3, k1)) || par1World.isBlockSolidOnSide(j1, par3, k1, ForgeDirection.getOrientation((i1 & 3) + 2)))) +- if (!func_150119_a(p_149695_1_.func_147439_a(i1, p_149695_3_, j1))) ++ if (!func_150119_a(p_149695_1_.func_147439_a(i1, p_149695_3_, j1)) || p_149695_1_.isSideSolid(i1, p_149695_3_, j1, ForgeDirection.getOrientation((l & 3) + 2))) { - par1World.setBlockToAir(par2, par3, par4); - this.dropBlockAsItem(par1World, par2, par3, par4, i1, 0); -@@ -259,6 +264,10 @@ - */ - public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5) + p_149695_1_.func_147468_f(p_149695_2_, p_149695_3_, p_149695_4_); + this.func_149697_b(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, l, 0); +@@ -218,6 +221,7 @@ + + public boolean func_149707_d(World p_149707_1_, int p_149707_2_, int p_149707_3_, int p_149707_4_, int p_149707_5_) { -+ if (disableValidation) -+ { -+ return true; -+ } - if (par5 == 0) ++ if (disableValidation) return true; + if (p_149707_5_ == 0) { return false; -@@ -289,7 +298,7 @@ - --par2; +@@ -248,7 +252,7 @@ + --p_149707_2_; } -- return isValidSupportBlock(par1World.getBlockId(par2, par3, par4)); -+ return isValidSupportBlock(par1World.getBlockId(par2, par3, par4)) || par1World.isBlockSolidOnSide(par2, par3, par4, ForgeDirection.UP); +- return func_150119_a(p_149707_1_.func_147439_a(p_149707_2_, p_149707_3_, p_149707_4_)); ++ return func_150119_a(p_149707_1_.func_147439_a(p_149707_2_, p_149707_3_, p_149707_4_)) || p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_, p_149707_4_, ForgeDirection.UP); } } -@@ -304,6 +313,10 @@ - */ - private static boolean isValidSupportBlock(int par0) +@@ -259,6 +263,7 @@ + + private static boolean func_150119_a(Block p_150119_0_) { -+ if (disableValidation) -+ { -+ return true; -+ } - if (par0 <= 0) - { - return false; ++ if (disableValidation) return true; + return p_150119_0_.field_149764_J.isOpaque() && p_150119_0_.func_149686_d() || p_150119_0_ == Blocks.glowstone || p_150119_0_ instanceof BlockSlab || p_150119_0_ 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 000000000..08b97c0d3 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockTripWireHook.java.patch @@ -0,0 +1,96 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockTripWireHook.java ++++ ../src-work/minecraft/net/minecraft/block/BlockTripWireHook.java +@@ -9,6 +9,9 @@ + import net.minecraft.world.IBlockAccess; + import net.minecraft.world.World; + ++import net.minecraftforge.common.util.ForgeDirection; ++import static net.minecraftforge.common.util.ForgeDirection.*; ++ + public class BlockTripWireHook extends Block + { + private static final String __OBFID = "CL_00000329"; +@@ -47,34 +50,41 @@ + + public boolean func_149707_d(World p_149707_1_, int p_149707_2_, int p_149707_3_, int p_149707_4_, int p_149707_5_) + { +- return p_149707_5_ == 2 && p_149707_1_.func_147439_a(p_149707_2_, p_149707_3_, p_149707_4_ + 1).func_149721_r() ? true : (p_149707_5_ == 3 && p_149707_1_.func_147439_a(p_149707_2_, p_149707_3_, p_149707_4_ - 1).func_149721_r() ? true : (p_149707_5_ == 4 && p_149707_1_.func_147439_a(p_149707_2_ + 1, p_149707_3_, p_149707_4_).func_149721_r() ? true : p_149707_5_ == 5 && p_149707_1_.func_147439_a(p_149707_2_ - 1, p_149707_3_, p_149707_4_).func_149721_r())); ++ ForgeDirection dir = ForgeDirection.getOrientation(p_149707_5_); ++ return (dir == NORTH && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_, p_149707_4_ + 1, NORTH)) || ++ (dir == SOUTH && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_, p_149707_4_ - 1, SOUTH)) || ++ (dir == WEST && p_149707_1_.isSideSolid(p_149707_2_ + 1, p_149707_3_, p_149707_4_, WEST )) || ++ (dir == EAST && p_149707_1_.isSideSolid(p_149707_2_ - 1, p_149707_3_, p_149707_4_, EAST )); + } + + public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) + { +- return p_149742_1_.func_147439_a(p_149742_2_ - 1, p_149742_3_, p_149742_4_).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_ + 1, p_149742_3_, p_149742_4_).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_ - 1).func_149721_r() ? true : p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_ + 1).func_149721_r())); ++ return p_149742_1_.isSideSolid(p_149742_2_ - 1, p_149742_3_, p_149742_4_, EAST ) || ++ p_149742_1_.isSideSolid(p_149742_2_ + 1, p_149742_3_, p_149742_4_, WEST ) || ++ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ - 1, SOUTH) || ++ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ + 1, NORTH); + } + + public int func_149660_a(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_) + { + byte b0 = 0; + +- if (p_149660_5_ == 2 && p_149660_1_.func_147445_c(p_149660_2_, p_149660_3_, p_149660_4_ + 1, true)) ++ if (p_149660_5_ == 2 && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ + 1, NORTH, true)) + { + b0 = 2; + } + +- if (p_149660_5_ == 3 && p_149660_1_.func_147445_c(p_149660_2_, p_149660_3_, p_149660_4_ - 1, true)) ++ if (p_149660_5_ == 3 && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ - 1, SOUTH, true)) + { + b0 = 0; + } + +- if (p_149660_5_ == 4 && p_149660_1_.func_147445_c(p_149660_2_ + 1, p_149660_3_, p_149660_4_, true)) ++ if (p_149660_5_ == 4 && p_149660_1_.isSideSolid(p_149660_2_ + 1, p_149660_3_, p_149660_4_, WEST, true)) + { + b0 = 1; + } + +- if (p_149660_5_ == 5 && p_149660_1_.func_147445_c(p_149660_2_ - 1, p_149660_3_, p_149660_4_, true)) ++ if (p_149660_5_ == 5 && p_149660_1_.isSideSolid(p_149660_2_ - 1, p_149660_3_, p_149660_4_, EAST, true)) + { + b0 = 3; + } +@@ -97,22 +107,22 @@ + int i1 = l & 3; + boolean flag = false; + +- if (!p_149695_1_.func_147439_a(p_149695_2_ - 1, p_149695_3_, p_149695_4_).func_149721_r() && i1 == 3) ++ if (!p_149695_1_.isSideSolid(p_149695_2_ - 1, p_149695_3_, p_149695_4_, EAST) && i1 == 3) + { + flag = true; + } + +- if (!p_149695_1_.func_147439_a(p_149695_2_ + 1, p_149695_3_, p_149695_4_).func_149721_r() && i1 == 1) ++ if (!p_149695_1_.isSideSolid(p_149695_2_ + 1, p_149695_3_, p_149695_4_, WEST) && i1 == 1) + { + flag = true; + } + +- if (!p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_, p_149695_4_ - 1).func_149721_r() && i1 == 0) ++ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_, p_149695_4_ - 1, SOUTH) && i1 == 0) + { + flag = true; + } + +- if (!p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_, p_149695_4_ + 1).func_149721_r() && i1 == 2) ++ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_, p_149695_4_ + 1, NORTH) && i1 == 2) + { + flag = true; + } +@@ -133,7 +143,7 @@ + boolean flag3 = (p_150136_6_ & 8) == 8; + boolean flag4 = !p_150136_5_; + boolean flag5 = false; +- boolean flag6 = !World.func_147466_a(p_150136_1_, p_150136_2_, p_150136_3_ - 1, p_150136_4_); ++ boolean flag6 = !p_150136_1_.isSideSolid(p_150136_2_, p_150136_3_ - 1, p_150136_4_, UP); + int l1 = Direction.offsetX[k1]; + int i2 = Direction.offsetZ[k1]; + int j2 = 0; diff --git a/patches/minecraft/net/minecraft/block/BlockTripWireSource.java.patch b/patches/minecraft/net/minecraft/block/BlockTripWireSource.java.patch deleted file mode 100644 index e758d60fe..000000000 --- a/patches/minecraft/net/minecraft/block/BlockTripWireSource.java.patch +++ /dev/null @@ -1,100 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockTripWireSource.java -+++ ../src-work/minecraft/net/minecraft/block/BlockTripWireSource.java -@@ -8,6 +8,9 @@ - import net.minecraft.world.IBlockAccess; - import net.minecraft.world.World; - -+import net.minecraftforge.common.ForgeDirection; -+import static net.minecraftforge.common.ForgeDirection.*; -+ - public class BlockTripWireSource extends Block - { - public BlockTripWireSource(int par1) -@@ -64,7 +67,11 @@ - */ - public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5) - { -- return par5 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1) ? true : (par5 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : (par5 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : par5 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4))); -+ ForgeDirection dir = ForgeDirection.getOrientation(par5); -+ return (dir == NORTH && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH)) || -+ (dir == SOUTH && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH)) || -+ (dir == WEST && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST )) || -+ (dir == EAST && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST )); - } - - /** -@@ -72,7 +79,10 @@ - */ - public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) - { -- return par1World.isBlockNormalCube(par2 - 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : par1World.isBlockNormalCube(par2, par3, par4 + 1))); -+ return par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST ) || -+ par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST ) || -+ par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH) || -+ par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH); - } - - /** -@@ -82,22 +92,22 @@ - { - byte b0 = 0; - -- if (par5 == 2 && par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true)) -+ if (par5 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH, true)) - { - b0 = 2; - } - -- if (par5 == 3 && par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true)) -+ if (par5 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH, true)) - { - b0 = 0; - } - -- if (par5 == 4 && par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true)) -+ if (par5 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST, true)) - { - b0 = 1; - } - -- if (par5 == 5 && par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true)) -+ if (par5 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST, true)) - { - b0 = 3; - } -@@ -127,22 +137,22 @@ - int j1 = i1 & 3; - boolean flag = false; - -- if (!par1World.isBlockNormalCube(par2 - 1, par3, par4) && j1 == 3) -+ if (!par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST) && j1 == 3) - { - flag = true; - } - -- if (!par1World.isBlockNormalCube(par2 + 1, par3, par4) && j1 == 1) -+ if (!par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST) && j1 == 1) - { - flag = true; - } - -- if (!par1World.isBlockNormalCube(par2, par3, par4 - 1) && j1 == 0) -+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH) && j1 == 0) - { - flag = true; - } - -- if (!par1World.isBlockNormalCube(par2, par3, par4 + 1) && j1 == 2) -+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH) && j1 == 2) - { - flag = true; - } -@@ -163,7 +173,7 @@ - boolean flag2 = (par6 & 8) == 8; - boolean flag3 = par5 == Block.tripWireSource.blockID; - boolean flag4 = false; -- boolean flag5 = !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4); -+ boolean flag5 = !par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP); - int i2 = Direction.offsetX[l1]; - int j2 = Direction.offsetZ[l1]; - int k2 = 0; diff --git a/patches/minecraft/net/minecraft/block/BlockVine.java.patch b/patches/minecraft/net/minecraft/block/BlockVine.java.patch index 937df2a55..26c4bdd5a 100644 --- a/patches/minecraft/net/minecraft/block/BlockVine.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockVine.java.patch @@ -1,61 +1,60 @@ --- ../src-base/minecraft/net/minecraft/block/BlockVine.java +++ ../src-work/minecraft/net/minecraft/block/BlockVine.java -@@ -2,9 +2,12 @@ +@@ -2,9 +2,11 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -+ +import java.util.ArrayList; import java.util.Random; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; - import net.minecraft.item.Item; - import net.minecraft.item.ItemStack; -@@ -15,7 +18,9 @@ + import net.minecraft.init.Blocks; + import net.minecraft.init.Items; +@@ -16,8 +18,10 @@ + import net.minecraft.world.ColorizerFoliage; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; ++import net.minecraftforge.common.ForgeHooks; ++import net.minecraftforge.common.IShearable; -public class BlockVine extends Block -+import net.minecraftforge.common.IShearable; -+ +public class BlockVine extends Block implements IShearable { - public BlockVine(int par1) + private static final String __OBFID = "CL_00000330"; + +@@ -375,14 +379,28 @@ + + public void func_149636_a(World p_149636_1_, EntityPlayer p_149636_2_, int p_149636_3_, int p_149636_4_, int p_149636_5_, int p_149636_6_) { -@@ -440,14 +445,26 @@ - */ - public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) - { -- if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.itemID) -- { -- par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); -- this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(Block.vine, 1, 0)); +- if (!p_149636_1_.isRemote && p_149636_2_.getCurrentEquippedItem() != null && p_149636_2_.getCurrentEquippedItem().getItem() == Items.shears) + { +- p_149636_2_.addStat(StatList.mineBlockStatArray[Block.func_149682_b(this)], 1); +- this.func_149642_a(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, new ItemStack(Blocks.vine, 1, 0)); - } - else - { -- super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); -- } -+ super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); + super.func_149636_a(p_149636_1_, p_149636_2_, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_); + } } + + @Override -+ public boolean isShearable(ItemStack item, World world, int x, int y, int z) ++ public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z) + { + return true; + } + + @Override -+ public ArrayList onSheared(ItemStack item, World world, int x, int y, int z, int fortune) ++ public ArrayList onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune) + { + ArrayList ret = new ArrayList(); -+ ret.add(new ItemStack(this, 1, 0)); ++ ret.add(new ItemStack(this, 1)); + return ret; + } + + @Override -+ public boolean isLadder(World world, int x, int y, int z, EntityLivingBase entity) ++ public boolean isLadder(IBlockAccess world, int x, int y, int z, EntityLivingBase entity) + { + return true; + } diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch index 36a0f4001..456b77a16 100644 --- a/patches/minecraft/net/minecraft/client/Minecraft.java.patch +++ b/patches/minecraft/net/minecraft/client/Minecraft.java.patch @@ -1,10 +1,9 @@ --- ../src-base/minecraft/net/minecraft/client/Minecraft.java +++ ../src-work/minecraft/net/minecraft/client/Minecraft.java -@@ -137,6 +137,16 @@ - - import com.google.common.collect.MapDifference; - -+import net.minecraftforge.client.ClientCommandHandler; +@@ -134,6 +134,14 @@ + import net.minecraft.world.storage.ISaveFormat; + import net.minecraft.world.storage.ISaveHandler; + import net.minecraft.world.storage.WorldInfo; +import net.minecraftforge.client.ForgeHooksClient; +import net.minecraftforge.client.GuiIngameForge; +import net.minecraftforge.client.event.GuiOpenEvent; @@ -13,20 +12,19 @@ +import net.minecraftforge.event.ForgeEventFactory; +import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action; +import net.minecraftforge.event.world.WorldEvent; -+ - @SideOnly(Side.CLIENT) - public class Minecraft implements IPlayerUsage - { -@@ -308,7 +318,7 @@ + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; + import org.lwjgl.LWJGLException; +@@ -274,7 +282,7 @@ this.startTimerHackThread(); this.session = par1Session; - this.mcLogAgent.logInfo("Setting user: " + par1Session.getUsername()); -- this.mcLogAgent.logInfo("(Session ID is " + par1Session.getSessionID() + ")"); -+ //this.mcLogAgent.logInfo("(Session ID is " + par1Session.getSessionID() + ")"); //don't print the session to the console.. that's stupid... + field_147123_G.info("Setting user: " + par1Session.getUsername()); +- field_147123_G.info("(Session ID is " + par1Session.getSessionID() + ")"); ++ //field_147123_G.info("(Session ID is " + par1Session.getSessionID() + ")"); //don't print the session to the console.. that's stupid... this.isDemo = par5; this.displayWidth = par2; this.displayHeight = par3; -@@ -416,7 +426,7 @@ +@@ -447,7 +455,7 @@ try { @@ -35,7 +33,7 @@ } catch (LWJGLException lwjglexception) { -@@ -498,7 +508,7 @@ +@@ -547,7 +555,7 @@ this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine); FMLClientHandler.instance().finishMinecraftLoading(); this.checkGLError("Post startup"); @@ -44,69 +42,71 @@ if (this.serverName != null) { -@@ -680,11 +690,6 @@ - */ - public void displayGuiScreen(GuiScreen par1GuiScreen) +@@ -733,11 +741,6 @@ + + public void func_147108_a(GuiScreen p_147108_1_) { - if (this.currentScreen != null) - { -- this.currentScreen.onGuiClosed(); +- this.currentScreen.func_146281_b(); - } - - this.statFileWriter.syncStats(); - - if (par1GuiScreen == null && this.theWorld == null) -@@ -696,6 +701,20 @@ - par1GuiScreen = new GuiGameOver(); + if (p_147108_1_ == null && this.theWorld == null) + { + p_147108_1_ = new GuiMainMenu(); +@@ -747,6 +750,17 @@ + p_147108_1_ = new GuiGameOver(); } + GuiScreen old = this.currentScreen; -+ GuiOpenEvent event = new GuiOpenEvent(par1GuiScreen); ++ GuiOpenEvent event = new GuiOpenEvent(p_147108_1_); ++ ++ if (MinecraftForge.EVENT_BUS.post(event)) return; ++ ++ p_147108_1_ = event.gui; ++ if (old != null && p_147108_1_ != old) ++ { ++ old.func_146281_b(); ++ } + -+ if (MinecraftForge.EVENT_BUS.post(event)) -+ { -+ return; -+ } -+ -+ par1GuiScreen = event.gui; -+ if (old != null && par1GuiScreen != old) -+ { -+ old.onGuiClosed(); -+ } -+ - if (par1GuiScreen instanceof GuiMainMenu) + if (p_147108_1_ instanceof GuiMainMenu) { this.gameSettings.showDebugInfo = false; -@@ -1301,7 +1320,7 @@ +@@ -1337,7 +1351,7 @@ - if (this.thePlayer.isCurrentToolAdventureModeExempt(j, k, l)) - { -- this.effectRenderer.addBlockHitEffects(j, k, l, this.objectMouseOver.sideHit); -+ this.effectRenderer.addBlockHitEffects(j, k, l, this.objectMouseOver); - this.thePlayer.swingItem(); - } - } -@@ -1367,7 +1386,8 @@ - { - int j1 = itemstack != null ? itemstack.stackSize : 0; - -- if (this.playerController.onPlayerRightClick(this.thePlayer, this.theWorld, itemstack, j, k, l, i1, this.objectMouseOver.hitVec)) -+ boolean result = !ForgeEventFactory.onPlayerInteract(thePlayer, Action.RIGHT_CLICK_BLOCK, j, k, l, i1).isCanceled(); -+ if (result && this.playerController.onPlayerRightClick(this.thePlayer, this.theWorld, itemstack, j, k, l, i1, this.objectMouseOver.hitVec)) + if (this.thePlayer.isCurrentToolAdventureModeExempt(i, j, k)) { - flag = false; +- this.effectRenderer.addBlockHitEffects(i, j, k, this.objectMouseOver.sideHit); ++ this.effectRenderer.addBlockHitEffects(i, j, k, this.objectMouseOver); this.thePlayer.swingItem(); -@@ -1393,7 +1413,8 @@ - { - ItemStack itemstack1 = this.thePlayer.inventory.getCurrentItem(); - -- if (itemstack1 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, itemstack1)) -+ boolean result = !ForgeEventFactory.onPlayerInteract(thePlayer, Action.RIGHT_CLICK_AIR, 0, 0, 0, -1).isCanceled(); -+ if (result && itemstack1 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, itemstack1)) - { - this.entityRenderer.itemRenderer.resetEquippedProgress2(); + } } -@@ -1575,6 +1596,8 @@ +@@ -1418,11 +1432,12 @@ + int j = this.objectMouseOver.blockY; + int k = this.objectMouseOver.blockZ; + +- if (this.theWorld.func_147439_a(i, j, k).func_149688_o() != Material.field_151579_a) ++ if (!this.theWorld.func_147439_a(i, j, k).isAir(theWorld, i, j, k)) + { + int l = itemstack != null ? itemstack.stackSize : 0; + +- if (this.playerController.onPlayerRightClick(this.thePlayer, this.theWorld, itemstack, i, j, k, this.objectMouseOver.sideHit, this.objectMouseOver.hitVec)) ++ boolean result = !ForgeEventFactory.onPlayerInteract(thePlayer, Action.RIGHT_CLICK_BLOCK, j, k, l, this.objectMouseOver.sideHit).isCanceled(); ++ if (result && this.playerController.onPlayerRightClick(this.thePlayer, this.theWorld, itemstack, j, k, l, this.objectMouseOver.sideHit, this.objectMouseOver.hitVec)) + { + flag = false; + this.thePlayer.swingItem(); +@@ -1449,7 +1464,8 @@ + { + ItemStack itemstack1 = this.thePlayer.inventory.getCurrentItem(); + +- if (itemstack1 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, itemstack1)) ++ boolean result = !ForgeEventFactory.onPlayerInteract(thePlayer, Action.RIGHT_CLICK_AIR, 0, 0, 0, -1).isCanceled(); ++ if (result && itemstack1 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, itemstack1)) + { + this.entityRenderer.itemRenderer.resetEquippedProgress2(); + } +@@ -1651,6 +1667,8 @@ while (Mouse.next()) { @@ -115,10 +115,10 @@ i = Mouse.getEventButton(); if (isRunningOnMac && i == 0 && (Keyboard.isKeyDown(29) || Keyboard.isKeyDown(157))) -@@ -2047,6 +2070,11 @@ +@@ -2120,6 +2138,11 @@ + // JAVADOC METHOD $$ func_71353_a + public void loadWorld(WorldClient par1WorldClient, String par2Str) { - this.statFileWriter.syncStats(); - + if (theWorld != null) + { + MinecraftForge.EVENT_BUS.post(new WorldEvent.Unload(theWorld)); @@ -126,12 +126,12 @@ + if (par1WorldClient == null) { - NetClientHandler netclienthandler = this.getNetHandler(); -@@ -2064,6 +2092,18 @@ + NetHandlerPlayClient nethandlerplayclient = this.func_147114_u(); +@@ -2132,6 +2155,18 @@ if (this.theIntegratedServer != null) { this.theIntegratedServer.initiateShutdown(); -+ if (loadingScreen!=null) ++ if (loadingScreen != null) + { + this.loadingScreen.resetProgresAndWorkingMessage("Shutting down internal server..."); + } @@ -146,76 +146,66 @@ } this.theIntegratedServer = null; -@@ -2226,7 +2266,7 @@ - */ - public boolean handleClientCommand(String par1Str) - { -- return false; -+ return ClientCommandHandler.instance.executeCommand(thePlayer, par1Str) == 1; - } - - /** -@@ -2237,108 +2277,13 @@ +@@ -2286,113 +2321,10 @@ if (this.objectMouseOver != null) { boolean flag = this.thePlayer.capabilities.isCreativeMode; - int i = 0; - boolean flag1 = false; -- int j; - int k; +- Item item; + int j; -- if (this.objectMouseOver.typeOfHit == EnumMovingObjectType.TILE) -+ if (!ForgeHooks.onPickBlock(this.objectMouseOver, this.thePlayer, this.theWorld)) - { -- k = this.objectMouseOver.blockX; -- int l = this.objectMouseOver.blockY; -- int i1 = this.objectMouseOver.blockZ; -- Block block = Block.blocksList[this.theWorld.getBlockId(k, l, i1)]; +- if (this.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) +- { +- j = this.objectMouseOver.blockX; +- int k = this.objectMouseOver.blockY; +- int l = this.objectMouseOver.blockZ; +- Block block = this.theWorld.func_147439_a(j, k, l); - -- if (block == null) +- if (block.func_149688_o() == Material.field_151579_a) - { - return; - } - -- j = block.idPicked(this.theWorld, k, l, i1); +- item = block.func_149694_d(this.theWorld, j, k, l); - -- if (j == 0) +- if (item == null) - { - return; - } - -- flag1 = Item.itemsList[j].getHasSubtypes(); -- int j1 = j < 256 && !Block.blocksList[block.blockID].isFlowerPot() ? j : block.blockID; -- i = Block.blocksList[j1].getDamageValue(this.theWorld, k, l, i1); -+ return; - } +- flag1 = item.getHasSubtypes(); +- Block block1 = item instanceof ItemBlock && !block.func_149648_K() ? Block.func_149634_a(item) : block; +- i = block1.func_149643_k(this.theWorld, j, k, l); +- } - else - { -- if (this.objectMouseOver.typeOfHit != EnumMovingObjectType.ENTITY || this.objectMouseOver.entityHit == null || !flag) +- if (this.objectMouseOver.typeOfHit != MovingObjectPosition.MovingObjectType.ENTITY || this.objectMouseOver.entityHit == null || !flag) - { - return; - } - +- - if (this.objectMouseOver.entityHit instanceof EntityPainting) - { -- j = Item.painting.itemID; +- item = Items.painting; - } - else if (this.objectMouseOver.entityHit instanceof EntityLeashKnot) - { -- j = Item.leash.itemID; +- item = Items.lead; - } - else if (this.objectMouseOver.entityHit instanceof EntityItemFrame) - { - EntityItemFrame entityitemframe = (EntityItemFrame)this.objectMouseOver.entityHit; +- ItemStack itemstack = entityitemframe.getDisplayedItem(); - -- if (entityitemframe.getDisplayedItem() == null) +- if (itemstack == null) - { -- j = Item.itemFrame.itemID; +- item = Items.item_frame; - } - else - { -- j = entityitemframe.getDisplayedItem().itemID; -- i = entityitemframe.getDisplayedItem().getItemDamage(); +- item = itemstack.getItem(); +- i = itemstack.getItemDamage(); - flag1 = true; - } - } @@ -225,32 +215,36 @@ - - if (entityminecart.getMinecartType() == 2) - { -- j = Item.minecartPowered.itemID; +- item = Items.furnace_minecart; - } - else if (entityminecart.getMinecartType() == 1) - { -- j = Item.minecartCrate.itemID; +- item = Items.chest_minecart; - } - else if (entityminecart.getMinecartType() == 3) - { -- j = Item.minecartTnt.itemID; +- item = Items.tnt_minecart; - } - else if (entityminecart.getMinecartType() == 5) - { -- j = Item.minecartHopper.itemID; +- item = Items.hopper_minecart; +- } +- else if (entityminecart.getMinecartType() == 6) +- { +- item = Items.command_block_minecart; - } - else - { -- j = Item.minecartEmpty.itemID; +- item = Items.minecart; - } - } - else if (this.objectMouseOver.entityHit instanceof EntityBoat) - { -- j = Item.boat.itemID; +- item = Items.boat; - } - else - { -- j = Item.monsterPlacer.itemID; +- item = Items.spawn_egg; - i = EntityList.getEntityID(this.objectMouseOver.entityHit); - flag1 = true; - @@ -261,20 +255,20 @@ - } - } - -- this.thePlayer.inventory.setCurrentItem(j, i, flag1, flag); +- this.thePlayer.inventory.func_146030_a(item, i, flag1, flag); - ++ if (!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) { - k = this.thePlayer.inventoryContainer.inventorySlots.size() - 9 + this.thePlayer.inventory.currentItem; -@@ -2420,11 +2365,18 @@ + j = this.thePlayer.inventoryContainer.inventorySlots.size() - 9 + this.thePlayer.inventory.currentItem; +@@ -2562,9 +2494,16 @@ par1PlayerUsageSnooper.addData("gl_max_texture_size", Integer.valueOf(getGLMaximumTextureSize())); } + //Forge: Adds a optimization to the getGLMaximumTextureSize, only calculate it once. + private static int max_texture_size = -1; - /** - * Used in the usage snooper. - */ + // JAVADOC METHOD $$ func_71369_N public static int getGLMaximumTextureSize() { + if (max_texture_size != -1) @@ -285,7 +279,7 @@ 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); -@@ -2432,6 +2384,7 @@ +@@ -2572,6 +2511,7 @@ if (j != 0) { diff --git a/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch b/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch index 34e7355a3..9c60d31aa 100644 --- a/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch +++ b/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch @@ -1,102 +1,30 @@ --- ../src-base/minecraft/net/minecraft/client/audio/SoundManager.java +++ ../src-work/minecraft/net/minecraft/client/audio/SoundManager.java -@@ -1,5 +1,9 @@ - package net.minecraft.client.audio; +@@ -35,6 +35,11 @@ + import paulscode.sound.codecs.CodecJOrbis; + import paulscode.sound.libraries.LibraryLWJGLOpenAL; +import net.minecraftforge.client.*; +import net.minecraftforge.client.event.sound.*; +import net.minecraftforge.common.MinecraftForge; +import static net.minecraftforge.client.event.sound.SoundEvent.*; - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; - import java.io.File; -@@ -62,9 +66,11 @@ - private Random rand = new Random(); - private int ticksBeforeMusic; - -+ public static int MUSIC_INTERVAL = 12000; + - public SoundManager(ResourceManager par1ResourceManager, GameSettings par2GameSettings, File par3File) - { -- this.ticksBeforeMusic = this.rand.nextInt(12000); -+ this.ticksBeforeMusic = this.rand.nextInt(MUSIC_INTERVAL); - this.options = par2GameSettings; - this.fileAssets = par3File; - this.soundPoolSounds = new SoundPool(par1ResourceManager, "sound", true); -@@ -76,6 +82,7 @@ + @SideOnly(Side.CLIENT) + public class SoundManager + { +@@ -69,6 +74,7 @@ + { SoundSystemConfig.addLibrary(LibraryLWJGLOpenAL.class); SoundSystemConfig.setCodec("ogg", CodecJOrbis.class); - SoundSystemConfig.setCodec("wav", CodecWav.class); + MinecraftForge.EVENT_BUS.post(new SoundSetupEvent(this)); } catch (SoundSystemException soundsystemexception) { -@@ -92,6 +99,7 @@ - this.stopAllSounds(); - this.cleanup(); - this.tryToSetLibraryAndCodecs(); +@@ -80,6 +86,7 @@ + { + this.func_148613_b(); + this.func_148608_i(); + MinecraftForge.EVENT_BUS.post(new SoundLoadEvent(this)); } - private void loadSounds() -@@ -238,10 +246,11 @@ - else - { - SoundPoolEntry soundpoolentry = this.soundPoolMusic.getRandomSound(); -+ soundpoolentry = SoundEvent.getResult(new PlayBackgroundMusicEvent(this, soundpoolentry)); - - if (soundpoolentry != null) - { -- this.ticksBeforeMusic = this.rand.nextInt(12000) + 12000; -+ this.ticksBeforeMusic = this.rand.nextInt(MUSIC_INTERVAL) + MUSIC_INTERVAL; - this.sndSystem.backgroundMusic("BgMusic", soundpoolentry.getSoundUrl(), soundpoolentry.getSoundName(), false); - this.sndSystem.setVolume("BgMusic", this.options.musicVolume); - this.sndSystem.play("BgMusic"); -@@ -309,6 +318,7 @@ - if (par1Str != null) - { - SoundPoolEntry soundpoolentry = this.soundPoolStreaming.getRandomSoundFromSoundPool(par1Str); -+ soundpoolentry = SoundEvent.getResult(new PlayStreamingEvent(this, soundpoolentry, par1Str, par2, par3, par4)); - - if (soundpoolentry != null) - { -@@ -319,6 +329,7 @@ - - this.sndSystem.newStreamingSource(true, s1, soundpoolentry.getSoundUrl(), soundpoolentry.getSoundName(), false, par2, par3, par4, 2, 64.0F); - this.sndSystem.setVolume(s1, 0.5F * this.options.soundVolume); -+ MinecraftForge.EVENT_BUS.post(new PlayStreamingSourceEvent(this, s1, par2, par3, par4)); - this.sndSystem.play(s1); - } - } -@@ -487,6 +498,7 @@ - if (this.loaded && this.options.soundVolume != 0.0F) - { - SoundPoolEntry soundpoolentry = this.soundPoolSounds.getRandomSoundFromSoundPool(par1Str); -+ soundpoolentry = SoundEvent.getResult(new PlaySoundEvent(this, soundpoolentry, par1Str, par2, par3, par4, par5, par6)); - - if (soundpoolentry != null && par5 > 0.0F) - { -@@ -508,6 +520,7 @@ - - this.sndSystem.setPitch(s1, par6); - this.sndSystem.setVolume(s1, par5 * this.options.soundVolume); -+ MinecraftForge.EVENT_BUS.post(new PlaySoundSourceEvent(this, s1, par2, par3, par4)); - this.sndSystem.play(s1); - } - } -@@ -522,6 +535,7 @@ - if (this.loaded && this.options.soundVolume != 0.0F) - { - SoundPoolEntry soundpoolentry = this.soundPoolSounds.getRandomSoundFromSoundPool(par1Str); -+ soundpoolentry = SoundEvent.getResult(new PlaySoundEffectEvent(this, soundpoolentry, par1Str, par2, par3)); - - if (soundpoolentry != null && par2 > 0.0F) - { -@@ -537,6 +551,7 @@ - par2 *= 0.25F; - this.sndSystem.setPitch(s1, par3); - this.sndSystem.setVolume(s1, par2 * this.options.soundVolume); -+ MinecraftForge.EVENT_BUS.post(new PlaySoundEffectSourceEvent(this, s1)); - this.sndSystem.play(s1); - } - } + private synchronized void func_148608_i() diff --git a/patches/minecraft/net/minecraft/client/entity/EntityOtherPlayerMP.java.patch b/patches/minecraft/net/minecraft/client/entity/EntityOtherPlayerMP.java.patch index ca165dc7a..2a3300fd4 100644 --- a/patches/minecraft/net/minecraft/client/entity/EntityOtherPlayerMP.java.patch +++ b/patches/minecraft/net/minecraft/client/entity/EntityOtherPlayerMP.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/entity/EntityOtherPlayerMP.java +++ ../src-work/minecraft/net/minecraft/client/entity/EntityOtherPlayerMP.java -@@ -170,7 +170,8 @@ +@@ -157,7 +157,8 @@ } } diff --git a/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch b/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch index 09410ab15..80b87a3f5 100644 --- a/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch +++ b/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch @@ -1,7 +1,7 @@ --- ../src-base/minecraft/net/minecraft/client/entity/EntityPlayerSP.java +++ ../src-work/minecraft/net/minecraft/client/entity/EntityPlayerSP.java -@@ -49,6 +49,9 @@ - import net.minecraft.util.MovementInput; +@@ -50,6 +50,9 @@ + import net.minecraft.util.ResourceLocation; import net.minecraft.util.Session; import net.minecraft.world.World; +import net.minecraftforge.client.ForgeHooksClient; @@ -10,7 +10,7 @@ @SideOnly(Side.CLIENT) public class EntityPlayerSP extends AbstractClientPlayer -@@ -343,7 +346,7 @@ +@@ -331,7 +334,7 @@ f *= 1.0F - f1 * 0.15F; } @@ -18,26 +18,37 @@ + return ForgeHooksClient.getOffsetFOV(this, f); } - /** -@@ -570,18 +573,66 @@ - */ - protected boolean pushOutOfBlocks(double par1, double par3, double par5) + // JAVADOC METHOD $$ func_71053_j +@@ -494,20 +497,45 @@ + return this.worldObj.func_147439_a(par1, par2, par3).func_149721_r(); + } + ++ private boolean isHeadspaceFree(int x, int y, int z, int height) ++ { ++ for (int i1 = 0; i1 < height; i1++) ++ { ++ if (isBlockTranslucent(x, y + i1, z + 1)) return false; ++ } ++ return true; ++ } ++ + protected boolean func_145771_j(double p_145771_1_, double p_145771_3_, double p_145771_5_) { + if (this.noClip) + { + return false; + } - int i = MathHelper.floor_double(par1); - int j = MathHelper.floor_double(par3); - int k = MathHelper.floor_double(par5); - double d3 = par1 - (double)i; - double d4 = par5 - (double)k; + int i = MathHelper.floor_double(p_145771_1_); + int j = MathHelper.floor_double(p_145771_3_); + int k = MathHelper.floor_double(p_145771_5_); + double d3 = p_145771_1_ - (double)i; + double d4 = p_145771_5_ - (double)k; - if (this.isBlockTranslucent(i, j, k) || this.isBlockTranslucent(i, j + 1, k)) + int entHeight = Math.max(Math.round(this.height), 1); -+ ++ + boolean inTranslucentBlock = true; -+ ++ + for (int i1 = 0; i1 < entHeight; i1++) { - boolean flag = !this.isBlockTranslucent(i - 1, j, k) && !this.isBlockTranslucent(i - 1, j + 1, k); @@ -49,49 +60,17 @@ + inTranslucentBlock = false; + } + } -+ ++ + if (inTranslucentBlock) + { -+ boolean flag = true; -+ boolean flag1 = true; -+ boolean flag2 = true; -+ boolean flag3 = true; -+ for (int i1 = 0; i1 < entHeight; i1++) -+ { -+ if(this.isBlockTranslucent(i - 1, j + i1, k)) -+ { -+ flag = false; -+ break; -+ } -+ } -+ for (int i1 = 0; i1 < entHeight; i1++) -+ { -+ if(this.isBlockTranslucent(i + 1, j + i1, k)) -+ { -+ flag1 = false; -+ break; -+ } -+ } -+ for (int i1 = 0; i1 < entHeight; i1++) -+ { -+ if(this.isBlockTranslucent(i, j + i1, k - 1)) -+ { -+ flag2 = false; -+ break; -+ } -+ } -+ for (int i1 = 0; i1 < entHeight; i1++) -+ { -+ if(this.isBlockTranslucent(i, j + i1, k + 1)) -+ { -+ flag3 = false; -+ break; -+ } -+ } ++ boolean flag = !isHeadspaceFree(i - 1, j, k, entHeight); ++ boolean flag1 = !isHeadspaceFree(i + 1, j, k, entHeight); ++ boolean flag2 = !isHeadspaceFree(i, j, k - 1, entHeight); ++ boolean flag3 = !isHeadspaceFree(i, j, k + 1, entHeight); byte b0 = -1; double d5 = 9999.0D; -@@ -685,6 +736,12 @@ +@@ -595,6 +623,12 @@ public void playSound(String par1Str, float par2, float par3) { diff --git a/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch index cb3b93c56..ca485e7ae 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch @@ -1,36 +1,48 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiChat.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiChat.java -@@ -7,8 +7,11 @@ - import java.util.Iterator; - import java.util.List; - import net.minecraft.network.packet.Packet203AutoComplete; -+import net.minecraft.util.EnumChatFormatting; -+import net.minecraftforge.client.ClientCommandHandler; - import org.lwjgl.input.Keyboard; - import org.lwjgl.input.Mouse; +@@ -1,6 +1,7 @@ + package net.minecraft.client.gui; + + import com.google.common.collect.Lists; +import com.google.common.collect.ObjectArrays; - - @SideOnly(Side.CLIENT) - public class GuiChat extends GuiScreen -@@ -278,13 +281,14 @@ - this.mc.ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(stringbuilder.toString(), 1); - } - -- this.inputField.writeText((String)this.field_73904_o.get(this.field_73903_n++)); -+ this.inputField.writeText(EnumChatFormatting.func_110646_a((String)this.field_73904_o.get(this.field_73903_n++))); + import cpw.mods.fml.relauncher.Side; + import cpw.mods.fml.relauncher.SideOnly; + import java.io.File; +@@ -24,6 +25,7 @@ + import net.minecraft.util.ChatComponentTranslation; + import net.minecraft.util.EnumChatFormatting; + import net.minecraft.util.IChatComponent; ++import net.minecraftforge.client.ClientCommandHandler; + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; + import org.lwjgl.input.Keyboard; +@@ -134,6 +136,7 @@ + public void func_146403_a(String p_146403_1_) + { + this.field_146297_k.ingameGUI.func_146158_b().func_146239_a(p_146403_1_); ++ if (ClientCommandHandler.instance.executeCommand(field_146297_k.thePlayer, p_146403_1_) == 1) return; + this.field_146297_k.thePlayer.sendChatMessage(p_146403_1_); } - private void func_73893_a(String par1Str, String par2Str) - { - if (par1Str.length() >= 1) - { -+ ClientCommandHandler.instance.autoComplete(par1Str, par2Str); - this.mc.thePlayer.sendQueue.addToSendQueue(new Packet203AutoComplete(par1Str)); - this.field_73905_m = true; +@@ -309,13 +312,14 @@ + this.field_146297_k.ingameGUI.func_146158_b().func_146234_a(new ChatComponentText(stringbuilder.toString()), 1); } -@@ -347,6 +351,13 @@ - String[] astring1 = par1ArrayOfStr; - int i = par1ArrayOfStr.length; + +- this.field_146415_a.func_146191_b((String)this.field_146412_t.get(this.field_146413_s++)); ++ this.field_146415_a.func_146191_b(EnumChatFormatting.func_110646_a((String)this.field_146412_t.get(this.field_146413_s++))); + } + + private void func_146405_a(String p_146405_1_, String p_146405_2_) + { + if (p_146405_1_.length() >= 1) + { ++ ClientCommandHandler.instance.autoComplete(p_146405_1_, p_146405_2_); + this.field_146297_k.thePlayer.sendQueue.func_147297_a(new C14PacketTabComplete(p_146405_1_)); + this.field_146414_r = true; + } +@@ -438,6 +442,13 @@ + String[] astring1 = p_146406_1_; + int i = p_146406_1_.length; + String[] complete = ClientCommandHandler.instance.latestAutoComplete; + if (complete != null) diff --git a/patches/minecraft/net/minecraft/client/gui/GuiControls.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiControls.java.patch deleted file mode 100644 index 0eeaca8d5..000000000 --- a/patches/minecraft/net/minecraft/client/gui/GuiControls.java.patch +++ /dev/null @@ -1,114 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiControls.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiControls.java -@@ -7,6 +7,8 @@ - import net.minecraft.client.settings.KeyBinding; - import net.minecraft.util.EnumChatFormatting; - -+import net.minecraftforge.client.GuiControlsScrollPanel; -+ - @SideOnly(Side.CLIENT) - public class GuiControls extends GuiScreen - { -@@ -24,6 +26,8 @@ - /** The ID of the button that has been pressed. */ - private int buttonId = -1; - -+ private GuiControlsScrollPanel scrollPane; -+ - public GuiControls(GuiScreen par1GuiScreen, GameSettings par2GameSettings) - { - this.parentScreen = par1GuiScreen; -@@ -43,14 +47,9 @@ - */ - public void initGui() - { -- int i = this.getLeftBorder(); -- -- for (int j = 0; j < this.options.keyBindings.length; ++j) -- { -- this.buttonList.add(new GuiSmallButton(j, i + j % 2 * 160, this.height / 6 + 24 * (j >> 1), 70, 20, this.options.getOptionDisplayString(j))); -- } -- -- this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168, I18n.getString("gui.done"))); -+ scrollPane = new GuiControlsScrollPanel(this, options, mc); -+ this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height - 28, I18n.getString("gui.done"))); -+ scrollPane.registerScrollButtons(7, 8); - this.screenTitle = I18n.getString("controls.title"); - } - -@@ -59,20 +58,10 @@ - */ - protected void actionPerformed(GuiButton par1GuiButton) - { -- for (int i = 0; i < this.options.keyBindings.length; ++i) -- { -- ((GuiButton)this.buttonList.get(i)).displayString = this.options.getOptionDisplayString(i); -- } -- - if (par1GuiButton.id == 200) - { - this.mc.displayGuiScreen(this.parentScreen); - } -- else -- { -- this.buttonId = par1GuiButton.id; -- par1GuiButton.displayString = "> " + this.options.getOptionDisplayString(par1GuiButton.id) + " <"; -- } - } - - /** -@@ -80,17 +69,7 @@ - */ - protected void mouseClicked(int par1, int par2, int par3) - { -- if (this.buttonId >= 0) -- { -- this.options.setKeyBinding(this.buttonId, -100 + par3); -- ((GuiButton)this.buttonList.get(this.buttonId)).displayString = this.options.getOptionDisplayString(this.buttonId); -- this.buttonId = -1; -- KeyBinding.resetKeyBindingArrayAndHash(); -- } -- else -- { -- super.mouseClicked(par1, par2, par3); -- } -+ super.mouseClicked(par1, par2, par3); - } - - /** -@@ -98,15 +77,8 @@ - */ - protected void keyTyped(char par1, int par2) - { -- if (this.buttonId >= 0) -+ if (scrollPane.keyTyped(par1, par2)) - { -- this.options.setKeyBinding(this.buttonId, par2); -- ((GuiButton)this.buttonList.get(this.buttonId)).displayString = this.options.getOptionDisplayString(this.buttonId); -- this.buttonId = -1; -- KeyBinding.resetKeyBindingArrayAndHash(); -- } -- else -- { - super.keyTyped(par1, par2); - } - } -@@ -117,6 +89,7 @@ - public void drawScreen(int par1, int par2, float par3) - { - this.drawDefaultBackground(); -+ /* Forge Start: Moved all rendering to GuiControlsScrollPanel - this.drawCenteredString(this.fontRenderer, this.screenTitle, this.width / 2, 20, 16777215); - int k = this.getLeftBorder(); - int l = 0; -@@ -157,6 +130,10 @@ - break; - } - } -+ */ -+ scrollPane.drawScreen(par1, par2, par3); -+ drawCenteredString(fontRenderer, screenTitle, width / 2, 4, 0xffffff); -+ //Forge End - - super.drawScreen(par1, par2, par3); - } diff --git a/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch index 83b51860e..368e709b7 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch @@ -1,20 +1,20 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiCreateWorld.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiCreateWorld.java -@@ -376,7 +376,7 @@ +@@ -322,7 +322,7 @@ } - else if (par1GuiButton.id == 8) + else if (p_146284_1_.field_146127_k == 8) { -- this.mc.displayGuiScreen(new GuiCreateFlatWorld(this, this.generatorOptionsToUse)); -+ WorldType.worldTypes[this.worldTypeId].onCustomizeButton(this.mc, this); +- this.field_146297_k.func_147108_a(new GuiCreateFlatWorld(this, this.field_146334_a)); ++ WorldType.worldTypes[field_146331_K].onCustomizeButton(field_146297_k, this); } } } -@@ -394,7 +394,7 @@ - this.buttonBonusItems.drawButton = this.moreOptions; - this.buttonWorldType.drawButton = this.moreOptions; - this.buttonAllowCommands.drawButton = this.moreOptions; -- this.buttonCustomize.drawButton = this.moreOptions && WorldType.worldTypes[this.worldTypeId] == WorldType.FLAT; -+ this.buttonCustomize.drawButton = this.moreOptions && (WorldType.worldTypes[this.worldTypeId].isCustomizable()); +@@ -340,7 +340,7 @@ + this.field_146326_C.field_146125_m = this.field_146344_y; + this.field_146320_D.field_146125_m = this.field_146344_y; + this.field_146321_E.field_146125_m = this.field_146344_y; +- this.field_146322_F.field_146125_m = this.field_146344_y && WorldType.worldTypes[this.field_146331_K] == WorldType.FLAT; ++ this.field_146322_F.field_146125_m = this.field_146344_y && WorldType.worldTypes[this.field_146331_K].isCustomizable(); - if (this.moreOptions) + if (this.field_146344_y) { diff --git a/patches/minecraft/net/minecraft/client/gui/GuiIngame.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiIngame.java.patch deleted file mode 100644 index 3e8f7609f..000000000 --- a/patches/minecraft/net/minecraft/client/gui/GuiIngame.java.patch +++ /dev/null @@ -1,56 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiIngame.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiIngame.java -@@ -40,6 +40,8 @@ - import org.lwjgl.opengl.GL11; - import org.lwjgl.opengl.GL12; - -+import net.minecraftforge.common.ForgeHooks; -+ - @SideOnly(Side.CLIENT) - public class GuiIngame extends Gui - { -@@ -99,9 +101,16 @@ - - ItemStack itemstack = this.mc.thePlayer.inventory.armorItemInSlot(3); - -- if (this.mc.gameSettings.thirdPersonView == 0 && itemstack != null && itemstack.itemID == Block.pumpkin.blockID) -+ if (this.mc.gameSettings.thirdPersonView == 0 && itemstack != null && itemstack.getItem() != null) - { -- this.renderPumpkinBlur(k, l); -+ if (itemstack.itemID == Block.pumpkin.blockID) -+ { -+ this.renderPumpkinBlur(k, l); -+ } -+ else -+ { -+ itemstack.getItem().renderHelmetOverlay(itemstack, mc.thePlayer, scaledresolution, par1, par2, par3, par4); -+ } - } - - if (!this.mc.thePlayer.isPotionActive(Potion.confusion)) -@@ -275,6 +284,16 @@ - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - fontrenderer.drawStringWithShadow(s1, k1, i2, 16777215 + (j2 << 24)); -+ FontRenderer font = highlightingItemStack.getItem().getFontRenderer(highlightingItemStack); -+ if (font != null) -+ { -+ k1 = (k - font.getStringWidth(s1)) / 2; -+ font.drawStringWithShadow(s1, k1, i2, 16777215 + (j2 << 24)); -+ } -+ else -+ { -+ fontrenderer.drawStringWithShadow(s1, k1, i2, 16777215 + (j2 << 24)); -+ } - GL11.glDisable(GL11.GL_BLEND); - GL11.glPopMatrix(); - } -@@ -563,7 +582,7 @@ - int k2 = Math.max(10 - (j2 - 2), 3); - int l2 = i2 - (j2 - 1) * k2 - 10; - float f2 = f1; -- int i3 = this.mc.thePlayer.getTotalArmorValue(); -+ int i3 = ForgeHooks.getTotalArmorValue(mc.thePlayer); - int j3 = -1; - - if (this.mc.thePlayer.isPotionActive(Potion.regeneration)) diff --git a/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch new file mode 100644 index 000000000..bbc678506 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch @@ -0,0 +1,42 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiScreen.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiScreen.java +@@ -113,7 +113,9 @@ + } + } + ++ FontRenderer font = p_146285_1_.getItem().getFontRenderer(p_146285_1_); + this.func_146283_a(list, p_146285_2_, p_146285_3_); ++ drawHoveringText(list, p_146285_2_, p_146285_3_, (font == null ? field_146289_q : font)); + } + + protected void func_146279_a(String p_146279_1_, int p_146279_2_, int p_146279_3_) +@@ -123,6 +125,11 @@ + + protected void func_146283_a(List p_146283_1_, int p_146283_2_, int p_146283_3_) + { ++ drawHoveringText(p_146283_1_, p_146283_2_, p_146283_3_, field_146289_q); ++ } ++ ++ protected void drawHoveringText(List p_146283_1_, int p_146283_2_, int p_146283_3_, FontRenderer font) ++ { + if (!p_146283_1_.isEmpty()) + { + GL11.glDisable(GL12.GL_RESCALE_NORMAL); +@@ -135,7 +142,7 @@ + while (iterator.hasNext()) + { + String s = (String)iterator.next(); +- int l = this.field_146289_q.getStringWidth(s); ++ int l = font.getStringWidth(s); + + if (l > k) + { +@@ -180,7 +187,7 @@ + for (int i2 = 0; i2 < p_146283_1_.size(); ++i2) + { + String s1 = (String)p_146283_1_.get(i2); +- this.field_146289_q.drawStringWithShadow(s1, j2, k2, -1); ++ font.drawStringWithShadow(s1, j2, k2, -1); + + if (i2 == 0) + { diff --git a/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch index e7b2ad3d5..3ec68ae06 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch @@ -1,39 +1,39 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiSlot.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiSlot.java -@@ -331,16 +331,7 @@ +@@ -294,16 +294,7 @@ GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_FOG); Tessellator tessellator = Tessellator.instance; -- this.mc.getTextureManager().bindTexture(Gui.optionsBackground); +- this.field_148161_k.getTextureManager().bindTexture(Gui.optionsBackground); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - float f1 = 32.0F; - tessellator.startDrawingQuads(); - tessellator.setColorOpaque_I(2105376); -- tessellator.addVertexWithUV((double)this.left, (double)this.bottom, 0.0D, (double)((float)this.left / f1), (double)((float)(this.bottom + (int)this.amountScrolled) / f1)); -- tessellator.addVertexWithUV((double)this.right, (double)this.bottom, 0.0D, (double)((float)this.right / f1), (double)((float)(this.bottom + (int)this.amountScrolled) / f1)); -- tessellator.addVertexWithUV((double)this.right, (double)this.top, 0.0D, (double)((float)this.right / f1), (double)((float)(this.top + (int)this.amountScrolled) / f1)); -- tessellator.addVertexWithUV((double)this.left, (double)this.top, 0.0D, (double)((float)this.left / f1), (double)((float)(this.top + (int)this.amountScrolled) / f1)); +- tessellator.addVertexWithUV((double)this.field_148152_e, (double)this.field_148154_c, 0.0D, (double)((float)this.field_148152_e / f1), (double)((float)(this.field_148154_c + (int)this.field_148169_q) / f1)); +- tessellator.addVertexWithUV((double)this.field_148151_d, (double)this.field_148154_c, 0.0D, (double)((float)this.field_148151_d / f1), (double)((float)(this.field_148154_c + (int)this.field_148169_q) / f1)); +- tessellator.addVertexWithUV((double)this.field_148151_d, (double)this.field_148153_b, 0.0D, (double)((float)this.field_148151_d / f1), (double)((float)(this.field_148153_b + (int)this.field_148169_q) / f1)); +- tessellator.addVertexWithUV((double)this.field_148152_e, (double)this.field_148153_b, 0.0D, (double)((float)this.field_148152_e / f1), (double)((float)(this.field_148153_b + (int)this.field_148169_q) / f1)); - tessellator.draw(); + drawContainerBackground(tessellator); - j1 = this.width / 2 - 92 - 16; - k1 = this.top + 4 - (int)this.amountScrolled; + l1 = this.field_148152_e + this.field_148155_a / 2 - this.func_148139_c() / 2 + 2; + i2 = this.field_148153_b + 4 - (int)this.field_148169_q; -@@ -484,4 +475,18 @@ - tessellator.addVertexWithUV(0.0D, (double)par1, 0.0D, 0.0D, (double)((float)par1 / f)); - tessellator.draw(); +@@ -475,4 +466,18 @@ + { + return this.field_148149_f; } + -+ protected void drawContainerBackground(Tessellator tess) ++ protected void drawContainerBackground(Tessellator tessellator) + { -+ this.mc.getTextureManager().bindTexture(Gui.optionsBackground); ++ this.field_148161_k.getTextureManager().bindTexture(Gui.optionsBackground); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); -+ float height = 32.0F; -+ tess.startDrawingQuads(); -+ tess.setColorOpaque_I(2105376); -+ tess.addVertexWithUV((double)left, (double)bottom, 0.0D, (double)(left / height), (double)((bottom + (int)amountScrolled) / height)); -+ tess.addVertexWithUV((double)right, (double)bottom, 0.0D, (double)(right / height), (double)((bottom + (int)amountScrolled) / height)); -+ tess.addVertexWithUV((double)right, (double)top, 0.0D, (double)(right / height), (double)((top + (int)amountScrolled) / height)); -+ tess.addVertexWithUV((double)left, (double)top, 0.0D, (double)(left / height), (double)((top + (int)amountScrolled) / height)); -+ tess.draw(); ++ float f1 = 32.0F; ++ tessellator.startDrawingQuads(); ++ tessellator.setColorOpaque_I(2105376); ++ tessellator.addVertexWithUV((double)this.field_148152_e, (double)this.field_148154_c, 0.0D, (double)((float)this.field_148152_e / f1), (double)((float)(this.field_148154_c + (int)this.field_148169_q) / f1)); ++ tessellator.addVertexWithUV((double)this.field_148151_d, (double)this.field_148154_c, 0.0D, (double)((float)this.field_148151_d / f1), (double)((float)(this.field_148154_c + (int)this.field_148169_q) / f1)); ++ tessellator.addVertexWithUV((double)this.field_148151_d, (double)this.field_148153_b, 0.0D, (double)((float)this.field_148151_d / f1), (double)((float)(this.field_148153_b + (int)this.field_148169_q) / f1)); ++ tessellator.addVertexWithUV((double)this.field_148152_e, (double)this.field_148153_b, 0.0D, (double)((float)this.field_148152_e / f1), (double)((float)(this.field_148153_b + (int)this.field_148169_q) / f1)); ++ tessellator.draw(); + } } diff --git a/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch b/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch index 711d721bb..3bcc5de8b 100644 --- a/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch @@ -1,39 +1,30 @@ --- ../src-base/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java +++ ../src-work/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java -@@ -2,6 +2,9 @@ - - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; -+ -+import java.util.LinkedList; -+import java.util.List; - import java.util.Random; - import net.minecraft.block.Block; - import net.minecraft.client.Minecraft; -@@ -22,6 +25,8 @@ +@@ -24,6 +24,9 @@ + import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; - ++import java.util.LinkedList; ++import java.util.List; +import net.minecraftforge.common.AchievementPage; -+ + @SideOnly(Side.CLIENT) - public class GuiAchievements extends GuiScreen - { -@@ -60,6 +65,10 @@ - private int isMouseButtonDown; - private StatFileWriter statFileWriter; + public class GuiAchievements extends GuiScreen implements IProgressMeter +@@ -50,6 +53,10 @@ + private boolean field_146558_F = true; + private static final String __OBFID = "CL_00000722"; + private int currentPage = -1; -+ private GuiSmallButton button; ++ private GuiButton button; + private LinkedList minecraftAchievements = new LinkedList(); + - public GuiAchievements(StatFileWriter par1StatFileWriter) + public GuiAchievements(GuiScreen p_i45026_1_, StatFileWriter p_i45026_2_) { - this.statFileWriter = par1StatFileWriter; -@@ -67,6 +76,14 @@ + this.field_146562_a = p_i45026_1_; +@@ -58,6 +65,14 @@ short short2 = 141; - this.field_74117_m = this.guiMapX = this.field_74124_q = (double)(AchievementList.openInventory.displayColumn * 24 - short1 / 2 - 12); - this.field_74115_n = this.guiMapY = this.field_74123_r = (double)(AchievementList.openInventory.displayRow * 24 - short2 / 2); + this.field_146569_s = this.field_146567_u = this.field_146565_w = (double)(AchievementList.openInventory.displayColumn * 24 - short1 / 2 - 12); + this.field_146568_t = this.field_146566_v = this.field_146573_x = (double)(AchievementList.openInventory.displayRow * 24 - short2 / 2); + minecraftAchievements.clear(); + for (Object achievement : AchievementList.achievementList) + { @@ -44,57 +35,57 @@ + } } - /** -@@ -76,6 +93,7 @@ - { - this.buttonList.clear(); - this.buttonList.add(new GuiSmallButton(1, this.width / 2 + 24, this.height / 2 + 74, 80, 20, I18n.getString("gui.done"))); -+ this.buttonList.add(button = new GuiSmallButton(2, (width - achievementsPaneWidth) / 2 + 24, height / 2 + 74, 125, 20, AchievementPage.getTitle(currentPage))); + // JAVADOC METHOD $$ func_73866_w_ +@@ -66,6 +81,7 @@ + this.field_146297_k.func_147114_u().func_147297_a(new C16PacketClientStatus(C16PacketClientStatus.EnumState.REQUEST_STATS)); + this.field_146292_n.clear(); + this.field_146292_n.add(new GuiOptionButton(1, this.field_146294_l / 2 + 24, this.field_146295_m / 2 + 74, 80, 20, I18n.getStringParams("gui.done", new Object[0]))); ++ this.field_146292_n.add(button = new GuiButton(2, (field_146294_l - field_146555_f) / 2 + 24, field_146295_m / 2 + 74, 125, 20, AchievementPage.getTitle(currentPage))); } - /** -@@ -89,6 +107,16 @@ - this.mc.setIngameFocus(); - } - -+ if (par1GuiButton.id == 2) -+ { -+ currentPage++; -+ if (currentPage >= AchievementPage.getAchievementPages().size()) -+ { -+ currentPage = -1; -+ } -+ button.displayString = AchievementPage.getTitle(currentPage); -+ } + protected void func_146284_a(GuiButton p_146284_1_) +@@ -76,6 +92,16 @@ + { + this.field_146297_k.func_147108_a(this.field_146562_a); + } + - super.actionPerformed(par1GuiButton); ++ if (p_146284_1_.field_146127_k == 2) ++ { ++ currentPage++; ++ if (currentPage >= AchievementPage.getAchievementPages().size()) ++ { ++ currentPage = -1; ++ } ++ button.field_146126_j = AchievementPage.getTitle(currentPage); ++ } + } } -@@ -314,11 +342,12 @@ +@@ -343,11 +369,12 @@ int i4; - int j4; + int j5; - for (i3 = 0; i3 < AchievementList.achievementList.size(); ++i3) + List achievementList = (currentPage == -1 ? minecraftAchievements : AchievementPage.getAchievementPage(currentPage).getAchievements()); + for (i3 = 0; i3 < achievementList.size(); ++i3) { -- Achievement achievement = (Achievement)AchievementList.achievementList.get(i3); -+ Achievement achievement = achievementList.get(i3); +- Achievement achievement1 = (Achievement)AchievementList.achievementList.get(i3); ++ Achievement achievement1 = achievementList.get(i3); -- if (achievement.parentAchievement != null) -+ if (achievement.parentAchievement != null && achievementList.contains(achievement.parentAchievement)) +- if (achievement1.parentAchievement != null) ++ if (achievement1.parentAchievement != null && achievementList.contains(achievement1.parentAchievement)) { - k3 = achievement.displayColumn * 24 - k + 11 + k1; - j3 = achievement.displayRow * 24 - l + 11 + l1; -@@ -352,9 +381,9 @@ - int l4; + j3 = achievement1.displayColumn * 24 - k + 11; + k3 = achievement1.displayRow * 24 - l + 11; +@@ -404,9 +431,9 @@ int i5; + int l4; -- for (k3 = 0; k3 < AchievementList.achievementList.size(); ++k3) -+ for (k3 = 0; k3 < achievementList.size(); ++k3) +- for (j5 = 0; j5 < AchievementList.achievementList.size(); ++j5) ++ for (j5 = 0; j5 < achievementList.size(); ++j5) { -- Achievement achievement2 = (Achievement)AchievementList.achievementList.get(k3); -+ Achievement achievement2 = (Achievement)achievementList.get(k3); - j4 = achievement2.displayColumn * 24 - k; - l3 = achievement2.displayRow * 24 - l; +- Achievement achievement2 = (Achievement)AchievementList.achievementList.get(j5); ++ Achievement achievement2 = (Achievement)achievementList.get(j5); + l4 = achievement2.displayColumn * 24 - k; + i5 = achievement2.displayRow * 24 - l; diff --git a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch index 8b05df6e1..df5434a8b 100644 --- a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch @@ -1,76 +1,36 @@ --- ../src-base/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java +++ ../src-work/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java -@@ -8,6 +8,7 @@ - import java.util.List; +@@ -6,6 +6,7 @@ + import java.util.Iterator; import java.util.Set; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderHelper; -@@ -143,7 +144,11 @@ +@@ -114,7 +115,11 @@ } } + //Forge: Force lighting to be disabled as there are some issue where lighting would + //incorrectly be applied based on items that are in the inventory. + GL11.glDisable(GL11.GL_LIGHTING); - this.drawGuiContainerForegroundLayer(par1, par2); + this.func_146979_b(par1, par2); + GL11.glEnable(GL11.GL_LIGHTING); - InventoryPlayer inventoryplayer = this.mc.thePlayer.inventory; - ItemStack itemstack = this.draggedStack == null ? inventoryplayer.getItemStack() : this.draggedStack; + InventoryPlayer inventoryplayer = this.field_146297_k.thePlayer.inventory; + ItemStack itemstack = this.field_147012_x == null ? inventoryplayer.getItemStack() : this.field_147012_x; -@@ -207,8 +212,11 @@ +@@ -178,8 +183,11 @@ GL11.glTranslatef(0.0F, 0.0F, 32.0F); this.zLevel = 200.0F; - itemRenderer.zLevel = 200.0F; -- itemRenderer.renderItemAndEffectIntoGUI(this.fontRenderer, this.mc.getTextureManager(), par1ItemStack, par2, par3); -- itemRenderer.renderItemOverlayIntoGUI(this.fontRenderer, this.mc.getTextureManager(), par1ItemStack, par2, par3 - (this.draggedStack == null ? 0 : 8), par4Str); + field_146296_j.zLevel = 200.0F; +- field_146296_j.renderItemAndEffectIntoGUI(this.field_146289_q, this.field_146297_k.getTextureManager(), p_146982_1_, p_146982_2_, p_146982_3_); +- field_146296_j.renderItemOverlayIntoGUI(this.field_146289_q, this.field_146297_k.getTextureManager(), p_146982_1_, p_146982_2_, p_146982_3_ - (this.field_147012_x == null ? 0 : 8), p_146982_4_); + FontRenderer font = null; -+ if (par1ItemStack != null) font = par1ItemStack.getItem().getFontRenderer(par1ItemStack); -+ if (font == null) font = fontRenderer; -+ itemRenderer.renderItemAndEffectIntoGUI(font, this.mc.getTextureManager(), par1ItemStack, par2, par3); -+ itemRenderer.renderItemOverlayIntoGUI(font, this.mc.getTextureManager(), par1ItemStack, par2, par3 - (this.draggedStack == null ? 0 : 8), par4Str); ++ if (p_146982_1_ != null) font = p_146982_1_.getItem().getFontRenderer(p_146982_1_); ++ if (font == null) font = field_146289_q; ++ field_146296_j.renderItemAndEffectIntoGUI(font, this.field_146297_k.getTextureManager(), p_146982_1_, p_146982_2_, p_146982_3_); ++ field_146296_j.renderItemOverlayIntoGUI(font, this.field_146297_k.getTextureManager(), p_146982_1_, p_146982_2_, p_146982_3_ - (this.field_147012_x == null ? 0 : 8), p_146982_4_); this.zLevel = 0.0F; - itemRenderer.zLevel = 0.0F; + field_146296_j.zLevel = 0.0F; } -@@ -229,7 +237,8 @@ - } - } - -- this.func_102021_a(list, par2, par3); -+ FontRenderer font = par1ItemStack.getItem().getFontRenderer(par1ItemStack); -+ drawHoveringText(list, par2, par3, (font == null ? fontRenderer : font)); - } - - /** -@@ -243,6 +252,11 @@ - - protected void func_102021_a(List par1List, int par2, int par3) - { -+ drawHoveringText(par1List, par2, par3, fontRenderer); -+ } -+ -+ protected void drawHoveringText(List par1List, int par2, int par3, FontRenderer font) -+ { - if (!par1List.isEmpty()) - { - GL11.glDisable(GL12.GL_RESCALE_NORMAL); -@@ -255,7 +269,7 @@ - while (iterator.hasNext()) - { - String s = (String)iterator.next(); -- int l = this.fontRenderer.getStringWidth(s); -+ int l = font.getStringWidth(s); - - if (l > k) - { -@@ -300,7 +314,7 @@ - for (int k2 = 0; k2 < par1List.size(); ++k2) - { - String s1 = (String)par1List.get(k2); -- this.fontRenderer.drawStringWithShadow(s1, i1, j1, -1); -+ font.drawStringWithShadow(s1, i1, j1, -1); - - if (k2 == 0) - { diff --git a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch index 7f0043457..98cf1ad17 100644 --- a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch @@ -1,121 +1,127 @@ --- ../src-base/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java +++ ../src-work/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java -@@ -61,6 +61,8 @@ - private Slot field_74235_v; - private boolean field_74234_w; - private CreativeCrafting field_82324_x; +@@ -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 par1EntityPlayer) { -@@ -201,7 +203,7 @@ +@@ -186,7 +188,7 @@ return; } -- if (itemstack != null && itemstack2 != null && itemstack.isItemEqual(itemstack2)) -+ if (itemstack != null && itemstack2 != null && itemstack.isItemEqual(itemstack2) && ItemStack.areItemStackTagsEqual(itemstack, itemstack2)) //Forge: Bugfix, Compare NBT data, allow for deletion of enchanted books, MC-12770 +- 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 (par3 == 0) + if (p_146984_3_ == 0) { -@@ -279,6 +281,13 @@ - this.setCurrentCreativeTab(CreativeTabs.creativeTabArray[i]); - this.field_82324_x = new CreativeCrafting(this.mc); - this.mc.thePlayer.inventoryContainer.addCraftingToCrafters(this.field_82324_x); +@@ -262,6 +264,13 @@ + this.func_147050_b(CreativeTabs.creativeTabArray[i]); + this.field_147059_E = new CreativeCrafting(this.field_146297_k); + this.field_146297_k.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, ">")); ++ field_146292_n.add(new GuiButton(101, field_147003_i, field_147009_r - 50, 20, 20, "<")); ++ field_146292_n.add(new GuiButton(102, field_147003_i + field_146999_f - 20, field_147009_r - 50, 20, 20, ">")); + maxPages = ((tabCount - 12) / 10) + 1; + } } else { -@@ -306,7 +315,7 @@ - */ +@@ -284,7 +293,7 @@ + // JAVADOC METHOD $$ func_73869_a protected void keyTyped(char par1, int par2) { -- if (selectedTabIndex != CreativeTabs.tabAllSearch.getTabIndex()) -+ if (!CreativeTabs.creativeTabArray[selectedTabIndex].hasSearchBar()) +- if (field_147058_w != CreativeTabs.tabAllSearch.getTabIndex()) ++ if (!CreativeTabs.creativeTabArray[field_147058_w].hasSearchBar()) { - if (GameSettings.isKeyDown(this.mc.gameSettings.keyBindChat)) + if (GameSettings.isKeyDown(this.field_146297_k.gameSettings.keyBindChat)) { -@@ -343,6 +352,15 @@ +@@ -321,6 +330,15 @@ { - ContainerCreative containercreative = (ContainerCreative)this.inventorySlots; - containercreative.itemList.clear(); + GuiContainerCreative.ContainerCreative containercreative = (GuiContainerCreative.ContainerCreative)this.field_147002_h; + containercreative.field_148330_a.clear(); + -+ CreativeTabs tab = CreativeTabs.creativeTabArray[selectedTabIndex]; ++ CreativeTabs tab = CreativeTabs.creativeTabArray[field_147058_w]; + if (tab.hasSearchBar() && tab != CreativeTabs.tabAllSearch) + { -+ tab.displayAllReleventItems(containercreative.itemList); ++ tab.displayAllReleventItems(containercreative.field_148330_a); + updateFilteredItems(containercreative); + return; + } + - Item[] aitem = Item.itemsList; - int i = aitem.length; - int j; -@@ -369,7 +387,12 @@ - Item.enchantedBook.func_92113_a(enchantment, containercreative.itemList); + Iterator iterator = Item.field_150901_e.iterator(); + + while (iterator.hasNext()) +@@ -332,7 +350,13 @@ + item.func_150895_a(item, (CreativeTabs)null, containercreative.field_148330_a); } } + updateFilteredItems(containercreative); + } -+ //split from above for custom search tabs -+ private void updateFilteredItems(ContainerCreative containercreative) ++ //split from above for sutom search tabs ++ private void updateFilteredItems(GuiContainerCreative.ContainerCreative containercreative) + { - Iterator iterator = containercreative.itemList.iterator(); - String s = this.searchField.getText().toLowerCase(); ++ Iterator iterator; + Enchantment[] aenchantment = Enchantment.enchantmentsList; + int j = aenchantment.length; -@@ -413,7 +436,7 @@ +@@ -386,7 +410,7 @@ { - CreativeTabs creativetabs = CreativeTabs.creativeTabArray[selectedTabIndex]; + CreativeTabs creativetabs = CreativeTabs.creativeTabArray[field_147058_w]; - if (creativetabs.drawInForegroundOfTab()) + if (creativetabs != null && creativetabs.drawInForegroundOfTab()) { - this.fontRenderer.drawString(I18n.getString(creativetabs.getTranslatedTabLabel()), 8, 6, 4210752); - } -@@ -462,7 +485,7 @@ + GL11.glDisable(GL11.GL_BLEND); + this.field_146289_q.drawString(I18n.getStringParams(creativetabs.getTranslatedTabLabel(), new Object[0]), 8, 6, 4210752); +@@ -407,7 +431,7 @@ { CreativeTabs creativetabs = acreativetabs[k1]; -- if (this.func_74232_a(creativetabs, l, i1)) -+ if (creativetabs != null && func_74232_a(creativetabs, l, i1)) +- if (this.func_147049_a(creativetabs, l, i1)) ++ if (creativetabs != null && this.func_147049_a(creativetabs, l, i1)) { - this.setCurrentCreativeTab(creativetabs); return; -@@ -478,11 +501,17 @@ - */ - private boolean needsScrollBars() + } +@@ -430,7 +454,7 @@ + { + CreativeTabs creativetabs = acreativetabs[k1]; + +- if (this.func_147049_a(creativetabs, l, i1)) ++ if (creativetabs != null && this.func_147049_a(creativetabs, l, i1)) + { + this.func_147050_b(creativetabs); + return; +@@ -443,11 +467,13 @@ + + private boolean func_147055_p() { -+ if (CreativeTabs.creativeTabArray[selectedTabIndex] == null) return false; - return selectedTabIndex != CreativeTabs.tabInventory.getTabIndex() && CreativeTabs.creativeTabArray[selectedTabIndex].shouldHidePlayerInventory() && ((ContainerCreative)this.inventorySlots).hasMoreThan1PageOfItemsInList(); ++ if (CreativeTabs.creativeTabArray[field_147058_w] == null) return false; + return field_147058_w != CreativeTabs.tabInventory.getTabIndex() && CreativeTabs.creativeTabArray[field_147058_w].shouldHidePlayerInventory() && ((GuiContainerCreative.ContainerCreative)this.field_147002_h).func_148328_e(); } - private void setCurrentCreativeTab(CreativeTabs par1CreativeTabs) + private void func_147050_b(CreativeTabs p_147050_1_) { -+ if (par1CreativeTabs == null) -+ { -+ return; -+ } -+ - int i = selectedTabIndex; - selectedTabIndex = par1CreativeTabs.getTabIndex(); - ContainerCreative containercreative = (ContainerCreative)this.inventorySlots; -@@ -551,7 +580,7 @@ ++ if (p_147050_1_ == null) return; + int i = field_147058_w; + field_147058_w = p_147050_1_.getTabIndex(); + GuiContainerCreative.ContainerCreative containercreative = (GuiContainerCreative.ContainerCreative)this.field_147002_h; +@@ -516,7 +542,7 @@ - if (this.searchField != null) + if (this.field_147062_A != null) { -- if (par1CreativeTabs == CreativeTabs.tabAllSearch) -+ if (par1CreativeTabs.hasSearchBar()) +- if (p_147050_1_ == CreativeTabs.tabAllSearch) ++ if (p_147050_1_.hasSearchBar()) { - this.searchField.setVisible(true); - this.searchField.setCanLoseFocus(false); -@@ -653,23 +682,44 @@ + this.field_147062_A.func_146189_e(true); + this.field_147062_A.func_146205_d(false); +@@ -613,23 +639,45 @@ super.drawScreen(par1, par2, par3); CreativeTabs[] acreativetabs = CreativeTabs.creativeTabArray; @@ -130,40 +136,40 @@ { CreativeTabs creativetabs = acreativetabs[j2]; -- if (this.renderCreativeInventoryHoveringText(creativetabs, par1, par2)) -+ if (creativetabs != null && this.renderCreativeInventoryHoveringText(creativetabs, par1, par2)) ++ if (creativetabs == null) continue; + if (this.func_147052_b(creativetabs, par1, par2)) { + rendered = true; break; } } -+ if (!rendered && !renderCreativeInventoryHoveringText(CreativeTabs.tabAllSearch, par1, par2)) ++ if (!rendered && func_147052_b(CreativeTabs.tabAllSearch, par1, par2)) + { -+ renderCreativeInventoryHoveringText(CreativeTabs.tabInventory, par1, par2); ++ func_147052_b(CreativeTabs.tabInventory, par1, par2); + } + - if (this.field_74235_v != null && selectedTabIndex == CreativeTabs.tabInventory.getTabIndex() && this.isPointInRegion(this.field_74235_v.xDisplayPosition, this.field_74235_v.yDisplayPosition, 16, 16, par1, par2)) + if (this.field_147064_C != null && field_147058_w == CreativeTabs.tabInventory.getTabIndex() && this.func_146978_c(this.field_147064_C.xDisplayPosition, this.field_147064_C.yDisplayPosition, 16, 16, par1, par2)) { - this.drawCreativeTabHoveringText(I18n.getString("inventory.binSlot"), par1, par2); + this.func_146279_a(I18n.getStringParams("inventory.binSlot", new Object[0]), par1, par2); } + if (maxPages != 0) + { + String page = String.format("%d / %d", tabPage + 1, maxPages + 1); -+ int width = fontRenderer.getStringWidth(page); ++ int width = field_146289_q.getStringWidth(page); + GL11.glDisable(GL11.GL_LIGHTING); + this.zLevel = 300.0F; -+ itemRenderer.zLevel = 300.0F; -+ fontRenderer.drawString(page, guiLeft + (xSize / 2) - (width / 2), guiTop - 44, -1); ++ field_146296_j.zLevel = 300.0F; ++ field_146289_q.drawString(page, field_147003_i + (field_146999_f / 2) - (width / 2), field_147009_r - 44, -1); + this.zLevel = 0.0F; -+ itemRenderer.zLevel = 0.0F; ++ field_146296_j.zLevel = 0.0F; + } + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_LIGHTING); } -@@ -741,17 +791,35 @@ +@@ -698,17 +746,37 @@ int k = acreativetabs.length; int l; @@ -175,12 +181,13 @@ + for (l = start; l < k; ++l) { CreativeTabs creativetabs1 = acreativetabs[l]; - this.mc.getTextureManager().bindTexture(field_110424_t); + this.field_146297_k.getTextureManager().bindTexture(field_147061_u); -- if (creativetabs1.getTabIndex() != selectedTabIndex) -+ if (creativetabs1 != null && creativetabs1.getTabIndex() != selectedTabIndex) ++ if (creativetabs1 == null) continue; ++ + if (creativetabs1.getTabIndex() != field_147058_w) { - this.renderCreativeTab(creativetabs1); + this.func_147051_a(creativetabs1); } } @@ -188,21 +195,21 @@ + { + if (creativetabs != CreativeTabs.tabAllSearch) + { -+ this.mc.getTextureManager().bindTexture(field_110424_t); -+ renderCreativeTab(CreativeTabs.tabAllSearch); ++ this.field_146297_k.getTextureManager().bindTexture(field_147061_u); ++ func_147051_a(CreativeTabs.tabAllSearch); + } + if (creativetabs != CreativeTabs.tabInventory) + { -+ this.mc.getTextureManager().bindTexture(field_110424_t); -+ renderCreativeTab(CreativeTabs.tabInventory); ++ this.field_146297_k.getTextureManager().bindTexture(field_147061_u); ++ 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(); -@@ -766,6 +834,14 @@ - this.drawTexturedModalRect(i1, k + (int)((float)(l - k - 17) * this.currentScroll), 232 + (this.needsScrollBars() ? 0 : 12), 0, 12, 15); + this.field_146297_k.getTextureManager().bindTexture(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + creativetabs.getBackgroundImageName())); + this.drawTexturedModalRect(this.field_147003_i, this.field_147009_r, 0, 0, this.field_146999_f, this.field_147000_g); + this.field_147062_A.func_146194_f(); +@@ -723,6 +791,14 @@ + this.drawTexturedModalRect(i1, k + (int)((float)(l - k - 17) * this.field_147067_x), 232 + (this.func_147055_p() ? 0 : 12), 0, 12, 15); } + if (creativetabs == null || creativetabs.getTabPage() != tabPage) @@ -213,55 +220,46 @@ + } + } + - this.renderCreativeTab(creativetabs); + this.func_147051_a(creativetabs); if (creativetabs == CreativeTabs.tabInventory) -@@ -776,6 +852,15 @@ +@@ -733,6 +809,15 @@ - protected boolean func_74232_a(CreativeTabs par1CreativeTabs, int par2, int par3) + protected boolean func_147049_a(CreativeTabs p_147049_1_, int p_147049_2_, int p_147049_3_) { -+ if (par1CreativeTabs.getTabPage() != tabPage) ++ if (p_147049_1_.getTabPage() != tabPage) + { -+ if (par1CreativeTabs != CreativeTabs.tabAllSearch && -+ par1CreativeTabs != CreativeTabs.tabInventory) ++ if (p_147049_1_ != CreativeTabs.tabAllSearch && ++ p_147049_1_ != CreativeTabs.tabInventory) + { + return false; + } + } + - int k = par1CreativeTabs.getTabColumn(); + int k = p_147049_1_.getTabColumn(); int l = 28 * k; byte b0 = 0; -@@ -883,6 +968,7 @@ +@@ -833,6 +918,7 @@ } GL11.glDisable(GL11.GL_LIGHTING); + GL11.glColor3f(1F, 1F, 1F); //Forge: Reset color in case Items change it. this.drawTexturedModalRect(l, i1, j, k, 28, b0); this.zLevel = 100.0F; - itemRenderer.zLevel = 100.0F; -@@ -890,7 +976,7 @@ - i1 += 8 + (flag1 ? 1 : -1); - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); -- ItemStack itemstack = new ItemStack(par1CreativeTabs.getTabIconItem()); -+ ItemStack itemstack = par1CreativeTabs.getIconItemStack(); - itemRenderer.renderItemAndEffectIntoGUI(this.fontRenderer, this.mc.getTextureManager(), itemstack, l, i1); - itemRenderer.renderItemOverlayIntoGUI(this.fontRenderer, this.mc.getTextureManager(), itemstack, l, i1); - GL11.glDisable(GL11.GL_LIGHTING); -@@ -912,6 +998,15 @@ + field_146296_j.zLevel = 100.0F; +@@ -859,6 +945,15 @@ { - this.mc.displayGuiScreen(new GuiStats(this, this.mc.statFileWriter)); + this.field_146297_k.func_147108_a(new GuiStats(this, this.field_146297_k.thePlayer.func_146107_m())); } + -+ if (par1GuiButton.id == 101) ++ if (p_146284_1_.field_146127_k == 101) + { + tabPage = Math.max(tabPage - 1, 0); + } -+ else if (par1GuiButton.id == 102) ++ else if (p_146284_1_.field_146127_k == 102) + { + tabPage = Math.min(tabPage + 1, maxPages); + } } - /** + public int func_147056_g() diff --git a/patches/minecraft/net/minecraft/client/gui/mco/GuiScreenCreateOnlineWorld.java.patch b/patches/minecraft/net/minecraft/client/gui/mco/GuiScreenCreateOnlineWorld.java.patch new file mode 100644 index 000000000..adfb095cb --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/mco/GuiScreenCreateOnlineWorld.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/mco/GuiScreenCreateOnlineWorld.java ++++ ../src-work/minecraft/net/minecraft/client/gui/mco/GuiScreenCreateOnlineWorld.java +@@ -207,7 +207,7 @@ + GuiScreenCreateOnlineWorld.field_146765_a.error("Couldn\'t create world"); + this.func_148416_a(unsupportedencodingexception.getLocalizedMessage()); + } +- catch (IOException ioexception) ++ catch (@SuppressWarnings("hiding") IOException ioexception) + { + GuiScreenCreateOnlineWorld.field_146765_a.error("Could not parse response creating world"); + this.func_148416_a(ioexception.getLocalizedMessage()); diff --git a/patches/minecraft/net/minecraft/client/model/ModelBox.java.patch b/patches/minecraft/net/minecraft/client/model/ModelBox.java.patch index d55462a0d..aaed79652 100644 --- a/patches/minecraft/net/minecraft/client/model/ModelBox.java.patch +++ b/patches/minecraft/net/minecraft/client/model/ModelBox.java.patch @@ -7,11 +7,11 @@ -@SideOnly(Side.CLIENT) public class ModelBox { - /** -@@ -96,6 +95,7 @@ - /** - * Draw the six sided box defined by this ModelBox - */ + // JAVADOC FIELD $$ field_78253_h +@@ -86,6 +85,7 @@ + } + + // JAVADOC METHOD $$ func_78245_a + @SideOnly(Side.CLIENT) public void render(Tessellator par1Tessellator, float par2) { diff --git a/patches/minecraft/net/minecraft/client/model/ModelRenderer.java.patch b/patches/minecraft/net/minecraft/client/model/ModelRenderer.java.patch index 90fa5af76..5aeb32d88 100644 --- a/patches/minecraft/net/minecraft/client/model/ModelRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/model/ModelRenderer.java.patch @@ -7,18 +7,16 @@ -@SideOnly(Side.CLIENT) public class ModelRenderer { - /** The size of the texture file's width in pixels. */ -@@ -117,7 +116,8 @@ - this.rotationPointY = par2; + // JAVADOC FIELD $$ field_78801_a +@@ -110,6 +109,7 @@ this.rotationPointZ = par3; } -- -+ + + @SideOnly(Side.CLIENT) public void render(float par1) { if (!this.isHidden) -@@ -200,6 +200,7 @@ +@@ -192,6 +192,7 @@ } } @@ -26,18 +24,18 @@ public void renderWithRotation(float par1) { if (!this.isHidden) -@@ -238,6 +239,7 @@ - /** - * Allows the changing of Angles after a box has been rendered - */ +@@ -228,6 +229,7 @@ + } + + // JAVADOC METHOD $$ func_78794_c + @SideOnly(Side.CLIENT) public void postRender(float par1) { if (!this.isHidden) -@@ -282,6 +284,7 @@ - /** - * Compiles a GL display list for this model - */ +@@ -270,6 +272,7 @@ + } + + // JAVADOC METHOD $$ func_78788_d + @SideOnly(Side.CLIENT) private void compileDisplayList(float par1) { diff --git a/patches/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch b/patches/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch index 415aa3c13..b749815ae 100644 --- a/patches/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch +++ b/patches/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch @@ -1,7 +1,10 @@ --- ../src-base/minecraft/net/minecraft/client/model/PositionTextureVertex.java +++ ../src-work/minecraft/net/minecraft/client/model/PositionTextureVertex.java -@@ -4,7 +4,6 @@ - import cpw.mods.fml.relauncher.SideOnly; +@@ -1,10 +1,7 @@ + package net.minecraft.client.model; + +-import cpw.mods.fml.relauncher.Side; +-import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.util.Vec3; -@SideOnly(Side.CLIENT) diff --git a/patches/minecraft/net/minecraft/client/model/TexturedQuad.java.patch b/patches/minecraft/net/minecraft/client/model/TexturedQuad.java.patch index f1d328bf4..b9b30e48d 100644 --- a/patches/minecraft/net/minecraft/client/model/TexturedQuad.java.patch +++ b/patches/minecraft/net/minecraft/client/model/TexturedQuad.java.patch @@ -1,6 +1,10 @@ --- ../src-base/minecraft/net/minecraft/client/model/TexturedQuad.java +++ ../src-work/minecraft/net/minecraft/client/model/TexturedQuad.java -@@ -5,7 +5,6 @@ +@@ -1,11 +1,8 @@ + package net.minecraft.client.model; + +-import cpw.mods.fml.relauncher.Side; +-import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.Tessellator; import net.minecraft.util.Vec3; diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch index 07ade0b89..f6a2c5aea 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch @@ -1,19 +1,10 @@ --- ../src-base/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java +++ ../src-work/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java -@@ -13,6 +13,8 @@ - import net.minecraft.world.chunk.Chunk; - import net.minecraft.world.chunk.EmptyChunk; - import net.minecraft.world.chunk.IChunkProvider; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.world.ChunkEvent; - - @SideOnly(Side.CLIENT) - public class ChunkProviderClient implements IChunkProvider -@@ -75,6 +77,7 @@ - { +@@ -63,6 +63,7 @@ Chunk chunk = new Chunk(this.worldObj, par1, par2); this.chunkMapping.add(ChunkCoordIntPair.chunkXZ2Int(par1, par2), chunk); -+ MinecraftForge.EVENT_BUS.post(new ChunkEvent.Load(chunk)); + this.chunkListing.add(chunk); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Load(chunk)); chunk.isChunkLoaded = true; return chunk; } diff --git a/patches/minecraft/net/minecraft/client/multiplayer/NetClientHandler.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/NetClientHandler.java.patch deleted file mode 100644 index 06bf44fdf..000000000 --- a/patches/minecraft/net/minecraft/client/multiplayer/NetClientHandler.java.patch +++ /dev/null @@ -1,47 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/multiplayer/NetClientHandler.java -+++ ../src-work/minecraft/net/minecraft/client/multiplayer/NetClientHandler.java -@@ -191,6 +191,11 @@ - import net.minecraft.world.storage.MapStorage; - import org.lwjgl.input.Keyboard; - -+import net.minecraftforge.client.ForgeHooksClient; -+import net.minecraftforge.client.event.ClientChatReceivedEvent; -+import net.minecraftforge.common.ForgeHooks; -+import net.minecraftforge.common.MinecraftForge; -+ - @SideOnly(Side.CLIENT) - public class NetClientHandler extends NetHandler - { -@@ -784,7 +789,7 @@ - - public void handleKickDisconnect(Packet255KickDisconnect par1Packet255KickDisconnect) - { -- this.netManager.networkShutdown("disconnect.kicked", new Object[0]); -+ this.netManager.networkShutdown("disconnect.kicked", par1Packet255KickDisconnect.reason); - this.disconnected = true; - this.mc.loadWorld((WorldClient)null); - -@@ -870,7 +875,11 @@ - { - return; - } -- this.mc.ingameGUI.getChatGUI().printChatMessage(ChatMessageComponent.createFromJson(par1Packet3Chat.message).toStringWithFormatting(true)); -+ ClientChatReceivedEvent event = new ClientChatReceivedEvent(par1Packet3Chat.message); -+ if (!MinecraftForge.EVENT_BUS.post(event) && event.message != null) -+ { -+ this.mc.ingameGUI.getChatGUI().printChatMessage(ChatMessageComponent.createFromJson(event.message).toStringWithFormatting(true)); -+ } - } - - public void handleAnimation(Packet18Animation par1Packet18Animation) -@@ -1358,6 +1367,10 @@ - { - tileentity.readFromNBT(par1Packet132TileEntityData.data); - } -+ else -+ { -+ tileentity.onDataPacket(netManager, par1Packet132TileEntityData); -+ } - } - } - } diff --git a/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch index 04799859f..d09963d29 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch @@ -1,8 +1,8 @@ --- ../src-base/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java +++ ../src-work/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java -@@ -22,6 +22,10 @@ - import net.minecraft.world.EnumGameType; +@@ -28,6 +28,10 @@ import net.minecraft.world.World; + import net.minecraft.world.WorldSettings; +import net.minecraftforge.common.ForgeHooks; +import net.minecraftforge.common.MinecraftForge; @@ -11,8 +11,8 @@ @SideOnly(Side.CLIENT) public class PlayerControllerMP { -@@ -125,6 +129,12 @@ - */ +@@ -104,6 +108,12 @@ + // JAVADOC METHOD $$ func_78751_a public boolean onPlayerDestroyBlock(int par1, int par2, int par3, int par4) { + ItemStack stack = mc.thePlayer.getCurrentEquippedItem(); @@ -24,32 +24,37 @@ if (this.currentGameType.isAdventure() && !this.mc.thePlayer.isCurrentToolAdventureModeExempt(par1, par2, par3)) { return false; -@@ -146,7 +156,7 @@ +@@ -125,7 +135,7 @@ { - worldclient.playAuxSFX(2001, par1, par2, par3, block.blockID + (worldclient.getBlockMetadata(par1, par2, par3) << 12)); + worldclient.playAuxSFX(2001, par1, par2, par3, Block.func_149682_b(block) + (worldclient.getBlockMetadata(par1, par2, par3) << 12)); int i1 = worldclient.getBlockMetadata(par1, par2, par3); -- boolean flag = worldclient.setBlockToAir(par1, par2, par3); -+ boolean flag = block.removeBlockByPlayer(worldclient, mc.thePlayer, par1, par2, par3); +- boolean flag = worldclient.func_147468_f(par1, par2, par3); ++ boolean flag = block.removedByPlayer(worldclient, mc.thePlayer, par1, par2, par3); if (flag) { -@@ -347,8 +357,14 @@ +@@ -326,11 +336,18 @@ float f2 = (float)par8Vec3.zCoord - (float)par6; boolean flag = false; - int i1; + +- if ((!par1EntityPlayer.isSneaking() || par1EntityPlayer.getHeldItem() == null) && par2World.func_147439_a(par4, par5, par6).func_149727_a(par2World, par4, par5, par6, par1EntityPlayer, par7, f, f1, f2)) + if (par3ItemStack != null && + par3ItemStack.getItem() != null && + par3ItemStack.getItem().onItemUseFirst(par3ItemStack, par1EntityPlayer, par2World, par4, par5, par6, par7, f, f1, f2)) -+ { -+ return true; -+ } - -- if (!par1EntityPlayer.isSneaking() || par1EntityPlayer.getHeldItem() == null) -+ if (!par1EntityPlayer.isSneaking() || (par1EntityPlayer.getHeldItem() == null || par1EntityPlayer.getHeldItem().getItem().shouldPassSneakingClickToBlock(par2World, par4, par5, par6))) { - i1 = par2World.getBlockId(par4, par5, par6); +- flag = true; ++ return true; + } -@@ -389,7 +405,15 @@ ++ if (!par1EntityPlayer.isSneaking() || par1EntityPlayer.getHeldItem() == null || par1EntityPlayer.getHeldItem().getItem().doesSneakBypassUse(par2World, par4, par5, par6, par1EntityPlayer)) ++ { ++ flag = par2World.func_147439_a(par4, par5, par6).func_149727_a(par2World, par4, par5, par6, par1EntityPlayer, par7, f, f1, f2); ++ } ++ + if (!flag && par3ItemStack != null && par3ItemStack.getItem() instanceof ItemBlock) + { + ItemBlock itemblock = (ItemBlock)par3ItemStack.getItem(); +@@ -362,7 +379,15 @@ } else { @@ -66,7 +71,7 @@ } } -@@ -411,9 +435,10 @@ +@@ -382,9 +407,10 @@ { par1EntityPlayer.inventory.mainInventory[par1EntityPlayer.inventory.currentItem] = itemstack1; diff --git a/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch index 9eb922568..308156244 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/multiplayer/WorldClient.java +++ ../src-work/minecraft/net/minecraft/client/multiplayer/WorldClient.java -@@ -29,6 +29,9 @@ +@@ -34,6 +34,9 @@ import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.storage.SaveHandlerMP; @@ -10,21 +10,21 @@ @SideOnly(Side.CLIENT) public class WorldClient extends World { -@@ -59,8 +62,11 @@ - super(new SaveHandlerMP(), "MpServer", WorldProvider.getProviderForDimension(par3), par2WorldSettings, par5Profiler, par6ILogAgent); - this.sendQueue = par1NetClientHandler; - this.difficultySetting = par4; +@@ -56,8 +59,11 @@ + super(new SaveHandlerMP(), "MpServer", WorldProvider.getProviderForDimension(p_i45063_3_), p_i45063_2_, p_i45063_5_); + this.sendQueue = p_i45063_1_; + this.difficultySetting = p_i45063_4_; - this.setSpawnLocation(8, 64, 8); - this.mapStorage = par1NetClientHandler.mapStorage; + this.mapStorage = p_i45063_1_.field_147305_a; + this.isRemote = true; -+ finishSetup(); ++ this.finishSetup(); + this.setSpawnLocation(8, 64, 8); + MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(this)); } - /** -@@ -290,6 +296,12 @@ - */ + // JAVADOC METHOD $$ func_72835_b +@@ -275,6 +281,12 @@ + // JAVADOC METHOD $$ func_72979_l protected void updateWeather() { + super.updateWeather(); @@ -35,4 +35,4 @@ + { if (!this.provider.hasNoSky) { - this.prevRainingStrength = this.rainingStrength; + ; 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 000000000..497dca231 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch @@ -0,0 +1,35 @@ +--- ../src-base/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java ++++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java +@@ -190,6 +190,8 @@ + import net.minecraft.world.storage.ISaveHandler; + import net.minecraft.world.storage.MapData; + import net.minecraft.world.storage.MapStorage; ++import net.minecraftforge.client.event.ClientChatReceivedEvent; ++import net.minecraftforge.common.MinecraftForge; + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; + +@@ -673,7 +675,11 @@ + + public void func_147251_a(S02PacketChat p_147251_1_) + { +- this.field_147299_f.ingameGUI.func_146158_b().func_146227_a(p_147251_1_.func_148915_c()); ++ ClientChatReceivedEvent event = new ClientChatReceivedEvent(p_147251_1_.func_148915_c()); ++ if (!MinecraftForge.EVENT_BUS.post(event) && event.message != null) ++ { ++ this.field_147299_f.ingameGUI.func_146158_b().func_146227_a(event.message); ++ } + } + + public void func_147279_a(S0BPacketAnimation p_147279_1_) +@@ -1113,6 +1119,10 @@ + { + tileentity.func_145839_a(p_147273_1_.func_148857_g()); + } ++ else ++ { ++ tileentity.onDataPacket(field_147302_e, p_147273_1_); ++ } + } + } + } diff --git a/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch b/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch index 79e5e732b..a02a7a1d6 100644 --- a/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch @@ -1,39 +1,47 @@ --- ../src-base/minecraft/net/minecraft/client/particle/EffectRenderer.java +++ ../src-work/minecraft/net/minecraft/client/particle/EffectRenderer.java -@@ -12,6 +12,7 @@ - import net.minecraft.client.renderer.texture.TextureMap; +@@ -16,9 +16,11 @@ + import net.minecraft.crash.CrashReportCategory; import net.minecraft.entity.Entity; import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; + import net.minecraft.util.ReportedException; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; ++ import org.lwjgl.opengl.GL11; -@@ -63,10 +64,14 @@ - for (int j = 0; j < this.fxLayers[i].size(); ++j) - { - EntityFX entityfx = (EntityFX)this.fxLayers[i].get(j); -- entityfx.onUpdate(); + + @SideOnly(Side.CLIENT) +@@ -72,7 +74,10 @@ + + try + { +- entityfx.onUpdate(); ++ if (entityfx != null) ++ { ++ entityfx.onUpdate(); ++ } + } + catch (Throwable throwable) + { +@@ -97,7 +102,7 @@ + throw new ReportedException(crashreport); + } - if (entityfx.isDead) -+ if (entityfx != null) - { -+ entityfx.onUpdate(); -+ } -+ + if (entityfx == null || entityfx.isDead) -+ { + { this.fxLayers[i].remove(j--); } - } -@@ -115,6 +120,7 @@ +@@ -147,6 +152,7 @@ for (int j = 0; j < this.fxLayers[i].size(); ++j) { - EntityFX entityfx = (EntityFX)this.fxLayers[i].get(j); + final EntityFX entityfx = (EntityFX)this.fxLayers[i].get(j); + if (entityfx == null) continue; tessellator.setBrightness(entityfx.getBrightnessForRender(par2)); - entityfx.renderParticle(tessellator, par2, f1, f5, f2, f3, f4); - } -@@ -145,6 +151,7 @@ + + try +@@ -203,6 +209,7 @@ for (int i = 0; i < list.size(); ++i) { EntityFX entityfx = (EntityFX)list.get(i); @@ -41,27 +49,24 @@ tessellator.setBrightness(entityfx.getBrightnessForRender(par2)); entityfx.renderParticle(tessellator, par2, f2, f6, f3, f4, f5); } -@@ -163,9 +170,9 @@ +@@ -221,7 +228,7 @@ - public void addBlockDestroyEffects(int par1, int par2, int par3, int par4, int par5) + public void func_147215_a(int p_147215_1_, int p_147215_2_, int p_147215_3_, Block p_147215_4_, int p_147215_5_) { -- if (par4 != 0) -+ Block block = Block.blocksList[par4]; -+ if (block != null && !block.addBlockDestroyEffects(worldObj, par1, par2, par3, par5, this)) +- if (p_147215_4_.func_149688_o() != Material.field_151579_a) ++ if (!p_147215_4_.isAir(worldObj, p_147215_1_, p_147215_2_, p_147215_3_) && !p_147215_4_.addDestroyEffects(worldObj, p_147215_1_, p_147215_2_, p_147215_3_, p_147215_5_, this)) { -- Block block = Block.blocksList[par4]; byte b0 = 4; - for (int j1 = 0; j1 < b0; ++j1) -@@ -237,4 +244,13 @@ +@@ -291,4 +298,13 @@ { return "" + (this.fxLayers[0].size() + this.fxLayers[1].size() + this.fxLayers[2].size()); } + + public void addBlockHitEffects(int x, int y, int z, MovingObjectPosition target) + { -+ Block block = Block.blocksList[worldObj.getBlockId(x, y, z)]; -+ if (block != null && !block.addBlockHitEffects(worldObj, target, this)) ++ Block block = worldObj.func_147439_a(x, y, z); ++ if (block != null && !block.addHitEffects(worldObj, target, this)) + { + addBlockHitEffects(x, y, z, target.sideHit); + } diff --git a/patches/minecraft/net/minecraft/client/particle/EntityDiggingFX.java.patch b/patches/minecraft/net/minecraft/client/particle/EntityDiggingFX.java.patch index 796ab3069..fef78c615 100644 --- a/patches/minecraft/net/minecraft/client/particle/EntityDiggingFX.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/EntityDiggingFX.java.patch @@ -1,9 +1,9 @@ --- ../src-base/minecraft/net/minecraft/client/particle/EntityDiggingFX.java +++ ../src-work/minecraft/net/minecraft/client/particle/EntityDiggingFX.java -@@ -10,15 +10,22 @@ - public class EntityDiggingFX extends EntityFX +@@ -12,21 +12,28 @@ { - private Block blockInstance; + private Block field_145784_a; + private static final String __OBFID = "CL_00000932"; + private int side; public EntityDiggingFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, Block par14Block, int par15) @@ -14,22 +14,20 @@ + public EntityDiggingFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, Block par14Block, int par15, int side) + { super(par1World, par2, par4, par6, par8, par10, par12); - this.blockInstance = par14Block; -- this.setParticleIcon(par14Block.getIcon(0, par15)); -+ this.setParticleIcon(par14Block.getIcon(side, par15)); - this.particleGravity = par14Block.blockParticleGravity; + this.field_145784_a = par14Block; +- this.setParticleIcon(par14Block.func_149691_a(0, par15)); ++ this.setParticleIcon(par14Block.func_149691_a(side, par15)); + this.particleGravity = par14Block.field_149763_I; this.particleRed = this.particleGreen = this.particleBlue = 0.6F; this.particleScale /= 2.0F; + this.side = side; } - /** -@@ -26,7 +33,7 @@ - */ + // JAVADOC METHOD $$ func_70596_a public EntityDiggingFX applyColourMultiplier(int par1, int par2, int par3) { -- if (this.blockInstance == Block.grass) -+ if (this.blockInstance == Block.grass && this.side != 1) +- if (this.field_145784_a == Blocks.grass) ++ if (this.field_145784_a == Blocks.grass && this.side != 1) { return this; } diff --git a/patches/minecraft/net/minecraft/client/particle/EntityFireworkStarterFX.java.patch b/patches/minecraft/net/minecraft/client/particle/EntityFireworkStarterFX.java.patch deleted file mode 100644 index 05433d175..000000000 --- a/patches/minecraft/net/minecraft/client/particle/EntityFireworkStarterFX.java.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/particle/EntityFireworkStarterFX.java -+++ ../src-work/minecraft/net/minecraft/client/particle/EntityFireworkStarterFX.java -@@ -30,11 +30,11 @@ - { - this.fireworkExplosions = par15NBTTagCompound.getTagList("Explosions"); - -- if (this.fireworkExplosions.tagCount() == 0) -+ if (this.fireworkExplosions != null && this.fireworkExplosions.tagCount() == 0) - { - this.fireworkExplosions = null; - } -- else -+ else if (this.fireworkExplosions != null) - { - this.particleMaxAge = this.fireworkExplosions.tagCount() * 2 - 1; - diff --git a/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch index abd997054..c2b4439ef 100644 --- a/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/EntityRenderer.java +++ ../src-work/minecraft/net/minecraft/client/renderer/EntityRenderer.java -@@ -40,6 +40,11 @@ +@@ -52,6 +52,11 @@ import org.lwjgl.opengl.GLContext; import org.lwjgl.util.glu.Project; @@ -10,9 +10,9 @@ +import net.minecraftforge.common.MinecraftForge; + @SideOnly(Side.CLIENT) - public class EntityRenderer + public class EntityRenderer implements IResourceManagerReloadListener { -@@ -319,7 +324,7 @@ +@@ -397,7 +402,7 @@ if (d3 < d2 || d2 == 0.0D) { @@ -21,8 +21,8 @@ { if (d2 == 0.0D) { -@@ -354,8 +359,15 @@ - */ +@@ -432,8 +437,15 @@ + // JAVADOC METHOD $$ func_78477_e private void updateFovModifierHand() { - EntityPlayerSP entityplayersp = (EntityPlayerSP)this.mc.renderViewEntity; @@ -39,7 +39,7 @@ this.fovModifierHandPrev = this.fovModifierHand; this.fovModifierHand += (this.fovMultiplierTemp - this.fovModifierHand) * 0.5F; -@@ -381,7 +393,7 @@ +@@ -457,7 +469,7 @@ } else { @@ -48,42 +48,35 @@ float f1 = 70.0F; if (par2) -@@ -468,15 +480,7 @@ +@@ -540,15 +552,7 @@ if (!this.mc.gameSettings.debugCamEnable) { -- int i = this.mc.theWorld.getBlockId(MathHelper.floor_double(entitylivingbase.posX), MathHelper.floor_double(entitylivingbase.posY), MathHelper.floor_double(entitylivingbase.posZ)); +- Block block = this.mc.theWorld.func_147439_a(MathHelper.floor_double(entitylivingbase.posX), MathHelper.floor_double(entitylivingbase.posY), MathHelper.floor_double(entitylivingbase.posZ)); - -- if (i == Block.bed.blockID) +- if (block == Blocks.bed) - { -- int j = this.mc.theWorld.getBlockMetadata(MathHelper.floor_double(entitylivingbase.posX), MathHelper.floor_double(entitylivingbase.posY), MathHelper.floor_double(entitylivingbase.posZ)); -- int k = j & 3; -- GL11.glRotatef((float)(k * 90), 0.0F, 1.0F, 0.0F); +- int i = this.mc.theWorld.getBlockMetadata(MathHelper.floor_double(entitylivingbase.posX), MathHelper.floor_double(entitylivingbase.posY), MathHelper.floor_double(entitylivingbase.posZ)); +- int j = i & 3; +- GL11.glRotatef((float)(j * 90), 0.0F, 1.0F, 0.0F); - } - + ForgeHooksClient.orientBedCamera(mc, entitylivingbase); GL11.glRotatef(entitylivingbase.prevRotationYaw + (entitylivingbase.rotationYaw - entitylivingbase.prevRotationYaw) * par1 + 180.0F, 0.0F, -1.0F, 0.0F); GL11.glRotatef(entitylivingbase.prevRotationPitch + (entitylivingbase.rotationPitch - entitylivingbase.prevRotationPitch) * par1, -1.0F, 0.0F, 0.0F); } -@@ -1152,7 +1156,10 @@ - { +@@ -1253,7 +1257,10 @@ + GL11.glPushMatrix(); RenderHelper.enableStandardItemLighting(); this.mc.mcProfiler.endStartSection("entities"); + ForgeHooksClient.setRenderPass(0); - renderglobal.renderEntities(entitylivingbase.getPosition(par1), frustrum, par1); + renderglobal.func_147589_a(entitylivingbase, frustrum, par1); + ForgeHooksClient.setRenderPass(0); -+ /* Forge: Moved down ++ // ToDo: Try and figure out how to make particles render sorted correctly.. {They render behind water} this.enableLightmap((double)par1); this.mc.mcProfiler.endStartSection("litParticles"); effectrenderer.renderLitParticles(entitylivingbase, par1); -@@ -1161,13 +1168,17 @@ - this.mc.mcProfiler.endStartSection("particles"); - effectrenderer.renderParticles(entitylivingbase, par1); - this.disableLightmap((double)par1); -+ */ - - if (this.mc.objectMouseOver != null && entitylivingbase.isInsideOfMaterial(Material.water) && entitylivingbase instanceof EntityPlayer && !this.mc.gameSettings.hideGUI) - { +@@ -1271,7 +1278,10 @@ entityplayer = (EntityPlayer)entitylivingbase; GL11.glDisable(GL11.GL_ALPHA_TEST); this.mc.mcProfiler.endStartSection("outline"); @@ -95,25 +88,7 @@ GL11.glEnable(GL11.GL_ALPHA_TEST); } } -@@ -1222,6 +1233,17 @@ - renderglobal.sortAndRender(entitylivingbase, 1, (double)par1); - } - -+ -+ if (this.debugViewDirection == 0) //Only render if render pass 0 happens as well. -+ { -+ RenderHelper.enableStandardItemLighting(); -+ this.mc.mcProfiler.endStartSection("entities"); -+ ForgeHooksClient.setRenderPass(1); -+ renderglobal.renderEntities(entitylivingbase.getPosition(par1), frustrum, par1); -+ ForgeHooksClient.setRenderPass(-1); -+ RenderHelper.disableStandardItemLighting(); -+ } -+ - GL11.glDepthMask(true); - GL11.glEnable(GL11.GL_CULL_FACE); - GL11.glDisable(GL11.GL_BLEND); -@@ -1231,14 +1253,17 @@ +@@ -1284,14 +1294,17 @@ entityplayer = (EntityPlayer)entitylivingbase; GL11.glDisable(GL11.GL_ALPHA_TEST); this.mc.mcProfiler.endStartSection("outline"); @@ -127,30 +102,26 @@ this.mc.mcProfiler.endStartSection("destroyProgress"); GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); + OpenGlHelper.func_148821_a(770, 1, 1, 0); - renderglobal.drawBlockDamageTexture(Tessellator.instance, (EntityPlayer)entitylivingbase, par1); + renderglobal.drawBlockDamageTexture(Tessellator.instance, entitylivingbase, par1); GL11.glDisable(GL11.GL_BLEND); - this.mc.mcProfiler.endStartSection("weather"); - this.renderRainSnow(par1); -@@ -1249,6 +1274,20 @@ - this.renderCloudsCheck(renderglobal, par1); + GL11.glDepthMask(false); + GL11.glEnable(GL11.GL_CULL_FACE); +@@ -1346,6 +1359,16 @@ + renderglobal.sortAndRender(entitylivingbase, 1, (double)par1); } -+ //Forge: Moved section from above, now particles are the last thing to render. -+ this.enableLightmap((double)par1); -+ this.mc.mcProfiler.endStartSection("litParticles"); -+ effectrenderer.renderLitParticles(entitylivingbase, par1); -+ RenderHelper.disableStandardItemLighting(); -+ this.setupFog(0, par1); -+ this.mc.mcProfiler.endStartSection("particles"); -+ effectrenderer.renderParticles(entitylivingbase, par1); -+ this.disableLightmap((double)par1); -+ //Forge: End Move ++ if (this.debugViewDirection == 0) //Only render if render pass 0 happens as well. ++ { ++ RenderHelper.enableStandardItemLighting(); ++ this.mc.mcProfiler.endStartSection("entities"); ++ ForgeHooksClient.setRenderPass(1); ++ renderglobal.func_147589_a(entitylivingbase, frustrum, par1); ++ ForgeHooksClient.setRenderPass(-1); ++ RenderHelper.disableStandardItemLighting(); ++ } + -+ this.mc.mcProfiler.endStartSection("FRenderLast"); -+ ForgeHooksClient.dispatchRenderLast(renderglobal, par1); -+ - this.mc.mcProfiler.endStartSection("hand"); - - if (this.cameraZoom == 1.0D) + GL11.glDepthMask(true); + GL11.glEnable(GL11.GL_CULL_FACE); + GL11.glDisable(GL11.GL_BLEND); diff --git a/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch index 3218d6eac..e58392709 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch @@ -1,15 +1,14 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/ItemRenderer.java +++ ../src-work/minecraft/net/minecraft/client/renderer/ItemRenderer.java -@@ -16,6 +16,8 @@ - import net.minecraft.entity.EntityLivingBase; - import net.minecraft.item.EnumAction; +@@ -20,6 +20,7 @@ import net.minecraft.item.Item; -+import net.minecraft.item.ItemBlock; + import net.minecraft.item.ItemBlock; + import net.minecraft.item.ItemCloth; +import net.minecraft.item.ItemMap; import net.minecraft.item.ItemStack; - import net.minecraft.util.Icon; + import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; -@@ -24,6 +26,13 @@ +@@ -28,6 +29,13 @@ import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; @@ -23,65 +22,56 @@ @SideOnly(Side.CLIENT) public class ItemRenderer { -@@ -54,16 +63,33 @@ - this.mapItemRenderer = new MapItemRenderer(par1Minecraft.gameSettings, par1Minecraft.getTextureManager()); - } - -+ public void renderItem(EntityLivingBase par1EntityLivingBase, ItemStack par2ItemStack, int par3) -+ { -+ this.renderItem(par1EntityLivingBase, par2ItemStack, par3, ItemRenderType.EQUIPPED); +@@ -53,13 +61,25 @@ + // JAVADOC METHOD $$ func_78443_a + public void renderItem(EntityLivingBase par1EntityLivingBase, ItemStack par2ItemStack, int par3) + { ++ this.renderItem(par1EntityLivingBase, par2ItemStack, par3, EQUIPPED); + } + - /** - * Renders the item stack for being in an entity's hand Args: itemStack - */ -- public void renderItem(EntityLivingBase par1EntityLivingBase, ItemStack par2ItemStack, int par3) ++ // JAVADOC METHOD $$ func_78443_a + public void renderItem(EntityLivingBase par1EntityLivingBase, ItemStack par2ItemStack, int par3, ItemRenderType type) - { ++ { GL11.glPushMatrix(); TextureManager texturemanager = this.mc.getTextureManager(); + Item item = par2ItemStack.getItem(); + Block block = Block.func_149634_a(item); -- if (par2ItemStack.getItemSpriteNumber() == 0 && par2ItemStack.itemID < Block.blocksList.length && Block.blocksList[par2ItemStack.itemID] != null && RenderBlocks.renderItemIn3d(Block.blocksList[par2ItemStack.itemID].getRenderType())) -+ Block block = null; -+ if (par2ItemStack.getItem() instanceof ItemBlock && par2ItemStack.itemID < Block.blocksList.length) - { -+ block = Block.blocksList[par2ItemStack.itemID]; -+ } -+ +- if (par2ItemStack.getItemSpriteNumber() == 0 && item instanceof ItemBlock && RenderBlocks.func_147739_a(block.func_149645_b())) + IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(par2ItemStack, type); + if (customRenderer != null) -+ { + { + texturemanager.bindTexture(texturemanager.getResourceLocation(par2ItemStack.getItemSpriteNumber())); -+ ForgeHooksClient.renderEquippedItem(type, customRenderer, renderBlocksInstance, par1EntityLivingBase, par2ItemStack); ++ ForgeHooksClient.renderEquippedItem(type, customRenderer, field_147720_h, par1EntityLivingBase, par2ItemStack); + } -+ else if (block != null && par2ItemStack.getItemSpriteNumber() == 0 && RenderBlocks.renderItemIn3d(Block.blocksList[par2ItemStack.itemID].getRenderType())) ++ else if (par2ItemStack.getItemSpriteNumber() == 0 && item instanceof ItemBlock && RenderBlocks.func_147739_a(block.func_149645_b())) + { texturemanager.bindTexture(texturemanager.getResourceLocation(0)); - this.renderBlocksInstance.renderBlockAsItem(Block.blocksList[par2ItemStack.itemID], par2ItemStack.getItemDamage(), 1.0F); - } -@@ -94,7 +120,7 @@ + + if (par2ItemStack != null && par2ItemStack.getItem() instanceof ItemCloth) +@@ -104,7 +124,7 @@ GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F); - renderItemIn2D(tessellator, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 0.0625F); + renderItemIn2D(tessellator, f1, f2, f, f3, iicon.getIconWidth(), iicon.getIconHeight(), 0.0625F); - if (par2ItemStack.hasEffect() && par3 == 0) + if (par2ItemStack.hasEffect(par3)) { GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_LIGHTING); -@@ -266,7 +292,7 @@ - Render render; +@@ -279,7 +299,7 @@ RenderPlayer renderplayer; + Render render; -- if (itemstack != null && itemstack.itemID == Item.map.itemID) +- if (itemstack != null && itemstack.getItem() == Items.filled_map) + if (itemstack != null && itemstack.getItem() instanceof ItemMap) { GL11.glPushMatrix(); - f12 = 0.8F; -@@ -333,12 +359,21 @@ + f13 = 0.8F; +@@ -346,12 +366,21 @@ tessellator.addVertexWithUV((double)(128 + b0), (double)(0 - b0), 0.0D, 1.0D, 0.0D); tessellator.addVertexWithUV((double)(0 - b0), (double)(0 - b0), 0.0D, 0.0D, 0.0D); tessellator.draw(); -- MapData mapdata = Item.map.getMapData(itemstack, this.mc.theWorld); +- MapData mapdata = Items.filled_map.getMapData(itemstack, this.mc.theWorld); - if (mapdata != null) + IItemRenderer custom = MinecraftForgeClient.getItemRenderer(itemstack, FIRST_PERSON_MAP); @@ -89,10 +79,10 @@ + + if (custom == null) { -- this.mapItemRenderer.renderMap(this.mc.thePlayer, this.mc.getTextureManager(), mapdata); +- this.mc.entityRenderer.func_147701_i().func_148250_a(mapdata, false); + if (mapdata != null) + { -+ this.mapItemRenderer.renderMap(this.mc.thePlayer, this.mc.getTextureManager(), mapdata); ++ this.mc.entityRenderer.func_147701_i().func_148250_a(mapdata, false); + } } + else @@ -102,32 +92,32 @@ GL11.glPopMatrix(); } -@@ -439,17 +474,20 @@ +@@ -452,17 +481,20 @@ if (itemstack.getItem().requiresMultipleRenderPasses()) { - this.renderItem(entityclientplayermp, itemstack, 0); -- int i1 = Item.itemsList[itemstack.itemID].getColorFromItemStack(itemstack, 1); -- f11 = (float)(i1 >> 16 & 255) / 255.0F; -- f13 = (float)(i1 >> 8 & 255) / 255.0F; -- f14 = (float)(i1 & 255) / 255.0F; -- GL11.glColor4f(f5 * f11, f5 * f13, f5 * f14, 1.0F); +- int j1 = itemstack.getItem().getColorFromItemStack(itemstack, 1); +- f10 = (float)(j1 >> 16 & 255) / 255.0F; +- f11 = (float)(j1 >> 8 & 255) / 255.0F; +- f12 = (float)(j1 & 255) / 255.0F; +- GL11.glColor4f(1.0F * f10, 1.0F * f11, 1.0F * f12, 1.0F); - this.renderItem(entityclientplayermp, itemstack, 1); -+ this.renderItem(entityclientplayermp, itemstack, 0, ItemRenderType.EQUIPPED_FIRST_PERSON); ++ this.renderItem(entityclientplayermp, itemstack, 0, EQUIPPED_FIRST_PERSON); + for (int x = 1; x < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); x++) + { -+ int i1 = Item.itemsList[itemstack.itemID].getColorFromItemStack(itemstack, x); -+ f11 = (float)(i1 >> 16 & 255) / 255.0F; -+ f13 = (float)(i1 >> 8 & 255) / 255.0F; -+ f14 = (float)(i1 & 255) / 255.0F; -+ GL11.glColor4f(f5 * f11, f5 * f13, f5 * f14, 1.0F); -+ this.renderItem(entityclientplayermp, itemstack, x, ItemRenderType.EQUIPPED_FIRST_PERSON); ++ int j1 = itemstack.getItem().getColorFromItemStack(itemstack, x); ++ f10 = (float)(j1 >> 16 & 255) / 255.0F; ++ f11 = (float)(j1 >> 8 & 255) / 255.0F; ++ f12 = (float)(j1 & 255) / 255.0F; ++ GL11.glColor4f(1.0F * f10, 1.0F * f11, 1.0F * f12, 1.0F); ++ this.renderItem(entityclientplayermp, itemstack, 1, EQUIPPED_FIRST_PERSON); + } } else { - this.renderItem(entityclientplayermp, itemstack, 0); -+ this.renderItem(entityclientplayermp, itemstack, 0, ItemRenderType.EQUIPPED_FIRST_PERSON); ++ this.renderItem(entityclientplayermp, itemstack, 0, EQUIPPED_FIRST_PERSON); } GL11.glPopMatrix(); diff --git a/patches/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch b/patches/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch index 4fcd49a74..b6cdb1c1d 100644 --- a/patches/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch @@ -1,17 +1,17 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/OpenGlHelper.java +++ ../src-work/minecraft/net/minecraft/client/renderer/OpenGlHelper.java -@@ -26,6 +26,10 @@ - */ - private static boolean useMultitextureARB; +@@ -27,6 +27,10 @@ + public static boolean field_148824_g; + 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; + - /** - * Initializes the texture constants to be used when rendering lightmap values - */ -@@ -88,5 +92,11 @@ + // JAVADOC METHOD $$ func_77474_a + public static void initializeTextures() + { +@@ -89,6 +93,12 @@ { GL13.glMultiTexCoord2f(par0, par1, par2); } @@ -22,4 +22,5 @@ + lastBrightnessY = par2; + } } - } + + public static void func_148821_a(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/RenderBlocks.java.patch b/patches/minecraft/net/minecraft/client/renderer/RenderBlocks.java.patch index 824986e4c..50d90b53f 100644 --- a/patches/minecraft/net/minecraft/client/renderer/RenderBlocks.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/RenderBlocks.java.patch @@ -1,108 +1,109 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/RenderBlocks.java +++ ../src-work/minecraft/net/minecraft/client/renderer/RenderBlocks.java -@@ -45,6 +45,8 @@ +@@ -52,6 +52,8 @@ import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; -+import static net.minecraftforge.common.ForgeDirection.*; ++import static net.minecraftforge.common.util.ForgeDirection.*; + @SideOnly(Side.CLIENT) public class RenderBlocks { -@@ -534,9 +536,8 @@ - public boolean renderBlockBed(Block par1Block, int par2, int par3, int par4) +@@ -336,9 +338,9 @@ + private boolean func_147773_v(Block p_147773_1_, int p_147773_2_, int p_147773_3_, int p_147773_4_) { Tessellator tessellator = Tessellator.instance; -- int l = this.blockAccess.getBlockMetadata(par2, par3, par4); -- int i1 = BlockBed.getDirection(l); -- boolean flag = BlockBed.isBlockHeadOfBed(l); -+ int i1 = par1Block.getBedDirection(blockAccess, par2, par3, par4); -+ boolean flag = par1Block.isBedFoot(blockAccess, par2, par3, par4); +- int l = this.field_147845_a.getBlockMetadata(p_147773_2_, p_147773_3_, p_147773_4_); +- int i1 = BlockBed.func_149895_l(l); +- boolean flag = BlockBed.func_149975_b(l); ++ Block bed = this.field_147845_a.func_147439_a(p_147773_2_, p_147773_3_, p_147773_4_); ++ int i1 = bed.getBedDirection(field_147845_a, p_147773_2_, p_147773_3_, p_147773_4_); ++ boolean flag = bed.isBedFoot(field_147845_a, p_147773_2_, p_147773_3_, p_147773_4_); float f = 0.5F; float f1 = 1.0F; float f2 = 0.8F; -@@ -545,6 +546,7 @@ +@@ -347,6 +349,7 @@ tessellator.setBrightness(j1); tessellator.setColorOpaque_F(f, f, f); - Icon icon = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 0); -+ if (hasOverrideBlockTexture()) icon = overrideBlockTexture; //BugFix Proper breaking texture on underside - double d0 = (double)icon.getMinU(); - double d1 = (double)icon.getMaxU(); - double d2 = (double)icon.getMinV(); -@@ -561,6 +563,7 @@ - tessellator.setBrightness(par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4)); + IIcon iicon = this.func_147793_a(p_147773_1_, this.field_147845_a, p_147773_2_, p_147773_3_, p_147773_4_, 0); ++ if (func_147744_b()) iicon = field_147840_d; //BugFix Proper breaking texture on underside + double d0 = (double)iicon.getMinU(); + double d1 = (double)iicon.getMaxU(); + double d2 = (double)iicon.getMinV(); +@@ -363,6 +366,7 @@ + tessellator.setBrightness(p_147773_1_.func_149677_c(this.field_147845_a, p_147773_2_, p_147773_3_ + 1, p_147773_4_)); tessellator.setColorOpaque_F(f1, f1, f1); - icon = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 1); -+ if (hasOverrideBlockTexture()) icon = overrideBlockTexture; //BugFix Proper breaking texture on underside - d0 = (double)icon.getMinU(); - d1 = (double)icon.getMaxU(); - d2 = (double)icon.getMinV(); -@@ -2358,7 +2361,7 @@ + iicon = this.func_147793_a(p_147773_1_, this.field_147845_a, p_147773_2_, p_147773_3_, p_147773_4_, 1); ++ if (func_147744_b()) iicon = field_147840_d; //BugFix Proper breaking texture on underside + d0 = (double)iicon.getMinU(); + d1 = (double)iicon.getMaxU(); + d2 = (double)iicon.getMinV(); +@@ -2037,7 +2041,7 @@ double d9; double d10; -- if (!this.blockAccess.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && !Block.fire.canBlockCatchFire(this.blockAccess, par2, par3 - 1, par4)) -+ if (!this.blockAccess.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && !Block.fire.canBlockCatchFire(this.blockAccess, par2, par3 - 1, par4, UP)) +- if (!World.func_147466_a(this.field_147845_a, p_147801_2_, p_147801_3_ - 1, p_147801_4_) && !Blocks.fire.func_149844_e(this.field_147845_a, p_147801_2_, p_147801_3_ - 1, p_147801_4_)) ++ if (!World.func_147466_a(this.field_147845_a, p_147801_2_, p_147801_3_ - 1, p_147801_4_) && !Blocks.fire.canCatchFire(this.field_147845_a, p_147801_2_, p_147801_3_ - 1, p_147801_4_, UP)) { - float f1 = 0.2F; - float f2 = 0.0625F; -@@ -2378,7 +2381,7 @@ + float f2 = 0.2F; + float f1 = 0.0625F; +@@ -2057,7 +2061,7 @@ d0 = d5; } -- if (Block.fire.canBlockCatchFire(this.blockAccess, par2 - 1, par3, par4)) -+ if (Block.fire.canBlockCatchFire(this.blockAccess, par2 - 1, par3, par4, EAST)) +- if (Blocks.fire.func_149844_e(this.field_147845_a, p_147801_2_ - 1, p_147801_3_, p_147801_4_)) ++ if (Blocks.fire.canCatchFire(this.field_147845_a, p_147801_2_ - 1, p_147801_3_, p_147801_4_, EAST)) { - tessellator.addVertexWithUV((double)((float)par2 + f1), (double)((float)par3 + f + f2), (double)(par4 + 1), d2, d1); - tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 0) + f2), (double)(par4 + 1), d2, d3); -@@ -2390,7 +2393,7 @@ - tessellator.addVertexWithUV((double)((float)par2 + f1), (double)((float)par3 + f + f2), (double)(par4 + 1), d2, d1); + tessellator.addVertexWithUV((double)((float)p_147801_2_ + f2), (double)((float)p_147801_3_ + f + f1), (double)(p_147801_4_ + 1), d2, d1); + tessellator.addVertexWithUV((double)(p_147801_2_ + 0), (double)((float)(p_147801_3_ + 0) + f1), (double)(p_147801_4_ + 1), d2, d3); +@@ -2069,7 +2073,7 @@ + tessellator.addVertexWithUV((double)((float)p_147801_2_ + f2), (double)((float)p_147801_3_ + f + f1), (double)(p_147801_4_ + 1), d2, d1); } -- if (Block.fire.canBlockCatchFire(this.blockAccess, par2 + 1, par3, par4)) -+ if (Block.fire.canBlockCatchFire(this.blockAccess, par2 + 1, par3, par4, WEST)) +- if (Blocks.fire.func_149844_e(this.field_147845_a, p_147801_2_ + 1, p_147801_3_, p_147801_4_)) ++ if (Blocks.fire.canCatchFire(this.field_147845_a, p_147801_2_ + 1, p_147801_3_, p_147801_4_, WEST)) { - tessellator.addVertexWithUV((double)((float)(par2 + 1) - f1), (double)((float)par3 + f + f2), (double)(par4 + 0), d0, d1); - tessellator.addVertexWithUV((double)(par2 + 1 - 0), (double)((float)(par3 + 0) + f2), (double)(par4 + 0), d0, d3); -@@ -2402,7 +2405,7 @@ - tessellator.addVertexWithUV((double)((float)(par2 + 1) - f1), (double)((float)par3 + f + f2), (double)(par4 + 0), d0, d1); + tessellator.addVertexWithUV((double)((float)(p_147801_2_ + 1) - f2), (double)((float)p_147801_3_ + f + f1), (double)(p_147801_4_ + 0), d0, d1); + tessellator.addVertexWithUV((double)(p_147801_2_ + 1 - 0), (double)((float)(p_147801_3_ + 0) + f1), (double)(p_147801_4_ + 0), d0, d3); +@@ -2081,7 +2085,7 @@ + tessellator.addVertexWithUV((double)((float)(p_147801_2_ + 1) - f2), (double)((float)p_147801_3_ + f + f1), (double)(p_147801_4_ + 0), d0, d1); } -- if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3, par4 - 1)) -+ if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3, par4 - 1, SOUTH)) +- if (Blocks.fire.func_149844_e(this.field_147845_a, p_147801_2_, p_147801_3_, p_147801_4_ - 1)) ++ if (Blocks.fire.canCatchFire(this.field_147845_a, p_147801_2_, p_147801_3_, p_147801_4_ - 1, SOUTH)) { - tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + f + f2), (double)((float)par4 + f1), d2, d1); - tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 0) + f2), (double)(par4 + 0), d2, d3); -@@ -2414,7 +2417,7 @@ - tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + f + f2), (double)((float)par4 + f1), d2, d1); + tessellator.addVertexWithUV((double)(p_147801_2_ + 0), (double)((float)p_147801_3_ + f + f1), (double)((float)p_147801_4_ + f2), d2, d1); + tessellator.addVertexWithUV((double)(p_147801_2_ + 0), (double)((float)(p_147801_3_ + 0) + f1), (double)(p_147801_4_ + 0), d2, d3); +@@ -2093,7 +2097,7 @@ + tessellator.addVertexWithUV((double)(p_147801_2_ + 0), (double)((float)p_147801_3_ + f + f1), (double)((float)p_147801_4_ + f2), d2, d1); } -- if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3, par4 + 1)) -+ if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3, par4 + 1, NORTH)) +- if (Blocks.fire.func_149844_e(this.field_147845_a, p_147801_2_, p_147801_3_, p_147801_4_ + 1)) ++ if (Blocks.fire.canCatchFire(this.field_147845_a, p_147801_2_, p_147801_3_, p_147801_4_ + 1, NORTH)) { - tessellator.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + f + f2), (double)((float)(par4 + 1) - f1), d0, d1); - tessellator.addVertexWithUV((double)(par2 + 1), (double)((float)(par3 + 0) + f2), (double)(par4 + 1 - 0), d0, d3); -@@ -2426,7 +2429,7 @@ - tessellator.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + f + f2), (double)((float)(par4 + 1) - f1), d0, d1); + tessellator.addVertexWithUV((double)(p_147801_2_ + 1), (double)((float)p_147801_3_ + f + f1), (double)((float)(p_147801_4_ + 1) - f2), d0, d1); + tessellator.addVertexWithUV((double)(p_147801_2_ + 1), (double)((float)(p_147801_3_ + 0) + f1), (double)(p_147801_4_ + 1 - 0), d0, d3); +@@ -2105,7 +2109,7 @@ + tessellator.addVertexWithUV((double)(p_147801_2_ + 1), (double)((float)p_147801_3_ + f + f1), (double)((float)(p_147801_4_ + 1) - f2), d0, d1); } -- if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3 + 1, par4)) -+ if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3 + 1, par4, DOWN)) +- if (Blocks.fire.func_149844_e(this.field_147845_a, p_147801_2_, p_147801_3_ + 1, p_147801_4_)) ++ if (Blocks.fire.canCatchFire(this.field_147845_a, p_147801_2_, p_147801_3_ + 1, p_147801_4_, DOWN)) { - d5 = (double)par2 + 0.5D + 0.5D; - d6 = (double)par2 + 0.5D - 0.5D; -@@ -3057,10 +3060,10 @@ - double d17 = (double)par2 + 0.5D + 0.0625D; - double d18 = (double)par4 + 0.5D - 0.0625D; - double d19 = (double)par4 + 0.5D + 0.0625D; -- boolean flag = par1BlockPane.canThisPaneConnectToThisBlockID(this.blockAccess.getBlockId(par2, par3, par4 - 1)); -- boolean flag1 = par1BlockPane.canThisPaneConnectToThisBlockID(this.blockAccess.getBlockId(par2, par3, par4 + 1)); -- boolean flag2 = par1BlockPane.canThisPaneConnectToThisBlockID(this.blockAccess.getBlockId(par2 - 1, par3, par4)); -- boolean flag3 = par1BlockPane.canThisPaneConnectToThisBlockID(this.blockAccess.getBlockId(par2 + 1, par3, par4)); -+ boolean flag = par1BlockPane.canPaneConnectTo(this.blockAccess,par2, par3, par4, NORTH); -+ boolean flag1 = par1BlockPane.canPaneConnectTo(this.blockAccess,par2, par3, par4, SOUTH); -+ boolean flag2 = par1BlockPane.canPaneConnectTo(this.blockAccess,par2, par3, par4, WEST); -+ boolean flag3 = par1BlockPane.canPaneConnectTo(this.blockAccess,par2, par3, par4, EAST); - boolean flag4 = par1BlockPane.shouldSideBeRendered(this.blockAccess, par2, par3 + 1, par4, 1); - boolean flag5 = par1BlockPane.shouldSideBeRendered(this.blockAccess, par2, par3 - 1, par4, 0); - double d20 = 0.01D; + d5 = (double)p_147801_2_ + 0.5D + 0.5D; + d6 = (double)p_147801_2_ + 0.5D - 0.5D; +@@ -3118,10 +3122,10 @@ + double d16 = (double)p_147767_2_ + 0.5D + 0.0625D; + double d17 = (double)p_147767_4_ + 0.5D - 0.0625D; + double d18 = (double)p_147767_4_ + 0.5D + 0.0625D; +- boolean flag = p_147767_1_.func_150098_a(this.field_147845_a.func_147439_a(p_147767_2_, p_147767_3_, p_147767_4_ - 1)); +- boolean flag1 = p_147767_1_.func_150098_a(this.field_147845_a.func_147439_a(p_147767_2_, p_147767_3_, p_147767_4_ + 1)); +- boolean flag2 = p_147767_1_.func_150098_a(this.field_147845_a.func_147439_a(p_147767_2_ - 1, p_147767_3_, p_147767_4_)); +- boolean flag3 = p_147767_1_.func_150098_a(this.field_147845_a.func_147439_a(p_147767_2_ + 1, p_147767_3_, p_147767_4_)); ++ boolean flag = p_147767_1_.canPaneConnectTo(this.field_147845_a, p_147767_2_, p_147767_3_, p_147767_4_ - 1, NORTH); ++ boolean flag1 = p_147767_1_.canPaneConnectTo(this.field_147845_a, p_147767_2_, p_147767_3_, p_147767_4_ + 1, SOUTH); ++ boolean flag2 = p_147767_1_.canPaneConnectTo(this.field_147845_a, p_147767_2_ - 1, p_147767_3_, p_147767_4_, WEST ); ++ boolean flag3 = p_147767_1_.canPaneConnectTo(this.field_147845_a, p_147767_2_ + 1, p_147767_3_, p_147767_4_, EAST ); + boolean flag4 = p_147767_1_.func_149646_a(this.field_147845_a, p_147767_2_, p_147767_3_ + 1, p_147767_4_, 1); + boolean flag5 = p_147767_1_.func_149646_a(this.field_147845_a, p_147767_2_, p_147767_3_ - 1, p_147767_4_, 0); + double d19 = 0.01D; diff --git a/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch b/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch index 8de1168c9..12802144c 100644 --- a/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/RenderGlobal.java +++ ../src-work/minecraft/net/minecraft/client/renderer/RenderGlobal.java -@@ -68,6 +68,9 @@ +@@ -79,6 +79,9 @@ import org.lwjgl.opengl.ARBOcclusionQuery; import org.lwjgl.opengl.GL11; @@ -10,43 +10,40 @@ @SideOnly(Side.CLIENT) public class RenderGlobal implements IWorldAccess { -@@ -447,8 +450,13 @@ - */ - public void renderEntities(Vec3 par1Vec3, ICamera par2ICamera, float par3) +@@ -411,8 +414,10 @@ + + public void func_147589_a(EntityLivingBase p_147589_1_, ICamera p_147589_2_, float p_147589_3_) { + int pass = MinecraftForgeClient.getRenderPass(); if (this.renderEntitiesStartupCounter > 0) { -+ if (pass > 0) -+ { -+ return; -+ } ++ if (pass > 0) return; --this.renderEntitiesStartupCounter; } else -@@ -456,6 +464,8 @@ +@@ -423,9 +428,12 @@ this.theWorld.theProfiler.startSection("prepare"); - TileEntityRenderer.instance.cacheActiveRenderInfo(this.theWorld, this.mc.getTextureManager(), this.mc.fontRenderer, this.mc.renderViewEntity, par3); - RenderManager.instance.cacheActiveRenderInfo(this.theWorld, this.mc.getTextureManager(), this.mc.fontRenderer, this.mc.renderViewEntity, this.mc.pointedEntityLiving, this.mc.gameSettings, par3); + TileEntityRendererDispatcher.field_147556_a.func_147542_a(this.theWorld, this.mc.getTextureManager(), this.mc.fontRenderer, this.mc.renderViewEntity, p_147589_3_); + RenderManager.instance.func_147938_a(this.theWorld, this.mc.getTextureManager(), this.mc.fontRenderer, this.mc.renderViewEntity, this.mc.field_147125_j, this.mc.gameSettings, p_147589_3_); + if (pass == 0) // no indentation to shrink patch + { this.countEntitiesTotal = 0; this.countEntitiesRendered = 0; this.countEntitiesHidden = 0; -@@ -466,16 +476,21 @@ - TileEntityRenderer.staticPlayerX = entitylivingbase.lastTickPosX + (entitylivingbase.posX - entitylivingbase.lastTickPosX) * (double)par3; - TileEntityRenderer.staticPlayerY = entitylivingbase.lastTickPosY + (entitylivingbase.posY - entitylivingbase.lastTickPosY) * (double)par3; - TileEntityRenderer.staticPlayerZ = entitylivingbase.lastTickPosZ + (entitylivingbase.posZ - entitylivingbase.lastTickPosZ) * (double)par3; + } - this.mc.entityRenderer.enableLightmap((double)par3); + EntityLivingBase entitylivingbase1 = this.mc.renderViewEntity; + double d3 = entitylivingbase1.lastTickPosX + (entitylivingbase1.posX - entitylivingbase1.lastTickPosX) * (double)p_147589_3_; + double d4 = entitylivingbase1.lastTickPosY + (entitylivingbase1.posY - entitylivingbase1.lastTickPosY) * (double)p_147589_3_; +@@ -454,13 +462,17 @@ + this.mc.entityRenderer.enableLightmap((double)p_147589_3_); this.theWorld.theProfiler.endStartSection("global"); List list = this.theWorld.getLoadedEntityList(); + if (pass == 0) // no indentation for smaller patch size + { this.countEntitiesTotal = list.size(); + } - int i; Entity entity; + int i; for (i = 0; i < this.theWorld.weatherEffects.size(); ++i) { @@ -54,30 +51,30 @@ + if (!entity.shouldRenderInPass(pass)) continue; ++this.countEntitiesRendered; - if (entity.isInRangeToRenderVec3D(par1Vec3)) -@@ -489,6 +504,7 @@ + if (entity.func_145770_h(d0, d1, d2)) +@@ -474,6 +486,7 @@ for (i = 0; i < list.size(); ++i) { entity = (Entity)list.get(i); + if (!entity.shouldRenderInPass(pass)) continue; - boolean flag = entity.isInRangeToRenderVec3D(par1Vec3) && (entity.ignoreFrustumCheck || par2ICamera.isBoundingBoxInFrustum(entity.boundingBox) || entity.riddenByEntity == this.mc.thePlayer); + boolean flag = entity.func_145770_h(d0, d1, d2) && (entity.ignoreFrustumCheck || p_147589_2_.isBoundingBoxInFrustum(entity.boundingBox) || entity.riddenByEntity == this.mc.thePlayer); if (!flag && entity instanceof EntityLiving) -@@ -514,7 +530,11 @@ +@@ -499,7 +512,11 @@ - for (i = 0; i < this.tileEntities.size(); ++i) + for (i = 0; i < this.field_147598_a.size(); ++i) { -- TileEntityRenderer.instance.renderTileEntity((TileEntity)this.tileEntities.get(i), par3); -+ TileEntity tile = (TileEntity)tileEntities.get(i); -+ if (tile.shouldRenderInPass(pass) && par2ICamera.isBoundingBoxInFrustum(tile.getRenderBoundingBox())) +- TileEntityRendererDispatcher.field_147556_a.func_147544_a((TileEntity)this.field_147598_a.get(i), p_147589_3_); ++ TileEntity tile = (TileEntity)this.field_147598_a.get(i); ++ if (tile.shouldRenderInPass(pass) && p_147589_2_.isBoundingBoxInFrustum(tile.getRenderBoundingBox())) + { -+ TileEntityRenderer.instance.renderTileEntity(tile, par3); ++ TileEntityRendererDispatcher.field_147556_a.func_147544_a(tile, p_147589_3_); + } } - this.mc.entityRenderer.disableLightmap((double)par3); -@@ -949,6 +969,12 @@ - */ + this.mc.entityRenderer.disableLightmap((double)p_147589_3_); +@@ -976,6 +993,12 @@ + // JAVADOC METHOD $$ func_72714_a public void renderSky(float par1) { + IRenderHandler skyProvider = null; @@ -89,7 +86,7 @@ if (this.mc.theWorld.provider.dimensionId == 1) { GL11.glDisable(GL11.GL_FOG); -@@ -1187,6 +1213,13 @@ +@@ -1214,6 +1237,12 @@ public void renderClouds(float par1) { @@ -99,11 +96,10 @@ + renderer.render(par1, theWorld, mc); + return; + } -+ if (this.mc.theWorld.provider.isSurfaceWorld()) { if (this.mc.gameSettings.fancyGraphics) -@@ -1596,6 +1629,11 @@ +@@ -1617,6 +1646,11 @@ public void drawBlockDamageTexture(Tessellator par1Tessellator, EntityPlayer par2EntityPlayer, float par3) { diff --git a/patches/minecraft/net/minecraft/client/renderer/Tessellator.java.patch b/patches/minecraft/net/minecraft/client/renderer/Tessellator.java.patch index 1c2b1deec..1e92aa99f 100644 --- a/patches/minecraft/net/minecraft/client/renderer/Tessellator.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/Tessellator.java.patch @@ -1,15 +1,14 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/Tessellator.java +++ ../src-work/minecraft/net/minecraft/client/renderer/Tessellator.java -@@ -7,6 +7,8 @@ +@@ -7,6 +7,7 @@ import java.nio.FloatBuffer; import java.nio.IntBuffer; import java.nio.ShortBuffer; +import java.util.Arrays; -+ - import org.lwjgl.opengl.ARBVertexBufferObject; - import org.lwjgl.opengl.GL11; - import org.lwjgl.opengl.GLContext; -@@ -14,6 +16,12 @@ + import java.util.PriorityQueue; + import net.minecraft.client.shader.TesselatorVertexState; + import net.minecraft.client.util.QuadComparator; +@@ -15,11 +16,18 @@ @SideOnly(Side.CLIENT) public class Tessellator { @@ -19,84 +18,44 @@ + public boolean defaultTexture = false; + private int rawBufferSize = 0; + public int textureID = 0; - /** - * Boolean used to check whether quads should be drawn as two triangles. Initialized to false and never changed. - */ -@@ -25,16 +33,16 @@ - private static boolean tryVBO; - - /** The byte buffer used for GL allocation. */ ++ + // JAVADOC FIELD $$ field_78394_d - private ByteBuffer byteBuffer; +- private IntBuffer field_147568_c; +- private FloatBuffer field_147566_d; +- private ShortBuffer field_147567_e; + private static ByteBuffer byteBuffer = GLAllocation.createDirectByteBuffer(nativeBufferSize * 4); - - /** The same memory as byteBuffer, but referenced as an integer buffer. */ -- private IntBuffer intBuffer; -+ private static IntBuffer intBuffer = byteBuffer.asIntBuffer(); - - /** The same memory as byteBuffer, but referenced as an float buffer. */ -- private FloatBuffer floatBuffer; -+ private static FloatBuffer floatBuffer = byteBuffer.asFloatBuffer(); - - /** Short buffer */ -- private ShortBuffer shortBuffer; -+ private static ShortBuffer shortBuffer = byteBuffer.asShortBuffer(); - - /** Raw integer array. */ ++ private static IntBuffer field_147568_c = byteBuffer.asIntBuffer(); ++ private static FloatBuffer field_147566_d = byteBuffer.asFloatBuffer(); ++ private static ShortBuffer field_147567_e = byteBuffer.asShortBuffer(); + // JAVADOC FIELD $$ field_78405_h private int[] rawBuffer; -@@ -110,10 +118,10 @@ - public boolean isDrawing; - - /** Whether we are currently using VBO or not. */ -- private boolean useVBO; -+ private static boolean useVBO = false; - - /** An IntBuffer used to store the indices of vertex buffer objects. */ -- private IntBuffer vertexBuffers; -+ private static IntBuffer vertexBuffers; - - /** - * The index of the last VBO used. This is used in round-robin fashion, sequentially, through the vboCount vertex -@@ -122,25 +130,28 @@ - private int vboIndex; - - /** Number of vertex buffer objects allocated for use. */ -- private int vboCount = 10; -+ private static int vboCount = 10; - - /** The size of the buffers used (in integers). */ - private int bufferSize; + // JAVADOC FIELD $$ field_78406_i +@@ -63,14 +71,17 @@ private Tessellator(int par1) { - this.bufferSize = par1; - this.byteBuffer = GLAllocation.createDirectByteBuffer(par1 * 4); -- this.intBuffer = this.byteBuffer.asIntBuffer(); -- this.floatBuffer = this.byteBuffer.asFloatBuffer(); -- this.shortBuffer = this.byteBuffer.asShortBuffer(); +- this.field_147568_c = this.byteBuffer.asIntBuffer(); +- this.field_147566_d = this.byteBuffer.asFloatBuffer(); +- this.field_147567_e = this.byteBuffer.asShortBuffer(); - this.rawBuffer = new int[par1]; -- this.useVBO = tryVBO && GLContext.getCapabilities().GL_ARB_vertex_buffer_object; -+ } -+ + } + + public Tessellator() + { + } -+ ++ + static + { + instance.defaultTexture = true; -+ useVBO = tryVBO && GLContext.getCapabilities().GL_ARB_vertex_buffer_object; - -- if (this.useVBO) -+ if (useVBO) - { -- this.vertexBuffers = GLAllocation.createDirectIntBuffer(this.vboCount); -- ARBVertexBufferObject.glGenBuffersARB(this.vertexBuffers); -+ vertexBuffers = GLAllocation.createDirectIntBuffer(vboCount); -+ ARBVertexBufferObject.glGenBuffersARB(vertexBuffers); - } - } - -@@ -157,12 +168,23 @@ ++ } ++ + // JAVADOC METHOD $$ func_78381_a + public int draw() + { +@@ -82,12 +93,15 @@ { this.isDrawing = false; @@ -104,57 +63,44 @@ + int offs = 0; + while (offs < vertexCount) { -+ int vtc = 0; -+ if (drawMode == 7 && convertQuadsToTriangles) -+ { -+ vtc = Math.min(vertexCount - offs, trivertsInBuffer); -+ } -+ else -+ { -+ vtc = Math.min(vertexCount - offs, nativeBufferSize >> 5); -+ } - this.intBuffer.clear(); -- this.intBuffer.put(this.rawBuffer, 0, this.rawBufferIndex); -+ this.intBuffer.put(this.rawBuffer, offs * 8, vtc * 8); ++ int vtc = Math.min(vertexCount - offs, nativeBufferSize >> 5); + this.field_147568_c.clear(); +- this.field_147568_c.put(this.rawBuffer, 0, this.field_147569_p); ++ this.field_147568_c.put(this.rawBuffer, offs * 8, vtc * 8); this.byteBuffer.position(0); -- this.byteBuffer.limit(this.rawBufferIndex * 4); +- this.byteBuffer.limit(this.field_147569_p * 4); + this.byteBuffer.limit(vtc * 32); + offs += vtc; - if (this.useVBO) + if (this.hasTexture) { -@@ -248,11 +270,11 @@ - - if (this.drawMode == 7 && convertQuadsToTriangles) - { -- GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, this.vertexCount); -+ GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, vtc); - } - else - { -- GL11.glDrawArrays(this.drawMode, 0, this.vertexCount); -+ GL11.glDrawArrays(this.drawMode, 0, vtc); - } - +@@ -122,7 +136,7 @@ + this.field_147566_d.position(0); + GL11.glVertexPointer(3, 32, this.field_147566_d); + GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); +- GL11.glDrawArrays(this.drawMode, 0, this.vertexCount); ++ GL11.glDrawArrays(this.drawMode, 0, vtc); GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); -@@ -280,6 +302,12 @@ + + if (this.hasTexture) +@@ -148,6 +162,12 @@ } } -+ if (rawBufferSize > 0x20000 && rawBufferIndex < (rawBufferSize << 3)) ++ if (rawBufferSize > 0x20000 && field_147569_p < (rawBufferSize << 3)) + { -+ rawBufferSize = 0; ++ field_147569_p = 0; + rawBuffer = null; + } + - int i = this.rawBufferIndex * 4; + int i = this.field_147569_p * 4; this.reset(); return i; -@@ -442,6 +470,19 @@ - */ +@@ -326,6 +346,19 @@ + // JAVADOC METHOD $$ func_78377_a public void addVertex(double par1, double par3, double par5) { -+ if (rawBufferIndex >= rawBufferSize - 32) ++ if (field_147569_p >= rawBufferSize - 32) + { + if (rawBufferSize == 0) + { @@ -169,17 +115,17 @@ + } ++this.addedVertices; - if (this.drawMode == 7 && convertQuadsToTriangles && this.addedVertices % 4 == 0) -@@ -500,12 +541,6 @@ - this.rawBuffer[this.rawBufferIndex + 2] = Float.floatToRawIntBits((float)(par5 + this.zOffset)); - this.rawBufferIndex += 8; + if (this.hasTexture) +@@ -354,12 +387,6 @@ + this.rawBuffer[this.field_147569_p + 2] = Float.floatToRawIntBits((float)(par5 + this.zOffset)); + this.field_147569_p += 8; ++this.vertexCount; - -- if (this.vertexCount % 4 == 0 && this.rawBufferIndex >= this.bufferSize - 32) +- if (this.vertexCount % 4 == 0 && this.field_147569_p >= this.bufferSize - 32) - { - this.draw(); - this.isDrawing = true; - } } - /** + // JAVADOC METHOD $$ func_78378_d diff --git a/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch index 52b23684b..a16f15928 100644 --- a/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch @@ -1,7 +1,7 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/WorldRenderer.java +++ ../src-work/minecraft/net/minecraft/client/renderer/WorldRenderer.java -@@ -23,7 +23,7 @@ - /** Reference to the World object. */ +@@ -29,7 +29,7 @@ + // JAVADOC FIELD $$ field_78924_a public World worldObj; private int glRenderList = -1; - private static Tessellator tessellator = Tessellator.instance; @@ -9,56 +9,60 @@ public static int chunksUpdated; public int posX; public int posY; -@@ -192,15 +192,16 @@ - GL11.glTranslatef(-8.0F, -8.0F, -8.0F); - GL11.glScalef(f, f, f); - GL11.glTranslatef(8.0F, 8.0F, 8.0F); -- tessellator.startDrawingQuads(); -- tessellator.setTranslation((double)(-this.posX), (double)(-this.posY), (double)(-this.posZ)); -+ //ForgeHooksClient.beforeRenderPass(l1); Noop fo now, TODO: Event if anyone needs -+ Tessellator.instance.startDrawingQuads(); -+ Tessellator.instance.setTranslation((double)(-this.posX), (double)(-this.posY), (double)(-this.posZ)); +@@ -177,7 +177,7 @@ + this.func_147890_b(k2); } - Block block = Block.blocksList[l2]; - - if (block != null) +- if (k2 == 0 && block.func_149716_u()) ++ if (k2 == 0 && block.hasTileEntity(chunkcache.getBlockMetadata(j3, l2, i3))) { -- if (l1 == 0 && block.hasTileEntity()) -+ if (l1 == 0 && block.hasTileEntity(chunkcache.getBlockMetadata(k2, i2, j2))) - { - TileEntity tileentity = chunkcache.getBlockTileEntity(k2, i2, j2); + TileEntity tileentity = chunkcache.func_147438_o(j3, l2, i3); -@@ -212,14 +213,15 @@ - - int i3 = block.getRenderBlockPass(); - -- if (i3 != l1) -+ if (i3 > l1) - { - flag = true; - } -- else if (i3 == l1) -+ if (!block.canRenderInPass(l1)) - { -- flag1 |= renderblocks.renderBlockByRenderType(block, k2, i2, j2); -+ continue; - } -+ flag1 |= renderblocks.renderBlockByRenderType(block, k2, i2, j2); +@@ -193,7 +193,9 @@ + { + flag = true; } - } - } -@@ -228,10 +230,11 @@ +- else if (k3 == k2) ++ ++ if (!block.canRenderInPass(k2)) continue; ++ + { + flag1 |= renderblocks.func_147805_b(block, j3, l2, i3); - if (flag2) - { -- this.bytesDrawn += tessellator.draw(); -+ //ForgeHooksClient.afterRenderPass(l1); Noop fo now, TODO: Event if anyone needs -+ this.bytesDrawn += Tessellator.instance.draw(); - GL11.glPopMatrix(); - GL11.glEndList(); -- tessellator.setTranslation(0.0D, 0.0D, 0.0D); -+ Tessellator.instance.setTranslation(0.0D, 0.0D, 0.0D); - } - else - { +@@ -252,21 +254,22 @@ + GL11.glTranslatef(-8.0F, -8.0F, -8.0F); + GL11.glScalef(f, f, f); + GL11.glTranslatef(8.0F, 8.0F, 8.0F); +- tessellator.startDrawingQuads(); +- tessellator.setTranslation((double)(-this.posX), (double)(-this.posY), (double)(-this.posZ)); ++ Tessellator.instance.startDrawingQuads(); ++ Tessellator.instance.setTranslation((double)(-this.posX), (double)(-this.posY), (double)(-this.posZ)); + } + + private void func_147891_a(int p_147891_1_, EntityLivingBase p_147891_2_) + { + if (p_147891_1_ == 1 && !this.skipRenderPass[p_147891_1_]) + { +- this.field_147894_y = tessellator.func_147564_a((float)p_147891_2_.posX, (float)p_147891_2_.posY, (float)p_147891_2_.posZ); ++ this.field_147894_y = Tessellator.instance.func_147564_a((float)p_147891_2_.posX, (float)p_147891_2_.posY, (float)p_147891_2_.posZ); + } + +- this.bytesDrawn += tessellator.draw(); ++ //ForgeHooksClient.afterRenderPass(l1); Noop fo now, TODO: Event if anyone needs ++ this.bytesDrawn += Tessellator.instance.draw(); + GL11.glPopMatrix(); + GL11.glEndList(); +- tessellator.setTranslation(0.0D, 0.0D, 0.0D); ++ Tessellator.instance.setTranslation(0.0D, 0.0D, 0.0D); + } + + public void func_147889_b(EntityLivingBase p_147889_1_) +@@ -274,7 +277,7 @@ + if (this.field_147894_y != null && !this.skipRenderPass[1]) + { + this.func_147890_b(1); +- tessellator.func_147565_a(this.field_147894_y); ++ Tessellator.instance.func_147565_a(this.field_147894_y); + this.func_147891_a(1, p_147889_1_); + } + } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java.patch index f3be8c979..09fc1ff96 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java.patch @@ -1,9 +1,9 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java -@@ -14,9 +14,15 @@ - import net.minecraft.item.EnumArmorMaterial; +@@ -15,9 +15,15 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemArmor; + import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; @@ -16,24 +16,101 @@ @SideOnly(Side.CLIENT) public class RenderBiped extends RenderLiving -@@ -49,11 +55,13 @@ +@@ -50,11 +56,13 @@ this.field_82425_h = new ModelBiped(0.5F); } -+ @Deprecated //Use the more sensitve version getArmorResource below ++ @Deprecated //Use the more sensitive version getArmorResource below public static ResourceLocation func_110857_a(ItemArmor par0ItemArmor, int par1) { return func_110858_a(par0ItemArmor, par1, (String)null); } -+ @Deprecated //Use the more sensitve version getArmorResource below ++ @Deprecated //Use the more sensitive version getArmorResource below public static ResourceLocation func_110858_a(ItemArmor par0ItemArmor, int par1, String par2Str) { String s1 = String.format("textures/models/armor/%s_layer_%d%s.png", new Object[] {bipedArmorFilenamePrefix[par0ItemArmor.renderIndex], Integer.valueOf(par1 == 2 ? 2 : 1), par2Str == null ? "" : String.format("_%s", new Object[]{par2Str})}); -@@ -68,6 +76,33 @@ - return resourcelocation; - } +@@ -81,7 +89,7 @@ + if (item instanceof ItemArmor) + { + ItemArmor itemarmor = (ItemArmor)item; +- this.bindTexture(func_110857_a(itemarmor, par2)); ++ this.bindTexture(getArmorResource(par1EntityLiving, itemstack, par2, null)); + ModelBiped modelbiped = par2 == 2 ? this.field_82425_h : this.field_82423_g; + modelbiped.bipedHead.showModel = par2 == 0; + modelbiped.bipedHeadwear.showModel = par2 == 0; +@@ -90,14 +98,16 @@ + modelbiped.bipedLeftArm.showModel = par2 == 1; + modelbiped.bipedRightLeg.showModel = par2 == 2 || par2 == 3; + modelbiped.bipedLeftLeg.showModel = par2 == 2 || par2 == 3; ++ modelbiped = ForgeHooksClient.getArmorModel(par1EntityLiving, itemstack, par2, modelbiped); + this.setRenderPassModel(modelbiped); + modelbiped.onGround = this.mainModel.onGround; + modelbiped.isRiding = this.mainModel.isRiding; + modelbiped.isChild = this.mainModel.isChild; +- if (itemarmor.getArmorMaterial() == ItemArmor.ArmorMaterial.CLOTH) ++ //Move out of if to allow for more then just CLOTH to have color ++ int j = itemarmor.getColor(itemstack); ++ if (j != -1) + { +- int j = itemarmor.getColor(itemstack); + float f1 = (float)(j >> 16 & 255) / 255.0F; + float f2 = (float)(j >> 8 & 255) / 255.0F; + float f3 = (float)(j & 255) / 255.0F; +@@ -135,7 +145,7 @@ + + if (item instanceof ItemArmor) + { +- this.bindTexture(func_110858_a((ItemArmor)item, par2, "overlay")); ++ this.bindTexture(getArmorResource(par1EntityLivingBase, itemstack, par2, "overlay")); + float f1 = 1.0F; + GL11.glColor3f(1.0F, 1.0F, 1.0F); + } +@@ -188,9 +198,12 @@ + this.modelBipedMain.bipedHead.postRender(0.0625F); + item = itemstack1.getItem(); + ++ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack1, EQUIPPED); ++ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack1, BLOCK_3D)); ++ + if (item instanceof ItemBlock) + { +- if (RenderBlocks.func_147739_a(Block.func_149634_a(item).func_149645_b())) ++ if (is3D || RenderBlocks.func_147739_a(Block.func_149634_a(item).func_149645_b())) + { + f1 = 0.625F; + GL11.glTranslatef(0.0F, -0.25F, 0.0F); +@@ -233,7 +246,10 @@ + this.modelBipedMain.bipedRightArm.postRender(0.0625F); + GL11.glTranslatef(-0.0625F, 0.4375F, 0.0625F); + +- if (item instanceof ItemBlock && RenderBlocks.func_147739_a(Block.func_149634_a(item).func_149645_b())) ++ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, EQUIPPED); ++ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack, BLOCK_3D)); ++ ++ if (item instanceof ItemBlock && (is3D || RenderBlocks.func_147739_a(Block.func_149634_a(item).func_149645_b()))) + { + f1 = 0.5F; + GL11.glTranslatef(0.0F, 0.1875F, -0.3125F); +@@ -289,7 +305,10 @@ + f3 = (float)(i >> 8 & 255) / 255.0F; + float f4 = (float)(i & 255) / 255.0F; + GL11.glColor4f(f2, f3, f4, 1.0F); +- this.renderManager.itemRenderer.renderItem(par1EntityLiving, itemstack, j); ++ for (int x = 1; x < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); x++) ++ { ++ this.renderManager.itemRenderer.renderItem(par1EntityLiving, itemstack, x); ++ } + } + } + else +@@ -344,4 +363,33 @@ + { + this.doRender((EntityLiving)par1Entity, par2, par4, par6, par8, par9); + } ++ ++ /*=================================== FORGE START =========================================*/ + /** + * More generic ForgeHook version of the above function, it allows for Items to have more control over what texture they provide. + * @@ -60,84 +137,5 @@ + + return resourcelocation; + } -+ - protected int func_130006_a(EntityLiving par1EntityLiving, int par2, float par3) - { - ItemStack itemstack = par1EntityLiving.func_130225_q(3 - par2); -@@ -79,7 +114,7 @@ - if (item instanceof ItemArmor) - { - ItemArmor itemarmor = (ItemArmor)item; -- this.bindTexture(func_110857_a(itemarmor, par2)); -+ this.bindTexture(getArmorResource(par1EntityLiving, itemstack, par2, null)); - ModelBiped modelbiped = par2 == 2 ? this.field_82425_h : this.field_82423_g; - modelbiped.bipedHead.showModel = par2 == 0; - modelbiped.bipedHeadwear.showModel = par2 == 0; -@@ -88,15 +123,17 @@ - modelbiped.bipedLeftArm.showModel = par2 == 1; - modelbiped.bipedRightLeg.showModel = par2 == 2 || par2 == 3; - modelbiped.bipedLeftLeg.showModel = par2 == 2 || par2 == 3; -+ modelbiped = ForgeHooksClient.getArmorModel(par1EntityLiving, itemstack, par2, modelbiped); - this.setRenderPassModel(modelbiped); - modelbiped.onGround = this.mainModel.onGround; - modelbiped.isRiding = this.mainModel.isRiding; - modelbiped.isChild = this.mainModel.isChild; - float f1 = 1.0F; - -- if (itemarmor.getArmorMaterial() == EnumArmorMaterial.CLOTH) -+ //Move out of if to allow for more then just CLOTH to have color -+ int j = itemarmor.getColor(itemstack); -+ if (j != -1) - { -- int j = itemarmor.getColor(itemstack); - float f2 = (float)(j >> 16 & 255) / 255.0F; - float f3 = (float)(j >> 8 & 255) / 255.0F; - float f4 = (float)(j & 255) / 255.0F; -@@ -134,7 +171,7 @@ - - if (item instanceof ItemArmor) - { -- this.bindTexture(func_110858_a((ItemArmor)item, par2, "overlay")); -+ this.bindTexture(getArmorResource(par1EntityLiving, itemstack, par2, "overlay")); - float f1 = 1.0F; - GL11.glColor3f(f1, f1, f1); - } -@@ -185,9 +222,12 @@ - GL11.glPushMatrix(); - this.modelBipedMain.bipedHead.postRender(0.0625F); - -- if (itemstack1.getItem().itemID < 256) -+ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack1, EQUIPPED); -+ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack1, BLOCK_3D)); -+ -+ if (itemstack1.getItem() instanceof ItemBlock) - { -- if (RenderBlocks.renderItemIn3d(Block.blocksList[itemstack1.itemID].getRenderType())) -+ if (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[itemstack1.itemID].getRenderType())) - { - f2 = 0.625F; - GL11.glTranslatef(0.0F, -0.25F, 0.0F); -@@ -229,7 +269,10 @@ - this.modelBipedMain.bipedRightArm.postRender(0.0625F); - GL11.glTranslatef(-0.0625F, 0.4375F, 0.0625F); - -- if (itemstack.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType())) -+ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, EQUIPPED); -+ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack, BLOCK_3D)); -+ -+ if (itemstack.getItem() instanceof ItemBlock && (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))) - { - f2 = 0.5F; - GL11.glTranslatef(0.0F, 0.1875F, -0.3125F); -@@ -276,7 +319,10 @@ - - if (itemstack.getItem().requiresMultipleRenderPasses()) - { -- this.renderManager.itemRenderer.renderItem(par1EntityLiving, itemstack, 1); -+ for (int x = 1; x < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); x++) -+ { -+ this.renderManager.itemRenderer.renderItem(par1EntityLiving, itemstack, x); -+ } - } - - GL11.glPopMatrix(); ++ /*=================================== 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 index f41993529..85f854cde 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch @@ -1,6 +1,14 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderItem.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderItem.java -@@ -21,6 +21,8 @@ +@@ -17,6 +17,7 @@ + import net.minecraft.crash.CrashReportCategory; + import net.minecraft.entity.Entity; + import net.minecraft.entity.item.EntityItem; ++import net.minecraft.item.Item; + import net.minecraft.item.ItemBlock; + import net.minecraft.item.ItemCloth; + import net.minecraft.item.ItemStack; +@@ -27,6 +28,8 @@ import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; @@ -9,276 +17,226 @@ @SideOnly(Side.CLIENT) public class RenderItem extends Render { -@@ -53,30 +55,10 @@ - if (itemstack.getItem() != null) - { +@@ -56,7 +59,7 @@ + this.bindEntityTexture(par1EntityItem); + this.random.setSeed(187L); GL11.glPushMatrix(); - float f2 = MathHelper.sin(((float)par1EntityItem.age + par9) / 10.0F + par1EntityItem.hoverStart) * 0.1F + 0.1F; + float f2 = shouldBob() ? MathHelper.sin(((float)par1EntityItem.age + par9) / 10.0F + par1EntityItem.hoverStart) * 0.1F + 0.1F : 0F; float f3 = (((float)par1EntityItem.age + par9) / 20.0F + par1EntityItem.hoverStart) * (180F / (float)Math.PI); -- byte b0 = 1; -+ byte b0 = getMiniBlockCount(itemstack); + byte b0 = 1; -- if (par1EntityItem.getEntityItem().stackSize > 1) -- { -- b0 = 2; -- } -- -- if (par1EntityItem.getEntityItem().stackSize > 5) -- { -- b0 = 3; -- } -- -- if (par1EntityItem.getEntityItem().stackSize > 20) -- { -- b0 = 4; -- } -- -- if (par1EntityItem.getEntityItem().stackSize > 40) -- { -- b0 = 5; -- } -- +@@ -80,12 +83,19 @@ + b0 = 5; + } + ++ b0 = getMiniBlockCount(itemstack, b0); ++ GL11.glTranslatef((float)par2, (float)par4 + f2, (float)par6); GL11.glEnable(GL12.GL_RESCALE_NORMAL); - float f4; -@@ -84,9 +66,18 @@ + float f7; float f6; - int i; + int k; -- if (itemstack.getItemSpriteNumber() == 0 && itemstack.itemID < Block.blocksList.length && Block.blocksList[itemstack.itemID] != null && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType())) -+ Block block = null; -+ if (itemstack.itemID < Block.blocksList.length) - { -- Block block = Block.blocksList[itemstack.itemID]; -+ block = Block.blocksList[itemstack.itemID]; -+ } -+ -+ if (ForgeHooksClient.renderEntityItem(par1EntityItem, itemstack, f2, f3, random, renderManager.renderEngine, renderBlocks)) ++ if (ForgeHooksClient.renderEntityItem(par1EntityItem, itemstack, f2, f3, random, renderManager.renderEngine, field_147909_c, b0)) + { + ; + } -+ else if (itemstack.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType())) -+ { - GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F); - - if (renderInFrame) -@@ -127,7 +118,7 @@ ++ else // Code Style break here to prevent the patch from editing this line + if (itemstack.getItemSpriteNumber() == 0 && itemstack.getItem() instanceof ItemBlock && RenderBlocks.func_147739_a(Block.func_149634_a(itemstack.getItem()).func_149645_b())) { - float f8; + Block block = Block.func_149634_a(itemstack.getItem()); +@@ -140,7 +150,7 @@ + { + float f5; - if (itemstack.getItemSpriteNumber() == 1 && itemstack.getItem().requiresMultipleRenderPasses()) -+ if (itemstack.getItem().requiresMultipleRenderPasses()) ++ if (/*itemstack.getItemSpriteNumber() == 1 &&*/ itemstack.getItem().requiresMultipleRenderPasses()) { if (renderInFrame) { -@@ -139,10 +130,10 @@ +@@ -152,10 +162,10 @@ GL11.glScalef(0.5F, 0.5F, 0.5F); } -- for (int k = 0; k <= 1; ++k) -+ for (int k = 0; k < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++k) +- for (int j = 0; j <= 1; ++j) ++ for (int j = 0; j <= itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++j) { this.random.setSeed(187L); -- Icon icon = itemstack.getItem().getIconFromDamageForRenderPass(itemstack.getItemDamage(), k); -+ Icon icon = itemstack.getItem().getIcon(itemstack, k); - f8 = 1.0F; +- IIcon iicon1 = itemstack.getItem().getIconFromDamageForRenderPass(itemstack.getItemDamage(), j); ++ IIcon iicon1 = itemstack.getItem().getIcon(itemstack, j); if (this.renderWithColor) -@@ -152,11 +143,11 @@ - f4 = (float)(i >> 8 & 255) / 255.0F; - f6 = (float)(i & 255) / 255.0F; - GL11.glColor4f(f5 * f8, f4 * f8, f6 * f8, 1.0F); -- this.renderDroppedItem(par1EntityItem, icon, b0, par9, f5 * f8, f4 * f8, f6 * f8); -+ this.renderDroppedItem(par1EntityItem, icon, b0, par9, f5 * f8, f4 * f8, f6 * f8, k); + { +@@ -164,11 +174,11 @@ + f6 = (float)(k >> 8 & 255) / 255.0F; + f7 = (float)(k & 255) / 255.0F; + GL11.glColor4f(f5, f6, f7, 1.0F); +- this.renderDroppedItem(par1EntityItem, iicon1, b0, par9, f5, f6, f7); ++ this.renderDroppedItem(par1EntityItem, iicon1, b0, par9, f5, f6, f7, j); } else { -- this.renderDroppedItem(par1EntityItem, icon, b0, par9, 1.0F, 1.0F, 1.0F); -+ this.renderDroppedItem(par1EntityItem, icon, b0, par9, 1.0F, 1.0F, 1.0F, k); +- this.renderDroppedItem(par1EntityItem, iicon1, b0, par9, 1.0F, 1.0F, 1.0F); ++ this.renderDroppedItem(par1EntityItem, iicon1, b0, par9, 1.0F, 1.0F, 1.0F, j); } } } -@@ -205,6 +196,10 @@ - */ - private void renderDroppedItem(EntityItem par1EntityItem, Icon par2Icon, int par3, float par4, float par5, float par6, float par7) +@@ -227,6 +237,12 @@ + // JAVADOC METHOD $$ func_77020_a + private void renderDroppedItem(EntityItem par1EntityItem, IIcon par2Icon, int par3, float par4, float par5, float par6, float par7) { -+ renderDroppedItem(par1EntityItem, par2Icon, par3, par4, par5, par6, par7, 0); ++ this.renderDroppedItem(par1EntityItem, par2Icon, par3, par4, par5, par6, par7, 0); + } -+ private void renderDroppedItem(EntityItem par1EntityItem, Icon par2Icon, int par3, float par4, float par5, float par6, float par7, int pass) ++ ++ // JAVADOC METHOD $$ func_77020_a ++ private void renderDroppedItem(EntityItem par1EntityItem, IIcon par2Icon, int par3, float par4, float par5, float par6, float par7, int pass) + { Tessellator tessellator = Tessellator.instance; if (par2Icon == null) -@@ -240,32 +235,26 @@ - f11 = 0.021875F; - ItemStack itemstack = par1EntityItem.getEntityItem(); - int j = itemstack.stackSize; -- byte b0; -+ byte b0 = getMiniItemCount(itemstack); +@@ -281,11 +297,24 @@ + b0 = 4; + } -- if (j < 2) -- { -- b0 = 1; -- } -- else if (j < 16) -- { -- b0 = 2; -- } -- else if (j < 32) -- { -- b0 = 3; -- } -- else -- { -- b0 = 4; -- } -- - GL11.glTranslatef(-f9, -f10, -((f12 + f11) * (float)b0 / 2.0F)); ++ b0 = getMiniItemCount(itemstack, b0); ++ + GL11.glTranslatef(-f7, -f8, -((f9 + f10) * (float)b0 / 2.0F)); for (int k = 0; k < b0; ++k) { -- GL11.glTranslatef(0.0F, 0.0F, f12 + f11); +- GL11.glTranslatef(0.0F, 0.0F, f9 + f10); + // Makes items offset when in 3D, like when in 2D, looks much better. Considered a vanilla bug... + if (k > 0 && shouldSpreadItems()) + { + float x = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F; + float y = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F; + float z = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F; -+ GL11.glTranslatef(x, y, f12 + f11); ++ GL11.glTranslatef(x, y, f9 + f10); + } + else + { -+ GL11.glTranslatef(0f, 0f, f12 + f11); ++ GL11.glTranslatef(0f, 0f, f9 + f10); + } -- if (itemstack.getItemSpriteNumber() == 0 && Block.blocksList[itemstack.itemID] != null) -+ if (itemstack.getItemSpriteNumber() == 0) + if (itemstack.getItemSpriteNumber() == 0) { - this.bindTexture(TextureMap.locationBlocksTexture); - } -@@ -277,7 +266,7 @@ +@@ -299,7 +328,7 @@ GL11.glColor4f(par5, par6, par7, 1.0F); - ItemRenderer.renderItemIn2D(tessellator, f5, f6, f4, f7, ((Icon)par2Icon).getIconWidth(), ((Icon)par2Icon).getIconHeight(), f12); + ItemRenderer.renderItemIn2D(tessellator, f15, f4, f14, f5, ((IIcon)par2Icon).getIconWidth(), ((IIcon)par2Icon).getIconHeight(), f9); - if (itemstack.hasEffect()) + if (itemstack.hasEffect(pass)) { GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_LIGHTING); -@@ -348,6 +337,10 @@ - */ +@@ -368,6 +397,12 @@ + // JAVADOC METHOD $$ func_77015_a public void renderItemIntoGUI(FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5) { -+ renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, false); ++ this.renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, false); + } ++ ++ // JAVADOC METHOD $$ func_77015_a + public void renderItemIntoGUI(FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5, boolean renderEffect) + { - int k = par3ItemStack.itemID; - int l = par3ItemStack.getItemDamage(); + int k = par3ItemStack.getItemDamage(); Object object = par3ItemStack.getIconIndex(); -@@ -356,10 +349,10 @@ - float f1; - float f2; + GL11.glEnable(GL11.GL_BLEND); +@@ -428,9 +463,11 @@ + GL11.glEnable(GL11.GL_ALPHA_TEST); + OpenGlHelper.func_148821_a(770, 771, 1, 0); -- if (par3ItemStack.getItemSpriteNumber() == 0 && RenderBlocks.renderItemIn3d(Block.blocksList[k].getRenderType())) -+ Block block = (k < Block.blocksList.length ? Block.blocksList[k] : null); -+ if (par3ItemStack.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d(Block.blocksList[k].getRenderType())) - { - par2TextureManager.bindTexture(TextureMap.locationBlocksTexture); -- Block block = Block.blocksList[k]; - GL11.glPushMatrix(); - GL11.glTranslatef((float)(par4 - 2), (float)(par5 + 3), -3.0F + this.zLevel); - GL11.glScalef(10.0F, 10.0F, 10.0F); -@@ -386,11 +379,11 @@ - else if (Item.itemsList[k].requiresMultipleRenderPasses()) - { - GL11.glDisable(GL11.GL_LIGHTING); -- par2TextureManager.bindTexture(TextureMap.locationItemsTexture); - -- for (int j1 = 0; j1 <= 1; ++j1) -+ for (int j1 = 0; j1 < Item.itemsList[k].getRenderPasses(l); ++j1) +- for (l = 0; l <= 1; ++l) ++ Item item = par3ItemStack.getItem(); ++ for (l = 0; l <= item.getRenderPasses(k); ++l) { -- Icon icon = Item.itemsList[k].getIconFromDamageForRenderPass(l, j1); -+ par2TextureManager.bindTexture(par3ItemStack.getItemSpriteNumber() == 0 ? TextureMap.locationBlocksTexture : TextureMap.locationItemsTexture); -+ Icon icon = Item.itemsList[k].getIcon(par3ItemStack, j1); - int k1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, j1); - f1 = (float)(k1 >> 16 & 255) / 255.0F; - f2 = (float)(k1 >> 8 & 255) / 255.0F; -@@ -402,6 +395,11 @@ +- IIcon iicon = par3ItemStack.getItem().getIconFromDamageForRenderPass(k, l); ++ par2TextureManager.bindTexture(item.getSpriteNumber() == 0 ? TextureMap.locationBlocksTexture : TextureMap.locationItemsTexture); ++ IIcon iicon = item.getIcon(par3ItemStack, l); + int i1 = par3ItemStack.getItem().getColorFromItemStack(par3ItemStack, l); + f = (float)(i1 >> 16 & 255) / 255.0F; + float f1 = (float)(i1 >> 8 & 255) / 255.0F; +@@ -442,6 +479,11 @@ } - this.renderIcon(par4, par5, icon, 16, 16); + this.renderIcon(par4, par5, iicon, 16, 16); + -+ if (par3ItemStack.hasEffect(j1)) ++ if (renderEffect && par3ItemStack.hasEffect(l)) + { + renderEffect(par2TextureManager, par4, par5); + } } - GL11.glEnable(GL11.GL_LIGHTING); -@@ -429,11 +427,34 @@ + GL11.glDisable(GL11.GL_ALPHA_TEST); +@@ -469,6 +511,11 @@ + } - this.renderIcon(par4, par5, (Icon)object, 16, 16); - GL11.glEnable(GL11.GL_LIGHTING); + this.renderIcon(par4, par5, (IIcon)object, 16, 16); + -+ if (par3ItemStack.hasEffect(0)) ++ if (renderEffect && par3ItemStack.hasEffect(0)) + { + renderEffect(par2TextureManager, par4, par5); + } + GL11.glEnable(GL11.GL_LIGHTING); } - GL11.glEnable(GL11.GL_CULL_FACE); - } +@@ -484,7 +531,10 @@ -+ private void renderEffect(TextureManager manager, int x, int y) -+ { -+ GL11.glDepthFunc(GL11.GL_GREATER); -+ GL11.glDisable(GL11.GL_LIGHTING); -+ GL11.glDepthMask(false); -+ manager.bindTexture(RES_ITEM_GLINT); -+ this.zLevel -= 50.0F; -+ GL11.glEnable(GL11.GL_BLEND); -+ GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_DST_COLOR); -+ GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F); -+ this.renderGlint(x * 431278612 + y * 32178161, x - 2, y - 2, 20, 20); -+ GL11.glDisable(GL11.GL_BLEND); -+ GL11.glDepthMask(true); -+ this.zLevel += 50.0F; -+ GL11.glEnable(GL11.GL_LIGHTING); -+ GL11.glDepthFunc(GL11.GL_LEQUAL); -+ } -+ - /** - * Render the item's icon or block into the GUI, including the glint effect. - */ -@@ -441,8 +462,12 @@ - { - if (par3ItemStack != null) - { -- this.renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5); -+ if (!ForgeHooksClient.renderInventoryItem(renderBlocks, par2TextureManager, par3ItemStack, renderWithColor, zLevel, (float)par4, (float)par5)) -+ { -+ this.renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, true); -+ } + try + { +- this.renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5); ++ if (!ForgeHooksClient.renderInventoryItem(this.field_147909_c, par2TextureManager, par3ItemStack, renderWithColor, zLevel, (float)par4, (float)par5)) ++ { ++ this.renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, true); ++ } + } + catch (Throwable throwable) + { +@@ -525,6 +575,7 @@ + throw new ReportedException(crashreport); + } -+ /* Modders must handle this themselves if they use custom renderers! ++ /* Forge: Bugfix, Move this to a per-render pass, modders must handle themselves if (par3ItemStack.hasEffect()) { - GL11.glDepthFunc(GL11.GL_GREATER); -@@ -460,6 +485,7 @@ + GL11.glDepthFunc(GL11.GL_EQUAL); +@@ -540,11 +591,28 @@ GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); } + */ + + this.zLevel -= 50.0F; } } -@@ -586,4 +612,47 @@ ++ public void renderEffect(TextureManager manager, int x, int y) ++ { ++ GL11.glDepthFunc(GL11.GL_EQUAL); ++ GL11.glDisable(GL11.GL_LIGHTING); ++ GL11.glDepthMask(false); ++ manager.bindTexture(RES_ITEM_GLINT); ++ GL11.glEnable(GL11.GL_ALPHA_TEST); ++ GL11.glEnable(GL11.GL_BLEND); ++ GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F); ++ this.renderGlint(x * 431278612 + y * 32178161, x - 2, y - 2, 20, 20); ++ GL11.glDepthMask(true); ++ GL11.glDisable(GL11.GL_ALPHA_TEST); ++ GL11.glEnable(GL11.GL_LIGHTING); ++ GL11.glDepthFunc(GL11.GL_LEQUAL); ++ } ++ + private void renderGlint(int par1, int par2, int par3, int par4, int par5) { - this.doRenderItem((EntityItem)par1Entity, par2, par4, par6, par8, par9); + for (int j1 = 0; j1 < 2; ++j1) +@@ -649,4 +717,42 @@ + { + this.doRender((EntityItem)par1Entity, par2, par4, par6, par8, par9); } + ++ /*==================================== FORGE START ===========================================*/ ++ + /** + * Items should spread out when rendered in 3d? + * @return @@ -297,28 +255,21 @@ + return true; + } + -+ public byte getMiniBlockCount(ItemStack stack) ++ public byte getMiniBlockCount(ItemStack stack, byte original) + { -+ byte ret = 1; -+ if (stack.stackSize > 1 ) ret = 2; -+ if (stack.stackSize > 5 ) ret = 3; -+ if (stack.stackSize > 20) ret = 4; -+ if (stack.stackSize > 40) ret = 5; -+ return ret; ++ return original; + } + + /** + * Allows for a subclass to override how many rendered items appear in a + * "mini item 3d stack" -+ * @param stack ++ * @param stack The item stack ++ * @param original The default amount vanilla would use + * @return + */ -+ public byte getMiniItemCount(ItemStack stack) ++ public byte getMiniItemCount(ItemStack stack, byte original) + { -+ byte ret = 1; -+ if (stack.stackSize > 1) ret = 2; -+ if (stack.stackSize > 15) ret = 3; -+ if (stack.stackSize > 31) ret = 4; -+ return ret; ++ return original; + } ++ /*==================================== FORGE END =============================================*/ } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch index 06ec9da9d..9648432a7 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch @@ -1,21 +1,19 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderManager.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderManager.java -@@ -223,12 +223,14 @@ - - if (par4EntityLivingBase.isPlayerSleeping()) +@@ -218,11 +218,13 @@ + if (p_147938_4_.isPlayerSleeping()) { -- int i = par1World.getBlockId(MathHelper.floor_double(par4EntityLivingBase.posX), MathHelper.floor_double(par4EntityLivingBase.posY), MathHelper.floor_double(par4EntityLivingBase.posZ)); -+ int x = MathHelper.floor_double(par4EntityLivingBase.posX); -+ int y = MathHelper.floor_double(par4EntityLivingBase.posY); -+ int z = MathHelper.floor_double(par4EntityLivingBase.posZ); -+ Block block = Block.blocksList[par1World.getBlockId(x, y, z)]; + Block block = p_147938_1_.func_147439_a(MathHelper.floor_double(p_147938_4_.posX), MathHelper.floor_double(p_147938_4_.posY), MathHelper.floor_double(p_147938_4_.posZ)); ++ int x = MathHelper.floor_double(p_147938_4_.posX); ++ int y = MathHelper.floor_double(p_147938_4_.posY); ++ int z = MathHelper.floor_double(p_147938_4_.posZ); -- if (i == Block.bed.blockID) -+ if (block != null && block.isBed(par1World, x, y, z, par4EntityLivingBase)) +- if (block == Blocks.bed) ++ if (block.isBed(p_147938_1_, x, y, z, p_147938_4_)) { -- int j = par1World.getBlockMetadata(MathHelper.floor_double(par4EntityLivingBase.posX), MathHelper.floor_double(par4EntityLivingBase.posY), MathHelper.floor_double(par4EntityLivingBase.posZ)); -- int k = j & 3; -+ int k = block.getBedDirection(par1World, x, y, z); - this.playerViewY = (float)(k * 90 + 180); +- int i = p_147938_1_.getBlockMetadata(MathHelper.floor_double(p_147938_4_.posX), MathHelper.floor_double(p_147938_4_.posY), MathHelper.floor_double(p_147938_4_.posZ)); +- int j = i & 3; ++ int j = block.getBedDirection(p_147938_1_, x, y, z); + this.playerViewY = (float)(j * 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 index 65c769b1d..96574b206 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch @@ -1,9 +1,9 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java -@@ -15,13 +15,22 @@ - import net.minecraft.item.EnumArmorMaterial; +@@ -16,13 +16,22 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemArmor; + import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.scoreboard.Score; @@ -46,7 +46,7 @@ ModelBiped modelbiped = par2 == 2 ? this.modelArmor : this.modelArmorChestplate; modelbiped.bipedHead.showModel = par2 == 0; modelbiped.bipedHeadwear.showModel = par2 == 0; -@@ -62,15 +78,17 @@ +@@ -62,14 +78,16 @@ modelbiped.bipedLeftArm.showModel = par2 == 1; modelbiped.bipedRightLeg.showModel = par2 == 2 || par2 == 3; modelbiped.bipedLeftLeg.showModel = par2 == 2 || par2 == 3; @@ -55,45 +55,44 @@ modelbiped.onGround = this.mainModel.onGround; modelbiped.isRiding = this.mainModel.isRiding; modelbiped.isChild = this.mainModel.isChild; - float f1 = 1.0F; -- if (itemarmor.getArmorMaterial() == EnumArmorMaterial.CLOTH) +- if (itemarmor.getArmorMaterial() == ItemArmor.ArmorMaterial.CLOTH) + //Move outside if to allow for more then just CLOTH + int j = itemarmor.getColor(itemstack); + if (j != -1) { - int j = itemarmor.getColor(itemstack); - float f2 = (float)(j >> 16 & 255) / 255.0F; - float f3 = (float)(j >> 8 & 255) / 255.0F; - float f4 = (float)(j & 255) / 255.0F; -@@ -108,7 +126,7 @@ + float f1 = (float)(j >> 16 & 255) / 255.0F; + float f2 = (float)(j >> 8 & 255) / 255.0F; + float f3 = (float)(j & 255) / 255.0F; +@@ -107,7 +125,7 @@ if (item instanceof ItemArmor) { - this.bindTexture(RenderBiped.func_110858_a((ItemArmor)item, par2, "overlay")); + this.bindTexture(RenderBiped.getArmorResource(par1AbstractClientPlayer, itemstack, par2, "overlay")); - float f1 = 1.0F; - GL11.glColor3f(f1, f1, f1); + GL11.glColor3f(1.0F, 1.0F, 1.0F); } -@@ -117,6 +135,7 @@ - - public void func_130009_a(AbstractClientPlayer par1AbstractClientPlayer, double par2, double par4, double par6, float par8, float par9) + } +@@ -116,6 +134,7 @@ + // JAVADOC METHOD $$ func_76986_a + public void doRender(AbstractClientPlayer par1AbstractClientPlayer, double par2, double par4, double par6, float par8, float par9) { + if (MinecraftForge.EVENT_BUS.post(new RenderPlayerEvent.Pre(par1AbstractClientPlayer, this, par9))) return; - float f2 = 1.0F; - GL11.glColor3f(f2, f2, f2); + GL11.glColor3f(1.0F, 1.0F, 1.0F); ItemStack itemstack = par1AbstractClientPlayer.inventory.getCurrentItem(); -@@ -148,6 +167,7 @@ + this.modelArmorChestplate.heldItemRight = this.modelArmor.heldItemRight = this.modelBipedMain.heldItemRight = itemstack != null ? 1 : 0; +@@ -146,6 +165,7 @@ this.modelArmorChestplate.aimedBow = this.modelArmor.aimedBow = this.modelBipedMain.aimedBow = false; this.modelArmorChestplate.isSneak = this.modelArmor.isSneak = this.modelBipedMain.isSneak = false; this.modelArmorChestplate.heldItemRight = this.modelArmor.heldItemRight = this.modelBipedMain.heldItemRight = 0; + MinecraftForge.EVENT_BUS.post(new RenderPlayerEvent.Post(par1AbstractClientPlayer, this, par9)); } - protected ResourceLocation func_110817_a(AbstractClientPlayer par1AbstractClientPlayer) -@@ -160,21 +180,30 @@ - */ - protected void renderSpecials(AbstractClientPlayer par1AbstractClientPlayer, float par2) + // JAVADOC METHOD $$ func_110775_a +@@ -156,12 +176,18 @@ + + protected void renderEquippedItems(AbstractClientPlayer par1AbstractClientPlayer, float par2) { + RenderPlayerEvent.Specials.Pre event = new RenderPlayerEvent.Specials.Pre(par1AbstractClientPlayer, this, par2); + if (MinecraftForge.EVENT_BUS.post(event)) @@ -101,8 +100,7 @@ + return; + } + - float f1 = 1.0F; - GL11.glColor3f(f1, f1, f1); + GL11.glColor3f(1.0F, 1.0F, 1.0F); super.renderEquippedItems(par1AbstractClientPlayer, par2); super.renderArrowsStuckInEntity(par1AbstractClientPlayer, par2); ItemStack itemstack = par1AbstractClientPlayer.inventory.armorItemInSlot(3); @@ -112,28 +110,27 @@ { GL11.glPushMatrix(); this.modelBipedMain.bipedHead.postRender(0.0625F); - float f2; +@@ -169,7 +195,10 @@ -- if (itemstack.getItem().itemID < 256) -+ if (itemstack != null && itemstack.getItem() instanceof ItemBlock) + if (itemstack.getItem() instanceof ItemBlock) { -- if (RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType())) +- if (RenderBlocks.func_147739_a(Block.func_149634_a(itemstack.getItem()).func_149645_b())) + IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, EQUIPPED); + boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack, BLOCK_3D)); + -+ if (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType())) ++ if (is3D || RenderBlocks.func_147739_a(Block.func_149634_a(itemstack.getItem()).func_149645_b())) { - f2 = 0.625F; + f1 = 0.625F; GL11.glTranslatef(0.0F, -0.25F, 0.0F); -@@ -226,6 +255,7 @@ - boolean flag = par1AbstractClientPlayer.getTextureCape().isTextureUploaded(); - boolean flag1 = !par1AbstractClientPlayer.isInvisible(); - boolean flag2 = !par1AbstractClientPlayer.getHideCape(); -+ flag = event.renderCape && flag; - float f6; +@@ -221,6 +250,7 @@ + } - if (flag && flag1 && flag2) -@@ -277,7 +307,7 @@ + boolean flag = par1AbstractClientPlayer.getTextureCape().isTextureUploaded(); ++ flag = event.renderCape && flag; + float f5; + + if (flag && !par1AbstractClientPlayer.isInvisible() && !par1AbstractClientPlayer.getHideCape()) +@@ -272,7 +302,7 @@ ItemStack itemstack1 = par1AbstractClientPlayer.inventory.getCurrentItem(); @@ -142,33 +139,32 @@ { GL11.glPushMatrix(); this.modelBipedMain.bipedRightArm.postRender(0.0625F); -@@ -297,7 +327,11 @@ +@@ -290,7 +320,10 @@ + enumaction = itemstack1.getItemUseAction(); + } - float f11; - -- if (itemstack1.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack1.itemID].getRenderType())) +- if (itemstack1.getItem() instanceof ItemBlock && RenderBlocks.func_147739_a(Block.func_149634_a(itemstack1.getItem()).func_149645_b())) + IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack1, EQUIPPED); + boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack1, BLOCK_3D)); -+ boolean isBlock = itemstack1.itemID < Block.blocksList.length && itemstack1.getItemSpriteNumber() == 0; + -+ if (is3D || (isBlock && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack1.itemID].getRenderType()))) ++ if (is3D || itemstack1.getItem() instanceof ItemBlock && RenderBlocks.func_147739_a(Block.func_149634_a(itemstack1.getItem()).func_149645_b())) { - f11 = 0.5F; + f3 = 0.5F; GL11.glTranslatef(0.0F, 0.1875F, -0.3125F); -@@ -354,7 +388,7 @@ +@@ -347,7 +380,7 @@ if (itemstack1.getItem().requiresMultipleRenderPasses()) { -- for (j = 0; j <= 1; ++j) -+ for (j = 0; j < itemstack1.getItem().getRenderPasses(itemstack1.getItemDamage()); ++j) +- for (k = 0; k <= 1; ++k) ++ for (k = 0; k <= itemstack1.getItem().getRenderPasses(itemstack1.getItemDamage()); ++k) { - int k = itemstack1.getItem().getColorFromItemStack(itemstack1, j); - f13 = (float)(k >> 16 & 255) / 255.0F; -@@ -376,6 +410,7 @@ + int i = itemstack1.getItem().getColorFromItemStack(itemstack1, k); + f12 = (float)(i >> 16 & 255) / 255.0F; +@@ -369,6 +402,7 @@ GL11.glPopMatrix(); } + MinecraftForge.EVENT_BUS.post(new RenderPlayerEvent.Specials.Post(par1AbstractClientPlayer, this, par2)); } - protected void renderPlayerScale(AbstractClientPlayer par1AbstractClientPlayer, float par2) + // JAVADOC METHOD $$ func_77041_b diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderSnowMan.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderSnowMan.java.patch index dce268645..3a5f5b494 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderSnowMan.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderSnowMan.java.patch @@ -1,10 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderSnowMan.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderSnowMan.java -@@ -8,9 +8,14 @@ - import net.minecraft.entity.Entity; - import net.minecraft.entity.EntityLivingBase; - import net.minecraft.entity.monster.EntitySnowman; -+import net.minecraft.item.ItemBlock; +@@ -13,6 +13,10 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; @@ -15,21 +11,15 @@ @SideOnly(Side.CLIENT) public class RenderSnowMan extends RenderLiving -@@ -35,12 +40,15 @@ - super.renderEquippedItems(par1EntitySnowman, par2); - ItemStack itemstack = new ItemStack(Block.pumpkin, 1); - -- if (itemstack != null && itemstack.getItem().itemID < 256) -+ if (itemstack != null && itemstack.getItem() instanceof ItemBlock) - { +@@ -39,7 +43,10 @@ GL11.glPushMatrix(); this.snowmanModel.head.postRender(0.0625F); -- if (RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType())) +- if (RenderBlocks.func_147739_a(Block.func_149634_a(itemstack.getItem()).func_149645_b())) + IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, EQUIPPED); + boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack, BLOCK_3D)); + -+ if (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType())) ++ if (is3D || RenderBlocks.func_147739_a(Block.func_149634_a(itemstack.getItem()).func_149645_b())) { float f1 = 0.625F; GL11.glTranslatef(0.0F, -0.34375F, 0.0F); diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch index 0dc6fd224..f4cf46127 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch @@ -1,18 +1,18 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java -@@ -18,6 +18,9 @@ - import net.minecraft.util.EnumChatFormatting; - import net.minecraft.util.MathHelper; +@@ -20,6 +20,9 @@ import net.minecraft.util.ResourceLocation; + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; +import net.minecraftforge.client.event.RenderLivingEvent; +import net.minecraftforge.common.MinecraftForge; + import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; -@@ -30,6 +33,9 @@ - /** The model to be used during the render passes. */ +@@ -33,6 +36,9 @@ protected ModelBase renderPassModel; + private static final String __OBFID = "CL_00001012"; + public static float NAME_TAG_RANGE = 64.0f; + public static float NAME_TAG_RANGE_SNEAK = 32.0f; @@ -20,29 +20,31 @@ public RendererLivingEntity(ModelBase par1ModelBase, float par2) { this.mainModel = par1ModelBase; -@@ -69,6 +75,7 @@ - - public void doRenderLiving(EntityLivingBase par1EntityLivingBase, double par2, double par4, double par6, float par8, float par9) +@@ -66,6 +72,7 @@ + // JAVADOC METHOD $$ func_76986_a + public void doRender(EntityLivingBase par1EntityLivingBase, double par2, double par4, double par6, float par8, float par9) { + if (MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Pre(par1EntityLivingBase, this))) return; GL11.glPushMatrix(); GL11.glDisable(GL11.GL_CULL_FACE); this.mainModel.onGround = this.renderSwingProgress(par1EntityLivingBase, par9); -@@ -278,6 +285,7 @@ +@@ -275,6 +282,7 @@ GL11.glEnable(GL11.GL_CULL_FACE); GL11.glPopMatrix(); this.passSpecialRender(par1EntityLivingBase, par2, par4, par6); + MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Post(par1EntityLivingBase, this)); } - /** -@@ -448,12 +456,13 @@ - */ + // JAVADOC METHOD $$ func_77036_a +@@ -428,6 +436,7 @@ + // JAVADOC METHOD $$ func_77033_b protected void passSpecialRender(EntityLivingBase par1EntityLivingBase, double par2, double par4, double par6) { + if (MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Specials.Pre(par1EntityLivingBase, this))) return; + GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); + if (this.func_110813_b(par1EntityLivingBase)) - { +@@ -435,7 +444,7 @@ float f = 1.6F; float f1 = 0.016666668F * f; double d3 = par1EntityLivingBase.getDistanceSqToEntity(this.renderManager.livingPlayer); @@ -51,7 +53,7 @@ if (d3 < (double)(f2 * f2)) { -@@ -497,6 +506,7 @@ +@@ -479,6 +488,7 @@ } } } diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch index 42a2d0444..128585ece 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch @@ -1,10 +1,10 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/texture/Stitcher.java +++ ../src-work/minecraft/net/minecraft/client/renderer/texture/Stitcher.java -@@ -187,7 +187,7 @@ +@@ -164,7 +164,7 @@ if (flag4 ^ flag5) { -- flag1 = flag4 && flag2; +- flag1 = !flag4; + flag1 = flag5 && flag3; //Forge: Bug fix: Attempt to fill all downward space before expanding width } else diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch index 8f4c9bd6f..0f80fa72e 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch @@ -1,33 +1,46 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java +++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java -@@ -11,9 +11,11 @@ +@@ -8,12 +8,14 @@ + import java.util.Iterator; import java.util.List; - import javax.imageio.ImageIO; - import net.minecraft.client.resources.Resource; -+import net.minecraft.client.resources.ResourceManager; + import java.util.concurrent.Callable; ++import net.minecraft.client.resources.IResourceManager; import net.minecraft.client.resources.data.AnimationFrame; import net.minecraft.client.resources.data.AnimationMetadataSection; - import net.minecraft.util.Icon; + import net.minecraft.crash.CrashReport; + import net.minecraft.crash.CrashReportCategory; + import net.minecraft.util.IIcon; + import net.minecraft.util.ReportedException; +import net.minecraft.util.ResourceLocation; @SideOnly(Side.CLIENT) - public class TextureAtlasSprite implements Icon -@@ -297,4 +299,18 @@ + public class TextureAtlasSprite implements IIcon +@@ -437,4 +439,28 @@ { 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 + '}'; } + + /** ++ * 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(IResourceManager manager, 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 -+ * @throws IOException + */ -+ public boolean load(ResourceManager manager, ResourceLocation location) throws IOException ++ public boolean load(IResourceManager manager, ResourceLocation location) + { -+ loadSprite(manager.getResource(location)); + return true; + } } diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch index ba3336d40..d47a77525 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch @@ -1,55 +1,56 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureMap.java +++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureMap.java -@@ -21,6 +21,7 @@ - import net.minecraft.util.Icon; +@@ -29,6 +29,7 @@ + import net.minecraft.util.MathHelper; import net.minecraft.util.ReportedException; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.ForgeHooksClient; + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; - @SideOnly(Side.CLIENT) - public class TextureMap extends AbstractTexture implements TickableTextureObject, IconRegister -@@ -58,10 +59,13 @@ +@@ -92,11 +93,14 @@ - public void loadTextureAtlas(ResourceManager par1ResourceManager) + public void loadTextureAtlas(IResourceManager par1ResourceManager) { + registerIcons(); //Re-gather list of Icons, allows for addition/removal of blocks/items after this map was initially constructed. + int i = Minecraft.getGLMaximumTextureSize(); - Stitcher stitcher = new Stitcher(i, i, true); + Stitcher stitcher = new Stitcher(i, i, true, 0, this.field_147636_j); this.mapUploadedSprites.clear(); this.listAnimatedSprites.clear(); + int j = Integer.MAX_VALUE; + ForgeHooksClient.onTextureStitchedPre(this); Iterator iterator = this.mapRegisteredSprites.entrySet().iterator(); + TextureAtlasSprite textureatlassprite; - while (iterator.hasNext()) -@@ -73,7 +77,7 @@ +@@ -107,6 +111,16 @@ + textureatlassprite = (TextureAtlasSprite)entry.getValue(); + ResourceLocation resourcelocation1 = this.func_147634_a(resourcelocation, 0); ++ if (textureatlassprite.hasCustomLoader(par1ResourceManager, resourcelocation)) ++ { ++ if (!textureatlassprite.load(par1ResourceManager, resourcelocation)) ++ { ++ j = Math.min(j, Math.min(textureatlassprite.getIconWidth(), textureatlassprite.getIconHeight())); ++ stitcher.addSprite(textureatlassprite); ++ } ++ continue; ++ } ++ try { -- textureatlassprite.loadSprite(par1ResourceManager.getResource(resourcelocation1)); -+ if (!textureatlassprite.load(par1ResourceManager, resourcelocation1)) continue; - } - catch (RuntimeException runtimeexception) - { -@@ -142,6 +146,7 @@ - textureatlassprite1 = (TextureAtlasSprite)iterator1.next(); - textureatlassprite1.copyFrom(this.missingImage); + IResource iresource = par1ResourceManager.getResource(resourcelocation1); +@@ -275,6 +289,7 @@ + textureatlassprite = (TextureAtlasSprite)iterator2.next(); + textureatlassprite.copyFrom(this.missingImage); } + ForgeHooksClient.onTextureStitchedPost(this); } - private void registerIcons() -@@ -212,6 +217,7 @@ - if (par1Str == null) - { - (new RuntimeException("Don\'t register null!")).printStackTrace(); -+ par1Str = "null"; //Don't allow things to actually register null.. - } - - Object object = (TextureAtlasSprite)this.mapRegisteredSprites.get(par1Str); -@@ -253,4 +259,37 @@ + private ResourceLocation func_147634_a(ResourceLocation p_147634_1_, int p_147634_2_) +@@ -404,4 +419,37 @@ { - this.updateAnimations(); + this.field_147637_k = p_147632_1_; } + + //=================================================================================================== diff --git a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityChestRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityChestRenderer.java.patch index 375062ad5..4f04836f0 100644 --- a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityChestRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityChestRenderer.java.patch @@ -7,20 +7,18 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import java.util.Calendar; -@@ -60,7 +61,15 @@ +@@ -52,7 +53,14 @@ if (block instanceof BlockChest && i == 0) { -- ((BlockChest)block).unifyAdjacentChests(par1TileEntityChest.getWorldObj(), par1TileEntityChest.xCoord, par1TileEntityChest.yCoord, par1TileEntityChest.zCoord); + try + { -+ ((BlockChest)block).unifyAdjacentChests(par1TileEntityChest.getWorldObj(), par1TileEntityChest.xCoord, par1TileEntityChest.yCoord, par1TileEntityChest.zCoord); + ((BlockChest)block).func_149954_e(p_147502_1_.func_145831_w(), p_147502_1_.field_145851_c, p_147502_1_.field_145848_d, p_147502_1_.field_145849_e); + } + catch (ClassCastException e) + { -+ FMLLog.severe("Attempted to render a chest at %d, %d, %d that was not a chest", -+ par1TileEntityChest.xCoord, par1TileEntityChest.yCoord, par1TileEntityChest.zCoord); ++ FMLLog.severe("Attempted to render a chest at %d, %d, %d that was not a chest", p_147502_1_.field_145851_c, p_147502_1_.field_145848_d, p_147502_1_.field_145849_e); + } - i = par1TileEntityChest.getBlockMetadata(); + i = p_147502_1_.func_145832_p(); } diff --git a/patches/minecraft/net/minecraft/command/CommandHandler.java.patch b/patches/minecraft/net/minecraft/command/CommandHandler.java.patch index 882b4851c..dd598fd1b 100644 --- a/patches/minecraft/net/minecraft/command/CommandHandler.java.patch +++ b/patches/minecraft/net/minecraft/command/CommandHandler.java.patch @@ -1,16 +1,16 @@ --- ../src-base/minecraft/net/minecraft/command/CommandHandler.java +++ ../src-work/minecraft/net/minecraft/command/CommandHandler.java -@@ -12,6 +12,9 @@ - import net.minecraft.util.ChatMessageComponent; - import net.minecraft.util.EnumChatFormatting; +@@ -14,6 +14,9 @@ + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.CommandEvent; + public class CommandHandler implements ICommandManager { - /** Map of Strings to the ICommand objects they represent */ -@@ -45,6 +48,16 @@ + private static final Logger field_147175_a = LogManager.getLogger(); +@@ -49,6 +52,16 @@ if (icommand.canCommandSenderUseCommand(par1ICommandSender)) { diff --git a/patches/minecraft/net/minecraft/crash/CallableSuspiciousClasses.java.patch b/patches/minecraft/net/minecraft/crash/CallableSuspiciousClasses.java.patch deleted file mode 100644 index db365e231..000000000 --- a/patches/minecraft/net/minecraft/crash/CallableSuspiciousClasses.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/crash/CallableSuspiciousClasses.java -+++ ../src-work/minecraft/net/minecraft/crash/CallableSuspiciousClasses.java -@@ -130,6 +130,6 @@ - - public Object call() - { -- return "FML is installed"; -+ return "FML and Forge are installed"; - } - } diff --git a/patches/minecraft/net/minecraft/crash/CrashReport.java.patch b/patches/minecraft/net/minecraft/crash/CrashReport.java.patch index c6ccc419b..de371a5f7 100644 --- a/patches/minecraft/net/minecraft/crash/CrashReport.java.patch +++ b/patches/minecraft/net/minecraft/crash/CrashReport.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/crash/CrashReport.java +++ ../src-work/minecraft/net/minecraft/crash/CrashReport.java -@@ -245,7 +245,8 @@ +@@ -328,7 +328,8 @@ StackTraceElement stacktraceelement = null; StackTraceElement stacktraceelement1 = null; diff --git a/patches/minecraft/net/minecraft/crash/CrashReportCategory.java.patch b/patches/minecraft/net/minecraft/crash/CrashReportCategory.java.patch index 7799d347b..225f18ed3 100644 --- a/patches/minecraft/net/minecraft/crash/CrashReportCategory.java.patch +++ b/patches/minecraft/net/minecraft/crash/CrashReportCategory.java.patch @@ -1,16 +1,16 @@ --- ../src-base/minecraft/net/minecraft/crash/CrashReportCategory.java +++ ../src-work/minecraft/net/minecraft/crash/CrashReportCategory.java -@@ -130,8 +130,11 @@ - public int func_85073_a(int par1) - { - StackTraceElement[] astacktraceelement = Thread.currentThread().getStackTrace(); -- this.stackTrace = new StackTraceElement[astacktraceelement.length - 3 - par1]; -- System.arraycopy(astacktraceelement, 3 + par1, this.stackTrace, 0, this.stackTrace.length); -+ //BugFix: Causes AIOOB for stacks < 3 + par1 -+ int len = astacktraceelement.length - 3 - par1; -+ 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; +@@ -131,8 +131,11 @@ + } + else + { +- this.stackTrace = new StackTraceElement[astacktraceelement.length - 3 - par1]; +- System.arraycopy(astacktraceelement, 3 + par1, this.stackTrace, 0, this.stackTrace.length); ++ int len = astacktraceelement.length - 3 - par1; ++ // 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 index 694be619f..17baea1b3 100644 --- a/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch +++ b/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch @@ -1,20 +1,12 @@ --- ../src-base/minecraft/net/minecraft/creativetab/CreativeTabs.java +++ ../src-work/minecraft/net/minecraft/creativetab/CreativeTabs.java -@@ -7,6 +7,7 @@ - import net.minecraft.enchantment.EnchantmentData; - import net.minecraft.enchantment.EnumEnchantmentType; - import net.minecraft.item.Item; -+import net.minecraft.item.ItemStack; +@@ -140,8 +140,22 @@ + private ItemStack field_151245_t; + private static final String __OBFID = "CL_00000005"; - public class CreativeTabs - { -@@ -34,8 +35,22 @@ - private boolean drawTitle = true; - private EnumEnchantmentType[] field_111230_s; - -+ public CreativeTabs(String label) ++ public CreativeTabs(String lable) + { -+ this(getNextID(), label); ++ this(getNextID(), lable); + } + public CreativeTabs(int par1, String par2Str) @@ -31,8 +23,8 @@ this.tabIndex = par1; this.tabLabel = par2Str; creativeTabArray[par1] = this; -@@ -122,6 +137,10 @@ - */ +@@ -226,6 +240,10 @@ + @SideOnly(Side.CLIENT) public int getTabColumn() { + if (tabIndex > 11) @@ -42,8 +34,8 @@ return this.tabIndex % 6; } -@@ -132,6 +151,10 @@ - */ +@@ -233,6 +251,10 @@ + @SideOnly(Side.CLIENT) public boolean isTabInFirstRow() { + if (tabIndex > 11) @@ -53,14 +45,14 @@ return this.tabIndex < 6; } -@@ -187,10 +210,18 @@ +@@ -284,10 +306,18 @@ { - Item item = aitem[j]; + Item item = (Item)iterator.next(); - if (item != null && item.getCreativeTab() == this) + if (item == null) { -- item.getSubItems(item.itemID, this, par1List); +- item.func_150895_a(item, this, par1List); + continue; } + @@ -68,13 +60,13 @@ + { + if (tab == this) + { -+ item.getSubItems(item.itemID, this, par1List); ++ item.func_150895_a(item, this, par1List); + } + } } if (this.func_111225_m() != null) -@@ -232,4 +263,36 @@ +@@ -326,4 +356,28 @@ } } } @@ -94,14 +86,6 @@ + } + + /** -+ * Get the ItemStack that will be rendered to the tab. -+ */ -+ public ItemStack getIconItemStack() -+ { -+ return new ItemStack(getTabIconItem()); -+ } -+ -+ /** + * Determines if the search bar should be shown for this tab. + * + * @return True to show the bar diff --git a/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch b/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch index 03d457717..6aa0250ec 100644 --- a/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch +++ b/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch @@ -1,18 +1,8 @@ --- ../src-base/minecraft/net/minecraft/enchantment/Enchantment.java +++ ../src-work/minecraft/net/minecraft/enchantment/Enchantment.java -@@ -1,6 +1,9 @@ - package net.minecraft.enchantment; +@@ -157,6 +157,36 @@ - import java.util.ArrayList; -+ -+import com.google.common.collect.ObjectArrays; -+ - import net.minecraft.entity.EntityLivingBase; - import net.minecraft.item.ItemStack; - import net.minecraft.util.DamageSource; -@@ -207,6 +210,36 @@ - return this.type.canEnchantItem(par1ItemStack.getItem()); - } + public void func_151367_b(EntityLivingBase p_151367_1_, Entity p_151367_2_, int p_151367_3_) {} + /** + * This applies specifically to applying at the enchanting table. The other method {@link #canApply(ItemStack)} @@ -32,7 +22,7 @@ + */ + public static void addToBookList(Enchantment enchantment) + { -+ ObjectArrays.concat(enchantmentsBookList, enchantment); ++ com.google.common.collect.ObjectArrays.concat(enchantmentsBookList, enchantment); + } + + /** @@ -46,4 +36,4 @@ + static { - ArrayList arraylist = new ArrayList(); + ArrayList var0 = new ArrayList(); diff --git a/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch b/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch index 1f5fff16e..16ffb4f6e 100644 --- a/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch +++ b/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch @@ -1,14 +1,12 @@ --- ../src-base/minecraft/net/minecraft/enchantment/EnchantmentHelper.java +++ ../src-work/minecraft/net/minecraft/enchantment/EnchantmentHelper.java -@@ -463,7 +463,10 @@ +@@ -461,7 +461,8 @@ { Enchantment enchantment = aenchantment[k]; - if (enchantment != null && (enchantment.type.canEnchantItem(item) || flag)) + if (enchantment == null) continue; -+ -+ flag = (par1ItemStack.itemID == Item.book.itemID) && enchantment.isAllowedOnBooks(); -+ if (enchantment.canApplyAtEnchantingTable(par1ItemStack) || flag) ++ if (enchantment.canApplyAtEnchantingTable(par1ItemStack) || ((item == Items.book) && enchantment.isAllowedOnBooks())) { for (int l = enchantment.getMinLevel(); l <= enchantment.getMaxLevel(); ++l) { diff --git a/patches/minecraft/net/minecraft/entity/Entity.java.patch b/patches/minecraft/net/minecraft/entity/Entity.java.patch index 43a6e6e9d..28c8b89ad 100644 --- a/patches/minecraft/net/minecraft/entity/Entity.java.patch +++ b/patches/minecraft/net/minecraft/entity/Entity.java.patch @@ -1,22 +1,17 @@ --- ../src-base/minecraft/net/minecraft/entity/Entity.java +++ ../src-work/minecraft/net/minecraft/entity/Entity.java -@@ -1,10 +1,15 @@ +@@ -1,7 +1,10 @@ package net.minecraft.entity; +import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -+ +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Random; import java.util.UUID; -+ - import net.minecraft.block.Block; - import net.minecraft.block.BlockFluid; - import net.minecraft.block.StepSound; -@@ -13,8 +18,13 @@ +@@ -13,9 +16,14 @@ import net.minecraft.crash.CrashReportCategory; import net.minecraft.enchantment.EnchantmentProtection; import net.minecraft.entity.effect.EntityLightningBolt; @@ -26,13 +21,14 @@ +import net.minecraft.entity.item.EntityMinecart; +import net.minecraft.entity.item.EntityPainting; import net.minecraft.entity.player.EntityPlayer; -+import net.minecraft.item.Item; + import net.minecraft.init.Blocks; ++import net.minecraft.init.Items; + import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; - import net.minecraft.nbt.NBTTagDouble; -@@ -26,12 +36,18 @@ - import net.minecraft.util.DamageSource; +@@ -30,12 +38,17 @@ import net.minecraft.util.Direction; + import net.minecraft.util.IChatComponent; import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.ReportedException; @@ -44,15 +40,14 @@ +import net.minecraftforge.common.IExtendedEntityProperties; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.entity.EntityEvent; -+import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.IFluidBlock; public abstract class Entity { -@@ -218,7 +234,14 @@ - private boolean invulnerable; - private UUID entityUniqueID; - public EnumEntitySize myEntitySize; +@@ -152,7 +165,14 @@ + protected UUID entityUniqueID; + public Entity.EnumEntitySize myEntitySize; + private static final String __OBFID = "CL_00001533"; + /** Forge: Used to store custom data for each entity. */ + private NBTTagCompound customEntityData; + public boolean captureDrops = false; @@ -61,10 +56,10 @@ + private HashMap extendedProperties; + - public Entity(World par1World) + public int func_145782_y() { - this.entityId = nextEntityID++; -@@ -245,6 +268,15 @@ + return this.field_145783_c; +@@ -189,6 +209,15 @@ this.dataWatcher.addObject(0, Byte.valueOf((byte)0)); this.dataWatcher.addObject(1, Short.valueOf((short)300)); this.entityInit(); @@ -80,18 +75,19 @@ } protected abstract void entityInit(); -@@ -1164,11 +1196,20 @@ - int k = MathHelper.floor_double(this.posZ); - int l = this.worldObj.getBlockId(i, j, k); +@@ -1051,9 +1080,22 @@ -- if (l != 0 && Block.blocksList[l].blockMaterial == par1Material) -+ Block block = Block.blocksList[l]; -+ if (block != null && block.blockMaterial == par1Material) + if (block.func_149688_o() == par1Material) { -- float f = BlockFluid.getFluidHeightPercent(this.worldObj.getBlockMetadata(i, j, k)) - 0.11111111F; +- float f = BlockLiquid.func_149801_b(this.worldObj.getBlockMetadata(i, j, k)) - 0.11111111F; - float f1 = (float)(j + 1) - f; - return d0 < (double)f1; -+ double filled = block.getFilledPercentage(worldObj, i, j, k); ++ double filled = 1.0f; //If it's not a liquid assume it's a solid block ++ if (block instanceof IFluidBlock) ++ { ++ filled = ((IFluidBlock)block).getFilledPercentage(worldObj, i, j, k); ++ } ++ + if (filled < 0) + { + filled *= -1; @@ -105,29 +101,36 @@ } else { -@@ -1529,6 +1570,21 @@ +@@ -1360,8 +1402,27 @@ par1NBTTagCompound.setInteger("PortalCooldown", this.timeUntilPortal); - par1NBTTagCompound.setLong("UUIDMost", this.entityUniqueID.getMostSignificantBits()); - par1NBTTagCompound.setLong("UUIDLeast", this.entityUniqueID.getLeastSignificantBits()); + par1NBTTagCompound.setLong("UUIDMost", this.getUniqueID().getMostSignificantBits()); + par1NBTTagCompound.setLong("UUIDLeast", this.getUniqueID().getLeastSignificantBits()); +- this.writeEntityToNBT(par1NBTTagCompound); + if (customEntityData != null) + { -+ par1NBTTagCompound.setCompoundTag("ForgeData", customEntityData); ++ par1NBTTagCompound.setTag("ForgeData", customEntityData); + } -+ -+ for (String identifier : this.extendedProperties.keySet()){ -+ try{ + ++ for (String identifier : this.extendedProperties.keySet()) ++ { ++ try ++ { + IExtendedEntityProperties props = this.extendedProperties.get(identifier); + props.saveNBTData(par1NBTTagCompound); -+ }catch (Throwable t){ ++ } ++ catch (Throwable t) ++ { + FMLLog.severe("Failed to save extended properties for %s. This is a mod issue.", identifier); + t.printStackTrace(); + } + } + - this.writeEntityToNBT(par1NBTTagCompound); - ++ this.writeEntityToNBT(par1NBTTagCompound); ++ if (this.ridingEntity != null) -@@ -1599,6 +1655,26 @@ + { + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); +@@ -1428,6 +1489,30 @@ this.setPosition(this.posX, this.posY, this.posZ); this.setRotation(this.rotationYaw, this.rotationPitch); @@ -136,11 +139,15 @@ + customEntityData = par1NBTTagCompound.getCompoundTag("ForgeData"); + } + -+ for (String identifier : this.extendedProperties.keySet()){ -+ try{ ++ for (String identifier : this.extendedProperties.keySet()) ++ { ++ try ++ { + IExtendedEntityProperties props = this.extendedProperties.get(identifier); + props.loadNBTData(par1NBTTagCompound); -+ }catch (Throwable t){ ++ } ++ catch (Throwable t) ++ { + FMLLog.severe("Failed to load extended properties for %s. This is a mod issue.", identifier); + t.printStackTrace(); + } @@ -154,10 +161,10 @@ this.readEntityFromNBT(par1NBTTagCompound); if (this.shouldSetPosAfterLoading()) -@@ -1711,7 +1787,14 @@ +@@ -1512,7 +1597,14 @@ { EntityItem entityitem = new EntityItem(this.worldObj, this.posX, this.posY + (double)par2, this.posZ, par1ItemStack); - entityitem.delayBeforeCanPickup = 10; + entityitem.field_145804_b = 10; - this.worldObj.spawnEntityInWorld(entityitem); + if (captureDrops) + { @@ -169,30 +176,29 @@ + } return entityitem; } - } -@@ -2010,7 +2093,7 @@ - */ + else +@@ -1782,7 +1874,7 @@ + // JAVADOC METHOD $$ func_70115_ae public boolean isRiding() { - return this.ridingEntity != null; + return this.ridingEntity != null && ridingEntity.shouldRiderSit(); } - /** -@@ -2385,7 +2468,7 @@ - */ - public float getBlockExplosionResistance(Explosion par1Explosion, World par2World, int par3, int par4, int par5, Block par6Block) + // JAVADOC METHOD $$ func_70093_af +@@ -2103,7 +2195,7 @@ + + public float func_145772_a(Explosion p_145772_1_, World p_145772_2_, int p_145772_3_, int p_145772_4_, int p_145772_5_, Block p_145772_6_) { -- return par6Block.getExplosionResistance(this); -+ return par6Block.getExplosionResistance(this, par2World, par3, par4, par5, posX, posY + (double)getEyeHeight(), posZ); +- return p_145772_6_.func_149638_a(this); ++ return p_145772_6_.getExplosionResistance(this, p_145772_2_, p_145772_3_, p_145772_3_, p_145772_4_, posX, posY + getEyeHeight(), posZ); } - public boolean shouldExplodeBlock(Explosion par1Explosion, World par2World, int par3, int par4, int par5, int par6, float par7) -@@ -2451,4 +2534,170 @@ - { - return this.getEntityName(); - } -+ + public boolean func_145774_a(Explosion p_145774_1_, World p_145774_2_, int p_145774_3_, int p_145774_4_, int p_145774_5_, Block p_145774_6_, float p_145774_7_) +@@ -2175,6 +2267,174 @@ + + public void func_145781_i(int p_145781_1_) {} + + /* ================================== Forge Start =====================================*/ + /** + * Returns a NBTTagCompound that can be used to store custom data for this entity. @@ -227,7 +233,23 @@ + { + if (this instanceof EntityPainting) + { -+ return new ItemStack(Item.painting); ++ return new ItemStack(Items.painting); ++ } ++ else if (this instanceof EntityLeashKnot) ++ { ++ return new ItemStack(Items.lead); ++ } ++ else if (this instanceof EntityItemFrame) ++ { ++ ItemStack held = ((EntityItemFrame)this).getDisplayedItem(); ++ if (held == null) ++ { ++ return new ItemStack(Items.item_frame); ++ } ++ else ++ { ++ return held.copy(); ++ } + } + else if (this instanceof EntityMinecart) + { @@ -235,30 +257,14 @@ + } + else if (this instanceof EntityBoat) + { -+ return new ItemStack(Item.boat); -+ } -+ else if (this instanceof EntityItemFrame) -+ { -+ ItemStack held = ((EntityItemFrame)this).getDisplayedItem(); -+ if (held == null) -+ { -+ return new ItemStack(Item.itemFrame); -+ } -+ else -+ { -+ return held.copy(); -+ } -+ } -+ else if (this instanceof EntityLeashKnot) -+ { -+ return new ItemStack(Item.leash); ++ return new ItemStack(Items.boat); + } + else + { + int id = EntityList.getEntityID(this); + if (id > 0 && EntityList.entityEggs.containsKey(id)) + { -+ return new ItemStack(Item.monsterPlacer, 1, id); ++ return new ItemStack(Items.spawn_egg, 1, id); + } + } + return null; @@ -274,7 +280,7 @@ + */ + public final void resetEntityId() + { -+ this.entityId = nextEntityID++; ++ this.field_145783_c = nextEntityID++; + } + + public boolean shouldRenderInPass(int pass) @@ -355,7 +361,12 @@ + * @param rider The entity that is riding + * @return if the entity should be dismounted when under water + */ -+ public boolean shouldDismountInWater(Entity rider){ ++ public boolean shouldDismountInWater(Entity rider) ++ { + return this instanceof EntityLivingBase; + } - } ++ /* ================================== Forge End =====================================*/ ++ + public static enum EnumEntitySize + { + SIZE_1, diff --git a/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch b/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch index 69b1a087b..5505b3441 100644 --- a/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch @@ -1,27 +1,25 @@ --- ../src-base/minecraft/net/minecraft/entity/EntityLiving.java +++ ../src-work/minecraft/net/minecraft/entity/EntityLiving.java -@@ -31,6 +31,11 @@ - import net.minecraft.util.MathHelper; +@@ -34,6 +34,9 @@ + import net.minecraft.world.EnumDifficulty; import net.minecraft.world.World; import net.minecraft.world.WorldServer; +import net.minecraftforge.common.ForgeHooks; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.Event.Result; ++import cpw.mods.fml.common.eventhandler.Event.Result; +import net.minecraftforge.event.ForgeEventFactory; -+import net.minecraftforge.event.entity.living.LivingSpawnEvent.AllowDespawn; public abstract class EntityLiving extends EntityLivingBase { -@@ -141,6 +146,7 @@ +@@ -130,6 +133,7 @@ public void setAttackTarget(EntityLivingBase par1EntityLivingBase) { this.attackTarget = par1EntityLivingBase; + ForgeHooks.onLivingSetAttackTarget(this, par1EntityLivingBase); } - /** -@@ -547,10 +553,22 @@ - */ + // JAVADOC METHOD $$ func_70686_a +@@ -506,10 +510,22 @@ + // JAVADOC METHOD $$ func_70623_bb protected void despawnEntity() { + Result result = null; @@ -43,12 +41,11 @@ else { EntityPlayer entityplayer = this.worldObj.getClosestPlayerToEntity(this, -1.0D); -@@ -726,8 +744,6 @@ - return this.worldObj.checkNoEntityCollision(this.boundingBox) && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(this.boundingBox); +@@ -677,7 +693,6 @@ } + // JAVADOC METHOD $$ func_70603_bj - @SideOnly(Side.CLIENT) -- - /** - * Returns render size modifier - */ + 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 index b4c5accdc..1a37d5175 100644 --- a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch @@ -1,18 +1,14 @@ --- ../src-base/minecraft/net/minecraft/entity/EntityLivingBase.java +++ ../src-work/minecraft/net/minecraft/entity/EntityLivingBase.java -@@ -20,9 +20,11 @@ +@@ -19,6 +19,7 @@ import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityXPOrb; import net.minecraft.entity.monster.EntityZombie; +import net.minecraft.entity.passive.EntityPig; import net.minecraft.entity.passive.EntityWolf; import net.minecraft.entity.player.EntityPlayer; - import net.minecraft.entity.projectile.EntityArrow; -+import net.minecraft.item.Item; - import net.minecraft.item.ItemArmor; - import net.minecraft.item.ItemStack; - import net.minecraft.nbt.NBTBase; -@@ -46,6 +48,7 @@ + import net.minecraft.entity.player.EntityPlayerMP; +@@ -48,6 +49,7 @@ import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraft.world.WorldServer; @@ -20,16 +16,16 @@ public abstract class EntityLivingBase extends Entity { -@@ -305,7 +308,7 @@ - - this.extinguish(); +@@ -254,7 +256,7 @@ + } + } - if (!this.worldObj.isRemote && this.isRiding() && this.ridingEntity instanceof EntityLivingBase) -+ if (!this.worldObj.isRemote && this.isRiding() && ridingEntity!=null && ridingEntity.shouldDismountInWater(this)) ++ if (!this.worldObj.isRemote && this.isRiding() && this.ridingEntity != null && ridingEntity.shouldDismountInWater(this)) { this.mountEntity((Entity)null); } -@@ -452,6 +455,7 @@ +@@ -408,6 +410,7 @@ { this.entityLivingToAttack = par1EntityLivingBase; this.revengeTimer = this.ticksExisted; @@ -37,32 +33,31 @@ } public EntityLivingBase getLastAttacker() -@@ -750,8 +754,6 @@ - return this.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD; +@@ -701,7 +704,6 @@ } + // JAVADOC METHOD $$ func_70618_n - @SideOnly(Side.CLIENT) -- - /** - * Remove the speified potion effect from this entity. - */ -@@ -832,6 +834,7 @@ - */ + public void removePotionEffectClient(int par1) + { + this.activePotionsMap.remove(Integer.valueOf(par1)); +@@ -773,6 +775,7 @@ + // JAVADOC METHOD $$ func_70097_a public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) { + if (ForgeHooks.onLivingAttack(this, par1DamageSource, par2)) return false; if (this.isEntityInvulnerable()) { return false; -@@ -982,6 +985,7 @@ - */ +@@ -928,6 +931,7 @@ + // JAVADOC METHOD $$ func_70645_a public void onDeath(DamageSource par1DamageSource) { + if (ForgeHooks.onLivingDeath(this, par1DamageSource)) return; Entity entity = par1DamageSource.getEntity(); EntityLivingBase entitylivingbase = this.func_94060_bK(); -@@ -1006,6 +1010,10 @@ +@@ -952,6 +956,10 @@ i = EnchantmentHelper.getLootingModifier((EntityLivingBase)entity); } @@ -70,10 +65,10 @@ + capturedDrops.clear(); + int j = 0; + - if (!this.isChild() && this.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot")) + if (this.func_146066_aG() && this.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot")) { this.dropFewItems(this.recentlyHit > 0, i); -@@ -1013,7 +1021,7 @@ +@@ -959,7 +967,7 @@ if (this.recentlyHit > 0) { @@ -82,7 +77,7 @@ if (j < 5) { -@@ -1021,6 +1029,16 @@ +@@ -967,6 +975,16 @@ } } } @@ -99,17 +94,17 @@ } this.worldObj.setEntityState(this, (byte)3); -@@ -1088,7 +1106,7 @@ +@@ -1021,7 +1039,7 @@ int j = MathHelper.floor_double(this.boundingBox.minY); int k = MathHelper.floor_double(this.posZ); - int l = this.worldObj.getBlockId(i, j, k); -- return l == Block.ladder.blockID || l == Block.vine.blockID; -+ return ForgeHooks.isLivingOnLadder(Block.blocksList[l], worldObj, i, j, k, this); + Block block = this.worldObj.func_147439_a(i, j, k); +- return block == Blocks.ladder || block == Blocks.vine; ++ return ForgeHooks.isLivingOnLadder(block, worldObj, i, j, k, this); } - /** -@@ -1104,6 +1122,8 @@ - */ + // JAVADOC METHOD $$ func_70089_S +@@ -1033,6 +1051,8 @@ + // JAVADOC METHOD $$ func_70069_a protected void fall(float par1) { + par1 = ForgeHooks.onLivingFall(this, par1); @@ -117,7 +112,16 @@ super.fall(par1); PotionEffect potioneffect = this.getActivePotionEffect(Potion.jump); float f1 = potioneffect != null ? (float)(potioneffect.getAmplifier() + 1) : 0.0F; -@@ -1237,6 +1257,8 @@ +@@ -1116,7 +1136,7 @@ + { + if (this instanceof EntityZombie) + { +- par2 = par2; ++ //par2 = par2; // Forge: Noop Warning + } + + int i; +@@ -1161,6 +1181,8 @@ { if (!this.isEntityInvulnerable()) { @@ -126,8 +130,8 @@ par2 = this.applyArmorCalculations(par1DamageSource, par2); par2 = this.applyPotionDamageCalculations(par1DamageSource, par2); float f1 = par2; -@@ -1298,6 +1320,17 @@ - */ +@@ -1213,6 +1235,17 @@ + // JAVADOC METHOD $$ func_71038_i public void swingItem() { + ItemStack stack = this.getHeldItem(); @@ -144,27 +148,23 @@ if (!this.isSwingInProgress || this.swingProgressInt >= this.getArmSwingAnimationEnd() / 2 || this.swingProgressInt < 0) { this.swingProgressInt = -1; -@@ -1535,6 +1568,7 @@ +@@ -1422,6 +1455,7 @@ } this.isAirBorne = true; + ForgeHooks.onLivingJump(this); } - /** -@@ -1739,6 +1773,11 @@ - */ + // JAVADOC METHOD $$ func_70612_e +@@ -1602,6 +1636,7 @@ + // JAVADOC METHOD $$ func_70071_h_ public void onUpdate() { -+ if (ForgeHooks.onLivingUpdate(this)) -+ { -+ return; -+ } -+ ++ if (ForgeHooks.onLivingUpdate(this)) return; super.onUpdate(); if (!this.worldObj.isRemote) -@@ -2277,4 +2316,42 @@ +@@ -2099,4 +2134,42 @@ { return this.getTeam() != null ? this.getTeam().isSameTeam(par1Team) : false; } diff --git a/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch b/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch index f1337800f..5530c4c3f 100644 --- a/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch +++ b/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch @@ -8,16 +8,16 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; -@@ -29,6 +30,8 @@ - Class classTarget; - private int field_75445_i; +@@ -25,6 +26,8 @@ + private double field_151496_k; + private static final String __OBFID = "CL_00001595"; + private int failedPathFindingPenalty; + public EntityAIAttackOnCollide(EntityCreature par1EntityCreature, Class par2Class, double par3, boolean par5) { this(par1EntityCreature, par3, par5); -@@ -65,8 +68,16 @@ +@@ -59,8 +62,16 @@ } else { @@ -26,7 +26,7 @@ + if (-- this.field_75445_i <= 0) + { + this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase); -+ this.field_75445_i = 4 + this.attacker.getRNG().nextInt(7); ++ this.field_75445_i = 4 + this.attacker.getRNG().nextInt(7); + return this.entityPathEntity != null; + } + else @@ -36,13 +36,13 @@ } } -@@ -106,8 +117,24 @@ - - if ((this.longMemory || this.attacker.getEntitySenses().canSee(entitylivingbase)) && --this.field_75445_i <= 0) - { +@@ -98,8 +109,25 @@ + this.field_151497_i = entitylivingbase.posX; + this.field_151495_j = entitylivingbase.boundingBox.minY; + this.field_151496_k = entitylivingbase.posZ; - this.field_75445_i = 4 + this.attacker.getRNG().nextInt(7); + this.field_75445_i = failedPathFindingPenalty + 4 + this.attacker.getRNG().nextInt(7); - this.attacker.getNavigator().tryMoveToEntityLiving(entitylivingbase, this.speedTowardsTarget); + + if (this.attacker.getNavigator().getPath() != null) + { + PathPoint finalPathPoint = this.attacker.getNavigator().getPath().getFinalPathPoint(); @@ -59,6 +59,7 @@ + { + failedPathFindingPenalty += 10; + } - } - - this.attackTick = Math.max(this.attackTick - 1, 0); ++ + 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 index b8484ab2d..fb74207e4 100644 --- a/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch +++ b/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch @@ -1,16 +1,14 @@ --- ../src-base/minecraft/net/minecraft/entity/boss/EntityDragon.java +++ ../src-work/minecraft/net/minecraft/entity/boss/EntityDragon.java -@@ -527,10 +527,11 @@ - for (int i2 = k; i2 <= j1; ++i2) +@@ -495,9 +495,9 @@ { - int j2 = this.worldObj.getBlockId(k1, l1, i2); -+ Block block = Block.blocksList[j2]; + Block block = this.worldObj.func_147439_a(k1, l1, i2); -- if (j2 != 0) -+ if (block != null) +- if (block.func_149688_o() != Material.field_151579_a) ++ if (!block.isAir(worldObj, k1, l1, i2)) { -- if (j2 != Block.obsidian.blockID && j2 != Block.whiteStone.blockID && j2 != Block.bedrock.blockID && this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")) +- if (block != Blocks.obsidian && block != Blocks.end_stone && block != Blocks.bedrock && this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")) + if (block.canEntityDestroy(worldObj, k1, l1, i2, this) && this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")) { - flag1 = this.worldObj.setBlockToAir(k1, l1, i2) || flag1; + flag1 = this.worldObj.func_147468_f(k1, l1, i2) || flag1; } diff --git a/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch b/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch index 88f0f4620..f5d9e0743 100644 --- a/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch +++ b/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch @@ -1,12 +1,11 @@ --- ../src-base/minecraft/net/minecraft/entity/boss/EntityWither.java +++ ../src-work/minecraft/net/minecraft/entity/boss/EntityWither.java -@@ -355,7 +355,8 @@ - int l2 = j1 + l1; - int i3 = this.worldObj.getBlockId(j2, k2, l2); +@@ -355,7 +355,7 @@ + int l = j1 + i2; + Block block = this.worldObj.func_147439_a(j2, k, l); -- if (i3 > 0 && i3 != Block.bedrock.blockID && i3 != Block.endPortal.blockID && i3 != Block.endPortalFrame.blockID) -+ Block block = Block.blocksList[i3]; -+ if (block != null && block.canEntityDestroy(worldObj, j2, k2, l2, this)) +- if (block.func_149688_o() != Material.field_151579_a && block != Blocks.bedrock && block != Blocks.end_portal && block != Blocks.end_portal_frame && block != Blocks.command_block) ++ if (!block.isAir(worldObj, j2, k, l) && block.canEntityDestroy(worldObj, j2, k, l, this)) { - flag = this.worldObj.destroyBlock(j2, k2, l2, true) || flag; + flag = this.worldObj.func_147480_a(j2, k, l, true) || flag; } diff --git a/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch b/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch index 033e61042..74dc615bf 100644 --- a/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch +++ b/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch @@ -1,23 +1,12 @@ --- ../src-base/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java +++ ../src-work/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java -@@ -10,6 +10,8 @@ - import net.minecraft.util.MathHelper; - import net.minecraft.util.Vec3; - import net.minecraft.world.World; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.entity.EntityStruckByLightningEvent; - - public class EntityLightningBolt extends EntityWeatherEffect - { -@@ -116,7 +118,10 @@ +@@ -106,7 +106,8 @@ for (int l = 0; l < list.size(); ++l) { Entity entity = (Entity)list.get(l); - entity.onStruckByLightning(this); -+ if (!MinecraftForge.EVENT_BUS.post(new EntityStruckByLightningEvent(entity, 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 index 5dc75e9f0..dfeacc2ec 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch @@ -9,28 +9,21 @@ public class EntityEnderPearl extends EntityThrowable { -@@ -51,14 +53,18 @@ +@@ -51,6 +53,9 @@ - if (!entityplayermp.playerNetServerHandler.connectionClosed && entityplayermp.worldObj == this.worldObj) + if (entityplayermp.playerNetServerHandler.func_147362_b().func_150724_d() && entityplayermp.worldObj == this.worldObj) { -- if (this.getThrower().isRiding()) + EnderTeleportEvent event = new EnderTeleportEvent(entityplayermp, this.posX, this.posY, this.posZ, 5.0F); + if (!MinecraftForge.EVENT_BUS.post(event)) ++ { // Don't indent to lower patch size + if (this.getThrower().isRiding()) { -- this.getThrower().mountEntity((Entity)null); -+ if (this.getThrower().isRiding()) -+ { -+ this.getThrower().mountEntity((Entity)null); -+ } -+ -+ this.getThrower().setPositionAndUpdate(event.targetX, event.targetY, event.targetZ); -+ this.getThrower().fallDistance = 0.0F; -+ this.getThrower().attackEntityFrom(DamageSource.fall, event.attackDamage); - } -- -- this.getThrower().setPositionAndUpdate(this.posX, this.posY, this.posZ); -- this.getThrower().fallDistance = 0.0F; -- this.getThrower().attackEntityFrom(DamageSource.fall, 5.0F); + this.getThrower().mountEntity((Entity)null); +@@ -59,6 +64,7 @@ + this.getThrower().setPositionAndUpdate(this.posX, this.posY, this.posZ); + this.getThrower().fallDistance = 0.0F; + this.getThrower().attackEntityFrom(DamageSource.fall, 5.0F); ++ } } } diff --git a/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch index 82c46068d..6308f906e 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch @@ -1,20 +1,23 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityItem.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityItem.java -@@ -2,6 +2,11 @@ - - import java.util.Iterator; - +@@ -14,10 +14,13 @@ + import net.minecraft.util.MathHelper; + import net.minecraft.util.StatCollector; + import net.minecraft.world.World; +import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.Event.Result; +import net.minecraftforge.event.entity.item.ItemExpireEvent; +import net.minecraftforge.event.entity.player.EntityItemPickupEvent; -+ - import cpw.mods.fml.common.registry.GameRegistry; - import net.minecraft.block.Block; - import net.minecraft.block.material.Material; -@@ -30,6 +35,11 @@ - /** The EntityItem's random initial float height. */ + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; +- + import cpw.mods.fml.common.FMLCommonHandler; ++import cpw.mods.fml.common.eventhandler.Event.Result; + + public class EntityItem extends Entity + { +@@ -33,6 +36,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. @@ -24,16 +27,19 @@ public EntityItem(World par1World, double par2, double par4, double par6) { super(par1World); -@@ -48,6 +58,7 @@ +@@ -49,8 +57,9 @@ + + public EntityItem(World par1World, double par2, double par4, double par6, ItemStack par8ItemStack) { - this(par1World, par2, par4, par6); +- this(par1World, par2, par4, par6); ++ this(par1World, par2, par4, par6); this.setEntityItemStack(par8ItemStack); + this.lifespan = (par8ItemStack.getItem() == null ? 6000 : par8ItemStack.getItem().getEntityLifespan(par8ItemStack, par1World)); } - /** -@@ -78,6 +89,15 @@ - */ + // JAVADOC METHOD $$ func_70041_e_ +@@ -76,6 +85,15 @@ + // JAVADOC METHOD $$ func_70071_h_ public void onUpdate() { + ItemStack stack = this.getDataWatcher().getWatchableObjectItemStack(10); @@ -45,50 +51,50 @@ + } + } + - super.onUpdate(); - - if (this.delayBeforeCanPickup > 0) -@@ -133,8 +153,30 @@ - - ++this.age; - -- if (!this.worldObj.isRemote && this.age >= 6000) -+ ItemStack item = getDataWatcher().getWatchableObjectItemStack(10); -+ -+ if (!this.worldObj.isRemote && this.age >= lifespan) + if (this.getEntityItem() == null) { -+ if (item != null) -+ { -+ ItemExpireEvent event = new ItemExpireEvent(this, (item.getItem() == null ? 6000 : item.getItem().getEntityLifespan(item, worldObj))); -+ if (MinecraftForge.EVENT_BUS.post(event)) -+ { -+ lifespan += event.extraLife; + this.setDead(); +@@ -131,8 +149,30 @@ + + ++this.age; + +- if (!this.worldObj.isRemote && this.age >= 6000) ++ ItemStack item = getDataWatcher().getWatchableObjectItemStack(10); ++ ++ if (!this.worldObj.isRemote && this.age >= lifespan) + { ++ if (item != null) ++ { ++ ItemExpireEvent event = new ItemExpireEvent(this, (item.getItem() == null ? 6000 : item.getItem().getEntityLifespan(item, worldObj))); ++ if (MinecraftForge.EVENT_BUS.post(event)) ++ { ++ lifespan += event.extraLife; ++ } ++ else ++ { ++ this.setDead(); ++ } + } + else + { + this.setDead(); + } + } -+ else ++ ++ if (item != null && item.stackSize <= 0) + { -+ this.setDead(); -+ } -+ } -+ -+ if (item != null && item.stackSize <= 0) -+ { - this.setDead(); + this.setDead(); + } } - } -@@ -268,6 +310,7 @@ +@@ -254,6 +294,7 @@ { par1NBTTagCompound.setShort("Health", (short)((byte)this.health)); par1NBTTagCompound.setShort("Age", (short)this.age); + par1NBTTagCompound.setInteger("Lifespan", lifespan); - if (this.getEntityItem() != null) + if (this.func_145800_j() != null) { -@@ -285,10 +328,17 @@ +@@ -290,10 +331,17 @@ NBTTagCompound nbttagcompound1 = par1NBTTagCompound.getCompoundTag("Item"); this.setEntityItemStack(ItemStack.loadItemStackFromNBT(nbttagcompound1)); @@ -106,12 +112,12 @@ + } } - /** -@@ -298,10 +348,22 @@ + // JAVADOC METHOD $$ func_70100_b_ +@@ -301,10 +349,22 @@ { if (!this.worldObj.isRemote) { -+ if (this.delayBeforeCanPickup > 0) ++ if (this.field_145804_b > 0) + { + return; + } @@ -126,8 +132,8 @@ ItemStack itemstack = this.getEntityItem(); int i = itemstack.stackSize; -- if (this.delayBeforeCanPickup == 0 && par1EntityPlayer.inventory.addItemStackToInventory(itemstack)) -+ if (this.delayBeforeCanPickup <= 0 && (event.getResult() == Result.ALLOW || i <= 0 || par1EntityPlayer.inventory.addItemStackToInventory(itemstack))) +- if (this.field_145804_b == 0 && (this.field_145802_g == null || 6000 - this.age <= 200 || this.field_145802_g.equals(par1EntityPlayer.getCommandSenderName())) && par1EntityPlayer.inventory.addItemStackToInventory(itemstack)) ++ if (this.field_145804_b <= 0 && (this.field_145802_g == null || lifespan - this.age <= 200 || this.field_145802_g.equals(par1EntityPlayer.getCommandSenderName())) && (event.getResult() == Result.ALLOW || i <= 0 || par1EntityPlayer.inventory.addItemStackToInventory(itemstack))) { - if (itemstack.itemID == Block.wood.blockID) + if (itemstack.getItem() == Item.func_150898_a(Blocks.log)) { diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch index 65c46345f..299a594bb 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecart.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecart.java -@@ -21,6 +21,10 @@ +@@ -23,6 +23,10 @@ import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraft.world.WorldServer; @@ -12,8 +12,8 @@ public abstract class EntityMinecart extends Entity { @@ -45,6 +49,20 @@ - @SideOnly(Side.CLIENT) - protected double velocityZ; + private double velocityZ; + private static final String __OBFID = "CL_00001670"; + /* Forge: Minecart Compatibility Layer Integration. */ + public static float defaultMaxSpeedAirLateral = 0.4f; @@ -32,8 +32,8 @@ public EntityMinecart(World par1World) { super(par1World); -@@ -104,6 +122,10 @@ - */ +@@ -94,19 +112,27 @@ + // JAVADOC METHOD $$ func_70114_g public AxisAlignedBB getCollisionBox(Entity par1Entity) { + if (getCollisionHandler() != null) @@ -43,8 +43,7 @@ return par1Entity.canBePushed() ? par1Entity.boundingBox : null; } -@@ -112,6 +134,10 @@ - */ + // JAVADOC METHOD $$ func_70046_E public AxisAlignedBB getBoundingBox() { + if (getCollisionHandler() != null) @@ -54,8 +53,7 @@ return null; } -@@ -120,7 +146,7 @@ - */ + // JAVADOC METHOD $$ func_70104_M public boolean canBePushed() { - return true; @@ -63,35 +61,33 @@ } public EntityMinecart(World par1World, double par2, double par4, double par6) -@@ -352,19 +378,21 @@ - double d5 = 0.0078125D; - int l = this.worldObj.getBlockId(j, i, k); +@@ -315,19 +341,20 @@ + double d2 = 0.0078125D; + Block block = this.worldObj.func_147439_a(l, i, i1); -- if (BlockRailBase.isRailBlock(l)) -+ if (canUseRail() && BlockRailBase.isRailBlock(l)) +- if (BlockRailBase.func_150051_a(block)) ++ if (canUseRail() && BlockRailBase.func_150051_a(block)) { -- int i1 = this.worldObj.getBlockMetadata(j, i, k); -- this.updateOnTrack(j, i, k, d4, d5, l, i1); -- -+ BlockRailBase rail = (BlockRailBase)Block.blocksList[l]; -+ float railMaxSpeed = rail.getRailMaxSpeed(worldObj, this, j, i, k); +- int j = this.worldObj.getBlockMetadata(l, i, i1); +- this.func_145821_a(l, i, i1, d0, d2, block, j); ++ float railMaxSpeed = ((BlockRailBase)block).getRailMaxSpeed(worldObj, this, l, i, i1); + double maxSpeed = Math.min(railMaxSpeed, getCurrentCartSpeedCapOnRail()); -+ int i1 = rail.getBasicRailMetadata(worldObj, this, j, i, k); -+ this.updateOnTrack(j, i, k, maxSpeed, getSlopeAdjustment(), l, i1); - if (l == Block.railActivator.blockID) ++ this.func_145821_a(l, i, i1, maxSpeed, getSlopeAdjustment(), block, ((BlockRailBase)block).getBasicRailMetadata(worldObj, this, l, i, i1)); + + if (block == Blocks.activator_rail) { -- this.onActivatorRailPass(j, i, k, (i1 & 8) != 0); -+ this.onActivatorRailPass(j, i, k, (worldObj.getBlockMetadata(j, i, k) & 8) != 0); +- this.onActivatorRailPass(l, i, i1, (j & 8) != 0); ++ this.onActivatorRailPass(l, i, i1, (worldObj.getBlockMetadata(l, i, i1) & 8) != 0); } } else { -- this.func_94088_b(d4); -+ this.func_94088_b(onGround ? d4 : getMaxSpeedAirLateral()); +- this.func_94088_b(d0); ++ this.func_94088_b(onGround ? d0 : getMaxSpeedAirLateral()); } - this.doBlockCollisions(); -@@ -391,8 +419,19 @@ + this.func_145775_I(); +@@ -354,8 +381,19 @@ } this.setRotation(this.rotationYaw, this.rotationPitch); @@ -111,17 +107,17 @@ + if (list != null && !list.isEmpty()) { - for (int j1 = 0; j1 < list.size(); ++j1) -@@ -415,6 +454,8 @@ + for (int k = 0; k < list.size(); ++k) +@@ -378,6 +416,8 @@ this.riddenByEntity = null; } + -+ MinecraftForge.EVENT_BUS.post(new MinecartUpdateEvent(this, j, i, k)); ++ MinecraftForge.EVENT_BUS.post(new MinecartUpdateEvent(this, l, i, i1)); } } -@@ -445,6 +486,17 @@ +@@ -406,6 +446,17 @@ this.motionZ = par1; } @@ -139,7 +135,7 @@ if (this.onGround) { this.motionX *= 0.5D; -@@ -452,13 +504,13 @@ +@@ -413,13 +464,13 @@ this.motionZ *= 0.5D; } @@ -157,16 +153,16 @@ } } -@@ -472,7 +524,7 @@ +@@ -433,7 +484,7 @@ - if (par8 == Block.railPowered.blockID) + if (p_145821_8_ == Blocks.golden_rail) { -- flag = (par9 & 8) != 0; -+ flag = (worldObj.getBlockMetadata(par1, par2, par3) & 8) != 0; +- flag = (p_145821_9_ & 8) != 0; ++ flag = (worldObj.getBlockMetadata(p_145821_1_, p_145821_2_, p_145821_3_) & 8) != 0; flag1 = !flag; } -@@ -551,7 +603,7 @@ +@@ -512,7 +563,7 @@ } } @@ -175,7 +171,7 @@ { d7 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); -@@ -599,37 +651,9 @@ +@@ -560,37 +611,9 @@ this.posX = d8 + d2 * d7; this.posZ = d9 + d3 * d7; this.setPosition(this.posX, this.posY + (double)this.yOffset, this.posZ); @@ -187,41 +183,41 @@ - d12 *= 0.75D; - d13 *= 0.75D; - } -+ moveMinecartOnRail(par1, par2, par3, par4); ++ moveMinecartOnRail(p_145821_1_, p_145821_2_, p_145821_3_, p_145821_4_); -- if (d12 < -par4) +- if (d12 < -p_145821_4_) - { -- d12 = -par4; +- d12 = -p_145821_4_; - } - -- if (d12 > par4) +- if (d12 > p_145821_4_) - { -- d12 = par4; +- d12 = p_145821_4_; - } - -- if (d13 < -par4) +- if (d13 < -p_145821_4_) - { -- d13 = -par4; +- d13 = -p_145821_4_; - } - -- if (d13 > par4) +- if (d13 > p_145821_4_) - { -- d13 = par4; +- d13 = p_145821_4_; - } - - this.moveEntity(d12, 0.0D, d13); - - if (aint[0][1] != 0 && MathHelper.floor_double(this.posX) - par1 == aint[0][0] && MathHelper.floor_double(this.posZ) - par3 == aint[0][2]) + if (aint[0][1] != 0 && MathHelper.floor_double(this.posX) - p_145821_1_ == aint[0][0] && MathHelper.floor_double(this.posZ) - p_145821_3_ == aint[0][2]) { this.setPosition(this.posX, this.posY + (double)aint[0][1], this.posZ); -@@ -666,8 +690,13 @@ - this.motionZ = d6 * (double)(k1 - par3); +@@ -627,8 +650,13 @@ + this.motionZ = d6 * (double)(i1 - p_145821_3_); } - if (flag) + if(shouldDoRailFunctions()) { -+ ((BlockRailBase)Block.blocksList[par8]).onMinecartPass(worldObj, this, par1, par2, par3); ++ ((BlockRailBase)p_145821_8_).onMinecartPass(worldObj, this, p_145821_1_, p_145821_2_, p_145821_3_); + } + + if (flag && shouldDoRailFunctions()) @@ -229,39 +225,39 @@ double d15 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); if (d15 > 0.01D) -@@ -737,13 +766,8 @@ +@@ -698,13 +726,8 @@ } else { -- int i1 = this.worldObj.getBlockMetadata(i, j, k); -+ int i1 = ((BlockRailBase)Block.blocksList[l]).getBasicRailMetadata(worldObj, this, i, j, k); +- int l = this.worldObj.getBlockMetadata(i, j, k); ++ int l = ((BlockRailBase)block).getBasicRailMetadata(worldObj, this, i, j, k); -- if (((BlockRailBase)Block.blocksList[l]).isPowered()) +- if (((BlockRailBase)block).func_150050_e()) - { -- i1 &= 7; +- l &= 7; - } - par3 = (double)j; - if (i1 >= 2 && i1 <= 5) -@@ -788,14 +812,9 @@ + if (l >= 2 && l <= 5) +@@ -749,14 +772,9 @@ - if (BlockRailBase.isRailBlock(l)) + if (BlockRailBase.func_150051_a(block)) { -- int i1 = this.worldObj.getBlockMetadata(i, j, k); -+ int i1 = ((BlockRailBase)Block.blocksList[l]).getBasicRailMetadata(worldObj, this, i, j, k); +- int l = this.worldObj.getBlockMetadata(i, j, k); ++ int l = ((BlockRailBase)block).getBasicRailMetadata(worldObj, this, i, j, k); par3 = (double)j; -- if (((BlockRailBase)Block.blocksList[l]).isPowered()) +- if (((BlockRailBase)block).func_150050_e()) - { -- i1 &= 7; +- l &= 7; - } - - if (i1 >= 2 && i1 <= 5) + if (l >= 2 && l <= 5) { par3 = (double)(j + 1); -@@ -900,11 +919,17 @@ - */ +@@ -855,11 +873,17 @@ + // JAVADOC METHOD $$ func_70108_f public void applyEntityCollision(Entity par1Entity) { + MinecraftForge.EVENT_BUS.post(new MinecartCollisionEvent(this, par1Entity)); @@ -279,7 +275,7 @@ { par1Entity.mountEntity(this); } -@@ -950,7 +975,7 @@ +@@ -905,7 +929,7 @@ double d7 = par1Entity.motionX + this.motionX; double d8 = par1Entity.motionZ + this.motionZ; @@ -288,20 +284,20 @@ { this.motionX *= 0.20000000298023224D; this.motionZ *= 0.20000000298023224D; -@@ -958,7 +983,7 @@ +@@ -913,7 +937,7 @@ par1Entity.motionX *= 0.949999988079071D; par1Entity.motionZ *= 0.949999988079071D; } - else if (((EntityMinecart)par1Entity).getMinecartType() != 2 && this.getMinecartType() == 2) -+ else if (!((EntityMinecart)par1Entity).isPoweredCart() && isPoweredCart()) ++ else if (((EntityMinecart)par1Entity).isPoweredCart() && !isPoweredCart()) { par1Entity.motionX *= 0.20000000298023224D; par1Entity.motionZ *= 0.20000000298023224D; -@@ -1168,4 +1193,211 @@ +@@ -1092,4 +1116,216 @@ { return this.entityName; } -+ ++ /* =================================== FORGE START ===========================================*/ + /** + * Moved to allow overrides. + * This code handles minecart movement and speed capping when on a rail. @@ -367,23 +363,27 @@ + */ + public ItemStack getCartItem() + { -+ if (this instanceof EntityMinecartChest) ++ if (this instanceof EntityMinecartFurnace) + { -+ return new ItemStack(Item.minecartCrate); ++ 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(Item.minecartTnt); -+ } -+ else if (this instanceof EntityMinecartFurnace) -+ { -+ return new ItemStack(Item.minecartPowered); ++ return new ItemStack(Items.tnt_minecart); + } + else if (this instanceof EntityMinecartHopper) + { -+ return new ItemStack(Item.minecartHopper); ++ return new ItemStack(Items.hopper_minecart); + } -+ return new ItemStack(Item.minecartEmpty); ++ else if (this instanceof EntityMinecartHopper) ++ { ++ return new ItemStack(Items.command_block_minecart); ++ } ++ return new ItemStack(Items.minecart); + } + + /** @@ -508,4 +508,5 @@ + { + return 0.0078125D; + } ++ /* =================================== FORGE END ===========================================*/ } diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch index 1e8e2fdb5..69050f9ad 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch @@ -1,22 +1,10 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java -@@ -8,6 +8,8 @@ - import net.minecraft.nbt.NBTTagList; - import net.minecraft.util.DamageSource; - import net.minecraft.world.World; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.entity.minecart.MinecartInteractEvent; - - public abstract class EntityMinecartContainer extends EntityMinecart implements IInventory - { -@@ -283,6 +285,10 @@ - */ +@@ -248,6 +248,7 @@ + // JAVADOC METHOD $$ func_130002_c public boolean interactFirst(EntityPlayer par1EntityPlayer) { -+ if(MinecraftForge.EVENT_BUS.post(new MinecartInteractEvent(this, par1EntityPlayer))) -+ { -+ return true; -+ } ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, par1EntityPlayer))) return true; if (!this.worldObj.isRemote) { par1EntityPlayer.displayGUIChest(this); diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch index fad2ad765..507f2324a 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch @@ -1,22 +1,10 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java -@@ -2,6 +2,8 @@ - - import net.minecraft.entity.player.EntityPlayer; - import net.minecraft.world.World; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.entity.minecart.MinecartInteractEvent; - - public class EntityMinecartEmpty extends EntityMinecart - { -@@ -20,6 +22,10 @@ - */ +@@ -20,6 +20,7 @@ + // JAVADOC METHOD $$ func_130002_c public boolean interactFirst(EntityPlayer par1EntityPlayer) { -+ if(MinecraftForge.EVENT_BUS.post(new MinecartInteractEvent(this, par1EntityPlayer))) -+ { -+ return true; -+ } ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, par1EntityPlayer))) return true; if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != par1EntityPlayer) { return true; diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch index 68fb0c9a0..6027a747c 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch @@ -1,22 +1,10 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java -@@ -8,6 +8,8 @@ - import net.minecraft.util.DamageSource; - import net.minecraft.util.MathHelper; - import net.minecraft.world.World; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.entity.minecart.MinecartInteractEvent; - - public class EntityMinecartFurnace extends EntityMinecart - { -@@ -126,6 +128,10 @@ - */ +@@ -124,6 +124,7 @@ + // JAVADOC METHOD $$ func_130002_c public boolean interactFirst(EntityPlayer par1EntityPlayer) { -+ if(MinecraftForge.EVENT_BUS.post(new MinecartInteractEvent(this, par1EntityPlayer))) -+ { -+ return true; -+ } ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, par1EntityPlayer))) return true; ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem(); - if (itemstack != null && itemstack.itemID == Item.coal.itemID) + 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 index 6910037ba..2d84a41b0 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch @@ -1,22 +1,10 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java -@@ -9,6 +9,8 @@ - import net.minecraft.tileentity.TileEntityHopper; - import net.minecraft.util.DamageSource; - import net.minecraft.world.World; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.entity.minecart.MinecartInteractEvent; - - public class EntityMinecartHopper extends EntityMinecartContainer implements Hopper - { -@@ -54,6 +56,10 @@ - */ +@@ -53,6 +53,7 @@ + // JAVADOC METHOD $$ func_130002_c public boolean interactFirst(EntityPlayer par1EntityPlayer) { -+ if(MinecraftForge.EVENT_BUS.post(new MinecartInteractEvent(this, par1EntityPlayer))) -+ { -+ return true; -+ } ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, par1EntityPlayer))) return true; if (!this.worldObj.isRemote) { par1EntityPlayer.displayGUIHopperMinecart(this); diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch index 0c5985167..ea91d34a7 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/monster/EntityEnderman.java +++ ../src-work/minecraft/net/minecraft/entity/monster/EntityEnderman.java -@@ -16,6 +16,8 @@ +@@ -19,6 +19,8 @@ import net.minecraft.util.MathHelper; import net.minecraft.util.Vec3; import net.minecraft.world.World; @@ -9,15 +9,14 @@ public class EntityEnderman extends EntityMob { -@@ -295,12 +297,17 @@ - */ +@@ -275,12 +277,16 @@ + // JAVADOC METHOD $$ func_70825_j protected boolean teleportTo(double par1, double par3, double par5) { + EnderTeleportEvent event = new EnderTeleportEvent(this, par1, par3, par5, 0); + if (MinecraftForge.EVENT_BUS.post(event)){ + return false; + } -+ double d3 = this.posX; double d4 = this.posY; double d5 = this.posZ; @@ -30,7 +29,7 @@ boolean flag = false; int i = MathHelper.floor_double(this.posX); int j = MathHelper.floor_double(this.posY); -@@ -477,7 +484,7 @@ +@@ -432,7 +438,7 @@ } } diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch index 722281d52..6fc13ccf3 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch @@ -1,46 +1,46 @@ --- ../src-base/minecraft/net/minecraft/entity/monster/EntityZombie.java +++ ../src-work/minecraft/net/minecraft/entity/monster/EntityZombie.java -@@ -34,6 +34,10 @@ - import net.minecraft.util.DamageSource; +@@ -37,6 +37,10 @@ import net.minecraft.util.MathHelper; + import net.minecraft.world.EnumDifficulty; import net.minecraft.world.World; -+import net.minecraftforge.common.ForgeDummyContainer; -+import net.minecraftforge.event.Event.Result; ++import net.minecraftforge.common.ForgeModContainer; ++import cpw.mods.fml.common.eventhandler.Event.Result; +import net.minecraftforge.event.ForgeEventFactory; +import net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent; public class EntityZombie extends EntityMob { -@@ -70,7 +74,7 @@ +@@ -75,7 +79,7 @@ this.getEntityAttribute(SharedMonsterAttributes.followRange).setAttribute(40.0D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.23000000417232513D); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setAttribute(3.0D); - this.getAttributeMap().func_111150_b(field_110186_bp).setAttribute(this.rand.nextDouble() * 0.10000000149011612D); -+ this.getAttributeMap().func_111150_b(field_110186_bp).setAttribute(this.rand.nextDouble() * ForgeDummyContainer.zombieSummonBaseChance); ++ this.getAttributeMap().func_111150_b(field_110186_bp).setAttribute(this.rand.nextDouble() * ForgeModContainer.zombieSummonBaseChance); } protected void entityInit() -@@ -211,13 +215,28 @@ +@@ -234,12 +238,28 @@ entitylivingbase = (EntityLivingBase)par1DamageSource.getEntity(); } -- if (entitylivingbase != null && this.worldObj.difficultySetting >= 3 && (double)this.rand.nextFloat() < this.getEntityAttribute(field_110186_bp).getAttributeValue()) -- { +- if (entitylivingbase != null && this.worldObj.difficultySetting == EnumDifficulty.HARD && (double)this.rand.nextFloat() < this.getEntityAttribute(field_110186_bp).getAttributeValue()) ++ ++ int i = MathHelper.floor_double(this.posX); ++ int j = MathHelper.floor_double(this.posY); ++ int k = MathHelper.floor_double(this.posZ); ++ ++ SummonAidEvent summonAid = ForgeEventFactory.fireZombieSummonAid(this, worldObj, i, j, k, entitylivingbase, this.getEntityAttribute(field_110186_bp).getAttributeValue()); ++ ++ if (summonAid.getResult() == Result.DENY) + { - 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); -+ int i = MathHelper.floor_double(this.posX); -+ int j = MathHelper.floor_double(this.posY); -+ int k = MathHelper.floor_double(this.posZ); - -+ SummonAidEvent summonAid = ForgeEventFactory.fireZombieSummonAid(this, worldObj, i, j, k, entitylivingbase, this.getEntityAttribute(field_110186_bp).getAttributeValue()); -+ -+ if (summonAid.getResult() == Result.DENY) -+ { + return true; + } -+ else if (summonAid.getResult() == Result.ALLOW || entitylivingbase != null && this.worldObj.difficultySetting >= 3 && (double)this.rand.nextFloat() < this.getEntityAttribute(field_110186_bp).getAttributeValue()) ++ else if (summonAid.getResult() == Result.ALLOW || entitylivingbase != null && this.worldObj.difficultySetting == EnumDifficulty.HARD && (double)this.rand.nextFloat() < this.getEntityAttribute(field_110186_bp).getAttributeValue()) + { + EntityZombie entityzombie; + if (summonAid.customSummonedAid != null && summonAid.getResult() == Result.ALLOW) @@ -51,25 +51,24 @@ + { + entityzombie = new EntityZombie(this.worldObj); + } -+ + for (int l = 0; l < 50; ++l) { - int i1 = i + MathHelper.getRandomIntegerInRange(this.rand, 7, 40) * MathHelper.getRandomIntegerInRange(this.rand, -1, 1); -@@ -231,7 +250,7 @@ +@@ -254,7 +274,7 @@ if (this.worldObj.checkNoEntityCollision(entityzombie.boundingBox) && this.worldObj.getCollidingBoundingBoxes(entityzombie, entityzombie.boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(entityzombie.boundingBox)) { this.worldObj.spawnEntityInWorld(entityzombie); - entityzombie.setAttackTarget(entitylivingbase); + if (entitylivingbase != null) entityzombie.setAttackTarget(entitylivingbase); - entityzombie.onSpawnWithEgg((EntityLivingData)null); + entityzombie.onSpawnWithEgg((IEntityLivingData)null); this.getEntityAttribute(field_110186_bp).applyModifier(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0)); entityzombie.getEntityAttribute(field_110186_bp).applyModifier(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, 0)); -@@ -442,7 +461,7 @@ +@@ -449,7 +469,7 @@ if (par1EntityLivingData1 == null) { -- par1EntityLivingData1 = new EntityZombieGroupData(this, this.worldObj.rand.nextFloat() < 0.05F, this.worldObj.rand.nextFloat() < 0.05F, (EntityZombieINNER1)null); -+ par1EntityLivingData1 = new EntityZombieGroupData(this, this.worldObj.rand.nextFloat() < ForgeDummyContainer.zombieBabyChance, this.worldObj.rand.nextFloat() < 0.05F, (EntityZombieINNER1)null); +- par1EntityLivingData1 = new EntityZombie.GroupData(this.worldObj.rand.nextFloat() < 0.05F, this.worldObj.rand.nextFloat() < 0.05F, null); ++ par1EntityLivingData1 = new EntityZombie.GroupData(this.worldObj.rand.nextFloat() < ForgeModContainer.zombieBabyChance, this.worldObj.rand.nextFloat() < 0.05F, null); } - if (par1EntityLivingData1 instanceof EntityZombieGroupData) + if (par1EntityLivingData1 instanceof EntityZombie.GroupData) diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch index 927de6add..b96937749 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch @@ -1,23 +1,30 @@ --- ../src-base/minecraft/net/minecraft/entity/passive/EntityMooshroom.java +++ ../src-work/minecraft/net/minecraft/entity/passive/EntityMooshroom.java -@@ -8,7 +8,11 @@ - import net.minecraft.item.ItemStack; - import net.minecraft.world.World; +@@ -1,14 +1,18 @@ + package net.minecraft.entity.passive; --public class EntityMooshroom extends EntityCow +import java.util.ArrayList; + + import net.minecraft.entity.EntityAgeable; + import net.minecraft.entity.item.EntityItem; + import net.minecraft.entity.player.EntityPlayer; + import net.minecraft.init.Blocks; + import net.minecraft.init.Items; + import net.minecraft.item.ItemStack; ++import net.minecraft.world.IBlockAccess; + import net.minecraft.world.World; +import net.minecraftforge.common.IShearable; -+ + +-public class EntityMooshroom extends EntityCow +public class EntityMooshroom extends EntityCow implements IShearable { - public EntityMooshroom(World par1World) - { -@@ -38,29 +42,7 @@ + private static final String __OBFID = "CL_00001645"; + +@@ -38,32 +42,7 @@ } } -- if (itemstack != null && itemstack.itemID == Item.shears.itemID && this.getGrowingAge() >= 0) +- if (itemstack != null && itemstack.getItem() == Items.shears && this.getGrowingAge() >= 0) { - this.setDead(); - this.worldObj.spawnParticle("largeexplode", this.posX, this.posY + (double)(this.height / 2.0F), this.posZ, 0.0D, 0.0D, 0.0D); @@ -32,8 +39,11 @@ - - for (int i = 0; i < 5; ++i) - { -- this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.posX, this.posY + (double)this.height, this.posZ, new ItemStack(Block.mushroomRed))); +- this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.posX, this.posY + (double)this.height, this.posZ, new ItemStack(Blocks.red_mushroom))); - } +- +- itemstack.damageItem(1, par1EntityPlayer); +- this.playSound("mob.sheep.shear", 1.0F, 1.0F); - } - - return true; @@ -43,19 +53,19 @@ return super.interact(par1EntityPlayer); } } -@@ -82,4 +64,29 @@ +@@ -72,4 +51,30 @@ { - return this.func_94900_c(par1EntityAgeable); + return new EntityMooshroom(this.worldObj); } + + @Override -+ public boolean isShearable(ItemStack item, World world, int X, int Y, int Z) ++ public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z) + { + return getGrowingAge() >= 0; + } + + @Override -+ public ArrayList onSheared(ItemStack item, World world, int X, int Y, int Z, int fortune) ++ public ArrayList onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune) + { + setDead(); + EntityCow entitycow = new EntityCow(worldObj); @@ -66,10 +76,11 @@ + worldObj.spawnParticle("largeexplode", posX, posY + (double)(height / 2.0F), posZ, 0.0D, 0.0D, 0.0D); + + ArrayList ret = new ArrayList(); -+ for (int x = 0; x < 5; x++) ++ for (int i = 0; i < 5; i++) + { -+ ret.add(new ItemStack(Block.mushroomRed)); ++ ret.add(new ItemStack(Blocks.red_mushroom)); + } ++ 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 index eb6a832b9..700a2678c 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch @@ -1,13 +1,11 @@ --- ../src-base/minecraft/net/minecraft/entity/passive/EntityOcelot.java +++ ../src-work/minecraft/net/minecraft/entity/passive/EntityOcelot.java -@@ -334,8 +334,9 @@ - } +@@ -298,7 +298,7 @@ - int l = this.worldObj.getBlockId(i, j - 1, k); -+ Block block = Block.blocksList[l]; + Block block = this.worldObj.func_147439_a(i, j - 1, k); -- if (l == Block.grass.blockID || l == Block.leaves.blockID) -+ if (l == Block.grass.blockID || (block != null && block.isLeaves(worldObj, i, j - 1, k))) +- if (block == Blocks.grass || block.func_149688_o() == Material.field_151584_j) ++ if (block == Blocks.grass || block.isLeaves(worldObj, i, j - 1, k)) { return true; } diff --git a/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch index 9c5cf3768..e58f4be94 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch @@ -1,32 +1,33 @@ --- ../src-base/minecraft/net/minecraft/entity/passive/EntitySheep.java +++ ../src-work/minecraft/net/minecraft/entity/passive/EntitySheep.java -@@ -2,6 +2,8 @@ +@@ -2,6 +2,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -+ +import java.util.ArrayList; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.entity.EntityAgeable; -@@ -26,7 +28,9 @@ +@@ -27,9 +28,11 @@ + import net.minecraft.item.crafting.CraftingManager; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.MathHelper; ++import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; ++import net.minecraftforge.common.IShearable; -public class EntitySheep extends EntityAnimal -+import net.minecraftforge.common.IShearable; -+ +public class EntitySheep extends EntityAnimal implements IShearable { - private final InventoryCrafting field_90016_e = new InventoryCrafting(new ContainerSheep(this), 2, 1); - -@@ -141,28 +145,6 @@ - */ + private final InventoryCrafting field_90016_e = new InventoryCrafting(new Container() + { +@@ -130,28 +133,6 @@ + // JAVADOC METHOD $$ func_70085_c public boolean interact(EntityPlayer par1EntityPlayer) { - ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem(); - -- if (itemstack != null && itemstack.itemID == Item.shears.itemID && !this.getSheared() && !this.isChild()) +- if (itemstack != null && itemstack.getItem() == Items.shears && !this.getSheared() && !this.isChild()) - { - if (!this.worldObj.isRemote) - { @@ -35,7 +36,7 @@ - - for (int j = 0; j < i; ++j) - { -- EntityItem entityitem = this.entityDropItem(new ItemStack(Block.cloth.blockID, 1, this.getFleeceColor()), 1.0F); +- EntityItem entityitem = this.entityDropItem(new ItemStack(Item.func_150898_a(Blocks.wool), 1, this.getFleeceColor()), 1.0F); - entityitem.motionY += (double)(this.rand.nextFloat() * 0.05F); - entityitem.motionX += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F); - entityitem.motionZ += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F); @@ -49,28 +50,28 @@ return super.interact(par1EntityPlayer); } -@@ -343,4 +325,24 @@ +@@ -305,4 +286,24 @@ { - return this.func_90015_b(par1EntityAgeable); + return 15 - ((EntitySheep)par1EntityAnimal).getFleeceColor(); } + + @Override -+ public boolean isShearable(ItemStack item, World world, int X, int Y, int Z) ++ public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z) + { + return !getSheared() && !isChild(); + } + + @Override -+ public ArrayList onSheared(ItemStack item, World world, int X, int Y, int Z, int fortune) ++ public ArrayList onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune) + { + ArrayList ret = new ArrayList(); + setSheared(true); + int i = 1 + rand.nextInt(3); + for (int j = 0; j < i; j++) + { -+ ret.add(new ItemStack(Block.cloth.blockID, 1, getFleeceColor())); ++ ret.add(new ItemStack(Blocks.wool, 1, getFleeceColor())); + } -+ this.worldObj.playSoundAtEntity(this, "mob.sheep.shear", 1.0F, 1.0F); ++ 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 index f796c92b0..aecb8713f 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch @@ -1,8 +1,8 @@ --- ../src-base/minecraft/net/minecraft/entity/passive/EntityVillager.java +++ ../src-work/minecraft/net/minecraft/entity/passive/EntityVillager.java -@@ -205,7 +205,7 @@ +@@ -189,7 +189,7 @@ ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem(); - boolean flag = itemstack != null && itemstack.itemID == Item.monsterPlacer.itemID; + 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() && !par1EntityPlayer.isSneaking()) diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch index b46869007..3a86b8037 100644 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch @@ -1,19 +1,20 @@ --- ../src-base/minecraft/net/minecraft/entity/player/EntityPlayer.java +++ ../src-work/minecraft/net/minecraft/entity/player/EntityPlayer.java -@@ -5,8 +5,11 @@ +@@ -8,9 +8,12 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import java.util.Collection; +import java.util.HashMap; import java.util.Iterator; import java.util.List; + import java.util.UUID; +import java.util.Map.Entry; + import net.minecraft.block.Block; import net.minecraft.block.BlockBed; import net.minecraft.block.material.Material; -@@ -66,8 +69,21 @@ - import net.minecraft.world.World; +@@ -78,8 +81,24 @@ + import net.minecraft.world.WorldSettings; import net.minecraft.world.chunk.IChunkProvider; +import net.minecraftforge.common.ForgeHooks; @@ -31,24 +32,13 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandSender { + public static final String PERSISTED_NBT_TAG = "PlayerPersisted"; - /** Inventory of the player */ ++ private HashMap spawnChunkMap = new HashMap(); ++ private HashMap spawnForcedMap = new HashMap(); ++ + // JAVADOC FIELD $$ field_71071_by public InventoryPlayer inventory = new InventoryPlayer(this); private InventoryEnderChest theInventoryEnderChest = new InventoryEnderChest(); -@@ -120,11 +136,13 @@ - * Holds the last coordinate to spawn based on last bed that the player sleep. - */ - private ChunkCoordinates spawnChunk; -+ private HashMap spawnChunkMap = new HashMap(); - - /** - * Whether this player's spawn point is forced, preventing execution of bed checks. - */ - private boolean spawnForced; -+ private HashMap spawnForcedMap = new HashMap(); - - /** Holds the coordinate of the player when enter a minecraft to ride. */ - private ChunkCoordinates startMinecartRidingCoordinate; -@@ -175,6 +193,7 @@ +@@ -148,6 +167,7 @@ this.setLocationAndAngles((double)chunkcoordinates.posX + 0.5D, (double)(chunkcoordinates.posY + 1), (double)chunkcoordinates.posZ + 0.5D, 0.0F, 0.0F); this.field_70741_aB = 180.0F; this.fireResistance = 20; @@ -56,15 +46,15 @@ } protected void applyEntityAttributes() -@@ -267,6 +286,7 @@ +@@ -227,6 +247,7 @@ if (itemstack == this.itemInUse) { -+ itemInUse.getItem().onUsingItemTick(itemInUse, this, itemInUseCount); ++ itemInUse.getItem().onUsingTick(itemInUse, this, itemInUseCount); if (this.itemInUseCount <= 25 && this.itemInUseCount % 4 == 0) { this.updateItemUse(itemstack, 5); -@@ -321,7 +341,7 @@ +@@ -281,7 +302,7 @@ super.onUpdate(); @@ -73,16 +63,7 @@ { this.closeScreen(); this.openContainer = this.inventoryContainer; -@@ -429,7 +449,7 @@ - vec31.rotateAroundX(-this.rotationPitch * (float)Math.PI / 180.0F); - vec31.rotateAroundY(-this.rotationYaw * (float)Math.PI / 180.0F); - vec31 = vec31.addVector(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ); -- this.worldObj.spawnParticle("iconcrack_" + par1ItemStack.getItem().itemID, vec31.xCoord, vec31.yCoord, vec31.zCoord, vec3.xCoord, vec3.yCoord + 0.05D, vec3.zCoord); -+ this.worldObj.spawnParticle("iconcrack_" + par1ItemStack.getItem().itemID + "_" + par1ItemStack.getItemDamage(), vec31.xCoord, vec31.yCoord, vec31.zCoord, vec3.xCoord, vec3.yCoord + 0.05D, vec3.zCoord); - } - - this.playSound("random.eat", 0.5F + 0.5F * (float)this.rand.nextInt(2), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); -@@ -537,11 +557,11 @@ +@@ -498,11 +519,11 @@ this.cameraYaw = 0.0F; this.addMountedMovementStat(this.posX - d0, this.posY - d1, this.posZ - d2); @@ -96,8 +77,8 @@ } } } -@@ -684,11 +704,15 @@ - */ +@@ -632,11 +653,15 @@ + // JAVADOC METHOD $$ func_70645_a public void onDeath(DamageSource par1DamageSource) { + if (ForgeHooks.onLivingDeath(this, par1DamageSource)) return; @@ -109,10 +90,10 @@ + captureDrops = true; + capturedDrops.clear(); + - if (this.username.equals("Notch")) + if (this.getCommandSenderName().equals("Notch")) { - this.dropPlayerItemWithRandomChoice(new ItemStack(Item.appleRed, 1), true); -@@ -699,6 +723,20 @@ + this.func_146097_a(new ItemStack(Items.apple, 1), true, false); +@@ -647,6 +672,20 @@ this.inventory.dropAllItems(); } @@ -133,11 +114,11 @@ if (par1DamageSource != null) { this.motionX = (double)(-MathHelper.cos((this.attackedAtYaw + this.rotationYaw) * (float)Math.PI / 180.0F) * 0.1F); -@@ -747,7 +785,20 @@ - */ +@@ -702,13 +741,26 @@ + // JAVADOC METHOD $$ func_71040_bB public EntityItem dropOneItem(boolean par1) { -- return this.dropPlayerItemWithRandomChoice(this.inventory.decrStackSize(this.inventory.currentItem, par1 && this.inventory.getCurrentItem() != null ? this.inventory.getCurrentItem().stackSize : 1), false); +- return this.func_146097_a(this.inventory.decrStackSize(this.inventory.currentItem, par1 && this.inventory.getCurrentItem() != null ? this.inventory.getCurrentItem().stackSize : 1), false, true); + ItemStack stack = inventory.getCurrentItem(); + + if (stack == null) @@ -148,25 +129,23 @@ + if (stack.getItem().onDroppedByPlayer(stack, this)) + { + int count = par1 && this.inventory.getCurrentItem() != null ? this.inventory.getCurrentItem().stackSize : 1; -+ return ForgeHooks.onPlayerTossEvent(this, inventory.decrStackSize(inventory.currentItem, count)); ++ return ForgeHooks.onPlayerTossEvent(this, inventory.decrStackSize(inventory.currentItem, count), true); + } + + return null; } - /** -@@ -756,7 +807,7 @@ - */ - public EntityItem dropPlayerItem(ItemStack par1ItemStack) + // JAVADOC METHOD $$ func_71019_a + public EntityItem dropPlayerItemWithRandomChoice(ItemStack par1ItemStack, boolean par2) { -- return this.dropPlayerItemWithRandomChoice(par1ItemStack, false); -+ return ForgeHooks.onPlayerTossEvent(this, par1ItemStack); +- return this.func_146097_a(par1ItemStack, false, false); ++ return ForgeHooks.onPlayerTossEvent(this, par1ItemStack, false); } - /** -@@ -812,16 +863,29 @@ - */ - public void joinEntityItemWithWorld(EntityItem par1EntityItem) + public EntityItem func_146097_a(ItemStack p_146097_1_, boolean p_146097_2_, boolean p_146097_3_) +@@ -765,13 +817,25 @@ + // JAVADOC METHOD $$ func_71012_a + protected void joinEntityItemWithWorld(EntityItem par1EntityItem) { + if (captureDrops) + { @@ -176,81 +155,77 @@ this.worldObj.spawnEntityInWorld(par1EntityItem); } - /** - * Returns how strong the player is against the specified block at this moment -+ * Deprecated in favor of the more sensitive version - */ -+ @Deprecated - public float getCurrentPlayerStrVsBlock(Block par1Block, boolean par2) ++ @Deprecated //Metadata sensitive version + public float func_146096_a(Block p_146096_1_, boolean p_146096_2_) { -- float f = this.inventory.getStrVsBlock(par1Block); -+ return getCurrentPlayerStrVsBlock(par1Block, par2, 0); +- float f = this.inventory.func_146023_a(p_146096_1_); ++ return getBreakSpeed(p_146096_1_, p_146096_2_, 0); + } -+ public float getCurrentPlayerStrVsBlock(Block par1Block, boolean par2, int meta) ++ public float getBreakSpeed(Block p_146096_1_, boolean p_146096_2_, int meta) + { + ItemStack stack = inventory.getCurrentItem(); -+ float f = (stack == null ? 1.0F : stack.getItem().getStrVsBlock(stack, par1Block, meta)); ++ float f = (stack == null ? 1.0F : stack.getItem().getDigSpeed(stack, p_146096_1_, meta)); + if (f > 1.0F) { int i = EnchantmentHelper.getEfficiencyModifier(this); -@@ -831,7 +895,9 @@ +@@ -781,7 +845,9 @@ { float f1 = (float)(i * i + 1); -- if (!itemstack.canHarvestBlock(par1Block) && f <= 1.0F) -+ boolean canHarvest = ForgeHooks.canToolHarvestBlock(par1Block, meta, itemstack); +- if (!itemstack.func_150998_b(p_146096_1_) && f <= 1.0F) ++ boolean canHarvest = ForgeHooks.canToolHarvestBlock(p_146096_1_, meta, itemstack); + + if (!canHarvest && f <= 1.0F) { f += f1 * 0.08F; } -@@ -862,7 +928,8 @@ +@@ -812,12 +878,13 @@ f /= 5.0F; } - return f; -+ f = ForgeEventFactory.getBreakSpeed(this, par1Block, meta, f); ++ f = ForgeEventFactory.getBreakSpeed(this, p_146096_1_, meta, f); + return (f < 0 ? 0 : f); } - /** -@@ -870,7 +937,7 @@ - */ - public boolean canHarvestBlock(Block par1Block) + public boolean func_146099_a(Block p_146099_1_) { -- return this.inventory.canHarvestBlock(par1Block); -+ return ForgeEventFactory.doPlayerHarvestCheck(this, par1Block, inventory.canHarvestBlock(par1Block)); +- return this.inventory.func_146025_b(p_146099_1_); ++ return ForgeEventFactory.doPlayerHarvestCheck(this, p_146099_1_, this.inventory.func_146025_b(p_146099_1_)); } - /** -@@ -900,6 +967,14 @@ - this.spawnChunk = new ChunkCoordinates(par1NBTTagCompound.getInteger("SpawnX"), par1NBTTagCompound.getInteger("SpawnY"), par1NBTTagCompound.getInteger("SpawnZ")); + // JAVADOC METHOD $$ func_70037_a +@@ -847,6 +914,16 @@ this.spawnForced = par1NBTTagCompound.getBoolean("SpawnForced"); } + + NBTTagList spawnlist = null; -+ spawnlist = par1NBTTagCompound.getTagList("Spawns"); -+ for (int i = 0; i < spawnlist.tagCount(); ++i) { -+ NBTTagCompound spawndata = (NBTTagCompound)spawnlist.tagAt(i); ++ spawnlist = par1NBTTagCompound.func_150295_c("Spawns", 10); ++ for (int i = 0; i < spawnlist.tagCount(); i++) ++ { ++ NBTTagCompound spawndata = (NBTTagCompound)spawnlist.func_150305_b(i); + int spawndim = spawndata.getInteger("Dim"); + this.spawnChunkMap.put(spawndim, new ChunkCoordinates(spawndata.getInteger("SpawnX"), spawndata.getInteger("SpawnY"), spawndata.getInteger("SpawnZ"))); + this.spawnForcedMap.put(spawndim, spawndata.getBoolean("SpawnForced")); + } - ++ this.foodStats.readNBT(par1NBTTagCompound); this.capabilities.readCapabilitiesFromNBT(par1NBTTagCompound); -@@ -933,6 +1008,21 @@ - par1NBTTagCompound.setInteger("SpawnZ", this.spawnChunk.posZ); + +@@ -878,6 +955,23 @@ par1NBTTagCompound.setBoolean("SpawnForced", this.spawnForced); } + + NBTTagList spawnlist = new NBTTagList(); -+ for (Entry entry : this.spawnChunkMap.entrySet()) { -+ NBTTagCompound spawndata = new NBTTagCompound(); ++ for (Entry entry : this.spawnChunkMap.entrySet()) ++ { + ChunkCoordinates spawn = entry.getValue(); + if (spawn == null) continue; + Boolean forced = spawnForcedMap.get(entry.getKey()); + if (forced == null) forced = false; ++ NBTTagCompound spawndata = new NBTTagCompound(); + spawndata.setInteger("Dim", entry.getKey()); + spawndata.setInteger("SpawnX", spawn.posX); + spawndata.setInteger("SpawnY", spawn.posY); @@ -259,10 +234,11 @@ + spawnlist.appendTag(spawndata); + } + par1NBTTagCompound.setTag("Spawns", spawnlist); - ++ this.foodStats.writeNBT(par1NBTTagCompound); this.capabilities.writeCapabilitiesToNBT(par1NBTTagCompound); -@@ -964,7 +1054,7 @@ + par1NBTTagCompound.setTag("EnderItems", this.theInventoryEnderChest.saveInventoryToNBT()); +@@ -902,7 +996,7 @@ public float getEyeHeight() { @@ -270,16 +246,16 @@ + return eyeHeight; } - /** -@@ -980,6 +1070,7 @@ - */ + // JAVADOC METHOD $$ func_71061_d_ +@@ -914,6 +1008,7 @@ + // JAVADOC METHOD $$ func_70097_a public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) { + if (ForgeHooks.onLivingAttack(this, par1DamageSource, par2)) return false; if (this.isEntityInvulnerable()) { return false; -@@ -1092,12 +1183,15 @@ +@@ -1018,12 +1113,15 @@ { if (!this.isEntityInvulnerable()) { @@ -296,7 +272,7 @@ par2 = this.applyPotionDamageCalculations(par1DamageSource, par2); float f1 = par2; par2 = Math.max(par2 - this.getAbsorptionAmount(), 0.0F); -@@ -1147,6 +1241,7 @@ +@@ -1058,6 +1156,7 @@ public boolean interactWith(Entity par1Entity) { @@ -304,8 +280,8 @@ ItemStack itemstack = this.getCurrentEquippedItem(); ItemStack itemstack1 = itemstack != null ? itemstack.copy() : null; -@@ -1203,7 +1298,9 @@ - */ +@@ -1110,7 +1209,9 @@ + // JAVADOC METHOD $$ func_71028_bD public void destroyCurrentEquippedItem() { + ItemStack orig = getCurrentEquippedItem(); @@ -313,9 +289,9 @@ + MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(this, orig)); } - /** -@@ -1220,6 +1317,15 @@ - */ + // JAVADOC METHOD $$ func_70033_W +@@ -1122,6 +1223,15 @@ + // JAVADOC METHOD $$ func_71059_n public void attackTargetEntityWithCurrentItem(Entity par1Entity) { + if (MinecraftForge.EVENT_BUS.post(new AttackEntityEvent(this, par1Entity))) @@ -330,9 +306,9 @@ if (par1Entity.canAttackWithItem()) { if (!par1Entity.hitByEntity(this)) -@@ -1373,6 +1479,12 @@ - */ - public EnumStatus sleepInBedAt(int par1, int par2, int par3) +@@ -1273,6 +1383,12 @@ + // JAVADOC METHOD $$ func_71018_a + public EntityPlayer.EnumStatus sleepInBedAt(int par1, int par2, int par3) { + PlayerSleepInBedEvent event = new PlayerSleepInBedEvent(this, par1, par2, par3); + MinecraftForge.EVENT_BUS.post(event); @@ -343,81 +319,70 @@ if (!this.worldObj.isRemote) { if (this.isPlayerSleeping() || !this.isEntityAlive()) -@@ -1417,6 +1529,11 @@ - { - int l = this.worldObj.getBlockMetadata(par1, par2, par3); - int i1 = BlockBed.getDirection(l); -+ Block block = Block.blocksList[worldObj.getBlockId(par1, par2, par3)]; -+ if (block != null) -+ { -+ i1 = block.getBedDirection(worldObj, par1, par2, par3); -+ } - float f = 0.5F; - float f1 = 0.5F; +@@ -1315,8 +1431,7 @@ -@@ -1487,10 +1604,12 @@ + if (this.worldObj.blockExists(par1, par2, par3)) + { +- int i1 = this.worldObj.getBlockMetadata(par1, par2, par3); +- int l = BlockBed.func_149895_l(i1); ++ int l = worldObj.func_147439_a(par1, par2, par3).getBedDirection(worldObj, par1, par2, par3); + float f1 = 0.5F; + float f = 0.5F; + +@@ -1384,11 +1499,12 @@ + this.resetHeight(); ChunkCoordinates chunkcoordinates = this.playerLocation; ChunkCoordinates chunkcoordinates1 = this.playerLocation; ++ Block block = (chunkcoordinates == null ? null : worldObj.func_147439_a(chunkcoordinates.posX, chunkcoordinates.posY, chunkcoordinates.posZ)); -- if (chunkcoordinates != null && this.worldObj.getBlockId(chunkcoordinates.posX, chunkcoordinates.posY, chunkcoordinates.posZ) == Block.bed.blockID) -+ Block block = (chunkcoordinates == null ? null : Block.blocksList[worldObj.getBlockId(chunkcoordinates.posX, chunkcoordinates.posY, chunkcoordinates.posZ)]); -+ -+ if (chunkcoordinates != null && block != null && block.isBed(worldObj, chunkcoordinates.posX, chunkcoordinates.posY, chunkcoordinates.posZ, this)) +- if (chunkcoordinates != null && this.worldObj.func_147439_a(chunkcoordinates.posX, chunkcoordinates.posY, chunkcoordinates.posZ) == Blocks.bed) ++ if (chunkcoordinates != null && block.isBed(worldObj, chunkcoordinates.posX, chunkcoordinates.posY, chunkcoordinates.posZ, this)) { -- BlockBed.setBedOccupied(this.worldObj, chunkcoordinates.posX, chunkcoordinates.posY, chunkcoordinates.posZ, false); -- chunkcoordinates1 = BlockBed.getNearestEmptyChunkCoordinates(this.worldObj, chunkcoordinates.posX, chunkcoordinates.posY, chunkcoordinates.posZ, 0); +- BlockBed.func_149979_a(this.worldObj, chunkcoordinates.posX, chunkcoordinates.posY, chunkcoordinates.posZ, false); +- chunkcoordinates1 = BlockBed.func_149977_a(this.worldObj, chunkcoordinates.posX, chunkcoordinates.posY, chunkcoordinates.posZ, 0); + block.setBedOccupied(this.worldObj, chunkcoordinates.posX, chunkcoordinates.posY, chunkcoordinates.posZ, this, false); -+ chunkcoordinates1 = block.getBedSpawnPosition(worldObj, chunkcoordinates.posX, chunkcoordinates.posY, chunkcoordinates.posZ, this); ++ chunkcoordinates1 = block.getBedSpawnPosition(this.worldObj, chunkcoordinates.posX, chunkcoordinates.posY, chunkcoordinates.posZ, this); if (chunkcoordinates1 == null) { -@@ -1527,7 +1646,9 @@ - */ +@@ -1423,7 +1539,7 @@ + // JAVADOC METHOD $$ func_71065_l private boolean isInBed() { -- return this.worldObj.getBlockId(this.playerLocation.posX, this.playerLocation.posY, this.playerLocation.posZ) == Block.bed.blockID; -+ ChunkCoordinates c = playerLocation; -+ int blockID = worldObj.getBlockId(c.posX, c.posY, c.posZ); -+ return Block.blocksList[blockID] != null && Block.blocksList[blockID].isBed(worldObj, c.posX, c.posY, c.posZ, this); +- return this.worldObj.func_147439_a(this.playerLocation.posX, this.playerLocation.posY, this.playerLocation.posZ) == Blocks.bed; ++ return this.worldObj.func_147439_a(this.playerLocation.posX, this.playerLocation.posY, this.playerLocation.posZ).isBed(worldObj, playerLocation.posX, playerLocation.posY, playerLocation.posZ, this); } - /** -@@ -1542,9 +1663,12 @@ + // JAVADOC METHOD $$ func_71056_a +@@ -1435,9 +1551,9 @@ ichunkprovider.loadChunk(par1ChunkCoordinates.posX - 3 >> 4, par1ChunkCoordinates.posZ + 3 >> 4); ichunkprovider.loadChunk(par1ChunkCoordinates.posX + 3 >> 4, par1ChunkCoordinates.posZ + 3 >> 4); -- if (par0World.getBlockId(par1ChunkCoordinates.posX, par1ChunkCoordinates.posY, par1ChunkCoordinates.posZ) == Block.bed.blockID) -+ ChunkCoordinates c = par1ChunkCoordinates; -+ Block block = Block.blocksList[par0World.getBlockId(c.posX, c.posY, c.posZ)]; -+ -+ if (block != null && block.isBed(par0World, c.posX, c.posY, c.posZ, null)) +- if (par0World.func_147439_a(par1ChunkCoordinates.posX, par1ChunkCoordinates.posY, par1ChunkCoordinates.posZ) == Blocks.bed) ++ if (par0World.func_147439_a(par1ChunkCoordinates.posX, par1ChunkCoordinates.posY, par1ChunkCoordinates.posZ).isBed(par0World, par1ChunkCoordinates.posX, par1ChunkCoordinates.posY, par1ChunkCoordinates.posZ, null)) { -- ChunkCoordinates chunkcoordinates1 = BlockBed.getNearestEmptyChunkCoordinates(par0World, par1ChunkCoordinates.posX, par1ChunkCoordinates.posY, par1ChunkCoordinates.posZ, 0); -+ ChunkCoordinates chunkcoordinates1 = block.getBedSpawnPosition(par0World, c.posX, c.posY, c.posZ, null); +- ChunkCoordinates chunkcoordinates1 = BlockBed.func_149977_a(par0World, par1ChunkCoordinates.posX, par1ChunkCoordinates.posY, par1ChunkCoordinates.posZ, 0); ++ ChunkCoordinates chunkcoordinates1 = par0World.func_147439_a(par1ChunkCoordinates.posX, par1ChunkCoordinates.posY, par1ChunkCoordinates.posZ).getBedSpawnPosition(par0World, par1ChunkCoordinates.posX, par1ChunkCoordinates.posY, par1ChunkCoordinates.posZ, null); return chunkcoordinates1; } else -@@ -1566,10 +1690,13 @@ +@@ -1456,8 +1572,10 @@ { if (this.playerLocation != null) { - int i = this.worldObj.getBlockMetadata(this.playerLocation.posX, this.playerLocation.posY, this.playerLocation.posZ); -- int j = BlockBed.getDirection(i); +- int j = BlockBed.func_149895_l(i); + int x = playerLocation.posX; + int y = playerLocation.posY; + int z = playerLocation.posZ; -+ Block block = Block.blocksList[worldObj.getBlockId(x, y, z)]; -+ int i = (block == null ? 0 : block.getBedDirection(worldObj, x, y, z)); ++ int j = worldObj.func_147439_a(x, y, z).getBedDirection(worldObj, x, y, z); -- switch (j) -+ switch (i) + switch (j) { - case 0: - return 90.0F; -@@ -1635,21 +1762,52 @@ - /** - * Returns the location of the bed the player will respawn at, or null if the player has not slept in a bed. - */ +@@ -1516,19 +1634,26 @@ + public void func_146105_b(IChatComponent p_146105_1_) {} + + // JAVADOC METHOD $$ func_70997_bJ + @Deprecated public ChunkCoordinates getBedLocation() { @@ -432,33 +397,7 @@ + return isSpawnForced(this.dimension); } - /** -+ * A dimension aware version of getBedLocation. -+ * @param dimension The dimension to get the bed spawn for -+ * @return The player specific spawn location for the dimension. May be null. -+ */ -+ public ChunkCoordinates getBedLocation(int dimension) { -+ if (dimension == 0) return this.spawnChunk; -+ return this.spawnChunkMap.get(dimension); -+ } -+ -+ /** -+ * A dimension aware version of isSpawnForced. -+ * Noramally isSpawnForced is used to determine if the respawn system should check for a bed or not. -+ * This just extends that to be dimension aware. -+ * @param dimension The dimension to get whether to check for a bed before spawning for -+ * @return The player specific spawn location for the dimension. May be null. -+ */ -+ public boolean isSpawnForced(int dimension) { -+ if (dimension == 0) return this.spawnForced; -+ Boolean forced = this.spawnForcedMap.get(dimension); -+ if (forced == null) return false; -+ return forced; -+ } -+ -+ /** - * Defines a spawn coordinate to player spawn. Used by bed after the player sleep on it. - */ + // JAVADOC METHOD $$ func_71063_a public void setSpawnChunk(ChunkCoordinates par1ChunkCoordinates, boolean par2) { + if (this.dimension != 0) @@ -469,49 +408,7 @@ if (par1ChunkCoordinates != null) { this.spawnChunk = new ChunkCoordinates(par1ChunkCoordinates); -@@ -1661,8 +1819,40 @@ - this.spawnForced = false; - } - } -- - /** -+ * A dimension aware version of setSpawnChunk. -+ * This functions identically, but allows you to specify which dimension to affect, rather than affecting the player's current dimension. -+ * @param chunkCoordinates The spawn point to set as the player-specific spawn point for the dimension -+ * @param forced Whether or not the respawn code should check for a bed at this location (true means it won't check for a bed) -+ * @param dimension Which dimension to apply the player-specific respawn point to -+ */ -+ public void setSpawnChunk(ChunkCoordinates chunkCoordinates, boolean forced, int dimension) { -+ if (dimension == 0) -+ { -+ if (chunkCoordinates != null) -+ { -+ this.spawnChunk = new ChunkCoordinates(chunkCoordinates); -+ this.spawnForced = forced; -+ } -+ else -+ { -+ this.spawnChunk = null; -+ this.spawnForced = false; -+ } -+ return; -+ } -+ if (chunkCoordinates != null) -+ { -+ this.spawnChunkMap.put(dimension, new ChunkCoordinates(chunkCoordinates)); -+ this.spawnForcedMap.put(dimension, forced); -+ } -+ else -+ { -+ this.spawnChunkMap.remove(dimension); -+ this.spawnForcedMap.remove(dimension); -+ } -+ } -+ /** - * Will trigger the specified trigger. - */ - public void triggerAchievement(StatBase par1StatBase) -@@ -1843,6 +2033,10 @@ +@@ -1710,6 +1835,10 @@ super.fall(par1); } @@ -521,8 +418,8 @@ + } } - /** -@@ -1884,7 +2078,7 @@ + protected String func_146067_o(int p_146067_1_) +@@ -1757,7 +1886,7 @@ { if (par1ItemStack.getItem().requiresMultipleRenderPasses()) { @@ -530,35 +427,35 @@ + return par1ItemStack.getItem().getIcon(par1ItemStack, par2); } - if (this.itemInUse != null && par1ItemStack.itemID == Item.bow.itemID) -@@ -1906,6 +2100,7 @@ - return Item.bow.getItemIconForUseDuration(0); + if (this.itemInUse != null && par1ItemStack.getItem() == Items.bow) +@@ -1779,6 +1908,7 @@ + return Items.bow.getItemIconForUseDuration(0); } } -+ icon = par1ItemStack.getItem().getIcon(par1ItemStack, par2, this, itemInUse, itemInUseCount); ++ iicon = par1ItemStack.getItem().getIcon(par1ItemStack, par2, this, itemInUse, itemInUseCount); } - return icon; -@@ -2127,7 +2322,17 @@ - this.setScore(par1EntityPlayer.getScore()); + return iicon; +@@ -1967,6 +2097,17 @@ } + this.theInventoryEnderChest = par1EntityPlayer.theInventoryEnderChest; ++ + this.spawnChunkMap = par1EntityPlayer.spawnChunkMap; + this.spawnForcedMap = par1EntityPlayer.spawnForcedMap; - this.theInventoryEnderChest = par1EntityPlayer.theInventoryEnderChest; + + //Copy over a section of the Entity Data from the old player. + //Allows mods to specify data that persists after players respawn. + NBTTagCompound old = par1EntityPlayer.getEntityData(); + if (old.hasKey(PERSISTED_NBT_TAG)) + { -+ getEntityData().setCompoundTag(PERSISTED_NBT_TAG, old.getCompoundTag(PERSISTED_NBT_TAG)); ++ getEntityData().setTag(PERSISTED_NBT_TAG, old.getCompoundTag(PERSISTED_NBT_TAG)); + } } - /** -@@ -2191,7 +2396,14 @@ - */ + // JAVADOC METHOD $$ func_70041_e_ +@@ -2013,7 +2154,14 @@ + // JAVADOC METHOD $$ func_70062_b public void setCurrentItemOrArmor(int par1, ItemStack par2ItemStack) { - this.inventory.armorInventory[par1] = par2ItemStack; @@ -572,23 +469,81 @@ + } } - @SideOnly(Side.CLIENT) -@@ -2245,7 +2457,7 @@ - */ - public String getTranslatedEntityName() - { -- return ScorePlayerTeam.formatPlayerName(this.getTeam(), this.username); -+ return ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getDisplayName()); - } + // JAVADOC METHOD $$ func_98034_c +@@ -2059,7 +2207,7 @@ - public void setAbsorptionAmount(float par1) -@@ -2267,4 +2479,39 @@ + public IChatComponent func_145748_c_() { +- ChatComponentText chatcomponenttext = new ChatComponentText(ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getCommandSenderName())); ++ ChatComponentText chatcomponenttext = new ChatComponentText(ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getDisplayName())); + chatcomponenttext.func_150256_b().func_150241_a(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/msg " + this.getCommandSenderName() + " ")); + return chatcomponenttext; + } +@@ -2096,6 +2244,101 @@ FMLNetworkHandler.openGui(this, mod, modGuiId, world, x, y, z); } -+ -+ /* ===================================== FORGE START =====================================*/ -+ + ++ /* ======================================== FORGE START =====================================*/ ++ /** ++ * A dimension aware version of getBedLocation. ++ * @param dimension The dimension to get the bed spawn for ++ * @return The player specific spawn location for the dimension. May be null. ++ */ ++ public ChunkCoordinates getBedLocation(int dimension) ++ { ++ return dimension == 0 ? spawnChunk : spawnChunkMap.get(dimension); ++ } ++ ++ /** ++ * A dimension aware version of isSpawnForced. ++ * Noramally isSpawnForced is used to determine if the respawn system should check for a bed or not. ++ * This just extends that to be dimension aware. ++ * @param dimension The dimension to get whether to check for a bed before spawning for ++ * @return The player specific spawn location for the dimension. May be null. ++ */ ++ public boolean isSpawnForced(int dimension) ++ { ++ if (dimension == 0) return this.spawnForced; ++ Boolean forced = this.spawnForcedMap.get(dimension); ++ return forced == null ? false : forced; ++ } ++ ++ /** ++ * A dimension aware version of setSpawnChunk. ++ * This functions identically, but allows you to specify which dimension to affect, rather than affecting the player's current dimension. ++ * @param chunkCoordinates The spawn point to set as the player-specific spawn point for the dimension ++ * @param forced Whether or not the respawn code should check for a bed at this location (true means it won't check for a bed) ++ * @param dimension Which dimension to apply the player-specific respawn point to ++ */ ++ public void setSpawnChunk(ChunkCoordinates chunkCoordinates, boolean forced, int dimension) ++ { ++ if (dimension == 0) ++ { ++ if (chunkCoordinates != null) ++ { ++ spawnChunk = new ChunkCoordinates(chunkCoordinates); ++ spawnForced = forced; ++ } ++ else ++ { ++ spawnChunk = null; ++ spawnForced = false; ++ } ++ return; ++ } ++ ++ if (chunkCoordinates != null) ++ { ++ spawnChunkMap.put(dimension, new ChunkCoordinates(chunkCoordinates)); ++ spawnForcedMap.put(dimension, forced); ++ } ++ else ++ { ++ spawnChunkMap.remove(dimension); ++ spawnForcedMap.remove(dimension); ++ } ++ } ++ + public float eyeHeight; + private String displayname; + @@ -609,7 +564,7 @@ + { + if(this.displayname == null) + { -+ this.displayname = ForgeEventFactory.getPlayerDisplayName(this, this.username); ++ this.displayname = ForgeEventFactory.getPlayerDisplayName(this, this.getCommandSenderName()); + } + return this.displayname; + } @@ -619,6 +574,10 @@ + */ + public void refreshDisplayName() + { -+ this.displayname = ForgeEventFactory.getPlayerDisplayName(this, this.username); ++ this.displayname = ForgeEventFactory.getPlayerDisplayName(this, this.getCommandSenderName()); + } - } ++ /* ======================================== FORGE END =====================================*/ ++ + public static enum EnumStatus + { + OK, diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch index e0a5845eb..678745ff7 100644 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch @@ -1,8 +1,8 @@ --- ../src-base/minecraft/net/minecraft/entity/player/EntityPlayerMP.java +++ ../src-work/minecraft/net/minecraft/entity/player/EntityPlayerMP.java -@@ -92,6 +92,12 @@ - import net.minecraft.world.WorldServer; - import net.minecraft.world.chunk.Chunk; +@@ -99,6 +99,12 @@ + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; +import net.minecraft.entity.item.EntityItem; +import net.minecraftforge.common.ForgeHooks; @@ -12,47 +12,39 @@ + public class EntityPlayerMP extends EntityPlayer implements ICrafting { - private String translator = "en_US"; -@@ -164,20 +170,15 @@ - super(par2World, par3Str); - par4ItemInWorldManager.thisPlayerMP = this; - this.theItemInWorldManager = par4ItemInWorldManager; -- this.renderDistance = par1MinecraftServer.getConfigurationManager().getViewDistance(); -- ChunkCoordinates chunkcoordinates = par2World.getSpawnPoint(); -+ if (par1MinecraftServer == null) //ToDo: Remove this in 1.7, Fake players shouldn't be used purely client side. -+ this.renderDistance = 0; -+ else -+ this.renderDistance = par1MinecraftServer.getConfigurationManager().getViewDistance(); -+ ChunkCoordinates chunkcoordinates = par2World.provider.getRandomizedSpawnPoint(); + private static final Logger field_147102_bM = LogManager.getLogger(); +@@ -148,19 +154,11 @@ + p_i45285_4_.thisPlayerMP = this; + this.theItemInWorldManager = p_i45285_4_; + this.renderDistance = p_i45285_1_.getConfigurationManager().getViewDistance(); +- ChunkCoordinates chunkcoordinates = p_i45285_2_.getSpawnPoint(); ++ ChunkCoordinates chunkcoordinates = p_i45285_2_.provider.getRandomizedSpawnPoint(); int i = chunkcoordinates.posX; int j = chunkcoordinates.posZ; int k = chunkcoordinates.posY; -- if (!par2World.provider.hasNoSky && par2World.getWorldInfo().getGameType() != EnumGameType.ADVENTURE) +- if (!p_i45285_2_.provider.hasNoSky && p_i45285_2_.getWorldInfo().getGameType() != WorldSettings.GameType.ADVENTURE) - { -- int l = Math.max(5, par1MinecraftServer.getSpawnProtectionSize() - 6); +- int l = Math.max(5, p_i45285_1_.getSpawnProtectionSize() - 6); - i += this.rand.nextInt(l * 2) - l; - j += this.rand.nextInt(l * 2) - l; -- k = par2World.getTopSolidOrLiquidBlock(i, j); +- k = p_i45285_2_.getTopSolidOrLiquidBlock(i, j); - } - - this.mcServer = par1MinecraftServer; + this.mcServer = p_i45285_1_; + this.field_147103_bO = p_i45285_1_.getConfigurationManager().func_148538_i(this.getCommandSenderName()); this.stepHeight = 0.0F; - this.yOffset = 0.0F; -@@ -240,11 +241,6 @@ - this.yOffset = 0.0F; +@@ -218,7 +216,7 @@ + + public float getEyeHeight() + { +- return 1.62F; ++ return super.getEyeHeight(); } -- public float getEyeHeight() -- { -- return 1.62F; -- } -- - /** - * Called to update the entity's position/logic. - */ -@@ -254,7 +250,7 @@ - --this.initialInvulnerability; + // JAVADOC METHOD $$ func_70071_h_ +@@ -234,7 +232,7 @@ + this.openContainer.detectAndSendChanges(); - if (!this.worldObj.isRemote && !this.openContainer.canInteractWith(this)) @@ -60,32 +52,32 @@ { this.closeScreen(); this.openContainer = this.inventoryContainer; -@@ -290,7 +286,10 @@ - if (chunkcoordintpair != null && this.worldObj.blockExists(chunkcoordintpair.chunkXPos << 4, 0, chunkcoordintpair.chunkZPos << 4)) - { - arraylist.add(this.worldObj.getChunkFromChunkCoords(chunkcoordintpair.chunkXPos, chunkcoordintpair.chunkZPos)); -- arraylist1.addAll(((WorldServer)this.worldObj).getAllTileEntityInBox(chunkcoordintpair.chunkXPos * 16, 0, chunkcoordintpair.chunkZPos * 16, chunkcoordintpair.chunkXPos * 16 + 16, 256, chunkcoordintpair.chunkZPos * 16 + 16)); -+ //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. -+ //ToDo: Find a way to efficiently clean abandoned chunks. -+ //arraylist1.addAll(((WorldServer)this.worldObj).getAllTileEntityInBox(chunkcoordintpair.chunkXPos * 16, 0, chunkcoordintpair.chunkZPos * 16, chunkcoordintpair.chunkXPos * 16 + 16, 256, chunkcoordintpair.chunkZPos * 16 + 16)); -+ arraylist1.addAll(((WorldServer)this.worldObj).getAllTileEntityInBox(chunkcoordintpair.chunkXPos * 16, 0, chunkcoordintpair.chunkZPos * 16, chunkcoordintpair.chunkXPos * 16 + 15, 256, chunkcoordintpair.chunkZPos * 16 + 15)); - } - } +@@ -275,8 +273,9 @@ -@@ -311,6 +310,7 @@ + if (chunk.func_150802_k()) + { +- 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)); ++ arraylist.add(chunk); ++ arraylist1.addAll(((WorldServer)this.worldObj).func_147486_a(chunkcoordintpair.chunkXPos * 16, 0, chunkcoordintpair.chunkZPos * 16, chunkcoordintpair.chunkXPos * 16 + 15, 256, chunkcoordintpair.chunkZPos * 16 + 16)); ++ //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(); + } + } +@@ -304,6 +303,7 @@ { - Chunk chunk = (Chunk)iterator2.next(); + chunk = (Chunk)iterator2.next(); this.getServerForPlayer().getEntityTracker().func_85172_a(this, chunk); + MinecraftForge.EVENT_BUS.post(new ChunkWatchEvent.Watch(chunk.getChunkCoordIntPair(), this)); } } } -@@ -383,11 +383,25 @@ - */ +@@ -429,11 +429,25 @@ + // JAVADOC METHOD $$ func_70645_a public void onDeath(DamageSource par1DamageSource) { + if (ForgeHooks.onLivingDeath(this, par1DamageSource)) return; - this.mcServer.getConfigurationManager().sendChatMsg(this.func_110142_aN().func_94546_b()); + this.mcServer.getConfigurationManager().func_148539_a(this.func_110142_aN().func_151521_b()); if (!this.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory")) { @@ -105,14 +97,13 @@ + } } - Collection collection = this.worldObj.getScoreboard().func_96520_a(ScoreObjectiveCriteria.deathCount); -@@ -1054,4 +1068,16 @@ + Collection collection = this.worldObj.getScoreboard().func_96520_a(IScoreObjectiveCriteria.deathCount); +@@ -1034,4 +1048,15 @@ { - this.field_143005_bX = MinecraftServer.getSystemTimeMillis(); + return this.field_147103_bO; } -+ ++ + /* ===================================== FORGE START =====================================*/ -+ + /** + * Returns the default eye height of the player + * @return player default eye height diff --git a/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch index f5976d07c..46d613b9e 100644 --- a/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch @@ -1,17 +1,17 @@ --- ../src-base/minecraft/net/minecraft/entity/player/InventoryPlayer.java +++ ../src-work/minecraft/net/minecraft/entity/player/InventoryPlayer.java -@@ -359,6 +359,14 @@ +@@ -324,6 +324,14 @@ this.mainInventory[i].updateAnimation(this.player.worldObj, this.player, i, this.currentItem == i); } } + -+ for (int i = 0; i < this.armorInventory.length; i++) ++ for (int i = 0; i < armorInventory.length; i++) + { -+ if (this.armorInventory[i] != null) ++ if (armorInventory[i] != null) + { -+ this.armorInventory[i].getItem().onArmorTickUpdate(this.player.worldObj, this.player, this.armorInventory[i]); ++ armorInventory[i].getItem().onArmorTick(player.worldObj, player, armorInventory[i]); + } + } } - /** + public boolean func_146026_a(Item p_146026_1_) 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 000000000..a7789d7bb --- /dev/null +++ b/patches/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch @@ -0,0 +1,28 @@ +--- ../src-base/minecraft/net/minecraft/inventory/ContainerBrewingStand.java ++++ ../src-work/minecraft/net/minecraft/inventory/ContainerBrewingStand.java +@@ -5,6 +5,7 @@ + import net.minecraft.entity.player.EntityPlayer; + import net.minecraft.entity.player.InventoryPlayer; + import net.minecraft.init.Items; ++import net.minecraft.item.ItemPotion; + import net.minecraft.item.ItemStack; + import net.minecraft.stats.AchievementList; + import net.minecraft.tileentity.TileEntityBrewingStand; +@@ -203,7 +204,7 @@ + + public void onPickupFromSlot(EntityPlayer par1EntityPlayer, ItemStack par2ItemStack) + { +- if (par2ItemStack.getItem() == Items.potionitem && par2ItemStack.getItemDamage() > 0) ++ if (par2ItemStack.getItem() instanceof ItemPotion && par2ItemStack.getItemDamage() > 0) + { + this.player.addStat(AchievementList.potion, 1); + } +@@ -214,7 +215,7 @@ + // JAVADOC METHOD $$ func_75243_a_ + public static boolean canHoldPotion(ItemStack par0ItemStack) + { +- return par0ItemStack != null && (par0ItemStack.getItem() == Items.potionitem || par0ItemStack.getItem() == Items.glass_bottle); ++ return par0ItemStack != null && (par0ItemStack.getItem() instanceof ItemPotion || par0ItemStack.getItem() == Items.glass_bottle); + } + } + } diff --git a/patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch index 1ffa06a95..4276a50fc 100644 --- a/patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch +++ b/patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch @@ -1,14 +1,14 @@ --- ../src-base/minecraft/net/minecraft/inventory/ContainerEnchantment.java +++ ../src-work/minecraft/net/minecraft/inventory/ContainerEnchantment.java @@ -12,6 +12,7 @@ - import net.minecraft.item.Item; + import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import net.minecraftforge.common.ForgeHooks; public class ContainerEnchantment extends Container { -@@ -109,6 +110,7 @@ +@@ -125,6 +126,7 @@ { i = 0; int j; @@ -16,40 +16,40 @@ for (j = -1; j <= 1; ++j) { -@@ -116,37 +118,15 @@ +@@ -132,37 +134,15 @@ { - if ((j != 0 || k != 0) && this.worldPointer.isAirBlock(this.posX + k, this.posY, this.posZ + j) && this.worldPointer.isAirBlock(this.posX + k, this.posY + 1, this.posZ + j)) + if ((j != 0 || k != 0) && this.worldPointer.func_147437_c(this.posX + k, this.posY, this.posZ + j) && this.worldPointer.func_147437_c(this.posX + k, this.posY + 1, this.posZ + j)) { -- if (this.worldPointer.getBlockId(this.posX + k * 2, this.posY, this.posZ + j * 2) == Block.bookShelf.blockID) +- if (this.worldPointer.func_147439_a(this.posX + k * 2, this.posY, this.posZ + j * 2) == Blocks.bookshelf) - { - ++i; - } + power += ForgeHooks.getEnchantPower(worldPointer, posX + k * 2, posY, posZ + j * 2); + power += ForgeHooks.getEnchantPower(worldPointer, posX + k * 2, posY + 1, posZ + j * 2); -- if (this.worldPointer.getBlockId(this.posX + k * 2, this.posY + 1, this.posZ + j * 2) == Block.bookShelf.blockID) +- if (this.worldPointer.func_147439_a(this.posX + k * 2, this.posY + 1, this.posZ + j * 2) == Blocks.bookshelf) - { - ++i; - } - if (k != 0 && j != 0) { -- if (this.worldPointer.getBlockId(this.posX + k * 2, this.posY, this.posZ + j) == Block.bookShelf.blockID) +- if (this.worldPointer.func_147439_a(this.posX + k * 2, this.posY, this.posZ + j) == Blocks.bookshelf) - { - ++i; - } - -- if (this.worldPointer.getBlockId(this.posX + k * 2, this.posY + 1, this.posZ + j) == Block.bookShelf.blockID) +- if (this.worldPointer.func_147439_a(this.posX + k * 2, this.posY + 1, this.posZ + j) == Blocks.bookshelf) - { - ++i; - } - -- if (this.worldPointer.getBlockId(this.posX + k, this.posY, this.posZ + j * 2) == Block.bookShelf.blockID) +- if (this.worldPointer.func_147439_a(this.posX + k, this.posY, this.posZ + j * 2) == Blocks.bookshelf) - { - ++i; - } - -- if (this.worldPointer.getBlockId(this.posX + k, this.posY + 1, this.posZ + j * 2) == Block.bookShelf.blockID) +- if (this.worldPointer.func_147439_a(this.posX + k, this.posY + 1, this.posZ + j * 2) == Blocks.bookshelf) - { - ++i; - } @@ -60,7 +60,7 @@ } } } -@@ -154,7 +134,7 @@ +@@ -170,7 +150,7 @@ for (j = 0; j < 3; ++j) { diff --git a/patches/minecraft/net/minecraft/inventory/ContainerFurnace.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerFurnace.java.patch deleted file mode 100644 index 5a130d68b..000000000 --- a/patches/minecraft/net/minecraft/inventory/ContainerFurnace.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/ContainerFurnace.java -+++ ../src-work/minecraft/net/minecraft/inventory/ContainerFurnace.java -@@ -125,7 +125,7 @@ - } - else if (par2 != 1 && par2 != 0) - { -- if (FurnaceRecipes.smelting().getSmeltingResult(itemstack1.getItem().itemID) != null) -+ if (FurnaceRecipes.smelting().getSmeltingResult(itemstack1) != null) - { - if (!this.mergeItemStack(itemstack1, 0, 1, false)) - { 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 000000000..8b31610a8 --- /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 +@@ -52,7 +52,8 @@ + // JAVADOC METHOD $$ func_75214_a + public boolean isItemValid(ItemStack par1ItemStack) + { +- return par1ItemStack == null ? false : (par1ItemStack.getItem() instanceof ItemArmor ? ((ItemArmor)par1ItemStack.getItem()).armorType == k : (par1ItemStack.getItem() != Item.func_150898_a(Blocks.pumpkin) && par1ItemStack.getItem() != Items.skull ? false : k == 0)); ++ if (par1ItemStack == null) return false; ++ return par1ItemStack.getItem().isValidArmor(par1ItemStack, k, thePlayer); + } + // JAVADOC METHOD $$ func_75212_b + @SideOnly(Side.CLIENT) diff --git a/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch index e6a3d5411..9a1f56a04 100644 --- a/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch +++ b/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch @@ -1,22 +1,11 @@ --- ../src-base/minecraft/net/minecraft/inventory/ContainerRepair.java +++ ../src-work/minecraft/net/minecraft/inventory/ContainerRepair.java -@@ -315,6 +315,11 @@ - k = Math.max(1, k / 2); +@@ -383,6 +383,8 @@ + k2 = Math.max(1, k2 / 2); } -+ if (flag && itemstack1!=null && !Item.itemsList[itemstack1.itemID].isBookEnchantable(itemstack1,itemstack2)) -+ { -+ itemstack1 = null; -+ } ++ if (flag && !itemstack1.getItem().isBookEnchantable(itemstack1, itemstack2)) itemstack1 = null; + - this.maximumCost = k + i; + this.maximumCost = k2 + i; if (i <= 0) -@@ -332,6 +337,7 @@ - itemstack1 = null; - } - -+ - if (itemstack1 != null) - { - i1 = itemstack1.getRepairCost(); diff --git a/patches/minecraft/net/minecraft/inventory/Slot.java.patch b/patches/minecraft/net/minecraft/inventory/Slot.java.patch index 2b621b672..0a7259c24 100644 --- a/patches/minecraft/net/minecraft/inventory/Slot.java.patch +++ b/patches/minecraft/net/minecraft/inventory/Slot.java.patch @@ -7,17 +7,17 @@ +import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; - import net.minecraft.util.Icon; + import net.minecraft.util.IIcon; +import net.minecraft.util.ResourceLocation; public class Slot { -@@ -23,6 +25,13 @@ - /** display position of the inventory slot on the screen y axis */ +@@ -20,6 +22,13 @@ public int yDisplayPosition; + private static final String __OBFID = "CL_00001762"; + /** Position within background texture file, normally -1 which causes no background to be drawn. */ -+ protected Icon backgroundIcon = null; ++ protected IIcon backgroundIcon = null; + + /** Background texture file assigned to this slot, if any. Vanilla "/gui/items.png" is used if this is null. */ + @SideOnly(Side.CLIENT) @@ -26,20 +26,21 @@ public Slot(IInventory par1IInventory, int par2, int par3, int par4) { this.inventory = par1IInventory; -@@ -148,7 +157,7 @@ - */ - public Icon getBackgroundIconIndex() +@@ -115,7 +124,7 @@ + @SideOnly(Side.CLIENT) + public IIcon getBackgroundIconIndex() { - return null; + return backgroundIcon; } @SideOnly(Side.CLIENT) -@@ -156,4 +165,44 @@ +@@ -123,4 +132,46 @@ { return true; } + ++ /*========================================= FORGE START =====================================*/ + /** + * Gets the path of the texture file to use for the background image of this slot when drawing the GUI. + * @return String: The texture file that will be used in GuiContainer.drawSlotInventory for the slot background. @@ -54,7 +55,7 @@ + * Sets which icon index to use as the background image of the slot when it's empty. + * @param icon The icon to use, null for none + */ -+ public void setBackgroundIcon(Icon icon) ++ public void setBackgroundIcon(IIcon icon) + { + backgroundIcon = icon; + } @@ -79,4 +80,5 @@ + { + return slotIndex; + } ++ /*========================================= FORGE END =====================================*/ } diff --git a/patches/minecraft/net/minecraft/inventory/SlotArmor.java.patch b/patches/minecraft/net/minecraft/inventory/SlotArmor.java.patch deleted file mode 100644 index 05bf3b8da..000000000 --- a/patches/minecraft/net/minecraft/inventory/SlotArmor.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/SlotArmor.java -+++ ../src-work/minecraft/net/minecraft/inventory/SlotArmor.java -@@ -41,7 +41,8 @@ - */ - public boolean isItemValid(ItemStack par1ItemStack) - { -- return par1ItemStack == null ? false : (par1ItemStack.getItem() instanceof ItemArmor ? ((ItemArmor)par1ItemStack.getItem()).armorType == this.armorType : (par1ItemStack.getItem().itemID != Block.pumpkin.blockID && par1ItemStack.getItem().itemID != Item.skull.itemID ? false : this.armorType == 0)); -+ Item item = (par1ItemStack == null ? null : par1ItemStack.getItem()); -+ return item != null && item.isValidArmor(par1ItemStack, armorType, parent.thePlayer); - } - - @SideOnly(Side.CLIENT) diff --git a/patches/minecraft/net/minecraft/inventory/SlotBrewingStandIngredient.java.patch b/patches/minecraft/net/minecraft/inventory/SlotBrewingStandIngredient.java.patch deleted file mode 100644 index a96cb9f41..000000000 --- a/patches/minecraft/net/minecraft/inventory/SlotBrewingStandIngredient.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/SlotBrewingStandIngredient.java -+++ ../src-work/minecraft/net/minecraft/inventory/SlotBrewingStandIngredient.java -@@ -19,7 +19,7 @@ - */ - public boolean isItemValid(ItemStack par1ItemStack) - { -- return par1ItemStack != null ? Item.itemsList[par1ItemStack.itemID].isPotionIngredient() : false; -+ return par1ItemStack != null ? Item.itemsList[par1ItemStack.itemID].isPotionIngredient(par1ItemStack) : false; - } - - /** diff --git a/patches/minecraft/net/minecraft/inventory/SlotBrewingStandPotion.java.patch b/patches/minecraft/net/minecraft/inventory/SlotBrewingStandPotion.java.patch deleted file mode 100644 index 2c609514c..000000000 --- a/patches/minecraft/net/minecraft/inventory/SlotBrewingStandPotion.java.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/SlotBrewingStandPotion.java -+++ ../src-work/minecraft/net/minecraft/inventory/SlotBrewingStandPotion.java -@@ -2,6 +2,7 @@ - - import net.minecraft.entity.player.EntityPlayer; - import net.minecraft.item.Item; -+import net.minecraft.item.ItemPotion; - import net.minecraft.item.ItemStack; - import net.minecraft.stats.AchievementList; - -@@ -35,7 +36,7 @@ - - public void onPickupFromSlot(EntityPlayer par1EntityPlayer, ItemStack par2ItemStack) - { -- if (par2ItemStack.itemID == Item.potion.itemID && par2ItemStack.getItemDamage() > 0) -+ if (par2ItemStack.getItem() instanceof ItemPotion && par2ItemStack.getItemDamage() > 0) - { - this.player.addStat(AchievementList.potion, 1); - } -@@ -48,6 +49,6 @@ - */ - public static boolean canHoldPotion(ItemStack par0ItemStack) - { -- return par0ItemStack != null && (par0ItemStack.itemID == Item.potion.itemID || par0ItemStack.itemID == Item.glassBottle.itemID); -+ return par0ItemStack != null && (par0ItemStack.getItem() instanceof ItemPotion || par0ItemStack.itemID == Item.glassBottle.itemID); - } - } diff --git a/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch b/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch index a84ac065c..04c5c256f 100644 --- a/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch +++ b/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch @@ -1,32 +1,27 @@ --- ../src-base/minecraft/net/minecraft/inventory/SlotCrafting.java +++ ../src-work/minecraft/net/minecraft/inventory/SlotCrafting.java -@@ -7,6 +7,10 @@ +@@ -10,6 +10,8 @@ import net.minecraft.item.ItemStack; + import net.minecraft.item.ItemSword; import net.minecraft.stats.AchievementList; - -+import net.minecraftforge.common.ForgeHooks; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; -+ + public class SlotCrafting extends Slot { - /** The craft matrix inventory linked to this result slot. */ -@@ -124,10 +128,16 @@ +@@ -124,8 +126,14 @@ if (itemstack1.getItem().hasContainerItem()) { - ItemStack itemstack2 = new ItemStack(itemstack1.getItem().getContainerItem()); -+ ItemStack itemstack2 = itemstack1.getItem().getContainerItemStack(itemstack1); ++ ItemStack itemstack2 = itemstack1.getItem().getContainerItem(itemstack1); -- if (!itemstack1.getItem().doesContainerItemLeaveCraftingGrid(itemstack1) || !this.thePlayer.inventory.addItemStackToInventory(itemstack2)) + if (itemstack2.isItemStackDamageable() && itemstack2.getItemDamage() > itemstack2.getMaxDamage()) - { ++ { + MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(thePlayer, itemstack2)); -+ itemstack2 = null; ++ continue; + } + -+ if (itemstack2 != null && (!itemstack1.getItem().doesContainerItemLeaveCraftingGrid(itemstack1) || !this.thePlayer.inventory.addItemStackToInventory(itemstack2))) -+ { + if (!itemstack1.getItem().doesContainerItemLeaveCraftingGrid(itemstack1) || !this.thePlayer.inventory.addItemStackToInventory(itemstack2)) + { if (this.craftMatrix.getStackInSlot(i) == null) - { - this.craftMatrix.setInventorySlotContents(i, itemstack2); diff --git a/patches/minecraft/net/minecraft/inventory/SlotFurnace.java.patch b/patches/minecraft/net/minecraft/inventory/SlotFurnace.java.patch deleted file mode 100644 index f40ad988c..000000000 --- a/patches/minecraft/net/minecraft/inventory/SlotFurnace.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/SlotFurnace.java -+++ ../src-work/minecraft/net/minecraft/inventory/SlotFurnace.java -@@ -69,7 +69,7 @@ - if (!this.thePlayer.worldObj.isRemote) - { - int i = this.field_75228_b; -- float f = FurnaceRecipes.smelting().getExperience(par1ItemStack.itemID); -+ float f = FurnaceRecipes.smelting().getExperience(par1ItemStack); - int j; - - if (f == 0.0F) diff --git a/patches/minecraft/net/minecraft/item/BehaviorDispenseArmor.java.patch b/patches/minecraft/net/minecraft/item/BehaviorDispenseArmor.java.patch deleted file mode 100644 index b503af410..000000000 --- a/patches/minecraft/net/minecraft/item/BehaviorDispenseArmor.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/BehaviorDispenseArmor.java -+++ ../src-work/minecraft/net/minecraft/item/BehaviorDispenseArmor.java -@@ -32,7 +32,7 @@ - int i1 = EntityLiving.getArmorPosition(par2ItemStack); - ItemStack itemstack1 = par2ItemStack.copy(); - itemstack1.stackSize = 1; -- entitylivingbase.setCurrentItemOrArmor(i1 - l, itemstack1); -+ entitylivingbase.setCurrentItemOrArmor(i1, itemstack1); //BUGFIX Forge: Vanilla bug fix associated with fixed setCurrentItemOrArmor indexs for players. - - if (entitylivingbase instanceof EntityLiving) - { diff --git a/patches/minecraft/net/minecraft/item/EnumArmorMaterial.java.patch b/patches/minecraft/net/minecraft/item/EnumArmorMaterial.java.patch deleted file mode 100644 index fe1a4c27e..000000000 --- a/patches/minecraft/net/minecraft/item/EnumArmorMaterial.java.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/EnumArmorMaterial.java -+++ ../src-work/minecraft/net/minecraft/item/EnumArmorMaterial.java -@@ -23,6 +23,9 @@ - /** Return the enchantability factor of the material */ - private int enchantability; - -+ //Added by forge for custom Armor materials. -+ public Item customCraftingMaterial = null; -+ - private EnumArmorMaterial(int par3, int[] par4ArrayOfInteger, int par5) - { - this.maxDamageFactor = par3; -@@ -61,6 +64,14 @@ - */ - public int getArmorCraftingMaterial() - { -- return this == CLOTH ? Item.leather.itemID : (this == CHAIN ? Item.ingotIron.itemID : (this == GOLD ? Item.ingotGold.itemID : (this == IRON ? Item.ingotIron.itemID : (this == DIAMOND ? Item.diamond.itemID : 0)))); -+ switch (this) -+ { -+ case CLOTH: return Item.leather.itemID; -+ case CHAIN: return Item.ingotIron.itemID; -+ case GOLD: return Item.ingotGold.itemID; -+ case IRON: return Item.ingotIron.itemID; -+ case DIAMOND: return Item.diamond.itemID; -+ default: return (customCraftingMaterial == null ? 0 : customCraftingMaterial.itemID); -+ } - } - } diff --git a/patches/minecraft/net/minecraft/item/EnumRarity.java.patch b/patches/minecraft/net/minecraft/item/EnumRarity.java.patch deleted file mode 100644 index e02018873..000000000 --- a/patches/minecraft/net/minecraft/item/EnumRarity.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/EnumRarity.java -+++ ../src-work/minecraft/net/minecraft/item/EnumRarity.java -@@ -1,9 +1,5 @@ - package net.minecraft.item; - --import cpw.mods.fml.relauncher.Side; --import cpw.mods.fml.relauncher.SideOnly; -- --@SideOnly(Side.CLIENT) - public enum EnumRarity - { - common(15, "Common"), diff --git a/patches/minecraft/net/minecraft/item/EnumToolMaterial.java.patch b/patches/minecraft/net/minecraft/item/EnumToolMaterial.java.patch deleted file mode 100644 index 8ccd20a4c..000000000 --- a/patches/minecraft/net/minecraft/item/EnumToolMaterial.java.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/EnumToolMaterial.java -+++ ../src-work/minecraft/net/minecraft/item/EnumToolMaterial.java -@@ -31,6 +31,9 @@ - /** Defines the natural enchantability factor of the material. */ - private final int enchantability; - -+ //Added by forge for custom Armor materials. -+ public Item customCraftingMaterial = null; -+ - private EnumToolMaterial(int par3, int par4, float par5, float par6, int par7) - { - this.harvestLevel = par3; -@@ -86,6 +89,14 @@ - */ - public int getToolCraftingMaterial() - { -- return this == WOOD ? Block.planks.blockID : (this == STONE ? Block.cobblestone.blockID : (this == GOLD ? Item.ingotGold.itemID : (this == IRON ? Item.ingotIron.itemID : (this == EMERALD ? Item.diamond.itemID : 0)))); -+ switch (this) -+ { -+ case WOOD: return Block.planks.blockID; -+ case STONE: return Block.cobblestone.blockID; -+ case GOLD: return Item.ingotGold.itemID; -+ case IRON: return Item.ingotIron.itemID; -+ case EMERALD: return Item.diamond.itemID; -+ default: return (customCraftingMaterial == null ? 0 : customCraftingMaterial.itemID); -+ } - } - } diff --git a/patches/minecraft/net/minecraft/item/Item.java.patch b/patches/minecraft/net/minecraft/item/Item.java.patch index 556dc57dc..089d41405 100644 --- a/patches/minecraft/net/minecraft/item/Item.java.patch +++ b/patches/minecraft/net/minecraft/item/Item.java.patch @@ -1,13 +1,26 @@ --- ../src-base/minecraft/net/minecraft/item/Item.java +++ ../src-work/minecraft/net/minecraft/item/Item.java -@@ -11,13 +11,18 @@ +@@ -7,10 +7,12 @@ + import cpw.mods.fml.common.registry.GameData; + import cpw.mods.fml.relauncher.Side; + import cpw.mods.fml.relauncher.SideOnly; ++import java.util.HashMap; + import java.util.HashSet; + import java.util.Iterator; + import java.util.List; + import java.util.Random; ++import java.util.Set; import java.util.UUID; import net.minecraft.block.Block; + import net.minecraft.block.BlockDirt; +@@ -27,13 +29,18 @@ + import net.minecraft.block.BlockWall; + import net.minecraft.block.BlockWood; import net.minecraft.block.material.Material; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.model.ModelBiped; - import net.minecraft.client.renderer.texture.IconRegister; + import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -16,55 +29,38 @@ import net.minecraft.entity.item.EntityPainting; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; + import net.minecraft.init.Blocks; + import net.minecraft.init.Items; import net.minecraft.potion.Potion; - import net.minecraft.potion.PotionHelper; - import net.minecraft.stats.StatList; -@@ -26,7 +31,9 @@ - import net.minecraft.util.MovingObjectPosition; +@@ -44,7 +51,10 @@ + import net.minecraft.util.RegistryNamespaced; import net.minecraft.util.StatCollector; import net.minecraft.util.Vec3; +import net.minecraft.util.WeightedRandomChestContent; import net.minecraft.world.World; +import net.minecraftforge.common.ChestGenHooks; ++import net.minecraftforge.common.util.EnumHelper; public class Item { -@@ -250,13 +257,16 @@ - /** The string associated with this Item's Icon. */ - protected String iconString; +@@ -462,6 +472,7 @@ + } -+ /** FORGE: To disable repair recipes. */ -+ protected boolean canRepair = true; -+ - public Item(int par1) - { - this.itemID = 256 + par1; - - if (itemsList[256 + par1] != null) - { -- System.out.println("CONFLICT @ " + par1); -+ System.out.println("CONFLICT @ " + par1 + " item slot already occupied by " + itemsList[256 + par1] + " while adding " + this); - } - - itemsList[256 + par1] = this; -@@ -334,6 +344,7 @@ - /** - * Returns the maximum size of the stack for a specific item. *Isn't this more a Set than a Get?* - */ + // JAVADOC METHOD $$ func_77639_j + @Deprecated public int getItemStackLimit() { return this.maxStackSize; -@@ -606,6 +617,7 @@ +@@ -660,6 +671,7 @@ } @SideOnly(Side.CLIENT) -+ @Deprecated //Render pass sensitive version below. ++ @Deprecated public boolean hasEffect(ItemStack par1ItemStack) { return par1ItemStack.isItemEnchanted(); -@@ -626,7 +638,7 @@ - */ +@@ -674,7 +686,7 @@ + // JAVADOC METHOD $$ func_77616_k public boolean isItemTool(ItemStack par1ItemStack) { - return this.getItemStackLimit() == 1 && this.isDamageable(); @@ -72,7 +68,7 @@ } protected MovingObjectPosition getMovingObjectPositionFromPlayer(World par1World, EntityPlayer par2EntityPlayer, boolean par3) -@@ -635,7 +647,7 @@ +@@ -683,7 +695,7 @@ float f1 = par2EntityPlayer.prevRotationPitch + (par2EntityPlayer.rotationPitch - par2EntityPlayer.prevRotationPitch) * f; float f2 = par2EntityPlayer.prevRotationYaw + (par2EntityPlayer.rotationYaw - par2EntityPlayer.prevRotationYaw) * f; double d0 = par2EntityPlayer.prevPosX + (par2EntityPlayer.posX - par2EntityPlayer.prevPosX) * (double)f; @@ -81,7 +77,7 @@ double d2 = par2EntityPlayer.prevPosZ + (par2EntityPlayer.posZ - par2EntityPlayer.prevPosZ) * (double)f; Vec3 vec3 = par1World.getWorldVec3Pool().getVecFromPool(d0, d1, d2); float f3 = MathHelper.cos(-f2 * 0.017453292F - (float)Math.PI); -@@ -645,6 +657,10 @@ +@@ -693,6 +705,10 @@ float f7 = f4 * f5; float f8 = f3 * f5; double d3 = 5.0D; @@ -90,14 +86,13 @@ + d3 = ((EntityPlayerMP)par2EntityPlayer).theItemInWorldManager.getBlockReachDistance(); + } Vec3 vec31 = vec3.addVector((double)f7 * d3, (double)f6 * d3, (double)f8 * d3); - return par1World.rayTraceBlocks_do_do(vec3, vec31, par3, !par3); + return par1World.func_147447_a(vec3, vec31, par3, !par3, false); } -@@ -753,4 +769,546 @@ - { - StatList.initStats(); +@@ -773,6 +789,532 @@ + return this.iconString == null ? "MISSING_ICON_ITEM_" + field_150901_e.func_148757_b(this) + "_" + this.unlocalizedName : this.iconString; } -+ -+ /* =========================================================== FORGE START ===============================================================*/ + ++ /* ======================================== FORGE START =====================================*/ + /** + * Called when a player drops the item into the world, + * returning false from this will prevent the item from @@ -135,11 +130,12 @@ + * @param metadata The items current metadata + * @return The damage strength + */ -+ public float getStrVsBlock(ItemStack itemstack, Block block, int metadata) ++ public float getDigSpeed(ItemStack itemstack, Block block, int metadata) + { -+ return getStrVsBlock(itemstack, block); ++ return func_150893_a(itemstack, block); + } + ++ protected boolean canRepair = true; + /** + * Called by CraftingManager to determine if an item is reparable. + * @return True if reparable @@ -182,7 +178,7 @@ + * @param player The Player using the item + * @param count The amount of time in tick the item has been used for continuously + */ -+ public void onUsingItemTick(ItemStack stack, EntityPlayer player, int count) ++ public void onUsingTick(ItemStack stack, EntityPlayer player, int count) + { + } + @@ -211,7 +207,7 @@ + * @param useRemaining The ticks remaining for the active item. + * @return The icon index + */ -+ public Icon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) ++ public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) + { + return getIcon(stack, renderPass); + } @@ -236,7 +232,7 @@ + * @param itemStack The current ItemStack + * @return The resulting ItemStack + */ -+ public ItemStack getContainerItemStack(ItemStack itemStack) ++ public ItemStack getContainerItem(ItemStack itemStack) + { + if (!hasContainerItem()) + { @@ -331,9 +327,9 @@ + * @param pass the multi-render pass + * @return the icon + */ -+ public Icon getIcon(ItemStack stack, int pass) ++ public IIcon getIcon(ItemStack stack, int pass) + { -+ return getIconFromDamageForRenderPass(stack.getItemDamage(), pass); ++ return getIconFromDamageForRenderPass(stack.getItemDamage(), pass); + } + + /** @@ -360,18 +356,18 @@ + * + * Should this item, when held, allow sneak-clicks to pass through to the underlying block? + * -+ * @param par2World -+ * @param par4 -+ * @param par5 -+ * @param par6 ++ * @param world The world ++ * @param x The X Position ++ * @param y The X Position ++ * @param z The X Position ++ * @param player The Player that is wielding the item + * @return + */ -+ public boolean shouldPassSneakingClickToBlock(World par2World, int par4, int par5, int par6) ++ public boolean doesSneakBypassUse(World world, int x, int y, int z, EntityPlayer player) + { + return false; + } + -+ + /** + * Called to tick armor in the armor slot. Override to do something + * @@ -379,7 +375,7 @@ + * @param player + * @param itemStack + */ -+ public void onArmorTickUpdate(World world, EntityPlayer player, ItemStack itemStack) ++ public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) + { + + } @@ -401,80 +397,25 @@ + + if (armorType == 0) + { -+ return itemID == Block.pumpkin.blockID || itemID == Item.skull.itemID; ++ return this == Item.func_150898_a(Blocks.pumpkin) || this == Items.skull; + } + + return false; + } + + /** -+ * ItemStack sensitive version of isPotionIngredient -+ * -+ * @param stack The item stack -+ * @return True if this stack can be used as a potion ingredient -+ */ -+ public boolean isPotionIngredient(ItemStack stack) -+ { -+ return isPotionIngredient(); -+ } -+ -+ /** -+ * ItemStack sensitive version of getPotionEffect -+ * -+ * @param stack The item stack -+ * @return A string containing the bit manipulation to apply the the potion. -+ */ -+ public String getPotionEffect(ItemStack stack) -+ { -+ return getPotionEffect(); -+ } -+ -+ /** + * Allow or forbid the specific book/item combination as an anvil enchant + * -+ * @param itemstack1 The item -+ * @param itemstack2 The book ++ * @param stack The item ++ * @param book The book + * @return if the enchantment is allowed + */ -+ public boolean isBookEnchantable(ItemStack itemstack1, ItemStack itemstack2) ++ public boolean isBookEnchantable(ItemStack stack, ItemStack book) + { + return true; + } + + /** -+ * An itemstack sensitive version of getDamageVsEntity - allows items to handle damage based on -+ * itemstack data, like tags. Falls back to getDamageVsEntity. -+ * -+ * @param par1Entity The entity being attacked (or the attacking mob, if it's a mob - vanilla bug?) -+ * @param itemStack The itemstack -+ * @return the damage -+ */ -+ @Deprecated //Need to find a new place to hook this -+ public float getDamageVsEntity(Entity par1Entity, ItemStack itemStack) -+ { -+ return 0.0F; //getDamageVsEntity(par1Entity); -+ } -+ -+ /** -+ * Called by RenderBiped and RenderPlayer to determine the armor texture that -+ * should be use for the currently equiped 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 equpt armor -+ * @param entity The entity wearing the armor -+ * @param slot The slot the armor is in -+ * @param layer The render layer, either 1 or 2, 2 is only used for CLOTH armor by default -+ * @return Path of texture to bind, or null to use default -+ */ -+ @Deprecated //Replaced with more useful version below -+ public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer) -+ { -+ return null; -+ } -+ -+ /** + * Called by RenderBiped and RenderPlayer to determine the armor texture that + * should be use for the currently equiped item. + * This will only be called on instances of ItemArmor. @@ -489,10 +430,9 @@ + */ + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) + { -+ return getArmorTexture(stack, entity, slot, (slot == 2 ? 2 : 1)); ++ return null; + } + -+ + /** + * Returns the font renderer used to render tooltips and overlays for this item. + * Returning null will use the standard font renderer. @@ -605,7 +545,7 @@ + stack.itemDamage = 0; + } + } -+ ++ + /** + * ItemStack sensitive version of {@link #canHarvestBlock(Block)} + * @param par1Block The block trying to harvest @@ -614,17 +554,16 @@ + */ + public boolean canHarvestBlock(Block par1Block, ItemStack itemStack) + { -+ return canHarvestBlock(par1Block); ++ return func_150897_b(par1Block); + } + -+ + /** + * Render Pass sensitive version of hasEffect() + */ + @SideOnly(Side.CLIENT) + public boolean hasEffect(ItemStack par1ItemStack, int pass) + { -+ return hasEffect(par1ItemStack) && (pass == 0 || itemID != Item.potion.itemID); ++ return hasEffect(par1ItemStack) && (pass == 0 || this == Items.potionitem); + } + + /** @@ -638,4 +577,74 @@ + { + return this.getItemStackLimit(); + } ++ ++ private HashMap toolClasses = new 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 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; ++ } ++ /* ======================================== FORGE END =====================================*/ ++ + public static enum ToolMaterial + { + WOOD(0, 59, 2.0F, 0.0F, 15), +@@ -793,6 +1335,9 @@ + + private static final String __OBFID = "CL_00000042"; + ++ //Added by forge for custom Tool materials. ++ public Item customCraftingMaterial = null; ++ + private ToolMaterial(int par3, int par4, float par5, float par6, int par7) + { + this.harvestLevel = par3; +@@ -834,7 +1379,15 @@ + + public Item func_150995_f() + { +- return this == WOOD ? Item.func_150898_a(Blocks.planks) : (this == STONE ? Item.func_150898_a(Blocks.cobblestone) : (this == GOLD ? Items.gold_ingot : (this == IRON ? Items.iron_ingot : (this == EMERALD ? Items.diamond : null)))); ++ switch (this) ++ { ++ case WOOD: return Item.func_150898_a(Blocks.planks); ++ case STONE: return Item.func_150898_a(Blocks.cobblestone); ++ case GOLD: return Items.gold_ingot; ++ case IRON: return Items.iron_ingot; ++ case EMERALD: return Items.diamond; ++ default: return customCraftingMaterial; ++ } + } + } } diff --git a/patches/minecraft/net/minecraft/item/ItemArmor.java.patch b/patches/minecraft/net/minecraft/item/ItemArmor.java.patch index 9430c052a..14e34af87 100644 --- a/patches/minecraft/net/minecraft/item/ItemArmor.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemArmor.java.patch @@ -1,11 +1,38 @@ --- ../src-base/minecraft/net/minecraft/item/ItemArmor.java +++ ../src-work/minecraft/net/minecraft/item/ItemArmor.java -@@ -218,7 +218,7 @@ +@@ -235,7 +235,7 @@ if (itemstack1 == null) { - par3EntityPlayer.setCurrentItemOrArmor(i, par1ItemStack.copy()); -+ par3EntityPlayer.setCurrentItemOrArmor(i + 1, par1ItemStack.copy()); //Forge: Vanilla bug fix associated with fixed setCurrentItemOrArmor indexs for players. ++ par3EntityPlayer.setCurrentItemOrArmor(i + 1, par1ItemStack.copy()); //Forge: Vanilla bug fix associated with fixed setCurrentItemOrArmor indexs for players. par1ItemStack.stackSize = 0; } +@@ -276,6 +276,9 @@ + + private static final String __OBFID = "CL_00001768"; + ++ //Added by forge for custom Armor materials. ++ public Item customCraftingMaterial = null; ++ + private ArmorMaterial(int par3, int[] par4ArrayOfInteger, int par5) + { + this.maxDamageFactor = par3; +@@ -303,7 +306,15 @@ + + public Item func_151685_b() + { +- return this == CLOTH ? 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 CLOTH: 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; ++ } + } + } + } diff --git a/patches/minecraft/net/minecraft/item/ItemBlock.java.patch b/patches/minecraft/net/minecraft/item/ItemBlock.java.patch index ea8e6458d..85eb89922 100644 --- a/patches/minecraft/net/minecraft/item/ItemBlock.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemBlock.java.patch @@ -1,43 +1,41 @@ --- ../src-base/minecraft/net/minecraft/item/ItemBlock.java +++ ../src-work/minecraft/net/minecraft/item/ItemBlock.java -@@ -64,7 +64,8 @@ +@@ -54,7 +54,7 @@ { par7 = 1; } -- else if (i1 != Block.vine.blockID && i1 != Block.tallGrass.blockID && i1 != Block.deadBush.blockID) -+ else if (i1 != Block.vine.blockID && i1 != Block.tallGrass.blockID && i1 != Block.deadBush.blockID -+ && (Block.blocksList[i1] == null || !Block.blocksList[i1].isBlockReplaceable(par3World, par4, par5, par6))) +- else if (block != Blocks.vine && block != Blocks.tallgrass && block != Blocks.deadbush) ++ else if (block != Blocks.vine && block != Blocks.tallgrass && block != Blocks.deadbush && block.isReplaceable(par3World, par4, par5, par6)) { if (par7 == 0) { -@@ -115,14 +116,8 @@ - int j1 = this.getMetadata(par1ItemStack.getItemDamage()); - int k1 = Block.blocksList[this.blockID].onBlockPlaced(par3World, par4, par5, par6, par7, par8, par9, par10, j1); +@@ -104,14 +104,8 @@ + int i1 = this.getMetadata(par1ItemStack.getItemDamage()); + int j1 = this.field_150939_a.func_149660_a(par3World, par4, par5, par6, par7, par8, par9, par10, i1); -- if (par3World.setBlock(par4, par5, par6, this.blockID, k1, 3)) -+ if (placeBlockAt(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10, k1)) +- if (par3World.func_147465_d(par4, par5, par6, this.field_150939_a, j1, 3)) ++ if (placeBlockAt(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10, j1)) { -- if (par3World.getBlockId(par4, par5, par6) == this.blockID) +- if (par3World.func_147439_a(par4, par5, par6) == this.field_150939_a) - { -- Block.blocksList[this.blockID].onBlockPlacedBy(par3World, par4, par5, par6, par2EntityPlayer, par1ItemStack); -- Block.blocksList[this.blockID].onPostBlockPlaced(par3World, par4, par5, par6, k1); +- this.field_150939_a.func_149689_a(par3World, par4, par5, par6, par2EntityPlayer, par1ItemStack); +- this.field_150939_a.func_149714_e(par3World, par4, par5, par6, j1); - } - - par3World.playSoundEffect((double)((float)par4 + 0.5F), (double)((float)par5 + 0.5F), (double)((float)par6 + 0.5F), block.stepSound.getPlaceSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F); + par3World.playSoundEffect((double)((float)par4 + 0.5F), (double)((float)par5 + 0.5F), (double)((float)par6 + 0.5F), this.field_150939_a.field_149762_H.func_150496_b(), (this.field_150939_a.field_149762_H.func_150497_c() + 1.0F) / 2.0F, this.field_150939_a.field_149762_H.func_150494_d() * 0.8F); --par1ItemStack.stackSize; } -@@ -148,7 +143,8 @@ +@@ -133,7 +127,7 @@ { - par5 = 1; + p_150936_5_ = 1; } -- else if (i1 != Block.vine.blockID && i1 != Block.tallGrass.blockID && i1 != Block.deadBush.blockID) -+ else if (i1 != Block.vine.blockID && i1 != Block.tallGrass.blockID && i1 != Block.deadBush.blockID -+ && (Block.blocksList[i1] == null || !Block.blocksList[i1].isBlockReplaceable(par1World, par2, par3, par4))) +- else if (block != Blocks.vine && block != Blocks.tallgrass && block != Blocks.deadbush) ++ else if (block != Blocks.vine && block != Blocks.tallgrass && block != Blocks.deadbush && block.isReplaceable(p_150936_1_, p_150936_2_, p_150936_3_, p_150936_4_)) { - if (par5 == 0) + if (p_150936_5_ == 0) { -@@ -231,4 +227,28 @@ - this.field_94588_b = par1IconRegister.registerIcon(s); +@@ -204,4 +198,29 @@ + this.field_150938_b = par1IconRegister.registerIcon(s); } } + @@ -51,15 +49,16 @@ + */ + public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) + { -+ if (!world.setBlock(x, y, z, this.blockID, metadata, 3)) ++ ++ if (!world.func_147465_d(x, y, z, field_150939_a, metadata, 3)) + { + return false; + } + -+ if (world.getBlockId(x, y, z) == this.blockID) ++ if (world.func_147439_a(x, y, z) == field_150939_a) + { -+ Block.blocksList[this.blockID].onBlockPlacedBy(world, x, y, z, player, stack); -+ Block.blocksList[this.blockID].onPostBlockPlaced(world, x, y, z, metadata); ++ field_150939_a.func_149689_a(world, x, y, z, player, stack); ++ field_150939_a.func_149714_e(world, x, y, z, metadata); + } + + return true; diff --git a/patches/minecraft/net/minecraft/item/ItemBow.java.patch b/patches/minecraft/net/minecraft/item/ItemBow.java.patch index 83aeafb8c..d90339834 100644 --- a/patches/minecraft/net/minecraft/item/ItemBow.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemBow.java.patch @@ -1,18 +1,17 @@ --- ../src-base/minecraft/net/minecraft/item/ItemBow.java +++ ../src-work/minecraft/net/minecraft/item/ItemBow.java -@@ -11,6 +11,10 @@ - import net.minecraft.util.Icon; +@@ -11,6 +11,9 @@ + import net.minecraft.init.Items; + import net.minecraft.util.IIcon; import net.minecraft.world.World; - +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.entity.player.ArrowLooseEvent; +import net.minecraftforge.event.entity.player.ArrowNockEvent; -+ + public class ItemBow extends Item { - public static final String[] bowPullIconNameArray = new String[] {"pulling_0", "pulling_1", "pulling_2"}; -@@ -30,11 +34,20 @@ - */ +@@ -29,11 +32,20 @@ + // JAVADOC METHOD $$ func_77615_a public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4) { + int j = this.getMaxItemUseDuration(par1ItemStack) - par4; @@ -27,14 +26,14 @@ + boolean flag = par3EntityPlayer.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, par1ItemStack) > 0; - if (flag || par3EntityPlayer.inventory.hasItem(Item.arrow.itemID)) + if (flag || par3EntityPlayer.inventory.func_146028_b(Items.arrow)) { - int j = this.getMaxItemUseDuration(par1ItemStack) - par4; float f = (float)j / 20.0F; f = (f * f + f * 2.0F) / 3.0F; -@@ -119,6 +132,13 @@ - */ +@@ -112,6 +124,13 @@ + // JAVADOC METHOD $$ func_77659_a public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + ArrowNockEvent event = new ArrowNockEvent(par3EntityPlayer, par1ItemStack); @@ -44,6 +43,6 @@ + return event.result; + } + - if (par3EntityPlayer.capabilities.isCreativeMode || par3EntityPlayer.inventory.hasItem(Item.arrow.itemID)) + if (par3EntityPlayer.capabilities.isCreativeMode || par3EntityPlayer.inventory.func_146028_b(Items.arrow)) { par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack)); diff --git a/patches/minecraft/net/minecraft/item/ItemBucket.java.patch b/patches/minecraft/net/minecraft/item/ItemBucket.java.patch index 97226f108..3be8a33ed 100644 --- a/patches/minecraft/net/minecraft/item/ItemBucket.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemBucket.java.patch @@ -1,17 +1,16 @@ --- ../src-base/minecraft/net/minecraft/item/ItemBucket.java +++ ../src-work/minecraft/net/minecraft/item/ItemBucket.java -@@ -8,6 +8,10 @@ +@@ -8,6 +8,9 @@ + import net.minecraft.init.Items; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; - ++import cpw.mods.fml.common.eventhandler.Event; +import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.Event; +import net.minecraftforge.event.entity.player.FillBucketEvent; -+ + public class ItemBucket extends Item { - /** field for checking if the bucket has been filled. */ -@@ -35,6 +39,32 @@ +@@ -34,6 +37,31 @@ } else { @@ -35,12 +34,11 @@ + + if (!par3EntityPlayer.inventory.addItemStackToInventory(event.result)) + { -+ par3EntityPlayer.dropPlayerItem(event.result); ++ par3EntityPlayer.dropPlayerItemWithRandomChoice(event.result, false); + } + + return par1ItemStack; + } -+ - if (movingobjectposition.typeOfHit == EnumMovingObjectType.TILE) + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { int i = movingobjectposition.blockX; diff --git a/patches/minecraft/net/minecraft/item/ItemBucketMilk.java.patch b/patches/minecraft/net/minecraft/item/ItemBucketMilk.java.patch index a15935d93..defdbb569 100644 --- a/patches/minecraft/net/minecraft/item/ItemBucketMilk.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemBucketMilk.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/ItemBucketMilk.java +++ ../src-work/minecraft/net/minecraft/item/ItemBucketMilk.java -@@ -22,7 +22,7 @@ +@@ -24,7 +24,7 @@ if (!par2World.isRemote) { @@ -8,4 +8,4 @@ + par3EntityPlayer.curePotionEffects(par1ItemStack); } - return par1ItemStack.stackSize <= 0 ? new ItemStack(Item.bucketEmpty) : par1ItemStack; + return par1ItemStack.stackSize <= 0 ? new ItemStack(Items.bucket) : par1ItemStack; diff --git a/patches/minecraft/net/minecraft/item/ItemDye.java.patch b/patches/minecraft/net/minecraft/item/ItemDye.java.patch index c6d7a0b35..567d4e18e 100644 --- a/patches/minecraft/net/minecraft/item/ItemDye.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemDye.java.patch @@ -1,39 +1,46 @@ --- ../src-base/minecraft/net/minecraft/item/ItemDye.java +++ ../src-work/minecraft/net/minecraft/item/ItemDye.java -@@ -21,6 +21,12 @@ +@@ -1,5 +1,6 @@ + package net.minecraft.item; + ++import cpw.mods.fml.common.eventhandler.Event.Result; + import cpw.mods.fml.relauncher.Side; + import cpw.mods.fml.relauncher.SideOnly; + import java.util.List; +@@ -17,6 +18,10 @@ + import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; - -+import net.minecraftforge.common.FakePlayerFactory; -+import net.minecraftforge.common.ForgeHooks; ++import net.minecraft.world.WorldServer; +import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.Event.Result; ++import net.minecraftforge.common.util.FakePlayerFactory; +import net.minecraftforge.event.entity.player.BonemealEvent; -+ + public class ItemDye extends Item { - /** List of dye color names */ -@@ -73,7 +79,7 @@ +@@ -60,7 +65,7 @@ { if (par1ItemStack.getItemDamage() == 15) { -- if (func_96604_a(par1ItemStack, par3World, par4, par5, par6)) +- if (func_150919_a(par1ItemStack, par3World, par4, par5, par6)) + if (applyBonemeal(par1ItemStack, par3World, par4, par5, par6, par2EntityPlayer)) { if (!par3World.isRemote) { -@@ -141,8 +147,28 @@ +@@ -128,8 +133,30 @@ - public static boolean func_96604_a(ItemStack par0ItemStack, World par1World, int par2, int par3, int par4) + public static boolean func_150919_a(ItemStack p_150919_0_, World p_150919_1_, int p_150919_2_, int p_150919_3_, int p_150919_4_) { -+ return applyBonemeal(par0ItemStack, par1World, par2, par3, par4, FakePlayerFactory.getMinecraft(par1World)); ++ if (p_150919_1_ instanceof WorldServer) ++ return applyBonemeal(p_150919_0_, p_150919_1_, p_150919_2_, p_150919_3_, p_150919_4_, FakePlayerFactory.getMinecraft((WorldServer)p_150919_1_)); ++ return false; + } + -+ public static boolean applyBonemeal(ItemStack par0ItemStack, World par1World, int par2, int par3, int par4, EntityPlayer player) ++ public static boolean applyBonemeal(ItemStack p_150919_0_, World p_150919_1_, int p_150919_2_, int p_150919_3_, int p_150919_4_, EntityPlayer player) + { - int l = par1World.getBlockId(par2, par3, par4); + Block block = p_150919_1_.func_147439_a(p_150919_2_, p_150919_3_, p_150919_4_); -+ BonemealEvent event = new BonemealEvent(player, par1World, l, par2, par3, par4); ++ BonemealEvent event = new BonemealEvent(player, p_150919_1_, block, p_150919_2_, p_150919_3_, p_150919_4_); + if (MinecraftForge.EVENT_BUS.post(event)) + { + return false; @@ -41,50 +48,30 @@ + + if (event.getResult() == Result.ALLOW) + { -+ if (!par1World.isRemote) ++ if (!p_150919_1_.isRemote) + { -+ par0ItemStack.stackSize--; ++ p_150919_0_.stackSize--; + } + return true; + } + - if (l == Block.sapling.blockID) + if (block instanceof IGrowable) { - if (!par1World.isRemote) -@@ -244,17 +270,10 @@ - par1World.setBlock(j1, k1, l1, Block.tallGrass.blockID, 1, 3); - } - } -- else if (itemRand.nextInt(3) != 0) -+ else - { -- if (Block.plantYellow.canBlockStay(par1World, j1, k1, l1)) -- { -- par1World.setBlock(j1, k1, l1, Block.plantYellow.blockID); -- } -+ ForgeHooks.plantGrass(par1World, j1, k1, l1); - } -- else if (Block.plantRed.canBlockStay(par1World, j1, k1, l1)) -- { -- par1World.setBlock(j1, k1, l1, Block.plantRed.blockID); -- } - } - } - } -@@ -318,6 +337,16 @@ - par0World.spawnParticle("happyVillager", (double)((float)par1 + itemRand.nextFloat()), (double)par2 + (double)itemRand.nextFloat() * block.getBlockBoundsMaxY(), (double)((float)par3 + itemRand.nextFloat()), d0, d1, d2); + IGrowable igrowable = (IGrowable)block; +@@ -175,6 +202,16 @@ + p_150918_0_.spawnParticle("happyVillager", (double)((float)p_150918_1_ + itemRand.nextFloat()), (double)p_150918_2_ + (double)itemRand.nextFloat() * block.func_149669_A(), (double)((float)p_150918_3_ + itemRand.nextFloat()), d0, d1, d2); } } + else + { -+ for (int j1 = 0; j1 < par4; ++j1) ++ for (int i1 = 0; i1 < p_150918_4_; ++i1) + { + double d0 = itemRand.nextGaussian() * 0.02D; + double d1 = itemRand.nextGaussian() * 0.02D; + double d2 = itemRand.nextGaussian() * 0.02D; -+ par0World.spawnParticle("happyVillager", (double)((float)par1 + itemRand.nextFloat()), (double)par2 + (double)itemRand.nextFloat() * 1.0f, (double)((float)par3 + itemRand.nextFloat()), d0, d1, d2); ++ p_150918_0_.spawnParticle("happyVillager", (double)((float)p_150918_1_ + itemRand.nextFloat()), (double)p_150918_2_ + (double)itemRand.nextFloat() * 1.0f, (double)((float)p_150918_3_ + itemRand.nextFloat()), d0, d1, d2); + } + } } - /** + // JAVADOC METHOD $$ func_111207_a diff --git a/patches/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch b/patches/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch index c8ac11d4a..1f9b743fa 100644 --- a/patches/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch @@ -1,13 +1,11 @@ --- ../src-base/minecraft/net/minecraft/item/ItemFlintAndSteel.java +++ ../src-work/minecraft/net/minecraft/item/ItemFlintAndSteel.java -@@ -57,9 +57,7 @@ +@@ -56,7 +56,7 @@ } else { -- int i1 = par3World.getBlockId(par4, par5, par6); -- -- if (i1 == 0) -+ if (par3World.isAirBlock(par4, par5, par6)) +- if (par3World.func_147439_a(par4, par5, par6).func_149688_o() == Material.field_151579_a) ++ if (par3World.func_147437_c(par4, par5, par6)) { par3World.playSoundEffect((double)par4 + 0.5D, (double)par5 + 0.5D, (double)par6 + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); - par3World.setBlock(par4, par5, par6, Block.fire.blockID); + par3World.func_147449_b(par4, par5, par6, Blocks.fire); diff --git a/patches/minecraft/net/minecraft/item/ItemHoe.java.patch b/patches/minecraft/net/minecraft/item/ItemHoe.java.patch index b2cbb6961..c68247fe7 100644 --- a/patches/minecraft/net/minecraft/item/ItemHoe.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemHoe.java.patch @@ -1,16 +1,22 @@ --- ../src-base/minecraft/net/minecraft/item/ItemHoe.java +++ ../src-work/minecraft/net/minecraft/item/ItemHoe.java -@@ -6,6 +6,9 @@ - import net.minecraft.creativetab.CreativeTabs; +@@ -1,5 +1,6 @@ + package net.minecraft.item; + ++import cpw.mods.fml.common.eventhandler.Event.Result; + import cpw.mods.fml.relauncher.Side; + import cpw.mods.fml.relauncher.SideOnly; + import net.minecraft.block.Block; +@@ -8,6 +9,8 @@ import net.minecraft.entity.player.EntityPlayer; + import net.minecraft.init.Blocks; import net.minecraft.world.World; +import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.Event.Result; +import net.minecraftforge.event.entity.player.UseHoeEvent; public class ItemHoe extends Item { -@@ -32,10 +35,22 @@ +@@ -31,9 +34,21 @@ } else { @@ -26,12 +32,10 @@ + return true; + } + - int i1 = par3World.getBlockId(par4, par5, par6); -- int j1 = par3World.getBlockId(par4, par5 + 1, par6); -+ boolean air = par3World.isAirBlock(par4, par5 + 1, par6); + Block block = par3World.func_147439_a(par4, par5, par6); -- if (par7 != 0 && j1 == 0 && (i1 == Block.grass.blockID || i1 == Block.dirt.blockID)) -+ if (par7 != 0 && air && (i1 == Block.grass.blockID || i1 == Block.dirt.blockID)) +- if (par7 != 0 && par3World.func_147439_a(par4, par5 + 1, par6).func_149688_o() == Material.field_151579_a && (block == Blocks.grass || block == Blocks.dirt)) ++ if (par7 != 0 && par3World.func_147439_a(par4, par5 + 1, par6).isAir(par3World, par4, par5 + 1, par6) && (block == Blocks.grass || block == Blocks.dirt)) { - Block block = Block.tilledField; - par3World.playSoundEffect((double)((float)par4 + 0.5F), (double)((float)par5 + 0.5F), (double)((float)par6 + 0.5F), block.stepSound.getStepSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F); + Block block1 = Blocks.farmland; + par3World.playSoundEffect((double)((float)par4 + 0.5F), (double)((float)par5 + 0.5F), (double)((float)par6 + 0.5F), block1.field_149762_H.func_150498_e(), (block1.field_149762_H.func_150497_c() + 1.0F) / 2.0F, block1.field_149762_H.func_150494_d() * 0.8F); diff --git a/patches/minecraft/net/minecraft/item/ItemMap.java.patch b/patches/minecraft/net/minecraft/item/ItemMap.java.patch deleted file mode 100644 index 9e0093a31..000000000 --- a/patches/minecraft/net/minecraft/item/ItemMap.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemMap.java -+++ ../src-work/minecraft/net/minecraft/item/ItemMap.java -@@ -98,7 +98,7 @@ - boolean flag = k2 * k2 + l2 * l2 > (j1 - 2) * (j1 - 2); - int i3 = (j / i + k1 - short1 / 2) * i; - int j3 = (k / i + j2 - short2 / 2) * i; -- int[] aint = new int[256]; -+ int[] aint = new int[Block.blocksList.length]; - Chunk chunk = par1World.getChunkFromBlockCoords(i3, j3); - - if (!chunk.isEmpty()) -@@ -194,7 +194,7 @@ - j4 = 0; - k4 = 0; - -- for (l4 = 0; l4 < 256; ++l4) -+ for (l4 = 0; l4 < Block.blocksList.length; ++l4) - { - if (aint[l4] > j4) - { diff --git a/patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch b/patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch index ee004b998..43a232987 100644 --- a/patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch @@ -1,50 +1,48 @@ --- ../src-base/minecraft/net/minecraft/item/ItemSeedFood.java +++ ../src-work/minecraft/net/minecraft/item/ItemSeedFood.java -@@ -1,9 +1,13 @@ - package net.minecraft.item; +@@ -2,9 +2,13 @@ -+import net.minecraft.block.Block; + import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; ++import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraftforge.common.EnumPlantType; -+import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.IPlantable; ++import net.minecraftforge.common.util.ForgeDirection; -public class ItemSeedFood extends ItemFood +public class ItemSeedFood extends ItemFood implements IPlantable { - /** Block ID of the crop this seed food should place. */ - private int cropId; -@@ -31,8 +35,9 @@ + private Block field_150908_b; + // JAVADOC FIELD $$ field_82809_c +@@ -27,7 +31,7 @@ + } else if (par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack) && par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6, par7, par1ItemStack)) { - int i1 = par3World.getBlockId(par4, par5, par6); -+ Block soil = Block.blocksList[i1]; - -- if (i1 == this.soilId && par3World.isAirBlock(par4, par5 + 1, par6)) -+ if (soil != null && soil.canSustainPlant(par3World, par4, par5, par6, ForgeDirection.UP, this) && par3World.isAirBlock(par4, par5 + 1, par6)) +- if (par3World.func_147439_a(par4, par5, par6) == this.soilId && par3World.func_147437_c(par4, par5 + 1, par6)) ++ if (par3World.func_147439_a(par4, par5, par6).canSustainPlant(par3World, par4, par5, par6, ForgeDirection.UP, this) && par3World.func_147437_c(par4, par5 + 1, par6)) { - par3World.setBlock(par4, par5 + 1, par6, this.cropId); + par3World.func_147449_b(par4, par5 + 1, par6, this.field_150908_b); --par1ItemStack.stackSize; -@@ -48,4 +53,22 @@ +@@ -43,4 +47,22 @@ return false; } } + + @Override -+ public EnumPlantType getPlantType(World world, int x, int y, int z) ++ public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z) + { + return EnumPlantType.Crop; + } + + @Override -+ public int getPlantID(World world, int x, int y, int z) ++ public Block getPlant(IBlockAccess world, int x, int y, int z) + { -+ return cropId; ++ return field_150908_b; + } + + @Override -+ public int getPlantMetadata(World world, int x, int y, int z) ++ public int getPlantMetadata(IBlockAccess world, int x, int y, int z) + { + return 0; + } diff --git a/patches/minecraft/net/minecraft/item/ItemSeeds.java.patch b/patches/minecraft/net/minecraft/item/ItemSeeds.java.patch index 785de820a..858f3c439 100644 --- a/patches/minecraft/net/minecraft/item/ItemSeeds.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemSeeds.java.patch @@ -1,52 +1,49 @@ --- ../src-base/minecraft/net/minecraft/item/ItemSeeds.java +++ ../src-work/minecraft/net/minecraft/item/ItemSeeds.java -@@ -1,10 +1,15 @@ - package net.minecraft.item; - -+import net.minecraft.block.Block; +@@ -3,9 +3,14 @@ + import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; ++import net.minecraft.init.Blocks; ++import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; ++import net.minecraftforge.common.EnumPlantType; ++import net.minecraftforge.common.IPlantable; ++import net.minecraftforge.common.util.ForgeDirection; -public class ItemSeeds extends Item -+import net.minecraftforge.common.EnumPlantType; -+import net.minecraftforge.common.ForgeDirection; -+import net.minecraftforge.common.IPlantable; -+ +public class ItemSeeds extends Item implements IPlantable { - /** - * The type of block this seed turns into (wheat or pumpkin stems for instance) -@@ -35,8 +40,9 @@ + private Block field_150925_a; + // JAVADOC FIELD $$ field_77838_b +@@ -28,7 +33,7 @@ + } else if (par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack) && par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6, par7, par1ItemStack)) { - int i1 = par3World.getBlockId(par4, par5, par6); -+ Block soil = Block.blocksList[i1]; - -- if (i1 == this.soilBlockID && par3World.isAirBlock(par4, par5 + 1, par6)) -+ if (soil != null && soil.canSustainPlant(par3World, par4, par5, par6, ForgeDirection.UP, this) && par3World.isAirBlock(par4, par5 + 1, par6)) +- if (par3World.func_147439_a(par4, par5, par6) == this.soilBlockID && par3World.func_147437_c(par4, par5 + 1, par6)) ++ if (par3World.func_147439_a(par4, par5, par6).canSustainPlant(par3World, par4, par5, par6, ForgeDirection.UP, this) && par3World.func_147437_c(par4, par5 + 1, par6)) { - par3World.setBlock(par4, par5 + 1, par6, this.blockType); + par3World.func_147449_b(par4, par5 + 1, par6, this.field_150925_a); --par1ItemStack.stackSize; -@@ -52,4 +58,22 @@ +@@ -44,4 +49,22 @@ return false; } } + + @Override -+ public EnumPlantType getPlantType(World world, int x, int y, int z) ++ public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z) + { -+ return (blockType == Block.netherStalk.blockID ? EnumPlantType.Nether : EnumPlantType.Crop); ++ return field_150925_a == Blocks.nether_wart ? EnumPlantType.Nether : EnumPlantType.Crop; + } + + @Override -+ public int getPlantID(World world, int x, int y, int z) ++ public Block getPlant(IBlockAccess world, int x, int y, int z) + { -+ return blockType; ++ return field_150925_a; + } + + @Override -+ public int getPlantMetadata(World world, int x, int y, int z) ++ public int getPlantMetadata(IBlockAccess world, int x, int y, int z) + { + return 0; + } diff --git a/patches/minecraft/net/minecraft/item/ItemShears.java.patch b/patches/minecraft/net/minecraft/item/ItemShears.java.patch index e34f35745..d65ee9df6 100644 --- a/patches/minecraft/net/minecraft/item/ItemShears.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemShears.java.patch @@ -1,43 +1,44 @@ --- ../src-base/minecraft/net/minecraft/item/ItemShears.java +++ ../src-work/minecraft/net/minecraft/item/ItemShears.java -@@ -1,9 +1,19 @@ +@@ -1,11 +1,20 @@ package net.minecraft.item; +import java.util.ArrayList; +import java.util.Random; + import net.minecraft.block.Block; + import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentHelper; -+import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; + import net.minecraft.init.Blocks; +import net.minecraft.stats.StatList; import net.minecraft.world.World; +import net.minecraftforge.common.IShearable; public class ItemShears extends Item { -@@ -17,13 +27,12 @@ +@@ -20,13 +29,12 @@ - public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLivingBase par7EntityLivingBase) + public boolean func_150894_a(ItemStack p_150894_1_, World p_150894_2_, Block p_150894_3_, int p_150894_4_, int p_150894_5_, int p_150894_6_, EntityLivingBase p_150894_7_) { -- if (par3 != Block.leaves.blockID && par3 != Block.web.blockID && par3 != Block.tallGrass.blockID && par3 != Block.vine.blockID && par3 != Block.tripWire.blockID) -+ if (par3 != Block.leaves.blockID && par3 != Block.web.blockID && par3 != Block.tallGrass.blockID && par3 != Block.vine.blockID && par3 != Block.tripWire.blockID && !(Block.blocksList[par3] instanceof IShearable)) +- if (p_150894_3_.func_149688_o() != Material.field_151584_j && p_150894_3_ != Blocks.web && p_150894_3_ != Blocks.tallgrass && p_150894_3_ != Blocks.vine && p_150894_3_ != Blocks.tripwire) ++ if (p_150894_3_.func_149688_o() != Material.field_151584_j && p_150894_3_ != Blocks.web && p_150894_3_ != Blocks.tallgrass && p_150894_3_ != Blocks.vine && p_150894_3_ != Blocks.tripwire && !(p_150894_3_ instanceof IShearable)) { - return super.onBlockDestroyed(par1ItemStack, par2World, par3, par4, par5, par6, par7EntityLivingBase); + return super.func_150894_a(p_150894_1_, p_150894_2_, p_150894_3_, p_150894_4_, p_150894_5_, p_150894_6_, p_150894_7_); } else { -- par1ItemStack.damageItem(1, par7EntityLivingBase); +- p_150894_1_.damageItem(1, p_150894_7_); return true; } } -@@ -44,4 +53,69 @@ +@@ -40,4 +48,69 @@ { - return par2Block.blockID != Block.web.blockID && par2Block.blockID != Block.leaves.blockID ? (par2Block.blockID == Block.cloth.blockID ? 5.0F : super.getStrVsBlock(par1ItemStack, par2Block)) : 15.0F; + return p_150893_2_ != Blocks.web && p_150893_2_.func_149688_o() != Material.field_151584_j ? (p_150893_2_ == Blocks.wool ? 5.0F : super.func_150893_a(p_150893_1_, p_150893_2_)) : 15.0F; } + + @Override @@ -77,10 +78,10 @@ + { + return false; + } -+ int id = player.worldObj.getBlockId(x, y, z); -+ if (Block.blocksList[id] instanceof IShearable) ++ Block block = player.worldObj.func_147439_a(x, y, z); ++ if (block instanceof IShearable) + { -+ IShearable target = (IShearable)Block.blocksList[id]; ++ IShearable target = (IShearable)block; + if (target.isShearable(itemstack, player.worldObj, x, y, z)) + { + ArrayList drops = target.onSheared(itemstack, player.worldObj, x, y, z, @@ -94,12 +95,12 @@ + double d1 = (double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; + double d2 = (double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; + EntityItem entityitem = new EntityItem(player.worldObj, (double)x + d, (double)y + d1, (double)z + d2, stack); -+ entityitem.delayBeforeCanPickup = 10; ++ entityitem.field_145804_b = 10; + player.worldObj.spawnEntityInWorld(entityitem); + } + + itemstack.damageItem(1, player); -+ player.addStat(StatList.mineBlockStatArray[id], 1); ++ player.addStat(StatList.mineBlockStatArray[Block.func_149682_b(block)], 1); + } + } + return false; diff --git a/patches/minecraft/net/minecraft/item/ItemStack.java.patch b/patches/minecraft/net/minecraft/item/ItemStack.java.patch index c44d2392a..042d3f21e 100644 --- a/patches/minecraft/net/minecraft/item/ItemStack.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemStack.java.patch @@ -1,87 +1,74 @@ --- ../src-base/minecraft/net/minecraft/item/ItemStack.java +++ ../src-work/minecraft/net/minecraft/item/ItemStack.java -@@ -29,6 +29,7 @@ - import net.minecraft.util.Icon; +@@ -32,6 +32,7 @@ + import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.World; +import net.minecraftforge.event.ForgeEventFactory; public final class ItemStack { -@@ -223,7 +224,7 @@ - */ +@@ -192,7 +193,7 @@ + // JAVADOC METHOD $$ func_77976_d public int getMaxStackSize() { - return this.getItem().getItemStackLimit(); + return this.getItem().getItemStackLimit(this); } - /** -@@ -239,7 +240,7 @@ - */ + // JAVADOC METHOD $$ func_77985_e +@@ -204,7 +205,7 @@ + // JAVADOC METHOD $$ func_77984_f public boolean isItemStackDamageable() { -- return Item.itemsList[this.itemID].getMaxDamage() > 0; -+ return Item.itemsList[this.itemID].getMaxDamage(this) > 0; +- return this.field_151002_e.getMaxDamage() <= 0 ? false : !this.hasTagCompound() || !this.getTagCompound().getBoolean("Unbreakable"); ++ return this.field_151002_e.getMaxDamage(this) <= 0 ? false : !this.hasTagCompound() || !this.getTagCompound().getBoolean("Unbreakable"); } public boolean getHasSubtypes() -@@ -252,7 +253,9 @@ - */ +@@ -215,36 +216,31 @@ + // JAVADOC METHOD $$ func_77951_h public boolean isItemDamaged() { - return this.isItemStackDamageable() && this.itemDamage > 0; -+ boolean damaged = itemDamage > 0; -+ if (getItem() != null) damaged = getItem().isDamaged(this); -+ return this.isItemStackDamageable() && damaged; ++ return this.isItemStackDamageable() && getItem().isDamaged(this); } - /** -@@ -260,6 +263,10 @@ - */ + // JAVADOC METHOD $$ func_77952_i public int getItemDamageForDisplay() { -+ if (getItem() != null) -+ { -+ return getItem().getDisplayDamage(this); -+ } - return this.itemDamage; +- return this.itemDamage; ++ return getItem().getDisplayDamage(this); } -@@ -268,6 +275,10 @@ - */ + // JAVADOC METHOD $$ func_77960_j public int getItemDamage() { -+ if (getItem() != null) -+ { -+ return getItem().getDamage(this); -+ } - return this.itemDamage; +- return this.itemDamage; ++ return getItem().getDamage(this); } -@@ -276,6 +287,12 @@ - */ + // JAVADOC METHOD $$ func_77964_b public void setItemDamage(int par1) { -+ if (getItem() != null) -+ { -+ getItem().setDamage(this, par1); -+ return; -+ } -+ - this.itemDamage = par1; - - if (this.itemDamage < 0) -@@ -289,7 +306,7 @@ - */ - public int getMaxDamage() - { -- return Item.itemsList[this.itemID].getMaxDamage(); -+ return this.getItem().getMaxDamage(this); +- this.itemDamage = par1; +- +- if (this.itemDamage < 0) +- { +- this.itemDamage = 0; +- } ++ getItem().setDamage(this, par1); } - /** -@@ -327,8 +344,8 @@ + // JAVADOC METHOD $$ func_77958_k + public int getMaxDamage() + { +- return this.field_151002_e.getMaxDamage(); ++ return getItem().getMaxDamage(this); + } + + // JAVADOC METHOD $$ func_96631_a +@@ -277,8 +273,8 @@ } } @@ -92,16 +79,16 @@ } } -@@ -396,7 +413,7 @@ - */ - public boolean canHarvestBlock(Block par1Block) +@@ -339,7 +335,7 @@ + + public boolean func_150998_b(Block p_150998_1_) { -- return Item.itemsList[this.itemID].canHarvestBlock(par1Block); -+ return Item.itemsList[this.itemID].canHarvestBlock(par1Block, this); +- return this.field_151002_e.func_150897_b(p_150998_1_); ++ return getItem().canHarvestBlock(p_150998_1_, this); } public boolean func_111282_a(EntityPlayer par1EntityPlayer, EntityLivingBase par2EntityLivingBase) -@@ -733,15 +750,22 @@ +@@ -653,16 +649,24 @@ { arraylist.add("Durability: " + (this.getMaxDamage() - this.getItemDamageForDisplay()) + " / " + this.getMaxDamage()); } @@ -117,11 +104,13 @@ - return this.getItem().hasEffect(this); + return hasEffect(0); } + + @SideOnly(Side.CLIENT) + public boolean hasEffect(int pass) + { + return this.getItem().hasEffect(this, pass); + } - - @SideOnly(Side.CLIENT) ++ public EnumRarity getRarity() + { + return this.getItem().getRarity(this); diff --git a/patches/minecraft/net/minecraft/item/ItemTool.java.patch b/patches/minecraft/net/minecraft/item/ItemTool.java.patch index 7b273ad04..486b82ff4 100644 --- a/patches/minecraft/net/minecraft/item/ItemTool.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemTool.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/ItemTool.java +++ ../src-work/minecraft/net/minecraft/item/ItemTool.java -@@ -9,6 +9,7 @@ +@@ -10,6 +10,7 @@ import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.world.World; @@ -8,19 +8,38 @@ public class ItemTool extends Item { -@@ -114,4 +115,15 @@ +@@ -91,4 +92,34 @@ multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Tool modifier", (double)this.damageVsEntity, 0)); return multimap; } + -+ /** FORGE: Overridden to allow custom tool effectiveness */ ++ /*===================================== FORGE START =================================*/ + @Override -+ public float getStrVsBlock(ItemStack stack, Block block, int meta) ++ public int getHarvestLevel(ItemStack stack, String toolClass) ++ { ++ if ("pickaxe".equals(toolClass) && this instanceof ItemPickaxe) ++ { ++ return this.toolMaterial.getHarvestLevel(); ++ } ++ else if ("axe".equals(toolClass) && this instanceof ItemAxe) ++ { ++ return this.toolMaterial.getHarvestLevel(); ++ } ++ else if ("shovel".equals(toolClass) && this instanceof ItemSpade) ++ { ++ return this.toolMaterial.getHarvestLevel(); ++ } ++ return super.getHarvestLevel(stack, toolClass); ++ } ++ ++ @Override ++ public float getDigSpeed(ItemStack stack, Block block, int meta) + { + if (ForgeHooks.isToolEffective(stack, block, meta)) + { + return efficiencyOnProperMaterial; + } -+ return getStrVsBlock(stack, block); ++ return super.getDigSpeed(stack, block, meta); + } ++ /*===================================== FORGE END =================================*/ } diff --git a/patches/minecraft/net/minecraft/item/crafting/CraftingManager.java.patch b/patches/minecraft/net/minecraft/item/crafting/CraftingManager.java.patch index 6ebe38e3f..74df56574 100644 --- a/patches/minecraft/net/minecraft/item/crafting/CraftingManager.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/CraftingManager.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/item/crafting/CraftingManager.java +++ ../src-work/minecraft/net/minecraft/item/crafting/CraftingManager.java -@@ -283,7 +283,7 @@ +@@ -303,7 +303,7 @@ } } -- if (i == 2 && itemstack.itemID == itemstack1.itemID && itemstack.stackSize == 1 && itemstack1.stackSize == 1 && Item.itemsList[itemstack.itemID].isDamageable()) -+ if (i == 2 && itemstack.itemID == itemstack1.itemID && itemstack.stackSize == 1 && itemstack1.stackSize == 1 && Item.itemsList[itemstack.itemID].isRepairable()) +- if (i == 2 && itemstack.getItem() == itemstack1.getItem() && itemstack.stackSize == 1 && itemstack1.stackSize == 1 && itemstack.getItem().isDamageable()) ++ if (i == 2 && itemstack.getItem() == itemstack1.getItem() && itemstack.stackSize == 1 && itemstack1.stackSize == 1 && itemstack.getItem().isRepairable()) { - Item item = Item.itemsList[itemstack.itemID]; - int k = item.getMaxDamage() - itemstack.getItemDamageForDisplay(); + Item item = itemstack.getItem(); + int j1 = item.getMaxDamage() - itemstack.getItemDamageForDisplay(); diff --git a/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch b/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch index 507d7cab0..370176d50 100644 --- a/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch @@ -1,94 +1,12 @@ --- ../src-base/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java +++ ../src-work/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java -@@ -1,6 +1,8 @@ - package net.minecraft.item.crafting; +@@ -109,6 +109,9 @@ -+import java.util.Arrays; - import java.util.HashMap; -+import java.util.List; - import java.util.Map; - import net.minecraft.block.Block; - import net.minecraft.item.Item; -@@ -13,6 +15,8 @@ - /** The list of smelting results. */ - private Map smeltingList = new HashMap(); - private Map experienceList = new HashMap(); -+ private HashMap, ItemStack> metaSmeltingList = new HashMap, ItemStack>(); -+ private HashMap, Float> metaExperience = new HashMap, Float>(); - - /** - * Used to call methods addSmelting and getSmeltingResult. -@@ -57,7 +61,9 @@ - - /** - * Returns the smelting result of an item. -+ * Deprecated in favor of a metadata sensitive version - */ -+ @Deprecated - public ItemStack getSmeltingResult(int par1) + public float func_151398_b(ItemStack p_151398_1_) { - return (ItemStack)this.smeltingList.get(Integer.valueOf(par1)); -@@ -68,8 +74,63 @@ - return this.smeltingList; - } ++ float ret = p_151398_1_.getItem().getSmeltingExperience(p_151398_1_); ++ if (ret != -1) return ret; ++ + Iterator iterator = this.experienceList.entrySet().iterator(); + Entry entry; -+ @Deprecated //In favor of ItemStack sensitive version - public float getExperience(int par1) - { - return this.experienceList.containsKey(Integer.valueOf(par1)) ? ((Float)this.experienceList.get(Integer.valueOf(par1))).floatValue() : 0.0F; - } -+ -+ /** -+ * A metadata sensitive version of adding a furnace recipe. -+ */ -+ public void addSmelting(int itemID, int metadata, ItemStack itemstack, float experience) -+ { -+ metaSmeltingList.put(Arrays.asList(itemID, metadata), itemstack); -+ metaExperience.put(Arrays.asList(itemstack.itemID, itemstack.getItemDamage()), experience); -+ } -+ -+ /** -+ * Used to get the resulting ItemStack form a source ItemStack -+ * @param item The Source ItemStack -+ * @return The result ItemStack -+ */ -+ public ItemStack getSmeltingResult(ItemStack item) -+ { -+ if (item == null) -+ { -+ return null; -+ } -+ ItemStack ret = (ItemStack)metaSmeltingList.get(Arrays.asList(item.itemID, item.getItemDamage())); -+ if (ret != null) -+ { -+ return ret; -+ } -+ return (ItemStack)smeltingList.get(Integer.valueOf(item.itemID)); -+ } -+ -+ /** -+ * Grabs the amount of base experience for this item to give when pulled from the furnace slot. -+ */ -+ public float getExperience(ItemStack item) -+ { -+ if (item == null || item.getItem() == null) -+ { -+ return 0; -+ } -+ float ret = item.getItem().getSmeltingExperience(item); -+ if (ret < 0 && metaExperience.containsKey(Arrays.asList(item.itemID, item.getItemDamage()))) -+ { -+ ret = metaExperience.get(Arrays.asList(item.itemID, item.getItemDamage())); -+ } -+ if (ret < 0 && experienceList.containsKey(item.itemID)) -+ { -+ ret = ((Float)experienceList.get(item.itemID)).floatValue(); -+ } -+ return (ret < 0 ? 0 : ret); -+ } -+ -+ public Map, ItemStack> getMetaSmeltingList() -+ { -+ return metaSmeltingList; -+ } - } diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch index 809096b6b..50dfffdad 100644 --- a/patches/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch @@ -1,24 +1,23 @@ --- ../src-base/minecraft/net/minecraft/item/crafting/RecipeFireworks.java +++ ../src-work/minecraft/net/minecraft/item/crafting/RecipeFireworks.java -@@ -91,9 +91,9 @@ +@@ -90,9 +90,9 @@ { - this.field_92102_a = new ItemStack(Item.firework); + this.field_92102_a = new ItemStack(Items.fireworks); + nbttagcompound = new NBTTagCompound(); if (l > 0) { - nbttagcompound = new NBTTagCompound(); - nbttagcompound1 = new NBTTagCompound("Fireworks"); - NBTTagList nbttaglist = new NBTTagList("Explosions"); + nbttagcompound1 = new NBTTagCompound(); + NBTTagList nbttaglist = new NBTTagList(); -@@ -110,9 +110,9 @@ +@@ -109,8 +109,8 @@ 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 -+ this.field_92102_a.setTagCompound(nbttagcompound); return true; } - else if (j == 1 && i == 0 && l == 0 && k > 0 && j1 <= 1) diff --git a/patches/minecraft/net/minecraft/logging/LogAgent.java.patch b/patches/minecraft/net/minecraft/logging/LogAgent.java.patch deleted file mode 100644 index 5e61ecbd2..000000000 --- a/patches/minecraft/net/minecraft/logging/LogAgent.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/logging/LogAgent.java -+++ ../src-work/minecraft/net/minecraft/logging/LogAgent.java -@@ -72,7 +72,7 @@ - - public void logWarningFormatted(String par1Str, Object ... par2ArrayOfObj) - { -- this.serverLogger.log(Level.WARNING, par1Str, par2ArrayOfObj); -+ this.serverLogger.log(Level.WARNING, String.format(par1Str, par2ArrayOfObj)); - } - - public void logWarningException(String par1Str, Throwable par2Throwable) diff --git a/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch b/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch index e8bd316d1..028a93969 100644 --- a/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch +++ b/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch @@ -1,14 +1,30 @@ --- ../src-base/minecraft/net/minecraft/nbt/CompressedStreamTools.java +++ ../src-work/minecraft/net/minecraft/nbt/CompressedStreamTools.java -@@ -140,7 +140,6 @@ - NBTBase.writeNamedTag(par0NBTTagCompound, par1DataOutput); +@@ -1,7 +1,5 @@ + package net.minecraft.nbt; + +-import cpw.mods.fml.relauncher.Side; +-import cpw.mods.fml.relauncher.SideOnly; + import java.io.BufferedInputStream; + import java.io.ByteArrayInputStream; + import java.io.ByteArrayOutputStream; +@@ -92,7 +90,6 @@ + return bytearrayoutputstream.toByteArray(); + } + +- @SideOnly(Side.CLIENT) + public static void safeWrite(NBTTagCompound par0NBTTagCompound, File par1File) throws IOException + { + File file2 = new File(par1File.getAbsolutePath() + "_tmp"); +@@ -179,7 +176,6 @@ + } } - @SideOnly(Side.CLIENT) public static void write(NBTTagCompound par0NBTTagCompound, File par1File) throws IOException { DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(par1File)); -@@ -155,7 +154,6 @@ +@@ -194,7 +190,6 @@ } } diff --git a/patches/minecraft/net/minecraft/nbt/NBTTagList.java.patch b/patches/minecraft/net/minecraft/nbt/NBTTagList.java.patch index f81f690e5..0be14b62e 100644 --- a/patches/minecraft/net/minecraft/nbt/NBTTagList.java.patch +++ b/patches/minecraft/net/minecraft/nbt/NBTTagList.java.patch @@ -8,12 +8,19 @@ import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; -@@ -99,8 +97,6 @@ +@@ -96,7 +94,6 @@ this.tagList.add(par1NBTBase); } - @SideOnly(Side.CLIENT) -- - /** - * Removes a tag at the given index. - */ + public void func_150304_a(int p_150304_1_, NBTBase p_150304_2_) + { + if (p_150304_1_ >= 0 && p_150304_1_ < this.tagList.size()) +@@ -120,7 +117,6 @@ + } + + // JAVADOC METHOD $$ func_74744_a +- @SideOnly(Side.CLIENT) + public NBTBase removeTag(int par1) + { + return (NBTBase)this.tagList.remove(par1); diff --git a/patches/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch b/patches/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch new file mode 100644 index 000000000..ac8244c32 --- /dev/null +++ b/patches/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch @@ -0,0 +1,147 @@ +--- ../src-base/minecraft/net/minecraft/network/NetHandlerPlayServer.java ++++ ../src-work/minecraft/net/minecraft/network/NetHandlerPlayServer.java +@@ -85,6 +85,14 @@ + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; + ++import net.minecraftforge.common.ForgeHooks; ++import net.minecraftforge.common.MinecraftForge; ++import cpw.mods.fml.common.eventhandler.Event; ++import net.minecraftforge.event.ForgeEventFactory; ++import net.minecraftforge.event.ServerChatEvent; ++import net.minecraftforge.event.entity.player.PlayerInteractEvent; ++import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action; ++ + public class NetHandlerPlayServer implements INetHandlerPlayServer + { + private static final Logger field_147370_c = LogManager.getLogger(); +@@ -219,6 +227,11 @@ + this.field_147369_b.ridingEntity.updateRiderPosition(); + } + ++ if (!this.field_147380_r) //Fixes teleportation kick while riding entities ++ { ++ return; ++ } ++ + this.field_147367_d.getConfigurationManager().serverUpdateMountedMovingPlayer(this.field_147369_b); + + if (this.field_147380_r) +@@ -296,9 +309,10 @@ + d4 = d1 - this.field_147369_b.posX; + double d5 = d2 - this.field_147369_b.posY; + double d6 = d3 - this.field_147369_b.posZ; +- double d7 = Math.min(Math.abs(d4), Math.abs(this.field_147369_b.motionX)); +- double d8 = Math.min(Math.abs(d5), Math.abs(this.field_147369_b.motionY)); +- double d9 = Math.min(Math.abs(d6), Math.abs(this.field_147369_b.motionZ)); ++ //BUGFIX: min -> max, grabs the highest distance ++ double d7 = Math.max(Math.abs(d4), Math.abs(this.field_147369_b.motionX)); ++ double d8 = Math.max(Math.abs(d5), Math.abs(this.field_147369_b.motionY)); ++ double d9 = Math.max(Math.abs(d6), Math.abs(this.field_147369_b.motionZ)); + double d10 = d7 * d7 + d8 * d8 + d9 * d9; + + if (d10 > 100.0D && (!this.field_147367_d.isSinglePlayer() || !this.field_147367_d.getServerOwner().equals(this.field_147369_b.getCommandSenderName()))) +@@ -316,6 +330,11 @@ + this.field_147369_b.jump(); + } + ++ if (!this.field_147380_r) //Fixes "Moved Too Fast" kick when being teleported while moving ++ { ++ return; ++ } ++ + this.field_147369_b.moveEntity(d4, d5, d6); + this.field_147369_b.onGround = p_147347_1_.func_149465_i(); + this.field_147369_b.addMovementStat(d4, d5, d6); +@@ -338,10 +357,15 @@ + field_147370_c.warn(this.field_147369_b.getCommandSenderName() + " moved wrongly!"); + } + ++ if (!this.field_147380_r) //Fixes "Moved Too Fast" kick when being teleported while moving ++ { ++ return; ++ } ++ + this.field_147369_b.setPositionAndRotation(d1, d2, d3, f1, f2); + boolean flag2 = worldserver.getCollidingBoundingBoxes(this.field_147369_b, this.field_147369_b.boundingBox.copy().contract((double)f3, (double)f3, (double)f3)).isEmpty(); + +- if (flag && (flag1 || !flag2) && !this.field_147369_b.isPlayerSleeping()) ++ if (flag && (flag1 || !flag2) && !this.field_147369_b.isPlayerSleeping() && !this.field_147369_b.noClip) + { + this.func_147364_a(this.field_147373_o, this.field_147382_p, this.field_147381_q, f1, f2); + return; +@@ -349,7 +373,7 @@ + + AxisAlignedBB axisalignedbb = this.field_147369_b.boundingBox.copy().expand((double)f3, (double)f3, (double)f3).addCoord(0.0D, -0.55D, 0.0D); + +- if (!this.field_147367_d.isFlightAllowed() && !this.field_147369_b.theItemInWorldManager.isCreative() && !worldserver.checkBlockCollision(axisalignedbb)) ++ if (!this.field_147367_d.isFlightAllowed() && !this.field_147369_b.theItemInWorldManager.isCreative() && !worldserver.checkBlockCollision(axisalignedbb) && !this.field_147369_b.capabilities.allowFlying) + { + if (d11 >= -0.03125D) + { +@@ -368,6 +392,11 @@ + this.field_147365_f = 0; + } + ++ if (!this.field_147380_r) //Fixes "Moved Too Fast" kick when being teleported while moving ++ { ++ return; ++ } ++ + this.field_147369_b.onGround = p_147347_1_.func_149465_i(); + this.field_147367_d.getConfigurationManager().serverUpdateMountedMovingPlayer(this.field_147369_b); + this.field_147369_b.updateFlyingState(this.field_147369_b.posY - d0, p_147347_1_.func_149465_i()); +@@ -436,7 +465,10 @@ + double d2 = this.field_147369_b.posZ - ((double)k + 0.5D); + double d3 = d0 * d0 + d1 * d1 + d2 * d2; + +- if (d3 > 36.0D) ++ double dist = field_147369_b.theItemInWorldManager.getBlockReachDistance() + 1; ++ dist *= dist; ++ ++ if (d3 > dist) + { + return; + } +@@ -497,7 +529,11 @@ + return; + } + +- this.field_147369_b.theItemInWorldManager.tryUseItem(this.field_147369_b, worldserver, itemstack); ++ PlayerInteractEvent event = ForgeEventFactory.onPlayerInteract(field_147369_b, PlayerInteractEvent.Action.RIGHT_CLICK_AIR, 0, 0, 0, -1); ++ if (event.useItem != Event.Result.DENY) ++ { ++ this.field_147369_b.theItemInWorldManager.tryUseItem(this.field_147369_b, worldserver, itemstack); ++ } + } + else if (p_147346_1_.func_149571_d() >= this.field_147367_d.getBuildLimit() - 1 && (p_147346_1_.func_149568_f() == 1 || p_147346_1_.func_149571_d() >= this.field_147367_d.getBuildLimit())) + { +@@ -508,7 +544,9 @@ + } + else + { +- if (this.field_147380_r && this.field_147369_b.getDistanceSq((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D) < 64.0D && !this.field_147367_d.isBlockProtected(worldserver, i, j, k, this.field_147369_b)) ++ double dist = field_147369_b.theItemInWorldManager.getBlockReachDistance() + 1; ++ dist *= dist; ++ if (this.field_147380_r && this.field_147369_b.getDistanceSq((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D) < dist && !this.field_147367_d.isBlockProtected(worldserver, i, j, k, this.field_147369_b)) + { + this.field_147369_b.theItemInWorldManager.activateBlockOrUseItem(this.field_147369_b, worldserver, itemstack, i, j, k, l, p_147346_1_.func_149573_h(), p_147346_1_.func_149569_i(), p_147346_1_.func_149575_j()); + } +@@ -674,6 +712,8 @@ + else + { + ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("chat.type.text", new Object[] {this.field_147369_b.func_145748_c_(), s}); ++ chatcomponenttranslation1 = ForgeHooks.onServerChatEvent(this, s, chatcomponenttranslation1); ++ if (chatcomponenttranslation1 == null) return; + this.field_147367_d.getConfigurationManager().func_148544_a(chatcomponenttranslation1, false); + } + +@@ -810,7 +850,7 @@ + return; + } + +- this.field_147369_b = this.field_147367_d.getConfigurationManager().respawnPlayer(this.field_147369_b, 0, false); ++ this.field_147369_b = this.field_147367_d.getConfigurationManager().respawnPlayer(this.field_147369_b, field_147369_b.dimension, false); + } + + break; diff --git a/patches/minecraft/net/minecraft/network/NetServerHandler.java.patch b/patches/minecraft/net/minecraft/network/NetServerHandler.java.patch deleted file mode 100644 index bb8a86e57..000000000 --- a/patches/minecraft/net/minecraft/network/NetServerHandler.java.patch +++ /dev/null @@ -1,147 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/network/NetServerHandler.java -+++ ../src-work/minecraft/net/minecraft/network/NetServerHandler.java -@@ -71,6 +71,14 @@ - import net.minecraft.world.WorldServer; - import org.apache.commons.lang3.StringUtils; - -+import net.minecraftforge.common.ForgeHooks; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.Event; -+import net.minecraftforge.event.ForgeEventFactory; -+import net.minecraftforge.event.ServerChatEvent; -+import net.minecraftforge.event.entity.player.PlayerInteractEvent; -+import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action; -+ - public class NetServerHandler extends NetHandler - { - /** The underlying network manager for this server handler. */ -@@ -223,6 +231,11 @@ - this.playerEntity.ridingEntity.updateRiderPosition(); - } - -+ if (!this.hasMoved) //Fixes teleportation kick while riding entities -+ { -+ return; -+ } -+ - this.mcServer.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity); - - if (this.hasMoved) -@@ -300,9 +313,10 @@ - d4 = d1 - this.playerEntity.posX; - double d5 = d2 - this.playerEntity.posY; - double d6 = d3 - this.playerEntity.posZ; -- double d7 = Math.min(Math.abs(d4), Math.abs(this.playerEntity.motionX)); -- double d8 = Math.min(Math.abs(d5), Math.abs(this.playerEntity.motionY)); -- double d9 = Math.min(Math.abs(d6), Math.abs(this.playerEntity.motionZ)); -+ //BUGFIX: min -> max, grabs the highest distance -+ double d7 = Math.max(Math.abs(d4), Math.abs(this.playerEntity.motionX)); -+ double d8 = Math.max(Math.abs(d5), Math.abs(this.playerEntity.motionY)); -+ double d9 = Math.max(Math.abs(d6), Math.abs(this.playerEntity.motionZ)); - double d10 = d7 * d7 + d8 * d8 + d9 * d9; - - if (d10 > 100.0D && (!this.mcServer.isSinglePlayer() || !this.mcServer.getServerOwner().equals(this.playerEntity.getCommandSenderName()))) -@@ -320,6 +334,11 @@ - this.playerEntity.addExhaustion(0.2F); - } - -+ if (!this.hasMoved) //Fixes "Moved Too Fast" kick when being teleported while moving -+ { -+ return; -+ } -+ - this.playerEntity.moveEntity(d4, d5, d6); - this.playerEntity.onGround = par1Packet10Flying.onGround; - this.playerEntity.addMovementStat(d4, d5, d6); -@@ -342,10 +361,15 @@ - this.mcServer.getLogAgent().logWarning(this.playerEntity.getCommandSenderName() + " moved wrongly!"); - } - -+ if (!this.hasMoved) //Fixes "Moved Too Fast" kick when being teleported while moving -+ { -+ return; -+ } -+ - this.playerEntity.setPositionAndRotation(d1, d2, d3, f2, f3); - boolean flag2 = worldserver.getCollidingBoundingBoxes(this.playerEntity, this.playerEntity.boundingBox.copy().contract((double)f4, (double)f4, (double)f4)).isEmpty(); - -- if (flag && (flag1 || !flag2) && !this.playerEntity.isPlayerSleeping()) -+ if (flag && (flag1 || !flag2) && !this.playerEntity.isPlayerSleeping() && !this.playerEntity.noClip) - { - this.setPlayerLocation(this.lastPosX, this.lastPosY, this.lastPosZ, f2, f3); - return; -@@ -353,7 +377,7 @@ - - AxisAlignedBB axisalignedbb = this.playerEntity.boundingBox.copy().expand((double)f4, (double)f4, (double)f4).addCoord(0.0D, -0.55D, 0.0D); - -- if (!this.mcServer.isFlightAllowed() && !this.playerEntity.theItemInWorldManager.isCreative() && !worldserver.checkBlockCollision(axisalignedbb)) -+ if (!this.mcServer.isFlightAllowed() && !this.playerEntity.theItemInWorldManager.isCreative() && !worldserver.checkBlockCollision(axisalignedbb) && !this.playerEntity.capabilities.allowFlying) - { - if (d11 >= -0.03125D) - { -@@ -372,6 +396,11 @@ - this.ticksForFloatKick = 0; - } - -+ if (!this.hasMoved) //Fixes "Moved Too Fast" kick when being teleported while moving -+ { -+ return; -+ } -+ - this.playerEntity.onGround = par1Packet10Flying.onGround; - this.mcServer.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity); - this.playerEntity.updateFlyingState(this.playerEntity.posY - d0, par1Packet10Flying.onGround); -@@ -443,7 +472,10 @@ - double d2 = this.playerEntity.posZ - ((double)k + 0.5D); - double d3 = d0 * d0 + d1 * d1 + d2 * d2; - -- if (d3 > 36.0D) -+ double dist = playerEntity.theItemInWorldManager.getBlockReachDistance() + 1; -+ dist *= dist; -+ -+ if (d3 > dist) - { - return; - } -@@ -504,7 +536,11 @@ - return; - } - -- this.playerEntity.theItemInWorldManager.tryUseItem(this.playerEntity, worldserver, itemstack); -+ PlayerInteractEvent event = ForgeEventFactory.onPlayerInteract(playerEntity, PlayerInteractEvent.Action.RIGHT_CLICK_AIR, 0, 0, 0, -1); -+ if (event.useItem != Event.Result.DENY) -+ { -+ this.playerEntity.theItemInWorldManager.tryUseItem(this.playerEntity, worldserver, itemstack); -+ } - } - else if (par1Packet15Place.getYPosition() >= this.mcServer.getBuildLimit() - 1 && (par1Packet15Place.getDirection() == 1 || par1Packet15Place.getYPosition() >= this.mcServer.getBuildLimit())) - { -@@ -513,7 +549,9 @@ - } - else - { -- if (this.hasMoved && this.playerEntity.getDistanceSq((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D) < 64.0D && !this.mcServer.isBlockProtected(worldserver, i, j, k, this.playerEntity)) -+ double dist = playerEntity.theItemInWorldManager.getBlockReachDistance() + 1; -+ dist *= dist; -+ if (this.hasMoved && this.playerEntity.getDistanceSq((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D) < dist && !this.mcServer.isBlockProtected(worldserver, i, j, k, this.playerEntity)) - { - this.playerEntity.theItemInWorldManager.activateBlockOrUseItem(this.playerEntity, worldserver, itemstack, i, j, k, l, par1Packet15Place.getXOffset(), par1Packet15Place.getYOffset(), par1Packet15Place.getZOffset()); - } -@@ -698,6 +736,8 @@ - } - - ChatMessageComponent chatmessagecomponent = ChatMessageComponent.createFromTranslationWithSubstitutions("chat.type.text", new Object[] {this.playerEntity.getTranslatedEntityName(), s}); -+ chatmessagecomponent = ForgeHooks.onServerChatEvent(this, s, chatmessagecomponent); -+ if (chatmessagecomponent == null) return; - this.mcServer.getConfigurationManager().func_110459_a(chatmessagecomponent, false); - } - -@@ -852,7 +892,7 @@ - return; - } - -- this.playerEntity = this.mcServer.getConfigurationManager().respawnPlayer(this.playerEntity, 0, false); -+ this.playerEntity = this.mcServer.getConfigurationManager().respawnPlayer(this.playerEntity, playerEntity.dimension, false); - } - } - } diff --git a/patches/minecraft/net/minecraft/network/packet/Packet51MapChunk.java.patch b/patches/minecraft/net/minecraft/network/packet/Packet51MapChunk.java.patch deleted file mode 100644 index a293891ee..000000000 --- a/patches/minecraft/net/minecraft/network/packet/Packet51MapChunk.java.patch +++ /dev/null @@ -1,81 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/network/packet/Packet51MapChunk.java -+++ ../src-work/minecraft/net/minecraft/network/packet/Packet51MapChunk.java -@@ -5,6 +5,7 @@ - import java.io.DataInput; - import java.io.DataOutput; - import java.io.IOException; -+import java.util.concurrent.Semaphore; - import java.util.zip.DataFormatException; - import java.util.zip.Deflater; - import java.util.zip.Inflater; -@@ -47,6 +48,8 @@ - /** A temporary storage for the compressed chunk data byte array. */ - private static byte[] temp = new byte[196864]; - -+ private Semaphore deflateGate; -+ - public Packet51MapChunk() - { - this.isChunkDataPacket = true; -@@ -59,17 +62,22 @@ - this.zCh = par1Chunk.zPosition; - this.includeInitialize = par2; - Packet51MapChunkData packet51mapchunkdata = getMapChunkData(par1Chunk, par2, par3); -- Deflater deflater = new Deflater(-1); - this.yChMax = packet51mapchunkdata.chunkHasAddSectionFlag; - this.yChMin = packet51mapchunkdata.chunkExistFlag; -+ this.compressedChunkData = packet51mapchunkdata.compressedData; -+ this.deflateGate = new Semaphore(1); -+ } - -+ private void deflate() -+ { -+ Deflater deflater = new Deflater(-1); - try - { -- this.compressedChunkData = packet51mapchunkdata.compressedData; -- deflater.setInput(packet51mapchunkdata.compressedData, 0, packet51mapchunkdata.compressedData.length); -+ deflater.setInput(compressedChunkData, 0, compressedChunkData.length); - deflater.finish(); -- this.chunkData = new byte[packet51mapchunkdata.compressedData.length]; -- this.tempLength = deflater.deflate(this.chunkData); -+ byte[] deflated = new byte[compressedChunkData.length]; -+ this.tempLength = deflater.deflate(deflated); -+ this.chunkData = deflated; - } - finally - { -@@ -97,13 +105,16 @@ - par1DataInput.readFully(temp, 0, this.tempLength); - int i = 0; - int j; -+ int msb = 0; //BugFix: MC does not read the MSB array from the packet properly, causing issues for servers that use blocks > 256 - - for (j = 0; j < 16; ++j) - { - i += this.yChMin >> j & 1; -+ msb += this.yChMax >> j & 1; - } - - j = 12288 * i; -+ j += 2048 * msb; - - if (this.includeInitialize) - { -@@ -133,6 +144,16 @@ - */ - public void writePacketData(DataOutput par1DataOutput) throws IOException - { -+ if (chunkData == null) -+ { -+ deflateGate.acquireUninterruptibly(); -+ if (chunkData == null) -+ { -+ deflate(); -+ } -+ deflateGate.release(); -+ } -+ - par1DataOutput.writeInt(this.xCh); - par1DataOutput.writeInt(this.zCh); - par1DataOutput.writeBoolean(this.includeInitialize); diff --git a/patches/minecraft/net/minecraft/network/packet/Packet52MultiBlockChange.java.patch b/patches/minecraft/net/minecraft/network/packet/Packet52MultiBlockChange.java.patch deleted file mode 100644 index 87003341e..000000000 --- a/patches/minecraft/net/minecraft/network/packet/Packet52MultiBlockChange.java.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/network/packet/Packet52MultiBlockChange.java -+++ ../src-work/minecraft/net/minecraft/network/packet/Packet52MultiBlockChange.java -@@ -7,6 +7,8 @@ - import java.io.IOException; - import net.minecraft.world.World; - import net.minecraft.world.chunk.Chunk; -+import net.minecraftforge.common.ForgeDummyContainer; -+import net.minecraftforge.common.MinecraftForge; - - public class Packet52MultiBlockChange extends Packet - { -@@ -39,10 +41,8 @@ - - try - { -- if (par4 >= 64) -+ if (par4 >= ForgeDummyContainer.clumpingThreshold) - { -- this.field_98193_m.logInfo("ChunkTilesUpdatePacket compress " + par4); -- - if (field_73449_e.length < l) - { - field_73449_e = new byte[l]; diff --git a/patches/minecraft/net/minecraft/network/packet/Packet56MapChunks.java.patch b/patches/minecraft/net/minecraft/network/packet/Packet56MapChunks.java.patch deleted file mode 100644 index b0ab38ea2..000000000 --- a/patches/minecraft/net/minecraft/network/packet/Packet56MapChunks.java.patch +++ /dev/null @@ -1,86 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/network/packet/Packet56MapChunks.java -+++ ../src-work/minecraft/net/minecraft/network/packet/Packet56MapChunks.java -@@ -6,6 +6,7 @@ - import java.io.DataOutput; - import java.io.IOException; - import java.util.List; -+import java.util.concurrent.Semaphore; - import java.util.zip.DataFormatException; - import java.util.zip.Deflater; - import java.util.zip.Inflater; -@@ -31,7 +32,10 @@ - */ - private boolean skyLightSent; - private static byte[] chunkDataNotCompressed = new byte[0]; -+ private int maxLen = 0; - -+ private Semaphore deflateGate; -+ - public Packet56MapChunks() {} - - public Packet56MapChunks(List par1List) -@@ -49,15 +53,6 @@ - { - Chunk chunk = (Chunk)par1List.get(k); - Packet51MapChunkData packet51mapchunkdata = Packet51MapChunk.getMapChunkData(chunk, true, 65535); -- -- if (chunkDataNotCompressed.length < j + packet51mapchunkdata.compressedData.length) -- { -- byte[] abyte = new byte[j + packet51mapchunkdata.compressedData.length]; -- System.arraycopy(chunkDataNotCompressed, 0, abyte, 0, chunkDataNotCompressed.length); -- chunkDataNotCompressed = abyte; -- } -- -- System.arraycopy(packet51mapchunkdata.compressedData, 0, chunkDataNotCompressed, j, packet51mapchunkdata.compressedData.length); - j += packet51mapchunkdata.compressedData.length; - this.chunkPostX[k] = chunk.xPosition; - this.chunkPosZ[k] = chunk.zPosition; -@@ -65,15 +60,29 @@ - this.field_73588_b[k] = packet51mapchunkdata.chunkHasAddSectionFlag; - this.field_73584_f[k] = packet51mapchunkdata.compressedData; - } -+ deflateGate = new Semaphore(1); -+ maxLen = j; -+ } - -+ private void deflate() -+ { -+ byte[] data = new byte[maxLen]; -+ int offset = 0; -+ for (int x = 0; x < field_73584_f.length; x++) -+ { -+ System.arraycopy(field_73584_f[x], 0, data, offset, field_73584_f[x].length); -+ offset += field_73584_f[x].length; -+ } -+ - Deflater deflater = new Deflater(-1); - - try - { -- deflater.setInput(chunkDataNotCompressed, 0, j); -+ deflater.setInput(data, 0, maxLen); - deflater.finish(); -- this.chunkDataBuffer = new byte[j]; -- this.dataLength = deflater.deflate(this.chunkDataBuffer); -+ byte[] deflated = new byte[maxLen]; -+ this.dataLength = deflater.deflate(deflated); -+ this.chunkDataBuffer = deflated; - } - finally - { -@@ -155,6 +164,15 @@ - */ - public void writePacketData(DataOutput par1DataOutput) throws IOException - { -+ if (this.chunkDataBuffer == null) -+ { -+ deflateGate.acquireUninterruptibly(); -+ if (this.chunkDataBuffer == null) -+ { -+ deflate(); -+ } -+ deflateGate.release(); -+ } - par1DataOutput.writeShort(this.chunkPostX.length); - par1DataOutput.writeInt(this.dataLength); - par1DataOutput.writeBoolean(this.skyLightSent); diff --git a/patches/minecraft/net/minecraft/network/play/server/S21PacketChunkData.java.patch b/patches/minecraft/net/minecraft/network/play/server/S21PacketChunkData.java.patch new file mode 100644 index 000000000..6c84cf2a1 --- /dev/null +++ b/patches/minecraft/net/minecraft/network/play/server/S21PacketChunkData.java.patch @@ -0,0 +1,79 @@ +--- ../src-base/minecraft/net/minecraft/network/play/server/S21PacketChunkData.java ++++ ../src-work/minecraft/net/minecraft/network/play/server/S21PacketChunkData.java +@@ -3,6 +3,7 @@ + import cpw.mods.fml.relauncher.Side; + import cpw.mods.fml.relauncher.SideOnly; + import java.io.IOException; ++import java.util.concurrent.Semaphore; + import java.util.zip.DataFormatException; + import java.util.zip.Deflater; + import java.util.zip.Inflater; +@@ -26,6 +27,7 @@ + private int field_149285_h; + private static byte[] field_149286_i = new byte[196864]; + private static final String __OBFID = "CL_00001304"; ++ private Semaphore deflateGate; + + public S21PacketChunkData() {} + +@@ -35,17 +37,22 @@ + this.field_149282_b = p_i45196_1_.zPosition; + this.field_149279_g = p_i45196_2_; + S21PacketChunkData.Extracted extracted = func_149269_a(p_i45196_1_, p_i45196_2_, p_i45196_3_); +- Deflater deflater = new Deflater(-1); + this.field_149280_d = extracted.field_150281_c; + this.field_149283_c = extracted.field_150280_b; ++ this.field_149278_f = extracted.field_150282_a; ++ this.deflateGate = new Semaphore(1); ++ } + ++ private void deflate() ++ { ++ Deflater deflater = new Deflater(-1); + try + { +- this.field_149278_f = extracted.field_150282_a; +- deflater.setInput(extracted.field_150282_a, 0, extracted.field_150282_a.length); ++ deflater.setInput(this.field_149278_f, 0, this.field_149278_f.length); + deflater.finish(); +- this.field_149281_e = new byte[extracted.field_150282_a.length]; +- this.field_149285_h = deflater.deflate(this.field_149281_e); ++ byte[] deflated = new byte[this.field_149278_f.length]; ++ this.field_149285_h = deflater.deflate(deflated); ++ this.field_149281_e = deflated; + } + finally + { +@@ -75,13 +82,16 @@ + p_148837_1_.readBytes(field_149286_i, 0, this.field_149285_h); + int i = 0; + int j; ++ int msb = 0; //BugFix: MC does not read the MSB array from the packet properly, causing issues for servers that use blocks > 256 + + for (j = 0; j < 16; ++j) + { + i += this.field_149283_c >> j & 1; ++ msb += this.field_149283_c >> j & 1; + } + + j = 12288 * i; ++ j += 2048 * msb; + + if (this.field_149279_g) + { +@@ -108,6 +118,15 @@ + + public void func_148840_b(PacketBuffer p_148840_1_) throws IOException + { ++ if (this.field_149281_e == null) ++ { ++ deflateGate.acquireUninterruptibly(); ++ if (this.field_149281_e == null) ++ { ++ deflate(); ++ } ++ deflateGate.release(); ++ } + p_148840_1_.writeInt(this.field_149284_a); + p_148840_1_.writeInt(this.field_149282_b); + p_148840_1_.writeBoolean(this.field_149279_g); diff --git a/patches/minecraft/net/minecraft/network/play/server/S26PacketMapChunkBulk.java.patch b/patches/minecraft/net/minecraft/network/play/server/S26PacketMapChunkBulk.java.patch new file mode 100644 index 000000000..98ad9d4e1 --- /dev/null +++ b/patches/minecraft/net/minecraft/network/play/server/S26PacketMapChunkBulk.java.patch @@ -0,0 +1,84 @@ +--- ../src-base/minecraft/net/minecraft/network/play/server/S26PacketMapChunkBulk.java ++++ ../src-work/minecraft/net/minecraft/network/play/server/S26PacketMapChunkBulk.java +@@ -4,6 +4,7 @@ + import cpw.mods.fml.relauncher.SideOnly; + import java.io.IOException; + import java.util.List; ++import java.util.concurrent.Semaphore; + import java.util.zip.DataFormatException; + import java.util.zip.Deflater; + import java.util.zip.Inflater; +@@ -25,6 +26,8 @@ + private boolean field_149267_h; + private static byte[] field_149268_i = new byte[0]; + private static final String __OBFID = "CL_00001306"; ++ private int maxLen = 0; ++ private Semaphore deflateGate; + + public S26PacketMapChunkBulk() {} + +@@ -43,15 +46,6 @@ + { + Chunk chunk = (Chunk)p_i45197_1_.get(k); + S21PacketChunkData.Extracted extracted = S21PacketChunkData.func_149269_a(chunk, true, 65535); +- +- if (field_149268_i.length < j + extracted.field_150282_a.length) +- { +- byte[] abyte = new byte[j + extracted.field_150282_a.length]; +- System.arraycopy(field_149268_i, 0, abyte, 0, field_149268_i.length); +- field_149268_i = abyte; +- } +- +- System.arraycopy(extracted.field_150282_a, 0, field_149268_i, j, extracted.field_150282_a.length); + j += extracted.field_150282_a.length; + this.field_149266_a[k] = chunk.xPosition; + this.field_149264_b[k] = chunk.zPosition; +@@ -59,15 +53,28 @@ + this.field_149262_d[k] = extracted.field_150281_c; + this.field_149260_f[k] = extracted.field_150282_a; + } ++ this.deflateGate = new Semaphore(1); ++ maxLen = j; ++ } + ++ private void deflate() ++ { ++ byte[] data = new byte[maxLen]; ++ int offset = 0; ++ for (int x = 0; x < field_149260_f.length; x++) ++ { ++ System.arraycopy(field_149260_f[x], 0, data, offset, field_149260_f[x].length); ++ offset += field_149260_f[x].length; ++ } + Deflater deflater = new Deflater(-1); + + try + { +- deflater.setInput(field_149268_i, 0, j); ++ deflater.setInput(data, 0, data.length); + deflater.finish(); +- this.field_149263_e = new byte[j]; +- this.field_149261_g = deflater.deflate(this.field_149263_e); ++ byte[] deflated = new byte[data.length]; ++ this.field_149261_g = deflater.deflate(deflated); ++ this.field_149263_e = deflated; + } + finally + { +@@ -148,6 +155,16 @@ + + public void func_148840_b(PacketBuffer p_148840_1_) throws IOException + { ++ if (this.field_149263_e == null) ++ { ++ deflateGate.acquireUninterruptibly(); ++ if (this.field_149263_e == null) ++ { ++ deflate(); ++ } ++ deflateGate.release(); ++ } ++ + p_148840_1_.writeShort(this.field_149266_a.length); + p_148840_1_.writeInt(this.field_149261_g); + p_148840_1_.writeBoolean(this.field_149267_h); diff --git a/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch b/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch index bcebb171f..e2dcc38c0 100644 --- a/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch +++ b/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch @@ -9,42 +9,43 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.EntityLivingBase; -+import net.minecraft.item.Item; ++import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; public class PotionEffect -@@ -26,6 +31,9 @@ - /** True if potion effect duration is at maximum, false otherwise. */ +@@ -21,6 +26,8 @@ + @SideOnly(Side.CLIENT) private boolean isPotionDurationMax; - + private static final String __OBFID = "CL_00001529"; + /** List of ItemStack that can cure the potion effect **/ + private List curativeItems; -+ + public PotionEffect(int par1, int par2) { - this(par1, par2, 0); -@@ -42,6 +50,8 @@ +@@ -38,6 +45,8 @@ this.duration = par2; this.amplifier = par3; this.isAmbient = par4; + this.curativeItems = new ArrayList(); -+ this.curativeItems.add(new ItemStack(Item.bucketMilk)); ++ this.curativeItems.add(new ItemStack(Items.milk_bucket)); } public PotionEffect(PotionEffect par1PotionEffect) -@@ -49,6 +59,7 @@ +@@ -45,6 +54,7 @@ this.potionID = par1PotionEffect.potionID; this.duration = par1PotionEffect.duration; this.amplifier = par1PotionEffect.amplifier; -+ this.curativeItems = par1PotionEffect.getCurativeItems(); ++ this.curativeItems = par1PotionEffect.curativeItems; } - /** -@@ -95,6 +106,63 @@ - return this.amplifier; + // JAVADOC METHOD $$ func_76452_a +@@ -210,4 +220,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 @@ -101,7 +102,4 @@ + this.curativeItems.add(stack); + } + } -+ - /** - * Set whether this potion is a splash potion. - */ + } diff --git a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch index 9927bae56..d28098884 100644 --- a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch +++ b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch @@ -1,16 +1,16 @@ --- ../src-base/minecraft/net/minecraft/server/MinecraftServer.java +++ ../src-work/minecraft/net/minecraft/server/MinecraftServer.java -@@ -11,6 +11,7 @@ - import java.text.SimpleDateFormat; - import java.util.ArrayList; +@@ -23,6 +23,7 @@ + import java.util.Arrays; + import java.util.Collections; import java.util.Date; +import java.util.Hashtable; import java.util.Iterator; import java.util.List; - import java.util.logging.Level; -@@ -54,6 +55,10 @@ - import net.minecraft.world.storage.ISaveHandler; - import net.minecraft.world.storage.WorldInfo; + import java.util.Random; +@@ -71,6 +72,10 @@ + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; +import net.minecraftforge.common.DimensionManager; +import net.minecraftforge.common.MinecraftForge; @@ -18,27 +18,27 @@ + public abstract class MinecraftServer implements ICommandSender, Runnable, IPlayerUsage { - /** Instance of Minecraft Server. */ -@@ -78,7 +83,7 @@ + private static final Logger field_147145_h = LogManager.getLogger(); +@@ -93,7 +98,7 @@ + // JAVADOC FIELD $$ field_71319_s private int serverPort = -1; - - /** The server world instances. */ + // JAVADOC FIELD $$ field_71305_c - public WorldServer[] worldServers; + public WorldServer[] worldServers = new WorldServer[0]; - - /** The ServerConfigurationManager instance. */ + // JAVADOC FIELD $$ field_71318_t private ServerConfigurationManager serverConfigManager; -@@ -133,7 +138,8 @@ - public final long[] tickTimeArray; - - /** Stats are [dimension][tick%100] system.nanoTime is stored. */ + // JAVADOC FIELD $$ field_71317_u +@@ -123,7 +128,8 @@ + private int field_143008_E = 0; + public final long[] tickTimeArray = new long[100]; + // JAVADOC FIELD $$ field_71312_k - public long[][] timeOfLastDimensionTick; + //public long[][] timeOfLastDimensionTick; + public Hashtable worldTickTimes = new Hashtable(); private KeyPair serverKeyPair; - - /** Username of the server owner (for integrated servers) */ -@@ -218,8 +224,6 @@ + // JAVADOC FIELD $$ field_71293_J + private String serverOwner; +@@ -215,8 +221,6 @@ { this.convertMapIfNeeded(par1Str); this.setUserMessage("menu.loadingLevel"); @@ -47,16 +47,16 @@ ISaveHandler isavehandler = this.anvilConverterForAnvilFile.getSaveLoader(par1Str, true); WorldInfo worldinfo = isavehandler.loadWorldInfo(); WorldSettings worldsettings; -@@ -239,46 +243,23 @@ +@@ -236,46 +240,21 @@ worldsettings.enableBonusChest(); } - for (int j = 0; j < this.worldServers.length; ++j) -+ WorldServer overWorld = (isDemo() ? new DemoWorldServer(this, isavehandler, par2Str, 0, theProfiler, getLogAgent()) : new WorldServer(this, isavehandler, par2Str, 0, worldsettings, theProfiler, getLogAgent())); ++ WorldServer overWorld = (isDemo() ? new DemoWorldServer(this, isavehandler, par2Str, 0, theProfiler) : new WorldServer(this, isavehandler, par2Str, 0, worldsettings, theProfiler)); + for (int dim : DimensionManager.getStaticDimensionIDs()) { - byte b0 = 0; -+ WorldServer world = (dim == 0 ? overWorld : new WorldServerMulti(this, isavehandler, par2Str, dim, worldsettings, overWorld, theProfiler, getLogAgent())); ++ WorldServer world = (dim == 0 ? overWorld : new WorldServerMulti(this, isavehandler, par2Str, dim, worldsettings, overWorld, theProfiler)); + world.addWorldAccess(new WorldManager(this, world)); - if (j == 1) @@ -73,16 +73,16 @@ - { - if (this.isDemo()) - { -- this.worldServers[j] = new DemoWorldServer(this, isavehandler, par2Str, b0, this.theProfiler, this.getLogAgent()); +- this.worldServers[j] = new DemoWorldServer(this, isavehandler, par2Str, b0, this.theProfiler); - } - else - { -- this.worldServers[j] = new WorldServer(this, isavehandler, par2Str, b0, worldsettings, this.theProfiler, this.getLogAgent()); +- this.worldServers[j] = new WorldServer(this, isavehandler, par2Str, b0, worldsettings, this.theProfiler); - } - } - else - { -- this.worldServers[j] = new WorldServerMulti(this, isavehandler, par2Str, b0, worldsettings, this.worldServers[0], this.theProfiler, this.getLogAgent()); +- this.worldServers[j] = new WorldServerMulti(this, isavehandler, par2Str, b0, worldsettings, this.worldServers[0], this.theProfiler); - } - - this.worldServers[j].addWorldAccess(new WorldManager(this, this.worldServers[j])); @@ -93,24 +93,23 @@ + world.getWorldInfo().setGameType(this.getGameType()); } - this.serverConfigManager.setPlayerManager(this.worldServers); -+ +- this.serverConfigManager.setPlayerManager(this.worldServers); + MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(world)); } + this.serverConfigManager.setPlayerManager(new WorldServer[]{ overWorld }); - this.setDifficultyForAllWorlds(this.getDifficulty()); + this.func_147139_a(this.func_147135_j()); this.initialWorldChunkLoad(); } -@@ -360,6 +341,7 @@ +@@ -346,6 +325,7 @@ if (!this.worldIsBeingDeleted) { WorldServer[] aworldserver = this.worldServers; -+ if (aworldserver == null) return; //ForgE: Just in case, NPE protection as it has been encountered. ++ 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) -@@ -413,9 +395,16 @@ +@@ -397,9 +377,16 @@ for (int i = 0; i < this.worldServers.length; ++i) { WorldServer worldserver = this.worldServers[i]; @@ -124,10 +123,10 @@ + DimensionManager.setWorld(world.provider.dimensionId, null); + } + - if (this.usageSnooper != null && this.usageSnooper.isSnooperRunning()) + if (this.usageSnooper.isSnooperRunning()) { this.usageSnooper.stopSnooper(); -@@ -638,13 +627,15 @@ +@@ -629,13 +616,15 @@ this.theProfiler.startSection("levels"); int i; @@ -146,7 +145,7 @@ this.theProfiler.startSection(worldserver.getWorldInfo().getWorldName()); this.theProfiler.startSection("pools"); worldserver.getWorldVec3Pool().clear(); -@@ -691,9 +682,11 @@ +@@ -682,9 +671,11 @@ this.theProfiler.endSection(); } @@ -157,10 +156,10 @@ + this.theProfiler.endStartSection("dim_unloading"); + DimensionManager.unloadWorlds(worldTickTimes); this.theProfiler.endStartSection("connection"); - this.getNetworkThread().networkTick(); + this.func_147137_ag().func_151269_c(); this.theProfiler.endStartSection("players"); -@@ -747,7 +740,13 @@ - */ +@@ -731,7 +722,13 @@ + // JAVADOC METHOD $$ func_71218_a public WorldServer worldServerForDimension(int par1) { - return par1 == -1 ? this.worldServers[1] : (par1 == 1 ? this.worldServers[2] : this.worldServers[0]); @@ -173,8 +172,8 @@ + return ret; } - @SideOnly(Side.SERVER) -@@ -1110,6 +1109,7 @@ + // JAVADOC METHOD $$ func_71249_w +@@ -1006,6 +1003,7 @@ if (worldserver != null) { diff --git a/patches/minecraft/net/minecraft/server/gui/StatsComponent.java.patch b/patches/minecraft/net/minecraft/server/gui/StatsComponent.java.patch deleted file mode 100644 index 1e56f7bf4..000000000 --- a/patches/minecraft/net/minecraft/server/gui/StatsComponent.java.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/gui/StatsComponent.java -+++ ../src-work/minecraft/net/minecraft/server/gui/StatsComponent.java -@@ -10,6 +10,8 @@ - import javax.swing.Timer; - import net.minecraft.network.TcpConnection; - import net.minecraft.server.MinecraftServer; -+import net.minecraft.world.WorldServer; -+import net.minecraftforge.common.DimensionManager; - - @SideOnly(Side.SERVER) - public class StatsComponent extends JComponent -@@ -32,6 +34,7 @@ - - private void func_120034_a() - { -+ this.field_120036_d = new String[5 + DimensionManager.getIDs().length]; - long i = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); - System.gc(); - this.field_120036_d[0] = "Memory use: " + i / 1024L / 1024L + " mb (" + Runtime.getRuntime().freeMemory() * 100L / Runtime.getRuntime().maxMemory() + "% free)"; -@@ -42,15 +45,18 @@ - - if (this.field_120037_e.worldServers != null) - { -- for (int j = 0; j < this.field_120037_e.worldServers.length; ++j) -+ int j = 0; -+ for (Integer id : DimensionManager.getIDs()) - { -- this.field_120036_d[5 + j] = "Lvl " + j + " tick: " + field_120040_a.format(this.func_120035_a(this.field_120037_e.timeOfLastDimensionTick[j]) * 1.0E-6D) + " ms"; -+ this.field_120036_d[5 + j] = "Lvl " + id + " tick: " + field_120040_a.format(this.func_120035_a(this.field_120037_e.worldTickTimes.get(id)) * 1.0E-6D) + " ms"; - -- if (this.field_120037_e.worldServers[j] != null && this.field_120037_e.worldServers[j].theChunkProviderServer != null) -+ WorldServer world = DimensionManager.getWorld(id); -+ if (world != null && world.theChunkProviderServer != null) - { -- this.field_120036_d[5 + j] = this.field_120036_d[5 + j] + ", " + this.field_120037_e.worldServers[j].theChunkProviderServer.makeString(); -- this.field_120036_d[5 + j] = this.field_120036_d[5 + j] + ", Vec3: " + this.field_120037_e.worldServers[j].getWorldVec3Pool().func_82590_d() + " / " + this.field_120037_e.worldServers[j].getWorldVec3Pool().getPoolSize(); -+ this.field_120036_d[5 + j] = this.field_120036_d[5 + j] + ", " + world.theChunkProviderServer.makeString(); -+ this.field_120036_d[5 + j] = this.field_120036_d[5 + j] + ", Vec3: " + world.getWorldVec3Pool().func_82590_d() + " / " + world.getWorldVec3Pool().getPoolSize(); - } -+ j++; - } - } - diff --git a/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch b/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch index 4bf1d8cd7..ac20b2c03 100644 --- a/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch +++ b/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch @@ -1,17 +1,16 @@ --- ../src-base/minecraft/net/minecraft/server/integrated/IntegratedServer.java +++ ../src-work/minecraft/net/minecraft/server/integrated/IntegratedServer.java -@@ -23,6 +23,10 @@ +@@ -23,6 +23,9 @@ + import net.minecraft.world.WorldType; import net.minecraft.world.demo.DemoWorldServer; import net.minecraft.world.storage.ISaveHandler; - +import net.minecraftforge.common.DimensionManager; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.world.WorldEvent; -+ - @SideOnly(Side.CLIENT) - public class IntegratedServer extends MinecraftServer - { -@@ -65,44 +69,23 @@ + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; + +@@ -55,44 +58,23 @@ protected void loadAllWorlds(String par1Str, String par2Str, long par3, WorldType par5WorldType, String par6Str) { this.convertMapIfNeeded(par1Str); @@ -20,18 +19,18 @@ ISaveHandler isavehandler = this.getActiveAnvilConverter().getSaveLoader(par1Str, true); - for (int j = 0; j < this.worldServers.length; ++j) -+ WorldServer overWorld = (isDemo() ? new DemoWorldServer(this, isavehandler, par2Str, 0, theProfiler, getLogAgent()) : new WorldServer(this, isavehandler, par2Str, 0, theWorldSettings, theProfiler, getLogAgent())); ++ WorldServer overWorld = (isDemo() ? new DemoWorldServer(this, isavehandler, par2Str, 0, theProfiler) : new WorldServer(this, isavehandler, par2Str, 0, theWorldSettings, theProfiler)); + for (int dim : DimensionManager.getStaticDimensionIDs()) { - byte b0 = 0; -+ WorldServer world = (dim == 0 ? overWorld : new WorldServerMulti(this, isavehandler, par2Str, dim, theWorldSettings, overWorld, theProfiler, getLogAgent())); ++ WorldServer world = (dim == 0 ? overWorld : new WorldServerMulti(this, isavehandler, par2Str, dim, theWorldSettings, overWorld, theProfiler)); + world.addWorldAccess(new WorldManager(this, world)); - if (j == 1) + if (!this.isSinglePlayer()) { - b0 = -1; -+ world.getWorldInfo().setGameType(this.getGameType()); ++ world.getWorldInfo().setGameType(getGameType()); } - if (j == 2) @@ -43,16 +42,16 @@ - { - if (this.isDemo()) - { -- this.worldServers[j] = new DemoWorldServer(this, isavehandler, par2Str, b0, this.theProfiler, this.getLogAgent()); +- this.worldServers[j] = new DemoWorldServer(this, isavehandler, par2Str, b0, this.theProfiler); - } - else - { -- this.worldServers[j] = new WorldServer(this, isavehandler, par2Str, b0, this.theWorldSettings, this.theProfiler, this.getLogAgent()); +- this.worldServers[j] = new WorldServer(this, isavehandler, par2Str, b0, this.theWorldSettings, this.theProfiler); - } - } - else - { -- this.worldServers[j] = new WorldServerMulti(this, isavehandler, par2Str, b0, this.theWorldSettings, this.worldServers[0], this.theProfiler, this.getLogAgent()); +- this.worldServers[j] = new WorldServerMulti(this, isavehandler, par2Str, b0, this.theWorldSettings, this.worldServers[0], this.theProfiler); - } - - this.worldServers[j].addWorldAccess(new WorldManager(this, this.worldServers[j])); @@ -61,6 +60,6 @@ } + this.getConfigurationManager().setPlayerManager(new WorldServer[]{ overWorld }); - this.setDifficultyForAllWorlds(this.getDifficulty()); + this.func_147139_a(this.func_147135_j()); this.initialWorldChunkLoad(); } diff --git a/patches/minecraft/net/minecraft/item/ItemInWorldManager.java.patch b/patches/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch similarity index 57% rename from patches/minecraft/net/minecraft/item/ItemInWorldManager.java.patch rename to patches/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch index 3c1b9b61e..67c1e2057 100644 --- a/patches/minecraft/net/minecraft/item/ItemInWorldManager.java.patch +++ b/patches/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch @@ -1,17 +1,17 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemInWorldManager.java -+++ ../src-work/minecraft/net/minecraft/item/ItemInWorldManager.java -@@ -4,12 +4,25 @@ - import net.minecraft.entity.player.EntityPlayer; - import net.minecraft.entity.player.EntityPlayerMP; - import net.minecraft.network.packet.Packet53BlockChange; +--- ../src-base/minecraft/net/minecraft/server/management/ItemInWorldManager.java ++++ ../src-work/minecraft/net/minecraft/server/management/ItemInWorldManager.java +@@ -7,12 +7,24 @@ + import net.minecraft.item.ItemStack; + import net.minecraft.item.ItemSword; + import net.minecraft.network.play.server.S23PacketBlockChange; +import net.minecraft.tileentity.TileEntity; - import net.minecraft.world.EnumGameType; import net.minecraft.world.World; import net.minecraft.world.WorldServer; + import net.minecraft.world.WorldSettings; +import net.minecraftforge.common.ForgeHooks; +import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.Event; ++import cpw.mods.fml.common.eventhandler.Event; +import net.minecraftforge.event.ForgeEventFactory; +import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; @@ -22,75 +22,85 @@ { + /** Forge reach distance */ + private double blockReachDistance = 5.0d; -+ - /** The world object that this object is connected to. */ + // JAVADOC FIELD $$ field_73092_a public World theWorld; - -@@ -145,6 +158,13 @@ + // JAVADOC FIELD $$ field_73090_b +@@ -133,6 +145,13 @@ { if (!this.gameType.isAdventure() || this.thisPlayerMP.isCurrentToolAdventureModeExempt(par1, par2, par3)) { + PlayerInteractEvent event = ForgeEventFactory.onPlayerInteract(thisPlayerMP, Action.LEFT_CLICK_BLOCK, par1, par2, par3, par4); + if (event.isCanceled()) + { -+ thisPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet53BlockChange(par1, par2, par3, theWorld)); ++ thisPlayerMP.playerNetServerHandler.func_147359_a(new S23PacketBlockChange(par1, par2, par3, theWorld)); + return; + } + if (this.isCreative()) { if (!this.theWorld.extinguishFire((EntityPlayer)null, par1, par2, par3, par4)) -@@ -154,17 +174,35 @@ +@@ -142,19 +161,36 @@ } else { - this.theWorld.extinguishFire((EntityPlayer)null, par1, par2, par3, par4); this.initialDamage = this.curblockDamage; float f = 1.0F; - int i1 = this.theWorld.getBlockId(par1, par2, par3); + Block block = this.theWorld.func_147439_a(par1, par2, par3); -- if (i1 > 0) -+ Block block = Block.blocksList[i1]; -+ -+ if (block != null) +- if (block.func_149688_o() != Material.field_151579_a) ++ ++ if (!block.isAir(theWorld, par1, par2, par3)) { -- Block.blocksList[i1].onBlockClicked(this.theWorld, par1, par2, par3, this.thisPlayerMP); -- f = Block.blocksList[i1].getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, par1, par2, par3); +- block.func_149699_a(this.theWorld, par1, par2, par3, this.thisPlayerMP); +- f = block.func_149737_a(this.thisPlayerMP, this.thisPlayerMP.worldObj, par1, par2, par3); + if (event.useBlock != Event.Result.DENY) + { -+ block.onBlockClicked(theWorld, par1, par2, par3, thisPlayerMP); ++ block.func_149699_a(theWorld, par1, par2, par3, thisPlayerMP); + theWorld.extinguishFire(thisPlayerMP, par1, par2, par3, par4); + } + else + { -+ thisPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet53BlockChange(par1, par2, par3, theWorld)); ++ thisPlayerMP.playerNetServerHandler.func_147359_a(new S23PacketBlockChange(par1, par2, par3, theWorld)); + } -+ f = block.getPlayerRelativeBlockHardness(thisPlayerMP, thisPlayerMP.worldObj, par1, par2, par3); ++ f = block.func_149737_a(thisPlayerMP, thisPlayerMP.worldObj, par1, par2, par3); } +- if (block.func_149688_o() != Material.field_151579_a && f >= 1.0F) + if (event.useItem == Event.Result.DENY) -+ { + { + if (f >= 1.0f) + { -+ thisPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet53BlockChange(par1, par2, par3, theWorld)); ++ thisPlayerMP.playerNetServerHandler.func_147359_a(new S23PacketBlockChange(par1, par2, par3, theWorld)); + } + return; + } + - if (i1 > 0 && f >= 1.0F) - { ++ if (!block.isAir(theWorld, par1, par2, par3) && f >= 1.0F) ++ { this.tryHarvestBlock(par1, par2, par3); -@@ -236,7 +274,7 @@ - block.onBlockHarvested(this.theWorld, par1, par2, par3, l, this.thisPlayerMP); - } + } + else +@@ -178,7 +214,7 @@ + int l = this.curblockDamage - this.initialDamage; + Block block = this.theWorld.func_147439_a(par1, par2, par3); -- boolean flag = this.theWorld.setBlockToAir(par1, par2, par3); -+ boolean flag = (block != null && block.removeBlockByPlayer(theWorld, thisPlayerMP, par1, par2, par3)); +- if (block.func_149688_o() != Material.field_151579_a) ++ if (!block.isAir(theWorld, par1, par2, par3)) + { + float f = block.func_149737_a(this.thisPlayerMP, this.thisPlayerMP.worldObj, par1, par2, par3) * (float)(l + 1); - if (block != null && flag) +@@ -214,7 +250,7 @@ + Block block = this.theWorld.func_147439_a(par1, par2, par3); + int l = this.theWorld.getBlockMetadata(par1, par2, par3); + block.func_149681_a(this.theWorld, par1, par2, par3, l, this.thisPlayerMP); +- boolean flag = this.theWorld.func_147468_f(par1, par2, par3); ++ boolean flag = block.removedByPlayer(theWorld, thisPlayerMP, par1, par2, par3); + + if (flag) { -@@ -251,29 +289,37 @@ - */ +@@ -227,29 +263,32 @@ + // JAVADOC METHOD $$ func_73084_b public boolean tryHarvestBlock(int par1, int par2, int par3) { - if (this.gameType.isAdventure() && !this.thisPlayerMP.isCurrentToolAdventureModeExempt(par1, par2, par3)) @@ -110,51 +120,45 @@ + { + return false; + } - int l = this.theWorld.getBlockId(par1, par2, par3); - int i1 = this.theWorld.getBlockMetadata(par1, par2, par3); - this.theWorld.playAuxSFXAtEntity(this.thisPlayerMP, 2001, par1, par2, par3, l + (this.theWorld.getBlockMetadata(par1, par2, par3) << 12)); + Block block = this.theWorld.func_147439_a(par1, par2, par3); + int l = this.theWorld.getBlockMetadata(par1, par2, par3); + this.theWorld.playAuxSFXAtEntity(this.thisPlayerMP, 2001, par1, par2, par3, Block.func_149682_b(block) + (this.theWorld.getBlockMetadata(par1, par2, par3) << 12)); - boolean flag = this.removeBlock(par1, par2, par3); + boolean flag = false; if (this.isCreative()) { + flag = this.removeBlock(par1, par2, par3); - this.thisPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet53BlockChange(par1, par2, par3, this.theWorld)); + this.thisPlayerMP.playerNetServerHandler.func_147359_a(new S23PacketBlockChange(par1, par2, par3, this.theWorld)); } else { ItemStack itemstack = this.thisPlayerMP.getCurrentEquippedItem(); -- boolean flag1 = this.thisPlayerMP.canHarvestBlock(Block.blocksList[l]); -+ boolean flag1 = false; -+ Block block = Block.blocksList[l]; -+ if (block != null) -+ { -+ flag1 = block.canHarvestBlock(thisPlayerMP, i1); -+ } +- boolean flag1 = this.thisPlayerMP.func_146099_a(block); ++ boolean flag1 = block.canHarvestBlock(thisPlayerMP, l); if (itemstack != null) { -@@ -285,12 +331,19 @@ +@@ -261,12 +300,18 @@ } } + flag = this.removeBlock(par1, par2, par3); if (flag && flag1) { - Block.blocksList[l].harvestBlock(this.theWorld, this.thisPlayerMP, par1, par2, par3, i1); + block.func_149636_a(this.theWorld, this.thisPlayerMP, par1, par2, par3, l); } } + // Drop experience -+ if (!this.isCreative() && flag && event != null) -+ { -+ Block.blocksList[l].dropXpOnBlockBreak(this.theWorld, par1, par2, par3, event.getExpToDrop()); -+ } -+ ++ if (!this.isCreative() && flag && event != null) ++ { ++ block.func_149657_c(this.theWorld, par1, par2, par3, event.getExpToDrop()); ++ } return flag; } } -@@ -325,6 +378,7 @@ +@@ -299,6 +344,7 @@ if (itemstack1.stackSize == 0) { par1EntityPlayer.inventory.mainInventory[par1EntityPlayer.inventory.currentItem] = null; @@ -162,50 +166,56 @@ } if (!par1EntityPlayer.isUsingItem()) -@@ -342,35 +396,56 @@ - */ +@@ -313,27 +359,56 @@ + // JAVADOC METHOD $$ func_73078_a public boolean activateBlockOrUseItem(EntityPlayer par1EntityPlayer, World par2World, ItemStack par3ItemStack, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { -- int i1; +- if ((!par1EntityPlayer.isSneaking() || par1EntityPlayer.getHeldItem() == null) && par2World.func_147439_a(par4, par5, par6).func_149727_a(par2World, par4, par5, par6, par1EntityPlayer, par7, par8, par9, par10)) + PlayerInteractEvent event = ForgeEventFactory.onPlayerInteract(par1EntityPlayer, Action.RIGHT_CLICK_BLOCK, par4, par5, par6, par7); + if (event.isCanceled()) -+ { -+ thisPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet53BlockChange(par4, par5, par6, theWorld)); -+ return false; -+ } - -- if (!par1EntityPlayer.isSneaking() || par1EntityPlayer.getHeldItem() == null) -+ Item item = (par3ItemStack != null ? par3ItemStack.getItem() : null); -+ if (item != null && item.onItemUseFirst(par3ItemStack, par1EntityPlayer, par2World, par4, par5, par6, par7, par8, par9, par10)) { -- i1 = par2World.getBlockId(par4, par5, par6); +- return true; ++ thisPlayerMP.playerNetServerHandler.func_147359_a(new S23PacketBlockChange(par4, par5, par6, theWorld)); ++ return false; + } +- else if (par3ItemStack == null) ++ ++ if (par3ItemStack != null && par3ItemStack.getItem().onItemUseFirst(par3ItemStack, par1EntityPlayer, par2World, par4, par5, par6, par7, par8, par9, par10)) + { +- return false; + if (par3ItemStack.stackSize <= 0) ForgeEventFactory.onPlayerDestroyItem(thisPlayerMP, par3ItemStack); + return true; -+ } - -- if (i1 > 0 && Block.blocksList[i1].onBlockActivated(par2World, par4, par5, par6, par1EntityPlayer, par7, par8, par9, par10)) -+ int i1 = par2World.getBlockId(par4, par5, par6); -+ Block block = Block.blocksList[i1]; + } +- else if (this.isCreative()) ++ Block block = par2World.func_147439_a(par4, par5, par6); ++ boolean isAir = block.isAir(par2World, par4, par5, par6); ++ boolean useBlock = !par1EntityPlayer.isSneaking() || par1EntityPlayer.getHeldItem() == null; ++ if (!useBlock) useBlock = par1EntityPlayer.getHeldItem().getItem().doesSneakBypassUse(par2World, par4, par5, par6, par1EntityPlayer); + boolean result = false; + -+ if (block != null && (!par1EntityPlayer.isSneaking() || ( par1EntityPlayer.getHeldItem() == null || par1EntityPlayer.getHeldItem().getItem().shouldPassSneakingClickToBlock(par2World, par4, par5, par6)))) -+ { ++ if (useBlock) + { +- int i1 = par3ItemStack.getItemDamage(); +- int j1 = par3ItemStack.stackSize; +- boolean flag = par3ItemStack.tryPlaceItemIntoWorld(par1EntityPlayer, par2World, par4, par5, par6, par7, par8, par9, par10); +- par3ItemStack.setItemDamage(i1); +- par3ItemStack.stackSize = j1; +- return flag; + if (event.useBlock != Event.Result.DENY) - { -- return true; -+ result = block.onBlockActivated(par2World, par4, par5, par6, par1EntityPlayer, par7, par8, par9, par10); - } ++ { ++ result = block.func_149727_a(par2World, par4, par5, par6, par1EntityPlayer, par7, par8, par9, par10); ++ } + else + { -+ thisPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet53BlockChange(par4, par5, par6, theWorld)); ++ thisPlayerMP.playerNetServerHandler.func_147359_a(new S23PacketBlockChange(par4, par5, par6, theWorld)); + result = event.useItem != Event.Result.ALLOW; + } } - -- if (par3ItemStack == null) +- else ++ + if (par3ItemStack != null && !result && event.useItem != Event.Result.DENY) { -- return false; +- return par3ItemStack.tryPlaceItemIntoWorld(par1EntityPlayer, par2World, par4, par5, par6, par7, par8, par9, par10); + int meta = par3ItemStack.getItemDamage(); + int size = par3ItemStack.stackSize; + result = par3ItemStack.tryPlaceItemIntoWorld(par1EntityPlayer, par2World, par4, par5, par6, par7, par8, par9, par10); @@ -216,29 +226,17 @@ + } + if (par3ItemStack.stackSize <= 0) ForgeEventFactory.onPlayerDestroyItem(thisPlayerMP, par3ItemStack); } -- else if (this.isCreative()) + + /* Re-enable if this causes bukkit incompatibility, or re-write client side to only send a single packet per right click. + if (par3ItemStack != null && ((!result && event.useItem != Event.Result.DENY) || event.useItem == Event.Result.ALLOW)) - { -- i1 = par3ItemStack.getItemDamage(); -- int j1 = par3ItemStack.stackSize; -- boolean flag = par3ItemStack.tryPlaceItemIntoWorld(par1EntityPlayer, par2World, par4, par5, par6, par7, par8, par9, par10); -- par3ItemStack.setItemDamage(i1); -- par3ItemStack.stackSize = j1; -- return flag; -- } -- else -- { -- return par3ItemStack.tryPlaceItemIntoWorld(par1EntityPlayer, par2World, par4, par5, par6, par7, par8, par9, par10); -- } ++ { + this.tryUseItem(thisPlayerMP, par2World, par3ItemStack); + }*/ + return result; } - /** -@@ -380,4 +455,13 @@ + // JAVADOC METHOD $$ func_73080_a +@@ -341,4 +416,13 @@ { this.theWorld = par1WorldServer; } diff --git a/patches/minecraft/net/minecraft/server/management/PlayerInstance.java.patch b/patches/minecraft/net/minecraft/server/management/PlayerInstance.java.patch deleted file mode 100644 index 59bf8105d..000000000 --- a/patches/minecraft/net/minecraft/server/management/PlayerInstance.java.patch +++ /dev/null @@ -1,79 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/management/PlayerInstance.java -+++ ../src-work/minecraft/net/minecraft/server/management/PlayerInstance.java -@@ -1,6 +1,7 @@ - package net.minecraft.server.management; - - import java.util.ArrayList; -+import java.util.Arrays; - import java.util.List; - import net.minecraft.entity.player.EntityPlayerMP; - import net.minecraft.network.packet.Packet; -@@ -10,6 +11,9 @@ - import net.minecraft.tileentity.TileEntity; - import net.minecraft.world.ChunkCoordIntPair; - import net.minecraft.world.chunk.Chunk; -+import net.minecraftforge.common.ForgeDummyContainer; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.world.ChunkWatchEvent; - - public class PlayerInstance - { -@@ -66,6 +70,8 @@ - this.playersInChunk.remove(par1EntityPlayerMP); - par1EntityPlayerMP.loadedChunks.remove(this.chunkLocation); - -+ MinecraftForge.EVENT_BUS.post(new ChunkWatchEvent.UnWatch(chunkLocation, par1EntityPlayerMP)); -+ - if (this.playersInChunk.isEmpty()) - { - long i = (long)this.chunkLocation.chunkXPos + 2147483647L | (long)this.chunkLocation.chunkZPos + 2147483647L << 32; -@@ -109,7 +115,7 @@ - - this.flagsYAreasToUpdate |= 1 << (par2 >> 4); - -- if (this.numberOfTilesToUpdate < 64) -+ //if (this.numberOfTilesToUpdate < 64) //Forge; Cache everything, so always run - { - short short1 = (short)(par1 << 12 | par3 << 8 | par2); - -@@ -121,6 +127,10 @@ - } - } - -+ if (numberOfTilesToUpdate == locationOfBlockChange.length) -+ { -+ locationOfBlockChange = Arrays.copyOf(locationOfBlockChange, locationOfBlockChange.length << 1); -+ } - this.locationOfBlockChange[this.numberOfTilesToUpdate++] = short1; - } - } -@@ -162,12 +172,13 @@ - { - int l; - -- if (this.numberOfTilesToUpdate == 64) -+ if (this.numberOfTilesToUpdate >= ForgeDummyContainer.clumpingThreshold) - { - i = this.chunkLocation.chunkXPos * 16; - j = this.chunkLocation.chunkZPos * 16; - this.sendToAllPlayersWatchingChunk(new Packet51MapChunk(PlayerManager.getWorldServer(this.thePlayerManager).getChunkFromChunkCoords(this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos), false, this.flagsYAreasToUpdate)); - -+ /* Forge: Grabs ALL tile entities is costly on a modded server, only send needed ones - for (k = 0; k < 16; ++k) - { - if ((this.flagsYAreasToUpdate & 1 << k) != 0) -@@ -181,11 +192,14 @@ - } - } - } -+ */ - } - else - { - this.sendToAllPlayersWatchingChunk(new Packet52MultiBlockChange(this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos, this.locationOfBlockChange, this.numberOfTilesToUpdate, PlayerManager.getWorldServer(this.thePlayerManager))); -+ } - -+ { //Forge: Send only the tile entities that are updated, Adding this brace lets us keep the indent and the patch small - for (i = 0; i < this.numberOfTilesToUpdate; ++i) - { - j = this.chunkLocation.chunkXPos * 16 + (this.locationOfBlockChange[i] >> 12 & 15); 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 000000000..4d6f865b4 --- /dev/null +++ b/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch @@ -0,0 +1,87 @@ +--- ../src-base/minecraft/net/minecraft/server/management/PlayerManager.java ++++ ../src-work/minecraft/net/minecraft/server/management/PlayerManager.java +@@ -1,6 +1,7 @@ + package net.minecraft.server.management; + + import java.util.ArrayList; ++import java.util.Arrays; + import java.util.List; + import net.minecraft.entity.player.EntityPlayerMP; + import net.minecraft.network.Packet; +@@ -13,6 +14,9 @@ + import net.minecraft.world.WorldProvider; + import net.minecraft.world.WorldServer; + import net.minecraft.world.chunk.Chunk; ++import net.minecraftforge.common.ForgeModContainer; ++import net.minecraftforge.common.MinecraftForge; ++import net.minecraftforge.event.world.ChunkWatchEvent; + + public class PlayerManager + { +@@ -337,6 +341,8 @@ + this.playersInChunk.remove(par1EntityPlayerMP); + par1EntityPlayerMP.loadedChunks.remove(this.chunkLocation); + ++ MinecraftForge.EVENT_BUS.post(new ChunkWatchEvent.UnWatch(chunkLocation, par1EntityPlayerMP)); ++ + if (this.playersInChunk.isEmpty()) + { + long i = (long)this.chunkLocation.chunkXPos + 2147483647L | (long)this.chunkLocation.chunkZPos + 2147483647L << 32; +@@ -376,7 +382,7 @@ + + this.flagsYAreasToUpdate |= 1 << (p_151253_2_ >> 4); + +- if (this.numberOfTilesToUpdate < 64) ++ //if (this.numberOfTilesToUpdate < 64) //Forge; Cache everything, so always run + { + short short1 = (short)(p_151253_1_ << 12 | p_151253_3_ << 8 | p_151253_2_); + +@@ -420,7 +426,7 @@ + k = this.chunkLocation.chunkZPos * 16 + (this.field_151254_d[0] >> 8 & 15); + this.func_151251_a(new S23PacketBlockChange(i, j, k, PlayerManager.this.theWorldServer)); + +- if (PlayerManager.this.theWorldServer.func_147439_a(i, j, k).func_149716_u()) ++ if (PlayerManager.this.theWorldServer.func_147439_a(i, j, k).hasTileEntity(PlayerManager.this.theWorldServer.getBlockMetadata(i, j, k))) + { + this.func_151252_a(PlayerManager.this.theWorldServer.func_147438_o(i, j, k)); + } +@@ -429,12 +435,13 @@ + { + int l; + +- if (this.numberOfTilesToUpdate == 64) ++ if (this.numberOfTilesToUpdate == ForgeModContainer.clumpingThreshold) + { + i = this.chunkLocation.chunkXPos * 16; + j = this.chunkLocation.chunkZPos * 16; + this.func_151251_a(new S21PacketChunkData(PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos), false, this.flagsYAreasToUpdate)); + ++ /* Forge: Grabs ALL tile entities is costly on a modded server, only send needed ones + for (k = 0; k < 16; ++k) + { + if ((this.flagsYAreasToUpdate & 1 << k) != 0) +@@ -448,18 +455,22 @@ + } + } + } ++ */ + } + else + { + this.func_151251_a(new S22PacketMultiBlockChange(this.numberOfTilesToUpdate, this.field_151254_d, PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkLocation.chunkXPos, this.chunkLocation.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.numberOfTilesToUpdate; ++i) + { + j = this.chunkLocation.chunkXPos * 16 + (this.field_151254_d[i] >> 12 & 15); + k = this.field_151254_d[i] & 255; + l = this.chunkLocation.chunkZPos * 16 + (this.field_151254_d[i] >> 8 & 15); + +- if (PlayerManager.this.theWorldServer.func_147439_a(j, k, l).func_149716_u()) ++ if (world.func_147439_a(j, k, l).hasTileEntity(world.getBlockMetadata(j, k, l))) + { + this.func_151252_a(PlayerManager.this.theWorldServer.func_147438_o(j, k, l)); + } diff --git a/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch b/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch index c5c4042ee..bf593e667 100644 --- a/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch +++ b/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch @@ -1,23 +1,17 @@ --- ../src-base/minecraft/net/minecraft/server/management/ServerConfigurationManager.java +++ ../src-work/minecraft/net/minecraft/server/management/ServerConfigurationManager.java -@@ -52,11 +52,15 @@ +@@ -54,7 +54,9 @@ import net.minecraft.util.EnumChatFormatting; + import net.minecraft.util.IChatComponent; import net.minecraft.util.MathHelper; - import net.minecraft.world.EnumGameType; +import net.minecraft.world.Teleporter; import net.minecraft.world.World; +import net.minecraft.world.WorldProvider; import net.minecraft.world.WorldServer; + import net.minecraft.world.WorldSettings; import net.minecraft.world.demo.DemoWorldManager; - import net.minecraft.world.storage.IPlayerFileData; - -+import net.minecraftforge.common.DimensionManager; -+ - public abstract class ServerConfigurationManager - { - private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z"); -@@ -392,13 +396,23 @@ - */ +@@ -375,13 +377,23 @@ + // JAVADOC METHOD $$ func_72368_a public EntityPlayerMP respawnPlayer(EntityPlayerMP par1EntityPlayerMP, int par2, boolean par3) { + World world = mcServer.worldServerForDimension(par2); @@ -42,15 +36,15 @@ par1EntityPlayerMP.dimension = par2; Object object; -@@ -414,6 +428,7 @@ - EntityPlayerMP entityplayermp1 = new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension), par1EntityPlayerMP.getCommandSenderName(), (ItemInWorldManager)object); +@@ -397,6 +409,7 @@ + EntityPlayerMP entityplayermp1 = new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension), par1EntityPlayerMP.func_146103_bH(), (ItemInWorldManager)object); entityplayermp1.playerNetServerHandler = par1EntityPlayerMP.playerNetServerHandler; entityplayermp1.clonePlayer(par1EntityPlayerMP, par3); + entityplayermp1.dimension = par2; - entityplayermp1.entityId = par1EntityPlayerMP.entityId; + entityplayermp1.func_145769_d(par1EntityPlayerMP.func_145782_y()); WorldServer worldserver = this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension); this.func_72381_a(entityplayermp1, par1EntityPlayerMP, worldserver); -@@ -458,6 +473,11 @@ +@@ -441,6 +454,11 @@ public void transferPlayerToDimension(EntityPlayerMP par1EntityPlayerMP, int par2) { @@ -62,23 +56,23 @@ int j = par1EntityPlayerMP.dimension; WorldServer worldserver = this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension); par1EntityPlayerMP.dimension = par2; -@@ -465,7 +485,7 @@ - par1EntityPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet9Respawn(par1EntityPlayerMP.dimension, (byte)par1EntityPlayerMP.worldObj.difficultySetting, worldserver1.getWorldInfo().getTerrainType(), worldserver1.getHeight(), par1EntityPlayerMP.theItemInWorldManager.getGameType())); +@@ -448,7 +466,7 @@ + par1EntityPlayerMP.playerNetServerHandler.func_147359_a(new S07PacketRespawn(par1EntityPlayerMP.dimension, par1EntityPlayerMP.worldObj.difficultySetting, par1EntityPlayerMP.worldObj.getWorldInfo().getTerrainType(), par1EntityPlayerMP.theItemInWorldManager.getGameType())); worldserver.removePlayerEntityDangerously(par1EntityPlayerMP); par1EntityPlayerMP.isDead = false; - this.transferEntityToWorld(par1EntityPlayerMP, j, worldserver, worldserver1); + this.transferEntityToWorld(par1EntityPlayerMP, j, worldserver, worldserver1, teleporter); this.func_72375_a(par1EntityPlayerMP, worldserver); - par1EntityPlayerMP.playerNetServerHandler.setPlayerLocation(par1EntityPlayerMP.posX, par1EntityPlayerMP.posY, par1EntityPlayerMP.posZ, par1EntityPlayerMP.rotationYaw, par1EntityPlayerMP.rotationPitch); + par1EntityPlayerMP.playerNetServerHandler.func_147364_a(par1EntityPlayerMP.posX, par1EntityPlayerMP.posY, par1EntityPlayerMP.posZ, par1EntityPlayerMP.rotationYaw, par1EntityPlayerMP.rotationPitch); par1EntityPlayerMP.theItemInWorldManager.setWorld(worldserver1); -@@ -487,39 +507,24 @@ - */ +@@ -467,15 +485,23 @@ + // JAVADOC METHOD $$ func_82448_a public void transferEntityToWorld(Entity par1Entity, int par2, WorldServer par3WorldServer, WorldServer par4WorldServer) { - double d0 = par1Entity.posX; - double d1 = par1Entity.posZ; - double d2 = 8.0D; -+ transferEntityToWorld(par1Entity, par2, par3WorldServer, par4WorldServer, par4WorldServer.getDefaultTeleporter()); ++ transferEntityToWorld(par1Entity, par2, par3WorldServer, par4WorldServer); + } + + public void transferEntityToWorld(Entity par1Entity, int par2, WorldServer par3WorldServer, WorldServer par4WorldServer, Teleporter teleporter) @@ -94,40 +88,26 @@ float f = par1Entity.rotationYaw; par3WorldServer.theProfiler.startSection("moving"); -- if (par1Entity.dimension == -1) ++ /* + if (par1Entity.dimension == -1) + { + d0 /= d2; +@@ -498,7 +524,8 @@ + par3WorldServer.updateEntityWithOptionalForce(par1Entity, false); + } + } +- else ++ */ + if (par1Entity.dimension == 1) { -- d0 /= d2; -- d1 /= d2; -- par1Entity.setLocationAndAngles(d0, par1Entity.posY, d1, par1Entity.rotationYaw, par1Entity.rotationPitch); -- -- if (par1Entity.isEntityAlive()) -- { -- par3WorldServer.updateEntityWithOptionalForce(par1Entity, false); -- } -- } -- else if (par1Entity.dimension == 0) -- { -- d0 *= d2; -- d1 *= d2; -- par1Entity.setLocationAndAngles(d0, par1Entity.posY, d1, par1Entity.rotationYaw, par1Entity.rotationPitch); -- -- if (par1Entity.isEntityAlive()) -- { -- par3WorldServer.updateEntityWithOptionalForce(par1Entity, false); -- } -- } -- else -- { ChunkCoordinates chunkcoordinates; - if (par2 == 1) -@@ -555,7 +560,7 @@ - par4WorldServer.spawnEntityInWorld(par1Entity); +@@ -533,7 +560,7 @@ + if (par1Entity.isEntityAlive()) + { par1Entity.setLocationAndAngles(d0, par1Entity.posY, d1, par1Entity.rotationYaw, par1Entity.rotationPitch); - par4WorldServer.updateEntityWithOptionalForce(par1Entity, false); - par4WorldServer.getDefaultTeleporter().placeInPortal(par1Entity, d3, d4, d5, f); + teleporter.placeInPortal(par1Entity, d3, d4, d5, f); + par4WorldServer.spawnEntityInWorld(par1Entity); + par4WorldServer.updateEntityWithOptionalForce(par1Entity, false); } - - par3WorldServer.theProfiler.endSection(); diff --git a/patches/minecraft/net/minecraft/stats/StatList.java.patch b/patches/minecraft/net/minecraft/stats/StatList.java.patch index 1e155a9cf..f4576b668 100644 --- a/patches/minecraft/net/minecraft/stats/StatList.java.patch +++ b/patches/minecraft/net/minecraft/stats/StatList.java.patch @@ -1,14 +1,38 @@ --- ../src-base/minecraft/net/minecraft/stats/StatList.java +++ ../src-work/minecraft/net/minecraft/stats/StatList.java -@@ -182,9 +182,9 @@ - */ - private static StatBase[] initMinableStats(String par0Str, int par1) - { -- StatBase[] astatbase = new StatBase[256]; -+ StatBase[] astatbase = new StatBase[Block.blocksList.length]; +@@ -118,7 +118,7 @@ -- for (int j = 0; j < 256; ++j) -+ for (int j = 0; j < Block.blocksList.length; ++j) - { - if (Block.blocksList[j] != null && Block.blocksList[j].getEnableStats()) + if (item != null) { +- int i = Item.func_150891_b(item); ++ int i = Item.func_150891_b(item); //TODO: Hook FML's stat change event and re-assign these + objectCraftStats[i] = (new StatCrafting("stat.craftItem." + i, new ChatComponentTranslation("stat.craftItem", new Object[] {(new ItemStack(item)).func_151000_E()}), item)).registerStat(); + } + } +@@ -136,7 +136,7 @@ + + if (Item.func_150898_a(block) != null) + { +- int i = Block.func_149682_b(block); ++ int i = Block.func_149682_b(block); //TODO: Hook FML's stat change event and re-assign these + + if (block.func_149652_G()) + { +@@ -159,7 +159,7 @@ + + if (item != null) + { +- int i = Item.func_150891_b(item); ++ int i = Item.func_150891_b(item); //TODO: Hook FML's stat change event and re-assign these + objectUseStats[i] = (new StatCrafting("stat.useItem." + i, new ChatComponentTranslation("stat.useItem", new Object[] {(new ItemStack(item)).func_151000_E()}), item)).registerStat(); + + if (!(item instanceof ItemBlock)) +@@ -182,7 +182,7 @@ + + if (item != null) + { +- int i = Item.func_150891_b(item); ++ int i = Item.func_150891_b(item); //TODO: Hook FML's stat change event and re-assign these + + if (item.isDamageable()) + { diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch index dfb93eb6e..4dfbf265e 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch @@ -1,20 +1,19 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntity.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntity.java -@@ -10,8 +10,11 @@ - import net.minecraft.block.Block; +@@ -12,7 +12,10 @@ import net.minecraft.crash.CrashReportCategory; + import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; -+import net.minecraft.network.INetworkManager; - import net.minecraft.network.packet.Packet; -+import net.minecraft.network.packet.Packet132TileEntityData; - import net.minecraft.server.MinecraftServer; ++import net.minecraft.network.NetworkManager; + import net.minecraft.network.Packet; ++import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; - public class TileEntity -@@ -309,4 +312,94 @@ - addMapping(TileEntityHopper.class, "Hopper"); - addMapping(TileEntityComparator.class, "Comparator"); + import org.apache.logging.log4j.Level; +@@ -279,4 +282,93 @@ + func_145826_a(TileEntityComparator.class, "Comparator"); + func_145826_a(TileEntityFlowerPot.class, "FlowerPot"); } + + // -- BEGIN FORGE PATCHES -- @@ -36,7 +35,7 @@ + * @param net The NetworkManager the packet originated from + * @param pkt The data packet + */ -+ public void onDataPacket(INetworkManager net, Packet132TileEntityData pkt) ++ public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) + { + } + @@ -57,14 +56,14 @@ + * @param oldMeta The old metadata of the block + * @param newMeta The new metadata of the block (May be the same) + * @param world Current world -+ * @param x X Postion ++ * @param x X Position + * @param y Y Position + * @param z Z Position + * @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(int oldID, int newID, int oldMeta, int newMeta, World world, int x, int y, int z) ++ public boolean shouldRefresh(Block oldBlock, Block newBlock, int oldMeta, int newMeta, World world, int x, int y, int z) + { -+ return !isVanilla || (oldID != newID); ++ return !isVanilla || (oldBlock != newBlock); + } + + public boolean shouldRenderInPass(int pass) @@ -75,10 +74,9 @@ + * Sometimes default render bounding box: infinite in scope. Used to control rendering on {@link TileEntitySpecialRenderer}. + */ + public static final AxisAlignedBB INFINITE_EXTENT_AABB = AxisAlignedBB.getBoundingBox(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 ++ * Defaults to the collision bounding box {@link Block#func_149668_a(World, int, int, int)} associated with the block + * at this location. + * + * @return an appropriately size {@link AxisAlignedBB} for the {@link TileEntity} @@ -87,18 +85,18 @@ + public AxisAlignedBB getRenderBoundingBox() + { + AxisAlignedBB bb = INFINITE_EXTENT_AABB; -+ Block type = getBlockType(); -+ if (type == Block.enchantmentTable) ++ Block type = func_145838_q(); ++ if (type == Blocks.enchanting_table) + { -+ bb = AxisAlignedBB.getAABBPool().getAABB(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1); ++ bb = AxisAlignedBB.getAABBPool().getAABB(field_145851_c, field_145848_d, field_145849_e, field_145851_c + 1, field_145848_d + 1, field_145849_e + 1); + } -+ else if (type == Block.chest || type == Block.chestTrapped) ++ else if (type == Blocks.chest || type == Blocks.trapped_chest) + { -+ bb = AxisAlignedBB.getAABBPool().getAABB(xCoord - 1, yCoord, zCoord - 1, xCoord + 2, yCoord + 2, zCoord + 2); ++ bb = AxisAlignedBB.getAABBPool().getAABB(field_145851_c - 1, field_145848_d, field_145849_e - 1, field_145851_c + 2, field_145848_d + 2, field_145849_e + 2); + } -+ else if (type != null && type != Block.beacon) ++ else if (type != null && type != Blocks.beacon) + { -+ AxisAlignedBB cbb = getBlockType().getCollisionBoundingBoxFromPool(worldObj, xCoord, yCoord, zCoord); ++ AxisAlignedBB cbb = type.func_149668_a(field_145850_b, field_145851_c, field_145848_d, field_145849_e); + if (cbb != null) + { + bb = cbb; diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch index eb458c8cb..72f29d0d0 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch @@ -1,13 +1,11 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntityBeacon.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityBeacon.java -@@ -121,7 +121,9 @@ +@@ -110,7 +110,7 @@ { - int i1 = this.worldObj.getBlockId(k, j, l); + Block block = this.field_145850_b.func_147439_a(l, k, i1); -- if (i1 != Block.blockEmerald.blockID && i1 != Block.blockGold.blockID && i1 != Block.blockDiamond.blockID && i1 != Block.blockIron.blockID) -+ Block block = Block.blocksList[i1]; -+ -+ if (block == null || !block.isBeaconBase(worldObj, k, j, l, xCoord, yCoord, zCoord)) +- if (block != Blocks.emerald_block && block != Blocks.gold_block && block != Blocks.diamond_block && block != Blocks.iron_block) ++ if (!block.isBeaconBase(this.field_145850_b, l, k, i1, field_145851_c, field_145848_d, field_145849_e)) { flag = false; break; diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch index 3bf5c46fb..90bab7d4e 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java -@@ -11,6 +11,8 @@ +@@ -12,6 +12,8 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.potion.PotionHelper; @@ -9,48 +9,47 @@ public class TileEntityBrewingStand extends TileEntity implements ISidedInventory { -@@ -122,7 +124,7 @@ +@@ -105,7 +107,7 @@ for (int i = 0; i < 3; ++i) { -- if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].itemID == Item.potion.itemID) -+ if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() instanceof ItemPotion) +- if (this.field_145945_j[i] != null && this.field_145945_j[i].getItem() == Items.potionitem) ++ if (this.field_145945_j[i] != null && this.field_145945_j[i].getItem() instanceof ItemPotion) { - int j = this.brewingItemStacks[i].getItemDamage(); - int k = this.getPotionResult(j, itemstack); -@@ -161,7 +163,7 @@ + int j = this.field_145945_j[i].getItemDamage(); + int k = this.func_145936_c(j, itemstack); +@@ -144,7 +146,7 @@ for (int i = 0; i < 3; ++i) { -- if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].itemID == Item.potion.itemID) -+ if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() instanceof ItemPotion) +- if (this.field_145945_j[i] != null && this.field_145945_j[i].getItem() == Items.potionitem) ++ if (this.field_145945_j[i] != null && this.field_145945_j[i].getItem() instanceof ItemPotion) { - int j = this.brewingItemStacks[i].getItemDamage(); - int k = this.getPotionResult(j, itemstack); -@@ -184,7 +186,7 @@ + int j = this.field_145945_j[i].getItemDamage(); + int k = this.func_145936_c(j, itemstack); +@@ -167,7 +169,7 @@ - if (Item.itemsList[itemstack.itemID].hasContainerItem()) + if (itemstack.getItem().hasContainerItem()) { -- this.brewingItemStacks[3] = new ItemStack(Item.itemsList[itemstack.itemID].getContainerItem()); -+ this.brewingItemStacks[3] = Item.itemsList[itemstack.itemID].getContainerItemStack(brewingItemStacks[3]); +- this.field_145945_j[3] = new ItemStack(itemstack.getItem().getContainerItem()); ++ this.field_145945_j[3] = itemstack.getItem().getContainerItem(itemstack); } else { -@@ -195,6 +197,8 @@ - this.brewingItemStacks[3] = null; +@@ -178,6 +180,7 @@ + this.field_145945_j[3] = null; } } -+ -+ MinecraftForge.EVENT_BUS.post(new PotionBrewedEvent(brewingItemStacks)); ++ MinecraftForge.EVENT_BUS.post(new PotionBrewedEvent(field_145945_j)); } } -@@ -343,7 +347,7 @@ - */ +@@ -300,7 +303,7 @@ + // JAVADOC METHOD $$ func_94041_b public boolean isItemValidForSlot(int par1, ItemStack par2ItemStack) { -- return par1 == 3 ? Item.itemsList[par2ItemStack.itemID].isPotionIngredient() : par2ItemStack.itemID == Item.potion.itemID || par2ItemStack.itemID == Item.glassBottle.itemID; -+ return par1 == 3 ? Item.itemsList[par2ItemStack.itemID].isPotionIngredient() : par2ItemStack.getItem() instanceof ItemPotion || par2ItemStack.itemID == Item.glassBottle.itemID; +- return par1 == 3 ? par2ItemStack.getItem().func_150892_m(par2ItemStack) : par2ItemStack.getItem() == Items.potionitem || par2ItemStack.getItem() == Items.glass_bottle; ++ return par1 == 3 ? par2ItemStack.getItem().func_150892_m(par2ItemStack) : par2ItemStack.getItem() instanceof ItemPotion || par2ItemStack.getItem() == Items.glass_bottle; } @SideOnly(Side.CLIENT) diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch index 20e6d6618..4dc5034a9 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch @@ -1,72 +1,34 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntityFurnace.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityFurnace.java -@@ -9,6 +9,7 @@ - import net.minecraft.entity.player.EntityPlayer; - import net.minecraft.inventory.ISidedInventory; - import net.minecraft.item.Item; -+import net.minecraft.item.ItemBlock; - import net.minecraft.item.ItemHoe; - import net.minecraft.item.ItemStack; - import net.minecraft.item.ItemSword; -@@ -16,6 +17,8 @@ - import net.minecraft.item.crafting.FurnaceRecipes; - import net.minecraft.nbt.NBTTagCompound; - import net.minecraft.nbt.NBTTagList; -+import net.minecraftforge.common.ForgeDirection; -+import net.minecraftforge.common.ForgeDummyContainer; +@@ -223,8 +223,7 @@ - public class TileEntityFurnace extends TileEntity implements ISidedInventory - { -@@ -279,8 +282,7 @@ - - if (this.furnaceItemStacks[1].stackSize == 0) + if (this.field_145957_n[1].stackSize == 0) { -- Item item = this.furnaceItemStacks[1].getItem().getContainerItem(); -- this.furnaceItemStacks[1] = item != null ? new ItemStack(item) : null; -+ this.furnaceItemStacks[1] = this.furnaceItemStacks[1].getItem().getContainerItemStack(furnaceItemStacks[1]); +- Item item = this.field_145957_n[1].getItem().getContainerItem(); +- this.field_145957_n[1] = item != null ? new ItemStack(item) : null; ++ this.field_145957_n[1] = field_145957_n[1].getItem().getContainerItem(field_145957_n[1]); } } } -@@ -326,8 +328,12 @@ - } +@@ -268,7 +267,11 @@ else { -- ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0].getItem().itemID); -- 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()))); -+ ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0]); + ItemStack itemstack = FurnaceRecipes.smelting().func_151395_a(this.field_145957_n[0]); +- return itemstack == null ? false : (this.field_145957_n[2] == null ? true : (!this.field_145957_n[2].isItemEqual(itemstack) ? false : (this.field_145957_n[2].stackSize < this.getInventoryStackLimit() && this.field_145957_n[2].stackSize < this.field_145957_n[2].getMaxStackSize() ? true : this.field_145957_n[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 <= itemstack.getMaxStackSize()); ++ if (this.field_145957_n[2] == null) return true; ++ if (!this.field_145957_n[2].isItemEqual(itemstack)) return false; ++ int result = field_145957_n[2].stackSize + itemstack.stackSize; ++ return result < getInventoryStackLimit() && result <= this.field_145957_n[2].getMaxStackSize(); //Forge BugFix: Make it respect stack sizes properly. } } -@@ -338,15 +344,15 @@ - { - if (this.canSmelt()) - { -- ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0].getItem().itemID); -+ ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0]); - - if (this.furnaceItemStacks[2] == null) - { - this.furnaceItemStacks[2] = itemstack.copy(); +@@ -284,7 +287,7 @@ } -- else if (this.furnaceItemStacks[2].itemID == itemstack.itemID) -+ else if (this.furnaceItemStacks[2].isItemEqual(itemstack)) + else if (this.field_145957_n[2].getItem() == itemstack.getItem()) { -- ++this.furnaceItemStacks[2].stackSize; -+ furnaceItemStacks[2].stackSize += itemstack.stackSize; +- ++this.field_145957_n[2].stackSize; ++ this.field_145957_n[2].stackSize += itemstack.stackSize; // Forge BugFix: Results may have multiple items } - --this.furnaceItemStacks[0].stackSize; -@@ -373,7 +379,7 @@ - int i = par0ItemStack.getItem().itemID; - Item item = par0ItemStack.getItem(); - -- if (i < 256 && Block.blocksList[i] != null) -+ if (par0ItemStack.getItem() instanceof ItemBlock && Block.blocksList[i] != null) - { - Block block = Block.blocksList[i]; - + --this.field_145957_n[0].stackSize; diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch index d03f52c7b..82bc5b6c8 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch @@ -1,35 +1,37 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntityHopper.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityHopper.java -@@ -453,17 +453,28 @@ +@@ -402,17 +402,30 @@ if (itemstack1 == null) { -- par0IInventory.setInventorySlotContents(par2, par1ItemStack); -- par1ItemStack = null; -+ int max = Math.min(par1ItemStack.getMaxStackSize(), par0IInventory.getInventoryStackLimit()); -+ if (max >= par1ItemStack.stackSize) +- p_145899_0_.setInventorySlotContents(p_145899_2_, p_145899_1_); +- p_145899_1_ = null; ++ //Forge: BUGFIX: Again, make things respect max stack sizes. ++ int max = Math.min(p_145899_1_.getMaxStackSize(), p_145899_0_.getInventoryStackLimit()); ++ if (max >= p_145899_1_.stackSize) + { -+ par0IInventory.setInventorySlotContents(par2, par1ItemStack); -+ par1ItemStack = null; ++ p_145899_0_.setInventorySlotContents(p_145899_2_, p_145899_1_); ++ p_145899_1_ = null; + } + else + { -+ par0IInventory.setInventorySlotContents(par2, par1ItemStack.splitStack(max)); ++ p_145899_0_.setInventorySlotContents(p_145899_2_, p_145899_1_.splitStack(max)); + } flag = true; } - else if (areItemStacksEqualItem(itemstack1, par1ItemStack)) + else if (func_145894_a(itemstack1, p_145899_1_)) { -- int k = par1ItemStack.getMaxStackSize() - itemstack1.stackSize; -- int l = Math.min(par1ItemStack.stackSize, k); -- par1ItemStack.stackSize -= l; +- int k = p_145899_1_.getMaxStackSize() - itemstack1.stackSize; +- int l = Math.min(p_145899_1_.stackSize, k); +- p_145899_1_.stackSize -= l; - itemstack1.stackSize += l; - flag = l > 0; -+ int max = Math.min(par1ItemStack.getMaxStackSize(), par0IInventory.getInventoryStackLimit()); ++ //Forge: BUGFIX: Again, make things respect max stack sizes. ++ int max = Math.min(p_145899_1_.getMaxStackSize(), p_145899_0_.getInventoryStackLimit()); + if (max > itemstack1.stackSize) + { -+ int l = Math.min(par1ItemStack.stackSize, max - itemstack1.stackSize); -+ par1ItemStack.stackSize -= l; ++ int l = Math.min(p_145899_1_.stackSize, max - itemstack1.stackSize); ++ p_145899_1_.stackSize -= l; + itemstack1.stackSize += l; + flag = l > 0; + } diff --git a/patches/minecraft/net/minecraft/util/MovingObjectPosition.java.patch b/patches/minecraft/net/minecraft/util/MovingObjectPosition.java.patch index 45e18118a..5fb3f730d 100644 --- a/patches/minecraft/net/minecraft/util/MovingObjectPosition.java.patch +++ b/patches/minecraft/net/minecraft/util/MovingObjectPosition.java.patch @@ -1,17 +1,15 @@ --- ../src-base/minecraft/net/minecraft/util/MovingObjectPosition.java +++ ../src-work/minecraft/net/minecraft/util/MovingObjectPosition.java -@@ -27,7 +27,13 @@ - - /** The hit entity */ +@@ -20,6 +20,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(int par1, int par2, int par3, int par4, Vec3 par5Vec3) { - this.typeOfHit = EnumMovingObjectType.TILE; + this(par1, par2, par3, par4, par5Vec3, true); diff --git a/patches/minecraft/net/minecraft/util/Session.java.patch b/patches/minecraft/net/minecraft/util/Session.java.patch index 0945bcc01..68f2a1d4d 100644 --- a/patches/minecraft/net/minecraft/util/Session.java.patch +++ b/patches/minecraft/net/minecraft/util/Session.java.patch @@ -1,13 +1,13 @@ --- ../src-base/minecraft/net/minecraft/util/Session.java +++ ../src-work/minecraft/net/minecraft/util/Session.java -@@ -11,6 +11,19 @@ +@@ -14,6 +14,19 @@ - public Session(String par1Str, String par2Str) + public Session(String p_i45006_1_, String p_i45006_2_, String p_i45006_3_) { -+ if (par1Str == null || par1Str.isEmpty()) ++ if (p_i45006_1_ == null || p_i45006_1_.isEmpty()) + { -+ par1Str = "MissingName"; -+ par2Str = "NotValid"; ++ p_i45006_1_ = "MissingName"; ++ p_i45006_2_ = p_i45006_3_ = "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"); @@ -17,6 +17,6 @@ + System.out.println("========================================================="); + + } - this.username = par1Str; - this.sessionId = par2Str; - } + this.username = p_i45006_1_; + this.field_148257_b = p_i45006_2_; + this.field_148258_c = p_i45006_3_; diff --git a/patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch b/patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch index 23ec43a9d..8fd38ab46 100644 --- a/patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch +++ b/patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch @@ -1,16 +1,14 @@ --- ../src-base/minecraft/net/minecraft/util/WeightedRandomChestContent.java +++ ../src-work/minecraft/net/minecraft/util/WeightedRandomChestContent.java -@@ -4,6 +4,9 @@ - import net.minecraft.inventory.IInventory; +@@ -5,6 +5,7 @@ + import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntityDispenser; +import net.minecraftforge.common.ChestGenHooks; -+import net.minecraftforge.common.DungeonHooks; -+import cpw.mods.fml.common.FMLLog; - public class WeightedRandomChestContent extends WeightedRandomItem + public class WeightedRandomChestContent extends WeightedRandom.Item { -@@ -40,23 +43,12 @@ +@@ -38,23 +39,12 @@ for (int j = 0; j < par3; ++j) { WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(par0Random, par1ArrayOfWeightedRandomChestContent); @@ -37,20 +35,19 @@ } } -@@ -68,23 +60,12 @@ - for (int j = 0; j < par3; ++j) +@@ -64,22 +54,11 @@ { - WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(par0Random, par1ArrayOfWeightedRandomChestContent); -- int k = weightedrandomchestcontent.theMinimumChanceToGenerateItem + par0Random.nextInt(weightedrandomchestcontent.theMaximumChanceToGenerateItem - weightedrandomchestcontent.theMinimumChanceToGenerateItem + 1); -+ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(par0Random, par2TileEntityDispenser); - + WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(p_150706_0_, p_150706_1_); + int k = weightedrandomchestcontent.theMinimumChanceToGenerateItem + p_150706_0_.nextInt(weightedrandomchestcontent.theMaximumChanceToGenerateItem - weightedrandomchestcontent.theMinimumChanceToGenerateItem + 1); +- - if (weightedrandomchestcontent.theItemId.getMaxStackSize() >= k) ++ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(p_150706_0_, p_150706_2_); + for (ItemStack item : stacks) { - ItemStack itemstack = weightedrandomchestcontent.theItemId.copy(); - itemstack.stackSize = k; -- par2TileEntityDispenser.setInventorySlotContents(par0Random.nextInt(par2TileEntityDispenser.getSizeInventory()), itemstack); -+ par2TileEntityDispenser.setInventorySlotContents(par0Random.nextInt(par2TileEntityDispenser.getSizeInventory()), item); +- p_150706_2_.setInventorySlotContents(p_150706_0_.nextInt(p_150706_2_.getSizeInventory()), itemstack); ++ p_150706_2_.setInventorySlotContents(p_150706_0_.nextInt(p_150706_2_.getSizeInventory()), item); } - else - { @@ -58,13 +55,13 @@ - { - ItemStack itemstack1 = weightedrandomchestcontent.theItemId.copy(); - itemstack1.stackSize = 1; -- par2TileEntityDispenser.setInventorySlotContents(par0Random.nextInt(par2TileEntityDispenser.getSizeInventory()), itemstack1); +- p_150706_2_.setInventorySlotContents(p_150706_0_.nextInt(p_150706_2_.getSizeInventory()), itemstack1); - } - } } } -@@ -109,4 +90,18 @@ +@@ -104,4 +83,17 @@ return aweightedrandomchestcontent1; } @@ -81,5 +78,4 @@ + { + return ChestGenHooks.generateStacks(random, theItemId, theMinimumChanceToGenerateItem, theMaximumChanceToGenerateItem); + } -+ } diff --git a/patches/minecraft/net/minecraft/village/VillageCollection.java.patch b/patches/minecraft/net/minecraft/village/VillageCollection.java.patch index 0ddb52f6a..c0eff1ca4 100644 --- a/patches/minecraft/net/minecraft/village/VillageCollection.java.patch +++ b/patches/minecraft/net/minecraft/village/VillageCollection.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/village/VillageCollection.java +++ ../src-work/minecraft/net/minecraft/village/VillageCollection.java -@@ -165,7 +165,7 @@ +@@ -152,7 +152,7 @@ { Village village = (Village)iterator.next(); int j = (int)village.getCenter().getDistanceSquared(villagedoorinfo.posX, villagedoorinfo.posY, villagedoorinfo.posZ); - int k = 32 + village.getVillageRadius(); -+ float k = 32f + village.getVillageRadius(); ++ float k = 32f + village.getVillageRadius(); //BugFix: Avoid int wrapping if (j > k * k) { diff --git a/patches/minecraft/net/minecraft/world/ChunkCache.java.patch b/patches/minecraft/net/minecraft/world/ChunkCache.java.patch index 64894396e..91d302899 100644 --- a/patches/minecraft/net/minecraft/world/ChunkCache.java.patch +++ b/patches/minecraft/net/minecraft/world/ChunkCache.java.patch @@ -1,92 +1,56 @@ --- ../src-base/minecraft/net/minecraft/world/ChunkCache.java +++ ../src-work/minecraft/net/minecraft/world/ChunkCache.java -@@ -8,6 +8,7 @@ +@@ -9,6 +9,7 @@ import net.minecraft.util.Vec3Pool; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.chunk.Chunk; -+import net.minecraftforge.common.ForgeDirection; ++import net.minecraftforge.common.util.ForgeDirection; public class ChunkCache implements IBlockAccess { -@@ -108,7 +109,15 @@ +@@ -95,6 +96,8 @@ { - int l = (par1 >> 4) - this.chunkX; - int i1 = (par3 >> 4) - this.chunkZ; -- return this.chunkArray[l][i1].getChunkBlockTileEntity(par1 & 15, par2, par3 & 15); -+ if (l >= 0 && l < this.chunkArray.length && i1 >= 0 && i1 < this.chunkArray[l].length) -+ { -+ Chunk chunk = this.chunkArray[l][i1]; -+ return chunk == null ? null : chunk.getChunkBlockTileEntity(par1 & 15, par2, par3 & 15); -+ } -+ else -+ { -+ return null; -+ } + int l = (p_147438_1_ >> 4) - this.chunkX; + int i1 = (p_147438_3_ >> 4) - this.chunkZ; ++ if (l < 0 || l >= chunkArray.length || i1 < 0 || i1 >= chunkArray[l].length) return null; ++ if (chunkArray[l][i1] == null) return null; + return this.chunkArray[l][i1].func_150806_e(p_147438_1_ & 15, p_147438_2_, p_147438_3_ & 15); } - @SideOnly(Side.CLIENT) -@@ -159,7 +168,12 @@ +@@ -128,6 +131,8 @@ { int l = (par1 >> 4) - this.chunkX; int i1 = (par3 >> 4) - this.chunkZ; -- return this.chunkArray[l][i1].getBlockMetadata(par1 & 15, par2, par3 & 15); -+ if (l >= 0 && l < this.chunkArray.length && i1 >= 0 && i1 < this.chunkArray[l].length) -+ { -+ Chunk chunk = this.chunkArray[l][i1]; -+ return chunk == null ? 0 : chunk.getBlockMetadata(par1 & 15, par2, par3 & 15); -+ } -+ return 0; ++ if (l < 0 || l >= chunkArray.length || i1 < 0 || i1 >= chunkArray[l].length) return 0; ++ if (chunkArray[l][i1] == null) return 0; + return this.chunkArray[l][i1].getBlockMetadata(par1 & 15, par2, par3 & 15); } } - -@@ -306,8 +320,7 @@ - */ - public boolean doesBlockHaveSolidTopSurface(int par1, int par2, int par3) - { -- Block block = Block.blocksList[this.getBlockId(par1, par2, par3)]; -- return this.worldObj.isBlockTopFacingSurfaceSolid(block, this.getBlockMetadata(par1, par2, par3)); -+ return this.worldObj.doesBlockHaveSolidTopSurface(par1, par2, par3); - } - - /** -@@ -318,15 +331,13 @@ +@@ -145,10 +150,9 @@ return this.worldObj.getWorldVec3Pool(); } - @SideOnly(Side.CLIENT) -- - /** - * Returns true if the block at the specified coordinates is empty - */ - public boolean isAirBlock(int par1, int par2, int par3) + public boolean func_147437_c(int p_147437_1_, int p_147437_2_, int p_147437_3_) { -- Block block = Block.blocksList[this.getBlockId(par1, par2, par3)]; -- return block == null; -+ int id = getBlockId(par1, par2, par3); -+ return id == 0 || Block.blocksList[id] == null || Block.blocksList[id].isAirBlock(this.worldObj, par1, par2, par3); +- return this.func_147439_a(p_147437_1_, p_147437_2_, p_147437_3_).func_149688_o() == Material.field_151579_a; ++ return this.func_147439_a(p_147437_1_, p_147437_2_, p_147437_3_).isAir(this, p_147437_1_, p_147437_2_, p_147437_3_); } - @SideOnly(Side.CLIENT) -@@ -449,4 +460,22 @@ - int i1 = this.getBlockId(par1, par2, par3); - return i1 == 0 ? 0 : Block.blocksList[i1].isProvidingStrongPower(this, par1, par2, par3, par4); + // JAVADOC METHOD $$ func_72810_a +@@ -258,4 +262,15 @@ + { + return this.func_147439_a(par1, par2, par3).func_149748_c(this, par1, par2, par3, par4); } + -+ public boolean isBlockSolidOnSide(int x, int y, int z, ForgeDirection side, boolean _default) ++ @Override ++ public boolean isSideSolid(int x, int y, int z, ForgeDirection side, boolean _default) + { + if (x < -30000000 || z < -30000000 || x >= 30000000 || z >= 30000000) + { + return _default; + } + -+ int blockId = getBlockId(x, y, z); -+ Block block = Block.blocksList[blockId]; -+ -+ if (block != null) -+ { -+ return block.isBlockSolidOnSide(this.worldObj, x, y, z, side); -+ } -+ -+ return false; ++ return func_147439_a(x, y, z).isSideSolid(this, x, y, z, side); + } } diff --git a/patches/minecraft/net/minecraft/world/Explosion.java.patch b/patches/minecraft/net/minecraft/world/Explosion.java.patch index 6f71cfff0..6f0dab817 100644 --- a/patches/minecraft/net/minecraft/world/Explosion.java.patch +++ b/patches/minecraft/net/minecraft/world/Explosion.java.patch @@ -1,20 +1,20 @@ --- ../src-base/minecraft/net/minecraft/world/Explosion.java +++ ../src-work/minecraft/net/minecraft/world/Explosion.java -@@ -92,7 +92,7 @@ - if (k1 > 0) +@@ -90,7 +90,7 @@ + + if (block.func_149688_o() != Material.field_151579_a) { - Block block = Block.blocksList[k1]; -- float f3 = this.exploder != null ? this.exploder.getBlockExplosionResistance(this, this.worldObj, l, i1, j1, block) : block.getExplosionResistance(this.exploder); -+ float f3 = this.exploder != null ? this.exploder.getBlockExplosionResistance(this, this.worldObj, l, i1, j1, block) : block.getExplosionResistance(this.exploder, worldObj, l, i1, j1, explosionX, explosionY, explosionZ); +- float f3 = this.exploder != null ? this.exploder.func_145772_a(this, this.worldObj, j1, k1, l1, block) : block.func_149638_a(this.exploder); ++ float f3 = this.exploder != null ? this.exploder.func_145772_a(this, this.worldObj, j1, k1, l1, block) : block.getExplosionResistance(this.exploder, worldObj, j1, k1, l1, explosionX, explosionY, explosionZ); f1 -= (f3 + 0.3F) * f2; } -@@ -222,8 +222,7 @@ - block.dropBlockAsItemWithChance(this.worldObj, i, j, k, this.worldObj.getBlockMetadata(i, j, k), 1.0F / this.explosionSize, 0); +@@ -216,8 +216,7 @@ + block.func_149690_a(this.worldObj, i, j, k, this.worldObj.getBlockMetadata(i, j, k), 1.0F / this.explosionSize, 0); } -- this.worldObj.setBlock(i, j, k, 0, 0, 3); -- block.onBlockDestroyedByExplosion(this.worldObj, i, j, k, this); +- this.worldObj.func_147465_d(i, j, k, Blocks.air, 0, 3); +- block.func_149723_a(this.worldObj, i, j, k, this); + block.onBlockExploded(this.worldObj, i, j, k, this); } } diff --git a/patches/minecraft/net/minecraft/world/IBlockAccess.java.patch b/patches/minecraft/net/minecraft/world/IBlockAccess.java.patch index 36274d664..31a82fd09 100644 --- a/patches/minecraft/net/minecraft/world/IBlockAccess.java.patch +++ b/patches/minecraft/net/minecraft/world/IBlockAccess.java.patch @@ -4,26 +4,25 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Vec3Pool; import net.minecraft.world.biome.BiomeGenBase; -+import net.minecraftforge.common.ForgeDirection; ++import net.minecraftforge.common.util.ForgeDirection; public interface IBlockAccess { -@@ -59,8 +60,6 @@ - */ - boolean isBlockNormalCube(int i, int j, int k); +@@ -20,7 +21,6 @@ + // JAVADOC METHOD $$ func_72805_g + int getBlockMetadata(int var1, int var2, int var3); - @SideOnly(Side.CLIENT) -- - /** - * Returns true if the block at the specified coordinates is empty - */ -@@ -103,4 +102,16 @@ - * Is this block powering in the specified direction Args: x, y, z, direction - */ - int isBlockProvidingPowerTo(int i, int j, int k, int l); + boolean func_147437_c(int var1, int var2, int var3); + + // JAVADOC METHOD $$ func_72807_a +@@ -40,4 +40,16 @@ + + // JAVADOC METHOD $$ func_72879_k + int isBlockProvidingPowerTo(int var1, int var2, int var3, int var4); + + /** -+ * FORGE: isBlockSolidOnSide, pulled up from {@link World} ++ * FORGE: isSideSolid, pulled up from {@link World} + * + * @param x X coord + * @param y Y coord @@ -32,5 +31,5 @@ + * @param _default default return value + * @return if the block is solid on the side + */ -+ boolean isBlockSolidOnSide(int x, int y, int z, ForgeDirection side, boolean _default); ++ boolean isSideSolid(int x, int y, int z, ForgeDirection side, boolean _default); } diff --git a/patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch b/patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch index 2b328f2d9..e051643bb 100644 --- a/patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch +++ b/patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch @@ -8,20 +8,19 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; -@@ -17,6 +19,10 @@ - import net.minecraft.world.biome.SpawnListEntry; +@@ -17,6 +19,9 @@ + import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.chunk.Chunk; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.Event.Result; ++import cpw.mods.fml.common.eventhandler.Event.Result; +import net.minecraftforge.event.ForgeEventFactory; + public final class SpawnerAnimals { - /** The 17x17 area around the player where mobs can spawn */ -@@ -85,9 +91,12 @@ + // JAVADOC FIELD $$ field_77193_b +@@ -80,9 +85,12 @@ { - EnumCreatureType enumcreaturetype = aenumcreaturetype[j1]; + EnumCreatureType enumcreaturetype = aenumcreaturetype[k3]; - if ((!enumcreaturetype.getPeacefulCreature() || par3) && (enumcreaturetype.getPeacefulCreature() || par2) && (!enumcreaturetype.getAnimal() || par4) && par1WorldServer.countEntities(enumcreaturetype.getCreatureClass()) <= enumcreaturetype.getMaxNumberOfCreature() * this.eligibleChunksForSpawning.size() / 256) + if ((!enumcreaturetype.getPeacefulCreature() || par3) && (enumcreaturetype.getPeacefulCreature() || par2) && (!enumcreaturetype.getAnimal() || par4) && par1WorldServer.countEntities(enumcreaturetype, true) <= enumcreaturetype.getMaxNumberOfCreature() * this.eligibleChunksForSpawning.size() / 256) @@ -33,34 +32,36 @@ label110: while (iterator.hasNext()) -@@ -165,13 +174,17 @@ +@@ -159,14 +167,18 @@ + } entityliving.setLocationAndAngles((double)f, (double)f1, (double)f2, par1WorldServer.rand.nextFloat() * 360.0F, 0.0F); - +- - if (entityliving.getCanSpawnHere()) ++ + Result canSpawn = ForgeEventFactory.canEntitySpawn(entityliving, par1WorldServer, f, f1, f2); + if (canSpawn == Result.ALLOW || (canSpawn == Result.DEFAULT && entityliving.getCanSpawnHere())) { - ++j2; + ++i2; par1WorldServer.spawnEntityInWorld(entityliving); -- entitylivingdata = entityliving.onSpawnWithEgg(entitylivingdata); +- ientitylivingdata = entityliving.onSpawnWithEgg(ientitylivingdata); + if (!ForgeEventFactory.doSpecialSpawn(entityliving, par1WorldServer, f, f1, f2)) + { -+ entitylivingdata = entityliving.onSpawnWithEgg(entitylivingdata); ++ ientitylivingdata = entityliving.onSpawnWithEgg(ientitylivingdata); + } -- if (j2 >= entityliving.getMaxSpawnedInChunk()) +- if (i2 >= entityliving.getMaxSpawnedInChunk()) + if (j2 >= ForgeEventFactory.getMaxSpawnPackSize(entityliving)) { continue label110; } -@@ -217,7 +230,8 @@ +@@ -210,7 +222,8 @@ else { - int l = par1World.getBlockId(par2, par3 - 1, par4); -- return l != Block.bedrock.blockID && !par1World.isBlockNormalCube(par2, par3, par4) && !par1World.getBlockMaterial(par2, par3, par4).isLiquid() && !par1World.isBlockNormalCube(par2, par3 + 1, par4); -+ boolean spawnBlock = (Block.blocksList[l] != null && Block.blocksList[l].canCreatureSpawn(par0EnumCreatureType, par1World, par2, par3 - 1, par4)); -+ return spawnBlock && l != Block.bedrock.blockID && !par1World.isBlockNormalCube(par2, par3, par4) && !par1World.getBlockMaterial(par2, par3, par4).isLiquid() && !par1World.isBlockNormalCube(par2, par3 + 1, par4); + Block block = par1World.func_147439_a(par2, par3 - 1, par4); +- return block != Blocks.bedrock && !par1World.func_147439_a(par2, par3, par4).func_149721_r() && !par1World.func_147439_a(par2, par3, par4).func_149688_o().isLiquid() && !par1World.func_147439_a(par2, par3 + 1, par4).func_149721_r(); ++ boolean spawnBlock = block.canCreatureSpawn(par0EnumCreatureType, par1World, par2, par3, par4); ++ return spawnBlock && block != Blocks.bedrock && !par1World.func_147439_a(par2, par3, par4).func_149721_r() && !par1World.func_147439_a(par2, par3, par4).func_149688_o().isLiquid() && !par1World.func_147439_a(par2, par3 + 1, par4).func_149721_r(); } } diff --git a/patches/minecraft/net/minecraft/world/World.java.patch b/patches/minecraft/net/minecraft/world/World.java.patch index dfa11c165..24d321477 100644 --- a/patches/minecraft/net/minecraft/world/World.java.patch +++ b/patches/minecraft/net/minecraft/world/World.java.patch @@ -1,25 +1,20 @@ --- ../src-base/minecraft/net/minecraft/world/World.java +++ ../src-work/minecraft/net/minecraft/world/World.java -@@ -1,5 +1,6 @@ - package net.minecraft.world; - -+import cpw.mods.fml.common.FMLLog; - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; - import java.util.ArrayList; -@@ -53,9 +54,34 @@ +@@ -52,8 +52,35 @@ import net.minecraft.world.storage.MapStorage; import net.minecraft.world.storage.WorldInfo; ++import cpw.mods.fml.common.FMLLog; ++ +import com.google.common.collect.ImmutableSetMultimap; + +import net.minecraftforge.client.ForgeHooksClient; +import net.minecraftforge.common.ForgeChunkManager; +import net.minecraftforge.common.ForgeChunkManager.Ticket; -+import net.minecraftforge.common.ForgeDummyContainer; ++import net.minecraftforge.common.ForgeModContainer; +import net.minecraftforge.common.ForgeHooks; +import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.common.ForgeDirection; ++import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.common.WorldSpecificSaveHandler; +import net.minecraftforge.event.entity.EntityEvent; +import net.minecraftforge.event.entity.EntityJoinWorldEvent; @@ -29,7 +24,7 @@ + public abstract class World implements IBlockAccess { - /** ++ /** + * Used in the getEntitiesWithinAABB functions to expand the search area for entities. + * Modders should change this variable to a higher value if it is less then the radius + * of one of there entities. @@ -38,30 +33,27 @@ + + public final MapStorage perWorldStorage; + -+ /** - * boolean; if true updates scheduled by scheduleBlockUpdate happen immediately - */ + // JAVADOC FIELD $$ field_72999_e public boolean scheduledUpdatesAreImmediate; -@@ -167,6 +193,11 @@ - */ - public BiomeGenBase getBiomeGenForCoords(int par1, int par2) + // JAVADOC FIELD $$ field_72996_f +@@ -120,6 +147,11 @@ + // JAVADOC METHOD $$ func_72807_a + public BiomeGenBase getBiomeGenForCoords(final int par1, final int par2) { + return provider.getBiomeGenForCoords(par1, par2); + } + -+ public BiomeGenBase getBiomeGenForCoordsBody(int par1, int par2) ++ public BiomeGenBase getBiomeGenForCoordsBody(final int par1, final int par2) + { if (this.blockExists(par1, 0, par2)) { Chunk chunk = this.getChunkFromBlockCoords(par1, par2); -@@ -194,8 +225,15 @@ - this.theProfiler = par5Profiler; - this.worldInfo = new WorldInfo(par4WorldSettings, par2Str); - this.provider = par3WorldProvider; -- this.mapStorage = new MapStorage(par1ISaveHandler); +@@ -166,7 +198,13 @@ + this.theProfiler = p_i45368_5_; + this.worldInfo = new WorldInfo(p_i45368_4_, p_i45368_2_); + this.provider = p_i45368_3_; +- this.mapStorage = new MapStorage(p_i45368_1_); + perWorldStorage = new MapStorage((ISaveHandler)null); - this.worldLogAgent = par6ILogAgent; -+ + } + + // Broken up so that the WorldClient gets the chance to set the mapstorage object before the dimension initializes @@ -71,12 +63,11 @@ VillageCollection villagecollection = (VillageCollection)this.mapStorage.loadData(VillageCollection.class, "villages"); if (villagecollection == null) -@@ -208,8 +246,10 @@ - this.villageCollectionObj = villagecollection; +@@ -180,7 +218,10 @@ this.villageCollectionObj.func_82566_a(this); } -- -- par3WorldProvider.registerWorld(this); + +- p_i45368_3_.registerWorld(this); + // Guarantee the dimension ID was not reset by the provider + int providerDim = this.provider.dimensionId; + this.provider.registerWorld(this); @@ -84,36 +75,37 @@ this.chunkProvider = this.createChunkProvider(); this.calculateInitialSkylight(); this.calculateInitialWeather(); -@@ -221,7 +261,7 @@ +@@ -195,7 +236,7 @@ this.lightUpdateBlockList = new int[32768]; - this.saveHandler = par1ISaveHandler; - this.theProfiler = par5Profiler; -- this.mapStorage = new MapStorage(par1ISaveHandler); -+ this.mapStorage = getMapStorage(par1ISaveHandler); - this.worldLogAgent = par6ILogAgent; - this.worldInfo = par1ISaveHandler.loadWorldInfo(); - -@@ -249,6 +289,14 @@ + this.saveHandler = p_i45369_1_; + this.theProfiler = p_i45369_5_; +- this.mapStorage = new MapStorage(p_i45369_1_); ++ this.mapStorage = getMapStorage(p_i45369_1_); + this.worldInfo = p_i45369_1_.loadWorldInfo(); + if (p_i45369_4_ != null) +@@ -223,6 +264,15 @@ this.provider.registerWorld(this); this.chunkProvider = this.createChunkProvider(); + + if (this instanceof WorldServer) + { -+ this.perWorldStorage = new MapStorage(new WorldSpecificSaveHandler((WorldServer)this, par1ISaveHandler)); ++ this.perWorldStorage = new MapStorage(new WorldSpecificSaveHandler((WorldServer)this, p_i45369_1_)); + } + else + { + this.perWorldStorage = new MapStorage((ISaveHandler)null); + } - ++ if (!this.worldInfo.isInitialized()) { -@@ -275,12 +323,12 @@ + try +@@ -248,12 +298,12 @@ this.worldInfo.setServerInitialized(true); } - VillageCollection villagecollection = (VillageCollection)this.mapStorage.loadData(VillageCollection.class, "villages"); -+ VillageCollection villagecollection = (VillageCollection)perWorldStorage.loadData(VillageCollection.class, "villages"); ++ VillageCollection villagecollection = (VillageCollection)this.perWorldStorage.loadData(VillageCollection.class, "villages"); if (villagecollection == null) { @@ -123,7 +115,7 @@ } else { -@@ -292,6 +340,20 @@ +@@ -265,6 +315,20 @@ this.calculateInitialWeather(); } @@ -141,49 +133,30 @@ + return s_mapStorage; + } + - /** - * Creates the chunk provider for this world. Called in the constructor. Retrieves provider from worldProvider? - */ -@@ -373,7 +435,8 @@ - */ - public boolean isAirBlock(int par1, int par2, int par3) + // JAVADOC METHOD $$ func_72970_h + protected abstract IChunkProvider createChunkProvider(); + +@@ -320,7 +384,8 @@ + + public boolean func_147437_c(int p_147437_1_, int p_147437_2_, int p_147437_3_) { -- return this.getBlockId(par1, par2, par3) == 0; -+ int id = getBlockId(par1, par2, par3); -+ return id == 0 || Block.blocksList[id] == null || Block.blocksList[id].isAirBlock(this, par1, par2, par3); +- return this.func_147439_a(p_147437_1_, p_147437_2_, p_147437_3_).func_149688_o() == Material.field_151579_a; ++ Block block = this.func_147439_a(p_147437_1_, p_147437_2_, p_147437_3_); ++ return block.isAir(this, p_147437_1_, p_147437_2_, p_147437_3_); } - /** -@@ -382,7 +445,8 @@ - public boolean blockHasTileEntity(int par1, int par2, int par3) - { - int l = this.getBlockId(par1, par2, par3); -- return Block.blocksList[l] != null && Block.blocksList[l].hasTileEntity(); -+ int meta = this.getBlockMetadata(par1, par2, par3); -+ return Block.blocksList[l] != null && Block.blocksList[l].hasTileEntity(meta); - } - - /** -@@ -1157,7 +1221,7 @@ - */ + // JAVADOC METHOD $$ func_72899_e +@@ -973,7 +1038,7 @@ + // JAVADOC METHOD $$ func_72935_r public boolean isDaytime() { - return this.skylightSubtracted < 4; + return provider.isDaytime(); } - /** -@@ -1192,7 +1256,7 @@ - int l1 = this.getBlockMetadata(l, i1, j1); - Block block = Block.blocksList[k1]; - -- if ((!par4 || block == null || block.getCollisionBoundingBoxFromPool(this, l, i1, j1) != null) && k1 > 0 && block.canCollideCheck(l1, par3)) -+ if (block != null && (!par4 || block == null || block.getCollisionBoundingBoxFromPool(this, l, i1, j1) != null) && k1 > 0 && block.canCollideCheck(l1, par3)) - { - MovingObjectPosition movingobjectposition = block.collisionRayTrace(this, l, i1, j1, par1Vec3, par2Vec3); - -@@ -1392,6 +1456,12 @@ - */ + // JAVADOC METHOD $$ func_72933_a +@@ -1207,6 +1272,12 @@ + // JAVADOC METHOD $$ func_72956_a public void playSoundAtEntity(Entity par1Entity, String par2Str, float par3, float par4) { + PlaySoundAtEntityEvent event = new PlaySoundAtEntityEvent(par1Entity, par2Str, par3, par4); @@ -192,11 +165,11 @@ + return; + } + par2Str = event.name; - if (par1Entity != null && par2Str != null) + for (int i = 0; i < this.worldAccesses.size(); ++i) { - for (int i = 0; i < this.worldAccesses.size(); ++i) -@@ -1406,6 +1476,12 @@ - */ + ((IWorldAccess)this.worldAccesses.get(i)).playSound(par2Str, par1Entity.posX, par1Entity.posY - (double)par1Entity.yOffset, par1Entity.posZ, par3, par4); +@@ -1216,6 +1287,12 @@ + // JAVADOC METHOD $$ func_85173_a public void playSoundToNearExcept(EntityPlayer par1EntityPlayer, String par2Str, float par3, float par4) { + PlaySoundAtEntityEvent event = new PlaySoundAtEntityEvent(par1EntityPlayer, par2Str, par3, par4); @@ -205,23 +178,27 @@ + return; + } + par2Str = event.name; - if (par1EntityPlayer != null && par2Str != null) + for (int i = 0; i < this.worldAccesses.size(); ++i) { - for (int i = 0; i < this.worldAccesses.size(); ++i) -@@ -1494,6 +1570,11 @@ + ((IWorldAccess)this.worldAccesses.get(i)).playSoundToNearExcept(par1EntityPlayer, par2Str, par1EntityPlayer.posX, par1EntityPlayer.posY - (double)par1EntityPlayer.yOffset, par1EntityPlayer.posZ, par3, par4); +@@ -1283,6 +1360,7 @@ + this.playerEntities.add(entityplayer); this.updateAllPlayersSleepingFlag(); } ++ if (MinecraftForge.EVENT_BUS.post(new EntityJoinWorldEvent(par1Entity, this)) && !flag) return false; -+ if (MinecraftForge.EVENT_BUS.post(new EntityJoinWorldEvent(par1Entity, this)) && !flag) -+ { -+ return false; -+ } -+ this.getChunkFromChunkCoords(i, j).addEntity(par1Entity); this.loadedEntityList.add(par1Entity); - this.onEntityAdded(par1Entity); -@@ -1733,6 +1814,12 @@ - */ +@@ -1479,7 +1557,6 @@ + } + + // JAVADOC METHOD $$ func_72848_b +- @SideOnly(Side.CLIENT) + public void removeWorldAccess(IWorldAccess par1IWorldAccess) + { + this.worldAccesses.remove(par1IWorldAccess); +@@ -1512,6 +1589,12 @@ + @SideOnly(Side.CLIENT) public Vec3 getSkyColor(Entity par1Entity, float par2) { + return provider.getSkyColor(par1Entity, par2); @@ -233,30 +210,18 @@ float f1 = this.getCelestialAngle(par2); float f2 = MathHelper.cos(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F; -@@ -1745,15 +1832,15 @@ - { - f2 = 1.0F; - } -- -+ +@@ -1528,9 +1611,7 @@ int i = MathHelper.floor_double(par1Entity.posX); - int j = MathHelper.floor_double(par1Entity.posZ); -- BiomeGenBase biomegenbase = this.getBiomeGenForCoords(i, j); -- float f3 = biomegenbase.getFloatTemperature(); -- int k = biomegenbase.getSkyColorByTemp(f3); -- float f4 = (float)(k >> 16 & 255) / 255.0F; -- float f5 = (float)(k >> 8 & 255) / 255.0F; -- float f6 = (float)(k & 255) / 255.0F; -+ -+ int multiplier = ForgeHooksClient.getSkyBlendColour(this, i, j); -+ -+ float f4 = (float)(multiplier >> 16 & 255) / 255.0F; -+ float f5 = (float)(multiplier >> 8 & 255) / 255.0F; -+ float f6 = (float)(multiplier & 255) / 255.0F; - f4 *= f2; - f5 *= f2; - f6 *= f2; -@@ -1833,6 +1920,12 @@ + int j = MathHelper.floor_double(par1Entity.posY); + int k = MathHelper.floor_double(par1Entity.posZ); +- BiomeGenBase biomegenbase = this.getBiomeGenForCoords(i, k); +- float f3 = biomegenbase.func_150564_a(i, j, k); +- int l = biomegenbase.getSkyColorByTemp(f3); ++ int l = ForgeHooksClient.getSkyBlendColour(this, i, j, k); + float f4 = (float)(l >> 16 & 255) / 255.0F; + float f5 = (float)(l >> 8 & 255) / 255.0F; + float f6 = (float)(l & 255) / 255.0F; +@@ -1607,6 +1688,12 @@ @SideOnly(Side.CLIENT) public Vec3 getCloudColour(float par1) { @@ -269,7 +234,7 @@ float f1 = this.getCelestialAngle(par1); float f2 = MathHelper.cos(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F; -@@ -1904,6 +1997,8 @@ +@@ -1671,6 +1758,8 @@ public int getTopSolidOrLiquidBlock(int par1, int par2) { Chunk chunk = this.getChunkFromBlockCoords(par1, par2); @@ -278,17 +243,17 @@ int k = chunk.getTopFilledSegment() + 15; par1 &= 15; -@@ -1911,7 +2006,7 @@ +@@ -1678,7 +1767,7 @@ { - int l = chunk.getBlockID(par1, k, par2); + Block block = chunk.func_150810_a(par1, k, par2); -- if (l != 0 && Block.blocksList[l].blockMaterial.blocksMovement() && Block.blocksList[l].blockMaterial != Material.leaves) -+ if (l != 0 && Block.blocksList[l].blockMaterial.blocksMovement() && Block.blocksList[l].blockMaterial != Material.leaves && !Block.blocksList[l].isBlockFoliage(this, x, k, z)) +- if (block.func_149688_o().blocksMovement() && block.func_149688_o() != Material.field_151584_j) ++ if (block.func_149688_o().blocksMovement() && block.func_149688_o() != Material.field_151584_j && !block.isFoliage(this, x, k, z)) { return k + 1; } -@@ -1927,6 +2022,12 @@ - */ +@@ -1691,6 +1780,12 @@ + @SideOnly(Side.CLIENT) public float getStarBrightness(float par1) { + return provider.getStarBrightness(par1); @@ -300,12 +265,12 @@ float f1 = this.getCelestialAngle(par1); float f2 = 1.0F - (MathHelper.cos(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.25F); -@@ -1990,7 +2091,15 @@ +@@ -1746,7 +1841,15 @@ entity.addEntityCrashInfo(crashreportcategory); } - throw new ReportedException(crashreport); -+ if (ForgeDummyContainer.removeErroringEntities) ++ if (ForgeModContainer.removeErroringEntities) + { + FMLLog.severe(crashreport.getCompleteReport()); + removeEntity(entity); @@ -317,13 +282,13 @@ } if (entity.isDead) -@@ -2052,7 +2161,16 @@ +@@ -1808,7 +1911,16 @@ crashreport = CrashReport.makeCrashReport(throwable1, "Ticking entity"); crashreportcategory = crashreport.makeCategory("Entity being ticked"); entity.addEntityCrashInfo(crashreportcategory); - throw new ReportedException(crashreport); + -+ if (ForgeDummyContainer.removeErroringEntities) ++ if (ForgeModContainer.removeErroringEntities) + { + FMLLog.severe(crashreport.getCompleteReport()); + removeEntity(entity); @@ -335,16 +300,16 @@ } } -@@ -2095,7 +2213,16 @@ - crashreport = CrashReport.makeCrashReport(throwable2, "Ticking tile entity"); - crashreportcategory = crashreport.makeCategory("Tile entity being ticked"); - tileentity.func_85027_a(crashreportcategory); +@@ -1851,7 +1963,16 @@ + crashreport = CrashReport.makeCrashReport(throwable, "Ticking block entity"); + crashreportcategory = crashreport.makeCategory("Block entity being ticked"); + tileentity.func_145828_a(crashreportcategory); - throw new ReportedException(crashreport); -+ if (ForgeDummyContainer.removeErroringTileEntities) ++ if (ForgeModContainer.removeErroringTileEntities) + { + FMLLog.severe(crashreport.getCompleteReport()); -+ tileentity.invalidate(); -+ setBlockToAir(tileentity.xCoord, tileentity.yCoord, tileentity.zCoord); ++ tileentity.func_145843_s(); ++ func_147468_f(tileentity.field_145851_c, tileentity.field_145848_d, tileentity.field_145849_e); + } + else + { @@ -353,236 +318,192 @@ } } -@@ -2109,7 +2236,7 @@ +@@ -1865,7 +1986,7 @@ if (chunk != null) { -- chunk.removeChunkBlockTileEntity(tileentity.xCoord & 15, tileentity.yCoord, tileentity.zCoord & 15); -+ chunk.cleanChunkBlockTileEntity(tileentity.xCoord & 15, tileentity.yCoord, tileentity.zCoord & 15); +- chunk.func_150805_f(tileentity.field_145851_c & 15, tileentity.field_145848_d, tileentity.field_145849_e & 15); ++ chunk.removeInvalidTileEntity(tileentity.field_145851_c & 15, tileentity.field_145848_d, tileentity.field_145849_e & 15); } } } -@@ -2118,6 +2245,10 @@ +@@ -1873,6 +1994,10 @@ - if (!this.entityRemoval.isEmpty()) + if (!this.field_147483_b.isEmpty()) { -+ for (Object tile : entityRemoval) ++ for (Object tile : field_147483_b) + { + ((TileEntity)tile).onChunkUnload(); + } - this.loadedTileEntityList.removeAll(this.entityRemoval); - this.entityRemoval.clear(); + this.field_147482_g.removeAll(this.field_147483_b); + this.field_147483_b.clear(); } -@@ -2138,18 +2269,18 @@ +@@ -1893,18 +2018,18 @@ { - this.loadedTileEntityList.add(tileentity1); + this.field_147482_g.add(tileentity1); } - + } + else + { - if (this.chunkExists(tileentity1.xCoord >> 4, tileentity1.zCoord >> 4)) + if (this.chunkExists(tileentity1.field_145851_c >> 4, tileentity1.field_145849_e >> 4)) { - Chunk chunk1 = this.getChunkFromChunkCoords(tileentity1.xCoord >> 4, tileentity1.zCoord >> 4); + Chunk chunk1 = this.getChunkFromChunkCoords(tileentity1.field_145851_c >> 4, tileentity1.field_145849_e >> 4); if (chunk1 != null) { -- chunk1.setChunkBlockTileEntity(tileentity1.xCoord & 15, tileentity1.yCoord, tileentity1.zCoord & 15, tileentity1); -+ chunk1.cleanChunkBlockTileEntity(tileentity1.xCoord & 15, tileentity1.yCoord, tileentity1.zCoord & 15); +- chunk1.func_150812_a(tileentity1.field_145851_c & 15, tileentity1.field_145848_d, tileentity1.field_145849_e & 15, tileentity1); ++ chunk1.removeInvalidTileEntity(tileentity1.field_145851_c & 15, tileentity1.field_145848_d, tileentity1.field_145849_e & 15); } } - -- this.markBlockForUpdate(tileentity1.xCoord, tileentity1.yCoord, tileentity1.zCoord); +- this.func_147471_g(tileentity1.field_145851_c, tileentity1.field_145848_d, tileentity1.field_145849_e); } } -@@ -2162,14 +2293,14 @@ +@@ -1917,14 +2042,11 @@ - public void addTileEntity(Collection par1Collection) + public void func_147448_a(Collection p_147448_1_) { -- if (this.scanningTileEntities) -+ List dest = scanningTileEntities ? addedTileEntityList : loadedTileEntityList; -+ for(Object entity : par1Collection) +- if (this.field_147481_N) ++ List dest = field_147481_N ? field_147484_a : field_147482_g; ++ for(TileEntity entity : (Collection)p_147448_1_) { -- this.addedTileEntityList.addAll(par1Collection); -+ if(((TileEntity)entity).canUpdate()) -+ { -+ dest.add(entity); -+ } +- this.field_147484_a.addAll(p_147448_1_); ++ if(entity.canUpdate()) dest.add(entity); } - else - { -- this.loadedTileEntityList.addAll(par1Collection); +- this.field_147482_g.addAll(p_147448_1_); - } } - /** -@@ -2188,10 +2319,18 @@ + // JAVADOC METHOD $$ func_72870_g +@@ -1938,10 +2060,19 @@ { int i = MathHelper.floor_double(par1Entity.posX); int j = MathHelper.floor_double(par1Entity.posZ); - byte b0 = 32; - -- if (!par2 || this.checkChunksExist(i - b0, 0, j - b0, i + b0, 0, j + b0)) + boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(i >> 4, j >> 4)); + byte b0 = isForced ? (byte)0 : 32; + boolean canUpdate = !par2 || this.checkChunksExist(i - b0, 0, j - b0, i + b0, 0, j + b0); + +- if (!par2 || this.checkChunksExist(i - b0, 0, j - b0, i + b0, 0, j + b0)) + if (!canUpdate) { + EntityEvent.CanUpdate event = new EntityEvent.CanUpdate(par1Entity); + MinecraftForge.EVENT_BUS.post(event); + canUpdate = event.canUpdate; + } ++ + if (canUpdate) + { par1Entity.lastTickPosX = par1Entity.posX; par1Entity.lastTickPosY = par1Entity.posY; par1Entity.lastTickPosZ = par1Entity.posZ; -@@ -2424,6 +2563,14 @@ +@@ -2163,6 +2294,10 @@ { return true; } + else + { -+ Block block = Block.blocksList[j2]; -+ if (block != null && block.isBlockBurning(this, k1, l1, i2)) -+ { -+ return true; -+ } ++ if (block.isBurning(this, k1, l1, i2)) return true; + } } } } -@@ -2746,15 +2893,16 @@ - */ - public void setBlockTileEntity(int par1, int par2, int par3, TileEntity par4TileEntity) +@@ -2456,13 +2591,15 @@ + + public void func_147455_a(int p_147455_1_, int p_147455_2_, int p_147455_3_, TileEntity p_147455_4_) { -- if (par4TileEntity != null && !par4TileEntity.isInvalid()) -+ if (par4TileEntity == null || par4TileEntity.isInvalid()) +- if (p_147455_4_ != null && !p_147455_4_.func_145837_r()) ++ if (p_147455_4_ == null || p_147455_4_.func_145837_r()) { -- if (this.scanningTileEntities) -- { -- par4TileEntity.xCoord = par1; -- par4TileEntity.yCoord = par2; -- par4TileEntity.zCoord = par3; -- Iterator iterator = this.addedTileEntityList.iterator(); + return; + } - -+ if (par4TileEntity.canUpdate()) ++ ++ if (p_147455_4_.canUpdate()) + { -+ if (scanningTileEntities) -+ { -+ Iterator iterator = addedTileEntityList.iterator(); + if (this.field_147481_N) + { +- p_147455_4_.field_145851_c = p_147455_1_; +- p_147455_4_.field_145848_d = p_147455_2_; +- p_147455_4_.field_145849_e = p_147455_3_; + Iterator iterator = this.field_147484_a.iterator(); + while (iterator.hasNext()) - { - TileEntity tileentity1 = (TileEntity)iterator.next(); -@@ -2765,20 +2913,21 @@ - iterator.remove(); - } - } -- -- this.addedTileEntityList.add(par4TileEntity); -+ addedTileEntityList.add(par4TileEntity); - } +@@ -2481,40 +2618,22 @@ else { -- this.loadedTileEntityList.add(par4TileEntity); -- Chunk chunk = this.getChunkFromChunkCoords(par1 >> 4, par3 >> 4); + this.field_147482_g.add(p_147455_4_); +- Chunk chunk = this.getChunkFromChunkCoords(p_147455_1_ >> 4, p_147455_3_ >> 4); - - if (chunk != null) - { -- chunk.setChunkBlockTileEntity(par1 & 15, par2, par3 & 15, par4TileEntity); +- chunk.func_150812_a(p_147455_1_ & 15, p_147455_2_, p_147455_3_ & 15, p_147455_4_); - } -+ loadedTileEntityList.add(par4TileEntity); } } -+ -+ Chunk chunk = this.getChunkFromChunkCoords(par1 >> 4, par3 >> 4); ++ Chunk chunk = this.getChunkFromChunkCoords(p_147455_1_ >> 4, p_147455_3_ >> 4); + if (chunk != null) + { -+ chunk.setChunkBlockTileEntity(par1 & 15, par2, par3 & 15, par4TileEntity); ++ chunk.func_150812_a(p_147455_1_ & 15, p_147455_2_, p_147455_3_ & 15, p_147455_4_); + } + //notify tile changes -+ func_96440_m(par1, par2, par3, 0); ++ func_147453_f(p_147455_1_, p_147455_2_, p_147455_3_, func_147439_a(p_147455_1_, p_147455_2_, p_147455_3_)); } - /** -@@ -2786,28 +2935,13 @@ - */ - public void removeBlockTileEntity(int par1, int par2, int par3) + public void func_147475_p(int p_147475_1_, int p_147475_2_, int p_147475_3_) { -- TileEntity tileentity = this.getBlockTileEntity(par1, par2, par3); +- TileEntity tileentity = this.func_147438_o(p_147475_1_, p_147475_2_, p_147475_3_); - -- if (tileentity != null && this.scanningTileEntities) -+ Chunk chunk = getChunkFromChunkCoords(par1 >> 4, par3 >> 4); -+ if (chunk != null) - { -- tileentity.invalidate(); -- this.addedTileEntityList.remove(tileentity); -+ chunk.removeChunkBlockTileEntity(par1 & 15, par2, par3 & 15); - } +- if (tileentity != null && this.field_147481_N) +- { +- tileentity.func_145843_s(); +- this.field_147484_a.remove(tileentity); +- } - else - { - if (tileentity != null) - { -- this.addedTileEntityList.remove(tileentity); -- this.loadedTileEntityList.remove(tileentity); +- this.field_147484_a.remove(tileentity); +- this.field_147482_g.remove(tileentity); - } - -- Chunk chunk = this.getChunkFromChunkCoords(par1 >> 4, par3 >> 4); +- Chunk chunk = this.getChunkFromChunkCoords(p_147475_1_ >> 4, p_147475_3_ >> 4); - - if (chunk != null) - { -- chunk.removeChunkBlockTileEntity(par1 & 15, par2, par3 & 15); +- chunk.func_150805_f(p_147475_1_ & 15, p_147475_2_, p_147475_3_ & 15); - } - } -+ //notify tile changes -+ func_96440_m(par1, par2, par3, 0); ++ Chunk chunk = getChunkFromChunkCoords(p_147475_1_ >> 4, p_147475_3_ >> 4); ++ if (chunk != null) chunk.func_150805_f(p_147475_1_ & 15, p_147475_2_, p_147475_3_ & 15); ++ func_147453_f(p_147475_1_, p_147475_2_, p_147475_3_, func_147439_a(p_147475_1_, p_147475_2_, p_147475_3_)); } - /** -@@ -2832,7 +2966,8 @@ - */ - public boolean isBlockNormalCube(int par1, int par2, int par3) + public void func_147457_a(TileEntity p_147457_1_) +@@ -2531,8 +2650,7 @@ + public static boolean func_147466_a(IBlockAccess p_147466_0_, int p_147466_1_, int p_147466_2_, int p_147466_3_) { -- return Block.isNormalCube(this.getBlockId(par1, par2, par3)); -+ Block block = Block.blocksList[getBlockId(par1, par2, par3)]; -+ return block != null && block.isBlockNormalCube(this, par1, par2, par3); + Block block = p_147466_0_.func_147439_a(p_147466_1_, p_147466_2_, p_147466_3_); +- int l = p_147466_0_.getBlockMetadata(p_147466_1_, p_147466_2_, p_147466_3_); +- return block.func_149688_o().isOpaque() && block.func_149686_d() ? true : (block instanceof BlockStairs ? (l & 4) == 4 : (block instanceof BlockSlab ? (l & 8) == 8 : (block instanceof BlockHopper ? true : (block instanceof BlockSnow ? (l & 7) == 7 : false)))); ++ return block.isSideSolid(p_147466_0_, p_147466_1_, p_147466_2_, p_147466_3_, ForgeDirection.UP); } - public boolean isBlockFullCube(int par1, int par2, int par3) -@@ -2855,16 +2990,17 @@ - */ - public boolean doesBlockHaveSolidTopSurface(int par1, int par2, int par3) - { -- Block block = Block.blocksList[this.getBlockId(par1, par2, par3)]; -- return this.isBlockTopFacingSurfaceSolid(block, this.getBlockMetadata(par1, par2, par3)); -+ return isBlockSolidOnSide(par1, par2, par3, ForgeDirection.UP); - } - - /** - * Performs check to see if the block is a normal, solid block, or if the metadata of the block indicates that its - * facing puts its solid side upwards. (inverted stairs, for example) - */ -+ @Deprecated //DO NOT USE THIS!!! USE doesBlockHaveSolidTopSurface - public boolean isBlockTopFacingSurfaceSolid(Block par1Block, int par2) - { -+ // -.- Mojang PLEASE make this location sensitive, you have no reason not to. - return par1Block == null ? false : (par1Block.blockMaterial.isOpaque() && par1Block.renderAsNormalBlock() ? true : (par1Block instanceof BlockStairs ? (par2 & 4) == 4 : (par1Block instanceof BlockHalfSlab ? (par2 & 8) == 8 : (par1Block instanceof BlockHopper ? true : (par1Block instanceof BlockSnow ? (par2 & 7) == 7 : false))))); - } - -@@ -2881,7 +3017,7 @@ + public boolean func_147445_c(int p_147445_1_, int p_147445_2_, int p_147445_3_, boolean p_147445_4_) +@@ -2544,7 +2662,7 @@ if (chunk != null && !chunk.isEmpty()) { - Block block = Block.blocksList[this.getBlockId(par1, par2, par3)]; -- return block == null ? false : block.blockMaterial.isOpaque() && block.renderAsNormalBlock(); -+ return block == null ? false : isBlockNormalCube(par1, par2, par3); + Block block = this.func_147439_a(p_147445_1_, p_147445_2_, p_147445_3_); +- return block.func_149688_o().isOpaque() && block.func_149686_d(); ++ return block.isNormalCube(this, p_147445_1_, p_147445_2_, p_147445_3_); } else { -@@ -2912,8 +3048,7 @@ - */ +@@ -2571,8 +2689,7 @@ + // JAVADOC METHOD $$ func_72891_a public void setAllowedSpawnTypes(boolean par1, boolean par2) { - this.spawnHostileMobs = par1; @@ -590,9 +511,9 @@ + provider.setAllowedSpawnTypes(par1, par2); } - /** -@@ -2929,6 +3064,11 @@ - */ + // JAVADOC METHOD $$ func_72835_b +@@ -2584,6 +2701,11 @@ + // JAVADOC METHOD $$ func_72947_a private void calculateInitialWeather() { + provider.calculateInitialWeather(); @@ -603,8 +524,8 @@ if (this.worldInfo.isRaining()) { this.rainingStrength = 1.0F; -@@ -2945,6 +3085,11 @@ - */ +@@ -2598,6 +2720,11 @@ + // JAVADOC METHOD $$ func_72979_l protected void updateWeather() { + provider.updateWeather(); @@ -614,25 +535,17 @@ + { if (!this.provider.hasNoSky) { - int i = this.worldInfo.getThunderTime(); -@@ -3041,12 +3186,14 @@ - - public void toggleRain() - { -- this.worldInfo.setRainTime(1); -+ provider.toggleRain(); - } - - protected void setActivePlayerChunksAndCheckLight() + if (!this.isRemote) +@@ -2682,6 +2809,7 @@ { this.activeChunkSet.clear(); -+ this.activeChunkSet.addAll(getPersistentChunks().keySet()); -+ this.theProfiler.startSection("buildList"); ++ this.activeChunkSet.addAll(getPersistentChunks().keySet()); int i; EntityPlayer entityplayer; -@@ -3153,6 +3300,11 @@ - */ + int j; +@@ -2776,6 +2904,11 @@ + // JAVADOC METHOD $$ func_72834_c public boolean canBlockFreeze(int par1, int par2, int par3, boolean par4) { + return provider.canBlockFreeze(par1, par2, par3, par4); @@ -641,48 +554,45 @@ + public boolean canBlockFreezeBody(int par1, int par2, int par3, boolean par4) + { BiomeGenBase biomegenbase = this.getBiomeGenForCoords(par1, par3); - float f = biomegenbase.getFloatTemperature(); + float f = biomegenbase.func_150564_a(par1, par2, par3); -@@ -3211,6 +3363,11 @@ - */ - public boolean canSnowAt(int par1, int par2, int par3) +@@ -2831,6 +2964,11 @@ + + public boolean func_147478_e(int p_147478_1_, int p_147478_2_, int p_147478_3_, boolean p_147478_4_) { -+ return provider.canSnowAt(par1, par2, par3); ++ return provider.canSnowAt(p_147478_1_, p_147478_2_, p_147478_3_, p_147478_4_); + } + -+ public boolean canSnowAtBody(int par1, int par2, int par3) ++ public boolean canSnowAtBody(int p_147478_1_, int p_147478_2_, int p_147478_3_, boolean p_147478_4_) + { - BiomeGenBase biomegenbase = this.getBiomeGenForCoords(par1, par3); - float f = biomegenbase.getFloatTemperature(); + BiomeGenBase biomegenbase = this.getBiomeGenForCoords(p_147478_1_, p_147478_3_); + float f = biomegenbase.func_150564_a(p_147478_1_, p_147478_2_, p_147478_3_); -@@ -3254,10 +3411,12 @@ +@@ -2880,10 +3018,11 @@ else { - int l = this.getBlockId(par1, par2, par3); -- int i1 = par4EnumSkyBlock == EnumSkyBlock.Sky ? 0 : Block.lightValue[l]; -- int j1 = Block.lightOpacity[l]; -+ Block block = Block.blocksList[l]; -+ int blockLight = (block == null ? 0 : block.getLightValue(this, par1, par2, par3)); -+ int i1 = par4EnumSkyBlock == EnumSkyBlock.Sky ? 0 : blockLight; -+ int j1 = (block == null ? 0 : block.getLightOpacity(this, par1, par2, par3)); + Block block = this.func_147439_a(par1, par2, par3); +- int l = par4EnumSkyBlock == EnumSkyBlock.Sky ? 0 : block.func_149750_m(); +- int i1 = block.func_149717_k(); ++ int blockLight = block.getLightValue(this, par1, par2, par3); ++ int l = par4EnumSkyBlock == EnumSkyBlock.Sky ? 0 : blockLight; ++ int i1 = block.getLightOpacity(this, par1, par2, par3); -- if (j1 >= 15 && Block.lightValue[l] > 0) -+ if (j1 >= 15 && blockLight > 0) +- if (i1 >= 15 && block.func_149750_m() > 0) ++ if (i1 >= 15 && blockLight > 0) { - j1 = 1; + i1 = 1; } -@@ -3353,7 +3512,9 @@ +@@ -2983,7 +3122,7 @@ int j4 = i2 + Facing.offsetsXForSide[i4]; int k4 = j2 + Facing.offsetsYForSide[i4]; int l4 = k2 + Facing.offsetsZForSide[i4]; -- int i5 = Math.max(1, Block.lightOpacity[this.getBlockId(j4, k4, l4)]); -+ Block block = Block.blocksList[getBlockId(j4, k4, l4)]; -+ int blockOpacity = (block == null ? 0 : block.getLightOpacity(this, j4, k4, l4)); -+ int i5 = Math.max(1, blockOpacity); - i3 = this.getSavedLightValue(par1EnumSkyBlock, j4, k4, l4); +- int i5 = Math.max(1, this.func_147439_a(j4, k4, l4).func_149717_k()); ++ int i5 = Math.max(1, this.func_147439_a(j4, k4, l4).getLightOpacity(this, j4, k4, l4)); + i3 = this.getSavedLightValue(p_147463_1_, j4, k4, l4); if (i3 == l2 - i5 && i1 < this.lightUpdateBlockList.length) -@@ -3456,10 +3617,10 @@ +@@ -3083,10 +3222,10 @@ public List getEntitiesWithinAABBExcludingEntity(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB, IEntitySelector par3IEntitySelector) { ArrayList arraylist = new ArrayList(); @@ -697,7 +607,7 @@ for (int i1 = i; i1 <= j; ++i1) { -@@ -3485,10 +3646,10 @@ +@@ -3110,10 +3249,10 @@ public List selectEntitiesWithinAABB(Class par1Class, AxisAlignedBB par2AxisAlignedBB, IEntitySelector par3IEntitySelector) { @@ -712,8 +622,8 @@ ArrayList arraylist = new ArrayList(); for (int i1 = i; i1 <= j; ++i1) -@@ -3582,11 +3743,14 @@ - */ +@@ -3194,11 +3333,14 @@ + // JAVADOC METHOD $$ func_72868_a public void addLoadedEntities(List par1List) { - this.loadedEntityList.addAll(par1List); @@ -730,44 +640,18 @@ } } -@@ -3624,6 +3788,11 @@ - block = null; - } - -+ if (block != null && block.isBlockReplaceable(this, par2, par3, par4)) -+ { -+ block = null; -+ } -+ - return block != null && block.blockMaterial == Material.circuits && block1 == Block.anvil ? true : par1 > 0 && block == null && block1.canPlaceBlockOnSide(this, par2, par3, par4, par6, par8ItemStack); - } - } -@@ -3744,14 +3913,20 @@ - */ +@@ -3321,7 +3463,8 @@ + // JAVADOC METHOD $$ func_72878_l public int getIndirectPowerLevelTo(int par1, int par2, int par3, int par4) { -- if (this.isBlockNormalCube(par1, par2, par3)) -+ Block block = Block.blocksList[this.getBlockId(par1, par2, par3)]; -+ -+ if (block == null) - { -+ return 0; -+ } -+ -+ if (!block.shouldCheckWeakPower(this, par1, par2, par3, par4)) -+ { - return this.getBlockPowerInput(par1, par2, par3); - } - else - { -- int i1 = this.getBlockId(par1, par2, par3); -- return i1 == 0 ? 0 : Block.blocksList[i1].isProvidingWeakPower(this, par1, par2, par3, par4); -+ return block.isProvidingWeakPower(this, par1, par2, par3, par4); - } +- return this.func_147439_a(par1, par2, par3).func_149721_r() ? this.getBlockPowerInput(par1, par2, par3) : this.func_147439_a(par1, par2, par3).func_149709_b(this, par1, par2, par3, par4); ++ Block block = this.func_147439_a(par1, par2, par3); ++ return block.shouldCheckWeakPower(this, par1, par2, par3, par4) ? this.getBlockPowerInput(par1, par2, par3) : block.func_149709_b(this, par1, par2, par3, par4); } -@@ -3914,7 +4089,7 @@ - */ + // JAVADOC METHOD $$ func_72864_z +@@ -3461,7 +3604,7 @@ + // JAVADOC METHOD $$ func_72905_C public long getSeed() { - return this.worldInfo.getSeed(); @@ -775,7 +659,7 @@ } public long getTotalWorldTime() -@@ -3924,7 +4099,7 @@ +@@ -3471,24 +3614,24 @@ public long getWorldTime() { @@ -783,46 +667,40 @@ + return provider.getWorldTime(); } - /** -@@ -3932,7 +4107,7 @@ - */ + // JAVADOC METHOD $$ func_72877_b public void setWorldTime(long par1) { - this.worldInfo.setWorldTime(par1); + provider.setWorldTime(par1); } - /** -@@ -3940,13 +4115,13 @@ - */ + // JAVADOC METHOD $$ func_72861_E public ChunkCoordinates getSpawnPoint() { - return new ChunkCoordinates(this.worldInfo.getSpawnX(), this.worldInfo.getSpawnY(), this.worldInfo.getSpawnZ()); + return provider.getSpawnPoint(); } - @SideOnly(Side.CLIENT) public void setSpawnLocation(int par1, int par2, int par3) { - this.worldInfo.setSpawnPosition(par1, par2, par3); + provider.setSpawnPoint(par1, par2, par3); } - @SideOnly(Side.CLIENT) -@@ -3970,7 +4145,10 @@ + // JAVADOC METHOD $$ func_72897_h +@@ -3509,13 +3652,21 @@ if (!this.loadedEntityList.contains(par1Entity)) { - this.loadedEntityList.add(par1Entity); + if (!MinecraftForge.EVENT_BUS.post(new EntityJoinWorldEvent(par1Entity, this))) + { -+ loadedEntityList.add(par1Entity); ++ this.loadedEntityList.add(par1Entity); + } } } -@@ -3979,6 +4157,11 @@ - */ + // JAVADOC METHOD $$ func_72962_a public boolean canMineBlock(EntityPlayer par1EntityPlayer, int par2, int par3, int par4) { + return provider.canMineBlock(par1EntityPlayer, par2, par3, par4); @@ -833,8 +711,8 @@ return true; } -@@ -4098,8 +4281,7 @@ - */ +@@ -3615,8 +3766,7 @@ + // JAVADOC METHOD $$ func_72958_C public boolean isBlockHighHumidity(int par1, int par2, int par3) { - BiomeGenBase biomegenbase = this.getBiomeGenForCoords(par1, par3); @@ -842,92 +720,85 @@ + return provider.isBlockHighHumidity(par1, par2, par3); } - /** -@@ -4174,7 +4356,7 @@ - */ + // JAVADOC METHOD $$ func_72823_a +@@ -3676,13 +3826,13 @@ + // JAVADOC METHOD $$ func_72800_K public int getHeight() { - return 256; + return provider.getHeight(); } - /** -@@ -4182,7 +4364,7 @@ - */ + // JAVADOC METHOD $$ func_72940_L public int getActualHeight() { - return this.provider.hasNoSky ? 128 : 256; + return provider.getActualHeight(); } - public IUpdatePlayerListBox getMinecartSoundUpdater(EntityMinecart par1EntityMinecart) -@@ -4225,7 +4407,7 @@ - */ + // JAVADOC METHOD $$ func_72843_D +@@ -3709,7 +3859,7 @@ + @SideOnly(Side.CLIENT) public double getHorizon() { - return this.worldInfo.getTerrainType().getHorizon(this); + return provider.getHorizon(); } - /** -@@ -4294,30 +4476,28 @@ + // JAVADOC METHOD $$ func_72914_a +@@ -3782,25 +3932,24 @@ - public void func_96440_m(int par1, int par2, int par3, int par4) + public void func_147453_f(int p_147453_1_, int p_147453_2_, int p_147453_3_, Block p_147453_4_) { -- for (int i1 = 0; i1 < 4; ++i1) -+ for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) +- for (int l = 0; l < 4; ++l) ++ for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { -- int j1 = par1 + Direction.offsetX[i1]; -- int k1 = par3 + Direction.offsetZ[i1]; -- int l1 = this.getBlockId(j1, par2, k1); -+ int j1 = par1 + dir.offsetX; -+ int y = par2 + dir.offsetY; -+ int k1 = par3 + dir.offsetZ; -+ int l1 = getBlockId(j1, y, k1); -+ Block block = Block.blocksList[l1]; +- int i1 = p_147453_1_ + Direction.offsetX[l]; +- int j1 = p_147453_3_ + Direction.offsetZ[l]; +- Block block1 = this.func_147439_a(i1, p_147453_2_, j1); ++ int i1 = p_147453_1_ + dir.offsetX; ++ int y = p_147453_2_ + dir.offsetY; ++ int j1 = p_147453_3_ + dir.offsetZ; ++ Block block1 = this.func_147439_a(i1, y, j1); -- if (l1 != 0) -+ if(block != null) +- if (Blocks.unpowered_comparator.func_149907_e(block1)) ++ block1.onNeighborChange(this, i1, y, j1, p_147453_1_, p_147453_2_, p_147453_3_); ++ if (block1.isNormalCube(this, i1, p_147453_2_, j1)) { -- Block block = Block.blocksList[l1]; -+ block.onNeighborTileChange(this, j1, y, k1, par1, par2, par3); +- block1.func_149695_a(this, i1, p_147453_2_, j1, p_147453_4_); +- } +- else if (block1.func_149721_r()) +- { +- i1 += Direction.offsetX[l]; +- j1 += Direction.offsetZ[l]; +- Block block2 = this.func_147439_a(i1, p_147453_2_, j1); ++ i1 += dir.offsetX; ++ y += dir.offsetY; ++ j1 += dir.offsetZ; ++ Block block2 = this.func_147439_a(i1, y, j1); -- if (Block.redstoneComparatorIdle.func_94487_f(l1)) -+ if(Block.isNormalCube(l1)) +- if (Blocks.unpowered_comparator.func_149907_e(block2)) ++ if (block2.getWeakChanges(this, i1, y, j1)) { -- block.onNeighborBlockChange(this, j1, par2, k1, par4); -- } -- else if (Block.isNormalCube(l1)) -- { -- j1 += Direction.offsetX[i1]; -- k1 += Direction.offsetZ[i1]; -- l1 = this.getBlockId(j1, par2, k1); -+ j1 += dir.offsetX; -+ y += dir.offsetY; -+ k1 += dir.offsetZ; -+ l1 = getBlockId(j1, y, k1); - block = Block.blocksList[l1]; -- -- if (Block.redstoneComparatorIdle.func_94487_f(l1)) -+ if(block != null && block.weakTileChanges()) - { -- block.onNeighborBlockChange(this, j1, par2, k1, par4); -+ block.onNeighborTileChange(this, j1, y, k1, par1, par2, par3); - } +- block2.func_149695_a(this, i1, p_147453_2_, j1, p_147453_4_); ++ block2.onNeighborChange(this, i1, y, j1, p_147453_1_, p_147453_2_, p_147453_3_); } } -@@ -4363,4 +4543,115 @@ - - return MathHelper.clamp_float(f, 0.0F, flag ? 1.5F : 1.0F); + } +@@ -3841,4 +3990,110 @@ + iworldaccess.func_147584_b(); + } } + ++ ++ /* ======================================== FORGE START =====================================*/ + /** + * Adds a single TileEntity to the world. + * @param entity The TileEntity to be added. + */ + public void addTileEntity(TileEntity entity) + { -+ List dest = scanningTileEntities ? addedTileEntityList : loadedTileEntityList; ++ List dest = field_147481_N ? field_147484_a : field_147482_g; + if(entity.canUpdate()) + { + dest.add(entity); @@ -944,9 +815,9 @@ + * @param side The Side in question + * @return True if the side is solid + */ -+ public boolean isBlockSolidOnSide(int x, int y, int z, ForgeDirection side) ++ public boolean isSideSolid(int x, int y, int z, ForgeDirection side) + { -+ return isBlockSolidOnSide(x, y, z, side, false); ++ return isSideSolid(x, y, z, side, false); + } + + /** @@ -957,11 +828,11 @@ + * @param y Block Y Position + * @param z Block Z Position + * @param side The Side in question -+ * @param _default The defult to return if the block doesn't exist. ++ * @param _default The default to return if the block doesn't exist. + * @return True if the side is solid + */ + @Override -+ public boolean isBlockSolidOnSide(int x, int y, int z, ForgeDirection side, boolean _default) ++ public boolean isSideSolid(int x, int y, int z, ForgeDirection side, boolean _default) + { + if (x < -30000000 || z < -30000000 || x >= 30000000 || z >= 30000000) + { @@ -973,14 +844,7 @@ + { + return _default; + } -+ -+ Block block = Block.blocksList[getBlockId(x, y, z)]; -+ if(block == null) -+ { -+ return false; -+ } -+ -+ return block.isBlockSolidOnSide(this, x, y, z, side); ++ return func_147439_a(x, y, z).isSideSolid(this, x, y, z, side); + } + + /** @@ -1013,7 +877,7 @@ + return 0; + } + -+ return getChunkFromChunkCoords(x >> 4, z >> 4).getBlockLightOpacity(x & 15, y, z & 15); ++ return getChunkFromChunkCoords(x >> 4, z >> 4).func_150808_b(x & 15, y, z & 15); + } + + /** diff --git a/patches/minecraft/net/minecraft/world/WorldProvider.java.patch b/patches/minecraft/net/minecraft/world/WorldProvider.java.patch index 9790d31f7..754fea599 100644 --- a/patches/minecraft/net/minecraft/world/WorldProvider.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldProvider.java.patch @@ -1,15 +1,17 @@ --- ../src-base/minecraft/net/minecraft/world/WorldProvider.java +++ ../src-work/minecraft/net/minecraft/world/WorldProvider.java -@@ -3,16 +3,23 @@ +@@ -2,17 +2,25 @@ + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; - import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; + import net.minecraft.init.Blocks; import net.minecraft.util.ChunkCoordinates; import net.minecraft.util.MathHelper; import net.minecraft.util.Vec3; ++import net.minecraft.world.WorldSettings.GameType; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.WorldChunkManager; import net.minecraft.world.biome.WorldChunkManagerHell; @@ -24,7 +26,7 @@ public abstract class WorldProvider { -@@ -199,7 +206,7 @@ +@@ -166,14 +174,14 @@ public static WorldProvider getProviderForDimension(int par0) { @@ -32,9 +34,8 @@ + return DimensionManager.createProviderFor(par0); } + // JAVADOC METHOD $$ func_76571_f @SideOnly(Side.CLIENT) -@@ -209,7 +216,7 @@ - */ public float getCloudHeight() { - return 128.0F; @@ -42,9 +43,9 @@ } @SideOnly(Side.CLIENT) -@@ -268,4 +275,277 @@ - * Returns the dimension's name, e.g. "The End", "Nether", or "Overworld". - */ +@@ -216,4 +224,272 @@ + + // JAVADOC METHOD $$ func_80007_l public abstract String getDimensionName(); + + /*======================================= Forge Start =========================================*/ @@ -151,7 +152,7 @@ + { + ChunkCoordinates chunkcoordinates = new ChunkCoordinates(this.worldObj.getSpawnPoint()); + -+ boolean isAdventure = worldObj.getWorldInfo().getGameType() == EnumGameType.ADVENTURE; ++ boolean isAdventure = worldObj.getWorldInfo().getGameType() == GameType.ADVENTURE; + int spawnFuzz = terrainType.getSpawnFuzz(); + int spawnFuzzHalf = spawnFuzz / 2; + @@ -236,19 +237,14 @@ + worldObj.updateWeatherBody(); + } + -+ public void toggleRain() -+ { -+ worldObj.worldInfo.setRainTime(1); -+ } -+ + public boolean canBlockFreeze(int x, int y, int z, boolean byWater) + { + return worldObj.canBlockFreezeBody(x, y, z, byWater); + } + -+ public boolean canSnowAt(int x, int y, int z) ++ public boolean canSnowAt(int x, int y, int z, boolean checkLight) + { -+ return worldObj.canSnowAtBody(x, y, z); ++ return worldObj.canSnowAtBody(x, y, z, checkLight); + } + + public void setWorldTime(long time) diff --git a/patches/minecraft/net/minecraft/world/WorldServer.java.patch b/patches/minecraft/net/minecraft/world/WorldServer.java.patch index 6cd8bd29a..bf0e61e4b 100644 --- a/patches/minecraft/net/minecraft/world/WorldServer.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldServer.java.patch @@ -8,7 +8,7 @@ import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; -@@ -47,11 +48,18 @@ +@@ -49,11 +50,19 @@ import net.minecraft.world.biome.WorldChunkManager; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.IChunkProvider; @@ -19,26 +19,27 @@ import net.minecraft.world.gen.feature.WorldGeneratorBonusChest; import net.minecraft.world.storage.ISaveHandler; +import net.minecraftforge.common.ChestGenHooks; -+import static net.minecraftforge.common.ChestGenHooks.*; ++import static net.minecraftforge.common.ChestGenHooks.BONUS_CHEST; +import net.minecraftforge.common.DimensionManager; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.ForgeEventFactory; +import net.minecraftforge.event.world.WorldEvent; ++ + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; - public class WorldServer extends World - { -@@ -93,6 +101,10 @@ - /** An IntHashMap of entity IDs (integers) to their Entity objects. */ +@@ -83,6 +92,10 @@ private IntHashMap entityIdMap; + private static final String __OBFID = "CL_00001437"; + /** Stores the recently processed (lighting) chunks */ + protected Set doneChunks = new HashSet(); + public List customTeleporters = new ArrayList(); + - public WorldServer(MinecraftServer par1MinecraftServer, ISaveHandler par2ISaveHandler, String par3Str, int par4, WorldSettings par5WorldSettings, Profiler par6Profiler, ILogAgent par7ILogAgent) + public WorldServer(MinecraftServer p_i45284_1_, ISaveHandler p_i45284_2_, String p_i45284_3_, int p_i45284_4_, WorldSettings p_i45284_5_, Profiler p_i45284_6_) { - super(par2ISaveHandler, par3Str, par5WorldSettings, WorldProvider.getProviderForDimension(par4), par6Profiler, par7ILogAgent); -@@ -125,8 +137,12 @@ + super(p_i45284_2_, p_i45284_3_, p_i45284_5_, WorldProvider.getProviderForDimension(p_i45284_4_), p_i45284_6_); +@@ -115,8 +128,12 @@ this.mapStorage.setData("scoreboard", scoreboardsavedata); } @@ -48,11 +49,11 @@ + scoreboardsavedata.func_96499_a(this.worldScoreboard); + } ((ServerScoreboard)this.worldScoreboard).func_96547_a(scoreboardsavedata); -+ DimensionManager.setWorld(par4, this); ++ DimensionManager.setWorld(p_i45284_4_, this); } - /** -@@ -188,6 +204,10 @@ + // JAVADOC METHOD $$ func_72835_b +@@ -176,6 +193,10 @@ this.villageSiegeObj.tick(); this.theProfiler.endStartSection("portalForcer"); this.worldTeleporter.removeStalePortalLocations(this.getTotalWorldTime()); @@ -61,17 +62,17 @@ + tele.removeStalePortalLocations(getTotalWorldTime()); + } this.theProfiler.endSection(); - this.sendAndApplyBlockEvents(); + this.func_147488_Z(); } -@@ -198,6 +218,7 @@ - public SpawnListEntry spawnRandomCreature(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4) +@@ -184,6 +205,7 @@ + public BiomeGenBase.SpawnListEntry spawnRandomCreature(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4) { List list = this.getChunkProvider().getPossibleCreatures(par1EnumCreatureType, par2, par3, par4); + list = ForgeEventFactory.getPotentialSpawns(this, par1EnumCreatureType, par2, par3, par4, list); - return list != null && !list.isEmpty() ? (SpawnListEntry)WeightedRandom.getRandomItem(this.rand, list) : null; + return list != null && !list.isEmpty() ? (BiomeGenBase.SpawnListEntry)WeightedRandom.getRandomItem(this.rand, list) : null; } -@@ -241,10 +262,7 @@ +@@ -225,10 +247,7 @@ private void resetRainAndThunder() { @@ -83,7 +84,7 @@ } public boolean areAllPlayersAsleep() -@@ -316,6 +334,14 @@ +@@ -293,6 +312,14 @@ int j = 0; Iterator iterator = this.activeChunkSet.iterator(); @@ -98,15 +99,15 @@ while (iterator.hasNext()) { ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair)iterator.next(); -@@ -325,14 +351,18 @@ +@@ -302,14 +329,18 @@ Chunk chunk = this.getChunkFromChunkCoords(chunkcoordintpair.chunkXPos, chunkcoordintpair.chunkZPos); - this.moodSoundAndLightCheck(k, l, chunk); + this.func_147467_a(k, l, chunk); this.theProfiler.endStartSection("tickChunk"); -- chunk.updateSkylight(); +- chunk.func_150804_b(false); + //Limits and evenly distributes the lighting update time + if (System.nanoTime() - startTime <= 4000000 && doneChunks.add(chunkcoordintpair)) + { -+ chunk.updateSkylight(); ++ chunk.func_150804_b(false); + } this.theProfiler.endStartSection("thunder"); int i1; @@ -119,27 +120,27 @@ { this.updateLCG = this.updateLCG * 3 + 1013904223; i1 = this.updateLCG >> 2; -@@ -349,7 +379,7 @@ +@@ -325,7 +356,7 @@ + this.theProfiler.endStartSection("iceandsnow"); - int i2; - if (this.rand.nextInt(16) == 0) + if (provider.canDoRainSnowIce(chunk) && this.rand.nextInt(16) == 0) { this.updateLCG = this.updateLCG * 3 + 1013904223; i1 = this.updateLCG >> 2; -@@ -437,6 +467,9 @@ - public void scheduleBlockUpdateWithPriority(int par1, int par2, int par3, int par4, int par5, int par6) +@@ -401,6 +432,9 @@ + public void func_147454_a(int p_147454_1_, int p_147454_2_, int p_147454_3_, Block p_147454_4_, int p_147454_5_, int p_147454_6_) { - NextTickListEntry nextticklistentry = new NextTickListEntry(par1, par2, par3, par4); + NextTickListEntry nextticklistentry = new NextTickListEntry(p_147454_1_, p_147454_2_, p_147454_3_, p_147454_4_); + //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.scheduledUpdatesAreImmediate && par4 > 0) -@@ -502,7 +535,7 @@ - */ + if (this.scheduledUpdatesAreImmediate && p_147454_4_.func_149688_o() != Material.field_151579_a) +@@ -461,7 +495,7 @@ + // JAVADOC METHOD $$ func_72939_s public void updateEntities() { - if (this.playerEntities.isEmpty()) @@ -147,7 +148,7 @@ { if (this.updateEntityTick++ >= 1200) { -@@ -568,6 +601,9 @@ +@@ -523,6 +557,9 @@ { nextticklistentry = (NextTickListEntry)iterator.next(); iterator.remove(); @@ -157,29 +158,29 @@ byte b0 = 0; if (this.checkChunksExist(nextticklistentry.xCoord - b0, nextticklistentry.yCoord - b0, nextticklistentry.zCoord - b0, nextticklistentry.xCoord + b0, nextticklistentry.yCoord + b0, nextticklistentry.zCoord + b0)) -@@ -700,16 +736,28 @@ +@@ -647,13 +684,26 @@ { ArrayList arraylist = new ArrayList(); -- for (int k1 = 0; k1 < this.loadedTileEntityList.size(); ++k1) -+ for(int x = (par1 >> 4); x <= (par4 >> 4); x++) +- for (int k1 = 0; k1 < this.field_147482_g.size(); ++k1) ++ for(int x = (p_147486_1_ >> 4); x <= (p_147486_4_ >> 4); x++) { -- TileEntity tileentity = (TileEntity)this.loadedTileEntityList.get(k1); +- TileEntity tileentity = (TileEntity)this.field_147482_g.get(k1); - -- if (tileentity.xCoord >= par1 && tileentity.yCoord >= par2 && tileentity.zCoord >= par3 && tileentity.xCoord < par4 && tileentity.yCoord < par5 && tileentity.zCoord < par6) -+ for(int z = (par3 >> 4); z <= (par6 >> 4); z++) +- if (tileentity.field_145851_c >= p_147486_1_ && tileentity.field_145848_d >= p_147486_2_ && tileentity.field_145849_e >= p_147486_3_ && tileentity.field_145851_c < p_147486_4_ && tileentity.field_145848_d < p_147486_5_ && tileentity.field_145849_e < p_147486_6_) ++ for(int z = (p_147486_3_ >> 4); z <= (p_147486_6_ >> 4); z++) { - arraylist.add(tileentity); + Chunk chunk = getChunkFromChunkCoords(x, z); + if (chunk != null) + { -+ for(Object obj : chunk.chunkTileEntityMap.values()) ++ for(Object obj : chunk.field_150816_i.values()) + { + TileEntity entity = (TileEntity)obj; -+ if (!entity.isInvalid()) ++ if (!entity.func_145837_r()) + { -+ if (entity.xCoord >= par1 && entity.yCoord >= par2 && entity.zCoord >= par3 && -+ entity.xCoord <= par4 && entity.yCoord <= par5 && entity.zCoord <= par6) ++ if (entity.field_145851_c >= p_147486_1_ && entity.field_145848_d >= p_147486_2_ && entity.field_145849_e >= p_147486_3_ && ++ entity.field_145851_c <= p_147486_4_ && entity.field_145848_d <= p_147486_5_ && entity.field_145849_e <= p_147486_6_) + { + arraylist.add(entity); + } @@ -188,12 +189,9 @@ + } } } -- - return arraylist; - } -@@ -718,6 +766,11 @@ - */ +@@ -663,6 +713,11 @@ + // JAVADOC METHOD $$ func_72962_a public boolean canMineBlock(EntityPlayer par1EntityPlayer, int par2, int par3, int par4) { + return super.canMineBlock(par1EntityPlayer, par2, par3, par4); @@ -204,8 +202,8 @@ return !this.mcServer.isBlockProtected(this, par2, par3, par4, par1EntityPlayer); } -@@ -801,7 +854,7 @@ - */ +@@ -742,7 +797,7 @@ + // JAVADOC METHOD $$ func_73047_i protected void createBonusChest() { - WorldGeneratorBonusChest worldgeneratorbonuschest = new WorldGeneratorBonusChest(bonusChestContent, 10); @@ -213,7 +211,7 @@ for (int i = 0; i < 10; ++i) { -@@ -844,6 +897,7 @@ +@@ -781,6 +836,7 @@ } this.chunkProvider.saveChunks(par1, par2IProgressUpdate); @@ -221,7 +219,7 @@ } } -@@ -866,6 +920,7 @@ +@@ -799,6 +855,7 @@ this.checkSessionLock(); this.saveHandler.saveWorldInfoWithPlayer(this.worldInfo, this.mcServer.getConfigurationManager().getHostPlayerData()); this.mapStorage.saveAllData(); @@ -229,13 +227,15 @@ } protected void onEntityAdded(Entity par1Entity) -@@ -1073,4 +1128,9 @@ - { - return this.worldTeleporter; +@@ -1013,6 +1070,11 @@ + } } -+ + + public File getChunkSaveLocation() + { + return ((AnvilChunkLoader)theChunkProviderServer.currentChunkLoader).chunkSaveLocation; + } - } ++ + static class ServerBlockEventList extends ArrayList + { + private static final String __OBFID = "CL_00001439"; diff --git a/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch b/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch index 155084e24..9b1d35d30 100644 --- a/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch @@ -1,9 +1,9 @@ --- ../src-base/minecraft/net/minecraft/world/WorldServerMulti.java +++ ../src-work/minecraft/net/minecraft/world/WorldServerMulti.java -@@ -19,5 +19,8 @@ - /** - * Saves the chunks to disk. - */ +@@ -18,5 +18,8 @@ + } + + // JAVADOC METHOD $$ func_73042_a - protected void saveLevel() throws MinecraftException {} + protected void saveLevel() throws MinecraftException + { diff --git a/patches/minecraft/net/minecraft/world/WorldType.java.patch b/patches/minecraft/net/minecraft/world/WorldType.java.patch index 6843ddac6..4436cb558 100644 --- a/patches/minecraft/net/minecraft/world/WorldType.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldType.java.patch @@ -1,16 +1,16 @@ --- ../src-base/minecraft/net/minecraft/world/WorldType.java +++ ../src-work/minecraft/net/minecraft/world/WorldType.java -@@ -10,6 +10,9 @@ - import com.google.common.collect.ObjectArrays; - import com.google.common.collect.Sets; +@@ -2,6 +2,9 @@ + + import java.util.Random; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiCreateFlatWorld; +import net.minecraft.client.gui.GuiCreateWorld; - import net.minecraft.world.*; - import net.minecraft.world.gen.*; - import net.minecraft.world.biome.*; -@@ -224,4 +227,47 @@ + import net.minecraft.world.biome.BiomeGenBase; + import net.minecraft.world.biome.WorldChunkManager; + import net.minecraft.world.biome.WorldChunkManagerHell; +@@ -203,4 +206,47 @@ * Called when 'Create New World' button is pressed before starting game */ public void onGUICreateWorldPress() { } @@ -35,11 +35,11 @@ + { + if (this == FLAT) + { -+ instance.displayGuiScreen(new GuiCreateFlatWorld(guiCreateWorld, guiCreateWorld.generatorOptionsToUse)); ++ instance.func_147108_a(new GuiCreateFlatWorld(guiCreateWorld, guiCreateWorld.field_146334_a)); + } + } + -+ /* ++ /** + * Should world creation GUI show 'Customize' button for this world type? + * @return if this world type has customization parameters + */ @@ -48,10 +48,10 @@ + return this == FLAT; + } + -+ @SideOnly(Side.CLIENT) + + /** -+ * the y level at which clouds are rendered. ++ * Get the height to render the clouds for this world type ++ * @return The height to render clouds at + */ + public float getCloudHeight() + { diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch index 5036b6605..86a84fabd 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeDecorator.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeDecorator.java -@@ -16,6 +16,11 @@ +@@ -19,6 +19,11 @@ import net.minecraft.world.gen.feature.WorldGenWaterlily; import net.minecraft.world.gen.feature.WorldGenerator; @@ -11,15 +11,13 @@ + public class BiomeDecorator { - /** The world the BiomeDecorator is currently decorating */ -@@ -199,26 +204,31 @@ - */ - protected void decorate() + // JAVADOC FIELD $$ field_76815_a +@@ -136,26 +141,30 @@ + + protected void func_150513_a(BiomeGenBase p_150513_1_) { -- this.generateOres(); + MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Pre(currentWorld, randomGenerator, chunk_X, chunk_Z)); -+ -+ this.generateOres(); + this.generateOres(); int i; int j; int k; @@ -48,9 +46,9 @@ { j = this.chunk_X + this.randomGenerator.nextInt(16) + 8; k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; -@@ -234,7 +244,8 @@ - +@@ -172,7 +181,8 @@ int l; + int i1; - for (j = 0; j < i; ++j) + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, TREE); @@ -58,8 +56,8 @@ { k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; -@@ -243,7 +254,8 @@ - worldgenerator.generate(this.currentWorld, this.randomGenerator, k, this.currentWorld.getHeightValue(k, l), l); +@@ -186,14 +196,16 @@ + } } - for (j = 0; j < this.bigMushroomsPerChunk; ++j) @@ -68,17 +66,16 @@ { k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; -@@ -252,7 +264,8 @@ - - int i1; + this.bigMushroomGen.generate(this.currentWorld, this.randomGenerator, k, this.currentWorld.getHeightValue(k, l), l); + } - for (j = 0; j < this.flowersPerChunk; ++j) + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, FLOWERS); + for (j = 0; doGen && j < this.flowersPerChunk; ++j) { k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - l = this.randomGenerator.nextInt(128); -@@ -268,7 +281,8 @@ + l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; +@@ -208,7 +220,8 @@ } } @@ -87,9 +84,9 @@ + for (j = 0; doGen && j < this.grassPerChunk; ++j) { k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - l = this.randomGenerator.nextInt(128); -@@ -277,7 +291,8 @@ - worldgenerator1.generate(this.currentWorld, this.randomGenerator, k, l, i1); + l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; +@@ -217,7 +230,8 @@ + worldgenerator.generate(this.currentWorld, this.randomGenerator, k, i1, l); } - for (j = 0; j < this.deadBushPerChunk; ++j) @@ -97,9 +94,9 @@ + for (j = 0; doGen && j < this.deadBushPerChunk; ++j) { k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - l = this.randomGenerator.nextInt(128); -@@ -285,7 +300,8 @@ - (new WorldGenDeadBush(Block.deadBush.blockID)).generate(this.currentWorld, this.randomGenerator, k, l, i1); + l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; +@@ -225,7 +239,8 @@ + (new WorldGenDeadBush(Blocks.deadbush)).generate(this.currentWorld, this.randomGenerator, k, i1, l); } - for (j = 0; j < this.waterlilyPerChunk; ++j) @@ -108,7 +105,7 @@ { k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; -@@ -298,7 +314,8 @@ +@@ -238,7 +253,8 @@ this.waterlilyGen.generate(this.currentWorld, this.randomGenerator, k, i1, l); } @@ -118,7 +115,7 @@ { if (this.randomGenerator.nextInt(4) == 0) { -@@ -317,7 +334,7 @@ +@@ -257,7 +273,7 @@ } } @@ -126,18 +123,18 @@ + if (doGen && this.randomGenerator.nextInt(4) == 0) { j = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - k = this.randomGenerator.nextInt(128); -@@ -325,7 +342,7 @@ - this.mushroomBrownGen.generate(this.currentWorld, this.randomGenerator, j, k, l); + k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; +@@ -265,7 +281,7 @@ + this.mushroomBrownGen.generate(this.currentWorld, this.randomGenerator, j, l, k); } - if (this.randomGenerator.nextInt(8) == 0) + if (doGen && this.randomGenerator.nextInt(8) == 0) { j = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - k = this.randomGenerator.nextInt(128); -@@ -333,7 +350,8 @@ - this.mushroomRedGen.generate(this.currentWorld, this.randomGenerator, j, k, l); + k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; +@@ -273,7 +289,8 @@ + this.mushroomRedGen.generate(this.currentWorld, this.randomGenerator, j, l, k); } - for (j = 0; j < this.reedsPerChunk; ++j) @@ -146,7 +143,7 @@ { k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; -@@ -341,7 +359,7 @@ +@@ -281,7 +298,7 @@ this.reedGen.generate(this.currentWorld, this.randomGenerator, k, i1, l); } @@ -154,9 +151,9 @@ + for (j = 0; doGen && j < 10; ++j) { k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - l = this.randomGenerator.nextInt(128); -@@ -349,7 +367,8 @@ - this.reedGen.generate(this.currentWorld, this.randomGenerator, k, l, i1); + l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; +@@ -289,7 +306,8 @@ + this.reedGen.generate(this.currentWorld, this.randomGenerator, k, i1, l); } - if (this.randomGenerator.nextInt(32) == 0) @@ -164,9 +161,9 @@ + if (doGen && this.randomGenerator.nextInt(32) == 0) { j = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - k = this.randomGenerator.nextInt(128); -@@ -357,7 +376,8 @@ - (new WorldGenPumpkin()).generate(this.currentWorld, this.randomGenerator, j, k, l); + k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; +@@ -297,7 +315,8 @@ + (new WorldGenPumpkin()).generate(this.currentWorld, this.randomGenerator, j, l, k); } - for (j = 0; j < this.cactiPerChunk; ++j) @@ -174,9 +171,9 @@ + for (j = 0; doGen && j < this.cactiPerChunk; ++j) { k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - l = this.randomGenerator.nextInt(128); -@@ -365,7 +385,8 @@ - this.cactusGen.generate(this.currentWorld, this.randomGenerator, k, l, i1); + l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; +@@ -305,7 +324,8 @@ + this.cactusGen.generate(this.currentWorld, this.randomGenerator, k, i1, l); } - if (this.generateLakes) @@ -185,24 +182,24 @@ { for (j = 0; j < 50; ++j) { -@@ -383,6 +404,8 @@ - (new WorldGenLiquids(Block.lavaMoving.blockID)).generate(this.currentWorld, this.randomGenerator, k, l, i1); +@@ -323,6 +343,8 @@ + (new WorldGenLiquids(Blocks.flowing_lava)).generate(this.currentWorld, this.randomGenerator, k, l, i1); } } + + MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Post(currentWorld, randomGenerator, chunk_X, chunk_Z)); } - /** -@@ -418,13 +441,23 @@ - */ + // JAVADOC METHOD $$ func_76795_a +@@ -352,13 +374,23 @@ + // JAVADOC METHOD $$ func_76797_b protected void generateOres() { + MinecraftForge.ORE_GEN_BUS.post(new OreGenEvent.Pre(currentWorld, randomGenerator, chunk_X, chunk_Z)); + if (TerrainGen.generateOre(currentWorld, randomGenerator, dirtGen, chunk_X, chunk_Z, DIRT)) - this.genStandardOre1(20, this.dirtGen, 0, 128); + this.genStandardOre1(20, this.dirtGen, 0, 256); + if (TerrainGen.generateOre(currentWorld, randomGenerator, gravelGen, chunk_X, chunk_Z, GRAVEL)) - this.genStandardOre1(10, this.gravelGen, 0, 128); + this.genStandardOre1(10, this.gravelGen, 0, 256); + if (TerrainGen.generateOre(currentWorld, randomGenerator, coalGen, chunk_X, chunk_Z, COAL)) this.genStandardOre1(20, this.coalGen, 0, 128); + if (TerrainGen.generateOre(currentWorld, randomGenerator, ironGen, chunk_X, chunk_Z, IRON)) diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch index bb146c8b3..0f1158121 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch @@ -1,16 +1,16 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenBase.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenBase.java -@@ -31,6 +31,9 @@ - import net.minecraft.world.gen.feature.WorldGenTrees; - import net.minecraft.world.gen.feature.WorldGenerator; +@@ -42,6 +42,9 @@ + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; +import net.minecraftforge.common.*; +import net.minecraftforge.event.terraingen.*; + public abstract class BiomeGenBase { - /** An array of all the biomes, indexed by biome id. */ -@@ -141,6 +144,10 @@ + private static final Logger field_150586_aC = LogManager.getLogger(); +@@ -155,6 +158,10 @@ public BiomeGenBase(int par1) { @@ -18,48 +18,52 @@ + } + public BiomeGenBase(int par1, boolean register) + { - this.topBlock = (byte)Block.grass.blockID; - this.fillerBlock = (byte)Block.dirt.blockID; - this.field_76754_C = 5169201; -@@ -159,6 +166,7 @@ - this.worldGeneratorForest = new WorldGenForest(false); + this.topBlock = Blocks.grass; + this.field_150604_aj = 0; + this.fillerBlock = Blocks.dirt; +@@ -173,6 +180,7 @@ + this.worldGeneratorBigTree = new WorldGenBigTree(false); this.worldGeneratorSwamp = new WorldGenSwamp(); this.biomeID = par1; + if (register) biomeList[par1] = this; this.theBiomeDecorator = this.createBiomeDecorator(); - this.spawnableCreatureList.add(new SpawnListEntry(EntitySheep.class, 12, 4, 4)); -@@ -179,8 +187,8 @@ - * Allocate a new BiomeDecorator for this BiomeGenBase - */ + this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntitySheep.class, 12, 4, 4)); +@@ -193,7 +201,7 @@ + // JAVADOC METHOD $$ func_76729_a public BiomeDecorator createBiomeDecorator() -- { -- return new BiomeDecorator(this); -+ { -+ return getModdedBiomeDecorator(new BiomeDecorator(this)); + { +- return new BiomeDecorator(); ++ return getModdedBiomeDecorator(new BiomeDecorator()); } - /** -@@ -372,7 +380,7 @@ + // JAVADOC METHOD $$ func_76732_a +@@ -373,7 +381,7 @@ { - double d0 = (double)MathHelper.clamp_float(this.getFloatTemperature(), 0.0F, 1.0F); + double d0 = (double)MathHelper.clamp_float(this.func_150564_a(p_150558_1_, p_150558_2_, p_150558_3_), 0.0F, 1.0F); double d1 = (double)MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F); - return ColorizerGrass.getGrassColor(d0, d1); + return getModdedBiomeGrassColor(ColorizerGrass.getGrassColor(d0, d1)); } @SideOnly(Side.CLIENT) -@@ -384,6 +392,32 @@ +@@ -381,7 +389,7 @@ { - double d0 = (double)MathHelper.clamp_float(this.getFloatTemperature(), 0.0F, 1.0F); + double d0 = (double)MathHelper.clamp_float(this.func_150564_a(p_150571_1_, p_150571_2_, p_150571_3_), 0.0F, 1.0F); double d1 = (double)MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F); - return ColorizerFoliage.getFoliageColor(d0, d1); + return getModdedBiomeFoliageColor(ColorizerFoliage.getFoliageColor(d0, d1)); } -+ + + public boolean func_150559_j() +@@ -529,6 +537,34 @@ + } + } + ++ /* ========================================= FORGE START ======================================*/ + public BiomeDecorator getModdedBiomeDecorator(BiomeDecorator original) + { -+ return new DeferredBiomeDecorator(this, original); ++ return new DeferredBiomeDecorator(original); + } + + public int getWaterColorMultiplier() @@ -82,4 +86,8 @@ + MinecraftForge.EVENT_BUS.post(event); + return event.newColor; + } - } ++ /* ========================================= FORGE END ======================================*/ ++ + static + { + plains.func_150566_k(); diff --git a/patches/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch b/patches/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch index c79c96a2d..bfce4e895 100644 --- a/patches/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch @@ -7,22 +7,22 @@ +import java.util.Arrays; import java.util.List; import java.util.Random; - import net.minecraft.world.ChunkPosition; -@@ -11,8 +12,13 @@ + import net.minecraft.crash.CrashReport; +@@ -13,9 +14,13 @@ + import net.minecraft.world.WorldType; import net.minecraft.world.gen.layer.GenLayer; import net.minecraft.world.gen.layer.IntCache; - -+import net.minecraftforge.common.*; -+import net.minecraftforge.event.terraingen.*; ++import net.minecraftforge.common.MinecraftForge; ++import net.minecraftforge.event.terraingen.WorldTypeEvent; +import static net.minecraft.world.biome.BiomeGenBase.*; -+ + public class WorldChunkManager { + public static ArrayList allowedBiomes = new ArrayList(Arrays.asList(forest, plains, taiga, taigaHills, forestHills, jungle, jungleHills)); private GenLayer genBiomes; - - /** A GenLayer containing the indices into BiomeGenBase.biomeList[] */ -@@ -28,19 +34,14 @@ + // JAVADOC FIELD $$ field_76945_e + private GenLayer biomeIndexLayer; +@@ -29,19 +34,14 @@ { this.biomeCache = new BiomeCache(this); this.biomesToSpawnIn = new ArrayList(); @@ -44,7 +44,7 @@ this.genBiomes = agenlayer[0]; this.biomeIndexLayer = agenlayer[1]; } -@@ -264,4 +265,11 @@ +@@ -254,4 +254,11 @@ { this.biomeCache.cleanupCache(); } diff --git a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch index 1e34021a0..609b5ac11 100644 --- a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch @@ -1,212 +1,99 @@ --- ../src-base/minecraft/net/minecraft/world/chunk/Chunk.java +++ ../src-work/minecraft/net/minecraft/world/chunk/Chunk.java -@@ -25,6 +25,10 @@ +@@ -29,6 +29,10 @@ + import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.WorldChunkManager; import net.minecraft.world.chunk.storage.ExtendedBlockStorage; - +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.entity.EntityEvent; +import net.minecraftforge.event.world.ChunkEvent; + - public class Chunk - { - /** -@@ -140,7 +144,9 @@ - { - for (int j1 = 0; j1 < k; ++j1) - { -- byte b0 = par2ArrayOfByte[l << 11 | i1 << 7 | j1]; -+ /* FORGE: The following change, a cast from unsigned byte to int, -+ * fixes a vanilla bug when generating new chunks that contain a block ID > 127 */ -+ int b0 = par2ArrayOfByte[l << 11 | i1 << 7 | j1] & 0xFF; + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; - if (b0 != 0) +@@ -217,7 +221,7 @@ { -@@ -159,6 +165,92 @@ - } + Block block = this.func_150810_a(j, l - 1, k); - /** -+ * Metadata sensitive Chunk constructor for use in new ChunkProviders that -+ * use metadata sensitive blocks during generation. -+ * -+ * @param world The world this chunk belongs to -+ * @param ids A ByteArray containing all the BlockID's to set this chunk to -+ * @param metadata A ByteArray containing all the metadata to set this chunk to -+ * @param chunkX The chunk's X position -+ * @param chunkZ The Chunk's Z position -+ */ -+ public Chunk(World world, byte[] ids, byte[] metadata, int chunkX, int chunkZ) -+ { -+ this(world, chunkX, chunkZ); -+ int k = ids.length / 256; -+ -+ for (int x = 0; x < 16; ++x) -+ { -+ for (int z = 0; z < 16; ++z) -+ { -+ for (int y = 0; y < k; ++y) -+ { -+ int idx = x << 11 | z << 7 | y; -+ int id = ids[idx] & 0xFF; -+ int meta = metadata[idx]; -+ -+ if (id != 0) -+ { -+ int l = y >> 4; -+ -+ if (this.storageArrays[l] == null) -+ { -+ this.storageArrays[l] = new ExtendedBlockStorage(l << 4, !world.provider.hasNoSky); -+ } -+ -+ this.storageArrays[l].setExtBlockID(x, y & 15, z, id); -+ this.storageArrays[l].setExtBlockMetadata(x, y & 15, z, meta); -+ } -+ } -+ } -+ } -+ } -+ -+ /** -+ * A Chunk Constructor which handles shorts to allow block ids > 256 (full 4096 range) -+ * Meta data sensitive -+ * NOTE: The x,y,z order of the array is different from the native Chunk constructor to allow for generation > y127 -+ * NOTE: This is possibly more efficient than the standard constructor due to less memory skipping -+ * -+ * @param world The world this chunk belongs to -+ * @param ids A ShortArray containing all the BlockID's to set this chunk to (x is low order, z is mid, y is high) -+ * @param metadata A ByteArray containing all the metadata to set this chunk to -+ * @param chunkX The chunk's X position -+ * @param chunkZ The Chunk's Z position -+ */ -+ public Chunk(World world, short[] ids, byte[] metadata, int chunkX, int chunkZ) -+ { -+ this(world, chunkX, chunkZ); -+ int max = ids.length / 256; -+ -+ for (int y = 0; y < max; ++y) -+ { -+ for (int z = 0; z < 16; ++z) -+ { -+ for (int x = 0; x < 16; ++x) -+ { -+ int idx = y << 8 | z << 4 | x; -+ int id = ids[idx] & 0xFFFFFF; -+ int meta = metadata[idx]; -+ -+ if (id != 0) -+ { -+ int storageBlock = y >> 4; -+ -+ if (this.storageArrays[storageBlock] == null) -+ { -+ this.storageArrays[storageBlock] = new ExtendedBlockStorage(storageBlock << 4, !world.provider.hasNoSky); -+ } -+ -+ this.storageArrays[storageBlock].setExtBlockID(x, y & 15, z, id); -+ this.storageArrays[storageBlock].setExtBlockMetadata(x, y & 15, z, meta); -+ } -+ } -+ } -+ } -+ } -+ -+ /** - * Checks whether the chunk is at the X/Z location specified - */ - public boolean isAtLocation(int par1, int par2) -@@ -222,7 +314,7 @@ - { - int i1 = this.getBlockID(j, l - 1, k); - -- if (Block.lightOpacity[i1] == 0) -+ if (getBlockLightOpacity(j, l - 1, k) == 0) +- if (block.func_149717_k() == 0) ++ if (func_150808_b(j, l - 1, k) == 0) { --l; continue; -@@ -528,7 +620,10 @@ +@@ -520,7 +524,9 @@ - public int getBlockLightOpacity(int par1, int par2, int par3) + public int func_150808_b(int p_150808_1_, int p_150808_2_, int p_150808_3_) { -- return Block.lightOpacity[this.getBlockID(par1, par2, par3)]; -+ int x = (xPosition << 4) + par1; -+ int z = (zPosition << 4) + par3; -+ Block block = Block.blocksList[getBlockID(par1, par2, par3)]; -+ return (block == null ? 0 : block.getLightOpacity(worldObj, x, par2, z)); +- return this.func_150810_a(p_150808_1_, p_150808_2_, p_150808_3_).func_149717_k(); ++ int x = (xPosition << 4) + p_150808_1_; ++ int z = (zPosition << 4) + p_150808_3_; ++ return this.func_150810_a(p_150808_1_, p_150808_2_, p_150808_3_).getLightOpacity(worldObj, x, p_150808_2_, p_150808_3_); } - /** -@@ -615,9 +710,13 @@ - { - Block.blocksList[l1].breakBlock(this.worldObj, j2, par2, k2, l1, i2); - } -- else if (Block.blocksList[l1] instanceof ITileEntityProvider && l1 != par4) -+ else if (Block.blocksList[l1] != null && Block.blocksList[l1].hasTileEntity(i2)) - { -- this.worldObj.removeBlockTileEntity(j2, par2, k2); -+ TileEntity te = worldObj.getBlockTileEntity(j2, par2, k2); -+ if (te != null && te.shouldRefresh(l1, par4, i2, par5, worldObj, j2, par2, k2)) -+ { -+ this.worldObj.removeBlockTileEntity(j2, par2, k2); -+ } - } + public Block func_150810_a(final int p_150810_1_, final int p_150810_2_, final int p_150810_3_) +@@ -618,9 +624,13 @@ + { + block1.func_149749_a(this.worldObj, l1, p_150807_2_, i2, block1, k1); + } +- else if (block1 instanceof ITileEntityProvider && block1 != p_150807_4_) ++ else if (block1.hasTileEntity(k1)) + { +- this.worldObj.func_147475_p(l1, p_150807_2_, i2); ++ TileEntity te = this.getTileEntityUnsafe(p_150807_1_ & 0x0F, p_150807_2_, p_150807_3_ & 0x0F); ++ if (te != null && te.shouldRefresh(block1, p_150807_4_, k1, p_150807_5_, worldObj, l1, p_150807_2_, i2)) ++ { ++ this.worldObj.func_147475_p(l1, p_150807_2_, i2); ++ } } -@@ -635,7 +734,7 @@ - } - else - { -- if (Block.lightOpacity[par4 & 4095] > 0) -+ if (getBlockLightOpacity(par1, par2, par3) > 0) - { - if (par2 >= k1) - { -@@ -659,32 +758,24 @@ - Block.blocksList[par4].onBlockAdded(this.worldObj, j2, par2, k2); - } + if (extendedblockstorage.func_150819_a(p_150807_1_, p_150807_2_ & 15, p_150807_3_) != p_150807_4_) +@@ -660,34 +670,19 @@ -- if (Block.blocksList[par4] instanceof ITileEntityProvider) -+ if (Block.blocksList[par4] != null && Block.blocksList[par4].hasTileEntity(par5)) - { - tileentity = this.getChunkBlockTileEntity(par1, par2, par3); + TileEntity tileentity; - if (tileentity == null) - { -- tileentity = ((ITileEntityProvider)Block.blocksList[par4]).createNewTileEntity(this.worldObj); -+ tileentity = Block.blocksList[par4].createTileEntity(this.worldObj, par5); - this.worldObj.setBlockTileEntity(j2, par2, k2, tileentity); - } - - if (tileentity != null) - { - tileentity.updateContainingBlockInfo(); -+ tileentity.blockMetadata = par5; - } - } - } -- else if (l1 > 0 && Block.blocksList[l1] instanceof ITileEntityProvider) +- if (block1 instanceof ITileEntityProvider) - { -- tileentity = this.getChunkBlockTileEntity(par1, par2, par3); - +- tileentity = this.func_150806_e(p_150807_1_, p_150807_2_, p_150807_3_); +- - if (tileentity != null) - { -- tileentity.updateContainingBlockInfo(); +- tileentity.func_145836_u(); - } - } - - this.isModified = true; - return true; - } -@@ -716,7 +807,7 @@ - extendedblockstorage.setExtBlockMetadata(par1, par2 & 15, par3, par4); - int j1 = extendedblockstorage.getExtBlockID(par1, par2 & 15, par3); - -- if (j1 > 0 && Block.blocksList[j1] instanceof ITileEntityProvider) -+ if (j1 > 0 && Block.blocksList[j1] != null && Block.blocksList[j1].hasTileEntity(par4)) + if (!this.worldObj.isRemote) { - TileEntity tileentity = this.getChunkBlockTileEntity(par1, par2, par3); + p_150807_4_.func_149726_b(this.worldObj, l1, p_150807_2_, i2); + } -@@ -829,6 +920,7 @@ +- if (p_150807_4_ instanceof ITileEntityProvider) ++ if (p_150807_4_.hasTileEntity(p_150807_5_)) + { + tileentity = this.func_150806_e(p_150807_1_, p_150807_2_, p_150807_3_); + +- if (tileentity == null) +- { +- tileentity = ((ITileEntityProvider)p_150807_4_).func_149915_a(this.worldObj, p_150807_5_); +- this.worldObj.func_147455_a(l1, p_150807_2_, i2, tileentity); +- } +- + if (tileentity != null) + { + tileentity.func_145836_u(); ++ tileentity.field_145847_g = p_150807_5_; + } + } + +@@ -719,7 +714,7 @@ + this.isModified = true; + extendedblockstorage.setExtBlockMetadata(par1, par2 & 15, par3, par4); + +- if (extendedblockstorage.func_150819_a(par1, par2 & 15, par3) instanceof ITileEntityProvider) ++ if (extendedblockstorage.func_150819_a(par1, par2 & 15, par3).hasTileEntity(par4)) + { + TileEntity tileentity = this.func_150806_e(par1, par2, par3); + +@@ -823,6 +818,7 @@ k = this.entityLists.length - 1; } @@ -214,40 +101,35 @@ par1Entity.addedToChunk = true; par1Entity.chunkCoordX = this.xPosition; par1Entity.chunkCoordY = k; -@@ -878,33 +970,32 @@ - ChunkPosition chunkposition = new ChunkPosition(par1, par2, par3); - TileEntity tileentity = (TileEntity)this.chunkTileEntityMap.get(chunkposition); +@@ -863,28 +859,27 @@ + ChunkPosition chunkposition = new ChunkPosition(p_150806_1_, p_150806_2_, p_150806_3_); + TileEntity tileentity = (TileEntity)this.field_150816_i.get(chunkposition); -+ if (tileentity != null && tileentity.isInvalid()) ++ if (tileentity != null && tileentity.func_145837_r()) + { -+ chunkTileEntityMap.remove(chunkposition); ++ field_150816_i.remove(chunkposition); + tileentity = null; + } + if (tileentity == null) { - int l = this.getBlockID(par1, par2, par3); -+ int meta = this.getBlockMetadata(par1, par2, par3); + Block block = this.func_150810_a(p_150806_1_, p_150806_2_, p_150806_3_); ++ int meta = this.getBlockMetadata(p_150806_1_, p_150806_2_, p_150806_3_); -- if (l <= 0 || !Block.blocksList[l].hasTileEntity()) -+ if (l <= 0 || !Block.blocksList[l].hasTileEntity(meta)) +- if (!block.func_149716_u()) ++ if (!block.hasTileEntity(meta)) { return null; } - if (tileentity == null) - { -- tileentity = ((ITileEntityProvider)Block.blocksList[l]).createNewTileEntity(this.worldObj); -+ tileentity = Block.blocksList[l].createTileEntity(this.worldObj, meta); - this.worldObj.setBlockTileEntity(this.xPosition * 16 + par1, par2, this.zPosition * 16 + par3, tileentity); - } - - tileentity = (TileEntity)this.chunkTileEntityMap.get(chunkposition); +- tileentity = ((ITileEntityProvider)block).func_149915_a(this.worldObj, this.getBlockMetadata(p_150806_1_, p_150806_2_, p_150806_3_)); ++ tileentity = block.createTileEntity(worldObj, meta); + this.worldObj.func_147455_a(this.xPosition * 16 + p_150806_1_, p_150806_2_, this.zPosition * 16 + p_150806_3_, tileentity); } -- if (tileentity != null && tileentity.isInvalid()) +- if (tileentity != null && tileentity.func_145837_r()) - { -- this.chunkTileEntityMap.remove(chunkposition); +- this.field_150816_i.remove(chunkposition); - return null; - } - else @@ -257,126 +139,154 @@ + return tileentity; } - /** -@@ -919,7 +1010,7 @@ + public void func_150813_a(TileEntity p_150813_1_) +@@ -896,7 +891,7 @@ if (this.isChunkLoaded) { -- this.worldObj.loadedTileEntityList.add(par1TileEntity); -+ this.worldObj.addTileEntity(par1TileEntity); +- this.worldObj.field_147482_g.add(p_150813_1_); ++ this.worldObj.addTileEntity(p_150813_1_); } } -@@ -934,7 +1025,8 @@ - par4TileEntity.yCoord = par2; - par4TileEntity.zCoord = this.zPosition * 16 + par3; +@@ -908,7 +903,8 @@ + p_150812_4_.field_145848_d = p_150812_2_; + p_150812_4_.field_145849_e = this.zPosition * 16 + p_150812_3_; -- if (this.getBlockID(par1, par2, par3) != 0 && Block.blocksList[this.getBlockID(par1, par2, par3)] instanceof ITileEntityProvider) -+ Block block = Block.blocksList[getBlockID(par1, par2, par3)]; -+ if (block != null && block.hasTileEntity(getBlockMetadata(par1, par2, par3))) +- if (this.func_150810_a(p_150812_1_, p_150812_2_, p_150812_3_) instanceof ITileEntityProvider) ++ int metadata = getBlockMetadata( p_150812_4_.field_145851_c, p_150812_4_.field_145848_d, p_150812_4_.field_145849_e); ++ if (this.func_150810_a(p_150812_1_, p_150812_2_, p_150812_3_).hasTileEntity(metadata)) { - if (this.chunkTileEntityMap.containsKey(chunkposition)) + if (this.field_150816_i.containsKey(chunkposition)) { -@@ -984,6 +1076,7 @@ +@@ -953,6 +949,7 @@ this.worldObj.addLoadedEntities(this.entityLists[i]); } + MinecraftForge.EVENT_BUS.post(new ChunkEvent.Load(this)); } - /** -@@ -1004,6 +1097,7 @@ + // JAVADOC METHOD $$ func_76623_d +@@ -971,6 +968,7 @@ { this.worldObj.unloadEntities(this.entityLists[i]); } + MinecraftForge.EVENT_BUS.post(new ChunkEvent.Unload(this)); } - /** -@@ -1020,8 +1114,8 @@ - */ + // JAVADOC METHOD $$ func_76630_e +@@ -982,8 +980,8 @@ + // JAVADOC METHOD $$ func_76588_a public void getEntitiesWithinAABBForEntity(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB, List par3List, IEntitySelector par4IEntitySelector) { - int i = MathHelper.floor_double((par2AxisAlignedBB.minY - 2.0D) / 16.0D); - int j = MathHelper.floor_double((par2AxisAlignedBB.maxY + 2.0D) / 16.0D); + int i = MathHelper.floor_double((par2AxisAlignedBB.minY - World.MAX_ENTITY_RADIUS) / 16.0D); + int j = MathHelper.floor_double((par2AxisAlignedBB.maxY + World.MAX_ENTITY_RADIUS) / 16.0D); + i = MathHelper.clamp_int(i, 0, this.entityLists.length - 1); + j = MathHelper.clamp_int(j, 0, this.entityLists.length - 1); - if (i < 0) - { -@@ -1070,8 +1164,8 @@ - */ +@@ -1020,8 +1018,8 @@ + // JAVADOC METHOD $$ func_76618_a public void getEntitiesOfTypeWithinAAAB(Class par1Class, AxisAlignedBB par2AxisAlignedBB, List par3List, IEntitySelector par4IEntitySelector) { - int i = MathHelper.floor_double((par2AxisAlignedBB.minY - 2.0D) / 16.0D); - int j = MathHelper.floor_double((par2AxisAlignedBB.maxY + 2.0D) / 16.0D); + int i = MathHelper.floor_double((par2AxisAlignedBB.minY - World.MAX_ENTITY_RADIUS) / 16.0D); + int j = MathHelper.floor_double((par2AxisAlignedBB.maxY + World.MAX_ENTITY_RADIUS) / 16.0D); + i = MathHelper.clamp_int(i, 0, this.entityLists.length - 1); + j = MathHelper.clamp_int(j, 0, this.entityLists.length - 1); - if (i < 0) - { -@@ -1254,6 +1348,15 @@ - */ +@@ -1185,6 +1183,15 @@ + @SideOnly(Side.CLIENT) public void fillChunk(byte[] par1ArrayOfByte, int par2, int par3, boolean par4) { -+ Iterator iterator = chunkTileEntityMap.values().iterator(); ++ Iterator iterator = field_150816_i.values().iterator(); + while(iterator.hasNext()) + { + TileEntity tileEntity = (TileEntity)iterator.next(); -+ tileEntity.updateContainingBlockInfo(); -+ tileEntity.getBlockMetadata(); -+ tileEntity.getBlockType(); ++ tileEntity.func_145836_u(); ++ tileEntity.func_145832_p(); ++ tileEntity.func_145838_q(); + } + int k = 0; boolean flag1 = !this.worldObj.provider.hasNoSky; int l; -@@ -1354,13 +1457,27 @@ - } - +@@ -1287,13 +1294,27 @@ + this.field_150814_l = true; + this.isTerrainPopulated = true; this.generateHeightMap(); -- Iterator iterator = this.chunkTileEntityMap.values().iterator(); - +- Iterator iterator = this.field_150816_i.values().iterator(); + List invalidList = new ArrayList(); -+ iterator = chunkTileEntityMap.values().iterator(); ++ iterator = this.field_150816_i.values().iterator(); + while (iterator.hasNext()) { -- TileEntity tileentity = (TileEntity)iterator.next(); -- tileentity.updateContainingBlockInfo(); -+ TileEntity tileEntity = (TileEntity)iterator.next(); -+ int x = tileEntity.xCoord & 15; -+ int y = tileEntity.yCoord; -+ int z = tileEntity.zCoord & 15; -+ Block block = tileEntity.getBlockType(); -+ if (block == null || block.blockID != getBlockID(x, y, z) || tileEntity.getBlockMetadata() != getBlockMetadata(x, y, z)) + TileEntity tileentity = (TileEntity)iterator.next(); ++ int x = tileentity.field_145851_c & 15; ++ int y = tileentity.field_145848_d; ++ int z = tileentity.field_145849_e & 15; ++ Block block = tileentity.func_145838_q(); ++ if (block != func_150810_a(x, y, z) || tileentity.field_145847_g != this.getBlockMetadata(x, y, z)) + { -+ invalidList.add(tileEntity); ++ invalidList.add(tileentity); + } -+ tileEntity.updateContainingBlockInfo(); + tileentity.func_145836_u(); } + -+ for (TileEntity tileEntity : invalidList) ++ for (TileEntity te : invalidList) + { -+ tileEntity.invalidate(); ++ te.func_145843_s(); + } } - /** -@@ -1468,4 +1585,18 @@ - } - } + // JAVADOC METHOD $$ func_76591_a +@@ -1501,4 +1522,48 @@ + + return true; } + -+ /** FORGE: Used to remove only invalid TileEntities */ -+ public void cleanChunkBlockTileEntity(int x, int y, int z) ++ /** ++ * Retrieves the tile entity, WITHOUT creating it. ++ * Good for checking if it exists. ++ * ++ * @param x ++ * @param y ++ * @param z ++ * @return The tile entity at the specified location, if it exists and is valid. ++ */ ++ public TileEntity getTileEntityUnsafe(int x, int y, int z) ++ { ++ ChunkPosition chunkposition = new ChunkPosition(x, y, z); ++ TileEntity tileentity = (TileEntity)this.field_150816_i.get(chunkposition); ++ ++ if (tileentity != null && tileentity.func_145837_r()) ++ { ++ field_150816_i.remove(chunkposition); ++ tileentity = null; ++ } ++ ++ return tileentity; ++ } ++ ++ /** ++ * Removes the tile entity at the specified position, only if it's ++ * marked as invalid. ++ * ++ * @param x ++ * @param y ++ * @param z ++ */ ++ public void removeInvalidTileEntity(int x, int y, int z) + { + ChunkPosition position = new ChunkPosition(x, y, z); + if (isChunkLoaded) + { -+ TileEntity entity = (TileEntity)chunkTileEntityMap.get(position); -+ if (entity != null && entity.isInvalid()) ++ TileEntity entity = (TileEntity)field_150816_i.get(position); ++ if (entity != null && entity.func_145837_r()) + { -+ chunkTileEntityMap.remove(position); ++ field_150816_i.remove(position); + } + } + } diff --git a/patches/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch b/patches/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch index d0de2f74c..08ae6c78d 100644 --- a/patches/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch @@ -1,15 +1,15 @@ --- ../src-base/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java +++ ../src-work/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java -@@ -27,6 +27,8 @@ +@@ -25,6 +25,8 @@ import net.minecraft.world.chunk.NibbleArray; import net.minecraft.world.storage.IThreadedFileIO; import net.minecraft.world.storage.ThreadedFileIOBase; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.world.ChunkDataEvent; - public class AnvilChunkLoader implements IChunkLoader, IThreadedFileIO - { -@@ -108,6 +110,7 @@ + import org.apache.logging.log4j.Level; + import org.apache.logging.log4j.LogManager; +@@ -109,6 +111,7 @@ chunk = this.readChunkFromNBT(par1World, par4NBTTagCompound.getCompoundTag("Level")); } @@ -17,7 +17,7 @@ return chunk; } } -@@ -122,6 +125,7 @@ +@@ -123,6 +126,7 @@ NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound.setTag("Level", nbttagcompound1); this.writeChunkToNBT(par2Chunk, par1World, nbttagcompound1); diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch index 0c37a1991..4a16b1b1a 100644 --- a/patches/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch @@ -1,22 +1,21 @@ --- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java +++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java -@@ -13,6 +13,10 @@ +@@ -15,6 +15,10 @@ import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.IChunkProvider; +import net.minecraftforge.common.*; -+import net.minecraftforge.event.Event.*; ++import cpw.mods.fml.common.eventhandler.Event.*; +import net.minecraftforge.event.terraingen.*; + public class ChunkProviderEnd implements IChunkProvider { private Random endRNG; -@@ -42,8 +46,16 @@ +@@ -44,6 +48,14 @@ this.noiseGen3 = new NoiseGeneratorOctaves(this.endRNG, 8); this.noiseGen4 = new NoiseGeneratorOctaves(this.endRNG, 10); this.noiseGen5 = new NoiseGeneratorOctaves(this.endRNG, 16); -- } - ++ + NoiseGeneratorOctaves[] noiseGens = {noiseGen1, noiseGen2, noiseGen3, noiseGen4, noiseGen5}; + noiseGens = TerrainGen.getModdedNoiseGenerators(par1World, this.endRNG, noiseGens); + this.noiseGen1 = noiseGens[0]; @@ -24,24 +23,22 @@ + this.noiseGen3 = noiseGens[2]; + this.noiseGen4 = noiseGens[3]; + this.noiseGen5 = noiseGens[4]; -+ } -+ - public void generateTerrain(int par1, int par2, byte[] par3ArrayOfByte, BiomeGenBase[] par4ArrayOfBiomeGenBase) - { - byte b0 = 2; -@@ -114,6 +126,10 @@ + } - public void replaceBlocksForBiome(int par1, int par2, byte[] par3ArrayOfByte, BiomeGenBase[] par4ArrayOfBiomeGenBase) + public void func_147420_a(int p_147420_1_, int p_147420_2_, Block[] p_147420_3_, BiomeGenBase[] p_147420_4_) +@@ -116,6 +128,10 @@ + + public void func_147421_b(int p_147421_1_, int p_147421_2_, Block[] p_147421_3_, BiomeGenBase[] p_147421_4_) { -+ ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, par1, par2, par3ArrayOfByte, par4ArrayOfBiomeGenBase); ++ ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, p_147421_1_, p_147421_2_, p_147421_3_, p_147421_4_); + MinecraftForge.EVENT_BUS.post(event); + if (event.getResult() == Result.DENY) return; + for (int k = 0; k < 16; ++k) { for (int l = 0; l < 16; ++l) -@@ -201,6 +217,10 @@ - */ +@@ -198,6 +214,10 @@ + // JAVADOC METHOD $$ func_73187_a private double[] initializeNoiseField(double[] par1ArrayOfDouble, int par2, int par3, int par4, int par5, int par6, int par7) { + ChunkProviderEvent.InitNoiseField event = new ChunkProviderEvent.InitNoiseField(this, par1ArrayOfDouble, par2, par3, par4, par5, par6, par7); @@ -51,10 +48,10 @@ if (par1ArrayOfDouble == null) { par1ArrayOfDouble = new double[par5 * par6 * par7]; -@@ -348,10 +368,16 @@ +@@ -341,10 +361,16 @@ public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) { - BlockSand.fallInstantly = true; + BlockFalling.field_149832_M = true; + + MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(par1IChunkProvider, endWorld, endWorld.rand, par2, par3, false)); + @@ -65,6 +62,6 @@ + + MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(par1IChunkProvider, endWorld, endWorld.rand, par2, par3, false)); + - BlockSand.fallInstantly = false; + BlockFalling.field_149832_M = false; } diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch index 90855020d..ebcf80c50 100644 --- a/patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch @@ -1,21 +1,21 @@ --- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java +++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java -@@ -20,6 +20,12 @@ +@@ -22,6 +22,12 @@ import net.minecraft.world.gen.structure.MapGenStronghold; import net.minecraft.world.gen.structure.MapGenVillage; +import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.*; +import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.*; +import net.minecraftforge.common.*; -+import net.minecraftforge.event.Event.*; ++import cpw.mods.fml.common.eventhandler.Event.*; +import net.minecraftforge.event.terraingen.*; + public class ChunkProviderGenerate implements IChunkProvider { - /** RNG. */ -@@ -92,6 +98,15 @@ - float[] parabolicField; + // JAVADOC FIELD $$ field_73220_k +@@ -62,6 +68,15 @@ int[][] field_73219_j = new int[32][32]; + private static final String __OBFID = "CL_00000396"; + { + caveGenerator = TerrainGen.getModdedMapGen(caveGenerator, CAVE); @@ -24,51 +24,40 @@ + mineshaftGenerator = (MapGenMineshaft) TerrainGen.getModdedMapGen(mineshaftGenerator, MINESHAFT); + scatteredFeatureGenerator = (MapGenScatteredFeature) TerrainGen.getModdedMapGen(scatteredFeatureGenerator, SCATTERED_FEATURE); + ravineGenerator = TerrainGen.getModdedMapGen(ravineGenerator, RAVINE); -+ } ++ } + public ChunkProviderGenerate(World par1World, long par2, boolean par4) { this.worldObj = par1World; -@@ -104,6 +119,16 @@ - this.noiseGen5 = new NoiseGeneratorOctaves(this.rand, 10); - this.noiseGen6 = new NoiseGeneratorOctaves(this.rand, 16); - this.mobSpawnerNoise = new NoiseGeneratorOctaves(this.rand, 8); +@@ -86,6 +101,16 @@ + this.field_147433_r[j + 2 + (k + 2) * 5] = f; + } + } + -+ NoiseGeneratorOctaves[] noiseGens = {noiseGen1, noiseGen2, noiseGen3, noiseGen4, noiseGen5, noiseGen6, mobSpawnerNoise}; ++ NoiseGeneratorOctaves[] noiseGens = {field_147431_j, field_147432_k, field_147429_l, field_147430_m, noiseGen5, noiseGen6, mobSpawnerNoise}; + noiseGens = TerrainGen.getModdedNoiseGenerators(par1World, this.rand, noiseGens); -+ this.noiseGen1 = noiseGens[0]; -+ this.noiseGen2 = noiseGens[1]; -+ this.noiseGen3 = noiseGens[2]; -+ this.noiseGen4 = noiseGens[3]; ++ this.field_147431_j = noiseGens[0]; ++ this.field_147432_k = noiseGens[1]; ++ this.field_147429_l = noiseGens[2]; ++ this.field_147430_m = noiseGens[3]; + this.noiseGen5 = noiseGens[4]; + this.noiseGen6 = noiseGens[5]; + this.mobSpawnerNoise = noiseGens[6]; } - /** -@@ -189,6 +214,10 @@ - */ - public void replaceBlocksForBiome(int par1, int par2, byte[] par3ArrayOfByte, BiomeGenBase[] par4ArrayOfBiomeGenBase) + public void func_147424_a(int p_147424_1_, int p_147424_2_, Block[] p_147424_3_) +@@ -167,6 +192,10 @@ + + public void func_147422_a(int p_147422_1_, int p_147422_2_, Block[] p_147422_3_, byte[] p_147422_4_, BiomeGenBase[] p_147422_5_) { -+ ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, par1, par2, par3ArrayOfByte, par4ArrayOfBiomeGenBase); ++ ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, p_147422_1_, p_147422_2_, p_147422_3_, p_147422_5_); + MinecraftForge.EVENT_BUS.post(event); + if (event.getResult() == Result.DENY) return; + - byte b0 = 63; double d0 = 0.03125D; - this.stoneNoise = this.noiseGen4.generateNoiseOctaves(this.stoneNoise, par1 * 16, par2 * 16, 0, 16, 16, 1, d0 * 2.0D, d0 * 2.0D, d0 * 2.0D); -@@ -324,6 +353,10 @@ - */ - private double[] initializeNoiseField(double[] par1ArrayOfDouble, int par2, int par3, int par4, int par5, int par6, int par7) - { -+ ChunkProviderEvent.InitNoiseField event = new ChunkProviderEvent.InitNoiseField(this, par1ArrayOfDouble, par2, par3, par4, par5, par6, par7); -+ MinecraftForge.EVENT_BUS.post(event); -+ if (event.getResult() == Result.DENY) return event.noisefield; -+ - if (par1ArrayOfDouble == null) - { - par1ArrayOfDouble = new double[par5 * par6 * par7]; -@@ -492,6 +525,8 @@ + this.stoneNoise = this.field_147430_m.func_151599_a(this.stoneNoise, (double)(p_147422_1_ * 16), (double)(p_147422_2_ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D); + +@@ -359,6 +388,8 @@ this.rand.setSeed((long)par2 * i1 + (long)par3 * j1 ^ this.worldObj.getSeed()); boolean flag = false; @@ -77,7 +66,7 @@ if (this.mapFeaturesEnabled) { this.mineshaftGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3); -@@ -504,7 +539,8 @@ +@@ -371,7 +402,8 @@ int l1; int i2; @@ -86,18 +75,17 @@ + && TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, LAKE)) { k1 = k + this.rand.nextInt(16) + 8; - l1 = this.rand.nextInt(128); -@@ -512,7 +548,8 @@ - (new WorldGenLakes(Block.waterStill.blockID)).generate(this.worldObj, this.rand, k1, l1, i2); + l1 = this.rand.nextInt(256); +@@ -379,7 +411,7 @@ + (new WorldGenLakes(Blocks.water)).generate(this.worldObj, this.rand, k1, l1, i2); } - if (!flag && this.rand.nextInt(8) == 0) -+ if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, LAVA) && -+ !flag && this.rand.nextInt(8) == 0) ++ if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, LAVA) && !flag && this.rand.nextInt(8) == 0) { k1 = k + this.rand.nextInt(16) + 8; - l1 = this.rand.nextInt(this.rand.nextInt(120) + 8); -@@ -524,7 +561,8 @@ + l1 = this.rand.nextInt(this.rand.nextInt(248) + 8); +@@ -391,7 +423,8 @@ } } @@ -106,8 +94,8 @@ + for (k1 = 0; doGen && k1 < 8; ++k1) { l1 = k + this.rand.nextInt(16) + 8; - i2 = this.rand.nextInt(128); -@@ -537,7 +575,8 @@ + i2 = this.rand.nextInt(256); +@@ -404,7 +437,8 @@ k += 8; l += 8; @@ -117,12 +105,12 @@ { for (l1 = 0; l1 < 16; ++l1) { -@@ -555,6 +594,8 @@ +@@ -422,6 +456,8 @@ } } + MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(par1IChunkProvider, worldObj, rand, par2, par3, flag)); + - BlockSand.fallInstantly = false; + BlockFalling.field_149832_M = false; } diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch index c446cf0f8..59a6556bb 100644 --- a/patches/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch @@ -1,22 +1,23 @@ --- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderHell.java +++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderHell.java -@@ -19,6 +19,13 @@ +@@ -21,6 +21,14 @@ import net.minecraft.world.gen.feature.WorldGenMinable; import net.minecraft.world.gen.structure.MapGenNetherBridge; +import static net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.*; +import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.*; +import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.*; ++import static net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.*; +import net.minecraftforge.common.*; -+import net.minecraftforge.event.Event.*; ++import cpw.mods.fml.common.eventhandler.Event.*; +import net.minecraftforge.event.terraingen.*; + public class ChunkProviderHell implements IChunkProvider { private Random hellRNG; -@@ -60,6 +67,11 @@ - double[] noiseData4; +@@ -51,6 +59,11 @@ double[] noiseData5; + private static final String __OBFID = "CL_00000392"; + { + genNetherBridge = (MapGenNetherBridge) TerrainGen.getModdedMapGen(genNetherBridge, NETHER_BRIDGE); @@ -26,7 +27,7 @@ public ChunkProviderHell(World par1World, long par2) { this.worldObj = par1World; -@@ -71,6 +83,16 @@ +@@ -62,6 +75,16 @@ this.netherrackExculsivityNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4); this.netherNoiseGen6 = new NoiseGeneratorOctaves(this.hellRNG, 10); this.netherNoiseGen7 = new NoiseGeneratorOctaves(this.hellRNG, 16); @@ -42,39 +43,40 @@ + this.netherNoiseGen7 = noiseGens[6]; } - /** -@@ -155,6 +177,10 @@ - */ - public void replaceBlocksForBiome(int par1, int par2, byte[] par3ArrayOfByte) + public void func_147419_a(int p_147419_1_, int p_147419_2_, Block[] p_147419_3_) +@@ -140,6 +163,10 @@ + + public void func_147418_b(int p_147418_1_, int p_147418_2_, Block[] p_147418_3_) { -+ ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, par1, par2, par3ArrayOfByte, null); ++ ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, p_147418_1_, p_147418_2_, p_147418_3_, null); + MinecraftForge.EVENT_BUS.post(event); + if (event.getResult() == Result.DENY) return; + byte b0 = 64; double d0 = 0.03125D; - this.slowsandNoise = this.slowsandGravelNoiseGen.generateNoiseOctaves(this.slowsandNoise, par1 * 16, par2 * 16, 0, 16, 16, 1, d0, d0, 1.0D); -@@ -290,6 +316,9 @@ - */ + this.slowsandNoise = this.slowsandGravelNoiseGen.generateNoiseOctaves(this.slowsandNoise, p_147418_1_ * 16, p_147418_2_ * 16, 0, 16, 16, 1, d0, d0, 1.0D); +@@ -262,6 +289,10 @@ + // JAVADOC METHOD $$ func_73164_a private double[] initializeNoiseField(double[] par1ArrayOfDouble, int par2, int par3, int par4, int par5, int par6, int par7) { + ChunkProviderEvent.InitNoiseField event = new ChunkProviderEvent.InitNoiseField(this, par1ArrayOfDouble, par2, par3, par4, par5, par6, par7); + MinecraftForge.EVENT_BUS.post(event); + if (event.getResult() == Result.DENY) return event.noisefield; ++ if (par1ArrayOfDouble == null) { par1ArrayOfDouble = new double[par5 * par6 * par7]; -@@ -442,6 +471,9 @@ +@@ -410,6 +441,9 @@ public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) { - BlockSand.fallInstantly = true; + BlockFalling.field_149832_M = true; + + MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(par1IChunkProvider, worldObj, hellRNG, par2, par3, false)); + int k = par2 * 16; int l = par3 * 16; this.genNetherBridge.generateStructuresInChunk(this.worldObj, this.hellRNG, par2, par3); -@@ -450,7 +482,8 @@ +@@ -418,7 +452,8 @@ int k1; int l1; @@ -84,7 +86,7 @@ { j1 = k + this.hellRNG.nextInt(16) + 8; k1 = this.hellRNG.nextInt(120) + 4; -@@ -461,7 +494,8 @@ +@@ -429,7 +464,8 @@ i1 = this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1) + 1; int i2; @@ -94,17 +96,19 @@ { k1 = k + this.hellRNG.nextInt(16) + 8; l1 = this.hellRNG.nextInt(120) + 4; -@@ -471,7 +505,8 @@ +@@ -438,8 +474,9 @@ + } i1 = this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1); - +- - for (j1 = 0; j1 < i1; ++j1) ++ + doGen = TerrainGen.populate(par1IChunkProvider, worldObj, hellRNG, par2, par3, false, GLOWSTONE); + for (j1 = 0; doGen && j1 < i1; ++j1) { k1 = k + this.hellRNG.nextInt(16) + 8; l1 = this.hellRNG.nextInt(120) + 4; -@@ -479,7 +514,7 @@ +@@ -447,7 +484,7 @@ (new WorldGenGlowStone1()).generate(this.worldObj, this.hellRNG, k1, l1, i2); } @@ -113,20 +117,20 @@ { k1 = k + this.hellRNG.nextInt(16) + 8; l1 = this.hellRNG.nextInt(128); -@@ -487,7 +522,10 @@ +@@ -455,7 +492,10 @@ (new WorldGenGlowStone2()).generate(this.worldObj, this.hellRNG, k1, l1, i2); } - if (this.hellRNG.nextInt(1) == 0) + MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Pre(worldObj, hellRNG, k, l)); -+ ++ + doGen = TerrainGen.decorate(worldObj, hellRNG, k, l, SHROOM); + if (doGen && this.hellRNG.nextInt(1) == 0) { j1 = k + this.hellRNG.nextInt(16) + 8; k1 = this.hellRNG.nextInt(128); -@@ -495,7 +533,7 @@ - (new WorldGenFlowers(Block.mushroomBrown.blockID)).generate(this.worldObj, this.hellRNG, j1, k1, l1); +@@ -463,7 +503,7 @@ + (new WorldGenFlowers(Blocks.brown_mushroom)).generate(this.worldObj, this.hellRNG, j1, k1, l1); } - if (this.hellRNG.nextInt(1) == 0) @@ -134,13 +138,23 @@ { j1 = k + this.hellRNG.nextInt(16) + 8; k1 = this.hellRNG.nextInt(128); -@@ -522,6 +560,9 @@ - (new WorldGenHellLava(Block.lavaMoving.blockID, true)).generate(this.worldObj, this.hellRNG, l1, i2, j2); +@@ -474,7 +514,8 @@ + WorldGenMinable worldgenminable = new WorldGenMinable(Blocks.quartz_ore, 13, Blocks.netherrack); + int j2; + +- for (k1 = 0; k1 < 16; ++k1) ++ doGen = TerrainGen.generateOre(worldObj, hellRNG, worldgenminable, k, l, QUARTZ); ++ for (k1 = 0; doGen && k1 < 16; ++k1) + { + l1 = k + this.hellRNG.nextInt(16); + i2 = this.hellRNG.nextInt(108) + 10; +@@ -490,6 +531,9 @@ + (new WorldGenHellLava(Blocks.flowing_lava, true)).generate(this.worldObj, this.hellRNG, l1, i2, j2); } + MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Post(worldObj, hellRNG, k, l)); + MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(par1IChunkProvider, worldObj, hellRNG, par2, par3, false)); + - BlockSand.fallInstantly = false; + BlockFalling.field_149832_M = false; } diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch index 30a3efa5b..38169ce3d 100644 --- a/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch @@ -1,17 +1,16 @@ --- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderServer.java +++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderServer.java -@@ -7,6 +7,9 @@ - import java.util.List; - import java.util.Set; - +@@ -24,6 +24,8 @@ + import net.minecraft.world.chunk.EmptyChunk; + import net.minecraft.world.chunk.IChunkProvider; + import net.minecraft.world.chunk.storage.IChunkLoader; +import net.minecraftforge.common.DimensionManager; +import net.minecraftforge.common.ForgeChunkManager; -+ - import cpw.mods.fml.common.registry.GameRegistry; - import net.minecraft.crash.CrashReport; - import net.minecraft.crash.CrashReportCategory; -@@ -66,7 +69,7 @@ - */ + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; + +@@ -59,7 +61,7 @@ + // JAVADOC METHOD $$ func_73241_b public void unloadChunksIfNotNearSpawn(int par1, int par2) { - if (this.worldObj.provider.canRespawnHere()) @@ -19,7 +18,7 @@ { ChunkCoordinates chunkcoordinates = this.worldObj.getSpawnPoint(); int k = par1 * 16 + 8 - chunkcoordinates.posX; -@@ -109,7 +112,11 @@ +@@ -98,7 +100,11 @@ if (chunk == null) { @@ -32,7 +31,7 @@ if (chunk == null) { -@@ -307,6 +314,11 @@ +@@ -272,6 +278,11 @@ { if (!this.worldObj.canNotSave) { @@ -44,12 +43,12 @@ for (int i = 0; i < 100; ++i) { if (!this.chunksToUnload.isEmpty()) -@@ -319,6 +331,11 @@ +@@ -284,6 +295,11 @@ this.chunksToUnload.remove(olong); this.loadedChunkHashMap.remove(olong.longValue()); this.loadedChunks.remove(chunk); + ForgeChunkManager.putDormantChunk(ChunkCoordIntPair.chunkXZ2Int(chunk.xPosition, chunk.zPosition), chunk); -+ if(loadedChunks.size() == 0 && ForgeChunkManager.getPersistentChunksFor(this.worldObj).size() == 0 && !DimensionManager.shouldLoadSpawn(this.worldObj.provider.dimensionId)) { ++ if(loadedChunks.size() == 0 && ForgeChunkManager.getPersistentChunksFor(this.worldObj).size() == 0 && !DimensionManager.shouldLoadSpawn(this.worldObj.provider.dimensionId)){ + DimensionManager.unloadWorld(this.worldObj.provider.dimensionId); + return currentChunkProvider.unloadQueuedChunks(); + } diff --git a/patches/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch b/patches/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch index 29a5439d4..7929c6a92 100644 --- a/patches/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch @@ -1,62 +1,60 @@ --- ../src-base/minecraft/net/minecraft/world/gen/MapGenCaves.java +++ ../src-work/minecraft/net/minecraft/world/gen/MapGenCaves.java -@@ -4,6 +4,7 @@ - import net.minecraft.block.Block; +@@ -5,6 +5,7 @@ + import net.minecraft.init.Blocks; import net.minecraft.util.MathHelper; import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; public class MapGenCaves extends MapGenBase { -@@ -140,7 +141,7 @@ - - if (i4 >= 0 && i4 < 128) +@@ -139,7 +140,7 @@ { -- if (par5ArrayOfByte[k3] == Block.waterMoving.blockID || par5ArrayOfByte[k3] == Block.waterStill.blockID) -+ if (isOceanBlock(par5ArrayOfByte, k3, j3, i4, l3, par3, par4)) + Block block = p_151541_5_[j3]; + +- if (block == Blocks.flowing_water || block == Blocks.water) ++ if (isOceanBlock(p_151541_5_, j3, k2, i3, l2, p_151541_3_, p_151541_4_)) { - flag2 = true; + flag3 = true; } -@@ -174,29 +175,12 @@ - - if (d14 > -0.7D && d12 * d12 + d14 * d14 + d13 * d13 < 1.0D) +@@ -175,27 +176,11 @@ { -- byte b0 = par5ArrayOfByte[j4]; -- -- if (b0 == Block.grass.blockID) -+ if (isTopBlock(par5ArrayOfByte, j4, j3, k4, k3, par3, par4)) - { - flag3 = true; - } + Block block1 = p_151541_5_[k3]; -- if (b0 == Block.stone.blockID || b0 == Block.dirt.blockID || b0 == Block.grass.blockID) +- if (block1 == Blocks.grass) ++ if (isTopBlock(p_151541_5_, k3, k2, l3, j3, p_151541_3_, p_151541_4_)) + { + flag1 = true; + } +- +- if (block1 == Blocks.stone || block1 == Blocks.dirt || block1 == Blocks.grass) - { -- if (k4 < 10) +- if (l3 < 10) - { -- par5ArrayOfByte[j4] = (byte)Block.lavaMoving.blockID; +- p_151541_5_[k3] = Blocks.lava; - } - else - { -- par5ArrayOfByte[j4] = 0; +- p_151541_5_[k3] = null; - -- if (flag3 && par5ArrayOfByte[j4 - 1] == Block.dirt.blockID) +- if (flag1 && p_151541_5_[k3 - 1] == Blocks.dirt) - { -- par5ArrayOfByte[j4 - 1] = this.worldObj.getBiomeGenForCoords(j3 + par3 * 16, k3 + par4 * 16).topBlock; +- p_151541_5_[k3 - 1] = this.worldObj.getBiomeGenForCoords(k2 + p_151541_3_ * 16, j3 + p_151541_4_ * 16).topBlock; - } - } - } -+ digBlock(par5ArrayOfByte, j4, j3, k4, k3, par3, par4, flag3); ++ digBlock(p_151541_5_, k3, k2, l3, j3, p_151541_3_, p_151541_4_, flag1); } - --j4; -@@ -255,4 +239,66 @@ + --k3; +@@ -251,4 +236,66 @@ } } } + -+ protected boolean isOceanBlock(byte[] data, int index, int x, int y, int z, int chunkX, int chunkZ) ++ protected boolean isOceanBlock(Block[] data, int index, int x, int y, int z, int chunkX, int chunkZ) + { -+ return data[index] == Block.waterMoving.blockID || data[index] == Block.waterStill.blockID; ++ return data[index] == Blocks.flowing_water || data[index] == Blocks.water; + } + + //Exception biomes to make sure we generate like vanilla @@ -70,10 +68,10 @@ + + //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(byte[] data, int index, int x, int y, int z, int chunkX, int chunkZ) ++ private boolean isTopBlock(Block[] data, int index, int x, int y, int z, int chunkX, int chunkZ) + { + BiomeGenBase biome = worldObj.getBiomeGenForCoords(x + chunkX * 16, z + chunkZ * 16); -+ return (isExceptionBiome(biome) ? data[index] == Block.grass.blockID : data[index] == biome.topBlock); ++ return (isExceptionBiome(biome) ? data[index] == Blocks.grass : data[index] == biome.topBlock); + } + + /** @@ -91,26 +89,26 @@ + * @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(byte[] data, int index, int x, int y, int z, int chunkX, int chunkZ, boolean foundTop) ++ protected void digBlock(Block[] data, int index, int x, int y, int z, int chunkX, int chunkZ, boolean foundTop) + { + BiomeGenBase biome = worldObj.getBiomeGenForCoords(x + chunkX * 16, z + chunkZ * 16); -+ int top = (isExceptionBiome(biome) ? Block.grass.blockID : biome.topBlock); -+ int filler = (isExceptionBiome(biome) ? Block.dirt.blockID : biome.fillerBlock); -+ int block = data[index]; ++ Block top = (isExceptionBiome(biome) ? Blocks.grass : biome.topBlock); ++ Block filler = (isExceptionBiome(biome) ? Blocks.dirt : biome.fillerBlock); ++ Block block = data[index]; + -+ if (block == Block.stone.blockID || block == filler || block == top) ++ if (block == Blocks.stone || block == filler || block == top) + { + if (y < 10) + { -+ data[index] = (byte)Block.lavaMoving.blockID; ++ data[index] = Blocks.lava; + } + else + { -+ data[index] = 0; ++ data[index] = null; + + if (foundTop && data[index - 1] == filler) + { -+ data[index - 1] = (byte)top; ++ data[index - 1] = top; + } + } + } diff --git a/patches/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch b/patches/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch index c3e81a499..56f630b28 100644 --- a/patches/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch @@ -1,62 +1,60 @@ --- ../src-base/minecraft/net/minecraft/world/gen/MapGenRavine.java +++ ../src-work/minecraft/net/minecraft/world/gen/MapGenRavine.java -@@ -4,6 +4,7 @@ - import net.minecraft.block.Block; +@@ -5,6 +5,7 @@ + import net.minecraft.init.Blocks; import net.minecraft.util.MathHelper; import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; public class MapGenRavine extends MapGenBase { -@@ -127,7 +128,7 @@ - - if (i4 >= 0 && i4 < 128) +@@ -131,7 +132,7 @@ { -- if (par5ArrayOfByte[k3] == Block.waterMoving.blockID || par5ArrayOfByte[k3] == Block.waterStill.blockID) -+ if (isOceanBlock(par5ArrayOfByte, k3, j3, i4, l3, par3, par4)) - { - flag1 = true; - } -@@ -161,29 +162,12 @@ + Block block = p_151540_5_[j3]; - if ((d12 * d12 + d13 * d13) * (double)this.field_75046_d[k4] + d14 * d14 / 6.0D < 1.0D) +- if (block == Blocks.flowing_water || block == Blocks.water) ++ if (isOceanBlock(p_151540_5_, j3, k2, i3, l2, p_151540_3_, p_151540_4_)) + { + flag2 = true; + } +@@ -167,27 +168,12 @@ { -- byte b0 = par5ArrayOfByte[j4]; -- -- if (b0 == Block.grass.blockID) -+ if (isTopBlock(par5ArrayOfByte, j4, j3, k4, k3, par3, par4)) + Block block1 = p_151540_5_[k3]; + +- if (block1 == Blocks.grass) ++ if (isTopBlock(p_151540_5_, k3, k2, l3, j3, p_151540_3_, p_151540_4_)) { - flag2 = true; + flag = true; } -- if (b0 == Block.stone.blockID || b0 == Block.dirt.blockID || b0 == Block.grass.blockID) +- if (block1 == Blocks.stone || block1 == Blocks.dirt || block1 == Blocks.grass) - { -- if (k4 < 10) +- if (l3 < 10) - { -- par5ArrayOfByte[j4] = (byte)Block.lavaMoving.blockID; +- p_151540_5_[k3] = Blocks.flowing_lava; - } - else - { -- par5ArrayOfByte[j4] = 0; +- p_151540_5_[k3] = null; - -- if (flag2 && par5ArrayOfByte[j4 - 1] == Block.dirt.blockID) +- if (flag && p_151540_5_[k3 - 1] == Blocks.dirt) - { -- par5ArrayOfByte[j4 - 1] = this.worldObj.getBiomeGenForCoords(j3 + par3 * 16, k3 + par4 * 16).topBlock; +- p_151540_5_[k3 - 1] = this.worldObj.getBiomeGenForCoords(k2 + p_151540_3_ * 16, j3 + p_151540_4_ * 16).topBlock; - } - } - } -+ digBlock(par5ArrayOfByte, j4, j3, k4, k3, par3, par4, flag2); ++ digBlock(p_151540_5_, k3, k2, l3, j3, p_151540_3_, p_151540_4_, flag); } - --j4; -@@ -223,4 +207,66 @@ + --k3; +@@ -224,4 +210,66 @@ } } } + -+ protected boolean isOceanBlock(byte[] data, int index, int x, int y, int z, int chunkX, int chunkZ) ++ protected boolean isOceanBlock(Block[] data, int index, int x, int y, int z, int chunkX, int chunkZ) + { -+ return data[index] == Block.waterMoving.blockID || data[index] == Block.waterStill.blockID; ++ return data[index] == Blocks.water || data[index] == Blocks.flowing_water; + } + + //Exception biomes to make sure we generate like vanilla @@ -70,10 +68,10 @@ + + //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(byte[] data, int index, int x, int y, int z, int chunkX, int chunkZ) ++ private boolean isTopBlock(Block[] data, int index, int x, int y, int z, int chunkX, int chunkZ) + { + BiomeGenBase biome = worldObj.getBiomeGenForCoords(x + chunkX * 16, z + chunkZ * 16); -+ return (isExceptionBiome(biome) ? data[index] == Block.grass.blockID : data[index] == biome.topBlock); ++ return (isExceptionBiome(biome) ? data[index] == Blocks.grass : data[index] == biome.topBlock); + } + + /** @@ -91,26 +89,26 @@ + * @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(byte[] data, int index, int x, int y, int z, int chunkX, int chunkZ, boolean foundTop) ++ protected void digBlock(Block[] data, int index, int x, int y, int z, int chunkX, int chunkZ, boolean foundTop) + { + BiomeGenBase biome = worldObj.getBiomeGenForCoords(x + chunkX * 16, z + chunkZ * 16); -+ int top = (isExceptionBiome(biome) ? Block.grass.blockID : biome.topBlock); -+ int filler = (isExceptionBiome(biome) ? Block.dirt.blockID : biome.fillerBlock); -+ int block = data[index]; ++ Block top = (isExceptionBiome(biome) ? Blocks.grass : biome.topBlock); ++ Block filler = (isExceptionBiome(biome) ? Blocks.dirt : biome.fillerBlock); ++ Block block = data[index]; + -+ if (block == Block.stone.blockID || block == filler || block == top) ++ if (block == Blocks.stone || block == filler || block == top) + { + if (y < 10) + { -+ data[index] = (byte)Block.lavaMoving.blockID; ++ data[index] = Blocks.flowing_lava; + } + else + { -+ data[index] = 0; ++ data[index] = null; + + if (foundTop && data[index - 1] == filler) + { -+ data[index - 1] = (byte)top; ++ data[index - 1] = top; + } + } + } 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 000000000..a95f24868 --- /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 +@@ -21,4 +21,10 @@ + } + + public void func_150524_b(World p_150524_1_, Random p_150524_2_, int p_150524_3_, int p_150524_4_, int p_150524_5_) {} ++ ++ protected boolean isReplaceable(World world, int x, int y, int z) ++ { ++ Block block = world.func_147439_a(x, y, z); ++ return block.isAir(world, x, y, z) || block.isLeaves(world, x, y, z) || block.isWood(world, x, y, z) || func_150523_a(block); ++ } + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch index e597e4246..d0ad4b615 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch @@ -1,35 +1,29 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java -@@ -56,7 +56,9 @@ +@@ -57,7 +57,7 @@ { - i2 = par1World.getBlockId(k1, j1, l1); + Block block = par1World.func_147439_a(k1, j1, l1); -- if (i2 != 0 && i2 != Block.leaves.blockID) -+ Block block = Block.blocksList[i2]; -+ -+ if (block != null && !block.isAirBlock(par1World, k1, j1, l1) && !block.isLeaves(par1World, k1, j1, l1)) +- if (block.func_149688_o() != Material.field_151579_a && block.func_149688_o() != Material.field_151584_j) ++ if (!block.isAir(par1World, k1, j1, l1) && !block.isLeaves(par1World, k1, j1, l1)) { flag = false; } -@@ -183,7 +185,9 @@ - l2 = 0; +@@ -184,7 +184,7 @@ + j2 = 0; } -- if ((l2 != 0 || par4 >= par4 + i1 - 1) && !Block.opaqueCubeLookup[par1World.getBlockId(i2, k1, k2)]) -+ Block block = Block.blocksList[par1World.getBlockId(i2, k1, k2)]; -+ -+ if ((l2 != 0 || par4 >= par4 + i1 - 1) && (block == null || block.canBeReplacedByLeaves(par1World, i2, k1, k2))) +- if ((j2 != 0 || par4 >= par4 + i1 - 1) && !par1World.func_147439_a(l2, k1, i2).func_149730_j()) ++ if ((j2 != 0 || par4 >= par4 + i1 - 1) && !par1World.func_147439_a(l2, k1, i2).canBeReplacedByLeaves(par1World, l2, k1, i2)) { - this.setBlockAndMetadata(par1World, i2, k1, k2, Block.mushroomCapBrown.blockID + l, l2); + this.func_150516_a(par1World, l2, k1, i2, Block.func_149729_e(Block.func_149682_b(Blocks.brown_mushroom_block) + l), j2); } -@@ -195,7 +199,9 @@ +@@ -196,7 +196,7 @@ { - l1 = par1World.getBlockId(par3, par4 + k1, par5); + Block block2 = par1World.func_147439_a(par3, par4 + k1, par5); -- if (!Block.opaqueCubeLookup[l1]) -+ Block block = Block.blocksList[l1]; -+ -+ if (block == null || block.canBeReplacedByLeaves(par1World, par3, par4 + k1, par5)) +- if (!block2.func_149730_j()) ++ if (block2.canBeReplacedByLeaves(par1World, par3, par4 + k1, par5)) { - this.setBlockAndMetadata(par1World, par3, par4 + k1, par5, Block.mushroomCapBrown.blockID + l, 10); + this.func_150516_a(par1World, par3, par4 + k1, par5, Block.func_149729_e(Block.func_149682_b(Blocks.brown_mushroom_block) + l), 10); } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch index ba2fbd878..6e1c91f04 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch @@ -1,52 +1,43 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java -@@ -1,9 +1,12 @@ - package net.minecraft.world.gen.feature; +@@ -2,10 +2,12 @@ import java.util.Random; -+ import net.minecraft.block.Block; +import net.minecraft.block.BlockSapling; + import net.minecraft.block.material.Material; + import net.minecraft.init.Blocks; import net.minecraft.util.MathHelper; import net.minecraft.world.World; -+import net.minecraftforge.common.ForgeDirection; ++import net.minecraftforge.common.util.ForgeDirection; - public class WorldGenBigTree extends WorldGenerator + public class WorldGenBigTree extends WorldGenAbstractTree { -@@ -163,8 +166,11 @@ - { - aint1[b2] = aint[b2] + k1; - int l1 = this.worldObj.getBlockId(aint1[0], aint1[1], aint1[2]); -+ Block block = Block.blocksList[l1]; +@@ -150,7 +152,7 @@ + aint1[b2] = aint[b2] + j1; + Block block1 = this.worldObj.func_147439_a(aint1[0], aint1[1], aint1[2]); -- if (l1 != 0 && l1 != Block.leaves.blockID) -+ if (block != null && -+ !block.isAirBlock(worldObj, aint1[0], aint1[1], aint1[2]) && -+ !block.isLeaves(worldObj, aint1[0], aint1[1], aint1[2])) +- if (block1.func_149688_o() != Material.field_151579_a && block1.func_149688_o() != Material.field_151584_j) ++ if (!block1.isAir(worldObj, aint1[0], aint1[1], aint1[2]) && !block1.isLeaves(worldObj, aint1[0], aint1[1], aint1[2])) { - ++k1; + ++j1; } -@@ -421,8 +427,11 @@ - aint3[b2] = MathHelper.floor_double((double)par1ArrayOfInteger[b2] + (double)i * d0); +@@ -389,7 +391,7 @@ aint3[b3] = MathHelper.floor_double((double)par1ArrayOfInteger[b3] + (double)i * d1); - int k = this.worldObj.getBlockId(aint3[0], aint3[1], aint3[2]); -+ Block block = Block.blocksList[k]; + Block block = this.worldObj.func_147439_a(aint3[0], aint3[1], aint3[2]); -- if (k != 0 && k != Block.leaves.blockID) -+ if (block != null && -+ !block.isAirBlock(worldObj, aint3[0], aint3[1], aint3[2]) && -+ !block.isLeaves(worldObj, aint3[0], aint3[1], aint3[2])) +- if (!this.func_150523_a(block)) ++ if (!this.isReplaceable(worldObj, aint3[0], aint3[1], aint3[2])) { break; } -@@ -442,7 +451,9 @@ +@@ -406,7 +408,8 @@ int[] aint1 = new int[] {this.basePos[0], this.basePos[1] + this.heightLimit - 1, this.basePos[2]}; - int i = this.worldObj.getBlockId(this.basePos[0], this.basePos[1] - 1, this.basePos[2]); + Block block = this.worldObj.func_147439_a(this.basePos[0], this.basePos[1] - 1, this.basePos[2]); -- if (i != 2 && i != 3) -+ Block soil = Block.blocksList[i]; -+ boolean isValidSoil = (soil != null && soil.canSustainPlant(worldObj, basePos[0], basePos[1] - 1, basePos[2], ForgeDirection.UP, (BlockSapling)Block.sapling)); -+ if (!isValidSoil) +- if (block != Blocks.dirt && block != Blocks.grass && block != Blocks.farmland) ++ boolean isSoil = block.canSustainPlant(worldObj, basePos[0], basePos[1] - 1, basePos[2], ForgeDirection.UP, (BlockSapling)Blocks.sapling); ++ if (!isSoil) { return false; } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch new file mode 100644 index 000000000..7b520f7eb --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch @@ -0,0 +1,69 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java +@@ -2,10 +2,12 @@ + + import java.util.Random; + import net.minecraft.block.Block; ++import net.minecraft.block.BlockSapling; + import net.minecraft.block.material.Material; + import net.minecraft.init.Blocks; + import net.minecraft.util.Direction; + import net.minecraft.world.World; ++import net.minecraftforge.common.util.ForgeDirection; + + public class WorldGenCanopyTree extends WorldGenAbstractTree + { +@@ -48,7 +50,7 @@ + { + Block block = par1World.func_147439_a(j1, i1, k1); + +- if (!this.func_150523_a(block)) ++ if (!this.isReplaceable(par1World, j1, i1, k1)) + { + flag = false; + } +@@ -69,12 +71,13 @@ + { + Block block2 = par1World.func_147439_a(par3, par4 - 1, par5); + +- if ((block2 == Blocks.grass || block2 == Blocks.dirt) && par4 < 256 - l - 1) ++ boolean isSoil = block2.canSustainPlant(par1World, par3, par4 - 1, par5, ForgeDirection.UP, (BlockSapling)Blocks.sapling); ++ if (isSoil && par4 < 256 - l - 1) + { +- this.func_150515_a(par1World, par3, par4 - 1, par5, Blocks.dirt); +- this.func_150515_a(par1World, par3 + 1, par4 - 1, par5, Blocks.dirt); +- this.func_150515_a(par1World, par3 + 1, par4 - 1, par5 + 1, Blocks.dirt); +- this.func_150515_a(par1World, par3, par4 - 1, par5 + 1, Blocks.dirt); ++ onPlantGrow(par1World, par3, par4 - 1, par5, par3, par4, par5); ++ onPlantGrow(par1World, par3 + 1, par4 - 1, par5, par3, par4, par5); ++ onPlantGrow(par1World, par3 + 1, par4 - 1, par5 + 1, par3, par4, par5); ++ onPlantGrow(par1World, par3, par4 - 1, par5 + 1, par3, par4, par5); + int j3 = par2Random.nextInt(4); + j1 = l - par2Random.nextInt(4); + k1 = 2 - par2Random.nextInt(3); +@@ -97,7 +100,7 @@ + + Block block1 = par1World.func_147439_a(k3, k2, l1); + +- if (block1.func_149688_o() == Material.field_151579_a || block1.func_149688_o() == Material.field_151584_j) ++ if (block1.isAir(par1World, k3, k2, l1) || block1.isLeaves(par1World, k3, k2, l1)) + { + this.func_150516_a(par1World, k3, k2, l1, Blocks.log2, 1); + this.func_150516_a(par1World, k3 + 1, k2, l1, Blocks.log2, 1); +@@ -203,9 +206,15 @@ + { + Block block = p_150526_1_.func_147439_a(p_150526_2_, p_150526_3_, p_150526_4_); + +- if (block.func_149688_o() == Material.field_151579_a) ++ if (block.isAir(p_150526_1_, p_150526_2_, p_150526_3_, p_150526_4_)) + { + this.func_150516_a(p_150526_1_, p_150526_2_, p_150526_3_, p_150526_4_, Blocks.leaves2, 1); + } + } ++ ++ //Just a helper macro ++ private void onPlantGrow(World world, int x, int y, int z, int sourceX, int sourceY, int sourceZ) ++ { ++ world.func_147439_a(x, y, z).onPlantGrow(world, x, y, z, sourceX, sourceY, sourceZ); ++ } + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch index a810fd978..78134195d 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch @@ -1,22 +1,20 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java -@@ -18,10 +18,16 @@ +@@ -19,10 +19,15 @@ { - int l; + Block block; -- for (boolean flag = false; ((l = par1World.getBlockId(par3, par4, par5)) == 0 || l == Block.leaves.blockID) && par4 > 0; --par4) -+ Block block = null; -+ do +- while (((block = par1World.func_147439_a(par3, par4, par5)).func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) && par4 > 0) ++ do { -- ; -- } -+ block = Block.blocksList[par1World.getBlockId(par3, par4, par5)]; -+ if (block != null && !block.isLeaves(par1World, par3, par4, par5)) ++ block = par1World.func_147439_a(par3, par4, par5); ++ if (block.isLeaves(par1World, par3, par4, par5) || block.isAir(par1World, par3, par4, par5)) + { + break; + } -+ par4--; + --par4; +- } + } while (par4 > 0); - for (int i1 = 0; i1 < 4; ++i1) + for (int l = 0; l < 4; ++l) { diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch index c4fb47beb..ab4df35e8 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch @@ -1,31 +1,31 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java -@@ -8,6 +8,8 @@ +@@ -8,6 +8,9 @@ import net.minecraft.tileentity.TileEntityMobSpawner; import net.minecraft.util.WeightedRandomChestContent; import net.minecraft.world.World; +import net.minecraftforge.common.ChestGenHooks; +import net.minecraftforge.common.DungeonHooks; ++import static net.minecraftforge.common.ChestGenHooks.DUNGEON_CHEST;; public class WorldGenDungeons extends WorldGenerator { -@@ -122,12 +124,12 @@ +@@ -123,12 +126,11 @@ if (k2 == 1) { - par1World.setBlock(i2, par4, j2, Block.chest.blockID, 0, 2); -- WeightedRandomChestContent[] aweightedrandomchestcontent = WeightedRandomChestContent.func_92080_a(field_111189_a, new WeightedRandomChestContent[] {Item.enchantedBook.func_92114_b(par2Random)}); - TileEntityChest tileentitychest = (TileEntityChest)par1World.getBlockTileEntity(i2, par4, j2); + par1World.func_147465_d(i2, par4, j2, Blocks.chest, 0, 2); +- WeightedRandomChestContent[] aweightedrandomchestcontent = WeightedRandomChestContent.func_92080_a(field_111189_a, new WeightedRandomChestContent[] {Items.enchanted_book.func_92114_b(par2Random)}); + TileEntityChest tileentitychest = (TileEntityChest)par1World.func_147438_o(i2, par4, j2); if (tileentitychest != null) { - WeightedRandomChestContent.generateChestContents(par2Random, aweightedrandomchestcontent, tileentitychest, 8); -+ ChestGenHooks info = ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST); -+ WeightedRandomChestContent.generateChestContents(par2Random, info.getItems(par2Random), tileentitychest, info.getCount(par2Random)); ++ WeightedRandomChestContent.generateChestContents(par2Random, ChestGenHooks.getItems(DUNGEON_CHEST, par2Random), tileentitychest, ChestGenHooks.getCount(DUNGEON_CHEST, par2Random)); } break label101; -@@ -169,7 +171,6 @@ - */ +@@ -168,7 +170,6 @@ + // JAVADOC METHOD $$ func_76543_b private String pickMobSpawner(Random par1Random) { - int i = par1Random.nextInt(4); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch index a7f5c365a..881792192 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch @@ -1,64 +1,54 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java -@@ -2,7 +2,9 @@ +@@ -2,9 +2,11 @@ import java.util.Random; import net.minecraft.block.Block; +import net.minecraft.block.BlockSapling; + import net.minecraft.block.material.Material; + import net.minecraft.init.Blocks; import net.minecraft.world.World; -+import net.minecraftforge.common.ForgeDirection; ++import net.minecraftforge.common.util.ForgeDirection; - public class WorldGenForest extends WorldGenerator + public class WorldGenForest extends WorldGenAbstractTree { -@@ -45,7 +47,11 @@ +@@ -55,7 +57,7 @@ { - l1 = par1World.getBlockId(j1, i1, k1); + Block block = par1World.func_147439_a(j1, i1, k1); -- if (l1 != 0 && l1 != Block.leaves.blockID) -+ Block block = Block.blocksList[l1]; -+ -+ if (block != null && -+ !block.isAirBlock(par1World, j1, i1, k1) && -+ !block.isLeaves(par1World, j1, i1, k1)) +- if (!this.func_150523_a(block)) ++ if (!this.isReplaceable(par1World, j1, i1, k1)) { flag = false; } -@@ -65,10 +71,12 @@ - else +@@ -76,9 +78,10 @@ { - i1 = par1World.getBlockId(par3, par4 - 1, par5); -+ Block soil = Block.blocksList[i1]; -+ boolean isValidSoil = soil != null && soil.canSustainPlant(par1World, par3, par4 - 1, par5, ForgeDirection.UP, (BlockSapling)Block.sapling); + Block block2 = par1World.func_147439_a(par3, par4 - 1, par5); -- if ((i1 == Block.grass.blockID || i1 == Block.dirt.blockID) && par4 < 256 - l - 1) -+ if (isValidSoil && par4 < 256 - l - 1) +- if ((block2 == Blocks.grass || block2 == Blocks.dirt || block2 == Blocks.farmland) && par4 < 256 - l - 1) ++ boolean isSoil = block2.canSustainPlant(par1World, par3, par4 - 1, par5, ForgeDirection.UP, (BlockSapling)Blocks.sapling); ++ if (isSoil && par4 < 256 - l - 1) { -- this.setBlock(par1World, par3, par4 - 1, par5, Block.dirt.blockID); -+ soil.onPlantGrow(par1World, par3, par4 - 1, par5, par3, par4, par5); - int i2; +- this.func_150515_a(par1World, par3, par4 - 1, par5, Blocks.dirt); ++ block2.onPlantGrow(par1World, par3, par4 - 1, par5, par3, par4, par5); + int k2; - for (i2 = par4 - 3 + l; i2 <= par4 + l; ++i2) -@@ -87,8 +95,9 @@ - if (Math.abs(j2) != k1 || Math.abs(l2) != k1 || par2Random.nextInt(2) != 0 && j1 != 0) + for (k2 = par4 - 3 + l; k2 <= par4 + l; ++k2) +@@ -98,7 +101,7 @@ { - int i3 = par1World.getBlockId(l1, i2, k2); -+ Block block = Block.blocksList[i3]; + Block block1 = par1World.func_147439_a(l2, k2, i2); -- if (i3 == 0 || i3 == Block.leaves.blockID) -+ if (block == null || block.canBeReplacedByLeaves(par1World, l1, i2, k2)) +- if (block1.func_149688_o() == Material.field_151579_a || block1.func_149688_o() == Material.field_151584_j) ++ if (block1.isAir(par1World, l2, k2, i2) || block1.isLeaves(par1World, l2, k2, i2)) { - this.setBlockAndMetadata(par1World, l1, i2, k2, Block.leaves.blockID, 2); + this.func_150516_a(par1World, l2, k2, i2, Blocks.leaves, 2); } -@@ -101,7 +110,11 @@ +@@ -111,7 +114,7 @@ { - j1 = par1World.getBlockId(par3, par4 + i2, par5); + Block block3 = par1World.func_147439_a(par3, par4 + k2, par5); -- if (j1 == 0 || j1 == Block.leaves.blockID) -+ Block block = Block.blocksList[j1]; -+ -+ if (block == null || -+ block.isAirBlock(par1World, par3, par4 + i2, par5) || -+ block.isLeaves(par1World, par3, par4 + i2, par5)) +- if (block3.func_149688_o() == Material.field_151579_a || block3.func_149688_o() == Material.field_151584_j) ++ if (block3.isAir(par1World, par3, par4 + k2, par5) || block3.isLeaves(par1World, par3, par4 + k2, par5)) { - this.setBlockAndMetadata(par1World, par3, par4 + i2, par5, Block.wood.blockID, 2); + this.func_150516_a(par1World, par3, par4 + k2, par5, Blocks.log, 2); } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch index 5483ad42b..1ebd94f34 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch @@ -1,118 +1,71 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java -@@ -2,8 +2,10 @@ +@@ -2,9 +2,11 @@ import java.util.Random; import net.minecraft.block.Block; +import net.minecraft.block.BlockSapling; - import net.minecraft.util.MathHelper; + import net.minecraft.block.material.Material; + import net.minecraft.init.Blocks; import net.minecraft.world.World; -+import net.minecraftforge.common.ForgeDirection; ++import net.minecraftforge.common.util.ForgeDirection; - public class WorldGenHugeTrees extends WorldGenerator + public abstract class WorldGenHugeTrees extends WorldGenAbstractTree { -@@ -57,8 +59,15 @@ - if (i1 >= 0 && i1 < 256) +@@ -66,7 +68,7 @@ { - l1 = par1World.getBlockId(j1, i1, k1); -+ Block block = Block.blocksList[l1]; + Block block = p_150536_1_.func_147439_a(j1, i1, k1); -- if (l1 != 0 && l1 != Block.leaves.blockID && l1 != Block.grass.blockID && l1 != Block.dirt.blockID && l1 != Block.wood.blockID && l1 != Block.sapling.blockID) -+ if (block != null && -+ !block.isAirBlock(par1World, j1, i1, k1) && -+ !block.isLeaves(par1World, j1, i1, k1) && -+ !block.isWood(par1World, j1, i1, k1) && -+ block != Block.grass && -+ block != Block.dirt && -+ block != Block.sapling) +- if (!this.func_150523_a(block)) ++ if (!this.isReplaceable(p_150536_1_, j1, i1, k1)) { flag = false; } -@@ -79,12 +88,15 @@ - { - i1 = par1World.getBlockId(par3, par4 - 1, par5); +@@ -91,12 +93,13 @@ + { + Block block = p_150532_1_.func_147439_a(p_150532_3_, p_150532_4_ - 1, p_150532_5_); -- if ((i1 == Block.grass.blockID || i1 == Block.dirt.blockID) && par4 < 256 - l - 1) -+ Block soil = Block.blocksList[i1]; -+ boolean isValidSoil = soil != null && soil.canSustainPlant(par1World, par3, par4 - 1, par5, ForgeDirection.UP, (BlockSapling)Block.sapling); -+ -+ if (isValidSoil && par4 < 256 - l - 1) +- if ((block == Blocks.grass || block == Blocks.dirt) && p_150532_4_ >= 2) ++ boolean isSoil = block.canSustainPlant(p_150532_1_, p_150532_3_, p_150532_4_ - 1, p_150532_5_, ForgeDirection.UP, (BlockSapling)Blocks.sapling); ++ if (isSoil && p_150532_4_ >= 2) + { +- p_150532_1_.func_147465_d(p_150532_3_, p_150532_4_ - 1, p_150532_5_, Blocks.dirt, 0, 2); +- p_150532_1_.func_147465_d(p_150532_3_ + 1, p_150532_4_ - 1, p_150532_5_, Blocks.dirt, 0, 2); +- p_150532_1_.func_147465_d(p_150532_3_, p_150532_4_ - 1, p_150532_5_ + 1, Blocks.dirt, 0, 2); +- p_150532_1_.func_147465_d(p_150532_3_ + 1, p_150532_4_ - 1, p_150532_5_ + 1, Blocks.dirt, 0, 2); ++ onPlantGrow(p_150532_1_, p_150532_3_, p_150532_4_ - 1, p_150532_5_, p_150532_3_, p_150532_4_, p_150532_5_); ++ onPlantGrow(p_150532_1_, p_150532_3_ + 1, p_150532_4_ - 1, p_150532_5_, p_150532_3_, p_150532_4_, p_150532_5_); ++ onPlantGrow(p_150532_1_, p_150532_3_, p_150532_4_ - 1, p_150532_5_ + 1, p_150532_3_, p_150532_4_, p_150532_5_); ++ onPlantGrow(p_150532_1_, p_150532_3_ + 1, p_150532_4_ - 1, p_150532_5_ + 1, p_150532_3_, p_150532_4_, p_150532_5_); + return true; + } + else +@@ -128,7 +131,7 @@ { -- par1World.setBlock(par3, par4 - 1, par5, Block.dirt.blockID, 0, 2); -- par1World.setBlock(par3 + 1, par4 - 1, par5, Block.dirt.blockID, 0, 2); -- par1World.setBlock(par3, par4 - 1, par5 + 1, Block.dirt.blockID, 0, 2); -- par1World.setBlock(par3 + 1, par4 - 1, par5 + 1, Block.dirt.blockID, 0, 2); -+ onPlantGrow(par1World, par3, par4 - 1, par5, par3, par4, par5); -+ onPlantGrow(par1World, par3 + 1, par4 - 1, par5, par3, par4, par5); -+ onPlantGrow(par1World, par3, par4 - 1, par5 + 1, par3, par4, par5); -+ onPlantGrow(par1World, par3 + 1, par4 - 1, par5 + 1, par3, par4, par5); - this.growLeaves(par1World, par3, par5, par4 + l, 2, par2Random); + Block block = p_150535_1_.func_147439_a(j1, p_150535_3_, l1); - for (int i2 = par4 + l - 2 - par2Random.nextInt(4); i2 > par4 + l / 2; i2 -= 2 + par2Random.nextInt(4)) -@@ -106,7 +118,7 @@ +- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) ++ if (block.isAir(p_150535_1_, j1, p_150535_3_, l1) || block.isLeaves(p_150535_1_, j1, p_150535_3_, l1)) { - k1 = par1World.getBlockId(par3, par4 + j1, par5); + this.func_150516_a(p_150535_1_, j1, p_150535_3_, l1, Blocks.leaves, this.leavesMetadata); + } +@@ -153,7 +156,7 @@ + { + Block block = p_150534_1_.func_147439_a(j1, p_150534_3_, l1); -- if (k1 == 0 || k1 == Block.leaves.blockID) -+ if (isReplaceable(par1World, par3, par4 + j1, par5)) - { - this.setBlockAndMetadata(par1World, par3, par4 + j1, par5, Block.wood.blockID, this.woodMetadata); - -@@ -128,7 +140,7 @@ - { - k1 = par1World.getBlockId(par3 + 1, par4 + j1, par5); - -- if (k1 == 0 || k1 == Block.leaves.blockID) -+ if (isReplaceable(par1World, par3 + 1, par4 + j1, par5)) - { - this.setBlockAndMetadata(par1World, par3 + 1, par4 + j1, par5, Block.wood.blockID, this.woodMetadata); - -@@ -148,7 +160,7 @@ - - k1 = par1World.getBlockId(par3 + 1, par4 + j1, par5 + 1); - -- if (k1 == 0 || k1 == Block.leaves.blockID) -+ if (isReplaceable(par1World, par3 + 1, par4 + j1, par5 + 1)) - { - this.setBlockAndMetadata(par1World, par3 + 1, par4 + j1, par5 + 1, Block.wood.blockID, this.woodMetadata); - -@@ -168,7 +180,7 @@ - - k1 = par1World.getBlockId(par3, par4 + j1, par5 + 1); - -- if (k1 == 0 || k1 == Block.leaves.blockID) -+ if (isReplaceable(par1World, par3, par4 + j1, par5 + 1)) - { - this.setBlockAndMetadata(par1World, par3, par4 + j1, par5 + 1, Block.wood.blockID, this.woodMetadata); - -@@ -222,8 +234,9 @@ - if ((i2 >= 0 || k2 >= 0 || i2 * i2 + k2 * k2 <= k1 * k1) && (i2 <= 0 && k2 <= 0 || i2 * i2 + k2 * k2 <= (k1 + 1) * (k1 + 1)) && (par6Random.nextInt(4) != 0 || i2 * i2 + k2 * k2 <= (k1 - 1) * (k1 - 1))) +- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) ++ if (block.isAir(p_150534_1_, j1, p_150534_3_, l1) || block.isLeaves(p_150534_1_, j1, p_150534_3_, l1)) { - int l2 = par1World.getBlockId(l1, i1, j2); -+ Block block = Block.blocksList[l2]; - -- if (l2 == 0 || l2 == Block.leaves.blockID) -+ if (block == null || block.canBeReplacedByLeaves(par1World, l1, i1, j2)) - { - this.setBlockAndMetadata(par1World, l1, i1, j2, Block.leaves.blockID, this.leavesMetadata); - } -@@ -232,4 +245,19 @@ + this.func_150516_a(p_150534_1_, j1, p_150534_3_, l1, Blocks.leaves, this.leavesMetadata); + } +@@ -161,4 +164,10 @@ } } } + ++ //Just a helper macro + private void onPlantGrow(World world, int x, int y, int z, int sourceX, int sourceY, int sourceZ) + { -+ Block block = Block.blocksList[world.getBlockId(x, y, z)]; -+ if (block != null) -+ { -+ block.onPlantGrow(world, x, y, z, sourceX, sourceY, sourceZ); -+ } -+ } -+ -+ private boolean isReplaceable(World world, int x, int y, int z) -+ { -+ Block block = Block.blocksList[world.getBlockId(x, y, z)]; -+ return (block == null || block.isAirBlock(world, x, y, z) || block.isLeaves(world, x, y, z)); ++ world.func_147439_a(x, y, z).onPlantGrow(world, x, y, z, sourceX, sourceY, sourceZ); + } } 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 000000000..b425fd48d --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch @@ -0,0 +1,38 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java +@@ -56,7 +56,7 @@ + { + Block block = par1World.func_147439_a(par3, par4 + l2, par5); + +- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) ++ if (block.isAir(par1World, par3, par4 + l2, par5) || block.isLeaves(par1World, par3, par4 + l2, par5)) + { + this.func_150516_a(par1World, par3, par4 + l2, par5, Blocks.log, this.woodMetadata); + +@@ -78,7 +78,7 @@ + { + block = par1World.func_147439_a(par3 + 1, par4 + l2, par5); + +- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) ++ if (block.isAir(par1World, par3 + 1, par4 + l2, par5) || block.isLeaves(par1World, par3 + 1, par4 + l2, par5)) + { + this.func_150516_a(par1World, par3 + 1, par4 + l2, par5, Blocks.log, this.woodMetadata); + +@@ -98,7 +98,7 @@ + + block = par1World.func_147439_a(par3 + 1, par4 + l2, par5 + 1); + +- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) ++ if (block.isAir(par1World, par3 + 1, par4 + l2, par5 + 1) || block.isLeaves(par1World, par3 + 1, par4 + l2, par5 + 1)) + { + this.func_150516_a(par1World, par3 + 1, par4 + l2, par5 + 1, Blocks.log, this.woodMetadata); + +@@ -118,7 +118,7 @@ + + block = par1World.func_147439_a(par3, par4 + l2, par5 + 1); + +- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) ++ if (block.isAir(par1World, par3, par4 + l2, par5 + 1) || block.isLeaves(par1World, par3, par4 + l2, par5 + 1)) + { + this.func_150516_a(par1World, par3, par4 + l2, par5 + 1, Blocks.log, this.woodMetadata); + diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch new file mode 100644 index 000000000..440f31b6c --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch @@ -0,0 +1,65 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java +@@ -2,10 +2,12 @@ + + import java.util.Random; + import net.minecraft.block.Block; ++import net.minecraft.block.BlockSapling; + import net.minecraft.block.material.Material; + import net.minecraft.init.Blocks; + import net.minecraft.util.MathHelper; + import net.minecraft.world.World; ++import net.minecraftforge.common.util.ForgeDirection; + + public class WorldGenMegaPineTree extends WorldGenHugeTrees + { +@@ -34,7 +36,7 @@ + { + Block block = par1World.func_147439_a(par3, par4 + i1, par5); + +- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) ++ if (block.isAir(par1World, par3, par4 + i1, par5) || block.isLeaves(par1World, par3, par4 + i1, par5)) + { + this.func_150516_a(par1World, par3, par4 + i1, par5, Blocks.log, this.woodMetadata); + } +@@ -43,21 +45,21 @@ + { + block = par1World.func_147439_a(par3 + 1, par4 + i1, par5); + +- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) ++ if (block.isAir(par1World, par3 + 1, par4 + i1, par5) || block.isLeaves(par1World, par3 + 1, par4 + i1, par5)) + { + this.func_150516_a(par1World, par3 + 1, par4 + i1, par5, Blocks.log, this.woodMetadata); + } + + block = par1World.func_147439_a(par3 + 1, par4 + i1, par5 + 1); + +- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) ++ if (block.isAir(par1World, par3 + 1, par4 + i1, par5 + 1) || block.isLeaves(par1World, par3 + 1, par4 + i1, par5 + 1)) + { + this.func_150516_a(par1World, par3 + 1, par4 + i1, par5 + 1, Blocks.log, this.woodMetadata); + } + + block = par1World.func_147439_a(par3, par4 + i1, par5 + 1); + +- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) ++ if (block.isAir(par1World, par3, par4 + i1, par5 + 1) || block.isLeaves(par1World, par3, par4 + i1, par5 + 1)) + { + this.func_150516_a(par1World, par3, par4 + i1, par5 + 1, Blocks.log, this.woodMetadata); + } +@@ -132,13 +134,13 @@ + { + Block block = p_150540_1_.func_147439_a(p_150540_2_, l, p_150540_4_); + +- if (block == Blocks.grass || block == Blocks.dirt) ++ if (block.canSustainPlant(p_150540_1_, p_150540_2_, l, p_150540_4_, ForgeDirection.UP, (BlockSapling)Blocks.sapling)) + { + this.func_150516_a(p_150540_1_, p_150540_2_, l, p_150540_4_, Blocks.dirt, 2); + break; + } + +- if (block.func_149688_o() != Material.field_151579_a && l < p_150540_3_) ++ if (block.isAir(p_150540_1_, p_150540_2_, l, p_150540_4_) && l < p_150540_3_) + { + break; + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch index 12f03e522..5722c1b93 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch @@ -1,36 +1,35 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java -@@ -9,6 +9,7 @@ - { - /** The block ID of the ore to be placed using this generator. */ - private int minableBlockId; -+ private int minableBlockMeta = 0; - - /** The number of blocks to generate. */ +@@ -13,6 +13,7 @@ private int numberOfBlocks; -@@ -28,6 +29,12 @@ - this.blockToReplace = par3; + private Block field_150518_c; + private static final String __OBFID = "CL_00000426"; ++ private int mineableBlockMeta; + + public WorldGenMinable(Block p_i45459_1_, int p_i45459_2_) + { +@@ -26,6 +27,12 @@ + this.field_150518_c = p_i45460_3_; } -+ public WorldGenMinable(int id, int meta, int number, int target) ++ public WorldGenMinable(Block block, int meta, int number, Block target) + { -+ this(id, number, target); -+ this.minableBlockMeta = meta; ++ this(block, number, target); ++ this.mineableBlockMeta = meta; + } + public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) { float f = par2Random.nextFloat() * (float)Math.PI; -@@ -69,9 +76,10 @@ +@@ -67,9 +74,9 @@ { double d14 = ((double)i3 + 0.5D - d8) / (d10 / 2.0D); -- if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && par1World.getBlockId(k2, l2, i3) == this.blockToReplace) -+ Block block = Block.blocksList[par1World.getBlockId(k2, l2, i3)]; -+ if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && (block != null && block.isGenMineableReplaceable(par1World, k2, l2, i3, this.blockToReplace))) +- if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && par1World.func_147439_a(k2, l2, i3) == this.field_150518_c) ++ if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && par1World.func_147439_a(k2, l2, i3).isReplaceableOreGen(par1World, k2, l2, i3, field_150518_c)) { -- par1World.setBlock(k2, l2, i3, this.minableBlockId, 0, 2); -+ par1World.setBlock(k2, l2, i3, this.minableBlockId, minableBlockMeta, 2); +- par1World.func_147465_d(k2, l2, i3, this.field_150519_a, 0, 2); ++ par1World.func_147465_d(k2, l2, i3, this.field_150519_a, mineableBlockMeta, 2); } } } 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 000000000..759a70ba0 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch @@ -0,0 +1,64 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java +@@ -2,10 +2,12 @@ + + import java.util.Random; + import net.minecraft.block.Block; ++import net.minecraft.block.BlockSapling; + import net.minecraft.block.material.Material; + import net.minecraft.init.Blocks; + import net.minecraft.util.Direction; + import net.minecraft.world.World; ++import net.minecraftforge.common.util.ForgeDirection; + + public class WorldGenSavannaTree extends WorldGenAbstractTree + { +@@ -48,7 +50,7 @@ + { + Block block = par1World.func_147439_a(j1, i1, k1); + +- if (!this.func_150523_a(block)) ++ if (!this.isReplaceable(par1World, j1, i1, k1)) + { + flag = false; + } +@@ -69,9 +71,10 @@ + { + Block block3 = par1World.func_147439_a(par3, par4 - 1, par5); + +- if ((block3 == Blocks.grass || block3 == Blocks.dirt) && par4 < 256 - l - 1) ++ boolean isSoil = block3.canSustainPlant(par1World, par3, par4 - 1, par5, ForgeDirection.UP, (BlockSapling)Blocks.sapling); ++ if (isSoil && par4 < 256 - l - 1) + { +- this.func_150515_a(par1World, par3, par4 - 1, par5, Blocks.dirt); ++ block3.onPlantGrow(par1World, par3, par4 - 1, par5, par3, par4, par5); + int j3 = par2Random.nextInt(4); + j1 = l - par2Random.nextInt(4) - 1; + k1 = 3 - par2Random.nextInt(3); +@@ -94,7 +97,7 @@ + + Block block1 = par1World.func_147439_a(k3, k2, l1); + +- if (block1.func_149688_o() == Material.field_151579_a || block1.func_149688_o() == Material.field_151584_j) ++ if (block1.isAir(par1World, k3, k2, l1) || block1.isLeaves(par1World, k3, k2, l1)) + { + this.func_150516_a(par1World, k3, k2, l1, Blocks.log2, 0); + i2 = k2; +@@ -146,7 +149,7 @@ + l1 += Direction.offsetZ[j2]; + Block block2 = par1World.func_147439_a(k3, i3, l1); + +- if (block2.func_149688_o() == Material.field_151579_a || block2.func_149688_o() == Material.field_151584_j) ++ if (block2.isAir(par1World, k3, i3, l1) || block2.isLeaves(par1World, k3, i3, l1)) + { + this.func_150516_a(par1World, k3, i3, l1, Blocks.log2, 0); + i2 = i3; +@@ -197,7 +200,7 @@ + { + Block block = p_150525_1_.func_147439_a(p_150525_2_, p_150525_3_, p_150525_4_); + +- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) ++ if (block.isAir(p_150525_1_, p_150525_2_, p_150525_3_, p_150525_4_) || block.isLeaves(p_150525_1_, p_150525_2_, p_150525_3_, p_150525_4_)) + { + this.func_150516_a(p_150525_1_, p_150525_2_, p_150525_3_, p_150525_4_, Blocks.leaves2, 0); + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch index f17972e00..734d6e3d0 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch @@ -1,34 +1,29 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java -@@ -19,10 +19,16 @@ +@@ -23,10 +23,15 @@ { - int l; + Block block; -- for (boolean flag = false; ((l = par1World.getBlockId(par3, par4, par5)) == 0 || l == Block.leaves.blockID) && par4 > 0; --par4) -+ Block block = null; -+ do +- while (((block = par1World.func_147439_a(par3, par4, par5)).func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) && par4 > 0) ++ do { -- ; -- } -+ block = Block.blocksList[par1World.getBlockId(par3, par4, par5)]; -+ if (block != null && !block.isAirBlock(par1World, par3, par4, par5) && !block.isLeaves(par1World, par3, par4, par5)) ++ block = par1World.func_147439_a(par3, par4, par5); ++ if (block.isLeaves(par1World, par3, par4, par5) || block.isAir(par1World, par3, par4, par5)) + { + break; + } -+ par4--; + --par4; +- } + } while (par4 > 0); - int i1 = par1World.getBlockId(par3, par4, par5); + Block block1 = par1World.func_147439_a(par3, par4, par5); -@@ -44,7 +50,10 @@ +@@ -48,7 +53,7 @@ { - int l2 = k2 - par5; + int j2 = i2 - par5; -- if ((Math.abs(j2) != l1 || Math.abs(l2) != l1 || par2Random.nextInt(2) != 0) && !Block.opaqueCubeLookup[par1World.getBlockId(i2, j1, k2)]) -+ block = Block.blocksList[par1World.getBlockId(i2, j1, k2)]; -+ -+ if ((Math.abs(j2) != l1 || Math.abs(l2) != l1 || par2Random.nextInt(2) != 0) && -+ (block == null || block.canBeReplacedByLeaves(par1World, i2, j1, k2))) +- if ((Math.abs(l1) != j1 || Math.abs(j2) != j1 || par2Random.nextInt(2) != 0) && !par1World.func_147439_a(k1, l, i2).func_149730_j()) ++ if ((Math.abs(l1) != j1 || Math.abs(j2) != j1 || par2Random.nextInt(2) != 0) && !par1World.func_147439_a(k1, l, i2).canBeReplacedByLeaves(par1World, k1, l, i2)) { - this.setBlockAndMetadata(par1World, i2, j1, k2, Block.leaves.blockID, this.field_76527_a); + this.func_150516_a(par1World, k1, l, i2, Blocks.leaves, this.field_150528_a); } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch index 56e839be9..e55b84bf8 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch @@ -1,44 +1,93 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java -@@ -47,7 +47,7 @@ +@@ -2,9 +2,11 @@ + + import java.util.Random; + import net.minecraft.block.Block; ++import net.minecraft.block.BlockSapling; + import net.minecraft.block.material.Material; + import net.minecraft.init.Blocks; + import net.minecraft.world.World; ++import net.minecraftforge.common.util.ForgeDirection; + + public class WorldGenSwamp extends WorldGenAbstractTree + { +@@ -53,7 +55,7 @@ { - l1 = par1World.getBlockId(j1, i1, k1); + Block block = par1World.func_147439_a(j1, i1, k1); -- if (l1 != 0 && l1 != Block.leaves.blockID) -+ if (l1 != 0 && (Block.blocksList[l1] != null && !Block.blocksList[l1].isLeaves(par1World, j1, i1, k1))) +- if (block.func_149688_o() != Material.field_151579_a && block.func_149688_o() != Material.field_151584_j) ++ if (block.isAir(par1World, j1, i1, k1) || block.isLeaves(par1World, j1, i1, k1)) { - if (l1 != Block.waterStill.blockID && l1 != Block.waterMoving.blockID) + if (block != Blocks.water && block != Blocks.flowing_water) { -@@ -94,7 +94,10 @@ - { - int l2 = k2 - par5; +@@ -81,9 +83,10 @@ + { + Block block1 = par1World.func_147439_a(par3, par4 - 1, par5); -- if ((Math.abs(i2) != k1 || Math.abs(l2) != k1 || par2Random.nextInt(2) != 0 && j1 != 0) && !Block.opaqueCubeLookup[par1World.getBlockId(l1, j2, k2)]) -+ Block block = Block.blocksList[par1World.getBlockId(l1, j2, k2)]; -+ -+ if ((Math.abs(i2) != k1 || Math.abs(l2) != k1 || par2Random.nextInt(2) != 0 && j1 != 0) && -+ (block == null || block.canBeReplacedByLeaves(par1World, l1, j2, k2))) +- if ((block1 == Blocks.grass || block1 == Blocks.dirt) && par4 < 256 - l - 1) ++ boolean isSoil = block1.canSustainPlant(par1World, par3, par4 - 1, par5, ForgeDirection.UP, (BlockSapling)Blocks.sapling); ++ if (isSoil && par4 < 256 - l - 1) + { +- this.func_150515_a(par1World, par3, par4 - 1, par5, Blocks.dirt); ++ block1.onPlantGrow(par1World, par3, par4 - 1, par5, par3, par4, par5); + int l1; + int l2; + int k2; +@@ -101,7 +104,7 @@ + { + int j2 = i2 - par5; + +- if ((Math.abs(l1) != k1 || Math.abs(j2) != k1 || par2Random.nextInt(2) != 0 && j1 != 0) && !par1World.func_147439_a(l2, k2, i2).func_149730_j()) ++ if ((Math.abs(l1) != k1 || Math.abs(j2) != k1 || par2Random.nextInt(2) != 0 && j1 != 0) && !par1World.func_147439_a(l2, k2, i2).canBeReplacedByLeaves(par1World, l2, k2, i2)) { - this.setBlock(par1World, l1, j2, k2, Block.leaves.blockID); + this.func_150515_a(par1World, l2, k2, i2, Blocks.leaves); } -@@ -106,7 +109,9 @@ +@@ -113,7 +116,7 @@ { - j1 = par1World.getBlockId(par3, par4 + j2, par5); + Block block2 = par1World.func_147439_a(par3, par4 + k2, par5); -- if (j1 == 0 || j1 == Block.leaves.blockID || j1 == Block.waterMoving.blockID || j1 == Block.waterStill.blockID) -+ Block block = Block.blocksList[j1]; -+ -+ if (j1 == 0 || (block != null && block.isLeaves(par1World, par3, par4 + j2, par5)) || j1 == Block.waterMoving.blockID || j1 == Block.waterStill.blockID) +- if (block2.func_149688_o() == Material.field_151579_a || block2.func_149688_o() == Material.field_151584_j || block2 == Blocks.flowing_water || block2 == Blocks.water) ++ if (block2.isAir(par1World, par3, par4 + k2, par5) || block2.isLeaves(par1World, par3, par4 + k2, par5) || block2 == Blocks.flowing_water || block2 == Blocks.water) { - this.setBlock(par1World, par3, par4 + j2, par5, Block.wood.blockID); + this.func_150515_a(par1World, par3, par4 + k2, par5, Blocks.log); } -@@ -121,7 +126,8 @@ +@@ -128,24 +131,24 @@ { - for (i2 = par5 - k1; i2 <= par5 + k1; ++i2) + for (l1 = par5 - k1; l1 <= par5 + k1; ++l1) { -- if (par1World.getBlockId(l1, j2, i2) == Block.leaves.blockID) -+ Block block = Block.blocksList[par1World.getBlockId(l1, j2, i2)]; -+ if (block != null && block.isLeaves(par1World, l1, j2, i2)) +- if (par1World.func_147439_a(l2, k2, l1).func_149688_o() == Material.field_151584_j) ++ if (par1World.func_147439_a(l2, k2, l1).isLeaves(par1World, l2, k2, l1)) { - if (par2Random.nextInt(4) == 0 && par1World.getBlockId(l1 - 1, j2, i2) == 0) +- if (par2Random.nextInt(4) == 0 && par1World.func_147439_a(l2 - 1, k2, l1).func_149688_o() == Material.field_151579_a) ++ if (par2Random.nextInt(4) == 0 && par1World.func_147439_a(l2 - 1, k2, l1).isAir(par1World, l2 - 1, k2, l1)) { + this.generateVines(par1World, l2 - 1, k2, l1, 8); + } + +- if (par2Random.nextInt(4) == 0 && par1World.func_147439_a(l2 + 1, k2, l1).func_149688_o() == Material.field_151579_a) ++ if (par2Random.nextInt(4) == 0 && par1World.func_147439_a(l2 + 1, k2, l1).isAir(par1World, l2 + 1, k2, l1)) + { + this.generateVines(par1World, l2 + 1, k2, l1, 2); + } + +- if (par2Random.nextInt(4) == 0 && par1World.func_147439_a(l2, k2, l1 - 1).func_149688_o() == Material.field_151579_a) ++ if (par2Random.nextInt(4) == 0 && par1World.func_147439_a(l2, k2, l1 - 1).isAir(par1World, l2, k2, l1 - 1)) + { + this.generateVines(par1World, l2, k2, l1 - 1, 1); + } + +- if (par2Random.nextInt(4) == 0 && par1World.func_147439_a(l2, k2, l1 + 1).func_149688_o() == Material.field_151579_a) ++ if (par2Random.nextInt(4) == 0 && par1World.func_147439_a(l2, k2, l1 + 1).isAir(par1World, l2, k2, l1 + 1)) + { + this.generateVines(par1World, l2, k2, l1 + 1, 4); + } +@@ -178,7 +181,7 @@ + { + --par3; + +- if (par1World.func_147439_a(par2, par3, par4).func_149688_o() != Material.field_151579_a || i1 <= 0) ++ if (par1World.func_147439_a(par2, par3, par4).isAir(par1World, par2, par3, par4) || i1 <= 0) + { + return; + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch index f7089260e..03214c9b2 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch @@ -1,36 +1,54 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java -@@ -43,7 +43,9 @@ - { - k2 = par1World.getBlockId(i2, l1, j2); +@@ -2,9 +2,11 @@ -- if (k2 != 0 && k2 != Block.leaves.blockID) -+ Block block = Block.blocksList[k2]; -+ -+ if (k2 != 0 && (block == null || !block.isLeaves(par1World, i2, l1, j2))) + import java.util.Random; + import net.minecraft.block.Block; ++import net.minecraft.block.BlockSapling; + import net.minecraft.block.material.Material; + import net.minecraft.init.Blocks; + import net.minecraft.world.World; ++import net.minecraftforge.common.util.ForgeDirection; + + public class WorldGenTaiga1 extends WorldGenAbstractTree + { +@@ -50,7 +52,7 @@ + { + Block block = par1World.func_147439_a(i2, l1, j2); + +- if (!this.func_150523_a(block)) ++ if (!this.isReplaceable(par1World, i2, l1, j2)) { flag = false; } -@@ -79,7 +81,10 @@ +@@ -71,9 +73,10 @@ + { + Block block1 = par1World.func_147439_a(par3, par4 - 1, par5); + +- if ((block1 == Blocks.grass || block1 == Blocks.dirt) && par4 < 256 - l - 1) ++ boolean isSoil = block1.canSustainPlant(par1World, par3, par4 - 1, par5, ForgeDirection.UP, (BlockSapling)Blocks.sapling); ++ if (isSoil && par4 < 256 - l - 1) + { +- this.func_150515_a(par1World, par3, par4 - 1, par5, Blocks.dirt); ++ block1.onPlantGrow(par1World, par3, par4 - 1, par5, par3, par4, par5); + i3 = 0; + + for (i2 = par4 + l; i2 >= par4 + i1; --i2) +@@ -86,7 +89,7 @@ { - int j3 = i3 - par5; + int l2 = k2 - par5; -- if ((Math.abs(k2) != l2 || Math.abs(j3) != l2 || l2 <= 0) && !Block.opaqueCubeLookup[par1World.getBlockId(j2, i2, i3)]) -+ Block block = Block.blocksList[par1World.getBlockId(j2, i2, i3)]; -+ -+ if ((Math.abs(k2) != l2 || Math.abs(j3) != l2 || l2 <= 0) && -+ (block == null || block.canBeReplacedByLeaves(par1World, j2, i2, i3))) +- if ((Math.abs(j3) != i3 || Math.abs(l2) != i3 || i3 <= 0) && !par1World.func_147439_a(j2, i2, k2).func_149730_j()) ++ if ((Math.abs(j3) != i3 || Math.abs(l2) != i3 || i3 <= 0) && !par1World.func_147439_a(j2, i2, k2).canBeReplacedByLeaves(par1World, j2, i2, k2)) { - this.setBlockAndMetadata(par1World, j2, i2, i3, Block.leaves.blockID, 1); + this.func_150516_a(par1World, j2, i2, k2, Blocks.leaves, 1); } -@@ -100,7 +105,9 @@ +@@ -107,7 +110,7 @@ { - j2 = par1World.getBlockId(par3, par4 + i2, par5); + Block block2 = par1World.func_147439_a(par3, par4 + i2, par5); -- if (j2 == 0 || j2 == Block.leaves.blockID) -+ Block block = Block.blocksList[j2]; -+ -+ if (j2 == 0 || block == null || block.isLeaves(par1World, par3, par4 + i2, par5)) +- if (block2.func_149688_o() == Material.field_151579_a || block2.func_149688_o() == Material.field_151584_j) ++ if (block2.isAir(par1World, par3, par4 + i2, par5) || block2.isLeaves(par1World, par3, par4 + i2, par5)) { - this.setBlockAndMetadata(par1World, par3, par4 + i2, par5, Block.wood.blockID, 1); + this.func_150516_a(par1World, par3, par4 + i2, par5, Blocks.log, 1); } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch index 0f8fd5d63..201984977 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch @@ -1,61 +1,54 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java -@@ -2,7 +2,9 @@ +@@ -2,9 +2,11 @@ import java.util.Random; import net.minecraft.block.Block; +import net.minecraft.block.BlockSapling; + import net.minecraft.block.material.Material; + import net.minecraft.init.Blocks; import net.minecraft.world.World; -+import net.minecraftforge.common.ForgeDirection; ++import net.minecraftforge.common.util.ForgeDirection; - public class WorldGenTaiga2 extends WorldGenerator + public class WorldGenTaiga2 extends WorldGenAbstractTree { -@@ -47,7 +49,9 @@ +@@ -49,7 +51,7 @@ { - j2 = par1World.getBlockId(i2, l1, l2); + Block block = par1World.func_147439_a(i2, l1, j2); -- if (j2 != 0 && j2 != Block.leaves.blockID) -+ Block block = Block.blocksList[j2]; -+ -+ if (j2 != 0 && block != null && !block.isLeaves(par1World, i2, l1, l2)) +- if (block.func_149688_o() != Material.field_151579_a && block.func_149688_o() != Material.field_151584_j) ++ if (!block.isAir(par1World, i2, l1, j2) && !block.isLeaves(par1World, i2, l1, j2)) { flag = false; } -@@ -67,10 +71,12 @@ - else +@@ -70,9 +72,10 @@ { - l1 = par1World.getBlockId(par3, par4 - 1, par5); -+ Block soil = Block.blocksList[l1]; -+ boolean isValidSoil = soil != null && soil.canSustainPlant(par1World, par3, par4 - 1, par5, ForgeDirection.UP, (BlockSapling)Block.sapling); + Block block1 = par1World.func_147439_a(par3, par4 - 1, par5); -- if ((l1 == Block.grass.blockID || l1 == Block.dirt.blockID) && par4 < 256 - l - 1) -+ if (isValidSoil && par4 < 256 - l - 1) +- if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland) && par4 < 256 - l - 1) ++ boolean isSoil = block1.canSustainPlant(par1World, par3, par4 - 1, par5, ForgeDirection.UP, (BlockSapling)Blocks.sapling); ++ if (isSoil && par4 < 256 - l - 1) { -- this.setBlock(par1World, par3, par4 - 1, par5, Block.dirt.blockID); -+ soil.onPlantGrow(par1World, par3, par4 - 1, par5, par3, par4, par5); - k2 = par2Random.nextInt(2); +- this.func_150515_a(par1World, par3, par4 - 1, par5, Blocks.dirt); ++ block1.onPlantGrow(par1World, par3, par4 - 1, par5, par3, par4, par5); + l3 = par2Random.nextInt(2); i2 = 1; byte b0 = 0; -@@ -89,7 +95,10 @@ +@@ -91,7 +94,7 @@ { - int i4 = l3 - par5; + int k3 = j3 - par5; -- if ((Math.abs(k3) != k2 || Math.abs(i4) != k2 || k2 <= 0) && !Block.opaqueCubeLookup[par1World.getBlockId(i3, j3, l3)]) -+ Block block = Block.blocksList[par1World.getBlockId(i3, j3, l3)]; -+ -+ if ((Math.abs(k3) != k2 || Math.abs(i4) != k2 || k2 <= 0) && -+ (block == null || block.canBeReplacedByLeaves(par1World, i3, j3, l3))) +- if ((Math.abs(i3) != l3 || Math.abs(k3) != l3 || l3 <= 0) && !par1World.func_147439_a(l2, k2, j3).func_149730_j()) ++ if ((Math.abs(i3) != l3 || Math.abs(k3) != l3 || l3 <= 0) && !par1World.func_147439_a(l2, k2, j3).canBeReplacedByLeaves(par1World, l2, k2, j3)) { - this.setBlockAndMetadata(par1World, i3, j3, l3, Block.leaves.blockID, 1); + this.func_150516_a(par1World, l2, k2, j3, Blocks.leaves, 1); } -@@ -119,7 +128,9 @@ +@@ -121,7 +124,7 @@ { - i3 = par1World.getBlockId(par3, par4 + j3, par5); + Block block2 = par1World.func_147439_a(par3, par4 + k2, par5); -- if (i3 == 0 || i3 == Block.leaves.blockID) -+ Block block = Block.blocksList[i3]; -+ -+ if (i3 == 0 || block == null || block.isLeaves(par1World, par3, par4 + j3, par5)) +- if (block2.func_149688_o() == Material.field_151579_a || block2.func_149688_o() == Material.field_151584_j) ++ if (block2.isAir(par1World, par3, par4 + k2, par5) || block2.isLeaves(par1World, par3, par4 + k2, par5)) { - this.setBlockAndMetadata(par1World, par3, par4 + j3, par5, Block.wood.blockID, 1); + this.func_150516_a(par1World, par3, par4 + k2, par5, Blocks.log, 1); } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch index 3978eb2b2..9854950fc 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch @@ -1,22 +1,20 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java -@@ -20,10 +20,16 @@ +@@ -21,10 +21,15 @@ { - int l; + Block block; -- for (boolean flag = false; ((l = par1World.getBlockId(par3, par4, par5)) == 0 || l == Block.leaves.blockID) && par4 > 0; --par4) -+ Block block = null; -+ do +- while (((block = par1World.func_147439_a(par3, par4, par5)).func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) && par4 > 0) ++ do { -- ; -- } -+ block = Block.blocksList[par1World.getBlockId(par3, par4, par5)]; -+ if (block != null && !block.isLeaves(par1World, par3, par4, par5)) ++ block = par1World.func_147439_a(par3, par4, par5); ++ if (block.isLeaves(par1World, par3, par4, par5) || block.isAir(par1World, par3, par4, par5)) + { + break; + } -+ par4--; + --par4; +- } + } while (par4 > 0); - for (int i1 = 0; i1 < 128; ++i1) + for (int l = 0; l < 128; ++l) { diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch index 450fa6163..26f736408 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch @@ -1,105 +1,94 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java -@@ -2,8 +2,10 @@ +@@ -2,10 +2,12 @@ import java.util.Random; import net.minecraft.block.Block; +import net.minecraft.block.BlockSapling; + import net.minecraft.block.material.Material; + import net.minecraft.init.Blocks; import net.minecraft.util.Direction; import net.minecraft.world.World; -+import net.minecraftforge.common.ForgeDirection; ++import net.minecraftforge.common.util.ForgeDirection; - public class WorldGenTrees extends WorldGenerator + public class WorldGenTrees extends WorldGenAbstractTree { -@@ -67,7 +69,13 @@ +@@ -66,7 +68,7 @@ { - k1 = par1World.getBlockId(l1, i1, j1); + block = par1World.func_147439_a(j1, i1, k1); -- if (k1 != 0 && k1 != Block.leaves.blockID && k1 != Block.grass.blockID && k1 != Block.dirt.blockID && k1 != Block.wood.blockID) -+ Block block = Block.blocksList[k1]; -+ -+ if (!par1World.isAirBlock(l1, i1, j1) && -+ !block.isLeaves(par1World, l1, i1, j1) && -+ k1 != Block.grass.blockID && -+ k1 != Block.dirt.blockID && -+ !block.isWood(par1World, l1, i1, j1)) +- if (!this.func_150523_a(block)) ++ if (!this.isReplaceable(par1World, j1, i1, k1)) { flag = false; } -@@ -87,10 +95,12 @@ - else +@@ -87,9 +89,10 @@ { - i1 = par1World.getBlockId(par3, par4 - 1, par5); -+ Block soil = Block.blocksList[i1]; -+ boolean isSoil = (soil != null && soil.canSustainPlant(par1World, par3, par4 - 1, par5, ForgeDirection.UP, (BlockSapling)Block.sapling)); + Block block2 = par1World.func_147439_a(par3, par4 - 1, par5); -- if ((i1 == Block.grass.blockID || i1 == Block.dirt.blockID) && par4 < 256 - l - 1) +- if ((block2 == Blocks.grass || block2 == Blocks.dirt || block2 == Blocks.farmland) && par4 < 256 - l - 1) ++ boolean isSoil = block2.canSustainPlant(par1World, par3, par4 - 1, par5, ForgeDirection.UP, (BlockSapling)Blocks.sapling); + if (isSoil && par4 < 256 - l - 1) { -- this.setBlock(par1World, par3, par4 - 1, par5, Block.dirt.blockID); -+ soil.onPlantGrow(par1World, par3, par4 - 1, par5, par3, par4, par5); +- this.func_150515_a(par1World, par3, par4 - 1, par5, Blocks.dirt); ++ block2.onPlantGrow(par1World, par3, par4 - 1, par5, par3, par4, par5); b0 = 3; byte b1 = 0; - int i2; -@@ -113,8 +123,9 @@ - if (Math.abs(k2) != i2 || Math.abs(i3) != i2 || par2Random.nextInt(2) != 0 && k1 != 0) + int l1; +@@ -114,7 +117,7 @@ { - int j3 = par1World.getBlockId(j2, j1, l2); -+ Block block = Block.blocksList[j3]; + Block block1 = par1World.func_147439_a(i2, k1, k2); -- if (j3 == 0 || j3 == Block.leaves.blockID) -+ if (block == null || block.canBeReplacedByLeaves(par1World, j2, j1, l2)) +- if (block1.func_149688_o() == Material.field_151579_a || block1.func_149688_o() == Material.field_151584_j) ++ if (block1.isAir(par1World, i2, k1, k2) || block1.isLeaves(par1World, i2, k1, k2)) { - this.setBlockAndMetadata(par1World, j2, j1, l2, Block.leaves.blockID, this.metaLeaves); + this.func_150516_a(par1World, i2, k1, k2, Blocks.leaves, this.metaLeaves); } -@@ -127,7 +138,9 @@ +@@ -127,7 +130,7 @@ { - k1 = par1World.getBlockId(par3, par4 + j1, par5); + block = par1World.func_147439_a(par3, par4 + k1, par5); -- if (k1 == 0 || k1 == Block.leaves.blockID) -+ Block block = Block.blocksList[k1]; -+ -+ if (block == null || block.isAirBlock(par1World, par3, par4 + j1, par5) || block.isLeaves(par1World, par3, par4 + j1, par5)) +- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) ++ if (block.isAir(par1World, par3, par4 + k1, par5) || block.isLeaves(par1World, par3, par4 + k1, par5)) { - this.setBlockAndMetadata(par1World, par3, par4 + j1, par5, Block.wood.blockID, this.metaWood); + this.func_150516_a(par1World, par3, par4 + k1, par5, Blocks.log, this.metaWood); -@@ -167,24 +180,25 @@ +@@ -167,24 +170,24 @@ { - for (k2 = par5 - i2; k2 <= par5 + i2; ++k2) + for (j2 = par5 - l1; j2 <= par5 + l1; ++j2) { -- if (par1World.getBlockId(j2, j1, k2) == Block.leaves.blockID) -+ Block block = Block.blocksList[par1World.getBlockId(j2, j1, k2)]; -+ if (block != null && block.isLeaves(par1World, j2, j1, k2)) +- if (par1World.func_147439_a(i2, k1, j2).func_149688_o() == Material.field_151584_j) ++ if (par1World.func_147439_a(i2, k1, j2).isLeaves(par1World, i2, k1, j2)) { -- if (par2Random.nextInt(4) == 0 && par1World.getBlockId(j2 - 1, j1, k2) == 0) -+ if (par2Random.nextInt(4) == 0 && par1World.isAirBlock(j2 - 1, j1, k2)) +- if (par2Random.nextInt(4) == 0 && par1World.func_147439_a(i2 - 1, k1, j2).func_149688_o() == Material.field_151579_a) ++ if (par2Random.nextInt(4) == 0 && par1World.func_147439_a(i2 - 1, k1, j2).isAir(par1World, i2 - 1, k1, j2)) { - this.growVines(par1World, j2 - 1, j1, k2, 8); + this.growVines(par1World, i2 - 1, k1, j2, 8); } -- if (par2Random.nextInt(4) == 0 && par1World.getBlockId(j2 + 1, j1, k2) == 0) -+ if (par2Random.nextInt(4) == 0 && par1World.isAirBlock(j2 + 1, j1, k2)) +- if (par2Random.nextInt(4) == 0 && par1World.func_147439_a(i2 + 1, k1, j2).func_149688_o() == Material.field_151579_a) ++ if (par2Random.nextInt(4) == 0 && par1World.func_147439_a(i2 + 1, k1, j2).isAir(par1World, i2 + 1, k1, j2)) { - this.growVines(par1World, j2 + 1, j1, k2, 2); + this.growVines(par1World, i2 + 1, k1, j2, 2); } -- if (par2Random.nextInt(4) == 0 && par1World.getBlockId(j2, j1, k2 - 1) == 0) -+ if (par2Random.nextInt(4) == 0 && par1World.isAirBlock(j2, j1, k2 - 1)) +- if (par2Random.nextInt(4) == 0 && par1World.func_147439_a(i2, k1, j2 - 1).func_149688_o() == Material.field_151579_a) ++ if (par2Random.nextInt(4) == 0 && par1World.func_147439_a(i2, k1, j2 - 1).isAir(par1World, i2, k1, j2 - 1)) { - this.growVines(par1World, j2, j1, k2 - 1, 1); + this.growVines(par1World, i2, k1, j2 - 1, 1); } -- if (par2Random.nextInt(4) == 0 && par1World.getBlockId(j2, j1, k2 + 1) == 0) -+ if (par2Random.nextInt(4) == 0 && par1World.isAirBlock(j2, j1, k2 + 1)) +- if (par2Random.nextInt(4) == 0 && par1World.func_147439_a(i2, k1, j2 + 1).func_149688_o() == Material.field_151579_a) ++ if (par2Random.nextInt(4) == 0 && par1World.func_147439_a(i2, k1, j2 + 1).isAir(par1World, i2, k1, j2 + 1)) { - this.growVines(par1World, j2, j1, k2 + 1, 4); + this.growVines(par1World, i2, k1, j2 + 1, 4); } -@@ -235,7 +249,7 @@ +@@ -233,7 +236,7 @@ { --par3; -- if (par1World.getBlockId(par2, par3, par4) != 0 || i1 <= 0) -+ if (!par1World.isAirBlock(par2, par3, par4) || i1 <= 0) +- if (par1World.func_147439_a(par2, par3, par4).func_149688_o() != Material.field_151579_a || i1 <= 0) ++ if (par1World.func_147439_a(par2, par3, par4).isAir(par1World, par2, par3, par4) || i1 <= 0) { return; } 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 000000000..098b77d98 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch @@ -0,0 +1,18 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java +@@ -26,10 +26,12 @@ + { + Block block; + +- while (((block = par1World.func_147439_a(par3, par4, par5)).func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) && par4 > 1) ++ do + { +- --par4; +- } ++ block = par1World.func_147439_a(par3, par4, par5); ++ if (!block.isAir(par1World, par3, par4, par5) && !block.isLeaves(par1World, par3, par4, par5)) break; ++ par4--; ++ } while (par4 > 1); + + if (par4 < 1) + { diff --git a/patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch b/patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch index 91477d630..7a5eb41be 100644 --- a/patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch @@ -1,27 +1,27 @@ --- ../src-base/minecraft/net/minecraft/world/gen/layer/GenLayer.java +++ ../src-work/minecraft/net/minecraft/world/gen/layer/GenLayer.java -@@ -2,6 +2,9 @@ - +@@ -7,6 +7,9 @@ import net.minecraft.world.WorldType; + import net.minecraft.world.biome.BiomeGenBase; +import net.minecraftforge.common.*; +import net.minecraftforge.event.terraingen.*; + public abstract class GenLayer { - /** seed from World#getWorldSeed that is used in the LCG prng */ -@@ -42,6 +45,7 @@ + // JAVADOC FIELD $$ field_75907_b +@@ -53,6 +56,7 @@ { - b0 = 6; + b0 = 4; } + b0 = getModdedBiomeSize(par2WorldType, b0); - GenLayer genlayer = GenLayerZoom.magnify(1000L, genlayeraddmushroomisland, 0); + GenLayer genlayer = GenLayerZoom.magnify(1000L, genlayer3, 0); GenLayerRiverInit genlayerriverinit = new GenLayerRiverInit(100L, genlayer); -@@ -151,4 +155,11 @@ - * amounts, or biomeList[] indices based on the particular GenLayer subclass. - */ - public abstract int[] getInts(int i, int j, int k, int l); +@@ -213,4 +217,11 @@ + { + return p_151617_2_ == p_151617_3_ && p_151617_3_ == p_151617_4_ ? p_151617_2_ : (p_151617_1_ == p_151617_2_ && p_151617_1_ == p_151617_3_ ? p_151617_1_ : (p_151617_1_ == p_151617_2_ && p_151617_1_ == p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_3_ && p_151617_1_ == p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_2_ && p_151617_3_ != p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_3_ && p_151617_2_ != p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_4_ && p_151617_2_ != p_151617_3_ ? p_151617_1_ : (p_151617_2_ == p_151617_3_ && p_151617_1_ != p_151617_4_ ? p_151617_2_ : (p_151617_2_ == p_151617_4_ && p_151617_1_ != p_151617_3_ ? p_151617_2_ : (p_151617_3_ == p_151617_4_ && p_151617_1_ != p_151617_2_ ? p_151617_3_ : this.func_151619_a(new int[] {p_151617_1_, p_151617_2_, p_151617_3_, p_151617_4_})))))))))); + } + + public static byte getModdedBiomeSize(WorldType worldType, byte original) + { diff --git a/patches/minecraft/net/minecraft/world/gen/structure/ComponentMineshaftCorridor.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/ComponentMineshaftCorridor.java.patch deleted file mode 100644 index b0573a6a2..000000000 --- a/patches/minecraft/net/minecraft/world/gen/structure/ComponentMineshaftCorridor.java.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/ComponentMineshaftCorridor.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/ComponentMineshaftCorridor.java -@@ -10,6 +10,9 @@ - import net.minecraft.util.WeightedRandomChestContent; - import net.minecraft.world.World; - -+import net.minecraftforge.common.ChestGenHooks; -+import static net.minecraftforge.common.ChestGenHooks.*; -+ - public class ComponentMineshaftCorridor extends StructureComponent - { - private boolean hasRails; -@@ -283,14 +286,16 @@ - this.randomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.05F, 1, 2, k - 1, Block.torchWood.blockID, 0); - this.randomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.05F, 1, 2, k + 1, Block.torchWood.blockID, 0); - -+ ChestGenHooks info = ChestGenHooks.getInfo(MINESHAFT_CORRIDOR); -+ - if (par2Random.nextInt(100) == 0) - { -- this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 2, 0, k - 1, WeightedRandomChestContent.func_92080_a(StructureMineshaftPieces.func_78816_a(), new WeightedRandomChestContent[] {Item.enchantedBook.func_92114_b(par2Random)}), 3 + par2Random.nextInt(4)); -+ this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 2, 0, k - 1, info.getItems(par2Random), info.getCount(par2Random)); - } - - if (par2Random.nextInt(100) == 0) - { -- this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 0, 0, k + 1, WeightedRandomChestContent.func_92080_a(StructureMineshaftPieces.func_78816_a(), new WeightedRandomChestContent[] {Item.enchantedBook.func_92114_b(par2Random)}), 3 + par2Random.nextInt(4)); -+ this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 0, 0, k + 1, info.getItems(par2Random), info.getCount(par2Random)); - } - - if (this.hasSpiders && !this.spawnerPlaced) diff --git a/patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeatureDesertPyramid.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeatureDesertPyramid.java.patch deleted file mode 100644 index 6f1eeab6c..000000000 --- a/patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeatureDesertPyramid.java.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeatureDesertPyramid.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeatureDesertPyramid.java -@@ -8,6 +8,9 @@ - import net.minecraft.util.WeightedRandomChestContent; - import net.minecraft.world.World; - -+import net.minecraftforge.common.ChestGenHooks; -+import static net.minecraftforge.common.ChestGenHooks.*; -+ - public class ComponentScatteredFeatureDesertPyramid extends ComponentScatteredFeature - { - private boolean[] field_74940_h = new boolean[4]; -@@ -236,13 +239,14 @@ - this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 1, 10, -10, 13, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 2, 10, -11, 13, par3StructureBoundingBox); - -+ ChestGenHooks info = ChestGenHooks.getInfo(PYRAMID_DESERT_CHEST); - for (i1 = 0; i1 < 4; ++i1) - { - if (!this.field_74940_h[i1]) - { - int j1 = Direction.offsetX[i1] * 2; - int k1 = Direction.offsetZ[i1] * 2; -- this.field_74940_h[i1] = this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 10 + j1, -11, 10 + k1, WeightedRandomChestContent.func_92080_a(itemsToGenerateInTemple, new WeightedRandomChestContent[] {Item.enchantedBook.func_92114_b(par2Random)}), 2 + par2Random.nextInt(5)); -+ this.field_74940_h[i1] = this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 10 + j1, -11, 10 + k1, info.getItems(par2Random), info.getCount(par2Random)); - } - } - diff --git a/patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeatureJunglePyramid.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeatureJunglePyramid.java.patch deleted file mode 100644 index ecd8be1e8..000000000 --- a/patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeatureJunglePyramid.java.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeatureJunglePyramid.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeatureJunglePyramid.java -@@ -8,6 +8,9 @@ - import net.minecraft.util.WeightedRandomChestContent; - import net.minecraft.world.World; - -+import net.minecraftforge.common.ChestGenHooks; -+import static net.minecraftforge.common.ChestGenHooks.*; -+ - public class ComponentScatteredFeatureJunglePyramid extends ComponentScatteredFeature - { - private boolean field_74947_h; -@@ -185,9 +188,12 @@ - this.placeBlockAtCurrentPosition(par1World, Block.redstoneWire.blockID, 0, 4, -3, 1, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.cobblestoneMossy.blockID, 0, 3, -3, 1, par3StructureBoundingBox); - -+ ChestGenHooks dispenser = ChestGenHooks.getInfo(PYRAMID_JUNGLE_DISPENSER); -+ ChestGenHooks chest = ChestGenHooks.getInfo(PYRAMID_JUNGLE_CHEST); -+ - if (!this.field_74945_j) - { -- this.field_74945_j = this.generateStructureDispenserContents(par1World, par3StructureBoundingBox, par2Random, 3, -2, 1, 2, junglePyramidsDispenserContents, 2); -+ this.field_74945_j = this.generateStructureDispenserContents(par1World, par3StructureBoundingBox, par2Random, 3, -2, 1, 2, dispenser.getItems(par2Random), dispenser.getCount(par2Random)); - } - - this.placeBlockAtCurrentPosition(par1World, Block.vine.blockID, 15, 3, -2, 2, par3StructureBoundingBox); -@@ -204,7 +210,7 @@ - - if (!this.field_74946_k) - { -- this.field_74946_k = this.generateStructureDispenserContents(par1World, par3StructureBoundingBox, par2Random, 9, -2, 3, 4, junglePyramidsDispenserContents, 2); -+ this.field_74946_k = this.generateStructureDispenserContents(par1World, par3StructureBoundingBox, par2Random, 9, -2, 3, 4, dispenser.getItems(par2Random), dispenser.getCount(par2Random)); - } - - this.placeBlockAtCurrentPosition(par1World, Block.vine.blockID, 15, 8, -1, 3, par3StructureBoundingBox); -@@ -212,7 +218,7 @@ - - if (!this.field_74947_h) - { -- this.field_74947_h = this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 8, -3, 3, WeightedRandomChestContent.func_92080_a(junglePyramidsChestContents, new WeightedRandomChestContent[] {Item.enchantedBook.func_92114_b(par2Random)}), 2 + par2Random.nextInt(5)); -+ this.field_74947_h = this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 8, -3, 3, chest.getItems(par2Random), chest.getCount(par2Random)); - } - - this.placeBlockAtCurrentPosition(par1World, Block.cobblestoneMossy.blockID, 0, 9, -3, 2, par3StructureBoundingBox); -@@ -245,7 +251,7 @@ - - if (!this.field_74948_i) - { -- this.field_74948_i = this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 9, -3, 10, WeightedRandomChestContent.func_92080_a(junglePyramidsChestContents, new WeightedRandomChestContent[] {Item.enchantedBook.func_92114_b(par2Random)}), 2 + par2Random.nextInt(5)); -+ this.field_74948_i = this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 9, -3, 10, chest.getItems(par2Random), chest.getCount(par2Random)); - } - - return true; diff --git a/patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch new file mode 100644 index 000000000..0e7085f42 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch @@ -0,0 +1,62 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java ++++ ../src-work/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java +@@ -11,6 +11,9 @@ + import net.minecraft.util.WeightedRandomChestContent; + import net.minecraft.world.World; + ++import net.minecraftforge.common.ChestGenHooks; ++import static net.minecraftforge.common.ChestGenHooks.*; ++ + public class ComponentScatteredFeaturePieces + { + private static final String __OBFID = "CL_00000473"; +@@ -277,9 +280,12 @@ + this.func_151550_a(par1World, Blocks.redstone_wire, 0, 4, -3, 1, par3StructureBoundingBox); + this.func_151550_a(par1World, Blocks.mossy_cobblestone, 0, 3, -3, 1, par3StructureBoundingBox); + ++ ChestGenHooks dispenser = ChestGenHooks.getInfo(PYRAMID_JUNGLE_DISPENSER); ++ ChestGenHooks chest = ChestGenHooks.getInfo(PYRAMID_JUNGLE_CHEST); ++ + if (!this.field_74945_j) + { +- this.field_74945_j = this.generateStructureDispenserContents(par1World, par3StructureBoundingBox, par2Random, 3, -2, 1, 2, junglePyramidsDispenserContents, 2); ++ this.field_74945_j = this.generateStructureDispenserContents(par1World, par3StructureBoundingBox, par2Random, 3, -2, 1, 2, dispenser.getItems(par2Random), dispenser.getCount(par2Random)); + } + + this.func_151550_a(par1World, Blocks.vine, 15, 3, -2, 2, par3StructureBoundingBox); +@@ -296,7 +302,7 @@ + + if (!this.field_74946_k) + { +- this.field_74946_k = this.generateStructureDispenserContents(par1World, par3StructureBoundingBox, par2Random, 9, -2, 3, 4, junglePyramidsDispenserContents, 2); ++ this.field_74946_k = this.generateStructureDispenserContents(par1World, par3StructureBoundingBox, par2Random, 9, -2, 3, 4, dispenser.getItems(par2Random), dispenser.getCount(par2Random)); + } + + this.func_151550_a(par1World, Blocks.vine, 15, 8, -1, 3, par3StructureBoundingBox); +@@ -304,7 +310,7 @@ + + if (!this.field_74947_h) + { +- this.field_74947_h = this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 8, -3, 3, WeightedRandomChestContent.func_92080_a(junglePyramidsChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.func_92114_b(par2Random)}), 2 + par2Random.nextInt(5)); ++ this.field_74947_h = this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 8, -3, 3, chest.getItems(par2Random), chest.getCount(par2Random)); + } + + this.func_151550_a(par1World, Blocks.mossy_cobblestone, 0, 9, -3, 2, par3StructureBoundingBox); +@@ -337,7 +343,7 @@ + + if (!this.field_74948_i) + { +- this.field_74948_i = this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 9, -3, 10, WeightedRandomChestContent.func_92080_a(junglePyramidsChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.func_92114_b(par2Random)}), 2 + par2Random.nextInt(5)); ++ this.field_74948_i = this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 9, -3, 10, chest.getItems(par2Random), chest.getCount(par2Random)); + } + + return true; +@@ -697,7 +703,7 @@ + { + int i1 = Direction.offsetX[l] * 2; + int j1 = Direction.offsetZ[l] * 2; +- this.field_74940_h[l] = this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 10 + i1, -11, 10 + j1, WeightedRandomChestContent.func_92080_a(itemsToGenerateInTemple, new WeightedRandomChestContent[] {Items.enchanted_book.func_92114_b(par2Random)}), 2 + par2Random.nextInt(5)); ++ this.field_74940_h[l] = this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 10 + i1, -11, 10 + j1, ChestGenHooks.getItems(PYRAMID_DESERT_CHEST, par2Random), ChestGenHooks.getCount(PYRAMID_DESERT_CHEST, par2Random)); + } + } + diff --git a/patches/minecraft/net/minecraft/world/gen/structure/ComponentStrongholdChestCorridor.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/ComponentStrongholdChestCorridor.java.patch deleted file mode 100644 index 015ec0629..000000000 --- a/patches/minecraft/net/minecraft/world/gen/structure/ComponentStrongholdChestCorridor.java.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/ComponentStrongholdChestCorridor.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/ComponentStrongholdChestCorridor.java -@@ -8,6 +8,9 @@ - import net.minecraft.util.WeightedRandomChestContent; - import net.minecraft.world.World; - -+import net.minecraftforge.common.ChestGenHooks; -+import static net.minecraftforge.common.ChestGenHooks.*; -+ - public class ComponentStrongholdChestCorridor extends ComponentStronghold - { - /** List of items that Stronghold chests can contain. */ -@@ -86,7 +89,7 @@ - if (par3StructureBoundingBox.isVecInside(j, i, k)) - { - this.hasMadeChest = true; -- this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 3, 2, 3, WeightedRandomChestContent.func_92080_a(strongholdChestContents, new WeightedRandomChestContent[] {Item.enchantedBook.func_92114_b(par2Random)}), 2 + par2Random.nextInt(2)); -+ this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 3, 2, 3, ChestGenHooks.getItems(STRONGHOLD_CORRIDOR, par2Random), ChestGenHooks.getCount(STRONGHOLD_CORRIDOR, par2Random)); - } - } - diff --git a/patches/minecraft/net/minecraft/world/gen/structure/ComponentStrongholdLibrary.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/ComponentStrongholdLibrary.java.patch deleted file mode 100644 index 221962153..000000000 --- a/patches/minecraft/net/minecraft/world/gen/structure/ComponentStrongholdLibrary.java.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/ComponentStrongholdLibrary.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/ComponentStrongholdLibrary.java -@@ -8,6 +8,9 @@ - import net.minecraft.util.WeightedRandomChestContent; - import net.minecraft.world.World; - -+import net.minecraftforge.common.ChestGenHooks; -+import static net.minecraftforge.common.ChestGenHooks.*; -+ - public class ComponentStrongholdLibrary extends ComponentStronghold - { - /** List of items that Stronghold Library chests can contain. */ -@@ -161,12 +164,14 @@ - this.placeBlockAtCurrentPosition(par1World, Block.torchWood.blockID, 0, b1, 8, b2 + 1, par3StructureBoundingBox); - } - -- this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 3, 3, 5, WeightedRandomChestContent.func_92080_a(strongholdLibraryChestContents, new WeightedRandomChestContent[] {Item.enchantedBook.func_92112_a(par2Random, 1, 5, 2)}), 1 + par2Random.nextInt(4)); -+ ChestGenHooks info = ChestGenHooks.getInfo(STRONGHOLD_LIBRARY); - -+ this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 3, 3, 5, info.getItems(par2Random), info.getCount(par2Random)); -+ - if (this.isLargeRoom) - { - this.placeBlockAtCurrentPosition(par1World, 0, 0, 12, 9, 1, par3StructureBoundingBox); -- this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 12, 8, 1, WeightedRandomChestContent.func_92080_a(strongholdLibraryChestContents, new WeightedRandomChestContent[] {Item.enchantedBook.func_92112_a(par2Random, 1, 5, 2)}), 1 + par2Random.nextInt(4)); -+ this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 12, 8, 1, info.getItems(par2Random), info.getCount(par2Random)); - } - - return true; diff --git a/patches/minecraft/net/minecraft/world/gen/structure/ComponentStrongholdRoomCrossing.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/ComponentStrongholdRoomCrossing.java.patch deleted file mode 100644 index e39441c85..000000000 --- a/patches/minecraft/net/minecraft/world/gen/structure/ComponentStrongholdRoomCrossing.java.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/ComponentStrongholdRoomCrossing.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/ComponentStrongholdRoomCrossing.java -@@ -8,6 +8,9 @@ - import net.minecraft.util.WeightedRandomChestContent; - import net.minecraft.world.World; - -+import net.minecraftforge.common.ChestGenHooks; -+import static net.minecraftforge.common.ChestGenHooks.*; -+ - public class ComponentStrongholdRoomCrossing extends ComponentStronghold - { - /** -@@ -158,7 +161,7 @@ - this.placeBlockAtCurrentPosition(par1World, Block.ladder.blockID, this.getMetadataWithOffset(Block.ladder.blockID, 4), 9, 1, 3, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.ladder.blockID, this.getMetadataWithOffset(Block.ladder.blockID, 4), 9, 2, 3, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.ladder.blockID, this.getMetadataWithOffset(Block.ladder.blockID, 4), 9, 3, 3, par3StructureBoundingBox); -- this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 3, 4, 8, WeightedRandomChestContent.func_92080_a(strongholdRoomCrossingChestContents, new WeightedRandomChestContent[] {Item.enchantedBook.func_92114_b(par2Random)}), 1 + par2Random.nextInt(4)); -+ this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 3, 4, 8, ChestGenHooks.getItems(STRONGHOLD_CROSSING, par2Random), ChestGenHooks.getCount(STRONGHOLD_CROSSING, par2Random)); - } - - return true; diff --git a/patches/minecraft/net/minecraft/world/gen/structure/ComponentVillage.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/ComponentVillage.java.patch deleted file mode 100644 index 1d530b2d5..000000000 --- a/patches/minecraft/net/minecraft/world/gen/structure/ComponentVillage.java.patch +++ /dev/null @@ -1,51 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/ComponentVillage.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/ComponentVillage.java -@@ -7,6 +7,10 @@ - import net.minecraft.nbt.NBTTagCompound; - import net.minecraft.world.World; - -+import net.minecraftforge.common.*; -+import net.minecraftforge.event.Event.*; -+import net.minecraftforge.event.terraingen.*; -+ - public abstract class ComponentVillage extends StructureComponent - { - protected int field_143015_k = -1; -@@ -14,6 +18,7 @@ - /** The number of villagers that have been spawned in this component. */ - private int villagersSpawned; - private boolean field_143014_b; -+ private ComponentVillageStartPiece startPiece; - - public ComponentVillage() {} - -@@ -24,6 +29,7 @@ - if (par1ComponentVillageStartPiece != null) - { - this.field_143014_b = par1ComponentVillageStartPiece.inDesert; -+ startPiece = par1ComponentVillageStartPiece; - } - } - -@@ -157,6 +163,10 @@ - */ - protected int getBiomeSpecificBlock(int par1, int par2) - { -+ BiomeEvent.GetVillageBlockID event = new BiomeEvent.GetVillageBlockID(startPiece == null ? null : startPiece.biome, par1, par2); -+ MinecraftForge.TERRAIN_GEN_BUS.post(event); -+ if (event.getResult() == Result.DENY) return event.replacement; -+ - if (this.field_143014_b) - { - if (par1 == Block.wood.blockID) -@@ -198,6 +208,10 @@ - */ - protected int getBiomeSpecificBlockMetadata(int par1, int par2) - { -+ BiomeEvent.GetVillageBlockMeta event = new BiomeEvent.GetVillageBlockMeta(startPiece == null ? null : startPiece.biome, par1, par2); -+ MinecraftForge.TERRAIN_GEN_BUS.post(event); -+ if (event.getResult() == Result.DENY) return event.replacement; -+ - if (this.field_143014_b) - { - if (par1 == Block.wood.blockID) diff --git a/patches/minecraft/net/minecraft/world/gen/structure/ComponentVillageHouse2.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/ComponentVillageHouse2.java.patch deleted file mode 100644 index 7e814c8f9..000000000 --- a/patches/minecraft/net/minecraft/world/gen/structure/ComponentVillageHouse2.java.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/ComponentVillageHouse2.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/ComponentVillageHouse2.java -@@ -8,6 +8,9 @@ - import net.minecraft.util.WeightedRandomChestContent; - import net.minecraft.world.World; - -+import net.minecraftforge.common.ChestGenHooks; -+import static net.minecraftforge.common.ChestGenHooks.*; -+ - public class ComponentVillageHouse2 extends ComponentVillage - { - /** List of items that Village's Blacksmith chest can contain. */ -@@ -106,7 +109,7 @@ - if (par3StructureBoundingBox.isVecInside(j, i, k)) - { - this.hasMadeChest = true; -- this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 5, 1, 5, villageBlacksmithChestContents, 3 + par2Random.nextInt(6)); -+ this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 5, 1, 5, ChestGenHooks.getItems(VILLAGE_BLACKSMITH, par2Random), ChestGenHooks.getCount(VILLAGE_BLACKSMITH, par2Random)); - } - } - diff --git a/patches/minecraft/net/minecraft/world/gen/structure/ComponentVillageStartPiece.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/ComponentVillageStartPiece.java.patch deleted file mode 100644 index 24c5e1a0a..000000000 --- a/patches/minecraft/net/minecraft/world/gen/structure/ComponentVillageStartPiece.java.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/ComponentVillageStartPiece.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/ComponentVillageStartPiece.java -@@ -12,6 +12,7 @@ - - /** Boolean that determines if the village is in a desert or not. */ - public boolean inDesert; -+ public BiomeGenBase biome; - - /** World terrain type, 0 for normal, 1 for flap map */ - public int terrainType; -@@ -35,6 +36,7 @@ - this.terrainType = par7; - BiomeGenBase biomegenbase = par1WorldChunkManager.getBiomeGenAt(par4, par5); - this.inDesert = biomegenbase == BiomeGenBase.desert || biomegenbase == BiomeGenBase.desertHills; -+ this.biome = biomegenbase; - } - - public WorldChunkManager getWorldChunkManager() diff --git a/patches/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch deleted file mode 100644 index f502fd946..000000000 --- a/patches/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch +++ /dev/null @@ -1,36 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java -@@ -1,6 +1,7 @@ - package net.minecraft.world.gen.structure; - - import java.util.ArrayList; -+import java.util.Arrays; - import java.util.Collections; - import java.util.Iterator; - import java.util.List; -@@ -14,6 +15,7 @@ - - public class MapGenStronghold extends MapGenStructure - { -+ public static ArrayList allowedBiomes = new ArrayList(Arrays.asList(BiomeGenBase.desert, BiomeGenBase.forest, BiomeGenBase.extremeHills, BiomeGenBase.swampland, BiomeGenBase.taiga, BiomeGenBase.icePlains, BiomeGenBase.iceMountains, BiomeGenBase.desertHills, BiomeGenBase.forestHills, BiomeGenBase.extremeHillsEdge, BiomeGenBase.jungle, BiomeGenBase.jungleHills)); - private BiomeGenBase[] allowedBiomeGenBases; - - /** -@@ -26,7 +28,7 @@ - - public MapGenStronghold() - { -- this.allowedBiomeGenBases = new BiomeGenBase[] {BiomeGenBase.desert, BiomeGenBase.forest, BiomeGenBase.extremeHills, BiomeGenBase.swampland, BiomeGenBase.taiga, BiomeGenBase.icePlains, BiomeGenBase.iceMountains, BiomeGenBase.desertHills, BiomeGenBase.forestHills, BiomeGenBase.extremeHillsEdge, BiomeGenBase.jungle, BiomeGenBase.jungleHills}; -+ this.allowedBiomeGenBases = allowedBiomes.toArray(new BiomeGenBase[0]); - this.structureCoords = new ChunkCoordIntPair[3]; - this.field_82671_h = 32.0D; - this.field_82672_i = 3; -@@ -34,7 +36,7 @@ - - public MapGenStronghold(Map par1Map) - { -- this.allowedBiomeGenBases = new BiomeGenBase[] {BiomeGenBase.desert, BiomeGenBase.forest, BiomeGenBase.extremeHills, BiomeGenBase.swampland, BiomeGenBase.taiga, BiomeGenBase.icePlains, BiomeGenBase.iceMountains, BiomeGenBase.desertHills, BiomeGenBase.forestHills, BiomeGenBase.extremeHillsEdge, BiomeGenBase.jungle, BiomeGenBase.jungleHills}; -+ this.allowedBiomeGenBases = allowedBiomes.toArray(new BiomeGenBase[0]); - this.structureCoords = new ChunkCoordIntPair[3]; - this.field_82671_h = 32.0D; - this.field_82672_i = 3; diff --git a/patches/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch index bc1f969ad..de906f0ef 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java +++ ../src-work/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java -@@ -234,12 +234,12 @@ +@@ -243,12 +243,12 @@ { if (this.field_143029_e == null) { diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch index 81fa95c1b..7304acc0f 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch @@ -1,14 +1,13 @@ --- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureComponent.java +++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureComponent.java -@@ -35,6 +35,11 @@ +@@ -36,6 +36,10 @@ public NBTTagCompound func_143010_b() { -+ if (MapGenStructureIO.func_143036_a(this) == null) ++ if (MapGenStructureIO.func_143036_a(this) == null) // Friendlier error then the Null Stirng 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_143047_a("BB")); + nbttagcompound.setTag("BB", this.boundingBox.func_151535_h()); diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch new file mode 100644 index 000000000..53e4cedac --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch @@ -0,0 +1,30 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java ++++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java +@@ -16,6 +16,9 @@ + import net.minecraft.util.WeightedRandomChestContent; + import net.minecraft.world.World; + ++import net.minecraftforge.common.ChestGenHooks; ++import static net.minecraftforge.common.ChestGenHooks.*; ++ + public class StructureMineshaftPieces + { + // JAVADOC FIELD $$ field_78818_a +@@ -664,14 +667,15 @@ + this.func_151552_a(par1World, par3StructureBoundingBox, par2Random, 0.05F, 1, 2, k - 1, Blocks.torch, 0); + this.func_151552_a(par1World, par3StructureBoundingBox, par2Random, 0.05F, 1, 2, k + 1, Blocks.torch, 0); + ++ ChestGenHooks info = ChestGenHooks.getInfo(MINESHAFT_CORRIDOR); + if (par2Random.nextInt(100) == 0) + { +- this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 2, 0, k - 1, WeightedRandomChestContent.func_92080_a(StructureMineshaftPieces.mineshaftChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.func_92114_b(par2Random)}), 3 + par2Random.nextInt(4)); ++ this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 2, 0, k - 1, info.getItems(par2Random), info.getCount(par2Random)); + } + + if (par2Random.nextInt(100) == 0) + { +- this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 0, 0, k + 1, WeightedRandomChestContent.func_92080_a(StructureMineshaftPieces.mineshaftChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.func_92114_b(par2Random)}), 3 + par2Random.nextInt(4)); ++ this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 0, 0, k + 1, info.getItems(par2Random), info.getCount(par2Random)); + } + + if (this.hasSpiders && !this.spawnerPlaced) diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch index 2d99017dc..d46f81090 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch @@ -1,14 +1,13 @@ --- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureStart.java +++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureStart.java -@@ -68,6 +68,11 @@ +@@ -65,6 +65,10 @@ public NBTTagCompound func_143021_a(int par1, int par2) { -+ if (MapGenStructureIO.func_143033_a(this) == null) ++ 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", par1); diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch new file mode 100644 index 000000000..7457c4da8 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch @@ -0,0 +1,47 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java ++++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java +@@ -12,6 +12,9 @@ + import net.minecraft.world.ChunkPosition; + import net.minecraft.world.World; + ++import net.minecraftforge.common.ChestGenHooks; ++import static net.minecraftforge.common.ChestGenHooks.*; ++ + public class StructureStrongholdPieces + { + private static final StructureStrongholdPieces.PieceWeight[] pieceWeightArray = new StructureStrongholdPieces.PieceWeight[] {new StructureStrongholdPieces.PieceWeight(StructureStrongholdPieces.Straight.class, 40, 0), new StructureStrongholdPieces.PieceWeight(StructureStrongholdPieces.Prison.class, 5, 5), new StructureStrongholdPieces.PieceWeight(StructureStrongholdPieces.LeftTurn.class, 20, 0), new StructureStrongholdPieces.PieceWeight(StructureStrongholdPieces.RightTurn.class, 20, 0), new StructureStrongholdPieces.PieceWeight(StructureStrongholdPieces.RoomCrossing.class, 10, 6), new StructureStrongholdPieces.PieceWeight(StructureStrongholdPieces.StairsStraight.class, 5, 5), new StructureStrongholdPieces.PieceWeight(StructureStrongholdPieces.Stairs.class, 5, 5), new StructureStrongholdPieces.PieceWeight(StructureStrongholdPieces.Crossing.class, 5, 4), new StructureStrongholdPieces.PieceWeight(StructureStrongholdPieces.ChestCorridor.class, 5, 4), new StructureStrongholdPieces.PieceWeight(StructureStrongholdPieces.Library.class, 10, 2) +@@ -573,12 +576,14 @@ + this.func_151550_a(par1World, Blocks.torch, 0, b1, 8, b2 + 1, par3StructureBoundingBox); + } + +- this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 3, 3, 5, WeightedRandomChestContent.func_92080_a(strongholdLibraryChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.func_92112_a(par2Random, 1, 5, 2)}), 1 + par2Random.nextInt(4)); ++ ChestGenHooks info = ChestGenHooks.getInfo(STRONGHOLD_LIBRARY); + ++ this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 3, 3, 5, info.getItems(par2Random), info.getCount(par2Random)); ++ + if (this.isLargeRoom) + { + this.func_151550_a(par1World, Blocks.air, 0, 12, 9, 1, par3StructureBoundingBox); +- this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 12, 8, 1, WeightedRandomChestContent.func_92080_a(strongholdLibraryChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.func_92112_a(par2Random, 1, 5, 2)}), 1 + par2Random.nextInt(4)); ++ this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 12, 8, 1, info.getItems(par2Random), info.getCount(par2Random)); + } + + return true; +@@ -806,7 +811,7 @@ + if (par3StructureBoundingBox.isVecInside(j, i, k)) + { + this.hasMadeChest = true; +- this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 3, 2, 3, WeightedRandomChestContent.func_92080_a(strongholdChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.func_92114_b(par2Random)}), 2 + par2Random.nextInt(2)); ++ this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 3, 2, 3, ChestGenHooks.getItems(STRONGHOLD_CORRIDOR, par2Random), ChestGenHooks.getCount(STRONGHOLD_CORRIDOR, par2Random)); + } + } + +@@ -960,7 +965,7 @@ + this.func_151550_a(par1World, Blocks.ladder, this.func_151555_a(Blocks.ladder, 4), 9, 1, 3, par3StructureBoundingBox); + this.func_151550_a(par1World, Blocks.ladder, this.func_151555_a(Blocks.ladder, 4), 9, 2, 3, par3StructureBoundingBox); + this.func_151550_a(par1World, Blocks.ladder, this.func_151555_a(Blocks.ladder, 4), 9, 3, 3, par3StructureBoundingBox); +- this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 3, 4, 8, WeightedRandomChestContent.func_92080_a(strongholdRoomCrossingChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.func_92114_b(par2Random)}), 1 + par2Random.nextInt(4)); ++ this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 3, 4, 8, ChestGenHooks.getItems(STRONGHOLD_CROSSING, par2Random), ChestGenHooks.getCount(STRONGHOLD_CROSSING, par2Random)); + } + + return true; diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch new file mode 100644 index 000000000..ef9791dd5 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch @@ -0,0 +1,83 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java ++++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java +@@ -4,7 +4,7 @@ + import java.util.Iterator; + import java.util.List; + import java.util.Random; +- ++import cpw.mods.fml.common.eventhandler.Event.Result; + import cpw.mods.fml.common.registry.VillagerRegistry; + import net.minecraft.block.Block; + import net.minecraft.block.material.Material; +@@ -18,6 +18,10 @@ + import net.minecraft.world.World; + import net.minecraft.world.biome.BiomeGenBase; + import net.minecraft.world.biome.WorldChunkManager; ++import net.minecraftforge.common.ChestGenHooks; ++import net.minecraftforge.common.MinecraftForge; ++import net.minecraftforge.event.terraingen.BiomeEvent; ++import static net.minecraftforge.common.ChestGenHooks.*; + + public class StructureVillagePieces + { +@@ -351,6 +355,7 @@ + private int villagersSpawned; + private boolean field_143014_b; + private static final String __OBFID = "CL_00000531"; ++ private StructureVillagePieces.Start startPiece; + + public Village() {} + +@@ -361,6 +366,7 @@ + if (par1ComponentVillageStartPiece != null) + { + this.field_143014_b = par1ComponentVillageStartPiece.inDesert; ++ startPiece = par1ComponentVillageStartPiece; + } + } + +@@ -479,6 +485,9 @@ + + protected Block func_151558_b(Block p_151558_1_, int p_151558_2_) + { ++ BiomeEvent.GetVillageBlockID event = new BiomeEvent.GetVillageBlockID(startPiece == null ? null : startPiece.biome, p_151558_1_, p_151558_2_); ++ MinecraftForge.TERRAIN_GEN_BUS.post(event); ++ if (event.getResult() == Result.DENY) return event.replacement; + if (this.field_143014_b) + { + if (p_151558_1_ == Blocks.log || p_151558_1_ == Blocks.log2) +@@ -517,6 +526,9 @@ + + protected int func_151557_c(Block p_151557_1_, int p_151557_2_) + { ++ BiomeEvent.GetVillageBlockMeta event = new BiomeEvent.GetVillageBlockMeta(startPiece == null ? null : startPiece.biome, p_151557_1_, p_151557_2_); ++ MinecraftForge.TERRAIN_GEN_BUS.post(event); ++ if (event.getResult() == Result.DENY) return event.replacement; + if (this.field_143014_b) + { + if (p_151557_1_ == Blocks.log || p_151557_1_ == Blocks.log2) +@@ -1286,7 +1298,7 @@ + if (par3StructureBoundingBox.isVecInside(j, i, k)) + { + this.hasMadeChest = true; +- this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 5, 1, 5, villageBlacksmithChestContents, 3 + par2Random.nextInt(6)); ++ this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 5, 1, 5, ChestGenHooks.getItems(VILLAGE_BLACKSMITH, par2Random), ChestGenHooks.getCount(VILLAGE_BLACKSMITH, par2Random)); + } + } + +@@ -1331,6 +1343,7 @@ + public List field_74932_i = new ArrayList(); + public List field_74930_j = new ArrayList(); + private static final String __OBFID = "CL_00000527"; ++ public BiomeGenBase biome; + + public Start() {} + +@@ -1342,6 +1355,7 @@ + this.terrainType = par7; + BiomeGenBase biomegenbase = par1WorldChunkManager.getBiomeGenAt(par4, par5); + this.inDesert = biomegenbase == BiomeGenBase.desert || biomegenbase == BiomeGenBase.desertHills; ++ this.biome = biomegenbase; + } + + public WorldChunkManager getWorldChunkManager() diff --git a/patches/minecraft/net/minecraft/world/storage/MapData.java.patch b/patches/minecraft/net/minecraft/world/storage/MapData.java.patch index 9515e29c7..692eece4b 100644 --- a/patches/minecraft/net/minecraft/world/storage/MapData.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/MapData.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/world/storage/MapData.java +++ ../src-work/minecraft/net/minecraft/world/storage/MapData.java -@@ -173,7 +173,7 @@ +@@ -162,7 +162,7 @@ par8 += par8 < 0.0D ? -8.0D : 8.0D; - b3 = (byte)((int)(par8 * 16.0D / 360.0D)); + b2 = (byte)((int)(par8 * 16.0D / 360.0D)); - if (this.dimension < 0) + if (par2World.provider.shouldMapSpin(par3Str, par4, par6, par8)) { int k = (int)(par2World.getWorldInfo().getWorldTime() / 10L); - b3 = (byte)(k * k * 34187121 + k * 121 >> 15 & 15); + b2 = (byte)(k * k * 34187121 + k * 121 >> 15 & 15); diff --git a/src/main/java/net/minecraftforge/classloading/FMLForgePlugin.java b/src/main/java/net/minecraftforge/classloading/FMLForgePlugin.java index 4a4f73835..35e0cdf68 100644 --- a/src/main/java/net/minecraftforge/classloading/FMLForgePlugin.java +++ b/src/main/java/net/minecraftforge/classloading/FMLForgePlugin.java @@ -13,10 +13,7 @@ public class FMLForgePlugin implements IFMLLoadingPlugin @Override public String[] getASMTransformerClass() { - return new String[]{ - "net.minecraftforge.transformers.ForgeAccessTransformer", - "net.minecraftforge.transformers.EventTransformer" - }; + return new String[0]; } @Override @@ -37,4 +34,10 @@ public class FMLForgePlugin implements IFMLLoadingPlugin RUNTIME_DEOBF = (Boolean)data.get("runtimeDeobfuscationEnabled"); forgeLocation = (File)data.get("coremodLocation"); } + + @Override + public String getAccessTransformerClass() + { + return "net.minecraftforge.transformers.ForgeAccessTransformer"; + } } diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 4aa611643..10266a2d5 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -18,9 +18,9 @@ import org.lwjgl.opengl.PixelFormat; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.registry.RenderingRegistry; +import cpw.mods.fml.common.FMLLog; import net.minecraft.client.Minecraft; import net.minecraft.block.Block; -import net.minecraft.block.BlockFluid; import net.minecraft.block.BlockLiquid; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.Entity; @@ -28,19 +28,23 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; +import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.client.model.ModelBiped; +import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.RenderGlobal; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.settings.GameSettings; import net.minecraftforge.client.IItemRenderer.ItemRenderType; import net.minecraftforge.client.event.DrawBlockHighlightEvent; import net.minecraftforge.client.event.RenderWorldLastEvent; @@ -67,7 +71,7 @@ public class ForgeHooksClient return result != null ? result : _default; } - public static boolean renderEntityItem(EntityItem entity, ItemStack item, float bobing, float rotation, Random random, TextureManager engine, RenderBlocks renderBlocks) + public static boolean renderEntityItem(EntityItem entity, ItemStack item, float bobing, float rotation, Random random, TextureManager engine, RenderBlocks renderBlocks, int count) { IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(item, ENTITY); if (customRenderer == null) @@ -86,11 +90,12 @@ public class ForgeHooksClient boolean is3D = customRenderer.shouldUseRenderHelper(ENTITY, item, BLOCK_3D); engine.bindTexture(item.getItemSpriteNumber() == 0 ? TextureMap.locationBlocksTexture : TextureMap.locationItemsTexture); - Block block = (item.itemID < Block.blocksList.length ? Block.blocksList[item.itemID] : null); - if (is3D || (block != null && RenderBlocks.renderItemIn3d(block.getRenderType()))) + Block block = item.getItem() instanceof ItemBlock ? Block.func_149634_a(item.getItem()) : null; + if (is3D || (block != null && RenderBlocks.func_147739_a(block.func_149645_b()))) { - int renderType = (block != null ? block.getRenderType() : 1); + int renderType = (block != null ? block.func_149645_b() : 1); float scale = (renderType == 1 || renderType == 19 || renderType == 12 || renderType == 2 ? 0.5F : 0.25F); + boolean blend = block != null && block.func_149701_w() > 0; if (RenderItem.renderInFrame) { @@ -99,10 +104,14 @@ public class ForgeHooksClient GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); } - GL11.glScalef(scale, scale, scale); + if (blend) + { + GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); + GL11.glEnable(GL11.GL_BLEND); + OpenGlHelper.func_148821_a(770, 771, 1, 0); + } - int size = item.stackSize; - int count = (size > 40 ? 5 : (size > 20 ? 4 : (size > 5 ? 3 : (size > 1 ? 2 : 1)))); + GL11.glScalef(scale, scale, scale); for(int j = 0; j < count; j++) { @@ -117,6 +126,11 @@ public class ForgeHooksClient customRenderer.renderItem(ENTITY, item, renderBlocks, entity); GL11.glPopMatrix(); } + + if (blend) + { + GL11.glDisable(GL11.GL_BLEND); + } } else { @@ -147,7 +161,7 @@ public class ForgeHooksClient if(inColor) { - int color = Item.itemsList[item.itemID].getColorFromItemStack(item, 0); + int color = item.getItem().getColorFromItemStack(item, 0); float r = (float)(color >> 16 & 0xff) / 255F; float g = (float)(color >> 8 & 0xff) / 255F; float b = (float)(color & 0xff) / 255F; @@ -155,9 +169,9 @@ public class ForgeHooksClient } GL11.glRotatef(-90F, 0.0F, 1.0F, 0.0F); - renderBlocks.useInventoryTint = inColor; + renderBlocks.field_147844_c = inColor; customRenderer.renderItem(INVENTORY, item, renderBlocks); - renderBlocks.useInventoryTint = true; + renderBlocks.field_147844_c = true; GL11.glPopMatrix(); } else @@ -168,7 +182,7 @@ public class ForgeHooksClient if (inColor) { - int color = Item.itemsList[item.itemID].getColorFromItemStack(item, 0); + int color = item.getItem().getColorFromItemStack(item, 0); float r = (float)(color >> 16 & 255) / 255.0F; float g = (float)(color >> 8 & 255) / 255.0F; float b = (float)(color & 255) / 255.0F; @@ -223,8 +237,7 @@ public class ForgeHooksClient if (block != null && block.isBed(mc.theWorld, x, y, z, entity)) { - int var12 = block.getBedDirection(mc.theWorld, x, y, z); - GL11.glRotatef((float)(var12 * 90), 0.0F, 1.0F, 0.0F); + GL11.glRotatef((float)(block.getBedDirection(mc.theWorld, x, y, z) * 90), 0.0F, 1.0F, 0.0F); } } @@ -259,8 +272,7 @@ public class ForgeHooksClient { if (Tessellator.renderingWorldRenderer) { - String msg = String.format("Warning: Texture %s not preloaded, will cause render glitches!", texture); - System.out.println(msg); + FMLLog.warning("Warning: Texture %s not preloaded, will cause render glitches!", texture); if (Tessellator.class.getPackage() != null) { if (Tessellator.class.getPackage().getName().startsWith("net.minecraft.")) @@ -268,7 +280,7 @@ public class ForgeHooksClient Minecraft mc = FMLClientHandler.instance().getClient(); if (mc.ingameGUI != null) { - mc.ingameGUI.getChatGUI().printChatMessage(msg); + mc.ingameGUI.func_146158_b().func_146227_a(new ChatComponentTranslation("forge.texture.preload.warning", texture)); } } } @@ -350,8 +362,14 @@ public class ForgeHooksClient return skyRGBMultiplier; } skyInit = true; - - int distance = Minecraft.getMinecraft().gameSettings.fancyGraphics ? ForgeModContainer.blendRanges[Minecraft.getMinecraft().gameSettings.renderDistance] : 0; + + GameSettings settings = Minecraft.getMinecraft().gameSettings; + int[] ranges = ForgeModContainer.blendRanges; + int distance = 0; + if (settings.fancyGraphics && settings.field_151451_c >= 0 && settings.field_151451_c < ranges.length) + { + distance = ranges[settings.field_151451_c]; + } int r = 0; int g = 0; @@ -383,7 +401,7 @@ public class ForgeHooksClient */ static { - FluidRegistry.renderIdFluid = RenderingRegistry.getNextAvailableRenderId(); - RenderingRegistry.registerBlockHandler(RenderBlockFluid.instance); + //FluidRegistry.renderIdFluid = RenderingRegistry.getNextAvailableRenderId(); + //RenderingRegistry.registerBlockHandler(RenderBlockFluid.instance); } } diff --git a/src/main/java/net/minecraftforge/client/MinecraftForgeClient.java b/src/main/java/net/minecraftforge/client/MinecraftForgeClient.java index 585d8da8c..4a114ad4b 100644 --- a/src/main/java/net/minecraftforge/client/MinecraftForgeClient.java +++ b/src/main/java/net/minecraftforge/client/MinecraftForgeClient.java @@ -6,9 +6,12 @@ package net.minecraftforge.client; import java.util.BitSet; +import java.util.IdentityHashMap; import org.lwjgl.opengl.Display; +import com.google.common.collect.Maps; + import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.item.Item; @@ -20,7 +23,7 @@ import net.minecraftforge.common.MinecraftForge; public class MinecraftForgeClient { - private static IItemRenderer[] customItemRenderers = new IItemRenderer[Item.itemsList.length]; + private static IdentityHashMap customItemRenderers = Maps.newIdentityHashMap(); /** * Register a custom renderer for a specific item. This can be used to @@ -30,17 +33,17 @@ public class MinecraftForgeClient * @param renderer The IItemRenderer interface that handles rendering for * this item. */ - public static void registerItemRenderer(int itemID, IItemRenderer renderer) + public static void registerItemRenderer(Item item, IItemRenderer renderer) { - customItemRenderers[itemID] = renderer; + customItemRenderers.put(item, renderer); } public static IItemRenderer getItemRenderer(ItemStack item, ItemRenderType type) { - IItemRenderer renderer = customItemRenderers[item.itemID]; + IItemRenderer renderer = customItemRenderers.get(item); if (renderer != null && renderer.handleRenderType(item, type)) { - return customItemRenderers[item.itemID]; + return renderer; } return null; } diff --git a/src/main/java/net/minecraftforge/client/event/ClientChatReceivedEvent.java b/src/main/java/net/minecraftforge/client/event/ClientChatReceivedEvent.java index 0711dd0fa..acb7c1d05 100644 --- a/src/main/java/net/minecraftforge/client/event/ClientChatReceivedEvent.java +++ b/src/main/java/net/minecraftforge/client/event/ClientChatReceivedEvent.java @@ -1,13 +1,14 @@ package net.minecraftforge.client.event; +import net.minecraft.util.IChatComponent; import cpw.mods.fml.common.eventhandler.Cancelable; import cpw.mods.fml.common.eventhandler.Event; @Cancelable public class ClientChatReceivedEvent extends Event { - public String message; - public ClientChatReceivedEvent(String message) + public IChatComponent message; + public ClientChatReceivedEvent(IChatComponent message) { this.message = message; } diff --git a/src/main/java/net/minecraftforge/common/BiomeDictionary.java b/src/main/java/net/minecraftforge/common/BiomeDictionary.java index 76e58b362..36f7772ad 100644 --- a/src/main/java/net/minecraftforge/common/BiomeDictionary.java +++ b/src/main/java/net/minecraftforge/common/BiomeDictionary.java @@ -213,7 +213,7 @@ public class BiomeDictionary if (biome.theBiomeDecorator instanceof DeferredBiomeDecorator) { DeferredBiomeDecorator decorator = (DeferredBiomeDecorator) biome.theBiomeDecorator; - decorator.fireCreateEventAndReplace(); + decorator.fireCreateEventAndReplace(biome); } checkRegistration(biome); diff --git a/src/main/java/net/minecraftforge/common/BiomeManager.java b/src/main/java/net/minecraftforge/common/BiomeManager.java index 5b88686bc..08a168c62 100644 --- a/src/main/java/net/minecraftforge/common/BiomeManager.java +++ b/src/main/java/net/minecraftforge/common/BiomeManager.java @@ -38,17 +38,17 @@ public class BiomeManager public static void addStrongholdBiome(BiomeGenBase biome) { - if (!MapGenStronghold.allowedBiomes.contains(biome)) + if (!MapGenStronghold.field_151546_e.contains(biome)) { - MapGenStronghold.allowedBiomes.add(biome); + MapGenStronghold.field_151546_e.add(biome); } } public static void removeStrongholdBiome(BiomeGenBase biome) { - if (MapGenStronghold.allowedBiomes.contains(biome)) + if (MapGenStronghold.field_151546_e.contains(biome)) { - MapGenStronghold.allowedBiomes.remove(biome); + MapGenStronghold.field_151546_e.remove(biome); } } diff --git a/src/main/java/net/minecraftforge/common/BlockExtension.java b/src/main/java/net/minecraftforge/common/BlockExtension.java deleted file mode 100644 index 8f1bf2410..000000000 --- a/src/main/java/net/minecraftforge/common/BlockExtension.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.minecraftforge.common; - -import net.minecraft.block.Block; - -public class BlockExtension -{ - /** - * The Block that this extension object is associated with - */ - public final Block owner; - - /** - * Determines wither or not a enderman can pickup and move this block. - */ - public boolean carriable = false; - - public BlockExtension(Block owner) - { - if (MinecraftForge.getBlockExtension(owner, false) != null) - { - throw new IllegalArgumentException(owner + " already has an extension object allocated"); - } - - this.owner = owner; - } -} diff --git a/src/main/java/net/minecraftforge/common/DimensionManager.java b/src/main/java/net/minecraftforge/common/DimensionManager.java index 8ea678586..116583a62 100644 --- a/src/main/java/net/minecraftforge/common/DimensionManager.java +++ b/src/main/java/net/minecraftforge/common/DimensionManager.java @@ -12,7 +12,8 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.concurrent.ConcurrentMap; -import java.util.logging.Level; + +import org.apache.logging.log4j.Level; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.HashMultiset; @@ -26,7 +27,6 @@ import com.google.common.collect.Sets; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLLog; - import net.minecraft.nbt.NBTTagCompound; import net.minecraft.server.MinecraftServer; import net.minecraft.world.ChunkCoordIntPair; @@ -251,7 +251,7 @@ public class DimensionManager ISaveHandler savehandler = overworld.getSaveHandler(); WorldSettings worldSettings = new WorldSettings(overworld.getWorldInfo()); - WorldServer world = (dim == 0 ? overworld : new WorldServerMulti(mcServer, savehandler, overworld.getWorldInfo().getWorldName(), dim, worldSettings, overworld, mcServer.theProfiler, overworld.getWorldLogAgent())); + WorldServer world = (dim == 0 ? overworld : new WorldServerMulti(mcServer, savehandler, overworld.getWorldInfo().getWorldName(), dim, worldSettings, overworld, mcServer.theProfiler)); world.addWorldAccess(new WorldManager(mcServer, world)); MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(world)); if (!mcServer.isSinglePlayer()) @@ -259,7 +259,7 @@ public class DimensionManager world.getWorldInfo().setGameType(mcServer.getGameType()); } - mcServer.setDifficultyForAllWorlds(mcServer.getDifficulty()); + mcServer.func_147139_a(mcServer.func_147135_j()); } public static WorldServer getWorld(int id) @@ -308,7 +308,7 @@ public class DimensionManager } catch (Exception e) { - FMLCommonHandler.instance().getFMLLogger().log(Level.SEVERE,String.format("An error occured trying to create an instance of WorldProvider %d (%s)", + FMLCommonHandler.instance().getFMLLogger().log(Level.ERROR, String.format("An error occured trying to create an instance of WorldProvider %d (%s)", dim, providers.get(getProviderType(dim)).getSimpleName()),e); throw new RuntimeException(e); } diff --git a/src/main/java/net/minecraftforge/common/ForgeChunkManager.java b/src/main/java/net/minecraftforge/common/ForgeChunkManager.java index d4c48fb75..3aef2d3e3 100644 --- a/src/main/java/net/minecraftforge/common/ForgeChunkManager.java +++ b/src/main/java/net/minecraftforge/common/ForgeChunkManager.java @@ -11,7 +11,8 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.UUID; -import java.util.logging.Level; + +import org.apache.logging.log4j.Level; import com.google.common.base.Supplier; import com.google.common.base.Suppliers; @@ -219,7 +220,7 @@ public class ForgeChunkManager } else { - FMLLog.log(Level.SEVERE, "Attempt to create a player ticket without a valid player"); + FMLLog.log(Level.ERROR, "Attempt to create a player ticket without a valid player"); throw new RuntimeException(); } } @@ -422,7 +423,7 @@ public class ForgeChunkManager } catch (IOException e) { - FMLLog.log(Level.WARNING, e, "Unable to read forced chunk data at %s - it will be ignored", chunkLoaderData.getAbsolutePath()); + FMLLog.log(Level.WARN, e, "Unable to read forced chunk data at %s - it will be ignored", chunkLoaderData.getAbsolutePath()); return; } NBTTagList ticketList = forcedChunkData.func_150295_c("TicketList", 9); @@ -628,7 +629,7 @@ public class ForgeChunkManager ModContainer mc = getContainer(mod); if (mc == null) { - FMLLog.log(Level.SEVERE, "Failed to locate the container for mod instance %s (%s : %x)", mod, mod.getClass().getName(), System.identityHashCode(mod)); + FMLLog.log(Level.ERROR, "Failed to locate the container for mod instance %s (%s : %x)", mod, mod.getClass().getName(), System.identityHashCode(mod)); return null; } if (playerTickets.get(player).size()>playerTicketLength) @@ -654,7 +655,7 @@ public class ForgeChunkManager ModContainer container = getContainer(mod); if (container == null) { - FMLLog.log(Level.SEVERE, "Failed to locate the container for mod instance %s (%s : %x)", mod, mod.getClass().getName(), System.identityHashCode(mod)); + FMLLog.log(Level.ERROR, "Failed to locate the container for mod instance %s (%s : %x)", mod, mod.getClass().getName(), System.identityHashCode(mod)); return null; } String modId = container.getModId(); @@ -874,7 +875,7 @@ public class ForgeChunkManager } catch (IOException e) { - FMLLog.log(Level.WARNING, e, "Unable to write forced chunk data to %s - chunkloading won't work", chunkLoaderData.getAbsolutePath()); + FMLLog.log(Level.WARN, e, "Unable to write forced chunk data to %s - chunkloading won't work", chunkLoaderData.getAbsolutePath()); return; } } @@ -936,7 +937,7 @@ public class ForgeChunkManager dest.delete(); } cfgFile.renameTo(dest); - FMLLog.log(Level.SEVERE, e, "A critical error occured reading the forgeChunkLoading.cfg file, defaults will be used - the invalid file is backed up at forgeChunkLoading.cfg.bak"); + FMLLog.log(Level.ERROR, e, "A critical error occured reading the forgeChunkLoading.cfg file, defaults will be used - the invalid file is backed up at forgeChunkLoading.cfg.bak"); } config.addCustomCategoryComment("defaults", "Default configuration for forge chunk loading control"); Property maxTicketCount = config.get("defaults", "maximumTicketCount", 200); diff --git a/src/main/java/net/minecraftforge/common/ForgeHooks.java b/src/main/java/net/minecraftforge/common/ForgeHooks.java index aad0af043..b809c06a3 100644 --- a/src/main/java/net/minecraftforge/common/ForgeHooks.java +++ b/src/main/java/net/minecraftforge/common/ForgeHooks.java @@ -5,11 +5,13 @@ import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Random; import java.util.Set; import cpw.mods.fml.common.eventhandler.Event; import cpw.mods.fml.relauncher.ReflectionHelper; import net.minecraft.block.Block; +import net.minecraft.block.BlockFlower; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; @@ -22,18 +24,25 @@ import net.minecraft.inventory.Container; import net.minecraft.item.Item; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemAxe; +import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemSpade; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; +import net.minecraft.network.NetHandlerPlayServer; import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S23PacketBlockChange; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.MovingObjectPosition.MovingObjectType; import net.minecraft.util.WeightedRandom; import net.minecraft.world.World; +import net.minecraft.world.WorldSettings.GameType; +import net.minecraft.world.biome.BiomeGenBase; import net.minecraftforge.event.ForgeEventFactory; import net.minecraftforge.event.ServerChatEvent; import net.minecraftforge.event.entity.item.ItemTossEvent; @@ -47,6 +56,7 @@ import net.minecraftforge.event.entity.living.LivingHurtEvent; import net.minecraftforge.event.entity.living.LivingSetAttackTargetEvent; import net.minecraftforge.event.entity.player.PlayerOpenContainerEvent; import net.minecraftforge.event.world.BlockEvent; +import static net.minecraft.init.Blocks.*; public class ForgeHooks { @@ -74,14 +84,21 @@ public class ForgeHooks static final List grassList = new ArrayList(); static final List seedList = new ArrayList(); - public static void plantGrass(World world, int x, int y, int z) + public static void plantGrass(World world, Random rand, int x, int y, int z) { + BiomeGenBase biome = world.getBiomeGenForCoords(x, z); + String flowername = biome.func_150572_a(rand, x, y, z); + + /* + field_149992_a.debug("Flower in " + p_149853_1_.getBiomeGenForCoords(i1, k1).biomeName + ": " + s); + BlockFlower blockflower = BlockFlower.func_149857_e(s); + */ GrassEntry grass = (GrassEntry)WeightedRandom.getRandomItem(world.rand, grassList); - if (grass == null || grass.block == null || !grass.block.canBlockStay(world, x, y, z)) + if (grass == null || grass.block == null || !grass.block.func_149718_j(world, x, y, z)) { return; } - world.setBlock(x, y, z, grass.block, grass.metadata, 3); + world.func_147465_d(x, y, z, grass.block, grass.metadata, 3); } public static ItemStack getGrassSeed(World world) @@ -95,64 +112,42 @@ public class ForgeHooks } private static boolean toolInit = false; - static HashMap toolClasses = new HashMap(); - static HashMap toolHarvestLevels = new HashMap(); static HashSet toolEffectiveness = new HashSet(); public static boolean canHarvestBlock(Block block, EntityPlayer player, int metadata) { - if (block.blockMaterial.isToolNotRequired()) + if (block.func_149688_o().isToolNotRequired()) { return true; } ItemStack stack = player.inventory.getCurrentItem(); - if (stack == null) + String tool = block.getHarvestTool(metadata); + if (stack == null || tool == null) { - return player.canHarvestBlock(block); + return player.func_146099_a(block); } - List info = toolClasses.get(stack.getItem()); - if (info == null) + int toolLevel = stack.getItem().getHarvestLevel(stack, tool); + if (toolLevel < 0) { - return player.canHarvestBlock(block); + return player.func_146099_a(block); } - Object[] tmp = info.toArray(); - String toolClass = (String)tmp[0]; - int harvestLevel = (Integer)tmp[1]; - - Integer blockHarvestLevel = toolHarvestLevels.get(Arrays.asList(block, metadata, toolClass)); - if (blockHarvestLevel == null) - { - return player.canHarvestBlock(block); - } - - if (blockHarvestLevel > harvestLevel) - { - return false; - } - return true; + return toolLevel >= block.getHarvestLevel(metadata); } public static boolean canToolHarvestBlock(Block block, int metadata, ItemStack stack) { - if (stack == null) return false; - List info = toolClasses.get(stack.getItem()); - if (info == null) return false; - - Object[] tmp = info.toArray(); - String toolClass = (String)tmp[0]; - int harvestLevel = (Integer)tmp[1]; - - Integer blockHarvestLevel = toolHarvestLevels.get(Arrays.asList(block, metadata, toolClass)); - return !(blockHarvestLevel == null || blockHarvestLevel > harvestLevel); + String tool = block.getHarvestTool(metadata); + if (stack == null || tool == null) return false; + return stack.getItem().getHarvestLevel(stack, tool) >= block.getHarvestLevel(metadata); } public static float blockStrength(Block block, EntityPlayer player, World world, int x, int y, int z) { int metadata = world.getBlockMetadata(x, y, z); - float hardness = block.getBlockHardness(world, x, y, z); + float hardness = block.func_149712_f(world, x, y, z); if (hardness < 0.0F) { return 0.0F; @@ -160,19 +155,22 @@ public class ForgeHooks if (!canHarvestBlock(block, player, metadata)) { - float speed = ForgeEventFactory.getBreakSpeed(player, block, metadata, 1.0f); - return (speed < 0 ? 0 : speed) / hardness / 100F; + return player.getBreakSpeed(block, true, metadata) / hardness / 100F; } else { - return player.getCurrentPlayerStrVsBlock(block, false, metadata) / hardness / 30F; + return player.getBreakSpeed(block, false, metadata) / hardness / 30F; } } public static boolean isToolEffective(ItemStack stack, Block block, int metadata) { - List toolClass = toolClasses.get(stack.getItem()); - return toolClass != null && toolEffectiveness.contains(Arrays.asList(block, metadata, toolClass.get(0))); + for (String type : stack.getItem().getToolClasses(stack)) + { + if (block.isToolEffective(type, metadata)) + return true; + } + return false; } static void initTools() @@ -183,55 +181,33 @@ public class ForgeHooks } toolInit = true; - MinecraftForge.setToolClass(Items.wooden_pickaxe, "pickaxe", 0); - MinecraftForge.setToolClass(Items.stone_pickaxe, "pickaxe", 1); - MinecraftForge.setToolClass(Items.iron_pickaxe, "pickaxe", 2); - MinecraftForge.setToolClass(Items.golden_pickaxe, "pickaxe", 0); - MinecraftForge.setToolClass(Items.diamond_pickaxe, "pickaxe", 3); - - MinecraftForge.setToolClass(Items.wooden_axe, "axe", 0); - MinecraftForge.setToolClass(Items.stone_axe, "axe", 1); - MinecraftForge.setToolClass(Items.iron_axe, "axe", 2); - MinecraftForge.setToolClass(Items.golden_axe, "axe", 0); - MinecraftForge.setToolClass(Items.diamond_axe, "axe", 3); - - MinecraftForge.setToolClass(Items.wooden_shovel, "shovel", 0); - MinecraftForge.setToolClass(Items.stone_shovel, "shovel", 1); - MinecraftForge.setToolClass(Items.iron_shovel, "shovel", 2); - MinecraftForge.setToolClass(Items.golden_shovel, "shovel", 0); - MinecraftForge.setToolClass(Items.diamond_shovel, "shovel", 3); - Set blocks = ReflectionHelper.getPrivateValue(ItemPickaxe.class, null, 0); for (Block block : blocks) { - MinecraftForge.setBlockHarvestLevel(block, "pickaxe", 0); + block.setHarvestLevel("pickaxe", 0); } blocks = ReflectionHelper.getPrivateValue(ItemSpade.class, null, 0); for (Block block : blocks) { - MinecraftForge.setBlockHarvestLevel(block, "shovel", 0); + block.setHarvestLevel("shovel", 0); } blocks = ReflectionHelper.getPrivateValue(ItemAxe.class, null, 0); for (Block block : blocks) { - MinecraftForge.setBlockHarvestLevel(block, "axe", 0); + block.setHarvestLevel("axe", 0); } - MinecraftForge.setBlockHarvestLevel(Blocks.obsidian, "pickaxe", 3); - MinecraftForge.setBlockHarvestLevel(Blocks.emerald_ore, "pickaxe", 2); - MinecraftForge.setBlockHarvestLevel(Blocks.emerald_block, "pickaxe", 2); - MinecraftForge.setBlockHarvestLevel(Blocks.diamond_ore, "pickaxe", 2); - MinecraftForge.setBlockHarvestLevel(Blocks.diamond_block, "pickaxe", 2); - MinecraftForge.setBlockHarvestLevel(Blocks.gold_ore, "pickaxe", 2); - MinecraftForge.setBlockHarvestLevel(Blocks.gold_block, "pickaxe", 2); - MinecraftForge.setBlockHarvestLevel(Blocks.iron_ore, "pickaxe", 1); - MinecraftForge.setBlockHarvestLevel(Blocks.iron_block, "pickaxe", 1); - MinecraftForge.setBlockHarvestLevel(Blocks.lapis_ore, "pickaxe", 1); - MinecraftForge.setBlockHarvestLevel(Blocks.lapis_block, "pickaxe", 1); - MinecraftForge.setBlockHarvestLevel(Blocks.redstone_ore, "pickaxe", 2); - MinecraftForge.setBlockHarvestLevel(Blocks.lit_redstone_ore, "pickaxe", 2); + Blocks.obsidian.setHarvestLevel("pickaxe", 3); + for (Block block : new Block[]{emerald_ore, emerald_block, diamond_ore, diamond_block, gold_ore, gold_block, redstone_ore, lit_redstone_ore}) + { + block.setHarvestLevel("pickaxe", 2); + } + Blocks.iron_ore.setHarvestLevel("pickaxe", 1); + Blocks.iron_block.setHarvestLevel("pickaxe", 1); + Blocks.lapis_ore.setHarvestLevel("pickaxe", 1); + Blocks.lapis_block.setHarvestLevel("pickaxe", 1); MinecraftForge.removeBlockEffectiveness(Blocks.redstone_ore, "pickaxe"); MinecraftForge.removeBlockEffectiveness(Blocks.obsidian, "pickaxe"); MinecraftForge.removeBlockEffectiveness(Blocks.lit_redstone_ore, "pickaxe"); @@ -271,23 +247,23 @@ public class ForgeHooks ItemStack result = null; boolean isCreative = player.capabilities.isCreativeMode; - if (target.typeOfHit == EnumMovingObjectType.TILE) + if (target.typeOfHit == MovingObjectType.BLOCK) { int x = target.blockX; int y = target.blockY; int z = target.blockZ; - Block var8 = world.func_147439_a(x, y, z); + Block block = world.func_147439_a(x, y, z); - if (var8 == null) + if (block.isAir(world, x, y, z)) { return false; } - result = var8.getPickBlock(target, world, x, y, z); + result = block.getPickBlock(target, world, x, y, z); } else { - if (target.typeOfHit != EnumMovingObjectType.ENTITY || target.entityHit == null || !isCreative) + if (target.typeOfHit != MovingObjectType.ENTITY || target.entityHit == null || !isCreative) { return false; } @@ -401,10 +377,10 @@ public class ForgeHooks MinecraftForge.EVENT_BUS.post(new LivingJumpEvent(entity)); } - public static EntityItem onPlayerTossEvent(EntityPlayer player, ItemStack item) + public static EntityItem onPlayerTossEvent(EntityPlayer player, ItemStack item, boolean includeName) { player.captureDrops = true; - EntityItem ret = player.dropPlayerItemWithRandomChoice(item, false); + EntityItem ret = player.func_146097_a(item, false, includeName); player.capturedDrops.clear(); player.captureDrops = false; @@ -425,18 +401,12 @@ public class ForgeHooks public static float getEnchantPower(World world, int x, int y, int z) { - if (world.isAirBlock(x, y, z)) - { - return 0; - } - - Block block = world.func_147439_a(x, y, z); - return (block == null ? 0 : block.getEnchantPowerBonus(world, x, y, z)); + return world.func_147439_a(x, y, z).getEnchantPowerBonus(world, x, y, z); } - public static ChatMessageComponent onServerChatEvent(NetServerHandler net, String raw, ChatMessageComponent comp) + public static ChatComponentTranslation onServerChatEvent(NetHandlerPlayServer net, String raw, ChatComponentTranslation comp) { - ServerChatEvent event = new ServerChatEvent(net.playerEntity, raw, comp); + ServerChatEvent event = new ServerChatEvent(net.field_147369_b, raw, comp); if (MinecraftForge.EVENT_BUS.post(event)) { return null; @@ -451,7 +421,7 @@ public class ForgeHooks return event.getResult() == Event.Result.DEFAULT ? event.canInteractWith : event.getResult() == Event.Result.ALLOW ? true : false; } - public static BlockEvent.BreakEvent onBlockBreakEvent(World world, EnumGameType gameType, EntityPlayerMP entityPlayer, int x, int y, int z) + public static BlockEvent.BreakEvent onBlockBreakEvent(World world, GameType gameType, EntityPlayerMP entityPlayer, int x, int y, int z) { // Logic from tryHarvestBlock for pre-canceling the event boolean preCancelEvent = false; @@ -465,12 +435,12 @@ public class ForgeHooks } // Tell client the block is gone immediately then process events - if (world.getBlockTileEntity(x, y, z) == null) + if (world.func_147438_o(x, y, z) == null) { - Packet53BlockChange packet = new Packet53BlockChange(x, y, z, world); - packet.type = 0; - packet.metadata = 0; - entityPlayer.playerNetServerHandler.sendPacketToPlayer(packet); + S23PacketBlockChange packet = new S23PacketBlockChange(x, y, z, world); + packet.field_148883_d = Blocks.air; + packet.field_148884_e = 0; + entityPlayer.playerNetServerHandler.func_147359_a(packet); } // Post the block break event @@ -484,16 +454,16 @@ public class ForgeHooks if (event.isCanceled()) { // Let the client know the block still exists - entityPlayer.playerNetServerHandler.sendPacketToPlayer(new Packet53BlockChange(x, y, z, world)); + entityPlayer.playerNetServerHandler.func_147359_a(new S23PacketBlockChange(x, y, z, world)); // Update any tile entity data for this block - TileEntity tileentity = world.getBlockTileEntity(x, y, z); + TileEntity tileentity = world.func_147438_o(x, y, z); if (tileentity != null) { Packet pkt = tileentity.func_145844_m(); if (pkt != null) { - entityPlayer.playerNetServerHandler.sendPacketToPlayer(pkt); + entityPlayer.playerNetServerHandler.func_147359_a(pkt); } } } diff --git a/src/main/java/net/minecraftforge/common/ForgeInternalHandler.java b/src/main/java/net/minecraftforge/common/ForgeInternalHandler.java index a4e60e415..eb3bad5a5 100644 --- a/src/main/java/net/minecraftforge/common/ForgeInternalHandler.java +++ b/src/main/java/net/minecraftforge/common/ForgeInternalHandler.java @@ -39,9 +39,9 @@ public class ForgeInternalHandler Item item = stack.getItem(); if (item == null) { - FMLLog.warning("Attempted to add a EntityItem to the world with a invalid item: ID %d at " + + FMLLog.warning("Attempted to add a EntityItem to the world with a invalid item at " + "(%2.2f, %2.2f, %2.2f), this is most likely a config issue between you and the server. Please double check your configs", - stack.itemID, entity.posX, entity.posY, entity.posZ); + entity.posX, entity.posY, entity.posZ); entity.setDead(); event.setCanceled(true); return; diff --git a/src/main/java/net/minecraftforge/common/ForgeModContainer.java b/src/main/java/net/minecraftforge/common/ForgeModContainer.java index f9a8d54b0..4072090b7 100644 --- a/src/main/java/net/minecraftforge/common/ForgeModContainer.java +++ b/src/main/java/net/minecraftforge/common/ForgeModContainer.java @@ -11,6 +11,7 @@ import java.util.Arrays; import java.util.Map; import java.util.logging.Level; +import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.storage.SaveHandler; @@ -35,6 +36,7 @@ import cpw.mods.fml.common.ModMetadata; import cpw.mods.fml.common.WorldAccessContainer; import cpw.mods.fml.common.event.FMLConstructionEvent; import cpw.mods.fml.common.event.FMLLoadCompleteEvent; +import cpw.mods.fml.common.event.FMLModIdMappingEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.event.FMLServerStartingEvent; @@ -50,7 +52,7 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC public static boolean forceDuplicateFluidBlockCrash = true; public static boolean fullBoundingBoxLadders = false; public static double zombieSummonBaseChance = 0.1; - public static int[] blendRanges = { 20, 15, 10, 5 }; + public static int[] blendRanges = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32 }; public static float zombieBabyChance = 0.05f; public static boolean shouldSortRecipies = false; @@ -141,7 +143,7 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC FMLLog.warning("Disabling forced crashes on duplicate Fluid Blocks - USE AT YOUR OWN RISK"); } - prop = config.get(Configuration.CATEGORY_GENERAL, "biomeSkyBlendRange", new int[] { 20, 15, 10, 5 }); + prop = config.get(Configuration.CATEGORY_GENERAL, "biomeSkyBlendRange", new int[] { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32 }); prop.comment = "Control the range of sky blending for colored skies in biomes."; blendRanges = prop.getIntList(); @@ -222,6 +224,13 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC } } + @Subscribe + public void mappingChanged(FMLModIdMappingEvent evt) + { + Blocks.fire.rebuildFireInfo(); + } + + @Override public File getSource() { diff --git a/src/main/java/net/minecraftforge/common/IPlantable.java b/src/main/java/net/minecraftforge/common/IPlantable.java index c19a21d44..9c3b0c4eb 100644 --- a/src/main/java/net/minecraftforge/common/IPlantable.java +++ b/src/main/java/net/minecraftforge/common/IPlantable.java @@ -1,10 +1,12 @@ package net.minecraftforge.common; +import net.minecraft.block.Block; +import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public interface IPlantable { - public EnumPlantType getPlantType(World world, int x, int y, int z); - public int getPlantID(World world, int x, int y, int z); - public int getPlantMetadata(World world, int x, int y, int z); + public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z); + public Block getPlant(IBlockAccess world, int x, int y, int z); + public int getPlantMetadata(IBlockAccess world, int x, int y, int z); } \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/common/IShearable.java b/src/main/java/net/minecraftforge/common/IShearable.java index 190e7b264..0a8ecccf5 100644 --- a/src/main/java/net/minecraftforge/common/IShearable.java +++ b/src/main/java/net/minecraftforge/common/IShearable.java @@ -5,7 +5,7 @@ import java.util.ArrayList; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.MovingObjectPosition; -import net.minecraft.world.World; +import net.minecraft.world.IBlockAccess; /** * @@ -28,7 +28,7 @@ public interface IShearable * @param z The Z Position * @return If this is shearable, and onSheared should be called. */ - public boolean isShearable(ItemStack item, World world, int x, int y, int z); + public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z); /** * Performs the shear function on this object. @@ -49,5 +49,5 @@ public interface IShearable * @param fortune The fortune level of the shears being used * @return A ArrayList containing all items from this shearing. Possible to be null. */ - public ArrayList onSheared(ItemStack item, World world, int x, int y, int z, int fortune); + public ArrayList onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune); } diff --git a/src/main/java/net/minecraftforge/common/MinecraftForge.java b/src/main/java/net/minecraftforge/common/MinecraftForge.java index f0c26077b..1dd808e1e 100644 --- a/src/main/java/net/minecraftforge/common/MinecraftForge.java +++ b/src/main/java/net/minecraftforge/common/MinecraftForge.java @@ -19,7 +19,6 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.common.ForgeHooks.GrassEntry; import net.minecraftforge.common.ForgeHooks.SeedEntry; -import net.minecraftforge.common.util.IdentityMap; import net.minecraftforge.event.entity.EntityEvent; import net.minecraftforge.oredict.OreDictionary; @@ -38,8 +37,6 @@ public class MinecraftForge public static final EventBus ORE_GEN_BUS = new EventBus(); private static final ForgeInternalHandler INTERNAL_HANDLER = new ForgeInternalHandler(); - - private static final IdentityMap EXTENSION_BLOCK = new IdentityMap(4096, 1.0f); /** Register a new plant to be planted when bonemeal is used on grass. @@ -65,141 +62,6 @@ public class MinecraftForge ForgeHooks.seedList.add(new SeedEntry(seed, weight)); } - /** - * - * Register a tool as a tool class with a given harvest level. - * - * @param tool The custom tool to register. - * @param toolClass The tool class to register as. The predefined tool - * clases are "pickaxe", "shovel", "axe". You can add - * others for custom tools. - * @param harvestLevel The harvest level of the tool. - */ - public static void setToolClass(Item tool, String toolClass, int harvestLevel) - { - ForgeHooks.toolClasses.put(tool, Arrays.asList(toolClass, harvestLevel)); - } - - /** - * Register a block to be harvested by a tool class. This is the metadata - * sensitive version, use it if your blocks are using metadata variants. - * By default, this sets the block class as effective against that type. - * - * @param block The block to register. - * @param metadata The metadata for the block subtype. - * @param toolClass The tool class to register as able to remove this block. - * You may register the same block multiple times with different tool - * classes, if multiple tool types can be used to harvest this block. - * @param harvestLevel The minimum tool harvest level required to successfully - * harvest the block. - * @see MinecraftForge#setToolClass for details on tool classes. - */ - public static void setBlockHarvestLevel(Block block, int metadata, String toolClass, int harvestLevel) - { - List key = Arrays.asList(block, metadata, toolClass); - ForgeHooks.toolHarvestLevels.put(key, harvestLevel); - ForgeHooks.toolEffectiveness.add(key); - } - - /** - * Remove a block effectiveness mapping. Since setBlockHarvestLevel - * makes the tool class effective against the block by default, this can be - * used to remove that mapping. This will force a block to be harvested at - * the same speed regardless of tool quality, while still requiring a given - * harvesting level. - * - * @param block The block to remove effectiveness from. - * @param metadata The metadata for the block subtype. - * @param toolClass The tool class to remove the effectiveness mapping from. - * @see MinecraftForge#setToolClass for details on tool classes. - */ - public static void removeBlockEffectiveness(Block block, int metadata, String toolClass) - { - List key = Arrays.asList(block, metadata, toolClass); - ForgeHooks.toolEffectiveness.remove(key); - } - - /** - * Register a block to be harvested by a tool class. - * By default, this sets the block class as effective against that type. - * - * @param block The block to register. - * @param toolClass The tool class to register as able to remove this block. - * You may register the same block multiple times with different tool - * classes, if multiple tool types can be used to harvest this block. - * @param harvestLevel The minimum tool harvest level required to successfully - * harvest the block. - * @see MinecraftForge#setToolClass for details on tool classes. - */ - public static void setBlockHarvestLevel(Block block, String toolClass, int harvestLevel) - { - for (int metadata = 0; metadata < 16; metadata++) - { - List key = Arrays.asList(block, metadata, toolClass); - ForgeHooks.toolHarvestLevels.put(key, harvestLevel); - ForgeHooks.toolEffectiveness.add(key); - } - } - - /** - * Returns the block harvest level for a particular tool class. - * - * @param block The block to check. - * @param metadata The metadata for the block subtype. - * @param toolClass The tool class to check as able to remove this block. - * @see MinecraftForge#setToolClass for details on tool classes. - * @return The harvest level or -1 if no mapping exists. - */ - public static int getBlockHarvestLevel(Block block, int metadata, String toolClass) - { - ForgeHooks.initTools(); - List key = Arrays.asList(block, metadata, toolClass); - Integer harvestLevel = ForgeHooks.toolHarvestLevels.get(key); - return (harvestLevel == null ? -1 : harvestLevel); - } - - /** - * Remove a block effectiveness mapping. Since setBlockHarvestLevel - * makes the tool class effective against the block by default, this can be - * used to remove that mapping. This will force a block to be harvested at - * the same speed regardless of tool quality, while still requiring a given - * harvesting level. - * - * @param block The block to remove effectiveness from. - * @param toolClass The tool class to remove the effectiveness mapping from. - * @see MinecraftForge#setToolClass for details on tool classes. - */ - public static void removeBlockEffectiveness(Block block, String toolClass) - { - for (int metadata = 0; metadata < 16; metadata++) - { - List key = Arrays.asList(block, metadata, toolClass); - ForgeHooks.toolEffectiveness.remove(key); - } - } - - /** - * Gets the associated Extension object for the specified block, - * if guarantee is true, and there is no extension associated, it will - * create a new one and register it. - * - * May return null, unless guarantee is set to true - * - * @param block The block instance - * @param guarantee Wither to create a new extension if one does not exist. - * @return The extension object or null if none is registered and guarantee is false - */ - public static BlockExtension getBlockExtension(Block block, boolean guarantee) - { - BlockExtension ret = EXTENSION_BLOCK.get(block); - if (ret == null && guarantee) - { - ret = new BlockExtension(block); - EXTENSION_BLOCK.put(block, ret); - } - return ret; - } - /** * Method invoked by FML before any other mods are loaded. */ diff --git a/src/main/java/net/minecraftforge/common/WorldSpecificSaveHandler.java b/src/main/java/net/minecraftforge/common/WorldSpecificSaveHandler.java index 91ce74c20..aaf2256c7 100644 --- a/src/main/java/net/minecraftforge/common/WorldSpecificSaveHandler.java +++ b/src/main/java/net/minecraftforge/common/WorldSpecificSaveHandler.java @@ -35,10 +35,12 @@ public class WorldSpecificSaveHandler implements ISaveHandler @Override public IPlayerFileData getSaveHandler() { return parent.getSaveHandler(); } @Override public void flush() { parent.flush(); } @Override public String getWorldDirectoryName() { return parent.getWorldDirectoryName(); } + @Override public File getWorldDirectory() { return parent.getWorldDirectory(); } @Override public File getMapFileFromName(String name) { return new File(dataDir, name + ".dat"); } + } diff --git a/src/main/java/net/minecraftforge/common/network/ForgeMessage.java b/src/main/java/net/minecraftforge/common/network/ForgeMessage.java index 8f0af9a9f..5883aec4d 100644 --- a/src/main/java/net/minecraftforge/common/network/ForgeMessage.java +++ b/src/main/java/net/minecraftforge/common/network/ForgeMessage.java @@ -36,23 +36,27 @@ public abstract class ForgeMessage { @Override void toBytes(ByteBuf bytes) { + /* bytes.writeInt(FluidRegistry.maxID); for (Map.Entry entry : FluidRegistry.fluidIDs.entrySet()) { ByteBufUtils.writeUTF8String(bytes,entry.getKey()); bytes.writeInt(entry.getValue()); } + */ } @Override void fromBytes(ByteBuf bytes) { + /* int listSize = bytes.readInt(); for (int i = 0; i < listSize; i++) { String fluidName = ByteBufUtils.readUTF8String(bytes); int fluidId = bytes.readInt(); fluidIds.put(fluidName, fluidId); } + */ } } diff --git a/src/main/java/net/minecraftforge/common/util/IdentityMap.java b/src/main/java/net/minecraftforge/common/util/IdentityMap.java deleted file mode 100644 index 4bddbf52b..000000000 --- a/src/main/java/net/minecraftforge/common/util/IdentityMap.java +++ /dev/null @@ -1,134 +0,0 @@ -package net.minecraftforge.common.util; - -import gnu.trove.iterator.TIntObjectIterator; -import gnu.trove.map.hash.TIntIntHashMap; -import gnu.trove.map.hash.TIntObjectHashMap; - -import java.util.AbstractMap; -import java.util.AbstractSet; -import java.util.Collection; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; - -public class IdentityMap implements Map -{ - private TIntObjectHashMap values; - private TIntObjectHashMap keys; - private EntrySet entrySet; - - public IdentityMap(int initialCapacity, float loadFactor) - { - keys = new TIntObjectHashMap(initialCapacity, loadFactor, -1); - values = new TIntObjectHashMap(initialCapacity, loadFactor, -1); - } - - @Override public int size(){ return values.size(); } - @Override public boolean isEmpty(){ return values.isEmpty(); } - @Override public boolean containsKey(Object key){ return values.containsKey(System.identityHashCode(key)); } - @Override public boolean containsValue(Object value){ return values.containsValue(value); } - @Override public V get(Object key){ return values.get(System.identityHashCode(key)); } - @Override - public V put(K key, V value) - { - int id = System.identityHashCode(key); - keys.put(id, key); - return values.put(id, value); - } - - @Override public V remove(Object key) - { - /* - int id = System.identityHashCode(key); - keys.remove(id); - return values.remove(id); - */ - throw new IllegalStateException(); - } - - @Override - public void putAll(Map m) - { - for (Entry entry : m.entrySet()) - { - put(entry.getKey(), entry.getValue()); - } - } - - @Override - public void clear() - { - /* - keys.clear(); - values.clear(); - */ - throw new IllegalStateException(); - } - - @Override - public Set keySet() - { - return new TreeSet(keys.valueCollection()); - } - - @Override - public Collection values() - { - return values.valueCollection(); - } - - @Override - public Set> entrySet() - { - if (entrySet == null) entrySet = new EntrySet(); - return entrySet; - } - - private class EntrySet extends AbstractSet> - { - @Override - public Iterator> iterator() - { - return new EntryIterator(keys.iterator()); - } - - @Override - public int size() - { - return keys.size(); - } - } - - private class EntryIterator implements Iterator> - { - private TIntObjectIterator itr; - private int last = -1; - private EntryIterator(TIntObjectIterator itr) - { - this.itr = itr; - } - - @Override - public boolean hasNext() - { - return itr.hasNext(); - } - - @Override - public Entry next() - { - itr.advance(); - return new AbstractMap.SimpleEntry(itr.value(), values.get(itr.key())); - } - @Override - public void remove() - { - /* - keys.remove(itr.key()); - values.remove(itr.key()); - */ - throw new IllegalStateException(); - } - } -} diff --git a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java index 07d35ea30..773a2c0ca 100644 --- a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java +++ b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java @@ -4,17 +4,19 @@ import java.util.ArrayList; import java.util.List; import cpw.mods.fml.common.eventhandler.Event.Result; - import net.minecraft.block.Block; +import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EnumCreatureType; +import net.minecraft.entity.effect.EntityLightningBolt; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.entity.EntityStruckByLightningEvent; import net.minecraftforge.event.entity.living.LivingPackSizeEvent; import net.minecraftforge.event.entity.living.LivingSpawnEvent; import net.minecraftforge.event.entity.living.LivingSpawnEvent.AllowDespawn; @@ -118,4 +120,9 @@ public class ForgeEventFactory MinecraftForge.EVENT_BUS.post(summonEvent); return summonEvent; } + + public static boolean onEntityStruckByLightning(Entity entity, EntityLightningBolt bolt) + { + return MinecraftForge.EVENT_BUS.post(new EntityStruckByLightningEvent(entity, bolt)); + } } diff --git a/src/main/java/net/minecraftforge/event/ServerChatEvent.java b/src/main/java/net/minecraftforge/event/ServerChatEvent.java index f9f6c8b6b..db11e5f8a 100644 --- a/src/main/java/net/minecraftforge/event/ServerChatEvent.java +++ b/src/main/java/net/minecraftforge/event/ServerChatEvent.java @@ -3,15 +3,15 @@ package net.minecraftforge.event; import cpw.mods.fml.common.eventhandler.Cancelable; import cpw.mods.fml.common.eventhandler.Event; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.util.ChatMessageComponent; +import net.minecraft.util.ChatComponentTranslation; @Cancelable public class ServerChatEvent extends Event { public final String message, username; public final EntityPlayerMP player; - public ChatMessageComponent component; - public ServerChatEvent(EntityPlayerMP player, String message, ChatMessageComponent component) + public ChatComponentTranslation component; + public ServerChatEvent(EntityPlayerMP player, String message, ChatComponentTranslation component) { super(); this.message = message; diff --git a/src/main/java/net/minecraftforge/event/entity/player/BonemealEvent.java b/src/main/java/net/minecraftforge/event/entity/player/BonemealEvent.java index 1c1f9353a..d599e1c9d 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/BonemealEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/BonemealEvent.java @@ -2,6 +2,7 @@ package net.minecraftforge.event.entity.player; import cpw.mods.fml.common.eventhandler.Cancelable; import cpw.mods.fml.common.eventhandler.Event; +import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; @@ -20,18 +21,18 @@ public class BonemealEvent extends PlayerEvent */ public final World world; - public final int ID; - public final int X; - public final int Y; - public final int Z; + public final Block block; + public final int x; + public final int y; + public final int z; - public BonemealEvent(EntityPlayer player, World world, int id, int x, int y, int z) + public BonemealEvent(EntityPlayer player, World world, Block block, int x, int y, int z) { super(player); this.world = world; - this.ID = id; - this.X = x; - this.Y = y; - this.Z = z; + this.block = block; + this.x = x; + this.y = y; + this.z = z; } } diff --git a/src/main/java/net/minecraftforge/event/terraingen/BiomeEvent.java b/src/main/java/net/minecraftforge/event/terraingen/BiomeEvent.java index 8487dfbb9..f87e66e53 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/BiomeEvent.java +++ b/src/main/java/net/minecraftforge/event/terraingen/BiomeEvent.java @@ -1,9 +1,11 @@ package net.minecraftforge.event.terraingen; import cpw.mods.fml.common.FMLLog; +import cpw.mods.fml.common.eventhandler.Cancelable; import cpw.mods.fml.common.eventhandler.Event; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; import net.minecraft.world.biome.BiomeDecorator; import net.minecraft.world.biome.BiomeGenBase; import net.minecraftforge.event.*; @@ -30,19 +32,6 @@ public class BiomeEvent extends Event } } - public static class BlockReplacement extends BiomeEvent - { - public final int original; - public int replacement; - - public BlockReplacement(BiomeGenBase biome, int original, int replacement) - { - super(biome); - this.original = original; - this.replacement = replacement; - } - } - public static class BiomeColor extends BiomeEvent { public final int originalColor; @@ -60,14 +49,20 @@ public class BiomeEvent extends Event * This event is fired when the village generator attempts to choose a block ID * based on the village's biome. * - * You can set the result to DENY to prevent the default block ID selection. + * You can cancel the event to override default values */ @HasResult - public static class GetVillageBlockID extends BlockReplacement + public static class GetVillageBlockID extends BiomeEvent { - public GetVillageBlockID(BiomeGenBase biome, int original, int replacement) + public final Block original; + public final int type; + public Block replacement; + + public GetVillageBlockID(BiomeGenBase biome, Block original, int type) { - super(biome, original, replacement); + super(biome); + this.original = original; + this.type = type; } } @@ -78,11 +73,17 @@ public class BiomeEvent extends Event * You can set the result to DENY to prevent the default block metadata selection. */ @HasResult - public static class GetVillageBlockMeta extends BlockReplacement + public static class GetVillageBlockMeta extends BiomeEvent { - public GetVillageBlockMeta(BiomeGenBase biome, int original, int replacement) + public final Block original; + public final int type; + public int replacement; + + public GetVillageBlockMeta(BiomeGenBase biome, Block original, int type) { - super(biome, original, replacement); + super(biome); + this.original = original; + this.type = type; } } diff --git a/src/main/java/net/minecraftforge/event/terraingen/ChunkProviderEvent.java b/src/main/java/net/minecraftforge/event/terraingen/ChunkProviderEvent.java index 98dcdc967..62f86b5d1 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/ChunkProviderEvent.java +++ b/src/main/java/net/minecraftforge/event/terraingen/ChunkProviderEvent.java @@ -1,6 +1,7 @@ package net.minecraftforge.event.terraingen; import cpw.mods.fml.common.eventhandler.Event; +import net.minecraft.block.Block; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.chunk.IChunkProvider; import net.minecraftforge.event.*; @@ -26,10 +27,10 @@ public class ChunkProviderEvent extends Event { public final int chunkX; public final int chunkZ; - public final byte[] blockArray; + public final Block[] blockArray; public final BiomeGenBase[] biomeArray; - public ReplaceBiomeBlocks(IChunkProvider chunkProvider, int chunkX, int chunkZ, byte[] blockArray, BiomeGenBase[] biomeArray) + public ReplaceBiomeBlocks(IChunkProvider chunkProvider, int chunkX, int chunkZ, Block[] blockArray, BiomeGenBase[] biomeArray) { super(chunkProvider); this.chunkX = chunkX; diff --git a/src/main/java/net/minecraftforge/event/terraingen/DeferredBiomeDecorator.java b/src/main/java/net/minecraftforge/event/terraingen/DeferredBiomeDecorator.java index 219d3ca8a..d8a6b3c1a 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/DeferredBiomeDecorator.java +++ b/src/main/java/net/minecraftforge/event/terraingen/DeferredBiomeDecorator.java @@ -10,20 +10,19 @@ import net.minecraftforge.common.MinecraftForge; public class DeferredBiomeDecorator extends BiomeDecorator { private BiomeDecorator wrapped; - public DeferredBiomeDecorator(BiomeGenBase biomeGenBase, BiomeDecorator wrappedOriginal) + public DeferredBiomeDecorator(BiomeDecorator wrappedOriginal) { - super(biomeGenBase); this.wrapped = wrappedOriginal; } @Override - public void decorate(World par1World, Random par2Random, int par3, int par4) + public void func_150512_a(World par1World, Random par2Random, BiomeGenBase biome, int par3, int par4) { - fireCreateEventAndReplace(); + fireCreateEventAndReplace(biome); // On first call to decorate, we fire and substitute ourselves, if we haven't already done so - biome.theBiomeDecorator.decorate(par1World, par2Random, par3, par4); + biome.theBiomeDecorator.func_150512_a(par1World, par2Random, biome, par3, par4); } - public void fireCreateEventAndReplace() + public void fireCreateEventAndReplace(BiomeGenBase biome) { // Copy any configuration from us to the real instance. wrapped.bigMushroomsPerChunk = bigMushroomsPerChunk; diff --git a/src/main/java/net/minecraftforge/event/terraingen/OreGenEvent.java b/src/main/java/net/minecraftforge/event/terraingen/OreGenEvent.java index a22580571..ecde62871 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/OreGenEvent.java +++ b/src/main/java/net/minecraftforge/event/terraingen/OreGenEvent.java @@ -47,7 +47,7 @@ public class OreGenEvent extends Event @HasResult public static class GenerateMinable extends OreGenEvent { - public static enum EventType { COAL, DIAMOND, DIRT, GOLD, GRAVEL, IRON, LAPIS, REDSTONE, CUSTOM } + public static enum EventType { COAL, DIAMOND, DIRT, GOLD, GRAVEL, IRON, LAPIS, REDSTONE, QUARTZ, CUSTOM } public final EventType type; public final WorldGenerator generator; diff --git a/src/main/java/net/minecraftforge/event/world/BlockEvent.java b/src/main/java/net/minecraftforge/event/world/BlockEvent.java index 42a4fab15..60b95b08c 100644 --- a/src/main/java/net/minecraftforge/event/world/BlockEvent.java +++ b/src/main/java/net/minecraftforge/event/world/BlockEvent.java @@ -4,12 +4,12 @@ import java.util.ArrayList; import cpw.mods.fml.common.eventhandler.Cancelable; import cpw.mods.fml.common.eventhandler.Event; - import net.minecraft.block.Block; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import net.minecraftforge.common.ForgeHooks; public class BlockEvent extends Event { public final int x; @@ -73,14 +73,14 @@ public class BlockEvent extends Event { super(x, y, z, world, block, blockMetadata); this.player = player; - if (block == null || !player.canHarvestBlock(block) || // Handle empty block or player unable to break block scenario + if (block == null || !ForgeHooks.canHarvestBlock(block, player, blockMetadata) || // Handle empty block or player unable to break block scenario block.canSilkHarvest(world, player, x, y, z, blockMetadata) && EnchantmentHelper.getSilkTouchModifier(player)) // If the block is being silk harvested, the exp dropped is 0 { this.exp = 0; } else { - int meta = block.getDamageValue(world, x, y, z); + int meta = block.func_149643_k(world, x, y, z); int bonusLevel = EnchantmentHelper.getFortuneModifier(player); this.exp = block.getExpDrop(world, meta, bonusLevel); } diff --git a/src/main/java/net/minecraftforge/event/world/ChunkWatchEvent.java b/src/main/java/net/minecraftforge/event/world/ChunkWatchEvent.java index 0e9bfd1cb..f2ab9d022 100644 --- a/src/main/java/net/minecraftforge/event/world/ChunkWatchEvent.java +++ b/src/main/java/net/minecraftforge/event/world/ChunkWatchEvent.java @@ -3,7 +3,6 @@ package net.minecraftforge.event.world; import cpw.mods.fml.common.eventhandler.Event; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.server.management.PlayerInstance; import net.minecraft.world.WorldServer; public class ChunkWatchEvent extends Event diff --git a/src/main/java/net/minecraftforge/event/world/WorldEvent.java b/src/main/java/net/minecraftforge/event/world/WorldEvent.java index f46c3f4dd..ea18bcfbc 100644 --- a/src/main/java/net/minecraftforge/event/world/WorldEvent.java +++ b/src/main/java/net/minecraftforge/event/world/WorldEvent.java @@ -8,7 +8,7 @@ import cpw.mods.fml.common.eventhandler.Event; import net.minecraft.entity.EnumCreatureType; import net.minecraft.world.World; -import net.minecraft.world.biome.SpawnListEntry; +import net.minecraft.world.biome.BiomeGenBase.SpawnListEntry; public class WorldEvent extends Event { diff --git a/src/main/java/net/minecraftforge/fluids/FluidIdMapPacket.java b/src/main/java/net/minecraftforge/fluids/FluidIdMapPacket.java index 344ffaf6f..2b9ab696f 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidIdMapPacket.java +++ b/src/main/java/net/minecraftforge/fluids/FluidIdMapPacket.java @@ -4,7 +4,6 @@ package net.minecraftforge.fluids; import java.util.Map; import net.minecraft.entity.player.EntityPlayer; -import net.minecraftforge.common.network.ForgePacket; import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; @@ -12,7 +11,7 @@ import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteArrayDataOutput; import com.google.common.io.ByteStreams; -public class FluidIdMapPacket extends ForgePacket +public class FluidIdMapPacket// extends ForgePacket { /* private BiMap fluidIds = HashBiMap.create(); diff --git a/src/main/java/net/minecraftforge/fluids/RenderBlockFluid.java b/src/main/java/net/minecraftforge/fluids/RenderBlockFluid.java index d90fc264b..e5bcab40f 100644 --- a/src/main/java/net/minecraftforge/fluids/RenderBlockFluid.java +++ b/src/main/java/net/minecraftforge/fluids/RenderBlockFluid.java @@ -18,7 +18,7 @@ public class RenderBlockFluid implements ISimpleBlockRenderingHandler { @Override public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {} @Override public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { return false; } - @Override public boolean shouldRender3DInInventory() { return false; } + @Override public boolean shouldRender3DInInventory(int modelId) { return false; } @Override public int getRenderId() { return 0; } /* public static RenderBlockFluid instance = new RenderBlockFluid(); diff --git a/src/main/java/net/minecraftforge/oredict/OreDictionary.java b/src/main/java/net/minecraftforge/oredict/OreDictionary.java index 2424c4cde..c1d498d1d 100644 --- a/src/main/java/net/minecraftforge/oredict/OreDictionary.java +++ b/src/main/java/net/minecraftforge/oredict/OreDictionary.java @@ -131,7 +131,13 @@ public class OreDictionary new ItemStack(Blocks.stonebrick), new ItemStack(Blocks.stone_slab), new ItemStack(Blocks.stone_stairs), - new ItemStack(Blocks.cobblestone_wall) + new ItemStack(Blocks.cobblestone_wall), + new ItemStack(Blocks.oak_stairs), + new ItemStack(Blocks.spruce_stairs), + new ItemStack(Blocks.birch_stairs), + new ItemStack(Blocks.jungle_stairs), + new ItemStack(Blocks.acacia_stairs), + new ItemStack(Blocks.dark_oak_stairs) }; List recipes = CraftingManager.getInstance().getRecipeList(); diff --git a/src/main/resources/assets/forge/lang/en_US.lang b/src/main/resources/assets/forge/lang/en_US.lang index 2f9368d41..0110b4dc4 100644 --- a/src/main/resources/assets/forge/lang/en_US.lang +++ b/src/main/resources/assets/forge/lang/en_US.lang @@ -2,4 +2,5 @@ commands.forge.usage=Use /forge . Subcommands are tps, track commands.forge.usage.tracking=Use /forge track . Valid types are te (Tile Entities). Duration is < 60. commands.forge.tps.summary=%s : Mean tick time: %d ms. Mean TPS: %d -commands.forge.tracking.te.enabled=Tile Entity tracking enabled for %d seconds. \ No newline at end of file +commands.forge.tracking.te.enabled=Tile Entity tracking enabled for %d seconds. +forge.texture.preload.warning=Warning: Texture %s not preloaded, will cause render glitches! \ No newline at end of file diff --git a/src/main/resources/forge_at.cfg b/src/main/resources/forge_at.cfg index df94dc509..0b04e01ce 100644 --- a/src/main/resources/forge_at.cfg +++ b/src/main/resources/forge_at.cfg @@ -42,7 +42,7 @@ public net.minecraft.item.ItemSpade (Lnet.minecraft.item.Item$ToolMaterial #public aqz.r()Laqz; #MD:Block/func_71875_q #setBlockUnbreakable #public aqz.b(Z)Laqz; #MD:Block/func_71907_b #setTickRandomly #public aqz.a(FFFFFF)V #MD:Block/func_71905_a #setBlockBounds -#public aqz.j(Labw;IIII)V #MD:Block/func_71923_g #dropXpOnBlockBreak +public net.minecraft.block.Block func_149657_c(Lnet/minecraft/world/World;IIII)V # dropXpOnBlockBreak # NetServerHandler #public ka.f #FD:NetServerHandler/field_72572_g #playerInAirTime # TileEntity @@ -59,11 +59,12 @@ public net.minecraft.item.ItemSpade (Lnet.minecraft.item.Item$ToolMaterial #public amz #CL:BlockBaseRailLogic #public amz.a()I #MD:BlockBaseRailLogic/func_94505_a #getNAdjacentTiles # EntityPlayer -#public uf.a(Lss;)V #MD:EntityPlayer/func_71012_a #joinEntityItemWithWorld +public net.minecraft.entity.player.EntityPlayer func_71012_a(Lnet/minecraft/entity/item/EntityItem;)V #joinEntityItemWithWorld +public net.minecraft.client.entity.EntityClientPlayerMP func_71012_a(Lnet/minecraft/entity/item/EntityItem;)V #joinEntityItemWithWorld #public uf.i()V #MD:EntityPlayer/func_71053_j #closeScreen #public uf.b #FD:EntityPlayer/field_71076_b #sleepTimer # EntityPlayerMP -#public bdi.a(Lss;)V #MD:EntityClientPlayerMP/func_71012_a #joinEntityItemWithWorld +public net.minecraft.client.entity.EntityClientPlayerMP (Lnet/minecraft/entity/item/EntityItem;)V func_71012_a #joinEntityItemWithWorld # World Gen Chests Related public net.minecraft.util.WeightedRandomChestContent * public net.minecraft.world.WorldServer field_73069_S @@ -76,16 +77,15 @@ public net.minecraft.world.gen.structure.StructureStrongholdPieces$Library field public net.minecraft.world.gen.structure.StructureStrongholdPieces$RoomCrossing field_75014_c public net.minecraft.world.gen.structure.StructureVillagePieces$House2 field_74918_a public net.minecraft.world.gen.feature.WorldGenDungeons field_111189_a -# AnvilChunkLoader.chunkSaveLocation -#public aee.d #FD:AnvilChunkLoader/field_75825_d -# ChunkProviderServer.currentChunkLoader -#public jr.e #FD:ChunkProviderServer/field_73247_e +# Save Location +public net.minecraft.world.chunk.storage.AnvilChunkLoader field_75825_d # chunkSaveLocation +public net.minecraft.world.gen.ChunkProviderServer field_73247_e # currentChunkLoader # PlayerManager #public jp.a(IIZ)Ljq; #MD:PlayerManager/func_72690_a #getOrCreateChunkWatcher # PlayerInstance #public jq #CL:PlayerInstance # World -#public-f abw.A #FD:World/field_72982_D #villageCollectionObj +public-f net.minecraft.world.World field_72982_D #villageCollectionObj #public abw.G #FD:World/field_72993_I #activeChunkSet # EntityLiving #public og.b #FD:EntityLiving/field_70728_aV #experienceValue @@ -95,6 +95,15 @@ public net.minecraft.world.gen.feature.WorldGenDungeons field_111189_a #public avz.a(Ljava/lang/String;ILacq;[Lagd;)V #MD:GuiFlatPresets/func_82297_a # BiomeGenBase public net.minecraft.world.biome.BiomeGenBase *() #Everything protected->public +public net.minecraft.world.biome.BiomeGenForest *() +public net.minecraft.world.biome.BiomeGenHills *() +public net.minecraft.world.biome.BiomeGenMesa *() +public net.minecraft.world.biome.BiomeGenPlains *() +public net.minecraft.world.biome.BiomeGenSavanna *() +public net.minecraft.world.biome.BiomeGenSnow *() +public net.minecraft.world.biome.BiomeGenTaiga *() +# Map Gen Biome Lists +public+f net.minecraft.world.gen.structure.MapGenStronghold field_151546_e # MapGenVillage public-f net.minecraft.world.gen.structure.MapGenVillage field_75055_e #villageSpawnBiomes # ShapedRecipes @@ -113,7 +122,7 @@ public net.minecraft.item.crafting.ShapelessRecipes field_77579_b #recipeItems # BiomeDecorator public net.minecraft.world.biome.BiomeDecorator * # CreativeTabs -#public-f ww.a #FD:CreativeTabs/field_78032_a # creativeTabArray non-final +public-f net.minecraft.creativetab.CreativeTabs field_78032_a # creativeTabArray non-final # Packet #public ey.a(IZZLjava/lang/Class;)V #MD:Packet/func_73285_a #addIdClassMapping # SaveHandler @@ -145,7 +154,7 @@ public net.minecraft.world.biome.BiomeDecorator * protected net.minecraft.client.gui.GuiIngame * protected net.minecraft.client.gui.GuiIngame *() # ItemStack -#default ye.f #FD:ItemStack/field_77991_e # make default access for itemDamage +default net.minecraft.item.ItemStack field_77991_e # GuiSlot #protected awg.b(IIII)V #MD:GuiSlot/func_77206_b #overlayBackground # EntityPlayer @@ -154,4 +163,7 @@ protected net.minecraft.client.gui.GuiIngame *() #public air.b(Ljava/lang/Class;Ljava/lang/String;)V #MD:MapGenStructureIO/func_143034_b #registerStart #public air.a(Ljava/lang/Class;Ljava/lang/String;)V #MD:MapGenStructureIO/func_143031_a #registerPiece # Stronghold -public net.minecraft.world.gen.structure.StructureStrongholdPieces$Stronghold # This doesn't work until I figure out how to apply ATs in MCInjector \ No newline at end of file +public net.minecraft.world.gen.structure.StructureStrongholdPieces$Stronghold +# Packets +public net.minecraft.network.play.server.S23PacketBlockChange field_148883_d # Block +public net.minecraft.network.play.server.S23PacketBlockChange field_148884_e # Metadata \ No newline at end of file