mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 17:07:43 +01:00
104 lines
5.0 KiB
Diff
104 lines
5.0 KiB
Diff
From d0d2ae9b7bb99f89e9d17307354d00d8e4dc9426 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
|
|
|
|
---
|
|
.../java/net/minecraft/server/ChunkRegionLoader.java | 1 +
|
|
src/main/java/net/minecraft/server/Entity.java | 6 ++++++
|
|
.../java/net/minecraft/server/EntityEnderSignal.java | 9 ++++++++-
|
|
src/main/java/net/minecraft/server/IProjectile.java | 7 +++++++
|
|
src/main/java/net/pl3x/purpur/PurpurWorldConfig.java | 2 ++
|
|
5 files changed, 24 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
|
index 742c59cb0..2b2471072 100644
|
|
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
|
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
|
@@ -475,6 +475,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 a8706f754..17c591b82 100644
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
|
@@ -311,6 +311,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;
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/EntityEnderSignal.java b/src/main/java/net/minecraft/server/EntityEnderSignal.java
|
|
index 84bf27299..82a5aaf5b 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityEnderSignal.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityEnderSignal.java
|
|
@@ -19,9 +19,16 @@ 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((Object) itemstack.cloneItemStack(), (itemstack1) -> {
|
|
+ this.getDataWatcher().set(EntityEnderSignal.b, SystemUtils.a(itemstack.cloneItemStack(), (itemstack1) -> { // Purpur - decompile error
|
|
itemstack1.setCount(1);
|
|
}));
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/IProjectile.java b/src/main/java/net/minecraft/server/IProjectile.java
|
|
index a961f5d5d..c5d788f22 100644
|
|
--- a/src/main/java/net/minecraft/server/IProjectile.java
|
|
+++ b/src/main/java/net/minecraft/server/IProjectile.java
|
|
@@ -18,6 +18,13 @@ public abstract class IProjectile extends Entity {
|
|
super(entitytypes, world);
|
|
}
|
|
|
|
+ // Purpur start
|
|
+ @Override
|
|
+ public boolean canSaveToDisk() {
|
|
+ return world != null && world.purpurConfig.saveProjectilesToDisk;
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
public void setShooter(@Nullable Entity entity) {
|
|
if (entity != null) {
|
|
this.shooter = entity.getUniqueID();
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
index 86b3cdcdc..571fb0d11 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -113,11 +113,13 @@ public class PurpurWorldConfig {
|
|
public boolean disableDropsOnCrammingDeath = false;
|
|
public boolean entitiesPickUpLootBypassMobGriefing = false;
|
|
public boolean milkCuresBadOmen = true;
|
|
+ public boolean saveProjectilesToDisk = true;
|
|
public double tridentLoyaltyVoidReturnHeight = 0.0D;
|
|
private void miscGameplayMechanicsSettings() {
|
|
disableDropsOnCrammingDeath = getBoolean("gameplay-mechanics.disable-drops-on-cramming-death", disableDropsOnCrammingDeath);
|
|
entitiesPickUpLootBypassMobGriefing = getBoolean("gameplay-mechanics.entities-pick-up-loot-bypass-mob-griefing", entitiesPickUpLootBypassMobGriefing);
|
|
milkCuresBadOmen = getBoolean("gameplay-mechanics.milk-cures-bad-omen", milkCuresBadOmen);
|
|
+ saveProjectilesToDisk = getBoolean("gameplay-mechanics.save-projectiles-to-disk", saveProjectilesToDisk);
|
|
tridentLoyaltyVoidReturnHeight = getDouble("gameplay-mechanics.trident-loyalty-void-return-height", tridentLoyaltyVoidReturnHeight);
|
|
}
|
|
|
|
--
|
|
2.26.2
|
|
|