From 650f92e85872566a769554f014a4f79a9c103828 Mon Sep 17 00:00:00 2001 From: LexManos Date: Sun, 4 Mar 2012 03:09:45 -0800 Subject: [PATCH] Client side initial patch update to Fernflower and MC 1.2.3 --- .../net/minecraft/client/Minecraft.java.patch | 136 +-- .../net/minecraft/src/Block.java.patch | 317 +++--- .../net/minecraft/src/BlockButton.java.patch | 167 ++-- .../net/minecraft/src/BlockChest.java.patch | 22 +- .../minecraft/src/BlockContainer.java.patch | 34 +- .../net/minecraft/src/BlockCrops.java.patch | 53 +- .../net/minecraft/src/BlockDoor.java.patch | 36 +- .../net/minecraft/src/BlockFire.java.patch | 517 +++++----- .../net/minecraft/src/BlockLadder.java.patch | 110 +-- .../net/minecraft/src/BlockLeaves.java.patch | 32 +- .../net/minecraft/src/BlockLever.java.patch | 158 ++- .../minecraft/src/BlockNetherStalk.java.patch | 53 +- .../minecraft/src/BlockPistonBase.java.patch | 8 +- .../src/BlockPressurePlate.java.patch | 24 +- .../net/minecraft/src/BlockRail.java.patch | 180 ++-- .../src/BlockRedstoneRepeater.java.patch | 30 +- .../src/BlockRedstoneWire.java.patch | 42 +- .../net/minecraft/src/BlockSnow.java.patch | 51 +- .../minecraft/src/BlockTallGrass.java.patch | 81 +- .../net/minecraft/src/BlockTorch.java.patch | 159 ++- .../minecraft/src/BlockTrapDoor.java.patch | 72 +- .../net/minecraft/src/BlockVine.java.patch | 30 +- .../net/minecraft/src/Chunk.java.patch | 328 +++---- .../src/ContainerCreative.java.patch | 39 +- .../minecraft/src/CraftingManager.java.patch | 12 +- .../minecraft/src/EffectRenderer.java.patch | 185 ++-- .../net/minecraft/src/Enchantment.java.patch | 22 +- .../src/EnchantmentHelper.java.patch | 14 +- .../net/minecraft/src/Entity.java.patch | 46 +- .../net/minecraft/src/EntityItem.java.patch | 47 +- .../net/minecraft/src/EntityLiving.java.patch | 32 +- .../minecraft/src/EntityMinecart.java.patch | 927 +++++++++--------- .../minecraft/src/EntityMooshroom.java.patch | 44 +- .../net/minecraft/src/EntityPlayer.java.patch | 188 ++-- .../minecraft/src/EntityRenderer.java.patch | 56 +- .../net/minecraft/src/EntitySheep.java.patch | 42 +- .../net/minecraft/src/Explosion.java.patch | 43 +- .../minecraft/src/FurnaceRecipes.java.patch | 74 +- .../net/minecraft/src/GuiControls.java.patch | 131 +-- .../net/minecraft/src/GuiIngame.java.patch | 31 +- .../net/minecraft/src/Item.java.patch | 69 +- .../net/minecraft/src/ItemBow.java.patch | 34 +- .../net/minecraft/src/ItemBucket.java.patch | 32 +- .../net/minecraft/src/ItemDye.java.patch | 103 +- .../net/minecraft/src/ItemHoe.java.patch | 24 +- .../net/minecraft/src/ItemRenderer.java.patch | 46 +- .../net/minecraft/src/ItemShears.java.patch | 41 +- .../net/minecraft/src/ItemTool.java.patch | 45 +- .../src/MovingObjectPosition.java.patch | 10 +- .../minecraft/src/NetClientHandler.java.patch | 82 +- .../minecraft/src/NetworkManager.java.patch | 22 +- .../minecraft/src/PlayerController.java.patch | 31 +- .../src/PlayerControllerCreative.java.patch | 41 +- .../src/PlayerControllerMP.java.patch | 111 +-- .../src/PlayerControllerSP.java.patch | 120 ++- .../net/minecraft/src/RailLogic.java.patch | 118 +-- .../net/minecraft/src/RenderBlocks.java.patch | 214 ++-- .../net/minecraft/src/RenderEngine.java.patch | 32 +- .../net/minecraft/src/RenderGlobal.java.patch | 32 +- .../net/minecraft/src/RenderItem.java.patch | 224 ++--- .../net/minecraft/src/RenderPlayer.java.patch | 22 +- .../net/minecraft/src/SlotCrafting.java.patch | 16 +- .../minecraft/src/SpawnerAnimals.java.patch | 12 + .../net/minecraft/src/Tessellator.java.patch | 350 ++++--- .../net/minecraft/src/TileEntity.java.patch | 16 +- .../src/TileEntityBrewingStand.java.patch | 18 +- .../src/TileEntityFurnace.java.patch | 119 +-- .../src/TileEntityRendererPiston.java.patch | 23 +- .../net/minecraft/src/World.java.patch | 256 ++--- .../minecraft/src/WorldGenDungeons.java.patch | 41 +- .../minecraft/src/WorldProvider.java.patch | 31 +- .../minecraft/src/WorldProviderEnd.java.patch | 4 +- .../src/WorldProviderHell.java.patch | 4 +- .../src/WorldProviderSurface.java.patch | 8 +- .../minecraft/src/WorldRenderer.java.patch | 125 ++- 75 files changed, 3482 insertions(+), 3567 deletions(-) create mode 100644 forge/patches/minecraft/net/minecraft/src/SpawnerAnimals.java.patch diff --git a/forge/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/forge/patches/minecraft/net/minecraft/client/Minecraft.java.patch index 74de46a99..1e1c0e11c 100644 --- a/forge/patches/minecraft/net/minecraft/client/Minecraft.java.patch +++ b/forge/patches/minecraft/net/minecraft/client/Minecraft.java.patch @@ -1,97 +1,113 @@ --- ../src_base/minecraft/net/minecraft/client/Minecraft.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/client/Minecraft.java 0000-00-00 00:00:00.000000000 -0000 -@@ -1615,70 +1615,47 @@ - - public void usePortal(int i) +@@ -1966,86 +1966,54 @@ + */ + public void usePortal(int par1) { -+ usePortal(i, new Teleporter()); ++ usePortal(par1, new Teleporter()); + } -+ public void usePortal(int i, Teleporter teleporter) ++ ++ public void usePortal(int par1, Teleporter teleporter) + { - int j = thePlayer.dimension; - thePlayer.dimension = i; - theWorld.setEntityDead(thePlayer); - thePlayer.isDead = false; -+ WorldProvider pNew = WorldProvider.getProviderForDimension(i); -+ WorldProvider pOld = WorldProvider.getProviderForDimension(j); - double d = thePlayer.posX; - double d1 = thePlayer.posZ; -- double d2 = 1.0D; -- if (j > -1 && thePlayer.dimension == -1) + int var2 = this.thePlayer.dimension; + this.thePlayer.dimension = par1; + this.theWorld.setEntityDead(this.thePlayer); + this.thePlayer.isDead = false; ++ WorldProvider pNew = WorldProvider.getProviderForDimension(par1); ++ WorldProvider pOld = WorldProvider.getProviderForDimension(var2); + double var3 = this.thePlayer.posX; + double var5 = this.thePlayer.posZ; +- double var7 = 1.0D; +- +- if (var2 > -1 && this.thePlayer.dimension == -1) - { -- d2 = 0.125D; +- var7 = 0.125D; - } -- else if (j == -1 && thePlayer.dimension > -1) +- else if (var2 == -1 && this.thePlayer.dimension > -1) - { -- d2 = 8D; +- var7 = 8.0D; - } -+ double d2 = pOld.getMovementFactor() / pNew.getMovementFactor(); - d *= d2; - d1 *= d2; -- if (thePlayer.dimension == -1) -+ -+ World world = new World(theWorld, pNew); -+ if (thePlayer.isEntityAlive()) +- ++ double var7 = pOld.getMovementFactor() / pNew.getMovementFactor(); + var3 *= var7; + var5 *= var7; +- World var9; ++ World var9 = new World(theWorld, pNew); + +- if (this.thePlayer.dimension == -1) ++ if (this.thePlayer.isEntityAlive()) { -- thePlayer.setLocationAndAngles(d, thePlayer.posY, d1, thePlayer.rotationYaw, thePlayer.rotationPitch); -- if (thePlayer.isEntityAlive()) +- this.thePlayer.setLocationAndAngles(var3, this.thePlayer.posY, var5, this.thePlayer.rotationYaw, this.thePlayer.rotationPitch); +- +- if (this.thePlayer.isEntityAlive()) - { -- theWorld.updateEntityWithOptionalForce(thePlayer, false); +- this.theWorld.updateEntityWithOptionalForce(this.thePlayer, false); - } -- World world = null; -- world = new World(theWorld, WorldProvider.getProviderForDimension(thePlayer.dimension)); -- changeWorld(world, "Entering the Nether", thePlayer); +- +- var9 = null; +- var9 = new World(this.theWorld, WorldProvider.getProviderForDimension(this.thePlayer.dimension)); +- this.changeWorld(var9, "Entering the Nether", this.thePlayer); - } -- else if (thePlayer.dimension == 0) +- else if (this.thePlayer.dimension == 0) - { -- if (thePlayer.isEntityAlive()) +- if (this.thePlayer.isEntityAlive()) - { -- thePlayer.setLocationAndAngles(d, thePlayer.posY, d1, thePlayer.rotationYaw, thePlayer.rotationPitch); -- theWorld.updateEntityWithOptionalForce(thePlayer, false); +- this.thePlayer.setLocationAndAngles(var3, this.thePlayer.posY, var5, this.thePlayer.rotationYaw, this.thePlayer.rotationPitch); +- this.theWorld.updateEntityWithOptionalForce(this.thePlayer, false); - } -- World world1 = null; -- world1 = new World(theWorld, WorldProvider.getProviderForDimension(thePlayer.dimension)); -- if (j == -1) +- +- var9 = null; +- var9 = new World(this.theWorld, WorldProvider.getProviderForDimension(this.thePlayer.dimension)); +- +- if (var2 == -1) - { -- changeWorld(world1, "Leaving the Nether", thePlayer); +- this.changeWorld(var9, "Leaving the Nether", this.thePlayer); - } - else - { -- changeWorld(world1, "Leaving the End", thePlayer); +- this.changeWorld(var9, "Leaving the End", this.thePlayer); - } -+ theWorld.updateEntityWithOptionalForce(thePlayer, false); ++ this.theWorld.updateEntityWithOptionalForce(this.thePlayer, false); } - else + + if (thePlayer.dimension == 1) { -- World world2 = null; -- world2 = new World(theWorld, WorldProvider.getProviderForDimension(thePlayer.dimension)); -- ChunkCoordinates chunkcoordinates = world2.getEntrancePortalLocation(); -+ ChunkCoordinates chunkcoordinates = world.getEntrancePortalLocation(); - d = chunkcoordinates.posX; - thePlayer.posY = chunkcoordinates.posY; - d1 = chunkcoordinates.posZ; -- thePlayer.setLocationAndAngles(d, thePlayer.posY, d1, 90F, 0.0F); -- if (thePlayer.isEntityAlive()) +- var9 = null; +- var9 = new World(this.theWorld, WorldProvider.getProviderForDimension(this.thePlayer.dimension)); + ChunkCoordinates var10 = var9.getEntrancePortalLocation(); + var3 = (double)var10.posX; + this.thePlayer.posY = (double)var10.posY; + var5 = (double)var10.posZ; +- this.thePlayer.setLocationAndAngles(var3, this.thePlayer.posY, var5, 90.0F, 0.0F); +- +- if (this.thePlayer.isEntityAlive()) - { -- world2.updateEntityWithOptionalForce(thePlayer, false); +- var9.updateEntityWithOptionalForce(this.thePlayer, false); - } -- changeWorld(world2, "Entering the End", thePlayer); +- +- this.changeWorld(var9, "Entering the End", this.thePlayer); + } + + if (thePlayer.dimension == 0) + { -+ changeWorld(world, pOld.getDepartMessage(), thePlayer); ++ changeWorld(var9, pOld.getDepartMessage(), thePlayer); + } + else + { -+ changeWorld(world, pNew.getWelcomeMessage(), thePlayer); ++ changeWorld(var9, pOld.getWelcomeMessage(), thePlayer); } - thePlayer.worldObj = theWorld; - System.out.println((new StringBuilder()).append("Teleported to ").append(theWorld.worldProvider.worldType).toString()); -- if (thePlayer.isEntityAlive() && j < 1) -+ if (thePlayer.isEntityAlive()) + + this.thePlayer.worldObj = this.theWorld; + System.out.println("Teleported to " + this.theWorld.worldProvider.worldType); + +- if (this.thePlayer.isEntityAlive() && var2 < 1) ++ if (this.thePlayer.isEntityAlive()) { - thePlayer.setLocationAndAngles(d, thePlayer.posY, d1, thePlayer.rotationYaw, thePlayer.rotationPitch); - theWorld.updateEntityWithOptionalForce(thePlayer, false); + this.thePlayer.setLocationAndAngles(var3, this.thePlayer.posY, var5, this.thePlayer.rotationYaw, this.thePlayer.rotationPitch); + this.theWorld.updateEntityWithOptionalForce(this.thePlayer, false); +- (new Teleporter()).placeInPortal(this.theWorld, this.thePlayer); ++ teleporter.placeInPortal(this.theWorld, this.thePlayer); + } + } + diff --git a/forge/patches/minecraft/net/minecraft/src/Block.java.patch b/forge/patches/minecraft/net/minecraft/src/Block.java.patch index 908627e61..8a65d536c 100644 --- a/forge/patches/minecraft/net/minecraft/src/Block.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/Block.java.patch @@ -7,181 +7,277 @@ import java.util.ArrayList; import java.util.Random; -@@ -277,12 +278,12 @@ +@@ -361,7 +362,7 @@ - public float getBlockBrightness(IBlockAccess iblockaccess, int i, int j, int k) + public static boolean func_48206_g(int par0) { -- return iblockaccess.getBrightness(i, j, k, lightValue[blockID]); -+ return iblockaccess.getBrightness(i, j, k, getLightValue(iblockaccess,i,j,k)); +- Block var1 = blocksList[par0]; ++ Block var1 = blocksList[par0]; + return var1 == null ? false : var1.blockMaterial.isOpaque() && var1.renderAsNormalBlock(); } - public int getMixedBrightnessForBlock(IBlockAccess iblockaccess, int i, int j, int k) +@@ -434,7 +435,7 @@ + + public boolean func_48205_p() { -- return iblockaccess.getLightBrightnessForSkyBlocks(i, j, k, lightValue[blockID]); -+ return iblockaccess.getLightBrightnessForSkyBlocks(i, j, k, getLightValue(iblockaccess,i,j,k)); +- return this.field_48207_bU; ++ return hasTileEntity(0); } - public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) -@@ -410,20 +411,15 @@ - return blockID; + /** +@@ -455,7 +456,7 @@ + */ + public float getBlockBrightness(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { +- return par1IBlockAccess.getBrightness(par2, par3, par4, lightValue[this.blockID]); ++ return par1IBlockAccess.getBrightness(par2, par3, par4, getLightValue(par1IBlockAccess, par2, par3, par4)); } -+ /** + /** +@@ -463,7 +464,7 @@ + */ + public int getMixedBrightnessForBlock(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { +- return par1IBlockAccess.getLightBrightnessForSkyBlocks(par2, par3, par4, lightValue[this.blockID]); ++ return par1IBlockAccess.getLightBrightnessForSkyBlocks(par2, par3, par4, getLightValue(par1IBlockAccess, par2, par3, par4)); + } + + /** +@@ -620,11 +621,14 @@ + } + + /** +- * Defines whether or not a play can break the block with current tool. + * Deprecated in favor of a metadata sensitive version + * @param entityplayer Entity attacking the block + * @return -+ */ + */ + @Deprecated - public float blockStrength(EntityPlayer entityplayer) + public float blockStrength(EntityPlayer par1EntityPlayer) { -- if (blockHardness < 0.0F) -- { -- return 0.0F; -- } -- if (!entityplayer.canHarvestBlock(this)) -- { -- return 1.0F / blockHardness / 100F; -- } -- else -- { -- return entityplayer.getCurrentPlayerStrVsBlock(this) / blockHardness / 30F; -- } -+ return blockStrength(entityplayer, 0); +- return this.blockHardness < 0.0F ? 0.0F : (!par1EntityPlayer.canHarvestBlock(this) ? 1.0F / this.blockHardness / 100.0F : par1EntityPlayer.getCurrentPlayerStrVsBlock(this) / this.blockHardness / 30.0F); ++ return blockStrength(par1EntityPlayer, 0); } - public final void dropBlockAsItem(World world, int i, int j, int k, int l, int i1) -@@ -437,18 +433,15 @@ + /** +@@ -644,16 +648,12 @@ { - return; - } -- int j1 = quantityDroppedWithBonus(i1, world.rand); -- for (int k1 = 0; k1 < j1; k1++) -+ -+ ArrayList items = getBlockDropped(world, i, j, k, l, i1); -+ for(ItemStack item : items) - { - if (world.rand.nextFloat() > f) + int var8 = this.quantityDroppedWithBonus(par7, par1World.rand); + +- for (int var9 = 0; var9 < var8; ++var9) ++ ArrayList items = getBlockDropped(par1World, par2, par3, par4, par5, par7); ++ for (ItemStack item : items) { - continue; + if (par1World.rand.nextFloat() <= par6) + { +- int var10 = this.idDropped(par5, par1World.rand, par7); +- +- if (var10 > 0) +- { +- this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(var10, 1, this.damageDropped(par5))); +- } ++ this.dropBlockAsItem_do(par1World, par2, par3, par4, item); + } } -- int l1 = idDropped(l, world.rand, i1); -- if (l1 > 0) -- { -- dropBlockAsItem_do(world, i, j, k, new ItemStack(l1, 1, damageDropped(l))); -- } -+ dropBlockAsItem_do(world, i, j, k, item); } - } +@@ -963,7 +963,7 @@ + par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); + par2EntityPlayer.addExhaustion(0.025F); -@@ -696,7 +689,7 @@ - { - entityplayer.addStat(StatList.mineBlockStatArray[blockID], 1); - entityplayer.addExhaustion(0.025F); -- if (renderAsNormalBlock() && !isBlockContainer[blockID] && EnchantmentHelper.getSilkTouchModifier(entityplayer.inventory)) -+ if (renderAsNormalBlock() && !hasTileEntity(l) && EnchantmentHelper.getSilkTouchModifier(entityplayer.inventory)) +- if (this.renderAsNormalBlock() && !this.field_48207_bU && EnchantmentHelper.getSilkTouchModifier(par2EntityPlayer.inventory)) ++ if (this.renderAsNormalBlock() && !hasTileEntity(par6) && EnchantmentHelper.getSilkTouchModifier(par2EntityPlayer.inventory)) { - ItemStack itemstack = createStackedBlock(l); - if (itemstack != null) -@@ -780,6 +773,273 @@ - { - } + ItemStack var8 = this.createStackedBlock(par6); -+ /* FORGE: Allow a block to set illumination on a coordinate basis. +@@ -1077,6 +1077,361 @@ + */ + public void onFallenUpon(World par1World, int par2, int par3, int par4, Entity par5Entity, float par6) {} + ++ /** ++ * Get a light value for this block, normal ranges are between 0 and 15 ++ * ++ * @param world The current world ++ * @param x X Position ++ * @param y Y position ++ * @param z Z position ++ * @return The light value + */ -+ public int getLightValue(IBlockAccess iba, int i, int j, int k) { ++ public int getLightValue(IBlockAccess world, int x, int y, int z) ++ { + return lightValue[blockID]; + } + -+ /* FORGE: Implement and return true if you wish this block to behave -+ * like a ladder when the player is inside. ++ /** ++ * Checks if a player or entity can use this block to 'climb' like a ladder. ++ * ++ * @param world The current world ++ * @param x X Position ++ * @param y Y position ++ * @param z Z position ++ * @return True if the block should act like a ladder + */ -+ public boolean isLadder(World world, int i, int j, int k) { ++ public boolean isLadder(World world, int x, int y, int z) ++ { + return false; + } -+ -+ /* FORGE: Return true if the block is a normal, solid cube. This ++ ++ /** ++ * Return true if the block is a normal, solid cube. This + * determines indirect power state, entity ejection from blocks, and a few + * others. ++ * ++ * @param world The current world ++ * @param x X Position ++ * @param y Y position ++ * @param z Z position ++ * @return True if the block is a full cube + */ -+ public boolean isBlockNormalCube(World world, int i, int j, int k) { ++ public boolean isBlockNormalCube(World world, int x, int y, int z) ++ { + return blockMaterial.isOpaque() && renderAsNormalBlock(); + } + -+ /* FORGE: Return true if the block is solid on the given side. This -+ * is used by placement logic. */ -+ public boolean isBlockSolidOnSide( World world, int i, int j, int k, -+ int side ) { -+ return isBlockNormalCube(world,i,j,k); ++ /** ++ * Checks if the block is a solid face on the given side, used by placement logic. ++ * ++ * @param world The current world ++ * @param x X Position ++ * @param y Y position ++ * @param z Z position ++ * @param size 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, int side) ++ { ++ return isBlockNormalCube(world, x, y, z); + } + -+ /* FORGE: Return true if the player can place a new block in the block -+ * occupied by this one, like water, lava, fire, etc. ++ /** ++ * Determines if a new block can be replace the space occupied by this one, ++ * Used in the player's placement code to make the block act like water, and lava. ++ * ++ * @param world The current world ++ * @param x X Position ++ * @param y Y position ++ * @param z Z position ++ * @return True if the block is replaceable by another block + */ -+ public boolean isBlockReplaceable( World world, int i, int j, int k ) { ++ public boolean isBlockReplaceable(World world, int x, int y, int z) ++ { + return false; + } + -+ /* FORGE: Return true if this block should set fire and deal fire damage -+ * to entities coming into contact with it, false otherwise. ++ /** ++ * Determines if this block should set fire and deal fire damage ++ * to entities coming into contact with it. ++ * ++ * @param world The current world ++ * @param x X Position ++ * @param y Y position ++ * @param z Z position ++ * @return True if the block should deal damage + */ -+ public boolean isBlockBurning( World world, int i, int j, int k ) { ++ public boolean isBlockBurning(World world, int x, int y, int z) ++ { + return false; + } -+ -+ /* FORGE: Return true if this block should be treated as an air block -+ * by the rest of the code, false otherwise. This method is primarily ++ ++ /** ++ * Determines this block should be treated as an air block ++ * by the rest of the code. This method is primarily + * useful for creating pure logic-blocks that will be invisible -+ * to the player and otherwise interact as air would. -+ */ -+ public boolean isAirBlock( World world, int i, int j, int k ) { ++ * to the player and otherwise interact as air would. ++ * ++ * @param world The current world ++ * @param x X Position ++ * @param y Y position ++ * @param z Z position ++ * @return True if the block considered air ++ */ ++ public boolean isAirBlock(World world, int x, int y, int z) ++ { + return false; + } + -+ /* FORGE: Return the block hardness with metadata md. ++ /** ++ * Metadata sensitive version of the default getHardness function. ++ * ++ * @param meta The block's current metatdata ++ * @return Block hardness + */ -+ public float getHardness(int md) { ++ public float getHardness(int meta) ++ { + return blockHardness; + } + -+ /* FORGE: Return the block strength of the block at i,j,k against the -+ * player. ++ /** ++ * Determines this block's strength against being destroyed by a player. ++ * ++ * @param world The current world ++ * @param player The player damaging the block, may be null ++ * @param x X Position ++ * @param y Y position ++ * @param z Z position ++ * @return A value + */ -+ public float blockStrength(World world, EntityPlayer player, -+ int i, int j, int k) { -+ int md=world.getBlockMetadata(i,j,k); -+ return blockStrength(player,md); ++ public float blockStrength(World world, EntityPlayer player, int x, int y, int z) ++ { ++ return blockStrength(player, world.getBlockMetadata(x, y, z)); + } + -+ /* FORGE: Return the block strength of a prototypical block with metadata -+ * md against the player. ++ /** ++ * Determines this block's strength against being destroyed by a player. ++ * ++ * @param player The player damaging the block, may be null ++ * @param meta The block's current metadata ++ * @return The larger the value, the faster it breaks. + */ -+ public float blockStrength(EntityPlayer player, int md) { -+ return ForgeHooks.blockStrength(this,player,md); ++ public float blockStrength(EntityPlayer player, int meta) ++ { ++ return ForgeHooks.blockStrength(this, player, meta); + } + -+ /* FORGE: Return true if the player can harvest a prototypical block with -+ * metadata md. ++ /** ++ * Determines if the player can harvest this block, obtaining it's drops when the block is destroyed. ++ * ++ * @param player The player damaging the block, may be null ++ * @param meta The block's current metadata ++ * @return True tospawn the drops + */ -+ public boolean canHarvestBlock(EntityPlayer player, int md) { -+ return ForgeHooks.canHarvestBlock(this,player,md); ++ public boolean canHarvestBlock(EntityPlayer player, int meta) ++ { ++ return ForgeHooks.canHarvestBlock(this, player, meta); + } + -+ /* FORGE: Called when a player removes a block. This is responsible for ++ /** ++ * Called when a player removes a block. This is responsible for + * actually destroying the block, and the block is intact at time of call. + * This is called regardless of whether the player can harvest the block or -+ * not. Return true if the block is actually destroyed. ++ * not. ++ * ++ * Return true if the block is actually destroyed. + * + * Note: When used in multiplayer, this is called on both client and + * server sides! ++ * ++ * @param world The current world ++ * @param player The player damaging the block, may be null ++ * @param x X Position ++ * @param y Y position ++ * @param z Z position ++ * @return True if the block is actually destroyed. + */ -+ public boolean removeBlockByPlayer(World world, EntityPlayer player, -+ int i, int j, int k) { -+ return world.setBlockWithNotify(i, j, k, 0); ++ public boolean removeBlockByPlayer(World world, EntityPlayer player, int x, int y, int z) ++ { ++ return world.setBlockWithNotify(x, y, z, 0); + } -+ -+ /* FORGE: Called when a new CreativeContainer is opened, populate the list ++ ++ /** ++ * 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. + */ + public void addCreativeItems(ArrayList itemList) + { @@ -291,7 +387,7 @@ + */ + public boolean hasTileEntity(int metadata) + { -+ return isBlockContainer[blockID]; ++ return field_48207_bU; + } + + /** @@ -329,14 +425,14 @@ + * This returns a complete list of items dropped from this block. + * + * @param world The current world -+ * @param X X Position ++ * @param x X Position + * @param Y Y Position + * @param Z Z Position + * @param metadata Current metadata + * @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 getBlockDropped(World world, int x, int y, int z, int metadata, int fortune) + { + ArrayList ret = new ArrayList(); + @@ -351,8 +447,7 @@ + } + return ret; + } -+ -+ - static Class _mthclass$(String s) ++ + static { - try + Item.itemsList[cloth.blockID] = (new ItemCloth(cloth.blockID - 256)).setItemName("cloth"); diff --git a/forge/patches/minecraft/net/minecraft/src/BlockButton.java.patch b/forge/patches/minecraft/net/minecraft/src/BlockButton.java.patch index 2cc64bae7..5bf8dad2f 100644 --- a/forge/patches/minecraft/net/minecraft/src/BlockButton.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/BlockButton.java.patch @@ -1,119 +1,90 @@ --- ../src_base/minecraft/net/minecraft/src/BlockButton.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/BlockButton.java 0000-00-00 00:00:00.000000000 -0000 -@@ -32,36 +32,36 @@ +@@ -46,7 +46,10 @@ - public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l) + public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5) { -- if (l == 2 && world.isBlockNormalCube(i, j, k + 1)) -+ if (l == 2 && world.isBlockSolidOnSide(i, j, k + 1, 2)) - { - return true; - } -- if (l == 3 && world.isBlockNormalCube(i, j, k - 1)) -+ if (l == 3 && world.isBlockSolidOnSide(i, j, k - 1, 3)) - { - return true; - } -- if (l == 4 && world.isBlockNormalCube(i + 1, j, k)) -+ if (l == 4 && world.isBlockSolidOnSide(i + 1, j, k, 4)) - { - return true; - } -- return l == 5 && world.isBlockNormalCube(i - 1, j, k); -+ return l == 5 && world.isBlockSolidOnSide(i - 1, j, k, 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))); ++ return (par5 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2)) || ++ (par5 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3)) || ++ (par5 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4)) || ++ (par5 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 5)); } - public boolean canPlaceBlockAt(World world, int i, int j, int k) + /** +@@ -54,7 +57,10 @@ + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) { -- if (world.isBlockNormalCube(i - 1, j, k)) -+ if (world.isBlockSolidOnSide(i - 1, j, k, 5)) - { - return true; - } -- if (world.isBlockNormalCube(i + 1, j, k)) -+ if (world.isBlockSolidOnSide(i + 1, j, k, 4)) - { - return true; - } -- if (world.isBlockNormalCube(i, j, k - 1)) -+ if (world.isBlockSolidOnSide(i, j, k - 1, 3)) - { - return true; - } -- return world.isBlockNormalCube(i, j, k + 1); -+ return world.isBlockSolidOnSide(i, j, k + 1, 2); +- 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, 5) || ++ par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4) || ++ par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3) || ++ par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2); } - public void onBlockPlaced(World world, int i, int j, int k, int l) -@@ -69,19 +69,19 @@ - int i1 = world.getBlockMetadata(i, j, k); - int j1 = i1 & 8; - i1 &= 7; -- if (l == 2 && world.isBlockNormalCube(i, j, k + 1)) -+ if (l == 2 && world.isBlockSolidOnSide(i, j, k + 1, 2)) - { - i1 = 4; - } -- else if (l == 3 && world.isBlockNormalCube(i, j, k - 1)) -+ else if (l == 3 && world.isBlockSolidOnSide(i, j, k - 1, 3)) - { - i1 = 3; - } -- else if (l == 4 && world.isBlockNormalCube(i + 1, j, k)) -+ else if (l == 4 && world.isBlockSolidOnSide(i + 1, j, k, 4)) - { - i1 = 2; - } -- else if (l == 5 && world.isBlockNormalCube(i - 1, j, k)) -+ else if (l == 5 && world.isBlockSolidOnSide(i - 1, j, k, 5)) - { - i1 = 1; - } -@@ -94,19 +94,19 @@ + /** +@@ -67,19 +73,19 @@ + int var7 = var6 & 8; + var6 &= 7; - private int getOrientation(World world, int i, int j, int k) +- if (par5 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1)) ++ if (par5 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2)) + { + var6 = 4; + } +- else if (par5 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1)) ++ else if (par5 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3)) + { + var6 = 3; + } +- else if (par5 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4)) ++ else if (par5 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4)) + { + var6 = 2; + } +- else if (par5 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4)) ++ else if (par5 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 5)) + { + var6 = 1; + } +@@ -96,7 +102,11 @@ + */ + private int getOrientation(World par1World, int par2, int par3, int par4) { -- if (world.isBlockNormalCube(i - 1, j, k)) -+ if (world.isBlockSolidOnSide(i - 1, j, k, 5)) - { - return 1; - } -- if (world.isBlockNormalCube(i + 1, j, k)) -+ if (world.isBlockSolidOnSide(i + 1, j, k, 4)) - { - return 2; - } -- if (world.isBlockNormalCube(i, j, k - 1)) -+ if (world.isBlockSolidOnSide(i, j, k - 1, 3)) - { - return 3; - } -- return !world.isBlockNormalCube(i, j, k + 1) ? 1 : 4; -+ return !world.isBlockSolidOnSide(i, j, k + 1, 2) ? 1 : 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, 5)) return 1; ++ if (par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4)) return 2; ++ if (par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3)) return 3; ++ if (par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2)) return 4; ++ return 1; } - public void onNeighborBlockChange(World world, int i, int j, int k, int l) -@@ -115,19 +115,19 @@ - { - int i1 = world.getBlockMetadata(i, j, k) & 7; - boolean flag = false; -- if (!world.isBlockNormalCube(i - 1, j, k) && i1 == 1) -+ if (!world.isBlockSolidOnSide(i - 1, j, k, 5) && i1 == 1) + /** +@@ -110,22 +120,22 @@ + int var6 = par1World.getBlockMetadata(par2, par3, par4) & 7; + boolean var7 = false; + +- if (!par1World.isBlockNormalCube(par2 - 1, par3, par4) && var6 == 1) ++ if (!par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 5) && var6 == 1) { - flag = true; + var7 = true; } -- if (!world.isBlockNormalCube(i + 1, j, k) && i1 == 2) -+ if (!world.isBlockSolidOnSide(i + 1, j, k, 4) && i1 == 2) + +- if (!par1World.isBlockNormalCube(par2 + 1, par3, par4) && var6 == 2) ++ if (!par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4) && var6 == 2) { - flag = true; + var7 = true; } -- if (!world.isBlockNormalCube(i, j, k - 1) && i1 == 3) -+ if (!world.isBlockSolidOnSide(i, j, k - 1, 3) && i1 == 3) + +- if (!par1World.isBlockNormalCube(par2, par3, par4 - 1) && var6 == 3) ++ if (!par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3) && var6 == 3) { - flag = true; + var7 = true; } -- if (!world.isBlockNormalCube(i, j, k + 1) && i1 == 4) -+ if (!world.isBlockSolidOnSide(i, j, k + 1, 2) && i1 == 4) + +- if (!par1World.isBlockNormalCube(par2, par3, par4 + 1) && var6 == 4) ++ if (!par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2) && var6 == 4) { - flag = true; + var7 = true; } diff --git a/forge/patches/minecraft/net/minecraft/src/BlockChest.java.patch b/forge/patches/minecraft/net/minecraft/src/BlockChest.java.patch index b29f42a85..4e552fb55 100644 --- a/forge/patches/minecraft/net/minecraft/src/BlockChest.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/BlockChest.java.patch @@ -1,31 +1,31 @@ --- ../src_base/minecraft/net/minecraft/src/BlockChest.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/BlockChest.java 0000-00-00 00:00:00.000000000 -0000 -@@ -424,23 +424,23 @@ +@@ -494,23 +494,23 @@ { return true; } -- if (world.isBlockNormalCube(i, j + 1, k)) -+ if (world.isBlockSolidOnSide(i, j + 1, k, 0)) +- else if (par1World.isBlockNormalCube(par2, par3 + 1, par4)) ++ else if (par1World.isBlockSolidOnSide(par2, par3 + 1, par4, 0)) { return true; } -- if (world.getBlockId(i - 1, j, k) == blockID && world.isBlockNormalCube(i - 1, j + 1, k)) -+ if (world.getBlockId(i - 1, j, k) == blockID && world.isBlockSolidOnSide(i - 1, j + 1, k, 0)) +- else if (par1World.getBlockId(par2 - 1, par3, par4) == this.blockID && par1World.isBlockNormalCube(par2 - 1, par3 + 1, par4)) ++ else if (par1World.getBlockId(par2 - 1, par3, par4) == this.blockID && par1World.isBlockSolidOnSide(par2 - 1, par3 + 1, par4, 0)) { return true; } -- if (world.getBlockId(i + 1, j, k) == blockID && world.isBlockNormalCube(i + 1, j + 1, k)) -+ if (world.getBlockId(i + 1, j, k) == blockID && world.isBlockSolidOnSide(i + 1, j + 1, k, 0)) +- else if (par1World.getBlockId(par2 + 1, par3, par4) == this.blockID && par1World.isBlockNormalCube(par2 + 1, par3 + 1, par4)) ++ else if (par1World.getBlockId(par2 + 1, par3, par4) == this.blockID && par1World.isBlockSolidOnSide(par2 + 1, par3 + 1, par4, 0)) { return true; } -- if (world.getBlockId(i, j, k - 1) == blockID && world.isBlockNormalCube(i, j + 1, k - 1)) -+ if (world.getBlockId(i, j, k - 1) == blockID && world.isBlockSolidOnSide(i, j + 1, k - 1, 0)) +- else if (par1World.getBlockId(par2, par3, par4 - 1) == this.blockID && par1World.isBlockNormalCube(par2, par3 + 1, par4 - 1)) ++ else if (par1World.getBlockId(par2, par3, par4 - 1) == this.blockID && par1World.isBlockSolidOnSide(par2, par3 + 1, par4 - 1, 0)) { return true; } -- if (world.getBlockId(i, j, k + 1) == blockID && world.isBlockNormalCube(i, j + 1, k + 1)) -+ if (world.getBlockId(i, j, k + 1) == blockID && world.isBlockSolidOnSide(i, j + 1, k + 1, 0)) +- else if (par1World.getBlockId(par2, par3, par4 + 1) == this.blockID && par1World.isBlockNormalCube(par2, par3 + 1, par4 + 1)) ++ else if (par1World.getBlockId(par2, par3, par4 + 1) == this.blockID && par1World.isBlockSolidOnSide(par2, par3 + 1, par4 + 1, 0)) { return true; } diff --git a/forge/patches/minecraft/net/minecraft/src/BlockContainer.java.patch b/forge/patches/minecraft/net/minecraft/src/BlockContainer.java.patch index f31e1ec4e..02ef26825 100644 --- a/forge/patches/minecraft/net/minecraft/src/BlockContainer.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/BlockContainer.java.patch @@ -1,30 +1,26 @@ --- ../src_base/minecraft/net/minecraft/src/BlockContainer.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/BlockContainer.java 0000-00-00 00:00:00.000000000 -0000 -@@ -17,7 +17,7 @@ - public void onBlockAdded(World world, int i, int j, int k) +@@ -20,7 +20,7 @@ + public void onBlockAdded(World par1World, int par2, int par3, int par4) { - super.onBlockAdded(world, i, j, k); -- world.setBlockTileEntity(i, j, k, getBlockEntity()); -+ world.setBlockTileEntity(i, j, k, getBlockEntity(world.getBlockMetadata(i,j,k))); + super.onBlockAdded(par1World, par2, par3, par4); +- par1World.setBlockTileEntity(par2, par3, par4, this.getBlockEntity()); ++ par1World.setBlockTileEntity(par2, par3, par4, this.getBlockEntity(par1World.getBlockMetadata(par2, par3, par4))); } - public void onBlockRemoval(World world, int i, int j, int k) -@@ -28,6 +28,18 @@ - - public abstract TileEntity getBlockEntity(); - -+ /* FORGE: Metadata-sensitive version, to fix 1.8.1 regression. -+ */ + /** +@@ -47,4 +47,14 @@ + var7.onTileEntityPowered(par5, par6); + } + } ++ + /** + * Metadata-sensitive version, to fix 1.8.1 regression. -+ * @param metadata The current Metadata ++ * @param meta The current Metadata + * @return And instance of the TileEntity class for this block + */ -+ public TileEntity getBlockEntity(int md) ++ public TileEntity getBlockEntity(int meta) + { -+ return getBlockEntity(); ++ return getBlockEntity(); + } -+ - public void powerBlock(World world, int i, int j, int k, int l, int i1) - { - super.powerBlock(world, i, j, k, l, i1); + } diff --git a/forge/patches/minecraft/net/minecraft/src/BlockCrops.java.patch b/forge/patches/minecraft/net/minecraft/src/BlockCrops.java.patch index c3c30f1ab..d4871159c 100644 --- a/forge/patches/minecraft/net/minecraft/src/BlockCrops.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/BlockCrops.java.patch @@ -8,41 +8,48 @@ public class BlockCrops extends BlockFlower { -@@ -98,27 +99,23 @@ +@@ -129,31 +130,24 @@ return 6; } -- public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f, int i1) +- /** +- * 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) + @Override -+ public ArrayList getBlockDropped(World world, int i, int j, int k, int meta, int fortune) ++ public ArrayList getBlockDropped(World world, int x, int y, int z, int metadata, int fortune) { -- super.dropBlockAsItemWithChance(world, i, j, k, l, f, 0); -- if (world.isRemote) -+ ArrayList ret = new ArrayList(); -+ if (meta == 7) +- super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0); +- +- if (!par1World.isRemote) ++ ArrayList ret = new ArrayList(); ++ if (metadata == 7) { -- return; -+ ret.add(new ItemStack(Item.wheat)); - } -- int j1 = 3 + i1; -- for (int k1 = 0; k1 < j1; k1++) +- int var8 = 3 + par7; +- +- for (int var9 = 0; var9 < var8; ++var9) ++ ret.add(new ItemStack(Item.wheat)); ++ } + + for (int n = 0; n < 3 + fortune; n++) - { -- if (world.rand.nextInt(15) <= l) -+ if (world.rand.nextInt(15) <= meta) ++ { ++ if (world.rand.nextInt(15) <= metadata) { -- float f1 = 0.7F; -- float f2 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F; -- float f3 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F; -- float f4 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F; -- EntityItem entityitem = new EntityItem(world, (float)i + f2, (float)j + f3, (float)k + f4, new ItemStack(Item.seeds)); -- entityitem.delayBeforeCanPickup = 10; -- world.spawnEntityInWorld(entityitem); +- if (par1World.rand.nextInt(15) <= par5) +- { +- float var10 = 0.7F; +- float var11 = par1World.rand.nextFloat() * var10 + (1.0F - var10) * 0.5F; +- float var12 = par1World.rand.nextFloat() * var10 + (1.0F - var10) * 0.5F; +- float var13 = par1World.rand.nextFloat() * var10 + (1.0F - var10) * 0.5F; +- EntityItem var14 = new EntityItem(par1World, (double)((float)par2 + var11), (double)((float)par3 + var12), (double)((float)par4 + var13), new ItemStack(Item.seeds)); +- var14.delayBeforeCanPickup = 10; +- par1World.spawnEntityInWorld(var14); +- } + ret.add(new ItemStack(Item.seeds)); } } ++ + return ret; } - public int idDropped(int i, Random random, int j) + /** diff --git a/forge/patches/minecraft/net/minecraft/src/BlockDoor.java.patch b/forge/patches/minecraft/net/minecraft/src/BlockDoor.java.patch index 9d4b49e4b..a6bfe28be 100644 --- a/forge/patches/minecraft/net/minecraft/src/BlockDoor.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/BlockDoor.java.patch @@ -1,29 +1,29 @@ --- ../src_base/minecraft/net/minecraft/src/BlockDoor.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/BlockDoor.java 0000-00-00 00:00:00.000000000 -0000 -@@ -101,7 +101,7 @@ +@@ -240,7 +240,7 @@ { - if (blockMaterial == Material.iron) + if (this.blockMaterial == Material.iron) { - return true; + return false; - } - int l = world.getBlockMetadata(i, j, k); - if ((l & 8) != 0) -@@ -169,7 +169,7 @@ - world.setBlockWithNotify(i, j, k, 0); - flag = true; - } -- if (!world.isBlockNormalCube(i, j - 1, k)) -+ if (!world.isBlockSolidOnSide(i, j - 1, k, 1)) - { - world.setBlockWithNotify(i, j, k, 0); - flag = true; -@@ -238,7 +238,7 @@ } else { -- return world.isBlockNormalCube(i, j - 1, k) && super.canPlaceBlockAt(world, i, j, k) && super.canPlaceBlockAt(world, i, j + 1, k); -+ return world.isBlockSolidOnSide(i, j - 1, k, 1) && super.canPlaceBlockAt(world, i, j, k) && super.canPlaceBlockAt(world, i, j + 1, k); - } +@@ -322,7 +322,7 @@ + var7 = true; + } + +- if (!par1World.isBlockNormalCube(par2, par3 - 1, par4)) ++ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1)) + { + par1World.setBlockWithNotify(par2, par3, par4, 0); + var7 = true; +@@ -375,7 +375,7 @@ + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + { +- return par3 >= 255 ? false : par1World.isBlockNormalCube(par2, par3 - 1, par4) && super.canPlaceBlockAt(par1World, par2, par3, par4) && super.canPlaceBlockAt(par1World, par2, par3 + 1, par4); ++ return par3 >= 255 ? false : par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1) && super.canPlaceBlockAt(par1World, par2, par3, par4) && super.canPlaceBlockAt(par1World, par2, par3 + 1, par4); } + /** diff --git a/forge/patches/minecraft/net/minecraft/src/BlockFire.java.patch b/forge/patches/minecraft/net/minecraft/src/BlockFire.java.patch index 4950a94ee..e4fc9122e 100644 --- a/forge/patches/minecraft/net/minecraft/src/BlockFire.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/BlockFire.java.patch @@ -1,297 +1,280 @@ --- ../src_base/minecraft/net/minecraft/src/BlockFire.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/BlockFire.java 0000-00-00 00:00:00.000000000 -0000 -@@ -10,8 +10,8 @@ - protected BlockFire(int i, int j) +@@ -5,13 +5,13 @@ + public class BlockFire extends Block + { + /** The chance this block will encourage nearby blocks to catch on fire */ +- private int[] chanceToEncourageFire = new int[256]; ++ private int[] chanceToEncourageFire = Block.blockFireSpreadSpeed; + + /** + * This is an array indexed by block ID the larger the number in the array the more likely a block type will catch + * fires + */ +- private int[] abilityToCatchFire = new int[256]; ++ private int[] abilityToCatchFire = Block.blockFlammability; + + protected BlockFire(int par1, int par2) { - super(i, j, Material.fire); -- chanceToEncourageFire = new int[256]; -- abilityToCatchFire = new int[256]; -+ chanceToEncourageFire = Block.blockFireSpreadSpeed; -+ abilityToCatchFire = Block.blockFlammability; - setTickOnLoad(true); +@@ -44,8 +44,7 @@ + */ + private void setBurnRate(int par1, int par2, int par3) + { +- this.chanceToEncourageFire[par1] = par2; +- this.abilityToCatchFire[par1] = par3; ++ Block.setBurnProperties(par1, par2, par3); } -@@ -28,11 +28,10 @@ - setBurnRate(Block.cloth.blockID, 30, 60); - setBurnRate(Block.vine.blockID, 15, 100); - } + /** +@@ -103,8 +102,9 @@ + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { +- boolean var6 = par1World.getBlockId(par2, par3 - 1, par4) == Block.netherrack.blockID; - -+ - private void setBurnRate(int i, int j, int k) - { -- chanceToEncourageFire[i] = j; -- abilityToCatchFire[i] = k; -+ Block.setBurnProperties(i, j, k); - } - - public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k) -@@ -67,7 +66,9 @@ - - public void updateTick(World world, int i, int j, int k, Random random) - { -- boolean flag = world.getBlockId(i, j - 1, k) == Block.netherrack.blockID; -+ Block base = Block.blocksList[world.getBlockId(i, j - 1, k)]; -+ boolean flag = (base != null && base.isFireSource(world, i, j - 1, k, world.getBlockMetadata(i, j - 1, k), 0)); -+ - if ((world.worldProvider instanceof WorldProviderEnd) && world.getBlockId(i, j - 1, k) == Block.bedrock.blockID) ++ Block base = Block.blocksList[par1World.getBlockId(par2, par3 - 1, par4)]; ++ boolean var6 = (base != null && base.isFireSource(par1World, par2, par3 - 1, par4, par1World.getBlockMetadata(par2, par3 - 1, par4), 0)); ++ + if (par1World.worldProvider instanceof WorldProviderEnd && par1World.getBlockId(par2, par3 - 1, par4) == Block.bedrock.blockID) { - flag = true; -@@ -89,23 +90,23 @@ - world.scheduleBlockUpdate(i, j, k, blockID, tickRate()); - if (!flag && !canNeighborBurn(world, i, j, k)) - { -- if (!world.isBlockNormalCube(i, j - 1, k) || l > 3) -+ if (!world.isBlockSolidOnSide(i, j - 1, k, 1) || l > 3) + var6 = true; +@@ -132,12 +132,12 @@ + + if (!var6 && !this.canNeighborBurn(par1World, par2, par3, par4)) { - world.setBlockWithNotify(i, j, k, 0); +- if (!par1World.isBlockNormalCube(par2, par3 - 1, par4) || var7 > 3) ++ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1) || var7 > 3) + { + par1World.setBlockWithNotify(par2, par3, par4, 0); + } } - return; - } -- if (!flag && !canBlockCatchFire(world, i, j - 1, k) && l == 15 && random.nextInt(4) == 0) -+ if (!flag && !canBlockCatchFire(world, i, j - 1, k, 1) && l == 15 && random.nextInt(4) == 0) - { - world.setBlockWithNotify(i, j, k, 0); - return; - } -- tryToCatchBlockOnFire(world, i + 1, j, k, 300, random, l); -- tryToCatchBlockOnFire(world, i - 1, j, k, 300, random, l); -- tryToCatchBlockOnFire(world, i, j - 1, k, 250, random, l); -- tryToCatchBlockOnFire(world, i, j + 1, k, 250, random, l); -- tryToCatchBlockOnFire(world, i, j, k - 1, 300, random, l); -- tryToCatchBlockOnFire(world, i, j, k + 1, 300, random, l); -+ tryToCatchBlockOnFire(world, i + 1, j, k, 300, random, l, 4); -+ tryToCatchBlockOnFire(world, i - 1, j, k, 300, random, l, 5); -+ tryToCatchBlockOnFire(world, i, j - 1, k, 250, random, l, 1); -+ tryToCatchBlockOnFire(world, i, j + 1, k, 250, random, l, 0); -+ tryToCatchBlockOnFire(world, i, j, k - 1, 300, random, l, 3); -+ tryToCatchBlockOnFire(world, i, j, k + 1, 300, random, l, 2); - for (int i1 = i - 1; i1 <= i + 1; i1++) - { - for (int j1 = k - 1; j1 <= k + 1; j1++) -@@ -142,9 +143,24 @@ +- else if (!var6 && !this.canBlockCatchFire(par1World, par2, par3 - 1, par4) && var7 == 15 && par5Random.nextInt(4) == 0) ++ else if (!var6 && !this.canBlockCatchFire(par1World, par2, par3 - 1, par4, 1) && var7 == 15 && par5Random.nextInt(4) == 0) + { + par1World.setBlockWithNotify(par2, par3, par4, 0); + } +@@ -151,12 +151,12 @@ + var9 = -50; + } + +- this.func_48211_a(par1World, par2 + 1, par3, par4, 300 + var9, par5Random, var7); +- this.func_48211_a(par1World, par2 - 1, par3, par4, 300 + var9, par5Random, var7); +- this.func_48211_a(par1World, par2, par3 - 1, par4, 250 + var9, par5Random, var7); +- this.func_48211_a(par1World, par2, par3 + 1, par4, 250 + var9, par5Random, var7); +- this.func_48211_a(par1World, par2, par3, par4 - 1, 300 + var9, par5Random, var7); +- this.func_48211_a(par1World, par2, par3, par4 + 1, 300 + var9, par5Random, var7); ++ this.tryToCatchBlockOnFire(par1World, par2 + 1, par3, par4, 300 + var9, par5Random, var7, 4); ++ this.tryToCatchBlockOnFire(par1World, par2 - 1, par3, par4, 300 + var9, par5Random, var7, 5); ++ this.tryToCatchBlockOnFire(par1World, par2, par3 - 1, par4, 250 + var9, par5Random, var7, 1); ++ this.tryToCatchBlockOnFire(par1World, par2, par3 + 1, par4, 250 + var9, par5Random, var7, 0); ++ this.tryToCatchBlockOnFire(par1World, par2, par3, par4 - 1, 300 + var9, par5Random, var7, 3); ++ this.tryToCatchBlockOnFire(par1World, par2, par3, par4 + 1, 300 + var9, par5Random, var7, 2); + + for (int var10 = par2 - 1; var10 <= par2 + 1; ++var10) + { +@@ -204,9 +204,21 @@ } } -+ /** -+ * Deprecated for a side-sensitive version -+ */ ++ /** Deprecated for a side-sensitive version */ + @Deprecated - private void tryToCatchBlockOnFire(World world, int i, int j, int k, int l, Random random, int i1) + private void func_48211_a(World par1World, int par2, int par3, int par4, int par5, Random par6Random, int par7) { -- int j1 = abilityToCatchFire[world.getBlockId(i, j, k)]; -+ tryToCatchBlockOnFire(world, i, j, k, l, random, i1, 0); +- int var8 = this.abilityToCatchFire[par1World.getBlockId(par2, par3, par4)]; ++ tryToCatchBlockOnFire(par1World, par2, par3, par4, par5, par6Random, par7, 0); + } -+ -+ private void tryToCatchBlockOnFire(World world, int i, int j, int k, int l, Random random, int i1, int face) -+ { -+ int j1 = 0; -+ Block block = Block.blocksList[world.getBlockId(i, j, k)]; -+ if (block != null) -+ { -+ j1 = block.getFlammability(world, i, j, k, world.getBlockMetadata(i, j, k), face); -+ } -+ - if (random.nextInt(l) < j1) - { - boolean flag = world.getBlockId(i, j, k) == Block.tnt.blockID; -@@ -170,27 +186,27 @@ - - private boolean canNeighborBurn(World world, int i, int j, int k) - { -- if (canBlockCatchFire(world, i + 1, j, k)) -+ if (canBlockCatchFire(world, i + 1, j, k, 4)) - { - return true; - } -- if (canBlockCatchFire(world, i - 1, j, k)) -+ if (canBlockCatchFire(world, i - 1, j, k, 5)) - { - return true; - } -- if (canBlockCatchFire(world, i, j - 1, k)) -+ if (canBlockCatchFire(world, i, j - 1, k, 1)) - { - return true; - } -- if (canBlockCatchFire(world, i, j + 1, k)) -+ if (canBlockCatchFire(world, i, j + 1, k, 0)) - { - return true; - } -- if (canBlockCatchFire(world, i, j, k - 1)) -+ if (canBlockCatchFire(world, i, j, k - 1, 3)) - { - return true; - } -- return canBlockCatchFire(world, i, j, k + 1); -+ return canBlockCatchFire(world, i, j, k + 1, 2); - } - - private int getChanceOfNeighborsEncouragingFire(World world, int i, int j, int k) -@@ -202,12 +218,12 @@ - } - else - { -- l = getChanceToEncourageFire(world, i + 1, j, k, l); -- l = getChanceToEncourageFire(world, i - 1, j, k, l); -- l = getChanceToEncourageFire(world, i, j - 1, k, l); -- l = getChanceToEncourageFire(world, i, j + 1, k, l); -- l = getChanceToEncourageFire(world, i, j, k - 1, l); -- l = getChanceToEncourageFire(world, i, j, k + 1, l); -+ l = getChanceToEncourageFire(world, i + 1, j, k, l, 4); -+ l = getChanceToEncourageFire(world, i - 1, j, k, l, 5); -+ l = getChanceToEncourageFire(world, i, j - 1, k, l, 1); -+ l = getChanceToEncourageFire(world, i, j + 1, k, l, 0); -+ l = getChanceToEncourageFire(world, i, j, k - 1, l, 3); -+ l = getChanceToEncourageFire(world, i, j, k + 1, l, 2); - return l; - } - } -@@ -217,32 +233,32 @@ - return false; - } - -+ /** -+ * Deprecated for a side-sensitive version -+ */ -+ @Deprecated - public boolean canBlockCatchFire(IBlockAccess iblockaccess, int i, int j, int k) - { -- return chanceToEncourageFire[iblockaccess.getBlockId(i, j, k)] > 0; -+ return canBlockCatchFire(iblockaccess, i, j, k, 0); - } - -+ /** -+ * Deprecated for a side-sensitive version -+ */ -+ @Deprecated - public int getChanceToEncourageFire(World world, int i, int j, int k, int l) - { -- int i1 = chanceToEncourageFire[world.getBlockId(i, j, k)]; -- if (i1 > l) -- { -- return i1; -- } -- else -- { -- return l; -- } -+ return getChanceToEncourageFire(world, i, j, k, l, 0); - } - - public boolean canPlaceBlockAt(World world, int i, int j, int k) - { -- return world.isBlockNormalCube(i, j - 1, k) || canNeighborBurn(world, i, j, k); -+ return world.isBlockSolidOnSide(i, j - 1, k, 1) || canNeighborBurn(world, i, j, k); - } - - public void onNeighborBlockChange(World world, int i, int j, int k, int l) - { -- if (!world.isBlockNormalCube(i, j - 1, k) && !canNeighborBurn(world, i, j, k)) -+ if (!world.isBlockSolidOnSide(i, j - 1, k, 1) && !canNeighborBurn(world, i, j, k)) - { - world.setBlockWithNotify(i, j, k, 0); - return; -@@ -259,7 +275,7 @@ - { - return; - } -- if (!world.isBlockNormalCube(i, j - 1, k) && !canNeighborBurn(world, i, j, k)) -+ if (!world.isBlockSolidOnSide(i, j - 1, k, 1) && !canNeighborBurn(world, i, j, k)) - { - world.setBlockWithNotify(i, j, k, 0); - return; -@@ -277,7 +293,7 @@ - { - world.playSoundEffect((float)i + 0.5F, (float)j + 0.5F, (float)k + 0.5F, "fire.fire", 1.0F + random.nextFloat(), random.nextFloat() * 0.7F + 0.3F); - } -- if (world.isBlockNormalCube(i, j - 1, k) || Block.fire.canBlockCatchFire(world, i, j - 1, k)) -+ if (world.isBlockSolidOnSide(i, j - 1, k, 1) || Block.fire.canBlockCatchFire(world, i, j - 1, k, 1)) - { - for (int l = 0; l < 3; l++) - { -@@ -289,7 +305,7 @@ - } - else - { -- if (Block.fire.canBlockCatchFire(world, i - 1, j, k)) -+ if (Block.fire.canBlockCatchFire(world, i - 1, j, k, 5)) - { - for (int i1 = 0; i1 < 2; i1++) - { -@@ -299,7 +315,7 @@ - world.spawnParticle("largesmoke", f1, f7, f13, 0.0D, 0.0D, 0.0D); - } - } -- if (Block.fire.canBlockCatchFire(world, i + 1, j, k)) -+ if (Block.fire.canBlockCatchFire(world, i + 1, j, k, 4)) - { - for (int j1 = 0; j1 < 2; j1++) - { -@@ -309,7 +325,7 @@ - world.spawnParticle("largesmoke", f2, f8, f14, 0.0D, 0.0D, 0.0D); - } - } -- if (Block.fire.canBlockCatchFire(world, i, j, k - 1)) -+ if (Block.fire.canBlockCatchFire(world, i, j, k - 1, 3)) - { - for (int k1 = 0; k1 < 2; k1++) - { -@@ -319,7 +335,7 @@ - world.spawnParticle("largesmoke", f3, f9, f15, 0.0D, 0.0D, 0.0D); - } - } -- if (Block.fire.canBlockCatchFire(world, i, j, k + 1)) -+ if (Block.fire.canBlockCatchFire(world, i, j, k + 1, 2)) - { - for (int l1 = 0; l1 < 2; l1++) - { -@@ -329,7 +345,7 @@ - world.spawnParticle("largesmoke", f4, f10, f16, 0.0D, 0.0D, 0.0D); - } - } -- if (Block.fire.canBlockCatchFire(world, i, j + 1, k)) -+ if (Block.fire.canBlockCatchFire(world, i, j + 1, k, 0)) - { - for (int i2 = 0; i2 < 2; i2++) - { -@@ -341,4 +357,39 @@ - } - } - } + -+ /** -+ * Forge: Side sensitive version -+ */ -+ public boolean canBlockCatchFire(IBlockAccess world, int i, int j, int k, int face) ++ private void tryToCatchBlockOnFire(World par1World, int par2, int par3, int par4, int par5, Random par6Random, int par7, int face) + { -+ Block block = Block.blocksList[world.getBlockId(i, j, k)]; ++ int var8 = 0; ++ Block block = Block.blocksList[par1World.getBlockId(par2, par3, par4)]; ++ if (block != null) ++ { ++ var8 = block.getFlammability(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), face); ++ } + + if (par6Random.nextInt(par5) < var8) + { +@@ -240,7 +252,12 @@ + */ + private boolean canNeighborBurn(World par1World, int par2, int par3, int par4) + { +- 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, 4) || ++ canBlockCatchFire(par1World, par2 - 1, par3, par4, 5) || ++ canBlockCatchFire(par1World, par2, par3 - 1, par4, 1) || ++ canBlockCatchFire(par1World, par2, par3 + 1, par4, 0) || ++ canBlockCatchFire(par1World, par2, par3, par4 - 1, 3) || ++ canBlockCatchFire(par1World, par2, par3, par4 + 1, 2); + } + + /** +@@ -256,12 +273,12 @@ + } + else + { +- int var6 = this.getChanceToEncourageFire(par1World, par2 + 1, par3, par4, var5); +- var6 = this.getChanceToEncourageFire(par1World, par2 - 1, par3, par4, var6); +- var6 = this.getChanceToEncourageFire(par1World, par2, par3 - 1, par4, var6); +- var6 = this.getChanceToEncourageFire(par1World, par2, par3 + 1, par4, var6); +- var6 = this.getChanceToEncourageFire(par1World, par2, par3, par4 - 1, var6); +- var6 = this.getChanceToEncourageFire(par1World, par2, par3, par4 + 1, var6); ++ int var6 = this.getChanceToEncourageFire(par1World, par2 + 1, par3, par4, var5, 4); ++ var6 = this.getChanceToEncourageFire(par1World, par2 - 1, par3, par4, var6, 5); ++ var6 = this.getChanceToEncourageFire(par1World, par2, par3 - 1, par4, var6, 1); ++ var6 = this.getChanceToEncourageFire(par1World, par2, par3 + 1, par4, var6, 0); ++ var6 = this.getChanceToEncourageFire(par1World, par2, par3, par4 - 1, var6, 3); ++ var6 = this.getChanceToEncourageFire(par1World, par2, par3, par4 + 1, var6, 2); + return var6; + } + } +@@ -276,21 +293,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, 0); + } + + /** + * 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) + { +- int var6 = this.chanceToEncourageFire[par1World.getBlockId(par2, par3, par4)]; +- return var6 > par5 ? var6 : par5; ++ return getChanceToEncourageFire(par1World, par2, par3, par4, par5, 0); + } + + /** +@@ -298,7 +318,7 @@ + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + { +- return par1World.isBlockNormalCube(par2, par3 - 1, par4) || this.canNeighborBurn(par1World, par2, par3, par4); ++ return par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1) || this.canNeighborBurn(par1World, par2, par3, par4); + } + + /** +@@ -307,7 +327,7 @@ + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { +- if (!par1World.isBlockNormalCube(par2, par3 - 1, par4) && !this.canNeighborBurn(par1World, par2, par3, par4)) ++ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1) && !this.canNeighborBurn(par1World, par2, par3, par4)) + { + par1World.setBlockWithNotify(par2, par3, par4, 0); + } +@@ -320,7 +340,7 @@ + { + if (par1World.worldProvider.worldType > 0 || par1World.getBlockId(par2, par3 - 1, par4) != Block.obsidian.blockID || !Block.portal.tryToCreatePortal(par1World, par2, par3, par4)) + { +- if (!par1World.isBlockNormalCube(par2, par3 - 1, par4) && !this.canNeighborBurn(par1World, par2, par3, par4)) ++ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1) && !this.canNeighborBurn(par1World, par2, par3, par4)) + { + par1World.setBlockWithNotify(par2, par3, par4, 0); + } +@@ -346,9 +366,9 @@ + float var8; + float var9; + +- if (!par1World.isBlockNormalCube(par2, par3 - 1, par4) && !Block.fire.canBlockCatchFire(par1World, par2, par3 - 1, par4)) ++ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1) && !Block.fire.canBlockCatchFire(par1World, par2, par3 - 1, par4, 1)) + { +- if (Block.fire.canBlockCatchFire(par1World, par2 - 1, par3, par4)) ++ if (Block.fire.canBlockCatchFire(par1World, par2 - 1, par3, par4, 5)) + { + for (var6 = 0; var6 < 2; ++var6) + { +@@ -359,7 +379,7 @@ + } + } + +- if (Block.fire.canBlockCatchFire(par1World, par2 + 1, par3, par4)) ++ if (Block.fire.canBlockCatchFire(par1World, par2 + 1, par3, par4, 4)) + { + for (var6 = 0; var6 < 2; ++var6) + { +@@ -370,7 +390,7 @@ + } + } + +- if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 - 1)) ++ if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 - 1, 3)) + { + for (var6 = 0; var6 < 2; ++var6) + { +@@ -381,7 +401,7 @@ + } + } + +- if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 + 1)) ++ if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 + 1, 2)) + { + for (var6 = 0; var6 < 2; ++var6) + { +@@ -392,7 +412,7 @@ + } + } + +- if (Block.fire.canBlockCatchFire(par1World, par2, par3 + 1, par4)) ++ if (Block.fire.canBlockCatchFire(par1World, par2, par3 + 1, par4, 0)) + { + for (var6 = 0; var6 < 2; ++var6) + { +@@ -414,4 +434,46 @@ + } + } + } ++ ++ /** ++ * Side sensitive version that calls the block function. ++ * ++ * @param world The current world ++ * @param x X Position ++ * @param y Y Position ++ * @param z Z Position ++ * @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, int face) ++ { ++ Block block = Block.blocksList[world.getBlockId(x, y, z)]; + if (block != null) + { -+ return block.isFlammable(world, i, j, k, world.getBlockMetadata(i, j, k), face); ++ return block.isFlammable(world, x, y, z, world.getBlockMetadata(x, y, z), face); + } + return false; + } -+ ++ + /** -+ * Forge: Side sensitive version ++ * Side sensitive version that calls the block function. ++ * ++ * @param world The current world ++ * @param x X Position ++ * @param y Y Position ++ * @param z Z Position ++ * @param oldChance The previous maximum chance. ++ * @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 i, int j, int k, int l, int face) ++ public int getChanceToEncourageFire(World world, int x, int y, int z, int oldChance, int face) + { -+ int i1 = 0; -+ Block block = Block.blocksList[world.getBlockId(i, j, k)]; ++ int newChance = 0; ++ Block block = Block.blocksList[world.getBlockId(x, y, z)]; + if (block != null) + { -+ i1 = block.getFireSpreadSpeed(world, i, j, k, world.getBlockMetadata(i, j, k), face); ++ newChance = block.getFireSpreadSpeed(world, x, y, z, world.getBlockMetadata(x, y, z), face); + } -+ -+ if (i1 > l) -+ { -+ return i1; -+ } -+ else -+ { -+ return l; -+ } ++ return (newChance > oldChance ? newChance : oldChance); + } } diff --git a/forge/patches/minecraft/net/minecraft/src/BlockLadder.java.patch b/forge/patches/minecraft/net/minecraft/src/BlockLadder.java.patch index 9510e3f74..dceb7d872 100644 --- a/forge/patches/minecraft/net/minecraft/src/BlockLadder.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/BlockLadder.java.patch @@ -1,92 +1,78 @@ --- ../src_base/minecraft/net/minecraft/src/BlockLadder.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/BlockLadder.java 0000-00-00 00:00:00.000000000 -0000 -@@ -35,7 +35,7 @@ - setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F); - } - return super.getSelectedBoundingBoxFromPool(world, i, j, k); -- } -+ } - - public boolean isOpaqueCube() +@@ -102,7 +102,10 @@ + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) { -@@ -54,37 +54,37 @@ - - public boolean canPlaceBlockAt(World world, int i, int j, int k) - { -- if (world.isBlockNormalCube(i - 1, j, k)) -+ if (world.isBlockSolidOnSide(i - 1, j, k, 5)) - { - return true; - } -- if (world.isBlockNormalCube(i + 1, j, k)) -+ if (world.isBlockSolidOnSide(i + 1, j, k, 4)) - { - return true; - } -- if (world.isBlockNormalCube(i, j, k - 1)) -+ if (world.isBlockSolidOnSide(i, j, k - 1, 3)) - { - return true; - } -- return world.isBlockNormalCube(i, j, k + 1); -+ return world.isBlockSolidOnSide(i, j, k + 1, 2); +- 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, 5) || ++ par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4) || ++ par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3) || ++ par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2); } - public void onBlockPlaced(World world, int i, int j, int k, int l) + /** +@@ -113,22 +116,22 @@ { - int i1 = world.getBlockMetadata(i, j, k); -- if ((i1 == 0 || l == 2) && world.isBlockNormalCube(i, j, k + 1)) -+ if ((i1 == 0 || l == 2) && world.isBlockSolidOnSide(i, j, k + 1, 2)) + int var6 = par1World.getBlockMetadata(par2, par3, par4); + +- if ((var6 == 0 || par5 == 2) && par1World.isBlockNormalCube(par2, par3, par4 + 1)) ++ if ((var6 == 0 || par5 == 2) && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2)) { - i1 = 2; + var6 = 2; } -- if ((i1 == 0 || l == 3) && world.isBlockNormalCube(i, j, k - 1)) -+ if ((i1 == 0 || l == 3) && world.isBlockSolidOnSide(i, j, k - 1, 3)) + +- if ((var6 == 0 || par5 == 3) && par1World.isBlockNormalCube(par2, par3, par4 - 1)) ++ if ((var6 == 0 || par5 == 3) && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3)) { - i1 = 3; + var6 = 3; } -- if ((i1 == 0 || l == 4) && world.isBlockNormalCube(i + 1, j, k)) -+ if ((i1 == 0 || l == 4) && world.isBlockSolidOnSide(i + 1, j, k, 4)) + +- if ((var6 == 0 || par5 == 4) && par1World.isBlockNormalCube(par2 + 1, par3, par4)) ++ if ((var6 == 0 || par5 == 4) && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4)) { - i1 = 4; + var6 = 4; } -- if ((i1 == 0 || l == 5) && world.isBlockNormalCube(i - 1, j, k)) -+ if ((i1 == 0 || l == 5) && world.isBlockSolidOnSide(i - 1, j, k, 5)) + +- if ((var6 == 0 || par5 == 5) && par1World.isBlockNormalCube(par2 - 1, par3, par4)) ++ if ((var6 == 0 || par5 == 5) && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 5)) { - i1 = 5; + var6 = 5; } -@@ -95,19 +95,19 @@ - { - int i1 = world.getBlockMetadata(i, j, k); - boolean flag = false; -- if (i1 == 2 && world.isBlockNormalCube(i, j, k + 1)) -+ if (i1 == 2 && world.isBlockSolidOnSide(i, j, k + 1, 2)) +@@ -145,22 +148,22 @@ + int var6 = par1World.getBlockMetadata(par2, par3, par4); + boolean var7 = false; + +- if (var6 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1)) ++ if (var6 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2)) { - flag = true; + var7 = true; } -- if (i1 == 3 && world.isBlockNormalCube(i, j, k - 1)) -+ if (i1 == 3 && world.isBlockSolidOnSide(i, j, k - 1, 3)) + +- if (var6 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1)) ++ if (var6 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3)) { - flag = true; + var7 = true; } -- if (i1 == 4 && world.isBlockNormalCube(i + 1, j, k)) -+ if (i1 == 4 && world.isBlockSolidOnSide(i + 1, j, k, 4)) + +- if (var6 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4)) ++ if (var6 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4)) { - flag = true; + var7 = true; } -- if (i1 == 5 && world.isBlockNormalCube(i - 1, j, k)) -+ if (i1 == 5 && world.isBlockSolidOnSide(i - 1, j, k, 5)) + +- if (var6 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4)) ++ if (var6 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 5)) { - flag = true; + var7 = true; } -@@ -123,4 +123,11 @@ +@@ -181,4 +184,10 @@ { return 1; } + -+ /* FORGE: Implemented base method, see Block.isLadder */ + @Override -+ public boolean isLadder(World world, int X, int Y, int Z) ++ public boolean isLadder(World world, int x, int y, int z) + { + return true; + } diff --git a/forge/patches/minecraft/net/minecraft/src/BlockLeaves.java.patch b/forge/patches/minecraft/net/minecraft/src/BlockLeaves.java.patch index b5caae467..c5245a5d8 100644 --- a/forge/patches/minecraft/net/minecraft/src/BlockLeaves.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/BlockLeaves.java.patch @@ -11,41 +11,41 @@ + +public class BlockLeaves extends BlockLeavesBase implements IShearable { - private int baseIndexInPNG; - int adjacentTreeBlocks[]; -@@ -213,15 +216,7 @@ - - public void harvestBlock(World world, EntityPlayer entityplayer, int i, int j, int k, int l) + /** + * The base index in terrain.png corresponding to the fancy version of the leaf texture. This is stored so we can +@@ -268,15 +271,7 @@ + */ + public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) { -- if (!world.isRemote && entityplayer.getCurrentEquippedItem() != null && entityplayer.getCurrentEquippedItem().itemID == Item.shears.shiftedIndex) +- if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.shiftedIndex) - { -- entityplayer.addStat(StatList.mineBlockStatArray[blockID], 1); -- dropBlockAsItem_do(world, i, j, k, new ItemStack(Block.leaves.blockID, 1, l & 3)); +- par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); +- this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(Block.leaves.blockID, 1, par6 & 3)); - } - else - { -- super.harvestBlock(world, entityplayer, i, j, k, l); +- super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); - } -+ super.harvestBlock(world, entityplayer, i, j, k, l); ++ super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); } - protected int damageDropped(int i) -@@ -256,4 +251,18 @@ + /** +@@ -320,4 +315,18 @@ { - super.onEntityWalking(world, i, j, k, entity); + super.onEntityWalking(par1World, par2, par3, par4, par5Entity); } + + @Override -+ public boolean isShearable(ItemStack item, World world, int X, int Y, int Z) ++ public boolean isShearable(ItemStack item, World 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, World 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)); ++ ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 3)); + return ret; + } } diff --git a/forge/patches/minecraft/net/minecraft/src/BlockLever.java.patch b/forge/patches/minecraft/net/minecraft/src/BlockLever.java.patch index 1fe17d922..f33fede78 100644 --- a/forge/patches/minecraft/net/minecraft/src/BlockLever.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/BlockLever.java.patch @@ -1,120 +1,100 @@ --- ../src_base/minecraft/net/minecraft/src/BlockLever.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/BlockLever.java 0000-00-00 00:00:00.000000000 -0000 -@@ -31,44 +31,44 @@ +@@ -43,7 +43,11 @@ - public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l) + public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5) { -- if (l == 1 && world.isBlockNormalCube(i, j - 1, k)) -+ if (l == 1 && world.isBlockSolidOnSide(i, j - 1, k, 1)) - { - return true; - } -- if (l == 2 && world.isBlockNormalCube(i, j, k + 1)) -+ if (l == 2 && world.isBlockSolidOnSide(i, j, k + 1, 2)) - { - return true; - } -- if (l == 3 && world.isBlockNormalCube(i, j, k - 1)) -+ if (l == 3 && world.isBlockSolidOnSide(i, j, k - 1, 3)) - { - return true; - } -- if (l == 4 && world.isBlockNormalCube(i + 1, j, k)) -+ if (l == 4 && world.isBlockSolidOnSide(i + 1, j, k, 4)) - { - return true; - } -- return l == 5 && world.isBlockNormalCube(i - 1, j, k); -+ return l == 5 && world.isBlockSolidOnSide(i - 1, j, k, 5); +- return par5 == 1 && par1World.isBlockNormalCube(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)))); ++ return (par5 == 1 && par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1)) || ++ (par5 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2)) || ++ (par5 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3)) || ++ (par5 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4)) || ++ (par5 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 5)); } - public boolean canPlaceBlockAt(World world, int i, int j, int k) + /** +@@ -51,7 +55,11 @@ + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) { -- if (world.isBlockNormalCube(i - 1, j, k)) -+ if (world.isBlockSolidOnSide(i - 1, j, k, 5)) - { - return true; - } -- if (world.isBlockNormalCube(i + 1, j, k)) -+ if (world.isBlockSolidOnSide(i + 1, j, k, 4)) - { - return true; - } -- if (world.isBlockNormalCube(i, j, k - 1)) -+ if (world.isBlockSolidOnSide(i, j, k - 1, 3)) - { - return true; - } -- if (world.isBlockNormalCube(i, j, k + 1)) -+ if (world.isBlockSolidOnSide(i, j, k + 1, 2)) - { - return true; - } -- return world.isBlockNormalCube(i, j - 1, k); -+ return world.isBlockSolidOnSide(i, j - 1, k, 1); +- 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.isBlockNormalCube(par2, par3 - 1, par4)))); ++ return par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 5) || ++ par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4) || ++ par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3) || ++ par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2) || ++ par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1); } - public void onBlockPlaced(World world, int i, int j, int k, int l) -@@ -77,23 +77,23 @@ - int j1 = i1 & 8; - i1 &= 7; - i1 = -1; -- if (l == 1 && world.isBlockNormalCube(i, j - 1, k)) -+ if (l == 1 && world.isBlockSolidOnSide(i, j - 1, k, 1)) + /** +@@ -65,27 +73,27 @@ + var6 &= 7; + var6 = -1; + +- if (par5 == 1 && par1World.isBlockNormalCube(par2, par3 - 1, par4)) ++ if (par5 == 1 && par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1)) { - i1 = 5 + world.rand.nextInt(2); + var6 = 5 + par1World.rand.nextInt(2); } -- if (l == 2 && world.isBlockNormalCube(i, j, k + 1)) -+ if (l == 2 && world.isBlockSolidOnSide(i, j, k + 1, 2)) + +- if (par5 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1)) ++ if (par5 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2)) { - i1 = 4; + var6 = 4; } -- if (l == 3 && world.isBlockNormalCube(i, j, k - 1)) -+ if (l == 3 && world.isBlockSolidOnSide(i, j, k - 1, 3)) + +- if (par5 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1)) ++ if (par5 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3)) { - i1 = 3; + var6 = 3; } -- if (l == 4 && world.isBlockNormalCube(i + 1, j, k)) -+ if (l == 4 && world.isBlockSolidOnSide(i + 1, j, k, 4)) + +- if (par5 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4)) ++ if (par5 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4)) { - i1 = 2; + var6 = 2; } -- if (l == 5 && world.isBlockNormalCube(i - 1, j, k)) -+ if (l == 5 && world.isBlockSolidOnSide(i - 1, j, k, 5)) + +- if (par5 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4)) ++ if (par5 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 5)) { - i1 = 1; + var6 = 1; } -@@ -116,27 +116,27 @@ - { - int i1 = world.getBlockMetadata(i, j, k) & 7; - boolean flag = false; -- if (!world.isBlockNormalCube(i - 1, j, k) && i1 == 1) -+ if (!world.isBlockSolidOnSide(i - 1, j, k, 5) && i1 == 1) +@@ -112,32 +120,32 @@ + int var6 = par1World.getBlockMetadata(par2, par3, par4) & 7; + boolean var7 = false; + +- if (!par1World.isBlockNormalCube(par2 - 1, par3, par4) && var6 == 1) ++ if (!par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 1) && var6 == 1) { - flag = true; + var7 = true; } -- if (!world.isBlockNormalCube(i + 1, j, k) && i1 == 2) -+ if (!world.isBlockSolidOnSide(i + 1, j, k, 4) && i1 == 2) + +- if (!par1World.isBlockNormalCube(par2 + 1, par3, par4) && var6 == 2) ++ if (!par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 2) && var6 == 2) { - flag = true; + var7 = true; } -- if (!world.isBlockNormalCube(i, j, k - 1) && i1 == 3) -+ if (!world.isBlockSolidOnSide(i, j, k - 1, 3) && i1 == 3) + +- if (!par1World.isBlockNormalCube(par2, par3, par4 - 1) && var6 == 3) ++ if (!par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3) && var6 == 3) { - flag = true; + var7 = true; } -- if (!world.isBlockNormalCube(i, j, k + 1) && i1 == 4) -+ if (!world.isBlockSolidOnSide(i, j, k + 1, 2) && i1 == 4) + +- if (!par1World.isBlockNormalCube(par2, par3, par4 + 1) && var6 == 4) ++ if (!par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 4) && var6 == 4) { - flag = true; + var7 = true; } -- if (!world.isBlockNormalCube(i, j - 1, k) && i1 == 5) -+ if (!world.isBlockSolidOnSide(i, j - 1, k, 1) && i1 == 5) + +- if (!par1World.isBlockNormalCube(par2, par3 - 1, par4) && var6 == 5) ++ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 5) && var6 == 5) { - flag = true; + var7 = true; } -- if (!world.isBlockNormalCube(i, j - 1, k) && i1 == 6) -+ if (!world.isBlockSolidOnSide(i, j - 1, k, 1) && i1 == 6) + +- if (!par1World.isBlockNormalCube(par2, par3 - 1, par4) && var6 == 6) ++ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 6) && var6 == 6) { - flag = true; + var7 = true; } diff --git a/forge/patches/minecraft/net/minecraft/src/BlockNetherStalk.java.patch b/forge/patches/minecraft/net/minecraft/src/BlockNetherStalk.java.patch index db5ed9d59..544d51656 100644 --- a/forge/patches/minecraft/net/minecraft/src/BlockNetherStalk.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/BlockNetherStalk.java.patch @@ -7,37 +7,46 @@ import java.util.Random; public class BlockNetherStalk extends BlockFlower -@@ -57,25 +58,24 @@ +@@ -66,30 +67,22 @@ return 6; } -- public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f, int i1) +- /** +- * 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) + @Override -+ public ArrayList getBlockDropped(World world, int i, int j, int k, int meta, int fortune) ++ public ArrayList getBlockDropped(World world, int x, int y, int z, int metadata, int fortune) { -- if (world.isRemote) +- if (!par1World.isRemote) - { -- return; -- } +- int var8 = 1; + ArrayList ret = new ArrayList(); - int j1 = 1; -- if (l >= 3) -+ if (meta >= 3) - { - j1 = 2 + world.rand.nextInt(3); -- if (i1 > 0) -+ if (fortune > 0) - { -- j1 += world.rand.nextInt(i1 + 1); -+ j1 += world.rand.nextInt(fortune + 1); - } - } - for (int k1 = 0; k1 < j1; k1++) - { -- dropBlockAsItem_do(world, i, j, k, new ItemStack(Item.netherStalkSeeds)); ++ int var8 = 1; + +- if (par5 >= 3) +- { +- var8 = 2 + par1World.rand.nextInt(3); +- +- if (par7 > 0) +- { +- var8 += par1World.rand.nextInt(par7 + 1); +- } +- } ++ if (metadata >= 3) ++ { ++ var8 = 2 + world.rand.nextInt(3) + (fortune > 0 ? world.rand.nextInt(fortune + 1) : 0); ++ } + +- for (int var9 = 0; var9 < var8; ++var9) +- { +- this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(Item.netherStalkSeeds)); +- } ++ for (int var9 = 0; var9 < var8; ++var9) ++ { + ret.add(new ItemStack(Item.netherStalkSeeds)); } + return ret; } - public int idDropped(int i, Random random, int j) + /** diff --git a/forge/patches/minecraft/net/minecraft/src/BlockPistonBase.java.patch b/forge/patches/minecraft/net/minecraft/src/BlockPistonBase.java.patch index f3d002017..e9ac3175d 100644 --- a/forge/patches/minecraft/net/minecraft/src/BlockPistonBase.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/BlockPistonBase.java.patch @@ -1,11 +1,11 @@ --- ../src_base/minecraft/net/minecraft/src/BlockPistonBase.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/BlockPistonBase.java 0000-00-00 00:00:00.000000000 -0000 -@@ -355,7 +355,7 @@ +@@ -364,7 +364,7 @@ return false; } + +- return !(Block.blocksList[par0] instanceof BlockContainer); ++ return !(Block.blocksList[par0] != null && Block.blocksList[par0].hasTileEntity(par1World.getBlockMetadata(par2, par3, par4))); } -- return !(Block.blocksList[i] instanceof BlockContainer); -+ return !(Block.blocksList[i] != null && Block.blocksList[i].hasTileEntity(world.getBlockMetadata(j, k, l))); } - private static boolean canExtend(World world, int i, int j, int k, int l) diff --git a/forge/patches/minecraft/net/minecraft/src/BlockPressurePlate.java.patch b/forge/patches/minecraft/net/minecraft/src/BlockPressurePlate.java.patch index e4539660f..d43c96d57 100644 --- a/forge/patches/minecraft/net/minecraft/src/BlockPressurePlate.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/BlockPressurePlate.java.patch @@ -1,20 +1,20 @@ --- ../src_base/minecraft/net/minecraft/src/BlockPressurePlate.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/BlockPressurePlate.java 0000-00-00 00:00:00.000000000 -0000 -@@ -38,7 +38,7 @@ - - public boolean canPlaceBlockAt(World world, int i, int j, int k) +@@ -61,7 +61,7 @@ + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) { -- return world.isBlockNormalCube(i, j - 1, k) || world.getBlockId(i, j - 1, k) == Block.fence.blockID; -+ return world.isBlockSolidOnSide(i, j - 1, k, 1) || world.getBlockId(i, j - 1, k) == Block.fence.blockID; +- return par1World.isBlockNormalCube(par2, par3 - 1, par4) || par1World.getBlockId(par2, par3 - 1, par4) == Block.fence.blockID; ++ return par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1) || par1World.getBlockId(par2, par3 - 1, par4) == Block.fence.blockID; } - public void onBlockAdded(World world, int i, int j, int k) -@@ -48,7 +48,7 @@ - public void onNeighborBlockChange(World world, int i, int j, int k, int l) + /** +@@ -77,7 +77,7 @@ { - boolean flag = false; -- if (!world.isBlockNormalCube(i, j - 1, k) && world.getBlockId(i, j - 1, k) != Block.fence.blockID) -+ if (!world.isBlockSolidOnSide(i, j - 1, k, 1) && world.getBlockId(i, j - 1, k) != Block.fence.blockID) + boolean var6 = false; + +- if (!par1World.isBlockNormalCube(par2, par3 - 1, par4) && par1World.getBlockId(par2, par3 - 1, par4) != Block.fence.blockID) ++ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1) && par1World.getBlockId(par2, par3 - 1, par4) != Block.fence.blockID) { - flag = true; + var6 = true; } diff --git a/forge/patches/minecraft/net/minecraft/src/BlockRail.java.patch b/forge/patches/minecraft/net/minecraft/src/BlockRail.java.patch index 3fb33b12b..0db2a9cd2 100644 --- a/forge/patches/minecraft/net/minecraft/src/BlockRail.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/BlockRail.java.patch @@ -1,8 +1,8 @@ --- ../src_base/minecraft/net/minecraft/src/BlockRail.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/BlockRail.java 0000-00-00 00:00:00.000000000 -0000 -@@ -5,16 +5,29 @@ - public class BlockRail extends Block +@@ -6,6 +6,19 @@ { + /** Power related rails have this field at true. */ private final boolean isPowered; + + /** @@ -15,93 +15,103 @@ + + public void setRenderType(int value) + { -+ renderType = value; ++ renderType = value; + } - public static final boolean isRailBlockAt(World world, int i, int j, int k) + /** + * Returns true if the block at the coordinates of world passed is a valid rail block (current is rail, powered or +@@ -14,7 +27,7 @@ + public static final boolean isRailBlockAt(World par0World, int par1, int par2, int par3) { - int l = world.getBlockId(i, j, k); -- return l == Block.rail.blockID || l == Block.railPowered.blockID || l == Block.railDetector.blockID; -+ return Block.blocksList[l] instanceof BlockRail; + int var4 = par0World.getBlockId(par1, par2, par3); +- return var4 == Block.rail.blockID || var4 == Block.railPowered.blockID || var4 == Block.railDetector.blockID; ++ return Block.blocksList[var4] instanceof BlockRail; } - public static final boolean isRailBlock(int i) + /** +@@ -22,7 +35,7 @@ + */ + public static final boolean isRailBlock(int par0) { -- return i == Block.rail.blockID || i == Block.railPowered.blockID || i == Block.railDetector.blockID; -+ return Block.blocksList[i] instanceof BlockRail; +- return par0 == Block.rail.blockID || par0 == Block.railPowered.blockID || par0 == Block.railDetector.blockID; ++ return Block.blocksList[par0] instanceof BlockRail; } - protected BlockRail(int i, int j, boolean flag) -@@ -81,7 +94,7 @@ - + protected BlockRail(int par1, int par2, boolean par3) +@@ -118,7 +131,7 @@ + */ public int getRenderType() { - return 9; + return renderType; } - public int quantityDropped(Random random) -@@ -91,7 +104,7 @@ - - public boolean canPlaceBlockAt(World world, int i, int j, int k) + /** +@@ -134,7 +147,7 @@ + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) { -- return world.isBlockNormalCube(i, j - 1, k); -+ return world.isBlockSolidOnSide(i, j - 1, k, 1); +- return par1World.isBlockNormalCube(par2, par3 - 1, par4); ++ return par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1); } - public void onBlockAdded(World world, int i, int j, int k) -@@ -119,23 +132,23 @@ - j1 &= 7; - } - boolean flag = false; -- if (!world.isBlockNormalCube(i, j - 1, k)) -+ if (!world.isBlockSolidOnSide(i, j - 1, k, 1)) - { - flag = true; - } -- if (j1 == 2 && !world.isBlockNormalCube(i + 1, j, k)) -+ if (j1 == 2 && !world.isBlockSolidOnSide(i + 1, j, k, 1)) - { - flag = true; - } -- if (j1 == 3 && !world.isBlockNormalCube(i - 1, j, k)) -+ if (j1 == 3 && !world.isBlockSolidOnSide(i - 1, j, k, 1)) - { - flag = true; - } -- if (j1 == 4 && !world.isBlockNormalCube(i, j, k - 1)) -+ if (j1 == 4 && !world.isBlockSolidOnSide(i, j, k - 1, 1)) - { - flag = true; - } -- if (j1 == 5 && !world.isBlockNormalCube(i, j, k + 1)) -+ if (j1 == 5 && !world.isBlockSolidOnSide(i, j, k + 1, 1)) - { - flag = true; - } -@@ -317,8 +330,119 @@ - return 0; + /** +@@ -171,27 +184,27 @@ + + boolean var8 = false; + +- if (!par1World.isBlockNormalCube(par2, par3 - 1, par4)) ++ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1)) + { + var8 = true; + } + +- if (var7 == 2 && !par1World.isBlockNormalCube(par2 + 1, par3, par4)) ++ if (var7 == 2 && !par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 1)) + { + var8 = true; + } + +- if (var7 == 3 && !par1World.isBlockNormalCube(par2 - 1, par3, par4)) ++ if (var7 == 3 && !par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 1)) + { + var8 = true; + } + +- if (var7 == 4 && !par1World.isBlockNormalCube(par2, par3, par4 - 1)) ++ if (var7 == 4 && !par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 1)) + { + var8 = true; + } + +- if (var7 == 5 && !par1World.isBlockNormalCube(par2, par3, par4 + 1)) ++ if (var7 == 5 && !par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 1)) + { + var8 = true; + } +@@ -396,10 +409,120 @@ } -+ /** + /** +- * Return true if the blocks passed is a power related rail. + * This function is no longer called by Minecraft -+ */ + */ + @Deprecated - static boolean isPoweredBlockRail(BlockRail blockrail) + static boolean isPoweredBlockRail(BlockRail par0BlockRail) { - return blockrail.isPowered; + return par0BlockRail.isPowered; } + + /** + * Return true if the rail can make corners. + * Used by placement logic. + * @param world The world. -+ * @param i The rail X coordinate. -+ * @param j The rail Y coordinate. -+ * @param k The rail Z coordinate. ++ * @param x The rail X coordinate. ++ * @param y The rail Y coordinate. ++ * @param z The rail Z coordinate. + * @return True if the rail can make corners. + */ -+ public boolean isFlexibleRail(World world, int i, int j, int k) ++ public boolean isFlexibleRail(World world, int y, int x, int z) + { + return !isPowered; + } @@ -110,12 +120,12 @@ + * Returns true if the rail can make up and down slopes. + * Used by placement logic. + * @param world The world. -+ * @param i The rail X coordinate. -+ * @param j The rail Y coordinate. -+ * @param k The rail Z coordinate. ++ * @param x The rail X coordinate. ++ * @param y The rail Y coordinate. ++ * @param z The rail Z coordinate. + * @return True if the rail can make slopes. + */ -+ public boolean canMakeSlopes(World world, int i, int j, int k) ++ public boolean canMakeSlopes(World world, int x, int y, int z) + { + return true; + } @@ -141,46 +151,48 @@ + * All directions are Notch defined. + * In MC Beta 1.8.3 the Sun rises in the North. + * In MC 1.0.0 the Sun rises in the East. ++ * + * @param world The world. + * @param cart The cart asking for the metadata, null if it is not called by EntityMinecart. -+ * @param i The rail X coordinate. -+ * @param j The rail Y coordinate. -+ * @param k The rail Z coordinate. ++ * @param y The rail X coordinate. ++ * @param x The rail Y coordinate. ++ * @param z The rail Z coordinate. + * @return The metadata. + */ -+ public int getBasicRailMetadata(IBlockAccess world, EntityMinecart cart, int i, int j, int k) ++ public int getBasicRailMetadata(IBlockAccess world, EntityMinecart cart, int x, int y, int z) + { -+ int meta = world.getBlockMetadata(i, j, k); -+ if(isPowered) { ++ int meta = world.getBlockMetadata(x, y, z); ++ if(isPowered) ++ { + meta = meta & 7; + } + return meta; + } -+ ++ + /** -+ * Returns the max speed of the rail at [i, j, k]. ++ * Returns the max speed of the rail at the specified position. + * @param world The world. + * @param cart The cart on the rail, may be null. -+ * @param i The rail X coordinate. -+ * @param j The rail Y coordinate. -+ * @param k The rail Z coordinate. ++ * @param x The rail X coordinate. ++ * @param y The rail Y coordinate. ++ * @param z The rail Z coordinate. + * @return The max speed of the current rail. + */ -+ public float getRailMaxSpeed(World world, EntityMinecart cart, int i, int j, int k) ++ public float getRailMaxSpeed(World world, EntityMinecart cart, int y, int x, int z) + { + return 0.4f; + } -+ ++ + /** + * This function is called by any minecart that passes over this rail. + * It is called once per update tick that the minecart is on the rail. + * @param world The world. + * @param cart The cart on the rail. -+ * @param i The rail X coordinate. -+ * @param j The rail Y coordinate. -+ * @param k The rail Z coordinate. ++ * @param y The rail X coordinate. ++ * @param x The rail Y coordinate. ++ * @param z The rail Z coordinate. + */ -+ public void onMinecartPass(World world, EntityMinecart cart, int i, int j, int k) ++ public void onMinecartPass(World world, EntityMinecart cart, int y, int x, int z) + { + } + @@ -189,12 +201,12 @@ + * Avoid using this function when getBasicRailMetadata() can be used instead. + * The only reason to use this function is if you wish to change the rails metadata. + * @param world The world. -+ * @param i The rail X coordinate. -+ * @param j The rail Y coordinate. -+ * @param k The rail Z coordinate. ++ * @param x The rail X coordinate. ++ * @param y The rail Y coordinate. ++ * @param z The rail Z coordinate. + * @return True if the 4th bit is a power bit. + */ -+ public boolean hasPowerBit(World world, int i, int j, int k) ++ public boolean hasPowerBit(World world, int x, int y, int z) + { + return isPowered; + } diff --git a/forge/patches/minecraft/net/minecraft/src/BlockRedstoneRepeater.java.patch b/forge/patches/minecraft/net/minecraft/src/BlockRedstoneRepeater.java.patch index 2c5a7b7ca..407082998 100644 --- a/forge/patches/minecraft/net/minecraft/src/BlockRedstoneRepeater.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/BlockRedstoneRepeater.java.patch @@ -1,20 +1,20 @@ --- ../src_base/minecraft/net/minecraft/src/BlockRedstoneRepeater.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/BlockRedstoneRepeater.java 0000-00-00 00:00:00.000000000 -0000 -@@ -28,7 +28,7 @@ - - public boolean canPlaceBlockAt(World world, int i, int j, int k) +@@ -33,7 +33,7 @@ + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) { -- if (!world.isBlockNormalCube(i, j - 1, k)) -+ if (!world.isBlockSolidOnSide(i, j - 1, k, 1)) - { - return false; - } -@@ -40,7 +40,7 @@ +- return !par1World.isBlockNormalCube(par2, par3 - 1, par4) ? false : super.canPlaceBlockAt(par1World, par2, par3, par4); ++ return !par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1) ? false : super.canPlaceBlockAt(par1World, par2, par3, par4); + } - public boolean canBlockStay(World world, int i, int j, int k) + /** +@@ -41,7 +41,7 @@ + */ + public boolean canBlockStay(World par1World, int par2, int par3, int par4) { -- if (!world.isBlockNormalCube(i, j - 1, k)) -+ if (!world.isBlockSolidOnSide(i, j - 1, k, 1)) - { - return false; - } +- return !par1World.isBlockNormalCube(par2, par3 - 1, par4) ? false : super.canBlockStay(par1World, par2, par3, par4); ++ return !par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1) ? false : super.canBlockStay(par1World, par2, par3, par4); + } + + /** diff --git a/forge/patches/minecraft/net/minecraft/src/BlockRedstoneWire.java.patch b/forge/patches/minecraft/net/minecraft/src/BlockRedstoneWire.java.patch index 40b044b06..0d5b43466 100644 --- a/forge/patches/minecraft/net/minecraft/src/BlockRedstoneWire.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/BlockRedstoneWire.java.patch @@ -1,33 +1,31 @@ --- ../src_base/minecraft/net/minecraft/src/BlockRedstoneWire.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/BlockRedstoneWire.java 0000-00-00 00:00:00.000000000 -0000 -@@ -2,6 +2,8 @@ - - import java.util.*; +@@ -5,6 +5,8 @@ + import java.util.Random; + import java.util.Set; +import net.minecraft.src.forge.IConnectRedstone; + public class BlockRedstoneWire extends Block { - private boolean wiresProvidePower; -@@ -47,7 +49,7 @@ - - public boolean canPlaceBlockAt(World world, int i, int j, int k) + /** +@@ -76,7 +78,7 @@ + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) { -- return world.isBlockNormalCube(i, j - 1, k); -+ return world.isBlockSolidOnSide(i, j - 1, k, 1); +- return par1World.isBlockNormalCube(par2, par3 - 1, par4) || par1World.getBlockId(par2, par3 - 1, par4) == Block.glowStone.blockID; ++ return par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1) || par1World.getBlockId(par2, par3 - 1, par4) == Block.glowStone.blockID; } - private void updateAndPropagateCurrentStrength(World world, int i, int j, int k) -@@ -467,6 +469,12 @@ - int j1 = iblockaccess.getBlockMetadata(i, j, k); - return l == (j1 & 3) || l == Direction.footInvisibleFaceRemap[j1 & 3]; + /** +@@ -548,6 +550,10 @@ } -+ -+ if (Block.blocksList[i1] instanceof IConnectRedstone) -+ { -+ return ((IConnectRedstone)Block.blocksList[i1]).canConnectRedstone(iblockaccess, i, j, k, l); -+ } -+ - return Block.blocksList[i1].canProvidePower() && l != -1; - } - + else if (var5 != Block.redstoneRepeaterIdle.blockID && var5 != Block.redstoneRepeaterActive.blockID) + { ++ if (Block.blocksList[var5] instanceof IConnectRedstone) ++ { ++ return ((IConnectRedstone)Block.blocksList[var5]).canConnectRedstone(par0IBlockAccess, par1, par2, par3, par4); ++ } + return Block.blocksList[var5].canProvidePower() && par4 != -1; + } + else diff --git a/forge/patches/minecraft/net/minecraft/src/BlockSnow.java.patch b/forge/patches/minecraft/net/minecraft/src/BlockSnow.java.patch index 463296bf1..2e0ddeda2 100644 --- a/forge/patches/minecraft/net/minecraft/src/BlockSnow.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/BlockSnow.java.patch @@ -1,43 +1,44 @@ --- ../src_base/minecraft/net/minecraft/src/BlockSnow.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/BlockSnow.java 0000-00-00 00:00:00.000000000 -0000 -@@ -63,7 +63,6 @@ +@@ -73,7 +73,6 @@ { - if (!canPlaceBlockAt(world, i, j, k)) + if (!this.canPlaceBlockAt(par1World, par2, par3, par4)) { -- dropBlockAsItem(world, i, j, k, world.getBlockMetadata(i, j, k), 0); - world.setBlockWithNotify(i, j, k, 0); +- this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); + par1World.setBlockWithNotify(par2, par3, par4, 0); return false; } -@@ -75,15 +74,7 @@ - - public void harvestBlock(World world, EntityPlayer entityplayer, int i, int j, int k, int l) +@@ -89,15 +88,7 @@ + */ + public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) { -- int i1 = Item.snowball.shiftedIndex; -- float f = 0.7F; -- double d = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; -- double d1 = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; -- double d2 = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; -- EntityItem entityitem = new EntityItem(world, (double)i + d, (double)j + d1, (double)k + d2, new ItemStack(i1, 1, 0)); -- entityitem.delayBeforeCanPickup = 10; -- world.spawnEntityInWorld(entityitem); -- world.setBlockWithNotify(i, j, k, 0); -+ dropBlockAsItem(world, i, j, k, l, 0); - entityplayer.addStat(StatList.mineBlockStatArray[blockID], 1); +- int var7 = Item.snowball.shiftedIndex; +- float var8 = 0.7F; +- double var9 = (double)(par1World.rand.nextFloat() * var8) + (double)(1.0F - var8) * 0.5D; +- double var11 = (double)(par1World.rand.nextFloat() * var8) + (double)(1.0F - var8) * 0.5D; +- double var13 = (double)(par1World.rand.nextFloat() * var8) + (double)(1.0F - var8) * 0.5D; +- EntityItem var15 = new EntityItem(par1World, (double)par3 + var9, (double)par4 + var11, (double)par5 + var13, new ItemStack(var7, 1, 0)); +- var15.delayBeforeCanPickup = 10; +- par1World.spawnEntityInWorld(var15); +- par1World.setBlockWithNotify(par3, par4, par5, 0); ++ dropBlockAsItem(par1World, par3, par4, par5, par6, 0); + par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); } -@@ -94,14 +85,13 @@ - - public int quantityDropped(Random random) +@@ -114,7 +105,7 @@ + */ + public int quantityDropped(Random par1Random) { - return 0; + return 1; } - public void updateTick(World world, int i, int j, int k, Random random) + /** +@@ -124,7 +115,6 @@ { - if (world.getSavedLightValue(EnumSkyBlock.Block, i, j, k) > 11) + if (par1World.getSavedLightValue(EnumSkyBlock.Block, par2, par3, par4) > 11) { -- dropBlockAsItem(world, i, j, k, world.getBlockMetadata(i, j, k), 0); - world.setBlockWithNotify(i, j, k, 0); +- this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); + par1World.setBlockWithNotify(par2, par3, par4, 0); } } diff --git a/forge/patches/minecraft/net/minecraft/src/BlockTallGrass.java.patch b/forge/patches/minecraft/net/minecraft/src/BlockTallGrass.java.patch index 92e097dad..f2ed87aa8 100644 --- a/forge/patches/minecraft/net/minecraft/src/BlockTallGrass.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/BlockTallGrass.java.patch @@ -12,70 +12,59 @@ + +public class BlockTallGrass extends BlockFlower implements IShearable { - protected BlockTallGrass(int i, int j) + protected BlockTallGrass(int par1, int par2) { -@@ -65,14 +69,7 @@ - - public int idDropped(int i, Random random, int j) +@@ -49,7 +53,7 @@ + */ + public int idDropped(int par1, Random par2Random, int par3) { -- if (random.nextInt(8) == 0) -- { -- return Item.seeds.shiftedIndex; -- } -- else -- { -- return -1; -- } +- return par2Random.nextInt(8) == 0 ? Item.seeds.shiftedIndex : -1; + return -1; } - public int quantityDroppedWithBonus(int i, Random random) -@@ -80,16 +77,39 @@ - return 1 + random.nextInt(i * 2 + 1); - } - -+ @Override -+ public ArrayList getBlockDropped(World world, int i, int j, int k, int md, 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); -+ } -+ return ret; + /** +@@ -66,14 +70,39 @@ + */ + 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.shiftedIndex) ++ super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); + } + - public void harvestBlock(World world, EntityPlayer entityplayer, int i, int j, int k, int l) - { -- if (!world.isRemote && entityplayer.getCurrentEquippedItem() != null && entityplayer.getCurrentEquippedItem().itemID == Item.shears.shiftedIndex) -- { -- entityplayer.addStat(StatList.mineBlockStatArray[blockID], 1); -- dropBlockAsItem_do(world, i, j, k, new ItemStack(Block.tallGrass, 1, l)); -- } ++ @Override ++ public ArrayList getBlockDropped(World world, int x, int y, int z, int meta, int fortune) ++ { ++ ArrayList ret = new ArrayList(); ++ if (world.rand.nextInt(8) != 0) + { +- par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); +- this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(Block.tallGrass, 1, par6)); ++ return ret; + } - else -- { -- super.harvestBlock(world, entityplayer, i, j, k, l); -- } -+ super.harvestBlock(world, entityplayer, i, j, k, l); ++ ++ ItemStack item = ForgeHooks.getGrassSeed(world); ++ if (item != null) + { +- super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); ++ ret.add(item); + } ++ return ret; + } + + @Override -+ public boolean isShearable(ItemStack item, World world, int X, int Y, int Z) ++ public boolean isShearable(ItemStack item, World 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, World world, int x, int y, int z, int fortune) + { + ArrayList ret = new ArrayList(); -+ ret.add(new ItemStack(this, 1, world.getBlockMetadata(X, Y, Z))); ++ ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z))); + return ret; } ++ ++ } diff --git a/forge/patches/minecraft/net/minecraft/src/BlockTorch.java.patch b/forge/patches/minecraft/net/minecraft/src/BlockTorch.java.patch index c41076c51..f5855479f 100644 --- a/forge/patches/minecraft/net/minecraft/src/BlockTorch.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/BlockTorch.java.patch @@ -1,107 +1,102 @@ --- ../src_base/minecraft/net/minecraft/src/BlockTorch.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/BlockTorch.java 0000-00-00 00:00:00.000000000 -0000 -@@ -32,7 +32,7 @@ - - private boolean canPlaceTorchOn(World world, int i, int j, int k) +@@ -49,7 +49,7 @@ + */ + private boolean canPlaceTorchOn(World par1World, int par2, int par3, int par4) { -- if (world.isBlockNormalCubeDefault(i, j, k, true)) -+ if (world.isBlockSolidOnSide(i, j, k, 1)) +- if (par1World.isBlockNormalCubeDefault(par2, par3, par4, true)) ++ if (par1World.isBlockSolidOnSide(par2, par3, par4, 1)) { return true; } -@@ -45,19 +45,19 @@ - - public boolean canPlaceBlockAt(World world, int i, int j, int k) +@@ -83,7 +83,11 @@ + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) { -- if (world.isBlockNormalCubeDefault(i - 1, j, k, true)) -+ if (world.isBlockSolidOnSide(i - 1, j, k, 5)) - { - return true; - } -- if (world.isBlockNormalCubeDefault(i + 1, j, k, true)) -+ if (world.isBlockSolidOnSide(i + 1, j, k, 4)) - { - return true; - } -- if (world.isBlockNormalCubeDefault(i, j, k - 1, true)) -+ if (world.isBlockSolidOnSide(i, j, k - 1, 3)) - { - return true; - } -- if (world.isBlockNormalCubeDefault(i, j, k + 1, true)) -+ if (world.isBlockSolidOnSide(i, j, k + 1, 2)) - { - return true; - } -@@ -71,19 +71,19 @@ - { - i1 = 5; - } -- if (l == 2 && world.isBlockNormalCubeDefault(i, j, k + 1, true)) -+ if (l == 2 && world.isBlockSolidOnSide(i, j, k + 1, 2)) - { - i1 = 4; - } -- if (l == 3 && world.isBlockNormalCubeDefault(i, j, k - 1, true)) -+ if (l == 3 && world.isBlockSolidOnSide(i, j, k - 1, 3)) - { - i1 = 3; - } -- if (l == 4 && world.isBlockNormalCubeDefault(i + 1, j, k, true)) -+ if (l == 4 && world.isBlockSolidOnSide(i + 1, j, k, 4)) - { - i1 = 2; - } -- if (l == 5 && world.isBlockNormalCubeDefault(i - 1, j, k, true)) -+ if (l == 5 && world.isBlockSolidOnSide(i - 1, j, k, 5)) - { - i1 = 1; - } -@@ -101,19 +101,19 @@ +- 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, 5) || ++ par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4) || ++ par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3) || ++ par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2) || ++ canPlaceTorchOn(par1World, par2, par3 - 1, par4); + } - public void onBlockAdded(World world, int i, int j, int k) + /** +@@ -99,22 +103,22 @@ + var6 = 5; + } + +- if (par5 == 2 && par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true)) ++ if (par5 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2)) + { + var6 = 4; + } + +- if (par5 == 3 && par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true)) ++ if (par5 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3)) + { + var6 = 3; + } + +- if (par5 == 4 && par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true)) ++ if (par5 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4)) + { + var6 = 2; + } + +- if (par5 == 5 && par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true)) ++ if (par5 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 5)) + { + var6 = 1; + } +@@ -140,19 +144,19 @@ + */ + public void onBlockAdded(World par1World, int par2, int par3, int par4) { -- if (world.isBlockNormalCubeDefault(i - 1, j, k, true)) -+ if (world.isBlockSolidOnSide(i - 1, j, k, 5)) +- if (par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true)) ++ if (par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 5)) { - world.setBlockMetadataWithNotify(i, j, k, 1); + par1World.setBlockMetadataWithNotify(par2, par3, par4, 1); } -- else if (world.isBlockNormalCubeDefault(i + 1, j, k, true)) -+ else if (world.isBlockSolidOnSide(i + 1, j, k, 4)) +- else if (par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true)) ++ else if (par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4)) { - world.setBlockMetadataWithNotify(i, j, k, 2); + par1World.setBlockMetadataWithNotify(par2, par3, par4, 2); } -- else if (world.isBlockNormalCubeDefault(i, j, k - 1, true)) -+ else if (world.isBlockSolidOnSide(i, j, k - 1, 3)) +- else if (par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true)) ++ else if (par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3)) { - world.setBlockMetadataWithNotify(i, j, k, 3); + par1World.setBlockMetadataWithNotify(par2, par3, par4, 3); } -- else if (world.isBlockNormalCubeDefault(i, j, k + 1, true)) -+ else if (world.isBlockSolidOnSide(i, j, k + 1, 2)) +- else if (par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true)) ++ else if (par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2)) { - world.setBlockMetadataWithNotify(i, j, k, 4); + par1World.setBlockMetadataWithNotify(par2, par3, par4, 4); } -@@ -130,19 +130,19 @@ - { - int i1 = world.getBlockMetadata(i, j, k); - boolean flag = false; -- if (!world.isBlockNormalCubeDefault(i - 1, j, k, true) && i1 == 1) -+ if (!world.isBlockSolidOnSide(i - 1, j, k, 5) && i1 == 1) +@@ -175,22 +179,22 @@ + int var6 = par1World.getBlockMetadata(par2, par3, par4); + boolean var7 = false; + +- if (!par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true) && var6 == 1) ++ if (!par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 5) && var6 == 1) { - flag = true; + var7 = true; } -- if (!world.isBlockNormalCubeDefault(i + 1, j, k, true) && i1 == 2) -+ if (!world.isBlockSolidOnSide(i + 1, j, k, 4) && i1 == 2) + +- if (!par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true) && var6 == 2) ++ if (!par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4) && var6 == 2) { - flag = true; + var7 = true; } -- if (!world.isBlockNormalCubeDefault(i, j, k - 1, true) && i1 == 3) -+ if (!world.isBlockSolidOnSide(i, j, k - 1, 3) && i1 == 3) + +- if (!par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true) && var6 == 3) ++ if (!par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3) && var6 == 3) { - flag = true; + var7 = true; } -- if (!world.isBlockNormalCubeDefault(i, j, k + 1, true) && i1 == 4) -+ if (!world.isBlockSolidOnSide(i, j, k + 1, 2) && i1 == 4) + +- if (!par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true) && var6 == 4) ++ if (!par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2) && var6 == 4) { - flag = true; + var7 = true; } diff --git a/forge/patches/minecraft/net/minecraft/src/BlockTrapDoor.java.patch b/forge/patches/minecraft/net/minecraft/src/BlockTrapDoor.java.patch index f3cf6c0b8..f77341545 100644 --- a/forge/patches/minecraft/net/minecraft/src/BlockTrapDoor.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/BlockTrapDoor.java.patch @@ -4,50 +4,50 @@ public class BlockTrapDoor extends Block { -+ /* FORGE: Set this to allow trapdoors to remain free-floating */ -+ public static boolean disableValidation = false; -+ - protected BlockTrapDoor(int i, Material material) ++ /** Set this to allow trapdoors to remain free-floating */ ++ public static boolean disableValidation = false; ++ + protected BlockTrapDoor(int par1, Material par2Material) { - super(i, material); -@@ -139,7 +142,7 @@ - { - j1--; - } -- if (!isValidSupportBlock(world.getBlockId(j1, j, k1))) -+ if (!(isValidSupportBlock(world.getBlockId(j1, j, k1)) || world.isBlockSolidOnSide(j1, j, k1, (i1 & 3) + 2))) - { - world.setBlockWithNotify(i, j, k, 0); - dropBlockAsItem(world, i, j, k, i1, 0); -@@ -181,6 +184,10 @@ + super(par1, par2Material); +@@ -183,7 +186,7 @@ + --var7; + } - public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l) +- if (!isValidSupportBlock(par1World.getBlockId(var7, par3, var8))) ++ if (!(isValidSupportBlock(par1World.getBlockId(var7, par3, var8)) || par1World.isBlockSolidOnSide(var7, par3, var8, (var6 & 3) + 2))) + { + par1World.setBlockWithNotify(par2, par3, par4, 0); + this.dropBlockAsItem(par1World, par2, par3, par4, var6, 0); +@@ -241,6 +244,10 @@ + + public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5) { -+ if (disableValidation) -+ { -+ return true; -+ } - if (l == 0) ++ if (disableValidation) ++ { ++ return true; ++ } + if (par5 == 0) { return false; -@@ -205,7 +212,7 @@ - { - i--; +@@ -271,7 +278,7 @@ + --par2; + } + +- return isValidSupportBlock(par1World.getBlockId(par2, par3, par4)); ++ return isValidSupportBlock(par1World.getBlockId(par2, par3, par4)) || par1World.isBlockSolidOnSide(par2, par3, par4, 1); } -- return isValidSupportBlock(world.getBlockId(i, j, k)); -+ return isValidSupportBlock(world.getBlockId(i, j, k)) || world.isBlockSolidOnSide(i, j, k, l); } - public static boolean isTrapdoorOpen(int i) -@@ -215,6 +222,11 @@ - - private static boolean isValidSupportBlock(int i) +@@ -286,6 +293,11 @@ + */ + private static boolean isValidSupportBlock(int par0) { -+ if (disableValidation) -+ { -+ return true; -+ } -+ - if (i <= 0) ++ if (disableValidation) ++ { ++ return true; ++ } ++ + if (par0 <= 0) { return false; diff --git a/forge/patches/minecraft/net/minecraft/src/BlockVine.java.patch b/forge/patches/minecraft/net/minecraft/src/BlockVine.java.patch index a54d39a98..4ebbf0130 100644 --- a/forge/patches/minecraft/net/minecraft/src/BlockVine.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/BlockVine.java.patch @@ -11,35 +11,41 @@ + +public class BlockVine extends Block implements IShearable { - public BlockVine(int i) + public BlockVine(int par1) { -@@ -345,14 +348,20 @@ - - public void harvestBlock(World world, EntityPlayer entityplayer, int i, int j, int k, int l) +@@ -429,14 +432,26 @@ + */ + public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) { -- if (!world.isRemote && entityplayer.getCurrentEquippedItem() != null && entityplayer.getCurrentEquippedItem().itemID == Item.shears.shiftedIndex) +- if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.shiftedIndex) - { -- entityplayer.addStat(StatList.mineBlockStatArray[blockID], 1); -- dropBlockAsItem_do(world, i, j, k, new ItemStack(Block.vine, 1, 0)); +- par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); +- this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(Block.vine, 1, 0)); - } - else - { -- super.harvestBlock(world, entityplayer, i, j, k, l); +- super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); - } -+ super.harvestBlock(world, entityplayer, i, j, k, l); ++ super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); + } + + @Override -+ public boolean isShearable(ItemStack item, World world, int X, int Y, int Z) ++ public boolean isShearable(ItemStack item, World world, int x, int y, int z) + { -+ return true; ++ return false; + } + + @Override -+ public ArrayList onSheared(ItemStack item, World world, int X, int Y, int Z, int fortune) ++ public ArrayList onSheared(ItemStack item, World world, int x, int y, int z, int fortune) + { + ArrayList ret = new ArrayList(); + ret.add(new ItemStack(this, 1, 0)); + return ret; ++ } ++ ++ @Override ++ public boolean isLadder(World world, int x, int y, int z) ++ { ++ return true; } } diff --git a/forge/patches/minecraft/net/minecraft/src/Chunk.java.patch b/forge/patches/minecraft/net/minecraft/src/Chunk.java.patch index 3e4aff738..8f7ffbc6b 100644 --- a/forge/patches/minecraft/net/minecraft/src/Chunk.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/Chunk.java.patch @@ -1,232 +1,190 @@ --- ../src_base/minecraft/net/minecraft/src/Chunk.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/Chunk.java 0000-00-00 00:00:00.000000000 -0000 -@@ -338,7 +338,7 @@ - { - Block.blocksList[l1].onBlockRemoval(worldObj, i2, j, j2); - } -- else if ((Block.blocksList[l1] instanceof BlockContainer) && l1 != l) -+ else if (Block.blocksList[l1] != null && Block.blocksList[l1].hasTileEntity(getBlockMetadata(i, j, k))) - { - worldObj.removeBlockTileEntity(i2, j, j2); - } -@@ -368,12 +368,12 @@ - { - Block.blocksList[l].onBlockAdded(worldObj, i2, j, j2); - } -- if (Block.blocksList[l] instanceof BlockContainer) -+ if (Block.blocksList[l] != null && Block.blocksList[l].hasTileEntity(i1)) - { - TileEntity tileentity = getChunkBlockTileEntity(i, j, k); - if (tileentity == null) +@@ -546,7 +546,7 @@ { -- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(); -+ tileentity = Block.blocksList[l].getTileEntity(i1); - worldObj.setBlockTileEntity(i2, j, j2, tileentity); + Block.blocksList[var8].onBlockRemoval(this.worldObj, var11, par2, var12); } - if (tileentity != null) -@@ -382,14 +382,6 @@ +- else if (Block.blocksList[var8] instanceof BlockContainer && var8 != par4) ++ else if (Block.blocksList[var8] != null && Block.blocksList[var8].hasTileEntity(getBlockMetadata(par1, par2, par3))) + { + this.worldObj.removeBlockTileEntity(var11, par2, var12); + } +@@ -584,32 +584,23 @@ + Block.blocksList[par4].onBlockAdded(this.worldObj, var11, par2, var12); + } + +- if (Block.blocksList[par4] instanceof BlockContainer) ++ if (Block.blocksList[par4] != null && Block.blocksList[par4].hasTileEntity(par5)) + { + var13 = this.getChunkBlockTileEntity(par1, par2, par3); + + if (var13 == null) + { +- var13 = ((BlockContainer)Block.blocksList[par4]).getBlockEntity(); ++ var13 = Block.blocksList[par4].getTileEntity(par5); + this.worldObj.setBlockTileEntity(var11, par2, var12, var13); + } + + if (var13 != null) + { + var13.updateContainingBlockInfo(); ++ var13.blockMetadata = par5; + } } } - } -- else if (l1 > 0 && (Block.blocksList[l1] instanceof BlockContainer)) -- { -- TileEntity tileentity1 = getChunkBlockTileEntity(i, j, k); -- if (tileentity1 != null) +- else if (var8 > 0 && Block.blocksList[var8] instanceof BlockContainer) - { -- tileentity1.updateContainingBlockInfo(); +- var13 = this.getChunkBlockTileEntity(par1, par2, par3); +- +- if (var13 != null) +- { +- var13.updateContainingBlockInfo(); +- } - } -- } - isModified = true; - return true; - } -@@ -413,7 +405,11 @@ - blocks[i << worldObj.xShift | k << worldObj.heightShift | j] = (byte)(byte0 & 0xff); - if (k1 != 0) - { -- Block.blocksList[k1].onBlockRemoval(worldObj, l1, j, i2); -+ if (!worldObj.isRemote) -+ { -+ Block.blocksList[k1].onBlockRemoval(worldObj, l1, j, i2); -+ } -+ removeChunkBlockTileEntity(i, j, k); +- + this.isModified = true; + return true; } - data.set(i, j, k, 0); - if (Block.lightOpacity[byte0 & 0xff] != 0) -@@ -436,28 +432,22 @@ - { - Block.blocksList[l].onBlockAdded(worldObj, l1, j, i2); - } -- if (l > 0 && (Block.blocksList[l] instanceof BlockContainer)) -+ int meta = getBlockMetadata(i, j, k); -+ if (l > 0 && Block.blocksList[l] != null && Block.blocksList[l].hasTileEntity(meta)) - { - TileEntity tileentity = getChunkBlockTileEntity(i, j, k); - if (tileentity == null) +@@ -640,7 +631,7 @@ + var5.func_48690_b(par1, par2 & 15, par3, par4); + int var7 = var5.func_48703_a(par1, par2 & 15, par3); + +- if (var7 > 0 && Block.blocksList[var7] instanceof BlockContainer) ++ if (var7 > 0 && Block.blocksList[var7] != null && Block.blocksList[var7].hasTileEntity(var5.func_48694_b(par1, par3 & 15, par3))) { -- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(); -+ tileentity = Block.blocksList[l].getTileEntity(meta); - worldObj.setBlockTileEntity(l1, j, i2, tileentity); - } - if (tileentity != null) - { - tileentity.updateContainingBlockInfo(); -+ tileentity.blockMetadata = meta; - } - } - } -- else if (k1 > 0 && (Block.blocksList[k1] instanceof BlockContainer)) -- { -- TileEntity tileentity1 = getChunkBlockTileEntity(i, j, k); -- if (tileentity1 != null) -- { -- tileentity1.updateContainingBlockInfo(); -- } -- } - isModified = true; - return true; - } -@@ -477,7 +467,7 @@ - } - data.set(i, j, k, l); - int j1 = getBlockID(i, j, k); -- if (j1 > 0 && (Block.blocksList[j1] instanceof BlockContainer)) -+ if (j1 > 0 && Block.blocksList[j1] != null && Block.blocksList[j1].hasTileEntity(i1)) - { - TileEntity tileentity = getChunkBlockTileEntity(i, j, k); - if (tileentity != null) -@@ -594,29 +584,27 @@ - { - ChunkPosition chunkposition = new ChunkPosition(i, j, k); - TileEntity tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition); -+ if (tileentity != null && tileentity.isInvalid()) + TileEntity var8 = this.getChunkBlockTileEntity(par1, par2, par3); + +@@ -807,33 +798,31 @@ + ChunkPosition var4 = new ChunkPosition(par1, par2, par3); + TileEntity var5 = (TileEntity)this.chunkTileEntityMap.get(var4); + ++ if (var5 != null && var5.isInvalid()) + { -+ chunkTileEntityMap.remove(chunkposition); -+ tileentity = null; ++ chunkTileEntityMap.remove(var4); ++ var5 = null; + } - if (tileentity == null) ++ + if (var5 == null) { - int l = getBlockID(i, j, k); -- if (!Block.isBlockContainer[l]) -+ int meta = getBlockMetadata(i, j, k); -+ if (Block.blocksList[l] == null || !Block.blocksList[l].hasTileEntity(meta)) + int var6 = this.getBlockID(par1, par2, par3); +- +- if (var6 <= 0 || !Block.blocksList[var6].func_48205_p()) ++ int meta = getBlockMetadata(par1, par2, par3); ++ if (var6 <= 0 || Block.blocksList[var6] == null || !Block.blocksList[var6].hasTileEntity(meta)) { return null; } - if (tileentity == null) + + if (var5 == null) { -- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(); -+ tileentity = Block.blocksList[l].getTileEntity(meta); - worldObj.setBlockTileEntity(xPosition * 16 + i, j, zPosition * 16 + k, tileentity); +- var5 = ((BlockContainer)Block.blocksList[var6]).getBlockEntity(); ++ var5 = Block.blocksList[var6].getTileEntity(meta); + this.worldObj.setBlockTileEntity(this.xPosition * 16 + par1, par2, this.zPosition * 16 + par3, var5); } - tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition); + + var5 = (TileEntity)this.chunkTileEntityMap.get(var4); } -- if (tileentity != null && tileentity.isInvalid()) + +- if (var5 != null && var5.isInvalid()) - { -- chunkTileEntityMap.remove(chunkposition); +- this.chunkTileEntityMap.remove(var4); - return null; - } - else - { -- return tileentity; +- return var5; - } -+ return tileentity; ++ return var5; } - public void addTileEntity(TileEntity tileentity) -@@ -627,7 +615,7 @@ - setChunkBlockTileEntity(i, j, k, tileentity); - if (isChunkLoaded) + /** +@@ -848,7 +837,7 @@ + + if (this.isChunkLoaded) { -- worldObj.loadedTileEntityList.add(tileentity); -+ worldObj.addTileEntity(tileentity); +- this.worldObj.loadedTileEntityList.add(par1TileEntity); ++ this.worldObj.addTileEntity(par1TileEntity); } } -@@ -638,12 +626,18 @@ - tileentity.xCoord = xPosition * 16 + i; - tileentity.yCoord = j; - tileentity.zCoord = zPosition * 16 + k; -- if (getBlockID(i, j, k) == 0 || !(Block.blocksList[getBlockID(i, j, k)] instanceof BlockContainer)) -+ int id = getBlockID(i, j, k); -+ if (id == 0 || Block.blocksList[id] == null || !Block.blocksList[id].hasTileEntity(getBlockMetadata(i, j, k))) - { - return; - } - else - { -+ TileEntity old = (TileEntity)chunkTileEntityMap.get(chunkposition); -+ if (old != null) -+ { -+ old.invalidate(); -+ } - tileentity.validate(); - chunkTileEntityMap.put(chunkposition, tileentity); - return; -@@ -790,6 +784,16 @@ - public int setChunkData(byte abyte0[], int i, int j, int k, int l, int i1, int j1, - int k1) - { -+ TileEntity te; -+ Iterator iterator = chunkTileEntityMap.values().iterator(); -+ while (iterator.hasNext()) -+ { -+ te = (TileEntity)iterator.next(); -+ te.updateContainingBlockInfo(); -+ te.getBlockMetadata(); -+ te.getBlockType(); -+ } -+ - for (int l1 = i; l1 < l; l1++) - { - for (int l2 = k; l2 < j1; l2++) -@@ -835,10 +839,29 @@ - } - } +@@ -863,8 +852,14 @@ + par4TileEntity.yCoord = par2; + par4TileEntity.zCoord = this.zPosition * 16 + par3; -- TileEntity tileentity; -- for (Iterator iterator = chunkTileEntityMap.values().iterator(); iterator.hasNext(); tileentity.updateContainingBlockInfo()) -+ List invalidList=new ArrayList(); -+ iterator = chunkTileEntityMap.values().iterator(); -+ while(iterator.hasNext()) +- if (this.getBlockID(par1, par2, par3) != 0 && Block.blocksList[this.getBlockID(par1, par2, par3)] instanceof BlockContainer) ++ int id = getBlockID(par1, par2, par3); ++ if (id > 0 && Block.blocksList[id] != null && Block.blocksList[id].hasTileEntity(getBlockMetadata(par1, par2, par3))) { -- tileentity = (TileEntity)iterator.next(); -+ te = (TileEntity)iterator.next(); -+ if ((te.xCoord & 15) >= i && (te.xCoord & 15) <= l && -+ (te.yCoord >= j) && (te.yCoord <= i1) && -+ (te.zCoord & 15) >= k && (te.zCoord & 15) <=j1) ++ TileEntity old = (TileEntity)chunkTileEntityMap.get(var5); ++ if (old != null) + { -+ -+ Block bl = te.getBlockType(); -+ if (bl != null && -+ bl.blockID == worldObj.getBlockId(te.xCoord, te.yCoord, te.zCoord) && -+ te.getBlockMetadata() == worldObj.getBlockMetadata(te.xCoord, te.yCoord, te.zCoord)) -+ continue; -+ -+ invalidList.add(te); ++ old.invalidate(); ++ } + par4TileEntity.validate(); + this.chunkTileEntityMap.put(var5, par4TileEntity); + } +@@ -1178,6 +1173,16 @@ + + public void func_48494_a(byte[] par1ArrayOfByte, int par2, int par3, boolean par4) + { ++ ++ Iterator iterator = chunkTileEntityMap.values().iterator(); ++ while(iterator.hasNext()) ++ { ++ TileEntity tileEntity = (TileEntity)iterator.next(); ++ tileEntity.updateContainingBlockInfo(); ++ tileEntity.getBlockMetadata(); ++ tileEntity.getBlockType(); ++ } ++ + int var5 = 0; + int var6; + +@@ -1281,6 +1286,29 @@ + TileEntity var9 = (TileEntity)var10.next(); + var9.updateContainingBlockInfo(); + } ++ ++ List invalidList = new ArrayList(); ++ iterator = chunkTileEntityMap.values().iterator(); ++ while (iterator.hasNext()) ++ { ++ TileEntity tileEntity = (TileEntity)iterator.next(); ++ int x = tileEntity.xCoord & 15; ++ int y = tileEntity.yCoord; ++ int z = tileEntity.zCoord & 15; ++ /* This function is called when an entire chunk is sent, so we don't need to check the bounds. ++ if (x >= xStart && x <= xStop && y >= yStart && y <= yEnd && z >= zStart && z <= zStop) ++ */ ++ Block block = tileEntity.getBlockType(); ++ if (block == null || block.blockID != getBlockID(x, y, z) || tileEntity.getBlockMetadata() != getBlockMetadata(x, y, z)) ++ { ++ invalidList.add(tileEntity); + } + } -+ -+ for(TileEntity te2 : invalidList) ++ ++ for (TileEntity tileEntity : invalidList) + { -+ te2.invalidate(); - } ++ tileEntity.invalidate(); ++ } + } - return k1; -@@ -917,4 +940,18 @@ - { - return new ChunkCoordIntPair(xPosition, zPosition); + public BiomeGenBase func_48490_a(int par1, int par2, WorldChunkManager par3WorldChunkManager) +@@ -1369,4 +1397,18 @@ + } + } } + -+ /* FORGE: Used to remove only invalid TileEntities */ -+ public void cleanChunkBlockTileEntity(int i, int j, int k) ++ /** FORGE: Used to remove only invalid TileEntities */ ++ public void cleanChunkBlockTileEntity(int x, int y, int z) + { -+ ChunkPosition chunkposition = new ChunkPosition(i, j, k); ++ ChunkPosition position = new ChunkPosition(x, y, z); + if (isChunkLoaded) + { -+ TileEntity tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition); -+ if (tileentity != null && tileentity.isInvalid()) ++ TileEntity entity = (TileEntity)chunkTileEntityMap.get(position); ++ if (entity != null && entity.isInvalid()) + { -+ chunkTileEntityMap.remove(chunkposition); ++ chunkTileEntityMap.remove(position); + } + } + } diff --git a/forge/patches/minecraft/net/minecraft/src/ContainerCreative.java.patch b/forge/patches/minecraft/net/minecraft/src/ContainerCreative.java.patch index a7987a665..7954a7597 100644 --- a/forge/patches/minecraft/net/minecraft/src/ContainerCreative.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/ContainerCreative.java.patch @@ -1,28 +1,27 @@ --- ../src_base/minecraft/net/minecraft/src/ContainerCreative.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/ContainerCreative.java 0000-00-00 00:00:00.000000000 -0000 -@@ -65,17 +65,20 @@ - itemList.add(new ItemStack(ablock[l1], 1, k2)); - } +@@ -57,12 +57,20 @@ -- for (int i2 = 256; i2 < Item.itemsList.length; i2++) -+ for(int x = 0; x < Block.blocksList.length; x++) + this.itemList.add(new ItemStack(var2[var10], 1, var11)); + } +- +- for (var10 = 256; var10 < Item.itemsList.length; ++var10) ++ ++ for (Block block : Block.blocksList) ++ { ++ if (block != null) ++ { ++ block.addCreativeItems((ArrayList)itemList); ++ } ++ } ++ ++ for (Item item : Item.itemsList) { -- if (Item.itemsList[i2] != null && Item.itemsList[i2].shiftedIndex != Item.potion.shiftedIndex && Item.itemsList[i2].shiftedIndex != Item.monsterPlacer.shiftedIndex) -+ if (Block.blocksList[x] != null) +- if (Item.itemsList[var10] != null && Item.itemsList[var10].shiftedIndex != Item.potion.shiftedIndex && Item.itemsList[var10].shiftedIndex != Item.monsterPlacer.shiftedIndex) ++ if (item != null) { -- itemList.add(new ItemStack(Item.itemsList[i2])); -+ Block.blocksList[x].addCreativeItems((ArrayList)itemList); +- this.itemList.add(new ItemStack(Item.itemsList[var10])); ++ item.addCreativeItems((ArrayList)itemList); } } -- for (int j2 = 1; j2 < 16; j2++) -+ for (int i2 = Block.blocksList.length; i2 < Item.itemsList.length; i2++) - { -- itemList.add(new ItemStack(Item.dyePowder.shiftedIndex, 1, j2)); -+ if (Item.itemsList[i2] != null) -+ { -+ Item.itemsList[i2].addCreativeItems((ArrayList)itemList); -+ } - } - - Integer integer; diff --git a/forge/patches/minecraft/net/minecraft/src/CraftingManager.java.patch b/forge/patches/minecraft/net/minecraft/src/CraftingManager.java.patch index 104d7261a..80a2ad81e 100644 --- a/forge/patches/minecraft/net/minecraft/src/CraftingManager.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/CraftingManager.java.patch @@ -1,11 +1,11 @@ --- ../src_base/minecraft/net/minecraft/src/CraftingManager.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/CraftingManager.java 0000-00-00 00:00:00.000000000 -0000 -@@ -423,7 +423,7 @@ - i++; +@@ -239,7 +239,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 (var2 == 2 && var3.itemID == var4.itemID && var3.stackSize == 1 && var4.stackSize == 1 && Item.itemsList[var3.itemID].isDamageable()) ++ if (var2 == 2 && var3.itemID == var4.itemID && var3.stackSize == 1 && var4.stackSize == 1 && Item.itemsList[var3.itemID].isRepairable()) { - Item item = Item.itemsList[itemstack.itemID]; - int l = item.getMaxDamage() - itemstack.getItemDamageForDisplay(); + Item var11 = Item.itemsList[var3.itemID]; + int var10 = var11.getMaxDamage() - var3.getItemDamageForDisplay(); diff --git a/forge/patches/minecraft/net/minecraft/src/EffectRenderer.java.patch b/forge/patches/minecraft/net/minecraft/src/EffectRenderer.java.patch index 08da01220..0591f9742 100644 --- a/forge/patches/minecraft/net/minecraft/src/EffectRenderer.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/EffectRenderer.java.patch @@ -1,30 +1,24 @@ --- ../src_base/minecraft/net/minecraft/src/EffectRenderer.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/EffectRenderer.java 0000-00-00 00:00:00.000000000 -0000 -@@ -1,17 +1,23 @@ - package net.minecraft.src; - - import java.util.*; -+ -+import net.minecraft.src.forge.BlockTextureParticles; -+import net.minecraft.src.forge.ITextureProvider; -+ +@@ -5,6 +5,8 @@ + import java.util.Random; import org.lwjgl.opengl.GL11; ++import net.minecraft.src.forge.*; ++ public class EffectRenderer { - protected World worldObj; - private List fxLayers[]; -+ private List effectList; - private RenderEngine renderer; - private Random rand; + /** Reference to the World object. */ +@@ -15,6 +17,8 @@ + /** RNG. */ + private Random rand = new Random(); - public EffectRenderer(World world, RenderEngine renderengine) ++ private List effectList = new ArrayList(); ++ + public EffectRenderer(World par1World, RenderEngine par2RenderEngine) { -+ effectList = new ArrayList(); - fxLayers = new List[4]; - rand = new Random(); - if (world != null) -@@ -49,6 +55,23 @@ + if (par1World != null) +@@ -57,6 +61,23 @@ } } } @@ -34,7 +28,7 @@ + BlockTextureParticles entry = (BlockTextureParticles)effectList.get(x); + for (int y = 0; y < entry.effects.size(); y++) + { -+ EntityFX entityfx = (EntityFX) entry.effects.get(y); ++ EntityFX entityfx = (EntityFX)entry.effects.get(y); + if (entityfx.isDead) + { + entry.effects.remove(y--); @@ -47,42 +41,40 @@ + } } - public void renderParticles(Entity entity, float f) -@@ -87,12 +110,31 @@ - for (int k = 0; k < fxLayers[i].size(); k++) - { - EntityFX entityfx = (EntityFX)fxLayers[i].get(k); -+ if (entityfx instanceof EntityDiggingFX) -+ { -+ continue; -+ } - tessellator.setBrightness(entityfx.getEntityBrightnessForRender(f)); - entityfx.renderParticle(tessellator, f, f1, f5, f2, f3, f4); - } + /** +@@ -102,12 +123,29 @@ + for (int var11 = 0; var11 < this.fxLayers[var8].size(); ++var11) + { + EntityFX var12 = (EntityFX)this.fxLayers[var8].get(var11); ++ if (var12 instanceof EntityDiggingFX) ++ { ++ continue; ++ } + var10.setBrightness(var12.getEntityBrightnessForRender(par2)); + var12.renderParticle(var10, par2, var3, var7, var4, var5, var6); + } - tessellator.draw(); - } -+ -+ Tessellator tessellator = Tessellator.instance; -+ for (int x = 0; x < effectList.size(); x++) -+ { -+ BlockTextureParticles entry = (BlockTextureParticles) effectList.get(x); -+ GL11.glBindTexture(3553 /* GL_TEXTURE_2D */, renderer.getTexture(entry.texture)); -+ tessellator.startDrawingQuads(); -+ for (int y = 0; y < entry.effects.size(); y++) + var10.draw(); + } ++ Tessellator tessallator = Tessellator.instance; ++ for (int x = 0; x < effectList.size(); x++) + { -+ EntityFX entityfx = (EntityFX) entry.effects.get(y); -+ tessellator.setBrightness(entityfx.getEntityBrightnessForRender(f)); -+ entityfx.renderParticle(tessellator, f, f1, f5, f2, f3, f4); ++ BlockTextureParticles entry = (BlockTextureParticles)effectList.get(x); ++ GL11.glBindTexture(GL11.GL_TEXTURE_2D, renderer.getTexture(entry.texture)); ++ tessallator.startDrawingQuads(); ++ for (int y = 0; y < entry.effects.size(); y++) ++ { ++ EntityFX entryfx = (EntityFX)entry.effects.get(y); ++ tessallator.setBrightness(entryfx.getEntityBrightnessForRender(par2)); ++ entryfx.renderParticle(tessallator, par2, var3, var7, var4, var5, var6); ++ } + } -+ tessellator.draw(); -+ } + } } - public void func_1187_b(Entity entity, float f) -@@ -123,6 +165,12 @@ - { - fxLayers[i].clear(); +@@ -131,6 +169,12 @@ + var11.renderParticle(var9, par2, var3, var7, var4, var5, var6); + } } + for (int x = 0; x < effectList.size(); x++) + { @@ -92,62 +84,67 @@ + effectList.clear(); } - public void addBlockDestroyEffects(int i, int j, int k, int l, int i1) -@@ -143,7 +191,11 @@ - double d1 = (double)j + ((double)l1 + 0.5D) / (double)j1; - double d2 = (double)k + ((double)i2 + 0.5D) / (double)j1; - int j2 = rand.nextInt(6); -- addEffect((new EntityDiggingFX(worldObj, d, d1, d2, d - (double)i - 0.5D, d1 - (double)j - 0.5D, d2 - (double)k - 0.5D, block, j2, i1)).func_4041_a(i, j, k)); -+ EntityDiggingFX dig_effect = new EntityDiggingFX(worldObj, d, d1, d2, -+ d - (double)i - 0.5D, d1 - (double)j - 0.5D, -+ d2 - (double)k - 0.5D, block, j2, i1); -+ dig_effect.func_4041_a(i, j, k); -+ addDigParticleEffect(dig_effect, block); - } - } - } -@@ -185,11 +237,43 @@ + public void clearEffects(World par1World) +@@ -141,6 +185,13 @@ { - d = (double)i + block.maxX + (double)f; + this.fxLayers[var2].clear(); } -- addEffect((new EntityDiggingFX(worldObj, d, d1, d2, 0.0D, 0.0D, 0.0D, block, l, worldObj.getBlockMetadata(i, j, k))).func_4041_a(i, j, k).multiplyVelocity(0.2F).func_405_d(0.6F)); -+ EntityDiggingFX dig_effect = new EntityDiggingFX(worldObj, d, d1, d2, 0.0D, 0.0D, 0.0D, block, l, worldObj.getBlockMetadata(i, j, k)); -+ dig_effect.func_4041_a(i, j, k); -+ dig_effect.multiplyVelocity(0.4F); -+ dig_effect.func_405_d(0.6F); -+ addDigParticleEffect(dig_effect, block); - } - - public String getStatistics() - { - return (new StringBuilder()).append("").append(fxLayers[0].size() + fxLayers[1].size() + fxLayers[2].size()).toString(); - } -+ -+ public void addDigParticleEffect(EntityDiggingFX dig_effect, Block block) -+ { -+ boolean added = false; -+ String comp = "/terrain.png"; -+ -+ if (block instanceof ITextureProvider) -+ { -+ comp = ((ITextureProvider)block).getTextureFile(); -+ } ++ + for (int x = 0; x < effectList.size(); x++) + { + BlockTextureParticles entry = (BlockTextureParticles)effectList.get(x); -+ if (entry.texture.equals(comp)) ++ entry.effects.clear(); ++ } ++ effectList.clear(); + } + + public void addBlockDestroyEffects(int par1, int par2, int par3, int par4, int par5) +@@ -160,7 +211,7 @@ + double var13 = (double)par2 + ((double)var9 + 0.5D) / (double)var7; + double var15 = (double)par3 + ((double)var10 + 0.5D) / (double)var7; + int var17 = this.rand.nextInt(6); +- this.addEffect((new EntityDiggingFX(this.worldObj, var11, var13, var15, var11 - (double)par1 - 0.5D, var13 - (double)par2 - 0.5D, var15 - (double)par3 - 0.5D, var6, var17, par5)).func_4041_a(par1, par2, par3)); ++ addDigParticleEffect((EntityDiggingFX)(new EntityDiggingFX(this.worldObj, var11, var13, var15, var11 - (double)par1 - 0.5D, var13 - (double)par2 - 0.5D, var15 - (double)par3 - 0.5D, var6, var17, par5)).func_4041_a(par1, par2, par3), var6); + } + } + } +@@ -212,7 +263,7 @@ + var8 = (double)par1 + var6.maxX + (double)var7; + } + +- this.addEffect((new EntityDiggingFX(this.worldObj, var8, var10, var12, 0.0D, 0.0D, 0.0D, var6, par4, this.worldObj.getBlockMetadata(par1, par2, par3))).func_4041_a(par1, par2, par3).multiplyVelocity(0.2F).func_405_d(0.6F)); ++ addDigParticleEffect((EntityDiggingFX)(new EntityDiggingFX(this.worldObj, var8, var10, var12, 0.0D, 0.0D, 0.0D, var6, par4, this.worldObj.getBlockMetadata(par1, par2, par3))).func_4041_a(par1, par2, par3).multiplyVelocity(0.2F).func_405_d(0.6F), var6); + } + } + +@@ -220,4 +271,30 @@ + { + return "" + (this.fxLayers[0].size() + this.fxLayers[1].size() + this.fxLayers[2].size()); + } ++ ++ public void addDigParticleEffect(EntityDiggingFX effect, Block block) ++ { ++ boolean added = false; ++ String texture = ForgeHooksClient.getTexture("/terrain.png", block); ++ ++ for (int x = 0; x < effectList.size(); x++) ++ { ++ BlockTextureParticles entry = (BlockTextureParticles)effectList.get(x); ++ if (entry.texture.equals(texture)) + { -+ entry.effects.add(dig_effect); ++ entry.effects.add(effect); + added = true; + } + } ++ + if (!added) + { + BlockTextureParticles entry = new BlockTextureParticles(); -+ entry.texture = comp; -+ entry.effects.add(dig_effect); ++ entry.texture = texture; ++ entry.effects.add(effect); + effectList.add(entry); + } -+ addEffect(dig_effect); ++ ++ addEffect(effect); + } } diff --git a/forge/patches/minecraft/net/minecraft/src/Enchantment.java.patch b/forge/patches/minecraft/net/minecraft/src/Enchantment.java.patch index 180c55541..8634641d7 100644 --- a/forge/patches/minecraft/net/minecraft/src/Enchantment.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/Enchantment.java.patch @@ -1,19 +1,17 @@ --- ../src_base/minecraft/net/minecraft/src/Enchantment.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/Enchantment.java 0000-00-00 00:00:00.000000000 -0000 -@@ -102,6 +102,16 @@ - return (new StringBuilder()).append(s).append(" ").append(StatCollector.translateToLocal((new StringBuilder()).append("enchantment.level.").append(i).toString())).toString(); +@@ -192,4 +192,14 @@ + String var2 = StatCollector.translateToLocal(this.getName()); + return var2 + " " + StatCollector.translateToLocal("enchantment.level." + par1); } - ++ + /** -+ * Called to determine if this enchantment can be applied to a ItemStack -+ * @param item The ItemStack that the enchantment might be put on -+ * @return True if the item is valid, false otherwise -+ */ ++ * Called to determine if this enchantment can be applied to a ItemStack ++ * @param item The ItemStack that the enchantment might be put on ++ * @return True if the item is valid, false otherwise ++ */ + public boolean canEnchantItem(ItemStack item) + { -+ return type.canEnchantItem(item.getItem()); ++ return type.canEnchantItem(item.getItem()); + } -+ - static - { - looting = new EnchantmentLootBonus(21, 2, EnumEnchantmentType.weapon); + } diff --git a/forge/patches/minecraft/net/minecraft/src/EnchantmentHelper.java.patch b/forge/patches/minecraft/net/minecraft/src/EnchantmentHelper.java.patch index 3a881ba16..5b4dc06bb 100644 --- a/forge/patches/minecraft/net/minecraft/src/EnchantmentHelper.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/EnchantmentHelper.java.patch @@ -1,11 +1,11 @@ --- ../src_base/minecraft/net/minecraft/src/EnchantmentHelper.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/EnchantmentHelper.java 0000-00-00 00:00:00.000000000 -0000 -@@ -261,7 +261,7 @@ - for (int k = 0; k < j; k++) +@@ -354,7 +354,7 @@ { - Enchantment enchantment = aenchantment[k]; -- if (enchantment == null || !enchantment.type.canEnchantItem(item)) -+ if (enchantment == null || !enchantment.canEnchantItem(itemstack)) + Enchantment var7 = var4[var6]; + +- if (var7 != null && var7.type.canEnchantItem(var2)) ++ if (var7 != null && var7.canEnchantItem(par1ItemStack)) { - continue; - } + for (int var8 = var7.getMinLevel(); var8 <= var7.getMaxLevel(); ++var8) + { diff --git a/forge/patches/minecraft/net/minecraft/src/Entity.java.patch b/forge/patches/minecraft/net/minecraft/src/Entity.java.patch index 2ed97166e..c42c2b1ec 100644 --- a/forge/patches/minecraft/net/minecraft/src/Entity.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/Entity.java.patch @@ -1,16 +1,16 @@ --- ../src_base/minecraft/net/minecraft/src/Entity.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/Entity.java 0000-00-00 00:00:00.000000000 -0000 -@@ -70,6 +70,9 @@ - public int serverPosZ; +@@ -177,6 +177,9 @@ + */ public boolean ignoreFrustrumCheck; public boolean isAirBorne; + -+ //Forge: Used to store custom data for each entity. ++ /** Forge: Used to store custom data for each entity. */ + private NBTTagCompound customEntityData; - public Entity(World world) + public Entity(World par1World) { -@@ -110,6 +113,20 @@ +@@ -218,6 +221,20 @@ } protected abstract void entityInit(); @@ -31,25 +31,25 @@ public DataWatcher getDataWatcher() { -@@ -967,6 +984,10 @@ - nbttagcompound.setShort("Fire", (short)fire); - nbttagcompound.setShort("Air", (short)getAir()); - nbttagcompound.setBoolean("OnGround", onGround); -+ if (customEntityData != null) +@@ -1290,6 +1307,10 @@ + par1NBTTagCompound.setShort("Fire", (short)this.fire); + par1NBTTagCompound.setShort("Air", (short)this.getAir()); + par1NBTTagCompound.setBoolean("OnGround", this.onGround); ++ if (customEntityData != null) + { -+ nbttagcompound.setCompoundTag("ForgeData", customEntityData); -+ } - writeEntityToNBT(nbttagcompound); - } - -@@ -1001,6 +1022,10 @@ - onGround = nbttagcompound.getBoolean("OnGround"); - setPosition(posX, posY, posZ); - setRotation(rotationYaw, rotationPitch); -+ if (nbttagcompound.hasKey("ForgeData")) -+ { -+ customEntityData = nbttagcompound.getCompoundTag("ForgeData"); ++ par1NBTTagCompound.setCompoundTag("ForgeData", customEntityData); + } - readEntityFromNBT(nbttagcompound); + this.writeEntityToNBT(par1NBTTagCompound); + } + +@@ -1331,6 +1352,10 @@ + this.onGround = par1NBTTagCompound.getBoolean("OnGround"); + this.setPosition(this.posX, this.posY, this.posZ); + this.setRotation(this.rotationYaw, this.rotationPitch); ++ if (par1NBTTagCompound.hasKey("ForgeData")) ++ { ++ customEntityData = par1NBTTagCompound.getCompoundTag("ForgeData"); ++ } + this.readEntityFromNBT(par1NBTTagCompound); } diff --git a/forge/patches/minecraft/net/minecraft/src/EntityItem.java.patch b/forge/patches/minecraft/net/minecraft/src/EntityItem.java.patch index ef50c3867..7d884fbd3 100644 --- a/forge/patches/minecraft/net/minecraft/src/EntityItem.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/EntityItem.java.patch @@ -1,30 +1,33 @@ --- ../src_base/minecraft/net/minecraft/src/EntityItem.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/EntityItem.java 0000-00-00 00:00:00.000000000 -0000 -@@ -2,6 +2,8 @@ - - import java.util.Random; +@@ -1,5 +1,7 @@ + package net.minecraft.src; +import net.minecraft.src.forge.ForgeHooks; + public class EntityItem extends Entity { - public ItemStack item; -@@ -139,6 +141,18 @@ - return; - } - int i = item.stackSize; -+ if (delayBeforeCanPickup == 0 && !ForgeHooks.onItemPickup(entityplayer, this)) -+ { -+ ModLoader.OnItemPickup(entityplayer, item); -+ worldObj.playSoundAtEntity(this, "random.pop", 0.2F, ((rand.nextFloat() - rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); -+ entityplayer.onItemPickup(this, i); -+ if (item.stackSize <= 0) -+ { -+ setEntityDead(); -+ } -+ return; -+ } -+ i = item.stackSize; - if (delayBeforeCanPickup == 0 && entityplayer.inventory.addItemStackToInventory(item)) + /** The item stack of this EntityItem. */ +@@ -170,7 +172,21 @@ + if (!this.worldObj.isRemote) { - if (item.itemID == Block.wood.blockID) + int var2 = this.item.stackSize; +- ++ ++ if (delayBeforeCanPickup == 0 && !ForgeHooks.onItemPickup(par1EntityPlayer, this)) ++ { ++ ModLoader.onItemPickup(par1EntityPlayer, item); ++ this.worldObj.playSoundAtEntity(this, "random.pop", 0.2F, ((rand.nextFloat() - rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); ++ par1EntityPlayer.onItemPickup(this, var2); ++ if (item.stackSize <= 0) ++ { ++ setEntityDead(); ++ } ++ return; ++ } ++ ++ var2 = item.stackSize; ++ + if (this.delayBeforeCanPickup == 0 && par1EntityPlayer.inventory.addItemStackToInventory(this.item)) + { + if (this.item.itemID == Block.wood.blockID) diff --git a/forge/patches/minecraft/net/minecraft/src/EntityLiving.java.patch b/forge/patches/minecraft/net/minecraft/src/EntityLiving.java.patch index 7c8bea6c4..256a496d4 100644 --- a/forge/patches/minecraft/net/minecraft/src/EntityLiving.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/EntityLiving.java.patch @@ -1,26 +1,20 @@ --- ../src_base/minecraft/net/minecraft/src/EntityLiving.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/EntityLiving.java 0000-00-00 00:00:00.000000000 -0000 -@@ -29,7 +29,7 @@ - public float swingProgress; - protected int health; - public int prevHealth; +@@ -49,7 +49,7 @@ + * in each step in the damage calculations, this is set to the 'carryover' that would result if someone was damaged + * .25 hearts (for example), and added to the damage in the next step + */ - protected int carryoverDamage; + public int carryoverDamage; + + /** Number of ticks since this EntityLiving last produced its sound */ private int livingSoundTime; - public int hurtTime; - public int maxHurtTime; -@@ -835,7 +835,13 @@ - int i = MathHelper.floor_double(posX); - int j = MathHelper.floor_double(boundingBox.minY); - int k = MathHelper.floor_double(posZ); -- return worldObj.getBlockId(i, j, k) == Block.ladder.blockID; -+ -+ Block block = Block.blocksList[worldObj.getBlockId(i, j, k)]; -+ if (block == null) -+ { -+ return false; -+ } -+ return block.isLadder(worldObj, i, j, k); +@@ -1286,7 +1286,7 @@ + int var2 = MathHelper.floor_double(this.boundingBox.minY); + int var3 = MathHelper.floor_double(this.posZ); + int var4 = this.worldObj.getBlockId(var1, var2, var3); +- return var4 == Block.ladder.blockID || var4 == Block.vine.blockID; ++ return Block.blocksList[var4] != null && Block.blocksList[var4].isLadder(worldObj, var1, var2, var3); } - public void writeEntityToNBT(NBTTagCompound nbttagcompound) + /** diff --git a/forge/patches/minecraft/net/minecraft/src/EntityMinecart.java.patch b/forge/patches/minecraft/net/minecraft/src/EntityMinecart.java.patch index ea752fc98..584fdae7f 100644 --- a/forge/patches/minecraft/net/minecraft/src/EntityMinecart.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/EntityMinecart.java.patch @@ -1,37 +1,28 @@ --- ../src_base/minecraft/net/minecraft/src/EntityMinecart.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/EntityMinecart.java 0000-00-00 00:00:00.000000000 -0000 -@@ -1,18 +1,23 @@ +@@ -1,28 +1,48 @@ package net.minecraft.src; +import java.util.ArrayList; import java.util.List; - import java.util.Random; -+import net.minecraft.src.forge.ForgeHooks; -+import net.minecraft.src.forge.IMinecartCollisionHandler; -+import net.minecraft.src.forge.MinecraftForge; ++import net.minecraft.src.forge.*; + - public class EntityMinecart extends Entity - implements IInventory + public class EntityMinecart extends Entity implements IInventory { -- private ItemStack cargoItems[]; + /** Array of item stacks stored in minecart (for storage minecarts). */ +- private ItemStack[] cargoItems; - private int fuel; - private boolean field_856_i; -+ protected ItemStack cargoItems[]; ++ protected ItemStack[] cargoItems; + protected int fuel; + protected boolean field_856_i; + + /** The type of minecart, 2 for powered, 1 for storage. */ public int minecartType; public double pushX; public double pushZ; -- private static final int field_855_j[][][] = -+ protected static final int field_855_j[][][] = - { - { - { -@@ -76,16 +81,35 @@ - } - } - }; +- private static final int[][][] field_855_j = new int[][][] {{{0, 0, -1}, {0, 0, 1}}, {{ -1, 0, 0}, {1, 0, 0}}, {{ -1, -1, 0}, {1, 0, 0}}, {{ -1, 0, 0}, {1, -1, 0}}, {{0, 0, -1}, {0, -1, 1}}, {{0, -1, -1}, {0, 0, 1}}, {{0, 0, 1}, {1, 0, 0}}, {{0, 0, 1}, { -1, 0, 0}}, {{0, 0, -1}, { -1, 0, 0}}, {{0, 0, -1}, {1, 0, 0}}}; - private int turnProgress; - private double minecartX; - private double minecartY; @@ -41,7 +32,7 @@ - private double velocityX; - private double velocityY; - private double velocityZ; -- ++ protected static final int[][][] field_855_j = new int[][][] {{{0, 0, -1}, {0, 0, 1}}, {{ -1, 0, 0}, {1, 0, 0}}, {{ -1, -1, 0}, {1, 0, 0}}, {{ -1, 0, 0}, {1, -1, 0}}, {{0, 0, -1}, {0, -1, 1}}, {{0, -1, -1}, {0, 0, 1}}, {{0, 0, 1}, {1, 0, 0}}, {{0, 0, 1}, { -1, 0, 0}}, {{0, 0, -1}, { -1, 0, 0}}, {{0, 0, -1}, {1, 0, 0}}}; + protected int turnProgress; + protected double minecartX; + protected double minecartY; @@ -51,8 +42,8 @@ + protected double velocityX; + protected double velocityY; + protected double velocityZ; -+ -+ /*Forge: Minecart Compatibility Layer Integration. */ ++ ++ /* Forge: Minecart Compatibility Layer Integration. */ + public static float defaultMaxSpeedRail = 0.4f; + public static float defaultMaxSpeedGround = 0.4f; + public static float defaultMaxSpeedAirLateral = 0.4f; @@ -62,22 +53,19 @@ + protected boolean canBePushed = true; + private static IMinecartCollisionHandler collisionHandler = null; + -+ /* -+ * Instance versions of the above physics properties -+ */ ++ /* Instance versions of the above physics properties */ + protected float maxSpeedRail; + protected float maxSpeedGround; + protected float maxSpeedAirLateral; + protected float maxSpeedAirVertical; + protected double dragAir; -+ - public EntityMinecart(World world) + + public EntityMinecart(World par1World) { - super(world); -@@ -95,6 +119,18 @@ - preventEntitySpawning = true; - setSize(0.98F, 0.7F); - yOffset = height / 2.0F; +@@ -33,6 +53,18 @@ + this.preventEntitySpawning = true; + this.setSize(0.98F, 0.7F); + this.yOffset = this.height / 2.0F; + + maxSpeedRail = defaultMaxSpeedRail; + maxSpeedGround = defaultMaxSpeedGround; @@ -88,475 +76,498 @@ + + public EntityMinecart(World world, int type) + { -+ this(world); -+ minecartType = type; ++ this(world); ++ minecartType = type; } - protected boolean canTriggerWalking() -@@ -112,17 +148,27 @@ - - public AxisAlignedBB getCollisionBox(Entity entity) + /** +@@ -58,6 +90,10 @@ + */ + public AxisAlignedBB getCollisionBox(Entity par1Entity) { -+ if (getCollisionHandler() != null) -+ { -+ return getCollisionHandler().getCollisionBox(this, entity); -+ } -+ - return entity.boundingBox; ++ if (getCollisionHandler() != null) ++ { ++ return getCollisionHandler().getCollisionBox(this, par1Entity); ++ } + return par1Entity.boundingBox; } +@@ -66,6 +102,10 @@ + */ public AxisAlignedBB getBoundingBox() { -+ if (getCollisionHandler() != null) -+ { -+ return getCollisionHandler().getBoundingBox(this); -+ } -+ ++ if (getCollisionHandler() != null) ++ { ++ return getCollisionHandler().getBoundingBox(this); ++ } return null; } +@@ -74,7 +114,7 @@ + */ public boolean canBePushed() { - return true; -+ return canBePushed; ++ return canBePushed; } - public EntityMinecart(World world, double d, double d1, double d2, -@@ -161,49 +207,8 @@ - riddenByEntity.mountEntity(this); - } - setEntityDead(); -- dropItemWithOffset(Item.minecartEmpty.shiftedIndex, 1, 0.0F); -- if (minecartType == 1) -- { -- EntityMinecart entityminecart = this; -- label0: -- for (int j = 0; j < entityminecart.getSizeInventory(); j++) + public EntityMinecart(World par1World, double par2, double par4, double par6, int par8) +@@ -118,48 +158,7 @@ + } + + this.setEntityDead(); +- this.dropItemWithOffset(Item.minecartEmpty.shiftedIndex, 1, 0.0F); +- +- if (this.minecartType == 1) - { -- ItemStack itemstack = entityminecart.getStackInSlot(j); -- if (itemstack == null) +- EntityMinecart var3 = this; +- +- for (int var4 = 0; var4 < var3.getSizeInventory(); ++var4) - { -- continue; -- } -- float f = rand.nextFloat() * 0.8F + 0.1F; -- float f1 = rand.nextFloat() * 0.8F + 0.1F; -- float f2 = rand.nextFloat() * 0.8F + 0.1F; -- do -- { -- if (itemstack.stackSize <= 0) +- ItemStack var5 = var3.getStackInSlot(var4); +- +- if (var5 != null) - { -- continue label0; +- float var6 = this.rand.nextFloat() * 0.8F + 0.1F; +- float var7 = this.rand.nextFloat() * 0.8F + 0.1F; +- float var8 = this.rand.nextFloat() * 0.8F + 0.1F; +- +- while (var5.stackSize > 0) +- { +- int var9 = this.rand.nextInt(21) + 10; +- +- if (var9 > var5.stackSize) +- { +- var9 = var5.stackSize; +- } +- +- var5.stackSize -= var9; +- EntityItem var10 = new EntityItem(this.worldObj, this.posX + (double)var6, this.posY + (double)var7, this.posZ + (double)var8, new ItemStack(var5.itemID, var9, var5.getItemDamage())); +- float var11 = 0.05F; +- var10.motionX = (double)((float)this.rand.nextGaussian() * var11); +- var10.motionY = (double)((float)this.rand.nextGaussian() * var11 + 0.2F); +- var10.motionZ = (double)((float)this.rand.nextGaussian() * var11); +- this.worldObj.spawnEntityInWorld(var10); +- } - } -- int k = rand.nextInt(21) + 10; -- if (k > itemstack.stackSize) -- { -- k = itemstack.stackSize; -- } -- itemstack.stackSize -= k; -- EntityItem entityitem = new EntityItem(worldObj, posX + (double)f, posY + (double)f1, posZ + (double)f2, new ItemStack(itemstack.itemID, k, itemstack.getItemDamage())); -- float f3 = 0.05F; -- entityitem.motionX = (float)rand.nextGaussian() * f3; -- entityitem.motionY = (float)rand.nextGaussian() * f3 + 0.2F; -- entityitem.motionZ = (float)rand.nextGaussian() * f3; -- worldObj.spawnEntityInWorld(entityitem); - } -- while (true); +- +- this.dropItemWithOffset(Block.chest.blockID, 1, 0.0F); +- } +- else if (this.minecartType == 2) +- { +- this.dropItemWithOffset(Block.stoneOvenIdle.blockID, 1, 0.0F); +- } ++ dropCartAsItem(); + } + + return true; +@@ -241,7 +240,7 @@ + this.func_41024_b(this.func_41025_i() - 1); + } + +- if (this.isMinecartPowered() && this.rand.nextInt(4) == 0) ++ if (this.isMinecartPowered() && this.rand.nextInt(4) == 0 && minecartType == 2 && getClass() == EntityMinecart.class) + { + this.worldObj.spawnParticle("largesmoke", this.posX, this.posY + 0.8D, this.posZ, 0.0D, 0.0D, 0.0D); + } +@@ -296,25 +295,20 @@ + double var6 = 0.0078125D; + int var8 = this.worldObj.getBlockId(var1, var2, var3); + +- if (BlockRail.isRailBlock(var8)) ++ if (canUseRail() && BlockRail.isRailBlock(var8)) + { + Vec3D var9 = this.func_514_g(this.posX, this.posY, this.posZ); +- int var10 = this.worldObj.getBlockMetadata(var1, var2, var3); ++ int var10 = ((BlockRail)Block.blocksList[var8]).getBasicRailMetadata(worldObj, this, var1, var2, var3); + this.posY = (double)var2; + boolean var11 = false; + boolean var12 = false; + + if (var8 == Block.railPowered.blockID) + { +- var11 = (var10 & 8) != 0; ++ var11 = (worldObj.getBlockMetadata(var1, var2, var3) & 8) != 0; + var12 = !var11; + } + +- if (((BlockRail)Block.blocksList[var8]).isPowered()) +- { +- var10 &= 7; - } - -- dropItemWithOffset(Block.chest.blockID, 1, 0.0F); -- } -- else if (minecartType == 2) -- { -- dropItemWithOffset(Block.stoneOvenIdle.blockID, 1, 0.0F); -- } + if (var10 >= 2 && var10 <= 5) + { + this.posY = (double)(var2 + 1); +@@ -357,7 +351,7 @@ + this.motionZ = var22 * var16 / var18; + double var24; + +- if (var12) ++ if (var12 && shouldDoRailFunctions()) + { + var24 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); + +@@ -407,36 +401,8 @@ + this.posX = var26 + var14 * var24; + this.posZ = var28 + var16 * var24; + this.setPosition(this.posX, this.posY + (double)this.yOffset, this.posZ); +- var34 = this.motionX; +- var36 = this.motionZ; +- +- if (this.riddenByEntity != null) +- { +- var34 *= 0.75D; +- var36 *= 0.75D; +- } +- +- if (var34 < -var4) +- { +- var34 = -var4; +- } +- +- if (var34 > var4) +- { +- var34 = var4; +- } +- +- if (var36 < -var4) +- { +- var36 = -var4; +- } +- +- if (var36 > var4) +- { +- var36 = var4; +- } +- +- this.moveEntity(var34, 0.0D, var36); ++ ++ moveMinecartOnRail(var1, var2, var3); + + if (var13[0][1] != 0 && MathHelper.floor_double(this.posX) - var1 == var13[0][0] && MathHelper.floor_double(this.posZ) - var3 == var13[0][2]) + { +@@ -447,41 +413,7 @@ + this.setPosition(this.posX, this.posY + (double)var13[1][1], this.posZ); + } + +- if (this.riddenByEntity != null) +- { +- this.motionX *= 0.997D; +- this.motionY *= 0.0D; +- this.motionZ *= 0.997D; +- } +- else +- { +- if (this.minecartType == 2) +- { +- var38 = (double)MathHelper.sqrt_double(this.pushX * this.pushX + this.pushZ * this.pushZ); +- +- if (var38 > 0.01D) +- { +- this.pushX /= var38; +- this.pushZ /= var38; +- double var40 = 0.04D; +- this.motionX *= 0.8D; +- this.motionY *= 0.0D; +- this.motionZ *= 0.8D; +- this.motionX += this.pushX * var40; +- this.motionZ += this.pushZ * var40; +- } +- else +- { +- this.motionX *= 0.9D; +- this.motionY *= 0.0D; +- this.motionZ *= 0.9D; +- } +- } +- +- this.motionX *= 0.96D; +- this.motionY *= 0.0D; +- this.motionZ *= 0.96D; +- } ++ applyDragAndPushForces(); + + Vec3D var52 = this.func_514_g(this.posX, this.posY, this.posZ); + +@@ -511,29 +443,14 @@ + + double var41; + +- if (this.minecartType == 2) ++ updatePushForces(); ++ ++ if (shouldDoRailFunctions()) + { +- var41 = (double)MathHelper.sqrt_double(this.pushX * this.pushX + this.pushZ * this.pushZ); +- +- if (var41 > 0.01D && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.001D) +- { +- this.pushX /= var41; +- this.pushZ /= var41; +- +- if (this.pushX * this.motionX + this.pushZ * this.motionZ < 0.0D) +- { +- this.pushX = 0.0D; +- this.pushZ = 0.0D; +- } +- else +- { +- this.pushX = this.motionX; +- this.pushZ = this.motionZ; +- } +- } ++ ((BlockRail)Block.blocksList[var8]).onMinecartPass(worldObj, this, var1, var2, var3); + } + +- if (var11) ++ if (var11 && shouldDoRailFunctions()) + { + var41 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); + +@@ -569,41 +486,7 @@ + } + else + { +- if (this.motionX < -var4) +- { +- this.motionX = -var4; +- } +- +- if (this.motionX > var4) +- { +- this.motionX = var4; +- } +- +- if (this.motionZ < -var4) +- { +- this.motionZ = -var4; +- } +- +- if (this.motionZ > var4) +- { +- this.motionZ = var4; +- } +- +- if (this.onGround) +- { +- this.motionX *= 0.5D; +- this.motionY *= 0.5D; +- this.motionZ *= 0.5D; +- } +- +- this.moveEntity(this.motionX, this.motionY, this.motionZ); +- +- if (!this.onGround) +- { +- this.motionX *= 0.95D; +- this.motionY *= 0.95D; +- this.motionZ *= 0.95D; +- } ++ moveMinecartOffRail(var1, var2, var3); + } + + this.rotationPitch = 0.0F; +@@ -639,8 +522,19 @@ + } + + this.setRotation(this.rotationYaw, this.rotationPitch); +- List var15 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.expand(0.2D, 0.0D, 0.2D)); +- + -+ dropCartAsItem(); ++ AxisAlignedBB box = null; ++ if (getCollisionHandler() != null) ++ { ++ box = getCollisionHandler().getMinecartCollisionBox(this); ++ } ++ else ++ { ++ box = boundingBox.expand(0.2D, 0.0D, 0.2D); ++ } ++ ++ List var15 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, box); ++ + if (var15 != null && var15.size() > 0) + { + for (int var50 = 0; var50 < var15.size(); ++var50) +@@ -664,17 +558,8 @@ + this.riddenByEntity = null; + } + +- if (this.fuel > 0) +- { +- --this.fuel; +- } +- +- if (this.fuel <= 0) +- { +- this.pushX = this.pushZ = 0.0D; +- } +- +- this.setMinecartPowered(this.fuel > 0); ++ updateFuel(); ++ ForgeHooks.onMinecartUpdate(this, var1, var2, var3); } - return true; } -@@ -268,7 +273,7 @@ - { - func_41024_b(func_41025_i() - 1); - } -- if (isMinecartPowered() && rand.nextInt(4) == 0) -+ if (isMinecartPowered() && rand.nextInt(4) == 0 && minecartType == 2 && getClass() == EntityMinecart.class) - { - worldObj.spawnParticle("largesmoke", posX, posY + 0.80000000000000004D, posZ, 0.0D, 0.0D, 0.0D); - } -@@ -309,22 +314,18 @@ - double d2 = 0.40000000000000002D; - double d4 = 0.0078125D; - int l = worldObj.getBlockId(i, j, k); -- if (BlockRail.isRailBlock(l)) -+ if (canUseRail() && BlockRail.isRailBlock(l)) - { - Vec3D vec3d = func_514_g(posX, posY, posZ); -- int i1 = worldObj.getBlockMetadata(i, j, k); -+ int i1 = ((BlockRail)Block.blocksList[l]).getBasicRailMetadata(worldObj, this, i, j, k); - posY = j; - boolean flag = false; - boolean flag1 = false; - if (l == Block.railPowered.blockID) - { -- flag = (i1 & 8) != 0; -+ flag = (worldObj.getBlockMetadata(i, j, k) & 8) != 0; - flag1 = !flag; - } -- if (((BlockRail)Block.blocksList[l]).isPowered()) -- { -- i1 &= 7; -- } - if (i1 >= 2 && i1 <= 5) - { - posY = j + 1; -@@ -358,7 +359,7 @@ - double d13 = Math.sqrt(motionX * motionX + motionZ * motionZ); - motionX = (d13 * d9) / d11; - motionZ = (d13 * d10) / d11; -- if (flag1) -+ if (flag1 && shouldDoRailFunctions()) - { - double d16 = Math.sqrt(motionX * motionX + motionZ * motionZ); - if (d16 < 0.029999999999999999D) -@@ -401,30 +402,9 @@ - posX = d18 + d9 * d17; - posZ = d19 + d10 * d17; - setPosition(posX, posY + (double)yOffset, posZ); -- double d23 = motionX; -- double d25 = motionZ; -- if (riddenByEntity != null) -- { -- d23 *= 0.75D; -- d25 *= 0.75D; -- } -- if (d23 < -d2) -- { -- d23 = -d2; -- } -- if (d23 > d2) -- { -- d23 = d2; -- } -- if (d25 < -d2) -- { -- d25 = -d2; -- } -- if (d25 > d2) -- { -- d25 = d2; -- } -- moveEntity(d23, 0.0D, d25); -+ -+ moveMinecartOnRail(i, j, k); -+ - if (ai[0][1] != 0 && MathHelper.floor_double(posX) - i == ai[0][0] && MathHelper.floor_double(posZ) - k == ai[0][2]) - { - setPosition(posX, posY + (double)ai[0][1], posZ); -@@ -433,39 +413,9 @@ - { - setPosition(posX, posY + (double)ai[1][1], posZ); - } -- if (riddenByEntity != null) -- { -- motionX *= 0.99699997901916504D; -- motionY *= 0.0D; -- motionZ *= 0.99699997901916504D; -- } -- else -- { -- if (minecartType == 2) -- { -- double d27 = MathHelper.sqrt_double(pushX * pushX + pushZ * pushZ); -- if (d27 > 0.01D) -- { -- pushX /= d27; -- pushZ /= d27; -- double d29 = 0.040000000000000001D; -- motionX *= 0.80000001192092896D; -- motionY *= 0.0D; -- motionZ *= 0.80000001192092896D; -- motionX += pushX * d29; -- motionZ += pushZ * d29; -- } -- else -- { -- motionX *= 0.89999997615814209D; -- motionY *= 0.0D; -- motionZ *= 0.89999997615814209D; -- } -- } -- motionX *= 0.95999997854232788D; -- motionY *= 0.0D; -- motionZ *= 0.95999997854232788D; -- } -+ -+ applyDragAndPushForces(); -+ - Vec3D vec3d1 = func_514_g(posX, posY, posZ); - if (vec3d1 != null && vec3d != null) - { -@@ -486,26 +436,14 @@ - motionX = d15 * (double)(k1 - i); - motionZ = d15 * (double)(l1 - k); - } -- if (minecartType == 2) -+ -+ updatePushForces(); -+ -+ if (shouldDoRailFunctions()) - { -- double d30 = MathHelper.sqrt_double(pushX * pushX + pushZ * pushZ); -- if (d30 > 0.01D && motionX * motionX + motionZ * motionZ > 0.001D) -- { -- pushX /= d30; -- pushZ /= d30; -- if (pushX * motionX + pushZ * motionZ < 0.0D) -- { -- pushX = 0.0D; -- pushZ = 0.0D; -- } -- else -- { -- pushX = motionX; -- pushZ = motionZ; -- } -- } -+ ((BlockRail)Block.blocksList[l]).onMinecartPass(worldObj, this, i, j, k); - } -- if (flag) -+ if (flag && shouldDoRailFunctions()) - { - double d31 = Math.sqrt(motionX * motionX + motionZ * motionZ); - if (d31 > 0.01D) -@@ -540,35 +478,7 @@ + +@@ -697,12 +582,7 @@ } else { -- if (motionX < -d2) +- int var13 = this.worldObj.getBlockMetadata(var9, var10, var11); +- +- if (((BlockRail)Block.blocksList[var12]).isPowered()) - { -- motionX = -d2; +- var13 &= 7; - } -- if (motionX > d2) -- { -- motionX = d2; -- } -- if (motionZ < -d2) -- { -- motionZ = -d2; -- } -- if (motionZ > d2) -- { -- motionZ = d2; -- } -- if (onGround) -- { -- motionX *= 0.5D; -- motionY *= 0.5D; -- motionZ *= 0.5D; -- } -- moveEntity(motionX, motionY, motionZ); -- if (!onGround) -- { -- motionX *= 0.94999998807907104D; -- motionY *= 0.94999998807907104D; -- motionZ *= 0.94999998807907104D; -- } -+ moveMinecartOffRail(i, j, k); - } - rotationPitch = 0.0F; - double d6 = prevPosX - posX; -@@ -590,7 +500,20 @@ - field_856_i = !field_856_i; - } - setRotation(rotationYaw, rotationPitch); -- List list = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.expand(0.20000000298023224D, 0.0D, 0.20000000298023224D)); -+ -+ AxisAlignedBB box = null; -+ -+ if (getCollisionHandler() != null) -+ { -+ box = getCollisionHandler().getMinecartCollisionBox(this); -+ } -+ else -+ { -+ -+ box = boundingBox.expand(0.20000000298023224D, 0.0D, 0.20000000298023224D); -+ } -+ -+ List list = worldObj.getEntitiesWithinAABBExcludingEntity(this, box); - if (list != null && list.size() > 0) - { - for (int j1 = 0; j1 < list.size(); j1++) -@@ -610,15 +533,8 @@ - } - riddenByEntity = null; - } -- if (fuel > 0) -- { -- fuel--; -- } -- if (fuel <= 0) -- { -- pushX = pushZ = 0.0D; -- } -- setMinecartPowered(fuel > 0); -+ updateFuel(); -+ ForgeHooks.onMinecartUpdate(this, i, j, k); - } ++ int var13 = ((BlockRail)Block.blocksList[var12]).getBasicRailMetadata(worldObj, this, var9, var10, var11); - public Vec3D func_515_a(double d, double d1, double d2, double d3) -@@ -633,11 +549,7 @@ - int l = worldObj.getBlockId(i, j, k); - if (BlockRail.isRailBlock(l)) + par3 = (double)var10; + +@@ -748,14 +628,9 @@ + + if (BlockRail.isRailBlock(var10)) { -- int i1 = worldObj.getBlockMetadata(i, j, k); -- if (((BlockRail)Block.blocksList[l]).isPowered()) +- int var11 = this.worldObj.getBlockMetadata(var7, var8, var9); ++ int var11 = ((BlockRail)Block.blocksList[var10]).getBasicRailMetadata(worldObj, this, var7, var8, var9); + par3 = (double)var8; + +- if (((BlockRail)Block.blocksList[var10]).isPowered()) - { -- i1 &= 7; +- var11 &= 7; - } -+ int i1 = ((BlockRail)Block.blocksList[l]).getBasicRailMetadata(worldObj, this, i, j, k); - d1 = j; - if (i1 >= 2 && i1 <= 5) +- + if (var11 >= 2 && var11 <= 5) { -@@ -679,12 +591,8 @@ - int l = worldObj.getBlockId(i, j, k); - if (BlockRail.isRailBlock(l)) - { -- int i1 = worldObj.getBlockMetadata(i, j, k); -+ int i1 = ((BlockRail)Block.blocksList[l]).getBasicRailMetadata(worldObj, this, i, j, k); - d1 = j; -- if (((BlockRail)Block.blocksList[l]).isPowered()) -- { -- i1 &= 7; -- } - if (i1 >= 2 && i1 <= 5) - { - d1 = j + 1; -@@ -739,13 +647,13 @@ - protected void writeEntityToNBT(NBTTagCompound nbttagcompound) + par3 = (double)(var8 + 1); +@@ -820,13 +695,14 @@ { - nbttagcompound.setInteger("Type", minecartType); -- if (minecartType == 2) + par1NBTTagCompound.setInteger("Type", this.minecartType); + +- if (this.minecartType == 2) + if (isPoweredCart()) { - nbttagcompound.setDouble("PushX", pushX); - nbttagcompound.setDouble("PushZ", pushZ); -- nbttagcompound.setShort("Fuel", (short)fuel); -+ nbttagcompound.setInteger("Fuel", fuel); + par1NBTTagCompound.setDouble("PushX", this.pushX); + par1NBTTagCompound.setDouble("PushZ", this.pushZ); +- par1NBTTagCompound.setShort("Fuel", (short)this.fuel); ++ par1NBTTagCompound.setInteger("Fuel", this.fuel); } -- else if (minecartType == 1) +- else if (this.minecartType == 1) ++ + if (getSizeInventory() > 0) { - NBTTagList nbttaglist = new NBTTagList(); - for (int i = 0; i < cargoItems.length; i++) -@@ -766,13 +674,13 @@ - protected void readEntityFromNBT(NBTTagCompound nbttagcompound) + NBTTagList var2 = new NBTTagList(); + +@@ -852,13 +728,14 @@ { - minecartType = nbttagcompound.getInteger("Type"); -- if (minecartType == 2) + this.minecartType = par1NBTTagCompound.getInteger("Type"); + +- if (this.minecartType == 2) + if (isPoweredCart()) { - pushX = nbttagcompound.getDouble("PushX"); - pushZ = nbttagcompound.getDouble("PushZ"); -- fuel = nbttagcompound.getShort("Fuel"); -+ fuel = nbttagcompound.getInteger("Fuel"); + this.pushX = par1NBTTagCompound.getDouble("PushX"); + this.pushZ = par1NBTTagCompound.getDouble("PushZ"); +- this.fuel = par1NBTTagCompound.getShort("Fuel"); ++ this.fuel = par1NBTTagCompound.getInteger("Fuel"); } -- else if (minecartType == 1) +- else if (this.minecartType == 1) ++ + if (getSizeInventory() > 0) { - NBTTagList nbttaglist = nbttagcompound.getTagList("Items"); - cargoItems = new ItemStack[getSizeInventory()]; -@@ -795,6 +703,12 @@ - - public void applyEntityCollision(Entity entity) + NBTTagList var2 = par1NBTTagCompound.getTagList("Items"); + this.cargoItems = new ItemStack[this.getSizeInventory()]; +@@ -886,11 +763,19 @@ + */ + public void applyEntityCollision(Entity par1Entity) { -+ ForgeHooks.onMinecartEntityCollision(this, entity); ++ ++ ForgeHooks.onMinecartEntityCollision(this, par1Entity); + if (getCollisionHandler() != null) + { -+ getCollisionHandler().onEntityCollision(this, entity); ++ getCollisionHandler().onEntityCollision(this, par1Entity); + return; + } - if (worldObj.isRemote) ++ + if (!this.worldObj.isRemote) { - return; -@@ -803,7 +717,7 @@ - { - return; - } -- if ((entity instanceof EntityLiving) && !(entity instanceof EntityPlayer) && minecartType == 0 && motionX * motionX + motionZ * motionZ > 0.01D && riddenByEntity == null && entity.ridingEntity == null) -+ if ((entity instanceof EntityLiving) && !(entity instanceof EntityPlayer) && canBeRidden() && motionX * motionX + motionZ * motionZ > 0.01D && riddenByEntity == null && entity.ridingEntity == null) - { - entity.mountEntity(this); - } -@@ -841,7 +755,7 @@ - } - double d7 = entity.motionX + motionX; - double d8 = entity.motionZ + motionZ; -- if (((EntityMinecart)entity).minecartType == 2 && minecartType != 2) -+ if (((EntityMinecart)entity).isPoweredCart() && !isPoweredCart()) + if (par1Entity != this.riddenByEntity) + { +- if (par1Entity instanceof EntityLiving && !(par1Entity instanceof EntityPlayer) && !(par1Entity instanceof EntityIronGolem) && this.minecartType == 0 && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && this.riddenByEntity == null && par1Entity.ridingEntity == null) ++ if (par1Entity instanceof EntityLiving && !(par1Entity instanceof EntityPlayer) && !(par1Entity instanceof EntityIronGolem) && canBeRidden() && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && this.riddenByEntity == null && par1Entity.ridingEntity == null) { - motionX *= 0.20000000298023224D; - motionZ *= 0.20000000298023224D; -@@ -849,7 +763,7 @@ - entity.motionX *= 0.94999998807907104D; - entity.motionZ *= 0.94999998807907104D; + par1Entity.mountEntity(this); } -- else if (((EntityMinecart)entity).minecartType != 2 && minecartType == 2) -+ else if (!((EntityMinecart)entity).isPoweredCart() && isPoweredCart()) - { - entity.motionX *= 0.20000000298023224D; - entity.motionZ *= 0.20000000298023224D; -@@ -879,7 +793,7 @@ +@@ -936,7 +821,7 @@ + double var18 = par1Entity.motionX + this.motionX; + double var20 = par1Entity.motionZ + this.motionZ; +- if (((EntityMinecart)par1Entity).minecartType == 2 && this.minecartType != 2) ++ if (((EntityMinecart)par1Entity).isPoweredCart() && !isPoweredCart()) + { + this.motionX *= 0.2D; + this.motionZ *= 0.2D; +@@ -944,7 +829,7 @@ + par1Entity.motionX *= 0.95D; + par1Entity.motionZ *= 0.95D; + } +- else if (((EntityMinecart)par1Entity).minecartType != 2 && this.minecartType == 2) ++ else if (!((EntityMinecart)par1Entity).isPoweredCart() && isPoweredCart()) + { + par1Entity.motionX *= 0.2D; + par1Entity.motionZ *= 0.2D; +@@ -979,7 +864,7 @@ + */ public int getSizeInventory() { - return 27; + return (minecartType == 1 && getClass() == EntityMinecart.class ? 27 : 0); } - public ItemStack getStackInSlot(int i) -@@ -935,7 +849,11 @@ - - public boolean interact(EntityPlayer entityplayer) + /** +@@ -1078,7 +963,12 @@ + */ + public boolean interact(EntityPlayer par1EntityPlayer) { -- if (minecartType == 0) -+ if (!ForgeHooks.onMinecartInteract(this, entityplayer)) -+ { -+ return true; -+ } +- if (this.minecartType == 0) ++ if (!ForgeHooks.onMinecartInteract(this, par1EntityPlayer)) ++ { ++ return true; ++ } ++ + if (canBeRidden()) { - if (riddenByEntity != null && (riddenByEntity instanceof EntityPlayer) && riddenByEntity != entityplayer) + if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != par1EntityPlayer) { -@@ -946,14 +864,14 @@ - entityplayer.mountEntity(this); +@@ -1090,14 +980,14 @@ + par1EntityPlayer.mountEntity(this); } } -- else if (minecartType == 1) +- else if (this.minecartType == 1) + else if (getSizeInventory() > 0) { - if (!worldObj.isRemote) + if (!this.worldObj.isRemote) { - entityplayer.displayGUIChest(this); + par1EntityPlayer.displayGUIChest(this); } } -- else if (minecartType == 2) -+ else if (minecartType == 2 && getClass() == EntityMinecart.class) +- else if (this.minecartType == 2) ++ else if (this.minecartType == 2 && getClass() == EntityMinecart.class) { - ItemStack itemstack = entityplayer.inventory.getCurrentItem(); - if (itemstack != null && itemstack.itemID == Item.coal.shiftedIndex) -@@ -1000,7 +918,7 @@ - return entityplayer.getDistanceSqToEntity(this) <= 64D; - } + ItemStack var2 = par1EntityPlayer.inventory.getCurrentItem(); +@@ -1156,7 +1046,7 @@ + /** + * Is this minecart powered (Fuel > 0) + */ - protected boolean isMinecartPowered() + public boolean isMinecartPowered() { - return (dataWatcher.getWatchableObjectByte(16) & 1) != 0; + return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0; } -@@ -1054,4 +972,382 @@ +@@ -1209,4 +1099,348 @@ { - return dataWatcher.getWatchableObjectInt(18); + return this.dataWatcher.getWatchableObjectInt(18); } + + /** @@ -702,11 +713,7 @@ + */ + protected double getDrag() + { -+ if(riddenByEntity != null) -+ { -+ return 0.99699997901916504D; -+ } -+ return 0.95999997854232788D; ++ return riddenByEntity != null ? 1D : 0.96D; + } + + /** @@ -722,17 +729,17 @@ + { + pushX /= d27; + pushZ /= d27; -+ double d29 = 0.040000000000000001D; -+ motionX *= 0.80000001192092896D; ++ double d29 = 0.04; ++ motionX *= 0.8D; + motionY *= 0.0D; -+ motionZ *= 0.80000001192092896D; ++ motionZ *= 0.8D; + motionX += pushX * d29; + motionZ += pushZ * d29; + } else + { -+ motionX *= 0.89999997615814209D; ++ motionX *= 0.9D; + motionY *= 0.0D; -+ motionZ *= 0.89999997615814209D; ++ motionZ *= 0.9D; + } + } + motionX *= getDrag(); @@ -780,30 +787,18 @@ + float railMaxSpeed = ((BlockRail)Block.blocksList[id]).getRailMaxSpeed(worldObj, this, i, j, k); + + double maxSpeed = Math.min(railMaxSpeed, getMaxSpeedRail()); -+ double d23 = motionX; -+ double d25 = motionZ; ++ double mX = motionX; ++ double mZ = motionZ; + if(riddenByEntity != null) + { -+ d23 *= 0.75D; -+ d25 *= 0.75D; ++ mX *= 0.75D; ++ mZ *= 0.75D; + } -+ if(d23 < -maxSpeed) -+ { -+ d23 = -maxSpeed; -+ } -+ if(d23 > maxSpeed) -+ { -+ d23 = maxSpeed; -+ } -+ if(d25 < -maxSpeed) -+ { -+ d25 = -maxSpeed; -+ } -+ if(d25 > maxSpeed) -+ { -+ d25 = maxSpeed; -+ } -+ moveEntity(d23, 0.0D, d25); ++ if(mX < -maxSpeed) mX = -maxSpeed; ++ if(mX > maxSpeed) mX = maxSpeed; ++ if(mZ < -maxSpeed) mZ = -maxSpeed; ++ if(mZ > maxSpeed) mZ = maxSpeed; ++ moveEntity(mX, 0.0D, mZ); + } + + /** @@ -817,22 +812,10 @@ + { + d2 = getMaxSpeedAirLateral(); + } -+ if(motionX < -d2) -+ { -+ motionX = -d2; -+ } -+ if(motionX > d2) -+ { -+ motionX = d2; -+ } -+ if(motionZ < -d2) -+ { -+ motionZ = -d2; -+ } -+ if(motionZ > d2) -+ { -+ motionZ = d2; -+ } ++ if(motionX < -d2) motionX = -d2; ++ if(motionX > d2) motionX = d2; ++ if(motionZ < -d2) motionZ = -d2; ++ if(motionZ > d2) motionZ = d2; + double moveY = motionY; + if(getMaxSpeedAirVertical() > 0 && motionY > getMaxSpeedAirVertical()) + { @@ -864,14 +847,8 @@ + */ + protected void updateFuel() + { -+ if (fuel > 0) -+ { -+ fuel--; -+ } -+ if (fuel <= 0) -+ { -+ pushX = pushZ = 0.0D; -+ } ++ if (fuel > 0) fuel--; ++ if (fuel <= 0) pushX = pushZ = 0.0D; + setMinecartPowered(fuel > 0); + } + diff --git a/forge/patches/minecraft/net/minecraft/src/EntityMooshroom.java.patch b/forge/patches/minecraft/net/minecraft/src/EntityMooshroom.java.patch index 3d624b1fd..89ca44485 100644 --- a/forge/patches/minecraft/net/minecraft/src/EntityMooshroom.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/EntityMooshroom.java.patch @@ -10,44 +10,50 @@ + +public class EntityMooshroom extends EntityCow implements IShearable { - public EntityMooshroom(World world) + public EntityMooshroom(World par1World) { -@@ -17,30 +21,36 @@ - entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, new ItemStack(Item.bowlSoup)); +@@ -21,31 +25,7 @@ + par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, new ItemStack(Item.bowlSoup)); return true; } -- if (itemstack != null && itemstack.itemID == Item.shears.shiftedIndex && getDelay() >= 0) +- else if (var2 != null && var2.itemID == Item.shears.shiftedIndex && this.func_48123_at() >= 0) - { -- setEntityDead(); -- EntityCow entitycow = new EntityCow(worldObj); -- entitycow.setLocationAndAngles(posX, posY, posZ, rotationYaw, rotationPitch); -- entitycow.setEntityHealth(getEntityHealth()); -- entitycow.renderYawOffset = renderYawOffset; -- worldObj.spawnEntityInWorld(entitycow); -- worldObj.spawnParticle("largeexplode", posX, posY + (double)(height / 2.0F), posZ, 0.0D, 0.0D, 0.0D); -- for (int i = 0; i < 5; i++) +- this.setEntityDead(); +- this.worldObj.spawnParticle("largeexplode", this.posX, this.posY + (double)(this.height / 2.0F), this.posZ, 0.0D, 0.0D, 0.0D); +- +- if (!this.worldObj.isRemote) - { -- worldObj.spawnEntityInWorld(new EntityItem(worldObj, posX, posY + (double)height, posZ, new ItemStack(Block.mushroomRed))); +- EntityCow var3 = new EntityCow(this.worldObj); +- var3.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); +- var3.setEntityHealth(this.getEntityHealth()); +- var3.renderYawOffset = this.renderYawOffset; +- this.worldObj.spawnEntityInWorld(var3); +- +- for (int var4 = 0; var4 < 5; ++var4) +- { +- this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.posX, this.posY + (double)this.height, this.posZ, new ItemStack(Block.mushroomRed))); +- } - } - - return true; - } - else - { -- return super.interact(entityplayer); +- return super.interact(par1EntityPlayer); - } -+ return super.interact(entityplayer); ++ return super.interact(par1EntityPlayer); } - protected EntityAnimal spawnBabyAnimal(EntityAnimal entityanimal) + /** +@@ -55,4 +35,29 @@ { - return new EntityMooshroom(worldObj); + return new EntityMooshroom(this.worldObj); } -+ ++ + @Override + public boolean isShearable(ItemStack item, World world, int X, int Y, int Z) + { -+ return getDelay() >= 0; ++ return func_48123_at() >= 0; + } + + @Override diff --git a/forge/patches/minecraft/net/minecraft/src/EntityPlayer.java.patch b/forge/patches/minecraft/net/minecraft/src/EntityPlayer.java.patch index 69d31abf7..7253a3351 100644 --- a/forge/patches/minecraft/net/minecraft/src/EntityPlayer.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/EntityPlayer.java.patch @@ -1,158 +1,112 @@ --- ../src_base/minecraft/net/minecraft/src/EntityPlayer.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/EntityPlayer.java 0000-00-00 00:00:00.000000000 -0000 -@@ -2,6 +2,12 @@ +@@ -3,6 +3,8 @@ + import java.util.Iterator; + import java.util.List; - import java.util.*; - -+import net.minecraft.src.forge.ArmorProperties; -+import net.minecraft.src.forge.ForgeHooks; -+import net.minecraft.src.forge.IGuiHandler; -+import net.minecraft.src.forge.ISpecialArmor; -+import net.minecraft.src.forge.MinecraftForge; ++import net.minecraft.src.forge.*; + public abstract class EntityPlayer extends EntityLiving { - public InventoryPlayer inventory; -@@ -149,6 +155,7 @@ + /** Inventory of the player */ +@@ -206,6 +208,7 @@ } else { -+ itemInUse.getItem().onUsingItemTick(itemInUse, this, itemInUseCount); - if (itemInUseCount <= 25 && itemInUseCount % 4 == 0) ++ itemInUse.getItem().onUsingItemTick(itemInUse, this, itemInUseCount); + if (this.itemInUseCount <= 25 && this.itemInUseCount % 4 == 0) { - func_35201_a(itemstack, 5); -@@ -490,7 +497,16 @@ + this.func_35201_a(var1, 5); +@@ -605,7 +608,16 @@ - public void dropCurrentItem() + public EntityItem func_48152_as() { -- dropPlayerItemWithRandomChoice(inventory.decrStackSize(inventory.currentItem, 1), false); -+ ItemStack stack = inventory.getCurrentItem(); -+ if (stack == null) -+ { -+ return; -+ } -+ -+ if (stack.getItem().onDroppedByPlayer(stack, this)) -+ { -+ dropPlayerItemWithRandomChoice(inventory.decrStackSize(inventory.currentItem, 1), false); -+ } +- return this.func_48151_a(this.inventory.decrStackSize(this.inventory.currentItem, 1), false); ++ ItemStack stack = inventory.getCurrentItem(); ++ if (stack == null) ++ { ++ return null; ++ } ++ if (stack.getItem().onDroppedByPlayer(stack, this)) ++ { ++ return func_48151_a(inventory.decrStackSize(inventory.currentItem, 1), false); ++ } ++ return null; } - public void dropPlayerItem(ItemStack itemstack) -@@ -537,6 +553,9 @@ - worldObj.spawnEntityInWorld(entityitem); - } + public EntityItem func_48153_a(ItemStack par1ItemStack) +@@ -664,14 +676,22 @@ -+ /* FORGE: This isnt called anymore -+ */ + /** + * Returns how strong the player is against the specified block at this moment ++ * Deprecated in favor of the metadata-sensitive version + */ + @Deprecated - public float getCurrentPlayerStrVsBlock(Block block) + public float getCurrentPlayerStrVsBlock(Block par1Block) { - float f = inventory.getStrVsBlock(block); -@@ -565,6 +584,45 @@ - return f1; - } - -+ /* FORGE: Extended to allow metadata. -+ */ -+ public float getCurrentPlayerStrVsBlock(Block block, int md) -+ { -+ float f = 1.0F; -+ ItemStack ist = inventory.getCurrentItem(); -+ if(ist != null) -+ { -+ f = ist.getItem().getStrVsBlock(ist, block, md); -+ } -+ -+ int i = EnchantmentHelper.getEfficiencyModifier(inventory); -+ if (i > 0 && ForgeHooks.canHarvestBlock(block, this, md)) -+ { -+ f += i * i + 1; -+ } -+ -+ if(isPotionActive(Potion.digSpeed)) -+ { -+ f *= 1.0F + (float)(getActivePotionEffect(Potion.digSpeed).getAmplifier() + 1) * 0.2F; -+ } -+ -+ if(isPotionActive(Potion.digSlowdown)) -+ { -+ f *= 1.0F - (float)(getActivePotionEffect(Potion.digSlowdown).getAmplifier() + 1) * 0.2F; -+ } -+ -+ if(isInsideOfMaterial(Material.water) && !EnchantmentHelper.getAquaAffinityModifier(inventory)) -+ { -+ f /= 5F; -+ } -+ -+ if(!onGround) -+ { -+ f /= 5F; -+ } -+ return f; +- float var2 = this.inventory.getStrVsBlock(par1Block); ++ return getCurrentPlayerStrVsBlock(par1Block, 0); + } -+ - public boolean canHarvestBlock(Block block) - { - return inventory.canHarvestBlock(block); -@@ -768,7 +826,11 @@ ++ ++ public float getCurrentPlayerStrVsBlock(Block par1Block, int meta) ++ { ++ ItemStack stack = inventory.getCurrentItem(); ++ float var2 = (stack == null ? 1.0F : stack.getItem().getStrVsBlock(stack, par1Block, meta)); + float var3 = var2; + int var4 = EnchantmentHelper.getEfficiencyModifier(this.inventory); + +- if (var4 > 0 && this.inventory.canHarvestBlock(par1Block)) ++ if (var4 > 0 && ForgeHooks.canHarvestBlock(par1Block, this, meta)) { - i = 1 + i >> 1; + var3 = var2 + (float)(var4 * var4 + 1); } -- i = applyArmorCalculations(damagesource, i); -+ i = ArmorProperties.ApplyArmor(this, inventory.armorInventory, damagesource, i); -+ if (i <= 0) +@@ -960,7 +980,11 @@ + par2 = 1 + par2 >> 1; + } + +- par2 = this.applyArmorCalculations(par1DamageSource, par2); ++ par2 = ArmorProperties.ApplyArmor(this, inventory.armorInventory, par1DamageSource, par2); ++ if (par2 <= 0) + { + return; + } - i = applyPotionDamageCalculations(damagesource, i); - addExhaustion(damagesource.getHungerDamage()); - health -= i; -@@ -815,7 +877,9 @@ - + par2 = this.applyPotionDamageCalculations(par1DamageSource, par2); + this.addExhaustion(par1DamageSource.getHungerDamage()); + this.health -= par2; +@@ -1021,7 +1045,9 @@ + */ public void destroyCurrentEquippedItem() { -+ ItemStack orig = inventory.getCurrentItem(); - inventory.setInventorySlotContents(inventory.currentItem, null); ++ ItemStack orig = inventory.getCurrentItem(); + this.inventory.setInventorySlotContents(this.inventory.currentItem, (ItemStack)null); + ForgeHooks.onDestroyCurrentItem(this, orig); } - public double getYOffset() -@@ -834,6 +898,11 @@ - - public void attackTargetEntityWithCurrentItem(Entity entity) + /** +@@ -1050,6 +1076,12 @@ + */ + public void attackTargetEntityWithCurrentItem(Entity par1Entity) { + ItemStack stack = getCurrentEquippedItem(); -+ if (stack != null && stack.getItem().onLeftClickEntity(stack, this, entity)) ++ if (stack != null && stack.getItem().onLeftClickEntity(stack, this, par1Entity)) + { + return; + } - int i = inventory.getDamageVsEntity(entity); - if (isPotionActive(Potion.damageBoost)) ++ + if (par1Entity.func_48080_j()) { -@@ -947,6 +1016,11 @@ - - public EnumStatus sleepInBedAt(int i, int j, int k) - { -+ EnumStatus customSleep = ForgeHooks.sleepInBedAt(this, i, j, k); -+ if (customSleep != null) -+ { -+ return customSleep; -+ } - if (!worldObj.isRemote) - { - if (isPlayerSleeping() || !isEntityAlive()) -@@ -1341,6 +1415,7 @@ + int var2 = this.inventory.getDamageVsEntity(par1Entity); +@@ -1674,6 +1706,7 @@ return 101; } } -+ j = itemstack.getItem().getIconIndex(itemstack, i, this, itemInUse, itemInUseCount); ++ var3 = par1ItemStack.getItem().getIconIndex(par1ItemStack, par2, this, itemInUse, itemInUseCount); } - return j; - } -@@ -1473,4 +1548,30 @@ - experience = entityplayer.experience; - score = entityplayer.score; + + return var3; +@@ -1841,4 +1874,30 @@ + { + return !this.capabilities.isFlying; } + + /** diff --git a/forge/patches/minecraft/net/minecraft/src/EntityRenderer.java.patch b/forge/patches/minecraft/net/minecraft/src/EntityRenderer.java.patch index 28ba51947..efde3588f 100644 --- a/forge/patches/minecraft/net/minecraft/src/EntityRenderer.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/EntityRenderer.java.patch @@ -1,48 +1,50 @@ --- ../src_base/minecraft/net/minecraft/src/EntityRenderer.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/EntityRenderer.java 0000-00-00 00:00:00.000000000 -0000 -@@ -4,6 +4,8 @@ - import java.nio.FloatBuffer; +@@ -5,6 +5,8 @@ + import java.util.List; import java.util.Random; import net.minecraft.client.Minecraft; +import net.minecraft.src.forge.ForgeHooksClient; + import org.lwjgl.input.Mouse; - import org.lwjgl.opengl.ContextCapabilities; import org.lwjgl.opengl.Display; -@@ -911,8 +913,11 @@ - EntityPlayer entityplayer = (EntityPlayer)entityliving; - GL11.glDisable(3008 /*GL_ALPHA_TEST*/); + import org.lwjgl.opengl.GL11; +@@ -1106,8 +1108,11 @@ + var20 = (EntityPlayer)var4; + GL11.glDisable(GL11.GL_ALPHA_TEST); Profiler.endStartSection("outline"); -- renderglobal.drawBlockBreaking(entityplayer, mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), f); -- renderglobal.drawSelectionBox(entityplayer, mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), f); -+ if (!ForgeHooksClient.onBlockHighlight(renderglobal, entityplayer, mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), f)) +- var5.drawBlockBreaking(var20, this.mc.objectMouseOver, 0, var20.inventory.getCurrentItem(), par1); +- var5.drawSelectionBox(var20, this.mc.objectMouseOver, 0, var20.inventory.getCurrentItem(), par1); ++ if (!ForgeHooksClient.onBlockHighlight(var5, var20, mc.objectMouseOver, 0, var20.inventory.getCurrentItem(), par1)) + { -+ renderglobal.drawBlockBreaking(entityplayer, mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), f); -+ renderglobal.drawSelectionBox(entityplayer, mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), f); ++ var5.drawBlockBreaking(var20, this.mc.objectMouseOver, 0, var20.inventory.getCurrentItem(), par1); ++ var5.drawSelectionBox(var20, this.mc.objectMouseOver, 0, var20.inventory.getCurrentItem(), par1); + } - GL11.glEnable(3008 /*GL_ALPHA_TEST*/); + GL11.glEnable(GL11.GL_ALPHA_TEST); } } -@@ -967,8 +972,11 @@ - EntityPlayer entityplayer1 = (EntityPlayer)entityliving; - GL11.glDisable(3008 /*GL_ALPHA_TEST*/); +@@ -1171,8 +1176,12 @@ + var20 = (EntityPlayer)var4; + GL11.glDisable(GL11.GL_ALPHA_TEST); Profiler.endStartSection("outline"); -- renderglobal.drawBlockBreaking(entityplayer1, mc.objectMouseOver, 0, entityplayer1.inventory.getCurrentItem(), f); -- renderglobal.drawSelectionBox(entityplayer1, mc.objectMouseOver, 0, entityplayer1.inventory.getCurrentItem(), f); -+ if (!ForgeHooksClient.onBlockHighlight(renderglobal, entityplayer1, mc.objectMouseOver, 0, entityplayer1.inventory.getCurrentItem(), f)) +- var5.drawBlockBreaking(var20, this.mc.objectMouseOver, 0, var20.inventory.getCurrentItem(), par1); +- var5.drawSelectionBox(var20, this.mc.objectMouseOver, 0, var20.inventory.getCurrentItem(), par1); ++ ++ if (!ForgeHooksClient.onBlockHighlight(var5, var20, mc.objectMouseOver, 0, var20.inventory.getCurrentItem(), par1)) + { -+ renderglobal.drawBlockBreaking(entityplayer1, mc.objectMouseOver, 0, entityplayer1.inventory.getCurrentItem(), f); -+ renderglobal.drawSelectionBox(entityplayer1, mc.objectMouseOver, 0, entityplayer1.inventory.getCurrentItem(), f); ++ var5.drawBlockBreaking(var20, this.mc.objectMouseOver, 0, var20.inventory.getCurrentItem(), par1); ++ var5.drawSelectionBox(var20, this.mc.objectMouseOver, 0, var20.inventory.getCurrentItem(), par1); + } - GL11.glEnable(3008 /*GL_ALPHA_TEST*/); + GL11.glEnable(GL11.GL_ALPHA_TEST); } - Profiler.endStartSection("weather"); -@@ -986,6 +994,8 @@ - setupFog(1, f); + +@@ -1196,6 +1205,9 @@ + this.setupFog(1, par1); GL11.glPopMatrix(); } ++ + Profiler.endStartSection("fhooks"); -+ ForgeHooksClient.onRenderWorldLast(renderglobal,f); ++ ForgeHooksClient.onRenderWorldLast(var5, par1); + Profiler.endStartSection("hand"); - if (cameraZoom == 1.0D) - { + diff --git a/forge/patches/minecraft/net/minecraft/src/EntitySheep.java.patch b/forge/patches/minecraft/net/minecraft/src/EntitySheep.java.patch index 7c278500c..06bbafc32 100644 --- a/forge/patches/minecraft/net/minecraft/src/EntitySheep.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/EntitySheep.java.patch @@ -11,35 +11,39 @@ + +public class EntitySheep extends EntityAnimal implements IShearable { - public static final float fleeceColorTable[][] = + /** + * Holds the RGB table of the sheep colors - in OpenGL glColor3f values - used to render the sheep colored fleece. +@@ -127,27 +130,6 @@ + */ + public boolean interact(EntityPlayer par1EntityPlayer) { -@@ -194,23 +197,6 @@ - - public boolean interact(EntityPlayer entityplayer) - { -- ItemStack itemstack = entityplayer.inventory.getCurrentItem(); -- if (itemstack != null && itemstack.itemID == Item.shears.shiftedIndex && !getSheared() && !isChild()) +- ItemStack var2 = par1EntityPlayer.inventory.getCurrentItem(); +- +- if (var2 != null && var2.itemID == Item.shears.shiftedIndex && !this.getSheared() && !this.isChild()) - { -- if (!worldObj.isRemote) +- if (!this.worldObj.isRemote) - { -- setSheared(true); -- int i = 1 + rand.nextInt(3); -- for (int j = 0; j < i; j++) +- this.setSheared(true); +- int var3 = 1 + this.rand.nextInt(3); +- +- for (int var4 = 0; var4 < var3; ++var4) - { -- EntityItem entityitem = entityDropItem(new ItemStack(Block.cloth.blockID, 1, getFleeceColor()), 1.0F); -- entityitem.motionY += rand.nextFloat() * 0.05F; -- entityitem.motionX += (rand.nextFloat() - rand.nextFloat()) * 0.1F; -- entityitem.motionZ += (rand.nextFloat() - rand.nextFloat()) * 0.1F; +- EntityItem var5 = this.entityDropItem(new ItemStack(Block.cloth.blockID, 1, this.getFleeceColor()), 1.0F); +- var5.motionY += (double)(this.rand.nextFloat() * 0.05F); +- var5.motionX += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F); +- var5.motionZ += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F); - } - } -- itemstack.damageItem(1, entityplayer); +- +- var2.damageItem(1, par1EntityPlayer); - } - return super.interact(entityplayer); +- + return super.interact(par1EntityPlayer); } -@@ -308,4 +294,23 @@ +@@ -276,4 +258,23 @@ + this.func_48122_d(var1); } - return entitysheep1; } + + @Override diff --git a/forge/patches/minecraft/net/minecraft/src/Explosion.java.patch b/forge/patches/minecraft/net/minecraft/src/Explosion.java.patch index 93ed0d15a..69b4e461e 100644 --- a/forge/patches/minecraft/net/minecraft/src/Explosion.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/Explosion.java.patch @@ -1,27 +1,28 @@ --- ../src_base/minecraft/net/minecraft/src/Explosion.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/Explosion.java 0000-00-00 00:00:00.000000000 -0000 -@@ -1,6 +1,7 @@ - package net.minecraft.src; +@@ -6,6 +6,8 @@ + import java.util.Random; + import java.util.Set; - import java.util.*; +import net.minecraft.src.forge.ISpecialResistance; - ++ public class Explosion { -@@ -66,7 +67,15 @@ - int k3 = worldObj.getBlockId(l2, i3, j3); - if (k3 > 0) - { -- f1 -= (Block.blocksList[k3].getExplosionResistance(exploder) + 0.3F) * f2; -+ if (Block.blocksList[k3] instanceof ISpecialResistance) -+ { -+ ISpecialResistance isr = (ISpecialResistance)Block.blocksList[k3]; -+ f1 -= (isr.getSpecialExplosionResistance(worldObj, l2, i3, j3, explosionX, explosionY, explosionZ, exploder) + 0.3F) * f2; -+ } -+ else -+ { -+ f1 -= (Block.blocksList[k3].getExplosionResistance(exploder) + 0.3F) * f2; -+ } - } - if (f1 > 0.0F) - { + public boolean isFlaming = false; +@@ -71,7 +73,15 @@ + + if (var25 > 0) + { +- var14 -= (Block.blocksList[var25].getExplosionResistance(this.exploder) + 0.3F) * var21; ++ if (Block.blocksList[var25] instanceof ISpecialResistance) ++ { ++ ISpecialResistance isr = (ISpecialResistance)Block.blocksList[var25]; ++ var14 -= (isr.getSpecialExplosionResistance(worldObj, var22, var23, var24, explosionX, explosionY, explosionZ, exploder) + 0.3F) * var21; ++ } ++ else ++ { ++ var14 -= (Block.blocksList[var25].getExplosionResistance(this.exploder) + 0.3F) * var21; ++ } + } + + if (var14 > 0.0F) diff --git a/forge/patches/minecraft/net/minecraft/src/FurnaceRecipes.java.patch b/forge/patches/minecraft/net/minecraft/src/FurnaceRecipes.java.patch index f9eb2289a..999216541 100644 --- a/forge/patches/minecraft/net/minecraft/src/FurnaceRecipes.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/FurnaceRecipes.java.patch @@ -1,31 +1,35 @@ --- ../src_base/minecraft/net/minecraft/src/FurnaceRecipes.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/FurnaceRecipes.java 0000-00-00 00:00:00.000000000 -0000 -@@ -2,11 +2,13 @@ +@@ -1,5 +1,6 @@ + package net.minecraft.src; ++import java.util.Arrays; import java.util.HashMap; import java.util.Map; -+import java.util.Arrays; - public class FurnaceRecipes - { - private static final FurnaceRecipes smeltingBase = new FurnaceRecipes(); - private Map smeltingList; -+ private Map metaSmeltingList; +@@ -9,6 +10,7 @@ - public static final FurnaceRecipes smelting() + /** The list of smelting results. */ + private Map smeltingList = new HashMap(); ++ private Map metaSmeltingList = new HashMap(); + + /** + * Used to call methods addSmelting and getSmeltingResult. +@@ -47,7 +49,9 @@ + + /** + * Returns the smelting result of an item. ++ * Deprecated in favor of a metadata sensitive version + */ ++ @Deprecated + public ItemStack getSmeltingResult(int par1) { -@@ -16,6 +18,7 @@ - private FurnaceRecipes() + return (ItemStack)this.smeltingList.get(Integer.valueOf(par1)); +@@ -57,4 +61,34 @@ { - smeltingList = new HashMap(); -+ metaSmeltingList = new HashMap(); - addSmelting(Block.oreIron.blockID, new ItemStack(Item.ingotIron)); - addSmelting(Block.oreGold.blockID, new ItemStack(Item.ingotGold)); - addSmelting(Block.oreDiamond.blockID, new ItemStack(Item.diamond)); -@@ -38,11 +41,43 @@ - smeltingList.put(Integer.valueOf(i), itemstack); + return this.smeltingList; } - ++ + /** + * Add a metadata-sensitive furnace recipe + * @param itemID The Item ID @@ -36,14 +40,7 @@ + { + metaSmeltingList.put(Arrays.asList(itemID, metadata), itemstack); + } -+ -+ /* FORGE: Not used anymore, now uses a metadata sensitive version */ -+ @Deprecated - public ItemStack getSmeltingResult(int i) - { - return (ItemStack)smeltingList.get(Integer.valueOf(i)); - } - ++ + /** + * Used to get the resulting ItemStack form a source ItemStack + * @param item The Source ItemStack @@ -51,18 +48,15 @@ + */ + 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)); ++ 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)); + } -+ - public Map getSmeltingList() - { - return smeltingList; + } diff --git a/forge/patches/minecraft/net/minecraft/src/GuiControls.java.patch b/forge/patches/minecraft/net/minecraft/src/GuiControls.java.patch index 6331c9bdf..15a827e92 100644 --- a/forge/patches/minecraft/net/minecraft/src/GuiControls.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/GuiControls.java.patch @@ -1,122 +1,135 @@ --- ../src_base/minecraft/net/minecraft/src/GuiControls.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/GuiControls.java 0000-00-00 00:00:00.000000000 -0000 -@@ -2,6 +2,7 @@ +@@ -1,5 +1,7 @@ + package net.minecraft.src; - import java.util.List; - import net.minecraft.client.Minecraft; +import net.minecraft.src.forge.GuiControlsScrollPanel; - ++ public class GuiControls extends GuiScreen { -@@ -9,6 +10,7 @@ - protected String screenTitle; - private GameSettings options; - private int buttonId; + /** +@@ -15,6 +17,8 @@ + + /** The ID of the button that has been pressed. */ + private int buttonId = -1; ++ + private GuiControlsScrollPanel scrollPane; - public GuiControls(GuiScreen guiscreen, GameSettings gamesettings) + public GuiControls(GuiScreen par1GuiScreen, GameSettings par2GameSettings) { -@@ -25,60 +27,30 @@ - +@@ -32,15 +36,12 @@ + */ public void initGui() { -+ scrollPane = new GuiControlsScrollPanel(this, options, mc); - StringTranslate stringtranslate = StringTranslate.getInstance(); - int i = func_20080_j(); -- for (int j = 0; j < options.keyBindings.length; j++) ++ scrollPane = new GuiControlsScrollPanel(this, options, mc); + StringTranslate var1 = StringTranslate.getInstance(); + int var2 = this.func_20080_j(); + +- for (int var3 = 0; var3 < this.options.keyBindings.length; ++var3) - { -- controlList.add(new GuiSmallButton(j, i + (j % 2) * 160, height / 6 + 24 * (j >> 1), 70, 20, options.getOptionDisplayString(j))); +- this.controlList.add(new GuiSmallButton(var3, var2 + var3 % 2 * 160, this.height / 6 + 24 * (var3 >> 1), 70, 20, this.options.getOptionDisplayString(var3))); - } - -- controlList.add(new GuiButton(200, width / 2 - 100, height / 6 + 168, stringtranslate.translateKey("gui.done"))); -+ controlList.add(new GuiButton(200, width / 2 - 100, height - 28, stringtranslate.translateKey("gui.done"))); +- this.controlList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168, var1.translateKey("gui.done"))); ++ this.controlList.add(new GuiButton(200, this.width / 2 - 100, this.height - 28, var1.translateKey("gui.done"))); + scrollPane.registerScrollButtons(controlList, 7, 8); - screenTitle = stringtranslate.translateKey("controls.title"); + this.screenTitle = var1.translateKey("controls.title"); } - protected void actionPerformed(GuiButton guibutton) +@@ -49,20 +50,10 @@ + */ + protected void actionPerformed(GuiButton par1GuiButton) { -- for (int i = 0; i < options.keyBindings.length; i++) +- for (int var2 = 0; var2 < this.options.keyBindings.length; ++var2) - { -- ((GuiButton)controlList.get(i)).displayString = options.getOptionDisplayString(i); +- ((GuiButton)this.controlList.get(var2)).displayString = this.options.getOptionDisplayString(var2); - } - - if (guibutton.id == 200) + if (par1GuiButton.id == 200) { - mc.displayGuiScreen(parentScreen); + this.mc.displayGuiScreen(this.parentScreen); } - else - { -- buttonId = guibutton.id; -- guibutton.displayString = (new StringBuilder()).append("> ").append(options.getOptionDisplayString(guibutton.id)).append(" <").toString(); +- this.buttonId = par1GuiButton.id; +- par1GuiButton.displayString = "> " + this.options.getOptionDisplayString(par1GuiButton.id) + " <"; - } } - protected void mouseClicked(int i, int j, int k) + /** +@@ -70,17 +61,7 @@ + */ + protected void mouseClicked(int par1, int par2, int par3) { -- if (buttonId >= 0) +- if (this.buttonId >= 0) - { -- options.setKeyBinding(buttonId, -100 + k); -- ((GuiButton)controlList.get(buttonId)).displayString = options.getOptionDisplayString(buttonId); -- buttonId = -1; +- this.options.setKeyBinding(this.buttonId, -100 + par3); +- ((GuiButton)this.controlList.get(this.buttonId)).displayString = this.options.getOptionDisplayString(this.buttonId); +- this.buttonId = -1; - KeyBinding.resetKeyBindingArrayAndHash(); - } - else - { -- super.mouseClicked(i, j, k); +- super.mouseClicked(par1, par2, par3); - } -+ super.mouseClicked(i, j, k); ++ super.mouseClicked(par1, par2, par3); } - protected void keyTyped(char c, int i) + /** +@@ -88,14 +69,7 @@ + */ + protected void keyTyped(char par1, int par2) { -- if (buttonId >= 0) +- if (this.buttonId >= 0) - { -- options.setKeyBinding(buttonId, i); -- ((GuiButton)controlList.get(buttonId)).displayString = options.getOptionDisplayString(buttonId); -- buttonId = -1; +- this.options.setKeyBinding(this.buttonId, par2); +- ((GuiButton)this.controlList.get(this.buttonId)).displayString = this.options.getOptionDisplayString(this.buttonId); +- this.buttonId = -1; - KeyBinding.resetKeyBindingArrayAndHash(); - } - else -+ if (scrollPane.keyTyped(c, i)) ++ if (scrollPane.keyTyped(par1, par2)) { - super.keyTyped(c, i); + super.keyTyped(par1, par2); } -@@ -87,35 +59,8 @@ - public void drawScreen(int i, int j, float f) +@@ -107,37 +81,9 @@ + public void drawScreen(int par1, int par2, float par3) { - drawDefaultBackground(); -- drawCenteredString(fontRenderer, screenTitle, width / 2, 20, 0xffffff); -- int k = func_20080_j(); -- for (int l = 0; l < options.keyBindings.length; l++) + this.drawDefaultBackground(); +- this.drawCenteredString(this.fontRenderer, this.screenTitle, this.width / 2, 20, 16777215); +- int var4 = this.func_20080_j(); +- +- for (int var5 = 0; var5 < this.options.keyBindings.length; ++var5) - { -- boolean flag = false; -- for (int i1 = 0; i1 < options.keyBindings.length; i1++) +- boolean var6 = false; +- +- for (int var7 = 0; var7 < this.options.keyBindings.length; ++var7) - { -- if (i1 != l && options.keyBindings[l].keyCode == options.keyBindings[i1].keyCode) +- if (var7 != var5 && this.options.keyBindings[var5].keyCode == this.options.keyBindings[var7].keyCode) - { -- flag = true; +- var6 = true; - } - } - -- int j1 = l; -- if (buttonId == l) +- if (this.buttonId == var5) - { -- ((GuiButton)controlList.get(j1)).displayString = "\247f> \247e??? \247f<"; +- ((GuiButton)this.controlList.get(var5)).displayString = "\u00a7f> \u00a7e??? \u00a7f<"; - } -- else if (flag) +- else if (var6) - { -- ((GuiButton)controlList.get(j1)).displayString = (new StringBuilder()).append("\247c").append(options.getOptionDisplayString(j1)).toString(); +- ((GuiButton)this.controlList.get(var5)).displayString = "\u00a7c" + this.options.getOptionDisplayString(var5); - } - else - { -- ((GuiButton)controlList.get(j1)).displayString = options.getOptionDisplayString(j1); +- ((GuiButton)this.controlList.get(var5)).displayString = this.options.getOptionDisplayString(var5); - } -- drawString(fontRenderer, options.getKeyBindingDescription(l), k + (l % 2) * 160 + 70 + 6, height / 6 + 24 * (l >> 1) + 7, -1); +- +- this.drawString(this.fontRenderer, this.options.getKeyBindingDescription(var5), var4 + var5 % 2 * 160 + 70 + 6, this.height / 6 + 24 * (var5 >> 1) + 7, -1); - } - -+ scrollPane.drawScreen(i, j, f); ++ ++ scrollPane.drawScreen(par1, par2, par3); + drawCenteredString(fontRenderer, screenTitle, width / 2, 4, 0xffffff); - super.drawScreen(i, j, f); + super.drawScreen(par1, par2, par3); } } diff --git a/forge/patches/minecraft/net/minecraft/src/GuiIngame.java.patch b/forge/patches/minecraft/net/minecraft/src/GuiIngame.java.patch index 7166488be..842cb7ed1 100644 --- a/forge/patches/minecraft/net/minecraft/src/GuiIngame.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/GuiIngame.java.patch @@ -1,31 +1,32 @@ --- ../src_base/minecraft/net/minecraft/src/GuiIngame.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/GuiIngame.java 0000-00-00 00:00:00.000000000 -0000 -@@ -5,6 +5,7 @@ - import java.util.Random; - import net.minecraft.client.Minecraft; +@@ -8,6 +8,8 @@ import org.lwjgl.opengl.GL11; -+import net.minecraft.src.forge.ISpecialArmor; + import org.lwjgl.opengl.GL12; ++import net.minecraft.src.forge.*; ++ public class GuiIngame extends Gui { -@@ -106,7 +107,19 @@ - } - int k8 = l - 39; - int j9 = k8 - 10; -- int i10 = mc.thePlayer.getTotalArmorValue(); -+ int i10 = 0; + private static RenderItem itemRenderer = new RenderItem(); +@@ -139,7 +141,19 @@ + + var51 = var7 - 39; + var22 = var51 - 10; +- var23 = this.mc.thePlayer.getTotalArmorValue(); ++ var23 = 0; + for (int x = 0; x < mc.thePlayer.inventory.armorInventory.length; x++) + { + ItemStack stack = mc.thePlayer.inventory.armorInventory[x]; + if (stack != null && stack.getItem() instanceof ISpecialArmor) + { -+ i10 += ((ISpecialArmor)stack.getItem()).getArmorDisplay(mc.thePlayer, stack, x); ++ var23 += ((ISpecialArmor)stack.getItem()).getArmorDisplay(mc.thePlayer, stack, x); + } + else if (stack != null && stack.getItem() instanceof ItemArmor) + { -+ i10 += ((ItemArmor)stack.getItem()).damageReduceAmount; ++ var23 += ((ItemArmor)stack.getItem()).damageReduceAmount; + } + } - int j10 = -1; - if (mc.thePlayer.isPotionActive(Potion.regeneration)) - { + int var24 = -1; + + if (this.mc.thePlayer.isPotionActive(Potion.regeneration)) diff --git a/forge/patches/minecraft/net/minecraft/src/Item.java.patch b/forge/patches/minecraft/net/minecraft/src/Item.java.patch index 00f7532c9..d811c0dd8 100644 --- a/forge/patches/minecraft/net/minecraft/src/Item.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/Item.java.patch @@ -1,35 +1,36 @@ --- ../src_base/minecraft/net/minecraft/src/Item.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/Item.java 0000-00-00 00:00:00.000000000 -0000 -@@ -1,6 +1,7 @@ +@@ -1,5 +1,6 @@ package net.minecraft.src; - import java.io.PrintStream; +import java.util.ArrayList; import java.util.List; import java.util.Random; -@@ -157,6 +158,9 @@ - private String potionEffect; - private String itemName; +@@ -188,7 +189,10 @@ -+ // FORGE: To disable repair recipes. + /** full name of item from language file */ + private String itemName; +- ++ ++ /** FORGE: To disable repair recipes. */ + protected boolean canRepair = true; -+ - protected Item(int i) ++ + protected Item(int par1) { - maxStackSize = 64; -@@ -449,7 +453,7 @@ - float f7 = f4 * f5; - float f8 = f6; - float f9 = f3 * f5; -- double d3 = 5D; -+ double d3 = ModLoader.getMinecraftInstance().playerController.getBlockReachDistance(); - Vec3D vec3d1 = vec3d.addVector((double)f7 * d3, (double)f8 * d3, (double)f9 * d3); - MovingObjectPosition movingobjectposition = world.rayTraceBlocks_do_do(vec3d, vec3d1, flag, !flag); - return movingobjectposition; -@@ -469,6 +473,149 @@ + this.shiftedIndex = 256 + par1; +@@ -542,7 +546,7 @@ + float var17 = MathHelper.sin(-var5 * 0.017453292F); + float var18 = var15 * var16; + float var20 = var14 * var16; +- double var21 = 5.0D; ++ double var21 = ModLoader.getMinecraftInstance().playerController.getBlockReachDistance(); + Vec3D var23 = var13.addVector((double)var18 * var21, (double)var17 * var21, (double)var20 * var21); + MovingObjectPosition var24 = par1World.rayTraceBlocks_do_do(var13, var23, par3, !par3); + return var24; +@@ -570,4 +574,147 @@ { - return getIconFromDamage(i); + StatList.initStats(); } + + /** @@ -40,11 +41,11 @@ + * @param itemList The list of items currently in the creative inventory + */ + public void addCreativeItems(ArrayList itemList) -+ { -+ if (this.shiftedIndex != Item.potion.shiftedIndex && this.shiftedIndex != Item.monsterPlacer.shiftedIndex) -+ { -+ itemList.add(new ItemStack(this, 1)); -+ } ++ { ++ if (this.shiftedIndex != Item.potion.shiftedIndex && this.shiftedIndex != Item.monsterPlacer.shiftedIndex) ++ { ++ itemList.add(new ItemStack(this, 1)); ++ } + } + + /** @@ -58,7 +59,7 @@ + */ + public boolean onDroppedByPlayer(ItemStack item, EntityPlayer player) + { -+ return true; ++ return true; + } + + /** @@ -74,7 +75,7 @@ + */ + public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int X, int Y, int Z, int side) + { -+ return false; ++ return false; + } + + /** @@ -86,7 +87,7 @@ + */ + public float getStrVsBlock(ItemStack itemstack, Block block, int metadata) + { -+ return getStrVsBlock(itemstack, block); ++ return getStrVsBlock(itemstack, block); + } + + /** @@ -95,7 +96,7 @@ + */ + public boolean isRepairable() + { -+ return canRepair && isDamageable(); ++ return canRepair && isDamageable(); + } + + /** @@ -104,8 +105,8 @@ + */ + public Item setNoRepair() + { -+ canRepair = false; -+ return this; ++ canRepair = false; ++ return this; + } + + /** @@ -122,7 +123,7 @@ + */ + public boolean onBlockStartBreak(ItemStack itemstack, int X, int Y, int Z, EntityPlayer player) + { -+ return false; ++ return false; + } + + /** @@ -174,6 +175,4 @@ + */ + return getIconIndex(stack); + } - - static - { + } diff --git a/forge/patches/minecraft/net/minecraft/src/ItemBow.java.patch b/forge/patches/minecraft/net/minecraft/src/ItemBow.java.patch index 47712eb79..34eeca329 100644 --- a/forge/patches/minecraft/net/minecraft/src/ItemBow.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/ItemBow.java.patch @@ -1,35 +1,35 @@ --- ../src_base/minecraft/net/minecraft/src/ItemBow.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/ItemBow.java 0000-00-00 00:00:00.000000000 -0000 -@@ -2,6 +2,8 @@ - - import java.util.Random; +@@ -1,5 +1,7 @@ + package net.minecraft.src; +import net.minecraft.src.forge.ForgeHooks; + public class ItemBow extends Item { - public ItemBow(int i) -@@ -13,6 +15,11 @@ - - public void onPlayerStoppedUsing(ItemStack itemstack, World world, EntityPlayer entityplayer, int i) + public ItemBow(int par1) +@@ -14,6 +16,11 @@ + */ + public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4) { -+ boolean handled = ForgeHooks.onArrowLoose(itemstack, world, entityplayer, getMaxItemUseDuration(itemstack) - i); -+ if (handled) ++ if (ForgeHooks.onArrowLoose(par1ItemStack, par2World, par3EntityPlayer, getMaxItemUseDuration(par1ItemStack) - par4)) + { + return; + } - boolean flag = entityplayer.capabilities.depleteBuckets || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, itemstack) > 0; - if (flag || entityplayer.inventory.hasItem(Item.arrow.shiftedIndex)) - { -@@ -80,6 +87,11 @@ ++ + boolean var5 = par3EntityPlayer.capabilities.depleteBuckets || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, par1ItemStack) > 0; - public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) + if (var5 || par3EntityPlayer.inventory.hasItem(Item.arrow.shiftedIndex)) +@@ -97,6 +104,12 @@ + */ + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { -+ ItemStack stack = ForgeHooks.onArrowNock(itemstack, world, entityplayer); ++ ItemStack stack = ForgeHooks.onArrowNock(par1ItemStack, par2World, par3EntityPlayer); + if (stack != null) + { + return stack; + } - if (entityplayer.capabilities.depleteBuckets || entityplayer.inventory.hasItem(Item.arrow.shiftedIndex)) ++ + if (par3EntityPlayer.capabilities.depleteBuckets || par3EntityPlayer.inventory.hasItem(Item.arrow.shiftedIndex)) { - entityplayer.setItemInUse(itemstack, getMaxItemUseDuration(itemstack)); + par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack)); diff --git a/forge/patches/minecraft/net/minecraft/src/ItemBucket.java.patch b/forge/patches/minecraft/net/minecraft/src/ItemBucket.java.patch index 0b79a918a..ff562cc6a 100644 --- a/forge/patches/minecraft/net/minecraft/src/ItemBucket.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/ItemBucket.java.patch @@ -1,23 +1,23 @@ --- ../src_base/minecraft/net/minecraft/src/ItemBucket.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/ItemBucket.java 0000-00-00 00:00:00.000000000 -0000 -@@ -2,6 +2,8 @@ - - import java.util.Random; +@@ -1,5 +1,7 @@ + package net.minecraft.src; +import net.minecraft.src.forge.MinecraftForge; + public class ItemBucket extends Item { - private int isFull; -@@ -40,6 +42,11 @@ - { - return itemstack; - } -+ ItemStack customBucket = MinecraftForge.fillCustomBucket(world, i, j, k); -+ if (customBucket != null) -+ { -+ return customBucket; -+ } - if (world.getBlockMaterial(i, j, k) == Material.water && world.getBlockMetadata(i, j, k) == 0) - { - world.setBlockWithNotify(i, j, k, 0); + /** field for checking if the bucket has been filled. */ +@@ -47,6 +49,12 @@ + { + return par1ItemStack; + } ++ ++ ItemStack stack = MinecraftForge.fillCustomBucket(par2World, var13, var14, var15); ++ if (stack != null) ++ { ++ return stack; ++ } + + if (par2World.getBlockMaterial(var13, var14, var15) == Material.water && par2World.getBlockMetadata(var13, var14, var15) == 0) + { diff --git a/forge/patches/minecraft/net/minecraft/src/ItemDye.java.patch b/forge/patches/minecraft/net/minecraft/src/ItemDye.java.patch index f22286edd..046a0aee2 100644 --- a/forge/patches/minecraft/net/minecraft/src/ItemDye.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/ItemDye.java.patch @@ -1,70 +1,65 @@ --- ../src_base/minecraft/net/minecraft/src/ItemDye.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/ItemDye.java 0000-00-00 00:00:00.000000000 -0000 -@@ -1,7 +1,10 @@ +@@ -1,5 +1,9 @@ package net.minecraft.src; +import java.util.ArrayList; - import java.util.Random; - ++ +import net.minecraft.src.forge.ForgeHooks; + public class ItemDye extends Item { - public static final String dyeColorNames[] = -@@ -43,6 +46,16 @@ - if (itemstack.getItemDamage() == 15) - { - int i1 = world.getBlockId(i, j, k); -+ -+ if (ForgeHooks.onUseBonemeal(world, i1, i, j, k)) -+ { -+ if (!world.isRemote) -+ { -+ itemstack.stackSize--; -+ } -+ return true; -+ } -+ - if (i1 == Block.sapling.blockID) + /** List of dye color names */ +@@ -43,6 +47,15 @@ + if (par1ItemStack.getItemDamage() == 15) { - if (!world.isRemote) -@@ -109,14 +122,7 @@ - world.setBlockAndMetadataWithNotify(k1, l1, i2, Block.tallGrass.blockID, 1); - continue; - } -- if (itemRand.nextInt(3) != 0) -- { -- world.setBlockWithNotify(k1, l1, i2, Block.plantYellow.blockID); -- } -- else -- { -- world.setBlockWithNotify(k1, l1, i2, Block.plantRed.blockID); -- } -+ ForgeHooks.plantGrassPlant(world, k1, l1, i2); - } - } - return true; -@@ -125,6 +131,23 @@ - return false; - } + int var8 = par3World.getBlockId(par4, par5, par6); ++ ++ if (ForgeHooks.onUseBonemeal(par3World, var8, par4, par5, par6)) ++ { ++ if (!par3World.isRemote) ++ { ++ par1ItemStack.stackSize--; ++ } ++ return true; ++ } + if (var8 == Block.sapling.blockID) + { +@@ -118,14 +131,7 @@ + { + par3World.setBlockAndMetadataWithNotify(var10, var11, var12, Block.tallGrass.blockID, 1); + } +- else if (itemRand.nextInt(3) != 0) +- { +- par3World.setBlockWithNotify(var10, var11, var12, Block.plantYellow.blockID); +- } +- else +- { +- par3World.setBlockWithNotify(var10, var11, var12, Block.plantRed.blockID); +- } ++ ForgeHooks.plantGrassPlant(par3World, var10, var11, var12); + } + } + } +@@ -155,4 +161,20 @@ + } + } + } + + /** -+ * Called when a new CreativeContainer is opened, populate the list -+ * with all of the items for this item you want a player in creative mode -+ * to have access to. -+ * -+ * @param itemList The list of items currently in the creative inventory -+ */ ++ * Called when a new CreativeContainer is opened, populate the list ++ * with all of the items for this item you want a player in creative mode ++ * to have access to. ++ * ++ * @param itemList The list of items currently in the creative inventory ++ */ + @Override + public void addCreativeItems(ArrayList itemList) -+ { -+ for (int x = 0; x < 16; x++) -+ { -+ itemList.add(new ItemStack(this, 1, x)); -+ } ++ { ++ for (int x = 0; x < 16; x++) ++ { ++ itemList.add(new ItemStack(this, 1, x)); ++ } + } -+ - public void useItemOnEntity(ItemStack itemstack, EntityLiving entityliving) - { - if (entityliving instanceof EntitySheep) + } diff --git a/forge/patches/minecraft/net/minecraft/src/ItemHoe.java.patch b/forge/patches/minecraft/net/minecraft/src/ItemHoe.java.patch index b14d552b4..b9b457e80 100644 --- a/forge/patches/minecraft/net/minecraft/src/ItemHoe.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/ItemHoe.java.patch @@ -7,16 +7,16 @@ + public class ItemHoe extends Item { - public ItemHoe(int i, EnumToolMaterial enumtoolmaterial) -@@ -15,6 +17,11 @@ - { - return false; + public ItemHoe(int par1, EnumToolMaterial par2EnumToolMaterial) +@@ -21,6 +23,11 @@ } -+ if(ForgeHooks.onUseHoe(itemstack, entityplayer, world, i, j, k)) -+ { -+ itemstack.damageItem(1, entityplayer); -+ return true; -+ } - int i1 = world.getBlockId(i, j, k); - int j1 = world.getBlockId(i, j + 1, k); - if (l != 0 && j1 == 0 && i1 == Block.grass.blockID || i1 == Block.dirt.blockID) + else + { ++ if (ForgeHooks.onUseHoe(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6)) ++ { ++ par1ItemStack.damageItem(1, par2EntityPlayer); ++ return true; ++ } + int var8 = par3World.getBlockId(par4, par5, par6); + int var9 = par3World.getBlockId(par4, par5 + 1, par6); + diff --git a/forge/patches/minecraft/net/minecraft/src/ItemRenderer.java.patch b/forge/patches/minecraft/net/minecraft/src/ItemRenderer.java.patch index 4962e0843..567e1c769 100644 --- a/forge/patches/minecraft/net/minecraft/src/ItemRenderer.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/ItemRenderer.java.patch @@ -9,41 +9,37 @@ +import net.minecraft.src.forge.MinecraftForgeClient; + import org.lwjgl.opengl.GL11; + import org.lwjgl.opengl.GL12; - public class ItemRenderer -@@ -27,20 +31,31 @@ - public void renderItem(EntityLiving entityliving, ItemStack itemstack, int i) +@@ -33,21 +37,27 @@ + public void renderItem(EntityLiving par1EntityLiving, ItemStack par2ItemStack, int par3) { GL11.glPushMatrix(); -- if (itemstack.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType())) -+ ICustomItemRenderer customRenderer = MinecraftForgeClient.getCustomItemRenderer(itemstack.itemID); -+ -+ if (customRenderer != null) ++ ICustomItemRenderer customRenderer = MinecraftForgeClient.getCustomItemRenderer(par2ItemStack.itemID); + +- if (par2ItemStack.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[par2ItemStack.itemID].getRenderType())) ++ if (customRenderer != null) + { -+ String tex = ForgeHooksClient.getTexture("/terrain.png", itemstack.getItem()); -+ GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture(tex)); -+ ForgeHooksClient.renderCustomItem(customRenderer, renderBlocksInstance, itemstack.itemID, itemstack.getItemDamage(), entityliving.getEntityBrightness(1.0F)); -+ } -+ else if(itemstack.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType())) ++ GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture(ForgeHooksClient.getTexture("/terrain.png", par2ItemStack.getItem()))); ++ ForgeHooksClient.renderCustomItem(customRenderer, renderBlocksInstance, par2ItemStack.itemID, par2ItemStack.getItemDamage(), par1EntityLiving.getEntityBrightness(1.0F)); ++ } ++ else if (par2ItemStack.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[par2ItemStack.itemID].getRenderType())) { -- GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/terrain.png")); -+ String tex = ForgeHooksClient.getTexture("/terrain.png", Block.blocksList[itemstack.itemID]); -+ GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture(tex)); - renderBlocksInstance.renderBlockAsItem(Block.blocksList[itemstack.itemID], itemstack.getItemDamage(), 1.0F); +- GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/terrain.png")); ++ GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture(ForgeHooksClient.getTexture("/terrain.png", par2ItemStack.getItem()))); + this.renderBlocksInstance.renderBlockAsItem(Block.blocksList[par2ItemStack.itemID], par2ItemStack.getItemDamage(), 1.0F); } else { - if (itemstack.itemID < 256) + if (par2ItemStack.itemID < 256) { -- GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/terrain.png")); -+ String tex = ForgeHooksClient.getTexture("/terrain.png", Block.blocksList[itemstack.itemID]); -+ GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture(tex)); +- GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/terrain.png")); ++ GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture(ForgeHooksClient.getTexture("/terrain.png", Block.blocksList[par2ItemStack.itemID]))); } else { -- GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/gui/items.png")); -+ String tex = ForgeHooksClient.getTexture("/gui/items.png", Item.itemsList[itemstack.itemID]); -+ GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture(tex)); +- GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/gui/items.png")); ++ GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture(ForgeHooksClient.getTexture("/gui/items.png", Item.itemsList[par2ItemStack.itemID]))); } - Tessellator tessellator = Tessellator.instance; - int j = entityliving.getItemIcon(itemstack, i); + + Tessellator var4 = Tessellator.instance; diff --git a/forge/patches/minecraft/net/minecraft/src/ItemShears.java.patch b/forge/patches/minecraft/net/minecraft/src/ItemShears.java.patch index 2c182aaed..b29449c15 100644 --- a/forge/patches/minecraft/net/minecraft/src/ItemShears.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/ItemShears.java.patch @@ -1,33 +1,32 @@ --- ../src_base/minecraft/net/minecraft/src/ItemShears.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/ItemShears.java 0000-00-00 00:00:00.000000000 -0000 -@@ -1,5 +1,9 @@ +@@ -1,5 +1,8 @@ package net.minecraft.src; +import java.util.ArrayList; -+ +import net.minecraft.src.forge.IShearable; + public class ItemShears extends Item { - public ItemShears(int i) -@@ -11,12 +15,11 @@ + public ItemShears(int par1) +@@ -11,13 +14,12 @@ - public boolean onBlockDestroyed(ItemStack itemstack, int i, int j, int k, int l, EntityLiving entityliving) + public boolean onBlockDestroyed(ItemStack par1ItemStack, int par2, int par3, int par4, int par5, EntityLiving par6EntityLiving) { -- if (i == Block.leaves.blockID || i == Block.web.blockID || i == Block.tallGrass.blockID || i == Block.vine.blockID) -+ if (i == Block.leaves.blockID || i == Block.web.blockID || i == Block.tallGrass.blockID || i == Block.vine.blockID || Block.blocksList[i] instanceof IShearable) +- if (par2 != Block.leaves.blockID && par2 != Block.web.blockID && par2 != Block.tallGrass.blockID && par2 != Block.vine.blockID) ++ if (par2 != Block.leaves.blockID && par2 != Block.web.blockID && par2 != Block.tallGrass.blockID && par2 != Block.vine.blockID && Block.blocksList[par2] instanceof IShearable) { -- itemstack.damageItem(1, entityliving); + return super.onBlockDestroyed(par1ItemStack, par2, par3, par4, par5, par6EntityLiving); + } + else + { +- par1ItemStack.damageItem(1, par6EntityLiving); return true; } -- else -+ else - { - return super.onBlockDestroyed(itemstack, i, j, k, l, entityliving); - } -@@ -42,4 +45,62 @@ - return super.getStrVsBlock(itemstack, block); - } + } +@@ -38,4 +40,62 @@ + { + return par2Block.blockID != Block.web.blockID && par2Block.blockID != Block.leaves.blockID ? (par2Block.blockID == Block.cloth.blockID ? 5.0F : super.getStrVsBlock(par1ItemStack, par2Block)) : 15.0F; } + + @Override @@ -57,19 +56,19 @@ + } + + @Override -+ public boolean onBlockStartBreak(ItemStack itemstack, int X, int Y, int Z, EntityPlayer player) ++ public boolean onBlockStartBreak(ItemStack itemstack, int x, int y, int z, EntityPlayer player) + { + if (player.worldObj.isRemote) + { + return false; + } -+ int id = player.worldObj.getBlockId(X, Y, Z); ++ int id = player.worldObj.getBlockId(x, y, z); + if (Block.blocksList[id] != null && Block.blocksList[id] instanceof IShearable) + { + IShearable target = (IShearable)Block.blocksList[id]; -+ if (target.isShearable(itemstack, player.worldObj, X, Y, Z)) ++ if (target.isShearable(itemstack, player.worldObj, x, y, z)) + { -+ ArrayList drops = target.onSheared(itemstack, player.worldObj, X, Y, Z, ++ ArrayList drops = target.onSheared(itemstack, player.worldObj, x, y, z, + EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, itemstack)); + for(ItemStack stack : drops) + { @@ -77,7 +76,7 @@ + double d = (double)(player.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; + double d1 = (double)(player.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; + double d2 = (double)(player.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 entityitem = new EntityItem(player.worldObj, (double)x + d, (double)y + d1, (double)z + d2, stack); + entityitem.delayBeforeCanPickup = 10; + player.worldObj.spawnEntityInWorld(entityitem); + } diff --git a/forge/patches/minecraft/net/minecraft/src/ItemTool.java.patch b/forge/patches/minecraft/net/minecraft/src/ItemTool.java.patch index a19b4943f..cc905fd4a 100644 --- a/forge/patches/minecraft/net/minecraft/src/ItemTool.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/ItemTool.java.patch @@ -1,35 +1,34 @@ --- ../src_base/minecraft/net/minecraft/src/ItemTool.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/ItemTool.java 0000-00-00 00:00:00.000000000 -0000 -@@ -1,10 +1,12 @@ +@@ -1,11 +1,13 @@ package net.minecraft.src; +import net.minecraft.src.forge.ForgeHooks; + public class ItemTool extends Item { - private Block blocksEffectiveAgainst[]; -- protected float efficiencyOnProperMaterial; + /** Array of blocks the tool has extra effect against. */ + private Block[] blocksEffectiveAgainst; +- protected float efficiencyOnProperMaterial = 4.0F; - private int damageVsEntity; -+ public float efficiencyOnProperMaterial; ++ public float efficiencyOnProperMaterial = 4.0F; + public int damageVsEntity; + + /** The material this tool is made from. */ protected EnumToolMaterial toolMaterial; - - protected ItemTool(int i, int j, EnumToolMaterial enumtoolmaterial, Block ablock[]) -@@ -32,6 +34,17 @@ - return 1.0F; - } - -+ /* FORGE: Overridden to allow custom tool effectiveness */ -+ @Override -+ public float getStrVsBlock(ItemStack itemstack, Block block, int md) -+ { -+ if (ForgeHooks.isToolEffective(itemstack, block, md)) -+ { -+ return efficiencyOnProperMaterial; -+ } -+ return getStrVsBlock(itemstack,block); -+ } -+ - public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1) +@@ -77,4 +79,15 @@ { - itemstack.damageItem(2, entityliving1); + return this.toolMaterial.getEnchantability(); + } ++ ++ /** FORGE: Overridden to allow custom tool effectiveness */ ++ @Override ++ public float getStrVsBlock(ItemStack stack, Block block, int meta) ++ { ++ if (ForgeHooks.isToolEffective(stack, block, meta)) ++ { ++ return efficiencyOnProperMaterial; ++ } ++ return getStrVsBlock(stack, block); ++ } + } diff --git a/forge/patches/minecraft/net/minecraft/src/MovingObjectPosition.java.patch b/forge/patches/minecraft/net/minecraft/src/MovingObjectPosition.java.patch index 7e5a80ea1..6f0af78f8 100644 --- a/forge/patches/minecraft/net/minecraft/src/MovingObjectPosition.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/MovingObjectPosition.java.patch @@ -1,12 +1,12 @@ --- ../src_base/minecraft/net/minecraft/src/MovingObjectPosition.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/MovingObjectPosition.java 0000-00-00 00:00:00.000000000 -0000 -@@ -9,6 +9,9 @@ - public int sideHit; - public Vec3D hitVec; +@@ -25,6 +25,9 @@ + + /** The hit entity */ public Entity entityHit; + -+ //Added for RedPower subblocks ++ /** Used to determine what sub-segment is hit */ + public int subHit = -1; - public MovingObjectPosition(int i, int j, int k, int l, Vec3D vec3d) + public MovingObjectPosition(int par1, int par2, int par3, int par4, Vec3D par5Vec3D) { diff --git a/forge/patches/minecraft/net/minecraft/src/NetClientHandler.java.patch b/forge/patches/minecraft/net/minecraft/src/NetClientHandler.java.patch index 8c70a3751..9b83a3559 100644 --- a/forge/patches/minecraft/net/minecraft/src/NetClientHandler.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/NetClientHandler.java.patch @@ -1,8 +1,16 @@ --- ../src_base/minecraft/net/minecraft/src/NetClientHandler.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/NetClientHandler.java 0000-00-00 00:00:00.000000000 -0000 -@@ -7,6 +7,9 @@ - import java.util.*; - import java.util.logging.Logger; +@@ -5,6 +5,7 @@ + import java.io.DataInputStream; + import java.io.IOException; + import java.io.InputStreamReader; ++import java.io.UnsupportedEncodingException; + import java.net.InetAddress; + import java.net.Socket; + import java.net.URL; +@@ -15,6 +16,9 @@ + import java.util.Map; + import java.util.Random; import net.minecraft.client.Minecraft; +import net.minecraft.src.forge.ForgeHooks; +import net.minecraft.src.forge.MessageManager; @@ -10,21 +18,21 @@ public class NetClientHandler extends NetHandler { -@@ -35,6 +38,8 @@ - mc = minecraft; - Socket socket = new Socket(InetAddress.getByName(s), i); - netManager = new NetworkManager(socket, "Client", this); +@@ -46,6 +50,8 @@ + this.mc = par1Minecraft; + Socket var4 = new Socket(InetAddress.getByName(par2Str), par3); + this.netManager = new NetworkManager(var4, "Client", this); + + ForgeHooks.onConnect(netManager); } - public void processReadPackets() -@@ -58,6 +63,27 @@ - mc.thePlayer.entityId = packet1login.protocolVersion; - currentServerMaxPlayers = packet1login.maxPlayers; - ((PlayerControllerMP)mc.playerController).setCreative(packet1login.serverMode == 1); + /** +@@ -73,6 +79,29 @@ + this.mc.thePlayer.entityId = par1Packet1Login.protocolVersion; + this.currentServerMaxPlayers = par1Packet1Login.maxPlayers; + ((PlayerControllerMP)this.mc.playerController).setCreative(par1Packet1Login.serverMode == 1); + -+ ForgeHooks.onLogin(netManager, packet1login); ++ ForgeHooks.onLogin(netManager, par1Packet1Login); + + String[] channels = MessageManager.getInstance().getRegisteredChannels(netManager); + StringBuilder tmp = new StringBuilder(); @@ -36,22 +44,24 @@ + } + Packet250CustomPayload pkt = new Packet250CustomPayload(); + pkt.channel = "REGISTER"; -+ try { ++ try ++ { + pkt.data = tmp.toString().getBytes("UTF8"); -+ } catch (UnsupportedEncodingException e) { ++ } ++ catch (UnsupportedEncodingException e) ++ { + e.printStackTrace(); + } + pkt.length = pkt.data.length; + addToSendQueue(pkt); -+ } - public void handlePickupSpawn(Packet21PickupSpawn packet21pickupspawn) -@@ -608,7 +634,19 @@ + public void handlePickupSpawn(Packet21PickupSpawn par1Packet21PickupSpawn) +@@ -630,7 +659,19 @@ } - else if (packet2handshake.username.equals("-")) + else if (par1Packet2Handshake.username.equals("-")) { -- addToSendQueue(new Packet1Login(mc.session.username, 23)); +- this.addToSendQueue(new Packet1Login(this.mc.session.username, 28)); + /** + * We use some of the unused fields in Packet 001 Login to identify the user as having Forge installed. + * This allows modded clients to connect to Vanilla server without crashing. @@ -59,20 +69,20 @@ + * Its a bit of a dirty hack, but it doesnt interrupt the login flow, and its unused data. + * The C->S serverMode is set to the hash code of the string "Forge", this should provide a fairly unique + * identifier so we are certain it is not random, and it is Forge installed. -+ * The C->S mapSeed is set to the current Forge build number, in case we need to do any quick version checks. ++ * The C->S dimension is set to the current Forge build number, in case we need to do any quick version checks. + */ -+ Packet1Login pkt = new Packet1Login(mc.session.username, 23); -+ pkt.serverMode = ForgePacket.FORGE_ID; -+ pkt.mapSeed = ForgeHooks.buildVersion; ++ Packet1Login pkt = new Packet1Login(mc.session.username, 28); ++ pkt.serverMode = ForgePacket.FORGE_ID; ++ pkt.field_48170_e = ForgeHooks.buildVersion; + addToSendQueue(pkt); } else { -@@ -620,7 +658,19 @@ - bufferedreader.close(); - if (s1.equalsIgnoreCase("ok")) +@@ -643,7 +684,19 @@ + + if (var6.equalsIgnoreCase("ok")) { -- addToSendQueue(new Packet1Login(mc.session.username, 23)); +- this.addToSendQueue(new Packet1Login(this.mc.session.username, 28)); + /** + * We use some of the unused fields in Packet 001 Login to identify the user as having Forge installed. + * This allows modded clients to connect to Vanilla server without crashing. @@ -80,18 +90,18 @@ + * Its a bit of a dirty hack, but it doesnt interrupt the login flow, and its unused data. + * The C->S serverMode is set to the hash code of the string "Forge", this should provide a fairly unique + * identifier so we are certain it is not random, and it is Forge installed. -+ * The C->S mapSeed is set to the current Forge build number, in case we need to do any quick version checks. ++ * The C->S dimension is set to the current Forge build number, in case we need to do any quick version checks. + */ -+ Packet1Login pkt = new Packet1Login(mc.session.username, 23); -+ pkt.serverMode = ForgePacket.FORGE_ID; -+ pkt.mapSeed = ForgeHooks.buildVersion; ++ Packet1Login pkt = new Packet1Login(mc.session.username, 28); ++ pkt.serverMode = ForgePacket.FORGE_ID; ++ pkt.field_48170_e = ForgeHooks.buildVersion; + addToSendQueue(pkt); } else { -@@ -1017,4 +1067,44 @@ +@@ -1074,4 +1127,44 @@ { - addToSendQueue(new Packet0KeepAlive(packet0keepalive.randomId)); + this.addToSendQueue(new Packet0KeepAlive(par1Packet0KeepAlive.randomId)); } + + @Override @@ -110,7 +120,7 @@ + } + catch (UnsupportedEncodingException ex) + { -+ ModLoader.ThrowException("NetClientHandler.handleCustomPayload", ex); ++ ModLoader.throwException("NetClientHandler.handleCustomPayload", ex); + } + } + else if (pkt.channel.equals("UNREGISTER")) @@ -125,7 +135,7 @@ + } + catch (UnsupportedEncodingException ex) + { -+ ModLoader.ThrowException("NetClientHandler.handleCustomPayload", ex); ++ ModLoader.throwException("NetClientHandler.handleCustomPayload", ex); + } + } + else diff --git a/forge/patches/minecraft/net/minecraft/src/NetworkManager.java.patch b/forge/patches/minecraft/net/minecraft/src/NetworkManager.java.patch index ee2a9c654..e4367bd42 100644 --- a/forge/patches/minecraft/net/minecraft/src/NetworkManager.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/NetworkManager.java.patch @@ -1,25 +1,25 @@ --- ../src_base/minecraft/net/minecraft/src/NetworkManager.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/NetworkManager.java 0000-00-00 00:00:00.000000000 -0000 -@@ -4,6 +4,8 @@ - import java.net.*; - import java.util.*; +@@ -11,6 +11,8 @@ + import java.util.Collections; + import java.util.List; +import net.minecraft.src.forge.ForgeHooks; + public class NetworkManager { - public static final Object threadSyncObject = new Object(); -@@ -201,6 +203,7 @@ - networkSocket = null; + /** Synchronization object used for read and write threads. */ +@@ -307,6 +309,7 @@ + { + ; + } ++ ForgeHooks.onDisconnect(this, par1Str, par2ArrayOfObj); } - catch (Throwable throwable2) { } -+ ForgeHooks.onDisconnect(this, s, aobj); } - public void processReadPackets() -@@ -293,4 +296,14 @@ +@@ -427,4 +430,14 @@ { - return networkmanager.writeThread; + return par0NetworkManager.writeThread; } + + /** diff --git a/forge/patches/minecraft/net/minecraft/src/PlayerController.java.patch b/forge/patches/minecraft/net/minecraft/src/PlayerController.java.patch index fdab6c278..deb45d187 100644 --- a/forge/patches/minecraft/net/minecraft/src/PlayerController.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/PlayerController.java.patch @@ -8,25 +8,20 @@ public abstract class PlayerController { -@@ -29,10 +30,10 @@ - } - world.playAuxSFX(2001, i, j, k, block.blockID + world.getBlockMetadata(i, j, k) * 256); - int i1 = world.getBlockMetadata(i, j, k); -- boolean flag = world.setBlockWithNotify(i, j, k, 0); -- if (block != null && flag) -+ boolean flag = block.removeBlockByPlayer(world, mc.thePlayer, i, j, k); -+ if (flag) +@@ -39,7 +40,7 @@ { -- block.onBlockDestroyedByPlayer(world, i, j, k, i1); -+ block.onBlockDestroyedByPlayer(world, i, j, k, i1); - } - return flag; - } -@@ -57,6 +58,7 @@ - if (itemstack1.stackSize == 0) + var5.playAuxSFX(2001, par1, par2, par3, var6.blockID + (var5.getBlockMetadata(par1, par2, par3) << 12)); + int var7 = var5.getBlockMetadata(par1, par2, par3); +- boolean var8 = var5.setBlockWithNotify(par1, par2, par3, 0); ++ boolean var8 = var6.removeBlockByPlayer(var5, mc.thePlayer, par1, par2, par3); + + if (var6 != null && var8) { - entityplayer.inventory.mainInventory[entityplayer.inventory.currentItem] = null; -+ ForgeHooks.onDestroyCurrentItem(entityplayer,itemstack1); +@@ -86,6 +87,7 @@ + if (var5.stackSize == 0) + { + par1EntityPlayer.inventory.mainInventory[par1EntityPlayer.inventory.currentItem] = null; ++ ForgeHooks.onDestroyCurrentItem(par1EntityPlayer, var5); } + return true; - } diff --git a/forge/patches/minecraft/net/minecraft/src/PlayerControllerCreative.java.patch b/forge/patches/minecraft/net/minecraft/src/PlayerControllerCreative.java.patch index 51238f557..3d86ace05 100644 --- a/forge/patches/minecraft/net/minecraft/src/PlayerControllerCreative.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/PlayerControllerCreative.java.patch @@ -1,27 +1,28 @@ --- ../src_base/minecraft/net/minecraft/src/PlayerControllerCreative.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/PlayerControllerCreative.java 0000-00-00 00:00:00.000000000 -0000 -@@ -43,11 +43,24 @@ - public static void clickBlockCreative(Minecraft minecraft, PlayerController playercontroller, int i, int j, int k, int l) +@@ -52,6 +52,11 @@ + */ + public static void clickBlockCreative(Minecraft par0Minecraft, PlayerController par1PlayerController, int par2, int par3, int par4, int par5) { - minecraft.theWorld.onBlockHit(minecraft.thePlayer, i, j, k, l); -+ ItemStack itemstack = minecraft.thePlayer.getCurrentEquippedItem(); -+ if (itemstack != null && itemstack.getItem().onBlockStartBreak(itemstack, i, j, k, minecraft.thePlayer)) ++ ItemStack itemstack = par0Minecraft.thePlayer.getCurrentEquippedItem(); ++ if (itemstack != null && itemstack.getItem().onBlockStartBreak(itemstack, par2, par3, par4, par0Minecraft.thePlayer)) + { + return; + } - playercontroller.onPlayerDestroyBlock(i, j, k, l); - } - - public boolean onPlayerRightClick(EntityPlayer entityplayer, World world, ItemStack itemstack, int i, int j, int k, int l) - { -+ if (itemstack != null) -+ { -+ Item item = itemstack.getItem(); -+ if (item.onItemUseFirst(itemstack, entityplayer, world, i, j, k, l)) -+ { -+ return true; -+ } -+ } - int i1 = world.getBlockId(i, j, k); - if (i1 > 0 && Block.blocksList[i1].blockActivated(world, i, j, k, entityplayer)) + if (!par0Minecraft.theWorld.func_48457_a(par0Minecraft.thePlayer, par2, par3, par4, par5)) { + par1PlayerController.onPlayerDestroyBlock(par2, par3, par4, par5); +@@ -63,6 +68,13 @@ + */ + public boolean onPlayerRightClick(EntityPlayer par1EntityPlayer, World par2World, ItemStack par3ItemStack, int par4, int par5, int par6, int par7) + { ++ if (par3ItemStack != null && ++ par3ItemStack.getItem() != null && ++ par3ItemStack.getItem().onItemUseFirst(par3ItemStack, par1EntityPlayer, par2World, par4, par5, par6, par7)) ++ { ++ return true; ++ } ++ + int var8 = par2World.getBlockId(par4, par5, par6); + + if (var8 > 0 && Block.blocksList[var8].blockActivated(par2World, par4, par5, par6, par1EntityPlayer)) diff --git a/forge/patches/minecraft/net/minecraft/src/PlayerControllerMP.java.patch b/forge/patches/minecraft/net/minecraft/src/PlayerControllerMP.java.patch index 4a75e7512..b87ef269c 100644 --- a/forge/patches/minecraft/net/minecraft/src/PlayerControllerMP.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/PlayerControllerMP.java.patch @@ -8,76 +8,65 @@ public class PlayerControllerMP extends PlayerController { -@@ -56,13 +57,19 @@ - - public boolean onPlayerDestroyBlock(int i, int j, int k, int l) +@@ -75,6 +76,11 @@ + */ + public boolean onPlayerDestroyBlock(int par1, int par2, int par3, int par4) { -+ ItemStack itemstack = mc.thePlayer.getCurrentEquippedItem(); -+ if (itemstack != null && itemstack.getItem().onBlockStartBreak(itemstack, i, j, k, mc.thePlayer)) -+ { -+ return false; -+ } -+ - if (creativeMode) - { - return super.onPlayerDestroyBlock(i, j, k, l); - } - int i1 = mc.theWorld.getBlockId(i, j, k); - boolean flag = super.onPlayerDestroyBlock(i, j, k, l); -- ItemStack itemstack = mc.thePlayer.getCurrentEquippedItem(); -+ - if (itemstack != null) - { - itemstack.onDestroyBlock(i1, i, j, k, mc.thePlayer); -@@ -91,7 +98,7 @@ - { - Block.blocksList[i1].onBlockClicked(mc.theWorld, i, j, k, mc.thePlayer); - } -- if (i1 > 0 && Block.blocksList[i1].blockStrength(mc.thePlayer) >= 1.0F) -+ if(i1 > 0 && Block.blocksList[i1].blockStrength(mc.theWorld, mc.thePlayer, i, j, k) >= 1.0F) - { - onPlayerDestroyBlock(i, j, k, l); - } -@@ -138,7 +145,7 @@ - return; - } - Block block = Block.blocksList[i1]; -- curBlockDamageMP += block.blockStrength(mc.thePlayer); -+ curBlockDamageMP += block.blockStrength(mc.theWorld, mc.thePlayer, i, j, k); - if (stepSoundTickCounter % 4F == 0.0F && block != null) - { - mc.sndManager.playSound(block.stepSound.getStepSound(), (float)i + 0.5F, (float)j + 0.5F, (float)k + 0.5F, (block.stepSound.getVolume() + 1.0F) / 8F, block.stepSound.getPitch() * 0.5F); -@@ -207,6 +214,16 @@ - { - syncCurrentPlayItem(); - netClientHandler.addToSendQueue(new Packet15Place(i, j, k, l, entityplayer.inventory.getCurrentItem())); -+ -+ if (itemstack != null) ++ ItemStack stack = mc.thePlayer.getCurrentEquippedItem(); ++ if (stack != null && stack.getItem().onBlockStartBreak(stack, par1, par2, par3, mc.thePlayer)) + { -+ Item item = itemstack.getItem(); -+ if (item.onItemUseFirst(itemstack, entityplayer, world, i, j, k, l)) -+ { -+ return true; -+ } ++ return false; ++ } + if (this.creativeMode) + { + return super.onPlayerDestroyBlock(par1, par2, par3, par4); +@@ -121,7 +127,7 @@ + Block.blocksList[var5].onBlockClicked(this.mc.theWorld, par1, par2, par3, this.mc.thePlayer); + } + +- if (var5 > 0 && Block.blocksList[var5].blockStrength(this.mc.thePlayer) >= 1.0F) ++ if (var5 > 0 && Block.blocksList[var5].blockStrength(mc.theWorld, mc.thePlayer, par1, par2, par3) >= 1.0F) + { + this.onPlayerDestroyBlock(par1, par2, par3, par4); + } +@@ -177,7 +183,7 @@ + } + + Block var6 = Block.blocksList[var5]; +- this.curBlockDamageMP += var6.blockStrength(this.mc.thePlayer); ++ this.curBlockDamageMP += var6.blockStrength(mc.theWorld, mc.thePlayer, par1, par2, par3); + + if (this.stepSoundTickCounter % 4.0F == 0.0F && var6 != null) + { +@@ -263,6 +269,14 @@ + { + this.syncCurrentPlayItem(); + this.netClientHandler.addToSendQueue(new Packet15Place(par4, par5, par6, par7, par1EntityPlayer.inventory.getCurrentItem())); ++ ++ if (par3ItemStack != null && ++ par3ItemStack.getItem() != null && ++ par3ItemStack.getItem().onItemUseFirst(par3ItemStack, par1EntityPlayer, par2World, par4, par5, par6, par7)) ++ { ++ return true; + } + - int i1 = world.getBlockId(i, j, k); - if (i1 > 0 && Block.blocksList[i1].blockActivated(world, i, j, k, entityplayer)) - { -@@ -227,7 +244,15 @@ + int var8 = par2World.getBlockId(par4, par5, par6); + + if (var8 > 0 && Block.blocksList[var8].blockActivated(par2World, par4, par5, par6, par1EntityPlayer)) +@@ -284,7 +298,15 @@ } else { -- return itemstack.useItem(entityplayer, world, i, j, k, l); -+ if (!itemstack.useItem(entityplayer, world, i, j, k, l)) +- return par3ItemStack.useItem(par1EntityPlayer, par2World, par4, par5, par6, par7); ++ if (!par3ItemStack.useItem(par1EntityPlayer, par2World, par4, par5, par6, par7)) + { -+ return false; ++ return false; + } -+ if (itemstack.stackSize == 0) -+ { -+ ForgeHooks.onDestroyCurrentItem(entityplayer, itemstack); -+ } -+ return true; ++ if (par3ItemStack.stackSize <= 0) ++ { ++ ForgeHooks.onDestroyCurrentItem(par1EntityPlayer, par3ItemStack); ++ } ++ return true; } } diff --git a/forge/patches/minecraft/net/minecraft/src/PlayerControllerSP.java.patch b/forge/patches/minecraft/net/minecraft/src/PlayerControllerSP.java.patch index 44977efd9..cfe6ed148 100644 --- a/forge/patches/minecraft/net/minecraft/src/PlayerControllerSP.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/PlayerControllerSP.java.patch @@ -8,73 +8,67 @@ public class PlayerControllerSP extends PlayerController { -@@ -36,11 +37,16 @@ - - public boolean onPlayerDestroyBlock(int i, int j, int k, int l) +@@ -35,11 +36,17 @@ + */ + public boolean onPlayerDestroyBlock(int par1, int par2, int par3, int par4) { -+ ItemStack itemstack = mc.thePlayer.getCurrentEquippedItem(); -+ if (itemstack != null && itemstack.getItem().onBlockStartBreak(itemstack, i, j, k, mc.thePlayer)) -+ { -+ return false; -+ } -+ - int i1 = mc.theWorld.getBlockId(i, j, k); - int j1 = mc.theWorld.getBlockMetadata(i, j, k); - boolean flag = super.onPlayerDestroyBlock(i, j, k, l); -- ItemStack itemstack = mc.thePlayer.getCurrentEquippedItem(); -- boolean flag1 = mc.thePlayer.canHarvestBlock(Block.blocksList[i1]); -+ boolean flag1 = Block.blocksList[i1].canHarvestBlock(mc.thePlayer, j1); - if (itemstack != null) - { - itemstack.onDestroyBlock(i1, i, j, k, mc.thePlayer); -@@ -69,7 +75,7 @@ - { - Block.blocksList[i1].onBlockClicked(mc.theWorld, i, j, k, mc.thePlayer); - } -- if (i1 > 0 && Block.blocksList[i1].blockStrength(mc.thePlayer) >= 1.0F) -+ if (i1 > 0 && Block.blocksList[i1].blockStrength(mc.theWorld, mc.thePlayer, i, j, k) >= 1.0F) - { - onPlayerDestroyBlock(i, j, k, l); - } -@@ -100,7 +106,7 @@ - return; - } - Block block = Block.blocksList[i1]; -- curBlockDamage += block.blockStrength(mc.thePlayer); -+ curBlockDamage += block.blockStrength(mc.theWorld, mc.thePlayer, i, j, k); - if (blockDestroySoundCounter % 4F == 0.0F && block != null) - { - mc.sndManager.playSound(block.stepSound.getStepSound(), (float)i + 0.5F, (float)j + 0.5F, (float)k + 0.5F, (block.stepSound.getVolume() + 1.0F) / 8F, block.stepSound.getPitch() * 0.5F); -@@ -165,6 +171,14 @@ - - public boolean onPlayerRightClick(EntityPlayer entityplayer, World world, ItemStack itemstack, int i, int j, int k, int l) - { -+ if (itemstack != null) ++ ItemStack stack = mc.thePlayer.getCurrentEquippedItem(); ++ if (stack != null && stack.getItem().onBlockStartBreak(stack, par1, par2, par3, mc.thePlayer)) + { -+ Item item = itemstack.getItem(); -+ if (item.onItemUseFirst(itemstack, entityplayer, world, i, j, k, l)) -+ { -+ return true; -+ } ++ return false; + } - int i1 = world.getBlockId(i, j, k); - if (i1 > 0 && Block.blocksList[i1].blockActivated(world, i, j, k, entityplayer)) ++ + int var5 = this.mc.theWorld.getBlockId(par1, par2, par3); + int var6 = this.mc.theWorld.getBlockMetadata(par1, par2, par3); + boolean var7 = super.onPlayerDestroyBlock(par1, par2, par3, par4); + ItemStack var8 = this.mc.thePlayer.getCurrentEquippedItem(); +- boolean var9 = this.mc.thePlayer.canHarvestBlock(Block.blocksList[var5]); ++ boolean var9 = Block.blocksList[var5].canHarvestBlock(mc.thePlayer, var6); + + if (var8 != null) { -@@ -176,7 +190,16 @@ - } - else - { -- return itemstack.useItem(entityplayer, world, i, j, k, l); -+ if (!itemstack.useItem(entityplayer, world, i, j, k, l)) -+ { -+ return false; -+ } -+ -+ if(itemstack.stackSize == 0) -+ { -+ ForgeHooks.onDestroyCurrentItem(entityplayer, itemstack); -+ } +@@ -75,7 +82,7 @@ + Block.blocksList[var5].onBlockClicked(this.mc.theWorld, par1, par2, par3, this.mc.thePlayer); + } + +- if (var5 > 0 && Block.blocksList[var5].blockStrength(this.mc.thePlayer) >= 1.0F) ++ if (var5 > 0 && Block.blocksList[var5].blockStrength(mc.theWorld, mc.thePlayer, par1, par2, par3) >= 1.0F) + { + this.onPlayerDestroyBlock(par1, par2, par3, par4); + } +@@ -195,8 +202,34 @@ + */ + public boolean onPlayerRightClick(EntityPlayer par1EntityPlayer, World par2World, ItemStack par3ItemStack, int par4, int par5, int par6, int par7) + { ++ if (par3ItemStack != null && ++ par3ItemStack.getItem() != null && ++ par3ItemStack.getItem().onItemUseFirst(par3ItemStack, par1EntityPlayer, par2World, par4, par5, par6, par7)) ++ { ++ return true; ++ } ++ + int var8 = par2World.getBlockId(par4, par5, par6); +- return var8 > 0 && Block.blocksList[var8].blockActivated(par2World, par4, par5, par6, par1EntityPlayer) ? true : (par3ItemStack == null ? false : par3ItemStack.useItem(par1EntityPlayer, par2World, par4, par5, par6, par7)); ++ if (var8 > 0 && Block.blocksList[var8].blockActivated(par2World, par4, par5, par6, par1EntityPlayer)) ++ { + return true; - } ++ } ++ ++ if (par3ItemStack == null) ++ { ++ return false; ++ } ++ ++ if (!par3ItemStack.useItem(par1EntityPlayer, par2World, par4, par5, par6, par7)) ++ { ++ return false; ++ } ++ ++ if (par3ItemStack.stackSize <= 0) ++ { ++ ForgeHooks.onDestroyCurrentItem(par1EntityPlayer, par3ItemStack); ++ } ++ return true; } + public boolean func_35642_f() diff --git a/forge/patches/minecraft/net/minecraft/src/RailLogic.java.patch b/forge/patches/minecraft/net/minecraft/src/RailLogic.java.patch index 30525cf36..8e40775ce 100644 --- a/forge/patches/minecraft/net/minecraft/src/RailLogic.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/RailLogic.java.patch @@ -7,81 +7,83 @@ -class RailLogic +public class RailLogic { + /** Reference to the World object. */ private World worldObj; - private int trackX; -@@ -12,6 +12,7 @@ - private final boolean isPoweredRail; +@@ -18,6 +18,7 @@ private List connectedTracks; + final BlockRail rail; + private final boolean canMakeSlopes; - public RailLogic(BlockRail blockrail, World world, int i, int j, int k) + public RailLogic(BlockRail par1BlockRail, World par2World, int par3, int par4, int par5) { -@@ -23,16 +24,12 @@ - trackY = j; - trackZ = k; - int l = world.getBlockId(i, j, k); -- int i1 = world.getBlockMetadata(i, j, k); -- if (BlockRail.isPoweredBlockRail((BlockRail)Block.blocksList[l])) +@@ -28,18 +29,12 @@ + this.trackY = par4; + this.trackZ = par5; + int var6 = par2World.getBlockId(par3, par4, par5); +- int var7 = par2World.getBlockMetadata(par3, par4, par5); +- +- if (BlockRail.isPoweredBlockRail((BlockRail)Block.blocksList[var6])) - { -- isPoweredRail = true; -- i1 &= -9; +- this.isPoweredRail = true; +- var7 &= -9; - } - else - { -- isPoweredRail = false; +- this.isPoweredRail = false; - } +- + -+ BlockRail target = (BlockRail)Block.blocksList[l]; -+ int i1 = target.getBasicRailMetadata(world, null, i, j, k); -+ isPoweredRail = !target.isFlexibleRail(world, i, j, k); -+ canMakeSlopes = target.canMakeSlopes(world, i, j, k); ++ BlockRail target = (BlockRail)Block.blocksList[var6]; ++ int var7 = target.getBasicRailMetadata(par2World, null, par3, par4, par5); ++ isPoweredRail = !target.isFlexibleRail(par2World, par3, par4, par5); ++ canMakeSlopes = target.canMakeSlopes(par2World, par3, par4, par5); + - setConnections(i1); + this.setConnections(var7); } -@@ -243,7 +240,7 @@ - byte0 = 9; +@@ -258,7 +253,7 @@ } } -- if (byte0 == 0) -+ if (byte0 == 0 && canMakeSlopes) - { - if (BlockRail.isRailBlockAt(worldObj, trackX, trackY + 1, trackZ - 1)) - { -@@ -254,7 +251,7 @@ - byte0 = 5; - } - } -- if (byte0 == 1) -+ if (byte0 == 1 && canMakeSlopes) - { - if (BlockRail.isRailBlockAt(worldObj, trackX + 1, trackY + 1, trackZ)) - { -@@ -377,7 +374,7 @@ - } - } - } -- if (byte0 == 0) -+ if (byte0 == 0 && canMakeSlopes) - { - if (BlockRail.isRailBlockAt(worldObj, trackX, trackY + 1, trackZ - 1)) - { -@@ -388,7 +385,7 @@ - byte0 = 5; - } - } -- if (byte0 == 1) -+ if (byte0 == 1 && canMakeSlopes) - { - if (BlockRail.isRailBlockAt(worldObj, trackX + 1, trackY + 1, trackZ)) - { -@@ -428,7 +425,7 @@ - } - } -- static int getNAdjacentTracks(RailLogic raillogic) -+ public static int getNAdjacentTracks(RailLogic raillogic) +- if (var6 == 0) ++ if (var6 == 0 && canMakeSlopes) + { + if (BlockRail.isRailBlockAt(this.worldObj, this.trackX, this.trackY + 1, this.trackZ - 1)) + { +@@ -271,7 +266,7 @@ + } + } + +- if (var6 == 1) ++ if (var6 == 1 && canMakeSlopes) + { + if (BlockRail.isRailBlockAt(this.worldObj, this.trackX + 1, this.trackY + 1, this.trackZ)) + { +@@ -422,7 +417,7 @@ + } + } + +- if (var7 == 0) ++ if (var7 == 0 && canMakeSlopes) + { + if (BlockRail.isRailBlockAt(this.worldObj, this.trackX, this.trackY + 1, this.trackZ - 1)) + { +@@ -435,7 +430,7 @@ + } + } + +- if (var7 == 1) ++ if (var7 == 1 && canMakeSlopes) + { + if (BlockRail.isRailBlockAt(this.worldObj, this.trackX + 1, this.trackY + 1, this.trackZ)) + { +@@ -485,7 +480,7 @@ + /** + * get number of adjacent tracks + */ +- static int getNAdjacentTracks(RailLogic par0RailLogic) ++ public static int getNAdjacentTracks(RailLogic par0RailLogic) { - return raillogic.getAdjacentTracks(); + return par0RailLogic.getAdjacentTracks(); } diff --git a/forge/patches/minecraft/net/minecraft/src/RenderBlocks.java.patch b/forge/patches/minecraft/net/minecraft/src/RenderBlocks.java.patch index 9ac9c45c5..e3a178e95 100644 --- a/forge/patches/minecraft/net/minecraft/src/RenderBlocks.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/RenderBlocks.java.patch @@ -1,128 +1,128 @@ --- ../src_base/minecraft/net/minecraft/src/RenderBlocks.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/RenderBlocks.java 0000-00-00 00:00:00.000000000 -0000 -@@ -1323,7 +1323,7 @@ - double d2 = (float)j1 / 256F; - double d3 = ((float)j1 + 15.99F) / 256F; - float f = 1.4F; -- if (!blockAccess.isBlockNormalCube(i, j - 1, k) && !Block.fire.canBlockCatchFire(blockAccess, i, j - 1, k)) -+ if (!blockAccess.isBlockNormalCube(i, j - 1, k) && !Block.fire.canBlockCatchFire(blockAccess, i, j - 1, k, 1)) +@@ -1375,7 +1375,7 @@ + double var28; + double var30; + +- if (!this.blockAccess.isBlockNormalCube(par2, par3 - 1, par4) && !Block.fire.canBlockCatchFire(this.blockAccess, par2, par3 - 1, par4)) ++ if (!this.blockAccess.isBlockNormalCube(par2, par3 - 1, par4) && !Block.fire.canBlockCatchFire(this.blockAccess, par2, par3 - 1, par4, 1)) { - float f1 = 0.2F; - float f2 = 0.0625F; -@@ -1340,7 +1340,7 @@ - d1 = d; - d = d4; + float var36 = 0.2F; + float var33 = 0.0625F; +@@ -1395,7 +1395,7 @@ + var9 = var18; } -- if (Block.fire.canBlockCatchFire(blockAccess, i - 1, j, k)) -+ if (Block.fire.canBlockCatchFire(blockAccess, i - 1, j, k, 5)) + +- if (Block.fire.canBlockCatchFire(this.blockAccess, par2 - 1, par3, par4)) ++ if (Block.fire.canBlockCatchFire(this.blockAccess, par2 - 1, par3, par4, 5)) { - tessellator.addVertexWithUV((float)i + f1, (float)j + f + f2, k + 1, d1, d2); - tessellator.addVertexWithUV(i + 0, (float)(j + 0) + f2, k + 1, d1, d3); -@@ -1351,7 +1351,7 @@ - tessellator.addVertexWithUV(i + 0, (float)(j + 0) + f2, k + 1, d1, d3); - tessellator.addVertexWithUV((float)i + f1, (float)j + f + f2, k + 1, d1, d2); + var5.addVertexWithUV((double)((float)par2 + var36), (double)((float)par3 + var17 + var33), (double)(par4 + 1), var11, var13); + var5.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 0) + var33), (double)(par4 + 1), var11, var15); +@@ -1407,7 +1407,7 @@ + var5.addVertexWithUV((double)((float)par2 + var36), (double)((float)par3 + var17 + var33), (double)(par4 + 1), var11, var13); } -- if (Block.fire.canBlockCatchFire(blockAccess, i + 1, j, k)) -+ if (Block.fire.canBlockCatchFire(blockAccess, i + 1, j, k, 4)) + +- if (Block.fire.canBlockCatchFire(this.blockAccess, par2 + 1, par3, par4)) ++ if (Block.fire.canBlockCatchFire(this.blockAccess, par2 + 1, par3, par4, 4)) { - tessellator.addVertexWithUV((float)(i + 1) - f1, (float)j + f + f2, k + 0, d, d2); - tessellator.addVertexWithUV((i + 1) - 0, (float)(j + 0) + f2, k + 0, d, d3); -@@ -1362,7 +1362,7 @@ - tessellator.addVertexWithUV((i + 1) - 0, (float)(j + 0) + f2, k + 0, d, d3); - tessellator.addVertexWithUV((float)(i + 1) - f1, (float)j + f + f2, k + 0, d, d2); + var5.addVertexWithUV((double)((float)(par2 + 1) - var36), (double)((float)par3 + var17 + var33), (double)(par4 + 0), var9, var13); + var5.addVertexWithUV((double)(par2 + 1 - 0), (double)((float)(par3 + 0) + var33), (double)(par4 + 0), var9, var15); +@@ -1419,7 +1419,7 @@ + var5.addVertexWithUV((double)((float)(par2 + 1) - var36), (double)((float)par3 + var17 + var33), (double)(par4 + 0), var9, var13); } -- if (Block.fire.canBlockCatchFire(blockAccess, i, j, k - 1)) -+ if (Block.fire.canBlockCatchFire(blockAccess, i, j, k - 1, 3)) + +- if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3, par4 - 1)) ++ if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3, par4 - 1, 3)) { - tessellator.addVertexWithUV(i + 0, (float)j + f + f2, (float)k + f1, d1, d2); - tessellator.addVertexWithUV(i + 0, (float)(j + 0) + f2, k + 0, d1, d3); -@@ -1373,7 +1373,7 @@ - tessellator.addVertexWithUV(i + 0, (float)(j + 0) + f2, k + 0, d1, d3); - tessellator.addVertexWithUV(i + 0, (float)j + f + f2, (float)k + f1, d1, d2); + var5.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + var17 + var33), (double)((float)par4 + var36), var11, var13); + var5.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 0) + var33), (double)(par4 + 0), var11, var15); +@@ -1431,7 +1431,7 @@ + var5.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + var17 + var33), (double)((float)par4 + var36), var11, var13); } -- if (Block.fire.canBlockCatchFire(blockAccess, i, j, k + 1)) -+ if (Block.fire.canBlockCatchFire(blockAccess, i, j, k + 1, 2)) + +- if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3, par4 + 1)) ++ if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3, par4 + 1, 2)) { - tessellator.addVertexWithUV(i + 1, (float)j + f + f2, (float)(k + 1) - f1, d, d2); - tessellator.addVertexWithUV(i + 1, (float)(j + 0) + f2, (k + 1) - 0, d, d3); -@@ -1384,7 +1384,7 @@ - tessellator.addVertexWithUV(i + 1, (float)(j + 0) + f2, (k + 1) - 0, d, d3); - tessellator.addVertexWithUV(i + 1, (float)j + f + f2, (float)(k + 1) - f1, d, d2); + var5.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + var17 + var33), (double)((float)(par4 + 1) - var36), var9, var13); + var5.addVertexWithUV((double)(par2 + 1), (double)((float)(par3 + 0) + var33), (double)(par4 + 1 - 0), var9, var15); +@@ -1443,7 +1443,7 @@ + var5.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + var17 + var33), (double)((float)(par4 + 1) - var36), var9, var13); } -- if (Block.fire.canBlockCatchFire(blockAccess, i, j + 1, k)) -+ if (Block.fire.canBlockCatchFire(blockAccess, i, j + 1, k, 0)) + +- if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3 + 1, par4)) ++ if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3 + 1, par4, 0)) { - double d5 = (double)i + 0.5D + 0.5D; - double d7 = ((double)i + 0.5D) - 0.5D; -@@ -3324,7 +3324,7 @@ - colorBlueTopRight *= f27; - int k2 = block.getBlockTexture(blockAccess, i, j, k, 2); - renderEastFace(block, i, j, k, k2); -- if (cfgGrassFix && k2 == 3 && overrideBlockTexture < 0) -+ if (Tessellator.instance.defaultTexture && cfgGrassFix && k2 == 3 && overrideBlockTexture < 0) + var18 = (double)par2 + 0.5D + 0.5D; + var20 = (double)par2 + 0.5D - 0.5D; +@@ -3601,7 +3601,7 @@ + var27 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 2); + this.renderEastFace(par1Block, (double)par2, (double)par3, (double)par4, var27); + +- if (cfgGrassFix && var27 == 3 && this.overrideBlockTexture < 0) ++ if (Tessellator.instance.defaultTexture && cfgGrassFix && var27 == 3 && this.overrideBlockTexture < 0) { - colorRedTopLeft *= f; - colorRedBottomLeft *= f; -@@ -3440,7 +3440,7 @@ - colorBlueTopRight *= f28; - int l2 = block.getBlockTexture(blockAccess, i, j, k, 3); - renderWestFace(block, i, j, k, block.getBlockTexture(blockAccess, i, j, k, 3)); -- if (cfgGrassFix && l2 == 3 && overrideBlockTexture < 0) -+ if (Tessellator.instance.defaultTexture && cfgGrassFix && l2 == 3 && overrideBlockTexture < 0) + this.colorRedTopLeft *= par5; + this.colorRedBottomLeft *= par5; +@@ -3724,7 +3724,7 @@ + var27 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 3); + this.renderWestFace(par1Block, (double)par2, (double)par3, (double)par4, par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 3)); + +- if (cfgGrassFix && var27 == 3 && this.overrideBlockTexture < 0) ++ if (Tessellator.instance.defaultTexture && cfgGrassFix && var27 == 3 && this.overrideBlockTexture < 0) { - colorRedTopLeft *= f; - colorRedBottomLeft *= f; -@@ -3556,7 +3556,7 @@ - colorBlueTopRight *= f29; - int i3 = block.getBlockTexture(blockAccess, i, j, k, 4); - renderNorthFace(block, i, j, k, i3); -- if (cfgGrassFix && i3 == 3 && overrideBlockTexture < 0) -+ if (Tessellator.instance.defaultTexture && cfgGrassFix && i3 == 3 && overrideBlockTexture < 0) + this.colorRedTopLeft *= par5; + this.colorRedBottomLeft *= par5; +@@ -3847,7 +3847,7 @@ + var27 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 4); + this.renderNorthFace(par1Block, (double)par2, (double)par3, (double)par4, var27); + +- if (cfgGrassFix && var27 == 3 && this.overrideBlockTexture < 0) ++ if (Tessellator.instance.defaultTexture && cfgGrassFix && var27 == 3 && this.overrideBlockTexture < 0) { - colorRedTopLeft *= f; - colorRedBottomLeft *= f; -@@ -3672,7 +3672,7 @@ - colorBlueTopRight *= f30; - int j3 = block.getBlockTexture(blockAccess, i, j, k, 5); - renderSouthFace(block, i, j, k, j3); -- if (cfgGrassFix && j3 == 3 && overrideBlockTexture < 0) -+ if (Tessellator.instance.defaultTexture && cfgGrassFix && j3 == 3 && overrideBlockTexture < 0) + this.colorRedTopLeft *= par5; + this.colorRedBottomLeft *= par5; +@@ -3970,7 +3970,7 @@ + var27 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 5); + this.renderSouthFace(par1Block, (double)par2, (double)par3, (double)par4, var27); + +- if (cfgGrassFix && var27 == 3 && this.overrideBlockTexture < 0) ++ if (Tessellator.instance.defaultTexture && cfgGrassFix && var27 == 3 && this.overrideBlockTexture < 0) { - colorRedTopLeft *= f; - colorRedBottomLeft *= f; -@@ -3765,7 +3765,7 @@ - tessellator.setColorOpaque_F(f11, f14, f17); - int i1 = block.getBlockTexture(blockAccess, i, j, k, 2); - renderEastFace(block, i, j, k, i1); -- if (cfgGrassFix && i1 == 3 && overrideBlockTexture < 0) -+ if (Tessellator.instance.defaultTexture && cfgGrassFix && i1 == 3 && overrideBlockTexture < 0) + this.colorRedTopLeft *= par5; + this.colorRedBottomLeft *= par5; +@@ -4082,7 +4082,7 @@ + var27 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 2); + this.renderEastFace(par1Block, (double)par2, (double)par3, (double)par4, var27); + +- if (cfgGrassFix && var27 == 3 && this.overrideBlockTexture < 0) ++ if (Tessellator.instance.defaultTexture && cfgGrassFix && var27 == 3 && this.overrideBlockTexture < 0) { - tessellator.setColorOpaque_F(f11 * f, f14 * f1, f17 * f2); - renderEastFace(block, i, j, k, 38); -@@ -3778,7 +3778,7 @@ - tessellator.setColorOpaque_F(f11, f14, f17); - int j1 = block.getBlockTexture(blockAccess, i, j, k, 3); - renderWestFace(block, i, j, k, j1); -- if (cfgGrassFix && j1 == 3 && overrideBlockTexture < 0) -+ if (Tessellator.instance.defaultTexture && cfgGrassFix && j1 == 3 && overrideBlockTexture < 0) + var8.setColorOpaque_F(var18 * par5, var21 * par6, var24 * par7); + this.renderEastFace(par1Block, (double)par2, (double)par3, (double)par4, 38); +@@ -4098,7 +4098,7 @@ + var27 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 3); + this.renderWestFace(par1Block, (double)par2, (double)par3, (double)par4, var27); + +- if (cfgGrassFix && var27 == 3 && this.overrideBlockTexture < 0) ++ if (Tessellator.instance.defaultTexture && cfgGrassFix && var27 == 3 && this.overrideBlockTexture < 0) { - tessellator.setColorOpaque_F(f11 * f, f14 * f1, f17 * f2); - renderWestFace(block, i, j, k, 38); -@@ -3791,7 +3791,7 @@ - tessellator.setColorOpaque_F(f12, f15, f18); - int k1 = block.getBlockTexture(blockAccess, i, j, k, 4); - renderNorthFace(block, i, j, k, k1); -- if (cfgGrassFix && k1 == 3 && overrideBlockTexture < 0) -+ if (Tessellator.instance.defaultTexture && cfgGrassFix && k1 == 3 && overrideBlockTexture < 0) + var8.setColorOpaque_F(var18 * par5, var21 * par6, var24 * par7); + this.renderWestFace(par1Block, (double)par2, (double)par3, (double)par4, 38); +@@ -4114,7 +4114,7 @@ + var27 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 4); + this.renderNorthFace(par1Block, (double)par2, (double)par3, (double)par4, var27); + +- if (cfgGrassFix && var27 == 3 && this.overrideBlockTexture < 0) ++ if (Tessellator.instance.defaultTexture && cfgGrassFix && var27 == 3 && this.overrideBlockTexture < 0) { - tessellator.setColorOpaque_F(f12 * f, f15 * f1, f18 * f2); - renderNorthFace(block, i, j, k, 38); -@@ -3804,7 +3804,7 @@ - tessellator.setColorOpaque_F(f12, f15, f18); - int l1 = block.getBlockTexture(blockAccess, i, j, k, 5); - renderSouthFace(block, i, j, k, l1); -- if (cfgGrassFix && l1 == 3 && overrideBlockTexture < 0) -+ if (Tessellator.instance.defaultTexture && cfgGrassFix && l1 == 3 && overrideBlockTexture < 0) + var8.setColorOpaque_F(var19 * par5, var22 * par6, var25 * par7); + this.renderNorthFace(par1Block, (double)par2, (double)par3, (double)par4, 38); +@@ -4130,7 +4130,7 @@ + var27 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 5); + this.renderSouthFace(par1Block, (double)par2, (double)par3, (double)par4, var27); + +- if (cfgGrassFix && var27 == 3 && this.overrideBlockTexture < 0) ++ if (Tessellator.instance.defaultTexture && cfgGrassFix && var27 == 3 && this.overrideBlockTexture < 0) { - tessellator.setColorOpaque_F(f12 * f, f15 * f1, f18 * f2); - renderSouthFace(block, i, j, k, 38); + var8.setColorOpaque_F(var19 * par5, var22 * par6, var25 * par7); + this.renderSouthFace(par1Block, (double)par2, (double)par3, (double)par4, 38); diff --git a/forge/patches/minecraft/net/minecraft/src/RenderEngine.java.patch b/forge/patches/minecraft/net/minecraft/src/RenderEngine.java.patch index 127272e4b..f212f6964 100644 --- a/forge/patches/minecraft/net/minecraft/src/RenderEngine.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/RenderEngine.java.patch @@ -1,22 +1,22 @@ --- ../src_base/minecraft/net/minecraft/src/RenderEngine.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/RenderEngine.java 0000-00-00 00:00:00.000000000 -0000 -@@ -30,7 +30,7 @@ - private GameSettings options; - public boolean clampTexture; - public boolean blurTexture; +@@ -48,7 +48,7 @@ + public boolean blurTexture = false; + + /** Texture pack */ - private TexturePackList texturePack; + public TexturePackList texturePack; - private BufferedImage missingTextureImage; - public RenderEngine(TexturePackList texturepacklist, GameSettings gamesettings) -@@ -135,6 +135,10 @@ - } - try + /** Missing texture image */ + private BufferedImage missingTextureImage = new BufferedImage(64, 64, 2); +@@ -156,6 +156,10 @@ { -+ if(Tessellator.renderingWorldRenderer) -+ { -+ System.out.printf("Warning: Texture %s not preloaded, will cause render glitches!\n", s); -+ } - singleIntBuffer.clear(); - GLAllocation.generateTextureNames(singleIntBuffer); - int i = singleIntBuffer.get(0); + try + { ++ if (Tessellator.renderingWorldRenderer) ++ { ++ System.out.printf("Warning: Texture %s not preloaded, will cause render glitches!\n", par1Str); ++ } + this.singleIntBuffer.clear(); + GLAllocation.generateTextureNames(this.singleIntBuffer); + int var6 = this.singleIntBuffer.get(0); diff --git a/forge/patches/minecraft/net/minecraft/src/RenderGlobal.java.patch b/forge/patches/minecraft/net/minecraft/src/RenderGlobal.java.patch index b1ce951b3..bd173d972 100644 --- a/forge/patches/minecraft/net/minecraft/src/RenderGlobal.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/RenderGlobal.java.patch @@ -1,24 +1,28 @@ --- ../src_base/minecraft/net/minecraft/src/RenderGlobal.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/RenderGlobal.java 0000-00-00 00:00:00.000000000 -0000 -@@ -10,8 +10,8 @@ - implements IWorldAccess - { - public List tileEntities; +@@ -15,10 +15,10 @@ + public List tileEntities = new ArrayList(); + + /** A reference to the World object. */ - private World worldObj; -- private RenderEngine renderEngine; + public World worldObj; + + /** The RenderEngine instance used by RenderGlobal */ +- private RenderEngine renderEngine; + public RenderEngine renderEngine; - private List worldRenderersToUpdate; - private WorldRenderer sortedWorldRenderers[]; - private WorldRenderer worldRenderers[]; -@@ -19,8 +19,8 @@ - private int renderChunksTall; - private int renderChunksDeep; + private List worldRenderersToUpdate = new ArrayList(); + private WorldRenderer[] sortedWorldRenderers; + private WorldRenderer[] worldRenderers; +@@ -30,10 +30,10 @@ private int glRenderListBase; + + /** A reference to the Minecraft object. */ - private Minecraft mc; -- private RenderBlocks globalRenderBlocks; + public Minecraft mc; + + /** Global render blocks */ +- private RenderBlocks globalRenderBlocks; + public RenderBlocks globalRenderBlocks; + + /** OpenGL occlusion query base */ private IntBuffer glOcclusionQueryBase; - private boolean occlusionEnabled; - private int cloudOffsetX; diff --git a/forge/patches/minecraft/net/minecraft/src/RenderItem.java.patch b/forge/patches/minecraft/net/minecraft/src/RenderItem.java.patch index f6c0649b8..a71fe9e12 100644 --- a/forge/patches/minecraft/net/minecraft/src/RenderItem.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/RenderItem.java.patch @@ -10,133 +10,125 @@ +import net.minecraft.src.forge.MinecraftForgeClient; + import org.lwjgl.opengl.GL11; + import org.lwjgl.opengl.GL12; - public class RenderItem extends Render -@@ -43,10 +48,33 @@ - } - GL11.glTranslatef((float)d, (float)d1 + f2, (float)d2); - GL11.glEnable(32826 /*GL_RESCALE_NORMAL_EXT*/); -- if (itemstack.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType())) -+ ICustomItemRenderer customRenderer = MinecraftForgeClient.getCustomItemRenderer(itemstack.itemID); +@@ -54,11 +59,31 @@ + float var19; + float var18; + float var23; +- +- if (var10.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[var10.itemID].getRenderType())) + -+ if (customRenderer != null) ++ ICustomItemRenderer customRenderer = MinecraftForgeClient.getCustomItemRenderer(var10.itemID); ++ if (customRenderer != null) + { -+ GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F); -+ loadTexture(ForgeHooksClient.getTexture("/terrain.png", itemstack.getItem())); -+ float f4 = 0.25F; -+ f4 = 0.5F; -+ GL11.glScalef(f4, f4, f4); -+ for(int j = 0; j < byte0; j++) ++ GL11.glRotatef(var12, 0.0F, 1.0F, 0.0F); ++ loadTexture(ForgeHooksClient.getTexture("/terrain.png", var10.getItem())); ++ GL11.glScalef(0.5F, 0.5F, 0.5F); ++ for(int j = 0; j < var13; j++) + { + GL11.glPushMatrix(); -+ if(j > 0) ++ if (j > 0) + { -+ float f5 = ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / f4; -+ float f7 = ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / f4; -+ float f9 = ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / f4; -+ GL11.glTranslatef(f5, f7, f9); ++ GL11.glTranslatef( ++ ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / 0.5F, ++ ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / 0.5F, ++ ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / 0.5F); + } -+ ForgeHooksClient.renderCustomItem(customRenderer, renderBlocks, itemstack.itemID, itemstack.getItemDamage(), entityitem.getEntityBrightness(f1)); ++ ForgeHooksClient.renderCustomItem(customRenderer, renderBlocks, var10.itemID, var10.getItemDamage(), par1EntityItem.getEntityBrightness(par9)); + GL11.glPopMatrix(); + } -+ } -+ else if (itemstack.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType())) ++ } ++ else if (var10.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[var10.itemID].getRenderType())) { - GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F); -- loadTexture("/terrain.png"); -+ loadTexture(ForgeHooksClient.getTexture("/terrain.png", Block.blocksList[itemstack.itemID])); - float f4 = 0.25F; - int k = Block.blocksList[itemstack.itemID].getRenderType(); - if (k == 1 || k == 19 || k == 12 || k == 2) -@@ -72,7 +100,7 @@ - else if (itemstack.getItem().func_46058_c()) - { - GL11.glScalef(0.5F, 0.5F, 0.5F); -- loadTexture("/gui/items.png"); -+ loadTexture(ForgeHooksClient.getTexture("/gui/items.png", Item.itemsList[itemstack.itemID])); - for (int i = 0; i <= 1; i++) - { - int l = itemstack.getItem().func_46057_a(itemstack.getItemDamage(), i); -@@ -94,11 +122,11 @@ - int j = itemstack.getIconIndex(); - if (itemstack.itemID < 256) - { -- loadTexture("/terrain.png"); -+ loadTexture(ForgeHooksClient.getTexture("/terrain.png", Block.blocksList[itemstack.itemID])); - } - else - { -- loadTexture("/gui/items.png"); -+ loadTexture(ForgeHooksClient.getTexture("/gui/items.png", Item.itemsList[itemstack.itemID])); - } - if (field_27004_a) - { -@@ -149,10 +177,39 @@ + GL11.glRotatef(var12, 0.0F, 1.0F, 0.0F); +- this.loadTexture("/terrain.png"); ++ this.loadTexture(ForgeHooksClient.getTexture("/terrain.png", Block.blocksList[var10.itemID])); + float var21 = 0.25F; + var15 = Block.blocksList[var10.itemID].getRenderType(); - public void drawItemIntoGui(FontRenderer fontrenderer, RenderEngine renderengine, int i, int j, int k, int l, int i1) - { -- if (i < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[i].getRenderType())) -+ ICustomItemRenderer customRenderer = MinecraftForgeClient.getCustomItemRenderer(i); -+ if (customRenderer != null) -+ { -+ int j1 = i; -+ String tex = ForgeHooksClient.getTexture("/terrain.png", Item.itemsList[i]); -+ renderengine.bindTexture(renderengine.getTexture(tex)); -+ Item item = Item.itemsList[i]; -+ GL11.glPushMatrix(); -+ GL11.glTranslatef(l - 2, i1 + 3, -3F + zLevel); -+ GL11.glScalef(10F, 10F, 10F); -+ GL11.glTranslatef(1.0F, 0.5F, 1.0F); -+ GL11.glScalef(1.0F, 1.0F, -1F); -+ GL11.glRotatef(210F, 1.0F, 0.0F, 0.0F); -+ GL11.glRotatef(45F, 0.0F, 1.0F, 0.0F); -+ int l1 = Item.itemsList[i].getColorFromDamage(j, 0); -+ float f2 = (float)(l1 >> 16 & 0xff) / 255F; -+ float f4 = (float)(l1 >> 8 & 0xff) / 255F; -+ float f5 = (float)(l1 & 0xff) / 255F; -+ if(field_27004_a) -+ { -+ GL11.glColor4f(f2, f4, f5, 1.0F); -+ } -+ GL11.glRotatef(-90F, 0.0F, 1.0F, 0.0F); -+ renderBlocks.useInventoryTint = field_27004_a; -+ ForgeHooksClient.renderCustomItem(customRenderer, renderBlocks, i, j, 1.0F); -+ renderBlocks.useInventoryTint = true; -+ GL11.glPopMatrix(); -+ } -+ else if(i < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[i].getRenderType())) +@@ -94,7 +119,7 @@ + if (var10.getItem().func_46058_c()) + { + GL11.glScalef(0.5F, 0.5F, 0.5F); +- this.loadTexture("/gui/items.png"); ++ this.loadTexture(ForgeHooksClient.getTexture("/gui/items.png", Item.itemsList[var10.itemID])); + + for (var14 = 0; var14 <= 1; ++var14) + { +@@ -120,11 +145,11 @@ + + if (var10.itemID < 256) + { +- this.loadTexture("/terrain.png"); ++ this.loadTexture(ForgeHooksClient.getTexture("/terrain.png", Block.blocksList[var10.itemID])); + } + else + { +- this.loadTexture("/gui/items.png"); ++ this.loadTexture(ForgeHooksClient.getTexture("/gui/items.png", Item.itemsList[var10.itemID])); + } + + if (this.field_27004_a) +@@ -186,10 +211,35 @@ + float var11; + float var12; + float var13; +- +- if (par3 < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[par3].getRenderType())) ++ ++ ICustomItemRenderer customRenderer = MinecraftForgeClient.getCustomItemRenderer(par3); ++ if (customRenderer != null) ++ { ++ par2RenderEngine.bindTexture(par2RenderEngine.getTexture(ForgeHooksClient.getTexture("/terrain.png", Item.itemsList[par3]))); ++ GL11.glPushMatrix(); ++ GL11.glTranslatef(par4 - 2, par7 + 3, -3F + zLevel); ++ GL11.glScalef(10F, 10F, 10F); ++ GL11.glTranslatef(1.0F, 0.5F, 1.0F); ++ GL11.glScalef(1.0F, 1.0F, -1F); ++ GL11.glRotatef(210F, 1.0F, 0.0F, 0.0F); ++ GL11.glRotatef(45F, 0.0F, 1.0F, 0.0F); ++ int l1 = Item.itemsList[par3].getColorFromDamage(par4, 0); ++ float f2 = (float)(l1 >> 16 & 0xff) / 255F; ++ float f4 = (float)(l1 >> 8 & 0xff) / 255F; ++ float f5 = (float)(l1 & 0xff) / 255F; ++ if(field_27004_a) ++ { ++ GL11.glColor4f(f2, f4, f5, 1.0F); ++ } ++ GL11.glRotatef(-90F, 0.0F, 1.0F, 0.0F); ++ renderBlocks.useInventoryTint = field_27004_a; ++ ForgeHooksClient.renderCustomItem(customRenderer, renderBlocks, par3, par4, 1.0F); ++ renderBlocks.useInventoryTint = true; ++ GL11.glPopMatrix(); ++ } ++ else if (par3 < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[par3].getRenderType())) { - int j1 = i; -- renderengine.bindTexture(renderengine.getTexture("/terrain.png")); -+ String tex = ForgeHooksClient.getTexture("/terrain.png", Block.blocksList[i]); -+ renderengine.bindTexture(renderengine.getTexture(tex)); - Block block = Block.blocksList[j1]; +- par2RenderEngine.bindTexture(par2RenderEngine.getTexture("/terrain.png")); ++ par2RenderEngine.bindTexture(par2RenderEngine.getTexture(ForgeHooksClient.getTexture("/terrain.png", Block.blocksList[par3]))); + Block var15 = Block.blocksList[par3]; GL11.glPushMatrix(); - GL11.glTranslatef(l - 2, i1 + 3, -3F + zLevel); -@@ -178,7 +235,8 @@ - else if (Item.itemsList[i].func_46058_c()) - { - GL11.glDisable(2896 /*GL_LIGHTING*/); -- renderengine.bindTexture(renderengine.getTexture("/gui/items.png")); -+ String tex = ForgeHooksClient.getTexture("/gui/items.png", Item.itemsList[i]); -+ renderengine.bindTexture(renderengine.getTexture(tex)); - for (int k1 = 0; k1 <= 1; k1++) + GL11.glTranslatef((float)(par6 - 2), (float)(par7 + 3), -3.0F + this.zLevel); +@@ -221,7 +271,7 @@ + if (Item.itemsList[par3].func_46058_c()) { - int i2 = Item.itemsList[i].func_46057_a(j, k1); -@@ -200,11 +258,13 @@ - GL11.glDisable(2896 /*GL_LIGHTING*/); - if (i < 256) - { -- renderengine.bindTexture(renderengine.getTexture("/terrain.png")); -- } -+ String tex = ForgeHooksClient.getTexture("/terrain.png", Block.blocksList[i]); -+ renderengine.bindTexture(renderengine.getTexture(tex)); -+ } - else - { -- renderengine.bindTexture(renderengine.getTexture("/gui/items.png")); -+ String tex = ForgeHooksClient.getTexture("/gui/items.png", Item.itemsList[i]); -+ renderengine.bindTexture(renderengine.getTexture(tex)); - } - int l1 = Item.itemsList[i].getColorFromDamage(j, 0); - float f = (float)(l1 >> 16 & 0xff) / 255F; + GL11.glDisable(GL11.GL_LIGHTING); +- par2RenderEngine.bindTexture(par2RenderEngine.getTexture("/gui/items.png")); ++ par2RenderEngine.bindTexture(par2RenderEngine.getTexture(ForgeHooksClient.getTexture("/gui/items.png", Item.itemsList[par3]))); + + for (var8 = 0; var8 <= 1; ++var8) + { +@@ -247,11 +297,11 @@ + + if (par3 < 256) + { +- par2RenderEngine.bindTexture(par2RenderEngine.getTexture("/terrain.png")); ++ par2RenderEngine.bindTexture(par2RenderEngine.getTexture(ForgeHooksClient.getTexture("/terrain.png", Block.blocksList[par3]))); + } + else + { +- par2RenderEngine.bindTexture(par2RenderEngine.getTexture("/gui/items.png")); ++ par2RenderEngine.bindTexture(par2RenderEngine.getTexture(ForgeHooksClient.getTexture("/gui/items.png", Item.itemsList[par3]))); + } + + var8 = Item.itemsList[par3].getColorFromDamage(par4, 0); diff --git a/forge/patches/minecraft/net/minecraft/src/RenderPlayer.java.patch b/forge/patches/minecraft/net/minecraft/src/RenderPlayer.java.patch index fb318670f..718b717cf 100644 --- a/forge/patches/minecraft/net/minecraft/src/RenderPlayer.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/RenderPlayer.java.patch @@ -8,19 +8,19 @@ public class RenderPlayer extends RenderLiving { -@@ -30,7 +31,14 @@ - if (item instanceof ItemArmor) +@@ -32,7 +33,14 @@ + if (var5 instanceof ItemArmor) { - ItemArmor itemarmor = (ItemArmor)item; -- loadTexture((new StringBuilder()).append("/armor/").append(armorFilenamePrefix[itemarmor.renderIndex]).append("_").append(i != 2 ? 1 : 2).append(".png").toString()); -+ if (item instanceof IArmorTextureProvider) + ItemArmor var6 = (ItemArmor)var5; +- this.loadTexture("/armor/" + armorFilenamePrefix[var6.renderIndex] + "_" + (par2 == 2 ? 2 : 1) + ".png"); ++ if (var5 instanceof IArmorTextureProvider) + { -+ loadTexture( ((IArmorTextureProvider)item).getArmorTextureFile(itemstack) ); ++ loadTexture(((IArmorTextureProvider)var5).getArmorTextureFile(var4)); + } + else + { -+ loadTexture((new StringBuilder()).append("/armor/").append(armorFilenamePrefix[itemarmor.renderIndex]).append("_").append(i != 2 ? 1 : 2).append(".png").toString()); -+ } - ModelBiped modelbiped = i != 2 ? modelArmorChestplate : modelArmor; - modelbiped.bipedHead.showModel = i == 0; - modelbiped.bipedHeadwear.showModel = i == 0; ++ this.loadTexture("/armor/" + armorFilenamePrefix[var6.renderIndex] + "_" + (par2 == 2 ? 2 : 1) + ".png"); ++ } + ModelBiped var7 = par2 == 2 ? this.modelArmor : this.modelArmorChestplate; + var7.bipedHead.showModel = par2 == 0; + var7.bipedHeadwear.showModel = par2 == 0; diff --git a/forge/patches/minecraft/net/minecraft/src/SlotCrafting.java.patch b/forge/patches/minecraft/net/minecraft/src/SlotCrafting.java.patch index 4753d421e..519c1562d 100644 --- a/forge/patches/minecraft/net/minecraft/src/SlotCrafting.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/SlotCrafting.java.patch @@ -7,12 +7,12 @@ + public class SlotCrafting extends Slot { - private final IInventory craftMatrix; -@@ -61,6 +63,7 @@ - thePlayer.addStat(AchievementList.bookcase, 1); + /** The craft matrix inventory linked to this result slot. */ +@@ -91,6 +93,7 @@ } - ModLoader.TakenFromCrafting(thePlayer, itemstack, craftMatrix); -+ ForgeHooks.onTakenFromCrafting(thePlayer, itemstack, craftMatrix); - for (int i = 0; i < craftMatrix.getSizeInventory(); i++) - { - ItemStack itemstack1 = craftMatrix.getStackInSlot(i); + + ModLoader.takenFromCrafting(this.thePlayer, par1ItemStack, this.craftMatrix); ++ ForgeHooks.onTakenFromCrafting(thePlayer, par1ItemStack, craftMatrix); + } + + /** diff --git a/forge/patches/minecraft/net/minecraft/src/SpawnerAnimals.java.patch b/forge/patches/minecraft/net/minecraft/src/SpawnerAnimals.java.patch new file mode 100644 index 000000000..0411fde28 --- /dev/null +++ b/forge/patches/minecraft/net/minecraft/src/SpawnerAnimals.java.patch @@ -0,0 +1,12 @@ +--- ../src_base/minecraft/net/minecraft/src/SpawnerAnimals.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft/net/minecraft/src/SpawnerAnimals.java 0000-00-00 00:00:00.000000000 -0000 +@@ -202,7 +202,8 @@ + else + { + int var5 = par1World.getBlockId(par2, par3 - 1, par4); +- return Block.func_48206_g(var5) && var5 != Block.bedrock.blockID && !par1World.isBlockNormalCube(par2, par3, par4) && !par1World.getBlockMaterial(par2, par3, par4).isLiquid() && !par1World.isBlockNormalCube(par2, par3 + 1, par4); ++ //Fix for 1.2.3 change.. Why guys.. why? ++ return par1World.isBlockNormalCube(par2, par3, par4) && var5 != Block.bedrock.blockID && !par1World.isBlockNormalCube(par2, par3, par4) && !par1World.getBlockMaterial(par2, par3, par4).isLiquid() && !par1World.isBlockNormalCube(par2, par3 + 1, par4); + } + } + diff --git a/forge/patches/minecraft/net/minecraft/src/Tessellator.java.patch b/forge/patches/minecraft/net/minecraft/src/Tessellator.java.patch index 844f18616..a6f448093 100644 --- a/forge/patches/minecraft/net/minecraft/src/Tessellator.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/Tessellator.java.patch @@ -1,192 +1,218 @@ --- ../src_base/minecraft/net/minecraft/src/Tessellator.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/Tessellator.java 0000-00-00 00:00:00.000000000 -0000 -@@ -1,16 +1,14 @@ - package net.minecraft.src; - - import java.nio.*; -+import java.util.*; - import org.lwjgl.opengl.*; +@@ -5,12 +5,19 @@ + 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; public class Tessellator { - private static boolean convertQuadsToTriangles = false; ++ private static int nativeBufferSize = 0x200000; ++ private static int trivertsInBuffer = (nativeBufferSize / 48) * 6; ++ public static boolean renderingWorldRenderer = false; ++ public boolean defaultTexture = true; ++ private int rawBufferSize = 0; + /** + * Boolean used to check whether quads should be drawn as four triangles. Initialized to true and never changed. + */ +@@ -22,16 +29,16 @@ private static boolean tryVBO = false; + + /** The byte buffer used for GL allocation. */ - private ByteBuffer byteBuffer; ++ 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 boolean useVBO = false; - private int rawBuffer[]; - private int vertexCount; - private double textureU; -@@ -24,21 +22,47 @@ - private int rawBufferIndex; - private int addedVertices; - private boolean isColorDisabled; ++ private static ShortBuffer shortBuffer = byteBuffer.asShortBuffer(); + + /** Raw integer array. */ + private int[] rawBuffer; +@@ -80,37 +87,37 @@ + private boolean isColorDisabled = false; + + /** The draw mode currently being used by the tessellator. */ - private int drawMode; -- private double xOffset; -- private double yOffset; -- private double zOffset; + public int drawMode; + + /** + * An offset to be applied along the x-axis for all vertices in this draw call. + */ +- private double xOffset; + public double xOffset; + + /** + * An offset to be applied along the y-axis for all vertices in this draw call. + */ +- private double yOffset; + public double yOffset; + + /** + * An offset to be applied along the z-axis for all vertices in this draw call. + */ +- private double zOffset; + public double zOffset; + + /** The normal to be applied to the face being drawn. */ private int normal; -- public static final Tessellator instance = new Tessellator(0x200000); -- private boolean isDrawing; -- private boolean useVBO; + + /** The static instance of the Tessellator. */ +- public static final Tessellator instance = new Tessellator(2097152); ++ public static Tessellator instance = new Tessellator(); + + /** Whether this tessellator is currently in draw mode. */ +- private boolean isDrawing = false; ++ public boolean isDrawing = false; + + /** Whether we are currently using VBO or not. */ +- private boolean useVBO = false; ++ private static boolean useVBO = false; + + /** An IntBuffer used to store the indices of vertex buffer objects. */ - private IntBuffer vertexBuffers; -+ public boolean isDrawing; - private int vboIndex; -- private int vboCount; -- private int bufferSize; -+ -+ public static boolean renderingWorldRenderer=false; -+ public boolean defaultTexture=false; -+ private int rawBufferSize; -+ private static int vboCount; + private static IntBuffer vertexBuffers; -+ private static int nativeBufferSize; -+ private static int trivertsInBuffer; -+ private static ByteBuffer byteBuffer; -+ private static IntBuffer intBuffer; -+ private static FloatBuffer floatBuffer; -+ private static ShortBuffer shortBuffer; -+ public static Tessellator instance; -+ -+ static { -+ instance = new Tessellator(); -+ instance.defaultTexture = true; -+ -+ nativeBufferSize = 0x200000; -+ trivertsInBuffer = (nativeBufferSize / 48) * 6; -+ byteBuffer = GLAllocation.createDirectByteBuffer(nativeBufferSize * 4); -+ intBuffer = byteBuffer.asIntBuffer(); -+ floatBuffer = byteBuffer.asFloatBuffer(); -+ shortBuffer = byteBuffer.asShortBuffer(); + + /** + * The index of the last VBO used. This is used in round-robin fashion, sequentially, through the vboCount vertex +@@ -119,27 +126,23 @@ + private int vboIndex = 0; + + /** Number of vertex buffer objects allocated for use. */ +- private int vboCount = 10; +- +- /** The size of the buffers used (in integers). */ +- private int bufferSize; ++ private static int vboCount = 10; + +- private Tessellator(int par1) ++ static + { +- 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.rawBuffer = new int[par1]; +- this.useVBO = tryVBO && GLContext.getCapabilities().GL_ARB_vertex_buffer_object; +- +- if (this.useVBO) + useVBO = tryVBO && GLContext.getCapabilities().GL_ARB_vertex_buffer_object; -+ vboCount = 10; -+ if(useVBO) -+ { ++ if (useVBO) + { +- this.vertexBuffers = GLAllocation.createDirectIntBuffer(this.vboCount); +- ARBVertexBufferObject.glGenBuffersARB(this.vertexBuffers); + vertexBuffers = GLAllocation.createDirectIntBuffer(vboCount); + ARBVertexBufferObject.glGenBuffersARB(vertexBuffers); -+ } + } + } ++ ++ public Tessellator() ++ { ++ this.rawBuffer = null; ++ defaultTexture = false; + } -- private Tessellator(int i) -- { -+ public Tessellator() { - vertexCount = 0; - hasColor = false; - hasTexture = false; -@@ -48,21 +72,9 @@ - addedVertices = 0; - isColorDisabled = false; - isDrawing = false; -- useVBO = false; - vboIndex = 0; -- vboCount = 10; -- bufferSize = i; -- byteBuffer = GLAllocation.createDirectByteBuffer(i * 4); -- intBuffer = byteBuffer.asIntBuffer(); -- floatBuffer = byteBuffer.asFloatBuffer(); -- shortBuffer = byteBuffer.asShortBuffer(); -- rawBuffer = new int[i]; -- useVBO = tryVBO && GLContext.getCapabilities().GL_ARB_vertex_buffer_object; -- if (useVBO) -- { -- vertexBuffers = GLAllocation.createDirectIntBuffer(vboCount); -- ARBVertexBufferObject.glGenBuffersARB(vertexBuffers); -- } -+ rawBuffer = null; -+ rawBufferSize = 0; - } - - public int draw() -@@ -72,12 +84,25 @@ - throw new IllegalStateException("Not tesselating!"); - } - isDrawing = false; -- if (vertexCount > 0) -+ int offs = 0; -+ while (offs < vertexCount) + /** + * Draws the data set up in this tessellator and resets the state to prepare for new drawing. +@@ -154,12 +157,23 @@ { -+ int vtc; -+ if (drawMode == 7 && convertQuadsToTriangles) -+ { -+ vtc = Math.min(vertexCount - offs, trivertsInBuffer); -+ } -+ else -+ { -+ vtc = Math.min(vertexCount - offs, nativeBufferSize >> 5); -+ } -+ - intBuffer.clear(); -- intBuffer.put(rawBuffer, 0, rawBufferIndex); -+ intBuffer.put(rawBuffer, offs * 8, vtc * 8); - byteBuffer.position(0); -- byteBuffer.limit(rawBufferIndex * 4); -+ byteBuffer.limit(vtc * 32); -+ offs += vtc; + this.isDrawing = false; + +- if (this.vertexCount > 0) ++ int offs = 0; ++ while (offs < vertexCount) + { ++ int vtc = 0; ++ if (drawMode == 7 && convertQuadsToTriangles) ++ { ++ Math.min(vertexCount - offs, trivertsInBuffer); ++ } ++ else ++ { ++ vtc = Math.min(vertexCount - offs, nativeBufferSize >> 5); ++ } + this.intBuffer.clear(); +- this.intBuffer.put(this.rawBuffer, 0, this.rawBufferIndex); ++ intBuffer.put(rawBuffer, offs * 8, vtc * 8); + this.byteBuffer.position(0); +- this.byteBuffer.limit(this.rawBufferIndex * 4); ++ byteBuffer.limit(vtc * 32); ++ offs += vtc; + + if (this.useVBO) + { +@@ -245,11 +259,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); + } + + GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); +@@ -276,7 +290,13 @@ + GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY); + } + } +- + - if (useVBO) - { - vboIndex = (vboIndex + 1) % vboCount; -@@ -150,11 +175,11 @@ - GL11.glEnableClientState(32884 /*GL_VERTEX_ARRAY_EXT*/); - if (drawMode == 7 && convertQuadsToTriangles) - { -- GL11.glDrawArrays(4, 0, vertexCount); -+ GL11.glDrawArrays(4, 0, vtc); - } - else - { -- GL11.glDrawArrays(drawMode, 0, vertexCount); -+ GL11.glDrawArrays(drawMode, 0, vtc); - } - GL11.glDisableClientState(32884 /*GL_VERTEX_ARRAY_EXT*/); - if (hasTexture) -@@ -176,6 +201,11 @@ - GL11.glDisableClientState(32885 /*GL_NORMAL_ARRAY_EXT*/); - } - } -+ if (rawBufferSize > 0x20000 && rawBufferIndex < (rawBufferSize << 3)) -+ { -+ rawBufferSize = 0; -+ rawBuffer = null; -+ } - int i = rawBufferIndex * 4; - reset(); - return i; -@@ -299,6 +329,19 @@ - - public void addVertex(double d, double d1, double d2) ++ if (rawBufferSize > 0x20000 && rawBufferIndex < (rawBufferSize << 3)) ++ { ++ rawBufferSize = 0; ++ rawBuffer = null; ++ } ++ + int var1 = this.rawBufferIndex * 4; + this.reset(); + return var1; +@@ -439,6 +459,19 @@ + */ + public void addVertex(double par1, double par3, double par5) { -+ if (rawBufferIndex >= rawBufferSize - 32) -+ { -+ if (rawBufferSize == 0) -+ { -+ rawBufferSize = 0x10000; -+ rawBuffer = new int[rawBufferSize]; -+ } -+ else -+ { -+ rawBufferSize *= 2; -+ rawBuffer = Arrays.copyOf(rawBuffer, rawBufferSize); -+ } -+ } - addedVertices++; - if (drawMode == 7 && convertQuadsToTriangles && addedVertices % 4 == 0) - { -@@ -347,11 +390,6 @@ - rawBuffer[rawBufferIndex + 2] = Float.floatToRawIntBits((float)(d2 + zOffset)); - rawBufferIndex += 8; - vertexCount++; -- if (vertexCount % 4 == 0 && rawBufferIndex >= bufferSize - 32) ++ if (rawBufferIndex >= rawBufferSize - 32) ++ { ++ if (rawBufferSize == 0) ++ { ++ rawBufferSize = 0x10000; ++ rawBuffer = new int[rawBufferSize]; ++ } ++ else ++ { ++ rawBufferSize *= 2; ++ rawBuffer = Arrays.copyOf(rawBuffer, rawBufferSize); ++ } ++ } + ++this.addedVertices; + + if (this.drawMode == 7 && convertQuadsToTriangles && this.addedVertices % 4 == 0) +@@ -497,12 +530,6 @@ + this.rawBuffer[this.rawBufferIndex + 2] = Float.floatToRawIntBits((float)(par5 + this.zOffset)); + this.rawBufferIndex += 8; + ++this.vertexCount; +- +- if (this.vertexCount % 4 == 0 && this.rawBufferIndex >= this.bufferSize - 32) - { -- draw(); -- isDrawing = true; +- this.draw(); +- this.isDrawing = true; - } } - public void setColorOpaque_I(int i) + /** diff --git a/forge/patches/minecraft/net/minecraft/src/TileEntity.java.patch b/forge/patches/minecraft/net/minecraft/src/TileEntity.java.patch index 43810e16b..77127f6df 100644 --- a/forge/patches/minecraft/net/minecraft/src/TileEntity.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/TileEntity.java.patch @@ -1,18 +1,16 @@ --- ../src_base/minecraft/net/minecraft/src/TileEntity.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/TileEntity.java 0000-00-00 00:00:00.000000000 -0000 -@@ -63,6 +63,15 @@ - { +@@ -207,4 +207,13 @@ + addMapping(TileEntityEnchantmentTable.class, "EnchantTable"); + addMapping(TileEntityEndPortal.class, "Airportal"); } - ++ + /** + * Determines if this TileEntity requires update calls. + * @return True if you want updateEntity() to be called, false if not + */ -+ public boolean canUpdate() ++ public boolean canUpdate() + { -+ return true; ++ return true; + } -+ - public static TileEntity createAndLoadEntity(NBTTagCompound nbttagcompound) - { - TileEntity tileentity = null; + } diff --git a/forge/patches/minecraft/net/minecraft/src/TileEntityBrewingStand.java.patch b/forge/patches/minecraft/net/minecraft/src/TileEntityBrewingStand.java.patch index be79da5ac..58fe8a3cc 100644 --- a/forge/patches/minecraft/net/minecraft/src/TileEntityBrewingStand.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/TileEntityBrewingStand.java.patch @@ -1,19 +1,19 @@ --- ../src_base/minecraft/net/minecraft/src/TileEntityBrewingStand.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/TileEntityBrewingStand.java 0000-00-00 00:00:00.000000000 -0000 -@@ -1,7 +1,9 @@ - package net.minecraft.src; +@@ -2,7 +2,9 @@ + import java.util.List; + +-public class TileEntityBrewingStand extends TileEntity implements IInventory +import net.minecraft.src.forge.ISidedInventory; + - public class TileEntityBrewingStand extends TileEntity -- implements IInventory -+ implements IInventory, ISidedInventory ++public class TileEntityBrewingStand extends TileEntity implements IInventory, ISidedInventory { - private ItemStack brewingItemStacks[]; - private int brewTime; -@@ -273,4 +275,16 @@ + /** The itemstacks currently placed in the slots of the brewing stand */ + private ItemStack[] brewingItemStacks = new ItemStack[4]; +@@ -318,4 +320,16 @@ - return i; + return var1; } + + @Override diff --git a/forge/patches/minecraft/net/minecraft/src/TileEntityFurnace.java.patch b/forge/patches/minecraft/net/minecraft/src/TileEntityFurnace.java.patch index 4a3fdc659..1ecf57bbc 100644 --- a/forge/patches/minecraft/net/minecraft/src/TileEntityFurnace.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/TileEntityFurnace.java.patch @@ -1,84 +1,71 @@ --- ../src_base/minecraft/net/minecraft/src/TileEntityFurnace.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/TileEntityFurnace.java 0000-00-00 00:00:00.000000000 -0000 -@@ -1,7 +1,9 @@ +@@ -1,6 +1,8 @@ package net.minecraft.src; +-public class TileEntityFurnace extends TileEntity implements IInventory +import net.minecraft.src.forge.ISidedInventory; + - public class TileEntityFurnace extends TileEntity -- implements IInventory -+ implements IInventory, ISidedInventory ++public class TileEntityFurnace extends TileEntity implements IInventory, ISidedInventory { - private ItemStack furnaceItemStacks[]; - public int furnaceBurnTime; -@@ -21,6 +23,20 @@ - return furnaceItemStacks.length; + /** + * The ItemStacks that hold the items currently being used in the furnace +@@ -275,8 +277,12 @@ + } + else + { +- ItemStack var1 = FurnaceRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0].getItem().shiftedIndex); +- return var1 == null ? false : (this.furnaceItemStacks[2] == null ? true : (!this.furnaceItemStacks[2].isItemEqual(var1) ? false : (this.furnaceItemStacks[2].stackSize < this.getInventoryStackLimit() && this.furnaceItemStacks[2].stackSize < this.furnaceItemStacks[2].getMaxStackSize() ? true : this.furnaceItemStacks[2].stackSize < var1.getMaxStackSize()))); ++ ItemStack var1 = FurnaceRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0]); ++ if (var1 == null) return false; ++ if (this.furnaceItemStacks[2] == null) return true; ++ if (!this.furnaceItemStacks[2].isItemEqual(var1)) return false; ++ int result = furnaceItemStacks[2].stackSize + var1.stackSize; ++ return (result <= getInventoryStackLimit() && result <= var1.getMaxStackSize()); + } } +@@ -287,13 +293,13 @@ + { + if (this.canSmelt()) + { +- ItemStack var1 = FurnaceRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0].getItem().shiftedIndex); ++ ItemStack var1 = FurnaceRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0]); + + if (this.furnaceItemStacks[2] == null) + { + this.furnaceItemStacks[2] = var1.copy(); + } +- else if (this.furnaceItemStacks[2].itemID == var1.itemID) ++ else if (this.furnaceItemStacks[2].isItemEqual(var1)) + { + this.furnaceItemStacks[2].stackSize += var1.stackSize; + } +@@ -318,7 +324,7 @@ + * Returns the number of ticks that the supplied fuel item will keep the furnace burning, or 0 if the item isn't + * fuel + */ +- private int getItemBurnTime(ItemStack par1ItemStack) ++ public int getItemBurnTime(ItemStack par1ItemStack) + { + if (par1ItemStack == null) + { +@@ -342,4 +348,18 @@ + public void openChest() {} + + public void closeChest() {} ++ + @Override + public int getStartInventorySide(int side) + { -+ if (side == 0) return 1; -+ if (side == 1) return 0; -+ return 2; ++ if (side == 0) return 1; ++ if (side == 1) return 0; ++ return 2; + } + + @Override + public int getSizeInventorySide(int side) + { -+ return 1; ++ return 1; + } -+ - public ItemStack getStackInSlot(int i) - { - return furnaceItemStacks[i]; -@@ -192,7 +208,7 @@ - { - return false; - } -- ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0].getItem().shiftedIndex); -+ ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0]); - if (itemstack == null) - { - return false; -@@ -205,11 +221,8 @@ - { - return false; - } -- if (furnaceItemStacks[2].stackSize < getInventoryStackLimit() && furnaceItemStacks[2].stackSize < furnaceItemStacks[2].getMaxStackSize()) -- { -- return true; -- } -- return furnaceItemStacks[2].stackSize < itemstack.getMaxStackSize(); -+ int result = furnaceItemStacks[2].stackSize + itemstack.stackSize; -+ return (result <= getInventoryStackLimit() && result <= itemstack.getMaxStackSize()); - } - - public void smeltItem() -@@ -218,14 +231,14 @@ - { - return; - } -- ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0].getItem().shiftedIndex); -+ ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0]); - if (furnaceItemStacks[2] == null) - { - furnaceItemStacks[2] = itemstack.copy(); - } -- else if (furnaceItemStacks[2].itemID == itemstack.itemID) -+ else if (furnaceItemStacks[2].isItemEqual(itemstack)) - { -- furnaceItemStacks[2].stackSize++; -+ furnaceItemStacks[2].stackSize += itemstack.stackSize; - } - if (furnaceItemStacks[0].getItem().func_46056_k()) - { -@@ -241,7 +254,7 @@ - } - } - -- private int getItemBurnTime(ItemStack itemstack) -+ public static int getItemBurnTime(ItemStack itemstack) - { - if (itemstack == null) - { + } diff --git a/forge/patches/minecraft/net/minecraft/src/TileEntityRendererPiston.java.patch b/forge/patches/minecraft/net/minecraft/src/TileEntityRendererPiston.java.patch index 4c9a1c6e8..facbbab75 100644 --- a/forge/patches/minecraft/net/minecraft/src/TileEntityRendererPiston.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/TileEntityRendererPiston.java.patch @@ -9,19 +9,20 @@ import org.lwjgl.opengl.GL11; public class TileEntityRendererPiston extends TileEntitySpecialRenderer -@@ -31,6 +33,7 @@ +@@ -29,7 +31,7 @@ { - GL11.glShadeModel(7424 /*GL_FLAT*/); + GL11.glShadeModel(GL11.GL_FLAT); } -+ ForgeHooksClient.beforeBlockRender(block, field_31071_b); - tessellator.startDrawingQuads(); - tessellator.setTranslationD(((float)d - (float)tileentitypiston.xCoord) + tileentitypiston.func_31017_b(f), ((float)d1 - (float)tileentitypiston.yCoord) + tileentitypiston.func_31014_c(f), ((float)d2 - (float)tileentitypiston.zCoord) + tileentitypiston.func_31013_d(f)); - tessellator.setColorOpaque(1, 1, 1); -@@ -52,6 +55,7 @@ - } - tessellator.setTranslationD(0.0D, 0.0D, 0.0D); - tessellator.draw(); -+ ForgeHooksClient.afterBlockRender(block, field_31071_b); +- ++ ForgeHooksClient.beforeBlockRender(var9, blockRenderer); + var10.startDrawingQuads(); + var10.setTranslationD((double)((float)par2 - (float)par1TileEntityPiston.xCoord + par1TileEntityPiston.getOffsetX(par8)), (double)((float)par4 - (float)par1TileEntityPiston.yCoord + par1TileEntityPiston.getOffsetY(par8)), (double)((float)par6 - (float)par1TileEntityPiston.zCoord + par1TileEntityPiston.getOffsetZ(par8))); + var10.setColorOpaque(1, 1, 1); +@@ -53,6 +55,7 @@ + + var10.setTranslationD(0.0D, 0.0D, 0.0D); + var10.draw(); ++ ForgeHooksClient.afterBlockRender(var9, blockRenderer); RenderHelper.enableStandardItemLighting(); } } diff --git a/forge/patches/minecraft/net/minecraft/src/World.java.patch b/forge/patches/minecraft/net/minecraft/src/World.java.patch index db6c8a76d..326a101df 100644 --- a/forge/patches/minecraft/net/minecraft/src/World.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/World.java.patch @@ -1,89 +1,85 @@ --- ../src_base/minecraft/net/minecraft/src/World.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/World.java 0000-00-00 00:00:00.000000000 -0000 -@@ -33,7 +33,7 @@ - public int lightningFlash; - public boolean editingBlocks; +@@ -67,7 +67,7 @@ + * Contains a timestamp from when the World object was created. Is used in the session.lock file + */ private long lockTimestamp; - protected int autosavePeriod; + public int autosavePeriod; - public int difficultySetting; - public Random rand; - public boolean isNewWorld; -@@ -399,7 +399,12 @@ - public boolean isAirBlock(int i, int j, int k) + /** Option > Difficulty setting (0 - 3) */ + public int difficultySetting; +@@ -539,7 +539,8 @@ + */ + public boolean isAirBlock(int par1, int par2, int par3) { -- return getBlockId(i, j, k) == 0; -+ int iBlockID = getBlockId(i, j, k); -+ if (iBlockID == 0) -+ { -+ return true; -+ } -+ return Block.blocksList[iBlockID].isAirBlock(this, i, j, k); +- 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); } - public boolean blockExists(int i, int j, int k) -@@ -1576,7 +1581,7 @@ - Chunk chunk = getChunkFromChunkCoords(tileentity.xCoord >> 4, tileentity.zCoord >> 4); - if (chunk != null) + /** +@@ -2037,7 +2038,7 @@ + + if (var7 != null) { -- chunk.removeChunkBlockTileEntity(tileentity.xCoord & 0xf, tileentity.yCoord, tileentity.zCoord & 0xf); -+ chunk.cleanChunkBlockTileEntity(tileentity.xCoord & 0xf, tileentity.yCoord, tileentity.zCoord & 0xf); +- var7.removeChunkBlockTileEntity(var5.xCoord & 15, var5.yCoord, var5.zCoord & 15); ++ var7.cleanChunkBlockTileEntity(var5.xCoord & 15, var5.yCoord, var5.zCoord & 15); } } } -@@ -1605,15 +1610,17 @@ +@@ -2067,18 +2068,18 @@ { - loadedTileEntityList.add(tileentity1); + this.loadedTileEntityList.add(var8); } +- + } + else + { - if (chunkExists(tileentity1.xCoord >> 4, tileentity1.zCoord >> 4)) + if (this.chunkExists(var8.xCoord >> 4, var8.zCoord >> 4)) { - Chunk chunk1 = getChunkFromChunkCoords(tileentity1.xCoord >> 4, tileentity1.zCoord >> 4); - if (chunk1 != null) + Chunk var9 = this.getChunkFromChunkCoords(var8.xCoord >> 4, var8.zCoord >> 4); + + if (var9 != null) { -- chunk1.setChunkBlockTileEntity(tileentity1.xCoord & 0xf, tileentity1.yCoord, tileentity1.zCoord & 0xf, tileentity1); -+ chunk1.cleanChunkBlockTileEntity(tileentity1.xCoord & 0xf, tileentity1.yCoord, tileentity1.zCoord & 0xf); +- var9.setChunkBlockTileEntity(var8.xCoord & 15, var8.yCoord, var8.zCoord & 15, var8); ++ var9.cleanChunkBlockTileEntity(var8.xCoord & 15, var8.yCoord, var8.zCoord & 15); } } -- markBlockNeedsUpdate(tileentity1.xCoord, tileentity1.yCoord, tileentity1.zCoord); +- +- this.markBlockNeedsUpdate(var8.xCoord, var8.yCoord, var8.zCoord); } } - while (true); -@@ -1625,14 +1632,14 @@ - public void addTileEntity(Collection collection) +@@ -2091,13 +2092,13 @@ + + public void addTileEntity(Collection par1Collection) { -- if (scanningTileEntities) +- if (this.scanningTileEntities) - { -- addedTileEntityList.addAll(collection); +- this.addedTileEntityList.addAll(par1Collection); - } - else -- { -- loadedTileEntityList.addAll(collection); -- } -+ List dest = scanningTileEntities ? addedTileEntityList : loadedTileEntityList; -+ for(Object entity : collection) -+ { -+ if(((TileEntity)entity).canUpdate()) -+ { -+ dest.add(entity); -+ } -+ } ++ List dest = scanningTileEntities ? addedTileEntityList : loadedTileEntityList; ++ for(Object entity : par1Collection) + { +- this.loadedTileEntityList.addAll(par1Collection); ++ if(((TileEntity)entity).canUpdate()) ++ { ++ dest.add(entity); ++ } + } } - public void updateEntity(Entity entity) -@@ -1793,7 +1800,14 @@ - if (j2 == Block.fire.blockID || j2 == Block.lavaMoving.blockID || j2 == Block.lavaStill.blockID) +@@ -2296,7 +2297,14 @@ + if (var11 == Block.fire.blockID || var11 == Block.lavaMoving.blockID || var11 == Block.lavaStill.blockID) { return true; - } + } + else + { -+ if(j2 > 0 && Block.blocksList[j2].isBlockBurning(this, k1, l1, i2)) ++ if(var11 > 0 && Block.blocksList[var11].isBlockBurning(this, var8, var9, var10)) + { + return true; + } @@ -91,106 +87,116 @@ } } } -@@ -2038,48 +2052,29 @@ - - public void setBlockTileEntity(int i, int j, int k, TileEntity tileentity) +@@ -2597,25 +2605,19 @@ + */ + public void setBlockTileEntity(int par1, int par2, int par3, TileEntity par4TileEntity) { -- if (tileentity != null && !tileentity.isInvalid()) -- { -- if (scanningTileEntities) +- if (par4TileEntity != null && !par4TileEntity.isInvalid()) ++ if (par4TileEntity == null || par4TileEntity.isInvalid()) + { +- if (this.scanningTileEntities) - { -- tileentity.xCoord = i; -- tileentity.yCoord = j; -- tileentity.zCoord = k; -- addedTileEntityList.add(tileentity); +- par4TileEntity.xCoord = par1; +- par4TileEntity.yCoord = par2; +- par4TileEntity.zCoord = par3; +- this.addedTileEntityList.add(par4TileEntity); - } - else - { -- loadedTileEntityList.add(tileentity); -- Chunk chunk = getChunkFromChunkCoords(i >> 4, k >> 4); -- if (chunk != null) +- this.loadedTileEntityList.add(par4TileEntity); +- Chunk var5 = this.getChunkFromChunkCoords(par1 >> 4, par3 >> 4); +- +- if (var5 != null) - { -- chunk.setChunkBlockTileEntity(i & 0xf, j, k & 0xf, tileentity); +- var5.setChunkBlockTileEntity(par1 & 15, par2, par3 & 15, par4TileEntity); - } - } -- } -+ if (tileentity == null || tileentity.isInvalid()) -+ { -+ return; -+ } -+ List dest = scanningTileEntities ? addedTileEntityList : loadedTileEntityList; -+ if (tileentity.canUpdate()) -+ { -+ dest.add(tileentity); -+ } -+ Chunk chunk = getChunkFromChunkCoords(i >> 4, k >> 4); -+ if (chunk != null) -+ { -+ chunk.setChunkBlockTileEntity(i & 0xf, j, k & 0xf, tileentity); -+ } ++ return; ++ } ++ List dest = scanningTileEntities ? addedTileEntityList : loadedTileEntityList; ++ if (par4TileEntity.canUpdate()) ++ { ++ dest.add(par4TileEntity); ++ } ++ Chunk chunk = getChunkFromChunkCoords(par1 >> 4, par3 >> 4); ++ if (chunk != null) ++ { ++ chunk.setChunkBlockTileEntity(par1 & 15, par2, par3 & 15, par4TileEntity); + } } - public void removeBlockTileEntity(int i, int j, int k) +@@ -2624,27 +2626,10 @@ + */ + public void removeBlockTileEntity(int par1, int par2, int par3) { -- TileEntity tileentity = getBlockTileEntity(i, j, k); -- if (tileentity != null && scanningTileEntities) +- TileEntity var4 = this.getBlockTileEntity(par1, par2, par3); +- +- if (var4 != null && this.scanningTileEntities) - { -- tileentity.invalidate(); -- addedTileEntityList.remove(tileentity); +- var4.invalidate(); +- this.addedTileEntityList.remove(var4); - } - else -- { -- if (tileentity != null) -- { -- addedTileEntityList.remove(tileentity); -- loadedTileEntityList.remove(tileentity); -- } -- Chunk chunk = getChunkFromChunkCoords(i >> 4, k >> 4); -- if (chunk != null) -- { -- chunk.removeChunkBlockTileEntity(i & 0xf, j, k & 0xf); -- } -- } -+ Chunk chunk = getChunkFromChunkCoords(i >> 4, k >> 4); -+ if (chunk != null) -+ { -+ chunk.removeChunkBlockTileEntity(i & 0xf, j, k & 0xf); -+ } - } - - public void markTileEntityForDespawn(TileEntity tileentity) -@@ -2109,7 +2104,7 @@ - } - else ++ Chunk chunk = getChunkFromChunkCoords(par1 >> 4, par3 >> 4); ++ if (chunk != null) { -- return block.blockMaterial.isOpaque() && block.renderAsNormalBlock(); -+ return block.isBlockNormalCube(this, i, j, k); +- if (var4 != null) +- { +- this.addedTileEntityList.remove(var4); +- this.loadedTileEntityList.remove(var4); +- } +- +- Chunk var5 = this.getChunkFromChunkCoords(par1 >> 4, par3 >> 4); +- +- if (var5 != null) +- { +- var5.removeChunkBlockTileEntity(par1 & 15, par2, par3 & 15); +- } ++ chunk.removeChunkBlockTileEntity(par1 & 15, par2, par3 & 15); } } -@@ -2535,7 +2530,7 @@ - - private int computeBlockLightValue(int i, int j, int k, int l, int i1, int j1) +@@ -2670,7 +2655,15 @@ + */ + public boolean isBlockNormalCube(int par1, int par2, int par3) { -- int k1 = Block.lightValue[i1]; -+ int k1 = (i1 == 0) ? 0 : Block.blocksList[i1].getLightValue(this, j, k, l); - int l1 = getSavedLightValue(EnumSkyBlock.Block, j - 1, k, l) - j1; - int i2 = getSavedLightValue(EnumSkyBlock.Block, j + 1, k, l) - j1; - int j2 = getSavedLightValue(EnumSkyBlock.Block, j, k - 1, l) - j1; -@@ -2945,6 +2940,10 @@ - { - block = null; - } -+ if (block != null && block.isBlockReplaceable(this, j, k, l)) +- return Block.func_48206_g(this.getBlockId(par1, par2, par3)); ++ Block block = Block.blocksList[getBlockId(par1, par2, par3)]; ++ if (block != null) + { -+ block = null; ++ return block.isBlockNormalCube(this, par1, par2, par3); ++ } ++ else ++ { ++ return false; + } - return i > 0 && block == null && block1.canPlaceBlockOnSide(this, j, k, l, i1); } -@@ -3493,4 +3492,39 @@ + /** +@@ -3263,7 +3256,7 @@ + + private int computeBlockLightValue(int par1, int par2, int par3, int par4, int par5, int par6) { - return worldInfo.getTerrainType() != EnumWorldType.FLAT ? 63D : 0.0D; +- int var7 = Block.lightValue[par5]; ++ int var7 = (par5 == 0 || Block.blocksList[par5] == null ? 0 : Block.blocksList[par5].getLightValue(this, par2, par3, par4)); + int var8 = this.getSavedLightValue(EnumSkyBlock.Block, par2 - 1, par3, par4) - par6; + int var9 = this.getSavedLightValue(EnumSkyBlock.Block, par2 + 1, par3, par4) - par6; + int var10 = this.getSavedLightValue(EnumSkyBlock.Block, par2, par3 - 1, par4) - par6; +@@ -3789,7 +3782,10 @@ + { + var8 = null; + } +- ++ if (var8 != null && var8.isBlockReplaceable(this, par2, par3, par4)) ++ { ++ var8 = null; ++ } + return par1 > 0 && var8 == null && var9.canPlaceBlockOnSide(this, par2, par3, par4, par6); + } + } +@@ -4378,4 +4374,39 @@ + { + return this.worldInfo.getTerrainType() == WorldType.field_48636_c ? 0.0D : 63.0D; } + + diff --git a/forge/patches/minecraft/net/minecraft/src/WorldGenDungeons.java.patch b/forge/patches/minecraft/net/minecraft/src/WorldGenDungeons.java.patch index 2a91e9e8f..7d7e664d4 100644 --- a/forge/patches/minecraft/net/minecraft/src/WorldGenDungeons.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/WorldGenDungeons.java.patch @@ -1,34 +1,23 @@ --- ../src_base/minecraft/net/minecraft/src/WorldGenDungeons.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/WorldGenDungeons.java 0000-00-00 00:00:00.000000000 -0000 -@@ -3,6 +3,8 @@ - import java.io.PrintStream; +@@ -2,6 +2,8 @@ + import java.util.Random; +import net.minecraft.src.forge.MinecraftForge; + public class WorldGenDungeons extends WorldGenerator { - public WorldGenDungeons() -@@ -118,11 +120,11 @@ - int k4 = 0; - do - { -- if (k4 >= 8) -+ if (k4 >= MinecraftForge.getDungeonLootTries()) - { - break label0; - } -- ItemStack itemstack = pickCheckLootItem(random); -+ ItemStack itemstack = MinecraftForge.getRandomDungeonLoot(random); - if (itemstack != null) - { - tileentitychest.setInventorySlotContents(random.nextInt(tileentitychest.getSizeInventory()), itemstack); -@@ -137,7 +139,7 @@ - TileEntityMobSpawner tileentitymobspawner = (TileEntityMobSpawner)world.getBlockTileEntity(i, j, k); - if (tileentitymobspawner != null) - { -- tileentitymobspawner.setMobID(pickMobSpawner(random)); -+ tileentitymobspawner.setMobID(MinecraftForge.getRandomDungeonMob(random)); - } - else - { + public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) +@@ -117,9 +119,9 @@ + + if (var16 != null) + { +- for (int var17 = 0; var17 < 8; ++var17) ++ for (int var17 = 0; var17 < MinecraftForge.getDungeonLootTries(); ++var17) + { +- ItemStack var18 = this.pickCheckLootItem(par2Random); ++ ItemStack var18 = MinecraftForge.getRandomDungeonLoot(par2Random); + + if (var18 != null) + { diff --git a/forge/patches/minecraft/net/minecraft/src/WorldProvider.java.patch b/forge/patches/minecraft/net/minecraft/src/WorldProvider.java.patch index eaf6b5a92..e0bbace63 100644 --- a/forge/patches/minecraft/net/minecraft/src/WorldProvider.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/WorldProvider.java.patch @@ -7,34 +7,19 @@ + public abstract class WorldProvider { - public World worldObj; -@@ -142,22 +144,7 @@ + /** world object being used */ +@@ -181,7 +183,7 @@ - public static WorldProvider getProviderForDimension(int i) + public static WorldProvider getProviderForDimension(int par0) { -- if (i == -1) -- { -- return new WorldProviderHell(); -- } -- if (i == 0) -- { -- return new WorldProviderSurface(); -- } -- if (i == 1) -- { -- return new WorldProviderEnd(); -- } -- else -- { -- return null; -- } -+ return DimensionManager.getProvider(i); +- return (WorldProvider)(par0 == -1 ? new WorldProviderHell() : (par0 == 0 ? new WorldProviderSurface() : (par0 == 1 ? new WorldProviderEnd() : null))); ++ return DimensionManager.getProvider(par0); } - public float getCloudHeight() -@@ -196,4 +183,36 @@ + /** +@@ -227,4 +229,36 @@ { - return terrainType != EnumWorldType.FLAT ? 0.03125D : 1.0D; + return false; } + + /** diff --git a/forge/patches/minecraft/net/minecraft/src/WorldProviderEnd.java.patch b/forge/patches/minecraft/net/minecraft/src/WorldProviderEnd.java.patch index 9db1bb0dd..379b2ecc0 100644 --- a/forge/patches/minecraft/net/minecraft/src/WorldProviderEnd.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/WorldProviderEnd.java.patch @@ -1,8 +1,8 @@ --- ../src_base/minecraft/net/minecraft/src/WorldProviderEnd.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/WorldProviderEnd.java 0000-00-00 00:00:00.000000000 -0000 -@@ -87,4 +87,22 @@ +@@ -115,4 +115,22 @@ { - return 50; + return true; } + + @Override diff --git a/forge/patches/minecraft/net/minecraft/src/WorldProviderHell.java.patch b/forge/patches/minecraft/net/minecraft/src/WorldProviderHell.java.patch index 49905f5df..5fd187ea6 100644 --- a/forge/patches/minecraft/net/minecraft/src/WorldProviderHell.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/WorldProviderHell.java.patch @@ -1,8 +1,8 @@ --- ../src_base/minecraft/net/minecraft/src/WorldProviderHell.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/WorldProviderHell.java 0000-00-00 00:00:00.000000000 -0000 -@@ -49,4 +49,28 @@ +@@ -76,4 +76,28 @@ { - return false; + return true; } + + @Override diff --git a/forge/patches/minecraft/net/minecraft/src/WorldProviderSurface.java.patch b/forge/patches/minecraft/net/minecraft/src/WorldProviderSurface.java.patch index f9269e6fe..a61e158e5 100644 --- a/forge/patches/minecraft/net/minecraft/src/WorldProviderSurface.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/WorldProviderSurface.java.patch @@ -1,9 +1,9 @@ --- ../src_base/minecraft/net/minecraft/src/WorldProviderSurface.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/WorldProviderSurface.java 0000-00-00 00:00:00.000000000 -0000 -@@ -5,4 +5,22 @@ - public WorldProviderSurface() - { - } +@@ -2,4 +2,22 @@ + + public class WorldProviderSurface extends WorldProvider + { + + @Override + public String getSaveFolder() diff --git a/forge/patches/minecraft/net/minecraft/src/WorldRenderer.java.patch b/forge/patches/minecraft/net/minecraft/src/WorldRenderer.java.patch index 1704deb39..2e206c91b 100644 --- a/forge/patches/minecraft/net/minecraft/src/WorldRenderer.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/WorldRenderer.java.patch @@ -1,80 +1,71 @@ --- ../src_base/minecraft/net/minecraft/src/WorldRenderer.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/WorldRenderer.java 0000-00-00 00:00:00.000000000 -0000 -@@ -1,13 +1,15 @@ - package net.minecraft.src; - - import java.util.*; +@@ -3,6 +3,9 @@ + import java.util.ArrayList; + import java.util.HashSet; + import java.util.List; + +import net.minecraft.src.forge.ForgeHooksClient; + import org.lwjgl.opengl.GL11; public class WorldRenderer - { +@@ -10,7 +13,6 @@ + /** Reference to the World object. */ public World worldObj; - private int glRenderList; -- private static Tessellator tessellator; + private int glRenderList = -1; +- private static Tessellator tessellator = Tessellator.instance; public static int chunksUpdated = 0; public int posX; public int posY; -@@ -150,10 +152,11 @@ - GL11.glTranslatef((float)(-sizeDepth) / 2.0F, (float)(-sizeHeight) / 2.0F, (float)(-sizeDepth) / 2.0F); - GL11.glScalef(f, f, f); - GL11.glTranslatef((float)sizeDepth / 2.0F, (float)sizeHeight / 2.0F, (float)sizeDepth / 2.0F); -- tessellator.startDrawingQuads(); -- tessellator.setTranslationD(-posX, -posY, -posZ); -+ ForgeHooksClient.beforeRenderPass(i2); -+ Tessellator.instance.startDrawingQuads(); -+ Tessellator.instance.setTranslationD(-posX, -posY, -posZ); - } -- if (i2 == 0 && Block.isBlockContainer[i3]) -+ if (i2 == 0 && Block.blocksList[i3] != null && Block.blocksList[i3].hasTileEntity(chunkcache.getBlockMetadata(l2, j2, k2))) - { - TileEntity tileentity = chunkcache.getBlockTileEntity(l2, j2, k2); - if (TileEntityRenderer.instance.hasSpecialRenderer(tileentity)) -@@ -167,25 +170,29 @@ - { - flag1 = true; - } -- if (j3 != i2) -+ if (j3 > i2) - { - flag = true; -- continue; - } -- if (j3 == i2) -+ if(!ForgeHooksClient.canRenderInPass(block, i2)) - { -- flag1 |= renderblocks.renderBlockByRenderType(block, l2, j2, k2); -+ continue; - } -+ -+ ForgeHooksClient.beforeBlockRender(block, renderblocks); -+ flag1 |= renderblocks.renderBlockByRenderType(block, l2, j2, k2); -+ ForgeHooksClient.afterBlockRender(block, renderblocks); - } - } - } +@@ -179,11 +181,12 @@ + GL11.glTranslatef(-8.0F, -8.0F, -8.0F); + GL11.glScalef(var19, var19, var19); + GL11.glTranslatef(8.0F, 8.0F, 8.0F); +- tessellator.startDrawingQuads(); +- tessellator.setTranslationD((double)(-this.posX), (double)(-this.posY), (double)(-this.posZ)); ++ ForgeHooksClient.beforeRenderPass(var11); ++ Tessellator.instance.startDrawingQuads(); ++ Tessellator.instance.setTranslationD((double)(-this.posX), (double)(-this.posY), (double)(-this.posZ)); + } - if (flag2) - { -- bytesDrawn += tessellator.draw(); -+ ForgeHooksClient.afterRenderPass(i2); -+ bytesDrawn += Tessellator.instance.draw(); - GL11.glPopMatrix(); - GL11.glEndList(); -- tessellator.setTranslationD(0.0D, 0.0D, 0.0D); -+ Tessellator.instance.setTranslationD(0.0D, 0.0D, 0.0D); - } - else - { -@@ -279,9 +286,4 @@ - { - needsUpdate = true; - } -- -- static -- { -- tessellator = Tessellator.instance; -- } - } +- if (var11 == 0 && Block.blocksList[var18].func_48205_p()) ++ if (var11 == 0 && Block.blocksList[var18] != null && Block.blocksList[var18].hasTileEntity(var9.getBlockMetadata(var17, var15, var16))) + { + TileEntity var23 = var9.getBlockTileEntity(var17, var15, var16); + +@@ -196,14 +199,17 @@ + Block var24 = Block.blocksList[var18]; + int var20 = var24.getRenderBlockPass(); + +- if (var20 != var11) ++ if (var20 > var11) + { + var12 = true; + } +- else if (var20 == var11) ++ if (!ForgeHooksClient.canRenderInPass(var24, var11)) + { +- var13 |= var10.renderBlockByRenderType(var24, var17, var15, var16); ++ continue; + } ++ ForgeHooksClient.beforeBlockRender(var24, var10); ++ var13 |= var10.renderBlockByRenderType(var24, var17, var15, var16); ++ ForgeHooksClient.afterBlockRender(var24, var10); + } + } + } +@@ -211,10 +217,11 @@ + + if (var14) + { +- this.bytesDrawn += tessellator.draw(); ++ ForgeHooksClient.afterRenderPass(var11); ++ this.bytesDrawn += Tessellator.instance.draw(); + GL11.glPopMatrix(); + GL11.glEndList(); +- tessellator.setTranslationD(0.0D, 0.0D, 0.0D); ++ Tessellator.instance.setTranslationD(0.0D, 0.0D, 0.0D); + } + else + {