This repository has been archived on 2023-11-26. You can view files and clone it, but cannot push or open issues or pull requests.
ScriptCraft/scriptcraft/src/main/java/com/thebrokenrail/scriptcraft/api/block/CustomBlock.java

29 lines
1.1 KiB
Java
Raw Normal View History

2020-04-28 00:15:24 +00:00
package com.thebrokenrail.scriptcraft.api.block;
2020-04-25 13:33:17 +00:00
2020-05-05 00:36:32 +00:00
import com.thebrokenrail.scriptcraft.core.ScriptCraftCore;
2020-04-28 00:15:24 +00:00
import com.thebrokenrail.scriptcraft.core.ValueUtil;
2020-04-25 13:33:17 +00:00
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 {
2020-04-26 17:23:16 +00:00
protected final Identifier id;
2020-04-25 13:33:17 +00:00
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) {
2020-05-05 00:36:32 +00:00
return ValueUtil.getEnumValue(ActionResult.class, (String) ScriptCraftCore.useBridge("CustomBlock.onUse", id.toString(), world, state, (double) pos.getX(), (double) pos.getY(), (double) pos.getZ(), hit.getSide().name(), player, hand.name()), ActionResult.PASS);
2020-04-25 13:33:17 +00:00
}
}