Merge branch '1.21' into new-container-api
This commit is contained in:
commit
d57371ca13
@ -16,11 +16,11 @@ object PlayerConfig : AbstractConfig("player") {
|
||||
|
||||
val REGENERATE_ENERGY_EFFICIENCY_FOOD: Double by builder
|
||||
.comment("How much % of food points to convert to energy")
|
||||
.defineInRange("REGENERATE_ENERGY_EFFICIENCY_FOOD", 0.75, 0.0)
|
||||
.defineInRange("REGENERATE_ENERGY_EFFICIENCY_FOOD", 0.4, 0.0)
|
||||
|
||||
val REGENERATE_ENERGY_EFFICIENCY_SATURATION: Double by builder
|
||||
.comment("How much % of food saturation points to convert to energy")
|
||||
.defineInRange("REGENERATE_ENERGY_EFFICIENCY_SATURATION", 0.4, 0.0)
|
||||
.defineInRange("REGENERATE_ENERGY_EFFICIENCY_SATURATION", 0.2, 0.0)
|
||||
|
||||
val REGENERATE_ENERGY_IN_PEACEFUL: Boolean by builder
|
||||
.comment("Regenerate energy while in peaceful")
|
||||
@ -39,6 +39,28 @@ object PlayerConfig : AbstractConfig("player") {
|
||||
.comment("for android players, since 'hunger' (for compatibility) is managed by mod in such case")
|
||||
.defineInRange("TIME_BETWEEN_NATURAL_REGENERATION", 120, 0, Int.MAX_VALUE)
|
||||
|
||||
val ANDROID_ENERGY_PER_HUNGER_POINT by builder.defineDecimal("energyPerHunger", Decimal(2000), Decimal.ZERO)
|
||||
val ANDROID_MAX_ENERGY by builder
|
||||
.comment("Internal battery of every android has this much storage")
|
||||
.comment("Keep in mind that already existing players won't get their value changed since it is", "stored inside their savedata")
|
||||
.defineDecimal("capacity", Decimal(80_000), Decimal.ZERO)
|
||||
|
||||
val NIGHT_VISION_POWER_DRAW by builder.defineDecimal("nightVisionPowerDraw", Decimal(8), Decimal.ZERO)
|
||||
|
||||
val FALL_DAMAGE_REDUCTION_PER_LEVEL_P: Double by builder
|
||||
.comment("In percent. Level of feature is multiplied by this")
|
||||
.comment("First, fall damage is reduced by flat resistance, then reduced by percentage resistance (this)")
|
||||
.defineInRange("FALL_DAMAGE_REDUCTION_PER_LEVEL_P", 0.2, 0.01, 1.0)
|
||||
|
||||
val FALL_DAMAGE_REDUCTION_PER_LEVEL_F: Double by builder
|
||||
.comment("In flat half of hearts. Level of feature is multiplied by this")
|
||||
.comment("First, fall damage is reduced by flat resistance (this), then reduced by percentage resistance")
|
||||
.defineInRange("FALL_DAMAGE_REDUCTION_PER_LEVEL_F", 1.5, 0.0, Float.MAX_VALUE.toDouble())
|
||||
|
||||
val SWIM_BOOSTERS: Double by builder
|
||||
.comment("Increase per level")
|
||||
.defineInRange("SWIM_BOOSTERS", 0.25, 0.0, Float.MAX_VALUE.toDouble())
|
||||
|
||||
init {
|
||||
builder.pop()
|
||||
}
|
||||
@ -71,27 +93,6 @@ object PlayerConfig : AbstractConfig("player") {
|
||||
}
|
||||
}
|
||||
|
||||
val ANDROID_ENERGY_PER_HUNGER_POINT by builder.defineDecimal("energyPerHunger", Decimal(2000), Decimal.ZERO)
|
||||
val ANDROID_MAX_ENERGY by builder
|
||||
.comment("Internal battery of every android has this much storage")
|
||||
.comment("Keep in mind that already existing players won't get their value changed since it is", "stored inside their savedata")
|
||||
.defineDecimal("capacity", Decimal(80_000), Decimal.ZERO)
|
||||
val NIGHT_VISION_POWER_DRAW by builder.defineDecimal("nightVisionPowerDraw", Decimal(8), Decimal.ZERO)
|
||||
|
||||
val FALL_DAMAGE_REDUCTION_PER_LEVEL_P: Double by builder
|
||||
.comment("In percent. Level of feature is multiplied by this")
|
||||
.comment("First, fall damage is reduced by flat resistance, then reduced by percentage resistance (this)")
|
||||
.defineInRange("FALL_DAMAGE_REDUCTION_PER_LEVEL_P", 0.2, 0.01, 1.0)
|
||||
|
||||
val FALL_DAMAGE_REDUCTION_PER_LEVEL_F: Double by builder
|
||||
.comment("In flat half of hearts. Level of feature is multiplied by this")
|
||||
.comment("First, fall damage is reduced by flat resistance (this), then reduced by percentage resistance")
|
||||
.defineInRange("FALL_DAMAGE_REDUCTION_PER_LEVEL_F", 1.5, 0.0, Float.MAX_VALUE.toDouble())
|
||||
|
||||
val SWIM_BOOSTERS: Double by builder
|
||||
.comment("Increase per level")
|
||||
.defineInRange("SWIM_BOOSTERS", 0.25, 0.0, Float.MAX_VALUE.toDouble())
|
||||
|
||||
object EnderTeleporter {
|
||||
init {
|
||||
builder.comment("Ender Teleporter ability").push("EnderTeleporter")
|
||||
|
@ -69,13 +69,13 @@ class MatteryFoodData(private var player: Player) : FoodData() {
|
||||
private var energyToDrain = Decimal.ZERO
|
||||
|
||||
private fun tickExhaustion() {
|
||||
if (exhaustionLevel >= EXHAUSTION_PER_HUNGER_POINT) {
|
||||
if (player.matteryPlayer.isAndroid && exhaustionLevel > 0f) {
|
||||
energyToDrain += PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT * (exhaustionLevel / EXHAUSTION_PER_HUNGER_POINT)
|
||||
exhaustionLevel = 0f
|
||||
} else if (exhaustionLevel >= EXHAUSTION_PER_HUNGER_POINT) {
|
||||
var points = (exhaustionLevel / EXHAUSTION_PER_HUNGER_POINT).toInt()
|
||||
exhaustionLevel %= EXHAUSTION_PER_HUNGER_POINT
|
||||
|
||||
if (player.matteryPlayer.isAndroid) {
|
||||
energyToDrain += PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT * points
|
||||
} else {
|
||||
if (saturationLevel > 0f) {
|
||||
val satisfied = min(saturationLevel.roundToInt(), points)
|
||||
points -= satisfied
|
||||
@ -85,7 +85,6 @@ class MatteryFoodData(private var player: Player) : FoodData() {
|
||||
foodLevel = max(0, foodLevel - points)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun tickRegeneration(values: IFoodRegenerationValues): Boolean {
|
||||
if (!player.isHurt || foodLevel < values.foodLimit || values.requiresSaturation && saturationLevel <= 0f)
|
||||
@ -111,9 +110,13 @@ class MatteryFoodData(private var player: Player) : FoodData() {
|
||||
if (player.matteryPlayer.isAndroid) {
|
||||
if (energyToDrain > Decimal.ZERO)
|
||||
energyToDrain -= player.matteryPlayer.androidEnergy.extractEnergy(energyToDrain, false)
|
||||
else if (energyToDrain < Decimal.ZERO)
|
||||
else if (energyToDrain < Decimal.ZERO) {
|
||||
energyToDrain += player.matteryPlayer.androidEnergy.receiveEnergy(-energyToDrain, false)
|
||||
|
||||
if (player.matteryPlayer.androidEnergy.missingPower <= Decimal.ZERO)
|
||||
energyToDrain = Decimal.ZERO
|
||||
}
|
||||
|
||||
if (player.level().difficulty == Difficulty.PEACEFUL && PlayerConfig.REGENERATE_ENERGY_IN_PEACEFUL)
|
||||
player.matteryPlayer.androidEnergy.receiveEnergy(PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT, false)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user