mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-22 19:58:34 +01:00
finished the spawni boi
This commit is contained in:
parent
080b7f8bc9
commit
b336b74efa
11 changed files with 402 additions and 60 deletions
|
@ -5,18 +5,18 @@ import net.minecraft.entity.Entity;
|
|||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.function.Function;
|
||||
import net.minecraftforge.fml.common.registry.EntityEntry;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
|
||||
public class AnimalSpawnerRecipe {
|
||||
|
||||
public final ResourceLocation name;
|
||||
public final Ingredient[] ingredients;
|
||||
public final Function<World, Entity> entity;
|
||||
public final ResourceLocation entity;
|
||||
public final int aura;
|
||||
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.ingredients = ingredients;
|
||||
this.entity = entity;
|
||||
|
@ -24,6 +24,13 @@ public class AnimalSpawnerRecipe {
|
|||
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() {
|
||||
NaturesAuraAPI.ANIMAL_SPAWNER_RECIPES.put(this.name, this);
|
||||
return this;
|
||||
|
|
|
@ -9,6 +9,7 @@ import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
|
|||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
|
@ -52,8 +53,15 @@ public class TileEntityAnimalSpawner extends TileEntityImpl implements ITickable
|
|||
|
||||
this.time += 10;
|
||||
if (this.time >= this.currentRecipe.time) {
|
||||
Entity entity = this.currentRecipe.entity.apply(this.world);
|
||||
entity.setPosition(this.spawnX, this.pos.getY() + 1, this.spawnZ);
|
||||
Entity entity = this.currentRecipe.makeEntity(this.world);
|
||||
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.currentRecipe = null;
|
||||
|
@ -117,7 +125,7 @@ public class TileEntityAnimalSpawner extends TileEntityImpl implements ITickable
|
|||
this.world.rand.nextFloat() + 0.5F);
|
||||
|
||||
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);
|
||||
}
|
||||
AxisAlignedBB bounds = this.entityClient.getEntityBoundingBox();
|
||||
|
|
|
@ -10,7 +10,6 @@ import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
|||
import de.ellpeck.naturesaura.api.recipes.AnimalSpawnerRecipe;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
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) {
|
||||
CraftTweakerCompat.SCHEDULED_ACTIONS.add(() -> {
|
||||
ResourceLocation res = new ResourceLocation(name);
|
||||
return new Add(Collections.singletonMap(res, new AnimalSpawnerRecipe(res,
|
||||
world -> ForgeRegistries.ENTITIES.getValue(new ResourceLocation(entity)).newInstance(world), aura, time,
|
||||
return new Add(Collections.singletonMap(res, new AnimalSpawnerRecipe(res, new ResourceLocation(entity), aura, time,
|
||||
Arrays.stream(ingredients).map(ing -> Ingredient.fromStacks(InputHelper.toStack(ing))).toArray(Ingredient[]::new)
|
||||
)));
|
||||
});
|
||||
|
|
|
@ -16,7 +16,6 @@ import net.minecraft.client.renderer.RenderHelper;
|
|||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
|
@ -64,17 +63,16 @@ public class AnimalSpawnerCategory implements IRecipeCategory<AnimalSpawnerWrapp
|
|||
@Override
|
||||
public void drawExtras(Minecraft minecraft) {
|
||||
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));
|
||||
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();
|
||||
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) {
|
||||
entity.world = world;
|
||||
private static void renderEntity(Entity entity, float x, float y, float rotation, float renderScale, float offset) {
|
||||
GlStateManager.enableColorMaterial();
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.color(1F, 1F, 1F);
|
||||
|
|
|
@ -5,6 +5,8 @@ import de.ellpeck.naturesaura.api.recipes.AnimalSpawnerRecipe;
|
|||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
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.crafting.Ingredient;
|
||||
|
||||
|
@ -22,5 +24,9 @@ public class AnimalSpawnerWrapper implements IRecipeWrapper {
|
|||
for (Ingredient ing : this.recipe.ingredients)
|
||||
builder.add(ing.getMatchingStacks());
|
||||
ingredients.setInputs(VanillaTypes.ITEM, builder.build());
|
||||
|
||||
ItemStack egg = new ItemStack(Items.SPAWN_EGG);
|
||||
ItemMonsterPlacer.applyEntityIdToItemStack(egg, this.recipe.entity);
|
||||
ingredients.setOutput(VanillaTypes.ITEM, egg);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -20,8 +20,7 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.block.BlockFlower;
|
||||
import net.minecraft.block.BlockStoneBrick;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.monster.*;
|
||||
import net.minecraft.entity.passive.*;
|
||||
import net.minecraft.entity.passive.EntitySheep;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
|
@ -32,8 +31,6 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
public final class ModRecipes {
|
||||
|
||||
public static void init() {
|
||||
|
@ -151,52 +148,57 @@ public final class ModRecipes {
|
|||
if (block instanceof BlockFlower)
|
||||
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())
|
||||
spawner("sheep_" + color.getName(), world -> {
|
||||
EntitySheep sheep = new EntitySheep(world);
|
||||
new AnimalSpawnerRecipe(new ResourceLocation(NaturesAura.MOD_ID, "sheep_" + color.getName()), new ResourceLocation("minecraft:sheep"),
|
||||
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);
|
||||
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));
|
||||
spawner("pig", EntityPig::new, 500, 60, Ingredient.fromItem(Items.PORKCHOP));
|
||||
spawner("blaze", EntityBlaze::new, 1500, 120, Ingredient.fromItem(Items.BLAZE_ROD), Ingredient.fromItem(Items.BLAZE_POWDER));
|
||||
spawner("ghast", EntityGhast::new, 1200, 150, Ingredient.fromItem(Items.GUNPOWDER), Ingredient.fromItem(Items.GHAST_TEAR));
|
||||
spawner("ocelot", EntityOcelot::new, 800, 60, Ingredient.fromItem(Items.FISH), Helper.blockIng(Blocks.WOOL));
|
||||
spawner("mule", EntityMule::new, 1000, 100, Ingredient.fromItem(Items.LEATHER), Helper.blockIng(Blocks.CHEST), Ingredient.fromItem(Items.APPLE));
|
||||
spawner("bat", EntityBat::new, 300, 40, Ingredient.fromItem(Items.FEATHER));
|
||||
spawner("endermite", EntityEndermite::new, 300, 40, Ingredient.fromItem(Items.ENDER_PEARL), Helper.blockIng(Blocks.STONE));
|
||||
spawner("parrot", EntityParrot::new, 500, 60, Ingredient.fromItem(Items.FEATHER), Ingredient.fromItem(Items.COOKIE));
|
||||
spawner("slime", EntitySlime::new, 300, 40, Ingredient.fromItem(Items.SLIME_BALL));
|
||||
spawner("spider", EntitySpider::new, 1000, 120, Ingredient.fromItem(Items.STRING), Ingredient.fromItem(Items.SPIDER_EYE));
|
||||
spawner("skeleton", EntitySkeleton::new, 1000, 120, Ingredient.fromItem(Items.BONE), Ingredient.fromItem(Items.ARROW));
|
||||
spawner("enderman", EntityEnderman::new, 1200, 120, Ingredient.fromItem(Items.ENDER_PEARL));
|
||||
spawner("silverfish", EntitySilverfish::new, 300, 40, Helper.blockIng(Blocks.STONE));
|
||||
spawner("squid", EntitySquid::new, 500, 40, Ingredient.fromStacks(new ItemStack(Items.DYE, 1, EnumDyeColor.BLACK.getDyeDamage())));
|
||||
spawner("stray", EntityStray::new, 1000, 120, Ingredient.fromItem(Items.BONE), Helper.blockIng(Blocks.ICE));
|
||||
spawner("shulker", EntityShulker::new, 1500, 100, Ingredient.fromItem(Items.SHULKER_SHELL));
|
||||
spawner("husk", EntityHusk::new, 1000, 120, Ingredient.fromItem(Items.ROTTEN_FLESH), Helper.blockIng(Blocks.SAND));
|
||||
spawner("llama", EntityLlama::new, 600, 80, Ingredient.fromStacks(new ItemStack(Blocks.WOOL, 1, OreDictionary.WILDCARD_VALUE)));
|
||||
spawner("rabbit", EntityRabbit::new, 300, 40, Ingredient.fromItem(Items.RABBIT_HIDE));
|
||||
spawner("magma_cube", EntityMagmaCube::new, 1000, 100, Ingredient.fromItem(Items.MAGMA_CREAM));
|
||||
spawner("zombie_pigman", EntityPigZombie::new, 1200, 150, Ingredient.fromItem(Items.ROTTEN_FLESH), Ingredient.fromItem(Items.GOLD_NUGGET));
|
||||
spawner("polar_bear", EntityPolarBear::new, 500, 60, Ingredient.fromItem(Items.FISH), Helper.blockIng(Blocks.ICE));
|
||||
spawner("mooshroom", EntityMooshroom::new, 400, 60, Ingredient.fromItem(Items.LEATHER), Helper.blockIng(Blocks.RED_MUSHROOM));
|
||||
spawner("guardian", EntityGuardian::new, 1500, 150, Ingredient.fromItem(Items.PRISMARINE_SHARD), Ingredient.fromItem(Items.PRISMARINE_CRYSTALS));
|
||||
spawner("horse", EntityHorse::new, 1000, 100, Ingredient.fromItem(Items.LEATHER));
|
||||
spawner("donkey", EntityDonkey::new, 1000, 100, Ingredient.fromItem(Items.LEATHER), Helper.blockIng(Blocks.CHEST));
|
||||
spawner("cave_spider", EntityCaveSpider::new, 1000, 120, Ingredient.fromItem(Items.STRING), Ingredient.fromItem(Items.FERMENTED_SPIDER_EYE));
|
||||
spawner("creeper", EntityCreeper::new, 1000, 120, Ingredient.fromItem(Items.GUNPOWDER));
|
||||
spawner("witch", EntityWitch::new, 1500, 150, Ingredient.fromItem(Items.GLASS_BOTTLE), Ingredient.fromItem(Items.GLOWSTONE_DUST));
|
||||
spawner("wither_skeleton", EntityWitherSkeleton::new, 1500, 150, Ingredient.fromItem(Items.BONE), Helper.blockIng(Blocks.OBSIDIAN));
|
||||
spawner("wolf", EntityWolf::new, 500, 60, Ingredient.fromItem(Items.LEATHER), Ingredient.fromItem(Items.BONE));
|
||||
spawner("zombie", EntityZombie::new, 1000, 100, Ingredient.fromItem(Items.ROTTEN_FLESH));
|
||||
}
|
||||
}.register();
|
||||
spawner("chicken", "minecraft:chicken", 300, 40, Ingredient.fromItem(Items.FEATHER), Ingredient.fromItem(Items.EGG));
|
||||
spawner("pig", "minecraft:pig", 500, 60, Ingredient.fromItem(Items.PORKCHOP));
|
||||
spawner("blaze", "minecraft:blaze", 1500, 120, Ingredient.fromItem(Items.BLAZE_ROD), Ingredient.fromItem(Items.BLAZE_POWDER));
|
||||
spawner("ghast", "minecraft:ghast", 1200, 150, Ingredient.fromItem(Items.GUNPOWDER), Ingredient.fromItem(Items.GHAST_TEAR));
|
||||
spawner("ocelot", "minecraft:ocelot", 800, 60, Ingredient.fromItem(Items.FISH), Helper.blockIng(Blocks.WOOL));
|
||||
spawner("mule", "minecraft:mule", 1000, 100, Ingredient.fromItem(Items.LEATHER), Helper.blockIng(Blocks.CHEST), Ingredient.fromItem(Items.APPLE));
|
||||
spawner("bat", "minecraft:bat", 300, 40, Ingredient.fromItem(Items.FEATHER));
|
||||
spawner("endermite", "minecraft:endermite", 300, 40, Ingredient.fromItem(Items.ENDER_PEARL), Helper.blockIng(Blocks.STONE));
|
||||
spawner("parrot", "minecraft:parrot", 500, 60, Ingredient.fromItem(Items.FEATHER), Ingredient.fromItem(Items.COOKIE));
|
||||
spawner("slime", "minecraft:slime", 300, 40, Ingredient.fromItem(Items.SLIME_BALL));
|
||||
spawner("spider", "minecraft:spider", 1000, 120, Ingredient.fromItem(Items.STRING), Ingredient.fromItem(Items.SPIDER_EYE));
|
||||
spawner("skeleton", "minecraft:skeleton", 1000, 120, Ingredient.fromItem(Items.BONE), Ingredient.fromItem(Items.ARROW));
|
||||
spawner("enderman", "minecraft:enderman", 1200, 120, Ingredient.fromItem(Items.ENDER_PEARL));
|
||||
spawner("silverfish", "minecraft:silverfish", 300, 40, Helper.blockIng(Blocks.STONE));
|
||||
spawner("squid", "minecraft:squid", 500, 40, Ingredient.fromStacks(new ItemStack(Items.DYE, 1, EnumDyeColor.BLACK.getDyeDamage())));
|
||||
spawner("stray", "minecraft:stray", 1000, 120, Ingredient.fromItem(Items.BONE), Helper.blockIng(Blocks.ICE));
|
||||
spawner("shulker", "minecraft:shulker", 1500, 100, Ingredient.fromItem(Items.SHULKER_SHELL));
|
||||
spawner("husk", "minecraft:husk", 1000, 120, Ingredient.fromItem(Items.ROTTEN_FLESH), Helper.blockIng(Blocks.SAND));
|
||||
spawner("llama", "minecraft:llama", 600, 80, Ingredient.fromStacks(new ItemStack(Blocks.WOOL, 1, OreDictionary.WILDCARD_VALUE)));
|
||||
spawner("rabbit", "minecraft:rabbit", 300, 40, Ingredient.fromItem(Items.RABBIT_HIDE));
|
||||
spawner("magma_cube", "minecraft:magma_cube", 1000, 100, Ingredient.fromItem(Items.MAGMA_CREAM));
|
||||
spawner("zombie_pigman", "minecraft:zombie_pigman", 1200, 150, Ingredient.fromItem(Items.ROTTEN_FLESH), Ingredient.fromItem(Items.GOLD_NUGGET));
|
||||
spawner("polar_bear", "minecraft:polar_bear", 500, 60, Ingredient.fromItem(Items.FISH), Helper.blockIng(Blocks.ICE));
|
||||
spawner("mooshroom", "minecraft:mooshroom", 400, 60, Ingredient.fromItem(Items.LEATHER), Helper.blockIng(Blocks.RED_MUSHROOM));
|
||||
spawner("guardian", "minecraft:guardian", 1500, 150, Ingredient.fromItem(Items.PRISMARINE_SHARD), Ingredient.fromItem(Items.PRISMARINE_CRYSTALS));
|
||||
spawner("horse", "minecraft:horse", 1000, 100, Ingredient.fromItem(Items.LEATHER));
|
||||
spawner("donkey", "minecraft:donkey", 1000, 100, Ingredient.fromItem(Items.LEATHER), Helper.blockIng(Blocks.CHEST));
|
||||
spawner("cave_spider", "minecraft:cave_spider", 1000, 120, Ingredient.fromItem(Items.STRING), Ingredient.fromItem(Items.FERMENTED_SPIDER_EYE));
|
||||
spawner("creeper", "minecraft:creeper", 1000, 120, Ingredient.fromItem(Items.GUNPOWDER));
|
||||
spawner("witch", "minecraft:witch", 1500, 150, Ingredient.fromItem(Items.GLASS_BOTTLE), Ingredient.fromItem(Items.GLOWSTONE_DUST));
|
||||
spawner("wither_skeleton", "minecraft:wither_skeleton", 1500, 150, Ingredient.fromItem(Items.BONE), Helper.blockIng(Blocks.OBSIDIAN));
|
||||
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];
|
||||
actualIngs[0] = Ingredient.fromItem(ModItems.BIRTH_SPIRIT);
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -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"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -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 |
Loading…
Reference in a new issue