// Path: src/main/java/net/darkhax/darkutils/DarkUtils.java
// @Mod(DarkUtils.MOD_ID)
// public class DarkUtils {
//     
//     public static final String MOD_ID = "darkutils";
//     
//     public static final String MOD_NAME = "Dark Utilities";
//     
//     public static final Logger LOG = LogManager.getLogger(MOD_NAME);
//     
//     public static final ItemGroup ITEM_GROUP = new ItemGroupBase(MOD_ID, () -> new ItemStack(DarkUtils.content.vectorPlate));
//     
//     public static final NetworkHelper NETWORK = new NetworkHelper(new ResourceLocation(MOD_ID, "main"), "2.0.X");
//     
//     public static RegistryHelper registry;
//     
//     public static Content content;
//     
//     public static AddonManager addons;
//     
//     public DarkUtils() {
//         
//         registry = DistExecutor.runForDist( () -> () -> new RegistryHelperClient(MOD_ID, LOG, ITEM_GROUP), () -> () -> new RegistryHelper(MOD_ID, LOG, ITEM_GROUP));
//         content = DistExecutor.runForDist( () -> () -> new ContentClient(registry), () -> () -> new Content(registry));
//         NETWORK.registerEnqueuedMessage(MessageSyncCrucibleType.class, NetworkHandlerServer::encodeStageMessage, t -> NetworkHandlerClient.decodeStageMessage(t), (t, u) -> NetworkHandlerClient.processSyncStagesMessage(t, u));
//         registry.initialize(FMLJavaModLoadingContext.get().getModEventBus());
//         
//         // Addons
//         addons = new AddonManager();
//     }
// }


import java.util.Random;
import com.google.gson.JsonObject;
import net.darkhax.bookshelf.crafting.block.BlockIngredient;
import net.darkhax.darkutils.DarkUtils;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraft.item.crafting.IRecipeType;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.registries.ForgeRegistryEntry;
    @Override
    public boolean canFit (int width, int height) {
        
        return true;
    }
    
    public Block getOutput (Random rand) {
        
        return this.output.getValidBlocks().get(rand.nextInt(this.output.getValidBlocks().size()));
    }
    
    public boolean isValid (BlockState state, ItemStack dustItem) {
        
        return this.item.test(dustItem) && this.input.test(state.getBlock()) && !this.output.getValidBlocks().isEmpty();
    }
    
    private static class Serializer extends ForgeRegistryEntry<IRecipeSerializer<?>> implements IRecipeSerializer<RecipeDustChange> {
        
        @Override
        public RecipeDustChange read (ResourceLocation recipeId, JsonObject json) {
            
            final Ingredient item = Ingredient.deserialize(json.getAsJsonObject("item"));
            final BlockIngredient input = BlockIngredient.deserialize(json.getAsJsonObject("input"));
            final BlockIngredient output = BlockIngredient.deserialize(json.getAsJsonObject("output"));
            return new RecipeDustChange(recipeId, item, input, output);
        }
        
        @Override
        public RecipeDustChange read (ResourceLocation recipeId, PacketBuffer buffer) {
            
// Path: src/main/java/net/darkhax/darkutils/DarkUtils.java
// @Mod(DarkUtils.MOD_ID)
// public class DarkUtils {
//     
//     public static final String MOD_ID = "darkutils";
//     
//     public static final String MOD_NAME = "Dark Utilities";
//     
//     public static final Logger LOG = LogManager.getLogger(MOD_NAME);
//     
//     public static final ItemGroup ITEM_GROUP = new ItemGroupBase(MOD_ID, () -> new ItemStack(DarkUtils.content.vectorPlate));
//     
//     public static final NetworkHelper NETWORK = new NetworkHelper(new ResourceLocation(MOD_ID, "main"), "2.0.X");
//     
//     public static RegistryHelper registry;
//     
//     public static Content content;
//     
//     public static AddonManager addons;
//     
//     public DarkUtils() {
//         
//         registry = DistExecutor.runForDist( () -> () -> new RegistryHelperClient(MOD_ID, LOG, ITEM_GROUP), () -> () -> new RegistryHelper(MOD_ID, LOG, ITEM_GROUP));
//         content = DistExecutor.runForDist( () -> () -> new ContentClient(registry), () -> () -> new Content(registry));
//         NETWORK.registerEnqueuedMessage(MessageSyncCrucibleType.class, NetworkHandlerServer::encodeStageMessage, t -> NetworkHandlerClient.decodeStageMessage(t), (t, u) -> NetworkHandlerClient.processSyncStagesMessage(t, u));
//         registry.initialize(FMLJavaModLoadingContext.get().getModEventBus());
//         
//         // Addons
//         addons = new AddonManager();
//     }
// }


// Path: src/main/java/net/darkhax/darkutils/features/dust/RecipeDustChange.java
import java.util.Random;
import com.google.gson.JsonObject;
import net.darkhax.bookshelf.crafting.block.BlockIngredient;
import net.darkhax.darkutils.DarkUtils;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraft.item.crafting.IRecipeType;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.registries.ForgeRegistryEntry;

    @Override
    public boolean canFit (int width, int height) {
        
        return true;
    }
    
    public Block getOutput (Random rand) {
        
        return this.output.getValidBlocks().get(rand.nextInt(this.output.getValidBlocks().size()));
    }
    
    public boolean isValid (BlockState state, ItemStack dustItem) {
        
        return this.item.test(dustItem) && this.input.test(state.getBlock()) && !this.output.getValidBlocks().isEmpty();
    }
    
    private static class Serializer extends ForgeRegistryEntry<IRecipeSerializer<?>> implements IRecipeSerializer<RecipeDustChange> {
        
        @Override
        public RecipeDustChange read (ResourceLocation recipeId, JsonObject json) {
            
            final Ingredient item = Ingredient.deserialize(json.getAsJsonObject("item"));
            final BlockIngredient input = BlockIngredient.deserialize(json.getAsJsonObject("input"));
            final BlockIngredient output = BlockIngredient.deserialize(json.getAsJsonObject("output"));
            return new RecipeDustChange(recipeId, item, input, output);
        }
        
        @Override
        public RecipeDustChange read (ResourceLocation recipeId, PacketBuffer buffer) {
            
            final Ingredient item = Ingredient.read(buffer);