Skip to content

Commit

Permalink
A much needed patch
Browse files Browse the repository at this point in the history
  • Loading branch information
StellarWitch7 committed Nov 2, 2024
1 parent 2fdadb5 commit 74b75b4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,12 @@ protected ItemActionResult onUseWithItem(ItemStack stack, BlockState state, Worl
return slot.map(s -> {
var slotStack = blockEntity.getStack(s);

if (!slotStack.isEmpty() || s == 2 ? !stack.isIn(ModItems.MANA_CRYSTALS) : !stack.isOf(ModItems.SPELL_CORE))
return ItemActionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
if (slotStack.isEmpty() && (s == 2 ? stack.isIn(ModItems.MANA_CRYSTALS) : stack.isOf(ModItems.SPELL_CORE))) {
tryAddBook(world, pos, player, blockEntity, stack, s);
return ItemActionResult.success(world.isClient);
}

tryAddBook(world, pos, player, blockEntity, stack, s);
return ItemActionResult.success(world.isClient);
return ItemActionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
}).orElse(ItemActionResult.SKIP_DEFAULT_BLOCK_INTERACTION);
} else {
return ItemActionResult.SKIP_DEFAULT_BLOCK_INTERACTION;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ public void setStack(int slot, ItemStack stack) {

if (!stack.contains(ModComponents.SPELL_CORE)
|| stack.get(ModComponents.SPELL_CORE) instanceof SpellCoreComponent comp
&& !spell.equals(comp.spell().orElse(null))) {
&& (!spell.equals(comp.spell().orElse(null))
|| comp.error().isPresent())) {
stack.set(ModComponents.SPELL_CORE, new SpellCoreComponent(spell));
}
}
Expand Down Expand Up @@ -199,7 +200,7 @@ public Fragment getCrowMind() {
@Override
public boolean queue(SpellExecutor executor) {
for (var stack : inventory) {
if (stack.isOf(ModItems.SPELL_CORE) && !stack.contains(ModComponents.SPELL_CORE)) {
if (stack.isOf(ModItems.SPELL_CORE) && !stack.contains(ModComponents.SPELL_CORE) || stack.get(ModComponents.SPELL_CORE).error().isPresent()) {
stack.set(ModComponents.SPELL_CORE, new SpellCoreComponent(executor, Optional.empty(), Optional.empty()));
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ public MutableManaPool getManaPool() {

@Override
public Vector3d getPos() {
return new Vector3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
var pos = this.pos.toCenterPos();
return new Vector3d(pos.x, pos.y, pos.z);
}

@Override
Expand Down

0 comments on commit 74b75b4

Please sign in to comment.