43/103 rejected minecraft source files applied

(idk what i was counting in the previous commit...)
This commit is contained in:
granny
2026-03-11 21:06:08 -07:00
parent 5eb960544c
commit 1f72458912
71 changed files with 1302 additions and 1656 deletions

View File

@@ -0,0 +1,20 @@
--- a/net/minecraft/world/damagesource/CombatRules.java
+++ b/net/minecraft/world/damagesource/CombatRules.java
@@ -17,7 +_,7 @@
final LivingEntity victim, final float damage, final DamageSource source, final float totalArmor, final float armorToughness
) {
float toughness = 2.0F + armorToughness / 4.0F;
- float realArmor = Mth.clamp(totalArmor - damage / toughness, totalArmor * 0.2F, 20.0F);
+ float realArmor = Mth.clamp(totalArmor - damage / toughness, totalArmor * 0.2F, org.purpurmc.purpur.PurpurConfig.limitArmor ? 20F : Float.MAX_VALUE); // Purpur - Add attribute clamping and armor limit config
float armorFraction = realArmor / 25.0F;
ItemStack weaponItem = source.getWeaponItem();
float modifiedArmorFraction;
@@ -32,7 +_,7 @@
}
public static float getDamageAfterMagicAbsorb(final float damage, final float totalMagicArmor) {
- float realArmor = Mth.clamp(totalMagicArmor, 0.0F, 20.0F);
+ float realArmor = Mth.clamp(totalMagicArmor, 0.0F, org.purpurmc.purpur.PurpurConfig.limitArmor ? 20F : Float.MAX_VALUE); // Purpur - Add attribute clamping and armor limit config
return damage * (1.0F - realArmor / 25.0F);
}
}

View File

@@ -0,0 +1,27 @@
--- a/net/minecraft/world/damagesource/CombatTracker.java
+++ b/net/minecraft/world/damagesource/CombatTracker.java
@@ -66,7 +_,7 @@
final Entity attackerEntity, final Component attackerName, final String messageWithItem, final String messageWithoutItem
) {
ItemStack attackerItem = attackerEntity instanceof LivingEntity livingEntity ? livingEntity.getMainHandItem() : ItemStack.EMPTY;
- return !attackerItem.isEmpty() && attackerItem.has(DataComponents.CUSTOM_NAME)
+ return !attackerItem.isEmpty() && (org.purpurmc.purpur.PurpurConfig.playerDeathsAlwaysShowItem || attackerItem.has(DataComponents.CUSTOM_NAME)) // Purpur - always show item in player death messages
? Component.translatable(messageWithItem, this.mob.getDisplayName(), attackerName, attackerItem.getDisplayName())
: Component.translatable(messageWithoutItem, this.mob.getDisplayName(), attackerName);
}
@@ -109,6 +_,15 @@
Component link = ComponentUtils.wrapInSquareBrackets(Component.translatable(deathMsg + ".link")).withStyle(INTENTIONAL_GAME_DESIGN_STYLE);
return Component.translatable(deathMsg + ".message", this.mob.getDisplayName(), link);
} else {
+ // Purpur start - Dont run with scissors!
+ if (killingSource.isScissors()) {
+ return killingSource.getLocalizedDeathMessage(org.purpurmc.purpur.PurpurConfig.deathMsgRunWithScissors, this.mob);
+ // Purpur start - Stonecutter damage
+ } else if (killingSource.isStonecutter()) {
+ return killingSource.getLocalizedDeathMessage(org.purpurmc.purpur.PurpurConfig.deathMsgStonecutter, this.mob);
+ // Purpur end - Stonecutter damage
+ }
+ // Purpur end - Dont run with scissors!
return killingSource.getLocalizedDeathMessage(this.mob);
}
}

View File

@@ -0,0 +1,73 @@
--- a/net/minecraft/world/damagesource/DamageSource.java
+++ b/net/minecraft/world/damagesource/DamageSource.java
@@ -24,6 +_,8 @@
private org.bukkit.block.@Nullable Block eventBlockDamager; // Relevant block set. damageSourcePosition is only used for bad respawn point explosion or custom damage
private org.bukkit.block.@Nullable BlockState fromBlockSnapshot; // Captured block snapshot when the eventBlockDamager is not relevant (e.g. for bad respawn point explosions the block is already removed)
private boolean critical; // Supports arrows and sweeping damage
+ private boolean scissors = false; // Purpur - Dont run with scissors!
+ private boolean stonecutter = false; // Purpur - Stonecutter damage
public DamageSource knownCause(final org.bukkit.event.entity.EntityDamageEvent.DamageCause cause) {
final DamageSource damageSource = this.copy();
@@ -35,6 +_,30 @@
return this.knownCause;
}
+ // Purpur start - Dont run with scissors!
+ public DamageSource scissors() {
+ this.knownCause(org.bukkit.event.entity.EntityDamageEvent.DamageCause.SUICIDE);
+ this.scissors = true;
+ return this;
+ }
+
+ public boolean isScissors() {
+ return this.scissors;
+ }
+ // Purpur end - Dont run with scissors!
+
+ // Purpur start - - Stonecutter damage
+ public DamageSource stonecutter() {
+ this.knownCause(org.bukkit.event.entity.EntityDamageEvent.DamageCause.CONTACT);
+ this.stonecutter = true;
+ return this;
+ }
+
+ public boolean isStonecutter() {
+ return this.stonecutter;
+ }
+ // Purpur end - Stonecutter damage
+
@Nullable
public Entity eventEntityDamager() {
return this.eventEntityDamager;
@@ -94,6 +_,8 @@
damageSource.eventBlockDamager = this.eventBlockDamager;
damageSource.fromBlockSnapshot = this.fromBlockSnapshot;
damageSource.critical = this.critical;
+ damageSource.scissors = this.isScissors(); // Purpur - Dont run with scissors!
+ damageSource.stonecutter = this.isStonecutter(); // Purpur - Stonecutter damage
return damageSource;
}
// CraftBukkit end
@@ -159,11 +_,20 @@
} else {
Component name = this.causingEntity == null ? this.directEntity.getDisplayName() : this.causingEntity.getDisplayName();
ItemStack held = this.causingEntity instanceof LivingEntity livingEntity ? livingEntity.getMainHandItem() : ItemStack.EMPTY;
- return !held.isEmpty() && held.has(DataComponents.CUSTOM_NAME)
+ return !held.isEmpty() && (org.purpurmc.purpur.PurpurConfig.playerDeathsAlwaysShowItem || held.has(DataComponents.CUSTOM_NAME)) // Purpur - always show item in player death messages
? Component.translatable(deathMsg + ".item", victim.getDisplayName(), name, held.getDisplayName())
: Component.translatable(deathMsg, victim.getDisplayName(), name);
}
}
+
+ // 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());
+ net.kyori.adventure.text.minimessage.tag.resolver.TagResolver template = net.kyori.adventure.text.minimessage.tag.resolver.Placeholder.component("player", name);
+ net.kyori.adventure.text.Component component = net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(str, template);
+ return io.papermc.paper.adventure.PaperAdventure.asVanilla(component);
+ }
+ // Purpur end - Component related conveniences
public String getMsgId() {
return this.type().msgId();