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-09-19 16:32:52.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/BlockButton.java 2011-09-19 16:32:53.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-09-19 16:32:52.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/BlockChest.java 2011-09-19 16:32:53.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/BlockDoor.java ../src_work/minecraft/net/minecraft/src/BlockDoor.java --- ../src_base/minecraft/net/minecraft/src/BlockDoor.java 2011-09-19 16:32:52.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/BlockDoor.java 2011-09-19 16:32:53.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-09-19 16:32:51.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/Block.java 2011-09-19 16:35:38.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 func_35275_c(IBlockAccess iblockaccess, int i, int j, int k) { - return iblockaccess.getLightBrightnessFromSunlight(i, j, k, lightValue[blockID]); + return iblockaccess.getLightBrightnessFromSunlight(i, j, k, + getLightValue(iblockaccess,i,j,k)); } public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) @@ -283,19 +286,12 @@ 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); } public final void dropBlockAsItem(World world, int i, int j, int k, int l) @@ -618,6 +614,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 Only in ../src_work/minecraft/net/minecraft/src: Block.java.orig Only in ../src_work/minecraft/net/minecraft/src: Block.java.rej 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-09-19 16:32:52.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/BlockLadder.java 2011-09-19 16:32:53.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-09-19 16:32:52.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/BlockLever.java 2011-09-19 16:32:53.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-09-19 16:32:52.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/BlockPressurePlate.java 2011-09-19 16:32:53.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-09-19 16:32:52.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/BlockRail.java 2011-09-19 16:32:53.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-09-19 16:32:52.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/BlockRedstoneRepeater.java 2011-09-19 16:32:53.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-09-19 16:32:52.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/BlockRedstoneWire.java 2011-09-19 16:32:53.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/BlockTorch.java ../src_work/minecraft/net/minecraft/src/BlockTorch.java --- ../src_base/minecraft/net/minecraft/src/BlockTorch.java 2011-09-19 16:32:52.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/BlockTorch.java 2011-09-19 16:32:53.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-09-19 16:32:52.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/BlockTrapDoor.java 2011-09-19 16:32:53.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-09-19 16:32:51.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/Chunk.java 2011-09-19 16:32:53.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,8 +322,13 @@ } 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) { @@ -410,8 +394,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,8 +401,13 @@ } 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) { @@ -777,8 +764,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 +777,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 +789,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 +801,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); @@ -880,7 +859,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-09-19 16:32:52.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/EffectRenderer.java 2011-09-19 16:36:34.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,20 @@ 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); + entityfx.renderParticle(tessellator, f, f1, f5, f2, f3, f4); + } + tessellator.draw(); + } + } public void func_1187_b(Entity entity, float f) @@ -132,7 +162,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 +188,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 +238,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; } Only in ../src_work/minecraft/net/minecraft/src: EffectRenderer.java.orig Only in ../src_work/minecraft/net/minecraft/src: EffectRenderer.java.rej 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-09-19 16:32:52.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/EntityLiving.java 2011-09-19 16:32:54.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-09-19 16:32:52.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/EntityPlayer.java 2011-09-19 16:38:04.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(func_35160_a(Potion.potionDigSpeed)) + { + f *= 1.0F + (float)(func_35167_b(Potion.potionDigSpeed).func_35801_c() + 1) * 0.2F; + } + if(func_35160_a(Potion.potionDigSlow)) + { + f *= 1.0F - (float)(func_35167_b(Potion.potionDigSlow).func_35801_c() + 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-09-19 16:32:52.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/EntityRenderer.java 2011-09-19 16:32:54.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-09-19 16:32:51.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/Explosion.java 2011-09-19 16:32:54.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-09-19 16:32:52.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/FurnaceRecipes.java 2011-09-20 21:01:53.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/ItemBucket.java ../src_work/minecraft/net/minecraft/src/ItemBucket.java --- ../src_base/minecraft/net/minecraft/src/ItemBucket.java 2011-09-19 16:32:52.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/ItemBucket.java 2011-09-19 16:32:54.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/Item.java ../src_work/minecraft/net/minecraft/src/Item.java --- ../src_base/minecraft/net/minecraft/src/Item.java 2011-09-19 16:32:51.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/Item.java 2011-09-19 16:32:54.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/ItemRenderer.java ../src_work/minecraft/net/minecraft/src/ItemRenderer.java --- ../src_base/minecraft/net/minecraft/src/ItemRenderer.java 2011-09-19 16:32:52.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/ItemRenderer.java 2011-09-19 16:32:54.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/ItemTool.java ../src_work/minecraft/net/minecraft/src/ItemTool.java --- ../src_base/minecraft/net/minecraft/src/ItemTool.java 2011-09-19 16:32:51.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/ItemTool.java 2011-09-19 16:32:54.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-09-19 16:32:52.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/MovingObjectPosition.java 2011-09-19 16:32:54.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-09-19 16:32:52.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/PlayerController.java 2011-09-19 16:32:54.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-09-19 16:32:52.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/PlayerControllerMP.java 2011-09-19 16:32:54.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(field_9441_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); @@ -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 -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-09-19 16:32:52.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/PlayerControllerSP.java 2011-09-19 16:32:54.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-09-19 16:32:51.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/RenderBlocks.java 2011-09-19 16:32:54.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-09-19 16:32:52.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/RenderEngine.java 2011-09-19 16:32:54.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); 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-09-19 16:32:52.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/RenderGlobal.java 2011-09-19 16:32:54.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-09-19 16:32:52.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/RenderItem.java 2011-09-19 16:32:54.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-09-19 16:32:52.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/RenderPlayer.java 2011-09-19 16:32:54.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() ); + } + 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-09-19 16:32:52.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/SlotCrafting.java 2011-09-19 16:32:54.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-09-19 16:32:52.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/Tessellator.java 2011-09-19 16:32:54.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(); - field_35836_g = 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 field_35836_g; + 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 field_35836_g; + 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(); + field_35836_g = byteBuffer.asShortBuffer(); + useVBO = tryVBO && GLContext.getCapabilities().GL_ARB_vertex_buffer_object; + vboCount = 10; + if(useVBO) + { + vertexBuffers = GLAllocation.createDirectIntBuffer(vboCount); + ARBVertexBufferObject.glGenBuffersARB(vertexBuffers); + } + } } 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-09-19 16:32:52.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/TileEntityFurnace.java 2011-09-20 20:58:51.000000000 -0400 @@ -196,7 +196,7 @@ { return false; } - ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0].getItem().shiftedIndex); + ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0]); if(itemstack == null) { return false; @@ -222,12 +222,12 @@ { 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++; } 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-09-19 16:32:52.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/TileEntity.java 2011-09-19 16:32:54.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-09-19 16:32:51.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/TileEntityRendererPiston.java 2011-09-19 16:32:54.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-09-19 16:32:51.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/World.java 2011-09-19 16:32:54.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) @@ -1684,7 +1687,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; + } } } @@ -1977,13 +1983,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 +2319,7 @@ private int func_35458_d(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 +2690,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 +3205,7 @@ public int field_27172_i; public boolean editingBlocks; private long lockTimestamp; - protected int autosavePeriod; + public int autosavePeriod; public int difficultySetting; public Random rand; public boolean isNewWorld; 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-09-19 16:32:52.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/WorldRenderer.java 2011-09-19 16:32:54.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-09-19 16:32:53.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/BlockButton.java 2011-09-19 16:32:54.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-09-19 16:32:53.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/BlockChest.java 2011-09-19 16:32:54.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/BlockDoor.java ../src_work/minecraft_server/net/minecraft/src/BlockDoor.java --- ../src_base/minecraft_server/net/minecraft/src/BlockDoor.java 2011-09-19 16:32:53.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/BlockDoor.java 2011-09-19 16:32:54.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-09-19 16:32:53.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/Block.java 2011-09-19 16:32:54.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; @@ -223,19 +224,12 @@ 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); } public final void dropBlockAsItem(World world, int i, int j, int k, int l) @@ -529,6 +523,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-09-19 16:32:53.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/BlockLadder.java 2011-09-19 16:32:54.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-09-19 16:32:53.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/BlockLever.java 2011-09-19 16:32:54.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-09-19 16:32:53.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/BlockPressurePlate.java 2011-09-19 16:32:54.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-09-19 16:32:53.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/BlockRail.java 2011-09-19 16:32:54.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-09-19 16:32:53.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/BlockRedstoneRepeater.java 2011-09-19 16:32:54.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-09-19 16:32:53.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/BlockRedstoneWire.java 2011-09-19 16:32:54.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/BlockTorch.java ../src_work/minecraft_server/net/minecraft/src/BlockTorch.java --- ../src_base/minecraft_server/net/minecraft/src/BlockTorch.java 2011-09-19 16:32:53.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/BlockTorch.java 2011-09-19 16:32:54.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; } Only in ../src_work/minecraft_server/net/minecraft/src: BlockTorch.java.orig 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-09-19 16:32:53.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/BlockTrapDoor.java 2011-09-19 16:32:54.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-09-19 16:32:53.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/Chunk.java 2011-09-19 16:32:54.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,8 +304,12 @@ } 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) { @@ -384,8 +375,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,8 +382,13 @@ } 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) { @@ -766,8 +760,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 +772,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 +784,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 +796,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 +843,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-09-19 16:32:53.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/EntityLiving.java 2011-09-19 16:32:54.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-09-19 16:32:53.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/EntityPlayer.java 2011-09-19 16:38:48.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-09-19 16:32:53.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/Explosion.java 2011-09-19 16:32:54.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-09-19 16:32:53.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/FurnaceRecipes.java 2011-09-20 21:01:46.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/ItemBucket.java ../src_work/minecraft_server/net/minecraft/src/ItemBucket.java --- ../src_base/minecraft_server/net/minecraft/src/ItemBucket.java 2011-09-19 16:32:53.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/ItemBucket.java 2011-09-19 16:32:54.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/ItemInWorldManager.java ../src_work/minecraft_server/net/minecraft/src/ItemInWorldManager.java --- ../src_base/minecraft_server/net/minecraft/src/ItemInWorldManager.java 2011-09-19 16:32:53.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/ItemInWorldManager.java 2011-09-19 16:32:54.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-09-19 16:32:53.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/Item.java 2011-09-19 16:32:54.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/ItemTool.java ../src_work/minecraft_server/net/minecraft/src/ItemTool.java --- ../src_base/minecraft_server/net/minecraft/src/ItemTool.java 2011-09-19 16:32:53.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/ItemTool.java 2011-09-19 16:32:54.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-09-19 16:32:53.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/MovingObjectPosition.java 2011-09-19 16:32:54.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-09-19 16:32:53.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/PlayerInstance.java 2011-09-19 16:32:54.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 j1 = chunkX * 16 + (blocksToUpdate[k] >> 12 & 0xf); int i2 = numBlocksToUpdate & 0xff; - int k2 = chunkZ * 16 + (numBlocksToUpdate >> 8 & 0xf); + 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-09-19 16:32:53.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/SlotCrafting.java 2011-09-19 16:32:54.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-09-19 16:32:53.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/TileEntityFurnace.java 2011-09-20 20:58:42.000000000 -0400 @@ -176,7 +176,7 @@ { return false; } - ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0].getItem().shiftedIndex); + ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0]); if(itemstack == null) { return false; @@ -204,12 +204,12 @@ { 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++; } 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-09-19 16:32:53.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/TileEntity.java 2011-09-19 16:32:54.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-09-19 16:32:53.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/World.java 2011-09-19 16:32:54.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) @@ -1372,6 +1376,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; } } @@ -1650,13 +1657,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 +1988,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 +2327,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 +2772,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;