Jump to content

DroidCrafter23

Members
  • Posts

    24
  • Joined

  • Last visited

Everything posted by DroidCrafter23

  1. I am wanting to add an axe to my mod though I do not want it to have a recipe, the reason for this being that I want you to only be able to find it in a structure. I have looked on both here and elsewhere on the internet and have found nothing... How would this be done? (Video for reference.)
  2. I have tried what you have said and it has worked, thank you for your help!
  3. Thank you again for the help! I should probably improve on inspecting my code more before asking questions here... ๐Ÿ˜…
  4. Here! public class ModRecipeProvider extends RecipeProvider implements IConditionBuilder { public ModRecipeProvider(PackOutput pOutput) { super(pOutput); } @Override protected void buildRecipes(Consumer<FinishedRecipe> pWriter) { ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModBlocks.PLACEHOLDER_BLOCK.get()) .pattern("SSS") .pattern("SSS") .pattern("SSS") .define('S', ModItems.PLACEHOLDER_ITEM.get()) .unlockedBy(getHasName(ModItems.PLACEHOLDER_ITEM.get()), has(ModItems.PLACEHOLDER_ITEM.get())) .save(pWriter); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.LEMON_JUICE.get(), 4) .requires(ModItems.LEMON.get()) .requires(Items.GLASS_BOTTLE, 4) .save(pWriter); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.ORANGE_JUICE.get(), 4) .requires(ModItems.ORANGE.get()) .requires(Items.GLASS_BOTTLE, 4) .save(pWriter); } protected static void oreSmelting(Consumer<FinishedRecipe> pFinishedRecipeConsumer, List<ItemLike> pIngredients, RecipeCategory pCategory, ItemLike pResult, float pExperience, int pCookingTIme, String pGroup) { oreCooking(pFinishedRecipeConsumer, RecipeSerializer.SMELTING_RECIPE, pIngredients, pCategory, pResult, pExperience, pCookingTIme, pGroup, "_from_smelting"); } protected static void oreBlasting(Consumer<FinishedRecipe> pFinishedRecipeConsumer, List<ItemLike> pIngredients, RecipeCategory pCategory, ItemLike pResult, float pExperience, int pCookingTime, String pGroup) { oreCooking(pFinishedRecipeConsumer, RecipeSerializer.BLASTING_RECIPE, pIngredients, pCategory, pResult, pExperience, pCookingTime, pGroup, "_from_blasting"); } protected static void oreCooking(Consumer<FinishedRecipe> pFinishedRecipeConsumer, RecipeSerializer<? extends AbstractCookingRecipe> pCookingSerializer, List<ItemLike> pIngredients, RecipeCategory pCategory, ItemLike pResult, float pExperience, int pCookingTime, String pGroup, String pRecipeName) { for(ItemLike itemlike : pIngredients) { SimpleCookingRecipeBuilder.generic(Ingredient.of(itemlike), pCategory, pResult, pExperience, pCookingTime, pCookingSerializer).group(pGroup).unlockedBy(getHasName(itemlike), has(itemlike)).save(pFinishedRecipeConsumer, DroidsAncientRelics.MOD_ID + ":" + getItemName(pResult) + pRecipeName + "_" + getItemName(itemlike)); } } } (The smelting, blasting and cooking are going unused for now). I have just realised that inside the recipe import there is a star, would this be because the original .json file is deleted? import net.minecraft.data.recipes.*;
  5. For a while now I have been following a tutorial on YouTube for DataGen that I am using for my mod. I have come across an error that I wanted to check on here before acting on anything that could mess up my progress. The error is as follows: Caused by: java.lang.IllegalStateException: No way of obtaining recipe droidsancientrelics:lemon_juice Curiously, It has worked fine with the "orange_juice" item but not the "lemon_juice," even though their code is the same. I am basically just reposting the same thing as before, though I am yet to get a reply. Video link for reference. PLEASE HELP!!!!
  6. I have been following a tutorial for DataGen for my Minecraft Mod and I have come across an error. Caused by: java.lang.IllegalStateException: No way of obtaining recipe droidsancientrelics:lemon_juice I am not sure why this has happened for the Lemon Juice specifically, as no error is present for the Orange Juice even though the code is the same. I thought I would make a post before acting on anything in case I would create unnecessary work for myself, though I know that a possible outcome would be to go to an earlier version of the mod where the data files are still separate and go from there. Video link for reference.
  7. Oh wow, It was really that simple? Sometimes I get so confused...
  8. I have been following this tutorial for my mod, though I am wondering how I add multiple items in the ModRecipeProvider class. ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.LEMON_JUICE.get(), 4) .requires(ModItems.LEMON.get()) .save(pWriter); I am wanting to add the Glass Bottle to the recipe though I am not sure how. (As seen in the .json file below). { "category": "misc", "ingredients": [ { "item": "droidsancientrelics:lemon" }, { "item": "minecraft:glass_bottle" }, { "item": "minecraft:glass_bottle" }, { "item": "minecraft:glass_bottle" }, { "item": "minecraft:glass_bottle" } ], "result": { "count": 4, "item": "droidsancientrelics:lemon_juice" }, "type": "minecraft:crafting_shapeless" } Would this be easy to perform?
  9. Thank you so much @Xoroshio, I don't know why I didn't think of this! It has worked and my problem is finally fixed.
  10. Okay, I shall look into this problem more in depth and look at Kaupenjoe's Java tutorials on YouTube. Thank you so much for all of your support over these last two weeks, you have helped me so much and I think that now I have a better understanding of Java thanks to you. ๐Ÿ˜Š
  11. I have made the changes to the creative mode tab and have managed to run the game successfully and to join my test world. Though, disappointingly, the Lemon Juice and Orange Juice items have not changed at all, their properties are exactly the same as how they were when I originally asked for help: (making the food eating sound and producing particles). I have absolutely no idea what to do and I am wondering why it has not worked at all, would you know how to fix this?
  12. I have now easily fixed the duplication error present, I was just not looking. I have been working for the past half hour to try and fix another error present, this time with the Creative Mode Tab. I have changed some things around to get where I am currently. (ModFoods to ModDrinks*) and it cannot find the symbol ".get" at the end of the code. *The custom class you recommended pOutput.accept(ModDrinks.ORANGE_JUICE.get()); I think the point I am at currently is the closest I have to how it should be but because I am not as experienced with java I would not know. I have also removed ORANGE_JUICE and LEMON_JUICE from the ModFoods class, to avoid confliction. I do hope all this can be fully resolved soon.
  13. I have managed to implement your code after finally managing to sort out my error with exporting to .zip, though when the game launches, it will not allow me to proceed further and gives this error: Caused by: java.lang.IllegalArgumentException: Duplicate registration orange I have checked over my code and no errors or warnings are present that would affect my orange item. I am not sure what to do here. (It is only registered in the ModItems, as it should be).
  14. I am wanting to export my mod to a .zip file in IntelliJ version 2024.1 but cannot. I am not sure what to do, the only options available to me are "Files or selection to HTML" and "Project to eclipse." A possible theory I have is that IntelliJ believes that my mod is a HTML file, though I am not sure whether I could change that or not. There is nothing I have found online about the missing zip option for exporting a file, so I am confused. I export a backup of my mod every time I add/edit something important, though I don't think I can do this currently. (I have tried to export as HTML though I did not think it would work).
  15. I shall look into this soon, as I am currently quite busy. I just realised that I put in ModItems when I meant ModFoods, so that part would be correct, it is just my mistake...
  16. I have corrected the code as you have written it, though there have been errors present in the ModItems class when I have registered the item. (These have been present before but I forgot to mention them ๐Ÿคฆโ€โ™‚๏ธ). public static final RegistryObject<Item> LEMON_JUICE = ITEMS.register("lemon_juice", () -> new Item(new Item.Properties().food(ModItems.LEMON_JUICE))); The first error occurs with the ModItems.LEMON_JUICE, the message is as follows: 'food(net.minecraft.world.food.FoodProperties)' in 'net.minecraft.world.item.Item.Properties' cannot be applied to '(net.minecraftforge.registries.RegistryObject<net.minecraft.world.item.Item>)' public static final RegistryObject<Item> LEMON_JUICE = ITEMS.register("lemon_juice", () -> new Item(new Item.Properties().food(FoodProperties.LEMON_JUICE))); The second error occurs with the FoodProperties.LEMON_JUICE, saying: Cannot resolve symbol 'LEMON_JUICE' This should be all that is left to do to finally fix all these errors that has been going on for two weeks now surprisingly.
  17. I have done this now but have got the error: 'food(net.minecraft.world.food.FoodProperties)' in 'net.minecraft.world.item.Item.Properties' cannot be applied to '(net.minecraftforge.registries.RegistryObject<net.minecraft.world.item.Item>)' public static final RegistryObject<Item> LEMON_JUICE = ITEMS.register( "lemon_juice", () -> new Item( new HoneyBottleItem.Properties().stacksTo(1).food( (new FoodProperties.Builder()) .nutrition(3) .saturationMod(0.25F) .effect(() -> new MobEffectInstance(MobEffects.DAMAGE_RESISTANCE, 1500), 0.01f ) .build() ) )); The code above is from the ModFoods class, the one below from the ModItems class. public static final RegistryObject<Item> LEMON_JUICE = ITEMS.register("lemon_juice", () -> new Item(new Item.Properties().food(ModFoods.LEMON_JUICE))); I shall keep going between them to try and figure out the cause. I am sorry if this is too much for you to help with, though I thank you greatly for your patience and all the effort you have put in to help me.
  18. I have been following these exact tutorials for quite a while, I must agree that they are amazing and easy to follow. I have registered the item in the ModFoods class, I tried to do it in ModItems (Where all the items should be registered) but got errors, I think I may need to revert this and figure it out from there. Once again, thank you for your help! ๐Ÿ‘ Just looking back, I have noticed in your code you added ITEMS.register, which I am guessing means that they are being registered in ModFoods, I shall go through the process of trial and error to figure this out.
  19. UPDATE: I have scanned again and have got two new errors, of which I am not sure about. Caused by: java.io.EOFException: SSL peer shut down incorrectly Caused by: javax.net.ssl.SSLHandshakeException: Remote host terminated the handshake I have looked at the scan, though I am not sure what exactly I am looking for. (IntelliJ recommended to find the stacktrace so I could link it if necessary).
  20. I have recently received support for my upcoming mod, which I have implemented but have received multiple errors giving the same output. I am not sure what to do as I have found out the meaning of java.lang.IllegalStateException and java.lang.ExceptionInInititializerError, though this has not helped me in the slightest! I have performed scans though I am still not sure... Caused by: java.lang.IllegalStateException: Cannot register new entries to DeferredRegister after RegisterEvent has been fired. (3x) Caused by: java.lang.ExceptionInInitializerError (2x)
  21. Thank you so, so much for your help! I have implemented the code from the example you gave me and it has been excepted, the only downside currently being that the game crashes on launch, saying: Caused by: java.lang.IllegalStateException: Cannot register new entries to DeferredRegister after RegisterEvent has been fired. (Three times) and Caused by: java.lang.ExceptionInInitializerError (Two times) With further scanning I have found this error: 2024-05-05T18:41:24.287+0100 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] I am not exactly sure what to do with these errors but I am sure I can resolve them. Once again, thank you for your help! It is much appreciated. ๐Ÿ˜
  22. Are you playing with mods? This usually happens to me when certain mods clash. I would recommend looking through the game logs (found in the file of the modpack) to see what errors have occurred. I hope this helps!
  23. For the HoneyBottleItem class, would I just copy/paste my Lemon Juice item into the class or would I have to make other changes? Also, for what you first said, I have copied the "getEatingSound" and the "getDrinkingSound" from the class into my ModFoods class (I could link the whole class if that would help you understand more), though nothing seems to have been done. I also do not see a way to prevent particles from appearing when the item is drank. (Could you also post some examples if possible, that would be a great help to see where I went wrong). I am at a point where I am quite clueless as the tutorials on YouTube do not cover the area I am needing to go into. I do hope that this is not too much of a bother for you.
  24. I have been working on my mod for some time now and I am wanting to add a drink item, I am new to modding and am currently self teaching myself java as I follow tutorials. I am hoping that the code would not need a massive reworking. public static final FoodProperties LEMON_JUICE = new FoodProperties.Builder().nutrition(3) .saturationMod(0.25f).effect(() -> new MobEffectInstance(MobEffects.DAMAGE_RESISTANCE, 1500),0.01f) .effect(() -> new MobEffectInstance(MobEffects.CONFUSION,200),1).build(); In game the lemon juice acts like a food, making eating audio and creating particles. For the audio I would like to use the honey drinking sound. How would I get this to work as I am wanting it to?
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.