diff --git a/paper-server/patches/sources/net/minecraft/world/entity/LivingEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/LivingEntity.java.patch index 251c921b81..10df56394d 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/LivingEntity.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/LivingEntity.java.patch @@ -703,6 +703,15 @@ ServerPlayer entityplayer = (ServerPlayer) this; entityplayer.awardStat(Stats.ITEM_USED.get(itemstack.getItem())); +@@ -1477,7 +1742,7 @@ + } + + if (!this.level().isClientSide && this.hasCustomName()) { +- LivingEntity.LOGGER.info("Named entity {} died: {}", this, this.getCombatTracker().getDeathMessage().getString()); ++ if (org.spigotmc.SpigotConfig.logNamedDeaths) LivingEntity.LOGGER.info("Named entity {} died: {}", this, this.getCombatTracker().getDeathMessage().getString()); // Spigot + } + + this.dead = true; @@ -1512,14 +1777,22 @@ BlockState iblockdata = Blocks.WITHER_ROSE.defaultBlockState(); @@ -894,7 +903,7 @@ + }; + float freezingModifier = freezing.apply((double) f).floatValue(); + f += freezingModifier; -+ + + com.google.common.base.Function hardHat = new com.google.common.base.Function() { + @Override + public Double apply(Double f) { @@ -924,7 +933,7 @@ + }; + float armorModifier = armor.apply((double) f).floatValue(); + f += armorModifier; - ++ + com.google.common.base.Function resistance = new com.google.common.base.Function() { + @Override + public Double apply(Double f) { @@ -1103,19 +1112,19 @@ this.setHealth(0.0F); this.die(this.damageSources().generic()); } -@@ -2181,6 +2672,12 @@ - public abstract Iterable getArmorSlots(); +@@ -2182,6 +2673,12 @@ public abstract ItemStack getItemBySlot(EquipmentSlot slot); -+ + + // CraftBukkit start + public void setItemSlot(EquipmentSlot enumitemslot, ItemStack itemstack, boolean silent) { + this.setItemSlot(enumitemslot, itemstack); + } + // CraftBukkit end - ++ public abstract void setItemSlot(EquipmentSlot slot, ItemStack stack); + public Iterable getHandSlots() { @@ -2494,7 +2991,7 @@ } @@ -1301,7 +1310,7 @@ + org.bukkit.inventory.EquipmentSlot hand = org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(enumhand); + PlayerItemConsumeEvent event = new PlayerItemConsumeEvent((Player) this.getBukkitEntity(), craftItem, hand); + this.level().getCraftServer().getPluginManager().callEvent(event); - ++ + if (event.isCancelled()) { + // Update client + Consumable consumable = this.useItem.get(DataComponents.CONSUMABLE); @@ -1312,7 +1321,7 @@ + entityPlayer.getBukkitEntity().updateScaledHealth(); + return; + } -+ + + itemstack = (craftItem.equals(event.getItem())) ? this.useItem.finishUsingItem(this.level(), this) : CraftItemStack.asNMSCopy(event.getItem()).finishUsingItem(this.level(), this); + } else { + itemstack = this.useItem.finishUsingItem(this.level(), this); diff --git a/paper-server/patches/sources/net/minecraft/world/entity/npc/Villager.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/npc/Villager.java.patch index dbf21d8f36..792919030c 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/npc/Villager.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/npc/Villager.java.patch @@ -24,25 +24,25 @@ } @Override -@@ -216,7 +224,18 @@ - return this.assignProfessionWhenSpawned; - } +@@ -214,7 +222,18 @@ + public boolean assignProfessionWhenSpawned() { + return this.assignProfessionWhenSpawned; ++ } ++ + // Spigot Start - @Override ++ @Override + public void inactiveTick() { + // SPIGOT-3874, SPIGOT-3894, SPIGOT-3846, SPIGOT-5286 :( + if (this.level().spigotConfig.tickInactiveVillagers && this.isEffectiveAi()) { + this.customServerAiStep((ServerLevel) this.level()); + } + super.inactiveTick(); -+ } + } + // Spigot End -+ -+ @Override - protected void customServerAiStep(ServerLevel world) { - ProfilerFiller gameprofilerfiller = Profiler.get(); + @Override + protected void customServerAiStep(ServerLevel world) { @@ -235,7 +254,7 @@ this.increaseProfessionLevelOnUpdate = false; } @@ -100,6 +100,15 @@ Logger logger = Villager.LOGGER; Objects.requireNonNull(logger); +@@ -618,7 +649,7 @@ + + @Override + public void die(DamageSource damageSource) { +- Villager.LOGGER.info("Villager {} died, message: '{}'", this, damageSource.getLocalizedDeathMessage(this).getString()); ++ if (org.spigotmc.SpigotConfig.logVillagerDeaths) Villager.LOGGER.info("Villager {} died, message: '{}'", this, damageSource.getLocalizedDeathMessage(this).getString()); // Spigot + Entity entity = damageSource.getEntity(); + + if (entity != null) { @@ -808,7 +839,7 @@ entitywitch1.finalizeSpawn(world, world.getCurrentDifficultyAt(entitywitch1.blockPosition()), EntitySpawnReason.CONVERSION, (SpawnGroupData) null); entitywitch1.setPersistenceRequired(); diff --git a/paper-server/src/main/java/org/spigotmc/SpigotConfig.java b/paper-server/src/main/java/org/spigotmc/SpigotConfig.java index ba5b472bdf..6b04e57eba 100644 --- a/paper-server/src/main/java/org/spigotmc/SpigotConfig.java +++ b/paper-server/src/main/java/org/spigotmc/SpigotConfig.java @@ -389,4 +389,11 @@ public class SpigotConfig SpigotConfig.disableAdvancementSaving = SpigotConfig.getBoolean("advancements.disable-saving", false); SpigotConfig.disabledAdvancements = SpigotConfig.getList("advancements.disabled", Arrays.asList(new String[]{"minecraft:story/disabled"})); } + + public static boolean logVillagerDeaths; + public static boolean logNamedDeaths; + private static void logDeaths() { + SpigotConfig.logVillagerDeaths = SpigotConfig.getBoolean("settings.log-villager-deaths", true); + SpigotConfig.logNamedDeaths = SpigotConfig.getBoolean("settings.log-named-deaths", true); + } }