mirror of
https://hub.spigotmc.org/stash/scm/spigot/spigot.git
synced 2024-11-21 20:56:14 +00:00
127 lines
9.1 KiB
Diff
127 lines
9.1 KiB
Diff
From 60c188efe5c512f1d6c1bd2571e4745c75fdc191 Mon Sep 17 00:00:00 2001
|
|
From: lazertester <austin.techhead@gmail.com>
|
|
Date: Sun, 17 Aug 2014 19:56:17 +1000
|
|
Subject: [PATCH] Add Hunger Config Values
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java
|
|
index 4935614a7a..24873c9743 100644
|
|
--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java
|
|
+++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java
|
|
@@ -1909,19 +1909,19 @@ public class EntityPlayer extends EntityHuman {
|
|
i = Math.round((float) Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F);
|
|
if (i > 0) {
|
|
this.awardStat(StatisticList.SWIM_ONE_CM, i);
|
|
- 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(TagsFluid.WATER)) {
|
|
i = Math.round((float) Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F);
|
|
if (i > 0) {
|
|
this.awardStat(StatisticList.WALK_UNDER_WATER_ONE_CM, i);
|
|
- 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(d0 * d0 + d2 * d2) * 100.0F);
|
|
if (i > 0) {
|
|
this.awardStat(StatisticList.WALK_ON_WATER_ONE_CM, i);
|
|
- 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 (d1 > 0.0D) {
|
|
@@ -1932,13 +1932,13 @@ public class EntityPlayer extends EntityHuman {
|
|
if (i > 0) {
|
|
if (this.isSprinting()) {
|
|
this.awardStat(StatisticList.SPRINT_ONE_CM, i);
|
|
- 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(StatisticList.CROUCH_ONE_CM, i);
|
|
- 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(StatisticList.WALK_ONE_CM, i);
|
|
- 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()) {
|
|
@@ -2021,9 +2021,9 @@ public class EntityPlayer extends EntityHuman {
|
|
super.jumpFromGround();
|
|
this.awardStat(StatisticList.JUMP);
|
|
if (this.isSprinting()) {
|
|
- 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, EntityExhaustionEvent.ExhaustionReason.JUMP); // CraftBukkit - EntityExhaustionEvent
|
|
+ this.causeFoodExhaustion(this.level().spigotConfig.jumpWalkExhaustion, EntityExhaustionEvent.ExhaustionReason.JUMP); // CraftBukkit - EntityExhaustionEvent // Spigot - Change to use configurable value
|
|
}
|
|
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
|
|
index 26bfc1b28e..b6a4defe87 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
|
|
@@ -1400,7 +1400,7 @@ public abstract class EntityHuman extends EntityLiving {
|
|
}
|
|
}
|
|
|
|
- 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((EntityHuman) null, this.getX(), this.getY(), this.getZ(), SoundEffects.PLAYER_ATTACK_NODAMAGE, this.getSoundSource(), 1.0F, 1.0F);
|
|
// CraftBukkit start - resync on cancelled event
|
|
diff --git a/src/main/java/net/minecraft/world/food/FoodMetaData.java b/src/main/java/net/minecraft/world/food/FoodMetaData.java
|
|
index 4bf05462ca..cc375483c2 100644
|
|
--- a/src/main/java/net/minecraft/world/food/FoodMetaData.java
|
|
+++ b/src/main/java/net/minecraft/world/food/FoodMetaData.java
|
|
@@ -91,7 +91,7 @@ public class FoodMetaData {
|
|
if (this.tickTimer >= this.unsaturatedRegenRate) { // CraftBukkit - add regen rate manipulation
|
|
entityplayer.heal(1.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.SATIATED); // CraftBukkit - added RegainReason
|
|
// this.addExhaustion(6.0F); CraftBukkit - EntityExhaustionEvent
|
|
- entityplayer.causeFoodExhaustion(6.0f, org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.REGEN); // CraftBukkit - EntityExhaustionEvent
|
|
+ entityplayer.causeFoodExhaustion(entityplayer.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) {
|
|
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
|
index 7882c95f4c..1b5d1e2837 100644
|
|
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
|
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
|
@@ -330,4 +330,30 @@ public class SpigotWorldConfig
|
|
log( "Custom Map Seeds: Village: " + villageSeed + " Desert: " + desertSeed + " Igloo: " + iglooSeed + " Jungle: " + jungleSeed + " Swamp: " + swampSeed + " Monument: " + monumentSeed
|
|
+ " Ocean: " + oceanSeed + " Shipwreck: " + shipwreckSeed + " End City: " + endCitySeed + " Slime: " + slimeSeed + " Nether: " + netherSeed + " Mansion: " + mansionSeed + " Fossil: " + fossilSeed + " Portal: " + 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 )
|
|
+ {
|
|
+ set( "hunger.walk-exhaustion", null );
|
|
+ set( "hunger.sprint-exhaustion", null );
|
|
+ set( "hunger.combat-exhaustion", 0.1 );
|
|
+ set( "hunger.regen-exhaustion", 6.0 );
|
|
+ }
|
|
+
|
|
+ jumpWalkExhaustion = (float) getDouble( "hunger.jump-walk-exhaustion", 0.05 );
|
|
+ jumpSprintExhaustion = (float) getDouble( "hunger.jump-sprint-exhaustion", 0.2 );
|
|
+ combatExhaustion = (float) getDouble( "hunger.combat-exhaustion", 0.1 );
|
|
+ regenExhaustion = (float) getDouble( "hunger.regen-exhaustion", 6.0 );
|
|
+ swimMultiplier = (float) getDouble( "hunger.swim-multiplier", 0.01 );
|
|
+ sprintMultiplier = (float) getDouble( "hunger.sprint-multiplier", 0.1 );
|
|
+ otherMultiplier = (float) getDouble( "hunger.other-multiplier", 0.0 );
|
|
+ }
|
|
}
|
|
--
|
|
2.47.0
|
|
|