From 4cc4104d9412f983fcd3edff75e13ec1bbff1c41 Mon Sep 17 00:00:00 2001 From: MineGame159 Date: Fri, 8 Dec 2023 14:20:32 +0100 Subject: [PATCH] Revert "1.20.4 update (#4249)" This reverts commit b0a927bafc077e9850d6a0d87710ff194c0ac7d4. --- build.gradle | 23 +- gradle.properties | 21 +- .../arguments/FakePlayerArgumentType.java | 2 +- .../arguments/PlayerArgumentType.java | 4 +- .../commands/commands/FakePlayerCommand.java | 4 +- .../commands/commands/SwarmCommand.java | 4 +- .../meteorclient/gui/GuiThemes.java | 8 +- .../gui/widgets/WItemWithLabel.java | 8 +- .../mixin/BookEditScreenMixin.java | 7 +- .../mixin/CapeFeatureRendererMixin.java | 2 +- .../mixin/ConnectScreenMixin.java | 2 +- .../mixin/DisconnectedScreenMixin.java | 2 +- .../mixin/ElytraFeatureRendererMixin.java | 2 +- .../meteorclient/mixin/GameRendererMixin.java | 4 +- .../mixin/LivingEntityRendererMixin.java | 5 +- .../mixin/RaycastContextMixin.java | 4 +- .../meteorclient/mixin/RegistriesMixin.java | 21 -- .../mixin/SimpleRegistryMixin.java | 22 ++ .../ChunkAwareBlockCollisionSweeperMixin.java | 2 +- .../sodium/SodiumBiomeColorCacheMixin.java | 6 +- .../sodium/SodiumFluidRendererMixin.java | 7 +- .../meteorclient/renderer/GL.java | 4 +- .../meteorclient/settings/BoolSetting.java | 3 +- .../meteorclient/settings/ColorSetting.java | 3 +- .../meteorclient/systems/System.java | 4 +- .../systems/accounts/Account.java | 6 +- .../systems/accounts/types/EasyMCAccount.java | 2 +- .../accounts/types/TheAlteningAccount.java | 4 +- .../meteorclient/systems/friends/Friend.java | 2 +- .../meteorclient/systems/friends/Friends.java | 2 +- .../systems/hud/elements/CombatHud.java | 2 +- .../systems/hud/elements/PlayerRadarHud.java | 4 +- .../systems/hud/elements/PotionTimersHud.java | 2 +- .../meteorclient/systems/modules/Modules.java | 5 +- .../systems/modules/misc/DiscordPresence.java | 8 +- .../systems/modules/misc/MessageAura.java | 2 +- .../systems/modules/misc/Notifier.java | 10 +- .../systems/modules/misc/ServerSpoof.java | 4 +- .../systems/modules/player/AutoTool.java | 4 +- .../systems/modules/player/FakePlayer.java | 2 +- .../modules/player/MiddleClickExtra.java | 6 +- .../modules/render/BetterTooltips.java | 6 +- .../systems/modules/render/EntityOwner.java | 2 +- .../systems/modules/render/LogoutSpots.java | 2 +- .../systems/modules/render/Nametags.java | 4 +- .../systems/modules/world/Flamethrower.java | 2 +- .../systems/modules/world/Nuker.java | 4 +- .../systems/modules/world/VeinMiner.java | 5 +- .../utils/entity/EntityUtils.java | 2 +- .../entity/fakeplayer/FakePlayerManager.java | 4 +- .../meteorclient/utils/misc/NbtUtils.java | 7 +- .../utils/misc/ValueComparableMap.java | 18 +- .../utils/network/PacketUtils.java | 116 +++++----- .../utils/network/PacketUtilsUtil.java | 211 +++++++++--------- .../utils/player/TitleScreenCredits.java | 63 ++++-- src/main/resources/fabric.mod.json | 5 +- src/main/resources/meteor-client.mixins.json | 2 +- 57 files changed, 360 insertions(+), 332 deletions(-) delete mode 100644 src/main/java/meteordevelopment/meteorclient/mixin/RegistriesMixin.java create mode 100644 src/main/java/meteordevelopment/meteorclient/mixin/SimpleRegistryMixin.java diff --git a/build.gradle b/build.gradle index 17cc649a38..3d97ca35a7 100644 --- a/build.gradle +++ b/build.gradle @@ -58,7 +58,7 @@ dependencies { modCompileOnly("maven.modrinth:indium:${project.indium_version}") { transitive = false } // Baritone (https://github.com/MeteorDevelopment/baritone) - modCompileOnly "meteordevelopment:baritone:${project.baritone_version}-SNAPSHOT" + modCompileOnly "meteordevelopment:baritone:${project.minecraft_version}-SNAPSHOT" // Libraries library "meteordevelopment:orbit:${project.orbit_version}" @@ -67,6 +67,8 @@ dependencies { library "org.reflections:reflections:${project.reflections_version}" library("io.netty:netty-handler-proxy:${project.netty_version}") { transitive = false } library("io.netty:netty-codec-socks:${project.netty_version}") { transitive = false } + library "io.github.llamalad7:mixinextras-fabric:${project.mixin_extras_version}" + annotationProcessor "io.github.llamalad7:mixinextras-fabric:${project.mixin_extras_version}" library "de.florianmichael:WaybackAuthLib:1.0.0" // Launch sub project @@ -94,24 +96,17 @@ shadowJar { } processResources { - def propertyMap = [ - "version" : project.version, - "devbuild" : project.findProperty("devbuild") ?: "", - "commit" : project.findProperty("commit") ?: "", - "minecraft_version": project.minecraft_version, - "loader_version" : project.loader_version - ] - - inputs.properties(propertyMap) filesMatching("fabric.mod.json") { - expand(propertyMap) + expand "version": project.version, + "devbuild": project.findProperty("devbuild") ?: "", + "commit": project.findProperty("commit") ?: "", + "minecraft_version": project.minecraft_version, + "loader_version": project.loader_version } } jar { - from("LICENSE") { - rename { "${it}_${archivesBaseName}" } - } + from "LICENSE" manifest { attributes("Main-Class": "meteordevelopment.meteorclient.Main") diff --git a/gradle.properties b/gradle.properties index cd6681815d..28c426c625 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,30 +1,26 @@ org.gradle.jvmargs=-Xmx2G # Fabric (https://fabricmc.net/develop) -# TODO: when updating to 1.21, revert "minecraft": ["1.20.3", "1.20.4"] to "minecraft": "${minecraft_version}" -minecraft_version=1.20.4 -yarn_mappings=1.20.4+build.1 -loader_version=0.15.0 -fapi_version=0.91.1+1.20.4 +minecraft_version=1.20.2 +yarn_mappings=1.20.2+build.4 +loader_version=0.14.24 +fapi_version=0.90.4+1.20.2 # Mod Properties -mod_version=0.5.6 +mod_version=0.5.5 maven_group=meteordevelopment archives_base_name=meteor-client # Dependency Versions -# Baritone (https://github.com/MeteorDevelopment/baritone) -baritone_version=1.20.2 - # Sodium (https://github.com/CaffeineMC/sodium-fabric) -sodium_version=mc1.20.3-0.5.4 +sodium_version=mc1.20.2-0.5.3 # Lithium (https://github.com/CaffeineMC/lithium-fabric) lithium_version=mc1.20.2-0.12.0 # Iris (https://github.com/IrisShaders/Iris) -iris_version=1.6.12+1.20.3 +iris_version=1.6.10+1.20.2 # Orbit (https://github.com/MeteorDevelopment/orbit) orbit_version=0.2.3 @@ -41,5 +37,8 @@ reflections_version=0.10.2 # Netty (https://github.com/netty/netty) netty_version=4.1.90.Final +# Mixin Extras (https://github.com/LlamaLad7/MixinExtras) +mixin_extras_version=0.2.0 + # Indium (https://github.com/comp500/Indium) indium_version=1.0.27+mc1.20.1 diff --git a/src/main/java/meteordevelopment/meteorclient/commands/arguments/FakePlayerArgumentType.java b/src/main/java/meteordevelopment/meteorclient/commands/arguments/FakePlayerArgumentType.java index 2ba92b3409..fde62bb80d 100644 --- a/src/main/java/meteordevelopment/meteorclient/commands/arguments/FakePlayerArgumentType.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/arguments/FakePlayerArgumentType.java @@ -38,7 +38,7 @@ public String parse(StringReader reader) throws CommandSyntaxException { @Override public CompletableFuture listSuggestions(CommandContext context, SuggestionsBuilder builder) { - return suggestMatching(FakePlayerManager.stream().map(fakePlayerEntity -> fakePlayerEntity.getName().getString()), builder); + return suggestMatching(FakePlayerManager.stream().map(FakePlayerEntity::getEntityName), builder); } @Override diff --git a/src/main/java/meteordevelopment/meteorclient/commands/arguments/PlayerArgumentType.java b/src/main/java/meteordevelopment/meteorclient/commands/arguments/PlayerArgumentType.java index 10472f55c6..b9ebc0b1e6 100644 --- a/src/main/java/meteordevelopment/meteorclient/commands/arguments/PlayerArgumentType.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/arguments/PlayerArgumentType.java @@ -41,7 +41,7 @@ public PlayerEntity parse(StringReader reader) throws CommandSyntaxException { PlayerEntity playerEntity = null; for (PlayerEntity p : mc.world.getPlayers()) { - if (p.getName().getString().equalsIgnoreCase(argument)) { + if (p.getEntityName().equalsIgnoreCase(argument)) { playerEntity = p; break; } @@ -53,7 +53,7 @@ public PlayerEntity parse(StringReader reader) throws CommandSyntaxException { @Override public CompletableFuture listSuggestions(CommandContext context, SuggestionsBuilder builder) { - return CommandSource.suggestMatching(mc.world.getPlayers().stream().map(abstractClientPlayerEntity -> abstractClientPlayerEntity.getName().getString()), builder); + return CommandSource.suggestMatching(mc.world.getPlayers().stream().map(PlayerEntity::getEntityName), builder); } @Override diff --git a/src/main/java/meteordevelopment/meteorclient/commands/commands/FakePlayerCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/FakePlayerCommand.java index 4a05f24d14..122e9a13c6 100644 --- a/src/main/java/meteordevelopment/meteorclient/commands/commands/FakePlayerCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/FakePlayerCommand.java @@ -50,7 +50,7 @@ public void build(LiteralArgumentBuilder builder) { } FakePlayerManager.remove(fp); - info("Removed Fake Player %s.".formatted(fp.getName().getString())); + info("Removed Fake Player %s.".formatted(fp.getEntityName())); return SINGLE_SUCCESS; }) @@ -67,7 +67,7 @@ public void build(LiteralArgumentBuilder builder) { builder.then(literal("list") .executes(context -> { info("--- Fake Players ((highlight)%s(default)) ---", FakePlayerManager.count()); - FakePlayerManager.forEach(fp -> ChatUtils.info("(highlight)%s".formatted(fp.getName().getString()))); + FakePlayerManager.forEach(fp -> ChatUtils.info("(highlight)%s".formatted(fp.getEntityName()))); return SINGLE_SUCCESS; }) ); diff --git a/src/main/java/meteordevelopment/meteorclient/commands/commands/SwarmCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/SwarmCommand.java index 317550eabd..fda2554682 100644 --- a/src/main/java/meteordevelopment/meteorclient/commands/commands/SwarmCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/SwarmCommand.java @@ -104,7 +104,7 @@ else if (swarm.isWorker()) { Swarm swarm = Modules.get().get(Swarm.class); if (swarm.isActive()) { if (swarm.isHost()) { - swarm.host.sendMessage(context.getInput() + " " + mc.player.getName().getString()); + swarm.host.sendMessage(context.getInput() + " " + mc.player.getEntityName()); } else if (swarm.isWorker()) { error("The follow host command must be used by the host."); @@ -124,7 +124,7 @@ else if (swarm.isWorker()) { swarm.host.sendMessage(context.getInput()); } else if (swarm.isWorker() && playerEntity != null) { - PathManagers.get().follow(entity -> entity.getName().getString().equalsIgnoreCase(playerEntity.getName().getString())); + PathManagers.get().follow(entity -> entity.getEntityName().equalsIgnoreCase(playerEntity.getEntityName())); } } else { diff --git a/src/main/java/meteordevelopment/meteorclient/gui/GuiThemes.java b/src/main/java/meteordevelopment/meteorclient/gui/GuiThemes.java index 2b528f16c7..beb6e164c4 100644 --- a/src/main/java/meteordevelopment/meteorclient/gui/GuiThemes.java +++ b/src/main/java/meteordevelopment/meteorclient/gui/GuiThemes.java @@ -35,7 +35,7 @@ public static void init() { public static void postInit() { if (FILE.exists()) { try { - NbtCompound tag = NbtIo.read(FILE.toPath()); + NbtCompound tag = NbtIo.read(FILE); if (tag != null) select(tag.getString("currentTheme")); } catch (IOException e) { @@ -82,7 +82,7 @@ public static void select(String name) { File file = new File(THEMES_FOLDER, get().name + ".nbt"); if (file.exists()) { - NbtCompound tag = NbtIo.read(file.toPath()); + NbtCompound tag = NbtIo.read(file); if (tag != null) get().fromTag(tag); } } catch (IOException e) { @@ -116,7 +116,7 @@ private static void saveTheme() { NbtCompound tag = get().toTag(); THEMES_FOLDER.mkdirs(); - NbtIo.write(tag, new File(THEMES_FOLDER, get().name + ".nbt").toPath()); + NbtIo.write(tag, new File(THEMES_FOLDER, get().name + ".nbt")); } catch (IOException e) { e.printStackTrace(); } @@ -129,7 +129,7 @@ private static void saveGlobal() { tag.putString("currentTheme", get().name); FOLDER.mkdirs(); - NbtIo.write(tag, FILE.toPath()); + NbtIo.write(tag, FILE); } catch (IOException e) { e.printStackTrace(); } diff --git a/src/main/java/meteordevelopment/meteorclient/gui/widgets/WItemWithLabel.java b/src/main/java/meteordevelopment/meteorclient/gui/widgets/WItemWithLabel.java index bc8769b7aa..26d3c4ce85 100644 --- a/src/main/java/meteordevelopment/meteorclient/gui/widgets/WItemWithLabel.java +++ b/src/main/java/meteordevelopment/meteorclient/gui/widgets/WItemWithLabel.java @@ -14,8 +14,6 @@ import java.util.List; -import static meteordevelopment.meteorclient.MeteorClient.mc; - public class WItemWithLabel extends WHorizontalList { private ItemStack itemStack; private String name; @@ -40,13 +38,13 @@ private String getStringToAppend() { if (itemStack.getItem() == Items.POTION) { List effects = PotionUtil.getPotion(itemStack).getEffects(); - if (!effects.isEmpty()) { + if (effects.size() > 0) { str += " "; StatusEffectInstance effect = effects.get(0); - if (effect.getAmplifier() > 0) str += "%d ".formatted(effect.getAmplifier() + 1); + if (effect.getAmplifier() > 0) str += effect.getAmplifier() + 1 + " "; - str += "(%s)".formatted(StatusEffectUtil.getDurationText(effect, 1, mc.world.getTickManager().getTickRate()).getString()); + str += "(" + StatusEffectUtil.getDurationText(effect, 1).getString() + ")"; } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/BookEditScreenMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/BookEditScreenMixin.java index 7468bd62b5..a1a1c95cc2 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/BookEditScreenMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/BookEditScreenMixin.java @@ -9,7 +9,10 @@ import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.ingame.BookEditScreen; import net.minecraft.client.gui.widget.ButtonWidget; -import net.minecraft.nbt.*; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.nbt.NbtIo; +import net.minecraft.nbt.NbtList; +import net.minecraft.nbt.NbtString; import net.minecraft.text.Text; import org.lwjgl.glfw.GLFW; import org.spongepowered.asm.mixin.Final; @@ -84,7 +87,7 @@ private void onInit(CallbackInfo info) { DataInputStream in = new DataInputStream(new ByteArrayInputStream(bytes)); try { - NbtCompound tag = NbtIo.readCompressed(in, NbtTagSizeTracker.ofUnlimitedBytes()); + NbtCompound tag = NbtIo.readCompressed(in); NbtList listTag = tag.getList("pages", 8).copy(); diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/CapeFeatureRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/CapeFeatureRendererMixin.java index 4e9368a904..43751d3d37 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/CapeFeatureRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/CapeFeatureRendererMixin.java @@ -17,7 +17,7 @@ @Mixin(CapeFeatureRenderer.class) public class CapeFeatureRendererMixin { - @ModifyExpressionValue(method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/client/network/AbstractClientPlayerEntity;FFFFFF)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/SkinTextures;capeTexture()Lnet/minecraft/util/Identifier;")) + @ModifyExpressionValue(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/SkinTextures;capeTexture()Lnet/minecraft/util/Identifier;")) private Identifier modifyCapeTexture(Identifier original, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, AbstractClientPlayerEntity abstractClientPlayerEntity, float f, float g, float h, float j, float k, float l) { Identifier id = Capes.get(abstractClientPlayerEntity); return id == null ? original : id; diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ConnectScreenMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ConnectScreenMixin.java index fac824368d..2fd47394c5 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ConnectScreenMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ConnectScreenMixin.java @@ -8,7 +8,7 @@ import meteordevelopment.meteorclient.MeteorClient; import meteordevelopment.meteorclient.events.world.ServerConnectBeginEvent; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.screen.multiplayer.ConnectScreen; +import net.minecraft.client.gui.screen.ConnectScreen; import net.minecraft.client.network.ServerAddress; import net.minecraft.client.network.ServerInfo; import org.spongepowered.asm.mixin.Mixin; diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/DisconnectedScreenMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/DisconnectedScreenMixin.java index 44d87fbacc..3092d3f470 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/DisconnectedScreenMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/DisconnectedScreenMixin.java @@ -7,7 +7,7 @@ import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.misc.AutoReconnect; -import net.minecraft.client.gui.screen.multiplayer.ConnectScreen; +import net.minecraft.client.gui.screen.ConnectScreen; import net.minecraft.client.gui.screen.DisconnectedScreen; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.TitleScreen; diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ElytraFeatureRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ElytraFeatureRendererMixin.java index 4fd5c52c9e..e7c7a5764c 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ElytraFeatureRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ElytraFeatureRendererMixin.java @@ -25,7 +25,7 @@ public ElytraFeatureRendererMixin(FeatureRendererContext context) { super(context); } - @ModifyExpressionValue(method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/entity/LivingEntity;FFFFFF)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/SkinTextures;capeTexture()Lnet/minecraft/util/Identifier;")) + @ModifyExpressionValue(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/SkinTextures;capeTexture()Lnet/minecraft/util/Identifier;")) private Identifier modifyCapeTexture(Identifier original, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, T livingEntity, float f, float g, float h, float j, float k, float l) { if (!(livingEntity instanceof AbstractClientPlayerEntity playerEntity)) return original; diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/GameRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/GameRendererMixin.java index da6f192634..23fe559f8a 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/GameRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/GameRendererMixin.java @@ -53,7 +53,7 @@ public abstract class GameRendererMixin { @Unique private Renderer3D renderer; @Inject(method = "renderWorld", at = @At(value = "INVOKE_STRING", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", args = { "ldc=hand" }), locals = LocalCapture.CAPTURE_FAILEXCEPTION) - private void onRenderWorld(float tickDelta, long limitTime, MatrixStack matrices, CallbackInfo ci, boolean bl, Camera camera, Entity entity, MatrixStack matrixStack, double d, float f, float g, Matrix4f matrix4f, Matrix3f matrix3f) { + private void onRenderWorld(float tickDelta, long limitTime, MatrixStack matrices, CallbackInfo info, boolean bl, Camera camera, MatrixStack matrixStack, double d, float f, float g, Matrix4f matrix4f, Matrix3f matrix3f) { if (!Utils.canUpdate()) return; client.getProfiler().push(MeteorClient.MOD_ID + "_render"); @@ -169,7 +169,7 @@ private void renderHand(MatrixStack matrices, Camera camera, float tickDelta, Ca info.cancel(); } - @ModifyConstant(method = "updateTargetedEntity", constant = @Constant(doubleValue = 6)) + @ModifyConstant(method = "updateTargetedEntity", constant = @Constant(doubleValue = 3)) private double updateTargetedEntityModifySurvivalReach(double d) { return Modules.get().get(Reach.class).entityReach(); } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/LivingEntityRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/LivingEntityRendererMixin.java index a69f012d37..21263b00e1 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/LivingEntityRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/LivingEntityRendererMixin.java @@ -22,7 +22,6 @@ import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.scoreboard.AbstractTeam; -import net.minecraft.scoreboard.Team; import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -67,8 +66,8 @@ public float changePitch(float oldValue, LivingEntity entity) { // Player model rendering in main menu - @ModifyExpressionValue(method = "hasLabel(Lnet/minecraft/entity/LivingEntity;)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;getScoreboardTeam()Lnet/minecraft/scoreboard/Team;")) - private Team hasLabelClientPlayerEntityGetScoreboardTeamProxy(Team team) { + @ModifyExpressionValue(method = "hasLabel(Lnet/minecraft/entity/LivingEntity;)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;getScoreboardTeam()Lnet/minecraft/scoreboard/AbstractTeam;")) + private AbstractTeam hasLabelClientPlayerEntityGetScoreboardTeamProxy(AbstractTeam team) { return (mc.player == null) ? null : team; } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/RaycastContextMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/RaycastContextMixin.java index 659dc3160d..8bd300912b 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/RaycastContextMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/RaycastContextMixin.java @@ -21,7 +21,7 @@ public class RaycastContextMixin implements IRaycastContext { @Shadow @Final @Mutable private Vec3d end; @Shadow @Final @Mutable private RaycastContext.ShapeType shapeType; @Shadow @Final @Mutable private RaycastContext.FluidHandling fluid; - @Shadow @Final @Mutable private ShapeContext shapeContext; + @Shadow @Final @Mutable private ShapeContext entityPosition; @Override public void set(Vec3d start, Vec3d end, RaycastContext.ShapeType shapeType, RaycastContext.FluidHandling fluidHandling, Entity entity) { @@ -29,6 +29,6 @@ public void set(Vec3d start, Vec3d end, RaycastContext.ShapeType shapeType, Rayc this.end = end; this.shapeType = shapeType; this.fluid = fluidHandling; - this.shapeContext = ShapeContext.of(entity); + this.entityPosition = ShapeContext.of(entity); } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/RegistriesMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/RegistriesMixin.java deleted file mode 100644 index 625ec10ba5..0000000000 --- a/src/main/java/meteordevelopment/meteorclient/mixin/RegistriesMixin.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). - * Copyright (c) Meteor Development. - */ - -package meteordevelopment.meteorclient.mixin; - -import net.minecraft.registry.Registries; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; - -import java.util.function.Supplier; - -@Mixin(Registries.class) -public abstract class RegistriesMixin { - @Redirect(method = "create(Lnet/minecraft/registry/RegistryKey;Lnet/minecraft/registry/MutableRegistry;Lnet/minecraft/registry/Registries$Initializer;Lcom/mojang/serialization/Lifecycle;)Lnet/minecraft/registry/MutableRegistry;", at = @At(value = "INVOKE", target = "Lnet/minecraft/Bootstrap;ensureBootstrapped(Ljava/util/function/Supplier;)V")) - private static void ignoreBootstrap(Supplier callerGetter) { - // nothing - } -} diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/SimpleRegistryMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/SimpleRegistryMixin.java new file mode 100644 index 0000000000..aca4582354 --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/mixin/SimpleRegistryMixin.java @@ -0,0 +1,22 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.mixin; + +import net.minecraft.registry.SimpleRegistry; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +import java.util.function.Supplier; + +@Mixin(SimpleRegistry.class) +public class SimpleRegistryMixin { + @Redirect(method = "(Lnet/minecraft/registry/RegistryKey;Lcom/mojang/serialization/Lifecycle;Z)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/Bootstrap;ensureBootstrapped(Ljava/util/function/Supplier;)V")) + private void idk(Supplier callerGetter) { + // TODO: Probably extremely retarded but seems to work + // nothing :trolla: + } +} diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/lithium/ChunkAwareBlockCollisionSweeperMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/lithium/ChunkAwareBlockCollisionSweeperMixin.java index 0152627779..eb15d0e2b1 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/lithium/ChunkAwareBlockCollisionSweeperMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/lithium/ChunkAwareBlockCollisionSweeperMixin.java @@ -21,7 +21,7 @@ @Mixin(value = ChunkAwareBlockCollisionSweeper.class) public abstract class ChunkAwareBlockCollisionSweeperMixin { - @Redirect(method = "computeNext()Lnet/minecraft/util/shape/VoxelShape;", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;getCollisionShape(Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/ShapeContext;)Lnet/minecraft/util/shape/VoxelShape;")) + @Redirect(method = "computeNext", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;getCollisionShape(Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/ShapeContext;)Lnet/minecraft/util/shape/VoxelShape;")) private VoxelShape onComputeNextCollisionBox(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { VoxelShape shape = state.getCollisionShape(world, pos, context); diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/sodium/SodiumBiomeColorCacheMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/sodium/SodiumBiomeColorCacheMixin.java index 39366b697f..3f147c8e58 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/sodium/SodiumBiomeColorCacheMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/sodium/SodiumBiomeColorCacheMixin.java @@ -25,17 +25,17 @@ private void onInit(CallbackInfo info) { ambience = Modules.get().get(Ambience.class); } - @ModifyExpressionValue(method = "updateColorBuffers", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/biome/ColorResolver;getColor(Lnet/minecraft/world/biome/Biome;DD)I", ordinal = 0, remap = true)) + @ModifyExpressionValue(method = "updateColorBuffers", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/biome/Biome;getGrassColorAt(DD)I", remap = true)) private int modify_getGrassColorAt(int color) { return ambience.isActive() && ambience.customGrassColor.get() ? ambience.grassColor.get().getPacked() : color; } - @ModifyExpressionValue(method = "updateColorBuffers", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/biome/ColorResolver;getColor(Lnet/minecraft/world/biome/Biome;DD)I", ordinal = 1, remap = true)) + @ModifyExpressionValue(method = "updateColorBuffers", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/biome/Biome;getFoliageColor()I", remap = true)) private int modify_getFoliageColor(int color) { return ambience.isActive() && ambience.customFoliageColor.get() ? ambience.foliageColor.get().getPacked() : color; } - @ModifyExpressionValue(method = "updateColorBuffers", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/biome/ColorResolver;getColor(Lnet/minecraft/world/biome/Biome;DD)I", ordinal = 2, remap = true)) + @ModifyExpressionValue(method = "updateColorBuffers", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/biome/Biome;getWaterColor()I", remap = true)) private int modify_getWaterColor(int color) { return ambience.isActive() && ambience.customWaterColor.get() ? ambience.waterColor.get().getPacked() : color; } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/sodium/SodiumFluidRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/sodium/SodiumFluidRendererMixin.java index 2ac8a24812..1eb4dbc141 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/sodium/SodiumFluidRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/sodium/SodiumFluidRendererMixin.java @@ -14,7 +14,6 @@ import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.render.Xray; import meteordevelopment.meteorclient.systems.modules.world.Ambience; -import meteordevelopment.meteorclient.utils.render.color.Color; import net.caffeinemc.mods.sodium.api.util.ColorABGR; import net.minecraft.fluid.FluidState; import net.minecraft.registry.tag.FluidTags; @@ -32,8 +31,7 @@ @Mixin(value = FluidRenderer.class, remap = false) public class SodiumFluidRendererMixin { - @Final - @Shadow + @Final @Shadow private int[] quadColors; @Unique @@ -55,8 +53,7 @@ private void onRender(WorldSlice world, FluidState fluidState, BlockPos blockPos private void onUpdateQuad(ModelQuadView quad, WorldSlice world, BlockPos pos, LightPipeline lighter, Direction dir, float brightness, ColorProvider colorProvider, FluidState fluidState, CallbackInfo info) { // Ambience if (ambience.isActive() && ambience.customLavaColor.get() && fluidState.isIn(FluidTags.LAVA)) { - Color c = ambience.lavaColor.get(); - Arrays.fill(quadColors, ColorABGR.pack(c.r, c.g, c.b, c.a)); + Arrays.fill(quadColors, ColorABGR.withAlpha(ambience.lavaColor.get().getPacked(), 255)); } } } diff --git a/src/main/java/meteordevelopment/meteorclient/renderer/GL.java b/src/main/java/meteordevelopment/meteorclient/renderer/GL.java index 511c1b783c..19526684bd 100644 --- a/src/main/java/meteordevelopment/meteorclient/renderer/GL.java +++ b/src/main/java/meteordevelopment/meteorclient/renderer/GL.java @@ -5,6 +5,7 @@ package meteordevelopment.meteorclient.renderer; +import com.google.common.collect.ImmutableList; import com.mojang.blaze3d.platform.GlStateManager; import meteordevelopment.meteorclient.mixin.BufferRendererAccessor; import meteordevelopment.meteorclient.mixininterface.ICapabilityTracker; @@ -17,7 +18,6 @@ import java.lang.reflect.Field; import java.nio.ByteBuffer; import java.nio.FloatBuffer; -import java.util.List; import static meteordevelopment.meteorclient.MeteorClient.mc; import static org.lwjgl.opengl.GL32C.*; @@ -133,7 +133,7 @@ public static int createShader(int type) { } public static void shaderSource(int shader, String source) { - GlStateManager.glShaderSource(shader, List.of(source)); + GlStateManager.glShaderSource(shader, ImmutableList.of(source)); } public static String compileShader(int shader) { diff --git a/src/main/java/meteordevelopment/meteorclient/settings/BoolSetting.java b/src/main/java/meteordevelopment/meteorclient/settings/BoolSetting.java index e42351541a..cb21ed7035 100644 --- a/src/main/java/meteordevelopment/meteorclient/settings/BoolSetting.java +++ b/src/main/java/meteordevelopment/meteorclient/settings/BoolSetting.java @@ -5,13 +5,14 @@ package meteordevelopment.meteorclient.settings; +import com.google.common.collect.ImmutableList; import net.minecraft.nbt.NbtCompound; import java.util.List; import java.util.function.Consumer; public class BoolSetting extends Setting { - private static final List SUGGESTIONS = List.of("true", "false", "toggle"); + private static final List SUGGESTIONS = ImmutableList.of("true", "false", "toggle"); private BoolSetting(String name, String description, Boolean defaultValue, Consumer onChanged, Consumer> onModuleActivated, IVisible visible) { super(name, description, defaultValue, onChanged, onModuleActivated, visible); diff --git a/src/main/java/meteordevelopment/meteorclient/settings/ColorSetting.java b/src/main/java/meteordevelopment/meteorclient/settings/ColorSetting.java index 47ef146303..644028e36f 100644 --- a/src/main/java/meteordevelopment/meteorclient/settings/ColorSetting.java +++ b/src/main/java/meteordevelopment/meteorclient/settings/ColorSetting.java @@ -5,6 +5,7 @@ package meteordevelopment.meteorclient.settings; +import com.google.common.collect.ImmutableList; import meteordevelopment.meteorclient.utils.render.color.Color; import meteordevelopment.meteorclient.utils.render.color.SettingColor; import net.minecraft.nbt.NbtCompound; @@ -13,7 +14,7 @@ import java.util.function.Consumer; public class ColorSetting extends Setting { - private static final List SUGGESTIONS = List.of("0 0 0 255", "225 25 25 255", "25 225 25 255", "25 25 225 255", "255 255 255 255"); + private static final List SUGGESTIONS = ImmutableList.of("0 0 0 255", "225 25 25 255", "25 225 25 255", "25 25 225 255", "255 255 255 255"); public ColorSetting(String name, String description, SettingColor defaultValue, Consumer onChanged, Consumer> onModuleActivated, IVisible visible) { super(name, description, defaultValue, onChanged, onModuleActivated, visible); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/System.java b/src/main/java/meteordevelopment/meteorclient/systems/System.java index 60b2fb203d..b2d23353ed 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/System.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/System.java @@ -46,7 +46,7 @@ public void save(File folder) { try { File tempFile = File.createTempFile(MeteorClient.MOD_ID, file.getName()); - NbtIo.write(tag, tempFile.toPath()); + NbtIo.write(tag, tempFile); if (folder != null) file = new File(folder, file.getName()); @@ -71,7 +71,7 @@ public void load(File folder) { if (file.exists()) { try { - fromTag(NbtIo.read(file.toPath())); + fromTag(NbtIo.read(file)); } catch (CrashException e) { String backupName = FilenameUtils.removeExtension(file.getName()) + "-" + ZonedDateTime.now().format(DATE_TIME_FORMATTER) + ".backup.nbt"; File backup = new File(file.getParentFile(), backupName); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/accounts/Account.java b/src/main/java/meteordevelopment/meteorclient/systems/accounts/Account.java index 70ca1ac710..428a424eb9 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/accounts/Account.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/accounts/Account.java @@ -68,7 +68,11 @@ public static void setSession(Session session) { MinecraftClientAccessor mca = (MinecraftClientAccessor) mc; mca.setSession(session); UserApiService apiService; - apiService = mca.getAuthenticationService().createUserApiService(session.getAccessToken()); + try { + apiService = mca.getAuthenticationService().createUserApiService(session.getAccessToken()); + } catch (AuthenticationException e) { + apiService = UserApiService.OFFLINE; + } mca.setUserApiService(apiService); mca.setSocialInteractionsManager(new SocialInteractionsManager(mc, apiService)); mca.setProfileKeys(ProfileKeys.create(apiService, session, mc.runDirectory.toPath())); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/accounts/types/EasyMCAccount.java b/src/main/java/meteordevelopment/meteorclient/systems/accounts/types/EasyMCAccount.java index 52b1aeeef7..e6f023df4e 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/accounts/types/EasyMCAccount.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/accounts/types/EasyMCAccount.java @@ -21,7 +21,7 @@ public class EasyMCAccount extends Account { - private static final Environment ENVIRONMENT = new Environment("https://sessionserver.easymc.io", "https://authserver.mojang.com", "EasyMC"); + private static final Environment ENVIRONMENT = new Environment("https://authserver.mojang.com", "https://sessionserver.easymc.io", "https://api.minecraftservices.com", "EasyMC"); private static final YggdrasilAuthenticationService SERVICE = new YggdrasilAuthenticationService(((MinecraftClientAccessor) mc).getProxy(), ENVIRONMENT); public EasyMCAccount(String token) { diff --git a/src/main/java/meteordevelopment/meteorclient/systems/accounts/types/TheAlteningAccount.java b/src/main/java/meteordevelopment/meteorclient/systems/accounts/types/TheAlteningAccount.java index 57f2df4bc2..b1c37466f2 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/accounts/types/TheAlteningAccount.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/accounts/types/TheAlteningAccount.java @@ -21,7 +21,7 @@ import static meteordevelopment.meteorclient.MeteorClient.mc; public class TheAlteningAccount extends Account { - private static final Environment ENVIRONMENT = new Environment("http://sessionserver.thealtening.com", "http://authserver.thealtening.com", "The Altening"); + private static final Environment ENVIRONMENT = new Environment("http://authserver.thealtening.com", "http://sessionserver.thealtening.com", "https://api.minecraftservices.com", "The Altening"); private static final YggdrasilAuthenticationService SERVICE = new YggdrasilAuthenticationService(((MinecraftClientAccessor) mc).getProxy(), ENVIRONMENT); public TheAlteningAccount(String token) { @@ -68,7 +68,7 @@ public boolean login() { } private WaybackAuthLib getAuth() { - WaybackAuthLib auth = new WaybackAuthLib(ENVIRONMENT.servicesHost()); + WaybackAuthLib auth = new WaybackAuthLib(ENVIRONMENT.accountsHost()); auth.setUsername(name); auth.setPassword("Meteor on Crack!"); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/friends/Friend.java b/src/main/java/meteordevelopment/meteorclient/systems/friends/Friend.java index 8003a938f1..16476b039a 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/friends/Friend.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/friends/Friend.java @@ -31,7 +31,7 @@ public Friend(String name, @Nullable UUID id) { } public Friend(PlayerEntity player) { - this(player.getName().getString(), player.getUuid()); + this(player.getEntityName(), player.getUuid()); } public Friend(String name) { this(name, null); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/friends/Friends.java b/src/main/java/meteordevelopment/meteorclient/systems/friends/Friends.java index 3642319fa1..7227e58c4d 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/friends/Friends.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/friends/Friends.java @@ -65,7 +65,7 @@ public Friend get(String name) { } public Friend get(PlayerEntity player) { - return get(player.getName().getString()); + return get(player.getEntityName()); } public Friend get(PlayerListEntry player) { diff --git a/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/CombatHud.java b/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/CombatHud.java index fe2e31086f..b868e4012c 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/CombatHud.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/CombatHud.java @@ -237,7 +237,7 @@ public void render(HudRenderer renderer) { String breakText = " | "; // Name - String nameText = playerEntity.getName().getString(); + String nameText = playerEntity.getEntityName(); Color nameColor = PlayerUtils.getPlayerColor(playerEntity, primaryColor); // Ping diff --git a/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/PlayerRadarHud.java b/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/PlayerRadarHud.java index 879a45d708..2adbde96a8 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/PlayerRadarHud.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/PlayerRadarHud.java @@ -153,7 +153,7 @@ public void tick(HudRenderer renderer) { if (entity.equals(mc.player)) continue; if (!friends.get() && Friends.get().isFriend(entity)) continue; - String text = entity.getName().getString(); + String text = entity.getEntityName(); if (distance.get()) text += String.format("(%sm)", Math.round(mc.getCameraEntity().distanceTo(entity))); width = Math.max(width, renderer.textWidth(text, shadow.get(), getScale())); @@ -180,7 +180,7 @@ public void render(HudRenderer renderer) { if (entity.equals(mc.player)) continue; if (!friends.get() && Friends.get().isFriend(entity)) continue; - String text = entity.getName().getString(); + String text = entity.getEntityName(); Color color = PlayerUtils.getPlayerColor(entity, primaryColor.get()); String distanceText = null; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/PotionTimersHud.java b/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/PotionTimersHud.java index 5d3f0e99c3..8a2e1c699a 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/PotionTimersHud.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/PotionTimersHud.java @@ -241,7 +241,7 @@ public void render(HudRenderer renderer) { } private String getString(StatusEffectInstance statusEffectInstance) { - return String.format("%s %d (%s)", Names.get(statusEffectInstance.getEffectType()), statusEffectInstance.getAmplifier() + 1, statusEffectInstance.isInfinite() ? "inf" : StringHelper.formatTicks(statusEffectInstance.getDuration(), mc.world.getTickManager().getTickRate())); //todo remove "inf" when font rendering can use symbols + return String.format("%s %d (%s)", Names.get(statusEffectInstance.getEffectType()), statusEffectInstance.getAmplifier() + 1, statusEffectInstance.isInfinite() ? "inf" : StringHelper.formatTicks(statusEffectInstance.getDuration())); //todo remove "inf" when font rendering can use symbols } private double getScale() { diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/Modules.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/Modules.java index c9b07c574d..ac14ca7ddc 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/Modules.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/Modules.java @@ -5,6 +5,7 @@ package meteordevelopment.meteorclient.systems.modules; +import com.google.common.collect.Ordering; import com.mojang.datafixers.util.Pair; import com.mojang.serialization.Lifecycle; import it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap; @@ -169,7 +170,7 @@ public List getActive() { } public Set searchTitles(String text) { - Map modules = new ValueComparableMap<>(Comparator.naturalOrder()); + Map modules = new ValueComparableMap<>(Ordering.natural()); for (Module module : this.moduleInstances.values()) { int score = Utils.searchLevenshteinDefault(module.title, text, false); @@ -180,7 +181,7 @@ public Set searchTitles(String text) { } public Set searchSettingTitles(String text) { - Map modules = new ValueComparableMap<>(Comparator.naturalOrder()); + Map modules = new ValueComparableMap<>(Ordering.natural()); for (Module module : this.moduleInstances.values()) { int lowest = Integer.MAX_VALUE; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/DiscordPresence.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/DiscordPresence.java index 3ddd3c98ca..3750694c38 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/DiscordPresence.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/DiscordPresence.java @@ -25,13 +25,13 @@ import meteordevelopment.orbit.EventHandler; import meteordevelopment.starscript.Script; import net.minecraft.client.gui.screen.*; -import net.minecraft.client.gui.screen.multiplayer.AddServerScreen; -import net.minecraft.client.gui.screen.multiplayer.ConnectScreen; -import net.minecraft.client.gui.screen.multiplayer.DirectConnectScreen; import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen; import net.minecraft.client.gui.screen.option.*; import net.minecraft.client.gui.screen.pack.PackScreen; -import net.minecraft.client.gui.screen.world.*; +import net.minecraft.client.gui.screen.world.CreateWorldScreen; +import net.minecraft.client.gui.screen.world.EditGameRulesScreen; +import net.minecraft.client.gui.screen.world.EditWorldScreen; +import net.minecraft.client.gui.screen.world.SelectWorldScreen; import net.minecraft.client.realms.gui.screen.RealmsScreen; import net.minecraft.util.Pair; import net.minecraft.util.Util; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/MessageAura.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/MessageAura.java index 23c795b191..3c63a48401 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/MessageAura.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/MessageAura.java @@ -43,7 +43,7 @@ private void onEntityAdded(EntityAddedEvent event) { if (!(event.entity instanceof PlayerEntity) || event.entity.getUuid().equals(mc.player.getUuid())) return; if (!ignoreFriends.get() || (ignoreFriends.get() && !Friends.get().isFriend((PlayerEntity)event.entity))) { - ChatUtils.sendPlayerMsg("/msg " + event.entity.getName().getString() + " " + message.get()); + ChatUtils.sendPlayerMsg("/msg " + event.entity.getEntityName() + " " + message.get()); } } } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/Notifier.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/Notifier.java index 4a91c48eee..adcbcb2825 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/Notifier.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/Notifier.java @@ -154,7 +154,7 @@ private void onEntityAdded(EntityAddedEvent event) { if (!event.entity.getUuid().equals(mc.player.getUuid()) && entities.get().contains(event.entity.getType()) && visualRange.get() && this.event.get() != Event.Despawn) { if (event.entity instanceof PlayerEntity) { if ((!visualRangeIgnoreFriends.get() || !Friends.get().isFriend(((PlayerEntity) event.entity))) && (!visualRangeIgnoreFakes.get() || !(event.entity instanceof FakePlayerEntity))) { - ChatUtils.sendMsg(event.entity.getId() + 100, Formatting.GRAY, "(highlight)%s(default) has entered your visual range!", event.entity.getName().getString()); + ChatUtils.sendMsg(event.entity.getId() + 100, Formatting.GRAY, "(highlight)%s(default) has entered your visual range!", event.entity.getEntityName()); if (visualMakeSound.get()) mc.world.playSoundFromEntity(mc.player, mc.player, SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP, SoundCategory.AMBIENT, 3.0F, 1.0F); @@ -180,7 +180,7 @@ private void onEntityRemoved(EntityRemovedEvent event) { if (!event.entity.getUuid().equals(mc.player.getUuid()) && entities.get().contains(event.entity.getType()) && visualRange.get() && this.event.get() != Event.Spawn) { if (event.entity instanceof PlayerEntity) { if ((!visualRangeIgnoreFriends.get() || !Friends.get().isFriend(((PlayerEntity) event.entity))) && (!visualRangeIgnoreFakes.get() || !(event.entity instanceof FakePlayerEntity))) { - ChatUtils.sendMsg(event.entity.getId() + 100, Formatting.GRAY, "(highlight)%s(default) has left your visual range!", event.entity.getName().getString()); + ChatUtils.sendMsg(event.entity.getId() + 100, Formatting.GRAY, "(highlight)%s(default) has left your visual range!", event.entity.getEntityName()); if (visualMakeSound.get()) mc.world.playSoundFromEntity(mc.player, mc.player, SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP, SoundCategory.AMBIENT, 3.0F, 1.0F); @@ -202,7 +202,7 @@ private void onEntityRemoved(EntityRemovedEvent event) { if (pearl.getOwner() != null && pearl.getOwner() instanceof PlayerEntity p) { double d = pearlStartPosMap.get(i).distanceTo(e.getPos()); if ((!Friends.get().isFriend(p) || !pearlIgnoreFriends.get()) && (!p.equals(mc.player) || !pearlIgnoreOwn.get())) { - info("(highlight)%s's(default) pearl landed at %d, %d, %d (highlight)(%.1fm away, travelled %.1fm)(default).", pearl.getOwner().getName().getString(), pearl.getBlockPos().getX(), pearl.getBlockPos().getY(), pearl.getBlockPos().getZ(), pearl.distanceTo(mc.player), d); + info("(highlight)%s's(default) pearl landed at %d, %d, %d (highlight)(%.1fm away, travelled %.1fm)(default).", pearl.getOwner().getEntityName(), pearl.getBlockPos().getX(), pearl.getBlockPos().getY(), pearl.getBlockPos().getZ(), pearl.distanceTo(mc.player), d); } } pearlStartPosMap.remove(i); @@ -246,7 +246,7 @@ private void onReceivePacket(PacketEvent.Receive event) { int pops = totemPopMap.getOrDefault(entity.getUuid(), 0); totemPopMap.put(entity.getUuid(), ++pops); - ChatUtils.sendMsg(getChatId(entity), Formatting.GRAY, "(highlight)%s (default)popped (highlight)%d (default)%s.", entity.getName().getString(), pops, pops == 1 ? "totem" : "totems"); + ChatUtils.sendMsg(getChatId(entity), Formatting.GRAY, "(highlight)%s (default)popped (highlight)%d (default)%s.", entity.getEntityName(), pops, pops == 1 ? "totem" : "totems"); } } @@ -260,7 +260,7 @@ private void onTick(TickEvent.Post event) { if (player.deathTime > 0 || player.getHealth() <= 0) { int pops = totemPopMap.removeInt(player.getUuid()); - ChatUtils.sendMsg(getChatId(player), Formatting.GRAY, "(highlight)%s (default)died after popping (highlight)%d (default)%s.", player.getName().getString(), pops, pops == 1 ? "totem" : "totems"); + ChatUtils.sendMsg(getChatId(player), Formatting.GRAY, "(highlight)%s (default)died after popping (highlight)%d (default)%s.", player.getEntityName(), pops, pops == 1 ? "totem" : "totems"); chatIdMap.removeInt(player.getUuid()); } } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/ServerSpoof.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/ServerSpoof.java index dd0b910d15..94edd3b9b0 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/ServerSpoof.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/ServerSpoof.java @@ -100,12 +100,12 @@ private void onPacketRecieve(PacketEvent.Receive event) { if (!(event.packet instanceof ResourcePackSendS2CPacket packet)) return; event.cancel(); MutableText msg = Text.literal("This server has "); - msg.append(packet.required() ? "a required " : "an optional "); + msg.append(packet.isRequired() ? "a required " : "an optional "); MutableText link = Text.literal("resource pack"); link.setStyle(link.getStyle() .withColor(Formatting.BLUE) .withUnderline(true) - .withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, packet.url())) + .withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, packet.getUrl())) .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Text.literal("Click to download"))) ); msg.append(link); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AutoTool.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AutoTool.java index f72e2fa1d0..7410c1f427 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AutoTool.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AutoTool.java @@ -189,7 +189,7 @@ private boolean shouldStopUsing(ItemStack itemStack) { public static double getScore(ItemStack itemStack, BlockState state, boolean silkTouchEnderChest, boolean fortuneOre, EnchantPreference enchantPreference, Predicate good) { if (!good.test(itemStack) || !isTool(itemStack)) return -1; - if (!itemStack.isSuitableFor(state) && !(itemStack.getItem() instanceof SwordItem && (state.getBlock() instanceof BambooBlock || state.getBlock() instanceof BambooShootBlock))) return -1; + if (!itemStack.isSuitableFor(state) && !(itemStack.getItem() instanceof SwordItem && (state.getBlock() instanceof BambooBlock || state.getBlock() instanceof BambooSaplingBlock))) return -1; if (silkTouchEnderChest && state.getBlock() == Blocks.ENDER_CHEST @@ -213,7 +213,7 @@ && isFortunable(state.getBlock()) if (enchantPreference == EnchantPreference.Fortune) score += EnchantmentHelper.getLevel(Enchantments.FORTUNE, itemStack); if (enchantPreference == EnchantPreference.SilkTouch) score += EnchantmentHelper.getLevel(Enchantments.SILK_TOUCH, itemStack); - if (itemStack.getItem() instanceof SwordItem item && (state.getBlock() instanceof BambooBlock || state.getBlock() instanceof BambooShootBlock)) + if (itemStack.getItem() instanceof SwordItem item && (state.getBlock() instanceof BambooBlock || state.getBlock() instanceof BambooSaplingBlock)) score += 9000 + (item.getMaterial().getMiningLevel() * 1000); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/FakePlayer.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/FakePlayer.java index bd4480eea4..6946dfddf7 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/FakePlayer.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/FakePlayer.java @@ -56,7 +56,7 @@ public WWidget getWidget(GuiTheme theme) { private void fillTable(GuiTheme theme, WTable table) { for (FakePlayerEntity fakePlayer : FakePlayerManager.getFakePlayers()) { - table.add(theme.label(fakePlayer.getName().getString())); + table.add(theme.label(fakePlayer.getEntityName())); WMinus delete = table.add(theme.minus()).expandCellX().right().widget(); delete.action = () -> { FakePlayerManager.remove(fakePlayer); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/MiddleClickExtra.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/MiddleClickExtra.java index 6794b7735b..0af7d1116e 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/MiddleClickExtra.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/MiddleClickExtra.java @@ -98,11 +98,11 @@ private void onMouseButton(MouseButtonEvent event) { if (!Friends.get().isFriend(player)) { Friends.get().add(new Friend(player)); - info("Added %s to friends", player.getName().getString()); - if (message.get()) ChatUtils.sendPlayerMsg("/msg " + player.getName() + " I just friended you on Meteor."); + info("Added %s to friends", player.getEntityName()); + if (message.get()) ChatUtils.sendPlayerMsg("/msg " + player.getEntityName() + " I just friended you on Meteor."); } else { Friends.get().remove(Friends.get().get(player)); - info("Removed %s from friends", player.getName().getString()); + info("Removed %s from friends", player.getEntityName()); } return; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/BetterTooltips.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/BetterTooltips.java index 357dc14986..4158e0646e 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/BetterTooltips.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/BetterTooltips.java @@ -417,10 +417,10 @@ public void applyCompactShulkerTooltip(ItemStack stack, List tooltip) { private MutableText getStatusText(StatusEffectInstance effect) { MutableText text = Text.translatable(effect.getTranslationKey()); if (effect.getAmplifier() != 0) { - text.append(String.format(" %d (%s)", effect.getAmplifier() + 1, StatusEffectUtil.getDurationText(effect, 1, mc.world.getTickManager().getTickRate()).getString())); + text.append(String.format(" %d (%s)", effect.getAmplifier() + 1, StatusEffectUtil.getDurationText(effect, 1).getString())); } else { - text.append(String.format(" (%s)", StatusEffectUtil.getDurationText(effect, 1, mc.world.getTickManager().getTickRate()).getString())); + text.append(String.format(" (%s)", StatusEffectUtil.getDurationText(effect, 1).getString())); } if (effect.getEffectType().isBeneficial()) return text.formatted(Formatting.BLUE); @@ -436,7 +436,7 @@ private Text getFirstPage(ItemStack stack) { if (stack.getItem() == Items.WRITABLE_BOOK) return Text.literal(pages.getString(0)); try { - return Text.Serialization.fromLenientJson(pages.getString(0)); + return Text.Serializer.fromLenientJson(pages.getString(0)); } catch (JsonParseException e) { return Text.literal("Invalid book data"); } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/EntityOwner.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/EntityOwner.java index 5b2f672650..cc1c4db427 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/EntityOwner.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/EntityOwner.java @@ -110,7 +110,7 @@ private void renderNametag(String name) { private String getOwnerName(UUID uuid) { // Check if the player is online PlayerEntity player = mc.world.getPlayerByUuid(uuid); - if (player != null) return player.getName().getString(); + if (player != null) return player.getEntityName(); // Check cache String name = uuidToName.get(uuid); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/LogoutSpots.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/LogoutSpots.java index 4bba428fec..a750a33afb 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/LogoutSpots.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/LogoutSpots.java @@ -217,7 +217,7 @@ public Entry(PlayerEntity entity) { height = entity.getBoundingBox().getLengthY(); uuid = entity.getUuid(); - name = entity.getName().getString(); + name = entity.getEntityName(); health = Math.round(entity.getHealth() + entity.getAbsorptionAmount()); maxHealth = Math.round(entity.getMaxHealth() + entity.getAbsorptionAmount()); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Nametags.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Nametags.java index 79d51bc625..c343ce6bdc 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Nametags.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Nametags.java @@ -391,8 +391,8 @@ private void renderNametagPlayer(Render2DEvent event, PlayerEntity player, boole String name; Color nameColor = PlayerUtils.getPlayerColor(player, this.nameColor.get()); - if (player == mc.player) name = Modules.get().get(NameProtect.class).getName(player.getName().getString()); - else name = player.getName().getString(); + if (player == mc.player) name = Modules.get().get(NameProtect.class).getName(player.getEntityName()); + else name = player.getEntityName(); // Health float absorption = player.getAbsorptionAmount(); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Flamethrower.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Flamethrower.java index 1eb6ff4e5d..3d6585f945 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Flamethrower.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Flamethrower.java @@ -125,7 +125,7 @@ private void interact() { Block block = mc.world.getBlockState(entity.getBlockPos()).getBlock(); Block bottom = mc.world.getBlockState(entity.getBlockPos().down()).getBlock(); if (block == Blocks.WATER || bottom == Blocks.WATER || bottom == Blocks.DIRT_PATH) return; - if (block == Blocks.GRASS_BLOCK) mc.interactionManager.attackBlock(entity.getBlockPos(), Direction.DOWN); + if (block == Blocks.GRASS) mc.interactionManager.attackBlock(entity.getBlockPos(), Direction.DOWN); if (putOutFire.get() && entity instanceof LivingEntity animal && animal.getHealth() < 1) { mc.interactionManager.attackBlock(entity.getBlockPos(), Direction.DOWN); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Nuker.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Nuker.java index ff2eff1a99..b3123ee743 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Nuker.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Nuker.java @@ -275,7 +275,7 @@ private void onRender(Render3DEvent event) { if (enableRenderBounding.get()){ // Render bounding box if cube and should break stuff if (shape.get() != Shape.Sphere && mode.get() != Mode.Smash) { - box = new Box(pos1.toCenterPos(), pos2.toCenterPos()); + box = new Box(pos1, pos2); event.renderer.box(box, sideColorBox.get(), lineColorBox.get(), shapeModeBox.get(), 0); } } @@ -341,7 +341,7 @@ private void onTickPre(TickEvent.Pre event) { if (mode.get() == Mode.Flatten){ pos1.setY((int) Math.floor(pY)); } - box = new Box(pos1.toCenterPos(), pos2.toCenterPos()); + box = new Box(pos1, pos2); // Find blocks to break BlockIterator.register(Math.max((int) Math.ceil(range.get()+1), maxh), Math.max((int) Math.ceil(range.get()), maxv), (blockPos, blockState) -> { diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/VeinMiner.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/VeinMiner.java index ca985ce861..36781f8748 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/VeinMiner.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/VeinMiner.java @@ -5,6 +5,7 @@ package meteordevelopment.meteorclient.systems.modules.world; +import com.google.common.collect.Sets; import meteordevelopment.meteorclient.events.entity.player.StartBreakingBlockEvent; import meteordevelopment.meteorclient.events.render.Render3DEvent; import meteordevelopment.meteorclient.events.world.TickEvent; @@ -36,7 +37,7 @@ public class VeinMiner extends Module { private final SettingGroup sgGeneral = settings.getDefaultGroup(); private final SettingGroup sgRender = settings.createGroup("Render"); - private final Set blockNeighbours = Set.of( + private final Set blockNeighbours = Sets.newHashSet( new Vec3i(1, -1, 1), new Vec3i(0, -1, 1), new Vec3i(-1, -1, 1), new Vec3i(1, -1, 0), new Vec3i(0, -1, 0), new Vec3i(-1, -1, 0), new Vec3i(1, -1, -1), new Vec3i(0, -1, -1), new Vec3i(-1, -1, -1), @@ -55,7 +56,7 @@ public class VeinMiner extends Module { private final Setting> selectedBlocks = sgGeneral.add(new BlockListSetting.Builder() .name("blocks") .description("Which blocks to select.") - .defaultValue(Blocks.STONE, Blocks.DIRT, Blocks.GRASS_BLOCK) + .defaultValue(Blocks.STONE, Blocks.DIRT, Blocks.GRASS) .build() ); diff --git a/src/main/java/meteordevelopment/meteorclient/utils/entity/EntityUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/entity/EntityUtils.java index 3fa73c7704..c89f3e83e5 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/entity/EntityUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/entity/EntityUtils.java @@ -139,7 +139,7 @@ public static BlockPos getCityBlock(PlayerEntity player) { public static String getName(Entity entity) { if (entity == null) return null; - if (entity instanceof PlayerEntity) return entity.getName().getString(); + if (entity instanceof PlayerEntity) return entity.getEntityName(); return entity.getType().getName().getString(); } diff --git a/src/main/java/meteordevelopment/meteorclient/utils/entity/fakeplayer/FakePlayerManager.java b/src/main/java/meteordevelopment/meteorclient/utils/entity/fakeplayer/FakePlayerManager.java index b05a47c29a..b6fe58d550 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/entity/fakeplayer/FakePlayerManager.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/entity/fakeplayer/FakePlayerManager.java @@ -23,7 +23,7 @@ public static List getFakePlayers() { public static FakePlayerEntity get(String name) { for (FakePlayerEntity fp : ENTITIES) { - if (fp.getName().getString().equals(name)) return fp; + if (fp.getEntityName().equals(name)) return fp; } return null; @@ -39,7 +39,7 @@ public static void add(String name, float health, boolean copyInv) { public static void remove(FakePlayerEntity fp) { ENTITIES.removeIf(fp1 -> { - if (fp1.getName().getString().equals(fp.getName().getString())) { + if (fp1.getEntityName().equals(fp.getEntityName())) { fp1.despawn(); return true; } diff --git a/src/main/java/meteordevelopment/meteorclient/utils/misc/NbtUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/misc/NbtUtils.java index 9ccca937a3..2d961e52b3 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/misc/NbtUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/misc/NbtUtils.java @@ -8,7 +8,10 @@ import meteordevelopment.meteorclient.MeteorClient; import meteordevelopment.meteorclient.systems.System; import meteordevelopment.meteorclient.utils.render.prompts.OkPrompt; -import net.minecraft.nbt.*; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.nbt.NbtElement; +import net.minecraft.nbt.NbtIo; +import net.minecraft.nbt.NbtList; import org.apache.commons.io.output.ByteArrayOutputStream; import java.io.ByteArrayInputStream; @@ -86,7 +89,7 @@ public static NbtCompound fromClipboard(NbtCompound schema) { byte[] data = Base64.getDecoder().decode(mc.keyboard.getClipboard().trim()); ByteArrayInputStream bis = new ByteArrayInputStream(data); - NbtCompound pasted = NbtIo.readCompressed(new DataInputStream(bis), NbtTagSizeTracker.ofUnlimitedBytes()); + NbtCompound pasted = NbtIo.readCompressed(new DataInputStream(bis)); for (String key : schema.getKeys()) if (!pasted.getKeys().contains(key)) return null; if (!pasted.getString("name").equals(schema.getString("name"))) return null; diff --git a/src/main/java/meteordevelopment/meteorclient/utils/misc/ValueComparableMap.java b/src/main/java/meteordevelopment/meteorclient/utils/misc/ValueComparableMap.java index a5046c916e..04d953a26b 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/misc/ValueComparableMap.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/misc/ValueComparableMap.java @@ -5,31 +5,29 @@ package meteordevelopment.meteorclient.utils.misc; +import com.google.common.collect.Ordering; + import java.util.Comparator; import java.util.HashMap; import java.util.Map; import java.util.TreeMap; public class ValueComparableMap, V> extends TreeMap { - private final transient Map valueMap; + private final Map valueMap; - public ValueComparableMap(final Comparator partialValueComparator) { - this(partialValueComparator, new HashMap<>()); + public ValueComparableMap(final Ordering partialValueOrdering) { + this(partialValueOrdering, new HashMap()); } - private ValueComparableMap(Comparator partialValueComparator, HashMap valueMap) { - super((k1, k2) -> { - int cmp = partialValueComparator.compare(valueMap.get(k1), valueMap.get(k2)); - return cmp != 0 ? cmp : k1.compareTo(k2); - }); - + private ValueComparableMap(Ordering partialValueOrdering, HashMap valueMap) { + super(partialValueOrdering.onResultOf(valueMap::get).compound(Comparator.naturalOrder())); this.valueMap = valueMap; } @Override public V put(K k, V v) { if (valueMap.containsKey(k)) remove(k); - valueMap.put(k, v); + valueMap.put(k,v); return super.put(k, v); } diff --git a/src/main/java/meteordevelopment/meteorclient/utils/network/PacketUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/network/PacketUtils.java index f20229eda3..76494d2559 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/network/PacketUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/network/PacketUtils.java @@ -5,6 +5,7 @@ package meteordevelopment.meteorclient.utils.network; +import com.google.common.collect.Iterators; import com.mojang.datafixers.util.Pair; import com.mojang.serialization.Lifecycle; import meteordevelopment.meteorclient.utils.misc.MeteorIdentifier; @@ -18,11 +19,10 @@ import net.minecraft.util.Identifier; import net.minecraft.util.math.random.Random; import org.jetbrains.annotations.NotNull; - import java.util.*; import java.util.stream.Stream; -public abstract class PacketUtils { +public class PacketUtils { public static final Registry>> REGISTRY = new PacketRegistry(); private static final Map>, String> S2C_PACKETS = new HashMap<>(); @@ -38,10 +38,10 @@ public abstract class PacketUtils { C2S_PACKETS_R.put("PlayerInteractItemC2SPacket", net.minecraft.network.packet.c2s.play.PlayerInteractItemC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.login.EnterConfigurationC2SPacket.class, "EnterConfigurationC2SPacket"); C2S_PACKETS_R.put("EnterConfigurationC2SPacket", net.minecraft.network.packet.c2s.login.EnterConfigurationC2SPacket.class); - C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.SelectMerchantTradeC2SPacket.class, "SelectMerchantTradeC2SPacket"); - C2S_PACKETS_R.put("SelectMerchantTradeC2SPacket", net.minecraft.network.packet.c2s.play.SelectMerchantTradeC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket.class, "PlayerActionC2SPacket"); C2S_PACKETS_R.put("PlayerActionC2SPacket", net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket.class); + C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.SelectMerchantTradeC2SPacket.class, "SelectMerchantTradeC2SPacket"); + C2S_PACKETS_R.put("SelectMerchantTradeC2SPacket", net.minecraft.network.packet.c2s.play.SelectMerchantTradeC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.CommandExecutionC2SPacket.class, "CommandExecutionC2SPacket"); C2S_PACKETS_R.put("CommandExecutionC2SPacket", net.minecraft.network.packet.c2s.play.CommandExecutionC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.RenameItemC2SPacket.class, "RenameItemC2SPacket"); @@ -54,30 +54,30 @@ public abstract class PacketUtils { C2S_PACKETS_R.put("QueryBlockNbtC2SPacket", net.minecraft.network.packet.c2s.play.QueryBlockNbtC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.PlayerInteractEntityC2SPacket.class, "PlayerInteractEntityC2SPacket"); C2S_PACKETS_R.put("PlayerInteractEntityC2SPacket", net.minecraft.network.packet.c2s.play.PlayerInteractEntityC2SPacket.class); - C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.UpdatePlayerAbilitiesC2SPacket.class, "UpdatePlayerAbilitiesC2SPacket"); - C2S_PACKETS_R.put("UpdatePlayerAbilitiesC2SPacket", net.minecraft.network.packet.c2s.play.UpdatePlayerAbilitiesC2SPacket.class); - C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.RequestCommandCompletionsC2SPacket.class, "RequestCommandCompletionsC2SPacket"); - C2S_PACKETS_R.put("RequestCommandCompletionsC2SPacket", net.minecraft.network.packet.c2s.play.RequestCommandCompletionsC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.AcknowledgeReconfigurationC2SPacket.class, "AcknowledgeReconfigurationC2SPacket"); C2S_PACKETS_R.put("AcknowledgeReconfigurationC2SPacket", net.minecraft.network.packet.c2s.play.AcknowledgeReconfigurationC2SPacket.class); + C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.RequestCommandCompletionsC2SPacket.class, "RequestCommandCompletionsC2SPacket"); + C2S_PACKETS_R.put("RequestCommandCompletionsC2SPacket", net.minecraft.network.packet.c2s.play.RequestCommandCompletionsC2SPacket.class); + C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.UpdatePlayerAbilitiesC2SPacket.class, "UpdatePlayerAbilitiesC2SPacket"); + C2S_PACKETS_R.put("UpdatePlayerAbilitiesC2SPacket", net.minecraft.network.packet.c2s.play.UpdatePlayerAbilitiesC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.query.QueryRequestC2SPacket.class, "QueryRequestC2SPacket"); C2S_PACKETS_R.put("QueryRequestC2SPacket", net.minecraft.network.packet.c2s.query.QueryRequestC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.UpdateCommandBlockC2SPacket.class, "UpdateCommandBlockC2SPacket"); C2S_PACKETS_R.put("UpdateCommandBlockC2SPacket", net.minecraft.network.packet.c2s.play.UpdateCommandBlockC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.HandSwingC2SPacket.class, "HandSwingC2SPacket"); C2S_PACKETS_R.put("HandSwingC2SPacket", net.minecraft.network.packet.c2s.play.HandSwingC2SPacket.class); - C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.AdvancementTabC2SPacket.class, "AdvancementTabC2SPacket"); - C2S_PACKETS_R.put("AdvancementTabC2SPacket", net.minecraft.network.packet.c2s.play.AdvancementTabC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.ClickSlotC2SPacket.class, "ClickSlotC2SPacket"); C2S_PACKETS_R.put("ClickSlotC2SPacket", net.minecraft.network.packet.c2s.play.ClickSlotC2SPacket.class); + C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.AdvancementTabC2SPacket.class, "AdvancementTabC2SPacket"); + C2S_PACKETS_R.put("AdvancementTabC2SPacket", net.minecraft.network.packet.c2s.play.AdvancementTabC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.AcknowledgeChunksC2SPacket.class, "AcknowledgeChunksC2SPacket"); C2S_PACKETS_R.put("AcknowledgeChunksC2SPacket", net.minecraft.network.packet.c2s.play.AcknowledgeChunksC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.SpectatorTeleportC2SPacket.class, "SpectatorTeleportC2SPacket"); C2S_PACKETS_R.put("SpectatorTeleportC2SPacket", net.minecraft.network.packet.c2s.play.SpectatorTeleportC2SPacket.class); - C2S_PACKETS.put(net.minecraft.network.packet.c2s.login.LoginKeyC2SPacket.class, "LoginKeyC2SPacket"); - C2S_PACKETS_R.put("LoginKeyC2SPacket", net.minecraft.network.packet.c2s.login.LoginKeyC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.UpdateDifficultyLockC2SPacket.class, "UpdateDifficultyLockC2SPacket"); C2S_PACKETS_R.put("UpdateDifficultyLockC2SPacket", net.minecraft.network.packet.c2s.play.UpdateDifficultyLockC2SPacket.class); + C2S_PACKETS.put(net.minecraft.network.packet.c2s.login.LoginKeyC2SPacket.class, "LoginKeyC2SPacket"); + C2S_PACKETS_R.put("LoginKeyC2SPacket", net.minecraft.network.packet.c2s.login.LoginKeyC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.JigsawGeneratingC2SPacket.class, "JigsawGeneratingC2SPacket"); C2S_PACKETS_R.put("JigsawGeneratingC2SPacket", net.minecraft.network.packet.c2s.play.JigsawGeneratingC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.QueryEntityNbtC2SPacket.class, "QueryEntityNbtC2SPacket"); @@ -92,16 +92,14 @@ public abstract class PacketUtils { C2S_PACKETS_R.put("PlayerMoveC2SPacket", net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.common.ClientOptionsC2SPacket.class, "ClientOptionsC2SPacket"); C2S_PACKETS_R.put("ClientOptionsC2SPacket", net.minecraft.network.packet.c2s.common.ClientOptionsC2SPacket.class); - C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.PickFromInventoryC2SPacket.class, "PickFromInventoryC2SPacket"); - C2S_PACKETS_R.put("PickFromInventoryC2SPacket", net.minecraft.network.packet.c2s.play.PickFromInventoryC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.common.CustomPayloadC2SPacket.class, "CustomPayloadC2SPacket"); C2S_PACKETS_R.put("CustomPayloadC2SPacket", net.minecraft.network.packet.c2s.common.CustomPayloadC2SPacket.class); + C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.PickFromInventoryC2SPacket.class, "PickFromInventoryC2SPacket"); + C2S_PACKETS_R.put("PickFromInventoryC2SPacket", net.minecraft.network.packet.c2s.play.PickFromInventoryC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.PlayerSessionC2SPacket.class, "PlayerSessionC2SPacket"); C2S_PACKETS_R.put("PlayerSessionC2SPacket", net.minecraft.network.packet.c2s.play.PlayerSessionC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.CloseHandledScreenC2SPacket.class, "CloseHandledScreenC2SPacket"); C2S_PACKETS_R.put("CloseHandledScreenC2SPacket", net.minecraft.network.packet.c2s.play.CloseHandledScreenC2SPacket.class); - C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.SlotChangedStateC2SPacket.class, "SlotChangedStateC2SPacket"); - C2S_PACKETS_R.put("SlotChangedStateC2SPacket", net.minecraft.network.packet.c2s.play.SlotChangedStateC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.config.ReadyC2SPacket.class, "ReadyC2SPacket"); C2S_PACKETS_R.put("ReadyC2SPacket", net.minecraft.network.packet.c2s.config.ReadyC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.BoatPaddleStateC2SPacket.class, "BoatPaddleStateC2SPacket"); @@ -112,10 +110,10 @@ public abstract class PacketUtils { C2S_PACKETS_R.put("ButtonClickC2SPacket", net.minecraft.network.packet.c2s.play.ButtonClickC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.UpdateBeaconC2SPacket.class, "UpdateBeaconC2SPacket"); C2S_PACKETS_R.put("UpdateBeaconC2SPacket", net.minecraft.network.packet.c2s.play.UpdateBeaconC2SPacket.class); - C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.UpdateSignC2SPacket.class, "UpdateSignC2SPacket"); - C2S_PACKETS_R.put("UpdateSignC2SPacket", net.minecraft.network.packet.c2s.play.UpdateSignC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.TeleportConfirmC2SPacket.class, "TeleportConfirmC2SPacket"); C2S_PACKETS_R.put("TeleportConfirmC2SPacket", net.minecraft.network.packet.c2s.play.TeleportConfirmC2SPacket.class); + C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.UpdateSignC2SPacket.class, "UpdateSignC2SPacket"); + C2S_PACKETS_R.put("UpdateSignC2SPacket", net.minecraft.network.packet.c2s.play.UpdateSignC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.UpdateStructureBlockC2SPacket.class, "UpdateStructureBlockC2SPacket"); C2S_PACKETS_R.put("UpdateStructureBlockC2SPacket", net.minecraft.network.packet.c2s.play.UpdateStructureBlockC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.UpdateCommandBlockMinecartC2SPacket.class, "UpdateCommandBlockMinecartC2SPacket"); @@ -134,18 +132,18 @@ public abstract class PacketUtils { C2S_PACKETS_R.put("MessageAcknowledgmentC2SPacket", net.minecraft.network.packet.c2s.play.MessageAcknowledgmentC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.common.KeepAliveC2SPacket.class, "KeepAliveC2SPacket"); C2S_PACKETS_R.put("KeepAliveC2SPacket", net.minecraft.network.packet.c2s.common.KeepAliveC2SPacket.class); - C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.CreativeInventoryActionC2SPacket.class, "CreativeInventoryActionC2SPacket"); - C2S_PACKETS_R.put("CreativeInventoryActionC2SPacket", net.minecraft.network.packet.c2s.play.CreativeInventoryActionC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.VehicleMoveC2SPacket.class, "VehicleMoveC2SPacket"); C2S_PACKETS_R.put("VehicleMoveC2SPacket", net.minecraft.network.packet.c2s.play.VehicleMoveC2SPacket.class); + C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.CreativeInventoryActionC2SPacket.class, "CreativeInventoryActionC2SPacket"); + C2S_PACKETS_R.put("CreativeInventoryActionC2SPacket", net.minecraft.network.packet.c2s.play.CreativeInventoryActionC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.BookUpdateC2SPacket.class, "BookUpdateC2SPacket"); C2S_PACKETS_R.put("BookUpdateC2SPacket", net.minecraft.network.packet.c2s.play.BookUpdateC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.RecipeBookDataC2SPacket.class, "RecipeBookDataC2SPacket"); C2S_PACKETS_R.put("RecipeBookDataC2SPacket", net.minecraft.network.packet.c2s.play.RecipeBookDataC2SPacket.class); - C2S_PACKETS.put(net.minecraft.network.packet.c2s.login.LoginQueryResponseC2SPacket.class, "LoginQueryResponseC2SPacket"); - C2S_PACKETS_R.put("LoginQueryResponseC2SPacket", net.minecraft.network.packet.c2s.login.LoginQueryResponseC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.handshake.HandshakeC2SPacket.class, "HandshakeC2SPacket"); C2S_PACKETS_R.put("HandshakeC2SPacket", net.minecraft.network.packet.c2s.handshake.HandshakeC2SPacket.class); + C2S_PACKETS.put(net.minecraft.network.packet.c2s.login.LoginQueryResponseC2SPacket.class, "LoginQueryResponseC2SPacket"); + C2S_PACKETS_R.put("LoginQueryResponseC2SPacket", net.minecraft.network.packet.c2s.login.LoginQueryResponseC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.UpdateDifficultyC2SPacket.class, "UpdateDifficultyC2SPacket"); C2S_PACKETS_R.put("UpdateDifficultyC2SPacket", net.minecraft.network.packet.c2s.play.UpdateDifficultyC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.CraftRequestC2SPacket.class, "CraftRequestC2SPacket"); @@ -183,38 +181,36 @@ public abstract class PacketUtils { S2C_PACKETS_R.put("ResourcePackSendS2CPacket", net.minecraft.network.packet.s2c.common.ResourcePackSendS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.DamageTiltS2CPacket.class, "DamageTiltS2CPacket"); S2C_PACKETS_R.put("DamageTiltS2CPacket", net.minecraft.network.packet.s2c.play.DamageTiltS2CPacket.class); - S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.CraftFailedResponseS2CPacket.class, "CraftFailedResponseS2CPacket"); - S2C_PACKETS_R.put("CraftFailedResponseS2CPacket", net.minecraft.network.packet.s2c.play.CraftFailedResponseS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.StatisticsS2CPacket.class, "StatisticsS2CPacket"); S2C_PACKETS_R.put("StatisticsS2CPacket", net.minecraft.network.packet.s2c.play.StatisticsS2CPacket.class); + S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.CraftFailedResponseS2CPacket.class, "CraftFailedResponseS2CPacket"); + S2C_PACKETS_R.put("CraftFailedResponseS2CPacket", net.minecraft.network.packet.s2c.play.CraftFailedResponseS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.login.LoginQueryRequestS2CPacket.class, "LoginQueryRequestS2CPacket"); S2C_PACKETS_R.put("LoginQueryRequestS2CPacket", net.minecraft.network.packet.s2c.login.LoginQueryRequestS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.VehicleMoveS2CPacket.class, "VehicleMoveS2CPacket"); S2C_PACKETS_R.put("VehicleMoveS2CPacket", net.minecraft.network.packet.s2c.play.VehicleMoveS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.EntityAttributesS2CPacket.class, "EntityAttributesS2CPacket"); S2C_PACKETS_R.put("EntityAttributesS2CPacket", net.minecraft.network.packet.s2c.play.EntityAttributesS2CPacket.class); - S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.TickStepS2CPacket.class, "TickStepS2CPacket"); - S2C_PACKETS_R.put("TickStepS2CPacket", net.minecraft.network.packet.s2c.play.TickStepS2CPacket.class); - S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.StopSoundS2CPacket.class, "StopSoundS2CPacket"); - S2C_PACKETS_R.put("StopSoundS2CPacket", net.minecraft.network.packet.s2c.play.StopSoundS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.ScoreboardObjectiveUpdateS2CPacket.class, "ScoreboardObjectiveUpdateS2CPacket"); S2C_PACKETS_R.put("ScoreboardObjectiveUpdateS2CPacket", net.minecraft.network.packet.s2c.play.ScoreboardObjectiveUpdateS2CPacket.class); + S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.StopSoundS2CPacket.class, "StopSoundS2CPacket"); + S2C_PACKETS_R.put("StopSoundS2CPacket", net.minecraft.network.packet.s2c.play.StopSoundS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.StartChunkSendS2CPacket.class, "StartChunkSendS2CPacket"); S2C_PACKETS_R.put("StartChunkSendS2CPacket", net.minecraft.network.packet.s2c.play.StartChunkSendS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.EntitySetHeadYawS2CPacket.class, "EntitySetHeadYawS2CPacket"); S2C_PACKETS_R.put("EntitySetHeadYawS2CPacket", net.minecraft.network.packet.s2c.play.EntitySetHeadYawS2CPacket.class); - S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.SelectAdvancementTabS2CPacket.class, "SelectAdvancementTabS2CPacket"); - S2C_PACKETS_R.put("SelectAdvancementTabS2CPacket", net.minecraft.network.packet.s2c.play.SelectAdvancementTabS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.SetTradeOffersS2CPacket.class, "SetTradeOffersS2CPacket"); S2C_PACKETS_R.put("SetTradeOffersS2CPacket", net.minecraft.network.packet.s2c.play.SetTradeOffersS2CPacket.class); + S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.SelectAdvancementTabS2CPacket.class, "SelectAdvancementTabS2CPacket"); + S2C_PACKETS_R.put("SelectAdvancementTabS2CPacket", net.minecraft.network.packet.s2c.play.SelectAdvancementTabS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.PlaySoundS2CPacket.class, "PlaySoundS2CPacket"); S2C_PACKETS_R.put("PlaySoundS2CPacket", net.minecraft.network.packet.s2c.play.PlaySoundS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.BlockEventS2CPacket.class, "BlockEventS2CPacket"); S2C_PACKETS_R.put("BlockEventS2CPacket", net.minecraft.network.packet.s2c.play.BlockEventS2CPacket.class); - S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.PlayerPositionLookS2CPacket.class, "PlayerPositionLookS2CPacket"); - S2C_PACKETS_R.put("PlayerPositionLookS2CPacket", net.minecraft.network.packet.s2c.play.PlayerPositionLookS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.ChunkSentS2CPacket.class, "ChunkSentS2CPacket"); S2C_PACKETS_R.put("ChunkSentS2CPacket", net.minecraft.network.packet.s2c.play.ChunkSentS2CPacket.class); + S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.PlayerPositionLookS2CPacket.class, "PlayerPositionLookS2CPacket"); + S2C_PACKETS_R.put("PlayerPositionLookS2CPacket", net.minecraft.network.packet.s2c.play.PlayerPositionLookS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.HealthUpdateS2CPacket.class, "HealthUpdateS2CPacket"); S2C_PACKETS_R.put("HealthUpdateS2CPacket", net.minecraft.network.packet.s2c.play.HealthUpdateS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.WorldEventS2CPacket.class, "WorldEventS2CPacket"); @@ -233,12 +229,12 @@ public abstract class PacketUtils { S2C_PACKETS_R.put("TeamS2CPacket", net.minecraft.network.packet.s2c.play.TeamS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.CooldownUpdateS2CPacket.class, "CooldownUpdateS2CPacket"); S2C_PACKETS_R.put("CooldownUpdateS2CPacket", net.minecraft.network.packet.s2c.play.CooldownUpdateS2CPacket.class); - S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.OpenScreenS2CPacket.class, "OpenScreenS2CPacket"); - S2C_PACKETS_R.put("OpenScreenS2CPacket", net.minecraft.network.packet.s2c.play.OpenScreenS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.ExperienceOrbSpawnS2CPacket.class, "ExperienceOrbSpawnS2CPacket"); S2C_PACKETS_R.put("ExperienceOrbSpawnS2CPacket", net.minecraft.network.packet.s2c.play.ExperienceOrbSpawnS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.EntityAnimationS2CPacket.class, "EntityAnimationS2CPacket"); S2C_PACKETS_R.put("EntityAnimationS2CPacket", net.minecraft.network.packet.s2c.play.EntityAnimationS2CPacket.class); + S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.OpenScreenS2CPacket.class, "OpenScreenS2CPacket"); + S2C_PACKETS_R.put("OpenScreenS2CPacket", net.minecraft.network.packet.s2c.play.OpenScreenS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.PlayerAbilitiesS2CPacket.class, "PlayerAbilitiesS2CPacket"); S2C_PACKETS_R.put("PlayerAbilitiesS2CPacket", net.minecraft.network.packet.s2c.play.PlayerAbilitiesS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.WorldBorderWarningBlocksChangedS2CPacket.class, "WorldBorderWarningBlocksChangedS2CPacket"); @@ -251,10 +247,10 @@ public abstract class PacketUtils { S2C_PACKETS_R.put("UnlockRecipesS2CPacket", net.minecraft.network.packet.s2c.play.UnlockRecipesS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.LightUpdateS2CPacket.class, "LightUpdateS2CPacket"); S2C_PACKETS_R.put("LightUpdateS2CPacket", net.minecraft.network.packet.s2c.play.LightUpdateS2CPacket.class); - S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.OverlayMessageS2CPacket.class, "OverlayMessageS2CPacket"); - S2C_PACKETS_R.put("OverlayMessageS2CPacket", net.minecraft.network.packet.s2c.play.OverlayMessageS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.WorldBorderInitializeS2CPacket.class, "WorldBorderInitializeS2CPacket"); S2C_PACKETS_R.put("WorldBorderInitializeS2CPacket", net.minecraft.network.packet.s2c.play.WorldBorderInitializeS2CPacket.class); + S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.OverlayMessageS2CPacket.class, "OverlayMessageS2CPacket"); + S2C_PACKETS_R.put("OverlayMessageS2CPacket", net.minecraft.network.packet.s2c.play.OverlayMessageS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.WorldBorderCenterChangedS2CPacket.class, "WorldBorderCenterChangedS2CPacket"); S2C_PACKETS_R.put("WorldBorderCenterChangedS2CPacket", net.minecraft.network.packet.s2c.play.WorldBorderCenterChangedS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.EntityVelocityUpdateS2CPacket.class, "EntityVelocityUpdateS2CPacket"); @@ -263,12 +259,10 @@ public abstract class PacketUtils { S2C_PACKETS_R.put("DifficultyS2CPacket", net.minecraft.network.packet.s2c.play.DifficultyS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.LookAtS2CPacket.class, "LookAtS2CPacket"); S2C_PACKETS_R.put("LookAtS2CPacket", net.minecraft.network.packet.s2c.play.LookAtS2CPacket.class); - S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.ScoreboardScoreUpdateS2CPacket.class, "ScoreboardScoreUpdateS2CPacket"); - S2C_PACKETS_R.put("ScoreboardScoreUpdateS2CPacket", net.minecraft.network.packet.s2c.play.ScoreboardScoreUpdateS2CPacket.class); - S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.TitleS2CPacket.class, "TitleS2CPacket"); - S2C_PACKETS_R.put("TitleS2CPacket", net.minecraft.network.packet.s2c.play.TitleS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.ScreenHandlerPropertyUpdateS2CPacket.class, "ScreenHandlerPropertyUpdateS2CPacket"); S2C_PACKETS_R.put("ScreenHandlerPropertyUpdateS2CPacket", net.minecraft.network.packet.s2c.play.ScreenHandlerPropertyUpdateS2CPacket.class); + S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.TitleS2CPacket.class, "TitleS2CPacket"); + S2C_PACKETS_R.put("TitleS2CPacket", net.minecraft.network.packet.s2c.play.TitleS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.OpenHorseScreenS2CPacket.class, "OpenHorseScreenS2CPacket"); S2C_PACKETS_R.put("OpenHorseScreenS2CPacket", net.minecraft.network.packet.s2c.play.OpenHorseScreenS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.SimulationDistanceS2CPacket.class, "SimulationDistanceS2CPacket"); @@ -283,38 +277,36 @@ public abstract class PacketUtils { S2C_PACKETS_R.put("DeathMessageS2CPacket", net.minecraft.network.packet.s2c.play.DeathMessageS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.MapUpdateS2CPacket.class, "MapUpdateS2CPacket"); S2C_PACKETS_R.put("MapUpdateS2CPacket", net.minecraft.network.packet.s2c.play.MapUpdateS2CPacket.class); - S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.ScreenHandlerSlotUpdateS2CPacket.class, "ScreenHandlerSlotUpdateS2CPacket"); - S2C_PACKETS_R.put("ScreenHandlerSlotUpdateS2CPacket", net.minecraft.network.packet.s2c.play.ScreenHandlerSlotUpdateS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket.class, "BlockEntityUpdateS2CPacket"); S2C_PACKETS_R.put("BlockEntityUpdateS2CPacket", net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket.class); + S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.ScreenHandlerSlotUpdateS2CPacket.class, "ScreenHandlerSlotUpdateS2CPacket"); + S2C_PACKETS_R.put("ScreenHandlerSlotUpdateS2CPacket", net.minecraft.network.packet.s2c.play.ScreenHandlerSlotUpdateS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.PlayerSpawnPositionS2CPacket.class, "PlayerSpawnPositionS2CPacket"); S2C_PACKETS_R.put("PlayerSpawnPositionS2CPacket", net.minecraft.network.packet.s2c.play.PlayerSpawnPositionS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.EntityStatusEffectS2CPacket.class, "EntityStatusEffectS2CPacket"); S2C_PACKETS_R.put("EntityStatusEffectS2CPacket", net.minecraft.network.packet.s2c.play.EntityStatusEffectS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.ClearTitleS2CPacket.class, "ClearTitleS2CPacket"); S2C_PACKETS_R.put("ClearTitleS2CPacket", net.minecraft.network.packet.s2c.play.ClearTitleS2CPacket.class); - S2C_PACKETS.put(net.minecraft.network.packet.s2c.login.LoginCompressionS2CPacket.class, "LoginCompressionS2CPacket"); - S2C_PACKETS_R.put("LoginCompressionS2CPacket", net.minecraft.network.packet.s2c.login.LoginCompressionS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.CommandTreeS2CPacket.class, "CommandTreeS2CPacket"); S2C_PACKETS_R.put("CommandTreeS2CPacket", net.minecraft.network.packet.s2c.play.CommandTreeS2CPacket.class); + S2C_PACKETS.put(net.minecraft.network.packet.s2c.login.LoginCompressionS2CPacket.class, "LoginCompressionS2CPacket"); + S2C_PACKETS_R.put("LoginCompressionS2CPacket", net.minecraft.network.packet.s2c.login.LoginCompressionS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.common.CommonPingS2CPacket.class, "CommonPingS2CPacket"); S2C_PACKETS_R.put("CommonPingS2CPacket", net.minecraft.network.packet.s2c.common.CommonPingS2CPacket.class); - S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.ScoreboardScoreResetS2CPacket.class, "ScoreboardScoreResetS2CPacket"); - S2C_PACKETS_R.put("ScoreboardScoreResetS2CPacket", net.minecraft.network.packet.s2c.play.ScoreboardScoreResetS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.TitleFadeS2CPacket.class, "TitleFadeS2CPacket"); S2C_PACKETS_R.put("TitleFadeS2CPacket", net.minecraft.network.packet.s2c.play.TitleFadeS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.query.PingResultS2CPacket.class, "PingResultS2CPacket"); S2C_PACKETS_R.put("PingResultS2CPacket", net.minecraft.network.packet.s2c.query.PingResultS2CPacket.class); - S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.UpdateTickRateS2CPacket.class, "UpdateTickRateS2CPacket"); - S2C_PACKETS_R.put("UpdateTickRateS2CPacket", net.minecraft.network.packet.s2c.play.UpdateTickRateS2CPacket.class); - S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.InventoryS2CPacket.class, "InventoryS2CPacket"); - S2C_PACKETS_R.put("InventoryS2CPacket", net.minecraft.network.packet.s2c.play.InventoryS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.PlayerActionResponseS2CPacket.class, "PlayerActionResponseS2CPacket"); S2C_PACKETS_R.put("PlayerActionResponseS2CPacket", net.minecraft.network.packet.s2c.play.PlayerActionResponseS2CPacket.class); + S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.InventoryS2CPacket.class, "InventoryS2CPacket"); + S2C_PACKETS_R.put("InventoryS2CPacket", net.minecraft.network.packet.s2c.play.InventoryS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.ChunkBiomeDataS2CPacket.class, "ChunkBiomeDataS2CPacket"); S2C_PACKETS_R.put("ChunkBiomeDataS2CPacket", net.minecraft.network.packet.s2c.play.ChunkBiomeDataS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.WorldBorderWarningTimeChangedS2CPacket.class, "WorldBorderWarningTimeChangedS2CPacket"); S2C_PACKETS_R.put("WorldBorderWarningTimeChangedS2CPacket", net.minecraft.network.packet.s2c.play.WorldBorderWarningTimeChangedS2CPacket.class); + S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.ScoreboardPlayerUpdateS2CPacket.class, "ScoreboardPlayerUpdateS2CPacket"); + S2C_PACKETS_R.put("ScoreboardPlayerUpdateS2CPacket", net.minecraft.network.packet.s2c.play.ScoreboardPlayerUpdateS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.EntityDamageS2CPacket.class, "EntityDamageS2CPacket"); S2C_PACKETS_R.put("EntityDamageS2CPacket", net.minecraft.network.packet.s2c.play.EntityDamageS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.ChatMessageS2CPacket.class, "ChatMessageS2CPacket"); @@ -323,22 +315,20 @@ public abstract class PacketUtils { S2C_PACKETS_R.put("KeepAliveS2CPacket", net.minecraft.network.packet.s2c.common.KeepAliveS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.OpenWrittenBookS2CPacket.class, "OpenWrittenBookS2CPacket"); S2C_PACKETS_R.put("OpenWrittenBookS2CPacket", net.minecraft.network.packet.s2c.play.OpenWrittenBookS2CPacket.class); - S2C_PACKETS.put(net.minecraft.network.packet.s2c.common.ResourcePackRemoveS2CPacket.class, "ResourcePackRemoveS2CPacket"); - S2C_PACKETS_R.put("ResourcePackRemoveS2CPacket", net.minecraft.network.packet.s2c.common.ResourcePackRemoveS2CPacket.class); - S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.PlaySoundFromEntityS2CPacket.class, "PlaySoundFromEntityS2CPacket"); - S2C_PACKETS_R.put("PlaySoundFromEntityS2CPacket", net.minecraft.network.packet.s2c.play.PlaySoundFromEntityS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.WorldTimeUpdateS2CPacket.class, "WorldTimeUpdateS2CPacket"); S2C_PACKETS_R.put("WorldTimeUpdateS2CPacket", net.minecraft.network.packet.s2c.play.WorldTimeUpdateS2CPacket.class); + S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.PlaySoundFromEntityS2CPacket.class, "PlaySoundFromEntityS2CPacket"); + S2C_PACKETS_R.put("PlaySoundFromEntityS2CPacket", net.minecraft.network.packet.s2c.play.PlaySoundFromEntityS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.config.FeaturesS2CPacket.class, "FeaturesS2CPacket"); S2C_PACKETS_R.put("FeaturesS2CPacket", net.minecraft.network.packet.s2c.config.FeaturesS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.SignEditorOpenS2CPacket.class, "SignEditorOpenS2CPacket"); S2C_PACKETS_R.put("SignEditorOpenS2CPacket", net.minecraft.network.packet.s2c.play.SignEditorOpenS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.ExplosionS2CPacket.class, "ExplosionS2CPacket"); S2C_PACKETS_R.put("ExplosionS2CPacket", net.minecraft.network.packet.s2c.play.ExplosionS2CPacket.class); - S2C_PACKETS.put(net.minecraft.network.packet.s2c.login.LoginDisconnectS2CPacket.class, "LoginDisconnectS2CPacket"); - S2C_PACKETS_R.put("LoginDisconnectS2CPacket", net.minecraft.network.packet.s2c.login.LoginDisconnectS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.RemoveEntityStatusEffectS2CPacket.class, "RemoveEntityStatusEffectS2CPacket"); S2C_PACKETS_R.put("RemoveEntityStatusEffectS2CPacket", net.minecraft.network.packet.s2c.play.RemoveEntityStatusEffectS2CPacket.class); + S2C_PACKETS.put(net.minecraft.network.packet.s2c.login.LoginDisconnectS2CPacket.class, "LoginDisconnectS2CPacket"); + S2C_PACKETS_R.put("LoginDisconnectS2CPacket", net.minecraft.network.packet.s2c.login.LoginDisconnectS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.EndCombatS2CPacket.class, "EndCombatS2CPacket"); S2C_PACKETS_R.put("EndCombatS2CPacket", net.minecraft.network.packet.s2c.play.EndCombatS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.PlayerListS2CPacket.class, "PlayerListS2CPacket"); @@ -375,10 +365,10 @@ public abstract class PacketUtils { S2C_PACKETS_R.put("SynchronizeRecipesS2CPacket", net.minecraft.network.packet.s2c.play.SynchronizeRecipesS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.EntityS2CPacket.class, "EntityS2CPacket"); S2C_PACKETS_R.put("EntityS2CPacket", net.minecraft.network.packet.s2c.play.EntityS2CPacket.class); - S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.EntityTrackerUpdateS2CPacket.class, "EntityTrackerUpdateS2CPacket"); - S2C_PACKETS_R.put("EntityTrackerUpdateS2CPacket", net.minecraft.network.packet.s2c.play.EntityTrackerUpdateS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.EntityStatusS2CPacket.class, "EntityStatusS2CPacket"); S2C_PACKETS_R.put("EntityStatusS2CPacket", net.minecraft.network.packet.s2c.play.EntityStatusS2CPacket.class); + S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.EntityTrackerUpdateS2CPacket.class, "EntityTrackerUpdateS2CPacket"); + S2C_PACKETS_R.put("EntityTrackerUpdateS2CPacket", net.minecraft.network.packet.s2c.play.EntityTrackerUpdateS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.config.DynamicRegistriesS2CPacket.class, "DynamicRegistriesS2CPacket"); S2C_PACKETS_R.put("DynamicRegistriesS2CPacket", net.minecraft.network.packet.s2c.config.DynamicRegistriesS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.common.CustomPayloadS2CPacket.class, "CustomPayloadS2CPacket"); @@ -387,10 +377,10 @@ public abstract class PacketUtils { S2C_PACKETS_R.put("SubtitleS2CPacket", net.minecraft.network.packet.s2c.play.SubtitleS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.NbtQueryResponseS2CPacket.class, "NbtQueryResponseS2CPacket"); S2C_PACKETS_R.put("NbtQueryResponseS2CPacket", net.minecraft.network.packet.s2c.play.NbtQueryResponseS2CPacket.class); - S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.EntityEquipmentUpdateS2CPacket.class, "EntityEquipmentUpdateS2CPacket"); - S2C_PACKETS_R.put("EntityEquipmentUpdateS2CPacket", net.minecraft.network.packet.s2c.play.EntityEquipmentUpdateS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.UnloadChunkS2CPacket.class, "UnloadChunkS2CPacket"); S2C_PACKETS_R.put("UnloadChunkS2CPacket", net.minecraft.network.packet.s2c.play.UnloadChunkS2CPacket.class); + S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.EntityEquipmentUpdateS2CPacket.class, "EntityEquipmentUpdateS2CPacket"); + S2C_PACKETS_R.put("EntityEquipmentUpdateS2CPacket", net.minecraft.network.packet.s2c.play.EntityEquipmentUpdateS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.config.ReadyS2CPacket.class, "ReadyS2CPacket"); S2C_PACKETS_R.put("ReadyS2CPacket", net.minecraft.network.packet.s2c.config.ReadyS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.EnterReconfigurationS2CPacket.class, "EnterReconfigurationS2CPacket"); @@ -498,7 +488,7 @@ public Class> get(int index) { @NotNull @Override public Iterator>> iterator() { - return Stream.concat(S2C_PACKETS.keySet().stream(), C2S_PACKETS.keySet().stream()).iterator(); + return Iterators.concat(S2C_PACKETS.keySet().iterator(), C2S_PACKETS.keySet().iterator()); } @Override @@ -508,7 +498,7 @@ public boolean contains(RegistryKey>> key) { @Override public Set>>, Class>>> getEntrySet() { - return Collections.emptySet(); + return null; } @Override @@ -569,7 +559,7 @@ public void populateTags(Map>>, List>>> getKeys() { - return Collections.emptySet(); + return null; } } } diff --git a/src/main/java/meteordevelopment/meteorclient/utils/network/PacketUtilsUtil.java b/src/main/java/meteordevelopment/meteorclient/utils/network/PacketUtilsUtil.java index c296a947e4..c56cd6a02b 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/network/PacketUtilsUtil.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/network/PacketUtilsUtil.java @@ -16,7 +16,7 @@ import java.io.IOException; import java.util.Set; -public abstract class PacketUtilsUtil { +public class PacketUtilsUtil { private static final String packetRegistryClass = """ private static class PacketRegistry extends SimpleRegistry>> { public PacketRegistry() { @@ -81,7 +81,7 @@ public Class> get(int index) { @NotNull @Override public Iterator>> iterator() { - return Stream.concat(S2C_PACKETS.keySet().stream(), C2S_PACKETS.keySet().stream()).iterator(); + return Iterators.concat(S2C_PACKETS.keySet().iterator(), C2S_PACKETS.keySet().iterator()); } @Override @@ -91,7 +91,7 @@ public boolean contains(RegistryKey>> key) { @Override public Set>>, Class>>> getEntrySet() { - return Collections.emptySet(); + return null; } @Override @@ -152,7 +152,7 @@ public void populateTags(Map>>, List>>> getKeys() { - return Collections.emptySet(); + return null; } } """; @@ -168,111 +168,114 @@ public static void main(String[] args) { public static void init() throws IOException { // Generate PacketUtils.java - File file = new File("src/main/java/%s/PacketUtils.java".formatted(PacketUtilsUtil.class.getPackageName().replace('.', '/'))); + File file = new File("src/main/java/" + PacketUtilsUtil.class.getPackageName().replace('.', '/') + "/PacketUtils.java"); if (!file.exists()) { file.getParentFile().mkdirs(); file.createNewFile(); } - try (BufferedWriter writer = new BufferedWriter(new FileWriter(file))) { - writer.write("/*\n"); - writer.write(" * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).\n"); - writer.write(" * Copyright (c) Meteor Development.\n"); - writer.write(" */\n\n"); - - writer.write("package meteordevelopment.meteorclient.utils.network;\n\n"); - - // Write imports - writer.write("import com.mojang.datafixers.util.Pair;\n"); - writer.write("import com.mojang.serialization.Lifecycle;\n"); - writer.write("import meteordevelopment.meteorclient.utils.misc.MeteorIdentifier;\n"); - writer.write("import net.minecraft.network.packet.Packet;\n"); - writer.write("import net.minecraft.registry.Registry;\n"); - writer.write("import net.minecraft.registry.RegistryKey;\n"); - writer.write("import net.minecraft.registry.SimpleRegistry;\n"); - writer.write("import net.minecraft.registry.entry.RegistryEntry;\n"); - writer.write("import net.minecraft.registry.entry.RegistryEntryList;\n"); - writer.write("import net.minecraft.registry.tag.TagKey;\n"); - writer.write("import net.minecraft.util.Identifier;\n"); - writer.write("import net.minecraft.util.math.random.Random;\n"); - writer.write("import org.jetbrains.annotations.NotNull;\n"); - - writer.write("import java.util.*;\n"); - writer.write("import java.util.stream.Stream;\n"); - - // Write class - writer.write("\npublic abstract class PacketUtils {\n"); - - // Write fields - writer.write(" public static final Registry>> REGISTRY = new PacketRegistry();\n\n"); - writer.write(" private static final Map>, String> S2C_PACKETS = new HashMap<>();\n"); - writer.write(" private static final Map>, String> C2S_PACKETS = new HashMap<>();\n\n"); - writer.write(" private static final Map>> S2C_PACKETS_R = new HashMap<>();\n"); - writer.write(" private static final Map>> C2S_PACKETS_R = new HashMap<>();\n\n"); - - // Write static block - writer.write(" static {\n"); - - // Client -> Sever Packets - Reflections c2s = new Reflections("net.minecraft.network.packet.c2s", Scanners.SubTypes); - Set> c2sPackets = c2s.getSubTypesOf(Packet.class); - - for (Class c2sPacket : c2sPackets) { - String name = c2sPacket.getName(); - String className = name.substring(name.lastIndexOf('.') + 1).replace('$', '.'); - String fullName = name.replace('$', '.'); - - writer.write(" C2S_PACKETS.put(%s.class, \"%s\");%n".formatted(fullName, className)); - writer.write(" C2S_PACKETS_R.put(\"%s\", %s.class);%n".formatted(className, fullName)); - } - - writer.newLine(); - - // Server -> Client Packets - Reflections s2c = new Reflections("net.minecraft.network.packet.s2c", Scanners.SubTypes); - Set> s2cPackets = s2c.getSubTypesOf(Packet.class); - - for (Class s2cPacket : s2cPackets) { - if (s2cPacket == BundlePacket.class) continue; - String name = s2cPacket.getName(); - String className = name.substring(name.lastIndexOf('.') + 1).replace('$', '.'); - String fullName = name.replace('$', '.'); - - writer.write(" S2C_PACKETS.put(%s.class, \"%s\");%n".formatted(fullName, className)); - writer.write(" S2C_PACKETS_R.put(\"%s\", %s.class);%n".formatted(className, fullName)); - } - - writer.write(" }\n\n"); - - // Write getName method - writer.write(" public static String getName(Class> packetClass) {\n"); - writer.write(" String name = S2C_PACKETS.get(packetClass);\n"); - writer.write(" if (name != null) return name;\n"); - writer.write(" return C2S_PACKETS.get(packetClass);\n"); - writer.write(" }\n\n"); - - // Write getPacket method - writer.write(" public static Class> getPacket(String name) {\n"); - writer.write(" Class> packet = S2C_PACKETS_R.get(name);\n"); - writer.write(" if (packet != null) return packet;\n"); - writer.write(" return C2S_PACKETS_R.get(name);\n"); - writer.write(" }\n\n"); - - // Write getS2CPackets method - writer.write(" public static Set>> getS2CPackets() {\n"); - writer.write(" return S2C_PACKETS.keySet();\n"); - writer.write(" }\n\n"); - - // Write getC2SPackets method - writer.write(" public static Set>> getC2SPackets() {\n"); - writer.write(" return C2S_PACKETS.keySet();\n"); - writer.write(" }\n\n"); - - // Write PacketRegistry class - writer.write(packetRegistryClass); - - // Write end class - writer.write("}\n"); + BufferedWriter writer = new BufferedWriter(new FileWriter(file)); + + writer.write("/*\n"); + writer.write(" * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).\n"); + writer.write(" * Copyright (c) Meteor Development.\n"); + writer.write(" */\n\n"); + + writer.write("package meteordevelopment.meteorclient.utils.network;\n\n"); + + // Write imports + writer.write("import com.google.common.collect.Iterators;\n"); + writer.write("import com.mojang.datafixers.util.Pair;\n"); + writer.write("import com.mojang.serialization.Lifecycle;\n"); + writer.write("import meteordevelopment.meteorclient.utils.misc.MeteorIdentifier;\n"); + writer.write("import net.minecraft.network.packet.Packet;\n"); + writer.write("import net.minecraft.registry.Registry;\n"); + writer.write("import net.minecraft.registry.RegistryKey;\n"); + writer.write("import net.minecraft.registry.SimpleRegistry;\n"); + writer.write("import net.minecraft.registry.entry.RegistryEntry;\n"); + writer.write("import net.minecraft.registry.entry.RegistryEntryList;\n"); + writer.write("import net.minecraft.registry.tag.TagKey;\n"); + writer.write("import net.minecraft.util.Identifier;\n"); + writer.write("import net.minecraft.util.math.random.Random;\n"); + writer.write("import org.jetbrains.annotations.NotNull;\n"); + + writer.write("import java.util.*;\n"); + writer.write("import java.util.stream.Stream;\n"); + + // Write class + writer.write("\npublic class PacketUtils {\n"); + + // Write fields + writer.write(" public static final Registry>> REGISTRY = new PacketRegistry();\n\n"); + writer.write(" private static final Map>, String> S2C_PACKETS = new HashMap<>();\n"); + writer.write(" private static final Map>, String> C2S_PACKETS = new HashMap<>();\n\n"); + writer.write(" private static final Map>> S2C_PACKETS_R = new HashMap<>();\n"); + writer.write(" private static final Map>> C2S_PACKETS_R = new HashMap<>();\n\n"); + + // Write static block + writer.write(" static {\n"); + + // Client -> Sever Packets + Reflections c2s = new Reflections("net.minecraft.network.packet.c2s", Scanners.SubTypes); + Set> c2sPackets = c2s.getSubTypesOf(Packet.class); + + for (Class c2sPacket : c2sPackets) { + String name = c2sPacket.getName(); + String className = name.substring(name.lastIndexOf('.') + 1).replace('$', '.'); + String fullName = name.replace('$', '.'); + + writer.write(String.format(" C2S_PACKETS.put(%s.class, \"%s\");\n", fullName, className)); + writer.write(String.format(" C2S_PACKETS_R.put(\"%s\", %s.class);\n", className, fullName)); + } + + writer.newLine(); + + // Server -> Client Packets + Reflections s2c = new Reflections("net.minecraft.network.packet.s2c", Scanners.SubTypes); + Set> s2cPackets = s2c.getSubTypesOf(Packet.class); + + for (Class s2cPacket : s2cPackets) { + if (s2cPacket == BundlePacket.class) continue; + String name = s2cPacket.getName(); + String className = name.substring(name.lastIndexOf('.') + 1).replace('$', '.'); + String fullName = name.replace('$', '.'); + + writer.write(String.format(" S2C_PACKETS.put(%s.class, \"%s\");\n", fullName, className)); + writer.write(String.format(" S2C_PACKETS_R.put(\"%s\", %s.class);\n", className, fullName)); } + + writer.write(" }\n\n"); + + // Write getName method + writer.write(" public static String getName(Class> packetClass) {\n"); + writer.write(" String name = S2C_PACKETS.get(packetClass);\n"); + writer.write(" if (name != null) return name;\n"); + writer.write(" return C2S_PACKETS.get(packetClass);\n"); + writer.write(" }\n\n"); + + // Write getPacket method + writer.write(" public static Class> getPacket(String name) {\n"); + writer.write(" Class> packet = S2C_PACKETS_R.get(name);\n"); + writer.write(" if (packet != null) return packet;\n"); + writer.write(" return C2S_PACKETS_R.get(name);\n"); + writer.write(" }\n\n"); + + // Write getS2CPackets method + writer.write(" public static Set>> getS2CPackets() {\n"); + writer.write(" return S2C_PACKETS.keySet();\n"); + writer.write(" }\n\n"); + + // Write getC2SPackets method + writer.write(" public static Set>> getC2SPackets() {\n"); + writer.write(" return C2S_PACKETS.keySet();\n"); + writer.write(" }\n\n"); + + // Write PacketRegistry class + writer.write(packetRegistryClass); + + // Write end class + writer.write("}\n"); + + writer.close(); } } diff --git a/src/main/java/meteordevelopment/meteorclient/utils/player/TitleScreenCredits.java b/src/main/java/meteordevelopment/meteorclient/utils/player/TitleScreenCredits.java index e86b163bd0..f0fc734375 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/player/TitleScreenCredits.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/player/TitleScreenCredits.java @@ -13,10 +13,11 @@ import meteordevelopment.meteorclient.gui.screens.CommitsScreen; import meteordevelopment.meteorclient.utils.network.Http; import meteordevelopment.meteorclient.utils.network.MeteorExecutor; +import meteordevelopment.meteorclient.utils.render.color.Color; +import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; -import net.minecraft.text.MutableText; -import net.minecraft.text.Text; -import net.minecraft.util.Formatting; +import net.minecraft.client.render.BufferBuilder; +import net.minecraft.client.render.VertexConsumerProvider; import java.util.ArrayList; import java.util.Comparator; @@ -24,7 +25,11 @@ import static meteordevelopment.meteorclient.MeteorClient.mc; -public abstract class TitleScreenCredits { +public class TitleScreenCredits { + private static final int WHITE = Color.fromRGBA(255, 255, 255, 255); + private static final int GRAY = Color.fromRGBA(175, 175, 175, 255); + private static final int RED = Color.fromRGBA(225, 25, 25, 255); + private static final List credits = new ArrayList<>(); private static void init() { @@ -33,7 +38,7 @@ private static void init() { for (MeteorAddon addon : AddonManager.ADDONS) add(addon); // Sort by width (Meteor always first) - credits.sort(Comparator.comparingInt(value -> value.addon == MeteorClient.ADDON ? Integer.MIN_VALUE : -mc.textRenderer.getWidth(value.text))); + credits.sort(Comparator.comparingInt(value -> value.sections.get(0).text.equals("Meteor Client ") ? Integer.MIN_VALUE : -value.width)); // Check for latest commits MeteorExecutor.execute(() -> { @@ -41,10 +46,13 @@ private static void init() { if (credit.addon.getRepo() == null || credit.addon.getCommit() == null) continue; GithubRepo repo = credit.addon.getRepo(); - Response res = Http.get("https://api.github.com/repos/%s/branches/%s".formatted(repo.getOwnerName(), repo.branch())).sendJson(Response.class); + Response res = Http.get(String.format("https://api.github.com/repos/%s/branches/%s", repo.getOwnerName(), repo.branch())).sendJson(Response.class); if (res != null && !credit.addon.getCommit().equals(res.commit.sha)) { - credit.text.append(Text.literal("*").formatted(Formatting.RED)); + synchronized (credit.sections) { + credit.sections.add(1, new Section("*", RED)); + credit.calculateWidth(); + } } } }); @@ -53,17 +61,18 @@ private static void init() { private static void add(MeteorAddon addon) { Credit credit = new Credit(addon); - credit.text.append(Text.literal(addon.name).styled(style -> style.withColor(addon.color.getPacked()))); - credit.text.append(Text.literal(" by ").formatted(Formatting.GRAY)); + credit.sections.add(new Section(addon.name, addon.color.getPacked())); + credit.sections.add(new Section(" by ", GRAY)); for (int i = 0; i < addon.authors.length; i++) { if (i > 0) { - credit.text.append(Text.literal(i == addon.authors.length - 1 ? " & " : ", ").formatted(Formatting.GRAY)); + credit.sections.add(new Section(i == addon.authors.length - 1 ? " & " : ", ", GRAY)); } - credit.text.append(Text.literal(addon.authors[i]).formatted(Formatting.WHITE)); + credit.sections.add(new Section(addon.authors[i], WHITE)); } + credit.calculateWidth(); credits.add(credit); } @@ -72,9 +81,14 @@ public static void render(DrawContext context) { int y = 3; for (Credit credit : credits) { - int x = mc.currentScreen.width - 3 - mc.textRenderer.getWidth(credit.text); + int x = mc.currentScreen.width - 3 - credit.width; - context.drawTextWithShadow(mc.textRenderer, credit.text, x, y, -1); + synchronized (credit.sections) { + for (Section section : credit.sections) { + context.drawTextWithShadow(mc.textRenderer, section.text, x, y, section.color); + x += section.width; + } + } y += mc.textRenderer.fontHeight + 2; } @@ -83,9 +97,9 @@ public static void render(DrawContext context) { public static boolean onClicked(double mouseX, double mouseY) { int y = 3; for (Credit credit : credits) { - int x = mc.currentScreen.width - 3 - mc.textRenderer.getWidth(credit.text); + int x = mc.currentScreen.width - 3 - credit.width; - if (mouseX >= x && mouseX <= x + mc.textRenderer.getWidth(credit.text) && mouseY >= y && mouseY <= y + mc.textRenderer.fontHeight + 2) { + if (mouseX >= x && mouseX <= x + credit.width && mouseY >= y && mouseY <= y + mc.textRenderer.fontHeight + 2) { if (credit.addon.getRepo() != null && credit.addon.getCommit() != null) { mc.setScreen(new CommitsScreen(GuiThemes.get(), credit.addon)); return true; @@ -100,11 +114,28 @@ public static boolean onClicked(double mouseX, double mouseY) { private static class Credit { public final MeteorAddon addon; - public final MutableText text = Text.empty(); + public final List
sections = new ArrayList<>(); + public int width; public Credit(MeteorAddon addon) { this.addon = addon; } + + public void calculateWidth() { + width = 0; + for (Section section : sections) width += section.width; + } + } + + private static class Section { + public final String text; + public final int color, width; + + public Section(String text, int color) { + this.text = text; + this.color = color; + this.width = mc.textRenderer.getWidth(text); + } } private static class Response { diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 78e9a2accf..a6cc83d676 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -19,6 +19,9 @@ "icon": "assets/meteor-client/icon.png", "environment": "client", "entrypoints": { + "preLaunch": [ + "com.llamalad7.mixinextras.MixinExtrasBootstrap::init" + ], "client": [ "meteordevelopment.meteorclient.MeteorClient" ] @@ -45,7 +48,7 @@ }, "depends": { "java": ">=17", - "minecraft": ["1.20.3", "1.20.4"], + "minecraft": "${minecraft_version}", "fabricloader": ">=${loader_version}" }, "breaks": { diff --git a/src/main/resources/meteor-client.mixins.json b/src/main/resources/meteor-client.mixins.json index 2e78a2126a..f292be27f9 100644 --- a/src/main/resources/meteor-client.mixins.json +++ b/src/main/resources/meteor-client.mixins.json @@ -138,7 +138,6 @@ "ProjectileEntityAccessor", "ProjectileInGroundAccessor", "RaycastContextMixin", - "RegistriesMixin", "ReloadStateAccessor", "RenderLayersMixin", "RenderTickCounterMixin", @@ -150,6 +149,7 @@ "SignBlockEntityRendererMixin", "SimpleEntityLookupAccessor", "SimpleOptionMixin", + "SimpleRegistryMixin", "SlimeBlockMixin", "SlotMixin", "SoundSystemMixin",