Skip to content

Commit

Permalink
refactor(api): enchantment FishingRod.preFishingRodCast returns IntPair
Browse files Browse the repository at this point in the history
Co-authored-by: lainio24 <[email protected]>
  • Loading branch information
WakelessSloth56 and lainio24 committed Feb 22, 2024
1 parent 3f5e4dc commit ede77b9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import net.minecraft.world.item.enchantment.Enchantment;
import net.minecraft.world.item.enchantment.EnchantmentCategory;
import net.minecraft.world.item.enchantment.Enchantments;
import org.apache.commons.lang3.tuple.Pair;
import org.auioc.mcmod.arnicalib.base.tuple.IntPair;
import org.auioc.mcmod.harmoniclib.enchantment.api.HLEnchantment;
import org.auioc.mcmod.harmoniclib.enchantment.api.IItemEnchantment;

Expand Down Expand Up @@ -67,14 +67,14 @@ public int getMaxCost(int lvl) {
}

@Override
public Pair<Integer, Integer> preFishingRodCast(int lvl, ItemStack fishingRod, ServerPlayer player, int speedBonus, int luckBonus) {
public IntPair preFishingRodCast(int lvl, ItemStack fishingRod, ServerPlayer player, int speedBonus, int luckBonus) {
float temperature = player.level().getBiome(player.blockPosition()).value().getBaseTemperature();
if (temperature <= 0.05F) {
luckBonus += lvl * 2;
} else if (temperature <= 0.3F) {
luckBonus += lvl;
}
return Pair.of(speedBonus, luckBonus);
return new IntPair(speedBonus, luckBonus);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,8 @@ public static Pair<Integer, Integer> preFishingRodCast(ItemStack fishingRod, Ser
ench, IItemEnchantment.FishingRod.class,
(e) -> {
var r = e.preFishingRodCast(lvl, fishingRod, player, bonus.getLeft(), bonus.getRight());
bonus.setLeft(r.getLeft());
bonus.setRight(r.getRight());
bonus.setLeft(r.x());
bonus.setRight(r.y());
}
),
fishingRod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import net.minecraft.world.level.Level;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import org.apache.commons.lang3.tuple.Pair;
import org.auioc.mcmod.arnicalib.base.tuple.IntPair;
import org.jetbrains.annotations.NotNull;

import javax.annotation.Nullable;
Expand Down Expand Up @@ -58,7 +58,7 @@ public static interface Elytra {

public static interface FishingRod {

Pair<Integer, Integer> preFishingRodCast(int lvl, ItemStack fishingRod, ServerPlayer player, int speedBonus, int luckBonus);
IntPair preFishingRodCast(int lvl, ItemStack fishingRod, ServerPlayer player, int speedBonus, int luckBonus);

}

Expand Down

0 comments on commit ede77b9

Please sign in to comment.