Skip to content
Closed
Show file tree
Hide file tree
Changes from 30 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
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@

package com.lambda.mixin.entity;

import net.minecraft.block.BlockState;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayerInteractionManager;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
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.callback.CallbackInfoReturnable;
Expand All @@ -30,6 +34,8 @@

@Mixin(PlayerInventory.class)
public class PlayerInventoryMixin {
@Shadow @Final public PlayerEntity player;

@Inject(method = "getMainHandStack", at = @At(value = "HEAD"), cancellable = true)
public void handleSpoofedMainHandStack(CallbackInfoReturnable<ItemStack> cir) {
PlayerInventory instance = (PlayerInventory) (Object) this;
Expand All @@ -44,4 +50,9 @@ public void handleSpoofedMainHandStack(CallbackInfoReturnable<ItemStack> cir) {
isValidHotbarIndex(actualSlot) ? instance.main.get(actualSlot) : ItemStack.EMPTY
);
}

@Inject(method = "getBlockBreakingSpeed", at = @At(value = "HEAD"), cancellable = true)
public void handleSpoofedBlockBreakingSpeed(BlockState block, CallbackInfoReturnable<Float> cir) {
cir.setReturnValue(player.getMainHandStack().getMiningSpeedMultiplier(block));
}
}
10 changes: 10 additions & 0 deletions common/src/main/java/com/lambda/mixin/render/InGameHudMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,25 @@
import com.lambda.graphics.RenderMain;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.hud.InGameHud;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
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.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

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

@Mixin(InGameHud.class)
public class InGameHudMixin {
@Inject(method = "render", at = @At("TAIL"))
private void onRender(DrawContext context, float tickDelta, CallbackInfo ci) {
RenderMain.render2D();
}

@Redirect(method = "tick()V", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerInventory;getMainHandStack()Lnet/minecraft/item/ItemStack;"))
private ItemStack onTick(PlayerInventory inventory) {
return isValidHotbarIndex(inventory.selectedSlot) ? inventory.main.get(inventory.selectedSlot) : ItemStack.EMPTY;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,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
47 changes: 47 additions & 0 deletions common/src/main/kotlin/com/lambda/config/groups/BreakSettings.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.lambda.config.groups

import com.lambda.config.Configurable
import com.lambda.interaction.request.Priority
import com.lambda.interaction.request.breaking.BreakConfig
import com.lambda.util.BlockUtils.allSigns

class BreakSettings(
c: Configurable,
priority: Priority = 0,
vis: () -> Boolean = { true }
) : BreakConfig(priority) {
override val breakMode by c.setting("Break Mode", BreakMode.Vanilla) { vis() }
override val breakThreshold by c.setting("Break Threshold", 1.0f, 0.1f..1.0f, 0.02f, "The break amount at which the block is considered broken") { vis() }
override val doubleBreak by c.setting("Double Break", false, "Allows breaking two blocks at once") { vis() }
override val breakDelay by c.setting("Break Delay", 5, 0..5, 1, "The delay between breaking blocks", " ticks") { vis() }
override val swing by c.setting("Swing Mode", SwingMode.Constant, "The times at which to swing the players hand") { vis() }
override val swingType by c.setting("Swing Type", SwingType.Vanilla, "The style of swing")
override val sounds by c.setting("Sounds", true, "Plays the breaking sounds") { vis() }
override val particles by c.setting("Particles", true, "Renders the breaking particles") { vis() }
override val breakingTexture by c.setting("Breaking Overlay", true, "Overlays the breaking texture at its different stages") { vis() }
override val rotateForBreak by c.setting("Rotate For Break", true, "Rotate towards block while breaking") { vis() }
override val ignoredBlocks by c.setting("Ignored Blocks", allSigns, "Blocks that wont be broken") { vis() }
override val breakConfirmation by c.setting("Break Confirmation", BreakConfirmationMode.BreakThenAwait, "The style of confirmation used when breaking") { vis() }
override val breaksPerTick by c.setting("Instant Breaks Per Tick", 5, 1..30, 1, "Maximum instant block breaks per tick") { vis() }
override val breakWeakBlocks by c.setting("Break Weak Blocks", false, "Break blocks that dont have structural integrity (e.g: grass)") { vis() }
override val forceSilkTouch by c.setting("Force Silk Touch", false, "Force silk touch when breaking blocks") { vis() }
override val forceFortunePickaxe by c.setting("Force Fortune Pickaxe", false, "Force fortune pickaxe when breaking blocks") { vis() }
override val minFortuneLevel by c.setting("Min Fortune Level", 1, 1..3, 1, "The minimum fortune level to use") { vis() && forceFortunePickaxe }
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Ensure mutual exclusivity for Silk Touch & Fortune.

When both forceSilkTouch and forceFortunePickaxe are enabled, there may be a conflict in the final drop outcome. Consider enforcing mutual exclusivity or clarifying which option overrides the other if both are true.

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

package com.lambda.config.groups

import net.minecraft.block.Block

interface BuildConfig {
// General
val pathing: Boolean
Expand All @@ -28,12 +26,7 @@ interface BuildConfig {
val interactionTimeout: Int

// Breaking
val rotateForBreak: Boolean
val breakConfirmation: Boolean
val breaksPerTick: Int
val breakWeakBlocks: Boolean
val forceSilkTouch: Boolean
val ignoredBlocks: Set<Block>
val breakSettings: BreakSettings

// Placing
val rotateForPlace: Boolean
Expand Down
11 changes: 3 additions & 8 deletions common/src/main/kotlin/com/lambda/config/groups/BuildSettings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package com.lambda.config.groups

import com.lambda.config.Configurable
import com.lambda.util.BlockUtils.allSigns
import com.lambda.interaction.request.breaking.BreakConfig.BreakConfirmationMode

class BuildSettings(
c: Configurable,
Expand All @@ -37,17 +37,12 @@ class BuildSettings(
override val maxPendingInteractions by c.setting("Max Pending Interactions", 1, 1..10, 1, "Dont wait for this many interactions for the server response") { vis() && page == Page.General }

// Breaking
override val rotateForBreak by c.setting("Rotate For Break", true, "Rotate towards block while breaking") { vis() && page == Page.Break }
override val breakConfirmation by c.setting("Break Confirmation", false, "Wait for block break confirmation") { vis() && page == Page.Break }
override val breaksPerTick by c.setting("Instant Breaks Per Tick", 5, 1..30, 1, "Maximum instant block breaks per tick") { vis() && page == Page.Break }
override val breakWeakBlocks by c.setting("Break Weak Blocks", false, "Break blocks that dont have structural integrity (e.g: grass)") { vis() && page == Page.Break }
override val forceSilkTouch by c.setting("Force Silk Touch", false, "Force silk touch when breaking blocks") { vis() && page == Page.Break }
override val ignoredBlocks by c.setting("Ignored Blocks", allSigns, "Blocks that wont be broken") { vis() && page == Page.Break }
override val breakSettings = BreakSettings(c) { page == Page.Break && vis() }

// Placing
override val rotateForPlace by c.setting("Rotate For Place", true, "Rotate towards block while placing") { vis() && page == Page.Place }
override val placeConfirmation by c.setting("Place Confirmation", true, "Wait for block placement confirmation") { vis() && page == Page.Place }
override val placementsPerTick by c.setting("Instant Places Per Tick", 1, 1..30, 1, "Maximum instant block places per tick") { vis() && page == Page.Place }

override val interactionTimeout by c.setting("Interaction Timeout", 10, 1..30, 1, "Timeout for block breaks in ticks", unit = " ticks") { vis() && (page == Page.Place && placeConfirmation || page == Page.Break && breakConfirmation) }
override val interactionTimeout by c.setting("Interaction Timeout", 10, 1..30, 1, "Timeout for block breaks in ticks", unit = " ticks") { vis() && (page == Page.Place && placeConfirmation || page == Page.Break && breakSettings.breakConfirmation != BreakConfirmationMode.None) }
}
49 changes: 46 additions & 3 deletions common/src/main/kotlin/com/lambda/config/groups/InventoryConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,62 @@

package com.lambda.config.groups

import com.lambda.interaction.material.ContainerSelection
import com.lambda.interaction.material.ContainerSelection.Companion.selectContainer
import com.lambda.interaction.material.StackSelection
import com.lambda.interaction.material.StackSelection.Companion.selectStack
import com.lambda.interaction.material.container.MaterialContainer
import com.lambda.util.item.ItemUtils
import net.minecraft.block.Block
import net.minecraft.item.Item
import net.minecraft.item.Items
import net.minecraft.item.ToolItem
import net.minecraft.item.ToolMaterial
import net.minecraft.item.ToolMaterials

interface InventoryConfig {
val disposables: Set<Block>
val accessEnderChest: Boolean

val swapWithDisposables: Boolean

val providerPriority: Priority
val storePriority: Priority

val accessShulkerBoxes: Boolean
val accessEnderChest: Boolean
val accessChests: Boolean
val accessStashes: Boolean

val containerSelection: ContainerSelection get() = selectContainer {
val allowedContainers = mutableSetOf<MaterialContainer.Rank>().apply {
addAll(MaterialContainer.Rank.entries)
if (!accessShulkerBoxes) remove(MaterialContainer.Rank.SHULKER_BOX)
if (!accessEnderChest) remove(MaterialContainer.Rank.ENDER_CHEST)
if (!accessChests) remove(MaterialContainer.Rank.CHEST)
if (!accessStashes) remove(MaterialContainer.Rank.STASH)
}
ofAnyType(*allowedContainers.toTypedArray())
}

val useWoodenTools: Boolean
val useStoneTools: Boolean
val useIronTools: Boolean
val useDiamondTools: Boolean
val useNetheriteTools: Boolean
val useGoldTools: Boolean
val useShears: Boolean
val useFlintAndSteel: Boolean

val allowedTools get() = mutableSetOf<Item>().apply {
addAll(ItemUtils.tools)
if (!useWoodenTools) removeIf { it is ToolItem && it.material == ToolMaterials.WOOD }
if (!useStoneTools) removeIf { it is ToolItem && it.material == ToolMaterials.STONE }
if (!useIronTools) removeIf { it is ToolItem && it.material == ToolMaterials.IRON }
if (!useDiamondTools) removeIf { it is ToolItem && it.material == ToolMaterials.DIAMOND }
if (!useNetheriteTools) removeIf { it is ToolItem && it.material == ToolMaterials.NETHERITE }
if (!useGoldTools) removeIf { it is ToolItem && it.material == ToolMaterials.GOLD }
if (!useShears) removeIf { it == Items.SHEARS }
if (!useFlintAndSteel) removeIf { it == Items.FLINT_AND_STEEL }
}

enum class Priority {
WithMinItems,
WithMaxItems;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,28 @@ class InventorySettings(
c: Configurable,
vis: () -> Boolean = { true },
) : InventoryConfig {
override val disposables by c.setting("Disposables", ItemUtils.defaultDisposables, "Items that will be ignored when checking for a free slot", vis)
override val accessEnderChest by c.setting("Access Ender Chest", false, "Allow access to the player's ender chest", vis)
override val swapWithDisposables by c.setting("Swap With Disposables", true, "Swap items with disposable ones", vis)
override val providerPriority by c.setting("Provider Priority", InventoryConfig.Priority.WithMinItems, "What container to prefer when retrieving the item from", vis)
override val storePriority by c.setting("Store Priority", InventoryConfig.Priority.WithMinItems, "What container to prefer when storing the item to", vis)
val page by c.setting("Inventory Page", Page.Container, "The page to open when the module is enabled", vis)

override val disposables by c.setting("Disposables", ItemUtils.defaultDisposables, "Items that will be included when checking for a free slot / are allowed to be droped when inventory is full") { vis() && page == Page.Container}
Copy link

Copilot AI Apr 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a spelling mistake in the comment: 'droped' should be 'dropped'.

Suggested change
override val disposables by c.setting("Disposables", ItemUtils.defaultDisposables, "Items that will be included when checking for a free slot / are allowed to be droped when inventory is full") { vis() && page == Page.Container}
override val disposables by c.setting("Disposables", ItemUtils.defaultDisposables, "Items that will be included when checking for a free slot / are allowed to be dropped when inventory is full") { vis() && page == Page.Container}

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI May 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The word 'droped' is misspelled; it should be 'dropped'.

Suggested change
override val disposables by c.setting("Disposables", ItemUtils.defaultDisposables, "Items that will be included when checking for a free slot / are allowed to be droped when inventory is full") { vis() && page == Page.Container}
override val disposables by c.setting("Disposables", ItemUtils.defaultDisposables, "Items that will be included when checking for a free slot / are allowed to be dropped when inventory is full") { vis() && page == Page.Container}

Copilot uses AI. Check for mistakes.
override val swapWithDisposables by c.setting("Swap With Disposables", true, "Swap items with disposable ones") { vis() && page == Page.Container}
override val providerPriority by c.setting("Provider Priority", InventoryConfig.Priority.WithMinItems, "What container to prefer when retrieving the item from") { vis() && page == Page.Container}
override val storePriority by c.setting("Store Priority", InventoryConfig.Priority.WithMinItems, "What container to prefer when storing the item to") { vis() && page == Page.Container}

override val accessShulkerBoxes by c.setting("Access Shulker Boxes", true, "Allow access to the player's shulker boxes") { vis() && page == Page.Access}
override val accessEnderChest by c.setting("Access Ender Chest", false, "Allow access to the player's ender chest") { vis() && page == Page.Access}
override val accessChests by c.setting("Access Chests", false, "Allow access to the player's normal chests") { vis() && page == Page.Access}
override val accessStashes by c.setting("Access Stashes", false, "Allow access to the player's stashes") { vis() && page == Page.Access}

override val useWoodenTools by c.setting("Use Wooden Tools", false, "Use wooden tools to mine blocks") { vis() && page == Page.Tools}
override val useStoneTools by c.setting("Use Stone Tools", false, "Use stone tools to mine blocks") { vis() && page == Page.Tools}
override val useIronTools by c.setting("Use Iron Tools", false, "Use iron tools to mine blocks") { vis() && page == Page.Tools}
override val useDiamondTools by c.setting("Use Diamond Tools", true, "Use diamond tools to mine blocks") { vis() && page == Page.Tools}
override val useNetheriteTools by c.setting("Use Netherite Tools", true, "Use netherite tools to mine blocks") { vis() && page == Page.Tools}
override val useGoldTools by c.setting("Use Gold Tools", false, "Use gold tools to mine blocks") { vis() && page == Page.Tools}
override val useShears by c.setting("Use Shears", true, "Use shears to mine blocks") { vis() && page == Page.Tools}
override val useFlintAndSteel by c.setting("Use Flint and Steel", true, "Use flint and steel to mine blocks?") { vis() && page == Page.Tools}

enum class Page {
Container, Access, Tools
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ import com.lambda.graphics.renderer.esp.DirectionMask
import com.lambda.graphics.renderer.esp.DirectionMask.exclude
import com.lambda.interaction.construction.verify.TargetState
import com.lambda.interaction.request.rotation.RotationRequest
import com.lambda.threading.runSafe
import com.lambda.util.world.raycast.RayCastUtils.distanceTo
import net.minecraft.block.BlockState
import net.minecraft.util.Hand
import net.minecraft.client.network.ClientPlayNetworkHandler
import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket
import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket.Action
import net.minecraft.util.hit.BlockHitResult
import net.minecraft.util.math.BlockPos
import net.minecraft.util.math.Direction
Expand All @@ -39,21 +40,12 @@ data class BreakContext(
override val rotation: RotationRequest,
override val checkedState: BlockState,
override val targetState: TargetState,
override var hand: Hand,
override var hotbarIndex: Int,
val instantBreak: Boolean,
) : BuildContext {
private val baseColor = Color(222, 0, 0, 25)
private val sideColor = Color(222, 0, 0, 100)

override fun interact(swingHand: Boolean) {
runSafe {
if (interaction.updateBlockBreakingProgress(result.blockPos, result.side)) {
if (player.isCreative) interaction.blockBreakingCooldown = 0
if (swingHand) player.swingHand(hand)
}
}
}

override val expectedPos: BlockPos
get() = result.blockPos

Expand All @@ -78,10 +70,29 @@ data class BreakContext(
}
}

override fun shouldRotate(config: BuildConfig) = config.rotateForBreak
override fun shouldRotate(config: BuildConfig) = config.breakSettings.rotateForBreak

override fun SafeContext.buildRenderer() {
withState(checkedState, expectedPos, baseColor, DirectionMask.ALL.exclude(result.side))
withState(checkedState, expectedPos, sideColor, result.side)
}

fun startBreakPacket(sequence: Int, connection: ClientPlayNetworkHandler) =
breakPacket(Action.START_DESTROY_BLOCK, sequence, connection)

fun stopBreakPacket(sequence: Int, connection: ClientPlayNetworkHandler) =
breakPacket(Action.STOP_DESTROY_BLOCK, sequence, connection)

fun abortBreakPacket(sequence: Int, connection: ClientPlayNetworkHandler) =
breakPacket(Action.ABORT_DESTROY_BLOCK, sequence, connection)

private fun breakPacket(action: Action, sequence: Int, connection: ClientPlayNetworkHandler) =
connection.sendPacket(
PlayerActionC2SPacket(
action,
expectedPos,
result.side,
sequence
)
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ package com.lambda.interaction.construction.context
import com.lambda.config.groups.BuildConfig
import com.lambda.interaction.construction.result.Drawable
import com.lambda.interaction.construction.verify.TargetState
import com.lambda.interaction.material.container.MaterialContainer
import com.lambda.interaction.request.rotation.RotationRequest
import net.minecraft.block.BlockState
import net.minecraft.util.Hand
import net.minecraft.item.ItemStack
import net.minecraft.util.hit.BlockHitResult
import net.minecraft.util.math.BlockPos
import net.minecraft.util.math.Vec3d
Expand All @@ -35,9 +36,10 @@ interface BuildContext : Comparable<BuildContext>, Drawable {
val targetState: TargetState
val expectedPos: BlockPos
val checkedState: BlockState
val hand: Hand
val hotbarIndex: Int
val rotation: RotationRequest

fun interact(swingHand: Boolean)
fun shouldRotate(config: BuildConfig): Boolean

data class LocalizedStack(val container: MaterialContainer, val stack: ItemStack)
}
Loading