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-03 12:18:32.126541000 +0200 +++ ../src_work/minecraft/net/minecraft/src/Block.java 2011-09-03 12:19:32.548997700 +0200 @@ -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; @@ -149,7 +150,8 @@ 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 boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) @@ -276,19 +278,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) @@ -600,6 +595,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() && renderAsNormalBlock(); + } + + /* FORGE: Return true if the block is solid on the given side. This + * is used by placement logic. */ + public boolean isBlockSolidOnSide( World world, int i, int j, int k, + int side ) { + return isBlockNormalCube(world,i,j,k); + } + + /* FORGE: Return true if the player can place a new block in the block + * occupied by this one, like water, lava, fire, etc. + */ + public boolean isBlockReplaceable( World world, int i, int j, int k ) { + return false; + } + + /* FORGE: Return true if this block should set fire and deal fire damage + * to entities coming into contact with it, false otherwise. + */ + public boolean isBlockBurning( World world, int i, int j, int k ) { + return false; + } + + /* FORGE: Return true if this block should be treated as an air block + * by the rest of the code, false otherwise. This method is primarily + * useful for creating pure logic-blocks that will be invisible + * to the player and otherwise interact as air would. + */ + public boolean isAirBlock( World world, int i, int j, int k ) { + return false; + } + + /* FORGE: Return the block hardness with metadata 'md'. + */ + public float getHardness(int md) { + return blockHardness; + } + + /* FORGE: Return the block strength of the block at i,j,k against the + * player. + */ + public float blockStrength(World world, EntityPlayer player, + int i, int j, int k) { + int md=world.getBlockMetadata(i,j,k); + return blockStrength(player,md); + } + + /* FORGE: Return the block strength of a prototypical block with metadata + * 'md' against the player. + */ + public float blockStrength(EntityPlayer player, int md) { + return ForgeHooks.blockStrength(this,player,md); + } + + /* FORGE: Return true if the player can harvest a prototypical block with + * metadata 'md'. + */ + public boolean canHarvestBlock(EntityPlayer player, int md) { + return ForgeHooks.canHarvestBlock(this,player,md); + } + static Class _mthclass$(String s) { try diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/BlockButton.java ../src_work/minecraft/net/minecraft/src/BlockButton.java --- ../src_base/minecraft/net/minecraft/src/BlockButton.java 2011-09-03 12:18:32.143542000 +0200 +++ ../src_work/minecraft/net/minecraft/src/BlockButton.java 2011-09-03 12:19:32.537997100 +0200 @@ -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-03 12:18:32.156543000 +0200 +++ ../src_work/minecraft/net/minecraft/src/BlockChest.java 2011-09-03 12:19:32.540997200 +0200 @@ -230,23 +230,23 @@ public boolean blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer) { Object obj = (TileEntityChest)world.getBlockTileEntity(i, j, k); - 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-03 12:18:32.191545000 +0200 +++ ../src_work/minecraft/net/minecraft/src/BlockDoor.java 2011-09-03 12:19:32.544997500 +0200 @@ -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; @@ -241,7 +241,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/BlockLadder.java ../src_work/minecraft/net/minecraft/src/BlockLadder.java --- ../src_base/minecraft/net/minecraft/src/BlockLadder.java 2011-09-03 12:18:32.257549000 +0200 +++ ../src_work/minecraft/net/minecraft/src/BlockLadder.java 2011-09-03 12:19:32.552997900 +0200 @@ -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-03 12:18:32.271549000 +0200 +++ ../src_work/minecraft/net/minecraft/src/BlockLever.java 2011-09-03 12:19:32.555998100 +0200 @@ -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-03 12:18:32.332553000 +0200 +++ ../src_work/minecraft/net/minecraft/src/BlockPressurePlate.java 2011-09-03 12:19:32.560998400 +0200 @@ -46,7 +46,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) @@ -56,7 +56,7 @@ public void onNeighborBlockChange(World world, int i, int j, int k, int l) { boolean flag = false; - if(!world.isBlockNormalCube(i, j - 1, k)) + if(!world.isBlockSolidOnSide(i, j - 1, k,1)) { 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-03 12:18:32.340553000 +0200 +++ ../src_work/minecraft/net/minecraft/src/BlockRail.java 2011-09-03 12:19:32.563998500 +0200 @@ -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-03 12:18:32.351554000 +0200 +++ ../src_work/minecraft/net/minecraft/src/BlockRedstoneRepeater.java 2011-09-03 12:19:32.566998700 +0200 @@ -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-03 12:18:32.364555000 +0200 +++ ../src_work/minecraft/net/minecraft/src/BlockRedstoneWire.java 2011-09-03 12:19:32.570998900 +0200 @@ -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-03 12:18:32.433559000 +0200 +++ ../src_work/minecraft/net/minecraft/src/BlockTorch.java 2011-09-03 12:19:32.574999200 +0200 @@ -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-03 12:18:32.437559000 +0200 +++ ../src_work/minecraft/net/minecraft/src/BlockTrapDoor.java 2011-09-03 12:19:32.577999300 +0200 @@ -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-03 12:18:32.476561000 +0200 +++ ../src_work/minecraft/net/minecraft/src/Chunk.java 2011-09-03 12:19:32.581999600 +0200 @@ -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.*; @@ -249,6 +250,13 @@ } int l1 = xPosition * 16 + i; int i2 = zPosition * 16 + k; + + 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 && !worldObj.multiplayerWorld) { @@ -292,6 +300,13 @@ } int k1 = xPosition * 16 + i; int l1 = zPosition * 16 + k; + + if (Block.blocksList[j1] instanceof IOverrideReplace) { + IOverrideReplace iovr = (IOverrideReplace) Block.blocksList[j1]; + if (!iovr.canReplaceBlock(worldObj, k1, j, l1, l)) + return iovr.getReplacedSuccess(); + } + blocks[i << 11 | k << 7 | j] = (byte)(byte0 & 0xff); if(j1 != 0) { 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-03 12:18:32.624570200 +0200 +++ ../src_work/minecraft/net/minecraft/src/EffectRenderer.java 2011-09-03 12:19:32.586999900 +0200 @@ -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,6 +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--); + } } @@ -93,11 +109,26 @@ for(int k = 0; k < fxLayers[i].size(); k++) { EntityFX entityfx = (EntityFX)fxLayers[i].get(k); + if(entityfx instanceof EntityDiggingFX) continue; entityfx.renderParticle(tessellator, f, f1, f5, f2, f3, f4); } 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(); + } } @@ -124,6 +155,13 @@ { fxLayers[i].clear(); } + + for (int x = 0; x < effectList.size(); x++) { + BlockTextureParticles entry = (BlockTextureParticles) effectList + .get(x); + entry.effects.clear(); + } + effectList.clear(); } @@ -145,7 +183,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); } } @@ -190,16 +233,48 @@ { d = (double)i + block.maxX + (double)f; } - addEffect((new EntityDiggingFX(worldObj, d, d1, d2, 0.0D, 0.0D, 0.0D, block, l, worldObj.getBlockMetadata(i, j, k))).func_4041_a(i, j, k).func_407_b(0.2F).func_405_d(0.6F)); + EntityDiggingFX dig_effect = new EntityDiggingFX(worldObj, d, d1, d2, + 0.0D, 0.0D, 0.0D, block, l, worldObj.getBlockMetadata(i, j, k)); + dig_effect.func_4041_a(i, j, k); + dig_effect.func_407_b(0.2F); + dig_effect.func_405_d(0.6F); + addDigParticleEffect(dig_effect, block); } public String getStatistics() { return (new StringBuilder()).append("").append(fxLayers[0].size() + fxLayers[1].size() + fxLayers[2].size()).toString(); } + + public void addDigParticleEffect(EntityDiggingFX dig_effect, Block block) { + boolean added = false; + String comp; + + if (block instanceof ITextureProvider) { + comp = ((ITextureProvider) block).getTextureFile(); + } else { + comp = "/terrain.png"; + } + for (int x = 0; x < effectList.size(); x++) { + BlockTextureParticles entry = (BlockTextureParticles) effectList + .get(x); + if (entry.texture.equals(comp)) { + entry.effects.add(dig_effect); + added = true; + } + } + if (!added) { + BlockTextureParticles entry = new BlockTextureParticles(); + entry.texture = comp; + entry.effects.add(dig_effect); + effectList.add(entry); + } + addEffect(dig_effect); + } protected World worldObj; private List fxLayers[]; + private List effectList; private RenderEngine renderer; private Random rand; } diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/EntityLiving.java ../src_work/minecraft/net/minecraft/src/EntityLiving.java --- ../src_base/minecraft/net/minecraft/src/EntityLiving.java 2011-09-03 12:18:32.813580000 +0200 +++ ../src_work/minecraft/net/minecraft/src/EntityLiving.java 2011-09-03 12:19:32.590000000 +0200 @@ -555,7 +555,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-03 12:18:32.888585000 +0200 +++ ../src_work/minecraft/net/minecraft/src/EntityPlayer.java 2011-09-03 12:19:32.594000300 +0200 @@ -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, ContainerPlayer, World, // ChunkCoordinates, DataWatcher, Container, StatList, @@ -316,6 +320,8 @@ worldObj.entityJoinedWorld(entityitem); } + /* FORGE: This isn't called anymore + */ public float getCurrentPlayerStrVsBlock(Block block) { float f = inventory.getStrVsBlock(block); @@ -330,6 +336,24 @@ 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; + } + return f; + } + public boolean canHarvestBlock(Block block) { return inventory.canHarvestBlock(block); @@ -477,6 +501,25 @@ protected void damageEntity(int i) { + boolean doRegularComputation = true; + int initialDamage = i; + + for (ItemStack stack : inventory.armorInventory) { + if (stack != null && stack.getItem() instanceof ISpecialArmor) { + ISpecialArmor armor = (ISpecialArmor) stack.getItem(); + + ArmorProperties props = armor.getProperties(this, initialDamage, i); + i = i - props.damageRemove; + doRegularComputation = doRegularComputation + && props.allowRegularComputation; + } + } + + if (!doRegularComputation) { + super.damageEntity(i); + return; + } + int j = 25 - inventory.getTotalArmorValue(); int k = i * j + damageRemainder; inventory.damageArmor(i); @@ -522,7 +565,9 @@ public void destroyCurrentEquippedItem() { + ItemStack orig=inventory.getCurrentItem(); inventory.setInventorySlotContents(inventory.currentItem, null); + ForgeHooks.onDestroyCurrentItem(this,orig); } public double getYOffset() @@ -594,6 +639,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-03 12:18:32.948588700 +0200 +++ ../src_work/minecraft/net/minecraft/src/EntityRenderer.java 2011-09-03 12:19:32.599000600 +0200 @@ -3,6 +3,7 @@ // Decompiler options: packimports(3) braces deadcode package net.minecraft.src; +import net.minecraft.src.forge.ForgeHooksClient; import java.nio.FloatBuffer; import java.util.List; @@ -573,8 +574,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*/); } GL11.glBlendFunc(770, 771); @@ -619,8 +624,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-03 12:18:33.076596000 +0200 +++ ../src_work/minecraft/net/minecraft/src/Explosion.java 2011-09-03 12:19:32.602000700 +0200 @@ -3,6 +3,7 @@ // Decompiler options: packimports(3) braces deadcode package net.minecraft.src; +import net.minecraft.src.forge.ISpecialResistance; import java.util.*; @@ -65,7 +66,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/Item.java ../src_work/minecraft/net/minecraft/src/Item.java --- ../src_base/minecraft/net/minecraft/src/Item.java 2011-09-03 12:18:33.419615000 +0200 +++ ../src_work/minecraft/net/minecraft/src/Item.java 2011-09-03 12:19:32.609001100 +0200 @@ -75,6 +75,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/ItemBucket.java ../src_work/minecraft/net/minecraft/src/ItemBucket.java --- ../src_base/minecraft/net/minecraft/src/ItemBucket.java 2011-09-03 12:18:33.448617000 +0200 +++ ../src_work/minecraft/net/minecraft/src/ItemBucket.java 2011-09-03 12:19:32.605000900 +0200 @@ -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, @@ -55,6 +57,13 @@ } if(isFull == 0) { + 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/ItemRenderer.java ../src_work/minecraft/net/minecraft/src/ItemRenderer.java --- ../src_base/minecraft/net/minecraft/src/ItemRenderer.java 2011-09-03 12:18:33.541622700 +0200 +++ ../src_work/minecraft/net/minecraft/src/ItemRenderer.java 2011-09-03 13:41:51.273476600 +0200 @@ -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; // Referenced classes of package net.minecraft.src: @@ -31,18 +35,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(), entityliving.getEntityBrightness(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-03 12:18:33.588625000 +0200 +++ ../src_work/minecraft/net/minecraft/src/ItemTool.java 2011-09-03 12:19:32.617001600 +0200 @@ -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/MetadataChunkBlock.java ../src_work/minecraft/net/minecraft/src/MetadataChunkBlock.java --- ../src_base/minecraft/net/minecraft/src/MetadataChunkBlock.java 2011-09-03 12:18:33.857640000 +0200 +++ ../src_work/minecraft/net/minecraft/src/MetadataChunkBlock.java 2011-09-03 12:19:32.621001800 +0200 @@ -95,7 +95,7 @@ } else if(blockEnum == EnumSkyBlock.Block) { - l3 = Block.lightValue[j3]; + l3 = (j3==0)?0:Block.blocksList[j3].getLightValue(world,k1,k2,l1); } if(k3 >= 15 && l3 == 0) { 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-03 12:18:34.108655000 +0200 +++ ../src_work/minecraft/net/minecraft/src/MovingObjectPosition.java 2011-09-03 12:19:32.624002000 +0200 @@ -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-03 12:18:34.468675000 +0200 +++ ../src_work/minecraft/net/minecraft/src/PlayerController.java 2011-09-03 12:19:32.628002200 +0200 @@ -3,6 +3,7 @@ // Decompiler options: packimports(3) braces deadcode package net.minecraft.src; +import net.minecraft.src.forge.*; import net.minecraft.client.Minecraft; @@ -71,6 +72,7 @@ if(itemstack1.stackSize == 0) { entityplayer.inventory.mainInventory[entityplayer.inventory.currentItem] = null; + ForgeHooks.onDestroyCurrentItem(entityplayer,itemstack1); } return true; } else @@ -98,6 +100,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)) { @@ -108,7 +116,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/PlayerControllerMP.java ../src_work/minecraft/net/minecraft/src/PlayerControllerMP.java --- ../src_base/minecraft/net/minecraft/src/PlayerControllerMP.java 2011-09-03 12:18:34.473675000 +0200 +++ ../src_work/minecraft/net/minecraft/src/PlayerControllerMP.java 2011-09-03 12:19:32.631002400 +0200 @@ -63,7 +63,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 @@ -106,7 +106,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.func_1145_d(), (float)i + 0.5F, (float)j + 0.5F, (float)k + 0.5F, (block.stepSound.getVolume() + 1.0F) / 8F, block.stepSound.getPitch() * 0.5F); 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-03 12:18:34.478676000 +0200 +++ ../src_work/minecraft/net/minecraft/src/PlayerControllerSP.java 2011-09-03 12:19:32.635002600 +0200 @@ -37,7 +37,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); @@ -62,7 +62,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); } @@ -89,7 +89,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.func_1145_d(), (float)i + 0.5F, (float)j + 0.5F, (float)k + 0.5F, (block.stepSound.getVolume() + 1.0F) / 8F, block.stepSound.getPitch() * 0.5F); 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-03 12:18:34.797694500 +0200 +++ ../src_work/minecraft/net/minecraft/src/RenderBlocks.java 2011-09-03 12:19:32.641003000 +0200 @@ -2171,7 +2171,7 @@ colorBlueTopRight *= f27; 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) { colorRedTopLeft *= f; colorRedBottomLeft *= f; @@ -2256,7 +2256,7 @@ colorBlueTopRight *= f28; int j1 = block.getBlockTexture(blockAccess, i, j, k, 3); renderWestFace(block, i, j, k, block.getBlockTexture(blockAccess, i, j, k, 3)); - if(cfgGrassFix && j1 == 3 && overrideBlockTexture < 0) + if(Tessellator.instance.defaultTexture && cfgGrassFix && j1 == 3 && overrideBlockTexture < 0) { colorRedTopLeft *= f; colorRedBottomLeft *= f; @@ -2341,7 +2341,7 @@ colorBlueTopRight *= f29; 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) { colorRedTopLeft *= f; colorRedBottomLeft *= f; @@ -2426,7 +2426,7 @@ colorBlueTopRight *= f30; 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) { colorRedTopLeft *= f; colorRedBottomLeft *= f; @@ -2510,7 +2510,7 @@ tessellator.setColorOpaque_F(f11 * f22, f14 * f22, f17 * f22); int l = block.getBlockTexture(blockAccess, i, j, k, 2); renderEastFace(block, i, j, k, l); - if(cfgGrassFix && l == 3 && overrideBlockTexture < 0) + if(Tessellator.instance.defaultTexture && cfgGrassFix && l == 3 && overrideBlockTexture < 0) { tessellator.setColorOpaque_F(f11 * f22 * f, f14 * f22 * f1, f17 * f22 * f2); renderEastFace(block, i, j, k, 38); @@ -2527,7 +2527,7 @@ tessellator.setColorOpaque_F(f11 * f23, f14 * f23, f17 * f23); int i1 = block.getBlockTexture(blockAccess, i, j, k, 3); renderWestFace(block, i, j, k, i1); - if(cfgGrassFix && i1 == 3 && overrideBlockTexture < 0) + if(Tessellator.instance.defaultTexture && cfgGrassFix && i1 == 3 && overrideBlockTexture < 0) { tessellator.setColorOpaque_F(f11 * f23 * f, f14 * f23 * f1, f17 * f23 * f2); renderWestFace(block, i, j, k, 38); @@ -2544,7 +2544,7 @@ tessellator.setColorOpaque_F(f12 * f24, f15 * f24, f18 * f24); int j1 = block.getBlockTexture(blockAccess, i, j, k, 4); renderNorthFace(block, i, j, k, j1); - if(cfgGrassFix && j1 == 3 && overrideBlockTexture < 0) + if(Tessellator.instance.defaultTexture && cfgGrassFix && j1 == 3 && overrideBlockTexture < 0) { tessellator.setColorOpaque_F(f12 * f24 * f, f15 * f24 * f1, f18 * f24 * f2); renderNorthFace(block, i, j, k, 38); @@ -2561,7 +2561,7 @@ tessellator.setColorOpaque_F(f12 * f25, f15 * f25, f18 * f25); int k1 = block.getBlockTexture(blockAccess, i, j, k, 5); renderSouthFace(block, i, j, k, k1); - if(cfgGrassFix && k1 == 3 && overrideBlockTexture < 0) + if(Tessellator.instance.defaultTexture && cfgGrassFix && k1 == 3 && overrideBlockTexture < 0) { tessellator.setColorOpaque_F(f12 * f25 * f, f15 * f25 * f1, f18 * f25 * 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-03 12:18:34.822695900 +0200 +++ ../src_work/minecraft/net/minecraft/src/RenderEngine.java 2011-09-03 12:19:32.646003200 +0200 @@ -126,6 +126,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-03 12:18:34.911701000 +0200 +++ ../src_work/minecraft/net/minecraft/src/RenderGlobal.java 2011-09-03 12:19:32.651003500 +0200 @@ -1558,8 +1558,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[]; @@ -1567,8 +1567,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-03 12:18:34.923701700 +0200 +++ ../src_work/minecraft/net/minecraft/src/RenderItem.java 2011-09-03 13:45:05.006557500 +0200 @@ -5,6 +5,11 @@ package net.minecraft.src; import java.util.Random; + +import net.minecraft.src.forge.ForgeHooksClient; +import net.minecraft.src.forge.ICustomItemRenderer; +import net.minecraft.src.forge.MinecraftForgeClient; + import org.lwjgl.opengl.GL11; // Referenced classes of package net.minecraft.src: @@ -47,10 +52,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; if(!Block.blocksList[itemstack.itemID].renderAsNormalBlock() && itemstack.itemID != Block.stairSingle.blockID && Block.blocksList[itemstack.itemID].getRenderType() != 16) { @@ -78,10 +109,12 @@ 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 f6 = (float)((i % 16) * 16 + 0) / 256F; float f8 = (float)((i % 16) * 16 + 16) / 256F; @@ -92,6 +125,7 @@ float f14 = 0.25F; if(field_27004_a) { + int k = Item.itemsList[itemstack.itemID].getColorFromDamage(itemstack.getItemDamage()); float f15 = (float)(k >> 16 & 0xff) / 255F; float f17 = (float)(k >> 8 & 0xff) / 255F; @@ -127,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); @@ -152,16 +213,17 @@ renderBlocks.renderBlockOnInventory(block, j, 1.0F); renderBlocks.useInventoryTint = true; GL11.glPopMatrix(); - } else - if(k >= 0) + } else if(k >= 0) { GL11.glDisable(2896 /*GL_LIGHTING*/); 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-03 12:18:34.964704100 +0200 +++ ../src_work/minecraft/net/minecraft/src/RenderPlayer.java 2011-09-03 12:19:32.658003900 +0200 @@ -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-03 12:18:35.048708000 +0200 +++ ../src_work/minecraft/net/minecraft/src/SlotCrafting.java 2011-09-03 12:19:32.662004200 +0200 @@ -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); + 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-03 12:18:35.156715000 +0200 +++ ../src_work/minecraft/net/minecraft/src/Tessellator.java 2011-09-03 12:19:32.666004400 +0200 @@ -6,6 +6,7 @@ import java.io.PrintStream; import java.nio.*; +import java.util.*; import org.lwjgl.opengl.*; // Referenced classes of package net.minecraft.src: @@ -13,9 +14,7 @@ public class Tessellator { - - private Tessellator(int i) - { + public Tessellator() { vertexCount = 0; hasColor = false; hasTexture = false; @@ -24,20 +23,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(); - 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() @@ -47,12 +36,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; @@ -106,10 +103,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) @@ -125,6 +122,10 @@ GL11.glDisableClientState(32885 /*GL_NORMAL_ARRAY_EXT*/); } } + if(rawBufferSize>0x20000 && rawBufferIndex<(rawBufferSize<<3)) { + rawBufferSize=0; + rawBuffer=null; + } reset(); } @@ -237,6 +238,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) { @@ -278,11 +288,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) @@ -335,9 +340,7 @@ private static boolean convertQuadsToTriangles = true; private static boolean tryVBO = false; - private ByteBuffer byteBuffer; - private IntBuffer intBuffer; - private FloatBuffer floatBuffer; + private static boolean useVBO = false; private int rawBuffer[]; private int vertexCount; private double textureU; @@ -350,16 +353,43 @@ private int addedVertices; private boolean isColorDisabled; private int drawMode; - private double xOffset; - private double yOffset; - private double zOffset; + 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; 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; + public static Tessellator instance; + public static Tessellator firstInstance; + + static { + instance=new Tessellator(); + firstInstance=instance; + firstInstance.defaultTexture=true; + + nativeBufferSize = 0x200000; + trivertsInBuffer = (nativeBufferSize/48)*6; + byteBuffer = GLAllocation.createDirectByteBuffer(nativeBufferSize * 4); + intBuffer = byteBuffer.asIntBuffer(); + floatBuffer = byteBuffer.asFloatBuffer(); + 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/TileEntityRendererPiston.java ../src_work/minecraft/net/minecraft/src/TileEntityRendererPiston.java --- ../src_base/minecraft/net/minecraft/src/TileEntityRendererPiston.java 2011-09-03 12:18:35.289722600 +0200 +++ ../src_work/minecraft/net/minecraft/src/TileEntityRendererPiston.java 2011-09-03 12:19:32.669004600 +0200 @@ -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-03 12:18:35.412729000 +0200 +++ ../src_work/minecraft/net/minecraft/src/World.java 2011-09-03 12:19:32.675004900 +0200 @@ -313,7 +313,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) @@ -711,9 +715,10 @@ if(enumskyblock == EnumSkyBlock.Block) { int i1 = getBlockId(i, j, k); - if(Block.lightValue[i1] > l) + int bl=(i1==0)?0:Block.blocksList[i1].getLightValue(this,i,j,k); + if(bl > l) { - l = Block.lightValue[i1]; + l = bl; } } if(getSavedLightValue(enumskyblock, i, j, k) != l) @@ -1607,7 +1612,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; + } } } @@ -1895,13 +1903,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) @@ -2425,6 +2438,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); } @@ -2913,7 +2927,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-03 12:18:35.529736400 +0200 +++ ../src_work/minecraft/net/minecraft/src/WorldRenderer.java 2011-09-03 12:19:32.679005100 +0200 @@ -5,6 +5,9 @@ package net.minecraft.src; import java.util.*; + +import net.minecraft.src.forge.ForgeHooksClient; + import org.lwjgl.opengl.GL11; // Referenced classes of package net.minecraft.src: @@ -125,8 +128,10 @@ 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]) { @@ -136,17 +141,17 @@ tileEntityRenderers.add(tileentity); } } + Block block = Block.blocksList[i3]; int j3 = block.getRenderBlockPass(); - 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); } } @@ -155,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; @@ -251,7 +257,6 @@ public World worldObj; private int glRenderList; - private static Tessellator tessellator; public static int chunksUpdated = 0; public int posX; public int posY; @@ -282,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/Block.java ../src_work/minecraft_server/net/minecraft/src/Block.java --- ../src_base/minecraft_server/net/minecraft/src/Block.java 2011-09-03 12:18:49.774551000 +0200 +++ ../src_work/minecraft_server/net/minecraft/src/Block.java 2011-09-03 12:19:32.695006000 +0200 @@ -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; @@ -221,19 +222,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) @@ -526,6 +520,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/BlockButton.java ../src_work/minecraft_server/net/minecraft/src/BlockButton.java --- ../src_base/minecraft_server/net/minecraft/src/BlockButton.java 2011-09-03 12:18:49.789551000 +0200 +++ ../src_work/minecraft_server/net/minecraft/src/BlockButton.java 2011-09-03 12:19:32.683005400 +0200 @@ -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-03 12:18:49.800552000 +0200 +++ ../src_work/minecraft_server/net/minecraft/src/BlockChest.java 2011-09-03 12:19:32.687005600 +0200 @@ -140,23 +140,23 @@ public boolean blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer) { Object obj = (TileEntityChest)world.getBlockTileEntity(i, j, k); - 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-03 12:18:49.831554000 +0200 +++ ../src_work/minecraft_server/net/minecraft/src/BlockDoor.java 2011-09-03 12:19:32.690005800 +0200 @@ -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; @@ -230,7 +230,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/BlockLadder.java ../src_work/minecraft_server/net/minecraft/src/BlockLadder.java --- ../src_base/minecraft_server/net/minecraft/src/BlockLadder.java 2011-09-03 12:18:49.880557000 +0200 +++ ../src_work/minecraft_server/net/minecraft/src/BlockLadder.java 2011-09-03 12:19:32.699006300 +0200 @@ -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-03 12:18:49.891557000 +0200 +++ ../src_work/minecraft_server/net/minecraft/src/BlockLever.java 2011-09-03 12:19:32.703006500 +0200 @@ -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-03 12:18:49.942560000 +0200 +++ ../src_work/minecraft_server/net/minecraft/src/BlockPressurePlate.java 2011-09-03 12:19:32.706006700 +0200 @@ -46,7 +46,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) @@ -56,7 +56,7 @@ public void onNeighborBlockChange(World world, int i, int j, int k, int l) { boolean flag = false; - if(!world.isBlockNormalCube(i, j - 1, k)) + if(!world.isBlockSolidOnSide(i, j - 1, k,1)) { 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-03 12:18:49.950561000 +0200 +++ ../src_work/minecraft_server/net/minecraft/src/BlockRail.java 2011-09-03 12:19:32.710006900 +0200 @@ -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[i] 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-03 12:18:49.958561000 +0200 +++ ../src_work/minecraft_server/net/minecraft/src/BlockRedstoneRepeater.java 2011-09-03 12:19:32.713007100 +0200 @@ -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-03 12:18:49.967562000 +0200 +++ ../src_work/minecraft_server/net/minecraft/src/BlockRedstoneWire.java 2011-09-03 12:19:32.717007300 +0200 @@ -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-03 12:18:50.020565000 +0200 +++ ../src_work/minecraft_server/net/minecraft/src/BlockTorch.java 2011-09-03 12:19:32.721007500 +0200 @@ -36,24 +36,24 @@ private boolean func_31028_g(World world, int i, int j, int k) { - return world.isBlockNormalCube(i, j, k) || world.getBlockId(i, j, k) == Block.fence.blockID; + return world.isBlockSolidOnSide(i, j, k,1) || world.getBlockId(i, j, k) == Block.fence.blockID; } public boolean canPlaceBlockAt(World world, int i, int j, int k) { - if(world.isBlockNormalCube(i - 1, j, k)) + if(world.isBlockSolidOnSide(i - 1, j, k,5)) { return true; } - if(world.isBlockNormalCube(i + 1, j, k)) + if(world.isBlockSolidOnSide(i + 1, j, k,4)) { return true; } - if(world.isBlockNormalCube(i, j, k - 1)) + if(world.isBlockSolidOnSide(i, j, k - 1,3)) { return true; } - if(world.isBlockNormalCube(i, j, k + 1)) + if(world.isBlockSolidOnSide(i, j, k + 1,2)) { return true; } @@ -67,19 +67,19 @@ { i1 = 5; } - if(l == 2 && world.isBlockNormalCube(i, j, k + 1)) + if(l == 2 && world.isBlockSolidOnSide(i, j, k + 1,2)) { i1 = 4; } - if(l == 3 && world.isBlockNormalCube(i, j, k - 1)) + if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3)) { i1 = 3; } - if(l == 4 && world.isBlockNormalCube(i + 1, j, k)) + if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4)) { i1 = 2; } - if(l == 5 && world.isBlockNormalCube(i - 1, j, k)) + if(l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5)) { i1 = 1; } @@ -97,19 +97,19 @@ public void onBlockAdded(World world, int i, int j, int k) { - if(world.isBlockNormalCube(i - 1, j, k)) + if(world.isBlockSolidOnSide(i - 1, j, k,5)) { world.setBlockMetadataWithNotify(i, j, k, 1); } else - if(world.isBlockNormalCube(i + 1, j, k)) + if(world.isBlockSolidOnSide(i + 1, j, k,4)) { world.setBlockMetadataWithNotify(i, j, k, 2); } else - if(world.isBlockNormalCube(i, j, k - 1)) + if(world.isBlockSolidOnSide(i, j, k - 1,3)) { world.setBlockMetadataWithNotify(i, j, k, 3); } else - if(world.isBlockNormalCube(i, j, k + 1)) + if(world.isBlockSolidOnSide(i, j, k + 1,2)) { world.setBlockMetadataWithNotify(i, j, k, 4); } else @@ -126,19 +126,19 @@ { int i1 = world.getBlockMetadata(i, j, k); boolean flag = false; - if(!world.isBlockNormalCube(i - 1, j, k) && i1 == 1) + if(!world.isBlockSolidOnSide(i - 1, j, k,5) && i1 == 1) { flag = true; } - if(!world.isBlockNormalCube(i + 1, j, k) && i1 == 2) + if(!world.isBlockSolidOnSide(i + 1, j, k,4) && i1 == 2) { flag = true; } - if(!world.isBlockNormalCube(i, j, k - 1) && i1 == 3) + if(!world.isBlockSolidOnSide(i, j, k - 1,3) && i1 == 3) { flag = true; } - if(!world.isBlockNormalCube(i, j, k + 1) && i1 == 4) + if(!world.isBlockSolidOnSide(i, j, k + 1,2) && i1 == 4) { flag = true; } diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/BlockTrapDoor.java ../src_work/minecraft_server/net/minecraft/src/BlockTrapDoor.java --- ../src_base/minecraft_server/net/minecraft/src/BlockTrapDoor.java 2011-09-03 12:18:50.024565000 +0200 +++ ../src_work/minecraft_server/net/minecraft/src/BlockTrapDoor.java 2011-09-03 12:19:32.725007800 +0200 @@ -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-03 12:18:50.043566000 +0200 +++ ../src_work/minecraft_server/net/minecraft/src/Chunk.java 2011-09-03 12:19:32.729008000 +0200 @@ -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.*; @@ -227,6 +228,13 @@ } int l1 = xPosition * 16 + i; int i2 = zPosition * 16 + k; + + 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 && !worldObj.singleplayerWorld) { @@ -270,6 +278,13 @@ } int k1 = xPosition * 16 + i; int l1 = zPosition * 16 + k; + + if(Block.blocksList[j1] instanceof IOverrideReplace) { + IOverrideReplace iovr=(IOverrideReplace)Block.blocksList[j1]; + if(!iovr.canReplaceBlock(worldObj,k1,j,l1,l)) + return iovr.getReplacedSuccess(); + } + blocks[i << 11 | k << 7 | j] = (byte)(byte0 & 0xff); if(j1 != 0) { 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-03 12:18:50.299581000 +0200 +++ ../src_work/minecraft_server/net/minecraft/src/EntityLiving.java 2011-09-03 12:19:32.734008300 +0200 @@ -532,7 +532,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-03 12:18:50.351584000 +0200 +++ ../src_work/minecraft_server/net/minecraft/src/EntityPlayer.java 2011-09-03 12:19:32.738008500 +0200 @@ -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, ContainerPlayer, World, // ChunkCoordinates, DataWatcher, Container, StatList, @@ -296,6 +300,8 @@ worldObj.entityJoinedWorld(entityitem); } + /* FORGE: This isn't called anymore + */ public float getCurrentPlayerStrVsBlock(Block block) { float f = inventory.getStrVsBlock(block); @@ -310,6 +316,24 @@ 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; + } + return f; + } + public boolean canHarvestBlock(Block block) { return inventory.canHarvestBlock(block); @@ -457,6 +481,25 @@ protected void damageEntity(int i) { + boolean doRegularComputation = true; + int initialDamage = i; + + for (ItemStack stack : inventory.armorInventory) { + if (stack != null && stack.getItem() instanceof ISpecialArmor) { + ISpecialArmor armor = (ISpecialArmor) stack.getItem(); + + ArmorProperties props = armor.getProperties(this, initialDamage, i); + i = i - props.damageRemove; + doRegularComputation = doRegularComputation + && props.allowRegularComputation; + } + } + + if (!doRegularComputation) { + super.damageEntity(i); + return; + } + int j = 25 - inventory.getTotalArmorValue(); int k = i * j + damageRemainder; inventory.damageArmor(i); @@ -502,7 +545,9 @@ public void destroyCurrentEquippedItem() { + ItemStack orig=inventory.getCurrentItem(); inventory.setInventorySlotContents(inventory.currentItem, null); + ForgeHooks.onDestroyCurrentItem(this,orig); } public double getYOffset() @@ -568,6 +613,10 @@ public EnumStatus goToSleep(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-03 12:18:50.455590000 +0200 +++ ../src_work/minecraft_server/net/minecraft/src/Explosion.java 2011-09-03 12:19:32.742008700 +0200 @@ -3,6 +3,7 @@ // Decompiler options: packimports(3) braces deadcode package net.minecraft.src; +import net.minecraft.src.forge.ISpecialResistance; import java.util.*; @@ -65,7 +66,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/Item.java ../src_work/minecraft_server/net/minecraft/src/Item.java --- ../src_base/minecraft_server/net/minecraft/src/Item.java 2011-09-03 12:18:50.545595000 +0200 +++ ../src_work/minecraft_server/net/minecraft/src/Item.java 2011-09-03 12:19:32.761009800 +0200 @@ -65,6 +65,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/ItemBucket.java ../src_work/minecraft_server/net/minecraft/src/ItemBucket.java --- ../src_base/minecraft_server/net/minecraft/src/ItemBucket.java 2011-09-03 12:18:50.570596000 +0200 +++ ../src_work/minecraft_server/net/minecraft/src/ItemBucket.java 2011-09-03 12:19:32.750009200 +0200 @@ -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, @@ -55,6 +57,13 @@ } if(isFull == 0) { + 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_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-03 12:18:50.609598000 +0200 +++ ../src_work/minecraft_server/net/minecraft/src/ItemInWorldManager.java 2011-09-03 12:19:32.756009500 +0200 @@ -3,6 +3,7 @@ // Decompiler options: packimports(3) braces deadcode package net.minecraft.src; +import net.minecraft.src.forge.*; // Referenced classes of package net.minecraft.src: @@ -29,7 +30,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; @@ -51,7 +53,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 @@ -71,7 +73,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); @@ -117,7 +119,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); ((EntityPlayerMP)thisPlayer).playerNetServerHandler.sendPacket(new Packet53BlockChange(i, j, k, thisWorld)); @@ -135,6 +137,7 @@ if(itemstack1.stackSize == 0) { entityplayer.inventory.mainInventory[entityplayer.inventory.currentItem] = null; + ForgeHooks.onDestroyCurrentItem(entityplayer,itemstack1); } return true; } else @@ -145,6 +148,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)) { @@ -155,7 +163,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_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-03 12:18:50.690603000 +0200 +++ ../src_work/minecraft_server/net/minecraft/src/ItemTool.java 2011-09-03 12:19:32.765010000 +0200 @@ -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/MetadataChunkBlock.java ../src_work/minecraft_server/net/minecraft/src/MetadataChunkBlock.java --- ../src_base/minecraft_server/net/minecraft/src/MetadataChunkBlock.java 2011-09-03 12:18:50.764607000 +0200 +++ ../src_work/minecraft_server/net/minecraft/src/MetadataChunkBlock.java 2011-09-03 12:19:32.769010300 +0200 @@ -95,7 +95,7 @@ } else if(blockEnum == EnumSkyBlock.Block) { - l3 = Block.lightValue[j3]; + l3 = (j3==0)?0:Block.blocksList[j3].getLightValue(world,k1,k2,l1); } if(k3 >= 15 && l3 == 0) { Seulement dans ../src_work/minecraft_server/net/minecraft/src: MetadataChunk~ 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-03 12:18:50.790609000 +0200 +++ ../src_work/minecraft_server/net/minecraft/src/MovingObjectPosition.java 2011-09-03 12:19:32.775010600 +0200 @@ -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-03 12:18:51.186631000 +0200 +++ ../src_work/minecraft_server/net/minecraft/src/PlayerInstance.java 2011-09-03 12:19:32.778010800 +0200 @@ -169,12 +169,11 @@ sendPacketToPlayersInInstance(new Packet52MultiBlockChange(chunkX, chunkZ, blocksToUpdate, numBlocksToUpdate, worldserver)); for(int k = 0; k < numBlocksToUpdate; k++) { - int j1 = chunkX * 16 + (numBlocksToUpdate >> 12 & 0xf); - int i2 = numBlocksToUpdate & 0xff; - int k2 = chunkZ * 16 + (numBlocksToUpdate >> 8 & 0xf); + int j1 = chunkX * 16 + (blocksToUpdate[k] >> 12 & 0xf); + int i2 = blocksToUpdate[k] & 0xff; + int k2 = chunkZ * 16 + (blocksToUpdate[k] >> 8 & 0xf); if(Block.isBlockContainer[worldserver.getBlockId(j1, i2, k2)]) { - System.out.println("Sending!"); updateTileEntity(worldserver.getBlockTileEntity(j1, i2, k2)); } } diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/SlotCrafting.java ../src_work/minecraft_server/net/minecraft/src/SlotCrafting.java --- ../src_base/minecraft_server/net/minecraft/src/SlotCrafting.java 2011-09-03 12:18:51.308638000 +0200 +++ ../src_work/minecraft_server/net/minecraft/src/SlotCrafting.java 2011-09-03 12:19:32.782011000 +0200 @@ -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); + 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/World.java ../src_work/minecraft_server/net/minecraft/src/World.java --- ../src_base/minecraft_server/net/minecraft/src/World.java 2011-09-03 12:18:51.499649000 +0200 +++ ../src_work/minecraft_server/net/minecraft/src/World.java 2011-09-03 12:19:32.788011400 +0200 @@ -166,7 +166,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) @@ -564,9 +568,10 @@ if(enumskyblock == EnumSkyBlock.Block) { int i1 = getBlockId(i, j, k); - if(Block.lightValue[i1] > l) + int bl=(i1==0)?0:Block.blocksList[i1].getLightValue(this,i,j,k); + if(bl > l) { - l = Block.lightValue[i1]; + l = bl; } } if(getSavedLightValue(enumskyblock, i, j, k) != l) @@ -1408,7 +1413,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; + } } } @@ -1681,13 +1689,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 boolean updatingLighting() @@ -2178,6 +2191,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); } @@ -2601,7 +2615,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; Seulement dans ../src_work/minecraft_server/net/minecraft/src: World.java~