mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 08:57:44 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: 7232d8f2a EntityLoadCrossbowEvent#shouldConsumeItem 4740bd6c8 Mark PlayerInventory#getItem as nullable bd9ace578 Add a config option to limit the number of entities of each type to load/save in a chunk (#4792) 6bafeb5a9 Move logic from last patch into correct place 9668118fd disable entity ticking flag after watchdog obliteration
77 lines
4.3 KiB
Diff
77 lines
4.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
|
Date: Fri, 7 Aug 2020 12:53:36 -0500
|
|
Subject: [PATCH] Add no-tick block list
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/BlockBase.java b/src/main/java/net/minecraft/server/BlockBase.java
|
|
index 829d4a7508e1656dbdc912096b7eafcf30cbb5b2..6aea156d7c7a9ca8a357aad6a6781d7209c9b8ae 100644
|
|
--- a/src/main/java/net/minecraft/server/BlockBase.java
|
|
+++ b/src/main/java/net/minecraft/server/BlockBase.java
|
|
@@ -617,10 +617,12 @@ public abstract class BlockBase {
|
|
}
|
|
|
|
public void a(WorldServer worldserver, BlockPosition blockposition, Random random) {
|
|
+ if (worldserver.purpurConfig.noTickBlocks.contains(getBlock())) return; // Purpur
|
|
this.getBlock().tickAlways(this.p(), worldserver, blockposition, random);
|
|
}
|
|
|
|
public void b(WorldServer worldserver, BlockPosition blockposition, Random random) {
|
|
+ if (worldserver.purpurConfig.noTickBlocks.contains(getBlock())) return; // Purpur
|
|
this.getBlock().tick(this.p(), worldserver, blockposition, random);
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
|
index 689504bb79de406c783a0fb926ed1366cbd213e1..437ab11826d12d743d74f0161ba796b006632c3c 100644
|
|
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
|
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
|
@@ -321,14 +321,14 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
|
// CraftBukkit end
|
|
if (com.destroystokyo.paper.PaperConfig.useOptimizedTickList) {
|
|
this.nextTickListBlock = new com.destroystokyo.paper.server.ticklist.PaperTickList<>(this, (block) -> {
|
|
- return block == null || block.getBlockData().isAir();
|
|
+ return block == null || block.getBlockData().isAir() || purpurConfig.noTickBlocks.contains(block); // Purpur
|
|
}, IRegistry.BLOCK::getKey, this::b, "Blocks"); // Paper - Timings
|
|
this.nextTickListFluid = new com.destroystokyo.paper.server.ticklist.PaperTickList<>(this, (fluidtype) -> {
|
|
return fluidtype == null || fluidtype == FluidTypes.EMPTY;
|
|
}, IRegistry.FLUID::getKey, this::a, "Fluids"); // Paper - Timings
|
|
} else {
|
|
this.nextTickListBlock = new TickListServer<>(this, (block) -> {
|
|
- return block == null || block.getBlockData().isAir();
|
|
+ return block == null || block.getBlockData().isAir() || purpurConfig.noTickBlocks.contains(block); // Purpur
|
|
}, IRegistry.BLOCK::getKey, this::b, "Blocks"); // Paper - Timings
|
|
this.nextTickListFluid = new TickListServer<>(this, (fluidtype) -> {
|
|
return fluidtype == null || fluidtype == FluidTypes.EMPTY;
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
index 40be126a94a56d2b8a6e8101bff9c74aae563c7d..a9fc19ea44e2a46c1f116632e208c57e54077ad8 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -11,8 +11,10 @@ import org.bukkit.configuration.ConfigurationSection;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
+import java.util.HashSet;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
+import java.util.Set;
|
|
import java.util.logging.Level;
|
|
|
|
import static net.pl3x.purpur.PurpurConfig.log;
|
|
@@ -183,6 +185,16 @@ public class PurpurWorldConfig {
|
|
playerInvulnerableWhileAcceptingResourcePack = getBoolean("gameplay-mechanics.player.invulnerable-while-accepting-resource-pack", playerInvulnerableWhileAcceptingResourcePack);
|
|
}
|
|
|
|
+ public Set<Block> noTickBlocks = new HashSet<>();
|
|
+ private void noTickBlocks() {
|
|
+ getList("blocks.no-tick", new ArrayList<>()).forEach(key -> {
|
|
+ Block block = IRegistry.BLOCK.get(new MinecraftKey(key.toString()));
|
|
+ if (!block.getBlockData().isAir()) {
|
|
+ noTickBlocks.add(block);
|
|
+ }
|
|
+ });
|
|
+ }
|
|
+
|
|
public boolean teleportIfOutsideBorder = false;
|
|
private void teleportIfOutsideBorder() {
|
|
teleportIfOutsideBorder = getBoolean("gameplay-mechanics.player.teleport-if-outside-border", teleportIfOutsideBorder);
|