<commit_before>package joshie.harvest.core.loot;

import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonObject;
import com.google.gson.JsonSerializationContext;
import joshie.harvest.core.base.block.BlockHFEnum;
import joshie.harvest.core.base.item.ItemBlockHF;
import joshie.harvest.core.base.item.ItemHFEnum;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.storage.loot.LootContext;
import net.minecraft.world.storage.loot.conditions.LootCondition;
import net.minecraft.world.storage.loot.functions.LootFunction;

import java.util.Random;


public class SetEnum extends LootFunction {
    private final String name;

    public SetEnum(LootCondition[] conditionsIn, String name) {
        super(conditionsIn);
        this.name = name;
    }

    public ItemStack apply(ItemStack stack, Random rand, LootContext context) {
        if (stack.getItem() instanceof ItemHFEnum) {
            ItemStack ret = ((ItemHFEnum)stack.getItem()).getStackFromEnumString(name);
            ret.stackSize = stack.stackSize; ///Update the size
            return ret;
        } else if (stack.getItem() instanceof ItemBlockHF && ((ItemBlockHF)stack.getItem()).getBlock() instanceof BlockHFEnum) {
            ItemStack ret = ((BlockHFEnum)((ItemBlockHF)stack.getItem()).getBlock()).getStackFromEnumString(name);
            ret.stackSize = stack.stackSize;
            return ret;
        }

        return stack;
    }

    public static class Serializer extends LootFunction.Serializer<SetEnum> {
        public Serializer() {
            super(new ResourceLocation("hf_set_enum"), SetEnum.class);
        }

        public void serialize(JsonObject object, SetEnum functionClazz, JsonSerializationContext serializationContext) {
            object.addProperty("enum", functionClazz.name);
        }
<commit_msg>Fix fishing not adjusting fishies!<commit_after>package joshie.harvest.core.loot;

import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonObject;
import com.google.gson.JsonSerializationContext;
import joshie.harvest.core.base.block.BlockHFEnum;
import joshie.harvest.core.base.item.ItemBlockHF;
import joshie.harvest.core.base.item.ItemHFEnum;
import joshie.harvest.core.base.item.ItemHFFoodEnum;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.storage.loot.LootContext;
import net.minecraft.world.storage.loot.conditions.LootCondition;
import net.minecraft.world.storage.loot.functions.LootFunction;

import java.util.Random;


public class SetEnum extends LootFunction {
    private final String name;

    public SetEnum(LootCondition[] conditionsIn, String name) {
        super(conditionsIn);
        this.name = name;
    }

    public ItemStack apply(ItemStack stack, Random rand, LootContext context) {
        if (stack.getItem() instanceof ItemHFFoodEnum) {
            ItemStack ret = ((ItemHFFoodEnum)stack.getItem()).getStackFromEnumString(name);
            ret.stackSize = stack.stackSize; ///Update the size
            return ret;
        } else if (stack.getItem() instanceof ItemHFEnum) {
            ItemStack ret = ((ItemHFEnum)stack.getItem()).getStackFromEnumString(name);
            ret.stackSize = stack.stackSize; ///Update the size
            return ret;
        } else if (stack.getItem() instanceof ItemBlockHF && ((ItemBlockHF)stack.getItem()).getBlock() instanceof BlockHFEnum) {
            ItemStack ret = ((BlockHFEnum)((ItemBlockHF)stack.getItem()).getBlock()).getStackFromEnumString(name);
            ret.stackSize = stack.stackSize;
            return ret;
        }

        return stack;
    }

    public static class Serializer extends LootFunction.Serializer<SetEnum> {
        public Serializer() {
            super(new ResourceLocation("hf_set_enum"), SetEnum.class);
        }

        public void serialize(JsonObject object, SetEnum functionClazz, JsonSerializationContext serializationContext) {
            object.addProperty("enum", functionClazz.name);
        }

{'fraction_non_alphanumeric': 0.10181106216348507, 'fraction_numerical': 0.0, 'mean_word_length': 3.576707726763718, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6810513', 'n_tokens_mistral': 1161, 'n_tokens_neox': 1155, 'n_words': 227}