mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 17:07:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: 9a129fa99 Add #getEligibleHumans to SkeletonHorseTrapEvent b5e23c7a6 Fix merging spawning values a932e8ad7 Turn off spigot verbose world by default 8ced89f65 Fix Delegation to vanilla chunk gen
77 lines
4.1 KiB
Diff
77 lines
4.1 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 4d1ac4e6b6..483756316a 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 03dc6ab4b2..66883ea891 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 e957d4f2df..992268620b 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);
|