finished the spawni boi

This commit is contained in:
Ellpeck 2019-01-01 15:20:12 +01:00
parent 080b7f8bc9
commit b336b74efa
11 changed files with 402 additions and 60 deletions

View file

@ -5,18 +5,18 @@ import net.minecraft.entity.Entity;
import net.minecraft.item.crafting.Ingredient; import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.EntityEntry;
import java.util.function.Function; import net.minecraftforge.fml.common.registry.ForgeRegistries;
public class AnimalSpawnerRecipe { public class AnimalSpawnerRecipe {
public final ResourceLocation name; public final ResourceLocation name;
public final Ingredient[] ingredients; public final Ingredient[] ingredients;
public final Function<World, Entity> entity; public final ResourceLocation entity;
public final int aura; public final int aura;
public final int time; public final int time;
public AnimalSpawnerRecipe(ResourceLocation name, Function<World, Entity> entity, int aura, int time, Ingredient... ingredients) { public AnimalSpawnerRecipe(ResourceLocation name, ResourceLocation entity, int aura, int time, Ingredient... ingredients) {
this.name = name; this.name = name;
this.ingredients = ingredients; this.ingredients = ingredients;
this.entity = entity; this.entity = entity;
@ -24,6 +24,13 @@ public class AnimalSpawnerRecipe {
this.time = time; this.time = time;
} }
public Entity makeEntity(World world) {
EntityEntry entry = ForgeRegistries.ENTITIES.getValue(this.entity);
if (entry == null)
return null;
return entry.newInstance(world);
}
public AnimalSpawnerRecipe register() { public AnimalSpawnerRecipe register() {
NaturesAuraAPI.ANIMAL_SPAWNER_RECIPES.put(this.name, this); NaturesAuraAPI.ANIMAL_SPAWNER_RECIPES.put(this.name, this);
return this; return this;

View file

@ -9,6 +9,7 @@ import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketHandler;
import de.ellpeck.naturesaura.packet.PacketParticles; import de.ellpeck.naturesaura.packet.PacketParticles;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient; import net.minecraft.item.crafting.Ingredient;
@ -52,8 +53,15 @@ public class TileEntityAnimalSpawner extends TileEntityImpl implements ITickable
this.time += 10; this.time += 10;
if (this.time >= this.currentRecipe.time) { if (this.time >= this.currentRecipe.time) {
Entity entity = this.currentRecipe.entity.apply(this.world); Entity entity = this.currentRecipe.makeEntity(this.world);
entity.setPosition(this.spawnX, this.pos.getY() + 1, this.spawnZ); entity.setLocationAndAngles(this.spawnX, this.pos.getY() + 1, this.spawnZ,
MathHelper.wrapDegrees(this.world.rand.nextFloat() * 360F), 0F);
if (entity instanceof EntityLiving) {
EntityLiving living = (EntityLiving) entity;
living.rotationYawHead = entity.rotationYaw;
living.renderYawOffset = entity.rotationYaw;
living.onInitialSpawn(this.world.getDifficultyForLocation(living.getPosition()), null);
}
this.world.spawnEntity(entity); this.world.spawnEntity(entity);
this.currentRecipe = null; this.currentRecipe = null;
@ -117,7 +125,7 @@ public class TileEntityAnimalSpawner extends TileEntityImpl implements ITickable
this.world.rand.nextFloat() + 0.5F); this.world.rand.nextFloat() + 0.5F);
if (this.entityClient == null) { if (this.entityClient == null) {
this.entityClient = this.currentRecipe.entity.apply(this.world); this.entityClient = this.currentRecipe.makeEntity(this.world);
this.entityClient.setPosition(this.spawnX, this.pos.getY() + 1, this.spawnZ); this.entityClient.setPosition(this.spawnX, this.pos.getY() + 1, this.spawnZ);
} }
AxisAlignedBB bounds = this.entityClient.getEntityBoundingBox(); AxisAlignedBB bounds = this.entityClient.getEntityBoundingBox();

View file

@ -10,7 +10,6 @@ import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.recipes.AnimalSpawnerRecipe; import de.ellpeck.naturesaura.api.recipes.AnimalSpawnerRecipe;
import net.minecraft.item.crafting.Ingredient; import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod; import stanhebben.zenscript.annotations.ZenMethod;
@ -26,8 +25,7 @@ public final class AnimalSpawnerTweaker {
public static void addRecipe(String name, String entity, int aura, int time, IItemStack[] ingredients) { public static void addRecipe(String name, String entity, int aura, int time, IItemStack[] ingredients) {
CraftTweakerCompat.SCHEDULED_ACTIONS.add(() -> { CraftTweakerCompat.SCHEDULED_ACTIONS.add(() -> {
ResourceLocation res = new ResourceLocation(name); ResourceLocation res = new ResourceLocation(name);
return new Add(Collections.singletonMap(res, new AnimalSpawnerRecipe(res, return new Add(Collections.singletonMap(res, new AnimalSpawnerRecipe(res, new ResourceLocation(entity), aura, time,
world -> ForgeRegistries.ENTITIES.getValue(new ResourceLocation(entity)).newInstance(world), aura, time,
Arrays.stream(ingredients).map(ing -> Ingredient.fromStacks(InputHelper.toStack(ing))).toArray(Ingredient[]::new) Arrays.stream(ingredients).map(ing -> Ingredient.fromStacks(InputHelper.toStack(ing))).toArray(Ingredient[]::new)
))); )));
}); });

View file

@ -16,7 +16,6 @@ import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.I18n;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import java.util.Arrays; import java.util.Arrays;
@ -64,17 +63,16 @@ public class AnimalSpawnerCategory implements IRecipeCategory<AnimalSpawnerWrapp
@Override @Override
public void drawExtras(Minecraft minecraft) { public void drawExtras(Minecraft minecraft) {
if (this.entity == null) if (this.entity == null)
this.entity = this.recipe.entity.apply(minecraft.world); this.entity = this.recipe.makeEntity(minecraft.world);
float size = Math.max(1F, Math.max(this.entity.width, this.entity.height)); float size = Math.max(1F, Math.max(this.entity.width, this.entity.height));
renderEntity(this.entity, minecraft.world, 35, 28, 35F, 100F / size * 0.4F, size * 0.5F); renderEntity(this.entity, 35, 28, 35F, 100F / size * 0.4F, size * 0.5F);
String name = this.entity.getDisplayName().getFormattedText(); String name = this.entity.getDisplayName().getFormattedText();
minecraft.fontRenderer.drawString(name, 36 - minecraft.fontRenderer.getStringWidth(name) / 2F, 55, 0xFFFFFF, true); minecraft.fontRenderer.drawString(name, 36 - minecraft.fontRenderer.getStringWidth(name) / 2F, 55, 0xFFFFFF, true);
} }
private static void renderEntity(Entity entity, World world, float x, float y, float rotation, float renderScale, float offset) { private static void renderEntity(Entity entity, float x, float y, float rotation, float renderScale, float offset) {
entity.world = world;
GlStateManager.enableColorMaterial(); GlStateManager.enableColorMaterial();
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
GlStateManager.color(1F, 1F, 1F); GlStateManager.color(1F, 1F, 1F);

View file

@ -5,6 +5,8 @@ import de.ellpeck.naturesaura.api.recipes.AnimalSpawnerRecipe;
import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.ingredients.VanillaTypes; import mezz.jei.api.ingredients.VanillaTypes;
import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.init.Items;
import net.minecraft.item.ItemMonsterPlacer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient; import net.minecraft.item.crafting.Ingredient;
@ -22,5 +24,9 @@ public class AnimalSpawnerWrapper implements IRecipeWrapper {
for (Ingredient ing : this.recipe.ingredients) for (Ingredient ing : this.recipe.ingredients)
builder.add(ing.getMatchingStacks()); builder.add(ing.getMatchingStacks());
ingredients.setInputs(VanillaTypes.ITEM, builder.build()); ingredients.setInputs(VanillaTypes.ITEM, builder.build());
ItemStack egg = new ItemStack(Items.SPAWN_EGG);
ItemMonsterPlacer.applyEntityIdToItemStack(egg, this.recipe.entity);
ingredients.setOutput(VanillaTypes.ITEM, egg);
} }
} }

View file

@ -0,0 +1,55 @@
package de.ellpeck.naturesaura.compat.patchouli;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.recipes.AnimalSpawnerRecipe;
import net.minecraft.client.resources.I18n;
import net.minecraft.init.Items;
import net.minecraft.item.ItemMonsterPlacer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.EntityEntry;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import vazkii.patchouli.api.IComponentProcessor;
import vazkii.patchouli.api.IVariableProvider;
import vazkii.patchouli.api.PatchouliAPI;
public class ProcessorAnimalSpawner implements IComponentProcessor {
private AnimalSpawnerRecipe recipe;
@Override
public void setup(IVariableProvider<String> provider) {
ResourceLocation res = new ResourceLocation(provider.get("recipe"));
this.recipe = NaturesAuraAPI.ANIMAL_SPAWNER_RECIPES.get(res);
}
@Override
public String process(String key) {
if (key.startsWith("input")) {
int id = Integer.parseInt(key.substring(5)) - 1;
if (this.recipe.ingredients.length > id)
return PatchouliAPI.instance.serializeIngredient(this.recipe.ingredients[id]);
else
return null;
} else {
switch (key) {
case "name":
EntityEntry entry = ForgeRegistries.ENTITIES.getValue(this.recipe.entity);
return I18n.format("entity." + entry.getName() + ".name");
case "entity":
return this.recipe.entity.toString();
case "egg":
ItemStack egg = new ItemStack(Items.SPAWN_EGG);
ItemMonsterPlacer.applyEntityIdToItemStack(egg, this.recipe.entity);
return PatchouliAPI.instance.serializeItemStack(egg);
default:
return null;
}
}
}
@Override
public boolean allowRender(String group) {
return !"seekrit".equals(group);
}
}

View file

@ -20,8 +20,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockFlower; import net.minecraft.block.BlockFlower;
import net.minecraft.block.BlockStoneBrick; import net.minecraft.block.BlockStoneBrick;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.monster.*; import net.minecraft.entity.passive.EntitySheep;
import net.minecraft.entity.passive.*;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.EnumDyeColor; import net.minecraft.item.EnumDyeColor;
@ -32,8 +31,6 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.ForgeRegistries; import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
import java.util.function.Function;
public final class ModRecipes { public final class ModRecipes {
public static void init() { public static void init() {
@ -151,52 +148,57 @@ public final class ModRecipes {
if (block instanceof BlockFlower) if (block instanceof BlockFlower)
NaturesAuraAPI.FLOWERS.addAll(block.getBlockState().getValidStates()); NaturesAuraAPI.FLOWERS.addAll(block.getBlockState().getValidStates());
spawner("cow", EntityCow::new, 500, 60, Ingredient.fromItem(Items.BEEF), Ingredient.fromItem(Items.LEATHER)); spawner("cow", "minecraft:cow", 500, 60, Ingredient.fromItem(Items.BEEF), Ingredient.fromItem(Items.LEATHER));
for (EnumDyeColor color : EnumDyeColor.values()) for (EnumDyeColor color : EnumDyeColor.values())
spawner("sheep_" + color.getName(), world -> { new AnimalSpawnerRecipe(new ResourceLocation(NaturesAura.MOD_ID, "sheep_" + color.getName()), new ResourceLocation("minecraft:sheep"),
EntitySheep sheep = new EntitySheep(world); 500, 60, Ingredient.fromItem(ModItems.BIRTH_SPIRIT), Ingredient.fromItem(Items.MUTTON),
Ingredient.fromStacks(new ItemStack(Blocks.WOOL, 1, color.getMetadata()))) {
@Override
public Entity makeEntity(World world) {
EntitySheep sheep = (EntitySheep) super.makeEntity(world);
sheep.setFleeceColor(color); sheep.setFleeceColor(color);
return sheep; return sheep;
}, 500, 60, Ingredient.fromItem(Items.MUTTON), Ingredient.fromStacks(new ItemStack(Blocks.WOOL, 1, color.getMetadata()))); }
spawner("chicken", EntityChicken::new, 300, 40, Ingredient.fromItem(Items.FEATHER), Ingredient.fromItem(Items.EGG)); }.register();
spawner("pig", EntityPig::new, 500, 60, Ingredient.fromItem(Items.PORKCHOP)); spawner("chicken", "minecraft:chicken", 300, 40, Ingredient.fromItem(Items.FEATHER), Ingredient.fromItem(Items.EGG));
spawner("blaze", EntityBlaze::new, 1500, 120, Ingredient.fromItem(Items.BLAZE_ROD), Ingredient.fromItem(Items.BLAZE_POWDER)); spawner("pig", "minecraft:pig", 500, 60, Ingredient.fromItem(Items.PORKCHOP));
spawner("ghast", EntityGhast::new, 1200, 150, Ingredient.fromItem(Items.GUNPOWDER), Ingredient.fromItem(Items.GHAST_TEAR)); spawner("blaze", "minecraft:blaze", 1500, 120, Ingredient.fromItem(Items.BLAZE_ROD), Ingredient.fromItem(Items.BLAZE_POWDER));
spawner("ocelot", EntityOcelot::new, 800, 60, Ingredient.fromItem(Items.FISH), Helper.blockIng(Blocks.WOOL)); spawner("ghast", "minecraft:ghast", 1200, 150, Ingredient.fromItem(Items.GUNPOWDER), Ingredient.fromItem(Items.GHAST_TEAR));
spawner("mule", EntityMule::new, 1000, 100, Ingredient.fromItem(Items.LEATHER), Helper.blockIng(Blocks.CHEST), Ingredient.fromItem(Items.APPLE)); spawner("ocelot", "minecraft:ocelot", 800, 60, Ingredient.fromItem(Items.FISH), Helper.blockIng(Blocks.WOOL));
spawner("bat", EntityBat::new, 300, 40, Ingredient.fromItem(Items.FEATHER)); spawner("mule", "minecraft:mule", 1000, 100, Ingredient.fromItem(Items.LEATHER), Helper.blockIng(Blocks.CHEST), Ingredient.fromItem(Items.APPLE));
spawner("endermite", EntityEndermite::new, 300, 40, Ingredient.fromItem(Items.ENDER_PEARL), Helper.blockIng(Blocks.STONE)); spawner("bat", "minecraft:bat", 300, 40, Ingredient.fromItem(Items.FEATHER));
spawner("parrot", EntityParrot::new, 500, 60, Ingredient.fromItem(Items.FEATHER), Ingredient.fromItem(Items.COOKIE)); spawner("endermite", "minecraft:endermite", 300, 40, Ingredient.fromItem(Items.ENDER_PEARL), Helper.blockIng(Blocks.STONE));
spawner("slime", EntitySlime::new, 300, 40, Ingredient.fromItem(Items.SLIME_BALL)); spawner("parrot", "minecraft:parrot", 500, 60, Ingredient.fromItem(Items.FEATHER), Ingredient.fromItem(Items.COOKIE));
spawner("spider", EntitySpider::new, 1000, 120, Ingredient.fromItem(Items.STRING), Ingredient.fromItem(Items.SPIDER_EYE)); spawner("slime", "minecraft:slime", 300, 40, Ingredient.fromItem(Items.SLIME_BALL));
spawner("skeleton", EntitySkeleton::new, 1000, 120, Ingredient.fromItem(Items.BONE), Ingredient.fromItem(Items.ARROW)); spawner("spider", "minecraft:spider", 1000, 120, Ingredient.fromItem(Items.STRING), Ingredient.fromItem(Items.SPIDER_EYE));
spawner("enderman", EntityEnderman::new, 1200, 120, Ingredient.fromItem(Items.ENDER_PEARL)); spawner("skeleton", "minecraft:skeleton", 1000, 120, Ingredient.fromItem(Items.BONE), Ingredient.fromItem(Items.ARROW));
spawner("silverfish", EntitySilverfish::new, 300, 40, Helper.blockIng(Blocks.STONE)); spawner("enderman", "minecraft:enderman", 1200, 120, Ingredient.fromItem(Items.ENDER_PEARL));
spawner("squid", EntitySquid::new, 500, 40, Ingredient.fromStacks(new ItemStack(Items.DYE, 1, EnumDyeColor.BLACK.getDyeDamage()))); spawner("silverfish", "minecraft:silverfish", 300, 40, Helper.blockIng(Blocks.STONE));
spawner("stray", EntityStray::new, 1000, 120, Ingredient.fromItem(Items.BONE), Helper.blockIng(Blocks.ICE)); spawner("squid", "minecraft:squid", 500, 40, Ingredient.fromStacks(new ItemStack(Items.DYE, 1, EnumDyeColor.BLACK.getDyeDamage())));
spawner("shulker", EntityShulker::new, 1500, 100, Ingredient.fromItem(Items.SHULKER_SHELL)); spawner("stray", "minecraft:stray", 1000, 120, Ingredient.fromItem(Items.BONE), Helper.blockIng(Blocks.ICE));
spawner("husk", EntityHusk::new, 1000, 120, Ingredient.fromItem(Items.ROTTEN_FLESH), Helper.blockIng(Blocks.SAND)); spawner("shulker", "minecraft:shulker", 1500, 100, Ingredient.fromItem(Items.SHULKER_SHELL));
spawner("llama", EntityLlama::new, 600, 80, Ingredient.fromStacks(new ItemStack(Blocks.WOOL, 1, OreDictionary.WILDCARD_VALUE))); spawner("husk", "minecraft:husk", 1000, 120, Ingredient.fromItem(Items.ROTTEN_FLESH), Helper.blockIng(Blocks.SAND));
spawner("rabbit", EntityRabbit::new, 300, 40, Ingredient.fromItem(Items.RABBIT_HIDE)); spawner("llama", "minecraft:llama", 600, 80, Ingredient.fromStacks(new ItemStack(Blocks.WOOL, 1, OreDictionary.WILDCARD_VALUE)));
spawner("magma_cube", EntityMagmaCube::new, 1000, 100, Ingredient.fromItem(Items.MAGMA_CREAM)); spawner("rabbit", "minecraft:rabbit", 300, 40, Ingredient.fromItem(Items.RABBIT_HIDE));
spawner("zombie_pigman", EntityPigZombie::new, 1200, 150, Ingredient.fromItem(Items.ROTTEN_FLESH), Ingredient.fromItem(Items.GOLD_NUGGET)); spawner("magma_cube", "minecraft:magma_cube", 1000, 100, Ingredient.fromItem(Items.MAGMA_CREAM));
spawner("polar_bear", EntityPolarBear::new, 500, 60, Ingredient.fromItem(Items.FISH), Helper.blockIng(Blocks.ICE)); spawner("zombie_pigman", "minecraft:zombie_pigman", 1200, 150, Ingredient.fromItem(Items.ROTTEN_FLESH), Ingredient.fromItem(Items.GOLD_NUGGET));
spawner("mooshroom", EntityMooshroom::new, 400, 60, Ingredient.fromItem(Items.LEATHER), Helper.blockIng(Blocks.RED_MUSHROOM)); spawner("polar_bear", "minecraft:polar_bear", 500, 60, Ingredient.fromItem(Items.FISH), Helper.blockIng(Blocks.ICE));
spawner("guardian", EntityGuardian::new, 1500, 150, Ingredient.fromItem(Items.PRISMARINE_SHARD), Ingredient.fromItem(Items.PRISMARINE_CRYSTALS)); spawner("mooshroom", "minecraft:mooshroom", 400, 60, Ingredient.fromItem(Items.LEATHER), Helper.blockIng(Blocks.RED_MUSHROOM));
spawner("horse", EntityHorse::new, 1000, 100, Ingredient.fromItem(Items.LEATHER)); spawner("guardian", "minecraft:guardian", 1500, 150, Ingredient.fromItem(Items.PRISMARINE_SHARD), Ingredient.fromItem(Items.PRISMARINE_CRYSTALS));
spawner("donkey", EntityDonkey::new, 1000, 100, Ingredient.fromItem(Items.LEATHER), Helper.blockIng(Blocks.CHEST)); spawner("horse", "minecraft:horse", 1000, 100, Ingredient.fromItem(Items.LEATHER));
spawner("cave_spider", EntityCaveSpider::new, 1000, 120, Ingredient.fromItem(Items.STRING), Ingredient.fromItem(Items.FERMENTED_SPIDER_EYE)); spawner("donkey", "minecraft:donkey", 1000, 100, Ingredient.fromItem(Items.LEATHER), Helper.blockIng(Blocks.CHEST));
spawner("creeper", EntityCreeper::new, 1000, 120, Ingredient.fromItem(Items.GUNPOWDER)); spawner("cave_spider", "minecraft:cave_spider", 1000, 120, Ingredient.fromItem(Items.STRING), Ingredient.fromItem(Items.FERMENTED_SPIDER_EYE));
spawner("witch", EntityWitch::new, 1500, 150, Ingredient.fromItem(Items.GLASS_BOTTLE), Ingredient.fromItem(Items.GLOWSTONE_DUST)); spawner("creeper", "minecraft:creeper", 1000, 120, Ingredient.fromItem(Items.GUNPOWDER));
spawner("wither_skeleton", EntityWitherSkeleton::new, 1500, 150, Ingredient.fromItem(Items.BONE), Helper.blockIng(Blocks.OBSIDIAN)); spawner("witch", "minecraft:witch", 1500, 150, Ingredient.fromItem(Items.GLASS_BOTTLE), Ingredient.fromItem(Items.GLOWSTONE_DUST));
spawner("wolf", EntityWolf::new, 500, 60, Ingredient.fromItem(Items.LEATHER), Ingredient.fromItem(Items.BONE)); spawner("wither_skeleton", "minecraft:wither_skeleton", 1500, 150, Ingredient.fromItem(Items.BONE), Helper.blockIng(Blocks.OBSIDIAN));
spawner("zombie", EntityZombie::new, 1000, 100, Ingredient.fromItem(Items.ROTTEN_FLESH)); spawner("wolf", "minecraft:wolf", 500, 60, Ingredient.fromItem(Items.LEATHER), Ingredient.fromItem(Items.BONE));
spawner("zombie", "minecraft:zombie", 1000, 100, Ingredient.fromItem(Items.ROTTEN_FLESH));
} }
private static void spawner(String name, Function<World, Entity> entity, int aura, int time, Ingredient... ings) { private static void spawner(String name, String entity, int aura, int time, Ingredient... ings) {
Ingredient[] actualIngs = new Ingredient[ings.length + 1]; Ingredient[] actualIngs = new Ingredient[ings.length + 1];
actualIngs[0] = Ingredient.fromItem(ModItems.BIRTH_SPIRIT); actualIngs[0] = Ingredient.fromItem(ModItems.BIRTH_SPIRIT);
System.arraycopy(ings, 0, actualIngs, 1, ings.length); System.arraycopy(ings, 0, actualIngs, 1, ings.length);
new AnimalSpawnerRecipe(new ResourceLocation(NaturesAura.MOD_ID, name), entity, aura, time, actualIngs).register(); new AnimalSpawnerRecipe(new ResourceLocation(NaturesAura.MOD_ID, name), new ResourceLocation(entity), aura, time, actualIngs).register();
} }
} }

View file

@ -0,0 +1,173 @@
{
"name": "Altar of Birthing",
"icon": "naturesaura:animal_spawner",
"category": "using",
"advancement": "naturesaura:sky_ingot",
"pages": [
{
"type": "text",
"text": "Sometimes, the $(thing)creation$() of certain living creatures would be of use for any slightly gruesome botanist. For this, the $(item)Altar of Birthing$() can be used: It can create and spawn almost any $(thing)living creature$() at the cost of some ingredients that are related to that very creature and a bit of $(aura) from the environment."
},
{
"type": "text",
"text": "For it to work, it requires the right structure to be assembled as well as the usage of a $(item)Spirit of Birthing$() as follows: All ingredients, including the $(item)Spirit of Birthing$(), are required to be thrown down on the ground close to the $(item)Altar of Birthing$() and the process will begin automatically.$(p)The following pages outline the construction, the way to obtain the $(item)Spirit of Birthing$() and all of the possible creatures to be spawned."
},
{
"type": "spotlight",
"item": "naturesaura:birth_spirit",
"link_recipe": true,
"text": "The required $(item)Spirit of Birthing$() can be obtained easily by a person $(thing)breeding$() two passive animals together while there is a (slight) excess of $(aura) present in the surrounding area. For each new baby born, there is a chance of a few $(item)Spirits of Birthing$() to be created in the process."
},
{
"type": "crafting",
"recipe": "naturesaura:animal_spawner",
"text": "Creating the $(item)Altar of Birthing$()"
},
{
"type": "multiblock",
"multiblock_id": "naturesaura:animal_spawner",
"text": "This formation needs to be created around the $(item)Altar of Birthing$() for it to work as expected."
},
{
"type": "naturesaura:animal_spawner",
"recipe": "naturesaura:cow"
},
{
"type": "naturesaura:animal_spawner",
"recipe": "naturesaura:sheep_white",
"text": "The color of the $(item)Wool$() used determines the color of the $(thing)Sheep$() created."
},
{
"type": "naturesaura:animal_spawner",
"recipe": "naturesaura:chicken"
},
{
"type": "naturesaura:animal_spawner",
"recipe": "naturesaura:pig"
},
{
"type": "naturesaura:animal_spawner",
"recipe": "naturesaura:blaze"
},
{
"type": "naturesaura:animal_spawner",
"recipe": "naturesaura:ghast"
},
{
"type": "naturesaura:animal_spawner",
"recipe": "naturesaura:ocelot"
},
{
"type": "naturesaura:animal_spawner",
"recipe": "naturesaura:mule"
},
{
"type": "naturesaura:animal_spawner",
"recipe": "naturesaura:bat"
},
{
"type": "naturesaura:animal_spawner",
"recipe": "naturesaura:endermite"
},
{
"type": "naturesaura:animal_spawner",
"recipe": "naturesaura:parrot"
},
{
"type": "naturesaura:animal_spawner",
"recipe": "naturesaura:slime"
},
{
"type": "naturesaura:animal_spawner",
"recipe": "naturesaura:spider"
},
{
"type": "naturesaura:animal_spawner",
"recipe": "naturesaura:skeleton"
},
{
"type": "naturesaura:animal_spawner",
"recipe": "naturesaura:enderman"
},
{
"type": "naturesaura:animal_spawner",
"recipe": "naturesaura:silverfish"
},
{
"type": "naturesaura:animal_spawner",
"recipe": "naturesaura:squid"
},
{
"type": "naturesaura:animal_spawner",
"recipe": "naturesaura:stray"
},
{
"type": "naturesaura:animal_spawner",
"recipe": "naturesaura:shulker"
},
{
"type": "naturesaura:animal_spawner",
"recipe": "naturesaura:husk"
},
{
"type": "naturesaura:animal_spawner",
"recipe": "naturesaura:llama"
},
{
"type": "naturesaura:animal_spawner",
"recipe": "naturesaura:rabbit"
},
{
"type": "naturesaura:animal_spawner",
"recipe": "naturesaura:magma_cube"
},
{
"type": "naturesaura:animal_spawner",
"recipe": "naturesaura:zombie_pigman"
},
{
"type": "naturesaura:animal_spawner",
"recipe": "naturesaura:polar_bear"
},
{
"type": "naturesaura:animal_spawner",
"recipe": "naturesaura:mooshroom"
},
{
"type": "naturesaura:animal_spawner",
"recipe": "naturesaura:guardian"
},
{
"type": "naturesaura:animal_spawner",
"recipe": "naturesaura:horse"
},
{
"type": "naturesaura:animal_spawner",
"recipe": "naturesaura:donkey"
},
{
"type": "naturesaura:animal_spawner",
"recipe": "naturesaura:cave_spider"
},
{
"type": "naturesaura:animal_spawner",
"recipe": "naturesaura:creeper"
},
{
"type": "naturesaura:animal_spawner",
"recipe": "naturesaura:witch"
},
{
"type": "naturesaura:animal_spawner",
"recipe": "naturesaura:wither_skeleton"
},
{
"type": "naturesaura:animal_spawner",
"recipe": "naturesaura:wolf"
},
{
"type": "naturesaura:animal_spawner",
"recipe": "naturesaura:zombie"
}
]
}

View file

@ -0,0 +1,66 @@
{
"processor": "de.ellpeck.naturesaura.compat.patchouli.ProcessorAnimalSpawner",
"components": [
{
"type": "item",
"item": "#input1",
"x": 12,
"y": 100
},
{
"type": "item",
"item": "#input2",
"x": 36,
"y": 100
},
{
"type": "item",
"item": "#input3",
"x": 60,
"y": 100
},
{
"type": "item",
"item": "#input4",
"x": 84,
"y": 100
},
{
"type": "entity",
"entity": "#entity",
"x": 56,
"y": 60,
"render_size": 60
},
{
"type": "image",
"image": "naturesaura:textures/gui/patchouli/elements.png",
"x": 8,
"y": 10,
"u": 0,
"v": 131,
"width": 96,
"height": 110
},
{
"type": "header",
"text": "#name",
"x": -1,
"y": 0
},
{
"type": "text",
"text": "#text",
"x": 0,
"y": 122
},
{
"type": "item",
"item": "#egg",
"x": 0,
"y": 0,
"link_recipe": true,
"group": "seekrit"
}
]
}

View file

@ -0,0 +1,29 @@
{
"type": "forge:ore_shaped",
"pattern": [
"SHS",
"IWI",
"SHS"
],
"key": {
"H": {
"item": "minecraft:hay_block"
},
"I": {
"item": "minecraft:iron_bars"
},
"S": {
"item": "naturesaura:sky_ingot"
},
"W": {
"type": "minecraft:item_nbt",
"item": "naturesaura:aura_bottle",
"nbt": {
"stored_type": "naturesaura:end"
}
}
},
"result": {
"item": "naturesaura:animal_spawner"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB