Skip to content

Commit 2b97e5d

Browse files
committed
Порт на 1.12.2
1 parent 04c2524 commit 2b97e5d

File tree

5 files changed

+55
-31
lines changed

5 files changed

+55
-31
lines changed

build.gradle

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ buildscript {
77
}
88
}
99
dependencies {
10-
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
10+
classpath 'net.minecraftforge.gradle:ForgeGradle:3.+'
1111
}
1212
}
1313

14-
apply plugin: 'forge'
14+
apply plugin: 'net.minecraftforge.gradle'
1515
apply plugin: 'idea'
1616

1717
idea {
@@ -22,26 +22,55 @@ idea {
2222
}
2323

2424
minecraft {
25-
version = '1.7.10-10.13.4.1614-1.7.10'
26-
runDir = 'minecraft'
25+
// The mappings can be changed at any time, and must be in the following format.
26+
// snapshot_YYYYMMDD Snapshot are built nightly.
27+
// stable_# Stables are built at the discretion of the MCP team.
28+
mappings channel: 'snapshot', version: '20171003-1.12'
29+
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
30+
31+
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
32+
33+
// Default run configurations.
34+
// These can be tweaked, removed, or duplicated as needed.
35+
runs {
36+
client {
37+
workingDirectory project.file('minecraft')
38+
39+
// Recommended logging data for a userdev environment
40+
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
41+
42+
// Recommended logging level for the console
43+
property 'forge.logging.console.level', 'debug'
44+
}
45+
}
46+
}
47+
48+
dependencies {
49+
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
50+
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
51+
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
52+
minecraft 'net.minecraftforge:forge:1.12.2-14.23.5.2860'
2753
}
2854

2955
// Project settings
30-
archivesBaseName = 'FontFix'
3156
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
3257

33-
tasks.withType(JavaCompile) {
58+
tasks.withType(JavaCompile).configureEach {
3459
options.encoding = 'UTF-8'
3560
}
3661

3762
jar {
3863
manifest {
3964
attributes 'FMLCorePlugin': 'com.gamerforea.fontfix.LoadingPlugin'
65+
attributes 'FMLCorePluginContainsFMLMod': 'true'
4066
}
4167
}
4268

43-
task devJar(type: Jar) {
44-
classifier = 'dev'
69+
// This is the preferred method to reobfuscate your jar file
70+
jar.finalizedBy('reobfJar')
71+
72+
tasks.register('devJar', Jar) {
73+
archiveClassifier.set('dev')
4574
manifest = jar.manifest
4675
from sourceSets.main.output
4776
}

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Project
22
group=com.gamerforea
3-
version=1.7.10
3+
version=1.12.2
44

55
# Repositories
6-
minecraftforge.repository.url=https://files.minecraftforge.net/maven
6+
minecraftforge.repository.url=https://maven.minecraftforge.net/

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
33
zipStoreBase=GRADLE_USER_HOME
44
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip

src/main/java/com/gamerforea/fontfix/ASMTransformer.java

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,17 @@ public class ASMTransformer implements IClassTransformer {
1818
@Override
1919
public byte[] transform(String name, String transformedName, byte[] bytes) {
2020
switch (name) {
21-
case "bbu":
21+
case "bip":
2222
case "net.minecraft.client.gui.FontRenderer":
2323
return patchFontRenderer(bytes);
24-
case "brs":
24+
case "cfb":
2525
return patchLocale(bytes, true);
2626
case "net.minecraft.client.resources.Locale":
2727
return patchLocale(bytes, false);
2828
case "net.minecraft.client.Minecraft":
2929
return patchMinecraft(bytes, false);
30-
case "bao":
30+
case "bib":
3131
return patchMinecraft(bytes, true);
32-
case "cofh.core.ProxyClient":
33-
case "cofh.lib.render.RenderHelper":
34-
case "buildcraft.silicon.render.PackageFontRenderer":
35-
case "blusunrize.immersiveengineering.client.IEManualInstance":
36-
return patchMods(bytes);
3732
}
3833
return bytes;
3934
}
@@ -64,12 +59,12 @@ private byte[] patchFontRenderer(byte[] bytes) {
6459
private byte[] patchLocale(byte[] bytes, boolean obf) {
6560
ClassNode clazz = Utils.readClass(bytes);
6661

67-
final Type classMc = Utils.getObjectType(obf ? "bao" : "net.minecraft.client.Minecraft");
68-
final Type classSettings = Utils.getObjectType(obf ? "bbj" : "net.minecraft.client.settings.GameSettings");
69-
final Type classLocale = Utils.getObjectType(obf ? "brs" : "net.minecraft.client.resources.Locale");
62+
final Type classMc = Utils.getObjectType(obf ? "bib" : "net.minecraft.client.Minecraft");
63+
final Type classSettings = Utils.getObjectType(obf ? "bid" : "net.minecraft.client.settings.GameSettings");
64+
final Type classLocale = Utils.getObjectType(obf ? "cfb" : "net.minecraft.client.resources.Locale");
7065
final String findMethod = obf ? "a" : "isUnicode";
71-
final String getMinecraft = obf ? "B" : "getMinecraft";
72-
final String gameSettings = obf ? "u" : "gameSettings";
66+
final String getMinecraft = obf ? "z" : "getMinecraft";
67+
final String gameSettings = obf ? "t" : "gameSettings";
7368

7469
for (MethodNode method : clazz.methods) {
7570
if (method.name.equals(findMethod) && method.desc.equals(Type.getMethodDescriptor(Type.BOOLEAN_TYPE))) {
@@ -79,16 +74,16 @@ private byte[] patchLocale(byte[] bytes, boolean obf) {
7974
list.add(new VarInsnNode(ASTORE, 1));
8075
list.add(new VarInsnNode(ALOAD, 1));
8176
list.add(new FieldInsnNode(GETFIELD, classMc.getInternalName(), gameSettings, classSettings.getDescriptor()));
82-
list.add(new FieldInsnNode(GETFIELD, classSettings.getInternalName(), obf ? "aK" : "language", Type.getType(String.class).getDescriptor()));
77+
list.add(new FieldInsnNode(GETFIELD, classSettings.getInternalName(), obf ? "aJ" : "language", Type.getType(String.class).getDescriptor()));
8378
list.add(new LdcInsnNode("ru_RU"));
8479
list.add(new MethodInsnNode(INVOKEVIRTUAL, Type.getInternalName(String.class), "equals", Type.getMethodDescriptor(Type.BOOLEAN_TYPE, Type.getType(Object.class)), false));
8580
list.add(new MethodInsnNode(INVOKESTATIC, classMc.getInternalName(), getMinecraft, Type.getMethodDescriptor(classMc), false));
8681
list.add(new FieldInsnNode(GETFIELD, classMc.getInternalName(), gameSettings, classSettings.getDescriptor()));
87-
list.add(new FieldInsnNode(GETFIELD, classSettings.getInternalName(), obf ? "aL" : "forceUnicodeFont", Type.BOOLEAN_TYPE.getDescriptor()));
82+
list.add(new FieldInsnNode(GETFIELD, classSettings.getInternalName(), obf ? "aK" : "forceUnicodeFont", Type.BOOLEAN_TYPE.getDescriptor()));
8883
list.add(new InsnNode(IRETURN));
8984
list.add(new FrameNode(F_APPEND, 1, new Object[]{classMc.getInternalName()}, 0, null));
9085
list.add(new VarInsnNode(ALOAD, 0));
91-
list.add(new FieldInsnNode(GETFIELD, classLocale.getInternalName(), obf ? "d" : "field_135029_d", Type.BOOLEAN_TYPE.getDescriptor()));
86+
list.add(new FieldInsnNode(GETFIELD, classLocale.getInternalName(), obf ? "d" : "unicode", Type.BOOLEAN_TYPE.getDescriptor()));
9287
list.add(new InsnNode(IRETURN));
9388

9489
method.instructions = list;
@@ -102,8 +97,8 @@ private byte[] patchLocale(byte[] bytes, boolean obf) {
10297

10398
private byte[] patchMinecraft(byte[] bytes, boolean obf) {
10499
ClassNode clazz = Utils.readClass(bytes);
105-
final Type fondRenderer = Utils.getObjectType(obf ? "bbu" : "net.minecraft.client.gui.FontRenderer");
106-
final String mStartGame = obf ? "ag" : "startGame";
100+
final Type fondRenderer = Utils.getObjectType(obf ? "bip" : "net.minecraft.client.gui.FontRenderer");
101+
final String mStartGame = obf ? "aq" : "init";
107102

108103
for (MethodNode method : clazz.methods) {
109104
if (method.name.equals(mStartGame) && method.desc.equals(Type.getMethodDescriptor(Type.VOID_TYPE))) {

src/main/java/com/gamerforea/fontfix/LoadingPlugin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package com.gamerforea.fontfix;
22

33
import java.util.Map;
4-
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
54
import net.minecraft.launchwrapper.Launch;
5+
import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin;
66
import org.apache.logging.log4j.LogManager;
77
import org.apache.logging.log4j.Logger;
88

9-
@IFMLLoadingPlugin.MCVersion("1.7.10")
9+
@IFMLLoadingPlugin.MCVersion("1.12.2")
1010
@IFMLLoadingPlugin.SortingIndex(900) // Obf
1111
public class LoadingPlugin implements IFMLLoadingPlugin {
1212

0 commit comments

Comments
 (0)