From dcd2d830efa553a7a6c6e377498ba4e7230e1738 Mon Sep 17 00:00:00 2001 From: stellanera Date: Wed, 24 Dec 2025 01:54:05 +0100 Subject: [PATCH 1/2] annoying item interactions --- .../bloodmagic/common/item/ItemRitualDiviner.java | 12 +++++------- .../bloodmagic/common/item/ItemRitualReader.java | 15 ++++----------- .../common/item/sigil/ItemSigilHolding.java | 6 +++--- .../common/item/sigil/ItemSigilTeleposition.java | 7 ++++++- .../util/handler/event/GenericHandler.java | 10 ++++++++++ 5 files changed, 28 insertions(+), 22 deletions(-) diff --git a/src/main/java/wayoftime/bloodmagic/common/item/ItemRitualDiviner.java b/src/main/java/wayoftime/bloodmagic/common/item/ItemRitualDiviner.java index d5d2f475a3..59d14d0ba9 100644 --- a/src/main/java/wayoftime/bloodmagic/common/item/ItemRitualDiviner.java +++ b/src/main/java/wayoftime/bloodmagic/common/item/ItemRitualDiviner.java @@ -145,6 +145,11 @@ public void inventoryTick(ItemStack stack, Level worldIn, Entity entityIn, int i @Override public InteractionResult useOn(UseOnContext context) { + // the things in this method only care about it being used on a MRS, if thats not the case we ignore + if (!(context.getLevel().getBlockEntity(context.getClickedPos()) instanceof TileMasterRitualStone)) { + return InteractionResult.PASS; + } + ItemStack stack = context.getPlayer().getItemInHand(context.getHand()); if (context.getPlayer().isShiftKeyDown()) { @@ -363,13 +368,6 @@ public InteractionResultHolder use(Level world, Player player, Intera ItemStack stack = player.getItemInHand(hand); setActivatedState(stack, false); - HitResult ray = getPlayerPOVHitResult(world, player, ClipContext.Fluid.NONE); - - if (ray != null && ray.getType() == HitResult.Type.BLOCK) - { - return new InteractionResultHolder<>(InteractionResult.PASS, stack); - } - if (player.isShiftKeyDown()) { if (!world.isClientSide) diff --git a/src/main/java/wayoftime/bloodmagic/common/item/ItemRitualReader.java b/src/main/java/wayoftime/bloodmagic/common/item/ItemRitualReader.java index 930663e835..4826f2b3d2 100644 --- a/src/main/java/wayoftime/bloodmagic/common/item/ItemRitualReader.java +++ b/src/main/java/wayoftime/bloodmagic/common/item/ItemRitualReader.java @@ -79,11 +79,6 @@ public void appendHoverText(ItemStack stack, Level world, List toolti public InteractionResultHolder use(Level world, Player player, InteractionHand hand) { ItemStack stack = player.getItemInHand(hand); - HitResult ray = Item.getPlayerPOVHitResult(world, player, Fluid.NONE); - if (ray != null && ray.getType() == HitResult.Type.BLOCK) - { - return new InteractionResultHolder<>(InteractionResult.PASS, stack); - } if (player.isShiftKeyDown()) { @@ -114,10 +109,9 @@ public InteractionResult useOn(UseOnContext context) { EnumRitualReaderState state = this.getState(stack); BlockEntity tile = world.getBlockEntity(pos); - if (tile instanceof IMasterRitualStone) + if (tile instanceof IMasterRitualStone master) { - IMasterRitualStone master = (IMasterRitualStone) tile; - if (master.getCurrentRitual() == null) + if (master.getCurrentRitual() == null) super.useOn(context); this.setMasterBlockPos(stack, pos); this.setBlockPos(stack, BlockPos.ZERO); @@ -195,10 +189,9 @@ public InteractionResult useOn(UseOnContext context) } else { tile = world.getBlockEntity(masterPos); - if (tile instanceof IMasterRitualStone) + if (tile instanceof IMasterRitualStone master) { - IMasterRitualStone master = (IMasterRitualStone) tile; - BlockPos pos2 = pos.subtract(masterPos); + BlockPos pos2 = pos.subtract(masterPos); String range = this.getCurrentBlockRange(stack); if (range == null || range.isEmpty()) { diff --git a/src/main/java/wayoftime/bloodmagic/common/item/sigil/ItemSigilHolding.java b/src/main/java/wayoftime/bloodmagic/common/item/sigil/ItemSigilHolding.java index 5b581cd9b4..fd9d32c238 100644 --- a/src/main/java/wayoftime/bloodmagic/common/item/sigil/ItemSigilHolding.java +++ b/src/main/java/wayoftime/bloodmagic/common/item/sigil/ItemSigilHolding.java @@ -140,11 +140,11 @@ public InteractionResultHolder use(Level world, Player player, Intera if (itemUsing.isEmpty() || ((IBindable) itemUsing.getItem()).getBinding(itemUsing) == null) return InteractionResultHolder.pass(stack); - itemUsing.getItem().use(world, player, hand); - + InteractionResultHolder result = itemUsing.getItem().use(world, player, hand); saveInventory(stack, inv); - return InteractionResultHolder.pass(stack); + // dont throw away the internal sigils use result, didnt do that in useOn either + return result; } @Nonnull diff --git a/src/main/java/wayoftime/bloodmagic/common/item/sigil/ItemSigilTeleposition.java b/src/main/java/wayoftime/bloodmagic/common/item/sigil/ItemSigilTeleposition.java index 069a442fb3..be14628c83 100644 --- a/src/main/java/wayoftime/bloodmagic/common/item/sigil/ItemSigilTeleposition.java +++ b/src/main/java/wayoftime/bloodmagic/common/item/sigil/ItemSigilTeleposition.java @@ -89,6 +89,10 @@ public InteractionResultHolder use(Level world, Player player, Intera public InteractionResult useOn(UseOnContext context) { ItemStack stack = context.getItemInHand(); + // need this to work in holding sigil + if (stack.getItem() instanceof ISigil.Holding) { + stack = ((Holding) stack.getItem()).getHeldItem(stack, context.getPlayer()); + } BlockPos pos = context.getClickedPos(); Level world = context.getLevel(); Player player = context.getPlayer(); @@ -108,9 +112,10 @@ public InteractionResult useOn(UseOnContext context) BindableHelper.applyBinding(stack, player); } } + return InteractionResult.SUCCESS; } - return InteractionResult.SUCCESS; + return InteractionResult.PASS; } public void setStoredPos(ItemStack stack, BlockPos pos) diff --git a/src/main/java/wayoftime/bloodmagic/util/handler/event/GenericHandler.java b/src/main/java/wayoftime/bloodmagic/util/handler/event/GenericHandler.java index b1600676f2..f0b646b725 100644 --- a/src/main/java/wayoftime/bloodmagic/util/handler/event/GenericHandler.java +++ b/src/main/java/wayoftime/bloodmagic/util/handler/event/GenericHandler.java @@ -201,6 +201,16 @@ public void onPlayerLeftClickAir(PlayerInteractEvent.LeftClickEmpty event) } } + @SubscribeEvent + // make cycling the diviner also work on clicking on a block instead of only on clicking nothing + public void onPlayerLeftClickBlock(PlayerInteractEvent.LeftClickBlock event) + { + if (event.getItemStack().getItem() instanceof ItemRitualDiviner) + { + BloodMagicPacketHandler.INSTANCE.sendToServer(new CycleRitualDivinerPacket(event.getEntity().getInventory().selected)); + } + } + @SubscribeEvent // Called when an entity is set to be hurt. Called before vanilla armour // calculations. From 78208ade566f776d2694c3bb6b5901d03cd32ca5 Mon Sep 17 00:00:00 2001 From: stellanera Date: Wed, 24 Dec 2025 17:19:45 +0100 Subject: [PATCH 2/2] add changelog, update diviner entry --- changelog.txt | 2 ++ .../guide/en_us/entries/rituals/ritual_diviner.json | 2 +- .../guide/en_us/entries/utility/changelog.json | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index 61cd69970f..4b7632f5bd 100644 --- a/changelog.txt +++ b/changelog.txt @@ -29,6 +29,8 @@ AgriCraft is *not* installed. - prevent a crash when opening the Edit HUD position screen while looking at an entity - soft coating no longer voids the contents of shulker boxes (or other tile-entities) - bloodmagic:geode_harvestable now adds forge:clusters as a tag instead of a block, meaning it'll actually work with them +- teleposition sigil now teleports you when clicking on a non-teleposer block as well. it also now checks itself for a destination when inside a sigil of holding +- ritual diviner and tinkerer can now be cycled even when looking at a (non master ritual stone) block ------------------------------------------------------ Version 3.3.5 diff --git a/src/main/resources/assets/bloodmagic/patchouli_books/guide/en_us/entries/rituals/ritual_diviner.json b/src/main/resources/assets/bloodmagic/patchouli_books/guide/en_us/entries/rituals/ritual_diviner.json index adc28bc74f..24459248e4 100644 --- a/src/main/resources/assets/bloodmagic/patchouli_books/guide/en_us/entries/rituals/ritual_diviner.json +++ b/src/main/resources/assets/bloodmagic/patchouli_books/guide/en_us/entries/rituals/ritual_diviner.json @@ -5,7 +5,7 @@ "pages": [ { "type": "patchouli:text", - "text": "Crafting rituals is an intricate business; Even if you have the correct $(item)Inscription Tools$(), you can't just slap runic inscriptions down any old how and expect things to happen. Luckily, the $(item)Ritual Diviner$() is here to help. $(br2)Hold [$(k:sneak)] and press [$(k:use)] or [$(k:attack)] while looking at empty air to cycle through the avaliable rituals in either direction." + "text": "Crafting rituals is an intricate business; Even if you have the correct $(item)Inscription Tools$(), you can't just slap runic inscriptions down any old how and expect things to happen. Luckily, the $(item)Ritual Diviner$() is here to help. $(br2)Hold [$(k:sneak)] and press [$(k:use)] or [$(k:attack)] to cycle through the avaliable rituals in either direction." }, { "type": "patchouli:text", diff --git a/src/main/resources/assets/bloodmagic/patchouli_books/guide/en_us/entries/utility/changelog.json b/src/main/resources/assets/bloodmagic/patchouli_books/guide/en_us/entries/utility/changelog.json index 1b979a1fb2..3867396f3c 100644 --- a/src/main/resources/assets/bloodmagic/patchouli_books/guide/en_us/entries/utility/changelog.json +++ b/src/main/resources/assets/bloodmagic/patchouli_books/guide/en_us/entries/utility/changelog.json @@ -41,6 +41,10 @@ "type": "patchouli:text", "text": "$(li)forge:storage_blocks/hellforged block and item tags have been added to the respective forge:storage_blocks tag$(li)prevent a crash when opening the Edit HUD position screen while looking at an entity$(li)soft coating no longer voids the contents of shulker boxes (or other tile-entities)" }, + { + "type": "patchouli:text", + "text": "$(li)teleposition sigil now teleports you when clicking on a non-teleposer block as well. it also now checks itself for a destination when inside a sigil of holding$()$(li)ritual diviner and tinkerer can now be cycled even when looking at a (non master ritual stone) block" + }, { "type": "patchouli:text", "title": "3.3.5",