mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-01-12 10:50:42 +01:00
Reimplemented TreeFeller on Jungle Trees experience nerf
This commit is contained in:
parent
7ccadae489
commit
d43e61a49c
@ -18,6 +18,7 @@ import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.Combat;
|
||||
import com.gmail.nossr50.skills.SkillType;
|
||||
import com.gmail.nossr50.skills.SkillTools;
|
||||
import com.gmail.nossr50.skills.woodcutting.Woodcutting.ExperienceGainMethod;
|
||||
import com.gmail.nossr50.util.BlockChecks;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.ModChecks;
|
||||
@ -178,14 +179,12 @@ public abstract class TreeFeller {
|
||||
Woodcutting.checkDoubleDrop(player, block);
|
||||
|
||||
try {
|
||||
xp += Woodcutting.getExperienceFromLog(block);
|
||||
xp += Woodcutting.getExperienceFromLog(block, ExperienceGainMethod.TREE_FELLER);
|
||||
}
|
||||
catch (IllegalArgumentException exception) {
|
||||
break;
|
||||
}
|
||||
|
||||
// TODO: Nerf XP from jungle trees, as it was done previously
|
||||
|
||||
Misc.dropItem(block.getLocation(), new ItemStack(Material.LOG, 1, Woodcutting.extractLogItemData(block.getData())));
|
||||
break;
|
||||
case LEAVES:
|
||||
|
@ -23,6 +23,11 @@ import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public final class Woodcutting {
|
||||
protected enum ExperienceGainMethod {
|
||||
DEFAULT,
|
||||
TREE_FELLER,
|
||||
};
|
||||
|
||||
public static final int DOUBLE_DROP_MAX_LEVEL = AdvancedConfig.getInstance().getMiningDoubleDropMaxLevel();
|
||||
public static final double DOUBLE_DROP_CHANCE = AdvancedConfig.getInstance().getMiningDoubleDropChance();
|
||||
public static final int LEAF_BLOWER_UNLOCK_LEVEL = AdvancedConfig.getInstance().getLeafBlowUnlockLevel();
|
||||
@ -69,7 +74,7 @@ public final class Woodcutting {
|
||||
}
|
||||
else {
|
||||
try {
|
||||
xp = getExperienceFromLog(block);
|
||||
xp = getExperienceFromLog(block, ExperienceGainMethod.DEFAULT);
|
||||
}
|
||||
catch (IllegalArgumentException exception) {
|
||||
return;
|
||||
@ -84,10 +89,11 @@ public final class Woodcutting {
|
||||
* Retrieves the experience reward from a log
|
||||
*
|
||||
* @param log Log being broken
|
||||
* @param experienceGainMethod How the log is being broken
|
||||
* @return Amount of experience
|
||||
* @throws IllegalArgumentException if 'log' is invalid
|
||||
*/
|
||||
protected static int getExperienceFromLog(Block log) {
|
||||
protected static int getExperienceFromLog(Block log, ExperienceGainMethod experienceGainMethod) {
|
||||
TreeSpecies logType = TreeSpecies.getByData(extractLogItemData(log.getData()));
|
||||
|
||||
// Apparently species can be null in certain cases (custom server mods?)
|
||||
@ -104,7 +110,14 @@ public final class Woodcutting {
|
||||
case BIRCH:
|
||||
return Config.getInstance().getWoodcuttingXPBirch();
|
||||
case JUNGLE:
|
||||
return Config.getInstance().getWoodcuttingXPJungle();
|
||||
int xp = Config.getInstance().getWoodcuttingXPJungle();
|
||||
|
||||
switch (experienceGainMethod) {
|
||||
case TREE_FELLER:
|
||||
return (int) (xp * 0.5);
|
||||
default:
|
||||
return xp;
|
||||
}
|
||||
default:
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user