Skip to content

Commit b007333

Browse files
committed
sync hotbar slot and added pending interactions collection to place manager for future use
1 parent 960f9c9 commit b007333

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

common/src/main/kotlin/com/lambda/interaction/request/hotbar/HotbarManager.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ object HotbarManager : RequestHandler<HotbarRequest>(), Loadable {
4848

4949
listen<TickEvent.Pre> {
5050
updateRequest()
51+
interaction.syncSelectedSlot()
5152
}
5253

5354
listen<TickEvent.Post> {

common/src/main/kotlin/com/lambda/interaction/request/placing/PlaceManager.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,20 @@ import com.lambda.event.events.TickEvent
2424
import com.lambda.event.events.UpdateManagerEvent
2525
import com.lambda.event.listener.SafeListener.Companion.listen
2626
import com.lambda.interaction.request.RequestHandler
27+
import com.lambda.interaction.request.breaking.BreakManager.BreakInfo
2728
import com.lambda.interaction.request.hotbar.HotbarRequest
2829
import com.lambda.interaction.request.rotation.RotationManager.onRotate
30+
import com.lambda.module.modules.client.TaskFlowModule
31+
import com.lambda.util.Communication.info
2932
import com.lambda.util.Communication.warn
33+
import com.lambda.util.collections.LimitedDecayQueue
3034
import net.minecraft.util.Hand
3135

3236
object PlaceManager : RequestHandler<PlaceRequest>() {
37+
private val pendingInteractions = LimitedDecayQueue<BreakInfo>(
38+
TaskFlowModule.build.maxPendingInteractions, TaskFlowModule.build.interactionTimeout * 50L
39+
) { info("${it::class.simpleName} at ${it.context.expectedPos.toShortString()} timed out") }
40+
3341
init {
3442
listen<TickEvent.Pre>(Int.MIN_VALUE) {
3543
preEvent()
@@ -47,6 +55,8 @@ object PlaceManager : RequestHandler<PlaceRequest>() {
4755
postEvent()
4856
return@listen
4957
}
58+
pendingInteractions.setMaxSize(request.buildConfig.maxPendingInteractions)
59+
pendingInteractions.setDecayTime(request.buildConfig.interactionTimeout * 50L)
5060
placeBlock(request, Hand.MAIN_HAND)
5161
}
5262

common/src/main/resources/lambda.accesswidener

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ accessible field net/minecraft/entity/LivingEntity jumpingCooldown I
2929
accessible field net/minecraft/entity/Entity pos Lnet/minecraft/util/math/Vec3d;
3030
accessible field net/minecraft/client/network/ClientPlayerInteractionManager lastSelectedSlot I
3131
accessible method net/minecraft/entity/LivingEntity getHandSwingDuration ()I
32+
accessible method net/minecraft/client/network/ClientPlayerInteractionManager syncSelectedSlot ()V
3233

3334
# Camera
3435
accessible method net/minecraft/client/render/Camera setPos (DDD)V

0 commit comments

Comments
 (0)