Files
Purpur/patches/server/0159-One-Punch-Man.patch
Encode42 c783c42654 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@f7e3976 Revert "Legacy data should look for legacy materials (Fixes #6618)" (Fixes #6664)
PaperMC/Paper@ce1e7e8 Fix jline relocation (#6677)
PaperMC/Paper@3e8fb21 Suggest PlayerPostRespawnEvent if changing player state (#6679)
PaperMC/Paper@2b404b0 Fix nullability on Block#breakNaturally (#6651)
PaperMC/Paper@8ee9bdd Fix stacktrace deobf where thrownProxy got initialized before rewriting (#6684)
PaperMC/Paper@fce7905 Option to prevent NBT copy in smithing recipes (#6671)
PaperMC/Paper@3b2b835 Fix click event when vanilla scoreboard name coloring is enabled (#6652)
PaperMC/Paper@425edfa More CommandBlock API (#5746)
PaperMC/Paper@6847f57 Improve ItemStack#editMeta (#6502)
PaperMC/Paper@6703c13 Preserve overstacked loot (#5943)
PaperMC/Paper@0032236 Make Levels Use Correct Spawn Settings (#6419)
PaperMC/Paper@4a27a4a Update head rotation in missing places (#5481)
PaperMC/Paper@ebfd70b Use null for null resource pack prompts (#6572)
PaperMC/Paper@826acaf Fix plugin provides load order (#6687)
PaperMC/Paper@f905057 Prevent unintended light block manipulation (#6601)
PaperMC/Paper@45c4f90 Readd root/admin user detection (#6593)
PaperMC/Paper@e8830b2 Revert "Readd root/admin user detection (#6593)" (#6699)
PaperMC/Paper@cc38c16 Updated Upstream (Bukkit/CraftBukkit) (#6638)
PaperMC/Paper@7dd7c0c [ci skip] update issue template to remove checkboxes and add datapacks (#6702)
PaperMC/Paper@bde7b98 Make legacyRenderer a ViewerUnaware renderer (#6691)
PaperMC/Paper@e391591 Update paperweight to 1.1.12 (#6653)
PaperMC/Paper@e14aff9 Don't count named piglins and hoglins towards mob cap (#6452)
PaperMC/Paper@a978f41 Start console thread after PaperConfig & MinecraftServer.console are initialized (#6716)
PaperMC/Paper@b1f0cbd [ci skip] Remove redundant/broken readme badges (#6715)
PaperMC/Paper@e3ef498 [ci skip] remove markdown from issue template (#6705)
PaperMC/Paper@7ebf08a Handle missing Spawn Egg item meta for 1.17 mobs (#6700)
PaperMC/Paper@90f717f Add missing team sidebar display slots (#6690)
2021-10-04 15:11:25 -04:00

52 lines
3.0 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 733a9827554f129809e77fe41174b5b2b89b8e5c..b2dbe65f07ecc25be810f80aaf05d924c998dfac 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -2137,6 +2137,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 f3a9bae0079eadfd3734930d4b2d1ee377085843..0c301b690b0f6c529f46c90b975348b30247a4e5 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -302,6 +302,7 @@ public class PurpurWorldConfig {
public boolean teleportIfOutsideBorder = false;
public boolean totemOfUndyingWorksInInventory = false;
public boolean playerFixStuckPortal = false;
+ public boolean creativeOnePunch = false;
private void playerSettings() {
if (PurpurConfig.version < 19) {
boolean oldVal = getBoolean("gameplay-mechanics.player.idle-timeout.mods-target", idleTimeoutTargetPlayer);
@@ -320,6 +321,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;