Purpur/patches/server/0117-Add-boat-fall-damage-config.patch

49 lines
3.2 KiB
Diff
Raw Normal View History

2020-12-13 08:32:09 +08:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2021-06-20 08:42:43 +08:00
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
2020-12-01 09:37:44 +08:00
Date: Mon, 30 Nov 2020 19:36:35 -0600
Subject: [PATCH] Add boat fall damage config
2021-06-20 08:42:43 +08:00
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
2022-06-11 14:25:34 +08:00
index 8e5aa1666ca929780670ce513d969973a513e21e..fe2d7acece87d5b825f3f3668c11c0efc877439b 100644
2021-06-20 08:42:43 +08:00
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
2022-06-08 23:50:34 +08:00
@@ -1032,7 +1032,16 @@ public class ServerPlayer extends Player {
2021-06-20 08:42:43 +08:00
if (this.isInvulnerableTo(source)) {
2020-12-01 09:37:44 +08:00
return false;
} else {
2021-06-20 08:42:43 +08:00
- if (source == DamageSource.FALL && getRootVehicle() instanceof net.minecraft.world.entity.vehicle.AbstractMinecart && level.purpurConfig.minecartControllable && !level.purpurConfig.minecartControllableFallDamage) return false; // Purpur
2020-12-01 09:37:44 +08:00
+ // Purpur start
2021-06-20 08:42:43 +08:00
+ if (source == DamageSource.FALL) {
+ if (getRootVehicle() instanceof net.minecraft.world.entity.vehicle.AbstractMinecart && level.purpurConfig.minecartControllable && !level.purpurConfig.minecartControllableFallDamage) {
2020-12-01 09:37:44 +08:00
+ return false;
+ }
2021-06-20 08:42:43 +08:00
+ if (getRootVehicle() instanceof net.minecraft.world.entity.vehicle.Boat && !level.purpurConfig.boatsDoFallDamage) {
2020-12-01 09:37:44 +08:00
+ return false;
+ }
+ }
+ // Purpur end
2021-06-20 08:42:43 +08:00
boolean flag = this.server.isDedicatedServer() && this.isPvpAllowed() && "fall".equals(source.msgId);
2020-12-01 09:37:44 +08:00
2021-06-20 08:42:43 +08:00
if (!flag && isSpawnInvulnerable() && source != DamageSource.OUT_OF_WORLD) { // Purpur
2021-11-29 21:30:53 +08:00
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 2375db9b994ffbd7371e92731bdb31095d40f9f5..e23ff0ebd09937fcf7c32c2157717c8dff7727d7 100644
2021-11-29 21:30:53 +08:00
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -109,6 +109,7 @@ public class PurpurWorldConfig {
2020-12-01 09:37:44 +08:00
public boolean useBetterMending = false;
public boolean boatEjectPlayersOnLand = false;
+ public boolean boatsDoFallDamage = true;
public boolean disableDropsOnCrammingDeath = false;
public boolean entitiesCanUsePortals = true;
2021-06-20 23:53:10 +08:00
public boolean milkCuresBadOmen = true;
@@ -121,6 +122,7 @@ public class PurpurWorldConfig {
2020-12-01 09:37:44 +08:00
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);
entitiesCanUsePortals = getBoolean("gameplay-mechanics.entities-can-use-portals", entitiesCanUsePortals);
2021-06-20 23:53:10 +08:00
milkCuresBadOmen = getBoolean("gameplay-mechanics.milk-cures-bad-omen", milkCuresBadOmen);