|
20 | 20 | import com.lambda.event.EventFlow; |
21 | 21 | import com.lambda.event.events.InventoryEvent; |
22 | 22 | import com.lambda.event.events.PlayerEvent; |
| 23 | +import com.lambda.interaction.managers.inventory.InventoryManager; |
| 24 | +import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod; |
| 25 | +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; |
23 | 26 | import net.minecraft.client.network.ClientPlayerEntity; |
24 | 27 | import net.minecraft.client.network.ClientPlayerInteractionManager; |
| 28 | +import net.minecraft.client.recipebook.ClientRecipeBook; |
| 29 | +import net.minecraft.client.world.ClientWorld; |
25 | 30 | import net.minecraft.entity.Entity; |
26 | 31 | import net.minecraft.entity.player.PlayerEntity; |
27 | 32 | import net.minecraft.entity.player.PlayerInventory; |
28 | 33 | import net.minecraft.screen.slot.SlotActionType; |
| 34 | +import net.minecraft.stat.StatHandler; |
29 | 35 | import net.minecraft.util.ActionResult; |
30 | 36 | import net.minecraft.util.Hand; |
31 | 37 | import net.minecraft.util.hit.BlockHitResult; |
|
42 | 48 |
|
43 | 49 | @Mixin(ClientPlayerInteractionManager.class) |
44 | 50 | public class ClientPlayInteractionManagerMixin { |
45 | | - |
46 | 51 | @Shadow |
47 | 52 | public float currentBreakingProgress; |
48 | 53 |
|
@@ -115,4 +120,11 @@ private void updateBlockBreakingProgressPre(BlockPos pos, Direction side, Callba |
115 | 120 | private void cancelBlockBreakingPre(CallbackInfo ci) { |
116 | 121 | if (EventFlow.post(new PlayerEvent.Breaking.Cancel(currentBreakingProgress)).isCanceled()) ci.cancel(); |
117 | 122 | } |
| 123 | + |
| 124 | + @WrapMethod(method = "createPlayer(Lnet/minecraft/client/world/ClientWorld;Lnet/minecraft/stat/StatHandler;Lnet/minecraft/client/recipebook/ClientRecipeBook;ZZ)Lnet/minecraft/client/network/ClientPlayerEntity;") |
| 125 | + private ClientPlayerEntity injectCreatePlayer(ClientWorld world, StatHandler statHandler, ClientRecipeBook recipeBook, boolean lastSneaking, boolean lastSprinting, Operation<ClientPlayerEntity> original) { |
| 126 | + var player = original.call(world, statHandler, recipeBook, lastSneaking, lastSprinting); |
| 127 | + InventoryManager.INSTANCE.setScreenHandler(player.playerScreenHandler); |
| 128 | + return player; |
| 129 | + } |
118 | 130 | } |
0 commit comments