1
0
forked from Clones/Controlify

🐘 Update to 1.20.2

This commit is contained in:
isXander
2023-09-26 23:12:55 +01:00
parent fb0373253b
commit 94684887cc
12 changed files with 78 additions and 39 deletions

View File

@ -12,7 +12,7 @@ plugins {
}
group = "dev.isxander"
version = "1.7.0-beta.1+1.20"
version = "1.7.0-beta.2+1.20"
val isAlpha = "alpha" in version.toString()
val isBeta = "beta" in version.toString()
if (isAlpha) println("Alpha version detected.")
@ -82,8 +82,6 @@ dependencies {
modRuntimeOnly(libs.fabric.api)
listOf(
// sodium requirements
"fabric-rendering-data-attachment-v1",
"fabric-rendering-fluids-v1",
).forEach {
modRuntimeOnly(fabricApi.module(it, libs.versions.fabric.api.get()))
@ -185,7 +183,7 @@ publishMods {
modLoaders.add("fabric")
// modrinth and curseforge use different formats for snapshots. this can be expressed globally
val stableMCVersions = listOf("1.20", "1.20.1")
val stableMCVersions = listOf("1.20.2")
val modrinthId: String by project
if (modrinthId.isNotBlank() && hasProperty("modrinth.token")) {

View File

@ -0,0 +1,12 @@
# Controlify 1.7.0 (Beta 2) for 1.20.2
## Changes
- Updated to 1.20.2.
- Pressing back button on server list now focuses on the back button.
## Bug Fixes
- Fix pause menu no longer showing button guides (regression in 1.7.0-beta.1).
- Fix NullPointerException when opening radial menu with an invalid action bound.
- Fix crash when discovering controllers without SDL loaded.

View File

@ -6,19 +6,19 @@ machete = "2.+"
grgit = "5.0.+"
blossom = "1.3.+"
minecraft = "1.20.1"
quilt_mappings = "23"
fabric_loader = "0.14.21"
fabric_api = "0.86.1+1.20.1"
minecraft = "1.20.2"
quilt_mappings = "2"
fabric_loader = "0.14.22"
fabric_api = "0.89.2+1.20.2"
mixin_extras = "0.2.0-beta.9"
yet_another_config_lib = "3.1.0+1.20"
mod_menu = "7.0.0"
yet_another_config_lib = "3.2.0+1.20.2"
mod_menu = "8.0.0-beta.2"
hid4java = "0.7.0"
quilt_json5 = "1.0.3"
sodium = "mc1.20.1-0.5.0"
iris = "1.6.5+1.20.1"
immediately_fast = "1.2.0+1.20.1"
simple_voice_chat = "fabric-1.20.1-2.4.18"
sodium = "mc1.20.2-0.5.3"
iris = "1.6.9+1.20.2"
immediately_fast = "1.2.5+1.20.2"
simple_voice_chat = "fabric-1.20.2-2.4.25"
libsdl4j = "2.28.2-11"
[libraries]

View File

@ -113,7 +113,7 @@ public class SDL2NativesManager {
throw new RuntimeException("Failed to initialise SDL2: " + SDL_GetError());
}
DebugLog.log("Initialised SDL2");
Log.LOGGER.info("Initialised SDL4j {}", SDL2_VERSION);
}
private static CompletableFuture<Boolean> downloadAndStart(Path localLibraryPath) {

View File

@ -80,7 +80,7 @@ public class InGameButtonGuide implements IngameGuideRegistry {
}
public void renderHud(GuiGraphics graphics, float tickDelta, int width, int height) {
if (!controller.config().showIngameGuide || minecraft.screen != null || minecraft.options.renderDebug)
if (!controller.config().showIngameGuide || minecraft.screen != null || minecraft.gui.getDebugOverlay().showDebugScreen())
return;
float scale = Controlify.instance().config().globalSettings().ingameButtonGuideScale;

View File

@ -15,6 +15,7 @@ import net.minecraft.client.gui.components.Tooltip;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
import java.util.Arrays;
import java.util.function.Supplier;
@ -29,7 +30,8 @@ import java.util.function.Supplier;
*/
public class ControllerCalibrationScreen extends Screen implements DontInteruptScreen {
private static final int CALIBRATION_TIME = 100;
private static final ResourceLocation GUI_BARS_LOCATION = new ResourceLocation("textures/gui/bars.png");
private static final ResourceLocation GREEN_BACK_BAR = new ResourceLocation("boss_bar/green_background");
private static final ResourceLocation GREEN_FRONT_BAR = new ResourceLocation("boss_bar/green_progress");
protected final Controller<?, ?> controller;
private final Supplier<Screen> parent;
@ -86,7 +88,7 @@ public class ControllerCalibrationScreen extends Screen implements DontInteruptS
@Override
public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
renderBackground(graphics);
renderBackground(graphics, mouseX, mouseY, delta);
super.render(graphics, mouseX, mouseY, delta);
@ -94,10 +96,10 @@ public class ControllerCalibrationScreen extends Screen implements DontInteruptS
graphics.pose().pushPose();
graphics.pose().scale(2f, 2f, 1f);
drawBar(graphics, width / 2 / 2, 30 / 2, 1f, 0);
var progress = (calibrationTicks - 1 + delta) / 100f;
if (progress > 0)
drawBar(graphics, width / 2 / 2, 30 / 2, progress, 5);
float progress = (calibrationTicks - 1 + delta) / 100f;
drawBar(graphics, width / 2 / 2, 30 / 2, progress);
graphics.pose().popPose();
MultiLineLabel label;
@ -115,11 +117,14 @@ public class ControllerCalibrationScreen extends Screen implements DontInteruptS
graphics.pose().popPose();
}
private void drawBar(GuiGraphics graphics, int centerX, int y, float progress, int vOffset) {
progress = 1 - (float)Math.pow(1 - progress, 3);
private void drawBar(GuiGraphics graphics, int centerX, int y, float progress) {
int width = Mth.lerpDiscrete(1 - (float)Math.pow(1 - progress, 3), 0, 182);
int x = centerX - 182 / 2;
graphics.blit(GUI_BARS_LOCATION, x, y, 0, 30 + vOffset, (int)(progress * 182), 5);
graphics.blitSprite(GREEN_BACK_BAR, 182, 5, 0, 0, x, y, 182, 5);
if (width > 0) {
graphics.blitSprite(GREEN_FRONT_BAR, 182, 5, 0, 0, x, y, width, 5);
}
}
@Override

View File

@ -33,12 +33,13 @@ import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.FastColor;
import net.minecraft.util.Mth;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
public class ControllerCarouselScreen extends Screen implements ScreenControllerEventListener {
public static final ResourceLocation CHECKMARK = new ResourceLocation("textures/gui/checkmark.png");
public static final ResourceLocation CHECKMARK = new ResourceLocation("icon/checkmark");
private final Screen parent;
@ -125,7 +126,7 @@ public class ControllerCarouselScreen extends Screen implements ScreenController
}
@Override
public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
public void render(@NotNull GuiGraphics graphics, int mouseX, int mouseY, float delta) {
renderDirtBackground(graphics);
int footerY = Mth.roundToward(this.height - 36 - 2, 2);
@ -148,6 +149,11 @@ public class ControllerCarouselScreen extends Screen implements ScreenController
graphics.blit(CreateWorldScreen.LIGHT_DIRT_BACKGROUND, 0, 0, 0, 0.0F, 0.0F, this.width, this.height, scale, scale);
}
@Override
public void renderBackground(GuiGraphics graphics, int i, int j, float f) {
}
public void focusOnEntry(int index) {
if (carouselAnimation != null && !carouselAnimation.isDone())
return;
@ -242,7 +248,7 @@ public class ControllerCarouselScreen extends Screen implements ScreenController
graphics.pose().translate((4 + 9 + 4 + font.width(currentlyInUseText)) * currentlyUsedPos, 0, 0);
if (currentlyUsedPos > -1) {
graphics.blit(CHECKMARK, x + 4, y + 4, 0f, 0f, 9, 8, 9, 8);
graphics.blitSprite(CHECKMARK, x + 4, y + 4, 9, 8);
graphics.drawString(font, currentlyInUseText, x + 17, y + 4, -1);
}
graphics.pose().popPose();

View File

@ -121,7 +121,7 @@ public class SubmitUnknownControllerScreen extends Screen implements DontInterup
@Override
public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
renderBackground(graphics);
renderBackground(graphics, mouseX, mouseY, delta);
super.render(graphics, mouseX, mouseY, delta);

View File

@ -5,9 +5,12 @@ import dev.isxander.controlify.api.ControlifyApi;
import dev.isxander.controlify.ingame.ControllerPlayerMovement;
import dev.isxander.controlify.ingame.DualInput;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ClientCommonPacketListenerImpl;
import net.minecraft.client.multiplayer.ClientPacketListener;
import net.minecraft.client.multiplayer.CommonListenerCookie;
import net.minecraft.client.player.KeyboardInput;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.network.Connection;
import net.minecraft.network.protocol.game.ClientboundLoginPacket;
import net.minecraft.network.protocol.game.ClientboundRespawnPacket;
import org.objectweb.asm.Opcodes;
@ -22,8 +25,10 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
* Override input handling for main player.
*/
@Mixin(ClientPacketListener.class)
public class ClientPacketListenerMixin {
@Shadow @Final private Minecraft minecraft;
public abstract class ClientPacketListenerMixin extends ClientCommonPacketListenerImpl {
protected ClientPacketListenerMixin(Minecraft client, Connection connection, CommonListenerCookie commonListenerCookie) {
super(client, connection, commonListenerCookie);
}
@Inject(method = "handleLogin", at = @At(value = "FIELD", target = "Lnet/minecraft/client/player/LocalPlayer;input:Lnet/minecraft/client/player/Input;", opcode = Opcodes.ASTORE, shift = At.Shift.AFTER))
private void overrideNewPlayerInput(ClientboundLoginPacket packet, CallbackInfo ci) {

View File

@ -4,7 +4,10 @@ import dev.isxander.controlify.Controlify;
import dev.isxander.controlify.InputMode;
import dev.isxander.controlify.gui.guide.InGameButtonGuide;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ClientCommonPacketListenerImpl;
import net.minecraft.client.multiplayer.ClientPacketListener;
import net.minecraft.client.multiplayer.CommonListenerCookie;
import net.minecraft.network.Connection;
import net.minecraft.network.protocol.game.ClientboundLoginPacket;
import net.minecraft.network.protocol.game.ClientboundRespawnPacket;
import org.objectweb.asm.Opcodes;
@ -16,8 +19,10 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(ClientPacketListener.class)
public class ClientPacketListenerMixin {
@Shadow @Final private Minecraft minecraft;
public abstract class ClientPacketListenerMixin extends ClientCommonPacketListenerImpl {
protected ClientPacketListenerMixin(Minecraft client, Connection connection, CommonListenerCookie commonListenerCookie) {
super(client, connection, commonListenerCookie);
}
@Inject(method = "handleLogin", at = @At(value = "FIELD", target = "Lnet/minecraft/client/player/LocalPlayer;input:Lnet/minecraft/client/player/Input;", opcode = Opcodes.ASTORE, shift = At.Shift.AFTER))
private void buttonGuideLogin(ClientboundLoginPacket packet, CallbackInfo ci) {

View File

@ -6,18 +6,21 @@ import dev.isxander.controlify.rumble.RumbleSource;
import dev.isxander.controlify.rumble.RumbleState;
import dev.isxander.controlify.utils.Easings;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ClientCommonPacketListenerImpl;
import net.minecraft.client.multiplayer.ClientPacketListener;
import net.minecraft.client.multiplayer.CommonListenerCookie;
import net.minecraft.network.Connection;
import net.minecraft.network.protocol.game.ClientboundExplodePacket;
import org.spongepowered.asm.mixin.Final;
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;
@Mixin(ClientPacketListener.class)
public class ClientPacketListenerMixin {
@Shadow @Final private Minecraft minecraft;
public abstract class ClientPacketListenerMixin extends ClientCommonPacketListenerImpl {
protected ClientPacketListenerMixin(Minecraft client, Connection connection, CommonListenerCookie commonListenerCookie) {
super(client, connection, commonListenerCookie);
}
@Inject(method = "handleExplosion", at = @At("RETURN"))
private void onClientExplosion(ClientboundExplodePacket packet, CallbackInfo ci) {

View File

@ -3,7 +3,10 @@ package dev.isxander.controlify.mixins.feature.rumble.useitem;
import dev.isxander.controlify.rumble.ContinuousRumbleEffect;
import dev.isxander.controlify.rumble.effects.UseItemEffectHolder;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ClientCommonPacketListenerImpl;
import net.minecraft.client.multiplayer.ClientPacketListener;
import net.minecraft.client.multiplayer.CommonListenerCookie;
import net.minecraft.network.Connection;
import net.minecraft.network.protocol.game.ClientboundRespawnPacket;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Final;
@ -14,8 +17,10 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(ClientPacketListener.class)
public class ClientPacketListenerMixin {
@Shadow @Final private Minecraft minecraft;
public abstract class ClientPacketListenerMixin extends ClientCommonPacketListenerImpl {
protected ClientPacketListenerMixin(Minecraft client, Connection connection, CommonListenerCookie commonListenerCookie) {
super(client, connection, commonListenerCookie);
}
@Inject(method = "handleRespawn", at = @At(value = "FIELD", target = "Lnet/minecraft/client/Minecraft;player:Lnet/minecraft/client/player/LocalPlayer;", opcode = Opcodes.PUTFIELD, shift = At.Shift.BEFORE))
private void clearUseItemRumble(ClientboundRespawnPacket packet, CallbackInfo ci) {