Lucreeper74 / Create-Metallurgy

Add-on for Create Mod, adding new metallurgy processings.
https://modrinth.com/mod/create-metallurgy
MIT License
14 stars 12 forks source link

[Enhancement 💡] KubeJs support ? #19

Closed Elnhomantia closed 1 month ago

Elnhomantia commented 4 months ago

Could you add a kubeJs support please ? Or provide the way to make recipes in the json format ?

Lucreeper74 commented 4 months ago

Hey 👋 @Elnhomantia KubeJS compat is planned, I dont know for now how I will implement it. But for now, you can just see how to create custom recipes in KubeJS on their wiki and just change the recipe type or others fields like my JSON recipes ones like Here for casting brass ingot recipe.

ElMurlocElegante commented 4 months ago

Yep, try doing something like this in your script:

    let alloying = (input, time, fluidType, fluidAmount, heat) => {
        event.custom({
            "type": "createmetallurgy:alloying",
            "ingredients": input,
            "processingTime": time,
            "results": [
              {
                "fluid": fluidType,
                "amount": fluidAmount
              }
            ],
            "heatRequirement": heat
          })
    }

and use it later on

       alloying(
      [
        {"fluid": "createmetallurgy:molten_copper", "amount": 10},
        {"fluid": "createmetallurgy:molten_zinc", "amount": 10}
      ],
      80, "createmetallurgy:molten_brass", 20, "heated"
    );
Lucreeper74 commented 4 months ago

I don't think it will be that easy. I didn't really think about how to do it afterwards so idk, and also I'm on Java not JavaScript

Elnhomantia commented 4 months ago

Actually I forgot I could actually go and see on the repo xD. Thx a lot for the help. This actually work and let me add anything as input/ouput :

/**
   * Add melting recipe with create metallurgy
   * @param {{item: 'tag'}|{fluid: 'tag', amount: number}[]} input
   * @param {number} time 
   * @param {{item: 'tag'}|{fluid: 'tag', amount: number}[]} output
   * @param {'no'|'heated'|'superheated'} heat
   */
  let melting = (input, time, output, heat) => {
    event.custom({
      type: "createmetallurgy:melting",
      ingredients: input,
      processingTime: time,
      results: output,
      heatRequirement: heat,
    });
  };
  /**
   * Add alloying recipe with create metallurgy
   * @param {{item: 'tag'}|{fluid: 'tag', amount: number}[]} input
   * @param {number} time 
   * @param {{item: 'tag'}|{fluid: 'tag', amount: number}[]} output
   * @param {'no'|'heated'|'superheated'} heat
   */
  let alloying = (input, time, output, heat) => {
    event.custom({
      type: "createmetallurgy:alloying",
      ingredients: input,
      processingTime: time,
      results: output,
      heatRequirement: heat,
    });
  };
Elnhomantia commented 4 months ago

it should be and used in the ServerEvents.recipes((event) => {} of kubeJs

Qi-Month commented 4 months ago

Could you add a kubeJs support please ? Or provide the way to make recipes in the json format ?

I wrote a schema that can be applied to basin and table. Although it is not perfect, the two most basic ones are not a big problem. image

Lucreeper74 commented 1 month ago

Here it is! Now Create Metallurgy will be compatible with KubeJS. I will make a little wiki page to help people use it. Here is the commit

Qi-Month commented 1 month ago

so good!