forked from Clones/Controlify
🐘 Update to 1.20.2
This commit is contained in:
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
Reference in New Issue
Block a user