From 55395661834115679dc1db6780333b8bdf852000 Mon Sep 17 00:00:00 2001 From: riking Date: Wed, 4 Dec 2013 16:16:48 -0800 Subject: [PATCH] Include new 1.7 biomes in fishing biome XP boost and Ice Fishing check --- .../gmail/nossr50/commands/skills/FishingCommand.java | 4 +--- .../java/com/gmail/nossr50/skills/fishing/Fishing.java | 10 ++++++++++ .../gmail/nossr50/skills/fishing/FishingManager.java | 10 ++-------- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java index c14d9370a..ab0e6aa8f 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java @@ -99,9 +99,7 @@ public class FishingCommand extends SkillCommand { location = player.getLocation(); } - Biome biome = location.getBlock().getBiome(); - - if (biome == Biome.RIVER || biome == Biome.OCEAN) { + if (Fishing.masterAnglerBiomes.contains(location.getBlock().getBiome())) { rawBiteChance = rawBiteChance * AdvancedConfig.getInstance().getMasterAnglerBiomeModifier(); } diff --git a/src/main/java/com/gmail/nossr50/skills/fishing/Fishing.java b/src/main/java/com/gmail/nossr50/skills/fishing/Fishing.java index 9ae2b9a4f..ae47266b7 100644 --- a/src/main/java/com/gmail/nossr50/skills/fishing/Fishing.java +++ b/src/main/java/com/gmail/nossr50/skills/fishing/Fishing.java @@ -1,9 +1,12 @@ package com.gmail.nossr50.skills.fishing; +import java.util.EnumSet; import java.util.HashMap; import java.util.List; +import java.util.Set; import org.bukkit.Material; +import org.bukkit.block.Biome; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.LivingEntity; import org.bukkit.inventory.ItemStack; @@ -56,6 +59,13 @@ public final class Fishing { public static final double STORM_MODIFIER = 0.909; + public static Set masterAnglerBiomes = EnumSet.of(Biome.RIVER, Biome.OCEAN, Biome.DEEP_OCEAN); + public static Set iceFishingBiomes = EnumSet.of( + Biome.FROZEN_OCEAN, Biome.FROZEN_RIVER, + Biome.TAIGA, Biome.TAIGA_HILLS, Biome.TAIGA_MOUNTAINS, + Biome.ICE_PLAINS, Biome.ICE_MOUNTAINS, Biome.ICE_PLAINS_SPIKES, + Biome.COLD_TAIGA, Biome.COLD_TAIGA_HILLS, Biome.COLD_TAIGA_MOUNTAINS); + private Fishing() {} /** diff --git a/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java b/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java index 632859e4e..78e765d30 100644 --- a/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java @@ -12,7 +12,6 @@ import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.WeatherType; import org.bukkit.World; -import org.bukkit.block.Biome; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.enchantments.Enchantment; @@ -70,7 +69,6 @@ public class FishingManager extends SkillManager { private Location fishingTarget; private Item fishingCatch; private Location hookLocation; - public FishingManager(McMMOPlayer mcMMOPlayer) { super(mcMMOPlayer, SkillType.FISHING); } @@ -198,10 +196,7 @@ public class FishingManager extends SkillManager { } // Make sure this is a body of water, not just a block of ice. - Biome biome = block.getBiome(); - boolean isFrozenBiome = (biome == Biome.FROZEN_OCEAN || biome == Biome.FROZEN_RIVER || biome == Biome.TAIGA || biome == Biome.TAIGA_HILLS || biome == Biome.ICE_PLAINS || biome == Biome.ICE_MOUNTAINS); - - if (!isFrozenBiome && (block.getRelative(BlockFace.DOWN, 3).getType() != Material.STATIONARY_WATER)) { + if (!Fishing.iceFishingBiomes.contains(block.getBiome()) && (block.getRelative(BlockFace.DOWN, 3).getType() != Material.STATIONARY_WATER)) { return false; } @@ -281,12 +276,11 @@ public class FishingManager extends SkillManager { public void masterAngler(Fish hook) { Player player = getPlayer(); Location location = hook.getLocation(); - Biome biome = location.getBlock().getBiome(); double biteChance = hook.getBiteChance(); hookLocation = location; - if (biome == Biome.RIVER || biome == Biome.OCEAN) { + if (Fishing.masterAnglerBiomes.contains(location.getBlock().getBiome())) { biteChance = biteChance * AdvancedConfig.getInstance().getMasterAnglerBiomeModifier(); }