New script to fix decompile differences between windows and linux/osx.
Removed the MLProp special case, no longer needed as MLProp decompiles fine. Updated patches to work on all systems. Added warning and exit if the user does not say yes to the cleanup.
This commit is contained in:
parent
9acdb5b620
commit
91ab9d0e1b
11 changed files with 78 additions and 66 deletions
|
@ -1,12 +0,0 @@
|
|||
package net.minecraft.src;
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface MLProp {
|
||||
String name() default "";
|
||||
String info() default "";
|
||||
double min() default Double.NEGATIVE_INFINITY;
|
||||
double max() default Double.POSITIVE_INFINITY;
|
||||
public int reobf() default 0;
|
||||
}
|
24
forge/clean_src.py
Normal file
24
forge/clean_src.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
import re, os, shutil, sys, fnmatch
|
||||
|
||||
if __name__ == '__main__':
|
||||
print "Cleaning trailing zeros from source files"
|
||||
trailing = re.compile(r'(?P<full>[0-9]+\.(?P<decimal>[0-9]+?)0)(?P<type>[Dd])')
|
||||
for path, _, filelist in os.walk(sys.argv[1], followlinks=True):
|
||||
for cur_file in fnmatch.filter(filelist, '*.java'):
|
||||
src_file = os.path.normpath(os.path.join(path, cur_file))
|
||||
tmp_file = src_file + '.tmp'
|
||||
with open(src_file, 'r') as fh:
|
||||
buf = fh.read()
|
||||
|
||||
|
||||
def strip_zeros_match(match):
|
||||
ret = match.group('full').rstrip('0')
|
||||
if ret[-1] == '.':
|
||||
ret += '0'
|
||||
return ret
|
||||
|
||||
buf = trailing.sub(strip_zeros_match, buf) #Strip trailing zeroes: 1.0040D -> 1.004D
|
||||
|
||||
with open(tmp_file, 'w') as fh:
|
||||
fh.write(buf)
|
||||
shutil.move(tmp_file, src_file)
|
|
@ -18,14 +18,16 @@ pushd .. >nul
|
|||
xcopy /Y /E /I forge\conf\* conf
|
||||
|
||||
runtime\bin\python\python_mcp runtime\cleanup.py
|
||||
if exist ".\src" (
|
||||
echo Please make sure to backup your modified files, and say yes when it asks you to do cleanup.
|
||||
exit 1
|
||||
)
|
||||
runtime\bin\python\python_mcp runtime\decompile.py
|
||||
runtime\bin\python\python_mcp forge\clean_src.py src
|
||||
|
||||
pushd src >nul
|
||||
|
||||
if exist ..\jars\bin\minecraft.jar (
|
||||
del minecraft\net\minecraft\src\MLProp.java
|
||||
copy ..\forge\MLProp.java minecraft\net\minecraft\src\MLProp.java
|
||||
|
||||
for /f "delims=" %%a in ('dir /a -d /b /S ..\forge\patches\minecraft') do (
|
||||
pushd "%%a" 2>nul
|
||||
if errorlevel 1 (
|
||||
|
@ -37,9 +39,6 @@ pushd src >nul
|
|||
)
|
||||
|
||||
if exist ..\jars\minecraft_server.jar (
|
||||
del minecraft_server\net\minecraft\src\MLProp.java
|
||||
copy ..\forge\MLProp.java minecraft_server\net\minecraft\src\MLProp.java
|
||||
|
||||
for /f "delims=" %%a in ('dir /a -d /b /S ..\forge\patches\minecraft_server') do (
|
||||
pushd "%%a" 2>nul
|
||||
if errorlevel 1 (
|
||||
|
|
|
@ -10,8 +10,8 @@ fi
|
|||
|
||||
if [ ! -f ../runtime/bin/fernflower.jar ]
|
||||
then
|
||||
echo "Failed to download fernflower, install it manually and re-run setup."
|
||||
exit 1
|
||||
echo "Failed to download fernflower, install it manually and re-run setup."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
pushd .. > /dev/null
|
||||
|
@ -21,13 +21,17 @@ mkdir conf
|
|||
cp -r forge/conf/* conf
|
||||
|
||||
./cleanup.sh
|
||||
if [ -d "src" ]
|
||||
then
|
||||
echo "Failed to cleanup the MCP folder, please backup your modified files and run this script again and say yes when promped."
|
||||
exit 1
|
||||
fi
|
||||
./decompile.sh
|
||||
python forge/clean_src.py src
|
||||
|
||||
pushd src > /dev/null
|
||||
if [ -f ../jars/bin/minecraft.jar ];
|
||||
then
|
||||
cp ../forge/MLProp.java minecraft/net/minecraft/src/MLProp.java
|
||||
|
||||
for i in `find ../forge/patches/minecraft/ -type f`
|
||||
do
|
||||
patch -p2 -i $i
|
||||
|
@ -38,10 +42,6 @@ pushd src > /dev/null
|
|||
|
||||
if [ -f ../jars/minecraft_server.jar ];
|
||||
then
|
||||
cp ../forge/MLProp.java minecraft_server/net/minecraft/src/MLProp.java
|
||||
|
||||
patch -p2 -i ../forge/modLoaderMP.patch
|
||||
|
||||
for i in `find ../forge/patches/minecraft_server/ -type f`
|
||||
do
|
||||
patch -p2 -i $i
|
||||
|
|
|
@ -63,10 +63,10 @@ cp -r ../forge_common/* src/minecraft_server
|
|||
cp -r ../patches/* patches
|
||||
cp -r ../conf/* conf
|
||||
cp ../lfcr.py .
|
||||
cp ../clean_src.py .
|
||||
cp ../install/install.cmd .
|
||||
cp ../install/install.sh .
|
||||
cp ../download_fernflower.py .
|
||||
cp ../MLProp.java .
|
||||
cp ../install/README.txt .
|
||||
cp ../minecraftforge_credits.txt .
|
||||
cp -r ../doc .
|
||||
|
|
|
@ -293,16 +293,20 @@
|
|||
|
||||
Vec3D var52 = this.func_514_g(this.posX, this.posY, this.posZ);
|
||||
|
||||
@@ -513,29 +445,14 @@
|
||||
@@ -512,30 +444,15 @@
|
||||
}
|
||||
|
||||
double var41;
|
||||
|
||||
-
|
||||
- if (this.minecartType == 2)
|
||||
- {
|
||||
+
|
||||
+ updatePushForces();
|
||||
+
|
||||
+ if(shouldDoRailFunctions())
|
||||
{
|
||||
- var41 = (double)MathHelper.sqrt_double(this.pushX * this.pushX + this.pushZ * this.pushZ);
|
||||
+ updatePushForces();
|
||||
|
||||
- if (var41 > 0.01D && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.0010D)
|
||||
-
|
||||
- if (var41 > 0.01D && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.001D)
|
||||
- {
|
||||
- this.pushX /= var41;
|
||||
- this.pushZ /= var41;
|
||||
|
@ -318,8 +322,6 @@
|
|||
- this.pushZ = this.motionZ;
|
||||
- }
|
||||
- }
|
||||
+ if(shouldDoRailFunctions())
|
||||
+ {
|
||||
+ ((BlockRail)Block.blocksList[var8]).onMinecartPass(worldObj, this, var1, var2, var3);
|
||||
}
|
||||
|
||||
|
|
|
@ -293,20 +293,24 @@
|
|||
|
||||
Vec3D var52 = this.func_182_g(this.posX, this.posY, this.posZ);
|
||||
|
||||
@@ -500,29 +438,14 @@
|
||||
@@ -499,30 +437,15 @@
|
||||
}
|
||||
|
||||
double var41;
|
||||
|
||||
-
|
||||
- if (this.minecartType == 2)
|
||||
- {
|
||||
+
|
||||
+ updatePushForces();
|
||||
+
|
||||
+ if(shouldDoRailFunctions())
|
||||
{
|
||||
- var41 = (double)MathHelper.sqrt_double(this.pushX * this.pushX + this.pushZ * this.pushZ);
|
||||
-
|
||||
- if (var41 > 0.01D && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.0010D)
|
||||
- if (var41 > 0.01D && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.001D)
|
||||
- {
|
||||
- this.pushX /= var41;
|
||||
- this.pushZ /= var41;
|
||||
+ updatePushForces();
|
||||
|
||||
-
|
||||
- if (this.pushX * this.motionX + this.pushZ * this.motionZ < 0.0D)
|
||||
- {
|
||||
- this.pushX = 0.0D;
|
||||
|
@ -318,8 +322,6 @@
|
|||
- this.pushZ = this.motionZ;
|
||||
- }
|
||||
- }
|
||||
+ if (shouldDoRailFunctions())
|
||||
+ {
|
||||
+ ((BlockRail)Block.blocksList[var8]).onMinecartPass(worldObj, this, var1, var2, var3);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
{
|
||||
this.playerEntity.itemInWorldManager.activeBlockOrUseItem(this.playerEntity, var2, var3, var5, var6, var7, var8);
|
||||
}
|
||||
@@ -761,9 +767,10 @@
|
||||
@@ -764,9 +770,10 @@
|
||||
*/
|
||||
public void handleRespawn(Packet9Respawn par1Packet9Respawn)
|
||||
{
|
||||
|
@ -46,7 +46,7 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
@@ -772,7 +779,7 @@
|
||||
@@ -775,7 +782,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -960,4 +966,49 @@
|
||||
@@ -960,4 +967,49 @@
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
@cmd /C build.bat
|
||||
|
||||
if %ERRORLEVEL% NEQ 0 exit 1
|
||||
|
||||
@cd ..
|
||||
|
||||
@echo | cmd /C reobfuscate.bat
|
||||
|
|
|
@ -14,22 +14,15 @@ pushd .. >nul
|
|||
exit 1
|
||||
)
|
||||
rmdir /S /Q src
|
||||
@echo | cmd /C decompile.bat
|
||||
@echo | cmd /C decompile.bat -r
|
||||
)
|
||||
|
||||
|
||||
rmdir /S /Q src_base
|
||||
rmdir /S /Q src_work
|
||||
|
||||
pushd src >nul
|
||||
del minecraft\net\minecraft\src\MLProp.java
|
||||
copy ..\forge\MLProp.java minecraft\net\minecraft\src\MLProp.java
|
||||
del minecraft_server\net\minecraft\src\MLProp.java
|
||||
copy ..\forge\MLProp.java minecraft_server\net\minecraft\src\MLProp.java
|
||||
popd >nul
|
||||
.\runtime\bin\python\python_mcp forge\clean_src.py src
|
||||
|
||||
@echo | cmd /C updatemd5.bat -f
|
||||
|
||||
rmdir /S /Q src_base
|
||||
rmdir /S /Q src_work
|
||||
mkdir src_base
|
||||
mkdir src_work
|
||||
|
||||
|
|
|
@ -34,14 +34,7 @@ rm -rf src src_work src_forge
|
|||
|
||||
if [ ! -d src_base ] ; then
|
||||
./decompile.sh
|
||||
pushd src > /dev/null
|
||||
|
||||
find . -name *.java -exec sed -i 's/\r//g' \{\} \;
|
||||
cp ../forge/MLProp.java minecraft/net/minecraft/src/MLProp.java
|
||||
cp ../forge/MLProp.java minecraft_server/net/minecraft/src/MLProp.java
|
||||
|
||||
popd > /dev/null
|
||||
|
||||
python forge/clean_src.py src
|
||||
mv src src_base
|
||||
fi
|
||||
|
||||
|
@ -49,10 +42,19 @@ cp -a src_base src_work
|
|||
pushd src_work > /dev/null
|
||||
for i in `find ../forge/patches/ -type f -name \*.patch`
|
||||
do
|
||||
patch -p2 -i $i
|
||||
patch -p2 -i $i
|
||||
done
|
||||
popd > /dev/null
|
||||
|
||||
echo "!!! WARNING !!!"
|
||||
echo
|
||||
echo "This is an extra step for Eloraam, only say yes if you are her"
|
||||
echo
|
||||
|
||||
read -p "Continue (y/n)? " var
|
||||
|
||||
if [ "$var" != "y" ]; then exit ; fi
|
||||
|
||||
cp -a src_work src_forge
|
||||
|
||||
cp -a forge/forge_client/src/net/* src_forge/minecraft/net/
|
||||
|
|
Loading…
Reference in a new issue