32 lines
1.4 KiB
Java
32 lines
1.4 KiB
Java
package carpet.mixins;
|
|
|
|
import carpet.CarpetServer;
|
|
import net.minecraft.block.Block;
|
|
import net.minecraft.block.BlockState;
|
|
import net.minecraft.block.entity.BlockEntity;
|
|
import net.minecraft.server.network.ServerPlayerEntity;
|
|
import net.minecraft.server.network.ServerPlayerInteractionManager;
|
|
import net.minecraft.util.math.BlockPos;
|
|
import org.spongepowered.asm.mixin.Mixin;
|
|
import org.spongepowered.asm.mixin.Shadow;
|
|
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;
|
|
|
|
@Mixin(ServerPlayerInteractionManager.class)
|
|
public class ServerPlayerInteractionManager_scarpetEventsMixin
|
|
{
|
|
@Shadow public ServerPlayerEntity player;
|
|
|
|
@Inject(method = "tryBreakBlock", locals = LocalCapture.CAPTURE_FAILEXCEPTION, at = @At(
|
|
value = "INVOKE",
|
|
target = "Lnet/minecraft/block/Block;onBroken(Lnet/minecraft/world/IWorld;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)V",
|
|
shift = At.Shift.BEFORE
|
|
))
|
|
private void onBlockBroken(BlockPos blockPos_1, CallbackInfoReturnable<Boolean> cir, BlockState blockState_1, BlockEntity be, Block b, boolean boolean_1)
|
|
{
|
|
CarpetServer.scriptServer.events.onBlockBroken(player, blockPos_1, blockState_1);
|
|
}
|
|
}
|