Move redstone config changes to Eigencraft patch

This commit is contained in:
Nassim Jahnke 2022-05-07 19:52:32 +02:00
parent 7a6163b41d
commit 1a17a83f8a
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
31 changed files with 141 additions and 204 deletions

View File

@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: theosib <millerti@172.16.221.1>
Date: Thu, 27 Sep 2018 01:43:35 -0600
Subject: [PATCH] Optimize redstone algorithm
Subject: [PATCH] Eigencraft redstone implementation
Author: theosib <millerti@172.16.221.1>
Co-authored-by: egg82 <phantom_zero@ymail.com>
@ -19,20 +19,44 @@ Aside from making the obvious class/function renames and obfhelpers I didn't nee
Just added Bukkit's event system and took a few liberties with dead code and comment misspellings.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index d6976656f10707da25e4b4ce51893d2d1bf80f2e..cba7aaed24550eea874f4ae7c37b537548635c43 100644
index d6976656f10707da25e4b4ce51893d2d1bf80f2e..cc54f13a59463dd4b40b0808086fa3c9f2ecf2b3 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -68,6 +68,16 @@ public class PaperWorldConfig {
@@ -68,6 +68,40 @@ public class PaperWorldConfig {
zombiesTargetTurtleEggs = getBoolean("zombies-target-turtle-eggs", zombiesTargetTurtleEggs);
}
+ public boolean useEigencraftRedstone = false;
+ private void useEigencraftRedstone() {
+ useEigencraftRedstone = this.getBoolean("use-faster-eigencraft-redstone", false);
+ if (useEigencraftRedstone) {
+ log("Using Eigencraft redstone algorithm by theosib.");
+ public enum RedstoneImplementation {
+ VANILLA, EIGENCRAFT
+ }
+ public RedstoneImplementation redstoneImplementation = RedstoneImplementation.VANILLA;
+ private void redstoneImplementation() {
+ String implementation;
+ if (PaperConfig.version < 27) {
+ implementation = "vanilla";
+ if (config.contains("world-settings.default.use-faster-eigencraft-redstone")) {
+ implementation = config.getBoolean("world-settings.default.use-faster-eigencraft-redstone") ? "eigencraft" : "vanilla";
+ config.set("world-settings.default.redstone-implementation", implementation);
+ }
+ if (config.contains("world-settings." + worldName + ".use-faster-eigencraft-redstone")) {
+ implementation = config.getBoolean("world-settings." + worldName + ".use-faster-eigencraft-redstone") ? "eigencraft" : "vanilla";
+ config.set("world-settings." + worldName + ".redstone-implementation", implementation);
+ }
+ remove("use-faster-eigencraft-redstone");
+ } else {
+ log("Using vanilla redstone algorithm.");
+ implementation = this.getString("redstone-implementation", "vanilla").toLowerCase().trim();
+ }
+ switch (implementation) {
+ default:
+ logError("Invalid redstone-implementation config " + implementation + " - must be one of: vanilla, eigencraft");
+ case "vanilla":
+ redstoneImplementation = RedstoneImplementation.VANILLA;
+ log("Using the Vanilla redstone implementation.");
+ break;
+ case "eigencraft":
+ redstoneImplementation = RedstoneImplementation.EIGENCRAFT;
+ log("Using Eigencraft's redstone implementation by theosib.");
+ break;
+ }
+ }
+
@ -959,24 +983,16 @@ index 0000000000000000000000000000000000000000..d4273df8124d9d6d4a122f5ecef6f3d0
+ }
+}
diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
index 8472510a4614afd8e292d83aec67115b906b9adb..037330bcb10039c013b2ed5fd68dee16ede20fbe 100644
index 8472510a4614afd8e292d83aec67115b906b9adb..0acc3b550a5bb809fe99708368114eaccb227312 100644
--- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
@@ -1,5 +1,7 @@
package net.minecraft.world.level.block;
+import com.destroystokyo.paper.PaperConfig;
+import com.destroystokyo.paper.util.RedstoneWireTurbo;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
@@ -255,6 +257,121 @@ public class RedStoneWireBlock extends Block {
@@ -255,6 +255,121 @@ public class RedStoneWireBlock extends Block {
return floor.isFaceSturdy(world, pos, Direction.UP) || floor.is(Blocks.HOPPER);
}
+ // Paper start - Optimize redstone
+ // The bulk of the new functionality is found in RedstoneWireTurbo.java
+ RedstoneWireTurbo turbo = new RedstoneWireTurbo(this);
+ com.destroystokyo.paper.util.RedstoneWireTurbo turbo = new com.destroystokyo.paper.util.RedstoneWireTurbo(this);
+
+ /*
+ * Modified version of pre-existing updateSurroundingRedstone, which is called from
@ -984,7 +1000,7 @@ index 8472510a4614afd8e292d83aec67115b906b9adb..037330bcb10039c013b2ed5fd68dee16
+ * Note: Added 'source' argument so as to help determine direction of information flow
+ */
+ private void updateSurroundingRedstone(Level worldIn, BlockPos pos, BlockState state, BlockPos source) {
+ if (worldIn.paperConfig.useEigencraftRedstone) {
+ if (worldIn.paperConfig.redstoneImplementation == com.destroystokyo.paper.PaperWorldConfig.RedstoneImplementation.EIGENCRAFT) {
+ turbo.updateSurroundingRedstone(worldIn, pos, state, source);
+ return;
+ }
@ -1008,7 +1024,7 @@ index 8472510a4614afd8e292d83aec67115b906b9adb..037330bcb10039c013b2ed5fd68dee16
+ int k = worldIn.getBestNeighborSignal(pos1);
+ this.shouldSignal = true;
+
+ if (!worldIn.paperConfig.useEigencraftRedstone) {
+ if (worldIn.paperConfig.redstoneImplementation == com.destroystokyo.paper.PaperWorldConfig.RedstoneImplementation.VANILLA) {
+ // This code is totally redundant to if statements just below the loop.
+ if (k > 0 && k > j - 1) {
+ j = k;
@ -1022,7 +1038,7 @@ index 8472510a4614afd8e292d83aec67115b906b9adb..037330bcb10039c013b2ed5fd68dee16
+ // redstone wire will be set to 'k'. If 'k' is already 15, then nothing inside the
+ // following loop can affect the power level of the wire. Therefore, the loop is
+ // skipped if k is already 15.
+ if (!worldIn.paperConfig.useEigencraftRedstone || k < 15) {
+ if (worldIn.paperConfig.redstoneImplementation == com.destroystokyo.paper.PaperWorldConfig.RedstoneImplementation.VANILLA || k < 15) {
+ for (Direction enumfacing : Direction.Plane.HORIZONTAL) {
+ BlockPos blockpos = pos1.relative(enumfacing);
+ boolean flag = blockpos.getX() != pos2.getX() || blockpos.getZ() != pos2.getZ();
@ -1041,7 +1057,7 @@ index 8472510a4614afd8e292d83aec67115b906b9adb..037330bcb10039c013b2ed5fd68dee16
+ }
+ }
+
+ if (!worldIn.paperConfig.useEigencraftRedstone) {
+ if (worldIn.paperConfig.redstoneImplementation == com.destroystokyo.paper.PaperWorldConfig.RedstoneImplementation.VANILLA) {
+ // The old code would decrement the wire value only by 1 at a time.
+ if (l > j) {
+ j = l - 1;
@ -1092,7 +1108,7 @@ index 8472510a4614afd8e292d83aec67115b906b9adb..037330bcb10039c013b2ed5fd68dee16
private void updatePowerStrength(Level world, BlockPos pos, BlockState state) {
int i = this.calculateTargetStrength(world, pos);
@@ -324,6 +441,7 @@ public class RedStoneWireBlock extends Block {
@@ -324,6 +439,7 @@ public class RedStoneWireBlock extends Block {
return Math.max(i, j - 1);
}
@ -1100,7 +1116,7 @@ index 8472510a4614afd8e292d83aec67115b906b9adb..037330bcb10039c013b2ed5fd68dee16
private int getWireSignal(BlockState state) {
return state.is((Block) this) ? (Integer) state.getValue(RedStoneWireBlock.POWER) : 0;
}
@@ -346,7 +464,7 @@ public class RedStoneWireBlock extends Block {
@@ -346,7 +462,7 @@ public class RedStoneWireBlock extends Block {
@Override
public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {
if (!oldState.is(state.getBlock()) && !world.isClientSide) {
@ -1109,7 +1125,7 @@ index 8472510a4614afd8e292d83aec67115b906b9adb..037330bcb10039c013b2ed5fd68dee16
Iterator iterator = Direction.Plane.VERTICAL.iterator();
while (iterator.hasNext()) {
@@ -373,7 +491,7 @@ public class RedStoneWireBlock extends Block {
@@ -373,7 +489,7 @@ public class RedStoneWireBlock extends Block {
world.updateNeighborsAt(pos.relative(enumdirection), this);
}
@ -1118,7 +1134,7 @@ index 8472510a4614afd8e292d83aec67115b906b9adb..037330bcb10039c013b2ed5fd68dee16
this.updateNeighborsOfNeighboringWires(world, pos);
}
}
@@ -408,7 +526,7 @@ public class RedStoneWireBlock extends Block {
@@ -408,7 +524,7 @@ public class RedStoneWireBlock extends Block {
public void neighborChanged(BlockState state, Level world, BlockPos pos, Block block, BlockPos fromPos, boolean notify) {
if (!world.isClientSide) {
if (state.canSurvive(world, pos)) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Toggle for removing existing dragon
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index cba7aaed24550eea874f4ae7c37b537548635c43..581c13c7d1c423ea6d2ead112c3fb6691b64bc00 100644
index cc54f13a59463dd4b40b0808086fa3c9f2ecf2b3..f0e9a8664e5d36b8adb98a0afd9de9edff7f9e6a 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -78,6 +78,14 @@ public class PaperWorldConfig {
@@ -102,6 +102,14 @@ public class PaperWorldConfig {
}
}

View File

@ -11,10 +11,10 @@ in IWorldServerData are removed as they were only used in certain places, with h
values used in other places.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 581c13c7d1c423ea6d2ead112c3fb6691b64bc00..638a3a70e33d2d817fef07e9a3f7a309aeab1759 100644
index f0e9a8664e5d36b8adb98a0afd9de9edff7f9e6a..789a92e4e2d586e6cd4c71e8ce72429b16141f08 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -86,6 +86,19 @@ public class PaperWorldConfig {
@@ -110,6 +110,19 @@ public class PaperWorldConfig {
}
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Climbing should not bypass cramming gamerule
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 638a3a70e33d2d817fef07e9a3f7a309aeab1759..e2337fa6feb024f9a8a3f5f809cf67113cd41404 100644
index 789a92e4e2d586e6cd4c71e8ce72429b16141f08..7a61a46fdfbd597ed6d76f8142c8159e05eba1d3 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -99,6 +99,11 @@ public class PaperWorldConfig {
@@ -123,6 +123,11 @@ public class PaperWorldConfig {
wanderingTraderSpawnChanceMax = getInt("wandering-trader.spawn-chance-max", wanderingTraderSpawnChanceMax);
}

View File

@ -8,10 +8,10 @@ and curing a villager on repeat by simply resetting the relevant part of
the reputation when it is cured.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index e2337fa6feb024f9a8a3f5f809cf67113cd41404..19ef3c1272fb364355eaac1dcae3ec1f9cc22b44 100644
index 7a61a46fdfbd597ed6d76f8142c8159e05eba1d3..99730237e0e447159282b70a179bc9cb44e538ea 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -104,6 +104,11 @@ public class PaperWorldConfig {
@@ -128,6 +128,11 @@ public class PaperWorldConfig {
fixClimbingBypassingCrammingRule = getBoolean("fix-climbing-bypassing-cramming-rule", fixClimbingBypassingCrammingRule);
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Allow disabling mob spawner spawn egg transformation
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 19ef3c1272fb364355eaac1dcae3ec1f9cc22b44..244a9958430497e5ba05acc06a11ef3073e5e85d 100644
index 99730237e0e447159282b70a179bc9cb44e538ea..163307c9cf8893282375a3dfa81f4c68c7561b3b 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -109,6 +109,11 @@ public class PaperWorldConfig {
@@ -133,6 +133,11 @@ public class PaperWorldConfig {
fixCuringZombieVillagerDiscountExploit = getBoolean("game-mechanics.fix-curing-zombie-villager-discount-exploit", fixCuringZombieVillagerDiscountExploit);
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Added world settings for mobs picking up loot
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 244a9958430497e5ba05acc06a11ef3073e5e85d..034be6700da0a4f929e442714e267db00cc054dc 100644
index 163307c9cf8893282375a3dfa81f4c68c7561b3b..bd28bbab098441bdede682c6b269c1d19a2dd062 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -742,6 +742,14 @@ public class PaperWorldConfig {
@@ -766,6 +766,14 @@ public class PaperWorldConfig {
phantomOnlyAttackInsomniacs = getBoolean("phantoms-only-attack-insomniacs", phantomOnlyAttackInsomniacs);
}

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Configurable door breaking difficulty
Co-authored-by: Doc <nachito94@msn.com>
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 034be6700da0a4f929e442714e267db00cc054dc..81b5b686b108f9f622d0487686348db8b15c0309 100644
index bd28bbab098441bdede682c6b269c1d19a2dd062..082a7d3c7ebaa66e89dbab3ebf7c9b5451e7180b 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -113,6 +113,27 @@ public class PaperWorldConfig {
@@ -137,6 +137,27 @@ public class PaperWorldConfig {
private void disableMobSpawnerSpawnEggTransformation() {
disableMobSpawnerSpawnEggTransformation = getBoolean("game-mechanics.disable-mob-spawner-spawn-egg-transformation", disableMobSpawnerSpawnEggTransformation);
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Collision option for requiring a player participant
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 81b5b686b108f9f622d0487686348db8b15c0309..a799b732715e029e1b7ecae4acd4e283600e107b 100644
index 082a7d3c7ebaa66e89dbab3ebf7c9b5451e7180b..b7ca3eb12ee9dcc2e66b1090addb0934bca01dde 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -86,6 +86,18 @@ public class PaperWorldConfig {
@@ -110,6 +110,18 @@ public class PaperWorldConfig {
}
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Configurable max leash distance
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index a799b732715e029e1b7ecae4acd4e283600e107b..a33bdad2d588268bb0e9e9a1de1eb004d60c26ef 100644
index b7ca3eb12ee9dcc2e66b1090addb0934bca01dde..08a08fed65f3c967384244c4a016692029a4725e 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -308,6 +308,12 @@ public class PaperWorldConfig {
@@ -332,6 +332,12 @@ public class PaperWorldConfig {
}
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add toggle for always placing the dragon egg
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index a33bdad2d588268bb0e9e9a1de1eb004d60c26ef..c5696fcac75cc6d9735faa55f99e25c51e3b7252 100644
index 08a08fed65f3c967384244c4a016692029a4725e..db93028c0acb771976cb38a3e4183441a65dbeb9 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -774,6 +774,11 @@ public class PaperWorldConfig {
@@ -798,6 +798,11 @@ public class PaperWorldConfig {
perPlayerMobSpawns = getBoolean("per-player-mob-spawns", true);
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] added option to disable pathfinding updates on block changes
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index c5696fcac75cc6d9735faa55f99e25c51e3b7252..37ffb33b75c0f2d028d9ba020cc1cd6e5d4ba95c 100644
index db93028c0acb771976cb38a3e4183441a65dbeb9..0e11202faccbb4b0347767dcf60a1461067d1b7c 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -779,6 +779,11 @@ public class PaperWorldConfig {
@@ -803,6 +803,11 @@ public class PaperWorldConfig {
enderDragonsDeathAlwaysPlacesDragonEgg = getBoolean("ender-dragons-death-always-places-dragon-egg", enderDragonsDeathAlwaysPlacesDragonEgg);
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Allow using signs inside spawn protection
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 37ffb33b75c0f2d028d9ba020cc1cd6e5d4ba95c..eb8193f4cd4f9bbc768e676ed16ace95d5a4ca0c 100644
index 0e11202faccbb4b0347767dcf60a1461067d1b7c..6675166be886365f2ef12dfdb4b58a96883e0d7a 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -813,4 +813,9 @@ public class PaperWorldConfig {
@@ -837,4 +837,9 @@ public class PaperWorldConfig {
delayChunkUnloadsBy *= 20;
}
}

View File

@ -9,7 +9,7 @@ defaults are only included for certain entites, this allows setting
limits for any entity type.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index eb8193f4cd4f9bbc768e676ed16ace95d5a4ca0c..17e3a9dd06d652d95ccaad1767c134831ae19c11 100644
index 6675166be886365f2ef12dfdb4b58a96883e0d7a..8de319b60de9b5c0cfcaef6b3d4f17c73ab8e4e6 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -8,6 +8,8 @@ import it.unimi.dsi.fastutil.objects.Reference2IntMap;
@ -21,7 +21,7 @@ index eb8193f4cd4f9bbc768e676ed16ace95d5a4ca0c..17e3a9dd06d652d95ccaad1767c13483
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
import org.spigotmc.SpigotWorldConfig;
@@ -147,6 +149,38 @@ public class PaperWorldConfig {
@@ -171,6 +173,38 @@ public class PaperWorldConfig {
}
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Limit item frame cursors on maps
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 17e3a9dd06d652d95ccaad1767c134831ae19c11..83e56dba01998b2b83405fc831ec80d7054bc158 100644
index 8de319b60de9b5c0cfcaef6b3d4f17c73ab8e4e6..4271920c69e44a522d8360a786651d4e85ce62ff 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -852,4 +852,9 @@ public class PaperWorldConfig {
@@ -876,4 +876,9 @@ public class PaperWorldConfig {
private void allowUsingSignsInsideSpawnProtection() {
allowUsingSignsInsideSpawnProtection = getBoolean("allow-using-signs-inside-spawn-protection", allowUsingSignsInsideSpawnProtection);
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add option to fix items merging through walls
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 83e56dba01998b2b83405fc831ec80d7054bc158..2c4a34f10db9a2297815bad943a1145022abbb4b 100644
index 4271920c69e44a522d8360a786651d4e85ce62ff..6d881cf705cf23bed1896a044548d4ae0a752f57 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -857,4 +857,9 @@ public class PaperWorldConfig {
@@ -881,4 +881,9 @@ public class PaperWorldConfig {
private void mapItemFrameCursorLimit() {
mapItemFrameCursorLimit = getInt("map-item-frame-cursor-limit", mapItemFrameCursorLimit);
}

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Fix invulnerable end crystals
MC-108513
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 2c4a34f10db9a2297815bad943a1145022abbb4b..249da1eed197151926c30e64b11cbe49406bdbb0 100644
index 6d881cf705cf23bed1896a044548d4ae0a752f57..bfd1b59b1bf071c3beedcd6d8db364ed41946033 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -862,4 +862,9 @@ public class PaperWorldConfig {
@@ -886,4 +886,9 @@ public class PaperWorldConfig {
private void fixItemsMergingThroughWalls() {
fixItemsMergingThroughWalls = getBoolean("fix-items-merging-through-walls", fixItemsMergingThroughWalls);
}

View File

@ -6,7 +6,7 @@ Subject: [PATCH] add per world spawn limits
Taken from #2982. Credit to Chasewhip8
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 249da1eed197151926c30e64b11cbe49406bdbb0..d0b17ef93a7f0f1e6171550659532296f44a0306 100644
index bfd1b59b1bf071c3beedcd6d8db364ed41946033..691e5db143801920a34bc623912c24c9024b97b0 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -58,6 +58,11 @@ public class PaperWorldConfig {
@ -21,7 +21,7 @@ index 249da1eed197151926c30e64b11cbe49406bdbb0..d0b17ef93a7f0f1e6171550659532296
}
if (needsSave) {
@@ -690,6 +695,21 @@ public class PaperWorldConfig {
@@ -714,6 +719,21 @@ public class PaperWorldConfig {
zombieVillagerInfectionChance = getDouble("zombie-villager-infection-chance", zombieVillagerInfectionChance);
}

View File

@ -10,10 +10,10 @@ This patch changes sign command logic so that `run_command` click events:
- sends failure messages to the player who clicked the sign
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index d0b17ef93a7f0f1e6171550659532296f44a0306..3d964f3bf92c2bcdb4c7abd02c5d172e27a3d49c 100644
index 691e5db143801920a34bc623912c24c9024b97b0..c8173f49326a9da0a76c98cd82fda2ba6b7be50e 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -887,4 +887,9 @@ public class PaperWorldConfig {
@@ -911,4 +911,9 @@ public class PaperWorldConfig {
private void fixInvulnerableEndCrystalExploit() {
fixInvulnerableEndCrystalExploit = getBoolean("unsupported-settings.fix-invulnerable-end-crystal-exploit", fixInvulnerableEndCrystalExploit);
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add config for mobs immune to default effects
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 3d964f3bf92c2bcdb4c7abd02c5d172e27a3d49c..eab7759ecdfe436aa86d587530508fac2ad6064e 100644
index c8173f49326a9da0a76c98cd82fda2ba6b7be50e..38f1ce3ef637a6b1915409ecab529a84317c5a5e 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -685,6 +685,21 @@ public class PaperWorldConfig {
@@ -709,6 +709,21 @@ public class PaperWorldConfig {
log("Hopper Ignore Container Entities inside Occluding Blocks: " + (hoppersIgnoreOccludingBlocks ? "enabled" : "disabled"));
}

View File

@ -11,10 +11,10 @@ It does not make a lot of sense to damage players if they get crammed,
For those who really want it a config option is provided.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index eab7759ecdfe436aa86d587530508fac2ad6064e..09f2e29db50bdd77458a1ed884c22139141542e0 100644
index 38f1ce3ef637a6b1915409ecab529a84317c5a5e..a8afdd402a0fe90ba73ae7fc60fa335f80cf267b 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -907,4 +907,9 @@ public class PaperWorldConfig {
@@ -931,4 +931,9 @@ public class PaperWorldConfig {
private void showSignClickCommandFailureMessagesToPlayer() {
showSignClickCommandFailureMessagesToPlayer = getBoolean("show-sign-click-command-failure-msgs-to-player", showSignClickCommandFailureMessagesToPlayer);
}

View File

@ -28,7 +28,7 @@ index b47b7dce26805badd422c1867733ff4bfd00e9f4..b27021a42cbed3f0648a8d0903d00d03
* Get a named timer for the specified tile entity type to track type specific timings.
* @param entity
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 09f2e29db50bdd77458a1ed884c22139141542e0..cb5223be0721c599f9940be0c46caa48032f51b8 100644
index a8afdd402a0fe90ba73ae7fc60fa335f80cf267b..96895f4e14924ff23ab1b17d298dd8abf7f2493e 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -9,8 +9,10 @@ import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap;
@ -42,7 +42,7 @@ index 09f2e29db50bdd77458a1ed884c22139141542e0..cb5223be0721c599f9940be0c46caa48
import org.bukkit.configuration.file.YamlConfiguration;
import org.spigotmc.SpigotWorldConfig;
@@ -912,4 +914,57 @@ public class PaperWorldConfig {
@@ -936,4 +938,57 @@ public class PaperWorldConfig {
private void playerCrammingDamage() {
allowPlayerCrammingDamage = getBoolean("allow-player-cramming-damage", allowPlayerCrammingDamage);
}

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Config option for Piglins guarding chests
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index cb5223be0721c599f9940be0c46caa48032f51b8..0564396dd3b47087f18f40a6896cdfb54cae3c7b 100644
index 96895f4e14924ff23ab1b17d298dd8abf7f2493e..48ed38be1eec19a64a03e0d04da22a546672a1ca 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -77,6 +77,11 @@ public class PaperWorldConfig {
@ -17,9 +17,9 @@ index cb5223be0721c599f9940be0c46caa48032f51b8..0564396dd3b47087f18f40a6896cdfb5
+ piglinsGuardChests = getBoolean("piglins-guard-chests", piglinsGuardChests);
+ }
+
public boolean useEigencraftRedstone = false;
private void useEigencraftRedstone() {
useEigencraftRedstone = this.getBoolean("use-faster-eigencraft-redstone", false);
public enum RedstoneImplementation {
VANILLA, EIGENCRAFT
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
index 65480f1ee70a55abbb35a88388d9161e366765a5..57f593e5f797d646ceb70fa61ec2e966cf4dabc1 100644
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Configurable item frame map cursor update interval
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 0564396dd3b47087f18f40a6896cdfb54cae3c7b..998ae8b2e30d08e051a04a7649e5f5a416831166 100644
index 48ed38be1eec19a64a03e0d04da22a546672a1ca..430cb89460c7f13a95a1019b640047e88cd79cfe 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -900,6 +900,11 @@ public class PaperWorldConfig {
@@ -924,6 +924,11 @@ public class PaperWorldConfig {
mapItemFrameCursorLimit = getInt("map-item-frame-cursor-limit", mapItemFrameCursorLimit);
}

View File

@ -10,10 +10,10 @@ chunk bans via the large amount of NBT created by unstacking the items.
Fixes GH-5140 and GH-4748.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 998ae8b2e30d08e051a04a7649e5f5a416831166..01dda989e42da8dd3b76221e9fa2756f78803969 100644
index 430cb89460c7f13a95a1019b640047e88cd79cfe..67016f8b02be8fc874f6c62e1786c0abe3aee741 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -925,6 +925,11 @@ public class PaperWorldConfig {
@@ -949,6 +949,11 @@ public class PaperWorldConfig {
allowPlayerCrammingDamage = getBoolean("allow-player-cramming-damage", allowPlayerCrammingDamage);
}

View File

@ -19,10 +19,10 @@ index ee72086b2dee2bd6415803e77825b2b1cb83cd3d..309dbf5fce3ce940d5e1b57d267b9d6b
}
final Object val = config.get(key);
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 01dda989e42da8dd3b76221e9fa2756f78803969..1c805adcdb9f38d3181bb734228cf6b0b1e290a8 100644
index 67016f8b02be8fc874f6c62e1786c0abe3aee741..d37b43cefeeffdd3bedddb9668fe7e7a4a0de4ab 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -970,6 +970,55 @@ public class PaperWorldConfig {
@@ -994,6 +994,55 @@ public class PaperWorldConfig {
return table;
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Hide unnecessary itemmeta from clients
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 1c805adcdb9f38d3181bb734228cf6b0b1e290a8..11726f1f5ff82fc863fe9597de062fdeb2b313c9 100644
index d37b43cefeeffdd3bedddb9668fe7e7a4a0de4ab..e55124b05c173fdc754f2406ea6edd341bb70fee 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -940,6 +940,13 @@ public class PaperWorldConfig {
@@ -964,6 +964,13 @@ public class PaperWorldConfig {
behaviorTickRates = loadTickRates("behavior");
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Configurable max block light for monster spawning
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 11726f1f5ff82fc863fe9597de062fdeb2b313c9..4448a1348a2483a57762f851cae2a17e516f63be 100644
index e55124b05c173fdc754f2406ea6edd341bb70fee..937d0574f4d1989475345690e800783a84a16602 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -1038,4 +1038,9 @@ public class PaperWorldConfig {
@@ -1062,4 +1062,9 @@ public class PaperWorldConfig {
Integer rate = table.get(columnKey, rowKey);
return rate != null && rate > -1 ? rate : def;
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Make water animal spawn height configurable
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 4448a1348a2483a57762f851cae2a17e516f63be..43091d7f4a5b228b3b0cb586e4267f9bfff938af 100644
index 937d0574f4d1989475345690e800783a84a16602..dcd42cfe2a9ac3e33565340e83ede1bd98ba3814 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -392,6 +392,24 @@ public class PaperWorldConfig {
@@ -416,6 +416,24 @@ public class PaperWorldConfig {
mobSpawnerTickRate = getInt("mob-spawner-tick-rate", 1);
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add configurable height for slime spawn
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 43091d7f4a5b228b3b0cb586e4267f9bfff938af..2d87ebd657db2977b95c2f5707a36a313444b6e4 100644
index dcd42cfe2a9ac3e33565340e83ede1bd98ba3814..20586d7b336d87ae3888b90da3ca39a4df08ed8f 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -430,6 +430,16 @@ public class PaperWorldConfig {
@@ -454,6 +454,16 @@ public class PaperWorldConfig {
allChunksAreSlimeChunks = getBoolean("all-chunks-are-slime-chunks", false);
}

View File

@ -1831,50 +1831,31 @@ index 0000000000000000000000000000000000000000..6b5bffd288e2f815d8c3788e73530e69
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 2d87ebd657db2977b95c2f5707a36a313444b6e4..246cfce07c74f42f8c1efb2b4e2b8ec086d5e58f 100644
index 20586d7b336d87ae3888b90da3ca39a4df08ed8f..246cfce07c74f42f8c1efb2b4e2b8ec086d5e58f 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -82,13 +82,41 @@ public class PaperWorldConfig {
piglinsGuardChests = getBoolean("piglins-guard-chests", piglinsGuardChests);
@@ -83,7 +83,7 @@ public class PaperWorldConfig {
}
- public boolean useEigencraftRedstone = false;
- private void useEigencraftRedstone() {
- useEigencraftRedstone = this.getBoolean("use-faster-eigencraft-redstone", false);
- if (useEigencraftRedstone) {
- log("Using Eigencraft redstone algorithm by theosib.");
+ public enum RedstoneImplementation {
public enum RedstoneImplementation {
- VANILLA, EIGENCRAFT
+ VANILLA, EIGENCRAFT, ALTERNATE_CURRENT
+ }
+ public RedstoneImplementation redstoneImplementation = RedstoneImplementation.VANILLA;
+ private void redstoneImplementation() {
+ String implementation;
+ if (PaperConfig.version < 27) {
+ implementation = "vanilla";
+ if (config.contains("world-settings.default.use-faster-eigencraft-redstone")) {
+ implementation = config.getBoolean("world-settings.default.use-faster-eigencraft-redstone") ? "eigencraft" : "vanilla";
+ config.set("world-settings.default.redstone-implementation", implementation);
+ }
+ if (config.contains("world-settings." + worldName + ".use-faster-eigencraft-redstone")) {
+ implementation = config.getBoolean("world-settings." + worldName + ".use-faster-eigencraft-redstone") ? "eigencraft" : "vanilla";
+ config.set("world-settings." + worldName + ".redstone-implementation", implementation);
+ }
+ remove("use-faster-eigencraft-redstone");
} else {
- log("Using vanilla redstone algorithm.");
+ implementation = this.getString("redstone-implementation", "vanilla").toLowerCase().trim();
+ }
+ switch (implementation) {
+ default:
}
public RedstoneImplementation redstoneImplementation = RedstoneImplementation.VANILLA;
private void redstoneImplementation() {
@@ -104,7 +104,7 @@ public class PaperWorldConfig {
}
switch (implementation) {
default:
- logError("Invalid redstone-implementation config " + implementation + " - must be one of: vanilla, eigencraft");
+ logError("Invalid redstone-implementation config " + implementation + " - must be one of: vanilla, eigencraft, alternate-current");
+ case "vanilla":
+ redstoneImplementation = RedstoneImplementation.VANILLA;
+ log("Using the Vanilla redstone implementation.");
+ break;
+ case "eigencraft":
+ redstoneImplementation = RedstoneImplementation.EIGENCRAFT;
+ log("Using Eigencraft's redstone implementation by theosib.");
+ break;
case "vanilla":
redstoneImplementation = RedstoneImplementation.VANILLA;
log("Using the Vanilla redstone implementation.");
@@ -113,6 +113,10 @@ public class PaperWorldConfig {
redstoneImplementation = RedstoneImplementation.EIGENCRAFT;
log("Using Eigencraft's redstone implementation by theosib.");
break;
+ case "alternate-current":
+ redstoneImplementation = RedstoneImplementation.ALTERNATE_CURRENT;
+ log("Using Alternate Current's redstone implementation by Space Walker.");
@ -2106,24 +2087,16 @@ index 4a34a08a1d46e4d3020644a51d9e30a36a18791a..358a40eb9b4be4d2b5446270f90b5113
public int getDirectSignal(BlockState state, BlockGetter world, BlockPos pos, Direction direction) {
return state.getSignal(world, pos, direction);
diff --git a/src/main/java/net/minecraft/world/level/block/PoweredBlock.java b/src/main/java/net/minecraft/world/level/block/PoweredBlock.java
index 0afffc33f3be221a28c62115f493808aeffb1bd8..def39cd02da68b9be1ecfa5ae70119ef862cd079 100644
index 0afffc33f3be221a28c62115f493808aeffb1bd8..0bd23df47085d578102a28157e309b585f4231f8 100644
--- a/src/main/java/net/minecraft/world/level/block/PoweredBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/PoweredBlock.java
@@ -3,6 +3,7 @@ package net.minecraft.world.level.block;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.level.BlockGetter;
+import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
@@ -16,6 +17,13 @@ public class PoweredBlock extends Block {
@@ -16,6 +16,13 @@ public class PoweredBlock extends Block {
return true;
}
+ // Paper start - optimize redstone (Alternate Current)
+ @Override
+ public boolean isSignalSourceTo(Level level, BlockPos pos, BlockState state, Direction dir) {
+ public boolean isSignalSourceTo(net.minecraft.world.level.Level level, BlockPos pos, BlockState state, Direction dir) {
+ return true;
+ }
+ // Paper end
@ -2132,69 +2105,25 @@ index 0afffc33f3be221a28c62115f493808aeffb1bd8..def39cd02da68b9be1ecfa5ae70119ef
public int getSignal(BlockState state, BlockGetter world, BlockPos pos, Direction direction) {
return 15;
diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
index 037330bcb10039c013b2ed5fd68dee16ede20fbe..dc545de83ef374e70712d5b20beb4b87fef1cf76 100644
index 0acc3b550a5bb809fe99708368114eaccb227312..b2522849d34bbd530c7086b6fbb0582f2d38fef7 100644
--- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
@@ -1,6 +1,7 @@
package net.minecraft.world.level.block;
import com.destroystokyo.paper.PaperConfig;
+import com.destroystokyo.paper.PaperWorldConfig.RedstoneImplementation;
import com.destroystokyo.paper.util.RedstoneWireTurbo;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
@@ -257,7 +258,7 @@ public class RedStoneWireBlock extends Block {
@@ -255,7 +255,7 @@ public class RedStoneWireBlock extends Block {
return floor.isFaceSturdy(world, pos, Direction.UP) || floor.is(Blocks.HOPPER);
}
- // Paper start - Optimize redstone
+ // Paper start - Optimize redstone (Eigencraft)
// The bulk of the new functionality is found in RedstoneWireTurbo.java
RedstoneWireTurbo turbo = new RedstoneWireTurbo(this);
com.destroystokyo.paper.util.RedstoneWireTurbo turbo = new com.destroystokyo.paper.util.RedstoneWireTurbo(this);
@@ -267,7 +268,7 @@ public class RedStoneWireBlock extends Block {
* Note: Added 'source' argument so as to help determine direction of information flow
*/
private void updateSurroundingRedstone(Level worldIn, BlockPos pos, BlockState state, BlockPos source) {
- if (worldIn.paperConfig.useEigencraftRedstone) {
+ if (worldIn.paperConfig.redstoneImplementation == RedstoneImplementation.EIGENCRAFT) {
turbo.updateSurroundingRedstone(worldIn, pos, state, source);
return;
}
@@ -291,7 +292,7 @@ public class RedStoneWireBlock extends Block {
int k = worldIn.getBestNeighborSignal(pos1);
this.shouldSignal = true;
- if (!worldIn.paperConfig.useEigencraftRedstone) {
+ if (worldIn.paperConfig.redstoneImplementation == RedstoneImplementation.VANILLA) {
// This code is totally redundant to if statements just below the loop.
if (k > 0 && k > j - 1) {
j = k;
@@ -305,7 +306,7 @@ public class RedStoneWireBlock extends Block {
// redstone wire will be set to 'k'. If 'k' is already 15, then nothing inside the
// following loop can affect the power level of the wire. Therefore, the loop is
// skipped if k is already 15.
- if (!worldIn.paperConfig.useEigencraftRedstone || k < 15) {
+ if (worldIn.paperConfig.redstoneImplementation == RedstoneImplementation.VANILLA || k < 15) {
for (Direction enumfacing : Direction.Plane.HORIZONTAL) {
BlockPos blockpos = pos1.relative(enumfacing);
boolean flag = blockpos.getX() != pos2.getX() || blockpos.getZ() != pos2.getZ();
@@ -324,7 +325,7 @@ public class RedStoneWireBlock extends Block {
}
}
- if (!worldIn.paperConfig.useEigencraftRedstone) {
+ if (worldIn.paperConfig.redstoneImplementation == RedstoneImplementation.VANILLA) {
// The old code would decrement the wire value only by 1 at a time.
if (l > j) {
j = l - 1;
@@ -464,7 +465,13 @@ public class RedStoneWireBlock extends Block {
@@ -462,7 +462,13 @@ public class RedStoneWireBlock extends Block {
@Override
public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {
if (!oldState.is(state.getBlock()) && !world.isClientSide) {
- this.updateSurroundingRedstone(world, pos, state, null); // Paper - Optimize redstone
+ // Paper start - optimize redstone - replace call to updatePowerStrength
+ if (world.paperConfig.redstoneImplementation == RedstoneImplementation.ALTERNATE_CURRENT) {
+ if (world.paperConfig.redstoneImplementation == com.destroystokyo.paper.PaperWorldConfig.RedstoneImplementation.ALTERNATE_CURRENT) {
+ world.getWireHandler().onWireAdded(pos); // Alternate Current
+ } else {
+ this.updateSurroundingRedstone(world, pos, state, null); // vanilla/Eigencraft
@ -2203,13 +2132,13 @@ index 037330bcb10039c013b2ed5fd68dee16ede20fbe..dc545de83ef374e70712d5b20beb4b87
Iterator iterator = Direction.Plane.VERTICAL.iterator();
while (iterator.hasNext()) {
@@ -491,7 +498,13 @@ public class RedStoneWireBlock extends Block {
@@ -489,7 +495,13 @@ public class RedStoneWireBlock extends Block {
world.updateNeighborsAt(pos.relative(enumdirection), this);
}
- this.updateSurroundingRedstone(world, pos, state, null); // Paper - Optimize redstone
+ // Paper start - optimize redstone - replace call to updatePowerStrength
+ if (world.paperConfig.redstoneImplementation == RedstoneImplementation.ALTERNATE_CURRENT) {
+ if (world.paperConfig.redstoneImplementation == com.destroystokyo.paper.PaperWorldConfig.RedstoneImplementation.ALTERNATE_CURRENT) {
+ world.getWireHandler().onWireRemoved(pos, state); // Alternate Current
+ } else {
+ this.updateSurroundingRedstone(world, pos, state, null); // vanilla/Eigencraft
@ -2218,13 +2147,13 @@ index 037330bcb10039c013b2ed5fd68dee16ede20fbe..dc545de83ef374e70712d5b20beb4b87
this.updateNeighborsOfNeighboringWires(world, pos);
}
}
@@ -525,8 +538,14 @@ public class RedStoneWireBlock extends Block {
@@ -523,8 +535,14 @@ public class RedStoneWireBlock extends Block {
@Override
public void neighborChanged(BlockState state, Level world, BlockPos pos, Block block, BlockPos fromPos, boolean notify) {
if (!world.isClientSide) {
+ // Paper start - optimize redstone (Alternate Current)
+ // Alternate Current handles breaking of redstone wires in the WireHandler.
+ if (world.paperConfig.redstoneImplementation == RedstoneImplementation.ALTERNATE_CURRENT) {
+ if (world.paperConfig.redstoneImplementation == com.destroystokyo.paper.PaperWorldConfig.RedstoneImplementation.ALTERNATE_CURRENT) {
+ world.getWireHandler().onWireUpdated(pos);
+ } else
+ // Paper end
@ -2312,29 +2241,21 @@ index d609c60c1650a5b7f860154e0a4f4c6d84fa63fc..391d64b698871aa420f736a97b7b4b28
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(OUTPUT_POWER);
diff --git a/src/main/java/net/minecraft/world/level/block/TrappedChestBlock.java b/src/main/java/net/minecraft/world/level/block/TrappedChestBlock.java
index 184c70cd2954f4904518c3fee2a377d9c4e81cc3..78a3d810cbb4c0da8c59a9b225e9241945520586 100644
index 184c70cd2954f4904518c3fee2a377d9c4e81cc3..316fd2758a3a981fd1a5e3603a4b7a064270f7fb 100644
--- a/src/main/java/net/minecraft/world/level/block/TrappedChestBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/TrappedChestBlock.java
@@ -7,6 +7,7 @@ import net.minecraft.stats.Stat;
import net.minecraft.stats.Stats;
import net.minecraft.util.Mth;
import net.minecraft.world.level.BlockGetter;
+import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.entity.ChestBlockEntity;
@@ -36,6 +37,18 @@ public class TrappedChestBlock extends ChestBlock {
@@ -36,6 +36,18 @@ public class TrappedChestBlock extends ChestBlock {
return true;
}
+ // Paper start - optimize redstone (Alternate Current)
+ @Override
+ public boolean isSignalSourceTo(Level level, BlockPos pos, BlockState state, Direction dir) {
+ public boolean isSignalSourceTo(net.minecraft.world.level.Level level, BlockPos pos, BlockState state, Direction dir) {
+ return true;
+ }
+
+ @Override
+ public boolean isDirectSignalSourceTo(Level level, BlockPos pos, BlockState state, Direction dir) {
+ public boolean isDirectSignalSourceTo(net.minecraft.world.level.Level level, BlockPos pos, BlockState state, Direction dir) {
+ return dir == Direction.UP;
+ }
+ // Paper end
@ -2366,7 +2287,7 @@ index a4344bf2267112e3c1e31c07c9f6b8eae9666947..5e973eb53b240615e70b7d46ef4dc17b
public BlockState rotate(BlockState state, Rotation rotation) {
return (BlockState) state.setValue(TripWireHookBlock.FACING, rotation.rotate((Direction) state.getValue(TripWireHookBlock.FACING)));
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 61590f2f04a797235299f1bd6b78a08f5bfe4a33..15e1d54cb53bcdf962b799d1deb2cade6491b433 100644
index 61590f2f04a797235299f1bd6b78a08f5bfe4a33..7f83c9390823b42fc30d04e1d3222e2825eaad50 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
@@ -70,7 +70,7 @@ import net.minecraft.world.phys.shapes.VoxelShape;
@ -2374,7 +2295,7 @@ index 61590f2f04a797235299f1bd6b78a08f5bfe4a33..15e1d54cb53bcdf962b799d1deb2cade
public abstract class BlockBehaviour {
- protected static final Direction[] UPDATE_SHAPE_ORDER = new Direction[]{Direction.WEST, Direction.EAST, Direction.NORTH, Direction.SOUTH, Direction.DOWN, Direction.UP};
+ public static final Direction[] UPDATE_SHAPE_ORDER = new Direction[]{Direction.WEST, Direction.EAST, Direction.NORTH, Direction.SOUTH, Direction.DOWN, Direction.UP};
+ public static final Direction[] UPDATE_SHAPE_ORDER = new Direction[]{Direction.WEST, Direction.EAST, Direction.NORTH, Direction.SOUTH, Direction.DOWN, Direction.UP}; // Paper - public
protected final Material material;
public final boolean hasCollision;
protected final float explosionResistance;