mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@eb48ada Merge chunk task urgent executor thread into the worker queue PaperMC/Paper@d9fb602 Expose vanilla BiomeProvider from WorldInfo (#7295) PaperMC/Paper@7d7ae7b Updated Upstream (Bukkit/CraftBukkit/Spigot) (#7246)
52 lines
3.0 KiB
Diff
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 cb825b7edfcee31ba431e5f166ec9008ea9f2060..e00c2b211cc3bf55f58039f4a0872ea59122603b 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
@@ -2158,6 +2158,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/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
index 06e7919068a693ac3f8dbf988d9f3fbe6f04538f..36bf919a4ac62d4fdd85a35e747c3a8b0d5cc7c0 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -335,6 +335,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);
|
|
@@ -353,6 +354,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;
|