use of com.simibubi.create.foundation.utility.placement.IPlacementHelper in project Create by Creators-of-Create.
the class SailBlock method use.
@Override
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult ray) {
ItemStack heldItem = player.getItemInHand(hand);
IPlacementHelper placementHelper = PlacementHelpers.get(placementHelperId);
if (placementHelper.matchesItem(heldItem))
return placementHelper.getOffset(player, world, state, pos, ray).placeInWorld(world, (BlockItem) heldItem.getItem(), player, hand, ray);
if (heldItem.getItem() instanceof ShearsItem) {
if (!world.isClientSide)
applyDye(state, world, pos, null);
return InteractionResult.SUCCESS;
}
if (frame)
return InteractionResult.PASS;
DyeColor color = DyeColor.getColor(heldItem);
if (color != null) {
if (!world.isClientSide)
applyDye(state, world, pos, color);
return InteractionResult.SUCCESS;
}
return InteractionResult.PASS;
}
Aggregations