Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
397 commits
Select commit Hold shift + click to select a range
e5ac786
Fix merge issues
Avanatiker Apr 17, 2025
7b99509
rotations fix for placements
beanbag44 Apr 17, 2025
bbdbd4d
Merge remote-tracking branch 'origin/feature/packetmine-rewrite' into…
beanbag44 Apr 17, 2025
aa57f9b
Remove "smart" pathing for now
Avanatiker Apr 17, 2025
ada6fa2
Revert "rotations fix for placements"
beanbag44 Apr 18, 2025
d7cd202
use receive instead of send for PlayerPositionLookS2CPacket reset
beanbag44 Apr 18, 2025
c59b824
fix small BreakManager oversight
beanbag44 Apr 18, 2025
b267a79
rotations fix!!!
beanbag44 Apr 18, 2025
38a5fc0
previous rotation direction checks in build sim
beanbag44 Apr 19, 2025
67c6f26
add todo in PlaceContext
beanbag44 Apr 19, 2025
e7c7990
rotations for instant breakable blocks
beanbag44 Apr 20, 2025
8ebfb17
currentDirIsInvalid check before calculating axis rotation
beanbag44 Apr 20, 2025
d3eda36
use players rotation first rather than current rotation
beanbag44 Apr 20, 2025
2ec256d
use current rotation rather than player rotation when checking the va…
beanbag44 Apr 20, 2025
ad9b456
fix rotations being reset causing incorrect placements
beanbag44 Apr 22, 2025
3df3485
cleaned up some code
emyfops Apr 25, 2025
bc883f8
return foreach instead of run and remove context sorting from the man…
beanbag44 Apr 25, 2025
f398a32
Use event tick stages
emyfops Apr 26, 2025
8a0cb5b
got something working ish but i hate it in many, many ways
beanbag44 Apr 28, 2025
e9db1aa
locks to yaw boundaries however pitch is still hard coded to 90, 0, -90
beanbag44 Apr 29, 2025
a358fca
Merge remote-tracking branch 'origin/feature/packetmine-rewrite' into…
beanbag44 Apr 29, 2025
93c5831
test players rotation before simulating axis rotations
beanbag44 May 1, 2025
240533e
cancel on tick post if not updated
beanbag44 May 1, 2025
d1d6568
fixed tick delay on break manager requests in PacketMine
beanbag44 May 1, 2025
7c8f3f3
Added inversed rotation method with unit tests
Avanatiker May 2, 2025
4492a04
start to re break implementation. Need to fix issue with managers cal…
beanbag44 May 2, 2025
0aeaece
Merge remote-tracking branch 'origin/feature/packetmine-rewrite' into…
beanbag44 May 2, 2025
49a5965
Fix package structure
Avanatiker May 2, 2025
03ba095
Use correct unit tests and fix algo
Avanatiker May 2, 2025
df00a6d
Merge remote-tracking branch 'origin/feature/packetmine-rewrite' into…
beanbag44 May 2, 2025
8221847
More extensive tests, removed up and down
Avanatiker May 2, 2025
1443cb5
manual rebreak touch ups and manager stage priority
beanbag44 May 4, 2025
68c8eec
Merge remote-tracking branch 'origin/feature/packetmine-rewrite' into…
beanbag44 May 4, 2025
c946eca
disallow vanilla instant breakables from re-break and cleanup
beanbag44 May 4, 2025
182485e
failing edge case unit test for PlaceDirection
beanbag44 May 5, 2025
5bd4985
input post event for updating break manager from packetmine module if…
beanbag44 May 5, 2025
64206d5
cancel break at the end of the tick if not updated
beanbag44 May 5, 2025
38a86e5
Maybe fix for snapToArea
Avanatiker May 5, 2025
c97d0cd
Merge remote-tracking branch 'origin/feature/packetmine-rewrite' into…
beanbag44 May 5, 2025
2e35391
PlaceDirection todo
beanbag44 May 6, 2025
5f7a85f
more PlaceDirection tests
beanbag44 May 6, 2025
a5096a2
better re-break setting and updatedThisTick check
beanbag44 May 6, 2025
50ae6d7
check updatedThisTick over activeAge
beanbag44 May 6, 2025
a018c9e
removed needless comma 🧌
beanbag44 May 6, 2025
4db79c6
automatic re-break
beanbag44 May 7, 2025
f878a53
ignore block updates / item drops in break manager if they match the …
beanbag44 May 7, 2025
d847675
call cancel callback if break times out
beanbag44 May 7, 2025
77101de
call onAccept if continued mining from rebreak
beanbag44 May 7, 2025
e0a95b2
packemine refactor and rebreak fixes
beanbag44 May 7, 2025
06c6a1b
Merge branch 'master' into feature/packetmine-rewrite
beanbag44 May 8, 2025
0aa3806
removed empty space at the top of the file
beanbag44 May 8, 2025
c930981
packetmine onDisable
beanbag44 May 8, 2025
c56cf10
Merge branch 'master' into feature/packetmine-rewrite
emyfops May 8, 2025
0f15b30
Generic events
emyfops May 8, 2025
ae3ae44
dont rotate for break by default
beanbag44 May 9, 2025
800cd68
reBreakMode in packetmine rather than break config
beanbag44 May 9, 2025
2faee16
Merge remote-tracking branch 'origin/feature/packetmine-rewrite' into…
beanbag44 May 9, 2025
439e414
correct config checks in packetmine
beanbag44 May 9, 2025
5de8935
cleaner configs idea
beanbag44 May 9, 2025
7f7040c
Revert "cleaner configs idea"
beanbag44 May 9, 2025
ab4917b
Removed TickStage in favor of TickEvent
emyfops May 9, 2025
f651714
reverted PlaceDirection back to cardinal snaps rather than area for now
beanbag44 May 9, 2025
99b40c9
Merge remote-tracking branch 'origin/feature/packetmine-rewrite' into…
beanbag44 May 9, 2025
7e820d4
fix oversight in PlaceDirection revert
beanbag44 May 10, 2025
dcd8a13
Merge branch 'master' into feature/packetmine-rewrite
beanbag44 May 11, 2025
adc8a42
removed outdated todo
beanbag44 May 11, 2025
61af38e
allow breaking with any tool with a setting for suitable only
beanbag44 May 14, 2025
d309ca1
queue and refactors
beanbag44 May 15, 2025
ef54193
queue sort setting
beanbag44 May 15, 2025
eb5e2f7
Merge branch 'master' into feature/packetmine-rewrite
beanbag44 May 16, 2025
f26320b
prevent blocking double break in the event the current secondary is p…
beanbag44 May 16, 2025
aa8f794
formatting
beanbag44 May 16, 2025
1938a2f
call cancelBreak instead of just sending an abort when overriding a p…
beanbag44 May 17, 2025
2683c5b
update breaks regardless if active request is null or not and return …
beanbag44 May 17, 2025
e07c829
added break radius for breaking a larger area at once with a single c…
beanbag44 May 17, 2025
22abb0f
include the hit pos in the positions for break radius > 0
beanbag44 May 17, 2025
11147d2
decoupled grouped area breaks and queue sorting
beanbag44 May 17, 2025
1b60759
fixed instability issue at slower rotation speeds when using a higher…
beanbag44 May 18, 2025
cd1231d
switched back to LinkedList from LinkedHashMap
beanbag44 May 18, 2025
6715b8b
switched back to LinkedList from LinkedHashSet
beanbag44 May 18, 2025
40ba329
Merge remote-tracking branch 'origin/feature/packetmine-rewrite' into…
beanbag44 May 18, 2025
6689f03
use active rotation for movement calculations as server rotation is o…
beanbag44 May 19, 2025
b6e7131
check breakCooldown before start breaking
beanbag44 May 19, 2025
d58efae
vanilla minecraft uses 6 tick break delay, adjusted the setting accor…
beanbag44 May 19, 2025
1288503
repeat the accept and start break cycle in case blocks are broken and…
beanbag44 May 20, 2025
f396c1e
add double break fudge factor setting
beanbag44 May 20, 2025
d586e2a
isSecondary or isRedundant
beanbag44 May 20, 2025
e47a99f
corrected hotbar keep ticks timing
beanbag44 May 22, 2025
d9408e3
aligned keep ticks timings
beanbag44 May 23, 2025
3166c0c
*almost* complete silent swap with double break and fixed listener i …
beanbag44 May 23, 2025
43f85c4
enable min swap ticks 1 tick before the block is considered expected …
beanbag44 May 24, 2025
bed22da
use calcItemBlockBreakingProgress when checking min keep ticks and sl…
beanbag44 May 27, 2025
56844cf
Merge branch 'master' into feature/packetmine-rewrite
beanbag44 May 27, 2025
61d6528
inventory manager start :doom:, and cleanup. Also moved the onStart c…
beanbag44 May 30, 2025
cd0cd7f
added todo
beanbag44 May 30, 2025
01df8aa
Revert "added todo"
beanbag44 May 30, 2025
7e5bcf6
Revert "inventory manager start :doom:, and cleanup. Also moved the o…
beanbag44 May 30, 2025
e1760ba
data objects for update manager events, moved on start callback above…
beanbag44 May 30, 2025
647cd42
forgot to remove settings in inventory settings
beanbag44 May 30, 2025
5a8588b
call onStop when the server breaks the block before the client too
beanbag44 May 30, 2025
f8371e3
avoid liquids setting
beanbag44 May 31, 2025
40f56ab
decouple fudge factor from double break to prevent desync when the di…
beanbag44 May 31, 2025
26b2d68
apply fudge factor to all breaks
beanbag44 May 31, 2025
f12aab3
moved manager utils into companion object in reuqest handler
beanbag44 May 31, 2025
36e0057
Revert "moved manager utils into companion object in reuqest handler"
beanbag44 May 31, 2025
df89d64
Update FastBreak.kt
emyfops May 31, 2025
023d6e6
Merge branch '1.21.5' into feature/packetmine-rewrite
emyfops May 31, 2025
6a51aca
make fudge factor affect everything
beanbag44 Jun 7, 2025
52428ee
looser redundant break handling when considered broken
beanbag44 Jun 8, 2025
6d40644
use isEmpty over isAir to account for waterloggable blocks
beanbag44 Jun 8, 2025
339f00d
better input sanitizing in break manager
beanbag44 Jun 8, 2025
95fbfcc
removed unnecessary todos
beanbag44 Jun 8, 2025
0c021c6
added break renders, currently only static however, so render at 20 fps
beanbag44 Jun 8, 2025
a6737f5
more specific break timeout warnings
beanbag44 Jun 8, 2025
a491145
build outlines for queued blocks
beanbag44 Jun 8, 2025
f3b4776
break request dsl builder
beanbag44 Jun 8, 2025
5fd5a05
arraylist over linkedlist to avoid excessive collection copying
beanbag44 Jun 9, 2025
341acb7
fixed issues with break radius / queue. Added onUpdate callback for b…
beanbag44 Jun 9, 2025
295d0f0
added desyncFix setting, although its functionality is broken until p…
beanbag44 Jun 16, 2025
bb4f6cb
baritone selection mode in nuker because i needed it
beanbag44 Jun 16, 2025
2c65434
added dsl for pre-processing info and expanded the pre-processors; re…
beanbag44 Jun 26, 2025
3feb026
simple module for printing every property coupled with every state im…
beanbag44 Jun 27, 2025
10bd793
added property ignores and more pre-processors
beanbag44 Jun 27, 2025
2ab4142
initial post-processing logic and interaction manager. Only has two h…
beanbag44 Jul 2, 2025
6d1ef93
build sim function signature cleanup and proper interaction related n…
beanbag44 Jul 3, 2025
ffd345f
use isEmpty and isNotEmpty over isAir
beanbag44 Jul 3, 2025
57570c0
use scan modes based on the block position rather than relative box d…
beanbag44 Jul 4, 2025
e325869
use the players regular position when simulating placements
beanbag44 Jul 4, 2025
2585445
cleaned up and removed essentially redundant context values
beanbag44 Jul 4, 2025
7dd5283
more cleanup
beanbag44 Jul 4, 2025
79799aa
remove problematic return if current dir was valid
beanbag44 Jul 5, 2025
14c8cd1
more cleanup
beanbag44 Jul 5, 2025
25c3b8d
move checkPostProcessResults invoke to the simulate function
beanbag44 Jul 5, 2025
3c6694f
inline checkPlaceOn as it's not suitable for slabs and potentially ot…
beanbag44 Jul 5, 2025
624e9ca
unused param
beanbag44 Jul 5, 2025
f1776a5
use direction entries rather than empty set for default PreProcessing…
beanbag44 Jul 5, 2025
dc7a2bf
filter interactions that collide with current pending interactions
beanbag44 Jul 5, 2025
d0d6452
update breaking on tick event input pre by default to please grim and…
beanbag44 Jul 5, 2025
bc54d80
await item instead of failing
beanbag44 Jul 6, 2025
0ecb949
check all other position blocking managers when accepting action requ…
beanbag44 Jul 7, 2025
2918f96
fix point selection optimum mode. Was calculating average vector hit …
beanbag44 Jul 8, 2025
c269194
null check on hit positions
beanbag44 Jul 8, 2025
140a17f
treat double slab placements like actual placements rather than inter…
beanbag44 Jul 8, 2025
fcc8860
allow use of the rest of the hotbar for placing
beanbag44 Jul 11, 2025
7e804e3
small cleanup
beanbag44 Jul 11, 2025
48cb6bf
OCD
Avanatiker Jul 11, 2025
46405bc
naming convention
beanbag44 Jul 12, 2025
df00f71
"WorldColors" as opposed to "World Colors"
beanbag44 Jul 12, 2025
1b253dd
AntiAim module and wrapping rotations
beanbag44 Jul 12, 2025
af1b01f
activeRotation over serverRotation for renders, and removed excess in…
beanbag44 Jul 12, 2025
1679832
interpolate between serverRotation and activeRotation, rather than pr…
beanbag44 Jul 12, 2025
e1ab355
use kotlin random
beanbag44 Jul 12, 2025
a5fd6f3
fix rotation render accuracy and potentially other issues
beanbag44 Jul 13, 2025
248c690
removed unused priority
beanbag44 Jul 13, 2025
69d3616
small nuker changes
beanbag44 Jul 13, 2025
fa9a42c
dont ignore break contexts that could potentially update current brea…
beanbag44 Jul 13, 2025
441a581
pages for break settings
beanbag44 Jul 13, 2025
196c979
brighter default render colours
beanbag44 Jul 13, 2025
e82bb80
post-processing property checks on break manager block updates and ad…
beanbag44 Jul 13, 2025
4800ed2
default fudgeFactor to 1
beanbag44 Jul 13, 2025
5a2cf1f
check by not null count in PacketMine and account for multiple differ…
beanbag44 Jul 14, 2025
b4a0e13
disable finishOnDone for nuker
beanbag44 Jul 14, 2025
97c60d2
check break cooldown before accepting contexts and set cooldown if no…
beanbag44 Jul 14, 2025
1f63a8b
fixe for when unsafe cancels is disabled, and improvements for revivi…
beanbag44 Jul 14, 2025
afee12a
use max value for tick pre in break manager to get ahead of the reque…
beanbag44 Jul 14, 2025
b05a988
isAir check in updateBreakProgress to account for unloaded chunks and…
beanbag44 Jul 14, 2025
941b822
inlined usages of internalOnCancel
beanbag44 Jul 14, 2025
280e92e
missed an internalOnCancel
beanbag44 Jul 15, 2025
943d942
ActionInfo interface and PostActionHandler class to reduce duplicate …
beanbag44 Jul 15, 2025
f492c5a
fixed config variable in Request
beanbag44 Jul 15, 2025
d7a1715
linear renders accounting for fudge factor
beanbag44 Jul 15, 2025
c3ade02
dont call onCancel when abandoning as the break isnt actually cancell…
beanbag44 Jul 15, 2025
7b0c246
was dumb and didnt fix renders the way i thought i did. Also only res…
beanbag44 Jul 15, 2025
165de50
swing hand type setting for interactions
beanbag44 Jul 16, 2025
fe14b56
omit top half DOUBLE_BLOCK_HALF property holders
beanbag44 Jul 16, 2025
837f5a9
separated interact settings into their own page in the build config a…
beanbag44 Jul 16, 2025
e0c55e7
start to an inventory manager
beanbag44 Jul 16, 2025
bb99955
instant client sided changes for swapping hand stacks
beanbag44 Jul 18, 2025
ff6b87b
better avoidLiquids logic
beanbag44 Jul 18, 2025
de62f07
fixed disposables logic. Was using >= 0 rather than > 0
beanbag44 Jul 18, 2025
e19e5af
fillFluids setting in nuker and better fluid removal logic in build s…
beanbag44 Jul 18, 2025
48db547
fix supporting block checks? And add setting to toggle it
beanbag44 Jul 19, 2025
40022f9
comment out desyncFix for now as its broken and wont be fixed for a w…
beanbag44 Jul 19, 2025
0a6e7de
sorter setting for breaks
beanbag44 Jul 19, 2025
9483f60
stage checks when cancelling block breaks
beanbag44 Jul 19, 2025
01a095f
removed abort break packet usage entirely as it doesnt really do anyt…
beanbag44 Jul 19, 2025
ae73453
Merge branch 'master' into feature/packetmine-rewrite
beanbag44 Jul 22, 2025
b5bc2b4
RequestConfig refactor and submitting from the request itself rather …
beanbag44 Jul 23, 2025
441d4b9
secondary request submit function for usage diversity
beanbag44 Jul 23, 2025
1b70a1a
remove priority typealias
beanbag44 Jul 23, 2025
771469d
consistent confirmation checks for block updates in the managers
beanbag44 Jul 23, 2025
52843b6
equality check over elvis
beanbag44 Jul 23, 2025
2427e33
nest the BreakRequestBuilder annotation class
beanbag44 Jul 23, 2025
56a2abf
decrement item stack even if awaiting before client placement
beanbag44 Jul 25, 2025
c663685
Merge branch 'master' into feature/packetmine-rewrite
beanbag44 Jul 25, 2025
e5d64c4
compile time fixes
beanbag44 Jul 26, 2025
b02a452
undo small "fix" i made because it wasnt broken to begin with and i b…
beanbag44 Jul 26, 2025
3b445f2
improve block update checks in managers
beanbag44 Jul 26, 2025
b5d57bb
override load function over init
beanbag44 Jul 26, 2025
2da4cef
make manager swing hand more consistent with the view model no swing …
beanbag44 Jul 26, 2025
5e266e3
update cancels on each stage close with mask checks
beanbag44 Jul 27, 2025
7928d32
remove input pre break stage mask from defaults
beanbag44 Jul 27, 2025
41f69ef
tick stage check and abort packet when cancelling primary breaks
beanbag44 Jul 27, 2025
a0cca20
use break manager for fast break
beanbag44 Jul 27, 2025
314409f
show interpolated renders between current and predicted next tick pro…
beanbag44 Jul 30, 2025
05afa47
check entity before setting pitch lol
beanbag44 Jul 30, 2025
0d57201
use sequences in the breakContexts function to limit collection creat…
beanbag44 Jul 30, 2025
bacff64
break settings re-order
beanbag44 Jul 30, 2025
f471659
ignore break attempts at already secondary breaking blocks
beanbag44 Jul 30, 2025
157e466
add closest option for queue and render the order colours using the s…
beanbag44 Jul 30, 2025
5bc4afd
use main hand stack if nothing else is faster rather than first hotba…
beanbag44 Jul 30, 2025
a5dc330
fix impossible failure and use the accurate wrong stack result
beanbag44 Jul 30, 2025
a9663e8
cleanup on tick pre in the post action handlers
beanbag44 Jul 30, 2025
7f78b68
only place shulkers on our y level until we can check where we can pa…
beanbag44 Jul 30, 2025
c28e38b
use ticking blueprints for placing containers
beanbag44 Jul 31, 2025
ae45467
pending interaction checks in PlaceContainer
beanbag44 Jul 31, 2025
674db53
remove input pre in default hotbar stage mask setting
beanbag44 Aug 1, 2025
e463725
selection and speed checks rather than slot comparison for new breaks
beanbag44 Aug 1, 2025
2f28e0a
generally prefer primary breaks item stack for usage, but secondary f…
beanbag44 Aug 2, 2025
7ac8925
more details in break info warnings and allow any block as long as it…
beanbag44 Aug 2, 2025
3515c29
redundancy improvements
beanbag44 Aug 2, 2025
4b6f410
subject currently held item to the same scrutiny as other items
beanbag44 Aug 2, 2025
37786be
swap mode setting
beanbag44 Aug 3, 2025
d6601c4
rebreak adjustments
beanbag44 Aug 4, 2025
232c217
move re break checks to the processRequest function and decouple chec…
beanbag44 Aug 4, 2025
98561c2
use updatableLazy
beanbag44 Aug 4, 2025
d8de058
fluid check to prevent placing when not necessary
beanbag44 Aug 4, 2025
49d6e9f
use main hand stack for render progress when swap mode is set to star…
beanbag44 Aug 4, 2025
445f360
move rebreak logic into startBreaking function to account for instant…
beanbag44 Aug 4, 2025
be7fd72
Merge branch 'feature/packetmine-rewrite' of https://github.com/Avana…
emyfops Aug 5, 2025
b55cade
My changes from a long time ago
emyfops Aug 5, 2025
19d0cc7
Merge branch '1.21.5' into feature/packetmine-rewrite
emyfops Aug 5, 2025
2dad5ca
changes
emyfops Aug 6, 2025
5d060fb
cap texture overlay progress at 9
beanbag44 Aug 8, 2025
84f1513
tick stage check in shouldSwap
beanbag44 Aug 8, 2025
7a102e9
move shouldProgress into its own variable for use in swap checks
beanbag44 Aug 8, 2025
9df5ac4
almost working block break speed. Might need to rework the hotbar man…
beanbag44 Aug 8, 2025
eedafd9
add FixMe's to HotbarManager and EnchantmentUtils
beanbag44 Aug 8, 2025
c2f2ec1
player.mainHandStack and, in theory, all other references to the play…
beanbag44 Aug 8, 2025
6bf0c26
removed FixMe
beanbag44 Aug 8, 2025
1285ae0
only snap to area if the players current rotation isn't in the desire…
beanbag44 Aug 8, 2025
10bf9cd
Fixed enchantment functions
emyfops Aug 9, 2025
52b051a
no silent swapping for primary breaks
beanbag44 Aug 9, 2025
ab92486
default fudge factor to 2
beanbag44 Aug 9, 2025
30e1beb
efficiency check for minKeepTicks
beanbag44 Aug 10, 2025
8c3324d
fix nuker
beanbag44 Aug 10, 2025
3253c5c
fix conflicts
beanbag44 Aug 12, 2025
46df050
Merge branch '1.21.5' into feature/packetmine-rewrite
Avanatiker Aug 12, 2025
adfbb46
more goofy not working fixes
beanbag44 Aug 12, 2025
8734884
Fixed grouping
Avanatiker Aug 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 56 additions & 17 deletions src/main/java/com/lambda/mixin/MinecraftClientMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,51 +24,82 @@
import com.lambda.event.events.TickEvent;
import com.lambda.gui.DearImGui;
import com.lambda.module.modules.player.Interact;
import com.lambda.module.modules.player.PacketMine;
import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.RunArgs;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.ingame.ScreenHandlerProvider;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.network.ClientPlayerInteractionManager;
import net.minecraft.client.util.Window;
import net.minecraft.client.render.WorldRenderer;
import net.minecraft.client.sound.SoundManager;
import net.minecraft.util.thread.ThreadExecutor;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.HitResult;
import org.jetbrains.annotations.Nullable;
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.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(MinecraftClient.class)
@Mixin(value = MinecraftClient.class, priority = Integer.MAX_VALUE)
public class MinecraftClientMixin {
@Shadow
@Nullable
public Screen currentScreen;
@Shadow
@Nullable
public HitResult crosshairTarget;

@Inject(method = "close", at = @At("HEAD"))
void closeImGui(CallbackInfo ci) {
DearImGui.INSTANCE.destroy();
}

@Inject(method = "tick", at = @At("HEAD"))
void onTickPre(CallbackInfo ci) {
EventFlow.post(new TickEvent.Pre());
@WrapMethod(method = "render")
void onLoopTick(boolean tick, Operation<Void> original) {
EventFlow.post(TickEvent.Render.Pre.INSTANCE);
original.call(tick);
EventFlow.post(TickEvent.Render.Post.INSTANCE);
}

@Inject(method = "tick", at = @At("RETURN"))
void onTickPost(CallbackInfo ci) {
EventFlow.post(new TickEvent.Post());
@WrapMethod(method = "tick")
void onTick(Operation<Void> original) {
EventFlow.post(TickEvent.Pre.INSTANCE);
original.call();
EventFlow.post(TickEvent.Post.INSTANCE);
}

@Inject(method = "render", at = @At("HEAD"))
void onLoopTickPre(CallbackInfo ci) {
EventFlow.post(new TickEvent.Render.Pre());
@WrapOperation(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;tick()V"))
void onNetwork(ClientPlayerInteractionManager instance, Operation<Void> original) {
EventFlow.post(TickEvent.Network.Pre.INSTANCE);
original.call(instance);
EventFlow.post(TickEvent.Network.Post.INSTANCE);
}

@Inject(method = "render", at = @At("RETURN"))
void onLoopTickPost(CallbackInfo ci) {
EventFlow.post(new TickEvent.Render.Post());
@WrapOperation(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;handleInputEvents()V"))
void onInput(MinecraftClient instance, Operation<Void> original) {
EventFlow.post(TickEvent.Input.Pre.INSTANCE);
original.call(instance);
EventFlow.post(TickEvent.Input.Post.INSTANCE);
}

@WrapOperation(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;tick()V"))
void onWorldRenderer(WorldRenderer instance, Operation<Void> original) {
EventFlow.post(TickEvent.WorldRender.Pre.INSTANCE);
original.call(instance);
EventFlow.post(TickEvent.WorldRender.Post.INSTANCE);
}

@WrapOperation(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/sound/SoundManager;tick(Z)V"))
void onSound(SoundManager instance, boolean paused, Operation<Void> original) {
EventFlow.post(TickEvent.Sound.Pre.INSTANCE);
original.call(instance, paused);
EventFlow.post(TickEvent.Sound.Post.INSTANCE);
}

@Inject(at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;info(Ljava/lang/String;)V", shift = At.Shift.AFTER, remap = false), method = "stop")
Expand Down Expand Up @@ -100,8 +131,16 @@ private void onScreenRemove(@Nullable Screen screen, CallbackInfo ci) {
}
}

@Redirect(method = "doAttack()Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;swingHand(Lnet/minecraft/util/Hand;)V"))
private void redirectHandSwing(ClientPlayerEntity instance, Hand hand) {
if (this.crosshairTarget == null) return;
if (this.crosshairTarget.getType() != HitResult.Type.BLOCK || PacketMine.INSTANCE.isDisabled()) {
instance.swingHand(hand);
}
}

@Redirect(method = "doItemUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;isBreakingBlock()Z"))
boolean injectMultiActon(ClientPlayerInteractionManager instance) {
boolean redirectMultiActon(ClientPlayerInteractionManager instance) {
if (instance == null) return true;

if (Interact.INSTANCE.isEnabled() && Interact.getMultiAction()) return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import baritone.Baritone;
import baritone.api.utils.Rotation;
import baritone.utils.player.BaritonePlayerContext;
import com.lambda.interaction.request.rotation.RotationManager;
import com.lambda.interaction.request.rotating.RotationManager;
import com.lambda.util.BaritoneUtils;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
Expand All @@ -42,7 +42,7 @@ void syncRotationWithBaritone(CallbackInfoReturnable<Rotation> cir) {

RotationManager rm = RotationManager.INSTANCE;
cir.setReturnValue(new Rotation(
(float) rm.getCurrentRotation().getYaw(), (float) rm.getCurrentRotation().getPitch())
(float) rm.getActiveRotation().getYaw(), (float) rm.getActiveRotation().getPitch())
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import baritone.api.event.events.RotationMoveEvent;
import baritone.api.utils.Rotation;
import baritone.behavior.LookBehavior;
import com.lambda.interaction.request.rotation.RotationManager;
import com.lambda.interaction.request.rotating.RotationManager;
import com.lambda.util.BaritoneUtils;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
Expand Down
35 changes: 19 additions & 16 deletions src/main/java/com/lambda/mixin/entity/ClientPlayerEntityMixin.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 Lambda
* Copyright 2025 Lambda
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -23,9 +23,11 @@
import com.lambda.event.events.PlayerEvent;
import com.lambda.event.events.TickEvent;
import com.lambda.interaction.PlayerPacketManager;
import com.lambda.interaction.request.rotation.RotationManager;
import com.lambda.interaction.request.rotating.RotationManager;
import com.lambda.module.modules.player.PortalGui;
import com.lambda.module.modules.render.ViewModel;
import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.mojang.authlib.GameProfile;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
Expand All @@ -51,6 +53,9 @@
@Mixin(value = ClientPlayerEntity.class, priority = Integer.MAX_VALUE)
public abstract class ClientPlayerEntityMixin extends AbstractClientPlayerEntity {

@Shadow
public Input input;

@Shadow
private boolean autoJumpEnabled;

Expand Down Expand Up @@ -90,6 +95,7 @@ void onMove(MovementType movementType, Vec3d movement, CallbackInfo ci) {
@Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/input/Input;tick()V"))
void processMovement(Input input) {
input.tick();
RotationManager.processRotations();
RotationManager.BaritoneProcessor.processPlayerMovement(input);
EventFlow.post(new MovementEvent.InputUpdate(input));
}
Expand Down Expand Up @@ -134,14 +140,11 @@ void sendBegin(CallbackInfo ci) {
autoJumpEnabled = Lambda.getMc().options.getAutoJump().getValue();
}

@Inject(method = "tick", at = @At(value = "HEAD"))
void onTickPre(CallbackInfo ci) {
EventFlow.post(new TickEvent.Player.Pre());
}

@Inject(method = "tick", at = @At(value = "RETURN"))
void onTickPost(CallbackInfo ci) {
EventFlow.post(new TickEvent.Player.Post());
@WrapMethod(method = "tick")
void onTick(Operation<Void> original) {
EventFlow.post(TickEvent.Player.Pre.INSTANCE);
original.call();
EventFlow.post(TickEvent.Player.Post.INSTANCE);
}

@Redirect(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;getYaw()F"))
Expand All @@ -155,15 +158,10 @@ float fixHeldItemPitch(ClientPlayerEntity instance) {
}

@Inject(method = "swingHand", at = @At("HEAD"), cancellable = true)
void onSwingHandPre(Hand hand, CallbackInfo ci) {
void onSwing(Hand hand, CallbackInfo ci) {
if (EventFlow.post(new PlayerEvent.SwingHand(hand)).isCanceled()) ci.cancel();
}

@Inject(method = "updateHealth", at = @At("HEAD"))
public void damage(float health, CallbackInfo ci) {
EventFlow.post(new PlayerEvent.Damage(health));
}

@Redirect(method = "swingHand", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/AbstractClientPlayerEntity;swingHand(Lnet/minecraft/util/Hand;)V"))
private void adjustSwing(AbstractClientPlayerEntity instance, Hand hand) {
ViewModel viewModel = ViewModel.INSTANCE;
Expand All @@ -176,6 +174,11 @@ private void adjustSwing(AbstractClientPlayerEntity instance, Hand hand) {
viewModel.adjustSwing(hand, instance);
}

@Inject(method = "updateHealth", at = @At("HEAD"))
public void damage(float health, CallbackInfo ci) {
EventFlow.post(new PlayerEvent.Damage(health));
}

/**
* Prevents the game from closing Guis when the player is in a nether portal
* <pre>{@code
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/lambda/mixin/entity/EntityMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import com.lambda.event.EventFlow;
import com.lambda.event.events.EntityEvent;
import com.lambda.event.events.PlayerEvent;
import com.lambda.interaction.request.rotation.RotationManager;
import com.lambda.interaction.request.rotating.RotationManager;
import com.lambda.util.math.Vec2d;
import net.minecraft.entity.Entity;
import net.minecraft.entity.MovementType;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/lambda/mixin/entity/LivingEntityMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import com.lambda.Lambda;
import com.lambda.event.EventFlow;
import com.lambda.event.events.MovementEvent;
import com.lambda.interaction.request.rotation.RotationManager;
import com.lambda.module.modules.render.ViewModel;
import com.lambda.interaction.request.rotating.RotationManager;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
Expand Down Expand Up @@ -128,7 +128,7 @@ private float rotBody(LivingEntity entity) {
return entity.getYaw();
}

Float yaw = RotationManager.getRenderYaw();
Float yaw = RotationManager.getHeadYaw();
return (yaw == null) ? entity.getYaw() : yaw;
}

Expand Down Expand Up @@ -159,7 +159,7 @@ private float rotHead(LivingEntity entity) {
return entity.getYaw();
}

Float yaw = RotationManager.getRenderYaw();
Float yaw = RotationManager.getHeadYaw();
return (yaw == null) ? entity.getYaw() : yaw;
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/lambda/mixin/entity/PlayerEntityMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import com.lambda.Lambda;
import com.lambda.event.EventFlow;
import com.lambda.event.events.MovementEvent;
import com.lambda.interaction.request.rotation.RotationManager;
import com.lambda.interaction.request.rotating.RotationManager;
import net.minecraft.entity.player.PlayerEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -42,7 +42,7 @@ private float injectHeadYaw(PlayerEntity instance) {
return instance.getYaw();
}

Float yaw = RotationManager.getRenderYaw();
Float yaw = RotationManager.getHeadYaw();
return (yaw != null) ? yaw : instance.getYaw();
}

Expand Down
40 changes: 16 additions & 24 deletions src/main/java/com/lambda/mixin/entity/PlayerInventoryMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,38 +17,30 @@

package com.lambda.mixin.entity;

import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayerInteractionManager;
import net.minecraft.entity.player.PlayerEntity;
import com.lambda.interaction.request.hotbar.HotbarManager;
import com.lambda.interaction.request.hotbar.HotbarRequest;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.collection.DefaultedList;
import org.spongepowered.asm.mixin.Final;
import org.objectweb.asm.Opcodes;
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.CallbackInfoReturnable;

import static net.minecraft.entity.player.PlayerInventory.isValidHotbarIndex;

@Mixin(PlayerInventory.class)
public class PlayerInventoryMixin {
@Shadow @Final private DefaultedList<ItemStack> main;

@Shadow @Final public PlayerEntity player;

@Inject(method = "getSelectedStack", at = @At(value = "HEAD"), cancellable = true)
public void handleSpoofedMainHandStack(CallbackInfoReturnable<ItemStack> cir) {
MinecraftClient mc = MinecraftClient.getInstance();
ClientPlayerInteractionManager interaction = mc.interactionManager;

if (player != mc.player || interaction == null) return;

int actualSlot = interaction.lastSelectedSlot;
@SuppressWarnings({"MixinAnnotationTarget", "UnresolvedMixinReference"})
@ModifyExpressionValue(method = "*", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/player/PlayerInventory;selectedSlot:I", opcode = Opcodes.GETFIELD))
private int modifySelectedSlot(int original) {
final HotbarRequest hotbarRequest = HotbarManager.INSTANCE.getActiveRequest();
if (hotbarRequest == null) return original;
return hotbarRequest.getSlot();
}

cir.setReturnValue(
isValidHotbarIndex(actualSlot) ? main.get(actualSlot) : ItemStack.EMPTY
);
@Inject(method = "getSelectedSlot", at = @At("HEAD"), cancellable = true)
private void redirectGetSelectedSlot(CallbackInfoReturnable<Integer> cir) {
final HotbarRequest hotbarRequest = HotbarManager.INSTANCE.getActiveRequest();
if (hotbarRequest == null) return;
cir.setReturnValue(hotbarRequest.getSlot());
}
}
2 changes: 1 addition & 1 deletion src/main/java/com/lambda/mixin/render/CameraMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package com.lambda.mixin.render;

import com.lambda.interaction.request.rotation.RotationManager;
import com.lambda.interaction.request.rotating.RotationManager;
import com.lambda.module.modules.player.Freecam;
import com.lambda.module.modules.render.CameraTweaks;
import com.lambda.module.modules.render.FreeLook;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@

package com.lambda.mixin.render;

import com.lambda.interaction.request.rotation.RotationManager;
import com.lambda.interaction.request.rotating.RotationManager;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import net.minecraft.client.render.entity.LivingEntityRenderer;
import net.minecraft.entity.LivingEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

import java.util.Objects;

Expand All @@ -48,6 +46,6 @@ public class LivingEntityRendererMixin {
*/
@ModifyExpressionValue(method = "updateRenderState(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/client/render/entity/state/LivingEntityRenderState;F)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;getLerpedPitch(F)F"))
private float injectRotationPitch(float original) {
return Objects.requireNonNullElse(RotationManager.getRenderPitch(), original);
return Objects.requireNonNullElse(RotationManager.getHeadPitch(), original);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ object TransferCommand : LambdaCommand(
val selection = selectStack(count) {
isItem(stack(ctx).value().item)
}
containerWithMaterial(selection).forEachIndexed { i, container ->
selection.containerWithMaterial().forEachIndexed { i, container ->
builder.suggest("\"${i + 1}. ${container.name}\"", container.description(selection))
}
builder.buildFuture()
Expand Down
4 changes: 4 additions & 0 deletions src/main/kotlin/com/lambda/config/AbstractSetting.kt
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ abstract class AbstractSetting<T : Any>(
listeners.add(ValueListener(false, block))
}

fun group(path: List<NamedEnum>, vararg continuation: NamedEnum) = apply {
groups.add(path + continuation)
}

fun group(vararg path: NamedEnum) = apply {
groups.add(path.toList())
}
Expand Down
Loading
Loading