mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 17:07:43 +01:00
Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@bcf52fe Delete some old patches PaperMC/Paper@348c855 Readd last API patch (with TODO) PaperMC/Paper@b630564 More patches PaperMC/Paper@3cb16c9 Add back per player mob spawning PaperMC/Paper@fe7b741 Another one PaperMC/Paper@12ed021 Update material tags and entity effect PaperMC/Paper@02bca1e Remove timings impl PaperMC/Paper@4d87302 Fix NPE and StackOverflowError for dispensers PaperMC/Paper@f8f230a Remove unnecessary AT PaperMC/Paper@29bf7be Fix unused parameter in PlayerList#remove PaperMC/Paper@9e35192 Execute spark tasks during tick sleep (#11525) PaperMC/Paper@e35f199 Use declaration order for state holder property iteration PaperMC/Paper@6288adb Remove leftover missed timings calls (#11527)
This commit is contained in:
92
patches/server/0263-Fire-Immunity-API.patch
Normal file
92
patches/server/0263-Fire-Immunity-API.patch
Normal file
@@ -0,0 +1,92 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Racci <90304606+DaRacci@users.noreply.github.com>
|
||||
Date: Fri, 4 Feb 2022 16:10:21 +1100
|
||||
Subject: [PATCH] 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 6474b375c05eebc1fa3468f2963770dfff8dec5c..c32803af95324003e803847e7a64735663811e2f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -432,6 +432,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
private UUID originWorld;
|
||||
public boolean freezeLocked = false; // Paper - Freeze Tick Lock API
|
||||
public boolean fixedPose = false; // Paper - Expand Pose API
|
||||
+ public @Nullable Boolean immuneToFire = null; // Purpur - Fire immune API
|
||||
|
||||
public void setOrigin(@javax.annotation.Nonnull Location location) {
|
||||
this.origin = location.toVector();
|
||||
@@ -1992,7 +1993,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
}
|
||||
|
||||
public boolean fireImmune() {
|
||||
- return this.getType().fireImmune();
|
||||
+ return this.immuneToFire != null ? immuneToFire : this.getType().fireImmune(); // Purpur - add fire immune API
|
||||
}
|
||||
|
||||
public boolean causeFallDamage(float fallDistance, float damageMultiplier, DamageSource damageSource) {
|
||||
@@ -2747,6 +2748,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
nbttagcompound.putBoolean("Paper.FreezeLock", true);
|
||||
}
|
||||
// Paper end
|
||||
+ // Purpur start
|
||||
+ if (immuneToFire != null) {
|
||||
+ nbttagcompound.putBoolean("Purpur.FireImmune", immuneToFire);
|
||||
+ }
|
||||
+ // Purpur end
|
||||
return nbttagcompound;
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
|
||||
@@ -2895,6 +2901,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
freezeLocked = nbt.getBoolean("Paper.FreezeLock");
|
||||
}
|
||||
// Paper end
|
||||
+ // Purpur start
|
||||
+ if (nbt.contains("Purpur.FireImmune")) {
|
||||
+ immuneToFire = nbt.getBoolean("Purpur.FireImmune");
|
||||
+ }
|
||||
+ // Purpur end
|
||||
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index b5885d16cd3371d34bd031bd00a22a0ba6db6509..cc7d5aeb2044019aabad93dd79a16178c7483037 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -88,6 +88,16 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
}
|
||||
|
||||
// Purpur start - API for any mob to burn daylight
|
||||
+ @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 01e4395f1669d21c30465aa1366bd2f1ae17678f..5c1cda88080850314dac196dbe71ff12e48a8aca 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
|
||||
@@ -173,9 +173,14 @@ public class CraftItem extends CraftEntity implements Item {
|
||||
return this.getHandle().immuneToExplosion;
|
||||
}
|
||||
|
||||
+ @Override
|
||||
+ public void setImmuneToFire(@org.jetbrains.annotations.Nullable Boolean immuneToFire) {
|
||||
+ this.getHandle().immuneToFire = (immuneToFire != null && immuneToFire);
|
||||
+ }
|
||||
+
|
||||
@Override
|
||||
public void setImmuneToFire(boolean immuneToFire) {
|
||||
- item.immuneToFire = immuneToFire;
|
||||
+ this.setImmuneToFire((Boolean) immuneToFire);
|
||||
}
|
||||
|
||||
@Override
|
||||
Reference in New Issue
Block a user