mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Fire Immunity API
This commit is contained in:
@@ -30,6 +30,14 @@
|
||||
protected String stringUUID = this.uuid.toString();
|
||||
private boolean hasGlowingTag;
|
||||
private final Set<String> tags = new io.papermc.paper.util.SizeLimitedSet<>(new it.unimi.dsi.fastutil.objects.ObjectOpenHashSet<>(), MAX_ENTITY_TAG_COUNT); // Paper - fully limit tag size - replace set impl
|
||||
@@ -342,6 +_,7 @@
|
||||
public long activatedTick = Integer.MIN_VALUE;
|
||||
public boolean isTemporarilyActive;
|
||||
public long activatedImmunityTick = Integer.MIN_VALUE;
|
||||
+ public @Nullable Boolean immuneToFire = null; // Purpur - Fire immune API
|
||||
|
||||
public void inactiveTick() {
|
||||
}
|
||||
@@ -526,10 +_,20 @@
|
||||
}
|
||||
// Paper end - optimise entity tracker
|
||||
@@ -51,6 +59,15 @@
|
||||
this.position = Vec3.ZERO;
|
||||
this.blockPosition = BlockPos.ZERO;
|
||||
this.chunkPosition = ChunkPos.ZERO;
|
||||
@@ -1830,7 +_,7 @@
|
||||
}
|
||||
|
||||
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 multiplier, DamageSource source) {
|
||||
@@ -1899,7 +_,7 @@
|
||||
return this.isInWater() || flag;
|
||||
}
|
||||
@@ -60,6 +77,34 @@
|
||||
if (this.getVehicle() instanceof AbstractBoat abstractBoat && !abstractBoat.isUnderWater()) {
|
||||
this.wasTouchingWater = false;
|
||||
} else if (this.updateFluidHeightAndDoFluidPushing(FluidTags.WATER, 0.014)) {
|
||||
@@ -2532,6 +_,13 @@
|
||||
compound.putBoolean("Paper.FreezeLock", true);
|
||||
}
|
||||
// Paper end
|
||||
+
|
||||
+ // Purpur start - Fire immune API
|
||||
+ if (immuneToFire != null) {
|
||||
+ compound.putBoolean("Purpur.FireImmune", immuneToFire);
|
||||
+ }
|
||||
+ // Purpur end - Fire immune API
|
||||
+
|
||||
return compound;
|
||||
} catch (Throwable var9) {
|
||||
CrashReport crashReport = CrashReport.forThrowable(var9, "Saving entity NBT");
|
||||
@@ -2681,6 +_,13 @@
|
||||
freezeLocked = compound.getBoolean("Paper.FreezeLock");
|
||||
}
|
||||
// Paper end
|
||||
+
|
||||
+ // Purpur start - Fire immune API
|
||||
+ if (compound.contains("Purpur.FireImmune")) {
|
||||
+ immuneToFire = compound.getBoolean("Purpur.FireImmune");
|
||||
+ }
|
||||
+ // Purpur end - Fire immune API
|
||||
+
|
||||
} catch (Throwable var17) {
|
||||
CrashReport crashReport = CrashReport.forThrowable(var17, "Loading entity NBT");
|
||||
CrashReportCategory crashReportCategory = crashReport.addCategory("Entity being loaded");
|
||||
@@ -2922,6 +_,7 @@
|
||||
if (this.isAlive() && this instanceof Leashable leashable) {
|
||||
if (leashable.getLeashHolder() == player) {
|
||||
|
||||
Reference in New Issue
Block a user