Commit 1e1dbf4540b79792372c3bb03b9816a830ab856d

Authored by Mumfrey
2 parents ebb3c2be 36e210a0

Merge branch 'mixin'

Showing 78 changed files with 2390 additions and 985 deletions
.gitignore
... ... @@ -2,7 +2,6 @@
2 2 #########
3 3 MANIFEST.MF
4 4 dependency-reduced-pom.xml
5   -.checkstyle
6 5  
7 6 # Compiled #
8 7 ############
... ... @@ -19,7 +18,6 @@ target
19 18 *.exe
20 19 *.o
21 20 *.so
22   -*.launch
23 21  
24 22 # Databases #
25 23 #############
... ... @@ -55,9 +53,12 @@ target
55 53 .DS_Store
56 54 ehthumbs.db
57 55 Thumbs.db
  56 +*.bat
  57 +*.sh
58 58  
59 59 # Project #
60 60 ###########
  61 +.checkstyle
61 62 .classpath
62 63 .externalToolBuilders
63 64 .gradle
... ... @@ -73,4 +74,5 @@ nb-configuration.xml
73 74 *.iml
74 75 *.ipr
75 76 *.iws
  77 +*.launch
76 78  
... ...
build.gradle
1 1 buildscript {
2 2 repositories {
  3 + jcenter()
3 4 mavenLocal()
4 5 mavenCentral()
5 6 maven {
... ... @@ -13,38 +14,62 @@ buildscript {
13 14 }
14 15 dependencies {
15 16 classpath 'net.minecraftforge.gradle:ForgeGradle:2.0-SNAPSHOT'
  17 + classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.0'
  18 + classpath 'org.spongepowered:mixingradle:0.1-SNAPSHOT'
16 19 }
17 20 }
18 21  
19 22 apply plugin: 'net.minecraftforge.gradle.tweaker-client'
20 23 apply plugin: 'checkstyle'
21 24 apply plugin: 'maven'
  25 +apply plugin: 'com.github.johnrengelman.shadow'
  26 +apply plugin: 'org.spongepowered.mixin'
22 27  
23   -// Artefact details
24   -ext.buildNumber = project.hasProperty("buildNumber") ? buildNumber : '0'
25   -ext.ciSystem = project.hasProperty("ciSystem") ? ciSystem : 'unknown'
26   -ext.commit = project.hasProperty("commit") ? commit : 'unknown'
27   -ext.classifier = project.hasProperty("buildType") ? buildType : 'SNAPSHOT'
28   -ext.isReleaseBuild = "RELEASE".equals(project.classifier.toUpperCase())
29   -ext.mavenRepo = project.isReleaseBuild ? "mavenUrl" : "mavenSnapshotUrl"
  28 +// Default tasks
  29 +defaultTasks 'build'
  30 +
  31 +ext {
  32 + // Artefact details
  33 + buildNumber = project.hasProperty("buildNumber") ? buildNumber : '0'
  34 + buildVersion = project.hasProperty("buildVersion") ? buildVersion : '0.0'
  35 + ciSystem = project.hasProperty("ciSystem") ? ciSystem : 'unknown'
  36 + commit = project.hasProperty("commit") ? commit : 'unknown'
  37 + classifier = project.hasProperty("buildType") ? buildType : 'SNAPSHOT'
  38 + isReleaseBuild = "RELEASE".equals(project.classifier.toUpperCase())
  39 + mavenRepo = project.isReleaseBuild ? "mavenUrl" : "mavenSnapshotUrl"
  40 +
  41 + // Extended project information
  42 + projectName = 'LiteLoader'
  43 + inceptionYear = '2012'
  44 + packaging = 'jar'
  45 +
  46 + startClass = 'com.mumfrey.liteloader.debug.Start'
  47 + tweakClass = 'com.mumfrey.liteloader.launch.LiteLoaderTweaker'
  48 +}
30 49  
31 50 // Basic project information
32 51 group = "com.mumfrey"
33 52 archivesBaseName = "liteloader"
34 53 version = buildVersion + (project.isReleaseBuild ? '' : '-' + project.classifier)
35 54  
36   -// Extended project information
37   -ext.projectName = 'LiteLoader'
38   -ext.inceptionYear = '2012'
39   -ext.packaging = 'jar'
40   -
41   -ext.startClass = 'com.mumfrey.liteloader.debug.Start'
42   -ext.tweakClass = 'com.mumfrey.liteloader.launch.LiteLoaderTweaker'
43   -
44 55 // Minimum version of Java required
45 56 sourceCompatibility = '1.6'
46 57 targetCompatibility = '1.6'
47 58  
  59 +repositories {
  60 + maven {
  61 + name = 'sponge'
  62 + url = 'https://repo.spongepowered.org/maven/'
  63 + }
  64 +}
  65 +
  66 +dependencies {
  67 + compile('org.spongepowered:mixin:0.4.11-SNAPSHOT') {
  68 + exclude module: 'launchwrapper'
  69 + exclude module: 'guava'
  70 + }
  71 +}
  72 +
48 73 minecraft {
49 74 version = project.mcVersion
50 75 mappings = project.mcMappings
... ... @@ -53,20 +78,28 @@ minecraft {
53 78 }
54 79  
55 80 sourceSets {
  81 + main {
  82 + refMap = "mixins.liteloader.core.refmap.json"
  83 + }
56 84 client {
57 85 compileClasspath += main.compileClasspath + main.output
  86 + refMap = "mixins.liteloader.client.refmap.json"
58 87 }
59 88 debug {
60 89 compileClasspath += client.compileClasspath + client.output
61 90 }
62 91 }
63 92  
  93 +mixin {
  94 + defaultObfuscationEnv notch
  95 +}
  96 +
64 97 checkstyle {
65 98 configProperties = [
66   - "name" : project.name,
67   - "organization": project.organization,
68   - "url" : project.url,
69   - "year" : project.inceptionYear
  99 + "name" : project.name,
  100 + "organization": project.organization,
  101 + "url" : project.url,
  102 + "year" : project.inceptionYear
70 103 ]
71 104 configFile = file("checkstyle.xml")
72 105 toolVersion = '6.13'
... ... @@ -77,8 +110,19 @@ javadoc {
77 110 source sourceSets.debug.allJava
78 111 }
79 112  
80   -// hacks for run configs
81 113 afterEvaluate {
  114 + logger.lifecycle '================================================='
  115 + logger.lifecycle ' LiteLoader'
  116 + logger.lifecycle ' Copyright (C) 2011-2016 Adam Mummery-Smith'
  117 + logger.lifecycle ' Running in {} mode', (project.isReleaseBuild ? "RELEASE" : "SNAPSHOT")
  118 + logger.lifecycle '================================================='
  119 +
  120 + makeEclipseCleanRunClient {
  121 + arguments = ""
  122 + jvmArguments = "-Dliteloader.debug=true -Dmixin.debug.verbose=true -Dmixin.debug.verify=true"
  123 + }
  124 +
  125 + // hacks for run configs
82 126 def mc = plugins.getPlugin 'net.minecraftforge.gradle.tweaker-client'
83 127 mc.replacer.putReplacement '{RUN_CLIENT_MAIN}', project.startClass
84 128 mc.replacer.putReplacement '{RUN_CLIENT_TWEAKER}', minecraft.tweakClass
... ... @@ -96,6 +140,14 @@ def jarManifest = {
96 140 }
97 141  
98 142 jar {
  143 + doFirst {
  144 + // Seriously forge?
  145 + ant.replace(
  146 + file: sourceSets.main.refMapFile,
  147 + token: "func_72355_a(Lnet/minecraft/network/NetworkManager;Lnet/minecraft/entity/player/EntityPlayerMP;)V",
  148 + value: "initializeConnectionToPlayer(Lnet/minecraft/network/NetworkManager;Lnet/minecraft/entity/player/EntityPlayerMP;Lnet/minecraft/network/NetHandlerPlayServer;)V"
  149 + )
  150 + }
99 151 from sourceSets.client.output
100 152 from sourceSets.debug.output
101 153 manifest jarManifest
... ... @@ -104,10 +156,38 @@ jar {
104 156 task releaseJar(type: Jar) {
105 157 from sourceSets.main.output
106 158 from sourceSets.client.output
  159 +
107 160 manifest jarManifest
  161 + classifier = 'staging'
  162 +}
  163 +
  164 +shadowJar {
  165 + manifest jarManifest
  166 + dependsOn 'reobfReleaseJar'
  167 +
  168 + from sourceSets.main.output
  169 + from sourceSets.client.output
  170 +
  171 + exclude 'META-INF/*.DSA'
  172 + exclude 'META-INF/*.RSA'
  173 + exclude 'dummyThing'
  174 + exclude 'LICENSE.txt'
  175 +
  176 + dependencies {
  177 + include(dependency('org.spongepowered:mixin'))
  178 + }
  179 +
108 180 classifier = 'release'
109 181 }
110 182  
  183 +sourceJar {
  184 + dependsOn retromapReplacedDebug
  185 + dependsOn retromapReplacedClient
  186 +
  187 + from zipTree(tasks.retromapReplacedDebug.out)
  188 + from zipTree(tasks.retromapReplacedClient.out)
  189 +}
  190 +
111 191 task javadocJar(type: Jar, dependsOn: javadoc) {
112 192 from javadoc.destinationDir
113 193 classifier = 'javadoc'
... ... @@ -122,7 +202,12 @@ task runClient(type: JavaExec, overwrite: true) {
122 202 }
123 203  
124 204 tasks.withType(JavaCompile) {
125   - options.compilerArgs += ['-Xlint:all', '-Xlint:-path', '-Xlint:-rawtypes']
  205 + options.compilerArgs += [
  206 + '-Xlint:all',
  207 + '-Xlint:-path',
  208 + '-Xlint:-rawtypes',
  209 + '-Xlint:-processing'
  210 + ]
126 211 options.deprecation = true
127 212 options.encoding = 'utf8'
128 213 }
... ... @@ -136,31 +221,39 @@ if (JavaVersion.current().isJava8Compatible()) {
136 221  
137 222 reobf {
138 223 jar {
139   - useSrgSrg()
  224 + mappingType = 'SEARGE'
140 225 }
141 226 releaseJar {
142   - useNotchSrg()
  227 + mappingType = 'NOTCH'
  228 + classpath = sourceSets.main.compileClasspath
  229 + }
  230 + shadowJar {
  231 + mappingType = 'NOTCH'
143 232 classpath = sourceSets.main.compileClasspath
144 233 }
145 234 }
146 235  
147   -compileJava.doFirst {
148   - println '------------------------------------------------------------'
149   - println 'Running ' + (project.isReleaseBuild ? "RELEASE" : "SNAPSHOT") + ' build'
150   - println '------------------------------------------------------------'
151   -}
152   -
153   -build.dependsOn "reobfReleaseJar"
  236 +build.dependsOn {[
  237 + 'reobfReleaseJar',
  238 + 'reobfShadowJar'
  239 +]}
154 240  
155 241 artifacts {
156 242 if (project.isReleaseBuild) {
157 243 archives jar
158 244 }
159   - archives releaseJar
  245 + archives shadowJar
160 246 archives sourceJar
161 247 archives javadocJar
162 248 }
163 249  
  250 +task deploy(type: Copy, dependsOn: build) {
  251 + def libraryDir = new File(new File(System.env.APPDATA), ".minecraft/libraries")
  252 + from shadowJar.outputs.files[0]
  253 + into new File(libraryDir, sprintf('%1$s%4$s%2$s%4$s%3$s', project.group.replace('.', File.separator), archivesBaseName, buildVersion, File.separatorChar))
  254 + rename shadowJar.outputs.files[0].name, sprintf("%s-%s.jar", archivesBaseName, buildVersion)
  255 +}
  256 +
164 257 uploadArchives {
165 258 repositories {
166 259 mavenDeployer {
... ...
extra/formatter.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2 +<profiles version="12">
  3 +<profile kind="CodeFormatterProfile" name="LiteLoader" version="12">
  4 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
  5 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
  6 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="insert"/>
  7 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
  8 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
  9 +<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
  10 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
  11 +<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="insert"/>
  12 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/>
  13 +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
  14 +<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
  15 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
  16 +<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
  17 +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
  18 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
  19 +<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="false"/>
  20 +<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
  21 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
  22 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
  23 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
  24 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
  25 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" value="insert"/>
  26 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
  27 +<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
  28 +<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
  29 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="0"/>
  30 +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
  31 +<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
  32 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" value="insert"/>
  33 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
  34 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
  35 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
  36 +<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/>
  37 +<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/>
  38 +<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
  39 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
  40 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
  41 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
  42 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
  43 +<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
  44 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
  45 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
  46 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value="insert"/>
  47 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
  48 +<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
  49 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
  50 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
  51 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
  52 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
  53 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
  54 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
  55 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
  56 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
  57 +<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="true"/>
  58 +<setting id="org.eclipse.jdt.core.compiler.problem.enumIdentifier" value="error"/>
  59 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
  60 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
  61 +<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
  62 +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="next_line"/>
  63 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
  64 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
  65 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
  66 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
  67 +<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="80"/>
  68 +<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="true"/>
  69 +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
  70 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
  71 +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
  72 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
  73 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
  74 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
  75 +<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="true"/>
  76 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
  77 +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="next_line"/>
  78 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
  79 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/>
  80 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
  81 +<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
  82 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="insert"/>
  83 +<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
  84 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression" value="16"/>
  85 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
  86 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
  87 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
  88 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
  89 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
  90 +<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
  91 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
  92 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
  93 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
  94 +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="next_line"/>
  95 +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="next_line"/>
  96 +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_lambda_body" value="end_of_line"/>
  97 +<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
  98 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
  99 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
  100 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
  101 +<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
  102 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
  103 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
  104 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
  105 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
  106 +<setting id="org.eclipse.jdt.core.compiler.problem.assertIdentifier" value="error"/>
  107 +<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
  108 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="insert"/>
  109 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/>
  110 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
  111 +<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
  112 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
  113 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator" value="insert"/>
  114 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
  115 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
  116 +<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="true"/>
  117 +<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
  118 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
  119 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
  120 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/>
  121 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
  122 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
  123 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
  124 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
  125 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="insert"/>
  126 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
  127 +<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="false"/>
  128 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
  129 +<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
  130 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
  131 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="insert"/>
  132 +<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
  133 +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
  134 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
  135 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
  136 +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/>
  137 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
  138 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
  139 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
  140 +<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
  141 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
  142 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/>
  143 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
  144 +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="next_line"/>
  145 +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="next_line"/>
  146 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
  147 +<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
  148 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
  149 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
  150 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
  151 +<setting id="org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode" value="enabled"/>
  152 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
  153 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/>
  154 +<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="false"/>
  155 +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
  156 +<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
  157 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
  158 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
  159 +<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
  160 +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="next_line"/>
  161 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
  162 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/>
  163 +<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="true"/>
  164 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
  165 +<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
  166 +<setting id="org.eclipse.jdt.core.compiler.source" value="1.8"/>
  167 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
  168 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
  169 +<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
  170 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant" value="insert"/>
  171 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
  172 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
  173 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
  174 +<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
  175 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
  176 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/>
  177 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/>
  178 +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
  179 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
  180 +<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
  181 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
  182 +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
  183 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
  184 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
  185 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
  186 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
  187 +<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="1.8"/>
  188 +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="next_line"/>
  189 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
  190 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
  191 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation" value="do not insert"/>
  192 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
  193 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
  194 +<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
  195 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
  196 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
  197 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
  198 +<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="true"/>
  199 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
  200 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
  201 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
  202 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="16"/>
  203 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
  204 +<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/>
  205 +<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
  206 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="insert"/>
  207 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
  208 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
  209 +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
  210 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="do not insert"/>
  211 +<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
  212 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
  213 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
  214 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
  215 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
  216 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
  217 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
  218 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
  219 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
  220 +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
  221 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
  222 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
  223 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
  224 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
  225 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
  226 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration" value="insert"/>
  227 +<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
  228 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
  229 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
  230 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
  231 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
  232 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/>
  233 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
  234 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
  235 +<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="false"/>
  236 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow" value="insert"/>
  237 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
  238 +<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="true"/>
  239 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
  240 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="0"/>
  241 +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
  242 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
  243 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
  244 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
  245 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
  246 +<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
  247 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
  248 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
  249 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
  250 +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
  251 +<setting id="org.eclipse.jdt.core.formatter.wrap_before_binary_operator" value="true"/>
  252 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
  253 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
  254 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
  255 +<setting id="org.eclipse.jdt.core.compiler.compliance" value="1.8"/>
  256 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
  257 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
  258 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
  259 +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
  260 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
  261 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
  262 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
  263 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
  264 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
  265 +<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/>
  266 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="do not insert"/>
  267 +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="next_line"/>
  268 +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="next_line"/>
  269 +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
  270 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
  271 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
  272 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
  273 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
  274 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
  275 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
  276 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
  277 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
  278 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
  279 +<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
  280 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" value="insert"/>
  281 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
  282 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
  283 +<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/>
  284 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
  285 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
  286 +<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="true"/>
  287 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="insert"/>
  288 +<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
  289 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
  290 +<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
  291 +<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="150"/>
  292 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
  293 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
  294 +</profile>
  295 +</profiles>
... ...
extra/liteloader.importorder 0 → 100644
  1 +#Organize Import Order
  2 +#Wed Dec 02 11:57:04 GMT 2015
  3 +4=com
  4 +3=org
  5 +2=javax
  6 +1=java
  7 +0=\#
... ...
src/client/java/com/mumfrey/liteloader/client/CallbackProxyClient.java deleted 100644 → 0
1   -package com.mumfrey.liteloader.client;
2   -
3   -import java.io.File;
4   -import java.util.UUID;
5   -
6   -import net.minecraft.client.Minecraft;
7   -import net.minecraft.client.entity.EntityPlayerSP;
8   -import net.minecraft.client.gui.GuiIngame;
9   -import net.minecraft.client.renderer.EntityRenderer;
10   -import net.minecraft.client.renderer.OpenGlHelper;
11   -import net.minecraft.client.renderer.RenderGlobal;
12   -import net.minecraft.client.renderer.entity.Render;
13   -import net.minecraft.client.renderer.entity.RenderManager;
14   -import net.minecraft.client.shader.Framebuffer;
15   -import net.minecraft.entity.Entity;
16   -import net.minecraft.entity.player.EntityPlayer;
17   -import net.minecraft.server.integrated.IntegratedServer;
18   -import net.minecraft.util.IChatComponent;
19   -import net.minecraft.util.ScreenShotHelper;
20   -import net.minecraft.util.Session;
21   -import net.minecraft.world.WorldSettings;
22   -
23   -import com.mojang.authlib.GameProfile;
24   -import com.mumfrey.liteloader.core.CallbackProxyCommon;
25   -import com.mumfrey.liteloader.transformers.event.EventInfo;
26   -import com.mumfrey.liteloader.transformers.event.ReturnEventInfo;
27   -
28   -/**
29   - * Proxy class which handles the redirected calls from the injected callbacks
30   - * and routes them to the relevant liteloader handler classes. We do this rather
31   - * than patching a bunch of bytecode into the packet classes themselves because
32   - * this is easier to maintain.
33   - *
34   - * @author Adam Mummery-Smith
35   - */
36   -public abstract class CallbackProxyClient extends CallbackProxyCommon
37   -{
38   - private static LiteLoaderEventBrokerClient clientEventBroker;
39   -
40   - private static boolean fboEnabled;
41   -
42   - private static boolean renderingFBO;
43   -
44   - private CallbackProxyClient() {}
45   -
46   - public static void onStartupComplete(EventInfo<Minecraft> e)
47   - {
48   - CallbackProxyCommon.onStartupComplete();
49   -
50   - CallbackProxyClient.clientEventBroker = LiteLoaderEventBrokerClient.getInstance();
51   -
52   - if (CallbackProxyClient.clientEventBroker == null)
53   - {
54   - throw new RuntimeException("LiteLoader failed to start up properly."
55   - + " The game is in an unstable state and must shut down now. Check the developer log for startup errors");
56   - }
57   -
58   - CallbackProxyClient.clientEventBroker.onStartupComplete();
59   - }
60   -
61   - public static void onTimerUpdate(EventInfo<Minecraft> e)
62   - {
63   - CallbackProxyClient.clientEventBroker.onTimerUpdate();
64   - }
65   -
66   - public static void newTick(EventInfo<Minecraft> e)
67   - {
68   - }
69   -
70   - public static void onTick(EventInfo<Minecraft> e)
71   - {
72   - CallbackProxyClient.clientEventBroker.onTick();
73   - }
74   -
75   - public static void onRender(EventInfo<Minecraft> e)
76   - {
77   - CallbackProxyClient.clientEventBroker.onRender();
78   - }
79   -
80   - public static void preRenderGUI(EventInfo<EntityRenderer> e, float partialTicks)
81   - {
82   - CallbackProxyClient.clientEventBroker.preRenderGUI(partialTicks);
83   - }
84   -
85   - public static void onSetupCameraTransform(EventInfo<EntityRenderer> e, int pass, float partialTicks, long timeSlice)
86   - {
87   - CallbackProxyClient.clientEventBroker.onSetupCameraTransform(pass, partialTicks, timeSlice);
88   - }
89   -
90   - public static void postRenderEntities(EventInfo<EntityRenderer> e, int pass, float partialTicks, long timeSlice)
91   - {
92   - CallbackProxyClient.clientEventBroker.postRenderEntities(partialTicks, timeSlice);
93   - }
94   -
95   - public static void postRender(EventInfo<EntityRenderer> e, float partialTicks, long timeSlice)
96   - {
97   - CallbackProxyClient.clientEventBroker.postRender(partialTicks, timeSlice);
98   - }
99   -
100   - public static void onRenderHUD(EventInfo<EntityRenderer> e, float partialTicks)
101   - {
102   - CallbackProxyClient.clientEventBroker.onRenderHUD(partialTicks);
103   - }
104   -
105   - public static void onRenderChat(EventInfo<GuiIngame> e, float partialTicks)
106   - {
107   - CallbackProxyClient.clientEventBroker.onRenderChat(e.getSource().getChatGUI(), partialTicks);
108   - }
109   -
110   - public static void postRenderChat(EventInfo<GuiIngame> e, float partialTicks)
111   - {
112   - CallbackProxyClient.clientEventBroker.postRenderChat(e.getSource().getChatGUI(), partialTicks);
113   - }
114   -
115   - public static void postRenderHUD(EventInfo<EntityRenderer> e, float partialTicks)
116   - {
117   - CallbackProxyClient.clientEventBroker.postRenderHUD(partialTicks);
118   - }
119   -
120   - public static void IntegratedServerCtor(EventInfo<IntegratedServer> e, Minecraft minecraft, String folderName, String worldName,
121   - WorldSettings worldSettings)
122   - {
123   - CallbackProxyClient.clientEventBroker.onStartServer(e.getSource(), folderName, worldName, worldSettings);
124   - }
125   -
126   - public static void onOutboundChat(EventInfo<EntityPlayerSP> e, String message)
127   - {
128   - CallbackProxyClient.clientEventBroker.onSendChatMessage(e, message);
129   - }
130   -
131   - public static void onResize(EventInfo<Minecraft> e)
132   - {
133   - if (CallbackProxyClient.clientEventBroker == null) return;
134   - CallbackProxyClient.clientEventBroker.onResize(e.getSource());
135   - }
136   -
137   - public static void preRenderFBO(EventInfo<Minecraft> e)
138   - {
139   - if (CallbackProxyClient.clientEventBroker == null) return;
140   - CallbackProxyClient.fboEnabled = OpenGlHelper.isFramebufferEnabled();
141   -
142   - if (CallbackProxyClient.fboEnabled)
143   - {
144   - CallbackProxyClient.renderingFBO = true;
145   - CallbackProxyClient.clientEventBroker.preRenderFBO(e.getSource().getFramebuffer());
146   - }
147   - }
148   -
149   - public static void postRenderFBO(EventInfo<Minecraft> e)
150   - {
151   - if (CallbackProxyClient.clientEventBroker == null) return;
152   - CallbackProxyClient.renderingFBO = false;
153   -
154   - if (CallbackProxyClient.fboEnabled)
155   - {
156   - CallbackProxyClient.clientEventBroker.postRenderFBO(e.getSource().getFramebuffer());
157   - }
158   - }
159   -
160   - public static void renderFBO(EventInfo<Framebuffer> e, int width, int height, boolean flag)
161   - {
162   - if (CallbackProxyClient.clientEventBroker == null) return;
163   - if (CallbackProxyClient.renderingFBO)
164   - {
165   - CallbackProxyClient.clientEventBroker.onRenderFBO(e.getSource(), width, height);
166   - }
167   -
168   - CallbackProxyClient.renderingFBO = false;
169   - }
170   -
171   - public static void onRenderWorld(EventInfo<EntityRenderer> e, float partialTicks, long timeSlice)
172   - {
173   - CallbackProxyClient.clientEventBroker.onRenderWorld(partialTicks, timeSlice);
174   - }
175   -
176   - public static void onRenderSky(EventInfo<EntityRenderer> e, int pass, float partialTicks, long timeSlice)
177   - {
178   - CallbackProxyClient.clientEventBroker.onRenderSky(partialTicks, pass, timeSlice);
179   - }
180   -
181   - public static void onRenderClouds(EventInfo<EntityRenderer> e, RenderGlobal renderGlobalIn, float partialTicks, int pass)
182   - {
183   - CallbackProxyClient.clientEventBroker.onRenderClouds(partialTicks, pass, renderGlobalIn);
184   - }
185   -
186   - public static void onRenderTerrain(EventInfo<EntityRenderer> e, int pass, float partialTicks, long timeSlice)
187   - {
188   - CallbackProxyClient.clientEventBroker.onRenderTerrain(partialTicks, pass, timeSlice);
189   - }
190   -
191   - public static void onSaveScreenshot(ReturnEventInfo<ScreenShotHelper, IChatComponent> e, File gameDir, String name, int width, int height,
192   - Framebuffer fbo)
193   - {
194   - CallbackProxyClient.clientEventBroker.onScreenshot(e, name, width, height, fbo);
195   - }
196   -
197   - public static void onRenderEntity(ReturnEventInfo<RenderManager, Boolean> e, Entity entity, double xPos, double yPos, double zPos, float yaw,
198   - float partialTicks, boolean hideBoundingBox, Render render)
199   - {
200   - CallbackProxyClient.clientEventBroker.onRenderEntity(e.getSource(), entity, xPos, yPos, zPos, yaw, partialTicks, render);
201   - }
202   -
203   - public static void onPostRenderEntity(ReturnEventInfo<RenderManager, Boolean> e, Entity entity, double xPos, double yPos, double zPos, float yaw,
204   - float partialTicks, boolean hideBoundingBox, Render render)
205   - {
206   - CallbackProxyClient.clientEventBroker.onPostRenderEntity(e.getSource(), entity, xPos, yPos, zPos, yaw, partialTicks, render);
207   - }
208   -
209   - /**
210   - * Compatiblbe behaviour with FML, this method is called to generate a
211   - * consistent offline UUID between client and server for a given username.
212   - */
213   - public static void generateOfflineUUID(ReturnEventInfo<Session, GameProfile> e)
214   - {
215   - Session session = e.getSource();
216   - UUID uuid = EntityPlayer.getUUID(new GameProfile((UUID)null, session.getUsername()));
217   - e.setReturnValue(new GameProfile(uuid, session.getUsername()));
218   - }
219   -}
src/client/java/com/mumfrey/liteloader/client/ClientPluginChannelsClient.java
1 1 package com.mumfrey.liteloader.client;
2 2  
  3 +import com.mumfrey.liteloader.client.ducks.IClientNetLoginHandler;
  4 +import com.mumfrey.liteloader.core.ClientPluginChannels;
  5 +import com.mumfrey.liteloader.core.exceptions.UnregisteredChannelException;
  6 +
3 7 import net.minecraft.client.Minecraft;
4   -import net.minecraft.client.network.NetHandlerLoginClient;
5 8 import net.minecraft.network.INetHandler;
6 9 import net.minecraft.network.NetworkManager;
7 10 import net.minecraft.network.PacketBuffer;
... ... @@ -12,10 +15,6 @@ import net.minecraft.network.play.client.C17PacketCustomPayload;
12 15 import net.minecraft.network.play.server.S01PacketJoinGame;
13 16 import net.minecraft.network.play.server.S3FPacketCustomPayload;
14 17  
15   -import com.mumfrey.liteloader.client.util.PrivateFieldsClient;
16   -import com.mumfrey.liteloader.core.ClientPluginChannels;
17   -import com.mumfrey.liteloader.core.exceptions.UnregisteredChannelException;
18   -
19 18 /**
20 19 * Handler for client plugin channels
21 20 *
... ... @@ -67,7 +66,7 @@ public class ClientPluginChannelsClient extends ClientPluginChannels
67 66 {
68 67 if (netHandler instanceof INetHandlerLoginClient)
69 68 {
70   - NetworkManager networkManager = PrivateFieldsClient.netManager.get(((NetHandlerLoginClient)netHandler));
  69 + NetworkManager networkManager = ((IClientNetLoginHandler)netHandler).getNetMgr();
71 70 networkManager.sendPacket(new C17PacketCustomPayload(CHANNEL_REGISTER, registrationData));
72 71 }
73 72 else if (netHandler instanceof INetHandlerPlayClient)
... ...
src/client/java/com/mumfrey/liteloader/client/ClientProxy.java 0 → 100644
  1 +package com.mumfrey.liteloader.client;
  2 +
  3 +import java.io.File;
  4 +
  5 +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
  6 +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
  7 +
  8 +import com.mumfrey.liteloader.client.ducks.IFramebuffer;
  9 +import com.mumfrey.liteloader.core.Proxy;
  10 +
  11 +import net.minecraft.client.Minecraft;
  12 +import net.minecraft.client.gui.GuiNewChat;
  13 +import net.minecraft.client.renderer.RenderGlobal;
  14 +import net.minecraft.client.renderer.entity.Render;
  15 +import net.minecraft.client.renderer.entity.RenderManager;
  16 +import net.minecraft.client.shader.Framebuffer;
  17 +import net.minecraft.entity.Entity;
  18 +import net.minecraft.server.integrated.IntegratedServer;
  19 +import net.minecraft.util.IChatComponent;
  20 +import net.minecraft.world.WorldSettings;
  21 +
  22 +/**
  23 + * Proxy class which handles the redirected calls from the injected callbacks
  24 + * and routes them to the relevant liteloader handler classes. We do this rather
  25 + * than patching a bunch of bytecode into the packet classes themselves because
  26 + * this is easier to maintain.
  27 + *
  28 + * @author Adam Mummery-Smith
  29 + */
  30 +public abstract class ClientProxy extends Proxy
  31 +{
  32 + private static LiteLoaderEventBrokerClient broker;
  33 +
  34 + private ClientProxy() {}
  35 +
  36 + public static void onStartupComplete()
  37 + {
  38 + Proxy.onStartupComplete();
  39 +
  40 + ClientProxy.broker = LiteLoaderEventBrokerClient.getInstance();
  41 +
  42 + if (ClientProxy.broker == null)
  43 + {
  44 + throw new RuntimeException("LiteLoader failed to start up properly."
  45 + + " The game is in an unstable state and must shut down now. Check the developer log for startup errors");
  46 + }
  47 +
  48 + ClientProxy.broker.onStartupComplete();
  49 + }
  50 +
  51 + public static void onTimerUpdate()
  52 + {
  53 + ClientProxy.broker.onTimerUpdate();
  54 + }
  55 +
  56 + public static void newTick()
  57 + {
  58 + }
  59 +
  60 + public static void onTick()
  61 + {
  62 + ClientProxy.broker.onTick();
  63 + }
  64 +
  65 + public static void onRender()
  66 + {
  67 + ClientProxy.broker.onRender();
  68 + }
  69 +
  70 + public static void preRenderGUI(float partialTicks)
  71 + {
  72 + ClientProxy.broker.preRenderGUI(partialTicks);
  73 + }
  74 +
  75 + public static void onSetupCameraTransform(int pass, float partialTicks, long timeSlice)
  76 + {
  77 + ClientProxy.broker.onSetupCameraTransform(pass, partialTicks, timeSlice);
  78 + }
  79 +
  80 + public static void postRenderEntities(int pass, float partialTicks, long timeSlice)
  81 + {
  82 + ClientProxy.broker.postRenderEntities(partialTicks, timeSlice);
  83 + }
  84 +
  85 + public static void postRender(float partialTicks, long timeSlice)
  86 + {
  87 + ClientProxy.broker.postRender(partialTicks, timeSlice);
  88 + }
  89 +
  90 + public static void onRenderHUD(float partialTicks)
  91 + {
  92 + ClientProxy.broker.onRenderHUD(partialTicks);
  93 + }
  94 +
  95 + public static void onRenderChat(GuiNewChat chatGui, float partialTicks)
  96 + {
  97 + ClientProxy.broker.onRenderChat(chatGui, partialTicks);
  98 + }
  99 +
  100 + public static void postRenderChat(GuiNewChat chatGui, float partialTicks)
  101 + {
  102 + ClientProxy.broker.postRenderChat(chatGui, partialTicks);
  103 + }
  104 +
  105 + public static void postRenderHUD(float partialTicks)
  106 + {
  107 + ClientProxy.broker.postRenderHUD(partialTicks);
  108 + }
  109 +
  110 + public static void onCreateIntegratedServer(IntegratedServer server, String folderName, String worldName, WorldSettings worldSettings)
  111 + {
  112 + ClientProxy.broker.onStartServer(server, folderName, worldName, worldSettings);
  113 + }
  114 +
  115 + public static void onOutboundChat(CallbackInfo e, String message)
  116 + {
  117 + ClientProxy.broker.onSendChatMessage(e, message);
  118 + }
  119 +
  120 + public static void onResize(Minecraft mc)
  121 + {
  122 + if (ClientProxy.broker == null) return;
  123 + ClientProxy.broker.onResize(mc);
  124 + }
  125 +
  126 + public static void preRenderFBO(Framebuffer frameBufferMc)
  127 + {
  128 + if (ClientProxy.broker == null) return;
  129 + if (frameBufferMc instanceof IFramebuffer)
  130 + {
  131 + ((IFramebuffer)frameBufferMc).setDispatchRenderEvent(true);
  132 + }
  133 + ClientProxy.broker.preRenderFBO(frameBufferMc);
  134 + }
  135 +
  136 + public static void postRenderFBO(Framebuffer frameBufferMc)
  137 + {
  138 + if (ClientProxy.broker == null) return;
  139 + ClientProxy.broker.postRenderFBO(frameBufferMc);
  140 + }
  141 +
  142 + public static void renderFBO(Framebuffer frameBufferMc, int width, int height, boolean flag)
  143 + {
  144 + if (ClientProxy.broker == null) return;
  145 + ClientProxy.broker.onRenderFBO(frameBufferMc, width, height);
  146 + }
  147 +
  148 + public static void onRenderWorld(float partialTicks, long timeSlice)
  149 + {
  150 + ClientProxy.broker.onRenderWorld(partialTicks, timeSlice);
  151 + }
  152 +
  153 + public static void onRenderSky(int pass, float partialTicks, long timeSlice)
  154 + {
  155 + ClientProxy.broker.onRenderSky(partialTicks, pass, timeSlice);
  156 + }
  157 +
  158 + public static void onRenderClouds(RenderGlobal renderGlobalIn, float partialTicks, int pass)
  159 + {
  160 + ClientProxy.broker.onRenderClouds(partialTicks, pass, renderGlobalIn);
  161 + }
  162 +
  163 + public static void onRenderTerrain(int pass, float partialTicks, long timeSlice)
  164 + {
  165 + ClientProxy.broker.onRenderTerrain(partialTicks, pass, timeSlice);
  166 + }
  167 +
  168 + public static void onSaveScreenshot(CallbackInfoReturnable<IChatComponent> ci, File gameDir, String name, int width, int height,
  169 + Framebuffer fbo)
  170 + {
  171 + ClientProxy.broker.onScreenshot(ci, name, width, height, fbo);
  172 + }
  173 +
  174 + public static void onRenderEntity(RenderManager source, Render render, Entity entity, double x, double y, double z, float yaw, float pTicks)
  175 + {
  176 + ClientProxy.broker.onRenderEntity(source, entity, x, y, z, yaw, pTicks, render);
  177 + }
  178 +
  179 + public static void onPostRenderEntity(RenderManager source, Render render, Entity entity, double x, double y, double z, float yaw, float pTicks)
  180 + {
  181 + ClientProxy.broker.onPostRenderEntity(source, entity, x, y, z, yaw, pTicks, render);
  182 + }
  183 +}
... ...
src/client/java/com/mumfrey/liteloader/client/LiteLoaderEventBrokerClient.java
1 1 package com.mumfrey.liteloader.client;
2 2  
3   -import net.minecraft.client.Minecraft;
4   -import net.minecraft.client.entity.EntityPlayerSP;
5   -import net.minecraft.client.gui.GuiNewChat;
6   -import net.minecraft.client.gui.ScaledResolution;
7   -import net.minecraft.client.renderer.RenderGlobal;
8   -import net.minecraft.client.renderer.entity.Render;
9   -import net.minecraft.client.renderer.entity.RenderManager;
10   -import net.minecraft.client.resources.IResourceManager;
11   -import net.minecraft.client.resources.IResourceManagerReloadListener;
12   -import net.minecraft.client.shader.Framebuffer;
13   -import net.minecraft.entity.Entity;
14   -import net.minecraft.network.play.client.C01PacketChatMessage;
15   -import net.minecraft.server.integrated.IntegratedServer;
16   -import net.minecraft.util.IChatComponent;
17   -import net.minecraft.util.ScreenShotHelper;
18   -import net.minecraft.util.Timer;
19   -
20 3 import org.lwjgl.input.Mouse;
  4 +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
  5 +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
21 6  
22 7 import com.mumfrey.liteloader.*;
23 8 import com.mumfrey.liteloader.client.overlays.IEntityRenderer;
... ... @@ -31,12 +16,28 @@ import com.mumfrey.liteloader.core.event.HandlerList.ReturnLogicOp;
31 16 import com.mumfrey.liteloader.core.event.ProfilingHandlerList;
32 17 import com.mumfrey.liteloader.interfaces.FastIterableDeque;
33 18 import com.mumfrey.liteloader.launch.LoaderProperties;
34   -import com.mumfrey.liteloader.transformers.event.EventInfo;
35   -import com.mumfrey.liteloader.transformers.event.ReturnEventInfo;
36 19 import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
37 20  
  21 +import net.minecraft.client.Minecraft;
  22 +import net.minecraft.client.gui.GuiNewChat;
  23 +import net.minecraft.client.gui.ScaledResolution;
  24 +import net.minecraft.client.renderer.RenderGlobal;
  25 +import net.minecraft.client.renderer.entity.Render;
  26 +import net.minecraft.client.renderer.entity.RenderManager;
  27 +import net.minecraft.client.resources.IResourceManager;
  28 +import net.minecraft.client.resources.IResourceManagerReloadListener;
  29 +import net.minecraft.client.shader.Framebuffer;
  30 +import net.minecraft.entity.Entity;
  31 +import net.minecraft.network.play.client.C01PacketChatMessage;
  32 +import net.minecraft.server.integrated.IntegratedServer;
  33 +import net.minecraft.util.IChatComponent;
  34 +import net.minecraft.util.Timer;
  35 +
38 36 public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker<Minecraft, IntegratedServer> implements IResourceManagerReloadListener
39 37 {
  38 + /**
  39 + * Singleton
  40 + */
40 41 private static LiteLoaderEventBrokerClient instance;
41 42  
42 43 /**
... ... @@ -93,7 +94,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft
93 94 this.tickListeners = new ProfilingHandlerList<Tickable>(Tickable.class, this.engineClient.getProfiler());
94 95 }
95 96  
96   - static LiteLoaderEventBrokerClient getInstance()
  97 + public static LiteLoaderEventBrokerClient getInstance()
97 98 {
98 99 return LiteLoaderEventBrokerClient.instance;
99 100 }
... ... @@ -363,8 +364,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft
363 364 */
364 365 void postRenderChat(GuiNewChat chatGui, float partialTicks)
365 366 {
366   - GuiNewChat chat = this.engineClient.getChatGUI();
367   - this.chatRenderListeners.all().onPostRenderChat(this.screenWidth, this.screenHeight, chat);
  367 + this.chatRenderListeners.all().onPostRenderChat(this.screenWidth, this.screenHeight, chatGui);
368 368 }
369 369  
370 370 /**
... ... @@ -442,7 +442,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft
442 442 /**
443 443 * @param message
444 444 */
445   - void onSendChatMessage(EventInfo<EntityPlayerSP> e, String message)
  445 + void onSendChatMessage(CallbackInfo e, String message)
446 446 {
447 447 if (!this.outboundChatFilters.all().onSendChatMessage(message))
448 448 {
... ... @@ -523,13 +523,13 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft
523 523 * @param height
524 524 * @param fbo
525 525 */
526   - void onScreenshot(ReturnEventInfo<ScreenShotHelper, IChatComponent> e, String name, int width, int height, Framebuffer fbo)
  526 + void onScreenshot(CallbackInfoReturnable<IChatComponent> ci, String name, int width, int height, Framebuffer fbo)
527 527 {
528   - ReturnValue<IChatComponent> ret = new ReturnValue<IChatComponent>(e.getReturnValue());
  528 + ReturnValue<IChatComponent> ret = new ReturnValue<IChatComponent>(ci.getReturnValue());
529 529  
530 530 if (!this.screenshotListeners.all().onSaveScreenshot(name, width, height, fbo, ret))
531 531 {
532   - e.setReturnValue(ret.get());
  532 + ci.setReturnValue(ret.get());
533 533 }
534 534 }
535 535  
... ...
src/client/java/com/mumfrey/liteloader/client/PacketEventsClient.java
1 1 package com.mumfrey.liteloader.client;
2 2  
3   -import net.minecraft.client.Minecraft;
4   -import net.minecraft.network.INetHandler;
5   -import net.minecraft.network.Packet;
6   -import net.minecraft.network.login.INetHandlerLoginClient;
7   -import net.minecraft.network.login.server.S02PacketLoginSuccess;
8   -import net.minecraft.network.play.INetHandlerPlayClient;
9   -import net.minecraft.network.play.server.S01PacketJoinGame;
10   -import net.minecraft.network.play.server.S02PacketChat;
11   -import net.minecraft.server.MinecraftServer;
12   -import net.minecraft.util.ChatComponentText;
13   -import net.minecraft.util.IChatComponent;
14   -import net.minecraft.util.IThreadListener;
15   -
16   -import com.mojang.realmsclient.RealmsMainScreen;
17 3 import com.mojang.realmsclient.dto.RealmsServer;
18   -import com.mumfrey.liteloader.ChatFilter;
19   -import com.mumfrey.liteloader.ChatListener;
20   -import com.mumfrey.liteloader.JoinGameListener;
21   -import com.mumfrey.liteloader.PostLoginListener;
22   -import com.mumfrey.liteloader.PreJoinGameListener;
23   -import com.mumfrey.liteloader.client.util.PrivateFieldsClient;
  4 +import com.mumfrey.liteloader.*;
  5 +import com.mumfrey.liteloader.common.ducks.IChatPacket;
24 6 import com.mumfrey.liteloader.common.transformers.PacketEventInfo;
25 7 import com.mumfrey.liteloader.core.ClientPluginChannels;
26 8 import com.mumfrey.liteloader.core.InterfaceRegistrationDelegate;
... ... @@ -32,10 +14,22 @@ import com.mumfrey.liteloader.core.event.HandlerList;
32 14 import com.mumfrey.liteloader.core.event.HandlerList.ReturnLogicOp;
33 15 import com.mumfrey.liteloader.core.runtime.Packets;
34 16 import com.mumfrey.liteloader.interfaces.FastIterableDeque;
35   -import com.mumfrey.liteloader.transformers.event.EventInfo;
36 17 import com.mumfrey.liteloader.util.ChatUtilities;
37 18 import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
38 19  
  20 +import net.minecraft.client.Minecraft;
  21 +import net.minecraft.network.INetHandler;
  22 +import net.minecraft.network.Packet;
  23 +import net.minecraft.network.login.INetHandlerLoginClient;
  24 +import net.minecraft.network.login.server.S02PacketLoginSuccess;
  25 +import net.minecraft.network.play.INetHandlerPlayClient;
  26 +import net.minecraft.network.play.server.S01PacketJoinGame;
  27 +import net.minecraft.network.play.server.S02PacketChat;
  28 +import net.minecraft.server.MinecraftServer;
  29 +import net.minecraft.util.ChatComponentText;
  30 +import net.minecraft.util.IChatComponent;
  31 +import net.minecraft.util.IThreadListener;
  32 +
39 33 /**
40 34 * Client-side packet event handlers
41 35 *
... ... @@ -113,7 +107,7 @@ public class PacketEventsClient extends PacketEvents
113 107 this.postLoginListeners.add(postLoginListener);
114 108 }
115 109  
116   - public static void onJoinRealm(EventInfo<RealmsMainScreen> e, long arg1, RealmsServer server)
  110 + public static void onJoinRealm(long serverId, RealmsServer server)
117 111 {
118 112 PacketEventsClient.joiningRealm = server;
119 113 }
... ... @@ -254,7 +248,7 @@ public class PacketEventsClient extends PacketEvents
254 248 try
255 249 {
256 250 chat = ChatUtilities.convertLegacyCodes(chat);
257   - PrivateFieldsClient.chatMessage.set(packet, chat);
  251 + ((IChatPacket)packet).setChatComponent(chat);
258 252 }
259 253 catch (Exception ex)
260 254 {
... ...
src/client/java/com/mumfrey/liteloader/client/SoundHandlerReloadInhibitor.java
... ... @@ -2,13 +2,13 @@ package com.mumfrey.liteloader.client;
2 2  
3 3 import java.util.List;
4 4  
  5 +import com.mumfrey.liteloader.client.ducks.IReloadable;
  6 +import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
  7 +
5 8 import net.minecraft.client.audio.SoundHandler;
6 9 import net.minecraft.client.resources.IResourceManagerReloadListener;
7 10 import net.minecraft.client.resources.SimpleReloadableResourceManager;
8 11  
9   -import com.mumfrey.liteloader.client.util.PrivateFieldsClient;
10   -import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
11   -
12 12 /**
13 13 * Manager object which handles inhibiting the sound handler's reload
14 14 * notification at startup.
... ... @@ -55,7 +55,7 @@ public class SoundHandlerReloadInhibitor
55 55 {
56 56 if (!this.inhibited)
57 57 {
58   - List<IResourceManagerReloadListener> reloadListeners = PrivateFieldsClient.reloadListeners.get(this.resourceManager);
  58 + List<IResourceManagerReloadListener> reloadListeners = ((IReloadable)this.resourceManager).getReloadListeners();
59 59 if (reloadListeners != null)
60 60 {
61 61 this.storedIndex = reloadListeners.indexOf(this.soundHandler);
... ... @@ -89,7 +89,7 @@ public class SoundHandlerReloadInhibitor
89 89 {
90 90 if (this.inhibited)
91 91 {
92   - List<IResourceManagerReloadListener> reloadListeners = PrivateFieldsClient.reloadListeners.get(this.resourceManager);
  92 + List<IResourceManagerReloadListener> reloadListeners = ((IReloadable)this.resourceManager).getReloadListeners();
93 93 if (reloadListeners != null)
94 94 {
95 95 if (this.storedIndex > -1)
... ...
src/client/java/com/mumfrey/liteloader/client/api/LiteLoaderBrandingProvider.java
... ... @@ -54,7 +54,7 @@ public class LiteLoaderBrandingProvider implements BrandingProvider
54 54 @Override
55 55 public String getCopyrightText()
56 56 {
57   - return "Copyright (c) 2012-2014 Adam Mummery-Smith";
  57 + return "Copyright (c) 2012-2016 Adam Mummery-Smith";
58 58 }
59 59  
60 60 /* (non-Javadoc)
... ...
src/client/java/com/mumfrey/liteloader/client/api/LiteLoaderCoreAPIClient.java
... ... @@ -6,6 +6,7 @@ import net.minecraft.client.Minecraft;
6 6 import net.minecraft.server.integrated.IntegratedServer;
7 7  
8 8 import com.google.common.collect.ImmutableList;
  9 +import com.google.common.collect.ObjectArrays;
9 10 import com.mumfrey.liteloader.api.CoreProvider;
10 11 import com.mumfrey.liteloader.api.CustomisationProvider;
11 12 import com.mumfrey.liteloader.api.InterfaceProvider;
... ... @@ -36,12 +37,20 @@ public class LiteLoaderCoreAPIClient extends LiteLoaderCoreAPI
36 37  
37 38 private static final String[] requiredDownstreamTransformers = {
38 39 LiteLoaderCoreAPI.PKG_LITELOADER_COMMON + ".transformers.LiteLoaderPacketTransformer",
39   - LiteLoaderCoreAPIClient.PKG_LITELOADER_CLIENT + ".transformers.LiteLoaderEventInjectionTransformer",
40 40 LiteLoaderCoreAPIClient.PKG_LITELOADER_CLIENT + ".transformers.MinecraftTransformer",
41 41 LiteLoaderCoreAPI.PKG_LITELOADER + ".transformers.event.json.ModEventInjectionTransformer"
42 42 };
43 43  
44 44 private ObjectFactory<Minecraft, IntegratedServer> objectFactory;
  45 +
  46 + @Override
  47 + public String[] getMixinConfigs()
  48 + {
  49 + String[] commonConfigs = super.getMixinConfigs();
  50 + return ObjectArrays.concat(commonConfigs, new String[] {
  51 + "mixins.liteloader.client.json"
  52 + }, String.class);
  53 + }
45 54  
46 55 /* (non-Javadoc)
47 56 * @see com.mumfrey.liteloader.api.LiteAPI#getRequiredTransformers()
... ... @@ -69,11 +78,11 @@ public class LiteLoaderCoreAPIClient extends LiteLoaderCoreAPI
69 78 public List<CustomisationProvider> getCustomisationProviders()
70 79 {
71 80 return ImmutableList.<CustomisationProvider>of
72   - (
73   - new LiteLoaderBrandingProvider(),
74   - new LiteLoaderModInfoDecorator(),
75   - new Translator()
76   - );
  81 + (
  82 + new LiteLoaderBrandingProvider(),
  83 + new LiteLoaderModInfoDecorator(),
  84 + new Translator()
  85 + );
77 86 }
78 87  
79 88 /* (non-Javadoc)
... ... @@ -83,10 +92,10 @@ public class LiteLoaderCoreAPIClient extends LiteLoaderCoreAPI
83 92 public List<CoreProvider> getCoreProviders()
84 93 {
85 94 return ImmutableList.<CoreProvider>of
86   - (
87   - new LiteLoaderCoreProviderClient(this.properties),
88   - LiteLoader.getInput()
89   - );
  95 + (
  96 + new LiteLoaderCoreProviderClient(this.properties),
  97 + LiteLoader.getInput()
  98 + );
90 99 }
91 100  
92 101  
... ... @@ -99,13 +108,13 @@ public class LiteLoaderCoreAPIClient extends LiteLoaderCoreAPI
99 108 ObjectFactory<?, ?> objectFactory = this.getObjectFactory();
100 109  
101 110 return ImmutableList.<InterfaceProvider>of
102   - (
103   - objectFactory.getEventBroker(),
104   - objectFactory.getPacketEventBroker(),
105   - objectFactory.getClientPluginChannels(),
106   - objectFactory.getServerPluginChannels(),
107   - MessageBus.getInstance()
108   - );
  111 + (
  112 + objectFactory.getEventBroker(),
  113 + objectFactory.getPacketEventBroker(),
  114 + objectFactory.getClientPluginChannels(),
  115 + objectFactory.getServerPluginChannels(),
  116 + MessageBus.getInstance()
  117 + );
109 118 }
110 119  
111 120 /* (non-Javadoc)
... ... @@ -115,9 +124,9 @@ public class LiteLoaderCoreAPIClient extends LiteLoaderCoreAPI
115 124 public List<Observer> getPreInitObservers()
116 125 {
117 126 return ImmutableList.<Observer>of
118   - (
119   - new ModEvents()
120   - );
  127 + (
  128 + new ModEvents()
  129 + );
121 130 }
122 131  
123 132 /* (non-Javadoc)
... ... @@ -129,11 +138,11 @@ public class LiteLoaderCoreAPIClient extends LiteLoaderCoreAPI
129 138 ObjectFactory<?, ?> objectFactory = this.getObjectFactory();
130 139  
131 140 return ImmutableList.<Observer>of
132   - (
133   - new ResourceObserver(),
134   - objectFactory.getPanelManager(),
135   - objectFactory.getEventBroker()
136   - );
  141 + (
  142 + new ResourceObserver(),
  143 + objectFactory.getPanelManager(),
  144 + objectFactory.getEventBroker()
  145 + );
137 146 }
138 147  
139 148 /* (non-Javadoc)
... ...
src/client/java/com/mumfrey/liteloader/client/api/LiteLoaderModInfoDecorator.java
... ... @@ -74,6 +74,22 @@ public class LiteLoaderModInfoDecorator implements ModInfoDecorator
74 74 });
75 75 }
76 76  
  77 + if (mod.hasMixins())
  78 + {
  79 + icons.add(new IconAbsoluteClickable(LiteLoaderBrandingProvider.ABOUT_TEXTURE,
  80 + I18n.format("gui.mod.providesmixins"), 12, 12, 122, 104, 134, 116)
  81 + {
  82 + @Override
  83 + public void onClicked(Object source, Object container)
  84 + {
  85 + if (container instanceof GuiModListPanel)
  86 + {
  87 + ((GuiModListPanel)container).displayModHelpMessage(mod, "gui.mod.providesmixins", "gui.mod.help.mixins");
  88 + }
  89 + }
  90 + });
  91 + }
  92 +
77 93 if (mod.usesAPI())
78 94 {
79 95 icons.add(new IconAbsolute(LiteLoaderBrandingProvider.ABOUT_TEXTURE,
... ...
src/client/java/com/mumfrey/liteloader/client/ducks/IClientNetLoginHandler.java 0 → 100644
  1 +package com.mumfrey.liteloader.client.ducks;
  2 +
  3 +import net.minecraft.network.NetworkManager;
  4 +
  5 +public interface IClientNetLoginHandler
  6 +{
  7 + public abstract NetworkManager getNetMgr();
  8 +}
... ...
src/client/java/com/mumfrey/liteloader/client/ducks/IFramebuffer.java 0 → 100644
  1 +package com.mumfrey.liteloader.client.ducks;
  2 +
  3 +public interface IFramebuffer
  4 +{
  5 + public abstract IFramebuffer setDispatchRenderEvent(boolean dispatchRenderEvent);
  6 +
  7 + public abstract boolean isDispatchRenderEvent();
  8 +}
... ...
src/client/java/com/mumfrey/liteloader/client/ducks/INamespacedRegistry.java 0 → 100644
  1 +package com.mumfrey.liteloader.client.ducks;
  2 +
  3 +public interface INamespacedRegistry
  4 +{
  5 + public abstract IObjectIntIdentityMap getUnderlyingMap();
  6 +}
... ...
src/client/java/com/mumfrey/liteloader/client/ducks/IObjectIntIdentityMap.java 0 → 100644
  1 +package com.mumfrey.liteloader.client.ducks;
  2 +
  3 +import java.util.IdentityHashMap;
  4 +import java.util.List;
  5 +
  6 +public interface IObjectIntIdentityMap
  7 +{
  8 + public abstract <V> IdentityHashMap<V, Integer> getIdentityMap();
  9 +
  10 + public abstract <V> List<V> getObjectList();
  11 +}
... ...
src/client/java/com/mumfrey/liteloader/client/ducks/IRegistrySimple.java 0 → 100644
  1 +package com.mumfrey.liteloader.client.ducks;
  2 +
  3 +import java.util.Map;
  4 +
  5 +public interface IRegistrySimple
  6 +{
  7 + public abstract <K, V> Map<K, V> getRegistryObjects();
  8 +}
... ...
src/client/java/com/mumfrey/liteloader/client/ducks/IReloadable.java 0 → 100644
  1 +package com.mumfrey.liteloader.client.ducks;
  2 +
  3 +import java.util.List;
  4 +
  5 +import net.minecraft.client.resources.IResourceManagerReloadListener;
  6 +
  7 +public interface IReloadable
  8 +{
  9 + public abstract List<IResourceManagerReloadListener> getReloadListeners();
  10 +}
... ...
src/client/java/com/mumfrey/liteloader/client/ducks/IRenderManager.java 0 → 100644
  1 +package com.mumfrey.liteloader.client.ducks;
  2 +
  3 +import java.util.Map;
  4 +
  5 +import net.minecraft.client.renderer.entity.Render;
  6 +import net.minecraft.entity.Entity;
  7 +
  8 +public interface IRenderManager
  9 +{
  10 + public abstract Map<Class<? extends Entity>, Render> getRenderMap();
  11 +}
... ...
src/client/java/com/mumfrey/liteloader/client/ducks/ITileEntityRendererDispatcher.java 0 → 100644
  1 +package com.mumfrey.liteloader.client.ducks;
  2 +
  3 +import java.util.Map;
  4 +
  5 +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
  6 +import net.minecraft.tileentity.TileEntity;
  7 +
  8 +public interface ITileEntityRendererDispatcher
  9 +{
  10 + public abstract Map<Class<? extends TileEntity>, TileEntitySpecialRenderer> getSpecialRenderMap();
  11 +}
... ...
src/client/java/com/mumfrey/liteloader/client/mixin/MixinEntityPlayerSP.java 0 → 100644
  1 +package com.mumfrey.liteloader.client.mixin;
  2 +
  3 +import org.spongepowered.asm.mixin.Mixin;
  4 +import org.spongepowered.asm.mixin.injection.At;
  5 +import org.spongepowered.asm.mixin.injection.Inject;
  6 +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
  7 +
  8 +import com.mumfrey.liteloader.client.ClientProxy;
  9 +
  10 +import net.minecraft.client.entity.AbstractClientPlayer;
  11 +import net.minecraft.client.entity.EntityPlayerSP;
  12 +
  13 +@Mixin(EntityPlayerSP.class)
  14 +public abstract class MixinEntityPlayerSP extends AbstractClientPlayer
  15 +{
  16 + public MixinEntityPlayerSP()
  17 + {
  18 + super(null, null);
  19 + }
  20 +
  21 + @Inject(method = "sendChatMessage(Ljava/lang/String;)V", at = { @At("HEAD") }, cancellable = true)
  22 + public void onSendChatMessage(String message, CallbackInfo ci)
  23 + {
  24 + ClientProxy.onOutboundChat(ci, message);
  25 + }
  26 +}
... ...
src/client/java/com/mumfrey/liteloader/client/mixin/MixinEntityRenderer.java 0 → 100644
  1 +package com.mumfrey.liteloader.client.mixin;
  2 +
  3 +import org.spongepowered.asm.mixin.Mixin;
  4 +import org.spongepowered.asm.mixin.injection.At;
  5 +import org.spongepowered.asm.mixin.injection.Inject;
  6 +import org.spongepowered.asm.mixin.injection.At.Shift;
  7 +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
  8 +
  9 +import com.mumfrey.liteloader.client.ClientProxy;
  10 +
  11 +import net.minecraft.client.renderer.EntityRenderer;
  12 +import net.minecraft.client.renderer.RenderGlobal;
  13 +
  14 +@Mixin(EntityRenderer.class)
  15 +public abstract class MixinEntityRenderer
  16 +{
  17 + @Inject(method = "updateCameraAndRender(F)V", at = @At(
  18 + value = "INVOKE",
  19 + shift = Shift.AFTER,
  20 + target = "Lnet/minecraft/client/renderer/GlStateManager;clear(I)V"
  21 + ))
  22 + private void onPreRenderGUI(float partialTicks, CallbackInfo ci)
  23 + {
  24 + ClientProxy.preRenderGUI(partialTicks);
  25 + }
  26 +
  27 + @Inject(method = "updateCameraAndRender(F)V", at = @At(
  28 + value = "INVOKE",
  29 + target = "Lnet/minecraft/client/gui/GuiIngame;renderGameOverlay(F)V"
  30 + ))
  31 + private void onRenderHUD(float partialTicks, CallbackInfo ci)
  32 + {
  33 + ClientProxy.onRenderHUD(partialTicks);
  34 + }
  35 +
  36 + @Inject(method = "updateCameraAndRender(F)V", at = @At(
  37 + value = "INVOKE",
  38 + shift = Shift.AFTER,
  39 + target = "Lnet/minecraft/client/gui/GuiIngame;renderGameOverlay(F)V"
  40 + ))
  41 + private void onPostRenderHUD(float partialTicks, CallbackInfo ci)
  42 + {
  43 + ClientProxy.postRenderHUD(partialTicks);
  44 + }
  45 +
  46 + @Inject(method = "renderWorld(FJ)V", at = @At(
  47 + value = "INVOKE",
  48 + target = "Lnet/minecraft/profiler/Profiler;startSection(Ljava/lang/String;)V",
  49 + ordinal = 0
  50 + ))
  51 + private void onRenderWorld(float partialTicks, long timeSlice, CallbackInfo ci)
  52 + {
  53 + ClientProxy.onRenderWorld(partialTicks, timeSlice);
  54 + }
  55 +
  56 + @Inject(method = "renderWorld(FJ)V", at = @At(
  57 + value = "INVOKE",
  58 + target = "Lnet/minecraft/profiler/Profiler;endSection()V",
  59 + ordinal = 0
  60 + ))
  61 + private void onPostRender(float partialTicks, long timeSlice, CallbackInfo ci)
  62 + {
  63 + ClientProxy.postRender(partialTicks, timeSlice);
  64 + }
  65 +
  66 + @Inject(method = "renderWorldPass(IFJ)V", at = @At(
  67 + value = "INVOKE_STRING",
  68 + target = "Lnet/minecraft/profiler/Profiler;endStartSection(Ljava/lang/String;)V",
  69 + args = "ldc=frustum"
  70 + ))
  71 + private void onSetupCameraTransform(int pass, float partialTicks, long timeSlice, CallbackInfo ci)
  72 + {
  73 + ClientProxy.onSetupCameraTransform(pass, partialTicks, timeSlice);
  74 + }
  75 +
  76 + @Inject(method = "renderWorldPass(IFJ)V", at = @At(
  77 + value = "INVOKE_STRING",
  78 + target = "Lnet/minecraft/profiler/Profiler;endStartSection(Ljava/lang/String;)V",
  79 + args = "ldc=sky"
  80 + ))
  81 + private void onRenderSky(int pass, float partialTicks, long timeSlice, CallbackInfo ci)
  82 + {
  83 + ClientProxy.onRenderSky(pass, partialTicks, timeSlice);
  84 + }
  85 +
  86 + @Inject(method = "renderWorldPass(IFJ)V", at = @At(
  87 + value = "INVOKE_STRING",
  88 + target = "Lnet/minecraft/profiler/Profiler;endStartSection(Ljava/lang/String;)V",
  89 + args = "ldc=terrain"
  90 + ))
  91 + private void onRenderTerrain(int pass, float partialTicks, long timeSlice, CallbackInfo ci)
  92 + {
  93 + ClientProxy.onRenderTerrain(pass, partialTicks, timeSlice);
  94 +
  95 + }
  96 +
  97 + @Inject(method = "renderWorldPass(IFJ)V", at = @At(
  98 + value = "INVOKE_STRING",
  99 + target = "Lnet/minecraft/profiler/Profiler;endStartSection(Ljava/lang/String;)V",
  100 + args = "ldc=litParticles"
  101 + ))
  102 + private void onPostRenderEntities(int pass, float partialTicks, long timeSlice, CallbackInfo ci)
  103 + {
  104 + ClientProxy.postRenderEntities(pass, partialTicks, timeSlice);
  105 + }
  106 +
  107 + @Inject(method = "renderCloudsCheck(Lnet/minecraft/client/renderer/RenderGlobal;FI)V", at = @At(
  108 + value = "INVOKE",
  109 + target = "Lnet/minecraft/profiler/Profiler;endStartSection(Ljava/lang/String;)V"
  110 + ))
  111 + private void onRenderClouds(RenderGlobal renderGlobalIn, float partialTicks, int pass, CallbackInfo ci)
  112 + {
  113 + ClientProxy.onRenderClouds(renderGlobalIn, partialTicks, pass);
  114 + }
  115 +}
... ...
src/client/java/com/mumfrey/liteloader/client/mixin/MixinFramebuffer.java 0 → 100644
  1 +package com.mumfrey.liteloader.client.mixin;
  2 +
  3 +import org.spongepowered.asm.mixin.Mixin;
  4 +import org.spongepowered.asm.mixin.injection.At;
  5 +import org.spongepowered.asm.mixin.injection.Inject;
  6 +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
  7 +
  8 +import com.mumfrey.liteloader.client.ClientProxy;
  9 +import com.mumfrey.liteloader.client.ducks.IFramebuffer;
  10 +
  11 +import net.minecraft.client.shader.Framebuffer;
  12 +
  13 +@Mixin(Framebuffer.class)
  14 +public abstract class MixinFramebuffer implements IFramebuffer
  15 +{
  16 + private boolean dispatchRenderEvent;
  17 +
  18 + @Override
  19 + public IFramebuffer setDispatchRenderEvent(boolean dispatchRenderEvent)
  20 + {
  21 + this.dispatchRenderEvent = dispatchRenderEvent;
  22 + return this;
  23 + }
  24 +
  25 + @Override
  26 + public boolean isDispatchRenderEvent()
  27 + {
  28 + return this.dispatchRenderEvent;
  29 + }
  30 +
  31 + @Inject(method = "framebufferRenderExt(IIZ)V", at = @At(
  32 + value = "INVOKE",
  33 + target = "Lnet/minecraft/client/shader/Framebuffer;bindFramebufferTexture()V"
  34 + ))
  35 + private void onRenderFBO(int width, int height, boolean flag, CallbackInfo ci)
  36 + {
  37 + if (this.dispatchRenderEvent)
  38 + {
  39 + ClientProxy.renderFBO((Framebuffer)(Object)this, width, height, flag);
  40 + this.dispatchRenderEvent = false;
  41 + }
  42 + }
  43 +}
... ...
src/client/java/com/mumfrey/liteloader/client/mixin/MixinGuiIngame.java 0 → 100644
  1 +package com.mumfrey.liteloader.client.mixin;
  2 +
  3 +import org.spongepowered.asm.mixin.Mixin;
  4 +import org.spongepowered.asm.mixin.Shadow;
  5 +import org.spongepowered.asm.mixin.injection.At;
  6 +import org.spongepowered.asm.mixin.injection.At.Shift;
  7 +import org.spongepowered.asm.mixin.injection.Inject;
  8 +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
  9 +
  10 +import com.mumfrey.liteloader.client.ClientProxy;
  11 +
  12 +import net.minecraft.client.gui.Gui;
  13 +import net.minecraft.client.gui.GuiIngame;
  14 +import net.minecraft.client.gui.GuiNewChat;
  15 +
  16 +@Mixin(GuiIngame.class)
  17 +public abstract class MixinGuiIngame extends Gui
  18 +{
  19 + @Shadow private GuiNewChat persistantChatGUI;
  20 +
  21 + @Inject(method = "renderGameOverlay(F)V", at = @At(
  22 + value = "INVOKE",
  23 + target = "Lnet/minecraft/client/gui/GuiNewChat;drawChat(I)V"
  24 + ))
  25 + private void onRenderChat(float partialTicks, CallbackInfo ci)
  26 + {
  27 + ClientProxy.onRenderChat(this.persistantChatGUI, partialTicks);
  28 + }
  29 +
  30 + @Inject(method = "renderGameOverlay(F)V", at = @At(
  31 + value = "INVOKE",
  32 + shift = Shift.AFTER,
  33 + target = "Lnet/minecraft/client/gui/GuiNewChat;drawChat(I)V"
  34 + ))
  35 + private void postRenderChat(float partialTicks, CallbackInfo ci)
  36 + {
  37 + ClientProxy.postRenderChat(this.persistantChatGUI, partialTicks);
  38 + }
  39 +}
... ...
src/client/java/com/mumfrey/liteloader/client/mixin/MixinIntegratedServer.java 0 → 100644
  1 +package com.mumfrey.liteloader.client.mixin;
  2 +
  3 +import org.spongepowered.asm.mixin.Mixin;
  4 +import org.spongepowered.asm.mixin.injection.At;
  5 +import org.spongepowered.asm.mixin.injection.Inject;
  6 +import org.spongepowered.asm.mixin.injection.Surrogate;
  7 +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
  8 +
  9 +import com.mumfrey.liteloader.client.ClientProxy;
  10 +
  11 +import net.minecraft.client.Minecraft;
  12 +import net.minecraft.server.MinecraftServer;
  13 +import net.minecraft.server.integrated.IntegratedServer;
  14 +import net.minecraft.world.WorldSettings;
  15 +
  16 +@Mixin(IntegratedServer.class)
  17 +public abstract class MixinIntegratedServer extends MinecraftServer
  18 +{
  19 + public MixinIntegratedServer()
  20 + {
  21 + super(null, null);
  22 + }
  23 +
  24 + @Inject(
  25 + method = "<init>*", //(Lnet/minecraft/client/Minecraft;Ljava/lang/String;Ljava/lang/String;Lnet/minecraft/world/WorldSettings;)V",
  26 + at = @At("RETURN"),
  27 + remap = false
  28 + )
  29 + private void onConstructed(Minecraft mcIn, String folderName, String worldName, WorldSettings settings, CallbackInfo ci)
  30 + {
  31 + ClientProxy.onCreateIntegratedServer((IntegratedServer)(Object)this, folderName, worldName, settings);
  32 + }
  33 +
  34 + @Surrogate
  35 + private void onConstructed(Minecraft mcIn, CallbackInfo ci)
  36 + {
  37 +// ClientProxy.onCreateIntegratedServer((IntegratedServer)(Object)this, folderName, worldName, settings);
  38 + }
  39 +}
... ...
src/client/java/com/mumfrey/liteloader/client/mixin/MixinMinecraft.java 0 → 100644
  1 +package com.mumfrey.liteloader.client.mixin;
  2 +
  3 +import org.spongepowered.asm.mixin.Mixin;
  4 +import org.spongepowered.asm.mixin.injection.At;
  5 +import org.spongepowered.asm.mixin.injection.At.Shift;
  6 +import org.spongepowered.asm.mixin.injection.Inject;
  7 +import org.spongepowered.asm.mixin.injection.Redirect;
  8 +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
  9 +
  10 +import com.mumfrey.liteloader.client.ClientProxy;
  11 +
  12 +import net.minecraft.client.Minecraft;
  13 +import net.minecraft.client.renderer.OpenGlHelper;
  14 +import net.minecraft.client.shader.Framebuffer;
  15 +
  16 +@Mixin(Minecraft.class)
  17 +public abstract class MixinMinecraft
  18 +{
  19 + @Inject(method = "startGame()V", at = @At("RETURN"))
  20 + private void onStartupComplete(CallbackInfo ci)
  21 + {
  22 + ClientProxy.onStartupComplete();
  23 + }
  24 +
  25 + @Inject(method = "updateFramebufferSize()V", at = @At("HEAD"))
  26 + private void onResize(CallbackInfo ci)
  27 + {
  28 + ClientProxy.onResize((Minecraft)(Object)this);
  29 + }
  30 +
  31 + @Inject(method = "runTick()V", at = @At("HEAD"))
  32 + private void newTick(CallbackInfo ci)
  33 + {
  34 + ClientProxy.newTick();
  35 + }
  36 +
  37 + @Inject(method = "runGameLoop()V", at = @At(
  38 + value = "INVOKE",
  39 + shift = Shift.AFTER,
  40 + target = "Lnet/minecraft/client/renderer/EntityRenderer;updateCameraAndRender(F)V"
  41 + ))
  42 + private void onTick(CallbackInfo ci)
  43 + {
  44 + ClientProxy.onTick();
  45 + }
  46 +
  47 + @Redirect(method = "runGameLoop()V", at = @At(
  48 + value = "INVOKE",
  49 + target = "Lnet/minecraft/client/shader/Framebuffer;framebufferRender(II)V"
  50 + ))
  51 + private void renderFBO(Framebuffer framebufferMc, int width, int height)
  52 + {
  53 + boolean fboEnabled = OpenGlHelper.isFramebufferEnabled();
  54 + if (fboEnabled)
  55 + {
  56 + ClientProxy.preRenderFBO(framebufferMc);
  57 + framebufferMc.framebufferRender(width, height);
  58 + ClientProxy.preRenderFBO(framebufferMc);
  59 + }
  60 + else
  61 + {
  62 + framebufferMc.framebufferRender(width, height);
  63 + }
  64 + }
  65 +
  66 + @Inject(method = "runGameLoop()V", at = @At(
  67 + value = "INVOKE_STRING",
  68 + target = "Lnet/minecraft/profiler/Profiler;startSection(Ljava/lang/String;)V",
  69 + args = "ldc=tick"
  70 + ))
  71 + private void onTimerUpdate(CallbackInfo ci)
  72 + {
  73 + ClientProxy.onTimerUpdate();
  74 + }
  75 +
  76 + @Inject (method = "runGameLoop()V", at = @At(
  77 + value = "INVOKE_STRING",
  78 + target = "Lnet/minecraft/profiler/Profiler;endStartSection(Ljava/lang/String;)V",
  79 + args = "ldc=gameRenderer"
  80 + ))
  81 + private void onRender(CallbackInfo ci)
  82 + {
  83 + ClientProxy.onRender();
  84 + }
  85 +}
... ...
src/client/java/com/mumfrey/liteloader/client/mixin/MixinNetHandlerLoginClient.java 0 → 100644
  1 +package com.mumfrey.liteloader.client.mixin;
  2 +
  3 +import org.spongepowered.asm.mixin.Mixin;
  4 +import org.spongepowered.asm.mixin.Shadow;
  5 +
  6 +import com.mumfrey.liteloader.client.ducks.IClientNetLoginHandler;
  7 +
  8 +import net.minecraft.client.network.NetHandlerLoginClient;
  9 +import net.minecraft.network.NetworkManager;
  10 +
  11 +@Mixin(NetHandlerLoginClient.class)
  12 +public abstract class MixinNetHandlerLoginClient implements IClientNetLoginHandler
  13 +{
  14 + @Shadow private NetworkManager networkManager;
  15 +
  16 + @Override
  17 + public NetworkManager getNetMgr()
  18 + {
  19 + return this.networkManager;
  20 + }
  21 +}
... ...
src/client/java/com/mumfrey/liteloader/client/mixin/MixinObjectIntIdentityMap.java 0 → 100644
  1 +package com.mumfrey.liteloader.client.mixin;
  2 +
  3 +import java.util.IdentityHashMap;
  4 +import java.util.List;
  5 +
  6 +import org.spongepowered.asm.mixin.Mixin;
  7 +import org.spongepowered.asm.mixin.Shadow;
  8 +
  9 +import com.mumfrey.liteloader.client.ducks.IObjectIntIdentityMap;
  10 +
  11 +import net.minecraft.util.ObjectIntIdentityMap;
  12 +
  13 +@Mixin(ObjectIntIdentityMap.class)
  14 +public abstract class MixinObjectIntIdentityMap implements IObjectIntIdentityMap
  15 +{
  16 + @Shadow private IdentityHashMap<?, Integer> identityMap;
  17 + @Shadow private List<?> objectList;
  18 +
  19 + @SuppressWarnings("unchecked")
  20 + @Override
  21 + public <V> IdentityHashMap<V, Integer> getIdentityMap()
  22 + {
  23 + return (IdentityHashMap<V, Integer>)this.identityMap;
  24 + }
  25 +
  26 + @SuppressWarnings("unchecked")
  27 + @Override
  28 + public <V> List<V> getObjectList()
  29 + {
  30 + return (List<V>)this.objectList;
  31 + }
  32 +}
... ...
src/client/java/com/mumfrey/liteloader/client/mixin/MixinRealmsMainScreen.java 0 → 100644
  1 +package com.mumfrey.liteloader.client.mixin;
  2 +
  3 +import org.spongepowered.asm.mixin.Mixin;
  4 +import org.spongepowered.asm.mixin.injection.At;
  5 +import org.spongepowered.asm.mixin.injection.Inject;
  6 +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
  7 +import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
  8 +
  9 +import com.mojang.realmsclient.RealmsMainScreen;
  10 +import com.mojang.realmsclient.dto.RealmsServer;
  11 +import com.mumfrey.liteloader.client.PacketEventsClient;
  12 +
  13 +import net.minecraft.realms.RealmsScreen;
  14 +
  15 +@Mixin(value = RealmsMainScreen.class, remap = false)
  16 +public abstract class MixinRealmsMainScreen extends RealmsScreen
  17 +{
  18 + @Inject(method = "play(J)V", locals = LocalCapture.CAPTURE_FAILSOFT, at = @At(
  19 + value = "INVOKE",
  20 + target = "Lcom/mojang/realmsclient/RealmsMainScreen;stopRealmsFetcherAndPinger()V"
  21 + ))
  22 + private void onJoinRealm(long serverId, CallbackInfo ci, RealmsServer server)
  23 + {
  24 + PacketEventsClient.onJoinRealm(serverId, server);
  25 + }
  26 +}
... ...
src/client/java/com/mumfrey/liteloader/client/mixin/MixinRegistryNamespaced.java 0 → 100644
  1 +package com.mumfrey.liteloader.client.mixin;
  2 +
  3 +import org.spongepowered.asm.mixin.Mixin;
  4 +import org.spongepowered.asm.mixin.Shadow;
  5 +
  6 +import com.mumfrey.liteloader.client.ducks.INamespacedRegistry;
  7 +import com.mumfrey.liteloader.client.ducks.IObjectIntIdentityMap;
  8 +
  9 +import net.minecraft.util.ObjectIntIdentityMap;
  10 +import net.minecraft.util.RegistryNamespaced;
  11 +import net.minecraft.util.RegistrySimple;
  12 +
  13 +@Mixin(RegistryNamespaced.class)
  14 +public abstract class MixinRegistryNamespaced extends RegistrySimple implements INamespacedRegistry
  15 +{
  16 + @Shadow protected ObjectIntIdentityMap underlyingIntegerMap;
  17 +
  18 + @Override
  19 + public IObjectIntIdentityMap getUnderlyingMap()
  20 + {
  21 + return (IObjectIntIdentityMap)this.underlyingIntegerMap;
  22 + }
  23 +}
... ...
src/client/java/com/mumfrey/liteloader/client/mixin/MixinRegistrySimple.java 0 → 100644
  1 +package com.mumfrey.liteloader.client.mixin;
  2 +
  3 +import java.util.Map;
  4 +
  5 +import org.spongepowered.asm.mixin.Mixin;
  6 +import org.spongepowered.asm.mixin.Shadow;
  7 +
  8 +import com.mumfrey.liteloader.client.ducks.IRegistrySimple;
  9 +
  10 +import net.minecraft.util.RegistrySimple;
  11 +
  12 +@Mixin(RegistrySimple.class)
  13 +public abstract class MixinRegistrySimple implements IRegistrySimple
  14 +{
  15 + @Shadow protected Map<?, ?> registryObjects;
  16 +
  17 + @SuppressWarnings("unchecked")
  18 + @Override
  19 + public <K, V> Map<K, V> getRegistryObjects()
  20 + {
  21 + return (Map<K, V>)this.registryObjects;
  22 + }
  23 +}
... ...
src/client/java/com/mumfrey/liteloader/client/mixin/MixinRenderManager.java 0 → 100644
  1 +package com.mumfrey.liteloader.client.mixin;
  2 +
  3 +import java.util.Map;
  4 +
  5 +import org.spongepowered.asm.mixin.Mixin;
  6 +import org.spongepowered.asm.mixin.Shadow;
  7 +import org.spongepowered.asm.mixin.injection.At;
  8 +import org.spongepowered.asm.mixin.injection.Redirect;
  9 +
  10 +import com.mumfrey.liteloader.client.ClientProxy;
  11 +import com.mumfrey.liteloader.client.ducks.IRenderManager;
  12 +
  13 +import net.minecraft.client.renderer.entity.Render;
  14 +import net.minecraft.client.renderer.entity.RenderManager;
  15 +import net.minecraft.entity.Entity;
  16 +
  17 +@Mixin(RenderManager.class)
  18 +public abstract class MixinRenderManager implements IRenderManager
  19 +{
  20 + @Shadow private Map<Class<? extends Entity>, Render> entityRenderMap;
  21 +
  22 + @Override
  23 + public Map<Class<? extends Entity>, Render> getRenderMap()
  24 + {
  25 + return this.entityRenderMap;
  26 + }
  27 +
  28 + @Redirect(method = "doRenderEntity(Lnet/minecraft/entity/Entity;DDDFFZ)Z", at = @At(
  29 + value = "INVOKE",
  30 + target = "Lnet/minecraft/client/renderer/entity/Render;doRender(Lnet/minecraft/entity/Entity;DDDFF)V"
  31 + ))
  32 + private void onRenderEntity(Render render, Entity entity, double x, double y, double z, float entityYaw, float partialTicks)
  33 + {
  34 + RenderManager source = (RenderManager)(Object)this;
  35 + ClientProxy.onRenderEntity(source, render, entity, x, y, z, entityYaw, partialTicks);
  36 + render.doRender(entity, x, y, z, entityYaw, partialTicks);
  37 + ClientProxy.onPostRenderEntity(source, render, entity, x, y, z, entityYaw, partialTicks);
  38 + }
  39 +}
... ...
src/client/java/com/mumfrey/liteloader/client/mixin/MixinScreenShotHelper.java 0 → 100644
  1 +package com.mumfrey.liteloader.client.mixin;
  2 +
  3 +import java.io.File;
  4 +
  5 +import org.spongepowered.asm.mixin.Mixin;
  6 +import org.spongepowered.asm.mixin.injection.At;
  7 +import org.spongepowered.asm.mixin.injection.Inject;
  8 +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
  9 +
  10 +import com.mumfrey.liteloader.client.ClientProxy;
  11 +
  12 +import net.minecraft.client.shader.Framebuffer;
  13 +import net.minecraft.util.IChatComponent;
  14 +import net.minecraft.util.ScreenShotHelper;
  15 +
  16 +@Mixin(ScreenShotHelper.class)
  17 +public abstract class MixinScreenShotHelper
  18 +{
  19 + @Inject(
  20 + method = "saveScreenshot(Ljava/io/File;Ljava/lang/String;IILnet/minecraft/client/shader/Framebuffer;)Lnet/minecraft/util/IChatComponent;",
  21 + at = @At(
  22 + value = "INVOKE",
  23 + target = "Lnet/minecraft/client/renderer/OpenGlHelper;isFramebufferEnabled()Z",
  24 + ordinal = 0
  25 + ),
  26 + cancellable = true
  27 + )
  28 + private static void onSaveScreenshot(File gameDir, String name, int width, int height, Framebuffer fbo, CallbackInfoReturnable<IChatComponent> ci)
  29 + {
  30 + ClientProxy.onSaveScreenshot(ci, gameDir, name, width, height, fbo);
  31 + }
  32 +}
... ...
src/client/java/com/mumfrey/liteloader/client/mixin/MixinSession.java 0 → 100644
  1 +package com.mumfrey.liteloader.client.mixin;
  2 +
  3 +import java.util.UUID;
  4 +
  5 +import org.spongepowered.asm.mixin.Mixin;
  6 +import org.spongepowered.asm.mixin.Shadow;
  7 +import org.spongepowered.asm.mixin.injection.At;
  8 +import org.spongepowered.asm.mixin.injection.Inject;
  9 +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
  10 +
  11 +import com.mojang.authlib.GameProfile;
  12 +
  13 +import net.minecraft.entity.player.EntityPlayer;
  14 +import net.minecraft.util.Session;
  15 +
  16 +@Mixin(Session.class)
  17 +public abstract class MixinSession
  18 +{
  19 + @Shadow public abstract String getUsername();
  20 +
  21 + @Inject(method = "getProfile()Lcom/mojang/authlib/GameProfile;", cancellable = true, at = @At(
  22 + value = "NEW",
  23 + args = "class=com/mojang/authlib/GameProfile",
  24 + ordinal = 1
  25 + ))
  26 + private void generateGameProfile(CallbackInfoReturnable<GameProfile> ci)
  27 + {
  28 + UUID uuid = EntityPlayer.getUUID(new GameProfile((UUID)null, this.getUsername()));
  29 + ci.setReturnValue(new GameProfile(uuid, this.getUsername()));
  30 + }
  31 +}
... ...
src/client/java/com/mumfrey/liteloader/client/mixin/MixinSimpleReloadableResourceManager.java 0 → 100644
  1 +package com.mumfrey.liteloader.client.mixin;
  2 +
  3 +import java.util.List;
  4 +
  5 +import org.spongepowered.asm.mixin.Mixin;
  6 +import org.spongepowered.asm.mixin.Shadow;
  7 +
  8 +import com.mumfrey.liteloader.client.ducks.IReloadable;
  9 +
  10 +import net.minecraft.client.resources.IResourceManagerReloadListener;
  11 +import net.minecraft.client.resources.SimpleReloadableResourceManager;
  12 +
  13 +@Mixin(SimpleReloadableResourceManager.class)
  14 +public abstract class MixinSimpleReloadableResourceManager implements IReloadable
  15 +{
  16 + @Shadow private List<IResourceManagerReloadListener> reloadListeners;
  17 +
  18 + @Override
  19 + public List<IResourceManagerReloadListener> getReloadListeners()
  20 + {
  21 + return this.reloadListeners;
  22 + }
  23 +}
... ...
src/client/java/com/mumfrey/liteloader/client/mixin/MixinTileEntityRendererDispatcher.java 0 → 100644
  1 +package com.mumfrey.liteloader.client.mixin;
  2 +
  3 +import java.util.Map;
  4 +
  5 +import org.spongepowered.asm.mixin.Mixin;
  6 +import org.spongepowered.asm.mixin.Shadow;
  7 +
  8 +import com.mumfrey.liteloader.client.ducks.ITileEntityRendererDispatcher;
  9 +
  10 +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
  11 +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
  12 +import net.minecraft.tileentity.TileEntity;
  13 +
  14 +@Mixin(TileEntityRendererDispatcher.class)
  15 +public abstract class MixinTileEntityRendererDispatcher implements ITileEntityRendererDispatcher
  16 +{
  17 + @Shadow private Map<Class<? extends TileEntity>, TileEntitySpecialRenderer> mapSpecialRenderers;
  18 +
  19 + @Override
  20 + public Map<Class<? extends TileEntity>, TileEntitySpecialRenderer> getSpecialRenderMap()
  21 + {
  22 + return this.mapSpecialRenderers;
  23 + }
  24 +}
... ...
src/client/java/com/mumfrey/liteloader/client/transformers/LiteLoaderEventInjectionTransformer.java deleted 100644 → 0
1   -package com.mumfrey.liteloader.client.transformers;
2   -
3   -import static com.mumfrey.liteloader.core.runtime.Methods.*;
4   -import static com.mumfrey.liteloader.transformers.event.InjectionPoint.*;
5   -
6   -import com.mumfrey.liteloader.common.transformers.LiteLoaderEventTransformer;
7   -import com.mumfrey.liteloader.core.runtime.Obf;
8   -import com.mumfrey.liteloader.transformers.event.Event;
9   -import com.mumfrey.liteloader.transformers.event.InjectionPoint;
10   -import com.mumfrey.liteloader.transformers.event.inject.BeforeInvoke;
11   -import com.mumfrey.liteloader.transformers.event.inject.BeforeNew;
12   -import com.mumfrey.liteloader.transformers.event.inject.BeforeReturn;
13   -import com.mumfrey.liteloader.transformers.event.inject.BeforeStringInvoke;
14   -import com.mumfrey.liteloader.transformers.event.inject.MethodHead;
15   -
16   -/**
17   - * Injector for LiteLoader's main events
18   - *
19   - * @author Adam Mummery-Smith
20   - */
21   -public class LiteLoaderEventInjectionTransformer extends LiteLoaderEventTransformer
22   -{
23   - @Override
24   - protected Obf getProxy()
25   - {
26   - return Obf.CallbackProxyClient;
27   - }
28   -
29   - @Override
30   - protected void addEvents()
31   - {
32   - super.addEvents();
33   -
34   - // Event declaraions
35   - Event onOutboundChat = Event.getOrCreate("onOutboundChat", true);
36   - Event onResize = Event.getOrCreate("updateFramebufferSize", false);
37   - Event preRenderFBO = Event.getOrCreate("preRenderFBO", false);
38   - Event renderFBO = Event.getOrCreate("renderFBO", false);
39   - Event postRenderFBO = Event.getOrCreate("postRenderFBO", false);
40   - Event onRenderWorld = Event.getOrCreate("onRenderWorld", false);
41   - Event onRenderSky = Event.getOrCreate("onRenderSky", false);
42   - Event onRenderClouds = Event.getOrCreate("onRenderClouds", false);
43   - Event onRenderTerrain = Event.getOrCreate("onRenderTerrain", false);
44   - Event onTimerUpdate = Event.getOrCreate("onTimerUpdate", false);
45   - Event onRender = Event.getOrCreate("onRender", false);
46   - Event newTick = Event.getOrCreate("newTick", false);
47   - Event onTick = Event.getOrCreate("onTick", false);
48   - Event preRenderGUI = Event.getOrCreate("preRenderGUI", false);
49   - Event onRenderHUD = Event.getOrCreate("onRenderHUD", false);
50   - Event postRenderHUD = Event.getOrCreate("postRenderHUD", false);
51   - Event onSetupCameraTransform = Event.getOrCreate("onSetupCameraTransform", false);
52   - Event postRenderEntities = Event.getOrCreate("postRenderEntities", false);
53   - Event postRender = Event.getOrCreate("postRender", false);
54   - Event onRenderChat = Event.getOrCreate("onRenderChat", false);
55   - Event postRenderChat = Event.getOrCreate("postRenderChat", false);
56   - Event onCreateIntegratedServer = Event.getOrCreate("onCreateIntegratedServer", false);
57   - Event onStartupComplete = Event.getOrCreate("onStartupComplete", false);
58   - Event onSessionProfileBad = Event.getOrCreate("onSessionProfileBad", true);
59   - Event onSaveScreenshot = Event.getOrCreate("onSaveScreenshot", true);
60   - Event onRenderEntity = Event.getOrCreate("onRenderEntity", false);
61   - Event onPostRenderEntity = Event.getOrCreate("onPostRenderEntity", false);
62   - Event onJoinRealm = Event.getOrCreate("onJoinRealm", false);
63   -
64   - // Injection Points
65   - InjectionPoint methodHead = new MethodHead();
66   - InjectionPoint methodReturn = new BeforeReturn();
67   - InjectionPoint beforeGlClear = new BeforeInvoke(glClear);
68   - InjectionPoint beforeFBORender = new BeforeInvoke(framebufferRender);
69   - InjectionPoint beforeRenderHUD = new BeforeInvoke(renderGameOverlay);
70   - InjectionPoint beforeBindFBOTex = new BeforeInvoke(bindFramebufferTexture);
71   - InjectionPoint beforeRender = new BeforeInvoke(updateCameraAndRender);
72   - InjectionPoint beforeDrawChat = new BeforeInvoke(drawChat);
73   - InjectionPoint beforeEndProfiler = new BeforeInvoke(endSection);
74   - InjectionPoint beforeIsFBOEnabled = new BeforeInvoke(isFramebufferEnabled);
75   - InjectionPoint beforeRenderEntity = new BeforeInvoke(doRender).setCaptureLocals(true);
76   - InjectionPoint beforeStopRealsmFetcher = new BeforeInvoke(realmsStopFetcher).setCaptureLocals(true);
77   - InjectionPoint beforeTickProfiler = new BeforeStringInvoke("tick", startSection);
78   - InjectionPoint beforeCenterProfiler = new BeforeStringInvoke("center", startSection);
79   - InjectionPoint beforeSkyProfiler = new BeforeStringInvoke("sky", endStartSection);
80   - InjectionPoint beforeCloudsProfiler = new BeforeStringInvoke("clouds", endStartSection);
81   - InjectionPoint beforeTerrainProfiler = new BeforeStringInvoke("terrain", endStartSection);
82   - InjectionPoint beforeRenderProfiler = new BeforeStringInvoke("gameRenderer", endStartSection);
83   - InjectionPoint beforeFrustumProfiler = new BeforeStringInvoke("frustum", endStartSection);
84   - InjectionPoint beforeParticlesProfiler = new BeforeStringInvoke("litParticles", endStartSection);
85   - InjectionPoint beforeNewGameProfile = new BeforeNew(1, Obf.GameProfile);
86   -
87   - // Hooks
88   - this.add(onOutboundChat, sendChatMessage, (methodHead), "onOutboundChat");
89   - this.add(onResize, updateFramebufferSize, (methodHead), "onResize");
90   - this.add(preRenderFBO, runGameLoop, (beforeFBORender), "preRenderFBO");
91   - this.add(renderFBO, framebufferRenderExt, (beforeBindFBOTex), "renderFBO");
92   - this.add(postRenderFBO, runGameLoop, after(beforeFBORender), "postRenderFBO");
93   - this.add(onRenderWorld, renderWorld, (beforeCenterProfiler), "onRenderWorld");
94   - this.add(onRenderSky, renderWorldPass, (beforeSkyProfiler), "onRenderSky");
95   - this.add(onRenderClouds, renderCloudsCheck, (beforeCloudsProfiler), "onRenderClouds");
96   - this.add(onRenderTerrain, renderWorldPass, (beforeTerrainProfiler), "onRenderTerrain");
97   - this.add(onTimerUpdate, runGameLoop, (beforeTickProfiler), "onTimerUpdate");
98   - this.add(onRender, runGameLoop, (beforeRenderProfiler), "onRender");
99   - this.add(newTick, runTick, (methodHead), "newTick");
100   - this.add(onTick, runGameLoop, after(beforeRender), "onTick");
101   - this.add(preRenderGUI, updateCameraAndRender, after(beforeGlClear), "preRenderGUI");
102   - this.add(onRenderHUD, updateCameraAndRender, (beforeRenderHUD), "onRenderHUD");
103   - this.add(postRenderHUD, updateCameraAndRender, after(beforeRenderHUD), "postRenderHUD");
104   - this.add(onSetupCameraTransform, renderWorldPass, (beforeFrustumProfiler), "onSetupCameraTransform");
105   - this.add(postRenderEntities, renderWorldPass, (beforeParticlesProfiler), "postRenderEntities");
106   - this.add(postRender, renderWorld, (beforeEndProfiler), "postRender");
107   - this.add(onRenderChat, renderGameOverlay, (beforeDrawChat), "onRenderChat");
108   - this.add(postRenderChat, renderGameOverlay, after(beforeDrawChat), "postRenderChat");
109   - this.add(onCreateIntegratedServer, integratedServerCtor, (methodReturn), "IntegratedServerCtor");
110   - this.add(onStartupComplete, startGame, (methodReturn), "onStartupComplete");
111   - this.add(onSaveScreenshot, saveScreenshot, (beforeIsFBOEnabled), "onSaveScreenshot");
112   - this.add(onRenderEntity, doRenderEntity, (beforeRenderEntity), "onRenderEntity");
113   - this.add(onPostRenderEntity, doRenderEntity, after(beforeRenderEntity), "onPostRenderEntity");
114   -
115   - // Compatibility handlers
116   - this.add(onSessionProfileBad, getProfile, (beforeNewGameProfile), "generateOfflineUUID");
117   -
118   - // Protocol handlers
119   - this.add(onJoinRealm, realmsPlay, (beforeStopRealsmFetcher), "onJoinRealm", Obf.PacketEventsClient);
120   - }
121   -}
src/client/java/com/mumfrey/liteloader/client/util/PrivateFieldsClient.java
1 1 package com.mumfrey.liteloader.client.util;
2 2  
3   -import java.util.IdentityHashMap;
4   -import java.util.List;
5 3 import java.util.Map;
6 4  
7   -import net.minecraft.client.network.NetHandlerLoginClient;
8   -import net.minecraft.client.renderer.entity.RenderManager;
9   -import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
10   -import net.minecraft.client.resources.IResourceManagerReloadListener;
11   -import net.minecraft.client.resources.SimpleReloadableResourceManager;
12   -import net.minecraft.network.NetworkManager;
13   -import net.minecraft.network.play.server.S02PacketChat;
14   -import net.minecraft.tileentity.TileEntity;
15   -import net.minecraft.util.IChatComponent;
16   -import net.minecraft.util.ObjectIntIdentityMap;
17   -import net.minecraft.util.RegistryNamespaced;
18   -import net.minecraft.util.RegistrySimple;
19   -
20 5 import com.mumfrey.liteloader.core.runtime.Obf;
21 6 import com.mumfrey.liteloader.util.PrivateFields;
22 7  
  8 +import net.minecraft.tileentity.TileEntity;
  9 +
23 10 @SuppressWarnings("rawtypes")
24 11 public final class PrivateFieldsClient<P, T> extends PrivateFields<P, T>
25 12 {
... ... @@ -30,17 +17,6 @@ public final class PrivateFieldsClient&lt;P, T&gt; extends PrivateFields&lt;P, T&gt;
30 17  
31 18 // CHECKSTYLE:OFF
32 19  
33   - public static final PrivateFieldsClient<RenderManager, Map> entityRenderMap = new PrivateFieldsClient<RenderManager, Map> (RenderManager.class, Obf.entityRenderMap);
34   - public static final PrivateFieldsClient<NetHandlerLoginClient, NetworkManager> netManager = new PrivateFieldsClient<NetHandlerLoginClient, NetworkManager> (NetHandlerLoginClient.class, Obf.networkManager);
35   - public static final PrivateFieldsClient<RegistrySimple, Map> registryObjects = new PrivateFieldsClient<RegistrySimple, Map> (RegistrySimple.class, Obf.registryObjects);
36   - public static final PrivateFieldsClient<RegistryNamespaced, ObjectIntIdentityMap> underlyingIntegerMap = new PrivateFieldsClient<RegistryNamespaced, ObjectIntIdentityMap>(RegistryNamespaced.class, Obf.underlyingIntegerMap);
37   - public static final PrivateFieldsClient<ObjectIntIdentityMap, IdentityHashMap> identityMap = new PrivateFieldsClient<ObjectIntIdentityMap, IdentityHashMap> (ObjectIntIdentityMap.class, Obf.identityMap);
38   - public static final PrivateFieldsClient<ObjectIntIdentityMap, List> objectList = new PrivateFieldsClient<ObjectIntIdentityMap, List> (ObjectIntIdentityMap.class, Obf.objectList);
39   - public static final PrivateFieldsClient<TileEntityRendererDispatcher, Map> specialRendererMap = new PrivateFieldsClient<TileEntityRendererDispatcher, Map> (TileEntityRendererDispatcher.class, Obf.mapSpecialRenderers);
40   - public static final PrivateFieldsClient<TileEntity, Map> tileEntityNameToClassMap = new PrivateFieldsClient<TileEntity, Map> (TileEntity.class, Obf.tileEntityNameToClassMap);
41   - public static final PrivateFieldsClient<TileEntity, Map> tileEntityClassToNameMap = new PrivateFieldsClient<TileEntity, Map> (TileEntity.class, Obf.tileEntityClassToNameMap);
42   - public static final PrivateFieldsClient<S02PacketChat, IChatComponent> chatMessage = new PrivateFieldsClient<S02PacketChat, IChatComponent> (S02PacketChat.class, Obf.chatComponent);
43   -
44   - public static final PrivateFieldsClient<SimpleReloadableResourceManager, List<IResourceManagerReloadListener>> reloadListeners =
45   - new PrivateFieldsClient<SimpleReloadableResourceManager, List<IResourceManagerReloadListener>>(SimpleReloadableResourceManager.class, Obf.reloadListeners);
  20 + public static final PrivateFieldsClient<TileEntity, Map> tileEntityNameToClassMap = new PrivateFieldsClient<TileEntity, Map>(TileEntity.class, Obf.tileEntityNameToClassMap);
  21 + public static final PrivateFieldsClient<TileEntity, Map> tileEntityClassToNameMap = new PrivateFieldsClient<TileEntity, Map>(TileEntity.class, Obf.tileEntityClassToNameMap);
46 22 }
47 23 \ No newline at end of file
... ...
src/client/java/com/mumfrey/liteloader/util/ModUtilities.java
... ... @@ -6,6 +6,15 @@ import java.util.IdentityHashMap;
6 6 import java.util.List;
7 7 import java.util.Map;
8 8  
  9 +import org.lwjgl.LWJGLException;
  10 +import org.lwjgl.opengl.Display;
  11 +import org.lwjgl.opengl.DisplayMode;
  12 +
  13 +import com.mumfrey.liteloader.client.ducks.*;
  14 +import com.mumfrey.liteloader.client.overlays.IMinecraft;
  15 +import com.mumfrey.liteloader.client.util.PrivateFieldsClient;
  16 +import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
  17 +
9 18 import net.minecraft.block.Block;
10 19 import net.minecraft.client.Minecraft;
11 20 import net.minecraft.client.renderer.entity.Render;
... ... @@ -17,20 +26,9 @@ import net.minecraft.init.Blocks;
17 26 import net.minecraft.init.Items;
18 27 import net.minecraft.item.Item;
19 28 import net.minecraft.tileentity.TileEntity;
20   -import net.minecraft.util.ObjectIntIdentityMap;
21   -import net.minecraft.util.RegistryNamespaced;
22 29 import net.minecraft.util.RegistrySimple;
23 30 import net.minecraft.util.ResourceLocation;
24 31  
25   -import org.lwjgl.LWJGLException;
26   -import org.lwjgl.opengl.Display;
27   -import org.lwjgl.opengl.DisplayMode;
28   -
29   -import com.mumfrey.liteloader.client.overlays.IMinecraft;
30   -import com.mumfrey.liteloader.client.util.PrivateFieldsClient;
31   -import com.mumfrey.liteloader.core.runtime.Obf;
32   -import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
33   -
34 32 /**
35 33 * A small collection of useful functions for mods
36 34 *
... ... @@ -67,12 +65,11 @@ public abstract class ModUtilities
67 65 * @param entityClass
68 66 * @param renderer
69 67 */
70   - @SuppressWarnings("unchecked")
71 68 public static void addRenderer(Class<? extends Entity> entityClass, Render renderer)
72 69 {
73 70 RenderManager renderManager = Minecraft.getMinecraft().getRenderManager();
74 71  
75   - Map<Class<? extends Entity>, Render> entityRenderMap = PrivateFieldsClient.entityRenderMap.get(renderManager);
  72 + Map<Class<? extends Entity>, Render> entityRenderMap = ((IRenderManager)renderManager).getRenderMap();
76 73 if (entityRenderMap != null)
77 74 {
78 75 entityRenderMap.put(entityClass, renderer);
... ... @@ -84,7 +81,6 @@ public abstract class ModUtilities
84 81 }
85 82 }
86 83  
87   - @SuppressWarnings("unchecked")
88 84 public static void addRenderer(Class<? extends TileEntity> tileEntityClass, TileEntitySpecialRenderer renderer)
89 85 {
90 86 TileEntityRendererDispatcher tileEntityRenderer = TileEntityRendererDispatcher.instance;
... ... @@ -92,7 +88,7 @@ public abstract class ModUtilities
92 88 try
93 89 {
94 90 Map<Class<? extends TileEntity>, TileEntitySpecialRenderer> specialRendererMap
95   - = PrivateFieldsClient.specialRendererMap.get(tileEntityRenderer);
  91 + = ((ITileEntityRendererDispatcher)tileEntityRenderer).getSpecialRenderMap();
96 92 specialRendererMap.put(tileEntityClass, renderer);
97 93 renderer.setRendererDispatcher(tileEntityRenderer);
98 94 }
... ... @@ -203,7 +199,6 @@ public abstract class ModUtilities
203 199 {
204 200 Map<String, Class<? extends TileEntity>> nameToClassMap = PrivateFieldsClient.tileEntityNameToClassMap.get(null);
205 201 Map<Class<? extends TileEntity>, String> classToNameMap = PrivateFieldsClient.tileEntityClassToNameMap.get(null);
206   -
207 202 nameToClassMap.put(entityName, tileEntityClass);
208 203 classToNameMap.put(tileEntityClass, entityName);
209 204 }
... ... @@ -213,47 +208,18 @@ public abstract class ModUtilities
213 208 }
214 209 }
215 210  
216   - /**
217   - * Abstraction helper function
218   - *
219   - * @param fieldName Name of field to get, returned unmodified if in debug
220   - * mode
221   - * @return Obfuscated field name if present
222   - * @deprecated use ObfuscationUtilities.getObfuscatedFieldName instead
223   - */
224   - @Deprecated
225   - public static String getObfuscatedFieldName(String fieldName, String obfuscatedFieldName, String seargeFieldName)
226   - {
227   - return ObfuscationUtilities.getObfuscatedFieldName(fieldName, obfuscatedFieldName, seargeFieldName);
228   - }
229   -
230   - /**
231   - * Abstraction helper function
232   - *
233   - * @param obf Field to get, returned unmodified if in debug mode
234   - * @return Obfuscated field name if present
235   - * @deprecated use ObfuscationUtilities.getObfuscatedFieldName instead
236   - */
237   - @Deprecated
238   - public static String getObfuscatedFieldName(Obf obf)
239   - {
240   - return ObfuscationUtilities.getObfuscatedFieldName(obf);
241   - }
242   -
243   - @SuppressWarnings("unchecked")
244 211 private static <K, V> V removeObjectFromRegistry(RegistrySimple registry, K key)
245 212 {
246 213 if (registry == null) return null;
247 214  
248   - ObjectIntIdentityMap underlyingIntegerMap = null;
  215 + IObjectIntIdentityMap underlyingIntegerMap = null;
249 216  
250   - if (registry instanceof RegistryNamespaced)
  217 + if (registry instanceof INamespacedRegistry)
251 218 {
252   - RegistryNamespaced rns = (RegistryNamespaced)registry;
253   - underlyingIntegerMap = PrivateFieldsClient.underlyingIntegerMap.get(rns);
  219 + underlyingIntegerMap = ((INamespacedRegistry)registry).getUnderlyingMap();
254 220 }
255 221  
256   - Map<K, V> registryObjects = PrivateFieldsClient.registryObjects.get(registry);
  222 + Map<K, V> registryObjects = ((IRegistrySimple)registry).<K, V>getRegistryObjects();
257 223 if (registryObjects != null)
258 224 {
259 225 V existingValue = registryObjects.get(key);
... ... @@ -263,8 +229,8 @@ public abstract class ModUtilities
263 229  
264 230 if (underlyingIntegerMap != null)
265 231 {
266   - IdentityHashMap<V, Integer> identityMap = PrivateFieldsClient.identityMap.get(underlyingIntegerMap);
267   - List<V> objectList = PrivateFieldsClient.objectList.get(underlyingIntegerMap);
  232 + IdentityHashMap<V, Integer> identityMap = underlyingIntegerMap.<V>getIdentityMap();
  233 + List<V> objectList = underlyingIntegerMap.<V>getObjectList();
268 234 if (identityMap != null) identityMap.remove(existingValue);
269 235 if (objectList != null) objectList.remove(existingValue);
270 236 }
... ...
src/client/resources/mixins.liteloader.client.json 0 → 100644
  1 +{
  2 + "required": true,
  3 + "minVersion": "0.4.10",
  4 + "package": "com.mumfrey.liteloader.client.mixin",
  5 + "refmap": "mixins.liteloader.client.refmap.json",
  6 + "mixins": [
  7 + "MixinMinecraft",
  8 + "MixinSession",
  9 + "MixinEntityRenderer",
  10 + "MixinRenderManager",
  11 + "MixinGuiIngame",
  12 + "MixinEntityPlayerSP",
  13 + "MixinFramebuffer",
  14 + "MixinIntegratedServer",
  15 + "MixinScreenShotHelper",
  16 + "MixinRealmsMainScreen",
  17 + "MixinNetHandlerLoginClient",
  18 + "MixinRegistrySimple",
  19 + "MixinRegistryNamespaced",
  20 + "MixinTileEntityRendererDispatcher",
  21 + "MixinSimpleReloadableResourceManager"
  22 + ]
  23 +}
0 24 \ No newline at end of file
... ...
src/main/java/com/mumfrey/liteloader/api/LiteAPI.java
... ... @@ -53,7 +53,13 @@ public interface LiteAPI
53 53 * dependency using the api@revision syntax.
54 54 */
55 55 public abstract int getRevision();
56   -
  56 +
  57 + /**
  58 + * Get mixin environment configuration provider for this API, can return
  59 + * null.
  60 + */
  61 + public abstract MixinConfigProvider getMixins();
  62 +
57 63 /**
58 64 * Should return an array of required transformer names, these transformers
59 65 * will be injected UPSTREAM. Can return null.
... ...
src/main/java/com/mumfrey/liteloader/api/MixinConfigProvider.java 0 → 100644
  1 +package com.mumfrey.liteloader.api;
  2 +
  3 +import org.spongepowered.asm.mixin.MixinEnvironment.CompatibilityLevel;
  4 +
  5 +/**
  6 + * Container for all of an API's mixin environment configuration
  7 + */
  8 +public interface MixinConfigProvider
  9 +{
  10 + /**
  11 + * Get the minimum required mixin operating compatibility level for this
  12 + * API, can return null.
  13 + */
  14 + public abstract CompatibilityLevel getCompatibilityLevel();
  15 +
  16 + /**
  17 + * Get mixin configuration files for this API, all returned configs will be
  18 + * added to the DEFAULT environment. Can return null.
  19 + */
  20 + public abstract String[] getMixinConfigs();
  21 +
  22 + /**
  23 + * Get mixin error handler classes to register for this API. Can return
  24 + * null.
  25 + */
  26 + public abstract String[] getErrorHandlers();
  27 +}
... ...
src/main/java/com/mumfrey/liteloader/api/manager/APIAdapter.java
... ... @@ -16,6 +16,12 @@ import com.mumfrey.liteloader.interfaces.InterfaceRegistry;
16 16 public interface APIAdapter
17 17 {
18 18 /**
  19 + * APIs should register their mixin configs and set up the mixin environment
  20 + * here.
  21 + */
  22 + public abstract void initMixins();
  23 +
  24 + /**
19 25 * Aggregate and return required transformers from all registered APIs
20 26 */
21 27 public abstract List<String> getRequiredTransformers();
... ...
src/main/java/com/mumfrey/liteloader/api/manager/APIProviderBasic.java
... ... @@ -8,8 +8,12 @@ import java.util.List;
8 8 import java.util.Map;
9 9 import java.util.regex.Matcher;
10 10  
  11 +import org.spongepowered.asm.mixin.MixinEnvironment;
  12 +import org.spongepowered.asm.mixin.MixinEnvironment.CompatibilityLevel;
  13 +
11 14 import com.mumfrey.liteloader.api.CoreProvider;
12 15 import com.mumfrey.liteloader.api.LiteAPI;
  16 +import com.mumfrey.liteloader.api.MixinConfigProvider;
13 17 import com.mumfrey.liteloader.api.Observer;
14 18 import com.mumfrey.liteloader.interfaces.InterfaceRegistry;
15 19  
... ... @@ -54,6 +58,44 @@ class APIProviderBasic implements APIProvider, APIAdapter
54 58 this.apiMap.put(api.getIdentifier(), api);
55 59 }
56 60 }
  61 +
  62 + /* (non-Javadoc)
  63 + * @see com.mumfrey.liteloader.api.manager.APIAdapter#initMixins()
  64 + */
  65 + @Override
  66 + public void initMixins()
  67 + {
  68 + for (LiteAPI api : this.apis)
  69 + {
  70 + MixinConfigProvider mixins = api.getMixins();
  71 + if (mixins != null)
  72 + {
  73 + CompatibilityLevel level = mixins.getCompatibilityLevel();
  74 + if (level != null)
  75 + {
  76 + MixinEnvironment.setCompatibilityLevel(level);
  77 + }
  78 +
  79 + String[] configs = mixins.getMixinConfigs();
  80 + if (configs != null)
  81 + {
  82 + for (String config : configs)
  83 + {
  84 + MixinEnvironment.getDefaultEnvironment().addConfiguration(config);
  85 + }
  86 + }
  87 +
  88 + String[] errorHandlers = mixins.getErrorHandlers();
  89 + if (errorHandlers != null)
  90 + {
  91 + for (String handlerName : errorHandlers)
  92 + {
  93 + MixinEnvironment.getDefaultEnvironment().registerErrorHandlerClass(handlerName);
  94 + }
  95 + }
  96 + }
  97 + }
  98 + }
57 99  
58 100 /* (non-Javadoc)
59 101 * @see com.mumfrey.liteloader.api.manager.APIProvider
... ...
src/main/java/com/mumfrey/liteloader/common/ducks/IChatPacket.java 0 → 100644
  1 +package com.mumfrey.liteloader.common.ducks;
  2 +
  3 +import net.minecraft.util.IChatComponent;
  4 +
  5 +public interface IChatPacket
  6 +{
  7 + public abstract IChatComponent getChatComponent();
  8 +
  9 + public abstract void setChatComponent(IChatComponent chatComponent);
  10 +}
... ...
src/main/java/com/mumfrey/liteloader/common/ducks/IPacketClientSettings.java 0 → 100644
  1 +package com.mumfrey.liteloader.common.ducks;
  2 +
  3 +public interface IPacketClientSettings
  4 +{
  5 + public abstract int getViewDistance();
  6 +}
... ...
src/main/java/com/mumfrey/liteloader/common/mixin/MixinC15PacketClientSettings.java 0 → 100644
  1 +package com.mumfrey.liteloader.common.mixin;
  2 +
  3 +import org.spongepowered.asm.mixin.Mixin;
  4 +import org.spongepowered.asm.mixin.Shadow;
  5 +
  6 +import com.mumfrey.liteloader.common.ducks.IPacketClientSettings;
  7 +
  8 +import net.minecraft.network.play.client.C15PacketClientSettings;
  9 +
  10 +@Mixin(C15PacketClientSettings.class)
  11 +public abstract class MixinC15PacketClientSettings implements IPacketClientSettings
  12 +{
  13 + @Shadow private int view;
  14 +
  15 + @Override
  16 + public int getViewDistance()
  17 + {
  18 + return this.view;
  19 + }
  20 +}
... ...
src/main/java/com/mumfrey/liteloader/common/mixin/MixinItemInWorldManager.java 0 → 100644
  1 +package com.mumfrey.liteloader.common.mixin;
  2 +
  3 +import org.spongepowered.asm.mixin.Mixin;
  4 +import org.spongepowered.asm.mixin.injection.At;
  5 +import org.spongepowered.asm.mixin.injection.Inject;
  6 +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
  7 +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
  8 +
  9 +import com.mumfrey.liteloader.core.Proxy;
  10 +
  11 +import net.minecraft.entity.player.EntityPlayer;
  12 +import net.minecraft.item.ItemStack;
  13 +import net.minecraft.server.management.ItemInWorldManager;
  14 +import net.minecraft.util.BlockPos;
  15 +import net.minecraft.util.EnumFacing;
  16 +import net.minecraft.world.World;
  17 +
  18 +@Mixin(ItemInWorldManager.class)
  19 +public abstract class MixinItemInWorldManager
  20 +{
  21 + @Inject(
  22 + method = "onBlockClicked(Lnet/minecraft/util/BlockPos;Lnet/minecraft/util/EnumFacing;)V",
  23 + cancellable = true,
  24 + at = @At("HEAD")
  25 + )
  26 + private void onBlockClicked(BlockPos pos, EnumFacing side, CallbackInfo ci)
  27 + {
  28 + Proxy.onBlockClicked(ci, (ItemInWorldManager)(Object)this, pos, side);
  29 + }
  30 +
  31 + @Inject(
  32 + method = "activateBlockOrUseItem(Lnet/minecraft/entity/player/EntityPlayer;Lnet/minecraft/world/World;Lnet/minecraft/item/ItemStack;"
  33 + + "Lnet/minecraft/util/BlockPos;Lnet/minecraft/util/EnumFacing;FFF)Z",
  34 + cancellable = true,
  35 + at = @At("HEAD")
  36 + )
  37 + private void onUseItem(EntityPlayer player, World worldIn, ItemStack stack, BlockPos pos, EnumFacing side, float offsetX, float offsetY,
  38 + float offsetZ, CallbackInfoReturnable<Boolean> cir)
  39 + {
  40 + Proxy.onUseItem(cir, player, worldIn, stack, pos, side, offsetX, offsetY, offsetZ);
  41 + }
  42 +}
... ...
src/main/java/com/mumfrey/liteloader/common/mixin/MixinMinecraftServer.java 0 → 100644
  1 +package com.mumfrey.liteloader.common.mixin;
  2 +
  3 +import org.spongepowered.asm.mixin.Mixin;
  4 +import org.spongepowered.asm.mixin.injection.At;
  5 +import org.spongepowered.asm.mixin.injection.Inject;
  6 +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
  7 +
  8 +import com.mumfrey.liteloader.core.Proxy;
  9 +
  10 +import net.minecraft.server.MinecraftServer;
  11 +
  12 +@Mixin(MinecraftServer.class)
  13 +public abstract class MixinMinecraftServer
  14 +{
  15 + @Inject(method = "updateTimeLightAndEntities()V", at = @At("HEAD"))
  16 + private void onServerTick(CallbackInfo ci)
  17 + {
  18 + Proxy.onServerTick((MinecraftServer)(Object)this);
  19 + }
  20 +}
... ...
src/main/java/com/mumfrey/liteloader/common/mixin/MixinNetHandlerPlayServer.java 0 → 100644
  1 +package com.mumfrey.liteloader.common.mixin;
  2 +
  3 +import org.objectweb.asm.Opcodes;
  4 +import org.spongepowered.asm.mixin.Mixin;
  5 +import org.spongepowered.asm.mixin.injection.At;
  6 +import org.spongepowered.asm.mixin.injection.At.Shift;
  7 +import org.spongepowered.asm.mixin.injection.Inject;
  8 +import org.spongepowered.asm.mixin.injection.Surrogate;
  9 +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
  10 +import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
  11 +
  12 +import com.mumfrey.liteloader.core.Proxy;
  13 +
  14 +import net.minecraft.network.NetHandlerPlayServer;
  15 +import net.minecraft.network.play.client.C03PacketPlayer;
  16 +import net.minecraft.network.play.client.C07PacketPlayerDigging;
  17 +import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;
  18 +import net.minecraft.network.play.client.C0APacketAnimation;
  19 +import net.minecraft.world.WorldServer;
  20 +
  21 +@Mixin(NetHandlerPlayServer.class)
  22 +public abstract class MixinNetHandlerPlayServer
  23 +{
  24 + @Inject(
  25 + method = "processPlayerBlockPlacement(Lnet/minecraft/network/play/client/C08PacketPlayerBlockPlacement;)V",
  26 + cancellable = true,
  27 + at = @At(
  28 + value = "INVOKE",
  29 + shift = Shift.AFTER,
  30 + target = "Lnet/minecraft/network/PacketThreadUtil;checkThreadAndEnqueue"
  31 + + "(Lnet/minecraft/network/Packet;Lnet/minecraft/network/INetHandler;Lnet/minecraft/util/IThreadListener;)V"
  32 + )
  33 + )
  34 + private void onPlaceBlock(C08PacketPlayerBlockPlacement packetIn, CallbackInfo ci)
  35 + {
  36 + Proxy.onPlaceBlock(ci, (NetHandlerPlayServer)(Object)this, packetIn);
  37 + }
  38 +
  39 + @Inject(
  40 + method = "handleAnimation(Lnet/minecraft/network/play/client/C0APacketAnimation;)V",
  41 + cancellable = true,
  42 + at = @At(
  43 + value = "INVOKE",
  44 + shift = Shift.AFTER,
  45 + target = "Lnet/minecraft/network/PacketThreadUtil;checkThreadAndEnqueue"
  46 + + "(Lnet/minecraft/network/Packet;Lnet/minecraft/network/INetHandler;Lnet/minecraft/util/IThreadListener;)V"
  47 + )
  48 + )
  49 + private void onClickedAir(C0APacketAnimation packetIn, CallbackInfo ci)
  50 + {
  51 + Proxy.onClickedAir(ci, (NetHandlerPlayServer)(Object)this, packetIn);
  52 + }
  53 +
  54 + @Inject(
  55 + method = "processPlayerDigging(Lnet/minecraft/network/play/client/C07PacketPlayerDigging;)V",
  56 + cancellable = true,
  57 + at = @At(
  58 + value = "INVOKE",
  59 + shift = Shift.AFTER,
  60 + target = "Lnet/minecraft/network/PacketThreadUtil;checkThreadAndEnqueue"
  61 + + "(Lnet/minecraft/network/Packet;Lnet/minecraft/network/INetHandler;Lnet/minecraft/util/IThreadListener;)V"
  62 + )
  63 + )
  64 + private void onPlayerDigging(C07PacketPlayerDigging packetIn, CallbackInfo ci)
  65 + {
  66 + Proxy.onPlayerDigging(ci, (NetHandlerPlayServer)(Object)this, packetIn);
  67 + }
  68 +
  69 + @Inject(
  70 + method = "processPlayer(Lnet/minecraft/network/play/client/C03PacketPlayer;)V",
  71 + cancellable = true,
  72 + locals = LocalCapture.CAPTURE_FAILHARD,
  73 + at = @At(
  74 + value = "FIELD",
  75 + opcode = Opcodes.GETFIELD,
  76 + target = "Lnet/minecraft/entity/player/EntityPlayerMP;posY:D",
  77 + ordinal = 4
  78 + )
  79 + )
  80 + private void onPlayerMoved(C03PacketPlayer packetIn, CallbackInfo ci, WorldServer world, double oldPosX, double oldPosY, double oldPosZ,
  81 + double deltaMoveSq, double deltaX, double deltaY, double deltaZ)
  82 + {
  83 + Proxy.onPlayerMoved(ci, (NetHandlerPlayServer)(Object)this, packetIn, world, oldPosX, oldPosY, oldPosZ, deltaMoveSq, deltaX, deltaY, deltaZ);
  84 + }
  85 +
  86 + @Surrogate
  87 + private void onPlayerMoved(C03PacketPlayer packetIn, CallbackInfo ci, WorldServer world, double oldPosX, double oldPosY, double oldPosZ)
  88 + {
  89 + Proxy.onPlayerMoved(ci, (NetHandlerPlayServer)(Object)this, packetIn, world, oldPosX, oldPosY, oldPosZ);
  90 + }
  91 +}
... ...
src/main/java/com/mumfrey/liteloader/common/mixin/MixinS02PacketChat.java 0 → 100644
  1 +package com.mumfrey.liteloader.common.mixin;
  2 +
  3 +import org.spongepowered.asm.mixin.Mixin;
  4 +import org.spongepowered.asm.mixin.Shadow;
  5 +
  6 +import com.mumfrey.liteloader.common.ducks.IChatPacket;
  7 +
  8 +import net.minecraft.network.play.server.S02PacketChat;
  9 +import net.minecraft.util.IChatComponent;
  10 +
  11 +@Mixin(S02PacketChat.class)
  12 +public abstract class MixinS02PacketChat implements IChatPacket
  13 +{
  14 + @Shadow private IChatComponent chatComponent;
  15 +
  16 + @Override
  17 + public IChatComponent getChatComponent()
  18 + {
  19 + return this.chatComponent;
  20 + }
  21 +
  22 + @Override
  23 + public void setChatComponent(IChatComponent chatComponent)
  24 + {
  25 + this.chatComponent = chatComponent;
  26 + }
  27 +}
... ...
src/main/java/com/mumfrey/liteloader/common/mixin/MixinServerConfigurationManager.java 0 → 100644
  1 +package com.mumfrey.liteloader.common.mixin;
  2 +
  3 +import org.spongepowered.asm.mixin.Mixin;
  4 +import org.spongepowered.asm.mixin.injection.At;
  5 +import org.spongepowered.asm.mixin.injection.Inject;
  6 +import org.spongepowered.asm.mixin.injection.Surrogate;
  7 +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
  8 +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
  9 +
  10 +import com.mojang.authlib.GameProfile;
  11 +import com.mumfrey.liteloader.core.Proxy;
  12 +
  13 +import net.minecraft.entity.player.EntityPlayerMP;
  14 +import net.minecraft.network.NetHandlerPlayServer;
  15 +import net.minecraft.network.NetworkManager;
  16 +import net.minecraft.server.management.ServerConfigurationManager;
  17 +
  18 +@Mixin(ServerConfigurationManager.class)
  19 +public abstract class MixinServerConfigurationManager
  20 +{
  21 + @Inject(
  22 + method = "initializeConnectionToPlayer(Lnet/minecraft/network/NetworkManager;Lnet/minecraft/entity/player/EntityPlayerMP;)V",
  23 + at = @At("RETURN")
  24 + )
  25 + private void onInitializePlayerConnection(NetworkManager netManager, EntityPlayerMP player, CallbackInfo ci)
  26 + {
  27 + Proxy.onInitializePlayerConnection((ServerConfigurationManager)(Object)this, netManager, player);
  28 + }
  29 +
  30 + // Because, forge
  31 + @Surrogate
  32 + private void onInitializePlayerConnection(NetworkManager netManager, EntityPlayerMP player, NetHandlerPlayServer nhps, CallbackInfo ci)
  33 + {
  34 + Proxy.onInitializePlayerConnection((ServerConfigurationManager)(Object)this, netManager, player);
  35 + }
  36 +
  37 + @Inject(method = "playerLoggedIn(Lnet/minecraft/entity/player/EntityPlayerMP;)V", at = @At("RETURN"))
  38 + private void onPlayerLogin(EntityPlayerMP player, CallbackInfo ci)
  39 + {
  40 + Proxy.onPlayerLogin((ServerConfigurationManager)(Object)this, player);
  41 + }
  42 +
  43 + @Inject(method = "playerLoggedOut(Lnet/minecraft/entity/player/EntityPlayerMP;)V", at = @At("RETURN"))
  44 + private void onPlayerLogout(EntityPlayerMP player, CallbackInfo ci)
  45 + {
  46 + Proxy.onPlayerLogout((ServerConfigurationManager)(Object)this, player);
  47 + }
  48 +
  49 + @Inject(
  50 + method = "createPlayerForUser(Lcom/mojang/authlib/GameProfile;)Lnet/minecraft/entity/player/EntityPlayerMP;",
  51 + cancellable = true,
  52 + at = @At("RETURN")
  53 + )
  54 + private void onSpawnPlayer(GameProfile profile, CallbackInfoReturnable<EntityPlayerMP> cir)
  55 + {
  56 + Proxy.onSpawnPlayer(cir, (ServerConfigurationManager)(Object)this, profile);
  57 + }
  58 +
  59 + @Inject(
  60 + method = "recreatePlayerEntity(Lnet/minecraft/entity/player/EntityPlayerMP;IZ)Lnet/minecraft/entity/player/EntityPlayerMP;",
  61 + cancellable = true,
  62 + at = @At("RETURN")
  63 + )
  64 + private void onRespawnPlayer(EntityPlayerMP player, int dimension, boolean conqueredEnd, CallbackInfoReturnable<EntityPlayerMP> cir)
  65 + {
  66 + Proxy.onRespawnPlayer(cir, (ServerConfigurationManager)(Object)this, player, dimension, conqueredEnd);
  67 + }
  68 +}
... ...
src/main/java/com/mumfrey/liteloader/common/transformers/LiteLoaderEventTransformer.java deleted 100644 → 0
1   -package com.mumfrey.liteloader.common.transformers;
2   -
3   -import static com.mumfrey.liteloader.core.runtime.Methods.*;
4   -import static com.mumfrey.liteloader.transformers.event.InjectionPoint.*;
5   -
6   -import org.objectweb.asm.Opcodes;
7   -
8   -import com.mumfrey.liteloader.core.runtime.Obf;
9   -import com.mumfrey.liteloader.transformers.event.Event;
10   -import com.mumfrey.liteloader.transformers.event.EventInjectionTransformer;
11   -import com.mumfrey.liteloader.transformers.event.InjectionPoint;
12   -import com.mumfrey.liteloader.transformers.event.MethodInfo;
13   -import com.mumfrey.liteloader.transformers.event.inject.BeforeFieldAccess;
14   -import com.mumfrey.liteloader.transformers.event.inject.BeforeInvoke;
15   -import com.mumfrey.liteloader.transformers.event.inject.BeforeNew;
16   -import com.mumfrey.liteloader.transformers.event.inject.BeforeReturn;
17   -import com.mumfrey.liteloader.transformers.event.inject.MethodHead;
18   -
19   -/**
20   - * Injector for LiteLoader's common events
21   - *
22   - * @author Adam Mummery-Smith
23   - */
24   -public abstract class LiteLoaderEventTransformer extends EventInjectionTransformer
25   -{
26   - protected abstract Obf getProxy();
27   -
28   - @Override
29   - protected void addEvents()
30   - {
31   - // Event declarations
32   - Event onInitializePlayerConnection = Event.getOrCreate("onInitializePlayerConnection", false);
33   - Event onPlayerLogin = Event.getOrCreate("onPlayerLogin", false);
34   - Event onPlayerLogout = Event.getOrCreate("onPlayerLogout", false);
35   - Event onSpawnPlayer = Event.getOrCreate("onSpawnPlayer", false);
36   - Event onRespawnPlayer = Event.getOrCreate("onRespawnPlayer", false);
37   - Event onServerTick = Event.getOrCreate("onServerTick", false);
38   - Event onBlockClickedEvent = Event.getOrCreate("onBlockClicked", true);
39   - Event onActivateBlockOrUseItem = Event.getOrCreate("onActivateBlockOrUseItem", true);
40   - Event onPlayerDigging = Event.getOrCreate("onPlayerDigging", true);
41   - Event onPlaceBlock = Event.getOrCreate("onPlaceBlock", true);
42   - Event onClickedAir = Event.getOrCreate("onClickedAir", true);
43   - Event onSessionProfileBad = Event.getOrCreate("onSessionProfileBad", true);
44   - Event onPlayerMoved = Event.getOrCreate("onPlayerMoved", true);
45   -
46   - // Injection Points
47   - InjectionPoint methodHead = new MethodHead();
48   - InjectionPoint methodReturn = new BeforeReturn();
49   - InjectionPoint beforeNewGameProfile = new BeforeNew(1, Obf.GameProfile);
50   - InjectionPoint beforeThreadMarshall = new BeforeInvoke(checkThreadAndEnqueue);
51   - InjectionPoint beforeGetPosY = new BeforeFieldAccess(Opcodes.GETFIELD, Obf.entityPosY, Obf.EntityPlayerMP, 4).setCaptureLocals(true);
52   -
53   - // Hooks
54   - this.add(onInitializePlayerConnection, initPlayerConnection, (methodReturn), "onInitializePlayerConnection");
55   - this.add(onPlayerLogin, playerLoggedIn, (methodReturn), "onPlayerLogin");
56   - this.add(onPlayerLogout, playerLoggedOut, (methodReturn), "onPlayerLogout");
57   - this.add(onSpawnPlayer, spawnPlayer, (methodReturn), "onSpawnPlayer");
58   - this.add(onRespawnPlayer, respawnPlayer, (methodReturn), "onRespawnPlayer");
59   - this.add(onServerTick, serverJobs, (methodHead), "onServerTick");
60   - this.add(onBlockClickedEvent, onBlockClicked, (methodHead), "onBlockClicked");
61   - this.add(onActivateBlockOrUseItem, activateBlockOrUseItem, (methodHead), "onUseItem");
62   - this.add(onPlaceBlock, processBlockPlacement, after(beforeThreadMarshall) , "onPlaceBlock");
63   - this.add(onClickedAir, handleAnimation, after(beforeThreadMarshall), "onClickedAir");
64   - this.add(onPlayerDigging, processPlayerDigging, after(beforeThreadMarshall), "onPlayerDigging");
65   - this.add(onPlayerMoved, processPlayer, (beforeGetPosY), "onPlayerMoved");
66   -
67   - // Compatibility handlers
68   - this.add(onSessionProfileBad, getProfile, (beforeNewGameProfile), "generateOfflineUUID");
69   - }
70   -
71   - protected final Event add(Event event, MethodInfo targetMethod, InjectionPoint injectionPoint, String callback)
72   - {
73   - return this.add(event, targetMethod, injectionPoint, callback, this.getProxy());
74   - }
75   -
76   - protected Event add(Event event, MethodInfo targetMethod, InjectionPoint injectionPoint, String callback, Obf proxy)
77   - {
78   - return this.addEvent(event, targetMethod, injectionPoint).addListener(new MethodInfo(proxy, callback));
79   - }
80   -}
src/main/java/com/mumfrey/liteloader/core/LiteLoader.java
... ... @@ -7,26 +7,10 @@ import java.util.List;
7 7  
8 8 import javax.activity.InvalidActivityException;
9 9  
10   -import net.minecraft.crash.CrashReport;
11   -import net.minecraft.crash.CrashReportCategory;
12   -import net.minecraft.launchwrapper.LaunchClassLoader;
13   -import net.minecraft.network.EnumConnectionState;
14   -import net.minecraft.network.INetHandler;
15   -import net.minecraft.network.play.server.S01PacketJoinGame;
16   -import net.minecraft.profiler.Profiler;
17   -import net.minecraft.world.World;
  10 +import org.spongepowered.asm.mixin.MixinEnvironment;
18 11  
19 12 import com.mumfrey.liteloader.LiteMod;
20   -import com.mumfrey.liteloader.api.CoreProvider;
21   -import com.mumfrey.liteloader.api.CustomisationProvider;
22   -import com.mumfrey.liteloader.api.Listener;
23   -import com.mumfrey.liteloader.api.LiteAPI;
24   -import com.mumfrey.liteloader.api.ModLoadObserver;
25   -import com.mumfrey.liteloader.api.PostRenderObserver;
26   -import com.mumfrey.liteloader.api.ShutdownObserver;
27   -import com.mumfrey.liteloader.api.TickObserver;
28   -import com.mumfrey.liteloader.api.TranslationProvider;
29   -import com.mumfrey.liteloader.api.WorldObserver;
  13 +import com.mumfrey.liteloader.api.*;
30 14 import com.mumfrey.liteloader.api.manager.APIAdapter;
31 15 import com.mumfrey.liteloader.api.manager.APIProvider;
32 16 import com.mumfrey.liteloader.common.GameEngine;
... ... @@ -37,12 +21,7 @@ import com.mumfrey.liteloader.core.event.HandlerList;
37 21 import com.mumfrey.liteloader.crashreport.CallableLaunchWrapper;
38 22 import com.mumfrey.liteloader.crashreport.CallableLiteLoaderBrand;
39 23 import com.mumfrey.liteloader.crashreport.CallableLiteLoaderMods;
40   -import com.mumfrey.liteloader.interfaces.FastIterableDeque;
41   -import com.mumfrey.liteloader.interfaces.Loadable;
42   -import com.mumfrey.liteloader.interfaces.LoadableMod;
43   -import com.mumfrey.liteloader.interfaces.LoaderEnumerator;
44   -import com.mumfrey.liteloader.interfaces.ObjectFactory;
45   -import com.mumfrey.liteloader.interfaces.PanelManager;
  24 +import com.mumfrey.liteloader.interfaces.*;
46 25 import com.mumfrey.liteloader.launch.LoaderEnvironment;
47 26 import com.mumfrey.liteloader.launch.LoaderEnvironment.EnvironmentType;
48 27 import com.mumfrey.liteloader.launch.LoaderProperties;
... ... @@ -56,6 +35,15 @@ import com.mumfrey.liteloader.util.Input;
56 35 import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
57 36 import com.mumfrey.liteloader.util.log.LiteLoaderLogger.Verbosity;
58 37  
  38 +import net.minecraft.crash.CrashReport;
  39 +import net.minecraft.crash.CrashReportCategory;
  40 +import net.minecraft.launchwrapper.LaunchClassLoader;
  41 +import net.minecraft.network.EnumConnectionState;
  42 +import net.minecraft.network.INetHandler;
  43 +import net.minecraft.network.play.server.S01PacketJoinGame;
  44 +import net.minecraft.profiler.Profiler;
  45 +import net.minecraft.world.World;
  46 +
59 47 /**
60 48 * LiteLoader is a simple loader which loads and provides useful callbacks to
61 49 * lightweight mods
... ... @@ -524,6 +512,7 @@ public final class LiteLoader
524 512 if (LiteLoaderLogger.DEBUG)
525 513 {
526 514 EventTransformer.dumpInjectionState();
  515 + MixinEnvironment.getCurrentEnvironment().audit();
527 516 LiteLoaderLogger.info("Debug info dumped to console");
528 517 }
529 518 else
... ... @@ -637,7 +626,6 @@ public final class LiteLoader
637 626 * @param modNameOrId
638 627 * @param metaDataKey
639 628 * @param defaultValue
640   - * @throws InvalidActivityException Thrown by getMod if init is not complete
641 629 * @throws IllegalArgumentException Thrown by getMod if argument is null
642 630 */
643 631 public String getModMetaData(String modNameOrId, String metaDataKey, String defaultValue) throws IllegalArgumentException
... ...
src/main/java/com/mumfrey/liteloader/core/LiteLoaderBootstrap.java
1 1 package com.mumfrey.liteloader.core;
2 2  
3   -import java.io.File;
4   -import java.io.FileInputStream;
5   -import java.io.FileNotFoundException;
6   -import java.io.FileWriter;
7   -import java.io.InputStream;
8   -import java.io.Serializable;
  3 +import java.io.*;
9 4 import java.lang.reflect.Field;
10 5 import java.lang.reflect.Method;
11 6 import java.util.List;
... ... @@ -15,10 +10,7 @@ import org.apache.logging.log4j.core.Layout;
15 10 import org.apache.logging.log4j.core.Logger;
16 11 import org.apache.logging.log4j.core.appender.FileAppender;
17 12 import org.apache.logging.log4j.core.layout.PatternLayout;
18   -
19   -import net.minecraft.launchwrapper.ITweaker;
20   -import net.minecraft.launchwrapper.Launch;
21   -import net.minecraft.launchwrapper.LaunchClassLoader;
  13 +import org.spongepowered.asm.mixin.MixinEnvironment;
22 14  
23 15 import com.mumfrey.liteloader.api.LiteAPI;
24 16 import com.mumfrey.liteloader.api.manager.APIAdapter;
... ... @@ -27,15 +19,15 @@ import com.mumfrey.liteloader.api.manager.APIRegistry;
27 19 import com.mumfrey.liteloader.common.LoadingProgress;
28 20 import com.mumfrey.liteloader.core.api.LiteLoaderCoreAPI;
29 21 import com.mumfrey.liteloader.interfaces.LoaderEnumerator;
30   -import com.mumfrey.liteloader.launch.ClassTransformerManager;
31   -import com.mumfrey.liteloader.launch.LiteLoaderTweaker;
32   -import com.mumfrey.liteloader.launch.LoaderBootstrap;
33   -import com.mumfrey.liteloader.launch.LoaderEnvironment;
34   -import com.mumfrey.liteloader.launch.LoaderProperties;
35   -import com.mumfrey.liteloader.launch.StartupEnvironment;
  22 +import com.mumfrey.liteloader.launch.*;
  23 +import com.mumfrey.liteloader.util.ObfuscationUtilities;
36 24 import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
37 25 import com.mumfrey.liteloader.util.log.LiteLoaderLogger.Verbosity;
38 26  
  27 +import net.minecraft.launchwrapper.ITweaker;
  28 +import net.minecraft.launchwrapper.Launch;
  29 +import net.minecraft.launchwrapper.LaunchClassLoader;
  30 +
39 31 /**
40 32 * LiteLoaderBootstrap is responsible for managing the early part of the
41 33 * LiteLoader startup process, this is to ensure that NONE of the Minecraft
... ... @@ -316,10 +308,18 @@ class LiteLoaderBootstrap implements LoaderBootstrap, LoaderEnvironment, LoaderP
316 308  
317 309 this.enumerator = this.spawnEnumerator(classLoader);
318 310 this.enumerator.onPreInit();
  311 +
  312 + this.initMixins();
319 313  
320 314 LiteLoaderLogger.info(Verbosity.REDUCED, "LiteLoader PREINIT complete");
321 315 }
322 316  
  317 + private void initMixins()
  318 + {
  319 + LiteLoaderLogger.info(Verbosity.REDUCED, "Initialising LiteLoader Mixins");
  320 + this.getAPIAdapter().initMixins();
  321 + }
  322 +
323 323 /**
324 324 * @param classLoader
325 325 */
... ... @@ -341,6 +341,12 @@ class LiteLoaderBootstrap implements LoaderBootstrap, LoaderEnvironment, LoaderP
341 341 }
342 342  
343 343 LoadingProgress.setEnabled(this.getAndStoreBooleanProperty(LoaderProperties.OPTION_LOADING_BAR, true));
  344 +
  345 + if (ObfuscationUtilities.fmlIsPresent())
  346 + {
  347 + LiteLoaderLogger.info("FML detected, switching to searge mappings");
  348 + MixinEnvironment.getDefaultEnvironment().setObfuscationContext("searge");
  349 + }
344 350 }
345 351  
346 352 /* (non-Javadoc)
... ... @@ -740,7 +746,7 @@ class LiteLoaderBootstrap implements LoaderBootstrap, LoaderEnvironment, LoaderP
740 746 @Override
741 747 public List<String> getRequiredTransformers()
742 748 {
743   - return this.apiAdapter.getRequiredTransformers();
  749 + return this.getAPIAdapter().getRequiredTransformers();
744 750 }
745 751  
746 752 /* (non-Javadoc)
... ... @@ -750,7 +756,7 @@ class LiteLoaderBootstrap implements LoaderBootstrap, LoaderEnvironment, LoaderP
750 756 @Override
751 757 public List<String> getRequiredDownstreamTransformers()
752 758 {
753   - List<String> requiredDownstreamTransformers = this.apiAdapter.getRequiredDownstreamTransformers();
  759 + List<String> requiredDownstreamTransformers = this.getAPIAdapter().getRequiredDownstreamTransformers();
754 760 requiredDownstreamTransformers.add(0, "com.mumfrey.liteloader.transformers.event.EventTransformer");
755 761 return requiredDownstreamTransformers;
756 762 }
... ...
src/main/java/com/mumfrey/liteloader/core/LiteLoaderEnumerator.java
... ... @@ -15,8 +15,8 @@ import java.util.List;
15 15 import java.util.Map;
16 16 import java.util.Set;
17 17  
18   -import net.minecraft.launchwrapper.Launch;
19   -import net.minecraft.launchwrapper.LaunchClassLoader;
  18 +import org.spongepowered.asm.mixin.MixinEnvironment;
  19 +import org.spongepowered.asm.mixin.MixinEnvironment.Phase;
20 20  
21 21 import com.google.common.base.Throwables;
22 22 import com.mumfrey.liteloader.LiteMod;
... ... @@ -35,6 +35,7 @@ import com.mumfrey.liteloader.interfaces.Injectable;
35 35 import com.mumfrey.liteloader.interfaces.Loadable;
36 36 import com.mumfrey.liteloader.interfaces.LoadableMod;
37 37 import com.mumfrey.liteloader.interfaces.LoaderEnumerator;
  38 +import com.mumfrey.liteloader.interfaces.MixinContainer;
38 39 import com.mumfrey.liteloader.interfaces.TweakContainer;
39 40 import com.mumfrey.liteloader.launch.ClassTransformerManager;
40 41 import com.mumfrey.liteloader.launch.LiteLoaderTweaker;
... ... @@ -43,6 +44,9 @@ import com.mumfrey.liteloader.launch.LoaderProperties;
43 44 import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
44 45 import com.mumfrey.liteloader.util.log.LiteLoaderLogger.Verbosity;
45 46  
  47 +import net.minecraft.launchwrapper.Launch;
  48 +import net.minecraft.launchwrapper.LaunchClassLoader;
  49 +
46 50 /**
47 51 * The enumerator performs all mod discovery functions for LiteLoader, this
48 52 * includes locating mod files to load as well as searching for mod classes
... ... @@ -571,7 +575,12 @@ public class LiteLoaderEnumerator implements LoaderEnumerator
571 575  
572 576 if (tweakContainer.hasClassTransformers())
573 577 {
574   - this.addClassTransformersFrom(tweakContainer, tweakContainer.getClassTransformerClassNames());
  578 + this.addClassTransformersFrom(tweakContainer);
  579 + }
  580 +
  581 + if (tweakContainer.hasMixins())
  582 + {
  583 + this.addMixinsFrom(tweakContainer);
575 584 }
576 585 }
577 586 }
... ... @@ -618,11 +627,11 @@ public class LiteLoaderEnumerator implements LoaderEnumerator
618 627 }
619 628 }
620 629  
621   - private void addClassTransformersFrom(TweakContainer<File> container, List<String> classTransformerClasses)
  630 + private void addClassTransformersFrom(TweakContainer<File> container)
622 631 {
623 632 try
624 633 {
625   - for (String classTransformerClass : classTransformerClasses)
  634 + for (String classTransformerClass : container.getClassTransformerClassNames())
626 635 {
627 636 LiteLoaderLogger.info(Verbosity.REDUCED, "Mod file '%s' provides classTransformer '%s', adding to class loader",
628 637 container.getName(), classTransformerClass);
... ... @@ -639,6 +648,30 @@ public class LiteLoaderEnumerator implements LoaderEnumerator
639 648 }
640 649 }
641 650  
  651 + private void addMixinsFrom(MixinContainer<File> container)
  652 + {
  653 + for (String config : container.getMixinConfigs())
  654 + {
  655 + if (config.endsWith(".json"))
  656 + {
  657 + LiteLoaderLogger.info(Verbosity.REDUCED, "Registering mixin config %s for %s", config, container.getName());
  658 + MixinEnvironment.getDefaultEnvironment().addConfiguration(config);
  659 + }
  660 + else if (config.contains(".json@"))
  661 + {
  662 + int pos = config.indexOf(".json@");
  663 + String phaseName = config.substring(pos + 6);
  664 + config = config.substring(0, pos + 5);
  665 + Phase phase = Phase.forName(phaseName);
  666 + if (phase != null)
  667 + {
  668 + LiteLoaderLogger.info(Verbosity.REDUCED, "Registering mixin config %s for %s", config, container.getName());
  669 + MixinEnvironment.getEnvironment(phase).addConfiguration(config);
  670 + }
  671 + }
  672 + }
  673 + }
  674 +
642 675 /**
643 676 * @param container
644 677 */
... ...
src/main/java/com/mumfrey/liteloader/core/LiteLoaderEventBroker.java
... ... @@ -5,6 +5,23 @@ import java.util.HashMap;
5 5 import java.util.Map;
6 6 import java.util.UUID;
7 7  
  8 +import com.mojang.authlib.GameProfile;
  9 +import com.mumfrey.liteloader.*;
  10 +import com.mumfrey.liteloader.PlayerInteractionListener.MouseButton;
  11 +import com.mumfrey.liteloader.api.InterfaceProvider;
  12 +import com.mumfrey.liteloader.api.Listener;
  13 +import com.mumfrey.liteloader.api.ShutdownObserver;
  14 +import com.mumfrey.liteloader.common.GameEngine;
  15 +import com.mumfrey.liteloader.common.LoadingProgress;
  16 +import com.mumfrey.liteloader.common.ducks.IPacketClientSettings;
  17 +import com.mumfrey.liteloader.core.event.HandlerList;
  18 +import com.mumfrey.liteloader.core.event.HandlerList.ReturnLogicOp;
  19 +import com.mumfrey.liteloader.interfaces.FastIterable;
  20 +import com.mumfrey.liteloader.interfaces.FastIterableDeque;
  21 +import com.mumfrey.liteloader.launch.LoaderProperties;
  22 +import com.mumfrey.liteloader.util.Position;
  23 +import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
  24 +
8 25 import net.minecraft.command.ICommandManager;
9 26 import net.minecraft.command.ServerCommandManager;
10 27 import net.minecraft.entity.player.EntityPlayerMP;
... ... @@ -25,31 +42,6 @@ import net.minecraft.world.World;
25 42 import net.minecraft.world.WorldServer;
26 43 import net.minecraft.world.WorldSettings;
27 44  
28   -import com.mojang.authlib.GameProfile;
29   -import com.mumfrey.liteloader.LiteMod;
30   -import com.mumfrey.liteloader.PlayerInteractionListener;
31   -import com.mumfrey.liteloader.PlayerInteractionListener.MouseButton;
32   -import com.mumfrey.liteloader.PlayerMoveListener;
33   -import com.mumfrey.liteloader.PluginChannelListener;
34   -import com.mumfrey.liteloader.ServerCommandProvider;
35   -import com.mumfrey.liteloader.ServerPlayerListener;
36   -import com.mumfrey.liteloader.ServerPluginChannelListener;
37   -import com.mumfrey.liteloader.ServerTickable;
38   -import com.mumfrey.liteloader.ShutdownListener;
39   -import com.mumfrey.liteloader.api.InterfaceProvider;
40   -import com.mumfrey.liteloader.api.Listener;
41   -import com.mumfrey.liteloader.api.ShutdownObserver;
42   -import com.mumfrey.liteloader.common.GameEngine;
43   -import com.mumfrey.liteloader.common.LoadingProgress;
44   -import com.mumfrey.liteloader.core.event.HandlerList;
45   -import com.mumfrey.liteloader.core.event.HandlerList.ReturnLogicOp;
46   -import com.mumfrey.liteloader.interfaces.FastIterable;
47   -import com.mumfrey.liteloader.interfaces.FastIterableDeque;
48   -import com.mumfrey.liteloader.launch.LoaderProperties;
49   -import com.mumfrey.liteloader.util.Position;
50   -import com.mumfrey.liteloader.util.PrivateFields;
51   -import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
52   -
53 45 /**
54 46 * @author Adam Mummery-Smith
55 47 *
... ... @@ -513,7 +505,7 @@ public abstract class LiteLoaderEventBroker&lt;TClient, TServer extends MinecraftSe
513 505 void onPlayerSettingsReceived(EntityPlayerMP player, C15PacketClientSettings packet)
514 506 {
515 507 PlayerEventState playerState = this.getPlayerState(player);
516   - playerState.setTraceDistance(PrivateFields.viewDistance.get(packet));
  508 + playerState.setTraceDistance(((IPacketClientSettings)packet).getViewDistance());
517 509 playerState.setLocale(packet.getLang());
518 510 }
519 511  
... ...
src/main/java/com/mumfrey/liteloader/core/ModInfo.java
... ... @@ -9,6 +9,7 @@ import com.google.common.collect.ImmutableSet;
9 9 import com.mumfrey.liteloader.LiteMod;
10 10 import com.mumfrey.liteloader.interfaces.Loadable;
11 11 import com.mumfrey.liteloader.interfaces.LoadableMod;
  12 +import com.mumfrey.liteloader.interfaces.MixinContainer;
12 13 import com.mumfrey.liteloader.interfaces.TweakContainer;
13 14  
14 15 /**
... ... @@ -179,6 +180,14 @@ public abstract class ModInfo&lt;TContainer extends Loadable&lt;?&gt;&gt;
179 180 {
180 181 return (this.container instanceof TweakContainer && ((TweakContainer<?>)this.container).hasEventTransformers());
181 182 }
  183 +
  184 + /**
  185 + * If this has mixins
  186 + */
  187 + public boolean hasMixins()
  188 + {
  189 + return (this.container instanceof MixinContainer && ((MixinContainer<?>)this.container).hasMixins());
  190 + }
182 191  
183 192 /**
184 193 * Get whether this mod uses external (3rd-party) API
... ...
src/main/java/com/mumfrey/liteloader/core/CallbackProxyCommon.java renamed to src/main/java/com/mumfrey/liteloader/core/Proxy.java
1 1 package com.mumfrey.liteloader.core;
2 2  
  3 +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
  4 +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
  5 +
  6 +import com.mojang.authlib.GameProfile;
  7 +
3 8 import net.minecraft.entity.player.EntityPlayer;
4 9 import net.minecraft.entity.player.EntityPlayerMP;
5 10 import net.minecraft.item.ItemStack;
... ... @@ -17,89 +22,83 @@ import net.minecraft.util.EnumFacing;
17 22 import net.minecraft.world.World;
18 23 import net.minecraft.world.WorldServer;
19 24  
20   -import com.mojang.authlib.GameProfile;
21   -import com.mumfrey.liteloader.transformers.event.EventInfo;
22   -import com.mumfrey.liteloader.transformers.event.ReturnEventInfo;
23   -
24   -public abstract class CallbackProxyCommon
  25 +public abstract class Proxy
25 26 {
26   - private static LiteLoaderEventBroker<?, ?> eventBroker;
  27 + private static LiteLoaderEventBroker<?, ?> broker;
27 28  
28   - protected CallbackProxyCommon() {}
  29 + protected Proxy() {}
29 30  
30 31 protected static void onStartupComplete()
31 32 {
32   - CallbackProxyCommon.eventBroker = LiteLoaderEventBroker.broker;
  33 + Proxy.broker = LiteLoaderEventBroker.broker;
33 34  
34   - if (CallbackProxyCommon.eventBroker == null)
  35 + if (Proxy.broker == null)
35 36 {
36 37 throw new RuntimeException("LiteLoader failed to start up properly."
37 38 + " The game is in an unstable state and must shut down now. Check the developer log for startup errors");
38 39 }
39 40 }
40 41  
41   - public static void onInitializePlayerConnection(EventInfo<ServerConfigurationManager> e, NetworkManager netManager, EntityPlayerMP player)
  42 + public static void onInitializePlayerConnection(ServerConfigurationManager source, NetworkManager netManager, EntityPlayerMP player)
42 43 {
43   - CallbackProxyCommon.eventBroker.onInitializePlayerConnection(e.getSource(), netManager, player);
  44 + Proxy.broker.onInitializePlayerConnection(source, netManager, player);
44 45 }
45 46  
46   - public static void onPlayerLogin(EventInfo<ServerConfigurationManager> e, EntityPlayerMP player)
  47 + public static void onPlayerLogin(ServerConfigurationManager source, EntityPlayerMP player)
47 48 {
48   - CallbackProxyCommon.eventBroker.onPlayerLogin(e.getSource(), player);
  49 + Proxy.broker.onPlayerLogin(source, player);
49 50 }
50 51  
51   - public static void onPlayerLogout(EventInfo<ServerConfigurationManager> e, EntityPlayerMP player)
  52 + public static void onPlayerLogout(ServerConfigurationManager source, EntityPlayerMP player)
52 53 {
53   - CallbackProxyCommon.eventBroker.onPlayerLogout(e.getSource(), player);
  54 + Proxy.broker.onPlayerLogout(source, player);
54 55 }
55 56  
56   - public static void onSpawnPlayer(ReturnEventInfo<ServerConfigurationManager, EntityPlayerMP> e, GameProfile profile)
  57 + public static void onSpawnPlayer(CallbackInfoReturnable<EntityPlayerMP> cir, ServerConfigurationManager source, GameProfile profile)
57 58 {
58   - CallbackProxyCommon.eventBroker.onSpawnPlayer(e.getSource(), e.getReturnValue(), profile);
  59 + Proxy.broker.onSpawnPlayer(source, cir.getReturnValue(), profile);
59 60 }
60 61  
61   - public static void onRespawnPlayer(ReturnEventInfo<ServerConfigurationManager, EntityPlayerMP> e, EntityPlayerMP oldPlayer, int dimension,
62   - boolean won)
  62 + public static void onRespawnPlayer(CallbackInfoReturnable<EntityPlayerMP> cir, ServerConfigurationManager source, EntityPlayerMP oldPlayer,
  63 + int dimension, boolean won)
63 64 {
64   - CallbackProxyCommon.eventBroker.onRespawnPlayer(e.getSource(), e.getReturnValue(), oldPlayer, dimension, won);
  65 + Proxy.broker.onRespawnPlayer(source, cir.getReturnValue(), oldPlayer, dimension, won);
65 66 }
66 67  
67   - public static void onServerTick(EventInfo<MinecraftServer> e)
  68 + public static void onServerTick(MinecraftServer mcServer)
68 69 {
69   - CallbackProxyCommon.eventBroker.onServerTick(e.getSource());
  70 + Proxy.broker.onServerTick(mcServer);
70 71 }
71 72  
72   - public static void onPlaceBlock(EventInfo<NetHandlerPlayServer> e, C08PacketPlayerBlockPlacement packet)
  73 + public static void onPlaceBlock(CallbackInfo ci, NetHandlerPlayServer netHandler, C08PacketPlayerBlockPlacement packet)
73 74 {
74   - NetHandlerPlayServer netHandler = e.getSource();
75   - if (!CallbackProxyCommon.eventBroker.onPlaceBlock(netHandler, netHandler.playerEntity, packet.getPosition(),
  75 + if (!Proxy.broker.onPlaceBlock(netHandler, netHandler.playerEntity, packet.getPosition(),
76 76 EnumFacing.getFront(packet.getPlacedBlockDirection())))
77 77 {
78   - e.cancel();
  78 + ci.cancel();
79 79 }
80 80 }
81 81  
82   - public static void onClickedAir(EventInfo<NetHandlerPlayServer> e, C0APacketAnimation packet)
  82 + public static void onClickedAir(CallbackInfo ci, NetHandlerPlayServer netHandler, C0APacketAnimation packet)
83 83 {
84   - if (!CallbackProxyCommon.eventBroker.onClickedAir(e.getSource()))
  84 + if (!Proxy.broker.onClickedAir(netHandler))
85 85 {
86   - e.cancel();
  86 + ci.cancel();
87 87 }
88 88 }
89 89  
90   - public static void onPlayerDigging(EventInfo<NetHandlerPlayServer> e, C07PacketPlayerDigging packet)
  90 + public static void onPlayerDigging(CallbackInfo ci, NetHandlerPlayServer netHandler, C07PacketPlayerDigging packet)
91 91 {
92 92 if (packet.getStatus() == C07PacketPlayerDigging.Action.START_DESTROY_BLOCK)
93 93 {
94   - NetHandlerPlayServer netHandler = e.getSource();
95   - if (!CallbackProxyCommon.eventBroker.onPlayerDigging(netHandler, packet.getPosition(), netHandler.playerEntity))
  94 + if (!Proxy.broker.onPlayerDigging(netHandler, packet.getPosition(), netHandler.playerEntity))
96 95 {
97   - e.cancel();
  96 + ci.cancel();
98 97 }
99 98 }
100 99 }
101 100  
102   - public static void onUseItem(ReturnEventInfo<ItemInWorldManager, Boolean> e, EntityPlayer player, World world, ItemStack itemStack, BlockPos pos,
  101 + public static void onUseItem(CallbackInfoReturnable<Boolean> ci, EntityPlayer player, World world, ItemStack itemStack, BlockPos pos,
103 102 EnumFacing side, float par8, float par9, float par10)
104 103 {
105 104 if (!(player instanceof EntityPlayerMP))
... ... @@ -107,39 +106,35 @@ public abstract class CallbackProxyCommon
107 106 return;
108 107 }
109 108  
110   - if (!CallbackProxyCommon.eventBroker.onUseItem(pos, side, (EntityPlayerMP)player))
  109 + if (!Proxy.broker.onUseItem(pos, side, (EntityPlayerMP)player))
111 110 {
112   - e.setReturnValue(false);
  111 + ci.setReturnValue(false);
113 112 }
114 113 }
115 114  
116   - public static void onBlockClicked(EventInfo<ItemInWorldManager> e, BlockPos pos, EnumFacing side)
  115 + public static void onBlockClicked(CallbackInfo ci, ItemInWorldManager manager, BlockPos pos, EnumFacing side)
117 116 {
118   - ItemInWorldManager manager = e.getSource();
119   -
120   - if (!CallbackProxyCommon.eventBroker.onBlockClicked(pos, side, manager))
  117 + if (!Proxy.broker.onBlockClicked(pos, side, manager))
121 118 {
122   - e.cancel();
  119 + ci.cancel();
123 120 }
124 121 }
125 122  
126   - public static void onPlayerMoved(EventInfo<NetHandlerPlayServer> e, C03PacketPlayer packet, WorldServer world, double oldPosX, double oldPosY,
127   - double oldPosZ)
  123 + public static void onPlayerMoved(CallbackInfo ci, NetHandlerPlayServer netHandler, C03PacketPlayer packet, WorldServer world, double oldPosX,
  124 + double oldPosY, double oldPosZ)
128 125 {
129   - NetHandlerPlayServer netHandler = e.getSource();
130   - if (!CallbackProxyCommon.eventBroker.onPlayerMove(netHandler, packet, netHandler.playerEntity, world))
  126 + if (!Proxy.broker.onPlayerMove(netHandler, packet, netHandler.playerEntity, world))
131 127 {
132   - e.cancel();
  128 + ci.cancel();
133 129 }
134 130 }
135 131  
136   - public static void onPlayerMoved(EventInfo<NetHandlerPlayServer> e, C03PacketPlayer packet, WorldServer world, double oldPosX, double oldPosY,
137   - double oldPosZ, double deltaMoveSq, double deltaX, double deltaY, double deltaZ)
  132 + public static void onPlayerMoved(CallbackInfo ci, NetHandlerPlayServer netHandler, C03PacketPlayer packet, WorldServer world, double oldPosX,
  133 + double oldPosY, double oldPosZ, double deltaMoveSq, double deltaX, double deltaY, double deltaZ)
138 134 {
139   - NetHandlerPlayServer netHandler = e.getSource();
140   - if (!CallbackProxyCommon.eventBroker.onPlayerMove(netHandler, packet, netHandler.playerEntity, world))
  135 + if (!Proxy.broker.onPlayerMove(netHandler, packet, netHandler.playerEntity, world))
141 136 {
142   - e.cancel();
  137 + ci.cancel();
143 138 }
144 139 }
145 140 }
... ...
src/main/java/com/mumfrey/liteloader/core/api/EnumeratorModuleClassPath.java
... ... @@ -92,7 +92,7 @@ public class EnumeratorModuleClassPath implements EnumeratorModule
92 92 if (enumerator.registerModContainer(classPathMod))
93 93 {
94 94 this.loadableMods.add(classPathMod);
95   - if (classPathMod.hasTweakClass() || classPathMod.hasClassTransformers())
  95 + if (classPathMod.requiresPreInitInjection())
96 96 {
97 97 enumerator.registerTweakContainer(classPathMod);
98 98 }
... ...
src/main/java/com/mumfrey/liteloader/core/api/LiteLoaderCoreAPI.java
... ... @@ -5,8 +5,11 @@ import java.util.ArrayList;
5 5 import java.util.Collections;
6 6 import java.util.List;
7 7  
  8 +import org.spongepowered.asm.mixin.MixinEnvironment.CompatibilityLevel;
  9 +
8 10 import com.mumfrey.liteloader.api.EnumeratorModule;
9 11 import com.mumfrey.liteloader.api.LiteAPI;
  12 +import com.mumfrey.liteloader.api.MixinConfigProvider;
10 13 import com.mumfrey.liteloader.core.LiteLoaderVersion;
11 14 import com.mumfrey.liteloader.interfaces.ObjectFactory;
12 15 import com.mumfrey.liteloader.launch.LoaderEnvironment;
... ... @@ -18,7 +21,7 @@ import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
18 21 *
19 22 * @author Adam Mummery-Smith
20 23 */
21   -public abstract class LiteLoaderCoreAPI implements LiteAPI
  24 +public abstract class LiteLoaderCoreAPI implements LiteAPI, MixinConfigProvider
22 25 {
23 26 protected static final String PKG_LITELOADER = "com.mumfrey.liteloader";
24 27 protected static final String PKG_LITELOADER_COMMON = LiteLoaderCoreAPI.PKG_LITELOADER + ".common";
... ... @@ -144,4 +147,30 @@ public abstract class LiteLoaderCoreAPI implements LiteAPI
144 147 * Get the ObjectFactory
145 148 */
146 149 public abstract ObjectFactory<?, ?> getObjectFactory();
  150 +
  151 + @Override
  152 + public MixinConfigProvider getMixins()
  153 + {
  154 + return this;
  155 + }
  156 +
  157 + @Override
  158 + public CompatibilityLevel getCompatibilityLevel()
  159 + {
  160 + return null;
  161 + }
  162 +
  163 + @Override
  164 + public String[] getMixinConfigs()
  165 + {
  166 + return new String[] {
  167 + "mixins.liteloader.core.json"
  168 + };
  169 + }
  170 +
  171 + @Override
  172 + public String[] getErrorHandlers()
  173 + {
  174 + return null;
  175 + }
147 176 }
... ...
src/main/java/com/mumfrey/liteloader/core/api/LoadableModFile.java
... ... @@ -187,6 +187,7 @@ public class LoadableModFile extends LoadableFile implements LoadableMod&lt;File&gt;
187 187 this.getMetaValuesInto(this.classTransformerClassNames, "classTransformerClasses", ",");
188 188 this.getMetaValuesInto(this.dependencies, "dependsOn", ",");
189 189 this.getMetaValuesInto(this.requiredAPIs, "requiredAPIs", ",");
  190 + this.getMetaValuesInto(this.mixinConfigs, "mixinConfigs", ",");
190 191 }
191 192 catch (ClassCastException ex)
192 193 {
... ...
src/main/java/com/mumfrey/liteloader/core/runtime/Methods.java
... ... @@ -16,54 +16,54 @@ public abstract class Methods
16 16 // CHECKSTYLE:OFF
17 17  
18 18 // Client & General
19   - public static final MethodInfo startGame = new MethodInfo(Obf.Minecraft, Obf.startGame, Void.TYPE);
20   - public static final MethodInfo runGameLoop = new MethodInfo(Obf.Minecraft, Obf.runGameLoop, Void.TYPE);
21   - public static final MethodInfo runTick = new MethodInfo(Obf.Minecraft, Obf.runTick, Void.TYPE);
22   - public static final MethodInfo updateFramebufferSize = new MethodInfo(Obf.Minecraft, Obf.updateFramebufferSize, Void.TYPE);
23   - public static final MethodInfo framebufferRender = new MethodInfo(Obf.FrameBuffer, Obf.framebufferRender, Void.TYPE, Integer.TYPE, Integer.TYPE);
24   - public static final MethodInfo framebufferRenderExt = new MethodInfo(Obf.FrameBuffer, Obf.framebufferRenderExt, Void.TYPE, Integer.TYPE, Integer.TYPE, Boolean.TYPE);
25   - public static final MethodInfo bindFramebufferTexture = new MethodInfo(Obf.FrameBuffer, Obf.bindFramebufferTexture, Void.TYPE);
26   - public static final MethodInfo sendChatMessage = new MethodInfo(Obf.EntityPlayerSP, Obf.sendChatMessage, Void.TYPE, String.class);
27   - public static final MethodInfo renderWorld = new MethodInfo(Obf.EntityRenderer, Obf.renderWorld, Void.TYPE, Float.TYPE, Long.TYPE);
28   - public static final MethodInfo renderWorldPass = new MethodInfo(Obf.EntityRenderer, Obf.renderWorldPass, Void.TYPE, Integer.TYPE, Float.TYPE, Long.TYPE);
29   - public static final MethodInfo updateCameraAndRender = new MethodInfo(Obf.EntityRenderer, Obf.updateCameraAndRender, Void.TYPE, Float.TYPE);
30   - public static final MethodInfo renderGameOverlay = new MethodInfo(Obf.GuiIngame, Obf.renderGameOverlay, Void.TYPE, Float.TYPE);
31   - public static final MethodInfo drawChat = new MethodInfo(Obf.GuiNewChat, Obf.drawChat, Void.TYPE, Integer.TYPE);
32   - public static final MethodInfo integratedServerCtor = new MethodInfo(Obf.IntegratedServer, Obf.constructor, Void.TYPE, Obf.Minecraft, String.class, String.class, Obf.WorldSettings);
33   - public static final MethodInfo initPlayerConnection = new MethodInfo(Obf.ServerConfigurationManager, Obf.initializeConnectionToPlayer, Void.TYPE, Obf.NetworkManager, Obf.EntityPlayerMP);
34   - public static final MethodInfo playerLoggedIn = new MethodInfo(Obf.ServerConfigurationManager, Obf.playerLoggedIn, Void.TYPE, Obf.EntityPlayerMP);
35   - public static final MethodInfo playerLoggedOut = new MethodInfo(Obf.ServerConfigurationManager, Obf.playerLoggedOut, Void.TYPE, Obf.EntityPlayerMP);
36   - public static final MethodInfo spawnPlayer = new MethodInfo(Obf.ServerConfigurationManager, Obf.spawnPlayer, Obf.EntityPlayerMP, Obf.GameProfile);
37   - public static final MethodInfo respawnPlayer = new MethodInfo(Obf.ServerConfigurationManager, Obf.respawnPlayer, Obf.EntityPlayerMP, Obf.EntityPlayerMP, Integer.TYPE, Boolean.TYPE);
38   - public static final MethodInfo glClear = new MethodInfo(Obf.GlStateManager, Obf.clear, Void.TYPE, Integer.TYPE);
39   - public static final MethodInfo getProfile = new MethodInfo(Obf.Session, Obf.getProfile, Obf.GameProfile);
40   - public static final MethodInfo saveScreenshot = new MethodInfo(Obf.ScreenShotHelper, Obf.saveScreenshot, Obf.IChatComponent, File.class, String.class, Integer.TYPE, Integer.TYPE, Obf.FrameBuffer);
41   - public static final MethodInfo isFramebufferEnabled = new MethodInfo(Obf.OpenGlHelper, Obf.isFramebufferEnabled, Boolean.TYPE);
42   - public static final MethodInfo doRenderEntity = new MethodInfo(Obf.RenderManager, Obf.doRenderEntity, Boolean.TYPE, Obf.Entity, Double.TYPE, Double.TYPE, Double.TYPE, Float.TYPE, Float.TYPE, Boolean.TYPE);
43   - public static final MethodInfo doRender = new MethodInfo(Obf.Render, Obf.doRender, Void.TYPE, Obf.Entity, Double.TYPE, Double.TYPE, Double.TYPE, Float.TYPE, Float.TYPE);
44   - public static final MethodInfo doRenderShadowAndFire = new MethodInfo(Obf.Render, Obf.doRenderShadowAndFire, Void.TYPE, Obf.Entity, Double.TYPE, Double.TYPE, Double.TYPE, Float.TYPE, Float.TYPE);
45   - public static final MethodInfo realmsPlay = new MethodInfo(Obf.RealmsMainScreen, "play", Void.TYPE, Long.TYPE);
46   - public static final MethodInfo realmsStopFetcher = new MethodInfo(Obf.RealmsMainScreen, "stopRealmsFetcherAndPinger", Void.TYPE);
47   - public static final MethodInfo onBlockClicked = new MethodInfo(Obf.ItemInWorldManager, Obf.onBlockClicked, Void.TYPE, Obf.BlockPos, Obf.EnumFacing);
48   - public static final MethodInfo activateBlockOrUseItem = new MethodInfo(Obf.ItemInWorldManager, Obf.activateBlockOrUseItem, Boolean.TYPE, Obf.EntityPlayer, Obf.World, Obf.ItemStack, Obf.BlockPos, Obf.EnumFacing, Float.TYPE, Float.TYPE, Float.TYPE);
49   - public static final MethodInfo processBlockPlacement = new MethodInfo(Obf.NetHandlerPlayServer, Obf.processPlayerBlockPlacement, Void.TYPE, Packets.C08PacketPlayerBlockPlacement);
50   - public static final MethodInfo handleAnimation = new MethodInfo(Obf.NetHandlerPlayServer, Obf.handleAnimation, Void.TYPE, Packets.C0APacketAnimation);
51   - public static final MethodInfo processPlayerDigging = new MethodInfo(Obf.NetHandlerPlayServer, Obf.processPlayerDigging, Void.TYPE, Packets.C07PacketPlayerDigging);
52   - public static final MethodInfo serverJobs = new MethodInfo(Obf.MinecraftServer, Obf.updateTimeLightAndEntities, Void.TYPE);
53   - public static final MethodInfo checkThreadAndEnqueue = new MethodInfo(Obf.PacketThreadUtil, Obf.checkThreadAndEnqueue);
54   - public static final MethodInfo processPlayer = new MethodInfo(Obf.NetHandlerPlayServer, Obf.processPlayer, Void.TYPE, Packets.C03PacketPlayer);
55   - public static final MethodInfo renderSky = new MethodInfo(Obf.RenderGlobal, Obf.renderSky, Void.TYPE, Float.TYPE, Integer.TYPE);
56   - public static final MethodInfo renderCloudsCheck = new MethodInfo(Obf.EntityRenderer, Obf.renderCloudsCheck, Void.TYPE, Obf.RenderGlobal, Float.TYPE, Integer.TYPE);
57   - public static final MethodInfo setupFog = new MethodInfo(Obf.EntityRenderer, Obf.setupFog, Void.TYPE, Integer.TYPE, Float.TYPE);
  19 + @Deprecated public static final MethodInfo startGame = new MethodInfo(Obf.Minecraft, Obf.startGame, Void.TYPE);
  20 + @Deprecated public static final MethodInfo runGameLoop = new MethodInfo(Obf.Minecraft, Obf.runGameLoop, Void.TYPE);
  21 + @Deprecated public static final MethodInfo runTick = new MethodInfo(Obf.Minecraft, Obf.runTick, Void.TYPE);
  22 + @Deprecated public static final MethodInfo updateFramebufferSize = new MethodInfo(Obf.Minecraft, Obf.updateFramebufferSize, Void.TYPE);
  23 + @Deprecated public static final MethodInfo framebufferRender = new MethodInfo(Obf.FrameBuffer, Obf.framebufferRender, Void.TYPE, Integer.TYPE, Integer.TYPE);
  24 + @Deprecated public static final MethodInfo framebufferRenderExt = new MethodInfo(Obf.FrameBuffer, Obf.framebufferRenderExt, Void.TYPE, Integer.TYPE, Integer.TYPE, Boolean.TYPE);
  25 + @Deprecated public static final MethodInfo bindFramebufferTexture = new MethodInfo(Obf.FrameBuffer, Obf.bindFramebufferTexture, Void.TYPE);
  26 + @Deprecated public static final MethodInfo sendChatMessage = new MethodInfo(Obf.EntityPlayerSP, Obf.sendChatMessage, Void.TYPE, String.class);
  27 + @Deprecated public static final MethodInfo renderWorld = new MethodInfo(Obf.EntityRenderer, Obf.renderWorld, Void.TYPE, Float.TYPE, Long.TYPE);
  28 + @Deprecated public static final MethodInfo renderWorldPass = new MethodInfo(Obf.EntityRenderer, Obf.renderWorldPass, Void.TYPE, Integer.TYPE, Float.TYPE, Long.TYPE);
  29 + @Deprecated public static final MethodInfo updateCameraAndRender = new MethodInfo(Obf.EntityRenderer, Obf.updateCameraAndRender, Void.TYPE, Float.TYPE);
  30 + @Deprecated public static final MethodInfo renderGameOverlay = new MethodInfo(Obf.GuiIngame, Obf.renderGameOverlay, Void.TYPE, Float.TYPE);
  31 + @Deprecated public static final MethodInfo drawChat = new MethodInfo(Obf.GuiNewChat, Obf.drawChat, Void.TYPE, Integer.TYPE);
  32 + @Deprecated public static final MethodInfo integratedServerCtor = new MethodInfo(Obf.IntegratedServer, Obf.constructor, Void.TYPE, Obf.Minecraft, String.class, String.class, Obf.WorldSettings);
  33 + @Deprecated public static final MethodInfo initPlayerConnection = new MethodInfo(Obf.ServerConfigurationManager, Obf.initializeConnectionToPlayer, Void.TYPE, Obf.NetworkManager, Obf.EntityPlayerMP);
  34 + @Deprecated public static final MethodInfo playerLoggedIn = new MethodInfo(Obf.ServerConfigurationManager, Obf.playerLoggedIn, Void.TYPE, Obf.EntityPlayerMP);
  35 + @Deprecated public static final MethodInfo playerLoggedOut = new MethodInfo(Obf.ServerConfigurationManager, Obf.playerLoggedOut, Void.TYPE, Obf.EntityPlayerMP);
  36 + @Deprecated public static final MethodInfo spawnPlayer = new MethodInfo(Obf.ServerConfigurationManager, Obf.spawnPlayer, Obf.EntityPlayerMP, Obf.GameProfile);
  37 + @Deprecated public static final MethodInfo respawnPlayer = new MethodInfo(Obf.ServerConfigurationManager, Obf.respawnPlayer, Obf.EntityPlayerMP, Obf.EntityPlayerMP, Integer.TYPE, Boolean.TYPE);
  38 + @Deprecated public static final MethodInfo glClear = new MethodInfo(Obf.GlStateManager, Obf.clear, Void.TYPE, Integer.TYPE);
  39 + @Deprecated public static final MethodInfo getProfile = new MethodInfo(Obf.Session, Obf.getProfile, Obf.GameProfile);
  40 + @Deprecated public static final MethodInfo saveScreenshot = new MethodInfo(Obf.ScreenShotHelper, Obf.saveScreenshot, Obf.IChatComponent, File.class, String.class, Integer.TYPE, Integer.TYPE, Obf.FrameBuffer);
  41 + @Deprecated public static final MethodInfo isFramebufferEnabled = new MethodInfo(Obf.OpenGlHelper, Obf.isFramebufferEnabled, Boolean.TYPE);
  42 + @Deprecated public static final MethodInfo doRenderEntity = new MethodInfo(Obf.RenderManager, Obf.doRenderEntity, Boolean.TYPE, Obf.Entity, Double.TYPE, Double.TYPE, Double.TYPE, Float.TYPE, Float.TYPE, Boolean.TYPE);
  43 + @Deprecated public static final MethodInfo doRender = new MethodInfo(Obf.Render, Obf.doRender, Void.TYPE, Obf.Entity, Double.TYPE, Double.TYPE, Double.TYPE, Float.TYPE, Float.TYPE);
  44 + @Deprecated public static final MethodInfo doRenderShadowAndFire = new MethodInfo(Obf.Render, Obf.doRenderShadowAndFire, Void.TYPE, Obf.Entity, Double.TYPE, Double.TYPE, Double.TYPE, Float.TYPE, Float.TYPE);
  45 + @Deprecated public static final MethodInfo realmsPlay = new MethodInfo(Obf.RealmsMainScreen, "play", Void.TYPE, Long.TYPE);
  46 + @Deprecated public static final MethodInfo realmsStopFetcher = new MethodInfo(Obf.RealmsMainScreen, "stopRealmsFetcherAndPinger", Void.TYPE);
  47 + @Deprecated public static final MethodInfo onBlockClicked = new MethodInfo(Obf.ItemInWorldManager, Obf.onBlockClicked, Void.TYPE, Obf.BlockPos, Obf.EnumFacing);
  48 + @Deprecated public static final MethodInfo activateBlockOrUseItem = new MethodInfo(Obf.ItemInWorldManager, Obf.activateBlockOrUseItem, Boolean.TYPE, Obf.EntityPlayer, Obf.World, Obf.ItemStack, Obf.BlockPos, Obf.EnumFacing, Float.TYPE, Float.TYPE, Float.TYPE);
  49 + @Deprecated public static final MethodInfo processBlockPlacement = new MethodInfo(Obf.NetHandlerPlayServer, Obf.processPlayerBlockPlacement, Void.TYPE, Packets.C08PacketPlayerBlockPlacement);
  50 + @Deprecated public static final MethodInfo handleAnimation = new MethodInfo(Obf.NetHandlerPlayServer, Obf.handleAnimation, Void.TYPE, Packets.C0APacketAnimation);
  51 + @Deprecated public static final MethodInfo processPlayerDigging = new MethodInfo(Obf.NetHandlerPlayServer, Obf.processPlayerDigging, Void.TYPE, Packets.C07PacketPlayerDigging);
  52 + @Deprecated public static final MethodInfo serverJobs = new MethodInfo(Obf.MinecraftServer, Obf.updateTimeLightAndEntities, Void.TYPE);
  53 + @Deprecated public static final MethodInfo checkThreadAndEnqueue = new MethodInfo(Obf.PacketThreadUtil, Obf.checkThreadAndEnqueue);
  54 + @Deprecated public static final MethodInfo processPlayer = new MethodInfo(Obf.NetHandlerPlayServer, Obf.processPlayer, Void.TYPE, Packets.C03PacketPlayer);
  55 + @Deprecated public static final MethodInfo renderSky = new MethodInfo(Obf.RenderGlobal, Obf.renderSky, Void.TYPE, Float.TYPE, Integer.TYPE);
  56 + @Deprecated public static final MethodInfo renderCloudsCheck = new MethodInfo(Obf.EntityRenderer, Obf.renderCloudsCheck, Void.TYPE, Obf.RenderGlobal, Float.TYPE, Integer.TYPE);
  57 + @Deprecated public static final MethodInfo setupFog = new MethodInfo(Obf.EntityRenderer, Obf.setupFog, Void.TYPE, Integer.TYPE, Float.TYPE);
58 58  
59 59 // Profiler
60   - public static final MethodInfo startSection = new MethodInfo(Obf.Profiler, Obf.startSection, Void.TYPE, String.class);
61   - public static final MethodInfo endSection = new MethodInfo(Obf.Profiler, Obf.endSection, Void.TYPE);
62   - public static final MethodInfo endStartSection = new MethodInfo(Obf.Profiler, Obf.endStartSection, Void.TYPE, String.class);
  60 + @Deprecated public static final MethodInfo startSection = new MethodInfo(Obf.Profiler, Obf.startSection, Void.TYPE, String.class);
  61 + @Deprecated public static final MethodInfo endSection = new MethodInfo(Obf.Profiler, Obf.endSection, Void.TYPE);
  62 + @Deprecated public static final MethodInfo endStartSection = new MethodInfo(Obf.Profiler, Obf.endStartSection, Void.TYPE, String.class);
63 63  
64 64 // Dedicated Server
65   - public static final MethodInfo startServer = new MethodInfo(Obf.DedicatedServer, Obf.startServer, Boolean.TYPE);
66   - public static final MethodInfo startServerThread = new MethodInfo(Obf.MinecraftServer, Obf.startServerThread, Void.TYPE);
  65 + @Deprecated public static final MethodInfo startServer = new MethodInfo(Obf.DedicatedServer, Obf.startServer, Boolean.TYPE);
  66 + @Deprecated public static final MethodInfo startServerThread = new MethodInfo(Obf.MinecraftServer, Obf.startServerThread, Void.TYPE);
67 67  
68 68 private Methods() {}
69 69  
... ...
src/main/java/com/mumfrey/liteloader/core/runtime/Obf.java
... ... @@ -17,8 +17,6 @@ public class Obf
17 17 {
18 18 // Non-obfuscated references, here for convenience
19 19 // -----------------------------------------------------------------------------------------
20   - public static final Obf CallbackProxyClient = new Obf("com.mumfrey.liteloader.client.CallbackProxyClient" );
21   - public static final Obf CallbackProxyServer = new Obf("com.mumfrey.liteloader.server.CallbackProxyServer" );
22 20 public static final Obf EventProxy = new Obf("com.mumfrey.liteloader.core.event.EventProxy" );
23 21 public static final Obf HandlerList = new Obf("com.mumfrey.liteloader.core.event.HandlerList" );
24 22 public static final Obf BakedHandlerList = new Obf("com.mumfrey.liteloader.core.event.HandlerList$BakedHandlerList" );
... ... @@ -41,121 +39,128 @@ public class Obf
41 39 public static final Obf IGuiTextField = new Obf("com.mumfrey.liteloader.client.overlays.IGuiTextField" );
42 40 public static final Obf IEntityRenderer = new Obf("com.mumfrey.liteloader.client.overlays.IEntityRenderer" );
43 41 public static final Obf ISoundHandler = new Obf("com.mumfrey.liteloader.client.overlays.ISoundHandler" );
  42 +
  43 + // CHECKSTYLE:OFF
44 44  
45 45 // Classes
46 46 // -----------------------------------------------------------------------------------------
47 47 public static final Obf Minecraft = new Obf("net.minecraft.client.Minecraft", "bsu" );
48 48 public static final Obf EntityRenderer = new Obf("net.minecraft.client.renderer.EntityRenderer", "cji" );
49   - public static final Obf GuiIngame = new Obf("net.minecraft.client.gui.GuiIngame", "btz" );
50   - public static final Obf Profiler = new Obf("net.minecraft.profiler.Profiler", "uw" );
  49 + public static final Obf Blocks = new Obf("net.minecraft.init.Blocks", "aty" );
51 50 public static final Obf CrashReport$6 = new Obf("net.minecraft.crash.CrashReport$6", "h" );
52 51 public static final Obf INetHandler = new Obf("net.minecraft.network.INetHandler", "hg" );
53   - public static final Obf IntegratedServer = new Obf("net.minecraft.server.integrated.IntegratedServer", "cyk" );
54   - public static final Obf WorldSettings = new Obf("net.minecraft.world.WorldSettings", "arb" );
55   - public static final Obf ServerConfigurationManager = new Obf("net.minecraft.server.management.ServerConfigurationManager", "sn" );
56   - public static final Obf EntityPlayerMP = new Obf("net.minecraft.entity.player.EntityPlayerMP", "qw" );
57   - public static final Obf NetworkManager = new Obf("net.minecraft.network.NetworkManager", "gr" );
58   - public static final Obf DedicatedServer = new Obf("net.minecraft.server.dedicated.DedicatedServer", "po" );
59   - public static final Obf EntityPlayerSP = new Obf("net.minecraft.client.entity.EntityPlayerSP", "cio" );
60   - public static final Obf Blocks = new Obf("net.minecraft.init.Blocks", "aty" );
61 52 public static final Obf Items = new Obf("net.minecraft.init.Items", "amk" );
62   - public static final Obf FrameBuffer = new Obf("net.minecraft.client.shader.Framebuffer", "ckw" );
63   - public static final Obf GuiNewChat = new Obf("net.minecraft.client.gui.GuiNewChat", "buh" );
64   - public static final Obf GlStateManager = new Obf("net.minecraft.client.renderer.GlStateManager", "cjm" );
65   - public static final Obf Session = new Obf("net.minecraft.util.Session", "btw" );
66   - public static final Obf IChatComponent = new Obf("net.minecraft.util.IChatComponent", "ho" );
67   - public static final Obf ScreenShotHelper = new Obf("net.minecraft.util.ScreenShotHelper", "btt" );
68   - public static final Obf OpenGlHelper = new Obf("net.minecraft.client.renderer.OpenGlHelper", "dax" );
69   - public static final Obf Entity = new Obf("net.minecraft.entity.Entity", "wv" );
70   - public static final Obf RenderManager = new Obf("net.minecraft.client.renderer.entity.RenderManager", "cpt" );
71   - public static final Obf Render = new Obf("net.minecraft.client.renderer.entity.Render", "cpu" );
72   - public static final Obf GuiTextField = new Obf("net.minecraft.client.gui.GuiTextField", "bul" );
73   - public static final Obf SoundHandler = new Obf("net.minecraft.client.audio.SoundHandler", "czh" );
74   - public static final Obf BlockPos = new Obf("net.minecraft.util.BlockPos", "dt" );
75   - public static final Obf EnumFacing = new Obf("net.minecraft.util.EnumFacing", "ej" );
76   - public static final Obf ItemInWorldManager = new Obf("net.minecraft.server.management.ItemInWorldManager", "qx" );
77   - public static final Obf NetHandlerPlayServer = new Obf("net.minecraft.network.NetHandlerPlayServer", "rj" );
78   - public static final Obf EntityPlayer = new Obf("net.minecraft.entity.player.EntityPlayer", "ahd" );
79   - public static final Obf World = new Obf("net.minecraft.world.World", "aqu" );
80   - public static final Obf ItemStack = new Obf("net.minecraft.item.ItemStack", "amj" );
81   - public static final Obf PacketThreadUtil = new Obf("net.minecraft.network.PacketThreadUtil", "ig" );
82   - public static final Obf RenderGlobal = new Obf("net.minecraft.client.renderer.RenderGlobal", "ckn" );
83 53  
84 54 // Fields
85 55 // -----------------------------------------------------------------------------------------
86   - public static final Obf minecraftProfiler = new Obf("field_71424_I", "y" );
87   - public static final Obf entityRenderMap = new Obf("field_78729_o", "k" );
88   - public static final Obf reloadListeners = new Obf("field_110546_b", "d" );
89   - public static final Obf networkManager = new Obf("field_147393_d", "d" );
90   - public static final Obf registryObjects = new Obf("field_82596_a", "c" );
91   - public static final Obf underlyingIntegerMap = new Obf("field_148759_a", "a" );
92   - public static final Obf identityMap = new Obf("field_148749_a", "a" );
93   - public static final Obf objectList = new Obf("field_148748_b", "b" );
94   - public static final Obf mapSpecialRenderers = new Obf("field_147559_m", "m" );
95 56 public static final Obf tileEntityNameToClassMap = new Obf("field_145855_i", "f" );
96 57 public static final Obf tileEntityClassToNameMap = new Obf("field_145853_j", "g" );
97   - public static final Obf timer = new Obf("field_71428_T", "U" );
98   - public static final Obf mcProfiler = new Obf("field_71424_I", "y" );
99   - public static final Obf running = new Obf("field_71425_J", "z" );
100   - public static final Obf defaultResourcePacks = new Obf("field_110449_ao", "aw" );
101   - public static final Obf serverName = new Obf("field_71475_ae", "am" );
102   - public static final Obf serverPort = new Obf("field_71477_af", "an" );
103   - public static final Obf shaderResourceLocations = new Obf("field_147712_ad", "ab" );
104   - public static final Obf shaderIndex = new Obf("field_147713_ae", "ac" );
105   - public static final Obf useShader = new Obf("field_175083_ad", "ad" );
106   - public static final Obf viewDistance = new Obf("field_149528_b", "b" );
107   - public static final Obf entityPosY = new Obf("field_70163_u", "t" );
108   - public static final Obf chatComponent = new Obf("field_148919_a", "a" );
109 58  
110 59 // Methods
111 60 // -----------------------------------------------------------------------------------------
112   - public static final Obf processPacket = new Obf("func_148833_a", "a" );
113   - public static final Obf runGameLoop = new Obf("func_71411_J", "as" );
114   - public static final Obf runTick = new Obf("func_71407_l", "r" );
115   - public static final Obf updateCameraAndRender = new Obf("func_78480_b", "b" );
116   - public static final Obf renderWorld = new Obf("func_78471_a", "a" );
117   - public static final Obf renderGameOverlay = new Obf("func_175180_a", "a" );
  61 + public static final Obf startGame = new Obf("func_71384_a", "aj" );
118 62 public static final Obf startSection = new Obf("func_76320_a", "a" );
119 63 public static final Obf endSection = new Obf("func_76319_b", "b" );
120 64 public static final Obf endStartSection = new Obf("func_76318_c", "c" );
121   - public static final Obf spawnPlayer = new Obf("func_148545_a", "f" );
122   - public static final Obf respawnPlayer = new Obf("func_72368_a", "a" );
123   - public static final Obf initializeConnectionToPlayer = new Obf("func_72355_a", "a" );
124   - public static final Obf playerLoggedIn = new Obf("func_72377_c", "c" );
125   - public static final Obf playerLoggedOut = new Obf("func_72367_e", "e" );
126   - public static final Obf startGame = new Obf("func_71384_a", "aj" );
127   - public static final Obf startServer = new Obf("func_71197_b", "i" );
128   - public static final Obf startServerThread = new Obf("func_71256_s", "B" );
129   - public static final Obf sendChatMessage = new Obf("func_71165_d", "e" );
130   - public static final Obf updateFramebufferSize = new Obf("func_147119_ah", "av" );
131   - public static final Obf framebufferRender = new Obf("func_147615_c", "c" );
132   - public static final Obf framebufferRenderExt = new Obf("func_178038_a", "a" );
133   - public static final Obf bindFramebufferTexture = new Obf("func_147612_c", "c" );
134   - public static final Obf drawChat = new Obf("func_146230_a", "a" );
135   - public static final Obf clear = new Obf("func_179086_m", "m" );
136   - public static final Obf renderWorldPass = new Obf("func_175068_a", "a" );
137   - public static final Obf getProfile = new Obf("func_148256_e", "a" );
138   - public static final Obf saveScreenshot = new Obf("func_148260_a", "a" );
139   - public static final Obf isFramebufferEnabled = new Obf("func_148822_b", "i" );
140   - public static final Obf doRenderEntity = new Obf("func_147939_a", "a" );
141   - public static final Obf doRender = new Obf("func_76986_a", "a" );
142   - public static final Obf doRenderShadowAndFire = new Obf("func_76979_b", "b" );
143   - public static final Obf resize = new Obf("func_71370_a", "a" );
144   - public static final Obf loadShader = new Obf("func_175069_a", "a" );
145   - public static final Obf getFOVModifier = new Obf("func_78481_a", "a" );
146   - public static final Obf setupCameraTransform = new Obf("func_78479_a", "a" );
147   - public static final Obf loadSoundResource = new Obf("func_147693_a", "a" );
148   - public static final Obf onBlockClicked = new Obf("func_180784_a", "a" );
149   - public static final Obf activateBlockOrUseItem = new Obf("func_180236_a", "a" );
150   - public static final Obf processPlayerBlockPlacement = new Obf("func_147346_a", "a" );
151   - public static final Obf handleAnimation = new Obf("func_175087_a", "a" );
152   - public static final Obf processPlayerDigging = new Obf("func_147345_a", "a" );
153   - public static final Obf updateTimeLightAndEntities = new Obf("func_71190_q", "z" );
154   - public static final Obf checkThreadAndEnqueue = new Obf("func_180031_a", "a" );
155   - public static final Obf processPlayer = new Obf("func_147347_a", "a" );
156   - public static final Obf renderSky = new Obf("func_174976_a", "a" );
157   - public static final Obf renderCloudsCheck = new Obf("func_180437_a", "a" );
158   - public static final Obf setupFog = new Obf("func_78468_a", "a" );
  65 + public static final Obf processPacket = new Obf("func_148833_a", "a" );
  66 +
  67 + // Legacy
  68 + // -----------------------------------------------------------------------------------------
  69 + @Deprecated public static final Obf GuiIngame = new Obf("net.minecraft.client.gui.GuiIngame", "btz" );
  70 + @Deprecated public static final Obf Profiler = new Obf("net.minecraft.profiler.Profiler", "uw" );
  71 + @Deprecated public static final Obf IntegratedServer = new Obf("net.minecraft.server.integrated.IntegratedServer", "cyk" );
  72 + @Deprecated public static final Obf WorldSettings = new Obf("net.minecraft.world.WorldSettings", "arb" );
  73 + @Deprecated public static final Obf ServerConfigurationManager = new Obf("net.minecraft.server.management.ServerConfigurationManager", "sn" );
  74 + @Deprecated public static final Obf EntityPlayerMP = new Obf("net.minecraft.entity.player.EntityPlayerMP", "qw" );
  75 + @Deprecated public static final Obf NetworkManager = new Obf("net.minecraft.network.NetworkManager", "gr" );
  76 + @Deprecated public static final Obf DedicatedServer = new Obf("net.minecraft.server.dedicated.DedicatedServer", "po" );
  77 + @Deprecated public static final Obf EntityPlayerSP = new Obf("net.minecraft.client.entity.EntityPlayerSP", "cio" );
  78 + @Deprecated public static final Obf FrameBuffer = new Obf("net.minecraft.client.shader.Framebuffer", "ckw" );
  79 + @Deprecated public static final Obf GuiNewChat = new Obf("net.minecraft.client.gui.GuiNewChat", "buh" );
  80 + @Deprecated public static final Obf GlStateManager = new Obf("net.minecraft.client.renderer.GlStateManager", "cjm" );
  81 + @Deprecated public static final Obf Session = new Obf("net.minecraft.util.Session", "btw" );
  82 + @Deprecated public static final Obf IChatComponent = new Obf("net.minecraft.util.IChatComponent", "ho" );
  83 + @Deprecated public static final Obf ScreenShotHelper = new Obf("net.minecraft.util.ScreenShotHelper", "btt" );
  84 + @Deprecated public static final Obf OpenGlHelper = new Obf("net.minecraft.client.renderer.OpenGlHelper", "dax" );
  85 + @Deprecated public static final Obf Entity = new Obf("net.minecraft.entity.Entity", "wv" );
  86 + @Deprecated public static final Obf RenderManager = new Obf("net.minecraft.client.renderer.entity.RenderManager", "cpt" );
  87 + @Deprecated public static final Obf Render = new Obf("net.minecraft.client.renderer.entity.Render", "cpu" );
  88 + @Deprecated public static final Obf GuiTextField = new Obf("net.minecraft.client.gui.GuiTextField", "bul" );
  89 + @Deprecated public static final Obf SoundHandler = new Obf("net.minecraft.client.audio.SoundHandler", "czh" );
  90 + @Deprecated public static final Obf BlockPos = new Obf("net.minecraft.util.BlockPos", "dt" );
  91 + @Deprecated public static final Obf EnumFacing = new Obf("net.minecraft.util.EnumFacing", "ej" );
  92 + @Deprecated public static final Obf ItemInWorldManager = new Obf("net.minecraft.server.management.ItemInWorldManager", "qx" );
  93 + @Deprecated public static final Obf NetHandlerPlayServer = new Obf("net.minecraft.network.NetHandlerPlayServer", "rj" );
  94 + @Deprecated public static final Obf EntityPlayer = new Obf("net.minecraft.entity.player.EntityPlayer", "ahd" );
  95 + @Deprecated public static final Obf World = new Obf("net.minecraft.world.World", "aqu" );
  96 + @Deprecated public static final Obf ItemStack = new Obf("net.minecraft.item.ItemStack", "amj" );
  97 + @Deprecated public static final Obf PacketThreadUtil = new Obf("net.minecraft.network.PacketThreadUtil", "ig" );
  98 + @Deprecated public static final Obf RenderGlobal = new Obf("net.minecraft.client.renderer.RenderGlobal", "ckn" );
  99 + @Deprecated public static final Obf minecraftProfiler = new Obf("field_71424_I", "y" );
  100 + @Deprecated public static final Obf entityRenderMap = new Obf("field_78729_o", "k" );
  101 + @Deprecated public static final Obf reloadListeners = new Obf("field_110546_b", "d" );
  102 + @Deprecated public static final Obf networkManager = new Obf("field_147393_d", "d" );
  103 + @Deprecated public static final Obf registryObjects = new Obf("field_82596_a", "c" );
  104 + @Deprecated public static final Obf underlyingIntegerMap = new Obf("field_148759_a", "a" );
  105 + @Deprecated public static final Obf identityMap = new Obf("field_148749_a", "a" );
  106 + @Deprecated public static final Obf objectList = new Obf("field_148748_b", "b" );
  107 + @Deprecated public static final Obf mapSpecialRenderers = new Obf("field_147559_m", "m" );
  108 + @Deprecated public static final Obf timer = new Obf("field_71428_T", "U" );
  109 + @Deprecated public static final Obf mcProfiler = new Obf("field_71424_I", "y" );
  110 + @Deprecated public static final Obf running = new Obf("field_71425_J", "z" );
  111 + @Deprecated public static final Obf defaultResourcePacks = new Obf("field_110449_ao", "aw" );
  112 + @Deprecated public static final Obf serverName = new Obf("field_71475_ae", "am" );
  113 + @Deprecated public static final Obf serverPort = new Obf("field_71477_af", "an" );
  114 + @Deprecated public static final Obf shaderResourceLocations = new Obf("field_147712_ad", "ab" );
  115 + @Deprecated public static final Obf shaderIndex = new Obf("field_147713_ae", "ac" );
  116 + @Deprecated public static final Obf useShader = new Obf("field_175083_ad", "ad" );
  117 + @Deprecated public static final Obf viewDistance = new Obf("field_149528_b", "b" );
  118 + @Deprecated public static final Obf entityPosY = new Obf("field_70163_u", "t" );
  119 + @Deprecated public static final Obf chatComponent = new Obf("field_148919_a", "a" );
  120 + @Deprecated public static final Obf runGameLoop = new Obf("func_71411_J", "as" );
  121 + @Deprecated public static final Obf runTick = new Obf("func_71407_l", "r" );
  122 + @Deprecated public static final Obf updateCameraAndRender = new Obf("func_78480_b", "b" );
  123 + @Deprecated public static final Obf renderWorld = new Obf("func_78471_a", "a" );
  124 + @Deprecated public static final Obf renderGameOverlay = new Obf("func_175180_a", "a" );
  125 + @Deprecated public static final Obf spawnPlayer = new Obf("func_148545_a", "f" );
  126 + @Deprecated public static final Obf respawnPlayer = new Obf("func_72368_a", "a" );
  127 + @Deprecated public static final Obf initializeConnectionToPlayer = new Obf("func_72355_a", "a" );
  128 + @Deprecated public static final Obf playerLoggedIn = new Obf("func_72377_c", "c" );
  129 + @Deprecated public static final Obf playerLoggedOut = new Obf("func_72367_e", "e" );
  130 + @Deprecated public static final Obf startServer = new Obf("func_71197_b", "i" );
  131 + @Deprecated public static final Obf startServerThread = new Obf("func_71256_s", "B" );
  132 + @Deprecated public static final Obf sendChatMessage = new Obf("func_71165_d", "e" );
  133 + @Deprecated public static final Obf updateFramebufferSize = new Obf("func_147119_ah", "av" );
  134 + @Deprecated public static final Obf framebufferRender = new Obf("func_147615_c", "c" );
  135 + @Deprecated public static final Obf framebufferRenderExt = new Obf("func_178038_a", "a" );
  136 + @Deprecated public static final Obf bindFramebufferTexture = new Obf("func_147612_c", "c" );
  137 + @Deprecated public static final Obf drawChat = new Obf("func_146230_a", "a" );
  138 + @Deprecated public static final Obf clear = new Obf("func_179086_m", "m" );
  139 + @Deprecated public static final Obf renderWorldPass = new Obf("func_175068_a", "a" );
  140 + @Deprecated public static final Obf getProfile = new Obf("func_148256_e", "a" );
  141 + @Deprecated public static final Obf saveScreenshot = new Obf("func_148260_a", "a" );
  142 + @Deprecated public static final Obf isFramebufferEnabled = new Obf("func_148822_b", "i" );
  143 + @Deprecated public static final Obf doRenderEntity = new Obf("func_147939_a", "a" );
  144 + @Deprecated public static final Obf doRender = new Obf("func_76986_a", "a" );
  145 + @Deprecated public static final Obf doRenderShadowAndFire = new Obf("func_76979_b", "b" );
  146 + @Deprecated public static final Obf resize = new Obf("func_71370_a", "a" );
  147 + @Deprecated public static final Obf loadShader = new Obf("func_175069_a", "a" );
  148 + @Deprecated public static final Obf getFOVModifier = new Obf("func_78481_a", "a" );
  149 + @Deprecated public static final Obf setupCameraTransform = new Obf("func_78479_a", "a" );
  150 + @Deprecated public static final Obf loadSoundResource = new Obf("func_147693_a", "a" );
  151 + @Deprecated public static final Obf onBlockClicked = new Obf("func_180784_a", "a" );
  152 + @Deprecated public static final Obf activateBlockOrUseItem = new Obf("func_180236_a", "a" );
  153 + @Deprecated public static final Obf processPlayerBlockPlacement = new Obf("func_147346_a", "a" );
  154 + @Deprecated public static final Obf handleAnimation = new Obf("func_175087_a", "a" );
  155 + @Deprecated public static final Obf processPlayerDigging = new Obf("func_147345_a", "a" );
  156 + @Deprecated public static final Obf updateTimeLightAndEntities = new Obf("func_71190_q", "z" );
  157 + @Deprecated public static final Obf checkThreadAndEnqueue = new Obf("func_180031_a", "a" );
  158 + @Deprecated public static final Obf processPlayer = new Obf("func_147347_a", "a" );
  159 + @Deprecated public static final Obf renderSky = new Obf("func_174976_a", "a" );
  160 + @Deprecated public static final Obf renderCloudsCheck = new Obf("func_180437_a", "a" );
  161 + @Deprecated public static final Obf setupFog = new Obf("func_78468_a", "a" );
  162 +
  163 + // CHECKSTYLE:ON
159 164  
160 165 public static final int MCP = 0;
161 166 public static final int SRG = 1;
... ...
src/main/java/com/mumfrey/liteloader/interfaces/Loadable.java
... ... @@ -91,4 +91,10 @@ public interface Loadable&lt;L&gt; extends Comparable&lt;L&gt;
91 91 * File instance, otherwise returns null.
92 92 */
93 93 public abstract File toFile();
  94 +
  95 + /**
  96 + * Get whether this container requires early injection, eg. it contains a
  97 + * tweaker, transformer or mixins
  98 + */
  99 + public abstract boolean requiresPreInitInjection();
94 100 }
... ...
src/main/java/com/mumfrey/liteloader/interfaces/LoadableFile.java
... ... @@ -5,7 +5,6 @@ import java.io.IOException;
5 5 import java.net.MalformedURLException;
6 6 import java.net.URL;
7 7 import java.nio.charset.Charset;
8   -import java.util.ArrayList;
9 8 import java.util.Collections;
10 9 import java.util.HashSet;
11 10 import java.util.List;
... ... @@ -30,6 +29,19 @@ import net.minecraft.launchwrapper.LaunchClassLoader;
30 29  
31 30 public class LoadableFile extends File implements TweakContainer<File>
32 31 {
  32 + public static final String MFATT_MODTYPE = "ModType";
  33 + public static final String MFATT_TWEAK_CLASS = "TweakClass";
  34 + public static final String MFATT_CLASS_PATH = "Class-Path";
  35 + public static final String MFATT_TWEAK_ORDER = "TweakOrder";
  36 + public static final String MFATT_IMPLEMENTATION_TITLE = "Implementation-Title";
  37 + public static final String MFATT_TWEAK_NAME = "TweakName";
  38 + public static final String MFATT_IMPLEMENTATION_VERSION = "Implementation-Version";
  39 + public static final String MFATT_TWEAK_VERSION = "TweakVersion";
  40 + public static final String MFATT_IMPLEMENTATION_VENDOR = "Implementation-Vendor";
  41 + public static final String MFATT_TWEAK_AUTHOR = "TweakAuthor";
  42 + public static final String MFATT_MIXIN_CONFIGS = "MixinConfigs";
  43 + public static final String MFATT_INJECTION_STRATEGY = "TweakInjectionStrategy";
  44 +
33 45 private static final Pattern versionPattern = Pattern.compile("([0-9]+\\.)+[0-9]+([_A-Z0-9]+)?");
34 46  
35 47 private static final long serialVersionUID = 1L;
... ... @@ -75,6 +87,11 @@ public class LoadableFile extends File implements TweakContainer&lt;File&gt;
75 87 protected boolean hasEventTransformers;
76 88  
77 89 /**
  90 + * Mixin config resource names
  91 + */
  92 + protected Set<String> mixinConfigs = new HashSet<String>();
  93 +
  94 + /**
78 95 * Create a new tweak container wrapping the specified file
79 96 */
80 97 public LoadableFile(File parent)
... ... @@ -145,12 +162,24 @@ public class LoadableFile extends File implements TweakContainer&lt;File&gt;
145 162 if (jar.getManifest() != null)
146 163 {
147 164 LiteLoaderLogger.info("Inspecting jar metadata in '%s'", this.getName());
148   - Attributes manifestAttributes = jar.getManifest().getMainAttributes();
149   -
150   - String modSystemList = manifestAttributes.getValue("ModType");
151   - if (modSystemList != null)
  165 + Attributes mfAttributes = jar.getManifest().getMainAttributes();
  166 +
  167 + String mfAttmodSystemList = mfAttributes.getValue(LoadableFile.MFATT_MODTYPE);
  168 + String mfAttTweakClass = mfAttributes.getValue(LoadableFile.MFATT_TWEAK_CLASS);
  169 + String mfAttClassPath = mfAttributes.getValue(LoadableFile.MFATT_CLASS_PATH);
  170 + String mfAttTweakOrder = mfAttributes.getValue(LoadableFile.MFATT_TWEAK_ORDER);
  171 + String mfAttDisplayName = mfAttributes.getValue(LoadableFile.MFATT_IMPLEMENTATION_TITLE);
  172 + String mfAttTweakName = mfAttributes.getValue(LoadableFile.MFATT_TWEAK_NAME);
  173 + String mfAttVersion = mfAttributes.getValue(LoadableFile.MFATT_IMPLEMENTATION_VERSION);
  174 + String mfAttTweakVersion = mfAttributes.getValue(LoadableFile.MFATT_TWEAK_VERSION);
  175 + String mfAttAuthor = mfAttributes.getValue(LoadableFile.MFATT_IMPLEMENTATION_VENDOR);
  176 + String mfAttTweakAuthor = mfAttributes.getValue(LoadableFile.MFATT_TWEAK_AUTHOR);
  177 + String mfAttMixinConfigs = mfAttributes.getValue(LoadableFile.MFATT_MIXIN_CONFIGS);
  178 + String mfAttInjectionStrategy = mfAttributes.getValue(LoadableFile.MFATT_INJECTION_STRATEGY);
  179 +
  180 + if (mfAttmodSystemList != null)
152 181 {
153   - for (String modSystem : modSystemList.split(","))
  182 + for (String modSystem : mfAttmodSystemList.split(","))
154 183 {
155 184 modSystem = modSystem.trim();
156 185 if (modSystem.length() > 0)
... ... @@ -160,57 +189,37 @@ public class LoadableFile extends File implements TweakContainer&lt;File&gt;
160 189 }
161 190 }
162 191  
163   - this.tweakClassName = manifestAttributes.getValue("TweakClass");
164   - if (this.tweakClassName != null)
  192 + this.tweakClassName = mfAttTweakClass;
  193 + if (this.tweakClassName != null && mfAttClassPath != null)
165 194 {
166   - String classPath = manifestAttributes.getValue("Class-Path");
167   - if (classPath != null)
168   - {
169   - this.classPathEntries = classPath.split(" ");
170   - }
  195 + this.classPathEntries = mfAttClassPath.split(" ");
171 196 }
172 197  
173   - if (manifestAttributes.getValue("TweakOrder") != null)
  198 + if (mfAttTweakOrder != null)
174 199 {
175   - Integer tweakOrder = Ints.tryParse(manifestAttributes.getValue("TweakOrder"));
  200 + Integer tweakOrder = Ints.tryParse(mfAttTweakOrder);
176 201 if (tweakOrder != null)
177 202 {
178 203 this.tweakPriority = tweakOrder.intValue();
179 204 }
180 205 }
181 206  
182   - if (manifestAttributes.getValue("Implementation-Title") != null)
  207 + if (mfAttDisplayName != null) this.displayName = mfAttDisplayName;
  208 + if (mfAttTweakName != null) this.displayName = mfAttTweakName;
  209 + if (mfAttVersion != null) this.version = mfAttVersion;
  210 + if (mfAttTweakVersion != null) this.version = mfAttTweakVersion;
  211 + if (mfAttAuthor != null) this.author = mfAttAuthor;
  212 + if (mfAttTweakAuthor != null) this.author = mfAttTweakAuthor;
  213 +
  214 + if (mfAttMixinConfigs != null)
183 215 {
184   - this.displayName = manifestAttributes.getValue("Implementation-Title");
185   - }
186   -
187   - if (manifestAttributes.getValue("TweakName") != null)
188   - {
189   - this.displayName = manifestAttributes.getValue("TweakName");
190   - }
191   -
192   - if (manifestAttributes.getValue("Implementation-Version") != null)
193   - {
194   - this.version = manifestAttributes.getValue("Implementation-Version");
195   - }
196   -
197   - if (manifestAttributes.getValue("TweakVersion") != null)
198   - {
199   - this.version = manifestAttributes.getValue("TweakVersion");
200   - }
201   -
202   - if (manifestAttributes.getValue("Implementation-Vendor") != null)
203   - {
204   - this.author = manifestAttributes.getValue("Implementation-Vendor");
205   - }
206   -
207   - if (manifestAttributes.getValue("TweakAuthor") != null)
208   - {
209   - this.author = manifestAttributes.getValue("TweakAuthor");
  216 + for (String config : mfAttMixinConfigs.split(","))
  217 + {
  218 + this.mixinConfigs.add(config);
  219 + }
210 220 }
211 221  
212   - String tweakInjectionStrategy = manifestAttributes.getValue("TweakInjectionStrategy");
213   - this.injectionStrategy = InjectionStrategy.parseStrategy(tweakInjectionStrategy, InjectionStrategy.TOP);
  222 + this.injectionStrategy = InjectionStrategy.parseStrategy(mfAttInjectionStrategy, InjectionStrategy.TOP);
214 223 }
215 224 }
216 225 catch (Exception ex)
... ... @@ -314,7 +323,19 @@ public class LoadableFile extends File implements TweakContainer&lt;File&gt;
314 323 @Override
315 324 public List<String> getClassTransformerClassNames()
316 325 {
317   - return new ArrayList<String>();
  326 + return Collections.<String>emptyList();
  327 + }
  328 +
  329 + @Override
  330 + public boolean hasMixins()
  331 + {
  332 + return this.mixinConfigs.size() > 0;
  333 + }
  334 +
  335 + @Override
  336 + public Set<String> getMixinConfigs()
  337 + {
  338 + return this.mixinConfigs;
318 339 }
319 340  
320 341 @Override
... ... @@ -337,6 +358,12 @@ public class LoadableFile extends File implements TweakContainer&lt;File&gt;
337 358 {
338 359 this.forceInjection = forceInjection;
339 360 }
  361 +
  362 + @Override
  363 + public boolean requiresPreInitInjection()
  364 + {
  365 + return this.hasTweakClass() || this.hasClassTransformers() || this.hasMixins();
  366 + }
340 367  
341 368 @Override
342 369 public boolean isInjected()
... ...
src/main/java/com/mumfrey/liteloader/interfaces/LoadableMod.java
... ... @@ -3,8 +3,7 @@ package com.mumfrey.liteloader.interfaces;
3 3 import java.io.File;
4 4 import java.net.MalformedURLException;
5 5 import java.net.URL;
6   -import java.util.ArrayList;
7   -import java.util.HashSet;
  6 +import java.util.Collections;
8 7 import java.util.List;
9 8 import java.util.Set;
10 9  
... ... @@ -287,7 +286,7 @@ public interface LoadableMod&lt;L&gt; extends Loadable&lt;L&gt;, Injectable
287 286 @Override
288 287 public Set<String> getMetaDataKeys()
289 288 {
290   - return new HashSet<String>();
  289 + return Collections.<String>emptySet();
291 290 }
292 291  
293 292 @Override
... ... @@ -305,7 +304,7 @@ public interface LoadableMod&lt;L&gt; extends Loadable&lt;L&gt;, Injectable
305 304 @Override
306 305 public Set<String> getDependencies()
307 306 {
308   - return new HashSet<String>();
  307 + return Collections.<String>emptySet();
309 308 }
310 309  
311 310 @Override
... ... @@ -316,13 +315,13 @@ public interface LoadableMod&lt;L&gt; extends Loadable&lt;L&gt;, Injectable
316 315 @Override
317 316 public Set<String> getMissingDependencies()
318 317 {
319   - return new HashSet<String>();
  318 + return Collections.<String>emptySet();
320 319 }
321 320  
322 321 @Override
323 322 public Set<String> getRequiredAPIs()
324 323 {
325   - return new HashSet<String>();
  324 + return Collections.<String>emptySet();
326 325 }
327 326  
328 327 @Override
... ... @@ -333,18 +332,24 @@ public interface LoadableMod&lt;L&gt; extends Loadable&lt;L&gt;, Injectable
333 332 @Override
334 333 public Set<String> getMissingAPIs()
335 334 {
336   - return new HashSet<String>();
  335 + return Collections.<String>emptySet();
337 336 }
338 337  
339 338 @Override
340 339 public List<String> getContainedClassNames()
341 340 {
342   - return new ArrayList<String>();
  341 + return Collections.<String>emptyList();
343 342 }
344 343  
345 344 @Override
346 345 public void addContainedMod(String modName)
347 346 {
348 347 }
  348 +
  349 + @Override
  350 + public boolean requiresPreInitInjection()
  351 + {
  352 + return false;
  353 + }
349 354 }
350 355 }
... ...
src/main/java/com/mumfrey/liteloader/interfaces/MixinContainer.java 0 → 100644
  1 +/*
  2 + * This file is part of Sponge, licensed under the MIT License (MIT).
  3 + *
  4 + * Copyright (c) SpongePowered <https://www.spongepowered.org>
  5 + * Copyright (c) contributors
  6 + *
  7 + * Permission is hereby granted, free of charge, to any person obtaining a copy
  8 + * of this software and associated documentation files (the "Software"), to deal
  9 + * in the Software without restriction, including without limitation the rights
  10 + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11 + * copies of the Software, and to permit persons to whom the Software is
  12 + * furnished to do so, subject to the following conditions:
  13 + *
  14 + * The above copyright notice and this permission notice shall be included in
  15 + * all copies or substantial portions of the Software.
  16 + *
  17 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  22 + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  23 + * THE SOFTWARE.
  24 + */
  25 +package com.mumfrey.liteloader.interfaces;
  26 +
  27 +import java.util.Set;
  28 +
  29 +public interface MixinContainer<L> extends Loadable<L>, Injectable
  30 +{
  31 +
  32 + /**
  33 + * Get whether this container has any mixins
  34 + */
  35 + public abstract boolean hasMixins();
  36 +
  37 + /**
  38 + * Get this mod's list of mixin configs
  39 + */
  40 + public abstract Set<String> getMixinConfigs();
  41 +
  42 +}
... ...
src/main/java/com/mumfrey/liteloader/interfaces/TweakContainer.java
... ... @@ -7,7 +7,7 @@ import java.util.List;
7 7 *
8 8 * @author Adam Mummery-Smith
9 9 */
10   -public interface TweakContainer<L> extends Loadable<L>, Injectable
  10 +public interface TweakContainer<L> extends MixinContainer<L>
11 11 {
12 12 /**
13 13 * Get whether this tweak container has a defined tweak class in its
... ...
src/main/java/com/mumfrey/liteloader/launch/LiteLoaderTweaker.java
... ... @@ -10,10 +10,14 @@ import java.util.List;
10 10 import java.util.Set;
11 11 import java.util.TreeSet;
12 12  
  13 +import org.spongepowered.asm.launch.MixinBootstrap;
  14 +
13 15 import net.minecraft.launchwrapper.ITweaker;
14 16 import net.minecraft.launchwrapper.Launch;
15 17 import net.minecraft.launchwrapper.LaunchClassLoader;
16 18  
  19 +import com.google.common.base.Preconditions;
  20 +import com.mumfrey.liteloader.launch.LoaderEnvironment.EnvironmentType;
17 21 import com.mumfrey.liteloader.transformers.event.EventInfo;
18 22 import com.mumfrey.liteloader.util.SortableValue;
19 23 import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
... ... @@ -231,6 +235,8 @@ public class LiteLoaderTweaker implements ITweaker
231 235 @Override
232 236 public void acceptOptions(List<String> args, File gameDirectory, File assetsDirectory, String profile)
233 237 {
  238 + LiteLoaderTweaker.injectTweakClass("org.spongepowered.asm.launch.MixinTweaker");
  239 +
234 240 Launch.classLoader.addClassLoaderExclusion("org.apache.");
235 241 Launch.classLoader.addClassLoaderExclusion("com.google.common.");
236 242 Launch.classLoader.addClassLoaderExclusion("org.objectweb.asm.");
... ... @@ -334,6 +340,8 @@ public class LiteLoaderTweaker implements ITweaker
334 340  
335 341 try
336 342 {
  343 + MixinBootstrap.init();
  344 +
337 345 this.bootstrap.preInit(Launch.classLoader, true, this.env.getModFilterList());
338 346  
339 347 this.injectDiscoveredTweakClasses();
... ... @@ -360,6 +368,7 @@ public class LiteLoaderTweaker implements ITweaker
360 368 {
361 369 this.transformerManager.injectDownstreamTransformers(Launch.classLoader);
362 370 this.bootstrap.preBeginGame();
  371 + MixinBootstrap.addProxy();
363 372 StartupState.BEGINGAME.completed();
364 373 }
365 374 catch (Throwable th)
... ... @@ -437,17 +446,15 @@ public class LiteLoaderTweaker implements ITweaker
437 446  
438 447 LiteLoaderLogger.info("Injecting cascaded tweakers...");
439 448  
440   - @SuppressWarnings("unchecked")
441   - List<String> tweakClasses = (List<String>)Launch.blackboard.get("TweakClasses");
442   - @SuppressWarnings("unchecked")
443   - List<ITweaker> tweakers = (List<ITweaker>)Launch.blackboard.get("Tweaks");
  449 + List<String> tweakClasses = LiteLoaderTweaker.getTweakClasses();
  450 + List<ITweaker> tweakers = LiteLoaderTweaker.getTweakers();
444 451 if (tweakClasses != null && tweakers != null)
445 452 {
446 453 for (SortableValue<String> tweak : this.sortedCascadingTweaks)
447 454 {
448 455 String tweakClass = tweak.getValue();
449 456 LiteLoaderLogger.info(Verbosity.REDUCED, "Injecting tweak class %s with priority %d", tweakClass, tweak.getPriority());
450   - this.injectTweakClass(tweakClass, tweakClasses, tweakers);
  457 + LiteLoaderTweaker.injectTweakClass(tweakClass, tweakClasses, tweakers);
451 458 }
452 459 }
453 460  
... ... @@ -455,26 +462,36 @@ public class LiteLoaderTweaker implements ITweaker
455 462 this.sortedCascadingTweaks.clear();
456 463 }
457 464 }
  465 +
  466 + private static boolean injectTweakClass(String tweakClass)
  467 + {
  468 + List<String> tweakClasses = LiteLoaderTweaker.getTweakClasses();
  469 + List<ITweaker> tweakers = LiteLoaderTweaker.getTweakers();
  470 + return LiteLoaderTweaker.injectTweakClass(tweakClass, tweakClasses, tweakers);
  471 + }
458 472  
459 473 /**
460 474 * @param tweakClass
461 475 * @param tweakClasses
462 476 * @param tweakers
463 477 */
464   - private void injectTweakClass(String tweakClass, List<String> tweakClasses, List<ITweaker> tweakers)
  478 + private static boolean injectTweakClass(String tweakClass, List<String> tweakClasses, List<ITweaker> tweakers)
465 479 {
466   - if (!tweakClasses.contains(tweakClass))
  480 + if (tweakClasses.contains(tweakClass))
  481 + {
  482 + return false;
  483 + }
  484 +
  485 + for (ITweaker existingTweaker : tweakers)
467 486 {
468   - for (ITweaker existingTweaker : tweakers)
  487 + if (tweakClass.equals(existingTweaker.getClass().getName()))
469 488 {
470   - if (tweakClass.equals(existingTweaker.getClass().getName()))
471   - {
472   - return;
473   - }
  489 + return false;
474 490 }
475   -
476   - tweakClasses.add(tweakClass);
477 491 }
  492 +
  493 + tweakClasses.add(tweakClass);
  494 + return true;
478 495 }
479 496  
480 497 /**
... ... @@ -592,11 +609,10 @@ public class LiteLoaderTweaker implements ITweaker
592 609 /**
593 610 * @param clazz
594 611 */
595   - @SuppressWarnings("unchecked")
596 612 private static boolean isTweakAlreadyEnqueued(String clazz)
597 613 {
598   - List<String> tweakClasses = (List<String>)Launch.blackboard.get("TweakClasses");
599   - List<ITweaker> tweakers = (List<ITweaker>)Launch.blackboard.get("Tweaks");
  614 + List<String> tweakClasses = LiteLoaderTweaker.getTweakClasses();
  615 + List<ITweaker> tweakers = LiteLoaderTweaker.getTweakers();
600 616  
601 617 if (tweakClasses != null)
602 618 {
... ... @@ -617,6 +633,18 @@ public class LiteLoaderTweaker implements ITweaker
617 633 return false;
618 634 }
619 635  
  636 + @SuppressWarnings("unchecked")
  637 + private static List<String> getTweakClasses()
  638 + {
  639 + return Preconditions.<List<String>>checkNotNull((List<String>)Launch.blackboard.get("TweakClasses"), "TweakClasses");
  640 + }
  641 +
  642 + @SuppressWarnings("unchecked")
  643 + private static List<ITweaker> getTweakers()
  644 + {
  645 + return Preconditions.<List<ITweaker>>checkNotNull((List<ITweaker>)Launch.blackboard.get("Tweaks"), "Tweaks");
  646 + }
  647 +
620 648 /**
621 649 * Get whether to enable the loading bar for minecraft startup
622 650 */
... ... @@ -656,4 +684,9 @@ public class LiteLoaderTweaker implements ITweaker
656 684 LiteLoaderTweaker.instance.onInit();
657 685 LiteLoaderTweaker.instance.onPostInit();
658 686 }
  687 +
  688 + public static EnvironmentType getEnvironmentType()
  689 + {
  690 + return LiteLoaderTweaker.instance.bootstrap.getEnvironment().getType();
  691 + }
659 692 }
660 693 \ No newline at end of file
... ...
src/main/java/com/mumfrey/liteloader/transformers/ClassOverlayTransformer.java
... ... @@ -76,7 +76,9 @@ import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
76 76 * </ul>
77 77 *
78 78 * @author Adam Mummery-Smith
  79 + * @deprecated Use mixins instead!
79 80 */
  81 +@Deprecated
80 82 public abstract class ClassOverlayTransformer extends ClassTransformer
81 83 {
82 84 /**
... ...
src/main/java/com/mumfrey/liteloader/transformers/event/Event.java
... ... @@ -42,6 +42,11 @@ public class Event implements Comparable&lt;Event&gt;
42 42 private static final List<Map<MethodNode, List<Event>>> proxyHandlerMethods = new ArrayList<Map<MethodNode, List<Event>>>();
43 43  
44 44 private static int proxyInnerClassIndex = 1;
  45 +
  46 + static
  47 + {
  48 + Event.resizeProxyList();
  49 + }
45 50  
46 51 /**
47 52 * The name of this event
... ... @@ -657,16 +662,21 @@ public class Event implements Comparable&lt;Event&gt;
657 662  
658 663 private static List<Event> addMethodToActiveProxy(MethodNode handlerMethod)
659 664 {
660   - while (Event.proxyHandlerMethods.size() < Event.proxyInnerClassIndex + 1)
661   - {
662   - Event.proxyHandlerMethods.add(new LinkedHashMap<MethodNode, List<Event>>());
663   - }
  665 + Event.resizeProxyList();
664 666  
665 667 ArrayList<Event> events = new ArrayList<Event>();
666 668 Event.proxyHandlerMethods.get(Event.proxyInnerClassIndex).put(handlerMethod, events);
667 669 return events;
668 670 }
669 671  
  672 + private static void resizeProxyList()
  673 + {
  674 + while (Event.proxyHandlerMethods.size() < Event.proxyInnerClassIndex + 1)
  675 + {
  676 + Event.proxyHandlerMethods.add(new LinkedHashMap<MethodNode, List<Event>>());
  677 + }
  678 + }
  679 +
670 680 private static List<Event> getEventsForHandlerMethod(MethodNode handlerMethod)
671 681 {
672 682 for (Map<MethodNode, List<Event>> handlers : Event.proxyHandlerMethods)
... ...
src/main/java/com/mumfrey/liteloader/util/ObfuscationUtilities.java
... ... @@ -14,25 +14,14 @@ public class ObfuscationUtilities
14 14 * raw field/method names.
15 15 */
16 16 private static boolean fmlDetected = false;
17   -
  17 +
  18 + private static boolean checkedObfEnv = false;
18 19 private static boolean seargeNames = false;
19 20  
20 21 static
21 22 {
22 23 // Check for FML
23 24 ObfuscationUtilities.fmlDetected = ObfuscationUtilities.fmlIsPresent();
24   -
25   - try
26   - {
27   - MinecraftServer.class.getDeclaredField("serverRunning");
28   - }
29   - catch (SecurityException ex)
30   - {
31   - }
32   - catch (NoSuchFieldException ex)
33   - {
34   - ObfuscationUtilities.seargeNames = true;
35   - }
36 25 }
37 26  
38 27 public static boolean fmlIsPresent()
... ... @@ -47,6 +36,28 @@ public class ObfuscationUtilities
47 36  
48 37 return false;
49 38 }
  39 +
  40 + public static boolean useSeargeNames()
  41 + {
  42 + if (!ObfuscationUtilities.checkedObfEnv)
  43 + {
  44 + ObfuscationUtilities.checkedObfEnv = true;
  45 +
  46 + try
  47 + {
  48 + MinecraftServer.class.getDeclaredField("serverRunning");
  49 + }
  50 + catch (SecurityException ex)
  51 + {
  52 + }
  53 + catch (NoSuchFieldException ex)
  54 + {
  55 + ObfuscationUtilities.seargeNames = true;
  56 + }
  57 + }
  58 +
  59 + return ObfuscationUtilities.seargeNames;
  60 + }
50 61  
51 62 /**
52 63 * Abstraction helper function
... ... @@ -58,7 +69,7 @@ public class ObfuscationUtilities
58 69 public static String getObfuscatedFieldName(String fieldName, String obfuscatedFieldName, String seargeFieldName)
59 70 {
60 71 boolean deobfuscated = BlockPos.class.getSimpleName().equals("BlockPos");
61   - return deobfuscated ? (ObfuscationUtilities.seargeNames ? seargeFieldName : fieldName)
  72 + return deobfuscated ? (ObfuscationUtilities.useSeargeNames() ? seargeFieldName : fieldName)
62 73 : (ObfuscationUtilities.fmlDetected ? seargeFieldName : obfuscatedFieldName);
63 74 }
64 75  
... ... @@ -71,6 +82,6 @@ public class ObfuscationUtilities
71 82 public static String getObfuscatedFieldName(Obf obf)
72 83 {
73 84 boolean deobfuscated = BlockPos.class.getSimpleName().equals("BlockPos");
74   - return deobfuscated ? (ObfuscationUtilities.seargeNames ? obf.srg : obf.name) : (ObfuscationUtilities.fmlDetected ? obf.srg : obf.obf);
  85 + return deobfuscated ? (ObfuscationUtilities.useSeargeNames() ? obf.srg : obf.name) : (ObfuscationUtilities.fmlDetected ? obf.srg : obf.obf);
75 86 }
76 87 }
... ...
src/main/java/com/mumfrey/liteloader/util/PrivateFields.java
... ... @@ -3,8 +3,6 @@ package com.mumfrey.liteloader.util;
3 3 import java.lang.reflect.Field;
4 4 import java.lang.reflect.Modifier;
5 5  
6   -import net.minecraft.network.play.client.C15PacketClientSettings;
7   -
8 6 import com.mumfrey.liteloader.core.runtime.Obf;
9 7  
10 8 /**
... ... @@ -124,9 +122,4 @@ public class PrivateFields&lt;P, T&gt;
124 122  
125 123 return value;
126 124 }
127   -
128   - // CHECKSTYLE:OFF
129   -
130   - public static final PrivateFields<C15PacketClientSettings, Integer> viewDistance = new PrivateFields<C15PacketClientSettings, Integer>(C15PacketClientSettings.class, Obf.viewDistance);
131   -
132 125 }
133 126 \ No newline at end of file
... ...
src/main/resources/assets/liteloader/lang/en_US.lang
... ... @@ -41,12 +41,14 @@ gui.description.missingapis=Missing APIs: %s
41 41 gui.mod.providestweak=Tweak
42 42 gui.mod.providestransformer=Transformer
43 43 gui.mod.providesevents=Injector
  44 +gui.mod.providesmixins=Mixins
44 45 gui.mod.usingapi=Uses additional API
45 46 gui.mod.startuperror=%d startup error(s)
46 47  
47 48 gui.mod.help.tweak=A tweaker is a special type of mod. Tweakers have almost unlimited control of the game and are usually mods which alter the game engine fundamentally, for example APIs or performance-enhancement mods like Optifine. Because they have the greatest amount of control, they are also the most likely to cause instability when not compatible with each other, if you are experiencing crashes or serious problems, you should always try disabling tweak mods first.
48 49 gui.mod.help.transformer=A transformer mod uses bytecode injection to hook extra functionality within the game which LiteLoader does not normally provide. Because transformers access functionality outside of LiteLoader's core, it is possible for them to have unforseen side-effects when combined with other mods. If you are experiencing crashes or other unexpected behaviour, you should disable transformer mods before regular mods to determine whether they are the source of the issue. Forge refers to this type of mod as a §lCoreMod
49 50 gui.mod.help.events=An injector mod uses a restricted form of bytecode injection which makes it somewhat safer than a full transformer mod, but can still cause instability under some circumstances. If you are experiencing crashes or other issues, then you should disable injector mods before regular mods to determine whether they are the source of the issue.
  51 +gui.mod.help.mixins=A mod with mixins uses a safe form of bytecode injection to hook into Minecraft
50 52  
51 53 gui.settings.title=%s Settings
52 54 gui.saveandclose=Save & Close
... ...
src/main/resources/assets/liteloader/textures/gui/about.png

42.5 KB | W: | H:

42.5 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
src/main/resources/mixins.liteloader.core.json 0 → 100644
  1 +{
  2 + "required": true,
  3 + "minVersion": "0.4.10",
  4 + "package": "com.mumfrey.liteloader.common.mixin",
  5 + "refmap": "mixins.liteloader.core.refmap.json",
  6 + "mixins": [
  7 + "MixinMinecraftServer",
  8 + "MixinServerConfigurationManager",
  9 + "MixinNetHandlerPlayServer",
  10 + "MixinItemInWorldManager",
  11 + "MixinC15PacketClientSettings",
  12 + "MixinS02PacketChat"
  13 + ]
  14 +}
0 15 \ No newline at end of file
... ...