Commit 36e210a016b36f9d5bc28dfcca5967e2f21f08f1
1 parent
44a45235
Expose mixin functionality to mods
Showing
15 changed files
with
212 additions
and
64 deletions
build.gradle
... | ... | @@ -64,7 +64,7 @@ repositories { |
64 | 64 | } |
65 | 65 | |
66 | 66 | dependencies { |
67 | - compile('org.spongepowered:mixin:0.4.10-SNAPSHOT') { | |
67 | + compile('org.spongepowered:mixin:0.4.11-SNAPSHOT') { | |
68 | 68 | exclude module: 'launchwrapper' |
69 | 69 | exclude module: 'guava' |
70 | 70 | } |
... | ... | @@ -113,7 +113,7 @@ javadoc { |
113 | 113 | afterEvaluate { |
114 | 114 | logger.lifecycle '=================================================' |
115 | 115 | logger.lifecycle ' LiteLoader' |
116 | - logger.lifecycle ' Copyright (C) 2011-2015 Adam Mummery-Smith' | |
116 | + logger.lifecycle ' Copyright (C) 2011-2016 Adam Mummery-Smith' | |
117 | 117 | logger.lifecycle ' Running in {} mode', (project.isReleaseBuild ? "RELEASE" : "SNAPSHOT") |
118 | 118 | logger.lifecycle '=================================================' |
119 | 119 | |
... | ... | @@ -180,6 +180,14 @@ shadowJar { |
180 | 180 | classifier = 'release' |
181 | 181 | } |
182 | 182 | |
183 | +sourceJar { | |
184 | + dependsOn retromapReplacedDebug | |
185 | + dependsOn retromapReplacedClient | |
186 | + | |
187 | + from zipTree(tasks.retromapReplacedDebug.out) | |
188 | + from zipTree(tasks.retromapReplacedClient.out) | |
189 | +} | |
190 | + | |
183 | 191 | task javadocJar(type: Jar, dependsOn: javadoc) { |
184 | 192 | from javadoc.destinationDir |
185 | 193 | classifier = 'javadoc' | ... | ... |
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/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/main/java/com/mumfrey/liteloader/core/LiteLoader.java
... | ... | @@ -626,7 +626,6 @@ public final class LiteLoader |
626 | 626 | * @param modNameOrId |
627 | 627 | * @param metaDataKey |
628 | 628 | * @param defaultValue |
629 | - * @throws InvalidActivityException Thrown by getMod if init is not complete | |
630 | 629 | * @throws IllegalArgumentException Thrown by getMod if argument is null |
631 | 630 | */ |
632 | 631 | public String getModMetaData(String modNameOrId, String metaDataKey, String defaultValue) throws IllegalArgumentException | ... | ... |
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/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<TContainer extends Loadable<?>> |
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/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/LoadableModFile.java
... | ... | @@ -187,6 +187,7 @@ public class LoadableModFile extends LoadableFile implements LoadableMod<File> |
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/interfaces/Loadable.java
... | ... | @@ -91,4 +91,10 @@ public interface Loadable<L> extends Comparable<L> |
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<File> |
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<File> |
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<File> |
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<File> |
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<File> |
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<L> extends Loadable<L>, 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<L> extends Loadable<L>, 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<L> extends Loadable<L>, 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<L> extends Loadable<L>, 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/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