0
0
mirror of https://github.com/Wurst-Imperium/Wurst7.git synced 2024-09-20 01:12:13 +02:00

Make 22w42a mostly work

NoChatReports is still completely broken.
Also WurstClient.MC can't be static final anymore, because something is
now loading the WurstClient class extremely early, which causes that
field to be null. Can't seem to find what's doing that.
This commit is contained in:
Alexander01998 2022-10-23 18:17:23 +02:00
parent 72c573a0bd
commit f8d4edc268
20 changed files with 104 additions and 199 deletions

View File

@ -55,8 +55,8 @@ public enum WurstClient
{
INSTANCE;
public static final MinecraftClient MC = MinecraftClient.getInstance();
public static final IMinecraftClient IMC = (IMinecraftClient)MC;
public static MinecraftClient MC;
public static IMinecraftClient IMC;
public static final String VERSION = "7.29";
public static final String MC_VERSION = "22w42a";
@ -89,6 +89,8 @@ public enum WurstClient
{
System.out.println("Starting Wurst Client...");
MC = MinecraftClient.getInstance();
IMC = (IMinecraftClient)MC;
wurstFolder = createWurstFolder();
String trackingID = "UA-52838431-5";

View File

@ -19,12 +19,8 @@ import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.network.PlayerListEntry;
import net.minecraft.client.util.DefaultSkinHelper;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.network.packet.s2c.play.PlayerListS2CPacket;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.minecraft.util.Uuids;
import net.minecraft.world.GameMode;
import net.wurstclient.WurstClient;
public final class AltRenderer
{
@ -38,13 +34,11 @@ public final class AltRenderer
if(loadedSkins.get(name) == null)
{
UUID uuid = Uuids
.getUuidFromProfile(new GameProfile((UUID)null, name));
UUID uuid =
Uuids.getUuidFromProfile(new GameProfile((UUID)null, name));
PlayerListEntry entry = new PlayerListEntry(
new PlayerListS2CPacket.Entry(new GameProfile(uuid, name), 0,
GameMode.CREATIVE, Text.literal(name), null),
WurstClient.MC.getServicesSignatureVerifier(), false);
PlayerListEntry entry =
new PlayerListEntry(new GameProfile(uuid, name));
loadedSkins.put(name, entry.getSkinTexture());
}
@ -95,8 +89,7 @@ public final class AltRenderer
bindSkinTexture(name);
boolean slim = DefaultSkinHelper
.getModel(Uuids.getOfflinePlayerUuid(name))
.equals("slim");
.getModel(Uuids.getOfflinePlayerUuid(name)).equals("slim");
GL11.glEnable(GL11.GL_BLEND);
RenderSystem.setShaderColor(1, 1, 1, 1);
@ -227,8 +220,7 @@ public final class AltRenderer
bindSkinTexture(name);
boolean slim = DefaultSkinHelper
.getModel(Uuids.getOfflinePlayerUuid(name))
.equals("slim");
.getModel(Uuids.getOfflinePlayerUuid(name)).equals("slim");
GL11.glEnable(GL11.GL_BLEND);
RenderSystem.setShaderColor(1, 1, 1, 1);

View File

@ -112,6 +112,6 @@ public final class AnnoyCmd extends Command implements ChatInputListener
if(rcMode.isChecked() && repeated.startsWith("."))
WURST.getCmdProcessor().process(repeated.substring(1));
else
MC.player.sendChatMessage(repeated, null);
MC.getNetworkHandler().method_45729(repeated);
}
}

View File

@ -49,6 +49,6 @@ public final class GmCmd extends Command
}
String message = "gamemode " + args2;
MC.player.sendCommand(message);
MC.getNetworkHandler().method_45730(message);
}
}

View File

@ -23,7 +23,7 @@ public final class LeaveCmd extends Command
{
if(args.length == 1 && args[0].equalsIgnoreCase("taco"))
for(int i = 0; i < 128; i++)
MC.player.sendChatMessage("Taco!", null);
MC.getNetworkHandler().method_45729("Taco!");
else if(args.length != 0)
throw new CmdSyntaxError();

View File

@ -30,8 +30,8 @@ public final class SayCmd extends Command
String message = String.join(" ", args);
if(message.startsWith("/"))
MC.player.sendCommand(message.substring(1));
MC.getNetworkHandler().method_45730(message.substring(1));
else
MC.player.sendChatMessage(message, null);
MC.getNetworkHandler().method_45729(message);
}
}

View File

@ -87,7 +87,7 @@ public final class AutoLeaveHack extends Hack implements UpdateListener
break;
case CHARS:
MC.player.sendChatMessage("\u00a7", null);
MC.getNetworkHandler().method_45729("\u00a7");
break;
case TELEPORT:

View File

@ -172,7 +172,8 @@ public final class ForceOpHack extends Hack implements ChatInputListener
return;
}
MC.player.sendCommand("login " + MC.getSession().getUsername());
MC.getNetworkHandler()
.method_45730("login " + MC.getSession().getUsername());
lastPW = 0;
sendIndexToDialog();
@ -202,7 +203,8 @@ public final class ForceOpHack extends Hack implements ChatInputListener
while(!sent)
try
{
MC.player.sendCommand("login " + passwords[i]);
MC.getNetworkHandler()
.method_45730("login " + passwords[i]);
sent = true;
}catch(Exception e)

View File

@ -16,7 +16,7 @@ import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen;
import net.minecraft.client.gui.screen.ingame.HandledScreen;
import net.minecraft.client.gui.widget.TextFieldWidget;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemGroups;
import net.wurstclient.Category;
import net.wurstclient.SearchTags;
import net.wurstclient.clickgui.screens.ClickGuiScreen;
@ -118,7 +118,7 @@ public final class InvWalkHack extends Hack implements UpdateListener
return false;
CreativeInventoryScreen crInvScreen = (CreativeInventoryScreen)screen;
return crInvScreen.getSelectedTab() == ItemGroup.SEARCH.getIndex();
return crInvScreen.getSelectedTab() == ItemGroups.SEARCH.getIndex();
}
private boolean hasTextBox(Screen screen)

View File

@ -92,7 +92,7 @@ public final class MassTpaHack extends Hack
return;
}
MC.player.sendCommand("tpa " + players.get(index));
MC.getNetworkHandler().method_45730("tpa " + players.get(index));
index++;
timer = 20;
}

View File

@ -15,19 +15,19 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.ingame.SignEditScreen;
import net.minecraft.client.gui.screen.ingame.AbstractSignEditScreen;
import net.minecraft.text.Text;
import net.wurstclient.WurstClient;
import net.wurstclient.hacks.AutoSignHack;
@Mixin(SignEditScreen.class)
public abstract class SignEditScreenMixin extends Screen
@Mixin(AbstractSignEditScreen.class)
public abstract class AbstractSignEditScreenMixin extends Screen
{
@Shadow
@Final
private String[] text;
private SignEditScreenMixin(WurstClient wurst, Text text_1)
private AbstractSignEditScreenMixin(WurstClient wurst, Text text_1)
{
super(text_1);
}

View File

@ -17,9 +17,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.TextFieldWidget;
import net.minecraft.client.network.ChatPreviewer;
import net.minecraft.text.Text;
import net.minecraft.util.Util;
import net.wurstclient.WurstClient;
import net.wurstclient.event.EventManager;
import net.wurstclient.events.ChatOutputListener.ChatOutputEvent;
@ -30,9 +28,6 @@ public class ChatScreenMixin extends Screen
@Shadow
protected TextFieldWidget chatField;
@Shadow
private ChatPreviewer chatPreviewer;
private ChatScreenMixin(WurstClient wurst, Text text)
{
super(text);
@ -46,37 +41,12 @@ public class ChatScreenMixin extends Screen
}
@Inject(at = @At("HEAD"),
method = "updatePreviewer(Ljava/lang/String;)V",
cancellable = true)
private void onUpdatePreviewer(String chatText, CallbackInfo ci)
{
if(!shouldPreviewChat())
return;
String normalized = normalize(chatText);
if(normalized.startsWith(".say "))
{
// send preview, but only for the part after ".say "
chatPreviewer.tryRequest(normalized.substring(5));
ci.cancel();
}else if(normalized.startsWith("."))
{
// disable & delete preview
chatPreviewer.disablePreview();
ci.cancel();
}
}
@Inject(at = @At(value = "INVOKE",
target = "Lnet/minecraft/client/network/ClientPlayerEntity;sendChatMessage(Ljava/lang/String;Lnet/minecraft/text/Text;)V"),
method = "sendMessage(Ljava/lang/String;Z)Z",
cancellable = true)
public void onSendMessage(String message, boolean addToHistory,
CallbackInfoReturnable<Boolean> cir)
{
if(!addToHistory || (message = normalize(message)).isEmpty())
if((message = normalize(message)).isEmpty())
return;
ChatOutputEvent event = new ChatOutputEvent(message);
@ -92,14 +62,13 @@ public class ChatScreenMixin extends Screen
return;
String newMessage = event.getMessage();
client.inGameHud.getChatHud().addToMessageHistory(newMessage);
Text preview = Util.map(chatPreviewer.tryConsumeResponse(newMessage),
ChatPreviewer.Response::previewText);
if(addToHistory)
client.inGameHud.getChatHud().addToMessageHistory(newMessage);
if(newMessage.startsWith("/"))
client.player.sendCommand(newMessage.substring(1), preview);
client.player.networkHandler.method_45730(newMessage.substring(1));
else
client.player.sendChatMessage(newMessage, preview);
client.player.networkHandler.method_45729(newMessage);
cir.setReturnValue(true);
}
@ -109,10 +78,4 @@ public class ChatScreenMixin extends Screen
{
return null;
}
@Shadow
private boolean shouldPreviewChat()
{
return false;
}
}

View File

@ -7,7 +7,6 @@
*/
package net.wurstclient.mixin;
import org.jetbrains.annotations.Nullable;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
@ -19,7 +18,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import com.mojang.authlib.GameProfile;
import com.mojang.brigadier.ParseResults;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
@ -27,17 +25,9 @@ import net.minecraft.client.network.AbstractClientPlayerEntity;
import net.minecraft.client.network.ClientPlayNetworkHandler;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.command.CommandSource;
import net.minecraft.entity.MovementType;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.network.encryption.PlayerPublicKey;
import net.minecraft.network.message.ArgumentSignatureDataMap;
import net.minecraft.network.message.DecoratedContents;
import net.minecraft.network.message.LastSeenMessageList;
import net.minecraft.network.message.MessageMetadata;
import net.minecraft.network.message.MessageSignatureData;
import net.minecraft.text.Text;
import net.minecraft.util.math.Vec3d;
import net.wurstclient.WurstClient;
import net.wurstclient.event.EventManager;
@ -67,9 +57,9 @@ public class ClientPlayerEntityMixin extends AbstractClientPlayerEntity
private Screen tempCurrentScreen;
public ClientPlayerEntityMixin(WurstClient wurst, ClientWorld world,
GameProfile profile, PlayerPublicKey playerPublicKey)
GameProfile profile)
{
super(world, profile, playerPublicKey);
super(world, profile);
}
@Inject(at = @At(value = "INVOKE",
@ -147,28 +137,31 @@ public class ClientPlayerEntityMixin extends AbstractClientPlayerEntity
tempCurrentScreen = null;
}
@Inject(at = @At("HEAD"),
method = "signChatMessage(Lnet/minecraft/network/message/MessageMetadata;Lnet/minecraft/network/message/DecoratedContents;Lnet/minecraft/network/message/LastSeenMessageList;)Lnet/minecraft/network/message/MessageSignatureData;",
cancellable = true)
private void onSignChatMessage(MessageMetadata metadata,
DecoratedContents content, LastSeenMessageList lastSeenMessages,
CallbackInfoReturnable<MessageSignatureData> cir)
{
if(WurstClient.INSTANCE.getOtfs().noChatReportsOtf.isActive())
cir.setReturnValue(MessageSignatureData.EMPTY);
}
@Inject(at = @At("HEAD"),
method = "signArguments(Lnet/minecraft/network/message/MessageMetadata;Lcom/mojang/brigadier/ParseResults;Lnet/minecraft/text/Text;Lnet/minecraft/network/message/LastSeenMessageList;)Lnet/minecraft/network/message/ArgumentSignatureDataMap;",
cancellable = true)
private void onSignArguments(MessageMetadata metadata,
ParseResults<CommandSource> parseResults, @Nullable Text preview,
LastSeenMessageList lastSeenMessages,
CallbackInfoReturnable<ArgumentSignatureDataMap> cir)
{
if(WurstClient.INSTANCE.getOtfs().noChatReportsOtf.isActive())
cir.setReturnValue(ArgumentSignatureDataMap.EMPTY);
}
// FIXME
// @Inject(at = @At("HEAD"),
// method =
// "signChatMessage(Lnet/minecraft/network/message/MessageMetadata;Lnet/minecraft/network/message/DecoratedContents;Lnet/minecraft/network/message/LastSeenMessageList;)Lnet/minecraft/network/message/MessageSignatureData;",
// cancellable = true)
// private void onSignChatMessage(MessageMetadata metadata,
// DecoratedContents content, LastSeenMessageList lastSeenMessages,
// CallbackInfoReturnable<MessageSignatureData> cir)
// {
// if(WurstClient.INSTANCE.getOtfs().noChatReportsOtf.isActive())
// cir.setReturnValue(MessageSignatureData.EMPTY);
// }
//
// @Inject(at = @At("HEAD"),
// method =
// "signArguments(Lnet/minecraft/network/message/MessageMetadata;Lcom/mojang/brigadier/ParseResults;Lnet/minecraft/text/Text;Lnet/minecraft/network/message/LastSeenMessageList;)Lnet/minecraft/network/message/ArgumentSignatureDataMap;",
// cancellable = true)
// private void onSignArguments(MessageMetadata metadata,
// ParseResults<CommandSource> parseResults, @Nullable Text preview,
// LastSeenMessageList lastSeenMessages,
// CallbackInfoReturnable<ArgumentSignatureDataMap> cir)
// {
// if(WurstClient.INSTANCE.getOtfs().noChatReportsOtf.isActive())
// cir.setReturnValue(ArgumentSignatureDataMap.EMPTY);
// }
@Override
public void setVelocityClient(double x, double y, double z)

View File

@ -1,44 +0,0 @@
/*
* Copyright (c) 2014-2022 Wurst-Imperium and contributors.
*
* This source code is subject to the terms of the GNU General Public
* License, version 3. If a copy of the GPL was not distributed with this
* file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt
*/
package net.wurstclient.mixin;
import java.time.Instant;
import org.jetbrains.annotations.Nullable;
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.callback.CallbackInfoReturnable;
import net.minecraft.client.network.PlayerListEntry;
import net.minecraft.client.network.message.MessageHandler;
import net.minecraft.client.network.message.MessageTrustStatus;
import net.minecraft.network.message.SignedMessage;
import net.minecraft.text.Text;
import net.wurstclient.WurstClient;
@Mixin(MessageHandler.class)
public class MessageHandlerMixin
{
/**
* Stops unreportable chat messages from being labeled as "not secure".
*/
@Inject(at = @At("RETURN"),
method = "getStatus(Lnet/minecraft/network/message/SignedMessage;Lnet/minecraft/text/Text;Lnet/minecraft/client/network/PlayerListEntry;Ljava/time/Instant;)Lnet/minecraft/client/network/message/MessageTrustStatus;",
cancellable = true)
private void onGetStatus(SignedMessage message, Text decorated,
@Nullable PlayerListEntry senderEntry, Instant receptionTimestamp,
CallbackInfoReturnable<MessageTrustStatus> cir)
{
if(!WurstClient.INSTANCE.isEnabled())
return;
if(cir.getReturnValue() != MessageTrustStatus.MODIFIED)
cir.setReturnValue(MessageTrustStatus.SECURE);
}
}

View File

@ -7,48 +7,41 @@
*/
package net.wurstclient.mixin;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
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.callback.CallbackInfoReturnable;
import net.minecraft.client.util.ProfileKeys;
import net.minecraft.network.encryption.PlayerPublicKey;
import net.minecraft.network.encryption.Signer;
import net.wurstclient.WurstClient;
@Mixin(ProfileKeys.class)
public class ProfileKeysMixin
{
@Inject(at = @At("HEAD"),
method = "getSigner()Lnet/minecraft/network/encryption/Signer;",
cancellable = true)
private void onGetSigner(CallbackInfoReturnable<Signer> cir)
{
if(WurstClient.INSTANCE.getOtfs().noChatReportsOtf.isActive())
cir.setReturnValue(null);
}
@Inject(at = @At("HEAD"),
method = "getPublicKey()Ljava/util/Optional;",
cancellable = true)
private void onGetPublicKey(
CallbackInfoReturnable<Optional<PlayerPublicKey>> cir)
{
if(WurstClient.INSTANCE.getOtfs().noChatReportsOtf.isActive())
cir.setReturnValue(Optional.empty());
}
@Inject(at = @At("HEAD"),
method = "refresh()Ljava/util/concurrent/CompletableFuture;",
cancellable = true)
private void onGetPublicKeyData(
CallbackInfoReturnable<CompletableFuture<Optional<PlayerPublicKey.PublicKeyData>>> cir)
{
if(WurstClient.INSTANCE.getOtfs().noChatReportsOtf.isActive())
cir.setReturnValue(CompletableFuture.supplyAsync(Optional::empty));
}
// FIXME
// @Inject(at = @At("HEAD"),
// method = "getSigner()Lnet/minecraft/network/encryption/Signer;",
// cancellable = true)
// private void onGetSigner(CallbackInfoReturnable<Signer> cir)
// {
// if(WurstClient.INSTANCE.getOtfs().noChatReportsOtf.isActive())
// cir.setReturnValue(null);
// }
//
// @Inject(at = @At("HEAD"),
// method = "getPublicKey()Ljava/util/Optional;",
// cancellable = true)
// private void onGetPublicKey(
// CallbackInfoReturnable<Optional<PlayerPublicKey>> cir)
// {
// if(WurstClient.INSTANCE.getOtfs().noChatReportsOtf.isActive())
// cir.setReturnValue(Optional.empty());
// }
//
// @Inject(at = @At("HEAD"),
// method = "refresh()Ljava/util/concurrent/CompletableFuture;",
// cancellable = true)
// private void onGetPublicKeyData(
// CallbackInfoReturnable<CompletableFuture<Optional<PlayerPublicKey.PublicKeyData>>>
// cir)
// {
// if(WurstClient.INSTANCE.getOtfs().noChatReportsOtf.isActive())
// cir.setReturnValue(CompletableFuture.supplyAsync(Optional::empty));
// }
}

View File

@ -67,10 +67,10 @@ public final class NoChatReportsOtf extends OtherFeature
if(!WurstClient.INSTANCE.isEnabled())
return indicator;
if(indicator != null || signature == null || signature.isEmpty())
if(indicator != null || signature == null)
return indicator;
return new MessageIndicator(0xE84F58, Icon.CHAT_NOT_SECURE,
return new MessageIndicator(0xE84F58, Icon.CHAT_MODIFIED,
Text.literal(ChatUtils.WURST_PREFIX + "\u00a7cReportable\u00a7r - ")
.append(Text.translatable(
"description.wurst.nochatreports.message_is_reportable")),

View File

@ -8,9 +8,11 @@
package net.wurstclient.update;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
import net.minecraft.resource.InputSupplier;
import net.minecraft.resource.ResourcePack;
import net.minecraft.resource.ResourcePackProfile;
import net.wurstclient.WurstClient;
@ -74,8 +76,12 @@ public final class ProblematicResourcePackDetector implements UpdateListener
{
try
{
ArrayList<String> lines =
StreamUtils.readAllLines(pack.openRoot("Selected Packs.txt"));
InputSupplier<InputStream> supplier =
pack.openRoot("Selected Packs.txt");
if(supplier == null)
return false;
ArrayList<String> lines = StreamUtils.readAllLines(supplier.get());
return lines.stream()
.anyMatch(line -> line.contains("TwinklingStars"));

View File

@ -22,8 +22,7 @@ public class FakePlayerEntity extends OtherClientPlayerEntity
public FakePlayerEntity()
{
super(WurstClient.MC.world, WurstClient.MC.player.getGameProfile(),
WurstClient.MC.player.getPublicKey());
super(WurstClient.MC.world, WurstClient.MC.player.getGameProfile());
copyPositionAndRotation(player);
copyInventory();

View File

@ -28,9 +28,9 @@
"accessWidener" : "wurst.accesswidener",
"depends": {
"fabricloader": ">=0.14.9",
"fabric-api": ">=0.59.0",
"minecraft": "~1.19.2",
"fabricloader": ">=0.14.10",
"fabric-api": ">=0.65.0",
"minecraft": "~1.19.3-alpha.22.42.a",
"java": ">=17"
},
"suggests": {

View File

@ -7,6 +7,7 @@
],
"client": [
"AbstractBlockStateMixin",
"AbstractSignEditScreenMixin",
"ArmorItemMixin",
"BackgroundRendererMixin",
"BlockEntityRenderDispatcherMixin",
@ -41,7 +42,6 @@
"LanguageManagerMixin",
"LightTextureManagerMixin",
"LivingEntityRendererMixin",
"MessageHandlerMixin",
"MinecraftClientMixin",
"MiningToolItemMixin",
"MouseMixin",
@ -55,7 +55,6 @@
"ScreenMixin",
"ServerListMixin",
"ShulkerBoxScreenMixin",
"SignEditScreenMixin",
"SimpleOptionMixin",
"SodiumBlockOcclusionCacheMixin",
"StatsScreenMixin",