From e8bb90cf36259d9827d1eff4c52ae04d97f3f52d Mon Sep 17 00:00:00 2001 From: William Blake Galbreath Date: Mon, 19 Oct 2020 20:45:08 -0500 Subject: [PATCH] Add night vision when riding ridables --- patches/server/0118-Ridables.patch | 38 +++++++++++++++---- ...izable-WitherBoss-Health-and-Healing.patch | 6 +-- ...sable-zombie-aggressiveness-towards-.patch | 10 ++--- patches/server/0132-Flying-squids-Oh-my.patch | 6 +-- 4 files changed, 41 insertions(+), 19 deletions(-) diff --git a/patches/server/0118-Ridables.patch b/patches/server/0118-Ridables.patch index 7bd5bf01f..14ffd8d70 100644 --- a/patches/server/0118-Ridables.patch +++ b/patches/server/0118-Ridables.patch @@ -3188,6 +3188,26 @@ index a3a428da9..bf5669c30 100644 this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityRaider.class})).a(new Class[0])); // CraftBukkit - decompile error this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true)); this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityVillagerAbstract.class, false)); +diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +index 0bf86369b..5e5e183da 100644 +--- a/src/main/java/net/minecraft/server/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/EntityPlayer.java +@@ -502,6 +502,15 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + } + + this.advancementDataPlayer.b(this); ++ ++ // Purpur start ++ if (this.world.purpurConfig.useNightVisionWhenRiding && this.getVehicle() != null && this.getVehicle().getRider() == this && world.getTime() % 100 == 0) { // 5 seconds ++ MobEffect nightVision = this.getEffect(MobEffects.NIGHT_VISION); ++ if (nightVision == null || nightVision.getDuration() <= 300) { // 15 seconds ++ this.addEffect(new MobEffect(MobEffects.NIGHT_VISION, 400, 0)); // 20 seconds ++ } ++ } ++ // Purpur end + } + + public void playerTick() { diff --git a/src/main/java/net/minecraft/server/EntityPolarBear.java b/src/main/java/net/minecraft/server/EntityPolarBear.java index cd6d2e07e..c74a10d9b 100644 --- a/src/main/java/net/minecraft/server/EntityPolarBear.java @@ -4959,7 +4979,7 @@ index 8714d1574..af3739c79 100644 public static int dungeonSeed = -1; diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -index 86a4ce528..30fdfa6aa 100644 +index 86a4ce528..35bb5d3e3 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java @@ -42,11 +42,6 @@ public class PurpurWorldConfig { @@ -4974,15 +4994,17 @@ index 86a4ce528..30fdfa6aa 100644 private ConfigurationSection getConfigurationSection(String path) { ConfigurationSection section = PurpurConfig.config.getConfigurationSection("world-settings." + worldName + "." + path); return section != null ? section : PurpurConfig.config.getConfigurationSection("world-settings.default." + path); -@@ -321,65 +316,188 @@ public class PurpurWorldConfig { +@@ -321,65 +316,190 @@ public class PurpurWorldConfig { turtleEggsBreakFromMinecarts = getBoolean("blocks.turtle_egg.break-from-minecarts", turtleEggsBreakFromMinecarts); } + public boolean babiesAreRidable = true; + public boolean untamedTamablesAreRidable = true; ++ public boolean useNightVisionWhenRiding = false; + private void ridableSettings() { + babiesAreRidable = getBoolean("ridable-settings.babies-are-ridable", babiesAreRidable); + untamedTamablesAreRidable = getBoolean("ridable-settings.untamed-tamables-are-ridable", untamedTamablesAreRidable); ++ useNightVisionWhenRiding = getBoolean("ridable-settings.use-night-vision", useNightVisionWhenRiding); + } + + public boolean batRidable = false; @@ -5163,7 +5185,7 @@ index 86a4ce528..30fdfa6aa 100644 public float giantStepHeight = 2.0F; public float giantJumpHeight = 1.0F; public double giantMaxHealth = 100.0D; -@@ -388,6 +506,8 @@ public class PurpurWorldConfig { +@@ -388,6 +508,8 @@ public class PurpurWorldConfig { public boolean giantHaveAI = false; public boolean giantHaveHostileAI = false; private void giantSettings() { @@ -5172,7 +5194,7 @@ index 86a4ce528..30fdfa6aa 100644 giantStepHeight = (float) getDouble("mobs.giant.step-height", giantStepHeight); giantJumpHeight = (float) getDouble("mobs.giant.jump-height", giantJumpHeight); giantMaxHealth = getDouble("mobs.giant.max-health", giantMaxHealth); -@@ -397,29 +517,119 @@ public class PurpurWorldConfig { +@@ -397,29 +519,119 @@ public class PurpurWorldConfig { giantHaveHostileAI = getBoolean("mobs.giant.have-hostile-ai", giantHaveHostileAI); } @@ -5292,7 +5314,7 @@ index 86a4ce528..30fdfa6aa 100644 public double phantomAttackedByCrystalRadius = 0.0D; public float phantomAttackedByCrystalDamage = 1.0F; public double phantomOrbitCrystalRadius = 0.0D; -@@ -439,6 +649,11 @@ public class PurpurWorldConfig { +@@ -439,6 +651,11 @@ public class PurpurWorldConfig { public boolean phantomIgnorePlayersWithTorch = false; public boolean phantomBurnInDaylight = true; private void phantomSettings() { @@ -5304,7 +5326,7 @@ index 86a4ce528..30fdfa6aa 100644 phantomAttackedByCrystalRadius = getDouble("mobs.phantom.attacked-by-crystal-range", phantomAttackedByCrystalRadius); phantomAttackedByCrystalDamage = (float) getDouble("mobs.phantom.attacked-by-crystal-damage", phantomAttackedByCrystalDamage); phantomOrbitCrystalRadius = getDouble("mobs.phantom.orbit-crystal-radius", phantomOrbitCrystalRadius); -@@ -459,40 +674,184 @@ public class PurpurWorldConfig { +@@ -459,40 +676,184 @@ public class PurpurWorldConfig { phantomIgnorePlayersWithTorch = getBoolean("mobs.phantom.ignore-players-with-torch", phantomIgnorePlayersWithTorch); } @@ -5489,7 +5511,7 @@ index 86a4ce528..30fdfa6aa 100644 public int villagerBrainTicks = 1; public boolean villagerUseBrainTicksOnlyWhenLagging = true; public boolean villagerCanBeLeashed = false; -@@ -502,6 +861,8 @@ public class PurpurWorldConfig { +@@ -502,6 +863,8 @@ public class PurpurWorldConfig { public int villagerSpawnIronGolemLimit = 0; public boolean villagerCanBreed = true; private void villagerSettings() { @@ -5498,7 +5520,7 @@ index 86a4ce528..30fdfa6aa 100644 villagerBrainTicks = getInt("mobs.villager.brain-ticks", villagerBrainTicks); villagerUseBrainTicksOnlyWhenLagging = getBoolean("mobs.villager.use-brain-ticks-only-when-lagging", villagerUseBrainTicksOnlyWhenLagging); villagerCanBeLeashed = getBoolean("mobs.villager.can-be-leashed", villagerCanBeLeashed); -@@ -512,46 +873,109 @@ public class PurpurWorldConfig { +@@ -512,46 +875,109 @@ public class PurpurWorldConfig { villagerCanBreed = getBoolean("mobs.villager.can-breed", villagerCanBreed); } diff --git a/patches/server/0123-Customizable-WitherBoss-Health-and-Healing.patch b/patches/server/0123-Customizable-WitherBoss-Health-and-Healing.patch index 0defb3ada..42530c831 100644 --- a/patches/server/0123-Customizable-WitherBoss-Health-and-Healing.patch +++ b/patches/server/0123-Customizable-WitherBoss-Health-and-Healing.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Customizable WitherBoss Health and Healing Adds the ability to customize the health of the Wither Boss, as well as the amount that it heals, and how often in the PurpurWorldConfig. diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java -index 1054b492c2..2a288d3726 100644 +index 1054b492c..2a288d372 100644 --- a/src/main/java/net/minecraft/server/EntityWither.java +++ b/src/main/java/net/minecraft/server/EntityWither.java @@ -145,6 +145,12 @@ public class EntityWither extends EntityMonster implements IRangedEntity { @@ -53,10 +53,10 @@ index 1054b492c2..2a288d3726 100644 @Override diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -index 039a205045..c905d95a8c 100644 +index 82cc321a0..3c3e48c9c 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -@@ -905,10 +905,16 @@ public class PurpurWorldConfig { +@@ -907,10 +907,16 @@ public class PurpurWorldConfig { public boolean witherRidable = false; public boolean witherRidableInWater = false; public double witherMaxY = 256D; diff --git a/patches/server/0129-Add-option-to-disable-zombie-aggressiveness-towards-.patch b/patches/server/0129-Add-option-to-disable-zombie-aggressiveness-towards-.patch index 4377337f2..8b8977647 100644 --- a/patches/server/0129-Add-option-to-disable-zombie-aggressiveness-towards-.patch +++ b/patches/server/0129-Add-option-to-disable-zombie-aggressiveness-towards-.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add option to disable zombie aggressiveness towards villagers diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java -index 89b56de756..ded483ace0 100644 +index 89b56de75..ded483ace 100644 --- a/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java +++ b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java @@ -131,6 +131,10 @@ public class MobGoalHelper { @@ -21,7 +21,7 @@ index 89b56de756..ded483ace0 100644 ignored.add("selector_1"); ignored.add("selector_2"); diff --git a/src/main/java/net/minecraft/server/EntityDrowned.java b/src/main/java/net/minecraft/server/EntityDrowned.java -index 8aa53c617b..99f615c645 100644 +index 8aa53c617..99f615c64 100644 --- a/src/main/java/net/minecraft/server/EntityDrowned.java +++ b/src/main/java/net/minecraft/server/EntityDrowned.java @@ -58,7 +58,18 @@ public class EntityDrowned extends EntityZombie implements IRangedEntity { @@ -45,7 +45,7 @@ index 8aa53c617b..99f615c645 100644 this.targetSelector.a(5, new PathfinderGoalNearestAttackableTarget<>(this, EntityTurtle.class, 10, true, false, EntityTurtle.bo)); } diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java -index d08747c66a..7b2a66d6d3 100644 +index d08747c66..7b2a66d6d 100644 --- a/src/main/java/net/minecraft/server/EntityZombie.java +++ b/src/main/java/net/minecraft/server/EntityZombie.java @@ -85,7 +85,18 @@ public class EntityZombie extends EntityMonster { @@ -69,10 +69,10 @@ index d08747c66a..7b2a66d6d3 100644 this.targetSelector.a(5, new PathfinderGoalNearestAttackableTarget<>(this, EntityTurtle.class, 10, true, false, EntityTurtle.bo)); } diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -index 24b3c7c19c..b769a54fc3 100644 +index 8ff4e3127..14c1e0d1f 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -@@ -1002,12 +1002,14 @@ public class PurpurWorldConfig { +@@ -1004,12 +1004,14 @@ public class PurpurWorldConfig { public boolean zombieJockeyOnlyBaby = true; public double zombieJockeyChance = 0.05D; public boolean zombieJockeyTryExistingChickens = true; diff --git a/patches/server/0132-Flying-squids-Oh-my.patch b/patches/server/0132-Flying-squids-Oh-my.patch index 0f7cc349b..4c55d6e6e 100644 --- a/patches/server/0132-Flying-squids-Oh-my.patch +++ b/patches/server/0132-Flying-squids-Oh-my.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Flying squids! Oh my! diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java -index c9d2461318..aa294a46e4 100644 +index c9d246131..aa294a46e 100644 --- a/src/main/java/net/minecraft/server/EntitySquid.java +++ b/src/main/java/net/minecraft/server/EntitySquid.java @@ -51,6 +51,11 @@ public class EntitySquid extends EntityWaterAnimal { @@ -38,10 +38,10 @@ index c9d2461318..aa294a46e4 100644 float f1 = MathHelper.cos(f) * 0.2F; float f2 = -0.1F + this.b.getRandom().nextFloat() * 0.2F; diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -index 400766dc76..f063a1a8c7 100644 +index 3aa8f34ec..4678b19e3 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -@@ -863,10 +863,12 @@ public class PurpurWorldConfig { +@@ -865,10 +865,12 @@ public class PurpurWorldConfig { public boolean squidRidable = false; public boolean squidImmuneToEAR = true; public double squidOffsetWaterCheck = 0.0D;