Skip to content

Commit

Permalink
Add 1.20 support, update 3rd-party mod compat, refactor Renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
NebelNidas committed Jun 12, 2024
1 parent af80463 commit b738490
Show file tree
Hide file tree
Showing 28 changed files with 581 additions and 70 deletions.
18 changes: 11 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ subprojects {
}

repositories {
if (project.use_third_party_mods == 'true') {
maven {
name = 'Modrinth'
url = 'https://api.modrinth.com/maven'
content {
includeGroup 'maven.modrinth'
}
maven {
name = 'Modrinth'
url = 'https://api.modrinth.com/maven'
content {
includeGroup 'maven.modrinth'
}
}
if (project.use_third_party_mods == 'true') {
maven {
url = 'https://cursemaven.com'
content {
Expand Down Expand Up @@ -132,4 +132,8 @@ subprojects {
}
}
}

build.doFirst {
use_third_party_mods = 'false'
}
}
21 changes: 20 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ cloth_config_version_1_19 = 8.3.115
minecraft_version_1_19_4 = 1.19.4
yarn_mappings_1_19_4 = 1.19.4+build.2
cloth_config_version_1_19_4 = 10.1.117
# 1.20
minecraft_version_1_20 = 1.20.1
yarn_mappings_1_20 = 1.20.1+build.10
cloth_config_version_1_20 = 11.1.118

# Dev-Env Mods
use_third_party_mods = true
Expand All @@ -43,7 +47,8 @@ starlight_version_1_17 = Starlight 1.0.0 1.17.x
ferritecore_version_1_17 = 3.0.3
smoothboot_version_1_17 = 1.16.5-1.6.0
no_fade_version_1_17 = 3355800
raised_version_1_17 = Fabric-1.17.1-1.1.2
raised_version_1_17 = Fabric-1.17.1-3.1.3
double_hotbar_version_1_17 = 1.1.0-mc1.17.1-fabric
# 1.19
fabric_api_version_1_19 = 0.76.1+1.19.2
modmenu_version_1_19 = 4.2.0-beta.2
Expand All @@ -55,6 +60,8 @@ starlight_version_1_19 = 1.1.1+1.19
ferritecore_version_1_19 = 5.0.3-fabric
smoothboot_version_1_19 = 3821513
no_fade_version_1_19 = 3550935
raised_version_1_19 = Fabric-1.19.2-3.1.3
double_hotbar_version_1_19 = 4034709
# 1.19.4
fabric_api_version_1_19_4 = 0.87.2+1.19.4
modmenu_version_1_19_4 = 6.3.1
Expand All @@ -64,3 +71,15 @@ starlight_version_1_19_4 = 1.1.1+1.19
ferritecore_version_1_19_4 = 5.2.0-fabric
smoothboot_version_1_19_4 = 4441240
no_fade_version_1_19_4 = 3550935
raised_version_1_19_4 = Fabric-1.19.4-3.1.3
double_hotbar_version_1_19_4 = 1.3.1-mc1.19.4-fabric
# 1.20
fabric_api_version_1_20 = 0.92.1+1.20.1
modmenu_version_1_20 = 7.2.2
sodium_version_1_20 = mc1.20.1-0.5.8
lithium_version_1_20 = mc1.20.1-0.11.2
ferritecore_version_1_20 = 6.0.1-fabric
threadtweak_version_1_20 = 0.1.1+mc1.20.2
fadeless_version_1_20 = 1.0.1
raised_version_1_20 = Fabric-1.20.2-3.1.3
double_hotbar_version_1_20 = 1.3.1-mc1.20.1-fabric
4 changes: 4 additions & 0 deletions microdurability-1.17/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ dependencies {
modRuntimeOnly "maven.modrinth:ferrite-core:${project.ferritecore_version_1_17}"
modRuntimeOnly "maven.modrinth:smoothboot-fabric:${project.smoothboot_version_1_17}"
modRuntimeOnly "curse.maven:no-fade-452768:${project.no_fade_version_1_17}"

// Comment out the following dependencies to check vanilla compatibility
modRuntimeOnly "maven.modrinth:raised:${project.raised_version_1_17}"
modRuntimeOnly "maven.modrinth:double-hotbar:${project.double_hotbar_version_1_17}"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@

import com.mojang.blaze3d.systems.RenderSystem;

import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.render.BufferBuilder;
import net.minecraft.client.render.BufferRenderer;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.render.VertexFormat;
import net.minecraft.client.render.VertexFormats;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;

public class Renderer117 extends RendererBase {
private static final DrawableHelper drawableHelper = new DrawableHelper() {};

@Override
protected void disableRenderSystems() {
RenderSystem.disableDepthTest();
Expand All @@ -25,6 +30,13 @@ protected void enableRenderSystems() {
RenderSystem.enableDepthTest();
}

@Override
protected void drawWarningTexture(Identifier texture, Object context, int x, int y, int u, int v, int width, int height) {
RenderSystem.setShaderTexture(0, texture);
drawableHelper.drawTexture((MatrixStack) context, x, y, u, v, width, height);
RenderSystem.setShaderTexture(0, DrawableHelper.GUI_ICONS_TEXTURE);
}

@Override
protected Iterable<ItemStack> getHandItems(ClientPlayerEntity player) {
return player.getItemsHand();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
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;
Expand All @@ -12,14 +13,28 @@

@Mixin(InGameHud.class)
public class InGameHudMixin117 {
@Shadow
private int ticks;

@Inject(
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/hud/InGameHud;renderStatusBars(Lnet/minecraft/client/util/math/MatrixStack;)V"
),
method = "render"
)
public void renderMicroDurability(MatrixStack matrices, float delta, CallbackInfo callbackInfo) {
MicroDurability117.renderer.onHudRender(matrices, delta);
private void renderArmorArea(MatrixStack matrices, float delta, CallbackInfo callbackInfo) {
MicroDurability117.renderer.renderArmorArea(matrices, ticks, delta);
}

@Inject(
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/hud/InGameHud;renderCrosshair(Lnet/minecraft/client/util/math/MatrixStack;)V"
),
method = "render"
)
private void renderHeldItemExclamationMark(MatrixStack matrices, float delta, CallbackInfo callbackInfo) {
MicroDurability117.renderer.renderHeldItemLowDurabilityWarning(matrices, ticks, delta);
}
}
2 changes: 1 addition & 1 deletion microdurability-1.17/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"com.github.reviversmc.microdurability.MicroDurability117"
],
"modmenu": [
"com.github.reviversmc.microdurability.ModMenuIntegration"
"com.github.reviversmc.microdurability.integration.ModMenuIntegration"
]
},
"mixins": [
Expand Down
4 changes: 4 additions & 0 deletions microdurability-1.19.4/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ dependencies {
modRuntimeOnly "maven.modrinth:ferrite-core:${project.ferritecore_version_1_19_4}"
modRuntimeOnly "curse.maven:smooth-boot-415758:${project.smoothboot_version_1_19_4}"
modRuntimeOnly "curse.maven:no-fade-452768:${project.no_fade_version_1_19_4}"

// Comment out the following dependencies to check vanilla compatibility
modRuntimeOnly "maven.modrinth:raised:${project.raised_version_1_19_4}"
modRuntimeOnly "maven.modrinth:double-hotbar:${project.double_hotbar_version_1_19_4}"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@

import com.mojang.blaze3d.systems.RenderSystem;

import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.render.BufferBuilder;
import net.minecraft.client.render.BufferRenderer;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.render.VertexFormat;
import net.minecraft.client.render.VertexFormats;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;

public class Renderer1194 extends RendererBase {
@Override
Expand All @@ -23,6 +26,13 @@ protected void enableRenderSystems() {
RenderSystem.enableDepthTest();
}

@Override
protected void drawWarningTexture(Identifier texture, Object context, int x, int y, int u, int v, int width, int height) {
RenderSystem.setShaderTexture(0, texture);
DrawableHelper.drawTexture((MatrixStack) context, x, y, u, v, width, height);
RenderSystem.setShaderTexture(0, DrawableHelper.GUI_ICONS_TEXTURE);
}

@Override
protected Iterable<ItemStack> getHandItems(ClientPlayerEntity player) {
return player.getHandItems();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
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;
Expand All @@ -12,14 +13,28 @@

@Mixin(InGameHud.class)
public class InGameHudMixin1194 {
@Shadow
private int ticks;

@Inject(
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/hud/InGameHud;renderStatusBars(Lnet/minecraft/client/util/math/MatrixStack;)V"
),
method = "render"
)
public void renderMicroDurability(MatrixStack matrices, float delta, CallbackInfo callbackInfo) {
MicroDurability1194.renderer.onHudRender(matrices, delta);
private void renderArmorArea(MatrixStack matrices, float delta, CallbackInfo callbackInfo) {
MicroDurability1194.renderer.renderArmorArea(matrices, ticks, delta);
}

@Inject(
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/hud/InGameHud;renderCrosshair(Lnet/minecraft/client/util/math/MatrixStack;)V"
),
method = "render"
)
private void renderHeldItemExclamationMark(MatrixStack matrices, float delta, CallbackInfo callbackInfo) {
MicroDurability1194.renderer.renderHeldItemLowDurabilityWarning(matrices, ticks, delta);
}
}
4 changes: 2 additions & 2 deletions microdurability-1.19.4/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
"com.github.reviversmc.microdurability.MicroDurability1194"
],
"modmenu": [
"com.github.reviversmc.microdurability.ModMenuIntegration"
"com.github.reviversmc.microdurability.integration.ModMenuIntegration"
]
},
"mixins": [
"microdurability.mixins.json"
],
"depends": {
"minecraft": ">=1.19.4-",
"minecraft": ">=1.19.4- <1.20",
"microdurability-core": "*"
}
}
4 changes: 4 additions & 0 deletions microdurability-1.19/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ dependencies {
modRuntimeOnly "maven.modrinth:ferrite-core:${project.ferritecore_version_1_19}"
modRuntimeOnly "curse.maven:smooth-boot-415758:${project.smoothboot_version_1_19}"
modRuntimeOnly "curse.maven:no-fade-452768:${project.no_fade_version_1_19}"

// Comment out the following dependencies to check vanilla compatibility
modRuntimeOnly "maven.modrinth:raised:${project.raised_version_1_19}"
// modRuntimeOnly "curse.maven:double-hotbar-554026:${project.double_hotbar_version_1_19}" // 404s because 3rd-party-sharing is disabled
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@

import com.mojang.blaze3d.systems.RenderSystem;

import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.render.BufferBuilder;
import net.minecraft.client.render.BufferRenderer;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.render.VertexFormat;
import net.minecraft.client.render.VertexFormats;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;

public class Renderer119 extends RendererBase {
private static final DrawableHelper drawableHelper = new DrawableHelper() {};

@Override
protected void disableRenderSystems() {
RenderSystem.disableDepthTest();
Expand All @@ -23,6 +28,13 @@ protected void enableRenderSystems() {
RenderSystem.enableDepthTest();
}

@Override
protected void drawWarningTexture(Identifier texture, Object context, int x, int y, int u, int v, int width, int height) {
RenderSystem.setShaderTexture(0, texture);
drawableHelper.drawTexture((MatrixStack) context, x, y, u, v, width, height);
RenderSystem.setShaderTexture(0, DrawableHelper.GUI_ICONS_TEXTURE);
}

@Override
protected Iterable<ItemStack> getHandItems(ClientPlayerEntity player) {
return player.getHandItems();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
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;
Expand All @@ -12,14 +13,28 @@

@Mixin(InGameHud.class)
public class InGameHudMixin119 {
@Shadow
private int ticks;

@Inject(
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/hud/InGameHud;renderStatusBars(Lnet/minecraft/client/util/math/MatrixStack;)V"
),
method = "render"
)
public void renderMicroDurability(MatrixStack matrices, float delta, CallbackInfo callbackInfo) {
MicroDurability119.renderer.onHudRender(matrices, delta);
private void renderArmorArea(MatrixStack matrices, float delta, CallbackInfo callbackInfo) {
MicroDurability119.renderer.renderArmorArea(matrices, ticks, delta);
}

@Inject(
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/hud/InGameHud;renderCrosshair(Lnet/minecraft/client/util/math/MatrixStack;)V"
),
method = "render"
)
private void renderHeldItemExclamationMark(MatrixStack matrices, float delta, CallbackInfo callbackInfo) {
MicroDurability119.renderer.renderHeldItemLowDurabilityWarning(matrices, ticks, delta);
}
}
2 changes: 1 addition & 1 deletion microdurability-1.19/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"com.github.reviversmc.microdurability.MicroDurability119"
],
"modmenu": [
"com.github.reviversmc.microdurability.ModMenuIntegration"
"com.github.reviversmc.microdurability.integration.ModMenuIntegration"
]
},
"mixins": [
Expand Down
Loading

0 comments on commit b738490

Please sign in to comment.