Commit cf05cbeaa8ae305c1c7b2d347d0645dd196137fc
1 parent
48a4b5c6
ExampleMod for 1.12, clean up build script
Showing
4 changed files
with
22 additions
and
13 deletions
build.gradle
... | ... | @@ -16,7 +16,7 @@ buildscript { |
16 | 16 | } |
17 | 17 | } |
18 | 18 | dependencies { |
19 | - classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT' | |
19 | + classpath 'net.minecraftforge.gradle:ForgeGradle:' + project.forgeGradleVersion | |
20 | 20 | classpath 'org.spongepowered:mixingradle:0.4-SNAPSHOT' |
21 | 21 | } |
22 | 22 | } |
... | ... | @@ -24,35 +24,38 @@ buildscript { |
24 | 24 | apply plugin: 'net.minecraftforge.gradle.liteloader' |
25 | 25 | apply plugin: 'org.spongepowered.mixin' |
26 | 26 | |
27 | -version = "0.1" | |
28 | 27 | group = "com.mumfrey.examplemod" // http://maven.apache.org/guides/mini/guide-naming-conventions.html |
29 | 28 | archivesBaseName = "examplemod" |
30 | 29 | |
31 | 30 | minecraft { |
32 | - version = "1.11.2" | |
33 | - mappings = "snapshot_20161224" | |
31 | + // these values are defined in the gradle.properties file, so that this file does not need to be altered | |
32 | + version = project.mcVersion | |
33 | + mappings = project.mcMappings | |
34 | 34 | runDir = "run" |
35 | 35 | } |
36 | 36 | |
37 | 37 | sourceSets { |
38 | 38 | main { |
39 | 39 | // Refmap declaration must match the refmap name specified in the json config |
40 | - refMap = "mixins.example.refmap.json" | |
40 | + ext.refMap = "mixins.example.refmap.json" | |
41 | 41 | } |
42 | 42 | } |
43 | 43 | |
44 | 44 | mixin { |
45 | + // liteloader does not do runtime deobfuscation, so in production we use "notch names", mixin needs to know this | |
45 | 46 | defaultObfuscationEnv notch |
46 | 47 | } |
47 | 48 | |
48 | 49 | litemod { |
49 | 50 | json { |
50 | 51 | name = "test" |
51 | - mcversion = "1.11.r2" | |
52 | + mcversion = project.targetVersion | |
53 | + description = "An example litemod project which draws a clock in-game" | |
52 | 54 | mixinConfigs += "mixins.example.json" |
53 | 55 | } |
54 | 56 | } |
55 | 57 | |
56 | 58 | jar { |
59 | + // The litemod task above generates the litemod.json dynamically, you can replace it with a resource if you want more control | |
57 | 60 | from litemod.outputs |
58 | 61 | } | ... | ... |
gradle.properties
0 → 100644
src/main/java/com/examplemod/Clock.java
... | ... | @@ -5,7 +5,7 @@ import static net.minecraft.client.renderer.vertex.DefaultVertexFormats.*; |
5 | 5 | |
6 | 6 | import net.minecraft.client.Minecraft; |
7 | 7 | import net.minecraft.client.renderer.Tessellator; |
8 | -import net.minecraft.client.renderer.VertexBuffer; | |
8 | +import net.minecraft.client.renderer.BufferBuilder; | |
9 | 9 | import net.minecraft.util.ResourceLocation; |
10 | 10 | import org.lwjgl.util.ReadableColor; |
11 | 11 | |
... | ... | @@ -231,7 +231,7 @@ public class Clock |
231 | 231 | // We use the tessellator rather than drawing individual quads because it uses vertex arrays to |
232 | 232 | // draw the quads more efficiently. |
233 | 233 | Tessellator tessellator = Tessellator.getInstance(); |
234 | - VertexBuffer worldRenderer = tessellator.getBuffer(); | |
234 | + BufferBuilder worldRenderer = tessellator.getBuffer(); | |
235 | 235 | worldRenderer.begin(GL_QUADS, POSITION_TEX); |
236 | 236 | worldRenderer.pos(x + 0, y + height, 0).tex(u * texMapScale, v2 * texMapScale).endVertex(); |
237 | 237 | worldRenderer.pos(x + width, y + height, 0).tex(u2 * texMapScale, v2 * texMapScale).endVertex(); |
... | ... | @@ -254,7 +254,7 @@ public class Clock |
254 | 254 | |
255 | 255 | // Draw the quad |
256 | 256 | Tessellator tessellator = Tessellator.getInstance(); |
257 | - VertexBuffer worldRenderer = tessellator.getBuffer(); | |
257 | + BufferBuilder worldRenderer = tessellator.getBuffer(); | |
258 | 258 | worldRenderer.begin(GL_QUADS, POSITION); |
259 | 259 | worldRenderer.pos(x1, y2, 0).endVertex(); |
260 | 260 | worldRenderer.pos(x2, y2, 0).endVertex(); | ... | ... |
src/main/java/com/examplemod/mixin/MixinGuiMainMenu.java
... | ... | @@ -35,11 +35,11 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; |
35 | 35 | @Mixin(GuiMainMenu.class) |
36 | 36 | public abstract class MixinGuiMainMenu extends GuiScreen |
37 | 37 | { |
38 | - @Shadow private int panoramaTimer; | |
38 | + @Shadow private float panoramaTimer; | |
39 | 39 | |
40 | - @Inject(method = "updateScreen()V", at = @At("HEAD")) | |
41 | - private void onUpdateScreen(CallbackInfo ci) | |
40 | + @Inject(method = "drawScreen(IIF)V", at = @At("HEAD")) | |
41 | + private void onUpdateScreen(int mouseX, int mouseY, float partialTicks, CallbackInfo ci) | |
42 | 42 | { |
43 | - this.panoramaTimer += 4; | |
43 | + this.panoramaTimer += partialTicks * 3; | |
44 | 44 | } |
45 | 45 | } | ... | ... |