9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2026-01-04 15:41:40 +00:00
Files
Leaf/patches/server/0029-Leaves-Server-Utils.patch
2024-07-05 02:30:31 +08:00

54 lines
2.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: violetc <58360096+s-yh-china@users.noreply.github.com>
Date: Tue, 13 Sep 2022 16:59:31 +0800
Subject: [PATCH] Leaves: Server Utils
Original license: GPLv3
Original project: https://github.com/LeavesMC/Leaves
Commit: e234432bd99e1c4b07c24d1dd247977226a7516a
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 8ed91095025dd9323d87df9a28c28fc04d8fb306..83ee59ff3d61f65fe354f7429d352929b077f23f 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -435,6 +435,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
public boolean activatedPriorityReset = false; // Pufferfish - DAB
public int activatedPriority = org.dreeam.leaf.config.modules.opt.DynamicActivationofBrain.maximumActivationPrio; // Pufferfish - DAB (golf score)
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) {
this.origin = location.toVector();
@@ -2528,6 +2529,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
nbttagcompound.putBoolean("Purpur.FireImmune", immuneToFire);
}
// Purpur end
+ nbttagcompound.put("Leaves.Data", leavesData); // Leaves - leaves ex data
return nbttagcompound;
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
@@ -2680,6 +2682,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
immuneToFire = nbt.getBoolean("Purpur.FireImmune");
}
// Purpur end
+ // Leaves start - leaves ex data
+ if (nbt.contains("Leaves.Data")) {
+ leavesData = nbt.getCompound("Leaves.Data");
+ }
+ // Leaves end - leaves ex data
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
@@ -5051,4 +5058,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return false;
}
// Purpur end
+
+ // Leaves start - leaves ex data
+ public CompoundTag getLeavesData() {
+ return leavesData;
+ }
+ // Leaves end - leaves ex data
}