Skip to content

Commit

Permalink
Fix patch the correct version of Optifine!!
Browse files Browse the repository at this point in the history
  • Loading branch information
StellaArtois committed Feb 19, 2016
1 parent 7384b7a commit e6678a1
Show file tree
Hide file tree
Showing 14 changed files with 104 additions and 35 deletions.
13 changes: 8 additions & 5 deletions applychanges.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,24 +53,27 @@ def merge_tree(root_src_dir, root_dst_dir):
shutil.copy(src_file, dst_dir)


def applychanges(mcp_dir, patch_dir = "patches", backup = True, copyOriginal=True, mergeInNew=True ):
def applychanges(mcp_dir, patch_dir = "patches", applyPatches=True, backup = True, copyOriginal=True, origDir='.minecraft_orig', mergeInNew=True ):
print("Applying Changes...")

mod_src_dir = os.path.join(mcp_dir, "src","minecraft")
mod_bak_dir = os.path.join(mcp_dir, "src","minecraft-bak")
org_src_dir = os.path.join(mcp_dir, "src",".minecraft_orig")
org_src_dir = os.path.join(mcp_dir, "src",origDir)

if backup and os.path.exists(mod_src_dir):
print("Backing up src/minecraft to src/minecraft-bak")
shutil.rmtree( mod_bak_dir, True )
shutil.move( mod_src_dir, mod_bak_dir )

if copyOriginal:
shutil.copytree( org_src_dir, mod_src_dir, ignore=lambda p,f: [".git"] )

#apply patches
apply_patches( mcp_dir, os.path.join( base_dir, patch_dir ), mod_src_dir )
#merge in the new classes
if applyPatches:
#apply patches
apply_patches( mcp_dir, os.path.join( base_dir, patch_dir ), mod_src_dir )

if mergeInNew:
#merge in the new classes
merge_tree( os.path.join( base_dir, "src" ), mod_src_dir )

if __name__ == '__main__':
Expand Down
2 changes: 2 additions & 0 deletions copyfilteredfiles.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@echo off
python copyfilteredfiles.py %*
60 changes: 60 additions & 0 deletions copyfilteredfiles.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import os
import shutil
from optparse import OptionParser

def create_relative_file_list(dir_path):

file_list = []
for root, _, files in os.walk(dir_path):
for file in files:
relative_file_path = os.path.join(os.path.relpath(root, dir_path), file).replace('.patch', '')
print ' ' + relative_file_path
file_list.append(relative_file_path)

print '%d File(s)' % len(file_list)
return file_list


def copy_filtered_files(filter_dir, sourceDir, destDir, cleanDest):

if cleanDest:
# clean dest dir
print 'Cleaning dest: %s' % destDir
shutil.rmtree(destDir, ignore_errors=True)

# create filter list
print 'Filter list:'
relative_filter = create_relative_file_list(filter_dir)


# walk the (relative path) file filter list, copy files
print 'Copy files:'
for file in relative_filter:

# create absolute paths
src_file = os.path.join(sourceDir, file)
dest_file = os.path.join(destDir, file)

# copy 'em
if os.path.exists(src_file):
dest_dir = os.path.dirname(dest_file)
if not os.path.exists(dest_dir):
os.makedirs(dest_dir)
print ' %s -> %s' % (src_file, dest_file)
shutil.copyfile(src_file, dest_file)


if __name__ == "__main__":
parser = OptionParser()
parser.add_option('-f', '--filter',dest='filterDir',action='store',default=None,help='Directory to create file filter from')
parser.add_option('-s', '--source',dest='sourceDir',action='store',default=None,help='Source directory to copy (filtered) files from')
parser.add_option('-d', '--dest',dest='destDir',action='store',default=None,help='Destination directory to copy (filtered) files to')
parser.add_option('-c', '--cleandest',dest='cleanDest',action='store_true',default=False,help='Clean destination directory first')
options,_= parser.parse_args()

filterDir = options.filterDir
sourceDir = options.sourceDir
destDir = options.destDir
cleanDest = options.cleanDest

copy_filtered_files(filterDir, sourceDir, destDir, cleanDest)
2 changes: 2 additions & 0 deletions copyfilteredfiles.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
python copyfilteredfiles.py $@
20 changes: 11 additions & 9 deletions install.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,11 +517,11 @@ def main(mcp_dir):

os.chdir( base_dir )

# Create original decompile src dir
org_src_dir = os.path.join(mcp_dir, "src",".minecraft_orig")
if os.path.exists( org_src_dir ):
shutil.rmtree( org_src_dir, True )
shutil.copytree( src_dir, org_src_dir )
# Create original nofix decompile src dir
org_no_fix_src_dir = os.path.join(mcp_dir, "src",".minecraft_orig_nofix")
if os.path.exists( org_no_fix_src_dir ):
shutil.rmtree( org_no_fix_src_dir, True )
shutil.copytree( src_dir, org_no_fix_src_dir )

if nocompilefixpatch == False:
compile_error_patching_done = False
Expand Down Expand Up @@ -552,10 +552,12 @@ def main(mcp_dir):
updatemd5( None, True, True, False )
os.chdir( base_dir )

# Now re-create the .minecraft_orig with the new buildable state
if os.path.exists( org_src_dir ):
shutil.rmtree( org_src_dir, True )
shutil.copytree( src_dir, org_src_dir )

# Create original (fixed) decompile src dir
org_src_dir = os.path.join(mcp_dir, "src",".minecraft_orig")
if os.path.exists( org_src_dir ):
shutil.rmtree( org_src_dir, True )
shutil.copytree( src_dir, org_src_dir )

if nopatch == False:
# Patch stage 2: Now apply our main Minecrift patches, only
Expand Down
2 changes: 1 addition & 1 deletion installer/1.7.10-forge-nohydra.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"minecraftArguments": "--username ${auth_player_name} --version ${version_name} --gameDir ${game_directory} --assetsDir ${assets_root} --assetIndex ${assets_index_name} --uuid ${auth_uuid} --accessToken ${auth_access_token} --userProperties ${user_properties} --userType ${user_type} --tweakClass cpw.mods.fml.common.launcher.FMLTweaker --tweakClass optifine.OptiFineForgeTweaker --tweakClass com.mtbs3d.minecrift.tweaker.MinecriftForgeTweaker",
"libraries": [
{
"name": "optifine:OptiFine:1.7.10_HD_D1"
"name": "optifine:OptiFine:1.7.10_HD_U_D1"
},
{
"name": "net.minecraftforge:forge:1.7.10-10.13.4.1614-1.7.10",
Expand Down
2 changes: 1 addition & 1 deletion installer/1.7.10-forge.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"minecraftArguments": "--username ${auth_player_name} --version ${version_name} --gameDir ${game_directory} --assetsDir ${assets_root} --assetIndex ${assets_index_name} --uuid ${auth_uuid} --accessToken ${auth_access_token} --userProperties ${user_properties} --userType ${user_type} --tweakClass cpw.mods.fml.common.launcher.FMLTweaker --tweakClass optifine.OptiFineForgeTweaker --tweakClass com.mtbs3d.minecrift.tweaker.MinecriftForgeTweaker",
"libraries": [
{
"name": "optifine:OptiFine:1.7.10_HD_D1"
"name": "optifine:OptiFine:1.7.10_HD_U_D1"
},
{
"name": "net.minecraftforge:forge:1.7.10-10.13.4.1614-1.7.10",
Expand Down
2 changes: 1 addition & 1 deletion installer/1.7.10-nohydra.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"minecraftArguments": "--username ${auth_player_name} --version ${version_name} --gameDir ${game_directory} --assetsDir ${assets_root} --assetIndex ${assets_index_name} --uuid ${auth_uuid} --accessToken ${auth_access_token} --userProperties ${user_properties} --userType ${user_type} --tweakClass optifine.OptiFineTweaker",
"libraries": [
{
"name": "optifine:OptiFine:1.7.10_HD_D1"
"name": "optifine:OptiFine:1.7.10_HD_U_D1"
},
{
"name": "org.ow2.asm:asm-all:5.0.3"
Expand Down
2 changes: 1 addition & 1 deletion installer/1.7.10.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"minecraftArguments": "--username ${auth_player_name} --version ${version_name} --gameDir ${game_directory} --assetsDir ${assets_root} --assetIndex ${assets_index_name} --uuid ${auth_uuid} --accessToken ${auth_access_token} --userProperties ${user_properties} --userType ${user_type} --tweakClass optifine.OptiFineTweaker",
"libraries": [
{
"name": "optifine:OptiFine:1.7.10_HD_D1"
"name": "optifine:OptiFine:1.7.10_HD_U_D1"
},
{
"name": "org.ow2.asm:asm-all:5.0.3"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
--- a/net/minecraft/client/renderer/EntityRenderer.java
+++ b/net/minecraft/client/renderer/EntityRenderer.java
@@ -241,7 +241,6 @@
@@ -242,7 +242,6 @@
private boolean lastShowDebugInfo = false;
private boolean showExtendedDebugInfo = false;
private long lastErrorCheckTimeMs = 0L;
- private static final String __OBFID = "CL_00000947";

public EntityRenderer(Minecraft p_i45076_1_, IResourceManager p_i45076_2_)
{
@@ -1390,41 +1389,26 @@
@@ -1391,41 +1390,26 @@
var11.addCrashSectionCallable("Screen name", new Callable()
{
private static final String __OBFID = "CL_00000948";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
--- a/net/minecraft/client/renderer/RenderGlobal.java
+++ b/net/minecraft/client/renderer/RenderGlobal.java
@@ -264,7 +264,6 @@
@@ -265,7 +265,6 @@
private long lastMovedTime = System.currentTimeMillis();
private long lastActionTime = System.currentTimeMillis();
private static AxisAlignedBB AABB_INFINITE = AxisAlignedBB.getBoundingBox(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);
- private static final String __OBFID = "CL_00000954";

public RenderGlobal(Minecraft par1Minecraft)
{
@@ -1817,7 +1816,7 @@
@@ -1821,7 +1820,7 @@
float var19 = this.theWorld.provider.getCloudHeight() - var21 + 0.33F;
var19 += this.mc.gameSettings.ofCloudsHeight * 128.0F;
float var20 = (float)(dc * (double)var10);
Expand All @@ -17,7 +17,7 @@
var5.startDrawingQuads();
var5.setColorRGBA_F(exactPlayerX, var8, exactPlayerY, 0.8F);

@@ -1825,10 +1824,10 @@
@@ -1829,10 +1828,10 @@
{
for (int var23 = -var3 * var4; var23 < var3 * var4; var23 += var3)
{
Expand All @@ -32,7 +32,7 @@
}
}

@@ -2501,15 +2500,10 @@
@@ -2509,15 +2508,10 @@
var16.addCrashSectionCallable("Position", new Callable()
{
private static final String __OBFID = "CL_00000955";
Expand All @@ -48,7 +48,7 @@
});
throw new ReportedException(var15);
}
@@ -2532,7 +2526,7 @@
@@ -2540,7 +2534,7 @@
double var15 = this.mc.renderViewEntity.posX - par2;
double var17 = this.mc.renderViewEntity.posY - par4;
double var19 = this.mc.renderViewEntity.posZ - par6;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
--- a/net/minecraft/client/renderer/texture/TextureMap.java
+++ b/net/minecraft/client/renderer/texture/TextureMap.java
@@ -66,7 +66,6 @@
@@ -67,7 +67,6 @@
private double iconGridSizeV;
private static final boolean ENABLE_SKIP = Boolean.parseBoolean(System.getProperty("fml.skipFirstTextureLoad", "true"));
private boolean skipFirst;
- private static final String __OBFID = "CL_00001058";

public TextureMap(int par1, String par2Str)
{
@@ -265,41 +264,26 @@
@@ -267,41 +266,26 @@
var261.addCrashSectionCallable("Sprite name", new Callable()
{
private static final String __OBFID = "CL_00001059";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
--- a/net/minecraft/client/settings/GameSettings.java
+++ b/net/minecraft/client/settings/GameSettings.java
@@ -45,7 +45,6 @@
@@ -49,7 +49,6 @@
private static final ParameterizedType typeListString = new ParameterizedType()
{
private static final String __OBFID = "CL_00000651";
- private static final String __OBFID = "CL_00000651";
public Type[] getActualTypeArguments()
{
return new Type[] {String.class};
@@ -271,7 +270,6 @@
@@ -275,7 +274,6 @@
public String language;
public boolean forceUnicodeFont;
private static final String __OBFID = "CL_00000650";
- private static final String __OBFID = "CL_00000650";

public GameSettings(Minecraft par1Minecraft, File par2File)
{
@@ -3054,7 +3052,6 @@
@@ -3072,7 +3070,6 @@
ANISOTROPIC_FILTERING("ANISOTROPIC_FILTERING", 32, "ANISOTROPIC_FILTERING", 32, "options.anisotropicFiltering", true, false, 1.0F, 16.0F, 0.0F, (Object)null, null)
{
private static final String __OBFID = "CL_00000654";
- private static final String __OBFID = "CL_00000654";
protected float snapToStep(float p_148264_1_)
{
return (float)MathHelper.roundUpToPowerOfTwo((int)p_148264_1_);
@@ -3146,7 +3143,7 @@
@@ -3164,7 +3161,7 @@
private static final String __OBFID = "CL_00000653";

private static final GameSettings.Options[] $VALUES$ = new GameSettings.Options[]{INVERT_MOUSE, SENSITIVITY, FOV, GAMMA, SATURATION, RENDER_DISTANCE, VIEW_BOBBING, ANAGLYPH, ADVANCED_OPENGL, FRAMERATE_LIMIT, FBO_ENABLE, DIFFICULTY, GRAPHICS, AMBIENT_OCCLUSION, GUI_SCALE, RENDER_CLOUDS, PARTICLES, CHAT_VISIBILITY, CHAT_COLOR, CHAT_LINKS, CHAT_OPACITY, CHAT_LINKS_PROMPT, SNOOPER_ENABLED, USE_FULLSCREEN, ENABLE_VSYNC, SHOW_CAPE, TOUCHSCREEN, CHAT_SCALE, CHAT_WIDTH, CHAT_HEIGHT_FOCUSED, CHAT_HEIGHT_UNFOCUSED, MIPMAP_LEVELS, ANISOTROPIC_FILTERING, FORCE_UNICODE_FONT, STREAM_BYTES_PER_PIXEL, STREAM_VOLUME_MIC, STREAM_VOLUME_SYSTEM, STREAM_KBPS, STREAM_FPS, STREAM_COMPRESSION, STREAM_SEND_METADATA, STREAM_CHAT_ENABLED, STREAM_CHAT_USER_FILTER, STREAM_MIC_TOGGLE_BEHAVIOR, FOG_FANCY, FOG_START, MIPMAP_TYPE, LOAD_FAR, PRELOADED_CHUNKS, SMOOTH_FPS, CLOUDS, CLOUD_HEIGHT, TREES, GRASS, RAIN, WATER, ANIMATED_WATER, ANIMATED_LAVA, ANIMATED_FIRE, ANIMATED_PORTAL, AO_LEVEL, LAGOMETER, SHOW_FPS, AUTOSAVE_TICKS, BETTER_GRASS, ANIMATED_REDSTONE, ANIMATED_EXPLOSION, ANIMATED_FLAME, ANIMATED_SMOKE, WEATHER, SKY, STARS, SUN_MOON, VIGNETTE, CHUNK_UPDATES, CHUNK_UPDATES_DYNAMIC, TIME, CLEAR_WATER, SMOOTH_WORLD, DEPTH_FOG, VOID_PARTICLES, WATER_PARTICLES, RAIN_SPLASH, PORTAL_PARTICLES, POTION_PARTICLES, PROFILER, DRIPPING_WATER_LAVA, BETTER_SNOW, FULLSCREEN_MODE, ANIMATED_TERRAIN, ANIMATED_ITEMS, SWAMP_COLORS, RANDOM_MOBS, SMOOTH_BIOMES, CUSTOM_FONTS, CUSTOM_COLORS, SHOW_CAPES, CONNECTED_TEXTURES, AA_LEVEL, ANIMATED_TEXTURES, NATURAL_TEXTURES, CHUNK_LOADING, HELD_ITEM_TOOLTIPS, DROPPED_ITEMS, LAZY_CHUNK_LOADING, CUSTOM_SKY, FAST_MATH, FAST_RENDER, TRANSLUCENT_BLOCKS};
Expand All @@ -33,7 +33,7 @@

public static GameSettings.Options getEnumOptions(int par0)
{
@@ -3252,7 +3249,6 @@
@@ -3270,7 +3267,6 @@
{
static final int[] optionIds = new int[GameSettings.Options.values().length];
private static final String __OBFID = "CL_00000652";
Expand Down
6 changes: 3 additions & 3 deletions minecriftversion.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
mc_version = "1.7.10"
mc_file_md5 = "e6b7a531b95d0c172acb704d1f54d1b3"
of_file_name = "1.7.10_HD_D1"
of_json_name = "1.7.10_HD_D1"
of_file_md5 = "b30db7148ee79b26a865889815f5d8a1"
of_file_name = "1.7.10_HD_U_D1"
of_json_name = "1.7.10_HD_U_D1"
of_file_md5 = "57c724fe8335c82aef8d54c101043e60"
minecrift_version_num = "1.7.10"
minecrift_build = "R2"
of_file_extension = ".jar"
Expand Down

0 comments on commit e6678a1

Please sign in to comment.