mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
88 lines
4.2 KiB
Diff
88 lines
4.2 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 7b017806dde98a33b64223f098cc63c286dac02b..eea1053e0ec1446e117d3ac4732deaba191db8f2 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -569,6 +569,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
|
}
|
|
}
|
|
// Paper end - optimise entity tracker
|
|
+ // Purpur start - Add canSaveToDisk to Entity
|
|
+ public boolean canSaveToDisk() {
|
|
+ return true;
|
|
+ }
|
|
+ // Purpur end - Add canSaveToDisk to Entity
|
|
|
|
public Entity(EntityType<?> type, Level world) {
|
|
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
|
|
diff --git a/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java b/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java
|
|
index 8296765d8f63f1a9fd207b27d495d7c04646f134..45e0b9b3653de2dcb51a579f939b991beac03149 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java
|
|
@@ -122,6 +122,12 @@ public class WitherSkull extends AbstractHurtingProjectile {
|
|
return target != this.getRider() && super.canHitEntity(target);
|
|
}
|
|
// Purpur end - Ridables
|
|
+ // Purpur start - Add canSaveToDisk to Entity
|
|
+ @Override
|
|
+ public boolean canSaveToDisk() {
|
|
+ return false;
|
|
+ }
|
|
+ // Purpur end - Add canSaveToDisk to Entity
|
|
|
|
@Override
|
|
protected void defineSynchedData(SynchedEntityData.Builder builder) {
|
|
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 356d010506fd21f3c752e4aa86c46c1106fdde3b..8573d4dbb45db6510d1a4deccb3e5a257504f7d5 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
|
|
@@ -106,6 +106,7 @@ public class EntityStorage implements EntityPersistentStorage<Entity> {
|
|
}
|
|
// Paper end - Entity load/save limit per chunk
|
|
CompoundTag compoundTagx = new CompoundTag();
|
|
+ if (!entity.canSaveToDisk()) return; // Purpur - Add canSaveToDisk to Entity
|
|
if (entity.save(compoundTagx)) {
|
|
listTag.add(compoundTagx);
|
|
}
|
|
diff --git a/src/main/java/org/purpurmc/purpur/entity/DolphinSpit.java b/src/main/java/org/purpurmc/purpur/entity/DolphinSpit.java
|
|
index e33e54fc31ab7dcff054d0ab245d6c3391d06449..477ae2cd8ded25023976e3b7525e0c3b0e8259d9 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/entity/DolphinSpit.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/entity/DolphinSpit.java
|
|
@@ -36,6 +36,13 @@ public class DolphinSpit extends LlamaSpit {
|
|
dolphin.getZ() + (double) (dolphin.getBbWidth() + 1.0F) * 0.5D * (double) Mth.cos(dolphin.yBodyRot * 0.017453292F));
|
|
}
|
|
|
|
+ // Purpur start - Add canSaveToDisk to Entity
|
|
+ @Override
|
|
+ public boolean canSaveToDisk() {
|
|
+ return false;
|
|
+ }
|
|
+ // Purpur end - Add canSaveToDisk to Entity
|
|
+
|
|
public void tick() {
|
|
super_tick();
|
|
|
|
diff --git a/src/main/java/org/purpurmc/purpur/entity/PhantomFlames.java b/src/main/java/org/purpurmc/purpur/entity/PhantomFlames.java
|
|
index 3759e45afe16bf1d8a37b78d3526ee446e63cfe5..f57d77c0cab0174e67c1fdda6ac56f408ad6a902 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/entity/PhantomFlames.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/entity/PhantomFlames.java
|
|
@@ -38,6 +38,13 @@ public class PhantomFlames extends LlamaSpit {
|
|
phantom.getZ() + (double) (phantom.getBbWidth() + 1.0F) * 0.5D * (double) Mth.cos(phantom.yBodyRot * 0.017453292F));
|
|
}
|
|
|
|
+ // Purpur start - Add canSaveToDisk to Entity
|
|
+ @Override
|
|
+ public boolean canSaveToDisk() {
|
|
+ return false;
|
|
+ }
|
|
+ // Purpur end - Add canSaveToDisk to Entity
|
|
+
|
|
public void tick() {
|
|
super_tick();
|
|
|