Skip to content

Commit

Permalink
Added tier getter for fishing rods
Browse files Browse the repository at this point in the history
  • Loading branch information
GirafiStudios committed Oct 4, 2020
1 parent 75b4ae2 commit af165ea
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,17 @@
import java.util.List;

public class AquaFishingRodItem extends FishingRodItem {
private final IItemTier material;
private final IItemTier tier;
private final int enchantability;

public AquaFishingRodItem(IItemTier material, Properties properties) {
public AquaFishingRodItem(IItemTier tier, Properties properties) {
super(properties);
this.enchantability = material == ItemTier.WOOD ? 10 : material.getEnchantability();
this.material = material;
this.enchantability = tier == ItemTier.WOOD ? 10 : tier.getEnchantability();
this.tier = tier;
}

public IItemTier getTier() { //Added getter, so other mods can access it
return tier;
}

@Override
Expand All @@ -54,7 +58,7 @@ public boolean showDurabilityBar(@Nonnull ItemStack stack) {
@Nonnull
public ActionResult<ItemStack> onItemRightClick(@Nonnull World world, PlayerEntity player, @Nonnull Hand hand) {
ItemStack heldStack = player.getHeldItem(hand);
boolean isAdminRod = AquaConfig.BASIC_OPTIONS.debugMode.get() && this.material == AquacultureAPI.MATS.NEPTUNIUM;
boolean isAdminRod = AquaConfig.BASIC_OPTIONS.debugMode.get() && this.tier == AquacultureAPI.MATS.NEPTUNIUM;
int lureSpeed;
int damage = this.getDamage(heldStack);
if (damage >= this.getMaxDamage(heldStack)) return new ActionResult<>(ActionResultType.FAIL, heldStack);
Expand Down Expand Up @@ -83,7 +87,7 @@ public ActionResult<ItemStack> onItemRightClick(@Nonnull World world, PlayerEnti
if (!world.isRemote) {
//Lure Speed
lureSpeed = EnchantmentHelper.getFishingSpeedBonus(heldStack);
if (this.material == AquacultureAPI.MATS.NEPTUNIUM) lureSpeed += 1;
if (this.tier == AquacultureAPI.MATS.NEPTUNIUM) lureSpeed += 1;
ItemStack bait = getBait(heldStack);
if (!isAdminRod && !bait.isEmpty()) {
lureSpeed += ((BaitItem) bait.getItem()).getLureSpeedModifier();
Expand All @@ -103,7 +107,7 @@ public ActionResult<ItemStack> onItemRightClick(@Nonnull World world, PlayerEnti

@Override
public boolean getIsRepairable(@Nonnull ItemStack toRepair, @Nonnull ItemStack repair) {
return this.material.getRepairMaterial().test(repair) || super.getIsRepairable(toRepair, repair);
return this.tier.getRepairMaterial().test(repair) || super.getIsRepairable(toRepair, repair);
}

@Nonnull
Expand Down

0 comments on commit af165ea

Please sign in to comment.