mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 00:47:42 +01:00
33 lines
1.6 KiB
Diff
33 lines
1.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
|
Date: Tue, 18 Feb 2020 20:07:08 -0600
|
|
Subject: [PATCH] Add canSaveToDisk to Entity
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
index 0ca18754b27b8e9dfab9ebf20d1677c66482fb17..3eebc432befec2223e487a6bd48f30d2160feb0a 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -4058,5 +4058,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
|
public boolean processClick(InteractionHand hand) {
|
|
return false;
|
|
}
|
|
+
|
|
+ public boolean canSaveToDisk() {
|
|
+ return true;
|
|
+ }
|
|
// Purpur end
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java
|
|
index 6204c6c9cf2cb620e41105889807f85438bd006c..29f1ae2df9bd792e7d77479432ae48b0d070586b 100644
|
|
--- a/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java
|
|
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java
|
|
@@ -90,6 +90,7 @@ public class EntityStorage implements EntityPersistentStorage<Entity> {
|
|
} else {
|
|
ListTag listTag = new ListTag();
|
|
dataList.getEntities().forEach((entity) -> {
|
|
+ if (!entity.canSaveToDisk()) return; // Purpur
|
|
CompoundTag compoundTag = new CompoundTag();
|
|
if (entity.save(compoundTag)) {
|
|
listTag.add(compoundTag);
|