Commit 7ed373de3b664fc193e7e1d67515433db3b2d186
1 parent
cf05cbea
Clean up comment style
Showing
3 changed files
with
54 additions
and
39 deletions
src/main/java/com/examplemod/Clock.java
@@ -12,25 +12,29 @@ import org.lwjgl.util.ReadableColor; | @@ -12,25 +12,29 @@ import org.lwjgl.util.ReadableColor; | ||
12 | import java.util.Calendar; | 12 | import java.util.Calendar; |
13 | 13 | ||
14 | /** | 14 | /** |
15 | - * Simple implementation of an analogue clock to demonstrate how to LiteLoader all the things | 15 | + * Simple implementation of an analogue clock to demonstrate how to LiteLoader |
16 | + * all the things | ||
16 | * | 17 | * |
17 | * @author Adam Mummery-Smith | 18 | * @author Adam Mummery-Smith |
18 | */ | 19 | */ |
19 | public class Clock | 20 | public class Clock |
20 | { | 21 | { |
21 | /** | 22 | /** |
22 | - * This is the clock face resource, you need to create a resource location for any assets that you | ||
23 | - * wish to use. It is best to make these static to avoid new instances being created for every instance | ||
24 | - * of the referencing object, this also means they will only be garbage collected when the class is | ||
25 | - * garbage collected or when no instances of the class are left. | 23 | + * This is the clock face resource, you need to create a resource location |
24 | + * for any assets that you wish to use. It is best to make these static to | ||
25 | + * avoid new instances being created for every instance of the referencing | ||
26 | + * object, this also means they will only be garbage collected when the | ||
27 | + * class is garbage collected or when no instances of the class are left. | ||
26 | * | 28 | * |
27 | - * The first parameter for the resource location is the "domain" and this should normally be your mod's | ||
28 | - * name. The domain MUST be lower case! The second is the resource "path" and represents the path to the | ||
29 | - * resource within the domain. It is convention that the path always start with the resource type, such | ||
30 | - * as "textures" in this case. | 29 | + * <p>The first parameter for the resource location is the "domain" and this |
30 | + * should normally be your mod's name. The domain MUST be lower case! The | ||
31 | + * second is the resource "path" and represents the path to the resource | ||
32 | + * within the domain. It is convention that the path always start with the | ||
33 | + * resource type, such as "textures" in this case.</p> | ||
31 | * | 34 | * |
32 | - * Resources are always stored in a path of the form "assets/{domain}/{path}" which makes the appropriate | ||
33 | - * path to the CLOCKFACE resource: "/assets/example/textures/clock/face.png" | 35 | + * <p>Resources are always stored in a path of the form |
36 | + * "assets/{domain}/{path}" which makes the appropriate path to the | ||
37 | + * CLOCKFACE resource: "/assets/example/textures/clock/face.png"</p> | ||
34 | */ | 38 | */ |
35 | private static final ResourceLocation CLOCKFACE = new ResourceLocation("example", "textures/clock/face.png"); | 39 | private static final ResourceLocation CLOCKFACE = new ResourceLocation("example", "textures/clock/face.png"); |
36 | 40 | ||
@@ -228,8 +232,8 @@ public class Clock | @@ -228,8 +232,8 @@ public class Clock | ||
228 | 232 | ||
229 | float texMapScale = 0.001953125F; // 512px | 233 | float texMapScale = 0.001953125F; // 512px |
230 | 234 | ||
231 | - // We use the tessellator rather than drawing individual quads because it uses vertex arrays to | ||
232 | - // draw the quads more efficiently. | 235 | + // We use the tessellator rather than drawing individual quads because |
236 | + // it uses vertex arrays to draw the quads more efficiently. | ||
233 | Tessellator tessellator = Tessellator.getInstance(); | 237 | Tessellator tessellator = Tessellator.getInstance(); |
234 | BufferBuilder worldRenderer = tessellator.getBuffer(); | 238 | BufferBuilder worldRenderer = tessellator.getBuffer(); |
235 | worldRenderer.begin(GL_QUADS, POSITION_TEX); | 239 | worldRenderer.begin(GL_QUADS, POSITION_TEX); |
src/main/java/com/examplemod/ExampleModConfigPanel.java
@@ -7,9 +7,9 @@ import com.mumfrey.liteloader.modconfig.ConfigPanelHost; | @@ -7,9 +7,9 @@ import com.mumfrey.liteloader.modconfig.ConfigPanelHost; | ||
7 | import net.minecraft.client.resources.I18n; | 7 | import net.minecraft.client.resources.I18n; |
8 | 8 | ||
9 | /** | 9 | /** |
10 | - * This is a simple example of adding a config panel to a mod. Your LiteMod class should implement | ||
11 | - * {@link Configurable} and return this class in order to support the settings functionality of the | ||
12 | - * mod panel. | 10 | + * This is a simple example of adding a config panel to a mod. Your LiteMod |
11 | + * class should implement {@link Configurable} and return this class in order to | ||
12 | + * support the settings functionality of the mod panel. | ||
13 | * | 13 | * |
14 | * @author Adam Mummery-Smith | 14 | * @author Adam Mummery-Smith |
15 | */ | 15 | */ |
@@ -25,7 +25,8 @@ public class ExampleModConfigPanel extends AbstractConfigPanel | @@ -25,7 +25,8 @@ public class ExampleModConfigPanel extends AbstractConfigPanel | ||
25 | } | 25 | } |
26 | 26 | ||
27 | /* (non-Javadoc) | 27 | /* (non-Javadoc) |
28 | - * @see com.mumfrey.liteloader.modconfig.AbstractConfigPanel#addOptions(com.mumfrey.liteloader.modconfig.ConfigPanelHost) | 28 | + * @see com.mumfrey.liteloader.modconfig.AbstractConfigPanel#addOptions( |
29 | + * com.mumfrey.liteloader.modconfig.ConfigPanelHost) | ||
29 | */ | 30 | */ |
30 | @Override | 31 | @Override |
31 | protected void addOptions(ConfigPanelHost host) | 32 | protected void addOptions(ConfigPanelHost host) |
@@ -46,7 +47,8 @@ public class ExampleModConfigPanel extends AbstractConfigPanel | @@ -46,7 +47,8 @@ public class ExampleModConfigPanel extends AbstractConfigPanel | ||
46 | @Override | 47 | @Override |
47 | public void onPanelHidden() | 48 | public void onPanelHidden() |
48 | { | 49 | { |
49 | - // This example applies the changes immediately, however you may wish to only save changes | ||
50 | - // when the user clicks "save and close". In which case you should apply your changes here | 50 | + // This example applies the changes immediately, however you may wish to |
51 | + // only save changes when the user clicks "save and close". In which | ||
52 | + // case you should apply your changes here | ||
51 | } | 53 | } |
52 | } | 54 | } |
src/main/java/com/examplemod/LiteModExample.java
@@ -17,8 +17,9 @@ import org.lwjgl.input.Keyboard; | @@ -17,8 +17,9 @@ import org.lwjgl.input.Keyboard; | ||
17 | import java.io.File; | 17 | import java.io.File; |
18 | 18 | ||
19 | /** | 19 | /** |
20 | - * This is a very simple example LiteMod, it draws an analogue clock on the minecraft HUD using | ||
21 | - * a traditional onTick hook supplied by LiteLoader's "Tickable" interface. | 20 | + * This is a very simple example LiteMod, it draws an analogue clock on the |
21 | + * minecraft HUD using a traditional onTick hook supplied by LiteLoader's | ||
22 | + * {@link Tickable} interface. | ||
22 | * | 23 | * |
23 | * @author Adam Mummery-Smith | 24 | * @author Adam Mummery-Smith |
24 | */ | 25 | */ |
@@ -31,9 +32,11 @@ public class LiteModExample implements Tickable, PreRenderListener, Configurable | @@ -31,9 +32,11 @@ public class LiteModExample implements Tickable, PreRenderListener, Configurable | ||
31 | private Clock clock = new Clock(10, 10); | 32 | private Clock clock = new Clock(10, 10); |
32 | 33 | ||
33 | /** | 34 | /** |
34 | - * This is a keybinding that we will register with the game and use to toggle the clock | 35 | + * This is a keybinding that we will register with the game and use to |
36 | + * toggle the clock | ||
35 | * | 37 | * |
36 | - * Notice that we specify the key name as an *unlocalised* string. The localisation is provided from the included resource file | 38 | + * Notice that we specify the key name as an *unlocalised* string. The |
39 | + * localisation is provided from the included resource file. | ||
37 | */ | 40 | */ |
38 | private static KeyBinding clockKeyBinding = new KeyBinding("key.clock.toggle", Keyboard.KEY_F12, "key.categories.litemods"); | 41 | private static KeyBinding clockKeyBinding = new KeyBinding("key.clock.toggle", Keyboard.KEY_F12, "key.categories.litemods"); |
39 | 42 | ||
@@ -46,16 +49,18 @@ public class LiteModExample implements Tickable, PreRenderListener, Configurable | @@ -46,16 +49,18 @@ public class LiteModExample implements Tickable, PreRenderListener, Configurable | ||
46 | private boolean clockVisible = true; | 49 | private boolean clockVisible = true; |
47 | 50 | ||
48 | /** | 51 | /** |
49 | - * Default constructor. All LiteMods must have a default constructor. In general you should do very little | ||
50 | - * in the mod constructor EXCEPT for initialising any non-game-interfacing components or performing | ||
51 | - * sanity checking prior to initialisation | 52 | + * Default constructor. All LiteMods must have a default constructor. In |
53 | + * general you should do very little in the mod constructor EXCEPT for | ||
54 | + * initialising any non-game-interfacing components or performing sanity | ||
55 | + * checking prior to initialisation | ||
52 | */ | 56 | */ |
53 | public LiteModExample() | 57 | public LiteModExample() |
54 | { | 58 | { |
55 | } | 59 | } |
56 | 60 | ||
57 | /** | 61 | /** |
58 | - * getName() should be used to return the display name of your mod and MUST NOT return null | 62 | + * getName() should be used to return the display name of your mod and MUST |
63 | + * NOT return null | ||
59 | * | 64 | * |
60 | * @see com.mumfrey.liteloader.LiteMod#getName() | 65 | * @see com.mumfrey.liteloader.LiteMod#getName() |
61 | */ | 66 | */ |
@@ -66,8 +71,8 @@ public class LiteModExample implements Tickable, PreRenderListener, Configurable | @@ -66,8 +71,8 @@ public class LiteModExample implements Tickable, PreRenderListener, Configurable | ||
66 | } | 71 | } |
67 | 72 | ||
68 | /** | 73 | /** |
69 | - * getVersion() should return the same version string present in the mod metadata, although this is | ||
70 | - * not a strict requirement. | 74 | + * getVersion() should return the same version string present in the mod |
75 | + * metadata, although this is not a strict requirement. | ||
71 | * | 76 | * |
72 | * @see com.mumfrey.liteloader.LiteMod#getVersion() | 77 | * @see com.mumfrey.liteloader.LiteMod#getVersion() |
73 | */ | 78 | */ |
@@ -84,16 +89,17 @@ public class LiteModExample implements Tickable, PreRenderListener, Configurable | @@ -84,16 +89,17 @@ public class LiteModExample implements Tickable, PreRenderListener, Configurable | ||
84 | } | 89 | } |
85 | 90 | ||
86 | /** | 91 | /** |
87 | - * init() is called very early in the initialisation cycle, before the game is fully initialised, this | ||
88 | - * means that it is important that your mod does not interact with the game in any way at this point. | 92 | + * init() is called very early in the initialisation cycle, before the game |
93 | + * is fully initialised, this means that it is important that your mod does | ||
94 | + * not interact with the game in any way at this point. | ||
89 | * | 95 | * |
90 | * @see com.mumfrey.liteloader.LiteMod#init(java.io.File) | 96 | * @see com.mumfrey.liteloader.LiteMod#init(java.io.File) |
91 | */ | 97 | */ |
92 | @Override | 98 | @Override |
93 | public void init(File configPath) | 99 | public void init(File configPath) |
94 | { | 100 | { |
95 | - // The key binding declared above won't do anything unless we register it, ModUtilties provides | ||
96 | - // a convenience method for this | 101 | + // The key binding declared above won't do anything unless we register |
102 | + // it, LiteLoader's Input manager provides a convenience method for this | ||
97 | LiteLoader.getInput().registerKeyBinding(LiteModExample.clockKeyBinding); | 103 | LiteLoader.getInput().registerKeyBinding(LiteModExample.clockKeyBinding); |
98 | 104 | ||
99 | this.clock.setSize(this.clockSize); | 105 | this.clock.setSize(this.clockSize); |
@@ -101,9 +107,11 @@ public class LiteModExample implements Tickable, PreRenderListener, Configurable | @@ -101,9 +107,11 @@ public class LiteModExample implements Tickable, PreRenderListener, Configurable | ||
101 | } | 107 | } |
102 | 108 | ||
103 | /** | 109 | /** |
104 | - * upgradeSettings is used to notify a mod that its version-specific settings are being migrated | 110 | + * upgradeSettings is used to notify a mod that its version-specific |
111 | + * settings are being migrated | ||
105 | * | 112 | * |
106 | - * @see com.mumfrey.liteloader.LiteMod#upgradeSettings(java.lang.String, java.io.File, java.io.File) | 113 | + * @see com.mumfrey.liteloader.LiteMod#upgradeSettings(java.lang.String, |
114 | + * java.io.File, java.io.File) | ||
107 | */ | 115 | */ |
108 | @Override | 116 | @Override |
109 | public void upgradeSettings(String version, File configPath, File oldConfigPath) | 117 | public void upgradeSettings(String version, File configPath, File oldConfigPath) |
@@ -113,8 +121,9 @@ public class LiteModExample implements Tickable, PreRenderListener, Configurable | @@ -113,8 +121,9 @@ public class LiteModExample implements Tickable, PreRenderListener, Configurable | ||
113 | @Override | 121 | @Override |
114 | public void onTick(Minecraft minecraft, float partialTicks, boolean inGame, boolean clock) | 122 | public void onTick(Minecraft minecraft, float partialTicks, boolean inGame, boolean clock) |
115 | { | 123 | { |
116 | - // The three checks here are critical to ensure that we only draw the clock as part of the "HUD" | ||
117 | - // and don't draw it over active GUI's or other elements | 124 | + // The three checks here are critical to ensure that we only draw the |
125 | + // clock as part of the "HUD" and don't draw it over active GUI's or | ||
126 | + // other elements | ||
118 | if (inGame && minecraft.currentScreen == null && Minecraft.isGuiEnabled()) | 127 | if (inGame && minecraft.currentScreen == null && Minecraft.isGuiEnabled()) |
119 | { | 128 | { |
120 | if (LiteModExample.clockKeyBinding.isPressed()) | 129 | if (LiteModExample.clockKeyBinding.isPressed()) |
@@ -131,8 +140,8 @@ public class LiteModExample implements Tickable, PreRenderListener, Configurable | @@ -131,8 +140,8 @@ public class LiteModExample implements Tickable, PreRenderListener, Configurable | ||
131 | this.clockVisible = this.clock.isVisible(); | 140 | this.clockVisible = this.clock.isVisible(); |
132 | } | 141 | } |
133 | 142 | ||
134 | - // Our @Expose annotations control what properties get saved, this tells liteloader to | ||
135 | - // actually write the properties to disk | 143 | + // Our @Expose annotations control what properties get saved, |
144 | + // this tells liteloader to actually write properties to disk | ||
136 | LiteLoader.getInstance().writeConfig(this); | 145 | LiteLoader.getInstance().writeConfig(this); |
137 | } | 146 | } |
138 | 147 |