Add configurable snowball damage

This commit is contained in:
William Blake Galbreath
2025-01-09 20:34:57 -08:00
committed by granny
parent 4346cee03f
commit 54b81f2b74
3 changed files with 16 additions and 35 deletions

View File

@@ -1,35 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Tue, 24 Nov 2020 05:32:02 -0600
Subject: [PATCH] Add configurable snowball damage
diff --git a/net/minecraft/world/entity/projectile/Snowball.java b/net/minecraft/world/entity/projectile/Snowball.java
index 048ca5232d71f07d8ba7d3eaf0236660494c6b35..f712963fcd80535eee2bd04ec55ae1abdadef2bd 100644
--- a/net/minecraft/world/entity/projectile/Snowball.java
+++ b/net/minecraft/world/entity/projectile/Snowball.java
@@ -58,7 +58,7 @@ public class Snowball extends ThrowableItemProjectile {
protected void onHitEntity(EntityHitResult entityHitResult) {
super.onHitEntity(entityHitResult);
Entity entity = entityHitResult.getEntity();
- int i = entity instanceof Blaze ? 3 : 0;
+ int i = entity.level().purpurConfig.snowballDamage >= 0 ? entity.level().purpurConfig.snowballDamage : entity instanceof Blaze ? 3 : 0; // Purpur
entity.hurt(this.damageSources().thrown(this, this.getOwner()), (float) i);
}
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index cdcc44e381dee9189f951e3f1984272b0f0f60b0..3ec8e7ea1cf1eb5dd8fec5fefa7a77d68cb75632 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -339,6 +339,11 @@ public class PurpurWorldConfig {
});
}
+ public int snowballDamage = -1;
+ private void snowballSettings() {
+ snowballDamage = getInt("gameplay-mechanics.projectile-damage.snowball", snowballDamage);
+ }
+
public boolean anvilAllowColors = false;
public boolean anvilColorsUseMiniMessage;
private void anvilSettings() {

View File

@@ -0,0 +1,11 @@
--- a/net/minecraft/world/entity/projectile/Snowball.java
+++ b/net/minecraft/world/entity/projectile/Snowball.java
@@ -52,7 +_,7 @@
protected void onHitEntity(EntityHitResult result) {
super.onHitEntity(result);
Entity entity = result.getEntity();
- int i = entity instanceof Blaze ? 3 : 0;
+ int i = entity.level().purpurConfig.snowballDamage >= 0 ? entity.level().purpurConfig.snowballDamage : entity instanceof Blaze ? 3 : 0; // Purpur - Add configurable snowball damage
entity.hurt(this.damageSources().thrown(this, this.getOwner()), i);
}

View File

@@ -330,6 +330,11 @@ public class PurpurWorldConfig {
});
}
public int snowballDamage = -1;
private void snowballSettings() {
snowballDamage = getInt("gameplay-mechanics.projectile-damage.snowball", snowballDamage);
}
public boolean anvilAllowColors = false;
public boolean anvilColorsUseMiniMessage;
private void anvilSettings() {