Skip to content

Commit

Permalink
Make quivers support holding fireworks on crossbows
Browse files Browse the repository at this point in the history
Still considering if I want to make it not hardcoded to fireworks and allow more general projectile
  • Loading branch information
KnightMiner committed Dec 27, 2022
1 parent add5d68 commit 8103789
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ArrowItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import slimeknights.tconstruct.TConstruct;
import slimeknights.tconstruct.common.TinkerTags;
import slimeknights.tconstruct.library.modifiers.ModifierEntry;
import slimeknights.tconstruct.library.modifiers.TinkerHooks;
import slimeknights.tconstruct.library.modifiers.dynamic.InventoryMenuModifier;
Expand Down Expand Up @@ -40,7 +43,8 @@ public int getPriority() {

@Override
public boolean isItemValid(IToolStackView tool, ModifierEntry modifier, int slot, ItemStack stack) {
return stack.getItem() instanceof ArrowItem;
Item item = stack.getItem();
return (item == Items.FIREWORK_ROCKET && tool.hasTag(TinkerTags.Items.CROSSBOWS)) || stack.getItem() instanceof ArrowItem;
}

@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ArrowItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import slimeknights.tconstruct.TConstruct;
import slimeknights.tconstruct.common.TinkerTags;
import slimeknights.tconstruct.library.modifiers.ModifierEntry;
import slimeknights.tconstruct.library.modifiers.TinkerHooks;
import slimeknights.tconstruct.library.modifiers.dynamic.InventoryMenuModifier;
Expand Down Expand Up @@ -62,7 +65,8 @@ public int getSlotLimit(IToolStackView tool, ModifierEntry modifier, int slot) {

@Override
public boolean isItemValid(IToolStackView tool, ModifierEntry modifier, int slot, ItemStack stack) {
return stack.getItem() instanceof ArrowItem;
Item item = stack.getItem();
return (item == Items.FIREWORK_ROCKET && tool.hasTag(TinkerTags.Items.CROSSBOWS)) || stack.getItem() instanceof ArrowItem;
}

@Nullable
Expand Down

0 comments on commit 8103789

Please sign in to comment.