Skip to content

Commit

Permalink
wawa boyfriend backshots
Browse files Browse the repository at this point in the history
  • Loading branch information
SammySemicolon committed Jan 19, 2024
1 parent 24cb563 commit 9c76251
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public RitualPlinthBlockEntity(BlockEntityType<? extends RitualPlinthBlockEntity
public RitualPlinthBlockEntity(BlockPos pos, BlockState state) {
super(BlockEntityRegistry.RITUAL_PLINTH.get(), pos, state);

inventory = new MalumBlockEntityInventory(1, 64, t -> !(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);
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@
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.*;

import java.util.*;
import java.util.function.*;

public abstract class MalumRitualType {

public final MalumSpiritType spirit;
public final ResourceLocation identifier;
protected MalumRitualRecipeData recipeData;
Expand All @@ -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) {
Expand Down

0 comments on commit 9c76251

Please sign in to comment.