<commit_before>package tehnut.resourceful.crops.compat.bloodmagic;

import WayofTime.bloodmagic.api.BlockStack;
import WayofTime.bloodmagic.api.iface.IHarvestHandler;
import net.minecraft.block.Block;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import tehnut.resourceful.crops.api.registry.SeedRegistry;
import tehnut.resourceful.crops.block.BlockRCrop;
import tehnut.resourceful.crops.item.ItemShard;
import tehnut.resourceful.crops.registry.BlockRegistry;
import tehnut.resourceful.crops.registry.ItemRegistry;
import tehnut.resourceful.crops.tile.TileRCrop;

public class ResourcefulCropsHarvestHandler implements IHarvestHandler {

    @Override
    public boolean harvestAndPlant(World world, BlockPos blockPos, BlockStack blockStack) {
        if (blockStack.getBlock() instanceof BlockRCrop && blockStack.getMeta() >= 7) {
            TileEntity tile = world.getTileEntity(blockPos);
            if (tile != null && tile instanceof TileRCrop) {
                TileRCrop tileCrop = (TileRCrop) tile;
                BlockStack newBlock = new BlockStack(BlockRegistry.getBlock(BlockRCrop.class));
                world.setBlockState(blockPos, newBlock.getState());
                world.playAuxSFX(2001, blockPos, Block.getIdFromBlock(blockStack.getBlock()) + (blockStack.getMeta() << 12));
                ItemStack drop = new ItemStack(ItemRegistry.getItem(ItemShard.class), 1, SeedRegistry.getIndexOf(tileCrop.getSeedName()));
                dropItem(world, blockPos, drop);
            }
        }

        return false;
    }

    private void dropItem(World world, BlockPos pos, ItemStack stack) {
        if (!world.isRemote && !world.restoringBlockSnapshots) {
            float f = 0.7F;<commit_msg>Harvest handler should return true if work was done<commit_after>package tehnut.resourceful.crops.compat.bloodmagic;

import WayofTime.bloodmagic.api.BlockStack;
import WayofTime.bloodmagic.api.iface.IHarvestHandler;
import net.minecraft.block.Block;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import tehnut.resourceful.crops.api.registry.SeedRegistry;
import tehnut.resourceful.crops.block.BlockRCrop;
import tehnut.resourceful.crops.item.ItemShard;
import tehnut.resourceful.crops.registry.BlockRegistry;
import tehnut.resourceful.crops.registry.ItemRegistry;
import tehnut.resourceful.crops.tile.TileRCrop;

public class ResourcefulCropsHarvestHandler implements IHarvestHandler {

    @Override
    public boolean harvestAndPlant(World world, BlockPos blockPos, BlockStack blockStack) {
        if (blockStack.getBlock() instanceof BlockRCrop && blockStack.getMeta() >= 7) {
            TileEntity tile = world.getTileEntity(blockPos);
            if (tile != null && tile instanceof TileRCrop) {
                TileRCrop tileCrop = (TileRCrop) tile;
                BlockStack newBlock = new BlockStack(BlockRegistry.getBlock(BlockRCrop.class));
                world.setBlockState(blockPos, newBlock.getState());
                world.playAuxSFX(2001, blockPos, Block.getIdFromBlock(blockStack.getBlock()) + (blockStack.getMeta() << 12));
                ItemStack drop = new ItemStack(ItemRegistry.getItem(ItemShard.class), 1, SeedRegistry.getIndexOf(tileCrop.getSeedName()));
                dropItem(world, blockPos, drop);
                return true;
            }
        }

        return false;
    }

    private void dropItem(World world, BlockPos pos, ItemStack stack) {
        if (!world.isRemote && !world.restoringBlockSnapshots) {
            float f = 0.7F;
{'fraction_non_alphanumeric': 0.09865824782951854, 'fraction_numerical': 0.005261773217574322, 'mean_word_length': 3.7229813664596274, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5532560', 'n_tokens_mistral': 1150, 'n_tokens_neox': 1111, 'n_words': 207}