Search in sources :

Example 1 with ClientPlayerInteractionManagerAccessor

use of com.tangykiwi.kiwiclient.mixin.ClientPlayerInteractionManagerAccessor in project KiwiClient by TangyKiwi.

the class AutoTool method onTick.

@Subscribe
public void onTick(TickEvent event) {
    ClientPlayerInteractionManager interactionManager = mc.interactionManager;
    if (prevState == true && !interactionManager.isBreakingBlock()) {
        mc.player.getInventory().selectedSlot = slot;
    } else if (prevState != interactionManager.isBreakingBlock()) {
        slot = mc.player.getInventory().selectedSlot;
    }
    if (interactionManager.isBreakingBlock()) {
        BlockPos blockPos = ((ClientPlayerInteractionManagerAccessor) interactionManager).getCurrentBreakingPos();
        BlockState blockState = mc.world.getBlockState(blockPos);
        swap(blockState);
    }
    prevState = interactionManager.isBreakingBlock();
}
Also used : ClientPlayerInteractionManager(net.minecraft.client.network.ClientPlayerInteractionManager) ClientPlayerInteractionManagerAccessor(com.tangykiwi.kiwiclient.mixin.ClientPlayerInteractionManagerAccessor) BlockState(net.minecraft.block.BlockState) BlockPos(net.minecraft.util.math.BlockPos) Subscribe(com.google.common.eventbus.Subscribe)

Aggregations

Subscribe (com.google.common.eventbus.Subscribe)1 ClientPlayerInteractionManagerAccessor (com.tangykiwi.kiwiclient.mixin.ClientPlayerInteractionManagerAccessor)1 BlockState (net.minecraft.block.BlockState)1 ClientPlayerInteractionManager (net.minecraft.client.network.ClientPlayerInteractionManager)1 BlockPos (net.minecraft.util.math.BlockPos)1