Skip to content

Commit

Permalink
feat: add player and mob head recipes to the bio-forge
Browse files Browse the repository at this point in the history
  • Loading branch information
Elenterius committed Oct 1, 2024
1 parent 333e8a3 commit 03f9910
Show file tree
Hide file tree
Showing 17 changed files with 541 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@
import com.github.elenterius.biomancy.datagen.recipes.builder.ItemData;
import com.github.elenterius.biomancy.init.ModBioForgeTabs;
import com.github.elenterius.biomancy.init.ModItems;
import com.github.elenterius.biomancy.item.EssenceItem;
import net.minecraft.data.PackOutput;
import net.minecraft.data.recipes.FinishedRecipe;
import net.minecraft.data.recipes.RecipeProvider;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraftforge.common.crafting.PartialNBTIngredient;

import java.util.function.Consumer;

Expand All @@ -25,6 +30,22 @@ protected BioForgeRecipeProvider(PackOutput output) {
super(output);
}

private static <T extends Item & NutrientsContainerItem> ItemStack withMaxNutrients(T item) {
ItemStack itemStack = item.getDefaultInstance();
item.setNutrients(itemStack, Integer.MAX_VALUE);
return itemStack;
}

private static Ingredient createMobEssenceIngredient(EntityType<?> entityType) {
CompoundTag essenceTag = new CompoundTag();
essenceTag.putString(EssenceItem.ENTITY_TYPE_KEY, EntityType.getKey(entityType).toString());
essenceTag.putString(EssenceItem.ENTITY_NAME_KEY, entityType.getDescriptionId());
CompoundTag tag = new CompoundTag();
tag.put(EssenceItem.ESSENCE_DATA_KEY, essenceTag);
tag.putInt(EssenceItem.ESSENCE_TIER_KEY, 1);
return PartialNBTIngredient.of(ModItems.ESSENCE.get(), tag);
}

@Override
protected void buildRecipes(Consumer<FinishedRecipe> consumer) {
buildMachineRecipes(consumer);
Expand Down Expand Up @@ -150,12 +171,6 @@ private void buildBlockRecipes(Consumer<FinishedRecipe> consumer) {
.unlockedBy(ModItems.BONE_FRAGMENTS.get()).save(consumer);
}

private <T extends Item & NutrientsContainerItem> ItemStack withMaxNutrients(T item) {
ItemStack itemStack = item.getDefaultInstance();
item.setNutrients(itemStack, Integer.MAX_VALUE);
return itemStack;
}

private void buildToolRecipes(Consumer<FinishedRecipe> consumer) {
BioForgeRecipeBuilder.create(withMaxNutrients(ModItems.RAVENOUS_CLAWS.get()))
.addIngredient(ModItems.LIVING_FLESH.get())
Expand Down Expand Up @@ -322,6 +337,44 @@ private void buildComponentRecipes(Consumer<FinishedRecipe> consumer) {
.addIngredient(ModItems.STONE_POWDER.get(), 1)
.setCategory(ModBioForgeTabs.COMPONENTS)
.unlockedBy(Items.NAUTILUS_SHELL).save(consumer);

BioForgeRecipeBuilder.create(Items.SKELETON_SKULL)
.setCraftingCost(4)
.addIngredient(ModItems.BONE_FRAGMENTS.get(), 48 + 2)
.addIngredient(ModItems.MINERAL_FRAGMENT.get(), 7 + 2)
.setCategory(ModBioForgeTabs.COMPONENTS)
.unlockedBy(Items.SKELETON_SKULL).save(consumer);

BioForgeRecipeBuilder.create(Items.WITHER_SKELETON_SKULL)
.setCraftingCost(4)
.addIngredient(ModItems.BONE_FRAGMENTS.get(), 48 + 2)
.addIngredient(ModItems.MINERAL_FRAGMENT.get(), 7 + 2)
.addIngredient(ModItems.WITHERING_OOZE.get(), 16 + 2)
.setCategory(ModBioForgeTabs.COMPONENTS)
.unlockedBy(Items.WITHER_SKELETON_SKULL).save(consumer);

BioForgeRecipeBuilder.create(Items.PLAYER_HEAD)
.setCraftingCost(4)
.addIngredient(Items.SKELETON_SKULL)
.addIngredient(createMobEssenceIngredient(EntityType.PLAYER))
.addIngredient(ModItems.FLESH_BITS.get(), 32 + 2)
.addIngredient(ModItems.ELASTIC_FIBERS.get(), 9 + 2)
.setCategory(ModBioForgeTabs.COMPONENTS)
.unlockedBy(Items.SKELETON_SKULL).save(consumer);

BioForgeRecipeBuilder.create(Items.PIGLIN_HEAD)
.setCraftingCost(4)
.addIngredient(Items.SKELETON_SKULL)
.addIngredient(createMobEssenceIngredient(EntityType.PIGLIN))
.addIngredient(ModItems.FLESH_BITS.get(), 36 + 2)
.addIngredient(ModItems.ELASTIC_FIBERS.get(), 12 + 2)
.setCategory(ModBioForgeTabs.COMPONENTS)
.unlockedBy(Items.SKELETON_SKULL).save(consumer);

// DecomposerRecipeBuilder.create().setIngredient(Items.ZOMBIE_HEAD).addOutput(ModItems.FLESH_BITS.get(), 14, 24).addOutput(ModItems.ELASTIC_FIBERS.get(), 5, 9).addOutput(Items.SKELETON_SKULL, 1).unlockedBy(Items.ZOMBIE_HEAD).save(consumer);
// DecomposerRecipeBuilder.create().setIngredient(Items.CREEPER_HEAD).addOutput(ModItems.FLESH_BITS.get(), 19, 32).addOutput(ModItems.ELASTIC_FIBERS.get(), 5, 9).addOutput(Items.SKELETON_SKULL, 1).unlockedBy(Items.CREEPER_HEAD).save(consumer);
// DecomposerRecipeBuilder.create().setIngredient(Items.DRAGON_HEAD).addOutput(ModItems.FLESH_BITS.get(), 50).addOutput(ModItems.EXOTIC_DUST.get(), 50).addOutput(ModItems.TOUGH_FIBERS.get(), 25).addOutput(ModItems.MINERAL_FRAGMENT.get(), 20).addOutput(ModItems.BONE_FRAGMENTS.get(), 50).unlockedBy(Items.DRAGON_HEAD).save(consumer);

}

private void buildMiscRecipes(Consumer<FinishedRecipe> consumer) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,9 @@ private void buildWorkbenchRecipes(Consumer<FinishedRecipe> consumer) {

SpecialRecipeBuilder.special(ModRecipes.CRADLE_CLEANSING_SERIALIZER.get())
.save(consumer, BiomancyMod.createRLString(ModItems.PRIMORDIAL_CRADLE.getId().toLanguageKey() + "_cleansing"));

SpecialRecipeBuilder.special(ModRecipes.PLAYER_HEAD_SERIALIZER.get())
.save(consumer, getSpecialCraftingRecipeId(Items.PLAYER_HEAD).toString());
}

private void membrane(Consumer<FinishedRecipe> consumer, SimpleBlockItem pane, SimpleBlockItem membrane) {
Expand All @@ -321,6 +324,14 @@ private void membrane(Consumer<FinishedRecipe> consumer, SimpleBlockItem pane, S
.save(consumer, getConversionRecipeId(membrane, pane));
}

protected ResourceLocation getSpecialCraftingRecipeId(ItemLike itemLike) {
return BiomancyMod.createRL("special_crafting/" + getItemName(itemLike));
}

protected ResourceLocation getCraftingRecipeId(ItemLike itemLike) {
return BiomancyMod.createRL("crafting/" + getItemName(itemLike));
}

protected ResourceLocation getSimpleRecipeId(ItemLike itemLike) {
return BiomancyMod.createRL(getItemName(itemLike));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_skeleton_skull": {
"conditions": {
"items": [
{
"items": [
"minecraft:skeleton_skull"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "biomancy:bio_forging/piglin_head_from_bio_forging"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_skeleton_skull",
"has_the_recipe"
]
],
"rewards": {
"recipes": [
"biomancy:bio_forging/piglin_head_from_bio_forging"
]
},
"sends_telemetry_event": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_skeleton_skull": {
"conditions": {
"items": [
{
"items": [
"minecraft:skeleton_skull"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "biomancy:bio_forging/player_head_from_bio_forging"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_skeleton_skull",
"has_the_recipe"
]
],
"rewards": {
"recipes": [
"biomancy:bio_forging/player_head_from_bio_forging"
]
},
"sends_telemetry_event": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_skeleton_skull": {
"conditions": {
"items": [
{
"items": [
"minecraft:skeleton_skull"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "biomancy:bio_forging/skeleton_skull_from_bio_forging"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_skeleton_skull",
"has_the_recipe"
]
],
"rewards": {
"recipes": [
"biomancy:bio_forging/skeleton_skull_from_bio_forging"
]
},
"sends_telemetry_event": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_the_recipe": {
"conditions": {
"recipe": "biomancy:bio_forging/wither_skeleton_skull_from_bio_forging"
},
"trigger": "minecraft:recipe_unlocked"
},
"has_wither_skeleton_skull": {
"conditions": {
"items": [
{
"items": [
"minecraft:wither_skeleton_skull"
]
}
]
},
"trigger": "minecraft:inventory_changed"
}
},
"requirements": [
[
"has_wither_skeleton_skull",
"has_the_recipe"
]
],
"rewards": {
"recipes": [
"biomancy:bio_forging/wither_skeleton_skull_from_bio_forging"
]
},
"sends_telemetry_event": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"type": "biomancy:bio_forging",
"bio_forge_tab": "biomancy:components",
"ingredients": [
{
"item": "minecraft:skeleton_skull"
},
{
"type": "forge:partial_nbt",
"item": "biomancy:essence",
"nbt": "{essence_data:{entity_type:\"minecraft:piglin\",name:\"entity.minecraft.piglin\"},essence_tier:1}"
},
{
"count": 38,
"item": "biomancy:flesh_bits"
},
{
"count": 14,
"item": "biomancy:elastic_fibers"
}
],
"nutrientsCost": 4,
"result": {
"item": "minecraft:piglin_head"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"type": "biomancy:bio_forging",
"bio_forge_tab": "biomancy:components",
"ingredients": [
{
"item": "minecraft:skeleton_skull"
},
{
"type": "forge:partial_nbt",
"item": "biomancy:essence",
"nbt": "{essence_data:{entity_type:\"minecraft:player\",name:\"entity.minecraft.player\"},essence_tier:1}"
},
{
"count": 34,
"item": "biomancy:flesh_bits"
},
{
"count": 11,
"item": "biomancy:elastic_fibers"
}
],
"nutrientsCost": 4,
"result": {
"item": "minecraft:player_head"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"type": "biomancy:bio_forging",
"bio_forge_tab": "biomancy:components",
"ingredients": [
{
"count": 50,
"item": "biomancy:bone_fragments"
},
{
"count": 9,
"item": "biomancy:mineral_fragment"
}
],
"nutrientsCost": 4,
"result": {
"item": "minecraft:skeleton_skull"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"type": "biomancy:bio_forging",
"bio_forge_tab": "biomancy:components",
"ingredients": [
{
"count": 50,
"item": "biomancy:bone_fragments"
},
{
"count": 9,
"item": "biomancy:mineral_fragment"
},
{
"count": 18,
"item": "biomancy:withering_ooze"
}
],
"nutrientsCost": 4,
"result": {
"item": "minecraft:wither_skeleton_skull"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "biomancy:crafting_dynamic_player_head",
"category": "misc"
}
Loading

0 comments on commit 03f9910

Please sign in to comment.