Skip to content

Commit

Permalink
Partial revert "1.20.2 update (MeteorDevelopment#4119)"
Browse files Browse the repository at this point in the history
This partially reverts commit 1ceea3e.
  • Loading branch information
Moondarker committed Feb 28, 2024
1 parent dabcdff commit dbc4403
Show file tree
Hide file tree
Showing 46 changed files with 209 additions and 253 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ private void basicInfo() {

info("Port: %d", ServerAddress.parse(server.address).getPort());

info("Type: %s", mc.player.getServer().getSaveProperties().getServerBrands() != null ? mc.player.getServer().getSaveProperties().getServerBrands() : "unknown");
info("Type: %s", mc.player.getServerBrand() != null ? mc.player.getServerBrand() : "unknown");

info("Motd: %s", server.label != null ? server.label.getString() : "unknown");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,12 @@ public void mouseMoved(double mouseX, double mouseY) {
}

@Override
public boolean mouseScrolled(double mouseX, double mouseY, double horizontalAmount, double verticalAmount) {
public boolean mouseScrolled(double mouseX, double mouseY, double amount) {
if (locked) return false;

root.mouseScrolled(verticalAmount);
root.mouseScrolled(amount);

return super.mouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount);
return super.mouseScrolled(mouseX, mouseY, amount);
}

@Override
Expand Down Expand Up @@ -196,7 +196,8 @@ public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
textBox.setCursorMax();

done.set(true);
} else {
}
else {
if (textBox.isFocused()) {
textBox.setFocused(false);
foundFocused.set(true);
Expand All @@ -218,7 +219,8 @@ public boolean keyPressed(int keyCode, int scanCode, int modifiers) {

if (control && keyCode == GLFW_KEY_C && toClipboard()) {
return true;
} else if (control && keyCode == GLFW_KEY_V && fromClipboard()) {
}
else if (control && keyCode == GLFW_KEY_V && fromClipboard()) {
reload();
if (parent instanceof WidgetScreen wScreen) {
wScreen.reload();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
package meteordevelopment.meteorclient.mixin;

import meteordevelopment.meteorclient.utils.misc.FakeClientPlayer;
import meteordevelopment.meteorclient.utils.network.Capes;
import net.minecraft.client.network.AbstractClientPlayerEntity;
import net.minecraft.client.network.PlayerListEntry;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.Identifier;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand All @@ -17,6 +20,12 @@

@Mixin(AbstractClientPlayerEntity.class)
public class AbstractClientPlayerEntityMixin {
@Inject(method = "getCapeTexture", at = @At("HEAD"), cancellable = true)
private void onGetCapeTexture(CallbackInfoReturnable<Identifier> info) {
Identifier id = Capes.get((PlayerEntity) (Object) this);
if (id != null) info.setReturnValue(id);
}

// Player model rendering in main menu

@Inject(method = "getPlayerListEntry", at = @At("HEAD"), cancellable = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private void onInit(CallbackInfo info) {
DataInputStream in = new DataInputStream(new ByteArrayInputStream(bytes));

try {
NbtCompound tag = NbtIo.readCompressed(in);
NbtCompound tag = NbtIo.read(in);

NbtList listTag = tag.getList("pages", 8).copy();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ private void onAddMessage(Text message, @Nullable MessageSignatureData signature

@ModifyExpressionValue(method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignatureData;ILnet/minecraft/client/gui/hud/MessageIndicator;Z)V", slice = @Slice(from = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/hud/ChatHud;visibleMessages:Ljava/util/List;")), at = @At(value = "INVOKE", target = "Ljava/util/List;size()I"))
private int addMessageListSizeProxy(int size) {
BetterChat betterChat = Modules.get().get(BetterChat.class);
BetterChat betterChat = getBetterChat();
if (betterChat.isLongerChat() && betterChat.getChatLength() >= 100) return size - betterChat.getChatLength();
return size;
}
Expand Down Expand Up @@ -244,8 +244,6 @@ private MessageIndicator onMessageIndicator(ChatHudLine.Visible message) {
@Inject(method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignatureData;ILnet/minecraft/client/gui/hud/MessageIndicator;Z)V",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/ChatHud;isChatFocused()Z"), locals = LocalCapture.CAPTURE_FAILSOFT)
private void onBreakChatMessageLines(Text message, MessageSignatureData signature, int ticks, MessageIndicator indicator, boolean refresh, CallbackInfo ci, int i, List<OrderedText> list) {
if (Modules.get() == null) return; // baritone calls addMessage before we initialise

getBetterChat().lines.add(0, list.size());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package meteordevelopment.meteorclient.mixin;

import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelPipeline;
import io.netty.handler.proxy.Socks4ProxyHandler;
Expand All @@ -20,8 +21,7 @@
import meteordevelopment.meteorclient.systems.proxies.Proxy;
import net.minecraft.network.ClientConnection;
import net.minecraft.network.NetworkSide;
import net.minecraft.network.handler.PacketEncoderException;
import net.minecraft.network.handler.PacketSizeLogger;
import net.minecraft.network.PacketEncoderException;
import net.minecraft.network.listener.ClientPlayPacketListener;
import net.minecraft.network.listener.PacketListener;
import net.minecraft.network.packet.Packet;
Expand Down Expand Up @@ -59,8 +59,8 @@ private void disconnect(Text disconnectReason, CallbackInfo ci) {
}
}

@Inject(method = "connect(Ljava/net/InetSocketAddress;ZLnet/minecraft/network/ClientConnection;)Lio/netty/channel/ChannelFuture;", at = @At("HEAD"))
private static void onConnect(InetSocketAddress address, boolean useEpoll, ClientConnection connection, CallbackInfoReturnable<?> cir) {
@Inject(method = "connect", at = @At("HEAD"))
private static void onConnect(InetSocketAddress address, boolean useEpoll, CallbackInfoReturnable<?> cir) {
MeteorClient.EVENT_BUS.post(ServerConnectEndEvent.get(address));
}

Expand All @@ -84,7 +84,7 @@ private void exceptionCaught(ChannelHandlerContext context, Throwable throwable,
}

@Inject(method = "addHandlers", at = @At("RETURN"))
private static void onAddHandlers(ChannelPipeline pipeline, NetworkSide side, PacketSizeLogger packetSizeLogger, CallbackInfo ci) {
private static void onAddHandlers(ChannelPipeline pipeline, NetworkSide side, CallbackInfo ci) {
if (side != NetworkSide.CLIENTBOUND) return;

Proxy proxy = Proxies.get().getEnabled();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,13 @@
import meteordevelopment.meteorclient.systems.modules.render.NoRender;
import meteordevelopment.meteorclient.utils.player.ChatUtils;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientCommonNetworkHandler;
import net.minecraft.client.network.ClientConnectionState;
import net.minecraft.client.network.ClientPlayNetworkHandler;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.Entity;
import net.minecraft.entity.ItemEntity;
import net.minecraft.network.ClientConnection;
import net.minecraft.network.packet.s2c.play.*;
import net.minecraft.world.chunk.WorldChunk;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
Expand All @@ -43,7 +41,10 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(ClientPlayNetworkHandler.class)
public abstract class ClientPlayNetworkHandlerMixin extends ClientCommonNetworkHandler {
public abstract class ClientPlayNetworkHandlerMixin {
@Shadow
@Final
private MinecraftClient client;
@Shadow
private ClientWorld world;

Expand All @@ -56,10 +57,6 @@ public abstract class ClientPlayNetworkHandlerMixin extends ClientCommonNetworkH
@Unique
private boolean worldNotNull;

protected ClientPlayNetworkHandlerMixin(MinecraftClient client, ClientConnection connection, ClientConnectionState connectionState) {
super(client, connection, connectionState);
}

@Inject(method = "onEntitySpawn", at = @At("HEAD"), cancellable = true)
private void onEntitySpawn(EntitySpawnS2CPacket packet, CallbackInfo info) {
if (packet != null && packet.getEntityType() != null) {
Expand Down Expand Up @@ -96,7 +93,7 @@ private void onPlaySound(PlaySoundS2CPacket packet, CallbackInfo info) {

@Inject(method = "onChunkData", at = @At("TAIL"))
private void onChunkData(ChunkDataS2CPacket packet, CallbackInfo info) {
WorldChunk chunk = client.world.getChunk(packet.getChunkX(), packet.getChunkZ());
WorldChunk chunk = client.world.getChunk(packet.getX(), packet.getZ());
MeteorClient.EVENT_BUS.post(ChunkDataEvent.get(chunk));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public abstract class ClientWorldMixin {

@Shadow @Nullable public abstract Entity getEntityById(int id);

@Inject(method = "addEntity", at = @At("TAIL"))
private void onAddEntity(Entity entity, CallbackInfo info) {
@Inject(method = "addEntityPrivate", at = @At("TAIL"))
private void onAddEntityPrivate(int id, Entity entity, CallbackInfo info) {
if (entity != null) MeteorClient.EVENT_BUS.post(EntityAddedEvent.get(entity));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client).
* Copyright (c) Meteor Development.
*/

package meteordevelopment.meteorclient.mixin;

import net.minecraft.network.PacketByteBuf;
import net.minecraft.network.packet.c2s.play.CustomPayloadC2SPacket;
import net.minecraft.util.Identifier;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.gen.Accessor;

@Mixin(CustomPayloadC2SPacket.class)
public interface CustomPayloadC2SPacketAccessor {
@Accessor("channel")
Identifier getChannel();

@Accessor("data")
PacketByteBuf getData();

@Mutable
@Accessor("data")
void setData(PacketByteBuf data);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

import meteordevelopment.meteorclient.systems.modules.Modules;
import meteordevelopment.meteorclient.systems.modules.misc.AntiPacketKick;
import net.minecraft.network.packet.s2c.common.CustomPayloadS2CPacket;
import net.minecraft.network.packet.s2c.play.CustomPayloadS2CPacket;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;

@Mixin(CustomPayloadS2CPacket.class)
public class CustomPayloadS2CPacketMixin {
@ModifyConstant(method = "readUnknownPayload", constant = @Constant(intValue = 1048576))
private static int maxValue(int value) {
@ModifyConstant(method = "<init>", constant = @Constant(intValue = 1048576))
private int maxValue(int value) {
return Modules.get().isActive(AntiPacketKick.class) ? Integer.MAX_VALUE : value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
@Mixin(DefaultSkinHelper.class)
public class DefaultSkinHelperMixin {
// Player model rendering in main menu
@Inject(method = "getSkinTextures(Ljava/util/UUID;)Lnet/minecraft/client/util/SkinTextures;", at = @At("HEAD"), cancellable = true)
@Inject(method = "getSkin", at = @At("HEAD"), cancellable = true)
private static void onShouldUseSlimModel(UUID uuid, CallbackInfoReturnable<Boolean> info) {
if (uuid == null) info.setReturnValue(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
import net.minecraft.client.network.ServerInfo;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.text.Text;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand Down Expand Up @@ -77,14 +75,12 @@ public void tick() {
}
}

@Unique
private String getText() {
String reconnectText = "Reconnect";
if (Modules.get().isActive(AutoReconnect.class)) reconnectText += " " + String.format("(%.1f)", time / 20);
return reconnectText;
}

@Unique
private void tryConnecting() {
var lastServer = Modules.get().get(AutoReconnect.class).lastServerConnection;
ConnectScreen.connect(new TitleScreen(), mc, lastServer.left(), lastServer.right(), false);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,11 @@

import com.mojang.authlib.minecraft.MinecraftSessionService;
import com.mojang.authlib.minecraft.UserApiService;
import com.mojang.authlib.yggdrasil.ProfileResult;
import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.SocialInteractionsManager;
import net.minecraft.client.report.AbuseReportContext;
import net.minecraft.client.resource.ResourceReloadLogger;
import net.minecraft.client.session.ProfileKeys;
import net.minecraft.client.session.Session;
import net.minecraft.client.session.report.AbuseReportContext;
import net.minecraft.client.texture.PlayerSkinProvider;
import net.minecraft.client.util.ProfileKeys;
import net.minecraft.client.util.Session;
Expand All @@ -25,7 +22,6 @@
import org.spongepowered.asm.mixin.gen.Invoker;

import java.net.Proxy;
import java.util.concurrent.CompletableFuture;

@Mixin(MinecraftClient.class)
public interface MinecraftClientAccessor {
Expand Down Expand Up @@ -81,8 +77,4 @@ static int getFps() {
@Mutable
@Accessor("abuseReportContext")
void setAbuseReportContext(AbuseReportContext abuseReportContext);

@Mutable
@Accessor("gameProfileFuture")
void setGameProfileFuture(CompletableFuture<ProfileResult> future);
}
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ private HitResult doItemUseMinecraftClientCrosshairTargetProxy(HitResult origina
return MeteorClient.EVENT_BUS.post(ItemUseCrosshairTargetEvent.get(original)).target;
}

@ModifyReturnValue(method = "reloadResources(ZLnet/minecraft/client/MinecraftClient$LoadingContext;)Ljava/util/concurrent/CompletableFuture;", at = @At("RETURN"))
@ModifyReturnValue(method = "reloadResources(Z)Ljava/util/concurrent/CompletableFuture;", at = @At("RETURN"))
private CompletableFuture<Void> onReloadResourcesNewCompletableFuture(CompletableFuture<Void> original) {
return original.thenRun(() -> MeteorClient.EVENT_BUS.post(ResourcePacksReloadedEvent.get()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@

@Mixin(PacketByteBuf.class)
public class PacketByteBufMixin {

@ModifyArg(method = "readNbt()Lnet/minecraft/nbt/NbtCompound;", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/PacketByteBuf;readNbt(Lnet/minecraft/nbt/NbtTagSizeTracker;)Lnet/minecraft/nbt/NbtElement;"))
@ModifyArg(method = "readNbt()Lnet/minecraft/nbt/NbtCompound;", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/PacketByteBuf;readNbt(Lnet/minecraft/nbt/NbtTagSizeTracker;)Lnet/minecraft/nbt/NbtCompound;"))
private NbtTagSizeTracker xlPackets(NbtTagSizeTracker sizeTracker) {
return Modules.get().isActive(AntiPacketKick.class) ? NbtTagSizeTracker.ofUnlimitedBytes() : sizeTracker;
return Modules.get().isActive(AntiPacketKick.class) ? NbtTagSizeTracker.EMPTY : sizeTracker;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ private void modifyRenderLayer(Args args, MatrixStack matrices, VertexConsumerPr
Chams chams = Modules.get().get(Chams.class);

if (chams.isActive() && chams.hand.get()) {
Identifier texture = chams.handTexture.get() ? player.playerListEntry.getSkinTextures().texture() : Chams.BLANK;
Identifier texture = chams.handTexture.get() ? player.getSkinTexture() : Chams.BLANK;
args.set(1, vertexConsumers.getBuffer(RenderLayer.getEntityTranslucent(texture)));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.PlayerListEntry;
import net.minecraft.client.util.DefaultSkinHelper;
import net.minecraft.client.util.SkinTextures;
import net.minecraft.util.Identifier;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -23,11 +23,11 @@ public abstract class PlayerListEntryMixin {
@Shadow
public abstract GameProfile getProfile();

@Inject(method = "getSkinTextures", at = @At("HEAD"), cancellable = true)
private void onGetTexture(CallbackInfoReturnable<SkinTextures> info) {
@Inject(method = "getSkinTexture", at = @At("HEAD"), cancellable = true)
private void onGetTexture(CallbackInfoReturnable<Identifier> info) {
if (getProfile().getName().equals(MinecraftClient.getInstance().getSession().getUsername())) {
if (Modules.get().get(NameProtect.class).skinProtect()) {
info.setReturnValue(DefaultSkinHelper.getSkinTextures(getProfile()));
info.setReturnValue(DefaultSkinHelper.getTexture());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;

import java.io.File;

@Mixin(PlayerSkinProvider.class)
public interface PlayerSkinProviderAccessor {
@Accessor("skinCache")
PlayerSkinProvider.FileCache getSkinCache();
@Accessor("skinCacheDir")
File getSkinCacheDir();
}
Loading

0 comments on commit dbc4403

Please sign in to comment.