You are browsing as a guest. Sign up (or log in) to start making projects!

4h 9m 37s logged

Okay what I did
Created two new Items called

  • Ink and Quill
  • Bottle of Ink

Added Recipes for the above as well


Rant

I wrote a hole ass para but stardance does not allow no more than 4000 words so I will try to keep it concise

back in the day ( 5 years from now ) minecraft used to have NBT data, this is the time when I picked modding, before that I had been doing datapacks.

now In this 5 five years , I have taken a 1.5 year break due to some personal reason (nothing major mind you )

2 years ago minecraft removed the NBT compound and replaced it with DataComponenet
DataComponents are better in all regards( keep this in mind )

Now my major issue is that I want to make sure that only water potion is used for crafting ink, not any other potion
So I had some understanding that using Datacomponents would work
The problem occured when I tried this approch, unfortunatly for me, ItemLike’s cant’ have datacomponents since they are Interfaces and Potions could not have been accessed as an Item

So I had to dig into a rabit hole to find something similar that minecraft it self did, and I did
tinted arrow , it need to know the type of potion for the arrow to have that effect

now the problem was that this required a customcrafting system for my potion.

During this rabit hole I also stumbled at the core of shapless crafting and Shaped Crafting

and when reading the Shapeless crafting , turns out , in the underling code , the crafting needs Ingredients. normaly this would have no effect and I would have continued .

But luckly I knew that fabric had a means to store datacomponent on Ingredients
using

DataComponentPatch data  = DataComponentPatch.builder().set(DataComponents.POTION_CONTENTS,new PotionContents(Potions.WATER)).build();Ingredient potion =  Ingredient.of(Items.POTION);Ingredient potionIng = DefaultCustomIngredients.components(potion,data);

and then registering a custom shapeless recipe to use core feature, I did it

CustomCraftingRecipeBuilder.customCrafting(RecipeCategory.BREWING,(commonInfo, craftingBookInfo) ->                new ShapelessRecipe(commonInfo,craftingBookInfo                        ,new ItemStackTemplate(InkQuillItems.BOTTLE_OF_INK,1),                        List.of(potionIng,Ingredient.of(Items.DYE.black()))))        .unlockedBy("has_black_dye",has(Items.DYE.black()))        .save(output, InkQuill.id("bottle_of_ink").toString());
0
2

Comments 0

No comments yet. Be the first!