From 080b7f8bc92df495598b5efd5fe7c1e7d53a49dc Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Mon, 31 Dec 2018 17:32:38 +0100 Subject: [PATCH] more work on the animal spawner. Patchouli category, doc and recipes left to come --- .../crafttweaker/AnimalSpawnerTweaker.java | 67 ++++++++++++ .../compat/jei/JEINaturesAuraPlugin.java | 10 +- .../jei/animal/AnimalSpawnerCategory.java | 96 ++++++++++++++++++ .../jei/animal/AnimalSpawnerWrapper.java | 26 +++++ .../naturesaura/items/ItemBirthSpirit.java | 36 +++++++ .../ellpeck/naturesaura/items/ModItems.java | 2 +- .../naturesaura/recipes/ModRecipes.java | 73 +++++++++---- .../blockstates/animal_spawner.json | 20 ++++ .../assets/naturesaura/lang/en_US.lang | 3 + .../naturesaura/models/item/birth_spirit.json | 6 ++ .../textures/blocks/animal_spawner.png | Bin 0 -> 681 bytes .../textures/blocks/animal_spawner_bottom.png | Bin 0 -> 681 bytes .../textures/blocks/animal_spawner_top.png | Bin 0 -> 649 bytes .../textures/gui/jei/animal_spawner.png | Bin 0 -> 1727 bytes .../textures/items/birth_spirit.png | Bin 0 -> 678 bytes 15 files changed, 319 insertions(+), 20 deletions(-) create mode 100644 src/main/java/de/ellpeck/naturesaura/compat/crafttweaker/AnimalSpawnerTweaker.java create mode 100644 src/main/java/de/ellpeck/naturesaura/compat/jei/animal/AnimalSpawnerCategory.java create mode 100644 src/main/java/de/ellpeck/naturesaura/compat/jei/animal/AnimalSpawnerWrapper.java create mode 100644 src/main/java/de/ellpeck/naturesaura/items/ItemBirthSpirit.java create mode 100644 src/main/resources/assets/naturesaura/blockstates/animal_spawner.json create mode 100644 src/main/resources/assets/naturesaura/models/item/birth_spirit.json create mode 100644 src/main/resources/assets/naturesaura/textures/blocks/animal_spawner.png create mode 100644 src/main/resources/assets/naturesaura/textures/blocks/animal_spawner_bottom.png create mode 100644 src/main/resources/assets/naturesaura/textures/blocks/animal_spawner_top.png create mode 100644 src/main/resources/assets/naturesaura/textures/gui/jei/animal_spawner.png create mode 100644 src/main/resources/assets/naturesaura/textures/items/birth_spirit.png diff --git a/src/main/java/de/ellpeck/naturesaura/compat/crafttweaker/AnimalSpawnerTweaker.java b/src/main/java/de/ellpeck/naturesaura/compat/crafttweaker/AnimalSpawnerTweaker.java new file mode 100644 index 00000000..e6c976f2 --- /dev/null +++ b/src/main/java/de/ellpeck/naturesaura/compat/crafttweaker/AnimalSpawnerTweaker.java @@ -0,0 +1,67 @@ +package de.ellpeck.naturesaura.compat.crafttweaker; + +import com.blamejared.mtlib.helpers.InputHelper; +import com.blamejared.mtlib.utils.BaseMapAddition; +import com.blamejared.mtlib.utils.BaseMapRemoval; +import crafttweaker.annotations.ZenRegister; +import crafttweaker.api.item.IItemStack; +import de.ellpeck.naturesaura.NaturesAura; +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; + +import java.util.Arrays; +import java.util.Collections; +import java.util.Map; + +@ZenRegister +@ZenClass("mods." + NaturesAura.MOD_ID + ".AnimalSpawner") +public final class AnimalSpawnerTweaker { + + @ZenMethod + 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, + Arrays.stream(ingredients).map(ing -> Ingredient.fromStacks(InputHelper.toStack(ing))).toArray(Ingredient[]::new) + ))); + }); + } + + @ZenMethod + public static void removeRecipe(String name) { + CraftTweakerCompat.SCHEDULED_ACTIONS.add(() -> { + ResourceLocation res = new ResourceLocation(name); + return new Remove(Collections.singletonMap(res, NaturesAuraAPI.ANIMAL_SPAWNER_RECIPES.get(res))); + }); + } + + private static class Add extends BaseMapAddition { + + protected Add(Map map) { + super("AnimalSpawner", NaturesAuraAPI.ANIMAL_SPAWNER_RECIPES, map); + } + + @Override + protected String getRecipeInfo(Map.Entry recipe) { + return recipe.getValue().name.toString(); + } + } + + private static class Remove extends BaseMapRemoval { + + protected Remove(Map map) { + super("AnimalSpawner", NaturesAuraAPI.ANIMAL_SPAWNER_RECIPES, map); + } + + @Override + protected String getRecipeInfo(Map.Entry recipe) { + return recipe.getValue().name.toString(); + } + } +} diff --git a/src/main/java/de/ellpeck/naturesaura/compat/jei/JEINaturesAuraPlugin.java b/src/main/java/de/ellpeck/naturesaura/compat/jei/JEINaturesAuraPlugin.java index a0dad737..3f5c9dfa 100644 --- a/src/main/java/de/ellpeck/naturesaura/compat/jei/JEINaturesAuraPlugin.java +++ b/src/main/java/de/ellpeck/naturesaura/compat/jei/JEINaturesAuraPlugin.java @@ -3,11 +3,14 @@ package de.ellpeck.naturesaura.compat.jei; import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.recipes.AltarRecipe; +import de.ellpeck.naturesaura.api.recipes.AnimalSpawnerRecipe; import de.ellpeck.naturesaura.api.recipes.OfferingRecipe; import de.ellpeck.naturesaura.api.recipes.TreeRitualRecipe; import de.ellpeck.naturesaura.blocks.ModBlocks; import de.ellpeck.naturesaura.compat.jei.altar.AltarCategory; import de.ellpeck.naturesaura.compat.jei.altar.AltarWrapper; +import de.ellpeck.naturesaura.compat.jei.animal.AnimalSpawnerCategory; +import de.ellpeck.naturesaura.compat.jei.animal.AnimalSpawnerWrapper; import de.ellpeck.naturesaura.compat.jei.offering.OfferingCategory; import de.ellpeck.naturesaura.compat.jei.offering.OfferingWrapper; import de.ellpeck.naturesaura.compat.jei.treeritual.TreeRitualCategory; @@ -25,6 +28,7 @@ public class JEINaturesAuraPlugin implements IModPlugin { public static final String TREE_RITUAL = NaturesAura.MOD_ID + ".tree_ritual"; public static final String ALTAR = NaturesAura.MOD_ID + ".altar"; public static final String OFFERING = NaturesAura.MOD_ID + ".offering"; + public static final String SPAWNER = NaturesAura.MOD_ID + ".animal_spawner"; @Override public void registerCategories(IRecipeCategoryRegistration registry) { @@ -32,7 +36,8 @@ public class JEINaturesAuraPlugin implements IModPlugin { registry.addRecipeCategories( new TreeRitualCategory(helper), new AltarCategory(helper), - new OfferingCategory(helper) + new OfferingCategory(helper), + new AnimalSpawnerCategory(helper) ); } @@ -41,15 +46,18 @@ public class JEINaturesAuraPlugin implements IModPlugin { registry.handleRecipes(TreeRitualRecipe.class, TreeRitualWrapper::new, TREE_RITUAL); registry.handleRecipes(AltarRecipe.class, AltarWrapper::new, ALTAR); registry.handleRecipes(OfferingRecipe.class, OfferingWrapper::new, OFFERING); + registry.handleRecipes(AnimalSpawnerRecipe.class, AnimalSpawnerWrapper::new, SPAWNER); registry.addRecipes(NaturesAuraAPI.TREE_RITUAL_RECIPES.values(), TREE_RITUAL); registry.addRecipes(NaturesAuraAPI.ALTAR_RECIPES.values(), ALTAR); registry.addRecipes(NaturesAuraAPI.OFFERING_RECIPES.values(), OFFERING); + registry.addRecipes(NaturesAuraAPI.ANIMAL_SPAWNER_RECIPES.values(), SPAWNER); registry.addRecipeCatalyst(new ItemStack(ModBlocks.GOLD_POWDER), TREE_RITUAL); registry.addRecipeCatalyst(new ItemStack(ModBlocks.WOOD_STAND), TREE_RITUAL); registry.addRecipeCatalyst(new ItemStack(ModBlocks.NATURE_ALTAR), ALTAR); registry.addRecipeCatalyst(new ItemStack(ModBlocks.CONVERSION_CATALYST), ALTAR); registry.addRecipeCatalyst(new ItemStack(ModBlocks.OFFERING_TABLE), OFFERING); + registry.addRecipeCatalyst(new ItemStack(ModBlocks.ANIMAL_SPAWNER), SPAWNER); } } diff --git a/src/main/java/de/ellpeck/naturesaura/compat/jei/animal/AnimalSpawnerCategory.java b/src/main/java/de/ellpeck/naturesaura/compat/jei/animal/AnimalSpawnerCategory.java new file mode 100644 index 00000000..ffb5d2a7 --- /dev/null +++ b/src/main/java/de/ellpeck/naturesaura/compat/jei/animal/AnimalSpawnerCategory.java @@ -0,0 +1,96 @@ +package de.ellpeck.naturesaura.compat.jei.animal; + +import de.ellpeck.naturesaura.NaturesAura; +import de.ellpeck.naturesaura.api.recipes.AnimalSpawnerRecipe; +import de.ellpeck.naturesaura.compat.jei.JEINaturesAuraPlugin; +import mezz.jei.api.IGuiHelper; +import mezz.jei.api.gui.IDrawable; +import mezz.jei.api.gui.IGuiItemStackGroup; +import mezz.jei.api.gui.IRecipeLayout; +import mezz.jei.api.ingredients.IIngredients; +import mezz.jei.api.recipe.IRecipeCategory; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +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; + +public class AnimalSpawnerCategory implements IRecipeCategory { + + private final IDrawable background; + private AnimalSpawnerRecipe recipe; + private Entity entity; + + public AnimalSpawnerCategory(IGuiHelper helper) { + this.background = helper.createDrawable(new ResourceLocation(NaturesAura.MOD_ID, "textures/gui/jei/animal_spawner.png"), 0, 0, 72, 86); + } + + @Override + public String getUid() { + return JEINaturesAuraPlugin.SPAWNER; + } + + @Override + public String getTitle() { + return I18n.format("container." + JEINaturesAuraPlugin.SPAWNER + ".name"); + } + + @Override + public String getModName() { + return NaturesAura.MOD_NAME; + } + + @Override + public IDrawable getBackground() { + return this.background; + } + + @Override + public void setRecipe(IRecipeLayout recipeLayout, AnimalSpawnerWrapper recipeWrapper, IIngredients ingredients) { + IGuiItemStackGroup group = recipeLayout.getItemStacks(); + this.recipe = recipeWrapper.recipe; + this.entity = null; + for (int i = 0; i < this.recipe.ingredients.length; i++) { + group.init(i, true, i * 18, 68); + group.set(i, Arrays.asList(this.recipe.ingredients[i].getMatchingStacks())); + } + } + + @Override + public void drawExtras(Minecraft minecraft) { + if (this.entity == null) + this.entity = this.recipe.entity.apply(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); + + 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; + GlStateManager.enableColorMaterial(); + GlStateManager.pushMatrix(); + GlStateManager.color(1F, 1F, 1F); + GlStateManager.translate(x, y, 50.0F); + GlStateManager.scale(-renderScale, renderScale, renderScale); + GlStateManager.translate(0F, offset, 0F); + GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(rotation, 0.0F, 1.0F, 0.0F); + RenderHelper.enableStandardItemLighting(); + Minecraft.getMinecraft().getRenderManager().playerViewY = 180.0F; + Minecraft.getMinecraft().getRenderManager().renderEntity(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, false); + GlStateManager.popMatrix(); + RenderHelper.disableStandardItemLighting(); + GlStateManager.disableRescaleNormal(); + GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GlStateManager.disableTexture2D(); + GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); + } +} diff --git a/src/main/java/de/ellpeck/naturesaura/compat/jei/animal/AnimalSpawnerWrapper.java b/src/main/java/de/ellpeck/naturesaura/compat/jei/animal/AnimalSpawnerWrapper.java new file mode 100644 index 00000000..4bed5d8e --- /dev/null +++ b/src/main/java/de/ellpeck/naturesaura/compat/jei/animal/AnimalSpawnerWrapper.java @@ -0,0 +1,26 @@ +package de.ellpeck.naturesaura.compat.jei.animal; + +import com.google.common.collect.ImmutableList; +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.item.ItemStack; +import net.minecraft.item.crafting.Ingredient; + +public class AnimalSpawnerWrapper implements IRecipeWrapper { + + public final AnimalSpawnerRecipe recipe; + + public AnimalSpawnerWrapper(AnimalSpawnerRecipe recipe) { + this.recipe = recipe; + } + + @Override + public void getIngredients(IIngredients ingredients) { + ImmutableList.Builder builder = ImmutableList.builder(); + for (Ingredient ing : this.recipe.ingredients) + builder.add(ing.getMatchingStacks()); + ingredients.setInputs(VanillaTypes.ITEM, builder.build()); + } +} diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemBirthSpirit.java b/src/main/java/de/ellpeck/naturesaura/items/ItemBirthSpirit.java new file mode 100644 index 00000000..a09e3f7e --- /dev/null +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemBirthSpirit.java @@ -0,0 +1,36 @@ +package de.ellpeck.naturesaura.items; + +import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.item.ItemStack; +import net.minecraft.util.math.BlockPos; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.entity.living.BabyEntitySpawnEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +public class ItemBirthSpirit extends ItemGlowing { + public ItemBirthSpirit() { + super("birth_spirit"); + MinecraftForge.EVENT_BUS.register(this); + } + + @SubscribeEvent + public void onBabyBorn(BabyEntitySpawnEvent event) { + EntityLivingBase parent = event.getParentA(); + if (!parent.world.isRemote && event.getCausedByPlayer() != null) { + BlockPos pos = parent.getPosition(); + int aura = IAuraChunk.getAuraInArea(parent.world, pos, 30); + if (aura < 12000) + return; + + int amount = parent.world.rand.nextInt(3) + 1; + EntityItem item = new EntityItem(parent.world, parent.posX, parent.posY, parent.posZ, + new ItemStack(ModItems.BIRTH_SPIRIT, amount)); + parent.world.spawnEntity(item); + + BlockPos spot = IAuraChunk.getHighestSpot(parent.world, pos, 30, pos); + IAuraChunk.getAuraChunk(parent.world, spot).drainAura(spot, 50 * amount); + } + } +} diff --git a/src/main/java/de/ellpeck/naturesaura/items/ModItems.java b/src/main/java/de/ellpeck/naturesaura/items/ModItems.java index ed1f8353..16ee7c89 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ModItems.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ModItems.java @@ -42,5 +42,5 @@ public final class ModItems { public static final Item SKY_INGOT = new ItemImpl("sky_ingot"); public static final Item CALLING_SPIRIT = new ItemGlowing("calling_spirit"); public static final Item EFFECT_POWDER = new ItemEffectPowder(); - public static final Item BIRTH_SPIRIT = new ItemImpl("birth_spirit"); + public static final Item BIRTH_SPIRIT = new ItemBirthSpirit(); } diff --git a/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java b/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java index 0935b4d1..6792c48c 100644 --- a/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java +++ b/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java @@ -19,15 +19,20 @@ import de.ellpeck.naturesaura.items.ModItems; import net.minecraft.block.Block; import net.minecraft.block.BlockFlower; import net.minecraft.block.BlockStoneBrick; -import net.minecraft.entity.passive.EntityCow; -import net.minecraft.entity.passive.EntitySheep; +import net.minecraft.entity.Entity; +import net.minecraft.entity.monster.*; +import net.minecraft.entity.passive.*; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.Ingredient; import net.minecraft.util.ResourceLocation; +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 { @@ -135,22 +140,6 @@ public final class ModRecipes { Ingredient.fromItem(ModItems.CALLING_SPIRIT), new ItemStack(ModItems.SKY_INGOT)).register(); - new AnimalSpawnerRecipe(new ResourceLocation(NaturesAura.MOD_ID, "cow"), - EntityCow::new, 500, 60, - Ingredient.fromItem(ModItems.BIRTH_SPIRIT), - Ingredient.fromItem(Items.BEEF), - Ingredient.fromItem(Items.LEATHER)).register(); - for (EnumDyeColor color : EnumDyeColor.values()) - new AnimalSpawnerRecipe(new ResourceLocation(NaturesAura.MOD_ID, "sheep_" + color.getName()), - world -> { - EntitySheep sheep = new EntitySheep(world); - sheep.setFleeceColor(color); - return sheep; - }, 500, 60, - Ingredient.fromItem(ModItems.BIRTH_SPIRIT), - Ingredient.fromItem(Items.MUTTON), - Ingredient.fromStacks(new ItemStack(Blocks.WOOL, 1, color.getMetadata()))).register(); - NaturesAuraAPI.BOTANIST_PICKAXE_CONVERSIONS.put( Blocks.COBBLESTONE.getDefaultState(), Blocks.MOSSY_COBBLESTONE.getDefaultState()); @@ -161,5 +150,53 @@ public final class ModRecipes { for (Block block : ForgeRegistries.BLOCKS) if (block instanceof BlockFlower) NaturesAuraAPI.FLOWERS.addAll(block.getBlockState().getValidStates()); + + spawner("cow", EntityCow::new, 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); + 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)); + } + + private static void spawner(String name, Function 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(); } } diff --git a/src/main/resources/assets/naturesaura/blockstates/animal_spawner.json b/src/main/resources/assets/naturesaura/blockstates/animal_spawner.json new file mode 100644 index 00000000..b7383cee --- /dev/null +++ b/src/main/resources/assets/naturesaura/blockstates/animal_spawner.json @@ -0,0 +1,20 @@ +{ + "forge_marker": 1, + "defaults": { + "model": "minecraft:cube", + "textures": { + "particle": "naturesaura:blocks/animal_spawner", + "up": "naturesaura:blocks/animal_spawner_top", + "down": "naturesaura:blocks/animal_spawner_bottom", + "north": "#particle", + "east": "#particle", + "south": "#particle", + "west": "#particle" + }, + "transform": "forge:default-block" + }, + "variants": { + "normal": [{}], + "inventory": [{}] + } +} \ No newline at end of file diff --git a/src/main/resources/assets/naturesaura/lang/en_US.lang b/src/main/resources/assets/naturesaura/lang/en_US.lang index 8adf8a3e..0b1a60af 100644 --- a/src/main/resources/assets/naturesaura/lang/en_US.lang +++ b/src/main/resources/assets/naturesaura/lang/en_US.lang @@ -37,6 +37,7 @@ tile.naturesaura.spawn_lamp.name=Lamp of Sanctuary tile.naturesaura.animal_generator.name=Disentangler of Mortals tile.naturesaura.end_flower.name=Rose of Oblivion tile.naturesaura.grated_chute.name=Adept Hopper +tile.naturesaura.animal_spawner.name=Altar of Birthing item.naturesaura.eye.name=Environmental Eye item.naturesaura.eye_improved.name=Environmental Ocular @@ -62,6 +63,7 @@ item.naturesaura.farming_stencil.name=Farming Stencil item.naturesaura.bottle_two_the_rebottling.name=Bottle and Cork item.naturesaura.sky_ingot.name=Ingot of the Skies item.naturesaura.calling_spirit.name=Spirit of Calling +item.naturesaura.birth_spirit.name=Spirit of Birthing item.naturesaura.infused_iron_helmet.name=Botanist's Headwear item.naturesaura.infused_iron_chest.name=Botanist's Chestplate item.naturesaura.infused_iron_pants.name=Botanist's Leggings @@ -73,6 +75,7 @@ item.naturesaura.effect_powder.naturesaura:animal.name=Powder of Chastity container.naturesaura.tree_ritual.name=Ritual of the Forest container.naturesaura.altar.name=Natural Altar Infusion container.naturesaura.offering.name=Offering to the Gods +container.naturesaura.animal_spawner.name=Altar of Birthing info.naturesaura.aura_in_area=Aura Around info.naturesaura.book.landing=$(aura) is a complicated matter, and creating, collecting and making use of it can be difficult.$(br)The $(item)Book of Natural Aura$() contains all the information one requires to do so. diff --git a/src/main/resources/assets/naturesaura/models/item/birth_spirit.json b/src/main/resources/assets/naturesaura/models/item/birth_spirit.json new file mode 100644 index 00000000..d33b03ea --- /dev/null +++ b/src/main/resources/assets/naturesaura/models/item/birth_spirit.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "naturesaura:items/birth_spirit" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/naturesaura/textures/blocks/animal_spawner.png b/src/main/resources/assets/naturesaura/textures/blocks/animal_spawner.png new file mode 100644 index 0000000000000000000000000000000000000000..bce49816a3f2411e998f447a0aa564fa99189210 GIT binary patch literal 681 zcmV;a0#^NrP)N2bZe?^J zG%hhNHDpIvQUCw~CrLy>R5(vvl1WcfQ547Dl4TPUgHQ+B2W=li)xP%#wqjd4z4F>p zJ5f47=K?M?27`v7(Ktlo5Q8g|y3vKvm3u#e-^t(2O<0he{B!O(=YOVq6r;?a-)ED)& ztMM%Q@AngWvH9+i!)xUgPjnsMQZR)B6Q~y(M4%g+El}#W?Fx!7Qxt^Q;als|H(K)L z%I3){d;H5By)jQ;+h2bgPoH}d+4V2qlP}J$XG%W1pm^e$YpJ}?E~>pmnM%`}zOT^Mtz>~9b9;b$Y9)3-AecKtb+Au|Vg{bXl$yW!|n6M6?L#?#@NhfNH;>5q?v9Gr0Tu4dQ0-E-C3dZFM literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/naturesaura/textures/blocks/animal_spawner_bottom.png b/src/main/resources/assets/naturesaura/textures/blocks/animal_spawner_bottom.png new file mode 100644 index 0000000000000000000000000000000000000000..55f9fad9999ea8b15d769d730333308653c72397 GIT binary patch literal 681 zcmV;a0#^NrP)N2bZe?^J zG%hhNHDpIvQUCw~CrLy>R5(vPl38mLVHAeH%ls5^ZJXIp;mgHzHPPjn_A%#STuU zzW2<_ znIb*M;t4?)5T3r&SX0$EU{C?@3BarSBY=Nl)hZxQ&Mm`ii6o?}+Lo1;N^&0TO)s;w z2F3bhkY~ke9a-sac4Z|ic_*e}JadaeDLxrDpGSMg_Oj`jDU6lY-4Cy%DQ?euk$TewCg4e#TOEfWGh*Wzoy<3zSg#}o9yZW_<@mv=qW zTuC>%H)kb-?(~uGg}ED>V7bPfb}#nf%Vp)3U>jl-;AMwUz6`+le`qf8ZF4KXoxB>H z5Ydw9sMH-s4U6o)PJRBB`gE53_%qlU1e&{%7l-QLt!ur>6w1!NC!YKV7fV20mH%Yv P00000NkvXXu0mjf4@EVQ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/naturesaura/textures/blocks/animal_spawner_top.png b/src/main/resources/assets/naturesaura/textures/blocks/animal_spawner_top.png new file mode 100644 index 0000000000000000000000000000000000000000..91d45953027ac7ef0f1153876951bd3e5eaef207 GIT binary patch literal 649 zcmV;40(Sk0P)N2bZe?^J zG%hhNHDpIvQUCw~2T4RhR5(vPlG{%cQ4q$@m>`I>UFbyAscN56C5|0G}SYuo;a53KY8%j+Y}m1|aAh06$on-5@^RGCbQzH9d~R z;8GAO)zwgXa@#e0?asd=gB)nIya+-pMFJ)p9fI(~hPrfpiYUJM4s@(gjXi%e^W|rJ z^KJ6w2YQP=+ck4V?xHI+!<9v4TJsX23kN?~u7hyP<%Y|V01sa)Kp3?ht+=o%34G$k zd#(iZIZuTNK78Zuslwo$JkaQPmI~^~p)O3n+Z84w#cM9ee}%c)knKcTy$jQY;fWdF zk{7AA;G}jBNsFKav4M@OO4qV9awC zctjR6F!1dIVa8WZ8xH^lB}!Z)N`mv#O3D+9QW**oGxJLH@={9_O!N%(OjFz=fF%x- zs;7%%NJZS+I}7t(CkU`69zXkgf037)9>>Z}YO`l59_Na9`QPCn>-UN~mw!gx`e>2= z^5ou9RsjZm2{DH6*F+r{_9R3w+=&inVEoXO$XJjc%gAzoyN&e#-4)3`|2%KU_H~b+ zF9VX_|2scP`Ty&>{+;OSzwb9ZPu~x9**YeUhW^zIOb;GwH8A|x!PQXxnoEHpt^nwf znwVPi1HbJ%Yrk=SzgD{87E{7j)&p7G4Ohh&R_ii^MKi3~#t@OqIKm`+`94(rW%@6t Vp7&<0&L&V9vd$@?2>^^*1F--A literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/naturesaura/textures/items/birth_spirit.png b/src/main/resources/assets/naturesaura/textures/items/birth_spirit.png new file mode 100644 index 0000000000000000000000000000000000000000..71998462e0f7512f73c942f79314e1964f692afd GIT binary patch literal 678 zcmV;X0$KfuP)N2bZe?^J zG%hhNHDpIvQUCw~BuPX;R5(v%Q%z4(Q4qcV)P*a9t)fj_xbP!lqAp#yFwtTvZAAsD zu?jJuF=!-IW2>lD3ZxKu#n^}M>%PABc+b4tQgAVErgLY`%$%93!C;^O{3pF$PxbqK zv7;yw?KsY%m>>w$A%_htjeo}Ei5g0$Q%yM{hou}%3l;R-{qYEOA`ki4M!l;!!>3a_%ibcn`R5GI~`2r z>PU>AbN`&)$HL`60JPRh*sR^uvM#cX$Pnkn>TYHg8^sQaxfK(u)c`%IP9iH4-oXgg zczeSrOm}WioE-7@t|9r?GmS+P zM?Zz@6~oHHMIQtrA3J6o0&-?nUN#*rUDv|X=s61qqlZIzea%!dyC&Q7mwXVIF&vk~ z*%1YRpQ8X)ScxN0GnqF1Y@IpsXW}6-z+RRW23sDO%oUEtq(!0r0XKLV3c_<#uK)l5 M07*qoM6N<$g0H729smFU literal 0 HcmV?d00001