package com.thebrokenrail.scriptcraft.api; import com.thebrokenrail.scriptcraft.util.Util; import com.thebrokenrail.scriptcraft.quickjs.QuickJSManager; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.util.Identifier; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @SuppressWarnings("deprecation") public class CustomBlock extends Block { private final Identifier id; public CustomBlock(Settings settings, Identifier id) { super(settings); this.id = id; } @Override public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { return Util.getEnumValue(ActionResult.class, (String) QuickJSManager.bridge("CustomBlock.onUse", id.toString(), world, state, (double) pos.getX(), (double) pos.getY(), (double) pos.getZ(), hit.getSide().name(), player, hand.name()), ActionResult.PASS); } }