-
-
Notifications
You must be signed in to change notification settings - Fork 479
Expand file tree
/
Copy path0061-Add-canSaveToDisk-to-Entity.patch
More file actions
80 lines (74 loc) · 4.01 KB
/
Copy path0061-Add-canSaveToDisk-to-Entity.patch
File metadata and controls
80 lines (74 loc) · 4.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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 555702ee03b0032f1cced2e63685b6a447216b57..7f1939cd6cd4e64c3085e6b24e1fe3d3719589f5 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4621,5 +4621,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
public boolean processClick(InteractionHand hand) {
return false;
}
+
+ public boolean canSaveToDisk() {
+ return true;
+ }
// Purpur end
}
diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
index cdaefabf24c59338a0406072ce01029c194700fd..80674ee4882d2d1c67f78c6bc627e34a78d0c4b0 100644
--- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
@@ -220,6 +220,11 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
// do not hit rider
return target != rider && super.canHitEntity(target);
}
+
+ @Override
+ public boolean canSaveToDisk() {
+ return false;
+ }
};
skull.setPosRaw(headX, headY, headZ);
level.addFreshEntity(skull);
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 1782d6957fa0290368e443e2e8d7b3c77ac6b8ef..2c9e9d35cd6500aa0ce3b53122067c6a2a15cbf7 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
@@ -112,6 +112,7 @@ public class EntityStorage implements EntityPersistentStorage<Entity> {
ListTag listTag = new ListTag();
final java.util.Map<net.minecraft.world.entity.EntityType<?>, Integer> savedEntityCounts = new java.util.HashMap<>(); // Paper
entities.forEach((entity) -> { // diff here: use entities parameter
+ if (!entity.canSaveToDisk()) return; // Purpur
// Paper start
final EntityType<?> entityType = entity.getType();
final int saveLimit = level.paperConfig().chunks.entityPerChunkSaveLimit.getOrDefault(entityType, -1);
diff --git a/src/main/java/org/purpurmc/purpur/entity/DolphinSpit.java b/src/main/java/org/purpurmc/purpur/entity/DolphinSpit.java
index d55f7611599b2a339293688861100cb8dae9f6c6..5e99789e5156e8ffbf125e77114c547e1f8e7925 100644
--- a/src/main/java/org/purpurmc/purpur/entity/DolphinSpit.java
+++ b/src/main/java/org/purpurmc/purpur/entity/DolphinSpit.java
@@ -35,6 +35,11 @@ public class DolphinSpit extends LlamaSpit {
dolphin.getZ() + (double) (dolphin.getBbWidth() + 1.0F) * 0.5D * (double) Mth.cos(dolphin.yBodyRot * 0.017453292F));
}
+ @Override
+ public boolean canSaveToDisk() {
+ return false;
+ }
+
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 2eca8317e991ec46cc88a4c7d6d8b50152ba4ea7..b6a594cd6b08c687cf51c2f5494297ef96ec4b92 100644
--- a/src/main/java/org/purpurmc/purpur/entity/PhantomFlames.java
+++ b/src/main/java/org/purpurmc/purpur/entity/PhantomFlames.java
@@ -38,6 +38,11 @@ public class PhantomFlames extends LlamaSpit {
phantom.getZ() + (double) (phantom.getBbWidth() + 1.0F) * 0.5D * (double) Mth.cos(phantom.yBodyRot * 0.017453292F));
}
+ @Override
+ public boolean canSaveToDisk() {
+ return false;
+ }
+
public void tick() {
super_tick();