fix one punch man patch

This commit is contained in:
granny
2024-04-28 14:32:43 -07:00
parent 9e63d11b9c
commit c9115d3655
4 changed files with 27 additions and 26 deletions

View File

@@ -5,26 +5,27 @@ 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 diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index dc1c7c55fd13cc1a8ade803bfb1b7c385cf29132..e8a92e4941ab7d638d3e3ac5ad8d6314bede17c0 100644 index dc1c7c55fd13cc1a8ade803bfb1b7c385cf29132..0b4384b6898ad591b8b9256b2427359474dd9c57 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -2382,6 +2382,20 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -2382,6 +2382,21 @@ public abstract class LivingEntity extends Entity implements Attackable {
} }
} }
+ // Purpur start + // Purpur start
+ if (damagesource.getEntity() instanceof net.minecraft.world.entity.player.Player player && damagesource.getEntity().level().purpurConfig.creativeOnePunch) { + if (damagesource.getEntity() instanceof net.minecraft.world.entity.player.Player player && damagesource.getEntity().level().purpurConfig.creativeOnePunch) {
+ if (player.isCreative()) { + if (player.isCreative()) {
+ double attackDamage = 0; + double attackDamage;
+ for (AttributeModifier modifier : player.getMainHandItem().getAttributeModifiers(EquipmentSlot.MAINHAND).get(Attributes.ATTACK_DAMAGE)) { + net.minecraft.world.item.component.ItemAttributeModifiers itemattributemodifiers = player.getMainHandItem().getOrDefault(DataComponents.ATTRIBUTE_MODIFIERS, net.minecraft.world.item.component.ItemAttributeModifiers.EMPTY);
+ attackDamage += modifier.getAmount(); +
+ } + attackDamage = itemattributemodifiers.compute(this.getAttributeBaseValue(Attributes.ATTACK_DAMAGE), EquipmentSlot.MAINHAND);
+ if (attackDamage == 0) { +
+ this.setHealth(0); + if (attackDamage == 0) {
+ } + this.setHealth(0);
+ } + }
+ } + }
+ // Purpur end + }
+ // Purpur end
+ +
if (f > 0 || !human) { if (f > 0 || !human) {
if (human) { if (human) {

View File

@@ -32,7 +32,7 @@ index 5f19cc285efac25b56a29242b41c2823020f170e..2d1fc8734f440c284710c71abc6789e8
return this.hardCollides; return this.hardCollides;
} }
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 58a57a1cf8b8a3e885346f1fd1f7dd54a0277867..20433981a866b46a2ccedec70d5ee01079c2797c 100644 index b5e63979fca87ac1f97e83ae18dd30dfecd275dc..79b782affc598abcd37a640a523f7bc35d1b3796 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -274,6 +274,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -274,6 +274,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -63,7 +63,7 @@ index 58a57a1cf8b8a3e885346f1fd1f7dd54a0277867..20433981a866b46a2ccedec70d5ee010
} }
// CraftBukkit start // CraftBukkit start
@@ -3572,6 +3579,27 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -3573,6 +3580,27 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.hurt(this.damageSources().drown(), 1.0F); this.hurt(this.damageSources().drown(), 1.0F);
} }

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Toggle for kinetic damage
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 20433981a866b46a2ccedec70d5ee01079c2797c..d85407573c47df162cedb8667c2fbc327e75588b 100644 index 79b782affc598abcd37a640a523f7bc35d1b3796..28718b44dc2bd98a5144ebcfd8be195a4715ccd7 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -2992,6 +2992,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -2993,6 +2993,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (f3 > 0.0F) { if (f3 > 0.0F) {
this.playSound(this.getFallDamageSound((int) f3), 1.0F, 1.0F); this.playSound(this.getFallDamageSound((int) f3), 1.0F, 1.0F);

View File

@@ -1211,7 +1211,7 @@ index 68e8f9913055219486ce19d95dcf9d7c76e08082..2c3ad553272ad651e6ca26917719e6d9
} }
} else { } else {
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 484eff80394a55088f3cef726a8263e28accd6fe..def30f8c79a4244116f1b9d9ae1a9d06d0a38bce 100644 index 580e01281f27a4cd1d3a243a7d4791b88910b5bb..5e979618feda785d3f36cf085e72eed23bdd3f22 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -423,7 +423,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -423,7 +423,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1232,7 +1232,7 @@ index 484eff80394a55088f3cef726a8263e28accd6fe..def30f8c79a4244116f1b9d9ae1a9d06
} }
public boolean canSpawnSoulSpeedParticle() { public boolean canSpawnSoulSpeedParticle() {
@@ -3226,10 +3226,10 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -3227,10 +3227,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
} }
this.run += (f3 - this.run) * 0.3F; this.run += (f3 - this.run) * 0.3F;
@@ -1246,7 +1246,7 @@ index 484eff80394a55088f3cef726a8263e28accd6fe..def30f8c79a4244116f1b9d9ae1a9d06
// Paper start - stop large pitch and yaw changes from crashing the server // Paper start - stop large pitch and yaw changes from crashing the server
this.yRotO += Math.round((this.getYRot() - this.yRotO) / 360.0F) * 360.0F; this.yRotO += Math.round((this.getYRot() - this.yRotO) / 360.0F) * 360.0F;
@@ -3241,7 +3241,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -3242,7 +3242,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.yHeadRotO += Math.round((this.yHeadRot - this.yHeadRotO) / 360.0F) * 360.0F; this.yHeadRotO += Math.round((this.yHeadRot - this.yHeadRotO) / 360.0F) * 360.0F;
// Paper end // Paper end
@@ -1255,7 +1255,7 @@ index 484eff80394a55088f3cef726a8263e28accd6fe..def30f8c79a4244116f1b9d9ae1a9d06
this.animStep += f2; this.animStep += f2;
if (this.isFallFlying()) { if (this.isFallFlying()) {
++this.fallFlyTicks; ++this.fallFlyTicks;
@@ -3464,19 +3464,19 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -3465,19 +3465,19 @@ public abstract class LivingEntity extends Entity implements Attackable {
} }
this.setDeltaMovement(d0, d1, d2); this.setDeltaMovement(d0, d1, d2);
@@ -1280,7 +1280,7 @@ index 484eff80394a55088f3cef726a8263e28accd6fe..def30f8c79a4244116f1b9d9ae1a9d06
if (this.jumping && this.isAffectedByFluids()) { if (this.jumping && this.isAffectedByFluids()) {
double d3; double d3;
@@ -3503,8 +3503,8 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -3504,8 +3504,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.noJumpDelay = 0; this.noJumpDelay = 0;
} }
@@ -1291,7 +1291,7 @@ index 484eff80394a55088f3cef726a8263e28accd6fe..def30f8c79a4244116f1b9d9ae1a9d06
this.xxa *= 0.98F; this.xxa *= 0.98F;
this.zza *= 0.98F; this.zza *= 0.98F;
this.updateFallFlying(); this.updateFallFlying();
@@ -3529,8 +3529,8 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -3530,8 +3530,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.travel(vec3d1); this.travel(vec3d1);
} }
@@ -1302,7 +1302,7 @@ index 484eff80394a55088f3cef726a8263e28accd6fe..def30f8c79a4244116f1b9d9ae1a9d06
if (!this.level().isClientSide && !this.isDeadOrDying() && !this.freezeLocked) { // Paper - Freeze Tick Lock API if (!this.level().isClientSide && !this.isDeadOrDying() && !this.freezeLocked) { // Paper - Freeze Tick Lock API
int i = this.getTicksFrozen(); int i = this.getTicksFrozen();
@@ -3547,15 +3547,15 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -3548,15 +3548,15 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.hurt(this.damageSources().freeze(), 1.0F); this.hurt(this.damageSources().freeze(), 1.0F);
} }