corrected signature
This commit is contained in:
parent
b2ce05e9bf
commit
18d4032f6c
@ -4,6 +4,7 @@ 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.callback.CallbackInfoReturnable;
|
||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
@ -19,7 +20,7 @@ import net.minecraft.world.World;
|
||||
*/
|
||||
@Mixin(Block.class)
|
||||
public class BlockBreakMixin {
|
||||
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/block/Block;onBreak(net/minecraft/world/World;net/minecraft/util/math/BlockPos;net/minecraft/block/BlockState;net/minecraft/entity/player/PlayerEntity)V"), method = "interactOnBreak", cancellable = true)
|
||||
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/block/Block;onBreak(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Lnet/minecraft/entity/player/PlayerEntity;)V"), method = "interactOnBreak", cancellable = true)
|
||||
private void interactOnBreak(final World world, final BlockPos blockPos, final BlockState blockState, final PlayerEntity player, final CallbackInfoReturnable<Boolean> info) {
|
||||
ActionResult result = BreakBlockCallback.EVENT.invoker().interact(world, blockPos, blockState, player);
|
||||
if (result == ActionResult.FAIL) {
|
||||
|
@ -13,7 +13,7 @@ import net.minecraft.world.World;
|
||||
* @author jotty
|
||||
*
|
||||
*/
|
||||
public interface BreakBlockCallback {
|
||||
public interface BreakBlockCallback {
|
||||
Event<BreakBlockCallback> EVENT = EventFactory.createArrayBacked(BreakBlockCallback.class,
|
||||
(listeners) -> (world, blockPos, blockState, player) -> {
|
||||
for (BreakBlockCallback listener : listeners) {
|
||||
@ -24,6 +24,6 @@ public interface BreakBlockCallback {
|
||||
}
|
||||
return ActionResult.PASS;
|
||||
});
|
||||
|
||||
|
||||
ActionResult interact(World world, BlockPos blockPos, BlockState blockState, PlayerEntity player);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user