added uu matter recipe provider hook and some examples (#3072)

* added uu matter recipe provider hook and some examples

* added uu matter recipe provider hook and some examples

* fix formatting

Co-authored-by: modmuss50 <modmuss50@gmail.com>
This commit is contained in:
Ayutac 2022-12-18 13:14:02 +01:00 committed by GitHub
parent 39f2fa9229
commit ac7f8c8496
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 165 additions and 146 deletions

View file

@ -35,6 +35,7 @@ import net.minecraft.recipe.RecipeSerializer
import net.minecraft.recipe.book.RecipeCategory
import net.minecraft.registry.RegistryWrapper
import net.minecraft.util.Identifier
import reborncore.common.recipes.PaddedShapedRecipeJsonBuilder
import techreborn.TechReborn
import techreborn.datagen.recipes.TechRebornRecipesProvider
import techreborn.init.TRContent
@ -85,6 +86,7 @@ class CraftingRecipesProvider extends TechRebornRecipesProvider {
}
generateToolRecipes()
generateArmorRecipes()
generateUuMatterRecipes()
}
def generateToolRecipes() {
@ -182,6 +184,62 @@ class CraftingRecipesProvider extends TechRebornRecipesProvider {
}
}
def generateUuMatterRecipes() {
String rootDir = "crafting_table/uu_matter/"
String dir
// dusts
dir = rootDir + "dust/"
createPureUuMatterPaddedRecipe(RecipeCategory.MISC, TRContent.Dusts.ALUMINUM)
.pattern("UUU")
.pattern("U ")
.pattern(" ")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, recipeNameString(dir, null, TRContent.Dusts.ALUMINUM)))
createPureUuMatterPaddedRecipe(RecipeCategory.MISC, TRContent.Dusts.CHROME)
.pattern("UUU")
.pattern("UU ")
.pattern(" U ")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, recipeNameString(dir, null, TRContent.Dusts.CHROME)))
createPureUuMatterPaddedRecipe(RecipeCategory.MISC, TRContent.Dusts.PLATINUM)
.pattern("UUU")
.pattern("UU ")
.pattern(" ")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, recipeNameString(dir, null, TRContent.Dusts.PLATINUM)))
createPureUuMatterPaddedRecipe(RecipeCategory.MISC, TRContent.Dusts.TITANIUM)
.pattern("UUU")
.pattern("U U")
.pattern(" ")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, recipeNameString(dir, null, TRContent.Dusts.TITANIUM)))
// nuggets
dir = rootDir + "nugget/"
createPureUuMatterPaddedRecipe(RecipeCategory.MISC, TRContent.Nuggets.NETHERITE)
.pattern("UUU")
.pattern("UUU")
.pattern("UU ")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, recipeNameString(dir, null, TRContent.Nuggets.NETHERITE)))
// raw ores
dir = rootDir + "raw/"
createPureUuMatterPaddedRecipe(RecipeCategory.MISC, Items.RAW_COPPER)
.pattern("U ")
.pattern(" ")
.pattern(" U ")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, recipeNameString(dir, null, Items.RAW_COPPER)))
createPureUuMatterPaddedRecipe(RecipeCategory.MISC, TRContent.RawMetals.LEAD)
.pattern(" ")
.pattern("U ")
.pattern("U ")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, recipeNameString(dir, null, TRContent.RawMetals.LEAD)))
createPureUuMatterPaddedRecipe(RecipeCategory.MISC, TRContent.RawMetals.TIN)
.pattern(" ")
.pattern(" U ")
.pattern(" U")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, recipeNameString(dir, null, TRContent.RawMetals.TIN)))
createPureUuMatterPaddedRecipe(RecipeCategory.MISC, TRContent.RawMetals.TUNGSTEN)
.pattern("UUU")
.pattern("UUU")
.pattern(" ")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, recipeNameString(dir, null, TRContent.RawMetals.TUNGSTEN)))
}
def static recipeNameString(String prefix, def input, def output, String source = null, String result = null) {
StringBuilder s = new StringBuilder()
s.append(prefix)
@ -344,5 +402,11 @@ class CraftingRecipesProvider extends TechRebornRecipesProvider {
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, type, TechRebornRecipesProvider::getNamePart1)))
}
def static createPureUuMatterPaddedRecipe(RecipeCategory category, ItemConvertible output) {
var input = TRContent.Parts.UU_MATTER
return PaddedShapedRecipeJsonBuilder.create(category, output, 1)
.input('U' as char, createIngredient(input))
.criterion(getCriterionName(input), getCriterionConditions(input))
}
}

View file

@ -1,16 +0,0 @@
{
"type": "reborncore:padded",
"pattern": [
"UUU",
"U ",
" "
],
"key": {
"U": {
"item": "techreborn:uu_matter"
}
},
"result": {
"item": "techreborn:aluminum_dust"
}
}

View file

@ -1,16 +0,0 @@
{
"type": "reborncore:padded",
"pattern": [
"UUU",
"UU ",
" U "
],
"key": {
"U": {
"item": "techreborn:uu_matter"
}
},
"result": {
"item": "techreborn:chrome_dust"
}
}

View file

@ -1,16 +0,0 @@
{
"type": "reborncore:padded",
"pattern": [
"UUU",
"UU ",
" "
],
"key": {
"U": {
"item": "techreborn:uu_matter"
}
},
"result": {
"item": "techreborn:platinum_dust"
}
}

View file

@ -1,16 +0,0 @@
{
"type": "reborncore:padded",
"pattern": [
"UUU",
"U U",
" "
],
"key": {
"U": {
"item": "techreborn:uu_matter"
}
},
"result": {
"item": "techreborn:titanium_dust"
}
}

View file

@ -1,16 +0,0 @@
{
"type": "reborncore:padded",
"pattern": [
"UUU",
"UUU",
"UU "
],
"key": {
"U": {
"item": "techreborn:uu_matter"
}
},
"result": {
"item": "techreborn:netherite_nugget"
}
}

View file

@ -1,16 +0,0 @@
{
"type": "reborncore:padded",
"pattern": [
"U ",
" ",
" U "
],
"key": {
"U": {
"item": "techreborn:uu_matter"
}
},
"result": {
"item": "minecraft:raw_copper"
}
}

View file

@ -1,16 +0,0 @@
{
"type": "reborncore:padded",
"pattern": [
" ",
"U ",
"U "
],
"key": {
"U": {
"item": "techreborn:uu_matter"
}
},
"result": {
"item": "techreborn:raw_lead"
}
}

View file

@ -1,16 +0,0 @@
{
"type": "reborncore:padded",
"pattern": [
" ",
" U ",
" U"
],
"key": {
"U": {
"item": "techreborn:uu_matter"
}
},
"result": {
"item": "techreborn:raw_tin"
}
}

View file

@ -1,16 +0,0 @@
{
"type": "reborncore:padded",
"pattern": [
"UUU",
"UUU",
" "
],
"key": {
"U": {
"item": "techreborn:uu_matter"
}
},
"result": {
"item": "techreborn:raw_tungsten"
}
}

View file

@ -3,6 +3,17 @@ accessWidener v2 named
accessible method net/minecraft/recipe/ShapedRecipe readSymbols (Lcom/google/gson/JsonObject;)Ljava/util/Map;
accessible method net/minecraft/recipe/ShapedRecipe getPattern (Lcom/google/gson/JsonArray;)[Ljava/lang/String;
accessible method net/minecraft/recipe/ShapedRecipe createPatternMatrix ([Ljava/lang/String;Ljava/util/Map;II)Lnet/minecraft/util/collection/DefaultedList;
accessible method net/minecraft/recipe/ShapedRecipe matchesPattern (Lnet/minecraft/inventory/CraftingInventory;IIZ)Z
accessible class net/minecraft/data/server/recipe/ShapedRecipeJsonBuilder$ShapedRecipeJsonProvider
accessible method net/minecraft/data/server/recipe/ShapedRecipeJsonBuilder validate (Lnet/minecraft/util/Identifier;)V
accessible field net/minecraft/data/server/recipe/ShapedRecipeJsonBuilder advancementBuilder Lnet/minecraft/advancement/Advancement$Builder;
accessible field net/minecraft/data/server/recipe/ShapedRecipeJsonBuilder output Lnet/minecraft/item/Item;
accessible field net/minecraft/data/server/recipe/ShapedRecipeJsonBuilder count I
accessible field net/minecraft/data/server/recipe/ShapedRecipeJsonBuilder group Ljava/lang/String;
accessible field net/minecraft/data/server/recipe/ShapedRecipeJsonBuilder pattern Ljava/util/List;
accessible field net/minecraft/data/server/recipe/ShapedRecipeJsonBuilder inputs Ljava/util/Map;
accessible field net/minecraft/data/server/recipe/ShapedRecipeJsonBuilder category Lnet/minecraft/recipe/book/RecipeCategory;
accessible class net/minecraft/recipe/Ingredient$Entry
accessible class net/minecraft/recipe/Ingredient$TagEntry
@ -21,7 +32,6 @@ accessible field net/minecraft/block/FluidBlock fluid Lnet/minecraft
accessible method net/minecraft/world/gen/foliage/FoliagePlacerType register (Ljava/lang/String;Lcom/mojang/serialization/Codec;)Lnet/minecraft/world/gen/foliage/FoliagePlacerType;
accessible method net/minecraft/recipe/RecipeManager getAllOfType (Lnet/minecraft/recipe/RecipeType;)Ljava/util/Map;
accessible field net/minecraft/screen/ScreenHandler listeners Ljava/util/List;
accessible method net/minecraft/recipe/ShapedRecipe matchesPattern (Lnet/minecraft/inventory/CraftingInventory;IIZ)Z
accessible field net/minecraft/structure/pool/StructurePool elements Lit/unimi/dsi/fastutil/objects/ObjectArrayList;