mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Upstream has released updates that appears to apply and compile correctly Tuinity Changes: 3b008f5 Optimisations 200f825 Actually unload POI data db64f14 Make sure to despawn entities if they are outside the player general 89276ac Fix villagers aggressively looking at people 8830cef Remove streams for poi searching in some zombie pathfinding a17dc2c Attempt to fix incorrect nearest village distance tracker updating ef8cd34 Fix NPE 3e45700Do not return complex parts for entity by class lookup 2110847 Rewrite getClosestEntity 460581d Fix getClosestEntity not working 2cb36ca Optimise non-flush packet sending 784b838 Some fixes e2dcdd1 Correct return value for ChunkCache#getCubes 968512b Add Velocity natives for encryption and compression (#188) 102d60b Rebuild patches 57fed71 Fix decompression with Velocity natives 442890b Fix decompression with Velocity natives (#191) 0179ea8 Re-Add region manager and notify patch cbffdcc Do not mark entities in unloaded chunks as being in blocks f2eef4a Fixup dev branch patches and store reverted patches in revert folder
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 2760b377d1..334b5e806b 100644
|
|
--- a/src/main/java/net/minecraft/server/BlockBase.java
|
|
+++ b/src/main/java/net/minecraft/server/BlockBase.java
|
|
@@ -576,10 +576,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 0b3a605a2f..51a25349c6 100644
|
|
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
|
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
|
@@ -313,14 +313,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 21b8e004cd..f9df4c5aa3 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;
|
|
@@ -187,6 +189,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);
|