Fixed a bug in forge_client project that had a hard link to E:/MCP/jars/bin/paul.jar now points to MCP/jars/bin/minecraft.jar {has the same paulsound libraries}

Major refactoring of the patches, now each modified file gets its own patch file.
Rewrote all the scripts to use new multi-patch system.
Added linux install.sh using new system.
Added some required libraries from GNUWin32 for the windows side of the new setup.bat/update_patches.bat http://gnuwin32.sourceforge.net/
This commit is contained in:
LexManos 2011-10-09 04:21:29 +00:00
parent d00a837635
commit 141805d5bb
104 changed files with 5065 additions and 5057 deletions

BIN
forge/bin/diff.exe Normal file

Binary file not shown.

BIN
forge/bin/find.exe Normal file

Binary file not shown.

BIN
forge/bin/libiconv2.dll Normal file

Binary file not shown.

BIN
forge/bin/libintl3.dll Normal file

Binary file not shown.

BIN
forge/bin/mkdir.exe Normal file

Binary file not shown.

BIN
forge/bin/regex2.dll Normal file

Binary file not shown.

BIN
forge/bin/sed.exe Normal file

Binary file not shown.

BIN
forge/bin/tr.exe Normal file

Binary file not shown.

View File

@ -7,6 +7,6 @@
<classpathentry kind="lib" path="../../jars/bin/jinput.jar"/>
<classpathentry kind="lib" path="../../jars/bin/lwjgl.jar"/>
<classpathentry kind="lib" path="../../jars/bin/lwjgl_util.jar"/>
<classpathentry kind="lib" path="E:/MCP/jars/bin/paul.jar"/>
<classpathentry kind="lib" path="../../jars/bin/minecraft.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -1,8 +1,28 @@
set HOME=%~dps0
set MCP=%HOME%..
xcopy /Y /E src\* ..\src
echo off
cd %MCP%\src
%MCP%\runtime\bin\python\python_mcp %HOME%\lfcr.py %HOME%\minecraft.patch %HOME%\minecraft-win.patch
%MCP%\runtime\bin\applydiff.exe -uf -p2 < %HOME%\minecraft-win.patch
pause
echo MinecraftForge Windows Setup Program
echo:
pushd .. >nul
cmd /C cleanup.bat
cmd /C decompile.bat
pushd src >nul
..\runtime\bin\python\python_mcp ..\forge\lfcr.py ../forge/modLoaderMP.patch ../forge/modLoaderMP.patch
..\runtime\bin\applydiff.exe -uf -p2 -i ../forge/modLoaderMP.patch
..\runtime\bin\python\python_mcp ..\forge\lfcr.py ../forge/mlprop.patch ../forge/mlprop.patch
..\runtime\bin\applydiff.exe -uf -p1 -i ../forge/mlprop.patch
for /f "delims=" %%a in ('dir /a -d /b /S ..\forge\patches') do (
pushd "%%a" 2>nul
if errorlevel 1 (
..\runtime\bin\python\python_mcp ..\forge\lfcr.py "%%a" "%%a"
..\runtime\bin\applydiff.exe -uf -p2 -i "%%a"
) else popd
)
popd >nul
xcopy /Y /E forge\src\* src
cmd /C updatemd5.bat

23
forge/install/install.sh Normal file
View File

@ -0,0 +1,23 @@
#!/bin/bash
echo "MinecraftForge Linux Setup Program"
echo
pushd .. > /dev/null
./cleanup.sh
./decompile.sh
pushd src > /dev/null
find . -name *.java -exec sed -i 's/\r//g' \{\} \;
patch -p2 -i ../forge/modLoaderMP.patch
patch -p1 -i ../forge/mlprop.patch
for i in `find ../forge/patches/ -type f`
do
patch -p2 -i $i
done
popd > /dev/null
cp -r forge/src/* src
./updatemd5.sh

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,190 @@
--- ../src_base/minecraft/net/minecraft/src/Block.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/Block.java 0000-00-00 00:00:00.000000000 -0000
@@ -4,6 +4,7 @@
package net.minecraft.src;
+import net.minecraft.src.forge.ForgeHooks;
import java.util.ArrayList;
import java.util.Random;
@@ -151,12 +152,14 @@
public float getBlockBrightness(IBlockAccess iblockaccess, int i, int j, int k)
{
- return iblockaccess.getBrightness(i, j, k, lightValue[blockID]);
+ return iblockaccess.getBrightness(i, j, k,
+ getLightValue(iblockaccess,i,j,k));
}
public int getMixedBrightnessForBlock(IBlockAccess iblockaccess, int i, int j, int k)
{
- return iblockaccess.getLightBrightnessForSkyBlocks(i, j, k, lightValue[blockID]);
+ return iblockaccess.getLightBrightnessForSkyBlocks(i, j, k,
+ getLightValue(iblockaccess,i,j,k));
}
public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
@@ -278,24 +281,40 @@
return 1;
}
+ /* FORGE: Metadata-sensitive version.
+ */
+ public int quantityDropped(int i, Random random)
+ {
+ return quantityDropped(random);
+ }
+
public int idDropped(int i, Random random)
{
return blockID;
}
+ /* FORGE: This function isnt called by Minecraft anymore. Use
+ * blockStrength(EntityPlayer,int) instead.
+ */
public float blockStrength(EntityPlayer entityplayer)
{
- if(blockHardness < 0.0F)
- {
- return 0.0F;
- }
- if(!entityplayer.canHarvestBlock(this))
- {
- return 1.0F / blockHardness / 100F;
- } else
- {
- return entityplayer.getCurrentPlayerStrVsBlock(this) / blockHardness / 30F;
- }
+ return blockStrength(entityplayer,0);
+ }
+
+ /* FORGE: This function returns the complete list of drops for a block.
+ */
+ public ArrayList<ItemStack> getBlockDropped(World world,
+ int i, int j, int k, int md) {
+ ArrayList<ItemStack> tr=new ArrayList<ItemStack>();
+
+ int q=quantityDropped(md,world.rand);
+ for(int n=0; n<q; n++) {
+ int id=idDropped(md, world.rand);
+ if(id>0) {
+ tr.add(new ItemStack(id,1,damageDropped(md)));
+ }
+ }
+ return tr;
}
public final void dropBlockAsItem(World world, int i, int j, int k, int l)
@@ -309,20 +328,12 @@
{
return;
}
- int i1 = quantityDropped(world.rand);
- for(int j1 = 0; j1 < i1; j1++)
- {
+ ArrayList<ItemStack> ar=getBlockDropped(world,i,j,k,l);
+ for(ItemStack ist : ar) {
if(world.rand.nextFloat() > f)
- {
continue;
- }
- int k1 = idDropped(l, world.rand);
- if(k1 > 0)
- {
- dropBlockAsItem_do(world, i, j, k, new ItemStack(k1, 1, damageDropped(l)));
- }
+ dropBlockAsItem_do(world, i, j, k, ist);
}
-
}
protected void dropBlockAsItem_do(World world, int i, int j, int k, ItemStack itemstack)
@@ -618,6 +629,86 @@
return iblockaccess.isBlockNormalCube(i, j, k) ? 0.2F : 1.0F;
}
+ /* FORGE: Allow a block to set illumination on a coordinate basis.
+ */
+ public int getLightValue(IBlockAccess iba, int i, int j, int k) {
+ return lightValue[blockID];
+ }
+
+ /* FORGE: Implement and return true if you wish this block to behave
+ * like a ladder when the player is inside.
+ */
+ public boolean isLadder() {
+ return false;
+ }
+
+ /* FORGE: Return true if the block is a normal, solid cube. This
+ * determines indirect power state, entity ejection from blocks, and a few
+ * others.
+ */
+ public boolean isBlockNormalCube(World world, int i, int j, int k) {
+ return blockMaterial.getIsOpaque() && renderAsNormalBlock();
+ }
+
+ /* FORGE: Return true if the block is solid on the given side. This
+ * is used by placement logic. */
+ public boolean isBlockSolidOnSide( World world, int i, int j, int k,
+ int side ) {
+ return isBlockNormalCube(world,i,j,k);
+ }
+
+ /* FORGE: Return true if the player can place a new block in the block
+ * occupied by this one, like water, lava, fire, etc.
+ */
+ public boolean isBlockReplaceable( World world, int i, int j, int k ) {
+ return false;
+ }
+
+ /* FORGE: Return true if this block should set fire and deal fire damage
+ * to entities coming into contact with it, false otherwise.
+ */
+ public boolean isBlockBurning( World world, int i, int j, int k ) {
+ return false;
+ }
+
+ /* FORGE: Return true if this block should be treated as an air block
+ * by the rest of the code, false otherwise. This method is primarily
+ * useful for creating pure logic-blocks that will be invisible
+ * to the player and otherwise interact as air would.
+ */
+ public boolean isAirBlock( World world, int i, int j, int k ) {
+ return false;
+ }
+
+ /* FORGE: Return the block hardness with metadata md.
+ */
+ public float getHardness(int md) {
+ return blockHardness;
+ }
+
+ /* FORGE: Return the block strength of the block at i,j,k against the
+ * player.
+ */
+ public float blockStrength(World world, EntityPlayer player,
+ int i, int j, int k) {
+ int md=world.getBlockMetadata(i,j,k);
+ return blockStrength(player,md);
+ }
+
+ /* FORGE: Return the block strength of a prototypical block with metadata
+ * md against the player.
+ */
+ public float blockStrength(EntityPlayer player, int md) {
+ return ForgeHooks.blockStrength(this,player,md);
+ }
+
+ /* FORGE: Return true if the player can harvest a prototypical block with
+ * metadata md.
+ */
+ public boolean canHarvestBlock(EntityPlayer player, int md) {
+ return ForgeHooks.canHarvestBlock(this,player,md);
+ }
+
static Class _mthclass$(String s)
{
try

View File

@ -0,0 +1,119 @@
--- ../src_base/minecraft/net/minecraft/src/BlockButton.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockButton.java 0000-00-00 00:00:00.000000000 -0000
@@ -41,36 +41,36 @@
public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l)
{
- if(l == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if(l == 2 && world.isBlockSolidOnSide(i, j, k + 1,2))
{
return true;
}
- if(l == 3 && world.isBlockNormalCube(i, j, k - 1))
+ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3))
{
return true;
}
- if(l == 4 && world.isBlockNormalCube(i + 1, j, k))
+ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4))
{
return true;
}
- return l == 5 && world.isBlockNormalCube(i - 1, j, k);
+ return l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5);
}
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- if(world.isBlockNormalCube(i - 1, j, k))
+ if(world.isBlockSolidOnSide(i - 1, j, k,5))
{
return true;
}
- if(world.isBlockNormalCube(i + 1, j, k))
+ if(world.isBlockSolidOnSide(i + 1, j, k,4))
{
return true;
}
- if(world.isBlockNormalCube(i, j, k - 1))
+ if(world.isBlockSolidOnSide(i, j, k - 1,3))
{
return true;
}
- return world.isBlockNormalCube(i, j, k + 1);
+ return world.isBlockSolidOnSide(i, j, k + 1,2);
}
public void onBlockPlaced(World world, int i, int j, int k, int l)
@@ -78,19 +78,19 @@
int i1 = world.getBlockMetadata(i, j, k);
int j1 = i1 & 8;
i1 &= 7;
- if(l == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if(l == 2 && world.isBlockSolidOnSide(i, j, k + 1,2))
{
i1 = 4;
} else
- if(l == 3 && world.isBlockNormalCube(i, j, k - 1))
+ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3))
{
i1 = 3;
} else
- if(l == 4 && world.isBlockNormalCube(i + 1, j, k))
+ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4))
{
i1 = 2;
} else
- if(l == 5 && world.isBlockNormalCube(i - 1, j, k))
+ if(l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5))
{
i1 = 1;
} else
@@ -102,19 +102,19 @@
private int getOrientation(World world, int i, int j, int k)
{
- if(world.isBlockNormalCube(i - 1, j, k))
+ if(world.isBlockSolidOnSide(i - 1, j, k,5))
{
return 1;
}
- if(world.isBlockNormalCube(i + 1, j, k))
+ if(world.isBlockSolidOnSide(i + 1, j, k,4))
{
return 2;
}
- if(world.isBlockNormalCube(i, j, k - 1))
+ if(world.isBlockSolidOnSide(i, j, k - 1,3))
{
return 3;
}
- return !world.isBlockNormalCube(i, j, k + 1) ? 1 : 4;
+ return !world.isBlockSolidOnSide(i, j, k + 1,2) ? 1 : 4;
}
public void onNeighborBlockChange(World world, int i, int j, int k, int l)
@@ -123,19 +123,19 @@
{
int i1 = world.getBlockMetadata(i, j, k) & 7;
boolean flag = false;
- if(!world.isBlockNormalCube(i - 1, j, k) && i1 == 1)
+ if(!world.isBlockSolidOnSide(i - 1, j, k,5) && i1 == 1)
{
flag = true;
}
- if(!world.isBlockNormalCube(i + 1, j, k) && i1 == 2)
+ if(!world.isBlockSolidOnSide(i + 1, j, k,4) && i1 == 2)
{
flag = true;
}
- if(!world.isBlockNormalCube(i, j, k - 1) && i1 == 3)
+ if(!world.isBlockSolidOnSide(i, j, k - 1,3) && i1 == 3)
{
flag = true;
}
- if(!world.isBlockNormalCube(i, j, k + 1) && i1 == 4)
+ if(!world.isBlockSolidOnSide(i, j, k + 1,2) && i1 == 4)
{
flag = true;
}

View File

@ -0,0 +1,31 @@
--- ../src_base/minecraft/net/minecraft/src/BlockChest.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockChest.java 0000-00-00 00:00:00.000000000 -0000
@@ -423,23 +423,23 @@
{
return true;
}
- if(world.isBlockNormalCube(i, j + 1, k))
+ if(world.isBlockSolidOnSide(i, j + 1, k,0))
{
return true;
}
- if(world.getBlockId(i - 1, j, k) == blockID && world.isBlockNormalCube(i - 1, j + 1, k))
+ if(world.getBlockId(i - 1, j, k) == blockID && world.isBlockSolidOnSide(i - 1, j + 1, k,0))
{
return true;
}
- if(world.getBlockId(i + 1, j, k) == blockID && world.isBlockNormalCube(i + 1, j + 1, k))
+ if(world.getBlockId(i + 1, j, k) == blockID && world.isBlockSolidOnSide(i + 1, j + 1, k,0))
{
return true;
}
- if(world.getBlockId(i, j, k - 1) == blockID && world.isBlockNormalCube(i, j + 1, k - 1))
+ if(world.getBlockId(i, j, k - 1) == blockID && world.isBlockSolidOnSide(i, j + 1, k - 1,0))
{
return true;
}
- if(world.getBlockId(i, j, k + 1) == blockID && world.isBlockNormalCube(i, j + 1, k + 1))
+ if(world.getBlockId(i, j, k + 1) == blockID && world.isBlockSolidOnSide(i, j + 1, k + 1,0))
{
return true;
}

View File

@ -0,0 +1,24 @@
--- ../src_base/minecraft/net/minecraft/src/BlockContainer.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockContainer.java 0000-00-00 00:00:00.000000000 -0000
@@ -26,7 +26,7 @@
public void onBlockAdded(World world, int i, int j, int k)
{
super.onBlockAdded(world, i, j, k);
- world.setBlockTileEntity(i, j, k, getBlockEntity());
+ world.setBlockTileEntity(i, j, k, getBlockEntity(world.getBlockMetadata(i,j,k)));
}
public void onBlockRemoval(World world, int i, int j, int k)
@@ -37,6 +37,12 @@
public abstract TileEntity getBlockEntity();
+ /* FORGE: Metadata-sensitive version, to fix 1.8.1 regression.
+ */
+ public TileEntity getBlockEntity(int md) {
+ return getBlockEntity();
+ }
+
public void playBlock(World world, int i, int j, int k, int l, int i1)
{
super.playBlock(world, i, j, k, l, i1);

View File

@ -0,0 +1,48 @@
--- ../src_base/minecraft/net/minecraft/src/BlockCrops.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockCrops.java 0000-00-00 00:00:00.000000000 -0000
@@ -5,6 +5,7 @@
package net.minecraft.src;
import java.util.Random;
+import java.util.ArrayList;
// Referenced classes of package net.minecraft.src:
// BlockFlower, Block, World, EntityItem,
@@ -108,27 +109,16 @@
return 6;
}
- public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f)
- {
- super.dropBlockAsItemWithChance(world, i, j, k, l, f);
- if(world.multiplayerWorld)
- {
- return;
- }
- for(int i1 = 0; i1 < 3; i1++)
- {
- if(world.rand.nextInt(15) <= l)
- {
- float f1 = 0.7F;
- float f2 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
- float f3 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
- float f4 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
- EntityItem entityitem = new EntityItem(world, (float)i + f2, (float)j + f3, (float)k + f4, new ItemStack(Item.seeds));
- entityitem.delayBeforeCanPickup = 10;
- world.entityJoinedWorld(entityitem);
- }
- }
-
+ public ArrayList<ItemStack> getBlockDropped(World world,
+ int i, int j, int k, int md) {
+ ArrayList<ItemStack> tr=new ArrayList<ItemStack>();
+ if(md==7) tr.add(new ItemStack(Item.wheat));
+
+ for(int n=0; n<3; n++) {
+ if(world.rand.nextInt(15) <= md)
+ tr.add(new ItemStack(Item.seeds));
+ }
+ return tr;
}
public int idDropped(int i, Random random)

View File

@ -0,0 +1,20 @@
--- ../src_base/minecraft/net/minecraft/src/BlockDoor.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockDoor.java 0000-00-00 00:00:00.000000000 -0000
@@ -178,7 +178,7 @@
world.setBlockWithNotify(i, j, k, 0);
flag = true;
}
- if(!world.isBlockNormalCube(i, j - 1, k))
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1))
{
world.setBlockWithNotify(i, j, k, 0);
flag = true;
@@ -242,7 +242,7 @@
return false;
} else
{
- return world.isBlockNormalCube(i, j - 1, k) && super.canPlaceBlockAt(world, i, j, k) && super.canPlaceBlockAt(world, i, j + 1, k);
+ return world.isBlockSolidOnSide(i, j - 1, k,1) && super.canPlaceBlockAt(world, i, j, k) && super.canPlaceBlockAt(world, i, j + 1, k);
}
}

View File

@ -0,0 +1,84 @@
--- ../src_base/minecraft/net/minecraft/src/BlockLadder.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockLadder.java 0000-00-00 00:00:00.000000000 -0000
@@ -63,6 +63,11 @@
return super.getSelectedBoundingBoxFromPool(world, i, j, k);
}
+ /* FORGE: Implemented base method, see Block.isLadder */
+ public boolean isLadder() {
+ return true;
+ }
+
public boolean isOpaqueCube()
{
return false;
@@ -80,37 +85,37 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- if(world.isBlockNormalCube(i - 1, j, k))
+ if(world.isBlockSolidOnSide(i - 1, j, k,5))
{
return true;
}
- if(world.isBlockNormalCube(i + 1, j, k))
+ if(world.isBlockSolidOnSide(i + 1, j, k,4))
{
return true;
}
- if(world.isBlockNormalCube(i, j, k - 1))
+ if(world.isBlockSolidOnSide(i, j, k - 1,3))
{
return true;
}
- return world.isBlockNormalCube(i, j, k + 1);
+ return world.isBlockSolidOnSide(i, j, k + 1,2);
}
public void onBlockPlaced(World world, int i, int j, int k, int l)
{
int i1 = world.getBlockMetadata(i, j, k);
- if((i1 == 0 || l == 2) && world.isBlockNormalCube(i, j, k + 1))
+ if((i1 == 0 || l == 2) && world.isBlockSolidOnSide(i, j, k + 1,2))
{
i1 = 2;
}
- if((i1 == 0 || l == 3) && world.isBlockNormalCube(i, j, k - 1))
+ if((i1 == 0 || l == 3) && world.isBlockSolidOnSide(i, j, k - 1,3))
{
i1 = 3;
}
- if((i1 == 0 || l == 4) && world.isBlockNormalCube(i + 1, j, k))
+ if((i1 == 0 || l == 4) && world.isBlockSolidOnSide(i + 1, j, k,4))
{
i1 = 4;
}
- if((i1 == 0 || l == 5) && world.isBlockNormalCube(i - 1, j, k))
+ if((i1 == 0 || l == 5) && world.isBlockSolidOnSide(i - 1, j, k,5))
{
i1 = 5;
}
@@ -121,19 +126,19 @@
{
int i1 = world.getBlockMetadata(i, j, k);
boolean flag = false;
- if(i1 == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if(i1 == 2 && world.isBlockSolidOnSide(i, j, k + 1,2))
{
flag = true;
}
- if(i1 == 3 && world.isBlockNormalCube(i, j, k - 1))
+ if(i1 == 3 && world.isBlockSolidOnSide(i, j, k - 1,3))
{
flag = true;
}
- if(i1 == 4 && world.isBlockNormalCube(i + 1, j, k))
+ if(i1 == 4 && world.isBlockSolidOnSide(i + 1, j, k,4))
{
flag = true;
}
- if(i1 == 5 && world.isBlockNormalCube(i - 1, j, k))
+ if(i1 == 5 && world.isBlockSolidOnSide(i - 1, j, k,5))
{
flag = true;
}

View File

@ -0,0 +1,120 @@
--- ../src_base/minecraft/net/minecraft/src/BlockLever.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockLever.java 0000-00-00 00:00:00.000000000 -0000
@@ -40,44 +40,44 @@
public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l)
{
- if(l == 1 && world.isBlockNormalCube(i, j - 1, k))
+ if(l == 1 && world.isBlockSolidOnSide(i, j - 1, k,1))
{
return true;
}
- if(l == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if(l == 2 && world.isBlockSolidOnSide(i, j, k + 1,2))
{
return true;
}
- if(l == 3 && world.isBlockNormalCube(i, j, k - 1))
+ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3))
{
return true;
}
- if(l == 4 && world.isBlockNormalCube(i + 1, j, k))
+ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4))
{
return true;
}
- return l == 5 && world.isBlockNormalCube(i - 1, j, k);
+ return l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5);
}
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- if(world.isBlockNormalCube(i - 1, j, k))
+ if(world.isBlockSolidOnSide(i - 1, j, k,5))
{
return true;
}
- if(world.isBlockNormalCube(i + 1, j, k))
+ if(world.isBlockSolidOnSide(i + 1, j, k,4))
{
return true;
}
- if(world.isBlockNormalCube(i, j, k - 1))
+ if(world.isBlockSolidOnSide(i, j, k - 1,3))
{
return true;
}
- if(world.isBlockNormalCube(i, j, k + 1))
+ if(world.isBlockSolidOnSide(i, j, k + 1,2))
{
return true;
}
- return world.isBlockNormalCube(i, j - 1, k);
+ return world.isBlockSolidOnSide(i, j - 1, k,1);
}
public void onBlockPlaced(World world, int i, int j, int k, int l)
@@ -86,23 +86,23 @@
int j1 = i1 & 8;
i1 &= 7;
i1 = -1;
- if(l == 1 && world.isBlockNormalCube(i, j - 1, k))
+ if(l == 1 && world.isBlockSolidOnSide(i, j - 1, k,1))
{
i1 = 5 + world.rand.nextInt(2);
}
- if(l == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if(l == 2 && world.isBlockSolidOnSide(i, j, k + 1,2))
{
i1 = 4;
}
- if(l == 3 && world.isBlockNormalCube(i, j, k - 1))
+ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3))
{
i1 = 3;
}
- if(l == 4 && world.isBlockNormalCube(i + 1, j, k))
+ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4))
{
i1 = 2;
}
- if(l == 5 && world.isBlockNormalCube(i - 1, j, k))
+ if(l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5))
{
i1 = 1;
}
@@ -124,27 +124,27 @@
{
int i1 = world.getBlockMetadata(i, j, k) & 7;
boolean flag = false;
- if(!world.isBlockNormalCube(i - 1, j, k) && i1 == 1)
+ if(!world.isBlockSolidOnSide(i - 1, j, k,5) && i1 == 1)
{
flag = true;
}
- if(!world.isBlockNormalCube(i + 1, j, k) && i1 == 2)
+ if(!world.isBlockSolidOnSide(i + 1, j, k,4) && i1 == 2)
{
flag = true;
}
- if(!world.isBlockNormalCube(i, j, k - 1) && i1 == 3)
+ if(!world.isBlockSolidOnSide(i, j, k - 1,3) && i1 == 3)
{
flag = true;
}
- if(!world.isBlockNormalCube(i, j, k + 1) && i1 == 4)
+ if(!world.isBlockSolidOnSide(i, j, k + 1,2) && i1 == 4)
{
flag = true;
}
- if(!world.isBlockNormalCube(i, j - 1, k) && i1 == 5)
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1) && i1 == 5)
{
flag = true;
}
- if(!world.isBlockNormalCube(i, j - 1, k) && i1 == 6)
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1) && i1 == 6)
{
flag = true;
}

View File

@ -0,0 +1,22 @@
--- ../src_base/minecraft/net/minecraft/src/BlockPressurePlate.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockPressurePlate.java 0000-00-00 00:00:00.000000000 -0000
@@ -46,7 +46,8 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- return world.isBlockNormalCube(i, j - 1, k) || world.getBlockId(i, j - 1, k) == Block.fence.blockID;
+ return world.isBlockSolidOnSide(i, j - 1, k,1)
+ || world.getBlockId(i, j - 1, k) == Block.fence.blockID;
}
public void onBlockAdded(World world, int i, int j, int k)
@@ -56,7 +57,8 @@
public void onNeighborBlockChange(World world, int i, int j, int k, int l)
{
boolean flag = false;
- if(!world.isBlockNormalCube(i, j - 1, k) && world.getBlockId(i, j - 1, k) != Block.fence.blockID)
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1)
+ && world.getBlockId(i, j - 1, k) != Block.fence.blockID)
{
flag = true;
}

View File

@ -0,0 +1,55 @@
--- ../src_base/minecraft/net/minecraft/src/BlockRail.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockRail.java 0000-00-00 00:00:00.000000000 -0000
@@ -16,12 +16,12 @@
public static final boolean isRailBlockAt(World world, int i, int j, int k)
{
int l = world.getBlockId(i, j, k);
- return l == Block.rail.blockID || l == Block.railPowered.blockID || l == Block.railDetector.blockID;
+ return Block.blocksList[l] instanceof BlockRail;
}
public static final boolean isRailBlock(int i)
{
- return i == Block.rail.blockID || i == Block.railPowered.blockID || i == Block.railDetector.blockID;
+ return Block.blocksList[i] instanceof BlockRail;
}
protected BlockRail(int i, int j, boolean flag)
@@ -97,7 +97,7 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- return world.isBlockNormalCube(i, j - 1, k);
+ return world.isBlockSolidOnSide(i, j - 1, k,1);
}
public void onBlockAdded(World world, int i, int j, int k)
@@ -121,23 +121,23 @@
j1 &= 7;
}
boolean flag = false;
- if(!world.isBlockNormalCube(i, j - 1, k))
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1))
{
flag = true;
}
- if(j1 == 2 && !world.isBlockNormalCube(i + 1, j, k))
+ if(j1 == 2 && !world.isBlockSolidOnSide(i + 1, j, k,1))
{
flag = true;
}
- if(j1 == 3 && !world.isBlockNormalCube(i - 1, j, k))
+ if(j1 == 3 && !world.isBlockSolidOnSide(i - 1, j, k,1))
{
flag = true;
}
- if(j1 == 4 && !world.isBlockNormalCube(i, j, k - 1))
+ if(j1 == 4 && !world.isBlockSolidOnSide(i, j, k - 1,1))
{
flag = true;
}
- if(j1 == 5 && !world.isBlockNormalCube(i, j, k + 1))
+ if(j1 == 5 && !world.isBlockSolidOnSide(i, j, k + 1,1))
{
flag = true;
}

View File

@ -0,0 +1,20 @@
--- ../src_base/minecraft/net/minecraft/src/BlockRedstoneRepeater.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockRedstoneRepeater.java 0000-00-00 00:00:00.000000000 -0000
@@ -27,7 +27,7 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- if(!world.isBlockNormalCube(i, j - 1, k))
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1))
{
return false;
} else
@@ -38,7 +38,7 @@
public boolean canBlockStay(World world, int i, int j, int k)
{
- if(!world.isBlockNormalCube(i, j - 1, k))
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1))
{
return false;
} else

View File

@ -0,0 +1,30 @@
--- ../src_base/minecraft/net/minecraft/src/BlockRedstoneWire.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockRedstoneWire.java 0000-00-00 00:00:00.000000000 -0000
@@ -3,6 +3,7 @@
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
+import net.minecraft.src.forge.*;
import java.util.*;
@@ -53,7 +54,7 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- return world.isBlockNormalCube(i, j - 1, k);
+ return world.isBlockSolidOnSide(i, j - 1, k, 1);
}
private void updateAndPropagateCurrentStrength(World world, int i, int j, int k)
@@ -451,6 +452,10 @@
{
return false;
}
+ if (Block.blocksList[i1] instanceof IConnectRedstone) {
+ IConnectRedstone icr = (IConnectRedstone) Block.blocksList[i1];
+ return icr.canConnectRedstone(iblockaccess, i, j, k, l);
+ }
if(Block.blocksList[i1].canProvidePower())
{
return true;

View File

@ -0,0 +1,38 @@
--- ../src_base/minecraft/net/minecraft/src/BlockTallGrass.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockTallGrass.java 0000-00-00 00:00:00.000000000 -0000
@@ -4,7 +4,10 @@
package net.minecraft.src;
+import net.minecraft.src.forge.ForgeHooks;
+
import java.util.Random;
+import java.util.ArrayList;
// Referenced classes of package net.minecraft.src:
// BlockFlower, ColorizerGrass, ColorizerFoliage, IBlockAccess,
@@ -79,13 +82,17 @@
public int idDropped(int i, Random random)
{
- if(random.nextInt(8) == 0)
- {
- return Item.seeds.shiftedIndex;
- } else
- {
- return -1;
- }
+ return -1;
+ }
+
+ public ArrayList<ItemStack> getBlockDropped(World world,
+ int i, int j, int k, int md) {
+ ArrayList<ItemStack> tr=new ArrayList<ItemStack>();
+ if(world.rand.nextInt(8)!=0)
+ return tr;
+ ItemStack ist=ForgeHooks.getGrassSeed(world);
+ if(ist!=null) tr.add(ist);
+ return tr;
}
public void harvestBlock(World world, EntityPlayer entityplayer, int i, int j, int k, int l)

View File

@ -0,0 +1,104 @@
--- ../src_base/minecraft/net/minecraft/src/BlockTorch.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockTorch.java 0000-00-00 00:00:00.000000000 -0000
@@ -41,24 +41,24 @@
private boolean func_31032_h(World world, int i, int j, int k)
{
- return world.isBlockNormalCube(i, j, k) || world.getBlockId(i, j, k) == Block.fence.blockID;
+ return world.isBlockSolidOnSide(i, j, k,1) || world.getBlockId(i, j, k) == Block.fence.blockID;
}
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- if(world.isBlockNormalCube(i - 1, j, k))
+ if(world.isBlockSolidOnSide(i - 1, j, k,5))
{
return true;
}
- if(world.isBlockNormalCube(i + 1, j, k))
+ if(world.isBlockSolidOnSide(i + 1, j, k,4))
{
return true;
}
- if(world.isBlockNormalCube(i, j, k - 1))
+ if(world.isBlockSolidOnSide(i, j, k - 1,3))
{
return true;
}
- if(world.isBlockNormalCube(i, j, k + 1))
+ if(world.isBlockSolidOnSide(i, j, k + 1,2))
{
return true;
}
@@ -72,19 +72,19 @@
{
i1 = 5;
}
- if(l == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if(l == 2 && world.isBlockSolidOnSide(i, j, k + 1,2))
{
i1 = 4;
}
- if(l == 3 && world.isBlockNormalCube(i, j, k - 1))
+ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3))
{
i1 = 3;
}
- if(l == 4 && world.isBlockNormalCube(i + 1, j, k))
+ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4))
{
i1 = 2;
}
- if(l == 5 && world.isBlockNormalCube(i - 1, j, k))
+ if(l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5))
{
i1 = 1;
}
@@ -102,19 +102,19 @@
public void onBlockAdded(World world, int i, int j, int k)
{
- if(world.isBlockNormalCube(i - 1, j, k))
+ if(world.isBlockSolidOnSide(i - 1, j, k,5))
{
world.setBlockMetadataWithNotify(i, j, k, 1);
} else
- if(world.isBlockNormalCube(i + 1, j, k))
+ if(world.isBlockSolidOnSide(i + 1, j, k,4))
{
world.setBlockMetadataWithNotify(i, j, k, 2);
} else
- if(world.isBlockNormalCube(i, j, k - 1))
+ if(world.isBlockSolidOnSide(i, j, k - 1,3))
{
world.setBlockMetadataWithNotify(i, j, k, 3);
} else
- if(world.isBlockNormalCube(i, j, k + 1))
+ if(world.isBlockSolidOnSide(i, j, k + 1,2))
{
world.setBlockMetadataWithNotify(i, j, k, 4);
} else
@@ -131,19 +131,19 @@
{
int i1 = world.getBlockMetadata(i, j, k);
boolean flag = false;
- if(!world.isBlockNormalCube(i - 1, j, k) && i1 == 1)
+ if(!world.isBlockSolidOnSide(i - 1, j, k,5) && i1 == 1)
{
flag = true;
}
- if(!world.isBlockNormalCube(i + 1, j, k) && i1 == 2)
+ if(!world.isBlockSolidOnSide(i + 1, j, k,4) && i1 == 2)
{
flag = true;
}
- if(!world.isBlockNormalCube(i, j, k - 1) && i1 == 3)
+ if(!world.isBlockSolidOnSide(i, j, k - 1,3) && i1 == 3)
{
flag = true;
}
- if(!world.isBlockNormalCube(i, j, k + 1) && i1 == 4)
+ if(!world.isBlockSolidOnSide(i, j, k + 1,2) && i1 == 4)
{
flag = true;
}

View File

@ -0,0 +1,36 @@
--- ../src_base/minecraft/net/minecraft/src/BlockTrapDoor.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockTrapDoor.java 0000-00-00 00:00:00.000000000 -0000
@@ -147,7 +147,7 @@
{
j1--;
}
- if(!world.isBlockNormalCube(j1, j, k1))
+ if(!disableValidation && !world.isBlockSolidOnSide(j1, j, k1, (i1&3)+2))
{
world.setBlockWithNotify(i, j, k, 0);
dropBlockAsItem(world, i, j, k, i1);
@@ -189,6 +189,7 @@
public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l)
{
+ if(disableValidation) return true;
if(l == 0)
{
return false;
@@ -213,11 +214,15 @@
{
i--;
}
- return world.isBlockNormalCube(i, j, k);
+ return world.isBlockSolidOnSide(i, j, k, l);
}
public static boolean isTrapdoorOpen(int i)
{
return (i & 4) != 0;
}
+
+ /* FORGE: Set this to allow trapdoors to remain free-floating
+ */
+ public static boolean disableValidation=false;
}

View File

@ -0,0 +1,354 @@
--- ../src_base/minecraft/net/minecraft/src/Chunk.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/Chunk.java 0000-00-00 00:00:00.000000000 -0000
@@ -3,6 +3,7 @@
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
+import net.minecraft.src.forge.*;
import java.io.PrintStream;
import java.util.*;
@@ -26,7 +27,6 @@
hasEntities = false;
lastSaveTime = 0L;
field_35846_u = false;
- world.getClass();
entities = new List[128 / 16];
worldObj = world;
xPosition = i;
@@ -44,11 +44,8 @@
{
this(world, i, j);
blocks = abyte0;
- world.getClass();
data = new NibbleArray(abyte0.length, 7);
- world.getClass();
skylightMap = new NibbleArray(abyte0.length, 7);
- world.getClass();
blocklightMap = new NibbleArray(abyte0.length, 7);
}
@@ -68,16 +65,12 @@
public void generateHeightMap()
{
- worldObj.getClass();
int i = 128 - 1;
for(int j = 0; j < 16; j++)
{
for(int k = 0; k < 16; k++)
{
- worldObj.getClass();
int l = 128 - 1;
- worldObj.getClass();
- worldObj.getClass();
for(int i1 = j << 11 | k << 7; l > 0 && Block.lightOpacity[blocks[(i1 + l) - 1] & 0xff] == 0; l--) { }
heightMap[k << 4 | j] = (byte)l;
if(l < i)
@@ -94,16 +87,12 @@
public void generateSkylightMap()
{
- worldObj.getClass();
int i = 128 - 1;
for(int j = 0; j < 16; j++)
{
for(int l = 0; l < 16; l++)
{
- worldObj.getClass();
int j1 = 128 - 1;
- worldObj.getClass();
- worldObj.getClass();
int k1;
for(k1 = j << 11 | l << 7; j1 > 0 && Block.lightOpacity[blocks[(k1 + j1) - 1] & 0xff] == 0; j1--) { }
heightMap[l << 4 | j] = (byte)j1;
@@ -116,7 +105,6 @@
continue;
}
int l1 = 15;
- worldObj.getClass();
int i2 = 128 - 1;
do
{
@@ -154,7 +142,6 @@
private void func_35839_k()
{
- worldObj.getClass();
if(worldObj.doChunksNearChunkExist(xPosition * 16 + 8, 128 / 2, zPosition * 16 + 8, 16))
{
for(int i = 0; i < 16; i++)
@@ -216,7 +203,6 @@
{
if(l > k)
{
- worldObj.getClass();
if(worldObj.doChunksNearChunkExist(i, 128 / 2, j, 16))
{
for(int i1 = k; i1 < l; i1++)
@@ -237,8 +223,6 @@
{
i1 = j;
}
- worldObj.getClass();
- worldObj.getClass();
for(int j1 = i << 11 | k << 7; i1 > 0 && Block.lightOpacity[blocks[(j1 + i1) - 1] & 0xff] == 0; i1--) { }
if(i1 == l)
{
@@ -251,7 +235,6 @@
lowestBlockHeight = i1;
} else
{
- worldObj.getClass();
int k1 = 128 - 1;
for(int i2 = 0; i2 < 16; i2++)
{
@@ -320,8 +303,6 @@
public int getBlockID(int i, int j, int k)
{
- worldObj.getClass();
- worldObj.getClass();
return blocks[i << 11 | k << 7 | j] & 0xff;
}
@@ -334,8 +315,6 @@
field_35845_c[j1] = -999;
}
int k1 = heightMap[k << 4 | i] & 0xff;
- worldObj.getClass();
- worldObj.getClass();
int l1 = blocks[i << 11 | k << 7 | j] & 0xff;
if(l1 == l && data.getNibble(i, j, k) == i1)
{
@@ -343,12 +322,18 @@
}
int i2 = xPosition * 16 + i;
int j2 = zPosition * 16 + k;
- worldObj.getClass();
- worldObj.getClass();
+
+ if (Block.blocksList[l1] instanceof IOverrideReplace) {
+ IOverrideReplace iovr = (IOverrideReplace) Block.blocksList[l1];
+ if (!iovr.canReplaceBlock(worldObj, i2, j, j2, l))
+ return iovr.getReplacedSuccess();
+ }
+
blocks[i << 11 | k << 7 | j] = (byte)(byte0 & 0xff);
- if(l1 != 0 && !worldObj.multiplayerWorld)
- {
- Block.blocksList[l1].onBlockRemoval(worldObj, i2, j, j2);
+ if(l1 != 0) {
+ if(!worldObj.multiplayerWorld)
+ Block.blocksList[l1].onBlockRemoval(worldObj, i2, j, j2);
+ removeChunkBlockTileEntity(i,j,k);
}
data.setNibble(i, j, k, i1);
if(!worldObj.worldProvider.hasNoSky)
@@ -380,7 +365,7 @@
TileEntity tileentity = getChunkBlockTileEntity(i, j, k);
if(tileentity == null)
{
- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity();
+ tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(i1);
worldObj.setBlockTileEntity(i, j, k, tileentity);
}
if(tileentity != null)
@@ -388,14 +373,6 @@
tileentity.func_35144_b();
}
}
- } else
- if(l1 > 0 && (Block.blocksList[l1] instanceof BlockContainer))
- {
- TileEntity tileentity1 = getChunkBlockTileEntity(i, j, k);
- if(tileentity1 != null)
- {
- tileentity1.func_35144_b();
- }
}
isModified = true;
return true;
@@ -410,8 +387,6 @@
field_35845_c[i1] = -999;
}
int j1 = heightMap[i1] & 0xff;
- worldObj.getClass();
- worldObj.getClass();
int k1 = blocks[i << 11 | k << 7 | j] & 0xff;
if(k1 == l)
{
@@ -419,12 +394,18 @@
}
int l1 = xPosition * 16 + i;
int i2 = zPosition * 16 + k;
- worldObj.getClass();
- worldObj.getClass();
+
+ if (Block.blocksList[k1] instanceof IOverrideReplace) {
+ IOverrideReplace iovr = (IOverrideReplace) Block.blocksList[k1];
+ if (!iovr.canReplaceBlock(worldObj, l1, j, i2, l))
+ return iovr.getReplacedSuccess();
+ }
+
blocks[i << 11 | k << 7 | j] = (byte)(byte0 & 0xff);
- if(k1 != 0)
- {
- Block.blocksList[k1].onBlockRemoval(worldObj, l1, j, i2);
+ if(k1 != 0) {
+ if(!worldObj.multiplayerWorld)
+ Block.blocksList[k1].onBlockRemoval(worldObj, l1, j, i2);
+ removeChunkBlockTileEntity(i,j,k);
}
data.setNibble(i, j, k, 0);
if(Block.lightOpacity[byte0 & 0xff] != 0)
@@ -452,7 +433,7 @@
TileEntity tileentity = getChunkBlockTileEntity(i, j, k);
if(tileentity == null)
{
- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity();
+ tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(0);
worldObj.setBlockTileEntity(i, j, k, tileentity);
}
if(tileentity != null)
@@ -460,14 +441,6 @@
tileentity.func_35144_b();
}
}
- } else
- if(k1 > 0 && (Block.blocksList[k1] instanceof BlockContainer))
- {
- TileEntity tileentity1 = getChunkBlockTileEntity(i, j, k);
- if(tileentity1 != null)
- {
- tileentity1.func_35144_b();
- }
}
isModified = true;
return true;
@@ -594,6 +567,11 @@
{
ChunkPosition chunkposition = new ChunkPosition(i, j, k);
TileEntity tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition);
+ if(tileentity != null && tileentity.isInvalid())
+ {
+ chunkTileEntityMap.remove(chunkposition);
+ tileentity=null;
+ }
if(tileentity == null)
{
int l = getBlockID(i, j, k);
@@ -603,18 +581,23 @@
}
if(tileentity == null)
{
- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity();
+ tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(getBlockMetadata(i,j,k));
worldObj.setBlockTileEntity(xPosition * 16 + i, j, zPosition * 16 + k, tileentity);
}
tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition);
}
- if(tileentity != null && tileentity.isInvalid())
- {
- chunkTileEntityMap.remove(chunkposition);
- return null;
- } else
+ return tileentity;
+ }
+
+ /* FORGE: Used to remove only invalid TileEntities */
+ public void cleanChunkBlockTileEntity(int i, int j, int k)
+ {
+ ChunkPosition chunkposition = new ChunkPosition(i, j, k);
+ if(isChunkLoaded)
{
- return tileentity;
+ TileEntity tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition);
+ if(tileentity!=null && tileentity.isInvalid())
+ chunkTileEntityMap.remove(chunkposition);
}
}
@@ -626,7 +609,7 @@
setChunkBlockTileEntity(i, j, k, tileentity);
if(isChunkLoaded)
{
- worldObj.loadedTileEntityList.add(tileentity);
+ worldObj.addTileEntity(tileentity);
}
}
@@ -643,6 +626,8 @@
return;
} else
{
+ TileEntity old=(TileEntity)chunkTileEntityMap.get(chunkposition);
+ if(old!=null) old.invalidate();
tileentity.validate();
chunkTileEntityMap.put(chunkposition, tileentity);
return;
@@ -777,8 +762,6 @@
{
for(int l2 = k; l2 < j1; l2++)
{
- worldObj.getClass();
- worldObj.getClass();
int l3 = l1 << 11 | l2 << 7 | j;
int l4 = i1 - j;
System.arraycopy(abyte0, k1, blocks, l3, l4);
@@ -792,8 +775,6 @@
{
for(int i3 = k; i3 < j1; i3++)
{
- worldObj.getClass();
- worldObj.getClass();
int i4 = (i2 << 11 | i3 << 7 | j) >> 1;
int i5 = (i1 - j) / 2;
System.arraycopy(abyte0, k1, data.data, i4, i5);
@@ -806,8 +787,6 @@
{
for(int j3 = k; j3 < j1; j3++)
{
- worldObj.getClass();
- worldObj.getClass();
int j4 = (j2 << 11 | j3 << 7 | j) >> 1;
int j5 = (i1 - j) / 2;
System.arraycopy(abyte0, k1, blocklightMap.data, j4, j5);
@@ -820,8 +799,6 @@
{
for(int k3 = k; k3 < j1; k3++)
{
- worldObj.getClass();
- worldObj.getClass();
int k4 = (k2 << 11 | k3 << 7 | j) >> 1;
int k5 = (i1 - j) / 2;
System.arraycopy(abyte0, k1, skylightMap.data, k4, k5);
@@ -830,11 +807,20 @@
}
+ List<TileEntity> invalidList=new ArrayList();
TileEntity tileentity;
for(Iterator iterator = chunkTileEntityMap.values().iterator(); iterator.hasNext(); tileentity.func_35144_b())
{
tileentity = (TileEntity)iterator.next();
+ if( (tileentity.xCoord&15)>=i && (tileentity.xCoord&15)<=l &&
+ tileentity.yCoord>=j && tileentity.yCoord<=i1 &&
+ (tileentity.zCoord&15)>=k && (tileentity.zCoord&15)<=j1) {
+
+ invalidList.add(tileentity);
+ }
}
+ for(TileEntity te : invalidList)
+ te.invalidate();
return k1;
}
@@ -880,7 +866,6 @@
int l = field_35845_c[k];
if(l == -999)
{
- worldObj.getClass();
int i1 = 128 - 1;
for(l = -1; i1 > 0 && l == -1;)
{

View File

@ -0,0 +1,148 @@
--- ../src_base/minecraft/net/minecraft/src/EffectRenderer.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/EffectRenderer.java 0000-00-00 00:00:00.000000000 -0000
@@ -7,6 +7,9 @@
import java.util.*;
import org.lwjgl.opengl.GL11;
+import net.minecraft.src.forge.BlockTextureParticles;
+import net.minecraft.src.forge.ITextureProvider;
+
// Referenced classes of package net.minecraft.src:
// EntityFX, Entity, MathHelper, RenderEngine,
// Tessellator, Block, EntityDiggingFX, World
@@ -16,6 +19,7 @@
public EffectRenderer(World world, RenderEngine renderengine)
{
+ effectList = new ArrayList();
fxLayers = new List[4];
rand = new Random();
if(world != null)
@@ -55,7 +59,18 @@
}
}
-
+ for (int x = 0; x < effectList.size(); x++) {
+ BlockTextureParticles entry = (BlockTextureParticles) effectList
+ .get(x);
+ for (int y = 0; y < entry.effects.size(); y++) {
+ EntityFX entityfx = (EntityFX) entry.effects.get(y);
+ if (entityfx.isDead) {
+ entry.effects.remove(y--);
+ }
+ }
+ if (effectList.size() == 0)
+ effectList.remove(x--);
+ }
}
public void renderParticles(Entity entity, float f)
@@ -94,6 +109,7 @@
for(int k = 0; k < fxLayers[i].size(); k++)
{
EntityFX entityfx = (EntityFX)fxLayers[i].get(k);
+ if(entityfx instanceof EntityDiggingFX) continue;
tessellator.setBrightness(entityfx.func_35115_a(f));
entityfx.renderParticle(tessellator, f, f1, f5, f2, f3, f4);
}
@@ -101,6 +117,21 @@
tessellator.draw();
}
+ Tessellator tessellator = Tessellator.instance;
+ for (int x = 0; x < effectList.size(); x++) {
+ BlockTextureParticles entry = (BlockTextureParticles) effectList
+ .get(x);
+ GL11.glBindTexture(3553 /* GL_TEXTURE_2D */,
+ renderer.getTexture(entry.texture));
+ tessellator.startDrawingQuads();
+ for (int y = 0; y < entry.effects.size(); y++) {
+ EntityFX entityfx = (EntityFX) entry.effects.get(y);
+ tessellator.setBrightness(entityfx.func_35115_a(f));
+ entityfx.renderParticle(tessellator, f, f1, f5, f2, f3, f4);
+ }
+ tessellator.draw();
+ }
+
}
public void func_1187_b(Entity entity, float f)
@@ -132,7 +163,12 @@
{
fxLayers[i].clear();
}
-
+ for (int x = 0; x < effectList.size(); x++) {
+ BlockTextureParticles entry = (BlockTextureParticles) effectList
+ .get(x);
+ entry.effects.clear();
+ }
+ effectList.clear();
}
public void addBlockDestroyEffects(int i, int j, int k, int l, int i1)
@@ -153,7 +189,12 @@
double d1 = (double)j + ((double)l1 + 0.5D) / (double)j1;
double d2 = (double)k + ((double)i2 + 0.5D) / (double)j1;
int j2 = rand.nextInt(6);
- addEffect((new EntityDiggingFX(worldObj, d, d1, d2, d - (double)i - 0.5D, d1 - (double)j - 0.5D, d2 - (double)k - 0.5D, block, j2, i1)).func_4041_a(i, j, k));
+ EntityDiggingFX dig_effect = new EntityDiggingFX(worldObj,
+ d, d1, d2, d - (double) i - 0.5D, d1 - (double) j
+ - 0.5D, d2 - (double) k - 0.5D, block, j2,
+ i1);
+ dig_effect.func_4041_a(i, j, k);
+ addDigParticleEffect(dig_effect, block);
}
}
@@ -198,16 +239,48 @@
{
d = (double)i + block.maxX + (double)f;
}
- addEffect((new EntityDiggingFX(worldObj, d, d1, d2, 0.0D, 0.0D, 0.0D, block, l, worldObj.getBlockMetadata(i, j, k))).func_4041_a(i, j, k).func_407_b(0.2F).func_405_d(0.6F));
+ EntityDiggingFX dig_effect = new EntityDiggingFX(worldObj, d, d1, d2,
+ 0.0D, 0.0D, 0.0D, block, l, worldObj.getBlockMetadata(i, j, k));
+ dig_effect.func_4041_a(i, j, k);
+ dig_effect.func_407_b(0.2F);
+ dig_effect.func_405_d(0.6F);
+ addDigParticleEffect(dig_effect, block);
}
public String getStatistics()
{
return (new StringBuilder()).append("").append(fxLayers[0].size() + fxLayers[1].size() + fxLayers[2].size()).toString();
}
+
+ public void addDigParticleEffect(EntityDiggingFX dig_effect, Block block) {
+ boolean added = false;
+ String comp;
+
+ if (block instanceof ITextureProvider) {
+ comp = ((ITextureProvider) block).getTextureFile();
+ } else {
+ comp = "/terrain.png";
+ }
+ for (int x = 0; x < effectList.size(); x++) {
+ BlockTextureParticles entry = (BlockTextureParticles) effectList
+ .get(x);
+ if (entry.texture.equals(comp)) {
+ entry.effects.add(dig_effect);
+ added = true;
+ }
+ }
+ if (!added) {
+ BlockTextureParticles entry = new BlockTextureParticles();
+ entry.texture = comp;
+ entry.effects.add(dig_effect);
+ effectList.add(entry);
+ }
+ addEffect(dig_effect);
+ }
protected World worldObj;
private List fxLayers[];
+ private List effectList;
private RenderEngine renderer;
private Random rand;
}

View File

@ -0,0 +1,13 @@
--- ../src_base/minecraft/net/minecraft/src/EntityLiving.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/EntityLiving.java 0000-00-00 00:00:00.000000000 -0000
@@ -624,7 +624,9 @@
int i = MathHelper.floor_double(posX);
int j = MathHelper.floor_double(boundingBox.minY);
int k = MathHelper.floor_double(posZ);
- return worldObj.getBlockId(i, j, k) == Block.ladder.blockID;
+ Block block=Block.blocksList[worldObj.getBlockId(i,j,k)];
+ if(block==null) return false;
+ return block.isLadder();
}
public void writeEntityToNBT(NBTTagCompound nbttagcompound)

View File

@ -0,0 +1,76 @@
--- ../src_base/minecraft/net/minecraft/src/EntityPlayer.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/EntityPlayer.java 0000-00-00 00:00:00.000000000 -0000
@@ -4,6 +4,10 @@
package net.minecraft.src;
+import net.minecraft.src.forge.ArmorProperties;
+import net.minecraft.src.forge.ISpecialArmor;
+import net.minecraft.src.forge.ForgeHooks;
+
import java.util.*;
// Referenced classes of package net.minecraft.src:
@@ -485,6 +489,8 @@
worldObj.entityJoinedWorld(entityitem);
}
+ /* FORGE: This isnt called anymore
+ */
public float getCurrentPlayerStrVsBlock(Block block)
{
float f = inventory.getStrVsBlock(block);
@@ -507,6 +513,32 @@
return f;
}
+ /* FORGE: Extended to allow metadata.
+ */
+ public float getCurrentPlayerStrVsBlock(Block block, int md)
+ {
+ float f = 1.0F;
+ ItemStack ist=inventory.getCurrentItem();
+ if(ist!=null) f=ist.getItem().getStrVsBlock(ist,block,md);
+ if(isInsideOfMaterial(Material.water))
+ {
+ f /= 5F;
+ }
+ if(!onGround)
+ {
+ f /= 5F;
+ }
+ if(isPotionActive(Potion.potionDigSpeed))
+ {
+ f *= 1.0F + (float)(getActivePotionEffect(Potion.potionDigSpeed).getAmplifier() + 1) * 0.2F;
+ }
+ if(isPotionActive(Potion.potionDigSlow))
+ {
+ f *= 1.0F - (float)(getActivePotionEffect(Potion.potionDigSlow).getAmplifier() + 1) * 0.2F;
+ }
+ return f;
+ }
+
public boolean canHarvestBlock(Block block)
{
return inventory.canHarvestBlock(block);
@@ -720,7 +752,9 @@
public void destroyCurrentEquippedItem()
{
+ ItemStack orig=inventory.getCurrentItem();
inventory.setInventorySlotContents(inventory.currentItem, null);
+ ForgeHooks.onDestroyCurrentItem(this,orig);
}
public double getYOffset()
@@ -815,6 +849,10 @@
public EnumStatus sleepInBedAt(int i, int j, int k)
{
+ EnumStatus customSleep = ForgeHooks.sleepInBedAt(this, i, j, k);
+ if (customSleep != null) {
+ return customSleep;
+ }
if(!worldObj.multiplayerWorld)
{
if(isPlayerSleeping() || !isEntityAlive())

View File

@ -0,0 +1,36 @@
--- ../src_base/minecraft/net/minecraft/src/EntityRenderer.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/EntityRenderer.java 0000-00-00 00:00:00.000000000 -0000
@@ -4,6 +4,7 @@
package net.minecraft.src;
+import net.minecraft.src.forge.ForgeHooksClient;
import java.awt.image.BufferedImage;
import java.nio.FloatBuffer;
import java.util.Random;
@@ -803,8 +804,12 @@
{
EntityPlayer entityplayer = (EntityPlayer)entityliving;
GL11.glDisable(3008 /*GL_ALPHA_TEST*/);
+ if(!ForgeHooksClient.onBlockHighlight(renderglobal,entityplayer,
+ mc.objectMouseOver,0,
+ entityplayer.inventory.getCurrentItem(),f)) {
renderglobal.drawBlockBreaking(entityplayer, mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), f);
renderglobal.drawSelectionBox(entityplayer, mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), f);
+ }
GL11.glEnable(3008 /*GL_ALPHA_TEST*/);
}
}
@@ -853,8 +858,12 @@
{
EntityPlayer entityplayer1 = (EntityPlayer)entityliving;
GL11.glDisable(3008 /*GL_ALPHA_TEST*/);
+ if(!ForgeHooksClient.onBlockHighlight(renderglobal,entityplayer1,
+ mc.objectMouseOver,0,
+ entityplayer1.inventory.getCurrentItem(),f)) {
renderglobal.drawBlockBreaking(entityplayer1, mc.objectMouseOver, 0, entityplayer1.inventory.getCurrentItem(), f);
renderglobal.drawSelectionBox(entityplayer1, mc.objectMouseOver, 0, entityplayer1.inventory.getCurrentItem(), f);
+ }
GL11.glEnable(3008 /*GL_ALPHA_TEST*/);
}
renderRainSnow(f);

View File

@ -0,0 +1,29 @@
--- ../src_base/minecraft/net/minecraft/src/Explosion.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/Explosion.java 0000-00-00 00:00:00.000000000 -0000
@@ -5,6 +5,7 @@
package net.minecraft.src;
import java.util.*;
+import net.minecraft.src.forge.ISpecialResistance;
// Referenced classes of package net.minecraft.src:
// World, MathHelper, Block, ChunkPosition,
@@ -66,7 +67,17 @@
int i5 = worldObj.getBlockId(j4, k4, l4);
if(i5 > 0)
{
- f1 -= (Block.blocksList[i5].getExplosionResistance(exploder) + 0.3F) * f2;
+ if (Block.blocksList[i5] instanceof ISpecialResistance) {
+ ISpecialResistance isr = (ISpecialResistance) Block.blocksList[i5];
+ f1 -= (isr.getSpecialExplosionResistance(
+ worldObj, j4, k4, l4, explosionX,
+ explosionY, explosionZ, exploder) + 0.3F)
+ * f2;
+ } else {
+ f1 -= (Block.blocksList[i5]
+ .getExplosionResistance(exploder) + 0.3F)
+ * f2;
+ }
}
if(f1 > 0.0F)
{

View File

@ -0,0 +1,58 @@
--- ../src_base/minecraft/net/minecraft/src/FurnaceRecipes.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/FurnaceRecipes.java 0000-00-00 00:00:00.000000000 -0000
@@ -6,6 +6,7 @@
import java.util.HashMap;
import java.util.Map;
+import java.util.Arrays;
// Referenced classes of package net.minecraft.src:
// Block, ItemStack, Item
@@ -21,6 +22,7 @@
private FurnaceRecipes()
{
smeltingList = new HashMap();
+ metaSmeltingList = new HashMap();
addSmelting(Block.oreIron.blockID, new ItemStack(Item.ingotIron));
addSmelting(Block.oreGold.blockID, new ItemStack(Item.ingotGold));
addSmelting(Block.oreDiamond.blockID, new ItemStack(Item.diamond));
@@ -40,11 +42,32 @@
smeltingList.put(Integer.valueOf(i), itemstack);
}
+ /* FORGE: Add a metadata-sensitive furnace recipe.
+ */
+ public void addSmelting(int i, int meta, ItemStack itemstack)
+ {
+ metaSmeltingList.put(Arrays.asList(i,meta), itemstack);
+ }
+
+ /* FORGE: Not used anymore.
+ */
public ItemStack getSmeltingResult(int i)
{
return (ItemStack)smeltingList.get(Integer.valueOf(i));
}
+ /* FORGE: Added to allow metadata-sensitive smelting.
+ */
+ public ItemStack getSmeltingResult(ItemStack src) {
+ ItemStack tr;
+
+ if(src==null) return null;
+ tr=(ItemStack)metaSmeltingList.get(
+ Arrays.asList(src.itemID,src.getItemDamage()));
+ if(tr!=null) return tr;
+ return (ItemStack)smeltingList.get(Integer.valueOf(src.itemID));
+ }
+
public Map getSmeltingList()
{
return smeltingList;
@@ -52,5 +75,6 @@
private static final FurnaceRecipes smeltingBase = new FurnaceRecipes();
private Map smeltingList;
+ private Map metaSmeltingList;
}

View File

@ -0,0 +1,16 @@
--- ../src_base/minecraft/net/minecraft/src/Item.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/Item.java 0000-00-00 00:00:00.000000000 -0000
@@ -76,6 +76,13 @@
return 1.0F;
}
+ /* FORGE: Metadata-sensitive version of getStrVsBlock
+ */
+ public float getStrVsBlock(ItemStack itemstack, Block block, int md)
+ {
+ return getStrVsBlock(itemstack,block);
+ }
+
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
{
return itemstack;

View File

@ -0,0 +1,11 @@
--- ../src_base/minecraft/net/minecraft/src/ItemBlock.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/ItemBlock.java 0000-00-00 00:00:00.000000000 -0000
@@ -62,7 +62,7 @@
{
return false;
}
- if(!entityplayer.func_35190_e(i, j, k))
+ if(entityplayer!=null && !entityplayer.func_35190_e(i, j, k))
{
return false;
}

View File

@ -0,0 +1,23 @@
--- ../src_base/minecraft/net/minecraft/src/ItemBucket.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/ItemBucket.java 0000-00-00 00:00:00.000000000 -0000
@@ -6,6 +6,8 @@
import java.util.Random;
+import net.minecraft.src.forge.MinecraftForge;
+
// Referenced classes of package net.minecraft.src:
// Item, EntityPlayer, Vec3D, MathHelper,
// World, MovingObjectPosition, EnumMovingObjectType, Material,
@@ -60,6 +62,11 @@
{
return itemstack;
}
+ ItemStack customBucket = MinecraftForge.fillCustomBucket(world,
+ i, j, k);
+ if (customBucket != null) {
+ return customBucket;
+ }
if(world.getBlockMaterial(i, j, k) == Material.water && world.getBlockMetadata(i, j, k) == 0)
{
world.setBlockWithNotify(i, j, k, 0);

View File

@ -0,0 +1,45 @@
--- ../src_base/minecraft/net/minecraft/src/ItemDye.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/ItemDye.java 0000-00-00 00:00:00.000000000 -0000
@@ -3,6 +3,7 @@
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
+import net.minecraft.src.forge.ForgeHooks;
import java.util.Random;
@@ -35,13 +36,18 @@
public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l)
{
- if(!entityplayer.func_35190_e(i, j, k))
+ if(entityplayer!=null && !entityplayer.func_35190_e(i, j, k))
{
return false;
}
if(itemstack.getItemDamage() == 15)
{
int i1 = world.getBlockId(i, j, k);
+ if(ForgeHooks.onUseBonemeal(world,i1,i,j,k)) {
+ if(!world.multiplayerWorld)
+ itemstack.stackSize--;
+ return true;
+ }
if(i1 == Block.sapling.blockID)
{
if(!world.multiplayerWorld)
@@ -108,13 +114,7 @@
world.setBlockAndMetadataWithNotify(k1, l1, i2, Block.tallGrass.blockID, 1);
continue;
}
- if(itemRand.nextInt(3) != 0)
- {
- world.setBlockWithNotify(k1, l1, i2, Block.plantYellow.blockID);
- } else
- {
- world.setBlockWithNotify(k1, l1, i2, Block.plantRed.blockID);
- }
+ ForgeHooks.plantGrassPlant(world,k1,l1,i2);
}
}

View File

@ -0,0 +1,11 @@
--- ../src_base/minecraft/net/minecraft/src/ItemFlintAndSteel.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/ItemFlintAndSteel.java 0000-00-00 00:00:00.000000000 -0000
@@ -46,7 +46,7 @@
{
i++;
}
- if(!entityplayer.func_35190_e(i, j, k))
+ if(entityplayer!=null && !entityplayer.func_35190_e(i, j, k))
{
return false;
}

View File

@ -0,0 +1,11 @@
--- ../src_base/minecraft/net/minecraft/src/ItemHoe.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/ItemHoe.java 0000-00-00 00:00:00.000000000 -0000
@@ -21,7 +21,7 @@
public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l)
{
- if(!entityplayer.func_35190_e(i, j, k))
+ if(entityplayer!=null && !entityplayer.func_35190_e(i, j, k))
{
return false;
}

View File

@ -0,0 +1,11 @@
--- ../src_base/minecraft/net/minecraft/src/ItemRedstone.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/ItemRedstone.java 0000-00-00 00:00:00.000000000 -0000
@@ -50,7 +50,7 @@
return false;
}
}
- if(!entityplayer.func_35190_e(i, j, k))
+ if(entityplayer!=null && !entityplayer.func_35190_e(i, j, k))
{
return false;
}

View File

@ -0,0 +1,11 @@
--- ../src_base/minecraft/net/minecraft/src/ItemReed.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/ItemReed.java 0000-00-00 00:00:00.000000000 -0000
@@ -52,7 +52,7 @@
i++;
}
}
- if(!entityplayer.func_35190_e(i, j, k))
+ if(entityplayer!=null && !entityplayer.func_35190_e(i, j, k))
{
return false;
}

View File

@ -0,0 +1,42 @@
--- ../src_base/minecraft/net/minecraft/src/ItemRenderer.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/ItemRenderer.java 0000-00-00 00:00:00.000000000 -0000
@@ -5,6 +5,10 @@
package net.minecraft.src;
import net.minecraft.client.Minecraft;
+import net.minecraft.src.forge.ForgeHooksClient;
+import net.minecraft.src.forge.ICustomItemRenderer;
+import net.minecraft.src.forge.MinecraftForgeClient;
+
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL13;
@@ -32,18 +36,27 @@
public void renderItem(EntityLiving entityliving, ItemStack itemstack)
{
GL11.glPushMatrix();
- if(itemstack.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
+ ICustomItemRenderer customRenderer = MinecraftForgeClient.getCustomItemRenderer(itemstack.itemID);
+
+ if (customRenderer != null) {
+ GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/terrain.png"));
+ ForgeHooksClient.overrideTexture (itemstack.getItem());
+ ForgeHooksClient.renderCustomItem(customRenderer, renderBlocksInstance, itemstack.itemID, itemstack.getItemDamage(), entityliving.getEntityBrightness(1.0F));
+ } else if(itemstack.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
{
GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/terrain.png"));
+ ForgeHooksClient.overrideTexture (Block.blocksList[itemstack.itemID]);
renderBlocksInstance.renderBlockOnInventory(Block.blocksList[itemstack.itemID], itemstack.getItemDamage(), 1.0F);
} else
{
if(itemstack.itemID < 256)
{
GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/terrain.png"));
+ ForgeHooksClient.overrideTexture (Block.blocksList[itemstack.itemID]);
} else
{
GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/gui/items.png"));
+ ForgeHooksClient.overrideTexture (Item.itemsList[itemstack.itemID]);
}
Tessellator tessellator = Tessellator.instance;
int i = entityliving.getItemIcon(itemstack);

View File

@ -0,0 +1,11 @@
--- ../src_base/minecraft/net/minecraft/src/ItemSeeds.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/ItemSeeds.java 0000-00-00 00:00:00.000000000 -0000
@@ -24,7 +24,7 @@
{
return false;
}
- if(!entityplayer.func_35190_e(i, j, k) || !entityplayer.func_35190_e(i, j + 1, k))
+ if(entityplayer!=null && (!entityplayer.func_35190_e(i, j, k) || !entityplayer.func_35190_e(i, j + 1, k)))
{
return false;
}

View File

@ -0,0 +1,36 @@
--- ../src_base/minecraft/net/minecraft/src/ItemTool.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/ItemTool.java 0000-00-00 00:00:00.000000000 -0000
@@ -4,6 +4,8 @@
package net.minecraft.src;
+import java.util.Arrays;
+import net.minecraft.src.forge.ForgeHooks;
// Referenced classes of package net.minecraft.src:
// Item, EnumToolMaterial, ItemStack, Block,
@@ -37,6 +39,14 @@
return 1.0F;
}
+ /* FORGE: Overridden to allow custom tool effectiveness
+ */
+ public float getStrVsBlock(ItemStack itemstack, Block block, int md) {
+ if(ForgeHooks.isToolEffective(itemstack,block,md))
+ return efficiencyOnProperMaterial;
+ return getStrVsBlock(itemstack,block);
+ }
+
public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
{
itemstack.damageItem(2, entityliving1);
@@ -60,7 +70,7 @@
}
private Block blocksEffectiveAgainst[];
- private float efficiencyOnProperMaterial;
- private int damageVsEntity;
+ public float efficiencyOnProperMaterial;
+ public int damageVsEntity;
protected EnumToolMaterial toolMaterial;
}

View File

@ -0,0 +1,10 @@
--- ../src_base/minecraft/net/minecraft/src/MovingObjectPosition.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/MovingObjectPosition.java 0000-00-00 00:00:00.000000000 -0000
@@ -35,4 +35,7 @@
public int sideHit;
public Vec3D hitVec;
public Entity entityHit;
+
+ // Added for RedPower subblocks.
+ public int subHit=-1;
}

View File

@ -0,0 +1,18 @@
--- ../src_base/minecraft/net/minecraft/src/PlayerController.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/PlayerController.java 0000-00-00 00:00:00.000000000 -0000
@@ -3,6 +3,7 @@
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
+import net.minecraft.src.forge.*;
import net.minecraft.client.Minecraft;
@@ -64,6 +65,7 @@
if(itemstack1.stackSize == 0)
{
entityplayer.inventory.mainInventory[entityplayer.inventory.currentItem] = null;
+ ForgeHooks.onDestroyCurrentItem(entityplayer,itemstack1);
}
return true;
} else

View File

@ -0,0 +1,57 @@
--- ../src_base/minecraft/net/minecraft/src/PlayerControllerMP.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/PlayerControllerMP.java 0000-00-00 00:00:00.000000000 -0000
@@ -4,6 +4,9 @@
package net.minecraft.src;
+import net.minecraft.src.forge.IUseItemFirst;
+import net.minecraft.src.forge.ForgeHooks;
+
import net.minecraft.client.Minecraft;
// Referenced classes of package net.minecraft.src:
@@ -91,7 +94,7 @@
{
Block.blocksList[i1].onBlockClicked(mc.theWorld, i, j, k, mc.thePlayer);
}
- if(i1 > 0 && Block.blocksList[i1].blockStrength(mc.thePlayer) >= 1.0F)
+ if(i1 > 0 && Block.blocksList[i1].blockStrength(mc.theWorld,mc.thePlayer,i,j,k) >= 1.0F)
{
sendBlockRemoved(i, j, k, l);
} else
@@ -137,7 +140,7 @@
return;
}
Block block = Block.blocksList[i1];
- curBlockDamageMP += block.blockStrength(mc.thePlayer);
+ curBlockDamageMP += block.blockStrength(mc.theWorld,mc.thePlayer,i,j,k);
if(stepSoundTickCounter % 4F == 0.0F && block != null)
{
mc.sndManager.playSound(block.stepSound.stepSoundDir2(), (float)i + 0.5F, (float)j + 0.5F, (float)k + 0.5F, (block.stepSound.getVolume() + 1.0F) / 8F, block.stepSound.getPitch() * 0.5F);
@@ -204,6 +207,13 @@
{
syncCurrentPlayItem();
netClientHandler.addToSendQueue(new Packet15Place(i, j, k, l, entityplayer.inventory.getCurrentItem()));
+
+ if (itemstack != null && itemstack.getItem() instanceof IUseItemFirst) {
+ IUseItemFirst iuif = (IUseItemFirst) itemstack.getItem();
+ if (iuif.onItemUseFirst(itemstack, entityplayer, world, i, j, k, l)) {
+ return true;
+ }
+ }
int i1 = world.getBlockId(i, j, k);
if(i1 > 0 && Block.blocksList[i1].blockActivated(world, i, j, k, entityplayer))
{
@@ -223,7 +233,11 @@
return flag;
} else
{
- return itemstack.useItem(entityplayer, world, i, j, k, l);
+ if(!itemstack.useItem(entityplayer, world, i, j, k, l))
+ return false;
+ if(itemstack.stackSize == 0)
+ ForgeHooks.onDestroyCurrentItem(entityplayer,itemstack);
+ return true;
}
}

View File

@ -0,0 +1,64 @@
--- ../src_base/minecraft/net/minecraft/src/PlayerControllerSP.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/PlayerControllerSP.java 0000-00-00 00:00:00.000000000 -0000
@@ -3,6 +3,8 @@
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
+import net.minecraft.src.forge.IUseItemFirst;
+import net.minecraft.src.forge.ForgeHooks;
import net.minecraft.client.Minecraft;
@@ -42,7 +44,7 @@
int j1 = mc.theWorld.getBlockMetadata(i, j, k);
boolean flag = super.sendBlockRemoved(i, j, k, l);
ItemStack itemstack = mc.thePlayer.getCurrentEquippedItem();
- boolean flag1 = mc.thePlayer.canHarvestBlock(Block.blocksList[i1]);
+ boolean flag1 = Block.blocksList[i1].canHarvestBlock(mc.thePlayer,j1);
if(itemstack != null)
{
itemstack.onDestroyBlock(i1, i, j, k, mc.thePlayer);
@@ -71,7 +73,7 @@
{
Block.blocksList[i1].onBlockClicked(mc.theWorld, i, j, k, mc.thePlayer);
}
- if(i1 > 0 && Block.blocksList[i1].blockStrength(mc.thePlayer) >= 1.0F)
+ if(i1 > 0 && Block.blocksList[i1].blockStrength(mc.theWorld,mc.thePlayer,i,j,k) >= 1.0F)
{
sendBlockRemoved(i, j, k, l);
}
@@ -102,7 +104,7 @@
return;
}
Block block = Block.blocksList[i1];
- curBlockDamage += block.blockStrength(mc.thePlayer);
+ curBlockDamage += block.blockStrength(mc.theWorld,mc.thePlayer,i,j,k);
if(field_1069_h % 4F == 0.0F && block != null)
{
mc.sndManager.playSound(block.stepSound.stepSoundDir2(), (float)i + 0.5F, (float)j + 0.5F, (float)k + 0.5F, (block.stepSound.getVolume() + 1.0F) / 8F, block.stepSound.getPitch() * 0.5F);
@@ -165,6 +167,12 @@
public boolean sendPlaceBlock(EntityPlayer entityplayer, World world, ItemStack itemstack, int i, int j, int k, int l)
{
+ if (itemstack != null && itemstack.getItem() instanceof IUseItemFirst) {
+ IUseItemFirst iuif = (IUseItemFirst) itemstack.getItem();
+ if (iuif.onItemUseFirst(itemstack, entityplayer, world, i, j, k, l)) {
+ return true;
+ }
+ }
int i1 = world.getBlockId(i, j, k);
if(i1 > 0 && Block.blocksList[i1].blockActivated(world, i, j, k, entityplayer))
{
@@ -175,7 +183,11 @@
return false;
} else
{
- return itemstack.useItem(entityplayer, world, i, j, k, l);
+ if(!itemstack.useItem(entityplayer, world, i, j, k, l))
+ return false;
+ if(itemstack.stackSize == 0)
+ ForgeHooks.onDestroyCurrentItem(entityplayer,itemstack);
+ return true;
}
}

View File

@ -0,0 +1,74 @@
--- ../src_base/minecraft/net/minecraft/src/RenderBlocks.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/RenderBlocks.java 0000-00-00 00:00:00.000000000 -0000
@@ -2980,7 +2980,7 @@
colorBlueTopRight *= f27;
int j2 = block.getBlockTexture(blockAccess, i, j, k, 2);
renderEastFace(block, i, j, k, j2);
- if(cfgGrassFix && j2 == 3 && overrideBlockTexture < 0)
+ if(Tessellator.instance.defaultTexture && cfgGrassFix && j2 == 3 && overrideBlockTexture < 0)
{
colorRedTopLeft *= f;
colorRedBottomLeft *= f;
@@ -3085,7 +3085,7 @@
colorBlueTopRight *= f28;
int k2 = block.getBlockTexture(blockAccess, i, j, k, 3);
renderWestFace(block, i, j, k, block.getBlockTexture(blockAccess, i, j, k, 3));
- if(cfgGrassFix && k2 == 3 && overrideBlockTexture < 0)
+ if(Tessellator.instance.defaultTexture && cfgGrassFix && k2 == 3 && overrideBlockTexture < 0)
{
colorRedTopLeft *= f;
colorRedBottomLeft *= f;
@@ -3190,7 +3190,7 @@
colorBlueTopRight *= f29;
int l2 = block.getBlockTexture(blockAccess, i, j, k, 4);
renderNorthFace(block, i, j, k, l2);
- if(cfgGrassFix && l2 == 3 && overrideBlockTexture < 0)
+ if(Tessellator.instance.defaultTexture && cfgGrassFix && l2 == 3 && overrideBlockTexture < 0)
{
colorRedTopLeft *= f;
colorRedBottomLeft *= f;
@@ -3295,7 +3295,7 @@
colorBlueTopRight *= f30;
int i3 = block.getBlockTexture(blockAccess, i, j, k, 5);
renderSouthFace(block, i, j, k, i3);
- if(cfgGrassFix && i3 == 3 && overrideBlockTexture < 0)
+ if(Tessellator.instance.defaultTexture && cfgGrassFix && i3 == 3 && overrideBlockTexture < 0)
{
colorRedTopLeft *= f;
colorRedBottomLeft *= f;
@@ -3388,7 +3388,7 @@
tessellator.setColorOpaque_F(f11, f14, f17);
int i1 = block.getBlockTexture(blockAccess, i, j, k, 2);
renderEastFace(block, i, j, k, i1);
- if(cfgGrassFix && i1 == 3 && overrideBlockTexture < 0)
+ if(Tessellator.instance.defaultTexture && cfgGrassFix && i1 == 3 && overrideBlockTexture < 0)
{
tessellator.setColorOpaque_F(f11 * f, f14 * f1, f17 * f2);
renderEastFace(block, i, j, k, 38);
@@ -3401,7 +3401,7 @@
tessellator.setColorOpaque_F(f11, f14, f17);
int j1 = block.getBlockTexture(blockAccess, i, j, k, 3);
renderWestFace(block, i, j, k, j1);
- if(cfgGrassFix && j1 == 3 && overrideBlockTexture < 0)
+ if(Tessellator.instance.defaultTexture && cfgGrassFix && j1 == 3 && overrideBlockTexture < 0)
{
tessellator.setColorOpaque_F(f11 * f, f14 * f1, f17 * f2);
renderWestFace(block, i, j, k, 38);
@@ -3414,7 +3414,7 @@
tessellator.setColorOpaque_F(f12, f15, f18);
int k1 = block.getBlockTexture(blockAccess, i, j, k, 4);
renderNorthFace(block, i, j, k, k1);
- if(cfgGrassFix && k1 == 3 && overrideBlockTexture < 0)
+ if(Tessellator.instance.defaultTexture && cfgGrassFix && k1 == 3 && overrideBlockTexture < 0)
{
tessellator.setColorOpaque_F(f12 * f, f15 * f1, f18 * f2);
renderNorthFace(block, i, j, k, 38);
@@ -3427,7 +3427,7 @@
tessellator.setColorOpaque_F(f12, f15, f18);
int l1 = block.getBlockTexture(blockAccess, i, j, k, 5);
renderSouthFace(block, i, j, k, l1);
- if(cfgGrassFix && l1 == 3 && overrideBlockTexture < 0)
+ if(Tessellator.instance.defaultTexture && cfgGrassFix && l1 == 3 && overrideBlockTexture < 0)
{
tessellator.setColorOpaque_F(f12 * f, f15 * f1, f18 * f2);
renderSouthFace(block, i, j, k, 38);

View File

@ -0,0 +1,21 @@
--- ../src_base/minecraft/net/minecraft/src/RenderEngine.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/RenderEngine.java 0000-00-00 00:00:00.000000000 -0000
@@ -128,6 +128,9 @@
}
try
{
+ if(Tessellator.renderingWorldRenderer) {
+ System.out.printf("Warning: Texture %s not preloaded, will cause render glitches!\n",s);
+ }
singleIntBuffer.clear();
GLAllocation.generateTextureNames(singleIntBuffer);
int i = singleIntBuffer.get(0);
@@ -667,7 +670,7 @@
private GameSettings options;
public boolean clampTexture;
public boolean blurTexture;
- private TexturePackList texturePack;
+ public TexturePackList texturePack;
private BufferedImage missingTextureImage;
}

View File

@ -0,0 +1,24 @@
--- ../src_base/minecraft/net/minecraft/src/RenderGlobal.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/RenderGlobal.java 0000-00-00 00:00:00.000000000 -0000
@@ -1635,8 +1635,8 @@
}
public List tileEntities;
- private World worldObj;
- private RenderEngine renderEngine;
+ public World worldObj;
+ public RenderEngine renderEngine;
private List worldRenderersToUpdate;
private WorldRenderer sortedWorldRenderers[];
private WorldRenderer worldRenderers[];
@@ -1644,8 +1644,8 @@
private int renderChunksTall;
private int renderChunksDeep;
private int glRenderListBase;
- private Minecraft mc;
- private RenderBlocks globalRenderBlocks;
+ public Minecraft mc;
+ public RenderBlocks globalRenderBlocks;
private IntBuffer glOcclusionQueryBase;
private boolean occlusionEnabled;
private int cloudOffsetX;

View File

@ -0,0 +1,114 @@
--- ../src_base/minecraft/net/minecraft/src/RenderItem.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/RenderItem.java 0000-00-00 00:00:00.000000000 -0000
@@ -4,6 +4,10 @@
package net.minecraft.src;
+import net.minecraft.src.forge.ForgeHooksClient;
+import net.minecraft.src.forge.ICustomItemRenderer;
+import net.minecraft.src.forge.MinecraftForgeClient;
+
import java.util.Random;
import org.lwjgl.opengl.GL11;
@@ -47,10 +51,36 @@
}
GL11.glTranslatef((float)d, (float)d1 + f2, (float)d2);
GL11.glEnable(32826 /*GL_RESCALE_NORMAL_EXT*/);
- if(itemstack.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
+
+ ICustomItemRenderer customRenderer = MinecraftForgeClient.getCustomItemRenderer(itemstack.itemID);
+
+ if (customRenderer != null) {
+ GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F);
+ loadTexture("/terrain.png");
+ ForgeHooksClient.overrideTexture(itemstack.getItem());
+ float f4 = 0.25F;
+ f4 = 0.5F;
+ GL11.glScalef(f4, f4, f4);
+ for(int j = 0; j < byte0; j++)
+ {
+ GL11.glPushMatrix();
+ if(j > 0)
+ {
+ float f5 = ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / f4;
+ float f7 = ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / f4;
+ float f9 = ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / f4;
+ GL11.glTranslatef(f5, f7, f9);
+ }
+ ForgeHooksClient.renderCustomItem(customRenderer, renderBlocks,
+ itemstack.itemID, itemstack.getItemDamage(),
+ entityitem.getEntityBrightness(f1));
+ GL11.glPopMatrix();
+ }
+ } else if(itemstack.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
{
GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F);
loadTexture("/terrain.png");
+ ForgeHooksClient.overrideTexture(Block.blocksList[itemstack.itemID]);
float f4 = 0.25F;
int j = Block.blocksList[itemstack.itemID].getRenderType();
if(j == 1 || j == 19 || j == 12 || j == 2)
@@ -80,9 +110,11 @@
if(itemstack.itemID < 256)
{
loadTexture("/terrain.png");
+ ForgeHooksClient.overrideTexture(Block.blocksList[itemstack.itemID]);
} else
{
loadTexture("/gui/items.png");
+ ForgeHooksClient.overrideTexture(Item.itemsList[itemstack.itemID]);
}
Tessellator tessellator = Tessellator.instance;
float f5 = (float)((i % 16) * 16 + 0) / 256F;
@@ -129,10 +161,37 @@
public void drawItemIntoGui(FontRenderer fontrenderer, RenderEngine renderengine, int i, int j, int k, int l, int i1)
{
- if(i < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[i].getRenderType()))
+ ICustomItemRenderer customRenderer = MinecraftForgeClient.getCustomItemRenderer(i);
+ if (customRenderer != null) {
+ int j1 = i;
+ renderengine.bindTexture(renderengine.getTexture("/terrain.png"));
+ Item item = Item.itemsList[i];
+ ForgeHooksClient.overrideTexture (Item.itemsList [i]);
+ GL11.glPushMatrix();
+ GL11.glTranslatef(l - 2, i1 + 3, -3F);
+ GL11.glScalef(10F, 10F, 10F);
+ GL11.glTranslatef(1.0F, 0.5F, 1.0F);
+ GL11.glScalef(1.0F, 1.0F, -1F);
+ GL11.glRotatef(210F, 1.0F, 0.0F, 0.0F);
+ GL11.glRotatef(45F, 0.0F, 1.0F, 0.0F);
+ int l1 = Item.itemsList[i].getColorFromDamage(j);
+ float f2 = (float)(l1 >> 16 & 0xff) / 255F;
+ float f4 = (float)(l1 >> 8 & 0xff) / 255F;
+ float f5 = (float)(l1 & 0xff) / 255F;
+ if(field_27004_a)
+ {
+ GL11.glColor4f(f2, f4, f5, 1.0F);
+ }
+ GL11.glRotatef(-90F, 0.0F, 1.0F, 0.0F);
+ renderBlocks.useInventoryTint = field_27004_a;
+ ForgeHooksClient.renderCustomItem(customRenderer, renderBlocks, i, j, 1.0F);
+ renderBlocks.useInventoryTint = true;
+ GL11.glPopMatrix();
+ } else if(i < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[i].getRenderType()))
{
int j1 = i;
renderengine.bindTexture(renderengine.getTexture("/terrain.png"));
+ ForgeHooksClient.overrideTexture (Block.blocksList[i]);
Block block = Block.blocksList[j1];
GL11.glPushMatrix();
GL11.glTranslatef(l - 2, i1 + 3, -3F);
@@ -161,9 +220,11 @@
if(i < 256)
{
renderengine.bindTexture(renderengine.getTexture("/terrain.png"));
+ ForgeHooksClient.overrideTexture (Block.blocksList[i]);
} else
{
renderengine.bindTexture(renderengine.getTexture("/gui/items.png"));
+ ForgeHooksClient.overrideTexture(Item.itemsList[i]);
}
int k1 = Item.itemsList[i].getColorFromDamage(j);
float f = (float)(k1 >> 16 & 0xff) / 255F;

View File

@ -0,0 +1,26 @@
--- ../src_base/minecraft/net/minecraft/src/RenderPlayer.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/RenderPlayer.java 0000-00-00 00:00:00.000000000 -0000
@@ -4,6 +4,7 @@
package net.minecraft.src;
+import net.minecraft.src.forge.IArmorTextureProvider;
import net.minecraft.client.Minecraft;
import org.lwjgl.opengl.GL11;
@@ -34,7 +35,14 @@
if(item instanceof ItemArmor)
{
ItemArmor itemarmor = (ItemArmor)item;
- loadTexture((new StringBuilder()).append("/armor/").append(armorFilenamePrefix[itemarmor.renderIndex]).append("_").append(i != 2 ? 1 : 2).append(".png").toString());
+ if ( item instanceof IArmorTextureProvider )
+ {
+ loadTexture( ((IArmorTextureProvider)item).getArmorTextureFile(itemstack) );
+ }
+ else
+ {
+ loadTexture((new StringBuilder()).append("/armor/").append(armorFilenamePrefix[itemarmor.renderIndex]).append("_").append(i != 2 ? 1 : 2).append(".png").toString());
+ }
ModelBiped modelbiped = i != 2 ? modelArmorChestplate : modelArmor;
modelbiped.bipedHead.showModel = i == 0;
modelbiped.bipedHeadwear.showModel = i == 0;

View File

@ -0,0 +1,18 @@
--- ../src_base/minecraft/net/minecraft/src/SlotCrafting.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/SlotCrafting.java 0000-00-00 00:00:00.000000000 -0000
@@ -3,6 +3,7 @@
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
+import net.minecraft.src.forge.ForgeHooks;
// Referenced classes of package net.minecraft.src:
@@ -60,6 +61,7 @@
thePlayer.addStat(AchievementList.buildSword, 1);
}
ModLoader.TakenFromCrafting(thePlayer, itemstack, craftMatrix);
+ ForgeHooks.onTakenFromCrafting(thePlayer, itemstack, craftMatrix);
for(int i = 0; i < craftMatrix.getSizeInventory(); i++)
{
ItemStack itemstack1 = craftMatrix.getStackInSlot(i);

View File

@ -0,0 +1,188 @@
--- ../src_base/minecraft/net/minecraft/src/Tessellator.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/Tessellator.java 0000-00-00 00:00:00.000000000 -0000
@@ -5,6 +5,7 @@
package net.minecraft.src;
import java.nio.*;
+import java.util.*;
import org.lwjgl.opengl.*;
// Referenced classes of package net.minecraft.src:
@@ -13,8 +14,7 @@
public class Tessellator
{
- private Tessellator(int i)
- {
+ public Tessellator() {
vertexCount = 0;
hasColor = false;
hasTexture = false;
@@ -24,21 +24,10 @@
addedVertices = 0;
isColorDisabled = false;
isDrawing = false;
- useVBO = false;
vboIndex = 0;
- vboCount = 10;
- bufferSize = i;
- byteBuffer = GLAllocation.createDirectByteBuffer(i * 4);
- intBuffer = byteBuffer.asIntBuffer();
- floatBuffer = byteBuffer.asFloatBuffer();
- shortBuffer = byteBuffer.asShortBuffer();
- rawBuffer = new int[i];
- useVBO = tryVBO && GLContext.getCapabilities().GL_ARB_vertex_buffer_object;
- if(useVBO)
- {
- vertexBuffers = GLAllocation.createDirectIntBuffer(vboCount);
- ARBVertexBufferObject.glGenBuffersARB(vertexBuffers);
- }
+
+ rawBuffer=null;
+ rawBufferSize=0;
}
public void draw()
@@ -48,12 +37,20 @@
throw new IllegalStateException("Not tesselating!");
}
isDrawing = false;
- if(vertexCount > 0)
- {
+ int offs=0;
+ while(offs < vertexCount) {
+ int vtc;
+ if(drawMode == 7 && convertQuadsToTriangles) {
+ vtc=Math.min(vertexCount-offs,trivertsInBuffer);
+ } else {
+ vtc=Math.min(vertexCount-offs,nativeBufferSize>>5);
+ }
+
intBuffer.clear();
- intBuffer.put(rawBuffer, 0, rawBufferIndex);
+ intBuffer.put(rawBuffer, offs*8, vtc*8);
byteBuffer.position(0);
- byteBuffer.limit(rawBufferIndex * 4);
+ byteBuffer.limit(vtc*32);
+ offs+=vtc;
if(useVBO)
{
vboIndex = (vboIndex + 1) % vboCount;
@@ -121,10 +118,10 @@
GL11.glEnableClientState(32884 /*GL_VERTEX_ARRAY_EXT*/);
if(drawMode == 7 && convertQuadsToTriangles)
{
- GL11.glDrawArrays(4, 0, vertexCount);
+ GL11.glDrawArrays(4, 0, vtc);
} else
{
- GL11.glDrawArrays(drawMode, 0, vertexCount);
+ GL11.glDrawArrays(drawMode, 0, vtc);
}
GL11.glDisableClientState(32884 /*GL_VERTEX_ARRAY_EXT*/);
if(hasTexture)
@@ -146,6 +143,10 @@
GL11.glDisableClientState(32885 /*GL_NORMAL_ARRAY_EXT*/);
}
}
+ if(rawBufferSize>0x20000 && rawBufferIndex<(rawBufferSize<<3)) {
+ rawBufferSize=0;
+ rawBuffer=null;
+ }
reset();
}
@@ -265,6 +266,15 @@
public void addVertex(double d, double d1, double d2)
{
+ if(rawBufferIndex >= rawBufferSize-32) {
+ if(rawBufferSize==0) {
+ rawBufferSize=0x10000;
+ rawBuffer=new int[rawBufferSize];
+ } else {
+ rawBufferSize*=2;
+ rawBuffer=Arrays.copyOf(rawBuffer,rawBufferSize);
+ }
+ }
addedVertices++;
if(drawMode == 7 && convertQuadsToTriangles && addedVertices % 4 == 0)
{
@@ -314,11 +324,6 @@
rawBuffer[rawBufferIndex + 2] = Float.floatToRawIntBits((float)(d2 + zOffset));
rawBufferIndex += 8;
vertexCount++;
- if(vertexCount % 4 == 0 && rawBufferIndex >= bufferSize - 32)
- {
- draw();
- isDrawing = true;
- }
}
public void setColorOpaque_I(int i)
@@ -367,10 +372,7 @@
private static boolean convertQuadsToTriangles = false;
private static boolean tryVBO = false;
- private ByteBuffer byteBuffer;
- private IntBuffer intBuffer;
- private FloatBuffer floatBuffer;
- private ShortBuffer shortBuffer;
+ private static boolean useVBO = false;
private int rawBuffer[];
private int vertexCount;
private double textureU;
@@ -384,17 +386,43 @@
private int rawBufferIndex;
private int addedVertices;
private boolean isColorDisabled;
- private int drawMode;
- private double xOffset;
- private double yOffset;
- private double zOffset;
+ public int drawMode;
+ public double xOffset;
+ public double yOffset;
+ public double zOffset;
private int normal;
- public static final Tessellator instance = new Tessellator(0x200000);
- private boolean isDrawing;
- private boolean useVBO;
- private IntBuffer vertexBuffers;
+ public boolean isDrawing;
private int vboIndex;
- private int vboCount;
- private int bufferSize;
+ public static boolean renderingWorldRenderer=false;
+ public boolean defaultTexture=false;
+ private int rawBufferSize;
+ private static int vboCount;
+ private static IntBuffer vertexBuffers;
+ private static int nativeBufferSize;
+ private static int trivertsInBuffer;
+ private static ByteBuffer byteBuffer;
+ private static IntBuffer intBuffer;
+ private static FloatBuffer floatBuffer;
+ private static ShortBuffer shortBuffer;
+ public static Tessellator instance;
+
+ static {
+ instance=new Tessellator();
+ instance.defaultTexture=true;
+
+ nativeBufferSize = 0x200000;
+ trivertsInBuffer = (nativeBufferSize/48)*6;
+ byteBuffer = GLAllocation.createDirectByteBuffer(nativeBufferSize * 4);
+ intBuffer = byteBuffer.asIntBuffer();
+ floatBuffer = byteBuffer.asFloatBuffer();
+ shortBuffer = byteBuffer.asShortBuffer();
+ useVBO = tryVBO && GLContext.getCapabilities().GL_ARB_vertex_buffer_object;
+ vboCount = 10;
+ if(useVBO)
+ {
+ vertexBuffers = GLAllocation.createDirectIntBuffer(vboCount);
+ ARBVertexBufferObject.glGenBuffersARB(vertexBuffers);
+ }
+ }
}

View File

@ -0,0 +1,16 @@
--- ../src_base/minecraft/net/minecraft/src/TileEntity.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/TileEntity.java 0000-00-00 00:00:00.000000000 -0000
@@ -61,6 +61,13 @@
{
}
+ /* FORGE: Return false if this TileEntity does not require updateEntity()
+ * calls.
+ */
+ public boolean canUpdate() {
+ return true;
+ }
+
public static TileEntity createAndLoadEntity(NBTTagCompound nbttagcompound)
{
TileEntity tileentity = null;

View File

@ -0,0 +1,87 @@
--- ../src_base/minecraft/net/minecraft/src/TileEntityFurnace.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/TileEntityFurnace.java 0000-00-00 00:00:00.000000000 -0000
@@ -4,6 +4,7 @@
package net.minecraft.src;
+import net.minecraft.src.forge.ISidedInventory;
// Referenced classes of package net.minecraft.src:
// TileEntity, IInventory, ItemStack, NBTTagCompound,
@@ -12,7 +13,7 @@
// EntityPlayer
public class TileEntityFurnace extends TileEntity
- implements IInventory
+ implements IInventory, ISidedInventory
{
public TileEntityFurnace()
@@ -28,6 +29,16 @@
return furnaceItemStacks.length;
}
+ public int getStartInventorySide(int side) {
+ if(side==0) return 1;
+ if(side==1) return 0;
+ return 2;
+ }
+
+ public int getSizeInventorySide(int side) {
+ return 1;
+ }
+
public ItemStack getStackInSlot(int i)
{
return furnaceItemStacks[i];
@@ -196,7 +207,7 @@
{
return false;
}
- ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0].getItem().shiftedIndex);
+ ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0]);
if(itemstack == null)
{
return false;
@@ -209,11 +220,9 @@
{
return false;
}
- if(furnaceItemStacks[2].stackSize < getInventoryStackLimit() && furnaceItemStacks[2].stackSize < furnaceItemStacks[2].getMaxStackSize())
- {
- return true;
- }
- return furnaceItemStacks[2].stackSize < itemstack.getMaxStackSize();
+ int st=furnaceItemStacks[2].stackSize+itemstack.stackSize;
+ return (st<=getInventoryStackLimit() &&
+ st<=itemstack.getMaxStackSize());
}
public void smeltItem()
@@ -222,14 +231,14 @@
{
return;
}
- ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0].getItem().shiftedIndex);
+ ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0]);
if(furnaceItemStacks[2] == null)
{
furnaceItemStacks[2] = itemstack.copy();
} else
- if(furnaceItemStacks[2].itemID == itemstack.itemID)
+ if(furnaceItemStacks[2].isItemEqual(itemstack))
{
- furnaceItemStacks[2].stackSize++;
+ furnaceItemStacks[2].stackSize+=itemstack.stackSize;
}
if(furnaceItemStacks[0].getItem().hasContainerItem())
{
@@ -244,7 +253,7 @@
}
}
- private int getItemBurnTime(ItemStack itemstack)
+ public static int getItemBurnTime(ItemStack itemstack)
{
if(itemstack == null)
{

View File

@ -0,0 +1,26 @@
--- ../src_base/minecraft/net/minecraft/src/TileEntityRendererPiston.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/TileEntityRendererPiston.java 0000-00-00 00:00:00.000000000 -0000
@@ -4,6 +4,7 @@
package net.minecraft.src;
+import net.minecraft.src.forge.ForgeHooksClient;
import net.minecraft.client.Minecraft;
import org.lwjgl.opengl.GL11;
@@ -38,6 +39,7 @@
{
GL11.glShadeModel(7424 /*GL_FLAT*/);
}
+ ForgeHooksClient.beforeBlockRender(block,field_31071_b);
tessellator.startDrawingQuads();
tessellator.setTranslationD(((float)d - (float)tileentitypiston.xCoord) + tileentitypiston.func_31017_b(f), ((float)d1 - (float)tileentitypiston.yCoord) + tileentitypiston.func_31014_c(f), ((float)d2 - (float)tileentitypiston.zCoord) + tileentitypiston.func_31013_d(f));
tessellator.setColorOpaque(1, 1, 1);
@@ -58,6 +60,7 @@
}
tessellator.setTranslationD(0.0D, 0.0D, 0.0D);
tessellator.draw();
+ ForgeHooksClient.afterBlockRender(block,field_31071_b);
RenderHelper.enableStandardItemLighting();
}
}

View File

@ -0,0 +1,192 @@
--- ../src_base/minecraft/net/minecraft/src/World.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/World.java 0000-00-00 00:00:00.000000000 -0000
@@ -336,7 +336,10 @@
public boolean isAirBlock(int i, int j, int k)
{
- return getBlockId(i, j, k) == 0;
+ int iBlockID = getBlockId( i, j, k );
+ if ( iBlockID == 0 )
+ return true;
+ return Block.blocksList[iBlockID].isAirBlock(this,i,j,k);
}
public boolean blockExists(int i, int j, int k)
@@ -1476,7 +1479,7 @@
Chunk chunk = getChunkFromChunkCoords(tileentity.xCoord >> 4, tileentity.zCoord >> 4);
if(chunk != null)
{
- chunk.removeChunkBlockTileEntity(tileentity.xCoord & 0xf, tileentity.yCoord, tileentity.zCoord & 0xf);
+ chunk.cleanChunkBlockTileEntity(tileentity.xCoord & 0xf, tileentity.yCoord, tileentity.zCoord & 0xf);
}
}
}
@@ -1503,16 +1506,16 @@
{
loadedTileEntityList.add(tileentity1);
}
+ } else {
if(chunkExists(tileentity1.xCoord >> 4, tileentity1.zCoord >> 4))
{
Chunk chunk1 = getChunkFromChunkCoords(tileentity1.xCoord >> 4, tileentity1.zCoord >> 4);
if(chunk1 != null)
{
- chunk1.setChunkBlockTileEntity(tileentity1.xCoord & 0xf, tileentity1.yCoord, tileentity1.zCoord & 0xf, tileentity1);
+ chunk1.cleanChunkBlockTileEntity(tileentity1.xCoord & 0xf, tileentity1.yCoord, tileentity1.zCoord & 0xf);
}
}
- markBlockNeedsUpdate(tileentity1.xCoord, tileentity1.yCoord, tileentity1.zCoord);
- }
+ }
} while(true);
addedTileEntityList.clear();
}
@@ -1520,13 +1523,19 @@
public void addTileEntity(Collection collection)
{
- if(scanningTileEntities)
- {
- addedTileEntityList.addAll(collection);
- } else
- {
- loadedTileEntityList.addAll(collection);
- }
+ List dest=scanningTileEntities ? addedTileEntityList :
+ loadedTileEntityList;
+ for(Object ob : collection) {
+ TileEntity te=(TileEntity)ob;
+ if(te.canUpdate()) dest.add(te);
+ }
+ }
+
+ /* FORGE: Used as a bugfix */
+ public void addTileEntity(TileEntity te) {
+ List dest=scanningTileEntities ? addedTileEntityList :
+ loadedTileEntityList;
+ if(te.canUpdate()) dest.add(te);
}
public void updateEntity(Entity entity)
@@ -1684,7 +1693,10 @@
if(j2 == Block.fire.blockID || j2 == Block.lavaMoving.blockID || j2 == Block.lavaStill.blockID)
{
return true;
- }
+ } else {
+ if(j2>0 && Block.blocksList[j2].isBlockBurning(this,k1,l1,i2))
+ return true;
+ }
}
}
@@ -1917,44 +1929,23 @@
public void setBlockTileEntity(int i, int j, int k, TileEntity tileentity)
{
- if(tileentity != null && !tileentity.isInvalid())
- {
- if(scanningTileEntities)
- {
- tileentity.xCoord = i;
- tileentity.yCoord = j;
- tileentity.zCoord = k;
- addedTileEntityList.add(tileentity);
- } else
- {
- loadedTileEntityList.add(tileentity);
- Chunk chunk = getChunkFromChunkCoords(i >> 4, k >> 4);
- if(chunk != null)
- {
- chunk.setChunkBlockTileEntity(i & 0xf, j, k & 0xf, tileentity);
- }
- }
- }
+ if(tileentity==null || tileentity.isInvalid())
+ return;
+ List dest=scanningTileEntities ? addedTileEntityList :
+ loadedTileEntityList;
+ if(tileentity.canUpdate()) dest.add(tileentity);
+ Chunk chunk = getChunkFromChunkCoords(i >> 4, k >> 4);
+ if(chunk != null) {
+ chunk.setChunkBlockTileEntity(i & 0xf, j, k & 0xf, tileentity);
+ }
}
public void removeBlockTileEntity(int i, int j, int k)
{
- TileEntity tileentity = getBlockTileEntity(i, j, k);
- if(tileentity != null && scanningTileEntities)
- {
- tileentity.invalidate();
- } else
- {
- if(tileentity != null)
- {
- loadedTileEntityList.remove(tileentity);
- }
- Chunk chunk = getChunkFromChunkCoords(i >> 4, k >> 4);
- if(chunk != null)
- {
- chunk.removeChunkBlockTileEntity(i & 0xf, j, k & 0xf);
- }
- }
+ Chunk chunk = getChunkFromChunkCoords(i >> 4, k >> 4);
+ if(chunk != null) {
+ chunk.removeChunkBlockTileEntity(i & 0xf, j, k & 0xf);
+ }
}
public void func_35455_a(TileEntity tileentity)
@@ -1977,13 +1968,18 @@
public boolean isBlockNormalCube(int i, int j, int k)
{
Block block = Block.blocksList[getBlockId(i, j, k)];
- if(block == null)
- {
- return false;
- } else
- {
- return block.blockMaterial.getIsOpaque() && block.renderAsNormalBlock();
- }
+ if(block == null) return false;
+ return block.isBlockNormalCube(this,i,j,k);
+ }
+
+ /* FORGE: Determine if the given block is considered solid on the
+ * specified side. Used by placement logic.
+ */
+ public boolean isBlockSolidOnSide(int i, int j, int k, int side)
+ {
+ Block block = Block.blocksList[getBlockId(i, j, k)];
+ if(block == null) return false;
+ return block.isBlockSolidOnSide(this,i,j,k,side);
}
public void saveWorldIndirectly(IProgressUpdate iprogressupdate)
@@ -2308,7 +2304,7 @@
private int computeBlockLightValue(int i, int j, int k, int l, int i1, int j1)
{
- int k1 = Block.lightValue[i1];
+ int k1=(i1==0)?0:Block.blocksList[i1].getLightValue(this,j,k,l);
int l1 = getSavedLightValue(EnumSkyBlock.Block, j - 1, k, l) - j1;
int i2 = getSavedLightValue(EnumSkyBlock.Block, j + 1, k, l) - j1;
int j2 = getSavedLightValue(EnumSkyBlock.Block, j, k - 1, l) - j1;
@@ -2679,6 +2675,7 @@
{
block = null;
}
+ if(block!=null && block.isBlockReplaceable(this,j,k,l)) block=null;
return i > 0 && block == null && block1.canPlaceBlockOnSide(this, j, k, l, i1);
}
@@ -3193,7 +3190,7 @@
public int lightningFlash;
public boolean editingBlocks;
private long lockTimestamp;
- protected int autosavePeriod;
+ public int autosavePeriod;
public int difficultySetting;
public Random rand;
public boolean isNewWorld;

View File

@ -0,0 +1,77 @@
--- ../src_base/minecraft/net/minecraft/src/WorldRenderer.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/WorldRenderer.java 0000-00-00 00:00:00.000000000 -0000
@@ -4,6 +4,8 @@
package net.minecraft.src;
+import net.minecraft.src.forge.ForgeHooksClient;
+
import java.util.*;
import org.lwjgl.opengl.GL11;
@@ -125,8 +127,9 @@
GL11.glTranslatef((float)(-sizeDepth) / 2.0F, (float)(-sizeHeight) / 2.0F, (float)(-sizeDepth) / 2.0F);
GL11.glScalef(f, f, f);
GL11.glTranslatef((float)sizeDepth / 2.0F, (float)sizeHeight / 2.0F, (float)sizeDepth / 2.0F);
- tessellator.startDrawingQuads();
- tessellator.setTranslationD(-posX, -posY, -posZ);
+ ForgeHooksClient.beforeRenderPass(i2);
+ Tessellator.instance.startDrawingQuads();
+ Tessellator.instance.setTranslationD(-posX, -posY, -posZ);
}
if(i2 == 0 && Block.isBlockContainer[i3])
{
@@ -142,15 +145,13 @@
{
flag1 = true;
}
- if(j3 != i2)
- {
- flag = true;
- continue;
- }
- if(j3 == i2)
- {
- flag1 |= renderblocks.renderBlockByRenderType(block, l2, j2, k2);
- }
+ if(j3>i2) flag=true;
+ if(!ForgeHooksClient.canRenderInPass(block,i2))
+ continue;
+
+ ForgeHooksClient.beforeBlockRender(block, renderblocks);
+ flag1 |= renderblocks.renderBlockByRenderType(block, l2, j2, k2);
+ ForgeHooksClient.afterBlockRender(block, renderblocks);
}
}
@@ -159,10 +160,11 @@
if(flag2)
{
- tessellator.draw();
+ ForgeHooksClient.afterRenderPass(i2);
+ Tessellator.instance.draw();
GL11.glPopMatrix();
GL11.glEndList();
- tessellator.setTranslationD(0.0D, 0.0D, 0.0D);
+ Tessellator.instance.setTranslationD(0.0D, 0.0D, 0.0D);
} else
{
flag1 = false;
@@ -255,7 +257,6 @@
public World worldObj;
private int glRenderList;
- private static Tessellator tessellator;
public static int chunksUpdated = 0;
public int posX;
public int posY;
@@ -286,8 +287,4 @@
public List tileEntityRenderers;
private List tileEntities;
- static
- {
- tessellator = Tessellator.instance;
- }
}

View File

@ -0,0 +1,173 @@
--- ../src_base/minecraft_server/net/minecraft/src/Block.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/Block.java 0000-00-00 00:00:00.000000000 -0000
@@ -3,6 +3,7 @@
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
+import net.minecraft.src.forge.ForgeHooks;
import java.util.ArrayList;
import java.util.Random;
@@ -218,24 +219,40 @@
return 1;
}
+ /* FORGE: Metadata-sensitive version.
+ */
+ public int quantityDropped(int i, Random random)
+ {
+ return quantityDropped(random);
+ }
+
public int idDropped(int i, Random random)
{
return blockID;
}
+ /* FORGE: This function isnt called by Minecraft anymore. Use
+ * blockStrength(EntityPlayer,int) instead.
+ */
public float blockStrength(EntityPlayer entityplayer)
{
- if(blockHardness < 0.0F)
- {
- return 0.0F;
- }
- if(!entityplayer.canHarvestBlock(this))
- {
- return 1.0F / blockHardness / 100F;
- } else
- {
- return entityplayer.getCurrentPlayerStrVsBlock(this) / blockHardness / 30F;
- }
+ return blockStrength(entityplayer,0);
+ }
+
+ /* FORGE: This function returns the complete list of drops for a block.
+ */
+ public ArrayList<ItemStack> getBlockDropped(World world,
+ int i, int j, int k, int md) {
+ ArrayList<ItemStack> tr=new ArrayList<ItemStack>();
+
+ int q=quantityDropped(md,world.rand);
+ for(int n=0; n<q; n++) {
+ int id=idDropped(md, world.rand);
+ if(id>0) {
+ tr.add(new ItemStack(id,1,damageDropped(md)));
+ }
+ }
+ return tr;
}
public final void dropBlockAsItem(World world, int i, int j, int k, int l)
@@ -249,20 +266,12 @@
{
return;
}
- int i1 = quantityDropped(world.rand);
- for(int j1 = 0; j1 < i1; j1++)
- {
+ ArrayList<ItemStack> ar=getBlockDropped(world,i,j,k,l);
+ for(ItemStack ist : ar) {
if(world.rand.nextFloat() > f)
- {
continue;
- }
- int k1 = idDropped(l, world.rand);
- if(k1 > 0)
- {
- dropBlockAsItem_do(world, i, j, k, new ItemStack(k1, 1, damageDropped(l)));
- }
+ dropBlockAsItem_do(world, i, j, k, ist);
}
-
}
protected void dropBlockAsItem_do(World world, int i, int j, int k, ItemStack itemstack)
@@ -529,6 +538,86 @@
return blockMaterial.getMaterialMobility();
}
+ /* FORGE: Allow a block to set illumination on a coordinate basis.
+ */
+ public int getLightValue(IBlockAccess iba, int i, int j, int k) {
+ return lightValue[blockID];
+ }
+
+ /* FORGE: Implement and return true if you wish this block to behave
+ * like a ladder when the player is inside.
+ */
+ public boolean isLadder() {
+ return false;
+ }
+
+ /* FORGE: Return true if the block is a normal, solid cube. This
+ * determines indirect power state, entity ejection from blocks, and a few
+ * others.
+ */
+ public boolean isBlockNormalCube(World world, int i, int j, int k) {
+ return blockMaterial.getIsOpaque() && isACube();
+ }
+
+ /* FORGE: Return true if the block is solid on the given side. This
+ * is used by placement logic. */
+ public boolean isBlockSolidOnSide( World world, int i, int j, int k,
+ int side ) {
+ return isBlockNormalCube(world,i,j,k);
+ }
+
+ /* FORGE: Return true if the player can place a new block in the block
+ * occupied by this one, like water, lava, fire, etc.
+ */
+ public boolean isBlockReplaceable( World world, int i, int j, int k ) {
+ return false;
+ }
+
+ /* FORGE: Return true if this block should set fire and deal fire damage
+ * to entities coming into contact with it, false otherwise.
+ */
+ public boolean isBlockBurning( World world, int i, int j, int k ) {
+ return false;
+ }
+
+ /* FORGE: Return true if this block should be treated as an air block
+ * by the rest of the code, false otherwise. This method is primarily
+ * useful for creating pure logic-blocks that will be invisible
+ * to the player and otherwise interact as air would.
+ */
+ public boolean isAirBlock( World world, int i, int j, int k ) {
+ return false;
+ }
+
+ /* FORGE: Return the block hardness with metadata md.
+ */
+ public float getHardness(int md) {
+ return blockHardness;
+ }
+
+ /* FORGE: Return the block strength of the block at i,j,k against the
+ * player.
+ */
+ public float blockStrength(World world, EntityPlayer player,
+ int i, int j, int k) {
+ int md=world.getBlockMetadata(i,j,k);
+ return blockStrength(player,md);
+ }
+
+ /* FORGE: Return the block strength of a prototypical block with metadata
+ * md against the player.
+ */
+ public float blockStrength(EntityPlayer player, int md) {
+ return ForgeHooks.blockStrength(this,player,md);
+ }
+
+ /* FORGE: Return true if the player can harvest a prototypical block with
+ * metadata md.
+ */
+ public boolean canHarvestBlock(EntityPlayer player, int md) {
+ return ForgeHooks.canHarvestBlock(this,player,md);
+ }
+
static Class _mthclass$(String s)
{
try

View File

@ -0,0 +1,119 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockButton.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockButton.java 0000-00-00 00:00:00.000000000 -0000
@@ -41,36 +41,36 @@
public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l)
{
- if(l == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if(l == 2 && world.isBlockSolidOnSide(i, j, k + 1,2))
{
return true;
}
- if(l == 3 && world.isBlockNormalCube(i, j, k - 1))
+ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3))
{
return true;
}
- if(l == 4 && world.isBlockNormalCube(i + 1, j, k))
+ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4))
{
return true;
}
- return l == 5 && world.isBlockNormalCube(i - 1, j, k);
+ return l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5);
}
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- if(world.isBlockNormalCube(i - 1, j, k))
+ if(world.isBlockSolidOnSide(i - 1, j, k,5))
{
return true;
}
- if(world.isBlockNormalCube(i + 1, j, k))
+ if(world.isBlockSolidOnSide(i + 1, j, k,4))
{
return true;
}
- if(world.isBlockNormalCube(i, j, k - 1))
+ if(world.isBlockSolidOnSide(i, j, k - 1,3))
{
return true;
}
- return world.isBlockNormalCube(i, j, k + 1);
+ return world.isBlockSolidOnSide(i, j, k + 1,2);
}
public void onBlockPlaced(World world, int i, int j, int k, int l)
@@ -78,19 +78,19 @@
int i1 = world.getBlockMetadata(i, j, k);
int j1 = i1 & 8;
i1 &= 7;
- if(l == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if(l == 2 && world.isBlockSolidOnSide(i, j, k + 1,2))
{
i1 = 4;
} else
- if(l == 3 && world.isBlockNormalCube(i, j, k - 1))
+ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3))
{
i1 = 3;
} else
- if(l == 4 && world.isBlockNormalCube(i + 1, j, k))
+ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4))
{
i1 = 2;
} else
- if(l == 5 && world.isBlockNormalCube(i - 1, j, k))
+ if(l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5))
{
i1 = 1;
} else
@@ -102,19 +102,19 @@
private int getOrientation(World world, int i, int j, int k)
{
- if(world.isBlockNormalCube(i - 1, j, k))
+ if(world.isBlockSolidOnSide(i - 1, j, k,5))
{
return 1;
}
- if(world.isBlockNormalCube(i + 1, j, k))
+ if(world.isBlockSolidOnSide(i + 1, j, k,4))
{
return 2;
}
- if(world.isBlockNormalCube(i, j, k - 1))
+ if(world.isBlockSolidOnSide(i, j, k - 1,3))
{
return 3;
}
- return !world.isBlockNormalCube(i, j, k + 1) ? 1 : 4;
+ return !world.isBlockSolidOnSide(i, j, k + 1,2) ? 1 : 4;
}
public void onNeighborBlockChange(World world, int i, int j, int k, int l)
@@ -123,19 +123,19 @@
{
int i1 = world.getBlockMetadata(i, j, k) & 7;
boolean flag = false;
- if(!world.isBlockNormalCube(i - 1, j, k) && i1 == 1)
+ if(!world.isBlockSolidOnSide(i - 1, j, k,5) && i1 == 1)
{
flag = true;
}
- if(!world.isBlockNormalCube(i + 1, j, k) && i1 == 2)
+ if(!world.isBlockSolidOnSide(i + 1, j, k,4) && i1 == 2)
{
flag = true;
}
- if(!world.isBlockNormalCube(i, j, k - 1) && i1 == 3)
+ if(!world.isBlockSolidOnSide(i, j, k - 1,3) && i1 == 3)
{
flag = true;
}
- if(!world.isBlockNormalCube(i, j, k + 1) && i1 == 4)
+ if(!world.isBlockSolidOnSide(i, j, k + 1,2) && i1 == 4)
{
flag = true;
}

View File

@ -0,0 +1,31 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockChest.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockChest.java 0000-00-00 00:00:00.000000000 -0000
@@ -328,23 +328,23 @@
{
return true;
}
- if(world.isBlockNormalCube(i, j + 1, k))
+ if(world.isBlockSolidOnSide(i, j + 1, k,0))
{
return true;
}
- if(world.getBlockId(i - 1, j, k) == blockID && world.isBlockNormalCube(i - 1, j + 1, k))
+ if(world.getBlockId(i - 1, j, k) == blockID && world.isBlockSolidOnSide(i - 1, j + 1, k,0))
{
return true;
}
- if(world.getBlockId(i + 1, j, k) == blockID && world.isBlockNormalCube(i + 1, j + 1, k))
+ if(world.getBlockId(i + 1, j, k) == blockID && world.isBlockSolidOnSide(i + 1, j + 1, k,0))
{
return true;
}
- if(world.getBlockId(i, j, k - 1) == blockID && world.isBlockNormalCube(i, j + 1, k - 1))
+ if(world.getBlockId(i, j, k - 1) == blockID && world.isBlockSolidOnSide(i, j + 1, k - 1,0))
{
return true;
}
- if(world.getBlockId(i, j, k + 1) == blockID && world.isBlockNormalCube(i, j + 1, k + 1))
+ if(world.getBlockId(i, j, k + 1) == blockID && world.isBlockSolidOnSide(i, j + 1, k + 1,0))
{
return true;
}

View File

@ -0,0 +1,24 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockContainer.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockContainer.java 0000-00-00 00:00:00.000000000 -0000
@@ -26,7 +26,7 @@
public void onBlockAdded(World world, int i, int j, int k)
{
super.onBlockAdded(world, i, j, k);
- world.setBlockTileEntity(i, j, k, getBlockEntity());
+ world.setBlockTileEntity(i, j, k, getBlockEntity(world.getBlockMetadata(i,j,k)));
}
public void onBlockRemoval(World world, int i, int j, int k)
@@ -37,6 +37,12 @@
public abstract TileEntity getBlockEntity();
+ /* FORGE: Metadata-sensitive version, to fix 1.8.1 regression.
+ */
+ public TileEntity getBlockEntity(int md) {
+ return getBlockEntity();
+ }
+
public void playBlock(World world, int i, int j, int k, int l, int i1)
{
super.playBlock(world, i, j, k, l, i1);

View File

@ -0,0 +1,48 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockCrops.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockCrops.java 0000-00-00 00:00:00.000000000 -0000
@@ -5,6 +5,7 @@
package net.minecraft.src;
import java.util.Random;
+import java.util.ArrayList;
// Referenced classes of package net.minecraft.src:
// BlockFlower, Block, World, EntityItem,
@@ -103,27 +104,16 @@
return blockIndexInTexture + j;
}
- public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f)
- {
- super.dropBlockAsItemWithChance(world, i, j, k, l, f);
- if(world.singleplayerWorld)
- {
- return;
- }
- for(int i1 = 0; i1 < 3; i1++)
- {
- if(world.rand.nextInt(15) <= l)
- {
- float f1 = 0.7F;
- float f2 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
- float f3 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
- float f4 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
- EntityItem entityitem = new EntityItem(world, (float)i + f2, (float)j + f3, (float)k + f4, new ItemStack(Item.seeds));
- entityitem.delayBeforeCanPickup = 10;
- world.entityJoinedWorld(entityitem);
- }
- }
-
+ public ArrayList<ItemStack> getBlockDropped(World world,
+ int i, int j, int k, int md) {
+ ArrayList<ItemStack> tr=new ArrayList<ItemStack>();
+ if(md==7) tr.add(new ItemStack(Item.wheat));
+
+ for(int n=0; n<3; n++) {
+ if(world.rand.nextInt(15) <= md)
+ tr.add(new ItemStack(Item.seeds));
+ }
+ return tr;
}
public int idDropped(int i, Random random)

View File

@ -0,0 +1,20 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockDoor.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockDoor.java 0000-00-00 00:00:00.000000000 -0000
@@ -167,7 +167,7 @@
world.setBlockWithNotify(i, j, k, 0);
flag = true;
}
- if(!world.isBlockNormalCube(i, j - 1, k))
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1))
{
world.setBlockWithNotify(i, j, k, 0);
flag = true;
@@ -231,7 +231,7 @@
return false;
} else
{
- return world.isBlockNormalCube(i, j - 1, k) && super.canPlaceBlockAt(world, i, j, k) && super.canPlaceBlockAt(world, i, j + 1, k);
+ return world.isBlockSolidOnSide(i, j - 1, k,1) && super.canPlaceBlockAt(world, i, j, k) && super.canPlaceBlockAt(world, i, j + 1, k);
}
}

View File

@ -0,0 +1,84 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockLadder.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockLadder.java 0000-00-00 00:00:00.000000000 -0000
@@ -40,6 +40,11 @@
return super.getCollisionBoundingBoxFromPool(world, i, j, k);
}
+ /* FORGE: Implemented base method, see Block.isLadder */
+ public boolean isLadder() {
+ return true;
+ }
+
public boolean isOpaqueCube()
{
return false;
@@ -52,37 +57,37 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- if(world.isBlockNormalCube(i - 1, j, k))
+ if(world.isBlockSolidOnSide(i - 1, j, k,5))
{
return true;
}
- if(world.isBlockNormalCube(i + 1, j, k))
+ if(world.isBlockSolidOnSide(i + 1, j, k,4))
{
return true;
}
- if(world.isBlockNormalCube(i, j, k - 1))
+ if(world.isBlockSolidOnSide(i, j, k - 1,3))
{
return true;
}
- return world.isBlockNormalCube(i, j, k + 1);
+ return world.isBlockSolidOnSide(i, j, k + 1,2);
}
public void onBlockPlaced(World world, int i, int j, int k, int l)
{
int i1 = world.getBlockMetadata(i, j, k);
- if((i1 == 0 || l == 2) && world.isBlockNormalCube(i, j, k + 1))
+ if((i1 == 0 || l == 2) && world.isBlockSolidOnSide(i, j, k + 1,2))
{
i1 = 2;
}
- if((i1 == 0 || l == 3) && world.isBlockNormalCube(i, j, k - 1))
+ if((i1 == 0 || l == 3) && world.isBlockSolidOnSide(i, j, k - 1,3))
{
i1 = 3;
}
- if((i1 == 0 || l == 4) && world.isBlockNormalCube(i + 1, j, k))
+ if((i1 == 0 || l == 4) && world.isBlockSolidOnSide(i + 1, j, k,4))
{
i1 = 4;
}
- if((i1 == 0 || l == 5) && world.isBlockNormalCube(i - 1, j, k))
+ if((i1 == 0 || l == 5) && world.isBlockSolidOnSide(i - 1, j, k,5))
{
i1 = 5;
}
@@ -93,19 +98,19 @@
{
int i1 = world.getBlockMetadata(i, j, k);
boolean flag = false;
- if(i1 == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if(i1 == 2 && world.isBlockSolidOnSide(i, j, k + 1,2))
{
flag = true;
}
- if(i1 == 3 && world.isBlockNormalCube(i, j, k - 1))
+ if(i1 == 3 && world.isBlockSolidOnSide(i, j, k - 1,3))
{
flag = true;
}
- if(i1 == 4 && world.isBlockNormalCube(i + 1, j, k))
+ if(i1 == 4 && world.isBlockSolidOnSide(i + 1, j, k,4))
{
flag = true;
}
- if(i1 == 5 && world.isBlockNormalCube(i - 1, j, k))
+ if(i1 == 5 && world.isBlockSolidOnSide(i - 1, j, k,5))
{
flag = true;
}

View File

@ -0,0 +1,120 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockLever.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockLever.java 0000-00-00 00:00:00.000000000 -0000
@@ -35,44 +35,44 @@
public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l)
{
- if(l == 1 && world.isBlockNormalCube(i, j - 1, k))
+ if(l == 1 && world.isBlockSolidOnSide(i, j - 1, k,1))
{
return true;
}
- if(l == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if(l == 2 && world.isBlockSolidOnSide(i, j, k + 1,2))
{
return true;
}
- if(l == 3 && world.isBlockNormalCube(i, j, k - 1))
+ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3))
{
return true;
}
- if(l == 4 && world.isBlockNormalCube(i + 1, j, k))
+ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4))
{
return true;
}
- return l == 5 && world.isBlockNormalCube(i - 1, j, k);
+ return l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5);
}
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- if(world.isBlockNormalCube(i - 1, j, k))
+ if(world.isBlockSolidOnSide(i - 1, j, k,5))
{
return true;
}
- if(world.isBlockNormalCube(i + 1, j, k))
+ if(world.isBlockSolidOnSide(i + 1, j, k,4))
{
return true;
}
- if(world.isBlockNormalCube(i, j, k - 1))
+ if(world.isBlockSolidOnSide(i, j, k - 1,3))
{
return true;
}
- if(world.isBlockNormalCube(i, j, k + 1))
+ if(world.isBlockSolidOnSide(i, j, k + 1,2))
{
return true;
}
- return world.isBlockNormalCube(i, j - 1, k);
+ return world.isBlockSolidOnSide(i, j - 1, k,1);
}
public void onBlockPlaced(World world, int i, int j, int k, int l)
@@ -81,23 +81,23 @@
int j1 = i1 & 8;
i1 &= 7;
i1 = -1;
- if(l == 1 && world.isBlockNormalCube(i, j - 1, k))
+ if(l == 1 && world.isBlockSolidOnSide(i, j - 1, k,1))
{
i1 = 5 + world.rand.nextInt(2);
}
- if(l == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if(l == 2 && world.isBlockSolidOnSide(i, j, k + 1,2))
{
i1 = 4;
}
- if(l == 3 && world.isBlockNormalCube(i, j, k - 1))
+ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3))
{
i1 = 3;
}
- if(l == 4 && world.isBlockNormalCube(i + 1, j, k))
+ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4))
{
i1 = 2;
}
- if(l == 5 && world.isBlockNormalCube(i - 1, j, k))
+ if(l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5))
{
i1 = 1;
}
@@ -119,27 +119,27 @@
{
int i1 = world.getBlockMetadata(i, j, k) & 7;
boolean flag = false;
- if(!world.isBlockNormalCube(i - 1, j, k) && i1 == 1)
+ if(!world.isBlockSolidOnSide(i - 1, j, k,5) && i1 == 1)
{
flag = true;
}
- if(!world.isBlockNormalCube(i + 1, j, k) && i1 == 2)
+ if(!world.isBlockSolidOnSide(i + 1, j, k,4) && i1 == 2)
{
flag = true;
}
- if(!world.isBlockNormalCube(i, j, k - 1) && i1 == 3)
+ if(!world.isBlockSolidOnSide(i, j, k - 1,3) && i1 == 3)
{
flag = true;
}
- if(!world.isBlockNormalCube(i, j, k + 1) && i1 == 4)
+ if(!world.isBlockSolidOnSide(i, j, k + 1,2) && i1 == 4)
{
flag = true;
}
- if(!world.isBlockNormalCube(i, j - 1, k) && i1 == 5)
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1) && i1 == 5)
{
flag = true;
}
- if(!world.isBlockNormalCube(i, j - 1, k) && i1 == 6)
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1) && i1 == 6)
{
flag = true;
}

View File

@ -0,0 +1,22 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockPressurePlate.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockPressurePlate.java 0000-00-00 00:00:00.000000000 -0000
@@ -46,7 +46,8 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- return world.isBlockNormalCube(i, j - 1, k) || world.getBlockId(i, j - 1, k) == Block.fence.blockID;
+ return world.isBlockSolidOnSide(i, j - 1, k,1) ||
+ world.getBlockId(i, j - 1, k) == Block.fence.blockID;
}
public void onBlockAdded(World world, int i, int j, int k)
@@ -56,7 +57,8 @@
public void onNeighborBlockChange(World world, int i, int j, int k, int l)
{
boolean flag = false;
- if(!world.isBlockNormalCube(i, j - 1, k) && world.getBlockId(i, j - 1, k) != Block.fence.blockID)
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1)
+ && world.getBlockId(i, j - 1, k) != Block.fence.blockID)
{
flag = true;
}

View File

@ -0,0 +1,55 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockRail.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockRail.java 0000-00-00 00:00:00.000000000 -0000
@@ -16,12 +16,12 @@
public static final boolean isRailBlockAt(World world, int i, int j, int k)
{
int l = world.getBlockId(i, j, k);
- return l == Block.rail.blockID || l == Block.railPowered.blockID || l == Block.railDetector.blockID;
+ return Block.blocksList[l] instanceof BlockRail;
}
public static final boolean isRailBlock(int i)
{
- return i == Block.rail.blockID || i == Block.railPowered.blockID || i == Block.railDetector.blockID;
+ return Block.blocksList[i] instanceof BlockRail;
}
protected BlockRail(int i, int j, boolean flag)
@@ -92,7 +92,7 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- return world.isBlockNormalCube(i, j - 1, k);
+ return world.isBlockSolidOnSide(i, j - 1, k,1);
}
public void onBlockAdded(World world, int i, int j, int k)
@@ -116,23 +116,23 @@
j1 &= 7;
}
boolean flag = false;
- if(!world.isBlockNormalCube(i, j - 1, k))
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1))
{
flag = true;
}
- if(j1 == 2 && !world.isBlockNormalCube(i + 1, j, k))
+ if(j1 == 2 && !world.isBlockSolidOnSide(i + 1, j, k,1))
{
flag = true;
}
- if(j1 == 3 && !world.isBlockNormalCube(i - 1, j, k))
+ if(j1 == 3 && !world.isBlockSolidOnSide(i - 1, j, k,1))
{
flag = true;
}
- if(j1 == 4 && !world.isBlockNormalCube(i, j, k - 1))
+ if(j1 == 4 && !world.isBlockSolidOnSide(i, j, k - 1,1))
{
flag = true;
}
- if(j1 == 5 && !world.isBlockNormalCube(i, j, k + 1))
+ if(j1 == 5 && !world.isBlockSolidOnSide(i, j, k + 1,1))
{
flag = true;
}

View File

@ -0,0 +1,20 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockRedstoneRepeater.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockRedstoneRepeater.java 0000-00-00 00:00:00.000000000 -0000
@@ -27,7 +27,7 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- if(!world.isBlockNormalCube(i, j - 1, k))
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1))
{
return false;
} else
@@ -38,7 +38,7 @@
public boolean canBlockStay(World world, int i, int j, int k)
{
- if(!world.isBlockNormalCube(i, j - 1, k))
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1))
{
return false;
} else

View File

@ -0,0 +1,30 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockRedstoneWire.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockRedstoneWire.java 0000-00-00 00:00:00.000000000 -0000
@@ -3,6 +3,7 @@
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
+import net.minecraft.src.forge.*;
import java.util.*;
@@ -43,7 +44,7 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- return world.isBlockNormalCube(i, j - 1, k);
+ return world.isBlockSolidOnSide(i, j - 1, k, 1);
}
private void updateAndPropagateCurrentStrength(World world, int i, int j, int k)
@@ -413,6 +414,10 @@
{
return false;
}
+ if(Block.blocksList[i1] instanceof IConnectRedstone) {
+ IConnectRedstone icr=(IConnectRedstone)Block.blocksList[i1];
+ return icr.canConnectRedstone(iblockaccess,i,j,k,l);
+ }
if(Block.blocksList[i1].canProvidePower())
{
return true;

View File

@ -0,0 +1,37 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockTallGrass.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockTallGrass.java 0000-00-00 00:00:00.000000000 -0000
@@ -4,7 +4,10 @@
package net.minecraft.src;
+import net.minecraft.src.forge.ForgeHooks;
+
import java.util.Random;
+import java.util.ArrayList;
// Referenced classes of package net.minecraft.src:
// BlockFlower, Item, World, EntityPlayer,
@@ -41,13 +44,17 @@
public int idDropped(int i, Random random)
{
- if(random.nextInt(8) == 0)
- {
- return Item.seeds.shiftedIndex;
- } else
- {
return -1;
- }
+ }
+
+ public ArrayList<ItemStack> getBlockDropped(World world,
+ int i, int j, int k, int md) {
+ ArrayList<ItemStack> tr=new ArrayList<ItemStack>();
+ if(world.rand.nextInt(8)!=0)
+ return tr;
+ ItemStack ist=ForgeHooks.getGrassSeed(world);
+ if(ist!=null) tr.add(ist);
+ return tr;
}
public void harvestBlock(World world, EntityPlayer entityplayer, int i, int j, int k, int l)

View File

@ -0,0 +1,104 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockTorch.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockTorch.java 0000-00-00 00:00:00.000000000 -0000
@@ -36,24 +36,24 @@
private boolean canPlaceTorchOn(World world, int i, int j, int k)
{
- return world.isBlockNormalCube(i, j, k) || world.getBlockId(i, j, k) == Block.fence.blockID;
+ return world.isBlockSolidOnSide(i, j, k,1) || world.getBlockId(i, j, k) == Block.fence.blockID;
}
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- if(world.isBlockNormalCube(i - 1, j, k))
+ if(world.isBlockSolidOnSide(i - 1, j, k,5))
{
return true;
}
- if(world.isBlockNormalCube(i + 1, j, k))
+ if(world.isBlockSolidOnSide(i + 1, j, k,4))
{
return true;
}
- if(world.isBlockNormalCube(i, j, k - 1))
+ if(world.isBlockSolidOnSide(i, j, k - 1,3))
{
return true;
}
- if(world.isBlockNormalCube(i, j, k + 1))
+ if(world.isBlockSolidOnSide(i, j, k + 1,2))
{
return true;
}
@@ -67,19 +67,19 @@
{
i1 = 5;
}
- if(l == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if(l == 2 && world.isBlockSolidOnSide(i, j, k + 1,2))
{
i1 = 4;
}
- if(l == 3 && world.isBlockNormalCube(i, j, k - 1))
+ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3))
{
i1 = 3;
}
- if(l == 4 && world.isBlockNormalCube(i + 1, j, k))
+ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4))
{
i1 = 2;
}
- if(l == 5 && world.isBlockNormalCube(i - 1, j, k))
+ if(l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5))
{
i1 = 1;
}
@@ -97,19 +97,19 @@
public void onBlockAdded(World world, int i, int j, int k)
{
- if(world.isBlockNormalCube(i - 1, j, k))
+ if(world.isBlockSolidOnSide(i - 1, j, k,5))
{
world.setBlockMetadataWithNotify(i, j, k, 1);
} else
- if(world.isBlockNormalCube(i + 1, j, k))
+ if(world.isBlockSolidOnSide(i + 1, j, k,4))
{
world.setBlockMetadataWithNotify(i, j, k, 2);
} else
- if(world.isBlockNormalCube(i, j, k - 1))
+ if(world.isBlockSolidOnSide(i, j, k - 1,3))
{
world.setBlockMetadataWithNotify(i, j, k, 3);
} else
- if(world.isBlockNormalCube(i, j, k + 1))
+ if(world.isBlockSolidOnSide(i, j, k + 1,2))
{
world.setBlockMetadataWithNotify(i, j, k, 4);
} else
@@ -126,19 +126,19 @@
{
int i1 = world.getBlockMetadata(i, j, k);
boolean flag = false;
- if(!world.isBlockNormalCube(i - 1, j, k) && i1 == 1)
+ if(!world.isBlockSolidOnSide(i - 1, j, k,5) && i1 == 1)
{
flag = true;
}
- if(!world.isBlockNormalCube(i + 1, j, k) && i1 == 2)
+ if(!world.isBlockSolidOnSide(i + 1, j, k,4) && i1 == 2)
{
flag = true;
}
- if(!world.isBlockNormalCube(i, j, k - 1) && i1 == 3)
+ if(!world.isBlockSolidOnSide(i, j, k - 1,3) && i1 == 3)
{
flag = true;
}
- if(!world.isBlockNormalCube(i, j, k + 1) && i1 == 4)
+ if(!world.isBlockSolidOnSide(i, j, k + 1,2) && i1 == 4)
{
flag = true;
}

View File

@ -0,0 +1,36 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockTrapDoor.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockTrapDoor.java 0000-00-00 00:00:00.000000000 -0000
@@ -130,7 +130,7 @@
{
j1--;
}
- if(!world.isBlockNormalCube(j1, j, k1))
+ if(!disableValidation && !world.isBlockSolidOnSide(j1, j, k1, (i1&3)+2))
{
world.setBlockWithNotify(i, j, k, 0);
dropBlockAsItem(world, i, j, k, i1);
@@ -172,6 +172,7 @@
public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l)
{
+ if(disableValidation) return true;
if(l == 0)
{
return false;
@@ -196,11 +197,15 @@
{
i--;
}
- return world.isBlockNormalCube(i, j, k);
+ return world.isBlockSolidOnSide(i, j, k, l);
}
public static boolean isTrapdoorOpen(int i)
{
return (i & 4) != 0;
}
+
+ /* FORGE: Set this to allow trapdoors to remain free-floating
+ */
+ public static boolean disableValidation=false;
}

View File

@ -0,0 +1,295 @@
--- ../src_base/minecraft_server/net/minecraft/src/Chunk.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/Chunk.java 0000-00-00 00:00:00.000000000 -0000
@@ -3,6 +3,7 @@
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
+import net.minecraft.src.forge.*;
import java.io.PrintStream;
import java.util.*;
@@ -68,16 +69,12 @@
public void generateSkylightMap()
{
- worldObj.getClass();
int i = 128 - 1;
for(int j = 0; j < 16; j++)
{
for(int l = 0; l < 16; l++)
{
- worldObj.getClass();
int j1 = 128 - 1;
- worldObj.getClass();
- worldObj.getClass();
int k1;
for(k1 = j << 11 | l << 7; j1 > 0 && Block.lightOpacity[blocks[(k1 + j1) - 1] & 0xff] == 0; j1--) { }
heightMap[l << 4 | j] = (byte)j1;
@@ -90,7 +87,6 @@
continue;
}
int l1 = 15;
- worldObj.getClass();
int i2 = 128 - 1;
do
{
@@ -128,7 +124,6 @@
private void func_35633_i()
{
- worldObj.getClass();
if(worldObj.doChunksNearChunkExist(xPosition * 16 + 8, 128 / 2, zPosition * 16 + 8, 16))
{
for(int i = 0; i < 16; i++)
@@ -190,7 +185,6 @@
{
if(l > k)
{
- worldObj.getClass();
if(worldObj.doChunksNearChunkExist(i, 128 / 2, j, 16))
{
for(int i1 = k; i1 < l; i1++)
@@ -211,8 +205,6 @@
{
i1 = j;
}
- worldObj.getClass();
- worldObj.getClass();
for(int j1 = i << 11 | k << 7; i1 > 0 && Block.lightOpacity[blocks[(j1 + i1) - 1] & 0xff] == 0; i1--) { }
if(i1 == l)
{
@@ -225,7 +217,6 @@
lowestBlockHeight = i1;
} else
{
- worldObj.getClass();
int k1 = 128 - 1;
for(int i2 = 0; i2 < 16; i2++)
{
@@ -294,8 +285,6 @@
public int getBlockID(int i, int j, int k)
{
- worldObj.getClass();
- worldObj.getClass();
return blocks[i << 11 | k << 7 | j] & 0xff;
}
@@ -308,8 +297,6 @@
field_35637_c[j1] = -999;
}
int k1 = heightMap[k << 4 | i] & 0xff;
- worldObj.getClass();
- worldObj.getClass();
int l1 = blocks[i << 11 | k << 7 | j] & 0xff;
if(l1 == l && data.getNibble(i, j, k) == i1)
{
@@ -317,12 +304,17 @@
}
int i2 = xPosition * 16 + i;
int j2 = zPosition * 16 + k;
- worldObj.getClass();
- worldObj.getClass();
+ if (Block.blocksList[l1] instanceof IOverrideReplace) {
+ IOverrideReplace iovr = (IOverrideReplace) Block.blocksList[l1];
+ if (!iovr.canReplaceBlock(worldObj, i2, j, j2, l))
+ return iovr.getReplacedSuccess();
+ }
+
blocks[i << 11 | k << 7 | j] = (byte)(byte0 & 0xff);
- if(l1 != 0 && !worldObj.singleplayerWorld)
- {
- Block.blocksList[l1].onBlockRemoval(worldObj, i2, j, j2);
+ if(l1 != 0) {
+ if(!worldObj.singleplayerWorld)
+ Block.blocksList[l1].onBlockRemoval(worldObj, i2, j, j2);
+ removeChunkBlockTileEntity(i,j,k);
}
data.setNibble(i, j, k, i1);
if(!worldObj.worldProvider.hasNoSky)
@@ -354,7 +346,7 @@
TileEntity tileentity = getChunkBlockTileEntity(i, j, k);
if(tileentity == null)
{
- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity();
+ tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(i1);
worldObj.setBlockTileEntity(i, j, k, tileentity);
}
if(tileentity != null)
@@ -362,14 +354,6 @@
tileentity.func_35164_g();
}
}
- } else
- if(l1 > 0 && (Block.blocksList[l1] instanceof BlockContainer))
- {
- TileEntity tileentity1 = getChunkBlockTileEntity(i, j, k);
- if(tileentity1 != null)
- {
- tileentity1.func_35164_g();
- }
}
isModified = true;
return true;
@@ -384,8 +368,6 @@
field_35637_c[i1] = -999;
}
int j1 = heightMap[i1] & 0xff;
- worldObj.getClass();
- worldObj.getClass();
int k1 = blocks[i << 11 | k << 7 | j] & 0xff;
if(k1 == l)
{
@@ -393,12 +375,18 @@
}
int l1 = xPosition * 16 + i;
int i2 = zPosition * 16 + k;
- worldObj.getClass();
- worldObj.getClass();
+
+ if (Block.blocksList[k1] instanceof IOverrideReplace) {
+ IOverrideReplace iovr = (IOverrideReplace) Block.blocksList[k1];
+ if (!iovr.canReplaceBlock(worldObj, l1, j, i2, l))
+ return iovr.getReplacedSuccess();
+ }
+
blocks[i << 11 | k << 7 | j] = (byte)(byte0 & 0xff);
- if(k1 != 0)
- {
- Block.blocksList[k1].onBlockRemoval(worldObj, l1, j, i2);
+ if(k1 != 0) {
+ if(!worldObj.singleplayerWorld)
+ Block.blocksList[k1].onBlockRemoval(worldObj, l1, j, i2);
+ removeChunkBlockTileEntity(i,j,k);
}
data.setNibble(i, j, k, 0);
if(Block.lightOpacity[byte0 & 0xff] != 0)
@@ -426,7 +414,7 @@
TileEntity tileentity = getChunkBlockTileEntity(i, j, k);
if(tileentity == null)
{
- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity();
+ tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(0);
worldObj.setBlockTileEntity(i, j, k, tileentity);
}
if(tileentity != null)
@@ -434,14 +422,6 @@
tileentity.func_35164_g();
}
}
- } else
- if(k1 > 0 && (Block.blocksList[k1] instanceof BlockContainer))
- {
- TileEntity tileentity1 = getChunkBlockTileEntity(i, j, k);
- if(tileentity1 != null)
- {
- tileentity1.func_35164_g();
- }
}
isModified = true;
return true;
@@ -568,6 +548,11 @@
{
ChunkPosition chunkposition = new ChunkPosition(i, j, k);
TileEntity tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition);
+ if(tileentity != null && tileentity.isInvalid())
+ {
+ chunkTileEntityMap.remove(chunkposition);
+ tileentity=null;
+ }
if(tileentity == null)
{
int l = getBlockID(i, j, k);
@@ -577,18 +562,23 @@
}
if(tileentity == null)
{
- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity();
+ tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(getBlockMetadata(i,j,k));
worldObj.setBlockTileEntity(xPosition * 16 + i, j, zPosition * 16 + k, tileentity);
}
tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition);
}
- if(tileentity != null && tileentity.isInvalid())
- {
- chunkTileEntityMap.remove(chunkposition);
- return null;
- } else
+ return tileentity;
+ }
+
+ /* FORGE: Used to remove only invalid TileEntities */
+ public void cleanChunkBlockTileEntity(int i, int j, int k)
+ {
+ ChunkPosition chunkposition = new ChunkPosition(i, j, k);
+ if(isChunkLoaded)
{
- return tileentity;
+ TileEntity tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition);
+ if(tileentity!=null && tileentity.isInvalid())
+ chunkTileEntityMap.remove(chunkposition);
}
}
@@ -600,7 +590,7 @@
setChunkBlockTileEntity(i, j, k, tileentity);
if(isChunkLoaded)
{
- worldObj.loadedTileEntityList.add(tileentity);
+ worldObj.addTileEntity(tileentity);
}
}
@@ -617,6 +607,8 @@
return;
} else
{
+ TileEntity old=(TileEntity)chunkTileEntityMap.get(chunkposition);
+ if(old!=null) old.invalidate();
tileentity.validate();
chunkTileEntityMap.put(chunkposition, tileentity);
return;
@@ -766,8 +758,6 @@
{
for(int k3 = k; k3 < j1; k3++)
{
- worldObj.getClass();
- worldObj.getClass();
int k4 = k2 << 11 | k3 << 7 | j;
int k5 = i1 - j;
System.arraycopy(blocks, k4, abyte0, k1, k5);
@@ -780,8 +770,6 @@
{
for(int l3 = k; l3 < j1; l3++)
{
- worldObj.getClass();
- worldObj.getClass();
int l4 = (l2 << 11 | l3 << 7 | j) >> 1;
int l5 = (i1 - j) / 2;
System.arraycopy(data.data, l4, abyte0, k1, l5);
@@ -794,8 +782,6 @@
{
for(int i4 = k; i4 < j1; i4++)
{
- worldObj.getClass();
- worldObj.getClass();
int i5 = (i3 << 11 | i4 << 7 | j) >> 1;
int i6 = (i1 - j) / 2;
System.arraycopy(blocklightMap.data, i5, abyte0, k1, i6);
@@ -808,8 +794,6 @@
{
for(int j4 = k; j4 < j1; j4++)
{
- worldObj.getClass();
- worldObj.getClass();
int j5 = (j3 << 11 | j4 << 7 | j) >> 1;
int j6 = (i1 - j) / 2;
System.arraycopy(skylightMap.data, j5, abyte0, k1, j6);
@@ -857,7 +841,6 @@
int l = field_35637_c[k];
if(l == -999)
{
- worldObj.getClass();
int i1 = 128 - 1;
for(l = -1; i1 > 0 && l == -1;)
{

View File

@ -0,0 +1,13 @@
--- ../src_base/minecraft_server/net/minecraft/src/EntityLiving.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/EntityLiving.java 0000-00-00 00:00:00.000000000 -0000
@@ -600,7 +600,9 @@
int i = MathHelper.floor_double(posX);
int j = MathHelper.floor_double(boundingBox.minY);
int k = MathHelper.floor_double(posZ);
- return worldObj.getBlockId(i, j, k) == Block.ladder.blockID;
+ Block block=Block.blocksList[worldObj.getBlockId(i,j,k)];
+ if(block==null) return false;
+ return block.isLadder();
}
public void writeEntityToNBT(NBTTagCompound nbttagcompound)

View File

@ -0,0 +1,76 @@
--- ../src_base/minecraft_server/net/minecraft/src/EntityPlayer.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/EntityPlayer.java 0000-00-00 00:00:00.000000000 -0000
@@ -6,6 +6,10 @@
import java.util.*;
+import net.minecraft.src.forge.ArmorProperties;
+import net.minecraft.src.forge.ISpecialArmor;
+import net.minecraft.src.forge.ForgeHooks;
+
// Referenced classes of package net.minecraft.src:
// EntityLiving, InventoryPlayer, FoodStats, PlayerCapabilities,
// ContainerPlayer, World, ChunkCoordinates, DataWatcher,
@@ -433,6 +437,8 @@
worldObj.entityJoinedWorld(entityitem);
}
+ /* FORGE: This isnt called anymore
+ */
public float getCurrentPlayerStrVsBlock(Block block)
{
float f = inventory.getStrVsBlock(block);
@@ -455,6 +461,32 @@
return f;
}
+ /* FORGE: Extended to allow metadata.
+ */
+ public float getCurrentPlayerStrVsBlock(Block block, int md)
+ {
+ float f = 1.0F;
+ ItemStack ist=inventory.getCurrentItem();
+ if(ist!=null) f=ist.getItem().getStrVsBlock(ist,block,md);
+ if(isInsideOfMaterial(Material.water))
+ {
+ f /= 5F;
+ }
+ if(!onGround)
+ {
+ f /= 5F;
+ }
+ if(func_35184_a(Potion.digSpeed))
+ {
+ f *= 1.0F + (float)(func_35187_b(Potion.digSpeed).func_35652_c() + 1) * 0.2F;
+ }
+ if(func_35184_a(Potion.digSlowdown))
+ {
+ f *= 1.0F - (float)(func_35187_b(Potion.digSlowdown).func_35652_c() + 1) * 0.2F;
+ }
+ return f;
+ }
+
public boolean canHarvestBlock(Block block)
{
return inventory.canHarvestBlock(block);
@@ -668,7 +700,9 @@
public void destroyCurrentEquippedItem()
{
+ ItemStack orig=inventory.getCurrentItem();
inventory.setInventorySlotContents(inventory.currentItem, null);
+ ForgeHooks.onDestroyCurrentItem(this,orig);
}
public double getYOffset()
@@ -757,6 +791,10 @@
public EnumStatus sleepInBedAt(int i, int j, int k)
{
+ EnumStatus customSleep = ForgeHooks.sleepInBedAt(this, i, j, k);
+ if (customSleep != null) {
+ return customSleep;
+ }
if(!worldObj.singleplayerWorld)
{
if(isPlayerSleeping() || !isEntityAlive())

View File

@ -0,0 +1,28 @@
--- ../src_base/minecraft_server/net/minecraft/src/Explosion.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/Explosion.java 0000-00-00 00:00:00.000000000 -0000
@@ -3,6 +3,7 @@
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
+import net.minecraft.src.forge.ISpecialResistance;
import java.util.*;
@@ -66,7 +67,16 @@
int i5 = worldObj.getBlockId(j4, k4, l4);
if(i5 > 0)
{
- f1 -= (Block.blocksList[i5].getExplosionResistance(exploder) + 0.3F) * f2;
+ if(Block.blocksList[i5] instanceof ISpecialResistance) {
+ ISpecialResistance isr=(ISpecialResistance)
+ Block.blocksList[i5];
+ f1-=(isr.getSpecialExplosionResistance(
+ worldObj,j4,k4,l4,
+ explosionX,explosionY,explosionZ,
+ exploder) + 0.3F) * f2;
+ } else {
+ f1 -= (Block.blocksList[i5].getExplosionResistance(exploder) + 0.3F) * f2;
+ }
}
if(f1 > 0.0F)
{

View File

@ -0,0 +1,58 @@
--- ../src_base/minecraft_server/net/minecraft/src/FurnaceRecipes.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/FurnaceRecipes.java 0000-00-00 00:00:00.000000000 -0000
@@ -6,6 +6,7 @@
import java.util.HashMap;
import java.util.Map;
+import java.util.Arrays;
// Referenced classes of package net.minecraft.src:
// Block, ItemStack, Item
@@ -21,6 +22,7 @@
private FurnaceRecipes()
{
smeltingList = new HashMap();
+ metaSmeltingList = new HashMap();
addSmelting(Block.oreIron.blockID, new ItemStack(Item.ingotIron));
addSmelting(Block.oreGold.blockID, new ItemStack(Item.ingotGold));
addSmelting(Block.oreDiamond.blockID, new ItemStack(Item.diamond));
@@ -40,11 +42,32 @@
smeltingList.put(Integer.valueOf(i), itemstack);
}
+ /* FORGE: Add a metadata-sensitive furnace recipe.
+ */
+ public void addSmelting(int i, int meta, ItemStack itemstack)
+ {
+ metaSmeltingList.put(Arrays.asList(i,meta), itemstack);
+ }
+
+ /* FORGE: Not used anymore.
+ */
public ItemStack getSmeltingResult(int i)
{
return (ItemStack)smeltingList.get(Integer.valueOf(i));
}
+ /* FORGE: Added to allow metadata-sensitive smelting.
+ */
+ public ItemStack getSmeltingResult(ItemStack src) {
+ ItemStack tr;
+
+ if(src==null) return null;
+ tr=(ItemStack)metaSmeltingList.get(
+ Arrays.asList(src.itemID,src.getItemDamage()));
+ if(tr!=null) return tr;
+ return (ItemStack)smeltingList.get(Integer.valueOf(src.itemID));
+ }
+
public Map getSmeltingList()
{
return smeltingList;
@@ -52,5 +75,6 @@
private static final FurnaceRecipes smeltingBase = new FurnaceRecipes();
private Map smeltingList;
+ private Map metaSmeltingList;
}

View File

@ -0,0 +1,16 @@
--- ../src_base/minecraft_server/net/minecraft/src/Item.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/Item.java 0000-00-00 00:00:00.000000000 -0000
@@ -66,6 +66,13 @@
return 1.0F;
}
+ /* FORGE: Metadata-sensitive version of getStrVsBlock
+ */
+ public float getStrVsBlock(ItemStack itemstack, Block block, int md)
+ {
+ return getStrVsBlock(itemstack,block);
+ }
+
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
{
return itemstack;

View File

@ -0,0 +1,11 @@
--- ../src_base/minecraft_server/net/minecraft/src/ItemBlock.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/ItemBlock.java 0000-00-00 00:00:00.000000000 -0000
@@ -62,7 +62,7 @@
{
return false;
}
- if(!entityplayer.func_35200_c(i, j, k))
+ if(entityplayer!=null && !entityplayer.func_35200_c(i, j, k))
{
return false;
}

View File

@ -0,0 +1,24 @@
--- ../src_base/minecraft_server/net/minecraft/src/ItemBucket.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/ItemBucket.java 0000-00-00 00:00:00.000000000 -0000
@@ -6,6 +6,8 @@
import java.util.Random;
+import net.minecraft.src.forge.MinecraftForge;
+
// Referenced classes of package net.minecraft.src:
// Item, EntityPlayer, Vec3D, MathHelper,
// World, MovingObjectPosition, EnumMovingObjectType, Material,
@@ -56,6 +58,12 @@
}
if(isFull == 0)
{
+ ItemStack customBucket = MinecraftForge.fillCustomBucket(world,
+ i, j, k);
+ if (customBucket != null) {
+ return customBucket;
+ }
+
if(!entityplayer.func_35200_c(i, j, k))
{
return itemstack;

View File

@ -0,0 +1,45 @@
--- ../src_base/minecraft_server/net/minecraft/src/ItemDye.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/ItemDye.java 0000-00-00 00:00:00.000000000 -0000
@@ -3,6 +3,7 @@
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
+import net.minecraft.src.forge.ForgeHooks;
import java.util.Random;
@@ -29,13 +30,18 @@
public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l)
{
- if(!entityplayer.func_35200_c(i, j, k))
+ if(entityplayer!=null && !entityplayer.func_35200_c(i, j, k))
{
return false;
}
if(itemstack.getItemDamage() == 15)
{
int i1 = world.getBlockId(i, j, k);
+ if(ForgeHooks.onUseBonemeal(world,i1,i,j,k)) {
+ if(!world.singleplayerWorld)
+ itemstack.stackSize--;
+ return true;
+ }
if(i1 == Block.sapling.blockID)
{
if(!world.singleplayerWorld)
@@ -102,13 +108,7 @@
world.setBlockAndMetadataWithNotify(k1, l1, i2, Block.tallGrass.blockID, 1);
continue;
}
- if(itemRand.nextInt(3) != 0)
- {
- world.setBlockWithNotify(k1, l1, i2, Block.plantYellow.blockID);
- } else
- {
- world.setBlockWithNotify(k1, l1, i2, Block.plantRed.blockID);
- }
+ ForgeHooks.plantGrassPlant(world,k1,l1,i2);
}
}

View File

@ -0,0 +1,11 @@
--- ../src_base/minecraft_server/net/minecraft/src/ItemFlintAndSteel.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/ItemFlintAndSteel.java 0000-00-00 00:00:00.000000000 -0000
@@ -46,7 +46,7 @@
{
i++;
}
- if(!entityplayer.func_35200_c(i, j, k))
+ if(entityplayer!=null && !entityplayer.func_35200_c(i, j, k))
{
return false;
}

View File

@ -0,0 +1,11 @@
--- ../src_base/minecraft_server/net/minecraft/src/ItemHoe.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/ItemHoe.java 0000-00-00 00:00:00.000000000 -0000
@@ -21,7 +21,7 @@
public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l)
{
- if(!entityplayer.func_35200_c(i, j, k))
+ if(entityplayer!=null && !entityplayer.func_35200_c(i, j, k))
{
return false;
}

View File

@ -0,0 +1,82 @@
--- ../src_base/minecraft_server/net/minecraft/src/ItemInWorldManager.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/ItemInWorldManager.java 0000-00-00 00:00:00.000000000 -0000
@@ -3,7 +3,8 @@
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
-
+import net.minecraft.src.forge.ForgeHooks;
+import net.minecraft.src.forge.IUseItemFirst;
// Referenced classes of package net.minecraft.src:
// EntityPlayer, PlayerCapabilities, World, Block,
@@ -66,7 +67,8 @@
if(j != 0)
{
Block block = Block.blocksList[j];
- float f = block.blockStrength(thisPlayer) * (float)(i + 1);
+ float f = block.blockStrength(thisWorld,thisPlayer,
+ field_22049_l,field_22048_m,field_22047_n) * (float)(i + 1);
if(f >= 1.0F)
{
field_22050_k = false;
@@ -93,7 +95,7 @@
{
Block.blocksList[i1].onBlockClicked(thisWorld, i, j, k, thisPlayer);
}
- if(i1 > 0 && Block.blocksList[i1].blockStrength(thisPlayer) >= 1.0F)
+ if(i1 > 0 && Block.blocksList[i1].blockStrength(thisWorld,thisPlayer,i,j,k) >= 1.0F)
{
blockHarvessted(i, j, k);
} else
@@ -113,7 +115,7 @@
if(i1 != 0)
{
Block block = Block.blocksList[i1];
- float f = block.blockStrength(thisPlayer) * (float)(l + 1);
+ float f = block.blockStrength(thisWorld,thisPlayer,i,j,k) * (float)(l + 1);
if(f >= 0.7F)
{
blockHarvessted(i, j, k);
@@ -164,7 +166,7 @@
thisPlayer.destroyCurrentEquippedItem();
}
}
- if(flag && thisPlayer.canHarvestBlock(Block.blocksList[l]))
+ if(flag && Block.blocksList[l].canHarvestBlock(thisPlayer,i1))
{
Block.blocksList[l].harvestBlock(thisWorld, thisPlayer, i, j, k, i1);
}
@@ -188,6 +190,7 @@
if(itemstack1.stackSize == 0)
{
entityplayer.inventory.mainInventory[entityplayer.inventory.currentItem] = null;
+ ForgeHooks.onDestroyCurrentItem(entityplayer,itemstack1);
}
return true;
} else
@@ -198,6 +201,11 @@
public boolean activeBlockOrUseItem(EntityPlayer entityplayer, World world, ItemStack itemstack, int i, int j, int k, int l)
{
+ if(itemstack!=null && itemstack.getItem() instanceof IUseItemFirst) {
+ IUseItemFirst iuif=(IUseItemFirst)itemstack.getItem();
+ if(iuif.onItemUseFirst(itemstack,entityplayer,world,i,j,k,l))
+ return true;
+ }
int i1 = world.getBlockId(i, j, k);
if(i1 > 0 && Block.blocksList[i1].blockActivated(world, i, j, k, entityplayer))
{
@@ -217,7 +225,11 @@
return flag;
} else
{
- return itemstack.useItem(entityplayer, world, i, j, k, l);
+ if(!itemstack.useItem(entityplayer, world, i, j, k, l))
+ return false;
+ if(itemstack.stackSize == 0)
+ ForgeHooks.onDestroyCurrentItem(entityplayer,itemstack);
+ return true;
}
}

View File

@ -0,0 +1,11 @@
--- ../src_base/minecraft_server/net/minecraft/src/ItemRedstone.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/ItemRedstone.java 0000-00-00 00:00:00.000000000 -0000
@@ -50,7 +50,7 @@
return false;
}
}
- if(!entityplayer.func_35200_c(i, j, k))
+ if(entityplayer!=null && !entityplayer.func_35200_c(i, j, k))
{
return false;
}

View File

@ -0,0 +1,11 @@
--- ../src_base/minecraft_server/net/minecraft/src/ItemReed.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/ItemReed.java 0000-00-00 00:00:00.000000000 -0000
@@ -52,7 +52,7 @@
i++;
}
}
- if(!entityplayer.func_35200_c(i, j, k))
+ if(entityplayer!=null && !entityplayer.func_35200_c(i, j, k))
{
return false;
}

View File

@ -0,0 +1,11 @@
--- ../src_base/minecraft_server/net/minecraft/src/ItemSeeds.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/ItemSeeds.java 0000-00-00 00:00:00.000000000 -0000
@@ -24,7 +24,7 @@
{
return false;
}
- if(!entityplayer.func_35200_c(i, j, k) || !entityplayer.func_35200_c(i, j + 1, k))
+ if(entityplayer!=null && (!entityplayer.func_35200_c(i, j, k) || !entityplayer.func_35200_c(i, j + 1, k)))
{
return false;
}

View File

@ -0,0 +1,36 @@
--- ../src_base/minecraft_server/net/minecraft/src/ItemTool.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/ItemTool.java 0000-00-00 00:00:00.000000000 -0000
@@ -4,6 +4,8 @@
package net.minecraft.src;
+import java.util.Arrays;
+import net.minecraft.src.forge.ForgeHooks;
// Referenced classes of package net.minecraft.src:
// Item, EnumToolMaterial, ItemStack, Block,
@@ -37,6 +39,14 @@
return 1.0F;
}
+ /* FORGE: Overridden to allow custom tool effectiveness
+ */
+ public float getStrVsBlock(ItemStack itemstack, Block block, int md) {
+ if(ForgeHooks.isToolEffective(itemstack,block,md))
+ return efficiencyOnProperMaterial;
+ return getStrVsBlock(itemstack,block);
+ }
+
public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
{
itemstack.damageItem(2, entityliving1);
@@ -55,7 +65,7 @@
}
private Block blocksEffectiveAgainst[];
- private float efficiencyOnProperMaterial;
- private int damageVsEntity;
+ public float efficiencyOnProperMaterial;
+ public int damageVsEntity;
protected EnumToolMaterial toolMaterial;
}

View File

@ -0,0 +1,10 @@
--- ../src_base/minecraft_server/net/minecraft/src/MovingObjectPosition.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/MovingObjectPosition.java 0000-00-00 00:00:00.000000000 -0000
@@ -35,4 +35,7 @@
public int sideHit;
public Vec3D hitVec;
public Entity entityHit;
+
+ // Added for RedPower subblocks.
+ public int subHit=-1;
}

View File

@ -0,0 +1,18 @@
--- ../src_base/minecraft_server/net/minecraft/src/PlayerInstance.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/PlayerInstance.java 0000-00-00 00:00:00.000000000 -0000
@@ -168,12 +168,11 @@
sendPacketToPlayersInInstance(new Packet52MultiBlockChange(chunkX, chunkZ, blocksToUpdate, numBlocksToUpdate, worldserver));
for(int k = 0; k < numBlocksToUpdate; k++)
{
- int j1 = chunkX * 16 + (numBlocksToUpdate >> 12 & 0xf);
- int i2 = numBlocksToUpdate & 0xff;
- int k2 = chunkZ * 16 + (numBlocksToUpdate >> 8 & 0xf);
+ int j1 = chunkX * 16 + (blocksToUpdate[k] >> 12 & 0xf);
+ int i2 = blocksToUpdate[k] & 0xff;
+ int k2 = chunkZ * 16 + (blocksToUpdate[k] >> 8 & 0xf);
if(Block.isBlockContainer[worldserver.getBlockId(j1, i2, k2)])
{
- System.out.println("Sending!");
updateTileEntity(worldserver.getBlockTileEntity(j1, i2, k2));
}
}

View File

@ -0,0 +1,19 @@
--- ../src_base/minecraft_server/net/minecraft/src/SlotCrafting.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/SlotCrafting.java 0000-00-00 00:00:00.000000000 -0000
@@ -3,7 +3,7 @@
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
-
+import net.minecraft.src.forge.ForgeHooks;
// Referenced classes of package net.minecraft.src:
// Slot, EntityPlayer, ItemStack, Block,
@@ -60,6 +60,7 @@
thePlayer.addStat(AchievementList.buildSword, 1);
}
ModLoader.TakenFromCrafting(thePlayer, itemstack);
+ ForgeHooks.onTakenFromCrafting(thePlayer, itemstack, craftMatrix);
for(int i = 0; i < craftMatrix.getSizeInventory(); i++)
{
ItemStack itemstack1 = craftMatrix.getStackInSlot(i);

View File

@ -0,0 +1,16 @@
--- ../src_base/minecraft_server/net/minecraft/src/TileEntity.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/TileEntity.java 0000-00-00 00:00:00.000000000 -0000
@@ -61,6 +61,13 @@
{
}
+ /* FORGE: Return false if this TileEntity does not require updateEntity()
+ * calls.
+ */
+ public boolean canUpdate() {
+ return true;
+ }
+
public static TileEntity createAndLoadEntity(NBTTagCompound nbttagcompound)
{
TileEntity tileentity = null;

View File

@ -0,0 +1,97 @@
--- ../src_base/minecraft_server/net/minecraft/src/TileEntityFurnace.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/TileEntityFurnace.java 0000-00-00 00:00:00.000000000 -0000
@@ -4,6 +4,7 @@
package net.minecraft.src;
+import net.minecraft.src.forge.ISidedInventory;
// Referenced classes of package net.minecraft.src:
// TileEntity, IInventory, ItemStack, NBTTagCompound,
@@ -12,7 +13,7 @@
// EntityPlayer
public class TileEntityFurnace extends TileEntity
- implements IInventory
+ implements IInventory, ISidedInventory
{
public TileEntityFurnace()
@@ -28,6 +29,16 @@
return furnaceItemStacks.length;
}
+ public int getStartInventorySide(int side) {
+ if(side==0) return 1;
+ if(side==1) return 0;
+ return 2;
+ }
+
+ public int getSizeInventorySide(int side) {
+ return 1;
+ }
+
public ItemStack getStackInSlot(int i)
{
return furnaceItemStacks[i];
@@ -176,7 +187,7 @@
{
return false;
}
- ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0].getItem().shiftedIndex);
+ ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0]);
if(itemstack == null)
{
return false;
@@ -189,13 +200,9 @@
{
return false;
}
- if(furnaceItemStacks[2].stackSize < getInventoryStackLimit() && furnaceItemStacks[2].stackSize < furnaceItemStacks[2].getMaxStackSize())
- {
- return true;
- } else
- {
- return furnaceItemStacks[2].stackSize < itemstack.getMaxStackSize();
- }
+ int st=furnaceItemStacks[2].stackSize+itemstack.stackSize;
+ return (st<=getInventoryStackLimit() &&
+ st<=itemstack.getMaxStackSize());
}
public void smeltItem()
@@ -204,23 +211,29 @@
{
return;
}
- ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0].getItem().shiftedIndex);
+ ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0]);
if(furnaceItemStacks[2] == null)
{
furnaceItemStacks[2] = itemstack.copy();
} else
- if(furnaceItemStacks[2].itemID == itemstack.itemID)
+ if(furnaceItemStacks[2].isItemEqual(itemstack))
+ {
+ furnaceItemStacks[2].stackSize+=itemstack.stackSize;
+ }
+ if(furnaceItemStacks[0].getItem().hasContainerItem())
+ {
+ furnaceItemStacks[0] = new ItemStack(furnaceItemStacks[0].getItem().getContainerItem());
+ } else
{
- furnaceItemStacks[2].stackSize++;
+ furnaceItemStacks[0].stackSize--;
}
- furnaceItemStacks[0].stackSize--;
if(furnaceItemStacks[0].stackSize <= 0)
{
furnaceItemStacks[0] = null;
}
}
- private int getItemBurnTime(ItemStack itemstack)
+ public static int getItemBurnTime(ItemStack itemstack)
{
if(itemstack == null)
{

View File

@ -0,0 +1,189 @@
--- ../src_base/minecraft_server/net/minecraft/src/World.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/World.java 0000-00-00 00:00:00.000000000 -0000
@@ -183,7 +183,11 @@
public boolean isAirBlock(int i, int j, int k)
{
- return getBlockId(i, j, k) == 0;
+ int iBlockID = getBlockId( i, j, k );
+
+ if ( iBlockID == 0 )
+ return true;
+ return Block.blocksList[iBlockID].isAirBlock(this,i,j,k);
}
public boolean blockExists(int i, int j, int k)
@@ -1124,7 +1128,7 @@
Chunk chunk = getChunkFromChunkCoords(tileentity.xCoord >> 4, tileentity.zCoord >> 4);
if(chunk != null)
{
- chunk.removeChunkBlockTileEntity(tileentity.xCoord & 0xf, tileentity.yCoord, tileentity.zCoord & 0xf);
+ chunk.cleanChunkBlockTileEntity(tileentity.xCoord & 0xf, tileentity.yCoord, tileentity.zCoord & 0xf);
}
}
}
@@ -1151,15 +1155,15 @@
{
loadedTileEntityList.add(tileentity1);
}
+ } else {
if(chunkExists(tileentity1.xCoord >> 4, tileentity1.zCoord >> 4))
{
Chunk chunk1 = getChunkFromChunkCoords(tileentity1.xCoord >> 4, tileentity1.zCoord >> 4);
if(chunk1 != null)
{
- chunk1.setChunkBlockTileEntity(tileentity1.xCoord & 0xf, tileentity1.yCoord, tileentity1.zCoord & 0xf, tileentity1);
+ chunk1.cleanChunkBlockTileEntity(tileentity1.xCoord & 0xf, tileentity1.yCoord, tileentity1.zCoord & 0xf);
}
}
- markBlockNeedsUpdate(tileentity1.xCoord, tileentity1.yCoord, tileentity1.zCoord);
}
} while(true);
addedTileEntityList.clear();
@@ -1168,13 +1172,19 @@
public void addTileEntity(Collection collection)
{
- if(scanningTileEntities)
- {
- addedTileEntityList.addAll(collection);
- } else
- {
- loadedTileEntityList.addAll(collection);
- }
+ List dest=scanningTileEntities ? addedTileEntityList :
+ loadedTileEntityList;
+ for(Object ob : collection) {
+ TileEntity te=(TileEntity)ob;
+ if(te.canUpdate()) dest.add(te);
+ }
+ }
+
+ /* FORGE: Used as a bugfix */
+ public void addTileEntity(TileEntity te) {
+ List dest=scanningTileEntities ? addedTileEntityList :
+ loadedTileEntityList;
+ if(te.canUpdate()) dest.add(te);
}
public void updateEntity(Entity entity)
@@ -1372,6 +1382,9 @@
if(j2 == Block.fire.blockID || j2 == Block.lavaMoving.blockID || j2 == Block.lavaStill.blockID)
{
return true;
+ } else {
+ if(j2>0 && Block.blocksList[j2].isBlockBurning(this,k1,l1,i2))
+ return true;
}
}
@@ -1590,44 +1603,23 @@
public void setBlockTileEntity(int i, int j, int k, TileEntity tileentity)
{
- if(tileentity != null && !tileentity.isInvalid())
- {
- if(scanningTileEntities)
- {
- tileentity.xCoord = i;
- tileentity.yCoord = j;
- tileentity.zCoord = k;
- addedTileEntityList.add(tileentity);
- } else
- {
- loadedTileEntityList.add(tileentity);
- Chunk chunk = getChunkFromChunkCoords(i >> 4, k >> 4);
- if(chunk != null)
- {
- chunk.setChunkBlockTileEntity(i & 0xf, j, k & 0xf, tileentity);
- }
- }
- }
+ if(tileentity==null || tileentity.isInvalid())
+ return;
+ List dest=scanningTileEntities ? addedTileEntityList :
+ loadedTileEntityList;
+ if(tileentity.canUpdate()) dest.add(tileentity);
+ Chunk chunk = getChunkFromChunkCoords(i >> 4, k >> 4);
+ if(chunk != null) {
+ chunk.setChunkBlockTileEntity(i & 0xf, j, k & 0xf, tileentity);
+ }
}
public void removeBlockTileEntity(int i, int j, int k)
{
- TileEntity tileentity = getBlockTileEntity(i, j, k);
- if(tileentity != null && scanningTileEntities)
- {
- tileentity.invalidate();
- } else
- {
- if(tileentity != null)
- {
- loadedTileEntityList.remove(tileentity);
- }
- Chunk chunk = getChunkFromChunkCoords(i >> 4, k >> 4);
- if(chunk != null)
- {
- chunk.removeChunkBlockTileEntity(i & 0xf, j, k & 0xf);
- }
- }
+ Chunk chunk = getChunkFromChunkCoords(i >> 4, k >> 4);
+ if(chunk != null) {
+ chunk.removeChunkBlockTileEntity(i & 0xf, j, k & 0xf);
+ }
}
public void func_35239_a(TileEntity tileentity)
@@ -1650,13 +1642,18 @@
public boolean isBlockNormalCube(int i, int j, int k)
{
Block block = Block.blocksList[getBlockId(i, j, k)];
- if(block == null)
- {
- return false;
- } else
- {
- return block.blockMaterial.getIsOpaque() && block.isACube();
- }
+ if(block == null) return false;
+ return block.isBlockNormalCube(this,i,j,k);
+ }
+
+ /* FORGE: Determine if the given block is considered solid on the
+ * specified side. Used by placement logic.
+ */
+ public boolean isBlockSolidOnSide(int i, int j, int k, int side)
+ {
+ Block block = Block.blocksList[getBlockId(i, j, k)];
+ if(block == null) return false;
+ return block.isBlockSolidOnSide(this,i,j,k,side);
}
public void calculateInitialSkylight()
@@ -1976,7 +1973,7 @@
private int func_35241_e(int i, int j, int k, int l, int i1, int j1)
{
- int k1 = Block.lightValue[i1];
+ int k1 = (i1==0)?0:Block.blocksList[i1].getLightValue(this,j,k,l);
int l1 = getSavedLightValue(EnumSkyBlock.Block, j - 1, k, l) - j1;
int i2 = getSavedLightValue(EnumSkyBlock.Block, j + 1, k, l) - j1;
int j2 = getSavedLightValue(EnumSkyBlock.Block, j, k - 1, l) - j1;
@@ -2315,6 +2312,7 @@
{
block = null;
}
+ if(block!=null && block.isBlockReplaceable(this,j,k,l)) block=null;
return i > 0 && block == null && block1.canPlaceBlockOnSide(this, j, k, l, i1);
}
@@ -2759,7 +2757,7 @@
public int field_27080_i;
public boolean editingBlocks;
private long lockTimestamp;
- protected int autosavePeriod;
+ public int autosavePeriod;
public int difficultySetting;
public Random rand;
public boolean isNewWorld;

View File

@ -0,0 +1,32 @@
--- ../src_base/minecraft_server/net/minecraft/src/WorldServer.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/WorldServer.java 0000-00-00 00:00:00.000000000 -0000
@@ -54,15 +54,20 @@
public List getTileEntityList(int i, int j, int k, int l, int i1, int j1)
{
ArrayList arraylist = new ArrayList();
- for(int k1 = 0; k1 < loadedTileEntityList.size(); k1++)
- {
- TileEntity tileentity = (TileEntity)loadedTileEntityList.get(k1);
- if(tileentity.xCoord >= i && tileentity.yCoord >= j && tileentity.zCoord >= k && tileentity.xCoord < l && tileentity.yCoord < i1 && tileentity.zCoord < j1)
- {
- arraylist.add(tileentity);
- }
- }
-
+ for(int x=(i>>4); x<=(l>>4); x++)
+ for(int z=(k>>4); z<=(j1>>4); z++) {
+ Chunk ch=getChunkFromChunkCoords(x,z);
+ if(ch==null) continue;
+ for(Object ob : ch.chunkTileEntityMap.values()) {
+ TileEntity te=(TileEntity)ob;
+ if(te.isInvalid()) continue;
+ if(te.xCoord>=i && te.yCoord>=j && te.zCoord>=k
+ && te.xCoord<l && te.yCoord<i1 &&
+ te.zCoord<j1) {
+ arraylist.add(te);
+ }
+ }
+ }
return arraylist;
}

View File

@ -3,16 +3,16 @@ cd ..
rmdir /S /Q src
IF EXIST src_base (
move src_base src
rmdir /S /Q src_work
move src_base src
rmdir /S /Q src_work
) ELSE (
cmd /C decompile.bat
cd src
..\runtime\bin\python\python_mcp ..\forge\lfcr.py ..\forge\modLoaderMP.patch ..\forge\modLoaderMP-win.patch
..\runtime\bin\applydiff.exe -uf -p2 < ..\forge\modLoaderMP-win.patch
cd ..
cmd /C recompile.bat
cmd /C updatemd5.bat
cmd /C decompile.bat
cd src
..\runtime\bin\python\python_mcp ..\forge\lfcr.py ..\forge\modLoaderMP.patch ..\forge\modLoaderMP-win.patch
..\runtime\bin\applydiff.exe -uf -p2 < ..\forge\modLoaderMP-win.patch
cd ..
cmd /C recompile.bat
cmd /C updatemd5.bat
)
mkdir src_base
@ -20,6 +20,16 @@ mkdir src_work
xcopy /Y /E src\* src_base
xcopy /Y /E src\* src_work
cd src_work
..\runtime\bin\python\python_mcp ..\forge\lfcr.py ..\forge\minecraft.patch ..\forge\minecraft-win.patch
..\runtime\bin\applydiff.exe -uf -p2 < ..\forge\minecraft-win.patch
@setlocal enabledelayedexpansion
@echo off
set PATH=..\forge\bin;%PATH%
echo Applying patches
for /f %%i in ('find ../forge/patches -type f') do (
..\runtime\bin\python\python_mcp ..\forge\lfcr.py %%i %%i
..\runtime\bin\applydiff.exe -uf -p2 < %%i
)
cd ../forge
pause

Some files were not shown because too many files have changed in this diff Show More