mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-27 11:14:44 +02:00
Skills which used to unlock at level 5 now unlock at level 1 and some
tweaks to ranks of other skills, and length scaling for super abilities. Early game boost has also been modified.
This commit is contained in:
@ -10,7 +10,6 @@ import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -19,25 +18,17 @@ import java.util.Set;
|
||||
|
||||
public final class Woodcutting {
|
||||
public static int treeFellerThreshold = Config.getInstance().getTreeFellerThreshold();
|
||||
|
||||
|
||||
protected static boolean treeFellerReachedThreshold = false;
|
||||
|
||||
protected enum ExperienceGainMethod {
|
||||
DEFAULT,
|
||||
TREE_FELLER,
|
||||
}
|
||||
|
||||
private Woodcutting() {}
|
||||
|
||||
/**
|
||||
* Retrieves the experience reward from a log
|
||||
*
|
||||
* @param blockState Log being broken
|
||||
* @param experienceGainMethod How the log is being broken
|
||||
* @return Amount of experience
|
||||
*/
|
||||
protected static int getExperienceFromLog(BlockState blockState, ExperienceGainMethod experienceGainMethod) {
|
||||
protected static int getExperienceFromLog(BlockState blockState) {
|
||||
if (mcMMO.getModManager().isCustomLog(blockState)) {
|
||||
return mcMMO.getModManager().getBlock(blockState).getXpGain();
|
||||
}
|
||||
@ -45,6 +36,33 @@ public final class Woodcutting {
|
||||
return ExperienceConfig.getInstance().getXp(PrimarySkillType.WOODCUTTING, blockState.getType());
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the experience reward from logging via Tree Feller
|
||||
* Experience is reduced per log processed so far
|
||||
* Experience is only reduced if the config option to reduce Tree Feller XP is set
|
||||
* Experience per log will not fall below 1 unless the experience for that log is set to 0 in the config
|
||||
*
|
||||
* @param blockState Log being broken
|
||||
* @param woodCount how many logs have given out XP for this tree feller so far
|
||||
* @return Amount of experience
|
||||
*/
|
||||
protected static int processTreeFellerXPGains(BlockState blockState, int woodCount) {
|
||||
int rawXP = ExperienceConfig.getInstance().getXp(PrimarySkillType.WOODCUTTING, blockState.getType());
|
||||
|
||||
if(rawXP <= 0)
|
||||
return 0;
|
||||
|
||||
if(ExperienceConfig.getInstance().isTreeFellerXPReduced()) {
|
||||
int reducedXP = 1 + (woodCount * 5);
|
||||
rawXP = Math.max(1, rawXP - reducedXP);
|
||||
return rawXP;
|
||||
} else {
|
||||
return ExperienceConfig.getInstance().getXp(PrimarySkillType.WOODCUTTING, blockState.getType());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Checks for double drops
|
||||
*
|
||||
|
@ -9,7 +9,6 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.skills.woodcutting.Woodcutting.ExperienceGainMethod;
|
||||
import com.gmail.nossr50.util.*;
|
||||
import com.gmail.nossr50.util.player.NotificationManager;
|
||||
import com.gmail.nossr50.util.random.RandomChanceUtil;
|
||||
@ -54,7 +53,7 @@ public class WoodcuttingManager extends SkillManager {
|
||||
* @param blockState Block being broken
|
||||
*/
|
||||
public void woodcuttingBlockCheck(BlockState blockState) {
|
||||
int xp = Woodcutting.getExperienceFromLog(blockState, ExperienceGainMethod.DEFAULT);
|
||||
int xp = Woodcutting.getExperienceFromLog(blockState);
|
||||
|
||||
switch (blockState.getType()) {
|
||||
case BROWN_MUSHROOM_BLOCK:
|
||||
@ -116,6 +115,7 @@ public class WoodcuttingManager extends SkillManager {
|
||||
private void dropBlocks(Set<BlockState> treeFellerBlocks) {
|
||||
Player player = getPlayer();
|
||||
int xp = 0;
|
||||
int processedLogCount = 0;
|
||||
|
||||
for (BlockState blockState : treeFellerBlocks) {
|
||||
Block block = blockState.getBlock();
|
||||
@ -126,30 +126,18 @@ public class WoodcuttingManager extends SkillManager {
|
||||
|
||||
Material material = blockState.getType();
|
||||
|
||||
//TODO: Update this to drop the correct items/blocks via NMS
|
||||
if (material == Material.BROWN_MUSHROOM_BLOCK || material == Material.RED_MUSHROOM_BLOCK) {
|
||||
xp += Woodcutting.getExperienceFromLog(blockState, ExperienceGainMethod.TREE_FELLER);
|
||||
xp += Woodcutting.processTreeFellerXPGains(blockState, processedLogCount);
|
||||
Misc.dropItems(Misc.getBlockCenter(blockState), block.getDrops());
|
||||
}
|
||||
else if (mcMMO.getModManager().isCustomLog(blockState)) {
|
||||
if (canGetDoubleDrops()) {
|
||||
Woodcutting.checkForDoubleDrop(blockState);
|
||||
}
|
||||
|
||||
CustomBlock customBlock = mcMMO.getModManager().getBlock(blockState);
|
||||
xp = customBlock.getXpGain();
|
||||
|
||||
} else if (mcMMO.getModManager().isCustomLeaf(blockState)) {
|
||||
Misc.dropItems(Misc.getBlockCenter(blockState), block.getDrops());
|
||||
}
|
||||
else if (mcMMO.getModManager().isCustomLeaf(blockState)) {
|
||||
Misc.dropItems(Misc.getBlockCenter(blockState), block.getDrops());
|
||||
}
|
||||
else {
|
||||
|
||||
} else {
|
||||
if (BlockUtils.isLog(blockState)) {
|
||||
if (canGetDoubleDrops()) {
|
||||
Woodcutting.checkForDoubleDrop(blockState);
|
||||
}
|
||||
xp += Woodcutting.getExperienceFromLog(blockState, ExperienceGainMethod.TREE_FELLER);
|
||||
xp += Woodcutting.processTreeFellerXPGains(blockState, processedLogCount);
|
||||
Misc.dropItems(Misc.getBlockCenter(blockState), block.getDrops());
|
||||
}
|
||||
if (BlockUtils.isLeaves(blockState)) {
|
||||
@ -159,6 +147,7 @@ public class WoodcuttingManager extends SkillManager {
|
||||
|
||||
blockState.setType(Material.AIR);
|
||||
blockState.update(true);
|
||||
processedLogCount+=1;
|
||||
}
|
||||
|
||||
applyXpGain(xp, XPGainReason.PVE);
|
||||
|
Reference in New Issue
Block a user