diff --git a/bin/diff.exe b/bin/diff.exe new file mode 100644 index 0000000000..85f370d867 Binary files /dev/null and b/bin/diff.exe differ diff --git a/bin/find.exe b/bin/find.exe new file mode 100644 index 0000000000..85192fbf44 Binary files /dev/null and b/bin/find.exe differ diff --git a/bin/libiconv2.dll b/bin/libiconv2.dll new file mode 100644 index 0000000000..747073f1b1 Binary files /dev/null and b/bin/libiconv2.dll differ diff --git a/bin/libintl3.dll b/bin/libintl3.dll new file mode 100644 index 0000000000..2efd2117cd Binary files /dev/null and b/bin/libintl3.dll differ diff --git a/bin/mkdir.exe b/bin/mkdir.exe new file mode 100644 index 0000000000..f96d181fc9 Binary files /dev/null and b/bin/mkdir.exe differ diff --git a/bin/regex2.dll b/bin/regex2.dll new file mode 100644 index 0000000000..f84a847a0d Binary files /dev/null and b/bin/regex2.dll differ diff --git a/bin/sed.exe b/bin/sed.exe new file mode 100644 index 0000000000..3190377ca1 Binary files /dev/null and b/bin/sed.exe differ diff --git a/bin/tr.exe b/bin/tr.exe new file mode 100644 index 0000000000..48e4c3c8f7 Binary files /dev/null and b/bin/tr.exe differ diff --git a/forge_client/.classpath b/forge_client/.classpath index 34ef34d1b6..fae6017a3b 100755 --- a/forge_client/.classpath +++ b/forge_client/.classpath @@ -7,6 +7,6 @@ - + diff --git a/install/install.cmd b/install/install.cmd index 8e13411ba4..b2485d3fd1 100755 --- a/install/install.cmd +++ b/install/install.cmd @@ -1,8 +1,28 @@ -set HOME=%~dps0 -set MCP=%HOME%.. -xcopy /Y /E src\* ..\src +echo off -cd %MCP%\src -%MCP%\runtime\bin\python\python_mcp %HOME%\lfcr.py %HOME%\minecraft.patch %HOME%\minecraft-win.patch -%MCP%\runtime\bin\applydiff.exe -uf -p2 < %HOME%\minecraft-win.patch -pause +echo MinecraftForge Windows Setup Program +echo: + +pushd .. >nul + +cmd /C cleanup.bat +cmd /C decompile.bat + +pushd src >nul + ..\runtime\bin\python\python_mcp ..\forge\lfcr.py ../forge/modLoaderMP.patch ../forge/modLoaderMP.patch + ..\runtime\bin\applydiff.exe -uf -p2 -i ../forge/modLoaderMP.patch + ..\runtime\bin\python\python_mcp ..\forge\lfcr.py ../forge/mlprop.patch ../forge/mlprop.patch + ..\runtime\bin\applydiff.exe -uf -p1 -i ../forge/mlprop.patch + + for /f "delims=" %%a in ('dir /a -d /b /S ..\forge\patches') do ( + pushd "%%a" 2>nul + if errorlevel 1 ( + ..\runtime\bin\python\python_mcp ..\forge\lfcr.py "%%a" "%%a" + ..\runtime\bin\applydiff.exe -uf -p2 -i "%%a" + ) else popd + ) +popd >nul + +xcopy /Y /E forge\src\* src + +cmd /C updatemd5.bat \ No newline at end of file diff --git a/install/install.sh b/install/install.sh new file mode 100644 index 0000000000..e5de30f20f --- /dev/null +++ b/install/install.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +echo "MinecraftForge Linux Setup Program" +echo + +pushd .. > /dev/null + +./cleanup.sh +./decompile.sh + +pushd src > /dev/null + find . -name *.java -exec sed -i 's/\r//g' \{\} \; + patch -p2 -i ../forge/modLoaderMP.patch + patch -p1 -i ../forge/mlprop.patch + for i in `find ../forge/patches/ -type f` + do + patch -p2 -i $i + done +popd > /dev/null + +cp -r forge/src/* src + +./updatemd5.sh diff --git a/minecraft.patch b/minecraft.patch deleted file mode 100644 index 21ec044efc..0000000000 --- a/minecraft.patch +++ /dev/null @@ -1,5032 +0,0 @@ -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/BlockButton.java ../src_work/minecraft/net/minecraft/src/BlockButton.java ---- ../src_base/minecraft/net/minecraft/src/BlockButton.java 2011-10-02 14:29:20.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/BlockButton.java 2011-10-02 14:29:22.000000000 -0400 -@@ -41,36 +41,36 @@ - - public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l) - { -- 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); - } - - 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); - } - - public void onBlockPlaced(World world, int i, int j, int k, int l) -@@ -78,19 +78,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)) -+ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3)) - { - i1 = 3; - } else -- if(l == 4 && world.isBlockNormalCube(i + 1, j, k)) -+ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4)) - { - i1 = 2; - } else -- if(l == 5 && world.isBlockNormalCube(i - 1, j, k)) -+ if(l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5)) - { - i1 = 1; - } else -@@ -102,19 +102,19 @@ - - private int getOrientation(World world, int i, int j, int k) - { -- 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; - } - - public void onNeighborBlockChange(World world, int i, int j, int k, int l) -@@ -123,19 +123,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) - { - flag = true; - } -- if(!world.isBlockNormalCube(i + 1, j, k) && i1 == 2) -+ if(!world.isBlockSolidOnSide(i + 1, j, k,4) && i1 == 2) - { - flag = true; - } -- if(!world.isBlockNormalCube(i, j, k - 1) && i1 == 3) -+ if(!world.isBlockSolidOnSide(i, j, k - 1,3) && i1 == 3) - { - flag = true; - } -- if(!world.isBlockNormalCube(i, j, k + 1) && i1 == 4) -+ if(!world.isBlockSolidOnSide(i, j, k + 1,2) && i1 == 4) - { - flag = true; - } -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/BlockChest.java ../src_work/minecraft/net/minecraft/src/BlockChest.java ---- ../src_base/minecraft/net/minecraft/src/BlockChest.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/BlockChest.java 2011-10-02 14:29:22.000000000 -0400 -@@ -423,23 +423,23 @@ - { - return true; - } -- if(world.isBlockNormalCube(i, j + 1, k)) -+ if(world.isBlockSolidOnSide(i, j + 1, k,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)) - { - 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)) - { - 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)) - { - 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)) - { - return true; - } -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/BlockContainer.java ../src_work/minecraft/net/minecraft/src/BlockContainer.java ---- ../src_base/minecraft/net/minecraft/src/BlockContainer.java 2011-10-02 14:29:20.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/BlockContainer.java 2011-10-02 14:29:22.000000000 -0400 -@@ -26,7 +26,7 @@ - public void onBlockAdded(World world, int i, int j, int k) - { - super.onBlockAdded(world, i, j, k); -- world.setBlockTileEntity(i, j, k, getBlockEntity()); -+ world.setBlockTileEntity(i, j, k, getBlockEntity(world.getBlockMetadata(i,j,k))); - } - - public void onBlockRemoval(World world, int i, int j, int k) -@@ -37,6 +37,12 @@ - - public abstract TileEntity getBlockEntity(); - -+ /* FORGE: Metadata-sensitive version, to fix 1.8.1 regression. -+ */ -+ public TileEntity getBlockEntity(int md) { -+ return getBlockEntity(); -+ } -+ - public void playBlock(World world, int i, int j, int k, int l, int i1) - { - super.playBlock(world, i, j, k, l, i1); -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/BlockCrops.java ../src_work/minecraft/net/minecraft/src/BlockCrops.java ---- ../src_base/minecraft/net/minecraft/src/BlockCrops.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/BlockCrops.java 2011-10-02 14:29:22.000000000 -0400 -@@ -5,6 +5,7 @@ - package net.minecraft.src; - - import java.util.Random; -+import java.util.ArrayList; - - // Referenced classes of package net.minecraft.src: - // BlockFlower, Block, World, EntityItem, -@@ -108,27 +109,16 @@ - return 6; - } - -- public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f) -- { -- super.dropBlockAsItemWithChance(world, i, j, k, l, f); -- if(world.multiplayerWorld) -- { -- return; -- } -- for(int i1 = 0; i1 < 3; i1++) -- { -- if(world.rand.nextInt(15) <= l) -- { -- 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.entityJoinedWorld(entityitem); -- } -- } -- -+ public ArrayList getBlockDropped(World world, -+ int i, int j, int k, int md) { -+ ArrayList tr=new ArrayList(); -+ if(md==7) tr.add(new ItemStack(Item.wheat)); -+ -+ for(int n=0; n<3; n++) { -+ if(world.rand.nextInt(15) <= md) -+ tr.add(new ItemStack(Item.seeds)); -+ } -+ return tr; - } - - public int idDropped(int i, Random random) -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/BlockDoor.java ../src_work/minecraft/net/minecraft/src/BlockDoor.java ---- ../src_base/minecraft/net/minecraft/src/BlockDoor.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/BlockDoor.java 2011-10-02 14:29:22.000000000 -0400 -@@ -178,7 +178,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; -@@ -242,7 +242,7 @@ - return false; - } 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); - } - } - -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/Block.java ../src_work/minecraft/net/minecraft/src/Block.java ---- ../src_base/minecraft/net/minecraft/src/Block.java 2011-10-02 14:29:20.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/Block.java 2011-10-02 14:29:22.000000000 -0400 -@@ -4,6 +4,7 @@ - - package net.minecraft.src; - -+import net.minecraft.src.forge.ForgeHooks; - import java.util.ArrayList; - import java.util.Random; - -@@ -151,12 +152,14 @@ - - public float getBlockBrightness(IBlockAccess iblockaccess, int i, int j, int k) - { -- return iblockaccess.getBrightness(i, j, k, lightValue[blockID]); -+ return iblockaccess.getBrightness(i, j, k, -+ getLightValue(iblockaccess,i,j,k)); - } - - public int getMixedBrightnessForBlock(IBlockAccess iblockaccess, int i, int j, int k) - { -- return iblockaccess.getLightBrightnessForSkyBlocks(i, j, k, lightValue[blockID]); -+ return iblockaccess.getLightBrightnessForSkyBlocks(i, j, k, -+ getLightValue(iblockaccess,i,j,k)); - } - - public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) -@@ -278,24 +281,40 @@ - return 1; - } - -+ /* FORGE: Metadata-sensitive version. -+ */ -+ public int quantityDropped(int i, Random random) -+ { -+ return quantityDropped(random); -+ } -+ - public int idDropped(int i, Random random) - { - return blockID; - } - -+ /* FORGE: This function isn't called by Minecraft anymore. Use -+ * blockStrength(EntityPlayer,int) instead. -+ */ - public float blockStrength(EntityPlayer entityplayer) - { -- 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); -+ } -+ -+ /* FORGE: This function returns the complete list of drops for a block. -+ */ -+ public ArrayList getBlockDropped(World world, -+ int i, int j, int k, int md) { -+ ArrayList tr=new ArrayList(); -+ -+ int q=quantityDropped(md,world.rand); -+ for(int n=0; n0) { -+ tr.add(new ItemStack(id,1,damageDropped(md))); -+ } -+ } -+ return tr; - } - - public final void dropBlockAsItem(World world, int i, int j, int k, int l) -@@ -309,20 +328,12 @@ - { - return; - } -- int i1 = quantityDropped(world.rand); -- for(int j1 = 0; j1 < i1; j1++) -- { -+ ArrayList ar=getBlockDropped(world,i,j,k,l); -+ for(ItemStack ist : ar) { - if(world.rand.nextFloat() > f) -- { - continue; -- } -- int k1 = idDropped(l, world.rand); -- if(k1 > 0) -- { -- dropBlockAsItem_do(world, i, j, k, new ItemStack(k1, 1, damageDropped(l))); -- } -+ dropBlockAsItem_do(world, i, j, k, ist); - } -- - } - - protected void dropBlockAsItem_do(World world, int i, int j, int k, ItemStack itemstack) -@@ -618,6 +629,86 @@ - return iblockaccess.isBlockNormalCube(i, j, k) ? 0.2F : 1.0F; - } - -+ /* FORGE: Allow a block to set illumination on a coordinate basis. -+ */ -+ public int getLightValue(IBlockAccess iba, int i, int j, int k) { -+ return lightValue[blockID]; -+ } -+ -+ /* FORGE: Implement and return true if you wish this block to behave -+ * like a ladder when the player is inside. -+ */ -+ public boolean isLadder() { -+ return false; -+ } -+ -+ /* FORGE: Return true if the block is a normal, solid cube. This -+ * determines indirect power state, entity ejection from blocks, and a few -+ * others. -+ */ -+ public boolean isBlockNormalCube(World world, int i, int j, int k) { -+ return blockMaterial.getIsOpaque() && 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); -+ } -+ -+ /* FORGE: Return true if the player can place a new block in the block -+ * occupied by this one, like water, lava, fire, etc. -+ */ -+ public boolean isBlockReplaceable( World world, int i, int j, int k ) { -+ return false; -+ } -+ -+ /* FORGE: Return true if this block should set fire and deal fire damage -+ * to entities coming into contact with it, false otherwise. -+ */ -+ public boolean isBlockBurning( World world, int i, int j, int k ) { -+ 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 -+ * 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 ) { -+ return false; -+ } -+ -+ /* FORGE: Return the block hardness with metadata 'md'. -+ */ -+ public float getHardness(int md) { -+ return blockHardness; -+ } -+ -+ /* FORGE: Return the block strength of the block at i,j,k against the -+ * player. -+ */ -+ public float blockStrength(World world, EntityPlayer player, -+ int i, int j, int k) { -+ int md=world.getBlockMetadata(i,j,k); -+ return blockStrength(player,md); -+ } -+ -+ /* FORGE: Return the block strength of a prototypical block with metadata -+ * 'md' against the player. -+ */ -+ public float blockStrength(EntityPlayer player, int md) { -+ return ForgeHooks.blockStrength(this,player,md); -+ } -+ -+ /* FORGE: Return true if the player can harvest a prototypical block with -+ * metadata 'md'. -+ */ -+ public boolean canHarvestBlock(EntityPlayer player, int md) { -+ return ForgeHooks.canHarvestBlock(this,player,md); -+ } -+ - static Class _mthclass$(String s) - { - try -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/BlockLadder.java ../src_work/minecraft/net/minecraft/src/BlockLadder.java ---- ../src_base/minecraft/net/minecraft/src/BlockLadder.java 2011-10-02 14:29:20.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/BlockLadder.java 2011-10-02 14:29:22.000000000 -0400 -@@ -63,6 +63,11 @@ - return super.getSelectedBoundingBoxFromPool(world, i, j, k); - } - -+ /* FORGE: Implemented base method, see Block.isLadder */ -+ public boolean isLadder() { -+ return true; -+ } -+ - public boolean isOpaqueCube() - { - return false; -@@ -80,37 +85,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); - } - - public void onBlockPlaced(World world, int i, int j, int k, int l) - { - 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)) - { - i1 = 2; - } -- if((i1 == 0 || l == 3) && world.isBlockNormalCube(i, j, k - 1)) -+ if((i1 == 0 || l == 3) && world.isBlockSolidOnSide(i, j, k - 1,3)) - { - i1 = 3; - } -- if((i1 == 0 || l == 4) && world.isBlockNormalCube(i + 1, j, k)) -+ if((i1 == 0 || l == 4) && world.isBlockSolidOnSide(i + 1, j, k,4)) - { - i1 = 4; - } -- if((i1 == 0 || l == 5) && world.isBlockNormalCube(i - 1, j, k)) -+ if((i1 == 0 || l == 5) && world.isBlockSolidOnSide(i - 1, j, k,5)) - { - i1 = 5; - } -@@ -121,19 +126,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)) - { - flag = true; - } -- if(i1 == 3 && world.isBlockNormalCube(i, j, k - 1)) -+ if(i1 == 3 && world.isBlockSolidOnSide(i, j, k - 1,3)) - { - flag = true; - } -- if(i1 == 4 && world.isBlockNormalCube(i + 1, j, k)) -+ if(i1 == 4 && world.isBlockSolidOnSide(i + 1, j, k,4)) - { - flag = true; - } -- if(i1 == 5 && world.isBlockNormalCube(i - 1, j, k)) -+ if(i1 == 5 && world.isBlockSolidOnSide(i - 1, j, k,5)) - { - flag = true; - } -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/BlockLever.java ../src_work/minecraft/net/minecraft/src/BlockLever.java ---- ../src_base/minecraft/net/minecraft/src/BlockLever.java 2011-10-02 14:29:20.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/BlockLever.java 2011-10-02 14:29:22.000000000 -0400 -@@ -40,44 +40,44 @@ - - public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l) - { -- 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); - } - - 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; - } -- 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); - } - - public void onBlockPlaced(World world, int i, int j, int k, int l) -@@ -86,23 +86,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)) - { - i1 = 5 + world.rand.nextInt(2); - } -- if(l == 2 && world.isBlockNormalCube(i, j, k + 1)) -+ if(l == 2 && world.isBlockSolidOnSide(i, j, k + 1,2)) - { - i1 = 4; - } -- if(l == 3 && world.isBlockNormalCube(i, j, k - 1)) -+ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3)) - { - i1 = 3; - } -- if(l == 4 && world.isBlockNormalCube(i + 1, j, k)) -+ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4)) - { - i1 = 2; - } -- if(l == 5 && world.isBlockNormalCube(i - 1, j, k)) -+ if(l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5)) - { - i1 = 1; - } -@@ -124,27 +124,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) - { - flag = true; - } -- if(!world.isBlockNormalCube(i + 1, j, k) && i1 == 2) -+ if(!world.isBlockSolidOnSide(i + 1, j, k,4) && i1 == 2) - { - flag = true; - } -- if(!world.isBlockNormalCube(i, j, k - 1) && i1 == 3) -+ if(!world.isBlockSolidOnSide(i, j, k - 1,3) && i1 == 3) - { - flag = true; - } -- if(!world.isBlockNormalCube(i, j, k + 1) && i1 == 4) -+ if(!world.isBlockSolidOnSide(i, j, k + 1,2) && i1 == 4) - { - flag = true; - } -- if(!world.isBlockNormalCube(i, j - 1, k) && i1 == 5) -+ if(!world.isBlockSolidOnSide(i, j - 1, k,1) && i1 == 5) - { - flag = true; - } -- if(!world.isBlockNormalCube(i, j - 1, k) && i1 == 6) -+ if(!world.isBlockSolidOnSide(i, j - 1, k,1) && i1 == 6) - { - flag = true; - } -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/BlockPressurePlate.java ../src_work/minecraft/net/minecraft/src/BlockPressurePlate.java ---- ../src_base/minecraft/net/minecraft/src/BlockPressurePlate.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/BlockPressurePlate.java 2011-10-02 14:29:22.000000000 -0400 -@@ -46,7 +46,8 @@ - - public boolean canPlaceBlockAt(World world, int i, int j, int k) - { -- 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; - } - - public void onBlockAdded(World world, int i, int j, int k) -@@ -56,7 +57,8 @@ - public void onNeighborBlockChange(World world, int i, int j, int k, int l) - { - 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) - { - flag = true; - } -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/BlockRail.java ../src_work/minecraft/net/minecraft/src/BlockRail.java ---- ../src_base/minecraft/net/minecraft/src/BlockRail.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/BlockRail.java 2011-10-02 14:29:22.000000000 -0400 -@@ -16,12 +16,12 @@ - public static final boolean isRailBlockAt(World world, int i, int j, int k) - { - 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; - } - - public static final boolean isRailBlock(int i) - { -- return i == Block.rail.blockID || i == Block.railPowered.blockID || i == Block.railDetector.blockID; -+ return Block.blocksList[i] instanceof BlockRail; - } - - protected BlockRail(int i, int j, boolean flag) -@@ -97,7 +97,7 @@ - - public boolean canPlaceBlockAt(World world, int i, int j, int k) - { -- return world.isBlockNormalCube(i, j - 1, k); -+ return world.isBlockSolidOnSide(i, j - 1, k,1); - } - - public void onBlockAdded(World world, int i, int j, int k) -@@ -121,23 +121,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; - } -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/BlockRedstoneRepeater.java ../src_work/minecraft/net/minecraft/src/BlockRedstoneRepeater.java ---- ../src_base/minecraft/net/minecraft/src/BlockRedstoneRepeater.java 2011-10-02 14:29:20.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/BlockRedstoneRepeater.java 2011-10-02 14:29:22.000000000 -0400 -@@ -27,7 +27,7 @@ - - public boolean canPlaceBlockAt(World world, int i, int j, int k) - { -- if(!world.isBlockNormalCube(i, j - 1, k)) -+ if(!world.isBlockSolidOnSide(i, j - 1, k,1)) - { - return false; - } else -@@ -38,7 +38,7 @@ - - public boolean canBlockStay(World world, int i, int j, int k) - { -- if(!world.isBlockNormalCube(i, j - 1, k)) -+ if(!world.isBlockSolidOnSide(i, j - 1, k,1)) - { - return false; - } else -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/BlockRedstoneWire.java ../src_work/minecraft/net/minecraft/src/BlockRedstoneWire.java ---- ../src_base/minecraft/net/minecraft/src/BlockRedstoneWire.java 2011-10-02 14:29:20.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/BlockRedstoneWire.java 2011-10-02 14:29:22.000000000 -0400 -@@ -3,6 +3,7 @@ - // Decompiler options: packimports(3) braces deadcode - - package net.minecraft.src; -+import net.minecraft.src.forge.*; - - import java.util.*; - -@@ -53,7 +54,7 @@ - - public boolean canPlaceBlockAt(World world, int i, int j, int k) - { -- return world.isBlockNormalCube(i, j - 1, k); -+ return world.isBlockSolidOnSide(i, j - 1, k, 1); - } - - private void updateAndPropagateCurrentStrength(World world, int i, int j, int k) -@@ -451,6 +452,10 @@ - { - return false; - } -+ if (Block.blocksList[i1] instanceof IConnectRedstone) { -+ IConnectRedstone icr = (IConnectRedstone) Block.blocksList[i1]; -+ return icr.canConnectRedstone(iblockaccess, i, j, k, l); -+ } - if(Block.blocksList[i1].canProvidePower()) - { - return true; -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/BlockTallGrass.java ../src_work/minecraft/net/minecraft/src/BlockTallGrass.java ---- ../src_base/minecraft/net/minecraft/src/BlockTallGrass.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/BlockTallGrass.java 2011-10-02 14:29:22.000000000 -0400 -@@ -4,7 +4,10 @@ - - package net.minecraft.src; - -+import net.minecraft.src.forge.ForgeHooks; -+ - import java.util.Random; -+import java.util.ArrayList; - - // Referenced classes of package net.minecraft.src: - // BlockFlower, ColorizerGrass, ColorizerFoliage, IBlockAccess, -@@ -79,13 +82,17 @@ - - public int idDropped(int i, Random random) - { -- if(random.nextInt(8) == 0) -- { -- return Item.seeds.shiftedIndex; -- } else -- { -- return -1; -- } -+ return -1; -+ } -+ -+ public ArrayList getBlockDropped(World world, -+ int i, int j, int k, int md) { -+ ArrayList tr=new ArrayList(); -+ if(world.rand.nextInt(8)!=0) -+ return tr; -+ ItemStack ist=ForgeHooks.getGrassSeed(world); -+ if(ist!=null) tr.add(ist); -+ return tr; - } - - public void harvestBlock(World world, EntityPlayer entityplayer, int i, int j, int k, int l) -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/BlockTorch.java ../src_work/minecraft/net/minecraft/src/BlockTorch.java ---- ../src_base/minecraft/net/minecraft/src/BlockTorch.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/BlockTorch.java 2011-10-02 14:29:22.000000000 -0400 -@@ -41,24 +41,24 @@ - - private boolean func_31032_h(World world, int i, int j, int k) - { -- return world.isBlockNormalCube(i, j, k) || world.getBlockId(i, j, k) == Block.fence.blockID; -+ return world.isBlockSolidOnSide(i, j, k,1) || world.getBlockId(i, j, k) == Block.fence.blockID; - } - - 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; - } -- if(world.isBlockNormalCube(i, j, k + 1)) -+ if(world.isBlockSolidOnSide(i, j, k + 1,2)) - { - return true; - } -@@ -72,19 +72,19 @@ - { - i1 = 5; - } -- if(l == 2 && world.isBlockNormalCube(i, j, k + 1)) -+ if(l == 2 && world.isBlockSolidOnSide(i, j, k + 1,2)) - { - i1 = 4; - } -- if(l == 3 && world.isBlockNormalCube(i, j, k - 1)) -+ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3)) - { - i1 = 3; - } -- if(l == 4 && world.isBlockNormalCube(i + 1, j, k)) -+ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4)) - { - i1 = 2; - } -- if(l == 5 && world.isBlockNormalCube(i - 1, j, k)) -+ if(l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5)) - { - i1 = 1; - } -@@ -102,19 +102,19 @@ - - public void onBlockAdded(World world, int i, int j, int k) - { -- if(world.isBlockNormalCube(i - 1, j, k)) -+ if(world.isBlockSolidOnSide(i - 1, j, k,5)) - { - world.setBlockMetadataWithNotify(i, j, k, 1); - } else -- if(world.isBlockNormalCube(i + 1, j, k)) -+ if(world.isBlockSolidOnSide(i + 1, j, k,4)) - { - world.setBlockMetadataWithNotify(i, j, k, 2); - } else -- if(world.isBlockNormalCube(i, j, k - 1)) -+ if(world.isBlockSolidOnSide(i, j, k - 1,3)) - { - world.setBlockMetadataWithNotify(i, j, k, 3); - } else -- if(world.isBlockNormalCube(i, j, k + 1)) -+ if(world.isBlockSolidOnSide(i, j, k + 1,2)) - { - world.setBlockMetadataWithNotify(i, j, k, 4); - } else -@@ -131,19 +131,19 @@ - { - int i1 = world.getBlockMetadata(i, j, k); - boolean flag = false; -- if(!world.isBlockNormalCube(i - 1, j, k) && i1 == 1) -+ if(!world.isBlockSolidOnSide(i - 1, j, k,5) && i1 == 1) - { - flag = true; - } -- if(!world.isBlockNormalCube(i + 1, j, k) && i1 == 2) -+ if(!world.isBlockSolidOnSide(i + 1, j, k,4) && i1 == 2) - { - flag = true; - } -- if(!world.isBlockNormalCube(i, j, k - 1) && i1 == 3) -+ if(!world.isBlockSolidOnSide(i, j, k - 1,3) && i1 == 3) - { - flag = true; - } -- if(!world.isBlockNormalCube(i, j, k + 1) && i1 == 4) -+ if(!world.isBlockSolidOnSide(i, j, k + 1,2) && i1 == 4) - { - flag = true; - } -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/BlockTrapDoor.java ../src_work/minecraft/net/minecraft/src/BlockTrapDoor.java ---- ../src_base/minecraft/net/minecraft/src/BlockTrapDoor.java 2011-10-02 14:29:20.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/BlockTrapDoor.java 2011-10-02 14:29:22.000000000 -0400 -@@ -147,7 +147,7 @@ - { - j1--; - } -- if(!world.isBlockNormalCube(j1, j, k1)) -+ if(!disableValidation && !world.isBlockSolidOnSide(j1, j, k1, (i1&3)+2)) - { - world.setBlockWithNotify(i, j, k, 0); - dropBlockAsItem(world, i, j, k, i1); -@@ -189,6 +189,7 @@ - - public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l) - { -+ if(disableValidation) return true; - if(l == 0) - { - return false; -@@ -213,11 +214,15 @@ - { - i--; - } -- return world.isBlockNormalCube(i, j, k); -+ return world.isBlockSolidOnSide(i, j, k, l); - } - - public static boolean isTrapdoorOpen(int i) - { - return (i & 4) != 0; - } -+ -+ /* FORGE: Set this to allow trapdoors to remain free-floating -+ */ -+ public static boolean disableValidation=false; - } -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/Chunk.java ../src_work/minecraft/net/minecraft/src/Chunk.java ---- ../src_base/minecraft/net/minecraft/src/Chunk.java 2011-10-02 14:29:20.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/Chunk.java 2011-10-04 17:42:37.000000000 -0400 -@@ -3,6 +3,7 @@ - // Decompiler options: packimports(3) braces deadcode - - package net.minecraft.src; -+import net.minecraft.src.forge.*; - - import java.io.PrintStream; - import java.util.*; -@@ -26,7 +27,6 @@ - hasEntities = false; - lastSaveTime = 0L; - field_35846_u = false; -- world.getClass(); - entities = new List[128 / 16]; - worldObj = world; - xPosition = i; -@@ -44,11 +44,8 @@ - { - this(world, i, j); - blocks = abyte0; -- world.getClass(); - data = new NibbleArray(abyte0.length, 7); -- world.getClass(); - skylightMap = new NibbleArray(abyte0.length, 7); -- world.getClass(); - blocklightMap = new NibbleArray(abyte0.length, 7); - } - -@@ -68,16 +65,12 @@ - - public void generateHeightMap() - { -- worldObj.getClass(); - int i = 128 - 1; - for(int j = 0; j < 16; j++) - { - for(int k = 0; k < 16; k++) - { -- worldObj.getClass(); - int l = 128 - 1; -- worldObj.getClass(); -- worldObj.getClass(); - for(int i1 = j << 11 | k << 7; l > 0 && Block.lightOpacity[blocks[(i1 + l) - 1] & 0xff] == 0; l--) { } - heightMap[k << 4 | j] = (byte)l; - if(l < i) -@@ -94,16 +87,12 @@ - - public void generateSkylightMap() - { -- worldObj.getClass(); - int i = 128 - 1; - for(int j = 0; j < 16; j++) - { - for(int l = 0; l < 16; l++) - { -- worldObj.getClass(); - int j1 = 128 - 1; -- worldObj.getClass(); -- worldObj.getClass(); - int k1; - for(k1 = j << 11 | l << 7; j1 > 0 && Block.lightOpacity[blocks[(k1 + j1) - 1] & 0xff] == 0; j1--) { } - heightMap[l << 4 | j] = (byte)j1; -@@ -116,7 +105,6 @@ - continue; - } - int l1 = 15; -- worldObj.getClass(); - int i2 = 128 - 1; - do - { -@@ -154,7 +142,6 @@ - - private void func_35839_k() - { -- worldObj.getClass(); - if(worldObj.doChunksNearChunkExist(xPosition * 16 + 8, 128 / 2, zPosition * 16 + 8, 16)) - { - for(int i = 0; i < 16; i++) -@@ -216,7 +203,6 @@ - { - if(l > k) - { -- worldObj.getClass(); - if(worldObj.doChunksNearChunkExist(i, 128 / 2, j, 16)) - { - for(int i1 = k; i1 < l; i1++) -@@ -237,8 +223,6 @@ - { - i1 = j; - } -- worldObj.getClass(); -- worldObj.getClass(); - for(int j1 = i << 11 | k << 7; i1 > 0 && Block.lightOpacity[blocks[(j1 + i1) - 1] & 0xff] == 0; i1--) { } - if(i1 == l) - { -@@ -251,7 +235,6 @@ - lowestBlockHeight = i1; - } else - { -- worldObj.getClass(); - int k1 = 128 - 1; - for(int i2 = 0; i2 < 16; i2++) - { -@@ -320,8 +303,6 @@ - - public int getBlockID(int i, int j, int k) - { -- worldObj.getClass(); -- worldObj.getClass(); - return blocks[i << 11 | k << 7 | j] & 0xff; - } - -@@ -334,8 +315,6 @@ - field_35845_c[j1] = -999; - } - int k1 = heightMap[k << 4 | i] & 0xff; -- worldObj.getClass(); -- worldObj.getClass(); - int l1 = blocks[i << 11 | k << 7 | j] & 0xff; - if(l1 == l && data.getNibble(i, j, k) == i1) - { -@@ -343,12 +322,18 @@ - } - int i2 = xPosition * 16 + i; - int j2 = zPosition * 16 + k; -- worldObj.getClass(); -- worldObj.getClass(); -+ -+ if (Block.blocksList[l1] instanceof IOverrideReplace) { -+ IOverrideReplace iovr = (IOverrideReplace) Block.blocksList[l1]; -+ if (!iovr.canReplaceBlock(worldObj, i2, j, j2, l)) -+ return iovr.getReplacedSuccess(); -+ } -+ - blocks[i << 11 | k << 7 | j] = (byte)(byte0 & 0xff); -- if(l1 != 0 && !worldObj.multiplayerWorld) -- { -- Block.blocksList[l1].onBlockRemoval(worldObj, i2, j, j2); -+ if(l1 != 0) { -+ if(!worldObj.multiplayerWorld) -+ Block.blocksList[l1].onBlockRemoval(worldObj, i2, j, j2); -+ removeChunkBlockTileEntity(i,j,k); - } - data.setNibble(i, j, k, i1); - if(!worldObj.worldProvider.hasNoSky) -@@ -380,7 +365,7 @@ - TileEntity tileentity = getChunkBlockTileEntity(i, j, k); - if(tileentity == null) - { -- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(); -+ tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(i1); - worldObj.setBlockTileEntity(i, j, k, tileentity); - } - if(tileentity != null) -@@ -388,14 +373,6 @@ - tileentity.func_35144_b(); - } - } -- } else -- if(l1 > 0 && (Block.blocksList[l1] instanceof BlockContainer)) -- { -- TileEntity tileentity1 = getChunkBlockTileEntity(i, j, k); -- if(tileentity1 != null) -- { -- tileentity1.func_35144_b(); -- } - } - isModified = true; - return true; -@@ -410,8 +387,6 @@ - field_35845_c[i1] = -999; - } - int j1 = heightMap[i1] & 0xff; -- worldObj.getClass(); -- worldObj.getClass(); - int k1 = blocks[i << 11 | k << 7 | j] & 0xff; - if(k1 == l) - { -@@ -419,12 +394,18 @@ - } - int l1 = xPosition * 16 + i; - int i2 = zPosition * 16 + k; -- worldObj.getClass(); -- worldObj.getClass(); -+ -+ if (Block.blocksList[k1] instanceof IOverrideReplace) { -+ IOverrideReplace iovr = (IOverrideReplace) Block.blocksList[k1]; -+ if (!iovr.canReplaceBlock(worldObj, l1, j, i2, l)) -+ return iovr.getReplacedSuccess(); -+ } -+ - blocks[i << 11 | k << 7 | j] = (byte)(byte0 & 0xff); -- if(k1 != 0) -- { -- Block.blocksList[k1].onBlockRemoval(worldObj, l1, j, i2); -+ if(k1 != 0) { -+ if(!worldObj.multiplayerWorld) -+ Block.blocksList[k1].onBlockRemoval(worldObj, l1, j, i2); -+ removeChunkBlockTileEntity(i,j,k); - } - data.setNibble(i, j, k, 0); - if(Block.lightOpacity[byte0 & 0xff] != 0) -@@ -452,7 +433,7 @@ - TileEntity tileentity = getChunkBlockTileEntity(i, j, k); - if(tileentity == null) - { -- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(); -+ tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(0); - worldObj.setBlockTileEntity(i, j, k, tileentity); - } - if(tileentity != null) -@@ -460,14 +441,6 @@ - tileentity.func_35144_b(); - } - } -- } else -- if(k1 > 0 && (Block.blocksList[k1] instanceof BlockContainer)) -- { -- TileEntity tileentity1 = getChunkBlockTileEntity(i, j, k); -- if(tileentity1 != null) -- { -- tileentity1.func_35144_b(); -- } - } - isModified = true; - return true; -@@ -594,6 +567,11 @@ - { - ChunkPosition chunkposition = new ChunkPosition(i, j, k); - TileEntity tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition); -+ if(tileentity != null && tileentity.isInvalid()) -+ { -+ chunkTileEntityMap.remove(chunkposition); -+ tileentity=null; -+ } - if(tileentity == null) - { - int l = getBlockID(i, j, k); -@@ -603,18 +581,23 @@ - } - if(tileentity == null) - { -- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(); -+ tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(getBlockMetadata(i,j,k)); - worldObj.setBlockTileEntity(xPosition * 16 + i, j, zPosition * 16 + k, tileentity); - } - tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition); - } -- if(tileentity != null && tileentity.isInvalid()) -- { -- chunkTileEntityMap.remove(chunkposition); -- return null; -- } else -+ return tileentity; -+ } -+ -+ /* FORGE: Used to remove only invalid TileEntities */ -+ public void cleanChunkBlockTileEntity(int i, int j, int k) -+ { -+ ChunkPosition chunkposition = new ChunkPosition(i, j, k); -+ if(isChunkLoaded) - { -- return tileentity; -+ TileEntity tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition); -+ if(tileentity!=null && tileentity.isInvalid()) -+ chunkTileEntityMap.remove(chunkposition); - } - } - -@@ -626,7 +609,7 @@ - setChunkBlockTileEntity(i, j, k, tileentity); - if(isChunkLoaded) - { -- worldObj.loadedTileEntityList.add(tileentity); -+ worldObj.addTileEntity(tileentity); - } - } - -@@ -643,6 +626,8 @@ - return; - } else - { -+ TileEntity old=(TileEntity)chunkTileEntityMap.get(chunkposition); -+ if(old!=null) old.invalidate(); - tileentity.validate(); - chunkTileEntityMap.put(chunkposition, tileentity); - return; -@@ -777,8 +762,6 @@ - { - for(int l2 = k; l2 < j1; l2++) - { -- worldObj.getClass(); -- worldObj.getClass(); - int l3 = l1 << 11 | l2 << 7 | j; - int l4 = i1 - j; - System.arraycopy(abyte0, k1, blocks, l3, l4); -@@ -792,8 +775,6 @@ - { - for(int i3 = k; i3 < j1; i3++) - { -- worldObj.getClass(); -- worldObj.getClass(); - int i4 = (i2 << 11 | i3 << 7 | j) >> 1; - int i5 = (i1 - j) / 2; - System.arraycopy(abyte0, k1, data.data, i4, i5); -@@ -806,8 +787,6 @@ - { - for(int j3 = k; j3 < j1; j3++) - { -- worldObj.getClass(); -- worldObj.getClass(); - int j4 = (j2 << 11 | j3 << 7 | j) >> 1; - int j5 = (i1 - j) / 2; - System.arraycopy(abyte0, k1, blocklightMap.data, j4, j5); -@@ -820,8 +799,6 @@ - { - for(int k3 = k; k3 < j1; k3++) - { -- worldObj.getClass(); -- worldObj.getClass(); - int k4 = (k2 << 11 | k3 << 7 | j) >> 1; - int k5 = (i1 - j) / 2; - System.arraycopy(abyte0, k1, skylightMap.data, k4, k5); -@@ -830,11 +807,20 @@ - - } - -+ List invalidList=new ArrayList(); - TileEntity tileentity; - for(Iterator iterator = chunkTileEntityMap.values().iterator(); iterator.hasNext(); tileentity.func_35144_b()) - { - tileentity = (TileEntity)iterator.next(); -+ if( (tileentity.xCoord&15)>=i && (tileentity.xCoord&15)<=l && -+ tileentity.yCoord>=j && tileentity.yCoord<=i1 && -+ (tileentity.zCoord&15)>=k && (tileentity.zCoord&15)<=j1) { -+ -+ invalidList.add(tileentity); -+ } - } -+ for(TileEntity te : invalidList) -+ te.invalidate(); - - return k1; - } -@@ -880,7 +866,6 @@ - int l = field_35845_c[k]; - if(l == -999) - { -- worldObj.getClass(); - int i1 = 128 - 1; - for(l = -1; i1 > 0 && l == -1;) - { -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/EffectRenderer.java ../src_work/minecraft/net/minecraft/src/EffectRenderer.java ---- ../src_base/minecraft/net/minecraft/src/EffectRenderer.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/EffectRenderer.java 2011-10-02 14:29:22.000000000 -0400 -@@ -7,6 +7,9 @@ - import java.util.*; - import org.lwjgl.opengl.GL11; - -+import net.minecraft.src.forge.BlockTextureParticles; -+import net.minecraft.src.forge.ITextureProvider; -+ - // Referenced classes of package net.minecraft.src: - // EntityFX, Entity, MathHelper, RenderEngine, - // Tessellator, Block, EntityDiggingFX, World -@@ -16,6 +19,7 @@ - - public EffectRenderer(World world, RenderEngine renderengine) - { -+ effectList = new ArrayList(); - fxLayers = new List[4]; - rand = new Random(); - if(world != null) -@@ -55,7 +59,18 @@ - } - - } -- -+ for (int x = 0; x < effectList.size(); x++) { -+ BlockTextureParticles entry = (BlockTextureParticles) effectList -+ .get(x); -+ for (int y = 0; y < entry.effects.size(); y++) { -+ EntityFX entityfx = (EntityFX) entry.effects.get(y); -+ if (entityfx.isDead) { -+ entry.effects.remove(y--); -+ } -+ } -+ if (effectList.size() == 0) -+ effectList.remove(x--); -+ } - } - - public void renderParticles(Entity entity, float f) -@@ -94,6 +109,7 @@ - for(int k = 0; k < fxLayers[i].size(); k++) - { - EntityFX entityfx = (EntityFX)fxLayers[i].get(k); -+ if(entityfx instanceof EntityDiggingFX) continue; - tessellator.setBrightness(entityfx.func_35115_a(f)); - entityfx.renderParticle(tessellator, f, f1, f5, f2, f3, f4); - } -@@ -101,6 +117,21 @@ - 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++) { -+ EntityFX entityfx = (EntityFX) entry.effects.get(y); -+ tessellator.setBrightness(entityfx.func_35115_a(f)); -+ entityfx.renderParticle(tessellator, f, f1, f5, f2, f3, f4); -+ } -+ tessellator.draw(); -+ } -+ - } - - public void func_1187_b(Entity entity, float f) -@@ -132,7 +163,12 @@ - { - fxLayers[i].clear(); - } -- -+ for (int x = 0; x < effectList.size(); x++) { -+ BlockTextureParticles entry = (BlockTextureParticles) effectList -+ .get(x); -+ entry.effects.clear(); -+ } -+ effectList.clear(); - } - - public void addBlockDestroyEffects(int i, int j, int k, int l, int i1) -@@ -153,7 +189,12 @@ - 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); - } - - } -@@ -198,16 +239,48 @@ - { - d = (double)i + block.maxX + (double)f; - } -- 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).func_407_b(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.func_407_b(0.2F); -+ 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; -+ -+ if (block instanceof ITextureProvider) { -+ comp = ((ITextureProvider) block).getTextureFile(); -+ } else { -+ comp = "/terrain.png"; -+ } -+ for (int x = 0; x < effectList.size(); x++) { -+ BlockTextureParticles entry = (BlockTextureParticles) effectList -+ .get(x); -+ if (entry.texture.equals(comp)) { -+ entry.effects.add(dig_effect); -+ added = true; -+ } -+ } -+ if (!added) { -+ BlockTextureParticles entry = new BlockTextureParticles(); -+ entry.texture = comp; -+ entry.effects.add(dig_effect); -+ effectList.add(entry); -+ } -+ addEffect(dig_effect); -+ } - - protected World worldObj; - private List fxLayers[]; -+ private List effectList; - private RenderEngine renderer; - private Random rand; - } -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/EntityLiving.java ../src_work/minecraft/net/minecraft/src/EntityLiving.java ---- ../src_base/minecraft/net/minecraft/src/EntityLiving.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/EntityLiving.java 2011-10-02 14:29:22.000000000 -0400 -@@ -624,7 +624,9 @@ - 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(); - } - - public void writeEntityToNBT(NBTTagCompound nbttagcompound) -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/EntityPlayer.java ../src_work/minecraft/net/minecraft/src/EntityPlayer.java ---- ../src_base/minecraft/net/minecraft/src/EntityPlayer.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/EntityPlayer.java 2011-10-02 14:29:22.000000000 -0400 -@@ -4,6 +4,10 @@ - - package net.minecraft.src; - -+import net.minecraft.src.forge.ArmorProperties; -+import net.minecraft.src.forge.ISpecialArmor; -+import net.minecraft.src.forge.ForgeHooks; -+ - import java.util.*; - - // Referenced classes of package net.minecraft.src: -@@ -485,6 +489,8 @@ - worldObj.entityJoinedWorld(entityitem); - } - -+ /* FORGE: This isn't called anymore -+ */ - public float getCurrentPlayerStrVsBlock(Block block) - { - float f = inventory.getStrVsBlock(block); -@@ -507,6 +513,32 @@ - return f; - } - -+ /* 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); -+ if(isInsideOfMaterial(Material.water)) -+ { -+ f /= 5F; -+ } -+ if(!onGround) -+ { -+ f /= 5F; -+ } -+ if(isPotionActive(Potion.potionDigSpeed)) -+ { -+ f *= 1.0F + (float)(getActivePotionEffect(Potion.potionDigSpeed).getAmplifier() + 1) * 0.2F; -+ } -+ if(isPotionActive(Potion.potionDigSlow)) -+ { -+ f *= 1.0F - (float)(getActivePotionEffect(Potion.potionDigSlow).getAmplifier() + 1) * 0.2F; -+ } -+ return f; -+ } -+ - public boolean canHarvestBlock(Block block) - { - return inventory.canHarvestBlock(block); -@@ -720,7 +752,9 @@ - - public void destroyCurrentEquippedItem() - { -+ ItemStack orig=inventory.getCurrentItem(); - inventory.setInventorySlotContents(inventory.currentItem, null); -+ ForgeHooks.onDestroyCurrentItem(this,orig); - } - - public double getYOffset() -@@ -815,6 +849,10 @@ - - public EnumStatus sleepInBedAt(int i, int j, int k) - { -+ EnumStatus customSleep = ForgeHooks.sleepInBedAt(this, i, j, k); -+ if (customSleep != null) { -+ return customSleep; -+ } - if(!worldObj.multiplayerWorld) - { - if(isPlayerSleeping() || !isEntityAlive()) -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/EntityRenderer.java ../src_work/minecraft/net/minecraft/src/EntityRenderer.java ---- ../src_base/minecraft/net/minecraft/src/EntityRenderer.java 2011-10-02 14:29:20.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/EntityRenderer.java 2011-10-02 14:29:22.000000000 -0400 -@@ -4,6 +4,7 @@ - - package net.minecraft.src; - -+import net.minecraft.src.forge.ForgeHooksClient; - import java.awt.image.BufferedImage; - import java.nio.FloatBuffer; - import java.util.Random; -@@ -803,8 +804,12 @@ - { - EntityPlayer entityplayer = (EntityPlayer)entityliving; - GL11.glDisable(3008 /*GL_ALPHA_TEST*/); -+ if(!ForgeHooksClient.onBlockHighlight(renderglobal,entityplayer, -+ mc.objectMouseOver,0, -+ entityplayer.inventory.getCurrentItem(),f)) { - renderglobal.drawBlockBreaking(entityplayer, mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), f); - renderglobal.drawSelectionBox(entityplayer, mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), f); -+ } - GL11.glEnable(3008 /*GL_ALPHA_TEST*/); - } - } -@@ -853,8 +858,12 @@ - { - EntityPlayer entityplayer1 = (EntityPlayer)entityliving; - GL11.glDisable(3008 /*GL_ALPHA_TEST*/); -+ if(!ForgeHooksClient.onBlockHighlight(renderglobal,entityplayer1, -+ mc.objectMouseOver,0, -+ entityplayer1.inventory.getCurrentItem(),f)) { - renderglobal.drawBlockBreaking(entityplayer1, mc.objectMouseOver, 0, entityplayer1.inventory.getCurrentItem(), f); - renderglobal.drawSelectionBox(entityplayer1, mc.objectMouseOver, 0, entityplayer1.inventory.getCurrentItem(), f); -+ } - GL11.glEnable(3008 /*GL_ALPHA_TEST*/); - } - renderRainSnow(f); -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/Explosion.java ../src_work/minecraft/net/minecraft/src/Explosion.java ---- ../src_base/minecraft/net/minecraft/src/Explosion.java 2011-10-02 14:29:20.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/Explosion.java 2011-10-02 14:29:22.000000000 -0400 -@@ -5,6 +5,7 @@ - package net.minecraft.src; - - import java.util.*; -+import net.minecraft.src.forge.ISpecialResistance; - - // Referenced classes of package net.minecraft.src: - // World, MathHelper, Block, ChunkPosition, -@@ -66,7 +67,17 @@ - int i5 = worldObj.getBlockId(j4, k4, l4); - if(i5 > 0) - { -- f1 -= (Block.blocksList[i5].getExplosionResistance(exploder) + 0.3F) * f2; -+ if (Block.blocksList[i5] instanceof ISpecialResistance) { -+ ISpecialResistance isr = (ISpecialResistance) Block.blocksList[i5]; -+ f1 -= (isr.getSpecialExplosionResistance( -+ worldObj, j4, k4, l4, explosionX, -+ explosionY, explosionZ, exploder) + 0.3F) -+ * f2; -+ } else { -+ f1 -= (Block.blocksList[i5] -+ .getExplosionResistance(exploder) + 0.3F) -+ * f2; -+ } - } - if(f1 > 0.0F) - { -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/FurnaceRecipes.java ../src_work/minecraft/net/minecraft/src/FurnaceRecipes.java ---- ../src_base/minecraft/net/minecraft/src/FurnaceRecipes.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/FurnaceRecipes.java 2011-10-02 14:29:22.000000000 -0400 -@@ -6,6 +6,7 @@ - - import java.util.HashMap; - import java.util.Map; -+import java.util.Arrays; - - // Referenced classes of package net.minecraft.src: - // Block, ItemStack, Item -@@ -21,6 +22,7 @@ - private FurnaceRecipes() - { - 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)); -@@ -40,11 +42,32 @@ - smeltingList.put(Integer.valueOf(i), itemstack); - } - -+ /* FORGE: Add a metadata-sensitive furnace recipe. -+ */ -+ public void addSmelting(int i, int meta, ItemStack itemstack) -+ { -+ metaSmeltingList.put(Arrays.asList(i,meta), itemstack); -+ } -+ -+ /* FORGE: Not used anymore. -+ */ - public ItemStack getSmeltingResult(int i) - { - return (ItemStack)smeltingList.get(Integer.valueOf(i)); - } - -+ /* FORGE: Added to allow metadata-sensitive smelting. -+ */ -+ public ItemStack getSmeltingResult(ItemStack src) { -+ ItemStack tr; -+ -+ if(src==null) return null; -+ tr=(ItemStack)metaSmeltingList.get( -+ Arrays.asList(src.itemID,src.getItemDamage())); -+ if(tr!=null) return tr; -+ return (ItemStack)smeltingList.get(Integer.valueOf(src.itemID)); -+ } -+ - public Map getSmeltingList() - { - return smeltingList; -@@ -52,5 +75,6 @@ - - private static final FurnaceRecipes smeltingBase = new FurnaceRecipes(); - private Map smeltingList; -+ private Map metaSmeltingList; - - } -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/ItemBlock.java ../src_work/minecraft/net/minecraft/src/ItemBlock.java ---- ../src_base/minecraft/net/minecraft/src/ItemBlock.java 2011-10-02 14:29:20.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/ItemBlock.java 2011-10-02 14:29:22.000000000 -0400 -@@ -62,7 +62,7 @@ - { - return false; - } -- if(!entityplayer.func_35190_e(i, j, k)) -+ if(entityplayer!=null && !entityplayer.func_35190_e(i, j, k)) - { - return false; - } -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/ItemBucket.java ../src_work/minecraft/net/minecraft/src/ItemBucket.java ---- ../src_base/minecraft/net/minecraft/src/ItemBucket.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/ItemBucket.java 2011-10-02 14:29:22.000000000 -0400 -@@ -6,6 +6,8 @@ - - import java.util.Random; - -+import net.minecraft.src.forge.MinecraftForge; -+ - // Referenced classes of package net.minecraft.src: - // Item, EntityPlayer, Vec3D, MathHelper, - // World, MovingObjectPosition, EnumMovingObjectType, Material, -@@ -60,6 +62,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); -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/ItemDye.java ../src_work/minecraft/net/minecraft/src/ItemDye.java ---- ../src_base/minecraft/net/minecraft/src/ItemDye.java 2011-10-02 14:29:20.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/ItemDye.java 2011-10-02 14:29:22.000000000 -0400 -@@ -3,6 +3,7 @@ - // Decompiler options: packimports(3) braces deadcode - - package net.minecraft.src; -+import net.minecraft.src.forge.ForgeHooks; - - import java.util.Random; - -@@ -35,13 +36,18 @@ - - public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l) - { -- if(!entityplayer.func_35190_e(i, j, k)) -+ if(entityplayer!=null && !entityplayer.func_35190_e(i, j, k)) - { - return false; - } - if(itemstack.getItemDamage() == 15) - { - int i1 = world.getBlockId(i, j, k); -+ if(ForgeHooks.onUseBonemeal(world,i1,i,j,k)) { -+ if(!world.multiplayerWorld) -+ itemstack.stackSize--; -+ return true; -+ } - if(i1 == Block.sapling.blockID) - { - if(!world.multiplayerWorld) -@@ -108,13 +114,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); - } - - } -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/ItemFlintAndSteel.java ../src_work/minecraft/net/minecraft/src/ItemFlintAndSteel.java ---- ../src_base/minecraft/net/minecraft/src/ItemFlintAndSteel.java 2011-10-02 14:29:20.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/ItemFlintAndSteel.java 2011-10-02 14:29:22.000000000 -0400 -@@ -46,7 +46,7 @@ - { - i++; - } -- if(!entityplayer.func_35190_e(i, j, k)) -+ if(entityplayer!=null && !entityplayer.func_35190_e(i, j, k)) - { - return false; - } -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/ItemHoe.java ../src_work/minecraft/net/minecraft/src/ItemHoe.java ---- ../src_base/minecraft/net/minecraft/src/ItemHoe.java 2011-10-02 14:29:20.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/ItemHoe.java 2011-10-02 14:29:22.000000000 -0400 -@@ -21,7 +21,7 @@ - - public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l) - { -- if(!entityplayer.func_35190_e(i, j, k)) -+ if(entityplayer!=null && !entityplayer.func_35190_e(i, j, k)) - { - return false; - } -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/Item.java ../src_work/minecraft/net/minecraft/src/Item.java ---- ../src_base/minecraft/net/minecraft/src/Item.java 2011-10-02 14:29:20.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/Item.java 2011-10-02 14:29:22.000000000 -0400 -@@ -76,6 +76,13 @@ - return 1.0F; - } - -+ /* FORGE: Metadata-sensitive version of getStrVsBlock -+ */ -+ public float getStrVsBlock(ItemStack itemstack, Block block, int md) -+ { -+ return getStrVsBlock(itemstack,block); -+ } -+ - public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) - { - return itemstack; -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/ItemRedstone.java ../src_work/minecraft/net/minecraft/src/ItemRedstone.java ---- ../src_base/minecraft/net/minecraft/src/ItemRedstone.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/ItemRedstone.java 2011-10-02 14:29:22.000000000 -0400 -@@ -50,7 +50,7 @@ - return false; - } - } -- if(!entityplayer.func_35190_e(i, j, k)) -+ if(entityplayer!=null && !entityplayer.func_35190_e(i, j, k)) - { - return false; - } -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/ItemReed.java ../src_work/minecraft/net/minecraft/src/ItemReed.java ---- ../src_base/minecraft/net/minecraft/src/ItemReed.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/ItemReed.java 2011-10-02 14:29:22.000000000 -0400 -@@ -52,7 +52,7 @@ - i++; - } - } -- if(!entityplayer.func_35190_e(i, j, k)) -+ if(entityplayer!=null && !entityplayer.func_35190_e(i, j, k)) - { - return false; - } -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/ItemRenderer.java ../src_work/minecraft/net/minecraft/src/ItemRenderer.java ---- ../src_base/minecraft/net/minecraft/src/ItemRenderer.java 2011-10-02 14:29:20.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/ItemRenderer.java 2011-10-02 14:29:22.000000000 -0400 -@@ -5,6 +5,10 @@ - package net.minecraft.src; - - import net.minecraft.client.Minecraft; -+import net.minecraft.src.forge.ForgeHooksClient; -+import net.minecraft.src.forge.ICustomItemRenderer; -+import net.minecraft.src.forge.MinecraftForgeClient; -+ - import org.lwjgl.opengl.GL11; - import org.lwjgl.opengl.GL13; - -@@ -32,18 +36,27 @@ - public void renderItem(EntityLiving entityliving, ItemStack itemstack) - { - GL11.glPushMatrix(); -- if(itemstack.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType())) -+ ICustomItemRenderer customRenderer = MinecraftForgeClient.getCustomItemRenderer(itemstack.itemID); -+ -+ if (customRenderer != null) { -+ GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/terrain.png")); -+ ForgeHooksClient.overrideTexture (itemstack.getItem()); -+ 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(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/terrain.png")); -+ ForgeHooksClient.overrideTexture (Block.blocksList[itemstack.itemID]); - renderBlocksInstance.renderBlockOnInventory(Block.blocksList[itemstack.itemID], itemstack.getItemDamage(), 1.0F); - } else - { - if(itemstack.itemID < 256) - { - GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/terrain.png")); -+ ForgeHooksClient.overrideTexture (Block.blocksList[itemstack.itemID]); - } else - { - GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/gui/items.png")); -+ ForgeHooksClient.overrideTexture (Item.itemsList[itemstack.itemID]); - } - Tessellator tessellator = Tessellator.instance; - int i = entityliving.getItemIcon(itemstack); -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/ItemSeeds.java ../src_work/minecraft/net/minecraft/src/ItemSeeds.java ---- ../src_base/minecraft/net/minecraft/src/ItemSeeds.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/ItemSeeds.java 2011-10-02 14:29:22.000000000 -0400 -@@ -24,7 +24,7 @@ - { - return false; - } -- if(!entityplayer.func_35190_e(i, j, k) || !entityplayer.func_35190_e(i, j + 1, k)) -+ if(entityplayer!=null && (!entityplayer.func_35190_e(i, j, k) || !entityplayer.func_35190_e(i, j + 1, k))) - { - return false; - } -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/ItemTool.java ../src_work/minecraft/net/minecraft/src/ItemTool.java ---- ../src_base/minecraft/net/minecraft/src/ItemTool.java 2011-10-02 14:29:20.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/ItemTool.java 2011-10-02 14:29:22.000000000 -0400 -@@ -4,6 +4,8 @@ - - package net.minecraft.src; - -+import java.util.Arrays; -+import net.minecraft.src.forge.ForgeHooks; - - // Referenced classes of package net.minecraft.src: - // Item, EnumToolMaterial, ItemStack, Block, -@@ -37,6 +39,14 @@ - return 1.0F; - } - -+ /* FORGE: Overridden to allow custom tool effectiveness -+ */ -+ 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) - { - itemstack.damageItem(2, entityliving1); -@@ -60,7 +70,7 @@ - } - - private Block blocksEffectiveAgainst[]; -- private float efficiencyOnProperMaterial; -- private int damageVsEntity; -+ public float efficiencyOnProperMaterial; -+ public int damageVsEntity; - protected EnumToolMaterial toolMaterial; - } -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/MovingObjectPosition.java ../src_work/minecraft/net/minecraft/src/MovingObjectPosition.java ---- ../src_base/minecraft/net/minecraft/src/MovingObjectPosition.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/MovingObjectPosition.java 2011-10-02 14:29:22.000000000 -0400 -@@ -35,4 +35,7 @@ - public int sideHit; - public Vec3D hitVec; - public Entity entityHit; -+ -+ // Added for RedPower subblocks. -+ public int subHit=-1; - } -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/PlayerController.java ../src_work/minecraft/net/minecraft/src/PlayerController.java ---- ../src_base/minecraft/net/minecraft/src/PlayerController.java 2011-10-02 14:29:20.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/PlayerController.java 2011-10-02 14:29:22.000000000 -0400 -@@ -3,6 +3,7 @@ - // Decompiler options: packimports(3) braces deadcode - - package net.minecraft.src; -+import net.minecraft.src.forge.*; - - import net.minecraft.client.Minecraft; - -@@ -64,6 +65,7 @@ - if(itemstack1.stackSize == 0) - { - entityplayer.inventory.mainInventory[entityplayer.inventory.currentItem] = null; -+ ForgeHooks.onDestroyCurrentItem(entityplayer,itemstack1); - } - return true; - } else -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/PlayerControllerMP.java ../src_work/minecraft/net/minecraft/src/PlayerControllerMP.java ---- ../src_base/minecraft/net/minecraft/src/PlayerControllerMP.java 2011-10-02 14:29:20.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/PlayerControllerMP.java 2011-10-02 14:31:02.000000000 -0400 -@@ -4,6 +4,9 @@ - - package net.minecraft.src; - -+import net.minecraft.src.forge.IUseItemFirst; -+import net.minecraft.src.forge.ForgeHooks; -+ - import net.minecraft.client.Minecraft; - - // Referenced classes of package net.minecraft.src: -@@ -91,7 +94,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) - { - sendBlockRemoved(i, j, k, l); - } else -@@ -137,7 +140,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.stepSoundDir2(), (float)i + 0.5F, (float)j + 0.5F, (float)k + 0.5F, (block.stepSound.getVolume() + 1.0F) / 8F, block.stepSound.getPitch() * 0.5F); -@@ -204,6 +207,13 @@ - { - syncCurrentPlayItem(); - netClientHandler.addToSendQueue(new Packet15Place(i, j, k, l, entityplayer.inventory.getCurrentItem())); -+ -+ if (itemstack != null && itemstack.getItem() instanceof IUseItemFirst) { -+ IUseItemFirst iuif = (IUseItemFirst) itemstack.getItem(); -+ if (iuif.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)) - { -@@ -223,7 +233,11 @@ - return flag; - } 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); -+ return true; - } - } - -Only in ../src_work/minecraft/net/minecraft/src: PlayerControllerMP.java.orig -Only in ../src_work/minecraft/net/minecraft/src: PlayerControllerMP.java.rej -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/PlayerControllerSP.java ../src_work/minecraft/net/minecraft/src/PlayerControllerSP.java ---- ../src_base/minecraft/net/minecraft/src/PlayerControllerSP.java 2011-10-02 14:29:20.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/PlayerControllerSP.java 2011-10-02 14:29:22.000000000 -0400 -@@ -3,6 +3,8 @@ - // Decompiler options: packimports(3) braces deadcode - - package net.minecraft.src; -+import net.minecraft.src.forge.IUseItemFirst; -+import net.minecraft.src.forge.ForgeHooks; - - import net.minecraft.client.Minecraft; - -@@ -42,7 +44,7 @@ - int j1 = mc.theWorld.getBlockMetadata(i, j, k); - boolean flag = super.sendBlockRemoved(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); -@@ -71,7 +73,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) - { - sendBlockRemoved(i, j, k, l); - } -@@ -102,7 +104,7 @@ - return; - } - Block block = Block.blocksList[i1]; -- curBlockDamage += block.blockStrength(mc.thePlayer); -+ curBlockDamage += block.blockStrength(mc.theWorld,mc.thePlayer,i,j,k); - if(field_1069_h % 4F == 0.0F && block != null) - { - mc.sndManager.playSound(block.stepSound.stepSoundDir2(), (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 +167,12 @@ - - public boolean sendPlaceBlock(EntityPlayer entityplayer, World world, ItemStack itemstack, int i, int j, int k, int l) - { -+ if (itemstack != null && itemstack.getItem() instanceof IUseItemFirst) { -+ IUseItemFirst iuif = (IUseItemFirst) itemstack.getItem(); -+ if (iuif.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)) - { -@@ -175,7 +183,11 @@ - return false; - } 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); -+ return true; - } - } - -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/RenderBlocks.java ../src_work/minecraft/net/minecraft/src/RenderBlocks.java ---- ../src_base/minecraft/net/minecraft/src/RenderBlocks.java 2011-10-02 14:29:20.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/RenderBlocks.java 2011-10-02 14:29:22.000000000 -0400 -@@ -2980,7 +2980,7 @@ - colorBlueTopRight *= f27; - int j2 = block.getBlockTexture(blockAccess, i, j, k, 2); - renderEastFace(block, i, j, k, j2); -- if(cfgGrassFix && j2 == 3 && overrideBlockTexture < 0) -+ if(Tessellator.instance.defaultTexture && cfgGrassFix && j2 == 3 && overrideBlockTexture < 0) - { - colorRedTopLeft *= f; - colorRedBottomLeft *= f; -@@ -3085,7 +3085,7 @@ - colorBlueTopRight *= f28; - int k2 = block.getBlockTexture(blockAccess, i, j, k, 3); - renderWestFace(block, i, j, k, block.getBlockTexture(blockAccess, i, j, k, 3)); -- if(cfgGrassFix && k2 == 3 && overrideBlockTexture < 0) -+ if(Tessellator.instance.defaultTexture && cfgGrassFix && k2 == 3 && overrideBlockTexture < 0) - { - colorRedTopLeft *= f; - colorRedBottomLeft *= f; -@@ -3190,7 +3190,7 @@ - colorBlueTopRight *= f29; - int l2 = block.getBlockTexture(blockAccess, i, j, k, 4); - renderNorthFace(block, i, j, k, l2); -- if(cfgGrassFix && l2 == 3 && overrideBlockTexture < 0) -+ if(Tessellator.instance.defaultTexture && cfgGrassFix && l2 == 3 && overrideBlockTexture < 0) - { - colorRedTopLeft *= f; - colorRedBottomLeft *= f; -@@ -3295,7 +3295,7 @@ - colorBlueTopRight *= f30; - int i3 = block.getBlockTexture(blockAccess, i, j, k, 5); - renderSouthFace(block, i, j, k, i3); -- if(cfgGrassFix && i3 == 3 && overrideBlockTexture < 0) -+ if(Tessellator.instance.defaultTexture && cfgGrassFix && i3 == 3 && overrideBlockTexture < 0) - { - colorRedTopLeft *= f; - colorRedBottomLeft *= f; -@@ -3388,7 +3388,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) - { - tessellator.setColorOpaque_F(f11 * f, f14 * f1, f17 * f2); - renderEastFace(block, i, j, k, 38); -@@ -3401,7 +3401,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) - { - tessellator.setColorOpaque_F(f11 * f, f14 * f1, f17 * f2); - renderWestFace(block, i, j, k, 38); -@@ -3414,7 +3414,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) - { - tessellator.setColorOpaque_F(f12 * f, f15 * f1, f18 * f2); - renderNorthFace(block, i, j, k, 38); -@@ -3427,7 +3427,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) - { - tessellator.setColorOpaque_F(f12 * f, f15 * f1, f18 * f2); - renderSouthFace(block, i, j, k, 38); -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/RenderEngine.java ../src_work/minecraft/net/minecraft/src/RenderEngine.java ---- ../src_base/minecraft/net/minecraft/src/RenderEngine.java 2011-10-02 14:29:20.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/RenderEngine.java 2011-10-05 18:51:03.000000000 -0400 -@@ -128,6 +128,9 @@ - } - try - { -+ 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); -@@ -667,7 +670,7 @@ - private GameSettings options; - public boolean clampTexture; - public boolean blurTexture; -- private TexturePackList texturePack; -+ public TexturePackList texturePack; - private BufferedImage missingTextureImage; - - } -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/RenderGlobal.java ../src_work/minecraft/net/minecraft/src/RenderGlobal.java ---- ../src_base/minecraft/net/minecraft/src/RenderGlobal.java 2011-10-02 14:29:20.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/RenderGlobal.java 2011-10-02 14:29:22.000000000 -0400 -@@ -1635,8 +1635,8 @@ - } - - public List tileEntities; -- private World worldObj; -- private RenderEngine renderEngine; -+ public World worldObj; -+ public RenderEngine renderEngine; - private List worldRenderersToUpdate; - private WorldRenderer sortedWorldRenderers[]; - private WorldRenderer worldRenderers[]; -@@ -1644,8 +1644,8 @@ - private int renderChunksTall; - private int renderChunksDeep; - private int glRenderListBase; -- private Minecraft mc; -- private RenderBlocks globalRenderBlocks; -+ public Minecraft mc; -+ public RenderBlocks globalRenderBlocks; - private IntBuffer glOcclusionQueryBase; - private boolean occlusionEnabled; - private int cloudOffsetX; -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/RenderItem.java ../src_work/minecraft/net/minecraft/src/RenderItem.java ---- ../src_base/minecraft/net/minecraft/src/RenderItem.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/RenderItem.java 2011-10-02 14:29:22.000000000 -0400 -@@ -4,6 +4,10 @@ - - package net.minecraft.src; - -+import net.minecraft.src.forge.ForgeHooksClient; -+import net.minecraft.src.forge.ICustomItemRenderer; -+import net.minecraft.src.forge.MinecraftForgeClient; -+ - import java.util.Random; - import org.lwjgl.opengl.GL11; - -@@ -47,10 +51,36 @@ - } - 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); -+ -+ if (customRenderer != null) { -+ GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F); -+ loadTexture("/terrain.png"); -+ ForgeHooksClient.overrideTexture(itemstack.getItem()); -+ float f4 = 0.25F; -+ f4 = 0.5F; -+ GL11.glScalef(f4, f4, f4); -+ for(int j = 0; j < byte0; j++) -+ { -+ GL11.glPushMatrix(); -+ 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); -+ } -+ ForgeHooksClient.renderCustomItem(customRenderer, renderBlocks, -+ itemstack.itemID, itemstack.getItemDamage(), -+ entityitem.getEntityBrightness(f1)); -+ GL11.glPopMatrix(); -+ } -+ } else if(itemstack.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType())) - { - GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F); - loadTexture("/terrain.png"); -+ ForgeHooksClient.overrideTexture(Block.blocksList[itemstack.itemID]); - float f4 = 0.25F; - int j = Block.blocksList[itemstack.itemID].getRenderType(); - if(j == 1 || j == 19 || j == 12 || j == 2) -@@ -80,9 +110,11 @@ - if(itemstack.itemID < 256) - { - loadTexture("/terrain.png"); -+ ForgeHooksClient.overrideTexture(Block.blocksList[itemstack.itemID]); - } else - { - loadTexture("/gui/items.png"); -+ ForgeHooksClient.overrideTexture(Item.itemsList[itemstack.itemID]); - } - Tessellator tessellator = Tessellator.instance; - float f5 = (float)((i % 16) * 16 + 0) / 256F; -@@ -129,10 +161,37 @@ - - 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; -+ renderengine.bindTexture(renderengine.getTexture("/terrain.png")); -+ Item item = Item.itemsList[i]; -+ ForgeHooksClient.overrideTexture (Item.itemsList [i]); -+ GL11.glPushMatrix(); -+ GL11.glTranslatef(l - 2, i1 + 3, -3F); -+ 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); -+ 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())) - { - int j1 = i; - renderengine.bindTexture(renderengine.getTexture("/terrain.png")); -+ ForgeHooksClient.overrideTexture (Block.blocksList[i]); - Block block = Block.blocksList[j1]; - GL11.glPushMatrix(); - GL11.glTranslatef(l - 2, i1 + 3, -3F); -@@ -161,9 +220,11 @@ - if(i < 256) - { - renderengine.bindTexture(renderengine.getTexture("/terrain.png")); -+ ForgeHooksClient.overrideTexture (Block.blocksList[i]); - } else - { - renderengine.bindTexture(renderengine.getTexture("/gui/items.png")); -+ ForgeHooksClient.overrideTexture(Item.itemsList[i]); - } - int k1 = Item.itemsList[i].getColorFromDamage(j); - float f = (float)(k1 >> 16 & 0xff) / 255F; -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/RenderPlayer.java ../src_work/minecraft/net/minecraft/src/RenderPlayer.java ---- ../src_base/minecraft/net/minecraft/src/RenderPlayer.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/RenderPlayer.java 2011-10-02 14:29:22.000000000 -0400 -@@ -4,6 +4,7 @@ - - package net.minecraft.src; - -+import net.minecraft.src.forge.IArmorTextureProvider; - import net.minecraft.client.Minecraft; - import org.lwjgl.opengl.GL11; - -@@ -34,7 +35,14 @@ - if(item 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 ) -+ { -+ loadTexture( ((IArmorTextureProvider)item).getArmorTextureFile(itemstack) ); -+ } -+ 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; -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/SlotCrafting.java ../src_work/minecraft/net/minecraft/src/SlotCrafting.java ---- ../src_base/minecraft/net/minecraft/src/SlotCrafting.java 2011-10-02 14:29:20.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/SlotCrafting.java 2011-10-02 14:29:22.000000000 -0400 -@@ -3,6 +3,7 @@ - // Decompiler options: packimports(3) braces deadcode - - package net.minecraft.src; -+import net.minecraft.src.forge.ForgeHooks; - - - // Referenced classes of package net.minecraft.src: -@@ -60,6 +61,7 @@ - thePlayer.addStat(AchievementList.buildSword, 1); - } - ModLoader.TakenFromCrafting(thePlayer, itemstack, craftMatrix); -+ ForgeHooks.onTakenFromCrafting(thePlayer, itemstack, craftMatrix); - for(int i = 0; i < craftMatrix.getSizeInventory(); i++) - { - ItemStack itemstack1 = craftMatrix.getStackInSlot(i); -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/Tessellator.java ../src_work/minecraft/net/minecraft/src/Tessellator.java ---- ../src_base/minecraft/net/minecraft/src/Tessellator.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/Tessellator.java 2011-10-02 14:37:42.000000000 -0400 -@@ -5,6 +5,7 @@ - package net.minecraft.src; - - import java.nio.*; -+import java.util.*; - import org.lwjgl.opengl.*; - - // Referenced classes of package net.minecraft.src: -@@ -13,8 +14,7 @@ - public class Tessellator - { - -- private Tessellator(int i) -- { -+ public Tessellator() { - vertexCount = 0; - hasColor = false; - hasTexture = false; -@@ -24,21 +24,10 @@ - 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 void draw() -@@ -48,12 +37,20 @@ - throw new IllegalStateException("Not tesselating!"); - } - isDrawing = false; -- if(vertexCount > 0) -- { -+ int offs=0; -+ while(offs < vertexCount) { -+ 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; - if(useVBO) - { - vboIndex = (vboIndex + 1) % vboCount; -@@ -121,10 +118,10 @@ - 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) -@@ -146,6 +143,10 @@ - GL11.glDisableClientState(32885 /*GL_NORMAL_ARRAY_EXT*/); - } - } -+ if(rawBufferSize>0x20000 && rawBufferIndex<(rawBufferSize<<3)) { -+ rawBufferSize=0; -+ rawBuffer=null; -+ } - reset(); - } - -@@ -265,6 +266,15 @@ - - public void addVertex(double d, double d1, double d2) - { -+ 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) - { -@@ -314,11 +324,6 @@ - rawBuffer[rawBufferIndex + 2] = Float.floatToRawIntBits((float)(d2 + zOffset)); - rawBufferIndex += 8; - vertexCount++; -- if(vertexCount % 4 == 0 && rawBufferIndex >= bufferSize - 32) -- { -- draw(); -- isDrawing = true; -- } - } - - public void setColorOpaque_I(int i) -@@ -367,10 +372,7 @@ - - private static boolean convertQuadsToTriangles = false; - private static boolean tryVBO = false; -- private ByteBuffer byteBuffer; -- private IntBuffer intBuffer; -- private FloatBuffer floatBuffer; -- private ShortBuffer shortBuffer; -+ private static boolean useVBO = false; - private int rawBuffer[]; - private int vertexCount; - private double textureU; -@@ -384,17 +386,43 @@ - private int rawBufferIndex; - private int addedVertices; - private boolean isColorDisabled; -- private int drawMode; -- private double xOffset; -- private double yOffset; -- private double zOffset; -+ public int drawMode; -+ public double xOffset; -+ public double yOffset; -+ public double zOffset; - private int normal; -- public static final Tessellator instance = new Tessellator(0x200000); -- private boolean isDrawing; -- private boolean useVBO; -- 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(); -+ useVBO = tryVBO && GLContext.getCapabilities().GL_ARB_vertex_buffer_object; -+ vboCount = 10; -+ if(useVBO) -+ { -+ vertexBuffers = GLAllocation.createDirectIntBuffer(vboCount); -+ ARBVertexBufferObject.glGenBuffersARB(vertexBuffers); -+ } -+ } - } -Only in ../src_work/minecraft/net/minecraft/src: Tessellator.java.orig -Only in ../src_work/minecraft/net/minecraft/src: Tessellator.java.rej -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/TileEntityFurnace.java ../src_work/minecraft/net/minecraft/src/TileEntityFurnace.java ---- ../src_base/minecraft/net/minecraft/src/TileEntityFurnace.java 2011-10-02 14:29:20.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/TileEntityFurnace.java 2011-10-02 14:29:22.000000000 -0400 -@@ -4,6 +4,7 @@ - - package net.minecraft.src; - -+import net.minecraft.src.forge.ISidedInventory; - - // Referenced classes of package net.minecraft.src: - // TileEntity, IInventory, ItemStack, NBTTagCompound, -@@ -12,7 +13,7 @@ - // EntityPlayer - - public class TileEntityFurnace extends TileEntity -- implements IInventory -+ implements IInventory, ISidedInventory - { - - public TileEntityFurnace() -@@ -28,6 +29,16 @@ - return furnaceItemStacks.length; - } - -+ public int getStartInventorySide(int side) { -+ if(side==0) return 1; -+ if(side==1) return 0; -+ return 2; -+ } -+ -+ public int getSizeInventorySide(int side) { -+ return 1; -+ } -+ - public ItemStack getStackInSlot(int i) - { - return furnaceItemStacks[i]; -@@ -196,7 +207,7 @@ - { - return false; - } -- ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0].getItem().shiftedIndex); -+ ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0]); - if(itemstack == null) - { - return false; -@@ -209,11 +220,9 @@ - { - return false; - } -- if(furnaceItemStacks[2].stackSize < getInventoryStackLimit() && furnaceItemStacks[2].stackSize < furnaceItemStacks[2].getMaxStackSize()) -- { -- return true; -- } -- return furnaceItemStacks[2].stackSize < itemstack.getMaxStackSize(); -+ int st=furnaceItemStacks[2].stackSize+itemstack.stackSize; -+ return (st<=getInventoryStackLimit() && -+ st<=itemstack.getMaxStackSize()); - } - - public void smeltItem() -@@ -222,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) -+ if(furnaceItemStacks[2].isItemEqual(itemstack)) - { -- furnaceItemStacks[2].stackSize++; -+ furnaceItemStacks[2].stackSize+=itemstack.stackSize; - } - if(furnaceItemStacks[0].getItem().hasContainerItem()) - { -@@ -244,7 +253,7 @@ - } - } - -- private int getItemBurnTime(ItemStack itemstack) -+ public static int getItemBurnTime(ItemStack itemstack) - { - if(itemstack == null) - { -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/TileEntity.java ../src_work/minecraft/net/minecraft/src/TileEntity.java ---- ../src_base/minecraft/net/minecraft/src/TileEntity.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/TileEntity.java 2011-10-02 14:29:22.000000000 -0400 -@@ -61,6 +61,13 @@ - { - } - -+ /* FORGE: Return false if this TileEntity does not require updateEntity() -+ * calls. -+ */ -+ public boolean canUpdate() { -+ return true; -+ } -+ - public static TileEntity createAndLoadEntity(NBTTagCompound nbttagcompound) - { - TileEntity tileentity = null; -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/TileEntityRendererPiston.java ../src_work/minecraft/net/minecraft/src/TileEntityRendererPiston.java ---- ../src_base/minecraft/net/minecraft/src/TileEntityRendererPiston.java 2011-10-02 14:29:20.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/TileEntityRendererPiston.java 2011-10-02 14:29:22.000000000 -0400 -@@ -4,6 +4,7 @@ - - package net.minecraft.src; - -+import net.minecraft.src.forge.ForgeHooksClient; - import net.minecraft.client.Minecraft; - import org.lwjgl.opengl.GL11; - -@@ -38,6 +39,7 @@ - { - GL11.glShadeModel(7424 /*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); -@@ -58,6 +60,7 @@ - } - tessellator.setTranslationD(0.0D, 0.0D, 0.0D); - tessellator.draw(); -+ ForgeHooksClient.afterBlockRender(block,field_31071_b); - RenderHelper.enableStandardItemLighting(); - } - } -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/World.java ../src_work/minecraft/net/minecraft/src/World.java ---- ../src_base/minecraft/net/minecraft/src/World.java 2011-10-02 14:29:20.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/World.java 2011-10-02 14:29:22.000000000 -0400 -@@ -336,7 +336,10 @@ - - public boolean isAirBlock(int i, int j, int k) - { -- 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); - } - - public boolean blockExists(int i, int j, int k) -@@ -1476,7 +1479,7 @@ - Chunk chunk = getChunkFromChunkCoords(tileentity.xCoord >> 4, tileentity.zCoord >> 4); - if(chunk != null) - { -- chunk.removeChunkBlockTileEntity(tileentity.xCoord & 0xf, tileentity.yCoord, tileentity.zCoord & 0xf); -+ chunk.cleanChunkBlockTileEntity(tileentity.xCoord & 0xf, tileentity.yCoord, tileentity.zCoord & 0xf); - } - } - } -@@ -1503,16 +1506,16 @@ - { - loadedTileEntityList.add(tileentity1); - } -+ } else { - if(chunkExists(tileentity1.xCoord >> 4, tileentity1.zCoord >> 4)) - { - Chunk chunk1 = getChunkFromChunkCoords(tileentity1.xCoord >> 4, tileentity1.zCoord >> 4); - if(chunk1 != null) - { -- chunk1.setChunkBlockTileEntity(tileentity1.xCoord & 0xf, tileentity1.yCoord, tileentity1.zCoord & 0xf, tileentity1); -+ chunk1.cleanChunkBlockTileEntity(tileentity1.xCoord & 0xf, tileentity1.yCoord, tileentity1.zCoord & 0xf); - } - } -- markBlockNeedsUpdate(tileentity1.xCoord, tileentity1.yCoord, tileentity1.zCoord); -- } -+ } - } while(true); - addedTileEntityList.clear(); - } -@@ -1520,13 +1523,19 @@ - - public void addTileEntity(Collection collection) - { -- if(scanningTileEntities) -- { -- addedTileEntityList.addAll(collection); -- } else -- { -- loadedTileEntityList.addAll(collection); -- } -+ List dest=scanningTileEntities ? addedTileEntityList : -+ loadedTileEntityList; -+ for(Object ob : collection) { -+ TileEntity te=(TileEntity)ob; -+ if(te.canUpdate()) dest.add(te); -+ } -+ } -+ -+ /* FORGE: Used as a bugfix */ -+ public void addTileEntity(TileEntity te) { -+ List dest=scanningTileEntities ? addedTileEntityList : -+ loadedTileEntityList; -+ if(te.canUpdate()) dest.add(te); - } - - public void updateEntity(Entity entity) -@@ -1684,7 +1693,10 @@ - if(j2 == Block.fire.blockID || j2 == Block.lavaMoving.blockID || j2 == Block.lavaStill.blockID) - { - return true; -- } -+ } else { -+ if(j2>0 && Block.blocksList[j2].isBlockBurning(this,k1,l1,i2)) -+ return true; -+ } - } - - } -@@ -1917,44 +1929,23 @@ - - public void setBlockTileEntity(int i, int j, int k, TileEntity tileentity) - { -- if(tileentity != null && !tileentity.isInvalid()) -- { -- if(scanningTileEntities) -- { -- tileentity.xCoord = i; -- tileentity.yCoord = j; -- tileentity.zCoord = k; -- addedTileEntityList.add(tileentity); -- } else -- { -- loadedTileEntityList.add(tileentity); -- Chunk chunk = getChunkFromChunkCoords(i >> 4, k >> 4); -- if(chunk != null) -- { -- chunk.setChunkBlockTileEntity(i & 0xf, j, k & 0xf, tileentity); -- } -- } -- } -+ 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); -+ } - } - - public void removeBlockTileEntity(int i, int j, int k) - { -- TileEntity tileentity = getBlockTileEntity(i, j, k); -- if(tileentity != null && scanningTileEntities) -- { -- tileentity.invalidate(); -- } else -- { -- if(tileentity != null) -- { -- 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 func_35455_a(TileEntity tileentity) -@@ -1977,13 +1968,18 @@ - public boolean isBlockNormalCube(int i, int j, int k) - { - Block block = Block.blocksList[getBlockId(i, j, k)]; -- if(block == null) -- { -- return false; -- } else -- { -- return block.blockMaterial.getIsOpaque() && block.renderAsNormalBlock(); -- } -+ if(block == null) return false; -+ return block.isBlockNormalCube(this,i,j,k); -+ } -+ -+ /* FORGE: Determine if the given block is considered solid on the -+ * specified side. Used by placement logic. -+ */ -+ public boolean isBlockSolidOnSide(int i, int j, int k, int side) -+ { -+ Block block = Block.blocksList[getBlockId(i, j, k)]; -+ if(block == null) return false; -+ return block.isBlockSolidOnSide(this,i,j,k,side); - } - - public void saveWorldIndirectly(IProgressUpdate iprogressupdate) -@@ -2308,7 +2304,7 @@ - - private int computeBlockLightValue(int i, int j, int k, int l, int i1, int j1) - { -- 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; -@@ -2679,6 +2675,7 @@ - { - block = null; - } -+ if(block!=null && block.isBlockReplaceable(this,j,k,l)) block=null; - return i > 0 && block == null && block1.canPlaceBlockOnSide(this, j, k, l, i1); - } - -@@ -3193,7 +3190,7 @@ - public int lightningFlash; - public boolean editingBlocks; - private long lockTimestamp; -- protected int autosavePeriod; -+ public int autosavePeriod; - public int difficultySetting; - public Random rand; - public boolean isNewWorld; -Only in ../src_work/minecraft/net/minecraft/src: World.java.orig -diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/WorldRenderer.java ../src_work/minecraft/net/minecraft/src/WorldRenderer.java ---- ../src_base/minecraft/net/minecraft/src/WorldRenderer.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft/net/minecraft/src/WorldRenderer.java 2011-10-02 14:29:22.000000000 -0400 -@@ -4,6 +4,8 @@ - - package net.minecraft.src; - -+import net.minecraft.src.forge.ForgeHooksClient; -+ - import java.util.*; - import org.lwjgl.opengl.GL11; - -@@ -125,8 +127,9 @@ - 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]) - { -@@ -142,15 +145,13 @@ - { - flag1 = true; - } -- if(j3 != i2) -- { -- flag = true; -- continue; -- } -- if(j3 == i2) -- { -- flag1 |= renderblocks.renderBlockByRenderType(block, l2, j2, k2); -- } -+ if(j3>i2) flag=true; -+ if(!ForgeHooksClient.canRenderInPass(block,i2)) -+ continue; -+ -+ ForgeHooksClient.beforeBlockRender(block, renderblocks); -+ flag1 |= renderblocks.renderBlockByRenderType(block, l2, j2, k2); -+ ForgeHooksClient.afterBlockRender(block, renderblocks); - } - - } -@@ -159,10 +160,11 @@ - - if(flag2) - { -- tessellator.draw(); -+ ForgeHooksClient.afterRenderPass(i2); -+ 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 - { - flag1 = false; -@@ -255,7 +257,6 @@ - - public World worldObj; - private int glRenderList; -- private static Tessellator tessellator; - public static int chunksUpdated = 0; - public int posX; - public int posY; -@@ -286,8 +287,4 @@ - public List tileEntityRenderers; - private List tileEntities; - -- static -- { -- tessellator = Tessellator.instance; -- } - } -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/BlockButton.java ../src_work/minecraft_server/net/minecraft/src/BlockButton.java ---- ../src_base/minecraft_server/net/minecraft/src/BlockButton.java 2011-10-02 14:29:22.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/BlockButton.java 2011-10-02 14:29:22.000000000 -0400 -@@ -41,36 +41,36 @@ - - public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l) - { -- 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); - } - - 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); - } - - public void onBlockPlaced(World world, int i, int j, int k, int l) -@@ -78,19 +78,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)) -+ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3)) - { - i1 = 3; - } else -- if(l == 4 && world.isBlockNormalCube(i + 1, j, k)) -+ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4)) - { - i1 = 2; - } else -- if(l == 5 && world.isBlockNormalCube(i - 1, j, k)) -+ if(l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5)) - { - i1 = 1; - } else -@@ -102,19 +102,19 @@ - - private int getOrientation(World world, int i, int j, int k) - { -- 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; - } - - public void onNeighborBlockChange(World world, int i, int j, int k, int l) -@@ -123,19 +123,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) - { - flag = true; - } -- if(!world.isBlockNormalCube(i + 1, j, k) && i1 == 2) -+ if(!world.isBlockSolidOnSide(i + 1, j, k,4) && i1 == 2) - { - flag = true; - } -- if(!world.isBlockNormalCube(i, j, k - 1) && i1 == 3) -+ if(!world.isBlockSolidOnSide(i, j, k - 1,3) && i1 == 3) - { - flag = true; - } -- if(!world.isBlockNormalCube(i, j, k + 1) && i1 == 4) -+ if(!world.isBlockSolidOnSide(i, j, k + 1,2) && i1 == 4) - { - flag = true; - } -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/BlockChest.java ../src_work/minecraft_server/net/minecraft/src/BlockChest.java ---- ../src_base/minecraft_server/net/minecraft/src/BlockChest.java 2011-10-02 14:29:22.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/BlockChest.java 2011-10-02 14:29:22.000000000 -0400 -@@ -328,23 +328,23 @@ - { - return true; - } -- if(world.isBlockNormalCube(i, j + 1, k)) -+ if(world.isBlockSolidOnSide(i, j + 1, k,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)) - { - 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)) - { - 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)) - { - 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)) - { - return true; - } -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/BlockContainer.java ../src_work/minecraft_server/net/minecraft/src/BlockContainer.java ---- ../src_base/minecraft_server/net/minecraft/src/BlockContainer.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/BlockContainer.java 2011-10-02 14:29:22.000000000 -0400 -@@ -26,7 +26,7 @@ - public void onBlockAdded(World world, int i, int j, int k) - { - super.onBlockAdded(world, i, j, k); -- world.setBlockTileEntity(i, j, k, getBlockEntity()); -+ world.setBlockTileEntity(i, j, k, getBlockEntity(world.getBlockMetadata(i,j,k))); - } - - public void onBlockRemoval(World world, int i, int j, int k) -@@ -37,6 +37,12 @@ - - public abstract TileEntity getBlockEntity(); - -+ /* FORGE: Metadata-sensitive version, to fix 1.8.1 regression. -+ */ -+ public TileEntity getBlockEntity(int md) { -+ return getBlockEntity(); -+ } -+ - public void playBlock(World world, int i, int j, int k, int l, int i1) - { - super.playBlock(world, i, j, k, l, i1); -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/BlockCrops.java ../src_work/minecraft_server/net/minecraft/src/BlockCrops.java ---- ../src_base/minecraft_server/net/minecraft/src/BlockCrops.java 2011-10-02 14:29:22.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/BlockCrops.java 2011-10-02 14:29:22.000000000 -0400 -@@ -5,6 +5,7 @@ - package net.minecraft.src; - - import java.util.Random; -+import java.util.ArrayList; - - // Referenced classes of package net.minecraft.src: - // BlockFlower, Block, World, EntityItem, -@@ -103,27 +104,16 @@ - return blockIndexInTexture + j; - } - -- public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f) -- { -- super.dropBlockAsItemWithChance(world, i, j, k, l, f); -- if(world.singleplayerWorld) -- { -- return; -- } -- for(int i1 = 0; i1 < 3; i1++) -- { -- if(world.rand.nextInt(15) <= l) -- { -- 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.entityJoinedWorld(entityitem); -- } -- } -- -+ public ArrayList getBlockDropped(World world, -+ int i, int j, int k, int md) { -+ ArrayList tr=new ArrayList(); -+ if(md==7) tr.add(new ItemStack(Item.wheat)); -+ -+ for(int n=0; n<3; n++) { -+ if(world.rand.nextInt(15) <= md) -+ tr.add(new ItemStack(Item.seeds)); -+ } -+ return tr; - } - - public int idDropped(int i, Random random) -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/BlockDoor.java ../src_work/minecraft_server/net/minecraft/src/BlockDoor.java ---- ../src_base/minecraft_server/net/minecraft/src/BlockDoor.java 2011-10-02 14:29:22.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/BlockDoor.java 2011-10-02 14:29:22.000000000 -0400 -@@ -167,7 +167,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; -@@ -231,7 +231,7 @@ - return false; - } 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); - } - } - -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/Block.java ../src_work/minecraft_server/net/minecraft/src/Block.java ---- ../src_base/minecraft_server/net/minecraft/src/Block.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/Block.java 2011-10-02 14:29:22.000000000 -0400 -@@ -3,6 +3,7 @@ - // Decompiler options: packimports(3) braces deadcode - - package net.minecraft.src; -+import net.minecraft.src.forge.ForgeHooks; - - import java.util.ArrayList; - import java.util.Random; -@@ -218,24 +219,40 @@ - return 1; - } - -+ /* FORGE: Metadata-sensitive version. -+ */ -+ public int quantityDropped(int i, Random random) -+ { -+ return quantityDropped(random); -+ } -+ - public int idDropped(int i, Random random) - { - return blockID; - } - -+ /* FORGE: This function isn't called by Minecraft anymore. Use -+ * blockStrength(EntityPlayer,int) instead. -+ */ - public float blockStrength(EntityPlayer entityplayer) - { -- 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); -+ } -+ -+ /* FORGE: This function returns the complete list of drops for a block. -+ */ -+ public ArrayList getBlockDropped(World world, -+ int i, int j, int k, int md) { -+ ArrayList tr=new ArrayList(); -+ -+ int q=quantityDropped(md,world.rand); -+ for(int n=0; n0) { -+ tr.add(new ItemStack(id,1,damageDropped(md))); -+ } -+ } -+ return tr; - } - - public final void dropBlockAsItem(World world, int i, int j, int k, int l) -@@ -249,20 +266,12 @@ - { - return; - } -- int i1 = quantityDropped(world.rand); -- for(int j1 = 0; j1 < i1; j1++) -- { -+ ArrayList ar=getBlockDropped(world,i,j,k,l); -+ for(ItemStack ist : ar) { - if(world.rand.nextFloat() > f) -- { - continue; -- } -- int k1 = idDropped(l, world.rand); -- if(k1 > 0) -- { -- dropBlockAsItem_do(world, i, j, k, new ItemStack(k1, 1, damageDropped(l))); -- } -+ dropBlockAsItem_do(world, i, j, k, ist); - } -- - } - - protected void dropBlockAsItem_do(World world, int i, int j, int k, ItemStack itemstack) -@@ -529,6 +538,86 @@ - return blockMaterial.getMaterialMobility(); - } - -+ /* FORGE: Allow a block to set illumination on a coordinate basis. -+ */ -+ public int getLightValue(IBlockAccess iba, int i, int j, int k) { -+ return lightValue[blockID]; -+ } -+ -+ /* FORGE: Implement and return true if you wish this block to behave -+ * like a ladder when the player is inside. -+ */ -+ public boolean isLadder() { -+ return false; -+ } -+ -+ /* FORGE: Return true if the block is a normal, solid cube. This -+ * determines indirect power state, entity ejection from blocks, and a few -+ * others. -+ */ -+ public boolean isBlockNormalCube(World world, int i, int j, int k) { -+ return blockMaterial.getIsOpaque() && isACube(); -+ } -+ -+ /* 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); -+ } -+ -+ /* FORGE: Return true if the player can place a new block in the block -+ * occupied by this one, like water, lava, fire, etc. -+ */ -+ public boolean isBlockReplaceable( World world, int i, int j, int k ) { -+ return false; -+ } -+ -+ /* FORGE: Return true if this block should set fire and deal fire damage -+ * to entities coming into contact with it, false otherwise. -+ */ -+ public boolean isBlockBurning( World world, int i, int j, int k ) { -+ 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 -+ * 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 ) { -+ return false; -+ } -+ -+ /* FORGE: Return the block hardness with metadata 'md'. -+ */ -+ public float getHardness(int md) { -+ return blockHardness; -+ } -+ -+ /* FORGE: Return the block strength of the block at i,j,k against the -+ * player. -+ */ -+ public float blockStrength(World world, EntityPlayer player, -+ int i, int j, int k) { -+ int md=world.getBlockMetadata(i,j,k); -+ return blockStrength(player,md); -+ } -+ -+ /* FORGE: Return the block strength of a prototypical block with metadata -+ * 'md' against the player. -+ */ -+ public float blockStrength(EntityPlayer player, int md) { -+ return ForgeHooks.blockStrength(this,player,md); -+ } -+ -+ /* FORGE: Return true if the player can harvest a prototypical block with -+ * metadata 'md'. -+ */ -+ public boolean canHarvestBlock(EntityPlayer player, int md) { -+ return ForgeHooks.canHarvestBlock(this,player,md); -+ } -+ - static Class _mthclass$(String s) - { - try -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/BlockLadder.java ../src_work/minecraft_server/net/minecraft/src/BlockLadder.java ---- ../src_base/minecraft_server/net/minecraft/src/BlockLadder.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/BlockLadder.java 2011-10-02 14:29:22.000000000 -0400 -@@ -40,6 +40,11 @@ - return super.getCollisionBoundingBoxFromPool(world, i, j, k); - } - -+ /* FORGE: Implemented base method, see Block.isLadder */ -+ public boolean isLadder() { -+ return true; -+ } -+ - public boolean isOpaqueCube() - { - return false; -@@ -52,37 +57,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); - } - - public void onBlockPlaced(World world, int i, int j, int k, int l) - { - 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)) - { - i1 = 2; - } -- if((i1 == 0 || l == 3) && world.isBlockNormalCube(i, j, k - 1)) -+ if((i1 == 0 || l == 3) && world.isBlockSolidOnSide(i, j, k - 1,3)) - { - i1 = 3; - } -- if((i1 == 0 || l == 4) && world.isBlockNormalCube(i + 1, j, k)) -+ if((i1 == 0 || l == 4) && world.isBlockSolidOnSide(i + 1, j, k,4)) - { - i1 = 4; - } -- if((i1 == 0 || l == 5) && world.isBlockNormalCube(i - 1, j, k)) -+ if((i1 == 0 || l == 5) && world.isBlockSolidOnSide(i - 1, j, k,5)) - { - i1 = 5; - } -@@ -93,19 +98,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)) - { - flag = true; - } -- if(i1 == 3 && world.isBlockNormalCube(i, j, k - 1)) -+ if(i1 == 3 && world.isBlockSolidOnSide(i, j, k - 1,3)) - { - flag = true; - } -- if(i1 == 4 && world.isBlockNormalCube(i + 1, j, k)) -+ if(i1 == 4 && world.isBlockSolidOnSide(i + 1, j, k,4)) - { - flag = true; - } -- if(i1 == 5 && world.isBlockNormalCube(i - 1, j, k)) -+ if(i1 == 5 && world.isBlockSolidOnSide(i - 1, j, k,5)) - { - flag = true; - } -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/BlockLever.java ../src_work/minecraft_server/net/minecraft/src/BlockLever.java ---- ../src_base/minecraft_server/net/minecraft/src/BlockLever.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/BlockLever.java 2011-10-02 14:29:22.000000000 -0400 -@@ -35,44 +35,44 @@ - - public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l) - { -- 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); - } - - 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; - } -- 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); - } - - public void onBlockPlaced(World world, int i, int j, int k, int l) -@@ -81,23 +81,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)) - { - i1 = 5 + world.rand.nextInt(2); - } -- if(l == 2 && world.isBlockNormalCube(i, j, k + 1)) -+ if(l == 2 && world.isBlockSolidOnSide(i, j, k + 1,2)) - { - i1 = 4; - } -- if(l == 3 && world.isBlockNormalCube(i, j, k - 1)) -+ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3)) - { - i1 = 3; - } -- if(l == 4 && world.isBlockNormalCube(i + 1, j, k)) -+ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4)) - { - i1 = 2; - } -- if(l == 5 && world.isBlockNormalCube(i - 1, j, k)) -+ if(l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5)) - { - i1 = 1; - } -@@ -119,27 +119,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) - { - flag = true; - } -- if(!world.isBlockNormalCube(i + 1, j, k) && i1 == 2) -+ if(!world.isBlockSolidOnSide(i + 1, j, k,4) && i1 == 2) - { - flag = true; - } -- if(!world.isBlockNormalCube(i, j, k - 1) && i1 == 3) -+ if(!world.isBlockSolidOnSide(i, j, k - 1,3) && i1 == 3) - { - flag = true; - } -- if(!world.isBlockNormalCube(i, j, k + 1) && i1 == 4) -+ if(!world.isBlockSolidOnSide(i, j, k + 1,2) && i1 == 4) - { - flag = true; - } -- if(!world.isBlockNormalCube(i, j - 1, k) && i1 == 5) -+ if(!world.isBlockSolidOnSide(i, j - 1, k,1) && i1 == 5) - { - flag = true; - } -- if(!world.isBlockNormalCube(i, j - 1, k) && i1 == 6) -+ if(!world.isBlockSolidOnSide(i, j - 1, k,1) && i1 == 6) - { - flag = true; - } -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/BlockPressurePlate.java ../src_work/minecraft_server/net/minecraft/src/BlockPressurePlate.java ---- ../src_base/minecraft_server/net/minecraft/src/BlockPressurePlate.java 2011-10-02 14:29:22.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/BlockPressurePlate.java 2011-10-02 14:29:22.000000000 -0400 -@@ -46,7 +46,8 @@ - - public boolean canPlaceBlockAt(World world, int i, int j, int k) - { -- 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; - } - - public void onBlockAdded(World world, int i, int j, int k) -@@ -56,7 +57,8 @@ - public void onNeighborBlockChange(World world, int i, int j, int k, int l) - { - 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) - { - flag = true; - } -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/BlockRail.java ../src_work/minecraft_server/net/minecraft/src/BlockRail.java ---- ../src_base/minecraft_server/net/minecraft/src/BlockRail.java 2011-10-02 14:29:22.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/BlockRail.java 2011-10-02 14:29:22.000000000 -0400 -@@ -16,12 +16,12 @@ - public static final boolean isRailBlockAt(World world, int i, int j, int k) - { - 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; - } - - public static final boolean isRailBlock(int i) - { -- return i == Block.rail.blockID || i == Block.railPowered.blockID || i == Block.railDetector.blockID; -+ return Block.blocksList[i] instanceof BlockRail; - } - - protected BlockRail(int i, int j, boolean flag) -@@ -92,7 +92,7 @@ - - public boolean canPlaceBlockAt(World world, int i, int j, int k) - { -- return world.isBlockNormalCube(i, j - 1, k); -+ return world.isBlockSolidOnSide(i, j - 1, k,1); - } - - public void onBlockAdded(World world, int i, int j, int k) -@@ -116,23 +116,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; - } -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/BlockRedstoneRepeater.java ../src_work/minecraft_server/net/minecraft/src/BlockRedstoneRepeater.java ---- ../src_base/minecraft_server/net/minecraft/src/BlockRedstoneRepeater.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/BlockRedstoneRepeater.java 2011-10-02 14:29:22.000000000 -0400 -@@ -27,7 +27,7 @@ - - public boolean canPlaceBlockAt(World world, int i, int j, int k) - { -- if(!world.isBlockNormalCube(i, j - 1, k)) -+ if(!world.isBlockSolidOnSide(i, j - 1, k,1)) - { - return false; - } else -@@ -38,7 +38,7 @@ - - public boolean canBlockStay(World world, int i, int j, int k) - { -- if(!world.isBlockNormalCube(i, j - 1, k)) -+ if(!world.isBlockSolidOnSide(i, j - 1, k,1)) - { - return false; - } else -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/BlockRedstoneWire.java ../src_work/minecraft_server/net/minecraft/src/BlockRedstoneWire.java ---- ../src_base/minecraft_server/net/minecraft/src/BlockRedstoneWire.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/BlockRedstoneWire.java 2011-10-02 14:29:22.000000000 -0400 -@@ -3,6 +3,7 @@ - // Decompiler options: packimports(3) braces deadcode - - package net.minecraft.src; -+import net.minecraft.src.forge.*; - - import java.util.*; - -@@ -43,7 +44,7 @@ - - public boolean canPlaceBlockAt(World world, int i, int j, int k) - { -- return world.isBlockNormalCube(i, j - 1, k); -+ return world.isBlockSolidOnSide(i, j - 1, k, 1); - } - - private void updateAndPropagateCurrentStrength(World world, int i, int j, int k) -@@ -413,6 +414,10 @@ - { - return false; - } -+ if(Block.blocksList[i1] instanceof IConnectRedstone) { -+ IConnectRedstone icr=(IConnectRedstone)Block.blocksList[i1]; -+ return icr.canConnectRedstone(iblockaccess,i,j,k,l); -+ } - if(Block.blocksList[i1].canProvidePower()) - { - return true; -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/BlockTallGrass.java ../src_work/minecraft_server/net/minecraft/src/BlockTallGrass.java ---- ../src_base/minecraft_server/net/minecraft/src/BlockTallGrass.java 2011-10-02 14:29:22.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/BlockTallGrass.java 2011-10-02 14:29:22.000000000 -0400 -@@ -4,7 +4,10 @@ - - package net.minecraft.src; - -+import net.minecraft.src.forge.ForgeHooks; -+ - import java.util.Random; -+import java.util.ArrayList; - - // Referenced classes of package net.minecraft.src: - // BlockFlower, Item, World, EntityPlayer, -@@ -41,13 +44,17 @@ - - public int idDropped(int i, Random random) - { -- if(random.nextInt(8) == 0) -- { -- return Item.seeds.shiftedIndex; -- } else -- { - return -1; -- } -+ } -+ -+ public ArrayList getBlockDropped(World world, -+ int i, int j, int k, int md) { -+ ArrayList tr=new ArrayList(); -+ if(world.rand.nextInt(8)!=0) -+ return tr; -+ ItemStack ist=ForgeHooks.getGrassSeed(world); -+ if(ist!=null) tr.add(ist); -+ return tr; - } - - public void harvestBlock(World world, EntityPlayer entityplayer, int i, int j, int k, int l) -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/BlockTorch.java ../src_work/minecraft_server/net/minecraft/src/BlockTorch.java ---- ../src_base/minecraft_server/net/minecraft/src/BlockTorch.java 2011-10-02 14:29:22.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/BlockTorch.java 2011-10-02 14:29:22.000000000 -0400 -@@ -36,24 +36,24 @@ - - private boolean canPlaceTorchOn(World world, int i, int j, int k) - { -- return world.isBlockNormalCube(i, j, k) || world.getBlockId(i, j, k) == Block.fence.blockID; -+ return world.isBlockSolidOnSide(i, j, k,1) || world.getBlockId(i, j, k) == Block.fence.blockID; - } - - 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; - } -- if(world.isBlockNormalCube(i, j, k + 1)) -+ if(world.isBlockSolidOnSide(i, j, k + 1,2)) - { - return true; - } -@@ -67,19 +67,19 @@ - { - i1 = 5; - } -- if(l == 2 && world.isBlockNormalCube(i, j, k + 1)) -+ if(l == 2 && world.isBlockSolidOnSide(i, j, k + 1,2)) - { - i1 = 4; - } -- if(l == 3 && world.isBlockNormalCube(i, j, k - 1)) -+ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3)) - { - i1 = 3; - } -- if(l == 4 && world.isBlockNormalCube(i + 1, j, k)) -+ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4)) - { - i1 = 2; - } -- if(l == 5 && world.isBlockNormalCube(i - 1, j, k)) -+ if(l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5)) - { - i1 = 1; - } -@@ -97,19 +97,19 @@ - - public void onBlockAdded(World world, int i, int j, int k) - { -- if(world.isBlockNormalCube(i - 1, j, k)) -+ if(world.isBlockSolidOnSide(i - 1, j, k,5)) - { - world.setBlockMetadataWithNotify(i, j, k, 1); - } else -- if(world.isBlockNormalCube(i + 1, j, k)) -+ if(world.isBlockSolidOnSide(i + 1, j, k,4)) - { - world.setBlockMetadataWithNotify(i, j, k, 2); - } else -- if(world.isBlockNormalCube(i, j, k - 1)) -+ if(world.isBlockSolidOnSide(i, j, k - 1,3)) - { - world.setBlockMetadataWithNotify(i, j, k, 3); - } else -- if(world.isBlockNormalCube(i, j, k + 1)) -+ if(world.isBlockSolidOnSide(i, j, k + 1,2)) - { - world.setBlockMetadataWithNotify(i, j, k, 4); - } else -@@ -126,19 +126,19 @@ - { - int i1 = world.getBlockMetadata(i, j, k); - boolean flag = false; -- if(!world.isBlockNormalCube(i - 1, j, k) && i1 == 1) -+ if(!world.isBlockSolidOnSide(i - 1, j, k,5) && i1 == 1) - { - flag = true; - } -- if(!world.isBlockNormalCube(i + 1, j, k) && i1 == 2) -+ if(!world.isBlockSolidOnSide(i + 1, j, k,4) && i1 == 2) - { - flag = true; - } -- if(!world.isBlockNormalCube(i, j, k - 1) && i1 == 3) -+ if(!world.isBlockSolidOnSide(i, j, k - 1,3) && i1 == 3) - { - flag = true; - } -- if(!world.isBlockNormalCube(i, j, k + 1) && i1 == 4) -+ if(!world.isBlockSolidOnSide(i, j, k + 1,2) && i1 == 4) - { - flag = true; - } -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/BlockTrapDoor.java ../src_work/minecraft_server/net/minecraft/src/BlockTrapDoor.java ---- ../src_base/minecraft_server/net/minecraft/src/BlockTrapDoor.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/BlockTrapDoor.java 2011-10-02 14:29:22.000000000 -0400 -@@ -130,7 +130,7 @@ - { - j1--; - } -- if(!world.isBlockNormalCube(j1, j, k1)) -+ if(!disableValidation && !world.isBlockSolidOnSide(j1, j, k1, (i1&3)+2)) - { - world.setBlockWithNotify(i, j, k, 0); - dropBlockAsItem(world, i, j, k, i1); -@@ -172,6 +172,7 @@ - - public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l) - { -+ if(disableValidation) return true; - if(l == 0) - { - return false; -@@ -196,11 +197,15 @@ - { - i--; - } -- return world.isBlockNormalCube(i, j, k); -+ return world.isBlockSolidOnSide(i, j, k, l); - } - - public static boolean isTrapdoorOpen(int i) - { - return (i & 4) != 0; - } -+ -+ /* FORGE: Set this to allow trapdoors to remain free-floating -+ */ -+ public static boolean disableValidation=false; - } -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/Chunk.java ../src_work/minecraft_server/net/minecraft/src/Chunk.java ---- ../src_base/minecraft_server/net/minecraft/src/Chunk.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/Chunk.java 2011-10-02 14:29:22.000000000 -0400 -@@ -3,6 +3,7 @@ - // Decompiler options: packimports(3) braces deadcode - - package net.minecraft.src; -+import net.minecraft.src.forge.*; - - import java.io.PrintStream; - import java.util.*; -@@ -68,16 +69,12 @@ - - public void generateSkylightMap() - { -- worldObj.getClass(); - int i = 128 - 1; - for(int j = 0; j < 16; j++) - { - for(int l = 0; l < 16; l++) - { -- worldObj.getClass(); - int j1 = 128 - 1; -- worldObj.getClass(); -- worldObj.getClass(); - int k1; - for(k1 = j << 11 | l << 7; j1 > 0 && Block.lightOpacity[blocks[(k1 + j1) - 1] & 0xff] == 0; j1--) { } - heightMap[l << 4 | j] = (byte)j1; -@@ -90,7 +87,6 @@ - continue; - } - int l1 = 15; -- worldObj.getClass(); - int i2 = 128 - 1; - do - { -@@ -128,7 +124,6 @@ - - private void func_35633_i() - { -- worldObj.getClass(); - if(worldObj.doChunksNearChunkExist(xPosition * 16 + 8, 128 / 2, zPosition * 16 + 8, 16)) - { - for(int i = 0; i < 16; i++) -@@ -190,7 +185,6 @@ - { - if(l > k) - { -- worldObj.getClass(); - if(worldObj.doChunksNearChunkExist(i, 128 / 2, j, 16)) - { - for(int i1 = k; i1 < l; i1++) -@@ -211,8 +205,6 @@ - { - i1 = j; - } -- worldObj.getClass(); -- worldObj.getClass(); - for(int j1 = i << 11 | k << 7; i1 > 0 && Block.lightOpacity[blocks[(j1 + i1) - 1] & 0xff] == 0; i1--) { } - if(i1 == l) - { -@@ -225,7 +217,6 @@ - lowestBlockHeight = i1; - } else - { -- worldObj.getClass(); - int k1 = 128 - 1; - for(int i2 = 0; i2 < 16; i2++) - { -@@ -294,8 +285,6 @@ - - public int getBlockID(int i, int j, int k) - { -- worldObj.getClass(); -- worldObj.getClass(); - return blocks[i << 11 | k << 7 | j] & 0xff; - } - -@@ -308,8 +297,6 @@ - field_35637_c[j1] = -999; - } - int k1 = heightMap[k << 4 | i] & 0xff; -- worldObj.getClass(); -- worldObj.getClass(); - int l1 = blocks[i << 11 | k << 7 | j] & 0xff; - if(l1 == l && data.getNibble(i, j, k) == i1) - { -@@ -317,12 +304,17 @@ - } - int i2 = xPosition * 16 + i; - int j2 = zPosition * 16 + k; -- worldObj.getClass(); -- worldObj.getClass(); -+ if (Block.blocksList[l1] instanceof IOverrideReplace) { -+ IOverrideReplace iovr = (IOverrideReplace) Block.blocksList[l1]; -+ if (!iovr.canReplaceBlock(worldObj, i2, j, j2, l)) -+ return iovr.getReplacedSuccess(); -+ } -+ - blocks[i << 11 | k << 7 | j] = (byte)(byte0 & 0xff); -- if(l1 != 0 && !worldObj.singleplayerWorld) -- { -- Block.blocksList[l1].onBlockRemoval(worldObj, i2, j, j2); -+ if(l1 != 0) { -+ if(!worldObj.singleplayerWorld) -+ Block.blocksList[l1].onBlockRemoval(worldObj, i2, j, j2); -+ removeChunkBlockTileEntity(i,j,k); - } - data.setNibble(i, j, k, i1); - if(!worldObj.worldProvider.hasNoSky) -@@ -354,7 +346,7 @@ - TileEntity tileentity = getChunkBlockTileEntity(i, j, k); - if(tileentity == null) - { -- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(); -+ tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(i1); - worldObj.setBlockTileEntity(i, j, k, tileentity); - } - if(tileentity != null) -@@ -362,14 +354,6 @@ - tileentity.func_35164_g(); - } - } -- } else -- if(l1 > 0 && (Block.blocksList[l1] instanceof BlockContainer)) -- { -- TileEntity tileentity1 = getChunkBlockTileEntity(i, j, k); -- if(tileentity1 != null) -- { -- tileentity1.func_35164_g(); -- } - } - isModified = true; - return true; -@@ -384,8 +368,6 @@ - field_35637_c[i1] = -999; - } - int j1 = heightMap[i1] & 0xff; -- worldObj.getClass(); -- worldObj.getClass(); - int k1 = blocks[i << 11 | k << 7 | j] & 0xff; - if(k1 == l) - { -@@ -393,12 +375,18 @@ - } - int l1 = xPosition * 16 + i; - int i2 = zPosition * 16 + k; -- worldObj.getClass(); -- worldObj.getClass(); -+ -+ if (Block.blocksList[k1] instanceof IOverrideReplace) { -+ IOverrideReplace iovr = (IOverrideReplace) Block.blocksList[k1]; -+ if (!iovr.canReplaceBlock(worldObj, l1, j, i2, l)) -+ return iovr.getReplacedSuccess(); -+ } -+ - blocks[i << 11 | k << 7 | j] = (byte)(byte0 & 0xff); -- if(k1 != 0) -- { -- Block.blocksList[k1].onBlockRemoval(worldObj, l1, j, i2); -+ if(k1 != 0) { -+ if(!worldObj.singleplayerWorld) -+ Block.blocksList[k1].onBlockRemoval(worldObj, l1, j, i2); -+ removeChunkBlockTileEntity(i,j,k); - } - data.setNibble(i, j, k, 0); - if(Block.lightOpacity[byte0 & 0xff] != 0) -@@ -426,7 +414,7 @@ - TileEntity tileentity = getChunkBlockTileEntity(i, j, k); - if(tileentity == null) - { -- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(); -+ tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(0); - worldObj.setBlockTileEntity(i, j, k, tileentity); - } - if(tileentity != null) -@@ -434,14 +422,6 @@ - tileentity.func_35164_g(); - } - } -- } else -- if(k1 > 0 && (Block.blocksList[k1] instanceof BlockContainer)) -- { -- TileEntity tileentity1 = getChunkBlockTileEntity(i, j, k); -- if(tileentity1 != null) -- { -- tileentity1.func_35164_g(); -- } - } - isModified = true; - return true; -@@ -568,6 +548,11 @@ - { - ChunkPosition chunkposition = new ChunkPosition(i, j, k); - TileEntity tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition); -+ if(tileentity != null && tileentity.isInvalid()) -+ { -+ chunkTileEntityMap.remove(chunkposition); -+ tileentity=null; -+ } - if(tileentity == null) - { - int l = getBlockID(i, j, k); -@@ -577,18 +562,23 @@ - } - if(tileentity == null) - { -- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(); -+ tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(getBlockMetadata(i,j,k)); - worldObj.setBlockTileEntity(xPosition * 16 + i, j, zPosition * 16 + k, tileentity); - } - tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition); - } -- if(tileentity != null && tileentity.isInvalid()) -- { -- chunkTileEntityMap.remove(chunkposition); -- return null; -- } else -+ return tileentity; -+ } -+ -+ /* FORGE: Used to remove only invalid TileEntities */ -+ public void cleanChunkBlockTileEntity(int i, int j, int k) -+ { -+ ChunkPosition chunkposition = new ChunkPosition(i, j, k); -+ if(isChunkLoaded) - { -- return tileentity; -+ TileEntity tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition); -+ if(tileentity!=null && tileentity.isInvalid()) -+ chunkTileEntityMap.remove(chunkposition); - } - } - -@@ -600,7 +590,7 @@ - setChunkBlockTileEntity(i, j, k, tileentity); - if(isChunkLoaded) - { -- worldObj.loadedTileEntityList.add(tileentity); -+ worldObj.addTileEntity(tileentity); - } - } - -@@ -617,6 +607,8 @@ - return; - } else - { -+ TileEntity old=(TileEntity)chunkTileEntityMap.get(chunkposition); -+ if(old!=null) old.invalidate(); - tileentity.validate(); - chunkTileEntityMap.put(chunkposition, tileentity); - return; -@@ -766,8 +758,6 @@ - { - for(int k3 = k; k3 < j1; k3++) - { -- worldObj.getClass(); -- worldObj.getClass(); - int k4 = k2 << 11 | k3 << 7 | j; - int k5 = i1 - j; - System.arraycopy(blocks, k4, abyte0, k1, k5); -@@ -780,8 +770,6 @@ - { - for(int l3 = k; l3 < j1; l3++) - { -- worldObj.getClass(); -- worldObj.getClass(); - int l4 = (l2 << 11 | l3 << 7 | j) >> 1; - int l5 = (i1 - j) / 2; - System.arraycopy(data.data, l4, abyte0, k1, l5); -@@ -794,8 +782,6 @@ - { - for(int i4 = k; i4 < j1; i4++) - { -- worldObj.getClass(); -- worldObj.getClass(); - int i5 = (i3 << 11 | i4 << 7 | j) >> 1; - int i6 = (i1 - j) / 2; - System.arraycopy(blocklightMap.data, i5, abyte0, k1, i6); -@@ -808,8 +794,6 @@ - { - for(int j4 = k; j4 < j1; j4++) - { -- worldObj.getClass(); -- worldObj.getClass(); - int j5 = (j3 << 11 | j4 << 7 | j) >> 1; - int j6 = (i1 - j) / 2; - System.arraycopy(skylightMap.data, j5, abyte0, k1, j6); -@@ -857,7 +841,6 @@ - int l = field_35637_c[k]; - if(l == -999) - { -- worldObj.getClass(); - int i1 = 128 - 1; - for(l = -1; i1 > 0 && l == -1;) - { -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/EntityLiving.java ../src_work/minecraft_server/net/minecraft/src/EntityLiving.java ---- ../src_base/minecraft_server/net/minecraft/src/EntityLiving.java 2011-10-02 14:29:22.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/EntityLiving.java 2011-10-02 14:29:22.000000000 -0400 -@@ -600,7 +600,9 @@ - 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(); - } - - public void writeEntityToNBT(NBTTagCompound nbttagcompound) -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/EntityPlayer.java ../src_work/minecraft_server/net/minecraft/src/EntityPlayer.java ---- ../src_base/minecraft_server/net/minecraft/src/EntityPlayer.java 2011-10-02 14:29:22.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/EntityPlayer.java 2011-10-02 14:29:22.000000000 -0400 -@@ -6,6 +6,10 @@ - - import java.util.*; - -+import net.minecraft.src.forge.ArmorProperties; -+import net.minecraft.src.forge.ISpecialArmor; -+import net.minecraft.src.forge.ForgeHooks; -+ - // Referenced classes of package net.minecraft.src: - // EntityLiving, InventoryPlayer, FoodStats, PlayerCapabilities, - // ContainerPlayer, World, ChunkCoordinates, DataWatcher, -@@ -433,6 +437,8 @@ - worldObj.entityJoinedWorld(entityitem); - } - -+ /* FORGE: This isn't called anymore -+ */ - public float getCurrentPlayerStrVsBlock(Block block) - { - float f = inventory.getStrVsBlock(block); -@@ -455,6 +461,32 @@ - return f; - } - -+ /* 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); -+ if(isInsideOfMaterial(Material.water)) -+ { -+ f /= 5F; -+ } -+ if(!onGround) -+ { -+ f /= 5F; -+ } -+ if(func_35184_a(Potion.digSpeed)) -+ { -+ f *= 1.0F + (float)(func_35187_b(Potion.digSpeed).func_35652_c() + 1) * 0.2F; -+ } -+ if(func_35184_a(Potion.digSlowdown)) -+ { -+ f *= 1.0F - (float)(func_35187_b(Potion.digSlowdown).func_35652_c() + 1) * 0.2F; -+ } -+ return f; -+ } -+ - public boolean canHarvestBlock(Block block) - { - return inventory.canHarvestBlock(block); -@@ -668,7 +700,9 @@ - - public void destroyCurrentEquippedItem() - { -+ ItemStack orig=inventory.getCurrentItem(); - inventory.setInventorySlotContents(inventory.currentItem, null); -+ ForgeHooks.onDestroyCurrentItem(this,orig); - } - - public double getYOffset() -@@ -757,6 +791,10 @@ - - public EnumStatus sleepInBedAt(int i, int j, int k) - { -+ EnumStatus customSleep = ForgeHooks.sleepInBedAt(this, i, j, k); -+ if (customSleep != null) { -+ return customSleep; -+ } - if(!worldObj.singleplayerWorld) - { - if(isPlayerSleeping() || !isEntityAlive()) -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/Explosion.java ../src_work/minecraft_server/net/minecraft/src/Explosion.java ---- ../src_base/minecraft_server/net/minecraft/src/Explosion.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/Explosion.java 2011-10-02 14:29:22.000000000 -0400 -@@ -3,6 +3,7 @@ - // Decompiler options: packimports(3) braces deadcode - - package net.minecraft.src; -+import net.minecraft.src.forge.ISpecialResistance; - - import java.util.*; - -@@ -66,7 +67,16 @@ - int i5 = worldObj.getBlockId(j4, k4, l4); - if(i5 > 0) - { -- f1 -= (Block.blocksList[i5].getExplosionResistance(exploder) + 0.3F) * f2; -+ if(Block.blocksList[i5] instanceof ISpecialResistance) { -+ ISpecialResistance isr=(ISpecialResistance) -+ Block.blocksList[i5]; -+ f1-=(isr.getSpecialExplosionResistance( -+ worldObj,j4,k4,l4, -+ explosionX,explosionY,explosionZ, -+ exploder) + 0.3F) * f2; -+ } else { -+ f1 -= (Block.blocksList[i5].getExplosionResistance(exploder) + 0.3F) * f2; -+ } - } - if(f1 > 0.0F) - { -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/FurnaceRecipes.java ../src_work/minecraft_server/net/minecraft/src/FurnaceRecipes.java ---- ../src_base/minecraft_server/net/minecraft/src/FurnaceRecipes.java 2011-10-02 14:29:22.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/FurnaceRecipes.java 2011-10-02 14:29:22.000000000 -0400 -@@ -6,6 +6,7 @@ - - import java.util.HashMap; - import java.util.Map; -+import java.util.Arrays; - - // Referenced classes of package net.minecraft.src: - // Block, ItemStack, Item -@@ -21,6 +22,7 @@ - private FurnaceRecipes() - { - 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)); -@@ -40,11 +42,32 @@ - smeltingList.put(Integer.valueOf(i), itemstack); - } - -+ /* FORGE: Add a metadata-sensitive furnace recipe. -+ */ -+ public void addSmelting(int i, int meta, ItemStack itemstack) -+ { -+ metaSmeltingList.put(Arrays.asList(i,meta), itemstack); -+ } -+ -+ /* FORGE: Not used anymore. -+ */ - public ItemStack getSmeltingResult(int i) - { - return (ItemStack)smeltingList.get(Integer.valueOf(i)); - } - -+ /* FORGE: Added to allow metadata-sensitive smelting. -+ */ -+ public ItemStack getSmeltingResult(ItemStack src) { -+ ItemStack tr; -+ -+ if(src==null) return null; -+ tr=(ItemStack)metaSmeltingList.get( -+ Arrays.asList(src.itemID,src.getItemDamage())); -+ if(tr!=null) return tr; -+ return (ItemStack)smeltingList.get(Integer.valueOf(src.itemID)); -+ } -+ - public Map getSmeltingList() - { - return smeltingList; -@@ -52,5 +75,6 @@ - - private static final FurnaceRecipes smeltingBase = new FurnaceRecipes(); - private Map smeltingList; -+ private Map metaSmeltingList; - - } -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/ItemBlock.java ../src_work/minecraft_server/net/minecraft/src/ItemBlock.java ---- ../src_base/minecraft_server/net/minecraft/src/ItemBlock.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/ItemBlock.java 2011-10-02 14:29:22.000000000 -0400 -@@ -62,7 +62,7 @@ - { - return false; - } -- if(!entityplayer.func_35200_c(i, j, k)) -+ if(entityplayer!=null && !entityplayer.func_35200_c(i, j, k)) - { - return false; - } -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/ItemBucket.java ../src_work/minecraft_server/net/minecraft/src/ItemBucket.java ---- ../src_base/minecraft_server/net/minecraft/src/ItemBucket.java 2011-10-02 14:29:22.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/ItemBucket.java 2011-10-02 14:29:22.000000000 -0400 -@@ -6,6 +6,8 @@ - - import java.util.Random; - -+import net.minecraft.src.forge.MinecraftForge; -+ - // Referenced classes of package net.minecraft.src: - // Item, EntityPlayer, Vec3D, MathHelper, - // World, MovingObjectPosition, EnumMovingObjectType, Material, -@@ -56,6 +58,12 @@ - } - if(isFull == 0) - { -+ ItemStack customBucket = MinecraftForge.fillCustomBucket(world, -+ i, j, k); -+ if (customBucket != null) { -+ return customBucket; -+ } -+ - if(!entityplayer.func_35200_c(i, j, k)) - { - return itemstack; -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/ItemDye.java ../src_work/minecraft_server/net/minecraft/src/ItemDye.java ---- ../src_base/minecraft_server/net/minecraft/src/ItemDye.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/ItemDye.java 2011-10-02 14:29:22.000000000 -0400 -@@ -3,6 +3,7 @@ - // Decompiler options: packimports(3) braces deadcode - - package net.minecraft.src; -+import net.minecraft.src.forge.ForgeHooks; - - import java.util.Random; - -@@ -29,13 +30,18 @@ - - public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l) - { -- if(!entityplayer.func_35200_c(i, j, k)) -+ if(entityplayer!=null && !entityplayer.func_35200_c(i, j, k)) - { - return false; - } - if(itemstack.getItemDamage() == 15) - { - int i1 = world.getBlockId(i, j, k); -+ if(ForgeHooks.onUseBonemeal(world,i1,i,j,k)) { -+ if(!world.singleplayerWorld) -+ itemstack.stackSize--; -+ return true; -+ } - if(i1 == Block.sapling.blockID) - { - if(!world.singleplayerWorld) -@@ -102,13 +108,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); - } - - } -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/ItemFlintAndSteel.java ../src_work/minecraft_server/net/minecraft/src/ItemFlintAndSteel.java ---- ../src_base/minecraft_server/net/minecraft/src/ItemFlintAndSteel.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/ItemFlintAndSteel.java 2011-10-02 14:29:22.000000000 -0400 -@@ -46,7 +46,7 @@ - { - i++; - } -- if(!entityplayer.func_35200_c(i, j, k)) -+ if(entityplayer!=null && !entityplayer.func_35200_c(i, j, k)) - { - return false; - } -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/ItemHoe.java ../src_work/minecraft_server/net/minecraft/src/ItemHoe.java ---- ../src_base/minecraft_server/net/minecraft/src/ItemHoe.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/ItemHoe.java 2011-10-02 14:29:22.000000000 -0400 -@@ -21,7 +21,7 @@ - - public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l) - { -- if(!entityplayer.func_35200_c(i, j, k)) -+ if(entityplayer!=null && !entityplayer.func_35200_c(i, j, k)) - { - return false; - } -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/ItemInWorldManager.java ../src_work/minecraft_server/net/minecraft/src/ItemInWorldManager.java ---- ../src_base/minecraft_server/net/minecraft/src/ItemInWorldManager.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/ItemInWorldManager.java 2011-10-02 14:29:22.000000000 -0400 -@@ -3,7 +3,8 @@ - // Decompiler options: packimports(3) braces deadcode - - package net.minecraft.src; -- -+import net.minecraft.src.forge.ForgeHooks; -+import net.minecraft.src.forge.IUseItemFirst; - - // Referenced classes of package net.minecraft.src: - // EntityPlayer, PlayerCapabilities, World, Block, -@@ -66,7 +67,8 @@ - if(j != 0) - { - Block block = Block.blocksList[j]; -- float f = block.blockStrength(thisPlayer) * (float)(i + 1); -+ float f = block.blockStrength(thisWorld,thisPlayer, -+ field_22049_l,field_22048_m,field_22047_n) * (float)(i + 1); - if(f >= 1.0F) - { - field_22050_k = false; -@@ -93,7 +95,7 @@ - { - Block.blocksList[i1].onBlockClicked(thisWorld, i, j, k, thisPlayer); - } -- if(i1 > 0 && Block.blocksList[i1].blockStrength(thisPlayer) >= 1.0F) -+ if(i1 > 0 && Block.blocksList[i1].blockStrength(thisWorld,thisPlayer,i,j,k) >= 1.0F) - { - blockHarvessted(i, j, k); - } else -@@ -113,7 +115,7 @@ - if(i1 != 0) - { - Block block = Block.blocksList[i1]; -- float f = block.blockStrength(thisPlayer) * (float)(l + 1); -+ float f = block.blockStrength(thisWorld,thisPlayer,i,j,k) * (float)(l + 1); - if(f >= 0.7F) - { - blockHarvessted(i, j, k); -@@ -164,7 +166,7 @@ - thisPlayer.destroyCurrentEquippedItem(); - } - } -- if(flag && thisPlayer.canHarvestBlock(Block.blocksList[l])) -+ if(flag && Block.blocksList[l].canHarvestBlock(thisPlayer,i1)) - { - Block.blocksList[l].harvestBlock(thisWorld, thisPlayer, i, j, k, i1); - } -@@ -188,6 +190,7 @@ - if(itemstack1.stackSize == 0) - { - entityplayer.inventory.mainInventory[entityplayer.inventory.currentItem] = null; -+ ForgeHooks.onDestroyCurrentItem(entityplayer,itemstack1); - } - return true; - } else -@@ -198,6 +201,11 @@ - - public boolean activeBlockOrUseItem(EntityPlayer entityplayer, World world, ItemStack itemstack, int i, int j, int k, int l) - { -+ if(itemstack!=null && itemstack.getItem() instanceof IUseItemFirst) { -+ IUseItemFirst iuif=(IUseItemFirst)itemstack.getItem(); -+ if(iuif.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)) - { -@@ -217,7 +225,11 @@ - return flag; - } 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); -+ return true; - } - } - -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/Item.java ../src_work/minecraft_server/net/minecraft/src/Item.java ---- ../src_base/minecraft_server/net/minecraft/src/Item.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/Item.java 2011-10-02 14:29:22.000000000 -0400 -@@ -66,6 +66,13 @@ - return 1.0F; - } - -+ /* FORGE: Metadata-sensitive version of getStrVsBlock -+ */ -+ public float getStrVsBlock(ItemStack itemstack, Block block, int md) -+ { -+ return getStrVsBlock(itemstack,block); -+ } -+ - public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) - { - return itemstack; -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/ItemRedstone.java ../src_work/minecraft_server/net/minecraft/src/ItemRedstone.java ---- ../src_base/minecraft_server/net/minecraft/src/ItemRedstone.java 2011-10-02 14:29:22.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/ItemRedstone.java 2011-10-02 14:29:22.000000000 -0400 -@@ -50,7 +50,7 @@ - return false; - } - } -- if(!entityplayer.func_35200_c(i, j, k)) -+ if(entityplayer!=null && !entityplayer.func_35200_c(i, j, k)) - { - return false; - } -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/ItemReed.java ../src_work/minecraft_server/net/minecraft/src/ItemReed.java ---- ../src_base/minecraft_server/net/minecraft/src/ItemReed.java 2011-10-02 14:29:22.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/ItemReed.java 2011-10-02 14:29:22.000000000 -0400 -@@ -52,7 +52,7 @@ - i++; - } - } -- if(!entityplayer.func_35200_c(i, j, k)) -+ if(entityplayer!=null && !entityplayer.func_35200_c(i, j, k)) - { - return false; - } -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/ItemSeeds.java ../src_work/minecraft_server/net/minecraft/src/ItemSeeds.java ---- ../src_base/minecraft_server/net/minecraft/src/ItemSeeds.java 2011-10-02 14:29:22.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/ItemSeeds.java 2011-10-02 14:29:22.000000000 -0400 -@@ -24,7 +24,7 @@ - { - return false; - } -- if(!entityplayer.func_35200_c(i, j, k) || !entityplayer.func_35200_c(i, j + 1, k)) -+ if(entityplayer!=null && (!entityplayer.func_35200_c(i, j, k) || !entityplayer.func_35200_c(i, j + 1, k))) - { - return false; - } -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/ItemTool.java ../src_work/minecraft_server/net/minecraft/src/ItemTool.java ---- ../src_base/minecraft_server/net/minecraft/src/ItemTool.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/ItemTool.java 2011-10-02 14:29:22.000000000 -0400 -@@ -4,6 +4,8 @@ - - package net.minecraft.src; - -+import java.util.Arrays; -+import net.minecraft.src.forge.ForgeHooks; - - // Referenced classes of package net.minecraft.src: - // Item, EnumToolMaterial, ItemStack, Block, -@@ -37,6 +39,14 @@ - return 1.0F; - } - -+ /* FORGE: Overridden to allow custom tool effectiveness -+ */ -+ 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) - { - itemstack.damageItem(2, entityliving1); -@@ -55,7 +65,7 @@ - } - - private Block blocksEffectiveAgainst[]; -- private float efficiencyOnProperMaterial; -- private int damageVsEntity; -+ public float efficiencyOnProperMaterial; -+ public int damageVsEntity; - protected EnumToolMaterial toolMaterial; - } -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/MovingObjectPosition.java ../src_work/minecraft_server/net/minecraft/src/MovingObjectPosition.java ---- ../src_base/minecraft_server/net/minecraft/src/MovingObjectPosition.java 2011-10-02 14:29:22.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/MovingObjectPosition.java 2011-10-02 14:29:22.000000000 -0400 -@@ -35,4 +35,7 @@ - public int sideHit; - public Vec3D hitVec; - public Entity entityHit; -+ -+ // Added for RedPower subblocks. -+ public int subHit=-1; - } -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/PlayerInstance.java ../src_work/minecraft_server/net/minecraft/src/PlayerInstance.java ---- ../src_base/minecraft_server/net/minecraft/src/PlayerInstance.java 2011-10-02 14:29:22.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/PlayerInstance.java 2011-10-02 14:29:22.000000000 -0400 -@@ -168,12 +168,11 @@ - sendPacketToPlayersInInstance(new Packet52MultiBlockChange(chunkX, chunkZ, blocksToUpdate, numBlocksToUpdate, worldserver)); - for(int k = 0; k < numBlocksToUpdate; k++) - { -- int j1 = chunkX * 16 + (numBlocksToUpdate >> 12 & 0xf); -- int i2 = numBlocksToUpdate & 0xff; -- int k2 = chunkZ * 16 + (numBlocksToUpdate >> 8 & 0xf); -+ int j1 = chunkX * 16 + (blocksToUpdate[k] >> 12 & 0xf); -+ int i2 = blocksToUpdate[k] & 0xff; -+ int k2 = chunkZ * 16 + (blocksToUpdate[k] >> 8 & 0xf); - if(Block.isBlockContainer[worldserver.getBlockId(j1, i2, k2)]) - { -- System.out.println("Sending!"); - updateTileEntity(worldserver.getBlockTileEntity(j1, i2, k2)); - } - } -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/SlotCrafting.java ../src_work/minecraft_server/net/minecraft/src/SlotCrafting.java ---- ../src_base/minecraft_server/net/minecraft/src/SlotCrafting.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/SlotCrafting.java 2011-10-02 14:29:22.000000000 -0400 -@@ -3,7 +3,7 @@ - // Decompiler options: packimports(3) braces deadcode - - package net.minecraft.src; -- -+import net.minecraft.src.forge.ForgeHooks; - - // Referenced classes of package net.minecraft.src: - // Slot, EntityPlayer, ItemStack, Block, -@@ -60,6 +60,7 @@ - thePlayer.addStat(AchievementList.buildSword, 1); - } - ModLoader.TakenFromCrafting(thePlayer, itemstack); -+ ForgeHooks.onTakenFromCrafting(thePlayer, itemstack, craftMatrix); - for(int i = 0; i < craftMatrix.getSizeInventory(); i++) - { - ItemStack itemstack1 = craftMatrix.getStackInSlot(i); -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/TileEntityFurnace.java ../src_work/minecraft_server/net/minecraft/src/TileEntityFurnace.java ---- ../src_base/minecraft_server/net/minecraft/src/TileEntityFurnace.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/TileEntityFurnace.java 2011-10-02 14:29:22.000000000 -0400 -@@ -4,6 +4,7 @@ - - package net.minecraft.src; - -+import net.minecraft.src.forge.ISidedInventory; - - // Referenced classes of package net.minecraft.src: - // TileEntity, IInventory, ItemStack, NBTTagCompound, -@@ -12,7 +13,7 @@ - // EntityPlayer - - public class TileEntityFurnace extends TileEntity -- implements IInventory -+ implements IInventory, ISidedInventory - { - - public TileEntityFurnace() -@@ -28,6 +29,16 @@ - return furnaceItemStacks.length; - } - -+ public int getStartInventorySide(int side) { -+ if(side==0) return 1; -+ if(side==1) return 0; -+ return 2; -+ } -+ -+ public int getSizeInventorySide(int side) { -+ return 1; -+ } -+ - public ItemStack getStackInSlot(int i) - { - return furnaceItemStacks[i]; -@@ -176,7 +187,7 @@ - { - return false; - } -- ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0].getItem().shiftedIndex); -+ ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0]); - if(itemstack == null) - { - return false; -@@ -189,13 +200,9 @@ - { - return false; - } -- if(furnaceItemStacks[2].stackSize < getInventoryStackLimit() && furnaceItemStacks[2].stackSize < furnaceItemStacks[2].getMaxStackSize()) -- { -- return true; -- } else -- { -- return furnaceItemStacks[2].stackSize < itemstack.getMaxStackSize(); -- } -+ int st=furnaceItemStacks[2].stackSize+itemstack.stackSize; -+ return (st<=getInventoryStackLimit() && -+ st<=itemstack.getMaxStackSize()); - } - - public void smeltItem() -@@ -204,23 +211,29 @@ - { - 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) -+ if(furnaceItemStacks[2].isItemEqual(itemstack)) -+ { -+ furnaceItemStacks[2].stackSize+=itemstack.stackSize; -+ } -+ if(furnaceItemStacks[0].getItem().hasContainerItem()) -+ { -+ furnaceItemStacks[0] = new ItemStack(furnaceItemStacks[0].getItem().getContainerItem()); -+ } else - { -- furnaceItemStacks[2].stackSize++; -+ furnaceItemStacks[0].stackSize--; - } -- furnaceItemStacks[0].stackSize--; - if(furnaceItemStacks[0].stackSize <= 0) - { - furnaceItemStacks[0] = null; - } - } - -- private int getItemBurnTime(ItemStack itemstack) -+ public static int getItemBurnTime(ItemStack itemstack) - { - if(itemstack == null) - { -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/TileEntity.java ../src_work/minecraft_server/net/minecraft/src/TileEntity.java ---- ../src_base/minecraft_server/net/minecraft/src/TileEntity.java 2011-10-02 14:29:22.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/TileEntity.java 2011-10-02 14:29:22.000000000 -0400 -@@ -61,6 +61,13 @@ - { - } - -+ /* FORGE: Return false if this TileEntity does not require updateEntity() -+ * calls. -+ */ -+ public boolean canUpdate() { -+ return true; -+ } -+ - public static TileEntity createAndLoadEntity(NBTTagCompound nbttagcompound) - { - TileEntity tileentity = null; -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/World.java ../src_work/minecraft_server/net/minecraft/src/World.java ---- ../src_base/minecraft_server/net/minecraft/src/World.java 2011-10-02 14:29:21.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/World.java 2011-10-02 14:35:03.000000000 -0400 -@@ -183,7 +183,11 @@ - - public boolean isAirBlock(int i, int j, int k) - { -- 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); - } - - public boolean blockExists(int i, int j, int k) -@@ -1124,7 +1128,7 @@ - Chunk chunk = getChunkFromChunkCoords(tileentity.xCoord >> 4, tileentity.zCoord >> 4); - if(chunk != null) - { -- chunk.removeChunkBlockTileEntity(tileentity.xCoord & 0xf, tileentity.yCoord, tileentity.zCoord & 0xf); -+ chunk.cleanChunkBlockTileEntity(tileentity.xCoord & 0xf, tileentity.yCoord, tileentity.zCoord & 0xf); - } - } - } -@@ -1151,15 +1155,15 @@ - { - loadedTileEntityList.add(tileentity1); - } -+ } else { - if(chunkExists(tileentity1.xCoord >> 4, tileentity1.zCoord >> 4)) - { - Chunk chunk1 = getChunkFromChunkCoords(tileentity1.xCoord >> 4, tileentity1.zCoord >> 4); - if(chunk1 != null) - { -- chunk1.setChunkBlockTileEntity(tileentity1.xCoord & 0xf, tileentity1.yCoord, tileentity1.zCoord & 0xf, tileentity1); -+ chunk1.cleanChunkBlockTileEntity(tileentity1.xCoord & 0xf, tileentity1.yCoord, tileentity1.zCoord & 0xf); - } - } -- markBlockNeedsUpdate(tileentity1.xCoord, tileentity1.yCoord, tileentity1.zCoord); - } - } while(true); - addedTileEntityList.clear(); -@@ -1168,13 +1172,19 @@ - - public void addTileEntity(Collection collection) - { -- if(scanningTileEntities) -- { -- addedTileEntityList.addAll(collection); -- } else -- { -- loadedTileEntityList.addAll(collection); -- } -+ List dest=scanningTileEntities ? addedTileEntityList : -+ loadedTileEntityList; -+ for(Object ob : collection) { -+ TileEntity te=(TileEntity)ob; -+ if(te.canUpdate()) dest.add(te); -+ } -+ } -+ -+ /* FORGE: Used as a bugfix */ -+ public void addTileEntity(TileEntity te) { -+ List dest=scanningTileEntities ? addedTileEntityList : -+ loadedTileEntityList; -+ if(te.canUpdate()) dest.add(te); - } - - public void updateEntity(Entity entity) -@@ -1372,6 +1382,9 @@ - if(j2 == Block.fire.blockID || j2 == Block.lavaMoving.blockID || j2 == Block.lavaStill.blockID) - { - return true; -+ } else { -+ if(j2>0 && Block.blocksList[j2].isBlockBurning(this,k1,l1,i2)) -+ return true; - } - } - -@@ -1590,44 +1603,23 @@ - - public void setBlockTileEntity(int i, int j, int k, TileEntity tileentity) - { -- if(tileentity != null && !tileentity.isInvalid()) -- { -- if(scanningTileEntities) -- { -- tileentity.xCoord = i; -- tileentity.yCoord = j; -- tileentity.zCoord = k; -- addedTileEntityList.add(tileentity); -- } else -- { -- loadedTileEntityList.add(tileentity); -- Chunk chunk = getChunkFromChunkCoords(i >> 4, k >> 4); -- if(chunk != null) -- { -- chunk.setChunkBlockTileEntity(i & 0xf, j, k & 0xf, tileentity); -- } -- } -- } -+ 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); -+ } - } - - public void removeBlockTileEntity(int i, int j, int k) - { -- TileEntity tileentity = getBlockTileEntity(i, j, k); -- if(tileentity != null && scanningTileEntities) -- { -- tileentity.invalidate(); -- } else -- { -- if(tileentity != null) -- { -- 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 func_35239_a(TileEntity tileentity) -@@ -1650,13 +1642,18 @@ - public boolean isBlockNormalCube(int i, int j, int k) - { - Block block = Block.blocksList[getBlockId(i, j, k)]; -- if(block == null) -- { -- return false; -- } else -- { -- return block.blockMaterial.getIsOpaque() && block.isACube(); -- } -+ if(block == null) return false; -+ return block.isBlockNormalCube(this,i,j,k); -+ } -+ -+ /* FORGE: Determine if the given block is considered solid on the -+ * specified side. Used by placement logic. -+ */ -+ public boolean isBlockSolidOnSide(int i, int j, int k, int side) -+ { -+ Block block = Block.blocksList[getBlockId(i, j, k)]; -+ if(block == null) return false; -+ return block.isBlockSolidOnSide(this,i,j,k,side); - } - - public void calculateInitialSkylight() -@@ -1976,7 +1973,7 @@ - - private int func_35241_e(int i, int j, int k, int l, int i1, int j1) - { -- 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; -@@ -2315,6 +2312,7 @@ - { - block = null; - } -+ if(block!=null && block.isBlockReplaceable(this,j,k,l)) block=null; - return i > 0 && block == null && block1.canPlaceBlockOnSide(this, j, k, l, i1); - } - -@@ -2759,7 +2757,7 @@ - public int field_27080_i; - public boolean editingBlocks; - private long lockTimestamp; -- protected int autosavePeriod; -+ public int autosavePeriod; - public int difficultySetting; - public Random rand; - public boolean isNewWorld; -Only in ../src_work/minecraft_server/net/minecraft/src: World.java.orig -Only in ../src_work/minecraft_server/net/minecraft/src: World.java.rej -diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/WorldServer.java ../src_work/minecraft_server/net/minecraft/src/WorldServer.java ---- ../src_base/minecraft_server/net/minecraft/src/WorldServer.java 2011-10-02 14:29:22.000000000 -0400 -+++ ../src_work/minecraft_server/net/minecraft/src/WorldServer.java 2011-10-02 14:29:22.000000000 -0400 -@@ -54,15 +54,20 @@ - public List getTileEntityList(int i, int j, int k, int l, int i1, int j1) - { - ArrayList arraylist = new ArrayList(); -- for(int k1 = 0; k1 < loadedTileEntityList.size(); k1++) -- { -- TileEntity tileentity = (TileEntity)loadedTileEntityList.get(k1); -- if(tileentity.xCoord >= i && tileentity.yCoord >= j && tileentity.zCoord >= k && tileentity.xCoord < l && tileentity.yCoord < i1 && tileentity.zCoord < j1) -- { -- arraylist.add(tileentity); -- } -- } -- -+ for(int x=(i>>4); x<=(l>>4); x++) -+ for(int z=(k>>4); z<=(j1>>4); z++) { -+ Chunk ch=getChunkFromChunkCoords(x,z); -+ if(ch==null) continue; -+ for(Object ob : ch.chunkTileEntityMap.values()) { -+ TileEntity te=(TileEntity)ob; -+ if(te.isInvalid()) continue; -+ if(te.xCoord>=i && te.yCoord>=j && te.zCoord>=k -+ && te.xCoord getBlockDropped(World world, ++ int i, int j, int k, int md) { ++ ArrayList tr=new ArrayList(); ++ ++ int q=quantityDropped(md,world.rand); ++ for(int n=0; n0) { ++ tr.add(new ItemStack(id,1,damageDropped(md))); ++ } ++ } ++ return tr; + } + + public final void dropBlockAsItem(World world, int i, int j, int k, int l) +@@ -309,20 +328,12 @@ + { + return; + } +- int i1 = quantityDropped(world.rand); +- for(int j1 = 0; j1 < i1; j1++) +- { ++ ArrayList ar=getBlockDropped(world,i,j,k,l); ++ for(ItemStack ist : ar) { + if(world.rand.nextFloat() > f) +- { + continue; +- } +- int k1 = idDropped(l, world.rand); +- if(k1 > 0) +- { +- dropBlockAsItem_do(world, i, j, k, new ItemStack(k1, 1, damageDropped(l))); +- } ++ dropBlockAsItem_do(world, i, j, k, ist); + } +- + } + + protected void dropBlockAsItem_do(World world, int i, int j, int k, ItemStack itemstack) +@@ -618,6 +629,86 @@ + return iblockaccess.isBlockNormalCube(i, j, k) ? 0.2F : 1.0F; + } + ++ /* FORGE: Allow a block to set illumination on a coordinate basis. ++ */ ++ public int getLightValue(IBlockAccess iba, int i, int j, int k) { ++ return lightValue[blockID]; ++ } ++ ++ /* FORGE: Implement and return true if you wish this block to behave ++ * like a ladder when the player is inside. ++ */ ++ public boolean isLadder() { ++ return false; ++ } ++ ++ /* FORGE: Return true if the block is a normal, solid cube. This ++ * determines indirect power state, entity ejection from blocks, and a few ++ * others. ++ */ ++ public boolean isBlockNormalCube(World world, int i, int j, int k) { ++ return blockMaterial.getIsOpaque() && 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); ++ } ++ ++ /* FORGE: Return true if the player can place a new block in the block ++ * occupied by this one, like water, lava, fire, etc. ++ */ ++ public boolean isBlockReplaceable( World world, int i, int j, int k ) { ++ return false; ++ } ++ ++ /* FORGE: Return true if this block should set fire and deal fire damage ++ * to entities coming into contact with it, false otherwise. ++ */ ++ public boolean isBlockBurning( World world, int i, int j, int k ) { ++ 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 ++ * 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 ) { ++ return false; ++ } ++ ++ /* FORGE: Return the block hardness with metadata md. ++ */ ++ public float getHardness(int md) { ++ return blockHardness; ++ } ++ ++ /* FORGE: Return the block strength of the block at i,j,k against the ++ * player. ++ */ ++ public float blockStrength(World world, EntityPlayer player, ++ int i, int j, int k) { ++ int md=world.getBlockMetadata(i,j,k); ++ return blockStrength(player,md); ++ } ++ ++ /* FORGE: Return the block strength of a prototypical block with metadata ++ * md against the player. ++ */ ++ public float blockStrength(EntityPlayer player, int md) { ++ return ForgeHooks.blockStrength(this,player,md); ++ } ++ ++ /* FORGE: Return true if the player can harvest a prototypical block with ++ * metadata md. ++ */ ++ public boolean canHarvestBlock(EntityPlayer player, int md) { ++ return ForgeHooks.canHarvestBlock(this,player,md); ++ } ++ + static Class _mthclass$(String s) + { + try diff --git a/patches/minecraft/net/minecraft/src/BlockButton.java.patch b/patches/minecraft/net/minecraft/src/BlockButton.java.patch new file mode 100644 index 0000000000..cc54d7ee6b --- /dev/null +++ b/patches/minecraft/net/minecraft/src/BlockButton.java.patch @@ -0,0 +1,119 @@ +--- ../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 +@@ -41,36 +41,36 @@ + + public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l) + { +- 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); + } + + 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); + } + + public void onBlockPlaced(World world, int i, int j, int k, int l) +@@ -78,19 +78,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)) ++ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3)) + { + i1 = 3; + } else +- if(l == 4 && world.isBlockNormalCube(i + 1, j, k)) ++ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4)) + { + i1 = 2; + } else +- if(l == 5 && world.isBlockNormalCube(i - 1, j, k)) ++ if(l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5)) + { + i1 = 1; + } else +@@ -102,19 +102,19 @@ + + private int getOrientation(World world, int i, int j, int k) + { +- 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; + } + + public void onNeighborBlockChange(World world, int i, int j, int k, int l) +@@ -123,19 +123,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) + { + flag = true; + } +- if(!world.isBlockNormalCube(i + 1, j, k) && i1 == 2) ++ if(!world.isBlockSolidOnSide(i + 1, j, k,4) && i1 == 2) + { + flag = true; + } +- if(!world.isBlockNormalCube(i, j, k - 1) && i1 == 3) ++ if(!world.isBlockSolidOnSide(i, j, k - 1,3) && i1 == 3) + { + flag = true; + } +- if(!world.isBlockNormalCube(i, j, k + 1) && i1 == 4) ++ if(!world.isBlockSolidOnSide(i, j, k + 1,2) && i1 == 4) + { + flag = true; + } diff --git a/patches/minecraft/net/minecraft/src/BlockChest.java.patch b/patches/minecraft/net/minecraft/src/BlockChest.java.patch new file mode 100644 index 0000000000..8c69a81af3 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/BlockChest.java.patch @@ -0,0 +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 +@@ -423,23 +423,23 @@ + { + return true; + } +- if(world.isBlockNormalCube(i, j + 1, k)) ++ if(world.isBlockSolidOnSide(i, j + 1, k,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)) + { + 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)) + { + 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)) + { + 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)) + { + return true; + } diff --git a/patches/minecraft/net/minecraft/src/BlockContainer.java.patch b/patches/minecraft/net/minecraft/src/BlockContainer.java.patch new file mode 100644 index 0000000000..1871f24c98 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/BlockContainer.java.patch @@ -0,0 +1,24 @@ +--- ../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 +@@ -26,7 +26,7 @@ + public void onBlockAdded(World world, int i, int j, int k) + { + super.onBlockAdded(world, i, j, k); +- world.setBlockTileEntity(i, j, k, getBlockEntity()); ++ world.setBlockTileEntity(i, j, k, getBlockEntity(world.getBlockMetadata(i,j,k))); + } + + public void onBlockRemoval(World world, int i, int j, int k) +@@ -37,6 +37,12 @@ + + public abstract TileEntity getBlockEntity(); + ++ /* FORGE: Metadata-sensitive version, to fix 1.8.1 regression. ++ */ ++ public TileEntity getBlockEntity(int md) { ++ return getBlockEntity(); ++ } ++ + public void playBlock(World world, int i, int j, int k, int l, int i1) + { + super.playBlock(world, i, j, k, l, i1); diff --git a/patches/minecraft/net/minecraft/src/BlockCrops.java.patch b/patches/minecraft/net/minecraft/src/BlockCrops.java.patch new file mode 100644 index 0000000000..2706d14e6d --- /dev/null +++ b/patches/minecraft/net/minecraft/src/BlockCrops.java.patch @@ -0,0 +1,48 @@ +--- ../src_base/minecraft/net/minecraft/src/BlockCrops.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft/net/minecraft/src/BlockCrops.java 0000-00-00 00:00:00.000000000 -0000 +@@ -5,6 +5,7 @@ + package net.minecraft.src; + + import java.util.Random; ++import java.util.ArrayList; + + // Referenced classes of package net.minecraft.src: + // BlockFlower, Block, World, EntityItem, +@@ -108,27 +109,16 @@ + return 6; + } + +- public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f) +- { +- super.dropBlockAsItemWithChance(world, i, j, k, l, f); +- if(world.multiplayerWorld) +- { +- return; +- } +- for(int i1 = 0; i1 < 3; i1++) +- { +- if(world.rand.nextInt(15) <= l) +- { +- 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.entityJoinedWorld(entityitem); +- } +- } +- ++ public ArrayList getBlockDropped(World world, ++ int i, int j, int k, int md) { ++ ArrayList tr=new ArrayList(); ++ if(md==7) tr.add(new ItemStack(Item.wheat)); ++ ++ for(int n=0; n<3; n++) { ++ if(world.rand.nextInt(15) <= md) ++ tr.add(new ItemStack(Item.seeds)); ++ } ++ return tr; + } + + public int idDropped(int i, Random random) diff --git a/patches/minecraft/net/minecraft/src/BlockDoor.java.patch b/patches/minecraft/net/minecraft/src/BlockDoor.java.patch new file mode 100644 index 0000000000..e6ba89fe80 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/BlockDoor.java.patch @@ -0,0 +1,20 @@ +--- ../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 +@@ -178,7 +178,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; +@@ -242,7 +242,7 @@ + return false; + } 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); + } + } + diff --git a/patches/minecraft/net/minecraft/src/BlockLadder.java.patch b/patches/minecraft/net/minecraft/src/BlockLadder.java.patch new file mode 100644 index 0000000000..78010cb2ad --- /dev/null +++ b/patches/minecraft/net/minecraft/src/BlockLadder.java.patch @@ -0,0 +1,84 @@ +--- ../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 +@@ -63,6 +63,11 @@ + return super.getSelectedBoundingBoxFromPool(world, i, j, k); + } + ++ /* FORGE: Implemented base method, see Block.isLadder */ ++ public boolean isLadder() { ++ return true; ++ } ++ + public boolean isOpaqueCube() + { + return false; +@@ -80,37 +85,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); + } + + public void onBlockPlaced(World world, int i, int j, int k, int l) + { + 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)) + { + i1 = 2; + } +- if((i1 == 0 || l == 3) && world.isBlockNormalCube(i, j, k - 1)) ++ if((i1 == 0 || l == 3) && world.isBlockSolidOnSide(i, j, k - 1,3)) + { + i1 = 3; + } +- if((i1 == 0 || l == 4) && world.isBlockNormalCube(i + 1, j, k)) ++ if((i1 == 0 || l == 4) && world.isBlockSolidOnSide(i + 1, j, k,4)) + { + i1 = 4; + } +- if((i1 == 0 || l == 5) && world.isBlockNormalCube(i - 1, j, k)) ++ if((i1 == 0 || l == 5) && world.isBlockSolidOnSide(i - 1, j, k,5)) + { + i1 = 5; + } +@@ -121,19 +126,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)) + { + flag = true; + } +- if(i1 == 3 && world.isBlockNormalCube(i, j, k - 1)) ++ if(i1 == 3 && world.isBlockSolidOnSide(i, j, k - 1,3)) + { + flag = true; + } +- if(i1 == 4 && world.isBlockNormalCube(i + 1, j, k)) ++ if(i1 == 4 && world.isBlockSolidOnSide(i + 1, j, k,4)) + { + flag = true; + } +- if(i1 == 5 && world.isBlockNormalCube(i - 1, j, k)) ++ if(i1 == 5 && world.isBlockSolidOnSide(i - 1, j, k,5)) + { + flag = true; + } diff --git a/patches/minecraft/net/minecraft/src/BlockLever.java.patch b/patches/minecraft/net/minecraft/src/BlockLever.java.patch new file mode 100644 index 0000000000..f2937b1c37 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/BlockLever.java.patch @@ -0,0 +1,120 @@ +--- ../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 +@@ -40,44 +40,44 @@ + + public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l) + { +- 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); + } + + 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; + } +- 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); + } + + public void onBlockPlaced(World world, int i, int j, int k, int l) +@@ -86,23 +86,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)) + { + i1 = 5 + world.rand.nextInt(2); + } +- if(l == 2 && world.isBlockNormalCube(i, j, k + 1)) ++ if(l == 2 && world.isBlockSolidOnSide(i, j, k + 1,2)) + { + i1 = 4; + } +- if(l == 3 && world.isBlockNormalCube(i, j, k - 1)) ++ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3)) + { + i1 = 3; + } +- if(l == 4 && world.isBlockNormalCube(i + 1, j, k)) ++ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4)) + { + i1 = 2; + } +- if(l == 5 && world.isBlockNormalCube(i - 1, j, k)) ++ if(l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5)) + { + i1 = 1; + } +@@ -124,27 +124,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) + { + flag = true; + } +- if(!world.isBlockNormalCube(i + 1, j, k) && i1 == 2) ++ if(!world.isBlockSolidOnSide(i + 1, j, k,4) && i1 == 2) + { + flag = true; + } +- if(!world.isBlockNormalCube(i, j, k - 1) && i1 == 3) ++ if(!world.isBlockSolidOnSide(i, j, k - 1,3) && i1 == 3) + { + flag = true; + } +- if(!world.isBlockNormalCube(i, j, k + 1) && i1 == 4) ++ if(!world.isBlockSolidOnSide(i, j, k + 1,2) && i1 == 4) + { + flag = true; + } +- if(!world.isBlockNormalCube(i, j - 1, k) && i1 == 5) ++ if(!world.isBlockSolidOnSide(i, j - 1, k,1) && i1 == 5) + { + flag = true; + } +- if(!world.isBlockNormalCube(i, j - 1, k) && i1 == 6) ++ if(!world.isBlockSolidOnSide(i, j - 1, k,1) && i1 == 6) + { + flag = true; + } diff --git a/patches/minecraft/net/minecraft/src/BlockPressurePlate.java.patch b/patches/minecraft/net/minecraft/src/BlockPressurePlate.java.patch new file mode 100644 index 0000000000..16abd9ba82 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/BlockPressurePlate.java.patch @@ -0,0 +1,22 @@ +--- ../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 +@@ -46,7 +46,8 @@ + + public boolean canPlaceBlockAt(World world, int i, int j, int k) + { +- 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; + } + + public void onBlockAdded(World world, int i, int j, int k) +@@ -56,7 +57,8 @@ + public void onNeighborBlockChange(World world, int i, int j, int k, int l) + { + 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) + { + flag = true; + } diff --git a/patches/minecraft/net/minecraft/src/BlockRail.java.patch b/patches/minecraft/net/minecraft/src/BlockRail.java.patch new file mode 100644 index 0000000000..2e26b4bb34 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/BlockRail.java.patch @@ -0,0 +1,55 @@ +--- ../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 +@@ -16,12 +16,12 @@ + public static final boolean isRailBlockAt(World world, int i, int j, int k) + { + 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; + } + + public static final boolean isRailBlock(int i) + { +- return i == Block.rail.blockID || i == Block.railPowered.blockID || i == Block.railDetector.blockID; ++ return Block.blocksList[i] instanceof BlockRail; + } + + protected BlockRail(int i, int j, boolean flag) +@@ -97,7 +97,7 @@ + + public boolean canPlaceBlockAt(World world, int i, int j, int k) + { +- return world.isBlockNormalCube(i, j - 1, k); ++ return world.isBlockSolidOnSide(i, j - 1, k,1); + } + + public void onBlockAdded(World world, int i, int j, int k) +@@ -121,23 +121,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; + } diff --git a/patches/minecraft/net/minecraft/src/BlockRedstoneRepeater.java.patch b/patches/minecraft/net/minecraft/src/BlockRedstoneRepeater.java.patch new file mode 100644 index 0000000000..488e9ef02c --- /dev/null +++ b/patches/minecraft/net/minecraft/src/BlockRedstoneRepeater.java.patch @@ -0,0 +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 +@@ -27,7 +27,7 @@ + + public boolean canPlaceBlockAt(World world, int i, int j, int k) + { +- if(!world.isBlockNormalCube(i, j - 1, k)) ++ if(!world.isBlockSolidOnSide(i, j - 1, k,1)) + { + return false; + } else +@@ -38,7 +38,7 @@ + + public boolean canBlockStay(World world, int i, int j, int k) + { +- if(!world.isBlockNormalCube(i, j - 1, k)) ++ if(!world.isBlockSolidOnSide(i, j - 1, k,1)) + { + return false; + } else diff --git a/patches/minecraft/net/minecraft/src/BlockRedstoneWire.java.patch b/patches/minecraft/net/minecraft/src/BlockRedstoneWire.java.patch new file mode 100644 index 0000000000..f0c5c3468a --- /dev/null +++ b/patches/minecraft/net/minecraft/src/BlockRedstoneWire.java.patch @@ -0,0 +1,30 @@ +--- ../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 +@@ -3,6 +3,7 @@ + // Decompiler options: packimports(3) braces deadcode + + package net.minecraft.src; ++import net.minecraft.src.forge.*; + + import java.util.*; + +@@ -53,7 +54,7 @@ + + public boolean canPlaceBlockAt(World world, int i, int j, int k) + { +- return world.isBlockNormalCube(i, j - 1, k); ++ return world.isBlockSolidOnSide(i, j - 1, k, 1); + } + + private void updateAndPropagateCurrentStrength(World world, int i, int j, int k) +@@ -451,6 +452,10 @@ + { + return false; + } ++ if (Block.blocksList[i1] instanceof IConnectRedstone) { ++ IConnectRedstone icr = (IConnectRedstone) Block.blocksList[i1]; ++ return icr.canConnectRedstone(iblockaccess, i, j, k, l); ++ } + if(Block.blocksList[i1].canProvidePower()) + { + return true; diff --git a/patches/minecraft/net/minecraft/src/BlockTallGrass.java.patch b/patches/minecraft/net/minecraft/src/BlockTallGrass.java.patch new file mode 100644 index 0000000000..d4750f5201 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/BlockTallGrass.java.patch @@ -0,0 +1,38 @@ +--- ../src_base/minecraft/net/minecraft/src/BlockTallGrass.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft/net/minecraft/src/BlockTallGrass.java 0000-00-00 00:00:00.000000000 -0000 +@@ -4,7 +4,10 @@ + + package net.minecraft.src; + ++import net.minecraft.src.forge.ForgeHooks; ++ + import java.util.Random; ++import java.util.ArrayList; + + // Referenced classes of package net.minecraft.src: + // BlockFlower, ColorizerGrass, ColorizerFoliage, IBlockAccess, +@@ -79,13 +82,17 @@ + + public int idDropped(int i, Random random) + { +- if(random.nextInt(8) == 0) +- { +- return Item.seeds.shiftedIndex; +- } else +- { +- return -1; +- } ++ return -1; ++ } ++ ++ public ArrayList getBlockDropped(World world, ++ int i, int j, int k, int md) { ++ ArrayList tr=new ArrayList(); ++ if(world.rand.nextInt(8)!=0) ++ return tr; ++ ItemStack ist=ForgeHooks.getGrassSeed(world); ++ if(ist!=null) tr.add(ist); ++ return tr; + } + + public void harvestBlock(World world, EntityPlayer entityplayer, int i, int j, int k, int l) diff --git a/patches/minecraft/net/minecraft/src/BlockTorch.java.patch b/patches/minecraft/net/minecraft/src/BlockTorch.java.patch new file mode 100644 index 0000000000..c3f031031c --- /dev/null +++ b/patches/minecraft/net/minecraft/src/BlockTorch.java.patch @@ -0,0 +1,104 @@ +--- ../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 +@@ -41,24 +41,24 @@ + + private boolean func_31032_h(World world, int i, int j, int k) + { +- return world.isBlockNormalCube(i, j, k) || world.getBlockId(i, j, k) == Block.fence.blockID; ++ return world.isBlockSolidOnSide(i, j, k,1) || world.getBlockId(i, j, k) == Block.fence.blockID; + } + + 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; + } +- if(world.isBlockNormalCube(i, j, k + 1)) ++ if(world.isBlockSolidOnSide(i, j, k + 1,2)) + { + return true; + } +@@ -72,19 +72,19 @@ + { + i1 = 5; + } +- if(l == 2 && world.isBlockNormalCube(i, j, k + 1)) ++ if(l == 2 && world.isBlockSolidOnSide(i, j, k + 1,2)) + { + i1 = 4; + } +- if(l == 3 && world.isBlockNormalCube(i, j, k - 1)) ++ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3)) + { + i1 = 3; + } +- if(l == 4 && world.isBlockNormalCube(i + 1, j, k)) ++ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4)) + { + i1 = 2; + } +- if(l == 5 && world.isBlockNormalCube(i - 1, j, k)) ++ if(l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5)) + { + i1 = 1; + } +@@ -102,19 +102,19 @@ + + public void onBlockAdded(World world, int i, int j, int k) + { +- if(world.isBlockNormalCube(i - 1, j, k)) ++ if(world.isBlockSolidOnSide(i - 1, j, k,5)) + { + world.setBlockMetadataWithNotify(i, j, k, 1); + } else +- if(world.isBlockNormalCube(i + 1, j, k)) ++ if(world.isBlockSolidOnSide(i + 1, j, k,4)) + { + world.setBlockMetadataWithNotify(i, j, k, 2); + } else +- if(world.isBlockNormalCube(i, j, k - 1)) ++ if(world.isBlockSolidOnSide(i, j, k - 1,3)) + { + world.setBlockMetadataWithNotify(i, j, k, 3); + } else +- if(world.isBlockNormalCube(i, j, k + 1)) ++ if(world.isBlockSolidOnSide(i, j, k + 1,2)) + { + world.setBlockMetadataWithNotify(i, j, k, 4); + } else +@@ -131,19 +131,19 @@ + { + int i1 = world.getBlockMetadata(i, j, k); + boolean flag = false; +- if(!world.isBlockNormalCube(i - 1, j, k) && i1 == 1) ++ if(!world.isBlockSolidOnSide(i - 1, j, k,5) && i1 == 1) + { + flag = true; + } +- if(!world.isBlockNormalCube(i + 1, j, k) && i1 == 2) ++ if(!world.isBlockSolidOnSide(i + 1, j, k,4) && i1 == 2) + { + flag = true; + } +- if(!world.isBlockNormalCube(i, j, k - 1) && i1 == 3) ++ if(!world.isBlockSolidOnSide(i, j, k - 1,3) && i1 == 3) + { + flag = true; + } +- if(!world.isBlockNormalCube(i, j, k + 1) && i1 == 4) ++ if(!world.isBlockSolidOnSide(i, j, k + 1,2) && i1 == 4) + { + flag = true; + } diff --git a/patches/minecraft/net/minecraft/src/BlockTrapDoor.java.patch b/patches/minecraft/net/minecraft/src/BlockTrapDoor.java.patch new file mode 100644 index 0000000000..e3106e78e0 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/BlockTrapDoor.java.patch @@ -0,0 +1,36 @@ +--- ../src_base/minecraft/net/minecraft/src/BlockTrapDoor.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft/net/minecraft/src/BlockTrapDoor.java 0000-00-00 00:00:00.000000000 -0000 +@@ -147,7 +147,7 @@ + { + j1--; + } +- if(!world.isBlockNormalCube(j1, j, k1)) ++ if(!disableValidation && !world.isBlockSolidOnSide(j1, j, k1, (i1&3)+2)) + { + world.setBlockWithNotify(i, j, k, 0); + dropBlockAsItem(world, i, j, k, i1); +@@ -189,6 +189,7 @@ + + public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l) + { ++ if(disableValidation) return true; + if(l == 0) + { + return false; +@@ -213,11 +214,15 @@ + { + i--; + } +- return world.isBlockNormalCube(i, j, k); ++ return world.isBlockSolidOnSide(i, j, k, l); + } + + public static boolean isTrapdoorOpen(int i) + { + return (i & 4) != 0; + } ++ ++ /* FORGE: Set this to allow trapdoors to remain free-floating ++ */ ++ public static boolean disableValidation=false; + } diff --git a/patches/minecraft/net/minecraft/src/Chunk.java.patch b/patches/minecraft/net/minecraft/src/Chunk.java.patch new file mode 100644 index 0000000000..20285d71da --- /dev/null +++ b/patches/minecraft/net/minecraft/src/Chunk.java.patch @@ -0,0 +1,354 @@ +--- ../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 +@@ -3,6 +3,7 @@ + // Decompiler options: packimports(3) braces deadcode + + package net.minecraft.src; ++import net.minecraft.src.forge.*; + + import java.io.PrintStream; + import java.util.*; +@@ -26,7 +27,6 @@ + hasEntities = false; + lastSaveTime = 0L; + field_35846_u = false; +- world.getClass(); + entities = new List[128 / 16]; + worldObj = world; + xPosition = i; +@@ -44,11 +44,8 @@ + { + this(world, i, j); + blocks = abyte0; +- world.getClass(); + data = new NibbleArray(abyte0.length, 7); +- world.getClass(); + skylightMap = new NibbleArray(abyte0.length, 7); +- world.getClass(); + blocklightMap = new NibbleArray(abyte0.length, 7); + } + +@@ -68,16 +65,12 @@ + + public void generateHeightMap() + { +- worldObj.getClass(); + int i = 128 - 1; + for(int j = 0; j < 16; j++) + { + for(int k = 0; k < 16; k++) + { +- worldObj.getClass(); + int l = 128 - 1; +- worldObj.getClass(); +- worldObj.getClass(); + for(int i1 = j << 11 | k << 7; l > 0 && Block.lightOpacity[blocks[(i1 + l) - 1] & 0xff] == 0; l--) { } + heightMap[k << 4 | j] = (byte)l; + if(l < i) +@@ -94,16 +87,12 @@ + + public void generateSkylightMap() + { +- worldObj.getClass(); + int i = 128 - 1; + for(int j = 0; j < 16; j++) + { + for(int l = 0; l < 16; l++) + { +- worldObj.getClass(); + int j1 = 128 - 1; +- worldObj.getClass(); +- worldObj.getClass(); + int k1; + for(k1 = j << 11 | l << 7; j1 > 0 && Block.lightOpacity[blocks[(k1 + j1) - 1] & 0xff] == 0; j1--) { } + heightMap[l << 4 | j] = (byte)j1; +@@ -116,7 +105,6 @@ + continue; + } + int l1 = 15; +- worldObj.getClass(); + int i2 = 128 - 1; + do + { +@@ -154,7 +142,6 @@ + + private void func_35839_k() + { +- worldObj.getClass(); + if(worldObj.doChunksNearChunkExist(xPosition * 16 + 8, 128 / 2, zPosition * 16 + 8, 16)) + { + for(int i = 0; i < 16; i++) +@@ -216,7 +203,6 @@ + { + if(l > k) + { +- worldObj.getClass(); + if(worldObj.doChunksNearChunkExist(i, 128 / 2, j, 16)) + { + for(int i1 = k; i1 < l; i1++) +@@ -237,8 +223,6 @@ + { + i1 = j; + } +- worldObj.getClass(); +- worldObj.getClass(); + for(int j1 = i << 11 | k << 7; i1 > 0 && Block.lightOpacity[blocks[(j1 + i1) - 1] & 0xff] == 0; i1--) { } + if(i1 == l) + { +@@ -251,7 +235,6 @@ + lowestBlockHeight = i1; + } else + { +- worldObj.getClass(); + int k1 = 128 - 1; + for(int i2 = 0; i2 < 16; i2++) + { +@@ -320,8 +303,6 @@ + + public int getBlockID(int i, int j, int k) + { +- worldObj.getClass(); +- worldObj.getClass(); + return blocks[i << 11 | k << 7 | j] & 0xff; + } + +@@ -334,8 +315,6 @@ + field_35845_c[j1] = -999; + } + int k1 = heightMap[k << 4 | i] & 0xff; +- worldObj.getClass(); +- worldObj.getClass(); + int l1 = blocks[i << 11 | k << 7 | j] & 0xff; + if(l1 == l && data.getNibble(i, j, k) == i1) + { +@@ -343,12 +322,18 @@ + } + int i2 = xPosition * 16 + i; + int j2 = zPosition * 16 + k; +- worldObj.getClass(); +- worldObj.getClass(); ++ ++ if (Block.blocksList[l1] instanceof IOverrideReplace) { ++ IOverrideReplace iovr = (IOverrideReplace) Block.blocksList[l1]; ++ if (!iovr.canReplaceBlock(worldObj, i2, j, j2, l)) ++ return iovr.getReplacedSuccess(); ++ } ++ + blocks[i << 11 | k << 7 | j] = (byte)(byte0 & 0xff); +- if(l1 != 0 && !worldObj.multiplayerWorld) +- { +- Block.blocksList[l1].onBlockRemoval(worldObj, i2, j, j2); ++ if(l1 != 0) { ++ if(!worldObj.multiplayerWorld) ++ Block.blocksList[l1].onBlockRemoval(worldObj, i2, j, j2); ++ removeChunkBlockTileEntity(i,j,k); + } + data.setNibble(i, j, k, i1); + if(!worldObj.worldProvider.hasNoSky) +@@ -380,7 +365,7 @@ + TileEntity tileentity = getChunkBlockTileEntity(i, j, k); + if(tileentity == null) + { +- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(); ++ tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(i1); + worldObj.setBlockTileEntity(i, j, k, tileentity); + } + if(tileentity != null) +@@ -388,14 +373,6 @@ + tileentity.func_35144_b(); + } + } +- } else +- if(l1 > 0 && (Block.blocksList[l1] instanceof BlockContainer)) +- { +- TileEntity tileentity1 = getChunkBlockTileEntity(i, j, k); +- if(tileentity1 != null) +- { +- tileentity1.func_35144_b(); +- } + } + isModified = true; + return true; +@@ -410,8 +387,6 @@ + field_35845_c[i1] = -999; + } + int j1 = heightMap[i1] & 0xff; +- worldObj.getClass(); +- worldObj.getClass(); + int k1 = blocks[i << 11 | k << 7 | j] & 0xff; + if(k1 == l) + { +@@ -419,12 +394,18 @@ + } + int l1 = xPosition * 16 + i; + int i2 = zPosition * 16 + k; +- worldObj.getClass(); +- worldObj.getClass(); ++ ++ if (Block.blocksList[k1] instanceof IOverrideReplace) { ++ IOverrideReplace iovr = (IOverrideReplace) Block.blocksList[k1]; ++ if (!iovr.canReplaceBlock(worldObj, l1, j, i2, l)) ++ return iovr.getReplacedSuccess(); ++ } ++ + blocks[i << 11 | k << 7 | j] = (byte)(byte0 & 0xff); +- if(k1 != 0) +- { +- Block.blocksList[k1].onBlockRemoval(worldObj, l1, j, i2); ++ if(k1 != 0) { ++ if(!worldObj.multiplayerWorld) ++ Block.blocksList[k1].onBlockRemoval(worldObj, l1, j, i2); ++ removeChunkBlockTileEntity(i,j,k); + } + data.setNibble(i, j, k, 0); + if(Block.lightOpacity[byte0 & 0xff] != 0) +@@ -452,7 +433,7 @@ + TileEntity tileentity = getChunkBlockTileEntity(i, j, k); + if(tileentity == null) + { +- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(); ++ tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(0); + worldObj.setBlockTileEntity(i, j, k, tileentity); + } + if(tileentity != null) +@@ -460,14 +441,6 @@ + tileentity.func_35144_b(); + } + } +- } else +- if(k1 > 0 && (Block.blocksList[k1] instanceof BlockContainer)) +- { +- TileEntity tileentity1 = getChunkBlockTileEntity(i, j, k); +- if(tileentity1 != null) +- { +- tileentity1.func_35144_b(); +- } + } + isModified = true; + return true; +@@ -594,6 +567,11 @@ + { + ChunkPosition chunkposition = new ChunkPosition(i, j, k); + TileEntity tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition); ++ if(tileentity != null && tileentity.isInvalid()) ++ { ++ chunkTileEntityMap.remove(chunkposition); ++ tileentity=null; ++ } + if(tileentity == null) + { + int l = getBlockID(i, j, k); +@@ -603,18 +581,23 @@ + } + if(tileentity == null) + { +- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(); ++ tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(getBlockMetadata(i,j,k)); + worldObj.setBlockTileEntity(xPosition * 16 + i, j, zPosition * 16 + k, tileentity); + } + tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition); + } +- if(tileentity != null && tileentity.isInvalid()) +- { +- chunkTileEntityMap.remove(chunkposition); +- return null; +- } else ++ return tileentity; ++ } ++ ++ /* FORGE: Used to remove only invalid TileEntities */ ++ public void cleanChunkBlockTileEntity(int i, int j, int k) ++ { ++ ChunkPosition chunkposition = new ChunkPosition(i, j, k); ++ if(isChunkLoaded) + { +- return tileentity; ++ TileEntity tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition); ++ if(tileentity!=null && tileentity.isInvalid()) ++ chunkTileEntityMap.remove(chunkposition); + } + } + +@@ -626,7 +609,7 @@ + setChunkBlockTileEntity(i, j, k, tileentity); + if(isChunkLoaded) + { +- worldObj.loadedTileEntityList.add(tileentity); ++ worldObj.addTileEntity(tileentity); + } + } + +@@ -643,6 +626,8 @@ + return; + } else + { ++ TileEntity old=(TileEntity)chunkTileEntityMap.get(chunkposition); ++ if(old!=null) old.invalidate(); + tileentity.validate(); + chunkTileEntityMap.put(chunkposition, tileentity); + return; +@@ -777,8 +762,6 @@ + { + for(int l2 = k; l2 < j1; l2++) + { +- worldObj.getClass(); +- worldObj.getClass(); + int l3 = l1 << 11 | l2 << 7 | j; + int l4 = i1 - j; + System.arraycopy(abyte0, k1, blocks, l3, l4); +@@ -792,8 +775,6 @@ + { + for(int i3 = k; i3 < j1; i3++) + { +- worldObj.getClass(); +- worldObj.getClass(); + int i4 = (i2 << 11 | i3 << 7 | j) >> 1; + int i5 = (i1 - j) / 2; + System.arraycopy(abyte0, k1, data.data, i4, i5); +@@ -806,8 +787,6 @@ + { + for(int j3 = k; j3 < j1; j3++) + { +- worldObj.getClass(); +- worldObj.getClass(); + int j4 = (j2 << 11 | j3 << 7 | j) >> 1; + int j5 = (i1 - j) / 2; + System.arraycopy(abyte0, k1, blocklightMap.data, j4, j5); +@@ -820,8 +799,6 @@ + { + for(int k3 = k; k3 < j1; k3++) + { +- worldObj.getClass(); +- worldObj.getClass(); + int k4 = (k2 << 11 | k3 << 7 | j) >> 1; + int k5 = (i1 - j) / 2; + System.arraycopy(abyte0, k1, skylightMap.data, k4, k5); +@@ -830,11 +807,20 @@ + + } + ++ List invalidList=new ArrayList(); + TileEntity tileentity; + for(Iterator iterator = chunkTileEntityMap.values().iterator(); iterator.hasNext(); tileentity.func_35144_b()) + { + tileentity = (TileEntity)iterator.next(); ++ if( (tileentity.xCoord&15)>=i && (tileentity.xCoord&15)<=l && ++ tileentity.yCoord>=j && tileentity.yCoord<=i1 && ++ (tileentity.zCoord&15)>=k && (tileentity.zCoord&15)<=j1) { ++ ++ invalidList.add(tileentity); ++ } + } ++ for(TileEntity te : invalidList) ++ te.invalidate(); + + return k1; + } +@@ -880,7 +866,6 @@ + int l = field_35845_c[k]; + if(l == -999) + { +- worldObj.getClass(); + int i1 = 128 - 1; + for(l = -1; i1 > 0 && l == -1;) + { diff --git a/patches/minecraft/net/minecraft/src/EffectRenderer.java.patch b/patches/minecraft/net/minecraft/src/EffectRenderer.java.patch new file mode 100644 index 0000000000..d02350e5e8 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/EffectRenderer.java.patch @@ -0,0 +1,148 @@ +--- ../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 +@@ -7,6 +7,9 @@ + import java.util.*; + import org.lwjgl.opengl.GL11; + ++import net.minecraft.src.forge.BlockTextureParticles; ++import net.minecraft.src.forge.ITextureProvider; ++ + // Referenced classes of package net.minecraft.src: + // EntityFX, Entity, MathHelper, RenderEngine, + // Tessellator, Block, EntityDiggingFX, World +@@ -16,6 +19,7 @@ + + public EffectRenderer(World world, RenderEngine renderengine) + { ++ effectList = new ArrayList(); + fxLayers = new List[4]; + rand = new Random(); + if(world != null) +@@ -55,7 +59,18 @@ + } + + } +- ++ for (int x = 0; x < effectList.size(); x++) { ++ BlockTextureParticles entry = (BlockTextureParticles) effectList ++ .get(x); ++ for (int y = 0; y < entry.effects.size(); y++) { ++ EntityFX entityfx = (EntityFX) entry.effects.get(y); ++ if (entityfx.isDead) { ++ entry.effects.remove(y--); ++ } ++ } ++ if (effectList.size() == 0) ++ effectList.remove(x--); ++ } + } + + public void renderParticles(Entity entity, float f) +@@ -94,6 +109,7 @@ + for(int k = 0; k < fxLayers[i].size(); k++) + { + EntityFX entityfx = (EntityFX)fxLayers[i].get(k); ++ if(entityfx instanceof EntityDiggingFX) continue; + tessellator.setBrightness(entityfx.func_35115_a(f)); + entityfx.renderParticle(tessellator, f, f1, f5, f2, f3, f4); + } +@@ -101,6 +117,21 @@ + 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++) { ++ EntityFX entityfx = (EntityFX) entry.effects.get(y); ++ tessellator.setBrightness(entityfx.func_35115_a(f)); ++ entityfx.renderParticle(tessellator, f, f1, f5, f2, f3, f4); ++ } ++ tessellator.draw(); ++ } ++ + } + + public void func_1187_b(Entity entity, float f) +@@ -132,7 +163,12 @@ + { + fxLayers[i].clear(); + } +- ++ for (int x = 0; x < effectList.size(); x++) { ++ BlockTextureParticles entry = (BlockTextureParticles) effectList ++ .get(x); ++ entry.effects.clear(); ++ } ++ effectList.clear(); + } + + public void addBlockDestroyEffects(int i, int j, int k, int l, int i1) +@@ -153,7 +189,12 @@ + 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); + } + + } +@@ -198,16 +239,48 @@ + { + d = (double)i + block.maxX + (double)f; + } +- 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).func_407_b(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.func_407_b(0.2F); ++ 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; ++ ++ if (block instanceof ITextureProvider) { ++ comp = ((ITextureProvider) block).getTextureFile(); ++ } else { ++ comp = "/terrain.png"; ++ } ++ for (int x = 0; x < effectList.size(); x++) { ++ BlockTextureParticles entry = (BlockTextureParticles) effectList ++ .get(x); ++ if (entry.texture.equals(comp)) { ++ entry.effects.add(dig_effect); ++ added = true; ++ } ++ } ++ if (!added) { ++ BlockTextureParticles entry = new BlockTextureParticles(); ++ entry.texture = comp; ++ entry.effects.add(dig_effect); ++ effectList.add(entry); ++ } ++ addEffect(dig_effect); ++ } + + protected World worldObj; + private List fxLayers[]; ++ private List effectList; + private RenderEngine renderer; + private Random rand; + } diff --git a/patches/minecraft/net/minecraft/src/EntityLiving.java.patch b/patches/minecraft/net/minecraft/src/EntityLiving.java.patch new file mode 100644 index 0000000000..6e09fb3851 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/EntityLiving.java.patch @@ -0,0 +1,13 @@ +--- ../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 +@@ -624,7 +624,9 @@ + 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(); + } + + public void writeEntityToNBT(NBTTagCompound nbttagcompound) diff --git a/patches/minecraft/net/minecraft/src/EntityPlayer.java.patch b/patches/minecraft/net/minecraft/src/EntityPlayer.java.patch new file mode 100644 index 0000000000..f10cc7362e --- /dev/null +++ b/patches/minecraft/net/minecraft/src/EntityPlayer.java.patch @@ -0,0 +1,76 @@ +--- ../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 +@@ -4,6 +4,10 @@ + + package net.minecraft.src; + ++import net.minecraft.src.forge.ArmorProperties; ++import net.minecraft.src.forge.ISpecialArmor; ++import net.minecraft.src.forge.ForgeHooks; ++ + import java.util.*; + + // Referenced classes of package net.minecraft.src: +@@ -485,6 +489,8 @@ + worldObj.entityJoinedWorld(entityitem); + } + ++ /* FORGE: This isnt called anymore ++ */ + public float getCurrentPlayerStrVsBlock(Block block) + { + float f = inventory.getStrVsBlock(block); +@@ -507,6 +513,32 @@ + return f; + } + ++ /* 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); ++ if(isInsideOfMaterial(Material.water)) ++ { ++ f /= 5F; ++ } ++ if(!onGround) ++ { ++ f /= 5F; ++ } ++ if(isPotionActive(Potion.potionDigSpeed)) ++ { ++ f *= 1.0F + (float)(getActivePotionEffect(Potion.potionDigSpeed).getAmplifier() + 1) * 0.2F; ++ } ++ if(isPotionActive(Potion.potionDigSlow)) ++ { ++ f *= 1.0F - (float)(getActivePotionEffect(Potion.potionDigSlow).getAmplifier() + 1) * 0.2F; ++ } ++ return f; ++ } ++ + public boolean canHarvestBlock(Block block) + { + return inventory.canHarvestBlock(block); +@@ -720,7 +752,9 @@ + + public void destroyCurrentEquippedItem() + { ++ ItemStack orig=inventory.getCurrentItem(); + inventory.setInventorySlotContents(inventory.currentItem, null); ++ ForgeHooks.onDestroyCurrentItem(this,orig); + } + + public double getYOffset() +@@ -815,6 +849,10 @@ + + public EnumStatus sleepInBedAt(int i, int j, int k) + { ++ EnumStatus customSleep = ForgeHooks.sleepInBedAt(this, i, j, k); ++ if (customSleep != null) { ++ return customSleep; ++ } + if(!worldObj.multiplayerWorld) + { + if(isPlayerSleeping() || !isEntityAlive()) diff --git a/patches/minecraft/net/minecraft/src/EntityRenderer.java.patch b/patches/minecraft/net/minecraft/src/EntityRenderer.java.patch new file mode 100644 index 0000000000..852e814076 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/EntityRenderer.java.patch @@ -0,0 +1,36 @@ +--- ../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,7 @@ + + package net.minecraft.src; + ++import net.minecraft.src.forge.ForgeHooksClient; + import java.awt.image.BufferedImage; + import java.nio.FloatBuffer; + import java.util.Random; +@@ -803,8 +804,12 @@ + { + EntityPlayer entityplayer = (EntityPlayer)entityliving; + GL11.glDisable(3008 /*GL_ALPHA_TEST*/); ++ if(!ForgeHooksClient.onBlockHighlight(renderglobal,entityplayer, ++ mc.objectMouseOver,0, ++ entityplayer.inventory.getCurrentItem(),f)) { + renderglobal.drawBlockBreaking(entityplayer, mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), f); + renderglobal.drawSelectionBox(entityplayer, mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), f); ++ } + GL11.glEnable(3008 /*GL_ALPHA_TEST*/); + } + } +@@ -853,8 +858,12 @@ + { + EntityPlayer entityplayer1 = (EntityPlayer)entityliving; + GL11.glDisable(3008 /*GL_ALPHA_TEST*/); ++ if(!ForgeHooksClient.onBlockHighlight(renderglobal,entityplayer1, ++ mc.objectMouseOver,0, ++ entityplayer1.inventory.getCurrentItem(),f)) { + renderglobal.drawBlockBreaking(entityplayer1, mc.objectMouseOver, 0, entityplayer1.inventory.getCurrentItem(), f); + renderglobal.drawSelectionBox(entityplayer1, mc.objectMouseOver, 0, entityplayer1.inventory.getCurrentItem(), f); ++ } + GL11.glEnable(3008 /*GL_ALPHA_TEST*/); + } + renderRainSnow(f); diff --git a/patches/minecraft/net/minecraft/src/Explosion.java.patch b/patches/minecraft/net/minecraft/src/Explosion.java.patch new file mode 100644 index 0000000000..bb54fe9488 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/Explosion.java.patch @@ -0,0 +1,29 @@ +--- ../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 +@@ -5,6 +5,7 @@ + package net.minecraft.src; + + import java.util.*; ++import net.minecraft.src.forge.ISpecialResistance; + + // Referenced classes of package net.minecraft.src: + // World, MathHelper, Block, ChunkPosition, +@@ -66,7 +67,17 @@ + int i5 = worldObj.getBlockId(j4, k4, l4); + if(i5 > 0) + { +- f1 -= (Block.blocksList[i5].getExplosionResistance(exploder) + 0.3F) * f2; ++ if (Block.blocksList[i5] instanceof ISpecialResistance) { ++ ISpecialResistance isr = (ISpecialResistance) Block.blocksList[i5]; ++ f1 -= (isr.getSpecialExplosionResistance( ++ worldObj, j4, k4, l4, explosionX, ++ explosionY, explosionZ, exploder) + 0.3F) ++ * f2; ++ } else { ++ f1 -= (Block.blocksList[i5] ++ .getExplosionResistance(exploder) + 0.3F) ++ * f2; ++ } + } + if(f1 > 0.0F) + { diff --git a/patches/minecraft/net/minecraft/src/FurnaceRecipes.java.patch b/patches/minecraft/net/minecraft/src/FurnaceRecipes.java.patch new file mode 100644 index 0000000000..b8a98fc45e --- /dev/null +++ b/patches/minecraft/net/minecraft/src/FurnaceRecipes.java.patch @@ -0,0 +1,58 @@ +--- ../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 +@@ -6,6 +6,7 @@ + + import java.util.HashMap; + import java.util.Map; ++import java.util.Arrays; + + // Referenced classes of package net.minecraft.src: + // Block, ItemStack, Item +@@ -21,6 +22,7 @@ + private FurnaceRecipes() + { + 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)); +@@ -40,11 +42,32 @@ + smeltingList.put(Integer.valueOf(i), itemstack); + } + ++ /* FORGE: Add a metadata-sensitive furnace recipe. ++ */ ++ public void addSmelting(int i, int meta, ItemStack itemstack) ++ { ++ metaSmeltingList.put(Arrays.asList(i,meta), itemstack); ++ } ++ ++ /* FORGE: Not used anymore. ++ */ + public ItemStack getSmeltingResult(int i) + { + return (ItemStack)smeltingList.get(Integer.valueOf(i)); + } + ++ /* FORGE: Added to allow metadata-sensitive smelting. ++ */ ++ public ItemStack getSmeltingResult(ItemStack src) { ++ ItemStack tr; ++ ++ if(src==null) return null; ++ tr=(ItemStack)metaSmeltingList.get( ++ Arrays.asList(src.itemID,src.getItemDamage())); ++ if(tr!=null) return tr; ++ return (ItemStack)smeltingList.get(Integer.valueOf(src.itemID)); ++ } ++ + public Map getSmeltingList() + { + return smeltingList; +@@ -52,5 +75,6 @@ + + private static final FurnaceRecipes smeltingBase = new FurnaceRecipes(); + private Map smeltingList; ++ private Map metaSmeltingList; + + } diff --git a/patches/minecraft/net/minecraft/src/Item.java.patch b/patches/minecraft/net/minecraft/src/Item.java.patch new file mode 100644 index 0000000000..664d382446 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/Item.java.patch @@ -0,0 +1,16 @@ +--- ../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 +@@ -76,6 +76,13 @@ + return 1.0F; + } + ++ /* FORGE: Metadata-sensitive version of getStrVsBlock ++ */ ++ public float getStrVsBlock(ItemStack itemstack, Block block, int md) ++ { ++ return getStrVsBlock(itemstack,block); ++ } ++ + public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) + { + return itemstack; diff --git a/patches/minecraft/net/minecraft/src/ItemBlock.java.patch b/patches/minecraft/net/minecraft/src/ItemBlock.java.patch new file mode 100644 index 0000000000..f9cf25b4da --- /dev/null +++ b/patches/minecraft/net/minecraft/src/ItemBlock.java.patch @@ -0,0 +1,11 @@ +--- ../src_base/minecraft/net/minecraft/src/ItemBlock.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft/net/minecraft/src/ItemBlock.java 0000-00-00 00:00:00.000000000 -0000 +@@ -62,7 +62,7 @@ + { + return false; + } +- if(!entityplayer.func_35190_e(i, j, k)) ++ if(entityplayer!=null && !entityplayer.func_35190_e(i, j, k)) + { + return false; + } diff --git a/patches/minecraft/net/minecraft/src/ItemBucket.java.patch b/patches/minecraft/net/minecraft/src/ItemBucket.java.patch new file mode 100644 index 0000000000..251d86ec24 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/ItemBucket.java.patch @@ -0,0 +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 +@@ -6,6 +6,8 @@ + + import java.util.Random; + ++import net.minecraft.src.forge.MinecraftForge; ++ + // Referenced classes of package net.minecraft.src: + // Item, EntityPlayer, Vec3D, MathHelper, + // World, MovingObjectPosition, EnumMovingObjectType, Material, +@@ -60,6 +62,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); diff --git a/patches/minecraft/net/minecraft/src/ItemDye.java.patch b/patches/minecraft/net/minecraft/src/ItemDye.java.patch new file mode 100644 index 0000000000..66e7f77eee --- /dev/null +++ b/patches/minecraft/net/minecraft/src/ItemDye.java.patch @@ -0,0 +1,45 @@ +--- ../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 +@@ -3,6 +3,7 @@ + // Decompiler options: packimports(3) braces deadcode + + package net.minecraft.src; ++import net.minecraft.src.forge.ForgeHooks; + + import java.util.Random; + +@@ -35,13 +36,18 @@ + + public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l) + { +- if(!entityplayer.func_35190_e(i, j, k)) ++ if(entityplayer!=null && !entityplayer.func_35190_e(i, j, k)) + { + return false; + } + if(itemstack.getItemDamage() == 15) + { + int i1 = world.getBlockId(i, j, k); ++ if(ForgeHooks.onUseBonemeal(world,i1,i,j,k)) { ++ if(!world.multiplayerWorld) ++ itemstack.stackSize--; ++ return true; ++ } + if(i1 == Block.sapling.blockID) + { + if(!world.multiplayerWorld) +@@ -108,13 +114,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); + } + + } diff --git a/patches/minecraft/net/minecraft/src/ItemFlintAndSteel.java.patch b/patches/minecraft/net/minecraft/src/ItemFlintAndSteel.java.patch new file mode 100644 index 0000000000..41c66ac63a --- /dev/null +++ b/patches/minecraft/net/minecraft/src/ItemFlintAndSteel.java.patch @@ -0,0 +1,11 @@ +--- ../src_base/minecraft/net/minecraft/src/ItemFlintAndSteel.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft/net/minecraft/src/ItemFlintAndSteel.java 0000-00-00 00:00:00.000000000 -0000 +@@ -46,7 +46,7 @@ + { + i++; + } +- if(!entityplayer.func_35190_e(i, j, k)) ++ if(entityplayer!=null && !entityplayer.func_35190_e(i, j, k)) + { + return false; + } diff --git a/patches/minecraft/net/minecraft/src/ItemHoe.java.patch b/patches/minecraft/net/minecraft/src/ItemHoe.java.patch new file mode 100644 index 0000000000..a82f7de402 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/ItemHoe.java.patch @@ -0,0 +1,11 @@ +--- ../src_base/minecraft/net/minecraft/src/ItemHoe.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft/net/minecraft/src/ItemHoe.java 0000-00-00 00:00:00.000000000 -0000 +@@ -21,7 +21,7 @@ + + public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l) + { +- if(!entityplayer.func_35190_e(i, j, k)) ++ if(entityplayer!=null && !entityplayer.func_35190_e(i, j, k)) + { + return false; + } diff --git a/patches/minecraft/net/minecraft/src/ItemRedstone.java.patch b/patches/minecraft/net/minecraft/src/ItemRedstone.java.patch new file mode 100644 index 0000000000..d22e6a1b48 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/ItemRedstone.java.patch @@ -0,0 +1,11 @@ +--- ../src_base/minecraft/net/minecraft/src/ItemRedstone.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft/net/minecraft/src/ItemRedstone.java 0000-00-00 00:00:00.000000000 -0000 +@@ -50,7 +50,7 @@ + return false; + } + } +- if(!entityplayer.func_35190_e(i, j, k)) ++ if(entityplayer!=null && !entityplayer.func_35190_e(i, j, k)) + { + return false; + } diff --git a/patches/minecraft/net/minecraft/src/ItemReed.java.patch b/patches/minecraft/net/minecraft/src/ItemReed.java.patch new file mode 100644 index 0000000000..15778ccf7d --- /dev/null +++ b/patches/minecraft/net/minecraft/src/ItemReed.java.patch @@ -0,0 +1,11 @@ +--- ../src_base/minecraft/net/minecraft/src/ItemReed.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft/net/minecraft/src/ItemReed.java 0000-00-00 00:00:00.000000000 -0000 +@@ -52,7 +52,7 @@ + i++; + } + } +- if(!entityplayer.func_35190_e(i, j, k)) ++ if(entityplayer!=null && !entityplayer.func_35190_e(i, j, k)) + { + return false; + } diff --git a/patches/minecraft/net/minecraft/src/ItemRenderer.java.patch b/patches/minecraft/net/minecraft/src/ItemRenderer.java.patch new file mode 100644 index 0000000000..3bcb926ab0 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/ItemRenderer.java.patch @@ -0,0 +1,42 @@ +--- ../src_base/minecraft/net/minecraft/src/ItemRenderer.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft/net/minecraft/src/ItemRenderer.java 0000-00-00 00:00:00.000000000 -0000 +@@ -5,6 +5,10 @@ + package net.minecraft.src; + + import net.minecraft.client.Minecraft; ++import net.minecraft.src.forge.ForgeHooksClient; ++import net.minecraft.src.forge.ICustomItemRenderer; ++import net.minecraft.src.forge.MinecraftForgeClient; ++ + import org.lwjgl.opengl.GL11; + import org.lwjgl.opengl.GL13; + +@@ -32,18 +36,27 @@ + public void renderItem(EntityLiving entityliving, ItemStack itemstack) + { + GL11.glPushMatrix(); +- if(itemstack.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType())) ++ ICustomItemRenderer customRenderer = MinecraftForgeClient.getCustomItemRenderer(itemstack.itemID); ++ ++ if (customRenderer != null) { ++ GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/terrain.png")); ++ ForgeHooksClient.overrideTexture (itemstack.getItem()); ++ 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(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/terrain.png")); ++ ForgeHooksClient.overrideTexture (Block.blocksList[itemstack.itemID]); + renderBlocksInstance.renderBlockOnInventory(Block.blocksList[itemstack.itemID], itemstack.getItemDamage(), 1.0F); + } else + { + if(itemstack.itemID < 256) + { + GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/terrain.png")); ++ ForgeHooksClient.overrideTexture (Block.blocksList[itemstack.itemID]); + } else + { + GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/gui/items.png")); ++ ForgeHooksClient.overrideTexture (Item.itemsList[itemstack.itemID]); + } + Tessellator tessellator = Tessellator.instance; + int i = entityliving.getItemIcon(itemstack); diff --git a/patches/minecraft/net/minecraft/src/ItemSeeds.java.patch b/patches/minecraft/net/minecraft/src/ItemSeeds.java.patch new file mode 100644 index 0000000000..9e754e8583 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/ItemSeeds.java.patch @@ -0,0 +1,11 @@ +--- ../src_base/minecraft/net/minecraft/src/ItemSeeds.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft/net/minecraft/src/ItemSeeds.java 0000-00-00 00:00:00.000000000 -0000 +@@ -24,7 +24,7 @@ + { + return false; + } +- if(!entityplayer.func_35190_e(i, j, k) || !entityplayer.func_35190_e(i, j + 1, k)) ++ if(entityplayer!=null && (!entityplayer.func_35190_e(i, j, k) || !entityplayer.func_35190_e(i, j + 1, k))) + { + return false; + } diff --git a/patches/minecraft/net/minecraft/src/ItemTool.java.patch b/patches/minecraft/net/minecraft/src/ItemTool.java.patch new file mode 100644 index 0000000000..ba4765bcb3 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/ItemTool.java.patch @@ -0,0 +1,36 @@ +--- ../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 +@@ -4,6 +4,8 @@ + + package net.minecraft.src; + ++import java.util.Arrays; ++import net.minecraft.src.forge.ForgeHooks; + + // Referenced classes of package net.minecraft.src: + // Item, EnumToolMaterial, ItemStack, Block, +@@ -37,6 +39,14 @@ + return 1.0F; + } + ++ /* FORGE: Overridden to allow custom tool effectiveness ++ */ ++ 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) + { + itemstack.damageItem(2, entityliving1); +@@ -60,7 +70,7 @@ + } + + private Block blocksEffectiveAgainst[]; +- private float efficiencyOnProperMaterial; +- private int damageVsEntity; ++ public float efficiencyOnProperMaterial; ++ public int damageVsEntity; + protected EnumToolMaterial toolMaterial; + } diff --git a/patches/minecraft/net/minecraft/src/MovingObjectPosition.java.patch b/patches/minecraft/net/minecraft/src/MovingObjectPosition.java.patch new file mode 100644 index 0000000000..49a2ac24df --- /dev/null +++ b/patches/minecraft/net/minecraft/src/MovingObjectPosition.java.patch @@ -0,0 +1,10 @@ +--- ../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 +@@ -35,4 +35,7 @@ + public int sideHit; + public Vec3D hitVec; + public Entity entityHit; ++ ++ // Added for RedPower subblocks. ++ public int subHit=-1; + } diff --git a/patches/minecraft/net/minecraft/src/PlayerController.java.patch b/patches/minecraft/net/minecraft/src/PlayerController.java.patch new file mode 100644 index 0000000000..7509b615f1 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/PlayerController.java.patch @@ -0,0 +1,18 @@ +--- ../src_base/minecraft/net/minecraft/src/PlayerController.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft/net/minecraft/src/PlayerController.java 0000-00-00 00:00:00.000000000 -0000 +@@ -3,6 +3,7 @@ + // Decompiler options: packimports(3) braces deadcode + + package net.minecraft.src; ++import net.minecraft.src.forge.*; + + import net.minecraft.client.Minecraft; + +@@ -64,6 +65,7 @@ + if(itemstack1.stackSize == 0) + { + entityplayer.inventory.mainInventory[entityplayer.inventory.currentItem] = null; ++ ForgeHooks.onDestroyCurrentItem(entityplayer,itemstack1); + } + return true; + } else diff --git a/patches/minecraft/net/minecraft/src/PlayerControllerMP.java.patch b/patches/minecraft/net/minecraft/src/PlayerControllerMP.java.patch new file mode 100644 index 0000000000..c78999f827 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/PlayerControllerMP.java.patch @@ -0,0 +1,57 @@ +--- ../src_base/minecraft/net/minecraft/src/PlayerControllerMP.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft/net/minecraft/src/PlayerControllerMP.java 0000-00-00 00:00:00.000000000 -0000 +@@ -4,6 +4,9 @@ + + package net.minecraft.src; + ++import net.minecraft.src.forge.IUseItemFirst; ++import net.minecraft.src.forge.ForgeHooks; ++ + import net.minecraft.client.Minecraft; + + // Referenced classes of package net.minecraft.src: +@@ -91,7 +94,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) + { + sendBlockRemoved(i, j, k, l); + } else +@@ -137,7 +140,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.stepSoundDir2(), (float)i + 0.5F, (float)j + 0.5F, (float)k + 0.5F, (block.stepSound.getVolume() + 1.0F) / 8F, block.stepSound.getPitch() * 0.5F); +@@ -204,6 +207,13 @@ + { + syncCurrentPlayItem(); + netClientHandler.addToSendQueue(new Packet15Place(i, j, k, l, entityplayer.inventory.getCurrentItem())); ++ ++ if (itemstack != null && itemstack.getItem() instanceof IUseItemFirst) { ++ IUseItemFirst iuif = (IUseItemFirst) itemstack.getItem(); ++ if (iuif.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)) + { +@@ -223,7 +233,11 @@ + return flag; + } 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); ++ return true; + } + } + diff --git a/patches/minecraft/net/minecraft/src/PlayerControllerSP.java.patch b/patches/minecraft/net/minecraft/src/PlayerControllerSP.java.patch new file mode 100644 index 0000000000..2bbbf8121e --- /dev/null +++ b/patches/minecraft/net/minecraft/src/PlayerControllerSP.java.patch @@ -0,0 +1,64 @@ +--- ../src_base/minecraft/net/minecraft/src/PlayerControllerSP.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft/net/minecraft/src/PlayerControllerSP.java 0000-00-00 00:00:00.000000000 -0000 +@@ -3,6 +3,8 @@ + // Decompiler options: packimports(3) braces deadcode + + package net.minecraft.src; ++import net.minecraft.src.forge.IUseItemFirst; ++import net.minecraft.src.forge.ForgeHooks; + + import net.minecraft.client.Minecraft; + +@@ -42,7 +44,7 @@ + int j1 = mc.theWorld.getBlockMetadata(i, j, k); + boolean flag = super.sendBlockRemoved(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); +@@ -71,7 +73,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) + { + sendBlockRemoved(i, j, k, l); + } +@@ -102,7 +104,7 @@ + return; + } + Block block = Block.blocksList[i1]; +- curBlockDamage += block.blockStrength(mc.thePlayer); ++ curBlockDamage += block.blockStrength(mc.theWorld,mc.thePlayer,i,j,k); + if(field_1069_h % 4F == 0.0F && block != null) + { + mc.sndManager.playSound(block.stepSound.stepSoundDir2(), (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 +167,12 @@ + + public boolean sendPlaceBlock(EntityPlayer entityplayer, World world, ItemStack itemstack, int i, int j, int k, int l) + { ++ if (itemstack != null && itemstack.getItem() instanceof IUseItemFirst) { ++ IUseItemFirst iuif = (IUseItemFirst) itemstack.getItem(); ++ if (iuif.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)) + { +@@ -175,7 +183,11 @@ + return false; + } 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); ++ return true; + } + } + diff --git a/patches/minecraft/net/minecraft/src/RenderBlocks.java.patch b/patches/minecraft/net/minecraft/src/RenderBlocks.java.patch new file mode 100644 index 0000000000..f7f78623c3 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/RenderBlocks.java.patch @@ -0,0 +1,74 @@ +--- ../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 +@@ -2980,7 +2980,7 @@ + colorBlueTopRight *= f27; + int j2 = block.getBlockTexture(blockAccess, i, j, k, 2); + renderEastFace(block, i, j, k, j2); +- if(cfgGrassFix && j2 == 3 && overrideBlockTexture < 0) ++ if(Tessellator.instance.defaultTexture && cfgGrassFix && j2 == 3 && overrideBlockTexture < 0) + { + colorRedTopLeft *= f; + colorRedBottomLeft *= f; +@@ -3085,7 +3085,7 @@ + colorBlueTopRight *= f28; + int k2 = block.getBlockTexture(blockAccess, i, j, k, 3); + renderWestFace(block, i, j, k, block.getBlockTexture(blockAccess, i, j, k, 3)); +- if(cfgGrassFix && k2 == 3 && overrideBlockTexture < 0) ++ if(Tessellator.instance.defaultTexture && cfgGrassFix && k2 == 3 && overrideBlockTexture < 0) + { + colorRedTopLeft *= f; + colorRedBottomLeft *= f; +@@ -3190,7 +3190,7 @@ + colorBlueTopRight *= f29; + int l2 = block.getBlockTexture(blockAccess, i, j, k, 4); + renderNorthFace(block, i, j, k, l2); +- if(cfgGrassFix && l2 == 3 && overrideBlockTexture < 0) ++ if(Tessellator.instance.defaultTexture && cfgGrassFix && l2 == 3 && overrideBlockTexture < 0) + { + colorRedTopLeft *= f; + colorRedBottomLeft *= f; +@@ -3295,7 +3295,7 @@ + colorBlueTopRight *= f30; + int i3 = block.getBlockTexture(blockAccess, i, j, k, 5); + renderSouthFace(block, i, j, k, i3); +- if(cfgGrassFix && i3 == 3 && overrideBlockTexture < 0) ++ if(Tessellator.instance.defaultTexture && cfgGrassFix && i3 == 3 && overrideBlockTexture < 0) + { + colorRedTopLeft *= f; + colorRedBottomLeft *= f; +@@ -3388,7 +3388,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) + { + tessellator.setColorOpaque_F(f11 * f, f14 * f1, f17 * f2); + renderEastFace(block, i, j, k, 38); +@@ -3401,7 +3401,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) + { + tessellator.setColorOpaque_F(f11 * f, f14 * f1, f17 * f2); + renderWestFace(block, i, j, k, 38); +@@ -3414,7 +3414,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) + { + tessellator.setColorOpaque_F(f12 * f, f15 * f1, f18 * f2); + renderNorthFace(block, i, j, k, 38); +@@ -3427,7 +3427,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) + { + tessellator.setColorOpaque_F(f12 * f, f15 * f1, f18 * f2); + renderSouthFace(block, i, j, k, 38); diff --git a/patches/minecraft/net/minecraft/src/RenderEngine.java.patch b/patches/minecraft/net/minecraft/src/RenderEngine.java.patch new file mode 100644 index 0000000000..eb2044e7c0 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/RenderEngine.java.patch @@ -0,0 +1,21 @@ +--- ../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 +@@ -128,6 +128,9 @@ + } + try + { ++ 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); +@@ -667,7 +670,7 @@ + private GameSettings options; + public boolean clampTexture; + public boolean blurTexture; +- private TexturePackList texturePack; ++ public TexturePackList texturePack; + private BufferedImage missingTextureImage; + + } diff --git a/patches/minecraft/net/minecraft/src/RenderGlobal.java.patch b/patches/minecraft/net/minecraft/src/RenderGlobal.java.patch new file mode 100644 index 0000000000..dfade4d45a --- /dev/null +++ b/patches/minecraft/net/minecraft/src/RenderGlobal.java.patch @@ -0,0 +1,24 @@ +--- ../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 +@@ -1635,8 +1635,8 @@ + } + + public List tileEntities; +- private World worldObj; +- private RenderEngine renderEngine; ++ public World worldObj; ++ public RenderEngine renderEngine; + private List worldRenderersToUpdate; + private WorldRenderer sortedWorldRenderers[]; + private WorldRenderer worldRenderers[]; +@@ -1644,8 +1644,8 @@ + private int renderChunksTall; + private int renderChunksDeep; + private int glRenderListBase; +- private Minecraft mc; +- private RenderBlocks globalRenderBlocks; ++ public Minecraft mc; ++ public RenderBlocks globalRenderBlocks; + private IntBuffer glOcclusionQueryBase; + private boolean occlusionEnabled; + private int cloudOffsetX; diff --git a/patches/minecraft/net/minecraft/src/RenderItem.java.patch b/patches/minecraft/net/minecraft/src/RenderItem.java.patch new file mode 100644 index 0000000000..f0d2249f2b --- /dev/null +++ b/patches/minecraft/net/minecraft/src/RenderItem.java.patch @@ -0,0 +1,114 @@ +--- ../src_base/minecraft/net/minecraft/src/RenderItem.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft/net/minecraft/src/RenderItem.java 0000-00-00 00:00:00.000000000 -0000 +@@ -4,6 +4,10 @@ + + package net.minecraft.src; + ++import net.minecraft.src.forge.ForgeHooksClient; ++import net.minecraft.src.forge.ICustomItemRenderer; ++import net.minecraft.src.forge.MinecraftForgeClient; ++ + import java.util.Random; + import org.lwjgl.opengl.GL11; + +@@ -47,10 +51,36 @@ + } + 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); ++ ++ if (customRenderer != null) { ++ GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F); ++ loadTexture("/terrain.png"); ++ ForgeHooksClient.overrideTexture(itemstack.getItem()); ++ float f4 = 0.25F; ++ f4 = 0.5F; ++ GL11.glScalef(f4, f4, f4); ++ for(int j = 0; j < byte0; j++) ++ { ++ GL11.glPushMatrix(); ++ 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); ++ } ++ ForgeHooksClient.renderCustomItem(customRenderer, renderBlocks, ++ itemstack.itemID, itemstack.getItemDamage(), ++ entityitem.getEntityBrightness(f1)); ++ GL11.glPopMatrix(); ++ } ++ } else if(itemstack.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType())) + { + GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F); + loadTexture("/terrain.png"); ++ ForgeHooksClient.overrideTexture(Block.blocksList[itemstack.itemID]); + float f4 = 0.25F; + int j = Block.blocksList[itemstack.itemID].getRenderType(); + if(j == 1 || j == 19 || j == 12 || j == 2) +@@ -80,9 +110,11 @@ + if(itemstack.itemID < 256) + { + loadTexture("/terrain.png"); ++ ForgeHooksClient.overrideTexture(Block.blocksList[itemstack.itemID]); + } else + { + loadTexture("/gui/items.png"); ++ ForgeHooksClient.overrideTexture(Item.itemsList[itemstack.itemID]); + } + Tessellator tessellator = Tessellator.instance; + float f5 = (float)((i % 16) * 16 + 0) / 256F; +@@ -129,10 +161,37 @@ + + 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; ++ renderengine.bindTexture(renderengine.getTexture("/terrain.png")); ++ Item item = Item.itemsList[i]; ++ ForgeHooksClient.overrideTexture (Item.itemsList [i]); ++ GL11.glPushMatrix(); ++ GL11.glTranslatef(l - 2, i1 + 3, -3F); ++ 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); ++ 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())) + { + int j1 = i; + renderengine.bindTexture(renderengine.getTexture("/terrain.png")); ++ ForgeHooksClient.overrideTexture (Block.blocksList[i]); + Block block = Block.blocksList[j1]; + GL11.glPushMatrix(); + GL11.glTranslatef(l - 2, i1 + 3, -3F); +@@ -161,9 +220,11 @@ + if(i < 256) + { + renderengine.bindTexture(renderengine.getTexture("/terrain.png")); ++ ForgeHooksClient.overrideTexture (Block.blocksList[i]); + } else + { + renderengine.bindTexture(renderengine.getTexture("/gui/items.png")); ++ ForgeHooksClient.overrideTexture(Item.itemsList[i]); + } + int k1 = Item.itemsList[i].getColorFromDamage(j); + float f = (float)(k1 >> 16 & 0xff) / 255F; diff --git a/patches/minecraft/net/minecraft/src/RenderPlayer.java.patch b/patches/minecraft/net/minecraft/src/RenderPlayer.java.patch new file mode 100644 index 0000000000..50669f71cc --- /dev/null +++ b/patches/minecraft/net/minecraft/src/RenderPlayer.java.patch @@ -0,0 +1,26 @@ +--- ../src_base/minecraft/net/minecraft/src/RenderPlayer.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft/net/minecraft/src/RenderPlayer.java 0000-00-00 00:00:00.000000000 -0000 +@@ -4,6 +4,7 @@ + + package net.minecraft.src; + ++import net.minecraft.src.forge.IArmorTextureProvider; + import net.minecraft.client.Minecraft; + import org.lwjgl.opengl.GL11; + +@@ -34,7 +35,14 @@ + if(item 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 ) ++ { ++ loadTexture( ((IArmorTextureProvider)item).getArmorTextureFile(itemstack) ); ++ } ++ 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; diff --git a/patches/minecraft/net/minecraft/src/SlotCrafting.java.patch b/patches/minecraft/net/minecraft/src/SlotCrafting.java.patch new file mode 100644 index 0000000000..fabc12a24f --- /dev/null +++ b/patches/minecraft/net/minecraft/src/SlotCrafting.java.patch @@ -0,0 +1,18 @@ +--- ../src_base/minecraft/net/minecraft/src/SlotCrafting.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft/net/minecraft/src/SlotCrafting.java 0000-00-00 00:00:00.000000000 -0000 +@@ -3,6 +3,7 @@ + // Decompiler options: packimports(3) braces deadcode + + package net.minecraft.src; ++import net.minecraft.src.forge.ForgeHooks; + + + // Referenced classes of package net.minecraft.src: +@@ -60,6 +61,7 @@ + thePlayer.addStat(AchievementList.buildSword, 1); + } + ModLoader.TakenFromCrafting(thePlayer, itemstack, craftMatrix); ++ ForgeHooks.onTakenFromCrafting(thePlayer, itemstack, craftMatrix); + for(int i = 0; i < craftMatrix.getSizeInventory(); i++) + { + ItemStack itemstack1 = craftMatrix.getStackInSlot(i); diff --git a/patches/minecraft/net/minecraft/src/Tessellator.java.patch b/patches/minecraft/net/minecraft/src/Tessellator.java.patch new file mode 100644 index 0000000000..6d52526c8e --- /dev/null +++ b/patches/minecraft/net/minecraft/src/Tessellator.java.patch @@ -0,0 +1,188 @@ +--- ../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 +@@ -5,6 +5,7 @@ + package net.minecraft.src; + + import java.nio.*; ++import java.util.*; + import org.lwjgl.opengl.*; + + // Referenced classes of package net.minecraft.src: +@@ -13,8 +14,7 @@ + public class Tessellator + { + +- private Tessellator(int i) +- { ++ public Tessellator() { + vertexCount = 0; + hasColor = false; + hasTexture = false; +@@ -24,21 +24,10 @@ + 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 void draw() +@@ -48,12 +37,20 @@ + throw new IllegalStateException("Not tesselating!"); + } + isDrawing = false; +- if(vertexCount > 0) +- { ++ int offs=0; ++ while(offs < vertexCount) { ++ 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; + if(useVBO) + { + vboIndex = (vboIndex + 1) % vboCount; +@@ -121,10 +118,10 @@ + 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) +@@ -146,6 +143,10 @@ + GL11.glDisableClientState(32885 /*GL_NORMAL_ARRAY_EXT*/); + } + } ++ if(rawBufferSize>0x20000 && rawBufferIndex<(rawBufferSize<<3)) { ++ rawBufferSize=0; ++ rawBuffer=null; ++ } + reset(); + } + +@@ -265,6 +266,15 @@ + + public void addVertex(double d, double d1, double d2) + { ++ 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) + { +@@ -314,11 +324,6 @@ + rawBuffer[rawBufferIndex + 2] = Float.floatToRawIntBits((float)(d2 + zOffset)); + rawBufferIndex += 8; + vertexCount++; +- if(vertexCount % 4 == 0 && rawBufferIndex >= bufferSize - 32) +- { +- draw(); +- isDrawing = true; +- } + } + + public void setColorOpaque_I(int i) +@@ -367,10 +372,7 @@ + + private static boolean convertQuadsToTriangles = false; + private static boolean tryVBO = false; +- private ByteBuffer byteBuffer; +- private IntBuffer intBuffer; +- private FloatBuffer floatBuffer; +- private ShortBuffer shortBuffer; ++ private static boolean useVBO = false; + private int rawBuffer[]; + private int vertexCount; + private double textureU; +@@ -384,17 +386,43 @@ + private int rawBufferIndex; + private int addedVertices; + private boolean isColorDisabled; +- private int drawMode; +- private double xOffset; +- private double yOffset; +- private double zOffset; ++ public int drawMode; ++ public double xOffset; ++ public double yOffset; ++ public double zOffset; + private int normal; +- public static final Tessellator instance = new Tessellator(0x200000); +- private boolean isDrawing; +- private boolean useVBO; +- 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(); ++ useVBO = tryVBO && GLContext.getCapabilities().GL_ARB_vertex_buffer_object; ++ vboCount = 10; ++ if(useVBO) ++ { ++ vertexBuffers = GLAllocation.createDirectIntBuffer(vboCount); ++ ARBVertexBufferObject.glGenBuffersARB(vertexBuffers); ++ } ++ } + } diff --git a/patches/minecraft/net/minecraft/src/TileEntity.java.patch b/patches/minecraft/net/minecraft/src/TileEntity.java.patch new file mode 100644 index 0000000000..b63e70a654 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/TileEntity.java.patch @@ -0,0 +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 +@@ -61,6 +61,13 @@ + { + } + ++ /* FORGE: Return false if this TileEntity does not require updateEntity() ++ * calls. ++ */ ++ public boolean canUpdate() { ++ return true; ++ } ++ + public static TileEntity createAndLoadEntity(NBTTagCompound nbttagcompound) + { + TileEntity tileentity = null; diff --git a/patches/minecraft/net/minecraft/src/TileEntityFurnace.java.patch b/patches/minecraft/net/minecraft/src/TileEntityFurnace.java.patch new file mode 100644 index 0000000000..89dfe957d7 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/TileEntityFurnace.java.patch @@ -0,0 +1,87 @@ +--- ../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 +@@ -4,6 +4,7 @@ + + package net.minecraft.src; + ++import net.minecraft.src.forge.ISidedInventory; + + // Referenced classes of package net.minecraft.src: + // TileEntity, IInventory, ItemStack, NBTTagCompound, +@@ -12,7 +13,7 @@ + // EntityPlayer + + public class TileEntityFurnace extends TileEntity +- implements IInventory ++ implements IInventory, ISidedInventory + { + + public TileEntityFurnace() +@@ -28,6 +29,16 @@ + return furnaceItemStacks.length; + } + ++ public int getStartInventorySide(int side) { ++ if(side==0) return 1; ++ if(side==1) return 0; ++ return 2; ++ } ++ ++ public int getSizeInventorySide(int side) { ++ return 1; ++ } ++ + public ItemStack getStackInSlot(int i) + { + return furnaceItemStacks[i]; +@@ -196,7 +207,7 @@ + { + return false; + } +- ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0].getItem().shiftedIndex); ++ ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0]); + if(itemstack == null) + { + return false; +@@ -209,11 +220,9 @@ + { + return false; + } +- if(furnaceItemStacks[2].stackSize < getInventoryStackLimit() && furnaceItemStacks[2].stackSize < furnaceItemStacks[2].getMaxStackSize()) +- { +- return true; +- } +- return furnaceItemStacks[2].stackSize < itemstack.getMaxStackSize(); ++ int st=furnaceItemStacks[2].stackSize+itemstack.stackSize; ++ return (st<=getInventoryStackLimit() && ++ st<=itemstack.getMaxStackSize()); + } + + public void smeltItem() +@@ -222,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) ++ if(furnaceItemStacks[2].isItemEqual(itemstack)) + { +- furnaceItemStacks[2].stackSize++; ++ furnaceItemStacks[2].stackSize+=itemstack.stackSize; + } + if(furnaceItemStacks[0].getItem().hasContainerItem()) + { +@@ -244,7 +253,7 @@ + } + } + +- private int getItemBurnTime(ItemStack itemstack) ++ public static int getItemBurnTime(ItemStack itemstack) + { + if(itemstack == null) + { diff --git a/patches/minecraft/net/minecraft/src/TileEntityRendererPiston.java.patch b/patches/minecraft/net/minecraft/src/TileEntityRendererPiston.java.patch new file mode 100644 index 0000000000..e3f6b6cc92 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/TileEntityRendererPiston.java.patch @@ -0,0 +1,26 @@ +--- ../src_base/minecraft/net/minecraft/src/TileEntityRendererPiston.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft/net/minecraft/src/TileEntityRendererPiston.java 0000-00-00 00:00:00.000000000 -0000 +@@ -4,6 +4,7 @@ + + package net.minecraft.src; + ++import net.minecraft.src.forge.ForgeHooksClient; + import net.minecraft.client.Minecraft; + import org.lwjgl.opengl.GL11; + +@@ -38,6 +39,7 @@ + { + GL11.glShadeModel(7424 /*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); +@@ -58,6 +60,7 @@ + } + tessellator.setTranslationD(0.0D, 0.0D, 0.0D); + tessellator.draw(); ++ ForgeHooksClient.afterBlockRender(block,field_31071_b); + RenderHelper.enableStandardItemLighting(); + } + } diff --git a/patches/minecraft/net/minecraft/src/World.java.patch b/patches/minecraft/net/minecraft/src/World.java.patch new file mode 100644 index 0000000000..204a25f5c2 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/World.java.patch @@ -0,0 +1,192 @@ +--- ../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 +@@ -336,7 +336,10 @@ + + public boolean isAirBlock(int i, int j, int k) + { +- 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); + } + + public boolean blockExists(int i, int j, int k) +@@ -1476,7 +1479,7 @@ + Chunk chunk = getChunkFromChunkCoords(tileentity.xCoord >> 4, tileentity.zCoord >> 4); + if(chunk != null) + { +- chunk.removeChunkBlockTileEntity(tileentity.xCoord & 0xf, tileentity.yCoord, tileentity.zCoord & 0xf); ++ chunk.cleanChunkBlockTileEntity(tileentity.xCoord & 0xf, tileentity.yCoord, tileentity.zCoord & 0xf); + } + } + } +@@ -1503,16 +1506,16 @@ + { + loadedTileEntityList.add(tileentity1); + } ++ } else { + if(chunkExists(tileentity1.xCoord >> 4, tileentity1.zCoord >> 4)) + { + Chunk chunk1 = getChunkFromChunkCoords(tileentity1.xCoord >> 4, tileentity1.zCoord >> 4); + if(chunk1 != null) + { +- chunk1.setChunkBlockTileEntity(tileentity1.xCoord & 0xf, tileentity1.yCoord, tileentity1.zCoord & 0xf, tileentity1); ++ chunk1.cleanChunkBlockTileEntity(tileentity1.xCoord & 0xf, tileentity1.yCoord, tileentity1.zCoord & 0xf); + } + } +- markBlockNeedsUpdate(tileentity1.xCoord, tileentity1.yCoord, tileentity1.zCoord); +- } ++ } + } while(true); + addedTileEntityList.clear(); + } +@@ -1520,13 +1523,19 @@ + + public void addTileEntity(Collection collection) + { +- if(scanningTileEntities) +- { +- addedTileEntityList.addAll(collection); +- } else +- { +- loadedTileEntityList.addAll(collection); +- } ++ List dest=scanningTileEntities ? addedTileEntityList : ++ loadedTileEntityList; ++ for(Object ob : collection) { ++ TileEntity te=(TileEntity)ob; ++ if(te.canUpdate()) dest.add(te); ++ } ++ } ++ ++ /* FORGE: Used as a bugfix */ ++ public void addTileEntity(TileEntity te) { ++ List dest=scanningTileEntities ? addedTileEntityList : ++ loadedTileEntityList; ++ if(te.canUpdate()) dest.add(te); + } + + public void updateEntity(Entity entity) +@@ -1684,7 +1693,10 @@ + if(j2 == Block.fire.blockID || j2 == Block.lavaMoving.blockID || j2 == Block.lavaStill.blockID) + { + return true; +- } ++ } else { ++ if(j2>0 && Block.blocksList[j2].isBlockBurning(this,k1,l1,i2)) ++ return true; ++ } + } + + } +@@ -1917,44 +1929,23 @@ + + public void setBlockTileEntity(int i, int j, int k, TileEntity tileentity) + { +- if(tileentity != null && !tileentity.isInvalid()) +- { +- if(scanningTileEntities) +- { +- tileentity.xCoord = i; +- tileentity.yCoord = j; +- tileentity.zCoord = k; +- addedTileEntityList.add(tileentity); +- } else +- { +- loadedTileEntityList.add(tileentity); +- Chunk chunk = getChunkFromChunkCoords(i >> 4, k >> 4); +- if(chunk != null) +- { +- chunk.setChunkBlockTileEntity(i & 0xf, j, k & 0xf, tileentity); +- } +- } +- } ++ 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); ++ } + } + + public void removeBlockTileEntity(int i, int j, int k) + { +- TileEntity tileentity = getBlockTileEntity(i, j, k); +- if(tileentity != null && scanningTileEntities) +- { +- tileentity.invalidate(); +- } else +- { +- if(tileentity != null) +- { +- 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 func_35455_a(TileEntity tileentity) +@@ -1977,13 +1968,18 @@ + public boolean isBlockNormalCube(int i, int j, int k) + { + Block block = Block.blocksList[getBlockId(i, j, k)]; +- if(block == null) +- { +- return false; +- } else +- { +- return block.blockMaterial.getIsOpaque() && block.renderAsNormalBlock(); +- } ++ if(block == null) return false; ++ return block.isBlockNormalCube(this,i,j,k); ++ } ++ ++ /* FORGE: Determine if the given block is considered solid on the ++ * specified side. Used by placement logic. ++ */ ++ public boolean isBlockSolidOnSide(int i, int j, int k, int side) ++ { ++ Block block = Block.blocksList[getBlockId(i, j, k)]; ++ if(block == null) return false; ++ return block.isBlockSolidOnSide(this,i,j,k,side); + } + + public void saveWorldIndirectly(IProgressUpdate iprogressupdate) +@@ -2308,7 +2304,7 @@ + + private int computeBlockLightValue(int i, int j, int k, int l, int i1, int j1) + { +- 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; +@@ -2679,6 +2675,7 @@ + { + block = null; + } ++ if(block!=null && block.isBlockReplaceable(this,j,k,l)) block=null; + return i > 0 && block == null && block1.canPlaceBlockOnSide(this, j, k, l, i1); + } + +@@ -3193,7 +3190,7 @@ + public int lightningFlash; + public boolean editingBlocks; + private long lockTimestamp; +- protected int autosavePeriod; ++ public int autosavePeriod; + public int difficultySetting; + public Random rand; + public boolean isNewWorld; diff --git a/patches/minecraft/net/minecraft/src/WorldRenderer.java.patch b/patches/minecraft/net/minecraft/src/WorldRenderer.java.patch new file mode 100644 index 0000000000..cbf615ac7a --- /dev/null +++ b/patches/minecraft/net/minecraft/src/WorldRenderer.java.patch @@ -0,0 +1,77 @@ +--- ../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 +@@ -4,6 +4,8 @@ + + package net.minecraft.src; + ++import net.minecraft.src.forge.ForgeHooksClient; ++ + import java.util.*; + import org.lwjgl.opengl.GL11; + +@@ -125,8 +127,9 @@ + 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]) + { +@@ -142,15 +145,13 @@ + { + flag1 = true; + } +- if(j3 != i2) +- { +- flag = true; +- continue; +- } +- if(j3 == i2) +- { +- flag1 |= renderblocks.renderBlockByRenderType(block, l2, j2, k2); +- } ++ if(j3>i2) flag=true; ++ if(!ForgeHooksClient.canRenderInPass(block,i2)) ++ continue; ++ ++ ForgeHooksClient.beforeBlockRender(block, renderblocks); ++ flag1 |= renderblocks.renderBlockByRenderType(block, l2, j2, k2); ++ ForgeHooksClient.afterBlockRender(block, renderblocks); + } + + } +@@ -159,10 +160,11 @@ + + if(flag2) + { +- tessellator.draw(); ++ ForgeHooksClient.afterRenderPass(i2); ++ 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 + { + flag1 = false; +@@ -255,7 +257,6 @@ + + public World worldObj; + private int glRenderList; +- private static Tessellator tessellator; + public static int chunksUpdated = 0; + public int posX; + public int posY; +@@ -286,8 +287,4 @@ + public List tileEntityRenderers; + private List tileEntities; + +- static +- { +- tessellator = Tessellator.instance; +- } + } diff --git a/patches/minecraft_server/net/minecraft/src/Block.java.patch b/patches/minecraft_server/net/minecraft/src/Block.java.patch new file mode 100644 index 0000000000..eb70c99a17 --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/Block.java.patch @@ -0,0 +1,173 @@ +--- ../src_base/minecraft_server/net/minecraft/src/Block.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/Block.java 0000-00-00 00:00:00.000000000 -0000 +@@ -3,6 +3,7 @@ + // Decompiler options: packimports(3) braces deadcode + + package net.minecraft.src; ++import net.minecraft.src.forge.ForgeHooks; + + import java.util.ArrayList; + import java.util.Random; +@@ -218,24 +219,40 @@ + return 1; + } + ++ /* FORGE: Metadata-sensitive version. ++ */ ++ public int quantityDropped(int i, Random random) ++ { ++ return quantityDropped(random); ++ } ++ + public int idDropped(int i, Random random) + { + return blockID; + } + ++ /* FORGE: This function isnt called by Minecraft anymore. Use ++ * blockStrength(EntityPlayer,int) instead. ++ */ + public float blockStrength(EntityPlayer entityplayer) + { +- 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); ++ } ++ ++ /* FORGE: This function returns the complete list of drops for a block. ++ */ ++ public ArrayList getBlockDropped(World world, ++ int i, int j, int k, int md) { ++ ArrayList tr=new ArrayList(); ++ ++ int q=quantityDropped(md,world.rand); ++ for(int n=0; n0) { ++ tr.add(new ItemStack(id,1,damageDropped(md))); ++ } ++ } ++ return tr; + } + + public final void dropBlockAsItem(World world, int i, int j, int k, int l) +@@ -249,20 +266,12 @@ + { + return; + } +- int i1 = quantityDropped(world.rand); +- for(int j1 = 0; j1 < i1; j1++) +- { ++ ArrayList ar=getBlockDropped(world,i,j,k,l); ++ for(ItemStack ist : ar) { + if(world.rand.nextFloat() > f) +- { + continue; +- } +- int k1 = idDropped(l, world.rand); +- if(k1 > 0) +- { +- dropBlockAsItem_do(world, i, j, k, new ItemStack(k1, 1, damageDropped(l))); +- } ++ dropBlockAsItem_do(world, i, j, k, ist); + } +- + } + + protected void dropBlockAsItem_do(World world, int i, int j, int k, ItemStack itemstack) +@@ -529,6 +538,86 @@ + return blockMaterial.getMaterialMobility(); + } + ++ /* FORGE: Allow a block to set illumination on a coordinate basis. ++ */ ++ public int getLightValue(IBlockAccess iba, int i, int j, int k) { ++ return lightValue[blockID]; ++ } ++ ++ /* FORGE: Implement and return true if you wish this block to behave ++ * like a ladder when the player is inside. ++ */ ++ public boolean isLadder() { ++ return false; ++ } ++ ++ /* FORGE: Return true if the block is a normal, solid cube. This ++ * determines indirect power state, entity ejection from blocks, and a few ++ * others. ++ */ ++ public boolean isBlockNormalCube(World world, int i, int j, int k) { ++ return blockMaterial.getIsOpaque() && isACube(); ++ } ++ ++ /* 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); ++ } ++ ++ /* FORGE: Return true if the player can place a new block in the block ++ * occupied by this one, like water, lava, fire, etc. ++ */ ++ public boolean isBlockReplaceable( World world, int i, int j, int k ) { ++ return false; ++ } ++ ++ /* FORGE: Return true if this block should set fire and deal fire damage ++ * to entities coming into contact with it, false otherwise. ++ */ ++ public boolean isBlockBurning( World world, int i, int j, int k ) { ++ 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 ++ * 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 ) { ++ return false; ++ } ++ ++ /* FORGE: Return the block hardness with metadata md. ++ */ ++ public float getHardness(int md) { ++ return blockHardness; ++ } ++ ++ /* FORGE: Return the block strength of the block at i,j,k against the ++ * player. ++ */ ++ public float blockStrength(World world, EntityPlayer player, ++ int i, int j, int k) { ++ int md=world.getBlockMetadata(i,j,k); ++ return blockStrength(player,md); ++ } ++ ++ /* FORGE: Return the block strength of a prototypical block with metadata ++ * md against the player. ++ */ ++ public float blockStrength(EntityPlayer player, int md) { ++ return ForgeHooks.blockStrength(this,player,md); ++ } ++ ++ /* FORGE: Return true if the player can harvest a prototypical block with ++ * metadata md. ++ */ ++ public boolean canHarvestBlock(EntityPlayer player, int md) { ++ return ForgeHooks.canHarvestBlock(this,player,md); ++ } ++ + static Class _mthclass$(String s) + { + try diff --git a/patches/minecraft_server/net/minecraft/src/BlockButton.java.patch b/patches/minecraft_server/net/minecraft/src/BlockButton.java.patch new file mode 100644 index 0000000000..4b1fb3e7fb --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/BlockButton.java.patch @@ -0,0 +1,119 @@ +--- ../src_base/minecraft_server/net/minecraft/src/BlockButton.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/BlockButton.java 0000-00-00 00:00:00.000000000 -0000 +@@ -41,36 +41,36 @@ + + public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l) + { +- 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); + } + + 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); + } + + public void onBlockPlaced(World world, int i, int j, int k, int l) +@@ -78,19 +78,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)) ++ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3)) + { + i1 = 3; + } else +- if(l == 4 && world.isBlockNormalCube(i + 1, j, k)) ++ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4)) + { + i1 = 2; + } else +- if(l == 5 && world.isBlockNormalCube(i - 1, j, k)) ++ if(l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5)) + { + i1 = 1; + } else +@@ -102,19 +102,19 @@ + + private int getOrientation(World world, int i, int j, int k) + { +- 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; + } + + public void onNeighborBlockChange(World world, int i, int j, int k, int l) +@@ -123,19 +123,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) + { + flag = true; + } +- if(!world.isBlockNormalCube(i + 1, j, k) && i1 == 2) ++ if(!world.isBlockSolidOnSide(i + 1, j, k,4) && i1 == 2) + { + flag = true; + } +- if(!world.isBlockNormalCube(i, j, k - 1) && i1 == 3) ++ if(!world.isBlockSolidOnSide(i, j, k - 1,3) && i1 == 3) + { + flag = true; + } +- if(!world.isBlockNormalCube(i, j, k + 1) && i1 == 4) ++ if(!world.isBlockSolidOnSide(i, j, k + 1,2) && i1 == 4) + { + flag = true; + } diff --git a/patches/minecraft_server/net/minecraft/src/BlockChest.java.patch b/patches/minecraft_server/net/minecraft/src/BlockChest.java.patch new file mode 100644 index 0000000000..5e0acf20ad --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/BlockChest.java.patch @@ -0,0 +1,31 @@ +--- ../src_base/minecraft_server/net/minecraft/src/BlockChest.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/BlockChest.java 0000-00-00 00:00:00.000000000 -0000 +@@ -328,23 +328,23 @@ + { + return true; + } +- if(world.isBlockNormalCube(i, j + 1, k)) ++ if(world.isBlockSolidOnSide(i, j + 1, k,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)) + { + 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)) + { + 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)) + { + 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)) + { + return true; + } diff --git a/patches/minecraft_server/net/minecraft/src/BlockContainer.java.patch b/patches/minecraft_server/net/minecraft/src/BlockContainer.java.patch new file mode 100644 index 0000000000..24433f82fd --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/BlockContainer.java.patch @@ -0,0 +1,24 @@ +--- ../src_base/minecraft_server/net/minecraft/src/BlockContainer.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/BlockContainer.java 0000-00-00 00:00:00.000000000 -0000 +@@ -26,7 +26,7 @@ + public void onBlockAdded(World world, int i, int j, int k) + { + super.onBlockAdded(world, i, j, k); +- world.setBlockTileEntity(i, j, k, getBlockEntity()); ++ world.setBlockTileEntity(i, j, k, getBlockEntity(world.getBlockMetadata(i,j,k))); + } + + public void onBlockRemoval(World world, int i, int j, int k) +@@ -37,6 +37,12 @@ + + public abstract TileEntity getBlockEntity(); + ++ /* FORGE: Metadata-sensitive version, to fix 1.8.1 regression. ++ */ ++ public TileEntity getBlockEntity(int md) { ++ return getBlockEntity(); ++ } ++ + public void playBlock(World world, int i, int j, int k, int l, int i1) + { + super.playBlock(world, i, j, k, l, i1); diff --git a/patches/minecraft_server/net/minecraft/src/BlockCrops.java.patch b/patches/minecraft_server/net/minecraft/src/BlockCrops.java.patch new file mode 100644 index 0000000000..09c53056b2 --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/BlockCrops.java.patch @@ -0,0 +1,48 @@ +--- ../src_base/minecraft_server/net/minecraft/src/BlockCrops.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/BlockCrops.java 0000-00-00 00:00:00.000000000 -0000 +@@ -5,6 +5,7 @@ + package net.minecraft.src; + + import java.util.Random; ++import java.util.ArrayList; + + // Referenced classes of package net.minecraft.src: + // BlockFlower, Block, World, EntityItem, +@@ -103,27 +104,16 @@ + return blockIndexInTexture + j; + } + +- public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f) +- { +- super.dropBlockAsItemWithChance(world, i, j, k, l, f); +- if(world.singleplayerWorld) +- { +- return; +- } +- for(int i1 = 0; i1 < 3; i1++) +- { +- if(world.rand.nextInt(15) <= l) +- { +- 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.entityJoinedWorld(entityitem); +- } +- } +- ++ public ArrayList getBlockDropped(World world, ++ int i, int j, int k, int md) { ++ ArrayList tr=new ArrayList(); ++ if(md==7) tr.add(new ItemStack(Item.wheat)); ++ ++ for(int n=0; n<3; n++) { ++ if(world.rand.nextInt(15) <= md) ++ tr.add(new ItemStack(Item.seeds)); ++ } ++ return tr; + } + + public int idDropped(int i, Random random) diff --git a/patches/minecraft_server/net/minecraft/src/BlockDoor.java.patch b/patches/minecraft_server/net/minecraft/src/BlockDoor.java.patch new file mode 100644 index 0000000000..c1ea96b1fe --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/BlockDoor.java.patch @@ -0,0 +1,20 @@ +--- ../src_base/minecraft_server/net/minecraft/src/BlockDoor.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/BlockDoor.java 0000-00-00 00:00:00.000000000 -0000 +@@ -167,7 +167,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; +@@ -231,7 +231,7 @@ + return false; + } 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); + } + } + diff --git a/patches/minecraft_server/net/minecraft/src/BlockLadder.java.patch b/patches/minecraft_server/net/minecraft/src/BlockLadder.java.patch new file mode 100644 index 0000000000..7cf02273c6 --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/BlockLadder.java.patch @@ -0,0 +1,84 @@ +--- ../src_base/minecraft_server/net/minecraft/src/BlockLadder.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/BlockLadder.java 0000-00-00 00:00:00.000000000 -0000 +@@ -40,6 +40,11 @@ + return super.getCollisionBoundingBoxFromPool(world, i, j, k); + } + ++ /* FORGE: Implemented base method, see Block.isLadder */ ++ public boolean isLadder() { ++ return true; ++ } ++ + public boolean isOpaqueCube() + { + return false; +@@ -52,37 +57,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); + } + + public void onBlockPlaced(World world, int i, int j, int k, int l) + { + 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)) + { + i1 = 2; + } +- if((i1 == 0 || l == 3) && world.isBlockNormalCube(i, j, k - 1)) ++ if((i1 == 0 || l == 3) && world.isBlockSolidOnSide(i, j, k - 1,3)) + { + i1 = 3; + } +- if((i1 == 0 || l == 4) && world.isBlockNormalCube(i + 1, j, k)) ++ if((i1 == 0 || l == 4) && world.isBlockSolidOnSide(i + 1, j, k,4)) + { + i1 = 4; + } +- if((i1 == 0 || l == 5) && world.isBlockNormalCube(i - 1, j, k)) ++ if((i1 == 0 || l == 5) && world.isBlockSolidOnSide(i - 1, j, k,5)) + { + i1 = 5; + } +@@ -93,19 +98,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)) + { + flag = true; + } +- if(i1 == 3 && world.isBlockNormalCube(i, j, k - 1)) ++ if(i1 == 3 && world.isBlockSolidOnSide(i, j, k - 1,3)) + { + flag = true; + } +- if(i1 == 4 && world.isBlockNormalCube(i + 1, j, k)) ++ if(i1 == 4 && world.isBlockSolidOnSide(i + 1, j, k,4)) + { + flag = true; + } +- if(i1 == 5 && world.isBlockNormalCube(i - 1, j, k)) ++ if(i1 == 5 && world.isBlockSolidOnSide(i - 1, j, k,5)) + { + flag = true; + } diff --git a/patches/minecraft_server/net/minecraft/src/BlockLever.java.patch b/patches/minecraft_server/net/minecraft/src/BlockLever.java.patch new file mode 100644 index 0000000000..09b539626e --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/BlockLever.java.patch @@ -0,0 +1,120 @@ +--- ../src_base/minecraft_server/net/minecraft/src/BlockLever.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/BlockLever.java 0000-00-00 00:00:00.000000000 -0000 +@@ -35,44 +35,44 @@ + + public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l) + { +- 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); + } + + 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; + } +- 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); + } + + public void onBlockPlaced(World world, int i, int j, int k, int l) +@@ -81,23 +81,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)) + { + i1 = 5 + world.rand.nextInt(2); + } +- if(l == 2 && world.isBlockNormalCube(i, j, k + 1)) ++ if(l == 2 && world.isBlockSolidOnSide(i, j, k + 1,2)) + { + i1 = 4; + } +- if(l == 3 && world.isBlockNormalCube(i, j, k - 1)) ++ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3)) + { + i1 = 3; + } +- if(l == 4 && world.isBlockNormalCube(i + 1, j, k)) ++ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4)) + { + i1 = 2; + } +- if(l == 5 && world.isBlockNormalCube(i - 1, j, k)) ++ if(l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5)) + { + i1 = 1; + } +@@ -119,27 +119,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) + { + flag = true; + } +- if(!world.isBlockNormalCube(i + 1, j, k) && i1 == 2) ++ if(!world.isBlockSolidOnSide(i + 1, j, k,4) && i1 == 2) + { + flag = true; + } +- if(!world.isBlockNormalCube(i, j, k - 1) && i1 == 3) ++ if(!world.isBlockSolidOnSide(i, j, k - 1,3) && i1 == 3) + { + flag = true; + } +- if(!world.isBlockNormalCube(i, j, k + 1) && i1 == 4) ++ if(!world.isBlockSolidOnSide(i, j, k + 1,2) && i1 == 4) + { + flag = true; + } +- if(!world.isBlockNormalCube(i, j - 1, k) && i1 == 5) ++ if(!world.isBlockSolidOnSide(i, j - 1, k,1) && i1 == 5) + { + flag = true; + } +- if(!world.isBlockNormalCube(i, j - 1, k) && i1 == 6) ++ if(!world.isBlockSolidOnSide(i, j - 1, k,1) && i1 == 6) + { + flag = true; + } diff --git a/patches/minecraft_server/net/minecraft/src/BlockPressurePlate.java.patch b/patches/minecraft_server/net/minecraft/src/BlockPressurePlate.java.patch new file mode 100644 index 0000000000..eff38e4bb4 --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/BlockPressurePlate.java.patch @@ -0,0 +1,22 @@ +--- ../src_base/minecraft_server/net/minecraft/src/BlockPressurePlate.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/BlockPressurePlate.java 0000-00-00 00:00:00.000000000 -0000 +@@ -46,7 +46,8 @@ + + public boolean canPlaceBlockAt(World world, int i, int j, int k) + { +- 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; + } + + public void onBlockAdded(World world, int i, int j, int k) +@@ -56,7 +57,8 @@ + public void onNeighborBlockChange(World world, int i, int j, int k, int l) + { + 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) + { + flag = true; + } diff --git a/patches/minecraft_server/net/minecraft/src/BlockRail.java.patch b/patches/minecraft_server/net/minecraft/src/BlockRail.java.patch new file mode 100644 index 0000000000..7034891beb --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/BlockRail.java.patch @@ -0,0 +1,55 @@ +--- ../src_base/minecraft_server/net/minecraft/src/BlockRail.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/BlockRail.java 0000-00-00 00:00:00.000000000 -0000 +@@ -16,12 +16,12 @@ + public static final boolean isRailBlockAt(World world, int i, int j, int k) + { + 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; + } + + public static final boolean isRailBlock(int i) + { +- return i == Block.rail.blockID || i == Block.railPowered.blockID || i == Block.railDetector.blockID; ++ return Block.blocksList[i] instanceof BlockRail; + } + + protected BlockRail(int i, int j, boolean flag) +@@ -92,7 +92,7 @@ + + public boolean canPlaceBlockAt(World world, int i, int j, int k) + { +- return world.isBlockNormalCube(i, j - 1, k); ++ return world.isBlockSolidOnSide(i, j - 1, k,1); + } + + public void onBlockAdded(World world, int i, int j, int k) +@@ -116,23 +116,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; + } diff --git a/patches/minecraft_server/net/minecraft/src/BlockRedstoneRepeater.java.patch b/patches/minecraft_server/net/minecraft/src/BlockRedstoneRepeater.java.patch new file mode 100644 index 0000000000..66372a4a8a --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/BlockRedstoneRepeater.java.patch @@ -0,0 +1,20 @@ +--- ../src_base/minecraft_server/net/minecraft/src/BlockRedstoneRepeater.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/BlockRedstoneRepeater.java 0000-00-00 00:00:00.000000000 -0000 +@@ -27,7 +27,7 @@ + + public boolean canPlaceBlockAt(World world, int i, int j, int k) + { +- if(!world.isBlockNormalCube(i, j - 1, k)) ++ if(!world.isBlockSolidOnSide(i, j - 1, k,1)) + { + return false; + } else +@@ -38,7 +38,7 @@ + + public boolean canBlockStay(World world, int i, int j, int k) + { +- if(!world.isBlockNormalCube(i, j - 1, k)) ++ if(!world.isBlockSolidOnSide(i, j - 1, k,1)) + { + return false; + } else diff --git a/patches/minecraft_server/net/minecraft/src/BlockRedstoneWire.java.patch b/patches/minecraft_server/net/minecraft/src/BlockRedstoneWire.java.patch new file mode 100644 index 0000000000..ec300c0949 --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/BlockRedstoneWire.java.patch @@ -0,0 +1,30 @@ +--- ../src_base/minecraft_server/net/minecraft/src/BlockRedstoneWire.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/BlockRedstoneWire.java 0000-00-00 00:00:00.000000000 -0000 +@@ -3,6 +3,7 @@ + // Decompiler options: packimports(3) braces deadcode + + package net.minecraft.src; ++import net.minecraft.src.forge.*; + + import java.util.*; + +@@ -43,7 +44,7 @@ + + public boolean canPlaceBlockAt(World world, int i, int j, int k) + { +- return world.isBlockNormalCube(i, j - 1, k); ++ return world.isBlockSolidOnSide(i, j - 1, k, 1); + } + + private void updateAndPropagateCurrentStrength(World world, int i, int j, int k) +@@ -413,6 +414,10 @@ + { + return false; + } ++ if(Block.blocksList[i1] instanceof IConnectRedstone) { ++ IConnectRedstone icr=(IConnectRedstone)Block.blocksList[i1]; ++ return icr.canConnectRedstone(iblockaccess,i,j,k,l); ++ } + if(Block.blocksList[i1].canProvidePower()) + { + return true; diff --git a/patches/minecraft_server/net/minecraft/src/BlockTallGrass.java.patch b/patches/minecraft_server/net/minecraft/src/BlockTallGrass.java.patch new file mode 100644 index 0000000000..31118139a4 --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/BlockTallGrass.java.patch @@ -0,0 +1,37 @@ +--- ../src_base/minecraft_server/net/minecraft/src/BlockTallGrass.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/BlockTallGrass.java 0000-00-00 00:00:00.000000000 -0000 +@@ -4,7 +4,10 @@ + + package net.minecraft.src; + ++import net.minecraft.src.forge.ForgeHooks; ++ + import java.util.Random; ++import java.util.ArrayList; + + // Referenced classes of package net.minecraft.src: + // BlockFlower, Item, World, EntityPlayer, +@@ -41,13 +44,17 @@ + + public int idDropped(int i, Random random) + { +- if(random.nextInt(8) == 0) +- { +- return Item.seeds.shiftedIndex; +- } else +- { + return -1; +- } ++ } ++ ++ public ArrayList getBlockDropped(World world, ++ int i, int j, int k, int md) { ++ ArrayList tr=new ArrayList(); ++ if(world.rand.nextInt(8)!=0) ++ return tr; ++ ItemStack ist=ForgeHooks.getGrassSeed(world); ++ if(ist!=null) tr.add(ist); ++ return tr; + } + + public void harvestBlock(World world, EntityPlayer entityplayer, int i, int j, int k, int l) diff --git a/patches/minecraft_server/net/minecraft/src/BlockTorch.java.patch b/patches/minecraft_server/net/minecraft/src/BlockTorch.java.patch new file mode 100644 index 0000000000..6a8d951fa5 --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/BlockTorch.java.patch @@ -0,0 +1,104 @@ +--- ../src_base/minecraft_server/net/minecraft/src/BlockTorch.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/BlockTorch.java 0000-00-00 00:00:00.000000000 -0000 +@@ -36,24 +36,24 @@ + + private boolean canPlaceTorchOn(World world, int i, int j, int k) + { +- return world.isBlockNormalCube(i, j, k) || world.getBlockId(i, j, k) == Block.fence.blockID; ++ return world.isBlockSolidOnSide(i, j, k,1) || world.getBlockId(i, j, k) == Block.fence.blockID; + } + + 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; + } +- if(world.isBlockNormalCube(i, j, k + 1)) ++ if(world.isBlockSolidOnSide(i, j, k + 1,2)) + { + return true; + } +@@ -67,19 +67,19 @@ + { + i1 = 5; + } +- if(l == 2 && world.isBlockNormalCube(i, j, k + 1)) ++ if(l == 2 && world.isBlockSolidOnSide(i, j, k + 1,2)) + { + i1 = 4; + } +- if(l == 3 && world.isBlockNormalCube(i, j, k - 1)) ++ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3)) + { + i1 = 3; + } +- if(l == 4 && world.isBlockNormalCube(i + 1, j, k)) ++ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4)) + { + i1 = 2; + } +- if(l == 5 && world.isBlockNormalCube(i - 1, j, k)) ++ if(l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5)) + { + i1 = 1; + } +@@ -97,19 +97,19 @@ + + public void onBlockAdded(World world, int i, int j, int k) + { +- if(world.isBlockNormalCube(i - 1, j, k)) ++ if(world.isBlockSolidOnSide(i - 1, j, k,5)) + { + world.setBlockMetadataWithNotify(i, j, k, 1); + } else +- if(world.isBlockNormalCube(i + 1, j, k)) ++ if(world.isBlockSolidOnSide(i + 1, j, k,4)) + { + world.setBlockMetadataWithNotify(i, j, k, 2); + } else +- if(world.isBlockNormalCube(i, j, k - 1)) ++ if(world.isBlockSolidOnSide(i, j, k - 1,3)) + { + world.setBlockMetadataWithNotify(i, j, k, 3); + } else +- if(world.isBlockNormalCube(i, j, k + 1)) ++ if(world.isBlockSolidOnSide(i, j, k + 1,2)) + { + world.setBlockMetadataWithNotify(i, j, k, 4); + } else +@@ -126,19 +126,19 @@ + { + int i1 = world.getBlockMetadata(i, j, k); + boolean flag = false; +- if(!world.isBlockNormalCube(i - 1, j, k) && i1 == 1) ++ if(!world.isBlockSolidOnSide(i - 1, j, k,5) && i1 == 1) + { + flag = true; + } +- if(!world.isBlockNormalCube(i + 1, j, k) && i1 == 2) ++ if(!world.isBlockSolidOnSide(i + 1, j, k,4) && i1 == 2) + { + flag = true; + } +- if(!world.isBlockNormalCube(i, j, k - 1) && i1 == 3) ++ if(!world.isBlockSolidOnSide(i, j, k - 1,3) && i1 == 3) + { + flag = true; + } +- if(!world.isBlockNormalCube(i, j, k + 1) && i1 == 4) ++ if(!world.isBlockSolidOnSide(i, j, k + 1,2) && i1 == 4) + { + flag = true; + } diff --git a/patches/minecraft_server/net/minecraft/src/BlockTrapDoor.java.patch b/patches/minecraft_server/net/minecraft/src/BlockTrapDoor.java.patch new file mode 100644 index 0000000000..6e2fcc1cd9 --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/BlockTrapDoor.java.patch @@ -0,0 +1,36 @@ +--- ../src_base/minecraft_server/net/minecraft/src/BlockTrapDoor.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/BlockTrapDoor.java 0000-00-00 00:00:00.000000000 -0000 +@@ -130,7 +130,7 @@ + { + j1--; + } +- if(!world.isBlockNormalCube(j1, j, k1)) ++ if(!disableValidation && !world.isBlockSolidOnSide(j1, j, k1, (i1&3)+2)) + { + world.setBlockWithNotify(i, j, k, 0); + dropBlockAsItem(world, i, j, k, i1); +@@ -172,6 +172,7 @@ + + public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l) + { ++ if(disableValidation) return true; + if(l == 0) + { + return false; +@@ -196,11 +197,15 @@ + { + i--; + } +- return world.isBlockNormalCube(i, j, k); ++ return world.isBlockSolidOnSide(i, j, k, l); + } + + public static boolean isTrapdoorOpen(int i) + { + return (i & 4) != 0; + } ++ ++ /* FORGE: Set this to allow trapdoors to remain free-floating ++ */ ++ public static boolean disableValidation=false; + } diff --git a/patches/minecraft_server/net/minecraft/src/Chunk.java.patch b/patches/minecraft_server/net/minecraft/src/Chunk.java.patch new file mode 100644 index 0000000000..1b328d5e10 --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/Chunk.java.patch @@ -0,0 +1,295 @@ +--- ../src_base/minecraft_server/net/minecraft/src/Chunk.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/Chunk.java 0000-00-00 00:00:00.000000000 -0000 +@@ -3,6 +3,7 @@ + // Decompiler options: packimports(3) braces deadcode + + package net.minecraft.src; ++import net.minecraft.src.forge.*; + + import java.io.PrintStream; + import java.util.*; +@@ -68,16 +69,12 @@ + + public void generateSkylightMap() + { +- worldObj.getClass(); + int i = 128 - 1; + for(int j = 0; j < 16; j++) + { + for(int l = 0; l < 16; l++) + { +- worldObj.getClass(); + int j1 = 128 - 1; +- worldObj.getClass(); +- worldObj.getClass(); + int k1; + for(k1 = j << 11 | l << 7; j1 > 0 && Block.lightOpacity[blocks[(k1 + j1) - 1] & 0xff] == 0; j1--) { } + heightMap[l << 4 | j] = (byte)j1; +@@ -90,7 +87,6 @@ + continue; + } + int l1 = 15; +- worldObj.getClass(); + int i2 = 128 - 1; + do + { +@@ -128,7 +124,6 @@ + + private void func_35633_i() + { +- worldObj.getClass(); + if(worldObj.doChunksNearChunkExist(xPosition * 16 + 8, 128 / 2, zPosition * 16 + 8, 16)) + { + for(int i = 0; i < 16; i++) +@@ -190,7 +185,6 @@ + { + if(l > k) + { +- worldObj.getClass(); + if(worldObj.doChunksNearChunkExist(i, 128 / 2, j, 16)) + { + for(int i1 = k; i1 < l; i1++) +@@ -211,8 +205,6 @@ + { + i1 = j; + } +- worldObj.getClass(); +- worldObj.getClass(); + for(int j1 = i << 11 | k << 7; i1 > 0 && Block.lightOpacity[blocks[(j1 + i1) - 1] & 0xff] == 0; i1--) { } + if(i1 == l) + { +@@ -225,7 +217,6 @@ + lowestBlockHeight = i1; + } else + { +- worldObj.getClass(); + int k1 = 128 - 1; + for(int i2 = 0; i2 < 16; i2++) + { +@@ -294,8 +285,6 @@ + + public int getBlockID(int i, int j, int k) + { +- worldObj.getClass(); +- worldObj.getClass(); + return blocks[i << 11 | k << 7 | j] & 0xff; + } + +@@ -308,8 +297,6 @@ + field_35637_c[j1] = -999; + } + int k1 = heightMap[k << 4 | i] & 0xff; +- worldObj.getClass(); +- worldObj.getClass(); + int l1 = blocks[i << 11 | k << 7 | j] & 0xff; + if(l1 == l && data.getNibble(i, j, k) == i1) + { +@@ -317,12 +304,17 @@ + } + int i2 = xPosition * 16 + i; + int j2 = zPosition * 16 + k; +- worldObj.getClass(); +- worldObj.getClass(); ++ if (Block.blocksList[l1] instanceof IOverrideReplace) { ++ IOverrideReplace iovr = (IOverrideReplace) Block.blocksList[l1]; ++ if (!iovr.canReplaceBlock(worldObj, i2, j, j2, l)) ++ return iovr.getReplacedSuccess(); ++ } ++ + blocks[i << 11 | k << 7 | j] = (byte)(byte0 & 0xff); +- if(l1 != 0 && !worldObj.singleplayerWorld) +- { +- Block.blocksList[l1].onBlockRemoval(worldObj, i2, j, j2); ++ if(l1 != 0) { ++ if(!worldObj.singleplayerWorld) ++ Block.blocksList[l1].onBlockRemoval(worldObj, i2, j, j2); ++ removeChunkBlockTileEntity(i,j,k); + } + data.setNibble(i, j, k, i1); + if(!worldObj.worldProvider.hasNoSky) +@@ -354,7 +346,7 @@ + TileEntity tileentity = getChunkBlockTileEntity(i, j, k); + if(tileentity == null) + { +- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(); ++ tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(i1); + worldObj.setBlockTileEntity(i, j, k, tileentity); + } + if(tileentity != null) +@@ -362,14 +354,6 @@ + tileentity.func_35164_g(); + } + } +- } else +- if(l1 > 0 && (Block.blocksList[l1] instanceof BlockContainer)) +- { +- TileEntity tileentity1 = getChunkBlockTileEntity(i, j, k); +- if(tileentity1 != null) +- { +- tileentity1.func_35164_g(); +- } + } + isModified = true; + return true; +@@ -384,8 +368,6 @@ + field_35637_c[i1] = -999; + } + int j1 = heightMap[i1] & 0xff; +- worldObj.getClass(); +- worldObj.getClass(); + int k1 = blocks[i << 11 | k << 7 | j] & 0xff; + if(k1 == l) + { +@@ -393,12 +375,18 @@ + } + int l1 = xPosition * 16 + i; + int i2 = zPosition * 16 + k; +- worldObj.getClass(); +- worldObj.getClass(); ++ ++ if (Block.blocksList[k1] instanceof IOverrideReplace) { ++ IOverrideReplace iovr = (IOverrideReplace) Block.blocksList[k1]; ++ if (!iovr.canReplaceBlock(worldObj, l1, j, i2, l)) ++ return iovr.getReplacedSuccess(); ++ } ++ + blocks[i << 11 | k << 7 | j] = (byte)(byte0 & 0xff); +- if(k1 != 0) +- { +- Block.blocksList[k1].onBlockRemoval(worldObj, l1, j, i2); ++ if(k1 != 0) { ++ if(!worldObj.singleplayerWorld) ++ Block.blocksList[k1].onBlockRemoval(worldObj, l1, j, i2); ++ removeChunkBlockTileEntity(i,j,k); + } + data.setNibble(i, j, k, 0); + if(Block.lightOpacity[byte0 & 0xff] != 0) +@@ -426,7 +414,7 @@ + TileEntity tileentity = getChunkBlockTileEntity(i, j, k); + if(tileentity == null) + { +- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(); ++ tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(0); + worldObj.setBlockTileEntity(i, j, k, tileentity); + } + if(tileentity != null) +@@ -434,14 +422,6 @@ + tileentity.func_35164_g(); + } + } +- } else +- if(k1 > 0 && (Block.blocksList[k1] instanceof BlockContainer)) +- { +- TileEntity tileentity1 = getChunkBlockTileEntity(i, j, k); +- if(tileentity1 != null) +- { +- tileentity1.func_35164_g(); +- } + } + isModified = true; + return true; +@@ -568,6 +548,11 @@ + { + ChunkPosition chunkposition = new ChunkPosition(i, j, k); + TileEntity tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition); ++ if(tileentity != null && tileentity.isInvalid()) ++ { ++ chunkTileEntityMap.remove(chunkposition); ++ tileentity=null; ++ } + if(tileentity == null) + { + int l = getBlockID(i, j, k); +@@ -577,18 +562,23 @@ + } + if(tileentity == null) + { +- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(); ++ tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(getBlockMetadata(i,j,k)); + worldObj.setBlockTileEntity(xPosition * 16 + i, j, zPosition * 16 + k, tileentity); + } + tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition); + } +- if(tileentity != null && tileentity.isInvalid()) +- { +- chunkTileEntityMap.remove(chunkposition); +- return null; +- } else ++ return tileentity; ++ } ++ ++ /* FORGE: Used to remove only invalid TileEntities */ ++ public void cleanChunkBlockTileEntity(int i, int j, int k) ++ { ++ ChunkPosition chunkposition = new ChunkPosition(i, j, k); ++ if(isChunkLoaded) + { +- return tileentity; ++ TileEntity tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition); ++ if(tileentity!=null && tileentity.isInvalid()) ++ chunkTileEntityMap.remove(chunkposition); + } + } + +@@ -600,7 +590,7 @@ + setChunkBlockTileEntity(i, j, k, tileentity); + if(isChunkLoaded) + { +- worldObj.loadedTileEntityList.add(tileentity); ++ worldObj.addTileEntity(tileentity); + } + } + +@@ -617,6 +607,8 @@ + return; + } else + { ++ TileEntity old=(TileEntity)chunkTileEntityMap.get(chunkposition); ++ if(old!=null) old.invalidate(); + tileentity.validate(); + chunkTileEntityMap.put(chunkposition, tileentity); + return; +@@ -766,8 +758,6 @@ + { + for(int k3 = k; k3 < j1; k3++) + { +- worldObj.getClass(); +- worldObj.getClass(); + int k4 = k2 << 11 | k3 << 7 | j; + int k5 = i1 - j; + System.arraycopy(blocks, k4, abyte0, k1, k5); +@@ -780,8 +770,6 @@ + { + for(int l3 = k; l3 < j1; l3++) + { +- worldObj.getClass(); +- worldObj.getClass(); + int l4 = (l2 << 11 | l3 << 7 | j) >> 1; + int l5 = (i1 - j) / 2; + System.arraycopy(data.data, l4, abyte0, k1, l5); +@@ -794,8 +782,6 @@ + { + for(int i4 = k; i4 < j1; i4++) + { +- worldObj.getClass(); +- worldObj.getClass(); + int i5 = (i3 << 11 | i4 << 7 | j) >> 1; + int i6 = (i1 - j) / 2; + System.arraycopy(blocklightMap.data, i5, abyte0, k1, i6); +@@ -808,8 +794,6 @@ + { + for(int j4 = k; j4 < j1; j4++) + { +- worldObj.getClass(); +- worldObj.getClass(); + int j5 = (j3 << 11 | j4 << 7 | j) >> 1; + int j6 = (i1 - j) / 2; + System.arraycopy(skylightMap.data, j5, abyte0, k1, j6); +@@ -857,7 +841,6 @@ + int l = field_35637_c[k]; + if(l == -999) + { +- worldObj.getClass(); + int i1 = 128 - 1; + for(l = -1; i1 > 0 && l == -1;) + { diff --git a/patches/minecraft_server/net/minecraft/src/EntityLiving.java.patch b/patches/minecraft_server/net/minecraft/src/EntityLiving.java.patch new file mode 100644 index 0000000000..607f48d7dd --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/EntityLiving.java.patch @@ -0,0 +1,13 @@ +--- ../src_base/minecraft_server/net/minecraft/src/EntityLiving.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/EntityLiving.java 0000-00-00 00:00:00.000000000 -0000 +@@ -600,7 +600,9 @@ + 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(); + } + + public void writeEntityToNBT(NBTTagCompound nbttagcompound) diff --git a/patches/minecraft_server/net/minecraft/src/EntityPlayer.java.patch b/patches/minecraft_server/net/minecraft/src/EntityPlayer.java.patch new file mode 100644 index 0000000000..b8f5e13ba4 --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/EntityPlayer.java.patch @@ -0,0 +1,76 @@ +--- ../src_base/minecraft_server/net/minecraft/src/EntityPlayer.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/EntityPlayer.java 0000-00-00 00:00:00.000000000 -0000 +@@ -6,6 +6,10 @@ + + import java.util.*; + ++import net.minecraft.src.forge.ArmorProperties; ++import net.minecraft.src.forge.ISpecialArmor; ++import net.minecraft.src.forge.ForgeHooks; ++ + // Referenced classes of package net.minecraft.src: + // EntityLiving, InventoryPlayer, FoodStats, PlayerCapabilities, + // ContainerPlayer, World, ChunkCoordinates, DataWatcher, +@@ -433,6 +437,8 @@ + worldObj.entityJoinedWorld(entityitem); + } + ++ /* FORGE: This isnt called anymore ++ */ + public float getCurrentPlayerStrVsBlock(Block block) + { + float f = inventory.getStrVsBlock(block); +@@ -455,6 +461,32 @@ + return f; + } + ++ /* 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); ++ if(isInsideOfMaterial(Material.water)) ++ { ++ f /= 5F; ++ } ++ if(!onGround) ++ { ++ f /= 5F; ++ } ++ if(func_35184_a(Potion.digSpeed)) ++ { ++ f *= 1.0F + (float)(func_35187_b(Potion.digSpeed).func_35652_c() + 1) * 0.2F; ++ } ++ if(func_35184_a(Potion.digSlowdown)) ++ { ++ f *= 1.0F - (float)(func_35187_b(Potion.digSlowdown).func_35652_c() + 1) * 0.2F; ++ } ++ return f; ++ } ++ + public boolean canHarvestBlock(Block block) + { + return inventory.canHarvestBlock(block); +@@ -668,7 +700,9 @@ + + public void destroyCurrentEquippedItem() + { ++ ItemStack orig=inventory.getCurrentItem(); + inventory.setInventorySlotContents(inventory.currentItem, null); ++ ForgeHooks.onDestroyCurrentItem(this,orig); + } + + public double getYOffset() +@@ -757,6 +791,10 @@ + + public EnumStatus sleepInBedAt(int i, int j, int k) + { ++ EnumStatus customSleep = ForgeHooks.sleepInBedAt(this, i, j, k); ++ if (customSleep != null) { ++ return customSleep; ++ } + if(!worldObj.singleplayerWorld) + { + if(isPlayerSleeping() || !isEntityAlive()) diff --git a/patches/minecraft_server/net/minecraft/src/Explosion.java.patch b/patches/minecraft_server/net/minecraft/src/Explosion.java.patch new file mode 100644 index 0000000000..7ee22e874c --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/Explosion.java.patch @@ -0,0 +1,28 @@ +--- ../src_base/minecraft_server/net/minecraft/src/Explosion.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/Explosion.java 0000-00-00 00:00:00.000000000 -0000 +@@ -3,6 +3,7 @@ + // Decompiler options: packimports(3) braces deadcode + + package net.minecraft.src; ++import net.minecraft.src.forge.ISpecialResistance; + + import java.util.*; + +@@ -66,7 +67,16 @@ + int i5 = worldObj.getBlockId(j4, k4, l4); + if(i5 > 0) + { +- f1 -= (Block.blocksList[i5].getExplosionResistance(exploder) + 0.3F) * f2; ++ if(Block.blocksList[i5] instanceof ISpecialResistance) { ++ ISpecialResistance isr=(ISpecialResistance) ++ Block.blocksList[i5]; ++ f1-=(isr.getSpecialExplosionResistance( ++ worldObj,j4,k4,l4, ++ explosionX,explosionY,explosionZ, ++ exploder) + 0.3F) * f2; ++ } else { ++ f1 -= (Block.blocksList[i5].getExplosionResistance(exploder) + 0.3F) * f2; ++ } + } + if(f1 > 0.0F) + { diff --git a/patches/minecraft_server/net/minecraft/src/FurnaceRecipes.java.patch b/patches/minecraft_server/net/minecraft/src/FurnaceRecipes.java.patch new file mode 100644 index 0000000000..70d851bf1c --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/FurnaceRecipes.java.patch @@ -0,0 +1,58 @@ +--- ../src_base/minecraft_server/net/minecraft/src/FurnaceRecipes.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/FurnaceRecipes.java 0000-00-00 00:00:00.000000000 -0000 +@@ -6,6 +6,7 @@ + + import java.util.HashMap; + import java.util.Map; ++import java.util.Arrays; + + // Referenced classes of package net.minecraft.src: + // Block, ItemStack, Item +@@ -21,6 +22,7 @@ + private FurnaceRecipes() + { + 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)); +@@ -40,11 +42,32 @@ + smeltingList.put(Integer.valueOf(i), itemstack); + } + ++ /* FORGE: Add a metadata-sensitive furnace recipe. ++ */ ++ public void addSmelting(int i, int meta, ItemStack itemstack) ++ { ++ metaSmeltingList.put(Arrays.asList(i,meta), itemstack); ++ } ++ ++ /* FORGE: Not used anymore. ++ */ + public ItemStack getSmeltingResult(int i) + { + return (ItemStack)smeltingList.get(Integer.valueOf(i)); + } + ++ /* FORGE: Added to allow metadata-sensitive smelting. ++ */ ++ public ItemStack getSmeltingResult(ItemStack src) { ++ ItemStack tr; ++ ++ if(src==null) return null; ++ tr=(ItemStack)metaSmeltingList.get( ++ Arrays.asList(src.itemID,src.getItemDamage())); ++ if(tr!=null) return tr; ++ return (ItemStack)smeltingList.get(Integer.valueOf(src.itemID)); ++ } ++ + public Map getSmeltingList() + { + return smeltingList; +@@ -52,5 +75,6 @@ + + private static final FurnaceRecipes smeltingBase = new FurnaceRecipes(); + private Map smeltingList; ++ private Map metaSmeltingList; + + } diff --git a/patches/minecraft_server/net/minecraft/src/Item.java.patch b/patches/minecraft_server/net/minecraft/src/Item.java.patch new file mode 100644 index 0000000000..545acffb2b --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/Item.java.patch @@ -0,0 +1,16 @@ +--- ../src_base/minecraft_server/net/minecraft/src/Item.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/Item.java 0000-00-00 00:00:00.000000000 -0000 +@@ -66,6 +66,13 @@ + return 1.0F; + } + ++ /* FORGE: Metadata-sensitive version of getStrVsBlock ++ */ ++ public float getStrVsBlock(ItemStack itemstack, Block block, int md) ++ { ++ return getStrVsBlock(itemstack,block); ++ } ++ + public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) + { + return itemstack; diff --git a/patches/minecraft_server/net/minecraft/src/ItemBlock.java.patch b/patches/minecraft_server/net/minecraft/src/ItemBlock.java.patch new file mode 100644 index 0000000000..794422dc09 --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/ItemBlock.java.patch @@ -0,0 +1,11 @@ +--- ../src_base/minecraft_server/net/minecraft/src/ItemBlock.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/ItemBlock.java 0000-00-00 00:00:00.000000000 -0000 +@@ -62,7 +62,7 @@ + { + return false; + } +- if(!entityplayer.func_35200_c(i, j, k)) ++ if(entityplayer!=null && !entityplayer.func_35200_c(i, j, k)) + { + return false; + } diff --git a/patches/minecraft_server/net/minecraft/src/ItemBucket.java.patch b/patches/minecraft_server/net/minecraft/src/ItemBucket.java.patch new file mode 100644 index 0000000000..ad858eb819 --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/ItemBucket.java.patch @@ -0,0 +1,24 @@ +--- ../src_base/minecraft_server/net/minecraft/src/ItemBucket.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/ItemBucket.java 0000-00-00 00:00:00.000000000 -0000 +@@ -6,6 +6,8 @@ + + import java.util.Random; + ++import net.minecraft.src.forge.MinecraftForge; ++ + // Referenced classes of package net.minecraft.src: + // Item, EntityPlayer, Vec3D, MathHelper, + // World, MovingObjectPosition, EnumMovingObjectType, Material, +@@ -56,6 +58,12 @@ + } + if(isFull == 0) + { ++ ItemStack customBucket = MinecraftForge.fillCustomBucket(world, ++ i, j, k); ++ if (customBucket != null) { ++ return customBucket; ++ } ++ + if(!entityplayer.func_35200_c(i, j, k)) + { + return itemstack; diff --git a/patches/minecraft_server/net/minecraft/src/ItemDye.java.patch b/patches/minecraft_server/net/minecraft/src/ItemDye.java.patch new file mode 100644 index 0000000000..30e1b2bb64 --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/ItemDye.java.patch @@ -0,0 +1,45 @@ +--- ../src_base/minecraft_server/net/minecraft/src/ItemDye.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/ItemDye.java 0000-00-00 00:00:00.000000000 -0000 +@@ -3,6 +3,7 @@ + // Decompiler options: packimports(3) braces deadcode + + package net.minecraft.src; ++import net.minecraft.src.forge.ForgeHooks; + + import java.util.Random; + +@@ -29,13 +30,18 @@ + + public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l) + { +- if(!entityplayer.func_35200_c(i, j, k)) ++ if(entityplayer!=null && !entityplayer.func_35200_c(i, j, k)) + { + return false; + } + if(itemstack.getItemDamage() == 15) + { + int i1 = world.getBlockId(i, j, k); ++ if(ForgeHooks.onUseBonemeal(world,i1,i,j,k)) { ++ if(!world.singleplayerWorld) ++ itemstack.stackSize--; ++ return true; ++ } + if(i1 == Block.sapling.blockID) + { + if(!world.singleplayerWorld) +@@ -102,13 +108,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); + } + + } diff --git a/patches/minecraft_server/net/minecraft/src/ItemFlintAndSteel.java.patch b/patches/minecraft_server/net/minecraft/src/ItemFlintAndSteel.java.patch new file mode 100644 index 0000000000..167cde2315 --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/ItemFlintAndSteel.java.patch @@ -0,0 +1,11 @@ +--- ../src_base/minecraft_server/net/minecraft/src/ItemFlintAndSteel.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/ItemFlintAndSteel.java 0000-00-00 00:00:00.000000000 -0000 +@@ -46,7 +46,7 @@ + { + i++; + } +- if(!entityplayer.func_35200_c(i, j, k)) ++ if(entityplayer!=null && !entityplayer.func_35200_c(i, j, k)) + { + return false; + } diff --git a/patches/minecraft_server/net/minecraft/src/ItemHoe.java.patch b/patches/minecraft_server/net/minecraft/src/ItemHoe.java.patch new file mode 100644 index 0000000000..4596ad1a1f --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/ItemHoe.java.patch @@ -0,0 +1,11 @@ +--- ../src_base/minecraft_server/net/minecraft/src/ItemHoe.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/ItemHoe.java 0000-00-00 00:00:00.000000000 -0000 +@@ -21,7 +21,7 @@ + + public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l) + { +- if(!entityplayer.func_35200_c(i, j, k)) ++ if(entityplayer!=null && !entityplayer.func_35200_c(i, j, k)) + { + return false; + } diff --git a/patches/minecraft_server/net/minecraft/src/ItemInWorldManager.java.patch b/patches/minecraft_server/net/minecraft/src/ItemInWorldManager.java.patch new file mode 100644 index 0000000000..fd72220c42 --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/ItemInWorldManager.java.patch @@ -0,0 +1,82 @@ +--- ../src_base/minecraft_server/net/minecraft/src/ItemInWorldManager.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/ItemInWorldManager.java 0000-00-00 00:00:00.000000000 -0000 +@@ -3,7 +3,8 @@ + // Decompiler options: packimports(3) braces deadcode + + package net.minecraft.src; +- ++import net.minecraft.src.forge.ForgeHooks; ++import net.minecraft.src.forge.IUseItemFirst; + + // Referenced classes of package net.minecraft.src: + // EntityPlayer, PlayerCapabilities, World, Block, +@@ -66,7 +67,8 @@ + if(j != 0) + { + Block block = Block.blocksList[j]; +- float f = block.blockStrength(thisPlayer) * (float)(i + 1); ++ float f = block.blockStrength(thisWorld,thisPlayer, ++ field_22049_l,field_22048_m,field_22047_n) * (float)(i + 1); + if(f >= 1.0F) + { + field_22050_k = false; +@@ -93,7 +95,7 @@ + { + Block.blocksList[i1].onBlockClicked(thisWorld, i, j, k, thisPlayer); + } +- if(i1 > 0 && Block.blocksList[i1].blockStrength(thisPlayer) >= 1.0F) ++ if(i1 > 0 && Block.blocksList[i1].blockStrength(thisWorld,thisPlayer,i,j,k) >= 1.0F) + { + blockHarvessted(i, j, k); + } else +@@ -113,7 +115,7 @@ + if(i1 != 0) + { + Block block = Block.blocksList[i1]; +- float f = block.blockStrength(thisPlayer) * (float)(l + 1); ++ float f = block.blockStrength(thisWorld,thisPlayer,i,j,k) * (float)(l + 1); + if(f >= 0.7F) + { + blockHarvessted(i, j, k); +@@ -164,7 +166,7 @@ + thisPlayer.destroyCurrentEquippedItem(); + } + } +- if(flag && thisPlayer.canHarvestBlock(Block.blocksList[l])) ++ if(flag && Block.blocksList[l].canHarvestBlock(thisPlayer,i1)) + { + Block.blocksList[l].harvestBlock(thisWorld, thisPlayer, i, j, k, i1); + } +@@ -188,6 +190,7 @@ + if(itemstack1.stackSize == 0) + { + entityplayer.inventory.mainInventory[entityplayer.inventory.currentItem] = null; ++ ForgeHooks.onDestroyCurrentItem(entityplayer,itemstack1); + } + return true; + } else +@@ -198,6 +201,11 @@ + + public boolean activeBlockOrUseItem(EntityPlayer entityplayer, World world, ItemStack itemstack, int i, int j, int k, int l) + { ++ if(itemstack!=null && itemstack.getItem() instanceof IUseItemFirst) { ++ IUseItemFirst iuif=(IUseItemFirst)itemstack.getItem(); ++ if(iuif.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)) + { +@@ -217,7 +225,11 @@ + return flag; + } 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); ++ return true; + } + } + diff --git a/patches/minecraft_server/net/minecraft/src/ItemRedstone.java.patch b/patches/minecraft_server/net/minecraft/src/ItemRedstone.java.patch new file mode 100644 index 0000000000..c7e7bd08e1 --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/ItemRedstone.java.patch @@ -0,0 +1,11 @@ +--- ../src_base/minecraft_server/net/minecraft/src/ItemRedstone.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/ItemRedstone.java 0000-00-00 00:00:00.000000000 -0000 +@@ -50,7 +50,7 @@ + return false; + } + } +- if(!entityplayer.func_35200_c(i, j, k)) ++ if(entityplayer!=null && !entityplayer.func_35200_c(i, j, k)) + { + return false; + } diff --git a/patches/minecraft_server/net/minecraft/src/ItemReed.java.patch b/patches/minecraft_server/net/minecraft/src/ItemReed.java.patch new file mode 100644 index 0000000000..ad19a4c590 --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/ItemReed.java.patch @@ -0,0 +1,11 @@ +--- ../src_base/minecraft_server/net/minecraft/src/ItemReed.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/ItemReed.java 0000-00-00 00:00:00.000000000 -0000 +@@ -52,7 +52,7 @@ + i++; + } + } +- if(!entityplayer.func_35200_c(i, j, k)) ++ if(entityplayer!=null && !entityplayer.func_35200_c(i, j, k)) + { + return false; + } diff --git a/patches/minecraft_server/net/minecraft/src/ItemSeeds.java.patch b/patches/minecraft_server/net/minecraft/src/ItemSeeds.java.patch new file mode 100644 index 0000000000..e5170c75a5 --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/ItemSeeds.java.patch @@ -0,0 +1,11 @@ +--- ../src_base/minecraft_server/net/minecraft/src/ItemSeeds.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/ItemSeeds.java 0000-00-00 00:00:00.000000000 -0000 +@@ -24,7 +24,7 @@ + { + return false; + } +- if(!entityplayer.func_35200_c(i, j, k) || !entityplayer.func_35200_c(i, j + 1, k)) ++ if(entityplayer!=null && (!entityplayer.func_35200_c(i, j, k) || !entityplayer.func_35200_c(i, j + 1, k))) + { + return false; + } diff --git a/patches/minecraft_server/net/minecraft/src/ItemTool.java.patch b/patches/minecraft_server/net/minecraft/src/ItemTool.java.patch new file mode 100644 index 0000000000..4bc57d9f23 --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/ItemTool.java.patch @@ -0,0 +1,36 @@ +--- ../src_base/minecraft_server/net/minecraft/src/ItemTool.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/ItemTool.java 0000-00-00 00:00:00.000000000 -0000 +@@ -4,6 +4,8 @@ + + package net.minecraft.src; + ++import java.util.Arrays; ++import net.minecraft.src.forge.ForgeHooks; + + // Referenced classes of package net.minecraft.src: + // Item, EnumToolMaterial, ItemStack, Block, +@@ -37,6 +39,14 @@ + return 1.0F; + } + ++ /* FORGE: Overridden to allow custom tool effectiveness ++ */ ++ 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) + { + itemstack.damageItem(2, entityliving1); +@@ -55,7 +65,7 @@ + } + + private Block blocksEffectiveAgainst[]; +- private float efficiencyOnProperMaterial; +- private int damageVsEntity; ++ public float efficiencyOnProperMaterial; ++ public int damageVsEntity; + protected EnumToolMaterial toolMaterial; + } diff --git a/patches/minecraft_server/net/minecraft/src/MovingObjectPosition.java.patch b/patches/minecraft_server/net/minecraft/src/MovingObjectPosition.java.patch new file mode 100644 index 0000000000..38011b3cf0 --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/MovingObjectPosition.java.patch @@ -0,0 +1,10 @@ +--- ../src_base/minecraft_server/net/minecraft/src/MovingObjectPosition.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/MovingObjectPosition.java 0000-00-00 00:00:00.000000000 -0000 +@@ -35,4 +35,7 @@ + public int sideHit; + public Vec3D hitVec; + public Entity entityHit; ++ ++ // Added for RedPower subblocks. ++ public int subHit=-1; + } diff --git a/patches/minecraft_server/net/minecraft/src/PlayerInstance.java.patch b/patches/minecraft_server/net/minecraft/src/PlayerInstance.java.patch new file mode 100644 index 0000000000..bf56c4732d --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/PlayerInstance.java.patch @@ -0,0 +1,18 @@ +--- ../src_base/minecraft_server/net/minecraft/src/PlayerInstance.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/PlayerInstance.java 0000-00-00 00:00:00.000000000 -0000 +@@ -168,12 +168,11 @@ + sendPacketToPlayersInInstance(new Packet52MultiBlockChange(chunkX, chunkZ, blocksToUpdate, numBlocksToUpdate, worldserver)); + for(int k = 0; k < numBlocksToUpdate; k++) + { +- int j1 = chunkX * 16 + (numBlocksToUpdate >> 12 & 0xf); +- int i2 = numBlocksToUpdate & 0xff; +- int k2 = chunkZ * 16 + (numBlocksToUpdate >> 8 & 0xf); ++ int j1 = chunkX * 16 + (blocksToUpdate[k] >> 12 & 0xf); ++ int i2 = blocksToUpdate[k] & 0xff; ++ int k2 = chunkZ * 16 + (blocksToUpdate[k] >> 8 & 0xf); + if(Block.isBlockContainer[worldserver.getBlockId(j1, i2, k2)]) + { +- System.out.println("Sending!"); + updateTileEntity(worldserver.getBlockTileEntity(j1, i2, k2)); + } + } diff --git a/patches/minecraft_server/net/minecraft/src/SlotCrafting.java.patch b/patches/minecraft_server/net/minecraft/src/SlotCrafting.java.patch new file mode 100644 index 0000000000..39b6ed4f9e --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/SlotCrafting.java.patch @@ -0,0 +1,19 @@ +--- ../src_base/minecraft_server/net/minecraft/src/SlotCrafting.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/SlotCrafting.java 0000-00-00 00:00:00.000000000 -0000 +@@ -3,7 +3,7 @@ + // Decompiler options: packimports(3) braces deadcode + + package net.minecraft.src; +- ++import net.minecraft.src.forge.ForgeHooks; + + // Referenced classes of package net.minecraft.src: + // Slot, EntityPlayer, ItemStack, Block, +@@ -60,6 +60,7 @@ + thePlayer.addStat(AchievementList.buildSword, 1); + } + ModLoader.TakenFromCrafting(thePlayer, itemstack); ++ ForgeHooks.onTakenFromCrafting(thePlayer, itemstack, craftMatrix); + for(int i = 0; i < craftMatrix.getSizeInventory(); i++) + { + ItemStack itemstack1 = craftMatrix.getStackInSlot(i); diff --git a/patches/minecraft_server/net/minecraft/src/TileEntity.java.patch b/patches/minecraft_server/net/minecraft/src/TileEntity.java.patch new file mode 100644 index 0000000000..ef84f71cb6 --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/TileEntity.java.patch @@ -0,0 +1,16 @@ +--- ../src_base/minecraft_server/net/minecraft/src/TileEntity.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/TileEntity.java 0000-00-00 00:00:00.000000000 -0000 +@@ -61,6 +61,13 @@ + { + } + ++ /* FORGE: Return false if this TileEntity does not require updateEntity() ++ * calls. ++ */ ++ public boolean canUpdate() { ++ return true; ++ } ++ + public static TileEntity createAndLoadEntity(NBTTagCompound nbttagcompound) + { + TileEntity tileentity = null; diff --git a/patches/minecraft_server/net/minecraft/src/TileEntityFurnace.java.patch b/patches/minecraft_server/net/minecraft/src/TileEntityFurnace.java.patch new file mode 100644 index 0000000000..5511bd75c0 --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/TileEntityFurnace.java.patch @@ -0,0 +1,97 @@ +--- ../src_base/minecraft_server/net/minecraft/src/TileEntityFurnace.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/TileEntityFurnace.java 0000-00-00 00:00:00.000000000 -0000 +@@ -4,6 +4,7 @@ + + package net.minecraft.src; + ++import net.minecraft.src.forge.ISidedInventory; + + // Referenced classes of package net.minecraft.src: + // TileEntity, IInventory, ItemStack, NBTTagCompound, +@@ -12,7 +13,7 @@ + // EntityPlayer + + public class TileEntityFurnace extends TileEntity +- implements IInventory ++ implements IInventory, ISidedInventory + { + + public TileEntityFurnace() +@@ -28,6 +29,16 @@ + return furnaceItemStacks.length; + } + ++ public int getStartInventorySide(int side) { ++ if(side==0) return 1; ++ if(side==1) return 0; ++ return 2; ++ } ++ ++ public int getSizeInventorySide(int side) { ++ return 1; ++ } ++ + public ItemStack getStackInSlot(int i) + { + return furnaceItemStacks[i]; +@@ -176,7 +187,7 @@ + { + return false; + } +- ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0].getItem().shiftedIndex); ++ ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0]); + if(itemstack == null) + { + return false; +@@ -189,13 +200,9 @@ + { + return false; + } +- if(furnaceItemStacks[2].stackSize < getInventoryStackLimit() && furnaceItemStacks[2].stackSize < furnaceItemStacks[2].getMaxStackSize()) +- { +- return true; +- } else +- { +- return furnaceItemStacks[2].stackSize < itemstack.getMaxStackSize(); +- } ++ int st=furnaceItemStacks[2].stackSize+itemstack.stackSize; ++ return (st<=getInventoryStackLimit() && ++ st<=itemstack.getMaxStackSize()); + } + + public void smeltItem() +@@ -204,23 +211,29 @@ + { + 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) ++ if(furnaceItemStacks[2].isItemEqual(itemstack)) ++ { ++ furnaceItemStacks[2].stackSize+=itemstack.stackSize; ++ } ++ if(furnaceItemStacks[0].getItem().hasContainerItem()) ++ { ++ furnaceItemStacks[0] = new ItemStack(furnaceItemStacks[0].getItem().getContainerItem()); ++ } else + { +- furnaceItemStacks[2].stackSize++; ++ furnaceItemStacks[0].stackSize--; + } +- furnaceItemStacks[0].stackSize--; + if(furnaceItemStacks[0].stackSize <= 0) + { + furnaceItemStacks[0] = null; + } + } + +- private int getItemBurnTime(ItemStack itemstack) ++ public static int getItemBurnTime(ItemStack itemstack) + { + if(itemstack == null) + { diff --git a/patches/minecraft_server/net/minecraft/src/World.java.patch b/patches/minecraft_server/net/minecraft/src/World.java.patch new file mode 100644 index 0000000000..0b57d2df1d --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/World.java.patch @@ -0,0 +1,189 @@ +--- ../src_base/minecraft_server/net/minecraft/src/World.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/World.java 0000-00-00 00:00:00.000000000 -0000 +@@ -183,7 +183,11 @@ + + public boolean isAirBlock(int i, int j, int k) + { +- 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); + } + + public boolean blockExists(int i, int j, int k) +@@ -1124,7 +1128,7 @@ + Chunk chunk = getChunkFromChunkCoords(tileentity.xCoord >> 4, tileentity.zCoord >> 4); + if(chunk != null) + { +- chunk.removeChunkBlockTileEntity(tileentity.xCoord & 0xf, tileentity.yCoord, tileentity.zCoord & 0xf); ++ chunk.cleanChunkBlockTileEntity(tileentity.xCoord & 0xf, tileentity.yCoord, tileentity.zCoord & 0xf); + } + } + } +@@ -1151,15 +1155,15 @@ + { + loadedTileEntityList.add(tileentity1); + } ++ } else { + if(chunkExists(tileentity1.xCoord >> 4, tileentity1.zCoord >> 4)) + { + Chunk chunk1 = getChunkFromChunkCoords(tileentity1.xCoord >> 4, tileentity1.zCoord >> 4); + if(chunk1 != null) + { +- chunk1.setChunkBlockTileEntity(tileentity1.xCoord & 0xf, tileentity1.yCoord, tileentity1.zCoord & 0xf, tileentity1); ++ chunk1.cleanChunkBlockTileEntity(tileentity1.xCoord & 0xf, tileentity1.yCoord, tileentity1.zCoord & 0xf); + } + } +- markBlockNeedsUpdate(tileentity1.xCoord, tileentity1.yCoord, tileentity1.zCoord); + } + } while(true); + addedTileEntityList.clear(); +@@ -1168,13 +1172,19 @@ + + public void addTileEntity(Collection collection) + { +- if(scanningTileEntities) +- { +- addedTileEntityList.addAll(collection); +- } else +- { +- loadedTileEntityList.addAll(collection); +- } ++ List dest=scanningTileEntities ? addedTileEntityList : ++ loadedTileEntityList; ++ for(Object ob : collection) { ++ TileEntity te=(TileEntity)ob; ++ if(te.canUpdate()) dest.add(te); ++ } ++ } ++ ++ /* FORGE: Used as a bugfix */ ++ public void addTileEntity(TileEntity te) { ++ List dest=scanningTileEntities ? addedTileEntityList : ++ loadedTileEntityList; ++ if(te.canUpdate()) dest.add(te); + } + + public void updateEntity(Entity entity) +@@ -1372,6 +1382,9 @@ + if(j2 == Block.fire.blockID || j2 == Block.lavaMoving.blockID || j2 == Block.lavaStill.blockID) + { + return true; ++ } else { ++ if(j2>0 && Block.blocksList[j2].isBlockBurning(this,k1,l1,i2)) ++ return true; + } + } + +@@ -1590,44 +1603,23 @@ + + public void setBlockTileEntity(int i, int j, int k, TileEntity tileentity) + { +- if(tileentity != null && !tileentity.isInvalid()) +- { +- if(scanningTileEntities) +- { +- tileentity.xCoord = i; +- tileentity.yCoord = j; +- tileentity.zCoord = k; +- addedTileEntityList.add(tileentity); +- } else +- { +- loadedTileEntityList.add(tileentity); +- Chunk chunk = getChunkFromChunkCoords(i >> 4, k >> 4); +- if(chunk != null) +- { +- chunk.setChunkBlockTileEntity(i & 0xf, j, k & 0xf, tileentity); +- } +- } +- } ++ 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); ++ } + } + + public void removeBlockTileEntity(int i, int j, int k) + { +- TileEntity tileentity = getBlockTileEntity(i, j, k); +- if(tileentity != null && scanningTileEntities) +- { +- tileentity.invalidate(); +- } else +- { +- if(tileentity != null) +- { +- 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 func_35239_a(TileEntity tileentity) +@@ -1650,13 +1642,18 @@ + public boolean isBlockNormalCube(int i, int j, int k) + { + Block block = Block.blocksList[getBlockId(i, j, k)]; +- if(block == null) +- { +- return false; +- } else +- { +- return block.blockMaterial.getIsOpaque() && block.isACube(); +- } ++ if(block == null) return false; ++ return block.isBlockNormalCube(this,i,j,k); ++ } ++ ++ /* FORGE: Determine if the given block is considered solid on the ++ * specified side. Used by placement logic. ++ */ ++ public boolean isBlockSolidOnSide(int i, int j, int k, int side) ++ { ++ Block block = Block.blocksList[getBlockId(i, j, k)]; ++ if(block == null) return false; ++ return block.isBlockSolidOnSide(this,i,j,k,side); + } + + public void calculateInitialSkylight() +@@ -1976,7 +1973,7 @@ + + private int func_35241_e(int i, int j, int k, int l, int i1, int j1) + { +- 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; +@@ -2315,6 +2312,7 @@ + { + block = null; + } ++ if(block!=null && block.isBlockReplaceable(this,j,k,l)) block=null; + return i > 0 && block == null && block1.canPlaceBlockOnSide(this, j, k, l, i1); + } + +@@ -2759,7 +2757,7 @@ + public int field_27080_i; + public boolean editingBlocks; + private long lockTimestamp; +- protected int autosavePeriod; ++ public int autosavePeriod; + public int difficultySetting; + public Random rand; + public boolean isNewWorld; diff --git a/patches/minecraft_server/net/minecraft/src/WorldServer.java.patch b/patches/minecraft_server/net/minecraft/src/WorldServer.java.patch new file mode 100644 index 0000000000..cdcb542ed0 --- /dev/null +++ b/patches/minecraft_server/net/minecraft/src/WorldServer.java.patch @@ -0,0 +1,32 @@ +--- ../src_base/minecraft_server/net/minecraft/src/WorldServer.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/WorldServer.java 0000-00-00 00:00:00.000000000 -0000 +@@ -54,15 +54,20 @@ + public List getTileEntityList(int i, int j, int k, int l, int i1, int j1) + { + ArrayList arraylist = new ArrayList(); +- for(int k1 = 0; k1 < loadedTileEntityList.size(); k1++) +- { +- TileEntity tileentity = (TileEntity)loadedTileEntityList.get(k1); +- if(tileentity.xCoord >= i && tileentity.yCoord >= j && tileentity.zCoord >= k && tileentity.xCoord < l && tileentity.yCoord < i1 && tileentity.zCoord < j1) +- { +- arraylist.add(tileentity); +- } +- } +- ++ for(int x=(i>>4); x<=(l>>4); x++) ++ for(int z=(k>>4); z<=(j1>>4); z++) { ++ Chunk ch=getChunkFromChunkCoords(x,z); ++ if(ch==null) continue; ++ for(Object ob : ch.chunkTileEntityMap.values()) { ++ TileEntity te=(TileEntity)ob; ++ if(te.isInvalid()) continue; ++ if(te.xCoord>=i && te.yCoord>=j && te.zCoord>=k ++ && te.xCoord /dev/null - patch -p2 -i ../forge/minecraft.patch + for i in `find ../forge/patches/ -type f` + do + patch -p2 -i $i + done popd > /dev/null cp -a src_work src_forge diff --git a/update_patch.sh b/update_patch.sh deleted file mode 100755 index 9e9edfbb90..0000000000 --- a/update_patch.sh +++ /dev/null @@ -1,5 +0,0 @@ -rm minecraft.patch -touch minecraft.patch - -diff -u ../src_base ../src_work -r --strip-trailing-cr | tr -d '\r' \ - >> minecraft.patch diff --git a/update_patches.bat b/update_patches.bat new file mode 100644 index 0000000000..719b407f2f --- /dev/null +++ b/update_patches.bat @@ -0,0 +1,25 @@ +@setlocal enabledelayedexpansion +@echo off + +rmdir /Q /S patches + +set PATH=.\bin;%PATH% +echo Creating directories +for /f %%i in ('find ../src_work -type d') do ( + set file=%%i + set file=!file:~11! + rem echo patches!file! + "./bin/mkdir.exe" --parents "patches!file!" +) +echo Creating patches +for /f %%i in ('find ../src_work -type f') do ( + set file=%%i + set file=!file:~11! + rem echo !file! + diff -u ../src_base!file! ../src_work!file! -r --strip-trailing-cr --new-file | sed -e "1,2s/[0-9-]* [0-9:\.]* [+-][0-9]*\b/0000-00-00 00:00:00.000000000 -0000/" | tr -d '\r' > patches!file!.patch +) +echo Removing empty patches +for /f %%i in ('find patches -size 0 -type f') do rm %%i +for /f %%i in ('find patches -depth -empty -type d') do rmdir "%%i" + +goto:eof diff --git a/update_patches.sh b/update_patches.sh new file mode 100644 index 0000000000..e2e8b6ea05 --- /dev/null +++ b/update_patches.sh @@ -0,0 +1,26 @@ +rm -rf patches + +echo Creating directories + +for i in `find ../src_work -type d` +do + mkdir --parents "./patches${i:11}" +done + +echo Creating patches + +for i in `find ../src_work -type f` +do + diff -u ../src_base${i:11} $i -r --strip-trailing-cr --new-file | sed -e "1,2s/[0-9-]* [0-9:\.]* [+-][0-9]*\b/0000-00-00 00:00:00.000000000 -00/" | tr -d '\r' > ./patches${i:11}.patch +done + +echo Removing empty patches +for i in `find patches -size 0 -type f` +do + rm $i +done +for i in `find patches -depth -empty -type d` +do + rmdir "$i" +done +