Skip to content

Commit

Permalink
Update to 1.20.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamalam360 committed Jun 11, 2024
1 parent 669f22d commit fe2a226
Show file tree
Hide file tree
Showing 20 changed files with 59 additions and 478 deletions.
18 changes: 3 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,32 +27,20 @@ jobs:
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1

- name: Setup JDK 17
- name: Setup JDK 21
uses: actions/setup-java@v1
with:
java-version: 17
java-version: 21

- name: Build
run: ./gradlew clean forge:build neoforge:build fabric:build quilt:build
run: ./gradlew clean neoforge:build fabric:build

- name: Capture Fabric Build Artifacts
uses: actions/upload-artifact@v2
with:
name: Fabric Artifacts
path: fabric/build/libs/

- name: Capture Quilt Build Artifacts
uses: actions/upload-artifact@v2
with:
name: Quilt Artifacts
path: quilt/build/libs/

- name: Capture Forge Build Artifacts
uses: actions/upload-artifact@v2
with:
name: Forge Artifacts
path: forge/build/libs/

- name: Capture NeoForge Build Artifacts
uses: actions/upload-artifact@v2
with:
Expand Down
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
- Icon update.
- Fix #1: allow setting the behaviour when the server has a resource pack (`resourcePackBehaviour` config option).
Update to 1.20.6
10 changes: 6 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.5-SNAPSHOT" apply false
id "dev.architectury.loom" version "1.6-SNAPSHOT" apply false
id "com.github.breadmoirai.github-release" version "2.4.1"
}

Expand Down Expand Up @@ -55,6 +55,10 @@ allprojects {
version = rootProject.version
group = rootProject.group

base {
archivesName = "quickerconnectbutton"
}

repositories {
mavenCentral()

Expand All @@ -71,7 +75,7 @@ allprojects {

tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
options.release = 17
options.release = 21
}

tasks.create("prepareWorkspace") {}
Expand All @@ -84,8 +88,6 @@ allprojects {
dependsOn("clean")
dependsOn("githubRelease")
dependsOn("fabric:publishUnified")
dependsOn("quilt:publishUnified")
dependsOn("forge:publishUnified")
dependsOn("neoforge:publishUnified")
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.github.jamalam360.quickerconnectbutton.mixin;

import io.github.jamalam360.quickerconnectbutton.QuickerConnectButton;
import java.util.Objects;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.components.Tooltip;
import net.minecraft.client.gui.screens.ConnectScreen;
Expand All @@ -13,76 +14,46 @@
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.ModifyArg;
import org.spongepowered.asm.mixin.injection.ModifyArgs;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;

import java.util.Objects;
import org.spongepowered.asm.mixin.injection.invoke.arg.Args;

@Mixin(TitleScreen.class)
public class TitleScreenMixin extends Screen {
protected TitleScreenMixin(Component component) {
super(component);
}

@Inject(
method = "createNormalMenuOptions",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/TitleScreen;addRenderableWidget(Lnet/minecraft/client/gui/components/events/GuiEventListener;)Lnet/minecraft/client/gui/components/events/GuiEventListener;", ordinal = 1, shift = At.Shift.BEFORE),
locals = LocalCapture.CAPTURE_FAILHARD
)
private void quickerconnectbutton$injectCustomButton(int a, int b, CallbackInfo info, Component multiplayerDisabledReason, boolean multiplayerDisabled, Tooltip multiplayerDisabledTooltip) {
if (QuickerConnectButton.CONFIG.get().enabled() && !QuickerConnectButton.CONFIG.get().replaceMultiplayerButton) {
Component text = QuickerConnectButton.CONFIG.get().getButtonText();
int width = Mth.clamp(Objects.requireNonNull(this.minecraft).font.width(text), 50, this.width - (this.width / 2 + 108));

this.addRenderableWidget(Button.builder(text, button -> {
ServerData data = QuickerConnectButton.createServerData();
ConnectScreen.startConnecting(this, this.minecraft, ServerAddress.parseString(data.ip), data, false);
}).bounds(this.width / 2 + 104, a + b, width, 20).tooltip(multiplayerDisabledTooltip).build()).active = multiplayerDisabled;
}
}

//FIXME: Apparently ModifyArgs straight up doesn't work on Forge (modlauncher). Using two (ModifyArg)s instead.
// @ModifyArgs(
// method = "createNormalMenuOptions",
// at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/components/Button;builder(Lnet/minecraft/network/chat/Component;Lnet/minecraft/client/gui/components/Button$OnPress;)Lnet/minecraft/client/gui/components/Button$Builder;", ordinal = 1)
// )
// private void quickerconnectbutton$modifyMultiplayerButton(Args args) {
// if (QuickerConnectButton.CONFIG.get().replaceMultiplayerButton) {
// args.set(0, QuickerConnectButton.CONFIG.get().getButtonText());
// args.<Button.OnPress>set(1, (button) -> {
// ServerData data = QuickerConnectButton.createServerData();
// ConnectScreen.startConnecting(this, Objects.requireNonNull(this.minecraft), ServerAddress.parseString(data.ip), data, false);
// });
// }
// }

@ModifyArg(
method = "createNormalMenuOptions",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/components/Button;builder(Lnet/minecraft/network/chat/Component;Lnet/minecraft/client/gui/components/Button$OnPress;)Lnet/minecraft/client/gui/components/Button$Builder;", ordinal = 1),
index = 0
)
private Component quickerconnectbutton$modifyMultiplayerButtonText(Component text) {
if (QuickerConnectButton.CONFIG.get().replaceMultiplayerButton) {
return QuickerConnectButton.CONFIG.get().getButtonText();
} else {
return text;
}
}

@ModifyArg(
method = "createNormalMenuOptions",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/components/Button;builder(Lnet/minecraft/network/chat/Component;Lnet/minecraft/client/gui/components/Button$OnPress;)Lnet/minecraft/client/gui/components/Button$Builder;", ordinal = 1),
index = 1
)
private Button.OnPress quickerconnectbutton$modifyMultiplayerButtonOnPress(Button.OnPress onPress) {
if (QuickerConnectButton.CONFIG.get().replaceMultiplayerButton) {
return (button) -> {
ServerData data = QuickerConnectButton.createServerData();
ConnectScreen.startConnecting(this, Objects.requireNonNull(this.minecraft), ServerAddress.parseString(data.ip), data, false);
};
} else {
return onPress;
}
}
protected TitleScreenMixin(Component component) {
super(component);
}

@Inject(
method = "createNormalMenuOptions",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/TitleScreen;addRenderableWidget(Lnet/minecraft/client/gui/components/events/GuiEventListener;)Lnet/minecraft/client/gui/components/events/GuiEventListener;", ordinal = 1, shift = At.Shift.BEFORE),
locals = LocalCapture.CAPTURE_FAILHARD
)
private void quickerconnectbutton$injectCustomButton(int a, int b, CallbackInfo info, Component multiplayerDisabledReason, boolean multiplayerDisabled, Tooltip multiplayerDisabledTooltip) {
if (QuickerConnectButton.CONFIG.get().enabled() && !QuickerConnectButton.CONFIG.get().replaceMultiplayerButton) {
Component text = QuickerConnectButton.CONFIG.get().getButtonText();
int width = Mth.clamp(Objects.requireNonNull(this.minecraft).font.width(text), 50, this.width - (this.width / 2 + 108));

this.addRenderableWidget(Button.builder(text, button -> {
ServerData data = QuickerConnectButton.createServerData();
ConnectScreen.startConnecting(this, this.minecraft, ServerAddress.parseString(data.ip), data, false, null);
}).bounds(this.width / 2 + 104, a + b, width, 20).tooltip(multiplayerDisabledTooltip).build()).active = multiplayerDisabled;
}
}

@ModifyArgs(
method = "createNormalMenuOptions",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/components/Button;builder(Lnet/minecraft/network/chat/Component;Lnet/minecraft/client/gui/components/Button$OnPress;)Lnet/minecraft/client/gui/components/Button$Builder;", ordinal = 1)
)
private void quickerconnectbutton$modifyMultiplayerButton(Args args) {
if (QuickerConnectButton.CONFIG.get().replaceMultiplayerButton) {
args.set(0, QuickerConnectButton.CONFIG.get().getButtonText());
args.<Button.OnPress>set(1, (button) -> {
ServerData data = QuickerConnectButton.createServerData();
ConnectScreen.startConnecting(this, Objects.requireNonNull(this.minecraft), ServerAddress.parseString(data.ip), data, false, null);
});
}
}
}
2 changes: 1 addition & 1 deletion fabric/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "com.github.johnrengelman.shadow" version "7.1.2"
id "com.github.johnrengelman.shadow" version "8.1.1"
id "me.shedaniel.unified-publishing" version "0.1.+"
}

Expand Down
113 changes: 0 additions & 113 deletions forge/build.gradle

This file was deleted.

1 change: 0 additions & 1 deletion forge/gradle.properties

This file was deleted.

This file was deleted.

43 changes: 0 additions & 43 deletions forge/src/main/resources/META-INF/mods.toml

This file was deleted.

6 changes: 0 additions & 6 deletions forge/src/main/resources/pack.mcmeta

This file was deleted.

Loading

0 comments on commit fe2a226

Please sign in to comment.