Coder Social home page Coder Social logo

snowsnakz / elementalfoods Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 346 KB

Custom foods and drinks, as well as custom crafting for said foods and drinks!

License: MIT License

Java 100.00%
custom-items food-items minecraft spigot-plugin spigot-resource spigotmc

elementalfoods's Introduction

Project Status

This project is currently not being developed or supported at the moment. I'm currently busy working on other things, and don't have much time to spare for this project. Community contributions are welcome, but please don't expect a timely response to support request. Thank you for taking the time to read this, I hope you have a wonderful day!

ElementalFoods

Custom foods and drinks, as well as custom crafting for said foods and drinks!

elementalfoods's People

Contributors

snowsnakz avatar

Stargazers

 avatar

Watchers

 avatar

elementalfoods's Issues

Request/Idea

Hello developer, I would like to ask you to add the ability to disable a value in the description that shows how much it restores hunger

Plugin crash on load/reload.

A user in the discord server reported a crash on plugin load, seemingly related to the config file.

chat-prefix: "&3&l[&bElemental&cFoods&3&l]&7: &f"
unlock-recipes-on-join: true
items:
    chiyopie:
        id: chiyo_pie
        material: PLAYER_HEAD
        show-food-value: true
        texture: f30ee237290dba133da01af5f88b87cce3b94bc40c5089e988852d478fa154a2
        color:
            red: 120
            green: 76
            blue: 58
        display-name: '&6&lChiyos Apple Pie'
        lore:
        - 'Better than your mums'
        commands: # If you have PlaceholderAPI installed, you can use PlaceholderAPI here,
        # otherwise the only placeholder you can use is %player% which will be replaced with the players username.
        # start a command with srv: to execute the command as the server (this will also ignore player permissions)
        - 'srv:effect give %player% minecraft:invisibility 30 1'
        - 'srv:effect give %player% minecraft:resistance 300 2'
        - 'srv:effect give %player% minecraft:health_boost 120 1'
        # try figure out custom effects e.g gather rate
        food-value: 10
        saturation-value: 5
        is-edible: true
        is-edible-when-full: true
        is-drink: false
        is-glowing: false
        sound-pitch-base: 0.85
        sound-pitch-range: 0.15
        instant-eat: false
        crafting-recipe:
            is-shapeless: true
            shape:
            - 'AAA'
            - 'SSS'
            - 'DDD'
            materials:
                A: APPLE
                D: PASTRY_DOUGH
                S: SUGAR
                
    pastrydough:
        id: PASTRY_DOUGH
        material: CLAY_BALL
        show-food-value: true
        color:
            red: 120
            green: 76
            blue: 58
        display-name: '&6&lPastry Dough'
        lore:
        - 'DOH!!!'
        commands:
        food-value: 10
        saturation-value: 5
        is-edible: false
        is-edible-when-full: true
        is-drink: false
        is-glowing: false
        sound-pitch-base: 0.85
        sound-pitch-range: 0.15
        instant-eat: false
        crafting-recipe:
            is-shapeless: true
            shape:
            - 'WWW'
            - 'TBT'
            materials:
                B: WATER_BUCKET
                W: WHEAT
                T: BUTTER
               
    butter:
        id: BUTTER
        material: GOLD_INGOT
        show-food-value: false
        display-name: '&6&lButter'
        lore:
        - 'I can believe it!'
        food-value: 0
        saturation-value: 2.0
        is-edible: false
        is-edible-when-full: true
        is-drink: false
        is-glowing: false
        sound-pitch-base: 0.85
        sound-pitch-range: 0.15
        instant-eat: false
        crafting-recipe:
            is-shapeless: true
            shape:
            - 'S'
            - 'M'
            materials:
                S: STICK
                M: MILK_BUCKET
                
    coffee:
        id: coffee
        material: potion
        show-food-value: false
        color:
            red: 120
            green: 76
            blue: 58
        display-name: '&6&lCoffee'
        lore:
        - 'Energetic.'
        commands:
        - 'srv:effect give %player% minecraft:speed 300 2'
        food-value: 0
        saturation-value: 2.0
        is-edible: true
        is-edible-when-full: true
        is-drink: true
        is-glowing: false
        sound-pitch-base: 0.85
        sound-pitch-range: 0.15
        instant-eat: false
        crafting-recipe:
            is-shapeless: false
            shape:
            - 'SSS'
            - 'CCC'
            - 'WMW'
            materials:
                S: SUGAR
                C: COCOA_BEANS
                M: MILK_BUCKET
                W: WATER_BUCKET
                
    heartystew:
        id: hearty_stew
        material: suspicious_stew
        show-food-value: true
        color:
            red: 120
            green: 76
            blue: 58
        display-name: '&6&lHearty Stew'
        lore:
        - 'Contains real hearts.'
        commands:
        - 'srv:effect give %player% minecraft:slowness 60 2'
        - 'srv:effect give %player% minecraft:regeneration 300 2'
        - 'srv:effect give %player% minecraft:health_boost 180 2'
        - 'srv:effect give %player% minecraft:strength 180 1'
        food-value: 20
        saturation-value: 20
        is-edible: true
        is-edible-when-full: false
        is-drink: false
        is-glowing: false
        sound-pitch-base: 0.85
        sound-pitch-range: 0.15
        instant-eat: false
        crafting-recipe:
            is-shapeless: true
            shape:
            materials:
                W: WATER_BUCKET
                B: BOWL
                C: COOKED_CHICKEN
                S: COOKED_BEEF
                T: CARROT
                P: POTATO
                M: BROWN_MUSHROOM
                E: WHEAT
                F: DANDELION

The first point at which the stacktrace references my source is in ElementalFoods.java at line 333 (com.elementalwoof.foods.ElementalFoods.reload), however line 333 is an empty line and I have verified this by looking at the revision history for that version.

[11:50:51 INFO]: *** issued server command: /foods reload
[11:50:51 ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'foods' in plugin ElementalFoods v1.4.0
	at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:155) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.craftbukkit.v1_19_R1.CraftServer.dispatchCommand(CraftServer.java:916) ~[paper-1.19.2.jar:git-Paper-215]
	at org.bukkit.craftbukkit.v1_19_R1.command.BukkitCommandWrapper.run(BukkitCommandWrapper.java:64) ~[paper-1.19.2.jar:git-Paper-215]
	at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:264) ~[paper-1.19.2.jar:?]
	at net.minecraft.commands.Commands.performCommand(Commands.java:305) ~[?:?]
	at net.minecraft.commands.Commands.performCommand(Commands.java:289) ~[?:?]
	at net.minecraft.server.network.ServerGamePacketListenerImpl.performChatCommand(ServerGamePacketListenerImpl.java:2294) ~[?:?]
	at net.minecraft.server.network.ServerGamePacketListenerImpl.lambda$handleChatCommand$20(ServerGamePacketListenerImpl.java:2248) ~[?:?]
	at net.minecraft.util.thread.BlockableEventLoop.lambda$submitAsync$0(BlockableEventLoop.java:59) ~[?:?]
	at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?]
	at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.19.2.jar:git-Paper-215]
	at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
	at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?]
	at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1341) ~[paper-1.19.2.jar:git-Paper-215]
	at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:185) ~[paper-1.19.2.jar:git-Paper-215]
	at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
	at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1318) ~[paper-1.19.2.jar:git-Paper-215]
	at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1311) ~[paper-1.19.2.jar:git-Paper-215]
	at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?]
	at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1289) ~[paper-1.19.2.jar:git-Paper-215]
	at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1177) ~[paper-1.19.2.jar:git-Paper-215]
	at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:305) ~[paper-1.19.2.jar:git-Paper-215]
	at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.IllegalArgumentException: recipeKey == null
	at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145) ~[guava-31.0.1-jre.jar:?]
	at org.bukkit.craftbukkit.v1_19_R1.CraftServer.getRecipe(CraftServer.java:1442) ~[paper-1.19.2.jar:git-Paper-215]
	at org.bukkit.Bukkit.getRecipe(Bukkit.java:1015) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
	at com.elementalwoof.foods.ElementalFoods.reload(ElementalFoods.java:333) ~[ElementalFoods.jar:?]
	at com.elementalwoof.foods.FoodsCommand.onCommand(FoodsCommand.java:44) ~[ElementalFoods.jar:?]
	at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
	... 23 more

I will be trying to find a solution.

java.lang.IllegalArgumentException: recipe cannot be null

This exception is thrown when reloading the plugin, and when a player joins.
This issue seems to be related to a bug where crafting recipes do not work at all, even if the recipe isn't unlocked.

This error seems to be caused in ElementalFoods.java at line 72, the conditions to reach this error are as follows:

  1. At least one custom item is defined in the config
  2. unlock-recipes-on-join is set to true
  3. The custom item has a crafting-recipe section in the config
  4. The crafting recipe is not null (ci.recipe null check exists on line 68)
  5. The recipe has show-in-recipe-list undefined or set to true.
  6. The NamespacedKey of the crafting recipe is null (ci.recipeKey is referenced on line 72)

Potential Causes:

  • At CustomRecipe.java line 28: NamespacedKey.fromString() fails silently.
  • At CustomItem.java line 252: this line is not executing.
  • At ElementalFoods.java line 331: this line is not executing.
    • Lines 343 to 351 are also not executing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.