-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add 1.20.5 support; use better injection points
- Loading branch information
1 parent
92c7f05
commit 6534ce9
Showing
16 changed files
with
195 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
base { | ||
archivesName = archivesName.get() + '-compat-1.20.5' | ||
} | ||
|
||
dependencies { | ||
api project(path: ':microdurability-1.20', configuration: 'namedElements') | ||
|
||
minecraft "com.mojang:minecraft:${project.minecraft_version_1_20_5}" | ||
mappings "net.fabricmc:yarn:${project.yarn_mappings_1_20_5}:v2" | ||
|
||
// Other mods | ||
modImplementation "com.terraformersmc:modmenu:${project.modmenu_version_1_20_5}" | ||
modImplementation("me.shedaniel.cloth:cloth-config-fabric:${project.cloth_config_version_1_20_5}") { | ||
exclude(group: 'net.fabricmc.fabric-api') | ||
} | ||
|
||
|
||
if (project.use_third_party_mods == 'true') { | ||
// Use full Fabric API bundle while debugging, since transitive deps aren't always declared correctly | ||
modRuntimeOnly "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version_1_20_5}" | ||
|
||
modRuntimeOnly "maven.modrinth:sodium:${project.sodium_version_1_20_5}" | ||
modRuntimeOnly "maven.modrinth:lithium:${project.lithium_version_1_20_5}" | ||
modRuntimeOnly "maven.modrinth:ferrite-core:${project.ferritecore_version_1_20_5}" | ||
modRuntimeOnly "maven.modrinth:threadtweak:${project.threadtweak_version_1_20_5}" | ||
modRuntimeOnly "maven.modrinth:fadeless:${project.fadeless_version_1_20_5}" | ||
|
||
// Comment out the following dependencies to check vanilla compatibility | ||
modRuntimeOnly "maven.modrinth:raised:${project.raised_version_1_20_5}" | ||
// modRuntimeOnly "maven.modrinth:double-hotbar:${project.double_hotbar_version_1_20_5}" | ||
} | ||
} | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_21 | ||
targetCompatibility = JavaVersion.VERSION_21 | ||
} | ||
|
||
tasks.withType(JavaCompile).configureEach { | ||
it.options.release = 21 | ||
} |
20 changes: 20 additions & 0 deletions
20
...ility-1.20.5/src/main/java/com/github/reviversmc/microdurability/MicroDurability1205.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.github.reviversmc.microdurability; | ||
|
||
import java.util.function.Supplier; | ||
|
||
import com.github.reviversmc.microdurability.mccompat.McVersionCompatInitializer; | ||
import com.github.reviversmc.microdurability.mccompat.McVersionHelper; | ||
|
||
public class MicroDurability1205 extends McVersionCompatInitializer { | ||
static final Supplier<Boolean> IS_COMPATIBLE = () -> McVersionHelper.isWithin("1.20.5", McVersionHelper.INFINITY); | ||
|
||
@Override | ||
public boolean isCompatible() { | ||
return IS_COMPATIBLE.get(); | ||
} | ||
|
||
@Override | ||
protected void initialize() { | ||
MicroDurability.renderer = new Renderer1205(); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...ability-1.20.5/src/main/java/com/github/reviversmc/microdurability/MixinProvider1205.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.github.reviversmc.microdurability; | ||
|
||
import java.util.List; | ||
|
||
import com.github.reviversmc.microdurability.mccompat.McVersionMixinProvider; | ||
|
||
public class MixinProvider1205 extends McVersionMixinProvider { | ||
@Override | ||
public List<String> getMixins() { | ||
if (MicroDurability1205.IS_COMPATIBLE.get()) { | ||
return List.of("InGameHudMixin1205"); | ||
} | ||
|
||
return null; | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
microdurability-1.20.5/src/main/java/com/github/reviversmc/microdurability/Renderer1205.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package com.github.reviversmc.microdurability; | ||
|
||
public class Renderer1205 extends Renderer120 { | ||
} |
28 changes: 28 additions & 0 deletions
28
...-1.20.5/src/main/java/com/github/reviversmc/microdurability/mixin/InGameHudMixin1205.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.github.reviversmc.microdurability.mixin; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
import net.minecraft.client.gui.DrawContext; | ||
import net.minecraft.client.gui.hud.InGameHud; | ||
|
||
import com.github.reviversmc.microdurability.MicroDurability; | ||
|
||
@Mixin(InGameHud.class) | ||
public class InGameHudMixin1205 { | ||
@Shadow | ||
private int ticks; | ||
|
||
@Inject(method = "renderHotbar", at = @At("HEAD")) | ||
private void renderArmorArea(DrawContext context, float delta, CallbackInfo callbackInfo) { | ||
MicroDurability.renderer.renderArmorArea(context, ticks); | ||
} | ||
|
||
@Inject(method = "renderCrosshair", at = @At("HEAD")) | ||
private void renderHeldItemExclamationMark(DrawContext context, float delta, CallbackInfo callbackInfo) { | ||
MicroDurability.renderer.renderHeldItemLowDurabilityWarning(context, ticks); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"schemaVersion": 1, | ||
"id": "microdurability-compat-1-20-5", | ||
"version": "${version}", | ||
"name": "microDurability 1.20.5 Compat", | ||
"license": "MPL-2.0", | ||
"environment": "client", | ||
"entrypoints": { | ||
"microdurability": [ | ||
"com.github.reviversmc.microdurability.MicroDurability1205" | ||
], | ||
"modmenu": [ | ||
"com.github.reviversmc.microdurability.integration.ModMenuIntegration" | ||
] | ||
}, | ||
"mixins": [ | ||
"microdurability1205.mixins.json" | ||
], | ||
"depends": { | ||
"fabricloader": ">=0.12.9", | ||
"minecraft": ">=1.20.5", | ||
"microdurability-compat-1-20": "*" | ||
}, | ||
"custom": { | ||
"modmenu": { | ||
"badges": ["library"], | ||
"parent": { | ||
"id": "microdurability" | ||
} | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
microdurability-1.20.5/src/main/resources/microdurability1205.mixins.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"required": true, | ||
"package": "com.github.reviversmc.microdurability.mixin", | ||
"compatibilityLevel": "JAVA_21", | ||
"plugin": "com.github.reviversmc.microdurability.MixinProvider1205", | ||
"injectors": { | ||
"defaultRequire": 1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters