Added reversion recipes

Added reversion recipes to the Alchemical Reaction Chamber. This allows no longer used blood orbs to be converted back to their pre-crafted form.
This commit is contained in:
WayofTime 2020-11-01 19:07:00 -05:00
parent 204fbb3c28
commit 4f46dc150d
17 changed files with 67 additions and 37 deletions

View file

@ -239,16 +239,16 @@ d79a96eb3eed597f1c18a8983764a6362a24748c data/bloodmagic/recipes/altar/dusk_tool
926d4a0e165c87a15a609744d832d2f5f04a40d0 data/bloodmagic/recipes/altar/water_tool.json
7551501cf361667ec7454c307b9d2368536fbed6 data/bloodmagic/recipes/altar/weakbloodorb.json
5807b2515f4a2dc9855327940e6055f6947f0749 data/bloodmagic/recipes/arc.json
4817530f1762a71663162c3027ee0e42dda6cf73 data/bloodmagic/recipes/arc/clay_from_sand.json
dac5f561ad15c54f73ab90d860575aa2476e4b8b data/bloodmagic/recipes/arc/clay_from_terracotta.json
989d04edd3a740e8e4ddc37c233d2e0956264783 data/bloodmagic/recipes/arc/netherrack_to_sulfer.json
96d124582fab414cd075a42a706785d9ae2925b4 data/bloodmagic/recipes/arc/ore/dustgold.json
dd04af92a3f395725043829de2d46fe93a073bb8 data/bloodmagic/recipes/arc/ore/dustiron.json
de77325557a73ff844e16be948753dfa25ca7880 data/bloodmagic/recipes/arc/reversion/apprentice_blood_orb.json
4f533621483d530a7b000cdb5dc5044996cd8e68 data/bloodmagic/recipes/arc/reversion/magician_blood_orb.json
678b1286bbe454d55883455fe2922a79a212eb5e data/bloodmagic/recipes/arc/reversion/master_blood_orb.json
0cc1158b0bc9e83b81f73f7c6532c280ebbc24a6 data/bloodmagic/recipes/arc/reversion/weak_blood_orb.json
107939af94dbcb356ea5acadf52f70c3e4d13454 data/bloodmagic/recipes/arc/weakbloodshard.json
f35bb47d609201f6568b598307ae9d157792fe3e data/bloodmagic/recipes/arc/clay_from_sand.json
6b8ba1822bac8a1af426a14f87d613dc89e3fca0 data/bloodmagic/recipes/arc/clay_from_terracotta.json
2eb26a1af68ed7a5fdb6ac9d4bbc7557729c56cd data/bloodmagic/recipes/arc/netherrack_to_sulfer.json
f3d4fd692c6ce6b6a22b5fc94524b5b72090ff85 data/bloodmagic/recipes/arc/ore/dustgold.json
4dc91e8c26b360bb78974a173ada3f20dfee1dac data/bloodmagic/recipes/arc/ore/dustiron.json
249229687c1b41a4191c455278624b642b501b4e data/bloodmagic/recipes/arc/reversion/apprentice_blood_orb.json
a2b7d868ac099dd6fb29fa54892aad90e29d028d data/bloodmagic/recipes/arc/reversion/magician_blood_orb.json
a7f51456052d0fd317164d400cdd595ae2687df8 data/bloodmagic/recipes/arc/reversion/master_blood_orb.json
8d9d66d63e21cc8a6f02fac2111f5d169c8542ff data/bloodmagic/recipes/arc/reversion/weak_blood_orb.json
1e5814caf63714b8e1ff2b2f413a86ba8c840ebb data/bloodmagic/recipes/arc/weakbloodshard.json
e1285ec51100f2336c1ea1a1a3057e74a0dd84d1 data/bloodmagic/recipes/array/airsigil.json
d1ac23080f72f21adb5908befefe965ffb4efd4f data/bloodmagic/recipes/array/bloodlightsigil.json
1890706e5b93cd6df764b0419483c348e0d7f277 data/bloodmagic/recipes/array/divinationsigil.json

View file

@ -20,5 +20,6 @@
],
"output": {
"item": "minecraft:clay_ball"
}
},
"consumeingredient": false
}

View file

@ -12,5 +12,6 @@
},
"output": {
"item": "minecraft:clay"
}
},
"consumeingredient": false
}

View file

@ -12,5 +12,6 @@
},
"output": {
"item": "bloodmagic:sulfur"
}
},
"consumeingredient": false
}

View file

@ -9,5 +9,6 @@
"output": {
"item": "bloodmagic:goldsand",
"count": 2
}
},
"consumeingredient": false
}

View file

@ -9,5 +9,6 @@
"output": {
"item": "bloodmagic:ironsand",
"count": 2
}
},
"consumeingredient": false
}

View file

@ -8,5 +8,6 @@
},
"output": {
"item": "minecraft:redstone_block"
}
},
"consumeingredient": true
}

View file

@ -8,5 +8,6 @@
},
"output": {
"item": "minecraft:gold_block"
}
},
"consumeingredient": true
}

View file

@ -8,5 +8,6 @@
},
"output": {
"item": "bloodmagic:weakbloodshard"
}
},
"consumeingredient": true
}

View file

@ -8,5 +8,6 @@
},
"output": {
"item": "minecraft:diamond"
}
},
"consumeingredient": true
}

View file

@ -16,5 +16,6 @@
],
"output": {
"item": "bloodmagic:weakbloodshard"
}
},
"consumeingredient": false
}

View file

@ -28,15 +28,16 @@ public abstract class RecipeARC extends BloodMagicRecipe
@Nonnull
private final ItemStack output;
private final FluidStack outputFluid;
private final boolean consumeIngredient;
private final List<Pair<ItemStack, Double>> addedItems;
protected RecipeARC(ResourceLocation id, Ingredient input, Ingredient arc_tool, FluidStackIngredient inputFluid, ItemStack output, FluidStack outputFluid)
protected RecipeARC(ResourceLocation id, Ingredient input, Ingredient arc_tool, FluidStackIngredient inputFluid, ItemStack output, FluidStack outputFluid, boolean consumeIngredient)
{
this(id, input, arc_tool, inputFluid, output, new ArrayList<Pair<ItemStack, Double>>(), outputFluid);
this(id, input, arc_tool, inputFluid, output, new ArrayList<Pair<ItemStack, Double>>(), outputFluid, consumeIngredient);
}
protected RecipeARC(ResourceLocation id, Ingredient input, Ingredient arc_tool, FluidStackIngredient inputFluid, ItemStack output, List<Pair<ItemStack, Double>> addedItems, FluidStack outputFluid)
protected RecipeARC(ResourceLocation id, Ingredient input, Ingredient arc_tool, FluidStackIngredient inputFluid, ItemStack output, List<Pair<ItemStack, Double>> addedItems, FluidStack outputFluid, boolean consumeIngredient)
{
super(id);
this.input = input;
@ -45,6 +46,7 @@ public abstract class RecipeARC extends BloodMagicRecipe
this.output = output;
this.addedItems = addedItems;
this.outputFluid = outputFluid;
this.consumeIngredient = consumeIngredient;
}
public RecipeARC addRandomOutput(ItemStack stack, double chance)
@ -130,6 +132,11 @@ public abstract class RecipeARC extends BloodMagicRecipe
return chanceArray;
}
public boolean getConsumeIngredient()
{
return consumeIngredient;
}
@Override
public void write(PacketBuffer buffer)
{
@ -154,5 +161,6 @@ public abstract class RecipeARC extends BloodMagicRecipe
{
outputFluid.writeToPacket(buffer);
}
buffer.writeBoolean(consumeIngredient);
}
}

View file

@ -28,8 +28,9 @@ public class ARCRecipeBuilder extends BloodMagicRecipeBuilder<ARCRecipeBuilder>
private final ItemStack output;
private final FluidStack outputFluid;
private final List<Pair<ItemStack, Double>> addedItems = new ArrayList<Pair<ItemStack, Double>>();
private final boolean consumeIngredient;
protected ARCRecipeBuilder(Ingredient input, Ingredient arcTool, FluidStackIngredient inputFluid, ItemStack output, FluidStack outputFluid)
protected ARCRecipeBuilder(Ingredient input, Ingredient arcTool, FluidStackIngredient inputFluid, ItemStack output, FluidStack outputFluid, boolean consumeIngredient)
{
super(bmSerializer("arc"));
this.input = input;
@ -37,11 +38,17 @@ public class ARCRecipeBuilder extends BloodMagicRecipeBuilder<ARCRecipeBuilder>
this.inputFluid = inputFluid;
this.output = output;
this.outputFluid = outputFluid == null ? FluidStack.EMPTY : outputFluid;
this.consumeIngredient = consumeIngredient;
}
public static ARCRecipeBuilder arc(Ingredient input, Ingredient arcTool, FluidStackIngredient inputFluid, ItemStack output, FluidStack outputFluid)
{
return new ARCRecipeBuilder(input, arcTool, inputFluid, output, outputFluid);
return new ARCRecipeBuilder(input, arcTool, inputFluid, output, outputFluid, false);
}
public static ARCRecipeBuilder arcConsume(Ingredient input, Ingredient arcTool, FluidStackIngredient inputFluid, ItemStack output, FluidStack outputFluid)
{
return new ARCRecipeBuilder(input, arcTool, inputFluid, output, outputFluid, true);
}
public ARCRecipeBuilder addRandomOutput(ItemStack stack, double chance)
@ -96,6 +103,7 @@ public class ARCRecipeBuilder extends BloodMagicRecipeBuilder<ARCRecipeBuilder>
json.add(Constants.JSON.OUTPUT_FLUID, SerializerHelper.serializeFluidStack(outputFluid));
json.add(Constants.JSON.OUTPUT, SerializerHelper.serializeItemStack(output));
json.addProperty("consumeingredient", consumeIngredient);
}
}
}

View file

@ -55,6 +55,6 @@ public class ARCRecipeProvider implements ISubRecipeProvider
private void registerReversionRecipe(Ingredient input, ItemStack outputStack, Consumer<IFinishedRecipe> consumer, String path)
{
ARCRecipeBuilder.arc(input, Ingredient.fromTag(BloodMagicTags.ARC_TOOL_REVERTER), null, outputStack, null).build(consumer, BloodMagic.rl(path));
ARCRecipeBuilder.arcConsume(input, Ingredient.fromTag(BloodMagicTags.ARC_TOOL_REVERTER), null, outputStack, null).build(consumer, BloodMagic.rl(path));
}
}

View file

@ -92,7 +92,9 @@ public class ARCRecipeSerializer<RECIPE extends RecipeARC> extends ForgeRegistry
outputFluidStack = SerializerHelper.deserializeFluid(outputFluid);
}
return this.factory.create(recipeId, inputIng, toolIng, inputFluidIng, output, addedItems, outputFluidStack);
boolean consumeIngredient = JSONUtils.getBoolean(json, "consumeingredient");
return this.factory.create(recipeId, inputIng, toolIng, inputFluidIng, output, addedItems, outputFluidStack, consumeIngredient);
}
@Override
@ -126,7 +128,9 @@ public class ARCRecipeSerializer<RECIPE extends RecipeARC> extends ForgeRegistry
outputFluid = FluidStack.readFromPacket(buffer);
}
return this.factory.create(recipeId, inputIng, toolIng, inputFluid, output, addedItems, outputFluid);
boolean consumeIngredient = buffer.readBoolean();
return this.factory.create(recipeId, inputIng, toolIng, inputFluid, output, addedItems, outputFluid, consumeIngredient);
} catch (Exception e)
{
BloodMagic.LOGGER.error("Error reading ARC recipe from packet.", e);
@ -150,6 +154,6 @@ public class ARCRecipeSerializer<RECIPE extends RecipeARC> extends ForgeRegistry
@FunctionalInterface
public interface IFactory<RECIPE extends RecipeARC>
{
RECIPE create(ResourceLocation id, Ingredient input, Ingredient arcTool, FluidStackIngredient inputFluid, ItemStack output, List<Pair<ItemStack, Double>> addedItems, FluidStack outputFluid);
RECIPE create(ResourceLocation id, Ingredient input, Ingredient arcTool, FluidStackIngredient inputFluid, ItemStack output, List<Pair<ItemStack, Double>> addedItems, FluidStack outputFluid, boolean consumeIngredient);
}
}

View file

@ -18,14 +18,14 @@ import wayoftime.bloodmagic.common.registries.BloodMagicRecipeSerializers;
public class IRecipeARC extends RecipeARC
{
public IRecipeARC(ResourceLocation id, Ingredient input, Ingredient arc_tool, FluidStackIngredient inputFluid, ItemStack output, FluidStack outputFluid)
public IRecipeARC(ResourceLocation id, Ingredient input, Ingredient arc_tool, FluidStackIngredient inputFluid, ItemStack output, FluidStack outputFluid, boolean consumeIngredient)
{
super(id, input, arc_tool, inputFluid, output, new ArrayList<Pair<ItemStack, Double>>(), outputFluid);
super(id, input, arc_tool, inputFluid, output, new ArrayList<Pair<ItemStack, Double>>(), outputFluid, consumeIngredient);
}
public IRecipeARC(ResourceLocation id, Ingredient input, Ingredient arc_tool, FluidStackIngredient inputFluid, ItemStack output, List<Pair<ItemStack, Double>> addedItems, FluidStack outputFluid)
public IRecipeARC(ResourceLocation id, Ingredient input, Ingredient arc_tool, FluidStackIngredient inputFluid, ItemStack output, List<Pair<ItemStack, Double>> addedItems, FluidStack outputFluid, boolean consumeIngredient)
{
super(id, input, arc_tool, inputFluid, output, addedItems, outputFluid);
super(id, input, arc_tool, inputFluid, output, addedItems, outputFluid, consumeIngredient);
}
@Override

View file

@ -287,7 +287,7 @@ public class TileAlchemicalReactionChamber extends TileInventory implements ITic
outputSlotHandler.canTransferAllItemsToSlots(recipe.getAllOutputs(world.rand), false);
outputTank.fill(recipe.getFluidOutput().copy(), FluidAction.EXECUTE);
consumeInventory();
consumeInventory(recipe.getConsumeIngredient());
}
}
@ -303,15 +303,15 @@ public class TileAlchemicalReactionChamber extends TileInventory implements ITic
List<ItemStack> outputList = new ArrayList<>();
outputList.add(outputStack);
outputSlotHandler.canTransferAllItemsToSlots(outputList, false);
consumeInventory();
consumeInventory(false);
}
public void consumeInventory()
public void consumeInventory(boolean consumeInput)
{
ItemStack inputStack = getStackInSlot(INPUT_SLOT);
if (!inputStack.isEmpty())
{
if (inputStack.getItem().hasContainerItem(inputStack))
if (!consumeInput && inputStack.getItem().hasContainerItem(inputStack))
{
setInventorySlotContents(INPUT_SLOT, inputStack.getItem().getContainerItem(inputStack));
} else