Skip to content

Commit

Permalink
Revert Purpur Fire Immunity API
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreeam-qwq committed Jul 17, 2023
1 parent 9d3682d commit 8db63bc
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 0 deletions.
29 changes: 29 additions & 0 deletions patches/api/0009-Revert-Purpur-Fire-Immunity-API.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
Date: Mon, 17 Jul 2023 07:45:39 +0800
Subject: [PATCH] Revert Purpur Fire Immunity API


diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index af421c1e9ad155e190dc3fe67ed24e96857d9e33..964ec7bd70fcdfcffd51b310cdea84c7c5db6c95 100644
--- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -1002,18 +1002,5 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
* @return True if in daylight
*/
boolean isInDaylight();
-
- /**
- * Checks if the entity is fire immune
- *
- * @return True if fire immune
- */
- boolean isImmuneToFire();
-
- /**
- * Sets if the entity is fire immune
- * Set this to null to restore the entity type default
- */
- void setImmuneToFire(@Nullable Boolean fireImmune);
// Purpur end
}
92 changes: 92 additions & 0 deletions patches/server/0033-Revert-Purpur-Fire-Immunity-API.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
Date: Mon, 17 Jul 2023 07:54:17 +0800
Subject: [PATCH] Revert Purpur Fire Immunity API


diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 18b9a7fe41cffb9ef7e060701621fd4b8726fcfd..980f7165e288bfc03dc78f3d1ef9ba68de1ee4d9 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -419,7 +419,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
private UUID originWorld;
public boolean freezeLocked = false; // Paper - Freeze Tick Lock API
public boolean collidingWithWorldBorder; // Paper
- public @Nullable Boolean immuneToFire = null; // Purpur - Fire immune API
private CompoundTag leavesData = new CompoundTag(); // Leaves - Leaves ex data

public void setOrigin(@javax.annotation.Nonnull Location location) {
@@ -1855,7 +1854,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}

public boolean fireImmune() {
- return this.immuneToFire != null ? immuneToFire : this.getType().fireImmune(); // Purpur - add fire immune API
+ return this.getType().fireImmune();
}

public boolean causeFallDamage(float fallDistance, float damageMultiplier, DamageSource damageSource) {
@@ -2533,11 +2532,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
nbt.putBoolean("Paper.FreezeLock", true);
}
// Paper end
- // Purpur start
- if (immuneToFire != null) {
- nbt.putBoolean("Purpur.FireImmune", immuneToFire);
- }
- // Purpur end
nbt.put("Leaves.Data", leavesData); // Leaves - leaves ex data
return nbt;
} catch (Throwable throwable) {
@@ -2707,11 +2701,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
freezeLocked = nbt.getBoolean("Paper.FreezeLock");
}
// Paper end
- // Purpur start
- if (nbt.contains("Purpur.FireImmune")) {
- immuneToFire = nbt.getBoolean("Purpur.FireImmune");
- }
- // Purpur end
// Leaves start - leaves ex data
if (nbt.contains("Leaves.Data")) {
leavesData = nbt.getCompound("Leaves.Data");
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index edd9fb7154d1082b3fe6d7b6e470f4f4c5459e4b..1445f52031104baf81e2b5373a400a588535b29d 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -218,16 +218,6 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
this.entity = entity;
}

- @Override
- public boolean isImmuneToFire() {
- return getHandle().fireImmune();
- }
-
- @Override
- public void setImmuneToFire(Boolean fireImmune) {
- getHandle().immuneToFire = fireImmune;
- }
-
@Override
public boolean isInDaylight() {
return getHandle().isSunBurnTick();
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
index ea15690da167ec5e653da6f5afb55b33c45d1622..09001578b88658c44d0661d340a0ee0f1ded6911 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
@@ -182,14 +182,9 @@ public class CraftItem extends CraftEntity implements Item {
return item.immuneToExplosion;
}

- @Override
- public void setImmuneToFire(@org.jetbrains.annotations.Nullable Boolean immuneToFire) {
- item.immuneToFire = (immuneToFire != null && immuneToFire);
- }
-
@Override
public void setImmuneToFire(boolean immuneToFire) {
- this.setImmuneToFire((Boolean) immuneToFire);
+ item.immuneToFire = immuneToFire;
}

@Override

0 comments on commit 8db63bc

Please sign in to comment.