mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: 98a702c7d [CI-SKIP] [Auto] Rebuild Patches cab361600 Expose LivingEntity hurt direction 7ef05fbd8 Do not perform neighbour updates when using debug stick (Fixes #2134)
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 4d1ac4e6b61897fc03b091475ef7be3ed0b228a9..483756316a51780da2122b68e73ffc5fc9d87df3 100644
|
|
--- a/src/main/java/net/minecraft/server/BlockBase.java
|
|
+++ b/src/main/java/net/minecraft/server/BlockBase.java
|
|
@@ -655,10 +655,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 e26fc1a6032027d16e72931c8329196b683774ba..9d93a8c86b675cf55210724a0b695f960b009d69 100644
|
|
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
|
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
|
@@ -314,14 +314,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 876a51801f6acdbc062de743106c5a63ed94b13c..4b96afcbf503d91c8dc7551dd8dfe445ffc5712b 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);
|