CraftTweaker

CraftTweaker

151M Downloads

[Question] Proper use of recipe function for new output with old damage

ElvenChaos opened this issue ยท 3 comments

commented

Issue Description:

I was trying to add a convenience recipe to convert Refined Storage Wireless Grids to RSAddons Wireless Crafting Grids, while maintaining the Energy level (damage) of the input grid to the output crafting grid. I followed the wiki example since my use case was similar, but I can't seem to create an output with the correct energy level. All my outputs seems to have 0 energy. What am I doing wrong with the script?

What happens:

Provided script creates recipe, but doesn't "transfer" the energy level from the old input to the new output.

What you expected to happen:

The output (Wireless crafting grid) having the same power level as the input used (wireless grid).

Script used:

https://pastebin.com/qgDXpdzw

crafttweaker.log file:

https://pastebin.com/wWkHwKP2


Affected Versions (Do not use "latest"):

  • Minecraft: 1.12.2
  • Forge: 2847
  • Crafttweaker: CraftTweaker2-1.12-4.1.19
  • Using a server: Custom Self-Hosted Server
  • If yes, does the client have the exact same scripts?
    Yes, I have completely mirrored the scripts.

Your most recent log file where the issue was present:

https://gist.github.com/ElvenChaos/6ad7b8097b136c7b0ec8235577260b53

commented

Are you sure they both use their metadata value for energy? And in the same way? Linked controller is definitely stored in NBT, have you examined the NBT on two functional and charged grids to see if energy is also stored there for some reason?

commented

As @PrincessRTFM said, there is probably a mismatch between the items, with each of them storing the energy value differently, or they just don't store energy with their damage.

commented

Similar issue here, I want to take a Mekanism elite tank and transfer the liquid stored to a new recipe for an Extra Utilities 2 Iron Drum. So I need to convert the NBT tag that stores the fluid info and amount from the Mekanism tank to the tag format for the drum.
What I currently have:

recipies.addShaped("OTAGHardTank", <extrautils2:drum:1>,
[[<ore:ingotSteel>, <minecraft:heavy_weighted_pressure_plate>, <ore:ingotSteel>],
 [<ore:ingotSteel>, <mekanism:machineblock2:11>.onlyWithTag({tier: 3}).marked("tank"), <ore:ingotSteel>],
 [<ore:ingotSteel>, <minecraft:heavy_weighted_pressure_plate>, <ore:ingotSteel>]], 
 function (output, input, cInfo){
     return output.withTag(input.tank.tag.mekData.fluidTank as Fluid);
 });

the tag formats are as such:
Mekanism Elite Tank:

{
    tier: 3, 
    mekData: {
        security: 0, 
        ownerUUID: [redacted], 
        fluidTank: {
            FluidName: "water", 
            Amount: 1000
        }, 
        Items: []
    }
}

Extra Utilities Iron Drum:

{
    Fluid: {
        FluidName: "water", 
        Amount: 1000
    }
}

"as Fluid" doesn't convert the tag, as I would have guessed, so how would i get that NBT data and convert it over to the NBT data Extra Utilities Uses? I've been looking for a way to do this but I've not had any luck. Any help would be greatly appreciated.