diff --git a/src/client/java/com/tcm/MineTale/block/workbenches/screen/ArmorersWorkbenchScreen.java b/src/client/java/com/tcm/MineTale/block/workbenches/screen/ArmorersWorkbenchScreen.java index 1188dac..d90484e 100644 --- a/src/client/java/com/tcm/MineTale/block/workbenches/screen/ArmorersWorkbenchScreen.java +++ b/src/client/java/com/tcm/MineTale/block/workbenches/screen/ArmorersWorkbenchScreen.java @@ -9,7 +9,6 @@ import com.tcm.MineTale.block.workbenches.menu.AbstractWorkbenchContainerMenu; import com.tcm.MineTale.block.workbenches.menu.ArmorersWorkbenchMenu; import com.tcm.MineTale.mixin.client.ClientRecipeBookAccessor; -import com.tcm.MineTale.mixin.client.RecipeBookComponentAccessor; import com.tcm.MineTale.network.CraftRequestPayload; import com.tcm.MineTale.recipe.MineTaleRecipeBookComponent; import com.tcm.MineTale.registry.ModBlocks; @@ -23,7 +22,6 @@ import net.minecraft.client.gui.navigation.ScreenPosition; import net.minecraft.client.gui.screens.inventory.AbstractRecipeBookScreen; import net.minecraft.client.gui.screens.recipebook.RecipeBookComponent; -import net.minecraft.client.gui.screens.recipebook.RecipeCollection; import net.minecraft.client.renderer.RenderPipelines; import net.minecraft.core.Holder; import net.minecraft.resources.Identifier; @@ -43,6 +41,8 @@ public class ArmorersWorkbenchScreen extends AbstractRecipeBookScreen tabs = List.of( - new RecipeBookComponent.TabInfo(tabIcon.getItem(), ModRecipeDisplay.WORKBENCH_SEARCH) + new RecipeBookComponent.TabInfo(tabIcon.getItem(), ModRecipeDisplay.ARMORERS_SEARCH) ); - return new MineTaleRecipeBookComponent(menu, tabs, ModRecipes.WORKBENCH_TYPE); + return new MineTaleRecipeBookComponent(menu, tabs, ModRecipes.ARMORERS_TYPE); } /** @@ -128,34 +128,52 @@ protected void init() { * @param amount the quantity to craft; use -1 to request crafting of the full available stack ("All") */ - private void handleCraftRequest(int amount) { - // 1. Cast the book component to the Accessor to get the selected data - RecipeBookComponentAccessor accessor = (RecipeBookComponentAccessor) this.mineTaleRecipeBook; + // private void handleCraftRequest(int amount) { + // // 1. Cast the book component to the Accessor to get the selected data + // RecipeBookComponentAccessor accessor = (RecipeBookComponentAccessor) this.mineTaleRecipeBook; - RecipeCollection collection = accessor.getLastRecipeCollection(); - RecipeDisplayId displayId = accessor.getLastRecipe(); - - if (collection != null && displayId != null) { - // 2. Find the visual entry - for (RecipeDisplayEntry entry : collection.getSelectedRecipes(RecipeCollection.CraftableStatus.ANY)) { - if (entry.id().equals(displayId)) { - // 3. Resolve result for the packet - List results = entry.resultItems(SlotDisplayContext.fromLevel(this.minecraft.level)); + // RecipeCollection collection = accessor.getLastRecipeCollection(); + // RecipeDisplayId displayId = accessor.getLastRecipe(); + + // if (collection != null && displayId != null) { + // // 2. Find the visual entry + // for (RecipeDisplayEntry entry : collection.getSelectedRecipes(RecipeCollection.CraftableStatus.ANY)) { + // if (entry.id().equals(displayId)) { + // // 3. Resolve result for the packet + // List results = entry.resultItems(SlotDisplayContext.fromLevel(this.minecraft.level)); - if (!results.isEmpty()) { - ItemStack resultStack = results.get(0); + // if (!results.isEmpty()) { + // ItemStack resultStack = results.get(0); - // 4. LOG FOR DEBUGGING - System.out.println("Sending craft request for: " + resultStack + " amount: " + amount); + // // 4. LOG FOR DEBUGGING + // System.out.println("Sending craft request for: " + resultStack + " amount: " + amount); - ClientPlayNetworking.send(new CraftRequestPayload(resultStack, amount)); - } - break; + // ClientPlayNetworking.send(new CraftRequestPayload(resultStack, amount)); + // } + // break; + // } + // } + // } else { + // System.out.println("Request failed: Collection or DisplayID is null!"); + // } + // } + + private void handleCraftRequest(int amount) { + // Look at our "Memory" instead of the component + if (this.lastKnownSelectedId != null) { + ClientRecipeBook book = this.minecraft.player.getRecipeBook(); + RecipeDisplayEntry entry = ((ClientRecipeBookAccessor) book).getKnown().get(this.lastKnownSelectedId); + + if (entry != null) { + List results = entry.resultItems(SlotDisplayContext.fromLevel(this.minecraft.level)); + if (!results.isEmpty()) { + System.out.println("Persistent Selection Success: " + results.get(0)); + ClientPlayNetworking.send(new CraftRequestPayload(results.get(0), amount)); + return; } } - } else { - System.out.println("Request failed: Collection or DisplayID is null!"); } + System.out.println("Request failed: No recipe was ever selected!"); } /** @@ -177,18 +195,22 @@ public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) { renderBackground(graphics, mouseX, mouseY, delta); super.render(graphics, mouseX, mouseY, delta); - // Get the ID of the recipe clicked in the ghost-book - RecipeDisplayId displayId = this.mineTaleRecipeBook.getSelectedRecipeId(); - RecipeDisplayEntry selectedEntry = null; + // 1. Get the current selection from the book + RecipeDisplayId currentId = this.mineTaleRecipeBook.getSelectedRecipeId(); + + // 2. If it's NOT null, remember it! + if (currentId != null) { + this.lastKnownSelectedId = currentId; + } - if (displayId != null && this.minecraft.level != null) { + // 3. Use the remembered ID to find the entry for button activation + RecipeDisplayEntry selectedEntry = null; + if (this.lastKnownSelectedId != null && this.minecraft.level != null) { ClientRecipeBook book = this.minecraft.player.getRecipeBook(); - // Accessing the known recipes via your Accessor - Map knownRecipes = ((ClientRecipeBookAccessor) book).getKnown(); - selectedEntry = knownRecipes.get(displayId); + selectedEntry = ((ClientRecipeBookAccessor) book).getKnown().get(this.lastKnownSelectedId); } - // 2. Button Activation Logic + // Logic for enabling/disabling buttons... if (selectedEntry != null) { // We use the entry directly. It contains the 15 ingredients needed! boolean canCraftOne = canCraft(this.minecraft.player, selectedEntry, 1); diff --git a/src/client/java/com/tcm/MineTale/datagen/ModBlockTagProvider.java b/src/client/java/com/tcm/MineTale/datagen/ModBlockTagProvider.java index 6c306aa..4672989 100644 --- a/src/client/java/com/tcm/MineTale/datagen/ModBlockTagProvider.java +++ b/src/client/java/com/tcm/MineTale/datagen/ModBlockTagProvider.java @@ -1,6 +1,5 @@ package com.tcm.MineTale.datagen; -import com.jcraft.jorbis.Block; import com.tcm.MineTale.registry.ModBlocks; import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider; diff --git a/src/client/java/com/tcm/MineTale/datagen/ModLootTableProvider.java b/src/client/java/com/tcm/MineTale/datagen/ModLootTableProvider.java index 79cd9cf..c4f55bd 100644 --- a/src/client/java/com/tcm/MineTale/datagen/ModLootTableProvider.java +++ b/src/client/java/com/tcm/MineTale/datagen/ModLootTableProvider.java @@ -2,7 +2,6 @@ import com.tcm.MineTale.block.workbenches.AbstractWorkbench; import com.tcm.MineTale.registry.ModBlocks; -import com.tcm.MineTale.registry.ModItems; import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; import net.fabricmc.fabric.api.datagen.v1.provider.FabricBlockLootTableProvider; import net.minecraft.advancements.criterion.StatePropertiesPredicate; diff --git a/src/client/java/com/tcm/MineTale/datagen/ModRecipeProvider.java b/src/client/java/com/tcm/MineTale/datagen/ModRecipeProvider.java index 9cbd11d..d08877c 100644 --- a/src/client/java/com/tcm/MineTale/datagen/ModRecipeProvider.java +++ b/src/client/java/com/tcm/MineTale/datagen/ModRecipeProvider.java @@ -4,7 +4,15 @@ import com.tcm.MineTale.MineTale; import com.tcm.MineTale.datagen.builders.WorkbenchRecipeBuilder; -import com.tcm.MineTale.registry.ModBlocks; +import com.tcm.MineTale.datagen.recipes.AlchemistRecipes; +import com.tcm.MineTale.datagen.recipes.ArmorRecipes; +import com.tcm.MineTale.datagen.recipes.BlacksmithRecipes; +import com.tcm.MineTale.datagen.recipes.BuilderRecipes; +import com.tcm.MineTale.datagen.recipes.FarmerRecipes; +import com.tcm.MineTale.datagen.recipes.ForgeRecipes; +import com.tcm.MineTale.datagen.recipes.FurnitureRecipes; +import com.tcm.MineTale.datagen.recipes.GeneralRecipes; +import com.tcm.MineTale.datagen.recipes.WorkbenchRecipes; import com.tcm.MineTale.registry.ModRecipeDisplay; import com.tcm.MineTale.registry.ModRecipes; @@ -68,27 +76,6 @@ public void buildRecipes() { .bookCategory(ModRecipeDisplay.CAMPFIRE_SEARCH) .save(exporter, "campfire_pork_cooking"); - // Workbench Recipes - - // 1. Workbenches - new WorkbenchRecipeBuilder(ModRecipes.WORKBENCH_TYPE, ModRecipes.WORKBENCH_SERIALIZER) - .input(Items.COPPER_INGOT, 2) - .input(ItemTags.LOGS, registryLookup, 10) - .input(ItemTags.STONE_TOOL_MATERIALS, registryLookup, 5) - .output(ModBlocks.ARMORERS_WORKBENCH_BLOCK.asItem()) - .unlockedBy("has_workbench", has(ModBlocks.WORKBENCH_WORKBENCH_BLOCK.asItem())) - .bookCategory(ModRecipeDisplay.WORKBENCH_SEARCH) - .save(exporter, "workbench_armorers_workbench"); - - new WorkbenchRecipeBuilder(ModRecipes.WORKBENCH_TYPE, ModRecipes.WORKBENCH_SERIALIZER) - .input(ItemTags.LOGS, registryLookup, 6) - .input(ItemTags.STONE_TOOL_MATERIALS, registryLookup, 6) - .output(ModBlocks.FURNACE_WORKBENCH_BLOCK_T1.asItem()) - .unlockedBy("has_workbench", has(ModBlocks.WORKBENCH_WORKBENCH_BLOCK.asItem())) - .bookCategory(ModRecipeDisplay.WORKBENCH_SEARCH) - .save(exporter, "workbench_furnace_workbench_t1"); - - // 2. Chests new WorkbenchRecipeBuilder(ModRecipes.WORKBENCH_TYPE, ModRecipes.WORKBENCH_SERIALIZER) .input(ItemTags.LOGS, registryLookup, 10) @@ -108,6 +95,25 @@ public void buildRecipes() { .unlockedBy("has_copper_ore", has(Items.COPPER_ORE)) .bookCategory(ModRecipeDisplay.FURNACE_T1_SEARCH) .save(exporter, "furnace_t1_copper_ingot"); + + // Alchemist Recipes + AlchemistRecipes.buildRecipes(this, exporter, registryLookup); + // Armor Recipes + ArmorRecipes.buildRecipes(this, exporter, registryLookup); + // Blacksmith Recipes + BlacksmithRecipes.buildRecipes(this, exporter, registryLookup); + // Builder Recipes + BuilderRecipes.buildRecipes(this, exporter, registryLookup); + // Farmer Recipes + FarmerRecipes.buildRecipes(this, exporter, registryLookup); + // Forge Recipes + ForgeRecipes.buildRecipes(this, exporter, registryLookup); + // Furniture Recipes + FurnitureRecipes.buildRecipes(this, exporter, registryLookup); + // General Recipes + GeneralRecipes.buildRecipes(this, exporter, registryLookup); + // Workbench Recipes + WorkbenchRecipes.buildRecipes(this, exporter, registryLookup); } }; } diff --git a/src/client/java/com/tcm/MineTale/datagen/builders/WorkbenchRecipeBuilder.java b/src/client/java/com/tcm/MineTale/datagen/builders/WorkbenchRecipeBuilder.java index 632ef9f..7a37b53 100644 --- a/src/client/java/com/tcm/MineTale/datagen/builders/WorkbenchRecipeBuilder.java +++ b/src/client/java/com/tcm/MineTale/datagen/builders/WorkbenchRecipeBuilder.java @@ -44,7 +44,7 @@ public class WorkbenchRecipeBuilder implements RecipeBuilder { private CraftingBookCategory category = CraftingBookCategory.MISC; private Identifier bookCategory = BuiltInRegistries.RECIPE_BOOK_CATEGORY .getKey(ModRecipeDisplay.CAMPFIRE_SEARCH); - private int cookTime = 200; + private float cookTime = 200; @Nullable private String group; /** @@ -185,7 +185,7 @@ public WorkbenchRecipeBuilder output(ItemLike stack) { * @param seconds the cook time in seconds * @return the builder instance */ - public WorkbenchRecipeBuilder time(int seconds) { + public WorkbenchRecipeBuilder time(float seconds) { this.cookTime = seconds * 20; return this; } diff --git a/src/client/java/com/tcm/MineTale/datagen/recipes/AlchemistRecipes.java b/src/client/java/com/tcm/MineTale/datagen/recipes/AlchemistRecipes.java new file mode 100644 index 0000000..04e8f90 --- /dev/null +++ b/src/client/java/com/tcm/MineTale/datagen/recipes/AlchemistRecipes.java @@ -0,0 +1,30 @@ +package com.tcm.MineTale.datagen.recipes; + +import net.minecraft.core.HolderLookup; +import net.minecraft.data.recipes.RecipeOutput; +import net.minecraft.data.recipes.RecipeProvider; + +public class AlchemistRecipes { + public static void buildRecipes(RecipeProvider provider, RecipeOutput exporter, HolderLookup.Provider lookup) { + // new WorkbenchRecipeBuilder(ModRecipes.ALCHEMIST_TYPE, ModRecipes.ALCHEMIST_SERIALIZER) + // .input(ModItems.EMPTY_POTION_BOTTLE) + // .input(ModItems.PLANT_FIBER, 5) + // .input(ModItems.ESSENCE_OF_LIFE, 2) + // .input(ModItems.VENOM_SACK, 1) + // .output(ModItems.ANTIDOTE) + // .time(1) + // .unlockedBy("has_alchemist_workbench", provider.has(ModBlocks.ALCHEMIST_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.ALCHEMIST_SEARCH) + // .save(exporter, "ANTIDOTE"); + + // new WorkbenchRecipeBuilder(ModRecipes.ALCHEMIST_TYPE, ModRecipes.ALCHEMIST_SERIALIZER) + // .input(ModItems.WILD_BERRY, 6) + // .input(ModItems.BOOM_POWDER, 2) + // .input(ModItems.PLANT_FIBER, 4) + // .output(ModItems.POPBERRY_BOMB, 2) + // .time(0.5) + // .unlockedBy("has_alchemist_workbench", provider.has(ModBlocks.ALCHEMIST_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.ALCHEMIST_SEARCH) + // .save(exporter, "POPBERRY_BOMB"); + } +} diff --git a/src/client/java/com/tcm/MineTale/datagen/recipes/ArmorRecipes.java b/src/client/java/com/tcm/MineTale/datagen/recipes/ArmorRecipes.java new file mode 100644 index 0000000..6415b3b --- /dev/null +++ b/src/client/java/com/tcm/MineTale/datagen/recipes/ArmorRecipes.java @@ -0,0 +1,89 @@ +package com.tcm.MineTale.datagen.recipes; + +import com.tcm.MineTale.datagen.builders.WorkbenchRecipeBuilder; +import com.tcm.MineTale.registry.ModItems; +import com.tcm.MineTale.registry.ModRecipeDisplay; +import com.tcm.MineTale.registry.ModRecipes; + +import net.minecraft.core.HolderLookup; +import net.minecraft.data.recipes.RecipeOutput; +import net.minecraft.data.recipes.RecipeProvider; +import net.minecraft.world.item.Items; + +public class ArmorRecipes { + public static void buildRecipes(RecipeProvider provider, RecipeOutput exporter, HolderLookup.Provider lookup) { + // Copper Armor + new WorkbenchRecipeBuilder(ModRecipes.ARMORERS_TYPE, ModRecipes.ARMORERS_SERIALIZER) + .input(Items.COPPER_INGOT, 11) + .input(ModItems.PLANT_FIBER, 4) + .output(Items.COPPER_CHESTPLATE) + .time(3) + .unlockedBy("has_copper_ingot", provider.has(Items.COPPER_INGOT)) + .bookCategory(ModRecipeDisplay.ARMORERS_SEARCH) + .save(exporter, "copper_cuirass"); + new WorkbenchRecipeBuilder(ModRecipes.ARMORERS_TYPE, ModRecipes.ARMORERS_SERIALIZER) + .input(Items.COPPER_INGOT, 6) + .input(ModItems.PLANT_FIBER, 2) + .output(Items.COPPER_HELMET) + .time(3) + .unlockedBy("has_copper_ingot", provider.has(Items.COPPER_INGOT)) + .bookCategory(ModRecipeDisplay.ARMORERS_SEARCH) + .save(exporter, "copper_helmet"); + new WorkbenchRecipeBuilder(ModRecipes.ARMORERS_TYPE, ModRecipes.ARMORERS_SERIALIZER) + .input(Items.COPPER_INGOT, 9) + .input(ModItems.PLANT_FIBER, 3) + .output(Items.COPPER_LEGGINGS) + .time(3) + .unlockedBy("has_copper_ingot", provider.has(Items.COPPER_INGOT)) + .bookCategory(ModRecipeDisplay.ARMORERS_SEARCH) + .save(exporter, "copper_greaves"); + // new WorkbenchRecipeBuilder(ModRecipes.ARMORERS_TYPE, ModRecipes.ARMORERS_SERIALIZER) + // .input(Items.COPPER_INGOT, 5) + // .input(ModItems.PLANT_FIBER, 1) + // .output(Items.COPPER_LEGGINGS) + // .time(3) + // .unlockedBy("has_copper_ingot", provider.has(Items.COPPER_INGOT)) + // .save(exporter, "copper_gauntlets"); + // new WorkbenchRecipeBuilder(ModRecipes.ARMORERS_TYPE, ModRecipes.ARMORERS_SERIALIZER) + // .input(Items.COPPER_INGOT, 2) + // .input(ModItems.PLANT_FIBER, 3) + // .input(ItemTags.LOGS, lookup) + // .output(ModItems.COPPER_SHIELD) + // .time(3) + // .unlockedBy("has_copper_ingot", provider.has(Items.COPPER_INGOT)) + // .save(exporter, "COPPER_SHIELD"); + + // Wood Armor + // TODO: WoodenArmor Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.ARMORERS_TYPE, ModRecipes.ARMORERS_SERIALIZER) + // .input(ItemTags.LOGS, lookup, 15) + // .input(ModItems.PLANT_FIBER, 3) + // .output(Items.COPPER_CHESTPLATE) + // .time(3) + // .unlockedBy("has_copper_ingot", provider.has(Items.COPPER_INGOT)) + // .save(exporter, "copper_cuirass"); + // new WorkbenchRecipeBuilder(ModRecipes.ARMORERS_TYPE, ModRecipes.ARMORERS_SERIALIZER) + // .input(Items.COPPER_INGOT, 6) + // .input(ModItems.PLANT_FIBER, 2) + // .output(Items.COPPER_HELMET) + // .time(3) + // .unlockedBy("has_copper_ingot", provider.has(Items.COPPER_INGOT)) + // .save(exporter, "copper_helmet"); + // new WorkbenchRecipeBuilder(ModRecipes.ARMORERS_TYPE, ModRecipes.ARMORERS_SERIALIZER) + // .input(Items.COPPER_INGOT, 9) + // .input(ModItems.PLANT_FIBER, 3) + // .output(Items.COPPER_LEGGINGS) + // .time(3) + // .unlockedBy("has_copper_ingot", provider.has(Items.COPPER_INGOT)) + // .save(exporter, "copper_greaves"); + // new WorkbenchRecipeBuilder(ModRecipes.ARMORERS_TYPE, ModRecipes.ARMORERS_SERIALIZER) + // .input(Items.COPPER_INGOT, 5) + // .input(ModItems.PLANT_FIBER, 1) + // .output(Items.COPPER_LEGGINGS) + // .time(3) + // .unlockedBy("has_copper_ingot", provider.has(Items.COPPER_INGOT)) + // .save(exporter, "copper_gauntlets"); + + + } +} diff --git a/src/client/java/com/tcm/MineTale/datagen/recipes/BlacksmithRecipes.java b/src/client/java/com/tcm/MineTale/datagen/recipes/BlacksmithRecipes.java new file mode 100644 index 0000000..c8700e9 --- /dev/null +++ b/src/client/java/com/tcm/MineTale/datagen/recipes/BlacksmithRecipes.java @@ -0,0 +1,89 @@ +package com.tcm.MineTale.datagen.recipes; + +import net.minecraft.core.HolderLookup; +import net.minecraft.data.recipes.RecipeOutput; +import net.minecraft.data.recipes.RecipeProvider; + +public class BlacksmithRecipes { + public static void buildRecipes(RecipeProvider provider, RecipeOutput exporter, HolderLookup.Provider lookup) { + // new WorkbenchRecipeBuilder(ModRecipes.BLACKSMITH_TYPE, ModRecipes.BLACKSMITH_SERIALIZER) + // .input(Items.COPPER_INGOT, 4) + // .input(ItemTags.LOGS, lookup, 2) + // .input(ModItems.PLANT_FIBER, 4) + // .output(Items.COPPER_AXE) + // .time(3) + // .unlockedBy("has_blacksmith_workbench", provider.has(ModBlocks.BLACKSMITH_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.BLACKSMITH_SEARCH) + // .save(exporter, "COPPER_AXE"); + + // new WorkbenchRecipeBuilder(ModRecipes.BLACKSMITH_TYPE, ModRecipes.BLACKSMITH_SERIALIZER) + // .input(Items.COPPER_INGOT, 6) + // .input(ItemTags.LOGS, lookup, 6) + // .input(ModItems.PLANT_FIBER, 4) + // .output(ModItems.COPPER_BATTLEAXE) + // .time(3) + // .unlockedBy("has_blacksmith_workbench", provider.has(ModBlocks.BLACKSMITH_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.BLACKSMITH_SEARCH) + // .save(exporter, "COPPER_BATTLEAXE"); + + // new WorkbenchRecipeBuilder(ModRecipes.BLACKSMITH_TYPE, ModRecipes.BLACKSMITH_SERIALIZER) + // .input(Items.COPPER_INGOT, 4) + // .input(ItemTags.LOGS, lookup, 3) + // .input(ModItems.PLANT_FIBER, 3) + // .output(ModItems.COPPER_DAGGERS) + // .time(3) + // .unlockedBy("has_blacksmith_workbench", provider.has(ModBlocks.BLACKSMITH_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.BLACKSMITH_SEARCH) + // .save(exporter, "COPPER_DAGGERS"); + + // new WorkbenchRecipeBuilder(ModRecipes.BLACKSMITH_TYPE, ModRecipes.BLACKSMITH_SERIALIZER) + // .input(ItemTags.STONE_TOOL_MATERIALS, lookup, 6) + // .input(ItemTags.LOGS, lookup, 2) + // .input(ModItems.PLANT_FIBER, 4) + // .output(ModItems.CRUDE_LONGSWORD) + // .time(3) + // .unlockedBy("has_blacksmith_workbench", provider.has(ModBlocks.BLACKSMITH_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.BLACKSMITH_SEARCH) + // .save(exporter, "CRUDE_LONGSWORD"); + + // new WorkbenchRecipeBuilder(ModRecipes.BLACKSMITH_TYPE, ModRecipes.BLACKSMITH_SERIALIZER) + // .input(Items.COPPER_INGOT, 6) + // .input(ItemTags.LOGS, lookup, 2) + // .input(ModItems.PLANT_FIBER, 4) + // .output(ModItems.COPPER_LONGSWORD) + // .time(3) + // .unlockedBy("has_blacksmith_workbench", provider.has(ModBlocks.BLACKSMITH_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.BLACKSMITH_SEARCH) + // .save(exporter, "COPPER_LONGSWORD"); + + // new WorkbenchRecipeBuilder(ModRecipes.BLACKSMITH_TYPE, ModRecipes.BLACKSMITH_SERIALIZER) + // .input(Items.COPPER_INGOT, 6) + // .input(ItemTags.LOGS, lookup, 10) + // .input(ModItems.PLANT_FIBER, 2) + // .output(ModItems.COPPER_MACE) + // .time(3) + // .unlockedBy("has_blacksmith_workbench", provider.has(ModBlocks.BLACKSMITH_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.BLACKSMITH_SEARCH) + // .save(exporter, "COPPER_MACE"); + + // new WorkbenchRecipeBuilder(ModRecipes.BLACKSMITH_TYPE, ModRecipes.BLACKSMITH_SERIALIZER) + // .input(Items.COPPER_INGOT, 4) + // .input(ItemTags.LOGS, lookup, 4) + // .input(ModItems.PLANT_FIBER, 6) + // .output(ModItems.COPPER_SHORTBOW) + // .time(3) + // .unlockedBy("has_blacksmith_workbench", provider.has(ModBlocks.BLACKSMITH_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.BLACKSMITH_SEARCH) + // .save(exporter, "COPPER_SHORTBOW"); + + // new WorkbenchRecipeBuilder(ModRecipes.BLACKSMITH_TYPE, ModRecipes.BLACKSMITH_SERIALIZER) + // .input(Items.COPPER_INGOT, 4) + // .input(ItemTags.LOGS, lookup, 4) + // .input(ModItems.PLANT_FIBER, 3) + // .output(ModItems.COPPER_SWORD) + // .time(3) + // .unlockedBy("has_blacksmith_workbench", provider.has(ModBlocks.BLACKSMITH_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.BLACKSMITH_SEARCH) + // .save(exporter, "COPPER_SWORD"); + } +} diff --git a/src/client/java/com/tcm/MineTale/datagen/recipes/BuilderRecipes.java b/src/client/java/com/tcm/MineTale/datagen/recipes/BuilderRecipes.java new file mode 100644 index 0000000..2c2a960 --- /dev/null +++ b/src/client/java/com/tcm/MineTale/datagen/recipes/BuilderRecipes.java @@ -0,0 +1,28 @@ +package com.tcm.MineTale.datagen.recipes; + +import net.minecraft.core.HolderLookup; +import net.minecraft.data.recipes.RecipeOutput; +import net.minecraft.data.recipes.RecipeProvider; + +public class BuilderRecipes { + public static void buildRecipes(RecipeProvider provider, RecipeOutput exporter, HolderLookup.Provider lookup) { + + // TODO: BUILDERS_WORKBENCH_BLOCK & ROPE Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.BUILDER_TYPE, ModRecipes.BUILDER_SERIALIZER) + // .input(ModItems.PLANT_FIBER) + // .output(ModBlocks.ROPE.asItem()) + // .time(3) + // .unlockedBy("has_builders_workbench", provider.has(ModBlocks.BUILDERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.BUILDER_SEARCH) + // .save(exporter, "builders_workbench_rope"); + + // TODO: BUILDERS_WORKBENCH_BLOCK & ROPE_DIAGONAL Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.BUILDER_TYPE, ModRecipes.BUILDER_SERIALIZER) + // .input(ModItems.PLANT_FIBER) + // .output(ModBlocks.ROPE_DIAGONAL.asItem()) + // .time(3) + // .unlockedBy("has_builders_workbench", provider.has(ModBlocks.BUILDERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.BUILDER_SEARCH) + // .save(exporter, "builders_workbench_rope_diagonal"); + } +} diff --git a/src/client/java/com/tcm/MineTale/datagen/recipes/FarmerRecipes.java b/src/client/java/com/tcm/MineTale/datagen/recipes/FarmerRecipes.java new file mode 100644 index 0000000..eb0f05e --- /dev/null +++ b/src/client/java/com/tcm/MineTale/datagen/recipes/FarmerRecipes.java @@ -0,0 +1,483 @@ +package com.tcm.MineTale.datagen.recipes; + +import net.minecraft.core.HolderLookup; +import net.minecraft.data.recipes.RecipeOutput; +import net.minecraft.data.recipes.RecipeProvider; + +public class FarmerRecipes { + public static void buildRecipes(RecipeProvider provider, RecipeOutput exporter, HolderLookup.Provider lookup) { + // TODO: ChickenCoop Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.FARMERS_TYPE, ModRecipes.FARMERS_SERIALIZER) + // .input(ItemTags.PLANKS, lookup, 20) + // .input(ModItems.ESSENCE_OF_LIFE, 50) + // .input(ModItems.PLANT_FIBER, 6) + // .output(ModBlocks.CHICKEN_COOP.asItem()) + // .time(2) + // .unlockedBy("has_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH.asItem())) + // .bookCategory(ModRecipeDisplay.FARMERS_SEARCH) + // .save(exporter, "CHICKEN_COOP"); + + // TODO: LOTS Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(ModItems.GREATER_ESSENCE_OF_LIFE, 100) + // .input(ModItems.WILD_BERRY, 100) + // .input(Items.WHEAT, 100) + // .input(ModItems.LETTUCE, 100) + // .input(Items.CARROT, 100) + // .input(ModItems.CORN, 100) + // .input(ModItems.CAULIFLOWER, 100) + // .input(ModItems.TURNIP, 100) + // .input(ModItems.AUBERGINE, 100) + // .input(Items.PUMPKIN) + // .input(ModItems.TOMATO, 100) + // .input(ModItems.CHILLI, 100) + // .input(ModItems.COTTON, 100) + // .input(ModItems.RICE, 100) + // .input(ModItems.ONION, 100) + // .input(Items.POTATO, 100) + // .input(Items.APPLE, 100) + // .input(Items.EGG, 100) + // .input(ModItems.WOOL_SCRAPS, 100) + // .input(ItemTags.FISHES, lookup, 100) + // .input(ItemTags.MOSS, lookup, 100) + // .input(ItemTags.LOGS, lookup, 100) + // .input(ModItems.POOP, 100) + // .input(Items.FEATHER, 100) + // .input(ModItems.TREE_SAP, 100) + // .input(ModItems.PLANT_FIBER, 100) + // .input(ItemTags.MILK_BUCKET, 8) + // .input(ItemTags.MOSS_HORN_MILK_BUCKET, 8) + // .output(ModBlocks.HARVEST_TROPHY.asItem()) + // .time(10) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "farmers_workbench_harvest_trophy"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(ModItems.PLANT_FIBER, 20) + // .input(ItemTags.SOIL, 2) + // .input(ModItems.ESSENCE_OF_LIFE, 10) + // .input(ModBlocks.BAMBOO_LOG) + // .output(ModBlocks.BAMBOO_PLANTER.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "BAMBOO_PLANTER"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(ModBlocks.BLUE_MOSS, 4) + // .input(ModItems.PLANT_FIBER, 2) + // .output(ModBlocks.BLUE_MOSS_BLOCK.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "BLUE_MOSS_BLOCK"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(ModBlocks.DARK_GREEN_MOSS, 4) + // .input(ModItems.PLANT_FIBER, 2) + // .output(ModBlocks.DARK_GREEN_MOSS_BLOCK.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "DARK_GREEN_MOSS_BLOCK"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(ModBlocks.MOSS, 4) + // .input(ModItems.PLANT_FIBER, 2) + // .output(ModBlocks.GREEN_MOSS_RUG.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "GREEN_MOSS_RUG"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(ModBlocks.RED_MOSS, 4) + // .input(ModItems.PLANT_FIBER, 2) + // .output(ModBlocks.RED_MOSS_BLOCK.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "RED_MOSS_BLOCK"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(ModBlocks.BLUE_MOSS, 4) + // .input(ModItems.PLANT_FIBER, 2) + // .output(ModBlocks.BLUE_MOSS_RUG.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "BLUE_MOSS_RUG"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(ModBlocks.RED_MOSS, 4) + // .input(ModItems.PLANT_FIBER, 2) + // .output(ModBlocks.RED_HANGING_MOSS.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "RED_HANGING_MOSS"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(ModBlocks.DARK_GREEN_MOSS, 4) + // .input(ModItems.PLANT_FIBER, 2) + // .output(ModBlocks.DARK_GREEN_HANGING_MOSS.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "DARK_GREEN_HANGING_MOSS"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(ModBlocks.BLUE_MOSS, 4) + // .input(ModItems.PLANT_FIBER, 2) + // .output(ModBlocks.BLUE_HANGING_MOSS.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "BLUE_HANGING_MOSS"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(ModBlocks.YELLOW_MOSS, 4) + // .input(ModItems.PLANT_FIBER, 2) + // .output(ModBlocks.YELLOW_MOSS_BLOCK.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "YELLOW_MOSS_BLOCK"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(ModBlocks.YELLOW_MOSS, 4) + // .input(ModItems.PLANT_FIBER, 2) + // .output(ModBlocks.YELLOW_HANGING_MOSS.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "YELLOW_HANGING_MOSS"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(ModBlocks.MOSS, 4) + // .input(ModItems.PLANT_FIBER, 2) + // .output(ModBlocks.GREEN_MOSS_BLOCK.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "GREEN_MOSS_BLOCK"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(ModBlocks.MOSS, 4) + // .input(ModItems.PLANT_FIBER, 2) + // .output(ModBlocks.GREEN_HANGING_MOSS.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "GREEN_HANGING_MOSS"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(ModBlocks.DARK_GREEN_MOSS, 4) + // .input(ModItems.PLANT_FIBER, 2) + // .output(ModBlocks.DARK_GREEN_MOSS_RUG.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "DARK_GREEN_MOSS_RUG"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(ModBlocks.YELLOW_MOSS, 4) + // .input(ModItems.PLANT_FIBER, 2) + // .output(ModBlocks.YELLOW_MOSS_RUG.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "YELLOW_MOSS_RUG"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(ModBlocks.MOSS, 4) + // .input(ModItems.PLANT_FIBER, 2) + // .output(ModBlocks.SORREL_RUG.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "SORREL_RUG"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(ModBlocks.RED_MOSS, 4) + // .input(ModItems.PLANT_FIBER, 2) + // .output(ModBlocks.RED_MOSS_RUG.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "RED_MOSS_RUG"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(ModBlocks.RED_MOSS, 4) + // .input(ModItems.PLANT_FIBER, 2) + // .output(ModBlocks.SHORT_RED_MOSS.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "SHORT_RED_MOSS"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(ModBlocks.YELLOW_MOSS, 4) + // .input(ModItems.PLANT_FIBER, 2) + // .output(ModBlocks.SHORT_YELLOW_MOSS.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "SHORT_YELLOW_MOSS"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(ModBlocks.BLUE_MOSS, 4) + // .input(ModItems.PLANT_FIBER, 2) + // .output(ModBlocks.SHORT_BLUE_MOSS.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "SHORT_BLUE_MOSS"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(ModBlocks.DARK_GREEN_MOSS, 4) + // .input(ModItems.PLANT_FIBER, 2) + // .output(ModBlocks.SHORT_DARK_GREEN_MOSS.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "SHORT_DARK_GREEN_MOSS"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(ModBlocks.MOSS, 4) + // .input(ModItems.PLANT_FIBER, 2) + // .output(ModBlocks.SHORT_MOSS.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "SHORT_MOSS"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(ModBlocks.BLUE_MOSS, 4) + // .input(ModItems.PLANT_FIBER, 2) + // .output(ModBlocks.SHORT_BLUE_MOSS.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "SHORT_BLUE_MOSS"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(ModItems.ESSENCE_OF_LIFE) + // .input(ModItems.PLANT_FIBER, 2) + // .output(ModBlocks.LIANA.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "LIANA"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(ModItems.ESSENCE_OF_LIFE) + // .input(ModItems.PLANT_FIBER, 2) + // .output(ModBlocks.VINE.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "VINE"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(ModItems.ESSENCE_OF_LIFE) + // .input(ModItems.PLANT_FIBER, 2) + // .output(ModBlocks.DRY_VINE.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "DRY_VINE"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(ModItems.ESSENCE_OF_LIFE) + // .input(ModItems.PLANT_FIBER, 2) + // .output(ModBlocks.POISONED_IVY.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "POISONED_IVY"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(ModItems.ESSENCE_OF_LIFE) + // .input(ModItems.PLANT_FIBER, 2) + // .output(ModBlocks.WALL_IVY.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "WALL__IVY"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(ModItems.ESSENCE_OF_LIFE) + // .input(ModItems.PLANT_FIBER, 2) + // .output(ModBlocks.IVY.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "IVY"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(ModItems.ESSENCE_OF_LIFE) + // .input(ModItems.PLANT_FIBER, 4) + // .output(ModBlocks.VINE_RUG.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "VINE_RUG"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(BlockTags.SOIL) + // .input(ModItems.PLANT_FIBER) + // .output(ModBlocks.COLD_GRASS.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "COLD_GRASS"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(BlockTags.SOIL) + // .input(ModItems.PLANT_FIBER) + // .output(ModBlocks.BURNT_GRASS.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "BURNT_GRASS"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(BlockTags.SOIL) + // .input(ModItems.PLANT_FIBER) + // .output(ModBlocks.POISONED_DIRT.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "POISONED_DIRT"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(BlockTags.SOIL) + // .input(ModItems.PLANT_FIBER) + // .output(ModBlocks.DEEP_GRASS.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "DEEP_GRASS"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(BlockTags.SOIL) + // .input(ModItems.PLANT_FIBER) + // .output(ModBlocks.DRY_DIRT.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "DRY_DIRT"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(BlockTags.SOIL) + // .input(ModItems.PLANT_FIBER) + // .output(ModBlocks.DRY_GRASS.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "DRY_GRASS"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(BlockTags.SOIL) + // .input(ModItems.PLANT_FIBER) + // .output(ModBlocks.WET_GRASS.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "WET_GRASS"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(BlockTags.SOIL) + // .input(ModItems.PLANT_FIBER) + // .output(ModBlocks.SUMMER_GRASS.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "SUMMER_GRASS"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(BlockTags.SOIL) + // .input(ModItems.PLANT_FIBER) + // .output(Blocks.GRASS_BLOCK.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "GRASS_BLOCK"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(BlockTags.SOIL) + // .input(ModItems.PLANT_FIBER) + // .output(ModBlocks.COLD_DIRT.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "COLD_DIRT"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(BlockTags.SOIL) + // .input(ModItems.PLANT_FIBER) + // .output(ModBlocks.FULL_GRASS.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "FULL_GRASS"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(BlockTags.SOIL) + // .input(ModItems.PLANT_FIBER) + // .output(ModBlocks.NEEDLED_SOIL.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "NEEDLED_SOIL"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(BlockTags.SOIL) + // .input(ModItems.PLANT_FIBER) + // .output(ModBlocks.SOIL_PATHWAY.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "SOIL_PATHWAY"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(BlockTags.SOIL) + // .input(ModItems.PLANT_FIBER) + // .output(Blocks.MUD.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "MUD"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(BlockTags.SOIL) + // .input(ModItems.PLANT_FIBER) + // .output(ModBlocks.LEAFY_SOIL.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "LEAFY_SOIL"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(BlockTags.SOIL) + // .input(ModItems.PLANT_FIBER) + // .output(ModBlocks.DRY_MUD.asItem()) + // .time(2) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "DRY_MUD"); + + // new WorkbenchRecipeBuilder(ModRecipes.FARMER_TYPE, ModRecipes.FARMER_SERIALIZER) + // .input(ItemTags.LOGS, lookup, 10) + // .input(ModItems.ESSENCE_OF_LIFE, 50) + // .input(ModItems.PLANT_FIBER, 20) + // .input(Items.IRON_INGOT) + // .output(ModBlocks.FISHING_TRAP.asItem()) + // .time(10) + // .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FARMER_SEARCH) + // .save(exporter, "FISHING_TRAP"); + } +} diff --git a/src/client/java/com/tcm/MineTale/datagen/recipes/ForgeRecipes.java b/src/client/java/com/tcm/MineTale/datagen/recipes/ForgeRecipes.java new file mode 100644 index 0000000..762729a --- /dev/null +++ b/src/client/java/com/tcm/MineTale/datagen/recipes/ForgeRecipes.java @@ -0,0 +1,19 @@ +package com.tcm.MineTale.datagen.recipes; + +import net.minecraft.core.HolderLookup; +import net.minecraft.data.recipes.RecipeOutput; +import net.minecraft.data.recipes.RecipeProvider; + +public class ForgeRecipes { + public static void buildRecipes(RecipeProvider provider, RecipeOutput exporter, HolderLookup.Provider lookup) { + // new WorkbenchRecipeBuilder(ModRecipes.FORGE_TYPE, ModRecipes.FORGE_SERIALIZER) + // .input(Items.COPPER_INGOT, 4) + // .input(ItemTags.LOGS, lookup, 6) + // .input(ModItems.PLANT_FIBER, 2) + // .output(Items.COPPER_CLUB) + // .time(3) + // .unlockedBy("has_forge_workbench", provider.has(ModBlocks.FORGE_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.FORGE_SEARCH) + // .save(exporter, "COPPER_CLUB"); + } +} diff --git a/src/client/java/com/tcm/MineTale/datagen/recipes/FurnitureRecipes.java b/src/client/java/com/tcm/MineTale/datagen/recipes/FurnitureRecipes.java new file mode 100644 index 0000000..8cc9a3e --- /dev/null +++ b/src/client/java/com/tcm/MineTale/datagen/recipes/FurnitureRecipes.java @@ -0,0 +1,267 @@ +package com.tcm.MineTale.datagen.recipes; + +import net.minecraft.core.HolderLookup; +import net.minecraft.data.recipes.RecipeOutput; +import net.minecraft.data.recipes.RecipeProvider; + +public class FurnitureRecipes { + public static void buildRecipes(RecipeProvider provider, RecipeOutput exporter, HolderLookup.Provider lookup) { + // TODO: WOODCUTTERS_BLOCK & FURNITURE_WORKBENCH_BLOCK Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.FURNITURE_TYPE, ModRecipes.FURNITURE_SERIALIZER) + // .input(ItemTags.LOGS, lookup) + // .input(ModItems.RUBBLE, 2) + // .input(ModItems.PLANT_FIBER, 2) + // .input(Items.STICK, 2) + // .output(ModItems.WOODCUTTERS_BLOCK) + // .unlockedBy("has_furniture_workbench", provider.has(ModBlocks.FURNITURE_WORKBENCH_BLOCK)) + // .bookCategory(ModRecipeDisplay.FURNITURE_SEARCH) + // .save(exporter, "woodcutters_block"); + + // TODO: LARGE_PILE_OF_BOOKS & FURNITURE_WORKBENCH_BLOCK Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.FURNITURE_TYPE, ModRecipes.FURNITURE_SERIALIZER) + // .input(ModItems.PLANT_FIBER, 12) + // .input(ModItems.LIGHT_LEATHER, 4) + // .output(ModBlocks.LARGE_PILE_OF_BOOKS.asItem()) + // .unlockedBy("has_furniture_workbench", provider.has(ModBlocks.FURNITURE_WORKBENCH_BLOCK)) + // .bookCategory(ModRecipeDisplay.FURNITURE_SEARCH) + // .save(exporter, "LARGE_PILE_OF_BOOKS"); + + // TODO: SMALL_PILE_OF_BOOKS & FURNITURE_WORKBENCH_BLOCK Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.FURNITURE_TYPE, ModRecipes.FURNITURE_SERIALIZER) + // .input(ModItems.PLANT_FIBER, 6) + // .input(ModItems.LIGHT_LEATHER, 2) + // .output(ModBlocks.SMALL_PILE_OF_BOOKS.asItem()) + // .unlockedBy("has_furniture_workbench", provider.has(ModBlocks.FURNITURE_WORKBENCH_BLOCK)) + // .bookCategory(ModRecipeDisplay.FURNITURE_SEARCH) + // .save(exporter, "SMALL_PILE_OF_BOOKS"); + + // TODO: KWEEBEC_PLUSHIE & FURNITURE_WORKBENCH_BLOCK Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.FURNITURE_TYPE, ModRecipes.FURNITURE_SERIALIZER) + // .input(ModBlocks.CYAN_CLOTH, 2) + // .input(ModItems.PLANT_FIBER, 4) + // .output(ModBlocks.KWEEBEC_PLUSHIE.asItem()) + // .unlockedBy("has_furniture_workbench", provider.has(ModBlocks.FURNITURE_WORKBENCH_BLOCK)) + // .bookCategory(ModRecipeDisplay.FURNITURE_SEARCH) + // .save(exporter, "KWEEBEC_PLUSHIE"); + + // TODO: OLD_SCROLL & FURNITURE_WORKBENCH_BLOCK Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.FURNITURE_TYPE, ModRecipes.FURNITURE_SERIALIZER) + // .input(ModItems.PLANT_FIBER, 4) + // .input(Items.STICK, 2) + // .output(ModBlocks.OLD_SCROLL.asItem()) + // .unlockedBy("has_furniture_workbench", provider.has(ModBlocks.FURNITURE_WORKBENCH_BLOCK)) + // .bookCategory(ModRecipeDisplay.FURNITURE_SEARCH) + // .save(exporter, "OLD_SCROLL"); + + // TODO: ANCIENT_CANDLE & FURNITURE_WORKBENCH_BLOCK Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.FURNITURE_TYPE, ModRecipes.FURNITURE_SERIALIZER) + // .input(ModItems.PLANT_FIBER, 2) + // .input(ModItems.TREE_SAP, 2) + // .output(ModBlocks.ANCIENT_CANDLE.asItem()) + // .unlockedBy("has_furniture_workbench", provider.has(ModBlocks.FURNITURE_WORKBENCH_BLOCK)) + // .bookCategory(ModRecipeDisplay.FURNITURE_SEARCH) + // .save(exporter, "ANCIENT_CANDLE"); + + // TODO: SMALL_RED_DOTTED_CHRISTMAS_PACKET & FURNITURE_WORKBENCH_BLOCK Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.FURNITURE_TYPE, ModRecipes.FURNITURE_SERIALIZER) + // .input(ModItems.PLANT_FIBER, 2) + // .input(ModItems.LINEN_SCRAPS) + // .input(ModItems.YELLOW_PETALS) + // .input(ModItems.RED_PETALS, 2) + // .output(ModBlocks.SMALL_RED_DOTTED_CHRISTMAS_PACKET.asItem()) + // .unlockedBy("has_furniture_workbench", provider.has(ModBlocks.FURNITURE_WORKBENCH_BLOCK)) + // .bookCategory(ModRecipeDisplay.FURNITURE_SEARCH) + // .save(exporter, "SMALL_RED_DOTTED_CHRISTMAS_PACKET"); + + // TODO: SMALL_RED_CHRISTMAS_PACKET & FURNITURE_WORKBENCH_BLOCK Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.FURNITURE_TYPE, ModRecipes.FURNITURE_SERIALIZER) + // .input(ModItems.PLANT_FIBER, 2) + // .input(ModItems.LINEN_SCRAPS) + // .input(ModItems.YELLOW_PETALS, 2) + // .output(ModBlocks.SMALL_RED_CHRISTMAS_PACKET.asItem()) + // .unlockedBy("has_furniture_workbench", provider.has(ModBlocks.FURNITURE_WORKBENCH_BLOCK)) + // .bookCategory(ModRecipeDisplay.FURNITURE_SEARCH) + // .save(exporter, "SMALL_RED_CHRISTMAS_PACKET"); + + // TODO: SMALL_CHRISTMAS_PACKET & FURNITURE_WORKBENCH_BLOCK Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.FURNITURE_TYPE, ModRecipes.FURNITURE_SERIALIZER) + // .input(ModItems.PLANT_FIBER, 2) + // .input(ModItems.LINEN_SCRAPS) + // .input(ModItems.YELLOW_PETALS, 3) + // .output(ModBlocks.SMALL_CHRISTMAS_PACKET.asItem()) + // .unlockedBy("has_furniture_workbench", provider.has(ModBlocks.FURNITURE_WORKBENCH_BLOCK)) + // .bookCategory(ModRecipeDisplay.FURNITURE_SEARCH) + // .save(exporter, "SMALL_CHRISTMAS_PACKET"); + + // TODO: SMALL_GREEN_CHRISTMAS_PACKET & FURNITURE_WORKBENCH_BLOCK Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.FURNITURE_TYPE, ModRecipes.FURNITURE_SERIALIZER) + // .input(ModItems.PLANT_FIBER, 2) + // .input(ModItems.LINEN_SCRAPS) + // .input(ModItems.GREEN_PETALS, 3) + // .output(ModBlocks.SMALL_GREEN_CHRISTMAS_PACKET.asItem()) + // .unlockedBy("has_furniture_workbench", provider.has(ModBlocks.FURNITURE_WORKBENCH_BLOCK)) + // .bookCategory(ModRecipeDisplay.FURNITURE_SEARCH) + // .save(exporter, "SMALL_GREEN_CHRISTMAS_PACKET"); + + // TODO: SMALL_WHITE_CHRISTMAS_PACKET & FURNITURE_WORKBENCH_BLOCK Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.FURNITURE_TYPE, ModRecipes.FURNITURE_SERIALIZER) + // .input(ModItems.PLANT_FIBER, 2) + // .input(ModItems.LINEN_SCRAPS) + // .input(ModItems.WHITE_PETALS, 3) + // .output(ModBlocks.SMALL_WHITE_CHRISTMAS_PACKET.asItem()) + // .unlockedBy("has_furniture_workbench", provider.has(ModBlocks.FURNITURE_WORKBENCH_BLOCK)) + // .bookCategory(ModRecipeDisplay.FURNITURE_SEARCH) + // .save(exporter, "SMALL_WHITE_CHRISTMAS_PACKET"); + + // TODO: FERAN_CANDLE & FURNITURE_WORKBENCH_BLOCK Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.FURNITURE_TYPE, ModRecipes.FURNITURE_SERIALIZER) + // .input(ModItems.PLANT_FIBER, 2) + // .input(ModItems.TREE_SAP, 2) + // .input(Items.BONE, 4) + // .output(ModBlocks.FERAN_CANDLE.asItem()) + // .unlockedBy("has_furniture_workbench", provider.has(ModBlocks.FURNITURE_WORKBENCH_BLOCK)) + // .bookCategory(ModRecipeDisplay.FURNITURE_SEARCH) + // .save(exporter, "FERAN_CANDLE"); + + // TODO: FERAN_TORCH & FURNITURE_WORKBENCH_BLOCK Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.FURNITURE_TYPE, ModRecipes.FURNITURE_SERIALIZER) + // .input(ModItems.PLANT_FIBER, 2) + // .input(ModItems.TREE_SAP, 2) + // .input(Items.BONE, 4) + // .output(ModBlocks.FERAN_TORCH.asItem()) + // .unlockedBy("has_furniture_workbench", provider.has(ModBlocks.FURNITURE_WORKBENCH_BLOCK)) + // .bookCategory(ModRecipeDisplay.FURNITURE_SEARCH) + // .save(exporter, "FERAN_TORCH"); + + // TODO: FERAN_BED & FURNITURE_WORKBENCH_BLOCK Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.FURNITURE_TYPE, ModRecipes.FURNITURE_SERIALIZER) + // .input(ModBlocks.DRYWOOD_PLANKS, 3) + // .input(ModItems.PLANT_FIBER, 4) + // .input(ModItems.MEDIUM_LEATHER, 2) + // .input(Items.BONE, 2) + // .output(ModBlocks.FERAN_BED.asItem()) + // .unlockedBy("has_furniture_workbench", provider.has(ModBlocks.FURNITURE_WORKBENCH_BLOCK)) + // .bookCategory(ModRecipeDisplay.FURNITURE_SEARCH) + // .save(exporter, "FERAN_BED"); + + // TODO: BAMBOO_CANDLE & FURNITURE_WORKBENCH_BLOCK Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.FURNITURE_TYPE, ModRecipes.FURNITURE_SERIALIZER) + // .input(ModBlocks.BAMBOO_LOG) + // .input(ModItems.PLANT_FIBER, 2) + // .input(ModItems.TREE_SAP, 2) + // .output(ModBlocks.BAMBOO_CANDLE.asItem()) + // .unlockedBy("has_furniture_workbench", provider.has(ModBlocks.FURNITURE_WORKBENCH_BLOCK)) + // .bookCategory(ModRecipeDisplay.FURNITURE_SEARCH) + // .save(exporter, "BAMBOO_CANDLE"); + + // TODO: BAMBOO_BED & FURNITURE_WORKBENCH_BLOCK Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.FURNITURE_TYPE, ModRecipes.FURNITURE_SERIALIZER) + // .input(ModBlocks.BAMBOO_LOG, 2) + // .input(ModItems.PLANT_FIBER, 4) + // .input(ModBlocks.CYAN_CLOTH, 2) + // .input(ModBlocks.ORANGE_CLOTH) + // .input(ModBlocks.WHITE_CLOTH) + // .output(ModBlocks.BAMBOO_BED.asItem()) + // .unlockedBy("has_furniture_workbench", provider.has(ModBlocks.FURNITURE_WORKBENCH_BLOCK)) + // .bookCategory(ModRecipeDisplay.FURNITURE_SEARCH) + // .save(exporter, "BAMBOO_BED"); + + // TODO: SMALL_KWEEBEC_CHEST & FURNITURE_WORKBENCH_BLOCK Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.FURNITURE_TYPE, ModRecipes.FURNITURE_SERIALIZER) + // .input(ModItems.ESSENCE_OF_LIFE, 2) + // .input(ModItems.PLANT_FIBER, 2) + // .input(Items.STICK) + // .output(ModBlocks.SMALL_KWEEBEC_CHEST.asItem()) + // .unlockedBy("has_furniture_workbench", provider.has(ModBlocks.FURNITURE_WORKBENCH_BLOCK)) + // .bookCategory(ModRecipeDisplay.FURNITURE_SEARCH) + // .save(exporter, "SMALL_KWEEBEC_CHEST"); + + // TODO: LUMBERJACK_BED & FURNITURE_WORKBENCH_BLOCK Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.FURNITURE_TYPE, ModRecipes.FURNITURE_SERIALIZER) + // .input(ModBlocks.HARDWOOD_PLANKS, 3) + // .input(ModItems.PLANT_FIBER, 4) + // .input(ModItems.HEAVY_HIDE, 2) + // .input(ModItems.WHITE_CLOTH) + // .output(ModBlocks.LUMBERJACK_BED.asItem()) + // .unlockedBy("has_furniture_workbench", provider.has(ModBlocks.FURNITURE_WORKBENCH_BLOCK)) + // .bookCategory(ModRecipeDisplay.FURNITURE_SEARCH) + // .save(exporter, "LUMBERJACK_BED"); + + // TODO: KWEEBEC_CANDLE & FURNITURE_WORKBENCH_BLOCK Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.FURNITURE_TYPE, ModRecipes.FURNITURE_SERIALIZER) + // .input(ModItems.TREE_SAP, 2) + // .input(ModItems.PLANT_FIBER, 2) + // .output(ModBlocks.KWEEBEC_CANDLE.asItem()) + // .unlockedBy("has_furniture_workbench", provider.has(ModBlocks.FURNITURE_WORKBENCH_BLOCK)) + // .bookCategory(ModRecipeDisplay.FURNITURE_SEARCH) + // .save(exporter, "KWEEBEC_CANDLE"); + + // TODO: KWEEBEC_BED & FURNITURE_WORKBENCH_BLOCK Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.FURNITURE_TYPE, ModRecipes.FURNITURE_SERIALIZER) + // .input(ItemTags.LOGS, lookup, 3) + // .input(ModItems.PLANT_FIBER, 4) + // .output(ModBlocks.KWEEBEC_BED.asItem()) + // .unlockedBy("has_furniture_workbench", provider.has(ModBlocks.FURNITURE_WORKBENCH_BLOCK)) + // .bookCategory(ModRecipeDisplay.FURNITURE_SEARCH) + // .save(exporter, "KWEEBEC_BED"); + + // TODO: TAVERN_CANDLE & FURNITURE_WORKBENCH_BLOCK Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.FURNITURE_TYPE, ModRecipes.FURNITURE_SERIALIZER) + // .input(ModItems.TREE_SAP, 2) + // .input(ModItems.PLANT_FIBER, 2) + // .output(ModBlocks.TAVERN_CANDLE.asItem()) + // .unlockedBy("has_furniture_workbench", provider.has(ModBlocks.FURNITURE_WORKBENCH_BLOCK)) + // .bookCategory(ModRecipeDisplay.FURNITURE_SEARCH) + // .save(exporter, "TAVERN_CANDLE"); + + // TODO: TAVERN_BED & FURNITURE_WORKBENCH_BLOCK Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.FURNITURE_TYPE, ModRecipes.FURNITURE_SERIALIZER) + // .input(ModBlocks.DARKWOOD_PLANKS, 3) + // .input(ModItems.PLANT_FIBER, 4) + // .input(ModBlocks.RED_CLOTH, 2) + // .input(ModBlocks.WHITE_CLOTH) + // .output(ModBlocks.TAVERN_BED.asItem()) + // .unlockedBy("has_furniture_workbench", provider.has(ModBlocks.FURNITURE_WORKBENCH_BLOCK)) + // .bookCategory(ModRecipeDisplay.FURNITURE_SEARCH) + // .save(exporter, "TAVERN_BED"); + + // TODO: WINTER_ROLL & FURNITURE_WORKBENCH_BLOCK Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.FURNITURE_TYPE, ModRecipes.FURNITURE_SERIALIZER) + // .input(ModItems.PLANT_FIBER, 4) + // .input(ModItems.YELLOW_PETALS) + // .output(ModBlocks.WINTER_ROLL.asItem()) + // .unlockedBy("has_furniture_workbench", provider.has(ModBlocks.FURNITURE_WORKBENCH_BLOCK)) + // .bookCategory(ModRecipeDisplay.FURNITURE_SEARCH) + // .save(exporter, "WINTER_ROLL"); + + // TODO: WINTER_BAUBLE & FURNITURE_WORKBENCH_BLOCK Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.FURNITURE_TYPE, ModRecipes.FURNITURE_SERIALIZER) + // .input(ModItems.PLANT_FIBER) + // .input(ModItems.YELLOW_CRYSTAL_SHARDS) + // .input(ModItems.RED_CRYSTAL_SHARDS) + // .output(ModBlocks.WINTER_BAUBLE.asItem()) + // .unlockedBy("has_furniture_workbench", provider.has(ModBlocks.FURNITURE_WORKBENCH_BLOCK)) + // .bookCategory(ModRecipeDisplay.FURNITURE_SEARCH) + // .save(exporter, "WINTER_BAUBLE"); + + // TODO: WINTER_WREATH & FURNITURE_WORKBENCH_BLOCK Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.FURNITURE_TYPE, ModRecipes.FURNITURE_SERIALIZER) + // .input(ModItems.PLANT_FIBER, 6) + // .input(ModItems.PINECONE, 4) + // .input(ModItems.RED_PETALS, 2) + // .output(ModBlocks.WINTER_WREATH.asItem()) + // .unlockedBy("has_furniture_workbench", provider.has(ModBlocks.FURNITURE_WORKBENCH_BLOCK)) + // .bookCategory(ModRecipeDisplay.FURNITURE_SEARCH) + // .save(exporter, "WINTER_WREATH"); + + // TODO: WINTER_GARLAND & FURNITURE_WORKBENCH_BLOCK Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.FURNITURE_TYPE, ModRecipes.FURNITURE_SERIALIZER) + // .input(ModItems.PLANT_FIBER, 3) + // .input(ModItems.PINECONE, 3) + // .input(ModItems.RED_PETALS, 2) + // .output(ModBlocks.WINTER_GARLAND.asItem()) + // .unlockedBy("has_furniture_workbench", provider.has(ModBlocks.FURNITURE_WORKBENCH_BLOCK)) + // .bookCategory(ModRecipeDisplay.FURNITURE_SEARCH) + // .save(exporter, "WINTER_GARLAND"); + } +} diff --git a/src/client/java/com/tcm/MineTale/datagen/recipes/GeneralRecipes.java b/src/client/java/com/tcm/MineTale/datagen/recipes/GeneralRecipes.java new file mode 100644 index 0000000..8c35556 --- /dev/null +++ b/src/client/java/com/tcm/MineTale/datagen/recipes/GeneralRecipes.java @@ -0,0 +1,11 @@ +package com.tcm.MineTale.datagen.recipes; + +import net.minecraft.core.HolderLookup; +import net.minecraft.data.recipes.RecipeOutput; +import net.minecraft.data.recipes.RecipeProvider; + +public class GeneralRecipes { + public static void buildRecipes(RecipeProvider provider, RecipeOutput exporter, HolderLookup.Provider lookup) { + + } +} diff --git a/src/client/java/com/tcm/MineTale/datagen/recipes/WorkbenchRecipes.java b/src/client/java/com/tcm/MineTale/datagen/recipes/WorkbenchRecipes.java new file mode 100644 index 0000000..63ce4ba --- /dev/null +++ b/src/client/java/com/tcm/MineTale/datagen/recipes/WorkbenchRecipes.java @@ -0,0 +1,195 @@ +package com.tcm.MineTale.datagen.recipes; + +import com.tcm.MineTale.datagen.builders.WorkbenchRecipeBuilder; +import com.tcm.MineTale.registry.ModBlocks; +import com.tcm.MineTale.registry.ModRecipeDisplay; +import com.tcm.MineTale.registry.ModRecipes; + +import net.minecraft.core.HolderLookup; +import net.minecraft.data.recipes.RecipeOutput; +import net.minecraft.data.recipes.RecipeProvider; +import net.minecraft.tags.ItemTags; +import net.minecraft.world.item.Items; + +public class WorkbenchRecipes { + public static void buildRecipes(RecipeProvider provider, RecipeOutput exporter, HolderLookup.Provider lookup) { + new WorkbenchRecipeBuilder(ModRecipes.WORKBENCH_TYPE, ModRecipes.WORKBENCH_SERIALIZER) + .input(Items.COPPER_INGOT, 2) + .input(ItemTags.LOGS, lookup, 10) + .input(ItemTags.STONE_TOOL_MATERIALS, lookup, 5) + .output(ModBlocks.ARMORERS_WORKBENCH_BLOCK.asItem()) + .time(3) + .unlockedBy("has_workbench", provider.has(ModBlocks.WORKBENCH_WORKBENCH_BLOCK.asItem())) + .bookCategory(ModRecipeDisplay.WORKBENCH_SEARCH) + .save(exporter, "workbench_armorers_workbench"); + + new WorkbenchRecipeBuilder(ModRecipes.WORKBENCH_TYPE, ModRecipes.WORKBENCH_SERIALIZER) + .input(ItemTags.LOGS, lookup, 6) + .input(ItemTags.STONE_TOOL_MATERIALS, lookup, 6) + .output(ModBlocks.FURNACE_WORKBENCH_BLOCK_T1.asItem()) + .time(3) + .unlockedBy("has_workbench", provider.has(ModBlocks.WORKBENCH_WORKBENCH_BLOCK.asItem())) + .bookCategory(ModRecipeDisplay.WORKBENCH_SEARCH) + .save(exporter, "workbench_furnace_workbench_t1"); + + // TODO: FarmersWorkbench Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.WORKBENCH_TYPE, ModRecipes.WORKBENCH_SERIALIZER) + // .input(ItemTags.LOGS, lookup, 6) + // .input(ModItems.PLANT_FIBER, 20) + // .output(ModBlocks.FARMERS_WORKBENCH) + // .time(3) + // .unlockedBy("has_workbench", provider.has(ModBlocks.WORKBENCH_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.WORKBENCH_SEARCH) + // .save(exporter, "workbench_farmers_workbench"); + + // TODO: Builder's Workbench Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.WORKBENCH_TYPE, ModRecipes.WORKBENCH_SERIALIZER) + // .input(ItemTags.LOGS, lookup, 6) + // .input(ItemTags.STONE_TOOL_MATERIALS, lookup, 3) + // .output(ModBlocks.BUILDERS_WORKBENCH.asItem()) + // .time(2) + // .unlockedBy("has_workbench", provider.has(ModBlocks.WORKBENCH_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.WORKBENCH_SEARCH) + // .save(exporter, "workbench_builders_workbench"); + + // TODO: HAY_TARGET Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.WORKBENCH_TYPE, ModRecipes.WORKBENCH_SERIALIZER) + // .input(ModItems.PLANT_FIBER) + // .output(ModBlocks.HAY_TARGET.asItem()) + // .time(1) + // .unlockedBy("has_workbench", provider.has(ModBlocks.WORKBENCH_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.WORKBENCH_SEARCH) + // .save(exporter, "workbench_hay_target"); + + // TODO: CRUDE_BEDROLL Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.WORKBENCH_TYPE, ModRecipes.WORKBENCH_SERIALIZER) + // .input(ModItems.PLANT_FIBER, 3) + // .input(ModItems.LIGHT_HIDE, 2) + // .output(ModBlocks.CRUDE_BEDROLL.asItem()) + // .time(1) + // .unlockedBy("has_workbench", provider.has(ModBlocks.WORKBENCH_WORKBENCH_BLOCK)) + // .bookCategory(ModRecipeDisplay.WORKBENCH_SEARCH) + // .save(exporter, "CRUDE_BEDROLL"); + + // TODO: CRUDE_TORCH Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.WORKBENCH_TYPE, ModRecipes.WORKBENCH_SERIALIZER) + // .input(ModItems.PLANT_FIBER) + // .input(ModItems.TREE_SAP) + // .input(Items.STICK) + // .time(0.5) + // .output(ModBlocks.CRUDE_TORCH.asItem(), 4) + // .unlockedBy("has_workbench", provider.has(ModBlocks.WORKBENCH_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.WORKBENCH_SEARCH) + // .save(exporter, "CRUDE_TORCH"); + + // TODO: CRUDE_BUILDERS_HAMMER Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.WORKBENCH_TYPE, ModRecipes.WORKBENCH_SERIALIZER) + // .input(ModItems.RUBBLE, 2) + // .input(ModItems.PLANT_FIBER, 3) + // .input(Items.STICK, 3) + // .time(3) + // .output(ModItems.CRUDE_BUILDERS_HAMMER) + // .unlockedBy("has_workbench", provider.has(ModBlocks.WORKBENCH_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.WORKBENCH_SEARCH) + // .save(exporter, "CRUDE_BUILDERS_HAMMER"); + + // TODO: COPPER_PICKAXE Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.WORKBENCH_TYPE, ModRecipes.WORKBENCH_SERIALIZER) + // .input(ModItems.PLANT_FIBER) + // .input(ItemTags.LOGS, lookup, 6) + // .input(Items.COPPER_INGOT, 3) + // .time(3) + // .output(ModItems.COPPER_PICKAXE) + // .unlockedBy("has_workbench", provider.has(ModBlocks.WORKBENCH_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.WORKBENCH_SEARCH) + // .save(exporter, "COPPER_PICKAXE"); + + // TODO: CRUDE_PICKAXE Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.WORKBENCH_TYPE, ModRecipes.WORKBENCH_SERIALIZER) + // .input(ModItems.RUBBLE, 2) + // .input(ModItems.PLANT_FIBER, 2) + // .input(Items.STICK, 2) + // .time(3) + // .output(ModItems.CRUDE_PICKAXE) + // .unlockedBy("has_workbench", provider.has(ModBlocks.WORKBENCH_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.WORKBENCH_SEARCH) + // .save(exporter, "CRUDE_PICKAXE"); + + // TODO: CRUDE_HATCHET Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.WORKBENCH_TYPE, ModRecipes.WORKBENCH_SERIALIZER) + // .input(ModItems.RUBBLE, 2) + // .input(ModItems.PLANT_FIBER, 2) + // .input(Items.STICK, 2) + // .time(3) + // .output(ModItems.CRUDE_HATCHET) + // .unlockedBy("has_workbench", provider.has(ModBlocks.WORKBENCH_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.WORKBENCH_SEARCH) + // .save(exporter, "CRUDE_HATCHET"); + + // TODO: COPPER_HATCHET Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.WORKBENCH_TYPE, ModRecipes.WORKBENCH_SERIALIZER) + // .input(ModItems.PLANT_FIBER, 3) + // .input(ItemTags.LOGS, lookup, 6) + // .input(Items.COPPER_INGOT, 3) + // .time(3) + // .output(ModItems.COPPER_HATCHET) + // .unlockedBy("has_workbench", provider.has(ModBlocks.WORKBENCH_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.WORKBENCH_SEARCH) + // .save(exporter, "COPPER_HATCHET"); + + // TODO: CRUDE_BATTLEAXE Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.WORKBENCH_TYPE, ModRecipes.WORKBENCH_SERIALIZER) + // .input(ItemTags.LOGS, lookup, 3) + // .input(ModItems.PLANT_FIBER, 4) + // .input(ItemTags.STONE_TOOL_MATERIALS, lookup, 6) + // .time(3) + // .output(ModItems.CRUDE_BATTLEAXE) + // .unlockedBy("has_workbench", provider.has(ModBlocks.WORKBENCH_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.WORKBENCH_SEARCH) + // .save(exporter, "CRUDE_BATTLEAXE"); + + // TODO: CRUDE_MACE Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.WORKBENCH_TYPE, ModRecipes.WORKBENCH_SERIALIZER) + // .input(ItemTags.LOGS, lookup, 3) + // .input(ModItems.PLANT_FIBER, 4) + // .input(ItemTags.STONE_TOOL_MATERIALS, lookup, 6) + // .time(3) + // .output(ModItems.CRUDE_MACE) + // .unlockedBy("has_workbench", provider.has(ModBlocks.WORKBENCH_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.WORKBENCH_SEARCH) + // .save(exporter, "CRUDE_MACE"); + + // TODO: CRUDE_DAGGERS Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.WORKBENCH_TYPE, ModRecipes.WORKBENCH_SERIALIZER) + // .input(ModItems.RUBBLE, 3) + // .input(ModItems.PLANT_FIBER, 2) + // .input(Items.STICK, 2) + // .time(3) + // .output(ModItems.CRUDE_DAGGERS) + // .unlockedBy("has_workbench", provider.has(ModBlocks.WORKBENCH_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.WORKBENCH_SEARCH) + // .save(exporter, "CRUDE_DAGGERS"); + + // TODO: CRUDE_SHORTBOW Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.WORKBENCH_TYPE, ModRecipes.WORKBENCH_SERIALIZER) + // .input(ModItems.PLANT_FIBER, 6) + // .input(Items.STICK, 4) + // .time(3) + // .output(ModItems.CRUDE_SHORTBOW) + // .unlockedBy("has_workbench", provider.has(ModBlocks.WORKBENCH_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.WORKBENCH_SEARCH) + // .save(exporter, "CRUDE_SHORTBOW"); + + // TODO: CRUDE_SWORD Not Implemented + // new WorkbenchRecipeBuilder(ModRecipes.WORKBENCH_TYPE, ModRecipes.WORKBENCH_SERIALIZER) + // .input(ModItems.RUBBLE, 2) + // .input(ModItems.PLANT_FIBER, 2) + // .input(Items.STICK, 2) + // .time(3) + // .output(ModItems.CRUDE_SWORD) + // .unlockedBy("has_workbench", provider.has(ModBlocks.WORKBENCH_WORKBENCH_BLOCK.asItem())) + // .bookCategory(ModRecipeDisplay.WORKBENCH_SEARCH) + // .save(exporter, "CRUDE_SWORD"); + + } +} diff --git a/src/main/java/com/tcm/MineTale/MineTale.java b/src/main/java/com/tcm/MineTale/MineTale.java index dac500e..44dc877 100644 --- a/src/main/java/com/tcm/MineTale/MineTale.java +++ b/src/main/java/com/tcm/MineTale/MineTale.java @@ -18,6 +18,7 @@ import com.tcm.MineTale.block.workbenches.entity.AbstractWorkbenchEntity; import com.tcm.MineTale.block.workbenches.menu.AbstractWorkbenchContainerMenu; +import com.tcm.MineTale.block.workbenches.menu.ArmorersWorkbenchMenu; import com.tcm.MineTale.block.workbenches.menu.WorkbenchWorkbenchMenu; import com.tcm.MineTale.network.ClientboundNearbyInventorySyncPacket; import com.tcm.MineTale.network.CraftRequestPayload; @@ -81,31 +82,82 @@ public void onInitialize() { PayloadTypeRegistry.playS2C().register(ClientboundNearbyInventorySyncPacket.TYPE, ClientboundNearbyInventorySyncPacket.STREAM_CODEC); // Register the server-side receiver using .TYPE + // ServerPlayNetworking.registerGlobalReceiver(CraftRequestPayload.TYPE, (payload, context) -> { + // context.server().execute(() -> { + // ServerPlayer player = context.player(); + + // // --- SECURITY GUARD --- + // // Ensure the player actually has the Workbench UI open before processing the craft + // if (!(player.containerMenu instanceof WorkbenchWorkbenchMenu)) { + // return; + // } + + // ItemStack requestedResult = payload.resultItem(); + // int amount = payload.amount(); + + // // 1. Get the RecipeManager from the server level + // RecipeManager recipeManager = player.level().recipeAccess(); + + // // 2. Find the recipe by matching the output ItemStack + // Optional> recipeOpt = recipeManager.getAllOfType(ModRecipes.WORKBENCH_TYPE).stream() + // .filter(holder -> { + // // Guard against recipes with no results before accessing index 0 + // if (holder.value().results().isEmpty()) { + // return false; + // } + + // // Compare the first result of the workbench recipe to the requested item + // ItemStack result = holder.value().results().get(0); + // return ItemStack.isSameItem(result, requestedResult); + // }) + // .findFirst(); + + // if (recipeOpt.isPresent()) { + // WorkbenchRecipe recipe = recipeOpt.get().value(); + + // // 2. Determine craft limit (Handle "All" logic) + // int limit = (amount == -1) ? 64 : Math.min(Math.max(amount, 0), 64); + + // for (int i = 0; i < limit; i++) { + // if (hasIngredients(player, recipe)) { + // consumeIngredients(player, recipe); + // player.getInventory().add(recipe.results().get(0).copy()); + // } else { + // break; + // } + // } + + // // 3. Sync inventory changes to the client screen + // player.containerMenu.broadcastChanges(); + // } + // }); + // }); + ServerPlayNetworking.registerGlobalReceiver(CraftRequestPayload.TYPE, (payload, context) -> { context.server().execute(() -> { ServerPlayer player = context.player(); + + // --- SELECTIVE SECURITY GUARD --- + // Only proceed if the menu is one of the two specific workbenches + boolean isWorkbench = player.containerMenu instanceof WorkbenchWorkbenchMenu; + boolean isArmorers = player.containerMenu instanceof ArmorersWorkbenchMenu; - // --- SECURITY GUARD --- - // Ensure the player actually has the Workbench UI open before processing the craft - if (!(player.containerMenu instanceof WorkbenchWorkbenchMenu)) { - return; + if (!isWorkbench && !isArmorers) { + return; // Reject packets from Campfires, Furnaces, or other menus } ItemStack requestedResult = payload.resultItem(); int amount = payload.amount(); - - // 1. Get the RecipeManager from the server level RecipeManager recipeManager = player.level().recipeAccess(); - // 2. Find the recipe by matching the output ItemStack - Optional> recipeOpt = recipeManager.getAllOfType(ModRecipes.WORKBENCH_TYPE).stream() + // 1. Determine which Recipe Type to search based on the open menu + var targetType = isWorkbench ? ModRecipes.WORKBENCH_TYPE : ModRecipes.ARMORERS_TYPE; + + // 2. Find the recipe within that specific type + Optional> recipeOpt = recipeManager.getAllOfType(targetType).stream() .filter(holder -> { - // Guard against recipes with no results before accessing index 0 - if (holder.value().results().isEmpty()) { - return false; - } + if (holder.value().results().isEmpty()) return false; - // Compare the first result of the workbench recipe to the requested item ItemStack result = holder.value().results().get(0); return ItemStack.isSameItem(result, requestedResult); }) @@ -114,19 +166,24 @@ public void onInitialize() { if (recipeOpt.isPresent()) { WorkbenchRecipe recipe = recipeOpt.get().value(); - // 2. Determine craft limit (Handle "All" logic) + // 3. Logic for crafting amount int limit = (amount == -1) ? 64 : Math.min(Math.max(amount, 0), 64); for (int i = 0; i < limit; i++) { + // IMPORTANT: Ensure these methods check nearby items if your benches use them! if (hasIngredients(player, recipe)) { consumeIngredients(player, recipe); - player.getInventory().add(recipe.results().get(0).copy()); + + // Give the item to the player + ItemStack output = recipe.results().get(0).copy(); + if (!player.getInventory().add(output)) { + player.drop(output, false); // Drop on floor if inventory is full + } } else { break; } } - // 3. Sync inventory changes to the client screen player.containerMenu.broadcastChanges(); } }); diff --git a/src/main/java/com/tcm/MineTale/block/workbenches/entity/AbstractWorkbenchEntity.java b/src/main/java/com/tcm/MineTale/block/workbenches/entity/AbstractWorkbenchEntity.java index 835b77d..c835cbd 100644 --- a/src/main/java/com/tcm/MineTale/block/workbenches/entity/AbstractWorkbenchEntity.java +++ b/src/main/java/com/tcm/MineTale/block/workbenches/entity/AbstractWorkbenchEntity.java @@ -42,7 +42,7 @@ public abstract class AbstractWorkbenchEntity extends BlockEntity implements Men // Slot Mapping: 0-1 Inputs, 2 Fuel, 3-6 Outputs protected final SimpleContainer inventory = new SimpleContainer(7); protected int progress = 0; - protected int maxProgress = 200; + protected float maxProgress = 200; protected boolean canPullFromNearby = false; /** diff --git a/src/main/java/com/tcm/MineTale/recipe/WorkbenchRecipe.java b/src/main/java/com/tcm/MineTale/recipe/WorkbenchRecipe.java index 2a5d30f..81c77ba 100644 --- a/src/main/java/com/tcm/MineTale/recipe/WorkbenchRecipe.java +++ b/src/main/java/com/tcm/MineTale/recipe/WorkbenchRecipe.java @@ -28,7 +28,7 @@ public record WorkbenchRecipe( List ingredients, List results, - int cookTime, + float cookTime, RecipeType recipeType, RecipeSerializer recipeSerializer, CraftingBookCategory category, @@ -168,7 +168,7 @@ public Serializer(RecipeType recipeType) { this.codec = RecordCodecBuilder.mapCodec(inst -> inst.group( Ingredient.CODEC.listOf().fieldOf("ingredients").forGetter(WorkbenchRecipe::ingredients), ItemStack.STRICT_CODEC.listOf().fieldOf("results").forGetter(WorkbenchRecipe::results), - Codec.INT.optionalFieldOf("cookTime", 200).forGetter(WorkbenchRecipe::cookTime), + Codec.FLOAT.optionalFieldOf("cookTime", 200f).forGetter(WorkbenchRecipe::cookTime), CraftingBookCategory.CODEC.optionalFieldOf("category", CraftingBookCategory.MISC).forGetter(WorkbenchRecipe::category), Identifier.CODEC.fieldOf("book_category").forGetter(WorkbenchRecipe::bookCategory) ).apply(inst, (ing, res, time, cat, book) -> @@ -179,7 +179,7 @@ public Serializer(RecipeType recipeType) { this.streamCodec = StreamCodec.composite( Ingredient.CONTENTS_STREAM_CODEC.apply(ByteBufCodecs.list()), WorkbenchRecipe::ingredients, ItemStack.STREAM_CODEC.apply(ByteBufCodecs.list()), WorkbenchRecipe::results, - ByteBufCodecs.VAR_INT.cast(), WorkbenchRecipe::cookTime, + ByteBufCodecs.FLOAT.cast(), WorkbenchRecipe::cookTime, CraftingBookCategory.STREAM_CODEC.cast(), WorkbenchRecipe::category, Identifier.STREAM_CODEC.cast(), WorkbenchRecipe::bookCategory, (ing, res, time, cat, book) -> diff --git a/src/main/java/com/tcm/MineTale/registry/ModItems.java b/src/main/java/com/tcm/MineTale/registry/ModItems.java index 7d7a95b..47aef66 100644 --- a/src/main/java/com/tcm/MineTale/registry/ModItems.java +++ b/src/main/java/com/tcm/MineTale/registry/ModItems.java @@ -3,26 +3,18 @@ import java.util.ArrayList; import java.util.List; import java.util.function.Function; -import java.util.function.UnaryOperator; import com.tcm.MineTale.MineTale; import com.tcm.MineTale.item.ModCreativeTab; import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; import net.minecraft.core.Registry; -import net.minecraft.core.component.DataComponents; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; import net.minecraft.resources.Identifier; import net.minecraft.resources.ResourceKey; import net.minecraft.world.food.FoodProperties; -import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; -import net.minecraft.world.item.Items; -import net.minecraft.world.item.component.ItemContainerContents; -import net.minecraft.world.level.block.Block; - -import static net.minecraft.world.item.Items.registerBlock; public class ModItems { diff --git a/src/main/java/com/tcm/MineTale/registry/ModRecipeDisplay.java b/src/main/java/com/tcm/MineTale/registry/ModRecipeDisplay.java index 143a7cb..175e0ba 100644 --- a/src/main/java/com/tcm/MineTale/registry/ModRecipeDisplay.java +++ b/src/main/java/com/tcm/MineTale/registry/ModRecipeDisplay.java @@ -27,6 +27,9 @@ public class ModRecipeDisplay { public static final RecipeDisplay.Type WORKBENCH_TYPE = new RecipeDisplay.Type<>(WorkbenchRecipeDisplay.CODEC, STREAM_CODEC); + public static final RecipeDisplay.Type ARMORERS_TYPE = + new RecipeDisplay.Type<>(WorkbenchRecipeDisplay.CODEC, STREAM_CODEC); + // 1. Declare the fields but don't assign them yet public static final RecipeBookCategory CAMPFIRE_SEARCH = registerCategory("campfire_recipe_book_category"); public static final RecipeBookCategory WORKBENCH_SEARCH = registerCategory("workbench_recipe_book_category");