mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
71 lines
3.8 KiB
Diff
71 lines
3.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Ben Kerllenevich <ben@omega24.dev>
|
|
Date: Sun, 21 Mar 2021 15:26:52 -0400
|
|
Subject: [PATCH] Drowning Settings
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
index adfd0f5e939fcd35a564682d913153944d806e5d..07a644587f4f1a9679edc37a2b639889fde4ce88 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -502,7 +502,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
|
|
// Spigot end
|
|
this.entityData = new SynchedEntityData(this);
|
|
this.entityData.define(Entity.DATA_SHARED_FLAGS_ID, (byte) 0);
|
|
- this.entityData.define(Entity.DATA_AIR_SUPPLY_ID, this.getMaxAirSupply());
|
|
+ this.entityData.define(Entity.DATA_AIR_SUPPLY_ID, this.level == null ? 300 : this.getMaxAirSupply()); // Purpur
|
|
this.entityData.define(Entity.DATA_CUSTOM_NAME_VISIBLE, false);
|
|
this.entityData.define(Entity.DATA_CUSTOM_NAME, Optional.empty());
|
|
this.entityData.define(Entity.DATA_SILENT, false);
|
|
@@ -2860,7 +2860,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
|
|
}
|
|
|
|
public int getMaxAirSupply() {
|
|
- return 300;
|
|
+ return this.level.purpurConfig.drowningAirTicks; // Purpur
|
|
}
|
|
|
|
public int getAirSupply() {
|
|
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
index 934bb735c1948113b01f9ba6799ecc1ad92dbb76..b036b0145a83eeb424beb261483b0515518dacd5 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
@@ -420,7 +420,7 @@ public abstract class LivingEntity extends Entity {
|
|
|
|
if (flag1) {
|
|
this.setAirSupply(this.decreaseAirSupply(this.getAirSupply()));
|
|
- if (this.getAirSupply() == -20) {
|
|
+ if (this.getAirSupply() == -this.level.purpurConfig.drowningDamageInterval) { // Purpur
|
|
this.setAirSupply(0);
|
|
Vec3 vec3d = this.getDeltaMovement();
|
|
|
|
@@ -432,7 +432,7 @@ public abstract class LivingEntity extends Entity {
|
|
this.level.addParticle(ParticleTypes.BUBBLE, this.getX() + d2, this.getY() + d3, this.getZ() + d4, vec3d.x, vec3d.y, vec3d.z);
|
|
}
|
|
|
|
- this.hurt(DamageSource.DROWN, 2.0F);
|
|
+ this.hurt(DamageSource.DROWN, (float) this.level.purpurConfig.damageFromDrowning); // Purpur
|
|
}
|
|
}
|
|
|
|
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
index af9622da4048668cc80baf57fbb1c4e151344170..0c34c88e1bd7ec56248aa36927faca4728399bde 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -122,6 +122,15 @@ public class PurpurWorldConfig {
|
|
nighttimeTicks = getInt("gameplay-mechanics.daylight-cycle-ticks.nighttime", nighttimeTicks);
|
|
}
|
|
|
|
+ public int drowningAirTicks = 300;
|
|
+ public int drowningDamageInterval = 20;
|
|
+ public double damageFromDrowning = 2.0F;
|
|
+ private void drowningSettings() {
|
|
+ drowningAirTicks = getInt("gameplay-mechanics.drowning.air-ticks", drowningAirTicks);
|
|
+ drowningDamageInterval = getInt("gameplay-mechanics.drowning.ticks-per-damage", drowningDamageInterval);
|
|
+ damageFromDrowning = getDouble("gameplay-mechanics.drowning.damage-from-drowning", damageFromDrowning);
|
|
+ }
|
|
+
|
|
public int elytraDamagePerSecond = 1;
|
|
public double elytraDamageMultiplyBySpeed = 0;
|
|
public boolean elytraIgnoreUnbreaking = false;
|