Skip to content

Commit

Permalink
Merge branch '1.19.4' into no-silent-work
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamCalculator authored Mar 22, 2024
2 parents 01c4de3 + 674c229 commit 3edfc95
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 27 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ dependencies {
include "net.lingala.zip4j:zip4j:2.11.5"


modApi "com.terraformersmc:modmenu:7.2.2"
modApi "com.terraformersmc:modmenu:6.3.1"

// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

public class Mod {
public static final String VERSION_NAME_MOD = "1.0.14";
public static final String VERSION_NAME_BRANCH = "mc1.20.1";
public static final String VERSION_NAME_BRANCH = "mc1.19.4";
public static final String VERSION_NAME = VERSION_NAME_MOD + "-" + VERSION_NAME_BRANCH;
public static final long VERSION_BUILD = 14;

Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.20.1
yarn_mappings=1.20.1+build.10
minecraft_version=1.19.4
yarn_mappings=1.19.4+build.2
loader_version=0.15.7

#Fabric api
fabric_version=0.92.0+1.20.1
fabric_version=0.87.2+1.19.4

# Mod Properties
mod_version=1.0.14-mc1.20.1
mod_version=1.0.14-mc1.19.4
maven_group=com.adamcalculator
archives_base_name=dynamicpack
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package com.adamcalculator.dynamicpack;

import net.minecraft.client.gui.DrawContext;

import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;

public class DebugScreen extends Screen {
Expand All @@ -11,9 +12,9 @@ protected DebugScreen() {
}

@Override
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
renderBackground(context);
super.render(context, mouseX, mouseY, delta);
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
renderBackground(matrices);
super.render(matrices, mouseX, mouseY, delta);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
import com.adamcalculator.dynamicpack.pack.Pack;
import com.adamcalculator.dynamicpack.sync.SyncingTask;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.screen.ScreenTexts;
import net.minecraft.text.MutableText;
import net.minecraft.text.Text;
Expand Down Expand Up @@ -40,14 +41,14 @@ private void setPack(Pack pack) {
}

@Override
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
public void render(MatrixStack context, int mouseX, int mouseY, float delta) {
renderBackground(context);
syncButton.active = !SyncingTask.isSyncing;
int h = 20;
context.drawTextWithShadow(this.textRenderer, this.title, 20, 8, 16777215);
context.drawTextWithShadow(this.textRenderer, screenDescText, 20, 20 + h, 16777215);
context.drawTextWithShadow(this.textRenderer, Text.translatable("dynamicpack.screen.pack.remote_type", pack.getRemoteType()), 20, 36 + h, 16777215);
context.drawTextWithShadow(this.textRenderer, Text.translatable("dynamicpack.screen.pack.latestUpdated", pack.getLatestUpdated() < 0 ? "-" : new Date(pack.getLatestUpdated() * 1000)), 20, 52 + h, 16777215);
DrawableHelper.drawTextWithShadow(context, this.textRenderer, this.title, 20, 8, 16777215);
DrawableHelper.drawTextWithShadow(context, this.textRenderer, screenDescText, 20, 20 + h, 16777215);
DrawableHelper.drawTextWithShadow(context, this.textRenderer, Text.translatable("dynamicpack.screen.pack.remote_type", pack.getRemoteType()), 20, 36 + h, 16777215);
DrawableHelper.drawTextWithShadow(context, this.textRenderer, Text.translatable("dynamicpack.screen.pack.latestUpdated", pack.getLatestUpdated() < 0 ? "-" : new Date(pack.getLatestUpdated() * 1000)), 20, 52 + h, 16777215);

if (pack.getLatestException() != null) {
DrawingUtil.drawWrappedString(context, Text.translatable("dynamicpack.screen.pack.latestException", pack.getLatestException().getMessage()).asTruncatedString(9999), 20, 78 + h, 500, 99, 0xff2222);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package com.adamcalculator.dynamicpack;

import com.adamcalculator.dynamicpack.pack.Pack;
import com.adamcalculator.dynamicpack.sync.SyncingTask;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.gui.screen.pack.PackListWidget;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.Identifier;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
Expand All @@ -12,13 +15,15 @@ public class PackMixinHelper {
private static final Identifier BUTTON_TEXTURE = Identifier.of("dynamicpack", "select_button.png");
private static final Identifier BUTTON_WARNING_TEXTURE = Identifier.of("dynamicpack", "select_button_warning.png");

public static void renderResourcePackEntry(Object resourcePackEntryMixin, DrawContext context, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta, CallbackInfo ci) {
public static void renderResourcePackEntry(Object resourcePackEntryMixin, MatrixStack context, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta, CallbackInfo ci) {
PackListWidget.ResourcePackEntry entry = (PackListWidget.ResourcePackEntry) resourcePackEntryMixin;
Pack pack = DynamicPackModBase.INSTANCE.getDynamicPackByMinecraftName(entry.getName());
if (pack != null) {
int i = mouseX - x;
int j = mouseY - y;
context.drawTexture(pack.getLatestException() != null ? BUTTON_WARNING_TEXTURE : BUTTON_TEXTURE, x + 174, y+16, 0.0F, ((i >= 174 && j >= 16 && hovered) ? 16f : 0f), 16, 16, 16, 32);

RenderSystem.setShaderTexture(0, pack.getLatestException() != null ? BUTTON_WARNING_TEXTURE : BUTTON_TEXTURE);
DrawableHelper.drawTexture(context, x + 174, y+16, 0.0F, ((i >= 174 && j >= 16 && hovered) ? 16f : 0f), 16, 16, 16, 32);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@
import com.adamcalculator.dynamicpack.DynamicPackModBase;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.RunArgs;
import net.minecraft.client.realms.RealmsClient;
import net.minecraft.resource.ResourceReload;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(MinecraftClient.class)
public class MinecraftClientMixin {
@Inject(at = @At("RETURN"), method = "onInitFinished")
private void dynamicpack$initCheck(RealmsClient realms, ResourceReload reload, RunArgs.QuickPlay quickPlay, CallbackInfo ci) {
@Inject(at = @At("RETURN"), method = "<init>")
private void dynamicpack$initCheck(RunArgs args, CallbackInfo ci) {
DynamicPackModBase.INSTANCE.minecraftInitialized();
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.adamcalculator.dynamicpack.mixin.client;

import com.adamcalculator.dynamicpack.PackMixinHelper;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.pack.PackListWidget;
import net.minecraft.client.util.math.MatrixStack;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
Expand All @@ -16,8 +16,8 @@ public abstract class ResourcePackEntryMixin {
@Shadow @Final private PackListWidget widget;

@Inject(at = @At("RETURN"), method = "render")
private void render(DrawContext context, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta, CallbackInfo ci) {
PackMixinHelper.renderResourcePackEntry(this, context, index, y, x, entryWidth, entryHeight, mouseX, mouseY, hovered, tickDelta, ci);
private void render(MatrixStack matrixStack, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta, CallbackInfo ci) {
PackMixinHelper.renderResourcePackEntry(this, matrixStack, index, y, x, entryWidth, entryHeight, mouseX, mouseY, hovered, tickDelta, ci);
}

@Inject(at = @At("RETURN"), method = "mouseClicked")
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
],
"depends": {
"fabricloader": ">=0.14.0",
"minecraft": ">=1.20.1",
"minecraft": "~1.19.4",
"java": ">=17"
}
}

0 comments on commit 3edfc95

Please sign in to comment.