more work on the animal spawner. Patchouli category, doc and recipes left to come

This commit is contained in:
Ellpeck 2018-12-31 17:32:38 +01:00
parent 0566a81012
commit 080b7f8bc9
15 changed files with 319 additions and 20 deletions

View file

@ -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<ResourceLocation, AnimalSpawnerRecipe> {
protected Add(Map<ResourceLocation, AnimalSpawnerRecipe> map) {
super("AnimalSpawner", NaturesAuraAPI.ANIMAL_SPAWNER_RECIPES, map);
}
@Override
protected String getRecipeInfo(Map.Entry<ResourceLocation, AnimalSpawnerRecipe> recipe) {
return recipe.getValue().name.toString();
}
}
private static class Remove extends BaseMapRemoval<ResourceLocation, AnimalSpawnerRecipe> {
protected Remove(Map<ResourceLocation, AnimalSpawnerRecipe> map) {
super("AnimalSpawner", NaturesAuraAPI.ANIMAL_SPAWNER_RECIPES, map);
}
@Override
protected String getRecipeInfo(Map.Entry<ResourceLocation, AnimalSpawnerRecipe> recipe) {
return recipe.getValue().name.toString();
}
}
}

View file

@ -3,11 +3,14 @@ package de.ellpeck.naturesaura.compat.jei;
import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.recipes.AltarRecipe; 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.OfferingRecipe;
import de.ellpeck.naturesaura.api.recipes.TreeRitualRecipe; import de.ellpeck.naturesaura.api.recipes.TreeRitualRecipe;
import de.ellpeck.naturesaura.blocks.ModBlocks; import de.ellpeck.naturesaura.blocks.ModBlocks;
import de.ellpeck.naturesaura.compat.jei.altar.AltarCategory; import de.ellpeck.naturesaura.compat.jei.altar.AltarCategory;
import de.ellpeck.naturesaura.compat.jei.altar.AltarWrapper; 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.OfferingCategory;
import de.ellpeck.naturesaura.compat.jei.offering.OfferingWrapper; import de.ellpeck.naturesaura.compat.jei.offering.OfferingWrapper;
import de.ellpeck.naturesaura.compat.jei.treeritual.TreeRitualCategory; 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 TREE_RITUAL = NaturesAura.MOD_ID + ".tree_ritual";
public static final String ALTAR = NaturesAura.MOD_ID + ".altar"; public static final String ALTAR = NaturesAura.MOD_ID + ".altar";
public static final String OFFERING = NaturesAura.MOD_ID + ".offering"; public static final String OFFERING = NaturesAura.MOD_ID + ".offering";
public static final String SPAWNER = NaturesAura.MOD_ID + ".animal_spawner";
@Override @Override
public void registerCategories(IRecipeCategoryRegistration registry) { public void registerCategories(IRecipeCategoryRegistration registry) {
@ -32,7 +36,8 @@ public class JEINaturesAuraPlugin implements IModPlugin {
registry.addRecipeCategories( registry.addRecipeCategories(
new TreeRitualCategory(helper), new TreeRitualCategory(helper),
new AltarCategory(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(TreeRitualRecipe.class, TreeRitualWrapper::new, TREE_RITUAL);
registry.handleRecipes(AltarRecipe.class, AltarWrapper::new, ALTAR); registry.handleRecipes(AltarRecipe.class, AltarWrapper::new, ALTAR);
registry.handleRecipes(OfferingRecipe.class, OfferingWrapper::new, OFFERING); 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.TREE_RITUAL_RECIPES.values(), TREE_RITUAL);
registry.addRecipes(NaturesAuraAPI.ALTAR_RECIPES.values(), ALTAR); registry.addRecipes(NaturesAuraAPI.ALTAR_RECIPES.values(), ALTAR);
registry.addRecipes(NaturesAuraAPI.OFFERING_RECIPES.values(), OFFERING); 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.GOLD_POWDER), TREE_RITUAL);
registry.addRecipeCatalyst(new ItemStack(ModBlocks.WOOD_STAND), TREE_RITUAL); registry.addRecipeCatalyst(new ItemStack(ModBlocks.WOOD_STAND), TREE_RITUAL);
registry.addRecipeCatalyst(new ItemStack(ModBlocks.NATURE_ALTAR), ALTAR); registry.addRecipeCatalyst(new ItemStack(ModBlocks.NATURE_ALTAR), ALTAR);
registry.addRecipeCatalyst(new ItemStack(ModBlocks.CONVERSION_CATALYST), ALTAR); registry.addRecipeCatalyst(new ItemStack(ModBlocks.CONVERSION_CATALYST), ALTAR);
registry.addRecipeCatalyst(new ItemStack(ModBlocks.OFFERING_TABLE), OFFERING); registry.addRecipeCatalyst(new ItemStack(ModBlocks.OFFERING_TABLE), OFFERING);
registry.addRecipeCatalyst(new ItemStack(ModBlocks.ANIMAL_SPAWNER), SPAWNER);
} }
} }

View file

@ -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<AnimalSpawnerWrapper> {
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);
}
}

View file

@ -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<ItemStack> builder = ImmutableList.builder();
for (Ingredient ing : this.recipe.ingredients)
builder.add(ing.getMatchingStacks());
ingredients.setInputs(VanillaTypes.ITEM, builder.build());
}
}

View file

@ -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);
}
}
}

View file

@ -42,5 +42,5 @@ public final class ModItems {
public static final Item SKY_INGOT = new ItemImpl("sky_ingot"); public static final Item SKY_INGOT = new ItemImpl("sky_ingot");
public static final Item CALLING_SPIRIT = new ItemGlowing("calling_spirit"); public static final Item CALLING_SPIRIT = new ItemGlowing("calling_spirit");
public static final Item EFFECT_POWDER = new ItemEffectPowder(); 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();
} }

View file

@ -19,15 +19,20 @@ import de.ellpeck.naturesaura.items.ModItems;
import net.minecraft.block.Block; 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.passive.EntityCow; import net.minecraft.entity.Entity;
import net.minecraft.entity.passive.EntitySheep; import net.minecraft.entity.monster.*;
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;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
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.minecraftforge.fml.common.registry.ForgeRegistries; import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.oredict.OreDictionary;
import java.util.function.Function;
public final class ModRecipes { public final class ModRecipes {
@ -135,22 +140,6 @@ public final class ModRecipes {
Ingredient.fromItem(ModItems.CALLING_SPIRIT), Ingredient.fromItem(ModItems.CALLING_SPIRIT),
new ItemStack(ModItems.SKY_INGOT)).register(); 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( NaturesAuraAPI.BOTANIST_PICKAXE_CONVERSIONS.put(
Blocks.COBBLESTONE.getDefaultState(), Blocks.COBBLESTONE.getDefaultState(),
Blocks.MOSSY_COBBLESTONE.getDefaultState()); Blocks.MOSSY_COBBLESTONE.getDefaultState());
@ -161,5 +150,53 @@ public final class ModRecipes {
for (Block block : ForgeRegistries.BLOCKS) for (Block block : ForgeRegistries.BLOCKS)
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));
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<World, Entity> 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();
} }
} }

View file

@ -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": [{}]
}
}

View file

@ -37,6 +37,7 @@ tile.naturesaura.spawn_lamp.name=Lamp of Sanctuary
tile.naturesaura.animal_generator.name=Disentangler of Mortals tile.naturesaura.animal_generator.name=Disentangler of Mortals
tile.naturesaura.end_flower.name=Rose of Oblivion tile.naturesaura.end_flower.name=Rose of Oblivion
tile.naturesaura.grated_chute.name=Adept Hopper tile.naturesaura.grated_chute.name=Adept Hopper
tile.naturesaura.animal_spawner.name=Altar of Birthing
item.naturesaura.eye.name=Environmental Eye item.naturesaura.eye.name=Environmental Eye
item.naturesaura.eye_improved.name=Environmental Ocular 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.bottle_two_the_rebottling.name=Bottle and Cork
item.naturesaura.sky_ingot.name=Ingot of the Skies item.naturesaura.sky_ingot.name=Ingot of the Skies
item.naturesaura.calling_spirit.name=Spirit of Calling 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_helmet.name=Botanist's Headwear
item.naturesaura.infused_iron_chest.name=Botanist's Chestplate item.naturesaura.infused_iron_chest.name=Botanist's Chestplate
item.naturesaura.infused_iron_pants.name=Botanist's Leggings 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.tree_ritual.name=Ritual of the Forest
container.naturesaura.altar.name=Natural Altar Infusion container.naturesaura.altar.name=Natural Altar Infusion
container.naturesaura.offering.name=Offering to the Gods 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.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. 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.

View file

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "naturesaura:items/birth_spirit"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 681 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 681 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 649 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 678 B