From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: William Blake Galbreath Date: Tue, 18 Feb 2020 20:07:08 -0600 Subject: [PATCH] Add option to disable saving projectiles to disk diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java index c2adc7f52..24a6102b3 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java @@ -489,6 +489,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 d978f2b08..204d9e004 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -306,6 +306,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 08da58677..3ff61434c 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 setItem(ItemStack itemstack) { if (true || itemstack.getItem() != Items.ENDER_EYE || itemstack.hasTag()) { // CraftBukkit - always allow item changing this.getDataWatcher().set(EntityEnderSignal.b, SystemUtils.a(itemstack.cloneItemStack(), (itemstack1) -> { // CraftBukkit - decompile error diff --git a/src/main/java/net/minecraft/server/IProjectile.java b/src/main/java/net/minecraft/server/IProjectile.java index 9f5ce64a6..0bac6b050 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 4c43444cb..839fead62 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); }