mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 11:06:29 +01:00
36f34f01c0
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: da9ef3c5 #496: Add methods to get/set ItemStacks in EquipmentSlots 3abebc9f #492: Let Tameable extend Animals rather than Entity 941111a0 #495: Expose ItemStack and hand used in PlayerShearEntityEvent 4fe19cae #494: InventoryView - Add missing Brewing FUEL_TIME CraftBukkit Changes:933e9094
#664: Add methods to get/set ItemStacks in EquipmentSlots18722312
#662: Expose ItemStack and hand used in PlayerShearEntityEvent
46 lines
2.9 KiB
Diff
46 lines
2.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Zero <zero@cock.li>
|
|
Date: Sat, 22 Feb 2020 16:10:31 -0500
|
|
Subject: [PATCH] Configurable chance of villager zombie infection
|
|
|
|
This allows you to solve an issue in vanilla behavior where:
|
|
* On easy difficulty your villagers will NEVER get infected, meaning they will always die.
|
|
* On normal difficulty they will have a 50% of getting infected or dying.
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
index b773b750ae4cd41708e3fde4c88b5cf1af7098cb..c3af4c9a9fe67b7a9c0eda5606e1c97bad778927 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
@@ -651,4 +651,9 @@ public class PaperWorldConfig {
|
|
private void nerfNetherPortalPigmen() {
|
|
nerfNetherPortalPigmen = getBoolean("game-mechanics.nerf-pigmen-from-nether-portals", nerfNetherPortalPigmen);
|
|
}
|
|
+
|
|
+ public double zombieVillagerInfectionChance = -1.0;
|
|
+ private void zombieVillagerInfectionChance() {
|
|
+ zombieVillagerInfectionChance = getDouble("zombie-villager-infection-chance", zombieVillagerInfectionChance);
|
|
+ }
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
|
|
index 8635d4f40ca153819e0fda014d7ea3795f86b940..07ebc1d81610bc506e51c7bbffefdcf676a2bb85 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityZombie.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
|
|
@@ -455,10 +455,14 @@ public class EntityZombie extends EntityMonster {
|
|
@Override
|
|
public void b(EntityLiving entityliving) {
|
|
super.b(entityliving);
|
|
- if ((this.world.getDifficulty() == EnumDifficulty.NORMAL || this.world.getDifficulty() == EnumDifficulty.HARD) && entityliving instanceof EntityVillager) {
|
|
- if (this.world.getDifficulty() != EnumDifficulty.HARD && this.random.nextBoolean()) {
|
|
+ // Paper start
|
|
+ if (world.paperConfig.zombieVillagerInfectionChance != 0.0 && (world.paperConfig.zombieVillagerInfectionChance != -1.0 || this.world.getDifficulty() == EnumDifficulty.NORMAL || this.world.getDifficulty() == EnumDifficulty.HARD) && entityliving instanceof EntityVillager) {
|
|
+ if (world.paperConfig.zombieVillagerInfectionChance == -1.0 && this.world.getDifficulty() != EnumDifficulty.HARD && this.random.nextBoolean()) {
|
|
+ return;
|
|
+ }
|
|
+ if (world.paperConfig.zombieVillagerInfectionChance != -1.0 && (this.random.nextDouble() * 100.0) > world.paperConfig.zombieVillagerInfectionChance) {
|
|
return;
|
|
- }
|
|
+ } // Paper end
|
|
|
|
EntityVillager entityvillager = (EntityVillager) entityliving;
|
|
EntityZombieVillager entityzombievillager = (EntityZombieVillager) EntityTypes.ZOMBIE_VILLAGER.a(this.world);
|