Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transfer tea flavors to datapack resources #39

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft

Transfer tea flavors to datapack resources #39

wants to merge 11 commits into from

Conversation

Hugman76
Copy link
Member

@Hugman76 Hugman76 commented Apr 3, 2022

Presentation

This PR aims at making the tea flavors part of data pack resources, instead of hardcoding them by:

  • Adding a resource reloader listener to stock tea flavors
  • Moving the tea potencies to the tea flavor configuration
    • Gloopy and glowing tea flavors only had one effect, so having multiple potencies was useless
  • Adding a tea effect registry
    • Currently contains culinaire:grant_effect, culinaire:clear_effect and culinaire:consume_item, which each their own codec parameters
    • A tea effect represent the algorithm that will get triggered upon the consumption of the tea bottle

Syntax

Let's take the file of the sour tea flavor as an example for what the PR is capable of right now:
Location: culinaire/tea_flavors/sour.json
Identifier: culinaire:sour
File content:

{
  "color": 7238946,
  "potencies": [
    {
      "value": 1,
      "name": "tea_type.culinaire.sour.weak",
      "description": "tea_type.culinaire.sour.weak.description",
      "effects": [
        {
          "type": "culinaire:clear_effect",
          "mob_effect": "minecraft:poison"
        }
      ],
      "ingredients": "#culinaire:tea_ingredients/sour/weak",
      "brew_time": 400
    },
    {
      "value": 2,
      "name": "tea_type.culinaire.sour.normal",
      "description": "tea_type.culinaire.sour.normal.description",
      "effects": [
        {
          "type": "culinaire:clear_effect",
          "mob_effect": "minecraft:poison"
        },
        {
          "type": "culinaire:grant_effect",
          "mob_effect": "minecraft:instant_health"
        }
      ],
      "ingredients": "#culinaire:tea_ingredients/sour/normal",
      "brew_time": 800
    }
  ]
}

Objectives

Firstly, I wish to move ingredients and brew times over to proper recipes files, and make input/output customizable too, in case another mod wants to create a new tea-friendly item. Let's also add more parameters for maximum potency amount, paper/string ingredients

Currently, this PR will absolutely break all previous tea bags and tea bottles. I will later add a fix that will re-write NBT data correctly.
This PR also has a bug where if a bottle exists with a flavor, and that flavor gets later deleted, the game will get very laggy, spam the console and probably break the entire tea system. We will disscuss whether or not we directly attach tea effects to the item stack's NBT, or if we make those outdated tea items' NBT data vanish altogether, making the items unusable. I think the first solution is to be preferred.
Right now, I am not sure if tea flavors are correctly synced from server to client. I'll need to test this out and maybe ask a few friends. I have tried doing dynamic registering, but this was a totaly messy experience that I wish I did not do at all. Therefore, it is currently just collected as part of a generic id -> tea flavor set in the singular instance of TeaFlavorManager.

It is also worth noting that the ingredients key does not allow for item arrays yet, as RegistryCodecs.entryList() just likes to spit at my face and tells me that either the field needs to be a JSON array, or that the item registry is not accessible when it actually IS a JSON array. This is what the minecraft:glow_lichen feature configuration uses (feature.glow_lichen.can_be_placed_on), as an example. Maybe the reload listener gets fired too early? I don't know.

@Hugman76 Hugman76 added the feature New feature or request label Apr 3, 2022
@Hugman76 Hugman76 self-assigned this Apr 3, 2022
@Hugman76 Hugman76 marked this pull request as draft April 3, 2022 12:43
@Hugman76
Copy link
Member Author

Hugman76 commented Apr 3, 2022

@Dhranios has made the interesting comment on the Discord server to change the type of the name and description values for whole text JSON components rather than translation keys.

@Hugman76
Copy link
Member Author

Hugman76 commented Apr 3, 2022

Instead of adding a whole registry, maybe we could also move everything to recipe serializing. We would put tea effects only in the NBT data of tea bags/bottles.

@Hugman76 Hugman76 changed the title Transfer tea flavors part to datapack resources Transfer tea flavors to datapack resources Apr 8, 2022
@Hugman76 Hugman76 changed the base branch from 1.18 to 1.19 July 10, 2022 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
Status: 🚀 In Progress
Development

Successfully merging this pull request may close these issues.

1 participant