Skip to content

Commit

Permalink
ToB spellbook now remembers old spells after crafting
Browse files Browse the repository at this point in the history
  • Loading branch information
dphaldes committed Nov 4, 2023
1 parent b9e9ea2 commit b715a5f
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# Changelog

## [0.3.2] - Unreleased
## [0.3.2] - 2023-11-04

## Changed

- Updated textures for Heretics Armor! Thanks Gronglegrowth/Eset!
- Sentient Harm Glyph now consumes will when on successful damage. The values are similar to Sentient Sword.
- Tome of Blood should now remember the old spells when crafting (the blood altar one works for now while the alchemy
table recipes need an upstream(Blood Magic) fix)

## [0.3.1] - 2023-10-30

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.mystchonky.tomeofblood.common.events;

import com.hollingsworth.arsnouveau.common.items.SpellBook;
import com.mystchonky.tomeofblood.TomeOfBlood;
import com.mystchonky.tomeofblood.common.items.TomeOfBloodItem;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import wayoftime.bloodmagic.api.event.BloodMagicCraftedEvent;

import java.util.Arrays;

@Mod.EventBusSubscriber(modid = TomeOfBlood.MODID)
public class RecipeEventHandler {

@SubscribeEvent
public static void altarSpellbookRecipe(BloodMagicCraftedEvent.Altar event) {
if (event.getOutput().getItem() instanceof TomeOfBloodItem) {
if (event.getInputs()[0].getItem() instanceof SpellBook) {
ItemStack tome = event.getOutput().copy();
tome.setTag(event.getInputs()[0].getTag());
event.setOutput(tome);
}
}
}

@SubscribeEvent
public static void alchemyTableSpellbookRecipe(BloodMagicCraftedEvent.AlchemyTable event) {
if (event.getOutput().getItem() instanceof TomeOfBloodItem) {
Arrays.stream(event.getInputs())
.filter(itemStack -> itemStack.getItem() instanceof TomeOfBloodItem)
.findFirst().ifPresent((input) -> {
ItemStack tome = event.getOutput().copy();
tome.setTag(input.getTag());
event.setOutput(tome);
}
);
}
}

}

0 comments on commit b715a5f

Please sign in to comment.