aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/hysky/skyblocker/events/ClientPlayerBlockBreakEvent.java
blob: 83ac716fbf73bef07478ba116626084b1ef3c677 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package de.hysky.skyblocker.events;

import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

// Fabric API currently doesn't have an event for this
public class ClientPlayerBlockBreakEvent {
    public static final Event<AfterBlockBreak> AFTER = EventFactory.createArrayBacked(AfterBlockBreak.class,
            (listeners) -> (world, player, pos, state) -> {
                for (AfterBlockBreak listener : listeners) {
                    listener.afterBlockBreak(world, player, pos, state);
                }
            });

    @FunctionalInterface
    public interface AfterBlockBreak {
        void afterBlockBreak(World world, PlayerEntity player, BlockPos pos, BlockState state);
    }
}