CraftTweaker

CraftTweaker

151M Downloads

How to: Make all slabs (may it be wooden or stone) to their respective full block through crafting

notIkibo opened this issue · 2 comments

commented

Describe the feature you'd like

The title says it all. I hate not being able to make slabs into planks again and I want to change that obviously, but I am a real newbie with Crafttweaker and I don't know what IItemStack is and I am fairly scared that I have to learn that?

Describe alternatives you've considered

Not learning anything and giving up usage of this high-potential-tweakmod.

sounds a lot easier, if you ask me

Additional context

Here are some examples I am able to do:

craftingTable.addShaped("name_tag", <item:minecraft:name_tag>*1,[
	[<item:minecraft:air>, <item:minecraft:iron_nugget>, <item:minecraft:iron_nugget>],
	[<item:minecraft:air>, <tag:items:minecraft:signs>, <item:minecraft:iron_nugget>],
	[<item:minecraft:slime_ball>, <item:minecraft:air>, <item:minecraft:air>]
]);

fairly simple.

What I tried to do was:

craftingTable.addShapeless("slabs", <tag:items:minecraft:planks>,
    [<tag:items:minecraft:wooden_slabs>],
    [<tag:items:minecraft:wooden_slabs>]
);

But it was no use...

And: Wb modded slabs?
I tried

 craftingTable.addShapeless("slabs", <item:minecraft:oak_planks>,
    [<item:minecraft:oak_slab>],
    [<item:minecraft:oak_slab>]
); 

or:

craftingTable.addShaped("slabs", <item:minecraft:oak_planks>, [
    [<item:minecraft:oak_slab>],[<item:minecraft:air>] ,[<item:minecraft:air>],
    [<item:minecraft:oak_slab>],[<item:minecraft:air>],[<item:minecraft:air>],
	[<item:minecraft:air>],[<item:minecraft:air>],[<item:minecraft:air>]
]); 

and it didn't work.
The ladder one didn't give any errors, but it didn't work nonetheless.
Same with
furnace.addRecipe("dirt2diamond", <item:minecraft:air>, <item:minecraft:dirt>, 1, 3600);
This was meant to be a joke, but it didn't work. Or if I placed something other than air innit.

I hope this is not too much, but I also wanted to change little things in the loot table e.g. taking out name tags out of every loot table since it's not treasure anymore.

Minecraft version

1.19

Modloader

Fabric

===
Edited by @kindlich: Put code examples into code blocks so that Brackets are properly visible

commented

I recommend you join our Discord server, as there are many people that can help you getting started with CraftTweaker there:
https://discord.blamejared.com/

You mixed up the parameters for crafting table ingredients.

  • When creating shapeless recipes, the order of ingredients doesn't matter.
    Therefore you only need to provide a single list with all possible input items.

    craftingTable.addShapeless("oak_slab_to_planks", <item:minecraft:oak_planks>, [<item:minecraft:oak_slab>, <item:minecraft:oak_slab>]);
  • When creating shaped recipes, the order does matter.
    Therefore you need to provide more information, in our case a list of lists (see the [] inside [] ?).

     craftingTable.addShaped("oak_slab_to_planks" <item:minecraft:oak_planks>, 
         [
             [<item:minecraft:oak_slab>], 
             [<item:minecraft:oak_slab>]
         ]);
    If this is your crafting table:
    ╔═╦═╦═╗
    ║a║b║c║
    ╠═╬═╬═╣
    ║d║e║f║
    ╠═╬═╬═╣
    ║g║h║i║
    ╚═╩═╩═╝
    
    ↓↓↓
    Then you would need to provide the recipe list like this
    [[a, b, c], [d, e, f], [g, h, i]]
    
commented

The only way to do this is to make the mappings between the slabs and full blocks yourself somehow, what you could do is something like this:

import crafttweaker.api.resource.ResourceLocation;

function slabToPlank(type as ResourceLocation) as void {
    var modid = type.namespace;
    var name = type.path;
    var itemStart = type as string;
    craftingTable.addShaped(modid + "_" + name + "_slabs_to_" + modid + "_" + name + "_planks", <item:${itemStart}_planks>, [[<item:${itemStart}_slab>],[<item:${itemStart}_slab>]]);
}

slabToPlank(<resource:minecraft:oak>);
slabToPlank(<resource:minecraft:birch>);
slabToPlank(<resource:minecraft:jungle>);

Which should work for most things.