Files
Purpur/patches/server/0159-Config-for-health-to-impact-Creeper-explosion-radius.patch
granny ffeb49da1e ignore item_model component for don't run with scissors feature alongside custom_model_data component
by default, the "don't run with scissors" feature will not activate for shears that have an `item_model` component or `custom_model_data` component.

adds a new world config option at `gameplay-mechanics.item.shears.damage-if-sprinting-item-model` that allows specifying a custom item model ResourceLocation (`purpurmc:scissors` by default) for use with this feature.
2024-12-06 06:05:14 -08:00

43 lines
2.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Encode42 <me@encode42.dev>
Date: Thu, 29 Apr 2021 20:28:18 -0400
Subject: [PATCH] Config for health to impact Creeper explosion radius
diff --git a/src/main/java/net/minecraft/world/entity/monster/Creeper.java b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
index 0bce10c1cbf9f1788817a2834ec0efa04dd17752..d2de324f024d0a83790e2b86dc765b0115081461 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
@@ -373,9 +373,10 @@ public class Creeper extends Monster {
if (world instanceof ServerLevel worldserver) {
float f = this.isPowered() ? 2.0F : 1.0F;
+ float multiplier = worldserver.purpurConfig.creeperHealthRadius ? this.getHealth() / this.getMaxHealth() : 1; // Purpur
// CraftBukkit start
- ExplosionPrimeEvent event = CraftEventFactory.callExplosionPrimeEvent(this, this.explosionRadius * f, false);
+ ExplosionPrimeEvent event = CraftEventFactory.callExplosionPrimeEvent(this, (this.explosionRadius * f) * multiplier, false); // Purpur
if (!event.isCancelled()) {
// CraftBukkit end
this.dead = true;
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 1ae95a30b6e4cf69028dc61c398651bde526418f..851d0c96350abc8d8c490d92183540b013a98d12 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -954,6 +954,7 @@ public class PurpurWorldConfig {
public boolean creeperBypassMobGriefing = false;
public boolean creeperTakeDamageFromWater = false;
public boolean creeperExplodeWhenKilled = false;
+ public boolean creeperHealthRadius = false;
private void creeperSettings() {
creeperRidable = getBoolean("mobs.creeper.ridable", creeperRidable);
creeperRidableInWater = getBoolean("mobs.creeper.ridable-in-water", creeperRidableInWater);
@@ -970,6 +971,7 @@ public class PurpurWorldConfig {
creeperBypassMobGriefing = getBoolean("mobs.creeper.bypass-mob-griefing", creeperBypassMobGriefing);
creeperTakeDamageFromWater = getBoolean("mobs.creeper.takes-damage-from-water", creeperTakeDamageFromWater);
creeperExplodeWhenKilled = getBoolean("mobs.creeper.explode-when-killed", creeperExplodeWhenKilled);
+ creeperHealthRadius = getBoolean("mobs.creeper.health-impacts-explosion", creeperHealthRadius);
}
public boolean dolphinRidable = false;