Part 2 of ARC Recipe Implementation
Added the ability for FluidStacks to be used as inputs and outputs, with a bit of cribbing off of how Mekanism handled their FluidStackIngredient.
This commit is contained in:
parent
f9327d8f5a
commit
f0d62b997a
12 changed files with 634 additions and 16 deletions
|
@ -13,6 +13,8 @@ import net.minecraft.item.crafting.Ingredient;
|
|||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import wayoftime.bloodmagic.api.event.recipes.FluidStackIngredient;
|
||||
|
||||
public abstract class RecipeARC extends BloodMagicRecipe
|
||||
{
|
||||
|
@ -22,23 +24,27 @@ public abstract class RecipeARC extends BloodMagicRecipe
|
|||
private final Ingredient input;
|
||||
@Nonnull
|
||||
private final Ingredient arc_tool;
|
||||
private final FluidStackIngredient inputFluid;
|
||||
@Nonnull
|
||||
private final ItemStack output;
|
||||
private final FluidStack outputFluid;
|
||||
|
||||
private final List<Pair<ItemStack, Double>> addedItems;
|
||||
|
||||
protected RecipeARC(ResourceLocation id, Ingredient input, Ingredient arc_tool, ItemStack output)
|
||||
protected RecipeARC(ResourceLocation id, Ingredient input, Ingredient arc_tool, FluidStackIngredient inputFluid, ItemStack output, FluidStack outputFluid)
|
||||
{
|
||||
this(id, input, arc_tool, output, new ArrayList<Pair<ItemStack, Double>>());
|
||||
this(id, input, arc_tool, inputFluid, output, new ArrayList<Pair<ItemStack, Double>>(), outputFluid);
|
||||
}
|
||||
|
||||
protected RecipeARC(ResourceLocation id, Ingredient input, Ingredient arc_tool, ItemStack output, List<Pair<ItemStack, Double>> addedItems)
|
||||
protected RecipeARC(ResourceLocation id, Ingredient input, Ingredient arc_tool, FluidStackIngredient inputFluid, ItemStack output, List<Pair<ItemStack, Double>> addedItems, FluidStack outputFluid)
|
||||
{
|
||||
super(id);
|
||||
this.input = input;
|
||||
this.arc_tool = arc_tool;
|
||||
this.inputFluid = inputFluid;
|
||||
this.output = output;
|
||||
this.addedItems = addedItems;
|
||||
this.outputFluid = outputFluid;
|
||||
}
|
||||
|
||||
public RecipeARC addRandomOutput(ItemStack stack, double chance)
|
||||
|
@ -106,5 +112,17 @@ public abstract class RecipeARC extends BloodMagicRecipe
|
|||
buffer.writeItemStack(pair.getLeft());
|
||||
buffer.writeDouble(pair.getValue());
|
||||
}
|
||||
|
||||
buffer.writeBoolean(inputFluid != null);
|
||||
if (inputFluid != null)
|
||||
{
|
||||
inputFluid.write(buffer);
|
||||
}
|
||||
|
||||
buffer.writeBoolean(outputFluid != null);
|
||||
if (outputFluid != null)
|
||||
{
|
||||
outputFluid.writeToPacket(buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue