mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 15:49:00 +01:00
Add Hunger Config Values
By: lazertester <austin.techhead@gmail.com>
This commit is contained in:
parent
83699d54bf
commit
f026f7905e
4 changed files with 36 additions and 10 deletions
|
@ -1054,21 +1054,21 @@
|
|||
if (i > 0) {
|
||||
this.awardStat(Stats.SWIM_ONE_CM, i);
|
||||
- this.causeFoodExhaustion(0.01F * (float) i * 0.01F);
|
||||
+ this.causeFoodExhaustion(0.01F * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.SWIM); // CraftBukkit - EntityExhaustionEvent
|
||||
+ this.causeFoodExhaustion(this.level().spigotConfig.swimMultiplier * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.SWIM); // CraftBukkit - EntityExhaustionEvent // Spigot
|
||||
}
|
||||
} else if (this.isEyeInFluid(FluidTags.WATER)) {
|
||||
i = Math.round((float) Math.sqrt(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ) * 100.0F);
|
||||
if (i > 0) {
|
||||
this.awardStat(Stats.WALK_UNDER_WATER_ONE_CM, i);
|
||||
- this.causeFoodExhaustion(0.01F * (float) i * 0.01F);
|
||||
+ this.causeFoodExhaustion(0.01F * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.WALK_UNDERWATER); // CraftBukkit - EntityExhaustionEvent
|
||||
+ this.causeFoodExhaustion(this.level().spigotConfig.swimMultiplier * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.WALK_UNDERWATER); // CraftBukkit - EntityExhaustionEvent // Spigot
|
||||
}
|
||||
} else if (this.isInWater()) {
|
||||
i = Math.round((float) Math.sqrt(deltaX * deltaX + deltaZ * deltaZ) * 100.0F);
|
||||
if (i > 0) {
|
||||
this.awardStat(Stats.WALK_ON_WATER_ONE_CM, i);
|
||||
- this.causeFoodExhaustion(0.01F * (float) i * 0.01F);
|
||||
+ this.causeFoodExhaustion(0.01F * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.WALK_ON_WATER); // CraftBukkit - EntityExhaustionEvent
|
||||
+ this.causeFoodExhaustion(this.level().spigotConfig.swimMultiplier * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.WALK_ON_WATER); // CraftBukkit - EntityExhaustionEvent // Spigot
|
||||
}
|
||||
} else if (this.onClimbable()) {
|
||||
if (deltaY > 0.0D) {
|
||||
|
@ -1077,15 +1077,15 @@
|
|||
if (this.isSprinting()) {
|
||||
this.awardStat(Stats.SPRINT_ONE_CM, i);
|
||||
- this.causeFoodExhaustion(0.1F * (float) i * 0.01F);
|
||||
+ this.causeFoodExhaustion(0.1F * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.SPRINT); // CraftBukkit - EntityExhaustionEvent
|
||||
+ this.causeFoodExhaustion(this.level().spigotConfig.sprintMultiplier * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.SPRINT); // CraftBukkit - EntityExhaustionEvent // Spigot
|
||||
} else if (this.isCrouching()) {
|
||||
this.awardStat(Stats.CROUCH_ONE_CM, i);
|
||||
- this.causeFoodExhaustion(0.0F * (float) i * 0.01F);
|
||||
+ this.causeFoodExhaustion(0.0F * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.CROUCH); // CraftBukkit - EntityExhaustionEvent
|
||||
+ this.causeFoodExhaustion(this.level().spigotConfig.otherMultiplier * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.CROUCH); // CraftBukkit - EntityExhaustionEvent // Spigot
|
||||
} else {
|
||||
this.awardStat(Stats.WALK_ONE_CM, i);
|
||||
- this.causeFoodExhaustion(0.0F * (float) i * 0.01F);
|
||||
+ this.causeFoodExhaustion(0.0F * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.WALK); // CraftBukkit - EntityExhaustionEvent
|
||||
+ this.causeFoodExhaustion(this.level().spigotConfig.otherMultiplier * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.WALK); // CraftBukkit - EntityExhaustionEvent // Spigot
|
||||
}
|
||||
}
|
||||
} else if (this.isFallFlying()) {
|
||||
|
@ -1112,10 +1112,10 @@
|
|||
this.awardStat(Stats.JUMP);
|
||||
if (this.isSprinting()) {
|
||||
- this.causeFoodExhaustion(0.2F);
|
||||
+ this.causeFoodExhaustion(0.2F, EntityExhaustionEvent.ExhaustionReason.JUMP_SPRINT); // CraftBukkit - EntityExhaustionEvent
|
||||
+ this.causeFoodExhaustion(this.level().spigotConfig.jumpSprintExhaustion, EntityExhaustionEvent.ExhaustionReason.JUMP_SPRINT); // CraftBukkit - EntityExhaustionEvent // Spigot - Change to use configurable value
|
||||
} else {
|
||||
- this.causeFoodExhaustion(0.05F);
|
||||
+ this.causeFoodExhaustion(0.05F, EntityExhaustionEvent.ExhaustionReason.JUMP); // CraftBukkit - EntityExhaustionEvent
|
||||
+ this.causeFoodExhaustion(this.level().spigotConfig.jumpWalkExhaustion, EntityExhaustionEvent.ExhaustionReason.JUMP); // CraftBukkit - EntityExhaustionEvent // Spigot - Change to use configurable value
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -300,7 +300,7 @@
|
|||
}
|
||||
|
||||
- this.causeFoodExhaustion(0.1F);
|
||||
+ this.causeFoodExhaustion(0.1F, EntityExhaustionEvent.ExhaustionReason.ATTACK); // CraftBukkit - EntityExhaustionEvent
|
||||
+ this.causeFoodExhaustion(this.level().spigotConfig.combatExhaustion, EntityExhaustionEvent.ExhaustionReason.ATTACK); // CraftBukkit - EntityExhaustionEvent // Spigot - Change to use configurable value
|
||||
} else {
|
||||
this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_NODAMAGE, this.getSoundSource(), 1.0F, 1.0F);
|
||||
+ // CraftBukkit start - resync on cancelled event
|
||||
|
|
|
@ -89,7 +89,7 @@
|
|||
+ if (this.tickTimer >= this.unsaturatedRegenRate) { // CraftBukkit - add regen rate manipulation
|
||||
+ player.heal(1.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.SATIATED); // CraftBukkit - added RegainReason
|
||||
+ // this.addExhaustion(6.0F); CraftBukkit - EntityExhaustionEvent
|
||||
+ player.causeFoodExhaustion(6.0f, org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.REGEN); // CraftBukkit - EntityExhaustionEvent
|
||||
+ player.causeFoodExhaustion(player.level().spigotConfig.regenExhaustion, org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.REGEN); // CraftBukkit - EntityExhaustionEvent // Spigot - Change to use configurable value
|
||||
this.tickTimer = 0;
|
||||
}
|
||||
} else if (this.foodLevel <= 0) {
|
||||
|
|
|
@ -330,4 +330,30 @@ public class SpigotWorldConfig
|
|||
this.log( "Custom Map Seeds: Village: " + this.villageSeed + " Desert: " + this.desertSeed + " Igloo: " + this.iglooSeed + " Jungle: " + this.jungleSeed + " Swamp: " + this.swampSeed + " Monument: " + this.monumentSeed
|
||||
+ " Ocean: " + this.oceanSeed + " Shipwreck: " + this.shipwreckSeed + " End City: " + this.endCitySeed + " Slime: " + this.slimeSeed + " Nether: " + this.netherSeed + " Mansion: " + this.mansionSeed + " Fossil: " + this.fossilSeed + " Portal: " + this.portalSeed );
|
||||
}
|
||||
|
||||
public float jumpWalkExhaustion;
|
||||
public float jumpSprintExhaustion;
|
||||
public float combatExhaustion;
|
||||
public float regenExhaustion;
|
||||
public float swimMultiplier;
|
||||
public float sprintMultiplier;
|
||||
public float otherMultiplier;
|
||||
private void initHunger()
|
||||
{
|
||||
if ( SpigotConfig.version < 10 )
|
||||
{
|
||||
this.set( "hunger.walk-exhaustion", null );
|
||||
this.set( "hunger.sprint-exhaustion", null );
|
||||
this.set( "hunger.combat-exhaustion", 0.1 );
|
||||
this.set( "hunger.regen-exhaustion", 6.0 );
|
||||
}
|
||||
|
||||
this.jumpWalkExhaustion = (float) this.getDouble( "hunger.jump-walk-exhaustion", 0.05 );
|
||||
this.jumpSprintExhaustion = (float) this.getDouble( "hunger.jump-sprint-exhaustion", 0.2 );
|
||||
this.combatExhaustion = (float) this.getDouble( "hunger.combat-exhaustion", 0.1 );
|
||||
this.regenExhaustion = (float) this.getDouble( "hunger.regen-exhaustion", 6.0 );
|
||||
this.swimMultiplier = (float) this.getDouble( "hunger.swim-multiplier", 0.01 );
|
||||
this.sprintMultiplier = (float) this.getDouble( "hunger.sprint-multiplier", 0.1 );
|
||||
this.otherMultiplier = (float) this.getDouble( "hunger.other-multiplier", 0.0 );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue