mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-21 12:42:57 +00:00
use updated battlegear2 api (#99)
* use updated battlegear2 api * Update dependencies.gradle --------- Co-authored-by: Martin Robertz <[email protected]>
This commit is contained in:
1 parent
b8950a1893
commit
d696ad50c3
5 files changed
+16
-13
No files matched your search
@@ -15,11 +15,11 @@ import mods.battlegear2.api.weapons.IBattlegearWeapon;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.weaponry.client.CrosshairType;
|
||||
|
||||
@Optional.InterfaceList({
|
||||
@Optional.Interface(modid = "battlegear2", iface = "mods.battlegear2.api.weapons.IBattlegearWeapon") })
|
||||
/**
|
||||
* Throwing weapons that utilize the ammo system on themselves. Throwing knifes etc.
|
||||
*/
|
||||
@Optional.InterfaceList({
|
||||
@Optional.Interface(modid = "battlegear2", iface = "mods.battlegear2.api.weapons.IBattlegearWeapon") })
|
||||
public abstract class AmmoWeapon extends AmmoItem implements IBattlegearWeapon, IAccuracy, IWindup {
|
||||
|
||||
public AmmoWeapon(int baseDamage, String name) {
|
||||
|
||||
@@ -13,7 +13,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import mods.battlegear2.api.core.InventoryPlayerBattle;
|
||||
import mods.battlegear2.api.core.IInventoryPlayerBattle;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.crafting.ToolBuilder;
|
||||
import tconstruct.library.tools.BowstringMaterial;
|
||||
@@ -23,6 +23,8 @@ 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);
|
||||
}
|
||||
@@ -60,9 +62,9 @@ public abstract class BowBaseAmmo extends ProjectileWeapon {
|
||||
@Override
|
||||
public ItemStack searchForAmmo(EntityPlayer player, ItemStack weapon) {
|
||||
// arrow priority: hotbar > inventory, tinker arrows > regular arrows
|
||||
if (Loader.isModLoaded("battlegear2")) {
|
||||
ItemStack offhand = ((InventoryPlayerBattle) player.inventory).getCurrentOffhandWeapon();
|
||||
if (offhand != null && (checkTinkerArrow(offhand) || checkVanillaArrow(offhand))) {
|
||||
if (isBattlegear2Loaded) {
|
||||
ItemStack offhand = ((IInventoryPlayerBattle) player.inventory).battlegear2$getCurrentOffhandWeapon();
|
||||
if (checkTinkerArrow(offhand) || checkVanillaArrow(offhand)) {
|
||||
return offhand;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,11 +32,11 @@ import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.weaponry.TinkerWeaponry;
|
||||
import tconstruct.weaponry.client.CrosshairType;
|
||||
|
||||
@Optional.InterfaceList({
|
||||
@Optional.Interface(modid = "battlegear2", iface = "mods.battlegear2.api.weapons.IBattlegearWeapon") })
|
||||
/**
|
||||
* Weapons that utilize ammo that uses the ammo system to shoot projectiles. Bows,...
|
||||
*/
|
||||
@Optional.InterfaceList({
|
||||
@Optional.Interface(modid = "battlegear2", iface = "mods.battlegear2.api.weapons.IBattlegearWeapon") })
|
||||
public abstract class ProjectileWeapon extends ToolCore implements IBattlegearWeapon, IAccuracy, IWindup {
|
||||
|
||||
public ProjectileWeapon(int baseDamage, String name) {
|
||||
|
||||
@@ -12,7 +12,7 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import mods.battlegear2.api.core.InventoryPlayerBattle;
|
||||
import mods.battlegear2.api.core.IInventoryPlayerBattle;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.crafting.ToolBuilder;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
@@ -27,6 +27,8 @@ import tconstruct.weaponry.entity.BoltEntity;
|
||||
|
||||
public class Crossbow extends ProjectileWeapon {
|
||||
|
||||
private static final boolean isBattlegear2Loaded = Loader.isModLoaded("battlegear2");
|
||||
|
||||
public Crossbow() {
|
||||
super(0, "Crossbow");
|
||||
this.setMaxDamage(100);
|
||||
@@ -218,8 +220,8 @@ public class Crossbow extends ProjectileWeapon {
|
||||
@Override
|
||||
public ItemStack searchForAmmo(EntityPlayer player, ItemStack weapon) {
|
||||
// arrow priority: hotbar > inventory, tinker arrows > regular arrows
|
||||
if (Loader.isModLoaded("battlegear2")) {
|
||||
ItemStack offhand = ((InventoryPlayerBattle) player.inventory).getCurrentOffhandWeapon();
|
||||
if (isBattlegear2Loaded) {
|
||||
ItemStack offhand = ((IInventoryPlayerBattle) player.inventory).battlegear2$getCurrentOffhandWeapon();
|
||||
if (offhand != null && (offhand.getItem() instanceof BoltAmmo)
|
||||
&& ((IAmmo) offhand.getItem()).getAmmoCount(offhand) > 0) {
|
||||
return offhand;
|
||||
|
||||
Reference in new issue
Block a user