Files
Purpur/patches/server/0161-One-Punch-Man.patch
William Blake Galbreath 13b1d3715e Updated Upstream (Paper & Tuinity)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
eaadb4a68f Fix Java toolchain configuration to work on arm macOS
8bebf48495 Mark sensor and behavior timings as verbose
6855505490 Fix some inconsistency issues with empty map items (#6304)
ed1dc272e6 Add System.out.println catcher (#6278)
112b6a508a Add force getter to ParticleBuilder (#6300)
a44f486694 Allow plugins to use Log4J to log (#6288)
8c28a33d4e Don't not shuffle visible chunks (#6283)
0e978ea45e Rewrite LogEvents to contain information about the source jar of stacktrace elements (#6142)
6e7f9aafd6 Prevent AFK kick while watching end credits (#6239). (#6265)

Tuinity Changes:
61c9a54783 Don't use CI build number for implementation version (#356)
dc9d19c984 Update packet limiter config to accept mojang or spigot packet class names (#322)
2021-08-02 16:11:12 -05:00

52 lines
3.1 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Fourmisain <8464472+Fourmisain@users.noreply.github.com>
Date: Fri, 5 Mar 2021 17:42:35 -0500
Subject: [PATCH] One Punch Man!
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index a343738d971994c91ac42e41558ca05d6f9f8f57..276bac768069d14b0015eed3f31f98c38978df0b 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -2124,6 +2124,20 @@ public abstract class LivingEntity extends Entity {
((ServerPlayer) damagesource.getEntity()).awardStat(Stats.DAMAGE_DEALT_ABSORBED, Math.round(f2 * 10.0F));
}
+ // Purpur start
+ if (damagesource.getEntity() instanceof net.minecraft.world.entity.player.Player player && damagesource.getEntity().level.purpurConfig.creativeOnePunch) {
+ if (player.isCreative()) {
+ double attackDamage = 0;
+ for (AttributeModifier modifier : player.getMainHandItem().getAttributeModifiers(EquipmentSlot.MAINHAND).get(Attributes.ATTACK_DAMAGE)) {
+ attackDamage += modifier.getAmount();
+ }
+ if (attackDamage == 0) {
+ this.setHealth(0);
+ }
+ }
+ }
+ // Purpur end
+
if (f > 0 || !human) {
if (human) {
// PAIL: Be sure to drag all this code from the EntityHuman subclass each update.
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 5c88e603a5a2db48ae19a360e0f44f86bec11a5d..26636dea0ce6ed0d58c44bdfbf18a4305d777874 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -300,6 +300,7 @@ public class PurpurWorldConfig {
public boolean teleportIfOutsideBorder = false;
public boolean totemOfUndyingWorksInInventory = false;
public boolean playerFixStuckPortal = false;
+ public boolean creativeOnePunch = false;
private void playerSettings() {
idleTimeoutKick = getBoolean("gameplay-mechanics.player.idle-timeout.kick-if-idle", idleTimeoutKick);
idleTimeoutTickNearbyEntities = getBoolean("gameplay-mechanics.player.idle-timeout.tick-nearby-entities", idleTimeoutTickNearbyEntities);
@@ -312,6 +313,7 @@ public class PurpurWorldConfig {
teleportIfOutsideBorder = getBoolean("gameplay-mechanics.player.teleport-if-outside-border", teleportIfOutsideBorder);
totemOfUndyingWorksInInventory = getBoolean("gameplay-mechanics.player.totem-of-undying-works-in-inventory", totemOfUndyingWorksInInventory);
playerFixStuckPortal = getBoolean("gameplay-mechanics.player.fix-stuck-in-portal", playerFixStuckPortal);
+ creativeOnePunch = getBoolean("gameplay-mechanics.player.one-punch-in-creative", creativeOnePunch);
}
public int snowballDamage = -1;