mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-18 03:15:07 +00:00
Move mana infusion to json
This commit is contained in:
1 parent
80dc95684e
commit
7ff539c5cd
143 files changed
+2020
-423
No files matched your search
@@ -62,7 +62,6 @@ public final class BotaniaAPI {
|
||||
*/
|
||||
public static Map<ResourceLocation, RecipePetals> petalRecipes = Collections.emptyMap();
|
||||
public static Map<ResourceLocation, RecipePureDaisy> pureDaisyRecipes = Collections.emptyMap();
|
||||
public static Map<ResourceLocation, RecipeManaInfusion> manaInfusionRecipes = Collections.emptyMap();
|
||||
public static Map<ResourceLocation, RecipeRuneAltar> runeAltarRecipes = Collections.emptyMap();
|
||||
public static Map<ResourceLocation, RecipeBrew> brewRecipes = Collections.emptyMap();
|
||||
|
||||
|
||||
@@ -10,17 +10,36 @@ package vazkii.botania.api.recipe;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.mojang.brigadier.StringReader;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.command.arguments.BlockStateParser;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
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.item.crafting.Ingredient;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.JSONUtils;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.crafting.CraftingHelper;
|
||||
import net.minecraftforge.registries.ForgeRegistryEntry;
|
||||
import net.minecraftforge.registries.ObjectHolder;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.crafting.ModRecipeTypes;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Objects;
|
||||
|
||||
public class RecipeManaInfusion {
|
||||
public class RecipeManaInfusion implements IRecipe<IInventory> {
|
||||
@ObjectHolder("botania:alchemy_catalyst") public static Block alchemy;
|
||||
|
||||
@ObjectHolder("botania:conjuration_catalyst") public static Block conjuration;
|
||||
@@ -32,26 +51,6 @@ public class RecipeManaInfusion {
|
||||
@Nullable private BlockState catalystState;
|
||||
private final String group;
|
||||
|
||||
public static RecipeManaInfusion conjuration(ResourceLocation id, ItemStack output, Ingredient input, int mana) {
|
||||
RecipeManaInfusion ret = new RecipeManaInfusion(id, output, input, mana);
|
||||
ret.setCatalyst(conjuration.getDefaultState());
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static RecipeManaInfusion alchemy(ResourceLocation id, ItemStack output, Ingredient input, int mana) {
|
||||
return alchemy(id, output, input, mana, null);
|
||||
}
|
||||
|
||||
public static RecipeManaInfusion alchemy(ResourceLocation id, ItemStack output, Ingredient input, int mana, @Nullable String group) {
|
||||
RecipeManaInfusion ret = new RecipeManaInfusion(id, output, input, mana, group);
|
||||
ret.setCatalyst(alchemy.getDefaultState());
|
||||
return ret;
|
||||
}
|
||||
|
||||
public RecipeManaInfusion(ResourceLocation id, ItemStack output, Ingredient input, int mana) {
|
||||
this(id, output, input, mana, null);
|
||||
}
|
||||
|
||||
public RecipeManaInfusion(ResourceLocation id, ItemStack output, Ingredient input, int mana, @Nullable String group) {
|
||||
this.id = id;
|
||||
this.output = output;
|
||||
@@ -61,10 +60,24 @@ public class RecipeManaInfusion {
|
||||
this.group = group == null ? "" : group;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public final ResourceLocation getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeSerializer<RecipeManaInfusion> getSerializer() {
|
||||
return ModRecipeTypes.MANA_INFUSION_SERIALIZER;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeType<?> getType() {
|
||||
return ModRecipeTypes.MANA_INFUSION_TYPE;
|
||||
}
|
||||
|
||||
public boolean matches(ItemStack stack) {
|
||||
return input.test(stack);
|
||||
}
|
||||
@@ -74,7 +87,7 @@ public class RecipeManaInfusion {
|
||||
return catalystState;
|
||||
}
|
||||
|
||||
public void setCatalyst(BlockState catalyst) {
|
||||
public void setCatalyst(@Nullable BlockState catalyst) {
|
||||
catalystState = catalyst;
|
||||
}
|
||||
|
||||
@@ -82,36 +95,97 @@ public class RecipeManaInfusion {
|
||||
return input;
|
||||
}
|
||||
|
||||
public ItemStack getOutput() {
|
||||
return output;
|
||||
}
|
||||
|
||||
public int getManaToConsume() {
|
||||
return mana;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() {
|
||||
return output;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public NonNullList<Ingredient> getIngredients() {
|
||||
return NonNullList.from(input);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getGroup() {
|
||||
return group;
|
||||
}
|
||||
|
||||
public void write(PacketBuffer buf) {
|
||||
buf.writeResourceLocation(id);
|
||||
input.write(buf);
|
||||
buf.writeItemStack(output, false);
|
||||
buf.writeVarInt(mana);
|
||||
buf.writeInt(catalystState == null ? -1 : Block.getStateId(catalystState));
|
||||
buf.writeString(group);
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack getIcon() {
|
||||
return new ItemStack(ModBlocks.manaPool);
|
||||
}
|
||||
|
||||
public static RecipeManaInfusion read(PacketBuffer buf) {
|
||||
ResourceLocation id = buf.readResourceLocation();
|
||||
Ingredient input = Ingredient.read(buf);
|
||||
ItemStack output = buf.readItemStack();
|
||||
int mana = buf.readVarInt();
|
||||
int catalystId = buf.readInt();
|
||||
String group = buf.readString();
|
||||
RecipeManaInfusion ret = new RecipeManaInfusion(id, output, input, mana, group);
|
||||
ret.setCatalyst(catalystId == -1 ? null : Block.getStateById(catalystId));
|
||||
return ret;
|
||||
// Ignored IRecipe stuff
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack getCraftingResult(@Nonnull IInventory inv) {
|
||||
return output;
|
||||
}
|
||||
@Override
|
||||
public boolean matches(@Nonnull IInventory inv, @Nonnull World world) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFit(int width, int height) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class Serializer extends ForgeRegistryEntry<IRecipeSerializer<?>> implements IRecipeSerializer<RecipeManaInfusion> {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public RecipeManaInfusion read(@Nonnull ResourceLocation id, @Nonnull JsonObject json) {
|
||||
JsonElement input = Objects.requireNonNull(json.get("input"));
|
||||
Ingredient ing = Ingredient.deserialize(input);
|
||||
ItemStack output = CraftingHelper.getItemStack(JSONUtils.getJsonObject(json, "output"), true);
|
||||
int mana = JSONUtils.getInt(json, "mana");
|
||||
String group = JSONUtils.getString(json, "group", "");
|
||||
String catalyst = JSONUtils.getString(json, "catalyst", "");
|
||||
BlockState catalystState = null;
|
||||
if (!catalyst.isEmpty()) {
|
||||
try {
|
||||
BlockStateParser parser = new BlockStateParser(new StringReader(catalyst), false).parse(false);
|
||||
catalystState = parser.getState();
|
||||
} catch (CommandSyntaxException e) {
|
||||
throw new JsonParseException("Failure reading catalyst state", e);
|
||||
}
|
||||
}
|
||||
|
||||
RecipeManaInfusion ret = new RecipeManaInfusion(id, output, ing, mana, group);
|
||||
ret.setCatalyst(catalystState);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public RecipeManaInfusion read(@Nonnull ResourceLocation id, @Nonnull PacketBuffer buf) {
|
||||
Ingredient input = Ingredient.read(buf);
|
||||
ItemStack output = buf.readItemStack();
|
||||
int mana = buf.readVarInt();
|
||||
int catalystId = buf.readInt();
|
||||
String group = buf.readString();
|
||||
RecipeManaInfusion ret = new RecipeManaInfusion(id, output, input, mana, group);
|
||||
ret.setCatalyst(catalystId == -1 ? null : Block.getStateById(catalystId));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(@Nonnull PacketBuffer buf, @Nonnull RecipeManaInfusion recipe) {
|
||||
recipe.getInput().write(buf);
|
||||
buf.writeItemStack(recipe.getRecipeOutput(), false);
|
||||
buf.writeVarInt(recipe.getManaToConsume());
|
||||
buf.writeInt(recipe.getCatalyst() == null ? -1 : Block.getStateId(recipe.getCatalyst()));
|
||||
buf.writeString(recipe.getGroup());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,16 +21,14 @@ import java.util.function.Consumer;
|
||||
*/
|
||||
public class RegisterRecipesEvent extends Event {
|
||||
private final Consumer<RecipePureDaisy> pureDaisy;
|
||||
private final Consumer<RecipeManaInfusion> manaInfusion;
|
||||
private final Consumer<RecipeBrew> brew;
|
||||
private final Consumer<RecipePetals> apothecary;
|
||||
private final Consumer<RecipeRuneAltar> runeAltar;
|
||||
|
||||
public RegisterRecipesEvent(Consumer<RecipePureDaisy> pureDaisy, Consumer<RecipeManaInfusion> manaInfusion,
|
||||
Consumer<RecipeBrew> brew,
|
||||
Consumer<RecipePetals> apothecary, Consumer<RecipeRuneAltar> runeAltar) {
|
||||
public RegisterRecipesEvent(Consumer<RecipePureDaisy> pureDaisy,
|
||||
Consumer<RecipeBrew> brew,
|
||||
Consumer<RecipePetals> apothecary, Consumer<RecipeRuneAltar> runeAltar) {
|
||||
this.pureDaisy = pureDaisy;
|
||||
this.manaInfusion = manaInfusion;
|
||||
this.brew = brew;
|
||||
this.apothecary = apothecary;
|
||||
this.runeAltar = runeAltar;
|
||||
@@ -40,10 +38,6 @@ public class RegisterRecipesEvent extends Event {
|
||||
return pureDaisy;
|
||||
}
|
||||
|
||||
public Consumer<RecipeManaInfusion> manaInfusion() {
|
||||
return manaInfusion;
|
||||
}
|
||||
|
||||
public Consumer<RecipeBrew> brew() {
|
||||
return brew;
|
||||
}
|
||||
|
||||
@@ -278,7 +278,7 @@ public final class HUDHandler {
|
||||
IProfiler profiler = mc.getProfiler();
|
||||
|
||||
profiler.startSection("poolRecipe");
|
||||
RecipeManaInfusion recipe = TilePool.getMatchingRecipe(stack, tile.getWorld().getBlockState(tile.getPos().down()));
|
||||
RecipeManaInfusion recipe = tile.getMatchingRecipe(stack, tile.getWorld().getBlockState(tile.getPos().down()));
|
||||
if (recipe != null) {
|
||||
int x = mc.getWindow().getScaledWidth() / 2 - 11;
|
||||
int y = mc.getWindow().getScaledHeight() / 2 + 10;
|
||||
@@ -294,8 +294,8 @@ public final class HUDHandler {
|
||||
RenderSystem.color4f(1F, 1F, 1F, 1F);
|
||||
|
||||
mc.getItemRenderer().renderItemAndEffectIntoGUI(stack, x - 20, y);
|
||||
mc.getItemRenderer().renderItemAndEffectIntoGUI(recipe.getOutput(), x + 26, y);
|
||||
mc.getItemRenderer().renderItemOverlays(mc.fontRenderer, recipe.getOutput(), x + 26, y);
|
||||
mc.getItemRenderer().renderItemAndEffectIntoGUI(recipe.getRecipeOutput(), x + 26, y);
|
||||
mc.getItemRenderer().renderItemOverlays(mc.fontRenderer, recipe.getRecipeOutput(), x + 26, y);
|
||||
|
||||
RenderSystem.disableLighting();
|
||||
RenderSystem.disableBlend();
|
||||
|
||||
@@ -49,6 +49,7 @@ import vazkii.botania.client.integration.jei.runicaltar.RunicAltarRecipeCategory
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.ModSubtiles;
|
||||
import vazkii.botania.common.block.tile.TileAlfPortal;
|
||||
import vazkii.botania.common.block.tile.mana.TilePool;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
import vazkii.botania.common.crafting.AbstractElvenTradeRecipe;
|
||||
import vazkii.botania.common.crafting.LexiconElvenTradeRecipe;
|
||||
@@ -124,7 +125,7 @@ public class JEIBotaniaPlugin implements IModPlugin {
|
||||
registry.addRecipes(BotaniaAPI.petalRecipes.values(), PetalApothecaryRecipeCategory.UID);
|
||||
registry.addRecipes(TileAlfPortal.elvenTradeRecipes(Minecraft.getInstance().world.getRecipeManager()), ElvenTradeRecipeCategory.UID);
|
||||
registry.addRecipes(BotaniaAPI.runeAltarRecipes.values(), RunicAltarRecipeCategory.UID);
|
||||
registry.addRecipes(BotaniaAPI.manaInfusionRecipes.values(), ManaPoolRecipeCategory.UID);
|
||||
registry.addRecipes(TilePool.manaInfusionRecipes(Minecraft.getInstance().world.getRecipeManager()), ManaPoolRecipeCategory.UID);
|
||||
|
||||
registry.addRecipes(
|
||||
BotaniaAPI.oreWeights.entrySet().stream()
|
||||
|
||||
+1
-1
@@ -98,7 +98,7 @@ public class ManaPoolRecipeCategory implements IRecipeCategory<RecipeManaInfusio
|
||||
}
|
||||
|
||||
iIngredients.setInputLists(VanillaTypes.ITEM, builder.build());
|
||||
iIngredients.setOutput(VanillaTypes.ITEM, recipe.getOutput());
|
||||
iIngredients.setOutput(VanillaTypes.ITEM, recipe.getRecipeOutput());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,8 +10,10 @@ package vazkii.botania.client.patchouli.processor;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
||||
@@ -20,6 +22,8 @@ import vazkii.botania.api.recipe.RecipeManaInfusion;
|
||||
import vazkii.botania.client.core.helper.RenderHelper;
|
||||
import vazkii.botania.client.patchouli.PatchouliUtils;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.tile.mana.TilePool;
|
||||
import vazkii.botania.common.crafting.ModRecipeTypes;
|
||||
import vazkii.patchouli.api.IComponentProcessor;
|
||||
import vazkii.patchouli.api.IVariableProvider;
|
||||
import vazkii.patchouli.api.PatchouliAPI;
|
||||
@@ -40,14 +44,14 @@ public class ManaInfusionProcessor implements IComponentProcessor {
|
||||
ImmutableList.Builder<RecipeManaInfusion> builder = ImmutableList.builder();
|
||||
if (variables.has("group")) {
|
||||
String group = variables.get("group");
|
||||
BotaniaAPI.manaInfusionRecipes.values().stream()
|
||||
TilePool.manaInfusionRecipes(Minecraft.getInstance().world.getRecipeManager()).stream()
|
||||
.filter(r -> r.getGroup().equals(group))
|
||||
.forEach(builder::add);
|
||||
} else {
|
||||
for (String s : variables.get("recipes").split(";")) {
|
||||
RecipeManaInfusion recipe = BotaniaAPI.manaInfusionRecipes.get(new ResourceLocation(s));
|
||||
if (recipe != null) {
|
||||
builder.add(recipe);
|
||||
IRecipe<?> recipe = Minecraft.getInstance().world.getRecipeManager().getRecipes(ModRecipeTypes.MANA_INFUSION_TYPE).get(new ResourceLocation(s));
|
||||
if (recipe instanceof RecipeManaInfusion) {
|
||||
builder.add((RecipeManaInfusion) recipe);
|
||||
} else {
|
||||
Botania.LOGGER.warn("Mana infusion template references nonexistent recipe {}", s);
|
||||
}
|
||||
@@ -66,13 +70,13 @@ public class ManaInfusionProcessor implements IComponentProcessor {
|
||||
switch (key) {
|
||||
case "heading":
|
||||
if (!hasCustomHeading) {
|
||||
return recipes.get(0).getOutput().getDisplayName().getString();
|
||||
return recipes.get(0).getRecipeOutput().getDisplayName().getString();
|
||||
}
|
||||
return null;
|
||||
case "input":
|
||||
return PatchouliUtils.interweaveIngredients(recipes.stream().map(RecipeManaInfusion::getInput).collect(Collectors.toList()));
|
||||
case "output":
|
||||
return recipes.stream().map(RecipeManaInfusion::getOutput).map(PatchouliAPI.instance::serializeItemStack).collect(Collectors.joining(","));
|
||||
return recipes.stream().map(RecipeManaInfusion::getRecipeOutput).map(PatchouliAPI.instance::serializeItemStack).collect(Collectors.joining(","));
|
||||
case "catalyst":
|
||||
return recipes.stream().map(RecipeManaInfusion::getCatalyst)
|
||||
.map(state -> {
|
||||
|
||||
@@ -20,6 +20,7 @@ import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.item.DyeColor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.RecipeManager;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.network.play.server.SUpdateTileEntityPacket;
|
||||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
@@ -58,6 +59,7 @@ import vazkii.botania.common.core.handler.ManaNetworkHandler;
|
||||
import vazkii.botania.common.core.handler.ModSounds;
|
||||
import vazkii.botania.common.core.helper.MathHelper;
|
||||
import vazkii.botania.common.core.helper.Vector3;
|
||||
import vazkii.botania.common.crafting.ModRecipeTypes;
|
||||
import vazkii.botania.common.item.ItemManaTablet;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
@@ -67,6 +69,7 @@ import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAttachable, IThrottledPacket, ITickableTileEntity {
|
||||
@ObjectHolder(LibMisc.MOD_ID + ":" + LibBlockNames.POOL) public static TileEntityType<TilePool> TYPE;
|
||||
@@ -146,11 +149,18 @@ public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAt
|
||||
return val;
|
||||
}
|
||||
|
||||
public static RecipeManaInfusion getMatchingRecipe(@Nonnull ItemStack stack, @Nonnull BlockState state) {
|
||||
public static List<RecipeManaInfusion> manaInfusionRecipes(RecipeManager rm) {
|
||||
return rm.getRecipes(ModRecipeTypes.MANA_INFUSION_TYPE).values().stream()
|
||||
.filter(r -> r instanceof RecipeManaInfusion)
|
||||
.map(r -> (RecipeManaInfusion) r)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public RecipeManaInfusion getMatchingRecipe(@Nonnull ItemStack stack, @Nonnull BlockState state) {
|
||||
List<RecipeManaInfusion> matchingNonCatRecipes = new ArrayList<>();
|
||||
List<RecipeManaInfusion> matchingCatRecipes = new ArrayList<>();
|
||||
|
||||
for (RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes.values()) {
|
||||
for (RecipeManaInfusion recipe : manaInfusionRecipes(world.getRecipeManager())) {
|
||||
if (recipe.matches(stack)) {
|
||||
if (recipe.getCatalyst() == null) {
|
||||
matchingNonCatRecipes.add(recipe);
|
||||
@@ -189,7 +199,7 @@ public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAt
|
||||
stack.shrink(1);
|
||||
item.onGround = false; //Force entity collision update to run every tick if crafting is in progress
|
||||
|
||||
ItemStack output = recipe.getOutput().copy();
|
||||
ItemStack output = recipe.getRecipeOutput().copy();
|
||||
ItemEntity outputItem = new ItemEntity(world, pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5, output);
|
||||
outputItem.age = 105;
|
||||
world.addEntity(outputItem);
|
||||
|
||||
@@ -1,131 +0,0 @@
|
||||
/*
|
||||
* This class is distributed as part of the Botania Mod.
|
||||
* Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.common.crafting;
|
||||
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.util.IItemProvider;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
import vazkii.botania.api.recipe.RecipeManaInfusion;
|
||||
import vazkii.botania.api.recipe.RegisterRecipesEvent;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.ModFluffBlocks;
|
||||
import vazkii.botania.common.block.ModSubtiles;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import static vazkii.botania.common.lib.ResourceLocationHelper.prefix;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID)
|
||||
public final class ModManaAlchemyRecipes {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void register(RegisterRecipesEvent evt) {
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.alchemy(prefix("rotten_flesh_to_leather"), new ItemStack(Items.LEATHER), Ingredient.fromItems(Items.ROTTEN_FLESH), 600));
|
||||
|
||||
cycle(evt.manaInfusion(), 40, "botania:log_cycle", Blocks.OAK_LOG, Blocks.SPRUCE_LOG, Blocks.BIRCH_LOG, Blocks.JUNGLE_LOG, Blocks.ACACIA_LOG, Blocks.DARK_OAK_LOG);
|
||||
cycle(evt.manaInfusion(), 120, "botania:sapling_cycle", Blocks.OAK_SAPLING, Blocks.SPRUCE_SAPLING, Blocks.BIRCH_SAPLING, Blocks.JUNGLE_SAPLING, Blocks.ACACIA_SAPLING, Blocks.DARK_OAK_SAPLING);
|
||||
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.alchemy(prefix("glowstone_deconstruct"), new ItemStack(Items.GLOWSTONE_DUST, 4), Ingredient.fromItems(Blocks.GLOWSTONE), 25));
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.alchemy(prefix("quartz_deconstruct"), new ItemStack(Items.QUARTZ, 4), Ingredient.fromItems(Blocks.QUARTZ_BLOCK), 25));
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.alchemy(prefix("dark_quartz_deconstruct"), new ItemStack(ModItems.darkQuartz, 4), Ingredient.fromItems(ModFluffBlocks.darkQuartz), 25));
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.alchemy(prefix("mana_quartz_deconstruct"), new ItemStack(ModItems.manaQuartz, 4), Ingredient.fromItems(ModFluffBlocks.manaQuartz), 25));
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.alchemy(prefix("blaze_quartz_deconstruct"), new ItemStack(ModItems.blazeQuartz, 4), Ingredient.fromItems(ModFluffBlocks.blazeQuartz), 25));
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.alchemy(prefix("lavender_quartz_deconstruct"), new ItemStack(ModItems.lavenderQuartz, 4), Ingredient.fromItems(ModFluffBlocks.lavenderQuartz), 25));
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.alchemy(prefix("red_quartz_deconstruct"), new ItemStack(ModItems.redQuartz, 4), Ingredient.fromItems(ModFluffBlocks.redQuartz), 25));
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.alchemy(prefix("elf_quartz_deconstruct"), new ItemStack(ModItems.elfQuartz, 4), Ingredient.fromItems(ModFluffBlocks.elfQuartz), 25));
|
||||
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.alchemy(prefix("chiseled_stone_bricks"), new ItemStack(Blocks.CHISELED_STONE_BRICKS, 1), Ingredient.fromItems(Blocks.STONE_BRICKS), 150));
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.alchemy(prefix("ice"), new ItemStack(Blocks.ICE), Ingredient.fromItems(Blocks.SNOW_BLOCK), 2250));
|
||||
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.alchemy(prefix("vine_to_lily_pad"), new ItemStack(Blocks.LILY_PAD), Ingredient.fromItems(Blocks.VINE), 320));
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.alchemy(prefix("lily_pad_to_vine"), new ItemStack(Blocks.VINE), Ingredient.fromItems(Blocks.LILY_PAD), 320));
|
||||
|
||||
cycle(evt.manaInfusion(), 200, "botania:fish_cycle", Items.COD, Items.SALMON, Items.TROPICAL_FISH, Items.PUFFERFISH);
|
||||
cycle(evt.manaInfusion(), 6000, "botania:crop_cycle", Items.COCOA_BEANS, Items.WHEAT_SEEDS, Items.POTATO, Items.CARROT, Items.BEETROOT_SEEDS, Items.MELON_SEEDS, Items.PUMPKIN_SEEDS);
|
||||
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.alchemy(prefix("potato_unpoison"), new ItemStack(Items.POTATO), Ingredient.fromItems(Items.POISONOUS_POTATO), 1200));
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.alchemy(prefix("blaze_rod_to_nether_wart"), new ItemStack(Items.NETHER_WART), Ingredient.fromItems(Items.BLAZE_ROD), 4000));
|
||||
|
||||
cycle(evt.manaInfusion(), 200, null, Items.GUNPOWDER, Items.FLINT);
|
||||
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.alchemy(prefix("book_to_name_tag"), new ItemStack(Items.NAME_TAG), Ingredient.fromItems(Items.WRITABLE_BOOK), 16000));
|
||||
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.alchemy(prefix("wool_deconstruct"), new ItemStack(Items.STRING, 3), Ingredient.fromTag(ItemTags.WOOL), 100));
|
||||
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.alchemy(prefix("cactus_to_slime"), new ItemStack(Items.SLIME_BALL), Ingredient.fromItems(Blocks.CACTUS), 1200));
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.alchemy(prefix("slime_to_cactus"), new ItemStack(Blocks.CACTUS), Ingredient.fromItems(Items.SLIME_BALL), 1200));
|
||||
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.alchemy(prefix("ender_pearl_from_ghast_tear"), new ItemStack(Items.ENDER_PEARL), Ingredient.fromItems(Items.GHAST_TEAR), 28000));
|
||||
|
||||
cycle(evt.manaInfusion(), 300, null, Items.GLOWSTONE_DUST, Items.REDSTONE);
|
||||
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.alchemy(prefix("cobble_to_sand"), new ItemStack(Blocks.SAND), Ingredient.fromItems(Blocks.COBBLESTONE), 50));
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.alchemy(prefix("terracotta_to_red_sand"), new ItemStack(Blocks.RED_SAND), Ingredient.fromItems(Blocks.TERRACOTTA), 50));
|
||||
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.alchemy(prefix("clay_deconstruct"), new ItemStack(Items.CLAY_BALL, 4), Ingredient.fromItems(Blocks.CLAY), 25));
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.alchemy(prefix("brick_deconstruct"), new ItemStack(Items.BRICK, 4), Ingredient.fromItems(Blocks.BRICKS), 25));
|
||||
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.alchemy(prefix("coarse_dirt"), new ItemStack(Blocks.COARSE_DIRT), Ingredient.fromItems(Blocks.DIRT), 120));
|
||||
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.alchemy(prefix("stone_to_andesite"), new ItemStack(Blocks.ANDESITE), Ingredient.fromItems(Blocks.STONE), 200));
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.alchemy(prefix("andesite_to_diorite"), new ItemStack(Blocks.DIORITE), Ingredient.fromItems(Blocks.ANDESITE), 200));
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.alchemy(prefix("diorite_to_granite"), new ItemStack(Blocks.GRANITE), Ingredient.fromItems(Blocks.DIORITE), 200));
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.alchemy(prefix("granite_to_andesite"), new ItemStack(Blocks.ANDESITE), Ingredient.fromItems(Blocks.GRANITE), 200));
|
||||
|
||||
cycle(evt.manaInfusion(), 500, "botania:shrub_cycle", Blocks.FERN, Blocks.DEAD_BUSH, Blocks.GRASS);
|
||||
|
||||
// NB: No wither rose is intentional
|
||||
cycle(evt.manaInfusion(), 400, "botania:flower_cycle", Blocks.DANDELION, Blocks.POPPY, Blocks.BLUE_ORCHID, Blocks.ALLIUM, Blocks.AZURE_BLUET, Blocks.RED_TULIP, Blocks.ORANGE_TULIP,
|
||||
Blocks.WHITE_TULIP, Blocks.PINK_TULIP, Blocks.OXEYE_DAISY, Blocks.CORNFLOWER, Blocks.LILY_OF_THE_VALLEY,
|
||||
Blocks.SUNFLOWER, Blocks.LILAC, Blocks.ROSE_BUSH, Blocks.PEONY);
|
||||
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.alchemy(prefix("chorus_fruit_to_flower"), new ItemStack(Blocks.CHORUS_FLOWER), Ingredient.fromItems(Items.POPPED_CHORUS_FRUIT), 10000));
|
||||
|
||||
cycle(evt.manaInfusion(), 240, "botania:berry_cycle", Items.APPLE, Items.SWEET_BERRIES);
|
||||
|
||||
if (Botania.gardenOfGlassLoaded) {
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.alchemy(prefix("prismarine_shard_gog"), new ItemStack(Items.PRISMARINE_SHARD), Ingredient.fromItems(Items.QUARTZ), 1000));
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.alchemy(prefix("prismarine_crystals_gog"), new ItemStack(Items.PRISMARINE_CRYSTALS), Ingredient.fromItems(Items.PRISMARINE_SHARD), 500));
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.alchemy(prefix("heart_of_the_sea"), new ItemStack(Items.HEART_OF_THE_SEA), Ingredient.fromItems(Items.NAUTILUS_SHELL), 20000));
|
||||
}
|
||||
|
||||
evt.manaInfusion().accept(mini(ModSubtiles.agricarnationChibi, ModSubtiles.agricarnation));
|
||||
evt.manaInfusion().accept(mini(ModSubtiles.clayconiaChibi, ModSubtiles.clayconia));
|
||||
evt.manaInfusion().accept(mini(ModSubtiles.bellethornChibi, ModSubtiles.bellethorn));
|
||||
evt.manaInfusion().accept(mini(ModSubtiles.bubbellChibi, ModSubtiles.bubbell));
|
||||
evt.manaInfusion().accept(mini(ModSubtiles.hopperhockChibi, ModSubtiles.hopperhock));
|
||||
evt.manaInfusion().accept(mini(ModSubtiles.marimorphosisChibi, ModSubtiles.marimorphosis));
|
||||
evt.manaInfusion().accept(mini(ModSubtiles.rannuncarpusChibi, ModSubtiles.rannuncarpus));
|
||||
evt.manaInfusion().accept(mini(ModSubtiles.solegnoliaChibi, ModSubtiles.solegnolia));
|
||||
}
|
||||
|
||||
private static void cycle(Consumer<RecipeManaInfusion> consumer, int cost, @Nullable String group, IItemProvider... items) {
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
Ingredient in = Ingredient.fromItems(items[i]);
|
||||
ItemStack out = new ItemStack(i == items.length - 1 ? items[0] : items[i + 1]);
|
||||
String id = String.format("%s_to_%s", items[i].asItem().getRegistryName().getPath(), out.getItem().getRegistryName().getPath());
|
||||
consumer.accept(RecipeManaInfusion.alchemy(new ResourceLocation(LibMisc.MOD_ID, id), out, in, cost, group));
|
||||
}
|
||||
}
|
||||
|
||||
private static RecipeManaInfusion mini(IItemProvider mini, IItemProvider full) {
|
||||
return RecipeManaInfusion.alchemy(mini.asItem().getRegistryName(), new ItemStack(mini), Ingredient.fromItems(full), 2500);
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
/*
|
||||
* This class is distributed as part of the Botania Mod.
|
||||
* Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.common.crafting;
|
||||
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.IItemProvider;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
import vazkii.botania.api.recipe.RecipeManaInfusion;
|
||||
import vazkii.botania.api.recipe.RegisterRecipesEvent;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static vazkii.botania.common.lib.ResourceLocationHelper.prefix;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID)
|
||||
public class ModManaConjurationRecipes {
|
||||
|
||||
public static RecipeManaInfusion redstoneRecipe;
|
||||
public static RecipeManaInfusion glowstoneRecipe;
|
||||
public static RecipeManaInfusion quartzRecipe;
|
||||
public static RecipeManaInfusion coalRecipe;
|
||||
public static RecipeManaInfusion snowballRecipe;
|
||||
public static RecipeManaInfusion netherrackRecipe;
|
||||
public static RecipeManaInfusion soulSandRecipe;
|
||||
public static RecipeManaInfusion gravelRecipe;
|
||||
public static List<RecipeManaInfusion> leavesRecipes;
|
||||
public static RecipeManaInfusion grassRecipe;
|
||||
|
||||
@SubscribeEvent
|
||||
public static void register(RegisterRecipesEvent evt) {
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.conjuration(prefix("redstone_dupe"), new ItemStack(Items.REDSTONE, 2), ingr(Items.REDSTONE), 5000));
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.conjuration(prefix("glowstone_dupe"), new ItemStack(Items.GLOWSTONE_DUST, 2), ingr(Items.GLOWSTONE_DUST), 5000));
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.conjuration(prefix("quartz_dupe"), new ItemStack(Items.QUARTZ, 2), ingr(Items.QUARTZ), 2500));
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.conjuration(prefix("coal_dupe"), new ItemStack(Items.COAL, 2), ingr(Items.COAL), 2100));
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.conjuration(prefix("snowball_dupe"), new ItemStack(Items.SNOWBALL, 2), ingr(Items.SNOWBALL), 200));
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.conjuration(prefix("netherrack_dupe"), new ItemStack(Blocks.NETHERRACK, 2), ingr(Blocks.NETHERRACK), 200));
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.conjuration(prefix("soul_sand_dupe"), new ItemStack(Blocks.SOUL_SAND, 2), ingr(Blocks.SOUL_SAND), 1500));
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.conjuration(prefix("gravel_dupe"), new ItemStack(Blocks.GRAVEL, 2), ingr(Blocks.GRAVEL), 720));
|
||||
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.conjuration(prefix("oak_leaves_dupe"), new ItemStack(Blocks.OAK_LEAVES, 2), ingr(Blocks.OAK_LEAVES), 2000));
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.conjuration(prefix("birch_leaves_dupe"), new ItemStack(Blocks.BIRCH_LEAVES, 2), ingr(Blocks.BIRCH_LEAVES), 2000));
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.conjuration(prefix("spruce_leaves_dupe"), new ItemStack(Blocks.SPRUCE_LEAVES, 2), ingr(Blocks.SPRUCE_LEAVES), 2000));
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.conjuration(prefix("jungle_leaves_dupe"), new ItemStack(Blocks.JUNGLE_LEAVES, 2), ingr(Blocks.JUNGLE_LEAVES), 2000));
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.conjuration(prefix("acacia_leaves_dupe"), new ItemStack(Blocks.ACACIA_LEAVES, 2), ingr(Blocks.ACACIA_LEAVES), 2000));
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.conjuration(prefix("dark_oak_leaves_dupe"), new ItemStack(Blocks.DARK_OAK_LEAVES, 2), ingr(Blocks.DARK_OAK_LEAVES), 2000));
|
||||
|
||||
evt.manaInfusion().accept(RecipeManaInfusion.conjuration(prefix("grass"), new ItemStack(Blocks.GRASS, 2), ingr(Blocks.GRASS), 800));
|
||||
}
|
||||
|
||||
private static Ingredient ingr(IItemProvider i) {
|
||||
return Ingredient.fromItems(i);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
/*
|
||||
* This class is distributed as part of the Botania Mod.
|
||||
* Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.common.crafting;
|
||||
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.DyeColor;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.Tags;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import vazkii.botania.api.recipe.RecipeManaInfusion;
|
||||
import vazkii.botania.api.recipe.RegisterRecipesEvent;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import static vazkii.botania.common.lib.ResourceLocationHelper.prefix;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID)
|
||||
public final class ModManaInfusionRecipes {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void register(RegisterRecipesEvent evt) {
|
||||
evt.manaInfusion().accept(new RecipeManaInfusion(prefix("manasteel"), new ItemStack(ModItems.manaSteel), Ingredient.fromTag(Tags.Items.INGOTS_IRON), 3000));
|
||||
evt.manaInfusion().accept(new RecipeManaInfusion(prefix("manasteel_block"), new ItemStack(ModBlocks.manasteelBlock), Ingredient.fromItems(Blocks.IRON_BLOCK), 27000));
|
||||
|
||||
evt.manaInfusion().accept(new RecipeManaInfusion(prefix("mana_pearl"), new ItemStack(ModItems.manaPearl), Ingredient.fromItems(Items.ENDER_PEARL), 6000));
|
||||
|
||||
evt.manaInfusion().accept(new RecipeManaInfusion(prefix("mana_diamond"), new ItemStack(ModItems.manaDiamond), Ingredient.fromTag(Tags.Items.GEMS_DIAMOND), 10000));
|
||||
evt.manaInfusion().accept(new RecipeManaInfusion(prefix("mana_diamond_block"), new ItemStack(ModBlocks.manaDiamondBlock), Ingredient.fromItems(Blocks.DIAMOND_BLOCK), 90000));
|
||||
|
||||
Ingredient dust = Ingredient.fromItems(Items.GUNPOWDER, Items.REDSTONE, Items.GLOWSTONE_DUST, Items.SUGAR);
|
||||
evt.manaInfusion().accept(new RecipeManaInfusion(prefix("mana_powder_dust"), new ItemStack(ModItems.manaPowder), dust, 500));
|
||||
Ingredient dyeIngredient = Ingredient.fromItems(Arrays.stream(DyeColor.values()).map(ModItems::getDye).toArray(Item[]::new));
|
||||
evt.manaInfusion().accept(new RecipeManaInfusion(prefix("mana_powder_dye"), new ItemStack(ModItems.manaPowder), dyeIngredient, 400));
|
||||
|
||||
evt.manaInfusion().accept(new RecipeManaInfusion(prefix("piston_relay"), new ItemStack(ModBlocks.pistonRelay), Ingredient.fromItems(Blocks.PISTON), 15000));
|
||||
evt.manaInfusion().accept(new RecipeManaInfusion(prefix("mana_cookie"), new ItemStack(ModItems.manaCookie), Ingredient.fromItems(Items.COOKIE), 20000));
|
||||
evt.manaInfusion().accept(new RecipeManaInfusion(prefix("grass_seeds"), new ItemStack(ModItems.grassSeeds), Ingredient.fromItems(Blocks.GRASS), 2500));
|
||||
evt.manaInfusion().accept(new RecipeManaInfusion(prefix("podzol_seeds"), new ItemStack(ModItems.podzolSeeds), Ingredient.fromItems(Blocks.DEAD_BUSH), 2500));
|
||||
|
||||
evt.manaInfusion().accept(new RecipeManaInfusion(prefix("mycel_seeds"), new ItemStack(ModItems.mycelSeeds), Ingredient.fromItems(Blocks.RED_MUSHROOM, Blocks.BROWN_MUSHROOM), 6500));
|
||||
|
||||
evt.manaInfusion().accept(new RecipeManaInfusion(prefix("mana_quartz"), new ItemStack(ModItems.manaQuartz), Ingredient.fromItems(Items.QUARTZ), 250));
|
||||
evt.manaInfusion().accept(new RecipeManaInfusion(prefix("tiny_potato"), new ItemStack(ModBlocks.tinyPotato), Ingredient.fromItems(Items.POTATO), 1337));
|
||||
|
||||
if (Botania.thaumcraftLoaded) {
|
||||
Item inkwell = ForgeRegistries.ITEMS.getValue(new ResourceLocation("thaumcraft", "scribing_tools"));
|
||||
evt.manaInfusion().accept(new RecipeManaInfusion(prefix("mana_inkwell"), new ItemStack(ModItems.manaInkwell), Ingredient.fromItems(inkwell), 35000));
|
||||
}
|
||||
|
||||
evt.manaInfusion().accept(new RecipeManaInfusion(prefix("mana_glass"), new ItemStack(ModBlocks.manaGlass), Ingredient.fromItems(Blocks.GLASS), 150));
|
||||
evt.manaInfusion().accept(new RecipeManaInfusion(prefix("mana_string"), new ItemStack(ModItems.manaString), Ingredient.fromItems(Items.STRING), 5000));
|
||||
|
||||
if (Botania.gardenOfGlassLoaded) {
|
||||
evt.manaInfusion().accept(new RecipeManaInfusion(prefix("sugar_cane"), new ItemStack(Blocks.SUGAR_CANE), Ingredient.fromItems(Blocks.HAY_BLOCK), 2000));
|
||||
}
|
||||
|
||||
evt.manaInfusion().accept(new RecipeManaInfusion(prefix("mana_bottle"), new ItemStack(ModItems.manaBottle), Ingredient.fromItems(Items.GLASS_BOTTLE), 5000));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import vazkii.botania.api.recipe.RecipeElvenTrade;
|
||||
import vazkii.botania.api.recipe.RecipeManaInfusion;
|
||||
import vazkii.botania.api.recipe.RecipePureDaisy;
|
||||
import vazkii.botania.common.block.ModSubtiles;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
@@ -18,6 +19,8 @@ import static vazkii.botania.common.lib.ResourceLocationHelper.prefix;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||
public class ModRecipeTypes {
|
||||
public static final IRecipeType<RecipeManaInfusion> MANA_INFUSION_TYPE = new RecipeType<>();
|
||||
public static final IRecipeSerializer<RecipeManaInfusion> MANA_INFUSION_SERIALIZER = new RecipeManaInfusion.Serializer();
|
||||
public static final IRecipeType<AbstractElvenTradeRecipe> ELVEN_TRADE_TYPE = new RecipeType<>();
|
||||
public static final IRecipeSerializer<RecipeElvenTrade> ELVEN_TRADE_SERIALIZER = new RecipeElvenTrade.Serializer();
|
||||
public static final SpecialRecipeSerializer<LexiconElvenTradeRecipe> LEXICON_ELVEN_TRADE_SERIALIZER = new SpecialRecipeSerializer<>(LexiconElvenTradeRecipe::new);
|
||||
@@ -28,6 +31,10 @@ public class ModRecipeTypes {
|
||||
Registry.register(Registry.RECIPE_TYPE, id, ELVEN_TRADE_TYPE);
|
||||
evt.getRegistry().register(ELVEN_TRADE_SERIALIZER.setRegistryName(id));
|
||||
evt.getRegistry().register(LEXICON_ELVEN_TRADE_SERIALIZER.setRegistryName(prefix("elven_trade_lexicon")));
|
||||
|
||||
id = prefix("mana_infusion");
|
||||
Registry.register(Registry.RECIPE_TYPE, id, MANA_INFUSION_TYPE);
|
||||
evt.getRegistry().register(MANA_INFUSION_SERIALIZER.setRegistryName(id));
|
||||
}
|
||||
|
||||
private static class RecipeType<T extends IRecipe<?>> implements IRecipeType<T> {
|
||||
|
||||
@@ -22,7 +22,6 @@ import net.minecraftforge.fml.network.PacketDistributor;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.recipe.RecipeBrew;
|
||||
import vazkii.botania.api.recipe.RecipeElvenTrade;
|
||||
import vazkii.botania.api.recipe.RecipeManaInfusion;
|
||||
import vazkii.botania.api.recipe.RecipePetals;
|
||||
import vazkii.botania.api.recipe.RecipePureDaisy;
|
||||
@@ -43,22 +42,19 @@ public class SyncHandler {
|
||||
@Override
|
||||
public void onResourceManagerReload(@Nullable IResourceManager manager) {
|
||||
Map<ResourceLocation, RecipePureDaisy> pureDaisy = new HashMap<>();
|
||||
Map<ResourceLocation, RecipeManaInfusion> manaInfusion = new HashMap<>();
|
||||
Map<ResourceLocation, RecipeBrew> brew = new HashMap<>();
|
||||
Map<ResourceLocation, RecipePetals> apothecary = new HashMap<>();
|
||||
Map<ResourceLocation, RecipeRuneAltar> runeAltar = new HashMap<>();
|
||||
|
||||
RegisterRecipesEvent evt = new RegisterRecipesEvent(
|
||||
r -> pureDaisy.put(r.getId(), r),
|
||||
r -> manaInfusion.put(r.getId(), r),
|
||||
r -> brew.put(r.getId(), r),
|
||||
r -> brew.put(r.getId(), r),
|
||||
r -> apothecary.put(r.getId(), r),
|
||||
r -> runeAltar.put(r.getId(), r)
|
||||
);
|
||||
MinecraftForge.EVENT_BUS.post(evt);
|
||||
|
||||
BotaniaAPI.pureDaisyRecipes = ImmutableMap.copyOf(pureDaisy);
|
||||
BotaniaAPI.manaInfusionRecipes = ImmutableMap.copyOf(manaInfusion);
|
||||
BotaniaAPI.brewRecipes = ImmutableMap.copyOf(brew);
|
||||
BotaniaAPI.petalRecipes = ImmutableMap.copyOf(apothecary);
|
||||
BotaniaAPI.runeAltarRecipes = ImmutableMap.copyOf(runeAltar);
|
||||
@@ -67,8 +63,8 @@ public class SyncHandler {
|
||||
}
|
||||
|
||||
private static PacketSyncRecipes syncPacket() {
|
||||
return new PacketSyncRecipes(BotaniaAPI.brewRecipes, BotaniaAPI.manaInfusionRecipes,
|
||||
BotaniaAPI.petalRecipes, BotaniaAPI.pureDaisyRecipes, BotaniaAPI.runeAltarRecipes);
|
||||
return new PacketSyncRecipes(BotaniaAPI.brewRecipes,
|
||||
BotaniaAPI.petalRecipes, BotaniaAPI.pureDaisyRecipes, BotaniaAPI.runeAltarRecipes);
|
||||
}
|
||||
|
||||
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID, value = Dist.CLIENT)
|
||||
@@ -76,7 +72,6 @@ public class SyncHandler {
|
||||
@SubscribeEvent
|
||||
public static void clientLogout(ClientPlayerNetworkEvent.LoggedOutEvent evt) {
|
||||
BotaniaAPI.brewRecipes = Collections.emptyMap();
|
||||
BotaniaAPI.manaInfusionRecipes = Collections.emptyMap();
|
||||
BotaniaAPI.petalRecipes = Collections.emptyMap();
|
||||
BotaniaAPI.pureDaisyRecipes = Collections.emptyMap();
|
||||
BotaniaAPI.runeAltarRecipes = Collections.emptyMap();
|
||||
|
||||
@@ -15,13 +15,10 @@ import net.minecraftforge.fml.network.NetworkEvent;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.recipe.RecipeBrew;
|
||||
import vazkii.botania.api.recipe.RecipeElvenTrade;
|
||||
import vazkii.botania.api.recipe.RecipeManaInfusion;
|
||||
import vazkii.botania.api.recipe.RecipePetals;
|
||||
import vazkii.botania.api.recipe.RecipePureDaisy;
|
||||
import vazkii.botania.api.recipe.RecipeRuneAltar;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -29,14 +26,12 @@ import java.util.stream.Stream;
|
||||
|
||||
public class PacketSyncRecipes {
|
||||
private Map<ResourceLocation, RecipeBrew> brew;
|
||||
private Map<ResourceLocation, RecipeManaInfusion> manaInfusion;
|
||||
private Map<ResourceLocation, RecipePetals> petal;
|
||||
private Map<ResourceLocation, RecipePureDaisy> pureDaisy;
|
||||
private Map<ResourceLocation, RecipeRuneAltar> runeAltar;
|
||||
|
||||
public PacketSyncRecipes(Map<ResourceLocation, RecipeBrew> brew, Map<ResourceLocation, RecipeManaInfusion> manaInfusion, Map<ResourceLocation, RecipePetals> petal, Map<ResourceLocation, RecipePureDaisy> pureDaisy, Map<ResourceLocation, RecipeRuneAltar> runeAltar) {
|
||||
public PacketSyncRecipes(Map<ResourceLocation, RecipeBrew> brew, Map<ResourceLocation, RecipePetals> petal, Map<ResourceLocation, RecipePureDaisy> pureDaisy, Map<ResourceLocation, RecipeRuneAltar> runeAltar) {
|
||||
this.brew = brew;
|
||||
this.manaInfusion = manaInfusion;
|
||||
this.petal = petal;
|
||||
this.pureDaisy = pureDaisy;
|
||||
this.runeAltar = runeAltar;
|
||||
@@ -47,10 +42,6 @@ public class PacketSyncRecipes {
|
||||
for (RecipeBrew recipe : brew.values()) {
|
||||
recipe.write(buf);
|
||||
}
|
||||
buf.writeVarInt(manaInfusion.size());
|
||||
for (RecipeManaInfusion recipe : manaInfusion.values()) {
|
||||
recipe.write(buf);
|
||||
}
|
||||
buf.writeVarInt(petal.size());
|
||||
for (RecipePetals recipe : petal.values()) {
|
||||
recipe.write(buf);
|
||||
@@ -70,10 +61,6 @@ public class PacketSyncRecipes {
|
||||
Map<ResourceLocation, RecipeBrew> brew = Stream.generate(() -> RecipeBrew.read(buf))
|
||||
.limit(brewCount)
|
||||
.collect(Collectors.toMap(RecipeBrew::getId, r -> r));
|
||||
int manaInfusionCount = buf.readVarInt();
|
||||
Map<ResourceLocation, RecipeManaInfusion> manaInfusion = Stream.generate(() -> RecipeManaInfusion.read(buf))
|
||||
.limit(manaInfusionCount)
|
||||
.collect(Collectors.toMap(RecipeManaInfusion::getId, r -> r));
|
||||
int petalCount = buf.readVarInt();
|
||||
Map<ResourceLocation, RecipePetals> petal = Stream.generate(() -> RecipePetals.read(buf))
|
||||
.limit(petalCount)
|
||||
@@ -86,7 +73,7 @@ public class PacketSyncRecipes {
|
||||
Map<ResourceLocation, RecipeRuneAltar> rune = Stream.generate(() -> RecipeRuneAltar.read(buf))
|
||||
.limit(runeCount)
|
||||
.collect(Collectors.toMap(RecipeRuneAltar::getId, r -> r));
|
||||
return new PacketSyncRecipes(brew, manaInfusion, petal, pureDaisy, rune);
|
||||
return new PacketSyncRecipes(brew, petal, pureDaisy, rune);
|
||||
}
|
||||
|
||||
public void handle(Supplier<NetworkEvent.Context> ctx) {
|
||||
@@ -96,7 +83,6 @@ public class PacketSyncRecipes {
|
||||
return;
|
||||
}
|
||||
BotaniaAPI.brewRecipes = brew;
|
||||
BotaniaAPI.manaInfusionRecipes = manaInfusion;
|
||||
BotaniaAPI.petalRecipes = petal;
|
||||
BotaniaAPI.pureDaisyRecipes = pureDaisy;
|
||||
BotaniaAPI.runeAltarRecipes = runeAltar;
|
||||
@@ -111,9 +97,8 @@ public class PacketSyncRecipes {
|
||||
private int loginIndex;
|
||||
|
||||
public Login() {
|
||||
this(new PacketSyncRecipes(BotaniaAPI.brewRecipes,
|
||||
BotaniaAPI.manaInfusionRecipes, BotaniaAPI.petalRecipes,
|
||||
BotaniaAPI.pureDaisyRecipes, BotaniaAPI.runeAltarRecipes));
|
||||
this(new PacketSyncRecipes(BotaniaAPI.brewRecipes, BotaniaAPI.petalRecipes,
|
||||
BotaniaAPI.pureDaisyRecipes, BotaniaAPI.runeAltarRecipes));
|
||||
}
|
||||
|
||||
public Login(PacketSyncRecipes packet) {
|
||||
|
||||
@@ -29,6 +29,7 @@ public class DataGenerators {
|
||||
evt.getGenerator().addProvider(new ItemModelProvider(evt.getGenerator(), evt.getExistingFileHelper()));
|
||||
evt.getGenerator().addProvider(new BlockstateProvider(evt.getGenerator(), evt.getExistingFileHelper()));
|
||||
evt.getGenerator().addProvider(new ElvenTradeProvider(evt.getGenerator()));
|
||||
evt.getGenerator().addProvider(new ManaInfusionProvider(evt.getGenerator()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,287 @@
|
||||
package vazkii.botania.data;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.IFinishedRecipe;
|
||||
import net.minecraft.data.RecipeProvider;
|
||||
import net.minecraft.item.DyeColor;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.crafting.IRecipeSerializer;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.state.IProperty;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.util.IItemProvider;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.Tags;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.ModFluffBlocks;
|
||||
import vazkii.botania.common.block.ModSubtiles;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
import vazkii.botania.common.crafting.ModRecipeTypes;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Arrays;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static vazkii.botania.common.lib.ResourceLocationHelper.prefix;
|
||||
|
||||
public class ManaInfusionProvider extends RecipeProvider {
|
||||
public ManaInfusionProvider(DataGenerator gen) {
|
||||
super(gen);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Botania mana pool recipes";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerRecipes(Consumer<IFinishedRecipe> consumer) {
|
||||
consumer.accept(new FinishedRecipe(id("manasteel"), new ItemStack(ModItems.manaSteel), Ingredient.fromTag(Tags.Items.INGOTS_IRON), 3000));
|
||||
consumer.accept(new FinishedRecipe(id("manasteel_block"), new ItemStack(ModBlocks.manasteelBlock), ingr(Blocks.IRON_BLOCK), 27000));
|
||||
|
||||
consumer.accept(new FinishedRecipe(id("mana_pearl"), new ItemStack(ModItems.manaPearl), ingr(Items.ENDER_PEARL), 6000));
|
||||
|
||||
consumer.accept(new FinishedRecipe(id("mana_diamond"), new ItemStack(ModItems.manaDiamond), Ingredient.fromTag(Tags.Items.GEMS_DIAMOND), 10000));
|
||||
consumer.accept(new FinishedRecipe(id("mana_diamond_block"), new ItemStack(ModBlocks.manaDiamondBlock), ingr(Blocks.DIAMOND_BLOCK), 90000));
|
||||
|
||||
Ingredient dust = Ingredient.fromItems(Items.GUNPOWDER, Items.REDSTONE, Items.GLOWSTONE_DUST, Items.SUGAR);
|
||||
consumer.accept(new FinishedRecipe(id("mana_powder_dust"), new ItemStack(ModItems.manaPowder), dust, 500));
|
||||
Ingredient dyeIngredient = Ingredient.fromItems(Arrays.stream(DyeColor.values()).map(ModItems::getDye).toArray(Item[]::new));
|
||||
consumer.accept(new FinishedRecipe(id("mana_powder_dye"), new ItemStack(ModItems.manaPowder), dyeIngredient, 400));
|
||||
|
||||
consumer.accept(new FinishedRecipe(id("piston_relay"), new ItemStack(ModBlocks.pistonRelay), ingr(Blocks.PISTON), 15000));
|
||||
consumer.accept(new FinishedRecipe(id("mana_cookie"), new ItemStack(ModItems.manaCookie), ingr(Items.COOKIE), 20000));
|
||||
consumer.accept(new FinishedRecipe(id("grass_seeds"), new ItemStack(ModItems.grassSeeds), ingr(Blocks.GRASS), 2500));
|
||||
consumer.accept(new FinishedRecipe(id("podzol_seeds"), new ItemStack(ModItems.podzolSeeds), ingr(Blocks.DEAD_BUSH), 2500));
|
||||
|
||||
consumer.accept(new FinishedRecipe(id("mycel_seeds"), new ItemStack(ModItems.mycelSeeds), Ingredient.fromItems(Blocks.RED_MUSHROOM, Blocks.BROWN_MUSHROOM), 6500));
|
||||
|
||||
consumer.accept(new FinishedRecipe(id("mana_quartz"), new ItemStack(ModItems.manaQuartz), ingr(Items.QUARTZ), 250));
|
||||
consumer.accept(new FinishedRecipe(id("tiny_potato"), new ItemStack(ModBlocks.tinyPotato), ingr(Items.POTATO), 1337));
|
||||
|
||||
/* todo 1.15 rip
|
||||
if (Botania.thaumcraftLoaded) {
|
||||
Item inkwell = ForgeRegistries.ITEMS.getValue(new ResourceLocation("thaumcraft", "scribing_tools"));
|
||||
consumer.accept(new FinishedRecipe(id("mana_inkwell"), new ItemStack(ModItems.manaInkwell), ingr(inkwell), 35000));
|
||||
}
|
||||
*/
|
||||
|
||||
consumer.accept(new FinishedRecipe(id("mana_glass"), new ItemStack(ModBlocks.manaGlass), ingr(Blocks.GLASS), 150));
|
||||
consumer.accept(new FinishedRecipe(id("mana_string"), new ItemStack(ModItems.manaString), ingr(Items.STRING), 5000));
|
||||
|
||||
// todo 1.15 move to gog
|
||||
if (Botania.gardenOfGlassLoaded) {
|
||||
consumer.accept(new FinishedRecipe(id("sugar_cane"), new ItemStack(Blocks.SUGAR_CANE), ingr(Blocks.HAY_BLOCK), 2000));
|
||||
}
|
||||
|
||||
consumer.accept(new FinishedRecipe(id("mana_bottle"), new ItemStack(ModItems.manaBottle), ingr(Items.GLASS_BOTTLE), 5000));
|
||||
|
||||
consumer.accept(FinishedRecipe.alchemy(id("rotten_flesh_to_leather"), new ItemStack(Items.LEATHER), ingr(Items.ROTTEN_FLESH), 600));
|
||||
|
||||
cycle(consumer, 40, "botania:log_cycle", Blocks.OAK_LOG, Blocks.SPRUCE_LOG, Blocks.BIRCH_LOG, Blocks.JUNGLE_LOG, Blocks.ACACIA_LOG, Blocks.DARK_OAK_LOG);
|
||||
cycle(consumer, 120, "botania:sapling_cycle", Blocks.OAK_SAPLING, Blocks.SPRUCE_SAPLING, Blocks.BIRCH_SAPLING, Blocks.JUNGLE_SAPLING, Blocks.ACACIA_SAPLING, Blocks.DARK_OAK_SAPLING);
|
||||
|
||||
consumer.accept(FinishedRecipe.alchemy(id("glowstone_deconstruct"), new ItemStack(Items.GLOWSTONE_DUST, 4), ingr(Blocks.GLOWSTONE), 25));
|
||||
consumer.accept(FinishedRecipe.alchemy(id("quartz_deconstruct"), new ItemStack(Items.QUARTZ, 4), ingr(Blocks.QUARTZ_BLOCK), 25));
|
||||
consumer.accept(FinishedRecipe.alchemy(id("dark_quartz_deconstruct"), new ItemStack(ModItems.darkQuartz, 4), ingr(ModFluffBlocks.darkQuartz), 25));
|
||||
consumer.accept(FinishedRecipe.alchemy(id("mana_quartz_deconstruct"), new ItemStack(ModItems.manaQuartz, 4), ingr(ModFluffBlocks.manaQuartz), 25));
|
||||
consumer.accept(FinishedRecipe.alchemy(id("blaze_quartz_deconstruct"), new ItemStack(ModItems.blazeQuartz, 4), ingr(ModFluffBlocks.blazeQuartz), 25));
|
||||
consumer.accept(FinishedRecipe.alchemy(id("lavender_quartz_deconstruct"), new ItemStack(ModItems.lavenderQuartz, 4), ingr(ModFluffBlocks.lavenderQuartz), 25));
|
||||
consumer.accept(FinishedRecipe.alchemy(id("red_quartz_deconstruct"), new ItemStack(ModItems.redQuartz, 4), ingr(ModFluffBlocks.redQuartz), 25));
|
||||
consumer.accept(FinishedRecipe.alchemy(id("elf_quartz_deconstruct"), new ItemStack(ModItems.elfQuartz, 4), ingr(ModFluffBlocks.elfQuartz), 25));
|
||||
|
||||
consumer.accept(FinishedRecipe.alchemy(id("chiseled_stone_bricks"), new ItemStack(Blocks.CHISELED_STONE_BRICKS, 1), ingr(Blocks.STONE_BRICKS), 150));
|
||||
consumer.accept(FinishedRecipe.alchemy(id("ice"), new ItemStack(Blocks.ICE), ingr(Blocks.SNOW_BLOCK), 2250));
|
||||
|
||||
consumer.accept(FinishedRecipe.alchemy(id("vine_to_lily_pad"), new ItemStack(Blocks.LILY_PAD), ingr(Blocks.VINE), 320));
|
||||
consumer.accept(FinishedRecipe.alchemy(id("lily_pad_to_vine"), new ItemStack(Blocks.VINE), ingr(Blocks.LILY_PAD), 320));
|
||||
|
||||
cycle(consumer, 200, "botania:fish_cycle", Items.COD, Items.SALMON, Items.TROPICAL_FISH, Items.PUFFERFISH);
|
||||
cycle(consumer, 6000, "botania:crop_cycle", Items.COCOA_BEANS, Items.WHEAT_SEEDS, Items.POTATO, Items.CARROT, Items.BEETROOT_SEEDS, Items.MELON_SEEDS, Items.PUMPKIN_SEEDS);
|
||||
|
||||
consumer.accept(FinishedRecipe.alchemy(id("potato_unpoison"), new ItemStack(Items.POTATO), ingr(Items.POISONOUS_POTATO), 1200));
|
||||
consumer.accept(FinishedRecipe.alchemy(id("blaze_rod_to_nether_wart"), new ItemStack(Items.NETHER_WART), ingr(Items.BLAZE_ROD), 4000));
|
||||
|
||||
cycle(consumer, 200, "", Items.GUNPOWDER, Items.FLINT);
|
||||
|
||||
consumer.accept(FinishedRecipe.alchemy(id("book_to_name_tag"), new ItemStack(Items.NAME_TAG), ingr(Items.WRITABLE_BOOK), 16000));
|
||||
|
||||
consumer.accept(FinishedRecipe.alchemy(id("wool_deconstruct"), new ItemStack(Items.STRING, 3), Ingredient.fromTag(ItemTags.WOOL), 100));
|
||||
|
||||
consumer.accept(FinishedRecipe.alchemy(id("cactus_to_slime"), new ItemStack(Items.SLIME_BALL), ingr(Blocks.CACTUS), 1200));
|
||||
consumer.accept(FinishedRecipe.alchemy(id("slime_to_cactus"), new ItemStack(Blocks.CACTUS), ingr(Items.SLIME_BALL), 1200));
|
||||
|
||||
consumer.accept(FinishedRecipe.alchemy(id("ender_pearl_from_ghast_tear"), new ItemStack(Items.ENDER_PEARL), ingr(Items.GHAST_TEAR), 28000));
|
||||
|
||||
cycle(consumer, 300, "", Items.GLOWSTONE_DUST, Items.REDSTONE);
|
||||
|
||||
consumer.accept(FinishedRecipe.alchemy(id("cobble_to_sand"), new ItemStack(Blocks.SAND), ingr(Blocks.COBBLESTONE), 50));
|
||||
consumer.accept(FinishedRecipe.alchemy(id("terracotta_to_red_sand"), new ItemStack(Blocks.RED_SAND), ingr(Blocks.TERRACOTTA), 50));
|
||||
|
||||
consumer.accept(FinishedRecipe.alchemy(id("clay_deconstruct"), new ItemStack(Items.CLAY_BALL, 4), ingr(Blocks.CLAY), 25));
|
||||
consumer.accept(FinishedRecipe.alchemy(id("brick_deconstruct"), new ItemStack(Items.BRICK, 4), ingr(Blocks.BRICKS), 25));
|
||||
|
||||
consumer.accept(FinishedRecipe.alchemy(id("coarse_dirt"), new ItemStack(Blocks.COARSE_DIRT), ingr(Blocks.DIRT), 120));
|
||||
|
||||
consumer.accept(FinishedRecipe.alchemy(id("stone_to_andesite"), new ItemStack(Blocks.ANDESITE), ingr(Blocks.STONE), 200));
|
||||
consumer.accept(FinishedRecipe.alchemy(id("andesite_to_diorite"), new ItemStack(Blocks.DIORITE), ingr(Blocks.ANDESITE), 200));
|
||||
consumer.accept(FinishedRecipe.alchemy(id("diorite_to_granite"), new ItemStack(Blocks.GRANITE), ingr(Blocks.DIORITE), 200));
|
||||
consumer.accept(FinishedRecipe.alchemy(id("granite_to_andesite"), new ItemStack(Blocks.ANDESITE), ingr(Blocks.GRANITE), 200));
|
||||
|
||||
cycle(consumer, 500, "botania:shrub_cycle", Blocks.FERN, Blocks.DEAD_BUSH, Blocks.GRASS);
|
||||
|
||||
// NB: No wither rose is intentional
|
||||
cycle(consumer, 400, "botania:flower_cycle", Blocks.DANDELION, Blocks.POPPY, Blocks.BLUE_ORCHID, Blocks.ALLIUM, Blocks.AZURE_BLUET, Blocks.RED_TULIP, Blocks.ORANGE_TULIP,
|
||||
Blocks.WHITE_TULIP, Blocks.PINK_TULIP, Blocks.OXEYE_DAISY, Blocks.CORNFLOWER, Blocks.LILY_OF_THE_VALLEY,
|
||||
Blocks.SUNFLOWER, Blocks.LILAC, Blocks.ROSE_BUSH, Blocks.PEONY);
|
||||
|
||||
consumer.accept(FinishedRecipe.alchemy(id("chorus_fruit_to_flower"), new ItemStack(Blocks.CHORUS_FLOWER), ingr(Items.POPPED_CHORUS_FRUIT), 10000));
|
||||
|
||||
cycle(consumer, 240, "botania:berry_cycle", Items.APPLE, Items.SWEET_BERRIES);
|
||||
|
||||
if (Botania.gardenOfGlassLoaded) {
|
||||
consumer.accept(FinishedRecipe.alchemy(id("prismarine_shard_gog"), new ItemStack(Items.PRISMARINE_SHARD), ingr(Items.QUARTZ), 1000));
|
||||
consumer.accept(FinishedRecipe.alchemy(id("prismarine_crystals_gog"), new ItemStack(Items.PRISMARINE_CRYSTALS), ingr(Items.PRISMARINE_SHARD), 500));
|
||||
consumer.accept(FinishedRecipe.alchemy(id("heart_of_the_sea"), new ItemStack(Items.HEART_OF_THE_SEA), ingr(Items.NAUTILUS_SHELL), 20000));
|
||||
}
|
||||
|
||||
consumer.accept(mini(ModSubtiles.agricarnationChibi, ModSubtiles.agricarnation));
|
||||
consumer.accept(mini(ModSubtiles.clayconiaChibi, ModSubtiles.clayconia));
|
||||
consumer.accept(mini(ModSubtiles.bellethornChibi, ModSubtiles.bellethorn));
|
||||
consumer.accept(mini(ModSubtiles.bubbellChibi, ModSubtiles.bubbell));
|
||||
consumer.accept(mini(ModSubtiles.hopperhockChibi, ModSubtiles.hopperhock));
|
||||
consumer.accept(mini(ModSubtiles.marimorphosisChibi, ModSubtiles.marimorphosis));
|
||||
consumer.accept(mini(ModSubtiles.rannuncarpusChibi, ModSubtiles.rannuncarpus));
|
||||
consumer.accept(mini(ModSubtiles.solegnoliaChibi, ModSubtiles.solegnolia));
|
||||
|
||||
consumer.accept(FinishedRecipe.conjuration(id("redstone_dupe"), new ItemStack(Items.REDSTONE, 2), ingr(Items.REDSTONE), 5000));
|
||||
consumer.accept(FinishedRecipe.conjuration(id("glowstone_dupe"), new ItemStack(Items.GLOWSTONE_DUST, 2), ingr(Items.GLOWSTONE_DUST), 5000));
|
||||
consumer.accept(FinishedRecipe.conjuration(id("quartz_dupe"), new ItemStack(Items.QUARTZ, 2), ingr(Items.QUARTZ), 2500));
|
||||
consumer.accept(FinishedRecipe.conjuration(id("coal_dupe"), new ItemStack(Items.COAL, 2), ingr(Items.COAL), 2100));
|
||||
consumer.accept(FinishedRecipe.conjuration(id("snowball_dupe"), new ItemStack(Items.SNOWBALL, 2), ingr(Items.SNOWBALL), 200));
|
||||
consumer.accept(FinishedRecipe.conjuration(id("netherrack_dupe"), new ItemStack(Blocks.NETHERRACK, 2), ingr(Blocks.NETHERRACK), 200));
|
||||
consumer.accept(FinishedRecipe.conjuration(id("soul_sand_dupe"), new ItemStack(Blocks.SOUL_SAND, 2), ingr(Blocks.SOUL_SAND), 1500));
|
||||
consumer.accept(FinishedRecipe.conjuration(id("gravel_dupe"), new ItemStack(Blocks.GRAVEL, 2), ingr(Blocks.GRAVEL), 720));
|
||||
|
||||
consumer.accept(FinishedRecipe.conjuration(id("oak_leaves_dupe"), new ItemStack(Blocks.OAK_LEAVES, 2), ingr(Blocks.OAK_LEAVES), 2000));
|
||||
consumer.accept(FinishedRecipe.conjuration(id("birch_leaves_dupe"), new ItemStack(Blocks.BIRCH_LEAVES, 2), ingr(Blocks.BIRCH_LEAVES), 2000));
|
||||
consumer.accept(FinishedRecipe.conjuration(id("spruce_leaves_dupe"), new ItemStack(Blocks.SPRUCE_LEAVES, 2), ingr(Blocks.SPRUCE_LEAVES), 2000));
|
||||
consumer.accept(FinishedRecipe.conjuration(id("jungle_leaves_dupe"), new ItemStack(Blocks.JUNGLE_LEAVES, 2), ingr(Blocks.JUNGLE_LEAVES), 2000));
|
||||
consumer.accept(FinishedRecipe.conjuration(id("acacia_leaves_dupe"), new ItemStack(Blocks.ACACIA_LEAVES, 2), ingr(Blocks.ACACIA_LEAVES), 2000));
|
||||
consumer.accept(FinishedRecipe.conjuration(id("dark_oak_leaves_dupe"), new ItemStack(Blocks.DARK_OAK_LEAVES, 2), ingr(Blocks.DARK_OAK_LEAVES), 2000));
|
||||
|
||||
consumer.accept(FinishedRecipe.conjuration(id("grass"), new ItemStack(Blocks.GRASS, 2), ingr(Blocks.GRASS), 800));
|
||||
}
|
||||
|
||||
private static void cycle(Consumer<IFinishedRecipe> consumer, int cost, String group, IItemProvider... items) {
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
Ingredient in = ingr(items[i]);
|
||||
ItemStack out = new ItemStack(i == items.length - 1 ? items[0] : items[i + 1]);
|
||||
String id = String.format("%s_to_%s", items[i].asItem().getRegistryName().getPath(), out.getItem().getRegistryName().getPath());
|
||||
consumer.accept(FinishedRecipe.alchemy(id(id), out, in, cost, group));
|
||||
}
|
||||
}
|
||||
|
||||
private static FinishedRecipe mini(IItemProvider mini, IItemProvider full) {
|
||||
return FinishedRecipe.alchemy(id(mini.asItem().getRegistryName().getPath()), new ItemStack(mini), ingr(full), 2500, "botania:flower_shrinking");
|
||||
}
|
||||
|
||||
private static ResourceLocation id(String s) {
|
||||
return prefix("mana_infusion/" + s);
|
||||
}
|
||||
|
||||
private static Ingredient ingr(IItemProvider i) {
|
||||
return Ingredient.fromItems(i);
|
||||
}
|
||||
|
||||
private static class FinishedRecipe implements IFinishedRecipe {
|
||||
private final ResourceLocation id;
|
||||
private final Ingredient input;
|
||||
private final ItemStack output;
|
||||
private final int mana;
|
||||
private final String group;
|
||||
@Nullable
|
||||
private final BlockState catalyst;
|
||||
|
||||
public static FinishedRecipe conjuration(ResourceLocation id, ItemStack output, Ingredient input, int mana) {
|
||||
return new FinishedRecipe(id, output, input, mana, "", ModBlocks.conjurationCatalyst.getDefaultState());
|
||||
}
|
||||
|
||||
public static FinishedRecipe alchemy(ResourceLocation id, ItemStack output, Ingredient input, int mana) {
|
||||
return alchemy(id, output, input, mana, "");
|
||||
}
|
||||
|
||||
public static FinishedRecipe alchemy(ResourceLocation id, ItemStack output, Ingredient input, int mana, String group) {
|
||||
return new FinishedRecipe(id, output, input, mana, group, ModBlocks.alchemyCatalyst.getDefaultState());
|
||||
}
|
||||
|
||||
public FinishedRecipe(ResourceLocation id, ItemStack output, Ingredient input, int mana) {
|
||||
this(id, output, input, mana, "");
|
||||
}
|
||||
|
||||
public FinishedRecipe(ResourceLocation id, ItemStack output, Ingredient input, int mana, String group) {
|
||||
this(id, output, input, mana, group, null);
|
||||
}
|
||||
|
||||
public FinishedRecipe(ResourceLocation id, ItemStack output, Ingredient input, int mana, String group, @Nullable BlockState catalyst) {
|
||||
this.id = id;
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.mana = mana;
|
||||
this.group = group;
|
||||
this.catalyst = catalyst;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(JsonObject json) {
|
||||
json.add("input", input.serialize());
|
||||
json.add("output", ItemNBTHelper.serializeStack(output));
|
||||
json.addProperty("mana", mana);
|
||||
if (!group.isEmpty()) {
|
||||
json.addProperty("group", group);
|
||||
}
|
||||
if (catalyst != null) {
|
||||
StringBuilder catalystStr = new StringBuilder(catalyst.getBlock().getRegistryName().toString());
|
||||
if (catalyst != catalyst.getBlock().getDefaultState()) {
|
||||
catalystStr.append('[');
|
||||
catalystStr.append(catalyst.getProperties().stream().map(prop -> prop.getName() + "=" + getName(prop, catalyst.get(prop)))
|
||||
.collect(Collectors.joining(",")));
|
||||
catalystStr.append(']');
|
||||
}
|
||||
json.addProperty("catalyst", catalystStr.toString());
|
||||
}
|
||||
}
|
||||
|
||||
private static <T extends Comparable<T>> String getName(IProperty<T> prop, Comparable<?> val) {
|
||||
return prop.getName((T)val);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeSerializer<?> getSerializer() {
|
||||
return ModRecipeTypes.MANA_INFUSION_SERIALIZER;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override public JsonObject getAdvancementJson() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override public ResourceLocation getAdvancementID() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user