mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-21 18:37:42 +01:00
Dont run with scissors!
inspired by https://modrinth.com/mod/dont-run-with-scissors
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
--- a/net/minecraft/world/damagesource/CombatTracker.java
|
||||
+++ b/net/minecraft/world/damagesource/CombatTracker.java
|
||||
@@ -98,6 +_,11 @@
|
||||
Component component = ComponentUtils.wrapInSquareBrackets(Component.translatable(string + ".link")).withStyle(INTENTIONAL_GAME_DESIGN_STYLE);
|
||||
return Component.translatable(string + ".message", this.mob.getDisplayName(), component);
|
||||
} else {
|
||||
+ // Purpur start - Dont run with scissors!
|
||||
+ if (damageSource.isScissors()) {
|
||||
+ return damageSource.getLocalizedDeathMessage(org.purpurmc.purpur.PurpurConfig.deathMsgRunWithScissors, this.mob);
|
||||
+ }
|
||||
+ // Purpur end - Dont run with scissors!
|
||||
return damageSource.getLocalizedDeathMessage(this.mob);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,44 @@
|
||||
--- a/net/minecraft/world/damagesource/DamageSource.java
|
||||
+++ b/net/minecraft/world/damagesource/DamageSource.java
|
||||
@@ -188,6 +_,15 @@
|
||||
}
|
||||
@@ -28,6 +_,7 @@
|
||||
private boolean sweep = false;
|
||||
private boolean melting = false;
|
||||
private boolean poison = false;
|
||||
+ private boolean scissors = false; // Purpur - Dont run with scissors!
|
||||
@Nullable
|
||||
private Entity customEventDamager = null; // This field is a helper for when causing entity damage is not set by vanilla // Paper - fix DamageSource API
|
||||
|
||||
@@ -58,6 +_,17 @@
|
||||
return this.poison;
|
||||
}
|
||||
|
||||
+ // Purpur start - Dont run with scissors!
|
||||
+ public DamageSource scissors() {
|
||||
+ this.scissors = true;
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ public boolean isScissors() {
|
||||
+ return this.scissors;
|
||||
+ }
|
||||
+ // Purpur end - Dont run with scissors!
|
||||
+
|
||||
// Paper start - fix DamageSource API
|
||||
@Nullable
|
||||
public Entity getCustomEventDamager() {
|
||||
@@ -116,6 +_,7 @@
|
||||
damageSource.sweep = this.isSweep();
|
||||
damageSource.poison = this.isPoison();
|
||||
damageSource.melting = this.isMelting();
|
||||
+ damageSource.scissors = this.isScissors(); // Purpur - Dont run with scissors!
|
||||
return damageSource;
|
||||
}
|
||||
// CraftBukkit end
|
||||
@@ -187,6 +_,15 @@
|
||||
: Component.translatable(string, livingEntity.getDisplayName(), component);
|
||||
}
|
||||
}
|
||||
+
|
||||
+ // Purpur start - Component related conveniences
|
||||
+ public Component getLocalizedDeathMessage(String str, LivingEntity entity) {
|
||||
+ net.kyori.adventure.text.Component name = io.papermc.paper.adventure.PaperAdventure.asAdventure(entity.getDisplayName());
|
||||
@@ -12,7 +47,6 @@
|
||||
+ return io.papermc.paper.adventure.PaperAdventure.asVanilla(component);
|
||||
+ }
|
||||
+ // Purpur end - Component related conveniences
|
||||
+
|
||||
|
||||
public String getMsgId() {
|
||||
return this.type().msgId();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
--- a/net/minecraft/world/damagesource/DamageSources.java
|
||||
+++ b/net/minecraft/world/damagesource/DamageSources.java
|
||||
@@ -45,11 +_,13 @@
|
||||
// CraftBukkit start
|
||||
private final DamageSource melting;
|
||||
private final DamageSource poison;
|
||||
+ private final DamageSource scissors; // Purpur - Dont run with scissors!
|
||||
|
||||
public DamageSources(RegistryAccess registry) {
|
||||
this.damageTypes = registry.lookupOrThrow(Registries.DAMAGE_TYPE);
|
||||
this.melting = this.source(DamageTypes.ON_FIRE).melting();
|
||||
this.poison = this.source(DamageTypes.MAGIC).poison();
|
||||
+ this.scissors = this.source(DamageTypes.MAGIC).scissors(); // Purpur - Dont run with scissors!
|
||||
// CraftBukkit end
|
||||
this.inFire = this.source(DamageTypes.IN_FIRE);
|
||||
this.campfire = this.source(DamageTypes.CAMPFIRE);
|
||||
@@ -99,6 +_,12 @@
|
||||
return this.poison;
|
||||
}
|
||||
// CraftBukkit end
|
||||
+
|
||||
+ // Purpur start - Dont run with scissors!
|
||||
+ public DamageSource scissors() {
|
||||
+ return this.scissors;
|
||||
+ }
|
||||
+ // Purpur end - Dont run with scissors!
|
||||
|
||||
public DamageSource inFire() {
|
||||
return this.inFire;
|
||||
Reference in New Issue
Block a user