merged with 1.1 branch

This commit is contained in:
Space Toad 2012-01-15 19:16:08 +00:00
parent 87d4c2134c
commit bfd0cfe506
118 changed files with 17590 additions and 16452 deletions

File diff suppressed because it is too large Load diff

View file

@ -213,6 +213,8 @@ net/minecraft/src/Packet8UpdateHealth.func_322_a(Ljava/io/DataOutputStream;)V=ja
net/minecraft/src/Packet8UpdateHealth.func_327_a(Ljava/io/DataInputStream;)V=java/io/IOException
net/minecraft/src/Packet9Respawn.func_322_a(Ljava/io/DataOutputStream;)V=java/io/IOException
net/minecraft/src/Packet9Respawn.func_327_a(Ljava/io/DataInputStream;)V=java/io/IOException
net/minecraft/src/Packet250CustomPayload.func_322_a(Ljava/io/DataOutputStream;)V=java/io/IOException
net/minecraft/src/Packet250CustomPayload.func_327_a(Ljava/io/DataInputStream;)V=java/io/IOException
net/minecraft/src/RegionFile.func_22196_b()V=java/io/IOException
net/minecraft/src/RegionFile.func_22198_a(III)V=java/io/IOException
net/minecraft/src/RegionFile.func_22200_a(I[BI)V=java/io/IOException
@ -226,3 +228,4 @@ net/minecraft/src/ThreadDownloadResources.func_1212_a(Ljava/net/URL;Ljava/io/Fil
net/minecraft/src/ThreadedChunkLoader.func_40551_a(Lnet/minecraft/src/ThreadedChunkLoaderPending;)V=java/io/IOException
net/minecraft/src/ThreadedChunkLoader.func_813_a(Lnet/minecraft/src/World;II)Lnet/minecraft/src/Chunk;=java/io/IOException
net/minecraft/src/ThreadedFileIOBase.func_40566_a()V=java/lang/InterruptedException
net/minecraft/src/StringTranslate.func_44025_a(Ljava/util/Properties;Ljava/lang/String;)V=java/io/IOException

File diff suppressed because it is too large Load diff

View file

@ -9,6 +9,9 @@ DirConf = conf
DirRuntime = runtime
DirLib = lib
DirFFOut = temp/ffout
DirBinOut = temp/bin
DirModSrc = modsrc
DirEclipse = eclipse
[CSV]
Classes = %(DirConf)s/classes.csv
@ -23,8 +26,8 @@ Server = %(DirTemp)s/server_rg.srg
DirNatives = %(DirJars)s/bin/natives
Client = %(DirJars)s/bin/minecraft.jar
Server = %(DirJars)s/minecraft_server.jar
MD5Client = 3820d222b95d0b8c520d9596a756a6e6
MD5Server = 934b6010999daa1f1b1ccdf4cb77e052
MD5Client = e92302d2acdba7c97e0d8df1e10d2006
MD5Server = b0f4fb91f9723104adf35944bbf3d3cf
[RETROGUARD]
Location = %(DirRuntime)s/bin/retroguard.jar
@ -50,8 +53,6 @@ XClientLog = %(DirLogs)s/client_exc.log
XServerLog = %(DirLogs)s/server_exc.log
[DECOMPILE]
FFClientConf = -rbr=0 -dgs=1 -asc=1
FFServerConf = -rbr=0 -dgs=1 -asc=1
FFClientOut = %(DirFFOut)s/client
FFServerOut = %(DirFFOut)s/server
FFClientSrc = %(DirFFOut)s/minecraft_exc.jar
@ -59,15 +60,12 @@ FFServerSrc = %(DirFFOut)s/minecraft_server_exc.jar
FFSource = net
[OUTPUT]
BinOut = %(DirTemp)s/bin
BinClient = %(DirTemp)s/bin/minecraft
BinServer = %(DirTemp)s/bin/minecraft_server
BinClient = %(DirBinOut)s/minecraft
BinServer = %(DirBinOut)s/minecraft_server
SrcClient = %(DirSrc)s/minecraft
SrcServer = %(DirSrc)s/minecraft_server
[PACKAGES]
PkgClient = net/minecraft/src,net/minecraft/client
PkgServer = net/minecraft/src,net/minecraft/server
TestClient = net/minecraft/client/Minecraft
TestServer = net/minecraft/server/MinecraftServer
[PATCHES]
PatchClient = %(DirConf)s/patches/minecraft.patch
@ -75,6 +73,8 @@ PatchServer = %(DirConf)s/patches/minecraft_server.patch
PatchTemp = %(DirTemp)s/temp.patch
FFPatchClient = %(DirConf)s/patches/minecraft_ff.patch
FFPatchServer = %(DirConf)s/patches/minecraft_server_ff.patch
PatchClient_osx = %(DirConf)s/patches/minecraft_osx.patch
PatchServer_osx = %(DirConf)s/patches/minecraft_server_osx.patch
[RECOMPILE]
BinClient = %(DirBin)s/minecraft
@ -84,8 +84,6 @@ ClassPathServer = %(DirLib)s/,%(DirLib)s/*,%(DirJars)s/minecraft_server.jar
ClientFixes = %(DirConf)s/patches
[REOBF]
SAFFXClient = %(DirTemp)s/minecraft.saffx
SAFFXServer = %(DirTemp)s/minecraft_server.saffx
MD5Client = %(DirTemp)s/client.md5
MD5Server = %(DirTemp)s/server.md5
MD5PreReobfClient = %(DirTemp)s/client_reobf.md5
@ -98,42 +96,46 @@ ObfJarClient = %(DirTemp)s/client_reobf.jar
ObfJarServer = %(DirTemp)s/server_reobf.jar
ReobfDirClient = %(DirReobf)s/minecraft
ReobfDirServer = %(DirReobf)s/minecraft_server
ClientRoLog = %(DirLogs)s/client_ro.log
ServerRoLog = %(DirLogs)s/server_ro.log
ReobfClientLog = %(DirLogs)s/client_reob.log
ReobfServerLog = %(DirLogs)s/server_reob.log
FixSound = minecraft/me.class
FixStart = minecraft/Start.class
FixSound = ga
FixStart = Start
NullPkg = net/minecraft/src
IgnorePkg = paulscode,com/jcraft,isom,ibxm,de/matthiasmann/twl,org/xmlpull,javax/xml
[GETMODSOURCE]
OutSRCClient = modsrc/client
OutSRCServer = modsrc/server
OutSRC = modsrc
OutSRCClient = %(DirModSrc)s/minecraft
OutSRCServer = %(DirModSrc)s/minecraft_server
[MCP]
LogFile = %(DirLogs)s/mcp.log
LogFileErr = %(DirLogs)s/mcperr.log
UpdateUrl = http://mcp.ocean-labs.de/files/mcprolling_{version}/
IgnoreUpdate = %(DirBin)s,%(DirLib)s,%(DirLogs)s,%(DirModSrc)s,%(DirReobf)s,%(DirSrc)s,%(DirTemp)s,%(DirEclipse)s/Client/bin,%(DirEclipse)s/Server/bin,%(DirJars)s/world,%(DirJars)s/saves,%(DirJars)s/resources
[COMMANDS]
Patcher = %(DirRuntime)s/bin/applydiff.exe
Patcher_win = %(DirRuntime)s/bin/applydiff.exe
Patcher_linux = patch
Patcher_osx = patch
Jad_win = %(DirRuntime)s/bin/jad.exe
Jad_linux = wine %(DirRuntime)s/bin/jad.exe
Jad_osx = %(DirRuntime)s/bin/jad-osx
AStyle_win = %(DirRuntime)s/bin/astyle.exe
AStyle_linux = wine %(DirRuntime)s/bin/astyle.exe
AStyle_osx = %(DirRuntime)s/bin/astyle-osx
JadRetro = %(DirRuntime)s/bin/jadretro.jar
Fernflower = %(DirRuntime)s/bin/fernflower.jar
Jadwin = %(DirRuntime)s/bin/jad.exe
Jadlinux = %(DirRuntime)s/bin/jad.exe
Jadosx = %(DirRuntime)s/bin/jad-osx
Exceptor = %(DirRuntime)s/bin/exceptor.jar
CmdRG = %s -cp {classpath} RetroGuard -searge {conffile}
CmdRGReobf = %s -cp {classpath} RetroGuard -notch {conffile}
CmdJadretro = %s -jar {jarjr} {targetdir}
CmdRecompClt = %s -g -source 1.6 -target 1.6 -classpath "{classpath}" -sourcepath {sourcepath} -d {outpath} {pkgs} {fixes}/*.java
CmdRecompSrv = %s -g -source 1.6 -target 1.6 -classpath "{classpath}" -sourcepath {sourcepath} -d {outpath} {pkgs}
CmdPatch = %s -p1 -u -i {patchfile} -d {srcdir}
CmdJad = %s -b -d {outdir} -dead -o -r -s .java -stat -ff {classes}
CmdAStyle = %s -A1s4CSKYm1M1pHjcnqz2 {classes}
CmdRG = %s -cp "{classpath}" RetroGuard -searge {conffile}
CmdRGReobf = %s -cp "{classpath}" RetroGuard -notch {conffile}
CmdJadretro = %s -jar %s {targetdir}
CmdFernflower = %s -jar %s -rbr=0 -dgs=1 -asc=1 -log=WARN {jarin} {jarout}
CmdExceptor = %s -jar %s {input} {output} {conf} {log}
CmdRecomp = %s -g -source 1.6 -target 1.6 -classpath "{classpath}" -sourcepath {sourcepath} -d {outpath} {pkgs}
CmdStartSrv = %s -Xincgc -Xms1024M -Xmx1024M -cp "{classpath}" net.minecraft.server.MinecraftServer
CmdStartClt = %s -Xincgc -Xms1024M -Xmx1024M -cp "{classpath}" -Djava.library.path={natives} Start
CmdJadwin = .\{binjad} -b -d {outdir} -dead -o -r -s .java -stat -v -ff {classes}
CmdJadlinux = wine {binjad} -b -d {outdir} -dead -o -r -s .java -stat -v -ff "{classes}"
CmdJadosx = {binjad} -b -d {outdir} -dead -o -r -s .java -stat -v -ff {classes}
CmdPatchwin = .\%(Patcher)s --binary -p1 -u -i ..\..\{patchfile} -d {srcdir}
CmdPatchlinux = patch --binary -p1 -u -i ../../{patchfile} -d {srcdir}
CmdPatchosx = patch --binary -p1 -u -i ../../{patchfile} -d {srcdir}
CmdFernflower = %s -jar {jarff} {conf} {jarin} {jarout}
CmdExceptor = %s -jar {jarexc} {input} {output} {conf} {log}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
diff -r -U 3 minecraft\net\minecraft\client\Minecraft.java minecraft_patched\net\minecraft\client\Minecraft.java
--- minecraft\net\minecraft\client\Minecraft.java Tue Nov 22 23:21:44 2011
+++ minecraft_patched\net\minecraft\client\Minecraft.java Wed Nov 23 00:09:14 2011
@@ -1600,11 +1600,13 @@
--- minecraft\net\minecraft\client\Minecraft.java Fri Jan 13 17:44:46 2012
+++ minecraft_patched\net\minecraft\client\Minecraft.java Fri Jan 13 17:35:06 2012
@@ -1609,11 +1609,13 @@
this.field_6324_e.func_600_a(var6.field_22395_a + var10, 64, var6.field_22396_c + var8);
if(!this.field_6327_b.func_35643_e()) {
@ -16,8 +16,8 @@ diff -r -U 3 minecraft\net\minecraft\client\Minecraft.java minecraft_patched\net
}
}
diff -r -U 3 minecraft\net\minecraft\src\CodecMus.java minecraft_patched\net\minecraft\src\CodecMus.java
--- minecraft\net\minecraft\src\CodecMus.java Tue Nov 22 23:21:36 2011
+++ minecraft_patched\net\minecraft\src\CodecMus.java Wed Nov 23 00:09:14 2011
--- minecraft\net\minecraft\src\CodecMus.java Fri Jan 13 17:44:20 2012
+++ minecraft_patched\net\minecraft\src\CodecMus.java Fri Jan 13 17:35:06 2012
@@ -1,5 +1,6 @@
package net.minecraft.src;
@ -39,8 +39,8 @@ diff -r -U 3 minecraft\net\minecraft\src\CodecMus.java minecraft_patched\net\min
}
}
diff -r -U 3 minecraft\net\minecraft\src\ItemMap.java minecraft_patched\net\minecraft\src\ItemMap.java
--- minecraft\net\minecraft\src\ItemMap.java Tue Nov 22 23:21:24 2011
+++ minecraft_patched\net\minecraft\src\ItemMap.java Wed Nov 23 00:09:14 2011
--- minecraft\net\minecraft\src\ItemMap.java Fri Jan 13 17:43:42 2012
+++ minecraft_patched\net\minecraft\src\ItemMap.java Fri Jan 13 17:35:06 2012
@@ -19,7 +19,6 @@
}
@ -58,8 +58,8 @@ diff -r -U 3 minecraft\net\minecraft\src\ItemMap.java minecraft_patched\net\mine
if(var4 == null) {
var1.func_28156_b(var2.func_28101_b("map"));
diff -r -U 3 minecraft\net\minecraft\src\MusInputStream.java minecraft_patched\net\minecraft\src\MusInputStream.java
--- minecraft\net\minecraft\src\MusInputStream.java Tue Nov 22 23:21:24 2011
+++ minecraft_patched\net\minecraft\src\MusInputStream.java Wed Nov 23 00:09:14 2011
--- minecraft\net\minecraft\src\MusInputStream.java Fri Jan 13 17:42:36 2012
+++ minecraft_patched\net\minecraft\src\MusInputStream.java Fri Jan 13 17:35:06 2012
@@ -1,5 +1,6 @@
package net.minecraft.src;
@ -82,8 +82,8 @@ diff -r -U 3 minecraft\net\minecraft\src\MusInputStream.java minecraft_patched\n
for(int var4 = 0; var4 < var3; ++var4) {
byte var5 = var1[var2 + var4] = (byte)(var1[var2 + var4] ^ this.field_1516_c >> 8);
diff -r -U 3 minecraft\net\minecraft\src\RenderGlobal.java minecraft_patched\net\minecraft\src\RenderGlobal.java
--- minecraft\net\minecraft\src\RenderGlobal.java Tue Nov 22 23:21:20 2011
+++ minecraft_patched\net\minecraft\src\RenderGlobal.java Wed Nov 23 00:10:20 2011
--- minecraft\net\minecraft\src\RenderGlobal.java Fri Jan 13 17:43:24 2012
+++ minecraft_patched\net\minecraft\src\RenderGlobal.java Fri Jan 13 17:35:06 2012
@@ -1466,7 +1466,7 @@
double var15 = this.field_1439_t.field_22009_h.field_611_ak - var2;
double var17 = this.field_1439_t.field_22009_h.field_610_al - var4;
@ -94,8 +94,8 @@ diff -r -U 3 minecraft\net\minecraft\src\RenderGlobal.java minecraft_patched\net
this.field_1439_t.field_6321_h.func_1192_a(var21 = new EntityHugeExplodeFX(this.field_1448_k, var2, var4, var6, var8, var10, var12));
} else if(var1.equals("largeexplode")) {
diff -r -U 3 minecraft\net\minecraft\src\ThreadedFileIOBase.java minecraft_patched\net\minecraft\src\ThreadedFileIOBase.java
--- minecraft\net\minecraft\src\ThreadedFileIOBase.java Tue Nov 22 23:21:30 2011
+++ minecraft_patched\net\minecraft\src\ThreadedFileIOBase.java Wed Nov 23 00:09:14 2011
--- minecraft\net\minecraft\src\ThreadedFileIOBase.java Fri Jan 13 17:43:00 2012
+++ minecraft_patched\net\minecraft\src\ThreadedFileIOBase.java Fri Jan 13 17:35:06 2012
@@ -21,7 +21,9 @@
}

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
diff -r -U 3 minecraft_server\net\minecraft\src\ItemMap.java minecraft_server_patched\net\minecraft\src\ItemMap.java
--- minecraft_server\net\minecraft\src\ItemMap.java Tue Nov 22 23:21:56 2011
+++ minecraft_server_patched\net\minecraft\src\ItemMap.java Wed Nov 23 00:09:45 2011
--- minecraft_server\net\minecraft\src\ItemMap.java Fri Jan 13 17:46:22 2012
+++ minecraft_server_patched\net\minecraft\src\ItemMap.java Fri Jan 13 17:37:00 2012
@@ -22,7 +22,6 @@
}
@ -11,8 +11,8 @@ diff -r -U 3 minecraft_server\net\minecraft\src\ItemMap.java minecraft_server_pa
var1.func_28145_b(var2.func_28104_b("map"));
diff -r -U 3 minecraft_server\net\minecraft\src\RConThreadClient.java minecraft_server_patched\net\minecraft\src\RConThreadClient.java
diff -r -U 3 minecraft_server\net\minecraft\src\ThreadedFileIOBase.java minecraft_server_patched\net\minecraft\src\ThreadedFileIOBase.java
--- minecraft_server\net\minecraft\src\ThreadedFileIOBase.java Tue Nov 22 23:22:10 2011
+++ minecraft_server_patched\net\minecraft\src\ThreadedFileIOBase.java Wed Nov 23 00:09:45 2011
--- minecraft_server\net\minecraft\src\ThreadedFileIOBase.java Fri Jan 13 17:45:20 2012
+++ minecraft_server_patched\net\minecraft\src\ThreadedFileIOBase.java Fri Jan 13 17:37:00 2012
@@ -21,7 +21,9 @@
}

View file

@ -182,6 +182,8 @@ net/minecraft/src/Packet8UpdateHealth.func_68_a(Ljava/io/DataOutputStream;)V=jav
net/minecraft/src/Packet8UpdateHealth.func_70_a(Ljava/io/DataInputStream;)V=java/io/IOException
net/minecraft/src/Packet9Respawn.func_68_a(Ljava/io/DataOutputStream;)V=java/io/IOException
net/minecraft/src/Packet9Respawn.func_70_a(Ljava/io/DataInputStream;)V=java/io/IOException
net/minecraft/src/Packet250CustomPayload.func_68_a(Ljava/io/DataOutputStream;)V=java/io/IOException
net/minecraft/src/Packet250CustomPayload.func_70_a(Ljava/io/DataInputStream;)V=java/io/IOException
net/minecraft/src/RConOutputStream.func_40393_a(I)V=java/io/IOException
net/minecraft/src/RConOutputStream.func_40394_a(S)V=java/io/IOException
net/minecraft/src/RConOutputStream.func_40396_a([B)V=java/io/IOException
@ -200,3 +202,4 @@ net/minecraft/src/RegionFile.func_22138_b(III)V=java/io/IOException
net/minecraft/src/ThreadedChunkLoader.func_40325_a(Lnet/minecraft/src/ThreadedChunkLoaderPending;)V=java/io/IOException
net/minecraft/src/ThreadedChunkLoader.func_659_a(Lnet/minecraft/src/World;II)Lnet/minecraft/src/Chunk;=java/io/IOException
net/minecraft/src/ThreadedFileIOBase.func_40508_a()V=java/lang/InterruptedException
net/minecraft/src/StringTranslate.func_44011_a(Ljava/util/Properties;Ljava/lang/String;)V=java/io/IOException

View file

@ -1,4 +1,4 @@
[VERSION]
MCPVersion = 5.0
ClientVersion = 1.0.0
ServerVersion = 1.0.1
MCPVersion = 5.6
ClientVersion = 1.1
ServerVersion = 1.1

View file

@ -1,33 +1,18 @@
diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/server/MinecraftServer.java ../src_work/minecraft_server/net/minecraft/server/MinecraftServer.java
--- ../src_base/minecraft_server/net/minecraft/server/MinecraftServer.java 2011-07-17 00:28:07.755771900 +0200
+++ ../src_work/minecraft_server/net/minecraft/server/MinecraftServer.java 2011-07-17 00:28:09.485870900 +0200
@@ -333,41 +333,22 @@
}
finally
@@ -397,38 +397,7 @@
{
- System.exit(0);
+ try
+ {
+ stopServer();
+ serverStopped = true;
+ }
+ catch(Throwable throwable2)
+ {
+ throwable2.printStackTrace();
+ }
+ finally
+ {
+ System.exit(0);
+ }
System.exit(0);
}
- break MISSING_BLOCK_LABEL_350;
- }
}
- try
- {
- stopServer();
- serverStopped = true;
- }
- catch(Throwable throwable)
- catch (Throwable throwable)
- {
- throwable.printStackTrace();
- }
@ -43,7 +28,7 @@ diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/server
- stopServer();
- serverStopped = true;
- }
- catch(Throwable throwable3)
- catch (Throwable throwable3)
- {
- throwable3.printStackTrace();
- }
@ -53,10 +38,9 @@ diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/server
- }
- throw exception2;
}
+}
private void doTick()
{
diff U3 ../src_base/minecraft_server/net/minecraft/src/MLProp.java ../src_work/minecraft_server/net/minecraft/src/MLProp.java
--- ../src_base/minecraft_server/net/minecraft/src/MLProp.java Wed Nov 30 22:27:22 2011
+++ ../src_work/minecraft_server/net/minecraft/src/MLProp.java Sun Dec 04 14:31:04 2011

View file

@ -1,146 +1,89 @@
--- ../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 @@
@@ -1,5 +1,6 @@
package net.minecraft.src;
+import net.minecraft.src.forge.ForgeHooks;
import java.util.ArrayList;
import java.util.Random;
@@ -312,12 +313,14 @@
@@ -277,12 +278,12 @@
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));
+ 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));
+ return iblockaccess.getLightBrightnessForSkyBlocks(i, j, k, getLightValue(iblockaccess,i,j,k));
}
public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
@@ -438,25 +441,70 @@
{
return 1;
}
-
+
+ /* FORGE: Metadata-sensitive version.
+ */
+ public int quantityDropped(int meta, int fortune, Random random)
+ {
+ return quantityDroppedWithBonus(fortune, random);
+ }
+
+ /* FORGE: Metadata-sensitive version.
+ *
+ * This is deprecated in MC 1.0+ versions because of the new Enchantment
+ * system requiring a new argument. Will be removed unless a valid reason
+ * for it to remain is brought to light.
+ *
+ * Implementing this in your mod will not do anything!
+ */
+ @Deprecated
+ public int quantityDropped(int meta, Random random)
+ {
+ return quantityDropped(meta, 0, random);
+ }
+
public int idDropped(int i, Random random, int j)
{
@@ -410,20 +411,15 @@
return blockID;
}
+ /* FORGE: This function isnt called by Minecraft anymore. Use
+ * blockStrength(EntityPlayer,int) instead.
+ /**
+ * Deprecated in favor of a metadata sensitive version
+ * @param entityplayer Entity attacking the block
+ * @return
+ */
+ @Deprecated
public float blockStrength(EntityPlayer entityplayer)
{
- if(blockHardness < 0.0F)
- if (blockHardness < 0.0F)
- {
- return 0.0F;
- }
- if(!entityplayer.canHarvestBlock(this))
- if (!entityplayer.canHarvestBlock(this))
- {
- return 1.0F / blockHardness / 100F;
- } else
- }
- 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, int fortune) {
+
+ ArrayList<ItemStack> tr = new ArrayList<ItemStack>();
+
+ int q = quantityDropped(md, fortune, world.rand);
+ for (int n = 0; n < q; n++) {
+ int id = idDropped(md, world.rand, 0);
+ if(id > 0) {
+ tr.add(new ItemStack(id, 1, damageDropped(md)));
+ }
+ }
+ return tr;
+ }
+
+ /* FORGE: This function returns the complete list of drops for a block.
+ *
+ * This is deprecated in MC 1.0+ versions because of the new Enchantment
+ * system requiring a new argument. Will be removed unless a valid reason
+ * for it to remain is brought to light.
+ *
+ * Implementing this in your mod will not do anything!
+ */
+ @Deprecated
+ public ArrayList<ItemStack> getBlockDropped(World world,
+ int i, int j, int k, int md) {
+ return getBlockDropped (world, i, j, k, md, 0);
+ return blockStrength(entityplayer, 0);
}
public final void dropBlockAsItem(World world, int i, int j, int k, int l, int i1)
@@ -470,18 +518,13 @@
@@ -437,18 +433,15 @@
{
return;
}
- int j1 = quantityDroppedWithBonus(i1, world.rand);
- for(int k1 = 0; k1 < j1; k1++)
- {
+ ArrayList<ItemStack> ar = getBlockDropped(world, i, j, k, l, i1);
+ for (ItemStack ist : ar) {
if(world.rand.nextFloat() > f)
- for (int k1 = 0; k1 < j1; k1++)
+
+ ArrayList<ItemStack> items = getBlockDropped(world, i, j, k, l, i1);
+ for(ItemStack item : items)
{
if (world.rand.nextFloat() > f)
{
continue;
}
- int l1 = idDropped(l, world.rand, i1);
- if(l1 > 0)
- if (l1 > 0)
- {
- dropBlockAsItem_do(world, i, j, k, new ItemStack(l1, 1, damageDropped(l)));
- }
+ dropBlockAsItem_do(world, i, j, k, ist);
+ dropBlockAsItem_do(world, i, j, k, item);
}
}
@@ -726,7 +769,7 @@
@@ -696,7 +689,7 @@
{
entityplayer.addStat(StatList.mineBlockStatArray[blockID], 1);
entityplayer.addExhaustion(0.025F);
- if(renderAsNormalBlock() && !isBlockContainer[blockID] && EnchantmentHelper.getSilkTouchModifier(entityplayer.inventory))
+ if(renderAsNormalBlock() && !hasTileEntity(l) && EnchantmentHelper.getSilkTouchModifier(entityplayer.inventory))
- if (renderAsNormalBlock() && !isBlockContainer[blockID] && EnchantmentHelper.getSilkTouchModifier(entityplayer.inventory))
+ if (renderAsNormalBlock() && !hasTileEntity(l) && EnchantmentHelper.getSilkTouchModifier(entityplayer.inventory))
{
ItemStack itemstack = createStackedBlock(l);
if(itemstack != null)
@@ -805,6 +848,248 @@
return iblockaccess.isBlockNormalCube(i, j, k) ? 0.2F : 1.0F;
if (itemstack != null)
@@ -780,6 +773,273 @@
{
}
+ /* FORGE: Allow a block to set illumination on a coordinate basis.
@ -151,19 +94,9 @@
+
+ /* FORGE: Implement and return true if you wish this block to behave
+ * like a ladder when the player is inside.
+ *
+ * This is deprecated in favor of the more flexible version below.
+ */
+ @Deprecated
+ public boolean isLadder() {
+ return false;
+ }
+
+ /* FORGE: Implement and return true if you wish this block to behave
+ * like a ladder when the player is inside.
+ */
+ public boolean isLadder(World world, int i, int j, int k) {
+ return isLadder();
+ return false;
+ }
+
+ /* FORGE: Return true if the block is a normal, solid cube. This
@ -358,14 +291,7 @@
+ */
+ public boolean hasTileEntity(int metadata)
+ {
+ if (isBlockContainer[blockID])
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ return isBlockContainer[blockID];
+ }
+
+ /**
@ -383,7 +309,49 @@
+ return ((BlockContainer)this).getBlockEntity(metadata);
+ }
+ return null;
+ }
+
+ /**
+ * Metadata and fortune sensitive version, this replaces the old (int meta, Random rand)
+ * version in 1.1.
+ *
+ * @param meta Blocks Metadata
+ * @param fortune Current item fortune level
+ * @param random Random number generator
+ * @return The number of items to drop
+ */
+ public int quantityDropped(int meta, int fortune, Random random)
+ {
+ return quantityDroppedWithBonus(fortune, random);
+ }
+
+ /**
+ * This returns a complete list of items dropped from this block.
+ *
+ * @param world The current world
+ * @param X X Position
+ * @param Y Y Position
+ * @param Z Z Position
+ * @param metadata Current metadata
+ * @param fortune Breakers fortune level
+ * @return A ArrayList containing all items this block drops
+ */
+ public ArrayList<ItemStack> getBlockDropped(World world, int X, int Y, int Z, int metadata, int fortune)
+ {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+
+ int count = quantityDropped(metadata, fortune, world.rand);
+ for(int i = 0; i < count; i++)
+ {
+ int id = idDropped(metadata, world.rand, 0);
+ if (id > 0)
+ {
+ ret.add(new ItemStack(id, 1, damageDropped(metadata)));
+ }
+ }
+ return ret;
+ }
+
+
static Class _mthclass$(String s)
{

View file

@ -1,119 +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 @@
@@ -32,36 +32,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))
- 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))
- 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))
- 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);
+ 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))
- 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))
- 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))
- 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);
+ 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 @@
@@ -69,19 +69,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))
- 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))
}
- else if (l == 3 && world.isBlockNormalCube(i, j, k - 1))
+ else 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))
}
- else if (l == 4 && world.isBlockNormalCube(i + 1, j, k))
+ else 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))
}
- else if (l == 5 && world.isBlockNormalCube(i - 1, j, k))
+ else if (l == 5 && world.isBlockSolidOnSide(i - 1, j, k, 5))
{
i1 = 1;
} else
@@ -102,19 +102,19 @@
}
@@ -94,19 +94,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))
- 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))
- 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))
- 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;
+ 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 @@
@@ -115,19 +115,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)
- 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)
- 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)
- 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)
- if (!world.isBlockNormalCube(i, j, k + 1) && i1 == 4)
+ if (!world.isBlockSolidOnSide(i, j, k + 1, 2) && i1 == 4)
{
flag = true;
}

View file

@ -1,31 +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
@@ -429,23 +429,23 @@
@@ -424,23 +424,23 @@
{
return true;
}
- if(world.isBlockNormalCube(i, j + 1, k))
+ if(world.isBlockSolidOnSide(i, j + 1, k,0))
- 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))
- 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))
- 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))
- 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))
- 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

@ -1,6 +1,6 @@
--- ../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 @@
@@ -17,7 +17,7 @@
public void onBlockAdded(World world, int i, int j, int k)
{
super.onBlockAdded(world, i, j, k);
@ -9,13 +9,19 @@
}
public void onBlockRemoval(World world, int i, int j, int k)
@@ -37,6 +37,12 @@
@@ -28,6 +28,18 @@
public abstract TileEntity getBlockEntity();
+ /* FORGE: Metadata-sensitive version, to fix 1.8.1 regression.
+ */
+ public TileEntity getBlockEntity(int md) {
+ /**
+ * Metadata-sensitive version, to fix 1.8.1 regression.
+ * @param metadata The current Metadata
+ * @return And instance of the TileEntity class for this block
+ */
+ public TileEntity getBlockEntity(int md)
+ {
+ return getBlockEntity();
+ }
+

View file

@ -1,36 +1,37 @@
--- ../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 @@
@@ -1,6 +1,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,28 +109,22 @@
public class BlockCrops extends BlockFlower
{
@@ -98,27 +99,23 @@
return 6;
}
- public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f, int i1)
- {
- super.dropBlockAsItemWithChance(world, i, j, k, l, f, 0);
- if(world.multiplayerWorld)
+ @Override
+ public ArrayList<ItemStack> getBlockDropped(World world, int i, int j, int k, int md, int fortune) {
+ ArrayList<ItemStack> tr = new ArrayList<ItemStack>();
+ if (md == 7)
{
+ public ArrayList<ItemStack> getBlockDropped(World world, int i, int j, int k, int meta, int fortune)
{
- super.dropBlockAsItemWithChance(world, i, j, k, l, f, 0);
- if (world.multiplayerWorld)
- {
- return;
+ tr.add(new ItemStack(Item.wheat));
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ if (meta == 7)
+ {
+ ret.add(new ItemStack(Item.wheat));
}
- int j1 = 3 + i1;
- for(int k1 = 0; k1 < j1; k1++)
+
+ for(int n = 0; n < 3+fortune; n++)
- for (int k1 = 0; k1 < j1; k1++)
+
+ for (int n = 0; n < 3 + fortune; n++)
{
- if(world.rand.nextInt(15) <= l)
+ if (world.rand.nextInt(15) <= md)
- if (world.rand.nextInt(15) <= l)
+ if (world.rand.nextInt(15) <= meta)
{
- float f1 = 0.7F;
- float f2 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
@ -39,11 +40,10 @@
- EntityItem entityitem = new EntityItem(world, (float)i + f2, (float)j + f3, (float)k + f4, new ItemStack(Item.seeds));
- entityitem.delayBeforeCanPickup = 10;
- world.spawnEntityInWorld(entityitem);
+ tr.add(new ItemStack(Item.seeds));
+ ret.add(new ItemStack(Item.seeds));
}
}
-
+ return tr;
+ return ret;
}
public int idDropped(int i, Random random, int j)

View file

@ -1,29 +1,29 @@
--- ../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
@@ -111,7 +111,7 @@
@@ -101,7 +101,7 @@
{
if(blockMaterial == Material.iron)
if (blockMaterial == Material.iron)
{
- return true;
+ return false;
}
int l = world.getBlockMetadata(i, j, k);
if((l & 8) != 0)
@@ -178,7 +178,7 @@
if ((l & 8) != 0)
@@ -169,7 +169,7 @@
world.setBlockWithNotify(i, j, k, 0);
flag = true;
}
- if(!world.isBlockNormalCube(i, j - 1, k))
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1))
- if (!world.isBlockNormalCube(i, j - 1, k))
+ if (!world.isBlockSolidOnSide(i, j - 1, k, 1))
{
world.setBlockWithNotify(i, j, k, 0);
flag = true;
@@ -241,7 +241,7 @@
return false;
} else
@@ -238,7 +238,7 @@
}
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);
+ return world.isBlockSolidOnSide(i, j - 1, k, 1) && super.canPlaceBlockAt(world, i, j, k) && super.canPlaceBlockAt(world, i, j + 1, k);
}
}

View file

@ -1,15 +1,6 @@
--- ../src_base/minecraft/net/minecraft/src/BlockFire.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockFire.java 0000-00-00 00:00:00.000000000 -0000
@@ -14,14 +14,14 @@
public class BlockFire extends Block
{
- private int chanceToEncourageFire[];
- private int abilityToCatchFire[];
-
+ private int chanceToEncourageFire[];
+ private int abilityToCatchFire[];
+
@@ -10,8 +10,8 @@
protected BlockFire(int i, int j)
{
super(i, j, Material.fire);
@ -20,7 +11,7 @@
setTickOnLoad(true);
}
@@ -38,11 +38,10 @@
@@ -28,11 +28,10 @@
setBurnRate(Block.cloth.blockID, 30, 60);
setBurnRate(Block.vine.blockID, 15, 100);
}
@ -34,34 +25,34 @@
}
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k)
@@ -77,11 +76,9 @@
@@ -67,11 +66,9 @@
public void updateTick(World world, int i, int j, int k, Random random)
{
- boolean flag = world.getBlockId(i, j - 1, k) == Block.netherrack.blockID;
- if((world.worldProvider instanceof WorldProviderEnd) && world.getBlockId(i, j - 1, k) == Block.bedrock.blockID)
- if ((world.worldProvider instanceof WorldProviderEnd) && world.getBlockId(i, j - 1, k) == Block.bedrock.blockID)
- {
- flag = true;
- }
+ Block base = Block.blocksList[world.getBlockId(i, j - 1, k)];
+ Block base = Block.blocksList[world.getBlockId(i, j - 1, k)];
+ boolean flag = (base != null && base.isFireSource(world, i, j - 1, k, world.getBlockMetadata(i, j - 1, k), 0));
+
if(!canPlaceBlockAt(world, i, j, k))
if (!canPlaceBlockAt(world, i, j, k))
{
world.setBlockWithNotify(i, j, k, 0);
@@ -99,23 +96,23 @@
@@ -89,23 +86,23 @@
world.scheduleBlockUpdate(i, j, k, blockID, tickRate());
if(!flag && !func_263_h(world, i, j, k))
if (!flag && !func_263_h(world, i, j, k))
{
- if(!world.isBlockNormalCube(i, j - 1, k) || l > 3)
+ if(!world.isBlockSolidOnSide(i, j - 1, k, 0) || l > 3)
- if (!world.isBlockNormalCube(i, j - 1, k) || l > 3)
+ if (!world.isBlockSolidOnSide(i, j - 1, k, 1) || l > 3)
{
world.setBlockWithNotify(i, j, k, 0);
}
return;
}
- if(!flag && !canBlockCatchFire(world, i, j - 1, k) && l == 15 && random.nextInt(4) == 0)
+ if(!flag && !canBlockCatchFire(world, i, j - 1, k, 0) && l == 15 && random.nextInt(4) == 0)
- if (!flag && !canBlockCatchFire(world, i, j - 1, k) && l == 15 && random.nextInt(4) == 0)
+ if (!flag && !canBlockCatchFire(world, i, j - 1, k, 1) && l == 15 && random.nextInt(4) == 0)
{
world.setBlockWithNotify(i, j, k, 0);
return;
@ -78,60 +69,61 @@
+ tryToCatchBlockOnFire(world, i, j + 1, k, 250, random, l, 0);
+ tryToCatchBlockOnFire(world, i, j, k - 1, 300, random, l, 3);
+ tryToCatchBlockOnFire(world, i, j, k + 1, 300, random, l, 2);
for(int i1 = i - 1; i1 <= i + 1; i1++)
for (int i1 = i - 1; i1 <= i + 1; i1++)
{
for(int j1 = k - 1; j1 <= k + 1; j1++)
@@ -155,9 +152,23 @@
for (int j1 = k - 1; j1 <= k + 1; j1++)
@@ -142,9 +139,24 @@
}
}
+ /*
+ * Added for backwards compatibility, should not be called by anyone who is making a mod for forge
+ /**
+ * Deprecated for a side-sensitive version
+ */
+ @Deprecated
private void tryToCatchBlockOnFire(World world, int i, int j, int k, int l, Random random, int i1)
{
- int j1 = abilityToCatchFire[world.getBlockId(i, j, k)];
+ tryToCatchBlockOnFire(world, i, j, k, l, random, i1, 0);
+ tryToCatchBlockOnFire(world, i, j, k, l, random, i1, 0);
+ }
+
+ private void tryToCatchBlockOnFire(World world, int i, int j, int k, int l, Random random, int i1, int face)
+ {
+ Block block = Block.blocksList[world.getBlockId(i, j, k)];
+ int j1 = 0;
+ if (block != null)
+ {
+ j1 = block.getFlammability(world, i, j, k, world.getBlockMetadata(i, j, k), face);
+ }
if(random.nextInt(l) < j1)
+ int j1 = 0;
+ Block block = Block.blocksList[world.getBlockId(i, j, k)];
+ if (block != null)
+ {
+ j1 = block.getFlammability(world, i, j, k, world.getBlockMetadata(i, j, k), face);
+ }
+
if (random.nextInt(l) < j1)
{
boolean flag = world.getBlockId(i, j, k) == Block.tnt.blockID;
@@ -182,27 +193,27 @@
@@ -170,27 +182,27 @@
private boolean func_263_h(World world, int i, int j, int k)
{
- if(canBlockCatchFire(world, i + 1, j, k))
+ if(canBlockCatchFire(world, i + 1, j, k, 4))
- if (canBlockCatchFire(world, i + 1, j, k))
+ if (canBlockCatchFire(world, i + 1, j, k, 4))
{
return true;
}
- if(canBlockCatchFire(world, i - 1, j, k))
+ if(canBlockCatchFire(world, i - 1, j, k, 5))
- if (canBlockCatchFire(world, i - 1, j, k))
+ if (canBlockCatchFire(world, i - 1, j, k, 5))
{
return true;
}
- if(canBlockCatchFire(world, i, j - 1, k))
+ if(canBlockCatchFire(world, i, j - 1, k, 1))
- if (canBlockCatchFire(world, i, j - 1, k))
+ if (canBlockCatchFire(world, i, j - 1, k, 1))
{
return true;
}
- if(canBlockCatchFire(world, i, j + 1, k))
+ if(canBlockCatchFire(world, i, j + 1, k, 0))
- if (canBlockCatchFire(world, i, j + 1, k))
+ if (canBlockCatchFire(world, i, j + 1, k, 0))
{
return true;
}
- if(canBlockCatchFire(world, i, j, k - 1))
+ if(canBlockCatchFire(world, i, j, k - 1, 3))
- if (canBlockCatchFire(world, i, j, k - 1))
+ if (canBlockCatchFire(world, i, j, k - 1, 3))
{
return true;
}
@ -140,9 +132,9 @@
}
private int getChanceOfNeighborsEncouragingFire(World world, int i, int j, int k)
@@ -213,12 +224,12 @@
return 0;
} else
@@ -202,12 +214,12 @@
}
else
{
- l = getChanceToEncourageFire(world, i + 1, j, k, l);
- l = getChanceToEncourageFire(world, i - 1, j, k, l);
@ -159,22 +151,123 @@
return l;
}
}
@@ -227,15 +238,43 @@
{
@@ -217,32 +229,32 @@
return false;
}
-
+
+ /*
+ * Added for backwards compatibility, should not be called by anyone who is making a mod for forge
+ /**
+ * Deprecated for a side-sensitive version
+ */
+ @Deprecated
public boolean canBlockCatchFire(IBlockAccess iblockaccess, int i, int j, int k)
{
- return chanceToEncourageFire[iblockaccess.getBlockId(i, j, k)] > 0;
+ return canBlockCatchFire(iblockaccess, i, j, k, 0);
+ return canBlockCatchFire(iblockaccess, i, j, k, 0);
}
-
+
+ /**
+ * Deprecated for a side-sensitive version
+ */
+ @Deprecated
public int getChanceToEncourageFire(World world, int i, int j, int k, int l)
{
- int i1 = chanceToEncourageFire[world.getBlockId(i, j, k)];
- if (i1 > l)
- {
- return i1;
- }
- else
- {
- return l;
- }
+ return getChanceToEncourageFire(world, i, j, k, l, 0);
}
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- return world.isBlockNormalCube(i, j - 1, k) || func_263_h(world, i, j, k);
+ return world.isBlockSolidOnSide(i, j - 1, k, 1) || func_263_h(world, i, j, k);
}
public void onNeighborBlockChange(World world, int i, int j, int k, int l)
{
- if (!world.isBlockNormalCube(i, j - 1, k) && !func_263_h(world, i, j, k))
+ if (!world.isBlockSolidOnSide(i, j - 1, k, 1) && !func_263_h(world, i, j, k))
{
world.setBlockWithNotify(i, j, k, 0);
return;
@@ -259,7 +271,7 @@
{
return;
}
- if (!world.isBlockNormalCube(i, j - 1, k) && !func_263_h(world, i, j, k))
+ if (!world.isBlockSolidOnSide(i, j - 1, k, 1) && !func_263_h(world, i, j, k))
{
world.setBlockWithNotify(i, j, k, 0);
return;
@@ -277,7 +289,7 @@
{
world.playSoundEffect((float)i + 0.5F, (float)j + 0.5F, (float)k + 0.5F, "fire.fire", 1.0F + random.nextFloat(), random.nextFloat() * 0.7F + 0.3F);
}
- if (world.isBlockNormalCube(i, j - 1, k) || Block.fire.canBlockCatchFire(world, i, j - 1, k))
+ if (world.isBlockSolidOnSide(i, j - 1, k, 1) || Block.fire.canBlockCatchFire(world, i, j - 1, k))
{
for (int l = 0; l < 3; l++)
{
@@ -289,7 +301,7 @@
}
else
{
- if (Block.fire.canBlockCatchFire(world, i - 1, j, k))
+ if (Block.fire.canBlockCatchFire(world, i - 1, j, k, 5))
{
for (int i1 = 0; i1 < 2; i1++)
{
@@ -299,7 +311,7 @@
world.spawnParticle("largesmoke", f1, f7, f13, 0.0D, 0.0D, 0.0D);
}
}
- if (Block.fire.canBlockCatchFire(world, i + 1, j, k))
+ if (Block.fire.canBlockCatchFire(world, i + 1, j, k, 4))
{
for (int j1 = 0; j1 < 2; j1++)
{
@@ -309,7 +321,7 @@
world.spawnParticle("largesmoke", f2, f8, f14, 0.0D, 0.0D, 0.0D);
}
}
- if (Block.fire.canBlockCatchFire(world, i, j, k - 1))
+ if (Block.fire.canBlockCatchFire(world, i, j, k - 1, 3))
{
for (int k1 = 0; k1 < 2; k1++)
{
@@ -319,7 +331,7 @@
world.spawnParticle("largesmoke", f3, f9, f15, 0.0D, 0.0D, 0.0D);
}
}
- if (Block.fire.canBlockCatchFire(world, i, j, k + 1))
+ if (Block.fire.canBlockCatchFire(world, i, j, k + 1, 2))
{
for (int l1 = 0; l1 < 2; l1++)
{
@@ -329,7 +341,7 @@
world.spawnParticle("largesmoke", f4, f10, f16, 0.0D, 0.0D, 0.0D);
}
}
- if (Block.fire.canBlockCatchFire(world, i, j + 1, k))
+ if (Block.fire.canBlockCatchFire(world, i, j + 1, k, 0))
{
for (int i2 = 0; i2 < 2; i2++)
{
@@ -341,4 +353,41 @@
}
}
}
+
+ /**
+ * Forge: Side sensitive version
+ */
+ public boolean canBlockCatchFire(IBlockAccess world, int i, int j, int k, int face)
+ {
+ Block block = Block.blocksList[world.getBlockId(i, j, k)];
@ -185,102 +278,27 @@
+ return false;
+ }
+
+ /*
+ * Added for backwards compatibility, should not be called by anyone who is making a mod for forge
+ /**
+ * Forge: Side sensitive version
+ */
+ @Deprecated
public int getChanceToEncourageFire(World world, int i, int j, int k, int l)
{
- int i1 = chanceToEncourageFire[world.getBlockId(i, j, k)];
+ return getChanceToEncourageFire(world, i, j, k, l, 0);
+ }
+
+ public int getChanceToEncourageFire(World world, int i, int j, int k, int l, int face)
+ {
+ int i1 = 0;
+
+ Block block = Block.blocksList[world.getBlockId(i, j, k)];
+ if (block != null)
+ {
+ i1 = block.getFireSpreadSpeed(world, i, j, k, world.getBlockMetadata(i, j, k), face);
+ }
if(i1 > l)
{
return i1;
@@ -247,12 +286,12 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- return world.isBlockNormalCube(i, j - 1, k) || func_263_h(world, i, j, k);
+ return world.isBlockSolidOnSide(i, j - 1, k, 1) || func_263_h(world, i, j, k);
}
public void onNeighborBlockChange(World world, int i, int j, int k, int l)
{
- if(!world.isBlockNormalCube(i, j - 1, k) && !func_263_h(world, i, j, k))
+ if(!world.isBlockSolidOnSide(i, j - 1, k, 1) && !func_263_h(world, i, j, k))
{
world.setBlockWithNotify(i, j, k, 0);
return;
@@ -268,7 +307,7 @@
{
return;
}
- if(!world.isBlockNormalCube(i, j - 1, k) && !func_263_h(world, i, j, k))
+ if(!world.isBlockSolidOnSide(i, j - 1, k, 0) && !func_263_h(world, i, j, k))
{
world.setBlockWithNotify(i, j, k, 0);
return;
@@ -285,7 +324,7 @@
{
world.playSoundEffect((float)i + 0.5F, (float)j + 0.5F, (float)k + 0.5F, "fire.fire", 1.0F + random.nextFloat(), random.nextFloat() * 0.7F + 0.3F);
}
- if(world.isBlockNormalCube(i, j - 1, k) || Block.fire.canBlockCatchFire(world, i, j - 1, k))
+ if(world.isBlockSolidOnSide(i, j - 1, k, 1) || Block.fire.canBlockCatchFire(world, i, j - 1, k, 1))
{
for(int l = 0; l < 3; l++)
{
@@ -297,7 +336,7 @@
} else
{
- if(Block.fire.canBlockCatchFire(world, i - 1, j, k))
+ if(Block.fire.canBlockCatchFire(world, i - 1, j, k, 5))
{
for(int i1 = 0; i1 < 2; i1++)
{
@@ -308,7 +347,7 @@
}
}
- if(Block.fire.canBlockCatchFire(world, i + 1, j, k))
+ if(Block.fire.canBlockCatchFire(world, i + 1, j, k, 4))
{
for(int j1 = 0; j1 < 2; j1++)
{
@@ -319,7 +358,7 @@
}
}
- if(Block.fire.canBlockCatchFire(world, i, j, k - 1))
+ if(Block.fire.canBlockCatchFire(world, i, j, k - 1, 3))
{
for(int k1 = 0; k1 < 2; k1++)
{
@@ -330,7 +369,7 @@
}
}
- if(Block.fire.canBlockCatchFire(world, i, j, k + 1))
+ if(Block.fire.canBlockCatchFire(world, i, j, k + 1, 2))
{
for(int l1 = 0; l1 < 2; l1++)
{
@@ -341,7 +380,7 @@
}
}
- if(Block.fire.canBlockCatchFire(world, i, j + 1, k))
+ if(Block.fire.canBlockCatchFire(world, i, j + 1, k, 0))
{
for(int i2 = 0; i2 < 2; i2++)
{
+
+ if (i1 > l)
+ {
+ return i1;
+ }
+ else
+ {
+ return l;
+ }
+ }
+
}

View file

@ -1,84 +1,93 @@
--- ../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 @@
@@ -35,7 +35,7 @@
setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
}
return super.getSelectedBoundingBoxFromPool(world, i, j, k);
}
- }
+ }
+ /* FORGE: Implemented base method, see Block.isLadder */
+ public boolean isLadder(World world, int i, int j, int k) {
+ return true;
+ }
+
public boolean isOpaqueCube()
{
return false;
@@ -80,37 +85,37 @@
@@ -54,37 +54,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))
- 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))
- 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))
- 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);
+ 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))
- 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))
- 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))
- 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))
- 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 @@
@@ -95,19 +95,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))
- 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))
- 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))
- 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))
- if (i1 == 5 && world.isBlockNormalCube(i - 1, j, k))
+ if (i1 == 5 && world.isBlockSolidOnSide(i - 1, j, k, 5))
{
flag = true;
}
@@ -123,4 +123,11 @@
{
return 1;
}
+
+ /* FORGE: Implemented base method, see Block.isLadder */
+ @Override
+ public boolean isLadder(World world, int X, int Y, int Z)
+ {
+ return true;
+ }
}

View file

@ -1,120 +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 @@
@@ -31,44 +31,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))
- 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))
- 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))
- 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))
- 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);
+ 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))
- 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))
- 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))
- 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))
- 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);
+ 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 @@
@@ -77,23 +77,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))
- 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))
- 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))
- 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))
- 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))
- 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 @@
@@ -116,27 +116,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)
- 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)
- 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)
- 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)
- 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)
- 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)
- if (!world.isBlockNormalCube(i, j - 1, k) && i1 == 6)
+ if (!world.isBlockSolidOnSide(i, j - 1, k, 1) && i1 == 6)
{
flag = true;
}

View file

@ -1,56 +1,44 @@
--- ../src_base/minecraft/net/minecraft/src/BlockNetherStalk.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockNetherStalk.java 0000-00-00 00:00:00.000000000 -0000
@@ -4,6 +4,7 @@
@@ -1,5 +1,6 @@
package net.minecraft.src;
+import java.util.ArrayList;
import java.util.Random;
// Referenced classes of package net.minecraft.src:
@@ -65,26 +66,26 @@
public class BlockNetherStalk extends BlockFlower
@@ -57,25 +58,25 @@
return 6;
}
- public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f, int i1)
+ @Override
+ public ArrayList<ItemStack> getBlockDropped(World world, int i, int j, int k, int md, int fortune)
+ public ArrayList<ItemStack> getBlockDropped(World world, int i, int j, int k, int meta, int fortune)
{
- if(world.multiplayerWorld)
- if (world.multiplayerWorld)
- {
- return;
- }
- int j1 = 1;
- if(l >= 3)
- {
- j1 = 2 + world.rand.nextInt(3);
- if(i1 > 0)
- {
- j1 += world.rand.nextInt(i1 + 1);
- }
- }
- for(int k1 = 0; k1 < j1; k1++)
- {
- dropBlockAsItem_do(world, i, j, k, new ItemStack(Item.netherStalkSeeds));
- }
-
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+
+ int count = 1;
+ if (md >= 3)
+ {
+ count = 2 + world.rand.nextInt(3);
+ if (fortune > 0)
+ {
+ count += world.rand.nextInt(fortune + 1);
+ }
+ }
+ for (int n = 0; n < count; n++)
+ {
+ ret.add(new ItemStack(Item.netherStalkSeeds));
+ }
+ return ret;
+
int j1 = 1;
- if (l >= 3)
+ if (meta >= 3)
{
j1 = 2 + world.rand.nextInt(3);
- if (i1 > 0)
+ if (fortune > 0)
{
- j1 += world.rand.nextInt(i1 + 1);
+ j1 += world.rand.nextInt(fortune + 1);
}
}
for (int k1 = 0; k1 < j1; k1++)
{
- dropBlockAsItem_do(world, i, j, k, new ItemStack(Item.netherStalkSeeds));
+ ret.add(new ItemStack(Item.netherStalkSeeds));
}
+
+ return ret;
}
public int idDropped(int i, Random random, int j)

View file

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/src/BlockPistonBase.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockPistonBase.java 0000-00-00 00:00:00.000000000 -0000
@@ -361,7 +361,7 @@
@@ -355,7 +355,7 @@
return false;
}
}

View file

@ -1,22 +1,20 @@
--- ../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
@@ -48,7 +48,8 @@
@@ -38,7 +38,7 @@
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;
+ 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)
@@ -58,7 +59,8 @@
@@ -48,7 +48,7 @@
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)
- 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

@ -1,8 +1,8 @@
--- ../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
@@ -14,16 +14,29 @@
@@ -5,16 +5,29 @@
public class BlockRail extends Block
{
private final boolean isPowered;
+
+ /**
@ -32,7 +32,7 @@
}
protected BlockRail(int i, int j, boolean flag)
@@ -89,7 +102,7 @@
@@ -81,7 +94,7 @@
public int getRenderType()
{
@ -41,51 +41,52 @@
}
public int quantityDropped(Random random)
@@ -99,7 +112,7 @@
@@ -91,7 +104,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);
+ return world.isBlockSolidOnSide(i, j - 1, k, 1);
}
public void onBlockAdded(World world, int i, int j, int k)
@@ -123,23 +136,23 @@
@@ -119,23 +132,23 @@
j1 &= 7;
}
boolean flag = false;
- if(!world.isBlockNormalCube(i, j - 1, k))
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1))
- 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))
- 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))
- 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))
- 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))
- if (j1 == 5 && !world.isBlockNormalCube(i, j, k + 1))
+ if (j1 == 5 && !world.isBlockSolidOnSide(i, j, k + 1, 1))
{
flag = true;
}
@@ -313,8 +326,118 @@
@@ -317,8 +330,119 @@
return 0;
}
+ /**
+ * This function is no longer called by Minecraft
+ */
+ @Deprecated
static boolean isPoweredBlockRail(BlockRail blockrail)
{
return blockrail.isPowered;

View file

@ -1,20 +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
@@ -35,7 +35,7 @@
@@ -28,7 +28,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))
- if (!world.isBlockNormalCube(i, j - 1, k))
+ if (!world.isBlockSolidOnSide(i, j - 1, k, 1))
{
return false;
} else
@@ -46,7 +46,7 @@
}
@@ -40,7 +40,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))
- if (!world.isBlockNormalCube(i, j - 1, k))
+ if (!world.isBlockSolidOnSide(i, j - 1, k, 1))
{
return false;
} else
}

View file

@ -1,15 +1,15 @@
--- ../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
@@ -6,6 +6,8 @@
@@ -2,6 +2,8 @@
import java.util.*;
+import net.minecraft.src.forge.*;
+import net.minecraft.src.forge.IConnectRedstone;
+
// Referenced classes of package net.minecraft.src:
// Block, Material, World, ChunkPosition,
// Item, IBlockAccess, Direction, AxisAlignedBB
@@ -56,7 +58,7 @@
public class BlockRedstoneWire extends Block
{
private boolean wiresProvidePower;
@@ -47,7 +49,7 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
@ -18,14 +18,16 @@
}
private void updateAndPropagateCurrentStrength(World world, int i, int j, int k)
@@ -454,6 +456,10 @@
{
return false;
@@ -467,6 +469,12 @@
int j1 = iblockaccess.getBlockMetadata(i, j, k);
return l == (j1 & 3) || l == Direction.footInvisibleFaceRemap[j1 & 3];
}
+ if (Block.blocksList[i1] instanceof IConnectRedstone) {
+ IConnectRedstone icr = (IConnectRedstone)Block.blocksList[i1];
+ return icr.canConnectRedstone(iblockaccess, i, j, k, l);
+
+ if (Block.blocksList[i1] instanceof IConnectRedstone)
+ {
+ return ((IConnectRedstone)Block.blocksList[i1]).canConnectRedstone(iblockaccess, i, j, k, l);
+ }
if(Block.blocksList[i1].canProvidePower() && l != -1)
{
return true;
+
return Block.blocksList[i1].canProvidePower() && l != -1;
}

View file

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/src/BlockSnow.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockSnow.java 0000-00-00 00:00:00.000000000 -0000
@@ -82,15 +82,8 @@
@@ -75,15 +75,7 @@
public void harvestBlock(World world, EntityPlayer entityplayer, int i, int j, int k, int l)
{
@ -13,12 +13,11 @@
- entityitem.delayBeforeCanPickup = 10;
- world.spawnEntityInWorld(entityitem);
- world.setBlockWithNotify(i, j, k, 0);
+
+ dropBlockAsItem(world,i,j,k,l,0);
+ dropBlockAsItem(world, i, j, k, l, 0);
entityplayer.addStat(StatList.mineBlockStatArray[blockID], 1);
}
@@ -101,7 +94,7 @@
@@ -94,7 +86,7 @@
public int quantityDropped(Random random)
{

View file

@ -1,45 +1,53 @@
--- ../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 @@
@@ -1,7 +1,10 @@
package net.minecraft.src;
+import java.util.ArrayList;
import java.util.Random;
+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,
@@ -73,13 +76,24 @@
public class BlockTallGrass extends BlockFlower
{
protected BlockTallGrass(int i, int j)
@@ -65,14 +68,7 @@
public int idDropped(int i, Random random, int j)
{
- if(random.nextInt(8) == 0)
- if (random.nextInt(8) == 0)
- {
- return Item.seeds.shiftedIndex;
- } else
- }
- else
- {
- return -1;
- }
+ return -1;
+ }
+
+ @Override
+ public ArrayList<ItemStack> getBlockDropped(World world, int i, int j, int k, int md, int fortune)
+ {
+ 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;
+ return -1;
}
public int quantityDroppedWithBonus(int i, Random random)
@@ -80,6 +76,23 @@
return 1 + random.nextInt(i * 2 + 1);
}
+ @Override
+ public ArrayList<ItemStack> getBlockDropped(World world, int i, int j, int k, int md, int fortune)
+ {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ if (world.rand.nextInt(8) != 0)
+ {
+ return ret;
+ }
+
+ ItemStack item = ForgeHooks.getGrassSeed(world);
+ if (item != null)
+ {
+ ret.add(item);
+ }
+ return ret;
+ }
+
public void harvestBlock(World world, EntityPlayer entityplayer, int i, int j, int k, int l)
{
if (!world.multiplayerWorld && entityplayer.getCurrentEquippedItem() != null && entityplayer.getCurrentEquippedItem().itemID == Item.shears.shiftedIndex)

View file

@ -1,107 +1,107 @@
--- ../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,7 +41,7 @@
@@ -32,7 +32,7 @@
private boolean canPlaceTorchOn(World world, int i, int j, int k)
{
- if(world.func_41082_b(i, j, k, true))
+ if(world.isBlockSolidOnSide(i, j, k, 1))
- if (world.func_41082_b(i, j, k, true))
+ if (world.isBlockSolidOnSide(i, j, k, 1))
{
return true;
} else
@@ -53,19 +53,19 @@
}
@@ -45,19 +45,19 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- if(world.func_41082_b(i - 1, j, k, true))
+ if(world.isBlockSolidOnSide(i - 1, j, k,5))
- if (world.func_41082_b(i - 1, j, k, true))
+ if (world.isBlockSolidOnSide(i - 1, j, k, 5))
{
return true;
}
- if(world.func_41082_b(i + 1, j, k, true))
+ if(world.isBlockSolidOnSide(i + 1, j, k,4))
- if (world.func_41082_b(i + 1, j, k, true))
+ if (world.isBlockSolidOnSide(i + 1, j, k, 4))
{
return true;
}
- if(world.func_41082_b(i, j, k - 1, true))
+ if(world.isBlockSolidOnSide(i, j, k-1,3))
- if (world.func_41082_b(i, j, k - 1, true))
+ if (world.isBlockSolidOnSide(i, j, k - 1, 3))
{
return true;
}
- if(world.func_41082_b(i, j, k + 1, true))
+ if(world.isBlockSolidOnSide(i, j, k+1,2))
- if (world.func_41082_b(i, j, k + 1, true))
+ if (world.isBlockSolidOnSide(i, j, k + 1, 2))
{
return true;
}
@@ -79,19 +79,19 @@
@@ -71,19 +71,19 @@
{
i1 = 5;
}
- if(l == 2 && world.func_41082_b(i, j, k + 1, true))
+ if(l == 2 && world.isBlockSolidOnSide(i, j, k+1,2))
- if (l == 2 && world.func_41082_b(i, j, k + 1, true))
+ if (l == 2 && world.isBlockSolidOnSide(i, j, k + 1, 2))
{
i1 = 4;
}
- if(l == 3 && world.func_41082_b(i, j, k - 1, true))
+ if(l == 3 && world.isBlockSolidOnSide(i, j, k-1,3))
- if (l == 3 && world.func_41082_b(i, j, k - 1, true))
+ if (l == 3 && world.isBlockSolidOnSide(i, j, k - 1, 3))
{
i1 = 3;
}
- if(l == 4 && world.func_41082_b(i + 1, j, k, true))
+ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4))
- if (l == 4 && world.func_41082_b(i + 1, j, k, true))
+ if (l == 4 && world.isBlockSolidOnSide(i + 1, j, k, 4))
{
i1 = 2;
}
- if(l == 5 && world.func_41082_b(i - 1, j, k, true))
+ if(l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5))
- if (l == 5 && world.func_41082_b(i - 1, j, k, true))
+ if (l == 5 && world.isBlockSolidOnSide(i - 1, j, k, 5))
{
i1 = 1;
}
@@ -109,19 +109,19 @@
@@ -101,19 +101,19 @@
public void onBlockAdded(World world, int i, int j, int k)
{
- if(world.func_41082_b(i - 1, j, k, true))
+ if(world.isBlockSolidOnSide(i - 1, j, k,5))
- if (world.func_41082_b(i - 1, j, k, true))
+ if (world.isBlockSolidOnSide(i - 1, j, k, 5))
{
world.setBlockMetadataWithNotify(i, j, k, 1);
} else
- if(world.func_41082_b(i + 1, j, k, true))
+ if(world.isBlockSolidOnSide(i + 1, j, k,4))
}
- else if (world.func_41082_b(i + 1, j, k, true))
+ else if (world.isBlockSolidOnSide(i + 1, j, k, 4))
{
world.setBlockMetadataWithNotify(i, j, k, 2);
} else
- if(world.func_41082_b(i, j, k - 1, true))
+ if(world.isBlockSolidOnSide(i, j, k-1,3))
}
- else if (world.func_41082_b(i, j, k - 1, true))
+ else if (world.isBlockSolidOnSide(i, j, k - 1, 3))
{
world.setBlockMetadataWithNotify(i, j, k, 3);
} else
- if(world.func_41082_b(i, j, k + 1, true))
+ if(world.isBlockSolidOnSide(i, j, k+1,2))
}
- else if (world.func_41082_b(i, j, k + 1, true))
+ else if (world.isBlockSolidOnSide(i, j, k + 1, 2))
{
world.setBlockMetadataWithNotify(i, j, k, 4);
} else
@@ -138,19 +138,19 @@
}
@@ -130,19 +130,19 @@
{
int i1 = world.getBlockMetadata(i, j, k);
boolean flag = false;
- if(!world.func_41082_b(i - 1, j, k, true) && i1 == 1)
+ if(!world.isBlockSolidOnSide(i - 1, j, k,5) && i1 == 1)
- if (!world.func_41082_b(i - 1, j, k, true) && i1 == 1)
+ if (!world.isBlockSolidOnSide(i - 1, j, k, 5) && i1 == 1)
{
flag = true;
}
- if(!world.func_41082_b(i + 1, j, k, true) && i1 == 2)
+ if(!world.isBlockSolidOnSide(i + 1, j, k,4) && i1 == 2)
- if (!world.func_41082_b(i + 1, j, k, true) && i1 == 2)
+ if (!world.isBlockSolidOnSide(i + 1, j, k, 4) && i1 == 2)
{
flag = true;
}
- if(!world.func_41082_b(i, j, k - 1, true) && i1 == 3)
+ if(!world.isBlockSolidOnSide(i, j, k-1,3) && i1 == 3)
- if (!world.func_41082_b(i, j, k - 1, true) && i1 == 3)
+ if (!world.isBlockSolidOnSide(i, j, k - 1, 3) && i1 == 3)
{
flag = true;
}
- if(!world.func_41082_b(i, j, k + 1, true) && i1 == 4)
+ if(!world.isBlockSolidOnSide(i, j, k+1,2) && i1 == 4)
- if (!world.func_41082_b(i, j, k + 1, true) && i1 == 4)
+ if (!world.isBlockSolidOnSide(i, j, k + 1, 2) && i1 == 4)
{
flag = true;
}

View file

@ -1,35 +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
@@ -11,7 +11,10 @@
@@ -2,6 +2,9 @@
public class BlockTrapDoor extends Block
{
-
+ /* FORGE: Set this to allow trapdoors to remain free-floating
+ */
+ public static boolean disableValidation=false;
+ /* FORGE: Set this to allow trapdoors to remain free-floating */
+ public static boolean disableValidation = false;
+
protected BlockTrapDoor(int i, Material material)
{
super(i, material);
@@ -147,7 +150,7 @@
@@ -139,7 +142,7 @@
{
j1--;
}
- if(!func_41052_f(world.getBlockId(j1, j, k1)))
+ if(!(func_41052_f(world.getBlockId(j1, j, k1)) || world.isBlockSolidOnSide(j1, j, k1, (i1&3)+2)))
- if (!func_41052_f(world.getBlockId(j1, j, k1)))
+ if (!(func_41052_f(world.getBlockId(j1, j, k1)) || world.isBlockSolidOnSide(j1, j, k1, (i1 & 3) + 2)))
{
world.setBlockWithNotify(i, j, k, 0);
dropBlockAsItem(world, i, j, k, i1, 0);
@@ -192,6 +195,7 @@
@@ -181,6 +184,10 @@
public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l)
{
+ if(disableValidation) return true;
if(l == 0)
+ if (disableValidation)
+ {
+ return true;
+ }
if (l == 0)
{
return false;
@@ -216,7 +220,7 @@
@@ -205,7 +212,7 @@
{
i--;
}
@ -38,14 +39,15 @@
}
public static boolean isTrapdoorOpen(int i)
@@ -226,6 +230,10 @@
@@ -215,6 +222,11 @@
private static boolean func_41052_f(int i)
{
+ if (disableValidation)
+ if (disableValidation)
+ {
+ return true;
+ }
if(i <= 0)
+
if (i <= 0)
{
return false;

View file

@ -1,62 +1,47 @@
--- ../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 fieldsfirst
package net.minecraft.src;
+import net.minecraft.src.forge.*;
import java.io.PrintStream;
import java.util.*;
@@ -351,11 +352,12 @@
blocks[i << worldObj.xShift | k << worldObj.heightShift | j] = (byte)(byte0 & 0xff);
if(l1 != 0)
{
+ int meta = getBlockMetadata(i, j, k);
if(!worldObj.multiplayerWorld)
@@ -338,7 +338,7 @@
{
Block.blocksList[l1].onBlockRemoval(worldObj, i2, j, j2);
} else
- if(Block.blocksList[l1] instanceof BlockContainer)
+ if(Block.blocksList[l1] != null && Block.blocksList[l1].hasTileEntity(meta))
}
- else if ((Block.blocksList[l1] instanceof BlockContainer) && l1 != l)
+ else if (Block.blocksList[l1] != null && Block.blocksList[l1].hasTileEntity(getBlockMetadata(i, j, k)) && l1 != l)
{
worldObj.removeBlockTileEntity(i2, j, j2);
}
@@ -385,12 +387,12 @@
@@ -368,12 +368,12 @@
{
Block.blocksList[l].onBlockAdded(worldObj, i2, j, j2);
}
- if(Block.blocksList[l] instanceof BlockContainer)
+ if(Block.blocksList[l] != null && Block.blocksList[l].hasTileEntity(i1))
- if (Block.blocksList[l] instanceof BlockContainer)
+ if (Block.blocksList[l] != null && Block.blocksList[l].hasTileEntity(i1))
{
TileEntity tileentity = getChunkBlockTileEntity(i, j, k);
if(tileentity == null)
if (tileentity == null)
{
- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity();
+ tileentity = Block.blocksList[l].getTileEntity(i1);
worldObj.setBlockTileEntity(i, j, k, tileentity);
worldObj.setBlockTileEntity(i2, j, j2, tileentity);
}
if(tileentity != null)
@@ -398,15 +400,7 @@
tileentity.updateContainingBlockInfo();
if (tileentity != null)
@@ -382,14 +382,6 @@
}
}
- } else
- if(l1 > 0 && (Block.blocksList[l1] instanceof BlockContainer))
}
- else if (l1 > 0 && (Block.blocksList[l1] instanceof BlockContainer))
- {
- TileEntity tileentity1 = getChunkBlockTileEntity(i, j, k);
- if(tileentity1 != null)
- if (tileentity1 != null)
- {
- tileentity1.updateContainingBlockInfo();
- }
- }
+ }
isModified = true;
return true;
}
@@ -430,7 +424,11 @@
@@ -413,7 +405,11 @@
blocks[i << worldObj.xShift | k << worldObj.heightShift | j] = (byte)(byte0 & 0xff);
if(k1 != 0)
if (k1 != 0)
{
- Block.blocksList[k1].onBlockRemoval(worldObj, l1, j, i2);
+ if (!worldObj.multiplayerWorld)
@ -66,154 +51,150 @@
+ removeChunkBlockTileEntity(i, j, k);
}
data.setNibble(i, j, k, 0);
if(Block.lightOpacity[byte0 & 0xff] != 0)
@@ -453,27 +451,21 @@
if (Block.lightOpacity[byte0 & 0xff] != 0)
@@ -436,28 +432,22 @@
{
Block.blocksList[l].onBlockAdded(worldObj, l1, j, i2);
}
- if(l > 0 && (Block.blocksList[l] instanceof BlockContainer))
- if (l > 0 && (Block.blocksList[l] instanceof BlockContainer))
+ int meta = getBlockMetadata(i, j, k);
+ if(l > 0 && Block.blocksList[l] != null && Block.blocksList[l].hasTileEntity(meta))
+ if (l > 0 && Block.blocksList[l] != null && Block.blocksList[l].hasTileEntity(meta))
{
TileEntity tileentity = getChunkBlockTileEntity(i, j, k);
if(tileentity == null)
if (tileentity == null)
{
- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity();
+ tileentity = Block.blocksList[l].getTileEntity(meta);
worldObj.setBlockTileEntity(i, j, k, tileentity);
worldObj.setBlockTileEntity(l1, j, i2, tileentity);
}
if(tileentity != null)
if (tileentity != null)
{
tileentity.updateContainingBlockInfo();
+ tileentity.blockMetadata = meta;
}
}
- } else
- if(k1 > 0 && (Block.blocksList[k1] instanceof BlockContainer))
}
- else if (k1 > 0 && (Block.blocksList[k1] instanceof BlockContainer))
- {
- TileEntity tileentity1 = getChunkBlockTileEntity(i, j, k);
- if(tileentity1 != null)
- if (tileentity1 != null)
- {
- tileentity1.updateContainingBlockInfo();
- }
}
- }
isModified = true;
return true;
@@ -494,7 +486,8 @@
}
@@ -477,7 +467,7 @@
}
data.setNibble(i, j, k, l);
int j1 = getBlockID(i, j, k);
- if(j1 > 0 && (Block.blocksList[j1] instanceof BlockContainer))
+
+ if(j1 > 0 && Block.blocksList[j1] != null && Block.blocksList[j1].hasTileEntity(i1))
- if (j1 > 0 && (Block.blocksList[j1] instanceof BlockContainer))
+ if (j1 > 0 && Block.blocksList[j1] != null && Block.blocksList[j1].hasTileEntity(i1))
{
TileEntity tileentity = getChunkBlockTileEntity(i, j, k);
if(tileentity != null)
@@ -609,27 +602,38 @@
if (tileentity != null)
@@ -594,29 +584,27 @@
{
ChunkPosition chunkposition = new ChunkPosition(i, j, k);
TileEntity tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition);
+ if(tileentity != null && tileentity.isInvalid())
+ if (tileentity != null && tileentity.isInvalid())
+ {
+ chunkTileEntityMap.remove(chunkposition);
+ tileentity=null;
+ chunkTileEntityMap.remove(chunkposition);
+ tileentity = null;
+ }
if(tileentity == null)
if (tileentity == null)
{
int l = getBlockID(i, j, k);
- if(!Block.isBlockContainer[l])
+ int meta = getBlockMetadata(i, j, k);
+ if(Block.blocksList[l] == null || !Block.blocksList[l].hasTileEntity(meta))
- if (!Block.isBlockContainer[l])
+ int meta = getBlockMetadata(i, j, k);
+ if (Block.blocksList[l] == null || !Block.blocksList[l].hasTileEntity(meta))
{
return null;
}
if(tileentity == null)
if (tileentity == null)
{
- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity();
+ tileentity = Block.blocksList[l].getTileEntity(meta);
+ tileentity = Block.blocksList[l].getTileEntity(meta);
worldObj.setBlockTileEntity(xPosition * 16 + i, j, zPosition * 16 + k, tileentity);
}
tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition);
}
- if(tileentity != null && tileentity.isInvalid())
- 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)
{
- }
- else
- {
- return tileentity;
+ TileEntity tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition);
+ if(tileentity != null && tileentity.isInvalid())
+ chunkTileEntityMap.remove(chunkposition);
}
- }
+ return tileentity;
}
@@ -641,7 +645,7 @@
public void addTileEntity(TileEntity tileentity)
@@ -627,7 +615,7 @@
setChunkBlockTileEntity(i, j, k, tileentity);
if(isChunkLoaded)
if (isChunkLoaded)
{
- worldObj.loadedTileEntityList.add(tileentity);
+ worldObj.addTileEntity(tileentity);
}
}
@@ -652,11 +656,15 @@
@@ -638,12 +626,18 @@
tileentity.xCoord = xPosition * 16 + i;
tileentity.yCoord = j;
tileentity.zCoord = zPosition * 16 + k;
- if(getBlockID(i, j, k) == 0 || !(Block.blocksList[getBlockID(i, j, k)] instanceof BlockContainer))
- if (getBlockID(i, j, k) == 0 || !(Block.blocksList[getBlockID(i, j, k)] instanceof BlockContainer))
+ int id = getBlockID(i, j, k);
+ int meta = getBlockMetadata(i, j, k);
+ if(id == 0 || Block.blocksList[id] == null || !Block.blocksList[id].hasTileEntity(meta))
+ if (id == 0 || Block.blocksList[id] == null || !Block.blocksList[id].hasTileEntity(getBlockMetadata(i, j, k)))
{
return;
} else
}
else
{
+ TileEntity old = (TileEntity)chunkTileEntityMap.get(chunkposition);
+ if (old != null) old.invalidate();
+ if (old != null)
+ {
+ old.invalidate();
+ }
tileentity.validate();
chunkTileEntityMap.put(chunkposition, tileentity);
return;
@@ -810,6 +818,15 @@
public int setChunkData(byte abyte0[], int i, int j, int k, int l, int i1, int j1,
@@ -790,6 +784,16 @@
public int setChunkData(byte abyte0[], int i, int j, int k, int l, int i1, int j1,
int k1)
{
+ TileEntity te;
+ Iterator iterator = chunkTileEntityMap.values().iterator();
+ while (iterator.hasNext()){
+ while (iterator.hasNext())
+ {
+ te = (TileEntity)iterator.next();
+ te.updateContainingBlockInfo();
+ te.getBlockMetadata();
+ te.getBlockType();
+ }
+
for(int l1 = i; l1 < l; l1++)
for (int l1 = i; l1 < l; l1++)
{
for(int l2 = k; l2 < j1; l2++)
@@ -859,12 +876,29 @@
for (int l2 = k; l2 < j1; l2++)
@@ -835,10 +839,29 @@
}
}
- TileEntity tileentity;
- for(Iterator iterator = chunkTileEntityMap.values().iterator(); iterator.hasNext(); tileentity.updateContainingBlockInfo())
- {
- tileentity = (TileEntity)iterator.next();
- for (Iterator iterator = chunkTileEntityMap.values().iterator(); iterator.hasNext(); tileentity.updateContainingBlockInfo())
+ List<TileEntity> invalidList=new ArrayList();
+ iterator = chunkTileEntityMap.values().iterator();
+ while(iterator.hasNext())
+ {
{
- tileentity = (TileEntity)iterator.next();
+ te = (TileEntity)iterator.next();
+ if ((te.xCoord & 15) >= i && (te.xCoord & 15) <= l &&
+ (te.yCoord >= j) && (te.yCoord <= i1) &&
+ (te.zCoord & 15) >= k && (te.zCoord & 15) <=j1) {
+ (te.zCoord & 15) >= k && (te.zCoord & 15) <=j1)
+ {
+
+ Block bl = te.getBlockType();
+ if (bl != null &&
@ -223,12 +204,30 @@
+
+ invalidList.add(te);
+ }
}
+ }
+
+ for(TileEntity te2 : invalidList)
+ {
+ te2.invalidate();
+ }
return k1;
}
}
return k1;
@@ -917,4 +940,18 @@
{
return new ChunkCoordIntPair(xPosition, zPosition);
}
+
+ /* 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)
+ {
+ TileEntity tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition);
+ if (tileentity != null && tileentity.isInvalid())
+ {
+ chunkTileEntityMap.remove(chunkposition);
+ }
+ }
+ }
}

View file

@ -1,9 +1,10 @@
--- ../src_base/minecraft/net/minecraft/src/ContainerCreative.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/ContainerCreative.java 0000-00-00 00:00:00.000000000 -0000
@@ -74,20 +74,23 @@
@@ -64,20 +64,23 @@
}
itemList.add(new ItemStack(ablock[l1], 1, k2));
}
-
+
+ for(int x = 0; x < 256; x++)
+ {
@ -12,22 +13,22 @@
+ Block.blocksList[x].addCreativeItems((ArrayList)itemList);
+ }
+ }
for(int i2 = 256; i2 < Item.itemsList.length; i2++)
+
for (int i2 = 256; i2 < Item.itemsList.length; i2++)
{
- if(Item.itemsList[i2] != null && Item.itemsList[i2].shiftedIndex != Item.potion.shiftedIndex)
+ if(Item.itemsList[i2] != null)
- if (Item.itemsList[i2] != null && Item.itemsList[i2].shiftedIndex != Item.potion.shiftedIndex && Item.itemsList[i2].shiftedIndex != Item.field_44019_bC.shiftedIndex)
+ if (Item.itemsList[i2] != null)
{
- itemList.add(new ItemStack(Item.itemsList[i2]));
+ Item.itemsList[i2].addCreativeItems((ArrayList)itemList);
+ Item.itemsList[i2].addCreativeItems((ArrayList)itemList);
}
}
- for(int j2 = 1; j2 < 16; j2++)
- for (int j2 = 1; j2 < 16; j2++)
- {
- itemList.add(new ItemStack(Item.dyePowder.shiftedIndex, 1, j2));
- }
-
InventoryPlayer inventoryplayer = entityplayer.inventory;
for(int l2 = 0; l2 < 9; l2++)
Integer integer;
for (Iterator iterator = EntityList.field_44041_a.keySet().iterator(); iterator.hasNext(); itemList.add(new ItemStack(Item.field_44019_bC.shiftedIndex, 1, integer.intValue())))
{

View file

@ -1,11 +1,11 @@
--- ../src_base/minecraft/net/minecraft/src/CraftingManager.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/CraftingManager.java 0000-00-00 00:00:00.000000000 -0000
@@ -363,7 +363,7 @@
@@ -423,7 +423,7 @@
i++;
}
- if(i == 2 && itemstack.itemID == itemstack1.itemID && itemstack.stackSize == 1 && itemstack1.stackSize == 1 && Item.itemsList[itemstack.itemID].isDamageable())
+ if(i == 2 && itemstack.itemID == itemstack1.itemID && itemstack.stackSize == 1 && itemstack1.stackSize == 1 && Item.itemsList[itemstack.itemID].isRepairable())
- if (i == 2 && itemstack.itemID == itemstack1.itemID && itemstack.stackSize == 1 && itemstack1.stackSize == 1 && Item.itemsList[itemstack.itemID].isDamageable())
+ if (i == 2 && itemstack.itemID == itemstack1.itemID && itemstack.stackSize == 1 && itemstack1.stackSize == 1 && Item.itemsList[itemstack.itemID].isRepairable())
{
Item item = Item.itemsList[itemstack.itemID];
int l = item.getMaxDamage() - itemstack.getItemDamageForDisplay();

View file

@ -1,17 +1,17 @@
--- ../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;
@@ -1,17 +1,23 @@
package net.minecraft.src;
import java.util.*;
+
+import net.minecraft.src.forge.BlockTextureParticles;
+import net.minecraft.src.forge.ITextureProvider;
+
// Referenced classes of package net.minecraft.src:
// EntityFX, ActiveRenderInfo, Entity, RenderEngine,
// Tessellator, MathHelper, Block, EntityDiggingFX,
@@ -17,11 +20,13 @@
import org.lwjgl.opengl.GL11;
public class EffectRenderer
{
protected World worldObj;
private List fxLayers[];
+ private List effectList;
@ -23,86 +23,90 @@
+ effectList = new ArrayList();
fxLayers = new List[4];
rand = new Random();
if(world != null)
@@ -61,7 +66,18 @@
if (world != null)
@@ -49,6 +55,23 @@
}
}
}
-
+ for (int x = 0; x < effectList.size(); x++) {
+ BlockTextureParticles entry = (BlockTextureParticles) effectList
+ .get(x);
+ for (int y = 0; y < entry.effects.size(); y++) {
+
+ 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) {
+ if (entityfx.isDead)
+ {
+ entry.effects.remove(y--);
+ }
+ }
+ if (effectList.size() == 0)
+ {
+ effectList.remove(x--);
+ }
+ }
}
public void renderParticles(Entity entity, float f)
@@ -100,6 +116,7 @@
for(int k = 0; k < fxLayers[i].size(); k++)
@@ -87,12 +110,31 @@
for (int k = 0; k < fxLayers[i].size(); k++)
{
EntityFX entityfx = (EntityFX)fxLayers[i].get(k);
+ if (entityfx instanceof EntityDiggingFX) continue;
+ if (entityfx instanceof EntityDiggingFX)
+ {
+ continue;
+ }
tessellator.setBrightness(entityfx.getEntityBrightnessForRender(f));
entityfx.renderParticle(tessellator, f, f1, f5, f2, f3, f4);
}
@@ -107,6 +124,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));
+ 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++) {
+ for (int y = 0; y < entry.effects.size(); y++)
+ {
+ EntityFX entityfx = (EntityFX) entry.effects.get(y);
+ tessellator.setBrightness(entityfx.getEntityBrightnessForRender(f));
+ entityfx.renderParticle(tessellator, f, f1, f5, f2, f3, f4);
+ }
+ tessellator.draw();
+ }
+
}
public void func_1187_b(Entity entity, float f)
@@ -138,7 +170,12 @@
@@ -123,6 +165,12 @@
{
fxLayers[i].clear();
}
-
+ for (int x = 0; x < effectList.size(); x++) {
+ BlockTextureParticles entry = (BlockTextureParticles) effectList
+ .get(x);
+ 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)
@@ -159,7 +196,12 @@
@@ -143,7 +191,11 @@
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);
+ 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);
}
}
@@ -204,11 +246,39 @@
}
@@ -185,11 +237,43 @@
{
d = (double)i + block.maxX + (double)f;
}
@ -119,22 +123,26 @@
return (new StringBuilder()).append("").append(fxLayers[0].size() + fxLayers[1].size() + fxLayers[2].size()).toString();
}
+
+ public void addDigParticleEffect(EntityDiggingFX dig_effect, Block block) {
+ public void addDigParticleEffect(EntityDiggingFX dig_effect, Block block)
+ {
+ boolean added = false;
+ String comp = "/terrain.png";
+
+ if (block instanceof ITextureProvider) {
+ comp = ((ITextureProvider) block).getTextureFile();
+ if (block instanceof ITextureProvider)
+ {
+ comp = ((ITextureProvider)block).getTextureFile();
+ }
+ for (int x = 0; x < effectList.size(); x++) {
+ BlockTextureParticles entry = (BlockTextureParticles) effectList
+ .get(x);
+ if (entry.texture.equals(comp)) {
+ 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) {
+ if (!added)
+ {
+ BlockTextureParticles entry = new BlockTextureParticles();
+ entry.texture = comp;
+ entry.effects.add(dig_effect);

View file

@ -1,16 +1,19 @@
--- ../src_base/minecraft/net/minecraft/src/Enchantment.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/Enchantment.java 0000-00-00 00:00:00.000000000 -0000
@@ -109,6 +109,13 @@
@@ -102,6 +102,16 @@
return (new StringBuilder()).append(s).append(" ").append(StatCollector.translateToLocal((new StringBuilder()).append("enchantment.level.").append(i).toString())).toString();
}
+ /* FORGE: Can enchantment be applied to item. Redirected to allow users to
+ * override it in their Enchantment class.
+ /**
+ * Called to determine if this enchantment can be applied to a ItemStack
+ * @param item The ItemStack that the enchantment might be put on
+ * @return True if the item is valid, false otherwise
+ */
+ public boolean canEnchantItem(ItemStack ist) {
+ return type.canEnchantItem(ist.getItem());
+ public boolean canEnchantItem(ItemStack item)
+ {
+ return type.canEnchantItem(item.getItem());
+ }
+
static
static
{
looting = new EnchantmentLootBonus(21, 2, EnumEnchantmentType.weapon);

View file

@ -1,11 +1,11 @@
--- ../src_base/minecraft/net/minecraft/src/EnchantmentHelper.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/EnchantmentHelper.java 0000-00-00 00:00:00.000000000 -0000
@@ -271,7 +271,7 @@
for(int k = 0; k < j; k++)
@@ -261,7 +261,7 @@
for (int k = 0; k < j; k++)
{
Enchantment enchantment = aenchantment[k];
- if(enchantment == null || !enchantment.type.canEnchantItem(item))
+ if(enchantment == null || !enchantment.canEnchantItem(itemstack))
- if (enchantment == null || !enchantment.type.canEnchantItem(item))
+ if (enchantment == null || !enchantment.canEnchantItem(itemstack))
{
continue;
}

View file

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/src/Entity.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/Entity.java 0000-00-00 00:00:00.000000000 -0000
@@ -83,6 +83,9 @@
@@ -70,6 +70,9 @@
public int serverPosZ;
public boolean ignoreFrustumCheck;
public boolean isAirBorne;
@ -10,7 +10,7 @@
public Entity(World world)
{
@@ -123,6 +126,20 @@
@@ -110,6 +113,20 @@
}
protected abstract void entityInit();
@ -31,23 +31,24 @@
public DataWatcher getDataWatcher()
{
@@ -955,6 +972,10 @@
@@ -967,6 +984,10 @@
nbttagcompound.setShort("Fire", (short)fire);
nbttagcompound.setShort("Air", (short)getAir());
nbttagcompound.setBoolean("OnGround", onGround);
+ if(customEntityData!=null) {
+ nbttagcompound.setCompoundTag("ForgeData",
+ customEntityData);
+ }
+ if (customEntityData != null)
+ {
+ nbttagcompound.setCompoundTag("ForgeData", customEntityData);
+ }
writeEntityToNBT(nbttagcompound);
}
@@ -989,6 +1010,9 @@
@@ -1001,6 +1022,10 @@
onGround = nbttagcompound.getBoolean("OnGround");
setPosition(posX, posY, posZ);
setRotation(rotationYaw, rotationPitch);
+ if(nbttagcompound.hasKey("ForgeData")) {
+ customEntityData=nbttagcompound.getCompoundTag("ForgeData");
+ if (nbttagcompound.hasKey("ForgeData"))
+ {
+ customEntityData = nbttagcompound.getCompoundTag("ForgeData");
+ }
readEntityFromNBT(nbttagcompound);
}

View file

@ -1,13 +1,17 @@
--- ../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
@@ -794,7 +794,9 @@
@@ -835,7 +835,13 @@
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(worldObj,i,j,k);
+
+ Block block = Block.blocksList[worldObj.getBlockId(i, j, k)];
+ if (block == null)
+ {
+ return false;
+ }
+ return block.isLadder(worldObj, i, j, k);
}
public void writeEntityToNBT(NBTTagCompound nbttagcompound)

View file

@ -1,7 +1,6 @@
--- ../src_base/minecraft/net/minecraft/src/EntityMinecart.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/EntityMinecart.java 0000-00-00 00:00:00.000000000 -0000
@@ -4,9 +4,14 @@
@@ -1,18 +1,23 @@
package net.minecraft.src;
+import java.util.ArrayList;
@ -12,13 +11,9 @@
+import net.minecraft.src.forge.IMinecartCollisionHandler;
+import net.minecraft.src.forge.MinecraftForge;
+
// Referenced classes of package net.minecraft.src:
// Entity, IInventory, ItemStack, DataWatcher,
// World, Item, EntityItem, Block,
@@ -18,13 +23,13 @@
public class EntityMinecart extends Entity
implements IInventory
{
- private ItemStack cargoItems[];
- private int fuel;
- private boolean field_856_i;
@ -28,12 +23,12 @@
public int minecartType;
public double pushX;
public double pushZ;
- private static final int field_855_j[][][] = {
+ protected static final int field_855_j[][][] = {
- private static final int field_855_j[][][] =
+ protected static final int field_855_j[][][] =
{
{
{
0, 0, -1
@@ -87,16 +92,36 @@
@@ -76,16 +81,36 @@
}
}
};
@ -80,7 +75,7 @@
public EntityMinecart(World world)
{
super(world);
@@ -106,6 +131,18 @@
@@ -95,6 +120,18 @@
preventEntitySpawning = true;
setSize(0.98F, 0.7F);
yOffset = height / 2.0F;
@ -99,7 +94,7 @@
}
protected boolean canTriggerWalking()
@@ -123,17 +160,27 @@
@@ -112,17 +149,27 @@
public AxisAlignedBB getCollisionBox(Entity entity)
{
@ -127,48 +122,35 @@
+ return canBePushed;
}
public EntityMinecart(World world, double d, double d1, double d2,
@@ -172,8 +219,10 @@
riddenByEntity.mountEntity(this);
}
setEntityDead();
- dropItemWithOffset(Item.minecartEmpty.shiftedIndex, 1, 0.0F);
- if(minecartType == 1)
+
+ dropCartAsItem();
+
+ if(getSizeInventory() > 0)
{
EntityMinecart entityminecart = this;
label0:
@@ -207,12 +256,6 @@
worldObj.spawnEntityInWorld(entityitem);
} while(true);
public EntityMinecart(World world, double d, double d1, double d2,
@@ -197,12 +244,6 @@
}
while (true);
}
-
- dropItemWithOffset(Block.chest.blockID, 1, 0.0F);
- } else
- if(minecartType == 2)
- }
- else if (minecartType == 2)
- {
- dropItemWithOffset(Block.stoneOvenIdle.blockID, 1, 0.0F);
}
}
return true;
@@ -277,7 +320,7 @@
@@ -268,7 +309,7 @@
{
func_41024_b(func_41025_i() - 1);
}
- if(isMinecartPowered() && rand.nextInt(4) == 0)
+ if(isMinecartPowered() && rand.nextInt(4) == 0 && minecartType == 2 && getClass() == EntityMinecart.class)
- if (isMinecartPowered() && rand.nextInt(4) == 0)
+ if (isMinecartPowered() && rand.nextInt(4) == 0 && minecartType == 2 && getClass() == EntityMinecart.class)
{
worldObj.spawnParticle("largesmoke", posX, posY + 0.80000000000000004D, posZ, 0.0D, 0.0D, 0.0D);
}
@@ -317,22 +360,19 @@
@@ -309,22 +350,18 @@
double d2 = 0.40000000000000002D;
double d4 = 0.0078125D;
int l = worldObj.getBlockId(i, j, k);
- if(BlockRail.isRailBlock(l))
+ if(canUseRail() && BlockRail.isRailBlock(l))
- if (BlockRail.isRailBlock(l))
+ if (canUseRail() && BlockRail.isRailBlock(l))
{
Vec3D vec3d = func_514_g(posX, posY, posZ);
- int i1 = worldObj.getBlockMetadata(i, j, k);
@ -176,54 +158,52 @@
posY = j;
boolean flag = false;
boolean flag1 = false;
if(l == Block.railPowered.blockID)
if (l == Block.railPowered.blockID)
{
- flag = (i1 & 8) != 0;
+ flag = (worldObj.getBlockMetadata(i, j, k) & 8) != 0;
flag1 = !flag;
}
- if(((BlockRail)Block.blocksList[l]).getIsPowered())
- if (((BlockRail)Block.blocksList[l]).getIsPowered())
- {
- i1 &= 7;
- }
+
if(i1 >= 2 && i1 <= 5)
if (i1 >= 2 && i1 <= 5)
{
posY = j + 1;
@@ -366,7 +406,8 @@
@@ -358,7 +395,7 @@
double d13 = Math.sqrt(motionX * motionX + motionZ * motionZ);
motionX = (d13 * d9) / d11;
motionZ = (d13 * d10) / d11;
- if(flag1)
+
+ if(flag1 && shouldDoRailFunctions())
- if (flag1)
+ if (flag1 && shouldDoRailFunctions())
{
double d16 = Math.sqrt(motionX * motionX + motionZ * motionZ);
if(d16 < 0.029999999999999999D)
@@ -407,30 +448,9 @@
if (d16 < 0.029999999999999999D)
@@ -401,30 +438,9 @@
posX = d18 + d9 * d17;
posZ = d19 + d10 * d17;
setPosition(posX, posY + (double)yOffset, posZ);
- double d23 = motionX;
- double d25 = motionZ;
- if(riddenByEntity != null)
- if (riddenByEntity != null)
- {
- d23 *= 0.75D;
- d25 *= 0.75D;
- }
- if(d23 < -d2)
- if (d23 < -d2)
- {
- d23 = -d2;
- }
- if(d23 > d2)
- if (d23 > d2)
- {
- d23 = d2;
- }
- if(d25 < -d2)
- if (d25 < -d2)
- {
- d25 = -d2;
- }
- if(d25 > d2)
- if (d25 > d2)
- {
- d25 = d2;
- }
@ -231,24 +211,25 @@
+
+ moveMinecartOnRail(i, j, k);
+
if(ai[0][1] != 0 && MathHelper.floor_double(posX) - i == ai[0][0] && MathHelper.floor_double(posZ) - k == ai[0][2])
if (ai[0][1] != 0 && MathHelper.floor_double(posX) - i == ai[0][0] && MathHelper.floor_double(posZ) - k == ai[0][2])
{
setPosition(posX, posY + (double)ai[0][1], posZ);
@@ -439,37 +459,9 @@
@@ -433,39 +449,9 @@
{
setPosition(posX, posY + (double)ai[1][1], posZ);
}
- if(riddenByEntity != null)
- if (riddenByEntity != null)
- {
- motionX *= 0.99699997901916504D;
- motionY *= 0.0D;
- motionZ *= 0.99699997901916504D;
- } else
- }
- else
- {
- if(minecartType == 2)
- if (minecartType == 2)
- {
- double d27 = MathHelper.sqrt_double(pushX * pushX + pushZ * pushZ);
- if(d27 > 0.01D)
- if (d27 > 0.01D)
- {
- pushX /= d27;
- pushZ /= d27;
@ -258,7 +239,8 @@
- motionZ *= 0.80000001192092896D;
- motionX += pushX * d29;
- motionZ += pushZ * d29;
- } else
- }
- else
- {
- motionX *= 0.89999997615814209D;
- motionY *= 0.0D;
@ -273,28 +255,29 @@
+ applyDragAndPushForces();
+
Vec3D vec3d1 = func_514_g(posX, posY, posZ);
if(vec3d1 != null && vec3d != null)
if (vec3d1 != null && vec3d != null)
{
@@ -490,25 +482,15 @@
@@ -486,26 +472,14 @@
motionX = d15 * (double)(k1 - i);
motionZ = d15 * (double)(l1 - k);
}
- if(minecartType == 2)
- if (minecartType == 2)
+
+ updatePushForces();
+
+ if (shouldDoRailFunctions())
{
- double d30 = MathHelper.sqrt_double(pushX * pushX + pushZ * pushZ);
- if(d30 > 0.01D && motionX * motionX + motionZ * motionZ > 0.001D)
- if (d30 > 0.01D && motionX * motionX + motionZ * motionZ > 0.001D)
- {
- pushX /= d30;
- pushZ /= d30;
- if(pushX * motionX + pushZ * motionZ < 0.0D)
- if (pushX * motionX + pushZ * motionZ < 0.0D)
- {
- pushX = 0.0D;
- pushZ = 0.0D;
- } else
- }
- else
- {
- pushX = motionX;
- pushZ = motionZ;
@ -302,54 +285,49 @@
- }
+ ((BlockRail)Block.blocksList[l]).onMinecartPass(worldObj, this, i, j, k);
}
- if(flag)
+
+ if(flag && shouldDoRailFunctions())
- if (flag)
+ if (flag && shouldDoRailFunctions())
{
double d31 = Math.sqrt(motionX * motionX + motionZ * motionZ);
if(d31 > 0.01D)
@@ -540,37 +522,10 @@
}
}
}
- } else
+ }
+ else
if (d31 > 0.01D)
@@ -540,35 +514,7 @@
}
else
{
- if(motionX < -d2)
- if (motionX < -d2)
- {
- motionX = -d2;
- }
- if(motionX > d2)
- if (motionX > d2)
- {
- motionX = d2;
- }
- if(motionZ < -d2)
- if (motionZ < -d2)
- {
- motionZ = -d2;
- }
- if(motionZ > d2)
- if (motionZ > d2)
- {
- motionZ = d2;
- }
- if(onGround)
- if (onGround)
- {
- motionX *= 0.5D;
- motionY *= 0.5D;
- motionZ *= 0.5D;
- }
- moveEntity(motionX, motionY, motionZ);
- if(!onGround)
- if (!onGround)
- {
- motionX *= 0.94999998807907104D;
- motionY *= 0.94999998807907104D;
- motionZ *= 0.94999998807907104D;
- }
+ moveMinecartOffRail(i, j, k);
+ moveMinecartOffRail(i, j, k);
}
rotationPitch = 0.0F;
double d6 = prevPosX - posX;
@@ -592,7 +547,20 @@
@@ -590,7 +536,20 @@
field_856_i = !field_856_i;
}
setRotation(rotationYaw, rotationPitch);
@ -368,15 +346,316 @@
+ }
+
+ List list = worldObj.getEntitiesWithinAABBExcludingEntity(this, box);
if(list != null && list.size() > 0)
if (list != null && list.size() > 0)
{
for(int j1 = 0; j1 < list.size(); j1++)
@@ -613,6 +581,178 @@
for (int j1 = 0; j1 < list.size(); j1++)
@@ -610,15 +569,8 @@
}
riddenByEntity = null;
}
- if (fuel > 0)
- {
- fuel--;
- }
- if (fuel <= 0)
- {
- pushX = pushZ = 0.0D;
- }
- setMinecartPowered(fuel > 0);
+ updateFuel();
+ ForgeHooks.onMinecartUpdate(this, i, j, k);
}
public Vec3D func_515_a(double d, double d1, double d2, double d3)
@@ -633,11 +585,7 @@
int l = worldObj.getBlockId(i, j, k);
if (BlockRail.isRailBlock(l))
{
- int i1 = worldObj.getBlockMetadata(i, j, k);
- if (((BlockRail)Block.blocksList[l]).getIsPowered())
- {
- i1 &= 7;
- }
+ int i1 = ((BlockRail)Block.blocksList[l]).getBasicRailMetadata(worldObj, this, i, j, k);
d1 = j;
if (i1 >= 2 && i1 <= 5)
{
@@ -679,12 +627,8 @@
int l = worldObj.getBlockId(i, j, k);
if (BlockRail.isRailBlock(l))
{
- int i1 = worldObj.getBlockMetadata(i, j, k);
+ int i1 = ((BlockRail)Block.blocksList[l]).getBasicRailMetadata(worldObj, this, i, j, k);
d1 = j;
- if (((BlockRail)Block.blocksList[l]).getIsPowered())
- {
- i1 &= 7;
- }
if (i1 >= 2 && i1 <= 5)
{
d1 = j + 1;
@@ -739,13 +683,13 @@
protected void writeEntityToNBT(NBTTagCompound nbttagcompound)
{
nbttagcompound.setInteger("Type", minecartType);
- if (minecartType == 2)
+ if (isPoweredCart())
{
nbttagcompound.setDouble("PushX", pushX);
nbttagcompound.setDouble("PushZ", pushZ);
- nbttagcompound.setShort("Fuel", (short)fuel);
+ nbttagcompound.setInteger("Fuel", fuel);
}
- else if (minecartType == 1)
+ if (getSizeInventory() > 0)
{
NBTTagList nbttaglist = new NBTTagList();
for (int i = 0; i < cargoItems.length; i++)
@@ -766,13 +710,13 @@
protected void readEntityFromNBT(NBTTagCompound nbttagcompound)
{
minecartType = nbttagcompound.getInteger("Type");
- if (minecartType == 2)
+ if (isPoweredCart())
{
pushX = nbttagcompound.getDouble("PushX");
pushZ = nbttagcompound.getDouble("PushZ");
- fuel = nbttagcompound.getShort("Fuel");
+ fuel = nbttagcompound.getInteger("Fuel");
}
- else if (minecartType == 1)
+ if (getSizeInventory() > 0)
{
NBTTagList nbttaglist = nbttagcompound.getTagList("Items");
cargoItems = new ItemStack[getSizeInventory()];
@@ -795,6 +739,12 @@
public void applyEntityCollision(Entity entity)
{
+ ForgeHooks.onMinecartEntityCollision(this, entity);
+ if (getCollisionHandler() != null)
+ {
+ getCollisionHandler().onEntityCollision(this, entity);
+ return;
+ }
if (worldObj.multiplayerWorld)
{
return;
@@ -803,7 +753,7 @@
{
return;
}
- if ((entity instanceof EntityLiving) && !(entity instanceof EntityPlayer) && minecartType == 0 && motionX * motionX + motionZ * motionZ > 0.01D && riddenByEntity == null && entity.ridingEntity == null)
+ if ((entity instanceof EntityLiving) && !(entity instanceof EntityPlayer) && canBeRidden() && motionX * motionX + motionZ * motionZ > 0.01D && riddenByEntity == null && entity.ridingEntity == null)
{
entity.mountEntity(this);
}
@@ -841,7 +791,7 @@
}
double d7 = entity.motionX + motionX;
double d8 = entity.motionZ + motionZ;
- if (((EntityMinecart)entity).minecartType == 2 && minecartType != 2)
+ if (((EntityMinecart)entity).isPoweredCart() && !isPoweredCart())
{
motionX *= 0.20000000298023224D;
motionZ *= 0.20000000298023224D;
@@ -849,7 +799,7 @@
entity.motionX *= 0.94999998807907104D;
entity.motionZ *= 0.94999998807907104D;
}
- else if (((EntityMinecart)entity).minecartType != 2 && minecartType == 2)
+ else if (!((EntityMinecart)entity).isPoweredCart() && isPoweredCart())
{
entity.motionX *= 0.20000000298023224D;
entity.motionZ *= 0.20000000298023224D;
@@ -879,7 +829,7 @@
public int getSizeInventory()
{
- return 27;
+ return (minecartType == 1 && getClass() == EntityMinecart.class ? 27 : 0);
}
public ItemStack getStackInSlot(int i)
@@ -935,7 +885,11 @@
public boolean interact(EntityPlayer entityplayer)
{
- if (minecartType == 0)
+ if (!ForgeHooks.onMinecartInteract(this, entityplayer))
+ {
+ return true;
+ }
+ if (canBeRidden())
{
if (riddenByEntity != null && (riddenByEntity instanceof EntityPlayer) && riddenByEntity != entityplayer)
{
@@ -946,14 +900,14 @@
entityplayer.mountEntity(this);
}
}
- else if (minecartType == 1)
+ else if (getSizeInventory() > 0)
{
if (!worldObj.multiplayerWorld)
{
entityplayer.displayGUIChest(this);
}
}
- else if (minecartType == 2)
+ else if (minecartType == 2 && getClass() == EntityMinecart.class)
{
ItemStack itemstack = entityplayer.inventory.getCurrentItem();
if (itemstack != null && itemstack.itemID == Item.coal.shiftedIndex)
@@ -1000,7 +954,7 @@
return entityplayer.getDistanceSqToEntity(this) <= 64D;
}
- protected boolean isMinecartPowered()
+ public boolean isMinecartPowered()
{
return (dataWatcher.getWatchableObjectByte(16) & 1) != 0;
}
@@ -1054,4 +1008,382 @@
{
return dataWatcher.getWatchableObjectInt(18);
}
+
+ /**
+ * Drops the cart as a item. The exact item dropped is defined by getItemDropped().
+ */
+ public void dropCartAsItem()
+ {
+ for(ItemStack item : getItemsDropped())
+ {
+ entityDropItem(item, 0);
+ }
+ }
+
+ /**
+ * Override this to define which items your cart drops when broken.
+ * This does not include items contained in the inventory,
+ * that is handled elsewhere.
+ * @return A list of items dropped.
+ */
+ public List<ItemStack> getItemsDropped()
+ {
+ List<ItemStack> items = new ArrayList<ItemStack>();
+ items.add(new ItemStack(Item.minecartEmpty));
+
+ switch(minecartType)
+ {
+ case 1:
+ items.add(new ItemStack(Block.chest));
+ break;
+ case 2:
+ items.add(new ItemStack(Block.stoneOvenIdle));
+ break;
+ }
+ return items;
+ }
+
+ /**
+ * This function returns an ItemStack that represents this cart.
+ * This should be an ItemStack that can be used by the player to place the cart.
+ * This is the item that was registered with the cart via the registerMinecart function,
+ * but is not necessary the item the cart drops when destroyed.
+ * @return An ItemStack that can be used to place the cart.
+ */
+ public ItemStack getCartItem()
+ {
+ return MinecraftForge.getItemForCart(this);
+ }
+
+ /**
+ * Returns true if this cart is self propelled.
+ * @return True if powered.
+ */
+ public boolean isPoweredCart()
+ {
+ return minecartType == 2 && getClass() == EntityMinecart.class;
+ }
+
+ /**
+ * Returns true if this cart is a storage cart
+ * Some carts may have inventories but not be storage carts
+ * and some carts without inventories may be storage carts.
+ * @return True if this cart should be classified as a storage cart.
+ */
+ public boolean isStorageCart()
+ {
+ return minecartType == 1 && getClass() == EntityMinecart.class;
+ }
+
+ /**
+ * Returns true if this cart can be ridden by an Entity.
+ * @return True if this cart can be ridden.
+ */
+ public boolean canBeRidden()
+ {
+ if(minecartType == 0 && getClass() == EntityMinecart.class)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Returns true if this cart can currently use rails.
+ * This function is mainly used to gracefully detach a minecart from a rail.
+ * @return True if the minecart can use rails.
+ */
+ public boolean canUseRail()
+ {
+ return canUseRail;
+ }
+
+ /**
+ * Set whether the minecart can use rails.
+ * This function is mainly used to gracefully detach a minecart from a rail.
+ * @param use Whether the minecart can currently use rails.
+ */
+ public void setCanUseRail(boolean use)
+ {
+ canUseRail = use;
+ }
+
+ /**
+ * Return false if this cart should not call IRail.onMinecartPass() and should ignore Powered Rails.
+ * @return True if this cart should call IRail.onMinecartPass().
+ */
+ public boolean shouldDoRailFunctions()
+ {
+ return true;
+ }
+
+ /**
+ * Simply returns the minecartType variable.
+ * @return minecartType
+ */
+ public int getMinecartType()
+ {
+ return minecartType;
+ }
+
+ /**
+ * Gets the current global Minecart Collision handler if none
+ * is registered, returns null
+ * @return The collision handler or null
+ */
+ public static IMinecartCollisionHandler getCollisionHandler()
+ {
+ return collisionHandler;
+ }
+
+ /**
+ * Sets the global Minecart Collision handler, overwrites any
+ * that is currently set.
+ * @param handler The new handler
+ */
+ public static void setCollisionHandler(IMinecartCollisionHandler handler)
+ {
+ collisionHandler = handler;
+ }
+
+ /**
@ -547,308 +826,15 @@
+ */
+ protected void updateFuel()
+ {
if(fuel > 0)
{
fuel--;
@@ -636,11 +776,8 @@
int l = worldObj.getBlockId(i, j, k);
if(BlockRail.isRailBlock(l))
{
- int i1 = worldObj.getBlockMetadata(i, j, k);
- if(((BlockRail)Block.blocksList[l]).getIsPowered())
- {
- i1 &= 7;
- }
+ int i1 = ((BlockRail)Block.blocksList[l]).getBasicRailMetadata(worldObj, this, i, j, k);
+
d1 = j;
if(i1 >= 2 && i1 <= 5)
{
@@ -681,12 +818,8 @@
int l = worldObj.getBlockId(i, j, k);
if(BlockRail.isRailBlock(l))
{
- int i1 = worldObj.getBlockMetadata(i, j, k);
+ int i1 = ((BlockRail)Block.blocksList[l]).getBasicRailMetadata(worldObj, this, i, j, k);
d1 = j;
- if(((BlockRail)Block.blocksList[l]).getIsPowered())
- {
- i1 &= 7;
- }
if(i1 >= 2 && i1 <= 5)
{
d1 = j + 1;
@@ -739,13 +872,14 @@
protected void writeEntityToNBT(NBTTagCompound nbttagcompound)
{
nbttagcompound.setInteger("Type", minecartType);
- if(minecartType == 2)
+ if(isPoweredCart())
{
nbttagcompound.setDouble("PushX", pushX);
nbttagcompound.setDouble("PushZ", pushZ);
- nbttagcompound.setShort("Fuel", (short)fuel);
- } else
- if(minecartType == 1)
+ nbttagcompound.setInteger("Fuel", fuel);
+ }
+
+ if(getSizeInventory() > 0)
{
NBTTagList nbttaglist = new NBTTagList();
for(int i = 0; i < cargoItems.length; i++)
@@ -766,13 +900,14 @@
protected void readEntityFromNBT(NBTTagCompound nbttagcompound)
{
minecartType = nbttagcompound.getInteger("Type");
- if(minecartType == 2)
+ if(isPoweredCart())
{
pushX = nbttagcompound.getDouble("PushX");
pushZ = nbttagcompound.getDouble("PushZ");
- fuel = nbttagcompound.getShort("Fuel");
- } else
- if(minecartType == 1)
+ fuel = nbttagcompound.getInteger("Fuel");
+ }
+
+ if(getSizeInventory() > 0)
{
NBTTagList nbttaglist = nbttagcompound.getTagList("Items");
cargoItems = new ItemStack[getSizeInventory()];
@@ -796,6 +931,16 @@
public void applyEntityCollision(Entity entity)
{
+ ForgeHooks.onMinecartEntityCollision(this, entity);
+
+
+ if (getCollisionHandler() != null)
+ {
+ getCollisionHandler().onEntityCollision(this, entity);
+ return;
+ }
+
+
if(worldObj.multiplayerWorld)
{
return;
@@ -804,7 +949,7 @@
{
return;
}
- if((entity instanceof EntityLiving) && !(entity instanceof EntityPlayer) && minecartType == 0 && motionX * motionX + motionZ * motionZ > 0.01D && riddenByEntity == null && entity.ridingEntity == null)
+ if((entity instanceof EntityLiving) && !(entity instanceof EntityPlayer) && canBeRidden() && motionX * motionX + motionZ * motionZ > 0.01D && riddenByEntity == null && entity.ridingEntity == null)
{
entity.mountEntity(this);
}
@@ -842,7 +987,7 @@
}
double d7 = entity.motionX + motionX;
double d8 = entity.motionZ + motionZ;
- if(((EntityMinecart)entity).minecartType == 2 && minecartType != 2)
+ if(((EntityMinecart)entity).isPoweredCart() && !isPoweredCart())
{
motionX *= 0.20000000298023224D;
motionZ *= 0.20000000298023224D;
@@ -850,7 +995,7 @@
entity.motionX *= 0.94999998807907104D;
entity.motionZ *= 0.94999998807907104D;
} else
- if(((EntityMinecart)entity).minecartType != 2 && minecartType == 2)
+ if(!((EntityMinecart)entity).isPoweredCart() && isPoweredCart())
{
entity.motionX *= 0.20000000298023224D;
entity.motionZ *= 0.20000000298023224D;
@@ -878,7 +1023,7 @@
public int getSizeInventory()
{
- return 27;
+ return (minecartType == 1 && getClass() == EntityMinecart.class ? 27 : 0);
}
public ItemStack getStackInSlot(int i)
@@ -933,7 +1078,12 @@
public boolean interact(EntityPlayer entityplayer)
{
- if(minecartType == 0)
+ if (!ForgeHooks.onMinecartInteract(this, entityplayer))
+ {
+ return true;
+ }
+
+ if(canBeRidden())
{
if(riddenByEntity != null && (riddenByEntity instanceof EntityPlayer) && riddenByEntity != entityplayer)
{
@@ -944,14 +1094,14 @@
entityplayer.mountEntity(this);
}
} else
- if(minecartType == 1)
+ if(getSizeInventory() > 0)
{
if(!worldObj.multiplayerWorld)
{
entityplayer.displayGUIChest(this);
}
} else
- if(minecartType == 2)
+ if(minecartType == 2 && getClass() == EntityMinecart.class)
{
ItemStack itemstack = entityplayer.inventory.getCurrentItem();
if(itemstack != null && itemstack.itemID == Item.coal.shiftedIndex)
@@ -998,7 +1148,7 @@
return entityplayer.getDistanceSqToEntity(this) <= 64D;
}
- protected boolean isMinecartPowered()
+ public boolean isMinecartPowered()
{
return (dataWatcher.getWatchableObjectByte(16) & 1) != 0;
}
@@ -1051,5 +1201,203 @@
{
return dataWatcher.getWatchableObjectInt(18);
}
+
+ /**
+ * Drops the cart as a item. The exact item dropped is defined by getItemDropped().
+ */
+ public void dropCartAsItem()
+ {
+ for(ItemStack item : getItemsDropped())
+ if (fuel > 0)
+ {
+ entityDropItem(item, 0);
+ fuel--;
+ }
+ }
+
+ /**
+ * Override this to define which items your cart drops when broken.
+ * This does not include items contained in the inventory,
+ * that is handled elsewhere.
+ * @return A list of items dropped.
+ */
+ public List<ItemStack> getItemsDropped()
+ {
+ List<ItemStack> items = new ArrayList<ItemStack>();
+ items.add(new ItemStack(Item.minecartEmpty));
+
+ switch(minecartType)
+ if (fuel <= 0)
+ {
+ case 1:
+ items.add(new ItemStack(Block.chest));
+ break;
+ case 2:
+ items.add(new ItemStack(Block.stoneOvenIdle));
+ break;
+ pushX = pushZ = 0.0D;
+ }
+ return items;
+ }
+
+ /**
+ * This function returns an ItemStack that represents this cart.
+ * This should be an ItemStack that can be used by the player to place the cart.
+ * This is the item that was registered with the cart via the registerMinecart function,
+ * but is not necessary the item the cart drops when destroyed.
+ * @return An ItemStack that can be used to place the cart.
+ */
+ public ItemStack getCartItem()
+ {
+ return MinecraftForge.getItemForCart(this);
+ }
+
+ /**
+ * Returns true if this cart is self propelled.
+ * @return True if powered.
+ */
+ public boolean isPoweredCart()
+ {
+ return minecartType == 2 && getClass() == EntityMinecart.class;
+ }
+
+ /**
+ * Returns true if this cart is a storage cart
+ * Some carts may have inventories but not be storage carts
+ * and some carts without inventories may be storage carts.
+ * @return True if this cart should be classified as a storage cart.
+ */
+ public boolean isStorageCart()
+ {
+ return minecartType == 1 && getClass() == EntityMinecart.class;
+ }
+
+ /**
+ * Returns true if this cart can be ridden by an Entity.
+ * @return True if this cart can be ridden.
+ */
+ public boolean canBeRidden()
+ {
+ if(minecartType == 0 && getClass() == EntityMinecart.class)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Returns true if this cart can currently use rails.
+ * This function is mainly used to gracefully detach a minecart from a rail.
+ * @return True if the minecart can use rails.
+ */
+ public boolean canUseRail()
+ {
+ return canUseRail;
+ }
+
+ /**
+ * Set whether the minecart can use rails.
+ * This function is mainly used to gracefully detach a minecart from a rail.
+ * @param use Whether the minecart can currently use rails.
+ */
+ public void setCanUseRail(boolean use)
+ {
+ canUseRail = use;
+ }
+
+ /**
+ * Return false if this cart should not call IRail.onMinecartPass() and should ignore Powered Rails.
+ * @return True if this cart should call IRail.onMinecartPass().
+ */
+ public boolean shouldDoRailFunctions()
+ {
+ return true;
+ }
+
+ /**
+ * Simply returns the minecartType variable.
+ * @return minecartType
+ */
+ public int getMinecartType()
+ {
+ return minecartType;
+ }
+
+ /**
+ * Gets the current global Minecart Collision handler if none
+ * is registered, returns null
+ * @return The collision handler or null
+ */
+ public static IMinecartCollisionHandler getCollisionHandler()
+ {
+ return collisionHandler;
+ }
+
+ /**
+ * Sets the global Minecart Collision handler, overwrites any
+ * that is currently set.
+ * @param handler The new handler
+ */
+ public static void setCollisionHandler(IMinecartCollisionHandler handler)
+ {
+ collisionHandler = handler;
+ setMinecartPowered(fuel > 0);
+ }
+
+ /**
@ -867,7 +853,7 @@
+ {
+ return maxSpeedRail;
+ }
+
+ public void setMaxSpeedRail(float value)
+ {
+ maxSpeedRail = value;

View file

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/src/EntityPigZombie.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/EntityPigZombie.java 0000-00-00 00:00:00.000000000 -0000
@@ -94,7 +94,7 @@
@@ -90,7 +90,7 @@
return super.attackEntityFrom(damagesource, i);
}

View file

@ -1,25 +1,25 @@
--- ../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 @@
@@ -2,6 +2,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:
@@ -166,6 +170,7 @@
clearItemInUse();
} else
+import net.minecraft.src.forge.ArmorProperties;
+import net.minecraft.src.forge.ForgeHooks;
+import net.minecraft.src.forge.ISpecialArmor;
+
public abstract class EntityPlayer extends EntityLiving
{
public InventoryPlayer inventory;
@@ -149,6 +153,7 @@
}
else
{
+ itemInUse.getItem().onUsingItemTick(itemInUse,this,itemInUseCount);
if(itemInUseCount <= 25 && itemInUseCount % 4 == 0)
+ itemInUse.getItem().onUsingItemTick(itemInUse, this, itemInUseCount);
if (itemInUseCount <= 25 && itemInUseCount % 4 == 0)
{
func_35201_a(itemstack, 5);
@@ -502,7 +507,16 @@
@@ -490,7 +495,16 @@
public void dropCurrentItem()
{
@ -37,16 +37,17 @@
}
public void dropPlayerItem(ItemStack itemstack)
@@ -548,6 +562,8 @@
@@ -537,6 +551,9 @@
worldObj.spawnEntityInWorld(entityitem);
}
+ /* FORGE: This isnt called anymore
+ */
+ @Deprecated
public float getCurrentPlayerStrVsBlock(Block block)
{
float f = inventory.getStrVsBlock(block);
@@ -576,6 +592,45 @@
@@ -565,6 +582,45 @@
return f1;
}
@ -92,50 +93,53 @@
public boolean canHarvestBlock(Block block)
{
return inventory.canHarvestBlock(block);
@@ -774,6 +829,25 @@
@@ -764,6 +820,27 @@
protected void damageEntity(DamageSource damagesource, int i)
{
+ boolean doRegularComputation = true;
+ int initialDamage = i;
+
+ for (ItemStack stack : inventory.armorInventory) {
+ if (stack != null && stack.getItem() instanceof ISpecialArmor) {
+ ISpecialArmor armor = (ISpecialArmor) stack.getItem();
+
+ ArmorProperties props = armor.getProperties(this, initialDamage, i);
+ i = i - props.damageRemove;
+ doRegularComputation = doRegularComputation
+ && props.allowRegularComputation;
+ }
+ }
+
+ if (!doRegularComputation) {
+ super.damageEntity(damagesource, i);
+ return;
+ }
+
if(!damagesource.isUnblockable() && isBlocking())
+ int initialDamage = i;
+
+ for (ItemStack stack : inventory.armorInventory)
+ {
+ if (stack != null && stack.getItem() instanceof ISpecialArmor)
+ {
+ ISpecialArmor armor = (ISpecialArmor) stack.getItem();
+
+ ArmorProperties props = armor.getProperties(this, initialDamage, i);
+ i = i - props.damageRemove;
+ doRegularComputation = doRegularComputation && props.allowRegularComputation;
+ }
+ }
+
+ if (!doRegularComputation)
+ {
+ super.damageEntity(damagesource, i);
+ return;
+ }
+
if (!damagesource.isUnblockable() && isBlocking())
{
i = 1 + i >> 1;
@@ -825,7 +899,9 @@
@@ -815,7 +892,9 @@
public void destroyCurrentEquippedItem()
{
+ ItemStack orig=inventory.getCurrentItem();
+ ItemStack orig = inventory.getCurrentItem();
inventory.setInventorySlotContents(inventory.currentItem, null);
+ ForgeHooks.onDestroyCurrentItem(this,orig);
+ ForgeHooks.onDestroyCurrentItem(this, orig);
}
public double getYOffset()
@@ -957,6 +1033,10 @@
@@ -947,6 +1026,11 @@
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)
+ EnumStatus customSleep = ForgeHooks.sleepInBedAt(this, i, j, k);
+ if (customSleep != null)
+ {
+ return customSleep;
+ }
if (!worldObj.multiplayerWorld)
{
if(isPlayerSleeping() || !isEntityAlive())
if (isPlayerSleeping() || !isEntityAlive())

View file

@ -1,45 +1,48 @@
--- ../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;
@@ -4,6 +4,8 @@
import java.nio.FloatBuffer;
import java.util.Random;
@@ -916,8 +917,10 @@
import net.minecraft.client.Minecraft;
+import net.minecraft.src.forge.ForgeHooksClient;
+
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.ContextCapabilities;
import org.lwjgl.opengl.Display;
@@ -911,8 +913,11 @@
EntityPlayer entityplayer = (EntityPlayer)entityliving;
GL11.glDisable(3008 /*GL_ALPHA_TEST*/);
Profiler.endStartSection("outline");
- renderglobal.drawBlockBreaking(entityplayer, mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), f);
- renderglobal.drawSelectionBox(entityplayer, mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), f);
+ if (!ForgeHooksClient.onBlockHighlight(renderglobal, entityplayer, mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), f)) {
+ 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*/);
}
}
@@ -969,8 +972,10 @@
@@ -967,8 +972,11 @@
EntityPlayer entityplayer1 = (EntityPlayer)entityliving;
GL11.glDisable(3008 /*GL_ALPHA_TEST*/);
Profiler.endStartSection("outline");
- renderglobal.drawBlockBreaking(entityplayer1, mc.objectMouseOver, 0, entityplayer1.inventory.getCurrentItem(), f);
- renderglobal.drawSelectionBox(entityplayer1, mc.objectMouseOver, 0, entityplayer1.inventory.getCurrentItem(), f);
+ if (!ForgeHooksClient.onBlockHighlight(renderglobal, entityplayer1, mc.objectMouseOver, 0, entityplayer1.inventory.getCurrentItem(), f)) {
+ 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*/);
}
Profiler.endStartSection("weather");
@@ -988,6 +993,8 @@
@@ -986,6 +994,8 @@
setupFog(1, f);
GL11.glPopMatrix();
}
+ Profiler.endStartSection("fhooks");
+ ForgeHooksClient.onRenderWorldLast(renderglobal,f);
+ Profiler.endStartSection("fhooks");
+ ForgeHooksClient.onRenderWorldLast(renderglobal,f);
Profiler.endStartSection("hand");
if(cameraZoom == 1.0D)
if (cameraZoom == 1.0D)
{

View file

@ -1,26 +1,27 @@
--- ../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 @@
@@ -1,6 +1,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,
@@ -76,7 +77,14 @@
public class Explosion
{
@@ -66,7 +67,15 @@
int k3 = worldObj.getBlockId(l2, i3, j3);
if(k3 > 0)
if (k3 > 0)
{
- f1 -= (Block.blocksList[k3].getExplosionResistance(exploder) + 0.3F) * f2;
+ if (Block.blocksList[k3] instanceof ISpecialResistance){
+ if (Block.blocksList[k3] instanceof ISpecialResistance)
+ {
+ ISpecialResistance isr = (ISpecialResistance)Block.blocksList[k3];
+ f1 -= (isr.getSpecialExplosionResistance(worldObj, l2, i3, j3,
+ explosionX, explosionY, explosionZ, exploder) + 0.3F) * f2;
+ } else {
+ f1 -= (isr.getSpecialExplosionResistance(worldObj, l2, i3, j3, explosionX, explosionY, explosionZ, exploder) + 0.3F) * f2;
+ }
+ else
+ {
+ f1 -= (Block.blocksList[k3].getExplosionResistance(exploder) + 0.3F) * f2;
+ }
+
+ }
}
if(f1 > 0.0F)
if (f1 > 0.0F)
{

View file

@ -1,22 +1,20 @@
--- ../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 @@
@@ -2,11 +2,13 @@
import java.util.HashMap;
import java.util.Map;
+import java.util.Arrays;
// Referenced classes of package net.minecraft.src:
// Block, ItemStack, Item
@@ -15,6 +16,7 @@
public class FurnaceRecipes
{
private static final FurnaceRecipes smeltingBase = new FurnaceRecipes();
private Map smeltingList;
+ private Map metaSmeltingList;
public static final FurnaceRecipes smelting()
{
@@ -24,6 +26,7 @@
@@ -16,6 +18,7 @@
private FurnaceRecipes()
{
smeltingList = new HashMap();
@ -24,34 +22,45 @@
addSmelting(Block.oreIron.blockID, new ItemStack(Item.ingotIron));
addSmelting(Block.oreGold.blockID, new ItemStack(Item.ingotGold));
addSmelting(Block.oreDiamond.blockID, new ItemStack(Item.diamond));
@@ -46,11 +49,32 @@
@@ -38,11 +41,43 @@
smeltingList.put(Integer.valueOf(i), itemstack);
}
+ /* FORGE: Add a metadata-sensitive furnace recipe.
+ /**
+ * Add a metadata-sensitive furnace recipe
+ * @param itemID The Item ID
+ * @param metadata The Item Metadata
+ * @param itemstack The ItemStack for the result
+ */
+ public void addSmelting(int i, int meta, ItemStack itemstack)
+ public void addSmelting(int itemID, int metadata, ItemStack itemstack)
+ {
+ metaSmeltingList.put(Arrays.asList(i,meta), itemstack);
+ metaSmeltingList.put(Arrays.asList(itemID, metadata), itemstack);
+ }
+
+ /* FORGE: Not used anymore.
+ */
+ /* FORGE: Not used anymore, now uses a metadata sensitive version */
+ @Deprecated
public ItemStack getSmeltingResult(int i)
{
return (ItemStack)smeltingList.get(Integer.valueOf(i));
}
+ /* FORGE: Added to allow metadata-sensitive smelting.
+ /**
+ * Used to get the resulting ItemStack form a source ItemStack
+ * @param item The Source ItemStack
+ * @return The result ItemStack
+ */
+ 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 ItemStack getSmeltingResult(ItemStack item)
+ {
+ if (item == null)
+ {
+ return null;
+ }
+ ItemStack ret = (ItemStack)metaSmeltingList.get(Arrays.asList(item.itemID, item.getItemDamage()));
+ if (ret != null)
+ {
+ return ret;
+ }
+ return (ItemStack)smeltingList.get(Integer.valueOf(item.itemID));
+ }
+
public Map getSmeltingList()

View file

@ -1,6 +1,6 @@
--- ../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
@@ -5,6 +5,7 @@
@@ -1,6 +1,7 @@
package net.minecraft.src;
import java.io.PrintStream;
@ -8,92 +8,31 @@
import java.util.List;
import java.util.Random;
@@ -177,6 +178,9 @@
@@ -157,6 +158,9 @@
private String potionModifier;
private String itemName;
+ // FORGE: To disable repair recipes.
+ protected boolean canRepair=true;
+ protected boolean canRepair = true;
+
protected Item(int i)
{
maxStackSize = 64;
@@ -221,6 +225,14 @@
return getIconFromDamage(itemstack.getItemDamage());
}
+ /* FORGE: This is called when the item is used, before the block is
+ * activated. Return true to prevent any further processing.
+ */
+ public boolean onItemUseFirst(ItemStack ist, EntityPlayer player,
+ World world, int i, int j, int k, int l) {
+ return false;
+ }
+
public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l)
@@ -469,6 +473,109 @@
{
return false;
@@ -231,6 +243,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;
@@ -278,6 +297,34 @@
return maxDamage > 0 && !hasSubtypes;
}
+ /* FORGE: Called by CraftingManager to determine if an item is repairable.
+ */
+ public boolean isRepairable() {
+ return canRepair && isDamageable();
+ }
+
+ /* FORGE: Call to disable repair recipes.
+ */
+ public Item setNoRepair() {
+ canRepair=false;
+ return this;
+ }
+
+ /* FORGE: Called before a block is broken. Return true to prevent default
+ * block harvesting.
+ *
+ * Note: In SMP, this is called on both client and server sides!
+ */
+ public boolean onBlockStartBreak(ItemStack itemstack, int i, int j, int k,
+ EntityPlayer player) {
+ return false;
+ }
+
+ /* FORGE: Called each tick while using an item.
+ */
+ public void onUsingItemTick(ItemStack ist, EntityPlayer player, int count) {
+ }
+
public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
{
return false;
@@ -473,6 +520,32 @@
{
return 0;
return getIconFromDamage(i);
}
+
+ /* FORGE: Called when a new CreativeContainer is opened, populate the list
+ /**
+ * Called when a new CreativeContainer is opened, populate the list
+ * with all of the items for this item you want a player in creative mode
+ * to have access to.
+ *
+ * @param itemList The list of items currently in the creative inventory
+ */
+ public void addCreativeItems(ArrayList itemList)
+ {
+ if (this.shiftedIndex != Item.potion.shiftedIndex)
+ if (this.shiftedIndex != Item.potion.shiftedIndex && this.shiftedIndex != Item.field_44019_bC.shiftedIndex)
+ {
+ itemList.add(new ItemStack(this, 1));
+ }
@ -111,7 +50,81 @@
+ public boolean onDroppedByPlayer(ItemStack item, EntityPlayer player)
+ {
+ return true;
+ }
+
+ /**
+ * This is called when the item is used, before the block is activated.
+ * @param stack The Item Stack
+ * @param player The Player that used the item
+ * @param world The Current World
+ * @param X Target X Position
+ * @param Y Target Y Position
+ * @param Z Target Z Position
+ * @param side The side of the target hit
+ * @return Return true to prevent any further processing.
+ */
+ public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int X, int Y, int Z, int side)
+ {
+ return false;
+ }
+
+ /**
+ * Metadata-sensitive version of getStrVsBlock
+ * @param itemstack The Item Stack
+ * @param block The block the item is trying to break
+ * @param metadata The items current metadata
+ * @return The damage strength
+ */
+ public float getStrVsBlock(ItemStack itemstack, Block block, int metadata)
+ {
+ return getStrVsBlock(itemstack, block);
+ }
+
+ /**
+ * Called by CraftingManager to determine if an item is reparable.
+ * @return True if reparable
+ */
+ public boolean isRepairable()
+ {
+ return canRepair && isDamageable();
+ }
+
+ /**
+ * Call to disable repair recipes.
+ * @return The current Item instance
+ */
+ public Item setNoRepair()
+ {
+ canRepair = false;
+ return this;
+ }
+
+ /**
+ * Called before a block is broken. Return true to prevent default block harvesting.
+ *
+ * Note: In SMP, this is called on both client and server sides!
+ *
+ * @param itemstack The current ItemStack
+ * @param X The X Position
+ * @param Y The X Position
+ * @param Z The X Position
+ * @param player The Player that is wielding the item
+ * @return True to prevent harvesting, false to continue as normal
+ */
+ public boolean onBlockStartBreak(ItemStack itemstack, int X, int Y, int Z, EntityPlayer player)
+ {
+ return false;
+ }
+
+ /**
+ * Called each tick while using an item.
+ * @param stack The Item being used
+ * @param player The Player using the item
+ * @param count The amount of time in tick the item has been used for continuously
+ */
+ public void onUsingItemTick(ItemStack stack, EntityPlayer player, int count)
+ {
+ }
static
static
{

View file

@ -1,23 +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 @@
@@ -2,6 +2,8 @@
import java.util.Random;
+import net.minecraft.src.forge.MinecraftForge;
+
// Referenced classes of package net.minecraft.src:
// Item, EntityPlayer, MovingObjectPosition, EnumMovingObjectType,
// World, Material, PlayerCapabilities, ItemStack,
@@ -50,6 +52,11 @@
public class ItemBucket extends Item
{
private int isFull;
@@ -40,6 +42,11 @@
{
return itemstack;
}
+ ItemStack customBucket = MinecraftForge.fillCustomBucket(world,
+ i, j, k);
+ if (customBucket != null) {
+ 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)
if (world.getBlockMaterial(i, j, k) == Material.water && world.getBlockMetadata(i, j, k) == 0)
{
world.setBlockWithNotify(i, j, k, 0);

View file

@ -1,28 +1,21 @@
--- ../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,7 +3,9 @@
// Decompiler options: packimports(3) braces deadcode fieldsfirst
@@ -1,7 +1,10 @@
package net.minecraft.src;
+import net.minecraft.src.forge.ForgeHooks;
+import java.util.ArrayList;
import java.util.Random;
// Referenced classes of package net.minecraft.src:
@@ -45,13 +47,23 @@
public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l)
{
- if(!entityplayer.canPlayerEdit(i, j, k))
+ if(entityplayer != null && !entityplayer.canPlayerEdit(i, j, k))
{
return false;
}
if(itemstack.getItemDamage() == 15)
+import net.minecraft.src.forge.ForgeHooks;
+
public class ItemDye extends Item
{
public static final String dyeColorNames[] =
@@ -43,6 +46,16 @@
if (itemstack.getItemDamage() == 15)
{
int i1 = world.getBlockId(i, j, k);
+
+
+ if (ForgeHooks.onUseBonemeal(world, i1, i, j, k))
+ {
+ if (!world.multiplayerWorld)
@ -32,33 +25,38 @@
+ return true;
+ }
+
if(i1 == Block.sapling.blockID)
if (i1 == Block.sapling.blockID)
{
if(!world.multiplayerWorld)
@@ -118,13 +130,7 @@
if (!world.multiplayerWorld)
@@ -109,14 +122,7 @@
world.setBlockAndMetadataWithNotify(k1, l1, i2, Block.tallGrass.blockID, 1);
continue;
}
- if(itemRand.nextInt(3) != 0)
- if (itemRand.nextInt(3) != 0)
- {
- world.setBlockWithNotify(k1, l1, i2, Block.plantYellow.blockID);
- } else
- }
- else
- {
- world.setBlockWithNotify(k1, l1, i2, Block.plantRed.blockID);
- }
+ ForgeHooks.plantGrassPlant(world,k1,l1,i2);
+ ForgeHooks.plantGrassPlant(world, k1, l1, i2);
}
}
@@ -147,5 +153,17 @@
}
}
return true;
@@ -125,6 +131,23 @@
return false;
}
+
+ /* FORGE: Called when a new CreativeContainer is opened, populate the list
+ /**
+ * Called when a new CreativeContainer is opened, populate the list
+ * with all of the items for this item you want a player in creative mode
+ * to have access to.
+ *
+ * @param itemList The list of items currently in the creative inventory
+ */
+ @Override
+ public void addCreativeItems(ArrayList itemList)
+ {
+ for (int x = 0; x < 16; x++)
@ -66,5 +64,7 @@
+ itemList.add(new ItemStack(this, 1, x));
+ }
+ }
}
+
public void useItemOnEntity(ItemStack itemstack, EntityLiving entityliving)
{
if (entityliving instanceof EntitySheep)

View file

@ -1,21 +1,22 @@
--- ../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
@@ -4,6 +4,7 @@
@@ -1,5 +1,7 @@
package net.minecraft.src;
+import net.minecraft.src.forge.ForgeHooks;
// Referenced classes of package net.minecraft.src:
// Item, EnumToolMaterial, EntityPlayer, World,
@@ -25,6 +26,10 @@
+
public class ItemHoe extends Item
{
public ItemHoe(int i, EnumToolMaterial enumtoolmaterial)
@@ -15,6 +17,11 @@
{
return false;
}
+ if(ForgeHooks.onUseHoe(itemstack,entityplayer,world,i,j,k)) {
+ itemstack.damageItem(1, entityplayer);
+ return true;
+ }
+ if(ForgeHooks.onUseHoe(itemstack, entityplayer, world, i, j, k))
+ {
+ itemstack.damageItem(1, entityplayer);
+ return true;
+ }
int i1 = world.getBlockId(i, j, k);
int j1 = world.getBlockId(i, j + 1, k);
if(l != 0 && j1 == 0 && i1 == Block.grass.blockID || i1 == Block.dirt.blockID)
if (l != 0 && j1 == 0 && i1 == Block.grass.blockID || i1 == Block.dirt.blockID)

View file

@ -1,6 +1,6 @@
--- ../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 @@
@@ -1,6 +1,10 @@
package net.minecraft.src;
import net.minecraft.client.Minecraft;
@ -10,32 +10,36 @@
+
import org.lwjgl.opengl.GL11;
// Referenced classes of package net.minecraft.src:
@@ -40,18 +44,27 @@
public class ItemRenderer
@@ -27,20 +31,31 @@
public void renderItem(EntityLiving entityliving, ItemStack itemstack, int i)
{
GL11.glPushMatrix();
- if(itemstack.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
- if (itemstack.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
+ ICustomItemRenderer customRenderer = MinecraftForgeClient.getCustomItemRenderer(itemstack.itemID);
+
+ if (customRenderer != null) {
+
+ if (customRenderer != null)
+ {
+ String tex = ForgeHooksClient.getTexture("/terrain.png", itemstack.getItem());
+ GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture(tex));
+ ForgeHooksClient.renderCustomItem(customRenderer, renderBlocksInstance, itemstack.itemID, itemstack.getItemDamage(), entityliving.getEntityBrightness(1.0F));
+ } else if(itemstack.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
+ }
+ else if(itemstack.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
{
- GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/terrain.png"));
+ String tex = ForgeHooksClient.getTexture("/terrain.png", Block.blocksList[itemstack.itemID]);
+ GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture(tex));
renderBlocksInstance.renderBlockAsItem(Block.blocksList[itemstack.itemID], itemstack.getItemDamage(), 1.0F);
} else
}
else
{
if(itemstack.itemID < 256)
if (itemstack.itemID < 256)
{
- GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/terrain.png"));
+ String tex = ForgeHooksClient.getTexture("/terrain.png", Block.blocksList[itemstack.itemID]);
+ GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture(tex));
} else
}
else
{
- GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/gui/items.png"));
+ String tex = ForgeHooksClient.getTexture("/gui/items.png", Item.itemsList[itemstack.itemID]);

View file

@ -1,17 +1,12 @@
--- ../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 @@
@@ -1,10 +1,12 @@
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,
@@ -13,8 +15,8 @@
+
public class ItemTool extends Item
{
private Block blocksEffectiveAgainst[];
- protected float efficiencyOnProperMaterial;
- private int damageVsEntity;
@ -20,15 +15,18 @@
protected EnumToolMaterial toolMaterial;
protected ItemTool(int i, int j, EnumToolMaterial enumtoolmaterial, Block ablock[])
@@ -42,6 +44,14 @@
@@ -32,6 +34,17 @@
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;
+ /* FORGE: Overridden to allow custom tool effectiveness */
+ @Override
+ public float getStrVsBlock(ItemStack itemstack, Block block, int md)
+ {
+ if (ForgeHooks.isToolEffective(itemstack, block, md))
+ {
+ return efficiencyOnProperMaterial;
+ }
+ return getStrVsBlock(itemstack,block);
+ }
+

View file

@ -1,6 +1,6 @@
--- ../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
@@ -18,6 +18,9 @@
@@ -9,6 +9,9 @@
public int sideHit;
public Vec3D hitVec;
public Entity entityHit;

View file

@ -1,14 +1,15 @@
--- ../src_base/minecraft/net/minecraft/src/Packet230ModLoader.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/Packet230ModLoader.java 0000-00-00 00:00:00.000000000 -0000
@@ -75,7 +75,10 @@
}));
@@ -71,7 +71,11 @@
}));
}
byte abyte0[] = new byte[k1];
- datainputstream.read(abyte0, 0, k1);
+ int bytesRead = 0;
+ while (bytesRead < k1) {
+ bytesRead += datainputstream.read(abyte0, bytesRead, k1 - bytesRead);
+ }
+ int bytesRead = 0;
+ while (bytesRead < k1)
+ {
+ bytesRead += datainputstream.read(abyte0, bytesRead, k1 - bytesRead);
+ }
dataString[j1] = new String(abyte0);
}
}

View file

@ -1,34 +1,32 @@
--- ../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 fieldsfirst
@@ -1,6 +1,7 @@
package net.minecraft.src;
+import net.minecraft.src.forge.*;
import net.minecraft.client.Minecraft;
+import net.minecraft.src.forge.ForgeHooks;
@@ -39,11 +40,10 @@
public abstract class PlayerController
{
@@ -29,10 +30,10 @@
}
world.playAuxSFX(2001, i, j, k, block.blockID + world.getBlockMetadata(i, j, k) * 256);
int i1 = world.getBlockMetadata(i, j, k);
- boolean flag = world.setBlockWithNotify(i, j, k, 0);
- if(block != null && flag)
- {
- block.onBlockDestroyedByPlayer(world, i, j, k, i1);
- }
+
- if (block != null && flag)
+ boolean flag = block.removeBlockByPlayer(world, mc.thePlayer, i, j, k);
+ if(flag)
+ if (flag)
{
- block.onBlockDestroyedByPlayer(world, i, j, k, i1);
+ block.onBlockDestroyedByPlayer(world, i, j, k, i1);
}
return flag;
}
@@ -67,6 +67,7 @@
if(itemstack1.stackSize == 0)
@@ -57,6 +58,7 @@
if (itemstack1.stackSize == 0)
{
entityplayer.inventory.mainInventory[entityplayer.inventory.currentItem] = null;
+ ForgeHooks.onDestroyCurrentItem(entityplayer,itemstack1);
+ ForgeHooks.onDestroyCurrentItem(entityplayer,itemstack1);
}
return true;
} else
}

View file

@ -1,15 +1,17 @@
--- ../src_base/minecraft/net/minecraft/src/PlayerControllerCreative.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/PlayerControllerCreative.java 0000-00-00 00:00:00.000000000 -0000
@@ -58,6 +58,12 @@
@@ -48,6 +48,14 @@
public boolean onPlayerRightClick(EntityPlayer entityplayer, World world, ItemStack itemstack, int i, int j, int k, int l)
{
+ if (itemstack != null) {
+ Item it=itemstack.getItem();
+ if (it.onItemUseFirst(itemstack, entityplayer, world, i, j, k, l)) {
+ return true;
+ }
+ if (itemstack != null)
+ {
+ Item item = itemstack.getItem();
+ if (item.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))
if (i1 > 0 && Block.blocksList[i1].blockActivated(world, i, j, k, entityplayer))
{

View file

@ -1,15 +1,14 @@
--- ../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,8 @@
@@ -1,6 +1,7 @@
package net.minecraft.src;
+import net.minecraft.src.forge.ForgeHooks;
+
import net.minecraft.client.Minecraft;
+import net.minecraft.src.forge.ForgeHooks;
// Referenced classes of package net.minecraft.src:
@@ -68,13 +70,19 @@
public class PlayerControllerMP extends PlayerController
{
@@ -56,13 +57,19 @@
public boolean onPlayerDestroyBlock(int i, int j, int k, int l)
{
@ -19,7 +18,7 @@
+ return false;
+ }
+
if(creativeMode)
if (creativeMode)
{
return super.onPlayerDestroyBlock(i, j, k, l);
}
@ -27,51 +26,58 @@
boolean flag = super.onPlayerDestroyBlock(i, j, k, l);
- ItemStack itemstack = mc.thePlayer.getCurrentEquippedItem();
+
if(itemstack != null)
if (itemstack != null)
{
itemstack.onDestroyBlock(i1, i, j, k, mc.thePlayer);
@@ -103,7 +111,7 @@
@@ -91,7 +98,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)
- 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)
{
onPlayerDestroyBlock(i, j, k, l);
} else
@@ -149,7 +157,7 @@
}
@@ -138,7 +145,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)
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);
@@ -216,6 +224,13 @@
@@ -207,6 +214,16 @@
{
syncCurrentPlayItem();
netClientHandler.addToSendQueue(new Packet15Place(i, j, k, l, entityplayer.inventory.getCurrentItem()));
+
+ if (itemstack != null) {
+ Item it=itemstack.getItem();
+ if (it.onItemUseFirst(itemstack, entityplayer, world, i, j, k, l)) {
+ return true;
+ }
+ if (itemstack != null)
+ {
+ Item item = itemstack.getItem();
+ if (item.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))
if (i1 > 0 && Block.blocksList[i1].blockActivated(world, i, j, k, entityplayer))
{
@@ -235,7 +250,11 @@
return flag;
} else
@@ -227,7 +244,15 @@
}
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;
+ if (!itemstack.useItem(entityplayer, world, i, j, k, l))
+ {
+ return false;
+ }
+ if (itemstack.stackSize == 0)
+ {
+ ForgeHooks.onDestroyCurrentItem(entityplayer, itemstack);
+ }
+ return true;
}
}

View file

@ -1,14 +1,14 @@
--- ../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,7 @@
// Decompiler options: packimports(3) braces deadcode fieldsfirst
@@ -1,6 +1,7 @@
package net.minecraft.src;
+import net.minecraft.src.forge.ForgeHooks;
import net.minecraft.client.Minecraft;
+import net.minecraft.src.forge.ForgeHooks;
@@ -46,11 +47,17 @@
public class PlayerControllerSP extends PlayerController
{
@@ -36,11 +37,16 @@
public boolean onPlayerDestroyBlock(int i, int j, int k, int l)
{
@ -23,52 +23,58 @@
boolean flag = super.onPlayerDestroyBlock(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)
if (itemstack != null)
{
itemstack.onDestroyBlock(i1, i, j, k, mc.thePlayer);
@@ -79,7 +86,7 @@
@@ -69,7 +75,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)
- 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)
{
onPlayerDestroyBlock(i, j, k, l);
}
@@ -110,7 +117,7 @@
@@ -100,7 +106,7 @@
return;
}
Block block = Block.blocksList[i1];
- curBlockDamage += block.blockStrength(mc.thePlayer);
+ curBlockDamage += block.blockStrength(mc.theWorld, mc.thePlayer, i, j, k);
if(blockDestroySoundCounter % 4F == 0.0F && block != null)
if (blockDestroySoundCounter % 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);
@@ -173,6 +180,12 @@
@@ -165,6 +171,14 @@
public boolean onPlayerRightClick(EntityPlayer entityplayer, World world, ItemStack itemstack, int i, int j, int k, int l)
{
+ if (itemstack != null) {
+ Item it=itemstack.getItem();
+ if (it.onItemUseFirst(itemstack, entityplayer, world, i, j, k, l)) {
+ return true;
+ }
+ if (itemstack != null)
+ {
+ Item item = itemstack.getItem();
+ if (item.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))
if (i1 > 0 && Block.blocksList[i1].blockActivated(world, i, j, k, entityplayer))
{
@@ -183,7 +196,11 @@
return false;
} else
@@ -176,7 +190,16 @@
}
else
{
- return itemstack.useItem(entityplayer, world, i, j, k, l);
+ if(!itemstack.useItem(entityplayer, world, i, j, k, l))
+ return false;
+ if (!itemstack.useItem(entityplayer, world, i, j, k, l))
+ {
+ return false;
+ }
+
+ if(itemstack.stackSize == 0)
+ ForgeHooks.onDestroyCurrentItem(entityplayer,itemstack);
+ return true;
+ {
+ ForgeHooks.onDestroyCurrentItem(entityplayer, itemstack);
+ }
+ return true;
}
}

View file

@ -1,32 +1,33 @@
--- ../src_base/minecraft/net/minecraft/src/RailLogic.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/RailLogic.java 0000-00-00 00:00:00.000000000 -0000
@@ -10,7 +10,7 @@
// Referenced classes of package net.minecraft.src:
// World, Block, BlockRail, ChunkPosition
@@ -3,7 +3,7 @@
import java.util.ArrayList;
import java.util.List;
-class RailLogic
+public class RailLogic
{
private World worldObj;
@@ -20,6 +20,7 @@
private int trackX;
@@ -12,6 +12,7 @@
private final boolean isPoweredRail;
private List connectedTracks;
final BlockRail rail; /* synthetic field */
final BlockRail rail;
+ private final boolean canMakeSlopes;
public RailLogic(BlockRail blockrail, World world, int i, int j, int k)
{
@@ -31,15 +32,12 @@
@@ -23,16 +24,12 @@
trackY = j;
trackZ = k;
int l = world.getBlockId(i, j, k);
- int i1 = world.getBlockMetadata(i, j, k);
- if(BlockRail.isPoweredBlockRail((BlockRail)Block.blocksList[l]))
- if (BlockRail.isPoweredBlockRail((BlockRail)Block.blocksList[l]))
- {
- isPoweredRail = true;
- i1 &= -9;
- } else
- }
- else
- {
- isPoweredRail = false;
- }
@ -39,43 +40,43 @@
setConnections(i1);
}
@@ -249,7 +247,7 @@
@@ -243,7 +240,7 @@
byte0 = 9;
}
}
- if(byte0 == 0)
+ if(byte0 == 0 && canMakeSlopes)
- if (byte0 == 0)
+ if (byte0 == 0 && canMakeSlopes)
{
if(BlockRail.isRailBlockAt(worldObj, trackX, trackY + 1, trackZ - 1))
if (BlockRail.isRailBlockAt(worldObj, trackX, trackY + 1, trackZ - 1))
{
@@ -260,7 +258,7 @@
@@ -254,7 +251,7 @@
byte0 = 5;
}
}
- if(byte0 == 1)
+ if(byte0 == 1 && canMakeSlopes)
- if (byte0 == 1)
+ if (byte0 == 1 && canMakeSlopes)
{
if(BlockRail.isRailBlockAt(worldObj, trackX + 1, trackY + 1, trackZ))
if (BlockRail.isRailBlockAt(worldObj, trackX + 1, trackY + 1, trackZ))
{
@@ -381,7 +379,7 @@
@@ -377,7 +374,7 @@
}
}
}
- if(byte0 == 0)
+ if(byte0 == 0 && canMakeSlopes)
- if (byte0 == 0)
+ if (byte0 == 0 && canMakeSlopes)
{
if(BlockRail.isRailBlockAt(worldObj, trackX, trackY + 1, trackZ - 1))
if (BlockRail.isRailBlockAt(worldObj, trackX, trackY + 1, trackZ - 1))
{
@@ -392,7 +390,7 @@
@@ -388,7 +385,7 @@
byte0 = 5;
}
}
- if(byte0 == 1)
+ if(byte0 == 1 && canMakeSlopes)
- if (byte0 == 1)
+ if (byte0 == 1 && canMakeSlopes)
{
if(BlockRail.isRailBlockAt(worldObj, trackX + 1, trackY + 1, trackZ))
if (BlockRail.isRailBlockAt(worldObj, trackX + 1, trackY + 1, trackZ))
{
@@ -433,7 +431,7 @@
@@ -428,7 +425,7 @@
}
}

View file

@ -1,128 +1,128 @@
--- ../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
@@ -1332,7 +1332,7 @@
@@ -1323,7 +1323,7 @@
double d2 = (float)j1 / 256F;
double d3 = ((float)j1 + 15.99F) / 256F;
float f = 1.4F;
- if(!blockAccess.isBlockNormalCube(i, j - 1, k) && !Block.fire.canBlockCatchFire(blockAccess, i, j - 1, k))
+ if(!blockAccess.isBlockNormalCube(i, j - 1, k) && !Block.fire.canBlockCatchFire(blockAccess, i, j - 1, k, 1))
- if (!blockAccess.isBlockNormalCube(i, j - 1, k) && !Block.fire.canBlockCatchFire(blockAccess, i, j - 1, k))
+ if (!blockAccess.isBlockNormalCube(i, j - 1, k) && !Block.fire.canBlockCatchFire(blockAccess, i, j - 1, k, 1))
{
float f1 = 0.2F;
float f2 = 0.0625F;
@@ -1349,7 +1349,7 @@
@@ -1340,7 +1340,7 @@
d1 = d;
d = d4;
}
- if(Block.fire.canBlockCatchFire(blockAccess, i - 1, j, k))
+ if(Block.fire.canBlockCatchFire(blockAccess, i - 1, j, k, 5))
- if (Block.fire.canBlockCatchFire(blockAccess, i - 1, j, k))
+ if (Block.fire.canBlockCatchFire(blockAccess, i - 1, j, k, 5))
{
tessellator.addVertexWithUV((float)i + f1, (float)j + f + f2, k + 1, d1, d2);
tessellator.addVertexWithUV(i + 0, (float)(j + 0) + f2, k + 1, d1, d3);
@@ -1360,7 +1360,7 @@
@@ -1351,7 +1351,7 @@
tessellator.addVertexWithUV(i + 0, (float)(j + 0) + f2, k + 1, d1, d3);
tessellator.addVertexWithUV((float)i + f1, (float)j + f + f2, k + 1, d1, d2);
}
- if(Block.fire.canBlockCatchFire(blockAccess, i + 1, j, k))
+ if(Block.fire.canBlockCatchFire(blockAccess, i + 1, j, k, 4))
- if (Block.fire.canBlockCatchFire(blockAccess, i + 1, j, k))
+ if (Block.fire.canBlockCatchFire(blockAccess, i + 1, j, k, 4))
{
tessellator.addVertexWithUV((float)(i + 1) - f1, (float)j + f + f2, k + 0, d, d2);
tessellator.addVertexWithUV((i + 1) - 0, (float)(j + 0) + f2, k + 0, d, d3);
@@ -1371,7 +1371,7 @@
@@ -1362,7 +1362,7 @@
tessellator.addVertexWithUV((i + 1) - 0, (float)(j + 0) + f2, k + 0, d, d3);
tessellator.addVertexWithUV((float)(i + 1) - f1, (float)j + f + f2, k + 0, d, d2);
}
- if(Block.fire.canBlockCatchFire(blockAccess, i, j, k - 1))
+ if(Block.fire.canBlockCatchFire(blockAccess, i, j, k - 1, 3))
- if (Block.fire.canBlockCatchFire(blockAccess, i, j, k - 1))
+ if (Block.fire.canBlockCatchFire(blockAccess, i, j, k - 1, 3))
{
tessellator.addVertexWithUV(i + 0, (float)j + f + f2, (float)k + f1, d1, d2);
tessellator.addVertexWithUV(i + 0, (float)(j + 0) + f2, k + 0, d1, d3);
@@ -1382,7 +1382,7 @@
@@ -1373,7 +1373,7 @@
tessellator.addVertexWithUV(i + 0, (float)(j + 0) + f2, k + 0, d1, d3);
tessellator.addVertexWithUV(i + 0, (float)j + f + f2, (float)k + f1, d1, d2);
}
- if(Block.fire.canBlockCatchFire(blockAccess, i, j, k + 1))
+ if(Block.fire.canBlockCatchFire(blockAccess, i, j, k + 1, 2))
- if (Block.fire.canBlockCatchFire(blockAccess, i, j, k + 1))
+ if (Block.fire.canBlockCatchFire(blockAccess, i, j, k + 1, 2))
{
tessellator.addVertexWithUV(i + 1, (float)j + f + f2, (float)(k + 1) - f1, d, d2);
tessellator.addVertexWithUV(i + 1, (float)(j + 0) + f2, (k + 1) - 0, d, d3);
@@ -1393,7 +1393,7 @@
@@ -1384,7 +1384,7 @@
tessellator.addVertexWithUV(i + 1, (float)(j + 0) + f2, (k + 1) - 0, d, d3);
tessellator.addVertexWithUV(i + 1, (float)j + f + f2, (float)(k + 1) - f1, d, d2);
}
- if(Block.fire.canBlockCatchFire(blockAccess, i, j + 1, k))
+ if(Block.fire.canBlockCatchFire(blockAccess, i, j + 1, k, 0))
- if (Block.fire.canBlockCatchFire(blockAccess, i, j + 1, k))
+ if (Block.fire.canBlockCatchFire(blockAccess, i, j + 1, k, 0))
{
double d5 = (double)i + 0.5D + 0.5D;
double d7 = ((double)i + 0.5D) - 0.5D;
@@ -3301,7 +3301,7 @@
@@ -3324,7 +3324,7 @@
colorBlueTopRight *= f27;
int k2 = block.getBlockTexture(blockAccess, i, j, k, 2);
renderEastFace(block, i, j, k, k2);
- if(cfgGrassFix && k2 == 3 && overrideBlockTexture < 0)
+ if(Tessellator.instance.defaultTexture && cfgGrassFix && k2 == 3 && overrideBlockTexture < 0)
- if (cfgGrassFix && k2 == 3 && overrideBlockTexture < 0)
+ if (Tessellator.instance.defaultTexture && cfgGrassFix && k2 == 3 && overrideBlockTexture < 0)
{
colorRedTopLeft *= f;
colorRedBottomLeft *= f;
@@ -3412,7 +3412,7 @@
@@ -3440,7 +3440,7 @@
colorBlueTopRight *= f28;
int l2 = block.getBlockTexture(blockAccess, i, j, k, 3);
renderWestFace(block, i, j, k, block.getBlockTexture(blockAccess, i, j, k, 3));
- if(cfgGrassFix && l2 == 3 && overrideBlockTexture < 0)
+ if(Tessellator.instance.defaultTexture && cfgGrassFix && l2 == 3 && overrideBlockTexture < 0)
- if (cfgGrassFix && l2 == 3 && overrideBlockTexture < 0)
+ if (Tessellator.instance.defaultTexture && cfgGrassFix && l2 == 3 && overrideBlockTexture < 0)
{
colorRedTopLeft *= f;
colorRedBottomLeft *= f;
@@ -3523,7 +3523,7 @@
@@ -3556,7 +3556,7 @@
colorBlueTopRight *= f29;
int i3 = block.getBlockTexture(blockAccess, i, j, k, 4);
renderNorthFace(block, i, j, k, i3);
- if(cfgGrassFix && i3 == 3 && overrideBlockTexture < 0)
+ if(Tessellator.instance.defaultTexture && cfgGrassFix && i3 == 3 && overrideBlockTexture < 0)
- if (cfgGrassFix && i3 == 3 && overrideBlockTexture < 0)
+ if (Tessellator.instance.defaultTexture && cfgGrassFix && i3 == 3 && overrideBlockTexture < 0)
{
colorRedTopLeft *= f;
colorRedBottomLeft *= f;
@@ -3634,7 +3634,7 @@
@@ -3672,7 +3672,7 @@
colorBlueTopRight *= f30;
int j3 = block.getBlockTexture(blockAccess, i, j, k, 5);
renderSouthFace(block, i, j, k, j3);
- if(cfgGrassFix && j3 == 3 && overrideBlockTexture < 0)
+ if(Tessellator.instance.defaultTexture && cfgGrassFix && j3 == 3 && overrideBlockTexture < 0)
- if (cfgGrassFix && j3 == 3 && overrideBlockTexture < 0)
+ if (Tessellator.instance.defaultTexture && cfgGrassFix && j3 == 3 && overrideBlockTexture < 0)
{
colorRedTopLeft *= f;
colorRedBottomLeft *= f;
@@ -3727,7 +3727,7 @@
@@ -3765,7 +3765,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)
- 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);
@@ -3740,7 +3740,7 @@
@@ -3778,7 +3778,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)
- 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);
@@ -3753,7 +3753,7 @@
@@ -3791,7 +3791,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)
- 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);
@@ -3766,7 +3766,7 @@
@@ -3804,7 +3804,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)
- 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

@ -1,6 +1,6 @@
--- ../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
@@ -39,7 +39,7 @@
@@ -30,7 +30,7 @@
private GameSettings options;
public boolean clampTexture;
public boolean blurTexture;
@ -9,12 +9,13 @@
private BufferedImage missingTextureImage;
public RenderEngine(TexturePackList texturepacklist, GameSettings gamesettings)
@@ -142,6 +142,9 @@
@@ -135,6 +135,10 @@
}
try
{
+ if(Tessellator.renderingWorldRenderer) {
+ System.out.printf("Warning: Texture %s not preloaded, will cause render glitches!\n",s);
+ if(Tessellator.renderingWorldRenderer)
+ {
+ System.out.printf("Warning: Texture %s not preloaded, will cause render glitches!\n", s);
+ }
singleIntBuffer.clear();
GLAllocation.generateTextureNames(singleIntBuffer);

View file

@ -1,8 +1,8 @@
--- ../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
@@ -34,8 +34,8 @@
@@ -10,8 +10,8 @@
implements IWorldAccess
{
public List tileEntities;
- private World worldObj;
- private RenderEngine renderEngine;
@ -11,7 +11,7 @@
private List worldRenderersToUpdate;
private WorldRenderer sortedWorldRenderers[];
private WorldRenderer worldRenderers[];
@@ -43,8 +43,8 @@
@@ -19,8 +19,8 @@
private int renderChunksTall;
private int renderChunksDeep;
private int glRenderListBase;

View file

@ -1,25 +1,26 @@
--- ../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 @@
@@ -1,6 +1,11 @@
package net.minecraft.src;
import java.util.Random;
+
+import net.minecraft.src.forge.ForgeHooksClient;
+import net.minecraft.src.forge.ICustomItemRenderer;
+import net.minecraft.src.forge.MinecraftForgeClient;
+
import java.util.Random;
import org.lwjgl.opengl.GL11;
@@ -54,10 +58,34 @@
public class RenderItem extends Render
@@ -43,10 +48,33 @@
}
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()))
+
- if (itemstack.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
+ ICustomItemRenderer customRenderer = MinecraftForgeClient.getCustomItemRenderer(itemstack.itemID);
+
+ if (customRenderer != null) {
+ if (customRenderer != null)
+ {
+ GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F);
+ loadTexture(ForgeHooksClient.getTexture("/terrain.png", itemstack.getItem()));
+ float f4 = 0.25F;
@ -35,64 +36,66 @@
+ 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));
+ 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()))
+ }
+ else if (itemstack.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
{
GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F);
- loadTexture("/terrain.png");
+ loadTexture(ForgeHooksClient.getTexture("/terrain.png", Block.blocksList[itemstack.itemID]));
float f4 = 0.25F;
int j = Block.blocksList[itemstack.itemID].getRenderType();
if(j == 1 || j == 19 || j == 12 || j == 2)
@@ -107,10 +135,10 @@
int i = itemstack.getIconIndex();
if(itemstack.itemID < 256)
int k = Block.blocksList[itemstack.itemID].getRenderType();
if (k == 1 || k == 19 || k == 12 || k == 2)
@@ -94,11 +122,11 @@
int j = itemstack.getIconIndex();
if (itemstack.itemID < 256)
{
- loadTexture("/terrain.png");
+ loadTexture(ForgeHooksClient.getTexture("/terrain.png", Block.blocksList[itemstack.itemID]));
} else
+ loadTexture(ForgeHooksClient.getTexture("/terrain.png", Block.blocksList[itemstack.itemID]));
}
else
{
- loadTexture("/gui/items.png");
+ loadTexture(ForgeHooksClient.getTexture("/gui/items.png", Item.itemsList[itemstack.itemID]));
+ loadTexture(ForgeHooksClient.getTexture("/gui/items.png", Item.itemsList[itemstack.itemID]));
}
if(field_27004_a)
if (field_27004_a)
{
@@ -162,10 +190,37 @@
@@ -149,10 +177,39 @@
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()))
- if (i < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[i].getRenderType()))
+ ICustomItemRenderer customRenderer = MinecraftForgeClient.getCustomItemRenderer(i);
+ if (customRenderer != null) {
+ int j1 = i;
+ String tex = ForgeHooksClient.getTexture("/terrain.png", Item.itemsList [i]);
+ renderengine.bindTexture(renderengine.getTexture(tex));
+ Item item = Item.itemsList[i];
+ GL11.glPushMatrix();
+ GL11.glTranslatef(l - 2, i1 + 3, -3F + zLevel);
+ 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()))
+ if (customRenderer != null)
+ {
+ int j1 = i;
+ String tex = ForgeHooksClient.getTexture("/terrain.png", Item.itemsList[i]);
+ renderengine.bindTexture(renderengine.getTexture(tex));
+ Item item = Item.itemsList[i];
+ GL11.glPushMatrix();
+ GL11.glTranslatef(l - 2, i1 + 3, -3F + zLevel);
+ 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, 0);
+ 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"));
@ -101,18 +104,20 @@
Block block = Block.blocksList[j1];
GL11.glPushMatrix();
GL11.glTranslatef(l - 2, i1 + 3, -3F + zLevel);
@@ -214,10 +269,12 @@
@@ -200,11 +257,13 @@
GL11.glDisable(2896 /*GL_LIGHTING*/);
if(i < 256)
if (i < 256)
{
- renderengine.bindTexture(renderengine.getTexture("/terrain.png"));
- }
+ String tex = ForgeHooksClient.getTexture("/terrain.png", Block.blocksList[i]);
+ renderengine.bindTexture(renderengine.getTexture(tex));
} else
+ }
else
{
- renderengine.bindTexture(renderengine.getTexture("/gui/items.png"));
+ String tex = ForgeHooksClient.getTexture("/gui/items.png", Item.itemsList[i]);
+ renderengine.bindTexture(renderengine.getTexture(tex));
}
int k1 = Item.itemsList[i].getColorFromDamage(j);
float f = (float)(k1 >> 16 & 0xff) / 255F;
int l1 = Item.itemsList[i].getColorFromDamage(j, 0);
float f = (float)(l1 >> 16 & 0xff) / 255F;

View file

@ -1,19 +1,19 @@
--- ../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 @@
@@ -2,6 +2,7 @@
package net.minecraft.src;
+import net.minecraft.src.forge.IArmorTextureProvider;
import net.minecraft.client.Minecraft;
import org.lwjgl.opengl.GL11;
+import net.minecraft.src.forge.IArmorTextureProvider;
@@ -41,7 +42,14 @@
if(item instanceof ItemArmor)
public class RenderPlayer extends RenderLiving
{
@@ -30,7 +31,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 )
+ if (item instanceof IArmorTextureProvider)
+ {
+ loadTexture( ((IArmorTextureProvider)item).getArmorTextureFile(itemstack) );
+ }

View file

@ -1,18 +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 fieldsfirst
@@ -1,5 +1,7 @@
package net.minecraft.src;
+import net.minecraft.src.forge.ForgeHooks;
// Referenced classes of package net.minecraft.src:
@@ -71,6 +72,7 @@
+
public class SlotCrafting extends Slot
{
private final IInventory craftMatrix;
@@ -61,6 +63,7 @@
thePlayer.addStat(AchievementList.bookcase, 1);
}
ModLoader.TakenFromCrafting(thePlayer, itemstack, craftMatrix);
+ ForgeHooks.onTakenFromCrafting(thePlayer, itemstack, craftMatrix);
for(int i = 0; i < craftMatrix.getSizeInventory(); i++)
for (int i = 0; i < craftMatrix.getSizeInventory(); i++)
{
ItemStack itemstack1 = craftMatrix.getStackInSlot(i);

View file

@ -1,18 +1,14 @@
--- ../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 @@
@@ -1,16 +1,14 @@
package net.minecraft.src;
import java.nio.*;
+import java.util.*;
import org.lwjgl.opengl.*;
// Referenced classes of package net.minecraft.src:
@@ -12,13 +13,9 @@
public class Tessellator
{
-
private static boolean convertQuadsToTriangles = false;
private static boolean tryVBO = false;
- private ByteBuffer byteBuffer;
@ -23,7 +19,7 @@
private int rawBuffer[];
private int vertexCount;
private double textureU;
@@ -32,21 +29,47 @@
@@ -24,21 +22,47 @@
private int rawBufferIndex;
private int addedVertices;
private boolean isColorDisabled;
@ -59,11 +55,11 @@
+ public static Tessellator instance;
+
+ static {
+ instance=new Tessellator();
+ instance.defaultTexture=true;
+ instance = new Tessellator();
+ instance.defaultTexture = true;
+
+ nativeBufferSize = 0x200000;
+ trivertsInBuffer = (nativeBufferSize/48)*6;
+ trivertsInBuffer = (nativeBufferSize / 48) * 6;
+ byteBuffer = GLAllocation.createDirectByteBuffer(nativeBufferSize * 4);
+ intBuffer = byteBuffer.asIntBuffer();
+ floatBuffer = byteBuffer.asFloatBuffer();
@ -83,7 +79,7 @@
vertexCount = 0;
hasColor = false;
hasTexture = false;
@@ -56,21 +79,10 @@
@@ -48,21 +72,9 @@
addedVertices = 0;
isColorDisabled = false;
isDrawing = false;
@ -97,87 +93,96 @@
- shortBuffer = byteBuffer.asShortBuffer();
- rawBuffer = new int[i];
- useVBO = tryVBO && GLContext.getCapabilities().GL_ARB_vertex_buffer_object;
- if(useVBO)
- if (useVBO)
- {
- vertexBuffers = GLAllocation.createDirectIntBuffer(vboCount);
- ARBVertexBufferObject.glGenBuffersARB(vertexBuffers);
- }
+
+ rawBuffer=null;
+ rawBufferSize=0;
+ rawBuffer = null;
+ rawBufferSize = 0;
}
public int draw()
@@ -80,12 +92,20 @@
@@ -72,12 +84,25 @@
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);
- 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);
+ intBuffer.put(rawBuffer, offs * 8, vtc * 8);
byteBuffer.position(0);
- byteBuffer.limit(rawBufferIndex * 4);
+ byteBuffer.limit(vtc*32);
+ offs+=vtc;
if(useVBO)
+ byteBuffer.limit(vtc * 32);
+ offs += vtc;
+
if (useVBO)
{
vboIndex = (vboIndex + 1) % vboCount;
@@ -153,10 +173,10 @@
@@ -150,11 +175,11 @@
GL11.glEnableClientState(32884 /*GL_VERTEX_ARRAY_EXT*/);
if(drawMode == 7 && convertQuadsToTriangles)
if (drawMode == 7 && convertQuadsToTriangles)
{
- GL11.glDrawArrays(4, 0, vertexCount);
+ GL11.glDrawArrays(4, 0, vtc);
} else
+ GL11.glDrawArrays(4, 0, vtc);
}
else
{
- GL11.glDrawArrays(drawMode, 0, vertexCount);
+ GL11.glDrawArrays(drawMode, 0, vtc);
+ GL11.glDrawArrays(drawMode, 0, vtc);
}
GL11.glDisableClientState(32884 /*GL_VERTEX_ARRAY_EXT*/);
if(hasTexture)
@@ -178,6 +198,10 @@
if (hasTexture)
@@ -176,6 +201,11 @@
GL11.glDisableClientState(32885 /*GL_NORMAL_ARRAY_EXT*/);
}
}
+ if (rawBufferSize > 0x20000 && rawBufferIndex < (rawBufferSize<<3)) {
+ rawBufferSize=0;
+ rawBuffer=null;
+ if (rawBufferSize > 0x20000 && rawBufferIndex < (rawBufferSize << 3))
+ {
+ rawBufferSize = 0;
+ rawBuffer = null;
+ }
int i = rawBufferIndex * 4;
reset();
return i;
@@ -299,6 +323,15 @@
@@ -299,6 +329,19 @@
public void addVertex(double d, double d1, double d2)
{
+ if (rawBufferIndex >= rawBufferSize-32) {
+ if (rawBufferSize == 0) {
+ if (rawBufferIndex >= rawBufferSize - 32)
+ {
+ if (rawBufferSize == 0)
+ {
+ rawBufferSize = 0x10000;
+ rawBuffer = new int[rawBufferSize];
+ } else {
+ }
+ else
+ {
+ rawBufferSize *= 2;
+ rawBuffer = Arrays.copyOf(rawBuffer, rawBufferSize);
+ }
+ }
addedVertices++;
if(drawMode == 7 && convertQuadsToTriangles && addedVertices % 4 == 0)
if (drawMode == 7 && convertQuadsToTriangles && addedVertices % 4 == 0)
{
@@ -348,11 +381,6 @@
@@ -347,11 +390,6 @@
rawBuffer[rawBufferIndex + 2] = Float.floatToRawIntBits((float)(d2 + zOffset));
rawBufferIndex += 8;
vertexCount++;
- if(vertexCount % 4 == 0 && rawBufferIndex >= bufferSize - 32)
- if (vertexCount % 4 == 0 && rawBufferIndex >= bufferSize - 32)
- {
- draw();
- isDrawing = true;

View file

@ -1,13 +1,15 @@
--- ../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
@@ -72,6 +72,13 @@
@@ -63,6 +63,15 @@
{
}
+ /* FORGE: Return false if this TileEntity does not require updateEntity()
+ * calls.
+ /**
+ * Determines if this TileEntity requires update calls.
+ * @return True if you want updateEntity() to be called, false if not
+ */
+ public boolean canUpdate() {
+ public boolean canUpdate()
+ {
+ return true;
+ }
+

View file

@ -1,35 +1,30 @@
--- ../src_base/minecraft/net/minecraft/src/TileEntityBrewingStand.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/TileEntityBrewingStand.java 0000-00-00 00:00:00.000000000 -0000
@@ -4,6 +4,8 @@
@@ -1,7 +1,9 @@
package net.minecraft.src;
+import net.minecraft.src.forge.ISidedInventory;
+
// Referenced classes of package net.minecraft.src:
// TileEntity, IInventory, ItemStack, World,
@@ -11,7 +13,7 @@
// NBTTagList, EntityPlayer
public class TileEntityBrewingStand extends TileEntity
- implements IInventory
+ implements IInventory, ISidedInventory
{
private ItemStack brewingItemStacks[];
@@ -280,4 +282,14 @@
private int brewTime;
@@ -273,4 +275,16 @@
return i;
}
+
+ @Override
+ public int getStartInventorySide(int side) {
+ public int getStartInventorySide(int side)
+ {
+ return (side == 1 ? 3 : 0);
+ }
+
+ @Override
+ public int getSizeInventorySide(int side) {
+ public int getSizeInventorySide(int side)
+ {
+ return (side == 1 ? 1 : 3);
+ }
}

View file

@ -1,86 +1,84 @@
--- ../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 @@
@@ -1,7 +1,9 @@
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
{
private ItemStack furnaceItemStacks[];
@@ -33,6 +34,16 @@
public int furnaceBurnTime;
@@ -21,6 +23,20 @@
return furnaceItemStacks.length;
}
+ public int getStartInventorySide(int side) {
+ if(side==0) return 1;
+ if(side==1) return 0;
+ @Override
+ public int getStartInventorySide(int side)
+ {
+ if (side == 0) return 1;
+ if (side == 1) return 0;
+ return 2;
+ }
+
+ public int getSizeInventorySide(int side) {
+ @Override
+ public int getSizeInventorySide(int side)
+ {
+ return 1;
+ }
+
public ItemStack getStackInSlot(int i)
{
return furnaceItemStacks[i];
@@ -201,7 +212,7 @@
@@ -192,7 +208,7 @@
{
return false;
}
- ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0].getItem().shiftedIndex);
+ ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0]);
if(itemstack == null)
if (itemstack == null)
{
return false;
@@ -214,11 +225,8 @@
@@ -205,11 +221,8 @@
{
return false;
}
- if(furnaceItemStacks[2].stackSize < getInventoryStackLimit() && furnaceItemStacks[2].stackSize < furnaceItemStacks[2].getMaxStackSize())
- 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());
+ int result = furnaceItemStacks[2].stackSize + itemstack.stackSize;
+ return (result <= getInventoryStackLimit() && result <= itemstack.getMaxStackSize());
}
public void smeltItem()
@@ -227,14 +235,14 @@
@@ -218,14 +231,14 @@
{
return;
}
- ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0].getItem().shiftedIndex);
+ ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0]);
if(furnaceItemStacks[2] == null)
if (furnaceItemStacks[2] == null)
{
furnaceItemStacks[2] = itemstack.copy();
} else
- if(furnaceItemStacks[2].itemID == itemstack.itemID)
+ if(furnaceItemStacks[2].isItemEqual(itemstack))
}
- else if (furnaceItemStacks[2].itemID == itemstack.itemID)
+ else if (furnaceItemStacks[2].equals(itemstack))
{
- furnaceItemStacks[2].stackSize++;
+ furnaceItemStacks[2].stackSize += itemstack.stackSize;
}
if(furnaceItemStacks[0].getItem().hasContainerItem())
if (furnaceItemStacks[0].getItem().func_46056_k())
{
@@ -249,7 +257,7 @@
@@ -241,7 +254,7 @@
}
}
- private int getItemBurnTime(ItemStack itemstack)
+ public static int getItemBurnTime(ItemStack itemstack)
{
if(itemstack == null)
if (itemstack == null)
{

View file

@ -1,26 +1,27 @@
--- ../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 @@
@@ -1,6 +1,8 @@
package net.minecraft.src;
+import net.minecraft.src.forge.ForgeHooksClient;
import net.minecraft.client.Minecraft;
+import net.minecraft.src.forge.ForgeHooksClient;
+
import org.lwjgl.opengl.GL11;
@@ -40,6 +41,7 @@
public class TileEntityRendererPiston extends TileEntitySpecialRenderer
@@ -31,6 +33,7 @@
{
GL11.glShadeModel(7424 /*GL_FLAT*/);
}
+ ForgeHooksClient.beforeBlockRender(block,field_31071_b);
+ 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);
@@ -60,6 +62,7 @@
@@ -52,6 +55,7 @@
}
tessellator.setTranslationD(0.0D, 0.0D, 0.0D);
tessellator.draw();
+ ForgeHooksClient.afterBlockRender(block,field_31071_b);
+ ForgeHooksClient.afterBlockRender(block, field_31071_b);
RenderHelper.enableStandardItemLighting();
}
}

View file

@ -1,6 +1,6 @@
--- ../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
@@ -51,7 +51,7 @@
@@ -33,7 +33,7 @@
public int lightningFlash;
public boolean editingBlocks;
private long lockTimestamp;
@ -9,112 +9,123 @@
public int difficultySetting;
public Random rand;
public boolean isNewWorld;
@@ -406,7 +406,10 @@
@@ -399,7 +399,12 @@
public boolean isAirBlock(int i, int j, int k)
{
- return getBlockId(i, j, k) == 0;
+ int iBlockID = getBlockId( i, j, k );
+ if ( iBlockID == 0 )
+ int iBlockID = getBlockId(i, j, k);
+ if (iBlockID == 0)
+ {
+ return true;
+ return Block.blocksList[iBlockID].isAirBlock(this,i,j,k);
+ }
+ return Block.blocksList[iBlockID].isAirBlock(this, i, j, k);
}
public boolean blockExists(int i, int j, int k)
@@ -1576,7 +1579,7 @@
@@ -1576,7 +1581,7 @@
Chunk chunk = getChunkFromChunkCoords(tileentity.xCoord >> 4, tileentity.zCoord >> 4);
if(chunk != null)
if (chunk != null)
{
- chunk.removeChunkBlockTileEntity(tileentity.xCoord & 0xf, tileentity.yCoord, tileentity.zCoord & 0xf);
+ chunk.cleanChunkBlockTileEntity(tileentity.xCoord & 0xf, tileentity.yCoord, tileentity.zCoord & 0xf);
}
}
}
@@ -1604,16 +1607,16 @@
@@ -1605,15 +1610,17 @@
{
loadedTileEntityList.add(tileentity1);
}
+ } else {
if(chunkExists(tileentity1.xCoord >> 4, tileentity1.zCoord >> 4))
+ }
+ else
+ {
if (chunkExists(tileentity1.xCoord >> 4, tileentity1.zCoord >> 4))
{
Chunk chunk1 = getChunkFromChunkCoords(tileentity1.xCoord >> 4, tileentity1.zCoord >> 4);
if(chunk1 != null)
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();
}
@@ -1623,13 +1626,17 @@
}
}
while (true);
@@ -1625,14 +1632,14 @@
public void addTileEntity(Collection collection)
{
- if(scanningTileEntities)
- if (scanningTileEntities)
- {
- addedTileEntityList.addAll(collection);
- } else
- }
- else
- {
- loadedTileEntityList.addAll(collection);
- }
+ List dest=scanningTileEntities ? addedTileEntityList : loadedTileEntityList;
+ for(Object ob : collection) {
+ TileEntity te = (TileEntity)ob;
+ if(te.canUpdate()) dest.add(te);
+ List dest = scanningTileEntities ? addedTileEntityList : loadedTileEntityList;
+ for(Object entity : collection)
+ {
+ if(((TileEntity)entity).canUpdate())
+ {
+ dest.add(entity);
+ }
+ }
+ }
+
+ /* 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)
@@ -1789,7 +1796,10 @@
if(j2 == Block.fire.blockID || j2 == Block.lavaMoving.blockID || j2 == Block.lavaStill.blockID)
@@ -1793,7 +1800,14 @@
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))
+ }
+ else
+ {
+ if(j2 > 0 && Block.blocksList[j2].isBlockBurning(this, k1, l1, i2))
+ {
+ return true;
+ }
+ }
}
}
@@ -2044,46 +2054,22 @@
}
@@ -2038,48 +2052,29 @@
public void setBlockTileEntity(int i, int j, int k, TileEntity tileentity)
{
- if(tileentity != null && !tileentity.isInvalid())
- if (tileentity != null && !tileentity.isInvalid())
- {
- if(scanningTileEntities)
- if (scanningTileEntities)
- {
- tileentity.xCoord = i;
- tileentity.yCoord = j;
- tileentity.zCoord = k;
- addedTileEntityList.add(tileentity);
- } else
- }
- else
- {
- loadedTileEntityList.add(tileentity);
- Chunk chunk = getChunkFromChunkCoords(i >> 4, k >> 4);
- if(chunk != null)
- if (chunk != null)
- {
- chunk.setChunkBlockTileEntity(i & 0xf, j, k & 0xf, tileentity);
- }
- }
- }
+ if(tileentity==null || tileentity.isInvalid())
+ if (tileentity == null || tileentity.isInvalid())
+ {
+ return;
+ List dest=scanningTileEntities ? addedTileEntityList : loadedTileEntityList;
+ if(tileentity.canUpdate()) dest.add(tileentity);
+ }
+ List dest = scanningTileEntities ? addedTileEntityList : loadedTileEntityList;
+ if (tileentity.canUpdate())
+ {
+ dest.add(tileentity);
+ }
+ Chunk chunk = getChunkFromChunkCoords(i >> 4, k >> 4);
+ if(chunk != null) {
+ if (chunk != null)
+ {
+ chunk.setChunkBlockTileEntity(i & 0xf, j, k & 0xf, tileentity);
+ }
}
@ -122,70 +133,98 @@
public void removeBlockTileEntity(int i, int j, int k)
{
- TileEntity tileentity = getBlockTileEntity(i, j, k);
- if(tileentity != null && scanningTileEntities)
- if (tileentity != null && scanningTileEntities)
- {
- tileentity.invalidate();
- addedTileEntityList.remove(tileentity);
- } else
- }
- else
- {
- if(tileentity != null)
- if (tileentity != null)
- {
- addedTileEntityList.remove(tileentity);
- loadedTileEntityList.remove(tileentity);
- }
- Chunk chunk = getChunkFromChunkCoords(i >> 4, k >> 4);
- if(chunk != null)
- if (chunk != null)
- {
- chunk.removeChunkBlockTileEntity(i & 0xf, j, k & 0xf);
- }
- }
+ Chunk chunk = getChunkFromChunkCoords(i >> 4, k >> 4);
+ if(chunk != null) {
+ if (chunk != null)
+ {
+ chunk.removeChunkBlockTileEntity(i & 0xf, j, k & 0xf);
+ }
}
public void markEntityForDespawn(TileEntity tileentity)
@@ -2106,13 +2092,18 @@
public boolean isBlockNormalCube(int i, int j, int k)
{
Block block = Block.blocksList[getBlockId(i, j, k)];
- if(block == null)
- {
- return false;
- } else
- {
@@ -2109,7 +2104,7 @@
}
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);
+ return block.isBlockNormalCube(this, i, j, k);
}
}
public boolean func_41082_b(int i, int j, int k, boolean flag)
@@ -2531,7 +2522,7 @@
@@ -2535,7 +2530,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 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;
@@ -2940,6 +2931,7 @@
@@ -2945,6 +2940,10 @@
{
block = null;
}
+ if (block != null && block.isBlockReplaceable(this,j,k,l)) 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);
}
@@ -3493,4 +3492,39 @@
{
return worldInfo.func_46133_t() != EnumWorldType.FLAT ? 63D : 0.0D;
}
+
+
+ /**
+ * Adds a single TileEntity to the world.
+ * TODO: Eloraam fully describe the bug this fixes.
+ * @param entity The TileEntity to be added.
+ */
+ public void addTileEntity(TileEntity entity)
+ {
+ List dest = scanningTileEntities ? addedTileEntityList : loadedTileEntityList;
+ if(entity.canUpdate())
+ {
+ dest.add(entity);
+ }
+ }
+
+ /**
+ * Determine if the given block is considered solid on the
+ * specified side. Used by placement logic.
+ *
+ * @param X Block X Position
+ * @param Y Block Y Position
+ * @param Z Block Z Position
+ * @param side The Side in question
+ * @return True if the side is solid
+ */
+ public boolean isBlockSolidOnSide(int X, int Y, int Z, int side)
+ {
+ Block block = Block.blocksList[getBlockId(X, Y, Z)];
+ if(block == null)
+ {
+ return false;
+ }
+ return block.isBlockSolidOnSide(this, X, Y, Z, side);
+ }
}

View file

@ -1,34 +1,34 @@
--- ../src_base/minecraft/net/minecraft/src/WorldGenDungeons.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/WorldGenDungeons.java 0000-00-00 00:00:00.000000000 -0000
@@ -7,6 +7,8 @@
@@ -3,6 +3,8 @@
import java.io.PrintStream;
import java.util.Random;
+import net.minecraft.src.forge.MinecraftForge;
+
// Referenced classes of package net.minecraft.src:
// WorldGenerator, World, Material, Block,
// TileEntityChest, TileEntityMobSpawner, ItemStack, Item
@@ -129,11 +131,11 @@
public class WorldGenDungeons extends WorldGenerator
{
public WorldGenDungeons()
@@ -118,11 +120,11 @@
int k4 = 0;
do
{
- if(k4 >= 8)
+ if(k4 >= MinecraftForge.getDungeonLootTries())
- if (k4 >= 8)
+ if (k4 >= MinecraftForge.getDungeonLootTries())
{
break label0;
}
- ItemStack itemstack = pickCheckLootItem(random);
+ ItemStack itemstack = MinecraftForge.getRandomDungeonLoot(random);
if(itemstack != null)
if (itemstack != null)
{
tileentitychest.setInventorySlotContents(random.nextInt(tileentitychest.getSizeInventory()), itemstack);
@@ -148,7 +150,7 @@
@@ -137,7 +139,7 @@
TileEntityMobSpawner tileentitymobspawner = (TileEntityMobSpawner)world.getBlockTileEntity(i, j, k);
if(tileentitymobspawner != null)
if (tileentitymobspawner != null)
{
- tileentitymobspawner.setMobID(pickMobSpawner(random));
+ tileentitymobspawner.setMobID(MinecraftForge.getRandomDungeonMob(random));
} else
+ tileentitymobspawner.setMobID(MinecraftForge.getRandomDungeonMob(random));
}
else
{
System.err.println((new StringBuilder()).append("Failed to fetch mob spawner entity at (").append(i).append(", ").append(j).append(", ").append(k).append(")").toString());

View file

@ -1,23 +1,23 @@
--- ../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 @@
@@ -1,13 +1,15 @@
package net.minecraft.src;
import java.util.*;
+
+import net.minecraft.src.forge.ForgeHooksClient;
+
import java.util.*;
import org.lwjgl.opengl.GL11;
@@ -18,7 +20,6 @@
public class WorldRenderer
{
public World worldObj;
private int glRenderList;
- private static Tessellator tessellator;
public static int chunksUpdated = 0;
public int posX;
public int posY;
@@ -160,10 +161,11 @@
@@ -150,10 +152,11 @@
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);
@ -27,53 +27,53 @@
+ Tessellator.instance.startDrawingQuads();
+ Tessellator.instance.setTranslationD(-posX, -posY, -posZ);
}
- if(i2 == 0 && Block.isBlockContainer[i3])
+ if(i2 == 0 && Block.blocksList[i3] != null && Block.blocksList[i3].hasTileEntity(chunkcache.getBlockMetadata(l2, j2, k2)))
- if (i2 == 0 && Block.isBlockContainer[i3])
+ if (i2 == 0 && Block.blocksList[i3] != null && Block.blocksList[i3].hasTileEntity(chunkcache.getBlockMetadata(l2, j2, k2)))
{
TileEntity tileentity = chunkcache.getBlockTileEntity(l2, j2, k2);
if(TileEntityRenderer.instance.hasSpecialRenderer(tileentity))
@@ -177,15 +179,13 @@
if (TileEntityRenderer.instance.hasSpecialRenderer(tileentity))
@@ -167,25 +170,29 @@
{
flag1 = true;
}
- if(j3 != i2)
- {
- flag = true;
- if (j3 != i2)
+ if (j3 > i2)
{
flag = true;
- continue;
- }
- if(j3 == i2)
- {
}
- if (j3 == i2)
+ if(!ForgeHooksClient.canRenderInPass(block, 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);
}
+
+ ForgeHooksClient.beforeBlockRender(block, renderblocks);
+ flag1 |= renderblocks.renderBlockByRenderType(block, l2, j2, k2);
+ ForgeHooksClient.afterBlockRender(block, renderblocks);
}
}
@@ -194,10 +194,11 @@
}
if(flag2)
if (flag2)
{
- bytesDrawn += tessellator.draw();
+ ForgeHooksClient.afterRenderPass(i2);
+ ForgeHooksClient.afterRenderPass(i2);
+ bytesDrawn += 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
}
else
{
flag1 = false;
@@ -288,8 +289,4 @@
@@ -279,9 +286,4 @@
{
needsUpdate = true;
}
- static
-
- static
- {
- tessellator = Tessellator.instance;
- }

View file

@ -1,182 +1,126 @@
--- ../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 fieldsfirst
package net.minecraft.src;
+import net.minecraft.src.forge.ForgeHooks;
@@ -3,6 +3,8 @@
import java.util.ArrayList;
import java.util.Random;
@@ -384,26 +385,71 @@
return 1;
+import net.minecraft.src.forge.ForgeHooks;
+
public class Block
{
public static final StepSound soundPowderFootstep;
@@ -344,6 +346,12 @@
{
}
+ /* FORGE: Metadata-sensitive version.
+ */
+ public int quantityDropped(int meta, int fortune, Random random)
+ {
+ return quantityDroppedWithBonus(fortune, random);
+ }
+
+ /* FORGE: Metadata-sensitive version.
+ *
+ * This is deprecated in MC 1.0+ versions because of the new Enchantment
+ * system requiring a new argument. Will be removed unless a valid reason
+ * for it to remain is brought to light.
+ *
+ * Implementing this in your mod will not do anything!
+ /**
+ * Deprecated in favor of a metadata sensitive version
+ * @param entityplayer Entity attacking the block
+ * @return
+ */
+ @Deprecated
+ public int quantityDropped(int meta, Random random)
+ {
+ return quantityDropped(meta, 0, random);
+ }
+
public int idDropped(int i, Random random, int j)
public int quantityDropped(Random random)
{
return blockID;
}
-
+
+ /* FORGE: This function isnt called by Minecraft anymore. Use
+ * blockStrength(EntityPlayer,int) instead.
+ */
return 1;
@@ -356,18 +364,7 @@
public float blockStrength(EntityPlayer entityplayer)
{
- if(blockHardness < 0.0F)
- if (blockHardness < 0.0F)
- {
- return 0.0F;
- }
- if(!entityplayer.canHarvestBlock(this))
- if (!entityplayer.canHarvestBlock(this))
- {
- return 1.0F / blockHardness / 100F;
- } else
- }
- else
- {
- return entityplayer.getCurrentPlayerStrVsBlock(this) / blockHardness / 30F;
- }
+ return blockStrength(entityplayer);
+ 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, int fortune) {
+
+ ArrayList<ItemStack> tr = new ArrayList<ItemStack>();
+
+ int q = quantityDropped(md, fortune, world.rand);
+ for(int n = 0; n < q; n++) {
+ int id = idDropped(md, world.rand, 0);
+ if (id > 0) {
+ tr.add(new ItemStack(id, 1, damageDropped(md)));
+ }
+ }
+ return tr;
+ }
+
+ /* FORGE: This function returns the complete list of drops for a block.
+ *
+ * This is deprecated in MC 1.0+ versions because of the new Enchantment
+ * system requiring a new argument. Will be removed unless a valid reason
+ * for it to remain is brought to light.
+ *
+ * Implementing this in your mod will not do anything!
+ */
+ @Deprecated
+ public ArrayList<ItemStack> getBlockDropped(World world,
+ int i, int j, int k, int md) {
+ return getBlockDropped (world, i, j, k, md, 0);
+ }
+
public final void dropBlockAsItem(World world, int i, int j, int k, int l, int i1)
{
dropBlockAsItemWithChance(world, i, j, k, l, 1.0F, i1);
@@ -415,18 +461,14 @@
@@ -381,18 +378,14 @@
{
return;
}
- int j1 = quantityDroppedWithBonus(i1, world.rand);
- for(int k1 = 0; k1 < j1; k1++)
+ ArrayList<ItemStack> ar = getBlockDropped(world, i, j, k, l, i1);
+ for (ItemStack ist : ar)
- for (int k1 = 0; k1 < j1; k1++)
+ ArrayList<ItemStack> items = getBlockDropped(world, i, j, k, l, i1);
+ for(ItemStack item : items)
{
if(world.rand.nextFloat() > f)
if (world.rand.nextFloat() > f)
{
continue;
}
- int l1 = idDropped(l, world.rand, i1);
- if(l1 > 0)
- if (l1 > 0)
- {
- dropBlockAsItem_do(world, i, j, k, new ItemStack(l1, 1, damageDropped(l)));
- }
+ dropBlockAsItem_do(world, i, j, k, ist);
+ dropBlockAsItem_do(world, i, j, k, item);
}
}
@@ -651,7 +693,7 @@
@@ -620,7 +613,7 @@
{
entityplayer.addStat(StatList.mineBlockStatArray[blockID], 1);
entityplayer.addExhaustion(0.025F);
- if(renderAsNormalBlock() && !isBlockContainer[blockID] && EnchantmentHelper.getSilkTouchModifier(entityplayer.inventory))
+ if(renderAsNormalBlock() && !hasTileEntity(l) && EnchantmentHelper.getSilkTouchModifier(entityplayer.inventory))
- if (renderAsNormalBlock() && !isBlockContainer[blockID] && EnchantmentHelper.getSilkTouchModifier(entityplayer.inventory))
+ if (renderAsNormalBlock() && !hasTileEntity(l) && EnchantmentHelper.getSilkTouchModifier(entityplayer.inventory))
{
ItemStack itemstack = createStackedBlock(l);
if(itemstack != null)
@@ -725,6 +767,246 @@
return blockMaterial.getMaterialMobility();
if (itemstack != null)
@@ -699,6 +692,278 @@
{
}
+ /* FORGE: Allow a block to set illumination on a coordinate basis.
+ */
+ public int getLightValue(IBlockAccess iba, int i, int j, int k) {
+ 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.
+ *
+ * This is deprecated in favor of the more flexible version below.
+ */
+ @Deprecated
+ public boolean isLadder() {
+ return false;
+ }
+
+ /* FORGE: Implement and return true if you wish this block to behave
+ * like a ladder when the player is inside.
+ */
+ public boolean isLadder(World world, int i, int j, int k) {
+ return isLadder();
+ public boolean isLadder(World world, int i, int j, int k)
+ {
+ 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) {
+ 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);
+ 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 ) {
+ 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 ) {
+ public boolean isBlockBurning(World world, int i, int j, int k)
+ {
+ return false;
+ }
+
@ -185,30 +129,32 @@
+ * 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 ) {
+ 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) {
+ 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);
+ public float blockStrength(World world, EntityPlayer player, int i, int j, int k)
+ {
+ return blockStrength(player, world.getBlockMetadata(i, j, k));
+ }
+
+ /* 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);
+ 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
@ -226,8 +172,8 @@
+ * Note: When used in multiplayer, this is called on both client and
+ * server sides!
+ */
+ public boolean removeBlockByPlayer(World world, EntityPlayer player,
+ int i, int j, int k) {
+ public boolean removeBlockByPlayer(World world, EntityPlayer player, int i, int j, int k)
+ {
+ return world.setBlockWithNotify(i, j, k, 0);
+ }
+
@ -341,14 +287,8 @@
+ */
+ public boolean hasTileEntity(int metadata)
+ {
+ if (isBlockContainer[blockID])
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ return (isBlockContainer[blockID]);
+
+ }
+
+ /**
@ -367,6 +307,47 @@
+ }
+ return null;
+ }
+
+ /**
+ * Metadata and fortune sensitive version, this replaces the old (int meta, Random rand)
+ * version in 1.1.
+ *
+ * @param meta Blocks Metadata
+ * @param fortune Current item fortune level
+ * @param random Random number generator
+ * @return The number of items to drop
+ */
+ public int quantityDropped(int meta, int fortune, Random random)
+ {
+ return quantityDroppedWithBonus(fortune, random);
+ }
+
+ /**
+ * This returns a complete list of items dropped from this block.
+ *
+ * @param world The current world
+ * @param X X Position
+ * @param Y Y Position
+ * @param Z Z Position
+ * @param metadata Current metadata
+ * @param fortune Breakers fortune level
+ * @return A ArrayList containing all items this block drops
+ */
+ public ArrayList<ItemStack> getBlockDropped(World world, int X, int Y, int Z, int metadata, int fortune)
+ {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+
+ int count = quantityDropped(metadata, fortune, world.rand);
+ for(int i = 0; i < count; i++)
+ {
+ int id = idDropped(metadata, world.rand, 0);
+ if (id > 0)
+ {
+ ret.add(new ItemStack(id, 1, damageDropped(metadata)));
+ }
+ }
+ return ret;
+ }
+
static Class _mthclass$(String s)
{

View file

@ -1,119 +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 @@
@@ -32,36 +32,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))
- 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))
- 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))
- 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);
+ 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))
- 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))
- 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))
- 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);
+ 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 @@
@@ -69,19 +69,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))
- 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))
}
- else if (l == 3 && world.isBlockNormalCube(i, j, k - 1))
+ else 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))
}
- else if (l == 4 && world.isBlockNormalCube(i + 1, j, k))
+ else 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))
}
- else if (l == 5 && world.isBlockNormalCube(i - 1, j, k))
+ else if (l == 5 && world.isBlockSolidOnSide(i - 1, j, k, 5))
{
i1 = 1;
} else
@@ -102,19 +102,19 @@
}
@@ -94,19 +94,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))
- 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))
- 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))
- 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;
+ 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 @@
@@ -115,19 +115,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)
- 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)
- 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)
- 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)
- if (!world.isBlockNormalCube(i, j, k + 1) && i1 == 4)
+ if (!world.isBlockSolidOnSide(i, j, k + 1, 2) && i1 == 4)
{
flag = true;
}

View file

@ -1,31 +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
@@ -339,23 +339,23 @@
@@ -334,23 +334,23 @@
{
return true;
}
- if(world.isBlockNormalCube(i, j + 1, k))
+ if(world.isBlockSolidOnSide(i, j + 1, k,0))
- 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))
- 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))
- 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))
- 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))
- 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

@ -1,6 +1,6 @@
--- ../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 @@
@@ -17,7 +17,7 @@
public void onBlockAdded(World world, int i, int j, int k)
{
super.onBlockAdded(world, i, j, k);
@ -9,7 +9,7 @@
}
public void onBlockRemoval(World world, int i, int j, int k)
@@ -36,7 +36,7 @@
@@ -27,7 +27,7 @@
}
public abstract TileEntity getBlockEntity();
@ -18,7 +18,7 @@
public void powerBlock(World world, int i, int j, int k, int l, int i1)
{
super.powerBlock(world, i, j, k, l, i1);
@@ -46,4 +46,14 @@
@@ -37,4 +37,14 @@
tileentity.onTileEntityPowered(l, i1);
}
}

View file

@ -1,38 +1,38 @@
--- ../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 @@
@@ -1,6 +1,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,28 +109,23 @@
public class BlockCrops extends BlockFlower
{
@@ -98,27 +99,23 @@
return 6;
}
- public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f, int i1)
+ @Override
+ public ArrayList<ItemStack> getBlockDropped(World world, int i, int j, int k, int md, int fortune)
+ public ArrayList<ItemStack> getBlockDropped(World world, int i, int j, int k, int meta, int fortune)
{
- super.dropBlockAsItemWithChance(world, i, j, k, l, f, 0);
- if(world.singleplayerWorld)
+ ArrayList<ItemStack> tr = new ArrayList<ItemStack>();
+ if (md == 7)
- if (world.singleplayerWorld)
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ if (meta == 7)
+ {
+ tr.add(new ItemStack(Item.wheat));
+ ret.add(new ItemStack(Item.wheat));
+ }
+
+ for(int n = 0; n < 3+fortune; n++)
+ for(int n = 0; n < 3 + fortune; n++)
{
- return;
- }
- int j1 = 3 + i1;
- for(int k1 = 0; k1 < j1; k1++)
- for (int k1 = 0; k1 < j1; k1++)
- {
- if(world.rand.nextInt(15) <= l)
+ if (world.rand.nextInt(15) <= md)
- if (world.rand.nextInt(15) <= l)
+ if (world.rand.nextInt(15) <= meta)
{
- float f1 = 0.7F;
- float f2 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
@ -41,11 +41,10 @@
- EntityItem entityitem = new EntityItem(world, (float)i + f2, (float)j + f3, (float)k + f4, new ItemStack(Item.seeds));
- entityitem.delayBeforeCanPickup = 10;
- world.spawnEntityInWorld(entityitem);
+ tr.add(new ItemStack(Item.seeds));
+ ret.add(new ItemStack(Item.seeds));
}
}
-
+ return tr;
+ return ret;
}
public int idDropped(int i, Random random, int j)

View file

@ -1,29 +1,29 @@
--- ../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
@@ -105,7 +105,7 @@
@@ -95,7 +95,7 @@
{
if(blockMaterial == Material.iron)
if (blockMaterial == Material.iron)
{
- return true;
+ return false;
}
int l = world.getBlockMetadata(i, j, k);
if((l & 8) != 0)
@@ -172,7 +172,7 @@
if ((l & 8) != 0)
@@ -163,7 +163,7 @@
world.setBlockWithNotify(i, j, k, 0);
flag = true;
}
- if(!world.isBlockNormalCube(i, j - 1, k))
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1))
- if (!world.isBlockNormalCube(i, j - 1, k))
+ if (!world.isBlockSolidOnSide(i, j - 1, k, 1))
{
world.setBlockWithNotify(i, j, k, 0);
flag = true;
@@ -235,7 +235,7 @@
return false;
} else
@@ -232,7 +232,7 @@
}
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);
+ return world.isBlockSolidOnSide(i, j - 1, k, 1) && super.canPlaceBlockAt(world, i, j, k) && super.canPlaceBlockAt(world, i, j + 1, k);
}
}

View file

@ -1,15 +1,6 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockFire.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockFire.java 0000-00-00 00:00:00.000000000 -0000
@@ -14,14 +14,14 @@
public class BlockFire extends Block
{
- private int chanceToEncourageFire[];
- private int abilityToCatchFire[];
-
+ private int chanceToEncourageFire[];
+ private int abilityToCatchFire[];
+
@@ -10,8 +10,8 @@
protected BlockFire(int i, int j)
{
super(i, j, Material.fire);
@ -20,7 +11,7 @@
setTickOnLoad(true);
}
@@ -38,11 +38,10 @@
@@ -28,11 +28,10 @@
setBurnRate(Block.cloth.blockID, 30, 60);
setBurnRate(Block.vine.blockID, 15, 100);
}
@ -34,34 +25,29 @@
}
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k)
@@ -77,11 +76,9 @@
@@ -67,7 +66,8 @@
public void updateTick(World world, int i, int j, int k, Random random)
{
- boolean flag = world.getBlockId(i, j - 1, k) == Block.netherrack.blockID;
- if((world.worldProvider instanceof WorldProviderEnd) && world.getBlockId(i, j - 1, k) == Block.bedrock.blockID)
- {
- flag = true;
- }
+ Block base = Block.blocksList[world.getBlockId(i, j - 1, k)];
+ boolean flag = (base != null && base.isFireSource(world, i, j - 1, k, world.getBlockMetadata(i, j - 1, k), 0));
+
if(!canPlaceBlockAt(world, i, j, k))
if ((world.worldProvider instanceof WorldProviderEnd) && world.getBlockId(i, j - 1, k) == Block.bedrock.blockID)
{
world.setBlockWithNotify(i, j, k, 0);
@@ -99,23 +96,23 @@
flag = true;
@@ -89,23 +89,23 @@
world.scheduleBlockUpdate(i, j, k, blockID, tickRate());
if(!flag && !func_268_g(world, i, j, k))
if (!flag && !func_268_g(world, i, j, k))
{
- if(!world.isBlockNormalCube(i, j - 1, k) || l > 3)
+ if(!world.isBlockSolidOnSide(i, j - 1, k, 0) || l > 3)
- if (!world.isBlockNormalCube(i, j - 1, k) || l > 3)
+ if (!world.isBlockSolidOnSide(i, j - 1, k, 0) || l > 3)
{
world.setBlockWithNotify(i, j, k, 0);
}
return;
}
- if(!flag && !canBlockCatchFire(world, i, j - 1, k) && l == 15 && random.nextInt(4) == 0)
+ if(!flag && !canBlockCatchFire(world, i, j - 1, k, 0) && l == 15 && random.nextInt(4) == 0)
- if (!flag && !canBlockCatchFire(world, i, j - 1, k) && l == 15 && random.nextInt(4) == 0)
+ if (!flag && !canBlockCatchFire(world, i, j - 1, k, 1) && l == 15 && random.nextInt(4) == 0)
{
world.setBlockWithNotify(i, j, k, 0);
return;
@ -78,22 +64,18 @@
+ tryToCatchBlockOnFire(world, i, j + 1, k, 250, random, l, 0);
+ tryToCatchBlockOnFire(world, i, j, k - 1, 300, random, l, 3);
+ tryToCatchBlockOnFire(world, i, j, k + 1, 300, random, l, 2);
for(int i1 = i - 1; i1 <= i + 1; i1++)
for (int i1 = i - 1; i1 <= i + 1; i1++)
{
for(int j1 = k - 1; j1 <= k + 1; j1++)
@@ -154,10 +151,24 @@
for (int j1 = k - 1; j1 <= k + 1; j1++)
@@ -142,55 +142,66 @@
}
}
-
+
+ /*
+ * Added for backwards compatibility, should not be called by anyone who is making a mod for forge
+ */
+ @Deprecated
private void tryToCatchBlockOnFire(World world, int i, int j, int k, int l, Random random, int i1)
{
- int j1 = abilityToCatchFire[world.getBlockId(i, j, k)];
- if (random.nextInt(l) < j1)
+ tryToCatchBlockOnFire(world, i, j, k, l, random, i1, 0);
+ }
+
@ -105,34 +87,57 @@
+ {
+ j1 = block.getFlammability(world, i, j, k, world.getBlockMetadata(i, j, k), face);
+ }
if(random.nextInt(l) < j1)
+ if(random.nextInt(l) < j1)
{
boolean flag = world.getBlockId(i, j, k) == Block.tnt.blockID;
@@ -182,27 +193,27 @@
- if (random.nextInt(i1 + 10) < 5 && !world.canLightningStrikeAt(i, j, k))
+ if(random.nextInt(i1 + 10) < 5 && !world.canLightningStrikeAt(i, j, k))
{
int k1 = i1 + random.nextInt(5) / 4;
- if (k1 > 15)
+ if(k1 > 15)
{
k1 = 15;
}
world.setBlockAndMetadataWithNotify(i, j, k, blockID, k1);
- }
- else
+ } else
{
world.setBlockWithNotify(i, j, k, 0);
}
- if (flag)
+ if(flag)
{
Block.tnt.onBlockDestroyedByPlayer(world, i, j, k, 1);
}
}
}
+
private boolean func_268_g(World world, int i, int j, int k)
{
- if(canBlockCatchFire(world, i + 1, j, k))
- if (canBlockCatchFire(world, i + 1, j, k))
+ if(canBlockCatchFire(world, i + 1, j, k, 4))
{
return true;
}
- if(canBlockCatchFire(world, i - 1, j, k))
- if (canBlockCatchFire(world, i - 1, j, k))
+ if(canBlockCatchFire(world, i - 1, j, k, 5))
{
return true;
}
- if(canBlockCatchFire(world, i, j - 1, k))
- if (canBlockCatchFire(world, i, j - 1, k))
+ if(canBlockCatchFire(world, i, j - 1, k, 1))
{
return true;
}
- if(canBlockCatchFire(world, i, j + 1, k))
- if (canBlockCatchFire(world, i, j + 1, k))
+ if(canBlockCatchFire(world, i, j + 1, k, 0))
{
return true;
}
- if(canBlockCatchFire(world, i, j, k - 1))
- if (canBlockCatchFire(world, i, j, k - 1))
+ if(canBlockCatchFire(world, i, j, k - 1, 3))
{
return true;
@ -142,9 +147,9 @@
}
private int getChanceOfNeighborsEncouragingFire(World world, int i, int j, int k)
@@ -213,12 +224,12 @@
return 0;
} else
@@ -202,12 +213,12 @@
}
else
{
- l = getChanceToEncourageFire(world, i + 1, j, k, l);
- l = getChanceToEncourageFire(world, i - 1, j, k, l);
@ -161,22 +166,17 @@
return l;
}
}
@@ -227,15 +238,43 @@
{
@@ -217,19 +228,40 @@
return false;
}
-
+
+ /*
+ * Added for backwards compatibility, should not be called by anyone who is making a mod for forge
+ */
+ @Deprecated
public boolean canBlockCatchFire(IBlockAccess iblockaccess, int i, int j, int k)
{
- return chanceToEncourageFire[iblockaccess.getBlockId(i, j, k)] > 0;
+ return canBlockCatchFire(iblockaccess, i, j, k, 0);
}
+ }
+
+ public boolean canBlockCatchFire(IBlockAccess world, int i, int j, int k, int face)
+ {
+ Block block = Block.blocksList[world.getBlockId(i, j, k)];
@ -185,15 +185,13 @@
+ return block.isFlammable(world, i, j, k, world.getBlockMetadata(i, j, k), face);
+ }
+ return false;
+ }
+
+ /*
+ * Added for backwards compatibility, should not be called by anyone who is making a mod for forge
+ */
}
+ @Deprecated
public int getChanceToEncourageFire(World world, int i, int j, int k, int l)
{
- int i1 = chanceToEncourageFire[world.getBlockId(i, j, k)];
- if (i1 > l)
+ return getChanceToEncourageFire(world, i, j, k, l, 0);
+ }
+
@ -205,30 +203,36 @@
+ {
+ i1 = block.getFireSpreadSpeed(world, i, j, k, world.getBlockMetadata(i, j, k), face);
+ }
if(i1 > l)
+ if(i1 > l)
{
return i1;
@@ -247,12 +286,12 @@
- }
- else
+ } else
{
return l;
}
@@ -237,12 +269,12 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- return world.isBlockNormalCube(i, j - 1, k) || func_268_g(world, i, j, k);
+ return world.isBlockSolidOnSide(i, j - 1, k, 0) || func_268_g(world, i, j, k);
+ return world.isBlockSolidOnSide(i, j - 1, k, 1) || func_268_g(world, i, j, k);
}
public void onNeighborBlockChange(World world, int i, int j, int k, int l)
{
- if(!world.isBlockNormalCube(i, j - 1, k) && !func_268_g(world, i, j, k))
+ if(!world.isBlockSolidOnSide(i, j - 1, k, 0) && !func_268_g(world, i, j, k))
- if (!world.isBlockNormalCube(i, j - 1, k) && !func_268_g(world, i, j, k))
+ if (!world.isBlockSolidOnSide(i, j - 1, k, 1) && !func_268_g(world, i, j, k))
{
world.setBlockWithNotify(i, j, k, 0);
return;
@@ -268,7 +307,7 @@
@@ -259,7 +291,7 @@
{
return;
}
- if(!world.isBlockNormalCube(i, j - 1, k) && !func_268_g(world, i, j, k))
+ if(!world.isBlockSolidOnSide(i, j - 1, k, 0) && !func_268_g(world, i, j, k))
- if (!world.isBlockNormalCube(i, j - 1, k) && !func_268_g(world, i, j, k))
+ if (!world.isBlockSolidOnSide(i, j - 1, k, 1) && !func_268_g(world, i, j, k))
{
world.setBlockWithNotify(i, j, k, 0);
return;

View file

@ -1,84 +1,83 @@
--- ../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(World world, int i, int j, int k) {
+ return true;
+ }
+
public boolean isOpaqueCube()
{
return false;
@@ -57,37 +62,37 @@
@@ -31,37 +31,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))
- 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))
- 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))
- 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);
+ 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))
- 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))
- 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))
- 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))
- 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;
}
@@ -98,19 +103,19 @@
@@ -72,19 +72,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))
- 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))
- 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))
- 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))
- if (i1 == 5 && world.isBlockNormalCube(i - 1, j, k))
+ if(i1 == 5 && world.isBlockSolidOnSide(i - 1, j, k, 5))
{
flag = true;
}
@@ -100,4 +100,10 @@
{
return 1;
}
+
+ /* FORGE: Implemented base method, see Block.isLadder */
+ public boolean isLadder(World world, int i, int j, int k)
+ {
+ return true;
+ }
}

View file

@ -1,120 +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
@@ -40,44 +40,44 @@
@@ -31,44 +31,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))
- 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))
- 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))
- 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))
- 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);
+ 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))
- 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))
- 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))
- 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))
- 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);
+ 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 @@
@@ -77,23 +77,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))
- 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))
- 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))
- 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))
- 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))
- 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 @@
@@ -116,27 +116,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)
- 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)
- 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)
- 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)
- 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)
- 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)
- if (!world.isBlockNormalCube(i, j - 1, k) && i1 == 6)
+ if (!world.isBlockSolidOnSide(i, j - 1, k, 1) && i1 == 6)
{
flag = true;
}

View file

@ -1,54 +1,49 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockNetherStalk.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockNetherStalk.java 0000-00-00 00:00:00.000000000 -0000
@@ -4,6 +4,7 @@
@@ -1,5 +1,6 @@
package net.minecraft.src;
+import java.util.ArrayList;
import java.util.Random;
// Referenced classes of package net.minecraft.src:
@@ -64,27 +65,27 @@
{
public class BlockNetherStalk extends BlockFlower
@@ -57,25 +58,26 @@
return 6;
}
-
- public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f, int i1)
- {
- if(world.singleplayerWorld)
+ @Override
+ public ArrayList<ItemStack> getBlockDropped(World world, int i, int j, int k, int metadata, int fortune)
{
- if (world.singleplayerWorld)
- {
- return;
- }
- int j1 = 1;
- if(l >= 3)
- if (l >= 3)
- {
- j1 = 2 + world.rand.nextInt(3);
- if(i1 > 0)
- if (i1 > 0)
- {
- j1 += world.rand.nextInt(i1 + 1);
- }
- }
- for(int k1 = 0; k1 < j1; k1++)
- for (int k1 = 0; k1 < j1; k1++)
- {
- dropBlockAsItem_do(world, i, j, k, new ItemStack(Item.netherStalkSeeds));
- }
-
+
+ @Override
+ public ArrayList<ItemStack> getBlockDropped(World world, int i, int j, int k, int md, int fortune)
+ {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+
+ int count = 1;
+ if (md >= 3)
+ int j1 = 1;
+ if (metadata >= 3)
+ {
+ count = 2 + world.rand.nextInt(3);
+ j1 = 2 + world.rand.nextInt(3);
+ if (fortune > 0)
+ {
+ count += world.rand.nextInt(fortune + 1);
+ j1 += world.rand.nextInt(fortune + 1);
+ }
+ }
+ for (int n = 0; n < count; n++)
+ for (int k1 = 0; k1 < j1; k1++)
+ {
+ ret.add(new ItemStack(Item.netherStalkSeeds));
+ }

View file

@ -1,6 +1,6 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockPistonBase.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockPistonBase.java 0000-00-00 00:00:00.000000000 -0000
@@ -356,7 +356,7 @@
@@ -350,7 +350,7 @@
return false;
}
}

View file

@ -1,22 +1,11 @@
--- ../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
@@ -48,7 +48,8 @@
@@ -38,7 +38,7 @@
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;
+ 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)
@@ -58,7 +59,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

@ -1,8 +1,8 @@
--- ../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
@@ -14,16 +14,29 @@
@@ -5,16 +5,29 @@
public class BlockRail extends Block
{
private final boolean isPowered;
+
+ /**
@ -32,7 +32,7 @@
}
protected BlockRail(int i, int j, boolean flag)
@@ -89,7 +102,7 @@
@@ -81,7 +94,7 @@
public int getRenderType()
{
@ -41,51 +41,47 @@
}
public int quantityDropped(Random random)
@@ -99,7 +112,7 @@
@@ -91,7 +104,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);
+ return world.isBlockSolidOnSide(i, j - 1, k, 1);
}
public void onBlockAdded(World world, int i, int j, int k)
@@ -123,23 +136,23 @@
j1 &= 7;
}
boolean flag = false;
- if(!world.isBlockNormalCube(i, j - 1, k))
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1))
@@ -123,19 +136,19 @@
{
flag = true;
}
- if(j1 == 2 && !world.isBlockNormalCube(i + 1, j, k))
+ if(j1 == 2 && !world.isBlockSolidOnSide(i + 1, j, k,1))
- 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))
- 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))
- 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))
- if (j1 == 5 && !world.isBlockNormalCube(i, j, k + 1))
+ if (j1 == 5 && !world.isBlockSolidOnSide(i, j, k + 1, 1))
{
flag = true;
}
@@ -313,8 +326,118 @@
@@ -317,8 +330,119 @@
return 0;
}
+ /**
+ * This function is no longer called by Minecraft
+ */
+ @Deprecated
static boolean isPoweredBlockRail(BlockRail blockrail)
{
return blockrail.isPowered;

View file

@ -1,20 +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
@@ -35,7 +35,7 @@
@@ -28,7 +28,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))
- if (!world.isBlockNormalCube(i, j - 1, k))
+ if (!world.isBlockSolidOnSide(i, j - 1, k, 1))
{
return false;
} else
@@ -46,7 +46,7 @@
}
@@ -40,7 +40,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))
- if (!world.isBlockNormalCube(i, j - 1, k))
+ if (!world.isBlockSolidOnSide(i, j - 1, k, 1))
{
return false;
} else
}

View file

@ -1,14 +1,15 @@
--- ../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 fieldsfirst
package net.minecraft.src;
+import net.minecraft.src.forge.*;
@@ -2,6 +2,8 @@
import java.util.*;
@@ -51,7 +52,7 @@
+import net.minecraft.src.forge.IConnectRedstone;
+
public class BlockRedstoneWire extends Block
{
private boolean wiresProvidePower;
@@ -42,7 +44,7 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
@ -17,14 +18,14 @@
}
private void updateAndPropagateCurrentStrength(World world, int i, int j, int k)
@@ -421,6 +422,10 @@
@@ -429,6 +431,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] instanceof IConnectRedstone)
+ {
+ return ((IConnectRedstone)Block.blocksList[i1]).canConnectRedstone(iblockaccess,i,j,k,l);
+ }
if(Block.blocksList[i1].canProvidePower() && l != -1)
if (i1 == Block.redstoneRepeaterIdle.blockID || i1 == Block.redstoneRepeaterActive.blockID)
{
return true;
int j1 = iblockaccess.getBlockMetadata(i, j, k);

View file

@ -1,6 +1,6 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockSnow.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockSnow.java 0000-00-00 00:00:00.000000000 -0000
@@ -82,15 +82,7 @@
@@ -75,15 +75,7 @@
public void harvestBlock(World world, EntityPlayer entityplayer, int i, int j, int k, int l)
{
@ -13,11 +13,11 @@
- entityitem.delayBeforeCanPickup = 10;
- world.spawnEntityInWorld(entityitem);
- world.setBlockWithNotify(i, j, k, 0);
+ dropBlockAsItem(world,i,j,k,l,0);
+ dropBlockAsItem(world,i,j,k,l,0);
entityplayer.addStat(StatList.mineBlockStatArray[blockID], 1);
}
@@ -101,7 +93,7 @@
@@ -94,7 +86,7 @@
public int quantityDropped(Random random)
{

View file

@ -1,44 +1,44 @@
--- ../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 @@
@@ -1,7 +1,10 @@
package net.minecraft.src;
+import java.util.ArrayList;
import java.util.Random;
+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,24 @@
public class BlockTallGrass extends BlockFlower
{
protected BlockTallGrass(int i, int j)
@@ -33,15 +36,25 @@
public int idDropped(int i, Random random, int j)
{
- if(random.nextInt(8) == 0)
- {
- return Item.seeds.shiftedIndex;
- } else
- {
return -1;
- }
+ }
+
- if (random.nextInt(8) == 0)
+ return -1;
+ }
+
+ @Override
+ public ArrayList<ItemStack> getBlockDropped(World world, int i, int j, int k, int md, int fortune)
+ public ArrayList<ItemStack> getBlockDropped(World world, int i, int j, int k, int md, int fortune)
+ {
+ 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;
}
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ if (world.rand.nextInt(8) != 0)
{
- return Item.seeds.shiftedIndex;
+ return ret;
}
- else
+
+ ItemStack item = ForgeHooks.getGrassSeed(world);
+ if (item != null)
{
- return -1;
+ ret.add(item);
}
- }
+ return ret;
+ }
public int quantityDroppedWithBonus(int i, Random random)
{

View file

@ -1,107 +1,107 @@
--- ../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
@@ -41,7 +41,7 @@
@@ -32,7 +32,7 @@
private boolean canPlaceTorchOn(World world, int i, int j, int k)
{
- if(world.func_41047_b(i, j, k, true))
- if (world.func_41047_b(i, j, k, true))
+ if(world.isBlockSolidOnSide(i, j, k, 1))
{
return true;
} else
@@ -53,19 +53,19 @@
}
@@ -45,19 +45,19 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- if(world.func_41047_b(i - 1, j, k, true))
+ if(world.isBlockSolidOnSide(i - 1, j, k,5))
- if (world.func_41047_b(i - 1, j, k, true))
+ if (world.isBlockSolidOnSide(i - 1, j, k, 5))
{
return true;
}
- if(world.func_41047_b(i + 1, j, k, true))
+ if(world.isBlockSolidOnSide(i + 1, j, k,4))
- if (world.func_41047_b(i + 1, j, k, true))
+ if (world.isBlockSolidOnSide(i + 1, j, k, 4))
{
return true;
}
- if(world.func_41047_b(i, j, k - 1, true))
+ if(world.isBlockSolidOnSide(i, j, k-1,3))
- if (world.func_41047_b(i, j, k - 1, true))
+ if (world.isBlockSolidOnSide(i, j, k - 1, 3))
{
return true;
}
- if(world.func_41047_b(i, j, k + 1, true))
+ if(world.isBlockSolidOnSide(i, j, k+1,2))
- if (world.func_41047_b(i, j, k + 1, true))
+ if (world.isBlockSolidOnSide(i, j, k + 1, 2))
{
return true;
}
@@ -79,19 +79,19 @@
@@ -71,19 +71,19 @@
{
i1 = 5;
}
- if(l == 2 && world.func_41047_b(i, j, k + 1, true))
+ if(l == 2 && world.isBlockSolidOnSide(i, j, k+1,2))
- if (l == 2 && world.func_41047_b(i, j, k + 1, true))
+ if (l == 2 && world.isBlockSolidOnSide(i, j, k + 1, 2))
{
i1 = 4;
}
- if(l == 3 && world.func_41047_b(i, j, k - 1, true))
+ if(l == 3 && world.isBlockSolidOnSide(i, j, k-1,3))
- if (l == 3 && world.func_41047_b(i, j, k - 1, true))
+ if (l == 3 && world.isBlockSolidOnSide(i, j, k - 1, 3))
{
i1 = 3;
}
- if(l == 4 && world.func_41047_b(i + 1, j, k, true))
+ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4))
- if (l == 4 && world.func_41047_b(i + 1, j, k, true))
+ if (l == 4 && world.isBlockSolidOnSide(i + 1, j, k, 4))
{
i1 = 2;
}
- if(l == 5 && world.func_41047_b(i - 1, j, k, true))
+ if(l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5))
- if (l == 5 && world.func_41047_b(i - 1, j, k, true))
+ if (l == 5 && world.isBlockSolidOnSide(i - 1, j, k, 5))
{
i1 = 1;
}
@@ -109,19 +109,19 @@
@@ -101,19 +101,19 @@
public void onBlockAdded(World world, int i, int j, int k)
{
- if(world.func_41047_b(i - 1, j, k, true))
+ if(world.isBlockSolidOnSide(i - 1, j, k,5))
- if (world.func_41047_b(i - 1, j, k, true))
+ if (world.isBlockSolidOnSide(i - 1, j, k, 5))
{
world.setBlockMetadataWithNotify(i, j, k, 1);
} else
- if(world.func_41047_b(i + 1, j, k, true))
+ if(world.isBlockSolidOnSide(i + 1, j, k,4))
}
- else if (world.func_41047_b(i + 1, j, k, true))
+ else if (world.isBlockSolidOnSide(i + 1, j, k, 4))
{
world.setBlockMetadataWithNotify(i, j, k, 2);
} else
- if(world.func_41047_b(i, j, k - 1, true))
+ if(world.isBlockSolidOnSide(i, j, k-1,3))
}
- else if (world.func_41047_b(i, j, k - 1, true))
+ else if (world.isBlockSolidOnSide(i, j, k - 1, 3))
{
world.setBlockMetadataWithNotify(i, j, k, 3);
} else
- if(world.func_41047_b(i, j, k + 1, true))
+ if(world.isBlockSolidOnSide(i, j, k+1,2))
}
- else if (world.func_41047_b(i, j, k + 1, true))
+ else if (world.isBlockSolidOnSide(i, j, k + 1, 2))
{
world.setBlockMetadataWithNotify(i, j, k, 4);
} else
@@ -138,19 +138,19 @@
}
@@ -130,19 +130,19 @@
{
int i1 = world.getBlockMetadata(i, j, k);
boolean flag = false;
- if(!world.func_41047_b(i - 1, j, k, true) && i1 == 1)
+ if(!world.isBlockSolidOnSide(i - 1, j, k,5) && i1 == 1)
- if (!world.func_41047_b(i - 1, j, k, true) && i1 == 1)
+ if (!world.isBlockSolidOnSide(i - 1, j, k, 5) && i1 == 1)
{
flag = true;
}
- if(!world.func_41047_b(i + 1, j, k, true) && i1 == 2)
+ if(!world.isBlockSolidOnSide(i + 1, j, k,4) && i1 == 2)
- if (!world.func_41047_b(i + 1, j, k, true) && i1 == 2)
+ if (!world.isBlockSolidOnSide(i + 1, j, k, 4) && i1 == 2)
{
flag = true;
}
- if(!world.func_41047_b(i, j, k - 1, true) && i1 == 3)
+ if(!world.isBlockSolidOnSide(i, j, k-1,3) && i1 == 3)
- if (!world.func_41047_b(i, j, k - 1, true) && i1 == 3)
+ if (!world.isBlockSolidOnSide(i, j, k - 1, 3) && i1 == 3)
{
flag = true;
}
- if(!world.func_41047_b(i, j, k + 1, true) && i1 == 4)
+ if(!world.isBlockSolidOnSide(i, j, k+1,2) && i1 == 4)
- if (!world.func_41047_b(i, j, k + 1, true) && i1 == 4)
+ if (!world.isBlockSolidOnSide(i, j, k + 1, 2) && i1 == 4)
{
flag = true;
}

View file

@ -1,35 +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
@@ -11,7 +11,10 @@
@@ -2,6 +2,9 @@
public class BlockTrapDoor extends Block
{
-
+ /* FORGE: Set this to allow trapdoors to remain free-floating
+ */
+ public static boolean disableValidation=false;
+ /* FORGE: Set this to allow trapdoors to remain free-floating */
+ public static boolean disableValidation = false;
+
protected BlockTrapDoor(int i, Material material)
{
super(i, material);
@@ -141,7 +144,7 @@
@@ -133,7 +136,7 @@
{
j1--;
}
- if(!func_41006_g(world.getBlockId(j1, j, k1)))
+ if(!(func_41006_g(world.getBlockId(j1, j, k1)) || world.isBlockSolidOnSide(j1, j, k1, (i1&3)+2)))
- if (!func_41006_g(world.getBlockId(j1, j, k1)))
+ if (!(func_41006_g(world.getBlockId(j1, j, k1)) || world.isBlockSolidOnSide(j1, j, k1, (i1 & 3) + 2)))
{
world.setBlockWithNotify(i, j, k, 0);
dropBlockAsItem(world, i, j, k, i1, 0);
@@ -186,6 +189,7 @@
@@ -175,6 +178,10 @@
public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l)
{
+ if(disableValidation) return true;
if(l == 0)
+ if (disableValidation)
+ {
+ return true;
+ }
if (l == 0)
{
return false;
@@ -210,7 +214,7 @@
@@ -199,7 +206,7 @@
{
i--;
}

View file

@ -1,59 +1,46 @@
--- ../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 fieldsfirst
package net.minecraft.src;
+import net.minecraft.src.forge.*;
import java.io.PrintStream;
import java.util.*;
@@ -328,11 +329,12 @@
blocks[i << worldObj.xShift | k << worldObj.worldYBits | j] = (byte)(byte0 & 0xff);
if(l1 != 0)
{
+ int meta = getBlockMetadata(i, j, k);
if(!worldObj.singleplayerWorld)
@@ -316,7 +316,7 @@
{
Block.blocksList[l1].onBlockRemoval(worldObj, i2, j, j2);
} else
- if(Block.blocksList[l1] instanceof BlockContainer)
+ if(Block.blocksList[l1] != null && Block.blocksList[l1].hasTileEntity(meta))
}
- else if ((Block.blocksList[l1] instanceof BlockContainer) && l1 != l)
+ else if (Block.blocksList[l1] != null && Block.blocksList[l1].hasTileEntity(getBlockMetadata(i, j, k)) && l1 != l)
{
worldObj.removeBlockTileEntity(i2, j, j2);
}
@@ -362,12 +364,12 @@
@@ -346,12 +346,12 @@
{
Block.blocksList[l].onBlockAdded(worldObj, i2, j, j2);
}
- if(Block.blocksList[l] instanceof BlockContainer)
+ if(Block.blocksList[l] != null && Block.blocksList[l].hasTileEntity(i1))
- if (Block.blocksList[l] instanceof BlockContainer)
+ if (Block.blocksList[l] != null && Block.blocksList[l].hasTileEntity(i1))
{
TileEntity tileentity = getChunkBlockTileEntity(i, j, k);
if(tileentity == null)
if (tileentity == null)
{
- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity();
+ tileentity = Block.blocksList[l].getTileEntity(i1);
worldObj.setBlockTileEntity(i, j, k, tileentity);
worldObj.setBlockTileEntity(i2, j, j2, tileentity);
}
if(tileentity != null)
@@ -375,14 +377,6 @@
tileentity.updateContainingBlockInfo();
if (tileentity != null)
@@ -360,14 +360,6 @@
}
}
- } else
- if(l1 > 0 && (Block.blocksList[l1] instanceof BlockContainer))
}
- else if (l1 > 0 && (Block.blocksList[l1] instanceof BlockContainer))
- {
- TileEntity tileentity1 = getChunkBlockTileEntity(i, j, k);
- if(tileentity1 != null)
- if (tileentity1 != null)
- {
- tileentity1.updateContainingBlockInfo();
- }
}
- }
isModified = true;
return true;
@@ -408,6 +402,11 @@
if(k1 != 0)
}
@@ -392,6 +384,11 @@
if (k1 != 0)
{
Block.blocksList[k1].onBlockRemoval(worldObj, l1, j, i2);
+ if (!worldObj.singleplayerWorld)
@ -63,66 +50,68 @@
+ worldObj.removeBlockTileEntity(l1, j, i2);
}
data.setNibble(i, j, k, 0);
if(Block.lightOpacity[byte0 & 0xff] != 0)
@@ -430,12 +429,13 @@
if (Block.lightOpacity[byte0 & 0xff] != 0)
@@ -414,28 +411,22 @@
{
Block.blocksList[l].onBlockAdded(worldObj, l1, j, i2);
}
- if(l > 0 && (Block.blocksList[l] instanceof BlockContainer))
- if (l > 0 && (Block.blocksList[l] instanceof BlockContainer))
+ int meta = getBlockMetadata(i, j, k);
+ if(l > 0 && Block.blocksList[l] != null && Block.blocksList[l].hasTileEntity(meta))
+ if (l > 0 && Block.blocksList[l] != null && Block.blocksList[l].hasTileEntity(meta))
{
TileEntity tileentity = getChunkBlockTileEntity(i, j, k);
if(tileentity == null)
if (tileentity == null)
{
- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity();
+ tileentity = Block.blocksList[l].getTileEntity(meta);
worldObj.setBlockTileEntity(i, j, k, tileentity);
worldObj.setBlockTileEntity(l1, j, i2, tileentity);
}
if(tileentity != null)
@@ -443,14 +443,6 @@
if (tileentity != null)
{
tileentity.updateContainingBlockInfo();
+ tileentity.blockMetadata = meta;
}
}
- } else
- if(k1 > 0 && (Block.blocksList[k1] instanceof BlockContainer))
}
- else if (k1 > 0 && (Block.blocksList[k1] instanceof BlockContainer))
- {
- TileEntity tileentity1 = getChunkBlockTileEntity(i, j, k);
- if(tileentity1 != null)
- if (tileentity1 != null)
- {
- tileentity1.updateContainingBlockInfo();
- }
}
- }
isModified = true;
return true;
@@ -471,7 +463,7 @@
}
@@ -455,7 +446,7 @@
}
data.setNibble(i, j, k, l);
int j1 = getBlockID(i, j, k);
- if(j1 > 0 && (Block.blocksList[j1] instanceof BlockContainer))
+ if(j1 > 0 && Block.blocksList[j1] != null && Block.blocksList[j1].hasTileEntity(l))
- if (j1 > 0 && (Block.blocksList[j1] instanceof BlockContainer))
+ if (j1 > 0 && Block.blocksList[j1] != null && Block.blocksList[j1].hasTileEntity(l))
{
TileEntity tileentity = getChunkBlockTileEntity(i, j, k);
if(tileentity != null)
@@ -586,27 +578,38 @@
if (tileentity != null)
@@ -572,29 +563,27 @@
{
ChunkPosition chunkposition = new ChunkPosition(i, j, k);
TileEntity tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition);
+ if(tileentity != null && tileentity.isInvalid())
+ {
+ chunkTileEntityMap.remove(chunkposition);
+ tileentity=null;
+ tileentity = null;
+ }
if(tileentity == null)
if (tileentity == null)
{
int l = getBlockID(i, j, k);
- if(!Block.isBlockContainer[l])
+ int meta = getBlockMetadata(i, j, k);
- if (!Block.isBlockContainer[l])
+ int meta = getBlockMetadata(i, j, k);
+ if(Block.blocksList[l] == null || !Block.blocksList[l].hasTileEntity(meta))
{
return null;
}
if(tileentity == null)
if (tileentity == null)
{
- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity();
+ tileentity = Block.blocksList[l].getTileEntity(meta);
@ -130,55 +119,64 @@
}
tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition);
}
- if(tileentity != null && tileentity.isInvalid())
- 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)
{
- }
- else
- {
- return tileentity;
+ TileEntity tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition);
+ if(tileentity!=null && tileentity.isInvalid())
+ chunkTileEntityMap.remove(chunkposition);
}
- }
+ return tileentity;
}
@@ -618,7 +621,7 @@
public void addTileEntity(TileEntity tileentity)
@@ -605,7 +594,7 @@
setChunkBlockTileEntity(i, j, k, tileentity);
if(isChunkLoaded)
if (isChunkLoaded)
{
- worldObj.loadedTileEntityList.add(tileentity);
+ worldObj.addTileEntity(tileentity);
}
}
@@ -629,11 +632,19 @@
@@ -616,12 +605,18 @@
tileentity.xCoord = xPosition * 16 + i;
tileentity.yCoord = j;
tileentity.zCoord = zPosition * 16 + k;
- if(getBlockID(i, j, k) == 0 || !(Block.blocksList[getBlockID(i, j, k)] instanceof BlockContainer))
- if (getBlockID(i, j, k) == 0 || !(Block.blocksList[getBlockID(i, j, k)] instanceof BlockContainer))
+ int id = getBlockID(i, j, k);
+ int meta = getBlockMetadata(i, j, k);
+ if(id == 0 || Block.blocksList[id] == null || !Block.blocksList[id].hasTileEntity(meta))
+ if(id == 0 || Block.blocksList[id] == null || !Block.blocksList[id].hasTileEntity(getBlockMetadata(i, j, k)))
{
return;
- } else
+ }
+ else
}
else
{
+ TileEntity old = (TileEntity)chunkTileEntityMap.get(chunkposition);
+ if (old != null)
+ {
+ old.invalidate();
+ }
+ TileEntity old = (TileEntity)chunkTileEntityMap.get(chunkposition);
+ if (old != null)
+ {
+ old.invalidate();
+ }
tileentity.validate();
chunkTileEntityMap.put(chunkposition, tileentity);
return;
@@ -903,4 +898,18 @@
{
return new ChunkCoordIntPair(xPosition, zPosition);
}
+
+ /* 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)
+ {
+ TileEntity tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition);
+ if (tileentity != null && tileentity.isInvalid())
+ {
+ chunkTileEntityMap.remove(chunkposition);
+ }
+ }
+ }
}

View file

@ -1,11 +1,11 @@
--- ../src_base/minecraft_server/net/minecraft/src/CraftingManager.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/CraftingManager.java 0000-00-00 00:00:00.000000000 -0000
@@ -363,7 +363,7 @@
@@ -423,7 +423,7 @@
i++;
}
- if(i == 2 && itemstack.itemID == itemstack1.itemID && itemstack.stackSize == 1 && itemstack1.stackSize == 1 && Item.itemsList[itemstack.itemID].isDamageable())
+ if(i == 2 && itemstack.itemID == itemstack1.itemID && itemstack.stackSize == 1 && itemstack1.stackSize == 1 && Item.itemsList[itemstack.itemID].isRepairable())
- if (i == 2 && itemstack.itemID == itemstack1.itemID && itemstack.stackSize == 1 && itemstack1.stackSize == 1 && Item.itemsList[itemstack.itemID].isDamageable())
+ if (i == 2 && itemstack.itemID == itemstack1.itemID && itemstack.stackSize == 1 && itemstack1.stackSize == 1 && Item.itemsList[itemstack.itemID].isRepairable())
{
Item item = Item.itemsList[itemstack.itemID];
int l = item.getMaxDamage() - itemstack.getItemDamageForDisplay();

View file

@ -1,16 +1,19 @@
--- ../src_base/minecraft_server/net/minecraft/src/Enchantment.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/Enchantment.java 0000-00-00 00:00:00.000000000 -0000
@@ -98,6 +98,13 @@
@@ -91,6 +91,16 @@
return this;
}
+ /* FORGE: Can enchantment be applied to item. Redirected to allow users to
+ * override it in their Enchantment class.
+ /**
+ * Called to determine if this enchantment can be applied to a ItemStack
+ * @param item The ItemStack that the enchantment might be put on
+ * @return True if the item is valid, false otherwise
+ */
+ public boolean canEnchantItem(ItemStack ist) {
+ return type.canEnchantItem(ist.getItem());
+ public boolean canEnchantItem(ItemStack item)
+ {
+ return type.canEnchantItem(item.getItem());
+ }
+
static
static
{
looting = new EnchantmentLootBonus(21, 2, EnumEnchantmentType.weapon);

View file

@ -1,11 +1,11 @@
--- ../src_base/minecraft_server/net/minecraft/src/EnchantmentHelper.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/EnchantmentHelper.java 0000-00-00 00:00:00.000000000 -0000
@@ -271,7 +271,7 @@
for(int k = 0; k < j; k++)
@@ -261,7 +261,7 @@
for (int k = 0; k < j; k++)
{
Enchantment enchantment = aenchantment[k];
- if(enchantment == null || !enchantment.type.canEnchantItem(item))
+ if(enchantment == null || !enchantment.canEnchantItem(itemstack))
- if (enchantment == null || !enchantment.type.canEnchantItem(item))
+ if (enchantment == null || !enchantment.canEnchantItem(itemstack))
{
continue;
}

View file

@ -1,6 +1,6 @@
--- ../src_base/minecraft_server/net/minecraft/src/Entity.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/Entity.java 0000-00-00 00:00:00.000000000 -0000
@@ -119,6 +119,22 @@
@@ -106,6 +106,22 @@
protected abstract void entityInit();
@ -23,23 +23,24 @@
public DataWatcher getDataWatcher()
{
return dataWatcher;
@@ -873,6 +889,10 @@
@@ -883,6 +899,10 @@
nbttagcompound.setShort("Fire", (short)fire);
nbttagcompound.setShort("Air", (short)getAir());
nbttagcompound.setBoolean("OnGround", onGround);
+ if (customEntityData != null)
+ {
+ nbttagcompound.setCompoundTag("ForgeData", customEntityData);
+ nbttagcompound.setCompoundTag("ForgeData", customEntityData);
+ }
writeEntityToNBT(nbttagcompound);
}
@@ -907,6 +927,9 @@
@@ -917,6 +937,10 @@
onGround = nbttagcompound.getBoolean("OnGround");
setPosition(posX, posY, posZ);
setRotation(rotationYaw, rotationPitch);
+ if (nbttagcompound.hasKey("ForgeData")) {
+ customEntityData=nbttagcompound.getCompoundTag("ForgeData");
+ if (nbttagcompound.hasKey("ForgeData"))
+ {
+ customEntityData = nbttagcompound.getCompoundTag("ForgeData");
+ }
readEntityFromNBT(nbttagcompound);
}

View file

@ -1,6 +1,6 @@
--- ../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
@@ -771,7 +771,9 @@
@@ -812,7 +812,9 @@
int i = MathHelper.floor_double(posX);
int j = MathHelper.floor_double(boundingBox.minY);
int k = MathHelper.floor_double(posZ);

View file

@ -1,7 +1,6 @@
--- ../src_base/minecraft_server/net/minecraft/src/EntityMinecart.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/EntityMinecart.java 0000-00-00 00:00:00.000000000 -0000
@@ -4,9 +4,14 @@
@@ -1,18 +1,23 @@
package net.minecraft.src;
+import java.util.ArrayList;
@ -12,28 +11,24 @@
+import net.minecraft.src.forge.IMinecartCollisionHandler;
+import net.minecraft.src.forge.MinecraftForge;
+
// Referenced classes of package net.minecraft.src:
// Entity, IInventory, ItemStack, DataWatcher,
// World, Item, EntityItem, Block,
@@ -18,13 +23,13 @@
public class EntityMinecart extends Entity
implements IInventory
{
- private ItemStack cargoItems[];
- private int fuel;
- private boolean field_469_aj;
+ protected ItemStack cargoItems[];
+ protected ItemStack cargoItems[];
+ protected int fuel;
+ protected boolean field_469_aj;
public int minecartType;
public double pushX;
public double pushZ;
- private static final int field_468_ak[][][] = {
+ protected static final int field_468_ak[][][] = {
- private static final int field_468_ak[][][] =
+ protected static final int field_468_ak[][][] =
{
{
{
0, 0, -1
@@ -87,13 +92,36 @@
@@ -76,13 +81,36 @@
}
}
};
@ -77,7 +72,7 @@
public EntityMinecart(World world)
{
super(world);
@@ -103,6 +131,18 @@
@@ -92,6 +120,18 @@
preventEntitySpawning = true;
setSize(0.98F, 0.7F);
yOffset = height / 2.0F;
@ -96,7 +91,7 @@
}
protected boolean canTriggerWalking()
@@ -120,17 +160,27 @@
@@ -109,17 +149,27 @@
public AxisAlignedBB getCollisionBox(Entity entity)
{
@ -124,128 +119,127 @@
+ return canBePushed;
}
public EntityMinecart(World world, double d, double d1, double d2,
@@ -169,8 +219,10 @@
public EntityMinecart(World world, double d, double d1, double d2,
@@ -158,8 +208,10 @@
riddenByEntity.mountEntity(this);
}
setEntityDead();
- dropItemWithOffset(Item.minecartEmpty.shiftedIndex, 1, 0.0F);
- if(minecartType == 1)
- if (minecartType == 1)
+
+ dropCartAsItem();
+
+ if(getSizeInventory() > 0)
+ if (getSizeInventory() > 0)
{
EntityMinecart entityminecart = this;
label0:
@@ -204,12 +256,6 @@
worldObj.spawnEntityInWorld(entityitem);
} while(true);
label0:
@@ -194,12 +246,6 @@
}
while (true);
}
-
- dropItemWithOffset(Block.chest.blockID, 1, 0.0F);
- } else
- if(minecartType == 2)
- }
- else if (minecartType == 2)
- {
- dropItemWithOffset(Block.stoneOvenIdle.blockID, 1, 0.0F);
}
}
return true;
@@ -267,7 +313,7 @@
@@ -258,7 +304,7 @@
{
func_41018_e_(func_41020_o() - 1);
}
- if(isMinecartPowered() && rand.nextInt(4) == 0)
+ if(isMinecartPowered() && rand.nextInt(4) == 0 && minecartType == 2 && getClass() == EntityMinecart.class)
- if (isMinecartPowered() && rand.nextInt(4) == 0)
+ if (isMinecartPowered() && rand.nextInt(4) == 0 && minecartType == 2 && getClass() == EntityMinecart.class)
{
worldObj.spawnParticle("largesmoke", posX, posY + 0.80000000000000004D, posZ, 0.0D, 0.0D, 0.0D);
}
@@ -307,22 +353,19 @@
@@ -299,22 +345,18 @@
double d2 = 0.40000000000000002D;
double d4 = 0.0078125D;
int l = worldObj.getBlockId(i, j, k);
- if(BlockRail.isRailBlock(l))
+ if(canUseRail() && BlockRail.isRailBlock(l))
- if (BlockRail.isRailBlock(l))
+ if (canUseRail() && BlockRail.isRailBlock(l))
{
Vec3D vec3d = func_182_g(posX, posY, posZ);
- int i1 = worldObj.getBlockMetadata(i, j, k);
+ int i1 = ((BlockRail)Block.blocksList[l]).getBasicRailMetadata(worldObj, this, i, j, k);;
+ int i1 = ((BlockRail)Block.blocksList[l]).getBasicRailMetadata(worldObj, this, i, j, k);
posY = j;
boolean flag = false;
boolean flag1 = false;
if(l == Block.railPowered.blockID)
if (l == Block.railPowered.blockID)
{
- flag = (i1 & 8) != 0;
+ flag = (worldObj.getBlockMetadata(i, j, k) & 8) != 0;
flag1 = !flag;
}
- if(((BlockRail)Block.blocksList[l]).getIsPowered())
- if (((BlockRail)Block.blocksList[l]).getIsPowered())
- {
- i1 &= 7;
- }
+
if(i1 >= 2 && i1 <= 5)
if (i1 >= 2 && i1 <= 5)
{
posY = j + 1;
@@ -356,7 +399,8 @@
@@ -348,7 +390,7 @@
double d13 = Math.sqrt(motionX * motionX + motionZ * motionZ);
motionX = (d13 * d9) / d11;
motionZ = (d13 * d10) / d11;
- if(flag1)
+
+ if(flag1 && shouldDoRailFunctions())
- if (flag1)
+ if (flag1 && shouldDoRailFunctions())
{
double d16 = Math.sqrt(motionX * motionX + motionZ * motionZ);
if(d16 < 0.029999999999999999D)
@@ -397,30 +441,9 @@
if (d16 < 0.029999999999999999D)
@@ -391,30 +433,9 @@
posX = d18 + d9 * d17;
posZ = d19 + d10 * d17;
setPosition(posX, posY + (double)yOffset, posZ);
- double d23 = motionX;
- double d25 = motionZ;
- if(riddenByEntity != null)
- if (riddenByEntity != null)
- {
- d23 *= 0.75D;
- d25 *= 0.75D;
- }
- if(d23 < -d2)
- if (d23 < -d2)
- {
- d23 = -d2;
- }
- if(d23 > d2)
- if (d23 > d2)
- {
- d23 = d2;
- }
- if(d25 < -d2)
- if (d25 < -d2)
- {
- d25 = -d2;
- }
- if(d25 > d2)
- if (d25 > d2)
- {
- d25 = d2;
- }
- moveEntity(d23, 0.0D, d25);
+
+
+ moveMinecartOnRail(i, j, k);
+
if(ai[0][1] != 0 && MathHelper.floor_double(posX) - i == ai[0][0] && MathHelper.floor_double(posZ) - k == ai[0][2])
if (ai[0][1] != 0 && MathHelper.floor_double(posX) - i == ai[0][0] && MathHelper.floor_double(posZ) - k == ai[0][2])
{
setPosition(posX, posY + (double)ai[0][1], posZ);
@@ -429,37 +452,9 @@
@@ -423,39 +444,9 @@
{
setPosition(posX, posY + (double)ai[1][1], posZ);
}
- if(riddenByEntity != null)
- if (riddenByEntity != null)
- {
- motionX *= 0.99699997901916504D;
- motionY *= 0.0D;
- motionZ *= 0.99699997901916504D;
- } else
- }
- else
- {
- if(minecartType == 2)
- if (minecartType == 2)
- {
- double d27 = MathHelper.sqrt_double(pushX * pushX + pushZ * pushZ);
- if(d27 > 0.01D)
- if (d27 > 0.01D)
- {
- pushX /= d27;
- pushZ /= d27;
@ -255,7 +249,8 @@
- motionZ *= 0.80000001192092896D;
- motionX += pushX * d29;
- motionZ += pushZ * d29;
- } else
- }
- else
- {
- motionX *= 0.89999997615814209D;
- motionY *= 0.0D;
@ -266,115 +261,275 @@
- motionY *= 0.0D;
- motionZ *= 0.95999997854232788D;
- }
+
+
+ applyDragAndPushForces();
+
Vec3D vec3d1 = func_182_g(posX, posY, posZ);
if(vec3d1 != null && vec3d != null)
if (vec3d1 != null && vec3d != null)
{
@@ -480,25 +475,15 @@
@@ -476,26 +467,14 @@
motionX = d15 * (double)(k1 - i);
motionZ = d15 * (double)(l1 - k);
}
- if(minecartType == 2)
- if (minecartType == 2)
+
+ updatePushForces();
+
+ if (shouldDoRailFunctions())
{
- double d30 = MathHelper.sqrt_double(pushX * pushX + pushZ * pushZ);
- if(d30 > 0.01D && motionX * motionX + motionZ * motionZ > 0.001D)
- if (d30 > 0.01D && motionX * motionX + motionZ * motionZ > 0.001D)
- {
- pushX /= d30;
- pushZ /= d30;
- if(pushX * motionX + pushZ * motionZ < 0.0D)
- if (pushX * motionX + pushZ * motionZ < 0.0D)
- {
- pushX = 0.0D;
- pushZ = 0.0D;
- } else
- }
- else
- {
- pushX = motionX;
- pushZ = motionZ;
- }
- }
+ ((BlockRail)Block.blocksList[l]).onMinecartPass(worldObj, this, i, j, k);
+ ((BlockRail)Block.blocksList[l]).onMinecartPass(worldObj, this, i, j, k);
}
- if(flag)
+
+ if(flag && shouldDoRailFunctions())
- if (flag)
+ if (flag && shouldDoRailFunctions())
{
double d31 = Math.sqrt(motionX * motionX + motionZ * motionZ);
if(d31 > 0.01D)
@@ -530,37 +515,10 @@
}
}
}
- } else
+ }
+ else
if (d31 > 0.01D)
@@ -530,35 +509,7 @@
}
else
{
- if(motionX < -d2)
- if (motionX < -d2)
- {
- motionX = -d2;
- }
- if(motionX > d2)
- if (motionX > d2)
- {
- motionX = d2;
- }
- if(motionZ < -d2)
- if (motionZ < -d2)
- {
- motionZ = -d2;
- }
- if(motionZ > d2)
- if (motionZ > d2)
- {
- motionZ = d2;
- }
- if(onGround)
- if (onGround)
- {
- motionX *= 0.5D;
- motionY *= 0.5D;
- motionZ *= 0.5D;
- }
- moveEntity(motionX, motionY, motionZ);
- if(!onGround)
- if (!onGround)
- {
- motionX *= 0.94999998807907104D;
- motionY *= 0.94999998807907104D;
- motionZ *= 0.94999998807907104D;
- }
+ moveMinecartOffRail(i, j, k);
+ moveMinecartOffRail(i, j, k);
}
rotationPitch = 0.0F;
double d6 = prevPosX - posX;
@@ -582,7 +540,20 @@
@@ -580,7 +531,19 @@
field_469_aj = !field_469_aj;
}
setRotation(rotationYaw, rotationPitch);
- List list = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.expand(0.20000000298023224D, 0.0D, 0.20000000298023224D));
+
+ AxisAlignedBB box = null;
+
+ AxisAlignedBB box = null;
+ if (getCollisionHandler() != null)
+ {
+ box = getCollisionHandler().getMinecartCollisionBox(this);
+ box = getCollisionHandler().getMinecartCollisionBox(this);
+ }
+ else
+ {
+
+ box = boundingBox.expand(0.20000000298023224D, 0.0D, 0.20000000298023224D);
+ box = boundingBox.expand(0.20000000298023224D, 0.0D, 0.20000000298023224D);
+ }
+
+ List list = worldObj.getEntitiesWithinAABBExcludingEntity(this, box);
if(list != null && list.size() > 0)
+
if (list != null && list.size() > 0)
{
for(int j1 = 0; j1 < list.size(); j1++)
@@ -603,6 +574,178 @@
for (int j1 = 0; j1 < list.size(); j1++)
@@ -600,15 +563,9 @@
}
riddenByEntity = null;
}
- if (fuel > 0)
- {
- fuel--;
- }
- if (fuel <= 0)
- {
- pushX = pushZ = 0.0D;
- }
- setMinecartPowered(fuel > 0);
+
+ updateFuel();
+ ForgeHooks.onMinecartUpdate(this, i, j, k);
+ }
}
public Vec3D func_182_g(double d, double d1, double d2)
@@ -623,12 +580,8 @@
int l = worldObj.getBlockId(i, j, k);
if (BlockRail.isRailBlock(l))
{
- int i1 = worldObj.getBlockMetadata(i, j, k);
+ int i1 = ((BlockRail)Block.blocksList[l]).getBasicRailMetadata(worldObj, this, i, j, k);
d1 = j;
- if (((BlockRail)Block.blocksList[l]).getIsPowered())
- {
- i1 &= 7;
- }
if (i1 >= 2 && i1 <= 5)
{
d1 = j + 1;
@@ -683,13 +636,14 @@
protected void writeEntityToNBT(NBTTagCompound nbttagcompound)
{
nbttagcompound.setInteger("Type", minecartType);
- if (minecartType == 2)
+ if (isPoweredCart())
{
nbttagcompound.setDouble("PushX", pushX);
nbttagcompound.setDouble("PushZ", pushZ);
- nbttagcompound.setShort("Fuel", (short)fuel);
+ nbttagcompound.setInteger("Fuel", fuel);
}
- else if (minecartType == 1)
+
+ if (getSizeInventory() > 0)
{
NBTTagList nbttaglist = new NBTTagList();
for (int i = 0; i < cargoItems.length; i++)
@@ -702,7 +656,6 @@
nbttaglist.setTag(nbttagcompound1);
}
}
-
nbttagcompound.setTag("Items", nbttaglist);
}
}
@@ -710,13 +663,14 @@
protected void readEntityFromNBT(NBTTagCompound nbttagcompound)
{
minecartType = nbttagcompound.getInteger("Type");
- if (minecartType == 2)
+ if (isPoweredCart())
{
pushX = nbttagcompound.getDouble("PushX");
pushZ = nbttagcompound.getDouble("PushZ");
- fuel = nbttagcompound.getShort("Fuel");
+ fuel = nbttagcompound.getInteger("Fuel");
}
- else if (minecartType == 1)
+
+ if (getSizeInventory() > 0)
{
NBTTagList nbttaglist = nbttagcompound.getTagList("Items");
cargoItems = new ItemStack[getSizeInventory()];
@@ -734,6 +688,13 @@
public void applyEntityCollision(Entity entity)
{
+ ForgeHooks.onMinecartEntityCollision(this, entity);
+
+ if (getCollisionHandler() != null)
+ {
+ getCollisionHandler().onEntityCollision(this, entity);
+ return;
+ }
if (worldObj.singleplayerWorld)
{
return;
@@ -742,7 +703,7 @@
{
return;
}
- if ((entity instanceof EntityLiving) && !(entity instanceof EntityPlayer) && minecartType == 0 && motionX * motionX + motionZ * motionZ > 0.01D && riddenByEntity == null && entity.ridingEntity == null)
+ if ((entity instanceof EntityLiving) && !(entity instanceof EntityPlayer) && canBeRidden() && motionX * motionX + motionZ * motionZ > 0.01D && riddenByEntity == null && entity.ridingEntity == null)
{
entity.mountEntity(this);
}
@@ -780,7 +741,7 @@
}
double d7 = entity.motionX + motionX;
double d8 = entity.motionZ + motionZ;
- if (((EntityMinecart)entity).minecartType == 2 && minecartType != 2)
+ if (((EntityMinecart)entity).isPoweredCart() && !isPoweredCart())
{
motionX *= 0.20000000298023224D;
motionZ *= 0.20000000298023224D;
@@ -788,7 +749,7 @@
entity.motionX *= 0.94999998807907104D;
entity.motionZ *= 0.94999998807907104D;
}
- else if (((EntityMinecart)entity).minecartType != 2 && minecartType == 2)
+ else if (!((EntityMinecart)entity).isPoweredCart() && isPoweredCart())
{
entity.motionX *= 0.20000000298023224D;
entity.motionZ *= 0.20000000298023224D;
@@ -818,7 +779,7 @@
public int getSizeInventory()
{
- return 27;
+ return (minecartType == 1 && getClass() == EntityMinecart.class ? 27 : 0);
}
public ItemStack getStackInSlot(int i)
@@ -874,7 +835,12 @@
public boolean interact(EntityPlayer entityplayer)
{
- if (minecartType == 0)
+ if (!ForgeHooks.onMinecartInteract(this, entityplayer))
+ {
+ return true;
+ }
+
+ if(canBeRidden())
{
if (riddenByEntity != null && (riddenByEntity instanceof EntityPlayer) && riddenByEntity != entityplayer)
{
@@ -885,14 +851,14 @@
entityplayer.mountEntity(this);
}
}
- else if (minecartType == 1)
+ else if (getSizeInventory() > 0)
{
if (!worldObj.singleplayerWorld)
{
entityplayer.displayGUIChest(this);
}
}
- else if (minecartType == 2)
+ else if (minecartType == 2 && getClass() == EntityMinecart.class)
{
ItemStack itemstack = entityplayer.inventory.getCurrentItem();
if (itemstack != null && itemstack.itemID == Item.coal.shiftedIndex)
@@ -918,7 +884,7 @@
return entityplayer.getDistanceSqToEntity(this) <= 64D;
}
- protected boolean isMinecartPowered()
+ public boolean isMinecartPowered()
{
return (dataWatcher.getWatchableObjectByte(16) & 1) != 0;
}
@@ -971,5 +937,384 @@
public int func_41021_q()
{
return dataWatcher.getWatchableObjectInt(18);
+ }
+
+ /**
+ * Carts should return their drag factor here
@ -455,7 +610,7 @@
+ int id = worldObj.getBlockId(i, j, k);
+ if (!BlockRail.isRailBlock(id))
+ {
+ return;
+ return;
+ }
+ float railMaxSpeed = ((BlockRail)Block.blocksList[id]).getRailMaxSpeed(worldObj, this, i, j, k);
+
@ -538,177 +693,24 @@
+ }
+ }
+
+ /**
+ * Moved to allow overrides.
+ * This code applies fuel consumption.
+ */
+ /**
+ * Moved to allow overrides.
+ * This code applies fuel consumption.
+ */
+ protected void updateFuel()
+ {
if(fuel > 0)
{
fuel--;
@@ -626,12 +769,8 @@
int l = worldObj.getBlockId(i, j, k);
if(BlockRail.isRailBlock(l))
{
- int i1 = worldObj.getBlockMetadata(i, j, k);
+ int i1 = ((BlockRail)Block.blocksList[l]).getBasicRailMetadata(worldObj, this, i, j, k);
d1 = j;
- if(((BlockRail)Block.blocksList[l]).getIsPowered())
- {
- i1 &= 7;
- }
if(i1 >= 2 && i1 <= 5)
{
d1 = j + 1;
@@ -684,13 +823,14 @@
protected void writeEntityToNBT(NBTTagCompound nbttagcompound)
{
nbttagcompound.setInteger("Type", minecartType);
- if(minecartType == 2)
+ if(isPoweredCart())
{
nbttagcompound.setDouble("PushX", pushX);
nbttagcompound.setDouble("PushZ", pushZ);
- nbttagcompound.setShort("Fuel", (short)fuel);
- } else
- if(minecartType == 1)
+ nbttagcompound.setInteger("Fuel", fuel);
+ }
+
+ if(getSizeInventory() > 0)
{
NBTTagList nbttaglist = new NBTTagList();
for(int i = 0; i < cargoItems.length; i++)
@@ -703,7 +843,6 @@
nbttaglist.setTag(nbttagcompound1);
}
}
-
nbttagcompound.setTag("Items", nbttaglist);
}
}
@@ -711,13 +850,14 @@
protected void readEntityFromNBT(NBTTagCompound nbttagcompound)
{
minecartType = nbttagcompound.getInteger("Type");
- if(minecartType == 2)
+ if(isPoweredCart())
{
pushX = nbttagcompound.getDouble("PushX");
pushZ = nbttagcompound.getDouble("PushZ");
- fuel = nbttagcompound.getShort("Fuel");
- } else
- if(minecartType == 1)
+ fuel = nbttagcompound.getInteger("Fuel");
+ if(fuel > 0)
+ {
+ fuel--;
+ }
+
+ if(getSizeInventory() > 0)
{
NBTTagList nbttaglist = nbttagcompound.getTagList("Items");
cargoItems = new ItemStack[getSizeInventory()];
@@ -730,12 +870,19 @@
cargoItems[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
}
}
-
}
}
public void applyEntityCollision(Entity entity)
{
+ ForgeHooks.onMinecartEntityCollision(this, entity);
+
+ if (getCollisionHandler() != null)
+ {
+ getCollisionHandler().onEntityCollision(this, entity);
+ return;
+ }
+
if(worldObj.singleplayerWorld)
{
return;
@@ -744,7 +891,7 @@
{
return;
}
- if((entity instanceof EntityLiving) && !(entity instanceof EntityPlayer) && minecartType == 0 && motionX * motionX + motionZ * motionZ > 0.01D && riddenByEntity == null && entity.ridingEntity == null)
+ if((entity instanceof EntityLiving) && !(entity instanceof EntityPlayer) && canBeRidden() && motionX * motionX + motionZ * motionZ > 0.01D && riddenByEntity == null && entity.ridingEntity == null)
{
entity.mountEntity(this);
}
@@ -782,7 +929,7 @@
}
double d7 = entity.motionX + motionX;
double d8 = entity.motionZ + motionZ;
- if(((EntityMinecart)entity).minecartType == 2 && minecartType != 2)
+ if(((EntityMinecart)entity).isPoweredCart() && !isPoweredCart())
{
motionX *= 0.20000000298023224D;
motionZ *= 0.20000000298023224D;
@@ -790,7 +937,7 @@
entity.motionX *= 0.94999998807907104D;
entity.motionZ *= 0.94999998807907104D;
} else
- if(((EntityMinecart)entity).minecartType != 2 && minecartType == 2)
+ if(!((EntityMinecart)entity).isPoweredCart() && isPoweredCart())
{
entity.motionX *= 0.20000000298023224D;
entity.motionZ *= 0.20000000298023224D;
@@ -818,7 +965,7 @@
public int getSizeInventory()
{
- return 27;
+ return (minecartType == 1 && getClass() == EntityMinecart.class ? 27 : 0);
}
public ItemStack getStackInSlot(int i)
@@ -873,7 +1020,12 @@
public boolean interact(EntityPlayer entityplayer)
{
- if(minecartType == 0)
+ if (!ForgeHooks.onMinecartInteract(this, entityplayer))
+ {
+ return true;
+ }
+
+ if(canBeRidden())
{
if(riddenByEntity != null && (riddenByEntity instanceof EntityPlayer) && riddenByEntity != entityplayer)
{
@@ -884,14 +1036,14 @@
entityplayer.mountEntity(this);
}
} else
- if(minecartType == 1)
+ if(getSizeInventory() > 0)
{
if(!worldObj.singleplayerWorld)
{
entityplayer.displayGUIChest(this);
}
} else
- if(minecartType == 2)
+ if(minecartType == 2 && getClass() == EntityMinecart.class)
{
ItemStack itemstack = entityplayer.inventory.getCurrentItem();
if(itemstack != null && itemstack.itemID == Item.coal.shiftedIndex)
@@ -917,7 +1069,7 @@
return entityplayer.getDistanceSqToEntity(this) <= 64D;
}
- protected boolean isMinecartPowered()
+ public boolean isMinecartPowered()
{
return (dataWatcher.getWatchableObjectByte(16) & 1) != 0;
}
@@ -970,5 +1122,203 @@
{
return dataWatcher.getWatchableObjectInt(18);
}
+ if(fuel <= 0)
+ {
+ pushX = pushZ = 0.0D;
+ }
+ setMinecartPowered(fuel > 0);
+ }
+
+
+ /**
+ * Drops the cart as a item. The exact item dropped is defined by getItemDropped().
+ */
@ -833,7 +835,7 @@
+ */
+ public static IMinecartCollisionHandler getCollisionHandler()
+ {
+ return collisionHandler;
+ return collisionHandler;
+ }
+
+ /**
@ -843,7 +845,7 @@
+ */
+ public static void setCollisionHandler(IMinecartCollisionHandler handler)
+ {
+ collisionHandler = handler;
+ collisionHandler = handler;
+ }
+
+ /**
@ -862,49 +864,49 @@
+ {
+ return maxSpeedRail;
+ }
+
+ public void setMaxSpeedRail(float value)
+ {
+ maxSpeedRail = value;
+ maxSpeedRail = value;
+ }
+
+ public float getMaxSpeedGround()
+ {
+ return maxSpeedGround;
+ return maxSpeedGround;
+ }
+
+ public void setMaxSpeedGround(float value)
+ {
+ maxSpeedGround = value;
+ maxSpeedGround = value;
+ }
+
+ public float getMaxSpeedAirLateral()
+ {
+ return maxSpeedAirLateral;
+ return maxSpeedAirLateral;
+ }
+
+ public void setMaxSpeedAirLateral(float value)
+ {
+ maxSpeedAirLateral = value;
+ maxSpeedAirLateral = value;
+ }
+
+ public float getMaxSpeedAirVertical()
+ {
+ return maxSpeedAirVertical;
+ return maxSpeedAirVertical;
+ }
+
+ public void setMaxSpeedAirVertical(float value)
+ {
+ maxSpeedAirVertical = value;
+ maxSpeedAirVertical = value;
+ }
+
+ public double getDragAir()
+ {
+ return dragAir;
+ return dragAir;
+ }
+
+ public void setDragAir(double value)
+ {
+ dragAir = value;
+ }
+ dragAir = value;
}
}

View file

@ -1,6 +1,6 @@
--- ../src_base/minecraft_server/net/minecraft/src/EntityPigZombie.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/EntityPigZombie.java 0000-00-00 00:00:00.000000000 -0000
@@ -94,7 +94,7 @@
@@ -90,7 +90,7 @@
return super.attackEntityFrom(damagesource, i);
}

View file

@ -1,25 +1,25 @@
--- ../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 @@
@@ -2,6 +2,10 @@
import java.util.*;
+import net.minecraft.src.forge.ArmorProperties;
+import net.minecraft.src.forge.ISpecialArmor;
+import net.minecraft.src.forge.ForgeHooks;
+import net.minecraft.src.forge.ISpecialArmor;
+
// Referenced classes of package net.minecraft.src:
// EntityLiving, InventoryPlayer, FoodStats, PlayerCapabilities,
// ContainerPlayer, World, ChunkCoordinates, DataWatcher,
@@ -142,6 +146,7 @@
clearItemInUse();
} else
public abstract class EntityPlayer extends EntityLiving
{
public InventoryPlayer inventory;
@@ -124,6 +128,7 @@
}
else
{
+ itemInUse.getItem().onUsingItemTick(itemInUse,this,itemInUseCount);
if(itemInUseCount <= 25 && itemInUseCount % 4 == 0)
+ itemInUse.getItem().onUsingItemTick(itemInUse,this,itemInUseCount);
if (itemInUseCount <= 25 && itemInUseCount % 4 == 0)
{
func_35208_b(itemstack, 5);
@@ -447,7 +452,16 @@
@@ -433,7 +438,16 @@
public void dropCurrentItem()
{
@ -37,16 +37,16 @@
}
public void dropPlayerItem(ItemStack itemstack)
@@ -493,6 +507,8 @@
@@ -480,6 +494,8 @@
worldObj.spawnEntityInWorld(entityitem);
}
+ /* FORGE: This isnt called anymore
+ */
+ /* FORGE: This isnt called anymore, There is a new metadata sensitive version */
+ @Deprecated
public float getCurrentPlayerStrVsBlock(Block block)
{
float f = inventory.getStrVsBlock(block);
@@ -521,6 +537,45 @@
@@ -508,6 +524,45 @@
return f1;
}
@ -92,50 +92,52 @@
public boolean canHarvestBlock(Block block)
{
return inventory.canHarvestBlock(block);
@@ -719,6 +774,25 @@
@@ -707,6 +762,26 @@
protected void damageEntity(DamageSource damagesource, int i)
{
+ boolean doRegularComputation = true;
+ int initialDamage = i;
+
+ for (ItemStack stack : inventory.armorInventory) {
+ if (stack != null && stack.getItem() instanceof ISpecialArmor) {
+ ISpecialArmor armor = (ISpecialArmor) stack.getItem();
+
+ ArmorProperties props = armor.getProperties(this, initialDamage, i);
+ i = i - props.damageRemove;
+ doRegularComputation = doRegularComputation
+ && props.allowRegularComputation;
+ }
+ }
+
+ if (!doRegularComputation) {
+ super.damageEntity(damagesource, i);
+ return;
+ }
+
if(!damagesource.isUnblockable() && isBlocking())
+ boolean doRegularComputation = true;
+ int initialDamage = i;
+
+ for (ItemStack stack : inventory.armorInventory)
+ {
+ if (stack != null && stack.getItem() instanceof ISpecialArmor)
+ {
+ ISpecialArmor armor = (ISpecialArmor) stack.getItem();
+ ArmorProperties props = armor.getProperties(this, initialDamage, i);
+ i = i - props.damageRemove;
+ doRegularComputation = doRegularComputation && props.allowRegularComputation;
+ }
+ }
+
+ if (!doRegularComputation)
+ {
+ super.damageEntity(damagesource, i);
+ return;
+ }
+
if (!damagesource.isUnblockable() && isBlocking())
{
i = 1 + i >> 1;
@@ -770,7 +844,9 @@
@@ -758,7 +833,9 @@
public void destroyCurrentEquippedItem()
{
+ ItemStack orig=inventory.getCurrentItem();
+ ItemStack orig=inventory.getCurrentItem();
inventory.setInventorySlotContents(inventory.currentItem, null);
+ ForgeHooks.onDestroyCurrentItem(this,orig);
+ ForgeHooks.onDestroyCurrentItem(this, orig);
}
public double getYOffset()
@@ -896,6 +972,10 @@
@@ -884,6 +961,11 @@
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)
+ EnumStatus customSleep = ForgeHooks.sleepInBedAt(this, i, j, k);
+ if (customSleep != null)
+ {
+ return customSleep;
+ }
if (!worldObj.singleplayerWorld)
{
if(isPlayerSleeping() || !isEntityAlive())
if (isPlayerSleeping() || !isEntityAlive())

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