Allow arrows and bolts to be used from bauble slots.

Register a Quiver slot if Baubles Expanded is present. Can be put in a ring slot (had to pick one) if just Baubles is present.
Clean up some unused and outdated logic in all the bow and ammo classes.
This commit is contained in:
koolkrafter5 committed 2025-07-18 12:28:48 -04:00
1 parent fdfe5df30f
commit 7fe01beebc
12 files changed
+255 -219

No files matched your search

@@ -12,9 +12,10 @@ import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import cpw.mods.fml.common.Loader;
import baubles.common.lib.PlayerHandler;
import mods.battlegear2.api.core.IBattlePlayer;
import tconstruct.compat.Battlegear2Compat;
import tconstruct.compat.LoadedMods;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.crafting.ToolBuilder;
import tconstruct.library.tools.BowstringMaterial;
@@ -24,8 +25,6 @@ import tconstruct.weaponry.entity.ArrowEntity;
public abstract class BowBaseAmmo extends ProjectileWeapon {
private static final boolean isBattlegear2Loaded = Loader.isModLoaded("battlegear2");
public BowBaseAmmo(int baseDamage, String name) {
super(baseDamage, name);
}
@@ -62,8 +61,8 @@ public abstract class BowBaseAmmo extends ProjectileWeapon {
@Override
public ItemStack searchForAmmo(EntityPlayer player, ItemStack weapon) {
// arrow priority: hotbar > inventory, tinker arrows > regular arrows
if (isBattlegear2Loaded && player instanceof IBattlePlayer battlePlayer
// arrow priority: offhand > bauble slots > hotbar > inventory, tinker arrows > regular arrows
if (LoadedMods.battlegear2 && player instanceof IBattlePlayer battlePlayer
&& battlePlayer.battlegear2$isBattlemode()) {
ItemStack offhand = Battlegear2Compat.getBattlegear2Offhand(player);
if (checkTinkerArrow(offhand) || checkVanillaArrow(offhand)) {
@@ -71,6 +70,14 @@ public abstract class BowBaseAmmo extends ProjectileWeapon {
}
}
if (LoadedMods.baubles) {
for (ItemStack bauble : PlayerHandler.getPlayerBaubles(player).stackList) {
if (checkTinkerArrow(bauble) || checkVanillaArrow(bauble)) {
return bauble;
}
}
}
ItemStack[] inventory = player.inventory.mainInventory;
// check hotbar for tinker arrows
@@ -142,7 +149,7 @@ public abstract class BowBaseAmmo extends ProjectileWeapon {
}
@Override
public void buildTool(int id, String name, List list) {
public void buildTool(int id, String name, List<ItemStack> list) {
// does the material have a bow material?
if (TConstructRegistry.getBowMaterial(id) == null) return;