mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
One Punch Man 2: Electric Boogaloo (#187)
This commit is contained in:
@@ -5,18 +5,26 @@ Subject: [PATCH] One Punch Man!
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index 50fa5f8395fea3ba6fa202a5a38519cd55ae00e0..44e4d52653f77fa5075840d873ad1a3a917041d0 100644
|
||||
index 50fa5f8395fea3ba6fa202a5a38519cd55ae00e0..c8f23b21cbe8625f7344c118eb62bab7e55e42e2 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -1921,6 +1921,15 @@ public abstract class EntityLiving extends Entity {
|
||||
@@ -1921,6 +1921,23 @@ public abstract class EntityLiving extends Entity {
|
||||
((EntityPlayer) damagesource.getEntity()).a(StatisticList.DAMAGE_DEALT_ABSORBED, Math.round(f2 * 10.0F));
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ if (damagesource.getEntity() instanceof EntityHuman && damagesource.getEntity().world.purpurConfig.creativeOnePunch) {
|
||||
+ if (damagesource.getEntity().world.purpurConfig.creativeOnePunch && damagesource.getEntity() instanceof EntityHuman) {
|
||||
+ EntityHuman entityHuman = (EntityHuman) damagesource.getEntity();
|
||||
+ if (entityHuman.getItemInMainHand().getItem() == Items.AIR && entityHuman.isCreative()) {
|
||||
+ this.setHealth(0);
|
||||
+ if (entityHuman.isCreative()) {
|
||||
+ double attackDamage = 0;
|
||||
+
|
||||
+ for (AttributeModifier modifier : entityHuman.getItemInMainHand().getAttributeModifiers(EnumItemSlot.MAINHAND).get(GenericAttributes.ATTACK_DAMAGE)) {
|
||||
+ attackDamage += modifier.getAmount();
|
||||
+ }
|
||||
+
|
||||
+ if (attackDamage == 0) {
|
||||
+ this.setHealth(0);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end
|
||||
@@ -24,6 +32,18 @@ index 50fa5f8395fea3ba6fa202a5a38519cd55ae00e0..44e4d52653f77fa5075840d873ad1a3a
|
||||
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/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
|
||||
index 3f9062d8eca3ce53c0fb9e9e40330aa4e3296c9a..47e3ac6bcebacd9c424ddcc49774e06e05f02fe2 100644
|
||||
--- a/src/main/java/net/minecraft/server/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/server/ItemStack.java
|
||||
@@ -842,6 +842,7 @@ public final class ItemStack {
|
||||
this.getOrCreateTag().setInt("RepairCost", i);
|
||||
}
|
||||
|
||||
+ public Multimap<AttributeBase, AttributeModifier> getAttributeModifiers(EnumItemSlot enumitemslot) { return this.a(enumitemslot); } // Purpur - OBFHELPER
|
||||
public Multimap<AttributeBase, AttributeModifier> a(EnumItemSlot enumitemslot) {
|
||||
Object object;
|
||||
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 5f14c6c0e62ce5bece342b850e201357314061b2..1e7c75c1f8830b5c2660c2cf8aab0167916ff501 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
|
||||
Reference in New Issue
Block a user