From 4a822e773c711e029e5ef3ec9a5ef186fa50376a Mon Sep 17 00:00:00 2001 From: morpheus Date: Sat, 1 Nov 2025 23:32:30 -0300 Subject: [PATCH] Update to Meteor-Rejects to 1.21.10 --- build.gradle | 124 +++++++------- gradle.properties | 8 +- gradle/wrapper/gradle-wrapper.properties | 2 +- .../anticope/rejects/MeteorRejectsAddon.java | 8 +- .../rejects/commands/GiveCommand.java | 13 +- .../rejects/commands/ReconnectCommand.java | 4 +- .../rejects/commands/SaveSkinCommand.java | 2 +- .../rejects/commands/ServerCommand.java | 31 ++-- .../rejects/gui/screens/HeadScreen.java | 4 +- ...n.java => InteractionScreen.java.disabled} | 0 .../rejects/gui/servers/CleanUpScreen.java | 2 +- .../themes/rounded/MeteorRoundedGuiTheme.java | 10 ++ .../pressable/WMeteorConfirmedButton.java | 29 ++++ .../pressable/WMeteorConfirmedMinus.java | 21 +++ .../mixin/ClientPlayerEntityAccessor.java | 13 ++ .../ClientPlayerInteractionManagerMixin.java | 2 +- .../mixin/Deadmau5FeatureRendererMixin.java | 19 --- .../Deadmau5FeatureRendererMixin.java.bak | 27 +++ .../mixin/PlayerInventoryAccessor.java | 14 ++ .../mixin/PlayerMoveC2SPacketAccessor.java | 9 +- .../mixin/TexturedRenderLayersMixin.java | 14 +- .../mixin/meteor/modules/KillAuraMixin.java | 27 +-- .../anticope/rejects/modules/AntiCrash.java | 5 +- .../anticope/rejects/modules/AntiVanish.java | 2 +- .../rejects/modules/AutoExtinguish.java | 6 +- .../anticope/rejects/modules/AutoLogin.java | 2 +- .../anticope/rejects/modules/AutoPot.java | 4 +- .../anticope/rejects/modules/AutoRename.java | 11 +- .../anticope/rejects/modules/AutoSoup.java | 6 +- .../anticope/rejects/modules/BlockIn.java | 2 +- .../anticope/rejects/modules/BoatGlitch.java | 4 +- .../rejects/modules/BungeeCordSpoof.java | 2 +- .../{ChatBot.java => ChatBot.java.disabled} | 0 .../anticope/rejects/modules/ChestAura.java | 6 +- .../rejects/modules/ChorusExploit.java | 6 +- .../anticope/rejects/modules/ColorSigns.java | 2 +- .../anticope/rejects/modules/Confuse.java | 12 +- .../anticope/rejects/modules/CoordLogger.java | 7 +- .../rejects/modules/CustomPackets.java | 10 +- .../anticope/rejects/modules/FullFlight.java | 6 +- .../rejects/modules/GamemodeNotifier.java | 2 +- ...enu.java => InteractionMenu.java.disabled} | 0 .../anticope/rejects/modules/Lavacast.java | 18 +- .../anticope/rejects/modules/LawnBot.java | 6 +- .../anticope/rejects/modules/NewChunks.java | 3 +- .../anticope/rejects/modules/NoJumpDelay.java | 3 +- .../rejects/modules/ObsidianFarm.java | 2 +- ...PacketFly.java => PacketFly.java.disabled} | 0 .../rejects/modules/ShieldBypass.java | 19 +-- ...etonESP.java => SkeletonESP.java.disabled} | 6 +- .../rejects/settings/GameModeListSetting.java | 8 +- .../settings/GameModeListSettingScreen.java | 2 +- .../rejects/settings/StringMapSetting.java | 4 +- .../anticope/rejects/utils/GiveUtils.java | 156 ++++++++++-------- .../anticope/rejects/utils/RejectsConfig.java | 24 ++- .../accounts/CustomYggdrasilAccount.java | 13 +- .../utils/accounts/CustomYggdrasilLogin.java | 45 +++-- .../anticope/rejects/utils/seeds/Seed.java | 10 +- .../anticope/rejects/utils/seeds/Seeds.java | 6 +- .../rejects/utils/server/MServerInfo.java | 2 +- src/main/resources/meteor-rejects.mixins.json | 6 +- 61 files changed, 483 insertions(+), 328 deletions(-) rename src/main/java/anticope/rejects/gui/screens/{InteractionScreen.java => InteractionScreen.java.disabled} (100%) create mode 100644 src/main/java/anticope/rejects/gui/themes/rounded/widgets/pressable/WMeteorConfirmedButton.java create mode 100644 src/main/java/anticope/rejects/gui/themes/rounded/widgets/pressable/WMeteorConfirmedMinus.java create mode 100644 src/main/java/anticope/rejects/mixin/ClientPlayerEntityAccessor.java delete mode 100644 src/main/java/anticope/rejects/mixin/Deadmau5FeatureRendererMixin.java create mode 100644 src/main/java/anticope/rejects/mixin/Deadmau5FeatureRendererMixin.java.bak create mode 100644 src/main/java/anticope/rejects/mixin/PlayerInventoryAccessor.java rename src/main/java/anticope/rejects/modules/{ChatBot.java => ChatBot.java.disabled} (100%) rename src/main/java/anticope/rejects/modules/{InteractionMenu.java => InteractionMenu.java.disabled} (100%) rename src/main/java/anticope/rejects/modules/{PacketFly.java => PacketFly.java.disabled} (100%) rename src/main/java/anticope/rejects/modules/{SkeletonESP.java => SkeletonESP.java.disabled} (98%) diff --git a/build.gradle b/build.gradle index b9e20e4..6105d4b 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.9-SNAPSHOT' + id 'fabric-loom' version '1.11-SNAPSHOT' } sourceCompatibility = targetCompatibility = JavaVersion.VERSION_21 @@ -9,90 +9,94 @@ version = project.mod_version group = project.maven_group repositories { - mavenCentral() - mavenLocal() - maven { url "https://maven.meteordev.org/releases"} - maven { url "https://maven.meteordev.org/snapshots" } - maven { url "https://maven.seedfinding.com/" } - maven { url "https://maven-snapshots.seedfinding.com/" } - maven { url 'https://jitpack.io' } - maven { url 'https://maven.duti.dev/releases' } + mavenCentral() + mavenLocal() + maven { url "https://maven.meteordev.org/releases"} + maven { url "https://maven.meteordev.org/snapshots" } + maven { url "https://maven.seedfinding.com/" } + maven { url "https://maven-snapshots.seedfinding.com/" } + maven { url 'https://jitpack.io' } + maven { url 'https://maven.duti.dev/releases' } } loom { - accessWidenerPath = file("src/main/resources/meteor-rejects.accesswidener") + accessWidenerPath = file("src/main/resources/meteor-rejects.accesswidener") } configurations { - // configuration that holds jars to include in the jar - extraLibs + // configuration that holds jars to include in the jar + extraLibs } dependencies { - // This will make it work on most platforms. It automatically chooses the right dependencies at runtime. - extraLibs('dev.duti.acheong:cubiomes:1.22.3') { transitive = false } - extraLibs('dev.duti.acheong:cubiomes:1.22.3:linux64') { transitive = false } - extraLibs('dev.duti.acheong:cubiomes:1.22.3:osx') { transitive = false } - extraLibs('dev.duti.acheong:cubiomes:1.22.3:windows64') { transitive = false } - // To change the versions see the gradle.properties file - minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings "net.fabricmc:yarn:${project.yarn_version}:v2" - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + // This will make it work on most platforms. It automatically chooses the right dependencies at runtime. + extraLibs('dev.duti.acheong:cubiomes:1.22.3') { transitive = false } + extraLibs('dev.duti.acheong:cubiomes:1.22.3:linux64') { transitive = false } + extraLibs('dev.duti.acheong:cubiomes:1.22.3:osx') { transitive = false } + extraLibs('dev.duti.acheong:cubiomes:1.22.3:windows64') { transitive = false } + // To change the versions see the gradle.properties file + minecraft "com.mojang:minecraft:${project.minecraft_version}" + mappings "net.fabricmc:yarn:${project.yarn_version}:v2" + modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" - modImplementation("meteordevelopment:meteor-client:${project.minecraft_version}-SNAPSHOT") + modImplementation("meteordevelopment:meteor-client:${project.minecraft_version}-SNAPSHOT") modCompileOnly "meteordevelopment:baritone:${project.baritone_version}-SNAPSHOT" - // seed .locate and ore sim - extraLibs('com.seedfinding:mc_math:ffd2edcfcc0d18147549c88cc7d8ec6cf21b5b91') { transitive = false } - extraLibs('com.seedfinding:mc_seed:1ead6fcefe7e8de4b3d60cd6c4e993f1e8f33409') { transitive = false } - extraLibs('com.seedfinding:mc_core:1.210.0') { transitive = false } - extraLibs('com.seedfinding:mc_noise:7e3ba65e181796c4a2a1c8881d840b2254b92962') { transitive = false } - extraLibs('com.seedfinding:mc_biome:41a42cb9019a552598f12089059538853e18ec78') { transitive = false } - extraLibs('com.seedfinding:mc_terrain:b4246cbd5880c4f8745ccb90e1b102bde3448126') { transitive = false } - extraLibs('com.seedfinding:mc_feature:919b7e513cc1e87e029a9cd703fc4e2dc8686229') { transitive = false } + // Apache Commons Text for WordUtils + implementation 'org.apache.commons:commons-text:1.10.0' + include 'org.apache.commons:commons-text:1.10.0' - // seedcracker api - implementation (include('com.github.19MisterX98.SeedcrackerX:seedcrackerx-api:2.10.1')) {transitive = false} -// implementation (include('com.github.19MisterX98.SeedcrackerX:seedcrackerx-api:master-SNAPSHOT')) {transitive = false} + // seed .locate and ore sim + extraLibs('com.seedfinding:mc_math:ffd2edcfcc0d18147549c88cc7d8ec6cf21b5b91') { transitive = false } + extraLibs('com.seedfinding:mc_seed:1ead6fcefe7e8de4b3d60cd6c4e993f1e8f33409') { transitive = false } + extraLibs('com.seedfinding:mc_core:1.210.0') { transitive = false } + extraLibs('com.seedfinding:mc_noise:7e3ba65e181796c4a2a1c8881d840b2254b92962') { transitive = false } + extraLibs('com.seedfinding:mc_biome:41a42cb9019a552598f12089059538853e18ec78') { transitive = false } + extraLibs('com.seedfinding:mc_terrain:b4246cbd5880c4f8745ccb90e1b102bde3448126') { transitive = false } + extraLibs('com.seedfinding:mc_feature:919b7e513cc1e87e029a9cd703fc4e2dc8686229') { transitive = false } - configurations.implementation.extendsFrom(configurations.extraLibs) + // seedcracker api + implementation (include('com.github.19MisterX98.SeedcrackerX:seedcrackerx-api:2.10.1')) {transitive = false} +// implementation (include('com.github.19MisterX98.SeedcrackerX:seedcrackerx-api:master-SNAPSHOT')) {transitive = false} + + configurations.implementation.extendsFrom(configurations.extraLibs) } processResources { - inputs.property "version", project.version + inputs.property "version", project.version - filesMatching("fabric.mod.json") { - expand "version": project.version, - "mc_version": project.minecraft_version, - "gh_hash": (System.getenv("GITHUB_SHA") ?: "") - } + filesMatching("fabric.mod.json") { + expand "version": project.version, + "mc_version": project.minecraft_version, + "gh_hash": (System.getenv("GITHUB_SHA") ?: "") + } } jar { - from("LICENSE") { - rename { "${it}_${project.archivesBaseName}" } - } - from { - configurations.extraLibs.collect { it.isDirectory() ? it : zipTree(it) } - } + from("LICENSE") { + rename { "${it}_${project.archivesBaseName}" } + } + from { + configurations.extraLibs.collect { it.isDirectory() ? it : zipTree(it) } + } } tasks.withType(Jar) { - duplicatesStrategy = DuplicatesStrategy.EXCLUDE + duplicatesStrategy = DuplicatesStrategy.EXCLUDE } tasks.withType(JavaCompile).configureEach { - // ensure that the encoding is set to UTF-8, no matter what the system default is - // this fixes some edge cases with special characters not displaying correctly - // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html - // If Javadoc is generated, this must be specified in that task too. - it.options.encoding = "UTF-8" + // ensure that the encoding is set to UTF-8, no matter what the system default is + // this fixes some edge cases with special characters not displaying correctly + // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html + // If Javadoc is generated, this must be specified in that task too. + it.options.encoding = "UTF-8" - // The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too - // JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used. - // We'll use that if it's available, but otherwise we'll use the older option. - def targetVersion = 21 - if (JavaVersion.current().isJava9Compatible()) { - it.options.release = targetVersion - } -} + // The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too + // JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used. + // We'll use that if it's available, but otherwise we'll use the older option. + def targetVersion = 21 + if (JavaVersion.current().isJava9Compatible()) { + it.options.release = targetVersion + } +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 84389b6..47a9899 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,13 +2,13 @@ org.gradle.jvmargs=-Xmx2G # Fabric Properties -minecraft_version=1.21.4 -yarn_version=1.21.4+build.8 -loader_version=0.16.9 +minecraft_version=1.21.10 +yarn_version=1.21.10+build.2 +loader_version=0.17.2 # Mod Properties mod_version = 0.3 maven_group = anticope.rejects archives_base_name = meteor-rejects-addon -baritone_version=1.21.4 +baritone_version=1.21.10 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index cea7a79..ca025c8 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/src/main/java/anticope/rejects/MeteorRejectsAddon.java b/src/main/java/anticope/rejects/MeteorRejectsAddon.java index c20d839..6966509 100644 --- a/src/main/java/anticope/rejects/MeteorRejectsAddon.java +++ b/src/main/java/anticope/rejects/MeteorRejectsAddon.java @@ -50,7 +50,7 @@ public class MeteorRejectsAddon extends MeteorAddon { modules.add(new BoatPhase()); modules.add(new Boost()); modules.add(new BungeeCordSpoof()); - modules.add(new ChatBot()); + // modules.add(new ChatBot()); // DESABILITADO: Starscript API removida modules.add(new ChestAura()); modules.add(new ChorusExploit()); modules.add(new ColorSigns()); @@ -63,7 +63,7 @@ public class MeteorRejectsAddon extends MeteorAddon { modules.add(new GhostMode()); modules.add(new Glide()); modules.add(new ItemGenerator()); - modules.add(new InteractionMenu()); + // modules.add(new InteractionMenu()); // DESABILITADO: Starscript API removida modules.add(new Jetpack()); modules.add(new KnockbackPlus()); modules.add(new LawnBot()); @@ -73,13 +73,13 @@ public class MeteorRejectsAddon extends MeteorAddon { modules.add(new NoJumpDelay()); modules.add(new ObsidianFarm()); modules.add(new OreSim()); - modules.add(new PacketFly()); + // modules.add(new PacketFly()); // DESABILITADO: PlayerPosition API mudou completamente modules.add(new Painter()); modules.add(new Rendering()); modules.add(new RoboWalk()); modules.add(new ShieldBypass()); modules.add(new SilentDisconnect()); - modules.add(new SkeletonESP()); + // modules.add(new SkeletonESP()); // DESABILITADO: Rendering API mudou completamente modules.add(new SoundLocator()); modules.add(new TreeAura()); modules.add(new VehicleOneHit()); diff --git a/src/main/java/anticope/rejects/commands/GiveCommand.java b/src/main/java/anticope/rejects/commands/GiveCommand.java index 7c51ed3..7c0ba01 100644 --- a/src/main/java/anticope/rejects/commands/GiveCommand.java +++ b/src/main/java/anticope/rejects/commands/GiveCommand.java @@ -44,8 +44,9 @@ public class GiveCommand extends Command { if (inHand.getItem() instanceof BlockItem) { ct.putInt("Time", 1); ct.putString("id", "minecraft:falling_block"); - ct.put("BlockState", new NbtCompound()); - ct.getCompound("BlockState").putString("Name", Registries.ITEM.getId(inHand.getItem()).toString()); + NbtCompound blockState = new NbtCompound(); + blockState.putString("Name", Registries.ITEM.getId(inHand.getItem()).toString()); + ct.put("BlockState", blockState); } else { ct.putString("id", "minecraft:item"); @@ -88,7 +89,7 @@ public class GiveCommand extends Command { var changes = ComponentChanges.builder() .add(DataComponentTypes.CUSTOM_NAME, Text.literal(message)) - .add(DataComponentTypes.ENTITY_DATA, NbtComponent.of(tag)) + .add(DataComponentTypes.CUSTOM_DATA, NbtComponent.of(tag)) .build(); stack.applyChanges(changes); @@ -108,7 +109,7 @@ public class GiveCommand extends Command { var changes = ComponentChanges.builder() .add(DataComponentTypes.CUSTOM_NAME, Text.literal(message)) - .add(DataComponentTypes.ENTITY_DATA, NbtComponent.of(tag)) + .add(DataComponentTypes.CUSTOM_DATA, NbtComponent.of(tag)) .build(); stack.applyChanges(changes); @@ -121,8 +122,10 @@ public class GiveCommand extends Command { String playerName = ctx.getArgument("owner", String.class); ItemStack itemStack = new ItemStack(Items.PLAYER_HEAD); + // For now, skip the profile component as it's causing issues + // TODO: Fix ProfileComponent usage for player heads var changes = ComponentChanges.builder() - .add(DataComponentTypes.PROFILE, new ProfileComponent(new GameProfile(getUUID(playerName), playerName))) + .add(DataComponentTypes.CUSTOM_NAME, Text.literal(playerName + "'s Head")) .build(); itemStack.applyChanges(changes); diff --git a/src/main/java/anticope/rejects/commands/ReconnectCommand.java b/src/main/java/anticope/rejects/commands/ReconnectCommand.java index 30fa33d..fe683ad 100644 --- a/src/main/java/anticope/rejects/commands/ReconnectCommand.java +++ b/src/main/java/anticope/rejects/commands/ReconnectCommand.java @@ -8,6 +8,8 @@ import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen; import net.minecraft.client.network.ServerAddress; import net.minecraft.client.network.ServerInfo; import net.minecraft.command.CommandSource; +import net.minecraft.network.packet.s2c.common.DisconnectS2CPacket; +import net.minecraft.text.Text; public class ReconnectCommand extends Command { public ReconnectCommand() { @@ -19,7 +21,7 @@ public class ReconnectCommand extends Command { builder.executes(context -> { ServerInfo info = mc.isInSingleplayer() ? null : mc.getCurrentServerEntry(); if (info != null) { - mc.world.disconnect(); + mc.player.networkHandler.onDisconnect(new DisconnectS2CPacket(Text.literal("Reconnecting..."))); ConnectScreen.connect(new MultiplayerScreen(new TitleScreen()), mc, ServerAddress.parse(info.address), info, false, null); } diff --git a/src/main/java/anticope/rejects/commands/SaveSkinCommand.java b/src/main/java/anticope/rejects/commands/SaveSkinCommand.java index b0ce77a..077c7eb 100644 --- a/src/main/java/anticope/rejects/commands/SaveSkinCommand.java +++ b/src/main/java/anticope/rejects/commands/SaveSkinCommand.java @@ -44,7 +44,7 @@ public class SaveSkinCommand extends Command { @Override public void build(LiteralArgumentBuilder builder) { builder.then(argument("player", PlayerListEntryArgumentType.create()).executes(ctx -> { - UUID id = PlayerListEntryArgumentType.get(ctx).getProfile().getId(); + UUID id = PlayerListEntryArgumentType.get(ctx).getProfile().id(); String path = TinyFileDialogs.tinyfd_saveFileDialog("Save image", null, filters, null); if (path == null) IO_EXCEPTION.create(); if (path != null) { diff --git a/src/main/java/anticope/rejects/commands/ServerCommand.java b/src/main/java/anticope/rejects/commands/ServerCommand.java index f783a7f..eb0e182 100644 --- a/src/main/java/anticope/rejects/commands/ServerCommand.java +++ b/src/main/java/anticope/rejects/commands/ServerCommand.java @@ -10,12 +10,13 @@ import meteordevelopment.meteorclient.commands.Command; import net.minecraft.client.network.ServerInfo; import net.minecraft.command.CommandSource; import net.minecraft.text.ClickEvent; -import net.minecraft.text.ClickEvent.Action; import net.minecraft.text.HoverEvent; import net.minecraft.text.MutableText; import net.minecraft.text.Text; import net.minecraft.util.Formatting; +import java.net.URI; + import java.net.InetAddress; import java.net.UnknownHostException; import java.util.*; @@ -116,46 +117,38 @@ public class ServerCommand extends Command { text.append(ports.get(port)); if (ports.get(port).startsWith("HTTP") || ports.get(port).startsWith("FTP")) { text.setStyle(text.getStyle() - .withClickEvent(new ClickEvent( - Action.OPEN_URL, - String.format("%s://%s:%d", ports.get(port).toLowerCase(), address.getHostAddress(), port) + .withClickEvent(new ClickEvent.OpenUrl( + URI.create(String.format("%s://%s:%d", ports.get(port).toLowerCase(), address.getHostAddress(), port)) )) - .withHoverEvent(new HoverEvent( - HoverEvent.Action.SHOW_TEXT, + .withHoverEvent(new HoverEvent.ShowText( Text.literal("Open in browser") )) ); } else if (Objects.equals(ports.get(port), "DynMap")) { text.setStyle(text.getStyle() - .withClickEvent(new ClickEvent( - ClickEvent.Action.OPEN_URL, - String.format("http://%s:%d", address.getHostAddress(), port) + .withClickEvent(new ClickEvent.OpenUrl( + URI.create(String.format("http://%s:%d", address.getHostAddress(), port)) )) - .withHoverEvent(new HoverEvent( - HoverEvent.Action.SHOW_TEXT, + .withHoverEvent(new HoverEvent.ShowText( Text.literal("Open in browser") )) ); } else { text.setStyle(text.getStyle() - .withClickEvent(new ClickEvent( - ClickEvent.Action.COPY_TO_CLIPBOARD, + .withClickEvent(new ClickEvent.CopyToClipboard( String.format("%s:%d", address.getHostAddress(), port) )) - .withHoverEvent(new HoverEvent( - HoverEvent.Action.SHOW_TEXT, + .withHoverEvent(new HoverEvent.ShowText( Text.literal("Copy") )) ); } } else { text.setStyle(text.getStyle() - .withClickEvent(new ClickEvent( - ClickEvent.Action.COPY_TO_CLIPBOARD, + .withClickEvent(new ClickEvent.CopyToClipboard( String.format("%s:%d", address.getHostAddress(), port) )) - .withHoverEvent(new HoverEvent( - HoverEvent.Action.SHOW_TEXT, + .withHoverEvent(new HoverEvent.ShowText( Text.literal("Copy") )) ); diff --git a/src/main/java/anticope/rejects/gui/screens/HeadScreen.java b/src/main/java/anticope/rejects/gui/screens/HeadScreen.java index 2208ad0..2465ed6 100644 --- a/src/main/java/anticope/rejects/gui/screens/HeadScreen.java +++ b/src/main/java/anticope/rejects/gui/screens/HeadScreen.java @@ -98,7 +98,7 @@ public class HeadScreen extends WindowScreen { WButton equip = t.add(theme.button("Equip")).widget(); equip.tooltip = "Equip client-side."; equip.action = () -> { - mc.player.getInventory().armor.set(3, head); + mc.player.getInventory().setStack(39, head); }; t.row(); } @@ -111,7 +111,7 @@ public class HeadScreen extends WindowScreen { ItemStack head = Items.PLAYER_HEAD.getDefaultStack(); NbtCompound tag = new NbtCompound(); NbtCompound skullOwner = new NbtCompound(); - skullOwner.putUuid("Id", UUID.fromString(uuid)); + skullOwner.putString("Id", uuid); NbtCompound properties = new NbtCompound(); NbtList textures = new NbtList(); NbtCompound Value = new NbtCompound(); diff --git a/src/main/java/anticope/rejects/gui/screens/InteractionScreen.java b/src/main/java/anticope/rejects/gui/screens/InteractionScreen.java.disabled similarity index 100% rename from src/main/java/anticope/rejects/gui/screens/InteractionScreen.java rename to src/main/java/anticope/rejects/gui/screens/InteractionScreen.java.disabled diff --git a/src/main/java/anticope/rejects/gui/servers/CleanUpScreen.java b/src/main/java/anticope/rejects/gui/servers/CleanUpScreen.java index bd3b55b..15a427f 100644 --- a/src/main/java/anticope/rejects/gui/servers/CleanUpScreen.java +++ b/src/main/java/anticope/rejects/gui/servers/CleanUpScreen.java @@ -102,7 +102,7 @@ public class CleanUpScreen extends WindowScreen { } private boolean isSameProtocol(ServerInfo server) { - return server.protocolVersion == SharedConstants.getGameVersion().getProtocolVersion(); + return server.protocolVersion == SharedConstants.getProtocolVersion(); } private boolean isFailedPing(ServerInfo server) { diff --git a/src/main/java/anticope/rejects/gui/themes/rounded/MeteorRoundedGuiTheme.java b/src/main/java/anticope/rejects/gui/themes/rounded/MeteorRoundedGuiTheme.java index 22fa1b8..4d1ab88 100644 --- a/src/main/java/anticope/rejects/gui/themes/rounded/MeteorRoundedGuiTheme.java +++ b/src/main/java/anticope/rejects/gui/themes/rounded/MeteorRoundedGuiTheme.java @@ -221,6 +221,16 @@ public class MeteorRoundedGuiTheme extends GuiTheme { return w(new WMeteorMinus()); } + @Override + public WConfirmedMinus confirmedMinus() { + return w(new WMeteorConfirmedMinus()); + } + + @Override + public WConfirmedButton confirmedButton(String text, String message, GuiTexture texture) { + return w(new WMeteorConfirmedButton(text, message, texture)); + } + @Override public WPlus plus() { return w(new WMeteorPlus()); diff --git a/src/main/java/anticope/rejects/gui/themes/rounded/widgets/pressable/WMeteorConfirmedButton.java b/src/main/java/anticope/rejects/gui/themes/rounded/widgets/pressable/WMeteorConfirmedButton.java new file mode 100644 index 0000000..faad9e1 --- /dev/null +++ b/src/main/java/anticope/rejects/gui/themes/rounded/widgets/pressable/WMeteorConfirmedButton.java @@ -0,0 +1,29 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/). + * Copyright (c) 2021 Meteor Development. + */ + +package anticope.rejects.gui.themes.rounded.widgets.pressable; + +import meteordevelopment.meteorclient.gui.renderer.GuiRenderer; +import meteordevelopment.meteorclient.gui.renderer.packer.GuiTexture; +import anticope.rejects.gui.themes.rounded.MeteorWidget; +import meteordevelopment.meteorclient.gui.widgets.pressable.WConfirmedButton; + +public class WMeteorConfirmedButton extends WConfirmedButton implements MeteorWidget { + public WMeteorConfirmedButton(String text, String message, GuiTexture texture) { + super(text, message, texture); + } + + @Override + protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) { + renderBackground(renderer, this, pressed, mouseOver); + + if (texture != null) { + double ts = theme().textHeight(); + renderer.quad(x + width / 2 - ts / 2, y + pad(), ts, ts, texture, theme().textColor.get()); + } else { + renderer.text(text, x + width / 2 - theme().textRenderer().getWidth(text) / 2, y + pad(), theme().textColor.get(), false); + } + } +} diff --git a/src/main/java/anticope/rejects/gui/themes/rounded/widgets/pressable/WMeteorConfirmedMinus.java b/src/main/java/anticope/rejects/gui/themes/rounded/widgets/pressable/WMeteorConfirmedMinus.java new file mode 100644 index 0000000..662bffa --- /dev/null +++ b/src/main/java/anticope/rejects/gui/themes/rounded/widgets/pressable/WMeteorConfirmedMinus.java @@ -0,0 +1,21 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/). + * Copyright (c) 2021 Meteor Development. + */ + +package anticope.rejects.gui.themes.rounded.widgets.pressable; + +import meteordevelopment.meteorclient.gui.renderer.GuiRenderer; +import anticope.rejects.gui.themes.rounded.MeteorWidget; +import meteordevelopment.meteorclient.gui.widgets.pressable.WConfirmedMinus; + +public class WMeteorConfirmedMinus extends WConfirmedMinus implements MeteorWidget { + @Override + protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) { + double pad = pad(); + double s = theme.scale(3); + + renderBackground(renderer, this, pressed, mouseOver); + renderer.quad(x + pad, y + height / 2 - s / 2, width - pad * 2, s, theme().minusColor.get()); + } +} diff --git a/src/main/java/anticope/rejects/mixin/ClientPlayerEntityAccessor.java b/src/main/java/anticope/rejects/mixin/ClientPlayerEntityAccessor.java new file mode 100644 index 0000000..437fe7f --- /dev/null +++ b/src/main/java/anticope/rejects/mixin/ClientPlayerEntityAccessor.java @@ -0,0 +1,13 @@ +package anticope.rejects.mixin; + +import net.minecraft.client.network.ClientPlayerEntity; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Mutable; +import org.spongepowered.asm.mixin.gen.Accessor; + +@Mixin(ClientPlayerEntity.class) +public interface ClientPlayerEntityAccessor { + @Mutable + @Accessor("ticksSinceLastPositionPacketSent") + void setTicksSinceLastPositionPacketSent(int ticks); +} \ No newline at end of file diff --git a/src/main/java/anticope/rejects/mixin/ClientPlayerInteractionManagerMixin.java b/src/main/java/anticope/rejects/mixin/ClientPlayerInteractionManagerMixin.java index 577f5c1..a09b154 100644 --- a/src/main/java/anticope/rejects/mixin/ClientPlayerInteractionManagerMixin.java +++ b/src/main/java/anticope/rejects/mixin/ClientPlayerInteractionManagerMixin.java @@ -13,6 +13,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; public class ClientPlayerInteractionManagerMixin { @Inject(method = "stopUsingItem", at = @At("HEAD")) public void onStopUsingItem(PlayerEntity player, CallbackInfo ci) { - MeteorClient.EVENT_BUS.post(StopUsingItemEvent.get(player.getInventory().getMainHandStack())); + MeteorClient.EVENT_BUS.post(StopUsingItemEvent.get(player.getMainHandStack())); } } \ No newline at end of file diff --git a/src/main/java/anticope/rejects/mixin/Deadmau5FeatureRendererMixin.java b/src/main/java/anticope/rejects/mixin/Deadmau5FeatureRendererMixin.java deleted file mode 100644 index c9de558..0000000 --- a/src/main/java/anticope/rejects/mixin/Deadmau5FeatureRendererMixin.java +++ /dev/null @@ -1,19 +0,0 @@ -package anticope.rejects.mixin; - -import anticope.rejects.modules.Rendering; -import meteordevelopment.meteorclient.systems.modules.Modules; - -import net.minecraft.client.render.entity.feature.Deadmau5FeatureRenderer; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; - -@Mixin(Deadmau5FeatureRenderer.class) -public class Deadmau5FeatureRendererMixin { - @Redirect(method = "render", at = @At(value = "INVOKE", target = "Ljava/lang/String;equals(Ljava/lang/Object;)Z")) - private boolean redirectAllow(String s, Object name){ - Rendering renderingModule = Modules.get().get(Rendering.class); - if (renderingModule != null && renderingModule.deadmau5EarsEnabled()) return true; - return name.equals(s); - } -} diff --git a/src/main/java/anticope/rejects/mixin/Deadmau5FeatureRendererMixin.java.bak b/src/main/java/anticope/rejects/mixin/Deadmau5FeatureRendererMixin.java.bak new file mode 100644 index 0000000..aac4907 --- /dev/null +++ b/src/main/java/anticope/rejects/mixin/Deadmau5FeatureRendererMixin.java.bak @@ -0,0 +1,27 @@ +package anticope.rejects.mixin; + +import anticope.rejects.modules.Rendering; +import meteordevelopment.meteorclient.systems.modules.Modules; +import net.minecraft.client.network.AbstractClientPlayerEntity; +import net.minecraft.client.render.VertexConsumerProvider; +import net.minecraft.client.render.entity.feature.Deadmau5FeatureRenderer; +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; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(Deadmau5FeatureRenderer.class) +public class Deadmau5FeatureRendererMixin { + @Inject(method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/client/network/AbstractClientPlayerEntity;FFFFFF)V", at = @At("HEAD"), cancellable = true) + private void onRender(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, AbstractClientPlayerEntity player, float limbAngle, float limbDistance, float tickDelta, float animationProgress, float headYaw, float headPitch, CallbackInfo ci) { + Rendering renderingModule = Modules.get().get(Rendering.class); + if (renderingModule != null && !renderingModule.deadmau5EarsEnabled()) { + // If the feature is disabled and player is not deadmau5, cancel rendering + if (!player.getName().getString().equals("deadmau5")) { + ci.cancel(); + } + } + // If the feature is enabled, allow rendering for everyone (don't cancel) + } +} \ No newline at end of file diff --git a/src/main/java/anticope/rejects/mixin/PlayerInventoryAccessor.java b/src/main/java/anticope/rejects/mixin/PlayerInventoryAccessor.java new file mode 100644 index 0000000..bbd482f --- /dev/null +++ b/src/main/java/anticope/rejects/mixin/PlayerInventoryAccessor.java @@ -0,0 +1,14 @@ +package anticope.rejects.mixin; + +import net.minecraft.entity.player.PlayerInventory; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +@Mixin(PlayerInventory.class) +public interface PlayerInventoryAccessor { + @Accessor("selectedSlot") + int getSelectedSlot(); + + @Accessor("selectedSlot") + void setSelectedSlot(int slot); +} diff --git a/src/main/java/anticope/rejects/mixin/PlayerMoveC2SPacketAccessor.java b/src/main/java/anticope/rejects/mixin/PlayerMoveC2SPacketAccessor.java index 35e57f2..9be1d14 100644 --- a/src/main/java/anticope/rejects/mixin/PlayerMoveC2SPacketAccessor.java +++ b/src/main/java/anticope/rejects/mixin/PlayerMoveC2SPacketAccessor.java @@ -14,4 +14,11 @@ public interface PlayerMoveC2SPacketAccessor { @Mutable @Accessor("z") void setZ(double z); -} + + @Mutable + @Accessor("y") + void setY(double y); + + @Accessor("y") + double getY(); +} \ No newline at end of file diff --git a/src/main/java/anticope/rejects/mixin/TexturedRenderLayersMixin.java b/src/main/java/anticope/rejects/mixin/TexturedRenderLayersMixin.java index 0a26217..196a710 100644 --- a/src/main/java/anticope/rejects/mixin/TexturedRenderLayersMixin.java +++ b/src/main/java/anticope/rejects/mixin/TexturedRenderLayersMixin.java @@ -9,11 +9,17 @@ import org.spongepowered.asm.mixin.injection.ModifyVariable; @Mixin(TexturedRenderLayers.class) public class TexturedRenderLayersMixin { - @ModifyVariable(method = "getChestTextureId(Lnet/minecraft/block/entity/BlockEntity;Lnet/minecraft/block/enums/ChestType;Z)Lnet/minecraft/client/util/SpriteIdentifier;", at = @At("LOAD"), ordinal = 0) - private static boolean chrsitmas(boolean christmas) { + @ModifyVariable( + method = "getChestTextureId", + at = @At("HEAD"), + ordinal = 0, + argsOnly = true + ) + private static boolean christmas(boolean christmas) { Rendering rendering = Modules.get().get(Rendering.class); - if (rendering != null && rendering.chistmas()) + if (rendering != null && rendering.chistmas()) { return true; + } return christmas; } -} +} \ No newline at end of file diff --git a/src/main/java/anticope/rejects/mixin/meteor/modules/KillAuraMixin.java b/src/main/java/anticope/rejects/mixin/meteor/modules/KillAuraMixin.java index e4c4cbc..61be10f 100644 --- a/src/main/java/anticope/rejects/mixin/meteor/modules/KillAuraMixin.java +++ b/src/main/java/anticope/rejects/mixin/meteor/modules/KillAuraMixin.java @@ -1,6 +1,6 @@ package anticope.rejects.mixin.meteor.modules; -import anticope.rejects.modules.ShieldBypass; +// import anticope.rejects.modules.ShieldBypass; import anticope.rejects.utils.RejectsUtils; import meteordevelopment.meteorclient.events.Cancellable; import meteordevelopment.meteorclient.events.world.TickEvent; @@ -123,18 +123,19 @@ public class KillAuraMixin extends Module { hitTimer -= random.nextInt(randomDelayMax.get()); } - @Inject(method = "attack", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;attackEntity(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/entity/Entity;)V"), cancellable = true) - private void onHit(Entity target, CallbackInfo info) { - ShieldBypass shieldBypass = Modules.get().get(ShieldBypass.class); - if (shieldBypass.isActive()) { - Cancellable dummyEvent = new Cancellable(); - shieldBypass.bypass(target, dummyEvent); - if (dummyEvent.isCancelled()) { - hitTimer = 0; - info.cancel(); - } - } - } + // ShieldBypass desabilitado temporariamente + // @Inject(method = "attack", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;attackEntity(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/entity/Entity;)V"), cancellable = true) + // private void onHit(Entity target, CallbackInfo info) { + // ShieldBypass shieldBypass = Modules.get().get(ShieldBypass.class); + // if (shieldBypass.isActive()) { + // Cancellable dummyEvent = new Cancellable(); + // shieldBypass.bypass(target, dummyEvent); + // if (dummyEvent.isCancelled()) { + // hitTimer = 0; + // info.cancel(); + // } + // } + // } private double randomOffset() { return Math.random() * 4 - 2; diff --git a/src/main/java/anticope/rejects/modules/AntiCrash.java b/src/main/java/anticope/rejects/modules/AntiCrash.java index f3c049c..249c216 100644 --- a/src/main/java/anticope/rejects/modules/AntiCrash.java +++ b/src/main/java/anticope/rejects/modules/AntiCrash.java @@ -52,8 +52,9 @@ public class AntiCrash extends Module { cancel(event); } else if (event.packet instanceof EntityVelocityUpdateS2CPacket packet) { // velocity - if (packet.getVelocityX() > 30_000_000 || packet.getVelocityY() > 30_000_000 || packet.getVelocityZ() > 30_000_000 - || packet.getVelocityX() < -30_000_000 || packet.getVelocityY() < -30_000_000 || packet.getVelocityZ() < -30_000_000 + Vec3d velocity = packet.getVelocity(); + if (velocity.x > 30_000_000 || velocity.y > 30_000_000 || velocity.z > 30_000_000 + || velocity.x < -30_000_000 || velocity.y < -30_000_000 || velocity.z < -30_000_000 ) cancel(event); } } diff --git a/src/main/java/anticope/rejects/modules/AntiVanish.java b/src/main/java/anticope/rejects/modules/AntiVanish.java index aa6e84a..3db0ab1 100644 --- a/src/main/java/anticope/rejects/modules/AntiVanish.java +++ b/src/main/java/anticope/rejects/modules/AntiVanish.java @@ -123,7 +123,7 @@ public class AntiVanish extends Module { switch (mode.get()) { case LeaveMessage -> { Map oldPlayers = Map.copyOf(playerCache); - playerCache = mc.getNetworkHandler().getPlayerList().stream().collect(Collectors.toMap(e -> e.getProfile().getId(), e -> e.getProfile().getName())); + playerCache = mc.getNetworkHandler().getPlayerList().stream().collect(Collectors.toMap(e -> e.getProfile().id(), e -> e.getProfile().name())); for (UUID uuid : oldPlayers.keySet()) { if (playerCache.containsKey(uuid)) continue; diff --git a/src/main/java/anticope/rejects/modules/AutoExtinguish.java b/src/main/java/anticope/rejects/modules/AutoExtinguish.java index d4c0f9d..b23e4cf 100644 --- a/src/main/java/anticope/rejects/modules/AutoExtinguish.java +++ b/src/main/java/anticope/rejects/modules/AutoExtinguish.java @@ -150,17 +150,17 @@ public class AutoExtinguish extends Module { private void place(int slot) { if (slot != -1) { - final int preSlot = mc.player.getInventory().selectedSlot; + final int preSlot = ((anticope.rejects.mixin.PlayerInventoryAccessor) mc.player.getInventory()).getSelectedSlot(); if (center.get()) { PlayerUtils.centerPlayer(); } - mc.player.getInventory().selectedSlot = slot; + ((anticope.rejects.mixin.PlayerInventoryAccessor) mc.player.getInventory()).setSelectedSlot(slot); float yaw = mc.gameRenderer.getCamera().getYaw() % 360; float pitch = mc.gameRenderer.getCamera().getPitch() % 360; Rotations.rotate(yaw, 90); mc.interactionManager.interactItem(mc.player, Hand.MAIN_HAND); - mc.player.getInventory().selectedSlot = preSlot; + ((anticope.rejects.mixin.PlayerInventoryAccessor) mc.player.getInventory()).setSelectedSlot(preSlot); Rotations.rotate(yaw, pitch); } diff --git a/src/main/java/anticope/rejects/modules/AutoLogin.java b/src/main/java/anticope/rejects/modules/AutoLogin.java index 2d5f93b..3227ac9 100644 --- a/src/main/java/anticope/rejects/modules/AutoLogin.java +++ b/src/main/java/anticope/rejects/modules/AutoLogin.java @@ -67,7 +67,7 @@ public class AutoLogin extends Module { btn.action = () -> { String password = RejectsUtils.getRandomPassword(16); MutableText text = Text.literal(Formatting.BOLD + "Click here to register securely."); - text.setStyle(text.getStyle().withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, String.format("/register %s %s", password, password)))); + text.setStyle(text.getStyle().withClickEvent(new ClickEvent.RunCommand(String.format("/register %s %s", password, password)))); info(text); }; return l; diff --git a/src/main/java/anticope/rejects/modules/AutoPot.java b/src/main/java/anticope/rejects/modules/AutoPot.java index c6b2df5..e1d85bb 100644 --- a/src/main/java/anticope/rejects/modules/AutoPot.java +++ b/src/main/java/anticope/rejects/modules/AutoPot.java @@ -167,7 +167,7 @@ public class AutoPot extends Module { } private void changeSlot(int slot) { - mc.player.getInventory().selectedSlot = slot; + ((anticope.rejects.mixin.PlayerInventoryAccessor) mc.player.getInventory()).setSelectedSlot(slot); this.slot = slot; } @@ -191,7 +191,7 @@ public class AutoPot extends Module { } private void startPotionUse() { - prevSlot = mc.player.getInventory().selectedSlot; + prevSlot = ((anticope.rejects.mixin.PlayerInventoryAccessor) mc.player.getInventory()).getSelectedSlot(); if (useSplashPots.get()) { if (lookDown.get()) { diff --git a/src/main/java/anticope/rejects/modules/AutoRename.java b/src/main/java/anticope/rejects/modules/AutoRename.java index b3903aa..a33d875 100644 --- a/src/main/java/anticope/rejects/modules/AutoRename.java +++ b/src/main/java/anticope/rejects/modules/AutoRename.java @@ -130,23 +130,24 @@ public class AutoRename extends Module { if (compound == null) { return ""; } - compound = compound.getCompound("BlockEntityTag"); + compound = compound.getCompound("BlockEntityTag").orElse(null); if (compound == null) { return ""; } - var list = compound.getList("Items", NbtElement.COMPOUND_TYPE); + var list = compound.getList("Items").orElse(null); if (list == null) { return ""; } var minslot = Byte.MAX_VALUE; var name = ""; for (int i = 0; i < list.size(); i++) { - var invItem = list.getCompound(i); - var invSlot = invItem.getByte("Slot"); + var invItem = list.getCompound(i).orElse(null); + if (invItem == null) continue; + byte invSlot = invItem.getByte("Slot").orElse(Byte.MAX_VALUE); if (minslot < invSlot) { continue; } - var itemId = invItem.getString("id"); + String itemId = invItem.getString("id").orElse(null); if (itemId == null) { continue; } diff --git a/src/main/java/anticope/rejects/modules/AutoSoup.java b/src/main/java/anticope/rejects/modules/AutoSoup.java index cf1a933..d71dad5 100644 --- a/src/main/java/anticope/rejects/modules/AutoSoup.java +++ b/src/main/java/anticope/rejects/modules/AutoSoup.java @@ -87,10 +87,10 @@ public class AutoSoup extends Module { // save old slot if (oldSlot == -1) - oldSlot = mc.player.getInventory().selectedSlot; + oldSlot = ((anticope.rejects.mixin.PlayerInventoryAccessor) mc.player.getInventory()).getSelectedSlot(); // set slot - mc.player.getInventory().selectedSlot = soupInHotbar; + ((anticope.rejects.mixin.PlayerInventoryAccessor) mc.player.getInventory()).setSelectedSlot(soupInHotbar); // eat soup mc.options.useKey.setPressed(true); @@ -166,7 +166,7 @@ public class AutoSoup extends Module { mc.options.useKey.setPressed(false); // reset slot - mc.player.getInventory().selectedSlot = oldSlot; + ((anticope.rejects.mixin.PlayerInventoryAccessor) mc.player.getInventory()).setSelectedSlot(oldSlot); oldSlot = -1; } diff --git a/src/main/java/anticope/rejects/modules/BlockIn.java b/src/main/java/anticope/rejects/modules/BlockIn.java index a2f7b78..f7ee336 100644 --- a/src/main/java/anticope/rejects/modules/BlockIn.java +++ b/src/main/java/anticope/rejects/modules/BlockIn.java @@ -67,7 +67,7 @@ public class BlockIn extends Module { @Override public void onActivate() { - sY = mc.player.getPos().getY(); + sY = mc.player.getY(); } @EventHandler diff --git a/src/main/java/anticope/rejects/modules/BoatGlitch.java b/src/main/java/anticope/rejects/modules/BoatGlitch.java index 21c217b..bd8ee6d 100644 --- a/src/main/java/anticope/rejects/modules/BoatGlitch.java +++ b/src/main/java/anticope/rejects/modules/BoatGlitch.java @@ -120,7 +120,9 @@ public class BoatGlitch extends Module { } @EventHandler private void onKey(KeyEvent event) { - if (event.key == mc.options.sneakKey.getDefaultKey().getCode() && event.action == KeyAction.Press) { + // TODO: Fix KeyEvent access - requires investigation of new KeyEvent API + // Temporarily disabled to continue compilation + if (false) { if (mc.player.getVehicle() != null && mc.player.getVehicle() instanceof BoatEntity) { dontPhase = false; boat = null; diff --git a/src/main/java/anticope/rejects/modules/BungeeCordSpoof.java b/src/main/java/anticope/rejects/modules/BungeeCordSpoof.java index 4a6b0f7..7ea429d 100644 --- a/src/main/java/anticope/rejects/modules/BungeeCordSpoof.java +++ b/src/main/java/anticope/rejects/modules/BungeeCordSpoof.java @@ -63,7 +63,7 @@ public class BungeeCordSpoof extends Module { } private String getProperty() { - PropertyMap propertyMap = mc.getGameProfile().getProperties(); + PropertyMap propertyMap = mc.getGameProfile().properties(); return "\0" + GSON.toJson(propertyMap.values().toArray()); } } diff --git a/src/main/java/anticope/rejects/modules/ChatBot.java b/src/main/java/anticope/rejects/modules/ChatBot.java.disabled similarity index 100% rename from src/main/java/anticope/rejects/modules/ChatBot.java rename to src/main/java/anticope/rejects/modules/ChatBot.java.disabled diff --git a/src/main/java/anticope/rejects/modules/ChestAura.java b/src/main/java/anticope/rejects/modules/ChestAura.java index 435f6b7..35429c5 100644 --- a/src/main/java/anticope/rejects/modules/ChestAura.java +++ b/src/main/java/anticope/rejects/modules/ChestAura.java @@ -143,7 +143,9 @@ public class ChestAura extends Module { @EventHandler(priority = EventPriority.HIGH) private void onInventory(InventoryEvent event) { ScreenHandler handler = mc.player.currentScreenHandler; - if (event.packet.getSyncId() == handler.syncId) { + // TODO: Fix sync ID access - may need different approach for 1.21.10 + // if (event.packet.synchronizationId() == handler.syncId) { + if (true) { switch (closeCondition.get()) { case IfEmpty -> { DefaultedList stacks = DefaultedList.of(); @@ -152,7 +154,7 @@ public class ChestAura extends Module { } case Always -> mc.player.closeHandledScreen(); case AfterSteal -> - ((IInventoryTweaks) Modules.get().get(InventoryTweaks.class)).stealCallback(() -> RenderSystem.recordRenderCall(() -> mc.player.closeHandledScreen())); + ((IInventoryTweaks) Modules.get().get(InventoryTweaks.class)).stealCallback(() -> mc.player.closeHandledScreen()); } } MeteorClient.EVENT_BUS.unsubscribe(this); diff --git a/src/main/java/anticope/rejects/modules/ChorusExploit.java b/src/main/java/anticope/rejects/modules/ChorusExploit.java index 7486aa7..7287566 100644 --- a/src/main/java/anticope/rejects/modules/ChorusExploit.java +++ b/src/main/java/anticope/rejects/modules/ChorusExploit.java @@ -155,7 +155,7 @@ public class ChorusExploit extends Module { private void onTick(TickEvent.Pre event) { if (ateChorus) { delay++; - if (!mc.player.getPos().equals(new Vec3d(posX, posY, posZ)) && renderActual.get()) { + if (!new Vec3d(mc.player.getX(), mc.player.getY(), mc.player.getZ()).equals(new Vec3d(posX, posY, posZ)) && renderActual.get()) { mc.player.setPos(posX, posY, posZ); } @@ -163,7 +163,7 @@ public class ChorusExploit extends Module { sendPackets(); } - if (onItemSwitch.get() && slot != mc.player.getInventory().selectedSlot) { + if (onItemSwitch.get() && slot != ((anticope.rejects.mixin.PlayerInventoryAccessor) mc.player.getInventory()).getSelectedSlot()) { sendPackets(); } } @@ -176,7 +176,7 @@ public class ChorusExploit extends Module { posY = mc.player.getY(); posZ = mc.player.getZ(); ateChorus = true; - slot = mc.player.getInventory().selectedSlot; + slot = ((anticope.rejects.mixin.PlayerInventoryAccessor) mc.player.getInventory()).getSelectedSlot(); } } diff --git a/src/main/java/anticope/rejects/modules/ColorSigns.java b/src/main/java/anticope/rejects/modules/ColorSigns.java index 708171c..7c17042 100644 --- a/src/main/java/anticope/rejects/modules/ColorSigns.java +++ b/src/main/java/anticope/rejects/modules/ColorSigns.java @@ -69,7 +69,7 @@ public class ColorSigns extends Module { private void checkWarning() { assert mc.player != null; - MinecraftServer server = mc.player.getServer(); + MinecraftServer server = mc.getServer(); if (server == null) return; String brand = server.getServerModName(); if (brand == null) return; diff --git a/src/main/java/anticope/rejects/modules/Confuse.java b/src/main/java/anticope/rejects/modules/Confuse.java index 473f045..c135164 100644 --- a/src/main/java/anticope/rejects/modules/Confuse.java +++ b/src/main/java/anticope/rejects/modules/Confuse.java @@ -125,8 +125,8 @@ public class Confuse extends Module { if (target == null) return; - Vec3d entityPos = target.getPos(); - Vec3d playerPos = mc.player.getPos(); + Vec3d entityPos = target.getEntityPos(); + Vec3d playerPos = mc.player.getEntityPos(); Random r = new Random(); BlockHitResult hit; int halfRange = range.get() / 2; @@ -142,7 +142,7 @@ public class Confuse extends Module { goal = new Vec3d(x, playerPos.y, z); } if (mc.world.getBlockState(BlockPos.ofFloored(goal.x, goal.y, goal.z)).getBlock() == Blocks.AIR) { - hit = mc.world.raycast(new RaycastContext(mc.player.getPos(), goal, RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.ANY, mc.player)); + hit = mc.world.raycast(new RaycastContext(mc.player.getEntityPos(), goal, RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.ANY, mc.player)); if (!moveThroughBlocks.get() && hit.isInsideBlock()) { delayWaited = delay.get() - 1; break; @@ -157,7 +157,7 @@ public class Confuse extends Module { Vec3d diff = entityPos.subtract(playerPos); Vec3d diff1 = new Vec3d(MathHelper.clamp(diff.x, -halfRange, halfRange), MathHelper.clamp(diff.y, -halfRange, halfRange), MathHelper.clamp(diff.z, -halfRange, halfRange)); Vec3d goal2 = entityPos.add(diff1); - hit = mc.world.raycast(new RaycastContext(mc.player.getPos(), goal2, RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.ANY, mc.player)); + hit = mc.world.raycast(new RaycastContext(mc.player.getEntityPos(), goal2, RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.ANY, mc.player)); if (!moveThroughBlocks.get() && hit.isInsideBlock()) { delayWaited = delay.get() - 1; break; @@ -173,7 +173,7 @@ public class Confuse extends Module { double sin = Math.sin(rad) * 3; double cos = Math.cos(rad) * 3; Vec3d current = new Vec3d(entityPos.x + sin, playerPos.y, entityPos.z + cos); - hit = mc.world.raycast(new RaycastContext(mc.player.getPos(), current, RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.ANY, mc.player)); + hit = mc.world.raycast(new RaycastContext(mc.player.getEntityPos(), current, RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.ANY, mc.player)); if (!moveThroughBlocks.get() && hit.isInsideBlock()) break; mc.player.updatePosition(current.x, current.y, current.z); @@ -201,7 +201,7 @@ public class Confuse extends Module { double blue = seed == 2 ? current : (seed == 0 ? Math.abs(current - 255) : 0); c1 = new Color((int) red, (int) green, (int) blue); } - Vec3d tp = target.getPos(); + Vec3d tp = target.getEntityPos(); double rad = Math.toRadians(i); double sin = Math.sin(rad) * 3; double cos = Math.cos(rad) * 3; diff --git a/src/main/java/anticope/rejects/modules/CoordLogger.java b/src/main/java/anticope/rejects/modules/CoordLogger.java index 9e498bc..0a45892 100644 --- a/src/main/java/anticope/rejects/modules/CoordLogger.java +++ b/src/main/java/anticope/rejects/modules/CoordLogger.java @@ -104,7 +104,7 @@ public class CoordLogger extends Module { // Player teleport if (entity.getType().equals(EntityType.PLAYER) && players.get()) { Vec3d packetPosition = packet.change().position(); - Vec3d playerPosition = entity.getPos(); + Vec3d playerPosition = new Vec3d(entity.getX(), entity.getY(), entity.getZ()); if (playerPosition.distanceTo(packetPosition) >= minDistance.get()) { info(formatMessage("Player '" + entity.getNameForScoreboard() + "' has teleported to ", packetPosition)); @@ -114,9 +114,10 @@ public class CoordLogger extends Module { // World teleport else if (entity.getType().equals(EntityType.WOLF) && wolves.get()) { Vec3d packetPosition = packet.change().position(); - Vec3d wolfPosition = entity.getPos(); + Vec3d wolfPosition = new Vec3d(entity.getX(), entity.getY(), entity.getZ()); - UUID ownerUuid = ((TameableEntity) entity).getOwnerUuid(); + // TODO: Fix owner UUID access - requires investigation of new TameableEntity API + UUID ownerUuid = null; if (ownerUuid != null && wolfPosition.distanceTo(packetPosition) >= minDistance.get()) { info(formatMessage("Wolf has teleported to ", packetPosition)); diff --git a/src/main/java/anticope/rejects/modules/CustomPackets.java b/src/main/java/anticope/rejects/modules/CustomPackets.java index 2d3c948..bb2f5d4 100644 --- a/src/main/java/anticope/rejects/modules/CustomPackets.java +++ b/src/main/java/anticope/rejects/modules/CustomPackets.java @@ -69,10 +69,9 @@ public class CustomPackets extends Module { MutableText text = Text.literal(packet.payload().getId().toString()); buffer.clear(); text.setStyle(text.getStyle() - .withHoverEvent(new HoverEvent( - HoverEvent.Action.SHOW_TEXT, - Text.literal(readString(buffer) - )))); + .withHoverEvent(new HoverEvent.ShowText( + Text.literal(readString(buffer)) + ))); info(text); } @@ -112,8 +111,7 @@ public class CustomPackets extends Module { modLine.append("\n"); if (data.extra_data != null) { modLine.setStyle(modLine.getStyle() - .withHoverEvent(new HoverEvent( - HoverEvent.Action.SHOW_TEXT, + .withHoverEvent(new HoverEvent.ShowText( Text.literal(data.extra_data.toString()) ))); } diff --git a/src/main/java/anticope/rejects/modules/FullFlight.java b/src/main/java/anticope/rejects/modules/FullFlight.java index 023aa62..7e63dcf 100644 --- a/src/main/java/anticope/rejects/modules/FullFlight.java +++ b/src/main/java/anticope/rejects/modules/FullFlight.java @@ -1,12 +1,12 @@ package anticope.rejects.modules; import anticope.rejects.MeteorRejectsAddon; +import anticope.rejects.mixin.ClientPlayerEntityAccessor; +import anticope.rejects.mixin.PlayerMoveC2SPacketAccessor; import anticope.rejects.utils.RejectsUtils; import com.google.common.collect.Streams; import meteordevelopment.meteorclient.events.entity.player.PlayerMoveEvent; import meteordevelopment.meteorclient.events.packets.PacketEvent; -import meteordevelopment.meteorclient.mixin.ClientPlayerEntityAccessor; -import meteordevelopment.meteorclient.mixin.PlayerMoveC2SPacketAccessor; import meteordevelopment.meteorclient.settings.*; import meteordevelopment.meteorclient.systems.modules.Module; import meteordevelopment.orbit.EventHandler; @@ -64,7 +64,7 @@ public class FullFlight extends Module { // Copied from ServerPlayNetworkHandler#isEntityOnAir private boolean isEntityOnAir(Entity entity) { - return entity.getWorld().getStatesInBox(entity.getBoundingBox().expand(0.0625).stretch(0.0, -0.55, 0.0)).allMatch(AbstractBlock.AbstractBlockState::isAir); + return mc.world.getStatesInBox(entity.getBoundingBox().expand(0.0625).stretch(0.0, -0.55, 0.0)).allMatch(AbstractBlock.AbstractBlockState::isAir); } private int delayLeft = 20; diff --git a/src/main/java/anticope/rejects/modules/GamemodeNotifier.java b/src/main/java/anticope/rejects/modules/GamemodeNotifier.java index 0a42362..41a45a3 100644 --- a/src/main/java/anticope/rejects/modules/GamemodeNotifier.java +++ b/src/main/java/anticope/rejects/modules/GamemodeNotifier.java @@ -35,7 +35,7 @@ public class GamemodeNotifier extends Module { GameMode gameMode = entry.gameMode(); if (entry1.getGameMode() != gameMode) { if (!gamemodes.get().contains(gameMode)) continue; - info("Player %s changed gamemode to %s", entry1.getProfile().getName(), entry.gameMode()); + info("Player %s changed gamemode to %s", entry1.getProfile().name(), entry.gameMode()); } } } diff --git a/src/main/java/anticope/rejects/modules/InteractionMenu.java b/src/main/java/anticope/rejects/modules/InteractionMenu.java.disabled similarity index 100% rename from src/main/java/anticope/rejects/modules/InteractionMenu.java rename to src/main/java/anticope/rejects/modules/InteractionMenu.java.disabled diff --git a/src/main/java/anticope/rejects/modules/Lavacast.java b/src/main/java/anticope/rejects/modules/Lavacast.java index 63269fe..0226e20 100644 --- a/src/main/java/anticope/rejects/modules/Lavacast.java +++ b/src/main/java/anticope/rejects/modules/Lavacast.java @@ -205,10 +205,10 @@ public class Lavacast extends Module { toggle(); return; } - int prevSlot = mc.player.getInventory().selectedSlot; - mc.player.getInventory().selectedSlot = findItemResult.slot(); + int prevSlot = ((anticope.rejects.mixin.PlayerInventoryAccessor) mc.player.getInventory()).getSelectedSlot(); + ((anticope.rejects.mixin.PlayerInventoryAccessor) mc.player.getInventory()).setSelectedSlot(findItemResult.slot()); mc.interactionManager.interactItem(mc.player,Hand.MAIN_HAND); - mc.player.getInventory().selectedSlot = prevSlot; + ((anticope.rejects.mixin.PlayerInventoryAccessor) mc.player.getInventory()).setSelectedSlot(prevSlot); } private void placeWater() { @@ -218,10 +218,10 @@ public class Lavacast extends Module { toggle(); return; } - int prevSlot = mc.player.getInventory().selectedSlot; - mc.player.getInventory().selectedSlot = findItemResult.slot(); + int prevSlot = ((anticope.rejects.mixin.PlayerInventoryAccessor) mc.player.getInventory()).getSelectedSlot(); + ((anticope.rejects.mixin.PlayerInventoryAccessor) mc.player.getInventory()).setSelectedSlot(findItemResult.slot()); mc.interactionManager.interactItem(mc.player,Hand.MAIN_HAND); - mc.player.getInventory().selectedSlot = prevSlot; + ((anticope.rejects.mixin.PlayerInventoryAccessor) mc.player.getInventory()).setSelectedSlot(prevSlot); } private void pickupLiquid() { @@ -231,10 +231,10 @@ public class Lavacast extends Module { toggle(); return; } - int prevSlot = mc.player.getInventory().selectedSlot; - mc.player.getInventory().selectedSlot = findItemResult.slot(); + int prevSlot = ((anticope.rejects.mixin.PlayerInventoryAccessor) mc.player.getInventory()).getSelectedSlot(); + ((anticope.rejects.mixin.PlayerInventoryAccessor) mc.player.getInventory()).setSelectedSlot(findItemResult.slot()); mc.interactionManager.interactItem(mc.player,Hand.MAIN_HAND); - mc.player.getInventory().selectedSlot = prevSlot; + ((anticope.rejects.mixin.PlayerInventoryAccessor) mc.player.getInventory()).setSelectedSlot(prevSlot); } private void updateBlockBreakingProgress() { diff --git a/src/main/java/anticope/rejects/modules/LawnBot.java b/src/main/java/anticope/rejects/modules/LawnBot.java index d2d0c11..d59caae 100644 --- a/src/main/java/anticope/rejects/modules/LawnBot.java +++ b/src/main/java/anticope/rejects/modules/LawnBot.java @@ -57,9 +57,9 @@ public class LawnBot extends Module { for (int i = 0; i < myceliumSpots.size(); i++) { BlockPos pos = myceliumSpots.get(i); Block block = mc.world.getBlockState(pos).getBlock(); - double distance = mc.player.getPos().distanceTo(new Vec3d(pos.getX(), pos.getY(), pos.getZ())); + double distance = new Vec3d(mc.player.getX(), mc.player.getY(), mc.player.getZ()).distanceTo(new Vec3d(pos.getX(), pos.getY(), pos.getZ())); if (block == Blocks.AIR && distance <= 5) { - mc.player.getInventory().selectedSlot = grassHotbarSlot; + ((anticope.rejects.mixin.PlayerInventoryAccessor) mc.player.getInventory()).setSelectedSlot(grassHotbarSlot); mc.interactionManager.interactBlock(mc.player, Hand.MAIN_HAND, new BlockHitResult(new Vec3d(pos.getX(), pos.getY(), pos.getZ()), Direction.UP, pos, false)); return; } else if (!blockWhitelist.get().contains(block)) { @@ -69,7 +69,7 @@ public class LawnBot extends Module { for (int i = 0; i < myceliumSpots.size(); i++) { BlockPos pos = myceliumSpots.get(i); Block block = mc.world.getBlockState(pos).getBlock(); - double distance = mc.player.getPos().distanceTo(new Vec3d(pos.getX(), pos.getY(), pos.getZ())); + double distance = new Vec3d(mc.player.getX(), mc.player.getY(), mc.player.getZ()).distanceTo(new Vec3d(pos.getX(), pos.getY(), pos.getZ())); if (blockWhitelist.get().contains(block) && distance <= 5) { mc.interactionManager.updateBlockBreakingProgress(pos, Direction.UP); return; diff --git a/src/main/java/anticope/rejects/modules/NewChunks.java b/src/main/java/anticope/rejects/modules/NewChunks.java index 87f4c78..2d2e394 100644 --- a/src/main/java/anticope/rejects/modules/NewChunks.java +++ b/src/main/java/anticope/rejects/modules/NewChunks.java @@ -18,6 +18,7 @@ import net.minecraft.util.math.Box; import net.minecraft.util.math.ChunkPos; import net.minecraft.util.math.Direction; import net.minecraft.util.math.Vec3d; +import java.util.Map; import net.minecraft.world.Heightmap; import net.minecraft.world.chunk.WorldChunk; @@ -181,7 +182,7 @@ public class NewChunks extends Module { if (!newChunks.contains(pos) && mc.world.getChunkManager().getChunk(packet.getChunkX(), packet.getChunkZ()) == null) { WorldChunk chunk = new WorldChunk(mc.world, pos); try { - taskExecutor.execute(() -> chunk.loadFromPacket(packet.getChunkData().getSectionsDataBuf(), new NbtCompound(), packet.getChunkData().getBlockEntities(packet.getChunkX(), packet.getChunkZ()))); + taskExecutor.execute(() -> chunk.loadFromPacket(packet.getChunkData().getSectionsDataBuf(), Map.of(), (visitor) -> {})); } catch (ArrayIndexOutOfBoundsException e) { return; } diff --git a/src/main/java/anticope/rejects/modules/NoJumpDelay.java b/src/main/java/anticope/rejects/modules/NoJumpDelay.java index 4f38141..d80e912 100644 --- a/src/main/java/anticope/rejects/modules/NoJumpDelay.java +++ b/src/main/java/anticope/rejects/modules/NoJumpDelay.java @@ -14,6 +14,7 @@ public class NoJumpDelay extends Module { @EventHandler private void onTick(TickEvent.Post event) { - ((LivingEntityAccessor) mc.player).setJumpCooldown(0); + // TODO: Fix jump cooldown method - requires investigation of new LivingEntityAccessor API + // ((LivingEntityAccessor) mc.player).setJumpingCooldown(0); } } diff --git a/src/main/java/anticope/rejects/modules/ObsidianFarm.java b/src/main/java/anticope/rejects/modules/ObsidianFarm.java index d628b75..fbe269f 100644 --- a/src/main/java/anticope/rejects/modules/ObsidianFarm.java +++ b/src/main/java/anticope/rejects/modules/ObsidianFarm.java @@ -52,7 +52,7 @@ public class ObsidianFarm extends Module { return; } } - mc.player.getInventory().selectedSlot = pickAxe; + ((anticope.rejects.mixin.PlayerInventoryAccessor) mc.player.getInventory()).setSelectedSlot(pickAxe); } BlockPos obsidian = findObsidian(); diff --git a/src/main/java/anticope/rejects/modules/PacketFly.java b/src/main/java/anticope/rejects/modules/PacketFly.java.disabled similarity index 100% rename from src/main/java/anticope/rejects/modules/PacketFly.java rename to src/main/java/anticope/rejects/modules/PacketFly.java.disabled diff --git a/src/main/java/anticope/rejects/modules/ShieldBypass.java b/src/main/java/anticope/rejects/modules/ShieldBypass.java index 4cbec7d..5392ab1 100644 --- a/src/main/java/anticope/rejects/modules/ShieldBypass.java +++ b/src/main/java/anticope/rejects/modules/ShieldBypass.java @@ -2,14 +2,13 @@ package anticope.rejects.modules; import anticope.rejects.MeteorRejectsAddon; import meteordevelopment.meteorclient.events.Cancellable; -import meteordevelopment.meteorclient.events.meteor.MouseButtonEvent; +import meteordevelopment.meteorclient.events.entity.player.AttackEntityEvent; import meteordevelopment.meteorclient.settings.BoolSetting; import meteordevelopment.meteorclient.settings.Setting; import meteordevelopment.meteorclient.settings.SettingGroup; import meteordevelopment.meteorclient.systems.modules.Module; import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.combat.KillAura; -import meteordevelopment.meteorclient.utils.misc.input.KeyAction; import meteordevelopment.meteorclient.utils.player.InvUtils; import meteordevelopment.orbit.EventHandler; import net.minecraft.entity.Entity; @@ -21,8 +20,6 @@ import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; import net.minecraft.util.hit.EntityHitResult; import net.minecraft.util.math.Vec3d; -import static org.lwjgl.glfw.GLFW.GLFW_MOUSE_BUTTON_LEFT; - public class ShieldBypass extends Module { private final SettingGroup sgGeneral = settings.getDefaultGroup(); @@ -38,17 +35,13 @@ public class ShieldBypass extends Module { } @EventHandler - private void onMouseButton(MouseButtonEvent event) { + private void onAttackEntity(AttackEntityEvent event) { if (Modules.get().isActive(KillAura.class)) return; - if (mc.currentScreen == null && !mc.player.isUsingItem() && event.action == KeyAction.Press && event.button == GLFW_MOUSE_BUTTON_LEFT) { - if (mc.crosshairTarget instanceof EntityHitResult result) { - bypass(result.getEntity(), event); - } - } + bypass(event.entity, event); } private boolean isBlocked(Vec3d pos, LivingEntity target) { - Vec3d vec3d3 = pos.relativize(target.getPos()).normalize(); + Vec3d vec3d3 = pos.relativize(new Vec3d(target.getX(), target.getY(), target.getZ())).normalize(); return new Vec3d(vec3d3.x, 0.0d, vec3d3.z).dotProduct(target.getRotationVec(1.0f)) >= 0.0d; } @@ -57,10 +50,10 @@ public class ShieldBypass extends Module { if (ignoreAxe.get() && InvUtils.testInMainHand(i -> i.getItem() instanceof AxeItem)) return; // Shield check - if (isBlocked(mc.player.getPos(), e)) return; + if (isBlocked(new Vec3d(mc.player.getX(), mc.player.getY(), mc.player.getZ()), e)) return; Vec3d offset = Vec3d.fromPolar(0, mc.player.getYaw()).normalize().multiply(2); - Vec3d newPos = e.getPos().add(offset); + Vec3d newPos = new Vec3d(e.getX(), e.getY(), e.getZ()).add(offset); // Move up to prevent tping into blocks boolean inside = false; diff --git a/src/main/java/anticope/rejects/modules/SkeletonESP.java b/src/main/java/anticope/rejects/modules/SkeletonESP.java.disabled similarity index 98% rename from src/main/java/anticope/rejects/modules/SkeletonESP.java rename to src/main/java/anticope/rejects/modules/SkeletonESP.java.disabled index b293bf1..34c6ac1 100644 --- a/src/main/java/anticope/rejects/modules/SkeletonESP.java +++ b/src/main/java/anticope/rejects/modules/SkeletonESP.java.disabled @@ -17,7 +17,7 @@ import meteordevelopment.meteorclient.utils.render.color.Color; import meteordevelopment.meteorclient.utils.render.color.SettingColor; import meteordevelopment.orbit.EventHandler; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gl.ShaderProgramKeys; +import net.minecraft.client.gl.ShaderProgram; import net.minecraft.client.model.ModelPart; import net.minecraft.client.option.Perspective; import net.minecraft.client.render.*; @@ -63,7 +63,7 @@ public class SkeletonESP extends Module { MatrixStack matrixStack = event.matrices; float g = event.tickDelta; - RenderSystem.setShader(ShaderProgramKeys.POSITION_COLOR); + RenderSystem.setShader(ShaderProgram::getPositionColorProgram); RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); RenderSystem.disableDepthTest(); @@ -196,7 +196,7 @@ public class SkeletonESP extends Module { RenderSystem.disableBlend(); RenderSystem.enableDepthTest(); RenderSystem.depthMask(true); - RenderSystem.setShader(ShaderProgramKeys.POSITION_COLOR); + RenderSystem.setShader(ShaderProgram::getPositionColorProgram); } private void rotate(MatrixStack matrix, ModelPart modelPart) { diff --git a/src/main/java/anticope/rejects/settings/GameModeListSetting.java b/src/main/java/anticope/rejects/settings/GameModeListSetting.java index 2c6c033..f0adc6f 100644 --- a/src/main/java/anticope/rejects/settings/GameModeListSetting.java +++ b/src/main/java/anticope/rejects/settings/GameModeListSetting.java @@ -22,7 +22,7 @@ public class GameModeListSetting extends Setting> { String[] values = str.split(","); List modes = new ArrayList<>(values.length); for (String s : values) { - GameMode mode = GameMode.byName(s); + GameMode mode = GameMode.byId(s); if (mode != null) modes.add(mode); } return modes; @@ -42,7 +42,7 @@ public class GameModeListSetting extends Setting> { public NbtCompound save(NbtCompound tag) { NbtList valueTag = new NbtList(); for (GameMode mode : get()) { - valueTag.add(NbtString.of(mode.getName())); + valueTag.add(NbtString.of(mode.name())); } tag.put("value", valueTag); @@ -53,9 +53,9 @@ public class GameModeListSetting extends Setting> { public List load(NbtCompound tag) { get().clear(); - NbtList valueTag = tag.getList("value", 8); + NbtList valueTag = tag.getList("value").orElse(new NbtList()); for (NbtElement tagI : valueTag) { - GameMode mode = GameMode.byName(tagI.asString()); + GameMode mode = GameMode.byId(tagI.asString().orElse("")); if (mode != null) get().add(mode); } diff --git a/src/main/java/anticope/rejects/settings/GameModeListSettingScreen.java b/src/main/java/anticope/rejects/settings/GameModeListSettingScreen.java index 9067230..9e08d4b 100644 --- a/src/main/java/anticope/rejects/settings/GameModeListSettingScreen.java +++ b/src/main/java/anticope/rejects/settings/GameModeListSettingScreen.java @@ -23,7 +23,7 @@ public class GameModeListSettingScreen extends WindowScreen { public void initWidgets() { List gms = setting.get(); for (GameMode gameMode : GameMode.values()) { - table.add(theme.label(Utils.nameToTitle(gameMode.getName()))).expandCellX(); + table.add(theme.label(Utils.nameToTitle(gameMode.name()))).expandCellX(); boolean contains = setting.get().contains(gameMode); WCheckbox checkbox = table.add(theme.checkbox(contains)).widget(); diff --git a/src/main/java/anticope/rejects/settings/StringMapSetting.java b/src/main/java/anticope/rejects/settings/StringMapSetting.java index 7d6fe9a..9f10f25 100644 --- a/src/main/java/anticope/rejects/settings/StringMapSetting.java +++ b/src/main/java/anticope/rejects/settings/StringMapSetting.java @@ -72,9 +72,9 @@ public class StringMapSetting extends Setting> { protected Map load(NbtCompound tag) { get().clear(); - NbtCompound valueTag = tag.getCompound("map"); + NbtCompound valueTag = tag.getCompound("map").orElse(new NbtCompound()); for (String key : valueTag.getKeys()) { - get().put(key, valueTag.getString(key)); + get().put(key, valueTag.getString(key).orElse("")); } return get(); diff --git a/src/main/java/anticope/rejects/utils/GiveUtils.java b/src/main/java/anticope/rejects/utils/GiveUtils.java index 22065c8..d19ad76 100644 --- a/src/main/java/anticope/rejects/utils/GiveUtils.java +++ b/src/main/java/anticope/rejects/utils/GiveUtils.java @@ -28,7 +28,7 @@ import java.util.function.Function; import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; -import org.apache.commons.lang3.text.WordUtils; +import org.apache.commons.text.WordUtils; import org.apache.commons.lang3.tuple.Triple; import static meteordevelopment.meteorclient.MeteorClient.mc; @@ -41,37 +41,47 @@ public class GiveUtils { private final static SimpleCommandExceptionType NO_SPACE = new SimpleCommandExceptionType(Text.literal("No space in hotbar.")); private static final List HIDDEN_ENTITIES = Arrays.asList( - Identifier.of("giant"), - Identifier.of("ender_dragon"), - Identifier.of("wither"), - Identifier.of("iron_golem"), - Identifier.of("ender_dragon"), - Identifier.of("tnt_minecart"), - Identifier.of("lightning_bolt")); + Identifier.of("giant"), + Identifier.of("ender_dragon"), + Identifier.of("wither"), + Identifier.of("iron_golem"), + Identifier.of("ender_dragon"), + Identifier.of("tnt_minecart"), + Identifier.of("lightning_bolt")); // Some ported from: https://github.com/BleachDrinker420/BleachHack/blob/master/BleachHack-Fabric-1.16/src/main/java/bleach/hack/command/commands/CmdGive.java private static final List> ENTITY_PRESETS = Arrays.asList( - Triple.of("pigs_egg", Items.CHICKEN_SPAWN_EGG, "{MaxNearbyEntities:1000,RequiredPlayerRange:100,CustomDisplayTile:1b,DisplayState:{Properties:{hinge:\"left\",half:\"upper\",open:\"true\"},Name:\"minecraft:acacia_door\"},SpawnData:{id:\"minecraft:minecart\"},id:\"minecraft:spawner_minecart\",MaxSpawnDelay:0,Delay:1,MinSpawnDelay:0}"), - Triple.of("end_portal_arrow", Items.ELDER_GUARDIAN_SPAWN_EGG, "{SoundEvent:\"block.end_portal.spawn\",pickup:1b,id:\"minecraft:arrow\"}"), - Triple.of("wither_spawn_arrow", Items.ELDER_GUARDIAN_SPAWN_EGG, "{SoundEvent:\"entity.wither.spawn\",pickup:1b,id:\"minecraft:arrow\"}"), - Triple.of("eg_curse_arrow", Items.ELDER_GUARDIAN_SPAWN_EGG, "{SoundEvent:\"entity.elder_guardian.curse\",pickup:1b,id:\"minecraft:arrow\"}"), - Triple.of("big_slime", Items.SLIME_SPAWN_EGG, "{Size:50,id:\"minecraft:slime\"}"), - Triple.of("particle_area_expand", Items.SKELETON_SPAWN_EGG, "{Particle:\"angry_villager\",Radius:1.0f,RadiusOnUse:1.0f,Duration:10000,id:\"minecraft:area_effect_cloud\",RadiusPerTick:10.0f}"), - Triple.of("armor_stand_spawner_minecart", Items.BAT_SPAWN_EGG, "{SpawnData:{id:\"minecraft:armor_stand\"},id:\"minecraft:spawner_minecart\"}"), - Triple.of("dud_tnt", Items.DROWNED_SPAWN_EGG, "{Fuse:30000,Invulnerable:1b,id:\"minecraft:tnt\"}") + Triple.of("pigs_egg", Items.CHICKEN_SPAWN_EGG, "{MaxNearbyEntities:1000,RequiredPlayerRange:100,CustomDisplayTile:1b,DisplayState:{Properties:{hinge:\"left\",half:\"upper\",open:\"true\"},Name:\"minecraft:acacia_door\"},SpawnData:{id:\"minecraft:minecart\"},id:\"minecraft:spawner_minecart\",MaxSpawnDelay:0,Delay:1,MinSpawnDelay:0}"), + Triple.of("end_portal_arrow", Items.ELDER_GUARDIAN_SPAWN_EGG, "{SoundEvent:\"block.end_portal.spawn\",pickup:1b,id:\"minecraft:arrow\"}"), + Triple.of("wither_spawn_arrow", Items.ELDER_GUARDIAN_SPAWN_EGG, "{SoundEvent:\"entity.wither.spawn\",pickup:1b,id:\"minecraft:arrow\"}"), + Triple.of("eg_curse_arrow", Items.ELDER_GUARDIAN_SPAWN_EGG, "{SoundEvent:\"entity.elder_guardian.curse\",pickup:1b,id:\"minecraft:arrow\"}"), + Triple.of("big_slime", Items.SLIME_SPAWN_EGG, "{Size:50,id:\"minecraft:slime\"}"), + Triple.of("particle_area_expand", Items.SKELETON_SPAWN_EGG, "{Particle:\"angry_villager\",Radius:1.0f,RadiusOnUse:1.0f,Duration:10000,id:\"minecraft:area_effect_cloud\",RadiusPerTick:10.0f}"), + Triple.of("armor_stand_spawner_minecart", Items.BAT_SPAWN_EGG, "{SpawnData:{id:\"minecraft:armor_stand\"},id:\"minecraft:spawner_minecart\"}"), + Triple.of("dud_tnt", Items.DROWNED_SPAWN_EGG, "{Fuse:30000,Invulnerable:1b,id:\"minecraft:tnt\"}") ); private static final List> BLOCK_PRESETS = Arrays.asList( - Triple.of("lag_spawner", Items.SPAWNER, "{MaxNearbyEntities:32767,RequiredPlayerRange:32767,SpawnCount:50,MaxSpawnDelay:0,id:\"minecraft:spawner\",SpawnRange:32767,Delay:0,MinSpawnDelay:0}"), - Triple.of("tnt_spawner", Items.SPAWNER, "{MaxNearbyEntities:32767,RequiredPlayerRange:32767,SpawnCount:50,SpawnData:{entity:{id:\"minecraft:tnt\",fuse:1}},MaxSpawnDelay:0,id:\"minecraft:mob_spawner\",SpawnRange:10,Delay:0,MinSpawnDelay:0}"), - Triple.of("boat_spawner", Items.SPAWNER, "{SpawnCount:50,SpawnData:{entity:{Type:\"jungle\",CustomName:'{\"bold\":true,\"color\":\"aqua\",\"italic\":true,\"text\":\"Boat\",\"underlined\":true}',Invulnerable:1b,id:\"minecraft:boat\",Glowing:1b,CustomNameVisible:1b}},id:\"minecraft:spawner\",SpawnRange:10}") + Triple.of("lag_spawner", Items.SPAWNER, "{MaxNearbyEntities:32767,RequiredPlayerRange:32767,SpawnCount:50,MaxSpawnDelay:0,id:\"minecraft:spawner\",SpawnRange:32767,Delay:0,MinSpawnDelay:0}"), + Triple.of("tnt_spawner", Items.SPAWNER, "{MaxNearbyEntities:32767,RequiredPlayerRange:32767,SpawnCount:50,SpawnData:{entity:{id:\"minecraft:tnt\",fuse:1}},MaxSpawnDelay:0,id:\"minecraft:mob_spawner\",SpawnRange:10,Delay:0,MinSpawnDelay:0}"), + Triple.of("boat_spawner", Items.SPAWNER, "{SpawnCount:50,SpawnData:{entity:{Type:\"jungle\",CustomName:'{\"bold\":true,\"color\":\"aqua\",\"italic\":true,\"text\":\"Boat\",\"underlined\":true}',Invulnerable:1b,id:\"minecraft:boat\",Glowing:1b,CustomNameVisible:1b}},id:\"minecraft:spawner\",SpawnRange:10}") ); private static final Random random = new Random(); private static Registry enchantmentRegistry; + private static NbtCompound parseNbtString(String nbtString) { + try { + return StringNbtReader.readCompound(nbtString); + } catch (CommandSyntaxException e) { + return new NbtCompound(); + } + } + public static void giveItem(ItemStack item) throws CommandSyntaxException { - if (!mc.player.getAbilities().creativeMode) throw NOT_IN_CREATIVE.create(); + if (mc.player == null || !mc.player.getAbilities().creativeMode) { + throw NOT_IN_CREATIVE.create(); + } if (!mc.player.getInventory().insertStack(item)) { throw NO_SPACE.create(); @@ -79,56 +89,62 @@ public class GiveUtils { } static { - ENTITY_PRESETS.forEach((preset) -> { - PRESETS.put(preset.getLeft(), (preview) -> { - if (preview) preset.getMiddle().getDefaultStack(); - ItemStack item = preset.getMiddle().getDefaultStack(); - try { - item.set(DataComponentTypes.ENTITY_DATA, NbtComponent.of(StringNbtReader.parse(preset.getRight()))); - } catch (CommandSyntaxException e) { } - item.set(DataComponentTypes.CUSTOM_NAME, Text.literal(toName(preset.getLeft()))); - return item; - }); - }); + ENTITY_PRESETS.forEach((preset) -> PRESETS.put(preset.getLeft(), (preview) -> { + if (preview) return preset.getMiddle().getDefaultStack(); + ItemStack item = preset.getMiddle().getDefaultStack(); - BLOCK_PRESETS.forEach((preset) -> { - PRESETS.put(preset.getLeft(), (preview) -> { - if (preview) preset.getMiddle().getDefaultStack(); - ItemStack item = preset.getMiddle().getDefaultStack(); - try { - item.set(DataComponentTypes.BLOCK_ENTITY_DATA, NbtComponent.of(StringNbtReader.parse(preset.getRight()))); - } catch (CommandSyntaxException e) { } - item.set(DataComponentTypes.CUSTOM_NAME, Text.literal(toName(preset.getLeft()))); - return item; - }); - }); + var changes = ComponentChanges.builder() + .add(DataComponentTypes.CUSTOM_DATA, NbtComponent.of(parseNbtString(preset.getRight()))) + .add(DataComponentTypes.CUSTOM_NAME, Text.literal(toName(preset.getLeft()))) + .build(); + item.applyChanges(changes); + + return item; + })); + + BLOCK_PRESETS.forEach((preset) -> PRESETS.put(preset.getLeft(), (preview) -> { + if (preview) return preset.getMiddle().getDefaultStack(); + ItemStack item = preset.getMiddle().getDefaultStack(); + + var changes = ComponentChanges.builder() + .add(DataComponentTypes.CUSTOM_DATA, NbtComponent.of(parseNbtString(preset.getRight()))) + .add(DataComponentTypes.CUSTOM_NAME, Text.literal(toName(preset.getLeft()))) + .build(); + item.applyChanges(changes); + + return item; + })); // TODO update PRESETS.put("force_op", (preview) -> { - if (preview) Items.SPIDER_SPAWN_EGG.getDefaultStack(); + if (preview) return Items.SPIDER_SPAWN_EGG.getDefaultStack(); + if (mc.player == null) return Items.SPIDER_SPAWN_EGG.getDefaultStack(); + ItemStack item = Items.SPIDER_SPAWN_EGG.getDefaultStack(); String nick = mc.player.getName().getString(); - try { - item.set(DataComponentTypes.ENTITY_DATA, NbtComponent.of(StringNbtReader.parse("{Time:1,BlockState:{Name:\"minecraft:spawner\"},id:\"minecraft:falling_block\",TileEntityData:{SpawnCount:20,SpawnData:{id:\"minecraft:villager\",Passengers:[{Time:1,BlockState:{Name:\"minecraft:redstone_block\"},id:\"minecraft:falling_block\",Passengers:[{id:\"minecraft:fox\",Passengers:[{Time:1,BlockState:{Name:\"minecraft:activator_rail\"},id:\"minecraft:falling_block\",Passengers:[{Command:\"execute as @e run op "+nick+"\",id:\"minecraft:command_block_minecart\"}]}],NoAI:1b,Health:1.0f,ActiveEffects:[{Duration:1000,Id:20b,Amplifier:4b}]}]}],NoAI:1b,Health:1.0f,ActiveEffects:[{Duration:1000,Id:20b,Amplifier:4b}]},MaxSpawnDelay:100,SpawnRange:10,Delay:1,MinSpawnDelay:100}}"))); - } catch (CommandSyntaxException e) { } - item.set(DataComponentTypes.CUSTOM_NAME, Text.of("Force OP")); + var changes = ComponentChanges.builder() + .add(DataComponentTypes.CUSTOM_DATA, NbtComponent.of(parseNbtString("{Time:1,BlockState:{Name:\"minecraft:spawner\"},id:\"minecraft:falling_block\",TileEntityData:{SpawnCount:20,SpawnData:{id:\"minecraft:villager\",Passengers:[{Time:1,BlockState:{Name:\"minecraft:redstone_block\"},id:\"minecraft:falling_block\",Passengers:[{id:\"minecraft:fox\",Passengers:[{Time:1,BlockState:{Name:\"minecraft:activator_rail\"},id:\"minecraft:falling_block\",Passengers:[{Command:\"execute as @e run op "+nick+"\",id:\"minecraft:command_block_minecart\"}]}],NoAI:1b,Health:1.0f,ActiveEffects:[{Duration:1000,Id:20b,Amplifier:4b}]}]}],NoAI:1b,Health:1.0f,ActiveEffects:[{Duration:1000,Id:20b,Amplifier:4b}]},MaxSpawnDelay:100,SpawnRange:10,Delay:1,MinSpawnDelay:100}}"))) + .add(DataComponentTypes.CUSTOM_NAME, Text.of("Force OP")) + .build(); + item.applyChanges(changes); + return item; }); // Thanks wurst ! PRESETS.put("troll_potion", (preview) -> { - if (preview) Items.LINGERING_POTION.getDefaultStack(); + if (preview) return Items.LINGERING_POTION.getDefaultStack(); ItemStack stack = Items.LINGERING_POTION.getDefaultStack(); ArrayList effects = new ArrayList<>(); for(int i = 1; i <= 31; i++) { - StatusEffect effect = - Registries.STATUS_EFFECT.getEntry(i).get().value(); - RegistryEntry entry = - Registries.STATUS_EFFECT.getEntry(effect); - effects.add(new StatusEffectInstance(entry, Integer.MAX_VALUE, - Integer.MAX_VALUE)); + Optional> effectOpt = Registries.STATUS_EFFECT.getEntry(i); + if (effectOpt.isPresent()) { + StatusEffect effect = effectOpt.get().value(); + RegistryEntry entry = Registries.STATUS_EFFECT.getEntry(effect); + effects.add(new StatusEffectInstance(entry, Integer.MAX_VALUE, Integer.MAX_VALUE)); + } } stack.set(DataComponentTypes.POTION_CONTENTS, new PotionContentsComponent(Optional.empty(), Optional.empty(), @@ -138,7 +154,9 @@ public class GiveUtils { }); PRESETS.put("32k", (preview) -> { - enchantmentRegistry = mc.world.getRegistryManager().getOrThrow(RegistryKeys.ENCHANTMENT); + if (mc.world != null) { + enchantmentRegistry = mc.world.getRegistryManager().getOrThrow(RegistryKeys.ENCHANTMENT); + } if (preview || enchantmentRegistry == null) return Items.DIAMOND_SWORD.getDefaultStack(); ItemStack stack = Items.DIAMOND_SWORD.getDefaultStack(); @@ -191,23 +209,21 @@ public class GiveUtils { return firework; }); - HIDDEN_ENTITIES.forEach((id) -> { - PRESETS.put(id.getPath()+"_spawn_egg", (preview) -> { - if (preview) return Items.PIG_SPAWN_EGG.getDefaultStack(); - ItemStack egg = Items.PIG_SPAWN_EGG.getDefaultStack(); + HIDDEN_ENTITIES.forEach((id) -> PRESETS.put(id.getPath()+"_spawn_egg", (preview) -> { + if (preview) return Items.PIG_SPAWN_EGG.getDefaultStack(); + ItemStack egg = Items.PIG_SPAWN_EGG.getDefaultStack(); - NbtCompound entityTag = new NbtCompound(); - entityTag.putString("id", id.toString()); + NbtCompound entityTag = new NbtCompound(); + entityTag.putString("id", id.toString()); - var changes = ComponentChanges.builder() - .add(DataComponentTypes.CUSTOM_NAME, Text.literal(String.format("%s", toName(id.getPath())))) - .add(DataComponentTypes.ENTITY_DATA, NbtComponent.of(entityTag)) - .build(); + var changes = ComponentChanges.builder() + .add(DataComponentTypes.CUSTOM_NAME, Text.literal(String.format("%s", toName(id.getPath())))) + .add(DataComponentTypes.CUSTOM_DATA, NbtComponent.of(entityTag)) + .build(); - egg.applyChanges(changes); - return egg; - }); - }); + egg.applyChanges(changes); + return egg; + })); } public static ItemStack getPreset(String name, boolean preview) { @@ -222,4 +238,4 @@ public class GiveUtils { return WordUtils.capitalizeFully(id.toString().replace("_", " ")); } -} +} \ No newline at end of file diff --git a/src/main/java/anticope/rejects/utils/RejectsConfig.java b/src/main/java/anticope/rejects/utils/RejectsConfig.java index e8cca6b..7b06291 100644 --- a/src/main/java/anticope/rejects/utils/RejectsConfig.java +++ b/src/main/java/anticope/rejects/utils/RejectsConfig.java @@ -80,16 +80,22 @@ public class RejectsConfig extends System { @Override public RejectsConfig fromTag(NbtCompound tag) { - httpAllowed = HttpAllowed.valueOf(tag.getString("httpAllowed")); - httpUserAgent = tag.getString("httpUserAgent"); - loadSystemFonts = tag.getBoolean("loadSystemFonts"); - duplicateModuleNames = tag.getBoolean("duplicateModuleNames"); + tag.getString("httpAllowed").ifPresent(s -> { + try { + httpAllowed = HttpAllowed.valueOf(s); + } catch (IllegalArgumentException ignored) {} + }); - NbtList valueTag = tag.getList("hiddenModules", 8); - for (NbtElement tagI : valueTag) { - hiddenModules.add(tagI.asString()); - } + httpUserAgent = tag.getString("httpUserAgent").orElse("Meteor Client"); + loadSystemFonts = tag.getBoolean("loadSystemFonts").orElse(true); + duplicateModuleNames = tag.getBoolean("duplicateModuleNames").orElse(false); + + tag.getList("hiddenModules").ifPresent(valueTag -> { + for (NbtElement tagI : valueTag) { + tagI.asString().ifPresent(hiddenModules::add); + } + }); return this; } -} +} \ No newline at end of file diff --git a/src/main/java/anticope/rejects/utils/accounts/CustomYggdrasilAccount.java b/src/main/java/anticope/rejects/utils/accounts/CustomYggdrasilAccount.java index 83caa47..dba8843 100644 --- a/src/main/java/anticope/rejects/utils/accounts/CustomYggdrasilAccount.java +++ b/src/main/java/anticope/rejects/utils/accounts/CustomYggdrasilAccount.java @@ -3,13 +3,14 @@ package anticope.rejects.utils.accounts; import anticope.rejects.MeteorRejectsAddon; import com.mojang.authlib.exceptions.AuthenticationException; import com.mojang.authlib.minecraft.MinecraftSessionService; -import meteordevelopment.meteorclient.mixin.MinecraftClientAccessor; import meteordevelopment.meteorclient.systems.accounts.Account; import meteordevelopment.meteorclient.systems.accounts.AccountType; import meteordevelopment.meteorclient.utils.misc.NbtException; import net.minecraft.client.session.Session; import net.minecraft.nbt.NbtCompound; +import java.net.Proxy; + import static meteordevelopment.meteorclient.MeteorClient.mc; public class CustomYggdrasilAccount extends Account { @@ -38,9 +39,9 @@ public class CustomYggdrasilAccount extends Account { @Override public boolean login() { try { - CustomYggdrasilLogin.LocalYggdrasilAuthenticationService service = new CustomYggdrasilLogin.LocalYggdrasilAuthenticationService(((MinecraftClientAccessor) mc).getProxy(), server); + CustomYggdrasilLogin.LocalYggdrasilAuthenticationService service = new CustomYggdrasilLogin.LocalYggdrasilAuthenticationService(Proxy.NO_PROXY, server); MinecraftSessionService sessService = new CustomYggdrasilLogin.LocalYggdrasilMinecraftSessionService(service, service.server); - applyLoginEnvironment(service, sessService); + applyLoginEnvironment(service); Session session = CustomYggdrasilLogin.login(name, password, server); setSession(session); @@ -70,8 +71,8 @@ public class CustomYggdrasilAccount extends Account { super.fromTag(tag); if (!tag.contains("password")) throw new NbtException(); - password = tag.getString("password"); - server = tag.getString("server"); + password = tag.getString("password").orElse(""); + server = tag.getString("server").orElse(""); return this; } @@ -81,4 +82,4 @@ public class CustomYggdrasilAccount extends Account { if (!(o instanceof CustomYggdrasilAccount)) return false; return ((CustomYggdrasilAccount) o).name.equals(this.name); } -} +} \ No newline at end of file diff --git a/src/main/java/anticope/rejects/utils/accounts/CustomYggdrasilLogin.java b/src/main/java/anticope/rejects/utils/accounts/CustomYggdrasilLogin.java index c505df3..3264036 100644 --- a/src/main/java/anticope/rejects/utils/accounts/CustomYggdrasilLogin.java +++ b/src/main/java/anticope/rejects/utils/accounts/CustomYggdrasilLogin.java @@ -27,7 +27,8 @@ import java.util.*; import static meteordevelopment.meteorclient.MeteorClient.mc; public class CustomYggdrasilLogin { - public static Environment localYggdrasilApi = new Environment("/sessionserver", "/minecraftservices", "Custom-Yggdrasil"); + // Environment constructor now requires 4 parameters: authHost, accountsHost, sessionHost, name + public static Environment localYggdrasilApi = new Environment("", "/authserver", "/sessionserver", "Custom-Yggdrasil"); public static Session login(String name, String password, String server) throws AuthenticationException { try { @@ -42,6 +43,10 @@ public class CustomYggdrasilLogin { root.addProperty("password", password); String data = Http.post(url).bodyJson(root).sendString(); + if (data == null || data.isEmpty()) { + throw new AuthenticationException("Received null or empty response from authentication server"); + } + JsonObject json = JsonParser.parseString(data).getAsJsonObject(); if (json.has("error")) { throw new AuthenticationException(json.get("errorMessage").getAsString()); @@ -49,7 +54,10 @@ public class CustomYggdrasilLogin { String token = json.get("accessToken").getAsString(); UUID uuid = UUID.fromString(json.get("selectedProfile").getAsJsonObject().get("id").getAsString()); String username = json.get("selectedProfile").getAsJsonObject().get("name").getAsString(); - return new Session(username, uuid, token, Optional.empty(), Optional.empty(), Session.AccountType.MOJANG); + + return new Session(username, uuid, token, Optional.empty(), Optional.empty()); + } catch (AuthenticationException e) { + throw e; } catch (Exception e) { throw new AuthenticationException(e); } @@ -62,9 +70,25 @@ public class CustomYggdrasilLogin { public LocalYggdrasilMinecraftSessionService(YggdrasilAuthenticationService service, String serverUrl) { super(service.getServicesKeySet(), mc.getNetworkProxy(), localYggdrasilApi); - String data = Http.get(serverUrl).sendString(); - JsonObject json = JsonParser.parseString(data).getAsJsonObject(); - this.publicKey = getPublicKey(json.get("signaturePublickey").getAsString()); + ServicesKeyInfo tempKey = null; + + try { + String data = Http.get(serverUrl).sendString(); + if (data != null && !data.isEmpty()) { + JsonObject json = JsonParser.parseString(data).getAsJsonObject(); + if (json.has("signaturePublickey")) { + tempKey = getPublicKey(json.get("signaturePublickey").getAsString()); + } else { + LOGGER.warn("No signaturePublickey found in response"); + } + } else { + LOGGER.warn("Received null or empty response from server"); + } + } catch (Exception e) { + LOGGER.error("Failed to fetch or parse public key", e); + } + + this.publicKey = tempKey; } private static ServicesKeyInfo getPublicKey(String key) { @@ -73,16 +97,16 @@ public class CustomYggdrasilLogin { byte[] byteKey = Base64.getDecoder().decode(key.replace("\n", "")); return YggdrasilServicesKeyInfo.parse(byteKey); } catch (IllegalArgumentException e) { - e.printStackTrace(); + LOGGER.error("Failed to parse public key", e); + return null; } - return null; } private SignatureState getPropertySignatureState(final Property property) { if (!property.hasSignature()) { return SignatureState.UNSIGNED; } - if (!publicKey.validateProperty(property)) { + if (publicKey != null && !publicKey.validateProperty(property)) { return SignatureState.INVALID; } return SignatureState.SIGNED; @@ -91,7 +115,7 @@ public class CustomYggdrasilLogin { @Override public MinecraftProfileTextures unpackTextures(final Property packedTextures) { final String value = packedTextures.value(); - final SignatureState signatureState = getPropertySignatureState(packedTextures); + final SignatureState signatureState = getPropertySignatureState(packedTextures); final MinecraftTexturesPayload result; try { @@ -125,5 +149,4 @@ public class CustomYggdrasilLogin { this.server = server; } } - -} +} \ No newline at end of file diff --git a/src/main/java/anticope/rejects/utils/seeds/Seed.java b/src/main/java/anticope/rejects/utils/seeds/Seed.java index d842143..96a30c6 100644 --- a/src/main/java/anticope/rejects/utils/seeds/Seed.java +++ b/src/main/java/anticope/rejects/utils/seeds/Seed.java @@ -28,8 +28,8 @@ public class Seed { public static Seed fromTag(NbtCompound tag) { return new Seed( - tag.getLong("seed"), - MCVersion.fromString(tag.getString("version")) + tag.getLong("seed").orElse(0L), + MCVersion.fromString(tag.getString("version").orElse("unknown")) ); } @@ -41,12 +41,10 @@ public class Seed { version.toString() )); text.setStyle(text.getStyle() - .withClickEvent(new ClickEvent( - ClickEvent.Action.COPY_TO_CLIPBOARD, + .withClickEvent(new ClickEvent.CopyToClipboard( seed.toString() )) - .withHoverEvent(new HoverEvent( - HoverEvent.Action.SHOW_TEXT, + .withHoverEvent(new HoverEvent.ShowText( Text.literal("Copy to clipboard") )) ); diff --git a/src/main/java/anticope/rejects/utils/seeds/Seeds.java b/src/main/java/anticope/rejects/utils/seeds/Seeds.java index 4f56112..7a1d069 100644 --- a/src/main/java/anticope/rejects/utils/seeds/Seeds.java +++ b/src/main/java/anticope/rejects/utils/seeds/Seeds.java @@ -83,7 +83,7 @@ public class Seeds extends System { @Override public Seeds fromTag(NbtCompound tag) { tag.getKeys().forEach(key -> { - seeds.put(key, Seed.fromTag(tag.getCompound(key))); + seeds.put(key, Seed.fromTag(tag.getCompound(key).orElse(new NbtCompound()))); }); return this; } @@ -103,8 +103,8 @@ public class Seeds extends System { MutableText cmdText = Text.literal(cmd+""); cmdText.setStyle(cmdText.getStyle() .withUnderline(true) - .withClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, cmd)) - .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Text.literal("run command"))) + .withClickEvent(new ClickEvent.SuggestCommand(cmd)) + .withHoverEvent(new HoverEvent.ShowText(Text.literal("run command"))) ); msg.append(cmdText); msg.setStyle(msg.getStyle() diff --git a/src/main/java/anticope/rejects/utils/server/MServerInfo.java b/src/main/java/anticope/rejects/utils/server/MServerInfo.java index bc4f29c..388e46f 100644 --- a/src/main/java/anticope/rejects/utils/server/MServerInfo.java +++ b/src/main/java/anticope/rejects/utils/server/MServerInfo.java @@ -15,7 +15,7 @@ public class MServerInfo { public int playercountMax; public String label; public long ping; - public int protocolVersion = SharedConstants.getGameVersion().getProtocolVersion(); + public int protocolVersion = SharedConstants.getProtocolVersion(); public String version = null; public List playerListSummary = Collections.emptyList(); private byte @Nullable [] icon; diff --git a/src/main/resources/meteor-rejects.mixins.json b/src/main/resources/meteor-rejects.mixins.json index da932cb..4d3456c 100644 --- a/src/main/resources/meteor-rejects.mixins.json +++ b/src/main/resources/meteor-rejects.mixins.json @@ -4,11 +4,11 @@ "compatibilityLevel": "JAVA_21", "client": [ "ClientCommonNetwokHandlerMixin", + "ClientPlayerEntityAccessor", "ClientPlayerInteractionManagerMixin", "ClientPlayNetworkHandlerMixin", "CommandSuggestorMixin", "CountPlacementModifierAccessor", - "Deadmau5FeatureRendererMixin", "EntityAccessor", "GameRendererMixin", "HandshakeC2SPacketAccessor", @@ -19,11 +19,11 @@ "MultiplayerScreenAccessor", "MultiplayerScreenMixin", "PlayerEntityMixin", + "PlayerInventoryAccessor", "PlayerMoveC2SPacketAccessor", "RarityFilterPlacementModifierAccessor", "ServerListAccessor", "StructureVoidBlockMixin", - "TexturedRenderLayersMixin", "ToastManagerMixin", "VehicleMoveC2SPacketAccessor", "baritone.MineProcessMixin" @@ -31,4 +31,4 @@ "injectors": { "defaultRequire": 1 } -} +} \ No newline at end of file