From c55ae79fedf663b70aca2122999079ad052b3ece Mon Sep 17 00:00:00 2001 From: Big Iron <52252627+Big-Iron-Cheems@users.noreply.github.com> Date: Sun, 17 Nov 2024 14:35:01 +0100 Subject: [PATCH] 1.21.2/.3 update (#4970) --- build.gradle | 2 +- gradle.properties | 18 +- gradle/wrapper/gradle-wrapper.properties | 2 +- .../transformers/GameRendererTransformer.java | 14 +- .../RegistryEntryReferenceArgumentType.java | 4 +- .../commands/commands/DamageCommand.java | 2 +- .../commands/commands/DismountCommand.java | 4 +- .../commands/commands/EnchantCommand.java | 2 +- .../commands/commands/FovCommand.java | 2 +- .../commands/commands/NbtCommand.java | 4 +- .../commands/commands/NotebotCommand.java | 8 +- .../commands/commands/SaveMapCommand.java | 7 +- .../commands/commands/VClipCommand.java | 4 +- .../commands/commands/WaypointCommand.java | 2 +- .../events/render/GetFovEvent.java | 4 +- .../events/render/RenderItemEntityEvent.java | 13 +- .../gui/DefaultSettingsWidgetFactory.java | 2 +- .../gui/renderer/GuiRenderer.java | 2 +- .../gui/screens/NotebotSongsScreen.java | 8 +- .../screens/accounts/AccountInfoScreen.java | 3 +- .../DynamicRegistryListSettingScreen.java | 2 +- .../screens/settings/PotionSettingScreen.java | 2 +- .../settings/SoundEventListSettingScreen.java | 2 +- ...StatusEffectAmplifierMapSettingScreen.java | 12 +- .../StatusEffectListSettingScreen.java | 12 +- .../meteorclient/gui/tabs/builtin/GuiTab.java | 2 +- .../mixin/AbstractBlockStateMixin.java | 5 +- ...ixin.java => AbstractBoatEntityMixin.java} | 25 +- .../AbstractFurnaceScreenHandlerMixin.java | 2 +- .../mixin/AbstractFurnaceScreenMixin.java | 9 +- .../mixin/ArmorFeatureRendererMixin.java | 13 +- .../meteorclient/mixin/ArmorTrimMixin.java | 4 +- .../mixin/BackgroundRendererMixin.java | 17 +- .../mixin/BannerBlockEntityRendererMixin.java | 6 +- .../mixin/BlockCollisionSpliteratorMixin.java | 13 +- .../meteorclient/mixin/BlockMixin.java | 6 +- .../meteorclient/mixin/BoxMixin.java | 4 +- .../meteorclient/mixin/CameraMixin.java | 2 +- .../mixin/CapabilityTrackerMixin.java | 4 +- .../mixin/CapeFeatureRendererMixin.java | 16 +- .../meteorclient/mixin/ChatHudMixin.java | 5 +- .../mixin/ChatInputSuggestorMixin.java | 8 +- .../mixin/ClientPlayNetworkHandlerMixin.java | 8 +- .../mixin/ClientPlayerEntityMixin.java | 12 +- .../meteorclient/mixin/CreativeSlotMixin.java | 4 +- .../mixin/DisconnectedScreenMixin.java | 5 +- .../meteorclient/mixin/DrawContextMixin.java | 10 +- .../mixin/ElytraFeatureRendererMixin.java | 21 +- ...chantingTableBlockEntityRendererMixin.java | 4 +- .../mixin/EndCrystalEntityModelMixin.java | 40 ++ .../mixin/EndCrystalEntityRendererMixin.java | 127 ++---- .../meteorclient/mixin/EntityMixin.java | 4 +- .../mixin/EntityRenderDispatcherMixin.java | 30 +- .../mixin/EntityRenderStateMixin.java | 28 ++ .../mixin/EntityRendererMixin.java | 36 +- .../meteorclient/mixin/ExplosionMixin.java | 45 -- .../mixin/ExplosionS2CPacketMixin.java | 39 +- .../mixin/FireworkRocketEntityMixin.java | 22 +- .../mixin/FireworksSparkParticleMixin.java | 6 +- .../meteorclient/mixin/GameRendererMixin.java | 29 +- .../mixin/HeldItemRendererMixin.java | 2 +- .../mixin/HorseBaseEntityMixin.java | 2 +- .../meteorclient/mixin/InGameHudMixin.java | 16 +- .../meteorclient/mixin/ItemEntityMixin.java | 28 -- .../mixin/ItemEntityRendererMixin.java | 16 +- .../meteorclient/mixin/ItemRendererMixin.java | 12 +- .../meteorclient/mixin/ItemStackMixin.java | 2 +- .../mixin/KeyboardInputMixin.java | 11 +- .../mixin/LightmapTextureManagerMixin.java | 16 +- .../meteorclient/mixin/LivingEntityMixin.java | 9 +- .../mixin/LivingEntityRendererMixin.java | 129 +++--- .../meteorclient/mixin/MapRendererMixin.java | 16 +- ...or.java => MapTextureManagerAccessor.java} | 8 +- .../mixin/MinecraftClientMixin.java | 27 +- .../mixin/MiningToolItemMixin.java | 34 ++ .../meteorclient/mixin/MultiPhaseMixin.java | 24 + .../mixin/MultiPhaseParametersMixin.java | 25 + .../meteorclient/mixin/PlayerEntityMixin.java | 14 +- .../mixin/PlayerEntityRendererMixin.java | 81 ++-- .../PlayerInteractEntityC2SPacketMixin.java | 4 +- .../mixin/PlayerMoveC2SPacketMixin.java | 4 +- .../PlayerPositionLookS2CPacketAccessor.java | 22 - .../mixin/ProjectileInGroundAccessor.java | 6 +- .../mixin/RaycastContextMixin.java | 2 +- .../meteorclient/mixin/ScreenMixin.java | 4 +- .../mixin/ServerPlayerEntityMixin.java | 45 ++ .../mixin/ShapeIndexBufferAccessor.java | 5 +- .../meteorclient/mixin/SimpleOptionMixin.java | 2 +- .../meteorclient/mixin/SkyRenderingMixin.java | 40 ++ .../meteorclient/mixin/SlotMixin.java | 4 +- .../meteorclient/mixin/TridentItemMixin.java | 6 +- .../meteorclient/mixin/Vec3dMixin.java | 6 +- .../meteorclient/mixin/VertexBufferMixin.java | 10 +- .../mixin/WorldRendererAccessor.java | 4 - .../mixin/WorldRendererMixin.java | 103 +++-- .../SodiumBlockOcclusionCacheMixin.java | 2 +- .../IAbstractFurnaceScreenHandler.java | 3 +- .../meteorclient/mixininterface/IBox.java | 8 +- .../meteorclient/mixininterface/ICamera.java | 2 +- .../mixininterface/ICapabilityTracker.java | 4 +- ...yRenderer.java => IEntityRenderState.java} | 7 +- .../mixininterface/IExplosionS2CPacket.java | 6 +- .../mixininterface/IHorseBaseEntity.java | 2 +- .../mixininterface/ILivingEntityRenderer.java | 16 - .../mixininterface/IMinecraftClient.java | 2 +- .../{IExplosion.java => IMiningToolItem.java} | 6 +- .../mixininterface/IMultiPhase.java | 12 + ...Entity.java => IMultiPhaseParameters.java} | 7 +- .../IPlayerInteractEntityC2SPacket.java | 4 +- .../mixininterface/IPlayerMoveC2SPacket.java | 4 +- .../mixininterface/IRaycastContext.java | 2 +- .../mixininterface/ISimpleOption.java | 2 +- .../meteorclient/mixininterface/ISlot.java | 4 +- .../meteorclient/mixininterface/IVec3d.java | 14 +- .../mixininterface/IWorldRenderer.java | 14 + .../meteorclient/renderer/Fonts.java | 2 +- .../meteorclient/renderer/Framebuffer.java | 2 +- .../meteorclient/renderer/GL.java | 31 +- .../meteorclient/renderer/Shader.java | 6 +- .../meteorclient/renderer/Texture.java | 2 +- .../renderer/text/CustomTextRenderer.java | 2 +- .../meteorclient/renderer/text/Font.java | 2 +- .../renderer/text/VanillaTextRenderer.java | 4 +- .../settings/StorageBlockListSetting.java | 34 +- .../meteorclient/systems/System.java | 4 +- .../meteorclient/systems/hud/HudRenderer.java | 4 +- .../systems/hud/elements/ArmorHud.java | 2 +- .../hud/screens/AddHudElementScreen.java | 4 +- .../meteorclient/systems/modules/Modules.java | 35 -- .../systems/modules/combat/ArrowDodge.java | 4 +- .../systems/modules/combat/AutoArmor.java | 25 +- .../systems/modules/combat/AutoTotem.java | 2 +- .../systems/modules/combat/Burrow.java | 18 +- .../systems/modules/combat/Criticals.java | 12 +- .../systems/modules/combat/CrystalAura.java | 29 +- .../systems/modules/combat/HoleFiller.java | 2 +- .../systems/modules/combat/Offhand.java | 2 +- .../systems/modules/combat/Quiver.java | 2 +- .../systems/modules/misc/BetterChat.java | 7 +- .../systems/modules/misc/InventoryTweaks.java | 12 - .../systems/modules/misc/Notebot.java | 2 +- .../systems/modules/misc/Notifier.java | 2 +- .../systems/modules/misc/SoundBlocker.java | 2 +- .../systems/modules/movement/Anchor.java | 2 +- .../systems/modules/movement/AutoJump.java | 2 +- .../systems/modules/movement/AutoWalk.java | 3 +- .../systems/modules/movement/AutoWasp.java | 12 +- .../systems/modules/movement/BoatFly.java | 2 +- .../systems/modules/movement/ElytraBoost.java | 2 +- .../modules/movement/EntityControl.java | 4 +- .../systems/modules/movement/EntitySpeed.java | 2 +- .../systems/modules/movement/Flight.java | 6 +- .../systems/modules/movement/Jesus.java | 22 +- .../systems/modules/movement/LongJump.java | 12 +- .../systems/modules/movement/NoFall.java | 8 +- .../systems/modules/movement/ReverseStep.java | 2 +- .../systems/modules/movement/Scaffold.java | 2 +- .../systems/modules/movement/Sprint.java | 4 +- .../systems/modules/movement/Step.java | 6 +- .../systems/modules/movement/Velocity.java | 2 +- .../movement/elytrafly/ElytraFlightMode.java | 4 +- .../modules/movement/elytrafly/ElytraFly.java | 32 +- .../movement/elytrafly/modes/Bounce.java | 15 +- .../movement/elytrafly/modes/Packet.java | 2 +- .../systems/modules/movement/speed/Speed.java | 4 +- .../modules/movement/speed/modes/Strafe.java | 4 +- .../modules/movement/speed/modes/Vanilla.java | 2 +- .../systems/modules/player/AutoEat.java | 1 + .../systems/modules/player/AutoGap.java | 1 + .../systems/modules/player/AutoTool.java | 2 +- .../systems/modules/player/ChestSwap.java | 13 +- .../systems/modules/player/NoRotate.java | 18 +- .../modules/render/BetterTooltips.java | 37 +- .../systems/modules/render/Blur.java | 4 +- .../systems/modules/render/Chams.java | 49 +- .../systems/modules/render/ItemPhysics.java | 22 +- .../systems/modules/render/PopChams.java | 6 +- .../systems/modules/render/StorageESP.java | 4 +- .../systems/modules/render/TimeChanger.java | 6 +- .../systems/modules/render/Tracers.java | 2 +- .../systems/modules/render/UnfocusedCPU.java | 29 -- .../systems/modules/render/Xray.java | 13 +- .../systems/modules/world/Ambience.java | 5 - .../systems/modules/world/AutoSmelter.java | 16 +- .../systems/modules/world/BuildHeight.java | 2 +- .../systems/modules/world/Collisions.java | 2 +- .../systems/modules/world/HighwayBuilder.java | 26 +- .../systems/modules/world/MountBypass.java | 2 +- .../meteorclient/systems/proxies/Proxy.java | 8 +- .../systems/waypoints/Waypoint.java | 2 +- .../meteorclient/utils/Utils.java | 10 +- .../utils/entity/DamageUtils.java | 21 +- .../utils/entity/EntityUtils.java | 6 +- .../entity/ProjectileEntitySimulator.java | 8 +- .../utils/entity/TargetUtils.java | 4 +- .../meteorclient/utils/files/StreamUtils.java | 2 +- .../utils/misc/FakeClientPlayer.java | 6 +- .../utils/misc/MeteorStarscript.java | 11 +- .../meteorclient/utils/misc/Names.java | 2 +- .../meteorclient/utils/misc/NbtUtils.java | 2 +- .../utils/misc/text/RunnableClickEvent.java | 1 - .../meteorclient/utils/network/Capes.java | 2 +- .../utils/network/PacketUtils.java | 77 ++-- .../utils/network/PacketUtilsUtil.java | 36 +- .../utils/notebot/decoder/NBSSongDecoder.java | 8 - .../utils/player/CustomPlayerInput.java | 100 +++- .../utils/player/InventorySorter.java | 6 +- .../utils/player/PlayerUtils.java | 18 +- .../meteorclient/utils/player/Rotations.java | 2 +- .../utils/player/TitleScreenCredits.java | 8 +- .../utils/render/MeteorToast.java | 33 +- .../meteorclient/utils/render/PeekScreen.java | 8 +- .../utils/render/RenderUtils.java | 21 +- .../utils/render/SimpleBlockRenderer.java | 2 +- .../utils/render/WireframeEntityRenderer.java | 429 +++++------------- .../render/postprocess/EntityShader.java | 21 +- .../render/postprocess/PostProcessShader.java | 9 +- .../postprocess/StorageOutlineShader.java | 2 +- .../utils/tooltip/BannerTooltipComponent.java | 10 +- .../utils/tooltip/BookTooltipComponent.java | 10 +- .../tooltip/ContainerTooltipComponent.java | 9 +- .../utils/tooltip/EntityTooltipComponent.java | 6 +- .../utils/tooltip/MapTooltipComponent.java | 15 +- .../utils/world/BlockIterator.java | 2 +- .../meteorclient/utils/world/BlockUtils.java | 12 +- src/main/resources/fabric.mod.json | 4 +- .../resources/meteor-client.accesswidener | 64 +-- src/main/resources/meteor-client.mixins.json | 14 +- 228 files changed, 1530 insertions(+), 1760 deletions(-) rename src/main/java/meteordevelopment/meteorclient/mixin/{BoatEntityMixin.java => AbstractBoatEntityMixin.java} (60%) create mode 100644 src/main/java/meteordevelopment/meteorclient/mixin/EndCrystalEntityModelMixin.java create mode 100644 src/main/java/meteordevelopment/meteorclient/mixin/EntityRenderStateMixin.java delete mode 100644 src/main/java/meteordevelopment/meteorclient/mixin/ExplosionMixin.java delete mode 100644 src/main/java/meteordevelopment/meteorclient/mixin/ItemEntityMixin.java rename src/main/java/meteordevelopment/meteorclient/mixin/{MapRendererAccessor.java => MapTextureManagerAccessor.java} (65%) create mode 100644 src/main/java/meteordevelopment/meteorclient/mixin/MiningToolItemMixin.java create mode 100644 src/main/java/meteordevelopment/meteorclient/mixin/MultiPhaseMixin.java create mode 100644 src/main/java/meteordevelopment/meteorclient/mixin/MultiPhaseParametersMixin.java delete mode 100644 src/main/java/meteordevelopment/meteorclient/mixin/PlayerPositionLookS2CPacketAccessor.java create mode 100644 src/main/java/meteordevelopment/meteorclient/mixin/ServerPlayerEntityMixin.java create mode 100644 src/main/java/meteordevelopment/meteorclient/mixin/SkyRenderingMixin.java rename src/main/java/meteordevelopment/meteorclient/mixininterface/{IEntityRenderer.java => IEntityRenderState.java} (66%) delete mode 100644 src/main/java/meteordevelopment/meteorclient/mixininterface/ILivingEntityRenderer.java rename src/main/java/meteordevelopment/meteorclient/mixininterface/{IExplosion.java => IMiningToolItem.java} (62%) create mode 100644 src/main/java/meteordevelopment/meteorclient/mixininterface/IMultiPhase.java rename src/main/java/meteordevelopment/meteorclient/mixininterface/{IItemEntity.java => IMultiPhaseParameters.java} (61%) create mode 100644 src/main/java/meteordevelopment/meteorclient/mixininterface/IWorldRenderer.java delete mode 100644 src/main/java/meteordevelopment/meteorclient/systems/modules/render/UnfocusedCPU.java diff --git a/build.gradle b/build.gradle index a393cdce14..96ae6c3abe 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id "fabric-loom" version "1.7-SNAPSHOT" + id "fabric-loom" version "1.8-SNAPSHOT" id "maven-publish" id "com.github.johnrengelman.shadow" version "8.1.1" } diff --git a/gradle.properties b/gradle.properties index 628f732f40..811b7111f3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,10 +1,10 @@ org.gradle.jvmargs=-Xmx2G # Fabric (https://fabricmc.net/develop) -minecraft_version=1.21.1 -yarn_mappings=1.21.1+build.3 -loader_version=0.15.11 -fapi_version=0.102.1+1.21.1 +minecraft_version=1.21.3 +yarn_mappings=1.21.3+build.2 +loader_version=0.16.9 +fapi_version=0.108.0+1.21.3 # Mod Properties mod_version=0.5.9 @@ -14,16 +14,16 @@ archives_base_name=meteor-client # Dependency Versions # Baritone (https://github.com/MeteorDevelopment/baritone) -baritone_version=1.21 +baritone_version=1.21.3 # Sodium (https://github.com/CaffeineMC/sodium-fabric) -sodium_version=mc1.21-0.6.0-beta.2-fabric +sodium_version=mc1.21.3-0.6.0-fabric # Lithium (https://github.com/CaffeineMC/lithium-fabric) -lithium_version=mc1.21.1-0.14.0-beta.1 +lithium_version=mc1.21.3-0.14.2 # Iris (https://github.com/IrisShaders/Iris) -iris_version=1.7.3+1.21 +iris_version=1.8.0+1.21.3-fabric # Orbit (https://github.com/MeteorDevelopment/orbit) orbit_version=0.2.4 @@ -41,7 +41,7 @@ reflections_version=0.10.2 netty_version=4.1.90.Final # ViaFabricPlus (https://github.com/ViaVersion/ViaFabricPlus) -viafabricplus_version=3.4.4 +viafabricplus_version=3.5.1 # WaybackAuthLib (https://github.com/FlorianMichael/WaybackAuthLib) waybackauthlib_version=1.0.1 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0d1842103b..e1adfb4938 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/meteordevelopment/meteorclient/asm/transformers/GameRendererTransformer.java b/src/main/java/meteordevelopment/meteorclient/asm/transformers/GameRendererTransformer.java index c8c5ea1fb2..53d90d925e 100644 --- a/src/main/java/meteordevelopment/meteorclient/asm/transformers/GameRendererTransformer.java +++ b/src/main/java/meteordevelopment/meteorclient/asm/transformers/GameRendererTransformer.java @@ -17,7 +17,7 @@ public class GameRendererTransformer extends AsmTransformer { public GameRendererTransformer() { super(mapClassName("net/minecraft/class_757")); - getFovMethod = new MethodInfo("net/minecraft/class_4184", null, new Descriptor("Lnet/minecraft/class_4184;", "F", "Z", "D"), true); + getFovMethod = new MethodInfo("net/minecraft/class_4184", null, new Descriptor("Lnet/minecraft/class_4184;", "F", "Z", "F"), true); } @Override @@ -30,7 +30,7 @@ public void transform(ClassNode klass) { //noinspection DataFlowIssue for (AbstractInsnNode insn : method.instructions) { - if (insn instanceof LdcInsnNode in && in.cst instanceof Double && (double) in.cst == 90) { + if (insn instanceof LdcInsnNode in && in.cst instanceof Float && (float) in.cst == 90) { InsnList insns = new InsnList(); generateEventCall(insns, new LdcInsnNode(in.cst)); @@ -39,14 +39,14 @@ public void transform(ClassNode klass) { injectionCount++; } else if ( - (insn instanceof MethodInsnNode in1 && in1.name.equals("intValue") && insn.getNext() instanceof InsnNode _in && _in.getOpcode() == Opcodes.I2D) + (insn instanceof MethodInsnNode in1 && in1.name.equals("intValue") && insn.getNext() instanceof InsnNode _in && _in.getOpcode() == Opcodes.I2F) || (insn instanceof MethodInsnNode in2 && in2.owner.equals(klass.name) && in2.name.startsWith("redirect") && in2.name.endsWith("getFov")) // Wi Zoom compatibility ) { InsnList insns = new InsnList(); - insns.add(new VarInsnNode(Opcodes.DSTORE, method.maxLocals)); - generateEventCall(insns, new VarInsnNode(Opcodes.DLOAD, method.maxLocals)); + insns.add(new VarInsnNode(Opcodes.FSTORE, method.maxLocals)); + generateEventCall(insns, new VarInsnNode(Opcodes.FLOAD, method.maxLocals)); method.instructions.insert(insn.getNext(), insns); injectionCount++; @@ -59,9 +59,9 @@ else if ( private void generateEventCall(InsnList insns, AbstractInsnNode loadPreviousFov) { insns.add(new FieldInsnNode(Opcodes.GETSTATIC, "meteordevelopment/meteorclient/MeteorClient", "EVENT_BUS", "Lmeteordevelopment/orbit/IEventBus;")); insns.add(loadPreviousFov); - insns.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "meteordevelopment/meteorclient/events/render/GetFovEvent", "get", "(D)Lmeteordevelopment/meteorclient/events/render/GetFovEvent;")); + insns.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "meteordevelopment/meteorclient/events/render/GetFovEvent", "get", "(F)Lmeteordevelopment/meteorclient/events/render/GetFovEvent;")); insns.add(new MethodInsnNode(Opcodes.INVOKEINTERFACE, "meteordevelopment/orbit/IEventBus", "post", "(Ljava/lang/Object;)Ljava/lang/Object;")); insns.add(new TypeInsnNode(Opcodes.CHECKCAST, "meteordevelopment/meteorclient/events/render/GetFovEvent")); - insns.add(new FieldInsnNode(Opcodes.GETFIELD, "meteordevelopment/meteorclient/events/render/GetFovEvent", "fov", "D")); + insns.add(new FieldInsnNode(Opcodes.GETFIELD, "meteordevelopment/meteorclient/events/render/GetFovEvent", "fov", "F")); } } diff --git a/src/main/java/meteordevelopment/meteorclient/commands/arguments/RegistryEntryReferenceArgumentType.java b/src/main/java/meteordevelopment/meteorclient/commands/arguments/RegistryEntryReferenceArgumentType.java index aed87cebef..7db6039a51 100644 --- a/src/main/java/meteordevelopment/meteorclient/commands/arguments/RegistryEntryReferenceArgumentType.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/arguments/RegistryEntryReferenceArgumentType.java @@ -106,14 +106,14 @@ public RegistryEntry.Reference parse(StringReader reader) throws CommandSynta Identifier identifier = Identifier.fromCommandInput(reader); RegistryKey registryKey = RegistryKey.of(this.registryRef, identifier); return MinecraftClient.getInstance().getNetworkHandler().getRegistryManager() - .getWrapperOrThrow(this.registryRef) + .getOrThrow(this.registryRef) .getOptional(registryKey) .orElseThrow(() -> NOT_FOUND_EXCEPTION.createWithContext(reader, identifier, this.registryRef.getValue())); } @Override public CompletableFuture listSuggestions(CommandContext context, SuggestionsBuilder builder) { - return CommandSource.suggestIdentifiers(MinecraftClient.getInstance().getNetworkHandler().getRegistryManager().getWrapperOrThrow(this.registryRef).streamKeys().map(RegistryKey::getValue), builder); + return CommandSource.suggestIdentifiers(MinecraftClient.getInstance().getNetworkHandler().getRegistryManager().getOrThrow(this.registryRef).streamKeys().map(RegistryKey::getValue), builder); } @Override diff --git a/src/main/java/meteordevelopment/meteorclient/commands/commands/DamageCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/DamageCommand.java index 1da52c8ca9..89f48f34d8 100644 --- a/src/main/java/meteordevelopment/meteorclient/commands/commands/DamageCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/DamageCommand.java @@ -60,6 +60,6 @@ private void damagePlayer(int amount) { } private void sendPositionPacket(double x, double y, double z, boolean onGround) { - mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y, z, onGround)); + mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y, z, onGround, mc.player.horizontalCollision)); } } diff --git a/src/main/java/meteordevelopment/meteorclient/commands/commands/DismountCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/DismountCommand.java index ece93ae0ec..1cbdfb84cd 100644 --- a/src/main/java/meteordevelopment/meteorclient/commands/commands/DismountCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/DismountCommand.java @@ -9,6 +9,7 @@ import meteordevelopment.meteorclient.commands.Command; import net.minecraft.command.CommandSource; import net.minecraft.network.packet.c2s.play.PlayerInputC2SPacket; +import net.minecraft.util.PlayerInput; public class DismountCommand extends Command { public DismountCommand() { @@ -18,7 +19,8 @@ public DismountCommand() { @Override public void build(LiteralArgumentBuilder builder) { builder.executes(context -> { - mc.getNetworkHandler().sendPacket(new PlayerInputC2SPacket(0, 0, false, true)); + PlayerInput sneak = new PlayerInput(false, false, false, false, false, true, false); + mc.getNetworkHandler().sendPacket(new PlayerInputC2SPacket(sneak)); return SINGLE_SUCCESS; }); } diff --git a/src/main/java/meteordevelopment/meteorclient/commands/commands/EnchantCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/EnchantCommand.java index 1576d6d960..7eb9e6b584 100644 --- a/src/main/java/meteordevelopment/meteorclient/commands/commands/EnchantCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/EnchantCommand.java @@ -96,7 +96,7 @@ private void one(CommandContext context, ToIntFunction level) throws CommandSyntaxException { ItemStack itemStack = tryGetItemStack(); - mc.getNetworkHandler().getRegistryManager().getOptionalWrapper(RegistryKeys.ENCHANTMENT).ifPresent(registry -> { + mc.getNetworkHandler().getRegistryManager().getOptional(RegistryKeys.ENCHANTMENT).ifPresent(registry -> { registry.streamEntries().forEach(enchantment -> { if (!onlyPossible || enchantment.value().isAcceptableItem(itemStack)) { Utils.addEnchantment(itemStack, enchantment, level.applyAsInt(enchantment.value())); diff --git a/src/main/java/meteordevelopment/meteorclient/commands/commands/FovCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/FovCommand.java index 225e015075..f758d5bfc5 100644 --- a/src/main/java/meteordevelopment/meteorclient/commands/commands/FovCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/FovCommand.java @@ -19,7 +19,7 @@ public FovCommand() { @Override public void build(LiteralArgumentBuilder builder) { builder.then(argument("fov", IntegerArgumentType.integer(0, 180)).executes(context -> { - ((ISimpleOption) (Object) mc.options.getFov()).set(context.getArgument("fov", Integer.class)); + ((ISimpleOption) (Object) mc.options.getFov()).meteor$set(context.getArgument("fov", Integer.class)); return SINGLE_SUCCESS; })); } diff --git a/src/main/java/meteordevelopment/meteorclient/commands/commands/NbtCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/NbtCommand.java index c4f716aa07..4e4cbf9e64 100644 --- a/src/main/java/meteordevelopment/meteorclient/commands/commands/NbtCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/NbtCommand.java @@ -79,7 +79,7 @@ public void build(LiteralArgumentBuilder builder) { if (validBasic(stack)) { ComponentMap components = ComponentMapArgumentType.getComponentMap(ctx, "component"); - ComponentMapImpl stackComponents = (ComponentMapImpl) stack.getComponents(); + MergedComponentMap stackComponents = (MergedComponentMap) stack.getComponents(); DataResult dataResult = ItemStack.validateComponents(components); dataResult.getOrThrow(MALFORMED_ITEM_EXCEPTION::create); @@ -115,7 +115,7 @@ public void build(LiteralArgumentBuilder builder) { ComponentType componentType = Registries.DATA_COMPONENT_TYPE.get(componentTypeKey); - ComponentMapImpl components = (ComponentMapImpl) stack.getComponents(); + MergedComponentMap components = (MergedComponentMap) stack.getComponents(); components.applyChanges(ComponentChanges.builder().remove(componentType).build()); setStack(stack); diff --git a/src/main/java/meteordevelopment/meteorclient/commands/commands/NotebotCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/NotebotCommand.java index f826c7db38..ee791ce2fc 100644 --- a/src/main/java/meteordevelopment/meteorclient/commands/commands/NotebotCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/NotebotCommand.java @@ -34,8 +34,8 @@ import java.util.Map; public class NotebotCommand extends Command { - private final static SimpleCommandExceptionType INVALID_SONG = new SimpleCommandExceptionType(Text.literal("Invalid song.")); - private final static DynamicCommandExceptionType INVALID_PATH = new DynamicCommandExceptionType(object -> Text.literal("'%s' is not a valid path.".formatted(object))); + private static final SimpleCommandExceptionType INVALID_SONG = new SimpleCommandExceptionType(Text.literal("Invalid song.")); + private static final DynamicCommandExceptionType INVALID_PATH = new DynamicCommandExceptionType(object -> Text.literal("'%s' is not a valid path.".formatted(object))); int ticks = -1; private final Map> song = new HashMap<>(); // tick -> notes @@ -144,7 +144,7 @@ private void onTick(TickEvent.Post event) { @EventHandler private void onReadPacket(PacketEvent.Receive event) { - if (event.packet instanceof PlaySoundS2CPacket sound && sound.getSound().value().getId().getPath().contains("note_block")) { + if (event.packet instanceof PlaySoundS2CPacket sound && sound.getSound().value().id().getPath().contains("note_block")) { if (ticks == -1) ticks = 0; List notes = song.computeIfAbsent(ticks, tick -> new ArrayList<>()); var note = getNote(sound); @@ -212,7 +212,7 @@ private Note getNote(PlaySoundS2CPacket soundPacket) { } private NoteBlockInstrument getInstrumentFromSound(SoundEvent sound) { - String path = sound.getId().getPath(); + String path = sound.id().getPath(); if (path.contains("harp")) return NoteBlockInstrument.HARP; else if (path.contains("basedrum")) diff --git a/src/main/java/meteordevelopment/meteorclient/commands/commands/SaveMapCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/SaveMapCommand.java index ee9bbcabcf..8d5ba1fed4 100644 --- a/src/main/java/meteordevelopment/meteorclient/commands/commands/SaveMapCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/SaveMapCommand.java @@ -11,8 +11,9 @@ import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; import meteordevelopment.meteorclient.MeteorClient; import meteordevelopment.meteorclient.commands.Command; -import meteordevelopment.meteorclient.mixin.MapRendererAccessor; +import meteordevelopment.meteorclient.mixin.MapTextureManagerAccessor; import net.minecraft.client.render.MapRenderer; +import net.minecraft.client.texture.MapTextureManager; import net.minecraft.command.CommandSource; import net.minecraft.component.DataComponentTypes; import net.minecraft.item.FilledMapItem; @@ -70,8 +71,8 @@ private void saveMap(int scale) throws CommandSyntaxException { File path = getPath(); if (path == null) throw OOPS.create(); - MapRenderer mapRenderer = mc.gameRenderer.getMapRenderer(); - MapRenderer.MapTexture texture = ((MapRendererAccessor) mapRenderer).invokeGetMapTexture(map.get(DataComponentTypes.MAP_ID), state); + MapRenderer mapRenderer = mc.gameRenderer.getClient().getMapRenderer(); + MapTextureManager.MapTexture texture = ((MapTextureManagerAccessor) mapRenderer).invokeGetMapTexture(map.get(DataComponentTypes.MAP_ID), state); if (texture.texture.getImage() == null) throw OOPS.create(); try { diff --git a/src/main/java/meteordevelopment/meteorclient/commands/commands/VClipCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/VClipCommand.java index e4a04d056f..b74103bb75 100644 --- a/src/main/java/meteordevelopment/meteorclient/commands/commands/VClipCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/VClipCommand.java @@ -49,10 +49,10 @@ public void build(LiteralArgumentBuilder builder) { // No vehicle version // For each 10 blocks, send a player move packet with no delta for (int packetNumber = 0; packetNumber < (packetsRequired - 1); packetNumber++) { - mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.OnGroundOnly(true)); + mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.OnGroundOnly(true, mc.player.horizontalCollision)); } // Now send the final player move packet - mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), mc.player.getY() + blocks, mc.player.getZ(), true)); + mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), mc.player.getY() + blocks, mc.player.getZ(), true, mc.player.horizontalCollision)); mc.player.setPosition(mc.player.getX(), mc.player.getY() + blocks, mc.player.getZ()); } diff --git a/src/main/java/meteordevelopment/meteorclient/commands/commands/WaypointCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/WaypointCommand.java index 5771766766..554046ad1f 100644 --- a/src/main/java/meteordevelopment/meteorclient/commands/commands/WaypointCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/WaypointCommand.java @@ -84,7 +84,7 @@ private String waypointFullPos(Waypoint waypoint) { private int addWaypoint(CommandContext context, boolean withCoords) { if (mc.player == null) return -1; - BlockPos pos = withCoords ? context.getArgument("pos", PosArgument.class).toAbsoluteBlockPos(mc.player.getCommandSource()) : mc.player.getBlockPos().up(2); + BlockPos pos = withCoords ? context.getArgument("pos", PosArgument.class).toAbsoluteBlockPos(mc.player.getCommandSource(mc.getServer().getOverworld())) : mc.player.getBlockPos().up(2); Waypoint waypoint = new Waypoint.Builder() .name(StringArgumentType.getString(context, "waypoint")) .pos(pos) diff --git a/src/main/java/meteordevelopment/meteorclient/events/render/GetFovEvent.java b/src/main/java/meteordevelopment/meteorclient/events/render/GetFovEvent.java index 85ac0b9ab5..228ddbd404 100644 --- a/src/main/java/meteordevelopment/meteorclient/events/render/GetFovEvent.java +++ b/src/main/java/meteordevelopment/meteorclient/events/render/GetFovEvent.java @@ -8,9 +8,9 @@ public class GetFovEvent { private static final GetFovEvent INSTANCE = new GetFovEvent(); - public double fov; + public float fov; - public static GetFovEvent get(double fov) { + public static GetFovEvent get(float fov) { INSTANCE.fov = fov; return INSTANCE; } diff --git a/src/main/java/meteordevelopment/meteorclient/events/render/RenderItemEntityEvent.java b/src/main/java/meteordevelopment/meteorclient/events/render/RenderItemEntityEvent.java index 7ad5fb9556..759303318a 100644 --- a/src/main/java/meteordevelopment/meteorclient/events/render/RenderItemEntityEvent.java +++ b/src/main/java/meteordevelopment/meteorclient/events/render/RenderItemEntityEvent.java @@ -6,33 +6,32 @@ package meteordevelopment.meteorclient.events.render; import meteordevelopment.meteorclient.events.Cancellable; +import meteordevelopment.meteorclient.mixininterface.IEntityRenderState; import net.minecraft.client.render.VertexConsumerProvider; +import net.minecraft.client.render.entity.state.ItemEntityRenderState; import net.minecraft.client.render.item.ItemRenderer; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.ItemEntity; -import net.minecraft.util.math.random.Random; public class RenderItemEntityEvent extends Cancellable { private static final RenderItemEntityEvent INSTANCE = new RenderItemEntityEvent(); public ItemEntity itemEntity; - public float f; + public ItemEntityRenderState renderState; public float tickDelta; public MatrixStack matrixStack; public VertexConsumerProvider vertexConsumerProvider; public int light; - public Random random; public ItemRenderer itemRenderer; - public static RenderItemEntityEvent get(ItemEntity itemEntity, float f, float tickDelta, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int light, Random random, ItemRenderer itemRenderer) { + public static RenderItemEntityEvent get(ItemEntityRenderState renderState, float tickDelta, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int light, ItemRenderer itemRenderer) { INSTANCE.setCancelled(false); - INSTANCE.itemEntity = itemEntity; - INSTANCE.f = f; + INSTANCE.itemEntity = (ItemEntity) ((IEntityRenderState) renderState).meteor$getEntity(); + INSTANCE.renderState = renderState; INSTANCE.tickDelta = tickDelta; INSTANCE.matrixStack = matrixStack; INSTANCE.vertexConsumerProvider = vertexConsumerProvider; INSTANCE.light = light; - INSTANCE.random = random; INSTANCE.itemRenderer = itemRenderer; return INSTANCE; } diff --git a/src/main/java/meteordevelopment/meteorclient/gui/DefaultSettingsWidgetFactory.java b/src/main/java/meteordevelopment/meteorclient/gui/DefaultSettingsWidgetFactory.java index 094c9629b0..457e28e319 100644 --- a/src/main/java/meteordevelopment/meteorclient/gui/DefaultSettingsWidgetFactory.java +++ b/src/main/java/meteordevelopment/meteorclient/gui/DefaultSettingsWidgetFactory.java @@ -344,7 +344,7 @@ private void blockDataW(WTable table, BlockDataSetting setting) { private void potionW(WTable table, PotionSetting setting) { WHorizontalList list = table.add(theme.horizontalList()).expandX().widget(); - WItemWithLabel item = list.add(theme.itemWithLabel(setting.get().potion, I18n.translate(setting.get().potion.getTranslationKey()))).widget(); + WItemWithLabel item = list.add(theme.itemWithLabel(setting.get().potion, I18n.translate(setting.get().potion.getItem().getTranslationKey()))).widget(); WButton button = list.add(theme.button("Select")).expandCellX().widget(); button.action = () -> { diff --git a/src/main/java/meteordevelopment/meteorclient/gui/renderer/GuiRenderer.java b/src/main/java/meteordevelopment/meteorclient/gui/renderer/GuiRenderer.java index 915564e14f..8957abf3b9 100644 --- a/src/main/java/meteordevelopment/meteorclient/gui/renderer/GuiRenderer.java +++ b/src/main/java/meteordevelopment/meteorclient/gui/renderer/GuiRenderer.java @@ -106,7 +106,7 @@ public void endRender() { r.render(drawContext.getMatrices()); - GL.bindTexture(TEXTURE.getGlId()); + GL.getTexture(TEXTURE.getGlId()); rTex.render(drawContext.getMatrices()); // Normal text diff --git a/src/main/java/meteordevelopment/meteorclient/gui/screens/NotebotSongsScreen.java b/src/main/java/meteordevelopment/meteorclient/gui/screens/NotebotSongsScreen.java index 6a97c41514..7ec54b7472 100644 --- a/src/main/java/meteordevelopment/meteorclient/gui/screens/NotebotSongsScreen.java +++ b/src/main/java/meteordevelopment/meteorclient/gui/screens/NotebotSongsScreen.java @@ -84,13 +84,9 @@ private void addPath(Path path) { table.add(theme.label(FilenameUtils.getBaseName(path.getFileName().toString()))).expandCellX(); WButton load = table.add(theme.button("Load")).right().widget(); - load.action = () -> { - notebot.loadSong(path.toFile()); - }; + load.action = () -> notebot.loadSong(path.toFile()); WButton preview = table.add(theme.button("Preview")).right().widget(); - preview.action = () -> { - notebot.previewSong(path.toFile()); - }; + preview.action = () -> notebot.previewSong(path.toFile()); table.row(); } diff --git a/src/main/java/meteordevelopment/meteorclient/gui/screens/accounts/AccountInfoScreen.java b/src/main/java/meteordevelopment/meteorclient/gui/screens/accounts/AccountInfoScreen.java index 19d5ab57b6..d4b53a1d45 100644 --- a/src/main/java/meteordevelopment/meteorclient/gui/screens/accounts/AccountInfoScreen.java +++ b/src/main/java/meteordevelopment/meteorclient/gui/screens/accounts/AccountInfoScreen.java @@ -10,14 +10,13 @@ import meteordevelopment.meteorclient.gui.widgets.containers.WHorizontalList; import meteordevelopment.meteorclient.gui.widgets.pressable.WButton; import meteordevelopment.meteorclient.systems.accounts.Account; -import meteordevelopment.meteorclient.systems.accounts.AccountType; import meteordevelopment.meteorclient.systems.accounts.TokenAccount; import meteordevelopment.meteorclient.utils.render.color.Color; import static meteordevelopment.meteorclient.MeteorClient.mc; public class AccountInfoScreen extends WindowScreen { - private Account account; + private final Account account; public AccountInfoScreen(GuiTheme theme, Account account) { super(theme, account.getUsername() + " details"); diff --git a/src/main/java/meteordevelopment/meteorclient/gui/screens/settings/DynamicRegistryListSettingScreen.java b/src/main/java/meteordevelopment/meteorclient/gui/screens/settings/DynamicRegistryListSettingScreen.java index 65f40c4636..a0d13065c4 100644 --- a/src/main/java/meteordevelopment/meteorclient/gui/screens/settings/DynamicRegistryListSettingScreen.java +++ b/src/main/java/meteordevelopment/meteorclient/gui/screens/settings/DynamicRegistryListSettingScreen.java @@ -97,7 +97,7 @@ private void generateWidgets() { try { Identifier id = entry.contains(":") ? Identifier.of(entry) : Identifier.ofVanilla(entry); addValue(RegistryKey.of(registryKey, id)); - } catch (InvalidIdentifierException e) {} + } catch (InvalidIdentifierException ignored) {} }; table.add(theme.verticalSeparator()).expandWidgetY(); diff --git a/src/main/java/meteordevelopment/meteorclient/gui/screens/settings/PotionSettingScreen.java b/src/main/java/meteordevelopment/meteorclient/gui/screens/settings/PotionSettingScreen.java index db4612882e..398c24f32e 100644 --- a/src/main/java/meteordevelopment/meteorclient/gui/screens/settings/PotionSettingScreen.java +++ b/src/main/java/meteordevelopment/meteorclient/gui/screens/settings/PotionSettingScreen.java @@ -27,7 +27,7 @@ public void initWidgets() { WTable table = add(theme.table()).expandX().widget(); for (MyPotion potion : MyPotion.values()) { - table.add(theme.itemWithLabel(potion.potion, I18n.translate(potion.potion.getTranslationKey()))); + table.add(theme.itemWithLabel(potion.potion, I18n.translate(potion.potion.getItem().getTranslationKey()))); WButton select = table.add(theme.button("Select")).widget(); select.action = () -> { diff --git a/src/main/java/meteordevelopment/meteorclient/gui/screens/settings/SoundEventListSettingScreen.java b/src/main/java/meteordevelopment/meteorclient/gui/screens/settings/SoundEventListSettingScreen.java index e2c58db1ac..3c098c47df 100644 --- a/src/main/java/meteordevelopment/meteorclient/gui/screens/settings/SoundEventListSettingScreen.java +++ b/src/main/java/meteordevelopment/meteorclient/gui/screens/settings/SoundEventListSettingScreen.java @@ -25,6 +25,6 @@ protected WWidget getValueWidget(SoundEvent value) { @Override protected String getValueName(SoundEvent value) { - return value.getId().getPath(); + return value.id().getPath(); } } diff --git a/src/main/java/meteordevelopment/meteorclient/gui/screens/settings/StatusEffectAmplifierMapSettingScreen.java b/src/main/java/meteordevelopment/meteorclient/gui/screens/settings/StatusEffectAmplifierMapSettingScreen.java index 6914e30680..f90e8b5131 100644 --- a/src/main/java/meteordevelopment/meteorclient/gui/screens/settings/StatusEffectAmplifierMapSettingScreen.java +++ b/src/main/java/meteordevelopment/meteorclient/gui/screens/settings/StatusEffectAmplifierMapSettingScreen.java @@ -78,10 +78,14 @@ private void initTable() { private ItemStack getPotionStack(StatusEffect effect) { ItemStack potion = Items.POTION.getDefaultStack(); - potion.set(DataComponentTypes.POTION_CONTENTS, new PotionContentsComponent( - potion.get(DataComponentTypes.POTION_CONTENTS).potion(), - Optional.of(effect.getColor()), - potion.get(DataComponentTypes.POTION_CONTENTS).customEffects()) + potion.set( + DataComponentTypes.POTION_CONTENTS, + new PotionContentsComponent( + potion.get(DataComponentTypes.POTION_CONTENTS).potion(), + Optional.of(effect.getColor()), + potion.get(DataComponentTypes.POTION_CONTENTS).customEffects(), + Optional.empty() + ) ); return potion; diff --git a/src/main/java/meteordevelopment/meteorclient/gui/screens/settings/StatusEffectListSettingScreen.java b/src/main/java/meteordevelopment/meteorclient/gui/screens/settings/StatusEffectListSettingScreen.java index 83862b286e..9b3d01dd14 100644 --- a/src/main/java/meteordevelopment/meteorclient/gui/screens/settings/StatusEffectListSettingScreen.java +++ b/src/main/java/meteordevelopment/meteorclient/gui/screens/settings/StatusEffectListSettingScreen.java @@ -37,10 +37,14 @@ protected String getValueName(StatusEffect value) { private ItemStack getPotionStack(StatusEffect effect) { ItemStack potion = Items.POTION.getDefaultStack(); - potion.set(DataComponentTypes.POTION_CONTENTS, new PotionContentsComponent( - potion.get(DataComponentTypes.POTION_CONTENTS).potion(), - Optional.of(effect.getColor()), - potion.get(DataComponentTypes.POTION_CONTENTS).customEffects()) + potion.set( + DataComponentTypes.POTION_CONTENTS, + new PotionContentsComponent( + potion.get(DataComponentTypes.POTION_CONTENTS).potion(), + Optional.of(effect.getColor()), + potion.get(DataComponentTypes.POTION_CONTENTS).customEffects(), + Optional.empty() + ) ); return potion; diff --git a/src/main/java/meteordevelopment/meteorclient/gui/tabs/builtin/GuiTab.java b/src/main/java/meteordevelopment/meteorclient/gui/tabs/builtin/GuiTab.java index b4d4135aa6..ca4633be3f 100644 --- a/src/main/java/meteordevelopment/meteorclient/gui/tabs/builtin/GuiTab.java +++ b/src/main/java/meteordevelopment/meteorclient/gui/tabs/builtin/GuiTab.java @@ -55,7 +55,7 @@ public void initWidgets() { }; WButton reset = add(theme.button("Reset GUI Layout")).widget(); - reset.action = () -> theme.clearWindowConfigs(); + reset.action = theme::clearWindowConfigs; add(theme.settings(theme.settings)).expandX(); } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/AbstractBlockStateMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/AbstractBlockStateMixin.java index 5deb47b3c1..b47e5b9935 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/AbstractBlockStateMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/AbstractBlockStateMixin.java @@ -10,7 +10,6 @@ import net.minecraft.block.AbstractBlock; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; -import net.minecraft.world.BlockView; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -19,9 +18,9 @@ @Mixin(AbstractBlock.AbstractBlockState.class) public abstract class AbstractBlockStateMixin { @Inject(method = "getModelOffset", at = @At("HEAD"), cancellable = true) - private void modifyPos(BlockView world, BlockPos pos, CallbackInfoReturnable cir) { + private void modifyPos(BlockPos pos, CallbackInfoReturnable info) { if (Modules.get() == null) return; - if (Modules.get().get(NoRender.class).noTextureRotations()) cir.setReturnValue(Vec3d.ZERO); + if (Modules.get().get(NoRender.class).noTextureRotations()) info.setReturnValue(Vec3d.ZERO); } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/BoatEntityMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/AbstractBoatEntityMixin.java similarity index 60% rename from src/main/java/meteordevelopment/meteorclient/mixin/BoatEntityMixin.java rename to src/main/java/meteordevelopment/meteorclient/mixin/AbstractBoatEntityMixin.java index cda37c9e0c..dd175938d8 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/BoatEntityMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/AbstractBoatEntityMixin.java @@ -9,6 +9,7 @@ import meteordevelopment.meteorclient.events.entity.BoatMoveEvent; import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.movement.BoatFly; +import net.minecraft.entity.vehicle.AbstractBoatEntity; import net.minecraft.entity.vehicle.BoatEntity; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -17,25 +18,29 @@ import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -@Mixin(BoatEntity.class) -public abstract class BoatEntityMixin { - @Shadow private boolean pressingLeft; +@Mixin(AbstractBoatEntity.class) +public abstract class AbstractBoatEntityMixin { + @Shadow + private boolean pressingLeft; - @Shadow private boolean pressingRight; + @Shadow + private boolean pressingRight; - @Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/vehicle/BoatEntity;move(Lnet/minecraft/entity/MovementType;Lnet/minecraft/util/math/Vec3d;)V")) + @Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/vehicle/AbstractBoatEntity;move(Lnet/minecraft/entity/MovementType;Lnet/minecraft/util/math/Vec3d;)V")) private void onTickInvokeMove(CallbackInfo info) { - MeteorClient.EVENT_BUS.post(BoatMoveEvent.get((BoatEntity) (Object) this)); + if ((Object) this instanceof BoatEntity boatEntity) { + MeteorClient.EVENT_BUS.post(BoatMoveEvent.get(boatEntity)); + } } - @Redirect(method = "updatePaddles", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/vehicle/BoatEntity;pressingLeft:Z")) - private boolean onUpdatePaddlesPressingLeft(BoatEntity boat) { + @Redirect(method = "updatePaddles", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/vehicle/AbstractBoatEntity;pressingLeft:Z")) + private boolean onUpdatePaddlesPressingLeft(AbstractBoatEntity instance) { if (Modules.get().isActive(BoatFly.class)) return false; return pressingLeft; } - @Redirect(method = "updatePaddles", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/vehicle/BoatEntity;pressingRight:Z")) - private boolean onUpdatePaddlesPressingRight(BoatEntity boat) { + @Redirect(method = "updatePaddles", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/vehicle/AbstractBoatEntity;pressingRight:Z")) + private boolean onUpdatePaddlesPressingRight(AbstractBoatEntity instance) { if (Modules.get().isActive(BoatFly.class)) return false; return pressingRight; } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/AbstractFurnaceScreenHandlerMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/AbstractFurnaceScreenHandlerMixin.java index 46e3c40702..807dae715a 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/AbstractFurnaceScreenHandlerMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/AbstractFurnaceScreenHandlerMixin.java @@ -17,7 +17,7 @@ public abstract class AbstractFurnaceScreenHandlerMixin implements IAbstractFurn protected abstract boolean isSmeltable(ItemStack itemStack); @Override - public boolean isItemSmeltable(ItemStack itemStack) { + public boolean meteor$isItemSmeltable(ItemStack itemStack) { return isSmeltable(itemStack); } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/AbstractFurnaceScreenMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/AbstractFurnaceScreenMixin.java index 415c4d4b59..c773b0b5cf 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/AbstractFurnaceScreenMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/AbstractFurnaceScreenMixin.java @@ -14,9 +14,6 @@ import net.minecraft.screen.AbstractFurnaceScreenHandler; import net.minecraft.text.Text; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(AbstractFurnaceScreen.class) public abstract class AbstractFurnaceScreenMixin extends HandledScreen implements RecipeBookProvider { @@ -24,8 +21,10 @@ public AbstractFurnaceScreenMixin(T container, PlayerInventory playerInventory, super(container, playerInventory, name); } - @Inject(method = "handledScreenTick", at = @At("TAIL")) - private void onTick(CallbackInfo info) { + @Override + public void handledScreenTick() { + super.handledScreenTick(); + if (Modules.get().isActive(AutoSmelter.class)) Modules.get().get(AutoSmelter.class).tick(handler); } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ArmorFeatureRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ArmorFeatureRendererMixin.java index e4ce233fd4..3923eddaf5 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ArmorFeatureRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ArmorFeatureRendererMixin.java @@ -10,19 +10,18 @@ import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.entity.feature.ArmorFeatureRenderer; import net.minecraft.client.render.entity.model.BipedEntityModel; +import net.minecraft.client.render.entity.state.BipedEntityRenderState; +import net.minecraft.client.render.entity.state.PlayerEntityRenderState; import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(ArmorFeatureRenderer.class) -public abstract class ArmorFeatureRendererMixin, A extends BipedEntityModel> { - @Inject(method = "renderArmor", at = @At("HEAD"), cancellable = true) - private void onRenderArmor(MatrixStack matrices, VertexConsumerProvider vertexConsumers, T livingEntity, EquipmentSlot equipmentSlot, int i, A bipedEntityModel, CallbackInfo info) { - if (livingEntity instanceof PlayerEntity && Modules.get().get(NoRender.class).noArmor()) info.cancel(); +public abstract class ArmorFeatureRendererMixin, A extends BipedEntityModel> { + @Inject(method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/client/render/entity/state/BipedEntityRenderState;FF)V", at = @At("HEAD"), cancellable = true) + private void onRender(MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, S bipedEntityRenderState, float f, float g, CallbackInfo ci) { + if (bipedEntityRenderState instanceof PlayerEntityRenderState && Modules.get().get(NoRender.class).noArmor()) ci.cancel(); } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ArmorTrimMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ArmorTrimMixin.java index ee32aa90ac..26b3198409 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ArmorTrimMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ArmorTrimMixin.java @@ -8,13 +8,13 @@ import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.render.BetterTooltips; -import net.minecraft.item.trim.ArmorTrim; +import net.minecraft.item.equipment.trim.ArmorTrim; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @Mixin(ArmorTrim.class) public abstract class ArmorTrimMixin { - @ModifyExpressionValue(method = "appendTooltip", at = @At(value = "FIELD", target = "Lnet/minecraft/item/trim/ArmorTrim;showInTooltip:Z")) + @ModifyExpressionValue(method = "appendTooltip(Lnet/minecraft/item/Item$TooltipContext;Ljava/util/function/Consumer;Lnet/minecraft/item/tooltip/TooltipType;)V", at = @At(value = "FIELD", target = "Lnet/minecraft/item/equipment/trim/ArmorTrim;showInTooltip:Z")) private boolean modifyShowInTooltip(boolean original) { BetterTooltips bt = Modules.get().get(BetterTooltips.class); return (bt.isActive() && bt.upgrades.get()) || original; diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/BackgroundRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/BackgroundRendererMixin.java index 514d2a369a..44c64fed59 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/BackgroundRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/BackgroundRendererMixin.java @@ -5,28 +5,27 @@ package meteordevelopment.meteorclient.mixin; -import com.mojang.blaze3d.systems.RenderSystem; import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.render.NoRender; import meteordevelopment.meteorclient.systems.modules.render.Xray; import net.minecraft.client.render.BackgroundRenderer; import net.minecraft.client.render.Camera; import net.minecraft.entity.Entity; +import org.joml.Vector4f; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.ModifyArgs; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import org.spongepowered.asm.mixin.injection.invoke.arg.Args; @Mixin(BackgroundRenderer.class) public abstract class BackgroundRendererMixin { - @Inject(method = "applyFog", at = @At("TAIL")) - private static void onApplyFog(Camera camera, BackgroundRenderer.FogType fogType, float viewDistance, boolean thickFog, float tickDelta, CallbackInfo info) { - if (Modules.get().get(NoRender.class).noFog() || Modules.get().isActive(Xray.class)) { - if (fogType == BackgroundRenderer.FogType.FOG_TERRAIN) { - RenderSystem.setShaderFogStart(viewDistance * 4); - RenderSystem.setShaderFogEnd(viewDistance * 4.25f); - } + @ModifyArgs(method = "applyFog", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/Fog;(FFLnet/minecraft/client/render/FogShape;FFFF)V")) + private static void modifyFogDistance(Args args, Camera camera, BackgroundRenderer.FogType fogType, Vector4f color, float viewDistance, boolean thickenFog, float tickDelta) { + if (fogType == BackgroundRenderer.FogType.FOG_TERRAIN && Modules.get().get(NoRender.class).noFog() || Modules.get().isActive(Xray.class)) { + args.set(0, viewDistance * 4); + args.set(1, viewDistance * 4.25f); } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/BannerBlockEntityRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/BannerBlockEntityRendererMixin.java index 313160110d..572c735480 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/BannerBlockEntityRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/BannerBlockEntityRendererMixin.java @@ -16,7 +16,7 @@ import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.block.entity.BannerBlockEntityRenderer; -import net.minecraft.client.render.model.ModelLoader; +import net.minecraft.client.render.model.ModelBaker; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.math.RotationAxis; import org.spongepowered.asm.mixin.Final; @@ -66,7 +66,7 @@ private void renderPillar(BannerBlockEntity bannerBlockEntity, MatrixStack matri matrixStack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(h)); matrixStack.push(); matrixStack.scale(0.6666667F, -0.6666667F, -0.6666667F); - VertexConsumer vertexConsumer = ModelLoader.BANNER_BASE.getVertexConsumer(vertexConsumerProvider, RenderLayer::getEntitySolid); + VertexConsumer vertexConsumer = ModelBaker.BANNER_BASE.getVertexConsumer(vertexConsumerProvider, RenderLayer::getEntitySolid); this.pillar.render(matrixStack, vertexConsumer, i, j); matrixStack.pop(); matrixStack.pop(); @@ -82,7 +82,7 @@ private void renderCrossbar(BannerBlockEntity bannerBlockEntity, MatrixStack mat matrixStack.translate(0.0D, -0.3125D, -0.4375D); matrixStack.push(); matrixStack.scale(0.6666667F, -0.6666667F, -0.6666667F); - VertexConsumer vertexConsumer = ModelLoader.BANNER_BASE.getVertexConsumer(vertexConsumerProvider, RenderLayer::getEntitySolid); + VertexConsumer vertexConsumer = ModelBaker.BANNER_BASE.getVertexConsumer(vertexConsumerProvider, RenderLayer::getEntitySolid); this.crossbar.render(matrixStack, vertexConsumer, i, j); matrixStack.pop(); matrixStack.pop(); diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/BlockCollisionSpliteratorMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/BlockCollisionSpliteratorMixin.java index 69856efc23..39048a1bd3 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/BlockCollisionSpliteratorMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/BlockCollisionSpliteratorMixin.java @@ -16,27 +16,26 @@ import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShapes; import net.minecraft.world.BlockCollisionSpliterator; -import net.minecraft.world.BlockView; +import net.minecraft.world.CollisionView; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @Mixin(BlockCollisionSpliterator.class) public abstract class BlockCollisionSpliteratorMixin { - @WrapOperation(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;" + target = "Lnet/minecraft/block/ShapeContext;getCollisionShape(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/CollisionView;Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/util/shape/VoxelShape;" ) ) - private VoxelShape onComputeNextCollisionBox(BlockState state, BlockView world, BlockPos pos, ShapeContext context, Operation original) { - VoxelShape shape = original.call(state, world, pos, context); + private VoxelShape onComputeNextCollisionBox(ShapeContext instance, BlockState blockState, CollisionView collisionView, BlockPos blockPos, Operation original) { + VoxelShape shape = original.call(instance, blockState, collisionView, blockPos); - if (world != MinecraftClient.getInstance().world) { + if (collisionView != MinecraftClient.getInstance().world) { return shape; } - CollisionShapeEvent event = MeteorClient.EVENT_BUS.post(CollisionShapeEvent.get(state, pos, shape)); + CollisionShapeEvent event = MeteorClient.EVENT_BUS.post(CollisionShapeEvent.get(blockState, blockPos, shape)); return event.isCancelled() ? VoxelShapes.empty() : event.shape; } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/BlockMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/BlockMixin.java index f16a371560..2819ca3696 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/BlockMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/BlockMixin.java @@ -15,9 +15,7 @@ import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.item.ItemConvertible; -import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; -import net.minecraft.world.BlockView; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -28,11 +26,11 @@ public BlockMixin(Settings settings) { } @ModifyReturnValue(method = "shouldDrawSide", at = @At("RETURN")) - private static boolean onShouldDrawSide(boolean original, BlockState state, BlockView world, BlockPos pos, Direction side, BlockPos blockPos) { + private static boolean onShouldDrawSide(boolean original, BlockState state, BlockState otherState, Direction side) { Xray xray = Modules.get().get(Xray.class); if (xray.isActive()) { - return xray.modifyDrawSide(state, world, pos, side, original); + return xray.modifyDrawSide(state, otherState, side, original); } return original; diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/BoxMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/BoxMixin.java index b4983c84c2..2bf35405fe 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/BoxMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/BoxMixin.java @@ -23,7 +23,7 @@ public abstract class BoxMixin implements IBox { @Shadow @Final @Mutable public double maxZ; @Override - public void expand(double v) { + public void meteor$expand(double v) { this.minX -= v; this.minY -= v; this.minZ -= v; @@ -33,7 +33,7 @@ public void expand(double v) { } @Override - public void set(double x1, double y1, double z1, double x2, double y2, double z2) { + public void meteor$set(double x1, double y1, double z1, double x2, double y2, double z2) { this.minX = Math.min(x1, x2); this.minY = Math.min(y1, y2); this.minZ = Math.min(z1, z2); diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/CameraMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/CameraMixin.java index 08d8f03bc1..c2dc0ebb5b 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/CameraMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/CameraMixin.java @@ -100,7 +100,7 @@ else if (freeLook.isActive()) { } @Override - public void setRot(double yaw, double pitch) { + public void meteor$setRot(double yaw, double pitch) { setRotation((float) yaw, (float) MathHelper.clamp(pitch, -90, 90)); } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/CapabilityTrackerMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/CapabilityTrackerMixin.java index 656cbb23c8..d5c45ef43e 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/CapabilityTrackerMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/CapabilityTrackerMixin.java @@ -18,12 +18,12 @@ public abstract class CapabilityTrackerMixin implements ICapabilityTracker { public abstract void setState(boolean state); @Override - public boolean get() { + public boolean meteor$get() { return state; } @Override - public void set(boolean state) { + public void meteor$set(boolean state) { setState(state); } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/CapeFeatureRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/CapeFeatureRendererMixin.java index a9a942d007..990c0bd158 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/CapeFeatureRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/CapeFeatureRendererMixin.java @@ -6,20 +6,26 @@ package meteordevelopment.meteorclient.mixin; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; +import meteordevelopment.meteorclient.mixininterface.IEntityRenderState; import meteordevelopment.meteorclient.utils.network.Capes; -import net.minecraft.client.network.AbstractClientPlayerEntity; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.entity.feature.CapeFeatureRenderer; +import net.minecraft.client.render.entity.state.PlayerEntityRenderState; import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.Identifier; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @Mixin(CapeFeatureRenderer.class) public abstract 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;")) - 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; + @ModifyExpressionValue(method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/client/render/entity/state/PlayerEntityRenderState;FF)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/SkinTextures;capeTexture()Lnet/minecraft/util/Identifier;")) + private Identifier modifyCapeTexture(Identifier original, MatrixStack matrices, VertexConsumerProvider consumers, int i, PlayerEntityRenderState state, float f, float g) { + if (((IEntityRenderState) state).meteor$getEntity() instanceof PlayerEntity player) { + Identifier id = Capes.get(player); + return id == null ? original : id; + } + + return original; } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ChatHudMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ChatHudMixin.java index 200c002963..c4cc2aa58d 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ChatHudMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ChatHudMixin.java @@ -34,7 +34,6 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; import java.util.List; @@ -167,8 +166,8 @@ private MessageIndicator onRender_modifyIndicator(MessageIndicator indicator) { // Anti spam - @Inject(method = "addVisibleMessage", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/ChatHud;isChatFocused()Z"), locals = LocalCapture.CAPTURE_FAILSOFT) - private void onBreakChatMessageLines(ChatHudLine message, CallbackInfo ci, int i, MessageIndicator.Icon icon, List list) { + @Inject(method = "addVisibleMessage", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/ChatHud;isChatFocused()Z")) + private void onBreakChatMessageLines(ChatHudLine message, CallbackInfo ci, @Local List list) { if (Modules.get() == null) return; // baritone calls addMessage before we initialise getBetterChat().lines.addFirst(list.size()); diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ChatInputSuggestorMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ChatInputSuggestorMixin.java index 7dd3a6b343..79d245b1e7 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ChatInputSuggestorMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ChatInputSuggestorMixin.java @@ -5,6 +5,7 @@ package meteordevelopment.meteorclient.mixin; +import com.llamalad7.mixinextras.sugar.Local; import com.mojang.brigadier.ParseResults; import com.mojang.brigadier.StringReader; import com.mojang.brigadier.suggestion.Suggestions; @@ -19,7 +20,6 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; import java.util.concurrent.CompletableFuture; @@ -38,9 +38,9 @@ public abstract class ChatInputSuggestorMixin { @Inject(method = "refresh", at = @At(value = "INVOKE", target = "Lcom/mojang/brigadier/StringReader;canRead()Z", remap = false), - cancellable = true, - locals = LocalCapture.CAPTURE_FAILHARD) - public void onRefresh(CallbackInfo ci, String string, StringReader reader) { + cancellable = true + ) + public void onRefresh(CallbackInfo ci, @Local StringReader reader) { String prefix = Config.get().prefix.get(); int length = prefix.length(); diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayNetworkHandlerMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayNetworkHandlerMixin.java index edb3c29d22..1bd58a0c6c 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayNetworkHandlerMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayNetworkHandlerMixin.java @@ -33,6 +33,7 @@ import net.minecraft.entity.ItemEntity; import net.minecraft.network.ClientConnection; import net.minecraft.network.packet.s2c.play.*; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.chunk.WorldChunk; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -121,9 +122,10 @@ private void onExplosionVelocity(ExplosionS2CPacket packet, CallbackInfo ci) { Velocity velocity = Modules.get().get(Velocity.class); if (!velocity.explosions.get()) return; - ((IExplosionS2CPacket) packet).setVelocityX((float) (packet.getPlayerVelocityX() * velocity.getHorizontal(velocity.explosionsHorizontal))); - ((IExplosionS2CPacket) packet).setVelocityY((float) (packet.getPlayerVelocityY() * velocity.getVertical(velocity.explosionsVertical))); - ((IExplosionS2CPacket) packet).setVelocityZ((float) (packet.getPlayerVelocityZ() * velocity.getHorizontal(velocity.explosionsHorizontal))); + IExplosionS2CPacket explosionPacket = (IExplosionS2CPacket) (Object) packet; + explosionPacket.meteor$setVelocityX((float) (packet.playerKnockback().orElse(Vec3d.ZERO).x * velocity.getHorizontal(velocity.explosionsHorizontal))); + explosionPacket.meteor$setVelocityY((float) (packet.playerKnockback().orElse(Vec3d.ZERO).y * velocity.getVertical(velocity.explosionsVertical))); + explosionPacket.meteor$setVelocityZ((float) (packet.playerKnockback().orElse(Vec3d.ZERO).z * velocity.getHorizontal(velocity.explosionsHorizontal))); } @Inject(method = "onItemPickupAnimation", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/world/ClientWorld;getEntityById(I)Lnet/minecraft/entity/Entity;", ordinal = 0)) diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayerEntityMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayerEntityMixin.java index ab98464f79..5fe903751d 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayerEntityMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayerEntityMixin.java @@ -9,21 +9,18 @@ import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; import com.mojang.authlib.GameProfile; import meteordevelopment.meteorclient.MeteorClient; -import meteordevelopment.meteorclient.events.entity.DamageEvent; import meteordevelopment.meteorclient.events.entity.DropItemsEvent; import meteordevelopment.meteorclient.events.entity.player.PlayerTickMovementEvent; import meteordevelopment.meteorclient.events.entity.player.SendMovementPacketsEvent; import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.movement.*; import meteordevelopment.meteorclient.systems.modules.player.Portals; -import meteordevelopment.meteorclient.utils.Utils; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.input.Input; import net.minecraft.client.network.AbstractClientPlayerEntity; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.world.ClientWorld; -import net.minecraft.entity.damage.DamageSource; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -79,18 +76,13 @@ private void onPushOutOfBlocks(double x, double d, CallbackInfo info) { } } - @Inject(method = "damage", at = @At("HEAD")) - private void onDamage(DamageSource source, float amount, CallbackInfoReturnable info) { - if (Utils.canUpdate() && getWorld().isClient && canTakeDamage()) MeteorClient.EVENT_BUS.post(DamageEvent.get(this, source)); - } - @ModifyExpressionValue(method = "canSprint", at = @At(value = "CONSTANT", args = "floatValue=6.0f")) private float onHunger(float constant) { if (Modules.get().get(NoSlow.class).hunger()) return -1; return constant; } - @ModifyExpressionValue(method = "sendMovementPackets", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isSneaking()Z")) + @ModifyExpressionValue(method = "sendSneakingPacket", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isSneaking()Z")) private boolean isSneaking(boolean sneaking) { return Modules.get().get(Sneak.class).doPacket() || Modules.get().get(NoSlow.class).airStrict() || sneaking; } @@ -131,7 +123,7 @@ private void onSendMovementPacketsHead(CallbackInfo info) { MeteorClient.EVENT_BUS.post(SendMovementPacketsEvent.Pre.get()); } - @Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/packet/Packet;)V", ordinal = 0)) + @Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/packet/Packet;)V", ordinal = 1)) private void onTickHasVehicleBeforeSendPackets(CallbackInfo info) { MeteorClient.EVENT_BUS.post(SendMovementPacketsEvent.Pre.get()); } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/CreativeSlotMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/CreativeSlotMixin.java index 80b24bc223..cc65e2f631 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/CreativeSlotMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/CreativeSlotMixin.java @@ -16,12 +16,12 @@ public abstract class CreativeSlotMixin implements ISlot { @Shadow @Final Slot slot; @Override - public int getId() { + public int meteor$getId() { return slot.id; } @Override - public int getIndex() { + public int meteor$getIndex() { return slot.getIndex(); } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/DisconnectedScreenMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/DisconnectedScreenMixin.java index f96e6c603c..221b9d4353 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/DisconnectedScreenMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/DisconnectedScreenMixin.java @@ -21,7 +21,6 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; import static meteordevelopment.meteorclient.MeteorClient.mc; @@ -37,8 +36,8 @@ protected DisconnectedScreenMixin(Text title) { super(title); } - @Inject(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/DirectionalLayoutWidget;refreshPositions()V", shift = At.Shift.BEFORE), locals = LocalCapture.CAPTURE_FAILHARD) - private void addButtons(CallbackInfo ci, ButtonWidget buttonWidget) { + @Inject(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/DirectionalLayoutWidget;refreshPositions()V", shift = At.Shift.BEFORE)) + private void addButtons(CallbackInfo ci) { AutoReconnect autoReconnect = Modules.get().get(AutoReconnect.class); if (autoReconnect.lastServerConnection != null) { diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/DrawContextMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/DrawContextMixin.java index 12fdaccb62..aad3bc1784 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/DrawContextMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/DrawContextMixin.java @@ -6,17 +6,19 @@ package meteordevelopment.meteorclient.mixin; import com.llamalad7.mixinextras.injector.ModifyReceiver; +import com.llamalad7.mixinextras.sugar.Local; import meteordevelopment.meteorclient.utils.tooltip.MeteorTooltipData; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.tooltip.TooltipComponent; import net.minecraft.item.tooltip.TooltipData; import net.minecraft.text.Text; +import net.minecraft.util.Identifier; +import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; import java.util.List; import java.util.Optional; @@ -24,13 +26,13 @@ @Mixin(value = DrawContext.class) public abstract class DrawContextMixin { - @Inject(method = "drawTooltip(Lnet/minecraft/client/font/TextRenderer;Ljava/util/List;Ljava/util/Optional;II)V", at = @At(value = "INVOKE", target = "Ljava/util/Optional;ifPresent(Ljava/util/function/Consumer;)V", shift = At.Shift.BEFORE), locals = LocalCapture.CAPTURE_FAILHARD) - private void onDrawTooltip(TextRenderer textRenderer, List text, Optional data, int x, int y, CallbackInfo ci, List list) { + @Inject(method = "drawTooltip(Lnet/minecraft/client/font/TextRenderer;Ljava/util/List;Ljava/util/Optional;IILnet/minecraft/util/Identifier;)V", at = @At(value = "INVOKE", target = "Ljava/util/Optional;ifPresent(Ljava/util/function/Consumer;)V", shift = At.Shift.BEFORE)) + private void onDrawTooltip(TextRenderer textRenderer, List text, Optional data, int x, int y, @Nullable Identifier texture, CallbackInfo info, @Local(ordinal = 1) List list) { if (data.isPresent() && data.get() instanceof MeteorTooltipData meteorTooltipData) list.add(meteorTooltipData.getComponent()); } - @ModifyReceiver(method = "drawTooltip(Lnet/minecraft/client/font/TextRenderer;Ljava/util/List;Ljava/util/Optional;II)V", at = @At(value = "INVOKE", target = "Ljava/util/Optional;ifPresent(Ljava/util/function/Consumer;)V")) + @ModifyReceiver(method = "drawTooltip(Lnet/minecraft/client/font/TextRenderer;Ljava/util/List;Ljava/util/Optional;IILnet/minecraft/util/Identifier;)V", at = @At(value = "INVOKE", target = "Ljava/util/Optional;ifPresent(Ljava/util/function/Consumer;)V")) private Optional onDrawTooltip_modifyIfPresentReceiver(Optional data, Consumer consumer) { if (data.isPresent() && data.get() instanceof MeteorTooltipData) return Optional.empty(); return data; diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ElytraFeatureRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ElytraFeatureRendererMixin.java index 4fd5c52c9e..085a84ddd4 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ElytraFeatureRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ElytraFeatureRendererMixin.java @@ -6,30 +6,33 @@ package meteordevelopment.meteorclient.mixin; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; +import meteordevelopment.meteorclient.mixininterface.IEntityRenderState; import meteordevelopment.meteorclient.utils.network.Capes; -import net.minecraft.client.network.AbstractClientPlayerEntity; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.entity.feature.ElytraFeatureRenderer; import net.minecraft.client.render.entity.feature.FeatureRenderer; import net.minecraft.client.render.entity.feature.FeatureRendererContext; import net.minecraft.client.render.entity.model.EntityModel; +import net.minecraft.client.render.entity.state.BipedEntityRenderState; import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.Identifier; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @Mixin(ElytraFeatureRenderer.class) -public abstract class ElytraFeatureRendererMixin> extends FeatureRenderer { - public ElytraFeatureRendererMixin(FeatureRendererContext context) { +public abstract class ElytraFeatureRendererMixin> extends FeatureRenderer { + 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;")) - 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; + @ModifyExpressionValue(method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/client/render/entity/state/BipedEntityRenderState;FF)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/feature/ElytraFeatureRenderer;getTexture(Lnet/minecraft/client/render/entity/state/BipedEntityRenderState;)Lnet/minecraft/util/Identifier;")) + private Identifier modifyCapeTexture(Identifier original, MatrixStack matrices, VertexConsumerProvider consumers, int i, S state, float f, float g) { + if (((IEntityRenderState) state).meteor$getEntity() instanceof PlayerEntity player) { + Identifier id = Capes.get(player); + return id == null ? original : id; + } - Identifier id = Capes.get(playerEntity); - return id == null ? original : id; + return original; } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/EnchantingTableBlockEntityRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/EnchantingTableBlockEntityRendererMixin.java index 04165de046..b446467acf 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/EnchantingTableBlockEntityRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/EnchantingTableBlockEntityRendererMixin.java @@ -17,8 +17,8 @@ @Mixin(EnchantingTableBlockEntityRenderer.class) public abstract class EnchantingTableBlockEntityRendererMixin { - @WrapWithCondition(method = "render(Lnet/minecraft/block/entity/EnchantingTableBlockEntity;FLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;II)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/model/BookModel;renderBook(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;III)V")) - private boolean onRenderBookModelRenderProxy(BookModel instance, MatrixStack matrices, VertexConsumer vertices, int light, int overlay, int i) { + @WrapWithCondition(method = "render(Lnet/minecraft/block/entity/EnchantingTableBlockEntity;FLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;II)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/model/BookModel;render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;II)V")) + private boolean onRenderBookModelRenderProxy(BookModel instance, MatrixStack matrixStack, VertexConsumer vertexConsumer, int light, int overlay) { return !Modules.get().get(NoRender.class).noEnchTableBook(); } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/EndCrystalEntityModelMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/EndCrystalEntityModelMixin.java new file mode 100644 index 0000000000..8222090ad1 --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/mixin/EndCrystalEntityModelMixin.java @@ -0,0 +1,40 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.mixin; + +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; +import meteordevelopment.meteorclient.systems.modules.Modules; +import meteordevelopment.meteorclient.systems.modules.render.Chams; +import net.minecraft.client.render.entity.model.EndCrystalEntityModel; +import net.minecraft.client.render.entity.state.EndCrystalEntityRenderState; +import net.minecraft.util.math.MathHelper; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +@Mixin(EndCrystalEntityModel.class) +public abstract class EndCrystalEntityModelMixin { + // Chams - Bounce + + @ModifyExpressionValue(method = "setAngles(Lnet/minecraft/client/render/entity/state/EndCrystalEntityRenderState;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/EndCrystalEntityRenderer;getYOffset(F)F")) + private float setAngles$bounce(float original, EndCrystalEntityRenderState state) { + Chams module = Modules.get().get(Chams.class); + if (!module.isActive() || !module.crystals.get()) return original; + + float g = MathHelper.sin(state.age * 0.2F) / 2.0F + 0.5F; + g = (g * g + g) * 0.4F * module.crystalsBounce.get().floatValue(); + return g - 1.4F; + } + + // Chams - Rotation speed + + @ModifyExpressionValue(method = "setAngles(Lnet/minecraft/client/render/entity/state/EndCrystalEntityRenderState;)V", at = @At(value = "FIELD", target = "Lnet/minecraft/client/render/entity/state/EndCrystalEntityRenderState;age:F", ordinal = 0)) + private float modifySpeed(float original) { + Chams module = Modules.get().get(Chams.class); + if (!module.isActive() || !module.crystals.get()) return original; + + return original * module.crystalsRotationSpeed.get().floatValue(); + } +} diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/EndCrystalEntityRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/EndCrystalEntityRendererMixin.java index 953d569ef9..3818803f9c 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/EndCrystalEntityRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/EndCrystalEntityRendererMixin.java @@ -5,126 +5,73 @@ package meteordevelopment.meteorclient.mixin; +import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.render.Chams; -import meteordevelopment.meteorclient.utils.render.color.Color; -import net.minecraft.client.model.ModelPart; import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.entity.EndCrystalEntityRenderer; +import net.minecraft.client.render.entity.model.EndCrystalEntityModel; +import net.minecraft.client.render.entity.state.EndCrystalEntityRenderState; import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.decoration.EndCrystalEntity; import net.minecraft.util.Identifier; -import net.minecraft.util.math.MathHelper; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Mutable; -import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.*; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.ModifyArgs; -import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.invoke.arg.Args; - -import static net.minecraft.client.render.entity.EndCrystalEntityRenderer.getYOffset; @Mixin(EndCrystalEntityRenderer.class) public abstract class EndCrystalEntityRendererMixin { - @Mutable @Shadow @Final - private static RenderLayer END_CRYSTAL; - - @Shadow @Final - private static Identifier TEXTURE; - - @Shadow @Final - public ModelPart core; + // Chams - @Shadow @Final - public ModelPart frame; + @Unique + private Chams chams; - // Texture - @Inject(method = "render(Lnet/minecraft/entity/decoration/EndCrystalEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At("HEAD")) - private void render(EndCrystalEntity endCrystalEntity, float f, float g, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, CallbackInfo ci) { - Chams module = Modules.get().get(Chams.class); - - END_CRYSTAL = RenderLayer.getEntityTranslucent((module.isActive() && module.crystals.get() && !module.crystalsTexture.get()) ? Chams.BLANK : TEXTURE); + @Inject(method = "", at = @At("RETURN")) + private void onInit(CallbackInfo info) { + chams = Modules.get().get(Chams.class); } - // Scale - @ModifyArgs(method = "render(Lnet/minecraft/entity/decoration/EndCrystalEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/math/MatrixStack;scale(FFF)V", ordinal = 0)) - private void modifyScale(Args args) { - Chams module = Modules.get().get(Chams.class); - if (!module.isActive() || !module.crystals.get()) return; + // Chams - Texture - args.set(0, 2.0F * module.crystalsScale.get().floatValue()); - args.set(1, 2.0F * module.crystalsScale.get().floatValue()); - args.set(2, 2.0F * module.crystalsScale.get().floatValue()); - } + @Shadow + @Final + @Mutable + private static RenderLayer END_CRYSTAL; - // Bounce - @Redirect(method = "render(Lnet/minecraft/entity/decoration/EndCrystalEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/EndCrystalEntityRenderer;getYOffset(Lnet/minecraft/entity/decoration/EndCrystalEntity;F)F")) - private float getYOff(EndCrystalEntity crystal, float tickDelta) { - Chams module = Modules.get().get(Chams.class); - if (!module.isActive() || !module.crystals.get()) return getYOffset(crystal, tickDelta); + @Shadow + @Final + private static Identifier TEXTURE; - float f = (float) crystal.endCrystalAge + tickDelta; - float g = MathHelper.sin(f * 0.2F) / 2.0F + 0.5F; - g = (g * g + g) * 0.4F * module.crystalsBounce.get().floatValue(); - return g - 1.4F; + @Inject(method = "render(Lnet/minecraft/client/render/entity/state/EndCrystalEntityRenderState;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At("HEAD")) + private void render$renderLayer(EndCrystalEntityRenderState endCrystalEntityRenderState, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, CallbackInfo ci) { + END_CRYSTAL = RenderLayer.getEntityTranslucent((chams.isActive() && chams.crystals.get() && !chams.crystalsTexture.get()) ? Chams.BLANK : TEXTURE); } - // Rotation speed - @ModifyArgs(method = "render(Lnet/minecraft/entity/decoration/EndCrystalEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/RotationAxis;rotationDegrees(F)Lorg/joml/Quaternionf;")) - private void modifySpeed(Args args) { - Chams module = Modules.get().get(Chams.class); - if (!module.isActive() || !module.crystals.get()) return; + // Chams - Scale - args.set(0, ((float) args.get(0)) * module.crystalsRotationSpeed.get().floatValue()); - } - - // Core - @Redirect(method = "render(Lnet/minecraft/entity/decoration/EndCrystalEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/model/ModelPart;render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;II)V", ordinal = 3)) - private void modifyCore(ModelPart modelPart, MatrixStack matrices, VertexConsumer vertices, int light, int overlay) { - Chams module = Modules.get().get(Chams.class); - if (!module.isActive() || !module.crystals.get()) { - core.render(matrices, vertices, light, overlay); - return; - } + @Inject(method = "render(Lnet/minecraft/client/render/entity/state/EndCrystalEntityRenderState;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/math/MatrixStack;scale(FFF)V")) + private void render$scale(EndCrystalEntityRenderState endCrystalEntityRenderState, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, CallbackInfo info) { + if (!chams.isActive() || !chams.crystals.get()) return; - if (module.renderCore.get()) { - Color color = module.crystalsCoreColor.get(); - core.render(matrices, vertices, light, overlay, color.getPacked()); - } + float v = chams.crystalsScale.get().floatValue(); + matrixStack.scale(v, v, v); } - // Frame - @Redirect(method = "render(Lnet/minecraft/entity/decoration/EndCrystalEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/model/ModelPart;render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;II)V", ordinal = 1)) - private void modifyFrame1(ModelPart modelPart, MatrixStack matrices, VertexConsumer vertices, int light, int overlay) { - Chams module = Modules.get().get(Chams.class); - if (!module.isActive() || !module.crystals.get()) { - frame.render(matrices, vertices, light, overlay); - return; - } + // Chams - Color - if (module.renderFrame1.get()) { - Color color = module.crystalsFrame1Color.get(); - frame.render(matrices, vertices, light, overlay, color.getPacked()); - } - } + @Shadow + @Final + private EndCrystalEntityModel model; - @Redirect(method = "render(Lnet/minecraft/entity/decoration/EndCrystalEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/model/ModelPart;render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;II)V", ordinal = 2)) - private void modifyFrame2(ModelPart modelPart, MatrixStack matrices, VertexConsumer vertices, int light, int overlay) { - Chams module = Modules.get().get(Chams.class); - if (!module.isActive() || !module.crystals.get()) { - frame.render(matrices, vertices, light, overlay); - return; + @WrapWithCondition(method = "render(Lnet/minecraft/client/render/entity/state/EndCrystalEntityRenderState;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/model/EndCrystalEntityModel;render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;II)V")) + private boolean render$color(EndCrystalEntityModel instance, MatrixStack matrices, VertexConsumer vertices, int light, int overlay) { + if (chams.isActive() && chams.crystals.get()) { + model.render(matrices, vertices, light, overlay, chams.crystalsColor.get().getPacked()); + return false; } - if (module.renderFrame2.get()) { - Color color = module.crystalsFrame2Color.get(); - frame.render(matrices, vertices, light, overlay, color.getPacked()); - } + return true; } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/EntityMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/EntityMixin.java index 1af9cd3a09..54ab458c2c 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/EntityMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/EntityMixin.java @@ -189,7 +189,7 @@ private void getPoseHook(CallbackInfoReturnable info) { if ((Object) this != mc.player) return; if (Modules.get().get(ElytraFly.class).canPacketEfly()) { - info.setReturnValue(EntityPose.FALL_FLYING); + info.setReturnValue(EntityPose.GLIDING); } } @@ -219,7 +219,7 @@ private void updateChangeLookDirection(double cursorDeltaX, double cursorDeltaY, } else if (Modules.get().isActive(HighwayBuilder.class)) { Camera camera = mc.gameRenderer.getCamera(); - ((ICamera) camera).setRot(camera.getYaw() + cursorDeltaX * 0.15, camera.getPitch() + cursorDeltaY * 0.15); + ((ICamera) camera).meteor$setRot(camera.getYaw() + cursorDeltaX * 0.15, camera.getPitch() + cursorDeltaY * 0.15); ci.cancel(); } else if (freeLook.cameraMode()) { diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/EntityRenderDispatcherMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/EntityRenderDispatcherMixin.java index 2f4aa08ac3..90393e6ea5 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/EntityRenderDispatcherMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/EntityRenderDispatcherMixin.java @@ -5,7 +5,10 @@ package meteordevelopment.meteorclient.mixin; +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; +import com.llamalad7.mixinextras.sugar.Local; import meteordevelopment.meteorclient.mixininterface.IBox; +import meteordevelopment.meteorclient.mixininterface.IEntityRenderState; import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.combat.Hitboxes; import meteordevelopment.meteorclient.systems.modules.render.NoRender; @@ -15,9 +18,11 @@ import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.entity.EntityRenderDispatcher; +import net.minecraft.client.render.entity.EntityRenderer; +import net.minecraft.client.render.entity.state.EntityRenderState; +import net.minecraft.client.render.entity.state.LivingEntityRenderState; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.Entity; -import net.minecraft.entity.LivingEntity; import net.minecraft.util.math.Box; import net.minecraft.util.math.MathHelper; import net.minecraft.world.WorldView; @@ -27,14 +32,13 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; @Mixin(EntityRenderDispatcher.class) public abstract class EntityRenderDispatcherMixin { @Shadow public Camera camera; - @Inject(method = "render", at = @At("HEAD"), cancellable = true) - private void render(E entity, double x, double y, double z, float yaw, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo info) { + @Inject(method = "render(Lnet/minecraft/entity/Entity;DDDFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/client/render/entity/EntityRenderer;)V", at = @At("HEAD"), cancellable = true) + private void render(E entity, double x, double y, double z, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, EntityRenderer renderer, CallbackInfo info) { if (entity instanceof FakePlayerEntity player && player.hideWhenInsideCamera) { int cX = MathHelper.floor(this.camera.getPos().x); int cY = MathHelper.floor(this.camera.getPos().y); @@ -44,18 +48,26 @@ private void render(E entity, double x, double y, double z, f } } - @Inject(method = "renderHitbox", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;drawBox(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;Lnet/minecraft/util/math/Box;FFFF)V", ordinal = 0), locals = LocalCapture.CAPTURE_FAILSOFT) - private static void onRenderHitbox(MatrixStack matrices, VertexConsumer vertices, Entity entity, float tickDelta, float red, float green, float blue, CallbackInfo ci, Box box) { + @Inject(method = "renderHitbox", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/VertexRendering;drawBox(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;Lnet/minecraft/util/math/Box;FFFF)V", ordinal = 0)) + private static void onRenderHitbox(MatrixStack matrices, VertexConsumer vertices, Entity entity, float tickDelta, float red, float green, float blue, CallbackInfo ci, @Local Box box) { double v = Modules.get().get(Hitboxes.class).getEntityValue(entity); - if (v != 0) ((IBox) box).expand(v); + if (v != 0) ((IBox) box).meteor$expand(v); + } + + // IEntityRenderState + + @ModifyExpressionValue(method = "render(Lnet/minecraft/entity/Entity;DDDFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/client/render/entity/EntityRenderer;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/EntityRenderer;getAndUpdateRenderState(Lnet/minecraft/entity/Entity;F)Lnet/minecraft/client/render/entity/state/EntityRenderState;")) + private S render$getAndUpdateRenderState(S state, E entity, double x, double y, double z, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, EntityRenderer renderer) { + ((IEntityRenderState) state).meteor$setEntity(entity); + return state; } // Player model rendering in main menu @Inject(method = "renderShadow", at = @At("HEAD"), cancellable = true) - private static void onRenderShadow(MatrixStack matrices, VertexConsumerProvider vertexConsumers, Entity entity, float opacity, float tickDelta, WorldView world, float radius, CallbackInfo info) { + private static void onRenderShadow(MatrixStack matrices, VertexConsumerProvider vertexConsumers, EntityRenderState renderState, float opacity, float tickDelta, WorldView world, float radius, CallbackInfo info) { if (PostProcessShaders.rendering) info.cancel(); - if (Modules.get().get(NoRender.class).noDeadEntities() && entity instanceof LivingEntity && ((LivingEntity) entity).isDead()) info.cancel(); + if (Modules.get().get(NoRender.class).noDeadEntities() && renderState instanceof LivingEntityRenderState livingEntityRenderState && livingEntityRenderState.deathTime > 0) info.cancel(); } @Inject(method = "getSquaredDistanceToCamera(Lnet/minecraft/entity/Entity;)D", at = @At("HEAD"), cancellable = true) diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/EntityRenderStateMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/EntityRenderStateMixin.java new file mode 100644 index 0000000000..0401a151f7 --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/mixin/EntityRenderStateMixin.java @@ -0,0 +1,28 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.mixin; + +import meteordevelopment.meteorclient.mixininterface.IEntityRenderState; +import net.minecraft.client.render.entity.state.EntityRenderState; +import net.minecraft.entity.Entity; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; + +@Mixin(EntityRenderState.class) +public abstract class EntityRenderStateMixin implements IEntityRenderState { + @Unique + private Entity entity; + + @Override + public Entity meteor$getEntity() { + return entity; + } + + @Override + public void meteor$setEntity(Entity entity) { + this.entity = entity; + } +} diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/EntityRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/EntityRendererMixin.java index 4409222e3d..0996e9ce40 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/EntityRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/EntityRendererMixin.java @@ -6,7 +6,6 @@ package meteordevelopment.meteorclient.mixin; import com.llamalad7.mixinextras.injector.ModifyReturnValue; -import meteordevelopment.meteorclient.mixininterface.IEntityRenderer; import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.render.Fullbright; import meteordevelopment.meteorclient.systems.modules.render.Nametags; @@ -14,40 +13,34 @@ import meteordevelopment.meteorclient.utils.entity.EntityUtils; import meteordevelopment.meteorclient.utils.render.postprocess.PostProcessShaders; import net.minecraft.client.render.Frustum; -import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.entity.EntityRenderer; -import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.client.render.entity.state.EntityRenderState; import net.minecraft.entity.Entity; import net.minecraft.entity.FallingBlockEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.text.Text; -import net.minecraft.util.Identifier; import net.minecraft.world.LightType; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(EntityRenderer.class) -public abstract class EntityRendererMixin implements IEntityRenderer { - @Shadow - public abstract Identifier getTexture(Entity entity); - - @Inject(method = "renderLabelIfPresent", at = @At("HEAD"), cancellable = true) - private void onRenderLabel(T entity, Text text, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, float tickDelta, CallbackInfo ci) { - if (PostProcessShaders.rendering) ci.cancel(); - if (Modules.get().get(NoRender.class).noNametags()) ci.cancel(); - if (!(entity instanceof PlayerEntity)) return; - if (Modules.get().get(Nametags.class).playerNametags() && !(EntityUtils.getGameMode((PlayerEntity) entity) == null && Modules.get().get(Nametags.class).excludeBots())) - ci.cancel(); +public abstract class EntityRendererMixin { + + @Inject(method = "getDisplayName", at = @At("HEAD"), cancellable = true) + private void onRenderLabel(T entity, CallbackInfoReturnable cir) { + if (PostProcessShaders.rendering) cir.setReturnValue(null); + if (Modules.get().get(NoRender.class).noNametags()) cir.setReturnValue(null); + if (!(entity instanceof PlayerEntity player)) return; + if (Modules.get().get(Nametags.class).playerNametags() && !(EntityUtils.getGameMode(player) == null && Modules.get().get(Nametags.class).excludeBots())) + cir.setReturnValue(null); } @Inject(method = "shouldRender", at = @At("HEAD"), cancellable = true) private void shouldRender(T entity, Frustum frustum, double x, double y, double z, CallbackInfoReturnable cir) { - if (Modules.get().get(NoRender.class).noEntity(entity)) cir.cancel(); - if (Modules.get().get(NoRender.class).noFallingBlocks() && entity instanceof FallingBlockEntity) cir.cancel(); + if (Modules.get().get(NoRender.class).noEntity(entity)) cir.setReturnValue(false); + if (Modules.get().get(NoRender.class).noFallingBlocks() && entity instanceof FallingBlockEntity) cir.setReturnValue(false); } @ModifyReturnValue(method = "getSkyLight", at = @At("RETURN")) @@ -59,9 +52,4 @@ private int onGetSkyLight(int original) { private int onGetBlockLight(int original) { return Math.max(Modules.get().get(Fullbright.class).getLuminance(LightType.BLOCK), original); } - - @Override - public Identifier getTextureInterface(Entity entity) { - return getTexture(entity); - } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ExplosionMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ExplosionMixin.java deleted file mode 100644 index 249df8bc33..0000000000 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ExplosionMixin.java +++ /dev/null @@ -1,45 +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 meteordevelopment.meteorclient.mixininterface.IExplosion; -import net.minecraft.entity.Entity; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; -import net.minecraft.world.explosion.Explosion; -import org.jetbrains.annotations.Nullable; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Mutable; -import org.spongepowered.asm.mixin.Shadow; - -import static meteordevelopment.meteorclient.MeteorClient.mc; - -@Mixin(Explosion.class) -public abstract class ExplosionMixin implements IExplosion { - @Shadow @Final @Mutable private World world; - @Shadow @Final @Mutable @Nullable private Entity entity; - - @Shadow @Final @Mutable private double x; - @Shadow @Final @Mutable private double y; - @Shadow @Final @Mutable private double z; - - @Shadow @Final @Mutable private float power; - @Shadow @Final @Mutable private boolean createFire; - @Shadow @Final @Mutable private Explosion.DestructionType destructionType; - - @Override - public void set(Vec3d pos, float power, boolean createFire) { - this.world = mc.world; - this.entity = null; - this.x = pos.x; - this.y = pos.y; - this.z = pos.z; - this.power = power; - this.createFire = createFire; - this.destructionType = Explosion.DestructionType.DESTROY; - } -} diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ExplosionS2CPacketMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ExplosionS2CPacketMixin.java index e837f1aaaa..aa42ee439f 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ExplosionS2CPacketMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ExplosionS2CPacketMixin.java @@ -7,31 +7,48 @@ import meteordevelopment.meteorclient.mixininterface.IExplosionS2CPacket; import net.minecraft.network.packet.s2c.play.ExplosionS2CPacket; +import net.minecraft.util.math.Vec3d; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mutable; import org.spongepowered.asm.mixin.Shadow; +import java.util.Optional; + @Mixin(ExplosionS2CPacket.class) public abstract class ExplosionS2CPacketMixin implements IExplosionS2CPacket { - @Shadow @Final @Mutable private float playerVelocityX; - - @Shadow @Final @Mutable private float playerVelocityY; - - @Shadow @Final @Mutable private float playerVelocityZ; + @Shadow + @Final + @Mutable + private Optional playerKnockback; @Override - public void setVelocityX(float velocity) { - playerVelocityX = velocity; + public void meteor$setVelocityX(float velocity) { + if (playerKnockback.isPresent()) { + Vec3d kb = playerKnockback.get(); + playerKnockback = Optional.of(new Vec3d(velocity, kb.y, kb.z)); + } else { + playerKnockback = Optional.of(new Vec3d(velocity, 0, 0)); + } } @Override - public void setVelocityY(float velocity) { - playerVelocityY = velocity; + public void meteor$setVelocityY(float velocity) { + if (playerKnockback.isPresent()) { + Vec3d kb = playerKnockback.get(); + playerKnockback = Optional.of(new Vec3d(kb.x, velocity, kb.z)); + } else { + playerKnockback = Optional.of(new Vec3d(0, velocity, 0)); + } } @Override - public void setVelocityZ(float velocity) { - playerVelocityZ = velocity; + public void meteor$setVelocityZ(float velocity) { + if (playerKnockback.isPresent()) { + Vec3d kb = playerKnockback.get(); + playerKnockback = Optional.of(new Vec3d(kb.x, kb.y, velocity)); + } else { + playerKnockback = Optional.of(new Vec3d(0, 0, velocity)); + } } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/FireworkRocketEntityMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/FireworkRocketEntityMixin.java index dcf1eee682..26bb11cf29 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/FireworkRocketEntityMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/FireworkRocketEntityMixin.java @@ -8,6 +8,7 @@ import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.movement.ElytraBoost; import net.minecraft.entity.projectile.FireworkRocketEntity; +import net.minecraft.server.world.ServerWorld; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.EntityHitResult; import org.spongepowered.asm.mixin.Mixin; @@ -18,23 +19,30 @@ @Mixin(FireworkRocketEntity.class) public abstract class FireworkRocketEntityMixin { - @Shadow protected abstract void explodeAndRemove(); + @Shadow + protected abstract void explodeAndRemove(ServerWorld world); - @Shadow private int life; + @Shadow + private int life; - @Shadow private int lifeTime; + @Shadow + private int lifeTime; @Inject(method = "tick", at = @At("TAIL")) private void onTick(CallbackInfo info) { if (Modules.get().get(ElytraBoost.class).isFirework((FireworkRocketEntity) (Object) this) && this.life > this.lifeTime) { - this.explodeAndRemove(); + if (((FireworkRocketEntity) (Object) this).getWorld() instanceof ServerWorld serverWorld) { + this.explodeAndRemove(serverWorld); + } } } @Inject(method = "onEntityHit", at = @At("HEAD"), cancellable = true) private void onEntityHit(EntityHitResult entityHitResult, CallbackInfo info) { if (Modules.get().get(ElytraBoost.class).isFirework((FireworkRocketEntity) (Object) this)) { - this.explodeAndRemove(); + if (((FireworkRocketEntity) (Object) this).getWorld() instanceof ServerWorld serverWorld) { + this.explodeAndRemove(serverWorld); + } info.cancel(); } } @@ -42,7 +50,9 @@ private void onEntityHit(EntityHitResult entityHitResult, CallbackInfo info) { @Inject(method = "onBlockHit", at = @At("HEAD"), cancellable = true) private void onBlockHit(BlockHitResult blockHitResult, CallbackInfo info) { if (Modules.get().get(ElytraBoost.class).isFirework((FireworkRocketEntity) (Object) this)) { - this.explodeAndRemove(); + if (((FireworkRocketEntity) (Object) this).getWorld() instanceof ServerWorld serverWorld) { + this.explodeAndRemove(serverWorld); + } info.cancel(); } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/FireworksSparkParticleMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/FireworksSparkParticleMixin.java index a87d415071..5491d82d29 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/FireworksSparkParticleMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/FireworksSparkParticleMixin.java @@ -5,18 +5,18 @@ package meteordevelopment.meteorclient.mixin; +import com.llamalad7.mixinextras.sugar.Local; import it.unimi.dsi.fastutil.ints.IntList; import net.minecraft.client.particle.FireworksSparkParticle; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; @Mixin(FireworksSparkParticle.FireworkParticle.class) public abstract class FireworksSparkParticleMixin { - @Inject(method = "addExplosionParticle", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/particle/FireworksSparkParticle$Explosion;setTrail(Z)V"), cancellable = true, locals = LocalCapture.CAPTURE_FAILSOFT) - private void onAddExplosion(double x, double y, double z, double velocityX, double velocityY, double velocityZ, IntList colors, IntList targetColors, boolean trail, boolean flicker, CallbackInfo info, FireworksSparkParticle.Explosion explosion) { + @Inject(method = "addExplosionParticle", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/particle/FireworksSparkParticle$Explosion;setTrail(Z)V"), cancellable = true) + private void onAddExplosion(double x, double y, double z, double velocityX, double velocityY, double velocityZ, IntList colors, IntList targetColors, boolean trail, boolean flicker, CallbackInfo info, @Local FireworksSparkParticle.Explosion explosion) { if (explosion == null) info.cancel(); } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/GameRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/GameRendererMixin.java index b15a3271d6..3e91843f36 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/GameRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/GameRendererMixin.java @@ -25,7 +25,6 @@ import meteordevelopment.meteorclient.utils.render.NametagUtils; import meteordevelopment.meteorclient.utils.render.RenderUtils; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.DrawContext; import net.minecraft.client.render.Camera; import net.minecraft.client.render.GameRenderer; import net.minecraft.client.render.RenderTickCounter; @@ -35,6 +34,7 @@ import net.minecraft.item.Items; import net.minecraft.util.hit.EntityHitResult; import net.minecraft.util.hit.HitResult; +import net.minecraft.util.profiler.Profilers; import org.joml.Matrix4f; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -44,13 +44,12 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; @Mixin(GameRenderer.class) public abstract class GameRendererMixin { @Shadow @Final - MinecraftClient client; + private MinecraftClient client; @Shadow public abstract void updateCrosshairTarget(float tickDelta); @@ -74,11 +73,11 @@ public abstract class GameRendererMixin { @Unique private final MatrixStack matrices = new MatrixStack(); - @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(RenderTickCounter tickCounter, CallbackInfo ci, @Local(ordinal = 1) Matrix4f matrix4f2, @Local(ordinal = 1) float tickDelta, @Local MatrixStack matrixStack) { + @Inject(method = "renderWorld", at = @At(value = "INVOKE_STRING", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", args = {"ldc=hand"})) + private void onRenderWorld(RenderTickCounter tickCounter, CallbackInfo ci, @Local(ordinal = 2) Matrix4f matrix4f3, @Local(ordinal = 1) float tickDelta, @Local MatrixStack matrixStack) { if (!Utils.canUpdate()) return; - client.getProfiler().push(MeteorClient.MOD_ID + "_render"); + Profilers.get().push(MeteorClient.MOD_ID + "_render"); // Create renderer and event @@ -88,11 +87,11 @@ private void onRenderWorld(RenderTickCounter tickCounter, CallbackInfo ci, @Loca // Call utility classes RenderUtils.updateScreenCenter(); - NametagUtils.onRender(matrix4f2); + NametagUtils.onRender(matrix4f3); // Update model view matrix - RenderSystem.getModelViewStack().pushMatrix().mul(matrix4f2); + RenderSystem.getModelViewStack().pushMatrix().mul(matrix4f3); matrices.push(); @@ -102,8 +101,6 @@ private void onRenderWorld(RenderTickCounter tickCounter, CallbackInfo ci, @Loca RenderSystem.getModelViewStack().mul(matrices.peek().getPositionMatrix().invert()); matrices.pop(); - RenderSystem.applyModelViewMatrix(); - // Render renderer.begin(); @@ -113,9 +110,8 @@ private void onRenderWorld(RenderTickCounter tickCounter, CallbackInfo ci, @Loca // Revert model view matrix RenderSystem.getModelViewStack().popMatrix(); - RenderSystem.applyModelViewMatrix(); - client.getProfiler().pop(); + Profilers.get().pop(); } @Inject(method = "renderWorld", at = @At("TAIL")) @@ -154,11 +150,6 @@ private float applyCameraTransformationsMathHelperLerpProxy(float original) { return Modules.get().get(NoRender.class).noNausea() ? 0 : original; } - @Inject(method = "renderNausea", at = @At("HEAD"), cancellable = true) - private void onRenderNausea(DrawContext context, float distortionStrength, CallbackInfo ci) { - if (Modules.get().get(NoRender.class).noNausea()) ci.cancel(); - } - // Freecam @Unique @@ -188,7 +179,7 @@ private void updateTargetedEntityInvoke(float tickDelta, CallbackInfo info) { cameraE.setYaw(camera.getYaw()); cameraE.setPitch(camera.getPitch()); } else { - ((IVec3d) cameraE.getPos()).set(freecam.pos.x, freecam.pos.y - cameraE.getEyeHeight(cameraE.getPose()), freecam.pos.z); + ((IVec3d) cameraE.getPos()).meteor$set(freecam.pos.x, freecam.pos.y - cameraE.getEyeHeight(cameraE.getPose()), freecam.pos.z); cameraE.prevX = freecam.prevPos.x; cameraE.prevY = freecam.prevPos.y - cameraE.getEyeHeight(cameraE.getPose()); cameraE.prevZ = freecam.prevPos.z; @@ -202,7 +193,7 @@ private void updateTargetedEntityInvoke(float tickDelta, CallbackInfo info) { updateCrosshairTarget(tickDelta); freecamSet = false; - ((IVec3d) cameraE.getPos()).set(x, y, z); + ((IVec3d) cameraE.getPos()).meteor$set(x, y, z); cameraE.prevX = prevX; cameraE.prevY = prevY; cameraE.prevZ = prevZ; diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/HeldItemRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/HeldItemRendererMixin.java index 3708700b23..333aa7d0b9 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/HeldItemRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/HeldItemRendererMixin.java @@ -76,7 +76,7 @@ private float modifyEquipProgressOffhand(float value) { return (showSwapping(offHand, mc.player.getOffHandStack()) ? 1 : 0) - equipProgressOffHand; } - @Inject(method = "renderFirstPersonItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/item/HeldItemRenderer;renderItem(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/render/model/json/ModelTransformationMode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V")) + @Inject(method = "renderFirstPersonItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/item/HeldItemRenderer;renderItem(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ModelTransformationMode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V")) private void onRenderItem(AbstractClientPlayerEntity player, float tickDelta, float pitch, Hand hand, float swingProgress, ItemStack item, float equipProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) { MeteorClient.EVENT_BUS.post(HeldItemRendererEvent.get(hand, matrices)); } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/HorseBaseEntityMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/HorseBaseEntityMixin.java index 9199230461..3df1606035 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/HorseBaseEntityMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/HorseBaseEntityMixin.java @@ -15,7 +15,7 @@ public abstract class HorseBaseEntityMixin implements IHorseBaseEntity { @Shadow protected abstract void setHorseFlag(int bitmask, boolean flag); @Override - public void setSaddled(boolean saddled) { + public void meteor$setSaddled(boolean saddled) { setHorseFlag(4, saddled); } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/InGameHudMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/InGameHudMixin.java index cff9d8363d..8dd2cd4a3f 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/InGameHudMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/InGameHudMixin.java @@ -6,7 +6,6 @@ package meteordevelopment.meteorclient.mixin; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; -import com.mojang.blaze3d.systems.RenderSystem; import meteordevelopment.meteorclient.MeteorClient; import meteordevelopment.meteorclient.events.render.Render2DEvent; import meteordevelopment.meteorclient.systems.modules.Modules; @@ -14,13 +13,12 @@ import meteordevelopment.meteorclient.systems.modules.render.Freecam; import meteordevelopment.meteorclient.systems.modules.render.NoRender; import meteordevelopment.meteorclient.utils.Utils; -import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.hud.InGameHud; import net.minecraft.client.render.RenderTickCounter; import net.minecraft.entity.Entity; import net.minecraft.scoreboard.ScoreboardObjective; -import org.spongepowered.asm.mixin.Final; +import net.minecraft.util.profiler.Profilers; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -31,22 +29,19 @@ @Mixin(InGameHud.class) public abstract class InGameHudMixin { - @Shadow @Final private MinecraftClient client; - @Shadow public abstract void clear(); @Inject(method = "render", at = @At("TAIL")) private void onRender(DrawContext context, RenderTickCounter tickCounter, CallbackInfo ci) { - client.getProfiler().push(MeteorClient.MOD_ID + "_render_2d"); + Profilers.get().push(MeteorClient.MOD_ID + "_render_2d"); Utils.unscaledProjection(); MeteorClient.EVENT_BUS.post(Render2DEvent.get(context, context.getScaledWindowWidth(), context.getScaledWindowWidth(), tickCounter.getTickDelta(true))); Utils.scaledProjection(); - RenderSystem.applyModelViewMatrix(); - client.getProfiler().pop(); + Profilers.get().pop(); } @Inject(method = "renderStatusEffectOverlay", at = @At("HEAD"), cancellable = true) @@ -115,4 +110,9 @@ private void onClear(CallbackInfo info) { info.cancel(); } } + + @Inject(method = "renderNauseaOverlay", at = @At("HEAD"), cancellable = true) + private void onRenderNausea(DrawContext context, float distortionStrength, CallbackInfo ci) { + if (Modules.get().get(NoRender.class).noNausea()) ci.cancel(); + } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ItemEntityMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ItemEntityMixin.java deleted file mode 100644 index c24f735bed..0000000000 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ItemEntityMixin.java +++ /dev/null @@ -1,28 +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 meteordevelopment.meteorclient.mixininterface.IItemEntity; -import net.minecraft.entity.ItemEntity; -import net.minecraft.util.math.Vec3d; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Unique; - -@Mixin(ItemEntity.class) -public abstract class ItemEntityMixin implements IItemEntity { - @Unique - private Vec3d rotation = new Vec3d(0, 0, 0); - - @Override - public Vec3d getRotation() { - return rotation; - } - - @Override - public void setRotation(Vec3d rotation) { - this.rotation = rotation; - } -} diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ItemEntityRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ItemEntityRendererMixin.java index fe556b2b7c..bcb26058d6 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ItemEntityRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ItemEntityRendererMixin.java @@ -9,10 +9,9 @@ import meteordevelopment.meteorclient.events.render.RenderItemEntityEvent; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.entity.ItemEntityRenderer; +import net.minecraft.client.render.entity.state.ItemEntityRenderState; import net.minecraft.client.render.item.ItemRenderer; import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.ItemEntity; -import net.minecraft.util.math.random.Random; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -20,14 +19,17 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import static meteordevelopment.meteorclient.MeteorClient.mc; + @Mixin(ItemEntityRenderer.class) public abstract class ItemEntityRendererMixin { - @Shadow @Final private Random random; - @Shadow @Final private ItemRenderer itemRenderer; + @Shadow + @Final + private ItemRenderer itemRenderer; - @Inject(method = "render(Lnet/minecraft/entity/ItemEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At("HEAD"), cancellable = true) - private void render(ItemEntity itemEntity, float f, float g, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, CallbackInfo ci) { - RenderItemEntityEvent event = MeteorClient.EVENT_BUS.post(RenderItemEntityEvent.get(itemEntity, f, g, matrixStack, vertexConsumerProvider, i, random, itemRenderer)); + @Inject(method = "render(Lnet/minecraft/client/render/entity/state/ItemEntityRenderState;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At("HEAD"), cancellable = true) + private void renderStack(ItemEntityRenderState itemEntityRenderState, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, CallbackInfo ci) { + RenderItemEntityEvent event = MeteorClient.EVENT_BUS.post(RenderItemEntityEvent.get(itemEntityRenderState, mc.getRenderTickCounter().getTickDelta(true), matrixStack, vertexConsumerProvider, i, this.itemRenderer)); if (event.isCancelled()) ci.cancel(); } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ItemRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ItemRendererMixin.java index 039cc037ee..33375c89b5 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ItemRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ItemRendererMixin.java @@ -7,16 +7,13 @@ import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.render.NoRender; -import net.minecraft.block.StainedGlassPaneBlock; -import net.minecraft.block.TransparentBlock; import net.minecraft.client.render.RenderLayers; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.item.ItemRenderer; import net.minecraft.client.render.model.BakedModel; -import net.minecraft.client.render.model.json.ModelTransformationMode; import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.item.BlockItem; import net.minecraft.item.ItemStack; +import net.minecraft.item.ModelTransformationMode; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.ModifyArgs; @@ -25,15 +22,14 @@ @Mixin(ItemRenderer.class) public abstract class ItemRendererMixin { @ModifyArgs( - method = "renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/render/model/json/ModelTransformationMode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;IILnet/minecraft/client/render/model/BakedModel;)V", + method = "renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ModelTransformationMode;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;IILnet/minecraft/client/render/model/BakedModel;Z)V", at = @At( value = "INVOKE", target = "Lnet/minecraft/client/render/item/ItemRenderer;renderBakedItemModel(Lnet/minecraft/client/render/model/BakedModel;Lnet/minecraft/item/ItemStack;IILnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;)V" ) ) - private void modifyEnchant(Args args, ItemStack stack, ModelTransformationMode renderMode, boolean leftHanded, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, BakedModel model) { + private void modifyEnchant(Args args, ItemStack stack, ModelTransformationMode transformationMode, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, BakedModel model, boolean useInventoryModel) { if (!Modules.get().get(NoRender.class).noEnchantGlint()) return; - boolean bl = (renderMode == ModelTransformationMode.GUI || renderMode.isFirstPerson() || !(stack.getItem() instanceof BlockItem blockItem) || !(blockItem.getBlock() instanceof TransparentBlock) && !(blockItem.getBlock() instanceof StainedGlassPaneBlock)); - args.set(5, vertexConsumers.getBuffer(RenderLayers.getItemLayer(stack, bl))); + args.set(5, vertexConsumers.getBuffer(RenderLayers.getItemLayer(stack))); } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ItemStackMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ItemStackMixin.java index fac7631650..8a27c0d568 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ItemStackMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ItemStackMixin.java @@ -58,7 +58,7 @@ private boolean modifyContainsTooltip(boolean original) { return !(bt.isActive() && bt.tooltip.get()) && original; } - @ModifyExpressionValue(method = "getTooltip", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;contains(Lnet/minecraft/component/ComponentType;)Z", ordinal = 3)) + @ModifyExpressionValue(method = "getTooltip", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;contains(Lnet/minecraft/component/ComponentType;)Z", ordinal = 2)) private boolean modifyContainsAdditional(boolean original) { BetterTooltips bt = Modules.get().get(BetterTooltips.class); return !(bt.isActive() && bt.additional.get()) && original; diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/KeyboardInputMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/KeyboardInputMixin.java index 83c38782e3..9ad5146b79 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/KeyboardInputMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/KeyboardInputMixin.java @@ -9,6 +9,7 @@ import meteordevelopment.meteorclient.systems.modules.movement.Sneak; import net.minecraft.client.input.Input; import net.minecraft.client.input.KeyboardInput; +import net.minecraft.util.PlayerInput; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -18,6 +19,14 @@ public abstract class KeyboardInputMixin extends Input { @Inject(method = "tick", at = @At("TAIL")) private void isPressed(boolean slowDown, float f, CallbackInfo ci) { - if (Modules.get().get(Sneak.class).doVanilla()) sneaking = true; + if (Modules.get().get(Sneak.class).doVanilla()) playerInput = new PlayerInput( + playerInput.forward(), + playerInput.backward(), + playerInput.left(), + playerInput.right(), + playerInput.jump(), + true, + playerInput.sprint() + ); } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/LightmapTextureManagerMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/LightmapTextureManagerMixin.java index a55a800623..9a873e0c4f 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/LightmapTextureManagerMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/LightmapTextureManagerMixin.java @@ -9,20 +9,26 @@ import meteordevelopment.meteorclient.systems.modules.render.Fullbright; import meteordevelopment.meteorclient.systems.modules.render.NoRender; import meteordevelopment.meteorclient.systems.modules.render.Xray; +import net.minecraft.client.gl.SimpleFramebuffer; import net.minecraft.client.render.LightmapTextureManager; +import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.ModifyArgs; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.spongepowered.asm.mixin.injection.invoke.arg.Args; @Mixin(LightmapTextureManager.class) public abstract class LightmapTextureManagerMixin { - @ModifyArgs(method = "update", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/texture/NativeImage;setColor(III)V")) - private void update(Args args) { + @Shadow + @Final + private SimpleFramebuffer lightmapFramebuffer; + + @Inject(method = "update", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gl/SimpleFramebuffer;endWrite()V", shift = At.Shift.BEFORE)) + private void onUpdate(CallbackInfo info) { if (Modules.get().get(Fullbright.class).getGamma() || Modules.get().isActive(Xray.class)) { - args.set(2, 0xFFFFFFFF); + this.lightmapFramebuffer.clear(); } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/LivingEntityMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/LivingEntityMixin.java index b99504bf35..f40ab07655 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/LivingEntityMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/LivingEntityMixin.java @@ -30,6 +30,7 @@ import net.minecraft.fluid.FluidState; import net.minecraft.item.ItemStack; import net.minecraft.registry.entry.RegistryEntry; +import net.minecraft.server.world.ServerWorld; import net.minecraft.util.Hand; import net.minecraft.world.World; import org.spongepowered.asm.mixin.Mixin; @@ -47,7 +48,7 @@ public LivingEntityMixin(EntityType type, World world) { } @Inject(method = "damage", at = @At("HEAD")) - private void onDamageHead(DamageSource source, float amount, CallbackInfoReturnable info) { + private void onDamageHead(ServerWorld world, DamageSource source, float amount, CallbackInfoReturnable cir) { if (Utils.canUpdate() && getWorld().isClient) MeteorClient.EVENT_BUS.post(DamageEvent.get((LivingEntity) (Object) this, source)); } @@ -89,8 +90,8 @@ private int getHandSwingDuration(int constant) { return Modules.get().get(HandView.class).isActive() && mc.options.getPerspective().isFirstPerson() ? Modules.get().get(HandView.class).swingSpeed.get() : constant; } - @ModifyReturnValue(method = "isFallFlying", at = @At("RETURN")) - private boolean isFallFlyingHook(boolean original) { + @ModifyReturnValue(method = "isGliding", at = @At("RETURN")) + private boolean isGlidingHook(boolean original) { if ((Object) this == mc.player && Modules.get().get(ElytraFly.class).canPacketEfly()) { return true; } @@ -101,7 +102,7 @@ private boolean isFallFlyingHook(boolean original) { @Unique private boolean previousElytra = false; - @Inject(method = "isFallFlying", at = @At("TAIL"), cancellable = true) + @Inject(method = "isGliding", at = @At("TAIL"), cancellable = true) public void recastOnLand(CallbackInfoReturnable cir) { boolean elytra = cir.getReturnValue(); ElytraFly elytraFly = Modules.get().get(ElytraFly.class); diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/LivingEntityRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/LivingEntityRendererMixin.java index 258f9d3692..a3b8586969 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/LivingEntityRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/LivingEntityRendererMixin.java @@ -6,126 +6,109 @@ package meteordevelopment.meteorclient.mixin; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; +import com.llamalad7.mixinextras.injector.ModifyReturnValue; +import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; +import meteordevelopment.meteorclient.mixininterface.IEntityRenderState; import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.render.Chams; import meteordevelopment.meteorclient.systems.modules.render.Freecam; import meteordevelopment.meteorclient.systems.modules.render.NoRender; import meteordevelopment.meteorclient.utils.player.PlayerUtils; -import meteordevelopment.meteorclient.utils.player.Rotations; -import meteordevelopment.meteorclient.utils.render.color.Color; import net.minecraft.client.render.RenderLayer; +import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.entity.LivingEntityRenderer; import net.minecraft.client.render.entity.model.EntityModel; +import net.minecraft.client.render.entity.state.LivingEntityRenderState; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.scoreboard.Team; -import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.*; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.invoke.arg.Args; import static meteordevelopment.meteorclient.MeteorClient.mc; -import static org.lwjgl.opengl.GL11.*; +import static org.lwjgl.opengl.GL11C.*; @Mixin(LivingEntityRenderer.class) -public abstract class LivingEntityRendererMixin> { - @Shadow @Nullable - protected abstract RenderLayer getRenderLayer(T entity, boolean showBody, boolean translucent, boolean showOutline); - +public abstract class LivingEntityRendererMixin> { // Freecam - @ModifyExpressionValue(method = "hasLabel(Lnet/minecraft/entity/LivingEntity;)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;getCameraEntity()Lnet/minecraft/entity/Entity;")) + @ModifyExpressionValue(method = "hasLabel(Lnet/minecraft/entity/LivingEntity;D)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;getCameraEntity()Lnet/minecraft/entity/Entity;")) private Entity hasLabelGetCameraEntityProxy(Entity cameraEntity) { return Modules.get().isActive(Freecam.class) ? null : cameraEntity; } - //3rd Person Rotation + // Player model rendering in main menu - @ModifyVariable(method = "render(Lnet/minecraft/entity/LivingEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", ordinal = 2, at = @At(value = "STORE", ordinal = 0)) - public float changeYaw(float oldValue, LivingEntity entity) { - if (entity.equals(mc.player) && Rotations.rotationTimer < 10) return Rotations.serverYaw; - return oldValue; + @ModifyExpressionValue(method = "hasLabel(Lnet/minecraft/entity/LivingEntity;D)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;getScoreboardTeam()Lnet/minecraft/scoreboard/Team;")) + private Team hasLabelClientPlayerEntityGetScoreboardTeamProxy(Team team) { + return (mc.player == null) ? null : team; } - @ModifyVariable(method = "render(Lnet/minecraft/entity/LivingEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", ordinal = 3, at = @At(value = "STORE", ordinal = 0)) - public float changeHeadYaw(float oldValue, LivingEntity entity) { - if (entity.equals(mc.player) && Rotations.rotationTimer < 10) return Rotations.serverYaw; - return oldValue; + // Chams + + @Unique + private Chams chams; + + @Inject(method = "", at = @At("RETURN")) + private void init$chams(CallbackInfo info) { + chams = Modules.get().get(Chams.class); } - @ModifyVariable(method = "render(Lnet/minecraft/entity/LivingEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", ordinal = 5, at = @At(value = "STORE", ordinal = 3)) - public float changePitch(float oldValue, LivingEntity entity) { - if (entity.equals(mc.player) && Rotations.rotationTimer < 10) return Rotations.serverPitch; - return oldValue; + // Chams - player color + + @WrapWithCondition(method = "render(Lnet/minecraft/client/render/entity/state/LivingEntityRenderState;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/model/EntityModel;render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;III)V")) + private boolean render$render(M instance, MatrixStack matrixStack, VertexConsumer vertexConsumer, int light, int overlay, int color, S state, MatrixStack matrices, VertexConsumerProvider consumers, int i) { + if (!chams.isActive() || !chams.players.get() || !(((IEntityRenderState) state).meteor$getEntity() instanceof PlayerEntity player)) return true; + if (chams.ignoreSelf.get() && player == mc.player) return true; + + instance.render(matrixStack, vertexConsumer, light, overlay, PlayerUtils.getPlayerColor(player, chams.playersColor.get()).getPacked()); + return false; } - // Player model rendering in main menu + // Chams - Player texture - @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) { - return (mc.player == null) ? null : team; + @ModifyReturnValue(method = "getRenderLayer", at = @At("RETURN")) + private RenderLayer getRenderPlayer(RenderLayer original, S state, boolean showBody, boolean translucent, boolean showOutline) { + if (!chams.isActive() || !(((IEntityRenderState) state).meteor$getEntity() instanceof PlayerEntity player)) + return original; + + if (!chams.players.get() || chams.playersTexture.get()) + return original; + if (chams.ignoreSelf.get() && player == mc.player) + return original; + + return RenderLayer.getItemEntityTranslucentCull(Chams.BLANK); } - // Through walls chams + // Chams - Through walls - @Inject(method = "render(Lnet/minecraft/entity/LivingEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At("HEAD"), cancellable = true) - private void renderHead(T livingEntity, float f, float g, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, CallbackInfo ci) { - if (Modules.get().get(NoRender.class).noDeadEntities() && livingEntity.isDead()) ci.cancel(); + @Inject(method = "render(Lnet/minecraft/client/render/entity/state/LivingEntityRenderState;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At("HEAD"), cancellable = true) + private void render$Head(S state, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, CallbackInfo info) { + Entity entity = ((IEntityRenderState) state).meteor$getEntity(); + if (!(entity instanceof LivingEntity livingEntity)) return; - Chams chams = Modules.get().get(Chams.class); + if (Modules.get().get(NoRender.class).noDeadEntities() && livingEntity.isDead()) info.cancel(); - if (chams.isActive() && chams.shouldRender(livingEntity)) { + if (chams.shouldRender(entity)) { glEnable(GL_POLYGON_OFFSET_FILL); glPolygonOffset(1.0f, -1100000.0f); } } - @Inject(method = "render(Lnet/minecraft/entity/LivingEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At("TAIL")) - private void renderTail(T livingEntity, float f, float g, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, CallbackInfo ci) { - Chams chams = Modules.get().get(Chams.class); + @Inject(method = "render(Lnet/minecraft/client/render/entity/state/LivingEntityRenderState;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At("TAIL")) + private void render$Tail(S state, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, CallbackInfo info) { + Entity entity = ((IEntityRenderState) state).meteor$getEntity(); + if (!(entity instanceof LivingEntity livingEntity)) return; - if (chams.isActive() && chams.shouldRender(livingEntity)) { + if (chams.shouldRender(livingEntity)) { glPolygonOffset(1.0f, 1100000.0f); glDisable(GL_POLYGON_OFFSET_FILL); } } - - // Player chams - - @ModifyArgs(method = "render(Lnet/minecraft/entity/LivingEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/math/MatrixStack;scale(FFF)V", ordinal = 1)) - private void modifyScale(Args args, T livingEntity, float f, float g, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i) { - Chams module = Modules.get().get(Chams.class); - if (!module.isActive() || !module.players.get() || !(livingEntity instanceof PlayerEntity)) return; - if (module.ignoreSelf.get() && livingEntity == mc.player) return; - - args.set(0, -module.playersScale.get().floatValue()); - args.set(1, -module.playersScale.get().floatValue()); - args.set(2, module.playersScale.get().floatValue()); - } - - @ModifyArgs(method = "render(Lnet/minecraft/entity/LivingEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/model/EntityModel;render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;III)V")) - private void modifyColor(Args args, T livingEntity, float f, float g, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i) { - Chams module = Modules.get().get(Chams.class); - if (!module.isActive() || !module.players.get() || !(livingEntity instanceof PlayerEntity)) return; - if (module.ignoreSelf.get() && livingEntity == mc.player) return; - - Color color = PlayerUtils.getPlayerColor(((PlayerEntity) livingEntity), module.playersColor.get()); - args.set(4, color.getPacked()); - } - - @Redirect(method = "render(Lnet/minecraft/entity/LivingEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/LivingEntityRenderer;getRenderLayer(Lnet/minecraft/entity/LivingEntity;ZZZ)Lnet/minecraft/client/render/RenderLayer;")) - private RenderLayer getRenderLayer(LivingEntityRenderer livingEntityRenderer, T livingEntity, boolean showBody, boolean translucent, boolean showOutline) { - Chams module = Modules.get().get(Chams.class); - if (!module.isActive() || !module.players.get() || !(livingEntity instanceof PlayerEntity) || module.playersTexture.get()) - return getRenderLayer(livingEntity, showBody, translucent, showOutline); - if (module.ignoreSelf.get() && livingEntity == mc.player) - return getRenderLayer(livingEntity, showBody, translucent, showOutline); - - return RenderLayer.getItemEntityTranslucentCull(Chams.BLANK); - } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/MapRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/MapRendererMixin.java index 9df35f2209..4a064dccf2 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/MapRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/MapRendererMixin.java @@ -8,7 +8,7 @@ import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.render.NoRender; -import meteordevelopment.meteorclient.utils.misc.EmptyIterator; +import net.minecraft.client.render.MapRenderState; import net.minecraft.client.render.MapRenderer; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.util.math.MatrixStack; @@ -18,15 +18,17 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -@Mixin(MapRenderer.MapTexture.class) +import java.util.List; + +@Mixin(MapRenderer.class) public abstract class MapRendererMixin { - @ModifyExpressionValue(method = "draw(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ZI)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/map/MapState;getDecorations()Ljava/lang/Iterable;")) - private Iterable getIconsProxy(Iterable original) { - return (Modules.get().get(NoRender.class).noMapMarkers()) ? EmptyIterator::new : original; + @ModifyExpressionValue(method = "draw(Lnet/minecraft/client/render/MapRenderState;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ZI)V", at = @At(value = "FIELD", target = "Lnet/minecraft/client/render/MapRenderState;decorations:Ljava/util/List;")) + private List getIconsProxy(List original) { + return (Modules.get().get(NoRender.class).noMapMarkers()) ? List.of() : original; } - @Inject(method = "draw(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ZI)V", at = @At("HEAD"), cancellable = true) - private void onDraw(MatrixStack matrices, VertexConsumerProvider vertexConsumers, boolean hidePlayerIcons, int light, CallbackInfo ci) { + @Inject(method = "draw(Lnet/minecraft/client/render/MapRenderState;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ZI)V", at = @At("HEAD"), cancellable = true) + private void onDraw(MapRenderState state, MatrixStack matrices, VertexConsumerProvider vertexConsumers, boolean bl, int light, CallbackInfo ci) { if (Modules.get().get(NoRender.class).noMapContents()) ci.cancel(); } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/MapRendererAccessor.java b/src/main/java/meteordevelopment/meteorclient/mixin/MapTextureManagerAccessor.java similarity index 65% rename from src/main/java/meteordevelopment/meteorclient/mixin/MapRendererAccessor.java rename to src/main/java/meteordevelopment/meteorclient/mixin/MapTextureManagerAccessor.java index d2565ef54d..d68ea823dc 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/MapRendererAccessor.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/MapTextureManagerAccessor.java @@ -5,14 +5,14 @@ package meteordevelopment.meteorclient.mixin; -import net.minecraft.client.render.MapRenderer; +import net.minecraft.client.texture.MapTextureManager; import net.minecraft.component.type.MapIdComponent; import net.minecraft.item.map.MapState; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Invoker; -@Mixin(MapRenderer.class) -public interface MapRendererAccessor { +@Mixin(MapTextureManager.class) +public interface MapTextureManagerAccessor { @Invoker("getMapTexture") - MapRenderer.MapTexture invokeGetMapTexture(MapIdComponent id, MapState state); + MapTextureManager.MapTexture invokeGetMapTexture(MapIdComponent id, MapState state); } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/MinecraftClientMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/MinecraftClientMixin.java index 68edcb4a23..75531985bf 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/MinecraftClientMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/MinecraftClientMixin.java @@ -7,6 +7,7 @@ import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import com.llamalad7.mixinextras.injector.ModifyReturnValue; +import com.llamalad7.mixinextras.sugar.Local; import meteordevelopment.meteorclient.MeteorClient; import meteordevelopment.meteorclient.events.entity.player.ItemUseCrosshairTargetEvent; import meteordevelopment.meteorclient.events.game.GameLeftEvent; @@ -20,7 +21,6 @@ import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.player.FastUse; import meteordevelopment.meteorclient.systems.modules.player.Multitask; -import meteordevelopment.meteorclient.systems.modules.render.UnfocusedCPU; import meteordevelopment.meteorclient.utils.Utils; import meteordevelopment.meteorclient.utils.misc.CPSUtils; import meteordevelopment.meteorclient.utils.misc.MeteorStarscript; @@ -35,9 +35,8 @@ import net.minecraft.client.util.Window; import net.minecraft.client.world.ClientWorld; import net.minecraft.item.ItemStack; -import net.minecraft.util.Hand; import net.minecraft.util.hit.HitResult; -import net.minecraft.util.profiler.Profiler; +import net.minecraft.util.profiler.Profilers; import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -48,7 +47,6 @@ import org.spongepowered.asm.mixin.injection.ModifyArg; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; import java.util.concurrent.CompletableFuture; @@ -66,8 +64,6 @@ public abstract class MinecraftClientMixin implements IMinecraftClient { @Shadow @Final public GameOptions options; @Shadow protected abstract void doItemUse(); - @Shadow public abstract Profiler getProfiler(); - @Shadow public abstract boolean isWindowFocused(); @Shadow @Nullable @@ -92,9 +88,9 @@ private void onPreTick(CallbackInfo info) { doItemUseCalled = false; - getProfiler().push(MeteorClient.MOD_ID + "_pre_update"); + Profilers.get().push(MeteorClient.MOD_ID + "_pre_update"); MeteorClient.EVENT_BUS.post(TickEvent.Pre.get()); - getProfiler().pop(); + Profilers.get().pop(); if (rightClick && !doItemUseCalled && interactionManager != null) doItemUse(); rightClick = false; @@ -102,9 +98,9 @@ private void onPreTick(CallbackInfo info) { @Inject(at = @At("TAIL"), method = "tick") private void onTick(CallbackInfo info) { - getProfiler().push(MeteorClient.MOD_ID + "_post_update"); + Profilers.get().push(MeteorClient.MOD_ID + "_post_update"); MeteorClient.EVENT_BUS.post(TickEvent.Post.get()); - getProfiler().pop(); + Profilers.get().pop(); } @Inject(method = "doAttack", at = @At("HEAD")) @@ -134,8 +130,8 @@ private void onSetScreen(Screen screen, CallbackInfo info) { if (event.isCancelled()) info.cancel(); } - @Inject(method = "doItemUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;isItemEnabled(Lnet/minecraft/resource/featuretoggle/FeatureSet;)Z"), locals = LocalCapture.CAPTURE_FAILHARD) - private void onDoItemUseHand(CallbackInfo ci, Hand[] var1, int var2, int var3, Hand hand, ItemStack itemStack) { + @Inject(method = "doItemUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;isItemEnabled(Lnet/minecraft/resource/featuretoggle/FeatureSet;)Z")) + private void onDoItemUseHand(CallbackInfo ci, @Local ItemStack itemStack) { FastUse fastUse = Modules.get().get(FastUse.class); if (fastUse.isActive()) { itemUseCooldown = fastUse.getItemUseCooldown(itemStack); @@ -172,11 +168,6 @@ private void onResolutionChanged(CallbackInfo info) { MeteorClient.EVENT_BUS.post(ResolutionChangedEvent.get()); } - @Inject(method = "getFramerateLimit", at = @At("HEAD"), cancellable = true) - private void onGetFramerateLimit(CallbackInfoReturnable info) { - if (Modules.get().isActive(UnfocusedCPU.class) && !isWindowFocused()) info.setReturnValue(Math.min(Modules.get().get(UnfocusedCPU.class).fps.get(), this.options.getMaxFps().getValue())); - } - // Time delta @Inject(method = "render", at = @At("HEAD")) @@ -220,7 +211,7 @@ private void handleInputEventsInjectStopUsingItem(CallbackInfo info) { // Interface @Override - public void meteor_client$rightClick() { + public void meteor$rightClick() { rightClick = true; } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/MiningToolItemMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/MiningToolItemMixin.java new file mode 100644 index 0000000000..391024fc92 --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/mixin/MiningToolItemMixin.java @@ -0,0 +1,34 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.mixin; + +import meteordevelopment.meteorclient.mixininterface.IMiningToolItem; +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.MiningToolItem; +import net.minecraft.item.ToolMaterial; +import net.minecraft.registry.tag.TagKey; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(MiningToolItem.class) +public abstract class MiningToolItemMixin implements IMiningToolItem { + @Unique + private ToolMaterial material; + + @Inject(method = "", at = @At("TAIL")) + private void onInit(ToolMaterial material, TagKey effectiveBlocks, float attackDamage, float attackSpeed, Item.Settings settings, CallbackInfo info) { + this.material = material; + } + + @Override + public ToolMaterial meteor$getMaterial() { + return material; + } +} diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/MultiPhaseMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/MultiPhaseMixin.java new file mode 100644 index 0000000000..ba7a2a8a7b --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/mixin/MultiPhaseMixin.java @@ -0,0 +1,24 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.mixin; + +import meteordevelopment.meteorclient.mixininterface.IMultiPhase; +import net.minecraft.client.render.RenderLayer; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; + +@Mixin(RenderLayer.MultiPhase.class) +public abstract class MultiPhaseMixin implements IMultiPhase { + @Shadow + @Final + private RenderLayer.MultiPhaseParameters phases; + + @Override + public RenderLayer.MultiPhaseParameters meteor$getParameters() { + return this.phases; + } +} diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/MultiPhaseParametersMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/MultiPhaseParametersMixin.java new file mode 100644 index 0000000000..bd5614526e --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/mixin/MultiPhaseParametersMixin.java @@ -0,0 +1,25 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.mixin; + +import meteordevelopment.meteorclient.mixininterface.IMultiPhaseParameters; +import net.minecraft.client.render.RenderLayer; +import net.minecraft.client.render.RenderPhase; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; + +@Mixin(RenderLayer.MultiPhaseParameters.class) +public abstract class MultiPhaseParametersMixin implements IMultiPhaseParameters { + @Shadow + @Final + private RenderPhase.Target target; + + @Override + public RenderPhase.Target meteor$getTarget() { + return this.target; + } +} diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/PlayerEntityMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/PlayerEntityMixin.java index fdebf5e9e2..bb90fb9987 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/PlayerEntityMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/PlayerEntityMixin.java @@ -30,7 +30,6 @@ import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import static meteordevelopment.meteorclient.MeteorClient.mc; @@ -53,9 +52,9 @@ protected void clipAtLedge(CallbackInfoReturnable info) { } @Inject(method = "dropItem(Lnet/minecraft/item/ItemStack;ZZ)Lnet/minecraft/entity/ItemEntity;", at = @At("HEAD"), cancellable = true) - private void onDropItem(ItemStack stack, boolean bl, boolean bl2, CallbackInfoReturnable info) { + private void onDropItem(ItemStack stack, boolean bl, boolean bl2, CallbackInfoReturnable cir) { if (getWorld().isClient && !stack.isEmpty()) { - if (MeteorClient.EVENT_BUS.post(DropItemsEvent.get(stack)).isCancelled()) info.cancel(); + if (MeteorClient.EVENT_BUS.post(DropItemsEvent.get(stack)).isCancelled()) cir.setReturnValue(null); } } @@ -80,15 +79,6 @@ public float onGetBlockBreakingSpeed(float breakSpeed, BlockState block) { return breakSpeed; } - @Inject(method = "jump", at = @At("HEAD"), cancellable = true) - public void dontJump(CallbackInfo info) { - if (!getWorld().isClient) return; - - Anchor module = Modules.get().get(Anchor.class); - if (module.isActive() && module.cancelJump) info.cancel(); - else if (Modules.get().get(Scaffold.class).towering()) info.cancel(); - } - @ModifyReturnValue(method = "getMovementSpeed", at = @At("RETURN")) private float onGetMovementSpeed(float original) { if (!getWorld().isClient) return original; diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/PlayerEntityRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/PlayerEntityRendererMixin.java index 42f87312f0..14800b114b 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/PlayerEntityRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/PlayerEntityRendererMixin.java @@ -5,59 +5,86 @@ package meteordevelopment.meteorclient.mixin; +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; +import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; +import meteordevelopment.meteorclient.MeteorClient; +import meteordevelopment.meteorclient.mixininterface.IEntityRenderState; +import meteordevelopment.meteorclient.mixininterface.IVec3d; import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.render.Chams; -import meteordevelopment.meteorclient.systems.modules.render.HandView; -import meteordevelopment.meteorclient.utils.render.color.Color; +import meteordevelopment.meteorclient.utils.player.Rotations; import net.minecraft.client.model.ModelPart; import net.minecraft.client.network.AbstractClientPlayerEntity; import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.entity.PlayerEntityRenderer; +import net.minecraft.client.render.entity.state.PlayerEntityRenderState; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.Identifier; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.ModifyArgs; -import org.spongepowered.asm.mixin.injection.Redirect; -import org.spongepowered.asm.mixin.injection.invoke.arg.Args; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(PlayerEntityRenderer.class) public abstract class PlayerEntityRendererMixin { - @ModifyArgs(method = "renderArm", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/model/ModelPart;render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;II)V", ordinal = 0)) - private void modifyRenderLayer(Args args, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, AbstractClientPlayerEntity player, ModelPart arm, ModelPart sleeve) { - Chams chams = Modules.get().get(Chams.class); + // Chams + @Unique + private Chams chams; + + @Inject(method = "", at = @At("RETURN")) + private void init$chams(CallbackInfo info) { + chams = Modules.get().get(Chams.class); + } + + // Chams - Player scale + + @Inject(method = "updateRenderState(Lnet/minecraft/client/network/AbstractClientPlayerEntity;Lnet/minecraft/client/render/entity/state/PlayerEntityRenderState;F)V", at = @At("RETURN")) + private void updateRenderState$scale(AbstractClientPlayerEntity player, PlayerEntityRenderState state, float f, CallbackInfo info) { + if (!chams.isActive() || !chams.players.get()) return; + if (chams.ignoreSelf.get() && player == MeteorClient.mc.player) return; + + float v = chams.playersScale.get().floatValue(); + state.baseScale *= v; + + if (state.nameLabelPos != null) + ((IVec3d) state.nameLabelPos).meteor$setY(state.nameLabelPos.y + (player.getHeight() * v - player.getHeight())); + } + + // Chams - Hand Texture + + @ModifyExpressionValue(method = "renderArm", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/RenderLayer;getEntityTranslucent(Lnet/minecraft/util/Identifier;)Lnet/minecraft/client/render/RenderLayer;")) + private RenderLayer renderArm$texture(RenderLayer original, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, Identifier skinTexture, ModelPart arm, boolean sleeveVisible) { if (chams.isActive() && chams.hand.get()) { - Identifier texture = chams.handTexture.get() ? player.getSkinTextures().texture() : Chams.BLANK; - args.set(1, vertexConsumers.getBuffer(RenderLayer.getEntityTranslucent(texture))); + Identifier texture = chams.handTexture.get() ? skinTexture : Chams.BLANK; + return RenderLayer.getEntityTranslucent(texture); } + + return original; } - @Redirect(method = "renderArm", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/model/ModelPart;render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;II)V", ordinal = 0)) - private void redirectRenderMain(ModelPart modelPart, MatrixStack matrices, VertexConsumer vertices, int light, int overlay) { - Chams chams = Modules.get().get(Chams.class); + // Chams - Hand Color + @WrapWithCondition(method = "renderArm", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/model/ModelPart;render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;II)V")) + private boolean renderArm$color(ModelPart instance, MatrixStack matrices, VertexConsumer vertices, int light, int overlay) { if (chams.isActive() && chams.hand.get()) { - Color color = chams.handColor.get(); - modelPart.render(matrices, vertices, light, overlay, color.getPacked()); - } else { - modelPart.render(matrices, vertices, light, overlay); + instance.render(matrices, vertices, light, overlay, chams.handColor.get().getPacked()); + return false; } - } - @Redirect(method = "renderArm", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/model/ModelPart;render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;II)V", ordinal = 1)) - private void redirectRenderSleeve(ModelPart modelPart, MatrixStack matrices, VertexConsumer vertices, int light, int overlay) { - Chams chams = Modules.get().get(Chams.class); + return true; + } - if (Modules.get().isActive(HandView.class)) return; + // Rotations - if (chams.isActive() && chams.hand.get()) { - Color color = chams.handColor.get(); - modelPart.render(matrices, vertices, light, overlay, color.getPacked()); - } else { - modelPart.render(matrices, vertices, light, overlay); + @Inject(method = "updateRenderState(Lnet/minecraft/client/network/AbstractClientPlayerEntity;Lnet/minecraft/client/render/entity/state/PlayerEntityRenderState;F)V", at = @At("RETURN")) + private void updateRenderState$rotations(AbstractClientPlayerEntity player, PlayerEntityRenderState state, float f, CallbackInfo info) { + if (Rotations.rotating && ((IEntityRenderState) state).meteor$getEntity() == MeteorClient.mc.player) { + state.bodyYaw = Rotations.serverYaw; + state.pitch = Rotations.serverPitch; } } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/PlayerInteractEntityC2SPacketMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/PlayerInteractEntityC2SPacketMixin.java index 4e919c46fe..458e49a6e5 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/PlayerInteractEntityC2SPacketMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/PlayerInteractEntityC2SPacketMixin.java @@ -25,12 +25,12 @@ public abstract class PlayerInteractEntityC2SPacketMixin implements IPlayerInter @Shadow @Final private int entityId; @Override - public PlayerInteractEntityC2SPacket.InteractType getType() { + public PlayerInteractEntityC2SPacket.InteractType meteor$getType() { return type.getType(); } @Override - public Entity getEntity() { + public Entity meteor$getEntity() { return mc.world.getEntityById(entityId); } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/PlayerMoveC2SPacketMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/PlayerMoveC2SPacketMixin.java index c7cf3a4e91..e056bdf71d 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/PlayerMoveC2SPacketMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/PlayerMoveC2SPacketMixin.java @@ -15,8 +15,8 @@ public abstract class PlayerMoveC2SPacketMixin implements IPlayerMoveC2SPacket { @Unique private int tag; @Override - public void setTag(int tag) { this.tag = tag; } + public void meteor$setTag(int tag) { this.tag = tag; } @Override - public int getTag() { return this.tag; } + public int meteor$getTag() { return this.tag; } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/PlayerPositionLookS2CPacketAccessor.java b/src/main/java/meteordevelopment/meteorclient/mixin/PlayerPositionLookS2CPacketAccessor.java deleted file mode 100644 index a1a1b62fb3..0000000000 --- a/src/main/java/meteordevelopment/meteorclient/mixin/PlayerPositionLookS2CPacketAccessor.java +++ /dev/null @@ -1,22 +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.network.packet.s2c.play.PlayerPositionLookS2CPacket; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Mutable; -import org.spongepowered.asm.mixin.gen.Accessor; - -@Mixin(PlayerPositionLookS2CPacket.class) -public interface PlayerPositionLookS2CPacketAccessor { - @Mutable - @Accessor("yaw") - void setYaw(float yaw); - - @Mutable - @Accessor("pitch") - void setPitch(float pitch); -} diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ProjectileInGroundAccessor.java b/src/main/java/meteordevelopment/meteorclient/mixin/ProjectileInGroundAccessor.java index 2d2f393c70..ebe168ba11 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ProjectileInGroundAccessor.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ProjectileInGroundAccessor.java @@ -7,10 +7,10 @@ import net.minecraft.entity.projectile.PersistentProjectileEntity; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; +import org.spongepowered.asm.mixin.gen.Invoker; @Mixin(PersistentProjectileEntity.class) public interface ProjectileInGroundAccessor { - @Accessor("inGround") - boolean getInGround(); + @Invoker("isInGround") + boolean invokeIsInGround(); } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/RaycastContextMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/RaycastContextMixin.java index cb25de2505..8a549798bd 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/RaycastContextMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/RaycastContextMixin.java @@ -24,7 +24,7 @@ public abstract class RaycastContextMixin implements IRaycastContext { @Shadow @Final @Mutable private ShapeContext shapeContext; @Override - public void set(Vec3d start, Vec3d end, RaycastContext.ShapeType shapeType, RaycastContext.FluidHandling fluidHandling, Entity entity) { + public void meteor$set(Vec3d start, Vec3d end, RaycastContext.ShapeType shapeType, RaycastContext.FluidHandling fluidHandling, Entity entity) { this.start = start; this.end = end; this.shapeType = shapeType; diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ScreenMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ScreenMixin.java index 5aebc5034a..f4cc426625 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ScreenMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ScreenMixin.java @@ -58,12 +58,12 @@ private void onRunCommand(Style style, CallbackInfoReturnable cir) { } @Inject(method = "keyPressed", at = @At("HEAD"), cancellable = true) - private void onKeyPressed(int keyCode, int scanCode, int modifiers, CallbackInfoReturnable info) { + private void onKeyPressed(int keyCode, int scanCode, int modifiers, CallbackInfoReturnable cir) { if ((Object) (this) instanceof ChatScreen) return; GUIMove guiMove = Modules.get().get(GUIMove.class); List arrows = List.of(GLFW_KEY_RIGHT, GLFW_KEY_LEFT, GLFW_KEY_DOWN, GLFW_KEY_UP); if ((guiMove.disableArrows() && arrows.contains(keyCode)) || (guiMove.disableSpace() && keyCode == GLFW_KEY_SPACE)) { - info.cancel(); + cir.setReturnValue(true); } } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ServerPlayerEntityMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ServerPlayerEntityMixin.java new file mode 100644 index 0000000000..aca212a707 --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ServerPlayerEntityMixin.java @@ -0,0 +1,45 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.mixin; + +import meteordevelopment.meteorclient.MeteorClient; +import meteordevelopment.meteorclient.events.entity.DamageEvent; +import meteordevelopment.meteorclient.systems.modules.Modules; +import meteordevelopment.meteorclient.systems.modules.movement.Anchor; +import meteordevelopment.meteorclient.systems.modules.movement.Scaffold; +import meteordevelopment.meteorclient.utils.Utils; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.damage.DamageSource; +import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(ServerPlayerEntity.class) +public abstract class ServerPlayerEntityMixin extends LivingEntity { + protected ServerPlayerEntityMixin(EntityType entityType, World world) { + super(entityType, world); + } + + @Inject(method = "jump", at = @At("HEAD"), cancellable = true) + public void dontJump(CallbackInfo ci) { + if (!getWorld().isClient) return; + + Anchor module = Modules.get().get(Anchor.class); + if (module.isActive() && module.cancelJump) ci.cancel(); + else if (Modules.get().get(Scaffold.class).towering()) ci.cancel(); + } + + @Inject(method = "damage", at = @At("HEAD")) + private void onDamage(ServerWorld world, DamageSource source, float amount, CallbackInfoReturnable cir) { + if (Utils.canUpdate() && getWorld().isClient && canTakeDamage()) MeteorClient.EVENT_BUS.post(DamageEvent.get(this, source)); + } +} diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ShapeIndexBufferAccessor.java b/src/main/java/meteordevelopment/meteorclient/mixin/ShapeIndexBufferAccessor.java index 6005c15cc9..5627985aa5 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ShapeIndexBufferAccessor.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ShapeIndexBufferAccessor.java @@ -6,11 +6,12 @@ package meteordevelopment.meteorclient.mixin; import com.mojang.blaze3d.systems.RenderSystem; +import net.minecraft.client.gl.GpuBuffer; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; @Mixin(RenderSystem.ShapeIndexBuffer.class) public interface ShapeIndexBufferAccessor { - @Accessor("id") - int getId(); + @Accessor("buffer") + GpuBuffer getBuffer(); } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/SimpleOptionMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/SimpleOptionMixin.java index b0b0f109ce..0b841a1026 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/SimpleOptionMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/SimpleOptionMixin.java @@ -21,7 +21,7 @@ public abstract class SimpleOptionMixin implements ISimpleOption { @Shadow @Final private Consumer changeCallback; @Override - public void set(Object value) { + public void meteor$set(Object value) { if (!MinecraftClient.getInstance().isRunning()) { this.value = value; } else { diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/SkyRenderingMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/SkyRenderingMixin.java new file mode 100644 index 0000000000..b155888d17 --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/mixin/SkyRenderingMixin.java @@ -0,0 +1,40 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.mixin; + +import meteordevelopment.meteorclient.systems.modules.Modules; +import meteordevelopment.meteorclient.systems.modules.world.Ambience; +import meteordevelopment.meteorclient.utils.render.color.Color; +import net.minecraft.client.render.*; +import net.minecraft.client.util.math.MatrixStack; +import org.joml.Matrix4f; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(SkyRendering.class) +public abstract class SkyRenderingMixin { + // Ambience + + @Inject(method = "renderEndSky", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/BufferRenderer;drawWithGlobalProgram(Lnet/minecraft/client/render/BuiltBuffer;)V")) + private void onRenderEndSkyDraw(MatrixStack matrices, CallbackInfo info) { + Ambience ambience = Modules.get().get(Ambience.class); + + if (ambience.isActive() && ambience.endSky.get() && ambience.customSkyColor.get()) { + Color customEndSkyColor = ambience.skyColor(); + + Tessellator tessellator = Tessellator.getInstance(); + BufferBuilder bufferBuilder = tessellator.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE_COLOR); + Matrix4f matrix4f = matrices.peek().getPositionMatrix(); + + bufferBuilder.vertex(matrix4f, -100.0F, -100.0F, -100.0F).texture(0.0F, 0.0F).color(customEndSkyColor.r, customEndSkyColor.g, customEndSkyColor.b, 255); + bufferBuilder.vertex(matrix4f, -100.0F, -100.0F, 100.0F).texture(0.0F, 16.0F).color(customEndSkyColor.r, customEndSkyColor.g, customEndSkyColor.b, 255); + bufferBuilder.vertex(matrix4f, 100.0F, -100.0F, 100.0F).texture(16.0F, 16.0F).color(customEndSkyColor.r, customEndSkyColor.g, customEndSkyColor.b, 255); + bufferBuilder.vertex(matrix4f, 100.0F, -100.0F, -100.0F).texture(16.0F, 0.0F).color(customEndSkyColor.r, customEndSkyColor.g, customEndSkyColor.b, 255); + } + } +} diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/SlotMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/SlotMixin.java index ff09a3dbf6..7289bf0fbf 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/SlotMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/SlotMixin.java @@ -17,12 +17,12 @@ public abstract class SlotMixin implements ISlot { @Shadow @Final private int index; @Override - public int getId() { + public int meteor$getId() { return id; } @Override - public int getIndex() { + public int meteor$getIndex() { return index; } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/TridentItemMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/TridentItemMixin.java index 4bbdf059c0..0d3e1a9e71 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/TridentItemMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/TridentItemMixin.java @@ -17,7 +17,7 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.ModifyArgs; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.invoke.arg.Args; import static meteordevelopment.meteorclient.MeteorClient.mc; @@ -25,12 +25,12 @@ @Mixin(TridentItem.class) public abstract class TridentItemMixin { @Inject(method = "onStoppedUsing", at = @At("HEAD")) - private void onStoppedUsingHead(ItemStack stack, World world, LivingEntity user, int remainingUseTicks, CallbackInfo info) { + private void onStoppedUsingHead(ItemStack stack, World world, LivingEntity user, int remainingUseTicks, CallbackInfoReturnable info) { if (user == mc.player) Utils.isReleasingTrident = true; } @Inject(method = "onStoppedUsing", at = @At("TAIL")) - private void onStoppedUsingTail(ItemStack stack, World world, LivingEntity user, int remainingUseTicks, CallbackInfo info) { + private void onStoppedUsingTail(ItemStack stack, World world, LivingEntity user, int remainingUseTicks, CallbackInfoReturnable info) { if (user == mc.player) Utils.isReleasingTrident = false; } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/Vec3dMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/Vec3dMixin.java index ac71e313f9..818a571744 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/Vec3dMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/Vec3dMixin.java @@ -19,20 +19,20 @@ public abstract class Vec3dMixin implements IVec3d { @Shadow @Final @Mutable public double z; @Override - public void set(double x, double y, double z) { + public void meteor$set(double x, double y, double z) { this.x = x; this.y = y; this.z = z; } @Override - public void setXZ(double x, double z) { + public void meteor$setXZ(double x, double z) { this.x = x; this.z = z; } @Override - public void setY(double y) { + public void meteor$setY(double y) { this.y = y; } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/VertexBufferMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/VertexBufferMixin.java index 1f02d3cd4e..01729de73d 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/VertexBufferMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/VertexBufferMixin.java @@ -7,8 +7,10 @@ import com.mojang.blaze3d.systems.RenderSystem; import meteordevelopment.meteorclient.renderer.GL; +import net.minecraft.client.gl.GpuBuffer; import net.minecraft.client.gl.VertexBuffer; import net.minecraft.client.render.BuiltBuffer; +import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -19,11 +21,13 @@ @Mixin(VertexBuffer.class) public abstract class VertexBufferMixin { - @Shadow private int indexBufferId; + @Shadow + @Nullable + private GpuBuffer indexBuffer; @Inject(method = "uploadIndexBuffer(Lnet/minecraft/client/render/BuiltBuffer$DrawParameters;Ljava/nio/ByteBuffer;)Lcom/mojang/blaze3d/systems/RenderSystem$ShapeIndexBuffer;", at = @At("RETURN")) private void onConfigureIndexBuffer(BuiltBuffer.DrawParameters parameters, ByteBuffer indexBuffer, CallbackInfoReturnable info) { - if (info.getReturnValue() == null) GL.CURRENT_IBO = this.indexBufferId; - else GL.CURRENT_IBO = ((ShapeIndexBufferAccessor) (Object) info.getReturnValue()).getId(); + if (info.getReturnValue() == null) GL.CURRENT_IBO = this.indexBuffer != null ? this.indexBuffer.handle : 0; + else GL.CURRENT_IBO = ((ShapeIndexBufferAccessor) (Object) info.getReturnValue()).getBuffer().handle; } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/WorldRendererAccessor.java b/src/main/java/meteordevelopment/meteorclient/mixin/WorldRendererAccessor.java index ed353303d3..0401330881 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/WorldRendererAccessor.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/WorldRendererAccessor.java @@ -6,7 +6,6 @@ package meteordevelopment.meteorclient.mixin; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import net.minecraft.client.gl.Framebuffer; import net.minecraft.client.render.WorldRenderer; import net.minecraft.entity.player.BlockBreakingInfo; @@ -15,9 +14,6 @@ @Mixin(WorldRenderer.class) public interface WorldRendererAccessor { - @Accessor - void setEntityOutlinesFramebuffer(Framebuffer framebuffer); - @Accessor("blockBreakingInfos") Int2ObjectMap getBlockBreakingInfos(); } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/WorldRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/WorldRendererMixin.java index a8f4f543cf..a76129b6e6 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/WorldRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/WorldRendererMixin.java @@ -5,20 +5,31 @@ package meteordevelopment.meteorclient.mixin; +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; +import com.llamalad7.mixinextras.sugar.Local; +import com.llamalad7.mixinextras.sugar.ref.LocalRef; +import it.unimi.dsi.fastutil.Stack; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import meteordevelopment.meteorclient.mixininterface.IWorldRenderer; import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.render.*; -import meteordevelopment.meteorclient.systems.modules.world.Ambience; import meteordevelopment.meteorclient.utils.render.color.Color; import meteordevelopment.meteorclient.utils.render.postprocess.EntityShader; import meteordevelopment.meteorclient.utils.render.postprocess.PostProcessShaders; import net.minecraft.block.BlockState; import net.minecraft.client.gl.Framebuffer; import net.minecraft.client.render.*; +import net.minecraft.client.util.Handle; +import net.minecraft.client.util.ObjectAllocator; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.Entity; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.LightType; import org.joml.Matrix4f; +import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; @@ -29,17 +40,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import com.llamalad7.mixinextras.injector.ModifyExpressionValue; -import com.llamalad7.mixinextras.injector.wrapoperation.Operation; -import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; -import com.llamalad7.mixinextras.sugar.Local; -import com.llamalad7.mixinextras.sugar.ref.LocalRef; - @Mixin(WorldRenderer.class) -public abstract class WorldRendererMixin { - @Shadow - private Framebuffer entityOutlinesFramebuffer; - +public abstract class WorldRendererMixin implements IWorldRenderer { @Unique private ESP esp; @Shadow @@ -51,8 +53,8 @@ private void onCheckEmpty(MatrixStack matrixStack, CallbackInfo info) { } @Inject(method = "drawBlockOutline", at = @At("HEAD"), cancellable = true) - private void onDrawHighlightedBlockOutline(MatrixStack matrixStack, VertexConsumer vertexConsumer, Entity entity, double d, double e, double f, BlockPos blockPos, BlockState blockState, CallbackInfo info) { - if (Modules.get().isActive(BlockSelection.class)) info.cancel(); + private void onDrawHighlightedBlockOutline(MatrixStack matrices, VertexConsumer vertexConsumer, Entity entity, double cameraX, double cameraY, double cameraZ, BlockPos pos, BlockState state, int i, CallbackInfo ci) { + if (Modules.get().isActive(BlockSelection.class)) ci.cancel(); } @ModifyArg(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;setupTerrain(Lnet/minecraft/client/render/Camera;Lnet/minecraft/client/render/Frustum;ZZ)V"), index = 3) @@ -63,8 +65,8 @@ private boolean renderSetupTerrainModifyArg(boolean spectator) { // No Render @Inject(method = "renderWeather", at = @At("HEAD"), cancellable = true) - private void onRenderWeather(LightmapTextureManager manager, float f, double d, double e, double g, CallbackInfo info) { - if (Modules.get().get(NoRender.class).noWeather()) info.cancel(); + private void onRenderWeather(FrameGraphBuilder frameGraphBuilder, LightmapTextureManager lightmapTextureManager, Vec3d pos, float tickDelta, Fog fog, CallbackInfo ci) { + if (Modules.get().get(NoRender.class).noWeather()) ci.cancel(); } @Inject(method = "hasBlindnessOrDarkness(Lnet/minecraft/client/render/Camera;)Z", at = @At("HEAD"), cancellable = true) @@ -75,7 +77,7 @@ private void hasBlindnessOrDarkness(Camera camera, CallbackInfoReturnable original, @Local LocalRef entity) { if (!getESP().isGlow() || getESP().shouldSkip(entity.get())) original.call(instance, red, green, blue, alpha); else { @@ -128,26 +129,6 @@ private void onResized(int width, int height, CallbackInfo info) { PostProcessShaders.onResized(width, height); } - // Ambience - - @Inject(method = "renderEndSky", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/BufferRenderer;drawWithGlobalProgram(Lnet/minecraft/client/render/BuiltBuffer;)V")) - private void onRenderEndSkyDraw(MatrixStack matrices, CallbackInfo info) { - Ambience ambience = Modules.get().get(Ambience.class); - - if (ambience.isActive() && ambience.endSky.get() && ambience.customSkyColor.get()) { - Color customEndSkyColor = ambience.skyColor(); - - Tessellator tessellator = Tessellator.getInstance(); - BufferBuilder bufferBuilder = tessellator.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE_COLOR); - Matrix4f matrix4f = matrices.peek().getPositionMatrix(); - - bufferBuilder.vertex(matrix4f, -100.0F, -100.0F, -100.0F).texture(0.0F, 0.0F).color(customEndSkyColor.r, customEndSkyColor.g, customEndSkyColor.b, 255); - bufferBuilder.vertex(matrix4f, -100.0F, -100.0F, 100.0F).texture(0.0F, 16.0F).color(customEndSkyColor.r, customEndSkyColor.g, customEndSkyColor.b, 255); - bufferBuilder.vertex(matrix4f, 100.0F, -100.0F, 100.0F).texture(16.0F, 16.0F).color(customEndSkyColor.r, customEndSkyColor.g, customEndSkyColor.b, 255); - bufferBuilder.vertex(matrix4f, 100.0F, -100.0F, -100.0F).texture(16.0F, 0.0F).color(customEndSkyColor.r, customEndSkyColor.g, customEndSkyColor.b, 255); - } - } - // Fullbright @ModifyVariable(method = "getLightmapCoordinates(Lnet/minecraft/world/BlockRenderView;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;)I", at = @At(value = "STORE"), ordinal = 0) @@ -168,4 +149,40 @@ private ESP getESP() { return esp; } + + // IWorldRenderer + + @Shadow + private Framebuffer entityOutlineFramebuffer; + + @Shadow + @Final + private DefaultFramebufferSet framebufferSet; + + @Unique + private Stack framebufferStack; + + @Unique + private Stack> framebufferHandleStack; + + @Inject(method = "", at = @At("TAIL")) + private void init$IWorldRenderer(CallbackInfo info) { + framebufferStack = new ObjectArrayList<>(); + framebufferHandleStack = new ObjectArrayList<>(); + } + + @Override + public void meteor$pushEntityOutlineFramebuffer(Framebuffer framebuffer) { + framebufferStack.push(this.entityOutlineFramebuffer); + this.entityOutlineFramebuffer = framebuffer; + + framebufferHandleStack.push(this.framebufferSet.entityOutlineFramebuffer); + this.framebufferSet.entityOutlineFramebuffer = () -> framebuffer; + } + + @Override + public void meteor$popEntityOutlineFramebuffer() { + this.entityOutlineFramebuffer = framebufferStack.pop(); + this.framebufferSet.entityOutlineFramebuffer = framebufferHandleStack.pop(); + } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/sodium/SodiumBlockOcclusionCacheMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/sodium/SodiumBlockOcclusionCacheMixin.java index 9c34df0b5b..e0edc2dc36 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/sodium/SodiumBlockOcclusionCacheMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/sodium/SodiumBlockOcclusionCacheMixin.java @@ -32,7 +32,7 @@ private void onInit(CallbackInfo info) { @ModifyReturnValue(method = "shouldDrawSide", at = @At("RETURN")) private boolean shouldDrawSide(boolean original, BlockState state, BlockView view, BlockPos pos, Direction facing) { if (xray.isActive()) { - return xray.modifyDrawSide(state, view, pos, facing, original); + return xray.modifyDrawSide(state, view.getBlockState(pos.offset(facing)), facing, original); } return original; diff --git a/src/main/java/meteordevelopment/meteorclient/mixininterface/IAbstractFurnaceScreenHandler.java b/src/main/java/meteordevelopment/meteorclient/mixininterface/IAbstractFurnaceScreenHandler.java index 42da9eebfe..50d3c53e8b 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixininterface/IAbstractFurnaceScreenHandler.java +++ b/src/main/java/meteordevelopment/meteorclient/mixininterface/IAbstractFurnaceScreenHandler.java @@ -7,7 +7,6 @@ import net.minecraft.item.ItemStack; -// Using accessor causes a stackoverflow for some fucking reason public interface IAbstractFurnaceScreenHandler { - boolean isItemSmeltable(ItemStack itemStack); + boolean meteor$isItemSmeltable(ItemStack itemStack); } diff --git a/src/main/java/meteordevelopment/meteorclient/mixininterface/IBox.java b/src/main/java/meteordevelopment/meteorclient/mixininterface/IBox.java index daf97f8a1f..1deebf68a1 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixininterface/IBox.java +++ b/src/main/java/meteordevelopment/meteorclient/mixininterface/IBox.java @@ -8,11 +8,11 @@ import net.minecraft.util.math.BlockPos; public interface IBox { - void expand(double v); + void meteor$expand(double v); - void set(double x1, double y1, double z1, double x2, double y2, double z2); + void meteor$set(double x1, double y1, double z1, double x2, double y2, double z2); - default void set(BlockPos pos) { - set(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1); + default void meteor$set(BlockPos pos) { + meteor$set(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1); } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixininterface/ICamera.java b/src/main/java/meteordevelopment/meteorclient/mixininterface/ICamera.java index 0381ff9888..cabd3382b8 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixininterface/ICamera.java +++ b/src/main/java/meteordevelopment/meteorclient/mixininterface/ICamera.java @@ -6,5 +6,5 @@ package meteordevelopment.meteorclient.mixininterface; public interface ICamera { - void setRot(double yaw, double pitch); + void meteor$setRot(double yaw, double pitch); } diff --git a/src/main/java/meteordevelopment/meteorclient/mixininterface/ICapabilityTracker.java b/src/main/java/meteordevelopment/meteorclient/mixininterface/ICapabilityTracker.java index 82509f4b6c..0d054f70df 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixininterface/ICapabilityTracker.java +++ b/src/main/java/meteordevelopment/meteorclient/mixininterface/ICapabilityTracker.java @@ -6,7 +6,7 @@ package meteordevelopment.meteorclient.mixininterface; public interface ICapabilityTracker { - boolean get(); + boolean meteor$get(); - void set(boolean state); + void meteor$set(boolean state); } diff --git a/src/main/java/meteordevelopment/meteorclient/mixininterface/IEntityRenderer.java b/src/main/java/meteordevelopment/meteorclient/mixininterface/IEntityRenderState.java similarity index 66% rename from src/main/java/meteordevelopment/meteorclient/mixininterface/IEntityRenderer.java rename to src/main/java/meteordevelopment/meteorclient/mixininterface/IEntityRenderState.java index 1b567ce089..41d4dc2d56 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixininterface/IEntityRenderer.java +++ b/src/main/java/meteordevelopment/meteorclient/mixininterface/IEntityRenderState.java @@ -6,8 +6,9 @@ package meteordevelopment.meteorclient.mixininterface; import net.minecraft.entity.Entity; -import net.minecraft.util.Identifier; -public interface IEntityRenderer { - Identifier getTextureInterface(Entity entity); +public interface IEntityRenderState { + Entity meteor$getEntity(); + + void meteor$setEntity(Entity entity); } diff --git a/src/main/java/meteordevelopment/meteorclient/mixininterface/IExplosionS2CPacket.java b/src/main/java/meteordevelopment/meteorclient/mixininterface/IExplosionS2CPacket.java index b78475351f..7cbec1a09e 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixininterface/IExplosionS2CPacket.java +++ b/src/main/java/meteordevelopment/meteorclient/mixininterface/IExplosionS2CPacket.java @@ -6,9 +6,9 @@ package meteordevelopment.meteorclient.mixininterface; public interface IExplosionS2CPacket { - void setVelocityX(float velocity); + void meteor$setVelocityX(float velocity); - void setVelocityY(float velocity); + void meteor$setVelocityY(float velocity); - void setVelocityZ(float velocity); + void meteor$setVelocityZ(float velocity); } diff --git a/src/main/java/meteordevelopment/meteorclient/mixininterface/IHorseBaseEntity.java b/src/main/java/meteordevelopment/meteorclient/mixininterface/IHorseBaseEntity.java index 8d8716f0b1..ff647cf687 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixininterface/IHorseBaseEntity.java +++ b/src/main/java/meteordevelopment/meteorclient/mixininterface/IHorseBaseEntity.java @@ -6,5 +6,5 @@ package meteordevelopment.meteorclient.mixininterface; public interface IHorseBaseEntity { - void setSaddled(boolean saddled); + void meteor$setSaddled(boolean saddled); } diff --git a/src/main/java/meteordevelopment/meteorclient/mixininterface/ILivingEntityRenderer.java b/src/main/java/meteordevelopment/meteorclient/mixininterface/ILivingEntityRenderer.java deleted file mode 100644 index b7bd06fa74..0000000000 --- a/src/main/java/meteordevelopment/meteorclient/mixininterface/ILivingEntityRenderer.java +++ /dev/null @@ -1,16 +0,0 @@ -/* - * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). - * Copyright (c) Meteor Development. - */ - -package meteordevelopment.meteorclient.mixininterface; - -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.LivingEntity; - -public interface ILivingEntityRenderer { - void setupTransformsInterface(LivingEntity entity, MatrixStack matrices, float animationProgress, float bodyYaw, float tickDelta); - void scaleInterface(LivingEntity entity, MatrixStack matrices, float amount); - boolean isVisibleInterface(LivingEntity entity); - float getAnimationCounterInterface(LivingEntity entity, float tickDelta); -} diff --git a/src/main/java/meteordevelopment/meteorclient/mixininterface/IMinecraftClient.java b/src/main/java/meteordevelopment/meteorclient/mixininterface/IMinecraftClient.java index 4e74162574..d1b09ff94e 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixininterface/IMinecraftClient.java +++ b/src/main/java/meteordevelopment/meteorclient/mixininterface/IMinecraftClient.java @@ -6,5 +6,5 @@ package meteordevelopment.meteorclient.mixininterface; public interface IMinecraftClient { - void meteor_client$rightClick(); + void meteor$rightClick(); } diff --git a/src/main/java/meteordevelopment/meteorclient/mixininterface/IExplosion.java b/src/main/java/meteordevelopment/meteorclient/mixininterface/IMiningToolItem.java similarity index 62% rename from src/main/java/meteordevelopment/meteorclient/mixininterface/IExplosion.java rename to src/main/java/meteordevelopment/meteorclient/mixininterface/IMiningToolItem.java index 067f41d2bc..fa7aae8e29 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixininterface/IExplosion.java +++ b/src/main/java/meteordevelopment/meteorclient/mixininterface/IMiningToolItem.java @@ -5,8 +5,8 @@ package meteordevelopment.meteorclient.mixininterface; -import net.minecraft.util.math.Vec3d; +import net.minecraft.item.ToolMaterial; -public interface IExplosion { - void set(Vec3d pos, float power, boolean createFire); +public interface IMiningToolItem { + ToolMaterial meteor$getMaterial(); } diff --git a/src/main/java/meteordevelopment/meteorclient/mixininterface/IMultiPhase.java b/src/main/java/meteordevelopment/meteorclient/mixininterface/IMultiPhase.java new file mode 100644 index 0000000000..d5785626c1 --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/mixininterface/IMultiPhase.java @@ -0,0 +1,12 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.mixininterface; + +import net.minecraft.client.render.RenderLayer; + +public interface IMultiPhase { + RenderLayer.MultiPhaseParameters meteor$getParameters(); +} diff --git a/src/main/java/meteordevelopment/meteorclient/mixininterface/IItemEntity.java b/src/main/java/meteordevelopment/meteorclient/mixininterface/IMultiPhaseParameters.java similarity index 61% rename from src/main/java/meteordevelopment/meteorclient/mixininterface/IItemEntity.java rename to src/main/java/meteordevelopment/meteorclient/mixininterface/IMultiPhaseParameters.java index 0ace42340e..e790b4b78b 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixininterface/IItemEntity.java +++ b/src/main/java/meteordevelopment/meteorclient/mixininterface/IMultiPhaseParameters.java @@ -5,9 +5,8 @@ package meteordevelopment.meteorclient.mixininterface; -import net.minecraft.util.math.Vec3d; +import net.minecraft.client.render.RenderPhase; -public interface IItemEntity { - Vec3d getRotation(); - void setRotation(Vec3d rotation); +public interface IMultiPhaseParameters { + RenderPhase.Target meteor$getTarget(); } diff --git a/src/main/java/meteordevelopment/meteorclient/mixininterface/IPlayerInteractEntityC2SPacket.java b/src/main/java/meteordevelopment/meteorclient/mixininterface/IPlayerInteractEntityC2SPacket.java index c667e9fb3b..70bfc1dbee 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixininterface/IPlayerInteractEntityC2SPacket.java +++ b/src/main/java/meteordevelopment/meteorclient/mixininterface/IPlayerInteractEntityC2SPacket.java @@ -9,7 +9,7 @@ import net.minecraft.network.packet.c2s.play.PlayerInteractEntityC2SPacket; public interface IPlayerInteractEntityC2SPacket { - PlayerInteractEntityC2SPacket.InteractType getType(); + PlayerInteractEntityC2SPacket.InteractType meteor$getType(); - Entity getEntity(); + Entity meteor$getEntity(); } diff --git a/src/main/java/meteordevelopment/meteorclient/mixininterface/IPlayerMoveC2SPacket.java b/src/main/java/meteordevelopment/meteorclient/mixininterface/IPlayerMoveC2SPacket.java index 35a2cca29f..a56eaaf29f 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixininterface/IPlayerMoveC2SPacket.java +++ b/src/main/java/meteordevelopment/meteorclient/mixininterface/IPlayerMoveC2SPacket.java @@ -6,7 +6,7 @@ package meteordevelopment.meteorclient.mixininterface; public interface IPlayerMoveC2SPacket { - int getTag(); + int meteor$getTag(); - void setTag(int tag); + void meteor$setTag(int tag); } diff --git a/src/main/java/meteordevelopment/meteorclient/mixininterface/IRaycastContext.java b/src/main/java/meteordevelopment/meteorclient/mixininterface/IRaycastContext.java index 8fb489e90c..e32816f66d 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixininterface/IRaycastContext.java +++ b/src/main/java/meteordevelopment/meteorclient/mixininterface/IRaycastContext.java @@ -10,5 +10,5 @@ import net.minecraft.world.RaycastContext; public interface IRaycastContext { - void set(Vec3d start, Vec3d end, RaycastContext.ShapeType shapeType, RaycastContext.FluidHandling fluidHandling, Entity entity); + void meteor$set(Vec3d start, Vec3d end, RaycastContext.ShapeType shapeType, RaycastContext.FluidHandling fluidHandling, Entity entity); } diff --git a/src/main/java/meteordevelopment/meteorclient/mixininterface/ISimpleOption.java b/src/main/java/meteordevelopment/meteorclient/mixininterface/ISimpleOption.java index 12ebbebd21..5873e435e8 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixininterface/ISimpleOption.java +++ b/src/main/java/meteordevelopment/meteorclient/mixininterface/ISimpleOption.java @@ -6,5 +6,5 @@ package meteordevelopment.meteorclient.mixininterface; public interface ISimpleOption { - void set(Object value); + void meteor$set(Object value); } diff --git a/src/main/java/meteordevelopment/meteorclient/mixininterface/ISlot.java b/src/main/java/meteordevelopment/meteorclient/mixininterface/ISlot.java index e5bebeaea4..11fd2db540 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixininterface/ISlot.java +++ b/src/main/java/meteordevelopment/meteorclient/mixininterface/ISlot.java @@ -6,7 +6,7 @@ package meteordevelopment.meteorclient.mixininterface; public interface ISlot { - int getId(); + int meteor$getId(); - int getIndex(); + int meteor$getIndex(); } diff --git a/src/main/java/meteordevelopment/meteorclient/mixininterface/IVec3d.java b/src/main/java/meteordevelopment/meteorclient/mixininterface/IVec3d.java index 79d201262b..a600199b1e 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixininterface/IVec3d.java +++ b/src/main/java/meteordevelopment/meteorclient/mixininterface/IVec3d.java @@ -9,17 +9,17 @@ import org.joml.Vector3d; public interface IVec3d { - void set(double x, double y, double z); + void meteor$set(double x, double y, double z); - default void set(Vec3i vec) { - set(vec.getX(), vec.getY(), vec.getZ()); + default void meteor$set(Vec3i vec) { + meteor$set(vec.getX(), vec.getY(), vec.getZ()); } - default void set(Vector3d vec) { - set(vec.x, vec.y, vec.z); + default void meteor$set(Vector3d vec) { + meteor$set(vec.x, vec.y, vec.z); } - void setXZ(double x, double z); + void meteor$setXZ(double x, double z); - void setY(double y); + void meteor$setY(double y); } diff --git a/src/main/java/meteordevelopment/meteorclient/mixininterface/IWorldRenderer.java b/src/main/java/meteordevelopment/meteorclient/mixininterface/IWorldRenderer.java new file mode 100644 index 0000000000..d114806144 --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/mixininterface/IWorldRenderer.java @@ -0,0 +1,14 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.mixininterface; + +import net.minecraft.client.gl.Framebuffer; + +public interface IWorldRenderer { + void meteor$pushEntityOutlineFramebuffer(Framebuffer framebuffer); + + void meteor$popEntityOutlineFramebuffer(); +} diff --git a/src/main/java/meteordevelopment/meteorclient/renderer/Fonts.java b/src/main/java/meteordevelopment/meteorclient/renderer/Fonts.java index cea83f3db9..2f8a1b6c3a 100644 --- a/src/main/java/meteordevelopment/meteorclient/renderer/Fonts.java +++ b/src/main/java/meteordevelopment/meteorclient/renderer/Fonts.java @@ -73,7 +73,7 @@ public static void load(FontFace fontFace) { throw new RuntimeException("Failed to load default font: " + fontFace, e); } - MeteorClient.LOG.error("Failed to load font: " + fontFace, e); + MeteorClient.LOG.error("Failed to load font: {}", fontFace, e); load(Fonts.DEFAULT_FONT); } diff --git a/src/main/java/meteordevelopment/meteorclient/renderer/Framebuffer.java b/src/main/java/meteordevelopment/meteorclient/renderer/Framebuffer.java index 84418c5c82..64e67e9306 100644 --- a/src/main/java/meteordevelopment/meteorclient/renderer/Framebuffer.java +++ b/src/main/java/meteordevelopment/meteorclient/renderer/Framebuffer.java @@ -33,7 +33,7 @@ private void init() { bind(); texture = GL.genTexture(); - GL.bindTexture(texture); + GL.getTexture(texture); GL.defaultPixelStore(); GL.textureParam(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); diff --git a/src/main/java/meteordevelopment/meteorclient/renderer/GL.java b/src/main/java/meteordevelopment/meteorclient/renderer/GL.java index aca3662bd0..78744aee5d 100644 --- a/src/main/java/meteordevelopment/meteorclient/renderer/GL.java +++ b/src/main/java/meteordevelopment/meteorclient/renderer/GL.java @@ -16,7 +16,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.*; @@ -128,7 +127,7 @@ public static int createShader(int type) { } public static void shaderSource(int shader, String source) { - GlStateManager.glShaderSource(shader, List.of(source)); + GlStateManager.glShaderSource(shader, source); } public static String compileShader(int shader) { @@ -237,23 +236,23 @@ public static void framebufferTexture2D(int target, int attachment, int textureT public static void clear(int mask) { GlStateManager._clearColor(0, 0, 0, 1); - GlStateManager._clear(mask,false); + GlStateManager._clear(mask); } // State public static void saveState() { - depthSaved = DEPTH.get(); - blendSaved = BLEND.get(); - cullSaved = CULL.get(); - scissorSaved = SCISSOR.get(); + depthSaved = DEPTH.meteor$get(); + blendSaved = BLEND.meteor$get(); + cullSaved = CULL.meteor$get(); + scissorSaved = SCISSOR.meteor$get(); } public static void restoreState() { - DEPTH.set(depthSaved); - BLEND.set(blendSaved); - CULL.set(cullSaved); - SCISSOR.set(scissorSaved); + DEPTH.meteor$set(depthSaved); + BLEND.meteor$set(blendSaved); + CULL.meteor$set(cullSaved); + SCISSOR.meteor$set(scissorSaved); disableLineSmooth(); } @@ -295,17 +294,17 @@ public static void disableLineSmooth() { glDisable(GL_LINE_SMOOTH); } - public static void bindTexture(Identifier id) { + public static void getTexture(Identifier id) { GlStateManager._activeTexture(GL_TEXTURE0); - mc.getTextureManager().bindTexture(id); + mc.getTextureManager().getTexture(id); } - public static void bindTexture(int i, int slot) { + public static void getTexture(int i, int slot) { GlStateManager._activeTexture(GL_TEXTURE0 + slot); GlStateManager._bindTexture(i); } - public static void bindTexture(int i) { - bindTexture(i, 0); + public static void getTexture(int i) { + getTexture(i, 0); } public static void resetTextureSlot() { diff --git a/src/main/java/meteordevelopment/meteorclient/renderer/Shader.java b/src/main/java/meteordevelopment/meteorclient/renderer/Shader.java index 00219c583a..7d65c576d6 100644 --- a/src/main/java/meteordevelopment/meteorclient/renderer/Shader.java +++ b/src/main/java/meteordevelopment/meteorclient/renderer/Shader.java @@ -31,7 +31,7 @@ public Shader(String vertPath, String fragPath) { String vertError = GL.compileShader(vert); if (vertError != null) { - MeteorClient.LOG.error("Failed to compile vertex shader (" + vertPath + "): " + vertError); + MeteorClient.LOG.error("Failed to compile vertex shader ({}): {}", vertPath, vertError); throw new RuntimeException("Failed to compile vertex shader (" + vertPath + "): " + vertError); } @@ -40,7 +40,7 @@ public Shader(String vertPath, String fragPath) { String fragError = GL.compileShader(frag); if (fragError != null) { - MeteorClient.LOG.error("Failed to compile fragment shader (" + fragPath + "): " + fragError); + MeteorClient.LOG.error("Failed to compile fragment shader ({}): {}", fragPath, fragError); throw new RuntimeException("Failed to compile fragment shader (" + fragPath + "): " + fragError); } @@ -48,7 +48,7 @@ public Shader(String vertPath, String fragPath) { String programError = GL.linkProgram(id, vert, frag); if (programError != null) { - MeteorClient.LOG.error("Failed to link program: " + programError); + MeteorClient.LOG.error("Failed to link program: {}", programError); throw new RuntimeException("Failed to link program: " + programError); } diff --git a/src/main/java/meteordevelopment/meteorclient/renderer/Texture.java b/src/main/java/meteordevelopment/meteorclient/renderer/Texture.java index 1f4b5e5f37..41f45df922 100644 --- a/src/main/java/meteordevelopment/meteorclient/renderer/Texture.java +++ b/src/main/java/meteordevelopment/meteorclient/renderer/Texture.java @@ -66,7 +66,7 @@ public boolean isValid() { } public void bind(int slot) { - GL.bindTexture(id, slot); + GL.getTexture(id, slot); } public void bind() { bind(0); diff --git a/src/main/java/meteordevelopment/meteorclient/renderer/text/CustomTextRenderer.java b/src/main/java/meteordevelopment/meteorclient/renderer/text/CustomTextRenderer.java index 878fbe80fb..6974db564e 100644 --- a/src/main/java/meteordevelopment/meteorclient/renderer/text/CustomTextRenderer.java +++ b/src/main/java/meteordevelopment/meteorclient/renderer/text/CustomTextRenderer.java @@ -123,7 +123,7 @@ public void end(MatrixStack matrices) { if (!scaleOnly) { mesh.end(); - GL.bindTexture(font.texture.getGlId()); + GL.getTexture(font.texture.getGlId()); mesh.render(matrices); } diff --git a/src/main/java/meteordevelopment/meteorclient/renderer/text/Font.java b/src/main/java/meteordevelopment/meteorclient/renderer/text/Font.java index 5a7a71d32f..06ead23f0d 100644 --- a/src/main/java/meteordevelopment/meteorclient/renderer/text/Font.java +++ b/src/main/java/meteordevelopment/meteorclient/renderer/text/Font.java @@ -23,7 +23,7 @@ public class Font { private final float scale; private final float ascent; private final Int2ObjectOpenHashMap charMap = new Int2ObjectOpenHashMap<>(); - private final static int size = 2048; + private static final int size = 2048; public Font(ByteBuffer buffer, int height) { this.height = height; diff --git a/src/main/java/meteordevelopment/meteorclient/renderer/text/VanillaTextRenderer.java b/src/main/java/meteordevelopment/meteorclient/renderer/text/VanillaTextRenderer.java index 1fb36939a4..82e382c674 100644 --- a/src/main/java/meteordevelopment/meteorclient/renderer/text/VanillaTextRenderer.java +++ b/src/main/java/meteordevelopment/meteorclient/renderer/text/VanillaTextRenderer.java @@ -71,7 +71,7 @@ public double render(String text, double x, double y, Color color, boolean shado y += 0.5 * scale; int preA = color.a; - color.a = (int) ((color.a / 255 * alpha) * 255); + color.a = (int) (((double) color.a / 255 * alpha) * 255); Matrix4f matrix = emptyMatrix; if (scaleIndividually) { @@ -105,13 +105,11 @@ public void end(MatrixStack matrices) { matrixStack.pushMatrix(); if (matrices != null) matrixStack.mul(matrices.peek().getPositionMatrix()); if (!scaleIndividually) matrixStack.scale((float) scale, (float) scale, 1); - RenderSystem.applyModelViewMatrix(); immediate.draw(); matrixStack.popMatrix(); RenderSystem.enableDepthTest(); - RenderSystem.applyModelViewMatrix(); this.scale = 2; this.building = false; diff --git a/src/main/java/meteordevelopment/meteorclient/settings/StorageBlockListSetting.java b/src/main/java/meteordevelopment/meteorclient/settings/StorageBlockListSetting.java index 36d9b39feb..194dce2392 100644 --- a/src/main/java/meteordevelopment/meteorclient/settings/StorageBlockListSetting.java +++ b/src/main/java/meteordevelopment/meteorclient/settings/StorageBlockListSetting.java @@ -5,7 +5,6 @@ package meteordevelopment.meteorclient.settings; -import com.mojang.datafixers.util.Pair; import com.mojang.serialization.Lifecycle; import it.unimi.dsi.fastutil.objects.ObjectIterators; import meteordevelopment.meteorclient.MeteorClient; @@ -20,7 +19,6 @@ import net.minecraft.registry.SimpleRegistry; import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.registry.entry.RegistryEntryList; -import net.minecraft.registry.tag.TagKey; import net.minecraft.util.Identifier; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -70,7 +68,8 @@ protected List> parseImpl(String str) { BlockEntityType block = parseId(Registries.BLOCK_ENTITY_TYPE, value); if (block != null) blocks.add(block); } - } catch (Exception ignored) {} + } catch (Exception ignored) { + } return blocks; } @@ -226,7 +225,7 @@ public Optional>> getEntry(int rawId) } @Override - public Optional>> getEntry(RegistryKey> key) { + public Optional>> getEntry(Identifier id) { return Optional.empty(); } @@ -236,35 +235,10 @@ public Stream>> streamEntries() { } @Override - public Optional>> getEntryList(TagKey> tag) { - return Optional.empty(); - } - - @Override - public RegistryEntryList.Named> getOrCreateEntryList(TagKey> tag) { + public Stream>> streamTags() { return null; } - @Override - public Stream>, RegistryEntryList.Named>>> streamTagsAndEntries() { - return null; - } - - @Override - public Stream>> streamTags() { - return null; - } - - @Override - public void clearTags() { - - } - - @Override - public void populateTags(Map>, List>>> tagEntries) { - - } - @Override public Set>> getKeys() { return null; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/System.java b/src/main/java/meteordevelopment/meteorclient/systems/System.java index 60b2fb203d..74c39b7617 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/System.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/System.java @@ -76,8 +76,8 @@ public void load(File folder) { String backupName = FilenameUtils.removeExtension(file.getName()) + "-" + ZonedDateTime.now().format(DATE_TIME_FORMATTER) + ".backup.nbt"; File backup = new File(file.getParentFile(), backupName); StreamUtils.copy(file, backup); - MeteorClient.LOG.error("Error loading " + this.name + ". Possibly corrupted?"); - MeteorClient.LOG.info("Saved settings backup to '" + backup + "'."); + MeteorClient.LOG.error("Error loading {}. Possibly corrupted?", this.name); + MeteorClient.LOG.info("Saved settings backup to '{}'.", backup); e.printStackTrace(); } } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/hud/HudRenderer.java b/src/main/java/meteordevelopment/meteorclient/systems/hud/HudRenderer.java index 0108406f85..49e74d9f2f 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/hud/HudRenderer.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/hud/HudRenderer.java @@ -78,7 +78,7 @@ public void end() { FontHolder fontHolder = it.next(); if (fontHolder.visited) { - GL.bindTexture(fontHolder.font.texture.getGlId()); + GL.getTexture(fontHolder.font.texture.getGlId()); fontHolder.getMesh().render(null); } else { @@ -117,7 +117,7 @@ public void triangle(double x1, double y1, double x2, double y2, double x3, doub } public void texture(Identifier id, double x, double y, double width, double height, Color color) { - GL.bindTexture(id); + GL.getTexture(id); Renderer2D.TEXTURE.begin(); Renderer2D.TEXTURE.texQuad(x, y, width, height, color); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/ArmorHud.java b/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/ArmorHud.java index 32dce0b9ed..c3c9a1ab03 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/ArmorHud.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/ArmorHud.java @@ -173,10 +173,10 @@ public void render(HudRenderer renderer) { private ItemStack getItem(int i) { if (isInEditor()) { return switch (i) { - default -> Items.NETHERITE_BOOTS.getDefaultStack(); case 1 -> Items.NETHERITE_LEGGINGS.getDefaultStack(); case 2 -> Items.NETHERITE_CHESTPLATE.getDefaultStack(); case 3 -> Items.NETHERITE_HELMET.getDefaultStack(); + default -> Items.NETHERITE_BOOTS.getDefaultStack(); }; } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/hud/screens/AddHudElementScreen.java b/src/main/java/meteordevelopment/meteorclient/systems/hud/screens/AddHudElementScreen.java index 23657e77ae..a837b8d9fd 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/hud/screens/AddHudElementScreen.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/hud/screens/AddHudElementScreen.java @@ -79,7 +79,7 @@ public void initWidgets() { WLabel title = l.add(theme.label(item.title)).widget(); title.tooltip = item.description; - if (item.object instanceof HudElementInfo.Preset preset) { + if (item.object instanceof HudElementInfo.Preset preset) { WPlus add = l.add(theme.plus()).expandCellX().right().widget(); add.action = () -> runObject(preset); @@ -105,7 +105,7 @@ public void initWidgets() { private void runObject(Object object) { if (object == null) return; - if (object instanceof HudElementInfo.Preset preset) { + if (object instanceof HudElementInfo.Preset preset) { Hud.get().add(preset, x, y); close(); } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/Modules.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/Modules.java index 8828598b66..37ec252a92 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/Modules.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/Modules.java @@ -5,7 +5,6 @@ package meteordevelopment.meteorclient.systems.modules; -import com.mojang.datafixers.util.Pair; import com.mojang.serialization.Lifecycle; import it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap; import meteordevelopment.meteorclient.MeteorClient; @@ -48,8 +47,6 @@ import net.minecraft.registry.RegistryKey; import net.minecraft.registry.SimpleRegistry; import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.registry.entry.RegistryEntryList; -import net.minecraft.registry.tag.TagKey; import net.minecraft.util.Identifier; import net.minecraft.util.math.random.Random; import org.jetbrains.annotations.NotNull; @@ -532,7 +529,6 @@ private void initRender() { add(new Tracers()); add(new Trail()); add(new Trajectories()); - add(new UnfocusedCPU()); add(new VoidESP()); add(new WallHack()); add(new WaypointsModule()); @@ -692,42 +688,11 @@ public Optional> getEntry(int rawId) { return Optional.empty(); } - @Override - public Optional> getEntry(RegistryKey key) { - return Optional.empty(); - } - @Override public Stream> streamEntries() { return null; } - @Override - public Optional> getEntryList(TagKey tag) { - return Optional.empty(); - } - - @Override - public RegistryEntryList.Named getOrCreateEntryList(TagKey tag) { - return null; - } - - @Override - public Stream, RegistryEntryList.Named>> streamTagsAndEntries() { - return null; - } - - @Override - public Stream> streamTags() { - return null; - } - - @Override - public void clearTags() {} - - @Override - public void populateTags(Map, List>> tagEntries) {} - private static class ModuleIterator implements Iterator { private final Iterator iterator = Modules.get().getAll().iterator(); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/ArrowDodge.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/ArrowDodge.java index 8c2d51e4a3..28bea04b29 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/ArrowDodge.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/ArrowDodge.java @@ -155,8 +155,8 @@ private void move(double velX, double velY, double velZ) { case Velocity -> mc.player.setVelocity(velX, velY, velZ); case Packet -> { Vec3d newPos = mc.player.getPos().add(velX, velY, velZ); - mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(newPos.x, newPos.y, newPos.z, false)); - mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(newPos.x, newPos.y - 0.01, newPos.z, true)); + mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(newPos.x, newPos.y, newPos.z, false, mc.player.horizontalCollision)); + mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(newPos.x, newPos.y - 0.01, newPos.z, true, mc.player.horizontalCollision)); } } } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/AutoArmor.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/AutoArmor.java index 7e30c169f6..3548cf66f9 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/AutoArmor.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/AutoArmor.java @@ -16,10 +16,12 @@ import meteordevelopment.meteorclient.utils.Utils; import meteordevelopment.meteorclient.utils.player.InvUtils; import meteordevelopment.orbit.EventHandler; +import net.minecraft.component.DataComponentTypes; +import net.minecraft.component.type.AttributeModifiersComponent; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.Enchantments; +import net.minecraft.entity.attribute.EntityAttributes; import net.minecraft.item.ArmorItem; -import net.minecraft.item.ElytraItem; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.registry.RegistryKey; @@ -151,8 +153,8 @@ private boolean hasAvoidedEnchantment() { } private int getItemSlotId(ItemStack itemStack) { - if (itemStack.getItem() instanceof ElytraItem) return 2; - return ((ArmorItem) itemStack.getItem()).getSlotType().getEntitySlotId(); + if (itemStack.contains(DataComponentTypes.GLIDER)) return 2; + return itemStack.get(DataComponentTypes.EQUIPPABLE).slot().getEntitySlotId(); } private int getScore(ItemStack itemStack) { @@ -174,8 +176,21 @@ private int getScore(ItemStack itemStack) { score += Utils.getEnchantmentLevel(enchantments, Enchantments.PROJECTILE_PROTECTION); score += Utils.getEnchantmentLevel(enchantments, Enchantments.UNBREAKING); score += 2 * Utils.getEnchantmentLevel(enchantments, Enchantments.MENDING); - score += itemStack.getItem() instanceof ArmorItem armorItem ? armorItem.getProtection() : 0; - score += itemStack.getItem() instanceof ArmorItem armorItem ? (int) armorItem.getToughness() : 0; + + if (itemStack.contains(DataComponentTypes.ATTRIBUTE_MODIFIERS)) { + AttributeModifiersComponent component = itemStack.get(DataComponentTypes.ATTRIBUTE_MODIFIERS); + for (AttributeModifiersComponent.Entry modifier : component.modifiers()) { + if (modifier.attribute() == EntityAttributes.ARMOR || modifier.attribute() == EntityAttributes.ARMOR_TOUGHNESS) { + double e = modifier.modifier().value(); + + score += (int) switch (modifier.modifier().operation()) { + case ADD_VALUE -> e; + case ADD_MULTIPLIED_BASE -> e * mc.player.getAttributeBaseValue(modifier.attribute()); + case ADD_MULTIPLIED_TOTAL -> e * score; + }; + } + } + } return score; } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/AutoTotem.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/AutoTotem.java index 54e8e49852..fc667ad74f 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/AutoTotem.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/AutoTotem.java @@ -87,7 +87,7 @@ private void onTick(TickEvent.Pre event) { if (totems <= 0) locked = false; else if (ticks >= delay.get()) { boolean low = mc.player.getHealth() + mc.player.getAbsorptionAmount() - PlayerUtils.possibleHealthReductions(explosion.get(), fall.get()) <= health.get(); - boolean ely = elytra.get() && mc.player.getEquippedStack(EquipmentSlot.CHEST).getItem() == Items.ELYTRA && mc.player.isFallFlying(); + boolean ely = elytra.get() && mc.player.getEquippedStack(EquipmentSlot.CHEST).getItem() == Items.ELYTRA && mc.player.isGliding(); locked = mode.get() == Mode.Strict || (mode.get() == Mode.Smart && (low || ely)); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/Burrow.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/Burrow.java index f2055b4ba9..5baf6d6eaf 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/Burrow.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/Burrow.java @@ -165,13 +165,7 @@ private void onTick(TickEvent.Pre event) { if (!shouldBurrow && instant.get()) blockPos.set(mc.player.getBlockPos()); if (shouldBurrow) { - //When automatic was on (and instant was off), this would just always toggle off without trying to burrow. -/* if (!mc.player.isOnGround()) { - toggle(); - return; - }*/ - - if (rotate.get()) + if (rotate.get()) Rotations.rotate(Rotations.getYaw(mc.player.getBlockPos()), Rotations.getPitch(mc.player.getBlockPos()), 50, this::burrow); else burrow(); @@ -193,10 +187,10 @@ private void burrow() { if (center.get()) PlayerUtils.centerPlayer(); if (instant.get()) { - mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), mc.player.getY() + 0.4, mc.player.getZ(), false)); - mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), mc.player.getY() + 0.75, mc.player.getZ(), false)); - mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), mc.player.getY() + 1.01, mc.player.getZ(), false)); - mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), mc.player.getY() + 1.15, mc.player.getZ(), false)); + mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), mc.player.getY() + 0.4, mc.player.getZ(), false, mc.player.horizontalCollision)); + mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), mc.player.getY() + 0.75, mc.player.getZ(), false, mc.player.horizontalCollision)); + mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), mc.player.getY() + 1.01, mc.player.getZ(), false, mc.player.horizontalCollision)); + mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), mc.player.getY() + 1.15, mc.player.getZ(), false, mc.player.horizontalCollision)); } @@ -211,7 +205,7 @@ private void burrow() { InvUtils.swapBack(); if (instant.get()) { - mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), mc.player.getY() + rubberbandHeight.get(), mc.player.getZ(), false)); + mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), mc.player.getY() + rubberbandHeight.get(), mc.player.getZ(), false, mc.player.horizontalCollision)); } else { mc.player.updatePosition(mc.player.getX(), mc.player.getY() + rubberbandHeight.get(), mc.player.getZ()); } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/Criticals.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/Criticals.java index 92e208f827..2bf7d49b0e 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/Criticals.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/Criticals.java @@ -79,9 +79,9 @@ public void onActivate() { @EventHandler private void onSendPacket(PacketEvent.Send event) { - if (event.packet instanceof IPlayerInteractEntityC2SPacket packet && packet.getType() == PlayerInteractEntityC2SPacket.InteractType.ATTACK) { + if (event.packet instanceof IPlayerInteractEntityC2SPacket packet && packet.meteor$getType() == PlayerInteractEntityC2SPacket.InteractType.ATTACK) { if (mace.get() && mc.player.getMainHandStack().getItem() instanceof MaceItem) { - if (mc.player.isFallFlying()) return; + if (mc.player.isGliding()) return; sendPacket(0); sendPacket(1.501 + extraHeight.get()); @@ -89,7 +89,7 @@ private void onSendPacket(PacketEvent.Send event) { } else { if (skipCrit()) return; - Entity entity = packet.getEntity(); + Entity entity = packet.meteor$getEntity(); if (!(entity instanceof LivingEntity) || (entity != Modules.get().get(KillAura.class).getTarget() && ka.get())) return; @@ -111,7 +111,7 @@ private void onSendPacket(PacketEvent.Send event) { attackPacket = (PlayerInteractEntityC2SPacket) event.packet; if (mode.get() == Mode.Jump) mc.player.jump(); - else ((IVec3d) mc.player.getVelocity()).setY(0.25); + else ((IVec3d) mc.player.getVelocity()).meteor$setY(0.25); event.cancel(); } } @@ -152,8 +152,8 @@ private void sendPacket(double height) { double y = mc.player.getY(); double z = mc.player.getZ(); - PlayerMoveC2SPacket packet = new PlayerMoveC2SPacket.PositionAndOnGround(x, y + height, z, false); - ((IPlayerMoveC2SPacket) packet).setTag(1337); + PlayerMoveC2SPacket packet = new PlayerMoveC2SPacket.PositionAndOnGround(x, y + height, z, false, mc.player.horizontalCollision); + ((IPlayerMoveC2SPacket) packet).meteor$setTag(1337); mc.player.networkHandler.sendPacket(packet); } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/CrystalAura.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/CrystalAura.java index 433777833a..998ff47fc8 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/CrystalAura.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/CrystalAura.java @@ -14,6 +14,7 @@ import meteordevelopment.meteorclient.events.render.Render3DEvent; import meteordevelopment.meteorclient.events.world.TickEvent; import meteordevelopment.meteorclient.mixininterface.IBox; +import meteordevelopment.meteorclient.mixininterface.IMiningToolItem; import meteordevelopment.meteorclient.mixininterface.IRaycastContext; import meteordevelopment.meteorclient.mixininterface.IVec3d; import meteordevelopment.meteorclient.renderer.ShapeMode; @@ -694,7 +695,7 @@ private void onPreTick(TickEvent.Pre event) { } // Set player eye pos - ((IVec3d) playerEyePos).set(mc.player.getPos().x, mc.player.getPos().y + mc.player.getEyeHeight(mc.player.getPose()), mc.player.getPos().z); + ((IVec3d) playerEyePos).meteor$set(mc.player.getPos().x, mc.player.getPos().y + mc.player.getEyeHeight(mc.player.getPose()), mc.player.getPos().z); // Find targets, break and place findTargets(); @@ -742,7 +743,7 @@ private void setRotation(boolean isPos, Vec3d pos, double yaw, double pitch) { didRotateThisTick = true; isLastRotationPos = isPos; - if (isPos) ((IVec3d) lastRotationPos).set(pos.x, pos.y, pos.z); + if (isPos) ((IVec3d) lastRotationPos).meteor$set(pos.x, pos.y, pos.z); else { lastYaw = yaw; lastPitch = pitch; @@ -861,10 +862,10 @@ private void doBreak(Entity crystal) { } private boolean isValidWeaknessItem(ItemStack itemStack) { - if (!(itemStack.getItem() instanceof ToolItem) || itemStack.getItem() instanceof HoeItem) return false; + if (!(itemStack.getItem() instanceof IMiningToolItem) || itemStack.getItem() instanceof HoeItem) return false; - ToolMaterial material = ((ToolItem) itemStack.getItem()).getMaterial(); - return material == ToolMaterials.DIAMOND || material == ToolMaterials.NETHERITE; + ToolMaterial material = ((IMiningToolItem) itemStack.getItem()).meteor$getMaterial(); + return material == ToolMaterial.DIAMOND || material == ToolMaterial.NETHERITE; } private void attackCrystal(Entity entity) { @@ -933,7 +934,7 @@ private void doPlace() { } // Check range - ((IVec3d) vec3d).set(bp.getX() + 0.5, bp.getY() + 1, bp.getZ() + 0.5); + ((IVec3d) vec3d).meteor$set(bp.getX() + 0.5, bp.getY() + 1, bp.getZ() + 0.5); blockPos.set(bp).move(0, 1, 0); if (isOutOfRange(vec3d, blockPos, true)) return; @@ -953,7 +954,7 @@ private void doPlace() { double x = bp.getX(); double y = bp.getY() + 1; double z = bp.getZ(); - ((IBox) box).set(x, y, z, x + 1, y + (placement112.get() ? 1 : 2), z + 1); + ((IBox) box).meteor$set(x, y, z, x + 1, y + (placement112.get() ? 1 : 2), z + 1); if (intersectsWithEntities(box)) return; @@ -972,7 +973,7 @@ private void doPlace() { BlockHitResult result = getPlaceInfo(bestBlockPos.get()); - ((IVec3d) vec3d).set( + ((IVec3d) vec3d).meteor$set( result.getBlockPos().getX() + 0.5 + result.getSide().getVector().getX() * 1.0 / 2.0, result.getBlockPos().getY() + 0.5 + result.getSide().getVector().getY() * 1.0 / 2.0, result.getBlockPos().getZ() + 0.5 + result.getSide().getVector().getZ() * 1.0 / 2.0 @@ -997,16 +998,16 @@ private void doPlace() { } private BlockHitResult getPlaceInfo(BlockPos blockPos) { - ((IVec3d) vec3d).set(mc.player.getX(), mc.player.getY() + mc.player.getEyeHeight(mc.player.getPose()), mc.player.getZ()); + ((IVec3d) vec3d).meteor$set(mc.player.getX(), mc.player.getY() + mc.player.getEyeHeight(mc.player.getPose()), mc.player.getZ()); for (Direction side : Direction.values()) { - ((IVec3d) vec3dRayTraceEnd).set( + ((IVec3d) vec3dRayTraceEnd).meteor$set( blockPos.getX() + 0.5 + side.getVector().getX() * 0.5, blockPos.getY() + 0.5 + side.getVector().getY() * 0.5, blockPos.getZ() + 0.5 + side.getVector().getZ() * 0.5 ); - ((IRaycastContext) raycastContext).set(vec3d, vec3dRayTraceEnd, RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.NONE, mc.player); + ((IRaycastContext) raycastContext).meteor$set(vec3d, vec3dRayTraceEnd, RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.NONE, mc.player); BlockHitResult result = mc.world.raycast(raycastContext); if (result != null && result.getType() == HitResult.Type.BLOCK && result.getBlockPos().equals(blockPos)) { @@ -1149,7 +1150,7 @@ private boolean shouldPause(PauseMode process) { } private boolean isOutOfRange(Vec3d vec3d, BlockPos blockPos, boolean place) { - ((IRaycastContext) raycastContext).set(playerEyePos, vec3d, RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.NONE, mc.player); + ((IRaycastContext) raycastContext).meteor$set(playerEyePos, vec3d, RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.NONE, mc.player); BlockHitResult result = mc.world.raycast(raycastContext); @@ -1265,13 +1266,13 @@ private void onRender(Render3DEvent event) { if (renderBoxOne == null) renderBoxOne = new Box(placeRenderPos); if (renderBoxTwo == null) renderBoxTwo = new Box(placeRenderPos); - else ((IBox) renderBoxTwo).set(placeRenderPos); + else ((IBox) renderBoxTwo).meteor$set(placeRenderPos); double offsetX = (renderBoxTwo.minX - renderBoxOne.minX) / smoothness.get(); double offsetY = (renderBoxTwo.minY - renderBoxOne.minY) / smoothness.get(); double offsetZ = (renderBoxTwo.minZ - renderBoxOne.minZ) / smoothness.get(); - ((IBox) renderBoxOne).set( + ((IBox) renderBoxOne).meteor$set( renderBoxOne.minX + offsetX, renderBoxOne.minY + offsetY, renderBoxOne.minZ + offsetZ, diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/HoleFiller.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/HoleFiller.java index 1a8e92bbc2..37bedb7257 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/HoleFiller.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/HoleFiller.java @@ -326,7 +326,7 @@ private boolean validHole(BlockPos pos) { if (((AbstractBlockAccessor) mc.world.getBlockState(testPos).getBlock()).isCollidable()) return false; testPos.add(0, -1, 0); - ((IBox) box).set(pos); + ((IBox) box).meteor$set(pos); if (!mc.world.getOtherEntities(null, box, entity -> entity instanceof PlayerEntity || entity instanceof TntEntity diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/Offhand.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/Offhand.java index 53a262fb59..bda8be8b18 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/Offhand.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/Offhand.java @@ -152,7 +152,7 @@ private void onTick(TickEvent.Pre event) { if (totems <= 0) locked = false; else if (ticks > delayTicks.get()) { boolean low = mc.player.getHealth() + mc.player.getAbsorptionAmount() - PlayerUtils.possibleHealthReductions(explosion.get(), falling.get()) <= minHealth.get(); - boolean ely = elytra.get() && mc.player.getEquippedStack(EquipmentSlot.CHEST).getItem() == Items.ELYTRA && mc.player.isFallFlying(); + boolean ely = elytra.get() && mc.player.getEquippedStack(EquipmentSlot.CHEST).getItem() == Items.ELYTRA && mc.player.isGliding(); FindItemResult item = InvUtils.find(itemStack -> itemStack.getItem() == currentItem.item, 0, 35); // Calculates Damage from Falling, Explosions + Elyta diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/Quiver.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/Quiver.java index 981ba9b1ce..a0281961ae 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/Quiver.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/Quiver.java @@ -184,7 +184,7 @@ private void onTick(TickEvent.Pre event) { int targetSlot = arrowSlots.getFirst(); arrowSlots.removeFirst(); - mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.LookAndOnGround(mc.player.getYaw(), -90, mc.player.isOnGround())); + mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.LookAndOnGround(mc.player.getYaw(), -90, mc.player.isOnGround(), mc.player.horizontalCollision)); mc.options.useKey.setPressed(false); mc.interactionManager.stopUsingItem(mc.player); if (targetSlot != 9) InvUtils.move().from(9).to(targetSlot); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/BetterChat.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/BetterChat.java index 8bd07ffd53..59980a6585 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/BetterChat.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/BetterChat.java @@ -30,6 +30,7 @@ import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.hud.ChatHudLine; import net.minecraft.client.network.PlayerListEntry; +import net.minecraft.client.render.RenderLayer; import net.minecraft.text.*; import net.minecraft.util.Formatting; import net.minecraft.util.Identifier; @@ -444,7 +445,7 @@ private void drawTexture(DrawContext context, IChatHudLine line, int y) { for (CustomHeadEntry entry : CUSTOM_HEAD_ENTRIES) { // Check prefix if (text.startsWith(entry.prefix(), startOffset)) { - context.drawTexture(entry.texture(), 0, y, 8, 8, 0, 0, 64, 64, 64, 64); + context.drawTexture(RenderLayer::getGuiTextured, entry.texture(), 0, y, 8, 8, 0, 0, 64, 64, 64, 64); return; } } @@ -458,8 +459,8 @@ private void drawTexture(DrawContext context, IChatHudLine line, int y) { Identifier skin = entry.getSkinTextures().texture(); - context.drawTexture(skin, 0, y, 8, 8, 8, 8, 8, 8, 64, 64); - context.drawTexture(skin, 0, y, 8, 8, 40, 8, 8, 8, 64, 64); + context.drawTexture(RenderLayer::getGuiTextured, skin, 0, y, 8, 8, 8, 8, 8, 8, 64, 64); + context.drawTexture(RenderLayer::getGuiTextured, skin, 0, y, 8, 8, 40, 8, 8, 8, 64, 64); } private GameProfile getSender(IChatHudLine line, String text) { diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java index 5c3b7b72d2..fcc681195c 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java @@ -23,11 +23,7 @@ import meteordevelopment.meteorclient.utils.network.MeteorExecutor; import meteordevelopment.meteorclient.utils.player.*; import meteordevelopment.orbit.EventHandler; -import net.minecraft.block.AbstractSkullBlock; -import net.minecraft.block.CarvedPumpkinBlock; import net.minecraft.client.gui.screen.ingame.HandledScreen; -import net.minecraft.item.BlockItem; -import net.minecraft.item.Equipment; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.network.packet.c2s.play.CloseHandledScreenC2SPacket; @@ -293,14 +289,6 @@ private boolean sort() { return true; } - private boolean isWearable(ItemStack itemStack) { - Item item = itemStack.getItem(); - - if (item instanceof Equipment) return true; - return item instanceof BlockItem blockItem && - (blockItem.getBlock() instanceof AbstractSkullBlock || blockItem.getBlock() instanceof CarvedPumpkinBlock); - } - @EventHandler private void onOpenScreen(OpenScreenEvent event) { sorter = null; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/Notebot.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/Notebot.java index 0544a13ed3..237a6d2db5 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/Notebot.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/Notebot.java @@ -751,7 +751,7 @@ public boolean loadFileToMap(File file, Runnable callback) { error("Loading song '" + FilenameUtils.getBaseName(file.getName()) + "' was cancelled."); } else { error("An error occurred while loading song '" + FilenameUtils.getBaseName(file.getName()) + "'. See the logs for more details"); - MeteorClient.LOG.error("An error occurred while loading song '" + FilenameUtils.getBaseName(file.getName()) + "'", ex); + MeteorClient.LOG.error("An error occurred while loading song '{}'", FilenameUtils.getBaseName(file.getName()), ex); onSongEnd(); } } 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 063a03dc51..2f6b334ed0 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/Notifier.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/Notifier.java @@ -333,7 +333,7 @@ private void onTick(TickEvent.Post event) { while (timer >= notificationDelay.get() && !messageQueue.isEmpty()) { timer = 0; if (simpleNotifications.get()) { - mc.player.sendMessage(messageQueue.removeFirst()); + mc.player.sendMessage(messageQueue.removeFirst(), false); } else { ChatUtils.sendMsg(messageQueue.removeFirst()); } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/SoundBlocker.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/SoundBlocker.java index 278bf51e43..7b2ff09a72 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/SoundBlocker.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/SoundBlocker.java @@ -34,7 +34,7 @@ public SoundBlocker() { @EventHandler private void onPlaySound(PlaySoundEvent event) { for (SoundEvent sound : sounds.get()) { - if (sound.getId().equals(event.sound.getId())) { + if (sound.id().equals(event.sound.getId())) { event.cancel(); break; } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Anchor.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Anchor.java index eb9124a3a3..a3aa2c7691 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Anchor.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Anchor.java @@ -127,7 +127,7 @@ private void onPostTick(TickEvent.Post event) { deltaX = MathHelper.clamp(holeX - mc.player.getX(), -0.05, 0.05); deltaZ = MathHelper.clamp(holeZ - mc.player.getZ(), -0.05, 0.05); - ((IVec3d) mc.player.getVelocity()).set(deltaX, mc.player.getVelocity().y - (pull.get() ? pullSpeed.get() : 0), deltaZ); + ((IVec3d) mc.player.getVelocity()).meteor$set(deltaX, mc.player.getVelocity().y - (pull.get() ? pullSpeed.get() : 0), deltaZ); } } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/AutoJump.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/AutoJump.java index a42a906826..3277d74f90 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/AutoJump.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/AutoJump.java @@ -58,7 +58,7 @@ private void onTick(TickEvent.Pre event) { if (!mc.player.isOnGround() || mc.player.isSneaking() || !jump()) return; if (mode.get() == Mode.Jump) mc.player.jump(); - else ((IVec3d) mc.player.getVelocity()).setY(velocityHeight.get()); + else ((IVec3d) mc.player.getVelocity()).meteor$setY(velocityHeight.get()); } public enum JumpWhen { diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/AutoWalk.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/AutoWalk.java index ccfb619c18..dfa4eb8447 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/AutoWalk.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/AutoWalk.java @@ -13,6 +13,7 @@ import meteordevelopment.meteorclient.settings.SettingGroup; import meteordevelopment.meteorclient.systems.modules.Categories; import meteordevelopment.meteorclient.systems.modules.Module; +import meteordevelopment.meteorclient.utils.Utils; import meteordevelopment.meteorclient.utils.misc.input.Input; import meteordevelopment.orbit.EventHandler; import meteordevelopment.orbit.EventPriority; @@ -26,7 +27,7 @@ public class AutoWalk extends Module { .description("Walking mode.") .defaultValue(Mode.Smart) .onChanged(mode1 -> { - if (isActive()) { + if (isActive() && Utils.canUpdate()) { if (mode1 == Mode.Simple) { PathManagers.get().stop(); } else { diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/AutoWasp.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/AutoWasp.java index 851375e2ac..e0aae0c7bc 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/AutoWasp.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/AutoWasp.java @@ -15,9 +15,9 @@ import meteordevelopment.meteorclient.utils.entity.SortPriority; import meteordevelopment.meteorclient.utils.entity.TargetUtils; import meteordevelopment.orbit.EventHandler; +import net.minecraft.component.DataComponentTypes; import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ElytraItem; import net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket; import net.minecraft.network.packet.s2c.common.DisconnectS2CPacket; import net.minecraft.text.Text; @@ -127,13 +127,13 @@ private void onTick(TickEvent.Pre event) { if (!isActive()) return; } - if (!(mc.player.getEquippedStack(EquipmentSlot.CHEST).getItem() instanceof ElytraItem)) return; + if (!(mc.player.getEquippedStack(EquipmentSlot.CHEST).contains(DataComponentTypes.GLIDER))) return; if (incrementJumpTimer) { jumpTimer++; } - if (!mc.player.isFallFlying()) { + if (!mc.player.isGliding()) { if (!incrementJumpTimer) incrementJumpTimer = true; if (mc.player.isOnGround() && incrementJumpTimer) { @@ -155,8 +155,8 @@ private void onTick(TickEvent.Pre event) { @EventHandler private void onMove(PlayerMoveEvent event) { - if (!(mc.player.getEquippedStack(EquipmentSlot.CHEST).getItem() instanceof ElytraItem)) return; - if (!mc.player.isFallFlying()) return; + if (!(mc.player.getEquippedStack(EquipmentSlot.CHEST).contains(DataComponentTypes.GLIDER))) return; + if (!mc.player.isGliding()) return; double xVel = 0, yVel = 0, zVel = 0; @@ -207,7 +207,7 @@ private void onMove(PlayerMoveEvent event) { else yVel = verticalSpeed.get() * Math.signum(yDist); } - ((IVec3d) event.movement).set(xVel, yVel, zVel); + ((IVec3d) event.movement).meteor$set(xVel, yVel, zVel); } public enum Action { diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/BoatFly.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/BoatFly.java index 13ea7f99bf..3183381bcd 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/BoatFly.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/BoatFly.java @@ -77,7 +77,7 @@ private void onBoatMove(BoatMoveEvent event) { else velY -= fallSpeed.get() / 20; // Apply velocity - ((IVec3d) event.boat.getVelocity()).set(velX, velY, velZ); + ((IVec3d) event.boat.getVelocity()).meteor$set(velX, velY, velZ); } @EventHandler diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/ElytraBoost.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/ElytraBoost.java index 493e3d0d9b..4f3a123210 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/ElytraBoost.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/ElytraBoost.java @@ -91,7 +91,7 @@ private void onTick(TickEvent.Post event) { private void boost() { if (!Utils.canUpdate()) return; - if (mc.player.isFallFlying() && mc.currentScreen == null) { + if (mc.player.isGliding() && mc.currentScreen == null) { ItemStack itemStack = Items.FIREWORK_ROCKET.getDefaultStack(); itemStack.set(DataComponentTypes.FIREWORKS, new FireworksComponent(fireworkLevel.get(), itemStack.get(DataComponentTypes.FIREWORKS).explosions())); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/EntityControl.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/EntityControl.java index 8e7dd4c3f8..2351992385 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/EntityControl.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/EntityControl.java @@ -39,14 +39,14 @@ public void onDeactivate() { if (!Utils.canUpdate() || mc.world.getEntities() == null) return; for (Entity entity : mc.world.getEntities()) { - if (entity instanceof AbstractHorseEntity) ((IHorseBaseEntity) entity).setSaddled(false); + if (entity instanceof AbstractHorseEntity) ((IHorseBaseEntity) entity).meteor$setSaddled(false); } } @EventHandler private void onTick(TickEvent.Pre event) { for (Entity entity : mc.world.getEntities()) { - if (entity instanceof AbstractHorseEntity) ((IHorseBaseEntity) entity).setSaddled(true); + if (entity instanceof AbstractHorseEntity) ((IHorseBaseEntity) entity).meteor$setSaddled(true); } if (maxJump.get()) ((ClientPlayerEntityAccessor) mc.player).setMountJumpStrength(1); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/EntitySpeed.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/EntitySpeed.java index 198d662706..7345ae2c45 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/EntitySpeed.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/EntitySpeed.java @@ -59,6 +59,6 @@ private void onLivingEntityMove(LivingEntityMoveEvent event) { // Set horizontal velocity Vec3d vel = PlayerUtils.getHorizontalVelocity(speed.get()); - ((IVec3d) event.movement).setXZ(vel.x, vel.z); + ((IVec3d) event.movement).meteor$setXZ(vel.x, vel.z); } } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Flight.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Flight.java index 3706dcddcd..a3e213fd3b 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Flight.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Flight.java @@ -209,14 +209,16 @@ private void onSendPacket(PacketEvent.Send event) { mc.player.getZ(), packet.getYaw(0), packet.getPitch(0), - packet.isOnGround() + packet.isOnGround(), + mc.player.horizontalCollision ); } else { fullPacket = new PlayerMoveC2SPacket.PositionAndOnGround( mc.player.getX(), mc.player.getY(), mc.player.getZ(), - packet.isOnGround() + packet.isOnGround(), + mc.player.horizontalCollision ); } event.cancel(); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Jesus.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Jesus.java index 9366ac3815..dad191eb30 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Jesus.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Jesus.java @@ -21,9 +21,10 @@ import meteordevelopment.orbit.EventHandler; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; -import net.minecraft.entity.EntityType; +import net.minecraft.entity.Entity; import net.minecraft.entity.attribute.EntityAttributes; import net.minecraft.entity.effect.StatusEffects; +import net.minecraft.entity.vehicle.AbstractBoatEntity; import net.minecraft.fluid.Fluids; import net.minecraft.network.packet.Packet; import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; @@ -199,13 +200,13 @@ private void onTick(TickEvent.Post event) { // Move up in bubble columns if (bubbleColumn) { - if (mc.options.jumpKey.isPressed() && mc.player.getVelocity().getY() < 0.11) ((IVec3d) mc.player.getVelocity()).setY(0.11); + if (mc.options.jumpKey.isPressed() && mc.player.getVelocity().getY() < 0.11) ((IVec3d) mc.player.getVelocity()).meteor$setY(0.11); return; } // Move up if (mc.player.isTouchingWater() || mc.player.isInLava()) { - ((IVec3d) mc.player.getVelocity()).setY(0.11); + ((IVec3d) mc.player.getVelocity()).meteor$setY(0.11); tickTimer = 0; return; } @@ -218,9 +219,9 @@ private void onTick(TickEvent.Post event) { // Simulate jumping out of water - if (tickTimer == 0) ((IVec3d) mc.player.getVelocity()).setY(0.30); + if (tickTimer == 0) ((IVec3d) mc.player.getVelocity()).meteor$setY(0.30); else if (tickTimer == 1 && (blockBelowState == Blocks.WATER.getDefaultState() || blockBelowState == Blocks.LAVA.getDefaultState() || waterLogger)) - ((IVec3d) mc.player.getVelocity()).setY(0); + ((IVec3d) mc.player.getVelocity()).meteor$setY(0); tickTimer++; } @@ -280,10 +281,10 @@ private void onSendPacket(PacketEvent.Send event) { // Create new packet Packet newPacket; if (packet instanceof PlayerMoveC2SPacket.PositionAndOnGround) { - newPacket = new PlayerMoveC2SPacket.PositionAndOnGround(x, y, z, true); + newPacket = new PlayerMoveC2SPacket.PositionAndOnGround(x, y, z, true, mc.player.horizontalCollision); } else { - newPacket = new PlayerMoveC2SPacket.Full(x, y, z, packet.getYaw(0), packet.getPitch(0), true); + newPacket = new PlayerMoveC2SPacket.Full(x, y, z, packet.getYaw(0), packet.getPitch(0), true, mc.player.horizontalCollision); } // Send new packet @@ -294,8 +295,8 @@ private boolean waterShouldBeSolid() { if (EntityUtils.getGameMode(mc.player) == GameMode.SPECTATOR || mc.player.getAbilities().flying) return false; if (mc.player.getVehicle() != null) { - EntityType vehicle = mc.player.getVehicle().getType(); - if (vehicle == EntityType.BOAT || vehicle == EntityType.CHEST_BOAT) return false; + Entity vehicle = mc.player.getVehicle(); + if (vehicle instanceof AbstractBoatEntity) return false; } if (Modules.get().get(Flight.class).isActive()) return false; @@ -321,8 +322,7 @@ private boolean lavaShouldBeSolid() { private boolean lavaIsSafe() { if (!dipIfFireResistant.get()) return false; - return mc.player.hasStatusEffect(StatusEffects.FIRE_RESISTANCE) && (mc.player.getStatusEffect(StatusEffects.FIRE_RESISTANCE).getDuration() > (15 * 20 * mc.player.getAttributeValue(EntityAttributes.GENERIC_BURNING_TIME))); - // todo verify + return mc.player.hasStatusEffect(StatusEffects.FIRE_RESISTANCE) && (mc.player.getStatusEffect(StatusEffects.FIRE_RESISTANCE).getDuration() > (15 * 20 * mc.player.getAttributeValue(EntityAttributes.BURNING_TIME))); } private boolean isOverLiquid() { diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/LongJump.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/LongJump.java index bbb0fbe7e1..69c3f316ad 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/LongJump.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/LongJump.java @@ -156,10 +156,10 @@ private void onPlayerMove(PlayerMoveEvent event) { double zDir = Math.sin(Math.toRadians(dir + 90)); if (!mc.world.isSpaceEmpty(mc.player.getBoundingBox().offset(0.0, mc.player.getVelocity().y, 0.0)) || mc.player.verticalCollision) { - ((IVec3d) event.movement).setXZ(xDir * 0.29F, zDir * 0.29F); + ((IVec3d) event.movement).meteor$setXZ(xDir * 0.29F, zDir * 0.29F); } if ((event.movement.getY() == .33319999363422365)) { - ((IVec3d) event.movement).setXZ(xDir * vanillaBoostFactor.get(), zDir * vanillaBoostFactor.get()); + ((IVec3d) event.movement).meteor$setXZ(xDir * vanillaBoostFactor.get(), zDir * vanillaBoostFactor.get()); } } } @@ -180,7 +180,7 @@ private void onPlayerMove(PlayerMoveEvent event) { if (PlayerUtils.isMoving() && (!onJump.get() || mc.options.jumpKey.isPressed()) && !mc.player.isInLava() && !mc.player.isTouchingWater()) { if (stage == 0) moveSpeed = getMoveSpeed() * burstInitialSpeed.get(); else if (stage == 1) { - ((IVec3d) event.movement).setY(0.42); + ((IVec3d) event.movement).meteor$setY(0.42); moveSpeed *= burstBoostFactor.get(); } else if (stage == 2) { @@ -191,7 +191,7 @@ else if (stage == 2) { setMoveSpeed(event, moveSpeed = Math.max(getMoveSpeed(), moveSpeed)); if (!mc.player.verticalCollision && !mc.world.isSpaceEmpty(mc.player.getBoundingBox().offset(0.0, mc.player.getVelocity().y, 0.0)) && !mc.world.isSpaceEmpty(mc.player.getBoundingBox().offset(0.0, -0.4, 0.0))) { - ((IVec3d) event.movement).setY(-0.001); + ((IVec3d) event.movement).meteor$setY(-0.001); } stage++; @@ -284,7 +284,7 @@ private void setMoveSpeed(PlayerMoveEvent event, double speed) { float yaw = mc.player.getYaw(); if (!PlayerUtils.isMoving()) { - ((IVec3d) event.movement).setXZ(0, 0); + ((IVec3d) event.movement).meteor$setXZ(0, 0); } else { if (forward != 0) { @@ -298,7 +298,7 @@ private void setMoveSpeed(PlayerMoveEvent event, double speed) { double cos = Math.cos(Math.toRadians(yaw + 90)); double sin = Math.sin(Math.toRadians(yaw + 90)); - ((IVec3d) event.movement).setXZ((forward * speed * cos) + (strafe * speed * sin), (forward * speed * sin) + (strafe * speed * cos)); + ((IVec3d) event.movement).meteor$setXZ((forward * speed * cos) + (strafe * speed * sin), (forward * speed * sin) + (strafe * speed * cos)); } public enum JumpMode { diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/NoFall.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/NoFall.java index af4259de2c..eaa487c5ea 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/NoFall.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/NoFall.java @@ -107,11 +107,11 @@ private void onSendPacket(PacketEvent.Send event) { if (mc.player.getAbilities().creativeMode || !(event.packet instanceof PlayerMoveC2SPacket) || mode.get() != Mode.Packet - || ((IPlayerMoveC2SPacket) event.packet).getTag() == 1337) return; + || ((IPlayerMoveC2SPacket) event.packet).meteor$getTag() == 1337) return; if (!Modules.get().isActive(Flight.class)) { - if (mc.player.isFallFlying()) return; + if (mc.player.isGliding()) return; if (mc.player.getVelocity().y > -0.5) return; ((PlayerMoveC2SPacketAccessor) event.packet).setOnGround(true); } else { @@ -138,11 +138,11 @@ private void onTick(TickEvent.Pre event) { Rotations.rotate(mc.player.getYaw(), 90, Integer.MAX_VALUE, () -> { double preY = mc.player.getVelocity().y; - ((IVec3d) mc.player.getVelocity()).setY(0); + ((IVec3d) mc.player.getVelocity()).meteor$setY(0); BlockUtils.place(mc.player.getBlockPos().down(), InvUtils.findInHotbar(itemStack -> itemStack.getItem() instanceof BlockItem), false, 0, true); - ((IVec3d) mc.player.getVelocity()).setY(preY); + ((IVec3d) mc.player.getVelocity()).meteor$setY(preY); }); } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/ReverseStep.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/ReverseStep.java index 68ef86e08d..a2a25eae46 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/ReverseStep.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/ReverseStep.java @@ -43,7 +43,7 @@ public ReverseStep() { private void onTick(TickEvent.Post event) { if (!mc.player.isOnGround() || mc.player.isHoldingOntoLadder() || mc.player.isSubmergedInWater() || mc.player.isInLava() ||mc.options.jumpKey.isPressed() || mc.player.noClip || mc.player.forwardSpeed == 0 && mc.player.sidewaysSpeed == 0) return; - if (!isOnBed() && !mc.world.isSpaceEmpty(mc.player.getBoundingBox().offset(0.0, (float) -(fallDistance.get() + 0.01), 0.0))) ((IVec3d) mc.player.getVelocity()).setY(-fallSpeed.get()); + if (!isOnBed() && !mc.world.isSpaceEmpty(mc.player.getBoundingBox().offset(0.0, (float) -(fallDistance.get() + 0.01), 0.0))) ((IVec3d) mc.player.getVelocity()).meteor$setY(-fallSpeed.get()); } private boolean isOnBed() { diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Scaffold.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Scaffold.java index 3a9fa6ab3a..1427b9e01c 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Scaffold.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Scaffold.java @@ -220,7 +220,7 @@ private void onTick(TickEvent.Pre event) { List blockPosArray = new ArrayList<>(); for (int x = (int) (mc.player.getX() - placeRange.get()); x < mc.player.getX() + placeRange.get(); x++) { for (int z = (int) (mc.player.getZ() - placeRange.get()); z < mc.player.getZ() + placeRange.get(); z++) { - for (int y = (int) Math.max(mc.world.getBottomY(), mc.player.getY() - placeRange.get()); y < Math.min(mc.world.getTopY(), mc.player.getY() + placeRange.get()); y++) { + for (int y = (int) Math.max(mc.world.getBottomY(), mc.player.getY() - placeRange.get()); y < Math.min(mc.world.getHeight(), mc.player.getY() + placeRange.get()); y++) { bp.set(x, y, z); if (BlockUtils.getPlaceSide(bp) == null) continue; if (!BlockUtils.canPlace(bp)) continue; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Sprint.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Sprint.java index 22a7a1ae51..8e2e2d46eb 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Sprint.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Sprint.java @@ -81,7 +81,7 @@ private void onTickMovement(TickEvent.Post event) { @EventHandler(priority = EventPriority.HIGH) private void onPacketSend(PacketEvent.Send event) { - if (!unsprintOnHit.get() || !(event.packet instanceof IPlayerInteractEntityC2SPacket packet) || packet.getType() != PlayerInteractEntityC2SPacket.InteractType.ATTACK) return; + if (!unsprintOnHit.get() || !(event.packet instanceof IPlayerInteractEntityC2SPacket packet) || packet.meteor$getType() != PlayerInteractEntityC2SPacket.InteractType.ATTACK) return; mc.getNetworkHandler().sendPacket(new ClientCommandC2SPacket(mc.player, ClientCommandC2SPacket.Mode.STOP_SPRINTING)); mc.player.setSprinting(false); @@ -90,7 +90,7 @@ private void onPacketSend(PacketEvent.Send event) { @EventHandler private void onPacketSent(PacketEvent.Sent event) { if (!unsprintOnHit.get() || !keepSprint.get()) return; - if (!(event.packet instanceof IPlayerInteractEntityC2SPacket packet) || packet.getType() != PlayerInteractEntityC2SPacket.InteractType.ATTACK) return; + if (!(event.packet instanceof IPlayerInteractEntityC2SPacket packet) || packet.meteor$getType() != PlayerInteractEntityC2SPacket.InteractType.ATTACK) return; if (shouldSprint() && !mc.player.isSprinting()) { mc.getNetworkHandler().sendPacket(new ClientCommandC2SPacket(mc.player, ClientCommandC2SPacket.Mode.START_SPRINTING)); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Step.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Step.java index f10f65065f..7a5d0f38c8 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Step.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Step.java @@ -74,16 +74,16 @@ private void onTick(TickEvent.Post event) { boolean work = (activeWhen.get() == ActiveWhen.Always) || (activeWhen.get() == ActiveWhen.Sneaking && mc.player.isSneaking()) || (activeWhen.get() == ActiveWhen.NotSneaking && !mc.player.isSneaking()); mc.player.setBoundingBox(mc.player.getBoundingBox().offset(0, 1, 0)); if (work && (!safeStep.get() || (getHealth() > stepHealth.get() && getHealth() - getExplosionDamage() > stepHealth.get()))){ - mc.player.getAttributeInstance(EntityAttributes.GENERIC_STEP_HEIGHT).setBaseValue(height.get()); + mc.player.getAttributeInstance(EntityAttributes.STEP_HEIGHT).setBaseValue(height.get()); } else { - mc.player.getAttributeInstance(EntityAttributes.GENERIC_STEP_HEIGHT).setBaseValue(prevStepHeight); + mc.player.getAttributeInstance(EntityAttributes.STEP_HEIGHT).setBaseValue(prevStepHeight); } mc.player.setBoundingBox(mc.player.getBoundingBox().offset(0, -1, 0)); } @Override public void onDeactivate() { - mc.player.getAttributeInstance(EntityAttributes.GENERIC_STEP_HEIGHT).setBaseValue(prevStepHeight); + mc.player.getAttributeInstance(EntityAttributes.STEP_HEIGHT).setBaseValue(prevStepHeight); PathManagers.get().getSettings().getStep().set(prevPathManagerStep); } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Velocity.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Velocity.java index f4b31b8b5f..407cf37637 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Velocity.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Velocity.java @@ -143,7 +143,7 @@ private void onTick(TickEvent.Post event) { if (mc.options.jumpKey.isPressed() || mc.options.sneakKey.isPressed()) return; if ((mc.player.isTouchingWater() || mc.player.isInLava()) && mc.player.getVelocity().y < 0) { - ((IVec3d) mc.player.getVelocity()).setY(0); + ((IVec3d) mc.player.getVelocity()).meteor$setY(0); } } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/elytrafly/ElytraFlightMode.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/elytrafly/ElytraFlightMode.java index fc07b278c6..4ed9d41eb0 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/elytrafly/ElytraFlightMode.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/elytrafly/ElytraFlightMode.java @@ -88,7 +88,7 @@ public void autoTakeoff() { boolean jumpPressed = mc.options.jumpKey.isPressed(); if (elytraFly.autoTakeOff.get() && jumpPressed) { - if (!lastJumpPressed && !mc.player.isFallFlying()) { + if (!lastJumpPressed && !mc.player.isGliding()) { jumpTimer = 0; incrementJumpTimer = true; } @@ -107,7 +107,7 @@ public void autoTakeoff() { } public void handleAutopilot() { - if (!mc.player.isFallFlying()) return; + if (!mc.player.isGliding()) return; if (elytraFly.autoPilot.get() && mc.player.getY() > elytraFly.autoPilotMinimumHeight.get() && elytraFly.flightMode.get() != ElytraFlightModes.Bounce) { mc.options.forwardKey.setPressed(true); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/elytrafly/ElytraFly.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/elytrafly/ElytraFly.java index 8c65e95fdf..22f720bf65 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/elytrafly/ElytraFly.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/elytrafly/ElytraFly.java @@ -26,7 +26,6 @@ import net.minecraft.block.BlockState; import net.minecraft.component.DataComponentTypes; import net.minecraft.entity.EquipmentSlot; -import net.minecraft.item.ElytraItem; import net.minecraft.item.Items; import net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket; import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; @@ -358,7 +357,7 @@ public void onDeactivate() { enableGroundListener(); } - if (mc.player.isFallFlying() && instaDrop.get()) { + if (mc.player.isGliding() && instaDrop.get()) { enableInstaDropListener(); } @@ -367,11 +366,11 @@ public void onDeactivate() { @EventHandler private void onPlayerMove(PlayerMoveEvent event) { - if (!(mc.player.getEquippedStack(EquipmentSlot.CHEST).getItem() instanceof ElytraItem)) return; + if (!(mc.player.getEquippedStack(EquipmentSlot.CHEST).contains(DataComponentTypes.GLIDER))) return; currentMode.autoTakeoff(); - if (mc.player.isFallFlying()) { + if (mc.player.isGliding()) { if (flightMode.get() != ElytraFlightModes.Bounce) { currentMode.velX = 0; @@ -398,12 +397,12 @@ private void onPlayerMove(PlayerMoveEvent event) { int chunkZ = (int) ((mc.player.getZ() + currentMode.velZ) / 16); if (dontGoIntoUnloadedChunks.get()) { if (mc.world.getChunkManager().isChunkLoaded(chunkX, chunkZ)) { - if (flightMode.get() != ElytraFlightModes.Bounce) ((IVec3d) event.movement).set(currentMode.velX, currentMode.velY, currentMode.velZ); + if (flightMode.get() != ElytraFlightModes.Bounce) ((IVec3d) event.movement).meteor$set(currentMode.velX, currentMode.velY, currentMode.velZ); } else { currentMode.zeroAcceleration(); - ((IVec3d) event.movement).set(0, currentMode.velY, 0); + ((IVec3d) event.movement).meteor$set(0, currentMode.velY, 0); } - } else if (flightMode.get() != ElytraFlightModes.Bounce) ((IVec3d) event.movement).set(currentMode.velX, currentMode.velY, currentMode.velZ); + } else if (flightMode.get() != ElytraFlightModes.Bounce) ((IVec3d) event.movement).meteor$set(currentMode.velX, currentMode.velY, currentMode.velZ); if (flightMode.get() != ElytraFlightModes.Bounce) currentMode.onPlayerMove(); } else { @@ -413,16 +412,16 @@ private void onPlayerMove(PlayerMoveEvent event) { } } - if (noCrash.get() && mc.player.isFallFlying() && flightMode.get() != ElytraFlightModes.Bounce) { + if (noCrash.get() && mc.player.isGliding() && flightMode.get() != ElytraFlightModes.Bounce) { Vec3d lookAheadPos = mc.player.getPos().add(mc.player.getVelocity().normalize().multiply(crashLookAhead.get())); RaycastContext raycastContext = new RaycastContext(mc.player.getPos(), new Vec3d(lookAheadPos.getX(), mc.player.getY(), lookAheadPos.getZ()), RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.NONE, mc.player); BlockHitResult hitResult = mc.world.raycast(raycastContext); if (hitResult != null && hitResult.getType() == HitResult.Type.BLOCK) { - ((IVec3d) event.movement).set(0, currentMode.velY, 0); + ((IVec3d) event.movement).meteor$set(0, currentMode.velY, 0); } } - if (autoHover.get() && mc.player.input.sneaking && !Modules.get().get(Freecam.class).isActive() && mc.player.isFallFlying() && flightMode.get() != ElytraFlightModes.Bounce) { + if (autoHover.get() && mc.player.input.playerInput.sneak() && !Modules.get().get(Freecam.class).isActive() && mc.player.isGliding() && flightMode.get() != ElytraFlightModes.Bounce) { BlockState underState = mc.world.getBlockState(mc.player.getBlockPos().down()); Block under = underState.getBlock(); BlockState under2State = mc.world.getBlockState(mc.player.getBlockPos().down().down()); @@ -432,27 +431,26 @@ private void onPlayerMove(PlayerMoveEvent event) { final boolean under2Collidable = under2.collidable || !under2State.getFluidState().isEmpty(); if (!underCollidable && under2Collidable) { - ((IVec3d)event.movement).set(event.movement.x, -0.1f, event.movement.z); + ((IVec3d)event.movement).meteor$set(event.movement.x, -0.1f, event.movement.z); mc.player.setPitch(MathHelper.clamp(mc.player.getPitch(0), -50.f, 20.f)); // clamp between -50 and 20 (>= 30 will pop you off, but lag makes that threshold lower) } if (underCollidable) { - ((IVec3d)event.movement).set(event.movement.x, -0.03f, event.movement.z); + ((IVec3d)event.movement).meteor$set(event.movement.x, -0.03f, event.movement.z); mc.player.setPitch(MathHelper.clamp(mc.player.getPitch(0), -50.f, 20.f)); if (mc.player.getPos().y <= mc.player.getBlockPos().down().getY() + 1.34f) { - ((IVec3d)event.movement).set(event.movement.x, 0, event.movement.z); + ((IVec3d)event.movement).meteor$set(event.movement.x, 0, event.movement.z); mc.player.setSneaking(false); - mc.player.input.sneaking = false; } } } } public boolean canPacketEfly() { - return isActive() && flightMode.get() == ElytraFlightModes.Packet && mc.player.getEquippedStack(EquipmentSlot.CHEST).getItem() instanceof ElytraItem && !mc.player.isOnGround(); + return isActive() && flightMode.get() == ElytraFlightModes.Packet && mc.player.getEquippedStack(EquipmentSlot.CHEST).contains(DataComponentTypes.GLIDER) && !mc.player.isOnGround(); } @EventHandler @@ -514,9 +512,9 @@ protected void disableGroundListener() { private class StaticInstaDropListener { @EventHandler private void onInstadropTick(TickEvent.Post event) { - if (mc.player != null && mc.player.isFallFlying()) { + if (mc.player != null && mc.player.isGliding()) { mc.player.setVelocity(0, 0, 0); - mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.OnGroundOnly(true)); + mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.OnGroundOnly(true, mc.player.horizontalCollision)); } else { disableInstaDropListener(); } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/elytrafly/modes/Bounce.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/elytrafly/modes/Bounce.java index 380ba802fd..9f44da6b8c 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/elytrafly/modes/Bounce.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/elytrafly/modes/Bounce.java @@ -15,11 +15,10 @@ import meteordevelopment.meteorclient.utils.misc.input.Input; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.option.KeyBinding; +import net.minecraft.component.DataComponentTypes; import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.effect.StatusEffects; -import net.minecraft.item.ElytraItem; import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; import net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket; import net.minecraft.network.packet.s2c.play.PlayerPositionLookS2CPacket; @@ -38,7 +37,7 @@ public Bounce() { public void onTick() { super.onTick(); - if (mc.options.jumpKey.isPressed() && !mc.player.isFallFlying()) mc.getNetworkHandler().sendPacket(new ClientCommandC2SPacket(mc.player, ClientCommandC2SPacket.Mode.START_FALL_FLYING)); + if (mc.options.jumpKey.isPressed() && !mc.player.isGliding()) mc.getNetworkHandler().sendPacket(new ClientCommandC2SPacket(mc.player, ClientCommandC2SPacket.Mode.START_FALL_FLYING)); // Make sure all the conditions are met (player has an elytra, isn't in water, etc) if (checkConditions(mc.player)) { @@ -53,7 +52,7 @@ public void onTick() { if (!elytraFly.sprint.get()) { // Sprinting all the time (when not on ground) makes it rubberband on certain anticheats. - if (mc.player.isFallFlying()) mc.player.setSprinting(mc.player.isOnGround()); + if (mc.player.isGliding()) mc.player.setSprinting(mc.player.isOnGround()); else mc.player.setSprinting(true); } @@ -86,7 +85,7 @@ private void unpress() { public void onPacketReceive(PacketEvent.Receive event) { if (event.packet instanceof PlayerPositionLookS2CPacket) { rubberbanded = true; - mc.player.stopFallFlying(); + mc.player.stopGliding(); } } @@ -112,14 +111,14 @@ public static boolean recastElytra(ClientPlayerEntity player) { public static boolean checkConditions(ClientPlayerEntity player) { ItemStack itemStack = player.getEquippedStack(EquipmentSlot.CHEST); - return (!player.getAbilities().flying && !player.hasVehicle() && !player.isClimbing() && itemStack.isOf(Items.ELYTRA) && ElytraItem.isUsable(itemStack)); + return (!player.getAbilities().flying && !player.hasVehicle() && !player.isClimbing() && itemStack.contains(DataComponentTypes.GLIDER) && !itemStack.willBreakNextUse()); } private static boolean ignoreGround(ClientPlayerEntity player) { if (!player.isTouchingWater() && !player.hasStatusEffect(StatusEffects.LEVITATION)) { ItemStack itemStack = player.getEquippedStack(EquipmentSlot.CHEST); - if (itemStack.isOf(Items.ELYTRA) && ElytraItem.isUsable(itemStack)) { - player.startFallFlying(); + if (itemStack.contains(DataComponentTypes.GLIDER) && !itemStack.willBreakNextUse()) { + player.startGliding(); return true; } else return false; } else return false; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/elytrafly/modes/Packet.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/elytrafly/modes/Packet.java index 7262affc85..10c3e7ca1b 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/elytrafly/modes/Packet.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/elytrafly/modes/Packet.java @@ -49,7 +49,7 @@ public void onTick() { mc.player.setVelocity(vec3d); mc.player.networkHandler.sendPacket(new ClientCommandC2SPacket(mc.player, ClientCommandC2SPacket.Mode.START_FALL_FLYING)); - mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.OnGroundOnly(true)); + mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.OnGroundOnly(true, mc.player.horizontalCollision)); } //Walalalalalalalalalalalala diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/speed/Speed.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/speed/Speed.java index e95b3341d4..d6a6b2d948 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/speed/Speed.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/speed/Speed.java @@ -113,7 +113,7 @@ public void onDeactivate() { @EventHandler private void onPlayerMove(PlayerMoveEvent event) { - if (event.type != MovementType.SELF || mc.player.isFallFlying() || mc.player.isClimbing() || mc.player.getVehicle() != null) return; + if (event.type != MovementType.SELF || mc.player.isGliding() || mc.player.isClimbing() || mc.player.getVehicle() != null) return; if (!whenSneaking.get() && mc.player.isSneaking()) return; if (vanillaOnGround.get() && !mc.player.isOnGround() && speedMode.get() == SpeedModes.Vanilla) return; if (!inLiquids.get() && (mc.player.isTouchingWater() || mc.player.isInLava())) return; @@ -127,7 +127,7 @@ private void onPlayerMove(PlayerMoveEvent event) { @EventHandler private void onPreTick(TickEvent.Pre event) { - if (mc.player.isFallFlying() || mc.player.isClimbing() || mc.player.getVehicle() != null) return; + if (mc.player.isGliding() || mc.player.isClimbing() || mc.player.getVehicle() != null) return; if (!whenSneaking.get() && mc.player.isSneaking()) return; if (vanillaOnGround.get() && !mc.player.isOnGround() && speedMode.get() == SpeedModes.Vanilla) return; if (!inLiquids.get() && (mc.player.isTouchingWater() || mc.player.isInLava())) return; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/speed/modes/Strafe.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/speed/modes/Strafe.java index 194e23811d..67fb3cafe4 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/speed/modes/Strafe.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/speed/modes/Strafe.java @@ -33,7 +33,7 @@ public void onMove(PlayerMoveEvent event) { case 1: //Jump if (!PlayerUtils.isMoving() || !mc.player.isOnGround()) break; - ((IVec3d) event.movement).setY(getHop(0.40123128)); + ((IVec3d) event.movement).meteor$setY(getHop(0.40123128)); speed *= settings.ncpSpeed.get(); stage++; break; @@ -67,7 +67,7 @@ public void onMove(PlayerMoveEvent event) { velZ = anchor.deltaZ; } - ((IVec3d) event.movement).setXZ(velX, velZ); + ((IVec3d) event.movement).meteor$setXZ(velX, velZ); } private Vector2d transformStrafe(double speed) { diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/speed/modes/Vanilla.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/speed/modes/Vanilla.java index 5a4ef24487..b914cbc2b0 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/speed/modes/Vanilla.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/speed/modes/Vanilla.java @@ -38,6 +38,6 @@ public void onMove(PlayerMoveEvent event) { velZ = anchor.deltaZ; } - ((IVec3d) event.movement).set(velX, event.movement.y, velZ); + ((IVec3d) event.movement).meteor$set(velX, event.movement.y, velZ); } } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AutoEat.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AutoEat.java index d41edba613..a3dc08d1fc 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AutoEat.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AutoEat.java @@ -31,6 +31,7 @@ import java.util.function.BiPredicate; public class AutoEat extends Module { + @SuppressWarnings("unchecked") private static final Class[] AURAS = new Class[]{KillAura.class, CrystalAura.class, AnchorAura.class, BedAura.class}; private final SettingGroup sgGeneral = settings.getDefaultGroup(); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AutoGap.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AutoGap.java index 053e933072..f6c1216f8d 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AutoGap.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AutoGap.java @@ -35,6 +35,7 @@ import java.util.Map; public class AutoGap extends Module { + @SuppressWarnings("unchecked") private static final Class[] AURAS = new Class[] { KillAura.class, CrystalAura.class, AnchorAura.class, BedAura.class }; private final SettingGroup sgGeneral = settings.getDefaultGroup(); 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 8c9ff700fb..2bbfabad1c 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AutoTool.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AutoTool.java @@ -222,7 +222,7 @@ && isFortunable(state.getBlock()) } public static boolean isTool(Item item) { - return item instanceof ToolItem || item instanceof ShearsItem; + return item instanceof MiningToolItem || item instanceof ShearsItem; } public static boolean isTool(ItemStack itemStack) { return isTool(itemStack.getItem()); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/ChestSwap.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/ChestSwap.java index 02baa93623..76c97a5a22 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/ChestSwap.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/ChestSwap.java @@ -13,9 +13,10 @@ import meteordevelopment.meteorclient.systems.modules.Categories; import meteordevelopment.meteorclient.systems.modules.Module; import meteordevelopment.meteorclient.utils.player.InvUtils; +import net.minecraft.component.DataComponentTypes; import net.minecraft.entity.EquipmentSlot; -import net.minecraft.item.ArmorItem; import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.network.packet.c2s.play.CloseHandledScreenC2SPacket; @@ -59,11 +60,11 @@ public void onDeactivate() { } public void swap() { - Item currentItem = mc.player.getEquippedStack(EquipmentSlot.CHEST).getItem(); + ItemStack currentItem = mc.player.getEquippedStack(EquipmentSlot.CHEST); - if (currentItem == Items.ELYTRA) { + if (currentItem.contains(DataComponentTypes.GLIDER)) { equipChestplate(); - } else if (currentItem instanceof ArmorItem && ((ArmorItem) currentItem).getSlotType() == EquipmentSlot.CHEST) { + } else if (currentItem.contains(DataComponentTypes.EQUIPPABLE) && currentItem.get(DataComponentTypes.EQUIPPABLE).slot().getEntitySlotId() == EquipmentSlot.CHEST.getEntitySlotId()) { equipElytra(); } else { if (!equipChestplate()) equipElytra(); @@ -117,9 +118,9 @@ private boolean equipChestplate() { private void equipElytra() { for (int i = 0; i < mc.player.getInventory().main.size(); i++) { - Item item = mc.player.getInventory().main.get(i).getItem(); + ItemStack item = mc.player.getInventory().main.get(i); - if (item == Items.ELYTRA) { + if (item.contains(DataComponentTypes.GLIDER)) { equip(i); break; } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/NoRotate.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/NoRotate.java index 9fef97df9d..f6d6340c6d 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/NoRotate.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/NoRotate.java @@ -6,10 +6,10 @@ package meteordevelopment.meteorclient.systems.modules.player; import meteordevelopment.meteorclient.events.packets.PacketEvent; -import meteordevelopment.meteorclient.mixin.PlayerPositionLookS2CPacketAccessor; import meteordevelopment.meteorclient.systems.modules.Categories; import meteordevelopment.meteorclient.systems.modules.Module; import meteordevelopment.orbit.EventHandler; +import net.minecraft.entity.player.PlayerPosition; import net.minecraft.network.packet.s2c.play.PlayerPositionLookS2CPacket; public class NoRotate extends Module { @@ -19,9 +19,19 @@ public NoRotate() { @EventHandler private void onReceivePacket(PacketEvent.Receive event) { - if (event.packet instanceof PlayerPositionLookS2CPacket) { - ((PlayerPositionLookS2CPacketAccessor) event.packet).setPitch(mc.player.getPitch()); - ((PlayerPositionLookS2CPacketAccessor) event.packet).setYaw(mc.player.getYaw()); + if (event.packet instanceof PlayerPositionLookS2CPacket packet) { + PlayerPosition oldPosition = packet.change(); + PlayerPosition newPosition = new PlayerPosition( + oldPosition.position(), + oldPosition.deltaMovement(), + mc.player.getYaw(), + mc.player.getPitch() + ); + event.packet = PlayerPositionLookS2CPacket.of( + packet.teleportId(), + newPosition, + packet.relatives() + ); } } } 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 007dd87da3..15d4b450e6 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/BetterTooltips.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/BetterTooltips.java @@ -28,9 +28,11 @@ import net.minecraft.entity.Bucketable; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; +import net.minecraft.entity.SpawnReason; import net.minecraft.entity.effect.StatusEffectInstance; import net.minecraft.entity.effect.StatusEffectUtil; import net.minecraft.item.*; +import net.minecraft.item.consume.ApplyEffectsConsumeEffect; import net.minecraft.registry.RegistryKeys; import net.minecraft.text.MutableText; import net.minecraft.text.RawFilteredPair; @@ -269,9 +271,13 @@ private void appendTooltip(ItemStackTooltipEvent event) { } } } else { - FoodComponent food = event.itemStack().get(DataComponentTypes.FOOD); - if (food != null) { - food.effects().forEach(e -> event.appendStart(getStatusText(e.effect()))); + ConsumableComponent consumable = event.itemStack().get(DataComponentTypes.CONSUMABLE); + if (consumable != null) { + consumable.onConsumeEffects().stream() + .filter(ApplyEffectsConsumeEffect.class::isInstance) + .map(ApplyEffectsConsumeEffect.class::cast) + .flatMap(apply -> apply.effects().stream()) + .forEach(effect -> event.appendStart(getStatusText(effect))); } } } @@ -295,7 +301,7 @@ private void appendTooltip(ItemStackTooltipEvent event) { // Item size tooltip if (byteSize.get()) { try { - event.itemStack().encode(mc.player.getRegistryManager()).write(ByteCountDataOutput.INSTANCE); + event.itemStack().toNbt(mc.player.getRegistryManager()).write(ByteCountDataOutput.INSTANCE); int byteCount = ByteCountDataOutput.INSTANCE.getCount(); String count; @@ -356,7 +362,7 @@ else if (event.itemStack.getItem() instanceof BannerItem && previewBanners()) { // Fish peek else if (event.itemStack.getItem() instanceof EntityBucketItem bucketItem && previewEntities()) { EntityType type = ((EntityBucketItemAccessor) bucketItem).getEntityType(); - Entity entity = type.create(mc.world); + Entity entity = type.create(mc.world, SpawnReason.NATURAL); if (entity != null) { ((Bucketable) entity).copyDataFromNbt(event.itemStack.get(DataComponentTypes.BUCKET_ENTITY_DATA).copyNbt()); ((EntityAccessor) entity).setInWater(true); @@ -397,14 +403,14 @@ public void applyCompactShulkerTooltip(ItemStack shulkerItem, List tooltip private void appendPreviewTooltipText(ItemStackTooltipEvent event, boolean spacer) { if (!isPressed() && ( shulkers.get() && Utils.hasItems(event.itemStack()) - || (event.itemStack().getItem() == Items.ENDER_CHEST && echest.get()) - || (event.itemStack().getItem() == Items.FILLED_MAP && maps.get()) - || (event.itemStack().getItem() == Items.WRITABLE_BOOK && books.get()) - || (event.itemStack().getItem() == Items.WRITTEN_BOOK && books.get()) - || (event.itemStack().getItem() instanceof EntityBucketItem && entitiesInBuckets.get()) - || (event.itemStack().getItem() instanceof BannerItem && banners.get()) - || (event.itemStack().getItem() instanceof BannerPatternItem && banners.get()) - || (event.itemStack().getItem() == Items.SHIELD && banners.get()) + || (event.itemStack().getItem() == Items.ENDER_CHEST && echest.get()) + || (event.itemStack().getItem() == Items.FILLED_MAP && maps.get()) + || (event.itemStack().getItem() == Items.WRITABLE_BOOK && books.get()) + || (event.itemStack().getItem() == Items.WRITTEN_BOOK && books.get()) + || (event.itemStack().getItem() instanceof EntityBucketItem && entitiesInBuckets.get()) + || (event.itemStack().getItem() instanceof BannerItem && banners.get()) + || (event.itemStack().getItem() instanceof BannerPatternItem && banners.get()) + || (event.itemStack().getItem() == Items.SHIELD && banners.get()) )) { // we don't want to add the spacer if the tooltip is hidden if (spacer) event.appendEnd(Text.literal("")); @@ -430,8 +436,7 @@ private Text getFirstPage(ItemStack bookItem) { if (pages.isEmpty()) return null; return Text.literal(pages.getFirst().get(false)); - } - else if (bookItem.get(DataComponentTypes.WRITTEN_BOOK_CONTENT) != null) { + } else if (bookItem.get(DataComponentTypes.WRITTEN_BOOK_CONTENT) != null) { List> pages = bookItem.get(DataComponentTypes.WRITTEN_BOOK_CONTENT).pages(); if (pages.isEmpty()) return null; @@ -443,7 +448,7 @@ else if (bookItem.get(DataComponentTypes.WRITTEN_BOOK_CONTENT) != null) { private BannerPatternsComponent createBannerPatternsComponent(BannerPatternItem item) { // I can't imagine getting the banner pattern from a banner pattern item would fail without some serious messing around - return new BannerPatternsComponent.Builder().add(mc.player.getRegistryManager().getWrapperOrThrow(RegistryKeys.BANNER_PATTERN).getOrThrow(item.getPattern()).get(0), DyeColor.WHITE).build(); + return new BannerPatternsComponent.Builder().add(mc.player.getRegistryManager().getOrThrow(RegistryKeys.BANNER_PATTERN).getOrThrow(item.getPattern()).get(0), DyeColor.WHITE).build(); } private BannerTooltipComponent createBannerFromShield(ItemStack shieldItem) { diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Blur.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Blur.java index 5ecef03d49..2ef5770dcb 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Blur.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Blur.java @@ -190,7 +190,7 @@ private void onRenderAfterWorld() { // Render output MinecraftClient.getInstance().getFramebuffer().beginWrite(true); shaderPassthrough.bind(); - GL.bindTexture(fbos[0].texture); + GL.getTexture(fbos[0].texture); shaderPassthrough.set("uTexture", 0); PostProcessRenderer.render(); @@ -208,7 +208,7 @@ private void renderToFbo(Framebuffer targetFbo, int sourceText, Shader shader, d targetFbo.bind(); targetFbo.setViewport(); shader.bind(); - GL.bindTexture(sourceText); + GL.getTexture(sourceText); shader.set("uTexture", 0); shader.set("uHalfTexelSize", .5 / targetFbo.width, .5 / targetFbo.height); shader.set("uOffset", offset); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Chams.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Chams.java index 1d2bcbef5a..959e8b1969 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Chams.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Chams.java @@ -29,6 +29,7 @@ public class Chams extends Module { public final Setting>> entities = sgThroughWalls.add(new EntityTypeListSetting.Builder() .name("entities") .description("Select entities to show through walls.") + .onlyAttackable() .build() ); @@ -142,54 +143,14 @@ public class Chams extends Module { .build() ); - public final Setting renderCore = sgCrystals.add(new BoolSetting.Builder() - .name("render-core") - .description("Enables rendering of the core of the crystal.") - .defaultValue(false) - .visible(crystals::get) - .build() - ); - - public final Setting crystalsCoreColor = sgCrystals.add(new ColorSetting.Builder() - .name("core-color") - .description("The color of the core of the crystal.") - .defaultValue(new SettingColor(198, 135, 254, 255)) - .visible(() -> crystals.get() && renderCore.get()) - .build() - ); - - public final Setting renderFrame1 = sgCrystals.add(new BoolSetting.Builder() - .name("render-inner-frame") - .description("Enables rendering of the inner frame of the crystal.") - .defaultValue(true) - .visible(crystals::get) - .build() - ); - - public final Setting crystalsFrame1Color = sgCrystals.add(new ColorSetting.Builder() - .name("inner-frame-color") - .description("The color of the inner frame of the crystal.") + public final Setting crystalsColor = sgCrystals.add(new ColorSetting.Builder() + .name("crystal-color") + .description("The color of the of the crystal.") .defaultValue(new SettingColor(198, 135, 254, 255)) - .visible(() -> crystals.get() && renderFrame1.get()) - .build() - ); - - public final Setting renderFrame2 = sgCrystals.add(new BoolSetting.Builder() - .name("render-outer-frame") - .description("Enables rendering of the outer frame of the crystal.") - .defaultValue(true) .visible(crystals::get) .build() ); - public final Setting crystalsFrame2Color = sgCrystals.add(new ColorSetting.Builder() - .name("outer-frame-color") - .description("The color of the outer frame of the crystal.") - .defaultValue(new SettingColor(198, 135, 254, 255)) - .visible(() -> crystals.get() && renderFrame2.get()) - .build() - ); - // Hand public final Setting hand = sgHand.add(new BoolSetting.Builder() @@ -222,7 +183,7 @@ public Chams() { } public boolean shouldRender(Entity entity) { - return isActive() && !isShader() && entities.get().contains(entity.getType()) && (entity != mc.player || ignoreSelfDepth.get()); + return isActive() && !isShader() && entities.get().contains(entity.getType()) && (entity != mc.player || !ignoreSelfDepth.get()); } public boolean isShader() { diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/ItemPhysics.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/ItemPhysics.java index d4e96dfc00..8dc6b2914a 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/ItemPhysics.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/ItemPhysics.java @@ -15,15 +15,14 @@ import meteordevelopment.meteorclient.systems.modules.Module; import meteordevelopment.orbit.EventHandler; import net.minecraft.client.render.OverlayTexture; -import net.minecraft.client.render.item.ItemRenderer; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.BakedQuad; -import net.minecraft.client.render.model.json.ModelTransformationMode; import net.minecraft.client.render.model.json.Transformation; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.ItemEntity; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; +import net.minecraft.item.ModelTransformationMode; import net.minecraft.util.math.Direction; import net.minecraft.util.math.RotationAxis; import net.minecraft.util.math.random.Random; @@ -53,11 +52,12 @@ private void onRenderItemEntity(RenderItemEntityEvent event) { MatrixStack matrices = event.matrixStack; matrices.push(); - ItemStack itemStack = event.itemEntity.getStack(); - BakedModel model = getModel(event.itemEntity); + ItemStack itemStack = event.renderState.stack; + BakedModel model = event.renderState.model; + if (model == null) return; ModelInfo info = getInfo(model); - random.setSeed(event.itemEntity.getId() * 2365798L); + random.setSeed(itemStack.isEmpty() ? 187 : Item.getRawId(itemStack.getItem()) + itemStack.getDamage()); applyTransformation(matrices, model); matrices.translate(0, info.offsetY, 0); @@ -159,16 +159,6 @@ private void preventZFighting(MatrixStack matrices, ItemEntity entity) { matrices.translate(0, offset, 0); } - private BakedModel getModel(ItemEntity entity) { - ItemStack itemStack = entity.getStack(); - - // Mojang be like - if (itemStack.isOf(Items.TRIDENT)) return mc.getItemRenderer().getModels().getModelManager().getModel(ItemRenderer.TRIDENT); - if (itemStack.isOf(Items.SPYGLASS)) return mc.getItemRenderer().getModels().getModelManager().getModel(ItemRenderer.SPYGLASS); - - return mc.getItemRenderer().getModel(itemStack, entity.getWorld(), null, entity.getId()); - } - private ModelInfo getInfo(BakedModel model) { Random random = Random.createLocal(); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/PopChams.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/PopChams.java index 7a16a377ff..98a3496962 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/PopChams.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/PopChams.java @@ -139,7 +139,7 @@ public boolean render(Render3DEvent event) { // Y Modifier lastRenderY = getY(); - ((IVec3d) getPos()).setY(getY() + yModifier.get() * event.frameTime); + ((IVec3d) getPos()).meteor$setY(getY() + yModifier.get() * event.frameTime); // Scale Modifier scale += scaleModifier.get() * event.frameTime; @@ -149,8 +149,8 @@ public boolean render(Render3DEvent event) { int preLineA = lineColor.get().a; if (fadeOut.get()) { - sideColor.get().a *= 1 - timer / renderTime.get(); - lineColor.get().a *= 1 - timer / renderTime.get(); + sideColor.get().a *= (int) (1 - timer / renderTime.get()); + lineColor.get().a *= (int) (1 - timer / renderTime.get()); } // Render diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/StorageESP.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/StorageESP.java index 667942491e..2cdbe1965a 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/StorageESP.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/StorageESP.java @@ -210,9 +210,7 @@ public WWidget getWidget(GuiTheme theme) { // Button to Clear Interacted Blocks WButton clear = list.add(theme.button("Clear Rendering Cache")).expandX().widget(); - clear.action = () -> { - interactedBlocks.clear(); - }; + clear.action = interactedBlocks::clear; return list; } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/TimeChanger.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/TimeChanger.java index c7b8a1a993..ae9682e878 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/TimeChanger.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/TimeChanger.java @@ -39,19 +39,19 @@ public void onActivate() { @Override public void onDeactivate() { - mc.world.setTimeOfDay(oldTime); + mc.world.getLevelProperties().setTimeOfDay(oldTime); } @EventHandler private void onPacketReceive(PacketEvent.Receive event) { if (event.packet instanceof WorldTimeUpdateS2CPacket) { - oldTime = ((WorldTimeUpdateS2CPacket) event.packet).getTime(); + oldTime = ((WorldTimeUpdateS2CPacket) event.packet).time(); // should this be time or timeOfDay? event.cancel(); } } @EventHandler private void onTick(TickEvent.Post event) { - mc.world.setTimeOfDay(time.get().longValue()); + mc.world.getLevelProperties().setTimeOfDay(time.get().longValue()); } } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Tracers.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Tracers.java index e227505bf9..9167c14ea6 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Tracers.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Tracers.java @@ -211,7 +211,7 @@ public enum TracerStyle { ); private int count; - private Instant initTimer = Instant.now(); + private final Instant initTimer = Instant.now(); public Tracers() { super(Categories.Render, "tracers", "Displays tracer lines to specified entities."); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/UnfocusedCPU.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/UnfocusedCPU.java deleted file mode 100644 index 27644101a5..0000000000 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/UnfocusedCPU.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). - * Copyright (c) Meteor Development. - */ - -package meteordevelopment.meteorclient.systems.modules.render; - -import meteordevelopment.meteorclient.settings.IntSetting; -import meteordevelopment.meteorclient.settings.Setting; -import meteordevelopment.meteorclient.settings.SettingGroup; -import meteordevelopment.meteorclient.systems.modules.Categories; -import meteordevelopment.meteorclient.systems.modules.Module; - -public class UnfocusedCPU extends Module { - private final SettingGroup sgGeneral = this.settings.getDefaultGroup(); - - public final Setting fps = sgGeneral.add(new IntSetting.Builder() - .name("target-fps") - .description("Target FPS to set as the limit when the window is not focused.") - .min(1) - .defaultValue(1) - .sliderRange(1, 20) - .build() - ); - - public UnfocusedCPU() { - super(Categories.Render, "unfocused-cpu", "Limits FPS when your Minecraft window is not focused."); - } -} diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Xray.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Xray.java index 1b33af413c..4664987c29 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Xray.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Xray.java @@ -24,7 +24,6 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; import java.util.List; @@ -101,16 +100,18 @@ private void onAmbientOcclusion(AmbientOcclusionEvent event) { event.lightLevel = 1; } - public boolean modifyDrawSide(BlockState state, BlockView view, BlockPos pos, Direction facing, boolean returns) { - if (!returns && !isBlocked(state.getBlock(), pos)) { - BlockPos adjPos = pos.offset(facing); - BlockState adjState = view.getBlockState(adjPos); - return adjState.getCullingFace(view, adjPos, facing.getOpposite()) != VoxelShapes.fullCube() || adjState.getBlock() != state.getBlock() || BlockUtils.isExposed(adjPos); + public boolean modifyDrawSide(BlockState state, BlockState otherState, Direction facing, boolean returns) { + if (!returns && !isBlocked(state, otherState)) { + return otherState.getCullingFace(facing.getOpposite()) != VoxelShapes.fullCube() || otherState.getBlock() != state.getBlock() || !otherState.isOpaque(); } return returns; } + public boolean isBlocked(BlockState state, BlockState otherState) { + return !(blocks.get().contains(state.getBlock()) && (!exposedOnly.get() || !otherState.isOpaque())); + } + public boolean isBlocked(Block block, BlockPos blockPos) { return !(blocks.get().contains(block) && (!exposedOnly.get() || (blockPos == null || BlockUtils.isExposed(blockPos)))); } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Ambience.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Ambience.java index d4c7392561..e40c72d4d9 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Ambience.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Ambience.java @@ -194,11 +194,6 @@ public Vec3d adjustFogColor(Vec3d color, float sunHeight) { public boolean useThickFog(int camX, int camY) { return false; } - - @Override - public float[] getFogColorOverride(float skyAngle, float tickDelta) { - return null; - } } public SettingColor skyColor() { diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/AutoSmelter.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/AutoSmelter.java index 4c6fd693f4..80c600eeeb 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/AutoSmelter.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/AutoSmelter.java @@ -14,16 +14,13 @@ import meteordevelopment.meteorclient.systems.modules.Module; import meteordevelopment.meteorclient.utils.Utils; import meteordevelopment.meteorclient.utils.player.InvUtils; -import net.minecraft.block.entity.AbstractFurnaceBlockEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; -import net.minecraft.recipe.RecipeType; -import net.minecraft.recipe.input.SingleStackRecipeInput; +import net.minecraft.recipe.RecipePropertySet; import net.minecraft.screen.AbstractFurnaceScreenHandler; import java.util.List; -import java.util.Map; public class AutoSmelter extends Module { private final SettingGroup sgGeneral = settings.getDefaultGroup(); @@ -53,21 +50,18 @@ public class AutoSmelter extends Module { .build() ); - private Map fuelTimeMap; - public AutoSmelter() { super(Categories.World, "auto-smelter", "Automatically smelts items from your inventory"); } private boolean fuelItemFilter(Item item) { - if (!Utils.canUpdate() && fuelTimeMap == null) return false; + if (!Utils.canUpdate()) return false; - if (fuelTimeMap == null) fuelTimeMap = AbstractFurnaceBlockEntity.createFuelTimeMap(); - return fuelTimeMap.containsKey(item); + return mc.getNetworkHandler().getFuelRegistry().getFuelItems().contains(item); } private boolean smeltableItemFilter(Item item) { - return mc.world != null && mc.world.getRecipeManager().getFirstMatch(RecipeType.SMELTING, new SingleStackRecipeInput(item.getDefaultStack()), mc.world).isPresent(); + return mc.world != null && mc.world.getRecipeManager().getPropertySet(RecipePropertySet.FURNACE_INPUT).canUse(item.getDefaultStack()); } public void tick(AbstractFurnaceScreenHandler c) { @@ -92,7 +86,7 @@ private void insertItems(AbstractFurnaceScreenHandler c) { for (int i = 3; i < c.slots.size(); i++) { ItemStack item = c.slots.get(i).getStack(); - if (!((IAbstractFurnaceScreenHandler) c).isItemSmeltable(item)) continue; + if (!((IAbstractFurnaceScreenHandler) c).meteor$isItemSmeltable(item)) continue; if (!smeltableItems.get().contains(item.getItem())) continue; if (!smeltableItemFilter(item.getItem())) continue; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/BuildHeight.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/BuildHeight.java index 78e5ce6e37..f0649003ee 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/BuildHeight.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/BuildHeight.java @@ -22,7 +22,7 @@ public BuildHeight() { private void onSendPacket(PacketEvent.Send event) { if (!(event.packet instanceof PlayerInteractBlockC2SPacket p)) return; if (mc.world == null) return; - if (p.getBlockHitResult().getPos().y >= mc.world.getTopY() && p.getBlockHitResult().getSide() == Direction.UP) { + if (p.getBlockHitResult().getPos().y >= mc.world.getHeight() && p.getBlockHitResult().getSide() == Direction.UP) { ((BlockHitResultAccessor) p.getBlockHitResult()).setSide(Direction.DOWN); } } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Collisions.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Collisions.java index 49ae4a1f6b..8d4b50bbe9 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Collisions.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Collisions.java @@ -76,7 +76,7 @@ private void onPlayerMove(PlayerMoveEvent event) { int x = (int) (mc.player.getX() + event.movement.x) >> 4; int z = (int) (mc.player.getZ() + event.movement.z) >> 4; if (unloadedChunks.get() && !mc.world.getChunkManager().isChunkLoaded(x, z)) { - ((IVec3d) event.movement).set(0, event.movement.y, 0); + ((IVec3d) event.movement).meteor$set(0, event.movement.y, 0); } } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/HighwayBuilder.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/HighwayBuilder.java index fdb0a1d6d3..3c8ce67824 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/HighwayBuilder.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/HighwayBuilder.java @@ -537,28 +537,28 @@ protected void tick(HighwayBuilder b) { b.mc.player.setYaw(0); if (!isZ) { - b.input.pressingForward = z < 0; - b.input.pressingBack = z > 0; + b.input.forward(z < 0); + b.input.backward(z > 0); if (b.mc.player.getZ() < 0) { - boolean forward = b.input.pressingForward; - b.input.pressingForward = b.input.pressingBack; - b.input.pressingBack = forward; + boolean forward = b.input.playerInput.forward(); + b.input.forward(b.input.playerInput.backward()); + b.input.backward(forward); } } if (!isX) { - b.input.pressingRight = x > 0; - b.input.pressingLeft = x < 0; + b.input.right(x > 0); + b.input.left(x < 0); if (b.mc.player.getX() < 0) { - boolean right = b.input.pressingRight; - b.input.pressingRight = b.input.pressingLeft; - b.input.pressingLeft = right; + boolean right = b.input.playerInput.right(); + b.input.right(b.input.playerInput.left()); + b.input.left(right); } } - b.input.sneaking = true; + b.input.sneak(true); } } }, @@ -575,7 +575,7 @@ protected void start(HighwayBuilder b) { protected void tick(HighwayBuilder b) { checkTasks(b); - if (b.state == Forward) b.input.pressingForward = true; // Move + if (b.state == Forward) b.input.forward(true); // Move } private void checkTasks(HighwayBuilder b) { @@ -809,7 +809,7 @@ protected void tick(HighwayBuilder b) { // Move if (moveTimer > 0) { b.mc.player.setYaw(dir.yaw); - b.input.pressingForward = moveTimer > 2; + b.input.forward(moveTimer > 2); moveTimer--; return; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/MountBypass.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/MountBypass.java index 7144abbc82..f4b33af72b 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/MountBypass.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/MountBypass.java @@ -28,7 +28,7 @@ public void onSendPacket(PacketEvent.Send event) { } if (event.packet instanceof IPlayerInteractEntityC2SPacket packet) { - if (packet.getType() == PlayerInteractEntityC2SPacket.InteractType.INTERACT_AT && packet.getEntity() instanceof AbstractDonkeyEntity) event.cancel(); + if (packet.meteor$getType() == PlayerInteractEntityC2SPacket.InteractType.INTERACT_AT && packet.meteor$getEntity() instanceof AbstractDonkeyEntity) event.cancel(); } } } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/proxies/Proxy.java b/src/main/java/meteordevelopment/meteorclient/systems/proxies/Proxy.java index 194b759235..90cb4868b7 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/proxies/Proxy.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/proxies/Proxy.java @@ -11,7 +11,6 @@ import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtElement; -import java.net.InetSocketAddress; import java.util.Objects; public class Proxy implements ISerializable { @@ -78,12 +77,7 @@ public Proxy(NbtElement tag) { } public boolean resolveAddress() { - int port = this.port.get(); - String address = this.address.get(); - - if (port <= 0 || port > 65535 || address == null || address.isBlank()) return false; - InetSocketAddress socketAddress = new InetSocketAddress(address, port); - return !socketAddress.isUnresolved(); + return Utils.resolveAddress(this.address.get(), this.port.get()); } public static class Builder { diff --git a/src/main/java/meteordevelopment/meteorclient/systems/waypoints/Waypoint.java b/src/main/java/meteordevelopment/meteorclient/systems/waypoints/Waypoint.java index f09e53cde1..4f1464d102 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/waypoints/Waypoint.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/waypoints/Waypoint.java @@ -116,7 +116,7 @@ public void renderIcon(double x, double y, double a, double size) { int preA = color.get().a; color.get().a *= a; - GL.bindTexture(texture.getGlId()); + GL.getTexture(texture.getGlId()); Renderer2D.TEXTURE.begin(); Renderer2D.TEXTURE.texQuad(x, y, size, size, color.get()); Renderer2D.TEXTURE.render(null); diff --git a/src/main/java/meteordevelopment/meteorclient/utils/Utils.java b/src/main/java/meteordevelopment/meteorclient/utils/Utils.java index a0d2b70d67..41ed0574d0 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/Utils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/Utils.java @@ -5,8 +5,8 @@ package meteordevelopment.meteorclient.utils; +import com.mojang.blaze3d.systems.ProjectionType; import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.systems.VertexSorter; import it.unimi.dsi.fastutil.objects.*; import meteordevelopment.meteorclient.MeteorClient; import meteordevelopment.meteorclient.events.world.TickEvent; @@ -82,7 +82,6 @@ public class Utils { public static boolean rendering3D = true; public static double frameTime; public static Screen screenToOpen; - public static VertexSorter vertexSorter; private Utils() { } @@ -210,13 +209,12 @@ public static int getWindowHeight() { } public static void unscaledProjection() { - vertexSorter = RenderSystem.getVertexSorting(); - RenderSystem.setProjectionMatrix(new Matrix4f().setOrtho(0, mc.getWindow().getFramebufferWidth(), mc.getWindow().getFramebufferHeight(), 0, 1000, 21000), VertexSorter.BY_Z); + RenderSystem.setProjectionMatrix(new Matrix4f().setOrtho(0, mc.getWindow().getFramebufferWidth(), mc.getWindow().getFramebufferHeight(), 0, 1000, 21000), ProjectionType.ORTHOGRAPHIC); rendering3D = false; } public static void scaledProjection() { - RenderSystem.setProjectionMatrix(new Matrix4f().setOrtho(0, (float) (mc.getWindow().getFramebufferWidth() / mc.getWindow().getScaleFactor()), (float) (mc.getWindow().getFramebufferHeight() / mc.getWindow().getScaleFactor()), 0, 1000, 21000), vertexSorter); + RenderSystem.setProjectionMatrix(new Matrix4f().setOrtho(0, (float) (mc.getWindow().getFramebufferWidth() / mc.getWindow().getScaleFactor()), (float) (mc.getWindow().getFramebufferHeight() / mc.getWindow().getScaleFactor()), 0, 1000, 21000), ProjectionType.PERSPECTIVE); rendering3D = true; } @@ -519,7 +517,7 @@ public static void leftClick() { } public static void rightClick() { - ((IMinecraftClient) mc).meteor_client$rightClick(); + ((IMinecraftClient) mc).meteor$rightClick(); } public static boolean isShulker(Item item) { diff --git a/src/main/java/meteordevelopment/meteorclient/utils/entity/DamageUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/entity/DamageUtils.java index e9bacbe6c9..e0665fd8fa 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/entity/DamageUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/entity/DamageUtils.java @@ -26,6 +26,7 @@ import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.registry.tag.DamageTypeTags; import net.minecraft.registry.tag.EntityTypeTags; +import net.minecraft.server.world.ServerWorld; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.HitResult; import net.minecraft.util.math.*; @@ -73,7 +74,7 @@ public static float anchorDamage(LivingEntity target, Vec3d targetPos, Box targe /** * Low level control of parameters without having to reimplement everything, for addon authors who wish to use their * own predictions or other systems. - * @see net.minecraft.world.explosion.ExplosionBehavior#calculateDamage(Explosion, Entity) + * @see net.minecraft.world.explosion.ExplosionBehavior#calculateDamage(Explosion, Entity, float) */ public static float explosionDamage(LivingEntity target, Vec3d targetPos, Box targetBox, Vec3d explosionPos, float power, RaycastFactory raycastFactory) { double modDistance = PlayerUtils.distance(targetPos.x, targetPos.y, targetPos.z, explosionPos.x, explosionPos.y, explosionPos.z); @@ -143,7 +144,7 @@ public static RaycastFactory getOverridingHitFactory(BlockPos overridePos, Block * @see PlayerEntity#attack(Entity) */ public static float getAttackDamage(LivingEntity attacker, LivingEntity target) { - float itemDamage = (float) attacker.getAttributeValue(EntityAttributes.GENERIC_ATTACK_DAMAGE); + float itemDamage = (float) attacker.getAttributeValue(EntityAttributes.ATTACK_DAMAGE); DamageSource damageSource = attacker instanceof PlayerEntity player ? mc.world.getDamageSources().playerAttack(player) : mc.world.getDamageSources().mobAttack(attacker); float damage = modifyAttackDamage(attacker, target, attacker.getWeaponStack(), damageSource, itemDamage); @@ -151,8 +152,8 @@ public static float getAttackDamage(LivingEntity attacker, LivingEntity target) } public static float getAttackDamage(LivingEntity attacker, LivingEntity target, ItemStack weapon) { - EntityAttributeInstance original = attacker.getAttributeInstance(EntityAttributes.GENERIC_ATTACK_DAMAGE); - EntityAttributeInstance copy = new EntityAttributeInstance(EntityAttributes.GENERIC_ATTACK_DAMAGE, o -> {}); + EntityAttributeInstance original = attacker.getAttributeInstance(EntityAttributes.ATTACK_DAMAGE); + EntityAttributeInstance copy = new EntityAttributeInstance(EntityAttributes.ATTACK_DAMAGE, o -> {}); copy.setBaseValue(original.getBaseValue()); for (EntityAttributeModifier modifier : original.getModifiers()) { @@ -163,7 +164,7 @@ public static float getAttackDamage(LivingEntity attacker, LivingEntity target, AttributeModifiersComponent attributeModifiers = weapon.get(DataComponentTypes.ATTRIBUTE_MODIFIERS); if (attributeModifiers != null) { attributeModifiers.applyModifiers(EquipmentSlot.MAINHAND, (entry, modifier) -> { - if (entry == EntityAttributes.GENERIC_ATTACK_DAMAGE) copy.updateModifier(modifier); + if (entry == EntityAttributes.ATTACK_DAMAGE) copy.updateModifier(modifier); }); } @@ -227,7 +228,7 @@ private static float modifyAttackDamage(LivingEntity attacker, LivingEntity targ // Fall Damage /** - * @see LivingEntity#computeFallDamage(float, float) (float, float, DamageSource) + * @see LivingEntity#computeFallDamage(float, float) */ public static float fallDamage(LivingEntity entity) { if (entity instanceof PlayerEntity player && player.getAbilities().flying) return 0f; @@ -255,7 +256,7 @@ private static float fallDamageReductions(LivingEntity entity, int surface) { // Utils /** - * @see LivingEntity#applyDamage(DamageSource, float) + * @see LivingEntity#applyDamage(ServerWorld, DamageSource, float) */ public static float calculateReductions(float damage, LivingEntity entity, DamageSource damageSource) { if (damageSource.isScaledWithDifficulty()) { @@ -266,7 +267,7 @@ public static float calculateReductions(float damage, LivingEntity entity, Damag } // Armor reduction - damage = DamageUtil.getDamageLeft(entity, damage, damageSource, getArmor(entity), (float) entity.getAttributeValue(EntityAttributes.GENERIC_ARMOR_TOUGHNESS)); + damage = DamageUtil.getDamageLeft(entity, damage, damageSource, getArmor(entity), (float) entity.getAttributeValue(EntityAttributes.ARMOR_TOUGHNESS)); // Resistance reduction damage = resistanceReduction(entity, damage); @@ -278,7 +279,7 @@ public static float calculateReductions(float damage, LivingEntity entity, Damag } private static float getArmor(LivingEntity entity) { - return (float) Math.floor(entity.getAttributeValue(EntityAttributes.GENERIC_ARMOR)); + return (float) Math.floor(entity.getAttributeValue(EntityAttributes.ARMOR)); } /** @@ -336,7 +337,7 @@ private static float resistanceReduction(LivingEntity player, float damage) { } /** - * @see Explosion#getExposure(Vec3d, Entity) + * @see net.minecraft.world.explosion.ExplosionImpl#calculateReceivedDamage(Vec3d, Entity) */ private static float getExposure(Vec3d source, Box box, RaycastFactory raycastFactory) { double xDiff = box.maxX - box.minX; diff --git a/src/main/java/meteordevelopment/meteorclient/utils/entity/EntityUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/entity/EntityUtils.java index 6d74ed13f8..30d622c802 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/entity/EntityUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/entity/EntityUtils.java @@ -23,6 +23,8 @@ import net.minecraft.entity.EntityType; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.vehicle.BoatEntity; +import net.minecraft.entity.vehicle.ChestBoatEntity; import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluids; import net.minecraft.util.math.BlockPos; @@ -41,7 +43,7 @@ import static meteordevelopment.meteorclient.MeteorClient.mc; public class EntityUtils { - private static BlockPos.Mutable testPos = new BlockPos.Mutable(); + private static final BlockPos.Mutable testPos = new BlockPos.Mutable(); private EntityUtils() { } @@ -51,7 +53,7 @@ public static boolean isAttackable(EntityType type) { } public static boolean isRideable(EntityType type) { - return type == EntityType.MINECART || type == EntityType.BOAT || type == EntityType.CAMEL || type == EntityType.DONKEY || type == EntityType.HORSE || type == EntityType.LLAMA || type == EntityType.MULE || type == EntityType.PIG || type == EntityType.SKELETON_HORSE || type == EntityType.STRIDER || type == EntityType.ZOMBIE_HORSE; + return type == EntityType.MINECART || BoatEntity.class.isAssignableFrom(type.getBaseClass()) || ChestBoatEntity.class.isAssignableFrom(type.getBaseClass()) || type == EntityType.CAMEL || type == EntityType.DONKEY || type == EntityType.HORSE || type == EntityType.LLAMA || type == EntityType.MULE || type == EntityType.PIG || type == EntityType.SKELETON_HORSE || type == EntityType.STRIDER || type == EntityType.ZOMBIE_HORSE; } public static float getTotalHealth(LivingEntity target) { diff --git a/src/main/java/meteordevelopment/meteorclient/utils/entity/ProjectileEntitySimulator.java b/src/main/java/meteordevelopment/meteorclient/utils/entity/ProjectileEntitySimulator.java index 9193f56459..a50a77bbab 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/entity/ProjectileEntitySimulator.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/entity/ProjectileEntitySimulator.java @@ -136,7 +136,7 @@ public void set(Entity user, double roll, double speed, double simulated, double public boolean set(Entity entity, boolean accurate) { // skip entities in ground - if (entity instanceof ProjectileInGroundAccessor ppe && ppe.getInGround()) return false; + if (entity instanceof ProjectileInGroundAccessor ppe && ppe.invokeIsInGround()) return false; if (entity instanceof ArrowEntity) { set(entity, 0.05, 0.6, accurate); @@ -221,7 +221,7 @@ public void setFishingBobber(Entity user, float tickDelta) { public HitResult tick() { // Apply velocity - ((IVec3d) prevPos3d).set(pos); + ((IVec3d) prevPos3d).meteor$set(pos); pos.add(velocity); // Update velocity @@ -237,7 +237,7 @@ public HitResult tick() { if (!mc.world.getChunkManager().isChunkLoaded(chunkX, chunkZ)) return MissHitResult.INSTANCE; // Check for collision - ((IVec3d) pos3d).set(pos); + ((IVec3d) pos3d).meteor$set(pos); if (pos3d.equals(prevPos3d)) return MissHitResult.INSTANCE; HitResult hitResult = getCollision(); @@ -257,7 +257,7 @@ private boolean isTouchingWater() { private HitResult getCollision() { HitResult hitResult = mc.world.raycast(new RaycastContext(prevPos3d, pos3d, RaycastContext.ShapeType.COLLIDER, waterDrag == 0 ? RaycastContext.FluidHandling.ANY : RaycastContext.FluidHandling.NONE, simulatingEntity)); if (hitResult.getType() != HitResult.Type.MISS) { - ((IVec3d) pos3d).set(hitResult.getPos().x, hitResult.getPos().y, hitResult.getPos().z); + ((IVec3d) pos3d).meteor$set(hitResult.getPos().x, hitResult.getPos().y, hitResult.getPos().z); } // Vanilla uses the current and next positions to check collisions, we use the previous and current positions diff --git a/src/main/java/meteordevelopment/meteorclient/utils/entity/TargetUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/entity/TargetUtils.java index b0426d1fd7..bf852e0823 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/entity/TargetUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/entity/TargetUtils.java @@ -51,7 +51,9 @@ public static void getList(List targetList, Predicate isGood, So targetList.sort(sortPriority); // fast list trimming - for (int i = targetList.size() - 1; i >= maxCount; i--) targetList.remove(i); + if (targetList.size() > maxCount) { + targetList.subList(maxCount, targetList.size()).clear(); + } } @Nullable diff --git a/src/main/java/meteordevelopment/meteorclient/utils/files/StreamUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/files/StreamUtils.java index 17f76be0ab..d1e869da8e 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/files/StreamUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/files/StreamUtils.java @@ -27,7 +27,7 @@ public static void copy(InputStream in, File to) { try (OutputStream out = new FileOutputStream(to)) { in.transferTo(out); } catch (IOException e) { - MeteorClient.LOG.error("Error writing to file '%s'.".formatted(to.getName())); + MeteorClient.LOG.error("Error writing to file '{}'.", to.getName()); } finally { IOUtils.closeQuietly(in); } diff --git a/src/main/java/meteordevelopment/meteorclient/utils/misc/FakeClientPlayer.java b/src/main/java/meteordevelopment/meteorclient/utils/misc/FakeClientPlayer.java index 163e09151f..730486be8e 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/misc/FakeClientPlayer.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/misc/FakeClientPlayer.java @@ -44,16 +44,16 @@ public static PlayerEntity getPlayer() { if (player == null || (!id.equals(lastId))) { if (world == null) { world = new ClientWorld( - new ClientPlayNetworkHandler(mc, new ClientConnection(NetworkSide.CLIENTBOUND), new ClientConnectionState(new GameProfile(mc.getSession().getUuidOrNull(), mc.getSession().getUsername()), null, null, null, null, mc.getCurrentServerEntry(), null, null, null, false, null, null)), + new ClientPlayNetworkHandler(mc, new ClientConnection(NetworkSide.CLIENTBOUND), new ClientConnectionState(new GameProfile(mc.getSession().getUuidOrNull(), mc.getSession().getUsername()), null, null, null, null, mc.getCurrentServerEntry(), null, null, null, null, null)), new ClientWorld.Properties(Difficulty.NORMAL, false, false), world.getRegistryKey(), world.getDimensionEntry(), 1, 1, - mc::getProfiler, null, false, - 0 + 0, + world.getSeaLevel() ); } diff --git a/src/main/java/meteordevelopment/meteorclient/utils/misc/MeteorStarscript.java b/src/main/java/meteordevelopment/meteorclient/utils/misc/MeteorStarscript.java index 76b4a4d092..15f47d200b 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/misc/MeteorStarscript.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/misc/MeteorStarscript.java @@ -509,10 +509,13 @@ private static Value biome() { if (mc.player == null || mc.world == null) return Value.string(""); BP.set(mc.player.getX(), mc.player.getY(), mc.player.getZ()); - Identifier id = mc.world.getRegistryManager().get(RegistryKeys.BIOME).getId(mc.world.getBiome(BP).value()); - if (id == null) return Value.string("Unknown"); - - return Value.string(Arrays.stream(id.getPath().split("_")).map(StringUtils::capitalize).collect(Collectors.joining(" "))); + return mc.world.getRegistryManager().getOptional(RegistryKeys.BIOME) + .map(biomeRegistry -> { + Identifier id = biomeRegistry.getId(mc.world.getBiome(BP).value()); + if (id == null) return Value.string("Unknown"); + return Value.string(Arrays.stream(id.getPath().split("_")).map(StringUtils::capitalize).collect(Collectors.joining(" "))); + }) + .orElse(Value.string("Unknown")); } private static Value handOrOffhand() { diff --git a/src/main/java/meteordevelopment/meteorclient/utils/misc/Names.java b/src/main/java/meteordevelopment/meteorclient/utils/misc/Names.java index eb569cfc82..0166dd0e6d 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/misc/Names.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/misc/Names.java @@ -88,7 +88,7 @@ public static String get(RegistryKey enchantment) { return enchantmentKeyNames.computeIfAbsent(enchantment, enchantment1 -> Optional.ofNullable(MinecraftClient.getInstance().getNetworkHandler()) .map(ClientPlayNetworkHandler::getRegistryManager) .flatMap(registryManager -> registryManager.getOptional(RegistryKeys.ENCHANTMENT)) - .flatMap(registry -> registry.getEntry(enchantment)) + .flatMap(registry -> registry.getEntry(enchantment.getValue())) .map(Names::get) .orElseGet(() -> { String key = "enchantment." + enchantment1.getValue().toTranslationKey(); diff --git a/src/main/java/meteordevelopment/meteorclient/utils/misc/NbtUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/misc/NbtUtils.java index 28335fadf0..354ee52211 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/misc/NbtUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/misc/NbtUtils.java @@ -60,7 +60,7 @@ public static boolean toClipboard(String name, NbtCompound nbtCompound) { mc.keyboard.setClipboard(Base64.getEncoder().encodeToString(byteArrayOutputStream.toByteArray())); return true; } catch (Exception e) { - MeteorClient.LOG.error(String.format("Error copying %s NBT to clipboard!", name)); + MeteorClient.LOG.error("Error copying {} NBT to clipboard!", name); OkPrompt.create() .title(String.format("Error copying %s NBT to clipboard!", name)) diff --git a/src/main/java/meteordevelopment/meteorclient/utils/misc/text/RunnableClickEvent.java b/src/main/java/meteordevelopment/meteorclient/utils/misc/text/RunnableClickEvent.java index 706b8d1592..edf4c958c1 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/misc/text/RunnableClickEvent.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/misc/text/RunnableClickEvent.java @@ -7,7 +7,6 @@ /** * Allows arbitrary code execution in a click event - * @see */ public class RunnableClickEvent extends MeteorClickEvent { public final Runnable runnable; diff --git a/src/main/java/meteordevelopment/meteorclient/utils/network/Capes.java b/src/main/java/meteordevelopment/meteorclient/utils/network/Capes.java index 5d9926b466..019d95ee0e 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/network/Capes.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/network/Capes.java @@ -48,7 +48,7 @@ public static void init() { MeteorExecutor.execute(() -> { // Cape owners Stream lines = Http.get(CAPE_OWNERS_URL) - .exceptionHandler(e -> MeteorClient.LOG.error("Could not load capes: " + e.getMessage())) + .exceptionHandler(e -> MeteorClient.LOG.error("Could not load capes: {}", e.getMessage())) .sendLines(); if (lines != null) { lines.forEach(s -> { diff --git a/src/main/java/meteordevelopment/meteorclient/utils/network/PacketUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/network/PacketUtils.java index 9a014f2705..dfd7268f60 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/network/PacketUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/network/PacketUtils.java @@ -5,7 +5,6 @@ package meteordevelopment.meteorclient.utils.network; -import com.mojang.datafixers.util.Pair; import com.mojang.serialization.Lifecycle; import it.unimi.dsi.fastutil.objects.Object2ReferenceOpenHashMap; import it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap; @@ -15,11 +14,10 @@ import net.minecraft.registry.RegistryKey; import net.minecraft.registry.SimpleRegistry; import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.registry.entry.RegistryEntryList; -import net.minecraft.registry.tag.TagKey; 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; @@ -39,10 +37,10 @@ public 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.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.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.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"); @@ -67,6 +65,8 @@ public class PacketUtils { 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.BundleItemSelectedC2SPacket.class, "BundleItemSelectedC2SPacket"); + C2S_PACKETS_R.put("BundleItemSelectedC2SPacket", net.minecraft.network.packet.c2s.play.BundleItemSelectedC2SPacket.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"); @@ -149,6 +149,8 @@ public class PacketUtils { C2S_PACKETS_R.put("VehicleMoveC2SPacket", net.minecraft.network.packet.c2s.play.VehicleMoveC2SPacket.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.ClientTickEndC2SPacket.class, "ClientTickEndC2SPacket"); + C2S_PACKETS_R.put("ClientTickEndC2SPacket", net.minecraft.network.packet.c2s.play.ClientTickEndC2SPacket.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.handshake.HandshakeC2SPacket.class, "HandshakeC2SPacket"); @@ -188,6 +190,8 @@ public class PacketUtils { S2C_PACKETS_R.put("RemoveMessageS2CPacket", net.minecraft.network.packet.s2c.play.RemoveMessageS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.SetCameraEntityS2CPacket.class, "SetCameraEntityS2CPacket"); S2C_PACKETS_R.put("SetCameraEntityS2CPacket", net.minecraft.network.packet.s2c.play.SetCameraEntityS2CPacket.class); + S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.EntityPositionSyncS2CPacket.class, "EntityPositionSyncS2CPacket"); + S2C_PACKETS_R.put("EntityPositionSyncS2CPacket", net.minecraft.network.packet.s2c.play.EntityPositionSyncS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.common.ResourcePackSendS2CPacket.class, "ResourcePackSendS2CPacket"); 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"); @@ -198,6 +202,8 @@ public class PacketUtils { S2C_PACKETS_R.put("StatisticsS2CPacket", net.minecraft.network.packet.s2c.play.StatisticsS2CPacket.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.SetCursorItemS2CPacket.class, "SetCursorItemS2CPacket"); + S2C_PACKETS_R.put("SetCursorItemS2CPacket", net.minecraft.network.packet.s2c.play.SetCursorItemS2CPacket.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"); @@ -208,20 +214,28 @@ public class PacketUtils { 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.RecipeBookAddS2CPacket.class, "RecipeBookAddS2CPacket"); + S2C_PACKETS_R.put("RecipeBookAddS2CPacket", net.minecraft.network.packet.s2c.play.RecipeBookAddS2CPacket.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.common.CookieRequestS2CPacket.class, "CookieRequestS2CPacket"); S2C_PACKETS_R.put("CookieRequestS2CPacket", net.minecraft.network.packet.s2c.common.CookieRequestS2CPacket.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.SetPlayerInventoryS2CPacket.class, "SetPlayerInventoryS2CPacket"); + S2C_PACKETS_R.put("SetPlayerInventoryS2CPacket", net.minecraft.network.packet.s2c.play.SetPlayerInventoryS2CPacket.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.PlayerRotationS2CPaket.class, "PlayerRotationS2CPaket"); + S2C_PACKETS_R.put("PlayerRotationS2CPaket", net.minecraft.network.packet.s2c.play.PlayerRotationS2CPaket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.common.StoreCookieS2CPacket.class, "StoreCookieS2CPacket"); S2C_PACKETS_R.put("StoreCookieS2CPacket", net.minecraft.network.packet.s2c.common.StoreCookieS2CPacket.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.MoveMinecartAlongTrackS2CPacket.class, "MoveMinecartAlongTrackS2CPacket"); + S2C_PACKETS_R.put("MoveMinecartAlongTrackS2CPacket", net.minecraft.network.packet.s2c.play.MoveMinecartAlongTrackS2CPacket.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"); @@ -246,14 +260,18 @@ public 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.RecipeBookRemoveS2CPacket.class, "RecipeBookRemoveS2CPacket"); + S2C_PACKETS_R.put("RecipeBookRemoveS2CPacket", net.minecraft.network.packet.s2c.play.RecipeBookRemoveS2CPacket.class); + S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.RecipeBookSettingsS2CPacket.class, "RecipeBookSettingsS2CPacket"); + S2C_PACKETS_R.put("RecipeBookSettingsS2CPacket", net.minecraft.network.packet.s2c.play.RecipeBookSettingsS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.config.ResetChatS2CPacket.class, "ResetChatS2CPacket"); S2C_PACKETS_R.put("ResetChatS2CPacket", net.minecraft.network.packet.s2c.config.ResetChatS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.WorldBorderWarningBlocksChangedS2CPacket.class, "WorldBorderWarningBlocksChangedS2CPacket"); @@ -296,10 +314,10 @@ public 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"); @@ -322,10 +340,10 @@ public class PacketUtils { 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.DebugSampleS2CPacket.class, "DebugSampleS2CPacket"); S2C_PACKETS_R.put("DebugSampleS2CPacket", net.minecraft.network.packet.s2c.play.DebugSampleS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.ChunkBiomeDataS2CPacket.class, "ChunkBiomeDataS2CPacket"); @@ -342,14 +360,12 @@ public 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.play.ChangeUnlockedRecipesS2CPacket.class, "ChangeUnlockedRecipesS2CPacket"); - S2C_PACKETS_R.put("ChangeUnlockedRecipesS2CPacket", net.minecraft.network.packet.s2c.play.ChangeUnlockedRecipesS2CPacket.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"); @@ -558,42 +574,11 @@ public Optional>>> getEntry(in return Optional.empty(); } - @Override - public Optional>>> getEntry(RegistryKey>> key) { - return Optional.empty(); - } - @Override public Stream>>> streamEntries() { return null; } - @Override - public Optional>>> getEntryList(TagKey>> tag) { - return Optional.empty(); - } - - @Override - public RegistryEntryList.Named>> getOrCreateEntryList(TagKey>> tag) { - return null; - } - - @Override - public Stream>>, RegistryEntryList.Named>>>> streamTagsAndEntries() { - return null; - } - - @Override - public Stream>>> streamTags() { - return null; - } - - @Override - public void clearTags() {} - - @Override - public void populateTags(Map>>, List>>>> tagEntries) {} - @Override public Set>>> getKeys() { return Collections.emptySet(); diff --git a/src/main/java/meteordevelopment/meteorclient/utils/network/PacketUtilsUtil.java b/src/main/java/meteordevelopment/meteorclient/utils/network/PacketUtilsUtil.java index a1c7327cb8..28fc10504b 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/network/PacketUtilsUtil.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/network/PacketUtilsUtil.java @@ -110,42 +110,11 @@ public Optional>>> getEntry(in return Optional.empty(); } - @Override - public Optional>>> getEntry(RegistryKey>> key) { - return Optional.empty(); - } - @Override public Stream>>> streamEntries() { return null; } - @Override - public Optional>>> getEntryList(TagKey>> tag) { - return Optional.empty(); - } - - @Override - public RegistryEntryList.Named>> getOrCreateEntryList(TagKey>> tag) { - return null; - } - - @Override - public Stream>>, RegistryEntryList.Named>>>> streamTagsAndEntries() { - return null; - } - - @Override - public Stream>>> streamTags() { - return null; - } - - @Override - public void clearTags() {} - - @Override - public void populateTags(Map>>, List>>>> tagEntries) {} - @Override public Set>>> getKeys() { return Collections.emptySet(); @@ -182,7 +151,6 @@ public static void init() throws IOException { 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 it.unimi.dsi.fastutil.objects.Object2ReferenceOpenHashMap;\n"); writer.write("import it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap;\n"); @@ -192,11 +160,9 @@ public static void init() throws IOException { 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 org.jetbrains.annotations.NotNull;\n\n"); writer.write("import java.util.*;\n"); writer.write("import java.util.stream.Stream;\n"); diff --git a/src/main/java/meteordevelopment/meteorclient/utils/notebot/decoder/NBSSongDecoder.java b/src/main/java/meteordevelopment/meteorclient/utils/notebot/decoder/NBSSongDecoder.java index c0ad563bc0..a4b6b50117 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/notebot/decoder/NBSSongDecoder.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/notebot/decoder/NBSSongDecoder.java @@ -80,20 +80,15 @@ private Song parse(InputStream inputStream) throws Exception { double tick = -1; while (true) { short jumpTicks = readShort(dataInputStream); // jumps till next tick - //System.out.println("Jumps to next tick: " + jumpTicks); if (jumpTicks == 0) { break; } tick += jumpTicks * (20f / speed); - //System.out.println("Tick: " + tick); - short layer = -1; while (true) { short jumpLayers = readShort(dataInputStream); // jumps till next layer if (jumpLayers == 0) { break; } - layer += jumpLayers; - //System.out.println("Layer: " + layer); byte instrument = dataInputStream.readByte(); byte key = dataInputStream.readByte(); @@ -118,9 +113,6 @@ private Song parse(InputStream inputStream) throws Exception { /** * Sets a note at a tick in a song - * @param ticks - * @param note - * @param notesMap */ private static void setNote(int ticks, Note note, Multimap notesMap) { notesMap.put(ticks, note); diff --git a/src/main/java/meteordevelopment/meteorclient/utils/player/CustomPlayerInput.java b/src/main/java/meteordevelopment/meteorclient/utils/player/CustomPlayerInput.java index c5096a05b7..5cf032c1c2 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/player/CustomPlayerInput.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/player/CustomPlayerInput.java @@ -6,25 +6,107 @@ package meteordevelopment.meteorclient.utils.player; import net.minecraft.client.input.Input; +import net.minecraft.util.PlayerInput; + +import static meteordevelopment.meteorclient.MeteorClient.mc; public class CustomPlayerInput extends Input { @Override public void tick(boolean slowDown, float f) { - movementForward = pressingForward == pressingBack ? 0.0F : (pressingForward ? 1.0F : -1.0F); - movementSideways = pressingLeft == pressingRight ? 0.0F : (pressingLeft ? 1.0F : -1.0F); + movementForward = mc.player.input.playerInput.forward() == mc.player.input.playerInput.backward() ? 0.0F : (mc.player.input.playerInput.forward() ? 1.0F : -1.0F); + movementSideways = mc.player.input.playerInput.left() == mc.player.input.playerInput.right() ? 0.0F : (mc.player.input.playerInput.left() ? 1.0F : -1.0F); - if (sneaking) { + if (mc.player.isSneaking()) { movementForward *= 0.3; movementSideways *= 0.3; } } public void stop() { - pressingForward = false; - pressingBack = false; - pressingRight = false; - pressingLeft = false; - jumping = false; - sneaking = false; + this.playerInput = PlayerInput.DEFAULT; + } + + public void forward(boolean bool) { + this.playerInput = new PlayerInput( + bool, + this.playerInput.backward(), + this.playerInput.left(), + this.playerInput.right(), + this.playerInput.jump(), + this.playerInput.sneak(), + this.playerInput.sprint() + ); + } + + public void backward(boolean bool) { + this.playerInput = new PlayerInput( + this.playerInput.forward(), + bool, + this.playerInput.left(), + this.playerInput.right(), + this.playerInput.jump(), + this.playerInput.sneak(), + this.playerInput.sprint() + ); + } + + public void left(boolean bool) { + this.playerInput = new PlayerInput( + this.playerInput.forward(), + this.playerInput.backward(), + bool, + this.playerInput.right(), + this.playerInput.jump(), + this.playerInput.sneak(), + this.playerInput.sprint() + ); + } + + public void right(boolean bool) { + this.playerInput = new PlayerInput( + this.playerInput.forward(), + this.playerInput.backward(), + this.playerInput.left(), + bool, + this.playerInput.jump(), + this.playerInput.sneak(), + this.playerInput.sprint() + ); + } + + public void jump(boolean bool) { + this.playerInput = new PlayerInput( + this.playerInput.forward(), + this.playerInput.backward(), + this.playerInput.left(), + this.playerInput.right(), + bool, + this.playerInput.sneak(), + this.playerInput.sprint() + ); + } + + public void sneak(boolean bool) { + this.playerInput = new PlayerInput( + this.playerInput.forward(), + this.playerInput.backward(), + this.playerInput.left(), + this.playerInput.right(), + this.playerInput.jump(), + bool, + this.playerInput.sprint() + ); + } + + public void sprint(boolean bool) { + this.playerInput = new PlayerInput( + this.playerInput.forward(), + this.playerInput.backward(), + this.playerInput.left(), + this.playerInput.right(), + this.playerInput.jump(), + this.playerInput.sneak(), + bool + ); } } diff --git a/src/main/java/meteordevelopment/meteorclient/utils/player/InventorySorter.java b/src/main/java/meteordevelopment/meteorclient/utils/player/InventorySorter.java index 75fd01b111..1c0437f5f9 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/player/InventorySorter.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/player/InventorySorter.java @@ -67,7 +67,7 @@ private void generateActions() { List slots = new ArrayList<>(); for (Slot slot : screen.getScreenHandler().slots) { - if (getInvPart(slot) == originInvPart) slots.add(new MySlot(((ISlot) slot).getId(), slot.getStack())); + if (getInvPart(slot) == originInvPart) slots.add(new MySlot(((ISlot) slot).meteor$getId(), slot.getStack())); } slots.sort(Comparator.comparingInt(value -> value.id)); @@ -173,9 +173,9 @@ private boolean isSlotBetter(MySlot best, MySlot slot) { } private InvPart getInvPart(Slot slot) { - int i = ((ISlot) slot).getIndex(); + int i = ((ISlot) slot).meteor$getIndex(); - if (slot.inventory instanceof PlayerInventory && (!(screen instanceof CreativeInventoryScreen) || ((ISlot) slot).getId() > 8)) { + if (slot.inventory instanceof PlayerInventory && (!(screen instanceof CreativeInventoryScreen) || ((ISlot) slot).meteor$getId() > 8)) { if (SlotUtils.isHotbar(i)) return InvPart.Hotbar; else if (SlotUtils.isMain(i)) return InvPart.Player; } diff --git a/src/main/java/meteordevelopment/meteorclient/utils/player/PlayerUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/player/PlayerUtils.java index 9f74da9817..530111b04a 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/player/PlayerUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/player/PlayerUtils.java @@ -72,24 +72,24 @@ public static Vec3d getHorizontalVelocity(double bps) { double velZ = 0; boolean a = false; - if (mc.player.input.pressingForward) { + if (mc.player.input.playerInput.forward()) { velX += forward.x / 20 * bps; velZ += forward.z / 20 * bps; a = true; } - if (mc.player.input.pressingBack) { + if (mc.player.input.playerInput.backward()) { velX -= forward.x / 20 * bps; velZ -= forward.z / 20 * bps; a = true; } boolean b = false; - if (mc.player.input.pressingRight) { + if (mc.player.input.playerInput.right()) { velX += right.x / 20 * bps; velZ += right.z / 20 * bps; b = true; } - if (mc.player.input.pressingLeft) { + if (mc.player.input.playerInput.left()) { velX -= right.x / 20 * bps; velZ -= right.z / 20 * bps; b = true; @@ -100,7 +100,7 @@ public static Vec3d getHorizontalVelocity(double bps) { velZ *= diagonal; } - ((IVec3d) horizontalVelocity).setXZ(velX, velZ); + ((IVec3d) horizontalVelocity).meteor$setXZ(velX, velZ); return horizontalVelocity; } @@ -108,18 +108,18 @@ public static void centerPlayer() { double x = MathHelper.floor(mc.player.getX()) + 0.5; double z = MathHelper.floor(mc.player.getZ()) + 0.5; mc.player.setPosition(x, mc.player.getY(), z); - mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), mc.player.getY(), mc.player.getZ(), mc.player.isOnGround())); + mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), mc.player.getY(), mc.player.getZ(), mc.player.isOnGround(), mc.player.horizontalCollision)); } public static boolean canSeeEntity(Entity entity) { Vec3d vec1 = new Vec3d(0, 0, 0); Vec3d vec2 = new Vec3d(0, 0, 0); - ((IVec3d) vec1).set(mc.player.getX(), mc.player.getY() + mc.player.getStandingEyeHeight(), mc.player.getZ()); - ((IVec3d) vec2).set(entity.getX(), entity.getY(), entity.getZ()); + ((IVec3d) vec1).meteor$set(mc.player.getX(), mc.player.getY() + mc.player.getStandingEyeHeight(), mc.player.getZ()); + ((IVec3d) vec2).meteor$set(entity.getX(), entity.getY(), entity.getZ()); boolean canSeeFeet = mc.world.raycast(new RaycastContext(vec1, vec2, RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.NONE, mc.player)).getType() == HitResult.Type.MISS; - ((IVec3d) vec2).set(entity.getX(), entity.getY() + entity.getStandingEyeHeight(), entity.getZ()); + ((IVec3d) vec2).meteor$set(entity.getX(), entity.getY() + entity.getStandingEyeHeight(), entity.getZ()); boolean canSeeEyes = mc.world.raycast(new RaycastContext(vec1, vec2, RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.NONE, mc.player)).getType() == HitResult.Type.MISS; return canSeeFeet || canSeeEyes; diff --git a/src/main/java/meteordevelopment/meteorclient/utils/player/Rotations.java b/src/main/java/meteordevelopment/meteorclient/utils/player/Rotations.java index 4e7f8e9c15..c10c4fff17 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/player/Rotations.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/player/Rotations.java @@ -236,7 +236,7 @@ public void set(double yaw, double pitch, int priority, boolean clientSide, Runn } public void sendPacket() { - mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.LookAndOnGround((float) yaw, (float) pitch, mc.player.isOnGround())); + mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.LookAndOnGround((float) yaw, (float) pitch, mc.player.isOnGround(), mc.player.horizontalCollision)); runCallback(); } diff --git a/src/main/java/meteordevelopment/meteorclient/utils/player/TitleScreenCredits.java b/src/main/java/meteordevelopment/meteorclient/utils/player/TitleScreenCredits.java index 67881268c1..2b3589862b 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/player/TitleScreenCredits.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/player/TitleScreenCredits.java @@ -63,12 +63,8 @@ private static void init() { MeteorClient.LOG.info("See: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens"); } } - case Http.FORBIDDEN -> { - MeteorClient.LOG.warn("Could not fetch updates for addon '%s': Rate-limited by GitHub.".formatted(credit.addon.name)); - } - case Http.NOT_FOUND -> { - MeteorClient.LOG.warn("Could not fetch updates for addon '%s': GitHub repository '%s' not found.".formatted(credit.addon.name, repo.getOwnerName())); - } + case Http.FORBIDDEN -> MeteorClient.LOG.warn("Could not fetch updates for addon '{}': Rate-limited by GitHub.", credit.addon.name); + case Http.NOT_FOUND -> MeteorClient.LOG.warn("Could not fetch updates for addon '{}': GitHub repository '{}' not found.", credit.addon.name, repo.getOwnerName()); case Http.SUCCESS -> { if (!credit.addon.getCommit().equals(res.body().commit.sha)) { synchronized (credit.text) { diff --git a/src/main/java/meteordevelopment/meteorclient/utils/render/MeteorToast.java b/src/main/java/meteordevelopment/meteorclient/utils/render/MeteorToast.java index 277a94490a..7e48395634 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/render/MeteorToast.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/render/MeteorToast.java @@ -7,8 +7,9 @@ import com.mojang.blaze3d.systems.RenderSystem; import meteordevelopment.meteorclient.utils.render.color.Color; +import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.render.GameRenderer; +import net.minecraft.client.render.RenderLayer; import net.minecraft.client.sound.PositionedSoundInstance; import net.minecraft.client.sound.SoundInstance; import net.minecraft.client.toast.Toast; @@ -34,6 +35,7 @@ public class MeteorToast implements Toast { private Text title, text; private boolean justUpdated = true, playedSound; private long start, duration; + private Toast.Visibility visibility = Visibility.HIDE; public MeteorToast(@Nullable Item item, @NotNull String title, @Nullable String text, long duration) { this.icon = item != null ? item.getDefaultStack() : null; @@ -50,16 +52,30 @@ public MeteorToast(@Nullable Item item, @NotNull String title, @Nullable String } @Override - public Visibility draw(DrawContext context, ToastManager toastManager, long currentTime) { + public Visibility getVisibility() { + return this.visibility; + } + + @Override + public void update(ToastManager manager, long time) { if (justUpdated) { - start = currentTime; + start = time; justUpdated = false; } - RenderSystem.setShader(GameRenderer::getPositionTexProgram); + visibility = time - start >= duration ? Toast.Visibility.HIDE : Toast.Visibility.SHOW; + + if (!playedSound) { + mc.getSoundManager().play(getSound()); + playedSound = true; + } + } + + @Override + public void draw(DrawContext context, TextRenderer textRenderer, long startTime) { RenderSystem.setShaderColor(1, 1, 1, 1); - context.drawTexture(TEXTURE, 0, 0, 0, 0, getWidth(), getHeight()); + context.drawGuiTexture(RenderLayer::getGuiTextured, TEXTURE, 0, 0, getWidth(), getHeight()); int x = icon != null ? 28 : 12; int titleY = 12; @@ -72,13 +88,6 @@ public Visibility draw(DrawContext context, ToastManager toastManager, long curr context.drawText(mc.textRenderer, title, x, titleY, TITLE_COLOR, false); if (icon != null) context.drawItem(icon, 8, 8); - - if (!playedSound) { - mc.getSoundManager().play(getSound()); - playedSound = true; - } - - return currentTime - start >= duration ? Toast.Visibility.HIDE : Toast.Visibility.SHOW; } public void setIcon(@Nullable Item item) { diff --git a/src/main/java/meteordevelopment/meteorclient/utils/render/PeekScreen.java b/src/main/java/meteordevelopment/meteorclient/utils/render/PeekScreen.java index 5e546e6797..f2afbee44a 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/render/PeekScreen.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/render/PeekScreen.java @@ -13,7 +13,7 @@ import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.ingame.BookScreen; import net.minecraft.client.gui.screen.ingame.ShulkerBoxScreen; -import net.minecraft.client.render.GameRenderer; +import net.minecraft.client.render.RenderLayer; import net.minecraft.component.DataComponentTypes; import net.minecraft.inventory.SimpleInventory; import net.minecraft.item.ItemStack; @@ -43,8 +43,7 @@ public boolean mouseClicked(double mouseX, double mouseY, int button) { ItemStack itemStack = focusedSlot.getStack(); if (Utils.hasItems(itemStack) || itemStack.getItem() == Items.ENDER_CHEST) { return Utils.openContainer(focusedSlot.getStack(), contents, false); - } - else if (itemStack.get(DataComponentTypes.WRITTEN_BOOK_CONTENT) != null || itemStack.get(DataComponentTypes.WRITABLE_BOOK_CONTENT) != null) { + } else if (itemStack.get(DataComponentTypes.WRITTEN_BOOK_CONTENT) != null || itemStack.get(DataComponentTypes.WRITABLE_BOOK_CONTENT) != null) { close(); mc.setScreen(new BookScreen(BookScreen.Contents.create(itemStack))); return true; @@ -81,11 +80,10 @@ public boolean keyReleased(int keyCode, int scanCode, int modifiers) { protected void drawBackground(DrawContext context, float delta, int mouseX, int mouseY) { Color color = Utils.getShulkerColor(storageBlock); - RenderSystem.setShader(GameRenderer::getPositionTexProgram); RenderSystem.setShaderColor(color.r / 255f, color.g / 255f, color.b / 255f, color.a / 255f); int i = (width - backgroundWidth) / 2; int j = (height - backgroundHeight) / 2; - context.drawTexture(TEXTURE, i, j, 0, 0, backgroundWidth, backgroundHeight); + context.drawTexture(RenderLayer::getGuiTextured, TEXTURE, i, j, 0f, 0f, backgroundWidth, backgroundHeight, 256, 256); RenderSystem.setShaderColor(1, 1, 1, 1); } } diff --git a/src/main/java/meteordevelopment/meteorclient/utils/render/RenderUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/render/RenderUtils.java index 1d255be2df..869325d74e 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/render/RenderUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/render/RenderUtils.java @@ -15,9 +15,9 @@ import meteordevelopment.orbit.EventHandler; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.network.AbstractClientPlayerEntity; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.Entity; -import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; @@ -56,7 +56,7 @@ public static void drawItem(DrawContext drawContext, ItemStack itemStack, int x, int scaledY = (int) (y / scale); drawContext.drawItem(itemStack, scaledX, scaledY); - if (overlay) drawContext.drawItemInSlot(mc.textRenderer, itemStack, scaledX, scaledY, countOverride); + if (overlay) drawContext.drawStackOverlay(mc.textRenderer, itemStack, scaledX, scaledY, countOverride); matrices.pop(); } @@ -86,15 +86,16 @@ public static void updateScreenCenter() { private static void bobView(MatrixStack matrices) { Entity cameraEntity = MinecraftClient.getInstance().getCameraEntity(); - if (cameraEntity instanceof PlayerEntity playerEntity) { - float f = mc.getRenderTickCounter().getTickDelta(true); - float g = playerEntity.horizontalSpeed - playerEntity.prevHorizontalSpeed; - float h = -(playerEntity.horizontalSpeed + g * f); - float i = MathHelper.lerp(f, playerEntity.prevStrideDistance, playerEntity.strideDistance); + if (cameraEntity instanceof AbstractClientPlayerEntity abstractClientPlayerEntity) { + float tickDelta = mc.getRenderTickCounter().getTickDelta(true); - matrices.translate(-(MathHelper.sin(h * 3.1415927f) * i * 0.5), Math.abs(MathHelper.cos(h * 3.1415927f) * i), 0); - matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(MathHelper.sin(h * 3.1415927f) * i * 3)); - matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(Math.abs(MathHelper.cos(h * 3.1415927f - 0.2f) * i) * 5)); + float var7 = abstractClientPlayerEntity.distanceMoved - abstractClientPlayerEntity.lastDistanceMoved; + float g = -(abstractClientPlayerEntity.distanceMoved + var7 * tickDelta); + float h = MathHelper.lerp(tickDelta, abstractClientPlayerEntity.prevStrideDistance, abstractClientPlayerEntity.strideDistance); + + matrices.translate(MathHelper.sin(g * (float) Math.PI) * h * 0.5F, -Math.abs(MathHelper.cos(g * (float) Math.PI) * h), 0.0F); + matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(MathHelper.sin(g * (float) Math.PI) * h * 3f)); + matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(Math.abs(MathHelper.cos(g * (float) Math.PI - 0.2f) * h) * 5f)); } } diff --git a/src/main/java/meteordevelopment/meteorclient/utils/render/SimpleBlockRenderer.java b/src/main/java/meteordevelopment/meteorclient/utils/render/SimpleBlockRenderer.java index ee6e1f34fc..29781987b6 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/render/SimpleBlockRenderer.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/render/SimpleBlockRenderer.java @@ -45,7 +45,7 @@ public static void render(BlockPos pos, BlockState state, VertexConsumerProvider VertexConsumer consumer = consumerProvider.getBuffer(RenderLayer.getSolid()); BakedModel model = mc.getBlockRenderManager().getModel(state); - Vec3d offset = state.getModelOffset(mc.world, pos); + Vec3d offset = state.getModelOffset(pos); float offsetX = (float) offset.x; float offsetY = (float) offset.y; diff --git a/src/main/java/meteordevelopment/meteorclient/utils/render/WireframeEntityRenderer.java b/src/main/java/meteordevelopment/meteorclient/utils/render/WireframeEntityRenderer.java index 75e20acc87..75e58630d0 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/render/WireframeEntityRenderer.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/render/WireframeEntityRenderer.java @@ -5,47 +5,41 @@ package meteordevelopment.meteorclient.utils.render; +import meteordevelopment.meteorclient.MeteorClient; import meteordevelopment.meteorclient.events.render.Render3DEvent; +import meteordevelopment.meteorclient.mixininterface.IMultiPhase; +import meteordevelopment.meteorclient.mixininterface.IMultiPhaseParameters; import meteordevelopment.meteorclient.renderer.Renderer3D; import meteordevelopment.meteorclient.renderer.ShapeMode; -import meteordevelopment.meteorclient.systems.modules.Modules; -import meteordevelopment.meteorclient.systems.modules.render.Chams; import meteordevelopment.meteorclient.utils.render.color.Color; -import net.minecraft.client.model.ModelPart; -import net.minecraft.client.network.AbstractClientPlayerEntity; -import net.minecraft.client.render.entity.*; -import net.minecraft.client.render.entity.model.*; +import net.minecraft.client.render.RenderLayer; +import net.minecraft.client.render.VertexConsumer; +import net.minecraft.client.render.VertexConsumerProvider; +import net.minecraft.client.render.entity.EntityRenderer; +import net.minecraft.client.render.entity.state.EntityRenderState; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.Entity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.decoration.EndCrystalEntity; -import net.minecraft.entity.vehicle.BoatEntity; -import net.minecraft.util.Arm; -import net.minecraft.util.Hand; -import net.minecraft.util.math.Box; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.RotationAxis; -import org.joml.Matrix4f; -import org.joml.Quaternionf; -import org.joml.Vector4f; - -import static meteordevelopment.meteorclient.MeteorClient.mc; +import net.minecraft.util.math.Vec3d; public class WireframeEntityRenderer { private static final MatrixStack matrices = new MatrixStack(); - private static final Vector4f pos1 = new Vector4f(); - private static final Vector4f pos2 = new Vector4f(); - private static final Vector4f pos3 = new Vector4f(); - private static final Vector4f pos4 = new Vector4f(); - private static double offsetX, offsetY, offsetZ; - private static Color sideColor, lineColor; + private static Renderer3D renderer; + + private static Color sideColor; + private static Color lineColor; private static ShapeMode shapeMode; + private static double offsetX; + private static double offsetY; + private static double offsetZ; + private WireframeEntityRenderer() { } public static void render(Render3DEvent event, Entity entity, double scale, Color sideColor, Color lineColor, ShapeMode shapeMode) { + WireframeEntityRenderer.renderer = event.renderer; WireframeEntityRenderer.sideColor = sideColor; WireframeEntityRenderer.lineColor = lineColor; WireframeEntityRenderer.shapeMode = shapeMode; @@ -54,333 +48,132 @@ public static void render(Render3DEvent event, Entity entity, double scale, Colo offsetY = MathHelper.lerp(event.tickDelta, entity.lastRenderY, entity.getY()); offsetZ = MathHelper.lerp(event.tickDelta, entity.lastRenderZ, entity.getZ()); - matrices.push(); - matrices.scale((float) scale, (float) scale, (float) scale); - - EntityRenderer entityRenderer = mc.getEntityRenderDispatcher().getRenderer(entity); + //noinspection unchecked + var renderer = (EntityRenderer) MeteorClient.mc.getEntityRenderDispatcher().getRenderer(entity); + var state = renderer.getAndUpdateRenderState(entity, event.tickDelta); - // LivingEntityRenderer - if (entityRenderer instanceof LivingEntityRenderer renderer) { - LivingEntity livingEntity = (LivingEntity) entity; - EntityModel model = renderer.getModel(); + Vec3d entityOffset = renderer.getPositionOffset(state); + offsetX += entityOffset.x; + offsetY += entityOffset.y; + offsetZ += entityOffset.z; - // PlayerEntityRenderer - if (entityRenderer instanceof PlayerEntityRenderer r) { - PlayerEntityModel playerModel = r.getModel(); - - playerModel.sneaking = entity.isInSneakingPose(); - BipedEntityModel.ArmPose armPose = PlayerEntityRenderer.getArmPose((AbstractClientPlayerEntity) entity, Hand.MAIN_HAND); - BipedEntityModel.ArmPose armPose2 = PlayerEntityRenderer.getArmPose((AbstractClientPlayerEntity) entity, Hand.OFF_HAND); + matrices.push(); + matrices.scale((float) scale, (float) scale, (float) scale); + renderer.render(state, matrices, MyVertexConsumerProvider.INSTANCE, 15); + matrices.push(); + } - if (armPose.isTwoHanded()) armPose2 = livingEntity.getOffHandStack().isEmpty() ? BipedEntityModel.ArmPose.EMPTY : BipedEntityModel.ArmPose.ITEM; + private static class MyVertexConsumerProvider implements VertexConsumerProvider { + public static final MyVertexConsumerProvider INSTANCE = new MyVertexConsumerProvider(); - if (livingEntity.getMainArm() == Arm.RIGHT) { - playerModel.rightArmPose = armPose; - playerModel.leftArmPose = armPose2; - } else { - playerModel.rightArmPose = armPose2; - playerModel.leftArmPose = armPose; - } + @Override + public VertexConsumer getBuffer(RenderLayer layer) { + //noinspection ConstantValue + if (layer instanceof IMultiPhase phase && ((IMultiPhaseParameters) (Object) phase.meteor$getParameters()).meteor$getTarget() == RenderLayer.ITEM_ENTITY_TARGET) { + return NoopVertexConsumer.INSTANCE; } - model.handSwingProgress = livingEntity.getHandSwingProgress(event.tickDelta); - model.riding = livingEntity.hasVehicle(); - model.child = livingEntity.isBaby(); - - float bodyYaw = MathHelper.lerpAngleDegrees(event.tickDelta, livingEntity.prevBodyYaw, livingEntity.bodyYaw); - float headYaw = MathHelper.lerpAngleDegrees(event.tickDelta, livingEntity.prevHeadYaw, livingEntity.headYaw); - float yaw = headYaw - bodyYaw; + return MyVertexConsumer.INSTANCE; + } + } - float animationProgress; - if (livingEntity.hasVehicle() && livingEntity.getVehicle() instanceof LivingEntity livingEntity2) { - bodyYaw = MathHelper.lerpAngleDegrees(event.tickDelta, livingEntity2.prevBodyYaw, livingEntity2.bodyYaw); - yaw = headYaw - bodyYaw; - animationProgress = MathHelper.wrapDegrees(yaw); + private static class MyVertexConsumer implements VertexConsumer { + public static final MyVertexConsumer INSTANCE = new MyVertexConsumer(); - if (animationProgress < -85) animationProgress = -85; - if (animationProgress >= 85) animationProgress = 85; + private final float[] xs = new float[4]; + private final float[] ys = new float[4]; + private final float[] zs = new float[4]; - bodyYaw = headYaw - animationProgress; - if (animationProgress * animationProgress > 2500) bodyYaw += animationProgress * 0.2; + private int i = 0; - yaw = headYaw - bodyYaw; - } + @Override + public VertexConsumer vertex(float x, float y, float z) { + xs[i] = x; + ys[i] = y; + zs[i] = z; - float pitch = MathHelper.lerp(event.tickDelta, livingEntity.prevPitch, livingEntity.getPitch()); + i++; - animationProgress = renderer.getAnimationProgress(livingEntity, event.tickDelta); - float limbDistance = 0; - float limbAngle = 0; + if (i == 4) { + if (shapeMode.sides()) { + renderer.triangles.quad( + renderer.triangles.vec3(offsetX + xs[0], offsetY + ys[0], offsetZ + zs[0]).color(sideColor).next(), + renderer.triangles.vec3(offsetX + xs[1], offsetY + ys[1], offsetZ + zs[1]).color(sideColor).next(), + renderer.triangles.vec3(offsetX + xs[2], offsetY + ys[2], offsetZ + zs[2]).color(sideColor).next(), + renderer.triangles.vec3(offsetX + xs[3], offsetY + ys[3], offsetZ + zs[3]).color(sideColor).next() + ); + } - if (!livingEntity.hasVehicle() && livingEntity.isAlive()) { - limbDistance = livingEntity.limbAnimator.getSpeed(event.tickDelta); - limbAngle = livingEntity.limbAnimator.getPos(event.tickDelta); + if (shapeMode.lines()) { + renderer.line(offsetX + xs[0], offsetY + ys[0], offsetZ + zs[0], offsetX + xs[1], offsetY + ys[1], offsetZ + zs[1], lineColor); + renderer.line(offsetX + xs[1], offsetY + ys[1], offsetZ + zs[1], offsetX + xs[2], offsetY + ys[2], offsetZ + zs[2], lineColor); + renderer.line(offsetX + xs[2], offsetY + ys[2], offsetZ + zs[2], offsetX + xs[3], offsetY + ys[3], offsetZ + zs[3], lineColor); + renderer.line(offsetX + xs[0], offsetY + ys[0], offsetZ + zs[0], offsetX + xs[0], offsetY + ys[0], offsetZ + zs[0], lineColor); + } - if (livingEntity.isBaby()) limbAngle *= 3; - if (limbDistance > 1) limbDistance = 1; + i = 0; } - model.animateModel(livingEntity, limbAngle, limbDistance, event.tickDelta); - model.setAngles(livingEntity, limbAngle, limbDistance, animationProgress, yaw, pitch); - - renderer.setupTransforms(livingEntity, matrices, animationProgress, bodyYaw, event.tickDelta, livingEntity.getScale()); - matrices.scale(-1, -1, 1); - renderer.scale(livingEntity, matrices, event.tickDelta); - matrices.translate(0, -1.5010000467300415, 0); - - // Render - if (model instanceof AnimalModel m) { - if (m.child) { - matrices.push(); - float g; - if (m.headScaled) { - g = 1.5F / m.invertedChildHeadScale; - matrices.scale(g, g, g); - } - - matrices.translate(0.0D, m.childHeadYOffset / 16.0F, m.childHeadZOffset / 16.0F); - if (model instanceof BipedEntityModel mo) render(event.renderer, mo.head); - else m.getHeadParts().forEach(modelPart -> render(event.renderer, (ModelPart) modelPart)); - matrices.pop(); - matrices.push(); - g = 1.0F / m.invertedChildBodyScale; - matrices.scale(g, g, g); - matrices.translate(0.0D, m.childBodyYOffset / 16.0F, 0.0D); - if (model instanceof BipedEntityModel mo) { - render(event.renderer, mo.body); - render(event.renderer, mo.leftArm); - render(event.renderer, mo.rightArm); - render(event.renderer, mo.leftLeg); - render(event.renderer, mo.rightLeg); - } - else m.getBodyParts().forEach(modelPart -> render(event.renderer, (ModelPart) modelPart)); - matrices.pop(); - } - else { - if (model instanceof BipedEntityModel mo) { - render(event.renderer, mo.head); - render(event.renderer, mo.body); - render(event.renderer, mo.leftArm); - render(event.renderer, mo.rightArm); - render(event.renderer, mo.leftLeg); - render(event.renderer, mo.rightLeg); - } - else { - m.getHeadParts().forEach(modelPart -> render(event.renderer, (ModelPart) modelPart)); - m.getBodyParts().forEach(modelPart -> render(event.renderer, (ModelPart) modelPart)); - } - } - } - else { - if (model instanceof SinglePartEntityModel m) { - render(event.renderer, m.getPart()); - } - else if (model instanceof CompositeEntityModel m) { - m.getParts().forEach(modelPart -> render(event.renderer, (ModelPart) modelPart)); - } - else if (model instanceof LlamaEntityModel m) { - if (m.child) { - matrices.push(); - matrices.scale(0.71428573F, 0.64935064F, 0.7936508F); - matrices.translate(0.0D, 1.3125D, 0.2199999988079071D); - render(event.renderer, m.head); - matrices.pop(); - matrices.push(); - matrices.scale(0.625F, 0.45454544F, 0.45454544F); - matrices.translate(0.0D, 2.0625D, 0.0D); - render(event.renderer, m.body); - matrices.pop(); - matrices.push(); - matrices.scale(0.45454544F, 0.41322312F, 0.45454544F); - matrices.translate(0.0D, 2.0625D, 0.0D); - render(event.renderer, m.rightHindLeg); - render(event.renderer, m.leftHindLeg); - render(event.renderer, m.rightFrontLeg); - render(event.renderer, m.leftFrontLeg); - render(event.renderer, m.rightChest); - render(event.renderer, m.leftChest); - matrices.pop(); - } - else { - render(event.renderer, m.head); - render(event.renderer, m.body); - render(event.renderer, m.rightHindLeg); - render(event.renderer, m.leftHindLeg); - render(event.renderer, m.rightFrontLeg); - render(event.renderer, m.leftFrontLeg); - render(event.renderer, m.rightChest); - render(event.renderer, m.leftChest); - } - } - else if (model instanceof RabbitEntityModel m) { - if (m.child) { - matrices.push(); - matrices.scale(0.56666666F, 0.56666666F, 0.56666666F); - matrices.translate(0.0D, 1.375D, 0.125D); - render(event.renderer, m.head); - render(event.renderer, m.leftEar); - render(event.renderer, m.rightEar); - render(event.renderer, m.nose); - matrices.pop(); - matrices.push(); - matrices.scale(0.4F, 0.4F, 0.4F); - matrices.translate(0.0D, 2.25D, 0.0D); - render(event.renderer, m.leftHindLeg); - render(event.renderer, m.rightHindLeg); - render(event.renderer, m.leftHaunch); - render(event.renderer, m.rightHaunch); - render(event.renderer, m.body); - render(event.renderer, m.leftFrontLeg); - render(event.renderer, m.rightFrontLeg); - render(event.renderer, m.tail); - matrices.pop(); - } - else { - matrices.push(); - matrices.scale(0.6F, 0.6F, 0.6F); - matrices.translate(0.0D, 1.0D, 0.0D); - render(event.renderer, m.leftHindLeg); - render(event.renderer, m.rightHindLeg); - render(event.renderer, m.leftHaunch); - render(event.renderer, m.rightHaunch); - render(event.renderer, m.body); - render(event.renderer, m.leftFrontLeg); - render(event.renderer, m.rightFrontLeg); - render(event.renderer, m.head); - render(event.renderer, m.rightEar); - render(event.renderer, m.leftEar); - render(event.renderer, m.tail); - render(event.renderer, m.nose); - matrices.pop(); - } - } - } + return this; } - if (entityRenderer instanceof EndCrystalEntityRenderer renderer) { - EndCrystalEntity crystalEntity = (EndCrystalEntity) entity; - Chams chams = Modules.get().get(Chams.class); - boolean chamsEnabled = chams.isActive() && chams.crystals.get(); - - matrices.push(); - float h; - if (chamsEnabled) { - float f = (float) crystalEntity.endCrystalAge + event.tickDelta; - float g = MathHelper.sin(f * 0.2F) / 2.0F + 0.5F; - g = (g * g + g) * 0.4F * chams.crystalsBounce.get().floatValue(); - h = g - 1.4F; - } - else h = EndCrystalEntityRenderer.getYOffset(crystalEntity, event.tickDelta); - float j = ((float) crystalEntity.endCrystalAge + event.tickDelta) * 3.0F; - matrices.push(); - if (chamsEnabled) matrices.scale(2.0F * chams.crystalsScale.get().floatValue(), 2.0F * chams.crystalsScale.get().floatValue(), 2.0F * chams.crystalsScale.get().floatValue()); - else matrices.scale(2.0F, 2.0F, 2.0F); - matrices.translate(0.0D, -0.5D, 0.0D); - if (crystalEntity.shouldShowBottom()) render(event.renderer, renderer.bottom); - - if (chamsEnabled) matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(j * chams.crystalsRotationSpeed.get().floatValue())); - else matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(j)); - matrices.translate(0.0D, 1.5F + h / 2.0F, 0.0D); - matrices.multiply(new Quaternionf().setAngleAxis(60.0F, EndCrystalEntityRenderer.SINE_45_DEGREES, 0.0F, EndCrystalEntityRenderer.SINE_45_DEGREES)); - if (!chamsEnabled || chams.renderFrame1.get()) render(event.renderer, renderer.frame); - matrices.scale(0.875F, 0.875F, 0.875F); - matrices.multiply(new Quaternionf().setAngleAxis(60.0F, EndCrystalEntityRenderer.SINE_45_DEGREES, 0.0F, EndCrystalEntityRenderer.SINE_45_DEGREES)); - if (chamsEnabled) matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(j * chams.crystalsRotationSpeed.get().floatValue())); - else matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(j)); - if (!chamsEnabled || chams.renderFrame2.get()) render(event.renderer, renderer.frame); - matrices.scale(0.875F, 0.875F, 0.875F); - matrices.multiply(new Quaternionf().setAngleAxis(60.0F, EndCrystalEntityRenderer.SINE_45_DEGREES, 0.0F, EndCrystalEntityRenderer.SINE_45_DEGREES)); - if (chamsEnabled) matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(j * chams.crystalsRotationSpeed.get().floatValue())); - else matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(j)); - if (!chamsEnabled || chams.renderCore.get()) render(event.renderer, renderer.core); - matrices.pop(); - matrices.pop(); + @Override + public VertexConsumer color(int red, int green, int blue, int alpha) { + return this; } - else if (entityRenderer instanceof BoatEntityRenderer renderer) { - BoatEntity boatEntity = (BoatEntity) entity; - - matrices.push(); - matrices.translate(0.0D, 0.375D, 0.0D); - matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(180.0F - MathHelper.lerp(event.tickDelta, entity.prevYaw, entity.getYaw()))); - float h = (float)boatEntity.getDamageWobbleTicks() - event.tickDelta; - float j = boatEntity.getDamageWobbleStrength() - event.tickDelta; - if (j < 0.0F) j = 0.0F; - - if (h > 0.0F) { - matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(MathHelper.sin(h) * h * j / 10.0F * (float)boatEntity.getDamageWobbleSide())); - } - float k = boatEntity.interpolateBubbleWobble(event.tickDelta); - if (!MathHelper.approximatelyEquals(k, 0.0F)) { - matrices.multiply(new Quaternionf().setAngleAxis(boatEntity.interpolateBubbleWobble(event.tickDelta), 1.0F, 0.0F, 1.0F)); - } - - CompositeEntityModel boatEntityModel = renderer.texturesAndModels.get(boatEntity.getVariant()).getSecond(); - matrices.scale(-1.0F, -1.0F, 1.0F); - matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(90.0F)); - boatEntityModel.setAngles(boatEntity, event.tickDelta, 0.0F, -0.1F, 0.0F, 0.0F); - boatEntityModel.getParts().forEach(modelPart -> render(event.renderer, modelPart)); - if (!boatEntity.isSubmergedInWater() && boatEntityModel instanceof ModelWithWaterPatch modelWithWaterPatch) render(event.renderer, modelWithWaterPatch.getWaterPatch()); - - matrices.pop(); + @Override + public VertexConsumer texture(float u, float v) { + return this; } - else if (entityRenderer instanceof ItemEntityRenderer) { - double dx = (entity.getX() - entity.prevX) * event.tickDelta; - double dy = (entity.getY() - entity.prevY) * event.tickDelta; - double dz = (entity.getZ() - entity.prevZ) * event.tickDelta; - Box box = entity.getBoundingBox(); - event.renderer.box(dx + box.minX, dy + box.minY, dz + box.minZ, dx + box.maxX, dy + box.maxY, dz + box.maxZ, sideColor, lineColor, shapeMode, 0); + @Override + public VertexConsumer overlay(int u, int v) { + return this; } - matrices.pop(); - } - - private static void render(Renderer3D renderer, ModelPart part) { - if (!part.visible || (part.cuboids.isEmpty() && part.children.isEmpty())) return; - - matrices.push(); - part.rotate(matrices); - - for (ModelPart.Cuboid cuboid : part.cuboids) render(renderer, cuboid, offsetX, offsetY, offsetZ); - for (ModelPart child : part.children.values()) render(renderer, child); + @Override + public VertexConsumer light(int u, int v) { + return this; + } - matrices.pop(); + @Override + public VertexConsumer normal(float x, float y, float z) { + return this; + } } - private static void render(Renderer3D renderer, ModelPart.Cuboid cuboid, double offsetX, double offsetY, double offsetZ) { - Matrix4f matrix = matrices.peek().getPositionMatrix(); + private static class NoopVertexConsumer implements VertexConsumer { + private static final NoopVertexConsumer INSTANCE = new NoopVertexConsumer(); - for (ModelPart.Quad quad : cuboid.sides) { - // Transform positions - pos1.set(quad.vertices[0].pos.x / 16, quad.vertices[0].pos.y / 16, quad.vertices[0].pos.z / 16, 1); - pos1.mul(matrix); + @Override + public VertexConsumer vertex(float x, float y, float z) { + return this; + } - pos2.set(quad.vertices[1].pos.x / 16, quad.vertices[1].pos.y / 16, quad.vertices[1].pos.z / 16, 1); - pos2.mul(matrix); + @Override + public VertexConsumer color(int red, int green, int blue, int alpha) { + return this; + } - pos3.set(quad.vertices[2].pos.x / 16, quad.vertices[2].pos.y / 16, quad.vertices[2].pos.z / 16, 1); - pos3.mul(matrix); + @Override + public VertexConsumer texture(float u, float v) { + return this; + } - pos4.set(quad.vertices[3].pos.x / 16, quad.vertices[3].pos.y / 16, quad.vertices[3].pos.z / 16, 1); - pos4.mul(matrix); + @Override + public VertexConsumer overlay(int u, int v) { + return this; + } - // Render - if (shapeMode.sides()) { - renderer.triangles.quad( - renderer.triangles.vec3(offsetX + pos1.x, offsetY + pos1.y, offsetZ + pos1.z).color(sideColor).next(), - renderer.triangles.vec3(offsetX + pos2.x, offsetY + pos2.y, offsetZ + pos2.z).color(sideColor).next(), - renderer.triangles.vec3(offsetX + pos3.x, offsetY + pos3.y, offsetZ + pos3.z).color(sideColor).next(), - renderer.triangles.vec3(offsetX + pos4.x, offsetY + pos4.y, offsetZ + pos4.z).color(sideColor).next() - ); - } + @Override + public VertexConsumer light(int u, int v) { + return this; + } - if (shapeMode.lines()) { - renderer.line(offsetX + pos1.x, offsetY + pos1.y, offsetZ + pos1.z, offsetX + pos2.x, offsetY + pos2.y, offsetZ + pos2.z, lineColor); - renderer.line(offsetX + pos2.x, offsetY + pos2.y, offsetZ + pos2.z, offsetX + pos3.x, offsetY + pos3.y, offsetZ + pos3.z, lineColor); - renderer.line(offsetX + pos3.x, offsetY + pos3.y, offsetZ + pos3.z, offsetX + pos4.x, offsetY + pos4.y, offsetZ + pos4.z, lineColor); - renderer.line(offsetX + pos1.x, offsetY + pos1.y, offsetZ + pos1.z, offsetX + pos1.x, offsetY + pos1.y, offsetZ + pos1.z, lineColor); - } + @Override + public VertexConsumer normal(float x, float y, float z) { + return this; } } } diff --git a/src/main/java/meteordevelopment/meteorclient/utils/render/postprocess/EntityShader.java b/src/main/java/meteordevelopment/meteorclient/utils/render/postprocess/EntityShader.java index af287ac4dd..c11115883d 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/render/postprocess/EntityShader.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/render/postprocess/EntityShader.java @@ -1,34 +1,21 @@ package meteordevelopment.meteorclient.utils.render.postprocess; -import meteordevelopment.meteorclient.mixin.WorldRendererAccessor; -import net.minecraft.client.gl.Framebuffer; -import net.minecraft.client.render.OutlineVertexConsumerProvider; -import net.minecraft.client.render.WorldRenderer; +import meteordevelopment.meteorclient.mixininterface.IWorldRenderer; import static meteordevelopment.meteorclient.MeteorClient.mc; public abstract class EntityShader extends PostProcessShader { - private Framebuffer prevBuffer; - @Override protected void preDraw() { - WorldRenderer worldRenderer = mc.worldRenderer; - WorldRendererAccessor wra = (WorldRendererAccessor) worldRenderer; - prevBuffer = worldRenderer.getEntityOutlinesFramebuffer(); - wra.setEntityOutlinesFramebuffer(framebuffer); + ((IWorldRenderer) mc.worldRenderer).meteor$pushEntityOutlineFramebuffer(framebuffer); } @Override protected void postDraw() { - if (prevBuffer == null) return; - - WorldRenderer worldRenderer = mc.worldRenderer; - WorldRendererAccessor wra = (WorldRendererAccessor) worldRenderer; - wra.setEntityOutlinesFramebuffer(prevBuffer); - prevBuffer = null; + ((IWorldRenderer) mc.worldRenderer).meteor$popEntityOutlineFramebuffer(); } public void endRender() { - endRender(() -> ((OutlineVertexConsumerProvider) vertexConsumerProvider).draw()); + endRender(() -> vertexConsumerProvider.draw()); } } diff --git a/src/main/java/meteordevelopment/meteorclient/utils/render/postprocess/PostProcessShader.java b/src/main/java/meteordevelopment/meteorclient/utils/render/postprocess/PostProcessShader.java index 785a7ddaa4..189004d1bb 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/render/postprocess/PostProcessShader.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/render/postprocess/PostProcessShader.java @@ -3,7 +3,6 @@ import meteordevelopment.meteorclient.renderer.GL; import meteordevelopment.meteorclient.renderer.PostProcessRenderer; import meteordevelopment.meteorclient.renderer.Shader; -import net.minecraft.client.MinecraftClient; import net.minecraft.client.gl.Framebuffer; import net.minecraft.client.gl.SimpleFramebuffer; import net.minecraft.client.render.OutlineVertexConsumerProvider; @@ -19,7 +18,7 @@ public abstract class PostProcessShader { public void init(String frag) { vertexConsumerProvider = new OutlineVertexConsumerProvider(mc.getBufferBuilders().getEntityVertexConsumers()); - framebuffer = new SimpleFramebuffer(mc.getWindow().getFramebufferWidth(), mc.getWindow().getFramebufferHeight(), false, MinecraftClient.IS_SYSTEM_MAC); + framebuffer = new SimpleFramebuffer(mc.getWindow().getFramebufferWidth(), mc.getWindow().getFramebufferHeight(), true); shader = new Shader("post-process/base.vert", "post-process/" + frag + ".frag"); } @@ -34,7 +33,7 @@ protected void postDraw() {} public void beginRender() { if (!shouldDraw()) return; - framebuffer.clear(MinecraftClient.IS_SYSTEM_MAC); + framebuffer.clear(); mc.getFramebuffer().beginWrite(false); } @@ -47,7 +46,7 @@ public void endRender(Runnable draw) { mc.getFramebuffer().beginWrite(false); - GL.bindTexture(framebuffer.getColorAttachment(), 0); + GL.getTexture(framebuffer.getColorAttachment(), 0); shader.bind(); @@ -61,6 +60,6 @@ public void endRender(Runnable draw) { public void onResized(int width, int height) { if (framebuffer == null) return; - framebuffer.resize(width, height, MinecraftClient.IS_SYSTEM_MAC); + framebuffer.resize(width, height); } } diff --git a/src/main/java/meteordevelopment/meteorclient/utils/render/postprocess/StorageOutlineShader.java b/src/main/java/meteordevelopment/meteorclient/utils/render/postprocess/StorageOutlineShader.java index aa3011110f..90e7fb603a 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/render/postprocess/StorageOutlineShader.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/render/postprocess/StorageOutlineShader.java @@ -13,7 +13,7 @@ public StorageOutlineShader() { @Override protected void preDraw() { - framebuffer.clear(false); + framebuffer.clear(); framebuffer.beginWrite(false); } diff --git a/src/main/java/meteordevelopment/meteorclient/utils/tooltip/BannerTooltipComponent.java b/src/main/java/meteordevelopment/meteorclient/utils/tooltip/BannerTooltipComponent.java index 47db76b442..a3668425c6 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/tooltip/BannerTooltipComponent.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/tooltip/BannerTooltipComponent.java @@ -14,7 +14,7 @@ import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.block.entity.BannerBlockEntityRenderer; import net.minecraft.client.render.entity.model.EntityModelLayers; -import net.minecraft.client.render.model.ModelLoader; +import net.minecraft.client.render.model.ModelBaker; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.component.DataComponentTypes; import net.minecraft.component.type.BannerPatternsComponent; @@ -48,8 +48,8 @@ public TooltipComponent getComponent() { } @Override - public int getHeight() { - return 32 * 5 - 2; + public int getHeight(TextRenderer textRenderer) { + return 32 * 5 -2; } @Override @@ -58,7 +58,7 @@ public int getWidth(TextRenderer textRenderer) { } @Override - public void drawItems(TextRenderer textRenderer, int x, int y, DrawContext context) { + public void drawItems(TextRenderer textRenderer, int x, int y, int width, int height, DrawContext context) { DiffuseLighting.disableGuiDepthLighting(); MatrixStack matrices = context.getMatrices(); matrices.push(); @@ -80,7 +80,7 @@ public void drawItems(TextRenderer textRenderer, int x, int y, DrawContext conte 0xF000F0, OverlayTexture.DEFAULT_UV, bannerField, - ModelLoader.BANNER_BASE, + ModelBaker.BANNER_BASE, true, color, patterns diff --git a/src/main/java/meteordevelopment/meteorclient/utils/tooltip/BookTooltipComponent.java b/src/main/java/meteordevelopment/meteorclient/utils/tooltip/BookTooltipComponent.java index feaef6575b..b7e2ce6893 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/tooltip/BookTooltipComponent.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/tooltip/BookTooltipComponent.java @@ -5,11 +5,10 @@ package meteordevelopment.meteorclient.utils.tooltip; -import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.tooltip.TooltipComponent; -import net.minecraft.client.render.GameRenderer; +import net.minecraft.client.render.RenderLayer; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.OrderedText; import net.minecraft.text.Text; @@ -30,7 +29,7 @@ public TooltipComponent getComponent() { } @Override - public int getHeight() { + public int getHeight(TextRenderer textRenderer) { return 134; } @@ -40,10 +39,9 @@ public int getWidth(TextRenderer textRenderer) { } @Override - public void drawItems(TextRenderer textRenderer, int x, int y, DrawContext context) { + public void drawItems(TextRenderer textRenderer, int x, int y, int width, int height, DrawContext context) { // Background - RenderSystem.setShader(GameRenderer::getPositionTexProgram); - context.drawTexture(TEXTURE_BOOK_BACKGROUND, x, y, 0, 12, 0, 112, 134, 179, 179); + context.drawTexture(RenderLayer::getGuiTextured, TEXTURE_BOOK_BACKGROUND, x, y, 0, 12, 0, 112, 134, 179, 179); // Content MatrixStack matrices = context.getMatrices(); diff --git a/src/main/java/meteordevelopment/meteorclient/utils/tooltip/ContainerTooltipComponent.java b/src/main/java/meteordevelopment/meteorclient/utils/tooltip/ContainerTooltipComponent.java index 13c964d520..dd2ff9f93b 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/tooltip/ContainerTooltipComponent.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/tooltip/ContainerTooltipComponent.java @@ -12,7 +12,7 @@ import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.tooltip.TooltipComponent; -import net.minecraft.client.render.GameRenderer; +import net.minecraft.client.render.RenderLayer; import net.minecraft.item.ItemStack; import net.minecraft.util.Identifier; @@ -33,7 +33,7 @@ public TooltipComponent getComponent() { } @Override - public int getHeight() { + public int getHeight(TextRenderer textRenderer) { return 67; } @@ -43,12 +43,11 @@ public int getWidth(TextRenderer textRenderer) { } @Override - public void drawItems(TextRenderer textRenderer, int x, int y, DrawContext context) { + public void drawItems(TextRenderer textRenderer, int x, int y, int width, int height, DrawContext context) { // Background - RenderSystem.setShader(GameRenderer::getPositionTexProgram); RenderSystem.setShaderColor(color.r / 255f, color.g / 255f, color.b / 255f, color.a / 255f); - context.drawTexture(TEXTURE_CONTAINER_BACKGROUND, x, y, 0, 0, 0, 176, 67, 176, 67); + context.drawTexture(RenderLayer::getGuiTextured, TEXTURE_CONTAINER_BACKGROUND, x, y, 0, 0, 0, 176, 67, 176, 67); RenderSystem.setShaderColor(1, 1, 1, 1); //Contents diff --git a/src/main/java/meteordevelopment/meteorclient/utils/tooltip/EntityTooltipComponent.java b/src/main/java/meteordevelopment/meteorclient/utils/tooltip/EntityTooltipComponent.java index a980777133..c38835c164 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/tooltip/EntityTooltipComponent.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/tooltip/EntityTooltipComponent.java @@ -36,7 +36,7 @@ public TooltipComponent getComponent() { } @Override - public int getHeight() { + public int getHeight(TextRenderer textRenderer) { return 24; } @@ -46,7 +46,7 @@ public int getWidth(TextRenderer textRenderer) { } @Override - public void drawItems(TextRenderer textRenderer, int x, int y, DrawContext context) { + public void drawItems(TextRenderer textRenderer, int x, int y, int width, int height, DrawContext context) { MatrixStack matrices = context.getMatrices(); matrices.push(); matrices.translate(15, 2, 0); @@ -86,7 +86,7 @@ protected void renderEntity(MatrixStack matrices, int x, int y) { VertexConsumerProvider.Immediate immediate = mc.getBufferBuilders().getEntityVertexConsumers(); entity.age = mc.player.age; entity.setCustomNameVisible(false); - entityRenderDispatcher.render(entity, 0, 0, 0, 0.f, 1.f, matrices, immediate, 15728880); + entityRenderDispatcher.render(entity, 0, 0, 0, 1.f, matrices, immediate, 15728880); immediate.draw(); entityRenderDispatcher.setRenderShadows(true); matrices.pop(); diff --git a/src/main/java/meteordevelopment/meteorclient/utils/tooltip/MapTooltipComponent.java b/src/main/java/meteordevelopment/meteorclient/utils/tooltip/MapTooltipComponent.java index 651f8fe278..a7ef3ce1ae 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/tooltip/MapTooltipComponent.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/tooltip/MapTooltipComponent.java @@ -5,13 +5,13 @@ package meteordevelopment.meteorclient.utils.tooltip; -import com.mojang.blaze3d.systems.RenderSystem; import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.render.BetterTooltips; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.tooltip.TooltipComponent; -import net.minecraft.client.render.GameRenderer; +import net.minecraft.client.render.MapRenderState; +import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.component.type.MapIdComponent; @@ -24,13 +24,14 @@ public class MapTooltipComponent implements TooltipComponent, MeteorTooltipData { private static final Identifier TEXTURE_MAP_BACKGROUND = Identifier.of("textures/map/map_background.png"); private final int mapId; + private final MapRenderState mapRenderState = new MapRenderState(); public MapTooltipComponent(int mapId) { this.mapId = mapId; } @Override - public int getHeight() { + public int getHeight(TextRenderer textRenderer) { double scale = Modules.get().get(BetterTooltips.class).mapsScale.get(); return (int) ((128 + 16) * scale) + 2; } @@ -47,7 +48,7 @@ public TooltipComponent getComponent() { } @Override - public void drawItems(TextRenderer textRenderer, int x, int y, DrawContext context) { + public void drawItems(TextRenderer textRenderer, int x, int y, int width, int height, DrawContext context) { double scale = Modules.get().get(BetterTooltips.class).mapsScale.get(); // Background @@ -56,8 +57,7 @@ public void drawItems(TextRenderer textRenderer, int x, int y, DrawContext conte matrices.translate(x, y, 0); matrices.scale((float) (scale) * 2, (float) (scale) * 2, 0); matrices.scale((64 + 8) / 64f, (64 + 8) / 64f, 0); - RenderSystem.setShader(GameRenderer::getPositionTexProgram); - context.drawTexture(TEXTURE_MAP_BACKGROUND, 0, 0, 0, 0, 0, 64, 64, 64, 64); + context.drawTexture(RenderLayer::getGuiTextured, TEXTURE_MAP_BACKGROUND, 0, 0, 0, 0, 0, 64, 64, 64, 64); matrices.pop(); // Contents @@ -68,7 +68,8 @@ public void drawItems(TextRenderer textRenderer, int x, int y, DrawContext conte matrices.translate(x, y, 0); matrices.scale((float) scale, (float) scale, 0); matrices.translate(8, 8, 0); - mc.gameRenderer.getMapRenderer().draw(matrices, consumer, new MapIdComponent(mapId), mapState, false, 0xF000F0); + mc.getMapRenderer().update(new MapIdComponent(mapId), mapState, mapRenderState); + mc.getMapRenderer().draw(mapRenderState, matrices, consumer, false, 0xF000F0); consumer.draw(); matrices.pop(); } diff --git a/src/main/java/meteordevelopment/meteorclient/utils/world/BlockIterator.java b/src/main/java/meteordevelopment/meteorclient/utils/world/BlockIterator.java index 89d192fda4..c0504fdcfd 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/world/BlockIterator.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/world/BlockIterator.java @@ -52,7 +52,7 @@ private static void onTick(TickEvent.Pre event) { for (int x = px - hRadius; x <= px + hRadius; x++) { for (int z = pz - hRadius; z <= pz + hRadius; z++) { for (int y = Math.max(mc.world.getBottomY(), py - vRadius); y <= py + vRadius; y++) { - if (y > mc.world.getTopY()) break; + if (y > mc.world.getHeight()) break; blockPos.set(x, y, z); BlockState blockState = mc.world.getBlockState(blockPos); diff --git a/src/main/java/meteordevelopment/meteorclient/utils/world/BlockUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/world/BlockUtils.java index c3a5ca04e6..129524417b 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/world/BlockUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/world/BlockUtils.java @@ -128,17 +128,17 @@ public static boolean place(BlockPos blockPos, Hand hand, int slot, boolean rota } public static void interact(BlockHitResult blockHitResult, Hand hand, boolean swing) { - boolean wasSneaking = mc.player.input.sneaking; - mc.player.input.sneaking = false; + boolean wasSneaking = mc.player.isSneaking(); + mc.player.setSneaking(false); ActionResult result = mc.interactionManager.interactBlock(mc.player, hand, blockHitResult); - if (result.shouldSwingHand()) { + if (result.isAccepted()) { if (swing) mc.player.swingHand(hand); else mc.getNetworkHandler().sendPacket(new HandSwingC2SPacket(hand)); } - mc.player.input.sneaking = wasSneaking; + mc.player.setSneaking(wasSneaking); } public static boolean canPlaceBlock(BlockPos blockPos, boolean checkEntities, Block block) { @@ -320,7 +320,7 @@ public static MobSpawn isValidMobSpawn(BlockPos blockPos, BlockState blockState, if (!topSurface(downState)) { if (downState.getCollisionShape(mc.world, down) != VoxelShapes.fullCube()) return MobSpawn.Never; - if (downState.isTransparent(mc.world, down)) return MobSpawn.Never; + if (downState.isTransparent()) return MobSpawn.Never; } if (mc.world.getLightLevel(LightType.BLOCK, blockPos) > spawnLightLimit) return MobSpawn.Never; @@ -399,7 +399,7 @@ private static double getBlockBreakingSpeed(int slot, BlockState block) { } if (mc.player.isSubmergedIn(FluidTags.WATER)) { - speed *= mc.player.getAttributeValue(EntityAttributes.PLAYER_SUBMERGED_MINING_SPEED); + speed *= mc.player.getAttributeValue(EntityAttributes.SUBMERGED_MINING_SPEED); } if (!mc.player.isOnGround()) { diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 7e51d8e8f0..3c24487f47 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -44,7 +44,7 @@ }, "depends": { "java": ">=21", - "minecraft": ["1.21", "${minecraft_version}"], + "minecraft": ["1.21.2", "${minecraft_version}"], "fabricloader": ">=${loader_version}" }, "breaks": { @@ -52,7 +52,7 @@ "feather": "*", "origins": "*", "wurst": "*", - "sodium": "<0.6.0-beta.2", + "sodium": "<0.6.0", "morechathistory": "*" } } diff --git a/src/main/resources/meteor-client.accesswidener b/src/main/resources/meteor-client.accesswidener index 15a8b56f6c..6d1b444d9a 100644 --- a/src/main/resources/meteor-client.accesswidener +++ b/src/main/resources/meteor-client.accesswidener @@ -1,7 +1,6 @@ accessWidener v1 named accessible class net/minecraft/client/texture/PlayerSkinProvider$FileCache -accessible class net/minecraft/client/render/RenderLayer$OutlineMode accessible class net/minecraft/client/particle/FireworksSparkParticle$Explosion accessible class net/minecraft/network/packet/c2s/play/PlayerInteractEntityC2SPacket$InteractType accessible class net/minecraft/network/packet/c2s/play/PlayerInteractEntityC2SPacket$InteractAtHandler @@ -10,60 +9,11 @@ accessible class net/minecraft/client/world/ClientChunkManager$ClientChunkMa accessible field net/minecraft/client/network/AbstractClientPlayerEntity playerListEntry Lnet/minecraft/client/network/PlayerListEntry; -accessible field net/minecraft/client/model/ModelPart cuboids Ljava/util/List; -accessible field net/minecraft/client/model/ModelPart children Ljava/util/Map; -accessible class net/minecraft/client/model/ModelPart$Quad -accessible class net/minecraft/client/model/ModelPart$Vertex -accessible field net/minecraft/client/model/ModelPart$Cuboid sides [Lnet/minecraft/client/model/ModelPart$Quad; -accessible method net/minecraft/client/render/entity/PlayerEntityRenderer getArmPose (Lnet/minecraft/client/network/AbstractClientPlayerEntity;Lnet/minecraft/util/Hand;)Lnet/minecraft/client/render/entity/model/BipedEntityModel$ArmPose; -accessible method net/minecraft/client/render/entity/LivingEntityRenderer setupTransforms (Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/client/util/math/MatrixStack;FFFF)V -accessible method net/minecraft/client/render/entity/LivingEntityRenderer scale (Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/client/util/math/MatrixStack;F)V -accessible method net/minecraft/client/render/entity/LivingEntityRenderer getAnimationProgress (Lnet/minecraft/entity/LivingEntity;F)F +accessible method net/minecraft/client/render/entity/EntityRenderDispatcher render (Lnet/minecraft/entity/Entity;DDDFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/client/render/entity/EntityRenderer;)V -accessible field net/minecraft/client/render/entity/model/AnimalModel headScaled Z -accessible field net/minecraft/client/render/entity/model/AnimalModel childHeadYOffset F -accessible field net/minecraft/client/render/entity/model/AnimalModel childHeadZOffset F -accessible field net/minecraft/client/render/entity/model/AnimalModel invertedChildHeadScale F -accessible field net/minecraft/client/render/entity/model/AnimalModel invertedChildBodyScale F -accessible field net/minecraft/client/render/entity/model/AnimalModel childBodyYOffset F -accessible method net/minecraft/client/render/entity/model/AnimalModel getHeadParts ()Ljava/lang/Iterable; -accessible method net/minecraft/client/render/entity/model/AnimalModel getBodyParts ()Ljava/lang/Iterable; +accessible class net/minecraft/client/texture/MapTextureManager$MapTexture +accessible field net/minecraft/client/texture/MapTextureManager$MapTexture texture Lnet/minecraft/client/texture/NativeImageBackedTexture; -accessible field net/minecraft/client/render/entity/model/LlamaEntityModel head Lnet/minecraft/client/model/ModelPart; -accessible field net/minecraft/client/render/entity/model/LlamaEntityModel body Lnet/minecraft/client/model/ModelPart; -accessible field net/minecraft/client/render/entity/model/LlamaEntityModel rightHindLeg Lnet/minecraft/client/model/ModelPart; -accessible field net/minecraft/client/render/entity/model/LlamaEntityModel leftHindLeg Lnet/minecraft/client/model/ModelPart; -accessible field net/minecraft/client/render/entity/model/LlamaEntityModel rightFrontLeg Lnet/minecraft/client/model/ModelPart; -accessible field net/minecraft/client/render/entity/model/LlamaEntityModel leftFrontLeg Lnet/minecraft/client/model/ModelPart; -accessible field net/minecraft/client/render/entity/model/LlamaEntityModel rightChest Lnet/minecraft/client/model/ModelPart; -accessible field net/minecraft/client/render/entity/model/LlamaEntityModel leftChest Lnet/minecraft/client/model/ModelPart; - -accessible field net/minecraft/client/render/entity/model/RabbitEntityModel leftHindLeg Lnet/minecraft/client/model/ModelPart; -accessible field net/minecraft/client/render/entity/model/RabbitEntityModel rightHindLeg Lnet/minecraft/client/model/ModelPart; -accessible field net/minecraft/client/render/entity/model/RabbitEntityModel leftHaunch Lnet/minecraft/client/model/ModelPart; -accessible field net/minecraft/client/render/entity/model/RabbitEntityModel rightHaunch Lnet/minecraft/client/model/ModelPart; -accessible field net/minecraft/client/render/entity/model/RabbitEntityModel body Lnet/minecraft/client/model/ModelPart; -accessible field net/minecraft/client/render/entity/model/RabbitEntityModel leftFrontLeg Lnet/minecraft/client/model/ModelPart; -accessible field net/minecraft/client/render/entity/model/RabbitEntityModel rightFrontLeg Lnet/minecraft/client/model/ModelPart; -accessible field net/minecraft/client/render/entity/model/RabbitEntityModel head Lnet/minecraft/client/model/ModelPart; -accessible field net/minecraft/client/render/entity/model/RabbitEntityModel rightEar Lnet/minecraft/client/model/ModelPart; -accessible field net/minecraft/client/render/entity/model/RabbitEntityModel leftEar Lnet/minecraft/client/model/ModelPart; -accessible field net/minecraft/client/render/entity/model/RabbitEntityModel tail Lnet/minecraft/client/model/ModelPart; -accessible field net/minecraft/client/render/entity/model/RabbitEntityModel nose Lnet/minecraft/client/model/ModelPart; - -accessible field net/minecraft/client/render/entity/EndCrystalEntityRenderer SINE_45_DEGREES F -accessible field net/minecraft/client/render/entity/EndCrystalEntityRenderer core Lnet/minecraft/client/model/ModelPart; -accessible field net/minecraft/client/render/entity/EndCrystalEntityRenderer frame Lnet/minecraft/client/model/ModelPart; -accessible field net/minecraft/client/render/entity/EndCrystalEntityRenderer bottom Lnet/minecraft/client/model/ModelPart; - -accessible field net/minecraft/client/render/entity/BoatEntityRenderer texturesAndModels Ljava/util/Map; - -accessible class net/minecraft/client/render/MapRenderer$MapTexture -accessible field net/minecraft/client/render/MapRenderer$MapTexture texture Lnet/minecraft/client/texture/NativeImageBackedTexture; - -accessible class net/minecraft/client/option/SimpleOption$Callbacks - -accessible class net/minecraft/client/gui/screen/ingame/BeaconScreen$BeaconButtonWidget accessible class net/minecraft/client/gui/screen/ingame/BeaconScreen$EffectButtonWidget accessible class net/minecraft/client/resource/ResourceReloadLogger$ReloadState @@ -73,7 +23,9 @@ accessible field net/minecraft/util/math/Direction HORIZONTAL [Lnet/minecraf accessible field net/minecraft/item/ItemGroups INVENTORY Lnet/minecraft/registry/RegistryKey; -accessible field net/minecraft/client/render/item/ItemRenderer TRIDENT Lnet/minecraft/client/util/ModelIdentifier; -accessible field net/minecraft/client/render/item/ItemRenderer SPYGLASS Lnet/minecraft/client/util/ModelIdentifier; - accessible class net/minecraft/entity/effect/StatusEffect$EffectAttributeModifierCreator + +accessible class net/minecraft/client/render/RenderLayer$MultiPhase +accessible field net/minecraft/client/render/RenderPhase ITEM_ENTITY_TARGET Lnet/minecraft/client/render/RenderPhase$Target; +accessible class net/minecraft/client/render/RenderLayer$MultiPhaseParameters +accessible class net/minecraft/client/render/RenderPhase$Target diff --git a/src/main/resources/meteor-client.mixins.json b/src/main/resources/meteor-client.mixins.json index 414a0b9a23..37a8dc2830 100644 --- a/src/main/resources/meteor-client.mixins.json +++ b/src/main/resources/meteor-client.mixins.json @@ -7,6 +7,7 @@ "AbstractBlockAccessor", "AbstractBlockMixin", "AbstractBlockStateMixin", + "AbstractBoatEntityMixin", "AbstractClientPlayerEntityMixin", "AbstractFurnaceScreenHandlerMixin", "AbstractFurnaceScreenMixin", @@ -29,7 +30,6 @@ "BlockModelRendererMixin", "BlockRenderManagerMixin", "BlockStateMixin", - "BoatEntityMixin", "BookEditScreenMixin", "BookScreenMixin", "BossBarHudMixin", @@ -77,6 +77,7 @@ "DyedColorComponentMixin", "ElytraFeatureRendererMixin", "EnchantingTableBlockEntityRendererMixin", + "EndCrystalEntityModelMixin", "EndCrystalEntityRendererMixin", "EntityAccessor", "EntityBucketItemAccessor", @@ -84,9 +85,9 @@ "EntityMixin", "EntityRenderDispatcherMixin", "EntityRendererMixin", + "EntityRenderStateMixin", "EntityTrackingSectionAccessor", "EntityVelocityUpdateS2CPacketAccessor", - "ExplosionMixin", "ExplosionS2CPacketMixin", "FileCacheAccessor", "FireworkRocketEntityMixin", @@ -106,7 +107,6 @@ "InGameHudMixin", "InGameOverlayRendererMixin", "ItemEnchantmentsComponentMixin", - "ItemEntityMixin", "ItemEntityRendererMixin", "ItemGroupsMixin", "ItemMixin", @@ -121,14 +121,17 @@ "LivingEntityAccessor", "LivingEntityMixin", "LivingEntityRendererMixin", - "MapRendererAccessor", "MapRendererMixin", + "MapTextureManagerAccessor", "MessageHandlerMixin", "MinecraftClientAccessor", "MinecraftClientMixin", "MinecraftServerAccessor", + "MiningToolItemMixin", "MobSpawnerBlockEntityRendererMixin", "MouseMixin", + "MultiPhaseMixin", + "MultiPhaseParametersMixin", "MultiplayerScreenMixin", "MutableTextMixin", "PacketByteBufMixin", @@ -141,7 +144,6 @@ "PlayerListHudMixin", "PlayerMoveC2SPacketAccessor", "PlayerMoveC2SPacketMixin", - "PlayerPositionLookS2CPacketAccessor", "PlayerSkinProviderAccessor", "PowderSnowBlockMixin", "ProjectileEntityAccessor", @@ -154,12 +156,14 @@ "ResourceReloadLoggerAccessor", "ScreenMixin", "SectionedEntityCacheAccessor", + "ServerPlayerEntityMixin", "ServerResourcePackLoaderMixin", "ShapeIndexBufferAccessor", "ShulkerBoxBlockMixin", "SignBlockEntityRendererMixin", "SimpleEntityLookupAccessor", "SimpleOptionMixin", + "SkyRenderingMixin", "SlimeBlockMixin", "SlotMixin", "SoundSystemMixin",