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:26c37d99d5create random seeds for features using SecureRandom589bf2f1bfUpgrade gson to 2.8.8 (Closes #6370)0a6103597bGet entity default attributes (#6449)40057019e0Correctly inflate villager activation bounding box (#6798)e5f9241d15Left handed API (#6775)40ee63496cAdd advancement display API (#6175)9d570042edAdd ItemFactory#getMonsterEgg API (#6772)55ca459515rename method to getSpawnEggbb397ba74cAdd critical damage API (#6275)f47aeafe00Add Horse Animation API (#5599)7a0886180fAT & Mapping fixes (#6809)5553432644docs: Update gradle instructions for Java 16 (#6811) [ci skip]a1f49e4c60Fix command suggestion leak (#6592)9472d38f3cFix method name for Critical damage (#6813)
70 lines
3.9 KiB
Diff
70 lines
3.9 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-random-tick block list
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
index 740b8243b95e46af5ba920f588357c78f4168dbb..d4d6ab96468ba08f6d43b6d07c921118fc150332 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
@@ -482,7 +482,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
this.players = Lists.newArrayList();
|
|
this.entityTickList = new EntityTickList();
|
|
Predicate<Block> predicate = (block) -> { // CraftBukkit - decompile eror
|
|
- return block == null || block.defaultBlockState().isAir();
|
|
+ return block == null || block.defaultBlockState().isAir() || purpurConfig.noRandomTickBlocks.contains(block); // Purpur
|
|
};
|
|
DefaultedRegistry registryblocks = Registry.BLOCK;
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
|
index 3d677fe25ed015e30634bf2fccde29f332e3dd87..e1aba175a74e73db0a8a11e8d2df35c45adfd3fa 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
|
@@ -914,10 +914,12 @@ public abstract class BlockBehaviour {
|
|
}
|
|
|
|
public void tick(ServerLevel world, BlockPos pos, Random random) {
|
|
+ if (world.purpurConfig.noRandomTickBlocks.contains(getBlock())) return; // Purpur
|
|
this.getBlock().tick(this.asState(), world, pos, random);
|
|
}
|
|
|
|
public void randomTick(ServerLevel world, BlockPos pos, Random random) {
|
|
+ if (world.purpurConfig.noRandomTickBlocks.contains(getBlock())) return; // Purpur
|
|
this.getBlock().randomTick(this.asState(), world, pos, random);
|
|
}
|
|
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
index 730abc3bc780ccbd22b9e8c33a2ea894f53f13ee..56b5ddbab362d2c6bd9402211d30e01b94b2e891 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -301,6 +301,28 @@ public class PurpurWorldConfig {
|
|
voidDamageDealt = getDouble("gameplay-mechanics.void-damage-dealt", voidDamageDealt);
|
|
}
|
|
|
|
+ public Set<Block> noRandomTickBlocks = new HashSet<>();
|
|
+ private void noRandomTickBlocks() {
|
|
+ if (PurpurConfig.version < 11) {
|
|
+ List<String> oldList = PurpurConfig.config.getStringList("world-settings." + worldName + ".blocks.no-tick");
|
|
+ if (!oldList.isEmpty()) {
|
|
+ PurpurConfig.config.set("world-settings." + worldName + ".blocks.no-random-tick", oldList);
|
|
+ PurpurConfig.config.set("world-settings." + worldName + ".blocks.no-tick", null);
|
|
+ }
|
|
+ oldList = PurpurConfig.config.getStringList("world-settings.default.blocks.no-tick");
|
|
+ if (!oldList.isEmpty()) {
|
|
+ PurpurConfig.config.set("world-settings.default.blocks.no-random-tick", oldList);
|
|
+ PurpurConfig.config.set("world-settings.default.blocks.no-tick", null);
|
|
+ }
|
|
+ }
|
|
+ getList("blocks.no-random-tick", new ArrayList<>()).forEach(key -> {
|
|
+ Block block = Registry.BLOCK.get(new ResourceLocation(key.toString()));
|
|
+ if (!block.defaultBlockState().isAir()) {
|
|
+ noRandomTickBlocks.add(block);
|
|
+ }
|
|
+ });
|
|
+ }
|
|
+
|
|
public boolean anvilAllowColors = false;
|
|
private void anvilSettings() {
|
|
anvilAllowColors = getBoolean("blocks.anvil.allow-colors", anvilAllowColors);
|