Commit fdb36ae1376359126e34c37f63a2792bc38f9bd4
1 parent
3781bd92
Style update part 3 - apply checkstyle
Showing
219 changed files
with
2871 additions
and
1464 deletions
build.gradle
@@ -17,6 +17,7 @@ buildscript { | @@ -17,6 +17,7 @@ buildscript { | ||
17 | } | 17 | } |
18 | 18 | ||
19 | apply plugin: 'net.minecraftforge.gradle.tweaker-client' | 19 | apply plugin: 'net.minecraftforge.gradle.tweaker-client' |
20 | +apply plugin: 'checkstyle' | ||
20 | apply plugin: 'maven' | 21 | apply plugin: 'maven' |
21 | 22 | ||
22 | // Artefact details | 23 | // Artefact details |
@@ -60,6 +61,17 @@ sourceSets { | @@ -60,6 +61,17 @@ sourceSets { | ||
60 | } | 61 | } |
61 | } | 62 | } |
62 | 63 | ||
64 | +checkstyle { | ||
65 | + configProperties = [ | ||
66 | + "name" : project.name, | ||
67 | + "organization": project.organization, | ||
68 | + "url" : project.url, | ||
69 | + "year" : project.inceptionYear | ||
70 | + ] | ||
71 | + configFile = file("checkstyle.xml") | ||
72 | + toolVersion = '6.13' | ||
73 | +} | ||
74 | + | ||
63 | javadoc { | 75 | javadoc { |
64 | source sourceSets.client.allJava | 76 | source sourceSets.client.allJava |
65 | source sourceSets.debug.allJava | 77 | source sourceSets.debug.allJava |
@@ -110,7 +122,7 @@ task runClient(type: JavaExec, overwrite: true) { | @@ -110,7 +122,7 @@ task runClient(type: JavaExec, overwrite: true) { | ||
110 | } | 122 | } |
111 | 123 | ||
112 | tasks.withType(JavaCompile) { | 124 | tasks.withType(JavaCompile) { |
113 | - options.compilerArgs += ['-Xlint:all', '-Xlint:-path'] | 125 | + options.compilerArgs += ['-Xlint:all', '-Xlint:-path', '-Xlint:-rawtypes'] |
114 | options.deprecation = true | 126 | options.deprecation = true |
115 | options.encoding = 'utf8' | 127 | options.encoding = 'utf8' |
116 | } | 128 | } |
checkstyle.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd"> | ||
3 | + | ||
4 | +<!-- | ||
5 | + This configuration file was written by the eclipse-cs plugin configuration editor | ||
6 | +--> | ||
7 | +<!-- | ||
8 | + Checkstyle-Configuration: LiteLoader Style | ||
9 | + Description: none | ||
10 | +--> | ||
11 | +<module name="Checker"> | ||
12 | + <property name="severity" value="warning"/> | ||
13 | + <property name="charset" value="UTF-8"/> | ||
14 | + <module name="TreeWalker"> | ||
15 | + <module name="FileContentsHolder"/> | ||
16 | + <module name="OuterTypeFilename"/> | ||
17 | + <module name="IllegalTokenText"> | ||
18 | + <property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/> | ||
19 | + <property name="format" value="\\u00(08|09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/> | ||
20 | + <property name="message" value="Avoid using corresponding octal or Unicode escape."/> | ||
21 | + </module> | ||
22 | + <module name="EmptyBlock"> | ||
23 | + <property name="option" value="TEXT"/> | ||
24 | + <property name="tokens" value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/> | ||
25 | + </module> | ||
26 | + <module name="ArrayTypeStyle"/> | ||
27 | + <module name="MissingSwitchDefault"/> | ||
28 | + <module name="FallThrough"/> | ||
29 | + <module name="UpperEll"/> | ||
30 | + <module name="ModifierOrder"/> | ||
31 | + <module name="PackageName"> | ||
32 | + <property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/> | ||
33 | + <message key="name.invalidPattern" value="Package name ''{0}'' must match pattern ''{1}''."/> | ||
34 | + </module> | ||
35 | + <module name="TypeName"> | ||
36 | + <message key="name.invalidPattern" value="Type name ''{0}'' must match pattern ''{1}''."/> | ||
37 | + </module> | ||
38 | + <module name="MemberName"> | ||
39 | + <property name="format" value="^[a-z]([a-zA-Z0-9]*)?$"/> | ||
40 | + <message key="name.invalidPattern" value="Member name ''{0}'' must match pattern ''{1}''."/> | ||
41 | + </module> | ||
42 | + <module name="ParameterName"> | ||
43 | + <property name="format" value="^[a-z]([a-zA-Z0-9]*)?$"/> | ||
44 | + <message key="name.invalidPattern" value="Parameter name ''{0}'' must match pattern ''{1}''."/> | ||
45 | + </module> | ||
46 | + <module name="LocalVariableName"> | ||
47 | + <property name="format" value="^[a-z]([a-zA-Z0-9]*)?$"/> | ||
48 | + <property name="tokens" value="VARIABLE_DEF"/> | ||
49 | + <message key="name.invalidPattern" value="Local variable name ''{0}'' must match pattern ''{1}''."/> | ||
50 | + </module> | ||
51 | + <module name="ClassTypeParameterName"> | ||
52 | + <property name="format" value="(^[A-Z][0-9]?)$|(T[A-Z][a-zA-Z0-9]*$)"/> | ||
53 | + <message key="name.invalidPattern" value="Class type name ''{0}'' must match pattern ''{1}''."/> | ||
54 | + </module> | ||
55 | + <module name="MethodTypeParameterName"> | ||
56 | + <property name="format" value="(^[A-Z][0-9]?)$|(T[A-Z][a-zA-Z0-9]*$)"/> | ||
57 | + <message key="name.invalidPattern" value="Method type name ''{0}'' must match pattern ''{1}''."/> | ||
58 | + </module> | ||
59 | + <module name="NoFinalizer"/> | ||
60 | + <module name="OperatorWrap"> | ||
61 | + <property name="option" value="NL"/> | ||
62 | + <property name="tokens" value="BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR, LT, MINUS, MOD, NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR "/> | ||
63 | + </module> | ||
64 | + <module name="RequireThis"/> | ||
65 | + <module name="EqualsHashCode"/> | ||
66 | + <module name="LeftCurly"> | ||
67 | + <property name="option" value="nl"/> | ||
68 | + </module> | ||
69 | + <module name="MethodParamPad"> | ||
70 | + <property name="allowLineBreaks" value="true"/> | ||
71 | + <property name="tokens" value="CTOR_DEF,METHOD_CALL,METHOD_DEF,SUPER_CTOR_CALL"/> | ||
72 | + </module> | ||
73 | + <module name="LineLength"> | ||
74 | + <metadata name="net.sf.eclipsecs.core.comment" value="Code line length"/> | ||
75 | + <property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/> | ||
76 | + <property name="max" value="150"/> | ||
77 | + <message key="maxLineLen" value="Code line is longer than {0,number,integer} characters (found {1,number,integer})."/> | ||
78 | + </module> | ||
79 | + <module name="LineLength"> | ||
80 | + <metadata name="net.sf.eclipsecs.core.comment" value="Comment line length"/> | ||
81 | + <property name="ignorePattern" value="^[ ]*([a-zA-Z0-9\{\}\+\|\&\"@\(\)\?\:\.=]|//)"/> | ||
82 | + <message key="maxLineLen" value="Comment line is longer than {0,number,integer} characters (found {1,number,integer})."/> | ||
83 | + </module> | ||
84 | + <module name="NeedBraces"> | ||
85 | + <property name="allowSingleLineStatement" value="true"/> | ||
86 | + <message key="needBraces" value="''{0}'' must use '''{}'''s."/> | ||
87 | + </module> | ||
88 | + <module name="RightCurly"> | ||
89 | + <property name="option" value="alone"/> | ||
90 | + <property name="tokens" value="LITERAL_TRY,LITERAL_CATCH,LITERAL_FINALLY,LITERAL_IF,LITERAL_ELSE,CLASS_DEF,METHOD_DEF,CTOR_DEF,LITERAL_FOR,LITERAL_WHILE,LITERAL_DO,STATIC_INIT,INSTANCE_INIT"/> | ||
91 | + <property name="shouldStartLine" value="false"/> | ||
92 | + </module> | ||
93 | + <module name="MissingOverride"> | ||
94 | + <property name="severity" value="error"/> | ||
95 | + </module> | ||
96 | + <module name="MissingDeprecated"> | ||
97 | + <property name="severity" value="warning"/> | ||
98 | + </module> | ||
99 | + <module name="TypecastParenPad"> | ||
100 | + <property name="tokens" value="RPAREN,TYPECAST"/> | ||
101 | + </module> | ||
102 | + <module name="DefaultComesLast"/> | ||
103 | + <module name="EmptyStatement"/> | ||
104 | + <module name="EqualsAvoidNull"/> | ||
105 | + <module name="StringLiteralEquality"/> | ||
106 | + <module name="FinalClass"/> | ||
107 | + </module> | ||
108 | + <module name="SuppressionCommentFilter"/> | ||
109 | +</module> |
src/client/java/com/mumfrey/liteloader/ChatFilter.java
@@ -13,11 +13,13 @@ import net.minecraft.util.IChatComponent; | @@ -13,11 +13,13 @@ import net.minecraft.util.IChatComponent; | ||
13 | public interface ChatFilter extends LiteMod | 13 | public interface ChatFilter extends LiteMod |
14 | { | 14 | { |
15 | /** | 15 | /** |
16 | - * Chat filter function, return false to filter this packet, true to pass the packet | 16 | + * Chat filter function, return false to filter this packet, true to pass |
17 | + * the packet. | ||
17 | * | 18 | * |
18 | * @param chat ChatMessageComponent parsed from the chat packet | 19 | * @param chat ChatMessageComponent parsed from the chat packet |
19 | * @param message Chat message parsed from the chat message component | 20 | * @param message Chat message parsed from the chat message component |
20 | - * @param newMessage If you wish to mutate the message, set the value using newMessage.set() | 21 | + * @param newMessage If you wish to mutate the message, set the value using |
22 | + * newMessage.set() | ||
21 | * | 23 | * |
22 | * @return True to keep the packet, false to discard | 24 | * @return True to keep the packet, false to discard |
23 | */ | 25 | */ |
src/client/java/com/mumfrey/liteloader/EntityRenderListener.java
@@ -4,7 +4,8 @@ import net.minecraft.client.renderer.entity.Render; | @@ -4,7 +4,8 @@ import net.minecraft.client.renderer.entity.Render; | ||
4 | import net.minecraft.entity.Entity; | 4 | import net.minecraft.entity.Entity; |
5 | 5 | ||
6 | /** | 6 | /** |
7 | - * Interface for mods which want to receive callbacks when entities are rendered into the world | 7 | + * Interface for mods which want to receive callbacks when entities are rendered |
8 | + * into the world. | ||
8 | * | 9 | * |
9 | * @author Adam Mummery-Smith | 10 | * @author Adam Mummery-Smith |
10 | */ | 11 | */ |
src/client/java/com/mumfrey/liteloader/FrameBufferListener.java
@@ -3,20 +3,23 @@ package com.mumfrey.liteloader; | @@ -3,20 +3,23 @@ package com.mumfrey.liteloader; | ||
3 | import net.minecraft.client.shader.Framebuffer; | 3 | import net.minecraft.client.shader.Framebuffer; |
4 | 4 | ||
5 | /** | 5 | /** |
6 | - * Interface for mods which want to interact with Minecraft's main Frame Buffer Object | 6 | + * Interface for mods which want to interact with Minecraft's main Frame Buffer |
7 | + * Object. | ||
7 | * | 8 | * |
8 | * @author Adam Mummery-Smith | 9 | * @author Adam Mummery-Smith |
9 | */ | 10 | */ |
10 | public interface FrameBufferListener extends LiteMod | 11 | public interface FrameBufferListener extends LiteMod |
11 | { | 12 | { |
12 | /** | 13 | /** |
13 | - * Called before the FBO is rendered. Useful if you want to interact with the FBO before it is drawn to the screen | 14 | + * Called before the FBO is rendered. Useful if you want to interact with |
15 | + * the FBO before it is drawn to the screen. | ||
14 | */ | 16 | */ |
15 | public abstract void preRenderFBO(Framebuffer fbo); | 17 | public abstract void preRenderFBO(Framebuffer fbo); |
16 | 18 | ||
17 | /** | 19 | /** |
18 | - * Called immediately before the FBO is rendered to the screen, after the appropriate IGL modes and matrix transforms | ||
19 | - * have been set but before the FBO is actually rendered into the main output buffer. | 20 | + * Called immediately before the FBO is rendered to the screen, after the |
21 | + * appropriate IGL modes and matrix transforms have been set but before the | ||
22 | + * FBO is actually rendered into the main output buffer. | ||
20 | * | 23 | * |
21 | * @param fbo FBO instance | 24 | * @param fbo FBO instance |
22 | * @param width FBO width | 25 | * @param width FBO width |
src/client/java/com/mumfrey/liteloader/InitCompleteListener.java
@@ -5,15 +5,17 @@ import net.minecraft.client.Minecraft; | @@ -5,15 +5,17 @@ import net.minecraft.client.Minecraft; | ||
5 | import com.mumfrey.liteloader.core.LiteLoader; | 5 | import com.mumfrey.liteloader.core.LiteLoader; |
6 | 6 | ||
7 | /** | 7 | /** |
8 | - * Interface for mods which need to initialise stuff once the game initialisation is completed, | ||
9 | - * for example mods which need to register new renderers. | 8 | + * Interface for mods which need to initialise stuff once the game |
9 | + * initialisation is completed, for example mods which need to register new | ||
10 | + * renderers. | ||
10 | * | 11 | * |
11 | * @author Adam Mummery-Smith | 12 | * @author Adam Mummery-Smith |
12 | */ | 13 | */ |
13 | public interface InitCompleteListener extends Tickable | 14 | public interface InitCompleteListener extends Tickable |
14 | { | 15 | { |
15 | /** | 16 | /** |
16 | - * Called as soon as the game is initialised and the main game loop is running | 17 | + * Called as soon as the game is initialised and the main game loop is |
18 | + * running. | ||
17 | * | 19 | * |
18 | * @param minecraft Minecraft instance | 20 | * @param minecraft Minecraft instance |
19 | * @param loader LiteLoader instance | 21 | * @param loader LiteLoader instance |
src/client/java/com/mumfrey/liteloader/JoinGameListener.java
@@ -8,7 +8,8 @@ import com.mojang.realmsclient.dto.RealmsServer; | @@ -8,7 +8,8 @@ import com.mojang.realmsclient.dto.RealmsServer; | ||
8 | 8 | ||
9 | 9 | ||
10 | /** | 10 | /** |
11 | - * Interface for mods which wish to be notified when the player connects to a server (or local game) | 11 | + * Interface for mods which wish to be notified when the player connects to a |
12 | + * server (or local game). | ||
12 | * | 13 | * |
13 | * @author Adam Mummery-Smith | 14 | * @author Adam Mummery-Smith |
14 | */ | 15 | */ |
@@ -19,8 +20,10 @@ public interface JoinGameListener extends LiteMod | @@ -19,8 +20,10 @@ public interface JoinGameListener extends LiteMod | ||
19 | * | 20 | * |
20 | * @param netHandler Net handler | 21 | * @param netHandler Net handler |
21 | * @param joinGamePacket Join game packet | 22 | * @param joinGamePacket Join game packet |
22 | - * @param serverData ServerData object representing the server being connected to | ||
23 | - * @param realmsServer If connecting to a realm, a reference to the RealmsServer object | 23 | + * @param serverData ServerData object representing the server being |
24 | + * connected to | ||
25 | + * @param realmsServer If connecting to a realm, a reference to the | ||
26 | + * RealmsServer object | ||
24 | */ | 27 | */ |
25 | public abstract void onJoinGame(INetHandler netHandler, S01PacketJoinGame joinGamePacket, ServerData serverData, RealmsServer realmsServer); | 28 | public abstract void onJoinGame(INetHandler netHandler, S01PacketJoinGame joinGamePacket, ServerData serverData, RealmsServer realmsServer); |
26 | } | 29 | } |
src/client/java/com/mumfrey/liteloader/OutboundChatFilter.java
@@ -8,7 +8,8 @@ package com.mumfrey.liteloader; | @@ -8,7 +8,8 @@ package com.mumfrey.liteloader; | ||
8 | public interface OutboundChatFilter extends LiteMod | 8 | public interface OutboundChatFilter extends LiteMod |
9 | { | 9 | { |
10 | /** | 10 | /** |
11 | - * Raised when a chat message is being sent, return false to filter this message or true to allow it to be sent | 11 | + * Raised when a chat message is being sent, return false to filter this |
12 | + * message or true to allow it to be sent. | ||
12 | * | 13 | * |
13 | * @param message | 14 | * @param message |
14 | */ | 15 | */ |
src/client/java/com/mumfrey/liteloader/OutboundChatListener.java
@@ -10,7 +10,8 @@ import net.minecraft.network.play.client.C01PacketChatMessage; | @@ -10,7 +10,8 @@ import net.minecraft.network.play.client.C01PacketChatMessage; | ||
10 | public interface OutboundChatListener extends LiteMod | 10 | public interface OutboundChatListener extends LiteMod |
11 | { | 11 | { |
12 | /** | 12 | /** |
13 | - * Raised when a new chat packet is created (not necessarily transmitted, something could be trolling us) | 13 | + * Raised when a new chat packet is created (not necessarily transmitted, |
14 | + * something could be trolling us). | ||
14 | * | 15 | * |
15 | * @param packet | 16 | * @param packet |
16 | * @param message | 17 | * @param message |
src/client/java/com/mumfrey/liteloader/PostLoginListener.java
@@ -10,8 +10,9 @@ import net.minecraft.network.login.server.S02PacketLoginSuccess; | @@ -10,8 +10,9 @@ import net.minecraft.network.login.server.S02PacketLoginSuccess; | ||
10 | public interface PostLoginListener extends LiteMod | 10 | public interface PostLoginListener extends LiteMod |
11 | { | 11 | { |
12 | /** | 12 | /** |
13 | - * Called immediately after login, before the player has properly joined the game. Note that this event is raised | ||
14 | - * <b>in the network thread</b> and is not marshalled to the main thread as other packet-generated events are. | 13 | + * Called immediately after login, before the player has properly joined the |
14 | + * game. Note that this event is raised <b>in the network thread</b> and is | ||
15 | + * not marshalled to the main thread as other packet-generated events are. | ||
15 | * | 16 | * |
16 | * @param netHandler | 17 | * @param netHandler |
17 | * @param packet | 18 | * @param packet |
src/client/java/com/mumfrey/liteloader/PreRenderListener.java
@@ -10,14 +10,16 @@ import net.minecraft.client.renderer.RenderGlobal; | @@ -10,14 +10,16 @@ import net.minecraft.client.renderer.RenderGlobal; | ||
10 | public interface PreRenderListener extends LiteMod | 10 | public interface PreRenderListener extends LiteMod |
11 | { | 11 | { |
12 | /** | 12 | /** |
13 | - * Called immediately before rendering of the world (including the sky) is started. | 13 | + * Called immediately before rendering of the world (including the sky) is |
14 | + * started. | ||
14 | * | 15 | * |
15 | * @param partialTicks | 16 | * @param partialTicks |
16 | */ | 17 | */ |
17 | public abstract void onRenderWorld(float partialTicks); | 18 | public abstract void onRenderWorld(float partialTicks); |
18 | 19 | ||
19 | /** | 20 | /** |
20 | - * Called <b>after</b> the world camera transform is initialised, may be called more than once per frame if anaglyph is enabled | 21 | + * Called <b>after</b> the world camera transform is initialised, may be |
22 | + * called more than once per frame if anaglyph is enabled. | ||
21 | * | 23 | * |
22 | * @param partialTicks | 24 | * @param partialTicks |
23 | * @param pass | 25 | * @param pass |
@@ -26,7 +28,8 @@ public interface PreRenderListener extends LiteMod | @@ -26,7 +28,8 @@ public interface PreRenderListener extends LiteMod | ||
26 | public abstract void onSetupCameraTransform(float partialTicks, int pass, long timeSlice); | 28 | public abstract void onSetupCameraTransform(float partialTicks, int pass, long timeSlice); |
27 | 29 | ||
28 | /** | 30 | /** |
29 | - * Called when the sky is rendered, may be called more than once per frame if anaglyph is enabled | 31 | + * Called when the sky is rendered, may be called more than once per frame |
32 | + * if anaglyph is enabled. | ||
30 | * | 33 | * |
31 | * @param partialTicks | 34 | * @param partialTicks |
32 | * @param pass | 35 | * @param pass |
@@ -34,7 +37,8 @@ public interface PreRenderListener extends LiteMod | @@ -34,7 +37,8 @@ public interface PreRenderListener extends LiteMod | ||
34 | public abstract void onRenderSky(float partialTicks, int pass); | 37 | public abstract void onRenderSky(float partialTicks, int pass); |
35 | 38 | ||
36 | /** | 39 | /** |
37 | - * Called immediately before the clouds are rendered, may be called more than once per frame if anaglyph is enabled | 40 | + * Called immediately before the clouds are rendered, may be called more |
41 | + * than once per frame if anaglyph is enabled. | ||
38 | * | 42 | * |
39 | * @param renderGlobal | 43 | * @param renderGlobal |
40 | * @param partialTicks | 44 | * @param partialTicks |
@@ -43,7 +47,8 @@ public interface PreRenderListener extends LiteMod | @@ -43,7 +47,8 @@ public interface PreRenderListener extends LiteMod | ||
43 | public abstract void onRenderClouds(float partialTicks, int pass, RenderGlobal renderGlobal); | 47 | public abstract void onRenderClouds(float partialTicks, int pass, RenderGlobal renderGlobal); |
44 | 48 | ||
45 | /** | 49 | /** |
46 | - * Called before the terrain is rendered, may be called more than once per frame if anaglyph is enabled | 50 | + * Called before the terrain is rendered, may be called more than once per |
51 | + * frame if anaglyph is enabled. | ||
47 | * | 52 | * |
48 | * @param partialTicks | 53 | * @param partialTicks |
49 | * @param pass | 54 | * @param pass |
src/client/java/com/mumfrey/liteloader/ScreenshotListener.java
@@ -13,15 +13,16 @@ import com.mumfrey.liteloader.core.LiteLoaderEventBroker.ReturnValue; | @@ -13,15 +13,16 @@ import com.mumfrey.liteloader.core.LiteLoaderEventBroker.ReturnValue; | ||
13 | public interface ScreenshotListener extends LiteMod | 13 | public interface ScreenshotListener extends LiteMod |
14 | { | 14 | { |
15 | /** | 15 | /** |
16 | - * Called when a screenshot is taken, mods should return FALSE to suspend further processing, or TRUE to allow | ||
17 | - * processing to continue normally | 16 | + * Called when a screenshot is taken, mods should return FALSE to suspend |
17 | + * further processing, or TRUE to allow processing to continue normally | ||
18 | * | 18 | * |
19 | * @param screenshotName | 19 | * @param screenshotName |
20 | * @param width | 20 | * @param width |
21 | * @param height | 21 | * @param height |
22 | * @param fbo | 22 | * @param fbo |
23 | * @param message Message to return if the event is cancelled | 23 | * @param message Message to return if the event is cancelled |
24 | - * @return FALSE to suspend further processing, or TRUE to allow processing to continue normally | 24 | + * @return FALSE to suspend further processing, or TRUE to allow processing |
25 | + * to continue normally | ||
25 | */ | 26 | */ |
26 | public boolean onSaveScreenshot(String screenshotName, int width, int height, Framebuffer fbo, ReturnValue<IChatComponent> message); | 27 | public boolean onSaveScreenshot(String screenshotName, int width, int height, Framebuffer fbo, ReturnValue<IChatComponent> message); |
27 | } | 28 | } |
src/client/java/com/mumfrey/liteloader/Tickable.java
@@ -15,7 +15,8 @@ public interface Tickable extends LiteMod | @@ -15,7 +15,8 @@ public interface Tickable extends LiteMod | ||
15 | * @param minecraft Minecraft instance | 15 | * @param minecraft Minecraft instance |
16 | * @param partialTicks Partial tick value | 16 | * @param partialTicks Partial tick value |
17 | * @param inGame True if in-game, false if in the menu | 17 | * @param inGame True if in-game, false if in the menu |
18 | - * @param clock True if this is a new tick, otherwise false if it's a regular frame | 18 | + * @param clock True if this is a new tick, otherwise false if it's a |
19 | + * regular frame | ||
19 | */ | 20 | */ |
20 | public abstract void onTick(Minecraft minecraft, float partialTicks, boolean inGame, boolean clock); | 21 | public abstract void onTick(Minecraft minecraft, float partialTicks, boolean inGame, boolean clock); |
21 | } | 22 | } |
src/client/java/com/mumfrey/liteloader/client/CallbackProxyClient.java
@@ -26,9 +26,10 @@ import com.mumfrey.liteloader.transformers.event.EventInfo; | @@ -26,9 +26,10 @@ import com.mumfrey.liteloader.transformers.event.EventInfo; | ||
26 | import com.mumfrey.liteloader.transformers.event.ReturnEventInfo; | 26 | import com.mumfrey.liteloader.transformers.event.ReturnEventInfo; |
27 | 27 | ||
28 | /** | 28 | /** |
29 | - * Proxy class which handles the redirected calls from the injected callbacks and routes them to the | ||
30 | - * relevant liteloader handler classes. We do this rather than patching a bunch of bytecode into the packet | ||
31 | - * classes themselves because this is easier to maintain. | 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. | ||
32 | * | 33 | * |
33 | * @author Adam Mummery-Smith | 34 | * @author Adam Mummery-Smith |
34 | */ | 35 | */ |
@@ -50,7 +51,8 @@ public abstract class CallbackProxyClient extends CallbackProxyCommon | @@ -50,7 +51,8 @@ public abstract class CallbackProxyClient extends CallbackProxyCommon | ||
50 | 51 | ||
51 | if (CallbackProxyClient.clientEventBroker == null) | 52 | if (CallbackProxyClient.clientEventBroker == null) |
52 | { | 53 | { |
53 | - throw new RuntimeException("LiteLoader failed to start up properly. The game is in an unstable state and must shut down now. Check the developer log for startup errors"); | 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"); | ||
54 | } | 56 | } |
55 | 57 | ||
56 | CallbackProxyClient.clientEventBroker.onStartupComplete(); | 58 | CallbackProxyClient.clientEventBroker.onStartupComplete(); |
@@ -115,7 +117,8 @@ public abstract class CallbackProxyClient extends CallbackProxyCommon | @@ -115,7 +117,8 @@ public abstract class CallbackProxyClient extends CallbackProxyCommon | ||
115 | CallbackProxyClient.clientEventBroker.postRenderHUD(partialTicks); | 117 | CallbackProxyClient.clientEventBroker.postRenderHUD(partialTicks); |
116 | } | 118 | } |
117 | 119 | ||
118 | - public static void IntegratedServerCtor(EventInfo<IntegratedServer> e, Minecraft minecraft, String folderName, String worldName, WorldSettings worldSettings) | 120 | + public static void IntegratedServerCtor(EventInfo<IntegratedServer> e, Minecraft minecraft, String folderName, String worldName, |
121 | + WorldSettings worldSettings) | ||
119 | { | 122 | { |
120 | CallbackProxyClient.clientEventBroker.onStartServer(e.getSource(), folderName, worldName, worldSettings); | 123 | CallbackProxyClient.clientEventBroker.onStartServer(e.getSource(), folderName, worldName, worldSettings); |
121 | } | 124 | } |
@@ -185,24 +188,27 @@ public abstract class CallbackProxyClient extends CallbackProxyCommon | @@ -185,24 +188,27 @@ public abstract class CallbackProxyClient extends CallbackProxyCommon | ||
185 | CallbackProxyClient.clientEventBroker.onRenderTerrain(partialTicks, pass, timeSlice); | 188 | CallbackProxyClient.clientEventBroker.onRenderTerrain(partialTicks, pass, timeSlice); |
186 | } | 189 | } |
187 | 190 | ||
188 | - public static void onSaveScreenshot(ReturnEventInfo<ScreenShotHelper, IChatComponent> e, File gameDir, String name, int width, int height, Framebuffer fbo) | 191 | + public static void onSaveScreenshot(ReturnEventInfo<ScreenShotHelper, IChatComponent> e, File gameDir, String name, int width, int height, |
192 | + Framebuffer fbo) | ||
189 | { | 193 | { |
190 | CallbackProxyClient.clientEventBroker.onScreenshot(e, name, width, height, fbo); | 194 | CallbackProxyClient.clientEventBroker.onScreenshot(e, name, width, height, fbo); |
191 | } | 195 | } |
192 | 196 | ||
193 | - public static void onRenderEntity(ReturnEventInfo<RenderManager, Boolean> e, Entity entity, double xPos, double yPos, double zPos, float yaw, float partialTicks, boolean hideBoundingBox, Render render) | 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) | ||
194 | { | 199 | { |
195 | CallbackProxyClient.clientEventBroker.onRenderEntity(e.getSource(), entity, xPos, yPos, zPos, yaw, partialTicks, render); | 200 | CallbackProxyClient.clientEventBroker.onRenderEntity(e.getSource(), entity, xPos, yPos, zPos, yaw, partialTicks, render); |
196 | } | 201 | } |
197 | 202 | ||
198 | - public static void onPostRenderEntity(ReturnEventInfo<RenderManager, Boolean> e, Entity entity, double xPos, double yPos, double zPos, float yaw, float partialTicks, boolean hideBoundingBox, Render render) | 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) | ||
199 | { | 205 | { |
200 | CallbackProxyClient.clientEventBroker.onPostRenderEntity(e.getSource(), entity, xPos, yPos, zPos, yaw, partialTicks, render); | 206 | CallbackProxyClient.clientEventBroker.onPostRenderEntity(e.getSource(), entity, xPos, yPos, zPos, yaw, partialTicks, render); |
201 | } | 207 | } |
202 | 208 | ||
203 | /** | 209 | /** |
204 | - * Compatiblbe behaviour with FML, this method is called to generate a consistent offline UUID between client and server | ||
205 | - * for a given username. | 210 | + * Compatiblbe behaviour with FML, this method is called to generate a |
211 | + * consistent offline UUID between client and server for a given username. | ||
206 | */ | 212 | */ |
207 | public static void generateOfflineUUID(ReturnEventInfo<Session, GameProfile> e) | 213 | public static void generateOfflineUUID(ReturnEventInfo<Session, GameProfile> e) |
208 | { | 214 | { |
src/client/java/com/mumfrey/liteloader/client/ClientPluginChannelsClient.java
@@ -86,7 +86,9 @@ public class ClientPluginChannelsClient extends ClientPluginChannels | @@ -86,7 +86,9 @@ public class ClientPluginChannelsClient extends ClientPluginChannels | ||
86 | protected boolean send(String channel, PacketBuffer data, ChannelPolicy policy) | 86 | protected boolean send(String channel, PacketBuffer data, ChannelPolicy policy) |
87 | { | 87 | { |
88 | if (channel == null || channel.length() > 16 || CHANNEL_REGISTER.equals(channel) || CHANNEL_UNREGISTER.equals(channel)) | 88 | if (channel == null || channel.length() > 16 || CHANNEL_REGISTER.equals(channel) || CHANNEL_UNREGISTER.equals(channel)) |
89 | + { | ||
89 | throw new RuntimeException("Invalid channel name specified"); | 90 | throw new RuntimeException("Invalid channel name specified"); |
91 | + } | ||
90 | 92 | ||
91 | if (!policy.allows(this, channel)) | 93 | if (!policy.allows(this, channel)) |
92 | { | 94 | { |
src/client/java/com/mumfrey/liteloader/client/GameEngineClient.java
@@ -148,7 +148,8 @@ public class GameEngineClient implements GameEngine<Minecraft, IntegratedServer> | @@ -148,7 +148,8 @@ public class GameEngineClient implements GameEngine<Minecraft, IntegratedServer> | ||
148 | } | 148 | } |
149 | 149 | ||
150 | /* (non-Javadoc) | 150 | /* (non-Javadoc) |
151 | - * @see com.mumfrey.liteloader.common.GameEngine#setKeyBindings(java.util.List) | 151 | + * @see com.mumfrey.liteloader.common.GameEngine |
152 | + * #setKeyBindings(java.util.List) | ||
152 | */ | 153 | */ |
153 | @Override | 154 | @Override |
154 | public void setKeyBindings(List<KeyBinding> keyBindings) | 155 | public void setKeyBindings(List<KeyBinding> keyBindings) |
src/client/java/com/mumfrey/liteloader/client/LiteLoaderCoreProviderClient.java
1 | package com.mumfrey.liteloader.client; | 1 | package com.mumfrey.liteloader.client; |
2 | 2 | ||
3 | +import net.minecraft.client.audio.SoundHandler; | ||
3 | import net.minecraft.client.resources.IResourceManager; | 4 | import net.minecraft.client.resources.IResourceManager; |
4 | import net.minecraft.client.resources.IResourcePack; | 5 | import net.minecraft.client.resources.IResourcePack; |
5 | import net.minecraft.client.resources.SimpleReloadableResourceManager; | 6 | import net.minecraft.client.resources.SimpleReloadableResourceManager; |
@@ -28,12 +29,15 @@ public class LiteLoaderCoreProviderClient implements CoreProvider | @@ -28,12 +29,15 @@ public class LiteLoaderCoreProviderClient implements CoreProvider | ||
28 | private final LoaderProperties properties; | 29 | private final LoaderProperties properties; |
29 | 30 | ||
30 | /** | 31 | /** |
31 | - * Read from the properties file, if true we will inhibit the sound manager reload during startup to avoid getting in trouble with OpenAL | 32 | + * Read from the properties file, if true we will inhibit the sound manager |
33 | + * reload during startup to avoid getting in trouble with OpenAL. | ||
32 | */ | 34 | */ |
33 | private boolean inhibitSoundManagerReload = true; | 35 | private boolean inhibitSoundManagerReload = true; |
34 | 36 | ||
35 | /** | 37 | /** |
36 | - * If inhibit is enabled, this object is used to reflectively inhibit the sound manager's reload process during startup by removing it from the reloadables list | 38 | + * If inhibit is enabled, this object is used to reflectively inhibit the |
39 | + * sound manager's reload process during startup by removing it from the | ||
40 | + * reloadables list. | ||
37 | */ | 41 | */ |
38 | private SoundHandlerReloadInhibitor soundHandlerReloadInhibitor; | 42 | private SoundHandlerReloadInhibitor soundHandlerReloadInhibitor; |
39 | 43 | ||
@@ -52,7 +56,9 @@ public class LiteLoaderCoreProviderClient implements CoreProvider | @@ -52,7 +56,9 @@ public class LiteLoaderCoreProviderClient implements CoreProvider | ||
52 | @Override | 56 | @Override |
53 | public void onPostInit(GameEngine<?, ?> engine) | 57 | public void onPostInit(GameEngine<?, ?> engine) |
54 | { | 58 | { |
55 | - this.soundHandlerReloadInhibitor = new SoundHandlerReloadInhibitor((SimpleReloadableResourceManager)engine.getResources().getResourceManager(), ((GameEngineClient)engine).getSoundHandler()); | 59 | + SimpleReloadableResourceManager resourceManager = (SimpleReloadableResourceManager)engine.getResources().getResourceManager(); |
60 | + SoundHandler soundHandler = ((GameEngineClient)engine).getSoundHandler(); | ||
61 | + this.soundHandlerReloadInhibitor = new SoundHandlerReloadInhibitor(resourceManager, soundHandler); | ||
56 | 62 | ||
57 | if (this.inhibitSoundManagerReload) | 63 | if (this.inhibitSoundManagerReload) |
58 | { | 64 | { |
src/client/java/com/mumfrey/liteloader/client/LiteLoaderEventBrokerClient.java
@@ -36,7 +36,7 @@ import com.mumfrey.liteloader.transformers.event.ReturnEventInfo; | @@ -36,7 +36,7 @@ import com.mumfrey.liteloader.transformers.event.ReturnEventInfo; | ||
36 | import com.mumfrey.liteloader.util.log.LiteLoaderLogger; | 36 | import com.mumfrey.liteloader.util.log.LiteLoaderLogger; |
37 | 37 | ||
38 | public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker<Minecraft, IntegratedServer> implements IResourceManagerReloadListener | 38 | public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker<Minecraft, IntegratedServer> implements IResourceManagerReloadListener |
39 | -{ | 39 | +{ |
40 | private static LiteLoaderEventBrokerClient instance; | 40 | private static LiteLoaderEventBrokerClient instance; |
41 | 41 | ||
42 | /** | 42 | /** |
@@ -60,8 +60,8 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker<Minecraft | @@ -60,8 +60,8 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker<Minecraft | ||
60 | private boolean wasFullScreen = false; | 60 | private boolean wasFullScreen = false; |
61 | 61 | ||
62 | /** | 62 | /** |
63 | - * Hash code of the current world. We don't store the world reference here because we don't want | ||
64 | - * to mess with world GC by mistake | 63 | + * Hash code of the current world. We don't store the world reference |
64 | + * here because we don't want to mess with world GC by mistake. | ||
65 | */ | 65 | */ |
66 | private int worldHashCode = 0; | 66 | private int worldHashCode = 0; |
67 | 67 | ||
@@ -76,8 +76,10 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker<Minecraft | @@ -76,8 +76,10 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker<Minecraft | ||
76 | private FastIterableDeque<ViewportListener> viewportListeners = new HandlerList<ViewportListener>(ViewportListener.class); | 76 | private FastIterableDeque<ViewportListener> viewportListeners = new HandlerList<ViewportListener>(ViewportListener.class); |
77 | private FastIterableDeque<FrameBufferListener> frameBufferListeners = new HandlerList<FrameBufferListener>(FrameBufferListener.class); | 77 | private FastIterableDeque<FrameBufferListener> frameBufferListeners = new HandlerList<FrameBufferListener>(FrameBufferListener.class); |
78 | private FastIterableDeque<InitCompleteListener> initListeners = new HandlerList<InitCompleteListener>(InitCompleteListener.class); | 78 | private FastIterableDeque<InitCompleteListener> initListeners = new HandlerList<InitCompleteListener>(InitCompleteListener.class); |
79 | - private FastIterableDeque<OutboundChatFilter> outboundChatFilters = new HandlerList<OutboundChatFilter>(OutboundChatFilter.class, ReturnLogicOp.AND); | ||
80 | - private FastIterableDeque<ScreenshotListener> screenshotListeners = new HandlerList<ScreenshotListener>(ScreenshotListener.class, ReturnLogicOp.AND_BREAK_ON_FALSE); | 79 | + private FastIterableDeque<OutboundChatFilter> outboundChatFilters = new HandlerList<OutboundChatFilter>(OutboundChatFilter.class, |
80 | + ReturnLogicOp.AND); | ||
81 | + private FastIterableDeque<ScreenshotListener> screenshotListeners = new HandlerList<ScreenshotListener>(ScreenshotListener.class, | ||
82 | + ReturnLogicOp.AND_BREAK_ON_FALSE); | ||
81 | private FastIterableDeque<EntityRenderListener> entityRenderListeners = new HandlerList<EntityRenderListener>(EntityRenderListener.class); | 83 | private FastIterableDeque<EntityRenderListener> entityRenderListeners = new HandlerList<EntityRenderListener>(EntityRenderListener.class); |
82 | 84 | ||
83 | @SuppressWarnings("cast") | 85 | @SuppressWarnings("cast") |
@@ -103,7 +105,8 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker<Minecraft | @@ -103,7 +105,8 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker<Minecraft | ||
103 | } | 105 | } |
104 | 106 | ||
105 | /* (non-Javadoc) | 107 | /* (non-Javadoc) |
106 | - * @see com.mumfrey.liteloader.api.InterfaceProvider#registerInterfaces(com.mumfrey.liteloader.core.InterfaceRegistrationDelegate) | 108 | + * @see com.mumfrey.liteloader.api.InterfaceProvider#registerInterfaces( |
109 | + * com.mumfrey.liteloader.core.InterfaceRegistrationDelegate) | ||
107 | */ | 110 | */ |
108 | @Override | 111 | @Override |
109 | public void registerInterfaces(InterfaceRegistrationDelegate delegate) | 112 | public void registerInterfaces(InterfaceRegistrationDelegate delegate) |
@@ -540,7 +543,8 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker<Minecraft | @@ -540,7 +543,8 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker<Minecraft | ||
540 | * @param partialTicks | 543 | * @param partialTicks |
541 | * @param render | 544 | * @param render |
542 | */ | 545 | */ |
543 | - public void onRenderEntity(RenderManager source, Entity entity, double xPos, double yPos, double zPos, float yaw, float partialTicks, Render render) | 546 | + public void onRenderEntity(RenderManager source, Entity entity, double xPos, double yPos, double zPos, float yaw, float partialTicks, |
547 | + Render render) | ||
544 | { | 548 | { |
545 | this.entityRenderListeners.all().onRenderEntity(render, entity, xPos, yPos, zPos, yaw, partialTicks); | 549 | this.entityRenderListeners.all().onRenderEntity(render, entity, xPos, yPos, zPos, yaw, partialTicks); |
546 | } | 550 | } |
@@ -555,7 +559,8 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker<Minecraft | @@ -555,7 +559,8 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker<Minecraft | ||
555 | * @param partialTicks | 559 | * @param partialTicks |
556 | * @param render | 560 | * @param render |
557 | */ | 561 | */ |
558 | - public void onPostRenderEntity(RenderManager source, Entity entity, double xPos, double yPos, double zPos, float yaw, float partialTicks, Render render) | 562 | + public void onPostRenderEntity(RenderManager source, Entity entity, double xPos, double yPos, double zPos, float yaw, float partialTicks, |
563 | + Render render) | ||
559 | { | 564 | { |
560 | this.entityRenderListeners.all().onPostRenderEntity(render, entity, xPos, yPos, zPos, yaw, partialTicks); | 565 | this.entityRenderListeners.all().onPostRenderEntity(render, entity, xPos, yPos, zPos, yaw, partialTicks); |
561 | } | 566 | } |
src/client/java/com/mumfrey/liteloader/client/LiteLoaderPanelManager.java
@@ -41,7 +41,8 @@ public class LiteLoaderPanelManager implements PanelManager<GuiScreen> | @@ -41,7 +41,8 @@ public class LiteLoaderPanelManager implements PanelManager<GuiScreen> | ||
41 | private Minecraft minecraft; | 41 | private Minecraft minecraft; |
42 | 42 | ||
43 | /** | 43 | /** |
44 | - * Setting which determines whether we show the "mod info" screen tab in the main menu | 44 | + * Setting which determines whether we show the "mod info" screen tab in the |
45 | + * main menu. | ||
45 | */ | 46 | */ |
46 | private boolean displayModInfoScreenTab = true; | 47 | private boolean displayModInfoScreenTab = true; |
47 | 48 | ||
@@ -51,8 +52,9 @@ public class LiteLoaderPanelManager implements PanelManager<GuiScreen> | @@ -51,8 +52,9 @@ public class LiteLoaderPanelManager implements PanelManager<GuiScreen> | ||
51 | private boolean tabAlwaysExpanded = false; | 52 | private boolean tabAlwaysExpanded = false; |
52 | 53 | ||
53 | /** | 54 | /** |
54 | - * Override for the "mod info" tab setting, so that mods which want to handle the mod info themselves | ||
55 | - * can temporarily disable the function without having to change the underlying property | 55 | + * Override for the "mod info" tab setting, so that mods which want to |
56 | + * handle the mod info themselves can temporarily disable the function | ||
57 | + * without having to change the underlying property. | ||
56 | */ | 58 | */ |
57 | private boolean hideModInfoScreenTab = false; | 59 | private boolean hideModInfoScreenTab = false; |
58 | 60 | ||
@@ -61,8 +63,8 @@ public class LiteLoaderPanelManager implements PanelManager<GuiScreen> | @@ -61,8 +63,8 @@ public class LiteLoaderPanelManager implements PanelManager<GuiScreen> | ||
61 | private String notification; | 63 | private String notification; |
62 | 64 | ||
63 | /** | 65 | /** |
64 | - * Active "mod info" screen, drawn as an overlay when in the main menu and made the active screen if | ||
65 | - * the user clicks the tab | 66 | + * Active "mod info" screen, drawn as an overlay when in the main menu and |
67 | + * made the active screen if the user clicks the tab. | ||
66 | */ | 68 | */ |
67 | private GuiLiteLoaderPanel panelHost; | 69 | private GuiLiteLoaderPanel panelHost; |
68 | 70 | ||
@@ -114,7 +116,8 @@ public class LiteLoaderPanelManager implements PanelManager<GuiScreen> | @@ -114,7 +116,8 @@ public class LiteLoaderPanelManager implements PanelManager<GuiScreen> | ||
114 | } | 116 | } |
115 | 117 | ||
116 | /* (non-Javadoc) | 118 | /* (non-Javadoc) |
117 | - * @see com.mumfrey.liteloader.api.TickObserver#onTick(boolean, float, boolean) | 119 | + * @see com.mumfrey.liteloader.api.TickObserver |
120 | + * #onTick(boolean, float, boolean) | ||
118 | */ | 121 | */ |
119 | @Override | 122 | @Override |
120 | public void onTick(boolean clock, float partialTicks, boolean inGame) | 123 | public void onTick(boolean clock, float partialTicks, boolean inGame) |
@@ -140,7 +143,8 @@ public class LiteLoaderPanelManager implements PanelManager<GuiScreen> | @@ -140,7 +143,8 @@ public class LiteLoaderPanelManager implements PanelManager<GuiScreen> | ||
140 | } | 143 | } |
141 | 144 | ||
142 | /* (non-Javadoc) | 145 | /* (non-Javadoc) |
143 | - * @see com.mumfrey.liteloader.api.PostRenderObserver#onPostRender(int, int, float) | 146 | + * @see com.mumfrey.liteloader.api.PostRenderObserver |
147 | + * #onPostRender(int, int, float) | ||
144 | */ | 148 | */ |
145 | @Override | 149 | @Override |
146 | public void onPostRender(int mouseX, int mouseY, float partialTicks) | 150 | public void onPostRender(int mouseX, int mouseY, float partialTicks) |
@@ -149,12 +153,14 @@ public class LiteLoaderPanelManager implements PanelManager<GuiScreen> | @@ -149,12 +153,14 @@ public class LiteLoaderPanelManager implements PanelManager<GuiScreen> | ||
149 | 153 | ||
150 | boolean tabHidden = this.isTabHidden() && this.minecraft.currentScreen instanceof GuiMainMenu; | 154 | boolean tabHidden = this.isTabHidden() && this.minecraft.currentScreen instanceof GuiMainMenu; |
151 | 155 | ||
152 | - if (this.isPanelSupportedOnScreen(this.minecraft.currentScreen) && ((this.displayModInfoScreenTab && !tabHidden) || (this.panelHost != null && this.panelHost.isOpen()))) | 156 | + if (this.isPanelSupportedOnScreen(this.minecraft.currentScreen) |
157 | + && ((this.displayModInfoScreenTab && !tabHidden) || (this.panelHost != null && this.panelHost.isOpen()))) | ||
153 | { | 158 | { |
154 | // If we're at the main menu, prepare the overlay | 159 | // If we're at the main menu, prepare the overlay |
155 | if (this.panelHost == null || this.panelHost.getScreen() != this.minecraft.currentScreen) | 160 | if (this.panelHost == null || this.panelHost.getScreen() != this.minecraft.currentScreen) |
156 | { | 161 | { |
157 | - this.panelHost = new GuiLiteLoaderPanel(this.minecraft, this.minecraft.currentScreen, this.mods, this.environment, this.properties, this.configManager, !tabHidden); | 162 | + this.panelHost = new GuiLiteLoaderPanel(this.minecraft, this.minecraft.currentScreen, this.mods, this.environment, this.properties, |
163 | + this.configManager, !tabHidden); | ||
158 | if (this.notification != null) | 164 | if (this.notification != null) |
159 | { | 165 | { |
160 | this.panelHost.setNotification(this.notification); | 166 | this.panelHost.setNotification(this.notification); |
@@ -170,14 +176,18 @@ public class LiteLoaderPanelManager implements PanelManager<GuiScreen> | @@ -170,14 +176,18 @@ public class LiteLoaderPanelManager implements PanelManager<GuiScreen> | ||
170 | this.panelHost.release(); | 176 | this.panelHost.release(); |
171 | this.panelHost = null; | 177 | this.panelHost = null; |
172 | } | 178 | } |
173 | - else if (this.isPanelSupportedOnScreen(this.minecraft.currentScreen) && Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && Keyboard.isKeyDown(Keyboard.KEY_TAB)) | 179 | + else if (this.isPanelSupportedOnScreen(this.minecraft.currentScreen) |
180 | + && Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) | ||
181 | + && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) | ||
182 | + && Keyboard.isKeyDown(Keyboard.KEY_TAB)) | ||
174 | { | 183 | { |
175 | this.displayLiteLoaderPanel(this.minecraft.currentScreen); | 184 | this.displayLiteLoaderPanel(this.minecraft.currentScreen); |
176 | } | 185 | } |
177 | } | 186 | } |
178 | 187 | ||
179 | /** | 188 | /** |
180 | - * Set the "mod info" screen tab to hidden, regardless of the property setting | 189 | + * Set the "mod info" screen tab to hidden, regardless of the property |
190 | + * setting. | ||
181 | */ | 191 | */ |
182 | @Override | 192 | @Override |
183 | public void hideTab() | 193 | public void hideTab() |
@@ -247,7 +257,8 @@ public class LiteLoaderPanelManager implements PanelManager<GuiScreen> | @@ -247,7 +257,8 @@ public class LiteLoaderPanelManager implements PanelManager<GuiScreen> | ||
247 | { | 257 | { |
248 | if (this.isPanelSupportedOnScreen(parentScreen)) | 258 | if (this.isPanelSupportedOnScreen(parentScreen)) |
249 | { | 259 | { |
250 | - this.panelHost = new GuiLiteLoaderPanel(this.minecraft, parentScreen, this.mods, this.environment, this.properties, this.configManager, !this.isTabHidden()); | 260 | + this.panelHost = new GuiLiteLoaderPanel(this.minecraft, parentScreen, this.mods, this.environment, this.properties, |
261 | + this.configManager, !this.isTabHidden()); | ||
251 | this.minecraft.displayGuiScreen(this.panelHost); | 262 | this.minecraft.displayGuiScreen(this.panelHost); |
252 | } | 263 | } |
253 | } | 264 | } |
src/client/java/com/mumfrey/liteloader/client/PacketEventsClient.java
@@ -45,11 +45,13 @@ public class PacketEventsClient extends PacketEvents | @@ -45,11 +45,13 @@ public class PacketEventsClient extends PacketEvents | ||
45 | { | 45 | { |
46 | private static RealmsServer joiningRealm; | 46 | private static RealmsServer joiningRealm; |
47 | 47 | ||
48 | - private FastIterableDeque<JoinGameListener> joinGameListeners = new HandlerList<JoinGameListener>(JoinGameListener.class); | ||
49 | - private FastIterableDeque<ChatListener> chatListeners = new HandlerList<ChatListener>(ChatListener.class); | ||
50 | - private FastIterableDeque<ChatFilter> chatFilters = new HandlerList<ChatFilter>(ChatFilter.class, ReturnLogicOp.AND_BREAK_ON_FALSE); | ||
51 | - private FastIterableDeque<PreJoinGameListener> preJoinGameListeners = new HandlerList<PreJoinGameListener>(PreJoinGameListener.class, ReturnLogicOp.AND_BREAK_ON_FALSE); | ||
52 | - private FastIterableDeque<PostLoginListener> postLoginListeners = new HandlerList<PostLoginListener>(PostLoginListener.class); | 48 | + private FastIterableDeque<JoinGameListener> joinGameListeners = new HandlerList<JoinGameListener>(JoinGameListener.class); |
49 | + private FastIterableDeque<ChatListener> chatListeners = new HandlerList<ChatListener>(ChatListener.class); | ||
50 | + private FastIterableDeque<ChatFilter> chatFilters = new HandlerList<ChatFilter>(ChatFilter.class, | ||
51 | + ReturnLogicOp.AND_BREAK_ON_FALSE); | ||
52 | + private FastIterableDeque<PreJoinGameListener> preJoinGameListeners = new HandlerList<PreJoinGameListener>(PreJoinGameListener.class, | ||
53 | + ReturnLogicOp.AND_BREAK_ON_FALSE); | ||
54 | + private FastIterableDeque<PostLoginListener> postLoginListeners = new HandlerList<PostLoginListener>(PostLoginListener.class); | ||
53 | 55 | ||
54 | @Override | 56 | @Override |
55 | public void registerInterfaces(InterfaceRegistrationDelegate delegate) | 57 | public void registerInterfaces(InterfaceRegistrationDelegate delegate) |
@@ -86,7 +88,8 @@ public class PacketEventsClient extends PacketEvents | @@ -86,7 +88,8 @@ public class PacketEventsClient extends PacketEvents | ||
86 | { | 88 | { |
87 | if (chatListener instanceof ChatFilter) | 89 | if (chatListener instanceof ChatFilter) |
88 | { | 90 | { |
89 | - LiteLoaderLogger.warning("Interface error initialising mod '%1s'. A mod implementing ChatFilter and ChatListener is not supported! Remove one of these interfaces", chatListener.getName()); | 91 | + LiteLoaderLogger.warning("Interface error initialising mod '%1s'. A mod implementing ChatFilter and ChatListener is not supported! " |
92 | + + "Remove one of these interfaces", chatListener.getName()); | ||
90 | } | 93 | } |
91 | else | 94 | else |
92 | { | 95 | { |
@@ -127,7 +130,10 @@ public class PacketEventsClient extends PacketEvents | @@ -127,7 +130,10 @@ public class PacketEventsClient extends PacketEvents | ||
127 | } | 130 | } |
128 | 131 | ||
129 | /* (non-Javadoc) | 132 | /* (non-Javadoc) |
130 | - * @see com.mumfrey.liteloader.core.PacketEvents#handlePacket(com.mumfrey.liteloader.common.transformers.PacketEventInfo, net.minecraft.network.INetHandler, net.minecraft.network.play.server.S01PacketJoinGame) | 133 | + * @see com.mumfrey.liteloader.core.PacketEvents#handlePacket( |
134 | + * com.mumfrey.liteloader.common.transformers.PacketEventInfo, | ||
135 | + * net.minecraft.network.INetHandler, | ||
136 | + * net.minecraft.network.play.server.S01PacketJoinGame) | ||
131 | */ | 137 | */ |
132 | @Override | 138 | @Override |
133 | protected void handlePacket(PacketEventInfo<Packet> e, INetHandler netHandler, S01PacketJoinGame packet) | 139 | protected void handlePacket(PacketEventInfo<Packet> e, INetHandler netHandler, S01PacketJoinGame packet) |
@@ -179,7 +185,10 @@ public class PacketEventsClient extends PacketEvents | @@ -179,7 +185,10 @@ public class PacketEventsClient extends PacketEvents | ||
179 | } | 185 | } |
180 | 186 | ||
181 | /* (non-Javadoc) | 187 | /* (non-Javadoc) |
182 | - * @see com.mumfrey.liteloader.core.PacketEvents#handlePacket(com.mumfrey.liteloader.common.transformers.PacketEventInfo, net.minecraft.network.INetHandler, net.minecraft.network.login.server.S02PacketLoginSuccess) | 188 | + * @see com.mumfrey.liteloader.core.PacketEvents#handlePacket( |
189 | + * com.mumfrey.liteloader.common.transformers.PacketEventInfo, | ||
190 | + * net.minecraft.network.INetHandler, | ||
191 | + * net.minecraft.network.login.server.S02PacketLoginSuccess) | ||
183 | */ | 192 | */ |
184 | @Override | 193 | @Override |
185 | protected void handlePacket(PacketEventInfo<Packet> e, INetHandler netHandler, S02PacketLoginSuccess packet) | 194 | protected void handlePacket(PacketEventInfo<Packet> e, INetHandler netHandler, S02PacketLoginSuccess packet) |
@@ -199,13 +208,18 @@ public class PacketEventsClient extends PacketEvents | @@ -199,13 +208,18 @@ public class PacketEventsClient extends PacketEvents | ||
199 | } | 208 | } |
200 | 209 | ||
201 | /* (non-Javadoc) | 210 | /* (non-Javadoc) |
202 | - * @see com.mumfrey.liteloader.core.PacketEvents#handlePacket(com.mumfrey.liteloader.common.transformers.PacketEventInfo, net.minecraft.network.INetHandler, net.minecraft.network.play.server.S02PacketChat) | 211 | + * @see com.mumfrey.liteloader.core.PacketEvents#handlePacket( |
212 | + * com.mumfrey.liteloader.common.transformers.PacketEventInfo, | ||
213 | + * net.minecraft.network.INetHandler, | ||
214 | + * net.minecraft.network.play.server.S02PacketChat) | ||
203 | */ | 215 | */ |
204 | @Override | 216 | @Override |
205 | protected void handlePacket(PacketEventInfo<Packet> e, INetHandler netHandler, S02PacketChat packet) | 217 | protected void handlePacket(PacketEventInfo<Packet> e, INetHandler netHandler, S02PacketChat packet) |
206 | { | 218 | { |
207 | if (packet.getChatComponent() == null) | 219 | if (packet.getChatComponent() == null) |
220 | + { | ||
208 | return; | 221 | return; |
222 | + } | ||
209 | 223 | ||
210 | IChatComponent originalChat = packet.getChatComponent(); | 224 | IChatComponent originalChat = packet.getChatComponent(); |
211 | IChatComponent chat = originalChat; | 225 | IChatComponent chat = originalChat; |
src/client/java/com/mumfrey/liteloader/client/ResourceObserver.java
@@ -50,7 +50,8 @@ public class ResourceObserver implements ModLoadObserver | @@ -50,7 +50,8 @@ public class ResourceObserver implements ModLoadObserver | ||
50 | { | 50 | { |
51 | LiteLoaderLogger.info("Adding \"%s\" to active resource pack set", container.getLocation()); | 51 | LiteLoaderLogger.info("Adding \"%s\" to active resource pack set", container.getLocation()); |
52 | IResourcePack resourcePack = this.initResourcePack(container, modName); | 52 | IResourcePack resourcePack = this.initResourcePack(container, modName); |
53 | - Resources<IResourceManager, IResourcePack> resources = (Resources<IResourceManager, IResourcePack>)LiteLoader.getGameEngine().getResources(); | 53 | + Resources<IResourceManager, IResourcePack> resources |
54 | + = (Resources<IResourceManager, IResourcePack>)LiteLoader.getGameEngine().getResources(); | ||
54 | if (resources.registerResourcePack(resourcePack)) | 55 | if (resources.registerResourcePack(resourcePack)) |
55 | { | 56 | { |
56 | LiteLoaderLogger.info("Successfully added \"%s\" to active resource pack set", container.getLocation()); | 57 | LiteLoaderLogger.info("Successfully added \"%s\" to active resource pack set", container.getLocation()); |
@@ -66,7 +67,8 @@ public class ResourceObserver implements ModLoadObserver | @@ -66,7 +67,8 @@ public class ResourceObserver implements ModLoadObserver | ||
66 | { | 67 | { |
67 | if (container.isDirectory()) | 68 | if (container.isDirectory()) |
68 | { | 69 | { |
69 | - LiteLoaderLogger.info("Setting up \"%s/%s\" as mod resource pack with identifier \"%s\"", container.toFile().getParentFile().getName(), container.getName(), name); | 70 | + LiteLoaderLogger.info("Setting up \"%s/%s\" as mod resource pack with identifier \"%s\"", |
71 | + container.toFile().getParentFile().getName(), container.getName(), name); | ||
70 | resourcePack = new ModResourcePackDir(name, container.toFile()); | 72 | resourcePack = new ModResourcePackDir(name, container.toFile()); |
71 | } | 73 | } |
72 | else | 74 | else |
src/client/java/com/mumfrey/liteloader/client/ResourcesClient.java
@@ -22,7 +22,8 @@ public class ResourcesClient implements Resources<IResourceManager, IResourcePac | @@ -22,7 +22,8 @@ public class ResourcesClient implements Resources<IResourceManager, IResourcePac | ||
22 | private final Map<String, IResourcePack> registeredResourcePacks = new HashMap<String, IResourcePack>(); | 22 | private final Map<String, IResourcePack> registeredResourcePacks = new HashMap<String, IResourcePack>(); |
23 | 23 | ||
24 | /** | 24 | /** |
25 | - * True while initialising mods if we need to do a resource manager reload once the process is completed | 25 | + * True while initialising mods if we need to do a resource manager reload |
26 | + * once the process is completed. | ||
26 | */ | 27 | */ |
27 | private boolean pendingResourceReload; | 28 | private boolean pendingResourceReload; |
28 | 29 | ||
@@ -50,7 +51,8 @@ public class ResourcesClient implements Resources<IResourceManager, IResourcePac | @@ -50,7 +51,8 @@ public class ResourcesClient implements Resources<IResourceManager, IResourcePac | ||
50 | } | 51 | } |
51 | 52 | ||
52 | /* (non-Javadoc) | 53 | /* (non-Javadoc) |
53 | - * @see com.mumfrey.liteloader.common.GameEngine#registerResourcePack(net.minecraft.client.resources.IResourcePack) | 54 | + * @see com.mumfrey.liteloader.common.GameEngine#registerResourcePack( |
55 | + * net.minecraft.client.resources.IResourcePack) | ||
54 | */ | 56 | */ |
55 | @Override | 57 | @Override |
56 | public boolean registerResourcePack(IResourcePack resourcePack) | 58 | public boolean registerResourcePack(IResourcePack resourcePack) |
@@ -72,7 +74,8 @@ public class ResourcesClient implements Resources<IResourceManager, IResourcePac | @@ -72,7 +74,8 @@ public class ResourcesClient implements Resources<IResourceManager, IResourcePac | ||
72 | } | 74 | } |
73 | 75 | ||
74 | /* (non-Javadoc) | 76 | /* (non-Javadoc) |
75 | - * @see com.mumfrey.liteloader.common.GameEngine#unRegisterResourcePack(net.minecraft.client.resources.IResourcePack) | 77 | + * @see com.mumfrey.liteloader.common.GameEngine#unRegisterResourcePack( |
78 | + * net.minecraft.client.resources.IResourcePack) | ||
76 | */ | 79 | */ |
77 | @Override | 80 | @Override |
78 | public boolean unRegisterResourcePack(IResourcePack resourcePack) | 81 | public boolean unRegisterResourcePack(IResourcePack resourcePack) |
src/client/java/com/mumfrey/liteloader/client/SoundHandlerReloadInhibitor.java
@@ -10,7 +10,8 @@ import com.mumfrey.liteloader.client.util.PrivateFieldsClient; | @@ -10,7 +10,8 @@ import com.mumfrey.liteloader.client.util.PrivateFieldsClient; | ||
10 | import com.mumfrey.liteloader.util.log.LiteLoaderLogger; | 10 | import com.mumfrey.liteloader.util.log.LiteLoaderLogger; |
11 | 11 | ||
12 | /** | 12 | /** |
13 | - * Manager object which handles inhibiting the sound handler's reload notification at startup | 13 | + * Manager object which handles inhibiting the sound handler's reload |
14 | + * notification at startup. | ||
14 | * | 15 | * |
15 | * @author Adam Mummery-Smith | 16 | * @author Adam Mummery-Smith |
16 | */ | 17 | */ |
@@ -32,7 +33,8 @@ public class SoundHandlerReloadInhibitor | @@ -32,7 +33,8 @@ public class SoundHandlerReloadInhibitor | ||
32 | private boolean inhibited; | 33 | private boolean inhibited; |
33 | 34 | ||
34 | /** | 35 | /** |
35 | - * So that we can re-insert the sound manager at the same index, we store the index we remove it from | 36 | + * So that we can re-insert the sound manager at the same index, we store |
37 | + * the index we remove it from. | ||
36 | */ | 38 | */ |
37 | private int storedIndex; | 39 | private int storedIndex; |
38 | 40 |
src/client/java/com/mumfrey/liteloader/client/Translator.java
@@ -7,7 +7,8 @@ import com.mumfrey.liteloader.api.TranslationProvider; | @@ -7,7 +7,8 @@ import com.mumfrey.liteloader.api.TranslationProvider; | ||
7 | public class Translator implements TranslationProvider | 7 | public class Translator implements TranslationProvider |
8 | { | 8 | { |
9 | /* (non-Javadoc) | 9 | /* (non-Javadoc) |
10 | - * @see com.mumfrey.liteloader.api.TranslationProvider#translate(java.lang.String, java.lang.Object[]) | 10 | + * @see com.mumfrey.liteloader.api.TranslationProvider#translate( |
11 | + * java.lang.String, java.lang.Object[]) | ||
11 | */ | 12 | */ |
12 | @Override | 13 | @Override |
13 | public String translate(String key, Object... args) | 14 | public String translate(String key, Object... args) |
@@ -17,7 +18,8 @@ public class Translator implements TranslationProvider | @@ -17,7 +18,8 @@ public class Translator implements TranslationProvider | ||
17 | } | 18 | } |
18 | 19 | ||
19 | /* (non-Javadoc) | 20 | /* (non-Javadoc) |
20 | - * @see com.mumfrey.liteloader.api.TranslationProvider#translate(java.lang.String, java.lang.String, java.lang.Object[]) | 21 | + * @see com.mumfrey.liteloader.api.TranslationProvider#translate( |
22 | + * java.lang.String, java.lang.String, java.lang.Object[]) | ||
21 | */ | 23 | */ |
22 | @Override | 24 | @Override |
23 | public String translate(String locale, String key, Object... args) | 25 | public String translate(String locale, String key, Object... args) |
src/client/java/com/mumfrey/liteloader/client/api/LiteLoaderBrandingProvider.java
@@ -20,9 +20,13 @@ public class LiteLoaderBrandingProvider implements BrandingProvider | @@ -20,9 +20,13 @@ public class LiteLoaderBrandingProvider implements BrandingProvider | ||
20 | public static final int BRANDING_COLOUR = 0xFF4785D1; | 20 | public static final int BRANDING_COLOUR = 0xFF4785D1; |
21 | 21 | ||
22 | public static final ResourceLocation ABOUT_TEXTURE = new ResourceLocation("liteloader", "textures/gui/about.png"); | 22 | public static final ResourceLocation ABOUT_TEXTURE = new ResourceLocation("liteloader", "textures/gui/about.png"); |
23 | - public static final IconAbsolute LOGO_COORDS = new IconAbsolute(LiteLoaderBrandingProvider.ABOUT_TEXTURE, "logo", 128, 40, 0, 0, 256, 80); | ||
24 | - public static final IconAbsolute ICON_COORDS = new IconAbsolute(LiteLoaderBrandingProvider.ABOUT_TEXTURE, "chicken", 32, 45, 0, 80, 64, 170); | ||
25 | - public static final IconAbsolute TWITTER_AVATAR_COORDS = new IconAbsolute(LiteLoaderBrandingProvider.ABOUT_TEXTURE, "twitter_avatar", 32, 32, 192, 80, 256, 144); | 23 | + |
24 | + public static final IconAbsolute LOGO_COORDS = new IconAbsolute(LiteLoaderBrandingProvider.ABOUT_TEXTURE, | ||
25 | + "logo", 128, 40, 0, 0, 256, 80); | ||
26 | + public static final IconAbsolute ICON_COORDS = new IconAbsolute(LiteLoaderBrandingProvider.ABOUT_TEXTURE, | ||
27 | + "chicken", 32, 45, 0, 80, 64, 170); | ||
28 | + public static final IconAbsolute TWITTER_AVATAR_COORDS = new IconAbsolute(LiteLoaderBrandingProvider.ABOUT_TEXTURE, | ||
29 | + "twitter_avatar",32, 32, 192, 80, 256, 144); | ||
26 | 30 | ||
27 | public static final URI LITELOADER_URI = URI.create("http://www.liteloader.com/"); | 31 | public static final URI LITELOADER_URI = URI.create("http://www.liteloader.com/"); |
28 | 32 | ||
@@ -117,7 +121,8 @@ public class LiteLoaderBrandingProvider implements BrandingProvider | @@ -117,7 +121,8 @@ public class LiteLoaderBrandingProvider implements BrandingProvider | ||
117 | } | 121 | } |
118 | 122 | ||
119 | /* (non-Javadoc) | 123 | /* (non-Javadoc) |
120 | - * @see com.mumfrey.liteloader.api.BrandingProvider#getTwitterAvatarResource() | 124 | + * @see com.mumfrey.liteloader.api.BrandingProvider |
125 | + * #getTwitterAvatarResource() | ||
121 | */ | 126 | */ |
122 | @Override | 127 | @Override |
123 | public ResourceLocation getTwitterAvatarResource() | 128 | public ResourceLocation getTwitterAvatarResource() |
src/client/java/com/mumfrey/liteloader/client/api/LiteLoaderCoreAPIClient.java
@@ -53,7 +53,8 @@ public class LiteLoaderCoreAPIClient extends LiteLoaderCoreAPI | @@ -53,7 +53,8 @@ public class LiteLoaderCoreAPIClient extends LiteLoaderCoreAPI | ||
53 | } | 53 | } |
54 | 54 | ||
55 | /* (non-Javadoc) | 55 | /* (non-Javadoc) |
56 | - * @see com.mumfrey.liteloader.api.LiteAPI#getRequiredDownstreamTransformers() | 56 | + * @see com.mumfrey.liteloader.api.LiteAPI |
57 | + * #getRequiredDownstreamTransformers() | ||
57 | */ | 58 | */ |
58 | @Override | 59 | @Override |
59 | public String[] getRequiredDownstreamTransformers() | 60 | public String[] getRequiredDownstreamTransformers() |
@@ -144,7 +145,7 @@ public class LiteLoaderCoreAPIClient extends LiteLoaderCoreAPI | @@ -144,7 +145,7 @@ public class LiteLoaderCoreAPIClient extends LiteLoaderCoreAPI | ||
144 | if (this.objectFactory == null) | 145 | if (this.objectFactory == null) |
145 | { | 146 | { |
146 | this.objectFactory = new ObjectFactoryClient(this.environment, this.properties); | 147 | this.objectFactory = new ObjectFactoryClient(this.environment, this.properties); |
147 | - } | 148 | + } |
148 | 149 | ||
149 | return this.objectFactory; | 150 | return this.objectFactory; |
150 | } | 151 | } |
src/client/java/com/mumfrey/liteloader/client/api/LiteLoaderModInfoDecorator.java
@@ -20,14 +20,17 @@ import com.mumfrey.liteloader.util.render.IconTextured; | @@ -20,14 +20,17 @@ import com.mumfrey.liteloader.util.render.IconTextured; | ||
20 | public class LiteLoaderModInfoDecorator implements ModInfoDecorator | 20 | public class LiteLoaderModInfoDecorator implements ModInfoDecorator |
21 | { | 21 | { |
22 | /* (non-Javadoc) | 22 | /* (non-Javadoc) |
23 | - * @see com.mumfrey.liteloader.api.ModInfoDecorator#addIcons(com.mumfrey.liteloader.core.ModInfo, java.util.List) | 23 | + * @see com.mumfrey.liteloader.api.ModInfoDecorator |
24 | + * #addIcons(com.mumfrey.liteloader.core.ModInfo, java.util.List) | ||
24 | */ | 25 | */ |
25 | @Override | 26 | @Override |
26 | public void addIcons(final ModInfo<?> mod, List<IconTextured> icons) | 27 | public void addIcons(final ModInfo<?> mod, List<IconTextured> icons) |
27 | { | 28 | { |
28 | if (mod.hasTweakClass()) | 29 | if (mod.hasTweakClass()) |
29 | { | 30 | { |
30 | - icons.add(new IconAbsoluteClickable(LiteLoaderBrandingProvider.ABOUT_TEXTURE, I18n.format("gui.mod.providestweak"), 12, 12, 158, 80, 170, 92){ | 31 | + icons.add(new IconAbsoluteClickable(LiteLoaderBrandingProvider.ABOUT_TEXTURE, |
32 | + I18n.format("gui.mod.providestweak"), 12, 12, 158, 80, 170, 92) | ||
33 | + { | ||
31 | @Override | 34 | @Override |
32 | public void onClicked(Object source, Object container) | 35 | public void onClicked(Object source, Object container) |
33 | { | 36 | { |
@@ -41,7 +44,9 @@ public class LiteLoaderModInfoDecorator implements ModInfoDecorator | @@ -41,7 +44,9 @@ public class LiteLoaderModInfoDecorator implements ModInfoDecorator | ||
41 | 44 | ||
42 | if (mod.hasEventTransformers()) | 45 | if (mod.hasEventTransformers()) |
43 | { | 46 | { |
44 | - icons.add(new IconAbsoluteClickable(LiteLoaderBrandingProvider.ABOUT_TEXTURE, I18n.format("gui.mod.providesevents"), 12, 12, 170, 92, 182, 104){ | 47 | + icons.add(new IconAbsoluteClickable(LiteLoaderBrandingProvider.ABOUT_TEXTURE, |
48 | + I18n.format("gui.mod.providesevents"), 12, 12, 170, 92, 182, 104) | ||
49 | + { | ||
45 | @Override | 50 | @Override |
46 | public void onClicked(Object source, Object container) | 51 | public void onClicked(Object source, Object container) |
47 | { | 52 | { |
@@ -55,7 +60,9 @@ public class LiteLoaderModInfoDecorator implements ModInfoDecorator | @@ -55,7 +60,9 @@ public class LiteLoaderModInfoDecorator implements ModInfoDecorator | ||
55 | 60 | ||
56 | if (mod.hasClassTransformers()) | 61 | if (mod.hasClassTransformers()) |
57 | { | 62 | { |
58 | - icons.add(new IconAbsoluteClickable(LiteLoaderBrandingProvider.ABOUT_TEXTURE, I18n.format("gui.mod.providestransformer"), 12, 12, 170, 80, 182, 92){ | 63 | + icons.add(new IconAbsoluteClickable(LiteLoaderBrandingProvider.ABOUT_TEXTURE, |
64 | + I18n.format("gui.mod.providestransformer"), 12, 12, 170, 80, 182, 92) | ||
65 | + { | ||
59 | @Override | 66 | @Override |
60 | public void onClicked(Object source, Object container) | 67 | public void onClicked(Object source, Object container) |
61 | { | 68 | { |
@@ -69,13 +76,16 @@ public class LiteLoaderModInfoDecorator implements ModInfoDecorator | @@ -69,13 +76,16 @@ public class LiteLoaderModInfoDecorator implements ModInfoDecorator | ||
69 | 76 | ||
70 | if (mod.usesAPI()) | 77 | if (mod.usesAPI()) |
71 | { | 78 | { |
72 | - icons.add(new IconAbsolute(LiteLoaderBrandingProvider.ABOUT_TEXTURE, I18n.format("gui.mod.usingapi"), 12, 12, 122, 92, 134, 104)); | 79 | + icons.add(new IconAbsolute(LiteLoaderBrandingProvider.ABOUT_TEXTURE, |
80 | + I18n.format("gui.mod.usingapi"), 12, 12, 122, 92, 134, 104)); | ||
73 | } | 81 | } |
74 | 82 | ||
75 | List<Throwable> startupErrors = mod.getStartupErrors(); | 83 | List<Throwable> startupErrors = mod.getStartupErrors(); |
76 | if (startupErrors != null && startupErrors.size() > 0) | 84 | if (startupErrors != null && startupErrors.size() > 0) |
77 | { | 85 | { |
78 | - icons.add(new IconAbsoluteClickable(LiteLoaderBrandingProvider.ABOUT_TEXTURE, I18n.format("gui.mod.startuperror", startupErrors.size()), 12, 12, 134, 92, 146, 104){ | 86 | + icons.add(new IconAbsoluteClickable(LiteLoaderBrandingProvider.ABOUT_TEXTURE, |
87 | + I18n.format("gui.mod.startuperror", startupErrors.size()), 12, 12, 134, 92, 146, 104) | ||
88 | + { | ||
79 | @Override | 89 | @Override |
80 | public void onClicked(Object source, Object container) | 90 | public void onClicked(Object source, Object container) |
81 | { | 91 | { |
@@ -89,7 +99,9 @@ public class LiteLoaderModInfoDecorator implements ModInfoDecorator | @@ -89,7 +99,9 @@ public class LiteLoaderModInfoDecorator implements ModInfoDecorator | ||
89 | } | 99 | } |
90 | 100 | ||
91 | /* (non-Javadoc) | 101 | /* (non-Javadoc) |
92 | - * @see com.mumfrey.liteloader.api.ModInfoDecorator#modifyStatusText(com.mumfrey.liteloader.core.ModInfo, java.lang.String) | 102 | + * @see com.mumfrey.liteloader.api.ModInfoDecorator |
103 | + * #modifyStatusText(com.mumfrey.liteloader.core.ModInfo, | ||
104 | + * java.lang.String) | ||
93 | */ | 105 | */ |
94 | @Override | 106 | @Override |
95 | public String modifyStatusText(ModInfo<?> mod, String statusText) | 107 | public String modifyStatusText(ModInfo<?> mod, String statusText) |
@@ -98,10 +110,13 @@ public class LiteLoaderModInfoDecorator implements ModInfoDecorator | @@ -98,10 +110,13 @@ public class LiteLoaderModInfoDecorator implements ModInfoDecorator | ||
98 | } | 110 | } |
99 | 111 | ||
100 | /* (non-Javadoc) | 112 | /* (non-Javadoc) |
101 | - * @see com.mumfrey.liteloader.api.ModInfoDecorator#onDrawListEntry(int, int, float, int, int, int, int, boolean, com.mumfrey.liteloader.core.ModInfo, int, int, int) | 113 | + * @see com.mumfrey.liteloader.api.ModInfoDecorator |
114 | + * #onDrawListEntry(int, int, float, int, int, int, int, boolean, | ||
115 | + * com.mumfrey.liteloader.core.ModInfo, int, int, int) | ||
102 | */ | 116 | */ |
103 | @Override | 117 | @Override |
104 | - public void onDrawListEntry(int mouseX, int mouseY, float partialTicks, int xPosition, int yPosition, int width, int height, boolean selected, ModInfo<?> mod, int gradientColour, int titleColour, int statusColour) | 118 | + public void onDrawListEntry(int mouseX, int mouseY, float partialTicks, int xPosition, int yPosition, int width, int height, boolean selected, |
119 | + ModInfo<?> mod, int gradientColour, int titleColour, int statusColour) | ||
105 | { | 120 | { |
106 | } | 121 | } |
107 | } | 122 | } |
src/client/java/com/mumfrey/liteloader/client/api/ObjectFactoryClient.java
@@ -96,7 +96,7 @@ class ObjectFactoryClient implements ObjectFactory<Minecraft, IntegratedServer> | @@ -96,7 +96,7 @@ class ObjectFactoryClient implements ObjectFactory<Minecraft, IntegratedServer> | ||
96 | if (this.engine == null) | 96 | if (this.engine == null) |
97 | { | 97 | { |
98 | this.engine = new GameEngineClient(); | 98 | this.engine = new GameEngineClient(); |
99 | - } | 99 | + } |
100 | 100 | ||
101 | return this.engine; | 101 | return this.engine; |
102 | } | 102 | } |
@@ -118,7 +118,7 @@ class ObjectFactoryClient implements ObjectFactory<Minecraft, IntegratedServer> | @@ -118,7 +118,7 @@ class ObjectFactoryClient implements ObjectFactory<Minecraft, IntegratedServer> | ||
118 | if (this.clientPluginChannels == null) | 118 | if (this.clientPluginChannels == null) |
119 | { | 119 | { |
120 | this.clientPluginChannels = new ClientPluginChannelsClient(); | 120 | this.clientPluginChannels = new ClientPluginChannelsClient(); |
121 | - } | 121 | + } |
122 | 122 | ||
123 | return this.clientPluginChannels; | 123 | return this.clientPluginChannels; |
124 | } | 124 | } |
@@ -129,7 +129,7 @@ class ObjectFactoryClient implements ObjectFactory<Minecraft, IntegratedServer> | @@ -129,7 +129,7 @@ class ObjectFactoryClient implements ObjectFactory<Minecraft, IntegratedServer> | ||
129 | if (this.serverPluginChannels == null) | 129 | if (this.serverPluginChannels == null) |
130 | { | 130 | { |
131 | this.serverPluginChannels = new ServerPluginChannels(); | 131 | this.serverPluginChannels = new ServerPluginChannels(); |
132 | - } | 132 | + } |
133 | 133 | ||
134 | return this.serverPluginChannels; | 134 | return this.serverPluginChannels; |
135 | } | 135 | } |
src/client/java/com/mumfrey/liteloader/client/gui/GuiCheckbox.java
@@ -27,14 +27,23 @@ public class GuiCheckbox extends GuiButton | @@ -27,14 +27,23 @@ public class GuiCheckbox extends GuiButton | ||
27 | { | 27 | { |
28 | minecraft.getTextureManager().bindTexture(LiteLoaderBrandingProvider.ABOUT_TEXTURE); | 28 | minecraft.getTextureManager().bindTexture(LiteLoaderBrandingProvider.ABOUT_TEXTURE); |
29 | glColor4f(1.0F, 1.0F, 1.0F, 1.0F); | 29 | glColor4f(1.0F, 1.0F, 1.0F, 1.0F); |
30 | - this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; | 30 | + this.hovered = mouseX >= this.xPosition |
31 | + && mouseY >= this.yPosition | ||
32 | + && mouseX < this.xPosition + this.width | ||
33 | + && mouseY < this.yPosition + this.height; | ||
31 | 34 | ||
32 | this.drawTexturedModalRect(this.xPosition, this.yPosition, this.checked ? 134 : 122, 80, 12, 12); | 35 | this.drawTexturedModalRect(this.xPosition, this.yPosition, this.checked ? 134 : 122, 80, 12, 12); |
33 | this.mouseDragged(minecraft, mouseX, mouseY); | 36 | this.mouseDragged(minecraft, mouseX, mouseY); |
34 | 37 | ||
35 | int colour = 0xE0E0E0; | 38 | int colour = 0xE0E0E0; |
36 | - if (!this.enabled) colour = 0xA0A0A0; | ||
37 | - else if (this.hovered) colour = 0xFFFFA0; | 39 | + if (!this.enabled) |
40 | + { | ||
41 | + colour = 0xA0A0A0; | ||
42 | + } | ||
43 | + else if (this.hovered) | ||
44 | + { | ||
45 | + colour = 0xFFFFA0; | ||
46 | + } | ||
38 | 47 | ||
39 | this.drawString(minecraft.fontRendererObj, this.displayString, this.xPosition + 16, this.yPosition + 2, colour); | 48 | this.drawString(minecraft.fontRendererObj, this.displayString, this.xPosition + 16, this.yPosition + 2, colour); |
40 | } | 49 | } |
src/client/java/com/mumfrey/liteloader/client/gui/GuiHoverLabel.java
@@ -36,7 +36,10 @@ public class GuiHoverLabel extends GuiButton | @@ -36,7 +36,10 @@ public class GuiHoverLabel extends GuiButton | ||
36 | { | 36 | { |
37 | if (this.visible) | 37 | if (this.visible) |
38 | { | 38 | { |
39 | - this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; | 39 | + this.hovered = mouseX >= this.xPosition |
40 | + && mouseY >= this.yPosition | ||
41 | + && mouseX < this.xPosition + this.width | ||
42 | + && mouseY < this.yPosition + this.height; | ||
40 | this.fontRenderer.drawString(this.displayString, this.xPosition, this.yPosition, this.hovered ? this.hoverColour : this.colour); | 43 | this.fontRenderer.drawString(this.displayString, this.xPosition, this.yPosition, this.hovered ? this.hoverColour : this.colour); |
41 | } | 44 | } |
42 | else | 45 | else |
src/client/java/com/mumfrey/liteloader/client/gui/GuiLiteLoaderPanel.java
@@ -36,30 +36,45 @@ import com.mumfrey.liteloader.modconfig.ConfigPanel; | @@ -36,30 +36,45 @@ import com.mumfrey.liteloader.modconfig.ConfigPanel; | ||
36 | import com.mumfrey.liteloader.util.render.Icon; | 36 | import com.mumfrey.liteloader.util.render.Icon; |
37 | 37 | ||
38 | /** | 38 | /** |
39 | - * GUI screen which displays info about loaded mods and also allows them to be enabled and | ||
40 | - * disabled. An instance of this class is created every time the main menu is displayed and is | ||
41 | - * drawn as an overlay until the tab is clicked, at which point it becomes the active GUI screen | ||
42 | - * and draws the parent main menu screen as its background to give the appearance of being | ||
43 | - * overlaid on the main menu. | 39 | + * GUI screen which displays info about loaded mods and also allows them to be |
40 | + * enabled and disabled. An instance of this class is created every time the | ||
41 | + * main menu is displayed and is drawn as an overlay until the tab is clicked, | ||
42 | + * at which point it becomes the active GUI screen and draws the parent main | ||
43 | + * menu screen as its background to give the appearance of being overlaid on the | ||
44 | + * main menu. | ||
44 | * | 45 | * |
45 | * @author Adam Mummery-Smith | 46 | * @author Adam Mummery-Smith |
46 | */ | 47 | */ |
47 | public class GuiLiteLoaderPanel extends GuiScreen | 48 | public class GuiLiteLoaderPanel extends GuiScreen |
48 | { | 49 | { |
49 | - static final int LEFT_EDGE = 80; | ||
50 | - static final int MARGIN = 12; | ||
51 | - static final int TAB_WIDTH = 20; | ||
52 | - static final int TAB_HEIGHT = 40; | ||
53 | - static final int TAB_TOP = 20; | ||
54 | - static final int PANEL_TOP = 83; | ||
55 | - static final int PANEL_BOTTOM = 26; | 50 | + static final int WHITE = 0xFFFFFFFF; |
51 | + static final int OPAQUE = 0xFF000000; | ||
52 | + static final int NOTIFICATION_TOOLTIP_FOREGROUND = 0xFFFFFF; | ||
53 | + static final int NOTIFICATION_TOOLTIP_BACKGROUND = 0xB0000099; | ||
54 | + static final int ERROR_TOOLTIP_FOREGROUND = 0xFF5555; | ||
55 | + static final int ERROR_TOOLTIP_BACKGROUND = 0xB0330000; | ||
56 | + static final int HEADER_HR_COLOUR = 0xFF999999; | ||
57 | + static final int HEADER_TEXT_COLOUR = GuiLiteLoaderPanel.WHITE; | ||
58 | + static final int HEADER_TEXT_COLOUR_SUB = 0xFFAAAAAA; | ||
59 | + static final int TOOLTIP_FOREGROUND = 0xFFFFFF; | ||
60 | + static final int TOOLTIP_FOREGROUND_SUB = 0xCCCCCC; | ||
61 | + static final int TOOLTIP_BACKGROUND = 0xB0000000; | ||
62 | + | ||
63 | + static final int LEFT_EDGE = 80; | ||
64 | + static final int MARGIN = 12; | ||
65 | + static final int TAB_WIDTH = 20; | ||
66 | + static final int TAB_HEIGHT = 40; | ||
67 | + static final int TAB_TOP = 20; | ||
68 | + static final int PANEL_TOP = 83; | ||
69 | + static final int PANEL_BOTTOM = 26; | ||
56 | 70 | ||
57 | private static final double TWEEN_RATE = 0.08; | 71 | private static final double TWEEN_RATE = 0.08; |
58 | 72 | ||
59 | private static boolean displayErrorToolTip = true; | 73 | private static boolean displayErrorToolTip = true; |
60 | 74 | ||
61 | /** | 75 | /** |
62 | - * Reference to the main menu which this screen is either overlaying or using as its background | 76 | + * Reference to the main menu which this screen is either overlaying or |
77 | + * using as its background. | ||
63 | */ | 78 | */ |
64 | private GuiScreen parentScreen; | 79 | private GuiScreen parentScreen; |
65 | 80 | ||
@@ -84,7 +99,8 @@ public class GuiLiteLoaderPanel extends GuiScreen | @@ -84,7 +99,8 @@ public class GuiLiteLoaderPanel extends GuiScreen | ||
84 | private double tweenAmount = 0.0; | 99 | private double tweenAmount = 0.0; |
85 | 100 | ||
86 | /** | 101 | /** |
87 | - * Since we don't get real mouse events we have to simulate them by tracking the mouse state | 102 | + * Since we don't get real mouse events we have to simulate them by tracking |
103 | + * the mouse state. | ||
88 | */ | 104 | */ |
89 | private boolean mouseDown, toggled, toggleable; | 105 | private boolean mouseDown, toggled, toggleable; |
90 | 106 | ||
@@ -131,7 +147,8 @@ public class GuiLiteLoaderPanel extends GuiScreen | @@ -131,7 +147,8 @@ public class GuiLiteLoaderPanel extends GuiScreen | ||
131 | * @param parentScreen | 147 | * @param parentScreen |
132 | * @param mods | 148 | * @param mods |
133 | */ | 149 | */ |
134 | - public GuiLiteLoaderPanel(Minecraft minecraft, GuiScreen parentScreen, LiteLoaderMods mods, LoaderEnvironment environment, LoaderProperties properties, ConfigManager configManager, boolean showTab) | 150 | + public GuiLiteLoaderPanel(Minecraft minecraft, GuiScreen parentScreen, LiteLoaderMods mods, LoaderEnvironment environment, |
151 | + LoaderProperties properties, ConfigManager configManager, boolean showTab) | ||
135 | { | 152 | { |
136 | this.mc = minecraft; | 153 | this.mc = minecraft; |
137 | this.fontRendererObj = minecraft.fontRendererObj; | 154 | this.fontRendererObj = minecraft.fontRendererObj; |
@@ -148,7 +165,8 @@ public class GuiLiteLoaderPanel extends GuiScreen | @@ -148,7 +165,8 @@ public class GuiLiteLoaderPanel extends GuiScreen | ||
148 | 165 | ||
149 | this.initBranding(); | 166 | this.initBranding(); |
150 | 167 | ||
151 | - this.currentPanel = this.modsPanel = new GuiPanelMods(this, minecraft, mods, environment, configManager, this.brandColour, this.modInfoDecorators); | 168 | + this.currentPanel = this.modsPanel = new GuiPanelMods(this, minecraft, mods, environment, configManager, |
169 | + this.brandColour, this.modInfoDecorators); | ||
152 | this.settingsPanel = new GuiPanelSettings(this, minecraft); | 170 | this.settingsPanel = new GuiPanelSettings(this, minecraft); |
153 | 171 | ||
154 | this.startupErrorCount = mods.getStartupErrorCount(); | 172 | this.startupErrorCount = mods.getStartupErrorCount(); |
@@ -181,7 +199,7 @@ public class GuiLiteLoaderPanel extends GuiScreen | @@ -181,7 +199,7 @@ public class GuiLiteLoaderPanel extends GuiScreen | ||
181 | if (brandingProvider.getBrandingColour() != 0 && brandingProvider.getPriority() > brandingColourProviderPriority) | 199 | if (brandingProvider.getBrandingColour() != 0 && brandingProvider.getPriority() > brandingColourProviderPriority) |
182 | { | 200 | { |
183 | brandingColourProviderPriority = brandingProvider.getPriority(); | 201 | brandingColourProviderPriority = brandingProvider.getPriority(); |
184 | - this.brandColour = 0xFF000000 | brandingProvider.getBrandingColour(); | 202 | + this.brandColour = GuiLiteLoaderPanel.OPAQUE | brandingProvider.getBrandingColour(); |
185 | } | 203 | } |
186 | 204 | ||
187 | ResourceLocation logoResource = brandingProvider.getLogoResource(); | 205 | ResourceLocation logoResource = brandingProvider.getLogoResource(); |
@@ -271,11 +289,13 @@ public class GuiLiteLoaderPanel extends GuiScreen | @@ -271,11 +289,13 @@ public class GuiLiteLoaderPanel extends GuiScreen | ||
271 | 289 | ||
272 | this.currentPanel.setSize(this.width - LEFT_EDGE, this.height); | 290 | this.currentPanel.setSize(this.width - LEFT_EDGE, this.height); |
273 | 291 | ||
274 | - this.buttonList.add(new GuiHoverLabel(2, LEFT_EDGE + MARGIN, this.height - PANEL_BOTTOM + 9, this.fontRendererObj, I18n.format("gui.about.taboptions"), this.brandColour)); | 292 | + this.buttonList.add(new GuiHoverLabel(2, LEFT_EDGE + MARGIN, this.height - PANEL_BOTTOM + 9, this.fontRendererObj, |
293 | + I18n.format("gui.about.taboptions"), this.brandColour)); | ||
275 | 294 | ||
276 | if (LiteLoaderVersion.getUpdateSite().canCheckForUpdate() && this.mc.theWorld == null && !this.isSnapshot) | 295 | if (LiteLoaderVersion.getUpdateSite().canCheckForUpdate() && this.mc.theWorld == null && !this.isSnapshot) |
277 | { | 296 | { |
278 | - this.buttonList.add(new GuiHoverLabel(3, LEFT_EDGE + MARGIN + 38 + this.fontRendererObj.getStringWidth(this.versionText) + 6, 50, this.fontRendererObj, I18n.format("gui.about.checkupdates"), this.brandColour)); | 297 | + this.buttonList.add(new GuiHoverLabel(3, LEFT_EDGE + MARGIN + 38 + this.fontRendererObj.getStringWidth(this.versionText) + 6, 50, |
298 | + this.fontRendererObj, I18n.format("gui.about.checkupdates"), this.brandColour)); | ||
279 | } | 299 | } |
280 | 300 | ||
281 | Keyboard.enableRepeatEvents(true); | 301 | Keyboard.enableRepeatEvents(true); |
@@ -288,7 +308,8 @@ public class GuiLiteLoaderPanel extends GuiScreen | @@ -288,7 +308,8 @@ public class GuiLiteLoaderPanel extends GuiScreen | ||
288 | } | 308 | } |
289 | 309 | ||
290 | /* (non-Javadoc) | 310 | /* (non-Javadoc) |
291 | - * @see net.minecraft.client.gui.GuiScreen#setWorldAndResolution(net.minecraft.client.Minecraft, int, int) | 311 | + * @see net.minecraft.client.gui.GuiScreen |
312 | + * #setWorldAndResolution(net.minecraft.client.Minecraft, int, int) | ||
292 | */ | 313 | */ |
293 | @Override | 314 | @Override |
294 | public void setWorldAndResolution(Minecraft minecraft, int width, int height) | 315 | public void setWorldAndResolution(Minecraft minecraft, int width, int height) |
@@ -363,11 +384,15 @@ public class GuiLiteLoaderPanel extends GuiScreen | @@ -363,11 +384,15 @@ public class GuiLiteLoaderPanel extends GuiScreen | ||
363 | int offsetMouseX = mouseX - (int)xOffset; | 384 | int offsetMouseX = mouseX - (int)xOffset; |
364 | 385 | ||
365 | // Handle mouse stuff here since we won't get mouse events when not the active GUI | 386 | // Handle mouse stuff here since we won't get mouse events when not the active GUI |
366 | - boolean mouseOverTab = this.showTab && (offsetMouseX > LEFT_EDGE - TAB_WIDTH && offsetMouseX < LEFT_EDGE && mouseY > TAB_TOP && mouseY < TAB_TOP + TAB_HEIGHT); | 387 | + boolean mouseOverTab = this.showTab && (offsetMouseX > LEFT_EDGE - TAB_WIDTH |
388 | + && offsetMouseX < LEFT_EDGE | ||
389 | + && mouseY > TAB_TOP | ||
390 | + && mouseY < TAB_TOP + TAB_HEIGHT); | ||
367 | this.handleMouseClick(offsetMouseX, mouseY, partialTicks, active, mouseOverTab); | 391 | this.handleMouseClick(offsetMouseX, mouseY, partialTicks, active, mouseOverTab); |
368 | 392 | ||
369 | // Calculate the tab opacity, not framerate adjusted because we don't really care | 393 | // Calculate the tab opacity, not framerate adjusted because we don't really care |
370 | - this.tabOpacity = mouseOverTab || alwaysExpandTab || this.startupErrorCount > 0 || this.notification != null || this.isOpen() ? 0.5F : Math.max(0.0F, this.tabOpacity - partialTicks * 0.1F); | 394 | + this.tabOpacity = mouseOverTab || alwaysExpandTab || this.startupErrorCount > 0 || this.notification != null |
395 | + || this.isOpen() ? 0.5F : Math.max(0.0F, this.tabOpacity - partialTicks * 0.1F); | ||
371 | 396 | ||
372 | // Draw the panel contents | 397 | // Draw the panel contents |
373 | this.drawPanel(offsetMouseX, mouseY, partialTicks, active, xOffset); | 398 | this.drawPanel(offsetMouseX, mouseY, partialTicks, active, xOffset); |
@@ -391,12 +416,12 @@ public class GuiLiteLoaderPanel extends GuiScreen | @@ -391,12 +416,12 @@ public class GuiLiteLoaderPanel extends GuiScreen | ||
391 | glTranslatef(xOffset, 0.0F, 0.0F); | 416 | glTranslatef(xOffset, 0.0F, 0.0F); |
392 | 417 | ||
393 | // Draw the background and left edge | 418 | // Draw the background and left edge |
394 | - drawRect(LEFT_EDGE, 0, this.width, this.height, 0xB0000000); | 419 | + drawRect(LEFT_EDGE, 0, this.width, this.height, GuiLiteLoaderPanel.TOOLTIP_BACKGROUND); |
395 | 420 | ||
396 | if (this.showTab) | 421 | if (this.showTab) |
397 | { | 422 | { |
398 | - drawRect(LEFT_EDGE, 0, LEFT_EDGE + 1, TAB_TOP, 0xFFFFFFFF); | ||
399 | - drawRect(LEFT_EDGE, TAB_TOP + TAB_HEIGHT, LEFT_EDGE + 1, this.height, 0xFFFFFFFF); | 423 | + drawRect(LEFT_EDGE, 0, LEFT_EDGE + 1, TAB_TOP, GuiLiteLoaderPanel.WHITE); |
424 | + drawRect(LEFT_EDGE, TAB_TOP + TAB_HEIGHT, LEFT_EDGE + 1, this.height, GuiLiteLoaderPanel.WHITE); | ||
400 | 425 | ||
401 | this.mc.getTextureManager().bindTexture(LiteLoaderBrandingProvider.ABOUT_TEXTURE); | 426 | this.mc.getTextureManager().bindTexture(LiteLoaderBrandingProvider.ABOUT_TEXTURE); |
402 | glDrawTexturedRect(LEFT_EDGE - TAB_WIDTH, TAB_TOP, TAB_WIDTH + 1, TAB_HEIGHT, 80, 80, 122, 160, 0.5F + this.tabOpacity); | 427 | glDrawTexturedRect(LEFT_EDGE - TAB_WIDTH, TAB_TOP, TAB_WIDTH + 1, TAB_HEIGHT, 80, 80, 122, 160, 0.5F + this.tabOpacity); |
@@ -411,7 +436,7 @@ public class GuiLiteLoaderPanel extends GuiScreen | @@ -411,7 +436,7 @@ public class GuiLiteLoaderPanel extends GuiScreen | ||
411 | } | 436 | } |
412 | else | 437 | else |
413 | { | 438 | { |
414 | - drawRect(LEFT_EDGE, 0, LEFT_EDGE + 1, this.height, 0xFFFFFFFF); | 439 | + drawRect(LEFT_EDGE, 0, LEFT_EDGE + 1, this.height, GuiLiteLoaderPanel.WHITE); |
415 | } | 440 | } |
416 | 441 | ||
417 | // Only draw the panel contents if we are actually open | 442 | // Only draw the panel contents if we are actually open |
@@ -470,14 +495,15 @@ public class GuiLiteLoaderPanel extends GuiScreen | @@ -470,14 +495,15 @@ public class GuiLiteLoaderPanel extends GuiScreen | ||
470 | glDrawTexturedRect(right - this.iconCoords.getIconWidth(), MARGIN, this.iconCoords, 1.0F); | 495 | glDrawTexturedRect(right - this.iconCoords.getIconWidth(), MARGIN, this.iconCoords, 1.0F); |
471 | 496 | ||
472 | // Draw header text | 497 | // Draw header text |
473 | - this.fontRendererObj.drawString(this.versionText, left + 38, 50, 0xFFFFFFFF); | ||
474 | - this.fontRendererObj.drawString(this.activeModText, left + 38, 60, 0xFFAAAAAA); | 498 | + this.fontRendererObj.drawString(this.versionText, left + 38, 50, GuiLiteLoaderPanel.HEADER_TEXT_COLOUR); |
499 | + this.fontRendererObj.drawString(this.activeModText, left + 38, 60, GuiLiteLoaderPanel.HEADER_TEXT_COLOUR_SUB); | ||
475 | 500 | ||
476 | // Draw top and bottom horizontal rules | 501 | // Draw top and bottom horizontal rules |
477 | - drawRect(left, 80, right, 81, 0xFF999999); | ||
478 | - drawRect(left, this.height - bottom + 2, right, this.height - bottom + 3, 0xFF999999); | 502 | + drawRect(left, 80, right, 81, GuiLiteLoaderPanel.HEADER_HR_COLOUR); |
503 | + drawRect(left, this.height - bottom + 2, right, this.height - bottom + 3, GuiLiteLoaderPanel.HEADER_HR_COLOUR); | ||
479 | 504 | ||
480 | - this.mouseOverLogo = (mouseY > MARGIN && mouseY < MARGIN + this.logoCoords.getIconHeight() && mouseX > left && mouseX < left + this.logoCoords.getIconWidth()); | 505 | + this.mouseOverLogo = (mouseY > MARGIN && mouseY < MARGIN + this.logoCoords.getIconHeight() |
506 | + && mouseX > left && mouseX < left + this.logoCoords.getIconWidth()); | ||
481 | return this.mouseOverLogo; | 507 | return this.mouseOverLogo; |
482 | } | 508 | } |
483 | 509 | ||
@@ -487,8 +513,10 @@ public class GuiLiteLoaderPanel extends GuiScreen | @@ -487,8 +513,10 @@ public class GuiLiteLoaderPanel extends GuiScreen | ||
487 | 513 | ||
488 | if (mouseOverTab && this.tweenAmount < 0.01) | 514 | if (mouseOverTab && this.tweenAmount < 0.01) |
489 | { | 515 | { |
490 | - GuiLiteLoaderPanel.drawTooltip(this.fontRendererObj, LiteLoader.getVersionDisplayString(), mouseX, mouseY, this.width, this.height, 0xFFFFFF, 0xB0000000); | ||
491 | - GuiLiteLoaderPanel.drawTooltip(this.fontRendererObj, this.activeModText, mouseX, mouseY + 13, this.width, this.height, 0xCCCCCC, 0xB0000000); | 516 | + GuiLiteLoaderPanel.drawTooltip(this.fontRendererObj, LiteLoader.getVersionDisplayString(), mouseX, mouseY, this.width, this.height, |
517 | + GuiLiteLoaderPanel.TOOLTIP_FOREGROUND, GuiLiteLoaderPanel.TOOLTIP_BACKGROUND); | ||
518 | + GuiLiteLoaderPanel.drawTooltip(this.fontRendererObj, this.activeModText, mouseX, mouseY + 13, this.width, this.height, | ||
519 | + GuiLiteLoaderPanel.TOOLTIP_FOREGROUND_SUB, GuiLiteLoaderPanel.TOOLTIP_BACKGROUND); | ||
492 | 520 | ||
493 | if (annoyingTip) | 521 | if (annoyingTip) |
494 | { | 522 | { |
@@ -505,16 +533,19 @@ public class GuiLiteLoaderPanel extends GuiScreen | @@ -505,16 +533,19 @@ public class GuiLiteLoaderPanel extends GuiScreen | ||
505 | { | 533 | { |
506 | if (this.startupErrorCount > 0) | 534 | if (this.startupErrorCount > 0) |
507 | { | 535 | { |
508 | - GuiLiteLoaderPanel.drawTooltip(this.fontRendererObj, I18n.format("gui.error.tooltip", this.startupErrorCount, this.criticalErrorCount), left, top, this.width, this.height, 0xFF5555, 0xB0330000); | 536 | + GuiLiteLoaderPanel.drawTooltip(this.fontRendererObj, I18n.format("gui.error.tooltip", this.startupErrorCount, this.criticalErrorCount), |
537 | + left, top, this.width, this.height, GuiLiteLoaderPanel.ERROR_TOOLTIP_FOREGROUND, GuiLiteLoaderPanel.ERROR_TOOLTIP_BACKGROUND); | ||
509 | } | 538 | } |
510 | else if (this.notification != null) | 539 | else if (this.notification != null) |
511 | { | 540 | { |
512 | - GuiLiteLoaderPanel.drawTooltip(this.fontRendererObj, this.notification, left, top, this.width, this.height, 0xFFFFFF, 0xB0000099); | 541 | + GuiLiteLoaderPanel.drawTooltip(this.fontRendererObj, this.notification, left, top, this.width, this.height, |
542 | + GuiLiteLoaderPanel.NOTIFICATION_TOOLTIP_FOREGROUND, GuiLiteLoaderPanel.NOTIFICATION_TOOLTIP_BACKGROUND); | ||
513 | } | 543 | } |
514 | } | 544 | } |
515 | 545 | ||
516 | /* (non-Javadoc) | 546 | /* (non-Javadoc) |
517 | - * @see net.minecraft.client.gui.GuiScreen#actionPerformed(net.minecraft.client.gui.GuiButton) | 547 | + * @see net.minecraft.client.gui.GuiScreen |
548 | + * #actionPerformed(net.minecraft.client.gui.GuiButton) | ||
518 | */ | 549 | */ |
519 | @Override | 550 | @Override |
520 | protected void actionPerformed(GuiButton button) | 551 | protected void actionPerformed(GuiButton button) |
@@ -586,9 +617,13 @@ public class GuiLiteLoaderPanel extends GuiScreen | @@ -586,9 +617,13 @@ public class GuiLiteLoaderPanel extends GuiScreen | ||
586 | protected void mouseReleased(int mouseX, int mouseY, int button) | 617 | protected void mouseReleased(int mouseX, int mouseY, int button) |
587 | { | 618 | { |
588 | if (button == -1) | 619 | if (button == -1) |
620 | + { | ||
589 | this.currentPanel.mouseMoved(mouseX - LEFT_EDGE, mouseY); | 621 | this.currentPanel.mouseMoved(mouseX - LEFT_EDGE, mouseY); |
622 | + } | ||
590 | else | 623 | else |
624 | + { | ||
591 | this.currentPanel.mouseReleased(mouseX - LEFT_EDGE, mouseY, button); | 625 | this.currentPanel.mouseReleased(mouseX - LEFT_EDGE, mouseY, button); |
626 | + } | ||
592 | 627 | ||
593 | if (!this.currentPanel.stealFocus()) | 628 | if (!this.currentPanel.stealFocus()) |
594 | { | 629 | { |
@@ -661,7 +696,8 @@ public class GuiLiteLoaderPanel extends GuiScreen | @@ -661,7 +696,8 @@ public class GuiLiteLoaderPanel extends GuiScreen | ||
661 | } | 696 | } |
662 | 697 | ||
663 | /** | 698 | /** |
664 | - * Callback for the "config" button, display the config panel for the currently selected mod | 699 | + * Callback for the "config" button, display the config panel for the |
700 | + * currently selected mod. | ||
665 | */ | 701 | */ |
666 | void openConfigPanel(ConfigPanel panel, LiteMod mod) | 702 | void openConfigPanel(ConfigPanel panel, LiteMod mod) |
667 | { | 703 | { |
@@ -694,7 +730,8 @@ public class GuiLiteLoaderPanel extends GuiScreen | @@ -694,7 +730,8 @@ public class GuiLiteLoaderPanel extends GuiScreen | ||
694 | } | 730 | } |
695 | 731 | ||
696 | /** | 732 | /** |
697 | - * Draw a tooltip at the specified location and clip to screenWidth and screenHeight | 733 | + * Draw a tooltip at the specified location and clip to screenWidth and |
734 | + * screenHeight | ||
698 | * | 735 | * |
699 | * @param fontRenderer | 736 | * @param fontRenderer |
700 | * @param tooltipText | 737 | * @param tooltipText |
@@ -705,13 +742,14 @@ public class GuiLiteLoaderPanel extends GuiScreen | @@ -705,13 +742,14 @@ public class GuiLiteLoaderPanel extends GuiScreen | ||
705 | * @param colour | 742 | * @param colour |
706 | * @param backgroundColour | 743 | * @param backgroundColour |
707 | */ | 744 | */ |
708 | - public static void drawTooltip(FontRenderer fontRenderer, String tooltipText, int mouseX, int mouseY, int screenWidth, int screenHeight, int colour, int backgroundColour) | 745 | + public static void drawTooltip(FontRenderer fontRenderer, String tooltipText, int mouseX, int mouseY, int screenWidth, int screenHeight, |
746 | + int colour, int backgroundColour) | ||
709 | { | 747 | { |
710 | int textSize = fontRenderer.getStringWidth(tooltipText); | 748 | int textSize = fontRenderer.getStringWidth(tooltipText); |
711 | mouseX = Math.max(0, Math.min(screenWidth - 4, mouseX - 4)); | 749 | mouseX = Math.max(0, Math.min(screenWidth - 4, mouseX - 4)); |
712 | mouseY = Math.max(0, Math.min(screenHeight - 16, mouseY)); | 750 | mouseY = Math.max(0, Math.min(screenHeight - 16, mouseY)); |
713 | drawRect(mouseX - textSize - 2, mouseY, mouseX + 2, mouseY + 12, backgroundColour); | 751 | drawRect(mouseX - textSize - 2, mouseY, mouseX + 2, mouseY + 12, backgroundColour); |
714 | - fontRenderer.drawStringWithShadow(tooltipText, mouseX - textSize, mouseY + 2, colour); // TODO OBF MCPTEST drawStringWithShadow - func_175063_a | 752 | + fontRenderer.drawStringWithShadow(tooltipText, mouseX - textSize, mouseY + 2, colour); |
715 | } | 753 | } |
716 | 754 | ||
717 | 755 |
src/client/java/com/mumfrey/liteloader/client/gui/GuiPanelAbout.java
@@ -23,13 +23,15 @@ import com.mumfrey.liteloader.util.SortableValue; | @@ -23,13 +23,15 @@ import com.mumfrey.liteloader.util.SortableValue; | ||
23 | import com.mumfrey.liteloader.util.render.Icon; | 23 | import com.mumfrey.liteloader.util.render.Icon; |
24 | 24 | ||
25 | /** | 25 | /** |
26 | - * "About LiteLoader" panel which docks in the mod info screen and lists information about the installed APIs | 26 | + * "About LiteLoader" panel which docks in the mod info screen and lists |
27 | + * information about the installed APIs. | ||
27 | * | 28 | * |
28 | * @author Adam Mummery-Smith | 29 | * @author Adam Mummery-Smith |
29 | */ | 30 | */ |
30 | class GuiPanelAbout extends GuiPanel implements ScrollPanelContent | 31 | class GuiPanelAbout extends GuiPanel implements ScrollPanelContent |
31 | { | 32 | { |
32 | - public static final IconAbsolute apiIconCoords = new IconAbsolute(LiteLoaderBrandingProvider.ABOUT_TEXTURE, "api_icon", 32, 32, 192, 144, 256, 208); | 33 | + public static final IconAbsolute apiIconCoords = new IconAbsolute(LiteLoaderBrandingProvider.ABOUT_TEXTURE, "api_icon", |
34 | + 32, 32, 192, 144, 256, 208); | ||
33 | 35 | ||
34 | private static final int ROW_HEIGHT = 40; | 36 | private static final int ROW_HEIGHT = 40; |
35 | 37 | ||
@@ -51,7 +53,8 @@ class GuiPanelAbout extends GuiPanel implements ScrollPanelContent | @@ -51,7 +53,8 @@ class GuiPanelAbout extends GuiPanel implements ScrollPanelContent | ||
51 | 53 | ||
52 | this.sortBrandingProviders(); | 54 | this.sortBrandingProviders(); |
53 | 55 | ||
54 | - this.scrollPane.addControl(new GuiHoverLabel(-2, 38, 22 + this.brandings.size() * GuiPanelAbout.ROW_HEIGHT, this.mc.fontRendererObj, "\247n" + MCP_URI.toString(), this.parent.getBrandColour())); | 56 | + this.scrollPane.addControl(new GuiHoverLabel(-2, 38, 22 + this.brandings.size() * GuiPanelAbout.ROW_HEIGHT, this.mc.fontRendererObj, |
57 | + "\247n" + MCP_URI.toString(), this.parent.getBrandColour())); | ||
55 | } | 58 | } |
56 | 59 | ||
57 | /** | 60 | /** |
@@ -66,9 +69,10 @@ class GuiPanelAbout extends GuiPanel implements ScrollPanelContent | @@ -66,9 +69,10 @@ class GuiPanelAbout extends GuiPanel implements ScrollPanelContent | ||
66 | BrandingProvider brandingProvider = LiteLoader.getCustomisationProvider(api, BrandingProvider.class); | 69 | BrandingProvider brandingProvider = LiteLoader.getCustomisationProvider(api, BrandingProvider.class); |
67 | if (brandingProvider != null) | 70 | if (brandingProvider != null) |
68 | { | 71 | { |
69 | - sortedBrandingProviders.add(new SortableValue<BrandingProvider>(Integer.MAX_VALUE - brandingProvider.getPriority(), 0, brandingProvider)); | 72 | + sortedBrandingProviders.add(new SortableValue<BrandingProvider>(Integer.MAX_VALUE - brandingProvider.getPriority(), 0, |
73 | + brandingProvider)); | ||
70 | } | 74 | } |
71 | - } | 75 | + } |
72 | 76 | ||
73 | int brandingIndex = 0; | 77 | int brandingIndex = 0; |
74 | 78 | ||
@@ -80,7 +84,8 @@ class GuiPanelAbout extends GuiPanel implements ScrollPanelContent | @@ -80,7 +84,8 @@ class GuiPanelAbout extends GuiPanel implements ScrollPanelContent | ||
80 | URI homepage = brandingProvider.getHomepage(); | 84 | URI homepage = brandingProvider.getHomepage(); |
81 | if (homepage != null) | 85 | if (homepage != null) |
82 | { | 86 | { |
83 | - this.scrollPane.addControl(new GuiHoverLabel(brandingIndex, 38, 22 + brandingIndex * GuiPanelAbout.ROW_HEIGHT, this.mc.fontRendererObj, "\247n" + homepage, this.parent.getBrandColour())); | 87 | + this.scrollPane.addControl(new GuiHoverLabel(brandingIndex, 38, 22 + brandingIndex * GuiPanelAbout.ROW_HEIGHT, |
88 | + this.mc.fontRendererObj, "\247n" + homepage, this.parent.getBrandColour())); | ||
84 | } | 89 | } |
85 | 90 | ||
86 | brandingIndex++; | 91 | brandingIndex++; |
src/client/java/com/mumfrey/liteloader/client/gui/GuiPanelConfigContainer.java
@@ -11,8 +11,9 @@ import com.mumfrey.liteloader.modconfig.ConfigPanel; | @@ -11,8 +11,9 @@ import com.mumfrey.liteloader.modconfig.ConfigPanel; | ||
11 | import com.mumfrey.liteloader.modconfig.ConfigPanelHost; | 11 | import com.mumfrey.liteloader.modconfig.ConfigPanelHost; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | - * Config panel container, this handles drawing the configuration panel chrome and also hosts the | ||
15 | - * configuration panels themselves to support scrolling and stuff | 14 | + * Config panel container, this handles drawing the configuration panel chrome |
15 | + * and also hosts the configuration panels themselves to support scrolling and | ||
16 | + * stuff. | ||
16 | * | 17 | * |
17 | * @author Adam Mummery-Smith | 18 | * @author Adam Mummery-Smith |
18 | */ | 19 | */ |
@@ -186,7 +187,8 @@ class GuiPanelConfigContainer extends GuiPanel implements ConfigPanelHost | @@ -186,7 +187,8 @@ class GuiPanelConfigContainer extends GuiPanel implements ConfigPanelHost | ||
186 | 187 | ||
187 | // Update and draw scroll bar | 188 | // Update and draw scroll bar |
188 | this.scrollBar.setMaxValue(this.totalHeight - this.innerHeight); | 189 | this.scrollBar.setMaxValue(this.totalHeight - this.innerHeight); |
189 | - this.scrollBar.drawScrollBar(mouseX, mouseY, partialTicks, this.width - MARGIN - 5, TOP, 5, this.innerHeight, Math.max(this.innerHeight, this.totalHeight)); | 190 | + this.scrollBar.drawScrollBar(mouseX, mouseY, partialTicks, this.width - MARGIN - 5, TOP, 5, this.innerHeight, |
191 | + Math.max(this.innerHeight, this.totalHeight)); | ||
190 | 192 | ||
191 | // Draw other buttons | 193 | // Draw other buttons |
192 | super.draw(mouseX, mouseY, partialTicks); | 194 | super.draw(mouseX, mouseY, partialTicks); |
@@ -221,7 +223,9 @@ class GuiPanelConfigContainer extends GuiPanel implements ConfigPanelHost | @@ -221,7 +223,9 @@ class GuiPanelConfigContainer extends GuiPanel implements ConfigPanelHost | ||
221 | if (mouseButton == 0) | 223 | if (mouseButton == 0) |
222 | { | 224 | { |
223 | if (this.scrollBar.wasMouseOver()) | 225 | if (this.scrollBar.wasMouseOver()) |
226 | + { | ||
224 | this.scrollBar.setDragging(true); | 227 | this.scrollBar.setDragging(true); |
228 | + } | ||
225 | } | 229 | } |
226 | 230 | ||
227 | super.mousePressed(mouseX, mouseY, mouseButton); | 231 | super.mousePressed(mouseX, mouseY, mouseButton); |
src/client/java/com/mumfrey/liteloader/client/gui/GuiPanelLiteLoaderLog.java
@@ -89,9 +89,12 @@ class GuiPanelLiteLoaderLog extends GuiPanel implements ScrollPanelContent | @@ -89,9 +89,12 @@ class GuiPanelLiteLoaderLog extends GuiPanel implements ScrollPanelContent | ||
89 | { | 89 | { |
90 | super.setSize(width, height); | 90 | super.setSize(width, height); |
91 | 91 | ||
92 | - this.controls.add(new GuiButton(0, this.width - 59 - MARGIN, this.height - BOTTOM + 9, 60, 20, I18n.format("gui.done"))); | ||
93 | - this.controls.add(this.btnUpload = new GuiButton(1, this.width - 145 - MARGIN, this.height - BOTTOM + 9, 80, 20, I18n.format("gui.log.postlog"))); | ||
94 | - this.controls.add(this.chkScale = new GuiCheckbox(2, MARGIN, this.height - BOTTOM + 15, I18n.format("gui.log.scalecheckbox"))); | 92 | + this.controls.add(new GuiButton(0, this.width - 59 - MARGIN, this.height - BOTTOM + 9, 60, 20, |
93 | + I18n.format("gui.done"))); | ||
94 | + this.controls.add(this.btnUpload = new GuiButton(1, this.width - 145 - MARGIN, this.height - BOTTOM + 9, 80, 20, | ||
95 | + I18n.format("gui.log.postlog"))); | ||
96 | + this.controls.add(this.chkScale = new GuiCheckbox(2, MARGIN, this.height - BOTTOM + 15, | ||
97 | + I18n.format("gui.log.scalecheckbox"))); | ||
95 | 98 | ||
96 | this.chkScale.checked = GuiPanelLiteLoaderLog.useNativeRes; | 99 | this.chkScale.checked = GuiPanelLiteLoaderLog.useNativeRes; |
97 | 100 | ||
@@ -142,7 +145,8 @@ class GuiPanelLiteLoaderLog extends GuiPanel implements ScrollPanelContent | @@ -142,7 +145,8 @@ class GuiPanelLiteLoaderLog extends GuiPanel implements ScrollPanelContent | ||
142 | { | 145 | { |
143 | LiteLoaderLogger.info("Log file upload succeeded, url is %s", this.logURL); | 146 | LiteLoaderLogger.info("Log file upload succeeded, url is %s", this.logURL); |
144 | int urlWidth = this.mc.fontRendererObj.getStringWidth(this.logURL); | 147 | int urlWidth = this.mc.fontRendererObj.getStringWidth(this.logURL); |
145 | - this.controls.add(new GuiHoverLabel(3, xMid - (urlWidth / 2), this.height / 2, this.mc.fontRendererObj, "\247n" + this.logURL, this.parent.getBrandColour())); | 148 | + this.controls.add(new GuiHoverLabel(3, xMid - (urlWidth / 2), this.height / 2, this.mc.fontRendererObj, "\247n" + this.logURL, |
149 | + this.parent.getBrandColour())); | ||
146 | } | 150 | } |
147 | else | 151 | else |
148 | { | 152 | { |
src/client/java/com/mumfrey/liteloader/client/gui/GuiPanelMods.java
@@ -26,7 +26,7 @@ import com.mumfrey.liteloader.modconfig.ConfigPanel; | @@ -26,7 +26,7 @@ import com.mumfrey.liteloader.modconfig.ConfigPanel; | ||
26 | * @author Adam Mummery-Smith | 26 | * @author Adam Mummery-Smith |
27 | */ | 27 | */ |
28 | public class GuiPanelMods extends GuiPanel implements ModListContainer | 28 | public class GuiPanelMods extends GuiPanel implements ModListContainer |
29 | -{ | 29 | +{ |
30 | private static final int SCROLLBAR_WIDTH = 5; | 30 | private static final int SCROLLBAR_WIDTH = 5; |
31 | 31 | ||
32 | private final GuiLiteLoaderPanel parentScreen; | 32 | private final GuiLiteLoaderPanel parentScreen; |
@@ -58,7 +58,8 @@ public class GuiPanelMods extends GuiPanel implements ModListContainer | @@ -58,7 +58,8 @@ public class GuiPanelMods extends GuiPanel implements ModListContainer | ||
58 | */ | 58 | */ |
59 | private GuiSimpleScrollBar scrollBar = new GuiSimpleScrollBar(); | 59 | private GuiSimpleScrollBar scrollBar = new GuiSimpleScrollBar(); |
60 | 60 | ||
61 | - public GuiPanelMods(GuiLiteLoaderPanel parentScreen, Minecraft minecraft, LiteLoaderMods mods, LoaderEnvironment environment, ConfigManager configManager, int brandColour, List<ModInfoDecorator> decorators) | 61 | + public GuiPanelMods(GuiLiteLoaderPanel parentScreen, Minecraft minecraft, LiteLoaderMods mods, LoaderEnvironment environment, |
62 | + ConfigManager configManager, int brandColour, List<ModInfoDecorator> decorators) | ||
62 | { | 63 | { |
63 | super(minecraft); | 64 | super(minecraft); |
64 | 65 | ||
@@ -106,8 +107,10 @@ public class GuiPanelMods extends GuiPanel implements ModListContainer | @@ -106,8 +107,10 @@ public class GuiPanelMods extends GuiPanel implements ModListContainer | ||
106 | int rightPanelLeftEdge = MARGIN + 4 + (this.width - MARGIN - MARGIN - 4) / 2; | 107 | int rightPanelLeftEdge = MARGIN + 4 + (this.width - MARGIN - MARGIN - 4) / 2; |
107 | 108 | ||
108 | this.controls.clear(); | 109 | this.controls.clear(); |
109 | - this.controls.add(this.btnToggle = new GuiButton(0, rightPanelLeftEdge, this.height - GuiLiteLoaderPanel.PANEL_BOTTOM - 24, 90, 20, I18n.format("gui.enablemod"))); | ||
110 | - this.controls.add(this.btnConfig = new GuiButton(1, rightPanelLeftEdge + 92, this.height - GuiLiteLoaderPanel.PANEL_BOTTOM - 24, 69, 20, I18n.format("gui.modsettings"))); | 110 | + this.controls.add(this.btnToggle = new GuiButton(0, rightPanelLeftEdge, this.height - GuiLiteLoaderPanel.PANEL_BOTTOM - 24, 90, 20, |
111 | + I18n.format("gui.enablemod"))); | ||
112 | + this.controls.add(this.btnConfig = new GuiButton(1, rightPanelLeftEdge + 92, this.height - GuiLiteLoaderPanel.PANEL_BOTTOM - 24, 69, 20, | ||
113 | + I18n.format("gui.modsettings"))); | ||
111 | 114 | ||
112 | this.modList.setSize(width, height); | 115 | this.modList.setSize(width, height); |
113 | } | 116 | } |
@@ -252,7 +255,8 @@ public class GuiPanelMods extends GuiPanel implements ModListContainer | @@ -252,7 +255,8 @@ public class GuiPanelMods extends GuiPanel implements ModListContainer | ||
252 | */ | 255 | */ |
253 | private void drawModsList(int mouseX, int mouseY, float partialTicks, int width, int height) | 256 | private void drawModsList(int mouseX, int mouseY, float partialTicks, int width, int height) |
254 | { | 257 | { |
255 | - this.scrollBar.drawScrollBar(mouseX, mouseY, partialTicks, MARGIN + width - SCROLLBAR_WIDTH, GuiLiteLoaderPanel.PANEL_TOP, SCROLLBAR_WIDTH, height, this.listHeight); | 258 | + this.scrollBar.drawScrollBar(mouseX, mouseY, partialTicks, MARGIN + width - SCROLLBAR_WIDTH, GuiLiteLoaderPanel.PANEL_TOP, SCROLLBAR_WIDTH, |
259 | + height, this.listHeight); | ||
256 | 260 | ||
257 | // clip outside of scroll area | 261 | // clip outside of scroll area |
258 | glEnableClipping(MARGIN, MARGIN + width - SCROLLBAR_WIDTH - 1, GuiLiteLoaderPanel.PANEL_TOP, this.height - GuiLiteLoaderPanel.PANEL_BOTTOM); | 262 | glEnableClipping(MARGIN, MARGIN + width - SCROLLBAR_WIDTH - 1, GuiLiteLoaderPanel.PANEL_TOP, this.height - GuiLiteLoaderPanel.PANEL_BOTTOM); |
src/client/java/com/mumfrey/liteloader/client/gui/GuiPanelUpdateCheck.java
@@ -22,6 +22,8 @@ import com.mumfrey.liteloader.update.UpdateSite; | @@ -22,6 +22,8 @@ import com.mumfrey.liteloader.update.UpdateSite; | ||
22 | */ | 22 | */ |
23 | class GuiPanelUpdateCheck extends GuiPanel | 23 | class GuiPanelUpdateCheck extends GuiPanel |
24 | { | 24 | { |
25 | + private static final int WHITE = 0xFFFFFFFF; | ||
26 | + | ||
25 | /** | 27 | /** |
26 | * URI to open if a new version is available | 28 | * URI to open if a new version is available |
27 | */ | 29 | */ |
@@ -51,7 +53,8 @@ class GuiPanelUpdateCheck extends GuiPanel | @@ -51,7 +53,8 @@ class GuiPanelUpdateCheck extends GuiPanel | ||
51 | 53 | ||
52 | private boolean canForceUpdate, updateForced; | 54 | private boolean canForceUpdate, updateForced; |
53 | 55 | ||
54 | - public GuiPanelUpdateCheck(GuiLiteLoaderPanel parentScreen, Minecraft minecraft, UpdateSite updateSite, String updateName, LoaderProperties properties) | 56 | + public GuiPanelUpdateCheck(GuiLiteLoaderPanel parentScreen, Minecraft minecraft, UpdateSite updateSite, String updateName, |
57 | + LoaderProperties properties) | ||
55 | { | 58 | { |
56 | super(minecraft); | 59 | super(minecraft); |
57 | 60 | ||
@@ -67,9 +70,12 @@ class GuiPanelUpdateCheck extends GuiPanel | @@ -67,9 +70,12 @@ class GuiPanelUpdateCheck extends GuiPanel | ||
67 | { | 70 | { |
68 | super.setSize(width, height); | 71 | super.setSize(width, height); |
69 | 72 | ||
70 | - this.controls.add(new GuiButton(0, this.width - 99 - MARGIN, this.height - BOTTOM + 9, 100, 20, this.updateForced ? I18n.format("gui.exitgame") : I18n.format("gui.done"))); | ||
71 | - this.controls.add(this.btnCheck = new GuiButton(1, MARGIN + 16, TOP + 16, 100, 20, I18n.format("gui.checknow"))); | ||
72 | - this.controls.add(this.btnDownload = new GuiButton(2, MARGIN + 16, TOP + 118, 100, 20, this.canForceUpdate ? I18n.format("gui.forceupdate") : I18n.format("gui.downloadupdate"))); | 73 | + this.controls.add(new GuiButton(0, this.width - 99 - MARGIN, this.height - BOTTOM + 9, 100, 20, |
74 | + this.updateForced ? I18n.format("gui.exitgame") : I18n.format("gui.done"))); | ||
75 | + this.controls.add(this.btnCheck = new GuiButton(1, MARGIN + 16, TOP + 16, 100, 20, | ||
76 | + I18n.format("gui.checknow"))); | ||
77 | + this.controls.add(this.btnDownload = new GuiButton(2, MARGIN + 16, TOP + 118, 100, 20, | ||
78 | + this.canForceUpdate ? I18n.format("gui.forceupdate") : I18n.format("gui.downloadupdate"))); | ||
73 | } | 79 | } |
74 | 80 | ||
75 | @Override | 81 | @Override |
@@ -78,7 +84,7 @@ class GuiPanelUpdateCheck extends GuiPanel | @@ -78,7 +84,7 @@ class GuiPanelUpdateCheck extends GuiPanel | ||
78 | FontRenderer fontRenderer = this.mc.fontRendererObj; | 84 | FontRenderer fontRenderer = this.mc.fontRendererObj; |
79 | 85 | ||
80 | // Draw panel title | 86 | // Draw panel title |
81 | - fontRenderer.drawString(this.panelTitle, MARGIN, TOP - 14, 0xFFFFFFFF); | 87 | + fontRenderer.drawString(this.panelTitle, MARGIN, TOP - 14, GuiPanelUpdateCheck.WHITE); |
82 | 88 | ||
83 | // Draw top and bottom horizontal bars | 89 | // Draw top and bottom horizontal bars |
84 | drawRect(MARGIN, TOP - 4, this.width - MARGIN, TOP - 3, 0xFF999999); | 90 | drawRect(MARGIN, TOP - 4, this.width - MARGIN, TOP - 3, 0xFF999999); |
@@ -90,23 +96,25 @@ class GuiPanelUpdateCheck extends GuiPanel | @@ -90,23 +96,25 @@ class GuiPanelUpdateCheck extends GuiPanel | ||
90 | if (this.updateSite.isCheckInProgress()) | 96 | if (this.updateSite.isCheckInProgress()) |
91 | { | 97 | { |
92 | this.drawThrobber(MARGIN, TOP + 40, this.throb); | 98 | this.drawThrobber(MARGIN, TOP + 40, this.throb); |
93 | - fontRenderer.drawString(I18n.format("gui.updates.status.checking", ""), MARGIN + 18, TOP + 44, 0xFFFFFFFF); | 99 | + fontRenderer.drawString(I18n.format("gui.updates.status.checking", ""), MARGIN + 18, TOP + 44, GuiPanelUpdateCheck.WHITE); |
94 | } | 100 | } |
95 | else if (this.updateSite.isCheckComplete()) | 101 | else if (this.updateSite.isCheckComplete()) |
96 | { | 102 | { |
97 | boolean success = this.updateSite.isCheckSucceess(); | 103 | boolean success = this.updateSite.isCheckSucceess(); |
98 | String status = success ? I18n.format("gui.updates.status.success") : I18n.format("gui.updates.status.failed"); | 104 | String status = success ? I18n.format("gui.updates.status.success") : I18n.format("gui.updates.status.failed"); |
99 | - fontRenderer.drawString(I18n.format("gui.updates.status.checking", status), MARGIN + 18, TOP + 44, 0xFFFFFFFF); | 105 | + fontRenderer.drawString(I18n.format("gui.updates.status.checking", status), MARGIN + 18, TOP + 44, GuiPanelUpdateCheck.WHITE); |
100 | 106 | ||
101 | if (success) | 107 | if (success) |
102 | { | 108 | { |
103 | - fontRenderer.drawString(I18n.format("gui.updates.available.title"), MARGIN + 18, TOP + 70, 0xFFFFFFFF); | 109 | + fontRenderer.drawString(I18n.format("gui.updates.available.title"), MARGIN + 18, TOP + 70, GuiPanelUpdateCheck.WHITE); |
104 | if (this.updateSite.isUpdateAvailable()) | 110 | if (this.updateSite.isUpdateAvailable()) |
105 | { | 111 | { |
106 | this.btnDownload.visible = !this.updateForced; | 112 | this.btnDownload.visible = !this.updateForced; |
107 | - fontRenderer.drawString(I18n.format("gui.updates.available.newversion"), MARGIN + 18, TOP + 84, 0xFFFFFFFF); | ||
108 | - fontRenderer.drawString(I18n.format("gui.updates.available.version", this.updateSite.getAvailableVersion()), MARGIN + 18, TOP + 94, 0xFFFFFFFF); | ||
109 | - fontRenderer.drawString(I18n.format("gui.updates.available.date", this.updateSite.getAvailableVersionDate()), MARGIN + 18, TOP + 104, 0xFFFFFFFF); | 113 | + fontRenderer.drawString(I18n.format("gui.updates.available.newversion"), MARGIN + 18, TOP + 84, GuiPanelUpdateCheck.WHITE); |
114 | + fontRenderer.drawString(I18n.format("gui.updates.available.version", this.updateSite.getAvailableVersion()), | ||
115 | + MARGIN + 18, TOP + 94, GuiPanelUpdateCheck.WHITE); | ||
116 | + fontRenderer.drawString(I18n.format("gui.updates.available.date", this.updateSite.getAvailableVersionDate()), | ||
117 | + MARGIN + 18, TOP + 104, GuiPanelUpdateCheck.WHITE); | ||
110 | 118 | ||
111 | if (this.updateForced) | 119 | if (this.updateForced) |
112 | { | 120 | { |
@@ -115,13 +123,13 @@ class GuiPanelUpdateCheck extends GuiPanel | @@ -115,13 +123,13 @@ class GuiPanelUpdateCheck extends GuiPanel | ||
115 | } | 123 | } |
116 | else | 124 | else |
117 | { | 125 | { |
118 | - fontRenderer.drawString(I18n.format("gui.updates.available.nonewversion"), MARGIN + 18, TOP + 84, 0xFFFFFFFF); | 126 | + fontRenderer.drawString(I18n.format("gui.updates.available.nonewversion"), MARGIN + 18, TOP + 84, GuiPanelUpdateCheck.WHITE); |
119 | } | 127 | } |
120 | } | 128 | } |
121 | } | 129 | } |
122 | else | 130 | else |
123 | { | 131 | { |
124 | - fontRenderer.drawString(I18n.format("gui.updates.status.idle"), MARGIN + 18, TOP + 44, 0xFFFFFFFF); | 132 | + fontRenderer.drawString(I18n.format("gui.updates.status.idle"), MARGIN + 18, TOP + 44, GuiPanelUpdateCheck.WHITE); |
125 | } | 133 | } |
126 | 134 | ||
127 | super.draw(mouseX, mouseY, partialTicks); | 135 | super.draw(mouseX, mouseY, partialTicks); |
src/client/java/com/mumfrey/liteloader/client/gui/GuiScrollPanel.java
@@ -129,7 +129,8 @@ class GuiScrollPanel extends GuiPanel | @@ -129,7 +129,8 @@ class GuiScrollPanel extends GuiPanel | ||
129 | glPopMatrix(); | 129 | glPopMatrix(); |
130 | 130 | ||
131 | // Update and draw scroll bar | 131 | // Update and draw scroll bar |
132 | - this.scrollBar.drawScrollBar(mouseX, mouseY, partialTicks, this.left + this.width - 5, this.top, 5, this.height, Math.max(this.height, this.contentHeight)); | 132 | + this.scrollBar.drawScrollBar(mouseX, mouseY, partialTicks, this.left + this.width - 5, this.top, 5, this.height, |
133 | + Math.max(this.height, this.contentHeight)); | ||
133 | } | 134 | } |
134 | 135 | ||
135 | @Override | 136 | @Override |
@@ -153,7 +154,9 @@ class GuiScrollPanel extends GuiPanel | @@ -153,7 +154,9 @@ class GuiScrollPanel extends GuiPanel | ||
153 | if (mouseButton == 0) | 154 | if (mouseButton == 0) |
154 | { | 155 | { |
155 | if (this.scrollBar.wasMouseOver()) | 156 | if (this.scrollBar.wasMouseOver()) |
157 | + { | ||
156 | this.scrollBar.setDragging(true); | 158 | this.scrollBar.setDragging(true); |
159 | + } | ||
157 | } | 160 | } |
158 | } | 161 | } |
159 | 162 |
src/client/java/com/mumfrey/liteloader/client/gui/GuiSimpleScrollBar.java
@@ -51,7 +51,8 @@ public class GuiSimpleScrollBar extends Gui | @@ -51,7 +51,8 @@ public class GuiSimpleScrollBar extends Gui | ||
51 | } | 51 | } |
52 | 52 | ||
53 | /** | 53 | /** |
54 | - * Set the scroll value, the value is clamped between 0 and the current max value | 54 | + * Set the scroll value, the value is clamped between 0 and the current max |
55 | + * value. | ||
55 | */ | 56 | */ |
56 | public void setValue(int value) | 57 | public void setValue(int value) |
57 | { | 58 | { |
@@ -59,7 +60,8 @@ public class GuiSimpleScrollBar extends Gui | @@ -59,7 +60,8 @@ public class GuiSimpleScrollBar extends Gui | ||
59 | } | 60 | } |
60 | 61 | ||
61 | /** | 62 | /** |
62 | - * Offset the scroll value by the specified amount, the value is clamped between 0 and the current max value | 63 | + * Offset the scroll value by the specified amount, the value is clamped |
64 | + * between 0 and the current max value. | ||
63 | */ | 65 | */ |
64 | public void offsetValue(int offset) | 66 | public void offsetValue(int offset) |
65 | { | 67 | { |
src/client/java/com/mumfrey/liteloader/client/gui/ScrollPanelContent.java
@@ -6,7 +6,7 @@ public interface ScrollPanelContent | @@ -6,7 +6,7 @@ public interface ScrollPanelContent | ||
6 | { | 6 | { |
7 | public abstract int getScrollPanelContentHeight(GuiScrollPanel source); | 7 | public abstract int getScrollPanelContentHeight(GuiScrollPanel source); |
8 | 8 | ||
9 | - public abstract void drawScrollPanelContent(GuiScrollPanel source, int mouseX, int mouseY, float partialTicks, int scrollAmount, int visibleHeight); | 9 | + public abstract void drawScrollPanelContent(GuiScrollPanel source, int mouseX, int mouseY, float partialTicks, int scrollAmt, int visibleHeight); |
10 | 10 | ||
11 | public abstract void scrollPanelActionPerformed(GuiScrollPanel source, GuiButton control); | 11 | public abstract void scrollPanelActionPerformed(GuiScrollPanel source, GuiButton control); |
12 | 12 |
src/client/java/com/mumfrey/liteloader/client/gui/modlist/GuiModInfoPanel.java
@@ -59,7 +59,8 @@ public class GuiModInfoPanel extends Gui | @@ -59,7 +59,8 @@ public class GuiModInfoPanel extends Gui | ||
59 | 59 | ||
60 | drawRect(xPosition + 5, yPos, xPosition + width, yPos + 1, GuiModInfoPanel.DIVIDER_COLOUR); yPos += 4; // divider | 60 | drawRect(xPosition + 5, yPos, xPosition + width, yPos + 1, GuiModInfoPanel.DIVIDER_COLOUR); yPos += 4; // divider |
61 | 61 | ||
62 | - this.fontRenderer.drawString(I18n.format("gui.about.authors") + ": \2477" + this.modInfo.getAuthor(), xPosition + 5, yPos, GuiModInfoPanel.AUTHORS_COLOUR); yPos += 10; | 62 | + this.fontRenderer.drawString(I18n.format("gui.about.authors") + ": \2477" + this.modInfo.getAuthor(), xPosition + 5, yPos, |
63 | + GuiModInfoPanel.AUTHORS_COLOUR); yPos += 10; | ||
63 | if (!Strings.isNullOrEmpty(this.modInfo.getURL())) | 64 | if (!Strings.isNullOrEmpty(this.modInfo.getURL())) |
64 | { | 65 | { |
65 | this.fontRenderer.drawString(this.modInfo.getURL(), xPosition + 5, yPos, GuiModListPanel.BLEND_2THRDS & this.brandColour); yPos += 10; | 66 | this.fontRenderer.drawString(this.modInfo.getURL(), xPosition + 5, yPos, GuiModListPanel.BLEND_2THRDS & this.brandColour); yPos += 10; |
src/client/java/com/mumfrey/liteloader/client/gui/modlist/GuiModListPanel.java
@@ -106,7 +106,8 @@ public class GuiModListPanel extends Gui | @@ -106,7 +106,8 @@ public class GuiModListPanel extends Gui | ||
106 | int titleColour = this.getTitleColour(selected); | 106 | int titleColour = this.getTitleColour(selected); |
107 | int statusColour = this.getStatusColour(selected); | 107 | int statusColour = this.getStatusColour(selected); |
108 | 108 | ||
109 | - this.drawGradientRect(xPosition, yPosition, xPosition + width, yPosition + GuiModListPanel.PANEL_HEIGHT, gradientColour, GuiModListPanel.GRADIENT_COLOUR2); | 109 | + this.drawGradientRect(xPosition, yPosition, xPosition + width, yPosition + GuiModListPanel.PANEL_HEIGHT, gradientColour, |
110 | + GuiModListPanel.GRADIENT_COLOUR2); | ||
110 | 111 | ||
111 | String titleText = this.owner.getTitleText(); | 112 | String titleText = this.owner.getTitleText(); |
112 | String versionText = this.owner.getVersionText(); | 113 | String versionText = this.owner.getVersionText(); |
@@ -128,7 +129,8 @@ public class GuiModListPanel extends Gui | @@ -128,7 +129,8 @@ public class GuiModListPanel extends Gui | ||
128 | 129 | ||
129 | for (ModInfoDecorator decorator : this.decorators) | 130 | for (ModInfoDecorator decorator : this.decorators) |
130 | { | 131 | { |
131 | - decorator.onDrawListEntry(mouseX, mouseY, partialTicks, xPosition, yPosition, width, GuiModListPanel.PANEL_HEIGHT, selected, this.modInfo, gradientColour, titleColour, statusColour); | 132 | + decorator.onDrawListEntry(mouseX, mouseY, partialTicks, xPosition, yPosition, width, GuiModListPanel.PANEL_HEIGHT, selected, |
133 | + this.modInfo, gradientColour, titleColour, statusColour); | ||
132 | } | 134 | } |
133 | } | 135 | } |
134 | 136 | ||
@@ -172,7 +174,8 @@ public class GuiModListPanel extends Gui | @@ -172,7 +174,8 @@ public class GuiModListPanel extends Gui | ||
172 | if (tooltipText != null) | 174 | if (tooltipText != null) |
173 | { | 175 | { |
174 | glDisableClipping(); | 176 | glDisableClipping(); |
175 | - GuiLiteLoaderPanel.drawTooltip(this.fontRenderer, tooltipText, mouseX, mouseY, 4096, 4096, GuiModListPanel.WHITE, GuiModListPanel.BLEND_HALF & GuiModListPanel.BLACK); | 177 | + GuiLiteLoaderPanel.drawTooltip(this.fontRenderer, tooltipText, mouseX, mouseY, 4096, 4096, GuiModListPanel.WHITE, |
178 | + GuiModListPanel.BLEND_HALF & GuiModListPanel.BLACK); | ||
176 | glEnableClipping(); | 179 | glEnableClipping(); |
177 | } | 180 | } |
178 | 181 | ||
@@ -187,7 +190,10 @@ public class GuiModListPanel extends Gui | @@ -187,7 +190,10 @@ public class GuiModListPanel extends Gui | ||
187 | */ | 190 | */ |
188 | protected int getGradientColour(boolean selected) | 191 | protected int getGradientColour(boolean selected) |
189 | { | 192 | { |
190 | - return GuiModListPanel.BLEND_2THRDS & (this.owner.isErrored() ? (selected ? GuiModListPanel.ERROR_GRADIENT_COLOUR : GuiModListPanel.ERROR_GRADIENT_COLOUR2) : (selected ? (this.owner.isExternal() ? GuiModListPanel.EXTERNAL_ENTRY_COLOUR : this.brandColour) : GuiModListPanel.BLACK)); | 193 | + return GuiModListPanel.BLEND_2THRDS |
194 | + & (this.owner.isErrored() | ||
195 | + ? (selected ? GuiModListPanel.ERROR_GRADIENT_COLOUR : GuiModListPanel.ERROR_GRADIENT_COLOUR2) | ||
196 | + : (selected ? (this.owner.isExternal() ? GuiModListPanel.EXTERNAL_ENTRY_COLOUR : this.brandColour) : GuiModListPanel.BLACK)); | ||
191 | } | 197 | } |
192 | 198 | ||
193 | /** | 199 | /** |
src/client/java/com/mumfrey/liteloader/client/gui/modlist/GuiModListPanelInvalid.java
@@ -11,7 +11,8 @@ public class GuiModListPanelInvalid extends GuiModListPanel | @@ -11,7 +11,8 @@ public class GuiModListPanelInvalid extends GuiModListPanel | ||
11 | { | 11 | { |
12 | private static final int BAD_PANEL_HEIGHT = 22; | 12 | private static final int BAD_PANEL_HEIGHT = 22; |
13 | 13 | ||
14 | - public GuiModListPanelInvalid(ModListEntry owner, FontRenderer fontRenderer, int brandColour, ModInfo<?> modInfo, List<ModInfoDecorator> decorators) | 14 | + public GuiModListPanelInvalid(ModListEntry owner, FontRenderer fontRenderer, int brandColour, ModInfo<?> modInfo, |
15 | + List<ModInfoDecorator> decorators) | ||
15 | { | 16 | { |
16 | super(owner, fontRenderer, brandColour, modInfo, decorators); | 17 | super(owner, fontRenderer, brandColour, modInfo, decorators); |
17 | } | 18 | } |
src/client/java/com/mumfrey/liteloader/client/gui/modlist/ModList.java
@@ -38,7 +38,8 @@ public class ModList | @@ -38,7 +38,8 @@ public class ModList | ||
38 | 38 | ||
39 | private boolean hasConfig = false; | 39 | private boolean hasConfig = false; |
40 | 40 | ||
41 | - public ModList(ModListContainer container, Minecraft minecraft, LiteLoaderMods mods, LoaderEnvironment environment, ConfigManager configManager, int brandColour, List<ModInfoDecorator> decorators) | 41 | + public ModList(ModListContainer container, Minecraft minecraft, LiteLoaderMods mods, LoaderEnvironment environment, ConfigManager configManager, |
42 | + int brandColour, List<ModInfoDecorator> decorators) | ||
42 | { | 43 | { |
43 | this.container = container; | 44 | this.container = container; |
44 | this.configManager = configManager; | 45 | this.configManager = configManager; |
@@ -53,7 +54,8 @@ public class ModList | @@ -53,7 +54,8 @@ public class ModList | ||
53 | * @param brandColour | 54 | * @param brandColour |
54 | * @param decorators | 55 | * @param decorators |
55 | */ | 56 | */ |
56 | - protected void populate(Minecraft minecraft, LiteLoaderMods mods, LoaderEnvironment environment, int brandColour, List<ModInfoDecorator> decorators) | 57 | + protected void populate(Minecraft minecraft, LiteLoaderMods mods, LoaderEnvironment environment, int brandColour, |
58 | + List<ModInfoDecorator> decorators) | ||
57 | { | 59 | { |
58 | // Add mods to this treeset first, in order to sort them | 60 | // Add mods to this treeset first, in order to sort them |
59 | Map<String, ModListEntry> sortedMods = new TreeMap<String, ModListEntry>(); | 61 | Map<String, ModListEntry> sortedMods = new TreeMap<String, ModListEntry>(); |
@@ -94,7 +96,9 @@ public class ModList | @@ -94,7 +96,9 @@ public class ModList | ||
94 | 96 | ||
95 | // Select the first mod in the list | 97 | // Select the first mod in the list |
96 | if (this.mods.size() > 0) | 98 | if (this.mods.size() > 0) |
99 | + { | ||
97 | this.selectedMod = this.mods.get(0); | 100 | this.selectedMod = this.mods.get(0); |
101 | + } | ||
98 | } | 102 | } |
99 | 103 | ||
100 | public GuiLiteLoaderPanel getParentScreen() | 104 | public GuiLiteLoaderPanel getParentScreen() |
@@ -156,7 +160,10 @@ public class ModList | @@ -156,7 +160,10 @@ public class ModList | ||
156 | this.scrollSelectedModIntoView(); | 160 | this.scrollSelectedModIntoView(); |
157 | return true; | 161 | return true; |
158 | } | 162 | } |
159 | - else if (keyCode == Keyboard.KEY_SPACE || keyCode == Keyboard.KEY_RETURN || keyCode == Keyboard.KEY_NUMPADENTER || keyCode == Keyboard.KEY_RIGHT) | 163 | + else if (keyCode == Keyboard.KEY_SPACE |
164 | + || keyCode == Keyboard.KEY_RETURN | ||
165 | + || keyCode == Keyboard.KEY_NUMPADENTER | ||
166 | + || keyCode == Keyboard.KEY_RIGHT) | ||
160 | { | 167 | { |
161 | this.toggleSelectedMod(); | 168 | this.toggleSelectedMod(); |
162 | return true; | 169 | return true; |
src/client/java/com/mumfrey/liteloader/client/gui/modlist/ModListEntry.java
@@ -15,8 +15,9 @@ import com.mumfrey.liteloader.interfaces.LoadableMod; | @@ -15,8 +15,9 @@ import com.mumfrey.liteloader.interfaces.LoadableMod; | ||
15 | import com.mumfrey.liteloader.launch.LoaderEnvironment; | 15 | import com.mumfrey.liteloader.launch.LoaderEnvironment; |
16 | 16 | ||
17 | /** | 17 | /** |
18 | - * Represents a mod in the mod info screen, keeps track of mod information and provides methods | ||
19 | - * for displaying the mod in the mod list and drawing the selected mod info | 18 | + * Represents a mod in the mod info screen, keeps track of mod information and |
19 | + * provides methods for displaying the mod in the mod list and drawing the | ||
20 | + * selected mod info. | ||
20 | * | 21 | * |
21 | * @author Adam Mummery-Smith | 22 | * @author Adam Mummery-Smith |
22 | */ | 23 | */ |
@@ -56,13 +57,15 @@ public class ModListEntry | @@ -56,13 +57,15 @@ public class ModListEntry | ||
56 | private Set<String> missingAPIs; | 57 | private Set<String> missingAPIs; |
57 | 58 | ||
58 | /** | 59 | /** |
59 | - * Whether the mod can be toggled, not all mods support this, eg. internal mods | 60 | + * Whether the mod can be toggled, not all mods support this, eg. internal |
61 | + * mods | ||
60 | */ | 62 | */ |
61 | private boolean canBeToggled; | 63 | private boolean canBeToggled; |
62 | 64 | ||
63 | /** | 65 | /** |
64 | - * Whether the mod WILL be enabled on the next startup, if the mod is active and has been disabled this | ||
65 | - * will be false, and if it's currently disabled by has been toggled then it will be true | 66 | + * Whether the mod WILL be enabled on the next startup, if the mod is active |
67 | + * and has been disabled this will be false, and if it's currently disabled | ||
68 | + * by has been toggled then it will be true. | ||
66 | */ | 69 | */ |
67 | private boolean willBeEnabled; | 70 | private boolean willBeEnabled; |
68 | 71 | ||
@@ -85,7 +88,8 @@ public class ModListEntry | @@ -85,7 +88,8 @@ public class ModListEntry | ||
85 | * @param decorators | 88 | * @param decorators |
86 | * @param modInfo | 89 | * @param modInfo |
87 | */ | 90 | */ |
88 | - ModListEntry(ModList modList, LiteLoaderMods mods, LoaderEnvironment environment, FontRenderer fontRenderer, int brandColour, List<ModInfoDecorator> decorators, ModInfo<?> modInfo) | 91 | + ModListEntry(ModList modList, LiteLoaderMods mods, LoaderEnvironment environment, FontRenderer fontRenderer, int brandColour, |
92 | + List<ModInfoDecorator> decorators, ModInfo<?> modInfo) | ||
89 | { | 93 | { |
90 | this.modList = modList; | 94 | this.modList = modList; |
91 | this.mods = mods; | 95 | this.mods = mods; |
@@ -94,7 +98,7 @@ public class ModListEntry | @@ -94,7 +98,7 @@ public class ModListEntry | ||
94 | this.isActive = modInfo.isActive(); | 98 | this.isActive = modInfo.isActive(); |
95 | this.isValid = modInfo.isValid(); | 99 | this.isValid = modInfo.isValid(); |
96 | this.canBeToggled = modInfo.isToggleable() && mods.getEnabledModsList().saveAllowed(); | 100 | this.canBeToggled = modInfo.isToggleable() && mods.getEnabledModsList().saveAllowed(); |
97 | - this.willBeEnabled = mods.isModEnabled(this.modInfo.getIdentifier());; | 101 | + this.willBeEnabled = mods.isModEnabled(this.modInfo.getIdentifier()); |
98 | this.isExternal = modInfo.getContainer().isExternalJar(); | 102 | this.isExternal = modInfo.getContainer().isExternalJar(); |
99 | this.isErrored = modInfo.getStartupErrors() != null && modInfo.getStartupErrors().size() > 0; | 103 | this.isErrored = modInfo.getStartupErrors() != null && modInfo.getStartupErrors().size() > 0; |
100 | 104 | ||
@@ -140,7 +144,9 @@ public class ModListEntry | @@ -140,7 +144,9 @@ public class ModListEntry | ||
140 | public void onTick() | 144 | public void onTick() |
141 | { | 145 | { |
142 | if (this.doubleClickTime > 0) | 146 | if (this.doubleClickTime > 0) |
147 | + { | ||
143 | this.doubleClickTime--; | 148 | this.doubleClickTime--; |
149 | + } | ||
144 | } | 150 | } |
145 | 151 | ||
146 | public void mousePressed(int mouseX, int mouseY, int mouseButton) | 152 | public void mousePressed(int mouseX, int mouseY, int mouseButton) |
src/client/java/com/mumfrey/liteloader/client/gui/startup/LoadingBar.java
@@ -118,7 +118,7 @@ public class LoadingBar extends LoadingProgress | @@ -118,7 +118,7 @@ public class LoadingBar extends LoadingProgress | ||
118 | 118 | ||
119 | protected void _initTextures() | 119 | protected void _initTextures() |
120 | { | 120 | { |
121 | - this.minecraftMessage = LoadingBar.LOADING_MESSAGE_2; | 121 | + this.minecraftMessage = LoadingBar.LOADING_MESSAGE_2; |
122 | } | 122 | } |
123 | 123 | ||
124 | @Override | 124 | @Override |
@@ -166,14 +166,15 @@ public class LoadingBar extends LoadingProgress | @@ -166,14 +166,15 @@ public class LoadingBar extends LoadingProgress | ||
166 | { | 166 | { |
167 | if (this.fontRenderer == null) | 167 | if (this.fontRenderer == null) |
168 | { | 168 | { |
169 | - this.fontRenderer = new FontRenderer(this.minecraft.gameSettings, new ResourceLocation("textures/font/ascii.png"), this.textureManager, false); | 169 | + this.fontRenderer = new FontRenderer(this.minecraft.gameSettings, new ResourceLocation("textures/font/ascii.png"), |
170 | + this.textureManager, false); | ||
170 | this.fontRenderer.onResourceManagerReload(this.minecraft.getResourceManager()); | 171 | this.fontRenderer.onResourceManagerReload(this.minecraft.getResourceManager()); |
171 | } | 172 | } |
172 | 173 | ||
173 | double totalProgress = this.totalMinecraftProgress + this.totalLiteLoaderProgress; | 174 | double totalProgress = this.totalMinecraftProgress + this.totalLiteLoaderProgress; |
174 | double progress = (this.minecraftProgress + this.liteLoaderProgress) / totalProgress; | 175 | double progress = (this.minecraftProgress + this.liteLoaderProgress) / totalProgress; |
175 | 176 | ||
176 | - // if (progress >= 1.0) LoadingBar.message = "Preparing..."; | 177 | +// if (progress >= 1.0) LoadingBar.message = "Preparing..."; |
177 | 178 | ||
178 | this.render(progress); | 179 | this.render(progress); |
179 | } | 180 | } |
@@ -308,15 +309,15 @@ public class LoadingBar extends LoadingProgress | @@ -308,15 +309,15 @@ public class LoadingBar extends LoadingProgress | ||
308 | glAlphaFunc(GL_GREATER, 0.0F); | 309 | glAlphaFunc(GL_GREATER, 0.0F); |
309 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | 310 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
310 | 311 | ||
311 | - // tessellator.startDrawingQuads(); | ||
312 | - // tessellator.setColorRGBA(0, 0, 0, 32); | ||
313 | - // tessellator.addVertex(0.0D, scaledHeight, 0.0D); | ||
314 | - // tessellator.setColorRGBA(0, 0, 0, 180); | ||
315 | - // tessellator.addVertex(0.0D + scaledWidth, scaledHeight, 0.0D); | ||
316 | - // tessellator.setColorRGBA(0, 0, 0, 0); | ||
317 | - // tessellator.addVertex(0.0D + scaledWidth, (scaledHeight / 10), 0.0D); | ||
318 | - // tessellator.addVertex(0.0D, scaledHeight - (scaledHeight / 3), 0.0D); | ||
319 | - // tessellator.draw(); | 312 | +// tessellator.startDrawingQuads(); |
313 | +// tessellator.setColorRGBA(0, 0, 0, 32); | ||
314 | +// tessellator.addVertex(0.0D, scaledHeight, 0.0D); | ||
315 | +// tessellator.setColorRGBA(0, 0, 0, 180); | ||
316 | +// tessellator.addVertex(0.0D + scaledWidth, scaledHeight, 0.0D); | ||
317 | +// tessellator.setColorRGBA(0, 0, 0, 0); | ||
318 | +// tessellator.addVertex(0.0D + scaledWidth, (scaledHeight / 10), 0.0D); | ||
319 | +// tessellator.addVertex(0.0D, scaledHeight - (scaledHeight / 3), 0.0D); | ||
320 | +// tessellator.draw(); | ||
320 | 321 | ||
321 | worldRenderer.startDrawingQuads(); | 322 | worldRenderer.startDrawingQuads(); |
322 | worldRenderer.setColorRGBA(this.barLuma, this.barLuma, this.barLuma, 128); // TODO OBF MCPTEST func_178961_b - setColorRGBA | 323 | worldRenderer.setColorRGBA(this.barLuma, this.barLuma, this.barLuma, 128); // TODO OBF MCPTEST func_178961_b - setColorRGBA |
@@ -346,7 +347,7 @@ public class LoadingBar extends LoadingProgress | @@ -346,7 +347,7 @@ public class LoadingBar extends LoadingProgress | ||
346 | 347 | ||
347 | glEnableAlphaTest(); | 348 | glEnableAlphaTest(); |
348 | glAlphaFunc(GL_GREATER, 0.1F); | 349 | glAlphaFunc(GL_GREATER, 0.1F); |
349 | - // glFlush(); | 350 | +// glFlush(); |
350 | 351 | ||
351 | this.minecraft.updateDisplay(); // TODO OBF MCPTEST updateDisplay - func_175601_h | 352 | this.minecraft.updateDisplay(); // TODO OBF MCPTEST updateDisplay - func_175601_h |
352 | } | 353 | } |
@@ -365,8 +366,9 @@ public class LoadingBar extends LoadingProgress | @@ -365,8 +366,9 @@ public class LoadingBar extends LoadingProgress | ||
365 | } | 366 | } |
366 | 367 | ||
367 | /** | 368 | /** |
368 | - * Find the most common (approx) colour in the image and assign it to the bar, reduces the palette to 9-bit by | ||
369 | - * stripping the the 5 LSB from each byte to create a 9-bit palette index in the form RRRGGGBBB | 369 | + * Find the most common (approx) colour in the image and assign it to the |
370 | + * bar, reduces the palette to 9-bit by stripping the the 5 LSB from each | ||
371 | + * byte to create a 9-bit palette index in the form RRRGGGBBB | ||
370 | * | 372 | * |
371 | * @param textureData | 373 | * @param textureData |
372 | */ | 374 | */ |
src/client/java/com/mumfrey/liteloader/client/overlays/IGuiTextField.java
@@ -3,7 +3,8 @@ package com.mumfrey.liteloader.client.overlays; | @@ -3,7 +3,8 @@ package com.mumfrey.liteloader.client.overlays; | ||
3 | import com.mumfrey.liteloader.transformers.access.Accessor; | 3 | import com.mumfrey.liteloader.transformers.access.Accessor; |
4 | 4 | ||
5 | /** | 5 | /** |
6 | - * Adapter for GuiTextField to expose internal properties, mainly to allow sensible subclassing | 6 | + * Adapter for GuiTextField to expose internal properties, mainly to allow |
7 | + * sensible subclassing. | ||
7 | * | 8 | * |
8 | * @author Adam Mummery-Smith | 9 | * @author Adam Mummery-Smith |
9 | */ | 10 | */ |
@@ -23,13 +24,13 @@ public interface IGuiTextField | @@ -23,13 +24,13 @@ public interface IGuiTextField | ||
23 | @Accessor("#5") public abstract void setHeight(int height); | 24 | @Accessor("#5") public abstract void setHeight(int height); |
24 | 25 | ||
25 | @Accessor("#12") public abstract boolean isEnabled(); | 26 | @Accessor("#12") public abstract boolean isEnabled(); |
26 | - // @Accessor("#12") public abstract void setEnabled(boolean enabled); // built in | 27 | +// @Accessor("#12") public abstract void setEnabled(boolean enabled); // built in |
27 | 28 | ||
28 | @Accessor("#13") public abstract int getLineScrollOffset(); | 29 | @Accessor("#13") public abstract int getLineScrollOffset(); |
29 | 30 | ||
30 | @Accessor("#16") public abstract int getTextColor(); | 31 | @Accessor("#16") public abstract int getTextColor(); |
31 | - // @Accessor("#16") public abstract void setTextColor(int color); // built in | 32 | +// @Accessor("#16") public abstract void setTextColor(int color); // built in |
32 | 33 | ||
33 | @Accessor("#17") public abstract int getDisabledTextColour(); | 34 | @Accessor("#17") public abstract int getDisabledTextColour(); |
34 | - // @Accessor("#17") public abstract void setDisabledTextColour(int color); // built in | 35 | +// @Accessor("#17") public abstract void setDisabledTextColour(int color); // built in |
35 | } | 36 | } |
src/client/java/com/mumfrey/liteloader/client/transformers/CrashReportTransformer.java
@@ -31,7 +31,8 @@ public class CrashReportTransformer extends ClassTransformer | @@ -31,7 +31,8 @@ public class CrashReportTransformer extends ClassTransformer | ||
31 | } | 31 | } |
32 | 32 | ||
33 | /** | 33 | /** |
34 | - * Inject the additional callback for populating the crash report into the CallableJVMFlags class | 34 | + * Inject the additional callback for populating the crash report into the |
35 | + * CallableJVMFlags class. | ||
35 | * | 36 | * |
36 | * @param basicClass basic class | 37 | * @param basicClass basic class |
37 | * @return transformed class | 38 | * @return transformed class |
@@ -58,14 +59,17 @@ public class CrashReportTransformer extends ClassTransformer | @@ -58,14 +59,17 @@ public class CrashReportTransformer extends ClassTransformer | ||
58 | { | 59 | { |
59 | InsnList code = new InsnList(); | 60 | InsnList code = new InsnList(); |
60 | code.add(new VarInsnNode(Opcodes.ALOAD, 1)); | 61 | code.add(new VarInsnNode(Opcodes.ALOAD, 1)); |
61 | - code.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "com/mumfrey/liteloader/core/LiteLoader", "populateCrashReport", "(Ljava/lang/Object;)V", false)); | 62 | + code.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "com/mumfrey/liteloader/core/LiteLoader", "populateCrashReport", |
63 | + "(Ljava/lang/Object;)V", false)); | ||
62 | 64 | ||
63 | ListIterator<AbstractInsnNode> insns = ctor.instructions.iterator(); | 65 | ListIterator<AbstractInsnNode> insns = ctor.instructions.iterator(); |
64 | while (insns.hasNext()) | 66 | while (insns.hasNext()) |
65 | { | 67 | { |
66 | AbstractInsnNode insnNode = insns.next(); | 68 | AbstractInsnNode insnNode = insns.next(); |
67 | if (insnNode.getOpcode() == Opcodes.RETURN) | 69 | if (insnNode.getOpcode() == Opcodes.RETURN) |
70 | + { | ||
68 | ctor.instructions.insertBefore(insnNode, code); | 71 | ctor.instructions.insertBefore(insnNode, code); |
72 | + } | ||
69 | } | 73 | } |
70 | } | 74 | } |
71 | } | 75 | } |
src/client/java/com/mumfrey/liteloader/client/transformers/MinecraftTransformer.java
@@ -86,6 +86,6 @@ public class MinecraftTransformer extends AccessorTransformer | @@ -86,6 +86,6 @@ public class MinecraftTransformer extends AccessorTransformer | ||
86 | 86 | ||
87 | method.instructions = insns; | 87 | method.instructions = insns; |
88 | 88 | ||
89 | - if (!found) LiteLoaderLogger.severe("MinecraftTransformer failed to find the INIT injection point, the game will probably crash pretty soon."); | 89 | + if (!found) LiteLoaderLogger.severe("MinecraftTransformer failed to find INIT injection point, the game will probably crash pretty soon."); |
90 | } | 90 | } |
91 | } | 91 | } |
src/client/java/com/mumfrey/liteloader/client/util/PrivateFieldsClient.java
@@ -21,19 +21,21 @@ import com.mumfrey.liteloader.core.runtime.Obf; | @@ -21,19 +21,21 @@ import com.mumfrey.liteloader.core.runtime.Obf; | ||
21 | import com.mumfrey.liteloader.util.PrivateFields; | 21 | import com.mumfrey.liteloader.util.PrivateFields; |
22 | 22 | ||
23 | @SuppressWarnings("rawtypes") | 23 | @SuppressWarnings("rawtypes") |
24 | -public class PrivateFieldsClient<P, T> extends PrivateFields<P, T> | 24 | +public final class PrivateFieldsClient<P, T> extends PrivateFields<P, T> |
25 | { | 25 | { |
26 | private PrivateFieldsClient(Class<P> owner, Obf obf) | 26 | private PrivateFieldsClient(Class<P> owner, Obf obf) |
27 | { | 27 | { |
28 | super(owner, obf); | 28 | super(owner, obf); |
29 | } | 29 | } |
30 | 30 | ||
31 | + // CHECKSTYLE:OFF | ||
32 | + | ||
31 | public static final PrivateFieldsClient<RenderManager, Map> entityRenderMap = new PrivateFieldsClient<RenderManager, Map> (RenderManager.class, Obf.entityRenderMap); | 33 | public static final PrivateFieldsClient<RenderManager, Map> entityRenderMap = new PrivateFieldsClient<RenderManager, Map> (RenderManager.class, Obf.entityRenderMap); |
32 | public static final PrivateFieldsClient<NetHandlerLoginClient, NetworkManager> netManager = new PrivateFieldsClient<NetHandlerLoginClient, NetworkManager> (NetHandlerLoginClient.class, Obf.networkManager); | 34 | public static final PrivateFieldsClient<NetHandlerLoginClient, NetworkManager> netManager = new PrivateFieldsClient<NetHandlerLoginClient, NetworkManager> (NetHandlerLoginClient.class, Obf.networkManager); |
33 | - public static final PrivateFieldsClient<RegistrySimple, Map> registryObjects = new PrivateFieldsClient<RegistrySimple, Map> (RegistrySimple.class, Obf.registryObjects); | ||
34 | - public static final PrivateFieldsClient<RegistryNamespaced, ObjectIntIdentityMap> underlyingIntegerMap = new PrivateFieldsClient<RegistryNamespaced, ObjectIntIdentityMap>(RegistryNamespaced.class, Obf.underlyingIntegerMap); | ||
35 | - public static final PrivateFieldsClient<ObjectIntIdentityMap, IdentityHashMap> identityMap = new PrivateFieldsClient<ObjectIntIdentityMap, IdentityHashMap> (ObjectIntIdentityMap.class, Obf.identityMap); | ||
36 | - public static final PrivateFieldsClient<ObjectIntIdentityMap, List> objectList = new PrivateFieldsClient<ObjectIntIdentityMap, List> (ObjectIntIdentityMap.class, Obf.objectList); | 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); | ||
37 | public static final PrivateFieldsClient<TileEntityRendererDispatcher, Map> specialRendererMap = new PrivateFieldsClient<TileEntityRendererDispatcher, Map> (TileEntityRendererDispatcher.class, Obf.mapSpecialRenderers); | 39 | public static final PrivateFieldsClient<TileEntityRendererDispatcher, Map> specialRendererMap = new PrivateFieldsClient<TileEntityRendererDispatcher, Map> (TileEntityRendererDispatcher.class, Obf.mapSpecialRenderers); |
38 | public static final PrivateFieldsClient<TileEntity, Map> tileEntityNameToClassMap = new PrivateFieldsClient<TileEntity, Map> (TileEntity.class, Obf.tileEntityNameToClassMap); | 40 | public static final PrivateFieldsClient<TileEntity, Map> tileEntityNameToClassMap = new PrivateFieldsClient<TileEntity, Map> (TileEntity.class, Obf.tileEntityNameToClassMap); |
39 | public static final PrivateFieldsClient<TileEntity, Map> tileEntityClassToNameMap = new PrivateFieldsClient<TileEntity, Map> (TileEntity.class, Obf.tileEntityClassToNameMap); | 41 | public static final PrivateFieldsClient<TileEntity, Map> tileEntityClassToNameMap = new PrivateFieldsClient<TileEntity, Map> (TileEntity.class, Obf.tileEntityClassToNameMap); |
src/client/java/com/mumfrey/liteloader/client/util/render/IconAbsolute.java
@@ -22,12 +22,14 @@ public class IconAbsolute implements IconTextured | @@ -22,12 +22,14 @@ public class IconAbsolute implements IconTextured | ||
22 | private float vCoord; | 22 | private float vCoord; |
23 | private float vCoord2; | 23 | private float vCoord2; |
24 | 24 | ||
25 | - public IconAbsolute(ResourceLocation textureResource, String displayText, int width, int height, float uCoord, float vCoord, float uCoord2, float vCoord2) | 25 | + public IconAbsolute(ResourceLocation textureResource, String displayText, int width, int height, float uCoord, float vCoord, float uCoord2, |
26 | + float vCoord2) | ||
26 | { | 27 | { |
27 | this(textureResource, displayText, width, height, uCoord, vCoord, uCoord2, vCoord2, 256); | 28 | this(textureResource, displayText, width, height, uCoord, vCoord, uCoord2, vCoord2, 256); |
28 | } | 29 | } |
29 | 30 | ||
30 | - public IconAbsolute(ResourceLocation textureResource, String displayText, int width, int height, float uCoord, float vCoord, float uCoord2, float vCoord2, int texMapSize) | 31 | + public IconAbsolute(ResourceLocation textureResource, String displayText, int width, int height, float uCoord, float vCoord, float uCoord2, |
32 | + float vCoord2, int texMapSize) | ||
31 | { | 33 | { |
32 | this.textureResource = textureResource; | 34 | this.textureResource = textureResource; |
33 | this.displayText = displayText; | 35 | this.displayText = displayText; |
src/client/java/com/mumfrey/liteloader/client/util/render/IconAbsoluteClickable.java
@@ -6,12 +6,14 @@ import com.mumfrey.liteloader.util.render.IconClickable; | @@ -6,12 +6,14 @@ import com.mumfrey.liteloader.util.render.IconClickable; | ||
6 | 6 | ||
7 | public abstract class IconAbsoluteClickable extends IconAbsolute implements IconClickable | 7 | public abstract class IconAbsoluteClickable extends IconAbsolute implements IconClickable |
8 | { | 8 | { |
9 | - public IconAbsoluteClickable(ResourceLocation textureResource, String displayText, int width, int height, float uCoord, float vCoord, float uCoord2, float vCoord2) | 9 | + public IconAbsoluteClickable(ResourceLocation textureResource, String displayText, int width, int height, float uCoord, float vCoord, |
10 | + float uCoord2, float vCoord2) | ||
10 | { | 11 | { |
11 | super(textureResource, displayText, width, height, uCoord, vCoord, uCoord2, vCoord2); | 12 | super(textureResource, displayText, width, height, uCoord, vCoord, uCoord2, vCoord2); |
12 | } | 13 | } |
13 | 14 | ||
14 | - public IconAbsoluteClickable(ResourceLocation textureResource, String displayText, int width, int height, float uCoord, float vCoord, float uCoord2, float vCoord2, int texMapSize) | 15 | + public IconAbsoluteClickable(ResourceLocation textureResource, String displayText, int width, int height, float uCoord, float vCoord, |
16 | + float uCoord2, float vCoord2, int texMapSize) | ||
15 | { | 17 | { |
16 | super(textureResource, displayText, width, height, uCoord, vCoord, uCoord2, vCoord2, texMapSize); | 18 | super(textureResource, displayText, width, height, uCoord, vCoord, uCoord2, vCoord2, texMapSize); |
17 | } | 19 | } |
src/client/java/com/mumfrey/liteloader/gl/GL.java
@@ -14,24 +14,29 @@ import org.lwjgl.util.glu.GLU; | @@ -14,24 +14,29 @@ import org.lwjgl.util.glu.GLU; | ||
14 | /** | 14 | /** |
15 | * Convenience class for working with Mojang's GLStateManager: | 15 | * Convenience class for working with Mojang's GLStateManager: |
16 | * | 16 | * |
17 | - * It would be pretty tolerable to work with GLStateManager as a static import were it not for the fact that you still need to | ||
18 | - * import the GL namespaces themselves from LWJGL in order to get the constants, and also have to deal with the fact that | ||
19 | - * GLStateManager's methods don't have "gl-style" names, making it annoying to work with. This class is designed to function as | ||
20 | - * an adapter to allow changeover to be more painless. Using this class means that the following code: | 17 | + * <p>It would be pretty tolerable to work with GLStateManager as a static |
18 | + * import were it not for the fact that you still need to import the GL | ||
19 | + * namespaces themselves from LWJGL in order to get the constants, and also have | ||
20 | + * to deal with the fact that GLStateManager's methods don't have "gl-style" | ||
21 | + * names, making it annoying to work with. This class is designed to function as | ||
22 | + * an adapter to allow changeover to be more painless. Using this class means | ||
23 | + * that the following code:</p> | ||
21 | * | 24 | * |
22 | - * glEnable(GL_BLEND); | ||
23 | - * glAlphaFunc(GL_GREATER, 0.0F); | 25 | + * <pre><code>glEnable(GL_BLEND); |
26 | + * glAlphaFunc(GL_GREATER, 0.0F);</code></pre> | ||
24 | * | 27 | * |
25 | - * becomes: | 28 | + * <p>becomes:</p> |
26 | * | 29 | * |
27 | - * glEnableBlend(); | ||
28 | - * glAlphaFunc(GL_GREATER, 0.0F); | 30 | + * <pre><code>glEnableBlend(); |
31 | + * glAlphaFunc(GL_GREATER, 0.0F);</code></pre> | ||
29 | * | 32 | * |
30 | - * Notice that the glAlphaFunc invokation remains unchanged, and the glEnable call simply gets replaced with a logical equivalent | ||
31 | - * which invokes the GLStateManager method behind the scenes. | 33 | + * <p>Notice that the <tt>glAlphaFunc</tt> invocation remains unchanged, and the |
34 | + * <tt>glEnable</tt> call simply gets replaced with a logical equivalent which | ||
35 | + * invokes the GLStateManager method behind the scenes.</p> | ||
32 | * | 36 | * |
33 | - * To use this class, simply replace existing static imports in your classes with this single static import, then change glEnable | ||
34 | - * and glDisable calls accordingly. | 37 | + * <p>To use this class, simply replace existing static imports in your classes |
38 | + * with this single static import, then change <tt>glEnable</tt> and <tt> | ||
39 | + * glDisable</tt> calls accordingly. | ||
35 | * | 40 | * |
36 | * @author Adam Mummery-Smith | 41 | * @author Adam Mummery-Smith |
37 | */ | 42 | */ |
@@ -1178,7 +1183,8 @@ public class GL | @@ -1178,7 +1183,8 @@ public class GL | ||
1178 | return GL11.glGetBoolean(pname); | 1183 | return GL11.glGetBoolean(pname); |
1179 | } | 1184 | } |
1180 | 1185 | ||
1181 | - public static void gluProject(float objx, float objy, float objz, FloatBuffer modelMatrix, FloatBuffer projMatrix, IntBuffer viewport, FloatBuffer winPos) | 1186 | + public static void gluProject(float objx, float objy, float objz, FloatBuffer modelMatrix, FloatBuffer projMatrix, IntBuffer viewport, |
1187 | + FloatBuffer winPos) | ||
1182 | { | 1188 | { |
1183 | GLU.gluProject(objx, objy, objz, modelMatrix, projMatrix, viewport, winPos); | 1189 | GLU.gluProject(objx, objy, objz, modelMatrix, projMatrix, viewport, winPos); |
1184 | } | 1190 | } |
src/client/java/com/mumfrey/liteloader/gl/GLClippingPlanes.java
@@ -8,11 +8,13 @@ import org.lwjgl.BufferUtils; | @@ -8,11 +8,13 @@ import org.lwjgl.BufferUtils; | ||
8 | import org.lwjgl.util.Rectangle; | 8 | import org.lwjgl.util.Rectangle; |
9 | 9 | ||
10 | /** | 10 | /** |
11 | - * OpenGL clipping plane convenience functions. We prefer to clip rectangular GUI regions in Minecraft using | ||
12 | - * clipping rather than scissor because scissor is a nuisance to work with, primarily because it works in | ||
13 | - * "window" (OpenGL window) coordinates and doesn't respect the current transformation matrix. Using clipping | ||
14 | - * planes we can specify clipping edges in "Minecraft screen coordinates", can optionally clip on only one or | ||
15 | - * two axes, and also don't need to worry about the current transform. | 11 | + * OpenGL clipping plane convenience functions. We prefer to clip rectangular |
12 | + * GUI regions in Minecraft using clipping rather than scissor because scissor | ||
13 | + * is a nuisance to work with, primarily because it works in "window" (OpenGL | ||
14 | + * window) coordinates and doesn't respect the current transformation matrix. | ||
15 | + * Using clipping planes we can specify clipping edges in "Minecraft screen | ||
16 | + * coordinates", can optionally clip on only one or two axes, and also don't | ||
17 | + * need to worry about the current transform. | ||
16 | * | 18 | * |
17 | * @author Adam Mummery-Smith | 19 | * @author Adam Mummery-Smith |
18 | */ | 20 | */ |
@@ -44,7 +46,7 @@ public final class GLClippingPlanes | @@ -44,7 +46,7 @@ public final class GLClippingPlanes | ||
44 | 46 | ||
45 | private static int totalClippingPlanes = glGetInteger(GL_MAX_CLIP_PLANES); | 47 | private static int totalClippingPlanes = glGetInteger(GL_MAX_CLIP_PLANES); |
46 | 48 | ||
47 | - // private static int frame = 0; | 49 | +// private static int frame = 0; |
48 | 50 | ||
49 | static | 51 | static |
50 | { | 52 | { |
src/client/java/com/mumfrey/liteloader/resources/InternalResourcePack.java
@@ -12,7 +12,8 @@ import net.minecraft.client.resources.data.IMetadataSerializer; | @@ -12,7 +12,8 @@ import net.minecraft.client.resources.data.IMetadataSerializer; | ||
12 | import net.minecraft.util.ResourceLocation; | 12 | import net.minecraft.util.ResourceLocation; |
13 | 13 | ||
14 | /** | 14 | /** |
15 | - * Resource pack which returns resources using Class::getResourceAsStream() on the specified class | 15 | + * Resource pack which returns resources using Class::getResourceAsStream() on |
16 | + * the specified class. | ||
16 | * | 17 | * |
17 | * @author Adam Mummery-Smith | 18 | * @author Adam Mummery-Smith |
18 | */ | 19 | */ |
@@ -50,7 +51,8 @@ public class InternalResourcePack implements IResourcePack | @@ -50,7 +51,8 @@ public class InternalResourcePack implements IResourcePack | ||
50 | } | 51 | } |
51 | 52 | ||
52 | /* (non-Javadoc) | 53 | /* (non-Javadoc) |
53 | - * @see net.minecraft.client.resources.IResourcePack#getInputStream(net.minecraft.util.ResourceLocation) | 54 | + * @see net.minecraft.client.resources.IResourcePack |
55 | + * #getInputStream(net.minecraft.util.ResourceLocation) | ||
54 | */ | 56 | */ |
55 | @Override | 57 | @Override |
56 | public InputStream getInputStream(ResourceLocation resourceLocation) throws IOException | 58 | public InputStream getInputStream(ResourceLocation resourceLocation) throws IOException |
@@ -63,11 +65,13 @@ public class InternalResourcePack implements IResourcePack | @@ -63,11 +65,13 @@ public class InternalResourcePack implements IResourcePack | ||
63 | */ | 65 | */ |
64 | private InputStream getResourceStream(ResourceLocation resourceLocation) | 66 | private InputStream getResourceStream(ResourceLocation resourceLocation) |
65 | { | 67 | { |
66 | - return this.resourceClass.getResourceAsStream(String.format("/assets/%s/%s", resourceLocation.getResourceDomain(), resourceLocation.getResourcePath())); | 68 | + return this.resourceClass.getResourceAsStream(String.format("/assets/%s/%s", |
69 | + resourceLocation.getResourceDomain(), resourceLocation.getResourcePath())); | ||
67 | } | 70 | } |
68 | 71 | ||
69 | /* (non-Javadoc) | 72 | /* (non-Javadoc) |
70 | - * @see net.minecraft.client.resources.IResourcePack#resourceExists(net.minecraft.util.ResourceLocation) | 73 | + * @see net.minecraft.client.resources.IResourcePack#resourceExists( |
74 | + * net.minecraft.util.ResourceLocation) | ||
71 | */ | 75 | */ |
72 | @Override | 76 | @Override |
73 | public boolean resourceExists(ResourceLocation resourceLocation) | 77 | public boolean resourceExists(ResourceLocation resourceLocation) |
@@ -85,7 +89,9 @@ public class InternalResourcePack implements IResourcePack | @@ -85,7 +89,9 @@ public class InternalResourcePack implements IResourcePack | ||
85 | } | 89 | } |
86 | 90 | ||
87 | /* (non-Javadoc) | 91 | /* (non-Javadoc) |
88 | - * @see net.minecraft.client.resources.IResourcePack#getPackMetadata(net.minecraft.client.resources.data.IMetadataSerializer, java.lang.String) | 92 | + * @see net.minecraft.client.resources.IResourcePack#getPackMetadata( |
93 | + * net.minecraft.client.resources.data.IMetadataSerializer, | ||
94 | + * java.lang.String) | ||
89 | */ | 95 | */ |
90 | @Override | 96 | @Override |
91 | public IMetadataSection getPackMetadata(IMetadataSerializer par1MetadataSerializer, String par2Str) throws IOException | 97 | public IMetadataSection getPackMetadata(IMetadataSerializer par1MetadataSerializer, String par2Str) throws IOException |
src/client/java/com/mumfrey/liteloader/resources/ModResourcePack.java
@@ -30,7 +30,9 @@ public class ModResourcePack extends FileResourcePack | @@ -30,7 +30,9 @@ public class ModResourcePack extends FileResourcePack | ||
30 | } | 30 | } |
31 | 31 | ||
32 | /* (non-Javadoc) | 32 | /* (non-Javadoc) |
33 | - * @see net.minecraft.client.resources.AbstractResourcePack#getPackMetadata(net.minecraft.client.resources.data.IMetadataSerializer, java.lang.String) | 33 | + * @see net.minecraft.client.resources.AbstractResourcePack#getPackMetadata( |
34 | + * net.minecraft.client.resources.data.IMetadataSerializer, | ||
35 | + * java.lang.String) | ||
34 | */ | 36 | */ |
35 | @Override | 37 | @Override |
36 | public IMetadataSection getPackMetadata(IMetadataSerializer metadataSerializer, String metadataSectionName) throws IOException | 38 | public IMetadataSection getPackMetadata(IMetadataSerializer metadataSerializer, String metadataSectionName) throws IOException |
src/client/java/com/mumfrey/liteloader/resources/ModResourcePackDir.java
@@ -30,7 +30,9 @@ public class ModResourcePackDir extends FolderResourcePack | @@ -30,7 +30,9 @@ public class ModResourcePackDir extends FolderResourcePack | ||
30 | } | 30 | } |
31 | 31 | ||
32 | /* (non-Javadoc) | 32 | /* (non-Javadoc) |
33 | - * @see net.minecraft.client.resources.AbstractResourcePack#getPackMetadata(net.minecraft.client.resources.data.IMetadataSerializer, java.lang.String) | 33 | + * @see net.minecraft.client.resources.AbstractResourcePack#getPackMetadata( |
34 | + * net.minecraft.client.resources.data.IMetadataSerializer, | ||
35 | + * java.lang.String) | ||
34 | */ | 36 | */ |
35 | @Override | 37 | @Override |
36 | public IMetadataSection getPackMetadata(IMetadataSerializer metadataSerializer, String metadataSectionName) throws IOException | 38 | public IMetadataSection getPackMetadata(IMetadataSerializer metadataSerializer, String metadataSectionName) throws IOException |
src/client/java/com/mumfrey/liteloader/util/InputManager.java
@@ -26,7 +26,8 @@ import com.mumfrey.liteloader.launch.LoaderProperties; | @@ -26,7 +26,8 @@ import com.mumfrey.liteloader.launch.LoaderProperties; | ||
26 | import com.mumfrey.liteloader.util.jinput.ComponentRegistry; | 26 | import com.mumfrey.liteloader.util.jinput.ComponentRegistry; |
27 | 27 | ||
28 | /** | 28 | /** |
29 | - * Mod input class, aggregates functionality from LiteLoader's mod key registration functions and JInputLib | 29 | + * Mod input class, aggregates functionality from LiteLoader's mod key |
30 | + * registration functions and JInputLib. | ||
30 | * | 31 | * |
31 | * @author Adam Mummery-Smith | 32 | * @author Adam Mummery-Smith |
32 | */ | 33 | */ |
@@ -55,8 +56,8 @@ public final class InputManager extends Input | @@ -55,8 +56,8 @@ public final class InputManager extends Input | ||
55 | private final List<KeyBinding> modKeyBindings = new ArrayList<KeyBinding>(); | 56 | private final List<KeyBinding> modKeyBindings = new ArrayList<KeyBinding>(); |
56 | 57 | ||
57 | /** | 58 | /** |
58 | - * Map of mod key bindings to their key codes, stored so that we don't need to cast from | ||
59 | - * string in the properties file every tick | 59 | + * Map of mod key bindings to their key codes, stored so that we don't need |
60 | + * to cast from string in the properties file every tick. | ||
60 | */ | 61 | */ |
61 | private final Map<KeyBinding, Integer> storedModKeyBindings = new HashMap<KeyBinding, Integer>(); | 62 | private final Map<KeyBinding, Integer> storedModKeyBindings = new HashMap<KeyBinding, Integer>(); |
62 | 63 | ||
@@ -130,7 +131,8 @@ public final class InputManager extends Input | @@ -130,7 +131,8 @@ public final class InputManager extends Input | ||
130 | { | 131 | { |
131 | try | 132 | try |
132 | { | 133 | { |
133 | - binding.setKeyCode(Integer.parseInt(this.keyMapSettings.getProperty(binding.getKeyDescription(), String.valueOf(binding.getKeyCode())))); | 134 | + int code = Integer.parseInt(this.keyMapSettings.getProperty(binding.getKeyDescription(), String.valueOf(binding.getKeyCode()))); |
135 | + binding.setKeyCode(code); | ||
134 | } | 136 | } |
135 | catch (NumberFormatException ex) {} | 137 | catch (NumberFormatException ex) {} |
136 | } | 138 | } |
@@ -148,7 +150,8 @@ public final class InputManager extends Input | @@ -148,7 +150,8 @@ public final class InputManager extends Input | ||
148 | } | 150 | } |
149 | 151 | ||
150 | /** | 152 | /** |
151 | - * Unregisters a registered keybind with the game settings class, thus removing it from the "controls" screen | 153 | + * Unregisters a registered keybind with the game settings class, thus |
154 | + * removing it from the "controls" screen. | ||
152 | * | 155 | * |
153 | * @param binding | 156 | * @param binding |
154 | */ | 157 | */ |
@@ -218,7 +221,8 @@ public final class InputManager extends Input | @@ -218,7 +221,8 @@ public final class InputManager extends Input | ||
218 | { | 221 | { |
219 | try | 222 | try |
220 | { | 223 | { |
221 | - this.keyMapSettings.store(new FileWriter(this.keyMapSettingsFile), "Mod key mappings for LiteLoader mods, stored here to avoid losing settings stored in options.txt"); | 224 | + this.keyMapSettings.store(new FileWriter(this.keyMapSettingsFile), |
225 | + "Mod key mappings for LiteLoader mods, stored here to avoid losing settings stored in options.txt"); | ||
222 | } | 226 | } |
223 | catch (IOException ex) {} | 227 | catch (IOException ex) {} |
224 | } | 228 | } |
@@ -233,18 +237,21 @@ public final class InputManager extends Input | @@ -233,18 +237,21 @@ public final class InputManager extends Input | ||
233 | } | 237 | } |
234 | 238 | ||
235 | /** | 239 | /** |
236 | - * Returns a handle to the event described by descriptor (or null if no component is found matching the | ||
237 | - * descriptor. Retrieving an event via this method adds the controller (if found) to the polling list and | ||
238 | - * causes it to raise events against the specified handler. | 240 | + * Returns a handle to the event described by descriptor (or null if no |
241 | + * component is found matching the descriptor. Retrieving an event via this | ||
242 | + * method adds the controller (if found) to the polling list and causes it | ||
243 | + * to raise events against the specified handler. | ||
239 | * | 244 | * |
240 | - * This method returns an {@link InputEvent} which is passed as an argument to the relevant callback on | ||
241 | - * the supplied handler in order to identify the event. For example: | 245 | + * <p>This method returns an {@link InputEvent} which is passed as an |
246 | + * argument to the relevant callback on the supplied handler in order to | ||
247 | + * identify the event. For example:</p> | ||
242 | * | 248 | * |
243 | - * this.joystickButton = input.getEvent(descriptor, this); | 249 | + * <code>this.joystickButton = input.getEvent(descriptor, this);</code> |
244 | * | 250 | * |
245 | - * then in onAxisEvent | 251 | + * <p>then in onAxisEvent</p> |
246 | * | 252 | * |
247 | - * if (source == this.joystickButton) // do something with button | 253 | + * <code>if (source == this.joystickButton) // do something with button |
254 | + * </code> | ||
248 | * | 255 | * |
249 | * @param descriptor | 256 | * @param descriptor |
250 | * @param handler | 257 | * @param handler |
src/client/java/com/mumfrey/liteloader/util/ModUtilities.java
@@ -79,7 +79,8 @@ public abstract class ModUtilities | @@ -79,7 +79,8 @@ public abstract class ModUtilities | ||
79 | } | 79 | } |
80 | else | 80 | else |
81 | { | 81 | { |
82 | - LiteLoaderLogger.warning("Attempted to set renderer %s for entity class %s but the operation failed", renderer.getClass().getSimpleName(), entityClass.getSimpleName()); | 82 | + LiteLoaderLogger.warning("Attempted to set renderer %s for entity class %s but the operation failed", |
83 | + renderer.getClass().getSimpleName(), entityClass.getSimpleName()); | ||
83 | } | 84 | } |
84 | } | 85 | } |
85 | 86 | ||
@@ -90,13 +91,15 @@ public abstract class ModUtilities | @@ -90,13 +91,15 @@ public abstract class ModUtilities | ||
90 | 91 | ||
91 | try | 92 | try |
92 | { | 93 | { |
93 | - Map<Class<? extends TileEntity>, TileEntitySpecialRenderer> specialRendererMap = PrivateFieldsClient.specialRendererMap.get(tileEntityRenderer); | 94 | + Map<Class<? extends TileEntity>, TileEntitySpecialRenderer> specialRendererMap |
95 | + = PrivateFieldsClient.specialRendererMap.get(tileEntityRenderer); | ||
94 | specialRendererMap.put(tileEntityClass, renderer); | 96 | specialRendererMap.put(tileEntityClass, renderer); |
95 | renderer.setRendererDispatcher(tileEntityRenderer); | 97 | renderer.setRendererDispatcher(tileEntityRenderer); |
96 | } | 98 | } |
97 | catch (Exception ex) | 99 | catch (Exception ex) |
98 | { | 100 | { |
99 | - LiteLoaderLogger.warning("Attempted to set renderer %s for tile entity class %s but the operation failed", renderer.getClass().getSimpleName(), tileEntityClass.getSimpleName()); | 101 | + LiteLoaderLogger.warning("Attempted to set renderer %s for tile entity class %s but the operation failed", |
102 | + renderer.getClass().getSimpleName(), tileEntityClass.getSimpleName()); | ||
100 | } | 103 | } |
101 | } | 104 | } |
102 | 105 | ||
@@ -213,7 +216,8 @@ public abstract class ModUtilities | @@ -213,7 +216,8 @@ public abstract class ModUtilities | ||
213 | /** | 216 | /** |
214 | * Abstraction helper function | 217 | * Abstraction helper function |
215 | * | 218 | * |
216 | - * @param fieldName Name of field to get, returned unmodified if in debug mode | 219 | + * @param fieldName Name of field to get, returned unmodified if in debug |
220 | + * mode | ||
217 | * @return Obfuscated field name if present | 221 | * @return Obfuscated field name if present |
218 | * @deprecated use ObfuscationUtilities.getObfuscatedFieldName instead | 222 | * @deprecated use ObfuscationUtilities.getObfuscatedFieldName instead |
219 | */ | 223 | */ |
@@ -272,7 +276,8 @@ public abstract class ModUtilities | @@ -272,7 +276,8 @@ public abstract class ModUtilities | ||
272 | return null; | 276 | return null; |
273 | } | 277 | } |
274 | 278 | ||
275 | - private static void setFinalStaticField(Field field, Object value) throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException | 279 | + private static void setFinalStaticField(Field field, Object value) |
280 | + throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException | ||
276 | { | 281 | { |
277 | Field modifiers = Field.class.getDeclaredField("modifiers"); | 282 | Field modifiers = Field.class.getDeclaredField("modifiers"); |
278 | modifiers.setAccessible(true); | 283 | modifiers.setAccessible(true); |
src/debug/java/com/mumfrey/liteloader/debug/LoginManager.java
@@ -61,28 +61,33 @@ public class LoginManager | @@ -61,28 +61,33 @@ public class LoginManager | ||
61 | private File jsonFile; | 61 | private File jsonFile; |
62 | 62 | ||
63 | /** | 63 | /** |
64 | - * Username read from the auth JSON file, we use this as the default in the login dialog in | ||
65 | - * case login fails. This is stored in the JSON even if authentication is not successful so that | ||
66 | - * we can display the same username next time | 64 | + * Username read from the auth JSON file, we use this as the default in the |
65 | + * login dialog in case login fails. This is stored in the JSON even if | ||
66 | + * authentication is not successful so that we can display the same username | ||
67 | + * next time. | ||
67 | */ | 68 | */ |
68 | private String defaultUsername; | 69 | private String defaultUsername; |
69 | 70 | ||
70 | /** | 71 | /** |
71 | - * Minecraft screen name read from the auth JSON file. Use this as default in case the login fails | ||
72 | - * or is skipped (when offline) so that at least the Minecraft client has a sensible display name. | ||
73 | - * Defaults to user.name when not specified | 72 | + * Minecraft screen name read from the auth JSON file. Use this as default |
73 | + * in case the login fails or is skipped (when offline) so that at least the | ||
74 | + * Minecraft client has a sensible display name. | ||
75 | + * | ||
76 | + * <p>Defaults to user.name when not specified</p> | ||
74 | */ | 77 | */ |
75 | private String defaultDisplayName = System.getProperty("user.name"); | 78 | private String defaultDisplayName = System.getProperty("user.name"); |
76 | 79 | ||
77 | /** | 80 | /** |
78 | - * True if login should not be attempted, skips the authentication attempt and the login dialog | 81 | + * True if login should not be attempted, skips the authentication attempt |
82 | + * and the login dialog. | ||
79 | */ | 83 | */ |
80 | private boolean offline = false; | 84 | private boolean offline = false; |
81 | 85 | ||
82 | /** | 86 | /** |
83 | - * If authentication fails with token then the first attempt will be to use the user/pass specified | ||
84 | - * on the command line (if any). This flag is set AFTER that first attempt so that we know to display | ||
85 | - * the login dialog anyway (eg. the login on the command line was bad) | 87 | + * If authentication fails with token then the first attempt will be to use |
88 | + * the user/pass specified on the command line (if any). This flag is set | ||
89 | + * <b>after</b> that first attempt so that we know to display the login | ||
90 | + * dialog anyway (eg. the login on the command line was bad). | ||
86 | */ | 91 | */ |
87 | private boolean forceShowLoginDialog = false; | 92 | private boolean forceShowLoginDialog = false; |
88 | 93 | ||
@@ -100,8 +105,8 @@ public class LoginManager | @@ -100,8 +105,8 @@ public class LoginManager | ||
100 | } | 105 | } |
101 | 106 | ||
102 | /** | 107 | /** |
103 | - * When authenticaion fails, we regenerate the auth service and agent because trying again with the same | ||
104 | - * client data will fail. | 108 | + * When authenticaion fails, we regenerate the auth service and agent |
109 | + * because trying again with the same client data will fail. | ||
105 | */ | 110 | */ |
106 | public void resetAuth() | 111 | public void resetAuth() |
107 | { | 112 | { |
@@ -181,18 +186,24 @@ public class LoginManager | @@ -181,18 +186,24 @@ public class LoginManager | ||
181 | } | 186 | } |
182 | 187 | ||
183 | /** | 188 | /** |
184 | - * Attempt to login. If authentication data are found on disk then tries first to log in with | ||
185 | - * the stored token. If the token login fails then attempts to log in with the username and password | ||
186 | - * specified. If no user or pass are specified or if they fail then displays a login dialog to | ||
187 | - * allow the user to login. If login succeeds then the token is stored on disk and the method | ||
188 | - * returns. | 189 | + * Attempt to login. If authentication data are found on disk then tries |
190 | + * first to log in with the stored token. If the token login fails then | ||
191 | + * attempts to log in with the username and password specified. If no user | ||
192 | + * or pass are specified or if they fail then displays a login dialog to | ||
193 | + * allow the user to login. If login succeeds then the token is stored on | ||
194 | + * disk and the method returns. | ||
189 | * | 195 | * |
190 | - * If the user presses cancel in the login dialog then the method returns false. | 196 | + * <p>If the user presses cancel in the login dialog then the method returns |
197 | + * false.</p> | ||
191 | * | 198 | * |
192 | - * @param username User name to log in with if token login fails, if null displays the login dialog immediately | ||
193 | - * @param password Password to log in with if token login fails, if null displays the login dialog immediately | ||
194 | - * @param remainingTries Number of loops to go through before giving up, decremented for each try, specify -1 for unlimited | ||
195 | - * @return false if the user presses cancel in the login dialog, otherwise returns true | 199 | + * @param username User name to log in with if token login fails, if null |
200 | + * displays the login dialog immediately | ||
201 | + * @param password Password to log in with if token login fails, if null | ||
202 | + * displays the login dialog immediately | ||
203 | + * @param remainingTries Number of loops to go through before giving up, | ||
204 | + * decremented for each try, specify -1 for unlimited | ||
205 | + * @return false if the user presses cancel in the login dialog, otherwise | ||
206 | + * returns true | ||
196 | */ | 207 | */ |
197 | public boolean login(String username, String password, int remainingTries) | 208 | public boolean login(String username, String password, int remainingTries) |
198 | { | 209 | { |
@@ -246,7 +257,14 @@ public class LoginManager | @@ -246,7 +257,14 @@ public class LoginManager | ||
246 | 257 | ||
247 | if (this.offline) | 258 | if (this.offline) |
248 | { | 259 | { |
249 | - if (JOptionPane.showConfirmDialog(null, "<html>You have chosen to work offline. You will never be prompted to log in again.<br /><br />If you would like to re-enable login please delete the file <span style=\"color: #0000FF\">.auth.json</span> from the working dir<br />or press Cancel to return to the login dialog.</html>", "Confirm work offline", JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE) == JOptionPane.CANCEL_OPTION) | 260 | + if (JOptionPane.showConfirmDialog(null, "<html>You have chosen to work offline. " |
261 | + + "You will never be prompted to log in again.<br /><br />" | ||
262 | + + "If you would like to re-enable login please delete the file <span style=\"color: #0000FF\">.auth.json</span> " | ||
263 | + + "from the working dir<br />" | ||
264 | + + "or press Cancel to return to the login dialog.</html>", | ||
265 | + "Confirm work offline", | ||
266 | + JOptionPane.OK_CANCEL_OPTION, | ||
267 | + JOptionPane.INFORMATION_MESSAGE) == JOptionPane.CANCEL_OPTION) | ||
250 | { | 268 | { |
251 | this.offline = false; | 269 | this.offline = false; |
252 | remainingTries = Math.max(remainingTries, 3); | 270 | remainingTries = Math.max(remainingTries, 3); |
@@ -329,7 +347,8 @@ public class LoginManager | @@ -329,7 +347,8 @@ public class LoginManager | ||
329 | public String getUserProperties() | 347 | public String getUserProperties() |
330 | { | 348 | { |
331 | PropertyMap userProperties = this.authentication.getUserProperties(); | 349 | PropertyMap userProperties = this.authentication.getUserProperties(); |
332 | - return userProperties != null ? (new GsonBuilder()).registerTypeAdapter(PropertyMap.class, new UserPropertiesSerializer()).create().toJson(userProperties) : "{}"; | 350 | + return userProperties != null ? (new GsonBuilder()).registerTypeAdapter(PropertyMap.class, |
351 | + new UserPropertiesSerializer()).create().toJson(userProperties) : "{}"; | ||
333 | } | 352 | } |
334 | 353 | ||
335 | class UserPropertiesSerializer implements JsonSerializer<PropertyMap> | 354 | class UserPropertiesSerializer implements JsonSerializer<PropertyMap> |
@@ -376,21 +395,27 @@ public class LoginManager | @@ -376,21 +395,27 @@ public class LoginManager | ||
376 | // default ctor for Gson | 395 | // default ctor for Gson |
377 | } | 396 | } |
378 | 397 | ||
379 | - public AuthData(YggdrasilAuthenticationService authService, YggdrasilUserAuthentication authentication, boolean workOffline, String defaultUserName, String defaultDisplayName) | 398 | + public AuthData(YggdrasilAuthenticationService authService, YggdrasilUserAuthentication authentication, boolean workOffline, |
399 | + String defaultUserName, String defaultDisplayName) | ||
380 | { | 400 | { |
381 | this.clientToken = authService.getClientToken(); | 401 | this.clientToken = authService.getClientToken(); |
382 | this.credentials = authentication.saveForStorage(); | 402 | this.credentials = authentication.saveForStorage(); |
383 | this.workOffline = workOffline; | 403 | this.workOffline = workOffline; |
384 | 404 | ||
385 | if (defaultUserName != null && !this.credentials.containsKey("username")) | 405 | if (defaultUserName != null && !this.credentials.containsKey("username")) |
406 | + { | ||
386 | this.credentials.put("username", defaultUserName); | 407 | this.credentials.put("username", defaultUserName); |
408 | + } | ||
387 | 409 | ||
388 | if (defaultDisplayName != null && !this.credentials.containsKey("displayName")) | 410 | if (defaultDisplayName != null && !this.credentials.containsKey("displayName")) |
411 | + { | ||
389 | this.credentials.put("displayName", defaultDisplayName); | 412 | this.credentials.put("displayName", defaultDisplayName); |
413 | + } | ||
390 | } | 414 | } |
391 | 415 | ||
392 | /** | 416 | /** |
393 | - * Called after Gson deserialisation to check that deserialisation was successful | 417 | + * Called after Gson deserialisation to check that deserialisation was |
418 | + * successful. | ||
394 | */ | 419 | */ |
395 | public boolean validate() | 420 | public boolean validate() |
396 | { | 421 | { |
@@ -426,7 +451,8 @@ public class LoginManager | @@ -426,7 +451,8 @@ public class LoginManager | ||
426 | 451 | ||
427 | public String getDisplayName() | 452 | public String getDisplayName() |
428 | { | 453 | { |
429 | - return this.credentials != null && this.credentials.containsKey("displayName") ? this.credentials.get("displayName").toString() : System.getProperty("user.name"); | 454 | + return this.credentials != null && this.credentials.containsKey("displayName") |
455 | + ? this.credentials.get("displayName").toString() : System.getProperty("user.name"); | ||
430 | } | 456 | } |
431 | } | 457 | } |
432 | } | 458 | } |
src/debug/java/com/mumfrey/liteloader/debug/LoginPanel.java
@@ -20,7 +20,8 @@ import javax.swing.border.EmptyBorder; | @@ -20,7 +20,8 @@ import javax.swing.border.EmptyBorder; | ||
20 | import javax.swing.border.TitledBorder; | 20 | import javax.swing.border.TitledBorder; |
21 | 21 | ||
22 | /** | 22 | /** |
23 | - * JPanel displayed in a JDialog to prompt the user for login credentials for minecraft | 23 | + * JPanel displayed in a JDialog to prompt the user for login credentials for |
24 | + * minecraft. | ||
24 | * | 25 | * |
25 | * @author Adam Mummery-Smith | 26 | * @author Adam Mummery-Smith |
26 | */ | 27 | */ |
@@ -77,7 +78,8 @@ public class LoginPanel extends JPanel | @@ -77,7 +78,8 @@ public class LoginPanel extends JPanel | ||
77 | 78 | ||
78 | this.panelCentre = new JPanel(); | 79 | this.panelCentre = new JPanel(); |
79 | this.panelCentre.setOpaque(false); | 80 | this.panelCentre.setOpaque(false); |
80 | - this.panelCentre.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Yggdrasil Login", TitledBorder.LEADING, TitledBorder.TOP, null, Color.WHITE)); | 81 | + this.panelCentre.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Yggdrasil Login", |
82 | + TitledBorder.LEADING, TitledBorder.TOP, null, Color.WHITE)); | ||
81 | this.panelLoginLayout = new GridBagLayout(); | 83 | this.panelLoginLayout = new GridBagLayout(); |
82 | this.panelLoginLayout.columnWidths = new int[] {30, 80, 120, 120, 30}; | 84 | this.panelLoginLayout.columnWidths = new int[] {30, 80, 120, 120, 30}; |
83 | this.panelLoginLayout.rowHeights = new int[] {24, 32, 32, 32}; | 85 | this.panelLoginLayout.rowHeights = new int[] {24, 32, 32, 32}; |
@@ -115,7 +117,8 @@ public class LoginPanel extends JPanel | @@ -115,7 +117,8 @@ public class LoginPanel extends JPanel | ||
115 | this.txtPassword.setText(password); | 117 | this.txtPassword.setText(password); |
116 | 118 | ||
117 | this.btnLogin = new JButton("Log in"); | 119 | this.btnLogin = new JButton("Log in"); |
118 | - this.btnLogin.addActionListener(new ActionListener() { | 120 | + this.btnLogin.addActionListener(new ActionListener() |
121 | + { | ||
119 | @Override public void actionPerformed(ActionEvent e) | 122 | @Override public void actionPerformed(ActionEvent e) |
120 | { | 123 | { |
121 | LoginPanel.this.onLoginClick(); | 124 | LoginPanel.this.onLoginClick(); |
@@ -123,7 +126,8 @@ public class LoginPanel extends JPanel | @@ -123,7 +126,8 @@ public class LoginPanel extends JPanel | ||
123 | }); | 126 | }); |
124 | 127 | ||
125 | this.btnCancel = new JButton("Cancel"); | 128 | this.btnCancel = new JButton("Cancel"); |
126 | - this.btnCancel.addActionListener(new ActionListener() { | 129 | + this.btnCancel.addActionListener(new ActionListener() |
130 | + { | ||
127 | @Override public void actionPerformed(ActionEvent e) | 131 | @Override public void actionPerformed(ActionEvent e) |
128 | { | 132 | { |
129 | LoginPanel.this.onCancelClick(); | 133 | LoginPanel.this.onCancelClick(); |
@@ -225,9 +229,13 @@ public class LoginPanel extends JPanel | @@ -225,9 +229,13 @@ public class LoginPanel extends JPanel | ||
225 | if (this.txtUsername.getText().length() > 0) | 229 | if (this.txtUsername.getText().length() > 0) |
226 | { | 230 | { |
227 | if (this.txtPassword.getText().length() > 0) | 231 | if (this.txtPassword.getText().length() > 0) |
232 | + { | ||
228 | this.txtUsername.select(0, this.txtUsername.getText().length()); | 233 | this.txtUsername.select(0, this.txtUsername.getText().length()); |
234 | + } | ||
229 | else | 235 | else |
236 | + { | ||
230 | this.txtPassword.requestFocusInWindow(); | 237 | this.txtPassword.requestFocusInWindow(); |
238 | + } | ||
231 | } | 239 | } |
232 | } | 240 | } |
233 | 241 |
src/debug/java/com/mumfrey/liteloader/debug/Start.java
@@ -18,7 +18,8 @@ import com.mumfrey.liteloader.launch.LiteLoaderTweakerServer; | @@ -18,7 +18,8 @@ import com.mumfrey.liteloader.launch.LiteLoaderTweakerServer; | ||
18 | import com.mumfrey.liteloader.util.log.LiteLoaderLogger; | 18 | import com.mumfrey.liteloader.util.log.LiteLoaderLogger; |
19 | 19 | ||
20 | /** | 20 | /** |
21 | - * Wrapper class for LaunchWrapper Main class, which logs in using Yggdrasil first so that online shizzle can be tested | 21 | + * Wrapper class for LaunchWrapper Main class, which logs in using Yggdrasil |
22 | + * first so that online shizzle can be tested. | ||
22 | * | 23 | * |
23 | * @author Adam Mummery-Smith | 24 | * @author Adam Mummery-Smith |
24 | */ | 25 | */ |
@@ -48,8 +49,9 @@ public abstract class Start | @@ -48,8 +49,9 @@ public abstract class Start | ||
48 | } | 49 | } |
49 | 50 | ||
50 | /** | 51 | /** |
51 | - * Process the launch-time args, since we may be being launched by GradleStart we need to parse | ||
52 | - * out any values passed in and ensure we replace them with our own | 52 | + * Process the launch-time args, since we may be being launched by |
53 | + * GradleStart we need to parse out any values passed in and ensure we | ||
54 | + * replace them with our own. | ||
53 | */ | 55 | */ |
54 | private static String[] processArgs(String[] args) | 56 | private static String[] processArgs(String[] args) |
55 | { | 57 | { |
@@ -77,14 +79,17 @@ public abstract class Start | @@ -77,14 +79,17 @@ public abstract class Start | ||
77 | for (String arg : args) | 79 | for (String arg : args) |
78 | { | 80 | { |
79 | if (target.equalsIgnoreCase(arg)) | 81 | if (target.equalsIgnoreCase(arg)) |
82 | + { | ||
80 | return true; | 83 | return true; |
84 | + } | ||
81 | } | 85 | } |
82 | 86 | ||
83 | return false; | 87 | return false; |
84 | } | 88 | } |
85 | 89 | ||
86 | /** | 90 | /** |
87 | - * Read the args from the command line into the qualified and unqualified collections | 91 | + * Read the args from the command line into the qualified and unqualified |
92 | + * collections. | ||
88 | */ | 93 | */ |
89 | private static void parseArgs(String[] args, List<String> unqualifiedArgs, Map<String, Set<String>> qualifiedArgs) | 94 | private static void parseArgs(String[] args, List<String> unqualifiedArgs, Map<String, Set<String>> qualifiedArgs) |
90 | { | 95 | { |
@@ -166,7 +171,9 @@ public abstract class Start | @@ -166,7 +171,9 @@ public abstract class Start | ||
166 | } | 171 | } |
167 | 172 | ||
168 | if (!Start.MULTI_VALUE_ARGS.contains(qualifier)) | 173 | if (!Start.MULTI_VALUE_ARGS.contains(qualifier)) |
174 | + { | ||
169 | args.clear(); | 175 | args.clear(); |
176 | + } | ||
170 | 177 | ||
171 | args.add(arg); | 178 | args.add(arg); |
172 | } | 179 | } |
src/main/java/com/mumfrey/liteloader/Configurable.java
@@ -3,15 +3,16 @@ package com.mumfrey.liteloader; | @@ -3,15 +3,16 @@ package com.mumfrey.liteloader; | ||
3 | import com.mumfrey.liteloader.modconfig.ConfigPanel; | 3 | import com.mumfrey.liteloader.modconfig.ConfigPanel; |
4 | 4 | ||
5 | /** | 5 | /** |
6 | - * Interface for mods which want to provide a configuration panel inside the "mod info" screen | 6 | + * Interface for mods which want to provide a configuration panel inside the |
7 | + * "mod info" screen. | ||
7 | * | 8 | * |
8 | * @author Adam Mummery-Smith | 9 | * @author Adam Mummery-Smith |
9 | */ | 10 | */ |
10 | public interface Configurable | 11 | public interface Configurable |
11 | { | 12 | { |
12 | /** | 13 | /** |
13 | - * Get the class of the configuration panel to use, the returned class must have a | ||
14 | - * default (no-arg) constructor | 14 | + * Get the class of the configuration panel to use, the returned class must |
15 | + * have a default (no-arg) constructor | ||
15 | * | 16 | * |
16 | * @return configuration panel class | 17 | * @return configuration panel class |
17 | */ | 18 | */ |
src/main/java/com/mumfrey/liteloader/LiteMod.java
@@ -20,15 +20,17 @@ public interface LiteMod extends Exposable, Listener | @@ -20,15 +20,17 @@ public interface LiteMod extends Exposable, Listener | ||
20 | public abstract String getVersion(); | 20 | public abstract String getVersion(); |
21 | 21 | ||
22 | /** | 22 | /** |
23 | - * Do startup stuff here, minecraft is not fully initialised when this function is called so mods *must not* | ||
24 | - * interact with minecraft in any way here | 23 | + * Do startup stuff here, minecraft is not fully initialised when this |
24 | + * function is called so mods <b>must not</b> interact with minecraft in any | ||
25 | + * way here. | ||
25 | * | 26 | * |
26 | * @param configPath Configuration path to use | 27 | * @param configPath Configuration path to use |
27 | */ | 28 | */ |
28 | public abstract void init(File configPath); | 29 | public abstract void init(File configPath); |
29 | 30 | ||
30 | /** | 31 | /** |
31 | - * Called when the loader detects that a version change has happened since this mod was last loaded | 32 | + * Called when the loader detects that a version change has happened since |
33 | + * this mod was last loaded. | ||
32 | * | 34 | * |
33 | * @param version new version | 35 | * @param version new version |
34 | * @param configPath Path for the new version-specific config | 36 | * @param configPath Path for the new version-specific config |
src/main/java/com/mumfrey/liteloader/PacketHandler.java
@@ -18,11 +18,15 @@ public interface PacketHandler extends LiteMod | @@ -18,11 +18,15 @@ public interface PacketHandler extends LiteMod | ||
18 | public List<Class<? extends Packet>> getHandledPackets(); | 18 | public List<Class<? extends Packet>> getHandledPackets(); |
19 | 19 | ||
20 | /** | 20 | /** |
21 | - * @param netHandler The vanilla nethandler which will handle this packet if not cancelled | 21 | + * @param netHandler The vanilla nethandler which will handle this packet if |
22 | + * not cancelled | ||
22 | * @param packet Incoming packet | 23 | * @param packet Incoming packet |
23 | - * @return True to allow further processing of this packet, including other PacketHandlers and eventually the vanilla netHandler, to inhibit further | ||
24 | - * processing return false. You may choose to return false and then invoke the vanilla handler method on the supplied INetHandler if you wish to | ||
25 | - * inhibit later PacketHandlers but preserve vanilla behaviour. | 24 | + * @return True to allow further processing of this packet, including other |
25 | + * PacketHandlers and eventually the vanilla netHandler, to inhibit | ||
26 | + * further processing return false. You may choose to return false and | ||
27 | + * then invoke the vanilla handler method on the supplied INetHandler | ||
28 | + * if you wish to inhibit later PacketHandlers but preserve vanilla | ||
29 | + * behaviour. | ||
26 | */ | 30 | */ |
27 | public abstract boolean handlePacket(INetHandler netHandler, Packet packet); | 31 | public abstract boolean handlePacket(INetHandler netHandler, Packet packet); |
28 | } | 32 | } |
src/main/java/com/mumfrey/liteloader/Permissible.java
@@ -11,9 +11,11 @@ import com.mumfrey.liteloader.permissions.PermissionsManagerClient; | @@ -11,9 +11,11 @@ import com.mumfrey.liteloader.permissions.PermissionsManagerClient; | ||
11 | public interface Permissible extends LiteMod | 11 | public interface Permissible extends LiteMod |
12 | { | 12 | { |
13 | /** | 13 | /** |
14 | - * Returns the node name of the mod, replicated permissions will be of the form mod.<name>.permission.node so this | ||
15 | - * method must return a valid name for use in permission nodes. This method must also return the same value every | ||
16 | - * time it is called since permissible names are not necessarily cached. | 14 | + * Returns the node name of the mod, replicated permissions will be of the |
15 | + * form mod.<name>.permission.node so this method must return a valid name | ||
16 | + * for use in permission nodes. This method must also return the same value | ||
17 | + * every time it is called since permissible names are not necessarily | ||
18 | + * cached. | ||
17 | * | 19 | * |
18 | * @return Permissible name | 20 | * @return Permissible name |
19 | */ | 21 | */ |
@@ -27,9 +29,10 @@ public interface Permissible extends LiteMod | @@ -27,9 +29,10 @@ public interface Permissible extends LiteMod | ||
27 | public abstract float getPermissibleModVersion(); | 29 | public abstract float getPermissibleModVersion(); |
28 | 30 | ||
29 | /** | 31 | /** |
30 | - * Called by the permissions manager at initialisation to instruct the mod to populate the list of permissions it | ||
31 | - * supports. This method should call back against the supplied permissions manager to register the permissions to | ||
32 | - * be sent to the server when connecting. | 32 | + * Called by the permissions manager at initialisation to instruct the mod |
33 | + * to populate the list of permissions it supports. This method should call | ||
34 | + * back against the supplied permissions manager to register the permissions | ||
35 | + * to be sent to the server when connecting. | ||
33 | * | 36 | * |
34 | * @param permissionsManager Client permissions manager | 37 | * @param permissionsManager Client permissions manager |
35 | */ | 38 | */ |
@@ -43,7 +46,8 @@ public interface Permissible extends LiteMod | @@ -43,7 +46,8 @@ public interface Permissible extends LiteMod | ||
43 | public abstract void onPermissionsCleared(PermissionsManager manager); | 46 | public abstract void onPermissionsCleared(PermissionsManager manager); |
44 | 47 | ||
45 | /** | 48 | /** |
46 | - * Called when the permissions are changed (eg. when new permissions are received from the server) | 49 | + * Called when the permissions are changed (eg. when new permissions are |
50 | + * received from the server) | ||
47 | * | 51 | * |
48 | * @param manager | 52 | * @param manager |
49 | */ | 53 | */ |
src/main/java/com/mumfrey/liteloader/PlayerInteractionListener.java
@@ -6,8 +6,8 @@ import net.minecraft.util.EnumFacing; | @@ -6,8 +6,8 @@ import net.minecraft.util.EnumFacing; | ||
6 | import net.minecraft.util.MovingObjectPosition.MovingObjectType; | 6 | import net.minecraft.util.MovingObjectPosition.MovingObjectType; |
7 | 7 | ||
8 | /** | 8 | /** |
9 | - * Interface for mods which want to observe the player's "interaction" status (player mouse clicks), allows block interaction | ||
10 | - * events to be cancelled. | 9 | + * Interface for mods which want to observe the player's "interaction" status |
10 | + * (player mouse clicks), allows block interaction events to be cancelled. | ||
11 | * | 11 | * |
12 | * @author Adam Mummery-Smith | 12 | * @author Adam Mummery-Smith |
13 | */ | 13 | */ |
@@ -23,28 +23,36 @@ public interface PlayerInteractionListener extends LiteMod | @@ -23,28 +23,36 @@ public interface PlayerInteractionListener extends LiteMod | ||
23 | } | 23 | } |
24 | 24 | ||
25 | /** | 25 | /** |
26 | - * Called when the player clicks but does not "hit" a block, the trace position is raytraced to the player's current view | ||
27 | - * distance and represents the block which the player is "looking at". This method is NOT called when the player right clicks | ||
28 | - * with an empty hand. | 26 | + * Called when the player clicks but does not "hit" a block, the trace |
27 | + * position is raytraced to the player's current view distance and | ||
28 | + * represents the block which the player is "looking at". This method is | ||
29 | + * <b>not</b> called when the player right clicks with an empty hand. | ||
29 | * | 30 | * |
30 | * @param player Player | 31 | * @param player Player |
31 | * @param button Mouse button the user clicked | 32 | * @param button Mouse button the user clicked |
32 | * @param tracePos Raytraced location of the block which was hit | 33 | * @param tracePos Raytraced location of the block which was hit |
33 | * @param traceSideHit Raytraced side hit | 34 | * @param traceSideHit Raytraced side hit |
34 | - * @param traceHitType Type of hit, will be MISS if the trace expired without hitting anything (eg. the player clicked the sky) | 35 | + * @param traceHitType Type of hit, will be MISS if the trace expired |
36 | + * without hitting anything (eg. the player clicked the sky) | ||
35 | */ | 37 | */ |
36 | - public abstract void onPlayerClickedAir(EntityPlayerMP player, MouseButton button, BlockPos tracePos, EnumFacing traceSideHit, MovingObjectType traceHitType); | 38 | + public abstract void onPlayerClickedAir(EntityPlayerMP player, MouseButton button, BlockPos tracePos, EnumFacing traceSideHit, |
39 | + MovingObjectType traceHitType); | ||
37 | 40 | ||
38 | /** | 41 | /** |
39 | - * Calls when the player clicks and hits a block, usually indicates that the player is digging or placing a block, although | ||
40 | - * a block placement does not necessarily succeed. Return true from this callback to allow the action to proceed, or false to | ||
41 | - * cancel the action. Cancelling the action does not prevent further handlers from receiving the event. | 42 | + * Calls when the player clicks and hits a block, usually indicates that the |
43 | + * player is digging or placing a block, although a block placement does not | ||
44 | + * necessarily succeed. Return true from this callback to allow the action | ||
45 | + * to proceed, or false to cancel the action. Cancelling the action does not | ||
46 | + * prevent further handlers from receiving the event. | ||
42 | * | 47 | * |
43 | * @param player Player | 48 | * @param player Player |
44 | - * @param button Mouse button that was pressed (left = dig, right = interact/place) | ||
45 | - * @param hitPos Block which was *hit*. Note that block placement will normally be at hitPos.offset(sideHit) | 49 | + * @param button Mouse button that was pressed, left = dig, right = interact |
50 | + * @param hitPos Block which was *hit*. Note that block placement will | ||
51 | + * normally be at hitPos.offset(sideHit) | ||
46 | * @param sideHit Side of the block which was hit | 52 | * @param sideHit Side of the block which was hit |
47 | - * @return true to allow the action to be processed (another listener may still inhibit the action), return false to cancel the action (other listeners will still be notified) | 53 | + * @return true to allow the action to be processed (another listener may |
54 | + * still inhibit the action), return false to cancel the action (other | ||
55 | + * listeners will still be notified) | ||
48 | */ | 56 | */ |
49 | public abstract boolean onPlayerClickedBlock(EntityPlayerMP player, MouseButton button, BlockPos hitPos, EnumFacing sideHit); | 57 | public abstract boolean onPlayerClickedBlock(EntityPlayerMP player, MouseButton button, BlockPos hitPos, EnumFacing sideHit); |
50 | } | 58 | } |
src/main/java/com/mumfrey/liteloader/PlayerMoveListener.java
@@ -18,9 +18,10 @@ public interface PlayerMoveListener extends LiteMod | @@ -18,9 +18,10 @@ public interface PlayerMoveListener extends LiteMod | ||
18 | * @param playerMP Player moving | 18 | * @param playerMP Player moving |
19 | * @param from Player's previous recorded position | 19 | * @param from Player's previous recorded position |
20 | * @param to Position the player is attempting to move to | 20 | * @param to Position the player is attempting to move to |
21 | - * @param newPos Set this position to teleport the player to newPos instead of processing the original move | ||
22 | - * | ||
23 | - * @return false to cancel the event or true to allow the movement to be processed as normal or newPos to be applied | 21 | + * @param newPos Set this position to teleport the player to newPos instead |
22 | + * of processing the original move | ||
23 | + * @return false to cancel the event or true to allow the movement to be | ||
24 | + * processed as normal or newPos to be applied | ||
24 | */ | 25 | */ |
25 | public abstract boolean onPlayerMove(EntityPlayerMP playerMP, Position from, Position to, ReturnValue<Position> newPos); | 26 | public abstract boolean onPlayerMove(EntityPlayerMP playerMP, Position from, Position to, ReturnValue<Position> newPos); |
26 | } | 27 | } |
src/main/java/com/mumfrey/liteloader/PluginChannelListener.java
@@ -12,7 +12,8 @@ import com.mumfrey.liteloader.core.CommonPluginChannelListener; | @@ -12,7 +12,8 @@ import com.mumfrey.liteloader.core.CommonPluginChannelListener; | ||
12 | public interface PluginChannelListener extends LiteMod, CommonPluginChannelListener | 12 | public interface PluginChannelListener extends LiteMod, CommonPluginChannelListener |
13 | { | 13 | { |
14 | /** | 14 | /** |
15 | - * Called when a custom payload packet arrives on a channel this mod has registered | 15 | + * Called when a custom payload packet arrives on a channel this mod has |
16 | + * registered. | ||
16 | * | 17 | * |
17 | * @param channel Channel on which the custom payload was received | 18 | * @param channel Channel on which the custom payload was received |
18 | * @param data Custom payload data | 19 | * @param data Custom payload data |
src/main/java/com/mumfrey/liteloader/PreJoinGameListener.java
@@ -5,18 +5,19 @@ import net.minecraft.network.play.server.S01PacketJoinGame; | @@ -5,18 +5,19 @@ import net.minecraft.network.play.server.S01PacketJoinGame; | ||
5 | 5 | ||
6 | 6 | ||
7 | /** | 7 | /** |
8 | - * Interface for mods which wish to be notified when the player connects to a server (or local game) | 8 | + * Interface for mods which wish to be notified when the player connects to a |
9 | + * server (or local game). | ||
9 | * | 10 | * |
10 | * @author Adam Mummery-Smith | 11 | * @author Adam Mummery-Smith |
11 | */ | 12 | */ |
12 | public interface PreJoinGameListener extends LiteMod | 13 | public interface PreJoinGameListener extends LiteMod |
13 | { | 14 | { |
14 | /** | 15 | /** |
15 | - * Called before login. NOTICE: as of 1.8 the return value of this method has a different meaning! | 16 | + * Called before login. NOTICE: as of 1.8 the return value of this method |
17 | + * has a different meaning! | ||
16 | * | 18 | * |
17 | * @param netHandler Net handler | 19 | * @param netHandler Net handler |
18 | * @param joinGamePacket Join game packet | 20 | * @param joinGamePacket Join game packet |
19 | - * | ||
20 | * @return true to allow login to continue, false to cancel login | 21 | * @return true to allow login to continue, false to cancel login |
21 | */ | 22 | */ |
22 | public abstract boolean onPreJoinGame(INetHandler netHandler, S01PacketJoinGame joinGamePacket); | 23 | public abstract boolean onPreJoinGame(INetHandler netHandler, S01PacketJoinGame joinGamePacket); |
src/main/java/com/mumfrey/liteloader/Priority.java
@@ -6,8 +6,8 @@ import java.lang.annotation.RetentionPolicy; | @@ -6,8 +6,8 @@ import java.lang.annotation.RetentionPolicy; | ||
6 | import java.lang.annotation.Target; | 6 | import java.lang.annotation.Target; |
7 | 7 | ||
8 | /** | 8 | /** |
9 | - * Priority declaration for LiteMods, used when sorting listener lists. Default value if no Priority annotation | ||
10 | - * is specified is 1000. | 9 | + * Priority declaration for LiteMods, used when sorting listener lists. Default |
10 | + * value if no Priority annotation is specified is 1000. | ||
11 | * | 11 | * |
12 | * @author Adam Mummery-Smith | 12 | * @author Adam Mummery-Smith |
13 | */ | 13 | */ |
src/main/java/com/mumfrey/liteloader/ServerChatFilter.java
@@ -11,7 +11,8 @@ import net.minecraft.network.play.client.C01PacketChatMessage; | @@ -11,7 +11,8 @@ import net.minecraft.network.play.client.C01PacketChatMessage; | ||
11 | public interface ServerChatFilter extends LiteMod | 11 | public interface ServerChatFilter extends LiteMod |
12 | { | 12 | { |
13 | /** | 13 | /** |
14 | - * Chat filter function, return false to filter this packet, true to pass the packet | 14 | + * Chat filter function, return false to filter this packet, true to pass |
15 | + * the packet. | ||
15 | * | 16 | * |
16 | * @param chatPacket Chat packet to examine | 17 | * @param chatPacket Chat packet to examine |
17 | * @param message Chat message | 18 | * @param message Chat message |
src/main/java/com/mumfrey/liteloader/ServerCommandProvider.java
@@ -11,8 +11,9 @@ import net.minecraft.command.ServerCommandManager; | @@ -11,8 +11,9 @@ import net.minecraft.command.ServerCommandManager; | ||
11 | public interface ServerCommandProvider extends LiteMod | 11 | public interface ServerCommandProvider extends LiteMod |
12 | { | 12 | { |
13 | /** | 13 | /** |
14 | - * Allows the mod to provide commands to the server command manager my invoking commandManager.registerCommand() to | ||
15 | - * provide new commands for single player and lan worlds | 14 | + * Allows the mod to provide commands to the server command manager by |
15 | + * invoking commandManager.registerCommand() to provide new commands for | ||
16 | + * single player and lan worlds | ||
16 | * | 17 | * |
17 | * @param commandManager | 18 | * @param commandManager |
18 | */ | 19 | */ |
src/main/java/com/mumfrey/liteloader/ServerPlayerListener.java
@@ -5,15 +5,17 @@ import net.minecraft.entity.player.EntityPlayerMP; | @@ -5,15 +5,17 @@ import net.minecraft.entity.player.EntityPlayerMP; | ||
5 | import com.mojang.authlib.GameProfile; | 5 | import com.mojang.authlib.GameProfile; |
6 | 6 | ||
7 | /** | 7 | /** |
8 | - * Interface for mods which want to handle players joining and leaving a LAN game (or single player game) | 8 | + * Interface for mods which want to handle players joining and leaving a LAN |
9 | + * game (or single player game) | ||
9 | * | 10 | * |
10 | * @author Adam Mummery-Smith | 11 | * @author Adam Mummery-Smith |
11 | */ | 12 | */ |
12 | public interface ServerPlayerListener extends LiteMod | 13 | public interface ServerPlayerListener extends LiteMod |
13 | { | 14 | { |
14 | /** | 15 | /** |
15 | - * Called when a player connects to the server and the EntityPlayerMP instance is created, the player has not logged | ||
16 | - * in at this point and may be disconnected if login fails | 16 | + * Called when a player connects to the server and the EntityPlayerMP |
17 | + * instance is created, the player has not logged in at this point and may | ||
18 | + * be disconnected if login fails. | ||
17 | * | 19 | * |
18 | * @param player Player attempting to connect | 20 | * @param player Player attempting to connect |
19 | * @param profile Player's GameProfile from the authentication service | 21 | * @param profile Player's GameProfile from the authentication service |
@@ -21,19 +23,22 @@ public interface ServerPlayerListener extends LiteMod | @@ -21,19 +23,22 @@ public interface ServerPlayerListener extends LiteMod | ||
21 | public abstract void onPlayerConnect(EntityPlayerMP player, GameProfile profile); | 23 | public abstract void onPlayerConnect(EntityPlayerMP player, GameProfile profile); |
22 | 24 | ||
23 | /** | 25 | /** |
24 | - * Called once the player has successfully logged in and all player variables are initialised and replicated | 26 | + * Called once the player has successfully logged in and all player |
27 | + * variables are initialised and replicated. | ||
25 | * | 28 | * |
26 | * @param player Player connected | 29 | * @param player Player connected |
27 | */ | 30 | */ |
28 | public abstract void onPlayerLoggedIn(EntityPlayerMP player); | 31 | public abstract void onPlayerLoggedIn(EntityPlayerMP player); |
29 | 32 | ||
30 | /** | 33 | /** |
31 | - * Called when a player respawns. This event is raised when a player respawns after dying or conquers the end | 34 | + * Called when a player respawns. This event is raised when a player |
35 | + * respawns after dying or conquers the end. | ||
32 | * | 36 | * |
33 | * @param player New player instance | 37 | * @param player New player instance |
34 | * @param oldPlayer Old player instance being discarded | 38 | * @param oldPlayer Old player instance being discarded |
35 | * @param newDimension Dimension the player is respawning in | 39 | * @param newDimension Dimension the player is respawning in |
36 | - * @param playerWonTheGame True if the player conquered the end (this respawn is NOT as the result of a death) | 40 | + * @param playerWonTheGame True if the player conquered the end (this |
41 | + * respawn is NOT as the result of a death) | ||
37 | */ | 42 | */ |
38 | public abstract void onPlayerRespawn(EntityPlayerMP player, EntityPlayerMP oldPlayer, int newDimension, boolean playerWonTheGame); | 43 | public abstract void onPlayerRespawn(EntityPlayerMP player, EntityPlayerMP oldPlayer, int newDimension, boolean playerWonTheGame); |
39 | 44 |
src/main/java/com/mumfrey/liteloader/ServerPluginChannelListener.java
@@ -6,14 +6,16 @@ import net.minecraft.network.PacketBuffer; | @@ -6,14 +6,16 @@ import net.minecraft.network.PacketBuffer; | ||
6 | import com.mumfrey.liteloader.core.CommonPluginChannelListener; | 6 | import com.mumfrey.liteloader.core.CommonPluginChannelListener; |
7 | 7 | ||
8 | /** | 8 | /** |
9 | - * Interface for mods which want to use plugin channels on the (integrated) server side | 9 | + * Interface for mods which want to use plugin channels on the (integrated) |
10 | + * server side. | ||
10 | * | 11 | * |
11 | * @author Adam Mummery-Smith | 12 | * @author Adam Mummery-Smith |
12 | */ | 13 | */ |
13 | public interface ServerPluginChannelListener extends CommonPluginChannelListener | 14 | public interface ServerPluginChannelListener extends CommonPluginChannelListener |
14 | { | 15 | { |
15 | /** | 16 | /** |
16 | - * Called when a custom payload packet arrives on a channel this mod has registered | 17 | + * Called when a custom payload packet arrives on a channel this mod has |
18 | + * registered. | ||
17 | * | 19 | * |
18 | * @param sender Player object which is the source of this message | 20 | * @param sender Player object which is the source of this message |
19 | * @param channel Channel on which the custom payload was received | 21 | * @param channel Channel on which the custom payload was received |
src/main/java/com/mumfrey/liteloader/ShutdownListener.java
1 | package com.mumfrey.liteloader; | 1 | package com.mumfrey.liteloader; |
2 | 2 | ||
3 | /** | 3 | /** |
4 | - * Interface for mods that want to receive an event when the game is shutting down due to a user request. They do | ||
5 | - * not receive the callback when the VM is terminating for other reasons, use a regular VM shutdownhook for that. | 4 | + * Interface for mods that want to receive an event when the game is shutting |
5 | + * down due to a user request. They do not receive the callback when the VM is | ||
6 | + * terminating for other reasons, use a regular VM shutdownhook for that. | ||
6 | * | 7 | * |
7 | * @author Adam Mummery-Smith | 8 | * @author Adam Mummery-Smith |
8 | */ | 9 | */ |
src/main/java/com/mumfrey/liteloader/api/BrandingProvider.java
@@ -9,94 +9,108 @@ import com.mumfrey.liteloader.util.render.Icon; | @@ -9,94 +9,108 @@ import com.mumfrey.liteloader.util.render.Icon; | ||
9 | /** | 9 | /** |
10 | * LiteLoader Extensible API - Branding Provider | 10 | * LiteLoader Extensible API - Branding Provider |
11 | * | 11 | * |
12 | - * The Branding Provider manages loader branding alterations for a particular API. This is an optional | ||
13 | - * API component which allows an API to specify customisations and additions to the loader environment | ||
14 | - * in order to provide a more comfortable integration for the API. | 12 | + * <p>The Branding Provider manages loader branding alterations for a particular |
13 | + * API. This is an optional API component which allows an API to specify | ||
14 | + * customisations and additions to the loader environment in order to provide a | ||
15 | + * more comfortable integration for the API.</p> | ||
15 | * | 16 | * |
16 | - * Since some branding options simply stack (like the API copyright notices for example) all APIs will | ||
17 | - * be allowed to supply this information, however other options (like the main logo image) can only be | ||
18 | - * set by one API. To determine which API should be used to set this information, the getPriority() | ||
19 | - * method will be called and used to sort branding providers by priority, with highest priority winning. | 17 | + * <p>Since some branding options simply stack (like the API copyright notices |
18 | + * for example) all APIs will be allowed to supply this information, however | ||
19 | + * other options (like the main logo image) can only be set by one API. To | ||
20 | + * determine which API should be used to set this information, the getPriority() | ||
21 | + * method will be called and used to sort branding providers by priority, with | ||
22 | + * highest priority winning.</p> | ||
20 | * | 23 | * |
21 | - * All branding options may return a null/not set value, allowing a branding provider to only override | ||
22 | - * the branding features it wishes. Some options require a non-null value to be returned from a set of | ||
23 | - * methods in order to take effect. eg. the logo option requires non-null return values from BOTH the | ||
24 | - * getLogoResource() and getLogoCoords() methods. | 24 | + * <p>All branding options may return a null/not set value, allowing a branding |
25 | + * provider to only override the branding features it wishes. Some options | ||
26 | + * require a non-null value to be returned from a set of methods in order to | ||
27 | + * take effect. eg. the logo option requires non-null return values from BOTH | ||
28 | + * the getLogoResource() and getLogoCoords() methods.</p> | ||
25 | * | 29 | * |
26 | * @author Adam Mummery-Smith | 30 | * @author Adam Mummery-Smith |
27 | */ | 31 | */ |
28 | public interface BrandingProvider extends CustomisationProvider | 32 | public interface BrandingProvider extends CustomisationProvider |
29 | { | 33 | { |
30 | /** | 34 | /** |
31 | - * Get the priority of this provider, higher numbers take precedence. Some brandings can only be set | ||
32 | - * by one provider (eg. the main "about" logo) so the branding provider with the highest priority will | ||
33 | - * be the one which gets control of that feature. | 35 | + * Get the priority of this provider, higher numbers take precedence. Some |
36 | + * brandings can only be set by one provider (eg. the main "about" logo) so | ||
37 | + * the branding provider with the highest priority will be the one which | ||
38 | + * gets control of that feature. | ||
34 | */ | 39 | */ |
35 | public abstract int getPriority(); | 40 | public abstract int getPriority(); |
36 | 41 | ||
37 | /** | 42 | /** |
38 | - * Get the primary branding colour for this API, the branding provider should return 0 if it | ||
39 | - * does not wish to override the branding colour. The branding colour is used for the mod list | ||
40 | - * entries and hyper-links within the about GUI panels, the colour returned should be fully opaque. | 43 | + * Get the primary branding colour for this API, the branding provider |
44 | + * should return 0 if it does not wish to override the branding colour. The | ||
45 | + * branding colour is used for the mod list entries and hyper-links within | ||
46 | + * the about GUI panels, the colour returned should be fully opaque. | ||
41 | */ | 47 | */ |
42 | public abstract int getBrandingColour(); | 48 | public abstract int getBrandingColour(); |
43 | 49 | ||
44 | /** | 50 | /** |
45 | - * Get the resource to use for the main logo, the API with the highest priority gets to define the | ||
46 | - * logo, this method can return null if this API does not want to override the logo | 51 | + * Get the resource to use for the main logo, the API with the highest |
52 | + * priority gets to define the logo, this method can return null if this API | ||
53 | + * does not want to override the logo. | ||
47 | */ | 54 | */ |
48 | public abstract ResourceLocation getLogoResource(); | 55 | public abstract ResourceLocation getLogoResource(); |
49 | 56 | ||
50 | /** | 57 | /** |
51 | - * Gets the coordinates of the logo as an IIcon instance, only called if getLogoResource() returns | ||
52 | - * a non-null value and the logo will only be used if BOTH methods return a valid object. | 58 | + * Gets the coordinates of the logo as an IIcon instance, only called if |
59 | + * getLogoResource() returns a non-null value and the logo will only be used | ||
60 | + * if BOTH methods return a valid object. | ||
53 | */ | 61 | */ |
54 | public abstract Icon getLogoCoords(); | 62 | public abstract Icon getLogoCoords(); |
55 | 63 | ||
56 | /** | 64 | /** |
57 | - * Get the resource to use for the icon logo (the chicken in the default setup), the API with the | ||
58 | - * highest priority gets to define the icon logo, this method can return null if this API does not | ||
59 | - * want to override the icon | 65 | + * Get the resource to use for the icon logo (the chicken in the default |
66 | + * setup), the API with the highest priority gets to define the icon logo, | ||
67 | + * this method can return null if this API does not want to override the | ||
68 | + * icon. | ||
60 | */ | 69 | */ |
61 | public abstract ResourceLocation getIconResource(); | 70 | public abstract ResourceLocation getIconResource(); |
62 | 71 | ||
63 | /** | 72 | /** |
64 | - * Gets the coordinates of the icon logo as an IIcon instance, only called if getIconResource() | ||
65 | - * returns a non-null value and the icon will only be used if BOTH methods return a valid object. | 73 | + * Gets the coordinates of the icon logo as an IIcon instance, only called |
74 | + * if getIconResource() returns a non-null value and the icon will only be | ||
75 | + * used if BOTH methods return a valid object. | ||
66 | */ | 76 | */ |
67 | public abstract Icon getIconCoords(); | 77 | public abstract Icon getIconCoords(); |
68 | 78 | ||
69 | /** | 79 | /** |
70 | - * Get the display name for this API, used on the "about" screen, must not return null | 80 | + * Get the display name for this API, used on the "about" screen, must not |
81 | + * return null. | ||
71 | */ | 82 | */ |
72 | public abstract String getDisplayName(); | 83 | public abstract String getDisplayName(); |
73 | 84 | ||
74 | /** | 85 | /** |
75 | - * Get the copyright text for this API, used on the "about" screen, must not return null | 86 | + * Get the copyright text for this API, used on the "about" screen, must not |
87 | + * return null. | ||
76 | */ | 88 | */ |
77 | public abstract String getCopyrightText(); | 89 | public abstract String getCopyrightText(); |
78 | 90 | ||
79 | /** | 91 | /** |
80 | - * Get the main home page URL for this API, used on the "about" screen, must not return null | 92 | + * Get the main home page URL for this API, used on the "about" screen, must |
93 | + * not return null. | ||
81 | */ | 94 | */ |
82 | public abstract URI getHomepage(); | 95 | public abstract URI getHomepage(); |
83 | 96 | ||
84 | /** | 97 | /** |
85 | - * If you wish to display a clickable twitter icon next to the API information in the "about" panel | ||
86 | - * then you must return values from this method as well as getTwitterAvatarResource() and | 98 | + * If you wish to display a clickable twitter icon next to the API |
99 | + * information in the "about" panel then you must return values from this | ||
100 | + * method as well as getTwitterAvatarResource() and | ||
87 | * getTwitterAvatarCoords(). Return the twitter user name here. | 101 | * getTwitterAvatarCoords(). Return the twitter user name here. |
88 | */ | 102 | */ |
89 | public abstract String getTwitterUserName(); | 103 | public abstract String getTwitterUserName(); |
90 | 104 | ||
91 | /** | 105 | /** |
92 | - * If you wish to display a clickable twitter icon next to the API information, return the icon | ||
93 | - * resource here. | 106 | + * If you wish to display a clickable twitter icon next to the API |
107 | + * information, return the icon resource here. | ||
94 | */ | 108 | */ |
95 | public abstract ResourceLocation getTwitterAvatarResource(); | 109 | public abstract ResourceLocation getTwitterAvatarResource(); |
96 | 110 | ||
97 | /** | 111 | /** |
98 | - * If you wish to display a clickable twitter icon next to the API information, return the icon | ||
99 | - * coordinates here. | 112 | + * If you wish to display a clickable twitter icon next to the API |
113 | + * information, return the icon coordinates here. | ||
100 | */ | 114 | */ |
101 | public abstract Icon getTwitterAvatarCoords(); | 115 | public abstract Icon getTwitterAvatarCoords(); |
102 | } | 116 | } |
src/main/java/com/mumfrey/liteloader/api/ContainerRegistry.java
@@ -36,7 +36,8 @@ public interface ContainerRegistry | @@ -36,7 +36,8 @@ public interface ContainerRegistry | ||
36 | } | 36 | } |
37 | 37 | ||
38 | /** | 38 | /** |
39 | - * Register an enabled container, removes the container from the disabled containers list if present | 39 | + * Register an enabled container, removes the container from the disabled |
40 | + * containers list if present. | ||
40 | */ | 41 | */ |
41 | public abstract void registerEnabledContainer(LoadableMod<?> container); | 42 | public abstract void registerEnabledContainer(LoadableMod<?> container); |
42 | 43 |
src/main/java/com/mumfrey/liteloader/api/CoreProvider.java
@@ -9,10 +9,11 @@ import com.mumfrey.liteloader.core.LiteLoaderMods; | @@ -9,10 +9,11 @@ import com.mumfrey.liteloader.core.LiteLoaderMods; | ||
9 | /** | 9 | /** |
10 | * LiteLoader Extensible API - API Core Provider | 10 | * LiteLoader Extensible API - API Core Provider |
11 | * | 11 | * |
12 | - * Core Providers are objects whose lifecycle is equivalent to the run time of game and thus the entire | ||
13 | - * lifecycle of your API, they are instanced early in the loader startup process. CoreProviders can implement | ||
14 | - * any Observer interface as appropriate and are automatically considered when allocating Observers to | ||
15 | - * callback lists | 12 | + * Core Providers are objects whose lifecycle is equivalent to the run time of |
13 | + * game and thus the entire lifecycle of your API, they are instanced early in | ||
14 | + * the loader startup process. CoreProviders can implement any Observer | ||
15 | + * interface as appropriate and are automatically considered when allocating | ||
16 | + * Observers to callback lists. | ||
16 | * | 17 | * |
17 | * @author Adam Mummery-Smith | 18 | * @author Adam Mummery-Smith |
18 | */ | 19 | */ |
@@ -21,33 +22,39 @@ public interface CoreProvider extends TickObserver, WorldObserver, ShutdownObser | @@ -21,33 +22,39 @@ public interface CoreProvider extends TickObserver, WorldObserver, ShutdownObser | ||
21 | public abstract void onInit(); | 22 | public abstract void onInit(); |
22 | 23 | ||
23 | /** | 24 | /** |
24 | - * During the postInit phase, the mods which were discovered during preInit phase are initialised and the | ||
25 | - * interfaces are allocated. This callback is invoked at the very start of the postInit phase, before mods | ||
26 | - * are initialised but after the point at which it is safe to assume it's ok to access game classes. This | ||
27 | - * is the first point at which the Minecraft game instance should be referenced. Be aware that certain game | ||
28 | - * classes (such as the EntityRenderer) are NOT initialised at this point. | 25 | + * During the postInit phase, the mods which were discovered during preInit |
26 | + * phase are initialised and the interfaces are allocated. This callback is | ||
27 | + * invoked at the very start of the postInit phase, before mods are | ||
28 | + * initialised but after the point at which it is safe to assume it's ok to | ||
29 | + * access game classes. This is the first point at which the Minecraft game | ||
30 | + * instance should be referenced. Be aware that certain game classes (such | ||
31 | + * as the EntityRenderer) are NOT initialised at this point. | ||
29 | * | 32 | * |
30 | * @param engine | 33 | * @param engine |
31 | */ | 34 | */ |
32 | public abstract void onPostInit(GameEngine<?, ?> engine); | 35 | public abstract void onPostInit(GameEngine<?, ?> engine); |
33 | 36 | ||
34 | /** | 37 | /** |
35 | - * Once the mods are initialised and the interfaces have been allocated, this callback is invoked to allow | ||
36 | - * the CoreProvider to perform any tasks which should be performed in the postInit phase but after mods | ||
37 | - * have been initialised. | 38 | + * Once the mods are initialised and the interfaces have been allocated, |
39 | + * this callback is invoked to allow the CoreProvider to perform any tasks | ||
40 | + * which should be performed in the postInit phase but after mods have been | ||
41 | + * initialised. | ||
38 | * | 42 | * |
39 | * @param mods | 43 | * @param mods |
40 | */ | 44 | */ |
41 | public abstract void onPostInitComplete(LiteLoaderMods mods); | 45 | public abstract void onPostInitComplete(LiteLoaderMods mods); |
42 | 46 | ||
43 | /** | 47 | /** |
44 | - * Called once startup is complete and the game loop begins running. This callback is invoked immediately | ||
45 | - * prior to the first "tick" event and immediately AFTER the the "late init" phase for mods (InitCompleteListener) | 48 | + * Called once startup is complete and the game loop begins running. This |
49 | + * callback is invoked immediately prior to the first "tick" event and | ||
50 | + * immediately <b>after</b> the the "late init" phase for mods | ||
51 | + * (InitCompleteListener). | ||
46 | */ | 52 | */ |
47 | public abstract void onStartupComplete(); | 53 | public abstract void onStartupComplete(); |
48 | 54 | ||
49 | /** | 55 | /** |
50 | - * Called immediately on joining a single or multi-player world when the JoinGame packet is received. Only called on the client. | 56 | + * Called immediately on joining a single or multi-player world when the |
57 | + * JoinGame packet is received. Only called on the client. | ||
51 | * | 58 | * |
52 | * @param netHandler | 59 | * @param netHandler |
53 | * @param loginPacket | 60 | * @param loginPacket |
src/main/java/com/mumfrey/liteloader/api/CustomisationProvider.java
1 | package com.mumfrey.liteloader.api; | 1 | package com.mumfrey.liteloader.api; |
2 | 2 | ||
3 | /** | 3 | /** |
4 | - * Base interface for loader customisation providers, has to be here so that we don't load branding provider classes too soon | 4 | + * Base interface for loader customisation providers, has to be here so that we |
5 | + * don't load branding provider classes too soon. | ||
5 | * | 6 | * |
6 | * @author Adam Mummery-Smith | 7 | * @author Adam Mummery-Smith |
7 | */ | 8 | */ |
src/main/java/com/mumfrey/liteloader/api/EnumerationObserver.java
@@ -11,8 +11,9 @@ import com.mumfrey.liteloader.interfaces.TweakContainer; | @@ -11,8 +11,9 @@ import com.mumfrey.liteloader.interfaces.TweakContainer; | ||
11 | /** | 11 | /** |
12 | * LiteLoader Extensible API - Enumeration observer | 12 | * LiteLoader Extensible API - Enumeration observer |
13 | * | 13 | * |
14 | - * EnumerationObserver receive callbacks when mod containers are enumerated. Instances of this class MUST be returned from | ||
15 | - * getPreInitObservers in order to work | 14 | + * EnumerationObserver receive callbacks when mod containers are enumerated. |
15 | + * Instances of this class <b>must</b> be returned from getPreInitObservers in | ||
16 | + * order to work. | ||
16 | * | 17 | * |
17 | * @author Adam Mummery-Smith | 18 | * @author Adam Mummery-Smith |
18 | */ | 19 | */ |
@@ -27,7 +28,8 @@ public interface EnumerationObserver extends Observer | @@ -27,7 +28,8 @@ public interface EnumerationObserver extends Observer | ||
27 | public abstract void onRegisterEnabledContainer(LoaderEnumerator enumerator, LoadableMod<?> container); | 28 | public abstract void onRegisterEnabledContainer(LoaderEnumerator enumerator, LoadableMod<?> container); |
28 | 29 | ||
29 | /** | 30 | /** |
30 | - * Called upon registration for every discovered container which is currently disabled, either because | 31 | + * Called upon registration for every discovered container which is |
32 | + * currently disabled, either because | ||
31 | * | 33 | * |
32 | * @param enumerator | 34 | * @param enumerator |
33 | * @param container | 35 | * @param container |
@@ -36,7 +38,8 @@ public interface EnumerationObserver extends Observer | @@ -36,7 +38,8 @@ public interface EnumerationObserver extends Observer | ||
36 | public abstract void onRegisterDisabledContainer(LoaderEnumerator enumerator, LoadableMod<?> container, DisabledReason reason); | 38 | public abstract void onRegisterDisabledContainer(LoaderEnumerator enumerator, LoadableMod<?> container, DisabledReason reason); |
37 | 39 | ||
38 | /** | 40 | /** |
39 | - * Called AFTER registration of an ENABLED container (eg. onRegisterEnabledContainer will be called first) if that container also | 41 | + * Called AFTER registration of an ENABLED container (eg. |
42 | + * onRegisterEnabledContainer will be called first) if that container also | ||
40 | * contains tweaks. | 43 | * contains tweaks. |
41 | * | 44 | * |
42 | * @param enumerator | 45 | * @param enumerator |
@@ -45,10 +48,14 @@ public interface EnumerationObserver extends Observer | @@ -45,10 +48,14 @@ public interface EnumerationObserver extends Observer | ||
45 | public abstract void onRegisterTweakContainer(LoaderEnumerator enumerator, TweakContainer<File> container); | 48 | public abstract void onRegisterTweakContainer(LoaderEnumerator enumerator, TweakContainer<File> container); |
46 | 49 | ||
47 | /** | 50 | /** |
48 | - * Called when a mod container is added to the pending mods list. This does not mean that the specific mod will actually be instanced since | ||
49 | - * the mod can still be disabled via the exclusion list (this is to allow entire containers to be disabled or just individual mods) and so | ||
50 | - * if you wish to observe actual mod instantiation you should still provide a {@link ResourceObserver}. However this event expresses a | ||
51 | - * declaration by the enumerator of an intention to load the specified mod. | 51 | + * Called when a mod container is added to the pending mods list. This does |
52 | + * not mean that the specific mod will actually be instanced since the mod | ||
53 | + * can still be disabled via the exclusion list (this is to allow entire | ||
54 | + * containers to be disabled or just individual mods) and so if you wish to | ||
55 | + * observe actual mod instantiation you should still provide a | ||
56 | + * {@link com.mumfrey.liteloader.client.ResourceObserver}. However this | ||
57 | + * event expresses a declaration by the enumerator of an intention to load | ||
58 | + * the specified mod. | ||
52 | * | 59 | * |
53 | * @param enumerator | 60 | * @param enumerator |
54 | * @param mod | 61 | * @param mod |
src/main/java/com/mumfrey/liteloader/api/EnumeratorModule.java
@@ -7,10 +7,12 @@ import com.mumfrey.liteloader.launch.LoaderProperties; | @@ -7,10 +7,12 @@ import com.mumfrey.liteloader.launch.LoaderProperties; | ||
7 | import net.minecraft.launchwrapper.LaunchClassLoader; | 7 | import net.minecraft.launchwrapper.LaunchClassLoader; |
8 | 8 | ||
9 | /** | 9 | /** |
10 | - * LiteLoader Extensible API - Interface for objects which can enumerate mods in places | 10 | + * LiteLoader Extensible API - Interface for objects which can enumerate mods in |
11 | + * places. | ||
11 | * | 12 | * |
12 | - * EnumeratorModules plug into the LoaderEnumerator and are used to discover mod containers in various | ||
13 | - * locations, for example searching in a specific folder for particular files. | 13 | + * <p>EnumeratorModules plug into the LoaderEnumerator and are used to discover |
14 | + * mod containers in various locations, for example searching in a specific | ||
15 | + * folder for particular files.</p> | ||
14 | * | 16 | * |
15 | * @author Adam Mummery-Smith | 17 | * @author Adam Mummery-Smith |
16 | */ | 18 | */ |
@@ -29,11 +31,13 @@ public interface EnumeratorModule | @@ -29,11 +31,13 @@ public interface EnumeratorModule | ||
29 | public abstract void writeSettings(LoaderEnvironment environment, LoaderProperties properties); | 31 | public abstract void writeSettings(LoaderEnvironment environment, LoaderProperties properties); |
30 | 32 | ||
31 | /** | 33 | /** |
32 | - * Find loadable mods in this enumerator's domain, the enumerator module should call back against the enumerator | ||
33 | - * itself to register containers it discovers using the registerModContainer() and registerTweakContainer() | 34 | + * Find loadable mods in this enumerator's domain, the enumerator module |
35 | + * should call back against the enumerator itself to register containers it | ||
36 | + * discovers using the registerModContainer() and registerTweakContainer() | ||
34 | * callbacks. | 37 | * callbacks. |
35 | * | 38 | * |
36 | - * This method is called during loader PREINIT phase so **DO NOT USE ANY GAME CLASSES HERE**! | 39 | + * <p>This method is called during loader PREINIT phase so <b>do not use any |
40 | + * game classes here</b>!</p> | ||
37 | * | 41 | * |
38 | * @param enumerator | 42 | * @param enumerator |
39 | * @param profile | 43 | * @param profile |
@@ -41,9 +45,10 @@ public interface EnumeratorModule | @@ -41,9 +45,10 @@ public interface EnumeratorModule | ||
41 | public abstract void enumerate(ModularEnumerator enumerator, String profile); | 45 | public abstract void enumerate(ModularEnumerator enumerator, String profile); |
42 | 46 | ||
43 | /** | 47 | /** |
44 | - * The enumerator module should inject (as required) any discovered containers into the classpath | 48 | + * The enumerator module should inject (as required) any discovered |
49 | + * containers into the classpath. | ||
45 | * | 50 | * |
46 | - * This method is called during the loader INIT phase | 51 | + * <p>This method is called during the loader INIT phase.</p> |
47 | * | 52 | * |
48 | * @param enumerator | 53 | * @param enumerator |
49 | * @param classLoader | 54 | * @param classLoader |
@@ -51,10 +56,10 @@ public interface EnumeratorModule | @@ -51,10 +56,10 @@ public interface EnumeratorModule | ||
51 | public abstract void injectIntoClassLoader(ModularEnumerator enumerator, LaunchClassLoader classLoader); | 56 | public abstract void injectIntoClassLoader(ModularEnumerator enumerator, LaunchClassLoader classLoader); |
52 | 57 | ||
53 | /** | 58 | /** |
54 | - * The enumerator module should callback against the enumerator using the registerModsFrom() callback to | ||
55 | - * register mods from discovered containers | 59 | + * The enumerator module should callback against the enumerator using the |
60 | + * registerModsFrom() callback to register mods from discovered containers. | ||
56 | * | 61 | * |
57 | - * This method is called during the loader INIT phase | 62 | + * <p>This method is called during the loader INIT phase</p> |
58 | * | 63 | * |
59 | * @param enumerator | 64 | * @param enumerator |
60 | * @param classLoader | 65 | * @param classLoader |
src/main/java/com/mumfrey/liteloader/api/EnumeratorPlugin.java
@@ -7,7 +7,8 @@ import com.mumfrey.liteloader.launch.LoaderEnvironment; | @@ -7,7 +7,8 @@ import com.mumfrey.liteloader.launch.LoaderEnvironment; | ||
7 | import com.mumfrey.liteloader.launch.LoaderProperties; | 7 | import com.mumfrey.liteloader.launch.LoaderProperties; |
8 | 8 | ||
9 | /** | 9 | /** |
10 | - * LiteLoader Extensible API - Interface for objects which can interact with the enumeration process, not yet available to APIs | 10 | + * LiteLoader Extensible API - Interface for objects which can interact with the |
11 | + * enumeration process, not yet available to APIs. | ||
11 | * | 12 | * |
12 | * @author Adam Mummery-Smith | 13 | * @author Adam Mummery-Smith |
13 | */ | 14 | */ |
@@ -24,7 +25,7 @@ public interface EnumeratorPlugin | @@ -24,7 +25,7 @@ public interface EnumeratorPlugin | ||
24 | * @param container Container to inspect | 25 | * @param container Container to inspect |
25 | * @param classloader ClassLoader for this container | 26 | * @param classloader ClassLoader for this container |
26 | * @param validator Mod class validator | 27 | * @param validator Mod class validator |
27 | - * @return | 28 | + * @return list of classes in the container |
28 | */ | 29 | */ |
29 | public abstract <T> List<Class<? extends T>> getClasses(LoadableMod<?> container, ClassLoader classloader, ModClassValidator validator); | 30 | public abstract <T> List<Class<? extends T>> getClasses(LoadableMod<?> container, ClassLoader classloader, ModClassValidator validator); |
30 | 31 |
src/main/java/com/mumfrey/liteloader/api/InterfaceProvider.java
@@ -5,8 +5,8 @@ import com.mumfrey.liteloader.core.InterfaceRegistrationDelegate; | @@ -5,8 +5,8 @@ import com.mumfrey.liteloader.core.InterfaceRegistrationDelegate; | ||
5 | /** | 5 | /** |
6 | * LiteLoader Extensible API - Interface Provider | 6 | * LiteLoader Extensible API - Interface Provider |
7 | * | 7 | * |
8 | - * InterfaceProviders are able to advertise and provide Listener interfaces which can be implemented | ||
9 | - * by mods or other Listener-derived classes | 8 | + * InterfaceProviders are able to advertise and provide Listener interfaces |
9 | + * which can be implemented by mods or other Listener-derived classes. | ||
10 | * | 10 | * |
11 | * @author Adam Mummery-Smith | 11 | * @author Adam Mummery-Smith |
12 | */ | 12 | */ |
@@ -18,8 +18,8 @@ public interface InterfaceProvider | @@ -18,8 +18,8 @@ public interface InterfaceProvider | ||
18 | public abstract Class<? extends Listener> getListenerBaseType(); | 18 | public abstract Class<? extends Listener> getListenerBaseType(); |
19 | 19 | ||
20 | /** | 20 | /** |
21 | - * The provider should call back against the supplied delegate in order to advertise the interfaces | ||
22 | - * it provides. | 21 | + * The provider should call back against the supplied delegate in order to |
22 | + * advertise the interfaces it provides. | ||
23 | * | 23 | * |
24 | * @param delegate | 24 | * @param delegate |
25 | */ | 25 | */ |
src/main/java/com/mumfrey/liteloader/api/Listener.java
1 | package com.mumfrey.liteloader.api; | 1 | package com.mumfrey.liteloader.api; |
2 | 2 | ||
3 | /** | 3 | /** |
4 | - * LiteLoader Extensible API - Listener is the base interface for (counter-intuitively) consumable Listener interfaces, in | ||
5 | - * that derived interfaces are consumable (from the point of view of the providers) but actual implementors consume the events | ||
6 | - * thus advertised by implementing those interfaces, making them themselves the consumers. Okay so that's probably pretty | ||
7 | - * confusing but I can't think of any better terminology so it's staying :) | 4 | + * LiteLoader Extensible API - Listener is the base interface for |
5 | + * (counter-intuitively) consumable Listener interfaces, in that derived | ||
6 | + * interfaces are consumable (from the point of view of the providers) but | ||
7 | + * actual implementors consume the events thus advertised by implementing those | ||
8 | + * interfaces, making them themselves the consumers. Okay so that's probably | ||
9 | + * pretty confusing but I can't think of any better terminology so it's | ||
10 | + * staying :) | ||
8 | * | 11 | * |
9 | * @author Adam Mummery-Smith | 12 | * @author Adam Mummery-Smith |
10 | */ | 13 | */ |
src/main/java/com/mumfrey/liteloader/api/LiteAPI.java
@@ -8,18 +8,22 @@ import com.mumfrey.liteloader.launch.LoaderProperties; | @@ -8,18 +8,22 @@ import com.mumfrey.liteloader.launch.LoaderProperties; | ||
8 | /** | 8 | /** |
9 | * LiteLoader Extensible API - main Mod API | 9 | * LiteLoader Extensible API - main Mod API |
10 | * | 10 | * |
11 | - * Implementors of this class don't really do anything except provide instances of other classes which make up the API proper. | ||
12 | - * Where possible, instance things as LATE as possible (eg. do not instance your CoreProviders in the constructor or init()) because | ||
13 | - * it's possible to screw up the game startup if things get loaded out of order, in general it's best to instance things only at | ||
14 | - * the earliest point in time at which they are needed. | 11 | + * <p>Implementors of this class don't really do anything except provide |
12 | + * instances of other classes which make up the API proper. Where possible, | ||
13 | + * instance things as <em>late</em> as possible (eg. do not instance your | ||
14 | + * CoreProviders in the constructor or init()) because it's possible to screw up | ||
15 | + * the game startup if things get loaded out of order, in general it's best to | ||
16 | + * instance things only at the earliest point in time at which they are needed. | ||
17 | + * </p> | ||
15 | * | 18 | * |
16 | * @author Adam Mummery-Smith | 19 | * @author Adam Mummery-Smith |
17 | */ | 20 | */ |
18 | public interface LiteAPI | 21 | public interface LiteAPI |
19 | { | 22 | { |
20 | /** | 23 | /** |
21 | - * Initialise this API, the API should do as little processing as possible here, but should also cache | ||
22 | - * the supplied environment and properties instances for later use | 24 | + * Initialise this API, the API should do as little processing as possible |
25 | + * here, but should also cache the supplied environment and properties | ||
26 | + * instances for later use. | ||
23 | * | 27 | * |
24 | * @param environment | 28 | * @param environment |
25 | * @param properties | 29 | * @param properties |
@@ -27,7 +31,8 @@ public interface LiteAPI | @@ -27,7 +31,8 @@ public interface LiteAPI | ||
27 | public abstract void init(LoaderEnvironment environment, LoaderProperties properties); | 31 | public abstract void init(LoaderEnvironment environment, LoaderProperties properties); |
28 | 32 | ||
29 | /** | 33 | /** |
30 | - * Get the identifier for this API, the identifier is used to retrieve the API and match it against specified mod API dependencies | 34 | + * Get the identifier for this API, the identifier is used to retrieve the |
35 | + * API and match it against specified mod API dependencies. | ||
31 | */ | 36 | */ |
32 | public abstract String getIdentifier(); | 37 | public abstract String getIdentifier(); |
33 | 38 | ||
@@ -42,50 +47,63 @@ public interface LiteAPI | @@ -42,50 +47,63 @@ public interface LiteAPI | ||
42 | public abstract String getVersion(); | 47 | public abstract String getVersion(); |
43 | 48 | ||
44 | /** | 49 | /** |
45 | - * Get the revision number of this API. Unlike the version number, the revision number should only change when an incompatible | ||
46 | - * change is made to the APIs interfaces, it is also used when a mod specifies an API dependency using the api@revision syntax | 50 | + * Get the revision number of this API. Unlike the version number, the |
51 | + * revision number should only change when an incompatible change is made to | ||
52 | + * the APIs interfaces, it is also used when a mod specifies an API | ||
53 | + * dependency using the api@revision syntax. | ||
47 | */ | 54 | */ |
48 | public abstract int getRevision(); | 55 | public abstract int getRevision(); |
49 | 56 | ||
50 | /** | 57 | /** |
51 | - * Should return an array of required transformer names, these transformers will be injected UPSTREAM. Can return null. | 58 | + * Should return an array of required transformer names, these transformers |
59 | + * will be injected UPSTREAM. Can return null. | ||
52 | */ | 60 | */ |
53 | public abstract String[] getRequiredTransformers(); | 61 | public abstract String[] getRequiredTransformers(); |
54 | 62 | ||
55 | /** | 63 | /** |
56 | - * Should return an array of required transformer names, these transformers will be injected DOWNSTREAM. Can return null. | 64 | + * Should return an array of required transformer names, these transformers |
65 | + * will be injected DOWNSTREAM. Can return null. | ||
57 | */ | 66 | */ |
58 | public abstract String[] getRequiredDownstreamTransformers(); | 67 | public abstract String[] getRequiredDownstreamTransformers(); |
59 | 68 | ||
60 | /** | 69 | /** |
61 | - * Return a mod class prefix supported by this API, can return null if an API just wants to use "LiteMod" as a standard class name prefix | 70 | + * Return a mod class prefix supported by this API, can return null if an |
71 | + * API just wants to use "LiteMod" as a standard class name prefix | ||
62 | */ | 72 | */ |
63 | public abstract String getModClassPrefix(); | 73 | public abstract String getModClassPrefix(); |
64 | 74 | ||
65 | /** | 75 | /** |
66 | - * Should return a list of Enumerator modules to be injected, can return null if the API doesn't want to inject any additonal modules | 76 | + * Should return a list of Enumerator modules to be injected, can return |
77 | + * null if the API doesn't want to inject any additonal modules | ||
67 | */ | 78 | */ |
68 | public abstract List<EnumeratorModule> getEnumeratorModules(); | 79 | public abstract List<EnumeratorModule> getEnumeratorModules(); |
69 | 80 | ||
70 | /** | 81 | /** |
71 | - * Should return a list of CoreProviders for this API, can return null if the API doesn't have any CoreProviders, (almost) guaranteed to only be called once | 82 | + * Should return a list of CoreProviders for this API, can return null if |
83 | + * the API doesn't have any CoreProviders, (almost) guaranteed to only be | ||
84 | + * called once. | ||
72 | */ | 85 | */ |
73 | public abstract List<CoreProvider> getCoreProviders(); | 86 | public abstract List<CoreProvider> getCoreProviders(); |
74 | 87 | ||
75 | /** | 88 | /** |
76 | - * Should return a list of InterfaceProviders for this API, can return null if the API doesn't have any InterfaceProviders, (almost) guaranteed to only be called once | 89 | + * Should return a list of InterfaceProviders for this API, can return null |
90 | + * if the API doesn't have any InterfaceProviders, (almost) guaranteed to | ||
91 | + * only be called once | ||
77 | */ | 92 | */ |
78 | public abstract List<InterfaceProvider> getInterfaceProviders(); | 93 | public abstract List<InterfaceProvider> getInterfaceProviders(); |
79 | 94 | ||
80 | /** | 95 | /** |
81 | - * Should return a list of Observers which are safe to instantiate during pre-init, for example EnumerationObservers. Can return null if the API doesn't have any | ||
82 | - * Observers. | 96 | + * Should return a list of Observers which are safe to instantiate during |
97 | + * pre-init, for example EnumerationObservers. Can return null if the API | ||
98 | + * doesn't have any Observers. | ||
83 | */ | 99 | */ |
84 | public abstract List<Observer> getPreInitObservers(); | 100 | public abstract List<Observer> getPreInitObservers(); |
85 | 101 | ||
86 | /** | 102 | /** |
87 | - * Should return a list of Observers for this API, can return null if the API doesn't have any Observers, (almost) guaranteed to only be called once. This list may | ||
88 | - * include Observers returned by getPreInitObservers if the observers are still required. | 103 | + * Should return a list of Observers for this API, can return null if the |
104 | + * API doesn't have any Observers, (almost) guaranteed to only be called | ||
105 | + * once. This list may include Observers returned by getPreInitObservers if | ||
106 | + * the observers are still required. | ||
89 | */ | 107 | */ |
90 | public abstract List<Observer> getObservers(); | 108 | public abstract List<Observer> getObservers(); |
91 | 109 |
src/main/java/com/mumfrey/liteloader/api/ModClassValidator.java
1 | package com.mumfrey.liteloader.api; | 1 | package com.mumfrey.liteloader.api; |
2 | 2 | ||
3 | /** | 3 | /** |
4 | - * Interface for object which validates whether a supplied mod class can be loaded | 4 | + * Interface for object which validates whether a supplied mod class can be |
5 | + * loaded. | ||
5 | * | 6 | * |
6 | * @author Adam Mummery-Smith | 7 | * @author Adam Mummery-Smith |
7 | */ | 8 | */ |
src/main/java/com/mumfrey/liteloader/api/ModInfoDecorator.java
@@ -8,7 +8,8 @@ import com.mumfrey.liteloader.util.render.IconTextured; | @@ -8,7 +8,8 @@ import com.mumfrey.liteloader.util.render.IconTextured; | ||
8 | /** | 8 | /** |
9 | * LiteLoader Extensible API - Branding Provider | 9 | * LiteLoader Extensible API - Branding Provider |
10 | * | 10 | * |
11 | - * Decorator for ModInfo classes, to alter the appearance of ModInfo entries in the mod list | 11 | + * Decorator for ModInfo classes, to alter the appearance of ModInfo entries in |
12 | + * the mod list. | ||
12 | * | 13 | * |
13 | * @author Adam Mummery-Smith | 14 | * @author Adam Mummery-Smith |
14 | */ | 15 | */ |
@@ -23,10 +24,12 @@ public interface ModInfoDecorator extends CustomisationProvider | @@ -23,10 +24,12 @@ public interface ModInfoDecorator extends CustomisationProvider | ||
23 | public abstract void addIcons(ModInfo<?> mod, List<IconTextured> icons); | 24 | public abstract void addIcons(ModInfo<?> mod, List<IconTextured> icons); |
24 | 25 | ||
25 | /** | 26 | /** |
26 | - * Allows this decorator to modify the status text for the specified mod, return null if no modification required | 27 | + * Allows this decorator to modify the status text for the specified mod, |
28 | + * return null if no modification required. | ||
27 | * | 29 | * |
28 | * @param statusText | 30 | * @param statusText |
29 | - * @return new status text or NULL to indicate the text should remain default | 31 | + * @return new status text or NULL to indicate the text should remain |
32 | + * default | ||
30 | */ | 33 | */ |
31 | public abstract String modifyStatusText(ModInfo<?> mod, String statusText); | 34 | public abstract String modifyStatusText(ModInfo<?> mod, String statusText); |
32 | 35 | ||
@@ -45,5 +48,6 @@ public interface ModInfoDecorator extends CustomisationProvider | @@ -45,5 +48,6 @@ public interface ModInfoDecorator extends CustomisationProvider | ||
45 | * @param titleColour | 48 | * @param titleColour |
46 | * @param statusColour | 49 | * @param statusColour |
47 | */ | 50 | */ |
48 | - public abstract void onDrawListEntry(int mouseX, int mouseY, float partialTicks, int xPosition, int yPosition, int width, int height, boolean selected, ModInfo<?> mod, int gradientColour, int titleColour, int statusColour); | 51 | + public abstract void onDrawListEntry(int mouseX, int mouseY, float partialTicks, int xPosition, int yPosition, int width, int height, |
52 | + boolean selected, ModInfo<?> mod, int gradientColour, int titleColour, int statusColour); | ||
49 | } | 53 | } |
src/main/java/com/mumfrey/liteloader/api/ModLoadObserver.java
@@ -9,21 +9,22 @@ import com.mumfrey.liteloader.interfaces.LoadableMod; | @@ -9,21 +9,22 @@ import com.mumfrey.liteloader.interfaces.LoadableMod; | ||
9 | /** | 9 | /** |
10 | * LiteLoader Extensible API - Mod Load Observer | 10 | * LiteLoader Extensible API - Mod Load Observer |
11 | * | 11 | * |
12 | - * ModLoadObservers receive callbacks when mod loading events are occurring, prior to init and other | ||
13 | - * loader-managed processes | 12 | + * ModLoadObservers receive callbacks when mod loading events are occurring, |
13 | + * prior to init and other loader-managed processes. | ||
14 | * | 14 | * |
15 | * @author Adam Mummery-Smith | 15 | * @author Adam Mummery-Smith |
16 | */ | 16 | */ |
17 | public interface ModLoadObserver extends Observer | 17 | public interface ModLoadObserver extends Observer |
18 | { | 18 | { |
19 | /** | 19 | /** |
20 | - * Called immediately after a mod instance is created, throw an exception from this method in | ||
21 | - * order to prevent further initialisation | 20 | + * Called immediately after a mod instance is created, throw an exception |
21 | + * from this method in order to prevent further initialisation. | ||
22 | */ | 22 | */ |
23 | public abstract void onModLoaded(LiteMod mod); | 23 | public abstract void onModLoaded(LiteMod mod); |
24 | 24 | ||
25 | /** | 25 | /** |
26 | - * Called after a mod is instanced and has been successfully added to the active mods list | 26 | + * Called after a mod is instanced and has been successfully added to the |
27 | + * active mods list. | ||
27 | * | 28 | * |
28 | * @param handle Mod handle | 29 | * @param handle Mod handle |
29 | */ | 30 | */ |
src/main/java/com/mumfrey/liteloader/api/Observer.java
@@ -3,8 +3,10 @@ package com.mumfrey.liteloader.api; | @@ -3,8 +3,10 @@ package com.mumfrey.liteloader.api; | ||
3 | /** | 3 | /** |
4 | * LiteLoader Extensible API - Observer base interface | 4 | * LiteLoader Extensible API - Observer base interface |
5 | * | 5 | * |
6 | - * Observers are essentially "core listeners" which are objects which make up the core a of a particular API implementation | ||
7 | - * and sink events generated by the Loader or by other observable components. See the derived interfaces for more detail. | 6 | + * <p>Observers are essentially "core listeners" which are objects which make up |
7 | + * the core a of a particular API implementation and sink events generated by | ||
8 | + * the Loader or by other observable components. See the derived interfaces for | ||
9 | + * more detail.</p> | ||
8 | * | 10 | * |
9 | * @author Adam Mummery-Smith | 11 | * @author Adam Mummery-Smith |
10 | */ | 12 | */ |
src/main/java/com/mumfrey/liteloader/api/PostRenderObserver.java
@@ -3,7 +3,8 @@ package com.mumfrey.liteloader.api; | @@ -3,7 +3,8 @@ package com.mumfrey.liteloader.api; | ||
3 | /** | 3 | /** |
4 | * LiteLoader Extensible API - Post-render Observers | 4 | * LiteLoader Extensible API - Post-render Observers |
5 | * | 5 | * |
6 | - * PostRenderObservers receive the onPostRender event every frame, allowing "draw-on-top" behaviour for API components | 6 | + * <p>PostRenderObservers receive the onPostRender event every frame, allowing |
7 | + * "draw-on-top" behaviour for API components.</p> | ||
7 | * | 8 | * |
8 | * @author Adam Mummery-Smith | 9 | * @author Adam Mummery-Smith |
9 | */ | 10 | */ |
src/main/java/com/mumfrey/liteloader/api/ShutdownObserver.java
@@ -3,8 +3,9 @@ package com.mumfrey.liteloader.api; | @@ -3,8 +3,9 @@ package com.mumfrey.liteloader.api; | ||
3 | /** | 3 | /** |
4 | * LiteLoader Extensible API - ShutDownObserver | 4 | * LiteLoader Extensible API - ShutDownObserver |
5 | * | 5 | * |
6 | - * ShutDownObservers receive an event when the game is shutting down due to a user request. They do NOT receive the | ||
7 | - * callback when the VM is terminating, use a regular VM shutdownhook for that. | 6 | + * ShutDownObservers receive an event when the game is shutting down due to a |
7 | + * user request. They do NOT receive the callback when the VM is terminating, | ||
8 | + * use a regular VM shutdownhook for that. | ||
8 | * | 9 | * |
9 | * @author Adam Mummery-Smith | 10 | * @author Adam Mummery-Smith |
10 | */ | 11 | */ |
src/main/java/com/mumfrey/liteloader/api/TranslationProvider.java
@@ -8,12 +8,14 @@ package com.mumfrey.liteloader.api; | @@ -8,12 +8,14 @@ package com.mumfrey.liteloader.api; | ||
8 | public interface TranslationProvider extends CustomisationProvider | 8 | public interface TranslationProvider extends CustomisationProvider |
9 | { | 9 | { |
10 | /** | 10 | /** |
11 | - * Translate the supplied key or return NULL if the provider has no translation for the specified key | 11 | + * Translate the supplied key or return NULL if the provider has no |
12 | + * translation for the specified key | ||
12 | */ | 13 | */ |
13 | public abstract String translate(String key, Object... args); | 14 | public abstract String translate(String key, Object... args); |
14 | 15 | ||
15 | /** | 16 | /** |
16 | - * Translate the supplied key to the specified locale, or return NULL if the provider has no translation for this key | 17 | + * Translate the supplied key to the specified locale, or return NULL if the |
18 | + * provider has no translation for this key | ||
17 | */ | 19 | */ |
18 | public abstract String translate(String locale, String key, Object... args); | 20 | public abstract String translate(String locale, String key, Object... args); |
19 | } | 21 | } |
src/main/java/com/mumfrey/liteloader/api/WorldObserver.java
@@ -5,8 +5,8 @@ import net.minecraft.world.World; | @@ -5,8 +5,8 @@ import net.minecraft.world.World; | ||
5 | /** | 5 | /** |
6 | * LiteLoader Extensible API - WorldObserver | 6 | * LiteLoader Extensible API - WorldObserver |
7 | * | 7 | * |
8 | - * WorldObservers receive a callback when the Minecraft.theWorld reference changes, beware the value is allowed | ||
9 | - * to be null | 8 | + * <p>WorldObservers receive a callback when the Minecraft.theWorld reference |
9 | + * changes, beware the value is allowed to be null.</p> | ||
10 | * | 10 | * |
11 | * @author Adam Mummery-Smith | 11 | * @author Adam Mummery-Smith |
12 | */ | 12 | */ |
src/main/java/com/mumfrey/liteloader/api/manager/APIAdapter.java
@@ -8,7 +8,8 @@ import com.mumfrey.liteloader.api.Observer; | @@ -8,7 +8,8 @@ import com.mumfrey.liteloader.api.Observer; | ||
8 | import com.mumfrey.liteloader.interfaces.InterfaceRegistry; | 8 | import com.mumfrey.liteloader.interfaces.InterfaceRegistry; |
9 | 9 | ||
10 | /** | 10 | /** |
11 | - * API Adapter provides convenience methods for invoking actions on ALL registered APIs | 11 | + * API Adapter provides convenience methods for invoking actions on ALL |
12 | + * registered APIs | ||
12 | * | 13 | * |
13 | * @author Adam Mummery-Smith | 14 | * @author Adam Mummery-Smith |
14 | */ | 15 | */ |
@@ -20,7 +21,8 @@ public interface APIAdapter | @@ -20,7 +21,8 @@ public interface APIAdapter | ||
20 | public abstract List<String> getRequiredTransformers(); | 21 | public abstract List<String> getRequiredTransformers(); |
21 | 22 | ||
22 | /** | 23 | /** |
23 | - * Aggregate and return required downstream transformers from all registered APIs | 24 | + * Aggregate and return required downstream transformers from all registered |
25 | + * APIs | ||
24 | */ | 26 | */ |
25 | public abstract List<String> getRequiredDownstreamTransformers(); | 27 | public abstract List<String> getRequiredDownstreamTransformers(); |
26 | 28 | ||
@@ -30,22 +32,27 @@ public interface APIAdapter | @@ -30,22 +32,27 @@ public interface APIAdapter | ||
30 | public abstract void registerInterfaces(InterfaceRegistry interfaceManager); | 32 | public abstract void registerInterfaces(InterfaceRegistry interfaceManager); |
31 | 33 | ||
32 | /** | 34 | /** |
33 | - * Get the CoreProviders for the specified API. Consuming classes should call this method instead of calling API::getCoreProviders() | ||
34 | - * directly since getCoreProviders() should only be invoked once and the resulting collection is cached by the API Adapter | 35 | + * Get the CoreProviders for the specified API. Consuming classes should |
36 | + * call this method instead of calling API::getCoreProviders() directly | ||
37 | + * since getCoreProviders() should only be invoked once and the resulting | ||
38 | + * collection is cached by the API Adapter | ||
35 | */ | 39 | */ |
36 | public abstract List<CoreProvider> getCoreProviders(); | 40 | public abstract List<CoreProvider> getCoreProviders(); |
37 | 41 | ||
38 | /** | 42 | /** |
39 | - * Get the observers for the specified API. Consuming classes should call this method instead of calling API::getObservers() directly | ||
40 | - * since getObservers() should only be invoked once and the resulting list is cached by the API Adapter | 43 | + * Get the observers for the specified API. Consuming classes should call |
44 | + * this method instead of calling API::getObservers() directly since | ||
45 | + * getObservers() should only be invoked once and the resulting list is | ||
46 | + * cached by the API Adapter | ||
41 | * | 47 | * |
42 | * @param api API to get observers for | 48 | * @param api API to get observers for |
43 | */ | 49 | */ |
44 | public abstract List<? extends Observer> getObservers(LiteAPI api); | 50 | public abstract List<? extends Observer> getObservers(LiteAPI api); |
45 | 51 | ||
46 | /** | 52 | /** |
47 | - * Get the observers for the specified API which implement the specified Observer interface. Always returns a valid list (even if | ||
48 | - * empty) and doesn't return null. | 53 | + * Get the observers for the specified API which implement the specified |
54 | + * Observer interface. Always returns a valid list (even if empty) and | ||
55 | + * doesn't return null. | ||
49 | * | 56 | * |
50 | * @param api API to get observers for | 57 | * @param api API to get observers for |
51 | * @param observerType type of observer to search for | 58 | * @param observerType type of observer to search for |
@@ -53,8 +60,9 @@ public interface APIAdapter | @@ -53,8 +60,9 @@ public interface APIAdapter | ||
53 | public abstract <T extends Observer> List<T> getObservers(LiteAPI api, Class<T> observerType); | 60 | public abstract <T extends Observer> List<T> getObservers(LiteAPI api, Class<T> observerType); |
54 | 61 | ||
55 | /** | 62 | /** |
56 | - * Get the observers for all registered APIs which implement the specified Observer interface. Always returns a valid list (even if | ||
57 | - * empty) and doesn't return null. Also includes core providers | 63 | + * Get the observers for all registered APIs which implement the specified |
64 | + * Observer interface. Always returns a valid list (even if empty) and | ||
65 | + * doesn't return null. Also includes core providers | ||
58 | * | 66 | * |
59 | * @param observerType type of observer to search for | 67 | * @param observerType type of observer to search for |
60 | */ | 68 | */ |
src/main/java/com/mumfrey/liteloader/api/manager/APIProvider.java
@@ -21,7 +21,8 @@ public interface APIProvider | @@ -21,7 +21,8 @@ public interface APIProvider | ||
21 | /** | 21 | /** |
22 | * Returns true if the specified API is available | 22 | * Returns true if the specified API is available |
23 | * | 23 | * |
24 | - * @param identifier API identifier (case sensitive) or API identifier-plus-minrevision in the form "identifier@minver" | 24 | + * @param identifier API identifier (case sensitive) or API |
25 | + * identifier-plus-minrevision in the form "identifier@minver" | ||
25 | */ | 26 | */ |
26 | public abstract boolean isAPIAvailable(String identifier); | 27 | public abstract boolean isAPIAvailable(String identifier); |
27 | 28 |
src/main/java/com/mumfrey/liteloader/api/manager/APIProviderBasic.java
@@ -56,7 +56,8 @@ class APIProviderBasic implements APIProvider, APIAdapter | @@ -56,7 +56,8 @@ class APIProviderBasic implements APIProvider, APIAdapter | ||
56 | } | 56 | } |
57 | 57 | ||
58 | /* (non-Javadoc) | 58 | /* (non-Javadoc) |
59 | - * @see com.mumfrey.liteloader.api.manager.APIProvider#getRequiredTransformers() | 59 | + * @see com.mumfrey.liteloader.api.manager.APIProvider |
60 | + * #getRequiredTransformers() | ||
60 | */ | 61 | */ |
61 | @Override | 62 | @Override |
62 | public List<String> getRequiredTransformers() | 63 | public List<String> getRequiredTransformers() |
@@ -76,7 +77,8 @@ class APIProviderBasic implements APIProvider, APIAdapter | @@ -76,7 +77,8 @@ class APIProviderBasic implements APIProvider, APIAdapter | ||
76 | } | 77 | } |
77 | 78 | ||
78 | /* (non-Javadoc) | 79 | /* (non-Javadoc) |
79 | - * @see com.mumfrey.liteloader.api.manager.APIProvider#getRequiredDownstreamTransformers() | 80 | + * @see com.mumfrey.liteloader.api.manager.APIProvider |
81 | + * #getRequiredDownstreamTransformers() | ||
80 | */ | 82 | */ |
81 | @Override | 83 | @Override |
82 | public List<String> getRequiredDownstreamTransformers() | 84 | public List<String> getRequiredDownstreamTransformers() |
@@ -96,7 +98,8 @@ class APIProviderBasic implements APIProvider, APIAdapter | @@ -96,7 +98,8 @@ class APIProviderBasic implements APIProvider, APIAdapter | ||
96 | } | 98 | } |
97 | 99 | ||
98 | /* (non-Javadoc) | 100 | /* (non-Javadoc) |
99 | - * @see com.mumfrey.liteloader.api.manager.APIProvider#getObservers(com.mumfrey.liteloader.api.LiteAPI) | 101 | + * @see com.mumfrey.liteloader.api.manager.APIProvider |
102 | + * #getObservers(com.mumfrey.liteloader.api.LiteAPI) | ||
100 | */ | 103 | */ |
101 | @Override | 104 | @Override |
102 | public List<? extends Observer> getObservers(LiteAPI api) | 105 | public List<? extends Observer> getObservers(LiteAPI api) |
@@ -152,7 +155,9 @@ class APIProviderBasic implements APIProvider, APIAdapter | @@ -152,7 +155,9 @@ class APIProviderBasic implements APIProvider, APIAdapter | ||
152 | for (CoreProvider coreProvider : this.getCoreProviders()) | 155 | for (CoreProvider coreProvider : this.getCoreProviders()) |
153 | { | 156 | { |
154 | if (observerType.isAssignableFrom(coreProvider.getClass()) && !matchingObservers.contains(coreProvider)) | 157 | if (observerType.isAssignableFrom(coreProvider.getClass()) && !matchingObservers.contains(coreProvider)) |
158 | + { | ||
155 | matchingObservers.add((T)coreProvider); | 159 | matchingObservers.add((T)coreProvider); |
160 | + } | ||
156 | } | 161 | } |
157 | 162 | ||
158 | return matchingObservers; | 163 | return matchingObservers; |
@@ -178,7 +183,9 @@ class APIProviderBasic implements APIProvider, APIAdapter | @@ -178,7 +183,9 @@ class APIProviderBasic implements APIProvider, APIAdapter | ||
178 | } | 183 | } |
179 | 184 | ||
180 | /* (non-Javadoc) | 185 | /* (non-Javadoc) |
181 | - * @see com.mumfrey.liteloader.api.manager.APIProvider#registerInterfaceProviders(com.mumfrey.liteloader.core.InterfaceManager) | 186 | + * @see com.mumfrey.liteloader.api.manager.APIProvider |
187 | + * #registerInterfaceProviders( | ||
188 | + * com.mumfrey.liteloader.core.InterfaceManager) | ||
182 | */ | 189 | */ |
183 | @Override | 190 | @Override |
184 | public void registerInterfaces(InterfaceRegistry interfaceManager) | 191 | public void registerInterfaces(InterfaceRegistry interfaceManager) |
@@ -224,7 +231,8 @@ class APIProviderBasic implements APIProvider, APIAdapter | @@ -224,7 +231,8 @@ class APIProviderBasic implements APIProvider, APIAdapter | ||
224 | } | 231 | } |
225 | 232 | ||
226 | /* (non-Javadoc) | 233 | /* (non-Javadoc) |
227 | - * @see com.mumfrey.liteloader.api.manager.APIProvider#isAPIAvailable(java.lang.String) | 234 | + * @see com.mumfrey.liteloader.api.manager.APIProvider |
235 | + * #isAPIAvailable(java.lang.String) | ||
228 | */ | 236 | */ |
229 | @Override | 237 | @Override |
230 | public boolean isAPIAvailable(String identifier) | 238 | public boolean isAPIAvailable(String identifier) |
@@ -242,7 +250,8 @@ class APIProviderBasic implements APIProvider, APIAdapter | @@ -242,7 +250,8 @@ class APIProviderBasic implements APIProvider, APIAdapter | ||
242 | } | 250 | } |
243 | 251 | ||
244 | /* (non-Javadoc) | 252 | /* (non-Javadoc) |
245 | - * @see com.mumfrey.liteloader.api.manager.APIProvider#isAPIAvailable(java.lang.String, int) | 253 | + * @see com.mumfrey.liteloader.api.manager.APIProvider |
254 | + * #isAPIAvailable(java.lang.String, int) | ||
246 | */ | 255 | */ |
247 | @Override | 256 | @Override |
248 | public boolean isAPIAvailable(String identifier, int minRevision) | 257 | public boolean isAPIAvailable(String identifier, int minRevision) |
@@ -254,7 +263,8 @@ class APIProviderBasic implements APIProvider, APIAdapter | @@ -254,7 +263,8 @@ class APIProviderBasic implements APIProvider, APIAdapter | ||
254 | } | 263 | } |
255 | 264 | ||
256 | /* (non-Javadoc) | 265 | /* (non-Javadoc) |
257 | - * @see com.mumfrey.liteloader.api.manager.APIProvider#getAPI(java.lang.String) | 266 | + * @see com.mumfrey.liteloader.api.manager.APIProvider |
267 | + * #getAPI(java.lang.String) | ||
258 | */ | 268 | */ |
259 | @Override | 269 | @Override |
260 | public LiteAPI getAPI(String identifier) | 270 | public LiteAPI getAPI(String identifier) |
@@ -263,7 +273,8 @@ class APIProviderBasic implements APIProvider, APIAdapter | @@ -263,7 +273,8 @@ class APIProviderBasic implements APIProvider, APIAdapter | ||
263 | } | 273 | } |
264 | 274 | ||
265 | /* (non-Javadoc) | 275 | /* (non-Javadoc) |
266 | - * @see com.mumfrey.liteloader.api.manager.APIProvider#getAPI(java.lang.Class) | 276 | + * @see com.mumfrey.liteloader.api.manager.APIProvider |
277 | + * #getAPI(java.lang.Class) | ||
267 | */ | 278 | */ |
268 | @SuppressWarnings("unchecked") | 279 | @SuppressWarnings("unchecked") |
269 | @Override | 280 | @Override |
@@ -274,7 +285,9 @@ class APIProviderBasic implements APIProvider, APIAdapter | @@ -274,7 +285,9 @@ class APIProviderBasic implements APIProvider, APIAdapter | ||
274 | for (LiteAPI api : this.apis) | 285 | for (LiteAPI api : this.apis) |
275 | { | 286 | { |
276 | if (apiClass.isAssignableFrom(api.getClass())) | 287 | if (apiClass.isAssignableFrom(api.getClass())) |
288 | + { | ||
277 | return (T)api; | 289 | return (T)api; |
290 | + } | ||
278 | } | 291 | } |
279 | } | 292 | } |
280 | catch (NullPointerException ex1) {} | 293 | catch (NullPointerException ex1) {} |
src/main/java/com/mumfrey/liteloader/api/manager/APIRegistry.java
@@ -17,8 +17,8 @@ import com.mumfrey.liteloader.util.log.LiteLoaderLogger; | @@ -17,8 +17,8 @@ import com.mumfrey.liteloader.util.log.LiteLoaderLogger; | ||
17 | import com.mumfrey.liteloader.util.log.LiteLoaderLogger.Verbosity; | 17 | import com.mumfrey.liteloader.util.log.LiteLoaderLogger.Verbosity; |
18 | 18 | ||
19 | /** | 19 | /** |
20 | - * This is where we register API classes during early startup before baking the registered list into an | ||
21 | - * APIProvider instance | 20 | + * This is where we register API classes during early startup before baking the |
21 | + * registered list into an APIProvider instance | ||
22 | * | 22 | * |
23 | * @author Adam Mummery-Smith | 23 | * @author Adam Mummery-Smith |
24 | */ | 24 | */ |
@@ -44,7 +44,8 @@ public final class APIRegistry | @@ -44,7 +44,8 @@ public final class APIRegistry | ||
44 | } | 44 | } |
45 | 45 | ||
46 | /** | 46 | /** |
47 | - * Register an API class, throws an exception if the API list has already been baked | 47 | + * Register an API class, throws an exception if the API list has already |
48 | + * been baked. | ||
48 | * | 49 | * |
49 | * @param apiClass | 50 | * @param apiClass |
50 | */ | 51 | */ |
@@ -52,7 +53,8 @@ public final class APIRegistry | @@ -52,7 +53,8 @@ public final class APIRegistry | ||
52 | { | 53 | { |
53 | if (this.baked != null) | 54 | if (this.baked != null) |
54 | { | 55 | { |
55 | - throw new InvalidAPIStateException("Unable to register API provider '" + apiClass + "' because the API state is now frozen, this probably means you are registering an API too late in the initialisation process"); | 56 | + throw new InvalidAPIStateException("Unable to register API provider '" + apiClass |
57 | + + "' because the API state is now frozen, this probably means you are registering an API too late in the initialisation process"); | ||
56 | } | 58 | } |
57 | 59 | ||
58 | if (!this.registeredAPIClasses.contains(apiClass)) | 60 | if (!this.registeredAPIClasses.contains(apiClass)) |
@@ -93,7 +95,8 @@ public final class APIRegistry | @@ -93,7 +95,8 @@ public final class APIRegistry | ||
93 | } | 95 | } |
94 | 96 | ||
95 | Class<? extends LiteAPI> conflictingAPIClass = this.instances.get(identifier).getClass(); | 97 | Class<? extends LiteAPI> conflictingAPIClass = this.instances.get(identifier).getClass(); |
96 | - LiteLoaderLogger.severe("API identifier clash while registering '%s', identifier '%s' clashes with '%s'", apiClassName, identifier, conflictingAPIClass); | 98 | + LiteLoaderLogger.severe("API identifier clash while registering '%s', identifier '%s' clashes with '%s'", apiClassName, |
99 | + identifier, conflictingAPIClass); | ||
97 | } | 100 | } |
98 | catch (ClassNotFoundException ex) | 101 | catch (ClassNotFoundException ex) |
99 | { | 102 | { |
@@ -133,7 +136,9 @@ public final class APIRegistry | @@ -133,7 +136,9 @@ public final class APIRegistry | ||
133 | } | 136 | } |
134 | 137 | ||
135 | /** | 138 | /** |
136 | - * Bakes all currently registered API classes to a new APIProvider containing the API instances | 139 | + * Bakes all currently registered API classes to a new APIProvider |
140 | + * containing the API instances. | ||
141 | + * | ||
137 | * @throws InvalidAPIStateException if the API list was already baked | 142 | * @throws InvalidAPIStateException if the API list was already baked |
138 | */ | 143 | */ |
139 | public APIProvider bake() throws InvalidAPIStateException | 144 | public APIProvider bake() throws InvalidAPIStateException |
src/main/java/com/mumfrey/liteloader/common/GameEngine.java
@@ -9,8 +9,10 @@ import net.minecraft.server.MinecraftServer; | @@ -9,8 +9,10 @@ import net.minecraft.server.MinecraftServer; | ||
9 | /** | 9 | /** |
10 | * @author Adam Mummery-Smith | 10 | * @author Adam Mummery-Smith |
11 | * | 11 | * |
12 | - * @param <TClient> Type of the client runtime, "Minecraft" on client and null on the server | ||
13 | - * @param <TServer> Type of the server runtime, "IntegratedServer" on the client, "MinecraftServer" on the server | 12 | + * @param <TClient> Type of the client runtime, "Minecraft" on client and null |
13 | + * on the server | ||
14 | + * @param <TServer> Type of the server runtime, "IntegratedServer" on the | ||
15 | + * client, "MinecraftServer" on the server | ||
14 | */ | 16 | */ |
15 | public interface GameEngine<TClient, TServer extends MinecraftServer> | 17 | public interface GameEngine<TClient, TServer extends MinecraftServer> |
16 | { | 18 | { |
@@ -20,7 +22,8 @@ public interface GameEngine<TClient, TServer extends MinecraftServer> | @@ -20,7 +22,8 @@ public interface GameEngine<TClient, TServer extends MinecraftServer> | ||
20 | public abstract boolean isClient(); | 22 | public abstract boolean isClient(); |
21 | 23 | ||
22 | /** | 24 | /** |
23 | - * True if the current environment is a server environment, always true on dedicated and true in single player | 25 | + * True if the current environment is a server environment, always true on |
26 | + * dedicated and true in single player. | ||
24 | */ | 27 | */ |
25 | public abstract boolean isServer(); | 28 | public abstract boolean isServer(); |
26 | 29 | ||
@@ -60,12 +63,14 @@ public interface GameEngine<TClient, TServer extends MinecraftServer> | @@ -60,12 +63,14 @@ public interface GameEngine<TClient, TServer extends MinecraftServer> | ||
60 | public abstract Profiler getProfiler(); | 63 | public abstract Profiler getProfiler(); |
61 | 64 | ||
62 | /** | 65 | /** |
63 | - * Get the keybinding list, only supported on client will throw an exception on the server | 66 | + * Get the keybinding list, only supported on client will throw an exception |
67 | + * on the server. | ||
64 | */ | 68 | */ |
65 | public abstract List<KeyBinding> getKeyBindings(); | 69 | public abstract List<KeyBinding> getKeyBindings(); |
66 | 70 | ||
67 | /** | 71 | /** |
68 | - * Set the keybinding list, only supported on client will throw an exception on the server | 72 | + * Set the keybinding list, only supported on client will throw an exception |
73 | + * on the server. | ||
69 | * | 74 | * |
70 | * @param keyBindings | 75 | * @param keyBindings |
71 | */ | 76 | */ |
src/main/java/com/mumfrey/liteloader/common/LoadingProgress.java
@@ -29,7 +29,7 @@ public abstract class LoadingProgress | @@ -29,7 +29,7 @@ public abstract class LoadingProgress | ||
29 | 29 | ||
30 | public static void setMessage(String format, String... args) | 30 | public static void setMessage(String format, String... args) |
31 | { | 31 | { |
32 | - if (LoadingProgress.instance != null) LoadingProgress.instance._setMessage(String.format(format, args)); | 32 | + if (LoadingProgress.instance != null) LoadingProgress.instance._setMessage(String.format(format, (Object[])args)); |
33 | } | 33 | } |
34 | 34 | ||
35 | public static void setMessage(String message) | 35 | public static void setMessage(String message) |
@@ -39,7 +39,7 @@ public abstract class LoadingProgress | @@ -39,7 +39,7 @@ public abstract class LoadingProgress | ||
39 | 39 | ||
40 | public static void incLiteLoaderProgress(String format, String... args) | 40 | public static void incLiteLoaderProgress(String format, String... args) |
41 | { | 41 | { |
42 | - if (LoadingProgress.instance != null) LoadingProgress.instance._incLiteLoaderProgress(String.format(format, args)); | 42 | + if (LoadingProgress.instance != null) LoadingProgress.instance._incLiteLoaderProgress(String.format(format, (Object[])args)); |
43 | } | 43 | } |
44 | 44 | ||
45 | public static void incLiteLoaderProgress(String message) | 45 | public static void incLiteLoaderProgress(String message) |
src/main/java/com/mumfrey/liteloader/common/Resources.java
@@ -10,7 +10,9 @@ public interface Resources<TResourceManager, TResourcePack> | @@ -10,7 +10,9 @@ public interface Resources<TResourceManager, TResourcePack> | ||
10 | public abstract void refreshResources(boolean force); | 10 | public abstract void refreshResources(boolean force); |
11 | 11 | ||
12 | /** | 12 | /** |
13 | - * Get the resource manager for the current environment, returns the SimpleReloadableResourceManager on client and ModResourceManager on the server | 13 | + * Get the resource manager for the current environment, returns the |
14 | + * SimpleReloadableResourceManager on client and ModResourceManager on the | ||
15 | + * server. | ||
14 | */ | 16 | */ |
15 | public abstract TResourceManager getResourceManager(); | 17 | public abstract TResourceManager getResourceManager(); |
16 | 18 |
src/main/java/com/mumfrey/liteloader/common/transformers/LiteLoaderEventTransformer.java
@@ -29,26 +29,26 @@ public abstract class LiteLoaderEventTransformer extends EventInjectionTransform | @@ -29,26 +29,26 @@ public abstract class LiteLoaderEventTransformer extends EventInjectionTransform | ||
29 | protected void addEvents() | 29 | protected void addEvents() |
30 | { | 30 | { |
31 | // Event declarations | 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); | 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 | 45 | ||
46 | // Injection Points | 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); | 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 | 52 | ||
53 | // Hooks | 53 | // Hooks |
54 | this.add(onInitializePlayerConnection, initPlayerConnection, (methodReturn), "onInitializePlayerConnection"); | 54 | this.add(onInitializePlayerConnection, initPlayerConnection, (methodReturn), "onInitializePlayerConnection"); |
src/main/java/com/mumfrey/liteloader/common/transformers/PacketEvent.java
@@ -21,7 +21,8 @@ import com.mumfrey.liteloader.transformers.event.EventInfo; | @@ -21,7 +21,8 @@ import com.mumfrey.liteloader.transformers.event.EventInfo; | ||
21 | public class PacketEvent extends Event | 21 | public class PacketEvent extends Event |
22 | { | 22 | { |
23 | /** | 23 | /** |
24 | - * Soft index for this packet, used as a lookup for speed when determining handlers | 24 | + * Soft index for this packet, used as a lookup for speed when determining |
25 | + * handlers. | ||
25 | */ | 26 | */ |
26 | private int packetIndex; | 27 | private int packetIndex; |
27 | 28 | ||
@@ -33,7 +34,8 @@ public class PacketEvent extends Event | @@ -33,7 +34,8 @@ public class PacketEvent extends Event | ||
33 | } | 34 | } |
34 | 35 | ||
35 | /* (non-Javadoc) | 36 | /* (non-Javadoc) |
36 | - * @see com.mumfrey.liteloader.transformers.event.Event#getEventInfoClassName() | 37 | + * @see com.mumfrey.liteloader.transformers.event.Event |
38 | + * #getEventInfoClassName() | ||
37 | */ | 39 | */ |
38 | @Override | 40 | @Override |
39 | public String getEventInfoClassName() | 41 | public String getEventInfoClassName() |
@@ -42,7 +44,9 @@ public class PacketEvent extends Event | @@ -42,7 +44,9 @@ public class PacketEvent extends Event | ||
42 | } | 44 | } |
43 | 45 | ||
44 | /* (non-Javadoc) | 46 | /* (non-Javadoc) |
45 | - * @see com.mumfrey.liteloader.transformers.event.Event#invokeEventInfoConstructor(org.objectweb.asm.tree.InsnList, boolean) | 47 | + * @see com.mumfrey.liteloader.transformers.event.Event |
48 | + * #invokeEventInfoConstructor(org.objectweb.asm.tree.InsnList, | ||
49 | + * boolean) | ||
46 | */ | 50 | */ |
47 | @Override | 51 | @Override |
48 | protected int invokeEventInfoConstructor(InsnList insns, boolean cancellable, boolean pushReturnValue, int marshallVar) | 52 | protected int invokeEventInfoConstructor(InsnList insns, boolean cancellable, boolean pushReturnValue, int marshallVar) |
@@ -53,7 +57,8 @@ public class PacketEvent extends Event | @@ -53,7 +57,8 @@ public class PacketEvent extends Event | ||
53 | insns.add(this.methodIsStatic ? new InsnNode(Opcodes.ACONST_NULL) : new VarInsnNode(Opcodes.ALOAD, 0)); ctorMAXS++; | 57 | insns.add(this.methodIsStatic ? new InsnNode(Opcodes.ACONST_NULL) : new VarInsnNode(Opcodes.ALOAD, 0)); ctorMAXS++; |
54 | insns.add(new InsnNode(cancellable ? Opcodes.ICONST_1 : Opcodes.ICONST_0)); ctorMAXS++; | 58 | insns.add(new InsnNode(cancellable ? Opcodes.ICONST_1 : Opcodes.ICONST_0)); ctorMAXS++; |
55 | insns.add(new IntInsnNode(Opcodes.BIPUSH, this.packetIndex)); | 59 | insns.add(new IntInsnNode(Opcodes.BIPUSH, this.packetIndex)); |
56 | - insns.add(new MethodInsnNode(Opcodes.INVOKESPECIAL, this.eventInfoClass, Obf.constructor.name, EventInfo.getConstructorDescriptor().replace(")", "I)"), false)); | 60 | + insns.add(new MethodInsnNode(Opcodes.INVOKESPECIAL, this.eventInfoClass, Obf.constructor.name, |
61 | + EventInfo.getConstructorDescriptor().replace(")", "I)"), false)); | ||
57 | 62 | ||
58 | return ctorMAXS; | 63 | return ctorMAXS; |
59 | } | 64 | } |
src/main/java/com/mumfrey/liteloader/core/CallbackProxyCommon.java
@@ -33,7 +33,8 @@ public abstract class CallbackProxyCommon | @@ -33,7 +33,8 @@ public abstract class CallbackProxyCommon | ||
33 | 33 | ||
34 | if (CallbackProxyCommon.eventBroker == null) | 34 | if (CallbackProxyCommon.eventBroker == null) |
35 | { | 35 | { |
36 | - throw new RuntimeException("LiteLoader failed to start up properly. The game is in an unstable state and must shut down now. Check the developer log for startup errors"); | 36 | + throw new RuntimeException("LiteLoader failed to start up properly." |
37 | + + " The game is in an unstable state and must shut down now. Check the developer log for startup errors"); | ||
37 | } | 38 | } |
38 | } | 39 | } |
39 | 40 | ||
@@ -57,7 +58,8 @@ public abstract class CallbackProxyCommon | @@ -57,7 +58,8 @@ public abstract class CallbackProxyCommon | ||
57 | CallbackProxyCommon.eventBroker.onSpawnPlayer(e.getSource(), e.getReturnValue(), profile); | 58 | CallbackProxyCommon.eventBroker.onSpawnPlayer(e.getSource(), e.getReturnValue(), profile); |
58 | } | 59 | } |
59 | 60 | ||
60 | - public static void onRespawnPlayer(ReturnEventInfo<ServerConfigurationManager, EntityPlayerMP> e, EntityPlayerMP oldPlayer, int dimension, boolean won) | 61 | + public static void onRespawnPlayer(ReturnEventInfo<ServerConfigurationManager, EntityPlayerMP> e, EntityPlayerMP oldPlayer, int dimension, |
62 | + boolean won) | ||
61 | { | 63 | { |
62 | CallbackProxyCommon.eventBroker.onRespawnPlayer(e.getSource(), e.getReturnValue(), oldPlayer, dimension, won); | 64 | CallbackProxyCommon.eventBroker.onRespawnPlayer(e.getSource(), e.getReturnValue(), oldPlayer, dimension, won); |
63 | } | 65 | } |
@@ -70,7 +72,8 @@ public abstract class CallbackProxyCommon | @@ -70,7 +72,8 @@ public abstract class CallbackProxyCommon | ||
70 | public static void onPlaceBlock(EventInfo<NetHandlerPlayServer> e, C08PacketPlayerBlockPlacement packet) | 72 | public static void onPlaceBlock(EventInfo<NetHandlerPlayServer> e, C08PacketPlayerBlockPlacement packet) |
71 | { | 73 | { |
72 | NetHandlerPlayServer netHandler = e.getSource(); | 74 | NetHandlerPlayServer netHandler = e.getSource(); |
73 | - if (!CallbackProxyCommon.eventBroker.onPlaceBlock(netHandler, netHandler.playerEntity, packet.getPosition(), EnumFacing.getFront(packet.getPlacedBlockDirection()))) | 75 | + if (!CallbackProxyCommon.eventBroker.onPlaceBlock(netHandler, netHandler.playerEntity, packet.getPosition(), |
76 | + EnumFacing.getFront(packet.getPlacedBlockDirection()))) | ||
74 | { | 77 | { |
75 | e.cancel(); | 78 | e.cancel(); |
76 | } | 79 | } |
@@ -96,7 +99,8 @@ public abstract class CallbackProxyCommon | @@ -96,7 +99,8 @@ public abstract class CallbackProxyCommon | ||
96 | } | 99 | } |
97 | } | 100 | } |
98 | 101 | ||
99 | - public static void onUseItem(ReturnEventInfo<ItemInWorldManager, Boolean> e, EntityPlayer player, World world, ItemStack itemStack, BlockPos pos, EnumFacing side, float par8, float par9, float par10) | 102 | + public static void onUseItem(ReturnEventInfo<ItemInWorldManager, Boolean> e, EntityPlayer player, World world, ItemStack itemStack, BlockPos pos, |
103 | + EnumFacing side, float par8, float par9, float par10) | ||
100 | { | 104 | { |
101 | if (!(player instanceof EntityPlayerMP)) | 105 | if (!(player instanceof EntityPlayerMP)) |
102 | { | 106 | { |
@@ -119,7 +123,8 @@ public abstract class CallbackProxyCommon | @@ -119,7 +123,8 @@ public abstract class CallbackProxyCommon | ||
119 | } | 123 | } |
120 | } | 124 | } |
121 | 125 | ||
122 | - public static void onPlayerMoved(EventInfo<NetHandlerPlayServer> e, C03PacketPlayer packet, WorldServer world, double oldPosX, double oldPosY, double oldPosZ) | 126 | + public static void onPlayerMoved(EventInfo<NetHandlerPlayServer> e, C03PacketPlayer packet, WorldServer world, double oldPosX, double oldPosY, |
127 | + double oldPosZ) | ||
123 | { | 128 | { |
124 | NetHandlerPlayServer netHandler = e.getSource(); | 129 | NetHandlerPlayServer netHandler = e.getSource(); |
125 | if (!CallbackProxyCommon.eventBroker.onPlayerMove(netHandler, packet, netHandler.playerEntity, world)) | 130 | if (!CallbackProxyCommon.eventBroker.onPlayerMove(netHandler, packet, netHandler.playerEntity, world)) |
@@ -128,7 +133,8 @@ public abstract class CallbackProxyCommon | @@ -128,7 +133,8 @@ public abstract class CallbackProxyCommon | ||
128 | } | 133 | } |
129 | } | 134 | } |
130 | 135 | ||
131 | - public static void onPlayerMoved(EventInfo<NetHandlerPlayServer> e, C03PacketPlayer packet, WorldServer world, double oldPosX, double oldPosY, double oldPosZ, double deltaMoveSq, double deltaX, double deltaY, double deltaZ) | 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 | { | 138 | { |
133 | NetHandlerPlayServer netHandler = e.getSource(); | 139 | NetHandlerPlayServer netHandler = e.getSource(); |
134 | if (!CallbackProxyCommon.eventBroker.onPlayerMove(netHandler, packet, netHandler.playerEntity, world)) | 140 | if (!CallbackProxyCommon.eventBroker.onPlayerMove(netHandler, packet, netHandler.playerEntity, world)) |
src/main/java/com/mumfrey/liteloader/core/ClientPluginChannels.java
@@ -22,7 +22,8 @@ public abstract class ClientPluginChannels extends PluginChannels<PluginChannelL | @@ -22,7 +22,8 @@ public abstract class ClientPluginChannels extends PluginChannels<PluginChannelL | ||
22 | 22 | ||
23 | protected ClientPluginChannels() | 23 | protected ClientPluginChannels() |
24 | { | 24 | { |
25 | - if (ClientPluginChannels.instance != null) throw new RuntimeException("Plugin Channels Startup Error", new InstantiationException("Only a single instance of ClientPluginChannels is allowed")); | 25 | + if (ClientPluginChannels.instance != null) throw new RuntimeException("Plugin Channels Startup Error", |
26 | + new InstantiationException("Only a single instance of ClientPluginChannels is allowed")); | ||
26 | ClientPluginChannels.instance = this; | 27 | ClientPluginChannels.instance = this; |
27 | } | 28 | } |
28 | 29 | ||
@@ -55,7 +56,9 @@ public abstract class ClientPluginChannels extends PluginChannels<PluginChannelL | @@ -55,7 +56,9 @@ public abstract class ClientPluginChannels extends PluginChannels<PluginChannelL | ||
55 | } | 56 | } |
56 | 57 | ||
57 | /* (non-Javadoc) | 58 | /* (non-Javadoc) |
58 | - * @see com.mumfrey.liteloader.api.InterfaceProvider#registerInterfaces(com.mumfrey.liteloader.core.InterfaceRegistrationDelegate) | 59 | + * @see com.mumfrey.liteloader.api.InterfaceProvider |
60 | + * #registerInterfaces( | ||
61 | + * com.mumfrey.liteloader.core.InterfaceRegistrationDelegate) | ||
59 | */ | 62 | */ |
60 | @Override | 63 | @Override |
61 | public void registerInterfaces(InterfaceRegistrationDelegate delegate) | 64 | public void registerInterfaces(InterfaceRegistrationDelegate delegate) |
@@ -118,11 +121,14 @@ public abstract class ClientPluginChannels extends PluginChannels<PluginChannelL | @@ -118,11 +121,14 @@ public abstract class ClientPluginChannels extends PluginChannels<PluginChannelL | ||
118 | { | 121 | { |
119 | int failCount = 1; | 122 | int failCount = 1; |
120 | if (this.faultingPluginChannelListeners.containsKey(pluginChannelListener)) | 123 | if (this.faultingPluginChannelListeners.containsKey(pluginChannelListener)) |
124 | + { | ||
121 | failCount = this.faultingPluginChannelListeners.get(pluginChannelListener).intValue() + 1; | 125 | failCount = this.faultingPluginChannelListeners.get(pluginChannelListener).intValue() + 1; |
126 | + } | ||
122 | 127 | ||
123 | if (failCount >= PluginChannels.WARN_FAULT_THRESHOLD) | 128 | if (failCount >= PluginChannels.WARN_FAULT_THRESHOLD) |
124 | { | 129 | { |
125 | - LiteLoaderLogger.warning("Plugin channel listener %s exceeded fault threshold on channel %s with %s", pluginChannelListener.getName(), channel, ex.getClass().getSimpleName()); | 130 | + LiteLoaderLogger.warning("Plugin channel listener %s exceeded fault threshold on channel %s with %s", |
131 | + pluginChannelListener.getName(), channel, ex.getClass().getSimpleName()); | ||
126 | this.faultingPluginChannelListeners.remove(pluginChannelListener); | 132 | this.faultingPluginChannelListeners.remove(pluginChannelListener); |
127 | } | 133 | } |
128 | else | 134 | else |
src/main/java/com/mumfrey/liteloader/core/CommonPluginChannelListener.java
@@ -5,16 +5,18 @@ import java.util.List; | @@ -5,16 +5,18 @@ import java.util.List; | ||
5 | import com.mumfrey.liteloader.api.Listener; | 5 | import com.mumfrey.liteloader.api.Listener; |
6 | 6 | ||
7 | /** | 7 | /** |
8 | - * Common interface for the client/server plugin channel listeners. DO NOT IMPLEMENT THIS INTERFACE DIRECTLY, nothing will happen! | 8 | + * Common interface for the client/server plugin channel listeners. <b>Do not |
9 | + * implement this interface directly</b>, nothing will happen! | ||
9 | * | 10 | * |
10 | * @author Adam Mummery-Smith | 11 | * @author Adam Mummery-Smith |
11 | */ | 12 | */ |
12 | public interface CommonPluginChannelListener extends Listener | 13 | public interface CommonPluginChannelListener extends Listener |
13 | { | 14 | { |
14 | /** | 15 | /** |
15 | - * Return a list of the plugin channels the mod wants to register | 16 | + * Return a list of the plugin channels the mod wants to register. |
16 | * | 17 | * |
17 | - * @return plugin channel names as a list, it is recommended to use {@link com.google.common.collect.ImmutableList#of} for this purpose | 18 | + * @return plugin channel names as a list, it is recommended to use |
19 | + * {@link com.google.common.collect.ImmutableList#of} for this purpose | ||
18 | */ | 20 | */ |
19 | public abstract List<String> getChannels(); | 21 | public abstract List<String> getChannels(); |
20 | } | 22 | } |
src/main/java/com/mumfrey/liteloader/core/Containers.java
@@ -92,7 +92,8 @@ class Containers implements ContainerRegistry | @@ -92,7 +92,8 @@ class Containers implements ContainerRegistry | ||
92 | } | 92 | } |
93 | 93 | ||
94 | /* (non-Javadoc) | 94 | /* (non-Javadoc) |
95 | - * @see com.mumfrey.liteloader.api.ContainerRegistry#isDisabledContainer(com.mumfrey.liteloader.interfaces.LoadableMod) | 95 | + * @see com.mumfrey.liteloader.api.ContainerRegistry |
96 | + * #isDisabledContainer(com.mumfrey.liteloader.interfaces.LoadableMod) | ||
96 | */ | 97 | */ |
97 | @Override | 98 | @Override |
98 | public boolean isDisabledContainer(LoadableMod<?> container) | 99 | public boolean isDisabledContainer(LoadableMod<?> container) |
@@ -101,7 +102,8 @@ class Containers implements ContainerRegistry | @@ -101,7 +102,8 @@ class Containers implements ContainerRegistry | ||
101 | } | 102 | } |
102 | 103 | ||
103 | /* (non-Javadoc) | 104 | /* (non-Javadoc) |
104 | - * @see com.mumfrey.liteloader.api.ContainerRegistry#getEnabledContainer(java.lang.String) | 105 | + * @see com.mumfrey.liteloader.api.ContainerRegistry |
106 | + * #getEnabledContainer(java.lang.String) | ||
105 | */ | 107 | */ |
106 | @Override | 108 | @Override |
107 | public LoadableMod<?> getEnabledContainer(String identifier) | 109 | public LoadableMod<?> getEnabledContainer(String identifier) |
@@ -111,7 +113,9 @@ class Containers implements ContainerRegistry | @@ -111,7 +113,9 @@ class Containers implements ContainerRegistry | ||
111 | } | 113 | } |
112 | 114 | ||
113 | /* (non-Javadoc) | 115 | /* (non-Javadoc) |
114 | - * @see com.mumfrey.liteloader.api.ContainerRegistry#registerBadContainer(com.mumfrey.liteloader.interfaces.Loadable, java.lang.String) | 116 | + * @see com.mumfrey.liteloader.api.ContainerRegistry |
117 | + * #registerBadContainer(com.mumfrey.liteloader.interfaces.Loadable, | ||
118 | + * java.lang.String) | ||
115 | */ | 119 | */ |
116 | @Override | 120 | @Override |
117 | public void registerBadContainer(Loadable<?> container, String reason) | 121 | public void registerBadContainer(Loadable<?> container, String reason) |
@@ -120,7 +124,9 @@ class Containers implements ContainerRegistry | @@ -120,7 +124,9 @@ class Containers implements ContainerRegistry | ||
120 | } | 124 | } |
121 | 125 | ||
122 | /* (non-Javadoc) | 126 | /* (non-Javadoc) |
123 | - * @see com.mumfrey.liteloader.api.ContainerRegistry#registerEnabledContainer(com.mumfrey.liteloader.interfaces.LoadableMod) | 127 | + * @see com.mumfrey.liteloader.api.ContainerRegistry |
128 | + * #registerEnabledContainer( | ||
129 | + * com.mumfrey.liteloader.interfaces.LoadableMod) | ||
124 | */ | 130 | */ |
125 | @Override | 131 | @Override |
126 | public void registerEnabledContainer(LoadableMod<?> container) | 132 | public void registerEnabledContainer(LoadableMod<?> container) |
@@ -130,7 +136,10 @@ class Containers implements ContainerRegistry | @@ -130,7 +136,10 @@ class Containers implements ContainerRegistry | ||
130 | } | 136 | } |
131 | 137 | ||
132 | /* (non-Javadoc) | 138 | /* (non-Javadoc) |
133 | - * @see com.mumfrey.liteloader.api.ContainerRegistry#registerDisabledContainer(com.mumfrey.liteloader.interfaces.LoadableMod, com.mumfrey.liteloader.api.ContainerRegistry.DisabledReason) | 139 | + * @see com.mumfrey.liteloader.api.ContainerRegistry |
140 | + * #registerDisabledContainer( | ||
141 | + * com.mumfrey.liteloader.interfaces.LoadableMod, | ||
142 | + * com.mumfrey.liteloader.api.ContainerRegistry.DisabledReason) | ||
134 | */ | 143 | */ |
135 | @Override | 144 | @Override |
136 | public void registerDisabledContainer(LoadableMod<?> container, DisabledReason reason) | 145 | public void registerDisabledContainer(LoadableMod<?> container, DisabledReason reason) |
@@ -140,7 +149,9 @@ class Containers implements ContainerRegistry | @@ -140,7 +149,9 @@ class Containers implements ContainerRegistry | ||
140 | } | 149 | } |
141 | 150 | ||
142 | /* (non-Javadoc) | 151 | /* (non-Javadoc) |
143 | - * @see com.mumfrey.liteloader.api.ContainerRegistry#registerTweakContainer(com.mumfrey.liteloader.interfaces.TweakContainer) | 152 | + * @see com.mumfrey.liteloader.api.ContainerRegistry |
153 | + * #registerTweakContainer( | ||
154 | + * com.mumfrey.liteloader.interfaces.TweakContainer) | ||
144 | */ | 155 | */ |
145 | @Override | 156 | @Override |
146 | public void registerTweakContainer(TweakContainer<File> container) | 157 | public void registerTweakContainer(TweakContainer<File> container) |
@@ -149,7 +160,9 @@ class Containers implements ContainerRegistry | @@ -149,7 +160,9 @@ class Containers implements ContainerRegistry | ||
149 | } | 160 | } |
150 | 161 | ||
151 | /* (non-Javadoc) | 162 | /* (non-Javadoc) |
152 | - * @see com.mumfrey.liteloader.api.ContainerRegistry#registerInjectedTweak(com.mumfrey.liteloader.interfaces.TweakContainer) | 163 | + * @see com.mumfrey.liteloader.api.ContainerRegistry |
164 | + * #registerInjectedTweak( | ||
165 | + * com.mumfrey.liteloader.interfaces.TweakContainer) | ||
153 | */ | 166 | */ |
154 | @Override | 167 | @Override |
155 | public void registerInjectedTweak(TweakContainer<File> container) | 168 | public void registerInjectedTweak(TweakContainer<File> container) |
src/main/java/com/mumfrey/liteloader/core/EnabledModsList.java
@@ -12,11 +12,12 @@ import com.google.gson.Gson; | @@ -12,11 +12,12 @@ import com.google.gson.Gson; | ||
12 | import com.google.gson.GsonBuilder; | 12 | import com.google.gson.GsonBuilder; |
13 | 13 | ||
14 | /** | 14 | /** |
15 | - * Serialisable (via GSON) object which stores list of enabled/disabled mods for each profile | 15 | + * Serialisable (via GSON) object which stores list of enabled/disabled mods for |
16 | + * each profile. | ||
16 | * | 17 | * |
17 | * @author Adam Mummery-Smith | 18 | * @author Adam Mummery-Smith |
18 | */ | 19 | */ |
19 | -public class EnabledModsList | 20 | +public final class EnabledModsList |
20 | { | 21 | { |
21 | @SuppressWarnings("unused") | 22 | @SuppressWarnings("unused") |
22 | private static final transient long serialVersionUID = -6449451105617763769L; | 23 | private static final transient long serialVersionUID = -6449451105617763769L; |
@@ -32,10 +33,12 @@ public class EnabledModsList | @@ -32,10 +33,12 @@ public class EnabledModsList | ||
32 | private TreeMap<String, TreeMap<String, Boolean>> mods; | 33 | private TreeMap<String, TreeMap<String, Boolean>> mods; |
33 | 34 | ||
34 | /** | 35 | /** |
35 | - * By default, when we discover a mod which is NOT in the list for the current profile, we will ENABLE the | ||
36 | - * mod and add it to the list. However, when we receive a list of mods on the command line, we instead want | ||
37 | - * to DISABLE any additional unlisted mods, we also don't want to save the mods list because the command line | ||
38 | - * is supposed to be an override rather than a new mask. These two values provide this behaviour. | 36 | + * By default, when we discover a mod which is NOT in the list for the |
37 | + * current profile, we will ENABLE the mod and add it to the list. However, | ||
38 | + * when we receive a list of mods on the command line, we instead want to | ||
39 | + * <b>disable</b> any additional unlisted mods, we also don't want to save | ||
40 | + * the mods list because the command line is supposed to be an override | ||
41 | + * rather than a new mask. These two values provide this behaviour. | ||
39 | */ | 42 | */ |
40 | private transient Boolean defaultEnabledValue = Boolean.TRUE; | 43 | private transient Boolean defaultEnabledValue = Boolean.TRUE; |
41 | private transient boolean allowSave = true; | 44 | private transient boolean allowSave = true; |
@@ -138,8 +141,8 @@ public class EnabledModsList | @@ -138,8 +141,8 @@ public class EnabledModsList | ||
138 | } | 141 | } |
139 | 142 | ||
140 | /** | 143 | /** |
141 | - * Factory method which tries to deserialise the enablement list from the file or if failing creates | ||
142 | - * and returns a new instance. | 144 | + * Factory method which tries to deserialise the enablement list from the |
145 | + * file or if failing creates and returns a new instance. | ||
143 | * | 146 | * |
144 | * @param file JSON file to create the EnabledModsList from | 147 | * @param file JSON file to create the EnabledModsList from |
145 | * @return a new EnabledModsList instance | 148 | * @return a new EnabledModsList instance |
@@ -166,7 +169,9 @@ public class EnabledModsList | @@ -166,7 +169,9 @@ public class EnabledModsList | ||
166 | try | 169 | try |
167 | { | 170 | { |
168 | if (reader != null) | 171 | if (reader != null) |
172 | + { | ||
169 | reader.close(); | 173 | reader.close(); |
174 | + } | ||
170 | } | 175 | } |
171 | catch (IOException ex) | 176 | catch (IOException ex) |
172 | { | 177 | { |
@@ -205,7 +210,9 @@ public class EnabledModsList | @@ -205,7 +210,9 @@ public class EnabledModsList | ||
205 | try | 210 | try |
206 | { | 211 | { |
207 | if (writer != null) | 212 | if (writer != null) |
213 | + { | ||
208 | writer.close(); | 214 | writer.close(); |
215 | + } | ||
209 | } | 216 | } |
210 | catch (IOException ex) | 217 | catch (IOException ex) |
211 | { | 218 | { |
src/main/java/com/mumfrey/liteloader/core/LiteLoader.java
@@ -290,7 +290,8 @@ public final class LiteLoader | @@ -290,7 +290,8 @@ public final class LiteLoader | ||
290 | } | 290 | } |
291 | 291 | ||
292 | /** | 292 | /** |
293 | - * Get the singleton instance of LiteLoader, initialises the loader if necessary | 293 | + * Get the singleton instance of LiteLoader, initialises the loader if |
294 | + * necessary. | ||
294 | * | 295 | * |
295 | * @return LiteLoader instance | 296 | * @return LiteLoader instance |
296 | */ | 297 | */ |
@@ -343,7 +344,8 @@ public final class LiteLoader | @@ -343,7 +344,8 @@ public final class LiteLoader | ||
343 | } | 344 | } |
344 | 345 | ||
345 | /** | 346 | /** |
346 | - * Get an API instance by identifier (returns null if no instance matching the supplied identifier exists) | 347 | + * Get an API instance by identifier (returns null if no instance matching |
348 | + * the supplied identifier exists). | ||
347 | * | 349 | * |
348 | * @param identifier | 350 | * @param identifier |
349 | */ | 351 | */ |
@@ -367,7 +369,9 @@ public final class LiteLoader | @@ -367,7 +369,9 @@ public final class LiteLoader | ||
367 | if (customisationProviders != null) | 369 | if (customisationProviders != null) |
368 | { | 370 | { |
369 | for (CustomisationProvider provider : customisationProviders) | 371 | for (CustomisationProvider provider : customisationProviders) |
372 | + { | ||
370 | if (providerType.isAssignableFrom(provider.getClass())) return (C)provider; | 373 | if (providerType.isAssignableFrom(provider.getClass())) return (C)provider; |
374 | + } | ||
371 | } | 375 | } |
372 | 376 | ||
373 | return null; | 377 | return null; |
@@ -550,7 +554,7 @@ public final class LiteLoader | @@ -550,7 +554,7 @@ public final class LiteLoader | ||
550 | loadedMods.add(loadedMod.getMod()); | 554 | loadedMods.add(loadedMod.getMod()); |
551 | } | 555 | } |
552 | 556 | ||
553 | - return loadedMods; | 557 | + return loadedMods; |
554 | } | 558 | } |
555 | 559 | ||
556 | /** | 560 | /** |
@@ -633,7 +637,7 @@ public final class LiteLoader | @@ -633,7 +637,7 @@ public final class LiteLoader | ||
633 | * @param modNameOrId | 637 | * @param modNameOrId |
634 | * @param metaDataKey | 638 | * @param metaDataKey |
635 | * @param defaultValue | 639 | * @param defaultValue |
636 | - * @throws InvalidActivityException Thrown by getMod if init is not complete | 640 | + * @throws InvalidActivityException Thrown by getMod if init is not complete |
637 | * @throws IllegalArgumentException Thrown by getMod if argument is null | 641 | * @throws IllegalArgumentException Thrown by getMod if argument is null |
638 | */ | 642 | */ |
639 | public String getModMetaData(String modNameOrId, String metaDataKey, String defaultValue) throws IllegalArgumentException | 643 | public String getModMetaData(String modNameOrId, String metaDataKey, String defaultValue) throws IllegalArgumentException |
@@ -666,7 +670,8 @@ public final class LiteLoader | @@ -666,7 +670,8 @@ public final class LiteLoader | ||
666 | } | 670 | } |
667 | 671 | ||
668 | /** | 672 | /** |
669 | - * Get the mod identifier, this is used for versioning, exclusivity, and enablement checks | 673 | + * Get the mod identifier, this is used for versioning, exclusivity, and |
674 | + * enablement checks. | ||
670 | * | 675 | * |
671 | * @param modClass | 676 | * @param modClass |
672 | */ | 677 | */ |
@@ -676,7 +681,8 @@ public final class LiteLoader | @@ -676,7 +681,8 @@ public final class LiteLoader | ||
676 | } | 681 | } |
677 | 682 | ||
678 | /** | 683 | /** |
679 | - * Get the mod identifier, this is used for versioning, exclusivity, and enablement checks | 684 | + * Get the mod identifier, this is used for versioning, exclusivity, and |
685 | + * enablement checks. | ||
680 | * | 686 | * |
681 | * @param mod | 687 | * @param mod |
682 | */ | 688 | */ |
@@ -686,7 +692,8 @@ public final class LiteLoader | @@ -686,7 +692,8 @@ public final class LiteLoader | ||
686 | } | 692 | } |
687 | 693 | ||
688 | /** | 694 | /** |
689 | - * Get the container (mod file, classpath jar or folder) for the specified mod | 695 | + * Get the container (mod file, classpath jar or folder) for the specified |
696 | + * mod. | ||
690 | * | 697 | * |
691 | * @param modClass | 698 | * @param modClass |
692 | */ | 699 | */ |
@@ -696,7 +703,8 @@ public final class LiteLoader | @@ -696,7 +703,8 @@ public final class LiteLoader | ||
696 | } | 703 | } |
697 | 704 | ||
698 | /** | 705 | /** |
699 | - * Get the container (mod file, classpath jar or folder) for the specified mod | 706 | + * Get the container (mod file, classpath jar or folder) for the specified |
707 | + * mod. | ||
700 | * | 708 | * |
701 | * @param mod | 709 | * @param mod |
702 | */ | 710 | */ |
@@ -768,7 +776,8 @@ public final class LiteLoader | @@ -768,7 +776,8 @@ public final class LiteLoader | ||
768 | * Register an arbitrary Exposable | 776 | * Register an arbitrary Exposable |
769 | * | 777 | * |
770 | * @param exposable Exposable object to register | 778 | * @param exposable Exposable object to register |
771 | - * @param fileName Override config file name to use (leave null to use value from ExposableConfig specified value) | 779 | + * @param fileName Override config file name to use (leave null to use value |
780 | + * from ExposableConfig specified value) | ||
772 | */ | 781 | */ |
773 | public void registerExposable(Exposable exposable, String fileName) | 782 | public void registerExposable(Exposable exposable, String fileName) |
774 | { | 783 | { |
@@ -777,7 +786,8 @@ public final class LiteLoader | @@ -777,7 +786,8 @@ public final class LiteLoader | ||
777 | } | 786 | } |
778 | 787 | ||
779 | /** | 788 | /** |
780 | - * Initialise lifetime objects like the game engine, event broker and interface manager | 789 | + * Initialise lifetime objects like the game engine, event broker and |
790 | + * interface manager. | ||
781 | */ | 791 | */ |
782 | private void initLifetimeObjects() | 792 | private void initLifetimeObjects() |
783 | { | 793 | { |
@@ -980,7 +990,8 @@ public final class LiteLoader | @@ -980,7 +990,8 @@ public final class LiteLoader | ||
980 | } | 990 | } |
981 | 991 | ||
982 | /** | 992 | /** |
983 | - * @param objCrashReport This is an object so that we don't need to transform the obfuscated name in the transformer | 993 | + * @param objCrashReport This is an object so that we don't need to |
994 | + * transform the obfuscated name in the transformer | ||
984 | */ | 995 | */ |
985 | public static void populateCrashReport(Object objCrashReport) | 996 | public static void populateCrashReport(Object objCrashReport) |
986 | { | 997 | { |
src/main/java/com/mumfrey/liteloader/core/LiteLoaderBootstrap.java
@@ -37,15 +37,18 @@ import com.mumfrey.liteloader.util.log.LiteLoaderLogger; | @@ -37,15 +37,18 @@ import com.mumfrey.liteloader.util.log.LiteLoaderLogger; | ||
37 | import com.mumfrey.liteloader.util.log.LiteLoaderLogger.Verbosity; | 37 | import com.mumfrey.liteloader.util.log.LiteLoaderLogger.Verbosity; |
38 | 38 | ||
39 | /** | 39 | /** |
40 | - * LiteLoaderBootstrap is responsible for managing the early part of the LiteLoader startup process, this is | ||
41 | - * to ensure that NONE of the Minecraft classes which by necessity the Loader references get loaded before the | ||
42 | - * PREINIT stage has completed. This allows us to load transforming tweakers in the PREINIT stage without all | ||
43 | - * hell breaking loose because class names have changed between initialisation stages! | 40 | + * LiteLoaderBootstrap is responsible for managing the early part of the |
41 | + * LiteLoader startup process, this is to ensure that NONE of the Minecraft | ||
42 | + * classes which by necessity the Loader references get loaded before the | ||
43 | + * PREINIT stage has completed. This allows us to load transforming tweakers in | ||
44 | + * the PREINIT stage without all hell breaking loose because class names have | ||
45 | + * changed between initialisation stages! | ||
44 | * | 46 | * |
45 | - * This class handles setting up requisite resources like the logger, enumerator and plug-in API modules and | ||
46 | - * passes init calls through to the LiteLoader instance at the appropriate points during startup. Because this | ||
47 | - * class is the first part of the loader to get loaded, we also keep central references like the paths, version | ||
48 | - * and loader properties in here. | 47 | + * <p>This class handles setting up requisite resources like the logger, |
48 | + * enumerator and plug-in API modules and passes init calls through to the | ||
49 | + * LiteLoader instance at the appropriate points during startup. Because this | ||
50 | + * class is the first part of the loader to get loaded, we also keep central | ||
51 | + * references like the paths, version and loader properties in here.</p> | ||
49 | * | 52 | * |
50 | * @author Adam Mummery-Smith | 53 | * @author Adam Mummery-Smith |
51 | */ | 54 | */ |
@@ -77,7 +80,8 @@ class LiteLoaderBootstrap implements LoaderBootstrap, LoaderEnvironment, LoaderP | @@ -77,7 +80,8 @@ class LiteLoaderBootstrap implements LoaderBootstrap, LoaderEnvironment, LoaderP | ||
77 | private final File versionedModsFolder; | 80 | private final File versionedModsFolder; |
78 | 81 | ||
79 | /** | 82 | /** |
80 | - * Base "liteconfig" folder under which all other lite mod configs and liteloader configs are placed | 83 | + * Base "liteconfig" folder under which all other lite mod configs and |
84 | + * liteloader configs are placed. | ||
81 | */ | 85 | */ |
82 | private final File configBaseFolder; | 86 | private final File configBaseFolder; |
83 | 87 | ||
@@ -283,7 +287,8 @@ class LiteLoaderBootstrap implements LoaderBootstrap, LoaderEnvironment, LoaderP | @@ -283,7 +287,8 @@ class LiteLoaderBootstrap implements LoaderBootstrap, LoaderEnvironment, LoaderP | ||
283 | } | 287 | } |
284 | 288 | ||
285 | /* (non-Javadoc) | 289 | /* (non-Javadoc) |
286 | - * @see com.mumfrey.liteloader.launch.ILoaderBootstrap#preInit(net.minecraft.launchwrapper.LaunchClassLoader, boolean) | 290 | + * @see com.mumfrey.liteloader.launch.ILoaderBootstrap |
291 | + * #preInit(net.minecraft.launchwrapper.LaunchClassLoader, boolean) | ||
287 | */ | 292 | */ |
288 | @Override | 293 | @Override |
289 | public void preInit(LaunchClassLoader classLoader, boolean loadTweaks, List<String> modsToLoad) | 294 | public void preInit(LaunchClassLoader classLoader, boolean loadTweaks, List<String> modsToLoad) |
@@ -339,7 +344,8 @@ class LiteLoaderBootstrap implements LoaderBootstrap, LoaderEnvironment, LoaderP | @@ -339,7 +344,8 @@ class LiteLoaderBootstrap implements LoaderBootstrap, LoaderEnvironment, LoaderP | ||
339 | } | 344 | } |
340 | 345 | ||
341 | /* (non-Javadoc) | 346 | /* (non-Javadoc) |
342 | - * @see com.mumfrey.liteloader.launch.ILoaderBootstrap#init(java.util.List, net.minecraft.launchwrapper.LaunchClassLoader) | 347 | + * @see com.mumfrey.liteloader.launch.ILoaderBootstrap |
348 | + * #init(java.util.List, net.minecraft.launchwrapper.LaunchClassLoader) | ||
343 | */ | 349 | */ |
344 | @Override | 350 | @Override |
345 | public void init() | 351 | public void init() |
@@ -396,8 +402,10 @@ class LiteLoaderBootstrap implements LoaderBootstrap, LoaderEnvironment, LoaderP | @@ -396,8 +402,10 @@ class LiteLoaderBootstrap implements LoaderBootstrap, LoaderEnvironment, LoaderP | ||
396 | LiteLoaderLogger.info("Setting up logger..."); | 402 | LiteLoaderLogger.info("Setting up logger..."); |
397 | 403 | ||
398 | Logger logger = LiteLoaderLogger.getLogger(); | 404 | Logger logger = LiteLoaderLogger.getLogger(); |
399 | - Layout<? extends Serializable> layout = PatternLayout.createLayout("[%d{HH:mm:ss}] [%t/%level]: %msg%n", logger.getContext().getConfiguration(), null, "UTF-8", "True"); | ||
400 | - FileAppender fileAppender = FileAppender.createAppender(this.logFile.getAbsolutePath(), "False", "False", "LiteLoader", "True", "True", "True", layout, null, "False", "", logger.getContext().getConfiguration()); | 405 | + Layout<? extends Serializable> layout = PatternLayout.createLayout("[%d{HH:mm:ss}] [%t/%level]: %msg%n", |
406 | + logger.getContext().getConfiguration(), null, "UTF-8", "True"); | ||
407 | + FileAppender fileAppender = FileAppender.createAppender(this.logFile.getAbsolutePath(), "False", "False", | ||
408 | + "LiteLoader", "True", "True", "True", layout, null, "False", "", logger.getContext().getConfiguration()); | ||
401 | fileAppender.start(); | 409 | fileAppender.start(); |
402 | logger.addAppender(fileAppender); | 410 | logger.addAppender(fileAppender); |
403 | } | 411 | } |
@@ -481,13 +489,19 @@ class LiteLoaderBootstrap implements LoaderBootstrap, LoaderEnvironment, LoaderP | @@ -481,13 +489,19 @@ class LiteLoaderBootstrap implements LoaderBootstrap, LoaderEnvironment, LoaderP | ||
481 | { | 489 | { |
482 | this.branding = this.internalProperties.getProperty(LoaderProperties.OPTION_BRAND, null); | 490 | this.branding = this.internalProperties.getProperty(LoaderProperties.OPTION_BRAND, null); |
483 | if (this.branding != null && this.branding.length() < 1) | 491 | if (this.branding != null && this.branding.length() < 1) |
492 | + { | ||
484 | this.branding = null; | 493 | this.branding = null; |
494 | + } | ||
485 | 495 | ||
486 | // Save appropriate branding in the local properties file | 496 | // Save appropriate branding in the local properties file |
487 | if (this.branding != null) | 497 | if (this.branding != null) |
498 | + { | ||
488 | this.localProperties.setProperty(LoaderProperties.OPTION_BRAND, this.branding); | 499 | this.localProperties.setProperty(LoaderProperties.OPTION_BRAND, this.branding); |
500 | + } | ||
489 | else | 501 | else |
502 | + { | ||
490 | this.localProperties.remove(LoaderProperties.OPTION_BRAND); | 503 | this.localProperties.remove(LoaderProperties.OPTION_BRAND); |
504 | + } | ||
491 | } | 505 | } |
492 | 506 | ||
493 | /** | 507 | /** |
@@ -563,7 +577,8 @@ class LiteLoaderBootstrap implements LoaderBootstrap, LoaderEnvironment, LoaderP | @@ -563,7 +577,8 @@ class LiteLoaderBootstrap implements LoaderBootstrap, LoaderEnvironment, LoaderP | ||
563 | } | 577 | } |
564 | 578 | ||
565 | /** | 579 | /** |
566 | - * Get a boolean propery from the properties file and also write the new value back to the properties file | 580 | + * Get a boolean propery from the properties file and also write the new |
581 | + * value back to the properties file. | ||
567 | * | 582 | * |
568 | * @param propertyName | 583 | * @param propertyName |
569 | * @param defaultValue | 584 | * @param defaultValue |
@@ -577,7 +592,8 @@ class LiteLoaderBootstrap implements LoaderBootstrap, LoaderEnvironment, LoaderP | @@ -577,7 +592,8 @@ class LiteLoaderBootstrap implements LoaderBootstrap, LoaderEnvironment, LoaderP | ||
577 | } | 592 | } |
578 | 593 | ||
579 | /** | 594 | /** |
580 | - * Get a boolean propery from the properties file and also write the new value back to the properties file | 595 | + * Get a boolean propery from the properties file and also write the new |
596 | + * value back to the properties file. | ||
581 | * | 597 | * |
582 | * @param propertyName | 598 | * @param propertyName |
583 | */ | 599 | */ |
@@ -694,7 +710,7 @@ class LiteLoaderBootstrap implements LoaderBootstrap, LoaderEnvironment, LoaderP | @@ -694,7 +710,7 @@ class LiteLoaderBootstrap implements LoaderBootstrap, LoaderEnvironment, LoaderP | ||
694 | 710 | ||
695 | String oldBrand = (String)mGetClientModName.invoke(null); | 711 | String oldBrand = (String)mGetClientModName.invoke(null); |
696 | 712 | ||
697 | - if (oldBrand.equals("vanilla")) | 713 | + if ("vanilla".equals(oldBrand)) |
698 | { | 714 | { |
699 | char[] newValue = brand.toCharArray(); | 715 | char[] newValue = brand.toCharArray(); |
700 | 716 | ||
@@ -718,7 +734,8 @@ class LiteLoaderBootstrap implements LoaderBootstrap, LoaderEnvironment, LoaderP | @@ -718,7 +734,8 @@ class LiteLoaderBootstrap implements LoaderBootstrap, LoaderEnvironment, LoaderP | ||
718 | } | 734 | } |
719 | 735 | ||
720 | /* (non-Javadoc) | 736 | /* (non-Javadoc) |
721 | - * @see com.mumfrey.liteloader.launch.LoaderBootstrap#getRequiredTransformers() | 737 | + * @see com.mumfrey.liteloader.launch.LoaderBootstrap |
738 | + * #getRequiredTransformers() | ||
722 | */ | 739 | */ |
723 | @Override | 740 | @Override |
724 | public List<String> getRequiredTransformers() | 741 | public List<String> getRequiredTransformers() |
@@ -727,7 +744,8 @@ class LiteLoaderBootstrap implements LoaderBootstrap, LoaderEnvironment, LoaderP | @@ -727,7 +744,8 @@ class LiteLoaderBootstrap implements LoaderBootstrap, LoaderEnvironment, LoaderP | ||
727 | } | 744 | } |
728 | 745 | ||
729 | /* (non-Javadoc) | 746 | /* (non-Javadoc) |
730 | - * @see com.mumfrey.liteloader.launch.LoaderBootstrap#getRequiredDownstreamTransformers() | 747 | + * @see com.mumfrey.liteloader.launch.LoaderBootstrap |
748 | + * #getRequiredDownstreamTransformers() | ||
731 | */ | 749 | */ |
732 | @Override | 750 | @Override |
733 | public List<String> getRequiredDownstreamTransformers() | 751 | public List<String> getRequiredDownstreamTransformers() |
src/main/java/com/mumfrey/liteloader/core/LiteLoaderEnumerator.java
@@ -44,8 +44,9 @@ import com.mumfrey.liteloader.util.log.LiteLoaderLogger; | @@ -44,8 +44,9 @@ import com.mumfrey.liteloader.util.log.LiteLoaderLogger; | ||
44 | import com.mumfrey.liteloader.util.log.LiteLoaderLogger.Verbosity; | 44 | import com.mumfrey.liteloader.util.log.LiteLoaderLogger.Verbosity; |
45 | 45 | ||
46 | /** | 46 | /** |
47 | - * The enumerator performs all mod discovery functions for LiteLoader, this includes locating mod files to load | ||
48 | - * as well as searching for mod classes within the class path and discovered mod files. | 47 | + * The enumerator performs all mod discovery functions for LiteLoader, this |
48 | + * includes locating mod files to load as well as searching for mod classes | ||
49 | + * within the class path and discovered mod files. | ||
49 | * | 50 | * |
50 | * @author Adam Mummery-Smith | 51 | * @author Adam Mummery-Smith |
51 | */ | 52 | */ |
@@ -70,7 +71,8 @@ public class LiteLoaderEnumerator implements LoaderEnumerator | @@ -70,7 +71,8 @@ public class LiteLoaderEnumerator implements LoaderEnumerator | ||
70 | { | 71 | { |
71 | if (fromState != this && fromState != this.previousState) | 72 | if (fromState != this && fromState != this.previousState) |
72 | { | 73 | { |
73 | - throw new IllegalStateException("Attempted to move to an invalid enumerator state " + this + ", expected to be in state " + this.previousState + " but current state is " + fromState); | 74 | + throw new IllegalStateException("Attempted to move to an invalid enumerator state " + this + ", expected to be in state " |
75 | + + this.previousState + " but current state is " + fromState); | ||
74 | } | 76 | } |
75 | 77 | ||
76 | return true; | 78 | return true; |
@@ -167,7 +169,7 @@ public class LiteLoaderEnumerator implements LoaderEnumerator | @@ -167,7 +169,7 @@ public class LiteLoaderEnumerator implements LoaderEnumerator | ||
167 | for (EnumeratorModule module : apiModules) | 169 | for (EnumeratorModule module : apiModules) |
168 | { | 170 | { |
169 | this.registerModule(module); | 171 | this.registerModule(module); |
170 | - } | 172 | + } |
171 | } | 173 | } |
172 | } | 174 | } |
173 | } | 175 | } |
@@ -176,7 +178,8 @@ public class LiteLoaderEnumerator implements LoaderEnumerator | @@ -176,7 +178,8 @@ public class LiteLoaderEnumerator implements LoaderEnumerator | ||
176 | { | 178 | { |
177 | if (this.state != state) | 179 | if (this.state != state) |
178 | { | 180 | { |
179 | - throw new IllegalStateException("Illegal enumerator state whilst performing " + action + ", expecting " + state + " but current state is " + this.state); | 181 | + throw new IllegalStateException("Illegal enumerator state whilst performing " + action + ", expecting " + state + " but current state is " |
182 | + + this.state); | ||
180 | } | 183 | } |
181 | } | 184 | } |
182 | 185 | ||
@@ -223,7 +226,8 @@ public class LiteLoaderEnumerator implements LoaderEnumerator | @@ -223,7 +226,8 @@ public class LiteLoaderEnumerator implements LoaderEnumerator | ||
223 | } | 226 | } |
224 | 227 | ||
225 | /* (non-Javadoc) | 228 | /* (non-Javadoc) |
226 | - * @see com.mumfrey.liteloader.core.PluggableEnumerator#registerModule(com.mumfrey.liteloader.core.EnumeratorModule) | 229 | + * @see com.mumfrey.liteloader.core.PluggableEnumerator |
230 | + * #registerModule(com.mumfrey.liteloader.core.EnumeratorModule) | ||
227 | */ | 231 | */ |
228 | @Override | 232 | @Override |
229 | public void registerModule(EnumeratorModule module) | 233 | public void registerModule(EnumeratorModule module) |
@@ -339,14 +343,17 @@ public class LiteLoaderEnumerator implements LoaderEnumerator | @@ -339,14 +343,17 @@ public class LiteLoaderEnumerator implements LoaderEnumerator | ||
339 | for (ModInfo<LoadableMod<?>> mod : this.modsToLoad) | 343 | for (ModInfo<LoadableMod<?>> mod : this.modsToLoad) |
340 | { | 344 | { |
341 | if (modClass.equals(mod.getModClass())) | 345 | if (modClass.equals(mod.getModClass())) |
346 | + { | ||
342 | return mod.getContainer(); | 347 | return mod.getContainer(); |
348 | + } | ||
343 | } | 349 | } |
344 | 350 | ||
345 | return LoadableMod.NONE; | 351 | return LoadableMod.NONE; |
346 | } | 352 | } |
347 | 353 | ||
348 | /** | 354 | /** |
349 | - * Get the mod identifier (metadata key), this is used for versioning, exclusivity, and enablement checks | 355 | + * Get the mod identifier (metadata key), this is used for versioning, |
356 | + * exclusivity, and enablement checks. | ||
350 | * | 357 | * |
351 | * @param modClass | 358 | * @param modClass |
352 | */ | 359 | */ |
@@ -358,7 +365,9 @@ public class LiteLoaderEnumerator implements LoaderEnumerator | @@ -358,7 +365,9 @@ public class LiteLoaderEnumerator implements LoaderEnumerator | ||
358 | for (ModInfo<LoadableMod<?>> mod : this.modsToLoad) | 365 | for (ModInfo<LoadableMod<?>> mod : this.modsToLoad) |
359 | { | 366 | { |
360 | if (modClassName.equals(mod.getModClassSimpleName())) | 367 | if (modClassName.equals(mod.getModClassSimpleName())) |
368 | + { | ||
361 | return mod.getIdentifier(); | 369 | return mod.getIdentifier(); |
370 | + } | ||
362 | } | 371 | } |
363 | 372 | ||
364 | return LiteLoaderEnumerator.getModClassName(modClass); | 373 | return LiteLoaderEnumerator.getModClassName(modClass); |
@@ -467,7 +476,8 @@ public class LiteLoaderEnumerator implements LoaderEnumerator | @@ -467,7 +476,8 @@ public class LiteLoaderEnumerator implements LoaderEnumerator | ||
467 | } | 476 | } |
468 | 477 | ||
469 | /* (non-Javadoc) | 478 | /* (non-Javadoc) |
470 | - * @see com.mumfrey.liteloader.interfaces.ModularEnumerator#registerModContainer(com.mumfrey.liteloader.interfaces.LoadableMod) | 479 | + * @see com.mumfrey.liteloader.interfaces.ModularEnumerator |
480 | + * #registerModContainer(com.mumfrey.liteloader.interfaces.LoadableMod) | ||
471 | */ | 481 | */ |
472 | @Override | 482 | @Override |
473 | public final boolean registerModContainer(LoadableMod<?> container) | 483 | public final boolean registerModContainer(LoadableMod<?> container) |
@@ -525,7 +535,8 @@ public class LiteLoaderEnumerator implements LoaderEnumerator | @@ -525,7 +535,8 @@ public class LiteLoaderEnumerator implements LoaderEnumerator | ||
525 | } | 535 | } |
526 | 536 | ||
527 | /* (non-Javadoc) | 537 | /* (non-Javadoc) |
528 | - * @see com.mumfrey.liteloader.core.PluggableEnumerator#addTweaksFrom(com.mumfrey.liteloader.core.TweakContainer) | 538 | + * @see com.mumfrey.liteloader.core.PluggableEnumerator#addTweaksFrom( |
539 | + * com.mumfrey.liteloader.core.TweakContainer) | ||
529 | */ | 540 | */ |
530 | @Override | 541 | @Override |
531 | public boolean registerTweakContainer(TweakContainer<File> container) | 542 | public boolean registerTweakContainer(TweakContainer<File> container) |
@@ -534,7 +545,8 @@ public class LiteLoaderEnumerator implements LoaderEnumerator | @@ -534,7 +545,8 @@ public class LiteLoaderEnumerator implements LoaderEnumerator | ||
534 | 545 | ||
535 | if (!container.isEnabled(this.environment)) | 546 | if (!container.isEnabled(this.environment)) |
536 | { | 547 | { |
537 | - LiteLoaderLogger.info(Verbosity.REDUCED, "Mod %s is disabled for profile %s, not injecting tranformers", container.getIdentifier(), this.environment.getProfile()); | 548 | + LiteLoaderLogger.info(Verbosity.REDUCED, "Mod %s is disabled for profile %s, not injecting tranformers", |
549 | + container.getIdentifier(), this.environment.getProfile()); | ||
538 | return false; | 550 | return false; |
539 | } | 551 | } |
540 | 552 | ||
@@ -570,7 +582,8 @@ public class LiteLoaderEnumerator implements LoaderEnumerator | @@ -570,7 +582,8 @@ public class LiteLoaderEnumerator implements LoaderEnumerator | ||
570 | { | 582 | { |
571 | String tweakClass = container.getTweakClassName(); | 583 | String tweakClass = container.getTweakClassName(); |
572 | int tweakPriority = container.getTweakPriority(); | 584 | int tweakPriority = container.getTweakPriority(); |
573 | - LiteLoaderLogger.info(Verbosity.REDUCED, "Mod file '%s' provides tweakClass '%s', adding to Launch queue with priority %d", container.getName(), tweakClass, tweakPriority); | 585 | + LiteLoaderLogger.info(Verbosity.REDUCED, "Mod file '%s' provides tweakClass '%s', adding to Launch queue with priority %d", |
586 | + container.getName(), tweakClass, tweakPriority); | ||
574 | if (this.environment.addCascadedTweaker(tweakClass, tweakPriority)) | 587 | if (this.environment.addCascadedTweaker(tweakClass, tweakPriority)) |
575 | { | 588 | { |
576 | LiteLoaderLogger.info(Verbosity.REDUCED, "tweakClass '%s' was successfully added", tweakClass); | 589 | LiteLoaderLogger.info(Verbosity.REDUCED, "tweakClass '%s' was successfully added", tweakClass); |
@@ -611,7 +624,8 @@ public class LiteLoaderEnumerator implements LoaderEnumerator | @@ -611,7 +624,8 @@ public class LiteLoaderEnumerator implements LoaderEnumerator | ||
611 | { | 624 | { |
612 | for (String classTransformerClass : classTransformerClasses) | 625 | for (String classTransformerClass : classTransformerClasses) |
613 | { | 626 | { |
614 | - LiteLoaderLogger.info(Verbosity.REDUCED, "Mod file '%s' provides classTransformer '%s', adding to class loader", container.getName(), classTransformerClass); | 627 | + LiteLoaderLogger.info(Verbosity.REDUCED, "Mod file '%s' provides classTransformer '%s', adding to class loader", |
628 | + container.getName(), classTransformerClass); | ||
615 | ClassTransformerManager transformerManager = this.environment.getTransformerManager(); | 629 | ClassTransformerManager transformerManager = this.environment.getTransformerManager(); |
616 | if (transformerManager != null && transformerManager.injectTransformer(classTransformerClass)) | 630 | if (transformerManager != null && transformerManager.injectTransformer(classTransformerClass)) |
617 | { | 631 | { |
@@ -645,7 +659,8 @@ public class LiteLoaderEnumerator implements LoaderEnumerator | @@ -645,7 +659,8 @@ public class LiteLoaderEnumerator implements LoaderEnumerator | ||
645 | } | 659 | } |
646 | 660 | ||
647 | /* (non-Javadoc) | 661 | /* (non-Javadoc) |
648 | - * @see com.mumfrey.liteloader.core.PluggableEnumerator#registerMods(com.mumfrey.liteloader.core.LoadableMod, boolean) | 662 | + * @see com.mumfrey.liteloader.core.PluggableEnumerator#registerMods( |
663 | + * com.mumfrey.liteloader.core.LoadableMod, boolean) | ||
649 | */ | 664 | */ |
650 | @Override | 665 | @Override |
651 | public void registerModsFrom(LoadableMod<?> container, boolean registerContainer) | 666 | public void registerModsFrom(LoadableMod<?> container, boolean registerContainer) |
@@ -688,7 +703,8 @@ public class LiteLoaderEnumerator implements LoaderEnumerator | @@ -688,7 +703,8 @@ public class LiteLoaderEnumerator implements LoaderEnumerator | ||
688 | } | 703 | } |
689 | 704 | ||
690 | /* (non-Javadoc) | 705 | /* (non-Javadoc) |
691 | - * @see com.mumfrey.liteloader.interfaces.ModularEnumerator#registerMod(com.mumfrey.liteloader.interfaces.ModInfo) | 706 | + * @see com.mumfrey.liteloader.interfaces.ModularEnumerator#registerMod( |
707 | + * com.mumfrey.liteloader.interfaces.ModInfo) | ||
692 | */ | 708 | */ |
693 | @Override | 709 | @Override |
694 | public void registerMod(ModInfo<LoadableMod<?>> mod) | 710 | public void registerMod(ModInfo<LoadableMod<?>> mod) |
src/main/java/com/mumfrey/liteloader/core/LiteLoaderEventBroker.java
@@ -53,8 +53,10 @@ import com.mumfrey.liteloader.util.log.LiteLoaderLogger; | @@ -53,8 +53,10 @@ import com.mumfrey.liteloader.util.log.LiteLoaderLogger; | ||
53 | /** | 53 | /** |
54 | * @author Adam Mummery-Smith | 54 | * @author Adam Mummery-Smith |
55 | * | 55 | * |
56 | - * @param <TClient> Type of the client runtime, "Minecraft" on client and null on the server | ||
57 | - * @param <TServer> Type of the server runtime, "IntegratedServer" on the client, "MinecraftServer" on the server | 56 | + * @param <TClient> Type of the client runtime, "Minecraft" on client and null |
57 | + * on the server | ||
58 | + * @param <TServer> Type of the server runtime, "IntegratedServer" on the client | ||
59 | + * "MinecraftServer" on the server | ||
58 | */ | 60 | */ |
59 | public abstract class LiteLoaderEventBroker<TClient, TServer extends MinecraftServer> implements InterfaceProvider, ShutdownObserver | 61 | public abstract class LiteLoaderEventBroker<TClient, TServer extends MinecraftServer> implements InterfaceProvider, ShutdownObserver |
60 | { | 62 | { |
@@ -131,32 +133,38 @@ public abstract class LiteLoaderEventBroker<TClient, TServer extends MinecraftSe | @@ -131,32 +133,38 @@ public abstract class LiteLoaderEventBroker<TClient, TServer extends MinecraftSe | ||
131 | /** | 133 | /** |
132 | * List of mods which provide server commands | 134 | * List of mods which provide server commands |
133 | */ | 135 | */ |
134 | - private FastIterable<ServerCommandProvider> serverCommandProviders = new HandlerList<ServerCommandProvider>(ServerCommandProvider.class); | 136 | + private FastIterable<ServerCommandProvider> serverCommandProviders |
137 | + = new HandlerList<ServerCommandProvider>(ServerCommandProvider.class); | ||
135 | 138 | ||
136 | /** | 139 | /** |
137 | * List of mods which monitor server player events | 140 | * List of mods which monitor server player events |
138 | */ | 141 | */ |
139 | - private FastIterable<ServerPlayerListener> serverPlayerListeners = new HandlerList<ServerPlayerListener>(ServerPlayerListener.class); | 142 | + private FastIterable<ServerPlayerListener> serverPlayerListeners |
143 | + = new HandlerList<ServerPlayerListener>(ServerPlayerListener.class); | ||
140 | 144 | ||
141 | /** | 145 | /** |
142 | * List of mods which handle player interaction events | 146 | * List of mods which handle player interaction events |
143 | */ | 147 | */ |
144 | - private FastIterable<PlayerInteractionListener> playerInteractionListeners = new HandlerList<PlayerInteractionListener>(PlayerInteractionListener.class, ReturnLogicOp.AND); | 148 | + private FastIterable<PlayerInteractionListener> playerInteractionListeners |
149 | + = new HandlerList<PlayerInteractionListener>(PlayerInteractionListener.class, ReturnLogicOp.AND); | ||
145 | 150 | ||
146 | /** | 151 | /** |
147 | * List of mods which handle player movement events | 152 | * List of mods which handle player movement events |
148 | */ | 153 | */ |
149 | - private FastIterable<PlayerMoveListener> playerMoveListeners = new HandlerList<PlayerMoveListener>(PlayerMoveListener.class, ReturnLogicOp.AND_BREAK_ON_FALSE); | 154 | + private FastIterable<PlayerMoveListener> playerMoveListeners |
155 | + = new HandlerList<PlayerMoveListener>(PlayerMoveListener.class, ReturnLogicOp.AND_BREAK_ON_FALSE); | ||
150 | 156 | ||
151 | /** | 157 | /** |
152 | * List of mods which monitor server ticks | 158 | * List of mods which monitor server ticks |
153 | */ | 159 | */ |
154 | - private FastIterable<ServerTickable> serverTickListeners = new HandlerList<ServerTickable>(ServerTickable.class); | 160 | + private FastIterable<ServerTickable> serverTickListeners |
161 | + = new HandlerList<ServerTickable>(ServerTickable.class); | ||
155 | 162 | ||
156 | /** | 163 | /** |
157 | * List of mods which want to be notified when the game is shutting down | 164 | * List of mods which want to be notified when the game is shutting down |
158 | */ | 165 | */ |
159 | - private FastIterable<ShutdownListener> shutdownListeners = new HandlerList<ShutdownListener>(ShutdownListener.class); | 166 | + private FastIterable<ShutdownListener> shutdownListeners |
167 | + = new HandlerList<ShutdownListener>(ShutdownListener.class); | ||
160 | 168 | ||
161 | /** | 169 | /** |
162 | * ctor | 170 | * ctor |
@@ -206,7 +214,8 @@ public abstract class LiteLoaderEventBroker<TClient, TServer extends MinecraftSe | @@ -206,7 +214,8 @@ public abstract class LiteLoaderEventBroker<TClient, TServer extends MinecraftSe | ||
206 | } | 214 | } |
207 | 215 | ||
208 | /* (non-Javadoc) | 216 | /* (non-Javadoc) |
209 | - * @see com.mumfrey.liteloader.api.InterfaceProvider#registerInterfaces(com.mumfrey.liteloader.core.InterfaceRegistrationDelegate) | 217 | + * @see com.mumfrey.liteloader.api.InterfaceProvider#registerInterfaces( |
218 | + * com.mumfrey.liteloader.core.InterfaceRegistrationDelegate) | ||
210 | */ | 219 | */ |
211 | @Override | 220 | @Override |
212 | public void registerInterfaces(InterfaceRegistrationDelegate delegate) | 221 | public void registerInterfaces(InterfaceRegistrationDelegate delegate) |
@@ -229,7 +238,8 @@ public abstract class LiteLoaderEventBroker<TClient, TServer extends MinecraftSe | @@ -229,7 +238,8 @@ public abstract class LiteLoaderEventBroker<TClient, TServer extends MinecraftSe | ||
229 | { | 238 | { |
230 | if (!(listener instanceof PluginChannelListener) && !(listener instanceof ServerPluginChannelListener)) | 239 | if (!(listener instanceof PluginChannelListener) && !(listener instanceof ServerPluginChannelListener)) |
231 | { | 240 | { |
232 | - LiteLoaderLogger.warning("Interface error for mod '%1s'. Implementing CommonPluginChannelListener has no effect! Use PluginChannelListener or ServerPluginChannelListener instead", listener.getName()); | 241 | + LiteLoaderLogger.warning("Interface error for mod '%1s'. Implementing CommonPluginChannelListener has no effect! " |
242 | + + "Use PluginChannelListener or ServerPluginChannelListener instead", listener.getName()); | ||
233 | } | 243 | } |
234 | } | 244 | } |
235 | 245 | ||
@@ -372,7 +382,7 @@ public abstract class LiteLoaderEventBroker<TClient, TServer extends MinecraftSe | @@ -372,7 +382,7 @@ public abstract class LiteLoaderEventBroker<TClient, TServer extends MinecraftSe | ||
372 | */ | 382 | */ |
373 | protected void onPostRender(int mouseX, int mouseY, float partialTicks) | 383 | protected void onPostRender(int mouseX, int mouseY, float partialTicks) |
374 | { | 384 | { |
375 | - this.loader.onPostRender(mouseX, mouseY, partialTicks); | 385 | + this.loader.onPostRender(mouseX, mouseY, partialTicks); |
376 | } | 386 | } |
377 | 387 | ||
378 | protected void onWorldChanged(World world) | 388 | protected void onWorldChanged(World world) |
@@ -485,7 +495,8 @@ public abstract class LiteLoaderEventBroker<TClient, TServer extends MinecraftSe | @@ -485,7 +495,8 @@ public abstract class LiteLoaderEventBroker<TClient, TServer extends MinecraftSe | ||
485 | if (!this.playerMoveListeners.all().onPlayerMove(playerMP, from, to, pos)) | 495 | if (!this.playerMoveListeners.all().onPlayerMove(playerMP, from, to, pos)) |
486 | { | 496 | { |
487 | playerMP.setPositionAndRotation(from.xCoord, from.yCoord, from.zCoord, playerMP.prevRotationYaw, playerMP.prevRotationPitch); | 497 | playerMP.setPositionAndRotation(from.xCoord, from.yCoord, from.zCoord, playerMP.prevRotationYaw, playerMP.prevRotationPitch); |
488 | - playerMP.playerNetServerHandler.sendPacket(new S08PacketPlayerPosLook(from.xCoord, from.yCoord, from.zCoord, playerMP.prevRotationYaw, playerMP.prevRotationPitch, Collections.emptySet())); | 498 | + playerMP.playerNetServerHandler.sendPacket(new S08PacketPlayerPosLook(from.xCoord, from.yCoord, from.zCoord, |
499 | + playerMP.prevRotationYaw, playerMP.prevRotationPitch, Collections.emptySet())); | ||
489 | return false; | 500 | return false; |
490 | } | 501 | } |
491 | 502 |
src/main/java/com/mumfrey/liteloader/core/LiteLoaderInterfaceManager.java
@@ -21,10 +21,12 @@ import com.mumfrey.liteloader.util.log.LiteLoaderLogger; | @@ -21,10 +21,12 @@ import com.mumfrey.liteloader.util.log.LiteLoaderLogger; | ||
21 | import com.mumfrey.liteloader.util.log.LiteLoaderLogger.Verbosity; | 21 | import com.mumfrey.liteloader.util.log.LiteLoaderLogger.Verbosity; |
22 | 22 | ||
23 | /** | 23 | /** |
24 | - * The interface manager handles the allocation of interface consumers (implementors) to interface providers. During | ||
25 | - * startup, registered providers are enumerated and handler mappings are created for every consumable interface the | ||
26 | - * provider supports. Later on, consumers are enumerated against the available handler mappings and registered with | ||
27 | - * the providers by calling the appropriate registration method. | 24 | + * The interface manager handles the allocation of interface consumers |
25 | + * (implementors) to interface providers. During startup, registered providers | ||
26 | + * are enumerated and handler mappings are created for every consumable | ||
27 | + * interface the provider supports. Later on, consumers are enumerated against | ||
28 | + * the available handler mappings and registered with the providers by calling | ||
29 | + * the appropriate registration method. | ||
28 | * | 30 | * |
29 | * @author Adam Mummery-Smith | 31 | * @author Adam Mummery-Smith |
30 | */ | 32 | */ |
@@ -33,8 +35,9 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | @@ -33,8 +35,9 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | ||
33 | static int handlerAllocationOrder = 0; | 35 | static int handlerAllocationOrder = 0; |
34 | 36 | ||
35 | /** | 37 | /** |
36 | - * InterfaceHandler describes a mapping of a consumable interface to an InterfaceProvider instance and appropriate | ||
37 | - * consumer registration method (which will be invoked via reflection). | 38 | + * InterfaceHandler describes a mapping of a consumable interface to an |
39 | + * InterfaceProvider instance and appropriate consumer registration method | ||
40 | + * (which will be invoked via reflection). | ||
38 | * | 41 | * |
39 | * @author Adam Mummery-Smith | 42 | * @author Adam Mummery-Smith |
40 | */ | 43 | */ |
@@ -51,7 +54,8 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | @@ -51,7 +54,8 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | ||
51 | public final int order; | 54 | public final int order; |
52 | 55 | ||
53 | /** | 56 | /** |
54 | - * Indicates that this handler must be the exclusive hander for this interface | 57 | + * Indicates that this handler must be the exclusive hander for this |
58 | + * interface | ||
55 | */ | 59 | */ |
56 | public final boolean exclusive; | 60 | public final boolean exclusive; |
57 | 61 | ||
@@ -66,7 +70,8 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | @@ -66,7 +70,8 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | ||
66 | public final Class<? extends Listener> interfaceType; | 70 | public final Class<? extends Listener> interfaceType; |
67 | 71 | ||
68 | /** | 72 | /** |
69 | - * List of registered listeners, so we can avoid registering the same listener multiple times | 73 | + * List of registered listeners, so we can avoid registering the same |
74 | + * listener multiple times | ||
70 | */ | 75 | */ |
71 | private final List<Listener> registeredListeners = new ArrayList<Listener>(); | 76 | private final List<Listener> registeredListeners = new ArrayList<Listener>(); |
72 | 77 | ||
@@ -116,7 +121,8 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | @@ -116,7 +121,8 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | ||
116 | { | 121 | { |
117 | if (method.getParameterTypes().length == 1 && method.getParameterTypes()[0].equals(interfaceType)) | 122 | if (method.getParameterTypes().length == 1 && method.getParameterTypes()[0].equals(interfaceType)) |
118 | { | 123 | { |
119 | - LiteLoaderLogger.debug("Found method %s for registering %s with provider %s", method.getName(), interfaceType, providerClass.getSimpleName()); | 124 | + LiteLoaderLogger.debug("Found method %s for registering %s with provider %s", |
125 | + method.getName(), interfaceType, providerClass.getSimpleName()); | ||
120 | return method; | 126 | return method; |
121 | } | 127 | } |
122 | } | 128 | } |
@@ -125,7 +131,8 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | @@ -125,7 +131,8 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | ||
125 | } | 131 | } |
126 | 132 | ||
127 | /** | 133 | /** |
128 | - * After instantiation, called to check that a valid registration method was located | 134 | + * After instantiation, called to check that a valid registration method |
135 | + * was located | ||
129 | */ | 136 | */ |
130 | public boolean isValid() | 137 | public boolean isValid() |
131 | { | 138 | { |
@@ -133,7 +140,8 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | @@ -133,7 +140,8 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | ||
133 | } | 140 | } |
134 | 141 | ||
135 | /** | 142 | /** |
136 | - * Proxy method which calls the registration method in the InterfaceProvider using reflection | 143 | + * Proxy method which calls the registration method in the |
144 | + * InterfaceProvider using reflection | ||
137 | * | 145 | * |
138 | * @param listener | 146 | * @param listener |
139 | */ | 147 | */ |
@@ -148,7 +156,8 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | @@ -148,7 +156,8 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | ||
148 | 156 | ||
149 | try | 157 | try |
150 | { | 158 | { |
151 | - LiteLoaderLogger.debug("Calling registration method %s for %s on %s with %s", this.registrationMethod.getName(), this.interfaceType.getSimpleName(), this.provider.getClass().getSimpleName(), listener.getClass().getSimpleName()); | 159 | + LiteLoaderLogger.debug("Calling registration method %s for %s on %s with %s", this.registrationMethod.getName(), |
160 | + this.interfaceType.getSimpleName(), this.provider.getClass().getSimpleName(), listener.getClass().getSimpleName()); | ||
152 | this.registrationMethod.invoke(this.provider, listener); | 161 | this.registrationMethod.invoke(this.provider, listener); |
153 | 162 | ||
154 | this.registeredListeners.add(listener); | 163 | this.registeredListeners.add(listener); |
@@ -198,20 +207,23 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | @@ -198,20 +207,23 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | ||
198 | protected final FastIterable<InterfaceObserver> observers = new HandlerList<InterfaceObserver>(InterfaceObserver.class); | 207 | protected final FastIterable<InterfaceObserver> observers = new HandlerList<InterfaceObserver>(InterfaceObserver.class); |
199 | 208 | ||
200 | /** | 209 | /** |
201 | - * True once the initial init phase (in which all registered providers are initialised) is completed, we | ||
202 | - * use this flag to indicate that any NEW providers should be immediately initialised. | 210 | + * True once the initial init phase (in which all registered providers are |
211 | + * initialised) is completed, we use this flag to indicate that any <b>new | ||
212 | + * </b> providers should be immediately initialised. | ||
203 | */ | 213 | */ |
204 | private boolean initDone = false; | 214 | private boolean initDone = false; |
205 | 215 | ||
206 | /** | 216 | /** |
207 | - * The last startup phase causes all currently registered consumers to be enumerated and offered to all | ||
208 | - * currently registered listeners, once this initial registration is done any NEW consumers should be | ||
209 | - * immediately offered to all registered listeners. | 217 | + * The last startup phase causes all currently registered consumers to be |
218 | + * enumerated and offered to all currently registered listeners, once this | ||
219 | + * initial registration is done any <b>new</b> consumers should immediately | ||
220 | + * offered to all registered listeners. | ||
210 | */ | 221 | */ |
211 | private boolean registrationDone = false; | 222 | private boolean registrationDone = false; |
212 | 223 | ||
213 | /** | 224 | /** |
214 | - * Registratiob Delegate which is active for the current registration process | 225 | + * Registratiob Delegate which is active for the current registration |
226 | + * process. | ||
215 | */ | 227 | */ |
216 | private InterfaceRegistrationDelegate activeRegistrationDelegate; | 228 | private InterfaceRegistrationDelegate activeRegistrationDelegate; |
217 | 229 | ||
@@ -248,7 +260,8 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | @@ -248,7 +260,8 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | ||
248 | { | 260 | { |
249 | for (InterfaceProvider provider : apiInterfaceProviders) | 261 | for (InterfaceProvider provider : apiInterfaceProviders) |
250 | { | 262 | { |
251 | - LiteLoaderLogger.info(Verbosity.REDUCED, "Registering interface provider %s for API %s", provider.getClass().getName(), api.getName()); | 263 | + LiteLoaderLogger.info(Verbosity.REDUCED, "Registering interface provider %s for API %s", |
264 | + provider.getClass().getName(), api.getName()); | ||
252 | if (this.registerProvider(provider)) | 265 | if (this.registerProvider(provider)) |
253 | { | 266 | { |
254 | this.providerToAPIMap.put(provider, api); | 267 | this.providerToAPIMap.put(provider, api); |
@@ -304,7 +317,8 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | @@ -304,7 +317,8 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | ||
304 | } | 317 | } |
305 | catch (Throwable th) | 318 | catch (Throwable th) |
306 | { | 319 | { |
307 | - LiteLoaderLogger.warning(th, "Error while registering interface provider %s: %s", provider.getClass().getSimpleName(), th.getClass().getSimpleName()); | 320 | + LiteLoaderLogger.warning(th, "Error while registering interface provider %s: %s", |
321 | + provider.getClass().getSimpleName(), th.getClass().getSimpleName()); | ||
308 | } | 322 | } |
309 | } | 323 | } |
310 | 324 | ||
@@ -321,7 +335,9 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | @@ -321,7 +335,9 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | ||
321 | } | 335 | } |
322 | 336 | ||
323 | /* (non-Javadoc) | 337 | /* (non-Javadoc) |
324 | - * @see com.mumfrey.liteloader.interfaces.InterfaceRegistry#registerInterface(com.mumfrey.liteloader.api.InterfaceProvider, java.lang.Class) | 338 | + * @see com.mumfrey.liteloader.interfaces.InterfaceRegistry |
339 | + * #registerInterface( | ||
340 | + * com.mumfrey.liteloader.api.InterfaceProvider, java.lang.Class) | ||
325 | */ | 341 | */ |
326 | @Override | 342 | @Override |
327 | public void registerInterface(InterfaceProvider provider, Class<? extends Listener> interfaceType) | 343 | public void registerInterface(InterfaceProvider provider, Class<? extends Listener> interfaceType) |
@@ -330,7 +346,9 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | @@ -330,7 +346,9 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | ||
330 | } | 346 | } |
331 | 347 | ||
332 | /* (non-Javadoc) | 348 | /* (non-Javadoc) |
333 | - * @see com.mumfrey.liteloader.interfaces.InterfaceRegistry#registerInterface(com.mumfrey.liteloader.api.InterfaceProvider, java.lang.Class, int) | 349 | + * @see com.mumfrey.liteloader.interfaces.InterfaceRegistry |
350 | + * #registerInterface(com.mumfrey.liteloader.api.InterfaceProvider, | ||
351 | + * java.lang.Class, int) | ||
334 | */ | 352 | */ |
335 | @Override | 353 | @Override |
336 | public void registerInterface(InterfaceProvider provider, Class<? extends Listener> interfaceType, int priority) | 354 | public void registerInterface(InterfaceProvider provider, Class<? extends Listener> interfaceType, int priority) |
@@ -339,7 +357,9 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | @@ -339,7 +357,9 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | ||
339 | } | 357 | } |
340 | 358 | ||
341 | /* (non-Javadoc) | 359 | /* (non-Javadoc) |
342 | - * @see com.mumfrey.liteloader.interfaces.InterfaceRegistry#registerInterface(com.mumfrey.liteloader.api.InterfaceProvider, java.lang.Class, int, boolean) | 360 | + * @see com.mumfrey.liteloader.interfaces.InterfaceRegistry |
361 | + * #registerInterface(com.mumfrey.liteloader.api.InterfaceProvider, | ||
362 | + * java.lang.Class, int, boolean) | ||
343 | */ | 363 | */ |
344 | @Override | 364 | @Override |
345 | public void registerInterface(InterfaceProvider provider, Class<? extends Listener> interfaceType, int priority, boolean exclusive) | 365 | public void registerInterface(InterfaceProvider provider, Class<? extends Listener> interfaceType, int priority, boolean exclusive) |
@@ -350,7 +370,8 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | @@ -350,7 +370,8 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | ||
350 | // Check if a this provider is already registered | 370 | // Check if a this provider is already registered |
351 | if (this.getProvidersFor(interfaceType).contains(provider)) | 371 | if (this.getProvidersFor(interfaceType).contains(provider)) |
352 | { | 372 | { |
353 | - throw new InvalidProviderException("Attempting to register duplicate mapping for provider " + provider.getClass() + " to " + interfaceType); | 373 | + throw new InvalidProviderException("Attempting to register duplicate mapping for provider " |
374 | + + provider.getClass() + " to " + interfaceType); | ||
354 | } | 375 | } |
355 | 376 | ||
356 | if (exclusive) | 377 | if (exclusive) |
@@ -365,7 +386,7 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | @@ -365,7 +386,7 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | ||
365 | for (Listener consumer : this.listeners) | 386 | for (Listener consumer : this.listeners) |
366 | { | 387 | { |
367 | handler.registerListener(consumer); | 388 | handler.registerListener(consumer); |
368 | - } | 389 | + } |
369 | } | 390 | } |
370 | else if (this.activeRegistrationDelegate != null) | 391 | else if (this.activeRegistrationDelegate != null) |
371 | { | 392 | { |
@@ -388,7 +409,9 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | @@ -388,7 +409,9 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | ||
388 | for (InterfaceHandler handler : this.interfaceHandlers) | 409 | for (InterfaceHandler handler : this.interfaceHandlers) |
389 | { | 410 | { |
390 | if (handler.interfaceType == interfaceType) | 411 | if (handler.interfaceType == interfaceType) |
412 | + { | ||
391 | handlers.add(handler.provider); | 413 | handlers.add(handler.provider); |
414 | + } | ||
392 | } | 415 | } |
393 | 416 | ||
394 | if (this.activeRegistrationDelegate != null) | 417 | if (this.activeRegistrationDelegate != null) |
@@ -396,7 +419,9 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | @@ -396,7 +419,9 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | ||
396 | for (InterfaceHandler handler : this.activeRegistrationDelegate.getHandlers()) | 419 | for (InterfaceHandler handler : this.activeRegistrationDelegate.getHandlers()) |
397 | { | 420 | { |
398 | if (handler.interfaceType == interfaceType) | 421 | if (handler.interfaceType == interfaceType) |
422 | + { | ||
399 | handlers.add(handler.provider); | 423 | handlers.add(handler.provider); |
424 | + } | ||
400 | } | 425 | } |
401 | } | 426 | } |
402 | 427 | ||
@@ -417,7 +442,8 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | @@ -417,7 +442,8 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | ||
417 | { | 442 | { |
418 | if (handler.exclusive) | 443 | if (handler.exclusive) |
419 | { | 444 | { |
420 | - throw new RuntimeException("Attempt to register an exclusive handler when an exclusive handler already exists for " + interfaceType); | 445 | + throw new RuntimeException("Attempt to register an exclusive handler when an exclusive handler already exists for " |
446 | + + interfaceType); | ||
421 | } | 447 | } |
422 | 448 | ||
423 | iter.remove(); | 449 | iter.remove(); |
@@ -426,8 +452,8 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | @@ -426,8 +452,8 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | ||
426 | } | 452 | } |
427 | 453 | ||
428 | /** | 454 | /** |
429 | - * Returns the API which supplied a particular provider, if the provider was supplied by an API, otherwise | ||
430 | - * returns null | 455 | + * Returns the API which supplied a particular provider, if the provider was |
456 | + * supplied by an API, otherwise returns null. | ||
431 | * | 457 | * |
432 | * @param provider | 458 | * @param provider |
433 | */ | 459 | */ |
@@ -451,8 +477,9 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | @@ -451,8 +477,9 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry | ||
451 | } | 477 | } |
452 | 478 | ||
453 | /** | 479 | /** |
454 | - * Offers an interface listener to the manager, the listener will actually be registered with the interface | ||
455 | - * handlers at the end of the startup process | 480 | + * Offers an interface listener to the manager, the listener will actually |
481 | + * be registered with the interface handlers at the end of the startup | ||
482 | + * process. | ||
456 | * | 483 | * |
457 | * @param listener | 484 | * @param listener |
458 | */ | 485 | */ |
src/main/java/com/mumfrey/liteloader/core/LiteLoaderMods.java
@@ -193,7 +193,9 @@ public class LiteLoaderMods | @@ -193,7 +193,9 @@ public class LiteLoaderMods | ||
193 | for (Mod mod : this.allMods) | 193 | for (Mod mod : this.allMods) |
194 | { | 194 | { |
195 | if (instance == mod.getMod()) | 195 | if (instance == mod.getMod()) |
196 | + { | ||
196 | return mod; | 197 | return mod; |
198 | + } | ||
197 | } | 199 | } |
198 | 200 | ||
199 | return null; | 201 | return null; |
@@ -232,7 +234,9 @@ public class LiteLoaderMods | @@ -232,7 +234,9 @@ public class LiteLoaderMods | ||
232 | for (Mod mod : this.allMods) | 234 | for (Mod mod : this.allMods) |
233 | { | 235 | { |
234 | if (mod.matchesName(modName)) | 236 | if (mod.matchesName(modName)) |
237 | + { | ||
235 | return (T)mod.getMod(); | 238 | return (T)mod.getMod(); |
239 | + } | ||
236 | } | 240 | } |
237 | 241 | ||
238 | return null; | 242 | return null; |
@@ -249,7 +253,9 @@ public class LiteLoaderMods | @@ -249,7 +253,9 @@ public class LiteLoaderMods | ||
249 | for (Mod mod : this.allMods) | 253 | for (Mod mod : this.allMods) |
250 | { | 254 | { |
251 | if (mod.getModClass().equals(modClass)) | 255 | if (mod.getModClass().equals(modClass)) |
256 | + { | ||
252 | return (T)mod.getMod(); | 257 | return (T)mod.getMod(); |
258 | + } | ||
253 | } | 259 | } |
254 | 260 | ||
255 | return null; | 261 | return null; |
@@ -267,7 +273,9 @@ public class LiteLoaderMods | @@ -267,7 +273,9 @@ public class LiteLoaderMods | ||
267 | for (Mod mod : this.allMods) | 273 | for (Mod mod : this.allMods) |
268 | { | 274 | { |
269 | if (mod.matchesIdentifier(identifier)) | 275 | if (mod.matchesIdentifier(identifier)) |
276 | + { | ||
270 | return mod.getModClass(); | 277 | return mod.getModClass(); |
278 | + } | ||
271 | } | 279 | } |
272 | 280 | ||
273 | return null; | 281 | return null; |
@@ -312,7 +320,8 @@ public class LiteLoaderMods | @@ -312,7 +320,8 @@ public class LiteLoaderMods | ||
312 | } | 320 | } |
313 | 321 | ||
314 | /** | 322 | /** |
315 | - * Get the mod identifier, this is used for versioning, exclusivity, and enablement checks | 323 | + * Get the mod identifier, this is used for versioning, exclusivity, and |
324 | + * enablement checks. | ||
316 | * | 325 | * |
317 | * @param modClass | 326 | * @param modClass |
318 | */ | 327 | */ |
@@ -322,7 +331,8 @@ public class LiteLoaderMods | @@ -322,7 +331,8 @@ public class LiteLoaderMods | ||
322 | } | 331 | } |
323 | 332 | ||
324 | /** | 333 | /** |
325 | - * Get the mod identifier, this is used for versioning, exclusivity, and enablement checks | 334 | + * Get the mod identifier, this is used for versioning, exclusivity, and |
335 | + * enablement checks. | ||
326 | * | 336 | * |
327 | * @param mod | 337 | * @param mod |
328 | */ | 338 | */ |
@@ -332,7 +342,8 @@ public class LiteLoaderMods | @@ -332,7 +342,8 @@ public class LiteLoaderMods | ||
332 | } | 342 | } |
333 | 343 | ||
334 | /** | 344 | /** |
335 | - * Get the container (mod file, classpath jar or folder) for the specified mod | 345 | + * Get the container (mod file, classpath jar or folder) for the specified |
346 | + * mod. | ||
336 | * | 347 | * |
337 | * @param modClass | 348 | * @param modClass |
338 | */ | 349 | */ |
@@ -342,7 +353,8 @@ public class LiteLoaderMods | @@ -342,7 +353,8 @@ public class LiteLoaderMods | ||
342 | } | 353 | } |
343 | 354 | ||
344 | /** | 355 | /** |
345 | - * Get the container (mod file, classpath jar or folder) for the specified mod | 356 | + * Get the container (mod file, classpath jar or folder) for the specified |
357 | + * mod. | ||
346 | * | 358 | * |
347 | * @param mod | 359 | * @param mod |
348 | */ | 360 | */ |
@@ -400,7 +412,9 @@ public class LiteLoaderMods | @@ -400,7 +412,9 @@ public class LiteLoaderMods | ||
400 | for (Mod mod : this.loadedMods) | 412 | for (Mod mod : this.loadedMods) |
401 | { | 413 | { |
402 | if (mod.matchesIdentifier(identifier)) | 414 | if (mod.matchesIdentifier(identifier)) |
415 | + { | ||
403 | return true; | 416 | return true; |
417 | + } | ||
404 | } | 418 | } |
405 | 419 | ||
406 | return false; | 420 | return false; |
@@ -509,7 +523,9 @@ public class LiteLoaderMods | @@ -509,7 +523,9 @@ public class LiteLoaderMods | ||
509 | for (ModInfo<?> mod : this.disabledMods) | 523 | for (ModInfo<?> mod : this.disabledMods) |
510 | { | 524 | { |
511 | if (mod.getContainer().equals(container)) | 525 | if (mod.getContainer().equals(container)) |
526 | + { | ||
512 | return; | 527 | return; |
528 | + } | ||
513 | } | 529 | } |
514 | 530 | ||
515 | if (container != LoadableMod.NONE) | 531 | if (container != LoadableMod.NONE) |
@@ -620,7 +636,8 @@ public class LiteLoaderMods | @@ -620,7 +636,8 @@ public class LiteLoaderMods | ||
620 | File newConfigPath = LiteLoader.getConfigFolder(); | 636 | File newConfigPath = LiteLoader.getConfigFolder(); |
621 | File oldConfigPath = this.environment.inflectVersionedConfigPath(lastModVersion); | 637 | File oldConfigPath = this.environment.inflectVersionedConfigPath(lastModVersion); |
622 | 638 | ||
623 | - LiteLoaderLogger.info("Performing config upgrade for mod %s. Upgrading %s to %s...", instance.getName(), lastModVersion, LiteLoaderVersion.CURRENT); | 639 | + LiteLoaderLogger.info("Performing config upgrade for mod %s. Upgrading %s to %s...", |
640 | + instance.getName(), lastModVersion, LiteLoaderVersion.CURRENT); | ||
624 | 641 | ||
625 | this.observers.all().onMigrateModConfig(instance, newConfigPath, oldConfigPath); | 642 | this.observers.all().onMigrateModConfig(instance, newConfigPath, oldConfigPath); |
626 | 643 | ||
@@ -635,7 +652,8 @@ public class LiteLoaderMods | @@ -635,7 +652,8 @@ public class LiteLoaderMods | ||
635 | } | 652 | } |
636 | else if (currentRevision < lastKnownRevision && ConfigManager.getConfigStrategy(instance) == ConfigStrategy.Unversioned) | 653 | else if (currentRevision < lastKnownRevision && ConfigManager.getConfigStrategy(instance) == ConfigStrategy.Unversioned) |
637 | { | 654 | { |
638 | - LiteLoaderLogger.warning("Mod %s has config from unknown loader revision %d. This may cause unexpected behaviour.", instance.getName(), lastKnownRevision); | 655 | + LiteLoaderLogger.warning("Mod %s has config from unknown loader revision %d. This may cause unexpected behaviour.", |
656 | + instance.getName(), lastKnownRevision); | ||
639 | } | 657 | } |
640 | } | 658 | } |
641 | 659 | ||
@@ -661,8 +679,8 @@ public class LiteLoaderMods | @@ -661,8 +679,8 @@ public class LiteLoaderMods | ||
661 | } | 679 | } |
662 | 680 | ||
663 | /** | 681 | /** |
664 | - * Check that all specified mod transformers were injected successfully, tag mods with failed transformers | ||
665 | - * as critically errored | 682 | + * Check that all specified mod transformers were injected successfully, tag |
683 | + * mods with failed transformers as critically errored. | ||
666 | */ | 684 | */ |
667 | private void validateModTransformers() | 685 | private void validateModTransformers() |
668 | { | 686 | { |
@@ -728,7 +746,9 @@ public class LiteLoaderMods | @@ -728,7 +746,9 @@ public class LiteLoaderMods | ||
728 | for (String modTransformer : modTransformers) | 746 | for (String modTransformer : modTransformers) |
729 | { | 747 | { |
730 | if (injectedTransformers.contains(modTransformer)) | 748 | if (injectedTransformers.contains(modTransformer)) |
749 | + { | ||
731 | return true; | 750 | return true; |
751 | + } | ||
732 | } | 752 | } |
733 | 753 | ||
734 | return false; | 754 | return false; |
src/main/java/com/mumfrey/liteloader/core/LiteLoaderUpdateSite.java
@@ -26,7 +26,8 @@ public class LiteLoaderUpdateSite extends UpdateSite | @@ -26,7 +26,8 @@ public class LiteLoaderUpdateSite extends UpdateSite | ||
26 | 26 | ||
27 | public LiteLoaderUpdateSite(String targetVersion, long currentTimeStamp) | 27 | public LiteLoaderUpdateSite(String targetVersion, long currentTimeStamp) |
28 | { | 28 | { |
29 | - super(LiteLoaderUpdateSite.UPDATE_SITE_URL, LiteLoaderUpdateSite.UPDATE_SITE_VERSIONS_JSON, targetVersion, LiteLoaderUpdateSite.UPDATE_SITE_ARTEFACT_NAME, currentTimeStamp); | 29 | + super(LiteLoaderUpdateSite.UPDATE_SITE_URL, LiteLoaderUpdateSite.UPDATE_SITE_VERSIONS_JSON, targetVersion, |
30 | + LiteLoaderUpdateSite.UPDATE_SITE_ARTEFACT_NAME, currentTimeStamp); | ||
30 | 31 | ||
31 | this.mcVersion = targetVersion; | 32 | this.mcVersion = targetVersion; |
32 | } | 33 | } |
@@ -52,7 +53,8 @@ public class LiteLoaderUpdateSite extends UpdateSite | @@ -52,7 +53,8 @@ public class LiteLoaderUpdateSite extends UpdateSite | ||
52 | if (!jarFile.isFile()) return false; | 53 | if (!jarFile.isFile()) return false; |
53 | 54 | ||
54 | // Validate that the jar is in the expected name and location | 55 | // Validate that the jar is in the expected name and location |
55 | - this.mcDir = this.walkAndValidateParents(jarFile, "liteloader-" + this.mcVersion + ".jar", this.mcVersion, "liteloader", "mumfrey", "com", "libraries"); | 56 | + this.mcDir = this.walkAndValidateParents(jarFile, "liteloader-" + this.mcVersion + ".jar", this.mcVersion, |
57 | + "liteloader", "mumfrey", "com", "libraries"); | ||
56 | if (this.mcDir == null) return false; | 58 | if (this.mcDir == null) return false; |
57 | 59 | ||
58 | // Check that the jar we found is actually on the current classpath | 60 | // Check that the jar we found is actually on the current classpath |
src/main/java/com/mumfrey/liteloader/core/LiteLoaderVersion.java
@@ -45,7 +45,8 @@ public enum LiteLoaderVersion | @@ -45,7 +45,8 @@ public enum LiteLoaderVersion | ||
45 | */ | 45 | */ |
46 | public static final LiteLoaderVersion CURRENT = LiteLoaderVersion.MC_1_8_0_R0; | 46 | public static final LiteLoaderVersion CURRENT = LiteLoaderVersion.MC_1_8_0_R0; |
47 | 47 | ||
48 | - private static final LiteLoaderUpdateSite updateSite = new LiteLoaderUpdateSite(LiteLoaderVersion.CURRENT.getMinecraftVersion(), LiteLoaderVersion.CURRENT.getReleaseTimestamp()); | 48 | + private static final LiteLoaderUpdateSite updateSite = new LiteLoaderUpdateSite(LiteLoaderVersion.CURRENT.getMinecraftVersion(), |
49 | + LiteLoaderVersion.CURRENT.getReleaseTimestamp()); | ||
49 | 50 | ||
50 | private final int revision; | 51 | private final int revision; |
51 | 52 | ||
@@ -98,7 +99,9 @@ public enum LiteLoaderVersion | @@ -98,7 +99,9 @@ public enum LiteLoaderVersion | ||
98 | for (LiteLoaderVersion version : LiteLoaderVersion.values()) | 99 | for (LiteLoaderVersion version : LiteLoaderVersion.values()) |
99 | { | 100 | { |
100 | if (version.getLoaderRevision() == revision) | 101 | if (version.getLoaderRevision() == revision) |
102 | + { | ||
101 | return version; | 103 | return version; |
104 | + } | ||
102 | } | 105 | } |
103 | 106 | ||
104 | return LiteLoaderVersion.LEGACY; | 107 | return LiteLoaderVersion.LEGACY; |
@@ -109,7 +112,9 @@ public enum LiteLoaderVersion | @@ -109,7 +112,9 @@ public enum LiteLoaderVersion | ||
109 | for (LiteLoaderVersion version : LiteLoaderVersion.values()) | 112 | for (LiteLoaderVersion version : LiteLoaderVersion.values()) |
110 | { | 113 | { |
111 | if (version.getLoaderVersion().equals(versionString)) | 114 | if (version.getLoaderVersion().equals(versionString)) |
115 | + { | ||
112 | return version.getLoaderRevision(); | 116 | return version.getLoaderRevision(); |
117 | + } | ||
113 | } | 118 | } |
114 | 119 | ||
115 | return LiteLoaderVersion.LEGACY.getLoaderRevision(); | 120 | return LiteLoaderVersion.LEGACY.getLoaderRevision(); |
src/main/java/com/mumfrey/liteloader/core/Mod.java
@@ -31,12 +31,14 @@ class Mod extends ModInfo<LoadableMod<?>> | @@ -31,12 +31,14 @@ class Mod extends ModInfo<LoadableMod<?>> | ||
31 | private LiteMod instance; | 31 | private LiteMod instance; |
32 | 32 | ||
33 | /** | 33 | /** |
34 | - * Mod display name, initially read from metadata then replaced with real name once instanced | 34 | + * Mod display name, initially read from metadata then replaced with real |
35 | + * name once instanced. | ||
35 | */ | 36 | */ |
36 | private String name; | 37 | private String name; |
37 | 38 | ||
38 | /** | 39 | /** |
39 | - * Mod display name, initially read from version then replaced with real version once instanced | 40 | + * Mod display name, initially read from version then replaced with real |
41 | + * version once instanced. | ||
40 | */ | 42 | */ |
41 | private String version; | 43 | private String version; |
42 | 44 |
src/main/java/com/mumfrey/liteloader/core/ModInfo.java
@@ -12,8 +12,9 @@ import com.mumfrey.liteloader.interfaces.LoadableMod; | @@ -12,8 +12,9 @@ import com.mumfrey.liteloader.interfaces.LoadableMod; | ||
12 | import com.mumfrey.liteloader.interfaces.TweakContainer; | 12 | import com.mumfrey.liteloader.interfaces.TweakContainer; |
13 | 13 | ||
14 | /** | 14 | /** |
15 | - * ModInfo is used to keep runtime information about a mod (or other injectable) together with relevant | ||
16 | - * environmental information (such as startup errors) and its container. | 15 | + * ModInfo is used to keep runtime information about a mod (or other injectable) |
16 | + * together with relevant environmental information (such as startup errors) and | ||
17 | + * its container. | ||
17 | * | 18 | * |
18 | * @author Adam Mummery-Smith | 19 | * @author Adam Mummery-Smith |
19 | * | 20 | * |
@@ -189,7 +190,9 @@ public abstract class ModInfo<TContainer extends Loadable<?>> | @@ -189,7 +190,9 @@ public abstract class ModInfo<TContainer extends Loadable<?>> | ||
189 | for (String requiredAPI : ((LoadableMod<?>)this.container).getRequiredAPIs()) | 190 | for (String requiredAPI : ((LoadableMod<?>)this.container).getRequiredAPIs()) |
190 | { | 191 | { |
191 | if (!ModInfo.BUILT_IN_APIS.contains(requiredAPI)) | 192 | if (!ModInfo.BUILT_IN_APIS.contains(requiredAPI)) |
193 | + { | ||
192 | return true; | 194 | return true; |
195 | + } | ||
193 | } | 196 | } |
194 | } | 197 | } |
195 | 198 |
src/main/java/com/mumfrey/liteloader/core/PacketEvents.java
@@ -55,7 +55,8 @@ public abstract class PacketEvents implements InterfaceProvider | @@ -55,7 +55,8 @@ public abstract class PacketEvents implements InterfaceProvider | ||
55 | 55 | ||
56 | private PacketHandlerList[] packetHandlers = new PacketHandlerList[Packets.count()]; | 56 | private PacketHandlerList[] packetHandlers = new PacketHandlerList[Packets.count()]; |
57 | 57 | ||
58 | - private FastIterable<ServerChatFilter> serverChatFilters = new HandlerList<ServerChatFilter>(ServerChatFilter.class, ReturnLogicOp.AND_BREAK_ON_FALSE); | 58 | + private FastIterable<ServerChatFilter> serverChatFilters = new HandlerList<ServerChatFilter>(ServerChatFilter.class, |
59 | + ReturnLogicOp.AND_BREAK_ON_FALSE); | ||
59 | 60 | ||
60 | private final int loginSuccessPacketId = Packets.S02PacketLoginSuccess.getIndex(); | 61 | private final int loginSuccessPacketId = Packets.S02PacketLoginSuccess.getIndex(); |
61 | private final int serverChatPacketId = Packets.S02PacketChat.getIndex(); | 62 | private final int serverChatPacketId = Packets.S02PacketChat.getIndex(); |
@@ -116,7 +117,8 @@ public abstract class PacketEvents implements InterfaceProvider | @@ -116,7 +117,8 @@ public abstract class PacketEvents implements InterfaceProvider | ||
116 | int packetId = Packets.indexOf(packetClassName); | 117 | int packetId = Packets.indexOf(packetClassName); |
117 | if (packetId == -1 || packetId >= this.packetHandlers.length) | 118 | if (packetId == -1 || packetId >= this.packetHandlers.length) |
118 | { | 119 | { |
119 | - LiteLoaderLogger.warning("PacketHandler %s attempted to register a handler for unupported packet class %s", handler.getName(), packetClassName); | 120 | + LiteLoaderLogger.warning("PacketHandler %s attempted to register a handler for unupported packet class %s", |
121 | + handler.getName(), packetClassName); | ||
120 | continue; | 122 | continue; |
121 | } | 123 | } |
122 | 124 | ||
@@ -188,8 +190,8 @@ public abstract class PacketEvents implements InterfaceProvider | @@ -188,8 +190,8 @@ public abstract class PacketEvents implements InterfaceProvider | ||
188 | * @param e | 190 | * @param e |
189 | * @param netHandler | 191 | * @param netHandler |
190 | * @param packetId | 192 | * @param packetId |
191 | - * | ||
192 | - * @return true if the packet was handled by a local handler and shouldn't be forwarded to later handlers | 193 | + * @return true if the packet was handled by a local handler and shouldn't |
194 | + * be forwarded to later handlers | ||
193 | */ | 195 | */ |
194 | protected boolean handlePacketEvent(PacketEventInfo<Packet> e, INetHandler netHandler, int packetId) | 196 | protected boolean handlePacketEvent(PacketEventInfo<Packet> e, INetHandler netHandler, int packetId) |
195 | { | 197 | { |
src/main/java/com/mumfrey/liteloader/core/PluginChannels.java
@@ -50,7 +50,8 @@ public abstract class PluginChannels<L extends CommonPluginChannelListener> impl | @@ -50,7 +50,8 @@ public abstract class PluginChannels<L extends CommonPluginChannelListener> impl | ||
50 | protected final Set<String> remotePluginChannels = new HashSet<String>(); | 50 | protected final Set<String> remotePluginChannels = new HashSet<String>(); |
51 | 51 | ||
52 | /** | 52 | /** |
53 | - * Keep track of faulting listeners so that we can periodically log a message if a listener is throwing LOTS of exceptions | 53 | + * Keep track of faulting listeners so that we can periodically log a |
54 | + * message if a listener is throwing LOTS of exceptions. | ||
54 | */ | 55 | */ |
55 | protected final Map<L, Integer> faultingPluginChannelListeners = new HashMap<L, Integer>(); | 56 | protected final Map<L, Integer> faultingPluginChannelListeners = new HashMap<L, Integer>(); |
56 | 57 | ||
@@ -176,7 +177,9 @@ public abstract class PluginChannels<L extends CommonPluginChannelListener> impl | @@ -176,7 +177,9 @@ public abstract class PluginChannels<L extends CommonPluginChannelListener> impl | ||
176 | for (String channel : channels) | 177 | for (String channel : channels) |
177 | { | 178 | { |
178 | if (channel.length() > 16 || channel.toUpperCase().equals(CHANNEL_REGISTER) || channel.toUpperCase().equals(CHANNEL_UNREGISTER)) | 179 | if (channel.length() > 16 || channel.toUpperCase().equals(CHANNEL_REGISTER) || channel.toUpperCase().equals(CHANNEL_UNREGISTER)) |
180 | + { | ||
179 | continue; | 181 | continue; |
182 | + } | ||
180 | 183 | ||
181 | if (!this.pluginChannels.containsKey(channel)) | 184 | if (!this.pluginChannels.containsKey(channel)) |
182 | { | 185 | { |
@@ -196,7 +199,8 @@ public abstract class PluginChannels<L extends CommonPluginChannelListener> impl | @@ -196,7 +199,8 @@ public abstract class PluginChannels<L extends CommonPluginChannelListener> impl | ||
196 | public enum ChannelPolicy | 199 | public enum ChannelPolicy |
197 | { | 200 | { |
198 | /** | 201 | /** |
199 | - * Dispatch the message, throw an exception if the channel is not registered | 202 | + * Dispatch the message, throw an exception if the channel is not |
203 | + * registered | ||
200 | */ | 204 | */ |
201 | DISPATCH, | 205 | DISPATCH, |
202 | 206 | ||
@@ -222,7 +226,8 @@ public abstract class PluginChannels<L extends CommonPluginChannelListener> impl | @@ -222,7 +226,8 @@ public abstract class PluginChannels<L extends CommonPluginChannelListener> impl | ||
222 | } | 226 | } |
223 | 227 | ||
224 | /** | 228 | /** |
225 | - * True if this policy does not throw an exception for unregistered outbound channels | 229 | + * True if this policy does not throw an exception for unregistered |
230 | + * outbound channels | ||
226 | */ | 231 | */ |
227 | public boolean isSilent() | 232 | public boolean isSilent() |
228 | { | 233 | { |
src/main/java/com/mumfrey/liteloader/core/ServerPluginChannels.java
@@ -26,7 +26,11 @@ public class ServerPluginChannels extends PluginChannels<ServerPluginChannelList | @@ -26,7 +26,11 @@ public class ServerPluginChannels extends PluginChannels<ServerPluginChannelList | ||
26 | 26 | ||
27 | public ServerPluginChannels() | 27 | public ServerPluginChannels() |
28 | { | 28 | { |
29 | - if (ServerPluginChannels.instance != null) throw new RuntimeException("Plugin Channels Startup Error", new InstantiationException("Only a single instance of ServerPluginChannels is allowed")); | 29 | + if (ServerPluginChannels.instance != null) |
30 | + { | ||
31 | + InstantiationException inner = new InstantiationException("Only a single instance of ServerPluginChannels is allowed"); | ||
32 | + throw new RuntimeException("Plugin Channels Startup Error", inner); | ||
33 | + } | ||
30 | ServerPluginChannels.instance = this; | 34 | ServerPluginChannels.instance = this; |
31 | } | 35 | } |
32 | 36 | ||
@@ -59,7 +63,8 @@ public class ServerPluginChannels extends PluginChannels<ServerPluginChannelList | @@ -59,7 +63,8 @@ public class ServerPluginChannels extends PluginChannels<ServerPluginChannelList | ||
59 | } | 63 | } |
60 | 64 | ||
61 | /* (non-Javadoc) | 65 | /* (non-Javadoc) |
62 | - * @see com.mumfrey.liteloader.api.InterfaceProvider#registerInterfaces(com.mumfrey.liteloader.core.InterfaceRegistrationDelegate) | 66 | + * @see com.mumfrey.liteloader.api.InterfaceProvider#registerInterfaces( |
67 | + * com.mumfrey.liteloader.core.InterfaceRegistrationDelegate) | ||
63 | */ | 68 | */ |
64 | @Override | 69 | @Override |
65 | public void registerInterfaces(InterfaceRegistrationDelegate delegate) | 70 | public void registerInterfaces(InterfaceRegistrationDelegate delegate) |
@@ -150,11 +155,14 @@ public class ServerPluginChannels extends PluginChannels<ServerPluginChannelList | @@ -150,11 +155,14 @@ public class ServerPluginChannels extends PluginChannels<ServerPluginChannelList | ||
150 | { | 155 | { |
151 | int failCount = 1; | 156 | int failCount = 1; |
152 | if (this.faultingPluginChannelListeners.containsKey(pluginChannelListener)) | 157 | if (this.faultingPluginChannelListeners.containsKey(pluginChannelListener)) |
158 | + { | ||
153 | failCount = this.faultingPluginChannelListeners.get(pluginChannelListener).intValue() + 1; | 159 | failCount = this.faultingPluginChannelListeners.get(pluginChannelListener).intValue() + 1; |
160 | + } | ||
154 | 161 | ||
155 | if (failCount >= PluginChannels.WARN_FAULT_THRESHOLD) | 162 | if (failCount >= PluginChannels.WARN_FAULT_THRESHOLD) |
156 | { | 163 | { |
157 | - LiteLoaderLogger.warning("Plugin channel listener %s exceeded fault threshold on channel %s with %s", pluginChannelListener.getName(), channel, ex.getClass().getSimpleName()); | 164 | + LiteLoaderLogger.warning("Plugin channel listener %s exceeded fault threshold on channel %s with %s", |
165 | + pluginChannelListener.getName(), channel, ex.getClass().getSimpleName()); | ||
158 | this.faultingPluginChannelListeners.remove(pluginChannelListener); | 166 | this.faultingPluginChannelListeners.remove(pluginChannelListener); |
159 | } | 167 | } |
160 | else | 168 | else |
@@ -219,7 +227,9 @@ public class ServerPluginChannels extends PluginChannels<ServerPluginChannelList | @@ -219,7 +227,9 @@ public class ServerPluginChannels extends PluginChannels<ServerPluginChannelList | ||
219 | if (recipient == null) return false; | 227 | if (recipient == null) return false; |
220 | 228 | ||
221 | if (channel == null || channel.length() > 16 || CHANNEL_REGISTER.equals(channel) || CHANNEL_UNREGISTER.equals(channel)) | 229 | if (channel == null || channel.length() > 16 || CHANNEL_REGISTER.equals(channel) || CHANNEL_UNREGISTER.equals(channel)) |
230 | + { | ||
222 | throw new RuntimeException("Invalid channel name specified"); | 231 | throw new RuntimeException("Invalid channel name specified"); |
232 | + } | ||
223 | 233 | ||
224 | if (!policy.allows(this, channel)) | 234 | if (!policy.allows(this, channel)) |
225 | { | 235 | { |
src/main/java/com/mumfrey/liteloader/core/api/DefaultClassValidator.java
@@ -19,19 +19,29 @@ public class DefaultClassValidator<T> implements ModClassValidator | @@ -19,19 +19,29 @@ public class DefaultClassValidator<T> implements ModClassValidator | ||
19 | @Override | 19 | @Override |
20 | public boolean validateName(String className) | 20 | public boolean validateName(String className) |
21 | { | 21 | { |
22 | - return this.supportedPrefixes == null || this.supportedPrefixes.size() == 0 || DefaultClassValidator.startsWithAny(className, this.supportedPrefixes); | 22 | + return this.supportedPrefixes == null |
23 | + || this.supportedPrefixes.size() == 0 | ||
24 | + || DefaultClassValidator.startsWithAny(className, this.supportedPrefixes); | ||
23 | } | 25 | } |
24 | 26 | ||
25 | @Override | 27 | @Override |
26 | public boolean validateClass(ClassLoader classLoader, Class<?> candidateClass) | 28 | public boolean validateClass(ClassLoader classLoader, Class<?> candidateClass) |
27 | { | 29 | { |
28 | - return (candidateClass != null && !this.superClass.equals(candidateClass) && this.superClass.isAssignableFrom(candidateClass) && !candidateClass.isInterface()); | 30 | + return (candidateClass != null |
31 | + && !this.superClass.equals(candidateClass) | ||
32 | + && this.superClass.isAssignableFrom(candidateClass) | ||
33 | + && !candidateClass.isInterface()); | ||
29 | } | 34 | } |
30 | 35 | ||
31 | private static boolean startsWithAny(String string, List<String> candidates) | 36 | private static boolean startsWithAny(String string, List<String> candidates) |
32 | { | 37 | { |
33 | for (String candidate : candidates) | 38 | for (String candidate : candidates) |
34 | - if (string.startsWith(candidate)) return true; | 39 | + { |
40 | + if (string.startsWith(candidate)) | ||
41 | + { | ||
42 | + return true; | ||
43 | + } | ||
44 | + } | ||
35 | 45 | ||
36 | return false; | 46 | return false; |
37 | } | 47 | } |
src/main/java/com/mumfrey/liteloader/core/api/DefaultEnumeratorPlugin.java
@@ -67,7 +67,9 @@ public class DefaultEnumeratorPlugin implements EnumeratorPlugin | @@ -67,7 +67,9 @@ public class DefaultEnumeratorPlugin implements EnumeratorPlugin | ||
67 | private boolean checkDependencies(ContainerRegistry containers, LoadableMod<?> base, LoadableMod<?> container, Set<String> circularDependencySet) | 67 | private boolean checkDependencies(ContainerRegistry containers, LoadableMod<?> base, LoadableMod<?> container, Set<String> circularDependencySet) |
68 | { | 68 | { |
69 | if (container.getDependencies().size() == 0) | 69 | if (container.getDependencies().size() == 0) |
70 | + { | ||
70 | return true; | 71 | return true; |
72 | + } | ||
71 | 73 | ||
72 | boolean result = true; | 74 | boolean result = true; |
73 | 75 | ||
@@ -87,14 +89,14 @@ public class DefaultEnumeratorPlugin implements EnumeratorPlugin | @@ -87,14 +89,14 @@ public class DefaultEnumeratorPlugin implements EnumeratorPlugin | ||
87 | } | 89 | } |
88 | else | 90 | else |
89 | { | 91 | { |
90 | - // LiteLoaderLogger.warning("Dependency %s required by %s is currently disabled", dependency, base.getIdentifier()); | 92 | +// LiteLoaderLogger.warning("Dependency %s required by %s is currently disabled", dependency, base.getIdentifier()); |
91 | base.registerMissingDependency(dependency); | 93 | base.registerMissingDependency(dependency); |
92 | result = false; | 94 | result = false; |
93 | } | 95 | } |
94 | } | 96 | } |
95 | else | 97 | else |
96 | { | 98 | { |
97 | - // LiteLoaderLogger.info("Dependency %s for %s is was not located, no container ", dependency, base.getIdentifier()); | 99 | +// LiteLoaderLogger.info("Dependency %s for %s is was not located, no container ", dependency, base.getIdentifier()); |
98 | base.registerMissingDependency(dependency); | 100 | base.registerMissingDependency(dependency); |
99 | result = false; | 101 | result = false; |
100 | } | 102 | } |
@@ -107,8 +109,6 @@ public class DefaultEnumeratorPlugin implements EnumeratorPlugin | @@ -107,8 +109,6 @@ public class DefaultEnumeratorPlugin implements EnumeratorPlugin | ||
107 | /** | 109 | /** |
108 | * Enumerate classes on the classpath which are subclasses of the specified | 110 | * Enumerate classes on the classpath which are subclasses of the specified |
109 | * class | 111 | * class |
110 | - * | ||
111 | - * @param superClass | ||
112 | */ | 112 | */ |
113 | @Override | 113 | @Override |
114 | public <T> List<Class<? extends T>> getClasses(LoadableMod<?> container, ClassLoader classloader, ModClassValidator validator) | 114 | public <T> List<Class<? extends T>> getClasses(LoadableMod<?> container, ClassLoader classloader, ModClassValidator validator) |
@@ -136,7 +136,8 @@ public class DefaultEnumeratorPlugin implements EnumeratorPlugin | @@ -136,7 +136,8 @@ public class DefaultEnumeratorPlugin implements EnumeratorPlugin | ||
136 | catch (OutdatedLoaderException ex) | 136 | catch (OutdatedLoaderException ex) |
137 | { | 137 | { |
138 | classes.clear(); | 138 | classes.clear(); |
139 | - LiteLoaderLogger.info(Verbosity.REDUCED, "Error searching in '%s', missing API component '%s', your loader is probably out of date", container, ex.getMessage()); | 139 | + LiteLoaderLogger.info(Verbosity.REDUCED, "Error searching in '%s', missing API component '%s', your loader is probably out of date", |
140 | + container, ex.getMessage()); | ||
140 | } | 141 | } |
141 | catch (Throwable th) | 142 | catch (Throwable th) |
142 | { | 143 | { |
@@ -148,10 +149,13 @@ public class DefaultEnumeratorPlugin implements EnumeratorPlugin | @@ -148,10 +149,13 @@ public class DefaultEnumeratorPlugin implements EnumeratorPlugin | ||
148 | } | 149 | } |
149 | 150 | ||
150 | @SuppressWarnings("unchecked") | 151 | @SuppressWarnings("unchecked") |
151 | - private static <T> Class<? extends T> checkClass(ClassLoader classLoader, ModClassValidator validator, String className) throws OutdatedLoaderException | 152 | + private static <T> Class<? extends T> checkClass(ClassLoader classLoader, ModClassValidator validator, String className) |
153 | + throws OutdatedLoaderException | ||
152 | { | 154 | { |
153 | if (className.indexOf('$') > -1) | 155 | if (className.indexOf('$') > -1) |
156 | + { | ||
154 | return null; | 157 | return null; |
158 | + } | ||
155 | 159 | ||
156 | try | 160 | try |
157 | { | 161 | { |
src/main/java/com/mumfrey/liteloader/core/api/EnumeratorModuleClassPath.java
@@ -58,7 +58,8 @@ public class EnumeratorModuleClassPath implements EnumeratorModule | @@ -58,7 +58,8 @@ public class EnumeratorModuleClassPath implements EnumeratorModule | ||
58 | } | 58 | } |
59 | 59 | ||
60 | /** | 60 | /** |
61 | - * Reads the class path entries that were supplied to the JVM and returns them as an array | 61 | + * Reads the class path entries that were supplied to the JVM and returns |
62 | + * them as an array. | ||
62 | */ | 63 | */ |
63 | private String[] readClassPath() | 64 | private String[] readClassPath() |
64 | { | 65 | { |
@@ -98,7 +99,8 @@ public class EnumeratorModuleClassPath implements EnumeratorModule | @@ -98,7 +99,8 @@ public class EnumeratorModuleClassPath implements EnumeratorModule | ||
98 | } | 99 | } |
99 | else | 100 | else |
100 | { | 101 | { |
101 | - LiteLoaderLogger.info(Verbosity.REDUCED, "Mod %s is disabled or missing a required dependency, not injecting tranformers", classPathMod.getIdentifier()); | 102 | + LiteLoaderLogger.info(Verbosity.REDUCED, "Mod %s is disabled or missing a required dependency, not injecting tranformers", |
103 | + classPathMod.getIdentifier()); | ||
102 | } | 104 | } |
103 | } | 105 | } |
104 | } | 106 | } |
src/main/java/com/mumfrey/liteloader/core/api/EnumeratorModuleFolder.java
@@ -52,7 +52,8 @@ public class EnumeratorModuleFolder implements FilenameFilter, EnumeratorModule | @@ -52,7 +52,8 @@ public class EnumeratorModuleFolder implements FilenameFilter, EnumeratorModule | ||
52 | protected boolean forceInjection; | 52 | protected boolean forceInjection; |
53 | 53 | ||
54 | /** | 54 | /** |
55 | - * True if this is a versioned folder and the enumerator should also try to load tweak jars which would normally be ignored | 55 | + * True if this is a versioned folder and the enumerator should also try to |
56 | + * load tweak jars which would normally be ignored. | ||
56 | */ | 57 | */ |
57 | protected final boolean loadTweakJars; | 58 | protected final boolean loadTweakJars; |
58 | 59 | ||
@@ -120,7 +121,8 @@ public class EnumeratorModuleFolder implements FilenameFilter, EnumeratorModule | @@ -120,7 +121,8 @@ public class EnumeratorModuleFolder implements FilenameFilter, EnumeratorModule | ||
120 | 121 | ||
121 | if (fileName.endsWith(".litemod.zip")) | 122 | if (fileName.endsWith(".litemod.zip")) |
122 | { | 123 | { |
123 | - LiteLoaderLogger.warning("Found %s with unsupported extension .litemod.zip. Please change file extension to .litemod to allow this file to be loaded!", fileName); | 124 | + LiteLoaderLogger.warning("Found %s with unsupported extension .litemod.zip." |
125 | + + " Please change file extension to .litemod to allow this file to be loaded!", fileName); | ||
124 | return true; | 126 | return true; |
125 | } | 127 | } |
126 | 128 | ||
@@ -128,7 +130,9 @@ public class EnumeratorModuleFolder implements FilenameFilter, EnumeratorModule | @@ -128,7 +130,9 @@ public class EnumeratorModuleFolder implements FilenameFilter, EnumeratorModule | ||
128 | } | 130 | } |
129 | 131 | ||
130 | /* (non-Javadoc) | 132 | /* (non-Javadoc) |
131 | - * @see com.mumfrey.liteloader.core.Enumerator#enumerate(com.mumfrey.liteloader.core.EnabledModsList, java.lang.String) | 133 | + * @see com.mumfrey.liteloader.core.Enumerator |
134 | + * #enumerate(com.mumfrey.liteloader.core.EnabledModsList, | ||
135 | + * java.lang.String) | ||
132 | */ | 136 | */ |
133 | @Override | 137 | @Override |
134 | public void enumerate(ModularEnumerator enumerator, String profile) | 138 | public void enumerate(ModularEnumerator enumerator, String profile) |
@@ -163,7 +167,8 @@ public class EnumeratorModuleFolder implements FilenameFilter, EnumeratorModule | @@ -163,7 +167,8 @@ public class EnumeratorModuleFolder implements FilenameFilter, EnumeratorModule | ||
163 | } | 167 | } |
164 | 168 | ||
165 | /** | 169 | /** |
166 | - * Check whether a particular file is valid, and add it to the candiates list if it appears to be acceptable | 170 | + * Check whether a particular file is valid, and add it to the candiates |
171 | + * list if it appears to be acceptable. | ||
167 | * | 172 | * |
168 | * @param enumerator | 173 | * @param enumerator |
169 | * @param candidateFile | 174 | * @param candidateFile |
@@ -188,13 +193,13 @@ public class EnumeratorModuleFolder implements FilenameFilter, EnumeratorModule | @@ -188,13 +193,13 @@ public class EnumeratorModuleFolder implements FilenameFilter, EnumeratorModule | ||
188 | else | 193 | else |
189 | { | 194 | { |
190 | LiteLoaderLogger.info("Ignoring %s", candidateFile); | 195 | LiteLoaderLogger.info("Ignoring %s", candidateFile); |
191 | - // enumerator.registerBadContainer(candidateFile, "No metadata"); | 196 | +// enumerator.registerBadContainer(candidateFile, "No metadata"); |
192 | } | 197 | } |
193 | } | 198 | } |
194 | - // else | ||
195 | - // { | ||
196 | - // enumerator.registerBadContainer(candidateFile, "Not a valid file"); | ||
197 | - // } | 199 | +// else |
200 | +// { | ||
201 | +// enumerator.registerBadContainer(candidateFile, "Not a valid file"); | ||
202 | +// } | ||
198 | } | 203 | } |
199 | 204 | ||
200 | /** | 205 | /** |
@@ -232,8 +237,9 @@ public class EnumeratorModuleFolder implements FilenameFilter, EnumeratorModule | @@ -232,8 +237,9 @@ public class EnumeratorModuleFolder implements FilenameFilter, EnumeratorModule | ||
232 | } | 237 | } |
233 | 238 | ||
234 | /** | 239 | /** |
235 | - * Called only if the file is not a valid mod container (has no mod metadata) to check whether it | ||
236 | - * could instead be a potential tweak container | 240 | + * Called only if the file is not a valid mod container (has no mod |
241 | + * metadata) to check whether it could instead be a potential tweak | ||
242 | + * container. | ||
237 | * | 243 | * |
238 | * @param candidateFile | 244 | * @param candidateFile |
239 | */ | 245 | */ |
@@ -341,7 +347,8 @@ public class EnumeratorModuleFolder implements FilenameFilter, EnumeratorModule | @@ -341,7 +347,8 @@ public class EnumeratorModuleFolder implements FilenameFilter, EnumeratorModule | ||
341 | } | 347 | } |
342 | else | 348 | else |
343 | { | 349 | { |
344 | - LiteLoaderLogger.info(Verbosity.REDUCED, "Not adding valid mod file '%s', the specified mod is disabled or missing a required dependency", modFile); | 350 | + LiteLoaderLogger.info(Verbosity.REDUCED, "Not adding valid mod file '%s', the specified mod is disabled or missing a required dependency", |
351 | + modFile); | ||
345 | } | 352 | } |
346 | 353 | ||
347 | if (this.loadTweaks) | 354 | if (this.loadTweaks) |
src/main/java/com/mumfrey/liteloader/core/api/LiteLoaderCoreAPI.java
@@ -76,7 +76,9 @@ public abstract class LiteLoaderCoreAPI implements LiteAPI | @@ -76,7 +76,9 @@ public abstract class LiteLoaderCoreAPI implements LiteAPI | ||
76 | } | 76 | } |
77 | 77 | ||
78 | /* (non-Javadoc) | 78 | /* (non-Javadoc) |
79 | - * @see com.mumfrey.liteloader.api.LiteAPI#init(com.mumfrey.liteloader.launch.LoaderEnvironment, com.mumfrey.liteloader.launch.LoaderProperties) | 79 | + * @see com.mumfrey.liteloader.api.LiteAPI#init( |
80 | + * com.mumfrey.liteloader.launch.LoaderEnvironment, | ||
81 | + * com.mumfrey.liteloader.launch.LoaderProperties) | ||
80 | */ | 82 | */ |
81 | @Override | 83 | @Override |
82 | public void init(LoaderEnvironment environment, LoaderProperties properties) | 84 | public void init(LoaderEnvironment environment, LoaderProperties properties) |
src/main/java/com/mumfrey/liteloader/core/api/LoadableModClassPath.java
@@ -39,7 +39,8 @@ public class LoadableModClassPath extends LoadableModFile | @@ -39,7 +39,8 @@ public class LoadableModClassPath extends LoadableModFile | ||
39 | } | 39 | } |
40 | else | 40 | else |
41 | { | 41 | { |
42 | - this.modName = String.format("%s.%s", this.getParentFile() != null ? this.getParentFile().getName().toLowerCase() : "", this.getName().toLowerCase()); | 42 | + String parentFileName = this.getParentFile() != null ? this.getParentFile().getName().toLowerCase() : ""; |
43 | + this.modName = String.format("%s.%s", parentFileName, this.getName().toLowerCase()); | ||
43 | this.modNameRequired = true; | 44 | this.modNameRequired = true; |
44 | } | 45 | } |
45 | } | 46 | } |
src/main/java/com/mumfrey/liteloader/core/api/LoadableModFile.java
@@ -32,9 +32,10 @@ import com.mumfrey.liteloader.launch.LoaderEnvironment; | @@ -32,9 +32,10 @@ import com.mumfrey.liteloader.launch.LoaderEnvironment; | ||
32 | import com.mumfrey.liteloader.util.log.LiteLoaderLogger; | 32 | import com.mumfrey.liteloader.util.log.LiteLoaderLogger; |
33 | 33 | ||
34 | /** | 34 | /** |
35 | - * Wrapper for file which represents a mod file to load with associated version information and | ||
36 | - * metadata. Retrieve this from litemod.json at enumeration time. We also override comparable to | ||
37 | - * provide our own custom sorting logic based on version info. | 35 | + * Wrapper for file which represents a mod file to load with associated version |
36 | + * information and metadata. Retrieve this from litemod.json at enumeration | ||
37 | + * time. We also override comparable to provide our own custom sorting logic | ||
38 | + * based on version info. | ||
38 | * | 39 | * |
39 | * @author Adam Mummery-Smith | 40 | * @author Adam Mummery-Smith |
40 | */ | 41 | */ |
@@ -53,12 +54,14 @@ public class LoadableModFile extends LoadableFile implements LoadableMod<File> | @@ -53,12 +54,14 @@ public class LoadableModFile extends LoadableFile implements LoadableMod<File> | ||
53 | protected static Gson gson = new Gson(); | 54 | protected static Gson gson = new Gson(); |
54 | 55 | ||
55 | /** | 56 | /** |
56 | - * True if the metadata information is parsed successfully, the mod will be added | 57 | + * True if the metadata information is parsed successfully, the mod will be |
58 | + * added. | ||
57 | */ | 59 | */ |
58 | protected boolean valid = false; | 60 | protected boolean valid = false; |
59 | 61 | ||
60 | /** | 62 | /** |
61 | - * Name of the mod specified in the JSON file, this can be any string but should be the same between mod versions | 63 | + * Name of the mod specified in the JSON file, this can be any string but |
64 | + * should be the same between mod versions. | ||
62 | */ | 65 | */ |
63 | protected String modName; | 66 | protected String modName; |
64 | 67 | ||
@@ -73,7 +76,8 @@ public class LoadableModFile extends LoadableFile implements LoadableMod<File> | @@ -73,7 +76,8 @@ public class LoadableModFile extends LoadableFile implements LoadableMod<File> | ||
73 | protected List<String> classTransformerClassNames = new ArrayList<String>(); | 76 | protected List<String> classTransformerClassNames = new ArrayList<String>(); |
74 | 77 | ||
75 | /** | 78 | /** |
76 | - * File time stamp, used as sorting criteria when no revision information is found | 79 | + * File time stamp, used as sorting criteria when no revision information is |
80 | + * found. | ||
77 | */ | 81 | */ |
78 | protected long timeStamp; | 82 | protected long timeStamp; |
79 | 83 | ||
@@ -83,12 +87,14 @@ public class LoadableModFile extends LoadableFile implements LoadableMod<File> | @@ -83,12 +87,14 @@ public class LoadableModFile extends LoadableFile implements LoadableMod<File> | ||
83 | protected float revision = 0.0F; | 87 | protected float revision = 0.0F; |
84 | 88 | ||
85 | /** | 89 | /** |
86 | - * True if the revision number was successfully read, used as a semaphore so that we know when revision is a valid number | 90 | + * True if the revision number was successfully read, used as a semaphore so |
91 | + * that we know when revision is a valid number. | ||
87 | */ | 92 | */ |
88 | protected boolean hasRevision = false; | 93 | protected boolean hasRevision = false; |
89 | 94 | ||
90 | /** | 95 | /** |
91 | - * ALL of the parsed metadata from the file, associated with the mod later on for retrieval via the loader | 96 | + * ALL of the parsed metadata from the file, associated with the mod later |
97 | + * on for retrieval via the loader. | ||
92 | */ | 98 | */ |
93 | protected Map<String, Object> metaData = new HashMap<String, Object>(); | 99 | protected Map<String, Object> metaData = new HashMap<String, Object>(); |
94 | 100 | ||
@@ -154,7 +160,8 @@ public class LoadableModFile extends LoadableFile implements LoadableMod<File> | @@ -154,7 +160,8 @@ public class LoadableModFile extends LoadableFile implements LoadableMod<File> | ||
154 | } | 160 | } |
155 | catch (JsonSyntaxException jsx) | 161 | catch (JsonSyntaxException jsx) |
156 | { | 162 | { |
157 | - LiteLoaderLogger.warning("Error reading %s in %s, JSON syntax exception: %s", LoadableMod.METADATA_FILENAME, this.getAbsolutePath(), jsx.getMessage()); | 163 | + LiteLoaderLogger.warning("Error reading %s in %s, JSON syntax exception: %s", |
164 | + LoadableMod.METADATA_FILENAME, this.getAbsolutePath(), jsx.getMessage()); | ||
158 | return; | 165 | return; |
159 | } | 166 | } |
160 | 167 | ||
@@ -245,7 +252,9 @@ public class LoadableModFile extends LoadableFile implements LoadableMod<File> | @@ -245,7 +252,9 @@ public class LoadableModFile extends LoadableFile implements LoadableMod<File> | ||
245 | 252 | ||
246 | String descriptionKey = "description"; | 253 | String descriptionKey = "description"; |
247 | if (key != null && key.length() > 0) | 254 | if (key != null && key.length() > 0) |
255 | + { | ||
248 | descriptionKey += "." + key.toLowerCase(); | 256 | descriptionKey += "." + key.toLowerCase(); |
257 | + } | ||
249 | 258 | ||
250 | return this.getMetaValue(descriptionKey, this.getMetaValue("description", "")); | 259 | return this.getMetaValue(descriptionKey, this.getMetaValue("description", "")); |
251 | } | 260 | } |
@@ -347,7 +356,9 @@ public class LoadableModFile extends LoadableFile implements LoadableMod<File> | @@ -347,7 +356,9 @@ public class LoadableModFile extends LoadableFile implements LoadableMod<File> | ||
347 | for (String name : this.getMetaValues(metaKey, separator)) | 356 | for (String name : this.getMetaValues(metaKey, separator)) |
348 | { | 357 | { |
349 | if (!Strings.isNullOrEmpty(name)) | 358 | if (!Strings.isNullOrEmpty(name)) |
359 | + { | ||
350 | collection.add(name); | 360 | collection.add(name); |
361 | + } | ||
351 | } | 362 | } |
352 | } | 363 | } |
353 | 364 | ||
@@ -512,7 +523,9 @@ public class LoadableModFile extends LoadableFile implements LoadableMod<File> | @@ -512,7 +523,9 @@ public class LoadableModFile extends LoadableFile implements LoadableMod<File> | ||
512 | { | 523 | { |
513 | // Prevent crash due to broken recursion | 524 | // Prevent crash due to broken recursion |
514 | if (depth > MAX_DISCOVERY_DEPTH) | 525 | if (depth > MAX_DISCOVERY_DEPTH) |
526 | + { | ||
515 | return classes; | 527 | return classes; |
528 | + } | ||
516 | 529 | ||
517 | File[] classFiles = packagePath.listFiles(); | 530 | File[] classFiles = packagePath.listFiles(); |
518 | 531 |
src/main/java/com/mumfrey/liteloader/core/event/Cancellable.java
@@ -21,7 +21,8 @@ public interface Cancellable | @@ -21,7 +21,8 @@ public interface Cancellable | ||
21 | * If the object is cancellable, cancels the object, implementors may throw | 21 | * If the object is cancellable, cancels the object, implementors may throw |
22 | * an EventCancellationException if the object is not actually cancellable. | 22 | * an EventCancellationException if the object is not actually cancellable. |
23 | * | 23 | * |
24 | - * @throws EventCancellationException (optional) may be thrown if the object is not actually cancellable | 24 | + * @throws EventCancellationException (optional) may be thrown if the object |
25 | + * is not actually cancellable | ||
25 | */ | 26 | */ |
26 | public abstract void cancel() throws EventCancellationException; | 27 | public abstract void cancel() throws EventCancellationException; |
27 | } | 28 | } |
28 | \ No newline at end of file | 29 | \ No newline at end of file |
src/main/java/com/mumfrey/liteloader/core/event/EventProxy.java
@@ -13,10 +13,11 @@ import com.mumfrey.liteloader.transformers.ByteCodeUtilities; | @@ -13,10 +13,11 @@ import com.mumfrey.liteloader.transformers.ByteCodeUtilities; | ||
13 | import com.mumfrey.liteloader.transformers.event.EventInfo; | 13 | import com.mumfrey.liteloader.transformers.event.EventInfo; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | - * EventProxy is a special class used by the EventInjectionTransformer, it is a stub class into which all of | ||
17 | - * the injected event callback methods are injected. Each event handler method contains a try/catch block which | ||
18 | - * invokes one of the error reporting methods contained below when an error occurs, in order to provide more | ||
19 | - * meaningful information to the user and to mod makers. | 16 | + * EventProxy is a special class used by the EventInjectionTransformer, it is a |
17 | + * stub class into which all of the injected event callback methods are | ||
18 | + * injected. Each event handler method contains a try/catch block which invokes | ||
19 | + * one of the error reporting methods contained below when an error occurs, in | ||
20 | + * order to provide more meaningful information to the user and to mod makers. | ||
20 | * | 21 | * |
21 | * @author Adam Mummery-Smith | 22 | * @author Adam Mummery-Smith |
22 | */ | 23 | */ |
@@ -165,8 +166,14 @@ public final class EventProxy | @@ -165,8 +166,14 @@ public final class EventProxy | ||
165 | String typeName = type.getClassName(); | 166 | String typeName = type.getClassName(); |
166 | typeName = typeName.substring(typeName.lastIndexOf('.') + 1); | 167 | typeName = typeName.substring(typeName.lastIndexOf('.') + 1); |
167 | tpl.append(typeName); | 168 | tpl.append(typeName); |
168 | - if (typeName.endsWith("ReturnEventInfo")) tpl.append('<').append(sourceClass).append(", ReturnType>"); | ||
169 | - else if (typeName.endsWith("EventInfo")) tpl.append('<').append(sourceClass).append('>'); | 169 | + if (typeName.endsWith("ReturnEventInfo")) |
170 | + { | ||
171 | + tpl.append('<').append(sourceClass).append(", ReturnType>"); | ||
172 | + } | ||
173 | + else if (typeName.endsWith("EventInfo")) | ||
174 | + { | ||
175 | + tpl.append('<').append(sourceClass).append('>'); | ||
176 | + } | ||
170 | return false; | 177 | return false; |
171 | default: | 178 | default: |
172 | tpl.append(ByteCodeUtilities.getTypeName(type)); | 179 | tpl.append(ByteCodeUtilities.getTypeName(type)); |
src/main/java/com/mumfrey/liteloader/core/event/HandlerList.java
@@ -36,8 +36,8 @@ import com.mumfrey.liteloader.util.SortableValue; | @@ -36,8 +36,8 @@ import com.mumfrey.liteloader.util.SortableValue; | ||
36 | import com.mumfrey.liteloader.util.log.LiteLoaderLogger; | 36 | import com.mumfrey.liteloader.util.log.LiteLoaderLogger; |
37 | 37 | ||
38 | /** | 38 | /** |
39 | - * HandlerList is a generic class which supports baking a list of event handlers into a dynamic inner | ||
40 | - * class for invokation at runtime. | 39 | + * HandlerList is a generic class which supports baking a list of event handlers |
40 | + * into a dynamic inner class for invocation at runtime. | ||
41 | * | 41 | * |
42 | * @author Adam Mummery-Smith | 42 | * @author Adam Mummery-Smith |
43 | * | 43 | * |
@@ -57,27 +57,32 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T | @@ -57,27 +57,32 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T | ||
57 | public enum ReturnLogicOp | 57 | public enum ReturnLogicOp |
58 | { | 58 | { |
59 | /** | 59 | /** |
60 | - * Logical OR applied between handlers, return FALSE unless one or more handlers returns TRUE | 60 | + * Logical OR applied between handlers, return FALSE unless one or more |
61 | + * handlers returns TRUE | ||
61 | */ | 62 | */ |
62 | OR(true, false), | 63 | OR(true, false), |
63 | 64 | ||
64 | /** | 65 | /** |
65 | - * Logical OR, returns TRUE at the first handler to return TRUE and doesn't process any further handlers | 66 | + * Logical OR, returns TRUE at the first handler to return TRUE and |
67 | + * doesn't process any further handlers. | ||
66 | */ | 68 | */ |
67 | OR_BREAK_ON_TRUE(true, true), | 69 | OR_BREAK_ON_TRUE(true, true), |
68 | 70 | ||
69 | /** | 71 | /** |
70 | - * Logical OR, but with the difference than an EMPTY handler list will return TRUE | 72 | + * Logical OR, but with the difference than an EMPTY handler list will |
73 | + * return TRUE. | ||
71 | */ | 74 | */ |
72 | OR_ASSUME_TRUE(true, false, true), | 75 | OR_ASSUME_TRUE(true, false, true), |
73 | 76 | ||
74 | /** | 77 | /** |
75 | - * Logical AND, returns TRUE if the list is empty or if all handlers return TRUE | 78 | + * Logical AND, returns TRUE if the list is empty or if all handlers |
79 | + * return TRUE. | ||
76 | */ | 80 | */ |
77 | AND(false, false), | 81 | AND(false, false), |
78 | 82 | ||
79 | /** | 83 | /** |
80 | - * Logical AND, returns FALSE at the first handler to return FALSE and doesn't process any further handlers | 84 | + * Logical AND, returns FALSE at the first handler to return FALSE and |
85 | + * doesn't process any further handlers. | ||
81 | */ | 86 | */ |
82 | AND_BREAK_ON_FALSE(false, true); | 87 | AND_BREAK_ON_FALSE(false, true); |
83 | 88 | ||
@@ -126,8 +131,8 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T | @@ -126,8 +131,8 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T | ||
126 | private final ReturnLogicOp logicOp; | 131 | private final ReturnLogicOp logicOp; |
127 | 132 | ||
128 | /** | 133 | /** |
129 | - * Current baked handler list, we cook them at gas mark 5 for 30 minutes in a disposable classloader whic | ||
130 | - * also handles the transformation for us | 134 | + * Current baked handler list, we cook them at gas mark 5 for 30 minutes in |
135 | + * a disposable classloader whic also handles the transformation for us. | ||
131 | */ | 136 | */ |
132 | private BakedHandlerList<T> bakedHandler; | 137 | private BakedHandlerList<T> bakedHandler; |
133 | 138 | ||
@@ -146,7 +151,8 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T | @@ -146,7 +151,8 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T | ||
146 | 151 | ||
147 | /** | 152 | /** |
148 | * @param type | 153 | * @param type |
149 | - * @param logicOp Logical operation to apply to interface methods which return boolean | 154 | + * @param logicOp Logical operation to apply to interface methods which |
155 | + * return boolean | ||
150 | */ | 156 | */ |
151 | public HandlerList(Class<T> type, ReturnLogicOp logicOp) | 157 | public HandlerList(Class<T> type, ReturnLogicOp logicOp) |
152 | { | 158 | { |
@@ -155,15 +161,17 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T | @@ -155,15 +161,17 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T | ||
155 | 161 | ||
156 | /** | 162 | /** |
157 | * @param type | 163 | * @param type |
158 | - * @param logicOp Logical operation to apply to interface methods which return boolean | ||
159 | - * @param sorted True to sort the list when baking (doesn't sort the underlying list) | 164 | + * @param logicOp Logical operation to apply to interface methods which |
165 | + * return boolean | ||
166 | + * @param sorted True to sort the list when baking (doesn't sort the | ||
167 | + * underlying list) | ||
160 | */ | 168 | */ |
161 | public HandlerList(Class<T> type, ReturnLogicOp logicOp, boolean sorted) | 169 | public HandlerList(Class<T> type, ReturnLogicOp logicOp, boolean sorted) |
162 | { | 170 | { |
163 | if (!type.isInterface()) | 171 | if (!type.isInterface()) |
164 | { | 172 | { |
165 | throw new IllegalArgumentException("HandlerList type argument must be an interface"); | 173 | throw new IllegalArgumentException("HandlerList type argument must be an interface"); |
166 | - } | 174 | + } |
167 | 175 | ||
168 | this.type = type; | 176 | this.type = type; |
169 | this.logicOp = logicOp; | 177 | this.logicOp = logicOp; |
@@ -593,7 +601,8 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T | @@ -593,7 +601,8 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T | ||
593 | private final Class<T> type; | 601 | private final Class<T> type; |
594 | 602 | ||
595 | /** | 603 | /** |
596 | - * Calculated class ref for the class type so that we don't have to keep calling getName().replace('.', '/') | 604 | + * Calculated class ref for the class type so that we don't have to keep |
605 | + * calling getName().replace('.', '/') | ||
597 | */ | 606 | */ |
598 | private final String typeRef; | 607 | private final String typeRef; |
599 | 608 | ||
@@ -669,7 +678,8 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T | @@ -669,7 +678,8 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T | ||
669 | * | 678 | * |
670 | * @param handlerClass Baked HandlerList class | 679 | * @param handlerClass Baked HandlerList class |
671 | * @return new instance of the Baked HandlerList class | 680 | * @return new instance of the Baked HandlerList class |
672 | - * @throws InstantiationException if the handler can't be created for some reason | 681 | + * @throws InstantiationException if the handler can't be created for |
682 | + * some reason | ||
673 | */ | 683 | */ |
674 | private BakedHandlerList<T> createInstance(Class<BakedHandlerList<T>> handlerClass) throws InstantiationException | 684 | private BakedHandlerList<T> createInstance(Class<BakedHandlerList<T>> handlerClass) throws InstantiationException |
675 | { | 685 | { |
@@ -701,7 +711,8 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T | @@ -701,7 +711,8 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T | ||
701 | try | 711 | try |
702 | { | 712 | { |
703 | // Read the basic class template | 713 | // Read the basic class template |
704 | - byte[] bytes = ByteCodeUtilities.applyTransformers(this.getTemplate().name, Launch.classLoader.getClassBytes(this.getTemplate().name)); | 714 | + byte[] bytes = ByteCodeUtilities.applyTransformers(this.getTemplate().name, |
715 | + Launch.classLoader.getClassBytes(this.getTemplate().name)); | ||
705 | ClassReader classReader = new ClassReader(bytes); | 716 | ClassReader classReader = new ClassReader(bytes); |
706 | ClassNode classNode = new ClassNode(); | 717 | ClassNode classNode = new ClassNode(); |
707 | classReader.accept(classNode, ClassReader.EXPAND_FRAMES); | 718 | classReader.accept(classNode, ClassReader.EXPAND_FRAMES); |
@@ -779,7 +790,8 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T | @@ -779,7 +790,8 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T | ||
779 | 790 | ||
780 | for (int handlerIndex = 0; handlerIndex < this.size; handlerIndex++) | 791 | for (int handlerIndex = 0; handlerIndex < this.size; handlerIndex++) |
781 | { | 792 | { |
782 | - classNode.fields.add(new FieldNode(Opcodes.ACC_PRIVATE, HandlerListClassLoader.HANDLER_VAR_PREFIX + handlerIndex, "L" + this.typeRef + ";", null, null)); | 793 | + classNode.fields.add(new FieldNode(Opcodes.ACC_PRIVATE, HandlerListClassLoader.HANDLER_VAR_PREFIX + handlerIndex, |
794 | + "L" + this.typeRef + ";", null, null)); | ||
783 | } | 795 | } |
784 | 796 | ||
785 | if (this.decorator != null) | 797 | if (this.decorator != null) |
@@ -874,11 +886,13 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T | @@ -874,11 +886,13 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T | ||
874 | { | 886 | { |
875 | method.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0)); | 887 | method.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0)); |
876 | method.instructions.add(new VarInsnNode(Opcodes.ALOAD, 1)); | 888 | method.instructions.add(new VarInsnNode(Opcodes.ALOAD, 1)); |
877 | - method.instructions.add(handlerIndex > Short.MAX_VALUE ? new LdcInsnNode(new Integer(handlerIndex)) : new IntInsnNode(Opcodes.SIPUSH, handlerIndex)); | 889 | + method.instructions.add(handlerIndex > Short.MAX_VALUE ? new LdcInsnNode(new Integer(handlerIndex)) |
890 | + : new IntInsnNode(Opcodes.SIPUSH, handlerIndex)); | ||
878 | method.instructions.add(new MethodInsnNode(Opcodes.INVOKEINTERFACE, "java/util/List", "get", "(I)Ljava/lang/Object;", true)); | 891 | method.instructions.add(new MethodInsnNode(Opcodes.INVOKEINTERFACE, "java/util/List", "get", "(I)Ljava/lang/Object;", true)); |
879 | method.instructions.add(new TypeInsnNode(Opcodes.CHECKCAST, this.typeRef)); | 892 | method.instructions.add(new TypeInsnNode(Opcodes.CHECKCAST, this.typeRef)); |
880 | - method.instructions.add(new FieldInsnNode(Opcodes.PUTFIELD, classNode.name, HandlerListClassLoader.HANDLER_VAR_PREFIX + handlerIndex, "L" + this.typeRef + ";")); | ||
881 | - } | 893 | + method.instructions.add(new FieldInsnNode(Opcodes.PUTFIELD, classNode.name, HandlerListClassLoader.HANDLER_VAR_PREFIX + handlerIndex, |
894 | + "L" + this.typeRef + ";")); | ||
895 | + } | ||
882 | 896 | ||
883 | method.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0)); | 897 | method.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0)); |
884 | method.instructions.add(new InsnNode(Opcodes.ARETURN)); | 898 | method.instructions.add(new InsnNode(Opcodes.ARETURN)); |
@@ -888,7 +902,8 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T | @@ -888,7 +902,8 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T | ||
888 | } | 902 | } |
889 | 903 | ||
890 | /** | 904 | /** |
891 | - * Recurse down the interface inheritance hierarchy and inject methods to handle each interface | 905 | + * Recurse down the interface inheritance hierarchy and inject methods |
906 | + * to handle each interface. | ||
892 | * | 907 | * |
893 | * @param classNode | 908 | * @param classNode |
894 | * @param interfaceName | 909 | * @param interfaceName |
@@ -917,7 +932,8 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T | @@ -917,7 +932,8 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T | ||
917 | } | 932 | } |
918 | 933 | ||
919 | /** | 934 | /** |
920 | - * Inject the supplied interface method into the target class an populate it with method calls to the list members | 935 | + * Inject the supplied interface method into the target class and |
936 | + * populate it with method calls to the list members | ||
921 | * | 937 | * |
922 | * @param classNode | 938 | * @param classNode |
923 | * @param method | 939 | * @param method |
@@ -930,12 +946,12 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T | @@ -930,12 +946,12 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T | ||
930 | if (returnType.equals(Type.BOOLEAN_TYPE)) | 946 | if (returnType.equals(Type.BOOLEAN_TYPE)) |
931 | { | 947 | { |
932 | method.access = Opcodes.ACC_PUBLIC; | 948 | method.access = Opcodes.ACC_PUBLIC; |
933 | - this.populateBooleanInvokationChain(classNode, method, args); | 949 | + this.populateBooleaninvocationChain(classNode, method, args); |
934 | } | 950 | } |
935 | else | 951 | else |
936 | { | 952 | { |
937 | method.access = Opcodes.ACC_PUBLIC; | 953 | method.access = Opcodes.ACC_PUBLIC; |
938 | - this.populateVoidInvokationChain(classNode, method, args, returnType); | 954 | + this.populateVoidinvocationChain(classNode, method, args, returnType); |
939 | } | 955 | } |
940 | 956 | ||
941 | if (this.decorator != null) | 957 | if (this.decorator != null) |
@@ -949,7 +965,7 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T | @@ -949,7 +965,7 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T | ||
949 | * @param method | 965 | * @param method |
950 | * @param args | 966 | * @param args |
951 | */ | 967 | */ |
952 | - private void populateVoidInvokationChain(ClassNode classNode, MethodNode method, Type[] args, Type returnType) | 968 | + private void populateVoidinvocationChain(ClassNode classNode, MethodNode method, Type[] args, Type returnType) |
953 | { | 969 | { |
954 | int returnSize = returnType.getSize(); | 970 | int returnSize = returnType.getSize(); |
955 | for (int handlerIndex = 0; handlerIndex < this.size; handlerIndex++) | 971 | for (int handlerIndex = 0; handlerIndex < this.size; handlerIndex++) |
@@ -989,7 +1005,7 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T | @@ -989,7 +1005,7 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T | ||
989 | * @param method | 1005 | * @param method |
990 | * @param args | 1006 | * @param args |
991 | */ | 1007 | */ |
992 | - private void populateBooleanInvokationChain(ClassNode classNode, MethodNode method, Type[] args) | 1008 | + private void populateBooleaninvocationChain(ClassNode classNode, MethodNode method, Type[] args) |
993 | { | 1009 | { |
994 | boolean isOrOperation = this.logicOp.isOr(); | 1010 | boolean isOrOperation = this.logicOp.isOr(); |
995 | boolean breakOnMatch = this.logicOp.breakOnMatch(); | 1011 | boolean breakOnMatch = this.logicOp.breakOnMatch(); |
@@ -1009,9 +1025,10 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T | @@ -1009,9 +1025,10 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T | ||
1009 | LabelNode lbl = new LabelNode(); | 1025 | LabelNode lbl = new LabelNode(); |
1010 | method.instructions.add(new JumpInsnNode(jumpCondition, lbl)); // jump over the set/return based on the condition | 1026 | method.instructions.add(new JumpInsnNode(jumpCondition, lbl)); // jump over the set/return based on the condition |
1011 | method.instructions.add(new InsnNode(semaphore)); // push TRUE or FALSE onto the stack | 1027 | method.instructions.add(new InsnNode(semaphore)); // push TRUE or FALSE onto the stack |
1012 | - method.instructions.add(breakOnMatch ? new InsnNode(Opcodes.IRETURN) : new VarInsnNode(Opcodes.ISTORE, localIndex)); // set local or return | 1028 | + // set local or return |
1029 | + method.instructions.add(breakOnMatch ? new InsnNode(Opcodes.IRETURN) : new VarInsnNode(Opcodes.ISTORE, localIndex)); | ||
1013 | method.instructions.add(lbl); // jump here | 1030 | method.instructions.add(lbl); // jump here |
1014 | - } | 1031 | + } |
1015 | 1032 | ||
1016 | method.instructions.add(new VarInsnNode(Opcodes.ILOAD, localIndex)); | 1033 | method.instructions.add(new VarInsnNode(Opcodes.ILOAD, localIndex)); |
1017 | method.instructions.add(new InsnNode(Opcodes.IRETURN)); | 1034 | method.instructions.add(new InsnNode(Opcodes.IRETURN)); |
@@ -1032,7 +1049,8 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T | @@ -1032,7 +1049,8 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T | ||
1032 | method.instructions.add(lineNumberLabel); | 1049 | method.instructions.add(lineNumberLabel); |
1033 | method.instructions.add(new LineNumberNode(100 + handlerIndex, lineNumberLabel)); | 1050 | method.instructions.add(new LineNumberNode(100 + handlerIndex, lineNumberLabel)); |
1034 | method.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0)); | 1051 | method.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0)); |
1035 | - method.instructions.add(new FieldInsnNode(Opcodes.GETFIELD, classNode.name, HandlerListClassLoader.HANDLER_VAR_PREFIX + handlerIndex, "L" + this.typeRef + ";")); | 1052 | + method.instructions.add(new FieldInsnNode(Opcodes.GETFIELD, classNode.name, HandlerListClassLoader.HANDLER_VAR_PREFIX + handlerIndex, |
1053 | + "L" + this.typeRef + ";")); | ||
1036 | 1054 | ||
1037 | if (this.decorator != null) | 1055 | if (this.decorator != null) |
1038 | { | 1056 | { |
@@ -1048,7 +1066,8 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T | @@ -1048,7 +1066,8 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T | ||
1048 | } | 1066 | } |
1049 | 1067 | ||
1050 | /** | 1068 | /** |
1051 | - * Inject instructions into the supplied method to invoke the same method on the supplied interface | 1069 | + * Inject instructions into the supplied method to invoke the same |
1070 | + * method on the supplied interface. | ||
1052 | * | 1071 | * |
1053 | * @param method | 1072 | * @param method |
1054 | * @param args | 1073 | * @param args |
src/main/java/com/mumfrey/liteloader/core/event/IHandlerListDecorator.java
@@ -10,7 +10,8 @@ import com.mumfrey.liteloader.core.event.HandlerList.BakedHandlerList; | @@ -10,7 +10,8 @@ import com.mumfrey.liteloader.core.event.HandlerList.BakedHandlerList; | ||
10 | import com.mumfrey.liteloader.core.runtime.Obf; | 10 | import com.mumfrey.liteloader.core.runtime.Obf; |
11 | 11 | ||
12 | /** | 12 | /** |
13 | - * Essentially a "mini plugin" for HandlerListClassLoader which allows alterations of the generated bytecode | 13 | + * Essentially a "mini plugin" for HandlerListClassLoader which allows |
14 | + * alterations of the generated bytecode. | ||
14 | * | 15 | * |
15 | * @author Adam Mummery-Smith | 16 | * @author Adam Mummery-Smith |
16 | * | 17 | * |
@@ -44,12 +45,14 @@ public interface IHandlerListDecorator<T> | @@ -44,12 +45,14 @@ public interface IHandlerListDecorator<T> | ||
44 | public abstract void processCtor(ClassNode classNode, MethodNode method); | 45 | public abstract void processCtor(ClassNode classNode, MethodNode method); |
45 | 46 | ||
46 | /** | 47 | /** |
47 | - * Called immediately before the interface method invokation bytecode is injected | 48 | + * Called immediately before the interface method invocation bytecode is |
49 | + * injected. | ||
48 | */ | 50 | */ |
49 | public abstract void preInvokeInterfaceMethod(int handlerIndex, ClassNode classNode, MethodNode method, Type[] args); | 51 | public abstract void preInvokeInterfaceMethod(int handlerIndex, ClassNode classNode, MethodNode method, Type[] args); |
50 | 52 | ||
51 | /** | 53 | /** |
52 | - * Called immediately after the interface method invokation bytecode is injected | 54 | + * Called immediately after the interface method invocation bytecode is |
55 | + * injected. | ||
53 | */ | 56 | */ |
54 | public abstract void postInvokeInterfaceMethod(int handlerIndex, ClassNode classNode, MethodNode method, Type[] args); | 57 | public abstract void postInvokeInterfaceMethod(int handlerIndex, ClassNode classNode, MethodNode method, Type[] args); |
55 | 58 |
src/main/java/com/mumfrey/liteloader/core/event/ProfilingHandlerList.java
@@ -19,7 +19,8 @@ import com.mumfrey.liteloader.api.Listener; | @@ -19,7 +19,8 @@ import com.mumfrey.liteloader.api.Listener; | ||
19 | import com.mumfrey.liteloader.core.runtime.Obf; | 19 | import com.mumfrey.liteloader.core.runtime.Obf; |
20 | 20 | ||
21 | /** | 21 | /** |
22 | - * A HandlerList which calls Profiler.beginSection and Profiler.endSection before every invokation | 22 | + * A HandlerList which calls Profiler.beginSection and Profiler.endSection |
23 | + * before every invocation. | ||
23 | * | 24 | * |
24 | * @author Adam Mummery-Smith | 25 | * @author Adam Mummery-Smith |
25 | * | 26 | * |
@@ -77,7 +78,7 @@ public class ProfilingHandlerList<T extends Listener> extends HandlerList<T> | @@ -77,7 +78,7 @@ public class ProfilingHandlerList<T extends Listener> extends HandlerList<T> | ||
77 | } | 78 | } |
78 | 79 | ||
79 | /** | 80 | /** |
80 | - * Decorator which adds the profiler section calls to the invokation lists | 81 | + * Decorator which adds the profiler section calls to the invocation lists |
81 | */ | 82 | */ |
82 | static class ProfilingHandlerListDecorator<T extends Listener> implements IHandlerListDecorator<T> | 83 | static class ProfilingHandlerListDecorator<T extends Listener> implements IHandlerListDecorator<T> |
83 | { | 84 | { |
@@ -91,7 +92,8 @@ public class ProfilingHandlerList<T extends Listener> extends HandlerList<T> | @@ -91,7 +92,8 @@ public class ProfilingHandlerList<T extends Listener> extends HandlerList<T> | ||
91 | } | 92 | } |
92 | 93 | ||
93 | /* (non-Javadoc) | 94 | /* (non-Javadoc) |
94 | - * @see com.mumfrey.liteloader.core.event.IHandlerListDecorator#getTemplate() | 95 | + * @see com.mumfrey.liteloader.core.event.IHandlerListDecorator |
96 | + * #getTemplate() | ||
95 | */ | 97 | */ |
96 | @Override | 98 | @Override |
97 | public Obf getTemplate() | 99 | public Obf getTemplate() |
@@ -100,7 +102,8 @@ public class ProfilingHandlerList<T extends Listener> extends HandlerList<T> | @@ -100,7 +102,8 @@ public class ProfilingHandlerList<T extends Listener> extends HandlerList<T> | ||
100 | } | 102 | } |
101 | 103 | ||
102 | /* (non-Javadoc) | 104 | /* (non-Javadoc) |
103 | - * @see com.mumfrey.liteloader.core.event.IHandlerListDecorator#prepare(java.util.List) | 105 | + * @see com.mumfrey.liteloader.core.event.IHandlerListDecorator |
106 | + * #prepare(java.util.List) | ||
104 | */ | 107 | */ |
105 | @Override | 108 | @Override |
106 | public void prepare(List<T> sortedList) | 109 | public void prepare(List<T> sortedList) |
@@ -115,7 +118,8 @@ public class ProfilingHandlerList<T extends Listener> extends HandlerList<T> | @@ -115,7 +118,8 @@ public class ProfilingHandlerList<T extends Listener> extends HandlerList<T> | ||
115 | } | 118 | } |
116 | 119 | ||
117 | /* (non-Javadoc) | 120 | /* (non-Javadoc) |
118 | - * @see com.mumfrey.liteloader.core.event.IHandlerListDecorator#createInstance(java.lang.Class) | 121 | + * @see com.mumfrey.liteloader.core.event.IHandlerListDecorator |
122 | + * #createInstance(java.lang.Class) | ||
119 | */ | 123 | */ |
120 | @Override | 124 | @Override |
121 | public BakedHandlerList<T> createInstance(Class<BakedHandlerList<T>> handlerClass) throws Exception | 125 | public BakedHandlerList<T> createInstance(Class<BakedHandlerList<T>> handlerClass) throws Exception |
@@ -134,7 +138,9 @@ public class ProfilingHandlerList<T extends Listener> extends HandlerList<T> | @@ -134,7 +138,9 @@ public class ProfilingHandlerList<T extends Listener> extends HandlerList<T> | ||
134 | } | 138 | } |
135 | 139 | ||
136 | /* (non-Javadoc) | 140 | /* (non-Javadoc) |
137 | - * @see com.mumfrey.liteloader.core.event.IHandlerListDecorator#populateClass(java.lang.String, org.objectweb.asm.tree.ClassNode) | 141 | + * @see com.mumfrey.liteloader.core.event.IHandlerListDecorator |
142 | + * #populateClass(java.lang.String, | ||
143 | + * org.objectweb.asm.tree.ClassNode) | ||
138 | */ | 144 | */ |
139 | @Override | 145 | @Override |
140 | public void populateClass(String name, ClassNode classNode) | 146 | public void populateClass(String name, ClassNode classNode) |
@@ -142,7 +148,9 @@ public class ProfilingHandlerList<T extends Listener> extends HandlerList<T> | @@ -142,7 +148,9 @@ public class ProfilingHandlerList<T extends Listener> extends HandlerList<T> | ||
142 | } | 148 | } |
143 | 149 | ||
144 | /* (non-Javadoc) | 150 | /* (non-Javadoc) |
145 | - * @see com.mumfrey.liteloader.core.event.IHandlerListDecorator#processCtor(org.objectweb.asm.tree.ClassNode, org.objectweb.asm.tree.MethodNode) | 151 | + * @see com.mumfrey.liteloader.core.event.IHandlerListDecorator |
152 | + * #processCtor(org.objectweb.asm.tree.ClassNode, | ||
153 | + * org.objectweb.asm.tree.MethodNode) | ||
146 | */ | 154 | */ |
147 | @Override | 155 | @Override |
148 | public void processCtor(ClassNode classNode, MethodNode method) | 156 | public void processCtor(ClassNode classNode, MethodNode method) |
@@ -151,12 +159,15 @@ public class ProfilingHandlerList<T extends Listener> extends HandlerList<T> | @@ -151,12 +159,15 @@ public class ProfilingHandlerList<T extends Listener> extends HandlerList<T> | ||
151 | method.instructions.clear(); | 159 | method.instructions.clear(); |
152 | method.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0)); | 160 | method.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0)); |
153 | method.instructions.add(new VarInsnNode(Opcodes.ALOAD, 1)); | 161 | method.instructions.add(new VarInsnNode(Opcodes.ALOAD, 1)); |
154 | - method.instructions.add(new MethodInsnNode(Opcodes.INVOKESPECIAL, Obf.BakedProfilingHandlerList.ref, Obf.constructor.name, method.desc, false)); | 162 | + method.instructions.add(new MethodInsnNode(Opcodes.INVOKESPECIAL, Obf.BakedProfilingHandlerList.ref, Obf.constructor.name, |
163 | + method.desc, false)); | ||
155 | method.instructions.add(new InsnNode(Opcodes.RETURN)); | 164 | method.instructions.add(new InsnNode(Opcodes.RETURN)); |
156 | } | 165 | } |
157 | 166 | ||
158 | /* (non-Javadoc) | 167 | /* (non-Javadoc) |
159 | - * @see com.mumfrey.liteloader.core.event.IHandlerListDecorator#preInvokeInterfaceMethod(int, org.objectweb.asm.tree.ClassNode, org.objectweb.asm.tree.MethodNode, org.objectweb.asm.Type[]) | 168 | + * @see com.mumfrey.liteloader.core.event.IHandlerListDecorator |
169 | + * #preInvokeInterfaceMethod(int, org.objectweb.asm.tree.ClassNode, | ||
170 | + * org.objectweb.asm.tree.MethodNode, org.objectweb.asm.Type[]) | ||
160 | */ | 171 | */ |
161 | @Override | 172 | @Override |
162 | public void preInvokeInterfaceMethod(int handlerIndex, ClassNode classNode, MethodNode method, Type[] args) | 173 | public void preInvokeInterfaceMethod(int handlerIndex, ClassNode classNode, MethodNode method, Type[] args) |
@@ -168,7 +179,9 @@ public class ProfilingHandlerList<T extends Listener> extends HandlerList<T> | @@ -168,7 +179,9 @@ public class ProfilingHandlerList<T extends Listener> extends HandlerList<T> | ||
168 | } | 179 | } |
169 | 180 | ||
170 | /* (non-Javadoc) | 181 | /* (non-Javadoc) |
171 | - * @see com.mumfrey.liteloader.core.event.IHandlerListDecorator#postInvokeInterfaceMethod(int, org.objectweb.asm.tree.ClassNode, org.objectweb.asm.tree.MethodNode, org.objectweb.asm.Type[]) | 182 | + * @see com.mumfrey.liteloader.core.event.IHandlerListDecorator |
183 | + * #postInvokeInterfaceMethod(int, org.objectweb.asm.tree.ClassNode, | ||
184 | + * org.objectweb.asm.tree.MethodNode, org.objectweb.asm.Type[]) | ||
172 | */ | 185 | */ |
173 | @Override | 186 | @Override |
174 | public void postInvokeInterfaceMethod(int handlerIndex, ClassNode classNode, MethodNode method, Type[] args) | 187 | public void postInvokeInterfaceMethod(int handlerIndex, ClassNode classNode, MethodNode method, Type[] args) |
@@ -179,7 +192,9 @@ public class ProfilingHandlerList<T extends Listener> extends HandlerList<T> | @@ -179,7 +192,9 @@ public class ProfilingHandlerList<T extends Listener> extends HandlerList<T> | ||
179 | } | 192 | } |
180 | 193 | ||
181 | /* (non-Javadoc) | 194 | /* (non-Javadoc) |
182 | - * @see com.mumfrey.liteloader.core.event.IHandlerListDecorator#populateInterfaceMethod(org.objectweb.asm.tree.ClassNode, org.objectweb.asm.tree.MethodNode) | 195 | + * @see com.mumfrey.liteloader.core.event.IHandlerListDecorator |
196 | + * #populateInterfaceMethod(org.objectweb.asm.tree.ClassNode, | ||
197 | + * org.objectweb.asm.tree.MethodNode) | ||
183 | */ | 198 | */ |
184 | @Override | 199 | @Override |
185 | public void populateInterfaceMethod(ClassNode classNode, MethodNode method) | 200 | public void populateInterfaceMethod(ClassNode classNode, MethodNode method) |
src/main/java/com/mumfrey/liteloader/core/exceptions/OutdatedLoaderException.java
1 | package com.mumfrey.liteloader.core.exceptions; | 1 | package com.mumfrey.liteloader.core.exceptions; |
2 | 2 | ||
3 | /** | 3 | /** |
4 | - * Exception thrown when a mod class references a liteloader interface which does not exist, | ||
5 | - * which more than likely means that it requires a more up-to-date version of the loader than | ||
6 | - * is currently installed. | 4 | + * Exception thrown when a mod class references a liteloader interface which |
5 | + * does not exist, which more than likely means that it requires a more | ||
6 | + * up-to-date version of the loader than is currently installed. | ||
7 | * | 7 | * |
8 | * @author Adam Mummery-Smith | 8 | * @author Adam Mummery-Smith |
9 | */ | 9 | */ |
src/main/java/com/mumfrey/liteloader/core/exceptions/ProfilerCrossThreadAccessException.java
1 | package com.mumfrey.liteloader.core.exceptions; | 1 | package com.mumfrey.liteloader.core.exceptions; |
2 | 2 | ||
3 | /** | 3 | /** |
4 | - * Exception to throw if startSection or endSection are called from a thread other than | ||
5 | - * the Minecraft main thread. This should NEVER happen and is an attempt to identify the | ||
6 | - * culprit of some profiler stack corruption causes. | 4 | + * Exception to throw if startSection or endSection are called from a thread |
5 | + * other than the Minecraft main thread. This should NEVER happen and is an | ||
6 | + * attempt to identify the culprit of some profiler stack corruption causes. | ||
7 | * | 7 | * |
8 | * @author Adam Mummery-Smith | 8 | * @author Adam Mummery-Smith |
9 | */ | 9 | */ |
src/main/java/com/mumfrey/liteloader/core/exceptions/ProfilerStackCorruptionException.java
1 | package com.mumfrey.liteloader.core.exceptions; | 1 | package com.mumfrey.liteloader.core.exceptions; |
2 | 2 | ||
3 | /** | 3 | /** |
4 | - * Exception to throw when a mod corrupts the profiler stack, this avoids throwing a | ||
5 | - * (somewhat cryptic) NoSuchElementException inside HookProfiler | 4 | + * Exception to throw when a mod corrupts the profiler stack, this avoids |
5 | + * throwing a (somewhat cryptic) NoSuchElementException inside HookProfiler | ||
6 | * | 6 | * |
7 | * @author Adam Mummery-Smith | 7 | * @author Adam Mummery-Smith |
8 | */ | 8 | */ |
9 | public class ProfilerStackCorruptionException extends RuntimeException | 9 | public class ProfilerStackCorruptionException extends RuntimeException |
10 | { | 10 | { |
11 | - /** | ||
12 | - * | ||
13 | - */ | ||
14 | private static final long serialVersionUID = -7745831270297368169L; | 11 | private static final long serialVersionUID = -7745831270297368169L; |
15 | 12 | ||
16 | public ProfilerStackCorruptionException(String message) | 13 | public ProfilerStackCorruptionException(String message) |
src/main/java/com/mumfrey/liteloader/core/runtime/Methods.java
@@ -13,6 +13,8 @@ import com.mumfrey.liteloader.transformers.event.MethodInfo; | @@ -13,6 +13,8 @@ import com.mumfrey.liteloader.transformers.event.MethodInfo; | ||
13 | */ | 13 | */ |
14 | public abstract class Methods | 14 | public abstract class Methods |
15 | { | 15 | { |
16 | + // CHECKSTYLE:OFF | ||
17 | + | ||
16 | // Client & General | 18 | // Client & General |
17 | public static final MethodInfo startGame = new MethodInfo(Obf.Minecraft, Obf.startGame, Void.TYPE); | 19 | public static final MethodInfo startGame = new MethodInfo(Obf.Minecraft, Obf.startGame, Void.TYPE); |
18 | public static final MethodInfo runGameLoop = new MethodInfo(Obf.Minecraft, Obf.runGameLoop, Void.TYPE); | 20 | public static final MethodInfo runGameLoop = new MethodInfo(Obf.Minecraft, Obf.runGameLoop, Void.TYPE); |
src/main/java/com/mumfrey/liteloader/core/runtime/Obf.java
@@ -256,7 +256,8 @@ public class Obf | @@ -256,7 +256,8 @@ public class Obf | ||
256 | } | 256 | } |
257 | 257 | ||
258 | /** | 258 | /** |
259 | - * Test whether any of this Obf's dimensions match the supplied name or ordinal | 259 | + * Test whether any of this Obf's dimensions match the supplied name or |
260 | + * ordinal | ||
260 | * | 261 | * |
261 | * @param name | 262 | * @param name |
262 | * @param ordinal | 263 | * @param ordinal |
@@ -348,7 +349,9 @@ public class Obf | @@ -348,7 +349,9 @@ public class Obf | ||
348 | String fieldName = fd.getName(); | 349 | String fieldName = fd.getName(); |
349 | Obf entry = (Obf)fd.get(null); | 350 | Obf entry = (Obf)fd.get(null); |
350 | if (name.equals(fieldName) || name.equals(entry.name)) | 351 | if (name.equals(fieldName) || name.equals(entry.name)) |
352 | + { | ||
351 | return entry; | 353 | return entry; |
354 | + } | ||
352 | } | 355 | } |
353 | } | 356 | } |
354 | } | 357 | } |
@@ -362,15 +365,18 @@ public class Obf | @@ -362,15 +365,18 @@ public class Obf | ||
362 | for (Obf obf : Obf.obfs.values()) | 365 | for (Obf obf : Obf.obfs.values()) |
363 | { | 366 | { |
364 | if (obfName.equals(obf.obf)) | 367 | if (obfName.equals(obf.obf)) |
368 | + { | ||
365 | return obf.name; | 369 | return obf.name; |
370 | + } | ||
366 | } | 371 | } |
367 | 372 | ||
368 | return obfName; | 373 | return obfName; |
369 | } | 374 | } |
370 | 375 | ||
371 | /** | 376 | /** |
372 | - * Ordinal reference, can be passed to some methods which accept an {@link Obf} to indicate an offset into a | ||
373 | - * class rather than a named reference. | 377 | + * Ordinal reference, can be passed to some methods which accept an |
378 | + * {@link Obf} to indicate an offset into a class rather than a named | ||
379 | + * reference. | ||
374 | * | 380 | * |
375 | * @author Adam Mummery-Smith | 381 | * @author Adam Mummery-Smith |
376 | */ | 382 | */ |
src/main/java/com/mumfrey/liteloader/core/runtime/Packets.java
@@ -9,13 +9,16 @@ import java.util.Map; | @@ -9,13 +9,16 @@ import java.util.Map; | ||
9 | * @author Adam Mummery-Smith | 9 | * @author Adam Mummery-Smith |
10 | * TODO Obfuscation 1.8 | 10 | * TODO Obfuscation 1.8 |
11 | */ | 11 | */ |
12 | -public class Packets extends Obf | 12 | +public final class Packets extends Obf |
13 | { | 13 | { |
14 | /** | 14 | /** |
15 | - * Since we need to catch and deal with the fact that a packet is first marshalled across threads via PacketThreadUtil, we | ||
16 | - * will need to know which owner object to check against the current thread in order to detect when the packet instance is being | ||
17 | - * processed by the main message loop. The Context object describes in which context (client or server) that a particular packet | ||
18 | - * will be processed in on the <em>receiving</em> end, and thus which object to check threading against. | 15 | + * Since we need to catch and deal with the fact that a packet is first |
16 | + * marshalled across threads via PacketThreadUtil, we will need to know | ||
17 | + * which owner object to check against the current thread in order to detect | ||
18 | + * when the packet instance is being processed by the main message loop. The | ||
19 | + * Context object describes in which context (client or server) that a | ||
20 | + * particular packet will be processed in on the <em>receiving</em> end, and | ||
21 | + * thus which object to check threading against. | ||
19 | * | 22 | * |
20 | * @author Adam Mummery-Smith | 23 | * @author Adam Mummery-Smith |
21 | */ | 24 | */ |
@@ -24,6 +27,8 @@ public class Packets extends Obf | @@ -24,6 +27,8 @@ public class Packets extends Obf | ||
24 | CLIENT, | 27 | CLIENT, |
25 | SERVER | 28 | SERVER |
26 | } | 29 | } |
30 | + | ||
31 | + // CHECKSTYLE:OFF | ||
27 | 32 | ||
28 | private static Map<String, Packets> packetMap = new HashMap<String, Packets>(); | 33 | private static Map<String, Packets> packetMap = new HashMap<String, Packets>(); |
29 | 34 | ||
@@ -139,6 +144,8 @@ public class Packets extends Obf | @@ -139,6 +144,8 @@ public class Packets extends Obf | ||
139 | public static Packets C01PacketPing = new Packets("net.minecraft.network.status.client.C01PacketPing", "nw", Context.SERVER); | 144 | public static Packets C01PacketPing = new Packets("net.minecraft.network.status.client.C01PacketPing", "nw", Context.SERVER); |
140 | public static Packets C00PacketServerQuery = new Packets("net.minecraft.network.status.client.C00PacketServerQuery", "nx", Context.SERVER); | 145 | public static Packets C00PacketServerQuery = new Packets("net.minecraft.network.status.client.C00PacketServerQuery", "nx", Context.SERVER); |
141 | 146 | ||
147 | + // CHECKSTYLE:ON | ||
148 | + | ||
142 | public static final Packets[] packets = new Packets[] { | 149 | public static final Packets[] packets = new Packets[] { |
143 | S08PacketPlayerPosLook, | 150 | S08PacketPlayerPosLook, |
144 | S0EPacketSpawnObject, | 151 | S0EPacketSpawnObject, |
@@ -290,7 +297,10 @@ public class Packets extends Obf | @@ -290,7 +297,10 @@ public class Packets extends Obf | ||
290 | { | 297 | { |
291 | for (Packets packet : Packets.packets) | 298 | for (Packets packet : Packets.packets) |
292 | { | 299 | { |
293 | - if (packet.name.equals(packetClassName) || packet.shortName.equals(packetClassName) || packet.obf.equals(packetClassName)) return packet.index; | 300 | + if (packet.name.equals(packetClassName) || packet.shortName.equals(packetClassName) || packet.obf.equals(packetClassName)) |
301 | + { | ||
302 | + return packet.index; | ||
303 | + } | ||
294 | } | 304 | } |
295 | 305 | ||
296 | return -1; | 306 | return -1; |
src/main/java/com/mumfrey/liteloader/interfaces/FastIterable.java
1 | package com.mumfrey.liteloader.interfaces; | 1 | package com.mumfrey.liteloader.interfaces; |
2 | 2 | ||
3 | /** | 3 | /** |
4 | - * Interface for objects which can return a baked list view of their list contents | 4 | + * Interface for objects which can return a baked list view of their list |
5 | + * contents. | ||
5 | * | 6 | * |
6 | * @author Adam Mummery-Smith | 7 | * @author Adam Mummery-Smith |
7 | * | 8 | * |
src/main/java/com/mumfrey/liteloader/interfaces/Loadable.java
@@ -9,7 +9,8 @@ import com.mumfrey.liteloader.launch.LoaderEnvironment; | @@ -9,7 +9,8 @@ import com.mumfrey.liteloader.launch.LoaderEnvironment; | ||
9 | * | 9 | * |
10 | * @author Adam Mummery-Smith | 10 | * @author Adam Mummery-Smith |
11 | * | 11 | * |
12 | - * @param <L> base class type for Comparable<?> so that implementors can specify their Comparable type | 12 | + * @param <L> base class type for Comparable<?> so that implementors can specify |
13 | + * their Comparable type. | ||
13 | */ | 14 | */ |
14 | public interface Loadable<L> extends Comparable<L> | 15 | public interface Loadable<L> extends Comparable<L> |
15 | { | 16 | { |
@@ -24,7 +25,8 @@ public interface Loadable<L> extends Comparable<L> | @@ -24,7 +25,8 @@ public interface Loadable<L> extends Comparable<L> | ||
24 | public abstract String getName(); | 25 | public abstract String getName(); |
25 | 26 | ||
26 | /** | 27 | /** |
27 | - * Get the name to use when displaying this loadable, such as file name, identifier or friendly name | 28 | + * Get the name to use when displaying this loadable, such as file name, |
29 | + * identifier or friendly name | ||
28 | */ | 30 | */ |
29 | public abstract String getDisplayName(); | 31 | public abstract String getDisplayName(); |
30 | 32 | ||
@@ -34,7 +36,8 @@ public interface Loadable<L> extends Comparable<L> | @@ -34,7 +36,8 @@ public interface Loadable<L> extends Comparable<L> | ||
34 | public abstract String getLocation(); | 36 | public abstract String getLocation(); |
35 | 37 | ||
36 | /** | 38 | /** |
37 | - * Get the identifier (usually "name" from metadata) of this loadable, used as the exclusivity key for mods and also the metadata key | 39 | + * Get the identifier (usually "name" from metadata) of this loadable, used |
40 | + * as the exclusivity key for mods and also the metadata key | ||
38 | */ | 41 | */ |
39 | public abstract String getIdentifier(); | 42 | public abstract String getIdentifier(); |
40 | 43 | ||
@@ -54,17 +57,20 @@ public interface Loadable<L> extends Comparable<L> | @@ -54,17 +57,20 @@ public interface Loadable<L> extends Comparable<L> | ||
54 | public abstract String getDescription(String key); | 57 | public abstract String getDescription(String key); |
55 | 58 | ||
56 | /** | 59 | /** |
57 | - * Returns true if this is an external jar containing a tweak rather than a mod | 60 | + * Returns true if this is an external jar containing a tweak rather than a |
61 | + * mod. | ||
58 | */ | 62 | */ |
59 | public abstract boolean isExternalJar(); | 63 | public abstract boolean isExternalJar(); |
60 | 64 | ||
61 | /** | 65 | /** |
62 | - * Returns true if this loadable supports being enabled and disabled via the GUI | 66 | + * Returns true if this loadable supports being enabled and disabled via the |
67 | + * GUI. | ||
63 | */ | 68 | */ |
64 | public abstract boolean isToggleable(); | 69 | public abstract boolean isToggleable(); |
65 | 70 | ||
66 | /** | 71 | /** |
67 | - * Get whether this loadable is currently enabled in the context of the supplied mods list | 72 | + * Get whether this loadable is currently enabled in the context of the |
73 | + * supplied mods list. | ||
68 | * | 74 | * |
69 | * @param environment | 75 | * @param environment |
70 | */ | 76 | */ |
@@ -81,7 +87,8 @@ public interface Loadable<L> extends Comparable<L> | @@ -81,7 +87,8 @@ public interface Loadable<L> extends Comparable<L> | ||
81 | public abstract boolean isDirectory(); | 87 | public abstract boolean isDirectory(); |
82 | 88 | ||
83 | /** | 89 | /** |
84 | - * If isFile or isDirectory return true then this method returns the inner File instance, otherwise returns null | 90 | + * If isFile or isDirectory return true then this method returns the inner |
91 | + * File instance, otherwise returns null. | ||
85 | */ | 92 | */ |
86 | public abstract File toFile(); | 93 | public abstract File toFile(); |
87 | } | 94 | } |
src/main/java/com/mumfrey/liteloader/interfaces/LoadableFile.java
@@ -42,9 +42,10 @@ public class LoadableFile extends File implements TweakContainer<File> | @@ -42,9 +42,10 @@ public class LoadableFile extends File implements TweakContainer<File> | ||
42 | protected boolean forceInjection; | 42 | protected boolean forceInjection; |
43 | 43 | ||
44 | /** | 44 | /** |
45 | - * Position to inject the mod file at in the class path, if blank injects at the bottom as usual, alternatively | ||
46 | - * the developer can specify "top" to inject at the top, "base" to inject above the game jar, or "above: name" to | ||
47 | - * inject above a specified other library matching "name". | 45 | + * Position to inject the mod file at in the class path, if blank injects at |
46 | + * the bottom as usual, alternatively the developer can specify "top" to | ||
47 | + * inject at the top, "base" to inject above the game jar, or "above: name" | ||
48 | + * to inject above a specified other library matching "name". | ||
48 | */ | 49 | */ |
49 | protected InjectionStrategy injectionStrategy = null; | 50 | protected InjectionStrategy injectionStrategy = null; |
50 | 51 | ||
@@ -109,7 +110,9 @@ public class LoadableFile extends File implements TweakContainer<File> | @@ -109,7 +110,9 @@ public class LoadableFile extends File implements TweakContainer<File> | ||
109 | { | 110 | { |
110 | Matcher versionPatternMatcher = LoadableFile.versionPattern.matcher(this.getName()); | 111 | Matcher versionPatternMatcher = LoadableFile.versionPattern.matcher(this.getName()); |
111 | while (versionPatternMatcher.find()) | 112 | while (versionPatternMatcher.find()) |
113 | + { | ||
112 | this.version = versionPatternMatcher.group(); | 114 | this.version = versionPatternMatcher.group(); |
115 | + } | ||
113 | } | 116 | } |
114 | 117 | ||
115 | protected void assignJarMetaData(LoadableFile file) | 118 | protected void assignJarMetaData(LoadableFile file) |
@@ -177,24 +180,37 @@ public class LoadableFile extends File implements TweakContainer<File> | @@ -177,24 +180,37 @@ public class LoadableFile extends File implements TweakContainer<File> | ||
177 | } | 180 | } |
178 | 181 | ||
179 | if (manifestAttributes.getValue("Implementation-Title") != null) | 182 | if (manifestAttributes.getValue("Implementation-Title") != null) |
183 | + { | ||
180 | this.displayName = manifestAttributes.getValue("Implementation-Title"); | 184 | this.displayName = manifestAttributes.getValue("Implementation-Title"); |
185 | + } | ||
181 | 186 | ||
182 | if (manifestAttributes.getValue("TweakName") != null) | 187 | if (manifestAttributes.getValue("TweakName") != null) |
188 | + { | ||
183 | this.displayName = manifestAttributes.getValue("TweakName"); | 189 | this.displayName = manifestAttributes.getValue("TweakName"); |
190 | + } | ||
184 | 191 | ||
185 | if (manifestAttributes.getValue("Implementation-Version") != null) | 192 | if (manifestAttributes.getValue("Implementation-Version") != null) |
193 | + { | ||
186 | this.version = manifestAttributes.getValue("Implementation-Version"); | 194 | this.version = manifestAttributes.getValue("Implementation-Version"); |
195 | + } | ||
187 | 196 | ||
188 | if (manifestAttributes.getValue("TweakVersion") != null) | 197 | if (manifestAttributes.getValue("TweakVersion") != null) |
198 | + { | ||
189 | this.version = manifestAttributes.getValue("TweakVersion"); | 199 | this.version = manifestAttributes.getValue("TweakVersion"); |
200 | + } | ||
190 | 201 | ||
191 | if (manifestAttributes.getValue("Implementation-Vendor") != null) | 202 | if (manifestAttributes.getValue("Implementation-Vendor") != null) |
203 | + { | ||
192 | this.author = manifestAttributes.getValue("Implementation-Vendor"); | 204 | this.author = manifestAttributes.getValue("Implementation-Vendor"); |
205 | + } | ||
193 | 206 | ||
194 | if (manifestAttributes.getValue("TweakAuthor") != null) | 207 | if (manifestAttributes.getValue("TweakAuthor") != null) |
208 | + { | ||
195 | this.author = manifestAttributes.getValue("TweakAuthor"); | 209 | this.author = manifestAttributes.getValue("TweakAuthor"); |
210 | + } | ||
196 | 211 | ||
197 | - this.injectionStrategy = InjectionStrategy.parseStrategy(manifestAttributes.getValue("TweakInjectionStrategy"), InjectionStrategy.TOP); | 212 | + String tweakInjectionStrategy = manifestAttributes.getValue("TweakInjectionStrategy"); |
213 | + this.injectionStrategy = InjectionStrategy.parseStrategy(tweakInjectionStrategy, InjectionStrategy.TOP); | ||
198 | } | 214 | } |
199 | } | 215 | } |
200 | catch (Exception ex) | 216 | catch (Exception ex) |
@@ -292,7 +308,8 @@ public class LoadableFile extends File implements TweakContainer<File> | @@ -292,7 +308,8 @@ public class LoadableFile extends File implements TweakContainer<File> | ||
292 | } | 308 | } |
293 | 309 | ||
294 | /* (non-Javadoc) | 310 | /* (non-Javadoc) |
295 | - * @see com.mumfrey.liteloader.core.ITweakContainer#getClassTransformerClassNames() | 311 | + * @see com.mumfrey.liteloader.core.ITweakContainer |
312 | + * #getClassTransformerClassNames() | ||
296 | */ | 313 | */ |
297 | @Override | 314 | @Override |
298 | public List<String> getClassTransformerClassNames() | 315 | public List<String> getClassTransformerClassNames() |
src/main/java/com/mumfrey/liteloader/interfaces/LoadableMod.java
@@ -19,7 +19,8 @@ import net.minecraft.launchwrapper.LaunchClassLoader; | @@ -19,7 +19,8 @@ import net.minecraft.launchwrapper.LaunchClassLoader; | ||
19 | * | 19 | * |
20 | * @author Adam Mummery-Smith | 20 | * @author Adam Mummery-Smith |
21 | * | 21 | * |
22 | - * @param <L> base class type for Comparable<?> so that implementors can specify their Comparable type | 22 | + * @param <L> base class type for Comparable<?> so that implementors can specify |
23 | + * their Comparable type | ||
23 | */ | 24 | */ |
24 | public interface LoadableMod<L> extends Loadable<L>, Injectable | 25 | public interface LoadableMod<L> extends Loadable<L>, Injectable |
25 | { | 26 | { |
@@ -76,7 +77,8 @@ public interface LoadableMod<L> extends Loadable<L>, Injectable | @@ -76,7 +77,8 @@ public interface LoadableMod<L> extends Loadable<L>, Injectable | ||
76 | public abstract Set<String> getRequiredAPIs(); | 77 | public abstract Set<String> getRequiredAPIs(); |
77 | 78 | ||
78 | /** | 79 | /** |
79 | - * Callback to notify the container that it's missing a specific required API | 80 | + * Callback to notify the container that it's missing a specific required |
81 | + * API | ||
80 | */ | 82 | */ |
81 | public abstract void registerMissingAPI(String identifier); | 83 | public abstract void registerMissingAPI(String identifier); |
82 | 84 | ||
@@ -86,7 +88,8 @@ public interface LoadableMod<L> extends Loadable<L>, Injectable | @@ -86,7 +88,8 @@ public interface LoadableMod<L> extends Loadable<L>, Injectable | ||
86 | public abstract Set<String> getMissingAPIs(); | 88 | public abstract Set<String> getMissingAPIs(); |
87 | 89 | ||
88 | /** | 90 | /** |
89 | - * Get the specified metadata value and return the default value if not present | 91 | + * Get the specified metadata value and return the default value if not |
92 | + * present | ||
90 | * | 93 | * |
91 | * @param metaKey metadata key | 94 | * @param metaKey metadata key |
92 | * @param defaultValue metadata value | 95 | * @param defaultValue metadata value |
@@ -109,13 +112,14 @@ public interface LoadableMod<L> extends Loadable<L>, Injectable | @@ -109,13 +112,14 @@ public interface LoadableMod<L> extends Loadable<L>, Injectable | ||
109 | public abstract List<String> getContainedClassNames(); | 112 | public abstract List<String> getContainedClassNames(); |
110 | 113 | ||
111 | /** | 114 | /** |
112 | - * Callback from the enumerator, whenever a mod is registered to this container | 115 | + * Callback from the enumerator, whenever a mod is registered to this |
116 | + * container | ||
113 | */ | 117 | */ |
114 | public abstract void addContainedMod(String modName); | 118 | public abstract void addContainedMod(String modName); |
115 | 119 | ||
116 | /** | 120 | /** |
117 | - * Container returned instead of null when a mod does not actually have a container or a container is requested for | ||
118 | - * a mod which doesn't exist | 121 | + * Container returned instead of null when a mod does not actually have a |
122 | + * container or a container is requested for a mod which doesn't exist. | ||
119 | */ | 123 | */ |
120 | public static final LoadableMod<File> NONE = new EmptyModContainer(); | 124 | public static final LoadableMod<File> NONE = new EmptyModContainer(); |
121 | 125 |
src/main/java/com/mumfrey/liteloader/interfaces/ObjectFactory.java
@@ -16,8 +16,10 @@ import com.mumfrey.liteloader.util.Input; | @@ -16,8 +16,10 @@ import com.mumfrey.liteloader.util.Input; | ||
16 | * | 16 | * |
17 | * @author Adam Mummery-Smith | 17 | * @author Adam Mummery-Smith |
18 | * | 18 | * |
19 | - * @param <TClient> Type of the client runtime, "Minecraft" on client and null on the server | ||
20 | - * @param <TServer> Type of the server runtime, "IntegratedServer" on the client, "MinecraftServer" on the server | 19 | + * @param <TClient> Type of the client runtime, "Minecraft" on client and null |
20 | + * on the server | ||
21 | + * @param <TServer> Type of the server runtime, "IntegratedServer" on the client | ||
22 | + * "MinecraftServer" on the server | ||
21 | */ | 23 | */ |
22 | public interface ObjectFactory<TClient, TServer extends MinecraftServer> | 24 | public interface ObjectFactory<TClient, TServer extends MinecraftServer> |
23 | { | 25 | { |
src/main/java/com/mumfrey/liteloader/interfaces/PanelManager.java
@@ -6,11 +6,13 @@ import com.mumfrey.liteloader.core.LiteLoaderMods; | @@ -6,11 +6,13 @@ import com.mumfrey.liteloader.core.LiteLoaderMods; | ||
6 | import com.mumfrey.liteloader.modconfig.ConfigManager; | 6 | import com.mumfrey.liteloader.modconfig.ConfigManager; |
7 | 7 | ||
8 | /** | 8 | /** |
9 | - * Interface for the liteloader panel manager, abstracted because we don't have the class GuiScreen on the server | 9 | + * Interface for the liteloader panel manager, abstracted because we don't have |
10 | + * the class GuiScreen on the server. | ||
10 | * | 11 | * |
11 | * @author Adam Mummery-Smith | 12 | * @author Adam Mummery-Smith |
12 | * | 13 | * |
13 | - * @param <TParentScreen> GuiScreen class, must be generic because we don't have GuiScreen on the server side | 14 | + * @param <TParentScreen> GuiScreen class, must be generic because we don't have |
15 | + * GuiScreen on the server side | ||
14 | */ | 16 | */ |
15 | public interface PanelManager<TParentScreen> extends TickObserver, PostRenderObserver | 17 | public interface PanelManager<TParentScreen> extends TickObserver, PostRenderObserver |
16 | { | 18 | { |
src/main/java/com/mumfrey/liteloader/interfaces/TweakContainer.java
@@ -10,7 +10,8 @@ import java.util.List; | @@ -10,7 +10,8 @@ import java.util.List; | ||
10 | public interface TweakContainer<L> extends Loadable<L>, Injectable | 10 | public interface TweakContainer<L> extends Loadable<L>, Injectable |
11 | { | 11 | { |
12 | /** | 12 | /** |
13 | - * Get whether this tweak container has a defined tweak class in its metadata | 13 | + * Get whether this tweak container has a defined tweak class in its |
14 | + * metadata. | ||
14 | */ | 15 | */ |
15 | public abstract boolean hasTweakClass(); | 16 | public abstract boolean hasTweakClass(); |
16 | 17 |
src/main/java/com/mumfrey/liteloader/launch/ClassPathUtilities.java
@@ -23,7 +23,6 @@ import com.mumfrey.liteloader.util.log.LiteLoaderLogger; | @@ -23,7 +23,6 @@ import com.mumfrey.liteloader.util.log.LiteLoaderLogger; | ||
23 | 23 | ||
24 | import net.minecraft.launchwrapper.Launch; | 24 | import net.minecraft.launchwrapper.Launch; |
25 | import net.minecraft.launchwrapper.LaunchClassLoader; | 25 | import net.minecraft.launchwrapper.LaunchClassLoader; |
26 | -import sun.misc.URLClassPath; | ||
27 | 26 | ||
28 | /** | 27 | /** |
29 | * Nasty horrible reflection hacks to do nasty things with the classpath | 28 | * Nasty horrible reflection hacks to do nasty things with the classpath |
@@ -33,6 +32,11 @@ import sun.misc.URLClassPath; | @@ -33,6 +32,11 @@ import sun.misc.URLClassPath; | ||
33 | public abstract class ClassPathUtilities | 32 | public abstract class ClassPathUtilities |
34 | { | 33 | { |
35 | /** | 34 | /** |
35 | + * URLClassPath | ||
36 | + */ | ||
37 | + private static Class<?> clURLClassPath; | ||
38 | + | ||
39 | + /** | ||
36 | * URLClassLoader::ucp -> instance of URLClassPath | 40 | * URLClassLoader::ucp -> instance of URLClassPath |
37 | */ | 41 | */ |
38 | private static Field ucp; | 42 | private static Field ucp; |
@@ -65,16 +69,18 @@ public abstract class ClassPathUtilities | @@ -65,16 +69,18 @@ public abstract class ClassPathUtilities | ||
65 | { | 69 | { |
66 | try | 70 | try |
67 | { | 71 | { |
72 | + ClassPathUtilities.clURLClassPath = Class.forName("sun.misc.URLClassPath"); | ||
73 | + | ||
68 | ClassPathUtilities.ucp = URLClassLoader.class.getDeclaredField("ucp"); | 74 | ClassPathUtilities.ucp = URLClassLoader.class.getDeclaredField("ucp"); |
69 | ClassPathUtilities.ucp.setAccessible(true); | 75 | ClassPathUtilities.ucp.setAccessible(true); |
70 | 76 | ||
71 | - ClassPathUtilities.classPathURLs = URLClassPath.class.getDeclaredField("urls"); | 77 | + ClassPathUtilities.classPathURLs = ClassPathUtilities.clURLClassPath.getDeclaredField("urls"); |
72 | ClassPathUtilities.classPathURLs.setAccessible(true); | 78 | ClassPathUtilities.classPathURLs.setAccessible(true); |
73 | - ClassPathUtilities.classPathPath = URLClassPath.class.getDeclaredField("path"); | 79 | + ClassPathUtilities.classPathPath = ClassPathUtilities.clURLClassPath.getDeclaredField("path"); |
74 | ClassPathUtilities.classPathPath.setAccessible(true); | 80 | ClassPathUtilities.classPathPath.setAccessible(true); |
75 | - ClassPathUtilities.classPathLoaderMap = URLClassPath.class.getDeclaredField("lmap"); | 81 | + ClassPathUtilities.classPathLoaderMap = ClassPathUtilities.clURLClassPath.getDeclaredField("lmap"); |
76 | ClassPathUtilities.classPathLoaderMap.setAccessible(true); | 82 | ClassPathUtilities.classPathLoaderMap.setAccessible(true); |
77 | - ClassPathUtilities.classPathLoaderList = URLClassPath.class.getDeclaredField("loaders"); | 83 | + ClassPathUtilities.classPathLoaderList = ClassPathUtilities.clURLClassPath.getDeclaredField("loaders"); |
78 | ClassPathUtilities.classPathLoaderList.setAccessible(true); | 84 | ClassPathUtilities.classPathLoaderList.setAccessible(true); |
79 | ClassPathUtilities.canInject = true; | 85 | ClassPathUtilities.canInject = true; |
80 | } | 86 | } |
@@ -86,7 +92,8 @@ public abstract class ClassPathUtilities | @@ -86,7 +92,8 @@ public abstract class ClassPathUtilities | ||
86 | } | 92 | } |
87 | 93 | ||
88 | /** | 94 | /** |
89 | - * Injects a URL into the classpath based on the specified injection strategy | 95 | + * Injects a URL into the classpath based on the specified injection |
96 | + * strategy. | ||
90 | * | 97 | * |
91 | * @param classLoader | 98 | * @param classLoader |
92 | * @param url | 99 | * @param url |
@@ -148,7 +155,7 @@ public abstract class ClassPathUtilities | @@ -148,7 +155,7 @@ public abstract class ClassPathUtilities | ||
148 | 155 | ||
149 | try | 156 | try |
150 | { | 157 | { |
151 | - URLClassPath classPath = (URLClassPath)ClassPathUtilities.ucp.get(classLoader); | 158 | + Object classPath = ClassPathUtilities.ucp.get(classLoader); |
152 | 159 | ||
153 | Stack<URL> urls = (Stack<URL>)ClassPathUtilities.classPathURLs.get(classPath); | 160 | Stack<URL> urls = (Stack<URL>)ClassPathUtilities.classPathURLs.get(classPath); |
154 | ArrayList<URL> path = (ArrayList<URL>)ClassPathUtilities.classPathPath.get(classPath); | 161 | ArrayList<URL> path = (ArrayList<URL>)ClassPathUtilities.classPathPath.get(classPath); |
@@ -168,7 +175,9 @@ public abstract class ClassPathUtilities | @@ -168,7 +175,9 @@ public abstract class ClassPathUtilities | ||
168 | for (int pos = path.size() - 1; pos > 0; pos--) | 175 | for (int pos = path.size() - 1; pos > 0; pos--) |
169 | { | 176 | { |
170 | if (above.equals(path.get(pos))) | 177 | if (above.equals(path.get(pos))) |
178 | + { | ||
171 | path.add(pos, url); | 179 | path.add(pos, url); |
180 | + } | ||
172 | } | 181 | } |
173 | } | 182 | } |
174 | } | 183 | } |
@@ -250,7 +259,9 @@ public abstract class ClassPathUtilities | @@ -250,7 +259,9 @@ public abstract class ClassPathUtilities | ||
250 | for (URL classPathEntry : classPath) | 259 | for (URL classPathEntry : classPath) |
251 | { | 260 | { |
252 | if (classPathEntry.toString().equals(jarURL)) | 261 | if (classPathEntry.toString().equals(jarURL)) |
262 | + { | ||
253 | return true; | 263 | return true; |
264 | + } | ||
254 | } | 265 | } |
255 | } | 266 | } |
256 | catch (Exception ex) | 267 | catch (Exception ex) |
@@ -327,7 +338,8 @@ public abstract class ClassPathUtilities | @@ -327,7 +338,8 @@ public abstract class ClassPathUtilities | ||
327 | final JarDeletionHandler jarDeletionHandler = new JarDeletionHandler(); | 338 | final JarDeletionHandler jarDeletionHandler = new JarDeletionHandler(); |
328 | 339 | ||
329 | JarFile jarInClassLoader = ClassPathUtilities.getJarFromClassLoader(Launch.classLoader, jarFileName, true); | 340 | JarFile jarInClassLoader = ClassPathUtilities.getJarFromClassLoader(Launch.classLoader, jarFileName, true); |
330 | - JarFile jarInParentClassLoader = ClassPathUtilities.getJarFromClassLoader((URLClassLoader)Launch.class.getClassLoader(), jarFileName, true); | 341 | + JarFile jarInParentClassLoader = ClassPathUtilities.getJarFromClassLoader((URLClassLoader)Launch.class.getClassLoader(), |
342 | + jarFileName, true); | ||
331 | 343 | ||
332 | File jarFileInClassLoader = new File(jarInClassLoader.getName()); | 344 | File jarFileInClassLoader = new File(jarInClassLoader.getName()); |
333 | File jarFileInParentClassLoader = new File(jarInParentClassLoader.getName()); | 345 | File jarFileInParentClassLoader = new File(jarInParentClassLoader.getName()); |
@@ -373,13 +385,14 @@ public abstract class ClassPathUtilities | @@ -373,13 +385,14 @@ public abstract class ClassPathUtilities | ||
373 | * @throws MalformedURLException | 385 | * @throws MalformedURLException |
374 | */ | 386 | */ |
375 | @SuppressWarnings("unchecked") | 387 | @SuppressWarnings("unchecked") |
376 | - private static JarFile getJarFromClassLoader(URLClassLoader classLoader, String fileName, boolean removeFromClassPath) throws MalformedURLException | 388 | + private static JarFile getJarFromClassLoader(URLClassLoader classLoader, String fileName, boolean removeFromClassPath) |
389 | + throws MalformedURLException | ||
377 | { | 390 | { |
378 | JarFile jar = null; | 391 | JarFile jar = null; |
379 | 392 | ||
380 | try | 393 | try |
381 | { | 394 | { |
382 | - URLClassPath classPath = (URLClassPath)ClassPathUtilities.ucp.get(classLoader); | 395 | + Object classPath = ClassPathUtilities.ucp.get(classLoader); |
383 | Map<String, ?> loaderMap = (Map<String, ?>)ClassPathUtilities.classPathLoaderMap.get(classPath); | 396 | Map<String, ?> loaderMap = (Map<String, ?>)ClassPathUtilities.classPathLoaderMap.get(classPath); |
384 | 397 | ||
385 | Iterator<?> iter = loaderMap.entrySet().iterator(); | 398 | Iterator<?> iter = loaderMap.entrySet().iterator(); |
src/main/java/com/mumfrey/liteloader/launch/ClassTransformerManager.java
@@ -27,12 +27,14 @@ public class ClassTransformerManager | @@ -27,12 +27,14 @@ public class ClassTransformerManager | ||
27 | private boolean gameStarted; | 27 | private boolean gameStarted; |
28 | 28 | ||
29 | /** | 29 | /** |
30 | - * Transformers to inject after preInit but before the game starts, necessary for anything that needs to be downstream of forge | 30 | + * Transformers to inject after preInit but before the game starts, |
31 | + * necessary for anything that needs to be downstream of forge. | ||
31 | */ | 32 | */ |
32 | private Set<String> downstreamTransformers = new LinkedHashSet<String>(); | 33 | private Set<String> downstreamTransformers = new LinkedHashSet<String>(); |
33 | 34 | ||
34 | /** | 35 | /** |
35 | - * Transformers passed into the constructor which are required and must be injected upstream | 36 | + * Transformers passed into the constructor which are required and must be |
37 | + * injected upstream. | ||
36 | */ | 38 | */ |
37 | private final List<String> requiredTransformers; | 39 | private final List<String> requiredTransformers; |
38 | 40 | ||
@@ -155,7 +157,9 @@ public class ClassTransformerManager | @@ -155,7 +157,9 @@ public class ClassTransformerManager | ||
155 | this.gameStarted = true; | 157 | this.gameStarted = true; |
156 | 158 | ||
157 | if (this.downstreamTransformers.size() > 0) | 159 | if (this.downstreamTransformers.size() > 0) |
160 | + { | ||
158 | LiteLoaderLogger.info("Injecting downstream transformers"); | 161 | LiteLoaderLogger.info("Injecting downstream transformers"); |
162 | + } | ||
159 | 163 | ||
160 | for (String transformerClassName : this.downstreamTransformers) | 164 | for (String transformerClassName : this.downstreamTransformers) |
161 | { | 165 | { |
@@ -210,7 +214,9 @@ public class ClassTransformerManager | @@ -210,7 +214,9 @@ public class ClassTransformerManager | ||
210 | for (IClassTransformer transformer : classLoader.getTransformers()) | 214 | for (IClassTransformer transformer : classLoader.getTransformers()) |
211 | { | 215 | { |
212 | if (transformer.getClass().getName().equals(transformerClassName)) | 216 | if (transformer.getClass().getName().equals(transformerClassName)) |
217 | + { | ||
213 | return transformer; | 218 | return transformer; |
219 | + } | ||
214 | } | 220 | } |
215 | 221 | ||
216 | return null; | 222 | return null; |
src/main/java/com/mumfrey/liteloader/launch/GameEnvironment.java
@@ -5,7 +5,8 @@ import java.io.File; | @@ -5,7 +5,8 @@ import java.io.File; | ||
5 | public interface GameEnvironment | 5 | public interface GameEnvironment |
6 | { | 6 | { |
7 | /** | 7 | /** |
8 | - * Get the game directory, this is the root directory of the game profile specified by the user in the launcher | 8 | + * Get the game directory, this is the root directory of the game profile |
9 | + * specified by the user in the launcher. | ||
9 | */ | 10 | */ |
10 | public abstract File getGameDirectory(); | 11 | public abstract File getGameDirectory(); |
11 | 12 | ||
@@ -20,7 +21,8 @@ public interface GameEnvironment | @@ -20,7 +21,8 @@ public interface GameEnvironment | ||
20 | public abstract String getProfile(); | 21 | public abstract String getProfile(); |
21 | 22 | ||
22 | /** | 23 | /** |
23 | - * Get the "mods" folder, used to get the base path for enumerators and config for legacy mods | 24 | + * Get the "mods" folder, used to get the base path for enumerators and |
25 | + * config for legacy mods. | ||
24 | */ | 26 | */ |
25 | public abstract File getModsFolder(); | 27 | public abstract File getModsFolder(); |
26 | } | 28 | } |
src/main/java/com/mumfrey/liteloader/launch/InjectionStrategy.java
@@ -5,7 +5,7 @@ package com.mumfrey.liteloader.launch; | @@ -5,7 +5,7 @@ package com.mumfrey.liteloader.launch; | ||
5 | * | 5 | * |
6 | * @author Adam Mummery-Smith | 6 | * @author Adam Mummery-Smith |
7 | */ | 7 | */ |
8 | -public class InjectionStrategy | 8 | +public final class InjectionStrategy |
9 | { | 9 | { |
10 | /** | 10 | /** |
11 | * Defines a position for a classpath injection strategy | 11 | * Defines a position for a classpath injection strategy |
@@ -15,17 +15,20 @@ public class InjectionStrategy | @@ -15,17 +15,20 @@ public class InjectionStrategy | ||
15 | public enum InjectionPosition | 15 | public enum InjectionPosition |
16 | { | 16 | { |
17 | /** | 17 | /** |
18 | - * Inject the URL at the bottom (end) of the classpath, lowest priority - this is the default | 18 | + * Inject the URL at the bottom (end) of the classpath, lowest priority |
19 | + * - this is the default. | ||
19 | */ | 20 | */ |
20 | Bottom, | 21 | Bottom, |
21 | 22 | ||
22 | /** | 23 | /** |
23 | - * Inject the URL at the base of the classpath (directly above the minecraft jar but below all other libs) | 24 | + * Inject the URL at the base of the classpath (directly above the |
25 | + * minecraft jar but below all other libs). | ||
24 | */ | 26 | */ |
25 | Base, | 27 | Base, |
26 | 28 | ||
27 | /** | 29 | /** |
28 | - * Inject the URL at the top (start) of the classpath, highest priority above all other libs | 30 | + * Inject the URL at the top (start) of the classpath, highest priority |
31 | + * above all other libs. | ||
29 | */ | 32 | */ |
30 | Top, | 33 | Top, |
31 | 34 | ||
@@ -80,7 +83,8 @@ public class InjectionStrategy | @@ -80,7 +83,8 @@ public class InjectionStrategy | ||
80 | private final String[] params; | 83 | private final String[] params; |
81 | 84 | ||
82 | /** | 85 | /** |
83 | - * Private constructor because strategy should be created from a string using parseStrategy() | 86 | + * Private constructor because strategy should be created from a string |
87 | + * using parseStrategy() | ||
84 | * | 88 | * |
85 | * @param injectAt | 89 | * @param injectAt |
86 | */ | 90 | */ |
src/main/java/com/mumfrey/liteloader/launch/InvalidTransformerException.java
1 | package com.mumfrey.liteloader.launch; | 1 | package com.mumfrey.liteloader.launch; |
2 | 2 | ||
3 | /** | 3 | /** |
4 | - * Exception thrown from the NonDelegatingClassLoader if a transformer tries to access a class outside of | ||
5 | - * the classes that are allowed for that transformer | 4 | + * Exception thrown from the NonDelegatingClassLoader if a transformer tries to |
5 | + * access a class outside of the classes that are allowed for that transformer. | ||
6 | * | 6 | * |
7 | * @author Adam Mummery-Smith | 7 | * @author Adam Mummery-Smith |
8 | */ | 8 | */ |
src/main/java/com/mumfrey/liteloader/launch/LiteLoaderTransformer.java
@@ -24,7 +24,10 @@ public class LiteLoaderTransformer extends ClassTransformer | @@ -24,7 +24,10 @@ public class LiteLoaderTransformer extends ClassTransformer | ||
24 | { | 24 | { |
25 | return this.transformMain(basicClass); | 25 | return this.transformMain(basicClass); |
26 | } | 26 | } |
27 | - else if (Obf.Blocks.obf.equals(transformedName) || Obf.Blocks.name.equals(transformedName) || Obf.Items.obf.equals(transformedName) || Obf.Items.name.equals(transformedName)) | 27 | + else if (Obf.Blocks.obf.equals(transformedName) |
28 | + || Obf.Blocks.name.equals(transformedName) | ||
29 | + || Obf.Items.obf.equals(transformedName) | ||
30 | + || Obf.Items.name.equals(transformedName)) | ||
28 | { | 31 | { |
29 | return this.stripFinalModifiers(basicClass); | 32 | return this.stripFinalModifiers(basicClass); |
30 | } | 33 | } |
@@ -40,7 +43,8 @@ public class LiteLoaderTransformer extends ClassTransformer | @@ -40,7 +43,8 @@ public class LiteLoaderTransformer extends ClassTransformer | ||
40 | { | 43 | { |
41 | if ("main".equals(method.name)) | 44 | if ("main".equals(method.name)) |
42 | { | 45 | { |
43 | - method.instructions.insert(new MethodInsnNode(Opcodes.INVOKESTATIC, LiteLoaderTransformer.LITELOADER_TWEAKER_CLASS, LiteLoaderTransformer.METHOD_PRE_BEGIN_GAME, "()V", false)); | 46 | + method.instructions.insert(new MethodInsnNode(Opcodes.INVOKESTATIC, LiteLoaderTransformer.LITELOADER_TWEAKER_CLASS, |
47 | + LiteLoaderTransformer.METHOD_PRE_BEGIN_GAME, "()V", false)); | ||
44 | } | 48 | } |
45 | } | 49 | } |
46 | 50 |
src/main/java/com/mumfrey/liteloader/launch/LiteLoaderTweaker.java
@@ -80,7 +80,8 @@ public class LiteLoaderTweaker implements ITweaker | @@ -80,7 +80,8 @@ public class LiteLoaderTweaker implements ITweaker | ||
80 | } | 80 | } |
81 | 81 | ||
82 | /** | 82 | /** |
83 | - * Go to the next state, checks whether can move to the next state (previous state is marked completed) first | 83 | + * Go to the next state, checks whether can move to the next state |
84 | + * (previous state is marked completed) first | ||
84 | */ | 85 | */ |
85 | public StartupState gotoState() | 86 | public StartupState gotoState() |
86 | { | 87 | { |
@@ -89,9 +90,15 @@ public class LiteLoaderTweaker implements ITweaker | @@ -89,9 +90,15 @@ public class LiteLoaderTweaker implements ITweaker | ||
89 | if (otherState.isInState() && otherState != this) | 90 | if (otherState.isInState() && otherState != this) |
90 | { | 91 | { |
91 | if (otherState.canGotoState(this)) | 92 | if (otherState.canGotoState(this)) |
93 | + { | ||
92 | otherState.leaveState(); | 94 | otherState.leaveState(); |
95 | + } | ||
93 | else | 96 | else |
94 | - throw new IllegalStateException(String.format("Cannot go to state <%s> as %s %s", this.name(), otherState, otherState.getNextState() == this ? "" : "and expects \"" + otherState.getNextState().name() + "\" instead"), LiteLoaderLogger.getLastThrowable()); | 97 | + { |
98 | + String message = String.format("Cannot go to state <%s> as %s %s", this.name(), otherState, | ||
99 | + otherState.getNextState() == this ? "" : "and expects \"" + otherState.getNextState().name() + "\" instead"); | ||
100 | + throw new IllegalStateException(message, LiteLoaderLogger.getLastThrowable()); | ||
101 | + } | ||
95 | } | 102 | } |
96 | } | 103 | } |
97 | 104 | ||
@@ -110,7 +117,9 @@ public class LiteLoaderTweaker implements ITweaker | @@ -110,7 +117,9 @@ public class LiteLoaderTweaker implements ITweaker | ||
110 | @Override | 117 | @Override |
111 | public String toString() | 118 | public String toString() |
112 | { | 119 | { |
113 | - return String.format("<%s> is %s %s", this.name(), this.inState ? "[ACTIVE]" : "[INACTIVE]", this.completed ? "and [COMPLETED]" : "but [INCOMPLETE]"); | 120 | + return String.format("<%s> is %s %s", this.name(), |
121 | + this.inState ? "[ACTIVE]" : "[INACTIVE]", | ||
122 | + this.completed ? "and [COMPLETED]" : "but [INCOMPLETE]"); | ||
114 | } | 123 | } |
115 | 124 | ||
116 | /** | 125 | /** |
@@ -127,7 +136,10 @@ public class LiteLoaderTweaker implements ITweaker | @@ -127,7 +136,10 @@ public class LiteLoaderTweaker implements ITweaker | ||
127 | public void completed() | 136 | public void completed() |
128 | { | 137 | { |
129 | if (!this.inState || this.completed) | 138 | if (!this.inState || this.completed) |
130 | - throw new IllegalStateException("Attempted to complete state " + this.name() + " but the state is already completed or is not active", LiteLoaderLogger.getLastThrowable()); | 139 | + { |
140 | + String message = String.format("Attempted to complete state %s but the state is already completed or is not active", this.name()); | ||
141 | + throw new IllegalStateException(message, LiteLoaderLogger.getLastThrowable()); | ||
142 | + } | ||
131 | 143 | ||
132 | this.completed = true; | 144 | this.completed = true; |
133 | } | 145 | } |
@@ -163,17 +175,20 @@ public class LiteLoaderTweaker implements ITweaker | @@ -163,17 +175,20 @@ public class LiteLoaderTweaker implements ITweaker | ||
163 | } | 175 | } |
164 | 176 | ||
165 | /** | 177 | /** |
166 | - * Singleton instance, mainly for delegating from injected callbacks which need a static method to call | 178 | + * Singleton instance, mainly for delegating from injected callbacks which |
179 | + * need a static method to call. | ||
167 | */ | 180 | */ |
168 | protected static LiteLoaderTweaker instance; | 181 | protected static LiteLoaderTweaker instance; |
169 | 182 | ||
170 | /** | 183 | /** |
171 | - * Approximate location of the minecraft jar, used for "base" injection position in ClassPathUtilities | 184 | + * Approximate location of the minecraft jar, used for "base" injection |
185 | + * position in ClassPathUtilities. | ||
172 | */ | 186 | */ |
173 | protected static URL jarUrl; | 187 | protected static URL jarUrl; |
174 | 188 | ||
175 | /** | 189 | /** |
176 | - * "Order" value for inserted tweakers, used as disambiguating sort criteria for injected tweakers which have the same priority | 190 | + * "Order" value for inserted tweakers, used as disambiguating sort criteria |
191 | + * for injected tweakers which have the same priority. | ||
177 | */ | 192 | */ |
178 | protected int tweakOrder = 0; | 193 | protected int tweakOrder = 0; |
179 | 194 | ||
@@ -193,7 +208,8 @@ public class LiteLoaderTweaker implements ITweaker | @@ -193,7 +208,8 @@ public class LiteLoaderTweaker implements ITweaker | ||
193 | protected boolean isPrimary; | 208 | protected boolean isPrimary; |
194 | 209 | ||
195 | /** | 210 | /** |
196 | - * Startup environment information, used to store info about the current startup in one place, also handles parsing command line arguments | 211 | + * Startup environment information, used to store info about the current |
212 | + * startup in one place, also handles parsing command line arguments. | ||
197 | */ | 213 | */ |
198 | protected StartupEnvironment env; | 214 | protected StartupEnvironment env; |
199 | 215 | ||
@@ -208,7 +224,9 @@ public class LiteLoaderTweaker implements ITweaker | @@ -208,7 +224,9 @@ public class LiteLoaderTweaker implements ITweaker | ||
208 | protected ClassTransformerManager transformerManager; | 224 | protected ClassTransformerManager transformerManager; |
209 | 225 | ||
210 | /* (non-Javadoc) | 226 | /* (non-Javadoc) |
211 | - * @see net.minecraft.launchwrapper.ITweaker#acceptOptions(java.util.List, java.io.File, java.io.File, java.lang.String) | 227 | + * @see net.minecraft.launchwrapper.ITweaker |
228 | + * #acceptOptions(java.util.List, java.io.File, java.io.File, | ||
229 | + * java.lang.String) | ||
212 | */ | 230 | */ |
213 | @Override | 231 | @Override |
214 | public void acceptOptions(List<String> args, File gameDirectory, File assetsDirectory, String profile) | 232 | public void acceptOptions(List<String> args, File gameDirectory, File assetsDirectory, String profile) |
@@ -224,13 +242,15 @@ public class LiteLoaderTweaker implements ITweaker | @@ -224,13 +242,15 @@ public class LiteLoaderTweaker implements ITweaker | ||
224 | } | 242 | } |
225 | 243 | ||
226 | /* (non-Javadoc) | 244 | /* (non-Javadoc) |
227 | - * @see net.minecraft.launchwrapper.ITweaker#injectIntoClassLoader(net.minecraft.launchwrapper.LaunchClassLoader) | 245 | + * @see net.minecraft.launchwrapper.ITweaker |
246 | + * #injectIntoClassLoader( | ||
247 | + * net.minecraft.launchwrapper.LaunchClassLoader) | ||
228 | */ | 248 | */ |
229 | @Override | 249 | @Override |
230 | public void injectIntoClassLoader(LaunchClassLoader classLoader) | 250 | public void injectIntoClassLoader(LaunchClassLoader classLoader) |
231 | { | 251 | { |
232 | - // classLoader.addClassLoaderExclusion("com.mumfrey.liteloader.core.runtime.Obf"); | ||
233 | - // classLoader.addClassLoaderExclusion("com.mumfrey.liteloader.core.runtime.Packets"); | 252 | +// classLoader.addClassLoaderExclusion("com.mumfrey.liteloader.core.runtime.Obf"); |
253 | +// classLoader.addClassLoaderExclusion("com.mumfrey.liteloader.core.runtime.Packets"); | ||
234 | 254 | ||
235 | this.transformerManager.injectUpstreamTransformers(classLoader); | 255 | this.transformerManager.injectUpstreamTransformers(classLoader); |
236 | 256 | ||
@@ -305,7 +325,8 @@ public class LiteLoaderTweaker implements ITweaker | @@ -305,7 +325,8 @@ public class LiteLoaderTweaker implements ITweaker | ||
305 | } | 325 | } |
306 | 326 | ||
307 | /** | 327 | /** |
308 | - * Do the first stage of loader startup, which enumerates mod sources and finds tweakers | 328 | + * Do the first stage of loader startup, which enumerates mod sources and |
329 | + * finds tweakers. | ||
309 | */ | 330 | */ |
310 | private void onPreInit() | 331 | private void onPreInit() |
311 | { | 332 | { |
@@ -447,7 +468,9 @@ public class LiteLoaderTweaker implements ITweaker | @@ -447,7 +468,9 @@ public class LiteLoaderTweaker implements ITweaker | ||
447 | for (ITweaker existingTweaker : tweakers) | 468 | for (ITweaker existingTweaker : tweakers) |
448 | { | 469 | { |
449 | if (tweakClass.equals(existingTweaker.getClass().getName())) | 470 | if (tweakClass.equals(existingTweaker.getClass().getName())) |
471 | + { | ||
450 | return; | 472 | return; |
473 | + } | ||
451 | } | 474 | } |
452 | 475 | ||
453 | tweakClasses.add(tweakClass); | 476 | tweakClasses.add(tweakClass); |
@@ -463,10 +486,14 @@ public class LiteLoaderTweaker implements ITweaker | @@ -463,10 +486,14 @@ public class LiteLoaderTweaker implements ITweaker | ||
463 | if (tweakClass != null && !this.allCascadingTweaks.contains(tweakClass)) | 486 | if (tweakClass != null && !this.allCascadingTweaks.contains(tweakClass)) |
464 | { | 487 | { |
465 | if (this.getClass().getName().equals(tweakClass)) | 488 | if (this.getClass().getName().equals(tweakClass)) |
489 | + { | ||
466 | return false; | 490 | return false; |
491 | + } | ||
467 | 492 | ||
468 | if (LiteLoaderTweaker.isTweakAlreadyEnqueued(tweakClass)) | 493 | if (LiteLoaderTweaker.isTweakAlreadyEnqueued(tweakClass)) |
494 | + { | ||
469 | return false; | 495 | return false; |
496 | + } | ||
470 | 497 | ||
471 | this.allCascadingTweaks.add(tweakClass); | 498 | this.allCascadingTweaks.add(tweakClass); |
472 | this.sortedCascadingTweaks.add(new SortableValue<String>(priority, this.tweakOrder++, tweakClass)); | 499 | this.sortedCascadingTweaks.add(new SortableValue<String>(priority, this.tweakOrder++, tweakClass)); |
@@ -477,7 +504,8 @@ public class LiteLoaderTweaker implements ITweaker | @@ -477,7 +504,8 @@ public class LiteLoaderTweaker implements ITweaker | ||
477 | } | 504 | } |
478 | 505 | ||
479 | /** | 506 | /** |
480 | - * The bootstrap object has to be spawned using reflection for obvious reasons, | 507 | + * The bootstrap object has to be spawned using reflection for obvious |
508 | + * reasons | ||
481 | * | 509 | * |
482 | * @param bootstrapClassName | 510 | * @param bootstrapClassName |
483 | * @param classLoader | 511 | * @param classLoader |
@@ -576,7 +604,7 @@ public class LiteLoaderTweaker implements ITweaker | @@ -576,7 +604,7 @@ public class LiteLoaderTweaker implements ITweaker | ||
576 | { | 604 | { |
577 | if (tweakClass.equals(clazz)) return true; | 605 | if (tweakClass.equals(clazz)) return true; |
578 | } | 606 | } |
579 | - } | 607 | + } |
580 | 608 | ||
581 | if (tweakers != null) | 609 | if (tweakers != null) |
582 | { | 610 | { |
@@ -599,7 +627,8 @@ public class LiteLoaderTweaker implements ITweaker | @@ -599,7 +627,8 @@ public class LiteLoaderTweaker implements ITweaker | ||
599 | } | 627 | } |
600 | 628 | ||
601 | /** | 629 | /** |
602 | - * Callback from the "Main" class, do the PREBEGINGAME steps (inject "downstream" transformers) | 630 | + * Callback from the "Main" class, do the PREBEGINGAME steps (inject |
631 | + * "downstream" transformers) | ||
603 | */ | 632 | */ |
604 | public static void preBeginGame() | 633 | public static void preBeginGame() |
605 | { | 634 | { |
src/main/java/com/mumfrey/liteloader/launch/LoaderBootstrap.java
@@ -5,16 +5,17 @@ import java.util.List; | @@ -5,16 +5,17 @@ import java.util.List; | ||
5 | import net.minecraft.launchwrapper.LaunchClassLoader; | 5 | import net.minecraft.launchwrapper.LaunchClassLoader; |
6 | 6 | ||
7 | /** | 7 | /** |
8 | - * Interface for the loader bootstrap, this is loaded in the parent classloader for convenience | ||
9 | - * otherwise it would be necessary to call the initialisation functions using reflection which | ||
10 | - * just gets boring very quickly. | 8 | + * Interface for the loader bootstrap, this is loaded in the parent classloader |
9 | + * for convenience otherwise it would be necessary to call the initialisation | ||
10 | + * functions using reflection which just gets boring very quickly. | ||
11 | * | 11 | * |
12 | * @author Adam Mummery-Smith | 12 | * @author Adam Mummery-Smith |
13 | */ | 13 | */ |
14 | public interface LoaderBootstrap | 14 | public interface LoaderBootstrap |
15 | { | 15 | { |
16 | /** | 16 | /** |
17 | - * Pre-init, perform mod file discovery and initial setup (eg. logger, properties) | 17 | + * Pre-init, perform mod file discovery and initial setup (eg. logger, |
18 | + * properties) | ||
18 | * | 19 | * |
19 | * @param classLoader | 20 | * @param classLoader |
20 | * @param loadTweaks | 21 | * @param loadTweaks |
src/main/java/com/mumfrey/liteloader/launch/LoaderEnvironment.java
@@ -9,8 +9,9 @@ import com.mumfrey.liteloader.core.LiteLoaderVersion; | @@ -9,8 +9,9 @@ import com.mumfrey.liteloader.core.LiteLoaderVersion; | ||
9 | import com.mumfrey.liteloader.interfaces.LoaderEnumerator; | 9 | import com.mumfrey.liteloader.interfaces.LoaderEnumerator; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | - * The Loader Environment, contains accessors for getting information about the current Loader session such as the | ||
13 | - * game directories, profile, and API management classes | 12 | + * The Loader Environment, contains accessors for getting information about the |
13 | + * current Loader session such as the game directories, profile, and API | ||
14 | + * management classes. | ||
14 | * | 15 | * |
15 | * Launch namespace, so loaded by the AppClassLoader | 16 | * Launch namespace, so loaded by the AppClassLoader |
16 | * | 17 | * |
@@ -27,17 +28,20 @@ public interface LoaderEnvironment extends GameEnvironment | @@ -27,17 +28,20 @@ public interface LoaderEnvironment extends GameEnvironment | ||
27 | public abstract EnvironmentType getType(); | 28 | public abstract EnvironmentType getType(); |
28 | 29 | ||
29 | /** | 30 | /** |
30 | - * Get the API Adapter, the API Adapter provides functionality for working with all loaded APIs | 31 | + * Get the API Adapter, the API Adapter provides functionality for working |
32 | + * with all loaded APIs. | ||
31 | */ | 33 | */ |
32 | public abstract APIAdapter getAPIAdapter(); | 34 | public abstract APIAdapter getAPIAdapter(); |
33 | 35 | ||
34 | /** | 36 | /** |
35 | - * Get the API Provider, the API Provider contains API instances for the current session | 37 | + * Get the API Provider, the API Provider contains API instances for the |
38 | + * current session. | ||
36 | */ | 39 | */ |
37 | public abstract APIProvider getAPIProvider(); | 40 | public abstract APIProvider getAPIProvider(); |
38 | 41 | ||
39 | /** | 42 | /** |
40 | - * The enabled mods list is a serialisable class which contains information about which mods are enabled/disabled | 43 | + * The enabled mods list is a serialisable class which contains information |
44 | + * about which mods are enabled/disabled. | ||
41 | */ | 45 | */ |
42 | public abstract EnabledModsList getEnabledModsList(); | 46 | public abstract EnabledModsList getEnabledModsList(); |
43 | 47 |
src/main/java/com/mumfrey/liteloader/launch/LoaderProperties.java
1 | package com.mumfrey.liteloader.launch; | 1 | package com.mumfrey.liteloader.launch; |
2 | 2 | ||
3 | /** | 3 | /** |
4 | - * Interface for the object which will manage loader properties (internal and volatile) | 4 | + * Interface for the object which will manage loader properties (internal and |
5 | + * volatile). | ||
5 | * | 6 | * |
6 | * @author Adam Mummery-Smith | 7 | * @author Adam Mummery-Smith |
7 | */ | 8 | */ |
@@ -33,7 +34,8 @@ public interface LoaderProperties | @@ -33,7 +34,8 @@ public interface LoaderProperties | ||
33 | public abstract boolean getBooleanProperty(String propertyName); | 34 | public abstract boolean getBooleanProperty(String propertyName); |
34 | 35 | ||
35 | /** | 36 | /** |
36 | - * Get a boolean property but write and return the supplied default value if the property doesn't exist | 37 | + * Get a boolean property but write and return the supplied default value if |
38 | + * the property doesn't exist | ||
37 | * | 39 | * |
38 | * @param propertyName | 40 | * @param propertyName |
39 | * @param defaultValue | 41 | * @param defaultValue |
@@ -56,7 +58,8 @@ public interface LoaderProperties | @@ -56,7 +58,8 @@ public interface LoaderProperties | ||
56 | public abstract int getIntegerProperty(String propertyName); | 58 | public abstract int getIntegerProperty(String propertyName); |
57 | 59 | ||
58 | /** | 60 | /** |
59 | - * Get an integer property but write and return the supplied default value if the property doesn't exist | 61 | + * Get an integer property but write and return the supplied default value |
62 | + * if the property doesn't exist | ||
60 | * | 63 | * |
61 | * @param propertyName | 64 | * @param propertyName |
62 | * @param defaultValue | 65 | * @param defaultValue |
src/main/java/com/mumfrey/liteloader/launch/NonDelegatingClassLoader.java
@@ -6,8 +6,9 @@ import java.util.HashSet; | @@ -6,8 +6,9 @@ import java.util.HashSet; | ||
6 | import java.util.Set; | 6 | import java.util.Set; |
7 | 7 | ||
8 | /** | 8 | /** |
9 | - * ClassLoader which only allows whitelisted classes to be loaded, used to pre-load packet transformer | ||
10 | - * classes to ensure that they don't reference any external classes. | 9 | + * ClassLoader which only allows whitelisted classes to be loaded, used to |
10 | + * pre-load packet transformer classes to ensure that they don't reference any | ||
11 | + * external classes. | ||
11 | * | 12 | * |
12 | * @author Adam Mummery-Smith | 13 | * @author Adam Mummery-Smith |
13 | */ | 14 | */ |
@@ -102,12 +103,16 @@ public class NonDelegatingClassLoader extends URLClassLoader | @@ -102,12 +103,16 @@ public class NonDelegatingClassLoader extends URLClassLoader | ||
102 | if (this.parent != null) | 103 | if (this.parent != null) |
103 | { | 104 | { |
104 | if (this.delegatedClassNames.contains(name)) | 105 | if (this.delegatedClassNames.contains(name)) |
106 | + { | ||
105 | return this.parent.loadClass(name); | 107 | return this.parent.loadClass(name); |
108 | + } | ||
106 | 109 | ||
107 | for (String delegatedPackage : this.delegatedPackages) | 110 | for (String delegatedPackage : this.delegatedPackages) |
108 | { | 111 | { |
109 | if (name.startsWith(delegatedPackage)) | 112 | if (name.startsWith(delegatedPackage)) |
113 | + { | ||
110 | return this.parent.loadClass(name); | 114 | return this.parent.loadClass(name); |
115 | + } | ||
111 | } | 116 | } |
112 | } | 117 | } |
113 | 118 | ||
@@ -120,12 +125,16 @@ public class NonDelegatingClassLoader extends URLClassLoader | @@ -120,12 +125,16 @@ public class NonDelegatingClassLoader extends URLClassLoader | ||
120 | if (name == null) return null; | 125 | if (name == null) return null; |
121 | 126 | ||
122 | if (this.validClassNames.contains(name)) | 127 | if (this.validClassNames.contains(name)) |
128 | + { | ||
123 | return super.findClass(name); | 129 | return super.findClass(name); |
130 | + } | ||
124 | 131 | ||
125 | for (String validPackage : this.validPackages) | 132 | for (String validPackage : this.validPackages) |
126 | { | 133 | { |
127 | if (name.startsWith(validPackage)) | 134 | if (name.startsWith(validPackage)) |
135 | + { | ||
128 | return super.findClass(name); | 136 | return super.findClass(name); |
137 | + } | ||
129 | } | 138 | } |
130 | 139 | ||
131 | this.valid = false; | 140 | this.valid = false; |
src/main/java/com/mumfrey/liteloader/launch/StartupEnvironment.java
@@ -14,12 +14,13 @@ import joptsimple.OptionParser; | @@ -14,12 +14,13 @@ import joptsimple.OptionParser; | ||
14 | import joptsimple.OptionSet; | 14 | import joptsimple.OptionSet; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | - * Container for startup environment state which also parses the command line options | 17 | + * Container for startup environment state which also parses the command line |
18 | + * options. | ||
18 | * | 19 | * |
19 | * @author Adam Mummery-Smith | 20 | * @author Adam Mummery-Smith |
20 | */ | 21 | */ |
21 | public abstract class StartupEnvironment implements GameEnvironment | 22 | public abstract class StartupEnvironment implements GameEnvironment |
22 | -{ | 23 | +{ |
23 | private List<String> singularLaunchArgs = new ArrayList<String>(); | 24 | private List<String> singularLaunchArgs = new ArrayList<String>(); |
24 | private Map<String, String> launchArgs; | 25 | private Map<String, String> launchArgs; |
25 | 26 | ||
@@ -56,7 +57,7 @@ public abstract class StartupEnvironment implements GameEnvironment | @@ -56,7 +57,7 @@ public abstract class StartupEnvironment implements GameEnvironment | ||
56 | this.launchArgs = (Map<String, String>)Launch.blackboard.get("launchArgs"); | 57 | this.launchArgs = (Map<String, String>)Launch.blackboard.get("launchArgs"); |
57 | if (this.launchArgs == null) | 58 | if (this.launchArgs == null) |
58 | { | 59 | { |
59 | - this.launchArgs = new HashMap<String, String>(); | 60 | + this.launchArgs = new HashMap<String, String>(); |
60 | Launch.blackboard.put("launchArgs", this.launchArgs); | 61 | Launch.blackboard.put("launchArgs", this.launchArgs); |
61 | } | 62 | } |
62 | 63 | ||
@@ -76,9 +77,12 @@ public abstract class StartupEnvironment implements GameEnvironment | @@ -76,9 +77,12 @@ public abstract class StartupEnvironment implements GameEnvironment | ||
76 | OptionParser optionParser = new OptionParser(); | 77 | OptionParser optionParser = new OptionParser(); |
77 | optionParser.allowsUnrecognizedOptions(); | 78 | optionParser.allowsUnrecognizedOptions(); |
78 | 79 | ||
79 | - this.modsOption = optionParser.accepts("mods", "Comma-separated list of mods to load").withRequiredArg().ofType(String.class).withValuesSeparatedBy(','); | ||
80 | - this.apisOption = optionParser.accepts("api", "Additional API classes to load").withRequiredArg().ofType(String.class); | ||
81 | - this.modsDirOption = optionParser.accepts("modsDir", "Path to 'mods' folder to use instead of default").withRequiredArg().ofType(String.class); | 80 | + this.modsOption = optionParser.accepts("mods", "Comma-separated list of mods to load") |
81 | + .withRequiredArg().ofType(String.class).withValuesSeparatedBy(','); | ||
82 | + this.apisOption = optionParser.accepts("api", "Additional API classes to load") | ||
83 | + .withRequiredArg().ofType(String.class); | ||
84 | + this.modsDirOption = optionParser.accepts("modsDir", "Path to 'mods' folder to use instead of default") | ||
85 | + .withRequiredArg().ofType(String.class); | ||
82 | 86 | ||
83 | this.unparsedOptions = optionParser.nonOptions(); | 87 | this.unparsedOptions = optionParser.nonOptions(); |
84 | this.parsedOptions = optionParser.parse(args); | 88 | this.parsedOptions = optionParser.parse(args); |
@@ -114,7 +118,9 @@ public abstract class StartupEnvironment implements GameEnvironment | @@ -114,7 +118,9 @@ public abstract class StartupEnvironment implements GameEnvironment | ||
114 | classifier = null; | 118 | classifier = null; |
115 | } | 119 | } |
116 | else | 120 | else |
121 | + { | ||
117 | this.singularLaunchArgs.add(arg); | 122 | this.singularLaunchArgs.add(arg); |
123 | + } | ||
118 | } | 124 | } |
119 | } | 125 | } |
120 | 126 | ||
@@ -129,13 +135,19 @@ public abstract class StartupEnvironment implements GameEnvironment | @@ -129,13 +135,19 @@ public abstract class StartupEnvironment implements GameEnvironment | ||
129 | public void provideRequiredArgs() | 135 | public void provideRequiredArgs() |
130 | { | 136 | { |
131 | if (this.launchArgs.get("--version") == null) | 137 | if (this.launchArgs.get("--version") == null) |
138 | + { | ||
132 | this.addClassifiedArg("--version", LiteLoaderTweaker.VERSION); | 139 | this.addClassifiedArg("--version", LiteLoaderTweaker.VERSION); |
140 | + } | ||
133 | 141 | ||
134 | if (this.launchArgs.get("--gameDir") == null && this.gameDirectory != null) | 142 | if (this.launchArgs.get("--gameDir") == null && this.gameDirectory != null) |
143 | + { | ||
135 | this.addClassifiedArg("--gameDir", this.gameDirectory.getAbsolutePath()); | 144 | this.addClassifiedArg("--gameDir", this.gameDirectory.getAbsolutePath()); |
145 | + } | ||
136 | 146 | ||
137 | if (this.launchArgs.get("--assetsDir") == null && this.assetsDirectory != null) | 147 | if (this.launchArgs.get("--assetsDir") == null && this.assetsDirectory != null) |
148 | + { | ||
138 | this.addClassifiedArg("--assetsDir", this.assetsDirectory.getAbsolutePath()); | 149 | this.addClassifiedArg("--assetsDir", this.assetsDirectory.getAbsolutePath()); |
150 | + } | ||
139 | } | 151 | } |
140 | 152 | ||
141 | public String[] getLaunchArguments() | 153 | public String[] getLaunchArguments() |
@@ -187,7 +199,9 @@ public abstract class StartupEnvironment implements GameEnvironment | @@ -187,7 +199,9 @@ public abstract class StartupEnvironment implements GameEnvironment | ||
187 | String path = option.value(this.parsedOptions); | 199 | String path = option.value(this.parsedOptions); |
188 | File dir = new File(path); | 200 | File dir = new File(path); |
189 | if (dir.isAbsolute()) | 201 | if (dir.isAbsolute()) |
202 | + { | ||
190 | return dir; | 203 | return dir; |
204 | + } | ||
191 | 205 | ||
192 | return new File(baseDirectory, path); | 206 | return new File(baseDirectory, path); |
193 | } | 207 | } |
src/main/java/com/mumfrey/liteloader/messaging/Message.java
@@ -16,7 +16,8 @@ public class Message | @@ -16,7 +16,8 @@ public class Message | ||
16 | /** | 16 | /** |
17 | * Regex for matching valid channels | 17 | * Regex for matching valid channels |
18 | */ | 18 | */ |
19 | - private static final Pattern channelPattern = Pattern.compile("^[a-z0-9]([a-z0-9_\\-]*[a-z0-9])?:[a-z0-9]([a-z0-9_\\-]*[a-z0-9])?$", Pattern.CASE_INSENSITIVE); | 19 | + private static final Pattern channelPattern = Pattern.compile("^[a-z0-9]([a-z0-9_\\-]*[a-z0-9])?:[a-z0-9]([a-z0-9_\\-]*[a-z0-9])?$", |
20 | + Pattern.CASE_INSENSITIVE); | ||
20 | 21 | ||
21 | private final String channel, replyChannel; | 22 | private final String channel, replyChannel; |
22 | private final Messenger sender; | 23 | private final Messenger sender; |
@@ -69,7 +70,8 @@ public class Message | @@ -69,7 +70,8 @@ public class Message | ||
69 | } | 70 | } |
70 | 71 | ||
71 | /** | 72 | /** |
72 | - * Get the specified reply channel (if any) for this message - may return null | 73 | + * Get the specified reply channel (if any) for this message - may return |
74 | + * null | ||
73 | */ | 75 | */ |
74 | public String getReplyChannel() | 76 | public String getReplyChannel() |
75 | { | 77 | { |
@@ -135,7 +137,8 @@ public class Message | @@ -135,7 +137,8 @@ public class Message | ||
135 | } | 137 | } |
136 | 138 | ||
137 | /** | 139 | /** |
138 | - * Gets the payload with the key "value", which is used with messages constructed using a string-only payload | 140 | + * Gets the payload with the key "value", which is used with messages |
141 | + * constructed using a string-only payload. | ||
139 | */ | 142 | */ |
140 | public <T> T getValue() | 143 | public <T> T getValue() |
141 | { | 144 | { |
src/main/java/com/mumfrey/liteloader/messaging/MessageBus.java
@@ -14,12 +14,12 @@ import com.mumfrey.liteloader.interfaces.FastIterable; | @@ -14,12 +14,12 @@ import com.mumfrey.liteloader.interfaces.FastIterable; | ||
14 | import com.mumfrey.liteloader.util.log.LiteLoaderLogger; | 14 | import com.mumfrey.liteloader.util.log.LiteLoaderLogger; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | - * Intra-mod messaging bus, allows mods to send arbitrary notifications to each other without having to | ||
18 | - * create an explicit dependency or resort to reflection | 17 | + * Intra-mod messaging bus, allows mods to send arbitrary notifications to each |
18 | + * other without having to create an explicit dependency or resort to reflection | ||
19 | * | 19 | * |
20 | * @author Adam Mummery-Smith | 20 | * @author Adam Mummery-Smith |
21 | */ | 21 | */ |
22 | -public class MessageBus implements InterfaceProvider | 22 | +public final class MessageBus implements InterfaceProvider |
23 | { | 23 | { |
24 | /** | 24 | /** |
25 | * Singleton | 25 | * Singleton |
@@ -65,7 +65,9 @@ public class MessageBus implements InterfaceProvider | @@ -65,7 +65,9 @@ public class MessageBus implements InterfaceProvider | ||
65 | } | 65 | } |
66 | 66 | ||
67 | /* (non-Javadoc) | 67 | /* (non-Javadoc) |
68 | - * @see com.mumfrey.liteloader.api.InterfaceProvider#registerInterfaces(com.mumfrey.liteloader.core.InterfaceRegistrationDelegate) | 68 | + * @see com.mumfrey.liteloader.api.InterfaceProvider |
69 | + * #registerInterfaces( | ||
70 | + * com.mumfrey.liteloader.core.InterfaceRegistrationDelegate) | ||
69 | */ | 71 | */ |
70 | @Override | 72 | @Override |
71 | public void registerInterfaces(InterfaceRegistrationDelegate delegate) | 73 | public void registerInterfaces(InterfaceRegistrationDelegate delegate) |
@@ -100,7 +102,8 @@ public class MessageBus implements InterfaceProvider | @@ -100,7 +102,8 @@ public class MessageBus implements InterfaceProvider | ||
100 | List<String> messageChannels = messenger.getMessageChannels(); | 102 | List<String> messageChannels = messenger.getMessageChannels(); |
101 | if (messageChannels == null) | 103 | if (messageChannels == null) |
102 | { | 104 | { |
103 | - LiteLoaderLogger.warning("Listener %s returned a null channel list for getMessageChannels(), this could indicate a problem with the listener", messenger.getName()); | 105 | + LiteLoaderLogger.warning("Listener %s returned a null channel list for getMessageChannels(), " |
106 | + + "this could indicate a problem with the listener", messenger.getName()); | ||
104 | return; | 107 | return; |
105 | } | 108 | } |
106 | 109 | ||
@@ -115,7 +118,7 @@ public class MessageBus implements InterfaceProvider | @@ -115,7 +118,7 @@ public class MessageBus implements InterfaceProvider | ||
115 | { | 118 | { |
116 | LiteLoaderLogger.warning("Listener %s tried to register invalid MessageBus channel %s", messenger.getName(), channel); | 119 | LiteLoaderLogger.warning("Listener %s tried to register invalid MessageBus channel %s", messenger.getName(), channel); |
117 | } | 120 | } |
118 | - } | 121 | + } |
119 | } | 122 | } |
120 | 123 | ||
121 | /** | 124 | /** |
@@ -148,7 +151,8 @@ public class MessageBus implements InterfaceProvider | @@ -148,7 +151,8 @@ public class MessageBus implements InterfaceProvider | ||
148 | catch (StackOverflowError err) | 151 | catch (StackOverflowError err) |
149 | { | 152 | { |
150 | // A listener tried to reply on the same channel and ended up calling itself | 153 | // A listener tried to reply on the same channel and ended up calling itself |
151 | - throw new RuntimeException("Stack overflow encountered dispatching message on channel '" + message.getChannel() + "'. Did you reply to yourself?"); | 154 | + throw new RuntimeException("Stack overflow encountered dispatching message on channel '" |
155 | + + message.getChannel() + "'. Did you reply to yourself?"); | ||
152 | } | 156 | } |
153 | } | 157 | } |
154 | 158 | ||
@@ -170,7 +174,8 @@ public class MessageBus implements InterfaceProvider | @@ -170,7 +174,8 @@ public class MessageBus implements InterfaceProvider | ||
170 | } | 174 | } |
171 | 175 | ||
172 | /** | 176 | /** |
173 | - * Send an empty message on the specified channel, this is useful for messages which are basically just notifications | 177 | + * Send an empty message on the specified channel, this is useful for |
178 | + * messages which are basically just notifications. | ||
174 | * | 179 | * |
175 | * @param channel | 180 | * @param channel |
176 | */ | 181 | */ |
@@ -193,7 +198,8 @@ public class MessageBus implements InterfaceProvider | @@ -193,7 +198,8 @@ public class MessageBus implements InterfaceProvider | ||
193 | } | 198 | } |
194 | 199 | ||
195 | /** | 200 | /** |
196 | - * Send a message with a value on the specified channel from the specified sender | 201 | + * Send a message with a value on the specified channel from the specified |
202 | + * sender. | ||
197 | * | 203 | * |
198 | * @param channel | 204 | * @param channel |
199 | * @param value | 205 | * @param value |
@@ -206,7 +212,8 @@ public class MessageBus implements InterfaceProvider | @@ -206,7 +212,8 @@ public class MessageBus implements InterfaceProvider | ||
206 | } | 212 | } |
207 | 213 | ||
208 | /** | 214 | /** |
209 | - * Send a message with a value on the specified channel from the specified sender | 215 | + * Send a message with a value on the specified channel from the specified |
216 | + * sender. | ||
210 | * | 217 | * |
211 | * @param channel | 218 | * @param channel |
212 | * @param value | 219 | * @param value |
@@ -232,7 +239,8 @@ public class MessageBus implements InterfaceProvider | @@ -232,7 +239,8 @@ public class MessageBus implements InterfaceProvider | ||
232 | } | 239 | } |
233 | 240 | ||
234 | /** | 241 | /** |
235 | - * Send a message with a supplied payload on the specified channel from the specified sender | 242 | + * Send a message with a supplied payload on the specified channel from the |
243 | + * specified sender. | ||
236 | * | 244 | * |
237 | * @param channel | 245 | * @param channel |
238 | * @param payload | 246 | * @param payload |
@@ -245,7 +253,8 @@ public class MessageBus implements InterfaceProvider | @@ -245,7 +253,8 @@ public class MessageBus implements InterfaceProvider | ||
245 | } | 253 | } |
246 | 254 | ||
247 | /** | 255 | /** |
248 | - * Send a message with a supplied payload on the specified channel from the specified sender | 256 | + * Send a message with a supplied payload on the specified channel from the |
257 | + * specified sender. | ||
249 | * | 258 | * |
250 | * @param channel | 259 | * @param channel |
251 | * @param payload | 260 | * @param payload |
src/main/java/com/mumfrey/liteloader/messaging/Messenger.java
@@ -12,39 +12,49 @@ import com.mumfrey.liteloader.api.Listener; | @@ -12,39 +12,49 @@ import com.mumfrey.liteloader.api.Listener; | ||
12 | public interface Messenger extends Listener | 12 | public interface Messenger extends Listener |
13 | { | 13 | { |
14 | /** | 14 | /** |
15 | - * Get listening channels for this Messenger. Channel names must follow the format: | 15 | + * <p>Get listening channels for this Messenger. Channel names must follow |
16 | + * the format:</p> | ||
16 | * | 17 | * |
17 | - * {category}:{channel} | 18 | + * <code>{category}:{channel}</code> |
18 | * | 19 | * |
19 | - * where both {category} and {channel} are alpha-numeric identifiers which can contain underscore or dash | ||
20 | - * but must begin and end with only alpha-numeric characters: for example the following channel names are | ||
21 | - * valid: | 20 | + * <p>where both <tt>{category}</tt> and <tt>{channel}</tt> are |
21 | + * alpha-numeric identifiers which can contain underscore or dash but must | ||
22 | + * begin and end with only alpha-numeric characters: for example the | ||
23 | + * following channel names are valid: | ||
22 | * | 24 | * |
23 | - * * foo:bar | ||
24 | - * * foo-bar:baz | ||
25 | - * * foo-bar:baz_derp | 25 | + * <ul> |
26 | + * <li>foo:bar</li> | ||
27 | + * <li>foo-bar:baz</li> | ||
28 | + * <li>foo-bar:baz_derp</li> | ||
29 | + * </ul> | ||
26 | * | 30 | * |
27 | - * The following are INVALID: | 31 | + * <p>The following are <b>invalid</b>:</p> |
28 | * | 32 | * |
29 | - * * foo | ||
30 | - * * foo_:bar | ||
31 | - * * _foo:bar | ||
32 | - * | ||
33 | - * In general, your listener should listen on channels all beginning with the same category, which may match | ||
34 | - * your mod id. Channel names and categories are case-sensitive. | 33 | + * <ul> |
34 | + * <li>foo</li> | ||
35 | + * <li>foo_:bar</li> | ||
36 | + * <li>_foo:bar</li> | ||
37 | + * </ul> | ||
38 | + * | ||
39 | + * <p>In general, your listener should listen on channels all beginning with | ||
40 | + * the same category, which may match your mod id. Channel names and | ||
41 | + * categories are case-sensitive.</p> | ||
35 | * | 42 | * |
36 | * @return List of channels to listen on | 43 | * @return List of channels to listen on |
37 | */ | 44 | */ |
38 | public abstract List<String> getMessageChannels(); | 45 | public abstract List<String> getMessageChannels(); |
39 | 46 | ||
40 | /** | 47 | /** |
41 | - * Called when a message matching a channel you have elected to listen on is dispatched by any agent. | ||
42 | - * WARNING: this method is called if you dispatch a message on a channel you are listening to, thus you should | ||
43 | - * AVOID replying on channels you are listening to UNLESS you specifically filter messages based on their sender: | 48 | + * Called when a message matching a channel you have elected to listen on is |
49 | + * dispatched by any agent. <b>WARNING</b> this method is called if you | ||
50 | + * dispatch a message on a channel you are listening to, thus you should | ||
51 | + * <b>avoid</b> replying on channels you are listening to <b>unless</b> you | ||
52 | + * specifically filter messages based on their sender: | ||
44 | * | 53 | * |
45 | - * if (message.getSender() == this) return; | 54 | + * <code>if (message.getSender() == this) return;</code> |
46 | * | 55 | * |
47 | - * Messages may have a null sender or payload but will never have a null channel. | 56 | + * <p>Messages may have a null sender or payload but will never have a null |
57 | + * channel.</p> | ||
48 | * | 58 | * |
49 | * @param message | 59 | * @param message |
50 | */ | 60 | */ |
src/main/java/com/mumfrey/liteloader/modconfig/AdvancedExposable.java
@@ -5,30 +5,34 @@ import java.io.File; | @@ -5,30 +5,34 @@ import java.io.File; | ||
5 | import com.google.gson.GsonBuilder; | 5 | import com.google.gson.GsonBuilder; |
6 | 6 | ||
7 | /** | 7 | /** |
8 | - * Interface for Exposables which want a finer degree of control over the serialisation process | 8 | + * Interface for Exposables which want a finer degree of control over the |
9 | + * serialisation process. | ||
9 | * | 10 | * |
10 | * @author Adam Mummery-Smith | 11 | * @author Adam Mummery-Smith |
11 | */ | 12 | */ |
12 | public interface AdvancedExposable extends Exposable | 13 | public interface AdvancedExposable extends Exposable |
13 | { | 14 | { |
14 | /** | 15 | /** |
15 | - * Allows this object to configure the GsonBuilder prior to the construction of the Gson instance. Use | ||
16 | - * this callback to (for example) register custom type adapters or set other Gson options such as | ||
17 | - * pretty printing. | 16 | + * Allows this object to configure the GsonBuilder prior to the construction |
17 | + * of the Gson instance. Use this callback to (for example) register custom | ||
18 | + * type adapters or set other Gson options such as pretty printing. | ||
18 | * | 19 | * |
19 | * @param gsonBuilder | 20 | * @param gsonBuilder |
20 | */ | 21 | */ |
21 | public abstract void setupGsonSerialiser(GsonBuilder gsonBuilder); | 22 | public abstract void setupGsonSerialiser(GsonBuilder gsonBuilder); |
22 | 23 | ||
23 | /** | 24 | /** |
24 | - * Allows this object to specify an alternative configuration file to the one determined by the writer, | ||
25 | - * either return null or return configFile to keep the original setting, or return a new File object | ||
26 | - * to set the location for the config file. If you specify an alternative location, you are responsible | ||
27 | - * for ensuring that the location exists and is writable. | 25 | + * Allows this object to specify an alternative configuration file to the |
26 | + * one determined by the writer, either return null or return configFile to | ||
27 | + * keep the original setting, or return a new File object to set the | ||
28 | + * location for the config file. If you specify an alternative location, you | ||
29 | + * are responsible for ensuring that the location exists and is writable. | ||
28 | * | 30 | * |
29 | - * @param configFile Default config file, generated by the ExposableOptions for this Exposable | ||
30 | - * @param configFileLocation Default config file location, from the config strategy | ||
31 | - * @param defaultFileName Default config file name, from the ExposableOptions | 31 | + * @param configFile Default config file, generated by the ExposableOptions |
32 | + * for this Exposable | ||
33 | + * @param configFileLocation Default config file location, from the config | ||
34 | + * strategy | ||
35 | + * @param defaultFileName Default cfg file name, from the ExposableOptions | ||
32 | * @return config file location to return, return null to use the default | 36 | * @return config file location to return, return null to use the default |
33 | */ | 37 | */ |
34 | public abstract File getConfigFile(File configFile, File configFileLocation, String defaultFileName); | 38 | public abstract File getConfigFile(File configFile, File configFileLocation, String defaultFileName); |
src/main/java/com/mumfrey/liteloader/modconfig/ConfigManager.java
@@ -8,6 +8,7 @@ import java.util.List; | @@ -8,6 +8,7 @@ import java.util.List; | ||
8 | import java.util.Map; | 8 | import java.util.Map; |
9 | 9 | ||
10 | import com.google.common.base.Strings; | 10 | import com.google.common.base.Strings; |
11 | +import com.google.common.collect.Maps; | ||
11 | import com.google.common.io.Files; | 12 | import com.google.common.io.Files; |
12 | import com.mumfrey.liteloader.Configurable; | 13 | import com.mumfrey.liteloader.Configurable; |
13 | import com.mumfrey.liteloader.LiteMod; | 14 | import com.mumfrey.liteloader.LiteMod; |
@@ -22,8 +23,8 @@ public class ConfigManager | @@ -22,8 +23,8 @@ public class ConfigManager | ||
22 | /** | 23 | /** |
23 | * Mod config panel classes | 24 | * Mod config panel classes |
24 | */ | 25 | */ |
25 | - private Map<Class<? extends LiteMod>, Class<? extends ConfigPanel>> configPanels = new HashMap<Class<? extends LiteMod>, Class<? extends ConfigPanel>>(); | ||
26 | - | 26 | + private Map<Class<? extends LiteMod>, Class<? extends ConfigPanel>> configPanels = Maps.newHashMap(); |
27 | + | ||
27 | /** | 28 | /** |
28 | * Mod config writers | 29 | * Mod config writers |
29 | */ | 30 | */ |
@@ -35,7 +36,8 @@ public class ConfigManager | @@ -35,7 +36,8 @@ public class ConfigManager | ||
35 | private List<ExposableConfigWriter> configWriterList = new LinkedList<ExposableConfigWriter>(); | 36 | private List<ExposableConfigWriter> configWriterList = new LinkedList<ExposableConfigWriter>(); |
36 | 37 | ||
37 | /** | 38 | /** |
38 | - * Register a mod, adds the config panel class to the map if the mod implements Configurable | 39 | + * Register a mod, adds the config panel class to the map if the mod |
40 | + * implements Configurable | ||
39 | */ | 41 | */ |
40 | public void registerMod(LiteMod mod) | 42 | public void registerMod(LiteMod mod) |
41 | { | 43 | { |
@@ -86,7 +88,9 @@ public class ConfigManager | @@ -86,7 +88,9 @@ public class ConfigManager | ||
86 | fileName = exposable.getClass().getSimpleName().toLowerCase(); | 88 | fileName = exposable.getClass().getSimpleName().toLowerCase(); |
87 | 89 | ||
88 | if (fileName.startsWith("litemod")) | 90 | if (fileName.startsWith("litemod")) |
91 | + { | ||
89 | fileName = fileName.substring(7); | 92 | fileName = fileName.substring(7); |
93 | + } | ||
90 | } | 94 | } |
91 | 95 | ||
92 | ExposableConfigWriter configWriter = ExposableConfigWriter.create(exposable, strategy, fileName, aggressive); | 96 | ExposableConfigWriter configWriter = ExposableConfigWriter.create(exposable, strategy, fileName, aggressive); |
@@ -98,7 +102,8 @@ public class ConfigManager | @@ -98,7 +102,8 @@ public class ConfigManager | ||
98 | } | 102 | } |
99 | 103 | ||
100 | /** | 104 | /** |
101 | - * If the specified mod has a versioned config strategy, attempt to copy the config | 105 | + * If the specified mod has a versioned config strategy, attempt to copy the |
106 | + * config. | ||
102 | * | 107 | * |
103 | * @param mod | 108 | * @param mod |
104 | * @param newConfigPath | 109 | * @param newConfigPath |
@@ -140,7 +145,8 @@ public class ConfigManager | @@ -140,7 +145,8 @@ public class ConfigManager | ||
140 | } | 145 | } |
141 | 146 | ||
142 | /** | 147 | /** |
143 | - * Instance a new config panel for the specified mod class if one is available | 148 | + * Instance a new config panel for the specified mod class if one is |
149 | + * available. | ||
144 | * | 150 | * |
145 | * @param modClass | 151 | * @param modClass |
146 | */ | 152 | */ |
@@ -176,8 +182,8 @@ public class ConfigManager | @@ -176,8 +182,8 @@ public class ConfigManager | ||
176 | } | 182 | } |
177 | 183 | ||
178 | /** | 184 | /** |
179 | - * Invalidate the specified mod config, cause it to be written to disk or scheduled for writing | ||
180 | - * if it has been written recent | 185 | + * Invalidate the specified mod config, cause it to be written to disk or |
186 | + * scheduled for writing if it has been written recently. | ||
181 | * | 187 | * |
182 | * @param exposable | 188 | * @param exposable |
183 | */ | 189 | */ |
@@ -190,7 +196,8 @@ public class ConfigManager | @@ -190,7 +196,8 @@ public class ConfigManager | ||
190 | } | 196 | } |
191 | 197 | ||
192 | /** | 198 | /** |
193 | - * Tick all of the configuration writers, handles latent writes for anti-hammer strategy | 199 | + * Tick all of the configuration writers, handles latent writes for |
200 | + * anti-hammer strategy. | ||
194 | */ | 201 | */ |
195 | public void onTick() | 202 | public void onTick() |
196 | { | 203 | { |
src/main/java/com/mumfrey/liteloader/modconfig/ConfigPanel.java
@@ -9,17 +9,20 @@ package com.mumfrey.liteloader.modconfig; | @@ -9,17 +9,20 @@ package com.mumfrey.liteloader.modconfig; | ||
9 | public interface ConfigPanel | 9 | public interface ConfigPanel |
10 | { | 10 | { |
11 | /** | 11 | /** |
12 | - * Panels should return the text to display at the top of the config panel window | 12 | + * Panels should return the text to display at the top of the config panel |
13 | + * window. | ||
13 | */ | 14 | */ |
14 | public abstract String getPanelTitle(); | 15 | public abstract String getPanelTitle(); |
15 | 16 | ||
16 | /** | 17 | /** |
17 | - * Get the height of the content area for scrolling purposes, return -1 to disable scrolling | 18 | + * Get the height of the content area for scrolling purposes, return -1 to |
19 | + * disable scrolling. | ||
18 | */ | 20 | */ |
19 | public abstract int getContentHeight(); | 21 | public abstract int getContentHeight(); |
20 | 22 | ||
21 | /** | 23 | /** |
22 | - * Called when the panel is displayed, initialise the panel (read settings, etc) | 24 | + * Called when the panel is displayed, initialise the panel (read settings, |
25 | + * etc) | ||
23 | * | 26 | * |
24 | * @param host panel host | 27 | * @param host panel host |
25 | */ | 28 | */ |
src/main/java/com/mumfrey/liteloader/modconfig/ConfigPanelHost.java
@@ -32,10 +32,11 @@ public interface ConfigPanelHost | @@ -32,10 +32,11 @@ public interface ConfigPanelHost | ||
32 | /** | 32 | /** |
33 | * Notify the panel host that the panel wishes to advance to the next panel | 33 | * Notify the panel host that the panel wishes to advance to the next panel |
34 | */ | 34 | */ |
35 | - // public abstract void next(); | 35 | +// public abstract void next(); |
36 | 36 | ||
37 | /** | 37 | /** |
38 | - * Notify the panel host that the panel wishes to go back to the previous panel | 38 | + * Notify the panel host that the panel wishes to go back to the previous |
39 | + * panel. | ||
39 | */ | 40 | */ |
40 | - // public abstract void previous(); | 41 | +// public abstract void previous(); |
41 | } | 42 | } |
src/main/java/com/mumfrey/liteloader/modconfig/ExposableConfigWriter.java
@@ -48,7 +48,8 @@ public final class ExposableConfigWriter implements InstanceCreator<Exposable> | @@ -48,7 +48,8 @@ public final class ExposableConfigWriter implements InstanceCreator<Exposable> | ||
48 | private final Gson gson; | 48 | private final Gson gson; |
49 | 49 | ||
50 | /** | 50 | /** |
51 | - * True if a config write has been requested but anti-hammer has prevented the write from occurring | 51 | + * True if a config write has been requested but anti-hammer has prevented |
52 | + * the write from occurring. | ||
52 | */ | 53 | */ |
53 | private volatile boolean dirty = false; | 54 | private volatile boolean dirty = false; |
54 | 55 | ||
@@ -58,7 +59,8 @@ public final class ExposableConfigWriter implements InstanceCreator<Exposable> | @@ -58,7 +59,8 @@ public final class ExposableConfigWriter implements InstanceCreator<Exposable> | ||
58 | private volatile long lastWrite = 0L; | 59 | private volatile long lastWrite = 0L; |
59 | 60 | ||
60 | /** | 61 | /** |
61 | - * It's possible that writes may be requested from different threads, lock object to prevent cross-thread derp | 62 | + * It's possible that writes may be requested from different threads, lock |
63 | + * object to prevent cross-thread derp. | ||
62 | */ | 64 | */ |
63 | private Object readWriteLock = new Object(); | 65 | private Object readWriteLock = new Object(); |
64 | 66 | ||
@@ -112,7 +114,8 @@ public final class ExposableConfigWriter implements InstanceCreator<Exposable> | @@ -112,7 +114,8 @@ public final class ExposableConfigWriter implements InstanceCreator<Exposable> | ||
112 | } | 114 | } |
113 | 115 | ||
114 | /** | 116 | /** |
115 | - * Returns true if this writer has been invalidated but not yet been flushed to disk | 117 | + * Returns true if this writer has been invalidated but not yet been flushed |
118 | + * to disk. | ||
116 | */ | 119 | */ |
117 | boolean isDirty() | 120 | boolean isDirty() |
118 | { | 121 | { |
@@ -120,7 +123,8 @@ public final class ExposableConfigWriter implements InstanceCreator<Exposable> | @@ -120,7 +123,8 @@ public final class ExposableConfigWriter implements InstanceCreator<Exposable> | ||
120 | } | 123 | } |
121 | 124 | ||
122 | /* (non-Javadoc) | 125 | /* (non-Javadoc) |
123 | - * @see com.google.gson.InstanceCreator#createInstance(java.lang.reflect.Type) | 126 | + * @see com.google.gson.InstanceCreator |
127 | + * #createInstance(java.lang.reflect.Type) | ||
124 | */ | 128 | */ |
125 | @Override | 129 | @Override |
126 | public Exposable createInstance(Type type) | 130 | public Exposable createInstance(Type type) |
@@ -129,7 +133,8 @@ public final class ExposableConfigWriter implements InstanceCreator<Exposable> | @@ -129,7 +133,8 @@ public final class ExposableConfigWriter implements InstanceCreator<Exposable> | ||
129 | } | 133 | } |
130 | 134 | ||
131 | /** | 135 | /** |
132 | - * Initialise the config, reads from file and writes the initial config file if not present | 136 | + * Initialise the config, reads from file and writes the initial config file |
137 | + * if not present. | ||
133 | */ | 138 | */ |
134 | void init() | 139 | void init() |
135 | { | 140 | { |
@@ -172,7 +177,9 @@ public final class ExposableConfigWriter implements InstanceCreator<Exposable> | @@ -172,7 +177,9 @@ public final class ExposableConfigWriter implements InstanceCreator<Exposable> | ||
172 | try | 177 | try |
173 | { | 178 | { |
174 | if (reader != null) | 179 | if (reader != null) |
180 | + { | ||
175 | reader.close(); | 181 | reader.close(); |
182 | + } | ||
176 | } | 183 | } |
177 | catch (IOException ex) | 184 | catch (IOException ex) |
178 | { | 185 | { |
@@ -208,7 +215,9 @@ public final class ExposableConfigWriter implements InstanceCreator<Exposable> | @@ -208,7 +215,9 @@ public final class ExposableConfigWriter implements InstanceCreator<Exposable> | ||
208 | try | 215 | try |
209 | { | 216 | { |
210 | if (writer != null) | 217 | if (writer != null) |
218 | + { | ||
211 | writer.close(); | 219 | writer.close(); |
220 | + } | ||
212 | } | 221 | } |
213 | catch (IOException ex) | 222 | catch (IOException ex) |
214 | { | 223 | { |
@@ -219,8 +228,8 @@ public final class ExposableConfigWriter implements InstanceCreator<Exposable> | @@ -219,8 +228,8 @@ public final class ExposableConfigWriter implements InstanceCreator<Exposable> | ||
219 | } | 228 | } |
220 | 229 | ||
221 | /** | 230 | /** |
222 | - * Write the config to file, respecting anti-hammer and queuing the write if not | ||
223 | - * enough time has elapsed | 231 | + * Write the config to file, respecting anti-hammer and queuing the write if |
232 | + * not enough time has elapsed. | ||
224 | */ | 233 | */ |
225 | void invalidate() | 234 | void invalidate() |
226 | { | 235 | { |
@@ -249,7 +258,7 @@ public final class ExposableConfigWriter implements InstanceCreator<Exposable> | @@ -249,7 +258,7 @@ public final class ExposableConfigWriter implements InstanceCreator<Exposable> | ||
249 | { | 258 | { |
250 | this.write(); | 259 | this.write(); |
251 | } | 260 | } |
252 | - } | 261 | + } |
253 | } | 262 | } |
254 | 263 | ||
255 | /** | 264 | /** |
@@ -264,7 +273,8 @@ public final class ExposableConfigWriter implements InstanceCreator<Exposable> | @@ -264,7 +273,8 @@ public final class ExposableConfigWriter implements InstanceCreator<Exposable> | ||
264 | } | 273 | } |
265 | 274 | ||
266 | /** | 275 | /** |
267 | - * Factory method which creates and intialises a new ExposableConfigWriter for the specified exposable object and strategy | 276 | + * Factory method which creates and intialises a new ExposableConfigWriter |
277 | + * for the specified exposable object and strategy. | ||
268 | * | 278 | * |
269 | * @param exposable | 279 | * @param exposable |
270 | * @param strategy | 280 | * @param strategy |
@@ -273,7 +283,9 @@ public final class ExposableConfigWriter implements InstanceCreator<Exposable> | @@ -273,7 +283,9 @@ public final class ExposableConfigWriter implements InstanceCreator<Exposable> | ||
273 | static ExposableConfigWriter create(Exposable exposable, ConfigStrategy strategy, String fileName, boolean aggressive) | 283 | static ExposableConfigWriter create(Exposable exposable, ConfigStrategy strategy, String fileName, boolean aggressive) |
274 | { | 284 | { |
275 | if (!fileName.toLowerCase().endsWith(".json")) | 285 | if (!fileName.toLowerCase().endsWith(".json")) |
286 | + { | ||
276 | fileName = fileName + ".json"; | 287 | fileName = fileName + ".json"; |
288 | + } | ||
277 | 289 | ||
278 | File configFile = strategy.getFileForStrategy(fileName); | 290 | File configFile = strategy.getFileForStrategy(fileName); |
279 | 291 |
src/main/java/com/mumfrey/liteloader/modconfig/ExposableOptions.java
@@ -6,8 +6,8 @@ import java.lang.annotation.RetentionPolicy; | @@ -6,8 +6,8 @@ import java.lang.annotation.RetentionPolicy; | ||
6 | import java.lang.annotation.Target; | 6 | import java.lang.annotation.Target; |
7 | 7 | ||
8 | /** | 8 | /** |
9 | - * Annotation which can be a applied to mod classes to indicate that members decorated with the Gson | ||
10 | - * Expose annotation should be serialised with Gson | 9 | + * Annotation which can be a applied to mod classes to indicate that members |
10 | + * decorated with the Gson Expose annotation should be serialised with Gson. | ||
11 | * | 11 | * |
12 | * @author Adam Mummery-Smith | 12 | * @author Adam Mummery-Smith |
13 | */ | 13 | */ |
src/main/java/com/mumfrey/liteloader/permissions/Permission.java
@@ -55,7 +55,7 @@ public class Permission | @@ -55,7 +55,7 @@ public class Permission | ||
55 | public Permission(String permissionName, boolean value) | 55 | public Permission(String permissionName, boolean value) |
56 | { | 56 | { |
57 | this.isRootNode = false; | 57 | this.isRootNode = false; |
58 | - this.isWildcardNode = permissionName.equals("*"); | 58 | + this.isWildcardNode = "*".equals(permissionName); |
59 | this.value = value; | 59 | this.value = value; |
60 | this.nodeName = permissionName; | 60 | this.nodeName = permissionName; |
61 | } | 61 | } |
@@ -192,7 +192,8 @@ public class Permission | @@ -192,7 +192,8 @@ public class Permission | ||
192 | } | 192 | } |
193 | 193 | ||
194 | /** | 194 | /** |
195 | - * Sets a permission and also explicitly sets the permission value, this allows negated permissions to be set | 195 | + * Sets a permission and also explicitly sets the permission value, this |
196 | + * allows negated permissions to be set. | ||
196 | * | 197 | * |
197 | * @param name | 198 | * @param name |
198 | * @param value | 199 | * @param value |
src/main/java/com/mumfrey/liteloader/permissions/Permissions.java
@@ -8,7 +8,8 @@ package com.mumfrey.liteloader.permissions; | @@ -8,7 +8,8 @@ package com.mumfrey.liteloader.permissions; | ||
8 | public interface Permissions | 8 | public interface Permissions |
9 | { | 9 | { |
10 | /** | 10 | /** |
11 | - * Returns true if the specified permission is set in this permission container | 11 | + * Returns true if the specified permission is set in this permission |
12 | + * container. | ||
12 | * | 13 | * |
13 | * @param permission Name of the permission to test for | 14 | * @param permission Name of the permission to test for |
14 | * @return True if the permission exists in this set | 15 | * @return True if the permission exists in this set |
@@ -16,19 +17,22 @@ public interface Permissions | @@ -16,19 +17,22 @@ public interface Permissions | ||
16 | public abstract boolean getPermissionSet(String permission); | 17 | public abstract boolean getPermissionSet(String permission); |
17 | 18 | ||
18 | /** | 19 | /** |
19 | - * Returns true if the authority says we have this permission or false if the permission is denied or not set | 20 | + * Returns true if the authority says we have this permission or false if |
21 | + * the permission is denied or not set. | ||
20 | * | 22 | * |
21 | * @param permission Name of the permission to test for | 23 | * @param permission Name of the permission to test for |
22 | */ | 24 | */ |
23 | public abstract boolean getHasPermission(String permission); | 25 | public abstract boolean getHasPermission(String permission); |
24 | 26 | ||
25 | /** | 27 | /** |
26 | - * Returns true if the authority says we have this permission or if the permission is not specified by the authority returns the default value | 28 | + * Returns true if the authority says we have this permission or if the |
29 | + * permission is not specified by the authority returns the default value. | ||
27 | * | 30 | * |
28 | * @param permission Name of the permission to test for | 31 | * @param permission Name of the permission to test for |
29 | - * @param defaultValue Value to return if the permission is NOT specified by the authority | ||
30 | - * | ||
31 | - * @return State of the authority permission or default value if not specified | 32 | + * @param defaultValue Value to return if the permission is NOT specified by |
33 | + * the authority | ||
34 | + * @return State of the authority permission or default value if not | ||
35 | + * specified | ||
32 | */ | 36 | */ |
33 | public abstract boolean getHasPermission(String permission, boolean defaultValue); | 37 | public abstract boolean getHasPermission(String permission, boolean defaultValue); |
34 | } | 38 | } |
src/main/java/com/mumfrey/liteloader/permissions/PermissionsManager.java
@@ -11,7 +11,8 @@ import com.mumfrey.liteloader.common.GameEngine; | @@ -11,7 +11,8 @@ import com.mumfrey.liteloader.common.GameEngine; | ||
11 | public interface PermissionsManager | 11 | public interface PermissionsManager |
12 | { | 12 | { |
13 | /** | 13 | /** |
14 | - * Get the underlying permissions node for this manager for the specified mod | 14 | + * Get the underlying permissions node for this manager for the specified |
15 | + * mod | ||
15 | * | 16 | * |
16 | * @param mod Mod to fetch permissions for | 17 | * @param mod Mod to fetch permissions for |
17 | */ | 18 | */ |
@@ -35,15 +36,16 @@ public interface PermissionsManager | @@ -35,15 +36,16 @@ public interface PermissionsManager | ||
35 | public abstract void onTick(GameEngine<?, ?> engine, float partialTicks, boolean inGame); | 36 | public abstract void onTick(GameEngine<?, ?> engine, float partialTicks, boolean inGame); |
36 | 37 | ||
37 | /** | 38 | /** |
38 | - * Register a new event listener, the registered object will receive callbacks for permissions events | 39 | + * Register a new event listener, the registered object will receive |
40 | + * callbacks for permissions events | ||
39 | * | 41 | * |
40 | * @param permissible | 42 | * @param permissible |
41 | */ | 43 | */ |
42 | public abstract void registerPermissible(Permissible permissible); | 44 | public abstract void registerPermissible(Permissible permissible); |
43 | 45 | ||
44 | /** | 46 | /** |
45 | - * Perform any necessary validation to check for a tamper condition, can and should be called from as | ||
46 | - * many places as possible | 47 | + * Perform any necessary validation to check for a tamper condition, can and |
48 | + * should be called from as many places as possible | ||
47 | */ | 49 | */ |
48 | public abstract void tamperCheck(); | 50 | public abstract void tamperCheck(); |
49 | } | 51 | } |
src/main/java/com/mumfrey/liteloader/permissions/PermissionsManagerClient.java
@@ -24,13 +24,15 @@ import com.mumfrey.liteloader.core.ClientPluginChannels; | @@ -24,13 +24,15 @@ import com.mumfrey.liteloader.core.ClientPluginChannels; | ||
24 | import com.mumfrey.liteloader.core.PluginChannels.ChannelPolicy; | 24 | import com.mumfrey.liteloader.core.PluginChannels.ChannelPolicy; |
25 | 25 | ||
26 | /** | 26 | /** |
27 | - * This class manages permissions on the client, it is a singleton class which can manage permissions for multiple | ||
28 | - * client mods. It manages the client/server communication used to replicate permissions and serves as a hub for | ||
29 | - * permissions objects which keep track of the permissions available on the client | 27 | + * This class manages permissions on the client, it is a singleton class which |
28 | + * can manage permissions for multiple client mods. It manages the client/server | ||
29 | + * communication used to replicate permissions and serves as a hub for | ||
30 | + * permissions objects which keep track of the permissions available on the | ||
31 | + * client. | ||
30 | * | 32 | * |
31 | * @author Adam Mummery-Smith | 33 | * @author Adam Mummery-Smith |
32 | */ | 34 | */ |
33 | -public class PermissionsManagerClient implements PermissionsManager, PluginChannelListener | 35 | +public final class PermissionsManagerClient implements PermissionsManager, PluginChannelListener |
34 | { | 36 | { |
35 | /** | 37 | /** |
36 | * Singleton instance of the client permissions manager | 38 | * Singleton instance of the client permissions manager |
@@ -38,7 +40,8 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann | @@ -38,7 +40,8 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann | ||
38 | private static PermissionsManagerClient instance; | 40 | private static PermissionsManagerClient instance; |
39 | 41 | ||
40 | /** | 42 | /** |
41 | - * Permissions permissible which is a proxy for permissions that are common to all mods | 43 | + * Permissions permissible which is a proxy for permissions that are common |
44 | + * to all mods. | ||
42 | */ | 45 | */ |
43 | private static Permissible allMods = new PermissibleAllMods(); | 46 | private static Permissible allMods = new PermissibleAllMods(); |
44 | 47 | ||
@@ -73,7 +76,8 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann | @@ -73,7 +76,8 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann | ||
73 | private Map<String, ServerPermissions> serverPermissions = new HashMap<String, ServerPermissions>(); | 76 | private Map<String, ServerPermissions> serverPermissions = new HashMap<String, ServerPermissions>(); |
74 | 77 | ||
75 | /** | 78 | /** |
76 | - * Last time onTick was called, used to detect tamper condition if no ticks are being received | 79 | + * Last time onTick was called, used to detect tamper condition if no ticks |
80 | + * are being received. | ||
77 | */ | 81 | */ |
78 | private long lastTickTime = System.currentTimeMillis(); | 82 | private long lastTickTime = System.currentTimeMillis(); |
79 | 83 | ||
@@ -85,7 +89,8 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann | @@ -85,7 +89,8 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann | ||
85 | private int menuTicks = 0; | 89 | private int menuTicks = 0; |
86 | 90 | ||
87 | /** | 91 | /** |
88 | - * Get a reference to the singleton instance of the client permissions manager | 92 | + * Get a reference to the singleton instance of the client permissions |
93 | + * manager. | ||
89 | */ | 94 | */ |
90 | public static PermissionsManagerClient getInstance() | 95 | public static PermissionsManagerClient getInstance() |
91 | { | 96 | { |
@@ -106,7 +111,8 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann | @@ -106,7 +111,8 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann | ||
106 | } | 111 | } |
107 | 112 | ||
108 | /* (non-Javadoc) | 113 | /* (non-Javadoc) |
109 | - * @see net.eq2online.permissions.PermissionsManager#getPermissions(java.lang.String) | 114 | + * @see net.eq2online.permissions.PermissionsManager |
115 | + * #getPermissions(java.lang.String) | ||
110 | */ | 116 | */ |
111 | @Override | 117 | @Override |
112 | public Permissions getPermissions(Permissible mod) | 118 | public Permissions getPermissions(Permissible mod) |
@@ -119,7 +125,8 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann | @@ -119,7 +125,8 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann | ||
119 | } | 125 | } |
120 | 126 | ||
121 | /* (non-Javadoc) | 127 | /* (non-Javadoc) |
122 | - * @see net.eq2online.permissions.PermissionsManager#getPermissionUpdateTime(java.lang.String) | 128 | + * @see net.eq2online.permissions.PermissionsManager |
129 | + * #getPermissionUpdateTime(java.lang.String) | ||
123 | */ | 130 | */ |
124 | @Override | 131 | @Override |
125 | public Long getPermissionUpdateTime(Permissible mod) | 132 | public Long getPermissionUpdateTime(Permissible mod) |
@@ -145,7 +152,8 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann | @@ -145,7 +152,8 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann | ||
145 | } | 152 | } |
146 | 153 | ||
147 | /* (non-Javadoc) | 154 | /* (non-Javadoc) |
148 | - * @see net.eq2online.permissions.PermissionsManager#registerListener(net.eq2online.permissions.PermissionsListener) | 155 | + * @see net.eq2online.permissions.PermissionsManager |
156 | + * #registerListener(net.eq2online.permissions.PermissionsListener) | ||
149 | */ | 157 | */ |
150 | @Override | 158 | @Override |
151 | public void registerPermissible(Permissible permissible) | 159 | public void registerPermissible(Permissible permissible) |
@@ -169,7 +177,8 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann | @@ -169,7 +177,8 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann | ||
169 | { | 177 | { |
170 | if (this.registeredClientMods.containsKey(modName)) | 178 | if (this.registeredClientMods.containsKey(modName)) |
171 | { | 179 | { |
172 | - throw new IllegalArgumentException("Cannot register mod \"" + modName + "\"! The mod was already registered with the permissions manager."); | 180 | + throw new IllegalArgumentException("Cannot register mod \"" + modName |
181 | + + "\"! The mod was already registered with the permissions manager."); | ||
173 | } | 182 | } |
174 | 183 | ||
175 | this.registeredClientMods.put(modName, mod); | 184 | this.registeredClientMods.put(modName, mod); |
@@ -211,9 +220,10 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann | @@ -211,9 +220,10 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann | ||
211 | } | 220 | } |
212 | 221 | ||
213 | /** | 222 | /** |
214 | - * Send a permission query packet to the server for the specified mod. You do not need to call this method because it is | ||
215 | - * issued automatically by the client permissions manager when connecting to a new server. However you can call use this | ||
216 | - * method to "force" a refresh of permissions when needed. | 223 | + * Send a permission query packet to the server for the specified mod. You |
224 | + * do not need to call this method because it is issued automatically by the | ||
225 | + * client permissions manager when connecting to a new server. However you | ||
226 | + * can call use this method to "force" a refresh of permissions when needed. | ||
217 | * | 227 | * |
218 | * @param mod mod to send a query packet for | 228 | * @param mod mod to send a query packet for |
219 | */ | 229 | */ |
@@ -251,7 +261,8 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann | @@ -251,7 +261,8 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann | ||
251 | } | 261 | } |
252 | 262 | ||
253 | /* (non-Javadoc) | 263 | /* (non-Javadoc) |
254 | - * @see com.mumfrey.liteloader.permissions.PermissionsManager#onTick(net.minecraft.client.Minecraft, float, boolean) | 264 | + * @see com.mumfrey.liteloader.permissions.PermissionsManager |
265 | + * #onTick(net.minecraft.client.Minecraft, float, boolean) | ||
255 | */ | 266 | */ |
256 | @Override | 267 | @Override |
257 | public void onTick(GameEngine<?, ?> engine, float partialTicks, boolean inGame) | 268 | public void onTick(GameEngine<?, ?> engine, float partialTicks, boolean inGame) |
@@ -300,7 +311,8 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann | @@ -300,7 +311,8 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann | ||
300 | } | 311 | } |
301 | 312 | ||
302 | /* (non-Javadoc) | 313 | /* (non-Javadoc) |
303 | - * @see net.eq2online.permissions.PermissionsManager#onCustomPayload(java.lang.String, int, byte[]) | 314 | + * @see net.eq2online.permissions.PermissionsManager |
315 | + * #onCustomPayload(java.lang.String, int, byte[]) | ||
304 | */ | 316 | */ |
305 | @Override | 317 | @Override |
306 | public void onCustomPayload(String channel, PacketBuffer data) | 318 | public void onCustomPayload(String channel, PacketBuffer data) |
@@ -334,8 +346,9 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann | @@ -334,8 +346,9 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann | ||
334 | } | 346 | } |
335 | 347 | ||
336 | /** | 348 | /** |
337 | - * Register a permission for all mods, the permission will be prefixed with "mod.all." to provide | ||
338 | - * a common namespace for client mods when permissions are replicated to the server | 349 | + * Register a permission for all mods, the permission will be prefixed with |
350 | + * <tt>"mod.all."</tt> to provide a common namespace for client mods when | ||
351 | + * permissions are replicated to the server. | ||
339 | * | 352 | * |
340 | * @param permission | 353 | * @param permission |
341 | */ | 354 | */ |
@@ -345,8 +358,9 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann | @@ -345,8 +358,9 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann | ||
345 | } | 358 | } |
346 | 359 | ||
347 | /** | 360 | /** |
348 | - * Register a permission for the specified mod, the permission will be prefixed with "mod.<modname>." to provide | ||
349 | - * a common namespace for client mods when permissions are replicated to the server | 361 | + * Register a permission for the specified mod, the permission will be |
362 | + * prefixed with <tt>"mod.<modname>."</tt> to provide a common namespace for | ||
363 | + * client mods when permissions are replicated to the server. | ||
350 | * | 364 | * |
351 | * @param mod | 365 | * @param mod |
352 | * @param permission | 366 | * @param permission |
@@ -358,7 +372,8 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann | @@ -358,7 +372,8 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann | ||
358 | 372 | ||
359 | if (!this.registeredClientMods.containsValue(mod)) | 373 | if (!this.registeredClientMods.containsValue(mod)) |
360 | { | 374 | { |
361 | - throw new IllegalArgumentException("Cannot register a mod permission for mod \"" + modName + "\"! The mod was not registered with the permissions manager."); | 375 | + throw new IllegalArgumentException("Cannot register a mod permission for mod \"" + modName |
376 | + + "\"! The mod was not registered with the permissions manager."); | ||
362 | } | 377 | } |
363 | 378 | ||
364 | permission = formatModPermission(modName, permission); | 379 | permission = formatModPermission(modName, permission); |
@@ -381,7 +396,8 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann | @@ -381,7 +396,8 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann | ||
381 | } | 396 | } |
382 | 397 | ||
383 | /** | 398 | /** |
384 | - * Get the value of the specified permission for all mods and return the default value if the permission is not set | 399 | + * Get the value of the specified permission for all mods and return the |
400 | + * default value if the permission is not set. | ||
385 | * | 401 | * |
386 | * @param permission Permission to check for | 402 | * @param permission Permission to check for |
387 | * @param defaultValue Value to return if the permission is not set | 403 | * @param defaultValue Value to return if the permission is not set |
@@ -392,8 +408,9 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann | @@ -392,8 +408,9 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann | ||
392 | } | 408 | } |
393 | 409 | ||
394 | /** | 410 | /** |
395 | - * Get the value of the specified permission for the specified mod. The permission will be prefixed with "mod.<modname>." | ||
396 | - * in keeping with registerModPermission as a convenience. | 411 | + * Get the value of the specified permission for the specified mod. The |
412 | + * permission will be prefixed with <tt>"mod.<modname>."</tt> in keeping | ||
413 | + * with registerModPermission as a convenience. | ||
397 | * | 414 | * |
398 | * @param mod | 415 | * @param mod |
399 | * @param permission | 416 | * @param permission |
@@ -413,8 +430,9 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann | @@ -413,8 +430,9 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann | ||
413 | } | 430 | } |
414 | 431 | ||
415 | /** | 432 | /** |
416 | - * Get the value of the specified permission for the specified mod. The permission will be prefixed with "mod.<modname>." | ||
417 | - * in keeping with registerModPermission as a convenience. | 433 | + * Get the value of the specified permission for the specified mod. The |
434 | + * permission will be prefixed with <tt>"mod.<modname>."</tt> in keeping | ||
435 | + * with registerModPermission as a convenience. | ||
418 | * | 436 | * |
419 | * @param modName | 437 | * @param modName |
420 | * @param permission | 438 | * @param permission |
@@ -426,9 +444,10 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann | @@ -426,9 +444,10 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann | ||
426 | } | 444 | } |
427 | 445 | ||
428 | /** | 446 | /** |
429 | - * Get the value of the specified permission for the specified mod. The permission will be prefixed with "mod.<modname>." | ||
430 | - * in keeping with registerModPermission as a convenience. If the permission does not exist, the specified default value | ||
431 | - * will be returned. | 447 | + * Get the value of the specified permission for the specified mod. The |
448 | + * permission will be prefixed with <tt>"mod.<modname>."</tt> in keeping | ||
449 | + * with registerModPermission as a convenience. If the permission does not | ||
450 | + * exist, the specified default value will be returned. | ||
432 | * | 451 | * |
433 | * @param mod | 452 | * @param mod |
434 | * @param permission | 453 | * @param permission |
@@ -449,8 +468,9 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann | @@ -449,8 +468,9 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann | ||
449 | } | 468 | } |
450 | 469 | ||
451 | /** | 470 | /** |
452 | - * Get the value of the specified permission for the specified mod. The permission will be prefixed with "mod.<modname>." | ||
453 | - * in keeping with registerModPermission as a convenience. | 471 | + * Get the value of the specified permission for the specified mod. The |
472 | + * permission will be prefixed with <tt>"mod.<modname>."</tt> in keeping | ||
473 | + * with registerModPermission as a convenience. | ||
454 | * | 474 | * |
455 | * @param modName | 475 | * @param modName |
456 | * @param permission | 476 | * @param permission |
src/main/java/com/mumfrey/liteloader/permissions/ReplicatedPermissions.java
1 | package com.mumfrey.liteloader.permissions; | 1 | package com.mumfrey.liteloader.permissions; |
2 | 2 | ||
3 | /** | 3 | /** |
4 | - * Represents a set of permissions assigned by a remote authority such as a server | 4 | + * Represents a set of permissions assigned by a remote authority such as a |
5 | + * server. | ||
5 | * | 6 | * |
6 | * @author Adam Mummery-Smith | 7 | * @author Adam Mummery-Smith |
7 | */ | 8 | */ |
@@ -18,12 +19,14 @@ public interface ReplicatedPermissions extends Permissions | @@ -18,12 +19,14 @@ public interface ReplicatedPermissions extends Permissions | ||
18 | public abstract boolean isValid(); | 19 | public abstract boolean isValid(); |
19 | 20 | ||
20 | /** | 21 | /** |
21 | - * Forcibly invalidate this permission container, forces update at the next opportunity | 22 | + * Forcibly invalidate this permission container, forces update at the next |
23 | + * opportunity. | ||
22 | */ | 24 | */ |
23 | public abstract void invalidate(); | 25 | public abstract void invalidate(); |
24 | 26 | ||
25 | /** | 27 | /** |
26 | - * Temporarily forces the permissions object to be valid to prevent repeated revalidation | 28 | + * Temporarily forces the permissions object to be valid to prevent repeated |
29 | + * revalidation. | ||
27 | */ | 30 | */ |
28 | public abstract void notifyRefreshPending(); | 31 | public abstract void notifyRefreshPending(); |
29 | } | 32 | } |
src/main/java/com/mumfrey/liteloader/permissions/ServerPermissions.java
@@ -39,12 +39,12 @@ public class ServerPermissions implements ReplicatedPermissions | @@ -39,12 +39,12 @@ public class ServerPermissions implements ReplicatedPermissions | ||
39 | /** | 39 | /** |
40 | * Time to cache server responses by default | 40 | * Time to cache server responses by default |
41 | */ | 41 | */ |
42 | - protected long cacheTime = 10L * 60L * 1000L; // 10 minutes | 42 | + protected long cacheTime = 10L * 60L * 1000L; // 10 minutes |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * Time to wait when refreshing server permissions before trying again | 45 | * Time to wait when refreshing server permissions before trying again |
46 | */ | 46 | */ |
47 | - protected long refreshTime = 15L * 1000L; // 15 seconds | 47 | + protected long refreshTime = 15L * 1000L; // 15 seconds |
48 | 48 | ||
49 | /** | 49 | /** |
50 | * @param data | 50 | * @param data |
@@ -87,7 +87,8 @@ public class ServerPermissions implements ReplicatedPermissions | @@ -87,7 +87,8 @@ public class ServerPermissions implements ReplicatedPermissions | ||
87 | } | 87 | } |
88 | 88 | ||
89 | /* (non-Javadoc) | 89 | /* (non-Javadoc) |
90 | - * @see net.eq2online.permissions.Permissions#getPermissionSet(java.lang.String) | 90 | + * @see net.eq2online.permissions.Permissions#getPermissionSet( |
91 | + * java.lang.String) | ||
91 | */ | 92 | */ |
92 | @Override | 93 | @Override |
93 | public boolean getPermissionSet(String permission) | 94 | public boolean getPermissionSet(String permission) |
@@ -96,7 +97,8 @@ public class ServerPermissions implements ReplicatedPermissions | @@ -96,7 +97,8 @@ public class ServerPermissions implements ReplicatedPermissions | ||
96 | } | 97 | } |
97 | 98 | ||
98 | /* (non-Javadoc) | 99 | /* (non-Javadoc) |
99 | - * @see net.eq2online.permissions.Permissions#getHasPermission(java.lang.String) | 100 | + * @see net.eq2online.permissions.Permissions#getHasPermission( |
101 | + * java.lang.String) | ||
100 | */ | 102 | */ |
101 | @Override | 103 | @Override |
102 | public boolean getHasPermission(String permission) | 104 | public boolean getHasPermission(String permission) |
@@ -106,7 +108,8 @@ public class ServerPermissions implements ReplicatedPermissions | @@ -106,7 +108,8 @@ public class ServerPermissions implements ReplicatedPermissions | ||
106 | } | 108 | } |
107 | 109 | ||
108 | /* (non-Javadoc) | 110 | /* (non-Javadoc) |
109 | - * @see net.eq2online.permissions.Permissions#getHasPermission(java.lang.String, boolean) | 111 | + * @see net.eq2online.permissions.Permissions#getHasPermission( |
112 | + * java.lang.String, boolean) | ||
110 | */ | 113 | */ |
111 | @Override | 114 | @Override |
112 | public boolean getHasPermission(String permission, boolean defaultValue) | 115 | public boolean getHasPermission(String permission, boolean defaultValue) |
src/main/java/com/mumfrey/liteloader/transformers/AppendInsns.java
@@ -6,8 +6,8 @@ import java.lang.annotation.RetentionPolicy; | @@ -6,8 +6,8 @@ import java.lang.annotation.RetentionPolicy; | ||
6 | import java.lang.annotation.Target; | 6 | import java.lang.annotation.Target; |
7 | 7 | ||
8 | /** | 8 | /** |
9 | - * Annotation which instructs the ClassOverlayTransformer to append instructions from the annotated | ||
10 | - * method to the target method. | 9 | + * Annotation which instructs the ClassOverlayTransformer to append instructions |
10 | + * from the annotated method to the target method. | ||
11 | * | 11 | * |
12 | * @author Adam Mummery-Smith | 12 | * @author Adam Mummery-Smith |
13 | */ | 13 | */ |
src/main/java/com/mumfrey/liteloader/transformers/ByteCodeUtilities.java
@@ -35,7 +35,8 @@ public abstract class ByteCodeUtilities | @@ -35,7 +35,8 @@ public abstract class ByteCodeUtilities | ||
35 | private ByteCodeUtilities() {} | 35 | private ByteCodeUtilities() {} |
36 | 36 | ||
37 | /** | 37 | /** |
38 | - * Replace all constructor invokations for the target class in the supplied classNode with invokations of the replacement class | 38 | + * Replace all constructor invocations for the target class in the supplied |
39 | + * classNode with invocations of the replacement class. | ||
39 | * | 40 | * |
40 | * @param classNode Class to search in | 41 | * @param classNode Class to search in |
41 | * @param target Target type | 42 | * @param target Target type |
@@ -50,7 +51,8 @@ public abstract class ByteCodeUtilities | @@ -50,7 +51,8 @@ public abstract class ByteCodeUtilities | ||
50 | } | 51 | } |
51 | 52 | ||
52 | /** | 53 | /** |
53 | - * Replace all constructor invokations for the target class in the supplied method with invokations of the replacement class | 54 | + * Replace all constructor invocations for the target class in the supplied |
55 | + * method with invocations of the replacement class. | ||
54 | * | 56 | * |
55 | * @param method Method to look in | 57 | * @param method Method to look in |
56 | * @param target Target type | 58 | * @param target Target type |
@@ -82,7 +84,8 @@ public abstract class ByteCodeUtilities | @@ -82,7 +84,8 @@ public abstract class ByteCodeUtilities | ||
82 | } | 84 | } |
83 | 85 | ||
84 | /** | 86 | /** |
85 | - * Injects appropriate LOAD opcodes into the supplied InsnList appropriate for each entry in the args array starting at pos | 87 | + * Injects appropriate LOAD opcodes into the supplied InsnList appropriate |
88 | + * for each entry in the args array starting at pos. | ||
86 | * | 89 | * |
87 | * @param args Argument types | 90 | * @param args Argument types |
88 | * @param insns Instruction List to inject into | 91 | * @param insns Instruction List to inject into |
@@ -94,7 +97,8 @@ public abstract class ByteCodeUtilities | @@ -94,7 +97,8 @@ public abstract class ByteCodeUtilities | ||
94 | } | 97 | } |
95 | 98 | ||
96 | /** | 99 | /** |
97 | - * Injects appropriate LOAD opcodes into the supplied InsnList appropriate for each entry in the args array starting at start and ending at end | 100 | + * Injects appropriate LOAD opcodes into the supplied InsnList appropriate |
101 | + * for each entry in the args array starting at start and ending at end. | ||
98 | * | 102 | * |
99 | * @param args Argument types | 103 | * @param args Argument types |
100 | * @param insns Instruction List to inject into | 104 | * @param insns Instruction List to inject into |
@@ -114,9 +118,11 @@ public abstract class ByteCodeUtilities | @@ -114,9 +118,11 @@ public abstract class ByteCodeUtilities | ||
114 | } | 118 | } |
115 | 119 | ||
116 | /** | 120 | /** |
117 | - * Injects appropriate LOAD opcodes into the supplied InsnList for each entry in the supplied locals array starting at pos | 121 | + * Injects appropriate LOAD opcodes into the supplied InsnList for each |
122 | + * entry in the supplied locals array starting at pos. | ||
118 | * | 123 | * |
119 | - * @param locals Local types (can contain nulls for uninitialised, TOP, or RETURN values in locals) | 124 | + * @param locals Local types (can contain nulls for uninitialised, TOP, or |
125 | + * RETURN values in locals) | ||
120 | * @param insns Instruction List to inject into | 126 | * @param insns Instruction List to inject into |
121 | * @param pos Start position | 127 | * @param pos Start position |
122 | */ | 128 | */ |
@@ -132,11 +138,14 @@ public abstract class ByteCodeUtilities | @@ -132,11 +138,14 @@ public abstract class ByteCodeUtilities | ||
132 | } | 138 | } |
133 | 139 | ||
134 | /** | 140 | /** |
135 | - * Get the first variable index in the supplied method which is not an argument or "this" reference, this corresponds | ||
136 | - * to the size of the arguments passed in to the method plus an extra spot for "this" if the method is non-static | 141 | + * Get the first variable index in the supplied method which is not an |
142 | + * argument or "this" reference, this corresponds to the size of the | ||
143 | + * arguments passed in to the method plus an extra spot for "this" if the | ||
144 | + * method is non-static. | ||
137 | * | 145 | * |
138 | * @param method MethodNode to inspect | 146 | * @param method MethodNode to inspect |
139 | - * @return first available local index which is NOT used by a method argument or "this" | 147 | + * @return first available local index which is NOT used by a method |
148 | + * argument or "this" | ||
140 | */ | 149 | */ |
141 | public static int getFirstNonArgLocalIndex(MethodNode method) | 150 | public static int getFirstNonArgLocalIndex(MethodNode method) |
142 | { | 151 | { |
@@ -144,12 +153,16 @@ public abstract class ByteCodeUtilities | @@ -144,12 +153,16 @@ public abstract class ByteCodeUtilities | ||
144 | } | 153 | } |
145 | 154 | ||
146 | /** | 155 | /** |
147 | - * Get the first non-arg variable index based on the supplied arg array and whether to include the "this" reference, | ||
148 | - * this corresponds to the size of the arguments passed in to the method plus an extra spot for "this" is specified | ||
149 | - | 156 | + * Get the first non-arg variable index based on the supplied arg array and |
157 | + * whether to include the "this" reference, this corresponds to the size of | ||
158 | + * the arguments passed in to the method plus an extra spot for "this" is | ||
159 | + * specified. | ||
160 | + * | ||
150 | * @param args Method arguments | 161 | * @param args Method arguments |
151 | - * @param includeThis Whether to include a slot for "this" (generally true for all non-static methods) | ||
152 | - * @return first available local index which is NOT used by a method argument or "this" | 162 | + * @param includeThis Whether to include a slot for "this" (generally true |
163 | + * for all non-static methods) | ||
164 | + * @return first available local index which is NOT used by a method | ||
165 | + * argument or "this" | ||
153 | */ | 166 | */ |
154 | public static int getFirstNonArgLocalIndex(Type[] args, boolean includeThis) | 167 | public static int getFirstNonArgLocalIndex(Type[] args, boolean includeThis) |
155 | { | 168 | { |
@@ -157,7 +170,8 @@ public abstract class ByteCodeUtilities | @@ -157,7 +170,8 @@ public abstract class ByteCodeUtilities | ||
157 | } | 170 | } |
158 | 171 | ||
159 | /** | 172 | /** |
160 | - * Get the size of the specified args array in local variable terms (eg. doubles and longs take two spaces) | 173 | + * Get the size of the specified args array in local variable terms (eg. |
174 | + * doubles and longs take two spaces). | ||
161 | * | 175 | * |
162 | * @param args Method argument types as array | 176 | * @param args Method argument types as array |
163 | * @return size of the specified arguments array in terms of stack slots | 177 | * @return size of the specified arguments array in terms of stack slots |
@@ -175,32 +189,47 @@ public abstract class ByteCodeUtilities | @@ -175,32 +189,47 @@ public abstract class ByteCodeUtilities | ||
175 | } | 189 | } |
176 | 190 | ||
177 | /** | 191 | /** |
178 | - * Attempts to identify available locals at an arbitrary point in the bytecode specified by node. | 192 | + * Attempts to identify available locals at an arbitrary point in the |
193 | + * bytecode specified by node. | ||
179 | * | 194 | * |
180 | - * This method builds an approximate view of the locals available at an arbitrary point in the bytecode by examining the following | ||
181 | - * features in the bytecode: | 195 | + * <p>This method builds an approximate view of the locals available at an |
196 | + * arbitrary point in the bytecode by examining the following features in | ||
197 | + * the bytecode:</p> | ||
182 | * | 198 | * |
183 | - * * Any available stack map frames | ||
184 | - * * STORE opcodes | ||
185 | - * * The local variable table | 199 | + * <ul> |
200 | + * <li>Any available stack map frames</li> | ||
201 | + * <li>STORE opcodes</li> | ||
202 | + * <li>The local variable table</li> | ||
203 | + * </ul> | ||
186 | * | 204 | * |
187 | - * Inference proceeds by walking the bytecode from the start of the method looking for stack frames and STORE opcodes. When either | ||
188 | - * of these is encountered, an attempt is made to cross-reference the values in the stack map or STORE opcode with the value in the | ||
189 | - * local variable table which covers the code range. Stack map frames overwrite the entire simulated local variable table with their | ||
190 | - * own value types, STORE opcodes overwrite only the local slot to which they pertain. Values in the simulated locals array are spaced | ||
191 | - * according to their size (unlike the representation in FrameNode) and this TOP, NULL and UNINTITIALIZED_THIS opcodes will be | ||
192 | - * represented as null values in the simulated frame. | 205 | + * <p>Inference proceeds by walking the bytecode from the start of the |
206 | + * method looking for stack frames and STORE opcodes. When either of these | ||
207 | + * is encountered, an attempt is made to cross-reference the values in the | ||
208 | + * stack map or STORE opcode with the value in the local variable table | ||
209 | + * which covers the code range. Stack map frames overwrite the entire | ||
210 | + * simulated local variable table with their own value types, STORE opcodes | ||
211 | + * overwrite only the local slot to which they pertain. Values in the | ||
212 | + * simulated locals array are spaced according to their size (unlike the | ||
213 | + * representation in FrameNode) and this TOP, NULL and UNINTITIALIZED_THIS | ||
214 | + * opcodes will be represented as null values in the simulated frame.</p> | ||
193 | * | 215 | * |
194 | - * This code does not currently simulate the prescribed JVM behaviour where overwriting the second slot of a DOUBLE or LONG actually | ||
195 | - * invalidates the DOUBLE or LONG stored in the previous location, so we have to hope (for now) that this behaviour isn't emitted by | ||
196 | - * the compiler or any upstream transformers. I may have to re-think this strategy if this situation is encountered in the wild. | 216 | + * <p>This code does not currently simulate the prescribed JVM behaviour |
217 | + * where overwriting the second slot of a DOUBLE or LONG actually | ||
218 | + * invalidates the DOUBLE or LONG stored in the previous location, so we | ||
219 | + * have to hope (for now) that this behaviour isn't emitted by the compiler | ||
220 | + * or any upstream transformers. I may have to re-think this strategy if | ||
221 | + * this situation is encountered in the wild.</p> | ||
197 | * | 222 | * |
198 | - * @param classNode ClassNode containing the method, used to initialise the implicit "this" reference in simple methods with no stack frames | 223 | + * @param classNode ClassNode containing the method, used to initialise the |
224 | + * implicit "this" reference in simple methods with no stack frames | ||
199 | * @param method MethodNode to explore | 225 | * @param method MethodNode to explore |
200 | - * @param node Node indicating the position at which to determine the locals state. The locals will be enumerated UP TO the specified | ||
201 | - * node, so bear in mind that if the specified node is itself a STORE opcode, then we will be looking at the state of the locals | ||
202 | - * PRIOR to its invokation | ||
203 | - * @return A sparse array containing a view (hopefully) of the locals at the specified location | 226 | + * @param node Node indicating the position at which to determine the locals |
227 | + * state. The locals will be enumerated UP TO the specified node, so | ||
228 | + * bear in mind that if the specified node is itself a STORE opcode, | ||
229 | + * then we will be looking at the state of the locals PRIOR to its | ||
230 | + * invocation | ||
231 | + * @return A sparse array containing a view (hopefully) of the locals at the | ||
232 | + * specified location | ||
204 | */ | 233 | */ |
205 | public static LocalVariableNode[] getLocalsAt(ClassNode classNode, MethodNode method, AbstractInsnNode node) | 234 | public static LocalVariableNode[] getLocalsAt(ClassNode classNode, MethodNode method, AbstractInsnNode node) |
206 | { | 235 | { |
@@ -250,7 +279,8 @@ public abstract class ByteCodeUtilities | @@ -250,7 +279,8 @@ public abstract class ByteCodeUtilities | ||
250 | } | 279 | } |
251 | else | 280 | else |
252 | { | 281 | { |
253 | - throw new RuntimeException("Unrecognised locals opcode " + localType + " in locals array at position " + localPos + " in " + classNode.name + "." + method.name + method.desc); | 282 | + throw new RuntimeException("Unrecognised locals opcode " + localType + " in locals array at position " + localPos + " in " |
283 | + + classNode.name + "." + method.name + method.desc); | ||
254 | } | 284 | } |
255 | } | 285 | } |
256 | else if (localType == null) | 286 | else if (localType == null) |
@@ -259,7 +289,8 @@ public abstract class ByteCodeUtilities | @@ -259,7 +289,8 @@ public abstract class ByteCodeUtilities | ||
259 | } | 289 | } |
260 | else | 290 | else |
261 | { | 291 | { |
262 | - throw new RuntimeException("Invalid value " + localType + " in locals array at position " + localPos + " in " + classNode.name + "." + method.name + method.desc); | 292 | + throw new RuntimeException("Invalid value " + localType + " in locals array at position " + localPos + " in " + classNode.name |
293 | + + "." + method.name + method.desc); | ||
263 | } | 294 | } |
264 | } | 295 | } |
265 | } | 296 | } |
@@ -278,14 +309,16 @@ public abstract class ByteCodeUtilities | @@ -278,14 +309,16 @@ public abstract class ByteCodeUtilities | ||
278 | } | 309 | } |
279 | 310 | ||
280 | /** | 311 | /** |
281 | - * Attempts to locate the appropriate entry in the local variable table for the specified local variable index at the location | ||
282 | - * specified by node. | 312 | + * Attempts to locate the appropriate entry in the local variable table for |
313 | + * the specified local variable index at the location specified by node. | ||
283 | * | 314 | * |
284 | * @param classNode Containing class | 315 | * @param classNode Containing class |
285 | * @param method Method | 316 | * @param method Method |
286 | - * @param node Instruction defining the location to get the local variable table at | 317 | + * @param node Instruction defining the location to get the local variable |
318 | + * table at | ||
287 | * @param var Local variable index | 319 | * @param var Local variable index |
288 | - * @return a LocalVariableNode containing information about the local variable at the specified location in the specified local slot | 320 | + * @return a LocalVariableNode containing information about the local |
321 | + * variable at the specified location in the specified local slot | ||
289 | */ | 322 | */ |
290 | public static LocalVariableNode getLocalVariableAt(ClassNode classNode, MethodNode method, AbstractInsnNode node, int var) | 323 | public static LocalVariableNode getLocalVariableAt(ClassNode classNode, MethodNode method, AbstractInsnNode node, int var) |
291 | { | 324 | { |
@@ -309,9 +342,11 @@ public abstract class ByteCodeUtilities | @@ -309,9 +342,11 @@ public abstract class ByteCodeUtilities | ||
309 | } | 342 | } |
310 | 343 | ||
311 | /** | 344 | /** |
312 | - * Fetches or generates the local variable table for the specified method. Since Mojang strip the local variable table | ||
313 | - * as part of the obfuscation process, we need to generate the local variable table when running obfuscated. We cache | ||
314 | - * the generated tables so that we only need to do the relatively expensive calculation once per method we encounter. | 345 | + * Fetches or generates the local variable table for the specified method. |
346 | + * Since Mojang strip the local variable table as part of the obfuscation | ||
347 | + * process, we need to generate the local variable table when running | ||
348 | + * obfuscated. We cache the generated tables so that we only need to do the | ||
349 | + * relatively expensive calculation once per method we encounter. | ||
315 | * | 350 | * |
316 | * @param classNode Containing class | 351 | * @param classNode Containing class |
317 | * @param method Method | 352 | * @param method Method |
@@ -337,7 +372,8 @@ public abstract class ByteCodeUtilities | @@ -337,7 +372,8 @@ public abstract class ByteCodeUtilities | ||
337 | } | 372 | } |
338 | 373 | ||
339 | /** | 374 | /** |
340 | - * Use ASM Analyzer to generate the local variable table for the specified method | 375 | + * Use ASM Analyzer to generate the local variable table for the specified |
376 | + * method. | ||
341 | * | 377 | * |
342 | * @param classNode Containing class | 378 | * @param classNode Containing class |
343 | * @param method Method | 379 | * @param method Method |
@@ -361,7 +397,8 @@ public abstract class ByteCodeUtilities | @@ -361,7 +397,8 @@ public abstract class ByteCodeUtilities | ||
361 | } | 397 | } |
362 | 398 | ||
363 | // Use Analyzer to generate the bytecode frames | 399 | // Use Analyzer to generate the bytecode frames |
364 | - Analyzer<BasicValue> analyzer = new Analyzer<BasicValue>(new SimpleVerifier(Type.getObjectType(classNode.name), objectType, interfaces, false)); | 400 | + Analyzer<BasicValue> analyzer = new Analyzer<BasicValue>(new SimpleVerifier(Type.getObjectType(classNode.name), |
401 | + objectType, interfaces, false)); | ||
365 | try | 402 | try |
366 | { | 403 | { |
367 | analyzer.analyze(classNode.name, method); | 404 | analyzer.analyze(classNode.name, method); |
@@ -456,10 +493,11 @@ public abstract class ByteCodeUtilities | @@ -456,10 +493,11 @@ public abstract class ByteCodeUtilities | ||
456 | } | 493 | } |
457 | 494 | ||
458 | /** | 495 | /** |
459 | - * Get the source code name for the specified type | 496 | + * Get the source code name for the specified type. |
460 | * | 497 | * |
461 | * @param type Type to generate a friendly name for | 498 | * @param type Type to generate a friendly name for |
462 | - * @return String representation of the specified type, eg "int" for an integer primitive or "String" for java.lang.String | 499 | + * @return String representation of the specified type, eg "int" for an |
500 | + * integer primitive or "String" for java.lang.String | ||
463 | */ | 501 | */ |
464 | public static String getTypeName(Type type) | 502 | public static String getTypeName(Type type) |
465 | { | 503 | { |
@@ -485,7 +523,8 @@ public abstract class ByteCodeUtilities | @@ -485,7 +523,8 @@ public abstract class ByteCodeUtilities | ||
485 | } | 523 | } |
486 | 524 | ||
487 | /** | 525 | /** |
488 | - * Finds a method in the target class, uses names specified in the {@link Obfuscated} annotation if present | 526 | + * Finds a method in the target class, uses names specified in the |
527 | + * {@link Obfuscated} annotation if present. | ||
489 | * | 528 | * |
490 | * @param targetClass Class to search in | 529 | * @param targetClass Class to search in |
491 | * @param searchFor Method to search for | 530 | * @param searchFor Method to search for |
@@ -495,7 +534,9 @@ public abstract class ByteCodeUtilities | @@ -495,7 +534,9 @@ public abstract class ByteCodeUtilities | ||
495 | for (MethodNode target : targetClass.methods) | 534 | for (MethodNode target : targetClass.methods) |
496 | { | 535 | { |
497 | if (target.name.equals(searchFor.name) && target.desc.equals(searchFor.desc)) | 536 | if (target.name.equals(searchFor.name) && target.desc.equals(searchFor.desc)) |
537 | + { | ||
498 | return target; | 538 | return target; |
539 | + } | ||
499 | } | 540 | } |
500 | 541 | ||
501 | AnnotationNode obfuscatedAnnotation = ByteCodeUtilities.getVisibleAnnotation(searchFor, Obfuscated.class); | 542 | AnnotationNode obfuscatedAnnotation = ByteCodeUtilities.getVisibleAnnotation(searchFor, Obfuscated.class); |
@@ -506,7 +547,9 @@ public abstract class ByteCodeUtilities | @@ -506,7 +547,9 @@ public abstract class ByteCodeUtilities | ||
506 | for (MethodNode target : targetClass.methods) | 547 | for (MethodNode target : targetClass.methods) |
507 | { | 548 | { |
508 | if (target.name.equals(obfuscatedName) && target.desc.equals(searchFor.desc)) | 549 | if (target.name.equals(obfuscatedName) && target.desc.equals(searchFor.desc)) |
550 | + { | ||
509 | return target; | 551 | return target; |
552 | + } | ||
510 | } | 553 | } |
511 | } | 554 | } |
512 | } | 555 | } |
@@ -515,7 +558,8 @@ public abstract class ByteCodeUtilities | @@ -515,7 +558,8 @@ public abstract class ByteCodeUtilities | ||
515 | } | 558 | } |
516 | 559 | ||
517 | /** | 560 | /** |
518 | - * Finds a field in the target class, uses names specified in the {@link Obfuscated} annotation if present | 561 | + * Finds a field in the target class, uses names specified in the |
562 | + * {@link Obfuscated} annotation if present | ||
519 | * | 563 | * |
520 | * @param targetClass Class to search in | 564 | * @param targetClass Class to search in |
521 | * @param searchFor Field to search for | 565 | * @param searchFor Field to search for |
@@ -525,7 +569,9 @@ public abstract class ByteCodeUtilities | @@ -525,7 +569,9 @@ public abstract class ByteCodeUtilities | ||
525 | for (FieldNode target : targetClass.fields) | 569 | for (FieldNode target : targetClass.fields) |
526 | { | 570 | { |
527 | if (target.name.equals(searchFor.name)) | 571 | if (target.name.equals(searchFor.name)) |
572 | + { | ||
528 | return target; | 573 | return target; |
574 | + } | ||
529 | } | 575 | } |
530 | 576 | ||
531 | AnnotationNode obfuscatedAnnotation = ByteCodeUtilities.getVisibleAnnotation(searchFor, Obfuscated.class); | 577 | AnnotationNode obfuscatedAnnotation = ByteCodeUtilities.getVisibleAnnotation(searchFor, Obfuscated.class); |
@@ -536,7 +582,9 @@ public abstract class ByteCodeUtilities | @@ -536,7 +582,9 @@ public abstract class ByteCodeUtilities | ||
536 | for (FieldNode target : targetClass.fields) | 582 | for (FieldNode target : targetClass.fields) |
537 | { | 583 | { |
538 | if (target.name.equals(obfuscatedName)) | 584 | if (target.name.equals(obfuscatedName)) |
585 | + { | ||
539 | return target; | 586 | return target; |
587 | + } | ||
540 | } | 588 | } |
541 | } | 589 | } |
542 | } | 590 | } |
@@ -545,7 +593,8 @@ public abstract class ByteCodeUtilities | @@ -545,7 +593,8 @@ public abstract class ByteCodeUtilities | ||
545 | } | 593 | } |
546 | 594 | ||
547 | /** | 595 | /** |
548 | - * Find a method in the target class which matches the specified method name and descriptor | 596 | + * Find a method in the target class which matches the specified method name |
597 | + * and descriptor | ||
549 | * | 598 | * |
550 | * @param classNode | 599 | * @param classNode |
551 | * @param searchFor | 600 | * @param searchFor |
@@ -558,7 +607,9 @@ public abstract class ByteCodeUtilities | @@ -558,7 +607,9 @@ public abstract class ByteCodeUtilities | ||
558 | for (MethodNode method : classNode.methods) | 607 | for (MethodNode method : classNode.methods) |
559 | { | 608 | { |
560 | if (searchFor.matches(method.name, ordinal++) && method.desc.equals(desc)) | 609 | if (searchFor.matches(method.name, ordinal++) && method.desc.equals(desc)) |
610 | + { | ||
561 | return method; | 611 | return method; |
612 | + } | ||
562 | } | 613 | } |
563 | 614 | ||
564 | return null; | 615 | return null; |
@@ -577,7 +628,9 @@ public abstract class ByteCodeUtilities | @@ -577,7 +628,9 @@ public abstract class ByteCodeUtilities | ||
577 | for (FieldNode field : classNode.fields) | 628 | for (FieldNode field : classNode.fields) |
578 | { | 629 | { |
579 | if (searchFor.matches(field.name, ordinal++)) | 630 | if (searchFor.matches(field.name, ordinal++)) |
631 | + { | ||
580 | return field; | 632 | return field; |
633 | + } | ||
581 | } | 634 | } |
582 | 635 | ||
583 | return null; | 636 | return null; |
@@ -687,7 +740,8 @@ public abstract class ByteCodeUtilities | @@ -687,7 +740,8 @@ public abstract class ByteCodeUtilities | ||
687 | } | 740 | } |
688 | 741 | ||
689 | /** | 742 | /** |
690 | - * Get an annotation of the specified class from the supplied list of annotations, returns null if no matching annotation was found | 743 | + * Get an annotation of the specified class from the supplied list of |
744 | + * annotations, returns null if no matching annotation was found | ||
691 | */ | 745 | */ |
692 | public static AnnotationNode getAnnotation(List<AnnotationNode> annotations, String annotationType) | 746 | public static AnnotationNode getAnnotation(List<AnnotationNode> annotations, String annotationType) |
693 | { | 747 | { |
@@ -696,7 +750,9 @@ public abstract class ByteCodeUtilities | @@ -696,7 +750,9 @@ public abstract class ByteCodeUtilities | ||
696 | for (AnnotationNode annotation : annotations) | 750 | for (AnnotationNode annotation : annotations) |
697 | { | 751 | { |
698 | if (annotationType.equals(annotation.desc)) | 752 | if (annotationType.equals(annotation.desc)) |
753 | + { | ||
699 | return annotation; | 754 | return annotation; |
755 | + } | ||
700 | } | 756 | } |
701 | } | 757 | } |
702 | 758 | ||
@@ -723,7 +779,9 @@ public abstract class ByteCodeUtilities | @@ -723,7 +779,9 @@ public abstract class ByteCodeUtilities | ||
723 | public static <T> T getAnnotationValue(AnnotationNode annotation, String key) | 779 | public static <T> T getAnnotationValue(AnnotationNode annotation, String key) |
724 | { | 780 | { |
725 | if (annotation == null || annotation.values == null) | 781 | if (annotation == null || annotation.values == null) |
782 | + { | ||
726 | return null; | 783 | return null; |
784 | + } | ||
727 | 785 | ||
728 | boolean getNextValue = false; | 786 | boolean getNextValue = false; |
729 | for (Object value : annotation.values) | 787 | for (Object value : annotation.values) |
@@ -768,7 +826,7 @@ public abstract class ByteCodeUtilities | @@ -768,7 +826,7 @@ public abstract class ByteCodeUtilities | ||
768 | */ | 826 | */ |
769 | public static String generateDescriptor(int obfType, Object returnType, Object... args) | 827 | public static String generateDescriptor(int obfType, Object returnType, Object... args) |
770 | { | 828 | { |
771 | - StringBuilder sb = new StringBuilder().append('(');; | 829 | + StringBuilder sb = new StringBuilder().append('('); |
772 | 830 | ||
773 | for (Object arg : args) | 831 | for (Object arg : args) |
774 | { | 832 | { |
src/main/java/com/mumfrey/liteloader/transformers/Callback.java
@@ -18,36 +18,37 @@ public class Callback | @@ -18,36 +18,37 @@ public class Callback | ||
18 | public enum CallbackType | 18 | public enum CallbackType |
19 | { | 19 | { |
20 | /** | 20 | /** |
21 | - * Redirect callbacks are injected at the start of a method and immediately return, thus | ||
22 | - * short-circuiting the method | 21 | + * Redirect callbacks are injected at the start of a method and |
22 | + * immediately return, thus short-circuiting the method | ||
23 | */ | 23 | */ |
24 | REDIRECT(true), | 24 | REDIRECT(true), |
25 | 25 | ||
26 | /** | 26 | /** |
27 | - * Event callbacks are injected at the start of a method but do not alter the normal method | ||
28 | - * behaviour. | 27 | + * Event callbacks are injected at the start of a method but do not |
28 | + * alter the normal method behaviour. | ||
29 | */ | 29 | */ |
30 | EVENT(false), | 30 | EVENT(false), |
31 | 31 | ||
32 | /** | 32 | /** |
33 | - * Return callbacks are injected immediately prior to every RETURN opcode in a particular | ||
34 | - * method. Callback handlers must have the SAME return type as the method containing the | ||
35 | - * injected callback | 33 | + * Return callbacks are injected immediately prior to every RETURN |
34 | + * opcode in a particular method. Callback handlers must have the SAME | ||
35 | + * return type as the method containing the injected callback | ||
36 | */ | 36 | */ |
37 | RETURN(false), | 37 | RETURN(false), |
38 | 38 | ||
39 | /** | 39 | /** |
40 | - * A profiler callback injected at a profiler "startSection" invokation | 40 | + * A profiler callback injected at a profiler "startSection" invocation |
41 | */ | 41 | */ |
42 | PROFILER_STARTSECTION(Obf.startSection, true), | 42 | PROFILER_STARTSECTION(Obf.startSection, true), |
43 | 43 | ||
44 | /** | 44 | /** |
45 | - * A profiler callback injected at a profiler "endSection" invokation | 45 | + * A profiler callback injected at a profiler "endSection" invocation |
46 | */ | 46 | */ |
47 | PROFILER_ENDSECTION(Obf.endSection, false), | 47 | PROFILER_ENDSECTION(Obf.endSection, false), |
48 | 48 | ||
49 | /** | 49 | /** |
50 | - * A profiler callback injected at a profiler "endStartSection" invokation | 50 | + * A profiler callback injected at a profiler "endStartSection" |
51 | + * invocation | ||
51 | */ | 52 | */ |
52 | PROFILER_ENDSTARTSECTION(Obf.endStartSection, true); | 53 | PROFILER_ENDSTARTSECTION(Obf.endStartSection, true); |
53 | 54 | ||
@@ -149,9 +150,10 @@ public class Callback | @@ -149,9 +150,10 @@ public class Callback | ||
149 | private final String callbackMethod; | 150 | private final String callbackMethod; |
150 | 151 | ||
151 | /** | 152 | /** |
152 | - * Return callbacks are injected before every RETURN opcode in the method, each RETURN is thus allocated | ||
153 | - * a sequential refNumber which is passed to the callback method so that the callback handler can choose | ||
154 | - * which RETURN it wishes to handle | 153 | + * Return callbacks are injected before every RETURN opcode in the method, |
154 | + * each RETURN is thus allocated a sequential refNumber which is passed to | ||
155 | + * the callback method so that the callback handler can choose which RETURN | ||
156 | + * it wishes to handle. | ||
155 | */ | 157 | */ |
156 | int refNumber; | 158 | int refNumber; |
157 | 159 | ||
@@ -168,14 +170,18 @@ public class Callback | @@ -168,14 +170,18 @@ public class Callback | ||
168 | /** | 170 | /** |
169 | * A new callback method in the specified class | 171 | * A new callback method in the specified class |
170 | * | 172 | * |
171 | - * @param callbackMethod Method to call, must be public, static and have the appropriate signature for the type of injected callback | ||
172 | - * @param callbackClass Fully qualified name of the class containing the callback method, must also be public or visible from the calling package | 173 | + * @param callbackMethod Method to call, must be public, static and have the |
174 | + * appropriate signature for the type of injected callback | ||
175 | + * @param callbackClass Fully qualified name of the class containing the | ||
176 | + * callback method, must also be public or visible from the calling | ||
177 | + * package | ||
173 | */ | 178 | */ |
174 | public Callback(CallbackType callbackType, String callbackMethod, String callbackClass, String section, int obfType) | 179 | public Callback(CallbackType callbackType, String callbackMethod, String callbackClass, String section, int obfType) |
175 | { | 180 | { |
176 | if (section == null && callbackType.isSectionRequired()) | 181 | if (section == null && callbackType.isSectionRequired()) |
177 | { | 182 | { |
178 | - throw new RuntimeException(String.format("Callback of type %s requires a section name but no section name was provided", callbackType.name())); | 183 | + throw new RuntimeException(String.format("Callback of type %s requires a section name but no section name was provided", |
184 | + callbackType.name())); | ||
179 | } | 185 | } |
180 | 186 | ||
181 | this.callbackType = callbackType; | 187 | this.callbackType = callbackType; |
@@ -250,7 +256,7 @@ public class Callback | @@ -250,7 +256,7 @@ public class Callback | ||
250 | public List<Callback> getChainedCallbacks() | 256 | public List<Callback> getChainedCallbacks() |
251 | { | 257 | { |
252 | return this.chainedCallbacks; | 258 | return this.chainedCallbacks; |
253 | - } | 259 | + } |
254 | 260 | ||
255 | @Override | 261 | @Override |
256 | public String toString() | 262 | public String toString() |
@@ -263,7 +269,8 @@ public class Callback | @@ -263,7 +269,8 @@ public class Callback | ||
263 | { | 269 | { |
264 | if (other == null || !(other instanceof Callback)) return false; | 270 | if (other == null || !(other instanceof Callback)) return false; |
265 | Callback callback = (Callback)other; | 271 | Callback callback = (Callback)other; |
266 | - return callback.callbackClass.equals(this.callbackClass) && callback.callbackMethod.equals(this.callbackMethod) && callback.callbackType == this.callbackType; | 272 | + return callback.callbackClass.equals(this.callbackClass) && callback.callbackMethod.equals(this.callbackMethod) |
273 | + && callback.callbackType == this.callbackType; | ||
267 | } | 274 | } |
268 | 275 | ||
269 | @Override | 276 | @Override |
src/main/java/com/mumfrey/liteloader/transformers/CallbackInjectionTransformer.java
@@ -22,7 +22,8 @@ import com.mumfrey.liteloader.transformers.Callback.CallbackType; | @@ -22,7 +22,8 @@ import com.mumfrey.liteloader.transformers.Callback.CallbackType; | ||
22 | import com.mumfrey.liteloader.util.log.LiteLoaderLogger; | 22 | import com.mumfrey.liteloader.util.log.LiteLoaderLogger; |
23 | 23 | ||
24 | /** | 24 | /** |
25 | - * Transformer which injects callbacks by searching for profiler invokations and RETURN opcodes | 25 | + * Transformer which injects callbacks by searching for profiler invocations |
26 | + * and RETURN opcodes. | ||
26 | * | 27 | * |
27 | * @author Adam Mummery-Smith | 28 | * @author Adam Mummery-Smith |
28 | * @deprecated Use Event Injection instead | 29 | * @deprecated Use Event Injection instead |
@@ -31,7 +32,7 @@ import com.mumfrey.liteloader.util.log.LiteLoaderLogger; | @@ -31,7 +32,7 @@ import com.mumfrey.liteloader.util.log.LiteLoaderLogger; | ||
31 | public abstract class CallbackInjectionTransformer extends ClassTransformer | 32 | public abstract class CallbackInjectionTransformer extends ClassTransformer |
32 | { | 33 | { |
33 | /** | 34 | /** |
34 | - * Mappings for profiler method invokations | 35 | + * Mappings for profiler method invocations |
35 | */ | 36 | */ |
36 | private Map<String, Map<String, Callback>> profilerCallbackMappings = new HashMap<String, Map<String, Callback>>(); | 37 | private Map<String, Map<String, Callback>> profilerCallbackMappings = new HashMap<String, Map<String, Callback>>(); |
37 | 38 | ||
@@ -65,7 +66,8 @@ public abstract class CallbackInjectionTransformer extends ClassTransformer | @@ -65,7 +66,8 @@ public abstract class CallbackInjectionTransformer extends ClassTransformer | ||
65 | this.profilerCallbackMappings.put(className, new HashMap<String, Callback>()); | 66 | this.profilerCallbackMappings.put(className, new HashMap<String, Callback>()); |
66 | } | 67 | } |
67 | 68 | ||
68 | - String signature = CallbackInjectionTransformer.generateSignature(className, methodName, methodSignature, callback.getProfilerMethod(), callback.getProfilerMethodSignature(), callback.getSectionName()); | 69 | + String signature = CallbackInjectionTransformer.generateSignature(className, methodName, methodSignature, callback.getProfilerMethod(), |
70 | + callback.getProfilerMethodSignature(), callback.getSectionName()); | ||
69 | this.addCallbackMapping(this.profilerCallbackMappings.get(className), signature, callback); | 71 | this.addCallbackMapping(this.profilerCallbackMappings.get(className), signature, callback); |
70 | } | 72 | } |
71 | else | 73 | else |
@@ -94,7 +96,8 @@ public abstract class CallbackInjectionTransformer extends ClassTransformer | @@ -94,7 +96,8 @@ public abstract class CallbackInjectionTransformer extends ClassTransformer | ||
94 | 96 | ||
95 | if (callback.injectReturn() || existingCallback.injectReturn()) | 97 | if (callback.injectReturn() || existingCallback.injectReturn()) |
96 | { | 98 | { |
97 | - String errorMessage = String.format("Callback for %s is already defined for %s, cannot add %s", signature, existingCallback, callback); | 99 | + String errorMessage = String.format("Callback for %s is already defined for %s, cannot add %s", |
100 | + signature, existingCallback, callback); | ||
98 | LiteLoaderLogger.severe(errorMessage); | 101 | LiteLoaderLogger.severe(errorMessage); |
99 | throw new InjectedCallbackCollisionError(errorMessage); | 102 | throw new InjectedCallbackCollisionError(errorMessage); |
100 | } | 103 | } |
@@ -108,7 +111,8 @@ public abstract class CallbackInjectionTransformer extends ClassTransformer | @@ -108,7 +111,8 @@ public abstract class CallbackInjectionTransformer extends ClassTransformer | ||
108 | } | 111 | } |
109 | 112 | ||
110 | /* (non-Javadoc) | 113 | /* (non-Javadoc) |
111 | - * @see net.minecraft.launchwrapper.IClassTransformer#transform(java.lang.String, java.lang.String, byte[]) | 114 | + * @see net.minecraft.launchwrapper.IClassTransformer |
115 | + * #transform(java.lang.String, java.lang.String, byte[]) | ||
112 | */ | 116 | */ |
113 | @Override | 117 | @Override |
114 | public final byte[] transform(String name, String transformedName, byte[] basicClass) | 118 | public final byte[] transform(String name, String transformedName, byte[] basicClass) |
@@ -139,14 +143,16 @@ public abstract class CallbackInjectionTransformer extends ClassTransformer | @@ -139,14 +143,16 @@ public abstract class CallbackInjectionTransformer extends ClassTransformer | ||
139 | 143 | ||
140 | if (mappings != null) | 144 | if (mappings != null) |
141 | { | 145 | { |
142 | - String headSignature = CallbackInjectionTransformer.generateSignature(classNode.name, method.name, method.desc, CallbackType.REDIRECT); | 146 | + String headSignature = CallbackInjectionTransformer.generateSignature(classNode.name, method.name, method.desc, |
147 | + CallbackType.REDIRECT); | ||
143 | if (mappings.containsKey(headSignature)) | 148 | if (mappings.containsKey(headSignature)) |
144 | { | 149 | { |
145 | Callback callback = mappings.get(headSignature); | 150 | Callback callback = mappings.get(headSignature); |
146 | InsnList callbackInsns = this.genCallbackInsns(classType, method, callback); | 151 | InsnList callbackInsns = this.genCallbackInsns(classType, method, callback); |
147 | if (callbackInsns != null) | 152 | if (callbackInsns != null) |
148 | { | 153 | { |
149 | - LiteLoaderLogger.info("Injecting %s callback for %s in class %s", callback.getType().name().toLowerCase(), callback, className); | 154 | + LiteLoaderLogger.info("Injecting %s callback for %s in class %s", callback.getType().name().toLowerCase(), |
155 | + callback, className); | ||
150 | method.instructions.insert(callbackInsns); | 156 | method.instructions.insert(callbackInsns); |
151 | if (callback.injectReturn()) continue; | 157 | if (callback.injectReturn()) continue; |
152 | } | 158 | } |
@@ -171,7 +177,8 @@ public abstract class CallbackInjectionTransformer extends ClassTransformer | @@ -171,7 +177,8 @@ public abstract class CallbackInjectionTransformer extends ClassTransformer | ||
171 | section = ((LdcInsnNode)lastInsn).cst.toString(); | 177 | section = ((LdcInsnNode)lastInsn).cst.toString(); |
172 | } | 178 | } |
173 | 179 | ||
174 | - String signature = CallbackInjectionTransformer.generateSignature(classNode.name, method.name, method.desc, invokeNode.name, invokeNode.desc, section); | 180 | + String signature = CallbackInjectionTransformer.generateSignature(classNode.name, method.name, method.desc, invokeNode.name, |
181 | + invokeNode.desc, section); | ||
175 | 182 | ||
176 | if (profilerMappings.containsKey(signature)) | 183 | if (profilerMappings.containsKey(signature)) |
177 | { | 184 | { |
@@ -181,7 +188,8 @@ public abstract class CallbackInjectionTransformer extends ClassTransformer | @@ -181,7 +188,8 @@ public abstract class CallbackInjectionTransformer extends ClassTransformer | ||
181 | } | 188 | } |
182 | else if (mappings != null && insn.getOpcode() == methodReturnOpcode) | 189 | else if (mappings != null && insn.getOpcode() == methodReturnOpcode) |
183 | { | 190 | { |
184 | - String returnSignature = CallbackInjectionTransformer.generateSignature(classNode.name, method.name, method.desc, CallbackType.RETURN); | 191 | + String returnSignature = CallbackInjectionTransformer.generateSignature(classNode.name, method.name, method.desc, |
192 | + CallbackType.RETURN); | ||
185 | if (mappings.containsKey(returnSignature)) | 193 | if (mappings.containsKey(returnSignature)) |
186 | { | 194 | { |
187 | Callback callback = mappings.get(returnSignature); | 195 | Callback callback = mappings.get(returnSignature); |
@@ -193,7 +201,8 @@ public abstract class CallbackInjectionTransformer extends ClassTransformer | @@ -193,7 +201,8 @@ public abstract class CallbackInjectionTransformer extends ClassTransformer | ||
193 | } | 201 | } |
194 | else | 202 | else |
195 | { | 203 | { |
196 | - LiteLoaderLogger.severe("Skipping callback mapping %s because the return behaviour does not match the method signature", returnSignature); | 204 | + LiteLoaderLogger.severe("Skipping callback mapping %s because the return behaviour does not match the method signature", |
205 | + returnSignature); | ||
197 | } | 206 | } |
198 | } | 207 | } |
199 | } | 208 | } |
@@ -205,7 +214,7 @@ public abstract class CallbackInjectionTransformer extends ClassTransformer | @@ -205,7 +214,7 @@ public abstract class CallbackInjectionTransformer extends ClassTransformer | ||
205 | { | 214 | { |
206 | Callback callback = profilerCallbackNode.getValue(); | 215 | Callback callback = profilerCallbackNode.getValue(); |
207 | 216 | ||
208 | - LiteLoaderLogger.info("Injecting profiler invokation callback for %s in class %s", callback, className); | 217 | + LiteLoaderLogger.info("Injecting profiler invocation callback for %s in class %s", callback, className); |
209 | InsnList injected = this.genProfilerCallbackInsns(new InsnList(), callback, callback.refNumber++); | 218 | InsnList injected = this.genProfilerCallbackInsns(new InsnList(), callback, callback.refNumber++); |
210 | method.instructions.insert(profilerCallbackNode.getKey(), injected); | 219 | method.instructions.insert(profilerCallbackNode.getKey(), injected); |
211 | } | 220 | } |
@@ -234,7 +243,8 @@ public abstract class CallbackInjectionTransformer extends ClassTransformer | @@ -234,7 +243,8 @@ public abstract class CallbackInjectionTransformer extends ClassTransformer | ||
234 | } | 243 | } |
235 | 244 | ||
236 | /** | 245 | /** |
237 | - * Generate bytecode for injecting the specified callback into the specified methodNode | 246 | + * Generate bytecode for injecting the specified callback into the specified |
247 | + * methodNode. | ||
238 | * | 248 | * |
239 | * @param classType | 249 | * @param classType |
240 | * @param methodNode | 250 | * @param methodNode |
@@ -246,7 +256,8 @@ public abstract class CallbackInjectionTransformer extends ClassTransformer | @@ -246,7 +256,8 @@ public abstract class CallbackInjectionTransformer extends ClassTransformer | ||
246 | } | 256 | } |
247 | 257 | ||
248 | /** | 258 | /** |
249 | - * Generate bytecode for injecting the specified callback into the specified methodNode | 259 | + * Generate bytecode for injecting the specified callback into the specified |
260 | + * methodNode. | ||
250 | * | 261 | * |
251 | * @param classType | 262 | * @param classType |
252 | * @param methodNode | 263 | * @param methodNode |
@@ -277,7 +288,7 @@ public abstract class CallbackInjectionTransformer extends ClassTransformer | @@ -277,7 +288,7 @@ public abstract class CallbackInjectionTransformer extends ClassTransformer | ||
277 | String callbackReturnValueArg = methodReturnsVoid ? "" : callbackReturnType.toString(); | 288 | String callbackReturnValueArg = methodReturnsVoid ? "" : callbackReturnType.toString(); |
278 | String classInstanceArg = methodIsStatic ? "" : classType; | 289 | String classInstanceArg = methodIsStatic ? "" : classType; |
279 | 290 | ||
280 | - // If this is a pre-return injection, push the invokation reference onto the call stack | 291 | + // If this is a pre-return injection, push the invocation reference onto the call stack |
281 | if (hasReturnRef) injected.insert(new IntInsnNode(Opcodes.BIPUSH, returnNumber)); | 292 | if (hasReturnRef) injected.insert(new IntInsnNode(Opcodes.BIPUSH, returnNumber)); |
282 | 293 | ||
283 | // If the method is non-static, then we pass in the class instance as an argument | 294 | // If the method is non-static, then we pass in the class instance as an argument |
@@ -292,7 +303,8 @@ public abstract class CallbackInjectionTransformer extends ClassTransformer | @@ -292,7 +303,8 @@ public abstract class CallbackInjectionTransformer extends ClassTransformer | ||
292 | } | 303 | } |
293 | 304 | ||
294 | // Generate the callback method descriptor | 305 | // Generate the callback method descriptor |
295 | - String callbackMethodDesc = String.format("(%s%s%s%s)%s", hasReturnRef ? callbackReturnValueArg : "", hasReturnRef ? "I" : "", classInstanceArg, CallbackInjectionTransformer.getMethodArgs(methodNode), callbackReturnType); | 306 | + String callbackMethodDesc = String.format("(%s%s%s%s)%s", hasReturnRef ? callbackReturnValueArg : "", hasReturnRef ? "I" : "", |
307 | + classInstanceArg, CallbackInjectionTransformer.getMethodArgs(methodNode), callbackReturnType); | ||
296 | 308 | ||
297 | // Add the callback method insn to the injected instructions list | 309 | // Add the callback method insn to the injected instructions list |
298 | injected.add(new MethodInsnNode(Opcodes.INVOKESTATIC, callback.getCallbackClass(), callback.getCallbackMethod(), callbackMethodDesc, false)); | 310 | injected.add(new MethodInsnNode(Opcodes.INVOKESTATIC, callback.getCallbackClass(), callback.getCallbackMethod(), callbackMethodDesc, false)); |
@@ -330,7 +342,8 @@ public abstract class CallbackInjectionTransformer extends ClassTransformer | @@ -330,7 +342,8 @@ public abstract class CallbackInjectionTransformer extends ClassTransformer | ||
330 | * @param invokeSig | 342 | * @param invokeSig |
331 | * @param section | 343 | * @param section |
332 | */ | 344 | */ |
333 | - private static String generateSignature(String className, String methodName, String methodSignature, String invokeName, String invokeSig, String section) | 345 | + private static String generateSignature(String className, String methodName, String methodSignature, |
346 | + String invokeName, String invokeSig, String section) | ||
334 | { | 347 | { |
335 | return String.format("%s::%s%s@%s%s/%s", className.replace('.', '/'), methodName, methodSignature, invokeName, invokeSig, section); | 348 | return String.format("%s::%s%s@%s%s/%s", className.replace('.', '/'), methodName, methodSignature, invokeName, invokeSig, section); |
336 | } | 349 | } |
src/main/java/com/mumfrey/liteloader/transformers/ClassOverlayTransformer.java
@@ -28,46 +28,60 @@ import org.objectweb.asm.tree.MethodNode; | @@ -28,46 +28,60 @@ import org.objectweb.asm.tree.MethodNode; | ||
28 | import com.mumfrey.liteloader.util.log.LiteLoaderLogger; | 28 | import com.mumfrey.liteloader.util.log.LiteLoaderLogger; |
29 | 29 | ||
30 | /** | 30 | /** |
31 | - * This transformer applies one class to another as an "overlay". This works by merging down and replacing all | ||
32 | - * methods and fields from the "overlay" class into the "target" class being transformed. Fields and methods | ||
33 | - * marked with the {@link Obfuscated} annotation will search through the list of provided names to find a | ||
34 | - * matching member in the target class, this allows methods and fields in the target class to be referenced | ||
35 | - * even if they have different names after obfuscation. | 31 | + * This transformer applies one class to another as an "overlay". This works by |
32 | + * merging down and replacing all methods and fields from the "overlay" class | ||
33 | + * into the "target" class being transformed. Fields and methods marked with the | ||
34 | + * {@link Obfuscated} annotation will search through the list of provided names | ||
35 | + * to find a matching member in the target class, this allows methods and fields | ||
36 | + * in the target class to be referenced even if they have different names after | ||
37 | + * obfuscation. | ||
36 | * | 38 | * |
37 | - * The "target" class is identified by a special field which must be named __TARGET in the overlay class which | ||
38 | - * must be a private static field of the appropriate target type. | 39 | + * <p>The "target" class is identified by a special field which must be named |
40 | + * <tt>__TARGET</tt> in the overlay class which must be a private static field | ||
41 | + * of the appropriate target type.</p> | ||
39 | * | 42 | * |
40 | - * Notes: | 43 | + * <h3>Notes:</h3> |
41 | * | 44 | * |
42 | - * - Constructors WILL NOT BE overlaid, see below for instruction merging. Constructors in the overlay class | ||
43 | - * should throw an InstantiationError. | 45 | + * <ul> |
46 | + * <li>Constructors WILL NOT BE overlaid, see below for instruction merging. | ||
47 | + * Constructors in the overlay class should throw an InstantiationError. | ||
48 | + * </li> | ||
44 | * | 49 | * |
45 | - * - Static method invokations will not be processed by "transformMethod", this means that any static methods | ||
46 | - * invoked must be accessible from the context of the transformed class (eg. public or package-private in the | ||
47 | - * same package). | 50 | + * <li>Static method invocations will not be processed by "transformMethod", |
51 | + * this means that any static methods invoked must be accessible from the | ||
52 | + * context of the transformed class (eg. public or package-private in the | ||
53 | + * same package).</li> | ||
48 | * | 54 | * |
49 | - * - The overlay class MUST be a sibling of the target class to ensure that calls to super.xxx are properly | ||
50 | - * transformed. In other words the overlay and the transformed class should have the same parent class | ||
51 | - * although they need not be in the same package unless any package-private members are accessed. | 55 | + * <li>The overlay class MUST be a sibling of the target class to ensure |
56 | + * that calls to super.xxx are properly transformed. In other words the | ||
57 | + * overlay and the transformed class should have the same parent class | ||
58 | + * although they need not be in the same package unless any package-private | ||
59 | + * members are accessed.</li> | ||
52 | * | 60 | * |
53 | - * - It is also possible to merge instructions from a "source" method into a specific method in the transformed | ||
54 | - * class by annotating the method with a {@link AppendInsns} annotation, specifying the name of the target method | ||
55 | - * as the annotation value. The target method signature must match the source method's signature and both | ||
56 | - * methods must return VOID. The instructions from the source method will be inserted immediately before the | ||
57 | - * RETURN opcode in the target method. | 61 | + * <li>It is also possible to merge instructions from a "source" method into |
62 | + * a specific method in the transformed class by annotating the method with | ||
63 | + * a {@link AppendInsns} annotation, specifying the name of the target | ||
64 | + * method as the annotation value. The target method signature must match | ||
65 | + * the source method's signature and both methods must return VOID. The | ||
66 | + * instructions from the source method will be inserted immediately before | ||
67 | + * the RETURN opcode in the target method.</li> | ||
58 | * | 68 | * |
59 | - * - To create a method stub for private methods you wish to invoke in the target class, decorate the stub | ||
60 | - * method with an {@link Stub} annotation, this will cause the overlay transformer to NOT merge the method | ||
61 | - * into the target, but merely verify that it exists in the target class. | 69 | + * <li>To create a method stub for private methods you wish to invoke in the |
70 | + * target class, decorate the stub method with an {@link Stub} annotation, | ||
71 | + * this will cause the overlay transformer to NOT merge the method into the | ||
72 | + * target, but merely verify that it exists in the target class.</li> | ||
62 | * | 73 | * |
63 | - * - Merge instructions into the constructor by specifying "<init>" as the target method name. | 74 | + * <li>Merge instructions into the constructor by specifying "<init>" as the |
75 | + * target method name.</li> | ||
76 | + * </ul> | ||
64 | * | 77 | * |
65 | * @author Adam Mummery-Smith | 78 | * @author Adam Mummery-Smith |
66 | */ | 79 | */ |
67 | public abstract class ClassOverlayTransformer extends ClassTransformer | 80 | public abstract class ClassOverlayTransformer extends ClassTransformer |
68 | { | 81 | { |
69 | /** | 82 | /** |
70 | - * Global list of overlaid classes, used to transform references in other classes | 83 | + * Global list of overlaid classes, used to transform references in other |
84 | + * classes. | ||
71 | */ | 85 | */ |
72 | private static final Map<String, String> overlayMap = new HashMap<String, String>(); | 86 | private static final Map<String, String> overlayMap = new HashMap<String, String>(); |
73 | 87 | ||
@@ -77,9 +91,10 @@ public abstract class ClassOverlayTransformer extends ClassTransformer | @@ -77,9 +91,10 @@ public abstract class ClassOverlayTransformer extends ClassTransformer | ||
77 | private static SimpleRemapper referenceRemapper; | 91 | private static SimpleRemapper referenceRemapper; |
78 | 92 | ||
79 | /** | 93 | /** |
80 | - * The first ClassOverlayTransformer to be instantiated accepts responsibility for performing | ||
81 | - * remapping operations and becomes the "remapping agent" transformer. This flag is set to | ||
82 | - * true to indicate that this instance is the remapping agent. | 94 | + * The first ClassOverlayTransformer to be instantiated accepts |
95 | + * responsibility for performing remapping operations and becomes the | ||
96 | + * "remapping agent" transformer. This flag is set to true to indicate that | ||
97 | + * this instance is the remapping agent. | ||
83 | */ | 98 | */ |
84 | private boolean remappingAgent = false; | 99 | private boolean remappingAgent = false; |
85 | 100 | ||
@@ -121,12 +136,15 @@ public abstract class ClassOverlayTransformer extends ClassTransformer | @@ -121,12 +136,15 @@ public abstract class ClassOverlayTransformer extends ClassTransformer | ||
121 | for (FieldNode field : overlayClass.fields) | 136 | for (FieldNode field : overlayClass.fields) |
122 | { | 137 | { |
123 | if ("__TARGET".equals(field.name) && ((field.access & Opcodes.ACC_STATIC) == Opcodes.ACC_STATIC)) | 138 | if ("__TARGET".equals(field.name) && ((field.access & Opcodes.ACC_STATIC) == Opcodes.ACC_STATIC)) |
139 | + { | ||
124 | targetClassName = Type.getType(field.desc).getClassName(); | 140 | targetClassName = Type.getType(field.desc).getClassName(); |
141 | + } | ||
125 | } | 142 | } |
126 | 143 | ||
127 | if (targetClassName == null) | 144 | if (targetClassName == null) |
128 | { | 145 | { |
129 | - throw new RuntimeException(String.format("Overlay class %s is missing a __TARGET field, unable to identify target class", this.overlayClassName)); | 146 | + throw new RuntimeException(String.format("Overlay class %s is missing a __TARGET field, unable to identify target class", |
147 | + this.overlayClassName)); | ||
130 | } | 148 | } |
131 | 149 | ||
132 | this.targetClassName = targetClassName; | 150 | this.targetClassName = targetClassName; |
@@ -142,7 +160,8 @@ public abstract class ClassOverlayTransformer extends ClassTransformer | @@ -142,7 +160,8 @@ public abstract class ClassOverlayTransformer extends ClassTransformer | ||
142 | } | 160 | } |
143 | 161 | ||
144 | /* (non-Javadoc) | 162 | /* (non-Javadoc) |
145 | - * @see net.minecraft.launchwrapper.IClassTransformer#transform(java.lang.String, java.lang.String, byte[]) | 163 | + * @see net.minecraft.launchwrapper.IClassTransformer |
164 | + * #transform(java.lang.String, java.lang.String, byte[]) | ||
146 | */ | 165 | */ |
147 | @Override | 166 | @Override |
148 | public byte[] transform(String name, String transformedName, byte[] basicClass) | 167 | public byte[] transform(String name, String transformedName, byte[] basicClass) |
@@ -250,7 +269,9 @@ public abstract class ClassOverlayTransformer extends ClassTransformer | @@ -250,7 +269,9 @@ public abstract class ClassOverlayTransformer extends ClassTransformer | ||
250 | for (String interfaceName : overlayClass.interfaces) | 269 | for (String interfaceName : overlayClass.interfaces) |
251 | { | 270 | { |
252 | if (!targetClass.interfaces.contains(interfaceName)) | 271 | if (!targetClass.interfaces.contains(interfaceName)) |
272 | + { | ||
253 | targetClass.interfaces.add(interfaceName); | 273 | targetClass.interfaces.add(interfaceName); |
274 | + } | ||
254 | } | 275 | } |
255 | } | 276 | } |
256 | 277 | ||
@@ -266,9 +287,10 @@ public abstract class ClassOverlayTransformer extends ClassTransformer | @@ -266,9 +287,10 @@ public abstract class ClassOverlayTransformer extends ClassTransformer | ||
266 | } | 287 | } |
267 | 288 | ||
268 | /** | 289 | /** |
269 | - * Overlay fields from overlay class into the target class. It is vital that this is done before | ||
270 | - * overlayMethods because we need to compute renamed fields so that transformMethod can rename field | ||
271 | - * references in the method body | 290 | + * Overlay fields from overlay class into the target class. It is vital that |
291 | + * this is done before overlayMethods because we need to compute renamed | ||
292 | + * fields so that transformMethod can rename field references in the | ||
293 | + * method body. | ||
272 | * | 294 | * |
273 | * @param targetClass | 295 | * @param targetClass |
274 | * @param overlayClass | 296 | * @param overlayClass |
@@ -279,7 +301,8 @@ public abstract class ClassOverlayTransformer extends ClassTransformer | @@ -279,7 +301,8 @@ public abstract class ClassOverlayTransformer extends ClassTransformer | ||
279 | { | 301 | { |
280 | if ((field.access & Opcodes.ACC_STATIC) == Opcodes.ACC_STATIC && (field.access & Opcodes.ACC_PRIVATE) != Opcodes.ACC_PRIVATE) | 302 | if ((field.access & Opcodes.ACC_STATIC) == Opcodes.ACC_STATIC && (field.access & Opcodes.ACC_PRIVATE) != Opcodes.ACC_PRIVATE) |
281 | { | 303 | { |
282 | - throw new InvalidOverlayException(String.format("Overlay classes cannot contain non-private static methods or fields, found %s", field.name)); | 304 | + throw new InvalidOverlayException(String.format("Overlay classes cannot contain non-private static methods or fields, found %s", |
305 | + field.name)); | ||
283 | } | 306 | } |
284 | 307 | ||
285 | FieldNode target = ByteCodeUtilities.findTargetField(targetClass, field); | 308 | FieldNode target = ByteCodeUtilities.findTargetField(targetClass, field); |
@@ -303,8 +326,8 @@ public abstract class ClassOverlayTransformer extends ClassTransformer | @@ -303,8 +326,8 @@ public abstract class ClassOverlayTransformer extends ClassTransformer | ||
303 | } | 326 | } |
304 | 327 | ||
305 | /** | 328 | /** |
306 | - * Called before merging methods to build the map of original method names -> new method names, | ||
307 | - * this is then used by transformMethod to remap | 329 | + * Called before merging methods to build the map of original method names |
330 | + * -> new method names, this is then used by transformMethod to remap. | ||
308 | * | 331 | * |
309 | * @param targetClass | 332 | * @param targetClass |
310 | * @param overlayClass | 333 | * @param overlayClass |
@@ -313,7 +336,8 @@ public abstract class ClassOverlayTransformer extends ClassTransformer | @@ -313,7 +336,8 @@ public abstract class ClassOverlayTransformer extends ClassTransformer | ||
313 | { | 336 | { |
314 | for (MethodNode overlayMethod : overlayClass.methods) | 337 | for (MethodNode overlayMethod : overlayClass.methods) |
315 | { | 338 | { |
316 | - if (ByteCodeUtilities.getVisibleAnnotation(overlayMethod, Stub.class) != null || (ByteCodeUtilities.getVisibleAnnotation(overlayMethod, AppendInsns.class) == null && !overlayMethod.name.startsWith("<"))) | 339 | + if (ByteCodeUtilities.getVisibleAnnotation(overlayMethod, Stub.class) != null |
340 | + || (ByteCodeUtilities.getVisibleAnnotation(overlayMethod, AppendInsns.class) == null && !overlayMethod.name.startsWith("<"))) | ||
317 | { | 341 | { |
318 | this.checkRenameMethod(targetClass, overlayMethod); | 342 | this.checkRenameMethod(targetClass, overlayMethod); |
319 | } | 343 | } |
@@ -350,7 +374,8 @@ public abstract class ClassOverlayTransformer extends ClassTransformer | @@ -350,7 +374,8 @@ public abstract class ClassOverlayTransformer extends ClassTransformer | ||
350 | } | 374 | } |
351 | else if (!overlayMethod.name.startsWith("<")) | 375 | else if (!overlayMethod.name.startsWith("<")) |
352 | { | 376 | { |
353 | - if ((overlayMethod.access & Opcodes.ACC_STATIC) == Opcodes.ACC_STATIC && (overlayMethod.access & Opcodes.ACC_PRIVATE) != Opcodes.ACC_PRIVATE) | 377 | + if ((overlayMethod.access & Opcodes.ACC_STATIC) == Opcodes.ACC_STATIC |
378 | + && (overlayMethod.access & Opcodes.ACC_PRIVATE) != Opcodes.ACC_PRIVATE) | ||
354 | { | 379 | { |
355 | continue; | 380 | continue; |
356 | } | 381 | } |
@@ -367,9 +392,10 @@ public abstract class ClassOverlayTransformer extends ClassTransformer | @@ -367,9 +392,10 @@ public abstract class ClassOverlayTransformer extends ClassTransformer | ||
367 | } | 392 | } |
368 | 393 | ||
369 | /** | 394 | /** |
370 | - * Handles "re-parenting" the method supplied, changes all references to the overlay class to | ||
371 | - * refer to the target class (for field accesses and method invokations) and also renames fields | ||
372 | - * accesses to their obfuscated versions | 395 | + * Handles "re-parenting" the method supplied, changes all references to the |
396 | + * overlay class to refer to the target class (for field accesses and method | ||
397 | + * invocations) and also renames fields accesses to their obfuscated | ||
398 | + * versions. | ||
373 | * | 399 | * |
374 | * @param method | 400 | * @param method |
375 | * @param fromClass | 401 | * @param fromClass |
@@ -411,7 +437,8 @@ public abstract class ClassOverlayTransformer extends ClassTransformer | @@ -411,7 +437,8 @@ public abstract class ClassOverlayTransformer extends ClassTransformer | ||
411 | } | 437 | } |
412 | 438 | ||
413 | /** | 439 | /** |
414 | - * Handles appending instructions from the source method to the target method | 440 | + * Handles appending instructions from the source method to the target |
441 | + * method. | ||
415 | * | 442 | * |
416 | * @param targetClass | 443 | * @param targetClass |
417 | * @param targetMethodName | 444 | * @param targetMethodName |
@@ -457,7 +484,7 @@ public abstract class ClassOverlayTransformer extends ClassTransformer | @@ -457,7 +484,7 @@ public abstract class ClassOverlayTransformer extends ClassTransformer | ||
457 | { | 484 | { |
458 | method.instructions.insertBefore(returnNode, insn); | 485 | method.instructions.insertBefore(returnNode, insn); |
459 | } | 486 | } |
460 | - } | 487 | + } |
461 | } | 488 | } |
462 | } | 489 | } |
463 | } | 490 | } |
src/main/java/com/mumfrey/liteloader/transformers/ClassTransformer.java
@@ -13,7 +13,8 @@ import org.objectweb.asm.tree.ClassNode; | @@ -13,7 +13,8 @@ import org.objectweb.asm.tree.ClassNode; | ||
13 | */ | 13 | */ |
14 | public abstract class ClassTransformer implements IClassTransformer | 14 | public abstract class ClassTransformer implements IClassTransformer |
15 | { | 15 | { |
16 | - public static final String HORIZONTAL_RULE = "----------------------------------------------------------------------------------------------------"; | 16 | + public static final String HORIZONTAL_RULE = |
17 | + "----------------------------------------------------------------------------------------------------"; | ||
17 | 18 | ||
18 | private ClassReader classReader; | 19 | private ClassReader classReader; |
19 | private ClassNode classNode; | 20 | private ClassNode classNode; |
src/main/java/com/mumfrey/liteloader/transformers/ObfProvider.java
@@ -3,15 +3,17 @@ package com.mumfrey.liteloader.transformers; | @@ -3,15 +3,17 @@ package com.mumfrey.liteloader.transformers; | ||
3 | import com.mumfrey.liteloader.core.runtime.Obf; | 3 | import com.mumfrey.liteloader.core.runtime.Obf; |
4 | 4 | ||
5 | /** | 5 | /** |
6 | - * Interface for dynamic (context-specific) obfuscation provider, used internally by ModEventInjectionTransformer to | ||
7 | - * provide obf entries for the AccessorTransformer from JSON | 6 | + * Interface for dynamic (context-specific) obfuscation provider, used |
7 | + * internally by ModEventInjectionTransformer to provide obf entries for the | ||
8 | + * AccessorTransformer from JSON | ||
8 | * | 9 | * |
9 | * @author Adam Mummery-Smith | 10 | * @author Adam Mummery-Smith |
10 | */ | 11 | */ |
11 | public interface ObfProvider | 12 | public interface ObfProvider |
12 | { | 13 | { |
13 | /** | 14 | /** |
14 | - * Try to locate an obfuscation table entry by name (id), returns null if no entry was found | 15 | + * Try to locate an obfuscation table entry by name (id), returns null if no |
16 | + * entry was found | ||
15 | * | 17 | * |
16 | * @param name | 18 | * @param name |
17 | */ | 19 | */ |
src/main/java/com/mumfrey/liteloader/transformers/Obfuscated.java
@@ -6,7 +6,8 @@ import java.lang.annotation.RetentionPolicy; | @@ -6,7 +6,8 @@ import java.lang.annotation.RetentionPolicy; | ||
6 | import java.lang.annotation.Target; | 6 | import java.lang.annotation.Target; |
7 | 7 | ||
8 | /** | 8 | /** |
9 | - * Annotation which provides the obfuscated names for a method or field to the ClassOverlayTransformer | 9 | + * Annotation which provides the obfuscated names for a method or field to the |
10 | + * ClassOverlayTransformer. | ||
10 | * | 11 | * |
11 | * @author Adam Mummery-Smith | 12 | * @author Adam Mummery-Smith |
12 | */ | 13 | */ |
src/main/java/com/mumfrey/liteloader/transformers/PacketHandlerException.java
@@ -3,7 +3,8 @@ package com.mumfrey.liteloader.transformers; | @@ -3,7 +3,8 @@ package com.mumfrey.liteloader.transformers; | ||
3 | import net.minecraft.network.Packet; | 3 | import net.minecraft.network.Packet; |
4 | 4 | ||
5 | /** | 5 | /** |
6 | - * Exception which a packet handler can throw in order to cancel further handling of the event | 6 | + * Exception which a packet handler can throw in order to cancel further |
7 | + * handling of the event. | ||
7 | * | 8 | * |
8 | * @author Adam Mummery-Smith | 9 | * @author Adam Mummery-Smith |
9 | */ | 10 | */ |
src/main/java/com/mumfrey/liteloader/transformers/Stub.java
@@ -6,7 +6,8 @@ import java.lang.annotation.RetentionPolicy; | @@ -6,7 +6,8 @@ import java.lang.annotation.RetentionPolicy; | ||
6 | import java.lang.annotation.Target; | 6 | import java.lang.annotation.Target; |
7 | 7 | ||
8 | /** | 8 | /** |
9 | - * Interface which instructs the ClassOverlayTransformer to NOT merge the annotated method | 9 | + * Interface which instructs the ClassOverlayTransformer to NOT merge the |
10 | + * annotated method. | ||
10 | * | 11 | * |
11 | * @author Adam Mummery-Smith | 12 | * @author Adam Mummery-Smith |
12 | */ | 13 | */ |
src/main/java/com/mumfrey/liteloader/transformers/access/Accessor.java
@@ -6,7 +6,8 @@ import java.lang.annotation.RetentionPolicy; | @@ -6,7 +6,8 @@ import java.lang.annotation.RetentionPolicy; | ||
6 | import java.lang.annotation.Target; | 6 | import java.lang.annotation.Target; |
7 | 7 | ||
8 | /** | 8 | /** |
9 | - * Defines an accessor method within an accessor injection interface, or an accessor interface itself | 9 | + * Defines an accessor method within an accessor injection interface, or an |
10 | + * accessor interface itself. | ||
10 | * | 11 | * |
11 | * @author Adam Mummery-Smith | 12 | * @author Adam Mummery-Smith |
12 | */ | 13 | */ |
src/main/java/com/mumfrey/liteloader/transformers/access/AccessorTransformer.java
@@ -15,6 +15,7 @@ import org.objectweb.asm.tree.AnnotationNode; | @@ -15,6 +15,7 @@ import org.objectweb.asm.tree.AnnotationNode; | ||
15 | import org.objectweb.asm.tree.ClassNode; | 15 | import org.objectweb.asm.tree.ClassNode; |
16 | import org.objectweb.asm.tree.FieldInsnNode; | 16 | import org.objectweb.asm.tree.FieldInsnNode; |
17 | import org.objectweb.asm.tree.FieldNode; | 17 | import org.objectweb.asm.tree.FieldNode; |
18 | +import org.objectweb.asm.tree.InsnList; | ||
18 | import org.objectweb.asm.tree.InsnNode; | 19 | import org.objectweb.asm.tree.InsnNode; |
19 | import org.objectweb.asm.tree.LdcInsnNode; | 20 | import org.objectweb.asm.tree.LdcInsnNode; |
20 | import org.objectweb.asm.tree.MethodInsnNode; | 21 | import org.objectweb.asm.tree.MethodInsnNode; |
@@ -29,7 +30,8 @@ import com.mumfrey.liteloader.transformers.ObfProvider; | @@ -29,7 +30,8 @@ import com.mumfrey.liteloader.transformers.ObfProvider; | ||
29 | import com.mumfrey.liteloader.util.log.LiteLoaderLogger; | 30 | import com.mumfrey.liteloader.util.log.LiteLoaderLogger; |
30 | 31 | ||
31 | /** | 32 | /** |
32 | - * Transformer which can inject accessor methods defined by an annotated interface into a target class | 33 | + * Transformer which can inject accessor methods defined by an annotated |
34 | + * interface into a target class. | ||
33 | * | 35 | * |
34 | * @author Adam Mummery-Smith | 36 | * @author Adam Mummery-Smith |
35 | */ | 37 | */ |
@@ -68,7 +70,8 @@ public abstract class AccessorTransformer extends ClassTransformer | @@ -68,7 +70,8 @@ public abstract class AccessorTransformer extends ClassTransformer | ||
68 | * Create a new new accessor using the specified template interface | 70 | * Create a new new accessor using the specified template interface |
69 | * | 71 | * |
70 | * @param iface Template interface | 72 | * @param iface Template interface |
71 | - * @throws IOException Thrown if an problem occurs when loading the interface bytecode | 73 | + * @throws IOException Thrown if an problem occurs when loading the |
74 | + * interface bytecode | ||
72 | */ | 75 | */ |
73 | protected AccessorInjection(String iface) throws IOException | 76 | protected AccessorInjection(String iface) throws IOException |
74 | { | 77 | { |
@@ -80,7 +83,8 @@ public abstract class AccessorTransformer extends ClassTransformer | @@ -80,7 +83,8 @@ public abstract class AccessorTransformer extends ClassTransformer | ||
80 | * | 83 | * |
81 | * @param iface Template interface | 84 | * @param iface Template interface |
82 | * @param obfProvider Obfuscation provider for this context | 85 | * @param obfProvider Obfuscation provider for this context |
83 | - * @throws IOException Thrown if an problem occurs when loading the interface bytecode | 86 | + * @throws IOException Thrown if an problem occurs when loading the |
87 | + * interface bytecode | ||
84 | */ | 88 | */ |
85 | protected AccessorInjection(String iface, ObfProvider obfProvider) throws IOException | 89 | protected AccessorInjection(String iface, ObfProvider obfProvider) throws IOException |
86 | { | 90 | { |
@@ -99,9 +103,11 @@ public abstract class AccessorTransformer extends ClassTransformer | @@ -99,9 +103,11 @@ public abstract class AccessorTransformer extends ClassTransformer | ||
99 | } | 103 | } |
100 | 104 | ||
101 | /** | 105 | /** |
102 | - * Get an obfuscation table mapping by name, first uses any supplied context provider, then any obfuscation table | ||
103 | - * class specified by an {@link ObfTableClass} annotation on the interface itself, and fails over onto the LiteLoader | ||
104 | - * obfuscation table. If the entry is not matched in any of the above locations then an exception is thrown | 106 | + * Get an obfuscation table mapping by name, first uses any supplied |
107 | + * context provider, then any obfuscation table class specified by an | ||
108 | + * {@link ObfTableClass} annotation on the interface itself, and fails | ||
109 | + * over onto the LiteLoader obfuscation table. If the entry is not | ||
110 | + * matched in any of the above locations then an exception is thrown. | ||
105 | * | 111 | * |
106 | * @param name Obfuscation table entry to fetch | 112 | * @param name Obfuscation table entry to fetch |
107 | */ | 113 | */ |
@@ -150,8 +156,9 @@ public abstract class AccessorTransformer extends ClassTransformer | @@ -150,8 +156,9 @@ public abstract class AccessorTransformer extends ClassTransformer | ||
150 | } | 156 | } |
151 | 157 | ||
152 | /** | 158 | /** |
153 | - * Inspects the target class for an {@link ObfTableClass} annotation and attempts to get a handle for the class | ||
154 | - * specified. On failure, the LiteLoader {@link Obf} is returned. | 159 | + * Inspects the target class for an {@link ObfTableClass} annotation and |
160 | + * attempts to get a handle for the class specified. On failure, the | ||
161 | + * LiteLoader {@link Obf} is returned. | ||
155 | */ | 162 | */ |
156 | @SuppressWarnings("unchecked") | 163 | @SuppressWarnings("unchecked") |
157 | private Class<? extends Obf> setupTable(ClassNode ifaceNode) | 164 | private Class<? extends Obf> setupTable(ClassNode ifaceNode) |
@@ -174,7 +181,8 @@ public abstract class AccessorTransformer extends ClassTransformer | @@ -174,7 +181,8 @@ public abstract class AccessorTransformer extends ClassTransformer | ||
174 | } | 181 | } |
175 | 182 | ||
176 | /** | 183 | /** |
177 | - * Locates the {@link Accessor} annotation on the interface in order to determine the target class | 184 | + * Locates the {@link Accessor} annotation on the interface in order to |
185 | + * determine the target class. | ||
178 | */ | 186 | */ |
179 | private Obf setupTarget(ClassNode ifaceNode) | 187 | private Obf setupTarget(ClassNode ifaceNode) |
180 | { | 188 | { |
@@ -259,12 +267,14 @@ public abstract class AccessorTransformer extends ClassTransformer | @@ -259,12 +267,14 @@ public abstract class AccessorTransformer extends ClassTransformer | ||
259 | } | 267 | } |
260 | else | 268 | else |
261 | { | 269 | { |
262 | - LiteLoaderLogger.severe("[AccessorTransformer] Method %s for %s has no @Accessor or @Invoker annotation, the method will be ABSTRACT!", method.name, this.iface); | 270 | + LiteLoaderLogger.severe("[AccessorTransformer] Method %s for %s has no @Accessor or @Invoker annotation, the method will " |
271 | + + "be ABSTRACT!", method.name, this.iface); | ||
263 | this.injectException(classNode, method, "No @Accessor or @Invoker annotation on method"); | 272 | this.injectException(classNode, method, "No @Accessor or @Invoker annotation on method"); |
264 | return; | 273 | return; |
265 | } | 274 | } |
266 | 275 | ||
267 | - LiteLoaderLogger.severe("[AccessorTransformer] Method %s for %s could not locate target member, the method will be ABSTRACT!", method.name, this.iface); | 276 | + LiteLoaderLogger.severe("[AccessorTransformer] Method %s for %s could not locate target member, the method will be ABSTRACT!", |
277 | + method.name, this.iface); | ||
268 | this.injectException(classNode, method, "Could not locate target class member '" + targetId + "'"); | 278 | this.injectException(classNode, method, "Could not locate target class member '" + targetId + "'"); |
269 | } | 279 | } |
270 | 280 | ||
@@ -431,14 +441,15 @@ public abstract class AccessorTransformer extends ClassTransformer | @@ -431,14 +441,15 @@ public abstract class AccessorTransformer extends ClassTransformer | ||
431 | */ | 441 | */ |
432 | private void injectException(ClassNode classNode, MethodNode method, String message) | 442 | private void injectException(ClassNode classNode, MethodNode method, String message) |
433 | { | 443 | { |
434 | - method.instructions.clear(); | 444 | + InsnList insns = method.instructions; |
435 | method.maxStack = 2; | 445 | method.maxStack = 2; |
436 | 446 | ||
437 | - method.instructions.add(new TypeInsnNode(Opcodes.NEW, "java/lang/RuntimeException")); | ||
438 | - method.instructions.add(new InsnNode(Opcodes.DUP)); | ||
439 | - method.instructions.add(new LdcInsnNode(message)); | ||
440 | - method.instructions.add(new MethodInsnNode(Opcodes.INVOKESPECIAL, "java/lang/RuntimeException", "<init>", "(Ljava/lang/String;)V", false)); | ||
441 | - method.instructions.add(new InsnNode(Opcodes.ATHROW)); | 447 | + insns.clear(); |
448 | + insns.add(new TypeInsnNode(Opcodes.NEW, "java/lang/RuntimeException")); | ||
449 | + insns.add(new InsnNode(Opcodes.DUP)); | ||
450 | + insns.add(new LdcInsnNode(message)); | ||
451 | + insns.add(new MethodInsnNode(Opcodes.INVOKESPECIAL, "java/lang/RuntimeException", "<init>", "(Ljava/lang/String;)V", false)); | ||
452 | + insns.add(new InsnNode(Opcodes.ATHROW)); | ||
442 | } | 453 | } |
443 | 454 | ||
444 | /** | 455 | /** |
@@ -505,7 +516,8 @@ public abstract class AccessorTransformer extends ClassTransformer | @@ -505,7 +516,8 @@ public abstract class AccessorTransformer extends ClassTransformer | ||
505 | } | 516 | } |
506 | 517 | ||
507 | /* (non-Javadoc) | 518 | /* (non-Javadoc) |
508 | - * @see net.minecraft.launchwrapper.IClassTransformer#transform(java.lang.String, java.lang.String, byte[]) | 519 | + * @see net.minecraft.launchwrapper.IClassTransformer |
520 | + * #transform(java.lang.String, java.lang.String, byte[]) | ||
509 | */ | 521 | */ |
510 | @Override | 522 | @Override |
511 | public byte[] transform(String name, String transformedName, byte[] basicClass) | 523 | public byte[] transform(String name, String transformedName, byte[] basicClass) |
@@ -524,8 +536,9 @@ public abstract class AccessorTransformer extends ClassTransformer | @@ -524,8 +536,9 @@ public abstract class AccessorTransformer extends ClassTransformer | ||
524 | } | 536 | } |
525 | 537 | ||
526 | /** | 538 | /** |
527 | - * Apply this transformer, used when this transformer is acting as a delegate via another transformer | ||
528 | - * (eg. an EventTransformer) and the parent transformer already has a ClassNode for the target class. | 539 | + * Apply this transformer, used when this transformer is acting as a |
540 | + * delegate via another transformer (eg. an EventTransformer) and the parent | ||
541 | + * transformer already has a ClassNode for the target class. | ||
529 | * | 542 | * |
530 | * @param name | 543 | * @param name |
531 | * @param transformedName | 544 | * @param transformedName |
@@ -558,7 +571,8 @@ public abstract class AccessorTransformer extends ClassTransformer | @@ -558,7 +571,8 @@ public abstract class AccessorTransformer extends ClassTransformer | ||
558 | } | 571 | } |
559 | 572 | ||
560 | /** | 573 | /** |
561 | - * Called after transformation is applied, allows custom transforms to be performed by subclasses | 574 | + * Called after transformation is applied, allows custom transforms to be |
575 | + * performed by subclasses. | ||
562 | * | 576 | * |
563 | * @param name | 577 | * @param name |
564 | * @param transformedName | 578 | * @param transformedName |
src/main/java/com/mumfrey/liteloader/transformers/access/ObfTableClass.java
@@ -8,7 +8,8 @@ import java.lang.annotation.Target; | @@ -8,7 +8,8 @@ import java.lang.annotation.Target; | ||
8 | import com.mumfrey.liteloader.core.runtime.Obf; | 8 | import com.mumfrey.liteloader.core.runtime.Obf; |
9 | 9 | ||
10 | /** | 10 | /** |
11 | - * Defines the obfuscation table class to use for an accessor injection interface | 11 | + * Defines the obfuscation table class to use for an accessor injection |
12 | + * interface. | ||
12 | * | 13 | * |
13 | * @author Adam Mummery-Smith | 14 | * @author Adam Mummery-Smith |
14 | */ | 15 | */ |
src/main/java/com/mumfrey/liteloader/transformers/event/Event.java
@@ -19,16 +19,18 @@ import com.mumfrey.liteloader.transformers.ByteCodeUtilities; | @@ -19,16 +19,18 @@ import com.mumfrey.liteloader.transformers.ByteCodeUtilities; | ||
19 | import com.mumfrey.liteloader.util.log.LiteLoaderLogger; | 19 | import com.mumfrey.liteloader.util.log.LiteLoaderLogger; |
20 | 20 | ||
21 | /** | 21 | /** |
22 | - * An injectable "event". An event is like a regular callback except that it is more intelligent about where | ||
23 | - * it can be injected in the bytecode and also supports conditional "cancellation", which is the ability to | ||
24 | - * conditionally return from the containing method with a custom return value. | 22 | + * An injectable "event". An event is like a regular callback except that it is |
23 | + * more intelligent about where it can be injected in the bytecode and also | ||
24 | + * supports conditional "cancellation", which is the ability to conditionally | ||
25 | + * return from the containing method with a custom return value. | ||
25 | * | 26 | * |
26 | * @author Adam Mummery-Smith | 27 | * @author Adam Mummery-Smith |
27 | */ | 28 | */ |
28 | public class Event implements Comparable<Event> | 29 | public class Event implements Comparable<Event> |
29 | { | 30 | { |
30 | /** | 31 | /** |
31 | - * Natural ordering of events, for use with sorting events which have the same priority | 32 | + * Natural ordering of events, for use with sorting events which have the |
33 | + * same priority. | ||
32 | */ | 34 | */ |
33 | private static int eventOrder = 0; | 35 | private static int eventOrder = 0; |
34 | 36 | ||
@@ -47,7 +49,8 @@ public class Event implements Comparable<Event> | @@ -47,7 +49,8 @@ public class Event implements Comparable<Event> | ||
47 | protected final String name; | 49 | protected final String name; |
48 | 50 | ||
49 | /** | 51 | /** |
50 | - * Whether this event is cancellable - if it is cancellable then the isCancelled() -> RETURN code will be injected | 52 | + * Whether this event is cancellable - if it is cancellable then the |
53 | + * isCancelled() -> RETURN code will be injected. | ||
51 | */ | 54 | */ |
52 | protected final boolean cancellable; | 55 | protected final boolean cancellable; |
53 | 56 | ||
@@ -64,9 +67,11 @@ public class Event implements Comparable<Event> | @@ -64,9 +67,11 @@ public class Event implements Comparable<Event> | ||
64 | private Set<MethodInfo> listeners = new HashSet<MethodInfo>(); | 67 | private Set<MethodInfo> listeners = new HashSet<MethodInfo>(); |
65 | 68 | ||
66 | /** | 69 | /** |
67 | - * Method this event is currently "attached" to, we "attach" at the beginning of a method injection in order to save | ||
68 | - * recalculating things like the return type and descriptor for each invokation, this means we need to calculate these | ||
69 | - * things at most once for each method this event is injecting into. | 70 | + * Method this event is currently "attached" to, we "attach" at the |
71 | + * beginning of a method injection in order to save recalculating things | ||
72 | + * like the return type and descriptor for each invocation, this means we | ||
73 | + * need to calculate these things at most once for each method this event is | ||
74 | + * injecting into. | ||
70 | */ | 75 | */ |
71 | protected MethodNode method; | 76 | protected MethodNode method; |
72 | 77 | ||
@@ -76,19 +81,20 @@ public class Event implements Comparable<Event> | @@ -76,19 +81,20 @@ public class Event implements Comparable<Event> | ||
76 | protected String eventDescriptor; | 81 | protected String eventDescriptor; |
77 | 82 | ||
78 | /** | 83 | /** |
79 | - * Method's original MAXS, used as a base to work out whether we need to increase the MAXS value | 84 | + * Method's original MAXS, used as a base to work out whether we need to |
85 | + * increase the MAXS value. | ||
80 | */ | 86 | */ |
81 | protected int methodMAXS = 0; | 87 | protected int methodMAXS = 0; |
82 | 88 | ||
83 | /** | 89 | /** |
84 | - * True if the attached method is static, used so that we know whether to push "this" onto the stack when | ||
85 | - * constructing the EventInfo, or "null" | 90 | + * True if the attached method is static, used so that we know whether to |
91 | + * push "this" onto the stack when constructing the EventInfo, or "null" | ||
86 | */ | 92 | */ |
87 | protected boolean methodIsStatic; | 93 | protected boolean methodIsStatic; |
88 | 94 | ||
89 | /** | 95 | /** |
90 | - * Return type for the attached method, used to determine which EventInfo class to use and which method | ||
91 | - * to invoke. | 96 | + * Return type for the attached method, used to determine which EventInfo |
97 | + * class to use and which method to invoke. | ||
92 | */ | 98 | */ |
93 | protected Type methodReturnType; | 99 | protected Type methodReturnType; |
94 | 100 | ||
@@ -117,8 +123,9 @@ public class Event implements Comparable<Event> | @@ -117,8 +123,9 @@ public class Event implements Comparable<Event> | ||
117 | } | 123 | } |
118 | 124 | ||
119 | /** | 125 | /** |
120 | - * Creates a new event with the specified name, if an event with the specified name already exists then | ||
121 | - * the existing event is returned instead. | 126 | + * Creates a new event with the specified name, if an event with the |
127 | + * specified name already exists then the existing event is returned | ||
128 | + * instead. | ||
122 | * | 129 | * |
123 | * @param name Event name (case insensitive) | 130 | * @param name Event name (case insensitive) |
124 | * @return new Event instance or existing Event instance | 131 | * @return new Event instance or existing Event instance |
@@ -129,8 +136,9 @@ public class Event implements Comparable<Event> | @@ -129,8 +136,9 @@ public class Event implements Comparable<Event> | ||
129 | } | 136 | } |
130 | 137 | ||
131 | /** | 138 | /** |
132 | - * Creates a new event with the specified name, if an event with the specified name already exists then | ||
133 | - * the existing event is returned instead. | 139 | + * Creates a new event with the specified name, if an event with the |
140 | + * specified name already exists then the existing event is returned | ||
141 | + * instead. | ||
134 | * | 142 | * |
135 | * @param name Event name (case insensitive) | 143 | * @param name Event name (case insensitive) |
136 | * @param cancellable True if the event should be created as cancellable | 144 | * @param cancellable True if the event should be created as cancellable |
@@ -142,12 +150,14 @@ public class Event implements Comparable<Event> | @@ -142,12 +150,14 @@ public class Event implements Comparable<Event> | ||
142 | } | 150 | } |
143 | 151 | ||
144 | /** | 152 | /** |
145 | - * Creates a new event with the specified name, if an event with the specified name already exists then | ||
146 | - * the existing event is returned instead. | 153 | + * Creates a new event with the specified name, if an event with the |
154 | + * specified name already exists then the existing event is returned | ||
155 | + * instead. | ||
147 | * | 156 | * |
148 | * @param name Event name (case insensitive) | 157 | * @param name Event name (case insensitive) |
149 | * @param cancellable True if the event should be created as cancellable | 158 | * @param cancellable True if the event should be created as cancellable |
150 | - * @param priority Priority for the event, only used when multiple events are being injected at the same instruction | 159 | + * @param priority Priority for the event, only used when multiple events |
160 | + * are being injected at the same instruction | ||
151 | * @return new Event instance or existing Event instance | 161 | * @return new Event instance or existing Event instance |
152 | */ | 162 | */ |
153 | public static Event getOrCreate(String name, boolean cancellable, int priority) | 163 | public static Event getOrCreate(String name, boolean cancellable, int priority) |
@@ -162,7 +172,8 @@ public class Event implements Comparable<Event> | @@ -162,7 +172,8 @@ public class Event implements Comparable<Event> | ||
162 | { | 172 | { |
163 | if (!event.cancellable && cancellable && defining) | 173 | if (!event.cancellable && cancellable && defining) |
164 | { | 174 | { |
165 | - throw new IllegalArgumentException("Attempted to define the event " + event.name + " with cancellable '" + cancellable + "' but the event is already defined with cancellable is '" + event.cancellable + "'"); | 175 | + throw new IllegalArgumentException("Attempted to define the event " + event.name + " with cancellable '" |
176 | + + cancellable + "' but the event is already defined with cancellable is '" + event.cancellable + "'"); | ||
166 | } | 177 | } |
167 | 178 | ||
168 | return event; | 179 | return event; |
@@ -221,10 +232,12 @@ public class Event implements Comparable<Event> | @@ -221,10 +232,12 @@ public class Event implements Comparable<Event> | ||
221 | } | 232 | } |
222 | 233 | ||
223 | /** | 234 | /** |
224 | - * Attaches this event to a particular method, this occurs before injection in order to allow the event to | ||
225 | - * configure its internal state appropriately for the method's signature. Since a single event may be injected | ||
226 | - * into multiple target methods, and may also be injected at multiple points in the same method, this saves | ||
227 | - * us recalculating this information for every injection, and instead just calculate once per method. | 235 | + * Attaches this event to a particular method, this occurs before injection |
236 | + * in order to allow the event to configure its internal state appropriately | ||
237 | + * for the method's signature. Since a single event may be injected into | ||
238 | + * multiple target methods, and may also be injected at multiple points in | ||
239 | + * the same method, this saves us recalculating this information for every | ||
240 | + * injection, and instead just calculate once per method. | ||
228 | * | 241 | * |
229 | * @param method Method to attach to | 242 | * @param method Method to attach to |
230 | */ | 243 | */ |
@@ -232,7 +245,8 @@ public class Event implements Comparable<Event> | @@ -232,7 +245,8 @@ public class Event implements Comparable<Event> | ||
232 | { | 245 | { |
233 | if (this.method != null) | 246 | if (this.method != null) |
234 | { | 247 | { |
235 | - throw new IllegalStateException("Attempted to attach the event " + this.name + " to " + method.name + " but the event was already attached to " + this.method.name + "!"); | 248 | + throw new IllegalStateException("Attempted to attach the event " + this.name + " to " + method.name |
249 | + + " but the event was already attached to " + this.method.name + "!"); | ||
236 | } | 250 | } |
237 | 251 | ||
238 | this.method = method; | 252 | this.method = method; |
@@ -244,7 +258,8 @@ public class Event implements Comparable<Event> | @@ -244,7 +258,8 @@ public class Event implements Comparable<Event> | ||
244 | } | 258 | } |
245 | 259 | ||
246 | /** | 260 | /** |
247 | - * Detach from the attached method, called once injection is completed for a particular method | 261 | + * Detach from the attached method, called once injection is completed for a |
262 | + * particular method. | ||
248 | */ | 263 | */ |
249 | void detach() | 264 | void detach() |
250 | { | 265 | { |
@@ -288,7 +303,8 @@ public class Event implements Comparable<Event> | @@ -288,7 +303,8 @@ public class Event implements Comparable<Event> | ||
288 | int uninjectedCount = 0; | 303 | int uninjectedCount = 0; |
289 | int pendingInjectionCount = this.pendingInjections != null ? this.pendingInjections.size() : 0; | 304 | int pendingInjectionCount = this.pendingInjections != null ? this.pendingInjections.size() : 0; |
290 | 305 | ||
291 | - LiteLoaderLogger.debug(" Event: %-40s Injected: %d Pending: %d %s", this.name, this.injectionCount, pendingInjectionCount, this.injectionCount == 0 ? " <<< NOT INJECTED >>>" : ""); | 306 | + LiteLoaderLogger.debug(" Event: %-40s Injected: %d Pending: %d %s", this.name, this.injectionCount, pendingInjectionCount, |
307 | + this.injectionCount == 0 ? " <<< NOT INJECTED >>>" : ""); | ||
292 | if (pendingInjectionCount > 0) | 308 | if (pendingInjectionCount > 0) |
293 | { | 309 | { |
294 | for (MethodInfo pending : this.pendingInjections) | 310 | for (MethodInfo pending : this.pendingInjections) |
@@ -317,17 +333,22 @@ public class Event implements Comparable<Event> | @@ -317,17 +333,22 @@ public class Event implements Comparable<Event> | ||
317 | } | 333 | } |
318 | 334 | ||
319 | /** | 335 | /** |
320 | - * Inject bytecode for this event into the currently attached method. When multiple events want to be injected | ||
321 | - * into the same method at the same point only the first event is injected, subsequent events are simply added to | ||
322 | - * the same handler delegate in the EventProxy class. | 336 | + * Inject bytecode for this event into the currently attached method. When |
337 | + * multiple events want to be injected into the same method at the same | ||
338 | + * point only the first event is injected, subsequent events are simply | ||
339 | + * added to the same handler delegate in the EventProxy class. | ||
323 | * | 340 | * |
324 | - * @param injectionPoint Point to inject code, new instructions will be injected directly ahead of the specifed insn | ||
325 | - * @param cancellable Cancellable flag, if true then the cancellation code (conditional return) will be injected as well | ||
326 | - * @param globalEventID Global event ID, used to map a callback to the relevant event handler delegate method in EventProxy | 341 | + * @param injectionPoint Point to inject code, new instructions will be |
342 | + * injected directly ahead of the specifed insn | ||
343 | + * @param cancellable Cancellable flag, if true then the cancellation code | ||
344 | + * (conditional return) will be injected as well | ||
345 | + * @param globalEventID Global event ID, used to map a callback to the | ||
346 | + * relevant event handler delegate method in EventProxy | ||
327 | * | 347 | * |
328 | * @return MethodNode for the event handler delegate | 348 | * @return MethodNode for the event handler delegate |
329 | */ | 349 | */ |
330 | - final MethodNode inject(final AbstractInsnNode injectionPoint, boolean cancellable, final int globalEventID, final boolean captureLocals, final Type[] locals) | 350 | + final MethodNode inject(final AbstractInsnNode injectionPoint, boolean cancellable, final int globalEventID, final boolean captureLocals, |
351 | + final Type[] locals) | ||
331 | { | 352 | { |
332 | // Pre-flight checks | 353 | // Pre-flight checks |
333 | this.validate(injectionPoint, cancellable, globalEventID); | 354 | this.validate(injectionPoint, cancellable, globalEventID); |
@@ -339,7 +360,8 @@ public class Event implements Comparable<Event> | @@ -339,7 +360,8 @@ public class Event implements Comparable<Event> | ||
339 | String eventDescriptor = this.generateEventDescriptor(doCaptureLocals, locals, arguments, initialFrameSize); | 360 | String eventDescriptor = this.generateEventDescriptor(doCaptureLocals, locals, arguments, initialFrameSize); |
340 | 361 | ||
341 | // Create the handler delegate method | 362 | // Create the handler delegate method |
342 | - MethodNode handler = new MethodNode(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC | Opcodes.ACC_SYNTHETIC, Event.getHandlerName(globalEventID), eventDescriptor, null, null); | 363 | + MethodNode handler = new MethodNode(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC | Opcodes.ACC_SYNTHETIC, Event.getHandlerName(globalEventID), |
364 | + eventDescriptor, null, null); | ||
343 | Event.addMethodToActiveProxy(handler); | 365 | Event.addMethodToActiveProxy(handler); |
344 | 366 | ||
345 | LiteLoaderLogger.debug("Event %s is spawning handler %s in class %s", this.name, handler.name, Event.getActiveProxyRef()); | 367 | LiteLoaderLogger.debug("Event %s is spawning handler %s in class %s", this.name, handler.name, Event.getActiveProxyRef()); |
@@ -413,11 +435,13 @@ public class Event implements Comparable<Event> | @@ -413,11 +435,13 @@ public class Event implements Comparable<Event> | ||
413 | if (pushReturnValue) | 435 | if (pushReturnValue) |
414 | { | 436 | { |
415 | insns.add(new VarInsnNode(this.methodReturnType.getOpcode(Opcodes.ILOAD), marshallVar)); | 437 | insns.add(new VarInsnNode(this.methodReturnType.getOpcode(Opcodes.ILOAD), marshallVar)); |
416 | - insns.add(new MethodInsnNode(Opcodes.INVOKESPECIAL, this.eventInfoClass, Obf.constructor.name, EventInfo.getConstructorDescriptor(this.methodReturnType), false)); | 438 | + insns.add(new MethodInsnNode(Opcodes.INVOKESPECIAL, this.eventInfoClass, Obf.constructor.name, |
439 | + EventInfo.getConstructorDescriptor(this.methodReturnType), false)); | ||
417 | } | 440 | } |
418 | else | 441 | else |
419 | { | 442 | { |
420 | - insns.add(new MethodInsnNode(Opcodes.INVOKESPECIAL, this.eventInfoClass, Obf.constructor.name, EventInfo.getConstructorDescriptor(), false)); | 443 | + insns.add(new MethodInsnNode(Opcodes.INVOKESPECIAL, this.eventInfoClass, Obf.constructor.name, |
444 | + EventInfo.getConstructorDescriptor(), false)); | ||
421 | } | 445 | } |
422 | 446 | ||
423 | return ctorMAXS; | 447 | return ctorMAXS; |
@@ -438,7 +462,8 @@ public class Event implements Comparable<Event> | @@ -438,7 +462,8 @@ public class Event implements Comparable<Event> | ||
438 | protected void injectCancellationCode(final InsnList insns, final AbstractInsnNode injectionPoint, int marshallVar) | 462 | protected void injectCancellationCode(final InsnList insns, final AbstractInsnNode injectionPoint, int marshallVar) |
439 | { | 463 | { |
440 | insns.add(new VarInsnNode(Opcodes.ALOAD, marshallVar)); | 464 | insns.add(new VarInsnNode(Opcodes.ALOAD, marshallVar)); |
441 | - insns.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, this.eventInfoClass, EventInfo.getIsCancelledMethodName(), EventInfo.getIsCancelledMethodSig(), false)); | 465 | + insns.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, this.eventInfoClass, EventInfo.getIsCancelledMethodName(), |
466 | + EventInfo.getIsCancelledMethodSig(), false)); | ||
442 | 467 | ||
443 | LabelNode notCancelled = new LabelNode(); | 468 | LabelNode notCancelled = new LabelNode(); |
444 | insns.add(new JumpInsnNode(Opcodes.IFEQ, notCancelled)); | 469 | insns.add(new JumpInsnNode(Opcodes.IFEQ, notCancelled)); |
@@ -506,7 +531,8 @@ public class Event implements Comparable<Event> | @@ -506,7 +531,8 @@ public class Event implements Comparable<Event> | ||
506 | 531 | ||
507 | if (this.pendingInjections != null && this.pendingInjections.size() == 0) | 532 | if (this.pendingInjections != null && this.pendingInjections.size() == 0) |
508 | { | 533 | { |
509 | - throw new EventAlreadyInjectedException("The event " + this.name + " was already injected and has 0 pending injections, addListener() is not allowed at this point"); | 534 | + throw new EventAlreadyInjectedException("The event " + this.name |
535 | + + " was already injected and has 0 pending injections, addListener() is not allowed at this point"); | ||
510 | } | 536 | } |
511 | 537 | ||
512 | this.listeners.add(listener); | 538 | this.listeners.add(listener); |
@@ -531,13 +557,16 @@ public class Event implements Comparable<Event> | @@ -531,13 +557,16 @@ public class Event implements Comparable<Event> | ||
531 | { | 557 | { |
532 | for (Event event : Event.events) | 558 | for (Event event : Event.events) |
533 | if (event.name.equalsIgnoreCase(eventName)) | 559 | if (event.name.equalsIgnoreCase(eventName)) |
560 | + { | ||
534 | return event; | 561 | return event; |
562 | + } | ||
535 | 563 | ||
536 | return null; | 564 | return null; |
537 | } | 565 | } |
538 | 566 | ||
539 | /** | 567 | /** |
540 | - * Populates the event proxy class with delegating methods for all injected events | 568 | + * Populates the event proxy class with delegating methods for all injected |
569 | + * events. | ||
541 | * | 570 | * |
542 | * @param classNode | 571 | * @param classNode |
543 | * @param proxyIndex | 572 | * @param proxyIndex |
@@ -559,7 +588,7 @@ public class Event implements Comparable<Event> | @@ -559,7 +588,7 @@ public class Event implements Comparable<Event> | ||
559 | MethodNode handlerMethod = handler.getKey(); | 588 | MethodNode handlerMethod = handler.getKey(); |
560 | List<Event> handlerEvents = handler.getValue(); | 589 | List<Event> handlerEvents = handler.getValue(); |
561 | 590 | ||
562 | - // Args is used to inject appropriate LOAD opcodes to put the method arguments on the stack for each handler invokation | 591 | + // Args is used to inject appropriate LOAD opcodes to put the method arguments on the stack for each handler invocation |
563 | Type[] args = Type.getArgumentTypes(handlerMethod.desc); | 592 | Type[] args = Type.getArgumentTypes(handlerMethod.desc); |
564 | 593 | ||
565 | // Add our generated method to the the class | 594 | // Add our generated method to the the class |
@@ -578,8 +607,10 @@ public class Event implements Comparable<Event> | @@ -578,8 +607,10 @@ public class Event implements Comparable<Event> | ||
578 | LabelNode tryCatchHandler2 = new LabelNode(); | 607 | LabelNode tryCatchHandler2 = new LabelNode(); |
579 | LabelNode tryCatchExit = new LabelNode(); | 608 | LabelNode tryCatchExit = new LabelNode(); |
580 | 609 | ||
581 | - handlerMethod.tryCatchBlocks.add(new TryCatchBlockNode(tryCatchStart, tryCatchEnd, tryCatchHandler1, "java/lang/NoSuchMethodError")); | ||
582 | - handlerMethod.tryCatchBlocks.add(new TryCatchBlockNode(tryCatchStart, tryCatchEnd, tryCatchHandler2, "java/lang/NoClassDefFoundError")); | 610 | + handlerMethod.tryCatchBlocks.add(new TryCatchBlockNode(tryCatchStart, tryCatchEnd, |
611 | + tryCatchHandler1, "java/lang/NoSuchMethodError")); | ||
612 | + handlerMethod.tryCatchBlocks.add(new TryCatchBlockNode(tryCatchStart, tryCatchEnd, | ||
613 | + tryCatchHandler2, "java/lang/NoClassDefFoundError")); | ||
583 | 614 | ||
584 | insns.add(tryCatchStart); // try { | 615 | insns.add(tryCatchStart); // try { |
585 | 616 | ||
@@ -592,7 +623,8 @@ public class Event implements Comparable<Event> | @@ -592,7 +623,8 @@ public class Event implements Comparable<Event> | ||
592 | insns.add(new LineNumberNode(++lineNumber, lineNumberLabel)); | 623 | insns.add(new LineNumberNode(++lineNumber, lineNumberLabel)); |
593 | 624 | ||
594 | ByteCodeUtilities.loadArgs(args, insns, 0); | 625 | ByteCodeUtilities.loadArgs(args, insns, 0); |
595 | - insns.add(new MethodInsnNode(Opcodes.INVOKESTATIC, listener.ownerRef, listener.getOrInflectName(event.name), handlerMethod.desc, false)); | 626 | + insns.add(new MethodInsnNode(Opcodes.INVOKESTATIC, listener.ownerRef, listener.getOrInflectName(event.name), |
627 | + handlerMethod.desc, false)); | ||
596 | } | 628 | } |
597 | 629 | ||
598 | insns.add(tryCatchEnd); // } | 630 | insns.add(tryCatchEnd); // } |
@@ -600,12 +632,14 @@ public class Event implements Comparable<Event> | @@ -600,12 +632,14 @@ public class Event implements Comparable<Event> | ||
600 | 632 | ||
601 | insns.add(tryCatchHandler1); // catch (NoSuchMethodError err) { | 633 | insns.add(tryCatchHandler1); // catch (NoSuchMethodError err) { |
602 | insns.add(new VarInsnNode(Opcodes.ALOAD, 0)); | 634 | insns.add(new VarInsnNode(Opcodes.ALOAD, 0)); |
603 | - insns.add(new MethodInsnNode(Opcodes.INVOKESTATIC, Obf.EventProxy.ref, "onMissingHandler", "(Ljava/lang/Error;Lcom/mumfrey/liteloader/transformers/event/EventInfo;)V", false)); | 635 | + insns.add(new MethodInsnNode(Opcodes.INVOKESTATIC, Obf.EventProxy.ref, "onMissingHandler", |
636 | + "(Ljava/lang/Error;Lcom/mumfrey/liteloader/transformers/event/EventInfo;)V", false)); | ||
604 | insns.add(new JumpInsnNode(Opcodes.GOTO, tryCatchExit)); | 637 | insns.add(new JumpInsnNode(Opcodes.GOTO, tryCatchExit)); |
605 | 638 | ||
606 | insns.add(tryCatchHandler2); // } catch (NoClassDefFoundError err) { | 639 | insns.add(tryCatchHandler2); // } catch (NoClassDefFoundError err) { |
607 | insns.add(new VarInsnNode(Opcodes.ALOAD, 0)); | 640 | insns.add(new VarInsnNode(Opcodes.ALOAD, 0)); |
608 | - insns.add(new MethodInsnNode(Opcodes.INVOKESTATIC, Obf.EventProxy.ref, "onMissingClass", "(Ljava/lang/Error;Lcom/mumfrey/liteloader/transformers/event/EventInfo;)V", false)); | 641 | + insns.add(new MethodInsnNode(Opcodes.INVOKESTATIC, Obf.EventProxy.ref, "onMissingClass", |
642 | + "(Ljava/lang/Error;Lcom/mumfrey/liteloader/transformers/event/EventInfo;)V", false)); | ||
609 | insns.add(new JumpInsnNode(Opcodes.GOTO, tryCatchExit)); | 643 | insns.add(new JumpInsnNode(Opcodes.GOTO, tryCatchExit)); |
610 | 644 | ||
611 | insns.add(tryCatchExit); // } | 645 | insns.add(tryCatchExit); // } |
@@ -615,7 +649,8 @@ public class Event implements Comparable<Event> | @@ -615,7 +649,8 @@ public class Event implements Comparable<Event> | ||
615 | insns.add(new InsnNode(Opcodes.RETURN)); | 649 | insns.add(new InsnNode(Opcodes.RETURN)); |
616 | } | 650 | } |
617 | 651 | ||
618 | - LiteLoaderLogger.info("Successfully generated event handler proxy class with %d handlers(s) and %d total invokations", handlerCount, invokeCount); | 652 | + LiteLoaderLogger.info("Successfully generated event handler proxy class with %d handlers(s) and %d total invocations", |
653 | + handlerCount, invokeCount); | ||
619 | 654 | ||
620 | return classNode; | 655 | return classNode; |
621 | } | 656 | } |
@@ -623,7 +658,9 @@ public class Event implements Comparable<Event> | @@ -623,7 +658,9 @@ public class Event implements Comparable<Event> | ||
623 | private static List<Event> addMethodToActiveProxy(MethodNode handlerMethod) | 658 | private static List<Event> addMethodToActiveProxy(MethodNode handlerMethod) |
624 | { | 659 | { |
625 | while (Event.proxyHandlerMethods.size() < Event.proxyInnerClassIndex + 1) | 660 | while (Event.proxyHandlerMethods.size() < Event.proxyInnerClassIndex + 1) |
661 | + { | ||
626 | Event.proxyHandlerMethods.add(new LinkedHashMap<MethodNode, List<Event>>()); | 662 | Event.proxyHandlerMethods.add(new LinkedHashMap<MethodNode, List<Event>>()); |
663 | + } | ||
627 | 664 | ||
628 | ArrayList<Event> events = new ArrayList<Event>(); | 665 | ArrayList<Event> events = new ArrayList<Event>(); |
629 | Event.proxyHandlerMethods.get(Event.proxyInnerClassIndex).put(handlerMethod, events); | 666 | Event.proxyHandlerMethods.get(Event.proxyInnerClassIndex).put(handlerMethod, events); |
src/main/java/com/mumfrey/liteloader/transformers/event/EventInfo.java
@@ -6,12 +6,13 @@ import com.mumfrey.liteloader.core.event.Cancellable; | @@ -6,12 +6,13 @@ import com.mumfrey.liteloader.core.event.Cancellable; | ||
6 | import com.mumfrey.liteloader.core.event.EventCancellationException; | 6 | import com.mumfrey.liteloader.core.event.EventCancellationException; |
7 | 7 | ||
8 | /** | 8 | /** |
9 | - * Contains information about an injected event, including the source object and whether the event | ||
10 | - * is cancellable and/or cancelled. | 9 | + * Contains information about an injected event, including the source object and |
10 | + * whether the event is cancellable and/or cancelled. | ||
11 | * | 11 | * |
12 | * @author Adam Mummery-Smith | 12 | * @author Adam Mummery-Smith |
13 | * | 13 | * |
14 | - * @param <S> Source object type. For non-static methods this will be the containing object instance. | 14 | + * @param <S> Source object type. For non-static methods this will be the |
15 | + * containing object instance. | ||
15 | */ | 16 | */ |
16 | public class EventInfo<S> implements Cancellable | 17 | public class EventInfo<S> implements Cancellable |
17 | { | 18 | { |
@@ -51,7 +52,8 @@ public class EventInfo<S> implements Cancellable | @@ -51,7 +52,8 @@ public class EventInfo<S> implements Cancellable | ||
51 | @Override | 52 | @Override |
52 | public String toString() | 53 | public String toString() |
53 | { | 54 | { |
54 | - return String.format("EventInfo(TYPE=%s,NAME=%s,SOURCE=%s,CANCELLABLE=%s)", this.getClass().getSimpleName(), this.name, this.getSourceClass(), this.cancellable); | 55 | + return String.format("EventInfo(TYPE=%s,NAME=%s,SOURCE=%s,CANCELLABLE=%s)", this.getClass().getSimpleName(), |
56 | + this.name, this.getSourceClass(), this.cancellable); | ||
55 | } | 57 | } |
56 | 58 | ||
57 | /* (non-Javadoc) | 59 | /* (non-Javadoc) |
src/main/java/com/mumfrey/liteloader/transformers/event/EventInjectionTransformer.java
@@ -19,7 +19,8 @@ public abstract class EventInjectionTransformer implements IClassTransformer | @@ -19,7 +19,8 @@ public abstract class EventInjectionTransformer implements IClassTransformer | ||
19 | } | 19 | } |
20 | 20 | ||
21 | /* (non-Javadoc) | 21 | /* (non-Javadoc) |
22 | - * @see net.minecraft.launchwrapper.IClassTransformer#transform(java.lang.String, java.lang.String, byte[]) | 22 | + * @see net.minecraft.launchwrapper.IClassTransformer |
23 | + * #transform(java.lang.String, java.lang.String, byte[]) | ||
23 | */ | 24 | */ |
24 | @Override | 25 | @Override |
25 | public byte[] transform(String name, String transformedName, byte[] basicClass) | 26 | public byte[] transform(String name, String transformedName, byte[] basicClass) |
@@ -33,11 +34,16 @@ public abstract class EventInjectionTransformer implements IClassTransformer | @@ -33,11 +34,16 @@ public abstract class EventInjectionTransformer implements IClassTransformer | ||
33 | protected abstract void addEvents(); | 34 | protected abstract void addEvents(); |
34 | 35 | ||
35 | /** | 36 | /** |
36 | - * Register a new event to be injected, the event instance will be created if it does not already exist | 37 | + * Register a new event to be injected, the event instance will be created |
38 | + * if it does not already exist. | ||
37 | * | 39 | * |
38 | - * @param eventName Name of the event to use/create. Beware that IllegalArgumentException if the event was already defined with incompatible parameters | ||
39 | - * @param targetMethod Method descriptor to identify the method to inject into | ||
40 | - * @param injectionPoint Delegate which finds the location(s) in the target method to inject into | 40 | + * @param eventName Name of the event to use/create. Beware that |
41 | + * IllegalArgumentException if the event was already defined with | ||
42 | + * incompatible parameters | ||
43 | + * @param targetMethod Method descriptor to identify the method to inject | ||
44 | + * into | ||
45 | + * @param injectionPoint Delegate which finds the location(s) in the target | ||
46 | + * method to inject into | ||
41 | * | 47 | * |
42 | * @return the event - for fluent interface | 48 | * @return the event - for fluent interface |
43 | */ | 49 | */ |
@@ -50,18 +56,24 @@ public abstract class EventInjectionTransformer implements IClassTransformer | @@ -50,18 +56,24 @@ public abstract class EventInjectionTransformer implements IClassTransformer | ||
50 | * Register an event to be injected | 56 | * Register an event to be injected |
51 | * | 57 | * |
52 | * @param event Event to inject | 58 | * @param event Event to inject |
53 | - * @param targetMethod Method descriptor to identify the method to inject into | ||
54 | - * @param injectionPoint Delegate which finds the location(s) in the target method to inject into | 59 | + * @param targetMethod Method descriptor to identify the method to inject |
60 | + * into | ||
61 | + * @param injectionPoint Delegate which finds the location(s) in the target | ||
62 | + * method to inject into | ||
55 | * | 63 | * |
56 | * @return the event - for fluent interface | 64 | * @return the event - for fluent interface |
57 | */ | 65 | */ |
58 | protected final Event addEvent(Event event, MethodInfo targetMethod, InjectionPoint injectionPoint) | 66 | protected final Event addEvent(Event event, MethodInfo targetMethod, InjectionPoint injectionPoint) |
59 | { | 67 | { |
60 | if (event == null) | 68 | if (event == null) |
69 | + { | ||
61 | throw new IllegalArgumentException("Event cannot be null!"); | 70 | throw new IllegalArgumentException("Event cannot be null!"); |
71 | + } | ||
62 | 72 | ||
63 | if (injectionPoint == null) | 73 | if (injectionPoint == null) |
74 | + { | ||
64 | throw new IllegalArgumentException("Injection point cannot be null for event " + event.getName()); | 75 | throw new IllegalArgumentException("Injection point cannot be null for event " + event.getName()); |
76 | + } | ||
65 | 77 | ||
66 | if ("true".equals(System.getProperty("mcpenv"))) | 78 | if ("true".equals(System.getProperty("mcpenv"))) |
67 | { | 79 | { |
@@ -89,7 +101,8 @@ public abstract class EventInjectionTransformer implements IClassTransformer | @@ -89,7 +101,8 @@ public abstract class EventInjectionTransformer implements IClassTransformer | ||
89 | } | 101 | } |
90 | 102 | ||
91 | /** | 103 | /** |
92 | - * Register an access injection interface and provide a contextual obfuscation provider | 104 | + * Register an access injection interface and provide a contextual |
105 | + * obfuscation provider. | ||
93 | * | 106 | * |
94 | * @param interfaceName | 107 | * @param interfaceName |
95 | * @param obfProvider | 108 | * @param obfProvider |
src/main/java/com/mumfrey/liteloader/transformers/event/EventProxyTransformer.java
@@ -9,8 +9,10 @@ import com.mumfrey.liteloader.core.runtime.Obf; | @@ -9,8 +9,10 @@ import com.mumfrey.liteloader.core.runtime.Obf; | ||
9 | import com.mumfrey.liteloader.transformers.ClassTransformer; | 9 | import com.mumfrey.liteloader.transformers.ClassTransformer; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | - * Transformer responsible for transforming/generating the EventProxy inner classes, separated from the Event Transformer | ||
13 | - * itself so that we can place it higher up the tranformer chain to avoid broken mod transformers screwing things up. | 12 | + * Transformer responsible for transforming/generating the EventProxy inner |
13 | + * classes, separated from the Event Transformer itself so that we can place it | ||
14 | + * higher up the tranformer chain to avoid broken mod transformers screwing | ||
15 | + * things up. | ||
14 | * | 16 | * |
15 | * @author Adam Mummery-Smith | 17 | * @author Adam Mummery-Smith |
16 | */ | 18 | */ |
@@ -63,7 +65,7 @@ public class EventProxyTransformer extends ClassTransformer | @@ -63,7 +65,7 @@ public class EventProxyTransformer extends ClassTransformer | ||
63 | method.instructions.clear(); | 65 | method.instructions.clear(); |
64 | method.instructions.add(new InsnNode(Opcodes.RETURN)); | 66 | method.instructions.add(new InsnNode(Opcodes.RETURN)); |
65 | } | 67 | } |
66 | - } | 68 | + } |
67 | 69 | ||
68 | return classNode; | 70 | return classNode; |
69 | } | 71 | } |
src/main/java/com/mumfrey/liteloader/transformers/event/EventTransformer.java
@@ -20,7 +20,7 @@ import org.objectweb.asm.tree.ClassNode; | @@ -20,7 +20,7 @@ import org.objectweb.asm.tree.ClassNode; | ||
20 | import org.objectweb.asm.tree.LocalVariableNode; | 20 | import org.objectweb.asm.tree.LocalVariableNode; |
21 | import org.objectweb.asm.tree.MethodNode; | 21 | import org.objectweb.asm.tree.MethodNode; |
22 | import org.objectweb.asm.util.CheckClassAdapter; | 22 | import org.objectweb.asm.util.CheckClassAdapter; |
23 | - | 23 | +import com.google.common.collect.Maps; |
24 | import com.mumfrey.liteloader.core.runtime.Obf; | 24 | import com.mumfrey.liteloader.core.runtime.Obf; |
25 | import com.mumfrey.liteloader.transformers.ByteCodeUtilities; | 25 | import com.mumfrey.liteloader.transformers.ByteCodeUtilities; |
26 | import com.mumfrey.liteloader.transformers.ClassTransformer; | 26 | import com.mumfrey.liteloader.transformers.ClassTransformer; |
@@ -30,29 +30,40 @@ import com.mumfrey.liteloader.util.log.LiteLoaderLogger; | @@ -30,29 +30,40 @@ import com.mumfrey.liteloader.util.log.LiteLoaderLogger; | ||
30 | import com.mumfrey.liteloader.util.log.LiteLoaderLogger.Verbosity; | 30 | import com.mumfrey.liteloader.util.log.LiteLoaderLogger.Verbosity; |
31 | 31 | ||
32 | /** | 32 | /** |
33 | - * EventTransformer is the spiritual successor to the CallbackInjectionTransformer and is a more advanced and flexible | ||
34 | - * version of the same premise. Like the CallbackInjectionTransformer, it can be used to inject callbacks intelligently | ||
35 | - * into a target method, however it has the following additional capabilities which make it more flexible and scalable: | 33 | + * EventTransformer is the spiritual successor to the |
34 | + * <tt>CallbackInjectionTransformer</tt> and is a more advanced and flexible | ||
35 | + * version of the same premise. Like the CallbackInjectionTransformer, it can be | ||
36 | + * used to inject callbacks intelligently into a target method, however it has | ||
37 | + * the following additional capabilities which make it more flexible and | ||
38 | + * scalable: | ||
36 | * | 39 | * |
37 | - * + Injections are not restricted to RETURN opcodes or profiler invokations, each injection is determined by | ||
38 | - * supplying an InjectionPoint instance to the {@code addEvent} method which is used to find the injection | ||
39 | - * point(s) in the method | 40 | + * <ul> |
41 | + * <li>Injections are not restricted to RETURN opcodes or profiler | ||
42 | + * invocations, each injection is determined by supplying an InjectionPoint | ||
43 | + * instance to the {@code addEvent} method which is used to find the | ||
44 | + * injection point(s) in the method.</li> | ||
40 | * | 45 | * |
41 | - * + Injected events can optionally be specified as *cancellable* which allows method execution to be pre-emptively | ||
42 | - * halted based on the cancellation status of the event. For methods with a return value, the return value may | ||
43 | - * be specified by the event handler. | 46 | + * <li>Injected events can optionally be specified as *cancellable* which |
47 | + * allows method execution to be pre-emptively halted based on the | ||
48 | + * cancellation status of the event. For methods with a return value, the | ||
49 | + * return value may be specified by the event handler.</li> | ||
44 | * | 50 | * |
45 | - * + Injected events call back against a dynamically-generated proxy class, this means that it is no longer necessary | ||
46 | - * to provide your own implementation of a static callback proxy, events can call back directly against handler | ||
47 | - * methods in your own codebase. | 51 | + * <li>Injected events call back against a dynamically-generated proxy |
52 | + * class, this means that it is no longer necessary to provide your own | ||
53 | + * implementation of a static callback proxy, events can call back directly | ||
54 | + * against handler methods in your own codebase.</li> | ||
48 | * | 55 | * |
49 | - * + Event injections are more intelligent about injecting at arbitrary points in the bytecode without corrupting the | ||
50 | - * local stack, and increase MAXS as required. | 56 | + * <li>Event injections are more intelligent about injecting at arbitrary |
57 | + * points in the bytecode without corrupting the local stack, and increase | ||
58 | + * MAXS as required.</li> | ||
51 | * | 59 | * |
52 | - * + Event injections do not "collide" like callback injections do - this means that if multiple events are injected | ||
53 | - * by multiple sources at the same point in the bytecode, then all event handlers will receive and handle the event | ||
54 | - * in one go. To provide for this, each event handler is defined with an intrinsic "priority" which determines its | ||
55 | - * call order when this situation occurs | 60 | + * <li>Event injections do not "collide" like callback injections do - this |
61 | + * means that if multiple events are injected by multiple sources at the | ||
62 | + * same point in the bytecode, then all event handlers will receive and | ||
63 | + * handle the event in one go. To provide for this, each event handler is | ||
64 | + * defined with an intrinsic "priority" which determines its call order when | ||
65 | + * this situation occurs</li> | ||
66 | + * </ul> | ||
56 | * | 67 | * |
57 | * @author Adam Mummery-Smith | 68 | * @author Adam Mummery-Smith |
58 | */ | 69 | */ |
@@ -63,9 +74,10 @@ public final class EventTransformer extends ClassTransformer | @@ -63,9 +74,10 @@ public final class EventTransformer extends ClassTransformer | ||
63 | public static final boolean VALIDATE = Booleans.parseBoolean(System.getProperty("liteloader.debug.validate"), false); | 74 | public static final boolean VALIDATE = Booleans.parseBoolean(System.getProperty("liteloader.debug.validate"), false); |
64 | 75 | ||
65 | /** | 76 | /** |
66 | - * Multidimensional map of class names -> target method signatures -> events to inject | 77 | + * Multidimensional map of class names -> target method signatures -> events |
78 | + * to inject. | ||
67 | */ | 79 | */ |
68 | - private static Map<String, Map<String, Map<Event, InjectionPoint>>> eventMappings = new HashMap<String, Map<String, Map<Event, InjectionPoint>>>(); | 80 | + private static Map<String, Map<String, Map<Event, InjectionPoint>>> eventMappings = Maps.newHashMap(); |
69 | 81 | ||
70 | private static AccessorTransformer accessorTransformer; | 82 | private static AccessorTransformer accessorTransformer; |
71 | 83 | ||
@@ -140,7 +152,9 @@ public final class EventTransformer extends ClassTransformer | @@ -140,7 +152,9 @@ public final class EventTransformer extends ClassTransformer | ||
140 | { | 152 | { |
141 | if (injectionPoint.captureLocals != this.captureLocals) | 153 | if (injectionPoint.captureLocals != this.captureLocals) |
142 | { | 154 | { |
143 | - throw new RuntimeException("Overlapping injection points defined with incompatible settings. Attempting to handle " + injectionPoint + " with capture locals [" + injectionPoint.captureLocals + "] but already defined injection point with [" + this.captureLocals + "]"); | 155 | + throw new RuntimeException("Overlapping injection points defined with incompatible settings. Attempting to handle " |
156 | + + injectionPoint + " with capture locals [" + injectionPoint.captureLocals + "] but already defined injection point with [" | ||
157 | + + this.captureLocals + "]"); | ||
144 | } | 158 | } |
145 | } | 159 | } |
146 | 160 | ||
@@ -339,7 +353,8 @@ public final class EventTransformer extends ClassTransformer | @@ -339,7 +353,8 @@ public final class EventTransformer extends ClassTransformer | ||
339 | LocalVariableNode local = locals[i]; | 353 | LocalVariableNode local = locals[i]; |
340 | if (local != null) | 354 | if (local != null) |
341 | { | 355 | { |
342 | - LiteLoaderLogger.debug(" Local[%d] %s %s", i, ByteCodeUtilities.getTypeName(Type.getType(local.desc)), local.name); | 356 | + LiteLoaderLogger.debug(" Local[%d] %s %s", i, ByteCodeUtilities.getTypeName(Type.getType(local.desc)), |
357 | + local.name); | ||
343 | } | 358 | } |
344 | } | 359 | } |
345 | LiteLoaderLogger.debug(ClassTransformer.HORIZONTAL_RULE); | 360 | LiteLoaderLogger.debug(ClassTransformer.HORIZONTAL_RULE); |
@@ -365,9 +380,11 @@ public final class EventTransformer extends ClassTransformer | @@ -365,9 +380,11 @@ public final class EventTransformer extends ClassTransformer | ||
365 | Event head = injection.getHead(); | 380 | Event head = injection.getHead(); |
366 | 381 | ||
367 | Verbosity verbosity = head.isVerbose() ? Verbosity.NORMAL : Verbosity.VERBOSE; | 382 | Verbosity verbosity = head.isVerbose() ? Verbosity.NORMAL : Verbosity.VERBOSE; |
368 | - LiteLoaderLogger.info(verbosity, "Injecting %s[x%d] in %s in %s", head.getName(), injection.size(), method.name, ClassTransformer.getSimpleClassName(classNode)); | 383 | + LiteLoaderLogger.info(verbosity, "Injecting %s[x%d] in %s in %s", head.getName(), injection.size(), method.name, |
384 | + ClassTransformer.getSimpleClassName(classNode)); | ||
369 | 385 | ||
370 | - MethodNode handler = head.inject(injectionPoint, injection.isCancellable(), this.globalEventID, injection.captureLocals(), injection.getLocalTypes()); | 386 | + MethodNode handler = head.inject(injectionPoint, injection.isCancellable(), this.globalEventID, injection.captureLocals(), |
387 | + injection.getLocalTypes()); | ||
371 | injection.addEventsToHandler(handler); | 388 | injection.addEventsToHandler(handler); |
372 | 389 | ||
373 | this.globalEventID++; | 390 | this.globalEventID++; |
src/main/java/com/mumfrey/liteloader/transformers/event/InjectionPoint.java
@@ -11,24 +11,29 @@ import org.objectweb.asm.tree.InsnList; | @@ -11,24 +11,29 @@ import org.objectweb.asm.tree.InsnList; | ||
11 | import com.google.common.base.Joiner; | 11 | import com.google.common.base.Joiner; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | - * Base class for injection point discovery classes. Each subclass describes a strategy for locating code injection | ||
15 | - * points within a method, with the {@code find} method populating a collection with insn nodes from the method | 14 | + * Base class for injection point discovery classes. Each subclass describes a |
15 | + * strategy for locating code injection points within a method, with the | ||
16 | + * {@link #find} method populating a collection with insn nodes from the method | ||
16 | * which satisfy its strategy. | 17 | * which satisfy its strategy. |
17 | * | 18 | * |
18 | - * This base class also contains composite strategy factory methods such as {@code and} and {@code or} which allow | ||
19 | - * strategies to be combined using intersection (and) or union (or) relationships to allow multiple strategies to | ||
20 | - * be easily combined. | 19 | + * <p>This base class also contains composite strategy factory methods such as |
20 | + * {@code and} and {@code or} which allow strategies to be combined using | ||
21 | + * intersection (and) or union (or) relationships to allow multiple strategies | ||
22 | + * to be easily combined.</p> | ||
21 | * | 23 | * |
22 | - * You are free to create your own injection point subclasses, but take note that it is allowed for a single | ||
23 | - * InjectionPoint instance to be used for multiple injections and thus implementing classes MUST NOT cache the insn | ||
24 | - * list, event, or nodes instance passed to the {@code find} method, as each call to {@code find} must be considered | ||
25 | - * a separate functional contract and the InjectionPoint's lifespan is not linked to the discovery lifespan, therefore | ||
26 | - * it is important that the InjectionPoint implementation is fully STATELESS. | 24 | + * <p>You are free to create your own injection point subclasses, but take note |
25 | + * that it is allowed for a single InjectionPoint instance to be used for | ||
26 | + * multiple injections and thus implementing classes MUST NOT cache the insn | ||
27 | + * list, event, or nodes instance passed to the {@code find} method, as each | ||
28 | + * call to {@code find} must be considered a separate functional contract and | ||
29 | + * the InjectionPoint's lifespan is not linked to the discovery lifespan, | ||
30 | + * therefore it is important that the InjectionPoint implementation is fully | ||
31 | + * STATELESS.</p> | ||
27 | * | 32 | * |
28 | * @author Adam Mummery-Smith | 33 | * @author Adam Mummery-Smith |
29 | */ | 34 | */ |
30 | public abstract class InjectionPoint | 35 | public abstract class InjectionPoint |
31 | -{ | 36 | +{ |
32 | /** | 37 | /** |
33 | * Capture locals as well as args | 38 | * Capture locals as well as args |
34 | */ | 39 | */ |
@@ -39,16 +44,22 @@ public abstract class InjectionPoint | @@ -39,16 +44,22 @@ public abstract class InjectionPoint | ||
39 | /** | 44 | /** |
40 | * Find injection points in the supplied insn list | 45 | * Find injection points in the supplied insn list |
41 | * | 46 | * |
42 | - * @param desc Method descriptor, supplied to allow return types and arguments etc. to be determined | ||
43 | - * @param insns Insn list to search in, the strategy MUST ONLY add nodes from this list to the {@code nodes} collection | ||
44 | - * @param nodes Collection of nodes to populate. Injectors should NOT make any assumptions about the state of this collection and should only call add() | ||
45 | - * @param event Event being injected here, supplied to allow alteration of behaviour for specific event configurations (eg. cancellable) | 47 | + * @param desc Method descriptor, supplied to allow return types and |
48 | + * arguments etc. to be determined | ||
49 | + * @param insns Insn list to search in, the strategy MUST ONLY add nodes | ||
50 | + * from this list to the {@code nodes} collection | ||
51 | + * @param nodes Collection of nodes to populate. Injectors should NOT make | ||
52 | + * any assumptions about the state of this collection and should only | ||
53 | + * call add() | ||
54 | + * @param event Event being injected here, supplied to allow alteration of | ||
55 | + * behaviour for specific event configurations (eg. cancellable) | ||
46 | * @return true if one or more injection points were found | 56 | * @return true if one or more injection points were found |
47 | */ | 57 | */ |
48 | public abstract boolean find(String desc, InsnList insns, Collection<AbstractInsnNode> nodes, Event event); | 58 | public abstract boolean find(String desc, InsnList insns, Collection<AbstractInsnNode> nodes, Event event); |
49 | 59 | ||
50 | /** | 60 | /** |
51 | - * Set whether this injection point should capture local variables as well as method arguments | 61 | + * Set whether this injection point should capture local variables as well |
62 | + * as method arguments. | ||
52 | * | 63 | * |
53 | * @param captureLocals | 64 | * @param captureLocals |
54 | * @return this, for fluent interface | 65 | * @return this, for fluent interface |
@@ -68,7 +79,8 @@ public abstract class InjectionPoint | @@ -68,7 +79,8 @@ public abstract class InjectionPoint | ||
68 | } | 79 | } |
69 | 80 | ||
70 | /** | 81 | /** |
71 | - * Since it's virtually impossible to know what locals are available at a given injection point by reading the source, this method causes the | 82 | + * Since it's virtually impossible to know what locals are available at a |
83 | + * given injection point by reading the source, this method causes the | ||
72 | * injection point to dump the locals to the debug log at injection time. | 84 | * injection point to dump the locals to the debug log at injection time. |
73 | * | 85 | * |
74 | * @param logLocals | 86 | * @param logLocals |
@@ -154,8 +166,12 @@ public abstract class InjectionPoint | @@ -154,8 +166,12 @@ public abstract class InjectionPoint | ||
154 | boolean in = true; | 166 | boolean in = true; |
155 | 167 | ||
156 | for (int b = 1; b < allNodes.length; b++) | 168 | for (int b = 1; b < allNodes.length; b++) |
169 | + { | ||
157 | if (!allNodes[b].contains(node)) | 170 | if (!allNodes[b].contains(node)) |
171 | + { | ||
158 | break; | 172 | break; |
173 | + } | ||
174 | + } | ||
159 | 175 | ||
160 | if (!in) continue; | 176 | if (!in) continue; |
161 | 177 | ||
@@ -259,8 +275,8 @@ public abstract class InjectionPoint | @@ -259,8 +275,8 @@ public abstract class InjectionPoint | ||
259 | } | 275 | } |
260 | 276 | ||
261 | /** | 277 | /** |
262 | - * Returns a composite injection point which returns the intersection of nodes from all component | ||
263 | - * injection points | 278 | + * Returns a composite injection point which returns the intersection of |
279 | + * nodes from all component injection points | ||
264 | * | 280 | * |
265 | * @param operands | 281 | * @param operands |
266 | */ | 282 | */ |
@@ -270,8 +286,8 @@ public abstract class InjectionPoint | @@ -270,8 +286,8 @@ public abstract class InjectionPoint | ||
270 | } | 286 | } |
271 | 287 | ||
272 | /** | 288 | /** |
273 | - * Returns a composite injection point which returns the union of nodes from all component | ||
274 | - * injection points | 289 | + * Returns a composite injection point which returns the union of nodes from |
290 | + * all component injection points. | ||
275 | * | 291 | * |
276 | * @param operands | 292 | * @param operands |
277 | */ | 293 | */ |
@@ -281,7 +297,8 @@ public abstract class InjectionPoint | @@ -281,7 +297,8 @@ public abstract class InjectionPoint | ||
281 | } | 297 | } |
282 | 298 | ||
283 | /** | 299 | /** |
284 | - * Returns an injection point which returns all insns immediately following insns from the supplied injection point | 300 | + * Returns an injection point which returns all insns immediately following |
301 | + * insns from the supplied injection point. | ||
285 | * | 302 | * |
286 | * @param point | 303 | * @param point |
287 | */ | 304 | */ |
@@ -291,7 +308,8 @@ public abstract class InjectionPoint | @@ -291,7 +308,8 @@ public abstract class InjectionPoint | ||
291 | } | 308 | } |
292 | 309 | ||
293 | /** | 310 | /** |
294 | - * Returns an injection point which returns all insns immediately prior to insns from the supplied injection point | 311 | + * Returns an injection point which returns all insns immediately prior to |
312 | + * insns from the supplied injection point. | ||
295 | * | 313 | * |
296 | * @param point | 314 | * @param point |
297 | */ | 315 | */ |
@@ -301,7 +319,8 @@ public abstract class InjectionPoint | @@ -301,7 +319,8 @@ public abstract class InjectionPoint | ||
301 | } | 319 | } |
302 | 320 | ||
303 | /** | 321 | /** |
304 | - * Returns an injection point which returns all insns offset by the specified "count" from insns from the supplied injection point | 322 | + * Returns an injection point which returns all insns offset by the |
323 | + * specified "count" from insns from the supplied injection point. | ||
305 | * | 324 | * |
306 | * @param point | 325 | * @param point |
307 | */ | 326 | */ |
src/main/java/com/mumfrey/liteloader/transformers/event/Jump.java
@@ -10,45 +10,45 @@ | @@ -10,45 +10,45 @@ | ||
10 | // | 10 | // |
11 | //public class Jump extends Event | 11 | //public class Jump extends Event |
12 | //{ | 12 | //{ |
13 | -// Jump(String name, boolean cancellable, int priority) | ||
14 | -// { | ||
15 | -// super(name, cancellable, priority); | ||
16 | -// } | ||
17 | -// | ||
18 | -// @Override | ||
19 | -// protected void validate(AbstractInsnNode injectionPoint, boolean cancellable, int globalEventID) | ||
20 | -// { | ||
21 | -// if (!(injectionPoint instanceof JumpInsnNode)) | ||
22 | -// { | ||
23 | -// throw new IllegalArgumentException("Attempted to inject a JUMP event where no JUMP is present"); | ||
24 | -// } | ||
25 | -// | ||
26 | -// super.validate(injectionPoint, cancellable, globalEventID); | ||
27 | -// } | ||
28 | -// | ||
29 | -// @Override | ||
30 | -// protected void injectCancellationCode(InsnList insns, AbstractInsnNode injectionPoint, int eventInfoVar) throws IllegalArgumentException | ||
31 | -// { | ||
32 | -// int opcode = injectionPoint.getOpcode(); | ||
33 | -// | ||
34 | -// if (opcode == Opcodes.JSR) throw new IllegalArgumentException("Can't jump on finally clause"); | ||
35 | -// | ||
36 | -// if (opcode == Opcodes.IFEQ || opcode == Opcodes.IFNE || opcode == Opcodes.IFLT || opcode == Opcodes.IFGE | ||
37 | -// || opcode == Opcodes.IFGT || opcode == Opcodes.IFLE || opcode == Opcodes.IFNULL || opcode == Opcodes.IFNONNULL) | ||
38 | -// { | ||
39 | -// insns.add(new InsnNode(Opcodes.POP)); | ||
40 | -// } | ||
41 | -// | ||
42 | -// if (opcode == Opcodes.IF_ICMPEQ || opcode == Opcodes.IF_ICMPNE || opcode == Opcodes.IF_ICMPLT || opcode == Opcodes.IF_ICMPGE | ||
43 | -// || opcode == Opcodes.IF_ICMPGT || opcode == Opcodes.IF_ICMPLE || opcode == Opcodes.IF_ACMPEQ || opcode == Opcodes.IF_ACMPNE) | ||
44 | -// { | ||
45 | -// insns.add(new InsnNode(Opcodes.POP)); | ||
46 | -// insns.add(new InsnNode(Opcodes.POP)); | ||
47 | -// } | ||
48 | -// | ||
49 | -// insns.add(new VarInsnNode(Opcodes.ALOAD, eventInfoVar)); | ||
50 | -// insns.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, this.eventInfoClass, "isCancelled", "()Z")); | ||
51 | -// | ||
52 | -// ((JumpInsnNode)injectionPoint).setOpcode(Opcodes.IFEQ); | ||
53 | -// } | 13 | +// Jump(String name, boolean cancellable, int priority) |
14 | +// { | ||
15 | +// super(name, cancellable, priority); | ||
16 | +// } | ||
17 | +// | ||
18 | +// @Override | ||
19 | +// protected void validate(AbstractInsnNode injectionPoint, boolean cancellable, int globalEventID) | ||
20 | +// { | ||
21 | +// if (!(injectionPoint instanceof JumpInsnNode)) | ||
22 | +// { | ||
23 | +// throw new IllegalArgumentException("Attempted to inject a JUMP event where no JUMP is present"); | ||
24 | +// } | ||
25 | +// | ||
26 | +// super.validate(injectionPoint, cancellable, globalEventID); | ||
27 | +// } | ||
28 | +// | ||
29 | +// @Override | ||
30 | +// protected void injectCancellationCode(InsnList insns, AbstractInsnNode injectionPoint, int eventInfoVar) throws IllegalArgumentException | ||
31 | +// { | ||
32 | +// int opcode = injectionPoint.getOpcode(); | ||
33 | +// | ||
34 | +// if (opcode == Opcodes.JSR) throw new IllegalArgumentException("Can't jump on finally clause"); | ||
35 | +// | ||
36 | +// if (opcode == Opcodes.IFEQ || opcode == Opcodes.IFNE || opcode == Opcodes.IFLT || opcode == Opcodes.IFGE | ||
37 | +// || opcode == Opcodes.IFGT || opcode == Opcodes.IFLE || opcode == Opcodes.IFNULL || opcode == Opcodes.IFNONNULL) | ||
38 | +// { | ||
39 | +// insns.add(new InsnNode(Opcodes.POP)); | ||
40 | +// } | ||
41 | +// | ||
42 | +// if (opcode == Opcodes.IF_ICMPEQ || opcode == Opcodes.IF_ICMPNE || opcode == Opcodes.IF_ICMPLT || opcode == Opcodes.IF_ICMPGE | ||
43 | +// || opcode == Opcodes.IF_ICMPGT || opcode == Opcodes.IF_ICMPLE || opcode == Opcodes.IF_ACMPEQ || opcode == Opcodes.IF_ACMPNE) | ||
44 | +// { | ||
45 | +// insns.add(new InsnNode(Opcodes.POP)); | ||
46 | +// insns.add(new InsnNode(Opcodes.POP)); | ||
47 | +// } | ||
48 | +// | ||
49 | +// insns.add(new VarInsnNode(Opcodes.ALOAD, eventInfoVar)); | ||
50 | +// insns.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, this.eventInfoClass, "isCancelled", "()Z")); | ||
51 | +// | ||
52 | +// ((JumpInsnNode)injectionPoint).setOpcode(Opcodes.IFEQ); | ||
53 | +// } | ||
54 | //} | 54 | //} |
src/main/java/com/mumfrey/liteloader/transformers/event/MethodInfo.java
@@ -6,8 +6,9 @@ import com.mumfrey.liteloader.core.runtime.Obf; | @@ -6,8 +6,9 @@ import com.mumfrey.liteloader.core.runtime.Obf; | ||
6 | import com.mumfrey.liteloader.transformers.ByteCodeUtilities; | 6 | import com.mumfrey.liteloader.transformers.ByteCodeUtilities; |
7 | 7 | ||
8 | /** | 8 | /** |
9 | - * Encapsulates a method descriptor with varying degrees of accuracy from a simpler owner/method mapping up to | ||
10 | - * and including a multi-faceted notch/srg/mcp method descriptor which works in all obfuscation environments. | 9 | + * Encapsulates a method descriptor with varying degrees of accuracy from a |
10 | + * simpler owner/method mapping up to and including a multi-faceted | ||
11 | + * notch/srg/mcp method descriptor which works in all obfuscation environments. | ||
11 | * | 12 | * |
12 | * @author Adam Mummery-Smith | 13 | * @author Adam Mummery-Smith |
13 | */ | 14 | */ |
@@ -35,7 +36,8 @@ public class MethodInfo | @@ -35,7 +36,8 @@ public class MethodInfo | ||
35 | final String sigObf; | 36 | final String sigObf; |
36 | 37 | ||
37 | /** | 38 | /** |
38 | - * Create a MethodInfo for the specified class with a method name inflected by context | 39 | + * Create a MethodInfo for the specified class with a method name inflected |
40 | + * by context | ||
39 | * | 41 | * |
40 | * @param owner Literal owner class name | 42 | * @param owner Literal owner class name |
41 | */ | 43 | */ |
@@ -45,7 +47,8 @@ public class MethodInfo | @@ -45,7 +47,8 @@ public class MethodInfo | ||
45 | } | 47 | } |
46 | 48 | ||
47 | /** | 49 | /** |
48 | - * Create a MethodInfo for the specified class with a method name inflected by context | 50 | + * Create a MethodInfo for the specified class with a method name inflected |
51 | + * by context | ||
49 | * | 52 | * |
50 | * @param owner Owner name descriptor | 53 | * @param owner Owner name descriptor |
51 | */ | 54 | */ |
@@ -88,11 +91,13 @@ public class MethodInfo | @@ -88,11 +91,13 @@ public class MethodInfo | ||
88 | } | 91 | } |
89 | 92 | ||
90 | /** | 93 | /** |
91 | - * Create a MethodInfo for the specified class, literal method name and literal descriptor | 94 | + * Create a MethodInfo for the specified class, literal method name and |
95 | + * literal descriptor | ||
92 | * | 96 | * |
93 | * @param owner Owner name descriptor | 97 | * @param owner Owner name descriptor |
94 | * @param method Literal method name | 98 | * @param method Literal method name |
95 | - * @param descriptor Literal descriptor (useful for methods which only accept primitive types and therefore have a fixed descriptor) | 99 | + * @param descriptor Literal descriptor (useful for methods which only |
100 | + * accept primitive types and therefore have a fixed descriptor) | ||
96 | */ | 101 | */ |
97 | public MethodInfo(Obf owner, String method, String descriptor) | 102 | public MethodInfo(Obf owner, String method, String descriptor) |
98 | { | 103 | { |
@@ -100,11 +105,13 @@ public class MethodInfo | @@ -100,11 +105,13 @@ public class MethodInfo | ||
100 | } | 105 | } |
101 | 106 | ||
102 | /** | 107 | /** |
103 | - * Create a MethodInfo for the specified literal class, literal method and literal descriptor | 108 | + * Create a MethodInfo for the specified literal class, literal method and |
109 | + * literal descriptor | ||
104 | * | 110 | * |
105 | * @param owner Literal class name | 111 | * @param owner Literal class name |
106 | * @param method Literal method name | 112 | * @param method Literal method name |
107 | - * @param descriptor Literal descriptor (useful for methods which only accept primitive types and therefore have a fixed descriptor) | 113 | + * @param descriptor Literal descriptor (useful for methods which only |
114 | + * accept primitive types and therefore have a fixed descriptor) | ||
108 | */ | 115 | */ |
109 | public MethodInfo(String owner, String method, String descriptor) | 116 | public MethodInfo(String owner, String method, String descriptor) |
110 | { | 117 | { |
@@ -112,11 +119,13 @@ public class MethodInfo | @@ -112,11 +119,13 @@ public class MethodInfo | ||
112 | } | 119 | } |
113 | 120 | ||
114 | /** | 121 | /** |
115 | - * Create a MethodInfo for the specified class and method, with a literal descriptor | 122 | + * Create a MethodInfo for the specified class and method, with a literal |
123 | + * descriptor | ||
116 | * | 124 | * |
117 | * @param owner Owner class name descriptor | 125 | * @param owner Owner class name descriptor |
118 | * @param method Method name descriptor | 126 | * @param method Method name descriptor |
119 | - * @param descriptor Literal descriptor (useful for methods which only accept primitive types and therefore have a fixed descriptor) | 127 | + * @param descriptor Literal descriptor (useful for methods which only |
128 | + * accept primitive types and therefore have a fixed descriptor) | ||
120 | */ | 129 | */ |
121 | public MethodInfo(Obf owner, Obf method, String descriptor) | 130 | public MethodInfo(Obf owner, Obf method, String descriptor) |
122 | { | 131 | { |
@@ -124,41 +133,61 @@ public class MethodInfo | @@ -124,41 +133,61 @@ public class MethodInfo | ||
124 | } | 133 | } |
125 | 134 | ||
126 | /** | 135 | /** |
127 | - * Create a MethodInfo for the specified class and literal method and compute the descriptor using the supplied arguments, both the | ||
128 | - * returnType and args values can be one of four types: | ||
129 | - * | ||
130 | - * + Obf instances - are converted to the appropriate class name for the obf type internally | ||
131 | - * + Strings - are added directly to the descriptor | ||
132 | - * + Type instances - are expanded to their bytecode literal | ||
133 | - * + Class instances - are expanded to their bytecode descriptor via Type.getDescriptor | 136 | + * <p>Create a MethodInfo for the specified class and literal method and |
137 | + * compute the descriptor using the supplied arguments, both the returnType | ||
138 | + * and args values can be one of four types:</p> | ||
139 | + * | ||
140 | + * <ul> | ||
141 | + * <li><b>Obf instances</b> - are converted to the appropriate class | ||
142 | + * name for the obf type internally</li> | ||
143 | + * <li><b>Strings</b> - are added directly to the descriptor</li> | ||
144 | + * <li><b>Type instances</b> - are expanded to their bytecode literal | ||
145 | + * </li> | ||
146 | + * <li><b>Class instances</b> - are expanded to their bytecode | ||
147 | + * descriptor via Type.getDescriptor</li> | ||
148 | + * </ul> | ||
134 | * | 149 | * |
135 | * @param owner Owner name descriptor | 150 | * @param owner Owner name descriptor |
136 | * @param method Literal method name | 151 | * @param method Literal method name |
137 | - * @param returnType Return type for the method (use Void.TYPE for void methods) | ||
138 | - * @param args (optional) list of method arguments as Obf/String/Type/Class instances | 152 | + * @param returnType Return type for the method (use Void.TYPE for void |
153 | + * methods) | ||
154 | + * @param args (optional) list of method arguments as Obf/String/Type/Class | ||
155 | + * instances | ||
139 | */ | 156 | */ |
140 | public MethodInfo(Obf owner, String method, Object returnType, Object... args) | 157 | public MethodInfo(Obf owner, String method, Object returnType, Object... args) |
141 | { | 158 | { |
142 | - this(owner.name, owner.obf, method, method, method, ByteCodeUtilities.generateDescriptor(Obf.MCP, returnType, args), ByteCodeUtilities.generateDescriptor(Obf.OBF, returnType, args)); | 159 | + this(owner.name, owner.obf, method, method, method, |
160 | + ByteCodeUtilities.generateDescriptor(Obf.MCP, returnType, args), | ||
161 | + ByteCodeUtilities.generateDescriptor(Obf.OBF, returnType, args)); | ||
143 | } | 162 | } |
144 | 163 | ||
145 | /** | 164 | /** |
146 | - * Create a MethodInfo for the specified class and method names and compute the descriptor using the supplied arguments, both the | ||
147 | - * returnType and args values can be one of four types: | ||
148 | - * | ||
149 | - * + Obf instances - are converted to the appropriate class name for the obf type internally | ||
150 | - * + Strings - are added directly to the descriptor | ||
151 | - * + Type instances - are expanded to their bytecode literal | ||
152 | - * + Class instances - are expanded to their bytecode descriptor via Type.getDescriptor | 165 | + * <p>Create a MethodInfo for the specified class and method names and |
166 | + * compute the descriptor using the supplied arguments, both the returnType | ||
167 | + * and args values can be one of four types:</p> | ||
168 | + * | ||
169 | + * <ul> | ||
170 | + * <li><b>Obf instances</b> - are converted to the appropriate class | ||
171 | + * name for the obf type internally</li> | ||
172 | + * <li><b>Strings</b> - are added directly to the descriptor</li> | ||
173 | + * <li><b>Type instances</b> - are expanded to their bytecode literal | ||
174 | + * </li> | ||
175 | + * <li><b>Class instances</b> - are expanded to their bytecode | ||
176 | + * descriptor via Type.getDescriptor</li> | ||
177 | + * </ul> | ||
153 | * | 178 | * |
154 | * @param owner Owner name descriptor | 179 | * @param owner Owner name descriptor |
155 | * @param method Method name descriptor | 180 | * @param method Method name descriptor |
156 | - * @param returnType Return type for the method (use Void.TYPE for void methods) | ||
157 | - * @param args (optional) list of method arguments as Obf/String/Type/Class instances | 181 | + * @param returnType Return type for the method (use Void.TYPE for void |
182 | + * methods) | ||
183 | + * @param args (optional) list of method arguments as Obf/String/Type/Class | ||
184 | + * instances | ||
158 | */ | 185 | */ |
159 | public MethodInfo(Obf owner, Obf method, Object returnType, Object... args) | 186 | public MethodInfo(Obf owner, Obf method, Object returnType, Object... args) |
160 | { | 187 | { |
161 | - this(owner.name, owner.obf, method.name, method.srg, method.obf, ByteCodeUtilities.generateDescriptor(Obf.MCP, returnType, args), ByteCodeUtilities.generateDescriptor(Obf.OBF, returnType, args)); | 188 | + this(owner.name, owner.obf, method.name, method.srg, method.obf, |
189 | + ByteCodeUtilities.generateDescriptor(Obf.MCP, returnType, args), | ||
190 | + ByteCodeUtilities.generateDescriptor(Obf.OBF, returnType, args)); | ||
162 | } | 191 | } |
163 | 192 | ||
164 | /** | 193 | /** |
@@ -194,7 +223,8 @@ public class MethodInfo | @@ -194,7 +223,8 @@ public class MethodInfo | ||
194 | } | 223 | } |
195 | 224 | ||
196 | /** | 225 | /** |
197 | - * Get the method's owning class's obfuscated name (if it has one, otherwise returns the same as getOwner()) | 226 | + * Get the method's owning class's obfuscated name (if it has one, otherwise |
227 | + * returns the same as getOwner()) | ||
198 | */ | 228 | */ |
199 | public String getOwnerObf() | 229 | public String getOwnerObf() |
200 | { | 230 | { |
@@ -218,7 +248,8 @@ public class MethodInfo | @@ -218,7 +248,8 @@ public class MethodInfo | ||
218 | } | 248 | } |
219 | 249 | ||
220 | /** | 250 | /** |
221 | - * Get the method name or inflects it using the supplied context if this MethodInfo was created with inflection enabled | 251 | + * Get the method name or inflects it using the supplied context if this |
252 | + * MethodInfo was created with inflection enabled | ||
222 | */ | 253 | */ |
223 | public String getOrInflectName(String context) | 254 | public String getOrInflectName(String context) |
224 | { | 255 | { |
@@ -226,7 +257,8 @@ public class MethodInfo | @@ -226,7 +257,8 @@ public class MethodInfo | ||
226 | } | 257 | } |
227 | 258 | ||
228 | /** | 259 | /** |
229 | - * Get the Searge name of the method (if it has one, otherwise returns the base name) | 260 | + * Get the Searge name of the method (if it has one, otherwise returns the |
261 | + * base name) | ||
230 | */ | 262 | */ |
231 | public String getNameSrg() | 263 | public String getNameSrg() |
232 | { | 264 | { |
@@ -234,7 +266,8 @@ public class MethodInfo | @@ -234,7 +266,8 @@ public class MethodInfo | ||
234 | } | 266 | } |
235 | 267 | ||
236 | /** | 268 | /** |
237 | - * Get the obfuscated name of the method (if it has one, otherwise returns the base name) | 269 | + * Get the obfuscated name of the method (if it has one, otherwise returns |
270 | + * the base name) | ||
238 | */ | 271 | */ |
239 | public String getNameObf() | 272 | public String getNameObf() |
240 | { | 273 | { |
@@ -258,7 +291,8 @@ public class MethodInfo | @@ -258,7 +291,8 @@ public class MethodInfo | ||
258 | } | 291 | } |
259 | 292 | ||
260 | /** | 293 | /** |
261 | - * Get the method descriptor with obfuscated parameter types (if available, otherwise returns the same as getDesc()) | 294 | + * Get the method descriptor with obfuscated parameter types (if available, |
295 | + * otherwise returns the same as getDesc()) | ||
262 | */ | 296 | */ |
263 | public String getDescObf() | 297 | public String getDescObf() |
264 | { | 298 | { |
@@ -282,7 +316,8 @@ public class MethodInfo | @@ -282,7 +316,8 @@ public class MethodInfo | ||
282 | } | 316 | } |
283 | 317 | ||
284 | /** | 318 | /** |
285 | - * Get the signature (combined method name and descriptor) for the method represented by this methodInfo | 319 | + * Get the signature (combined method name and descriptor) for the method |
320 | + * represented by this methodInfo | ||
286 | * | 321 | * |
287 | * @param type Obfuscation type to use | 322 | * @param type Obfuscation type to use |
288 | */ | 323 | */ |
src/main/java/com/mumfrey/liteloader/transformers/event/ReadOnlyInsnList.java
@@ -87,7 +87,7 @@ public class ReadOnlyInsnList extends InsnList | @@ -87,7 +87,7 @@ public class ReadOnlyInsnList extends InsnList | ||
87 | @Override | 87 | @Override |
88 | public AbstractInsnNode[] toArray() | 88 | public AbstractInsnNode[] toArray() |
89 | { | 89 | { |
90 | - // throw new UnsupportedOperationException(); | 90 | +// throw new UnsupportedOperationException(); |
91 | return this.insnList.toArray(); | 91 | return this.insnList.toArray(); |
92 | } | 92 | } |
93 | 93 |
src/main/java/com/mumfrey/liteloader/transformers/event/ReturnEventInfo.java
@@ -9,7 +9,8 @@ import com.mumfrey.liteloader.core.event.EventCancellationException; | @@ -9,7 +9,8 @@ import com.mumfrey.liteloader.core.event.EventCancellationException; | ||
9 | * | 9 | * |
10 | * @author Adam Mummery-Smith | 10 | * @author Adam Mummery-Smith |
11 | * | 11 | * |
12 | - * @param <S> Source object type. For non-static methods this will be the containing object instance. | 12 | + * @param <S> Source object type. For non-static methods this will be the |
13 | + * containing object instance. | ||
13 | * @param <R> Return type | 14 | * @param <R> Return type |
14 | */ | 15 | */ |
15 | public class ReturnEventInfo<S, R> extends EventInfo<S> | 16 | public class ReturnEventInfo<S, R> extends EventInfo<S> |
@@ -85,7 +86,8 @@ public class ReturnEventInfo<S, R> extends EventInfo<S> | @@ -85,7 +86,8 @@ public class ReturnEventInfo<S, R> extends EventInfo<S> | ||
85 | } | 86 | } |
86 | 87 | ||
87 | /** | 88 | /** |
88 | - * Sets a return value for this event and cancels the event (required in order to return the new value) | 89 | + * Sets a return value for this event and cancels the event (required in |
90 | + * order to return the new value). | ||
89 | * | 91 | * |
90 | * @param returnValue | 92 | * @param returnValue |
91 | */ | 93 | */ |
@@ -94,7 +96,7 @@ public class ReturnEventInfo<S, R> extends EventInfo<S> | @@ -94,7 +96,7 @@ public class ReturnEventInfo<S, R> extends EventInfo<S> | ||
94 | super.cancel(); | 96 | super.cancel(); |
95 | 97 | ||
96 | this.returnValue = returnValue; | 98 | this.returnValue = returnValue; |
97 | - } | 99 | + } |
98 | 100 | ||
99 | public R getReturnValue() | 101 | public R getReturnValue() |
100 | { | 102 | { |
src/main/java/com/mumfrey/liteloader/transformers/event/inject/BeforeFieldAccess.java
@@ -7,9 +7,11 @@ import com.mumfrey.liteloader.core.runtime.Obf; | @@ -7,9 +7,11 @@ import com.mumfrey.liteloader.core.runtime.Obf; | ||
7 | import com.mumfrey.liteloader.transformers.event.MethodInfo; | 7 | import com.mumfrey.liteloader.transformers.event.MethodInfo; |
8 | 8 | ||
9 | /** | 9 | /** |
10 | - * An injection point which searches for GETFIELD and SETFIELD opcodes matching its arguments and returns a list of insns | ||
11 | - * immediately prior to matching instructions. Only the field name is required, owners and signatures are optional and can | ||
12 | - * be used to disambiguate between fields of the same name but with different types, or belonging to different classes. | 10 | + * An injection point which searches for GETFIELD and SETFIELD opcodes matching |
11 | + * its arguments and returns a list of insns immediately prior to matching | ||
12 | + * instructions. Only the field name is required, owners and signatures are | ||
13 | + * optional and can be used to disambiguate between fields of the same name but | ||
14 | + * with different types, or belonging to different classes. | ||
13 | * | 15 | * |
14 | * @author Adam Mummery-Smith | 16 | * @author Adam Mummery-Smith |
15 | */ | 17 | */ |
src/main/java/com/mumfrey/liteloader/transformers/event/inject/BeforeInvoke.java
@@ -15,9 +15,11 @@ import com.mumfrey.liteloader.transformers.event.MethodInfo; | @@ -15,9 +15,11 @@ import com.mumfrey.liteloader.transformers.event.MethodInfo; | ||
15 | import com.mumfrey.liteloader.util.log.LiteLoaderLogger; | 15 | import com.mumfrey.liteloader.util.log.LiteLoaderLogger; |
16 | 16 | ||
17 | /** | 17 | /** |
18 | - * An injection point which searches for method invokations matching its arguments and returns a list of insns immediately | ||
19 | - * prior to matching invokations. Only the method name is required, owners and signatures are optional and can be used to disambiguate | ||
20 | - * between methods of the same name but with different args, or belonging to different classes. | 18 | + * An injection point which searches for method invocations matching its |
19 | + * arguments and returns a list of insns immediately prior to matching | ||
20 | + * invocations. Only the method name is required, owners and signatures are | ||
21 | + * optional and can be used to disambiguate between methods of the same name but | ||
22 | + * with different args, or belonging to different classes. | ||
21 | * | 23 | * |
22 | * @author Adam Mummery-Smith | 24 | * @author Adam Mummery-Smith |
23 | */ | 25 | */ |
@@ -53,25 +55,29 @@ public class BeforeInvoke extends InjectionPoint | @@ -53,25 +55,29 @@ public class BeforeInvoke extends InjectionPoint | ||
53 | } | 55 | } |
54 | 56 | ||
55 | /** | 57 | /** |
56 | - * Method name(s) to search for, usually this will contain the different names of the method for different obfuscations (mcp, srg, notch) | 58 | + * Method name(s) to search for, usually this will contain the different |
59 | + * names of the method for different obfuscations (mcp, srg, notch) | ||
57 | */ | 60 | */ |
58 | protected final String[] methodNames; | 61 | protected final String[] methodNames; |
59 | 62 | ||
60 | /** | 63 | /** |
61 | - * Method owner(s) to search for, the values in this array MUST much the equivalent indices in methodNames, if the array is NULL then | ||
62 | - * all owners are valid | 64 | + * Method owner(s) to search for, the values in this array MUST much the |
65 | + * equivalent indices in methodNames, if the array is NULL then all owners | ||
66 | + * are valid. | ||
63 | */ | 67 | */ |
64 | protected final String[] methodOwners; | 68 | protected final String[] methodOwners; |
65 | 69 | ||
66 | /** | 70 | /** |
67 | - * Method signature(s) to search for, the values in this array MUST much the equivalent indices in methodNames, if the array is NULL | ||
68 | - * then all signatures are valid | 71 | + * Method signature(s) to search for, the values in this array MUST much the |
72 | + * equivalent indices in methodNames, if the array is NULL then all | ||
73 | + * signatures are valid. | ||
69 | */ | 74 | */ |
70 | protected final String[] methodSignatures; | 75 | protected final String[] methodSignatures; |
71 | 76 | ||
72 | /** | 77 | /** |
73 | - * This strategy can be used to identify a particular invokation if the same method is invoked at multiple points, if this value is -1 | ||
74 | - * then the strategy returns ALL invokations of the method. | 78 | + * This strategy can be used to identify a particular invocation if the same |
79 | + * method is invoked at multiple points, if this value is -1 then the | ||
80 | + * strategy returns ALL invocations of the method. | ||
75 | */ | 81 | */ |
76 | protected final int ordinal; | 82 | protected final int ordinal; |
77 | 83 | ||
@@ -93,10 +99,11 @@ public class BeforeInvoke extends InjectionPoint | @@ -93,10 +99,11 @@ public class BeforeInvoke extends InjectionPoint | ||
93 | } | 99 | } |
94 | 100 | ||
95 | /** | 101 | /** |
96 | - * Match the specified invokation of the specified method | 102 | + * Match the specified invocation of the specified method |
97 | * | 103 | * |
98 | * @param methodName Method name to search for | 104 | * @param methodName Method name to search for |
99 | - * @param ordinal ID of the invokation to hook, or -1 to hook all invokations | 105 | + * @param ordinal ID of the invocation to hook, or -1 to hook all |
106 | + * invocations | ||
100 | */ | 107 | */ |
101 | public BeforeInvoke(String methodName, int ordinal) | 108 | public BeforeInvoke(String methodName, int ordinal) |
102 | { | 109 | { |
@@ -104,10 +111,11 @@ public class BeforeInvoke extends InjectionPoint | @@ -104,10 +111,11 @@ public class BeforeInvoke extends InjectionPoint | ||
104 | } | 111 | } |
105 | 112 | ||
106 | /** | 113 | /** |
107 | - * Match the specified invokation of the specified method(s) | 114 | + * Match the specified invocation of the specified method(s) |
108 | * | 115 | * |
109 | * @param methodNames Method names to search for | 116 | * @param methodNames Method names to search for |
110 | - * @param ordinal ID of the invokation to hook, or -1 to hook all invokations | 117 | + * @param ordinal ID of the invocation to hook, or -1 to hook all |
118 | + * invocations | ||
111 | */ | 119 | */ |
112 | public BeforeInvoke(String[] methodNames, int ordinal) | 120 | public BeforeInvoke(String[] methodNames, int ordinal) |
113 | { | 121 | { |
@@ -115,12 +123,16 @@ public class BeforeInvoke extends InjectionPoint | @@ -115,12 +123,16 @@ public class BeforeInvoke extends InjectionPoint | ||
115 | } | 123 | } |
116 | 124 | ||
117 | /** | 125 | /** |
118 | - * Match all occurrences of the specified method or methods with the specified owners | 126 | + * Match all occurrences of the specified method or methods with the |
127 | + * specified owners. | ||
119 | * | 128 | * |
120 | * @param methodNames Method names to search for | 129 | * @param methodNames Method names to search for |
121 | - * @param methodOwners Owners to search for, indices in this array MUST match the indices in methodNames, eg. if methodNames contains | ||
122 | - * { "mcpName", "func_12345_a", "a" } then methodOwners should contain { "net/minecraft/pkg/ClassName", "net/minecraft/pkg/ClassName", "abc" } | ||
123 | - * in order that the appropriate owner name obfuscation matches the corresponding index in the methodNames array | 130 | + * @param methodOwners Owners to search for, indices in this array MUST |
131 | + * match the indices in methodNames, eg. if methodNames contains | ||
132 | + * { "mcpName", "func_12345_a", "a" } then methodOwners should contain | ||
133 | + * { "net/minecraft/pkg/ClsName", "net/minecraft/pkg/ClsName", "abc" } | ||
134 | + * in order that the appropriate owner name obfuscation matches the | ||
135 | + * corresponding index in the methodNames array | ||
124 | */ | 136 | */ |
125 | public BeforeInvoke(String[] methodNames, String[] methodOwners) | 137 | public BeforeInvoke(String[] methodNames, String[] methodOwners) |
126 | { | 138 | { |
@@ -128,13 +140,17 @@ public class BeforeInvoke extends InjectionPoint | @@ -128,13 +140,17 @@ public class BeforeInvoke extends InjectionPoint | ||
128 | } | 140 | } |
129 | 141 | ||
130 | /** | 142 | /** |
131 | - * Match the specified invokation of the specified method or methods with the specified owners | 143 | + * Match the specified invocation of the specified method or methods with |
144 | + * the specified owners. | ||
132 | * | 145 | * |
133 | * @param methodNames Method names to search for | 146 | * @param methodNames Method names to search for |
134 | - * @param methodOwners Owners to search for, indices in this array MUST match the indices in methodNames, eg. if methodNames contains | ||
135 | - * { "mcpName", "func_12345_a", "a" } then methodOwners should contain { "net/minecraft/pkg/ClassName", "net/minecraft/pkg/ClassName", "abc" } | ||
136 | - * in order that the appropriate owner name obfuscation matches the corresponding index in the methodNames array | ||
137 | - * @param ordinal ID of the invokation to hook, or -1 to hook all invokations | 147 | + * @param methodOwners Owners to search for, indices in this array MUST |
148 | + * match the indices in methodNames, eg. if methodNames contains | ||
149 | + * { "mcpName", "func_12345_a", "a" } then methodOwners should contain | ||
150 | + * { "net/minecraft/pkg/ClsName", "net/minecraft/pkg/ClsName", "abc" } | ||
151 | + * in order that the appropriate owner name obfuscation matches the | ||
152 | + * corresponding index in the methodNames array | ||
153 | + * @param ordinal ID of the invocation to hook or -1 to hook all invocations | ||
138 | */ | 154 | */ |
139 | public BeforeInvoke(String[] methodNames, String[] methodOwners, int ordinal) | 155 | public BeforeInvoke(String[] methodNames, String[] methodOwners, int ordinal) |
140 | { | 156 | { |
@@ -142,16 +158,26 @@ public class BeforeInvoke extends InjectionPoint | @@ -142,16 +158,26 @@ public class BeforeInvoke extends InjectionPoint | ||
142 | } | 158 | } |
143 | 159 | ||
144 | /** | 160 | /** |
145 | - * Match all occurrences of the specified method or methods with the specified owners or signatures, pass null to the owners array if you | ||
146 | - * only want to match signatures | 161 | + * Match all occurrences of the specified method or methods with the |
162 | + * specified owners or signatures, pass null to the owners array if you only | ||
163 | + * want to match signatures. | ||
147 | * | 164 | * |
148 | * @param methodNames Method names to search for | 165 | * @param methodNames Method names to search for |
149 | - * @param methodOwners Owners to search for, indices in this array MUST match the indices in methodNames, eg. if methodNames contains | ||
150 | - * { "mcpName", "func_12345_a", "a" } then methodOwners should contain { "net/minecraft/pkg/ClassName", "net/minecraft/pkg/ClassName", "abc" } | ||
151 | - * in order that the appropriate owner name obfuscation matches the corresponding index in the methodNames array | ||
152 | - * @param methodSignatures Signatures to search for, indices in this array MUST match the indices in methodNames, eg. if methodNames contains | ||
153 | - * { "mcpName", "func_12345_a", "a" } then methodSignatures should contain { "(Lnet/minecraft/pkg/ClassName;)V", "(Lnet/minecraft/pkg/ClassName;)V", "(Labc;)V" } | ||
154 | - * in order that the appropriate signature obfuscation matches the corresponding index in the methodNames array (and ownerNames array if present) | 166 | + * @param methodOwners Owners to search for, indices in this array MUST |
167 | + * match the indices in methodNames, eg. if methodNames contains | ||
168 | + * { "mcpName", "func_12345_a", "a" } then methodOwners should contain | ||
169 | + * { "net/minecraft/pkg/ClsName", "net/minecraft/pkg/ClsName", "abc" } | ||
170 | + * in order that the appropriate owner name obfuscation matches the | ||
171 | + * corresponding index in the methodNames array | ||
172 | + * @param methodSignatures Signatures to search for, indices in this array | ||
173 | + * MUST match the indices in methodNames, eg. if methodNames contains | ||
174 | + * { "mcpName", "func_12345_a", "a" } then methodSignatures should | ||
175 | + * contain | ||
176 | + * { "(Lnet/minecraft/pkg/ClsName;)V", | ||
177 | + * "(Lnet/minecraft/pkg/ClsName;)V", "(Labc;)V" } | ||
178 | + * in order that the appropriate signature obfuscation matches the | ||
179 | + * corresponding index in the methodNames array (and ownerNames array | ||
180 | + * if present) | ||
155 | */ | 181 | */ |
156 | public BeforeInvoke(String[] methodNames, String[] methodOwners, String[] methodSignatures) | 182 | public BeforeInvoke(String[] methodNames, String[] methodOwners, String[] methodSignatures) |
157 | { | 183 | { |
@@ -159,22 +185,33 @@ public class BeforeInvoke extends InjectionPoint | @@ -159,22 +185,33 @@ public class BeforeInvoke extends InjectionPoint | ||
159 | } | 185 | } |
160 | 186 | ||
161 | /** | 187 | /** |
162 | - * Match the specified invokation of the specified method or methods with the specified owners or signatures, pass null to the owners array if you | ||
163 | - * only want to match signatures | 188 | + * Match the specified invocation of the specified method or methods with |
189 | + * the specified owners or signatures, pass null to the owners array if you | ||
190 | + * only want to match signatures. | ||
164 | * | 191 | * |
165 | * @param methodNames Method names to search for | 192 | * @param methodNames Method names to search for |
166 | - * @param methodOwners Owners to search for, indices in this array MUST match the indices in methodNames, eg. if methodNames contains | ||
167 | - * { "mcpName", "func_12345_a", "a" } then methodOwners should contain { "net/minecraft/pkg/ClassName", "net/minecraft/pkg/ClassName", "abc" } | ||
168 | - * in order that the appropriate owner name obfuscation matches the corresponding index in the methodNames array | ||
169 | - * @param methodSignatures Signatures to search for, indices in this array MUST match the indices in methodNames, eg. if methodNames contains | ||
170 | - * { "mcpName", "func_12345_a", "a" } then methodSignatures should contain { "(Lnet/minecraft/pkg/ClassName;)V", "(Lnet/minecraft/pkg/ClassName;)V", "(Labc;)V" } | ||
171 | - * in order that the appropriate signature obfuscation matches the corresponding index in the methodNames array (and ownerNames array if present) | ||
172 | - * @param ordinal ID of the invokation to hook, or -1 to hook all invokations | 193 | + * @param methodOwners Owners to search for, indices in this array MUST |
194 | + * match the indices in methodNames, eg. if methodNames contains | ||
195 | + * { "mcpName", "func_12345_a", "a" } then methodOwners should contain | ||
196 | + * { "net/minecraft/pkg/ClsName", "net/minecraft/pkg/ClsName", "abc" } | ||
197 | + * in order that the appropriate owner name obfuscation matches the | ||
198 | + * corresponding index in the methodNames array | ||
199 | + * @param methodSignatures Signatures to search for, indices in this array | ||
200 | + * MUST match the indices in methodNames, eg. if methodNames contains | ||
201 | + * { "mcpName", "func_12345_a", "a" } then methodSignatures should | ||
202 | + * contain { "(Lnet/minecraft/pkg/ClassName;)V", | ||
203 | + * "(Lnet/minecraft/pkg/ClassName;)V", "(Labc;)V" } | ||
204 | + * in order that the appropriate signature obfuscation matches the | ||
205 | + * corresponding index in the methodNames array (and ownerNames array | ||
206 | + * if present) | ||
207 | + * @param ordinal ID of the invocation to hook or -1 to hook all invocations | ||
173 | */ | 208 | */ |
174 | public BeforeInvoke(String[] methodNames, String[] methodOwners, String[] methodSignatures, int ordinal) | 209 | public BeforeInvoke(String[] methodNames, String[] methodOwners, String[] methodSignatures, int ordinal) |
175 | { | 210 | { |
176 | if (methodNames == null || methodNames.length == 0) | 211 | if (methodNames == null || methodNames.length == 0) |
177 | - throw new IllegalArgumentException("Method name selector must not be null"); | 212 | + { |
213 | + throw new IllegalArgumentException("Method name selector must not be null"); | ||
214 | + } | ||
178 | 215 | ||
179 | if (methodSignatures != null && methodSignatures.length == 0) methodSignatures = null; | 216 | if (methodSignatures != null && methodSignatures.length == 0) methodSignatures = null; |
180 | if (methodOwners != null && methodOwners.length == 0) methodOwners = null; | 217 | if (methodOwners != null && methodOwners.length == 0) methodOwners = null; |
@@ -190,7 +227,7 @@ public class BeforeInvoke extends InjectionPoint | @@ -190,7 +227,7 @@ public class BeforeInvoke extends InjectionPoint | ||
190 | } | 227 | } |
191 | 228 | ||
192 | /** | 229 | /** |
193 | - * Match the invokation described by the supplied MethodInfo | 230 | + * Match the invocation described by the supplied MethodInfo |
194 | * | 231 | * |
195 | * @param method | 232 | * @param method |
196 | */ | 233 | */ |
@@ -200,7 +237,8 @@ public class BeforeInvoke extends InjectionPoint | @@ -200,7 +237,8 @@ public class BeforeInvoke extends InjectionPoint | ||
200 | } | 237 | } |
201 | 238 | ||
202 | /** | 239 | /** |
203 | - * Match the invokation described by the supplied MethodInfo at the specified ordinal | 240 | + * Match the invocation described by the supplied MethodInfo at the |
241 | + * specified ordinal. | ||
204 | * | 242 | * |
205 | * @param method | 243 | * @param method |
206 | * @param ordinal | 244 | * @param ordinal |
@@ -239,7 +277,11 @@ public class BeforeInvoke extends InjectionPoint | @@ -239,7 +277,11 @@ public class BeforeInvoke extends InjectionPoint | ||
239 | } | 277 | } |
240 | 278 | ||
241 | /* (non-Javadoc) | 279 | /* (non-Javadoc) |
242 | - * @see com.mumfrey.liteloader.transformers.event.InjectionStrategy#findInjectionPoint(java.lang.String, org.objectweb.asm.tree.InsnList, com.mumfrey.liteloader.transformers.event.Event, java.util.Collection) | 280 | + * @see com.mumfrey.liteloader.transformers.event.InjectionStrategy |
281 | + * #findInjectionPoint(java.lang.String, | ||
282 | + * org.objectweb.asm.tree.InsnList, | ||
283 | + * com.mumfrey.liteloader.transformers.event.Event, | ||
284 | + * java.util.Collection) | ||
243 | */ | 285 | */ |
244 | @Override | 286 | @Override |
245 | public boolean find(String desc, InsnList insns, Collection<AbstractInsnNode> nodes, Event event) | 287 | public boolean find(String desc, InsnList insns, Collection<AbstractInsnNode> nodes, Event event) |
@@ -262,7 +304,11 @@ public class BeforeInvoke extends InjectionPoint | @@ -262,7 +304,11 @@ public class BeforeInvoke extends InjectionPoint | ||
262 | { | 304 | { |
263 | InsnInfo nodeInfo = new InsnInfo(insn); | 305 | InsnInfo nodeInfo = new InsnInfo(insn); |
264 | 306 | ||
265 | - if (this.logging) LiteLoaderLogger.debug(this.className + " is considering insn NAME=%s DESC=%s OWNER=%s", nodeInfo.name, nodeInfo.desc, nodeInfo.owner); | 307 | + if (this.logging) |
308 | + { | ||
309 | + LiteLoaderLogger.debug(this.className + " is considering insn NAME=%s DESC=%s OWNER=%s", | ||
310 | + nodeInfo.name, nodeInfo.desc, nodeInfo.owner); | ||
311 | + } | ||
266 | 312 | ||
267 | int index = BeforeInvoke.arrayIndexOf(this.methodNames, nodeInfo.name, -1); | 313 | int index = BeforeInvoke.arrayIndexOf(this.methodNames, nodeInfo.name, -1); |
268 | if (index > -1 && this.logging) LiteLoaderLogger.debug(this.className + " found a matching insn, checking owner/signature..."); | 314 | if (index > -1 && this.logging) LiteLoaderLogger.debug(this.className + " found a matching insn, checking owner/signature..."); |
@@ -279,7 +325,9 @@ public class BeforeInvoke extends InjectionPoint | @@ -279,7 +325,9 @@ public class BeforeInvoke extends InjectionPoint | ||
279 | found = true; | 325 | found = true; |
280 | 326 | ||
281 | if (this.ordinal == ordinal) | 327 | if (this.ordinal == ordinal) |
328 | + { | ||
282 | break; | 329 | break; |
330 | + } | ||
283 | } | 331 | } |
284 | 332 | ||
285 | ordinal++; | 333 | ordinal++; |
@@ -306,13 +354,17 @@ public class BeforeInvoke extends InjectionPoint | @@ -306,13 +354,17 @@ public class BeforeInvoke extends InjectionPoint | ||
306 | 354 | ||
307 | protected boolean matchesInsn(InsnInfo nodeInfo, int ordinal) | 355 | protected boolean matchesInsn(InsnInfo nodeInfo, int ordinal) |
308 | { | 356 | { |
309 | - if (this.logging) LiteLoaderLogger.debug(this.className + " comparing target ordinal %d with current ordinal %d", this.ordinal, ordinal); | 357 | + if (this.logging) |
358 | + { | ||
359 | + LiteLoaderLogger.debug(this.className + " comparing target ordinal %d with current ordinal %d", this.ordinal, ordinal); | ||
360 | + } | ||
310 | return this.ordinal == -1 || this.ordinal == ordinal; | 361 | return this.ordinal == -1 || this.ordinal == ordinal; |
311 | } | 362 | } |
312 | 363 | ||
313 | /** | 364 | /** |
314 | - * Special version of contains which returns TRUE if the haystack array is null, which is an odd behaviour we actually | ||
315 | - * want here because null indicates that the value is not important | 365 | + * Special version of contains which returns TRUE if the haystack array is |
366 | + * null, which is an odd behaviour we actually want here because null | ||
367 | + * indicates that the value is not important. | ||
316 | * | 368 | * |
317 | * @param haystack | 369 | * @param haystack |
318 | * @param needle | 370 | * @param needle |
@@ -323,7 +375,12 @@ public class BeforeInvoke extends InjectionPoint | @@ -323,7 +375,12 @@ public class BeforeInvoke extends InjectionPoint | ||
323 | if (pos > -1 && pos < haystack.length && needle.equals(haystack[pos])) return pos; | 375 | if (pos > -1 && pos < haystack.length && needle.equals(haystack[pos])) return pos; |
324 | 376 | ||
325 | for (int index = 0; index < haystack.length; index++) | 377 | for (int index = 0; index < haystack.length; index++) |
326 | - if (needle.equals(haystack[index])) return index; | 378 | + { |
379 | + if (needle.equals(haystack[index])) | ||
380 | + { | ||
381 | + return index; | ||
382 | + } | ||
383 | + } | ||
327 | 384 | ||
328 | return -1; | 385 | return -1; |
329 | } | 386 | } |
src/main/java/com/mumfrey/liteloader/transformers/event/inject/BeforeReturn.java
@@ -13,8 +13,8 @@ import com.mumfrey.liteloader.transformers.event.Event; | @@ -13,8 +13,8 @@ import com.mumfrey.liteloader.transformers.event.Event; | ||
13 | import com.mumfrey.liteloader.transformers.event.InjectionPoint; | 13 | import com.mumfrey.liteloader.transformers.event.InjectionPoint; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | - * An injection point which searches for RETURN opcodes in the supplied method and either finds all insns or | ||
17 | - * the insn at the specified ordinal | 16 | + * An injection point which searches for RETURN opcodes in the supplied method |
17 | + * and either finds all insns or the insn at the specified ordinal. | ||
18 | * | 18 | * |
19 | * @author Adam Mummery-Smith | 19 | * @author Adam Mummery-Smith |
20 | */ | 20 | */ |
src/main/java/com/mumfrey/liteloader/transformers/event/inject/BeforeStringInvoke.java
@@ -11,7 +11,8 @@ import com.mumfrey.liteloader.transformers.event.MethodInfo; | @@ -11,7 +11,8 @@ import com.mumfrey.liteloader.transformers.event.MethodInfo; | ||
11 | import com.mumfrey.liteloader.util.log.LiteLoaderLogger; | 11 | import com.mumfrey.liteloader.util.log.LiteLoaderLogger; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | - * An injection point which searches for a matching String LDC insn immediately prior to a qualifying invoke | 14 | + * An injection point which searches for a matching String LDC insn immediately |
15 | + * prior to a qualifying invoke. | ||
15 | * | 16 | * |
16 | * @author Adam Mummery-Smith | 17 | * @author Adam Mummery-Smith |
17 | */ | 18 | */ |
@@ -34,8 +35,12 @@ public class BeforeStringInvoke extends BeforeInvoke | @@ -34,8 +35,12 @@ public class BeforeStringInvoke extends BeforeInvoke | ||
34 | this.ldcValue = ldcValue; | 35 | this.ldcValue = ldcValue; |
35 | 36 | ||
36 | for (int i = 0; i < this.methodSignatures.length; i++) | 37 | for (int i = 0; i < this.methodSignatures.length; i++) |
38 | + { | ||
37 | if (!STRING_VOID_SIG.equals(this.methodSignatures[i])) | 39 | if (!STRING_VOID_SIG.equals(this.methodSignatures[i])) |
40 | + { | ||
38 | throw new IllegalArgumentException("BeforeStringInvoke requires method with with signature " + STRING_VOID_SIG); | 41 | throw new IllegalArgumentException("BeforeStringInvoke requires method with with signature " + STRING_VOID_SIG); |
42 | + } | ||
43 | + } | ||
39 | } | 44 | } |
40 | 45 | ||
41 | @Override | 46 | @Override |
src/main/java/com/mumfrey/liteloader/transformers/event/inject/JumpInsnPoint.java
@@ -11,9 +11,11 @@ import com.mumfrey.liteloader.transformers.event.Event; | @@ -11,9 +11,11 @@ import com.mumfrey.liteloader.transformers.event.Event; | ||
11 | import com.mumfrey.liteloader.transformers.event.InjectionPoint; | 11 | import com.mumfrey.liteloader.transformers.event.InjectionPoint; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | - * An injection point which searches for JUMP opcodes (if, try/catch, continue, break, conditional assignment, etc.) | ||
15 | - * with either a particular opcode or at a particular ordinal in the method body (eg. "the Nth JUMP insn" where N is the | ||
16 | - * ordinal of the instruction). By default it returns all JUMP instructions in a method body. | 14 | + * An injection point which searches for JUMP opcodes (if, try/catch, continue, |
15 | + * break, conditional assignment, etc.) with either a particular opcode or at a | ||
16 | + * particular ordinal in the method body (eg. "the Nth JUMP insn" where N is the | ||
17 | + * ordinal of the instruction). By default it returns all JUMP instructions in a | ||
18 | + * method body. | ||
17 | * | 19 | * |
18 | * @author Adam Mummery-Smith | 20 | * @author Adam Mummery-Smith |
19 | */ | 21 | */ |
src/main/java/com/mumfrey/liteloader/transformers/event/json/JsonEvents.java
@@ -13,12 +13,13 @@ import com.mumfrey.liteloader.core.runtime.Obf; | @@ -13,12 +13,13 @@ import com.mumfrey.liteloader.core.runtime.Obf; | ||
13 | import com.mumfrey.liteloader.transformers.ObfProvider; | 13 | import com.mumfrey.liteloader.transformers.ObfProvider; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | - * Serialisable class which represents a set of event injection definitions. Instances of this class are | ||
17 | - * created by deserialising with JSON. The JSON string should be passed to the static {@link #parse} method | ||
18 | - * which returns an instance of the class. | 16 | + * Serialisable class which represents a set of event injection definitions. |
17 | + * Instances of this class are created by deserialising with JSON. The JSON | ||
18 | + * string should be passed to the static {@link #parse} method which returns an | ||
19 | + * instance of the class. | ||
19 | * | 20 | * |
20 | - * After parsing, the events defined here can be injected into an event transformer instance by calling the | ||
21 | - * {@link #register} method | 21 | + * <p>After parsing, the events defined here can be injected into an event |
22 | + * transformer instance by calling the {@link #register} method.</p> | ||
22 | * | 23 | * |
23 | * @author Adam Mummery-Smith | 24 | * @author Adam Mummery-Smith |
24 | */ | 25 | */ |
@@ -29,7 +30,8 @@ public class JsonEvents implements Serializable, ObfProvider | @@ -29,7 +30,8 @@ public class JsonEvents implements Serializable, ObfProvider | ||
29 | private static final Gson gson = new GsonBuilder().setPrettyPrinting().create(); | 30 | private static final Gson gson = new GsonBuilder().setPrettyPrinting().create(); |
30 | 31 | ||
31 | /** | 32 | /** |
32 | - * Tokens are an instruction to the parser to look up a value rather than using a literal | 33 | + * Tokens are an instruction to the parser to look up a value rather than |
34 | + * using a literal. | ||
33 | */ | 35 | */ |
34 | private static final Pattern tokenPattern = Pattern.compile("^\\$\\{([a-zA-Z0-9_\\-\\.\\$]+)\\}$"); | 36 | private static final Pattern tokenPattern = Pattern.compile("^\\$\\{([a-zA-Z0-9_\\-\\.\\$]+)\\}$"); |
35 | 37 | ||
@@ -112,7 +114,8 @@ public class JsonEvents implements Serializable, ObfProvider | @@ -112,7 +114,8 @@ public class JsonEvents implements Serializable, ObfProvider | ||
112 | } | 114 | } |
113 | catch (Exception ex) | 115 | catch (Exception ex) |
114 | { | 116 | { |
115 | - throw new InvalidEventJsonException("An error occurred whilst parsing the event definition: " + ex.getClass().getSimpleName() + ": " + ex.getMessage(), ex); | 117 | + throw new InvalidEventJsonException("An error occurred whilst parsing the event definition: " + ex.getClass().getSimpleName() |
118 | + + ": " + ex.getMessage(), ex); | ||
116 | } | 119 | } |
117 | } | 120 | } |
118 | 121 | ||
@@ -122,7 +125,8 @@ public class JsonEvents implements Serializable, ObfProvider | @@ -122,7 +125,8 @@ public class JsonEvents implements Serializable, ObfProvider | ||
122 | } | 125 | } |
123 | 126 | ||
124 | /** | 127 | /** |
125 | - * Parse a token name, returns the token name as a string if the token is valid, or null if the token is not valid | 128 | + * Parse a token name, returns the token name as a string if the token is |
129 | + * valid, or null if the token is not valid | ||
126 | * | 130 | * |
127 | * @param token | 131 | * @param token |
128 | */ | 132 | */ |
@@ -140,7 +144,8 @@ public class JsonEvents implements Serializable, ObfProvider | @@ -140,7 +144,8 @@ public class JsonEvents implements Serializable, ObfProvider | ||
140 | } | 144 | } |
141 | 145 | ||
142 | /** | 146 | /** |
143 | - * Called to register all events defined in this object into the specified transformer | 147 | + * Called to register all events defined in this object into the specified |
148 | + * transformer. | ||
144 | * | 149 | * |
145 | * @param transformer | 150 | * @param transformer |
146 | */ | 151 | */ |
@@ -158,7 +163,8 @@ public class JsonEvents implements Serializable, ObfProvider | @@ -158,7 +163,8 @@ public class JsonEvents implements Serializable, ObfProvider | ||
158 | } | 163 | } |
159 | 164 | ||
160 | /* (non-Javadoc) | 165 | /* (non-Javadoc) |
161 | - * @see com.mumfrey.liteloader.transformers.ObfProvider#getByName(java.lang.String) | 166 | + * @see com.mumfrey.liteloader.transformers.ObfProvider |
167 | + * #getByName(java.lang.String) | ||
162 | */ | 168 | */ |
163 | @Override | 169 | @Override |
164 | public Obf getByName(String name) | 170 | public Obf getByName(String name) |
@@ -166,10 +172,10 @@ public class JsonEvents implements Serializable, ObfProvider | @@ -166,10 +172,10 @@ public class JsonEvents implements Serializable, ObfProvider | ||
166 | return this.obfuscation.getByName(name); | 172 | return this.obfuscation.getByName(name); |
167 | } | 173 | } |
168 | 174 | ||
169 | - // public String toJson() | ||
170 | - // { | ||
171 | - // return JsonEvents.gson.toJson(this); | ||
172 | - // } | 175 | +// public String toJson() |
176 | +// { | ||
177 | +// return JsonEvents.gson.toJson(this); | ||
178 | +// } | ||
173 | 179 | ||
174 | /** | 180 | /** |
175 | * Parse a new JsonEvents object from the supplied JSON string | 181 | * Parse a new JsonEvents object from the supplied JSON string |
@@ -192,7 +198,8 @@ public class JsonEvents implements Serializable, ObfProvider | @@ -192,7 +198,8 @@ public class JsonEvents implements Serializable, ObfProvider | ||
192 | } | 198 | } |
193 | catch (Throwable th) | 199 | catch (Throwable th) |
194 | { | 200 | { |
195 | - throw new InvalidEventJsonException("An error occurred whilst parsing the event definition: " + th.getClass().getSimpleName() + ": " + th.getMessage(), th); | 201 | + throw new InvalidEventJsonException("An error occurred whilst parsing the event definition: " + th.getClass().getSimpleName() |
202 | + + ": " + th.getMessage(), th); | ||
196 | } | 203 | } |
197 | } | 204 | } |
198 | } | 205 | } |
src/main/java/com/mumfrey/liteloader/transformers/event/json/JsonInjection.java
@@ -135,7 +135,9 @@ public class JsonInjection implements Serializable | @@ -135,7 +135,9 @@ public class JsonInjection implements Serializable | ||
135 | private Object getArg(int arg) | 135 | private Object getArg(int arg) |
136 | { | 136 | { |
137 | if (this.args == null || this.args.length >= this.args.length || arg < 0) | 137 | if (this.args == null || this.args.length >= this.args.length || arg < 0) |
138 | + { | ||
138 | return ""; | 139 | return ""; |
140 | + } | ||
139 | 141 | ||
140 | return this.args[arg]; | 142 | return this.args[arg]; |
141 | } | 143 | } |
src/main/java/com/mumfrey/liteloader/transformers/event/json/JsonMethods.java
@@ -8,8 +8,9 @@ import com.mumfrey.liteloader.core.runtime.Methods; | @@ -8,8 +8,9 @@ import com.mumfrey.liteloader.core.runtime.Methods; | ||
8 | import com.mumfrey.liteloader.transformers.event.MethodInfo; | 8 | import com.mumfrey.liteloader.transformers.event.MethodInfo; |
9 | 9 | ||
10 | /** | 10 | /** |
11 | - * A simple registry of MethodInfo objects parsed from the JSON, objects which consume the specified | ||
12 | - * MethodInfo objects will be passed an instance of this object at parse time. | 11 | + * A simple registry of MethodInfo objects parsed from the JSON, objects which |
12 | + * consume the specified MethodInfo objects will be passed an instance of this | ||
13 | + * object at parse time. | ||
13 | * | 14 | * |
14 | * @author Adam Mummery-Smith | 15 | * @author Adam Mummery-Smith |
15 | */ | 16 | */ |
src/main/java/com/mumfrey/liteloader/transformers/event/json/JsonObfuscationTable.java
@@ -10,8 +10,8 @@ import com.mumfrey.liteloader.core.runtime.Obf; | @@ -10,8 +10,8 @@ import com.mumfrey.liteloader.core.runtime.Obf; | ||
10 | import com.mumfrey.liteloader.core.runtime.Packets; | 10 | import com.mumfrey.liteloader.core.runtime.Packets; |
11 | 11 | ||
12 | /** | 12 | /** |
13 | - * JSON-defined obfuscation table entries used like a registry by the other JSON components to look up obfuscation mappings | ||
14 | - * for methods and fields. | 13 | + * JSON-defined obfuscation table entries used like a registry by the other JSON |
14 | + * components to look up obfuscation mappings for methods and fields. | ||
15 | * | 15 | * |
16 | * @author Adam Mummery-Smith | 16 | * @author Adam Mummery-Smith |
17 | */ | 17 | */ |
src/main/java/com/mumfrey/liteloader/transformers/event/json/ModEventInjectionTransformer.java
@@ -11,7 +11,8 @@ import com.mumfrey.liteloader.util.log.LiteLoaderLogger; | @@ -11,7 +11,8 @@ import com.mumfrey.liteloader.util.log.LiteLoaderLogger; | ||
11 | import com.mumfrey.liteloader.util.log.LiteLoaderLogger.Verbosity; | 11 | import com.mumfrey.liteloader.util.log.LiteLoaderLogger.Verbosity; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | - * Event transformer which manages injections of mod events specified via events.json in the mod container | 14 | + * Event transformer which manages injections of mod events specified via |
15 | + * events.json in the mod container. | ||
15 | * | 16 | * |
16 | * @author Adam Mummery-Smith | 17 | * @author Adam Mummery-Smith |
17 | */ | 18 | */ |
src/main/java/com/mumfrey/liteloader/update/UpdateSite.java
@@ -12,8 +12,8 @@ import com.mumfrey.liteloader.util.log.LiteLoaderLogger; | @@ -12,8 +12,8 @@ import com.mumfrey.liteloader.util.log.LiteLoaderLogger; | ||
12 | import com.mumfrey.liteloader.util.net.HttpStringRetriever; | 12 | import com.mumfrey.liteloader.util.net.HttpStringRetriever; |
13 | 13 | ||
14 | /** | 14 | /** |
15 | - * An update site, used by liteloader to check for new versions but is also available to mods who may | ||
16 | - * want to use a similar system | 15 | + * An update site, used by liteloader to check for new versions but is also |
16 | + * available to mods who may want to use a similar system. | ||
17 | * | 17 | * |
18 | * @author Adam Mummery-Smith | 18 | * @author Adam Mummery-Smith |
19 | */ | 19 | */ |
@@ -30,7 +30,8 @@ public class UpdateSite implements Comparator<Long> | @@ -30,7 +30,8 @@ public class UpdateSite implements Comparator<Long> | ||
30 | private final String updateSiteUrl; | 30 | private final String updateSiteUrl; |
31 | 31 | ||
32 | /** | 32 | /** |
33 | - * Name of the json file containing the remote versions data, eg. versions.json | 33 | + * Name of the json file containing the remote versions data, eg. |
34 | + * versions.json | ||
34 | */ | 35 | */ |
35 | private final String updateSiteJsonFileName; | 36 | private final String updateSiteJsonFileName; |
36 | 37 | ||
@@ -60,7 +61,8 @@ public class UpdateSite implements Comparator<Long> | @@ -60,7 +61,8 @@ public class UpdateSite implements Comparator<Long> | ||
60 | private final Object lock = new Object(); | 61 | private final Object lock = new Object(); |
61 | 62 | ||
62 | /** | 63 | /** |
63 | - * StringRetriever which will fetch the remote json file, null when not performing a fetch operation | 64 | + * StringRetriever which will fetch the remote json file, null when not |
65 | + * performing a fetch operation. | ||
64 | */ | 66 | */ |
65 | private HttpStringRetriever stringRetriever; | 67 | private HttpStringRetriever stringRetriever; |
66 | 68 | ||
@@ -97,14 +99,19 @@ public class UpdateSite implements Comparator<Long> | @@ -97,14 +99,19 @@ public class UpdateSite implements Comparator<Long> | ||
97 | /** | 99 | /** |
98 | * Create a new UpdateSite with the specified information | 100 | * Create a new UpdateSite with the specified information |
99 | * | 101 | * |
100 | - * @param updateSiteUrl Base URL of the update site, should include the trailing slash | ||
101 | - * @param jsonFileName Name of the json file on the remote site containing the version data, eg. versions.json | 102 | + * @param updateSiteUrl Base URL of the update site, should include the |
103 | + * trailing slash | ||
104 | + * @param jsonFileName Name of the json file on the remote site containing | ||
105 | + * the version data, eg. versions.json | ||
102 | * @param targetVersion The target minecraft version | 106 | * @param targetVersion The target minecraft version |
103 | - * @param artefact Artefact name in the form "com.somedomain.pkg:artefactname" | 107 | + * @param artefact Artefact name in the form |
108 | + * "com.somedomain.pkg:artefactname" | ||
104 | * @param currentTimeStamp Timestamp of the current artefact | 109 | * @param currentTimeStamp Timestamp of the current artefact |
105 | - * @param timeStampComparator Comparator to use for comparing timestamps, if null uses built in comparator | 110 | + * @param timeStampComparator Comparator to use for comparing timestamps, if |
111 | + * null uses built in comparator | ||
106 | */ | 112 | */ |
107 | - public UpdateSite(String updateSiteUrl, String jsonFileName, String targetVersion, String artefact, long currentTimeStamp, Comparator<Long> timeStampComparator) | 113 | + public UpdateSite(String updateSiteUrl, String jsonFileName, String targetVersion, String artefact, long currentTimeStamp, |
114 | + Comparator<Long> timeStampComparator) | ||
108 | { | 115 | { |
109 | this.updateSiteUrl = updateSiteUrl + (updateSiteUrl.endsWith("/") ? "" : "/"); | 116 | this.updateSiteUrl = updateSiteUrl + (updateSiteUrl.endsWith("/") ? "" : "/"); |
110 | this.updateSiteJsonFileName = jsonFileName; | 117 | this.updateSiteJsonFileName = jsonFileName; |
@@ -119,10 +126,13 @@ public class UpdateSite implements Comparator<Long> | @@ -119,10 +126,13 @@ public class UpdateSite implements Comparator<Long> | ||
119 | /** | 126 | /** |
120 | * Create a new UpdateSite with the specified information | 127 | * Create a new UpdateSite with the specified information |
121 | * | 128 | * |
122 | - * @param updateSiteUrl Base URL of the update site, should include the trailing slash | ||
123 | - * @param jsonFileName Name of the json file on the remote site containing the version data, eg. versions.json | 129 | + * @param updateSiteUrl Base URL of the update site, should include the |
130 | + * trailing slash | ||
131 | + * @param jsonFileName Name of the json file on the remote site containing | ||
132 | + * the version data, eg. versions.json | ||
124 | * @param targetVersion The target minecraft version | 133 | * @param targetVersion The target minecraft version |
125 | - * @param artefact Artefact name in the form "com.somedomain.pkg:artefactname" | 134 | + * @param artefact Artefact name in the form |
135 | + * "com.somedomain.pkg:artefactname" | ||
126 | * @param currentTimeStamp Timestamp of the current artefact | 136 | * @param currentTimeStamp Timestamp of the current artefact |
127 | */ | 137 | */ |
128 | public UpdateSite(String updateSiteUrl, String jsonFileName, String targetVersion, String artefact, long currentTimeStamp) | 138 | public UpdateSite(String updateSiteUrl, String jsonFileName, String targetVersion, String artefact, long currentTimeStamp) |
@@ -217,7 +227,8 @@ public class UpdateSite implements Comparator<Long> | @@ -217,7 +227,8 @@ public class UpdateSite implements Comparator<Long> | ||
217 | } | 227 | } |
218 | 228 | ||
219 | /** | 229 | /** |
220 | - * Check whether an in-progress check has completed and if it has parse the retrieved data | 230 | + * Check whether an in-progress check has completed and if it has parse the |
231 | + * retrieved data. | ||
221 | */ | 232 | */ |
222 | private void update() | 233 | private void update() |
223 | { | 234 | { |
@@ -238,7 +249,8 @@ public class UpdateSite implements Comparator<Long> | @@ -238,7 +249,8 @@ public class UpdateSite implements Comparator<Long> | ||
238 | } | 249 | } |
239 | catch (Exception ex) | 250 | catch (Exception ex) |
240 | { | 251 | { |
241 | - LiteLoaderLogger.debug("Update site for %s failed parsing the update response: %s:%s", this.artefact, ex.getClass().getSimpleName(), ex.getMessage()); | 252 | + LiteLoaderLogger.debug("Update site for %s failed parsing the update response: %s:%s", this.artefact, |
253 | + ex.getClass().getSimpleName(), ex.getMessage()); | ||
242 | this.checkSuccess = false; | 254 | this.checkSuccess = false; |
243 | ex.printStackTrace(); | 255 | ex.printStackTrace(); |
244 | } | 256 | } |
src/main/java/com/mumfrey/liteloader/util/ChatUtilities.java
@@ -34,7 +34,7 @@ public abstract class ChatUtilities | @@ -34,7 +34,7 @@ public abstract class ChatUtilities | ||
34 | * Get a chat style from a legacy formatting code | 34 | * Get a chat style from a legacy formatting code |
35 | * | 35 | * |
36 | * @param code Code | 36 | * @param code Code |
37 | - * @return | 37 | + * @return chat style |
38 | */ | 38 | */ |
39 | public static ChatStyle getChatStyleFromCode(char code) | 39 | public static ChatStyle getChatStyleFromCode(char code) |
40 | { | 40 | { |
@@ -64,7 +64,8 @@ public abstract class ChatUtilities | @@ -64,7 +64,8 @@ public abstract class ChatUtilities | ||
64 | } | 64 | } |
65 | 65 | ||
66 | /** | 66 | /** |
67 | - * Convert a component containing text formatted with legacy codes to a native ChatComponent structure | 67 | + * Convert a component containing text formatted with legacy codes to a |
68 | + * native ChatComponent structure. | ||
68 | */ | 69 | */ |
69 | public static IChatComponent convertLegacyCodes(IChatComponent chat) | 70 | public static IChatComponent convertLegacyCodes(IChatComponent chat) |
70 | { | 71 | { |
src/main/java/com/mumfrey/liteloader/util/Input.java
@@ -19,7 +19,8 @@ public abstract class Input implements CoreProvider | @@ -19,7 +19,8 @@ public abstract class Input implements CoreProvider | ||
19 | public abstract void registerKeyBinding(KeyBinding binding); | 19 | public abstract void registerKeyBinding(KeyBinding binding); |
20 | 20 | ||
21 | /** | 21 | /** |
22 | - * Unregisters a registered keybind with the game settings class, thus removing it from the "controls" screen | 22 | + * Unregisters a registered keybind with the game settings class, thus |
23 | + * removing it from the "controls" screen. | ||
23 | * | 24 | * |
24 | * @param binding | 25 | * @param binding |
25 | */ | 26 | */ |
@@ -36,18 +37,21 @@ public abstract class Input implements CoreProvider | @@ -36,18 +37,21 @@ public abstract class Input implements CoreProvider | ||
36 | public abstract ComponentRegistry getComponentRegistry(); | 37 | public abstract ComponentRegistry getComponentRegistry(); |
37 | 38 | ||
38 | /** | 39 | /** |
39 | - * Returns a handle to the event described by descriptor (or null if no component is found matching the | ||
40 | - * descriptor. Retrieving an event via this method adds the controller (if found) to the polling list and | ||
41 | - * causes it to raise events against the specified handler. | 40 | + * Returns a handle to the event described by descriptor (or null if no |
41 | + * component is found matching the descriptor. Retrieving an event via this | ||
42 | + * method adds the controller (if found) to the polling list and causes it | ||
43 | + * to raise events against the specified handler. | ||
42 | * | 44 | * |
43 | - * This method returns an {@link InputEvent} which is passed as an argument to the relevant callback on | ||
44 | - * the supplied handler in order to identify the event. For example: | 45 | + * <p>This method returns an {@link InputEvent} which is passed as an |
46 | + * argument to the relevant callback on the supplied handler in order to | ||
47 | + * identify the event. For example:</p> | ||
45 | * | 48 | * |
46 | - * this.joystickButton = input.getEvent(descriptor, this); | 49 | + * <code>this.joystickButton = input.getEvent(descriptor, this);</code> |
47 | * | 50 | * |
48 | - * then in onAxisEvent | 51 | + * <p>then in onAxisEvent</p> |
49 | * | 52 | * |
50 | - * if (source == this.joystickButton) // do something with button | 53 | + * <code>if (source == this.joystickButton) // do something with button |
54 | + * </code> | ||
51 | * | 55 | * |
52 | * @param descriptor | 56 | * @param descriptor |
53 | * @param handler | 57 | * @param handler |
src/main/java/com/mumfrey/liteloader/util/InputEvent.java
@@ -5,9 +5,10 @@ import net.java.games.input.Controller; | @@ -5,9 +5,10 @@ import net.java.games.input.Controller; | ||
5 | import net.java.games.input.Event; | 5 | import net.java.games.input.Event; |
6 | 6 | ||
7 | /** | 7 | /** |
8 | - * A handle to an input event, this handle will be used to call back the handler for the specified | ||
9 | - * component's events. This class represents a singly-linked list of delegates with each delegate's | ||
10 | - * next field pointing to the next delegate in the chain | 8 | + * A handle to an input event, this handle will be used to call back the handler |
9 | + * for the specified component's events. This class represents a singly-linked | ||
10 | + * list of delegates with each delegate's next field pointing to the next | ||
11 | + * delegate in the chain. | ||
11 | * | 12 | * |
12 | * @author Adam Mummery-Smith | 13 | * @author Adam Mummery-Smith |
13 | */ | 14 | */ |
@@ -46,7 +47,8 @@ public class InputEvent | @@ -46,7 +47,8 @@ public class InputEvent | ||
46 | } | 47 | } |
47 | 48 | ||
48 | /** | 49 | /** |
49 | - * Link this delegate to the specified delegate and return the start of the delegate chain | 50 | + * Link this delegate to the specified delegate and return the start of the |
51 | + * delegate chain. | ||
50 | * | 52 | * |
51 | * @param chain delegate to link to (will be null if the chain is empty) | 53 | * @param chain delegate to link to (will be null if the chain is empty) |
52 | */ | 54 | */ |
@@ -66,7 +68,9 @@ public class InputEvent | @@ -66,7 +68,9 @@ public class InputEvent | ||
66 | InputEvent tail = this; // Start here | 68 | InputEvent tail = this; // Start here |
67 | 69 | ||
68 | while (tail.next != null) // Find the end of the chain | 70 | while (tail.next != null) // Find the end of the chain |
71 | + { | ||
69 | tail = tail.next; | 72 | tail = tail.next; |
73 | + } | ||
70 | 74 | ||
71 | tail.next = delegate; // Append the new delegate | 75 | tail.next = delegate; // Append the new delegate |
72 | return this; // Return the start of the delegate chain (eg. this node) | 76 | return this; // Return the start of the delegate chain (eg. this node) |
src/main/java/com/mumfrey/liteloader/util/InputHandler.java
@@ -17,7 +17,8 @@ public interface InputHandler | @@ -17,7 +17,8 @@ public interface InputHandler | ||
17 | void onAxisEvent(InputEvent source, float value, long nanos); | 17 | void onAxisEvent(InputEvent source, float value, long nanos); |
18 | 18 | ||
19 | /** | 19 | /** |
20 | - * Called when a POV (Point-Of-View) event is raised on the specified component | 20 | + * Called when a POV (Point-Of-View) event is raised on the specified |
21 | + * component. | ||
21 | * | 22 | * |
22 | * @param source | 23 | * @param source |
23 | * @param value | 24 | * @param value |
src/main/java/com/mumfrey/liteloader/util/ObfuscationUtilities.java
@@ -10,7 +10,8 @@ import com.mumfrey.liteloader.core.runtime.Obf; | @@ -10,7 +10,8 @@ import com.mumfrey.liteloader.core.runtime.Obf; | ||
10 | public class ObfuscationUtilities | 10 | public class ObfuscationUtilities |
11 | { | 11 | { |
12 | /** | 12 | /** |
13 | - * True if FML is being used, in which case we use searge names instead of raw field/method names | 13 | + * True if FML is being used, in which case we use searge names instead of |
14 | + * raw field/method names. | ||
14 | */ | 15 | */ |
15 | private static boolean fmlDetected = false; | 16 | private static boolean fmlDetected = false; |
16 | 17 | ||
@@ -37,7 +38,12 @@ public class ObfuscationUtilities | @@ -37,7 +38,12 @@ public class ObfuscationUtilities | ||
37 | public static boolean fmlIsPresent() | 38 | public static boolean fmlIsPresent() |
38 | { | 39 | { |
39 | for (IClassTransformer transformer : Launch.classLoader.getTransformers()) | 40 | for (IClassTransformer transformer : Launch.classLoader.getTransformers()) |
40 | - if (transformer.getClass().getName().contains("fml")) return true; | 41 | + { |
42 | + if (transformer.getClass().getName().contains("fml")) | ||
43 | + { | ||
44 | + return true; | ||
45 | + } | ||
46 | + } | ||
41 | 47 | ||
42 | return false; | 48 | return false; |
43 | } | 49 | } |
@@ -45,13 +51,15 @@ public class ObfuscationUtilities | @@ -45,13 +51,15 @@ public class ObfuscationUtilities | ||
45 | /** | 51 | /** |
46 | * Abstraction helper function | 52 | * Abstraction helper function |
47 | * | 53 | * |
48 | - * @param fieldName Name of field to get, returned unmodified if in debug mode | 54 | + * @param fieldName Name of field to get, returned unmodified if in debug |
55 | + * mode | ||
49 | * @return Obfuscated field name if present | 56 | * @return Obfuscated field name if present |
50 | */ | 57 | */ |
51 | public static String getObfuscatedFieldName(String fieldName, String obfuscatedFieldName, String seargeFieldName) | 58 | public static String getObfuscatedFieldName(String fieldName, String obfuscatedFieldName, String seargeFieldName) |
52 | { | 59 | { |
53 | boolean deobfuscated = BlockPos.class.getSimpleName().equals("BlockPos"); | 60 | boolean deobfuscated = BlockPos.class.getSimpleName().equals("BlockPos"); |
54 | - return deobfuscated ? (ObfuscationUtilities.seargeNames ? seargeFieldName : fieldName) : (ObfuscationUtilities.fmlDetected ? seargeFieldName : obfuscatedFieldName); | 61 | + return deobfuscated ? (ObfuscationUtilities.seargeNames ? seargeFieldName : fieldName) |
62 | + : (ObfuscationUtilities.fmlDetected ? seargeFieldName : obfuscatedFieldName); | ||
55 | } | 63 | } |
56 | 64 | ||
57 | /** | 65 | /** |
src/main/java/com/mumfrey/liteloader/util/Position.java
@@ -34,7 +34,11 @@ public class Position extends Vec3 | @@ -34,7 +34,11 @@ public class Position extends Vec3 | ||
34 | 34 | ||
35 | public Position(Entity entity, boolean usePrevious) | 35 | public Position(Entity entity, boolean usePrevious) |
36 | { | 36 | { |
37 | - this(usePrevious ? entity.prevPosX : entity.posX, usePrevious ? entity.prevPosY : entity.posY, usePrevious ? entity.prevPosZ : entity.posZ, usePrevious ? entity.prevRotationYaw : entity.rotationYaw, usePrevious ? entity.prevRotationPitch : entity.rotationPitch); | 37 | + this(usePrevious ? entity.prevPosX : entity.posX, |
38 | + usePrevious ? entity.prevPosY : entity.posY, | ||
39 | + usePrevious ? entity.prevPosZ : entity.posZ, | ||
40 | + usePrevious ? entity.prevRotationYaw : entity.rotationYaw, | ||
41 | + usePrevious ? entity.prevRotationPitch : entity.rotationPitch); | ||
38 | } | 42 | } |
39 | 43 | ||
40 | public void applyTo(Entity entity) | 44 | public void applyTo(Entity entity) |
src/main/java/com/mumfrey/liteloader/util/PrivateFields.java
@@ -8,7 +8,8 @@ import net.minecraft.network.play.client.C15PacketClientSettings; | @@ -8,7 +8,8 @@ import net.minecraft.network.play.client.C15PacketClientSettings; | ||
8 | import com.mumfrey.liteloader.core.runtime.Obf; | 8 | import com.mumfrey.liteloader.core.runtime.Obf; |
9 | 9 | ||
10 | /** | 10 | /** |
11 | - * Wrapper for obf/mcp reflection-accessed private fields, mainly added to centralise the locations I have to update the obfuscated field names | 11 | + * Wrapper for obf/mcp reflection-accessed private fields, mainly added to |
12 | + * centralise the locations I have to update the obfuscated field names. | ||
12 | * | 13 | * |
13 | * @author Adam Mummery-Smith | 14 | * @author Adam Mummery-Smith |
14 | * | 15 | * |
@@ -123,6 +124,8 @@ public class PrivateFields<P, T> | @@ -123,6 +124,8 @@ public class PrivateFields<P, T> | ||
123 | 124 | ||
124 | return value; | 125 | return value; |
125 | } | 126 | } |
127 | + | ||
128 | + // CHECKSTYLE:OFF | ||
126 | 129 | ||
127 | public static final PrivateFields<C15PacketClientSettings, Integer> viewDistance = new PrivateFields<C15PacketClientSettings, Integer>(C15PacketClientSettings.class, Obf.viewDistance); | 130 | public static final PrivateFields<C15PacketClientSettings, Integer> viewDistance = new PrivateFields<C15PacketClientSettings, Integer>(C15PacketClientSettings.class, Obf.viewDistance); |
128 | 131 |
src/main/java/com/mumfrey/liteloader/util/SortableValue.java
1 | package com.mumfrey.liteloader.util; | 1 | package com.mumfrey.liteloader.util; |
2 | 2 | ||
3 | /** | 3 | /** |
4 | - * Struct which contains a mapping of a priority value to another object, used for sorting items using | ||
5 | - * the native functionality in TreeMap and TreeSet | 4 | + * Struct which contains a mapping of a priority value to another object, used |
5 | + * for sorting items using the native functionality in TreeMap and TreeSet. | ||
6 | * | 6 | * |
7 | * @author Adam Mummery-Smith | 7 | * @author Adam Mummery-Smith |
8 | */ | 8 | */ |
src/main/java/com/mumfrey/liteloader/util/jinput/ComponentRegistry.java
@@ -11,7 +11,8 @@ import net.java.games.input.Controller; | @@ -11,7 +11,8 @@ import net.java.games.input.Controller; | ||
11 | import net.java.games.input.ControllerEnvironment; | 11 | import net.java.games.input.ControllerEnvironment; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | - * Registry which keeps track of mappings of JInput descriptors to the controller and component references | 14 | + * Registry which keeps track of mappings of JInput descriptors to the |
15 | + * controller and component references. | ||
15 | * | 16 | * |
16 | * @author Adam Mummery-Smith | 17 | * @author Adam Mummery-Smith |
17 | */ | 18 | */ |
@@ -40,7 +41,8 @@ public class ComponentRegistry | @@ -40,7 +41,8 @@ public class ComponentRegistry | ||
40 | { | 41 | { |
41 | LiteLoaderLogger.info("JInput Component Registry is initialising..."); | 42 | LiteLoaderLogger.info("JInput Component Registry is initialising..."); |
42 | this.enumerate(ControllerEnvironment.getDefaultEnvironment()); | 43 | this.enumerate(ControllerEnvironment.getDefaultEnvironment()); |
43 | - LiteLoaderLogger.info("JInput Component Registry initialised, found %d controller(s) %d component(s)", ControllerEnvironment.getDefaultEnvironment().getControllers().length, components.size()); | 44 | + LiteLoaderLogger.info("JInput Component Registry initialised, found %d controller(s) %d component(s)", |
45 | + ControllerEnvironment.getDefaultEnvironment().getControllers().length, components.size()); | ||
44 | } | 46 | } |
45 | catch (Throwable th) | 47 | catch (Throwable th) |
46 | { | 48 | { |
@@ -82,7 +84,9 @@ public class ComponentRegistry | @@ -82,7 +84,9 @@ public class ComponentRegistry | ||
82 | component = this.getComponent(descriptor, offset++); | 84 | component = this.getComponent(descriptor, offset++); |
83 | 85 | ||
84 | if (components.contains(component)) | 86 | if (components.contains(component)) |
87 | + { | ||
85 | component = null; | 88 | component = null; |
89 | + } | ||
86 | 90 | ||
87 | if (component != null) | 91 | if (component != null) |
88 | { | 92 | { |
@@ -111,7 +115,9 @@ public class ComponentRegistry | @@ -111,7 +115,9 @@ public class ComponentRegistry | ||
111 | if (matches(entry.getKey(), descriptor)) | 115 | if (matches(entry.getKey(), descriptor)) |
112 | { | 116 | { |
113 | if (--offset < 0) | 117 | if (--offset < 0) |
118 | + { | ||
114 | return entry.getValue(); | 119 | return entry.getValue(); |
120 | + } | ||
115 | } | 121 | } |
116 | } | 122 | } |
117 | 123 | ||
@@ -130,7 +136,9 @@ public class ComponentRegistry | @@ -130,7 +136,9 @@ public class ComponentRegistry | ||
130 | controller = this.getController(descriptor, offset++); | 136 | controller = this.getController(descriptor, offset++); |
131 | 137 | ||
132 | if (controllers.contains(controller)) | 138 | if (controllers.contains(controller)) |
139 | + { | ||
133 | controller = null; | 140 | controller = null; |
141 | + } | ||
134 | 142 | ||
135 | if (controller != null) | 143 | if (controller != null) |
136 | { | 144 | { |
@@ -159,11 +167,13 @@ public class ComponentRegistry | @@ -159,11 +167,13 @@ public class ComponentRegistry | ||
159 | if (matches(entry.getKey(), descriptor)) | 167 | if (matches(entry.getKey(), descriptor)) |
160 | { | 168 | { |
161 | if (--offset < 0) | 169 | if (--offset < 0) |
170 | + { | ||
162 | return entry.getValue(); | 171 | return entry.getValue(); |
172 | + } | ||
163 | } | 173 | } |
164 | } | 174 | } |
165 | 175 | ||
166 | - return null; | 176 | + return null; |
167 | } | 177 | } |
168 | 178 | ||
169 | public static String getDescriptor(Controller controller, Component component) | 179 | public static String getDescriptor(Controller controller, Component component) |
@@ -245,8 +255,12 @@ public class ComponentRegistry | @@ -245,8 +255,12 @@ public class ComponentRegistry | ||
245 | 255 | ||
246 | for (int i = 0; i < descriptorParts.length; i++) | 256 | for (int i = 0; i < descriptorParts.length; i++) |
247 | { | 257 | { |
248 | - if (wildDescriptorParts[i].length() > 0 && descriptorParts[i].length() > 0 && !wildDescriptorParts[i].equals(descriptorParts[i]) && !wildDescriptorParts[i].equals("*")) | 258 | + if (wildDescriptorParts[i].length() > 0 && descriptorParts[i].length() > 0 |
259 | + && !wildDescriptorParts[i].equals(descriptorParts[i]) | ||
260 | + && !wildDescriptorParts[i].equals("*")) | ||
261 | + { | ||
249 | return false; | 262 | return false; |
263 | + } | ||
250 | } | 264 | } |
251 | 265 | ||
252 | return true; | 266 | return true; |
src/main/java/com/mumfrey/liteloader/util/log/LiteLoaderLogger.java
@@ -36,7 +36,8 @@ public class LiteLoaderLogger extends AbstractAppender | @@ -36,7 +36,8 @@ public class LiteLoaderLogger extends AbstractAppender | ||
36 | private static Throwable lastThrowable; | 36 | private static Throwable lastThrowable; |
37 | 37 | ||
38 | /** | 38 | /** |
39 | - * Provides some wiggle-room within log4j's Level so we can have different levels of logging on the same, um.. Level | 39 | + * Provides some wiggle-room within log4j's Level so we can have different |
40 | + * levels of logging on the same, um.. Level | ||
40 | */ | 41 | */ |
41 | public static enum Verbosity | 42 | public static enum Verbosity |
42 | { | 43 | { |
@@ -111,7 +112,9 @@ public class LiteLoaderLogger extends AbstractAppender | @@ -111,7 +112,9 @@ public class LiteLoaderLogger extends AbstractAppender | ||
111 | LiteLoaderLogger.logTail.add(line); | 112 | LiteLoaderLogger.logTail.add(line); |
112 | 113 | ||
113 | if (LiteLoaderLogger.logTail.size() > LiteLoaderLogger.LOG_TAIL_SIZE) | 114 | if (LiteLoaderLogger.logTail.size() > LiteLoaderLogger.LOG_TAIL_SIZE) |
115 | + { | ||
114 | LiteLoaderLogger.logTail.remove(); | 116 | LiteLoaderLogger.logTail.remove(); |
117 | + } | ||
115 | } | 118 | } |
116 | 119 | ||
117 | public static long getLogIndex() | 120 | public static long getLogIndex() |
src/main/java/com/mumfrey/liteloader/util/net/HttpStringRetriever.java
@@ -58,7 +58,8 @@ public class HttpStringRetriever extends Thread | @@ -58,7 +58,8 @@ public class HttpStringRetriever extends Thread | ||
58 | private volatile boolean success = false; | 58 | private volatile boolean success = false; |
59 | 59 | ||
60 | /** | 60 | /** |
61 | - * Create a new string retriever for the specified URL, with the supplied headers and line end characters | 61 | + * Create a new string retriever for the specified URL, with the supplied |
62 | + * headers and line end characters. | ||
62 | * | 63 | * |
63 | * @param url URL to download from | 64 | * @param url URL to download from |
64 | * @param headers Additional headers to add to the request | 65 | * @param headers Additional headers to add to the request |
@@ -72,7 +73,8 @@ public class HttpStringRetriever extends Thread | @@ -72,7 +73,8 @@ public class HttpStringRetriever extends Thread | ||
72 | } | 73 | } |
73 | 74 | ||
74 | /** | 75 | /** |
75 | - * Create a new string retriever for the specified URL, with the supplied headers | 76 | + * Create a new string retriever for the specified URL, with the supplied |
77 | + * headers. | ||
76 | * | 78 | * |
77 | * @param url URL to download from | 79 | * @param url URL to download from |
78 | * @param headers Additional headers to add to the request | 80 | * @param headers Additional headers to add to the request |
@@ -128,7 +130,8 @@ public class HttpStringRetriever extends Thread | @@ -128,7 +130,8 @@ public class HttpStringRetriever extends Thread | ||
128 | } | 130 | } |
129 | 131 | ||
130 | /** | 132 | /** |
131 | - * Get the response code from the HTTP request, -1 if a connection error occurred | 133 | + * Get the response code from the HTTP request, -1 if a connection error |
134 | + * occurred. | ||
132 | */ | 135 | */ |
133 | public int getHttpResponseCode() | 136 | public int getHttpResponseCode() |
134 | { | 137 | { |
@@ -159,8 +162,9 @@ public class HttpStringRetriever extends Thread | @@ -159,8 +162,9 @@ public class HttpStringRetriever extends Thread | ||
159 | } | 162 | } |
160 | 163 | ||
161 | /** | 164 | /** |
162 | - * Fetch a String in the current thread, normally this method is called by the run() method to fetch the resource | ||
163 | - * in a new thread but can be called directly to fetch the result in the current thread | 165 | + * Fetch a String in the current thread, normally this method is called by |
166 | + * the run() method to fetch the resource in a new thread but can be called | ||
167 | + * directly to fetch the result in the current thread. | ||
164 | * | 168 | * |
165 | * @param url URL to fetch | 169 | * @param url URL to fetch |
166 | * @return retrieved string or empty string on failure | 170 | * @return retrieved string or empty string on failure |
@@ -198,7 +202,9 @@ public class HttpStringRetriever extends Thread | @@ -198,7 +202,9 @@ public class HttpStringRetriever extends Thread | ||
198 | 202 | ||
199 | String readLine; | 203 | String readLine; |
200 | while ((readLine = reader.readLine()) != null) | 204 | while ((readLine = reader.readLine()) != null) |
205 | + { | ||
201 | readString.append(readLine).append(this.lineEnding); | 206 | readString.append(readLine).append(this.lineEnding); |
207 | + } | ||
202 | 208 | ||
203 | this.success = true; | 209 | this.success = true; |
204 | } | 210 | } |
src/main/java/com/mumfrey/liteloader/util/render/IconClickable.java
@@ -9,7 +9,8 @@ public interface IconClickable extends IconTextured | @@ -9,7 +9,8 @@ public interface IconClickable extends IconTextured | ||
9 | { | 9 | { |
10 | /** | 10 | /** |
11 | * @param source Source of the event, usually the outermost gui screen | 11 | * @param source Source of the event, usually the outermost gui screen |
12 | - * @param container Container of this icon, the actual component hosting the icon | 12 | + * @param container Container of this icon, the actual component hosting the |
13 | + * icon | ||
13 | */ | 14 | */ |
14 | public void onClicked(Object source, Object container); | 15 | public void onClicked(Object source, Object container); |
15 | } | 16 | } |
src/main/java/net/eq2online/permissions/ReplicatedPermissionsContainer.java
@@ -30,14 +30,16 @@ public class ReplicatedPermissionsContainer implements Serializable | @@ -30,14 +30,16 @@ public class ReplicatedPermissionsContainer implements Serializable | ||
30 | public Float modVersion = 0.0F; | 30 | public Float modVersion = 0.0F; |
31 | 31 | ||
32 | /** | 32 | /** |
33 | - * List of permissions to replicate, prepend "-" for a negated permission and "+" for a granted permission | 33 | + * List of permissions to replicate, prepend "-" for a negated permission |
34 | + * and "+" for a granted permission. | ||
34 | */ | 35 | */ |
35 | public Set<String> permissions = new TreeSet<String>(); | 36 | public Set<String> permissions = new TreeSet<String>(); |
36 | 37 | ||
37 | /** | 38 | /** |
38 | - * Amount of time in seconds that the client will trust these permissions for before requesting an update | 39 | + * Amount of time in seconds that the client will trust these permissions |
40 | + * for before requesting an update. | ||
39 | */ | 41 | */ |
40 | - public long remoteCacheTimeSeconds = 600L; // 10 minutes | 42 | + public long remoteCacheTimeSeconds = 600L; // 10 minutes |
41 | 43 | ||
42 | public static final String CHANNEL = "PERMISSIONSREPL"; | 44 | public static final String CHANNEL = "PERMISSIONSREPL"; |
43 | 45 | ||
@@ -73,7 +75,8 @@ public class ReplicatedPermissionsContainer implements Serializable | @@ -73,7 +75,8 @@ public class ReplicatedPermissionsContainer implements Serializable | ||
73 | } | 75 | } |
74 | 76 | ||
75 | /** | 77 | /** |
76 | - * Serialise this container to a byte array for transmission to a remote host | 78 | + * Serialise this container to a byte array for transmission to a remote |
79 | + * host. | ||
77 | */ | 80 | */ |
78 | public byte[] getBytes() | 81 | public byte[] getBytes() |
79 | { | 82 | { |