Skip to content

Commit

Permalink
Update for MC 1.19.4 (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
MeeniMc authored Sep 1, 2023
1 parent 55acb2f commit 52c5442
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 23 deletions.
16 changes: 8 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ maven_group = com.github.reviversmc
archives_base_name = microdurability

# Global Dependencies
fabric_loader_version = 0.14.6
fabric_loader_version = 0.14.18
spotbugs_version = 4.7.0

# Module Dependencies
Expand All @@ -18,11 +18,11 @@ fabric_version_1_17 = 0.46.1+1.17
modmenu_version_1_17 = 2.0.14
cloth_config_version_1_17 = 5.3.63
# 1.19
minecraft_version_1_19 = 1.19
yarn_mappings_1_19 = 1.19+build.1
fabric_version_1_19 = 0.55.2+1.19
modmenu_version_1_19 = 4.0.0-beta.4
cloth_config_version_1_19 = 7.0.65
minecraft_version_1_19 = 1.19.4
yarn_mappings_1_19 = 1.19.4+build.1
fabric_version_1_19 = 0.76.0+1.19.4
modmenu_version_1_19 = 6.1.0-rc.4
cloth_config_version_1_19 = 10.0.96

# If true, third-party mods will be loaded during runtime in the developer run configurations
use_third_party_mods = true
Expand All @@ -36,6 +36,6 @@ 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
# 1.19
lazydfu_version_1_19 = 0.1.2
smoothboot_version_1_19 = 3692365
lazydfu_version_1_19 = 0.1.3
smoothboot_version_1_19 = 1.19.4-1.7.0
no_fade_version_1_19 = 3550935
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion microdurability-1.17/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '0.11-SNAPSHOT'
id 'fabric-loom' version '1.1-SNAPSHOT'
id 'io.github.juuxel.loom-quiltflower' version '1.8.0'
id 'maven-publish'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,34 @@

import com.mojang.blaze3d.systems.RenderSystem;

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.item.ItemStack;

public class Renderer117 extends RendererBase {

@Override
protected void disableRenderSystems() {
RenderSystem.disableDepthTest();
RenderSystem.disableTexture();
RenderSystem.disableBlend();
}
@Override
protected void enableRenderSystems() {
RenderSystem.enableBlend();
RenderSystem.enableTexture();
RenderSystem.enableDepthTest();
}

@Override
protected Iterable<ItemStack> getHandItems(ClientPlayerEntity player) {
return player.getItemsHand();
}

@Override
protected void renderGuiQuad(BufferBuilder buffer, int x, int y, int width, int height, int red, int green,
int blue, int alpha) {
Expand Down
4 changes: 2 additions & 2 deletions microdurability-1.19/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '0.11-SNAPSHOT'
id 'fabric-loom' version '1.1-SNAPSHOT'
id 'io.github.juuxel.loom-quiltflower' version '1.8.0'
id 'maven-publish'
}
Expand All @@ -10,7 +10,7 @@ targetCompatibility = JavaVersion.VERSION_17

archivesBaseName = project.archives_base_name
def mod_version = project.mod_version as Object
version = "${mod_version}+1.19"
version = "${mod_version}+1.19.4"

apply from: '../common.gradle'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,51 @@

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;

public class Renderer119 extends RendererBase {

@Override
public void renderWarning(MatrixStack matrixStack, int x, int y) {
RenderSystem.setShaderTexture(0, TEX);
DrawableHelper.drawTexture(matrixStack, x, y, 0, 0, 3, 11);
RenderSystem.setShaderTexture(0, GUI_ICONS_TEXTURE);
}

@Override
protected void disableRenderSystems() {
RenderSystem.disableDepthTest();
RenderSystem.disableBlend();
}
@Override
protected void enableRenderSystems() {
RenderSystem.enableBlend();
RenderSystem.enableDepthTest();
}

@Override
protected Iterable<ItemStack> getHandItems(ClientPlayerEntity player) {
return player.getHandItems();
}

@Override
protected void renderGuiQuad(BufferBuilder buffer, int x, int y, int width, int height, int red, int green,
int blue, int alpha) {
RenderSystem.setShader(GameRenderer::getPositionColorShader);
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
buffer.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
buffer.vertex(x, y, 0.0D).color(red, green, blue, alpha).next();
buffer.vertex(x, y + height, 0.0D).color(red, green, blue, alpha).next();
buffer.vertex(x + width, y + height, 0.0D).color(red, green, blue, alpha).next();
buffer.vertex(x + width, y, 0.0D).color(red, green, blue, alpha).next();
BufferRenderer.drawWithShader(buffer.end());
BufferRenderer.drawWithGlobalProgram(buffer.end());
}

}
2 changes: 1 addition & 1 deletion microdurability-core/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '0.11-SNAPSHOT'
id 'fabric-loom' version '1.1-SNAPSHOT'
id 'io.github.juuxel.loom-quiltflower' version '1.8.0'
id 'maven-publish'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.render.*;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;

public abstract class RendererBase extends DrawableHelper implements HudRenderCallback {
private static final Identifier TEX = new Identifier("microdurability", "textures/gui/icons.png");
protected static final Identifier TEX = new Identifier("microdurability", "textures/gui/icons.png");
private final MinecraftClient mc;

private float time = 0;
Expand All @@ -28,7 +29,7 @@ public void onHudRender(MatrixStack matrixStack, float delta) {

// Render held item low durability warning
if (MicroDurability.config.lowDurabilityWarning.displayWarningForTools) {
for (ItemStack item : mc.player.getItemsHand()) {
for (ItemStack item : getHandItems(mc.player)) {
if (MicroDurability.shouldWarn(item)) {
if (MicroDurability.config.lowDurabilityWarning.blinkTime > 0
&& time < MicroDurability.config.lowDurabilityWarning.blinkTime * 20f) {
Expand Down Expand Up @@ -84,9 +85,7 @@ public void renderBar(ItemStack stack, int x, int y) {
if (!MicroDurability.config.armorBars.displayBarsForUndamagedArmor && !stack.isItemBarVisible()) return;
if (!stack.isDamageable()) return;

RenderSystem.disableDepthTest();
RenderSystem.disableTexture();
RenderSystem.disableBlend();
disableRenderSystems();
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferBuilder = tessellator.getBuffer();
int width = stack.getItemBarStep();
Expand All @@ -109,10 +108,13 @@ public void renderBar(ItemStack stack, int x, int y) {
alpha = 255;
}
this.renderGuiQuad(bufferBuilder, x, y, width, 1, red, green, blue, alpha);
RenderSystem.enableBlend();
RenderSystem.enableTexture();
RenderSystem.enableDepthTest();
enableRenderSystems();
}

protected abstract void enableRenderSystems();
protected abstract void disableRenderSystems();

protected abstract Iterable<ItemStack> getHandItems(ClientPlayerEntity e);

protected abstract void renderGuiQuad(BufferBuilder buffer, int x, int y, int width, int height, int red, int green, int blue, int alpha);
}

0 comments on commit 52c5442

Please sign in to comment.