mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 17:07:43 +01:00
PaperPR - Projectile load/save limit per chunk
- Dropped "Add option to disable saving projectiles to disk" in favor of the above patch - Config migration is automatic. If "gameplay-mechanics.save-projectiles-to-disk" was set to false in purpur.yml, "projectile-load-save-per-chunk-limit" will be set to 0 in paper.yml (resulting in unchanged behaviour)
This commit is contained in:
35
patches/server/0075-Add-canSaveToDisk-to-Entity.patch
Normal file
35
patches/server/0075-Add-canSaveToDisk-to-Entity.patch
Normal file
@@ -0,0 +1,35 @@
|
||||
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/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
||||
index 3628b04fc4..b40cb0c7b2 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
||||
@@ -532,6 +532,7 @@ public class ChunkRegionLoader {
|
||||
|
||||
while (iterator1.hasNext()) {
|
||||
Entity entity = (Entity) iterator1.next();
|
||||
+ if (!entity.canSaveToDisk()) continue; // Purpur
|
||||
if (worldserver.paperConfig.projectileSaveLimit > -1 && (entity instanceof IProjectile || entity instanceof EntityEnderSignal)) {
|
||||
final EntityTypes<?> projectileType = entity.getEntityType();
|
||||
if (savedProjectileCounts.getOrDefault(projectileType, 0) >= worldserver.paperConfig.projectileSaveLimit) {
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index fba2e13aef..e8aaddbe1d 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -308,6 +308,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
this.headHeight = this.getHeadHeight(EntityPose.STANDING, this.size);
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ public boolean canSaveToDisk() {
|
||||
+ return true;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
public boolean isSpectator() {
|
||||
return false;
|
||||
}
|
||||
Reference in New Issue
Block a user