made all recipes JSON

This commit is contained in:
Ellpeck 2020-04-29 16:38:50 +02:00
parent b69c3d1452
commit 253fb64cac
145 changed files with 2351 additions and 961 deletions

View file

@ -1,69 +0,0 @@
# Editing Nature's Aura recipes with CraftTweaker
Note that [CraftTweaker](https://minecraft.curseforge.com/projects/crafttweaker) is required for this compatibility.
***This documentation is for 1.15. For the 1.12 documentation, [click here](https://github.com/Ellpeck/NaturesAura/blob/1.12/CraftTweakerCompat.md).***
A few notes that apply for most of the recipe types:
- If you don't know how the CraftTweaker syntax works, [read up on it](https://docs.blamejared.com/en/#Getting_Started/) first.
- `name` is the name of a recipe. Read on for more information about this.
- `aura` is the amount of Aura required and represents the total amount required for the completion of the recipe (for reference, 1,000,000 is the default amount of Aura present in the world and 2,000,000 is the amount that is required for the Environmental Eye's bar to fill up fully)
- `time` is the time processes take in ticks
- For most removal recipes, `output` is the output of the recipe that should be removed. All recipes with the given outupt will be removed.
## On the Importance of Recipe Names
When replacing an existing recipe with a new one, the `name` variable of the recipe matters greatly, both for Nature's Aura's custom recipe types and for [vanilla crafting recipes](https://crafttweaker.readthedocs.io/en/latest/#Vanilla/Recipes/Crafting/Recipes_Crafting_Table/), if the replacement recipe should be displayed correctly in the Book of Natural Aura in place of the original recipe.
__The replacement recipe that is added for any given item inside of Nature's Aura needs to be named after the item id of the item that is being crafted.__
As an example, the following piece of code will remove the existing recipe of the Imperceptible Builder and replace it with a new one. Checking its Book of Natural Aura entry will then also display the new recipe correctly without errors.
```
recipes.remove(<item:naturesaura:placer>);
recipes.addShapeless("placer", <item:naturesaura:placer>, [<item:naturesaura:infused_iron>, <item:minecraft:piston>]);
```
Note that the name of the recipe is supplied as `placer` because the item id of the Imperceptible Builder is `naturesaura:placer`. Not doing this would lead to the Book of Natural Aura not displaying the new recipe.
_When adding a new recipe without replacing an existing one, the name of the newly added recipe does not matter._
## Natural Altar
```zs
mods.naturesaura.Altar.addRecipe(String name, IIngredient input, IItemStack output, String auraType, int aura, int time, IIngredient catalyst)
```
- `auraType` is the type of aura required for this recipe. For the regular Natural Altar, use `naturesaura:overworld`. For the nether variant of the altar, use `naturesaura:nether`.
- `catalyst` is the catalyst block that is placed on one of the four corner blocks, can be `null`
```zs
mods.naturesaura.Altar.removeRecipe(IItemStack output)
```
## Altar of Birthing
```zs
mods.naturesaura.AnimalSpawner.addRecipe(String name, String entity, int aura, int time, IIngredient[] ingredients)
```
- `entity` is the registry name of the entity that you want to spawn
```zs
mods.naturesaura.AnimalSpawner.removeRecipe(String name)
```
- `entity` is the registry name of the entity whose spawning recipe should be removed
## Offering to the Gods
```zs
mods.naturesaura.Offering.addRecipe(String name, IIngredient input, int inputAmount, IIngredient startItem, IItemStack output)
```
- `inputAmount` is the amount of items required for the input. Note that this means that the amount of the `input` variable is ignored
- `startItem` is the item required to start the offering, should pretty much always be `naturesaura:calling_spirit`
```zs
mods.naturesaura.Offering.removeRecipe(IItemStack output)
```
## Ritual of the Forest
```zs
mods.naturesaura.TreeRitual.addRecipe(String name, IIngredient saplingType, IItemStack result, int time, IIngredient[] items)
```
- `saplingType` is an item representation of the sapling that needs to be placed and grown into a tree
- `items` are the items that need to be placed on the wooden stands
```zs
mods.naturesaura.TreeRitual.removeRecipe(IItemStack output)
```

View file

@ -98,7 +98,7 @@ repositories {
} }
dependencies { dependencies {
minecraft 'net.minecraftforge:forge:1.15.2-31.1.19' minecraft 'net.minecraftforge:forge:1.15.2-31.1.24'
compileOnly fg.deobf("mezz.jei:jei-1.15.2:6.0.0.2:api") compileOnly fg.deobf("mezz.jei:jei-1.15.2:6.0.0.2:api")
runtimeOnly fg.deobf("mezz.jei:jei-1.15.2:6.0.0.2") runtimeOnly fg.deobf("mezz.jei:jei-1.15.2:6.0.0.2")

View file

@ -3,7 +3,7 @@ package de.ellpeck.naturesaura;
import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.aura.type.BasicAuraType; import de.ellpeck.naturesaura.api.aura.type.BasicAuraType;
import de.ellpeck.naturesaura.api.aura.type.IAuraType; import de.ellpeck.naturesaura.api.aura.type.IAuraType;
import de.ellpeck.naturesaura.api.recipes.WeightedOre; import de.ellpeck.naturesaura.api.misc.WeightedOre;
import de.ellpeck.naturesaura.chunk.effect.OreSpawnEffect; import de.ellpeck.naturesaura.chunk.effect.OreSpawnEffect;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
@ -21,7 +21,6 @@ public final class ModConfig {
public static ModConfig instance; public static ModConfig instance;
public ForgeConfigSpec.ConfigValue<List<? extends String>> additionalBotanistPickaxeConversions; public ForgeConfigSpec.ConfigValue<List<? extends String>> additionalBotanistPickaxeConversions;
public ForgeConfigSpec.ConfigValue<List<? extends String>> additionalFlowers;
public ForgeConfigSpec.ConfigValue<List<? extends String>> auraTypeOverrides; public ForgeConfigSpec.ConfigValue<List<? extends String>> auraTypeOverrides;
public ForgeConfigSpec.ConfigValue<List<? extends String>> additionalOres; public ForgeConfigSpec.ConfigValue<List<? extends String>> additionalOres;
public ForgeConfigSpec.ConfigValue<List<? extends String>> oreExceptions; public ForgeConfigSpec.ConfigValue<List<? extends String>> oreExceptions;
@ -56,10 +55,6 @@ public final class ModConfig {
.comment("Additional conversion recipes for the Botanist's Pickaxe right click function. Each entry needs to be formatted as modid:input_block[prop1=value1,...]->modid:output_block[prop1=value1,...] where block state properties are optional") .comment("Additional conversion recipes for the Botanist's Pickaxe right click function. Each entry needs to be formatted as modid:input_block[prop1=value1,...]->modid:output_block[prop1=value1,...] where block state properties are optional")
.translation("config." + NaturesAura.MOD_ID + ".additionalBotanistPickaxeConversions") .translation("config." + NaturesAura.MOD_ID + ".additionalBotanistPickaxeConversions")
.defineList("additionalBotanistPickaxeConversions", Collections.emptyList(), s -> true); .defineList("additionalBotanistPickaxeConversions", Collections.emptyList(), s -> true);
this.additionalFlowers = builder
.comment("Additional blocks that several mechanics identify as flowers. Each entry needs to be formatted as modid:block[prop1=value1,...] where block state properties are optional")
.translation("config." + NaturesAura.MOD_ID + ".additionalFlowers")
.defineList("additionalFlowers", Collections.emptyList(), s -> true);
this.auraTypeOverrides = builder this.auraTypeOverrides = builder
.comment("Additional dimensions that map to Aura types that should be present in them. This is useful if you have a modpack with custom dimensions that should have Aura act similarly to an existing dimension in them. Each entry needs to be formatted as dimension_name->aura_type, where aura_type can be any of naturesaura:overworld, naturesaura:nether and naturesaura:end.") .comment("Additional dimensions that map to Aura types that should be present in them. This is useful if you have a modpack with custom dimensions that should have Aura act similarly to an existing dimension in them. Each entry needs to be formatted as dimension_name->aura_type, where aura_type can be any of naturesaura:overworld, naturesaura:nether and naturesaura:end.")
.translation("config." + NaturesAura.MOD_ID + ".auraTypeOverrides") .translation("config." + NaturesAura.MOD_ID + ".auraTypeOverrides")
@ -185,13 +180,6 @@ public final class ModConfig {
NaturesAura.LOGGER.warn("Error parsing additionalBotanistPickaxeConversions", e); NaturesAura.LOGGER.warn("Error parsing additionalBotanistPickaxeConversions", e);
} }
try {
for (String s : this.additionalFlowers.get())
NaturesAuraAPI.FLOWERS.add(Helper.getStateFromString(s));
} catch (Exception e) {
NaturesAura.LOGGER.warn("Error parsing additionalFlowers", e);
}
try { try {
for (String s : this.auraTypeOverrides.get()) { for (String s : this.auraTypeOverrides.get()) {
String[] split = s.split("->"); String[] split = s.split("->");
@ -206,8 +194,7 @@ public final class ModConfig {
try { try {
for (String s : this.additionalOres.get()) { for (String s : this.additionalOres.get()) {
String[] split = s.split(":"); String[] split = s.split(":");
Tag<Block> tag = BlockTags.getCollection().get(new ResourceLocation(split[0])); WeightedOre ore = new WeightedOre(new ResourceLocation(split[0]), Integer.parseInt(split[1]));
WeightedOre ore = new WeightedOre(tag, Integer.parseInt(split[1]));
String dimension = split[2]; String dimension = split[2];
if ("nether".equalsIgnoreCase(dimension)) if ("nether".equalsIgnoreCase(dimension))
NaturesAuraAPI.NETHER_ORES.add(ore); NaturesAuraAPI.NETHER_ORES.add(ore);

View file

@ -9,11 +9,10 @@ import de.ellpeck.naturesaura.api.aura.item.IAuraRecharge;
import de.ellpeck.naturesaura.api.aura.type.BasicAuraType; import de.ellpeck.naturesaura.api.aura.type.BasicAuraType;
import de.ellpeck.naturesaura.api.aura.type.IAuraType; import de.ellpeck.naturesaura.api.aura.type.IAuraType;
import de.ellpeck.naturesaura.api.misc.IWorldData; import de.ellpeck.naturesaura.api.misc.IWorldData;
import de.ellpeck.naturesaura.api.misc.WeightedOre;
import de.ellpeck.naturesaura.api.multiblock.IMultiblock; import de.ellpeck.naturesaura.api.multiblock.IMultiblock;
import de.ellpeck.naturesaura.api.multiblock.Matcher; import de.ellpeck.naturesaura.api.multiblock.Matcher;
import de.ellpeck.naturesaura.api.recipes.*;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.FlowerBlock;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
@ -43,31 +42,6 @@ public final class NaturesAuraAPI {
public static final String MOD_ID = "naturesaura"; public static final String MOD_ID = "naturesaura";
public static final String API_ID = MOD_ID + "api"; public static final String API_ID = MOD_ID + "api";
public static final String VERSION = "9"; public static final String VERSION = "9";
/**
* The list of all {@link AltarRecipe} instances which are the recipes used
* by the Natural Altar. Newly created recipes can be easily added using
* {@link AltarRecipe#register()}.
*/
public static final Map<ResourceLocation, AltarRecipe> ALTAR_RECIPES = new HashMap<>();
/**
* The list of all {@link TreeRitualRecipe} instances which are the recipes
* used in the Ritual of the Forest. Newly created recipes can be easily
* added using {@link TreeRitualRecipe#register()}.
*/
public static final Map<ResourceLocation, TreeRitualRecipe> TREE_RITUAL_RECIPES = new HashMap<>();
/**
* The list of all {@link OfferingRecipe} instances which are the recipes
* used by the Offering Table. Newly created recipes can by easily added
* using {@link OfferingRecipe#register()}.
*/
public static final Map<ResourceLocation, OfferingRecipe> OFFERING_RECIPES = new HashMap<>();
/**
* The list of all types of blocks that several mechanics in the mod use as
* flowers. Right now, this includes the Herbivorous Absorber and the
* Offering Table. By default, all {@link FlowerBlock} instances and all
* blocks specified in the config file are added
*/
public static final List<BlockState> FLOWERS = new ArrayList<>();
/** /**
* A map of all of the block states that the Botanist's Pickaxe can convert * A map of all of the block states that the Botanist's Pickaxe can convert
* into their mossy variations. Contains mossy brick and mossy cobblestone * into their mossy variations. Contains mossy brick and mossy cobblestone
@ -106,12 +80,6 @@ public final class NaturesAuraAPI {
* using the multiblock maker debug tool. * using the multiblock maker debug tool.
*/ */
public static final Map<ResourceLocation, IMultiblock> MULTIBLOCKS = new HashMap<>(); public static final Map<ResourceLocation, IMultiblock> MULTIBLOCKS = new HashMap<>();
/**
* A map of all {@link AnimalSpawnerRecipe} objects that are used with the
* animal spawner block. To register a recipe, use {@link
* AnimalSpawnerRecipe#register()}.
*/
public static final Map<ResourceLocation, AnimalSpawnerRecipe> ANIMAL_SPAWNER_RECIPES = new HashMap<>();
/** /**
* A list of all {@link WeightedOre} objects that represent ores that can * A list of all {@link WeightedOre} objects that represent ores that can
* spawn inside of stone blocks in the overworld * spawn inside of stone blocks in the overworld

View file

@ -0,0 +1,14 @@
package de.ellpeck.naturesaura.api.misc;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.WeightedRandom;
public class WeightedOre extends WeightedRandom.Item {
public final ResourceLocation tag;
public WeightedOre(ResourceLocation tag, int weight) {
super(weight);
this.tag = tag;
}
}

View file

@ -3,13 +3,14 @@ package de.ellpeck.naturesaura.api.multiblock;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorld; import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import java.util.Map; import java.util.Map;
import java.util.function.BiFunction; import java.util.function.BiFunction;
public interface IMultiblock { public interface IMultiblock {
boolean isComplete(IWorld world, BlockPos center); boolean isComplete(World world, BlockPos center);
boolean forEach(BlockPos center, char c, BiFunction<BlockPos, Matcher, Boolean> function); boolean forEach(BlockPos center, char c, BiFunction<BlockPos, Matcher, Boolean> function);

View file

@ -6,6 +6,7 @@ import net.minecraft.block.Blocks;
import net.minecraft.tags.Tag; import net.minecraft.tags.Tag;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorld; import net.minecraft.world.IWorld;
import net.minecraft.world.World;
public class Matcher { public class Matcher {
@ -34,6 +35,6 @@ public class Matcher {
} }
public interface ICheck { public interface ICheck {
boolean matches(IWorld world, BlockPos start, BlockPos offset, BlockPos pos, BlockState state, char c); boolean matches(World world, BlockPos start, BlockPos offset, BlockPos pos, BlockState state, char c);
} }
} }

View file

@ -1,33 +0,0 @@
package de.ellpeck.naturesaura.api.recipes;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.ResourceLocation;
public class AltarRecipe {
public final ResourceLocation name;
public final Ingredient input;
public final ItemStack output;
public final IAuraType requiredType;
public final Ingredient catalyst;
public final int aura;
public final int time;
public AltarRecipe(ResourceLocation name, Ingredient input, ItemStack output, IAuraType requiredType, Ingredient catalyst, int aura, int time) {
this.name = name;
this.input = input;
this.output = output;
this.requiredType = requiredType;
this.catalyst = catalyst;
this.aura = aura;
this.time = time;
}
public AltarRecipe register() {
NaturesAuraAPI.ALTAR_RECIPES.put(this.name, this);
return this;
}
}

View file

@ -1,47 +0,0 @@
package de.ellpeck.naturesaura.api.recipes;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.MobEntity;
import net.minecraft.entity.SpawnReason;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
public class AnimalSpawnerRecipe {
public final ResourceLocation name;
public final Ingredient[] ingredients;
public final EntityType entity;
public final int aura;
public final int time;
public AnimalSpawnerRecipe(ResourceLocation name, EntityType entity, int aura, int time, Ingredient... ingredients) {
this.name = name;
this.ingredients = ingredients;
this.entity = entity;
this.aura = aura;
this.time = time;
}
public Entity makeEntity(World world, double x, double y, double z) {
Entity entity = this.entity.create(world);
if (x == 0 && y == 0 && z == 0)
return entity;
entity.setLocationAndAngles(x, y, z, MathHelper.wrapDegrees(world.rand.nextFloat() * 360F), 0F);
if (entity instanceof MobEntity) {
MobEntity living = (MobEntity) entity;
living.rotationYawHead = entity.rotationYaw;
living.renderYawOffset = entity.rotationYaw;
living.onInitialSpawn(world, world.getDifficultyForLocation(living.getPosition()), SpawnReason.SPAWNER, null, null);
}
return entity;
}
public AnimalSpawnerRecipe register() {
NaturesAuraAPI.ANIMAL_SPAWNER_RECIPES.put(this.name, this);
return this;
}
}

View file

@ -1,26 +0,0 @@
package de.ellpeck.naturesaura.api.recipes;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.ResourceLocation;
public class OfferingRecipe {
public final ResourceLocation name;
public final Ingredient input;
public final Ingredient startItem;
public final ItemStack output;
public OfferingRecipe(ResourceLocation name, Ingredient input, Ingredient startItem, ItemStack output) {
this.name = name;
this.input = input;
this.startItem = startItem;
this.output = output;
}
public OfferingRecipe register() {
NaturesAuraAPI.OFFERING_RECIPES.put(this.name, this);
return this;
}
}

View file

@ -1,28 +0,0 @@
package de.ellpeck.naturesaura.api.recipes;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.ResourceLocation;
public class TreeRitualRecipe {
public final ResourceLocation name;
public final Ingredient saplingType;
public final Ingredient[] ingredients;
public final ItemStack result;
public final int time;
public TreeRitualRecipe(ResourceLocation name, Ingredient saplingType, ItemStack result, int time, Ingredient... ingredients) {
this.name = name;
this.saplingType = saplingType;
this.ingredients = ingredients;
this.result = result;
this.time = time;
}
public TreeRitualRecipe register() {
NaturesAuraAPI.TREE_RITUAL_RECIPES.put(this.name, this);
return this;
}
}

View file

@ -1,15 +0,0 @@
package de.ellpeck.naturesaura.api.recipes;
import net.minecraft.block.Block;
import net.minecraft.tags.Tag;
import net.minecraft.util.WeightedRandom;
public class WeightedOre extends WeightedRandom.Item {
public final Tag<Block> tag;
public WeightedOre(Tag<Block> tag, int weight) {
super(weight);
this.tag = tag;
}
}

View file

@ -1,55 +0,0 @@
package de.ellpeck.naturesaura.api.recipes.ing;
import it.unimi.dsi.fastutil.ints.IntList;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
import java.util.stream.Stream;
public class AmountIngredient extends Ingredient {
public final Ingredient delegate;
public final int amount;
private ItemStack[] matchingStacks;
public AmountIngredient(Ingredient delegate, int amount) {
super(Stream.empty());
this.delegate = delegate;
this.amount = amount;
}
public AmountIngredient(ItemStack stack) {
this(Ingredient.fromStacks(stack), stack.getCount());
}
@Override
public ItemStack[] getMatchingStacks() {
if (this.matchingStacks == null) {
ItemStack[] delegate = this.delegate.getMatchingStacks();
this.matchingStacks = new ItemStack[delegate.length];
for (int i = 0; i < delegate.length; i++) {
ItemStack copy = delegate[i].copy();
copy.setCount(this.amount);
this.matchingStacks[i] = copy;
}
}
return this.matchingStacks;
}
@Override
public boolean test(ItemStack stack) {
if (!this.delegate.test(stack))
return false;
return stack.getCount() >= this.amount;
}
@Override
public IntList getValidItemStacksPacked() {
return this.delegate.getValidItemStacksPacked();
}
@Override
public boolean isSimple() {
return this.delegate.isSimple();
}
}

View file

@ -1,9 +0,0 @@
package de.ellpeck.naturesaura.api.recipes.ing;
import net.minecraft.item.ItemStack;
public class NBTIngredient extends net.minecraftforge.common.crafting.NBTIngredient {
public NBTIngredient(ItemStack stack) {
super(stack);
}
}

View file

@ -2,7 +2,9 @@ package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.Helper; import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.recipes.TreeRitualRecipe; import de.ellpeck.naturesaura.recipes.ModRecipe;
import de.ellpeck.naturesaura.recipes.ModRecipes;
import de.ellpeck.naturesaura.recipes.TreeRitualRecipe;
import de.ellpeck.naturesaura.blocks.multi.Multiblocks; import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityWoodStand; import de.ellpeck.naturesaura.blocks.tiles.TileEntityWoodStand;
@ -67,11 +69,11 @@ public class BlockWoodStand extends BlockContainerImpl implements ITESRProvider<
IWorld world = event.getWorld(); IWorld world = event.getWorld();
BlockPos pos = event.getPos(); BlockPos pos = event.getPos();
if (!world.isRemote()) { if (!world.isRemote()) {
if (Multiblocks.TREE_RITUAL.isComplete(world, pos)) { if (Multiblocks.TREE_RITUAL.isComplete((World) world, pos)) {
BlockState sapling = world.getBlockState(pos); BlockState sapling = world.getBlockState(pos);
ItemStack saplingStack = sapling.getBlock().getItem(world, pos, sapling); ItemStack saplingStack = sapling.getBlock().getItem(world, pos, sapling);
if (!saplingStack.isEmpty()) { if (!saplingStack.isEmpty()) {
for (TreeRitualRecipe recipe : NaturesAuraAPI.TREE_RITUAL_RECIPES.values()) { for (TreeRitualRecipe recipe : ((World) world).getRecipeManager().getRecipes(ModRecipes.TREE_RITUAL_TYPE, null, null)) {
if (recipe.saplingType.test(saplingStack)) { if (recipe.saplingType.test(saplingStack)) {
List<Ingredient> required = new ArrayList<>(Arrays.asList(recipe.ingredients)); List<Ingredient> required = new ArrayList<>(Arrays.asList(recipe.ingredients));
MutableObject<TileEntityWoodStand> toPick = new MutableObject<>(); MutableObject<TileEntityWoodStand> toPick = new MutableObject<>();

View file

@ -9,6 +9,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorld; import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -107,7 +108,7 @@ public class Multiblock implements IMultiblock {
} }
@Override @Override
public boolean isComplete(IWorld world, BlockPos center) { public boolean isComplete(World world, BlockPos center) {
BlockPos start = this.getStart(center); BlockPos start = this.getStart(center);
return this.forEach(center, (char) 0, (pos, matcher) -> { return this.forEach(center, (char) 0, (pos, matcher) -> {
BlockPos offset = pos.subtract(start); BlockPos offset = pos.subtract(start);

View file

@ -7,6 +7,7 @@ import de.ellpeck.naturesaura.api.multiblock.IMultiblock;
import de.ellpeck.naturesaura.api.multiblock.Matcher; import de.ellpeck.naturesaura.api.multiblock.Matcher;
import de.ellpeck.naturesaura.blocks.BlockNatureAltar; import de.ellpeck.naturesaura.blocks.BlockNatureAltar;
import de.ellpeck.naturesaura.blocks.ModBlocks; import de.ellpeck.naturesaura.blocks.ModBlocks;
import de.ellpeck.naturesaura.recipes.ModRecipes;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.block.LogBlock; import net.minecraft.block.LogBlock;
import net.minecraft.block.SaplingBlock; import net.minecraft.block.SaplingBlock;
@ -53,7 +54,7 @@ public final class Multiblocks {
// try-catch to prevent blocks that need to have been placed crashing here // try-catch to prevent blocks that need to have been placed crashing here
try { try {
ItemStack stack = state.getBlock().getItem(world, pos, state); ItemStack stack = state.getBlock().getItem(world, pos, state);
return !stack.isEmpty() && NaturesAuraAPI.TREE_RITUAL_RECIPES.values().stream().anyMatch(recipe -> recipe.saplingType.test(stack)); return !stack.isEmpty() && world.getRecipeManager().getRecipes(ModRecipes.TREE_RITUAL_TYPE, null, null).stream().anyMatch(r -> r.saplingType.test(stack));
} catch (Exception e) { } catch (Exception e) {
return false; return false;
} }
@ -76,7 +77,7 @@ public final class Multiblocks {
new String[][]{ new String[][]{
{" RRRRR ", " R R ", "R RRR R", "R R R R", "R R 0 R R", "R R R R", "R RRR R", " R R ", " RRRRR "}}, {" RRRRR ", " R R ", "R RRR R", "R R R R", "R R 0 R R", "R R R R", "R RRR R", " R R ", " RRRRR "}},
'R', new Matcher(Blocks.POPPY.getDefaultState(), 'R', new Matcher(Blocks.POPPY.getDefaultState(),
(world, start, offset, pos, state, c) -> NaturesAuraAPI.FLOWERS.contains(state)), (world, start, offset, pos, state, c) -> BlockTags.SMALL_FLOWERS.contains(state.getBlock())),
'0', ModBlocks.OFFERING_TABLE, '0', ModBlocks.OFFERING_TABLE,
' ', Matcher.wildcard()); ' ', Matcher.wildcard());
public static final IMultiblock ANIMAL_SPAWNER = NaturesAuraAPI.instance().createMultiblock( public static final IMultiblock ANIMAL_SPAWNER = NaturesAuraAPI.instance().createMultiblock(

View file

@ -4,10 +4,11 @@ import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
import de.ellpeck.naturesaura.api.aura.type.IAuraType; import de.ellpeck.naturesaura.api.aura.type.IAuraType;
import de.ellpeck.naturesaura.api.recipes.AnimalSpawnerRecipe; import de.ellpeck.naturesaura.recipes.AnimalSpawnerRecipe;
import de.ellpeck.naturesaura.blocks.multi.Multiblocks; 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 de.ellpeck.naturesaura.recipes.ModRecipes;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.item.ItemEntity; import net.minecraft.entity.item.ItemEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -67,7 +68,7 @@ public class TileEntityAnimalSpawner extends TileEntityImpl implements ITickable
List<ItemEntity> items = this.world.getEntitiesWithinAABB(ItemEntity.class, List<ItemEntity> items = this.world.getEntitiesWithinAABB(ItemEntity.class,
new AxisAlignedBB(this.pos).grow(2)); new AxisAlignedBB(this.pos).grow(2));
for (AnimalSpawnerRecipe recipe : NaturesAuraAPI.ANIMAL_SPAWNER_RECIPES.values()) { for (AnimalSpawnerRecipe recipe : this.world.getRecipeManager().getRecipes(ModRecipes.ANIMAL_SPAWNER_TYPE, null, null)) {
if (recipe.ingredients.length != items.size()) if (recipe.ingredients.length != items.size())
continue; continue;
List<Ingredient> required = new ArrayList<>(Arrays.asList(recipe.ingredients)); List<Ingredient> required = new ArrayList<>(Arrays.asList(recipe.ingredients));
@ -150,8 +151,10 @@ public class TileEntityAnimalSpawner extends TileEntityImpl implements ITickable
super.readNBT(compound, type); super.readNBT(compound, type);
if (type != SaveType.BLOCK) { if (type != SaveType.BLOCK) {
if (compound.contains("recipe")) { if (compound.contains("recipe")) {
if (this.hasWorld()) {
ResourceLocation name = new ResourceLocation(compound.getString("recipe")); ResourceLocation name = new ResourceLocation(compound.getString("recipe"));
this.currentRecipe = NaturesAuraAPI.ANIMAL_SPAWNER_RECIPES.get(name); this.currentRecipe = (AnimalSpawnerRecipe) this.world.getRecipeManager().getRecipe(name).orElse(null);
}
this.spawnX = compound.getDouble("spawn_x"); this.spawnX = compound.getDouble("spawn_x");
this.spawnZ = compound.getDouble("spawn_z"); this.spawnZ = compound.getDouble("spawn_z");
this.time = compound.getInt("time"); this.time = compound.getInt("time");

View file

@ -12,6 +12,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.INBT; import net.minecraft.nbt.INBT;
import net.minecraft.nbt.ListNBT; import net.minecraft.nbt.ListNBT;
import net.minecraft.tags.BlockTags;
import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@ -41,12 +42,11 @@ public class TileEntityFlowerGenerator extends TileEntityImpl implements ITickab
for (int z = -range; z <= range; z++) { for (int z = -range; z <= range; z++) {
BlockPos offset = this.pos.add(x, y, z); BlockPos offset = this.pos.add(x, y, z);
BlockState state = this.world.getBlockState(offset); BlockState state = this.world.getBlockState(offset);
if (NaturesAuraAPI.FLOWERS.contains(state)) { if (BlockTags.SMALL_FLOWERS.contains(state.getBlock()))
possible.add(offset); possible.add(offset);
} }
} }
} }
}
if (possible.isEmpty()) if (possible.isEmpty())
return; return;

View file

@ -5,11 +5,12 @@ import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
import de.ellpeck.naturesaura.api.aura.container.BasicAuraContainer; import de.ellpeck.naturesaura.api.aura.container.BasicAuraContainer;
import de.ellpeck.naturesaura.api.aura.container.IAuraContainer; import de.ellpeck.naturesaura.api.aura.container.IAuraContainer;
import de.ellpeck.naturesaura.api.aura.type.IAuraType; import de.ellpeck.naturesaura.api.aura.type.IAuraType;
import de.ellpeck.naturesaura.api.recipes.AltarRecipe; import de.ellpeck.naturesaura.recipes.AltarRecipe;
import de.ellpeck.naturesaura.blocks.multi.Multiblocks; import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketHandler;
import de.ellpeck.naturesaura.packet.PacketParticleStream; import de.ellpeck.naturesaura.packet.PacketParticleStream;
import de.ellpeck.naturesaura.packet.PacketParticles; import de.ellpeck.naturesaura.packet.PacketParticles;
import de.ellpeck.naturesaura.recipes.ModRecipes;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient; import net.minecraft.item.crafting.Ingredient;
@ -203,7 +204,7 @@ public class TileEntityNatureAltar extends TileEntityImpl implements ITickableTi
private AltarRecipe getRecipeForInput(ItemStack input) { private AltarRecipe getRecipeForInput(ItemStack input) {
IAuraType type = IAuraType.forWorld(this.world); IAuraType type = IAuraType.forWorld(this.world);
for (AltarRecipe recipe : NaturesAuraAPI.ALTAR_RECIPES.values()) { for (AltarRecipe recipe : this.world.getRecipeManager().getRecipes(ModRecipes.ALTAR_TYPE, null, null)) {
if (recipe.input.test(input) && (recipe.requiredType == null || type.isSimilar(recipe.requiredType))) { if (recipe.input.test(input) && (recipe.requiredType == null || type.isSimilar(recipe.requiredType))) {
if (recipe.catalyst == Ingredient.EMPTY) if (recipe.catalyst == Ingredient.EMPTY)
return recipe; return recipe;
@ -250,7 +251,8 @@ public class TileEntityNatureAltar extends TileEntityImpl implements ITickableTi
} }
if (type == SaveType.TILE) { if (type == SaveType.TILE) {
if (compound.contains("recipe")) { if (compound.contains("recipe")) {
this.currentRecipe = NaturesAuraAPI.ALTAR_RECIPES.get(new ResourceLocation(compound.getString("recipe"))); if (this.hasWorld())
this.currentRecipe = (AltarRecipe) this.world.getRecipeManager().getRecipe(new ResourceLocation(compound.getString("recipe"))).orElse(null);
this.timer = compound.getInt("timer"); this.timer = compound.getInt("timer");
} }
} }

View file

@ -2,7 +2,8 @@ package de.ellpeck.naturesaura.blocks.tiles;
import de.ellpeck.naturesaura.Helper; import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.recipes.OfferingRecipe; import de.ellpeck.naturesaura.recipes.ModRecipes;
import de.ellpeck.naturesaura.recipes.OfferingRecipe;
import de.ellpeck.naturesaura.blocks.multi.Multiblocks; 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;
@ -15,6 +16,7 @@ import net.minecraft.nbt.ListNBT;
import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld; import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.ItemStackHandler; import net.minecraftforge.items.ItemStackHandler;
@ -36,8 +38,8 @@ public class TileEntityOfferingTable extends TileEntityImpl implements ITickable
super(ModTileEntities.OFFERING_TABLE); super(ModTileEntities.OFFERING_TABLE);
} }
private static OfferingRecipe getRecipe(ItemStack input) { private OfferingRecipe getRecipe(ItemStack input) {
for (OfferingRecipe recipe : NaturesAuraAPI.OFFERING_RECIPES.values()) for (OfferingRecipe recipe : this.world.getRecipeManager().getRecipes(ModRecipes.OFFERING_TYPE, null, null))
if (recipe.input.test(input)) if (recipe.input.test(input))
return recipe; return recipe;
return null; return null;
@ -58,7 +60,7 @@ public class TileEntityOfferingTable extends TileEntityImpl implements ITickable
if (items.isEmpty()) if (items.isEmpty())
return; return;
OfferingRecipe recipe = getRecipe(stack); OfferingRecipe recipe = this.getRecipe(stack);
if (recipe == null) if (recipe == null)
return; return;

View file

@ -1,7 +1,7 @@
package de.ellpeck.naturesaura.blocks.tiles; package de.ellpeck.naturesaura.blocks.tiles;
import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.recipes.TreeRitualRecipe; import de.ellpeck.naturesaura.recipes.TreeRitualRecipe;
import de.ellpeck.naturesaura.blocks.multi.Multiblocks; import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketHandler;
import de.ellpeck.naturesaura.packet.PacketParticleStream; import de.ellpeck.naturesaura.packet.PacketParticleStream;
@ -208,7 +208,8 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickableTile
if (compound.contains("recipe")) { if (compound.contains("recipe")) {
this.ritualPos = BlockPos.fromLong(compound.getLong("ritual_pos")); this.ritualPos = BlockPos.fromLong(compound.getLong("ritual_pos"));
this.timer = compound.getInt("timer"); this.timer = compound.getInt("timer");
this.recipe = NaturesAuraAPI.TREE_RITUAL_RECIPES.get(new ResourceLocation(compound.getString("recipe"))); if (this.hasWorld())
this.recipe = (TreeRitualRecipe) this.world.getRecipeManager().getRecipe(new ResourceLocation(compound.getString("recipe"))).orElse(null);
} }
} }
} }

View file

@ -6,7 +6,7 @@ import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
import de.ellpeck.naturesaura.api.aura.chunk.IDrainSpotEffect; import de.ellpeck.naturesaura.api.aura.chunk.IDrainSpotEffect;
import de.ellpeck.naturesaura.api.aura.type.IAuraType; import de.ellpeck.naturesaura.api.aura.type.IAuraType;
import de.ellpeck.naturesaura.api.recipes.WeightedOre; import de.ellpeck.naturesaura.api.misc.WeightedOre;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
@ -14,6 +14,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext; import net.minecraft.item.ItemUseContext;
import net.minecraft.tags.Tag;
import net.minecraft.util.*; import net.minecraft.util.*;
import net.minecraft.util.math.*; import net.minecraft.util.math.*;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -102,7 +103,10 @@ public class OreSpawnEffect implements IDrainSpotEffect {
outer: outer:
while (true) { while (true) {
WeightedOre ore = WeightedRandom.getRandomItem(world.rand, ores, totalWeight); WeightedOre ore = WeightedRandom.getRandomItem(world.rand, ores, totalWeight);
for (Block toPlace : ore.tag.getAllElements()) { Tag<Block> tag = world.getTags().getBlocks().get(ore.tag);
if (tag == null)
continue;
for (Block toPlace : tag.getAllElements()) {
if (toPlace == null || toPlace == Blocks.AIR) if (toPlace == null || toPlace == Blocks.AIR)
continue; continue;

View file

@ -1,30 +0,0 @@
package de.ellpeck.naturesaura.compat.crafttweaker;
import com.blamejared.crafttweaker.api.actions.IAction;
import com.blamejared.crafttweaker.api.actions.IRuntimeAction;
import net.minecraft.util.ResourceLocation;
import java.util.Map;
public class AddAction<T> implements IRuntimeAction {
private final Map<ResourceLocation, T> registry;
private final ResourceLocation res;
private final T recipe;
public AddAction(Map<ResourceLocation, T> registry, ResourceLocation res, T recipe) {
this.registry = registry;
this.res = res;
this.recipe = recipe;
}
@Override
public void apply() {
this.registry.put(this.res, this.recipe);
}
@Override
public String describe() {
return "Adding recipe " + this.res;
}
}

View file

@ -1,40 +0,0 @@
package de.ellpeck.naturesaura.compat.crafttweaker;
import com.blamejared.crafttweaker.api.CraftTweakerAPI;
import com.blamejared.crafttweaker.api.annotations.ZenRegister;
import com.blamejared.crafttweaker.api.item.IIngredient;
import com.blamejared.crafttweaker.api.item.IItemStack;
import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.recipes.AltarRecipe;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.ResourceLocation;
import org.openzen.zencode.java.ZenCodeType;
import java.util.*;
@ZenRegister
@ZenCodeType.Name("mods." + NaturesAura.MOD_ID + ".Altar")
public final class AltarTweaker {
@ZenCodeType.Method
public static void addRecipe(String name, IIngredient input, IItemStack output, String auraType, int aura, int time, @ZenCodeType.Optional IIngredient catalyst) {
ResourceLocation res = new ResourceLocation("crafttweaker", name);
CraftTweakerAPI.apply(new AddAction<>(NaturesAuraAPI.ALTAR_RECIPES, res, new AltarRecipe(res,
input.asVanillaIngredient(),
output.getInternal(),
NaturesAuraAPI.AURA_TYPES.get(new ResourceLocation(auraType)),
catalyst == null ? Ingredient.EMPTY : catalyst.asVanillaIngredient(),
aura, time)));
}
@ZenCodeType.Method
public static void removeRecipe(IItemStack output) {
List<ResourceLocation> recipes = new ArrayList<>();
for (AltarRecipe recipe : NaturesAuraAPI.ALTAR_RECIPES.values())
if (Helper.areItemsEqual(recipe.output, output.getInternal(), true))
recipes.add(recipe.name);
CraftTweakerAPI.apply(new RemoveAction(NaturesAuraAPI.ALTAR_RECIPES, recipes));
}
}

View file

@ -1,35 +0,0 @@
package de.ellpeck.naturesaura.compat.crafttweaker;
import com.blamejared.crafttweaker.api.CraftTweakerAPI;
import com.blamejared.crafttweaker.api.annotations.ZenRegister;
import com.blamejared.crafttweaker.api.item.IIngredient;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.recipes.AnimalSpawnerRecipe;
import de.ellpeck.naturesaura.compat.Compat;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.registries.ForgeRegistries;
import org.openzen.zencode.java.ZenCodeType;
import java.util.Arrays;
import java.util.Collections;
import java.util.Map;
@ZenRegister
@ZenCodeType.Name("mods." + NaturesAura.MOD_ID + ".AnimalSpawner")
public final class AnimalSpawnerTweaker {
@ZenCodeType.Method
public static void addRecipe(String name, String entity, int aura, int time, IIngredient[] ingredients) {
ResourceLocation res = new ResourceLocation("crafttweaker", name);
CraftTweakerAPI.apply(new AddAction<>(NaturesAuraAPI.ANIMAL_SPAWNER_RECIPES, res, new AnimalSpawnerRecipe(res,
ForgeRegistries.ENTITIES.getValue(new ResourceLocation(entity)), aura, time,
Arrays.stream(ingredients).map(IIngredient::asVanillaIngredient).toArray(Ingredient[]::new))));
}
@ZenCodeType.Method
public static void removeRecipe(String name) {
CraftTweakerAPI.apply(new RemoveAction(NaturesAuraAPI.ANIMAL_SPAWNER_RECIPES, Collections.singletonList(new ResourceLocation(name))));
}
}

View file

@ -1,39 +0,0 @@
package de.ellpeck.naturesaura.compat.crafttweaker;
import com.blamejared.crafttweaker.api.CraftTweakerAPI;
import com.blamejared.crafttweaker.api.annotations.ZenRegister;
import com.blamejared.crafttweaker.api.item.IIngredient;
import com.blamejared.crafttweaker.api.item.IItemStack;
import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.recipes.OfferingRecipe;
import de.ellpeck.naturesaura.api.recipes.ing.AmountIngredient;
import de.ellpeck.naturesaura.compat.Compat;
import net.minecraft.util.ResourceLocation;
import org.openzen.zencode.java.ZenCodeType;
import java.util.*;
@ZenRegister
@ZenCodeType.Name("mods." + NaturesAura.MOD_ID + ".Offering")
public final class OfferingTweaker {
@ZenCodeType.Method
public static void addRecipe(String name, IIngredient input, int inputAmount, IIngredient startItem, IItemStack output) {
ResourceLocation res = new ResourceLocation("crafttweaker", name);
CraftTweakerAPI.apply(new AddAction<>(NaturesAuraAPI.OFFERING_RECIPES, res, new OfferingRecipe(res,
new AmountIngredient(input.asVanillaIngredient(), inputAmount),
startItem.asVanillaIngredient(),
output.getInternal())));
}
@ZenCodeType.Method
public static void removeRecipe(IItemStack output) {
List<ResourceLocation> recipes = new ArrayList<>();
for (OfferingRecipe recipe : NaturesAuraAPI.OFFERING_RECIPES.values())
if (Helper.areItemsEqual(recipe.output, output.getInternal(), true))
recipes.add(recipe.name);
CraftTweakerAPI.apply(new RemoveAction(NaturesAuraAPI.OFFERING_RECIPES, recipes));
}
}

View file

@ -1,31 +0,0 @@
package de.ellpeck.naturesaura.compat.crafttweaker;
import com.blamejared.crafttweaker.api.actions.IAction;
import com.blamejared.crafttweaker.api.actions.IRuntimeAction;
import net.minecraft.util.ResourceLocation;
import org.apache.commons.lang3.tuple.Pair;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
public class RemoveAction implements IRuntimeAction {
private final Map<ResourceLocation, ?> registry;
private final List<ResourceLocation> recipes;
public RemoveAction(Map<ResourceLocation, ?> registry, List<ResourceLocation> recipes) {
this.registry = registry;
this.recipes = recipes;
}
@Override
public void apply() {
for (ResourceLocation recipe : this.recipes)
this.registry.remove(recipe);
}
@Override
public String describe() {
return "Removing recipes " + this.recipes;
}
}

View file

@ -1,41 +0,0 @@
package de.ellpeck.naturesaura.compat.crafttweaker;
import com.blamejared.crafttweaker.api.CraftTweakerAPI;
import com.blamejared.crafttweaker.api.annotations.ZenRegister;
import com.blamejared.crafttweaker.api.item.IIngredient;
import com.blamejared.crafttweaker.api.item.IItemStack;
import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.recipes.TreeRitualRecipe;
import de.ellpeck.naturesaura.compat.Compat;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.ResourceLocation;
import org.openzen.zencode.java.ZenCodeType;
import java.util.*;
@ZenRegister
@ZenCodeType.Name("mods." + NaturesAura.MOD_ID + ".TreeRitual")
public final class TreeRitualTweaker {
@ZenCodeType.Method
public static void addRecipe(String name, IIngredient saplingType, IItemStack result, int time, IIngredient[] items) {
ResourceLocation res = new ResourceLocation("crafttweaker", name);
CraftTweakerAPI.apply(new AddAction<>(NaturesAuraAPI.TREE_RITUAL_RECIPES, res, new TreeRitualRecipe(res,
saplingType.asVanillaIngredient(),
result.getInternal(),
time,
Arrays.stream(items).map(IIngredient::asVanillaIngredient).toArray(Ingredient[]::new)
)));
}
@ZenCodeType.Method
public static void removeRecipe(IItemStack output) {
List<ResourceLocation> recipes = new ArrayList<>();
for (TreeRitualRecipe recipe : NaturesAuraAPI.TREE_RITUAL_RECIPES.values())
if (Helper.areItemsEqual(recipe.result, output.getInternal(), true))
recipes.add(recipe.name);
CraftTweakerAPI.apply(new RemoveAction(NaturesAuraAPI.TREE_RITUAL_RECIPES, recipes));
}
}

View file

@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.compat.jei;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.recipes.AltarRecipe; import de.ellpeck.naturesaura.recipes.AltarRecipe;
import de.ellpeck.naturesaura.blocks.ModBlocks; import de.ellpeck.naturesaura.blocks.ModBlocks;
import de.ellpeck.naturesaura.items.ItemAuraBottle; import de.ellpeck.naturesaura.items.ItemAuraBottle;
import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.items.ModItems;

View file

@ -4,7 +4,7 @@ import com.google.common.collect.ImmutableList;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.recipes.AnimalSpawnerRecipe; import de.ellpeck.naturesaura.recipes.AnimalSpawnerRecipe;
import mezz.jei.api.constants.VanillaTypes; import mezz.jei.api.constants.VanillaTypes;
import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.gui.drawable.IDrawable; import mezz.jei.api.gui.drawable.IDrawable;

View file

@ -7,6 +7,7 @@ import de.ellpeck.naturesaura.blocks.ModBlocks;
import de.ellpeck.naturesaura.items.ItemAuraBottle; import de.ellpeck.naturesaura.items.ItemAuraBottle;
import de.ellpeck.naturesaura.items.ItemEffectPowder; import de.ellpeck.naturesaura.items.ItemEffectPowder;
import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.items.ModItems;
import de.ellpeck.naturesaura.recipes.ModRecipes;
import mezz.jei.api.IModPlugin; import mezz.jei.api.IModPlugin;
import mezz.jei.api.JeiPlugin; import mezz.jei.api.JeiPlugin;
import mezz.jei.api.helpers.IGuiHelper; import mezz.jei.api.helpers.IGuiHelper;
@ -15,7 +16,9 @@ import mezz.jei.api.registration.IRecipeCatalystRegistration;
import mezz.jei.api.registration.IRecipeCategoryRegistration; import mezz.jei.api.registration.IRecipeCategoryRegistration;
import mezz.jei.api.registration.IRecipeRegistration; import mezz.jei.api.registration.IRecipeRegistration;
import mezz.jei.api.registration.ISubtypeRegistration; import mezz.jei.api.registration.ISubtypeRegistration;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.RecipeManager;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
@JeiPlugin @JeiPlugin
@ -68,9 +71,10 @@ public class JEINaturesAuraPlugin implements IModPlugin {
@Override @Override
public void registerRecipes(IRecipeRegistration registration) { public void registerRecipes(IRecipeRegistration registration) {
registration.addRecipes(NaturesAuraAPI.TREE_RITUAL_RECIPES.values(), TREE_RITUAL); RecipeManager manager = Minecraft.getInstance().world.getRecipeManager();
registration.addRecipes(NaturesAuraAPI.ALTAR_RECIPES.values(), ALTAR); registration.addRecipes(manager.getRecipes(ModRecipes.TREE_RITUAL_TYPE, null, null), TREE_RITUAL);
registration.addRecipes(NaturesAuraAPI.OFFERING_RECIPES.values(), OFFERING); registration.addRecipes(manager.getRecipes(ModRecipes.ALTAR_TYPE, null, null), ALTAR);
registration.addRecipes(NaturesAuraAPI.ANIMAL_SPAWNER_RECIPES.values(), SPAWNER); registration.addRecipes(manager.getRecipes(ModRecipes.OFFERING_TYPE, null, null), OFFERING);
registration.addRecipes(manager.getRecipes(ModRecipes.ANIMAL_SPAWNER_TYPE, null, null), SPAWNER);
} }
} }

View file

@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.compat.jei;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.recipes.OfferingRecipe; import de.ellpeck.naturesaura.recipes.OfferingRecipe;
import mezz.jei.api.constants.VanillaTypes; import mezz.jei.api.constants.VanillaTypes;
import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.gui.drawable.IDrawable; import mezz.jei.api.gui.drawable.IDrawable;

View file

@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.compat.jei;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.recipes.TreeRitualRecipe; import de.ellpeck.naturesaura.recipes.TreeRitualRecipe;
import mezz.jei.api.constants.VanillaTypes; import mezz.jei.api.constants.VanillaTypes;
import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.gui.drawable.IDrawable; import mezz.jei.api.gui.drawable.IDrawable;

View file

@ -8,12 +8,20 @@ import de.ellpeck.naturesaura.api.multiblock.Matcher;
import de.ellpeck.naturesaura.compat.ICompat; import de.ellpeck.naturesaura.compat.ICompat;
import de.ellpeck.naturesaura.data.ItemTagProvider; import de.ellpeck.naturesaura.data.ItemTagProvider;
import de.ellpeck.naturesaura.events.ClientEvents; import de.ellpeck.naturesaura.events.ClientEvents;
import de.ellpeck.naturesaura.recipes.ModRecipe;
import de.ellpeck.naturesaura.recipes.ModRecipes;
import de.ellpeck.naturesaura.renderers.SupporterFancyHandler; import de.ellpeck.naturesaura.renderers.SupporterFancyHandler;
import de.ellpeck.naturesaura.renderers.SupporterFancyHandler.FancyInfo; import de.ellpeck.naturesaura.renderers.SupporterFancyHandler.FancyInfo;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.AbstractGui; import net.minecraft.client.gui.AbstractGui;
import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.IRecipeType;
import net.minecraft.item.crafting.RecipeManager;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
@ -26,7 +34,9 @@ import vazkii.patchouli.api.PatchouliAPI;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.Month; import java.time.Month;
import java.util.Collections; import java.util.Collections;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
public class PatchouliCompat implements ICompat { public class PatchouliCompat implements ICompat {
@ -47,12 +57,11 @@ public class PatchouliCompat implements ICompat {
DeferredWorkQueue.runLater(() -> PatchouliAPI.instance.registerMultiblock(name, PatchouliAPI.instance.makeMultiblock(pattern, rawMatchers))); DeferredWorkQueue.runLater(() -> PatchouliAPI.instance.registerMultiblock(name, PatchouliAPI.instance.makeMultiblock(pattern, rawMatchers)));
} }
public static <T> T getRecipe(Map<ResourceLocation, T> recipes, String name) { public static <T extends IRecipe<?>> T getRecipe(String type, String name) {
RecipeManager manager = Minecraft.getInstance().world.getRecipeManager();
ResourceLocation res = new ResourceLocation(name); ResourceLocation res = new ResourceLocation(name);
T recipe = recipes.get(res); ResourceLocation pre = new ResourceLocation(res.getNamespace(), type + "/" + res.getPath());
if (recipe == null) return (T) manager.getRecipe(pre).orElse(null);
recipe = recipes.get(new ResourceLocation("crafttweaker", res.getPath()));
return recipe;
} }
@Override @Override

View file

@ -1,7 +1,7 @@
package de.ellpeck.naturesaura.compat.patchouli; package de.ellpeck.naturesaura.compat.patchouli;
import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.recipes.AltarRecipe; import de.ellpeck.naturesaura.recipes.AltarRecipe;
import de.ellpeck.naturesaura.items.ItemAuraBottle; import de.ellpeck.naturesaura.items.ItemAuraBottle;
import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.items.ModItems;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -16,7 +16,7 @@ public class ProcessorAltar implements IComponentProcessor {
@Override @Override
public void setup(IVariableProvider<String> provider) { public void setup(IVariableProvider<String> provider) {
this.recipe = PatchouliCompat.getRecipe(NaturesAuraAPI.ALTAR_RECIPES, provider.get("recipe")); this.recipe = PatchouliCompat.getRecipe("altar", provider.get("recipe"));
} }
@Override @Override

View file

@ -1,7 +1,7 @@
package de.ellpeck.naturesaura.compat.patchouli; package de.ellpeck.naturesaura.compat.patchouli;
import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.recipes.AnimalSpawnerRecipe; import de.ellpeck.naturesaura.recipes.AnimalSpawnerRecipe;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.SpawnEggItem; import net.minecraft.item.SpawnEggItem;
import vazkii.patchouli.api.IComponentProcessor; import vazkii.patchouli.api.IComponentProcessor;
@ -14,7 +14,7 @@ public class ProcessorAnimalSpawner implements IComponentProcessor {
@Override @Override
public void setup(IVariableProvider<String> provider) { public void setup(IVariableProvider<String> provider) {
this.recipe = PatchouliCompat.getRecipe(NaturesAuraAPI.ANIMAL_SPAWNER_RECIPES, provider.get("recipe")); this.recipe = PatchouliCompat.getRecipe("animal_spawner", provider.get("recipe"));
} }
@Override @Override

View file

@ -1,7 +1,7 @@
package de.ellpeck.naturesaura.compat.patchouli; package de.ellpeck.naturesaura.compat.patchouli;
import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.recipes.OfferingRecipe; import de.ellpeck.naturesaura.recipes.OfferingRecipe;
import vazkii.patchouli.api.IComponentProcessor; import vazkii.patchouli.api.IComponentProcessor;
import vazkii.patchouli.api.IVariableProvider; import vazkii.patchouli.api.IVariableProvider;
import vazkii.patchouli.api.PatchouliAPI; import vazkii.patchouli.api.PatchouliAPI;
@ -12,7 +12,7 @@ public class ProcessorOffering implements IComponentProcessor {
@Override @Override
public void setup(IVariableProvider<String> provider) { public void setup(IVariableProvider<String> provider) {
this.recipe = PatchouliCompat.getRecipe(NaturesAuraAPI.OFFERING_RECIPES, provider.get("recipe")); this.recipe = PatchouliCompat.getRecipe("offering", provider.get("recipe"));
} }
@Override @Override

View file

@ -1,7 +1,7 @@
package de.ellpeck.naturesaura.compat.patchouli; package de.ellpeck.naturesaura.compat.patchouli;
import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.recipes.TreeRitualRecipe; import de.ellpeck.naturesaura.recipes.TreeRitualRecipe;
import vazkii.patchouli.api.IComponentProcessor; import vazkii.patchouli.api.IComponentProcessor;
import vazkii.patchouli.api.IVariableProvider; import vazkii.patchouli.api.IVariableProvider;
import vazkii.patchouli.api.PatchouliAPI; import vazkii.patchouli.api.PatchouliAPI;
@ -12,7 +12,7 @@ public class ProcessorTreeRitual implements IComponentProcessor {
@Override @Override
public void setup(IVariableProvider<String> provider) { public void setup(IVariableProvider<String> provider) {
this.recipe = PatchouliCompat.getRecipe(NaturesAuraAPI.TREE_RITUAL_RECIPES, provider.get("recipe")); this.recipe = PatchouliCompat.getRecipe("tree_ritual", provider.get("recipe"));
} }
@Override @Override

View file

@ -136,9 +136,4 @@ public class CommonEvents {
public void onServerStarting(FMLServerStartingEvent event) { public void onServerStarting(FMLServerStartingEvent event) {
CommandAura.register(event.getCommandDispatcher()); CommandAura.register(event.getCommandDispatcher());
} }
@SubscribeEvent
public void onServerAboutToStart(FMLServerAboutToStartEvent event) {
event.getServer().getResourceManager().addReloadListener(new ModRecipes());
}
} }

View file

@ -45,9 +45,6 @@ public class ClientProxy implements IProxy {
Compat.setupClient(); Compat.setupClient();
ScreenManager.registerFactory(ModContainers.ENDER_CRATE, GuiEnderCrate::new); ScreenManager.registerFactory(ModContainers.ENDER_CRATE, GuiEnderCrate::new);
ScreenManager.registerFactory(ModContainers.ENDER_ACCESS, GuiEnderCrate::new); ScreenManager.registerFactory(ModContainers.ENDER_ACCESS, GuiEnderCrate::new);
IResourceManager manager = Minecraft.getInstance().getResourceManager();
((IReloadableResourceManager) manager).addReloadListener(new ModRecipes());
} }
@Override @Override

View file

@ -0,0 +1,89 @@
package de.ellpeck.naturesaura.recipes;
import com.google.gson.JsonObject;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
import net.minecraft.data.IFinishedRecipe;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraft.item.crafting.IRecipeType;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.crafting.CraftingHelper;
import net.minecraftforge.registries.ForgeRegistryEntry;
import javax.annotation.Nullable;
public class AltarRecipe extends ModRecipe {
public final Ingredient input;
public final ItemStack output;
public final IAuraType requiredType;
public final Ingredient catalyst;
public final int aura;
public final int time;
public AltarRecipe(ResourceLocation name, Ingredient input, ItemStack output, IAuraType requiredType, Ingredient catalyst, int aura, int time) {
super(name);
this.input = input;
this.output = output;
this.requiredType = requiredType;
this.catalyst = catalyst;
this.aura = aura;
this.time = time;
}
@Override
public ItemStack getRecipeOutput() {
return this.output;
}
@Override
public IRecipeSerializer<?> getSerializer() {
return ModRecipes.ALTAR_SERIAIZER;
}
@Override
public IRecipeType<?> getType() {
return ModRecipes.ALTAR_TYPE;
}
public static class Serializer extends ForgeRegistryEntry<IRecipeSerializer<?>> implements IRecipeSerializer<AltarRecipe> {
@Override
public AltarRecipe read(ResourceLocation recipeId, JsonObject json) {
return new AltarRecipe(
recipeId,
Ingredient.deserialize(json.getAsJsonObject("input")),
CraftingHelper.getItemStack(json.getAsJsonObject("output"), true),
NaturesAuraAPI.AURA_TYPES.get(new ResourceLocation(json.get("aura_type").getAsString())),
json.has("catalyst") ? Ingredient.deserialize(json.getAsJsonObject("catalyst")) : Ingredient.EMPTY,
json.get("aura").getAsInt(),
json.get("time").getAsInt());
}
@Nullable
@Override
public AltarRecipe read(ResourceLocation recipeId, PacketBuffer buffer) {
return new AltarRecipe(
recipeId,
Ingredient.read(buffer),
buffer.readItemStack(),
NaturesAuraAPI.AURA_TYPES.get(buffer.readResourceLocation()),
Ingredient.read(buffer),
buffer.readInt(),
buffer.readInt());
}
@Override
public void write(PacketBuffer buffer, AltarRecipe recipe) {
recipe.input.write(buffer);
buffer.writeItemStack(recipe.output);
buffer.writeResourceLocation(recipe.requiredType.getName());
recipe.catalyst.write(buffer);
buffer.writeInt(recipe.aura);
buffer.writeInt(recipe.time);
}
}
}

View file

@ -0,0 +1,106 @@
package de.ellpeck.naturesaura.recipes;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.MobEntity;
import net.minecraft.entity.SpawnReason;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraft.item.crafting.IRecipeType;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.ForgeRegistryEntry;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
public class AnimalSpawnerRecipe extends ModRecipe {
public final Ingredient[] ingredients;
public final EntityType<?> entity;
public final int aura;
public final int time;
public AnimalSpawnerRecipe(ResourceLocation name, EntityType<?> entity, int aura, int time, Ingredient... ingredients) {
super(name);
this.ingredients = ingredients;
this.entity = entity;
this.aura = aura;
this.time = time;
}
public Entity makeEntity(World world, double x, double y, double z) {
Entity entity = this.entity.create(world);
if (x == 0 && y == 0 && z == 0)
return entity;
entity.setLocationAndAngles(x, y, z, MathHelper.wrapDegrees(world.rand.nextFloat() * 360F), 0F);
if (entity instanceof MobEntity) {
MobEntity living = (MobEntity) entity;
living.rotationYawHead = entity.rotationYaw;
living.renderYawOffset = entity.rotationYaw;
living.onInitialSpawn(world, world.getDifficultyForLocation(living.getPosition()), SpawnReason.SPAWNER, null, null);
}
return entity;
}
@Override
public ItemStack getRecipeOutput() {
return ItemStack.EMPTY;
}
@Override
public IRecipeSerializer<?> getSerializer() {
return ModRecipes.ANIMAL_SPAWNER_SERIALIZER;
}
@Override
public IRecipeType<?> getType() {
return ModRecipes.ANIMAL_SPAWNER_TYPE;
}
public static class Serializer extends ForgeRegistryEntry<IRecipeSerializer<?>> implements IRecipeSerializer<AnimalSpawnerRecipe> {
@Override
public AnimalSpawnerRecipe read(ResourceLocation recipeId, JsonObject json) {
List<Ingredient> ingredients = new ArrayList<>();
for (JsonElement e : json.getAsJsonArray("ingredients"))
ingredients.add(Ingredient.deserialize(e));
return new AnimalSpawnerRecipe(recipeId,
ForgeRegistries.ENTITIES.getValue(new ResourceLocation(json.get("entity").getAsString())),
json.get("aura").getAsInt(),
json.get("time").getAsInt(),
ingredients.toArray(new Ingredient[0]));
}
@Nullable
@Override
public AnimalSpawnerRecipe read(ResourceLocation recipeId, PacketBuffer buffer) {
Ingredient[] ings = new Ingredient[buffer.readInt()];
for (int i = 0; i < ings.length; i++)
ings[i] = Ingredient.read(buffer);
return new AnimalSpawnerRecipe(
recipeId,
ForgeRegistries.ENTITIES.getValue(buffer.readResourceLocation()),
buffer.readInt(),
buffer.readInt(),
ings);
}
@Override
public void write(PacketBuffer buffer, AnimalSpawnerRecipe recipe) {
buffer.writeInt(recipe.ingredients.length);
for (Ingredient ing : recipe.ingredients)
ing.write(buffer);
buffer.writeResourceLocation(recipe.entity.getRegistryName());
buffer.writeInt(recipe.aura);
buffer.writeInt(recipe.time);
}
}
}

View file

@ -0,0 +1,40 @@
package de.ellpeck.naturesaura.recipes;
import com.google.gson.JsonObject;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraft.item.crafting.IRecipeType;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.items.wrapper.RecipeWrapper;
public abstract class ModRecipe implements IRecipe<RecipeWrapper> {
public final ResourceLocation name;
public ModRecipe(ResourceLocation name) {
this.name = name;
}
@Override
public boolean matches(RecipeWrapper inv, World worldIn) {
// return true here so that we can easily get all recipes of a type from the recipe manager
return true;
}
@Override
public ItemStack getCraftingResult(RecipeWrapper inv) {
return ItemStack.EMPTY;
}
@Override
public boolean canFit(int width, int height) {
return false;
}
@Override
public ResourceLocation getId() {
return this.name;
}
}

View file

@ -1,241 +1,52 @@
package de.ellpeck.naturesaura.recipes; package de.ellpeck.naturesaura.recipes;
import com.google.gson.JsonObject;
import com.mojang.datafixers.Dynamic;
import com.mojang.datafixers.types.JsonOps;
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.*; import de.ellpeck.naturesaura.api.misc.WeightedOre;
import de.ellpeck.naturesaura.api.recipes.ing.AmountIngredient;
import de.ellpeck.naturesaura.api.recipes.ing.NBTIngredient;
import de.ellpeck.naturesaura.blocks.ModBlocks;
import de.ellpeck.naturesaura.chunk.effect.*;
import de.ellpeck.naturesaura.items.ItemAuraBottle;
import de.ellpeck.naturesaura.items.ItemEffectPowder;
import de.ellpeck.naturesaura.items.ModItems;
import de.ellpeck.naturesaura.misc.ColoredBlockHelper;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.block.FlowerBlock;
import net.minecraft.client.resources.ReloadListener; import net.minecraft.client.resources.ReloadListener;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.entity.passive.SheepEntity;
import net.minecraft.item.DyeColor;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.Ingredient; import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraft.potion.PotionUtils; import net.minecraft.item.crafting.IRecipeType;
import net.minecraft.potion.Potions; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.profiler.IProfiler; import net.minecraft.nbt.INBT;
import net.minecraft.resources.IResourceManager; import net.minecraft.nbt.NBTDynamicOps;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.Tag;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World; import net.minecraft.util.registry.Registry;
import net.minecraftforge.common.Tags; import net.minecraftforge.common.Tags;
import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.registries.IForgeRegistry;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
public class ModRecipes extends ReloadListener<Object> { public final class ModRecipes {
private void init() { public static final IRecipeType<AltarRecipe> ALTAR_TYPE = new RecipeType<>();
// Clear all registries first public static final IRecipeSerializer<AltarRecipe> ALTAR_SERIAIZER = new AltarRecipe.Serializer();
NaturesAuraAPI.TREE_RITUAL_RECIPES.clear();
NaturesAuraAPI.ALTAR_RECIPES.clear();
NaturesAuraAPI.OFFERING_RECIPES.clear();
NaturesAuraAPI.BOTANIST_PICKAXE_CONVERSIONS.clear();
NaturesAuraAPI.FLOWERS.clear();
NaturesAuraAPI.ANIMAL_SPAWNER_RECIPES.clear();
NaturesAuraAPI.OVERWORLD_ORES.clear();
NaturesAuraAPI.NETHER_ORES.clear();
NaturesAuraAPI.PROJECTILE_GENERATIONS.clear();
new TreeRitualRecipe(res("eye"), public static final IRecipeType<AnimalSpawnerRecipe> ANIMAL_SPAWNER_TYPE = new RecipeType<>();
ing(new ItemStack(Blocks.OAK_SAPLING)), new ItemStack(ModItems.EYE), 250, public static final IRecipeSerializer<AnimalSpawnerRecipe> ANIMAL_SPAWNER_SERIALIZER = new AnimalSpawnerRecipe.Serializer();
ing(Items.SPIDER_EYE),
ing(Items.GOLD_INGOT),
ing(ModItems.GOLD_LEAF),
ing(ModItems.GOLD_LEAF)).register();
new TreeRitualRecipe(res("eye_improved"),
ing(new ItemStack(Blocks.OAK_SAPLING)), new ItemStack(ModItems.EYE_IMPROVED), 500,
ing(ModItems.EYE),
ing(ModItems.SKY_INGOT),
ing(ModItems.SKY_INGOT),
ing(ModBlocks.END_FLOWER),
ing(ModItems.GOLD_LEAF),
ing(ModItems.GOLD_LEAF)).register();
new TreeRitualRecipe(res("nature_altar"),
ing(Blocks.OAK_SAPLING), new ItemStack(ModBlocks.NATURE_ALTAR), 500,
ing(Blocks.STONE),
ing(Blocks.STONE),
ing(Blocks.STONE),
ing(ModItems.GOLD_LEAF),
ing(Items.GOLD_INGOT),
ing(ModItems.TOKEN_JOY)).register();
new TreeRitualRecipe(res("ancient_sapling"),
ing(Blocks.OAK_SAPLING), new ItemStack(ModBlocks.ANCIENT_SAPLING), 200,
ing(Blocks.OAK_SAPLING),
ing(Blocks.DANDELION),
ing(Blocks.POPPY),
ing(Items.WHEAT_SEEDS),
ing(Items.SUGAR_CANE),
ing(ModItems.GOLD_LEAF)).register();
new TreeRitualRecipe(res("furnace_heater"),
ing(Blocks.OAK_SAPLING), new ItemStack(ModBlocks.FURNACE_HEATER), 600,
ing(ModBlocks.INFUSED_STONE),
ing(ModBlocks.INFUSED_STONE),
ing(ModItems.TAINTED_GOLD),
ing(ModItems.INFUSED_IRON),
ing(Items.FIRE_CHARGE),
ing(Items.FLINT),
ing(Blocks.MAGMA_BLOCK),
ing(ModItems.TOKEN_FEAR)).register();
new TreeRitualRecipe(res("conversion_catalyst"),
ing(Blocks.JUNGLE_SAPLING), new ItemStack(ModBlocks.CONVERSION_CATALYST), 600,
ing(ModBlocks.GOLD_BRICK),
ing(ModBlocks.INFUSED_STONE),
ing(Items.BREWING_STAND),
ing(ModItems.SKY_INGOT),
ing(ModItems.GOLD_LEAF),
ing(Blocks.GLOWSTONE)).register();
new TreeRitualRecipe(res("crushing_catalyst"),
ing(Blocks.OAK_SAPLING), new ItemStack(ModBlocks.CRUSHING_CATALYST), 600,
ing(ModBlocks.GOLD_BRICK),
ing(ModBlocks.INFUSED_STONE),
ing(Blocks.PISTON),
ing(Items.FLINT),
ing(ModItems.TOKEN_ANGER)).register();
new TreeRitualRecipe(res("plant_powder"),
ing(new ItemStack(Blocks.OAK_SAPLING)),
ItemEffectPowder.setEffect(new ItemStack(ModItems.EFFECT_POWDER, 24), PlantBoostEffect.NAME), 400,
ing(ModBlocks.GOLD_POWDER),
ing(ModBlocks.GOLD_POWDER),
ing(ModItems.SKY_INGOT),
ing(Items.WHEAT)).register();
new TreeRitualRecipe(res("cache_powder"),
ing(new ItemStack(Blocks.OAK_SAPLING)),
ItemEffectPowder.setEffect(new ItemStack(ModItems.EFFECT_POWDER, 32), CacheRechargeEffect.NAME), 400,
ing(ModBlocks.GOLD_POWDER),
ing(ModBlocks.GOLD_POWDER),
ing(ModItems.SKY_INGOT),
ing(ModItems.AURA_CACHE)).register();
new TreeRitualRecipe(res("animal_powder"),
ing(Blocks.JUNGLE_SAPLING),
ItemEffectPowder.setEffect(new ItemStack(ModItems.EFFECT_POWDER, 8), AnimalEffect.NAME), 400,
ing(ModBlocks.GOLD_POWDER),
ing(ModBlocks.GOLD_POWDER),
ing(ModItems.SKY_INGOT),
ing(Items.EGG)).register();
new TreeRitualRecipe(res("ore_spawn_powder"),
ing(Blocks.OAK_SAPLING),
ItemEffectPowder.setEffect(new ItemStack(ModItems.EFFECT_POWDER, 4), OreSpawnEffect.NAME), 400,
ing(ModBlocks.GOLD_POWDER),
ing(ModBlocks.GOLD_POWDER),
ing(Blocks.DIAMOND_ORE),
ing(Blocks.REDSTONE_ORE)).register();
new TreeRitualRecipe(res("nether_grass_powder"),
ing(Blocks.OAK_SAPLING),
ItemEffectPowder.setEffect(new ItemStack(ModItems.EFFECT_POWDER, 24), NetherGrassEffect.NAME), 400,
ing(ModBlocks.GOLD_POWDER),
ing(ModBlocks.GOLD_POWDER),
ing(Blocks.NETHERRACK),
ing(Blocks.GRASS)).register();
new TreeRitualRecipe(res("token_joy"),
ing(Blocks.OAK_SAPLING), new ItemStack(ModItems.TOKEN_JOY, 2), 200,
nbtIng(ItemAuraBottle.setType(new ItemStack(ModItems.AURA_BOTTLE), NaturesAuraAPI.TYPE_OVERWORLD)),
ing(ModItems.GOLD_LEAF),
ing(ItemTags.SMALL_FLOWERS),
ing(Items.APPLE),
ing(Blocks.TORCH),
ing(Items.IRON_INGOT)).register();
new TreeRitualRecipe(res("token_anger"),
ing(Blocks.OAK_SAPLING), new ItemStack(ModItems.TOKEN_ANGER, 2), 200,
nbtIng(ItemAuraBottle.setType(new ItemStack(ModItems.AURA_BOTTLE), NaturesAuraAPI.TYPE_NETHER)),
ing(ModItems.GOLD_LEAF),
ing(Blocks.MAGMA_BLOCK),
ing(Items.BLAZE_POWDER),
ing(Items.GUNPOWDER),
ing(Items.ENDER_PEARL)).register();
new TreeRitualRecipe(res("token_sorrow"),
ing(Blocks.OAK_SAPLING), new ItemStack(ModItems.TOKEN_SORROW, 2), 200,
nbtIng(ItemAuraBottle.setType(new ItemStack(ModItems.AURA_BOTTLE), NaturesAuraAPI.TYPE_OVERWORLD)),
ing(ModItems.GOLD_LEAF),
ing(Items.GHAST_TEAR),
ing(Items.BEEF, Items.MUTTON, Items.CHICKEN, Items.PORKCHOP),
ing(Blocks.GLASS),
ing(ItemTags.FISHES)).register();
new TreeRitualRecipe(res("token_fear"),
ing(Blocks.OAK_SAPLING), new ItemStack(ModItems.TOKEN_FEAR, 2), 200,
nbtIng(ItemAuraBottle.setType(new ItemStack(ModItems.AURA_BOTTLE), NaturesAuraAPI.TYPE_NETHER)),
ing(ModItems.GOLD_LEAF),
ing(Items.ROTTEN_FLESH),
ing(Items.FEATHER),
ing(Items.BONE),
ing(Blocks.SOUL_SAND)).register();
new AltarRecipe(res("infused_iron"), public static final IRecipeType<OfferingRecipe> OFFERING_TYPE = new RecipeType<>();
ing(Items.IRON_INGOT), new ItemStack(ModItems.INFUSED_IRON), public static final IRecipeSerializer<OfferingRecipe> OFFERING_SERIALIZER = new OfferingRecipe.Serializer();
NaturesAuraAPI.TYPE_OVERWORLD, Ingredient.EMPTY, 15000, 80).register();
new AltarRecipe(res("infused_iron_block"),
ing(Blocks.IRON_BLOCK), new ItemStack(ModBlocks.INFUSED_IRON_BLOCK),
NaturesAuraAPI.TYPE_OVERWORLD, Ingredient.EMPTY, 135000, 700).register();
new AltarRecipe(res("tainted_gold"),
ing(Items.GOLD_INGOT), new ItemStack(ModItems.TAINTED_GOLD),
NaturesAuraAPI.TYPE_NETHER, Ingredient.EMPTY, 15000, 80).register();
new AltarRecipe(res("tainted_gold_block"),
ing(Blocks.GOLD_BLOCK), new ItemStack(ModBlocks.TAINTED_GOLD_BLOCK),
NaturesAuraAPI.TYPE_NETHER, Ingredient.EMPTY, 135000, 700).register();
new AltarRecipe(res("infused_stone"),
ing(Blocks.STONE), new ItemStack(ModBlocks.INFUSED_STONE),
NaturesAuraAPI.TYPE_OVERWORLD, Ingredient.EMPTY, 7500, 40).register();
Ingredient conversion = ing(ModBlocks.CONVERSION_CATALYST); public static final IRecipeType<TreeRitualRecipe> TREE_RITUAL_TYPE = new RecipeType<>();
new AltarRecipe(res("breath"), nbtIng(ItemAuraBottle.setType(new ItemStack(ModItems.AURA_BOTTLE), NaturesAuraAPI.TYPE_END)), new ItemStack(Items.DRAGON_BREATH), NaturesAuraAPI.TYPE_NETHER, conversion, 20000, 80).register(); public static final IRecipeSerializer<TreeRitualRecipe> TREE_RITUAL_SERIALIZER = new TreeRitualRecipe.Serializer();
new AltarRecipe(res("leather"), ing(Items.ROTTEN_FLESH), new ItemStack(Items.LEATHER), NaturesAuraAPI.TYPE_OVERWORLD, conversion, 10000, 50).register();
new AltarRecipe(res("soul_sand"), ing(Blocks.SAND), new ItemStack(Blocks.SOUL_SAND), NaturesAuraAPI.TYPE_NETHER, conversion, 5000, 100).register();
new AltarRecipe(res("nether_wart"), ing(Blocks.RED_MUSHROOM), new ItemStack(Items.NETHER_WART), NaturesAuraAPI.TYPE_NETHER, conversion, 30000, 250).register();
new AltarRecipe(res("prismarine"), ing(Items.QUARTZ), new ItemStack(Items.PRISMARINE_SHARD), NaturesAuraAPI.TYPE_NETHER, conversion, 55000, 200).register();
new AltarRecipe(res("water"), ing(Items.GLASS_BOTTLE), PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), Potions.WATER), NaturesAuraAPI.TYPE_OVERWORLD, conversion, 25000, 200).register();
new AltarRecipe(res("coal"), ing(Items.CHARCOAL), new ItemStack(Items.COAL), NaturesAuraAPI.TYPE_OVERWORLD, conversion, 30000, 250).register();
Ingredient crushing = ing(ModBlocks.CRUSHING_CATALYST); public static void register(IForgeRegistry<IRecipeSerializer<?>> registry) {
new AltarRecipe(res("bone"), ing(Items.BONE), new ItemStack(Items.BONE_MEAL, 6), NaturesAuraAPI.TYPE_OVERWORLD, crushing, 3000, 40).register(); register(registry, "altar", ALTAR_TYPE, ALTAR_SERIAIZER);
new AltarRecipe(res("sugar"), ing(Items.SUGAR_CANE), new ItemStack(Items.SUGAR, 3), NaturesAuraAPI.TYPE_OVERWORLD, crushing, 3000, 40).register(); register(registry, "animal_spawner", ANIMAL_SPAWNER_TYPE, ANIMAL_SPAWNER_SERIALIZER);
new AltarRecipe(res("blaze"), ing(Items.BLAZE_ROD), new ItemStack(Items.BLAZE_POWDER, 4), NaturesAuraAPI.TYPE_NETHER, crushing, 5000, 60).register(); register(registry, "offering", OFFERING_TYPE, OFFERING_SERIALIZER);
new AltarRecipe(res("glowstone"), ing(Blocks.GLOWSTONE), new ItemStack(Items.GLOWSTONE_DUST, 4), NaturesAuraAPI.TYPE_NETHER, crushing, 3000, 40).register(); register(registry, "tree_ritual", TREE_RITUAL_TYPE, TREE_RITUAL_SERIALIZER);
new AltarRecipe(res("sand"), ing(Blocks.COBBLESTONE), new ItemStack(Blocks.SAND), NaturesAuraAPI.TYPE_OVERWORLD, crushing, 3000, 40).register(); }
new OfferingRecipe(res("sky_ingot"),
amountIng(new ItemStack(ModItems.INFUSED_IRON, 3)),
ing(ModItems.CALLING_SPIRIT),
new ItemStack(ModItems.SKY_INGOT)).register();
new OfferingRecipe(res("sky_ingot_from_gold"),
ing(ModItems.TAINTED_GOLD),
ing(ModItems.CALLING_SPIRIT),
new ItemStack(ModItems.SKY_INGOT)).register();
new OfferingRecipe(res("clock_hand"),
ing(Items.NETHER_STAR),
ing(ModItems.CALLING_SPIRIT),
new ItemStack(ModItems.CLOCK_HAND)).register();
new OfferingRecipe(res("token_euphoria"),
ing(ModItems.TOKEN_JOY),
ing(ModItems.CALLING_SPIRIT),
new ItemStack(ModItems.TOKEN_EUPHORIA)).register();
new OfferingRecipe(res("token_rage"),
ing(ModItems.TOKEN_ANGER),
ing(ModItems.CALLING_SPIRIT),
new ItemStack(ModItems.TOKEN_RAGE)).register();
new OfferingRecipe(res("token_grief"),
ing(ModItems.TOKEN_SORROW),
ing(ModItems.CALLING_SPIRIT),
new ItemStack(ModItems.TOKEN_GRIEF)).register();
new OfferingRecipe(res("token_terror"),
ing(ModItems.TOKEN_FEAR),
ing(ModItems.CALLING_SPIRIT),
new ItemStack(ModItems.TOKEN_TERROR)).register();
public static void init() {
NaturesAuraAPI.BOTANIST_PICKAXE_CONVERSIONS.put( NaturesAuraAPI.BOTANIST_PICKAXE_CONVERSIONS.put(
Blocks.COBBLESTONE.getDefaultState(), Blocks.COBBLESTONE.getDefaultState(),
Blocks.MOSSY_COBBLESTONE.getDefaultState()); Blocks.MOSSY_COBBLESTONE.getDefaultState());
@ -249,106 +60,49 @@ public class ModRecipes extends ReloadListener<Object> {
Blocks.STONE_BRICK_WALL.getDefaultState(), Blocks.STONE_BRICK_WALL.getDefaultState(),
Blocks.MOSSY_STONE_BRICK_WALL.getDefaultState()); Blocks.MOSSY_STONE_BRICK_WALL.getDefaultState());
for (Block block : ForgeRegistries.BLOCKS) ore(NaturesAuraAPI.OVERWORLD_ORES, "ores/coal", 5000);
if (block instanceof FlowerBlock) ore(NaturesAuraAPI.OVERWORLD_ORES, "ores/iron", 3000);
NaturesAuraAPI.FLOWERS.addAll(block.getStateContainer().getValidStates()); ore(NaturesAuraAPI.OVERWORLD_ORES, "ores/gold", 500);
ore(NaturesAuraAPI.OVERWORLD_ORES, "ores/diamond", 50);
ore(NaturesAuraAPI.OVERWORLD_ORES, "ores/lapis", 250);
ore(NaturesAuraAPI.OVERWORLD_ORES, "ores/redstone", 200);
ore(NaturesAuraAPI.OVERWORLD_ORES, "ores/emerald", 30);
ore(NaturesAuraAPI.NETHER_ORES, "ores/quartz", 3000);
for (DyeColor color : DyeColor.values()) ore(NaturesAuraAPI.OVERWORLD_ORES, "ores/copper", 2000);
new AnimalSpawnerRecipe(res("sheep_" + color.getName()), EntityType.SHEEP, ore(NaturesAuraAPI.NETHER_ORES, "ores/nether/copper", 2000);
500, 60, ing(ModItems.BIRTH_SPIRIT), ing(Items.MUTTON), ore(NaturesAuraAPI.OVERWORLD_ORES, "ores/tin", 1800);
ing(ColoredBlockHelper.WOOL.get(color.getId()))) { ore(NaturesAuraAPI.NETHER_ORES, "ores/nether/tin", 1800);
@Override ore(NaturesAuraAPI.OVERWORLD_ORES, "ores/lead", 1500);
public Entity makeEntity(World world, double x, double y, double z) { ore(NaturesAuraAPI.NETHER_ORES, "ores/nether/lead", 1500);
SheepEntity sheep = (SheepEntity) super.makeEntity(world, x, y, z); ore(NaturesAuraAPI.OVERWORLD_ORES, "ores/silver", 1000);
sheep.setFleeceColor(color); ore(NaturesAuraAPI.NETHER_ORES, "ores/nether/silver", 1000);
return sheep; ore(NaturesAuraAPI.OVERWORLD_ORES, "ores/nickel", 100);
} ore(NaturesAuraAPI.NETHER_ORES, "ores/nether/nickel", 100);
}.register(); ore(NaturesAuraAPI.OVERWORLD_ORES, "ores/platinum", 20);
spawner("cow", EntityType.COW, 50000, 60, ing(Items.BEEF), ing(Items.LEATHER)); ore(NaturesAuraAPI.NETHER_ORES, "ores/nether/platinum", 20);
spawner("chicken", EntityType.CHICKEN, 30000, 40, ing(Items.FEATHER), ing(Items.EGG)); ore(NaturesAuraAPI.OVERWORLD_ORES, "ores/aluminum", 1200);
spawner("pig", EntityType.PIG, 50000, 60, ing(Items.PORKCHOP)); ore(NaturesAuraAPI.OVERWORLD_ORES, "ores/aluminium", 1200);
spawner("blaze", EntityType.BLAZE, 150000, 120, ing(Items.BLAZE_ROD), ing(Items.BLAZE_POWDER)); ore(NaturesAuraAPI.OVERWORLD_ORES, "ores/osmium", 1500);
spawner("ghast", EntityType.GHAST, 120000, 150, ing(Items.GUNPOWDER), ing(Items.GHAST_TEAR)); ore(NaturesAuraAPI.OVERWORLD_ORES, "ores/zinc", 1000);
spawner("ocelot", EntityType.OCELOT, 80000, 60, ing(ItemTags.FISHES), ing(ItemTags.WOOL)); ore(NaturesAuraAPI.OVERWORLD_ORES, "ores/yellorite", 1200);
spawner("mule", EntityType.MULE, 100000, 100, ing(Items.LEATHER), ing(Blocks.CHEST), ing(Items.APPLE)); ore(NaturesAuraAPI.OVERWORLD_ORES, "ores/uranium", 400);
spawner("bat", EntityType.BAT, 30000, 40, ing(Items.FEATHER)); ore(NaturesAuraAPI.OVERWORLD_ORES, "ores/apatite", 700);
spawner("endermite", EntityType.ENDERMITE, 30000, 40, ing(Items.ENDER_PEARL), ing(Blocks.STONE)); ore(NaturesAuraAPI.OVERWORLD_ORES, "ores/ruby", 40);
spawner("parrot", EntityType.PARROT, 50000, 60, ing(Items.FEATHER), ing(Items.COOKIE)); ore(NaturesAuraAPI.OVERWORLD_ORES, "ores/peridot", 40);
spawner("slime", EntityType.SLIME, 30000, 40, ing(Items.SLIME_BALL)); ore(NaturesAuraAPI.OVERWORLD_ORES, "ores/topaz", 40);
spawner("spider", EntityType.SPIDER, 100000, 120, ing(Items.STRING), ing(Items.SPIDER_EYE)); ore(NaturesAuraAPI.OVERWORLD_ORES, "ores/tanzanite", 40);
spawner("skeleton", EntityType.SKELETON, 100000, 120, ing(Items.BONE), ing(Items.ARROW)); ore(NaturesAuraAPI.OVERWORLD_ORES, "ores/malachite", 40);
spawner("enderman", EntityType.ENDERMAN, 120000, 120, ing(Items.ENDER_PEARL)); ore(NaturesAuraAPI.OVERWORLD_ORES, "ores/sapphire", 40);
spawner("silverfish", EntityType.SILVERFISH, 30000, 40, ing(Blocks.STONE)); ore(NaturesAuraAPI.OVERWORLD_ORES, "ores/amber", 150);
spawner("squid", EntityType.SQUID, 50000, 40, ing(Items.INK_SAC)); ore(NaturesAuraAPI.OVERWORLD_ORES, "ores/resonating", 50);
spawner("stray", EntityType.STRAY, 100000, 120, ing(Items.BONE), ing(Blocks.ICE)); ore(NaturesAuraAPI.OVERWORLD_ORES, "ores/sulfur", 3000);
spawner("shulker", EntityType.SHULKER, 150000, 100, ing(Items.SHULKER_SHELL)); ore(NaturesAuraAPI.OVERWORLD_ORES, "ores/saltpeter", 250);
spawner("husk", EntityType.HUSK, 100000, 120, ing(Items.ROTTEN_FLESH), ing(Blocks.SAND)); ore(NaturesAuraAPI.NETHER_ORES, "ores/firestone", 30);
spawner("llama", EntityType.LLAMA, 60000, 80, ing(ItemTags.WOOL)); ore(NaturesAuraAPI.OVERWORLD_ORES, "ores/salt", 2900);
spawner("rabbit", EntityType.RABBIT, 30000, 40, ing(Items.RABBIT_HIDE)); ore(NaturesAuraAPI.OVERWORLD_ORES, "ores/draconium", 5);
spawner("magma_cube", EntityType.MAGMA_CUBE, 100000, 100, ing(Items.MAGMA_CREAM)); ore(NaturesAuraAPI.NETHER_ORES, "ores/cobalt", 50);
spawner("zombie_pigman", EntityType.ZOMBIE_PIGMAN, 120000, 150, ing(Items.ROTTEN_FLESH), ing(Items.GOLD_NUGGET)); ore(NaturesAuraAPI.NETHER_ORES, "ores/ardite", 50);
spawner("polar_bear", EntityType.POLAR_BEAR, 50000, 60, ing(Items.COD), ing(Blocks.ICE));
spawner("mooshroom", EntityType.MOOSHROOM, 40000, 60, ing(Items.LEATHER), ing(Blocks.RED_MUSHROOM));
spawner("guardian", EntityType.GUARDIAN, 150000, 150, ing(Items.PRISMARINE_SHARD), ing(Items.PRISMARINE_CRYSTALS));
spawner("horse", EntityType.HORSE, 100000, 100, ing(Items.LEATHER));
spawner("donkey", EntityType.DONKEY, 100000, 100, ing(Items.LEATHER), ing(Blocks.CHEST));
spawner("cave_spider", EntityType.CAVE_SPIDER, 100000, 120, ing(Items.STRING), ing(Items.FERMENTED_SPIDER_EYE));
spawner("creeper", EntityType.CREEPER, 100000, 120, ing(Items.GUNPOWDER));
spawner("witch", EntityType.WITCH, 150000, 150, ing(Items.GLASS_BOTTLE), ing(Items.GLOWSTONE_DUST));
spawner("wither_skeleton", EntityType.WITHER_SKELETON, 150000, 150, ing(Items.BONE), ing(Blocks.OBSIDIAN));
spawner("wolf", EntityType.WOLF, 50000, 60, ing(Items.LEATHER), ing(Items.BONE));
spawner("zombie", EntityType.ZOMBIE, 100000, 100, ing(Items.ROTTEN_FLESH));
spawner("bee", EntityType.BEE, 50000, 100, ing(Items.HONEYCOMB), ing(Items.HONEY_BLOCK));
spawner("dolphin", EntityType.DOLPHIN, 100000, 150, ing(ItemTags.FISHES), ing(Items.MAP));
spawner("fox", EntityType.FOX, 30000, 100, ing(Items.SWEET_BERRIES), ing(Items.FEATHER));
spawner("panda", EntityType.PANDA, 100000, 100, ing(Items.BAMBOO), ing(Blocks.BAMBOO_SAPLING));
spawner("turtle", EntityType.TURTLE, 100000, 150, ing(Items.SCUTE), ing(Items.SEAGRASS));
spawner("phantom", EntityType.PHANTOM, 200000, 200, ing(Items.PHANTOM_MEMBRANE));
spawner("cat", EntityType.CAT, 50000, 100, ing(Items.STRING), ing(ItemTags.WOOL));
NaturesAuraAPI.OVERWORLD_ORES.add(new WeightedOre(Tags.Blocks.ORES_COAL, 5000));
NaturesAuraAPI.OVERWORLD_ORES.add(new WeightedOre(Tags.Blocks.ORES_IRON, 3000));
NaturesAuraAPI.OVERWORLD_ORES.add(new WeightedOre(Tags.Blocks.ORES_GOLD, 500));
NaturesAuraAPI.OVERWORLD_ORES.add(new WeightedOre(Tags.Blocks.ORES_DIAMOND, 50));
NaturesAuraAPI.OVERWORLD_ORES.add(new WeightedOre(Tags.Blocks.ORES_LAPIS, 250));
NaturesAuraAPI.OVERWORLD_ORES.add(new WeightedOre(Tags.Blocks.ORES_REDSTONE, 200));
NaturesAuraAPI.OVERWORLD_ORES.add(new WeightedOre(Tags.Blocks.ORES_EMERALD, 30));
NaturesAuraAPI.NETHER_ORES.add(new WeightedOre(Tags.Blocks.ORES_QUARTZ, 3000));
foreignOre(NaturesAuraAPI.OVERWORLD_ORES, "ores/copper", 2000);
foreignOre(NaturesAuraAPI.NETHER_ORES, "ores/nether/copper", 2000);
foreignOre(NaturesAuraAPI.OVERWORLD_ORES, "ores/tin", 1800);
foreignOre(NaturesAuraAPI.NETHER_ORES, "ores/nether/tin", 1800);
foreignOre(NaturesAuraAPI.OVERWORLD_ORES, "ores/lead", 1500);
foreignOre(NaturesAuraAPI.NETHER_ORES, "ores/nether/lead", 1500);
foreignOre(NaturesAuraAPI.OVERWORLD_ORES, "ores/silver", 1000);
foreignOre(NaturesAuraAPI.NETHER_ORES, "ores/nether/silver", 1000);
foreignOre(NaturesAuraAPI.OVERWORLD_ORES, "ores/nickel", 100);
foreignOre(NaturesAuraAPI.NETHER_ORES, "ores/nether/nickel", 100);
foreignOre(NaturesAuraAPI.OVERWORLD_ORES, "ores/platinum", 20);
foreignOre(NaturesAuraAPI.NETHER_ORES, "ores/nether/platinum", 20);
foreignOre(NaturesAuraAPI.OVERWORLD_ORES, "ores/aluminum", 1200);
foreignOre(NaturesAuraAPI.OVERWORLD_ORES, "ores/aluminium", 1200);
foreignOre(NaturesAuraAPI.OVERWORLD_ORES, "ores/osmium", 1500);
foreignOre(NaturesAuraAPI.OVERWORLD_ORES, "ores/zinc", 1000);
foreignOre(NaturesAuraAPI.OVERWORLD_ORES, "ores/yellorite", 1200);
foreignOre(NaturesAuraAPI.OVERWORLD_ORES, "ores/uranium", 400);
foreignOre(NaturesAuraAPI.OVERWORLD_ORES, "ores/apatite", 700);
foreignOre(NaturesAuraAPI.OVERWORLD_ORES, "ores/ruby", 40);
foreignOre(NaturesAuraAPI.OVERWORLD_ORES, "ores/peridot", 40);
foreignOre(NaturesAuraAPI.OVERWORLD_ORES, "ores/topaz", 40);
foreignOre(NaturesAuraAPI.OVERWORLD_ORES, "ores/tanzanite", 40);
foreignOre(NaturesAuraAPI.OVERWORLD_ORES, "ores/malachite", 40);
foreignOre(NaturesAuraAPI.OVERWORLD_ORES, "ores/sapphire", 40);
foreignOre(NaturesAuraAPI.OVERWORLD_ORES, "ores/amber", 150);
foreignOre(NaturesAuraAPI.OVERWORLD_ORES, "ores/resonating", 50);
foreignOre(NaturesAuraAPI.OVERWORLD_ORES, "ores/sulfur", 3000);
foreignOre(NaturesAuraAPI.OVERWORLD_ORES, "ores/saltpeter", 250);
foreignOre(NaturesAuraAPI.NETHER_ORES, "ores/firestone", 30);
foreignOre(NaturesAuraAPI.OVERWORLD_ORES, "ores/salt", 2900);
foreignOre(NaturesAuraAPI.OVERWORLD_ORES, "ores/draconium", 5);
foreignOre(NaturesAuraAPI.NETHER_ORES, "ores/cobalt", 50);
foreignOre(NaturesAuraAPI.NETHER_ORES, "ores/ardite", 50);
NaturesAuraAPI.PROJECTILE_GENERATIONS.put(EntityType.EGG, 2500); NaturesAuraAPI.PROJECTILE_GENERATIONS.put(EntityType.EGG, 2500);
NaturesAuraAPI.PROJECTILE_GENERATIONS.put(EntityType.SNOWBALL, 3500); NaturesAuraAPI.PROJECTILE_GENERATIONS.put(EntityType.SNOWBALL, 3500);
@ -362,57 +116,42 @@ public class ModRecipes extends ReloadListener<Object> {
NaturesAuraAPI.PROJECTILE_GENERATIONS.put(EntityType.TRIDENT, 3000000); NaturesAuraAPI.PROJECTILE_GENERATIONS.put(EntityType.TRIDENT, 3000000);
} }
private static void spawner(String name, EntityType entity, int aura, int time, Ingredient... ings) { private static void ore(List<WeightedOre> list, String name, int weight) {
Ingredient[] actualIngs = new Ingredient[ings.length + 1];
actualIngs[0] = ing(ModItems.BIRTH_SPIRIT);
System.arraycopy(ings, 0, actualIngs, 1, ings.length);
new AnimalSpawnerRecipe(res(name), entity, aura, time, actualIngs).register();
}
private static void foreignOre(List<WeightedOre> list, String name, int weight) {
ResourceLocation res = new ResourceLocation("forge", name); ResourceLocation res = new ResourceLocation("forge", name);
Tag<Block> tag = BlockTags.getCollection().get(res); list.add(new WeightedOre(res, weight));
if (tag == null)
return;
list.add(new WeightedOre(tag, weight));
} }
private static Ingredient ing(Block... blocks) { private static void register(IForgeRegistry<IRecipeSerializer<?>> registry, String name, IRecipeType<?> type, IRecipeSerializer<?> serializer) {
return ing(Arrays.stream(blocks).map(ItemStack::new).toArray(ItemStack[]::new)); ResourceLocation res = new ResourceLocation(NaturesAura.MOD_ID, name);
Registry.register(Registry.RECIPE_TYPE, res, type);
registry.register(serializer.setRegistryName(res));
} }
private static Ingredient ing(Item... items) { public static JsonObject serializeStack(ItemStack stack) {
return ing(Arrays.stream(items).map(ItemStack::new).toArray(ItemStack[]::new)); CompoundNBT nbt = stack.write(new CompoundNBT());
byte c = nbt.getByte("Count");
if (c != 1) {
nbt.putByte("count", c);
}
nbt.remove("Count");
renameTag(nbt, "id", "item");
renameTag(nbt, "tag", "nbt");
Dynamic<INBT> dyn = new Dynamic<>(NBTDynamicOps.INSTANCE, nbt);
return dyn.convert(JsonOps.INSTANCE).getValue().getAsJsonObject();
} }
private static Ingredient ing(ItemStack... stacks) { private static void renameTag(CompoundNBT nbt, String oldName, String newName) {
return Ingredient.fromStacks(stacks); INBT tag = nbt.get(oldName);
} if (tag != null) {
nbt.remove(oldName);
private static Ingredient ing(Tag<Item> tag) { nbt.put(newName, tag);
return Ingredient.fromTag(tag); }
}
private static Ingredient nbtIng(ItemStack stack) {
return new NBTIngredient(stack);
}
private static Ingredient amountIng(ItemStack stack) {
return new AmountIngredient(stack);
}
private static ResourceLocation res(String name) {
return new ResourceLocation(NaturesAura.MOD_ID, name);
} }
private static class RecipeType<T extends IRecipe<?>> implements IRecipeType<T> {
@Override @Override
protected Object prepare(IResourceManager resourceManagerIn, IProfiler profilerIn) { public String toString() {
return null; return Registry.RECIPE_TYPE.getKey(this).toString();
} }
@Override
protected void apply(Object splashList, IResourceManager resourceManagerIn, IProfiler profilerIn) {
NaturesAura.LOGGER.info("Loading recipes");
this.init();
} }
} }

View file

@ -0,0 +1,70 @@
package de.ellpeck.naturesaura.recipes;
import com.google.gson.JsonObject;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraft.item.crafting.IRecipeType;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.crafting.CraftingHelper;
import net.minecraftforge.registries.ForgeRegistryEntry;
import javax.annotation.Nullable;
public class OfferingRecipe extends ModRecipe {
public final Ingredient input;
public final Ingredient startItem;
public final ItemStack output;
public OfferingRecipe(ResourceLocation name, Ingredient input, Ingredient startItem, ItemStack output) {
super(name);
this.input = input;
this.startItem = startItem;
this.output = output;
}
@Override
public ItemStack getRecipeOutput() {
return this.output;
}
@Override
public IRecipeSerializer<?> getSerializer() {
return ModRecipes.OFFERING_SERIALIZER;
}
@Override
public IRecipeType<?> getType() {
return ModRecipes.OFFERING_TYPE;
}
public static class Serializer extends ForgeRegistryEntry<IRecipeSerializer<?>> implements IRecipeSerializer<OfferingRecipe> {
@Override
public OfferingRecipe read(ResourceLocation recipeId, JsonObject json) {
return new OfferingRecipe(
recipeId,
Ingredient.deserialize(json.get("input")),
Ingredient.deserialize(json.get("start_item")),
CraftingHelper.getItemStack(json.getAsJsonObject("output"), true));
}
@Nullable
@Override
public OfferingRecipe read(ResourceLocation recipeId, PacketBuffer buffer) {
return new OfferingRecipe(
recipeId,
Ingredient.read(buffer),
Ingredient.read(buffer),
buffer.readItemStack());
}
@Override
public void write(PacketBuffer buffer, OfferingRecipe recipe) {
recipe.input.write(buffer);
recipe.startItem.write(buffer);
buffer.writeItemStack(recipe.output);
}
}
}

View file

@ -0,0 +1,87 @@
package de.ellpeck.naturesaura.recipes;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraft.item.crafting.IRecipeType;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.crafting.CraftingHelper;
import net.minecraftforge.registries.ForgeRegistryEntry;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
public class TreeRitualRecipe extends ModRecipe {
public final Ingredient saplingType;
public final Ingredient[] ingredients;
public final ItemStack result;
public final int time;
public TreeRitualRecipe(ResourceLocation name, Ingredient saplingType, ItemStack result, int time, Ingredient... ingredients) {
super(name);
this.saplingType = saplingType;
this.ingredients = ingredients;
this.result = result;
this.time = time;
}
@Override
public ItemStack getRecipeOutput() {
return this.result;
}
@Override
public IRecipeSerializer<?> getSerializer() {
return ModRecipes.TREE_RITUAL_SERIALIZER;
}
@Override
public IRecipeType<?> getType() {
return ModRecipes.TREE_RITUAL_TYPE;
}
public static class Serializer extends ForgeRegistryEntry<IRecipeSerializer<?>> implements IRecipeSerializer<TreeRitualRecipe> {
@Override
public TreeRitualRecipe read(ResourceLocation recipeId, JsonObject json) {
List<Ingredient> ings = new ArrayList<>();
for (JsonElement element : json.getAsJsonArray("ingredients"))
ings.add(Ingredient.deserialize(element));
return new TreeRitualRecipe(
recipeId,
Ingredient.deserialize(json.getAsJsonObject("sapling")),
CraftingHelper.getItemStack(json.getAsJsonObject("output"), true),
json.get("time").getAsInt(),
ings.toArray(new Ingredient[0]));
}
@Nullable
@Override
public TreeRitualRecipe read(ResourceLocation recipeId, PacketBuffer buffer) {
Ingredient[] ings = new Ingredient[buffer.readInt()];
for (int i = 0; i < ings.length; i++)
ings[i] = Ingredient.read(buffer);
return new TreeRitualRecipe(
recipeId,
Ingredient.read(buffer),
buffer.readItemStack(),
buffer.readInt(),
ings);
}
@Override
public void write(PacketBuffer buffer, TreeRitualRecipe recipe) {
buffer.writeInt(recipe.ingredients.length);
for (Ingredient ing : recipe.ingredients)
ing.write(buffer);
recipe.saplingType.write(buffer);
buffer.writeItemStack(recipe.result);
buffer.writeInt(recipe.time);
}
}
}

View file

@ -28,6 +28,7 @@ import de.ellpeck.naturesaura.items.*;
import de.ellpeck.naturesaura.items.tools.*; import de.ellpeck.naturesaura.items.tools.*;
import de.ellpeck.naturesaura.potion.ModPotions; import de.ellpeck.naturesaura.potion.ModPotions;
import de.ellpeck.naturesaura.potion.PotionBreathless; import de.ellpeck.naturesaura.potion.PotionBreathless;
import de.ellpeck.naturesaura.recipes.ModRecipes;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.block.FlowerPotBlock; import net.minecraft.block.FlowerPotBlock;
@ -40,6 +41,7 @@ import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.inventory.container.ContainerType; import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.BlockItem; import net.minecraft.item.BlockItem;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraft.potion.Effect; import net.minecraft.potion.Effect;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType; import net.minecraft.tileentity.TileEntityType;
@ -282,6 +284,11 @@ public final class ModRegistry {
Helper.populateObjectHolders(ModFeatures.class, event.getRegistry()); Helper.populateObjectHolders(ModFeatures.class, event.getRegistry());
} }
@SubscribeEvent
public static void registerRecipes(RegistryEvent.Register<IRecipeSerializer<?>> event) {
ModRecipes.register(event.getRegistry());
}
public static void init() { public static void init() {
for (IModItem item : ALL_ITEMS) { for (IModItem item : ALL_ITEMS) {
if (item instanceof IColorProvidingBlock) if (item instanceof IColorProvidingBlock)

View file

@ -0,0 +1,16 @@
{
"type": "naturesaura:altar",
"input": {
"item": "minecraft:blaze_rod"
},
"output": {
"item": "minecraft:blaze_powder",
"count": 4
},
"aura_type": "naturesaura:nether",
"catalyst": {
"item": "naturesaura:crushing_catalyst"
},
"aura": 5000,
"time": 60
}

View file

@ -0,0 +1,16 @@
{
"type": "naturesaura:altar",
"input": {
"item": "minecraft:bone"
},
"output": {
"item": "minecraft:bone_meal",
"count": 6
},
"aura_type": "naturesaura:overworld",
"catalyst": {
"item": "naturesaura:crushing_catalyst"
},
"aura": 3000,
"time": 40
}

View file

@ -0,0 +1,18 @@
{
"type": "naturesaura:altar",
"input": {
"type": "forge:nbt",
"item": "naturesaura:aura_bottle",
"count": 1,
"nbt": "{stored_type:\"naturesaura:end\"}"
},
"output": {
"item": "minecraft:dragon_breath"
},
"aura_type": "naturesaura:nether",
"catalyst": {
"item": "naturesaura:conversion_catalyst"
},
"aura": 20000,
"time": 80
}

View file

@ -0,0 +1,15 @@
{
"type": "naturesaura:altar",
"input": {
"item": "minecraft:charcoal"
},
"output": {
"item": "minecraft:coal"
},
"aura_type": "naturesaura:overworld",
"catalyst": {
"item": "naturesaura:conversion_catalyst"
},
"aura": 30000,
"time": 250
}

View file

@ -0,0 +1,16 @@
{
"type": "naturesaura:altar",
"input": {
"item": "minecraft:glowstone"
},
"output": {
"item": "minecraft:glowstone_dust",
"count": 4
},
"aura_type": "naturesaura:nether",
"catalyst": {
"item": "naturesaura:crushing_catalyst"
},
"aura": 3000,
"time": 40
}

View file

@ -0,0 +1,12 @@
{
"type": "naturesaura:altar",
"input": {
"item": "minecraft:iron_ingot"
},
"output": {
"item": "naturesaura:infused_iron"
},
"aura_type": "naturesaura:overworld",
"aura": 15000,
"time": 80
}

View file

@ -0,0 +1,12 @@
{
"type": "naturesaura:altar",
"input": {
"item": "minecraft:iron_block"
},
"output": {
"item": "naturesaura:infused_iron_block"
},
"aura_type": "naturesaura:overworld",
"aura": 135000,
"time": 700
}

View file

@ -0,0 +1,12 @@
{
"type": "naturesaura:altar",
"input": {
"item": "minecraft:stone"
},
"output": {
"item": "naturesaura:infused_stone"
},
"aura_type": "naturesaura:overworld",
"aura": 7500,
"time": 40
}

View file

@ -0,0 +1,15 @@
{
"type": "naturesaura:altar",
"input": {
"item": "minecraft:rotten_flesh"
},
"output": {
"item": "minecraft:leather"
},
"aura_type": "naturesaura:overworld",
"catalyst": {
"item": "naturesaura:conversion_catalyst"
},
"aura": 10000,
"time": 50
}

View file

@ -0,0 +1,15 @@
{
"type": "naturesaura:altar",
"input": {
"item": "minecraft:red_mushroom"
},
"output": {
"item": "minecraft:nether_wart"
},
"aura_type": "naturesaura:nether",
"catalyst": {
"item": "naturesaura:conversion_catalyst"
},
"aura": 30000,
"time": 250
}

View file

@ -0,0 +1,15 @@
{
"type": "naturesaura:altar",
"input": {
"item": "minecraft:quartz"
},
"output": {
"item": "minecraft:prismarine_shard"
},
"aura_type": "naturesaura:nether",
"catalyst": {
"item": "naturesaura:conversion_catalyst"
},
"aura": 55000,
"time": 200
}

View file

@ -0,0 +1,15 @@
{
"type": "naturesaura:altar",
"input": {
"item": "minecraft:cobblestone"
},
"output": {
"item": "minecraft:sand"
},
"aura_type": "naturesaura:overworld",
"catalyst": {
"item": "naturesaura:crushing_catalyst"
},
"aura": 3000,
"time": 40
}

View file

@ -0,0 +1,15 @@
{
"type": "naturesaura:altar",
"input": {
"item": "minecraft:sand"
},
"output": {
"item": "minecraft:soul_sand"
},
"aura_type": "naturesaura:nether",
"catalyst": {
"item": "naturesaura:conversion_catalyst"
},
"aura": 5000,
"time": 100
}

View file

@ -0,0 +1,16 @@
{
"type": "naturesaura:altar",
"input": {
"item": "minecraft:sugar_cane"
},
"output": {
"item": "minecraft:sugar",
"count": 3
},
"aura_type": "naturesaura:overworld",
"catalyst": {
"item": "naturesaura:crushing_catalyst"
},
"aura": 3000,
"time": 40
}

View file

@ -0,0 +1,12 @@
{
"type": "naturesaura:altar",
"input": {
"item": "minecraft:gold_ingot"
},
"output": {
"item": "naturesaura:tainted_gold"
},
"aura_type": "naturesaura:nether",
"aura": 15000,
"time": 80
}

View file

@ -0,0 +1,12 @@
{
"type": "naturesaura:altar",
"input": {
"item": "minecraft:gold_block"
},
"output": {
"item": "naturesaura:tainted_gold_block"
},
"aura_type": "naturesaura:nether",
"aura": 135000,
"time": 700
}

View file

@ -0,0 +1,18 @@
{
"type": "naturesaura:altar",
"input": {
"item": "minecraft:glass_bottle"
},
"output": {
"nbt": {
"Potion": "minecraft:water"
},
"item": "minecraft:potion"
},
"aura_type": "naturesaura:overworld",
"catalyst": {
"item": "naturesaura:conversion_catalyst"
},
"aura": 25000,
"time": 200
}

View file

@ -0,0 +1,14 @@
{
"type": "naturesaura:animal_spawner",
"ingredients": [
{
"item": "naturesaura:birth_spirit"
},
{
"item": "minecraft:feather"
}
],
"entity": "minecraft:bat",
"aura": 30000,
"time": 40
}

View file

@ -0,0 +1,17 @@
{
"type": "naturesaura:animal_spawner",
"ingredients": [
{
"item": "naturesaura:birth_spirit"
},
{
"item": "minecraft:honeycomb"
},
{
"item": "minecraft:honey_block"
}
],
"entity": "minecraft:bee",
"aura": 50000,
"time": 100
}

View file

@ -0,0 +1,17 @@
{
"type": "naturesaura:animal_spawner",
"ingredients": [
{
"item": "naturesaura:birth_spirit"
},
{
"item": "minecraft:blaze_rod"
},
{
"item": "minecraft:blaze_powder"
}
],
"entity": "minecraft:blaze",
"aura": 150000,
"time": 120
}

View file

@ -0,0 +1,17 @@
{
"type": "naturesaura:animal_spawner",
"ingredients": [
{
"item": "naturesaura:birth_spirit"
},
{
"item": "minecraft:string"
},
{
"tag": "minecraft:wool"
}
],
"entity": "minecraft:cat",
"aura": 50000,
"time": 100
}

View file

@ -0,0 +1,17 @@
{
"type": "naturesaura:animal_spawner",
"ingredients": [
{
"item": "naturesaura:birth_spirit"
},
{
"item": "minecraft:string"
},
{
"item": "minecraft:fermented_spider_eye"
}
],
"entity": "minecraft:cave_spider",
"aura": 100000,
"time": 120
}

View file

@ -0,0 +1,17 @@
{
"type": "naturesaura:animal_spawner",
"ingredients": [
{
"item": "naturesaura:birth_spirit"
},
{
"item": "minecraft:feather"
},
{
"item": "minecraft:egg"
}
],
"entity": "minecraft:chicken",
"aura": 30000,
"time": 40
}

View file

@ -0,0 +1,17 @@
{
"type": "naturesaura:animal_spawner",
"ingredients": [
{
"item": "naturesaura:birth_spirit"
},
{
"item": "minecraft:beef"
},
{
"item": "minecraft:leather"
}
],
"entity": "minecraft:cow",
"aura": 50000,
"time": 60
}

View file

@ -0,0 +1,14 @@
{
"type": "naturesaura:animal_spawner",
"ingredients": [
{
"item": "naturesaura:birth_spirit"
},
{
"item": "minecraft:gunpowder"
}
],
"entity": "minecraft:creeper",
"aura": 100000,
"time": 120
}

View file

@ -0,0 +1,17 @@
{
"type": "naturesaura:animal_spawner",
"ingredients": [
{
"item": "naturesaura:birth_spirit"
},
{
"tag": "minecraft:fishes"
},
{
"item": "minecraft:map"
}
],
"entity": "minecraft:dolphin",
"aura": 100000,
"time": 150
}

View file

@ -0,0 +1,17 @@
{
"type": "naturesaura:animal_spawner",
"ingredients": [
{
"item": "naturesaura:birth_spirit"
},
{
"item": "minecraft:leather"
},
{
"item": "minecraft:chest"
}
],
"entity": "minecraft:donkey",
"aura": 100000,
"time": 100
}

View file

@ -0,0 +1,14 @@
{
"type": "naturesaura:animal_spawner",
"ingredients": [
{
"item": "naturesaura:birth_spirit"
},
{
"item": "minecraft:ender_pearl"
}
],
"entity": "minecraft:enderman",
"aura": 120000,
"time": 120
}

View file

@ -0,0 +1,17 @@
{
"type": "naturesaura:animal_spawner",
"ingredients": [
{
"item": "naturesaura:birth_spirit"
},
{
"item": "minecraft:ender_pearl"
},
{
"item": "minecraft:stone"
}
],
"entity": "minecraft:endermite",
"aura": 30000,
"time": 40
}

View file

@ -0,0 +1,17 @@
{
"type": "naturesaura:animal_spawner",
"ingredients": [
{
"item": "naturesaura:birth_spirit"
},
{
"item": "minecraft:sweet_berries"
},
{
"item": "minecraft:feather"
}
],
"entity": "minecraft:fox",
"aura": 30000,
"time": 100
}

View file

@ -0,0 +1,17 @@
{
"type": "naturesaura:animal_spawner",
"ingredients": [
{
"item": "naturesaura:birth_spirit"
},
{
"item": "minecraft:gunpowder"
},
{
"item": "minecraft:ghast_tear"
}
],
"entity": "minecraft:ghast",
"aura": 120000,
"time": 150
}

View file

@ -0,0 +1,17 @@
{
"type": "naturesaura:animal_spawner",
"ingredients": [
{
"item": "naturesaura:birth_spirit"
},
{
"item": "minecraft:prismarine_shard"
},
{
"item": "minecraft:prismarine_crystals"
}
],
"entity": "minecraft:guardian",
"aura": 150000,
"time": 150
}

View file

@ -0,0 +1,14 @@
{
"type": "naturesaura:animal_spawner",
"ingredients": [
{
"item": "naturesaura:birth_spirit"
},
{
"item": "minecraft:leather"
}
],
"entity": "minecraft:horse",
"aura": 100000,
"time": 100
}

View file

@ -0,0 +1,17 @@
{
"type": "naturesaura:animal_spawner",
"ingredients": [
{
"item": "naturesaura:birth_spirit"
},
{
"item": "minecraft:rotten_flesh"
},
{
"item": "minecraft:sand"
}
],
"entity": "minecraft:husk",
"aura": 100000,
"time": 120
}

View file

@ -0,0 +1,14 @@
{
"type": "naturesaura:animal_spawner",
"ingredients": [
{
"item": "naturesaura:birth_spirit"
},
{
"tag": "minecraft:wool"
}
],
"entity": "minecraft:llama",
"aura": 60000,
"time": 80
}

View file

@ -0,0 +1,14 @@
{
"type": "naturesaura:animal_spawner",
"ingredients": [
{
"item": "naturesaura:birth_spirit"
},
{
"item": "minecraft:magma_cream"
}
],
"entity": "minecraft:magma_cube",
"aura": 100000,
"time": 100
}

View file

@ -0,0 +1,17 @@
{
"type": "naturesaura:animal_spawner",
"ingredients": [
{
"item": "naturesaura:birth_spirit"
},
{
"item": "minecraft:leather"
},
{
"item": "minecraft:red_mushroom"
}
],
"entity": "minecraft:mooshroom",
"aura": 40000,
"time": 60
}

View file

@ -0,0 +1,20 @@
{
"type": "naturesaura:animal_spawner",
"ingredients": [
{
"item": "naturesaura:birth_spirit"
},
{
"item": "minecraft:leather"
},
{
"item": "minecraft:chest"
},
{
"item": "minecraft:apple"
}
],
"entity": "minecraft:mule",
"aura": 100000,
"time": 100
}

View file

@ -0,0 +1,17 @@
{
"type": "naturesaura:animal_spawner",
"ingredients": [
{
"item": "naturesaura:birth_spirit"
},
{
"tag": "minecraft:fishes"
},
{
"tag": "minecraft:wool"
}
],
"entity": "minecraft:ocelot",
"aura": 80000,
"time": 60
}

View file

@ -0,0 +1,17 @@
{
"type": "naturesaura:animal_spawner",
"ingredients": [
{
"item": "naturesaura:birth_spirit"
},
{
"item": "minecraft:bamboo"
},
{
"item": "minecraft:jungle_sapling"
}
],
"entity": "minecraft:panda",
"aura": 100000,
"time": 100
}

View file

@ -0,0 +1,17 @@
{
"type": "naturesaura:animal_spawner",
"ingredients": [
{
"item": "naturesaura:birth_spirit"
},
{
"item": "minecraft:feather"
},
{
"item": "minecraft:cookie"
}
],
"entity": "minecraft:parrot",
"aura": 50000,
"time": 60
}

View file

@ -0,0 +1,14 @@
{
"type": "naturesaura:animal_spawner",
"ingredients": [
{
"item": "naturesaura:birth_spirit"
},
{
"item": "minecraft:phantom_membrane"
}
],
"entity": "minecraft:phantom",
"aura": 200000,
"time": 200
}

View file

@ -0,0 +1,14 @@
{
"type": "naturesaura:animal_spawner",
"ingredients": [
{
"item": "naturesaura:birth_spirit"
},
{
"item": "minecraft:porkchop"
}
],
"entity": "minecraft:pig",
"aura": 50000,
"time": 60
}

View file

@ -0,0 +1,17 @@
{
"type": "naturesaura:animal_spawner",
"ingredients": [
{
"item": "naturesaura:birth_spirit"
},
{
"item": "minecraft:cod"
},
{
"item": "minecraft:ice"
}
],
"entity": "minecraft:polar_bear",
"aura": 50000,
"time": 60
}

View file

@ -0,0 +1,14 @@
{
"type": "naturesaura:animal_spawner",
"ingredients": [
{
"item": "naturesaura:birth_spirit"
},
{
"item": "minecraft:rabbit_hide"
}
],
"entity": "minecraft:rabbit",
"aura": 30000,
"time": 40
}

View file

@ -0,0 +1,17 @@
{
"type": "naturesaura:animal_spawner",
"ingredients": [
{
"item": "naturesaura:birth_spirit"
},
{
"item": "minecraft:mutton"
},
{
"item": "minecraft:black_wool"
}
],
"entity": "minecraft:sheep",
"aura": 500,
"time": 60
}

View file

@ -0,0 +1,17 @@
{
"type": "naturesaura:animal_spawner",
"ingredients": [
{
"item": "naturesaura:birth_spirit"
},
{
"item": "minecraft:mutton"
},
{
"item": "minecraft:blue_wool"
}
],
"entity": "minecraft:sheep",
"aura": 500,
"time": 60
}

View file

@ -0,0 +1,17 @@
{
"type": "naturesaura:animal_spawner",
"ingredients": [
{
"item": "naturesaura:birth_spirit"
},
{
"item": "minecraft:mutton"
},
{
"item": "minecraft:brown_wool"
}
],
"entity": "minecraft:sheep",
"aura": 500,
"time": 60
}

View file

@ -0,0 +1,17 @@
{
"type": "naturesaura:animal_spawner",
"ingredients": [
{
"item": "naturesaura:birth_spirit"
},
{
"item": "minecraft:mutton"
},
{
"item": "minecraft:cyan_wool"
}
],
"entity": "minecraft:sheep",
"aura": 500,
"time": 60
}

View file

@ -0,0 +1,17 @@
{
"type": "naturesaura:animal_spawner",
"ingredients": [
{
"item": "naturesaura:birth_spirit"
},
{
"item": "minecraft:mutton"
},
{
"item": "minecraft:gray_wool"
}
],
"entity": "minecraft:sheep",
"aura": 500,
"time": 60
}

View file

@ -0,0 +1,17 @@
{
"type": "naturesaura:animal_spawner",
"ingredients": [
{
"item": "naturesaura:birth_spirit"
},
{
"item": "minecraft:mutton"
},
{
"item": "minecraft:green_wool"
}
],
"entity": "minecraft:sheep",
"aura": 500,
"time": 60
}

View file

@ -0,0 +1,17 @@
{
"type": "naturesaura:animal_spawner",
"ingredients": [
{
"item": "naturesaura:birth_spirit"
},
{
"item": "minecraft:mutton"
},
{
"item": "minecraft:light_blue_wool"
}
],
"entity": "minecraft:sheep",
"aura": 500,
"time": 60
}

Some files were not shown because too many files have changed in this diff Show more