From 9c7625121b0b4dd5898dbbfcbf0274ec451c92ea Mon Sep 17 00:00:00 2001 From: SammySemicolon <69329424+SammySemicolon@users.noreply.github.com> Date: Fri, 19 Jan 2024 03:46:13 +0100 Subject: [PATCH] wawa boyfriend backshots --- .../ritual_plinth/RitualPlinthBlockEntity.java | 12 +++++++++--- .../spiritritual/ManaboundEnhancementRitualType.java | 6 ++++++ .../malum/core/systems/ritual/MalumRitualType.java | 12 +++++++++++- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/sammy/malum/common/block/curiosities/ritual_plinth/RitualPlinthBlockEntity.java b/src/main/java/com/sammy/malum/common/block/curiosities/ritual_plinth/RitualPlinthBlockEntity.java index 866d49d7a..ff2244cd8 100644 --- a/src/main/java/com/sammy/malum/common/block/curiosities/ritual_plinth/RitualPlinthBlockEntity.java +++ b/src/main/java/com/sammy/malum/common/block/curiosities/ritual_plinth/RitualPlinthBlockEntity.java @@ -64,7 +64,7 @@ public RitualPlinthBlockEntity(BlockEntityType !(t.getItem() instanceof SpiritShardItem)) { + inventory = new MalumBlockEntityInventory(1, 64, t -> (ritualType != null && ritualType.isItemStackValid(this, t)) || (ritualType == null && !(t.getItem() instanceof SpiritShardItem))) { @Override public void onContentsChanged(int slot) { super.onContentsChanged(slot); @@ -129,7 +129,13 @@ public void onBreak(@Nullable Player player) { @Override public InteractionResult onUse(Player player, InteractionHand hand) { - if (ritualType == null && inventory.getStackInSlot(0).isEmpty() && extrasInventory.isEmpty()) { + if (ritualType != null) { + InteractionResult interactionResult = ritualType.onUsePlinth(this, player, hand); + if (!interactionResult.equals(InteractionResult.PASS)) { + return interactionResult; + } + } + else if (inventory.getStackInSlot(0).isEmpty() && extrasInventory.isEmpty()) { ItemStack stack = player.getItemInHand(hand); if (stack.getItem() instanceof RitualShardItem) { if (!level.isClientSide) { @@ -217,7 +223,7 @@ else if (ritualRecipe != null) { if (level.isClientSide) { final ItemStack stack = inventory.getStackInSlot(0); if (!stack.isEmpty()) { - boolean isItemValid = ritualRecipe != null && ritualRecipe.input.matches(stack); + boolean isItemValid = ritualType != null ? ritualType.isItemStackValid(this, stack) : ritualRecipe != null && ritualRecipe.input.matches(stack); if (isItemValid) { RitualPlinthParticleEffects.holdingPrimeItemPlinthParticles(this); } diff --git a/src/main/java/com/sammy/malum/common/spiritritual/ManaboundEnhancementRitualType.java b/src/main/java/com/sammy/malum/common/spiritritual/ManaboundEnhancementRitualType.java index a1dc08673..1a3b01503 100644 --- a/src/main/java/com/sammy/malum/common/spiritritual/ManaboundEnhancementRitualType.java +++ b/src/main/java/com/sammy/malum/common/spiritritual/ManaboundEnhancementRitualType.java @@ -4,6 +4,8 @@ import com.sammy.malum.common.block.curiosities.ritual_plinth.*; import com.sammy.malum.core.systems.ritual.*; import com.sammy.malum.registry.common.*; +import net.minecraft.world.item.ItemStack; +import top.theillusivec4.curios.api.type.capability.ICurioItem; public class ManaboundEnhancementRitualType extends MalumRitualType { public ManaboundEnhancementRitualType() { @@ -12,6 +14,10 @@ public ManaboundEnhancementRitualType() { @Override public void triggerRitualEffect(RitualPlinthBlockEntity ritualPlinth) { + } + @Override + public boolean isItemStackValid(RitualPlinthBlockEntity ritualPlinth, ItemStack stack) { + return stack.getItem() instanceof ICurioItem; } } diff --git a/src/main/java/com/sammy/malum/core/systems/ritual/MalumRitualType.java b/src/main/java/com/sammy/malum/core/systems/ritual/MalumRitualType.java index 21a05b867..763d5f991 100644 --- a/src/main/java/com/sammy/malum/core/systems/ritual/MalumRitualType.java +++ b/src/main/java/com/sammy/malum/core/systems/ritual/MalumRitualType.java @@ -7,6 +7,9 @@ import net.minecraft.nbt.*; import net.minecraft.network.chat.*; import net.minecraft.resources.*; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.*; import team.lodestar.lodestone.helpers.*; @@ -14,7 +17,6 @@ import java.util.function.*; public abstract class MalumRitualType { - public final MalumSpiritType spirit; public final ResourceLocation identifier; protected MalumRitualRecipeData recipeData; @@ -24,6 +26,14 @@ public MalumRitualType(ResourceLocation identifier, MalumSpiritType spirit) { this.spirit = spirit; } + + public InteractionResult onUsePlinth(RitualPlinthBlockEntity ritualPlinth, Player player, InteractionHand hand) { + return InteractionResult.PASS; + } + public boolean isItemStackValid(RitualPlinthBlockEntity ritualPlinth, ItemStack stack) { + return false; + } + public abstract void triggerRitualEffect(RitualPlinthBlockEntity ritualPlinth); public void setRecipeData(MalumRitualRecipeData recipeData) {