ForgePatch/forge/minecraft.patch
Eloraam 622f536f80 Improved BTW compatibility.
Finished the placement hook changes.
Added a sleep handler.
Added a current item destroyed handler.
2011-08-18 00:14:09 +00:00

3020 lines
116 KiB
Diff

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-08-11 17:02:11.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/BlockButton.java 2011-08-11 21:40:22.000000000 -0400
@@ -41,36 +41,36 @@
public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l)
{
- if(l == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if(l == 2 && world.isBlockSolidOnSide(i, j, k + 1,2))
{
return true;
}
- if(l == 3 && world.isBlockNormalCube(i, j, k - 1))
+ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3))
{
return true;
}
- if(l == 4 && world.isBlockNormalCube(i + 1, j, k))
+ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4))
{
return true;
}
- return l == 5 && world.isBlockNormalCube(i - 1, j, k);
+ return l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5);
}
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- if(world.isBlockNormalCube(i - 1, j, k))
+ if(world.isBlockSolidOnSide(i - 1, j, k,5))
{
return true;
}
- if(world.isBlockNormalCube(i + 1, j, k))
+ if(world.isBlockSolidOnSide(i + 1, j, k,4))
{
return true;
}
- if(world.isBlockNormalCube(i, j, k - 1))
+ if(world.isBlockSolidOnSide(i, j, k - 1,3))
{
return true;
}
- return world.isBlockNormalCube(i, j, k + 1);
+ return world.isBlockSolidOnSide(i, j, k + 1,2);
}
public void onBlockPlaced(World world, int i, int j, int k, int l)
@@ -78,19 +78,19 @@
int i1 = world.getBlockMetadata(i, j, k);
int j1 = i1 & 8;
i1 &= 7;
- if(l == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if(l == 2 && world.isBlockSolidOnSide(i, j, k + 1,2))
{
i1 = 4;
} else
- if(l == 3 && world.isBlockNormalCube(i, j, k - 1))
+ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3))
{
i1 = 3;
} else
- if(l == 4 && world.isBlockNormalCube(i + 1, j, k))
+ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4))
{
i1 = 2;
} else
- if(l == 5 && world.isBlockNormalCube(i - 1, j, k))
+ if(l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5))
{
i1 = 1;
} else
@@ -102,19 +102,19 @@
private int getOrientation(World world, int i, int j, int k)
{
- if(world.isBlockNormalCube(i - 1, j, k))
+ if(world.isBlockSolidOnSide(i - 1, j, k,5))
{
return 1;
}
- if(world.isBlockNormalCube(i + 1, j, k))
+ if(world.isBlockSolidOnSide(i + 1, j, k,4))
{
return 2;
}
- if(world.isBlockNormalCube(i, j, k - 1))
+ if(world.isBlockSolidOnSide(i, j, k - 1,3))
{
return 3;
}
- return !world.isBlockNormalCube(i, j, k + 1) ? 1 : 4;
+ return !world.isBlockSolidOnSide(i, j, k + 1,2) ? 1 : 4;
}
public void onNeighborBlockChange(World world, int i, int j, int k, int l)
@@ -123,19 +123,19 @@
{
int i1 = world.getBlockMetadata(i, j, k) & 7;
boolean flag = false;
- if(!world.isBlockNormalCube(i - 1, j, k) && i1 == 1)
+ if(!world.isBlockSolidOnSide(i - 1, j, k,5) && i1 == 1)
{
flag = true;
}
- if(!world.isBlockNormalCube(i + 1, j, k) && i1 == 2)
+ if(!world.isBlockSolidOnSide(i + 1, j, k,4) && i1 == 2)
{
flag = true;
}
- if(!world.isBlockNormalCube(i, j, k - 1) && i1 == 3)
+ if(!world.isBlockSolidOnSide(i, j, k - 1,3) && i1 == 3)
{
flag = true;
}
- if(!world.isBlockNormalCube(i, j, k + 1) && i1 == 4)
+ if(!world.isBlockSolidOnSide(i, j, k + 1,2) && i1 == 4)
{
flag = true;
}
diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/BlockChest.java ../src_work/minecraft/net/minecraft/src/BlockChest.java
--- ../src_base/minecraft/net/minecraft/src/BlockChest.java 2011-08-11 17:02:11.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/BlockChest.java 2011-08-11 22:00:30.000000000 -0400
@@ -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-08-11 17:02:11.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/BlockDoor.java 2011-08-11 22:01:46.000000000 -0400
@@ -178,7 +178,7 @@
world.setBlockWithNotify(i, j, k, 0);
flag = true;
}
- if(!world.isBlockNormalCube(i, j - 1, k))
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1))
{
world.setBlockWithNotify(i, j, k, 0);
flag = true;
@@ -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/Block.java ../src_work/minecraft/net/minecraft/src/Block.java
--- ../src_base/minecraft/net/minecraft/src/Block.java 2011-08-11 17:02:11.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/Block.java 2011-08-17 17:54:54.000000000 -0400
@@ -3,6 +3,7 @@
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
+import net.minecraft.src.forge.ForgeHooks;
import java.util.ArrayList;
import java.util.Random;
@@ -276,19 +277,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 +594,80 @@
return blockMaterial.getMaterialMobility();
}
+ /* FORGE: Implement and return true if you wish this block to behave
+ * like a ladder when the player is inside.
+ */
+ public boolean isLadder() {
+ return false;
+ }
+
+ /* FORGE: Return true if the block is a normal, solid cube. This
+ * determines indirect power state, entity ejection from blocks, and a few
+ * others.
+ */
+ public boolean isBlockNormalCube(World world, int i, int j, int k) {
+ return blockMaterial.getIsOpaque() && renderAsNormalBlock();
+ }
+
+ /* FORGE: Return true if the block is solid on the given side. This
+ * is used by placement logic. */
+ public boolean isBlockSolidOnSide( World world, int i, int j, int k,
+ int side ) {
+ return isBlockNormalCube(world,i,j,k);
+ }
+
+ /* FORGE: Return true if the player can place a new block in the block
+ * occupied by this one, like water, lava, fire, etc.
+ */
+ public boolean isBlockReplaceable( World world, int i, int j, int k ) {
+ return false;
+ }
+
+ /* FORGE: Return true if this block should set fire and deal fire damage
+ * to entities coming into contact with it, false otherwise.
+ */
+ public boolean isBlockBurning( World world, int i, int j, int k ) {
+ return false;
+ }
+
+ /* FORGE: Return true if this block should be treated as an air block
+ * by the rest of the code, false otherwise. This method is primarily
+ * useful for creating pure logic-blocks that will be invisible
+ * to the player and otherwise interact as air would.
+ */
+ public boolean isAirBlock( World world, int i, int j, int k ) {
+ return false;
+ }
+
+ /* FORGE: Return the block hardness with metadata 'md'.
+ */
+ public float getHardness(int md) {
+ return blockHardness;
+ }
+
+ /* FORGE: Return the block strength of the block at i,j,k against the
+ * player.
+ */
+ public float blockStrength(World world, EntityPlayer player,
+ int i, int j, int k) {
+ int md=world.getBlockMetadata(i,j,k);
+ return blockStrength(player,md);
+ }
+
+ /* FORGE: Return the block strength of a prototypical block with metadata
+ * 'md' against the player.
+ */
+ public float blockStrength(EntityPlayer player, int md) {
+ return ForgeHooks.blockStrength(this,player,md);
+ }
+
+ /* FORGE: Return true if the player can harvest a prototypical block with
+ * metadata 'md'.
+ */
+ public boolean canHarvestBlock(EntityPlayer player, int md) {
+ return ForgeHooks.canHarvestBlock(this,player,md);
+ }
+
static Class _mthclass$(String s)
{
try
diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/BlockLadder.java ../src_work/minecraft/net/minecraft/src/BlockLadder.java
--- ../src_base/minecraft/net/minecraft/src/BlockLadder.java 2011-08-11 17:02:11.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/BlockLadder.java 2011-08-11 22:07:59.000000000 -0400
@@ -63,6 +63,11 @@
return super.getSelectedBoundingBoxFromPool(world, i, j, k);
}
+ /* FORGE: Implemented base method, see Block.isLadder */
+ public boolean isLadder() {
+ return true;
+ }
+
public boolean isOpaqueCube()
{
return false;
@@ -80,37 +85,37 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- if(world.isBlockNormalCube(i - 1, j, k))
+ if(world.isBlockSolidOnSide(i - 1, j, k,5))
{
return true;
}
- if(world.isBlockNormalCube(i + 1, j, k))
+ if(world.isBlockSolidOnSide(i + 1, j, k,4))
{
return true;
}
- if(world.isBlockNormalCube(i, j, k - 1))
+ if(world.isBlockSolidOnSide(i, j, k - 1,3))
{
return true;
}
- return world.isBlockNormalCube(i, j, k + 1);
+ return world.isBlockSolidOnSide(i, j, k + 1,2);
}
public void onBlockPlaced(World world, int i, int j, int k, int l)
{
int i1 = world.getBlockMetadata(i, j, k);
- if((i1 == 0 || l == 2) && world.isBlockNormalCube(i, j, k + 1))
+ if((i1 == 0 || l == 2) && world.isBlockSolidOnSide(i, j, k + 1,2))
{
i1 = 2;
}
- if((i1 == 0 || l == 3) && world.isBlockNormalCube(i, j, k - 1))
+ if((i1 == 0 || l == 3) && world.isBlockSolidOnSide(i, j, k - 1,3))
{
i1 = 3;
}
- if((i1 == 0 || l == 4) && world.isBlockNormalCube(i + 1, j, k))
+ if((i1 == 0 || l == 4) && world.isBlockSolidOnSide(i + 1, j, k,4))
{
i1 = 4;
}
- if((i1 == 0 || l == 5) && world.isBlockNormalCube(i - 1, j, k))
+ if((i1 == 0 || l == 5) && world.isBlockSolidOnSide(i - 1, j, k,5))
{
i1 = 5;
}
@@ -121,19 +126,19 @@
{
int i1 = world.getBlockMetadata(i, j, k);
boolean flag = false;
- if(i1 == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if(i1 == 2 && world.isBlockSolidOnSide(i, j, k + 1,2))
{
flag = true;
}
- if(i1 == 3 && world.isBlockNormalCube(i, j, k - 1))
+ if(i1 == 3 && world.isBlockSolidOnSide(i, j, k - 1,3))
{
flag = true;
}
- if(i1 == 4 && world.isBlockNormalCube(i + 1, j, k))
+ if(i1 == 4 && world.isBlockSolidOnSide(i + 1, j, k,4))
{
flag = true;
}
- if(i1 == 5 && world.isBlockNormalCube(i - 1, j, k))
+ if(i1 == 5 && world.isBlockSolidOnSide(i - 1, j, k,5))
{
flag = true;
}
diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/BlockLever.java ../src_work/minecraft/net/minecraft/src/BlockLever.java
--- ../src_base/minecraft/net/minecraft/src/BlockLever.java 2011-08-11 17:02:11.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/BlockLever.java 2011-08-11 22:12:11.000000000 -0400
@@ -40,44 +40,44 @@
public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l)
{
- if(l == 1 && world.isBlockNormalCube(i, j - 1, k))
+ if(l == 1 && world.isBlockSolidOnSide(i, j - 1, k,1))
{
return true;
}
- if(l == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if(l == 2 && world.isBlockSolidOnSide(i, j, k + 1,2))
{
return true;
}
- if(l == 3 && world.isBlockNormalCube(i, j, k - 1))
+ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3))
{
return true;
}
- if(l == 4 && world.isBlockNormalCube(i + 1, j, k))
+ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4))
{
return true;
}
- return l == 5 && world.isBlockNormalCube(i - 1, j, k);
+ return l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5);
}
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- if(world.isBlockNormalCube(i - 1, j, k))
+ if(world.isBlockSolidOnSide(i - 1, j, k,5))
{
return true;
}
- if(world.isBlockNormalCube(i + 1, j, k))
+ if(world.isBlockSolidOnSide(i + 1, j, k,4))
{
return true;
}
- if(world.isBlockNormalCube(i, j, k - 1))
+ if(world.isBlockSolidOnSide(i, j, k - 1,3))
{
return true;
}
- if(world.isBlockNormalCube(i, j, k + 1))
+ if(world.isBlockSolidOnSide(i, j, k + 1,2))
{
return true;
}
- return world.isBlockNormalCube(i, j - 1, k);
+ return world.isBlockSolidOnSide(i, j - 1, k,1);
}
public void onBlockPlaced(World world, int i, int j, int k, int l)
@@ -86,23 +86,23 @@
int j1 = i1 & 8;
i1 &= 7;
i1 = -1;
- if(l == 1 && world.isBlockNormalCube(i, j - 1, k))
+ if(l == 1 && world.isBlockSolidOnSide(i, j - 1, k,1))
{
i1 = 5 + world.rand.nextInt(2);
}
- if(l == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if(l == 2 && world.isBlockSolidOnSide(i, j, k + 1,2))
{
i1 = 4;
}
- if(l == 3 && world.isBlockNormalCube(i, j, k - 1))
+ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3))
{
i1 = 3;
}
- if(l == 4 && world.isBlockNormalCube(i + 1, j, k))
+ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4))
{
i1 = 2;
}
- if(l == 5 && world.isBlockNormalCube(i - 1, j, k))
+ if(l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5))
{
i1 = 1;
}
@@ -124,27 +124,27 @@
{
int i1 = world.getBlockMetadata(i, j, k) & 7;
boolean flag = false;
- if(!world.isBlockNormalCube(i - 1, j, k) && i1 == 1)
+ if(!world.isBlockSolidOnSide(i - 1, j, k,5) && i1 == 1)
{
flag = true;
}
- if(!world.isBlockNormalCube(i + 1, j, k) && i1 == 2)
+ if(!world.isBlockSolidOnSide(i + 1, j, k,4) && i1 == 2)
{
flag = true;
}
- if(!world.isBlockNormalCube(i, j, k - 1) && i1 == 3)
+ if(!world.isBlockSolidOnSide(i, j, k - 1,3) && i1 == 3)
{
flag = true;
}
- if(!world.isBlockNormalCube(i, j, k + 1) && i1 == 4)
+ if(!world.isBlockSolidOnSide(i, j, k + 1,2) && i1 == 4)
{
flag = true;
}
- if(!world.isBlockNormalCube(i, j - 1, k) && i1 == 5)
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1) && i1 == 5)
{
flag = true;
}
- if(!world.isBlockNormalCube(i, j - 1, k) && i1 == 6)
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1) && i1 == 6)
{
flag = true;
}
diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/BlockPressurePlate.java ../src_work/minecraft/net/minecraft/src/BlockPressurePlate.java
--- ../src_base/minecraft/net/minecraft/src/BlockPressurePlate.java 2011-08-11 17:02:11.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/BlockPressurePlate.java 2011-08-11 22:17:55.000000000 -0400
@@ -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-08-11 17:02:11.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/BlockRail.java 2011-08-17 17:10:13.000000000 -0400
@@ -16,12 +16,12 @@
public static final boolean isRailBlockAt(World world, int i, int j, int k)
{
int l = world.getBlockId(i, j, k);
- return l == Block.rail.blockID || l == Block.railPowered.blockID || l == Block.railDetector.blockID;
+ return Block.blocksList[l] instanceof BlockRail;
}
public static final boolean isRailBlock(int i)
{
- return i == Block.rail.blockID || i == Block.railPowered.blockID || i == Block.railDetector.blockID;
+ return Block.blocksList[i] instanceof BlockRail;
}
protected BlockRail(int i, int j, boolean flag)
@@ -97,7 +97,7 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- return world.isBlockNormalCube(i, j - 1, k);
+ return world.isBlockSolidOnSide(i, j - 1, k,1);
}
public void onBlockAdded(World world, int i, int j, int k)
@@ -121,23 +121,23 @@
j1 &= 7;
}
boolean flag = false;
- if(!world.isBlockNormalCube(i, j - 1, k))
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1))
{
flag = true;
}
- if(j1 == 2 && !world.isBlockNormalCube(i + 1, j, k))
+ if(j1 == 2 && !world.isBlockSolidOnSide(i + 1, j, k,1))
{
flag = true;
}
- if(j1 == 3 && !world.isBlockNormalCube(i - 1, j, k))
+ if(j1 == 3 && !world.isBlockSolidOnSide(i - 1, j, k,1))
{
flag = true;
}
- if(j1 == 4 && !world.isBlockNormalCube(i, j, k - 1))
+ if(j1 == 4 && !world.isBlockSolidOnSide(i, j, k - 1,1))
{
flag = true;
}
- if(j1 == 5 && !world.isBlockNormalCube(i, j, k + 1))
+ if(j1 == 5 && !world.isBlockSolidOnSide(i, j, k + 1,1))
{
flag = true;
}
diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/BlockRedstoneRepeater.java ../src_work/minecraft/net/minecraft/src/BlockRedstoneRepeater.java
--- ../src_base/minecraft/net/minecraft/src/BlockRedstoneRepeater.java 2011-08-11 17:02:11.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/BlockRedstoneRepeater.java 2011-08-11 22:18:50.000000000 -0400
@@ -27,7 +27,7 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- if(!world.isBlockNormalCube(i, j - 1, k))
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1))
{
return false;
} else
@@ -38,7 +38,7 @@
public boolean canBlockStay(World world, int i, int j, int k)
{
- if(!world.isBlockNormalCube(i, j - 1, k))
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1))
{
return false;
} else
diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/BlockRedstoneWire.java ../src_work/minecraft/net/minecraft/src/BlockRedstoneWire.java
--- ../src_base/minecraft/net/minecraft/src/BlockRedstoneWire.java 2011-08-11 17:02:11.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/BlockRedstoneWire.java 2011-08-17 18:00:29.000000000 -0400
@@ -3,6 +3,7 @@
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
+import net.minecraft.src.forge.*;
import java.util.*;
@@ -53,7 +54,7 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- return world.isBlockNormalCube(i, j - 1, k);
+ return world.isBlockSolidOnSide(i, j - 1, k, 1);
}
private void updateAndPropagateCurrentStrength(World world, int i, int j, int k)
@@ -451,6 +452,10 @@
{
return false;
}
+ if (Block.blocksList[i1] instanceof IConnectRedstone) {
+ IConnectRedstone icr = (IConnectRedstone) Block.blocksList[i1];
+ return icr.canConnectRedstone(iblockaccess, i, j, k, l);
+ }
if(Block.blocksList[i1].canProvidePower())
{
return true;
diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/BlockTorch.java ../src_work/minecraft/net/minecraft/src/BlockTorch.java
--- ../src_base/minecraft/net/minecraft/src/BlockTorch.java 2011-08-11 17:02:11.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/BlockTorch.java 2011-08-11 22:30:24.000000000 -0400
@@ -41,24 +41,24 @@
private boolean func_31032_h(World world, int i, int j, int k)
{
- return world.isBlockNormalCube(i, j, k) || world.getBlockId(i, j, k) == Block.fence.blockID;
+ return world.isBlockSolidOnSide(i, j, k,1) || world.getBlockId(i, j, k) == Block.fence.blockID;
}
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- if(world.isBlockNormalCube(i - 1, j, k))
+ if(world.isBlockSolidOnSide(i - 1, j, k,5))
{
return true;
}
- if(world.isBlockNormalCube(i + 1, j, k))
+ if(world.isBlockSolidOnSide(i + 1, j, k,4))
{
return true;
}
- if(world.isBlockNormalCube(i, j, k - 1))
+ if(world.isBlockSolidOnSide(i, j, k - 1,3))
{
return true;
}
- if(world.isBlockNormalCube(i, j, k + 1))
+ if(world.isBlockSolidOnSide(i, j, k + 1,2))
{
return true;
}
@@ -72,19 +72,19 @@
{
i1 = 5;
}
- if(l == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if(l == 2 && world.isBlockSolidOnSide(i, j, k + 1,2))
{
i1 = 4;
}
- if(l == 3 && world.isBlockNormalCube(i, j, k - 1))
+ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3))
{
i1 = 3;
}
- if(l == 4 && world.isBlockNormalCube(i + 1, j, k))
+ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4))
{
i1 = 2;
}
- if(l == 5 && world.isBlockNormalCube(i - 1, j, k))
+ if(l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5))
{
i1 = 1;
}
@@ -102,19 +102,19 @@
public void onBlockAdded(World world, int i, int j, int k)
{
- if(world.isBlockNormalCube(i - 1, j, k))
+ if(world.isBlockSolidOnSide(i - 1, j, k,5))
{
world.setBlockMetadataWithNotify(i, j, k, 1);
} else
- if(world.isBlockNormalCube(i + 1, j, k))
+ if(world.isBlockSolidOnSide(i + 1, j, k,4))
{
world.setBlockMetadataWithNotify(i, j, k, 2);
} else
- if(world.isBlockNormalCube(i, j, k - 1))
+ if(world.isBlockSolidOnSide(i, j, k - 1,3))
{
world.setBlockMetadataWithNotify(i, j, k, 3);
} else
- if(world.isBlockNormalCube(i, j, k + 1))
+ if(world.isBlockSolidOnSide(i, j, k + 1,2))
{
world.setBlockMetadataWithNotify(i, j, k, 4);
} else
@@ -131,19 +131,19 @@
{
int i1 = world.getBlockMetadata(i, j, k);
boolean flag = false;
- if(!world.isBlockNormalCube(i - 1, j, k) && i1 == 1)
+ if(!world.isBlockSolidOnSide(i - 1, j, k,5) && i1 == 1)
{
flag = true;
}
- if(!world.isBlockNormalCube(i + 1, j, k) && i1 == 2)
+ if(!world.isBlockSolidOnSide(i + 1, j, k,4) && i1 == 2)
{
flag = true;
}
- if(!world.isBlockNormalCube(i, j, k - 1) && i1 == 3)
+ if(!world.isBlockSolidOnSide(i, j, k - 1,3) && i1 == 3)
{
flag = true;
}
- if(!world.isBlockNormalCube(i, j, k + 1) && i1 == 4)
+ if(!world.isBlockSolidOnSide(i, j, k + 1,2) && i1 == 4)
{
flag = true;
}
diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/BlockTrapDoor.java ../src_work/minecraft/net/minecraft/src/BlockTrapDoor.java
--- ../src_base/minecraft/net/minecraft/src/BlockTrapDoor.java 2011-08-11 17:02:11.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/BlockTrapDoor.java 2011-08-17 17:38:38.000000000 -0400
@@ -147,7 +147,7 @@
{
j1--;
}
- if(!world.isBlockNormalCube(j1, j, k1))
+ if(!disableValidation && !world.isBlockSolidOnSide(j1, j, k1, (i1&3)+2))
{
world.setBlockWithNotify(i, j, k, 0);
dropBlockAsItem(world, i, j, k, i1);
@@ -213,11 +213,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-08-11 17:02:11.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/Chunk.java 2011-08-11 17:02:12.000000000 -0400
@@ -3,6 +3,7 @@
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
+import net.minecraft.src.forge.*;
import java.io.PrintStream;
import java.util.*;
@@ -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-08-11 17:02:11.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/EffectRenderer.java 2011-08-11 17:02:12.000000000 -0400
@@ -7,6 +7,9 @@
import java.util.*;
import org.lwjgl.opengl.GL11;
+import net.minecraft.src.forge.BlockTextureParticles;
+import net.minecraft.src.forge.ITextureProvider;
+
// Referenced classes of package net.minecraft.src:
// EntityFX, Entity, MathHelper, RenderEngine,
// Tessellator, Block, EntityDiggingFX, World
@@ -16,6 +19,7 @@
public EffectRenderer(World world, RenderEngine renderengine)
{
+ effectList = new ArrayList();
fxLayers = new List[4];
rand = new Random();
if(world != null)
@@ -55,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-08-11 17:02:11.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/EntityLiving.java 2011-08-11 17:02:12.000000000 -0400
@@ -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-08-11 17:02:11.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/EntityPlayer.java 2011-08-17 19:06:38.000000000 -0400
@@ -6,6 +6,9 @@
import java.util.*;
+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 +319,8 @@
worldObj.entityJoinedWorld(entityitem);
}
+ /* FORGE: This isn't called anymore
+ */
public float getCurrentPlayerStrVsBlock(Block block)
{
float f = inventory.getStrVsBlock(block);
@@ -330,6 +335,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 +500,21 @@
protected void damageEntity(int i)
{
+ boolean doRegularComputation = true;
+ for (ItemStack stack : inventory.armorInventory) {
+ if (stack != null && stack.getItem() instanceof ISpecialArmor) {
+ ISpecialArmor armor = (ISpecialArmor) stack.getItem();
+
+ i = armor.adjustArmorDamage(i);
+ doRegularComputation = doRegularComputation
+ && armor.allowRegularComputation();
+ }
+ }
+
+ if (!doRegularComputation) {
+ super.damageEntity(i);
+ }
+
int j = 25 - inventory.getTotalArmorValue();
int k = i * j + damageRemainder;
inventory.damageArmor(i);
@@ -523,6 +561,7 @@
public void destroyCurrentEquippedItem()
{
inventory.setInventorySlotContents(inventory.currentItem, null);
+ ForgeHooks.onDestroyCurrentItem(this);
}
public double getYOffset()
@@ -594,6 +633,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/Explosion.java ../src_work/minecraft/net/minecraft/src/Explosion.java
--- ../src_base/minecraft/net/minecraft/src/Explosion.java 2011-08-11 17:02:11.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/Explosion.java 2011-08-11 17:02:12.000000000 -0400
@@ -3,6 +3,7 @@
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
+import net.minecraft.src.forge.ISpecialResistance;
import java.util.*;
@@ -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/ItemBucket.java ../src_work/minecraft/net/minecraft/src/ItemBucket.java
--- ../src_base/minecraft/net/minecraft/src/ItemBucket.java 2011-08-11 17:02:11.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/ItemBucket.java 2011-08-11 17:02:12.000000000 -0400
@@ -6,6 +6,8 @@
import java.util.Random;
+import net.minecraft.src.forge.MinecraftForge;
+
// Referenced classes of package net.minecraft.src:
// Item, EntityPlayer, Vec3D, MathHelper,
// World, MovingObjectPosition, EnumMovingObjectType, Material,
@@ -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/Item.java ../src_work/minecraft/net/minecraft/src/Item.java
--- ../src_base/minecraft/net/minecraft/src/Item.java 2011-08-11 17:02:11.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/Item.java 2011-08-12 17:59:17.000000000 -0400
@@ -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/ItemRenderer.java ../src_work/minecraft/net/minecraft/src/ItemRenderer.java
--- ../src_base/minecraft/net/minecraft/src/ItemRenderer.java 2011-08-11 17:02:11.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/ItemRenderer.java 2011-08-11 17:02:12.000000000 -0400
@@ -5,6 +5,8 @@
package net.minecraft.src;
import net.minecraft.client.Minecraft;
+import net.minecraft.src.forge.ForgeHooksClient;
+
import org.lwjgl.opengl.GL11;
// Referenced classes of package net.minecraft.src:
@@ -34,15 +36,18 @@
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-08-11 17:02:11.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/ItemTool.java 2011-08-12 18:38:09.000000000 -0400
@@ -4,6 +4,8 @@
package net.minecraft.src;
+import java.util.Arrays;
+import net.minecraft.src.forge.ForgeHooks;
// Referenced classes of package net.minecraft.src:
// Item, EnumToolMaterial, ItemStack, Block,
@@ -37,6 +39,14 @@
return 1.0F;
}
+ /* FORGE: Overridden to allow custom tool effectiveness
+ */
+ public float getStrVsBlock(ItemStack itemstack, Block block, int md) {
+ if(ForgeHooks.isToolEffective(itemstack,block,md))
+ return efficiencyOnProperMaterial;
+ return getStrVsBlock(itemstack,block);
+ }
+
public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
{
itemstack.damageItem(2, entityliving1);
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-08-11 17:02:11.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/MovingObjectPosition.java 2011-08-11 17:02:12.000000000 -0400
@@ -35,4 +35,7 @@
public int sideHit;
public Vec3D hitVec;
public Entity entityHit;
+
+ // Added for RedPower subblocks.
+ public int subHit=0;
}
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-08-11 17:02:11.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/PlayerController.java 2011-08-17 20:02:41.000000000 -0400
@@ -3,6 +3,7 @@
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
+import net.minecraft.src.forge.*;
import net.minecraft.client.Minecraft;
@@ -71,6 +72,7 @@
if(itemstack1.stackSize == 0)
{
entityplayer.inventory.mainInventory[entityplayer.inventory.currentItem] = null;
+ ForgeHooks.onDestroyCurrentItem(entityplayer);
}
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);
+ 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-08-11 17:02:11.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/PlayerControllerMP.java 2011-08-12 00:47:04.000000000 -0400
@@ -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-08-11 17:02:11.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/PlayerControllerSP.java 2011-08-12 19:08:13.000000000 -0400
@@ -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-08-11 17:02:11.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/RenderBlocks.java 2011-08-12 19:29:14.000000000 -0400
@@ -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-08-11 17:02:11.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/RenderEngine.java 2011-08-11 23:20:23.000000000 -0400
@@ -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/RenderItem.java ../src_work/minecraft/net/minecraft/src/RenderItem.java
--- ../src_base/minecraft/net/minecraft/src/RenderItem.java 2011-08-11 17:02:11.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/RenderItem.java 2011-08-11 17:02:12.000000000 -0400
@@ -5,6 +5,9 @@
package net.minecraft.src;
import java.util.Random;
+
+import net.minecraft.src.forge.ForgeHooksClient;
+
import org.lwjgl.opengl.GL11;
// Referenced classes of package net.minecraft.src:
@@ -51,6 +54,7 @@
{
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 +82,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 +98,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;
@@ -131,6 +138,7 @@
{
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);
@@ -159,9 +167,11 @@
if(i < 256)
{
renderengine.bindTexture(renderengine.getTexture("/terrain.png"));
+ ForgeHooksClient.overrideTexture (Block.blocksList[i]);
} else
{
renderengine.bindTexture(renderengine.getTexture("/gui/items.png"));
+ ForgeHooksClient.overrideTexture(Item.itemsList[i]);
}
int k1 = Item.itemsList[i].getColorFromDamage(j);
float f = (float)(k1 >> 16 & 0xff) / 255F;
diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/SlotCrafting.java ../src_work/minecraft/net/minecraft/src/SlotCrafting.java
--- ../src_base/minecraft/net/minecraft/src/SlotCrafting.java 2011-08-11 17:02:11.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/SlotCrafting.java 2011-08-17 11:26:26.000000000 -0400
@@ -3,6 +3,7 @@
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
+import net.minecraft.src.forge.ForgeHooks;
// Referenced classes of package net.minecraft.src:
@@ -60,6 +61,7 @@
thePlayer.addStat(AchievementList.buildSword, 1);
}
ModLoader.TakenFromCrafting(thePlayer, itemstack);
+ 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-08-11 17:02:11.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/Tessellator.java 2011-08-11 23:13:28.000000000 -0400
@@ -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-08-11 17:02:11.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/TileEntityRendererPiston.java 2011-08-12 19:32:56.000000000 -0400
@@ -4,6 +4,7 @@
package net.minecraft.src;
+import net.minecraft.src.forge.ForgeHooksClient;
import net.minecraft.client.Minecraft;
import org.lwjgl.opengl.GL11;
@@ -38,6 +39,7 @@
{
GL11.glShadeModel(7424 /*GL_FLAT*/);
}
+ ForgeHooksClient.beforeBlockRender(block,field_31071_b);
tessellator.startDrawingQuads();
tessellator.setTranslationD(((float)d - (float)tileentitypiston.xCoord) + tileentitypiston.func_31017_b(f), ((float)d1 - (float)tileentitypiston.yCoord) + tileentitypiston.func_31014_c(f), ((float)d2 - (float)tileentitypiston.zCoord) + tileentitypiston.func_31013_d(f));
tessellator.setColorOpaque(1, 1, 1);
@@ -58,6 +60,7 @@
}
tessellator.setTranslationD(0.0D, 0.0D, 0.0D);
tessellator.draw();
+ ForgeHooksClient.afterBlockRender(block,field_31071_b);
RenderHelper.enableStandardItemLighting();
}
}
diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/World.java ../src_work/minecraft/net/minecraft/src/World.java
--- ../src_base/minecraft/net/minecraft/src/World.java 2011-08-11 17:02:11.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/World.java 2011-08-17 17:56:22.000000000 -0400
@@ -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)
@@ -1607,7 +1611,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 +1902,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 +2437,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 +2926,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;
Only in ../src_work/minecraft/net/minecraft/src: World.java.orig
diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/WorldRenderer.java ../src_work/minecraft/net/minecraft/src/WorldRenderer.java
--- ../src_base/minecraft/net/minecraft/src/WorldRenderer.java 2011-08-11 17:02:11.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/WorldRenderer.java 2011-08-12 19:23:40.000000000 -0400
@@ -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/BlockButton.java ../src_work/minecraft_server/net/minecraft/src/BlockButton.java
--- ../src_base/minecraft_server/net/minecraft/src/BlockButton.java 2011-08-11 17:02:12.000000000 -0400
+++ ../src_work/minecraft_server/net/minecraft/src/BlockButton.java 2011-08-11 21:44:46.000000000 -0400
@@ -41,36 +41,36 @@
public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l)
{
- if(l == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if(l == 2 && world.isBlockSolidOnSide(i, j, k + 1,2))
{
return true;
}
- if(l == 3 && world.isBlockNormalCube(i, j, k - 1))
+ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3))
{
return true;
}
- if(l == 4 && world.isBlockNormalCube(i + 1, j, k))
+ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4))
{
return true;
}
- return l == 5 && world.isBlockNormalCube(i - 1, j, k);
+ return l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5);
}
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- if(world.isBlockNormalCube(i - 1, j, k))
+ if(world.isBlockSolidOnSide(i - 1, j, k,5))
{
return true;
}
- if(world.isBlockNormalCube(i + 1, j, k))
+ if(world.isBlockSolidOnSide(i + 1, j, k,4))
{
return true;
}
- if(world.isBlockNormalCube(i, j, k - 1))
+ if(world.isBlockSolidOnSide(i, j, k - 1,3))
{
return true;
}
- return world.isBlockNormalCube(i, j, k + 1);
+ return world.isBlockSolidOnSide(i, j, k + 1,2);
}
public void onBlockPlaced(World world, int i, int j, int k, int l)
@@ -78,19 +78,19 @@
int i1 = world.getBlockMetadata(i, j, k);
int j1 = i1 & 8;
i1 &= 7;
- if(l == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if(l == 2 && world.isBlockSolidOnSide(i, j, k + 1,2))
{
i1 = 4;
} else
- if(l == 3 && world.isBlockNormalCube(i, j, k - 1))
+ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3))
{
i1 = 3;
} else
- if(l == 4 && world.isBlockNormalCube(i + 1, j, k))
+ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4))
{
i1 = 2;
} else
- if(l == 5 && world.isBlockNormalCube(i - 1, j, k))
+ if(l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5))
{
i1 = 1;
} else
@@ -102,19 +102,19 @@
private int getOrientation(World world, int i, int j, int k)
{
- if(world.isBlockNormalCube(i - 1, j, k))
+ if(world.isBlockSolidOnSide(i - 1, j, k,5))
{
return 1;
}
- if(world.isBlockNormalCube(i + 1, j, k))
+ if(world.isBlockSolidOnSide(i + 1, j, k,4))
{
return 2;
}
- if(world.isBlockNormalCube(i, j, k - 1))
+ if(world.isBlockSolidOnSide(i, j, k - 1,3))
{
return 3;
}
- return !world.isBlockNormalCube(i, j, k + 1) ? 1 : 4;
+ return !world.isBlockSolidOnSide(i, j, k + 1,2) ? 1 : 4;
}
public void onNeighborBlockChange(World world, int i, int j, int k, int l)
@@ -123,19 +123,19 @@
{
int i1 = world.getBlockMetadata(i, j, k) & 7;
boolean flag = false;
- if(!world.isBlockNormalCube(i - 1, j, k) && i1 == 1)
+ if(!world.isBlockSolidOnSide(i - 1, j, k,5) && i1 == 1)
{
flag = true;
}
- if(!world.isBlockNormalCube(i + 1, j, k) && i1 == 2)
+ if(!world.isBlockSolidOnSide(i + 1, j, k,4) && i1 == 2)
{
flag = true;
}
- if(!world.isBlockNormalCube(i, j, k - 1) && i1 == 3)
+ if(!world.isBlockSolidOnSide(i, j, k - 1,3) && i1 == 3)
{
flag = true;
}
- if(!world.isBlockNormalCube(i, j, k + 1) && i1 == 4)
+ if(!world.isBlockSolidOnSide(i, j, k + 1,2) && i1 == 4)
{
flag = true;
}
diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/BlockChest.java ../src_work/minecraft_server/net/minecraft/src/BlockChest.java
--- ../src_base/minecraft_server/net/minecraft/src/BlockChest.java 2011-08-11 17:02:12.000000000 -0400
+++ ../src_work/minecraft_server/net/minecraft/src/BlockChest.java 2011-08-11 22:01:13.000000000 -0400
@@ -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-08-11 17:02:12.000000000 -0400
+++ ../src_work/minecraft_server/net/minecraft/src/BlockDoor.java 2011-08-11 22:02:01.000000000 -0400
@@ -167,7 +167,7 @@
world.setBlockWithNotify(i, j, k, 0);
flag = true;
}
- if(!world.isBlockNormalCube(i, j - 1, k))
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1))
{
world.setBlockWithNotify(i, j, k, 0);
flag = true;
@@ -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/Block.java ../src_work/minecraft_server/net/minecraft/src/Block.java
--- ../src_base/minecraft_server/net/minecraft/src/Block.java 2011-08-11 17:02:12.000000000 -0400
+++ ../src_work/minecraft_server/net/minecraft/src/Block.java 2011-08-17 17:55:56.000000000 -0400
@@ -3,6 +3,7 @@
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
+import net.minecraft.src.forge.ForgeHooks;
import java.util.ArrayList;
import java.util.Random;
@@ -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,80 @@
return blockMaterial.getMaterialMobility();
}
+ /* FORGE: Implement and return true if you wish this block to behave
+ * like a ladder when the player is inside.
+ */
+ public boolean isLadder() {
+ return false;
+ }
+
+ /* FORGE: Return true if the block is a normal, solid cube. This
+ * determines indirect power state, entity ejection from blocks, and a few
+ * others.
+ */
+ public boolean isBlockNormalCube(World world, int i, int j, int k) {
+ return blockMaterial.getIsOpaque() && isACube();
+ }
+
+ /* FORGE: Return true if the block is solid on the given side. This
+ * is used by placement logic. */
+ public boolean isBlockSolidOnSide( World world, int i, int j, int k,
+ int side ) {
+ return isBlockNormalCube(world,i,j,k);
+ }
+
+ /* FORGE: Return true if the player can place a new block in the block
+ * occupied by this one, like water, lava, fire, etc.
+ */
+ public boolean isBlockReplaceable( World world, int i, int j, int k ) {
+ return false;
+ }
+
+ /* FORGE: Return true if this block should set fire and deal fire damage
+ * to entities coming into contact with it, false otherwise.
+ */
+ public boolean isBlockBurning( World world, int i, int j, int k ) {
+ return false;
+ }
+
+ /* FORGE: Return true if this block should be treated as an air block
+ * by the rest of the code, false otherwise. This method is primarily
+ * useful for creating pure logic-blocks that will be invisible
+ * to the player and otherwise interact as air would.
+ */
+ public boolean isAirBlock( World world, int i, int j, int k ) {
+ return false;
+ }
+
+ /* FORGE: Return the block hardness with metadata 'md'.
+ */
+ public float getHardness(int md) {
+ return blockHardness;
+ }
+
+ /* FORGE: Return the block strength of the block at i,j,k against the
+ * player.
+ */
+ public float blockStrength(World world, EntityPlayer player,
+ int i, int j, int k) {
+ int md=world.getBlockMetadata(i,j,k);
+ return blockStrength(player,md);
+ }
+
+ /* FORGE: Return the block strength of a prototypical block with metadata
+ * 'md' against the player.
+ */
+ public float blockStrength(EntityPlayer player, int md) {
+ return ForgeHooks.blockStrength(this,player,md);
+ }
+
+ /* FORGE: Return true if the player can harvest a prototypical block with
+ * metadata 'md'.
+ */
+ public boolean canHarvestBlock(EntityPlayer player, int md) {
+ return ForgeHooks.canHarvestBlock(this,player,md);
+ }
+
static Class _mthclass$(String s)
{
try
diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/BlockLadder.java ../src_work/minecraft_server/net/minecraft/src/BlockLadder.java
--- ../src_base/minecraft_server/net/minecraft/src/BlockLadder.java 2011-08-11 17:02:12.000000000 -0400
+++ ../src_work/minecraft_server/net/minecraft/src/BlockLadder.java 2011-08-11 22:07:05.000000000 -0400
@@ -40,6 +40,11 @@
return super.getCollisionBoundingBoxFromPool(world, i, j, k);
}
+ /* FORGE: Implemented base method, see Block.isLadder */
+ public boolean isLadder() {
+ return true;
+ }
+
public boolean isOpaqueCube()
{
return false;
@@ -52,37 +57,37 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- if(world.isBlockNormalCube(i - 1, j, k))
+ if(world.isBlockSolidOnSide(i - 1, j, k,5))
{
return true;
}
- if(world.isBlockNormalCube(i + 1, j, k))
+ if(world.isBlockSolidOnSide(i + 1, j, k,4))
{
return true;
}
- if(world.isBlockNormalCube(i, j, k - 1))
+ if(world.isBlockSolidOnSide(i, j, k - 1,3))
{
return true;
}
- return world.isBlockNormalCube(i, j, k + 1);
+ return world.isBlockSolidOnSide(i, j, k + 1,2);
}
public void onBlockPlaced(World world, int i, int j, int k, int l)
{
int i1 = world.getBlockMetadata(i, j, k);
- if((i1 == 0 || l == 2) && world.isBlockNormalCube(i, j, k + 1))
+ if((i1 == 0 || l == 2) && world.isBlockSolidOnSide(i, j, k + 1,2))
{
i1 = 2;
}
- if((i1 == 0 || l == 3) && world.isBlockNormalCube(i, j, k - 1))
+ if((i1 == 0 || l == 3) && world.isBlockSolidOnSide(i, j, k - 1,3))
{
i1 = 3;
}
- if((i1 == 0 || l == 4) && world.isBlockNormalCube(i + 1, j, k))
+ if((i1 == 0 || l == 4) && world.isBlockSolidOnSide(i + 1, j, k,4))
{
i1 = 4;
}
- if((i1 == 0 || l == 5) && world.isBlockNormalCube(i - 1, j, k))
+ if((i1 == 0 || l == 5) && world.isBlockSolidOnSide(i - 1, j, k,5))
{
i1 = 5;
}
@@ -93,19 +98,19 @@
{
int i1 = world.getBlockMetadata(i, j, k);
boolean flag = false;
- if(i1 == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if(i1 == 2 && world.isBlockSolidOnSide(i, j, k + 1,2))
{
flag = true;
}
- if(i1 == 3 && world.isBlockNormalCube(i, j, k - 1))
+ if(i1 == 3 && world.isBlockSolidOnSide(i, j, k - 1,3))
{
flag = true;
}
- if(i1 == 4 && world.isBlockNormalCube(i + 1, j, k))
+ if(i1 == 4 && world.isBlockSolidOnSide(i + 1, j, k,4))
{
flag = true;
}
- if(i1 == 5 && world.isBlockNormalCube(i - 1, j, k))
+ if(i1 == 5 && world.isBlockSolidOnSide(i - 1, j, k,5))
{
flag = true;
}
diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/BlockLever.java ../src_work/minecraft_server/net/minecraft/src/BlockLever.java
--- ../src_base/minecraft_server/net/minecraft/src/BlockLever.java 2011-08-11 17:02:12.000000000 -0400
+++ ../src_work/minecraft_server/net/minecraft/src/BlockLever.java 2011-08-11 22:13:32.000000000 -0400
@@ -35,44 +35,44 @@
public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l)
{
- if(l == 1 && world.isBlockNormalCube(i, j - 1, k))
+ if(l == 1 && world.isBlockSolidOnSide(i, j - 1, k,1))
{
return true;
}
- if(l == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if(l == 2 && world.isBlockSolidOnSide(i, j, k + 1,2))
{
return true;
}
- if(l == 3 && world.isBlockNormalCube(i, j, k - 1))
+ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3))
{
return true;
}
- if(l == 4 && world.isBlockNormalCube(i + 1, j, k))
+ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4))
{
return true;
}
- return l == 5 && world.isBlockNormalCube(i - 1, j, k);
+ return l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5);
}
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- if(world.isBlockNormalCube(i - 1, j, k))
+ if(world.isBlockSolidOnSide(i - 1, j, k,5))
{
return true;
}
- if(world.isBlockNormalCube(i + 1, j, k))
+ if(world.isBlockSolidOnSide(i + 1, j, k,4))
{
return true;
}
- if(world.isBlockNormalCube(i, j, k - 1))
+ if(world.isBlockSolidOnSide(i, j, k - 1,3))
{
return true;
}
- if(world.isBlockNormalCube(i, j, k + 1))
+ if(world.isBlockSolidOnSide(i, j, k + 1,2))
{
return true;
}
- return world.isBlockNormalCube(i, j - 1, k);
+ return world.isBlockSolidOnSide(i, j - 1, k,1);
}
public void onBlockPlaced(World world, int i, int j, int k, int l)
@@ -81,23 +81,23 @@
int j1 = i1 & 8;
i1 &= 7;
i1 = -1;
- if(l == 1 && world.isBlockNormalCube(i, j - 1, k))
+ if(l == 1 && world.isBlockSolidOnSide(i, j - 1, k,1))
{
i1 = 5 + world.rand.nextInt(2);
}
- if(l == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if(l == 2 && world.isBlockSolidOnSide(i, j, k + 1,2))
{
i1 = 4;
}
- if(l == 3 && world.isBlockNormalCube(i, j, k - 1))
+ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3))
{
i1 = 3;
}
- if(l == 4 && world.isBlockNormalCube(i + 1, j, k))
+ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4))
{
i1 = 2;
}
- if(l == 5 && world.isBlockNormalCube(i - 1, j, k))
+ if(l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5))
{
i1 = 1;
}
@@ -119,27 +119,27 @@
{
int i1 = world.getBlockMetadata(i, j, k) & 7;
boolean flag = false;
- if(!world.isBlockNormalCube(i - 1, j, k) && i1 == 1)
+ if(!world.isBlockSolidOnSide(i - 1, j, k,5) && i1 == 1)
{
flag = true;
}
- if(!world.isBlockNormalCube(i + 1, j, k) && i1 == 2)
+ if(!world.isBlockSolidOnSide(i + 1, j, k,4) && i1 == 2)
{
flag = true;
}
- if(!world.isBlockNormalCube(i, j, k - 1) && i1 == 3)
+ if(!world.isBlockSolidOnSide(i, j, k - 1,3) && i1 == 3)
{
flag = true;
}
- if(!world.isBlockNormalCube(i, j, k + 1) && i1 == 4)
+ if(!world.isBlockSolidOnSide(i, j, k + 1,2) && i1 == 4)
{
flag = true;
}
- if(!world.isBlockNormalCube(i, j - 1, k) && i1 == 5)
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1) && i1 == 5)
{
flag = true;
}
- if(!world.isBlockNormalCube(i, j - 1, k) && i1 == 6)
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1) && i1 == 6)
{
flag = true;
}
diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/BlockPressurePlate.java ../src_work/minecraft_server/net/minecraft/src/BlockPressurePlate.java
--- ../src_base/minecraft_server/net/minecraft/src/BlockPressurePlate.java 2011-08-11 17:02:12.000000000 -0400
+++ ../src_work/minecraft_server/net/minecraft/src/BlockPressurePlate.java 2011-08-11 22:18:08.000000000 -0400
@@ -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-08-11 17:02:12.000000000 -0400
+++ ../src_work/minecraft_server/net/minecraft/src/BlockRail.java 2011-08-17 17:10:08.000000000 -0400
@@ -16,12 +16,12 @@
public static final boolean func_27029_g(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 func_27030_c(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-08-11 17:02:12.000000000 -0400
+++ ../src_work/minecraft_server/net/minecraft/src/BlockRedstoneRepeater.java 2011-08-11 22:19:02.000000000 -0400
@@ -27,7 +27,7 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- if(!world.isBlockNormalCube(i, j - 1, k))
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1))
{
return false;
} else
@@ -38,7 +38,7 @@
public boolean canBlockStay(World world, int i, int j, int k)
{
- if(!world.isBlockNormalCube(i, j - 1, k))
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1))
{
return false;
} else
diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/BlockRedstoneWire.java ../src_work/minecraft_server/net/minecraft/src/BlockRedstoneWire.java
--- ../src_base/minecraft_server/net/minecraft/src/BlockRedstoneWire.java 2011-08-11 17:02:12.000000000 -0400
+++ ../src_work/minecraft_server/net/minecraft/src/BlockRedstoneWire.java 2011-08-17 18:00:42.000000000 -0400
@@ -3,6 +3,7 @@
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
+import net.minecraft.src.forge.*;
import java.util.*;
@@ -43,7 +44,7 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- return world.isBlockNormalCube(i, j - 1, k);
+ return world.isBlockSolidOnSide(i, j - 1, k, 1);
}
private void updateAndPropagateCurrentStrength(World world, int i, int j, int k)
@@ -413,6 +414,10 @@
{
return false;
}
+ if(Block.blocksList[i1] instanceof IConnectRedstone) {
+ IConnectRedstone icr=(IConnectRedstone)Block.blocksList[i1];
+ return icr.canConnectRedstone(iblockaccess,i,j,k,l);
+ }
if(Block.blocksList[i1].canProvidePower())
{
return true;
diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/BlockTorch.java ../src_work/minecraft_server/net/minecraft/src/BlockTorch.java
--- ../src_base/minecraft_server/net/minecraft/src/BlockTorch.java 2011-08-11 17:02:12.000000000 -0400
+++ ../src_work/minecraft_server/net/minecraft/src/BlockTorch.java 2011-08-11 22:31:30.000000000 -0400
@@ -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-08-11 17:02:12.000000000 -0400
+++ ../src_work/minecraft_server/net/minecraft/src/BlockTrapDoor.java 2011-08-17 17:38:43.000000000 -0400
@@ -130,7 +130,7 @@
{
j1--;
}
- if(!world.isBlockNormalCube(j1, j, k1))
+ if(!disableValidation && !world.isBlockSolidOnSide(j1, j, k1, (i1&3)+2))
{
world.setBlockWithNotify(i, j, k, 0);
dropBlockAsItem(world, i, j, k, i1);
@@ -196,11 +196,15 @@
{
i--;
}
- return world.isBlockNormalCube(i, j, k);
+ return world.isBlockSolidOnSide(i, j, k,l);
}
public static boolean func_28038_d(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-08-11 17:02:12.000000000 -0400
+++ ../src_work/minecraft_server/net/minecraft/src/Chunk.java 2011-08-11 17:02:12.000000000 -0400
@@ -3,6 +3,7 @@
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
+import net.minecraft.src.forge.*;
import java.io.PrintStream;
import java.util.*;
@@ -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-08-11 17:02:12.000000000 -0400
+++ ../src_work/minecraft_server/net/minecraft/src/EntityLiving.java 2011-08-11 20:47:14.000000000 -0400
@@ -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-08-11 17:02:12.000000000 -0400
+++ ../src_work/minecraft_server/net/minecraft/src/EntityPlayer.java 2011-08-17 19:06:41.000000000 -0400
@@ -6,6 +6,9 @@
import java.util.*;
+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 +299,8 @@
worldObj.entityJoinedWorld(entityitem);
}
+ /* FORGE: This isn't called anymore
+ */
public float getCurrentPlayerStrVsBlock(Block block)
{
float f = inventory.getStrVsBlock(block);
@@ -310,6 +315,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 +480,21 @@
protected void damageEntity(int i)
{
+ boolean doRegularComputation = true;
+ for (ItemStack stack : inventory.armorInventory) {
+ if (stack != null && stack.getItem() instanceof ISpecialArmor) {
+ ISpecialArmor armor = (ISpecialArmor) stack.getItem();
+
+ i = armor.adjustArmorDamage(i);
+ doRegularComputation = doRegularComputation
+ && armor.allowRegularComputation();
+ }
+ }
+
+ if (!doRegularComputation) {
+ super.damageEntity(i);
+ }
+
int j = 25 - inventory.getTotalArmorValue();
int k = i * j + damageRemainder;
inventory.damageArmor(i);
@@ -503,6 +541,7 @@
public void destroyCurrentEquippedItem()
{
inventory.setInventorySlotContents(inventory.currentItem, null);
+ ForgeHooks.onDestroyCurrentItem(this);
}
public double getYOffset()
@@ -568,6 +607,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-08-11 17:02:12.000000000 -0400
+++ ../src_work/minecraft_server/net/minecraft/src/Explosion.java 2011-08-11 17:02:12.000000000 -0400
@@ -3,6 +3,7 @@
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
+import net.minecraft.src.forge.ISpecialResistance;
import java.util.*;
@@ -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/ItemBucket.java ../src_work/minecraft_server/net/minecraft/src/ItemBucket.java
--- ../src_base/minecraft_server/net/minecraft/src/ItemBucket.java 2011-08-11 17:02:12.000000000 -0400
+++ ../src_work/minecraft_server/net/minecraft/src/ItemBucket.java 2011-08-11 17:02:12.000000000 -0400
@@ -6,6 +6,8 @@
import java.util.Random;
+import net.minecraft.src.forge.MinecraftForge;
+
// Referenced classes of package net.minecraft.src:
// Item, EntityPlayer, Vec3D, MathHelper,
// World, MovingObjectPosition, EnumMovingObjectType, Material,
@@ -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-08-11 17:02:12.000000000 -0400
+++ ../src_work/minecraft_server/net/minecraft/src/ItemInWorldManager.java 2011-08-17 20:02:48.000000000 -0400
@@ -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);
}
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);
+ return true;
}
}
diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/Item.java ../src_work/minecraft_server/net/minecraft/src/Item.java
--- ../src_base/minecraft_server/net/minecraft/src/Item.java 2011-08-11 17:02:12.000000000 -0400
+++ ../src_work/minecraft_server/net/minecraft/src/Item.java 2011-08-12 17:59:16.000000000 -0400
@@ -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/ItemTool.java ../src_work/minecraft_server/net/minecraft/src/ItemTool.java
--- ../src_base/minecraft_server/net/minecraft/src/ItemTool.java 2011-08-11 17:02:12.000000000 -0400
+++ ../src_work/minecraft_server/net/minecraft/src/ItemTool.java 2011-08-12 18:38:14.000000000 -0400
@@ -4,6 +4,8 @@
package net.minecraft.src;
+import java.util.Arrays;
+import net.minecraft.src.forge.ForgeHooks;
// Referenced classes of package net.minecraft.src:
// Item, EnumToolMaterial, ItemStack, Block,
@@ -37,6 +39,14 @@
return 1.0F;
}
+ /* FORGE: Overridden to allow custom tool effectiveness
+ */
+ public float getStrVsBlock(ItemStack itemstack, Block block, int md) {
+ if(ForgeHooks.isToolEffective(itemstack,block,md))
+ return efficiencyOnProperMaterial;
+ return getStrVsBlock(itemstack,block);
+ }
+
public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
{
itemstack.damageItem(2, entityliving1);
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-08-11 17:02:12.000000000 -0400
+++ ../src_work/minecraft_server/net/minecraft/src/MovingObjectPosition.java 2011-08-11 17:02:12.000000000 -0400
@@ -35,4 +35,7 @@
public int sideHit;
public Vec3D hitVec;
public Entity entityHit;
+
+ // Added for RedPower subblocks.
+ public int subHit=0;
}
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-08-11 17:02:12.000000000 -0400
+++ ../src_work/minecraft_server/net/minecraft/src/PlayerInstance.java 2011-08-11 17:02:12.000000000 -0400
@@ -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-08-11 17:02:12.000000000 -0400
+++ ../src_work/minecraft_server/net/minecraft/src/SlotCrafting.java 2011-08-17 11:26:29.000000000 -0400
@@ -3,6 +3,7 @@
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
+import net.minecraft.src.forge.ForgeHooks;
// Referenced classes of package net.minecraft.src:
@@ -60,6 +61,7 @@
field_25004_e.addStat(AchievementList.field_27101_r, 1);
}
ModLoader.TakenFromCrafting(field_25004_e, itemstack);
+ ForgeHooks.onTakenFromCrafting(field_25004_e, 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-08-11 17:02:12.000000000 -0400
+++ ../src_work/minecraft_server/net/minecraft/src/World.java 2011-08-17 17:56:37.000000000 -0400
@@ -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)
@@ -1408,7 +1412,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 +1688,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 func_6156_d()
@@ -2178,6 +2190,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 +2614,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;