Readded the Alchemy Table
Finished adding the Alchemy Table with JEI compatability. Also added recipes for the ARC block and the Alchemy Table.
This commit is contained in:
parent
37c5e807b0
commit
bf6250272c
41 changed files with 1915 additions and 29 deletions
|
@ -19,6 +19,7 @@ import net.minecraftforge.fluids.FluidStack;
|
|||
import wayoftime.bloodmagic.api.IBloodMagicRecipeRegistrar;
|
||||
import wayoftime.bloodmagic.api.impl.recipe.RecipeARC;
|
||||
import wayoftime.bloodmagic.api.impl.recipe.RecipeAlchemyArray;
|
||||
import wayoftime.bloodmagic.api.impl.recipe.RecipeAlchemyTable;
|
||||
import wayoftime.bloodmagic.api.impl.recipe.RecipeBloodAltar;
|
||||
import wayoftime.bloodmagic.api.impl.recipe.RecipeTartaricForge;
|
||||
import wayoftime.bloodmagic.common.recipe.BloodMagicRecipeType;
|
||||
|
@ -324,6 +325,45 @@ public class BloodMagicRecipeRegistrar implements IBloodMagicRecipeRegistrar
|
|||
// return null;
|
||||
// }
|
||||
//
|
||||
@Nullable
|
||||
public RecipeAlchemyTable getAlchemyTable(World world, @Nonnull List<ItemStack> input)
|
||||
{
|
||||
Preconditions.checkNotNull(input, "input cannot be null.");
|
||||
if (input.isEmpty())
|
||||
return null;
|
||||
|
||||
List<RecipeAlchemyTable> tartaricForgeRecipes = world.getRecipeManager().getRecipesForType(BloodMagicRecipeType.ALCHEMYTABLE);
|
||||
mainLoop: for (RecipeAlchemyTable recipe : tartaricForgeRecipes)
|
||||
{
|
||||
if (recipe.getInput().size() != input.size())
|
||||
continue;
|
||||
|
||||
List<Ingredient> recipeInput = new ArrayList<>(recipe.getInput());
|
||||
|
||||
for (int i = 0; i < input.size(); i++)
|
||||
{
|
||||
boolean matched = false;
|
||||
for (int j = 0; j < recipeInput.size(); j++)
|
||||
{
|
||||
Ingredient ingredient = recipeInput.get(j);
|
||||
if (ingredient.test(input.get(i)))
|
||||
{
|
||||
matched = true;
|
||||
recipeInput.remove(j);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!matched)
|
||||
continue mainLoop;
|
||||
}
|
||||
|
||||
return recipe;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public RecipeTartaricForge getTartaricForge(World world, @Nonnull List<ItemStack> input)
|
||||
{
|
||||
|
@ -457,6 +497,11 @@ public class BloodMagicRecipeRegistrar implements IBloodMagicRecipeRegistrar
|
|||
return ImmutableSet.copyOf(world.getRecipeManager().getRecipesForType(BloodMagicRecipeType.ARC));
|
||||
}
|
||||
|
||||
public Set<RecipeAlchemyTable> getAlchemyTableRecipes(World world)
|
||||
{
|
||||
return ImmutableSet.copyOf(world.getRecipeManager().getRecipesForType(BloodMagicRecipeType.ALCHEMYTABLE));
|
||||
}
|
||||
|
||||
public Set<RecipeAlchemyArray> getCraftingAlchemyArrayRecipes(World world)
|
||||
{
|
||||
Set<RecipeAlchemyArray> recipes = Set.copyOf(world.getRecipeManager().getRecipesForType(BloodMagicRecipeType.ARRAY));
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
package wayoftime.bloodmagic.api.impl.recipe;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnegative;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public abstract class RecipeAlchemyTable extends BloodMagicRecipe
|
||||
{
|
||||
@Nonnull
|
||||
private final List<Ingredient> input;
|
||||
@Nonnull
|
||||
private final ItemStack output;
|
||||
@Nonnegative
|
||||
private final int syphon;
|
||||
@Nonnegative
|
||||
private final int ticks;
|
||||
@Nonnegative
|
||||
private final int minimumTier;
|
||||
|
||||
public static final int MAX_INPUTS = 6;
|
||||
|
||||
public RecipeAlchemyTable(ResourceLocation id, List<Ingredient> input, @Nonnull ItemStack output, int syphon, int ticks, int minimumTier)
|
||||
{
|
||||
super(id);
|
||||
Preconditions.checkNotNull(input, "input cannot be null.");
|
||||
Preconditions.checkNotNull(output, "output cannot be null.");
|
||||
Preconditions.checkArgument(syphon >= 0, "syphon cannot be negative.");
|
||||
Preconditions.checkArgument(ticks >= 0, "ticks cannot be negative.");
|
||||
Preconditions.checkArgument(minimumTier >= 0, "minimumTier cannot be negative.");
|
||||
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.syphon = syphon;
|
||||
this.ticks = ticks;
|
||||
this.minimumTier = minimumTier;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public final List<Ingredient> getInput()
|
||||
{
|
||||
return input;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public final ItemStack getOutput()
|
||||
{
|
||||
return output;
|
||||
}
|
||||
|
||||
public final int getSyphon()
|
||||
{
|
||||
return syphon;
|
||||
}
|
||||
|
||||
public final int getTicks()
|
||||
{
|
||||
return ticks;
|
||||
}
|
||||
|
||||
public final int getMinimumTier()
|
||||
{
|
||||
return minimumTier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(PacketBuffer buffer)
|
||||
{
|
||||
buffer.writeInt(input.size());
|
||||
for (int i = 0; i < input.size(); i++)
|
||||
{
|
||||
input.get(i).write(buffer);
|
||||
}
|
||||
buffer.writeItemStack(output);
|
||||
buffer.writeInt(syphon);
|
||||
buffer.writeInt(ticks);
|
||||
buffer.writeInt(minimumTier);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue