mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@b4192fd fix NPE from changes in e4358b82171 PaperMC/Paper@5b6445a Revert "fix NPE from changes in e4358b82171" PaperMC/Paper@323c087 Revert "#686: Fix contains for default section generating real sections" PaperMC/Paper@c837002 Fix client world difficulty sync issue (#7035) PaperMC/Paper@a4782f7 [ci skip] fixup indent PaperMC/Paper@83aee0f [ci skip] Clarify setSize consequences for Slimes (#7036) PaperMC/Paper@7c8fdc1 Add dropped hunk from mid-tick tasks (#7034) PaperMC/Paper@fd263ef Fix empty/null chunk section check in LevelChunk#getBlockData, rename… (#7039) PaperMC/Paper@b8d486c Create workflow to add new PRs to the PR Queue project (#6918) PaperMC/Paper@a50e273 Include axolotls in affected entities for water splash potions (#7024) PaperMC/Paper@af95df8 Port Actually unload POI data from Tuinity 1.16 (#7044) PaperMC/Paper@04897b1 [ci skip] Revert "Create workflow to add new PRs to the PR Queue project (#6918)" (#7046) PaperMC/Paper@b4a77a8 Updated Upstream (Bukkit/CraftBukkit) (#7045) PaperMC/Paper@0e25db2 Fix mis-placed processEnchantOrder from 1.18 update (#7052) PaperMC/Paper@53d026e Fix unused EntitySectionStorage#getEntities(AABB, Consumer) method being broken PaperMC/Paper@772e880 Fix light propagation in high y sections PaperMC/Paper@33ea869 Bump Starlight light version PaperMC/Paper@74fd151 Fix entity equipment on cancellation of EntityDeathEvent (#5740) PaperMC/Paper@758e2a7 Fix bad ticking checks for blocks PaperMC/Paper@0e91b6a Return 0 for light values if a dimenion does not have them PaperMC/Paper@188a8df Fix ChunkSnapshot#isSectionEmpty(int) PaperMC/Paper@bbc7451 Fix issue with snapshotted biomes in last commit PaperMC/Paper@b475c6a Backport log4j fix PaperMC/Paper@4e355c4 Updated Upstream (CraftBukkit) PaperMC/Paper@dce79f3 Update Log4J (#7069)
77 lines
4.3 KiB
Diff
77 lines
4.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
|
Date: Thu, 24 Jun 2021 21:19:30 -0500
|
|
Subject: [PATCH] Burp after eating food fills hunger bar completely
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
index 535bc6d57d153a62f2cbf57747586de3d4c41b1f..055e11c1a180f74a6d2bd3d20e1451ff027b10e2 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
@@ -193,6 +193,8 @@ public abstract class Player extends LivingEntity {
|
|
// CraftBukkit end
|
|
|
|
// Purpur start
|
|
+ public int burpCooldown = 0;
|
|
+
|
|
public abstract void resetLastActionTime();
|
|
|
|
public void setAfk(boolean afk) {
|
|
@@ -255,6 +257,12 @@ public abstract class Player extends LivingEntity {
|
|
|
|
@Override
|
|
public void tick() {
|
|
+ // Purpur start
|
|
+ if (this.burpCooldown > 0 && --this.burpCooldown == 0) {
|
|
+ this.level.playSound(null, getX(), getY(), getZ(), SoundEvents.PLAYER_BURP, SoundSource.PLAYERS, 1.0F, this.level.random.nextFloat() * 0.1F + 0.9F);
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
this.noPhysics = this.isSpectator();
|
|
if (this.isSpectator()) {
|
|
this.onGround = false;
|
|
@@ -2298,7 +2306,7 @@ public abstract class Player extends LivingEntity {
|
|
public ItemStack eat(Level world, ItemStack stack) {
|
|
this.getFoodData().eat(stack.getItem(), stack);
|
|
this.awardStat(Stats.ITEM_USED.get(stack.getItem()));
|
|
- world.playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_BURP, SoundSource.PLAYERS, 0.5F, world.random.nextFloat() * 0.1F + 0.9F);
|
|
+ // world.playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_BURP, SoundSource.PLAYERS, 0.5F, world.random.nextFloat() * 0.1F + 0.9F); // Purpur - moved to tick()
|
|
if (this instanceof ServerPlayer) {
|
|
CriteriaTriggers.CONSUME_ITEM.trigger((ServerPlayer) this, stack);
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/food/FoodData.java b/src/main/java/net/minecraft/world/food/FoodData.java
|
|
index 2934b6de1f1fb914a532ee20184df99d1acd8e65..65421cfff05c0493f5fef1bdff03172c9e33f33e 100644
|
|
--- a/src/main/java/net/minecraft/world/food/FoodData.java
|
|
+++ b/src/main/java/net/minecraft/world/food/FoodData.java
|
|
@@ -34,8 +34,10 @@ public class FoodData {
|
|
// CraftBukkit end
|
|
|
|
public void eat(int food, float saturationModifier) {
|
|
+ int oldValue = this.foodLevel; // Purpur
|
|
this.foodLevel = Math.min(food + this.foodLevel, 20);
|
|
this.saturationLevel = Math.min(this.saturationLevel + (float) food * saturationModifier * 2.0F, (float) this.foodLevel);
|
|
+ if (this.entityhuman.level.purpurConfig.playerBurpWhenFull && this.foodLevel == 20 && oldValue < 20) this.entityhuman.burpCooldown = 10; // Purpur
|
|
}
|
|
|
|
public void eat(Item item, ItemStack stack) {
|
|
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
index 907daf5e078ae3877db5830f7494ea02697da2c6..025a069dab527ee38f92c209c564e577520958cd 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -342,6 +342,7 @@ public class PurpurWorldConfig {
|
|
public boolean playerSleepNearMonsters = false;
|
|
public boolean playersSkipNight = true;
|
|
public double playerCriticalDamageMultiplier = 1.5D;
|
|
+ public boolean playerBurpWhenFull = false;
|
|
private void playerSettings() {
|
|
if (PurpurConfig.version < 19) {
|
|
boolean oldVal = getBoolean("gameplay-mechanics.player.idle-timeout.mods-target", idleTimeoutTargetPlayer);
|
|
@@ -364,6 +365,7 @@ public class PurpurWorldConfig {
|
|
playerSleepNearMonsters = getBoolean("gameplay-mechanics.player.sleep-ignore-nearby-mobs", playerSleepNearMonsters);
|
|
playersSkipNight = getBoolean("gameplay-mechanics.player.can-skip-night", playersSkipNight);
|
|
playerCriticalDamageMultiplier = getDouble("gameplay-mechanics.player.critical-damage-multiplier", playerCriticalDamageMultiplier);
|
|
+ playerBurpWhenFull = getBoolean("gameplay-mechanics.player.burp-when-full", playerBurpWhenFull);
|
|
}
|
|
|
|
public int snowballDamage = -1;
|