From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: jmp <jasonpenilla2@me.com>
Date: Sat, 20 Feb 2021 14:47:08 -0800
Subject: [PATCH] Configs for if Wither/Ender Dragon can ride vehicles


diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 49a1447bae91294a23ccab27c2809bea0c4c90a3..94af972e115491d0f4394dd290ec2d9d426b8d32 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2274,7 +2274,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
         }
     }
 
-    protected boolean n(Entity entity) {
+    protected boolean n(Entity entity) { // Purpur - canRide
         return !this.isSneaking() && this.j <= 0;
     }
 
diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java
index fd019a7d8940150ba776e211fe5f7ecb4ffbc89c..9e27d3ccfd6a5ee00cac72c3137189b1be1f81fb 100644
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
@@ -1023,6 +1023,7 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster {
 
     @Override
     protected boolean n(Entity entity) {
+        if (this.world.purpurConfig.enderDragonCanRideVehicles) return this.getRideCooldown() <= 0; // Purpur
         return false;
     }
 
diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java
index 8679f9f5210632349915558016c3273f5ef0527d..e238352bd41069936da2860b707f071c9aef0062 100644
--- a/src/main/java/net/minecraft/server/EntityWither.java
+++ b/src/main/java/net/minecraft/server/EntityWither.java
@@ -673,6 +673,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
 
     @Override
     protected boolean n(Entity entity) {
+        if (this.world.purpurConfig.witherCanRideVehicles) return this.getRideCooldown() <= 0; // Purpur
         return false;
     }
 
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 64657c3c9250d8767702a54bb0ee3a23f43da04a..958b0ee8af21e4176e9d35af88294919c509a2c1 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -773,6 +773,7 @@ public class PurpurWorldConfig {
     public boolean enderDragonAlwaysDropsFullExp = false;
     public boolean enderDragonBypassMobGriefing = false;
     public double enderDragonMaxHealth = 200.0D;
+    public boolean enderDragonCanRideVehicles = false;
     private void enderDragonSettings() {
         enderDragonRidable = getBoolean("mobs.ender_dragon.ridable", enderDragonRidable);
         enderDragonRidableInWater = getBoolean("mobs.ender_dragon.ridable-in-water", enderDragonRidableInWater);
@@ -789,6 +790,7 @@ public class PurpurWorldConfig {
             set("mobs.ender_dragon.attributes.max_health", oldValue);
         }
         enderDragonMaxHealth = getDouble("mobs.ender_dragon.attributes.max_health", enderDragonMaxHealth);
+        enderDragonCanRideVehicles = getBoolean("mobs.ender_dragon.can-ride-vehicles", enderDragonCanRideVehicles);
     }
 
     public boolean endermanRidable = false;
@@ -1731,6 +1733,7 @@ public class PurpurWorldConfig {
     public float witherHealthRegenAmount = 1.0f;
     public int witherHealthRegenDelay = 20;
     public double witherMaxHealth = 300.0D;
+    public boolean witherCanRideVehicles = false;
     private void witherSettings() {
         witherRidable = getBoolean("mobs.wither.ridable", witherRidable);
         witherRidableInWater = getBoolean("mobs.wither.ridable-in-water", witherRidableInWater);
@@ -1748,6 +1751,7 @@ public class PurpurWorldConfig {
             set("mobs.wither.attributes.max_health", oldValue);
         }
         witherMaxHealth = getDouble("mobs.wither.attributes.max_health", witherMaxHealth);
+        witherCanRideVehicles = getBoolean("mobs.wither.can-ride-vehicles", witherCanRideVehicles);
     }
 
     public boolean witherSkeletonRidable = false;
