mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2025-02-17 01:52:28 +01:00
manually updated code
This commit is contained in:
parent
dac8f0deef
commit
9e035ca97a
@ -19,10 +19,8 @@ package de.florianmichael.viafabricplus.injection.mixin.base;
|
||||
|
||||
import de.florianmichael.viafabricplus.definition.c0_30.ClassicProgressRenderer;
|
||||
import de.florianmichael.viafabricplus.base.settings.groups.GeneralSettings;
|
||||
import de.florianmichael.viafabricplus.settings.groups.GeneralSettings;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.ConnectScreen;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
|
@ -18,8 +18,8 @@
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft;
|
||||
|
||||
import de.florianmichael.viafabricplus.base.settings.groups.VisualSettings;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.hud.InGameHud;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.JumpingMount;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
@ -40,17 +40,17 @@ public abstract class MixinInGameHud {
|
||||
// Removing newer elements
|
||||
|
||||
@Inject(method = "renderExperienceBar", at = @At("HEAD"), cancellable = true)
|
||||
public void removeExperienceBar(MatrixStack matrices, int x, CallbackInfo ci) {
|
||||
public void removeExperienceBar(DrawContext context, int x, CallbackInfo ci) {
|
||||
if (VisualSettings.INSTANCE.removeNewerHudElements.getValue()) ci.cancel();
|
||||
}
|
||||
|
||||
@Inject(method = "renderMountJumpBar", at = @At("HEAD"), cancellable = true)
|
||||
public void removeMountJumpBar(JumpingMount mount, MatrixStack matrices, int x, CallbackInfo ci) {
|
||||
public void removeMountJumpBar(JumpingMount mount, DrawContext context, int x, CallbackInfo ci) {
|
||||
if (VisualSettings.INSTANCE.removeNewerHudElements.getValue()) ci.cancel();
|
||||
}
|
||||
|
||||
@Inject(method = "renderMountHealth", at = @At("HEAD"), cancellable = true)
|
||||
public void removeMountHealth(MatrixStack matrices, CallbackInfo ci) {
|
||||
public void removeMountHealth(DrawContext context, CallbackInfo ci) {
|
||||
if (VisualSettings.INSTANCE.removeNewerHudElements.getValue()) ci.cancel();
|
||||
}
|
||||
|
||||
@ -69,15 +69,15 @@ public abstract class MixinInGameHud {
|
||||
return scaledHeight;
|
||||
}
|
||||
|
||||
@ModifyArg(method = "renderStatusBars", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;drawTexture(Lnet/minecraft/client/util/math/MatrixStack;IIIIII)V"), slice = @Slice(
|
||||
from = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;push(Ljava/lang/String;)V"),
|
||||
to = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", ordinal = 0)), index = 1)
|
||||
@ModifyArg(method = "renderStatusBars", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTexture(Lnet/minecraft/util/Identifier;IIIIII)V"), slice = @Slice(
|
||||
from = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;push(Ljava/lang/String;)V"),
|
||||
to = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", ordinal = 0)), index = 1)
|
||||
private int moveArmor(int old) {
|
||||
if (VisualSettings.INSTANCE.removeNewerHudElements.getValue()) return scaledWidth - old - 9;
|
||||
return old;
|
||||
}
|
||||
|
||||
@ModifyArg(method = "renderStatusBars", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;drawTexture(Lnet/minecraft/client/util/math/MatrixStack;IIIIII)V"), slice = @Slice(
|
||||
@ModifyArg(method = "renderStatusBars", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTexture(Lnet/minecraft/util/Identifier;IIIIII)V"), slice = @Slice(
|
||||
from = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;push(Ljava/lang/String;)V"),
|
||||
to = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", ordinal = 0)), index = 2)
|
||||
private int moveArmorDown(int old) {
|
||||
@ -85,9 +85,9 @@ public abstract class MixinInGameHud {
|
||||
return old;
|
||||
}
|
||||
|
||||
@ModifyArg(method = "renderStatusBars", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;drawTexture(Lnet/minecraft/client/util/math/MatrixStack;IIIIII)V"), slice = @Slice(
|
||||
from = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", ordinal = 2),
|
||||
to = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;pop()V")), index = 1)
|
||||
@ModifyArg(method = "renderStatusBars", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTexture(Lnet/minecraft/util/Identifier;IIIIII)V"), slice = @Slice(
|
||||
from = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", ordinal = 2),
|
||||
to = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;pop()V")), index = 1)
|
||||
private int moveAir(int old) {
|
||||
if (VisualSettings.INSTANCE.removeNewerHudElements.getValue()) return scaledWidth - old - 9;
|
||||
return old;
|
||||
|
@ -94,7 +94,7 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
|
||||
@Redirect(method = "sendMovementPackets", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/ClientPlayerEntity;lastOnGround:Z", ordinal = 0))
|
||||
public boolean sendIdlePacket(ClientPlayerEntity instance) {
|
||||
if (DebugSettings.INSTANCE.sendIdlePacket.getValue()) {
|
||||
return !onGround;
|
||||
return !isOnGround();
|
||||
}
|
||||
return lastOnGround;
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ package de.florianmichael.viafabricplus.ui.screen;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.NoticeScreen;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
@ -57,17 +58,19 @@ public class VFPScreen extends Screen {
|
||||
MinecraftClient.getInstance().setScreen(prevScreen);
|
||||
}
|
||||
|
||||
public void renderTitle(final MatrixStack matrices) {
|
||||
renderTitle(matrices, Text.of("https://github.com/FlorianMichael/ViaFabricPlus"));
|
||||
public void renderTitle(final DrawContext context) {
|
||||
renderTitle(context, Text.of("https://github.com/FlorianMichael/ViaFabricPlus"));
|
||||
}
|
||||
|
||||
public void renderTitle(final MatrixStack matrices, final Text subTitle) {
|
||||
public void renderTitle(final DrawContext context, final Text subTitle) {
|
||||
final MatrixStack matrices = context.getMatrices();
|
||||
|
||||
matrices.push();
|
||||
matrices.scale(2F, 2F, 2F);
|
||||
drawCenteredTextWithShadow(matrices, textRenderer, "ViaFabricPlus", width / 4, 3, Color.ORANGE.getRGB());
|
||||
context.drawCenteredTextWithShadow(textRenderer, "ViaFabricPlus", width / 4, 3, Color.ORANGE.getRGB());
|
||||
matrices.pop();
|
||||
|
||||
drawCenteredTextWithShadow(matrices, textRenderer, subTitle, width / 2, (textRenderer.fontHeight + 2) * 2 + 3, -1);
|
||||
context.drawCenteredTextWithShadow(textRenderer, subTitle, width / 2, (textRenderer.fontHeight + 2) * 2 + 3, -1);
|
||||
}
|
||||
|
||||
public static void playClickSound() {
|
||||
|
@ -55,9 +55,7 @@ public class ForceVersionScreen extends VFPScreen {
|
||||
this.renderBackground(context);
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
|
||||
final MatrixStack matrices = context.getMatrices();
|
||||
|
||||
this.renderTitle(matrices, Text.translatable("forceversion.viafabricplus.title"));
|
||||
this.renderTitle(context, Text.translatable("forceversion.viafabricplus.title"));
|
||||
}
|
||||
|
||||
public class SlotList extends AlwaysSelectedEntryListWidget<DummyProtocolSlot> {
|
||||
|
@ -105,9 +105,7 @@ public class ProtocolSelectionScreen extends VFPScreen {
|
||||
this.renderBackground(context);
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
|
||||
final MatrixStack matrices = context.getMatrices();
|
||||
|
||||
this.renderTitle(matrices);
|
||||
this.renderTitle(context);
|
||||
}
|
||||
|
||||
public static class SlotList extends AlwaysSelectedEntryListWidget<ProtocolSlot> {
|
||||
|
@ -48,9 +48,7 @@ public class SettingsScreen extends VFPScreen {
|
||||
this.renderBackground(context);
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
|
||||
final MatrixStack matrices = context.getMatrices();
|
||||
|
||||
this.renderTitle(matrices);
|
||||
this.renderTitle(context);
|
||||
}
|
||||
|
||||
public static class SlotList extends AlwaysSelectedEntryListWidget<MappedSlotEntry> {
|
||||
|
@ -21,7 +21,7 @@ import de.florianmichael.viafabricplus.ui.screen.MappedSlotEntry;
|
||||
import de.florianmichael.viafabricplus.base.settings.type_impl.BooleanSetting;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
|
||||
|
@ -26,6 +26,7 @@ import de.florianmichael.viafabricplus.ui.screen.VFPScreen;
|
||||
import de.florianmichael.viafabricplus.ui.screen.impl.settings.settingrenderer.meta.TitleRenderer;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.ConnectScreen;
|
||||
import net.minecraft.client.gui.widget.AlwaysSelectedEntryListWidget;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
@ -62,12 +63,10 @@ public class BetaCraftScreen extends VFPScreen {
|
||||
this.renderBackground(context);
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
|
||||
final MatrixStack matrices = context.getMatrices();
|
||||
|
||||
this.renderTitle(matrices);
|
||||
this.renderTitle(context);
|
||||
}
|
||||
|
||||
public class SlotList extends AlwaysSelectedEntryListWidget<MappedSlotEntry> {
|
||||
public static class SlotList extends AlwaysSelectedEntryListWidget<MappedSlotEntry> {
|
||||
|
||||
public SlotList(MinecraftClient minecraftClient, int width, int height, int top, int bottom, int entryHeight) {
|
||||
super(minecraftClient, width, height, top, bottom, entryHeight);
|
||||
@ -110,20 +109,20 @@ public class BetaCraftScreen extends VFPScreen {
|
||||
final ServerAddress serverAddress = LegacyServerAddress.parse(null, server.host() + ":" + server.port());
|
||||
final ServerInfo entry = new ServerInfo(server.name(), serverAddress.getAddress(), false);
|
||||
|
||||
ConnectScreen.connect(MinecraftClient.getInstance().currentScreen, MinecraftClient.getInstance(), serverAddress, entry);
|
||||
playClickSound();
|
||||
ConnectScreen.connect(MinecraftClient.getInstance().currentScreen, MinecraftClient.getInstance(), serverAddress, entry, false);
|
||||
super.mappedMouseClicked(mouseX, mouseY, button);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mappedRenderer(DrawContext context, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
public void mappedRender(DrawContext context, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
final TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
|
||||
drawCenteredTextWithShadow(matrices, textRenderer, server.name() + Formatting.DARK_GRAY + " [" + server.gameVersion() + "]", entryWidth / 2, entryHeight / 2 - textRenderer.fontHeight / 2, -1);
|
||||
context.drawCenteredTextWithShadow(textRenderer, server.name() + Formatting.DARK_GRAY + " [" + server.gameVersion() + "]", entryWidth / 2, entryHeight / 2 - textRenderer.fontHeight / 2, -1);
|
||||
|
||||
if (server.onlineMode()) {
|
||||
drawTextWithShadow(matrices, textRenderer, Text.translatable("words.viafabricplus.online").formatted(Formatting.GREEN), 1, 1, -1);
|
||||
context.drawTextWithShadow(textRenderer, Text.translatable("words.viafabricplus.online").formatted(Formatting.GREEN), 1, 1, -1);
|
||||
}
|
||||
final String playerText = server.playerCount() + "/" + server.playerLimit();
|
||||
drawTextWithShadow(matrices, textRenderer, playerText, entryWidth - textRenderer.getWidth(playerText) - 4 /* magic value from MappedSlotEntry#32 */ - 1, 1, -1);
|
||||
context.drawTextWithShadow(textRenderer, playerText, entryWidth - textRenderer.getWidth(playerText) - 4 /* magic value from line 152 */ - 1, 1, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,13 +26,10 @@ import de.florianmichael.viafabricplus.definition.c0_30.ClassiCubeAccountHandler
|
||||
import de.florianmichael.viafabricplus.integration.Classic4JImpl;
|
||||
import de.florianmichael.viafabricplus.ui.screen.VFPScreen;
|
||||
import de.florianmichael.viafabricplus.ui.screen.impl.base.ProtocolSelectionScreen;
|
||||
import de.florianmichael.viafabricplus.screen.ProtocolSelectionScreen;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.gui.widget.TextFieldWidget;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
public class ClassiCubeMFAScreen extends VFPScreen {
|
||||
|
@ -85,12 +85,10 @@ public class ClassiCubeServerListScreen extends VFPScreen {
|
||||
this.renderBackground(context);
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
|
||||
final MatrixStack matrices = context.getMatrices();
|
||||
|
||||
final CCAccount account = ClassiCubeAccountHandler.INSTANCE.getAccount();
|
||||
if (account == null) return;
|
||||
|
||||
this.renderTitle(matrices, Text.of("ClassiCube Profile: " + account.username()));
|
||||
this.renderTitle(context, Text.of("ClassiCube Profile: " + account.username()));
|
||||
}
|
||||
|
||||
public static class SlotList extends AlwaysSelectedEntryListWidget<MappedSlotEntry> {
|
||||
@ -135,7 +133,8 @@ public class ClassiCubeServerListScreen extends VFPScreen {
|
||||
((IServerInfo) entry).viafabricplus_forceVersion(ViaLoadingBase.fromProtocolVersion(LegacyProtocolVersion.c0_30cpe));
|
||||
}
|
||||
|
||||
ConnectScreen.connect(MinecraftClient.getInstance().currentScreen, MinecraftClient.getInstance(), serverAddress, entry);
|
||||
ConnectScreen.connect(MinecraftClient.getInstance().currentScreen, MinecraftClient.getInstance(), serverAddress, entry, false);
|
||||
super.mappedMouseClicked(mouseX, mouseY, button);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user