From 8767574fe7b01d6a938a2b467190d8638c276fb7 Mon Sep 17 00:00:00 2001 From: William Blake Galbreath Date: Mon, 14 Sep 2020 08:48:47 -0500 Subject: [PATCH] Fix #56 Fix #50 - Ridable baby and tameable settings --- patches/server/0119-Ridables.patch | 38 +++++++++++++------ ...izable-WitherBoss-Health-and-Healing.patch | 4 +- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/patches/server/0119-Ridables.patch b/patches/server/0119-Ridables.patch index ae71a9680..595642c7b 100644 --- a/patches/server/0119-Ridables.patch +++ b/patches/server/0119-Ridables.patch @@ -2199,7 +2199,7 @@ index f5c9e4e0a..5e6c7e317 100644 this.targetSelector.a(2, (new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true)).a(300)); this.targetSelector.a(3, (new PathfinderGoalNearestAttackableTarget<>(this, EntityVillagerAbstract.class, false)).a(300)); diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index 7465e867b..0dc811ff7 100644 +index 7465e867b..2bda9d6c6 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java @@ -29,7 +29,7 @@ public abstract class EntityInsentient extends EntityLiving { @@ -2264,7 +2264,7 @@ index 7465e867b..0dc811ff7 100644 } public boolean ev() { -@@ -1614,4 +1617,45 @@ public abstract class EntityInsentient extends EntityLiving { +@@ -1614,4 +1617,54 @@ public abstract class EntityInsentient extends EntityLiving { this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit this.unleash(true, false); } @@ -2295,6 +2295,15 @@ index 7465e867b..0dc811ff7 100644 + if (tameable.isTamed() && !tameable.isOwner(entityhuman)) { + return EnumInteractionResult.PASS; + } ++ if (!tameable.isTamed() && !world.purpurConfig.untamedTamablesAreRidable) { ++ return EnumInteractionResult.PASS; ++ } ++ } ++ if (this instanceof EntityAgeable) { ++ EntityAgeable ageable = (EntityAgeable) this; ++ if (ageable.isBaby() && !world.purpurConfig.babiesAreRidable) { ++ return EnumInteractionResult.PASS; ++ } + } + if (!entityhuman.getBukkitEntity().hasPermission("allow.ride." + getEntityType().getName())) { + entityhuman.sendMessage(net.pl3x.purpur.PurpurConfig.cannotRideMob); @@ -4864,7 +4873,7 @@ index 0bac6b050..9a17eb606 100644 Entity entity1 = this.getShooter(); // Paper start - Cancel hit for vanished players diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index a8ec01687..f07e2d285 100644 +index 1ff07a08d..5b5e9211c 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -2149,6 +2149,8 @@ public class PlayerConnection implements PacketListenerPlayIn { @@ -4950,7 +4959,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 b070eed98..a58f07b4b 100644 +index b070eed98..a0684f16c 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 { @@ -4965,10 +4974,17 @@ index b070eed98..a58f07b4b 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); -@@ -317,65 +312,181 @@ public class PurpurWorldConfig { +@@ -317,65 +312,188 @@ public class PurpurWorldConfig { turtleEggsBreakFromMinecarts = getBoolean("blocks.turtle_egg.break-from-minecarts", turtleEggsBreakFromMinecarts); } ++ public boolean babiesAreRidable = true; ++ public boolean untamedTamablesAreRidable = true; ++ private void ridableSettings() { ++ babiesAreRidable = getBoolean("ridable-settings.babies-are-ridable", babiesAreRidable); ++ untamedTamablesAreRidable = getBoolean("ridable-settings.untamed-tamables-are-ridable", untamedTamablesAreRidable); ++ } ++ + public boolean batRidable = false; + public boolean batRidableInWater = false; + public double batMaxY = 256D; @@ -5147,7 +5163,7 @@ index b070eed98..a58f07b4b 100644 public float giantStepHeight = 2.0F; public float giantJumpHeight = 1.0F; public double giantMaxHealth = 100.0D; -@@ -384,6 +495,8 @@ public class PurpurWorldConfig { +@@ -384,6 +502,8 @@ public class PurpurWorldConfig { public boolean giantHaveAI = false; public boolean giantHaveHostileAI = false; private void giantSettings() { @@ -5156,7 +5172,7 @@ index b070eed98..a58f07b4b 100644 giantStepHeight = (float) getDouble("mobs.giant.step-height", giantStepHeight); giantJumpHeight = (float) getDouble("mobs.giant.jump-height", giantJumpHeight); giantMaxHealth = getDouble("mobs.giant.max-health", giantMaxHealth); -@@ -393,29 +506,119 @@ public class PurpurWorldConfig { +@@ -393,29 +513,119 @@ public class PurpurWorldConfig { giantHaveHostileAI = getBoolean("mobs.giant.have-hostile-ai", giantHaveHostileAI); } @@ -5276,7 +5292,7 @@ index b070eed98..a58f07b4b 100644 public double phantomAttackedByCrystalRadius = 0.0D; public float phantomAttackedByCrystalDamage = 1.0F; public double phantomOrbitCrystalRadius = 0.0D; -@@ -435,6 +638,11 @@ public class PurpurWorldConfig { +@@ -435,6 +645,11 @@ public class PurpurWorldConfig { public boolean phantomIgnorePlayersWithTorch = false; public boolean phantomBurnInDaylight = true; private void phantomSettings() { @@ -5288,7 +5304,7 @@ index b070eed98..a58f07b4b 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); -@@ -455,40 +663,184 @@ public class PurpurWorldConfig { +@@ -455,40 +670,184 @@ public class PurpurWorldConfig { phantomIgnorePlayersWithTorch = getBoolean("mobs.phantom.ignore-players-with-torch", phantomIgnorePlayersWithTorch); } @@ -5473,7 +5489,7 @@ index b070eed98..a58f07b4b 100644 public int villagerBrainTicks = 1; public boolean villagerUseBrainTicksOnlyWhenLagging = true; public boolean villagerCanBeLeashed = false; -@@ -498,6 +850,8 @@ public class PurpurWorldConfig { +@@ -498,6 +857,8 @@ public class PurpurWorldConfig { public int villagerSpawnIronGolemLimit = 0; public boolean villagerCanBreed = true; private void villagerSettings() { @@ -5482,7 +5498,7 @@ index b070eed98..a58f07b4b 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); -@@ -508,46 +862,109 @@ public class PurpurWorldConfig { +@@ -508,46 +869,109 @@ public class PurpurWorldConfig { villagerCanBreed = getBoolean("mobs.villager.can-breed", villagerCanBreed); } diff --git a/patches/server/0125-Customizable-WitherBoss-Health-and-Healing.patch b/patches/server/0125-Customizable-WitherBoss-Health-and-Healing.patch index 21accb085..50591a073 100644 --- a/patches/server/0125-Customizable-WitherBoss-Health-and-Healing.patch +++ b/patches/server/0125-Customizable-WitherBoss-Health-and-Healing.patch @@ -53,10 +53,10 @@ index 1054b492c..2a288d372 100644 @Override diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -index ad8ff0587..11a5795f5 100644 +index 6ca2815b0..54319b097 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -@@ -894,10 +894,16 @@ public class PurpurWorldConfig { +@@ -901,10 +901,16 @@ public class PurpurWorldConfig { public boolean witherRidable = false; public boolean witherRidableInWater = false; public double witherMaxY = 256D;