Files
Purpur/patches/server/0105-Add-no-tick-block-list.patch
jmp c7b279fe1b Updated Upstream (Paper & Tuinity)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
05af2837c [CI-SKIP] Improved the annotation test output
586966949 abstract custom set tags, add entity tags
c7667378e Added PlayerLoomPatternSelectEvent
00972e80d Reimplement GS4QueryEvent
544c5c278 Re-add coral block tags (#4987)
7d56c8deb Added PlayerLecternPageChangeEvent
c7cdf255b Add BlockFailedDispenseEvent
c8a8d6fbe Added world settings for mobs picking up loot
91eda5bd3 Added ServerResourcesReloadedEvent
be81b4f5c Add a Enchantable MaterialTag
975d18703 Add doors to material tags
d075e748e colorful itemdump
f3ba3dee0 Added WorldGameRuleChangeEvent
086d20118 Guardian beam workaround
b63c890ec Support spawning item stacks
d7d74c552 added height config for bamboo
7878e3bc2 Use setAmount for Recipe Amount
50e70697b Add EntityLoadCrossbowEvent
f344e092c Add Anti-Xray bypass permission
9fd31e675 fix for nerfed slime mobs splitting
4a7962cd1 Zombie API - breaking doors
5650a41f5 Fix interact event not being called in adventure
2c9ed4335 Add PlayerFlowerPotManipulateEvent
1f32290b6 [Auto] Updated Upstream (CraftBukkit)
d87694a20 Redact Velocity forwarding secret properly (#4980)
24a0b0206 [Auto] Updated Upstream (CraftBukkit)
7681042ef [Auto] Updated Upstream (Bukkit/CraftBukkit)
7dea3dba6 [Auto] Updated Upstream (CraftBukkit)
4b3792920 JavaDoc fixes
f13b4727e Allow disabling mob spawner spawn egg transformation
525b50737 Cache burn durations
2c37d1077 Optimized tick ready check
b4000b01a Add API to get the Material of Boats and Minecarts
f1317386d Fix sign lazy initialisation
9f61759d9 Updated Upstream (CraftBukkit/Spigot) (#4972)
aaff430b6 [CI-SKIP] Use GitHub Actions for build status
9f4055d99 Fix harming potion dupe
7bfb781ff Additional Block Material API's
0eaffd008 Micro Optimize DataBits

Tuinity Changes:
9e5cabb6e Port starlight changes
2021-01-04 15:21:27 -08:00

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 5db25b05565be541f07993092ba8e67c32d7cb18..44942f73c98e28821ee9d899733f44f45762b02c 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);