From f1473dc42f736a0a2ff650d2d300316c9d50a1c5 Mon Sep 17 00:00:00 2001 From: Zerokyuuni Date: Fri, 6 Dec 2013 18:26:57 -0500 Subject: [PATCH] BG Compat Changelog: Updated the compat for the changed api Paladins with hammers and shields, ho! --- src/mods/battlegear2/api/IAllowItem.java | 11 +++ src/mods/battlegear2/api/IDyable.java | 6 +- src/mods/battlegear2/api/IEnchantable.java | 15 +++ src/mods/battlegear2/api/IOffhandDual.java | 55 +++++++++++ src/mods/battlegear2/api/ISheathed.java | 12 +++ src/mods/battlegear2/api/IShield.java | 10 +- .../api/quiver/QuiverArrowRegistry.java | 28 +++++- .../api/weapons/IBattlegearWeapon.java | 66 +------------ .../api/weapons/WeaponRegistry.java | 98 +++++++++++++++++++ src/tconstruct/items/tools/Arrow.java | 2 +- src/tconstruct/items/tools/Battleaxe.java | 10 +- src/tconstruct/items/tools/Chisel.java | 10 +- src/tconstruct/items/tools/Cleaver.java | 26 +++-- src/tconstruct/items/tools/Excavator.java | 12 +-- src/tconstruct/items/tools/Hammer.java | 20 +++- src/tconstruct/items/tools/Hatchet.java | 2 +- src/tconstruct/items/tools/LumberAxe.java | 12 +-- src/tconstruct/items/tools/Mattock.java | 12 +-- src/tconstruct/items/tools/Pickaxe.java | 3 +- src/tconstruct/items/tools/Scythe.java | 12 +-- src/tconstruct/items/tools/Shortbow.java | 12 +-- src/tconstruct/items/tools/Shovel.java | 3 +- src/tconstruct/library/tools/ToolCore.java | 13 +-- 23 files changed, 294 insertions(+), 156 deletions(-) create mode 100644 src/mods/battlegear2/api/IAllowItem.java create mode 100644 src/mods/battlegear2/api/IEnchantable.java create mode 100644 src/mods/battlegear2/api/IOffhandDual.java create mode 100644 src/mods/battlegear2/api/ISheathed.java create mode 100644 src/mods/battlegear2/api/weapons/WeaponRegistry.java diff --git a/src/mods/battlegear2/api/IAllowItem.java b/src/mods/battlegear2/api/IAllowItem.java new file mode 100644 index 00000000000..9c629d48a10 --- /dev/null +++ b/src/mods/battlegear2/api/IAllowItem.java @@ -0,0 +1,11 @@ +package mods.battlegear2.api; + +import net.minecraft.item.ItemStack; + +public interface IAllowItem { + + /** + * Returns true if the mainhand {@link #ItemStack} allows the offhand {@link #ItemStack} to be placed in the partner offhand slot + */ + public boolean allowOffhand(ItemStack mainhand, ItemStack offhand); +} diff --git a/src/mods/battlegear2/api/IDyable.java b/src/mods/battlegear2/api/IDyable.java index a5be9d7ef4f..3e72f2fcf92 100644 --- a/src/mods/battlegear2/api/IDyable.java +++ b/src/mods/battlegear2/api/IDyable.java @@ -8,20 +8,20 @@ public interface IDyable { /** - * Return whether the specified armor ItemStack has a color. + * Return whether the specified ItemStack has a color. */ public boolean hasColor(ItemStack par1ItemStack); /** - * Return the color for the specified armor ItemStack. + * Return the color for the specified ItemStack. */ public int getColor(ItemStack par1ItemStack); public void setColor(ItemStack dyable, int rgb); /** - * Remove the color from the specified armor ItemStack. + * Remove the color from the specified ItemStack. */ public void removeColor(ItemStack par1ItemStack); diff --git a/src/mods/battlegear2/api/IEnchantable.java b/src/mods/battlegear2/api/IEnchantable.java new file mode 100644 index 00000000000..9bf5178647e --- /dev/null +++ b/src/mods/battlegear2/api/IEnchantable.java @@ -0,0 +1,15 @@ +package mods.battlegear2.api; + +import mods.battlegear2.enchantments.BaseEnchantment; +import net.minecraft.item.ItemStack; + +public interface IEnchantable { + + /** + * If a Battlegear {@link #BaseEnchantment} can be applied to this item, given the {@link #ItemStack} + * @param baseEnchantment + * @param stack + * @return + */ + public boolean isEnchantable(BaseEnchantment baseEnchantment, ItemStack stack); +} diff --git a/src/mods/battlegear2/api/IOffhandDual.java b/src/mods/battlegear2/api/IOffhandDual.java new file mode 100644 index 00000000000..1c18468785e --- /dev/null +++ b/src/mods/battlegear2/api/IOffhandDual.java @@ -0,0 +1,55 @@ +package mods.battlegear2.api; + +import cpw.mods.fml.relauncher.Side; +import mods.battlegear2.api.weapons.OffhandAttackEvent; +import net.minecraft.item.ItemStack; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; + +public interface IOffhandDual { + /** + * Returns true if the item can be dual wielded in the offhand slot + */ + public boolean isOffhandHandDual(ItemStack off); + + /** + * Perform any function when the item is held in the offhand and the user right clicks an entity. + * This is generally used to attack an entity with the offhand item. If this is the case the event should + * be canceled to prevent any default right clicking events (Eg Villager Trading) + * + * @param event the OffhandAttackEvent that was generated + * @param mainhandItem the ItemStack currently being held in the right hand + * @param offhandItem the ItemStack currently being held in the left hand + * @return true if the off hand swing animation should be performed + */ + public boolean offhandAttackEntity(OffhandAttackEvent event, ItemStack mainhandItem, ItemStack offhandItem); + + /** + * Perform any function when the item is held in the offhand and the user right clicks "Air". + * + * @param event the PlayerInteractEvent that was generated + * @param mainhandItem the ItemStack currently being held in the right hand + * @param offhandItem the ItemStack currently being held in the left hand + * @return true if the off hand swing animation should be performed + */ + public boolean offhandClickAir(PlayerInteractEvent event, ItemStack mainhandItem, ItemStack offhandItem); + + /** + * Perform any function when the item is held in the offhand and the user right clicks a block. + * Note that this will happen prior to the activation of any activation functions of blocks + * + * @param event the PlayerInteractEvent that was generated + * @param mainhandItem the ItemStack currently being held in the right hand + * @param offhandItem the ItemStack currently being held in the left hand + * @return true if the off hand swing animation should be performed + */ + public boolean offhandClickBlock(PlayerInteractEvent event, ItemStack mainhandItem, ItemStack offhandItem); + + /** + * Perform any passive effects on each game tick when the item is held in the offhand + * + * @param effectiveSide the effective side the method was called from + * @param mainhandItem the ItemStack currently being held in the right hand + * @param offhandItem the ItemStack currently being held in the left hand + */ + public void performPassiveEffects(Side effectiveSide, ItemStack mainhandItem, ItemStack offhandItem); +} diff --git a/src/mods/battlegear2/api/ISheathed.java b/src/mods/battlegear2/api/ISheathed.java new file mode 100644 index 00000000000..5955b87b357 --- /dev/null +++ b/src/mods/battlegear2/api/ISheathed.java @@ -0,0 +1,12 @@ +package mods.battlegear2.api; + +import net.minecraft.item.ItemStack; + +public interface ISheathed { + + /** + * Returns true if the item should always be sheathed on the back, false if it should be sheathed on the hip + * @param item the {@link #ItemStack} to be sheathed + */ + public boolean sheatheOnBack(ItemStack item); +} diff --git a/src/mods/battlegear2/api/IShield.java b/src/mods/battlegear2/api/IShield.java index de9a81bf914..089935c5c83 100644 --- a/src/mods/battlegear2/api/IShield.java +++ b/src/mods/battlegear2/api/IShield.java @@ -1,6 +1,5 @@ package mods.battlegear2.api; - import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; @@ -15,6 +14,15 @@ public interface IShield { * @return a value between 0 & 1 representing the decay rate per tick */ public float getDecayRate(ItemStack shield); + + /** + * Gets the recovery rate for the stamina bar when the shield is not in use. + * The value should be between 0 and 1. + * + * @param shield The {@link #ItemStack} representing the shield + * @return a value between 0 & 1 representing the recovery rate per tick + */ + public float getRecoveryRate(ItemStack shield); /** * Returns true if the current shield can and should block the given damage source diff --git a/src/mods/battlegear2/api/quiver/QuiverArrowRegistry.java b/src/mods/battlegear2/api/quiver/QuiverArrowRegistry.java index 072930c2587..fcf1dcaf93f 100644 --- a/src/mods/battlegear2/api/quiver/QuiverArrowRegistry.java +++ b/src/mods/battlegear2/api/quiver/QuiverArrowRegistry.java @@ -2,6 +2,7 @@ import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import java.util.Comparator; import java.util.Map; @@ -13,7 +14,13 @@ public class QuiverArrowRegistry { public static void addArrowToRegistry(int itemId, int itemMetadata, Class entityArrow){ ItemStack stack = new ItemStack(itemId, 1, itemMetadata); - map.put(stack, entityArrow); + addArrowToRegistry(stack, entityArrow); + } + + public static void addArrowToRegistry(ItemStack stack, Class entityArrow){ + ItemStack st = stack.copy(); + st.stackSize = 1; + map.put(st, entityArrow); } public static Class getArrowClass(ItemStack stack){ @@ -23,7 +30,6 @@ public static Class getArrowClass(ItemStack stack){ static class StackComparator implements Comparator { @Override public int compare(ItemStack stack, ItemStack stack2) { - if(stack == stack2){ return 0; }else{ @@ -31,8 +37,22 @@ public int compare(ItemStack stack, ItemStack stack2) { int idDiff = stack.itemID - stack2.itemID; if(idDiff != 0){ return idDiff; - }else - return stack.getItemDamage() - stack2.getItemDamage(); + }else{ + idDiff = stack.getItemDamage() - stack2.getItemDamage(); + if(idDiff != 0){ + return idDiff; + }else{ + int tag = 0; + if(stack.hasTagCompound()){ + tag = stack.getTagCompound().hashCode(); + } + int tag2 = 0; + if(stack2.hasTagCompound()){ + tag2 = stack2.getTagCompound().hashCode(); + } + return tag-tag2; + } + } } } diff --git a/src/mods/battlegear2/api/weapons/IBattlegearWeapon.java b/src/mods/battlegear2/api/weapons/IBattlegearWeapon.java index ccdceb5ebd0..f0a76becc2c 100644 --- a/src/mods/battlegear2/api/weapons/IBattlegearWeapon.java +++ b/src/mods/battlegear2/api/weapons/IBattlegearWeapon.java @@ -1,70 +1,12 @@ package mods.battlegear2.api.weapons; import cpw.mods.fml.relauncher.Side; +import mods.battlegear2.api.IAllowItem; +import mods.battlegear2.api.IOffhandDual; +import mods.battlegear2.api.ISheathed; import net.minecraft.item.ItemStack; import net.minecraftforge.event.entity.player.PlayerInteractEvent; -public interface IBattlegearWeapon { - - /** - * Returns true if the weapon will allow other weapons to be placed in the partner offhand slot - */ - public boolean willAllowOffhandWeapon(); - - /** - * Will allow shield - */ - public boolean willAllowShield(); - - /** - * Returns true if the weapon be dual wielded in the offhand slot - */ - public boolean isOffhandHandDualWeapon(); - - /** - * Returns true if the weapon should always be sheathed on the back, false if it should be sheathed on the hip - */ - public boolean sheatheOnBack(); - - /** - * Perform any function when the item is held in the offhand and the user right clicks an entity. - * This is generally used to attack an entity with the offhand item. If this is the case the event should - * be canceled to prevent any default right clicking events (Eg Villager Trading) - * - * @param event the OffhandAttackEvent that was generated - * @param mainhandItem the ItemStack currently being held in the right hand - * @param offhandItem the ItemStack currently being held in the left hand - * @return true if the off hand swing animation should be performed - */ - public boolean offhandAttackEntity(OffhandAttackEvent event, ItemStack mainhandItem, ItemStack offhandItem); - - /** - * Perform any function when the item is held in the offhand and the user right clicks "Air". - * - * @param event the PlayerInteractEvent that was generated - * @param mainhandItem the ItemStack currently being held in the right hand - * @param offhandItem the ItemStack currently being held in the left hand - * @return true if the off hand swing animation should be performed - */ - public boolean offhandClickAir(PlayerInteractEvent event, ItemStack mainhandItem, ItemStack offhandItem); - - /** - * Perform any function when the item is held in the offhand and the user right clicks a block. - * Note that this will happen prior to the activation of any activation functions of blocks - * - * @param event the PlayerInteractEvent that was generated - * @param mainhandItem the ItemStack currently being held in the right hand - * @param offhandItem the ItemStack currently being held in the left hand - */ - public boolean offhandClickBlock(PlayerInteractEvent event, ItemStack mainhandItem, ItemStack offhandItem); - - /** - * Perform any passive effects on each game tick when the item is held in the offhand - * - * @param effectiveSide the effective side the method was called from - * @param mainhandItem the ItemStack currently being held in the right hand - * @param offhandItem the ItemStack currently being held in the left hand - */ - public void performPassiveEffects(Side effectiveSide, ItemStack mainhandItem, ItemStack offhandItem); +public interface IBattlegearWeapon extends ISheathed,IOffhandDual,IAllowItem{ } \ No newline at end of file diff --git a/src/mods/battlegear2/api/weapons/WeaponRegistry.java b/src/mods/battlegear2/api/weapons/WeaponRegistry.java new file mode 100644 index 00000000000..41143930106 --- /dev/null +++ b/src/mods/battlegear2/api/weapons/WeaponRegistry.java @@ -0,0 +1,98 @@ +package mods.battlegear2.api.weapons; + +import java.util.HashSet; +import java.util.Set; + +import mods.battlegear2.utils.BattlegearUtils; +import net.minecraft.item.ItemStack; +/** + * Registry for stacks which will be allowed in battle inventory, + * accessible through {@link #FMLInterModComms} messages. + * Use only if your item is not recognized by default. + * Use of {@link #IBattlegearWeapon} is preferred over this method. + * {@link #NBTTagCompound} are supported. + * @author GotoLink + * + */ +public class WeaponRegistry { + private static Set weapons = new HashSet(); + private static Set mainHand = new HashSet(); + private static Set offHand = new HashSet(); + /** + * Called by a {@link #IMCMessage} with "Dual" as key, and the {@link #ItemStack} as value + * @param stack registered as dual wieldable + */ + public static void addDualWeapon(ItemStack stack) { + if(!BattlegearUtils.checkForRightClickFunction(stack.getItem())){ + weapons.add(new StackHolder(stack)); + mainHand.add(new StackHolder(stack)); + offHand.add(new StackHolder(stack)); + } + } + + /** + * Called by a {@link #IMCMessage} with "MainHand" as key, and the {@link #ItemStack} as value + * @param stack registered as wieldable only in main hand + */ + public static void addTwoHanded(ItemStack stack) { + if(!BattlegearUtils.checkForRightClickFunction(stack.getItem())){ + weapons.add(new StackHolder(stack)); + mainHand.add(new StackHolder(stack)); + } + } + + /** + * Called by a {@link #IMCMessage} with "OffHand" as key, and the {@link #ItemStack} as value + * @param stack registered as wieldable only in main hand + */ + public static void addOffhandWeapon(ItemStack stack) { + if(!BattlegearUtils.checkForRightClickFunction(stack.getItem())){ + weapons.add(new StackHolder(stack)); + offHand.add(new StackHolder(stack)); + } + } + + public static boolean isWeapon(ItemStack stack) { + return weapons.contains(new StackHolder(stack)); + } + + public static boolean isMainHand(ItemStack stack) { + return mainHand.contains(new StackHolder(stack)); + } + + public static boolean isOffHand(ItemStack stack) { + return offHand.contains(new StackHolder(stack)); + } + + static class StackHolder{ + private ItemStack stack; + + public StackHolder(ItemStack stack){ + this.stack = stack; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = prime + (stack == null ? 0 : stack.itemID ^ stack.stackSize + (stack.hasTagCompound() ? prime*prime ^ stack.getTagCompound().hashCode():0)); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof StackHolder)) { + return false; + } + if (!ItemStack.areItemStacksEqual(stack, ((StackHolder) obj).stack)) { + return false; + } + return true; + } + } +} diff --git a/src/tconstruct/items/tools/Arrow.java b/src/tconstruct/items/tools/Arrow.java index 0162d97e1cf..02cb383c5c4 100644 --- a/src/tconstruct/items/tools/Arrow.java +++ b/src/tconstruct/items/tools/Arrow.java @@ -231,7 +231,7 @@ else if (power > this.getMaxCharge(stack) * 2 / 3) } @Override - public boolean isOffhandHandDualWeapon () + public boolean isOffhandHandDual(ItemStack off) { return false; } diff --git a/src/tconstruct/items/tools/Battleaxe.java b/src/tconstruct/items/tools/Battleaxe.java index fe98e10ac30..ad5e0f98dcf 100644 --- a/src/tconstruct/items/tools/Battleaxe.java +++ b/src/tconstruct/items/tools/Battleaxe.java @@ -302,20 +302,20 @@ public boolean onBlockStartBreak (ItemStack stack, int x, int y, int z, EntityPl } @Override - public boolean willAllowOffhandWeapon () + public boolean allowOffhand(ItemStack mainhand, ItemStack offhand) { return false; } @Override - public boolean willAllowShield () + public boolean isOffhandHandDual(ItemStack off) { return false; } - + @Override - public boolean isOffhandHandDualWeapon () + public boolean sheatheOnBack(ItemStack item) { - return false; + return true; } } diff --git a/src/tconstruct/items/tools/Chisel.java b/src/tconstruct/items/tools/Chisel.java index b9c0b761f27..773887bd7e4 100644 --- a/src/tconstruct/items/tools/Chisel.java +++ b/src/tconstruct/items/tools/Chisel.java @@ -227,19 +227,13 @@ public String[] toolCategories () } @Override - public boolean willAllowOffhandWeapon () + public boolean allowOffhand(ItemStack mainhand, ItemStack offhand) { return false; } @Override - public boolean willAllowShield () - { - return false; - } - - @Override - public boolean isOffhandHandDualWeapon () + public boolean isOffhandHandDual(ItemStack off) { return false; } diff --git a/src/tconstruct/items/tools/Cleaver.java b/src/tconstruct/items/tools/Cleaver.java index d0948202340..77ef2145e29 100644 --- a/src/tconstruct/items/tools/Cleaver.java +++ b/src/tconstruct/items/tools/Cleaver.java @@ -4,6 +4,7 @@ import tconstruct.library.tools.AbilityHelper; import tconstruct.library.tools.Weapon; import tconstruct.util.config.PHConstruct; +import mods.battlegear2.items.ItemShield; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; @@ -164,25 +165,30 @@ public boolean onEntitySwing (EntityLiving entity, ItemStack stack) }*/ @Override - public boolean willAllowOffhandWeapon () + public boolean allowOffhand(ItemStack mainhand, ItemStack offhand) { - return false; - } - - @Override - public boolean willAllowShield () - { - return PHConstruct.isCleaverTwoHanded; + try + { + if ((PHConstruct.isCleaverTwoHanded) && (offhand.getItem() instanceof ItemShield)) + { + return true; + } + else return false; + } + catch (Exception e) + { + return false; + } } @Override - public boolean isOffhandHandDualWeapon () + public boolean isOffhandHandDual(ItemStack off) { return false; } @Override - public boolean sheatheOnBack () + public boolean sheatheOnBack(ItemStack item) { return true; } diff --git a/src/tconstruct/items/tools/Excavator.java b/src/tconstruct/items/tools/Excavator.java index 1ccdfe72567..62dc95d1286 100644 --- a/src/tconstruct/items/tools/Excavator.java +++ b/src/tconstruct/items/tools/Excavator.java @@ -295,25 +295,19 @@ public float getStrVsBlock (ItemStack stack, Block block, int meta) } @Override - public boolean willAllowOffhandWeapon () + public boolean allowOffhand(ItemStack mainhand, ItemStack offhand) { return false; } @Override - public boolean willAllowShield () + public boolean isOffhandHandDual(ItemStack off) { return false; } @Override - public boolean isOffhandHandDualWeapon () - { - return false; - } - - @Override - public boolean sheatheOnBack () + public boolean sheatheOnBack(ItemStack item) { return true; } diff --git a/src/tconstruct/items/tools/Hammer.java b/src/tconstruct/items/tools/Hammer.java index 61957ba8708..aedc164e8fa 100644 --- a/src/tconstruct/items/tools/Hammer.java +++ b/src/tconstruct/items/tools/Hammer.java @@ -10,6 +10,7 @@ import tconstruct.library.tools.AbilityHelper; import tconstruct.library.tools.HarvestTool; +import mods.battlegear2.items.ItemShield; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; @@ -422,19 +423,30 @@ public String[] toolCategories () } @Override - public boolean willAllowOffhandWeapon () + public boolean allowOffhand(ItemStack mainhand, ItemStack offhand) { - return false; + try + { + if (offhand.getItem() instanceof ItemShield) + { + return true; + } + else return false; + } + catch (Exception e) + { + return false; + } } @Override - public boolean isOffhandHandDualWeapon () + public boolean isOffhandHandDual(ItemStack off) { return false; } @Override - public boolean sheatheOnBack () + public boolean sheatheOnBack(ItemStack item) { return true; } diff --git a/src/tconstruct/items/tools/Hatchet.java b/src/tconstruct/items/tools/Hatchet.java index abf57990984..c82d4c1af46 100644 --- a/src/tconstruct/items/tools/Hatchet.java +++ b/src/tconstruct/items/tools/Hatchet.java @@ -107,7 +107,7 @@ public String getDefaultFolder () } @Override - public boolean isOffhandHandDualWeapon () + public boolean isOffhandHandDual(ItemStack off) { return PHConstruct.isHatchetWeapon; } diff --git a/src/tconstruct/items/tools/LumberAxe.java b/src/tconstruct/items/tools/LumberAxe.java index 6087ad2ddaa..2beb9e077fa 100644 --- a/src/tconstruct/items/tools/LumberAxe.java +++ b/src/tconstruct/items/tools/LumberAxe.java @@ -402,25 +402,19 @@ public int durabilityTypeExtra () } @Override - public boolean willAllowOffhandWeapon () + public boolean allowOffhand(ItemStack mainhand, ItemStack offhand) { return false; } @Override - public boolean willAllowShield () + public boolean isOffhandHandDual(ItemStack off) { return false; } @Override - public boolean isOffhandHandDualWeapon () - { - return false; - } - - @Override - public boolean sheatheOnBack () + public boolean sheatheOnBack(ItemStack item) { return true; } diff --git a/src/tconstruct/items/tools/Mattock.java b/src/tconstruct/items/tools/Mattock.java index c6bb95130ee..a06c15d1dd4 100644 --- a/src/tconstruct/items/tools/Mattock.java +++ b/src/tconstruct/items/tools/Mattock.java @@ -146,25 +146,19 @@ private boolean allowCrafting (int head) } @Override - public boolean willAllowOffhandWeapon () + public boolean allowOffhand(ItemStack mainhand, ItemStack offhand) { return false; } @Override - public boolean willAllowShield () + public boolean isOffhandHandDual(ItemStack off) { return false; } @Override - public boolean isOffhandHandDualWeapon () - { - return false; - } - - @Override - public boolean sheatheOnBack () + public boolean sheatheOnBack(ItemStack item) { return true; } diff --git a/src/tconstruct/items/tools/Pickaxe.java b/src/tconstruct/items/tools/Pickaxe.java index 6388c83d74f..f2072796c71 100644 --- a/src/tconstruct/items/tools/Pickaxe.java +++ b/src/tconstruct/items/tools/Pickaxe.java @@ -4,6 +4,7 @@ import tconstruct.library.tools.HarvestTool; import net.minecraft.block.material.Material; import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; public class Pickaxe extends HarvestTool { @@ -70,7 +71,7 @@ public String getDefaultFolder () } @Override - public boolean isOffhandHandDualWeapon () + public boolean isOffhandHandDual(ItemStack off) { return false; } diff --git a/src/tconstruct/items/tools/Scythe.java b/src/tconstruct/items/tools/Scythe.java index 75619d9179c..6909769eaa3 100644 --- a/src/tconstruct/items/tools/Scythe.java +++ b/src/tconstruct/items/tools/Scythe.java @@ -219,25 +219,19 @@ public boolean onLeftClickEntity (ItemStack stack, EntityPlayer player, Entity e } @Override - public boolean willAllowOffhandWeapon () + public boolean allowOffhand(ItemStack mainhand, ItemStack offhand) { return false; } @Override - public boolean willAllowShield () + public boolean isOffhandHandDual(ItemStack off) { return false; } @Override - public boolean isOffhandHandDualWeapon () - { - return false; - } - - @Override - public boolean sheatheOnBack () + public boolean sheatheOnBack(ItemStack item) { return true; } diff --git a/src/tconstruct/items/tools/Shortbow.java b/src/tconstruct/items/tools/Shortbow.java index 3df3735c1b3..0aca07549cb 100644 --- a/src/tconstruct/items/tools/Shortbow.java +++ b/src/tconstruct/items/tools/Shortbow.java @@ -192,25 +192,19 @@ public String getBowstringName (int type) } @Override - public boolean willAllowOffhandWeapon () + public boolean allowOffhand(ItemStack mainhand, ItemStack offhand) { return false; } @Override - public boolean willAllowShield () + public boolean isOffhandHandDual(ItemStack off) { return false; } @Override - public boolean isOffhandHandDualWeapon () - { - return false; - } - - @Override - public boolean sheatheOnBack () + public boolean sheatheOnBack(ItemStack item) { return true; } diff --git a/src/tconstruct/items/tools/Shovel.java b/src/tconstruct/items/tools/Shovel.java index 78ebbc14cde..dfa29cf8c40 100644 --- a/src/tconstruct/items/tools/Shovel.java +++ b/src/tconstruct/items/tools/Shovel.java @@ -4,6 +4,7 @@ import tconstruct.library.tools.HarvestTool; import net.minecraft.block.material.Material; import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -91,7 +92,7 @@ public String getDefaultFolder () } @Override - public boolean isOffhandHandDualWeapon () + public boolean isOffhandHandDual(ItemStack off) { return false; } diff --git a/src/tconstruct/library/tools/ToolCore.java b/src/tconstruct/library/tools/ToolCore.java index f70c7f94f51..b2e1afb6c65 100644 --- a/src/tconstruct/library/tools/ToolCore.java +++ b/src/tconstruct/library/tools/ToolCore.java @@ -1022,25 +1022,19 @@ public boolean canUse (ItemStack itemStack, int amount) /* Battlegear support, IBattlegearWeapon */ @Override - public boolean willAllowOffhandWeapon () + public boolean allowOffhand(ItemStack mainhand, ItemStack offhand) { return true; } @Override - public boolean willAllowShield () + public boolean isOffhandHandDual(ItemStack off) { return true; } @Override - public boolean isOffhandHandDualWeapon () - { - return true; - } - - @Override - public boolean sheatheOnBack () + public boolean sheatheOnBack(ItemStack item) { return false; } @@ -1057,7 +1051,6 @@ public boolean offhandClickAir (PlayerInteractEvent event, ItemStack mainhandIte return true; } - @Override public boolean offhandClickBlock (PlayerInteractEvent event, ItemStack mainhandItem, ItemStack offhandItem) { return true;