BlockLandingInvoker.java 1.2 KB

1234567891011121314151617181920212223
  1. package me.shedaniel.architectury.mixin;
  2. import me.shedaniel.architectury.event.events.BlockEvent;
  3. import net.minecraft.core.BlockPos;
  4. import net.minecraft.world.entity.item.FallingBlockEntity;
  5. import net.minecraft.world.level.Level;
  6. import net.minecraft.world.level.block.AnvilBlock;
  7. import net.minecraft.world.level.block.ConcretePowderBlock;
  8. import net.minecraft.world.level.block.FallingBlock;
  9. import net.minecraft.world.level.block.state.BlockState;
  10. import org.spongepowered.asm.mixin.Mixin;
  11. import org.spongepowered.asm.mixin.injection.At;
  12. import org.spongepowered.asm.mixin.injection.Inject;
  13. import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
  14. import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
  15. @Mixin({FallingBlock.class, AnvilBlock.class, ConcretePowderBlock.class})
  16. public abstract class BlockLandingInvoker {
  17. @Inject(method = "onLand", at = @At("RETURN"), locals = LocalCapture.CAPTURE_FAILHARD)
  18. public void handleLand(Level level, BlockPos pos, BlockState fallState, BlockState landOn, FallingBlockEntity entity, CallbackInfo ci) {
  19. BlockEvent.FALLING_LAND.invoker().onLand(level, pos, fallState, landOn, entity);
  20. }
  21. }