mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 09:27:43 +01:00
Upstream has released updates that appears to apply and compile correctly Paper Changes: cc477e6a Force Plugins that use delayed tasks for init back in their place 597263fd Don't skip full player connection tick when dead e2c23475 Revert loaded entity list (#3304) fa87db6b Move another NetworkManager util into the inner class (#3303) 841c7d18 Make loaded entity list logic more consistent (#3301) 36f34f01 Updated Upstream (Bukkit/CraftBukkit) 5ca5f131 Rebuild all patches using the new rebuild pattern 1ccff6fa Add villager reputation API 5c0bfffa Speed up rebuilding patches and reduce diff f37381ea Optimize Network Manager to not need synchronization 8f9df2ed Anti Xray cleanup 878c66f1 No-Tick view distance implementation - Closes #3196 b87743c1 Stop copy-on-write operations for updating light data 97a9c972 Optimize isOutsideRange to use distance maps b4e629a2 Use distance map to optimise entity tracker / Misc Utils d80d1517 Optimize Entity Ticking to Loaded Chunks only 31d7686d Add item slot helper methods for various inventories (#3221) 75e1e3b3 Mob Goal API c7bc393a Revert "Don't flush packet queue off main thread" 1abd2bd2 Don't flush packet queue off main thread a4ed58a9 Clean up Direct Memory Region Files Fix for different Java versions 55e35019 Set cap on JDK per-thread native byte buffer cache b5101f4f Cleanup Region Files Direct Memory on close 81e655d7 Optimize Voxel Shape Merging ed9fc11f Sync position on teleportation 9c326fce Nanothing to see here 3e9fc24b Attempt to fix FastLogin maybe
173 lines
8.4 KiB
Diff
173 lines
8.4 KiB
Diff
From 0237527ce0f7c3b8ff3b2e2a513d8ad51484356b 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 option to disable saving projectiles to disk
|
|
|
|
---
|
|
.../net/minecraft/server/ChunkRegionLoader.java | 1 +
|
|
src/main/java/net/minecraft/server/Entity.java | 6 ++++++
|
|
.../java/net/minecraft/server/EntityArrow.java | 7 +++++++
|
|
.../net/minecraft/server/EntityEnderSignal.java | 7 +++++++
|
|
.../net/minecraft/server/EntityFireworks.java | 7 +++++++
|
|
.../net/minecraft/server/EntityLlamaSpit.java | 7 +++++++
|
|
.../net/minecraft/server/EntityProjectile.java | 7 +++++++
|
|
.../java/net/pl3x/purpur/PurpurWorldConfig.java | 16 ++++++++++++++++
|
|
8 files changed, 58 insertions(+)
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
|
index fa893b14b..a60e4ef36 100644
|
|
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
|
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
|
@@ -437,6 +437,7 @@ public class ChunkRegionLoader {
|
|
|
|
while (iterator1.hasNext()) {
|
|
Entity entity = (Entity) iterator1.next();
|
|
+ if (!entity.canSaveToDisk()) continue; // Purpur
|
|
NBTTagCompound nbttagcompound4 = new NBTTagCompound();
|
|
// Paper start
|
|
if (asyncsavedata == null && !entity.dead && (int) Math.floor(entity.locX()) >> 4 != chunk.getPos().x || (int) Math.floor(entity.locZ()) >> 4 != chunk.getPos().z) {
|
|
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
|
index ae119067e..6406e6c5d 100644
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
|
@@ -1587,6 +1587,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
|
|
|
}
|
|
|
|
+ // Purpur start
|
|
+ public boolean canSaveToDisk() {
|
|
+ return true;
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
public boolean c(NBTTagCompound nbttagcompound) {
|
|
String s = this.getSaveID();
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
|
|
index 9c97edf9c..48da1e662 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityArrow.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
|
|
@@ -68,6 +68,13 @@ public abstract class EntityArrow extends Entity implements IProjectile {
|
|
|
|
}
|
|
|
|
+ // Purpur start
|
|
+ @Override
|
|
+ public boolean canSaveToDisk() {
|
|
+ return world != null && world.purpurConfig.saveProjectilesToDisk;
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
public void a(SoundEffect soundeffect) {
|
|
this.av = soundeffect;
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/EntityEnderSignal.java b/src/main/java/net/minecraft/server/EntityEnderSignal.java
|
|
index 7ebd7da1c..74f8257ec 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityEnderSignal.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityEnderSignal.java
|
|
@@ -19,6 +19,13 @@ public class EntityEnderSignal extends Entity {
|
|
this.setPosition(d0, d1, d2);
|
|
}
|
|
|
|
+ // Purpur start
|
|
+ @Override
|
|
+ public boolean canSaveToDisk() {
|
|
+ return world != null && world.purpurConfig.saveProjectilesToDisk;
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
public void b(ItemStack itemstack) {
|
|
if (itemstack.getItem() != Items.ENDER_EYE || itemstack.hasTag()) {
|
|
this.getDataWatcher().set(EntityEnderSignal.b, SystemUtils.a(itemstack.cloneItemStack(), (itemstack1) -> { // Purpur - decompile error
|
|
diff --git a/src/main/java/net/minecraft/server/EntityFireworks.java b/src/main/java/net/minecraft/server/EntityFireworks.java
|
|
index 5c3731f68..ce3168e5d 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityFireworks.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityFireworks.java
|
|
@@ -21,6 +21,13 @@ public class EntityFireworks extends Entity implements IProjectile {
|
|
super(entitytypes, world);
|
|
}
|
|
|
|
+ // Purpur start
|
|
+ @Override
|
|
+ public boolean canSaveToDisk() {
|
|
+ return world != null && world.purpurConfig.saveProjectilesToDisk;
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
// Spigot Start - copied from tick
|
|
@Override
|
|
public void inactiveTick() {
|
|
diff --git a/src/main/java/net/minecraft/server/EntityLlamaSpit.java b/src/main/java/net/minecraft/server/EntityLlamaSpit.java
|
|
index b7a92e100..b95ee50a4 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityLlamaSpit.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityLlamaSpit.java
|
|
@@ -19,6 +19,13 @@ public class EntityLlamaSpit extends Entity implements IProjectile {
|
|
this.setPosition(entityllama.locX() - (double) (entityllama.getWidth() + 1.0F) * 0.5D * (double) MathHelper.sin(entityllama.aI * 0.017453292F), entityllama.getHeadY() - 0.10000000149011612D, entityllama.locZ() + (double) (entityllama.getWidth() + 1.0F) * 0.5D * (double) MathHelper.cos(entityllama.aI * 0.017453292F));
|
|
}
|
|
|
|
+ // Purpur start
|
|
+ @Override
|
|
+ public boolean canSaveToDisk() {
|
|
+ return world != null && world.purpurConfig.saveProjectilesToDisk;
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
@Override
|
|
public void tick() {
|
|
super.tick();
|
|
diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java
|
|
index f5c8074dc..674f2ccc7 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityProjectile.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityProjectile.java
|
|
@@ -35,6 +35,13 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
|
|
this.projectileSource = (org.bukkit.entity.LivingEntity) entityliving.getBukkitEntity(); // CraftBukkit
|
|
}
|
|
|
|
+ // Purpur start
|
|
+ @Override
|
|
+ public boolean canSaveToDisk() {
|
|
+ return world != null && world.purpurConfig.saveProjectilesToDisk;
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
public void a(Entity entity, float f, float f1, float f2, float f3, float f4) {
|
|
float f5 = -MathHelper.sin(f1 * 0.017453292F) * MathHelper.cos(f * 0.017453292F);
|
|
float f6 = -MathHelper.sin((f + f2) * 0.017453292F);
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
index d4b4dfdd3..51585a7d8 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -164,6 +164,7 @@ public class PurpurWorldConfig {
|
|
public boolean playerSleepOnlyWithCondition = false;
|
|
public String playerSleepCondition = "time >= 12541 && time <= 23458";
|
|
public boolean useBetterMending = false;
|
|
+ public boolean saveProjectilesToDisk = true;
|
|
private void gameplayMechanicsSettings() {
|
|
boatEjectPlayersOnLand = getBoolean("gameplay-mechanics.boat.eject-players-on-land", boatEjectPlayersOnLand);
|
|
armorstandStepHeight = (float) getDouble("gameplay-mechanics.armorstand.step-height", armorstandStepHeight);
|
|
@@ -192,6 +193,21 @@ public class PurpurWorldConfig {
|
|
playerSleepOnlyWithCondition = getBoolean("gameplay-mechanics.player.sleep.only-with-condition", playerSleepOnlyWithCondition);
|
|
playerSleepCondition = getString("gameplay-mechanics.player.sleep.condition", playerSleepCondition);
|
|
useBetterMending = getBoolean("gameplay-mechanics.use-better-mending", useBetterMending);
|
|
+ if (PurpurConfig.version < 4) {
|
|
+ Object oldVal = PurpurConfig.config.get("world-settings.default.gameplay-mechanics.saveProjectilesToDisk");
|
|
+ if (oldVal instanceof Boolean) {
|
|
+ PurpurConfig.config.addDefault("world-settings.default.gameplay-mechanics.save-projectiles-to-disk", oldVal);
|
|
+ PurpurConfig.config.set("world-settings.default.gameplay-mechanics.save-projectiles-to-disk", oldVal);
|
|
+ saveProjectilesToDisk = (boolean) oldVal;
|
|
+ }
|
|
+ oldVal = PurpurConfig.config.get("world-settings." + worldName + ".gameplay-mechanics.saveProjectilesToDisk");
|
|
+ if (oldVal instanceof Boolean) {
|
|
+ PurpurConfig.config.set("world-settings." + worldName + ".gameplay-mechanics.save-projectiles-to-disk", oldVal);
|
|
+ saveProjectilesToDisk = (boolean) oldVal;
|
|
+ }
|
|
+ set("gameplay-mechanics.saveProjectilesToDisk", null);
|
|
+ }
|
|
+ saveProjectilesToDisk = getBoolean("gameplay-mechanics.save-projectiles-to-disk", saveProjectilesToDisk);
|
|
}
|
|
|
|
public int elytraDamagePerSecond = 1;
|
|
--
|
|
2.24.0
|
|
|