mirror of
https://github.com/GTNewHorizons/IguanaTweaksTConstruct.git
synced 2026-11-26 06:43:05 +00:00
Add a config option and logic to penalize part-replacement with an xp-penality
This commit is contained in:
1 parent
bd71187a25
commit
1cef48a667
2 files changed
+27
No files matched your search
@@ -39,6 +39,10 @@ public class Config {
|
||||
public static int durabilityPercentage;
|
||||
public static int miningSpeedPercentage;
|
||||
|
||||
// part replacement
|
||||
public static int partReplacementXpPenality;
|
||||
public static int partReplacementBoostXpPenality;
|
||||
|
||||
// heads
|
||||
public static int baseHeadDropChance;
|
||||
public static int beheadingHeadDropChance;
|
||||
@@ -72,6 +76,7 @@ public class Config {
|
||||
final String CATEGORY_Leveling = "ToolLeveling";
|
||||
final String CATEGORY_PickLeveling = "PickLeveling";
|
||||
final String CATEGORY_HarvestLevels = "HarvestLevelTweaks";
|
||||
final String CATEGORY_PartReplacement = "PartReplacement";
|
||||
final String CATEGORY_Heads = "MobHeads";
|
||||
final String CATEGORY_Tweaks = "Tweaks";
|
||||
final String CATEGORY_Debug = "Debug";
|
||||
@@ -117,6 +122,10 @@ public class Config {
|
||||
durabilityPercentage = configfile.getInt("durabilityPercentage", CATEGORY_HarvestLevels, 80, 1, 999, "Change durability of all tool materials (in percent)");
|
||||
miningSpeedPercentage = configfile.getInt("miningSpeedPercentage", CATEGORY_HarvestLevels, 100, 1, 999, "Change mining speed of all tool materials (in percent)");
|
||||
|
||||
/** PartReplacement Module **/
|
||||
partReplacementXpPenality = configfile.getInt("XpPenality", CATEGORY_PartReplacement, 0, 0, 100, "How much of the current XP% shall be removed when replacing parts (So if you had 50%, and penality is 10% it'll remove 5% xp, resulting in 45%). Does not remove Skill Levels.");
|
||||
partReplacementBoostXpPenality = configfile.getInt("PickBoostXpPenality", CATEGORY_PartReplacement, 5, 0, 100, "How much of the current XP% to the next mining level shall be removed when replacing parts. Useful to remove the mining level boost on part replacement.");
|
||||
|
||||
/** MobHeads **/
|
||||
// todo: implement
|
||||
configfile.setCategoryComment(CATEGORY_Heads, "Mob Head Module: Adds additional Mob heads and drops");
|
||||
|
||||
@@ -2,6 +2,7 @@ package iguanaman.iguanatweakstconstruct.replacing;
|
||||
|
||||
import iguanaman.iguanatweakstconstruct.leveling.LevelingLogic;
|
||||
import iguanaman.iguanatweakstconstruct.leveling.modifiers.ModXpAwareRedstone;
|
||||
import iguanaman.iguanatweakstconstruct.reference.Config;
|
||||
import iguanaman.iguanatweakstconstruct.util.Log;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -158,6 +159,12 @@ public abstract class ReplacementLogic {
|
||||
// apply transition
|
||||
xp *= newRequiredXp / (float) oldRequiredXp;
|
||||
|
||||
// xp penality?
|
||||
if(Config.partReplacementXpPenality > 0)
|
||||
{
|
||||
xp *= (100.0f-Config.partReplacementXpPenality)/100.0f;
|
||||
}
|
||||
|
||||
tags.setInteger(LevelingLogic.TAG_EXP, Math.round(xp));
|
||||
}
|
||||
|
||||
@@ -172,6 +179,17 @@ public abstract class ReplacementLogic {
|
||||
// apply transition
|
||||
xp *= newRequiredBoostXp / (float) oldRequiredBoostXp;
|
||||
|
||||
// xp penality?
|
||||
if(Config.partReplacementBoostXpPenality > 0)
|
||||
{
|
||||
if(LevelingLogic.isBoosted(tags)) {
|
||||
tags.setBoolean(LevelingLogic.TAG_IS_BOOSTED, false);
|
||||
xp = newRequiredBoostXp;
|
||||
}
|
||||
|
||||
xp *= (100.0f-Config.partReplacementBoostXpPenality)/100.0f;
|
||||
}
|
||||
|
||||
tags.setInteger(LevelingLogic.TAG_BOOST_EXP, Math.round(xp));
|
||||
|
||||
// already full xp?
|
||||
|
||||
Reference in new issue
Block a user