From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <blake.galbreath@gmail.com>
Date: Mon, 30 Nov 2020 19:36:35 -0600
Subject: [PATCH] Add boat fall damage config


diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java
index 7faf393954b703efda7290c831ff75b6a02a4dc1..35b26e520be7c06b296ae219be18ef38a1de5dfc 100644
--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java
@@ -106,6 +106,7 @@ import net.minecraft.world.entity.monster.EntityMonster;
 import net.minecraft.world.entity.player.EntityHuman;
 import net.minecraft.world.entity.player.EnumChatVisibility;
 import net.minecraft.world.entity.projectile.EntityArrow;
+import net.minecraft.world.entity.vehicle.EntityBoat;
 import net.minecraft.world.entity.vehicle.EntityMinecartAbstract;
 import net.minecraft.world.inventory.Container;
 import net.minecraft.world.inventory.ContainerHorse;
@@ -1142,7 +1143,16 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
         if (this.isInvulnerable(damagesource)) {
             return false;
         } else {
-            if (damagesource == DamageSource.FALL && getRootVehicle() instanceof EntityMinecartAbstract && world.purpurConfig.controllableMinecarts && !world.purpurConfig.controllableMinecartsFallDamage) return false; // Purpur
+            // Purpur start
+            if (damagesource == DamageSource.FALL) {
+                if (getRootVehicle() instanceof EntityMinecartAbstract && world.purpurConfig.controllableMinecarts && !world.purpurConfig.controllableMinecartsFallDamage) {
+                    return false;
+                }
+                if (getRootVehicle() instanceof EntityBoat && !world.purpurConfig.boatsDoFallDamage) {
+                    return false;
+                }
+            }
+            // Purpur end
             boolean flag = this.server.j() && this.canPvP() && "fall".equals(damagesource.translationIndex);
 
             if (!flag && isSpawnInvulnerable() && damagesource != DamageSource.OUT_OF_WORLD) { // Purpur
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 2265952ae272dc27796f87bd05e171a6c1fdab1b..df42e4a1d1c542eb20759ede3e20ce186352e5c2 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -224,6 +224,7 @@ public class PurpurWorldConfig {
 
     public boolean useBetterMending = false;
     public boolean boatEjectPlayersOnLand = false;
+    public boolean boatsDoFallDamage = true;
     public boolean disableDropsOnCrammingDeath = false;
     public boolean entitiesPickUpLootBypassMobGriefing = false;
     public boolean entitiesCanUsePortals = true;
@@ -237,6 +238,7 @@ public class PurpurWorldConfig {
     private void miscGameplayMechanicsSettings() {
         useBetterMending = getBoolean("gameplay-mechanics.use-better-mending", useBetterMending);
         boatEjectPlayersOnLand = getBoolean("gameplay-mechanics.boat.eject-players-on-land", boatEjectPlayersOnLand);
+        boatsDoFallDamage = getBoolean("gameplay-mechanics.boat.do-fall-damage", boatsDoFallDamage);
         disableDropsOnCrammingDeath = getBoolean("gameplay-mechanics.disable-drops-on-cramming-death", disableDropsOnCrammingDeath);
         entitiesPickUpLootBypassMobGriefing = getBoolean("gameplay-mechanics.entities-pick-up-loot-bypass-mob-griefing", entitiesPickUpLootBypassMobGriefing);
         entitiesCanUsePortals = getBoolean("gameplay-mechanics.entities-can-use-portals", entitiesCanUsePortals);
