mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@a7ae966 readd itemstack data sanitization (#10454) PaperMC/Paper@ca50b87 Clear firework item properly (#10793) PaperMC/Paper@9774a52 fix and cleanup loot table patches (#10100) PaperMC/Paper@ac4ee06 Fix integer overflow for lag compensating eating check (#10797) PaperMC/Paper@6649a17 Fix BlockStateMeta equals (#10795) PaperMC/Paper@1b8cdc6 Extend Player Interact cancellation to cover Jigsaw blocks (#10719) PaperMC/Paper@841ab41 Fix more item desync when an event is cancelled (#10654) PaperMC/Paper@b0e3ca4 Prevent NPE if hooked entity was cleared (#10712) PaperMC/Paper@347bbe3 Fix Cancelling BlockPlaceEvent calling onRemove (#10773)
86 lines
4.0 KiB
Diff
86 lines
4.0 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 e4e240b227fbde9dee03d7a3fa8364e3b129da88..9b653134ad71a6d3ff22dfaa15390e3cd7b4453a 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -557,6 +557,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
|
return false;
|
|
}
|
|
|
|
+ public boolean canSaveToDisk() {
|
|
+ return true;
|
|
+ }
|
|
+
|
|
public final boolean hardCollides() {
|
|
return this.hardCollides;
|
|
}
|
|
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 4117260538e47c978ea31c76f439d43369ebedfb..c753f715710ec4bb8337e035ac5a4c11371a84a0 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java
|
|
@@ -117,6 +117,11 @@ public class WitherSkull extends AbstractHurtingProjectile {
|
|
// do not hit rider
|
|
return target != this.getRider() && super.canHitEntity(target);
|
|
}
|
|
+
|
|
+ @Override
|
|
+ public boolean canSaveToDisk() {
|
|
+ return false;
|
|
+ }
|
|
// Purpur end
|
|
|
|
@Override
|
|
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 bee39dee1b96023c907407877aedf3aafaf5e1b8..5b6bc200381a486c99061f9f5b7121c2c355b477 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
|
|
@@ -107,6 +107,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 - Entity load/save limit per chunk
|
|
entities.forEach((entity) -> { // diff here: use entities parameter
|
|
+ if (!entity.canSaveToDisk()) return; // Purpur
|
|
// Paper start - Entity load/save limit per chunk
|
|
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 89c476c740b4efb4f44c1dcd384b908626d96780..f25abee6dbf99c8d08f8e09db02b41df86115faa 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
|
|
+ @Override
|
|
+ public boolean canSaveToDisk() {
|
|
+ return false;
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
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 c0b7e0eeffdf31b88662232b07944bf3e6fa2148..75e31aee6e706f042398444f272888f9ad0fa3f4 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
|
|
+ @Override
|
|
+ public boolean canSaveToDisk() {
|
|
+ return false;
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
public void tick() {
|
|
super_tick();
|
|
|