397
This commit is contained in:
parent
e8396dbc33
commit
d18d1b820e
65 changed files with 287 additions and 520 deletions
|
@ -38,6 +38,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.state.StateFactory;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.BlockView;
|
||||
|
@ -90,12 +91,12 @@ public class BlockPlayerDetector extends BlockMachineBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, Direction side, float hitX, float hitY, float hitZ) {
|
||||
public boolean activate(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, BlockHitResult hitResult) {
|
||||
ItemStack stack = playerIn.getStackInHand(Hand.MAIN_HAND);
|
||||
BlockEntity tileEntity = worldIn.getBlockEntity(pos);
|
||||
|
||||
if (tileEntity == null) {
|
||||
return super.onBlockActivated(state, worldIn, pos, playerIn, hand, side, hitX, hitY, hitZ);
|
||||
return super.activate(state, worldIn, pos, playerIn, hand, hitResult);
|
||||
}
|
||||
|
||||
String type = state.get(TYPE);
|
||||
|
@ -103,7 +104,7 @@ public class BlockPlayerDetector extends BlockMachineBase {
|
|||
ChatFormat color = ChatFormat.GREEN;
|
||||
|
||||
if (!stack.isEmpty() && ToolManager.INSTANCE.canHandleTool(stack)) {
|
||||
if (ToolManager.INSTANCE.handleTool(stack, pos, worldIn, playerIn, side, false)) {
|
||||
if (ToolManager.INSTANCE.handleTool(stack, pos, worldIn, playerIn, hitResult.getSide(), false)) {
|
||||
if (playerIn.isSneaking()) {
|
||||
if (tileEntity instanceof IToolDrop) {
|
||||
ItemStack drop = ((IToolDrop) tileEntity).getToolDrop(playerIn);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue