mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-21 23:11:56 +01:00
Move redstone config changes to Eigencraft patch
This commit is contained in:
parent
14d355612e
commit
6084c2a6bd
@ -1835,46 +1835,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||||
piglinsGuardChests = getBoolean("piglins-guard-chests", piglinsGuardChests);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- public boolean useEigencraftRedstone = false;
|
public enum RedstoneImplementation {
|
||||||
- private void useEigencraftRedstone() {
|
- VANILLA, EIGENCRAFT
|
||||||
- useEigencraftRedstone = this.getBoolean("use-faster-eigencraft-redstone", false);
|
|
||||||
- if (useEigencraftRedstone) {
|
|
||||||
- log("Using Eigencraft redstone algorithm by theosib.");
|
|
||||||
+ public enum RedstoneImplementation {
|
|
||||||
+ VANILLA, EIGENCRAFT, ALTERNATE_CURRENT
|
+ VANILLA, EIGENCRAFT, ALTERNATE_CURRENT
|
||||||
+ }
|
}
|
||||||
+ public RedstoneImplementation redstoneImplementation = RedstoneImplementation.VANILLA;
|
public RedstoneImplementation redstoneImplementation = RedstoneImplementation.VANILLA;
|
||||||
+ private void redstoneImplementation() {
|
private void redstoneImplementation() {
|
||||||
+ String implementation;
|
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||||
+ if (PaperConfig.version < 27) {
|
}
|
||||||
+ implementation = "vanilla";
|
switch (implementation) {
|
||||||
+ if (config.contains("world-settings.default.use-faster-eigencraft-redstone")) {
|
default:
|
||||||
+ implementation = config.getBoolean("world-settings.default.use-faster-eigencraft-redstone") ? "eigencraft" : "vanilla";
|
- logError("Invalid redstone-implementation config " + implementation + " - must be one of: vanilla, eigencraft");
|
||||||
+ 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, alternate-current");
|
+ logError("Invalid redstone-implementation config " + implementation + " - must be one of: vanilla, eigencraft, alternate-current");
|
||||||
+ case "vanilla":
|
case "vanilla":
|
||||||
+ redstoneImplementation = RedstoneImplementation.VANILLA;
|
redstoneImplementation = RedstoneImplementation.VANILLA;
|
||||||
+ log("Using the Vanilla redstone implementation.");
|
log("Using the Vanilla redstone implementation.");
|
||||||
+ break;
|
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||||
+ case "eigencraft":
|
redstoneImplementation = RedstoneImplementation.EIGENCRAFT;
|
||||||
+ redstoneImplementation = RedstoneImplementation.EIGENCRAFT;
|
log("Using Eigencraft's redstone implementation by theosib.");
|
||||||
+ log("Using Eigencraft's redstone implementation by theosib.");
|
break;
|
||||||
+ break;
|
|
||||||
+ case "alternate-current":
|
+ case "alternate-current":
|
||||||
+ redstoneImplementation = RedstoneImplementation.ALTERNATE_CURRENT;
|
+ redstoneImplementation = RedstoneImplementation.ALTERNATE_CURRENT;
|
||||||
+ log("Using Alternate Current's redstone implementation by Space Walker.");
|
+ log("Using Alternate Current's redstone implementation by Space Walker.");
|
||||||
@ -2109,21 +2090,13 @@ diff --git a/src/main/java/net/minecraft/world/level/block/PoweredBlock.java b/s
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/PoweredBlock.java
|
--- a/src/main/java/net/minecraft/world/level/block/PoweredBlock.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/PoweredBlock.java
|
+++ b/src/main/java/net/minecraft/world/level/block/PoweredBlock.java
|
||||||
@@ -0,0 +0,0 @@ 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;
|
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ public class PoweredBlock extends Block {
|
@@ -0,0 +0,0 @@ public class PoweredBlock extends Block {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Paper start - optimize redstone (Alternate Current)
|
+ // Paper start - optimize redstone (Alternate Current)
|
||||||
+ @Override
|
+ @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;
|
+ return true;
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
@ -2135,14 +2108,6 @@ diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.jav
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
|
--- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
|
+++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
|
||||||
@@ -0,0 +0,0 @@
|
|
||||||
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;
|
|
||||||
@@ -0,0 +0,0 @@ public class RedStoneWireBlock extends Block {
|
@@ -0,0 +0,0 @@ public class RedStoneWireBlock extends Block {
|
||||||
return floor.isFaceSturdy(world, pos, Direction.UP) || floor.is(Blocks.HOPPER);
|
return floor.isFaceSturdy(world, pos, Direction.UP) || floor.is(Blocks.HOPPER);
|
||||||
}
|
}
|
||||||
@ -2150,51 +2115,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
- // Paper start - Optimize redstone
|
- // Paper start - Optimize redstone
|
||||||
+ // Paper start - Optimize redstone (Eigencraft)
|
+ // Paper start - Optimize redstone (Eigencraft)
|
||||||
// The bulk of the new functionality is found in RedstoneWireTurbo.java
|
// 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);
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ 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;
|
|
||||||
}
|
|
||||||
@@ -0,0 +0,0 @@ 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;
|
|
||||||
@@ -0,0 +0,0 @@ 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();
|
|
||||||
@@ -0,0 +0,0 @@ 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;
|
|
||||||
@@ -0,0 +0,0 @@ public class RedStoneWireBlock extends Block {
|
@@ -0,0 +0,0 @@ public class RedStoneWireBlock extends Block {
|
||||||
@Override
|
@Override
|
||||||
public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {
|
public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {
|
||||||
if (!oldState.is(state.getBlock()) && !world.isClientSide) {
|
if (!oldState.is(state.getBlock()) && !world.isClientSide) {
|
||||||
- this.updateSurroundingRedstone(world, pos, state, null); // Paper - Optimize redstone
|
- this.updateSurroundingRedstone(world, pos, state, null); // Paper - Optimize redstone
|
||||||
+ // Paper start - optimize redstone - replace call to updatePowerStrength
|
+ // 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
|
+ world.getWireHandler().onWireAdded(pos); // Alternate Current
|
||||||
+ } else {
|
+ } else {
|
||||||
+ this.updateSurroundingRedstone(world, pos, state, null); // vanilla/Eigencraft
|
+ this.updateSurroundingRedstone(world, pos, state, null); // vanilla/Eigencraft
|
||||||
@ -2209,7 +2138,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
- this.updateSurroundingRedstone(world, pos, state, null); // Paper - Optimize redstone
|
- this.updateSurroundingRedstone(world, pos, state, null); // Paper - Optimize redstone
|
||||||
+ // Paper start - optimize redstone - replace call to updatePowerStrength
|
+ // 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
|
+ world.getWireHandler().onWireRemoved(pos, state); // Alternate Current
|
||||||
+ } else {
|
+ } else {
|
||||||
+ this.updateSurroundingRedstone(world, pos, state, null); // vanilla/Eigencraft
|
+ this.updateSurroundingRedstone(world, pos, state, null); // vanilla/Eigencraft
|
||||||
@ -2224,7 +2153,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
if (!world.isClientSide) {
|
if (!world.isClientSide) {
|
||||||
+ // Paper start - optimize redstone (Alternate Current)
|
+ // Paper start - optimize redstone (Alternate Current)
|
||||||
+ // Alternate Current handles breaking of redstone wires in the WireHandler.
|
+ // 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);
|
+ world.getWireHandler().onWireUpdated(pos);
|
||||||
+ } else
|
+ } else
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
@ -2315,26 +2244,18 @@ diff --git a/src/main/java/net/minecraft/world/level/block/TrappedChestBlock.jav
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/TrappedChestBlock.java
|
--- a/src/main/java/net/minecraft/world/level/block/TrappedChestBlock.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/TrappedChestBlock.java
|
+++ b/src/main/java/net/minecraft/world/level/block/TrappedChestBlock.java
|
||||||
@@ -0,0 +0,0 @@ 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;
|
|
||||||
@@ -0,0 +0,0 @@ public class TrappedChestBlock extends ChestBlock {
|
@@ -0,0 +0,0 @@ public class TrappedChestBlock extends ChestBlock {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Paper start - optimize redstone (Alternate Current)
|
+ // Paper start - optimize redstone (Alternate Current)
|
||||||
+ @Override
|
+ @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;
|
+ return true;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @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;
|
+ return dir == Direction.UP;
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
@ -2374,7 +2295,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
public abstract class BlockBehaviour {
|
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};
|
- 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;
|
protected final Material material;
|
||||||
public final boolean hasCollision;
|
public final boolean hasCollision;
|
||||||
protected final float explosionResistance;
|
protected final float explosionResistance;
|
||||||
|
@ -17,9 +17,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ piglinsGuardChests = getBoolean("piglins-guard-chests", piglinsGuardChests);
|
+ piglinsGuardChests = getBoolean("piglins-guard-chests", piglinsGuardChests);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
public boolean useEigencraftRedstone = false;
|
public enum RedstoneImplementation {
|
||||||
private void useEigencraftRedstone() {
|
VANILLA, EIGENCRAFT
|
||||||
useEigencraftRedstone = this.getBoolean("use-faster-eigencraft-redstone", false);
|
}
|
||||||
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
|
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
|
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: theosib <millerti@172.16.221.1>
|
From: theosib <millerti@172.16.221.1>
|
||||||
Date: Thu, 27 Sep 2018 01:43:35 -0600
|
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>
|
Author: theosib <millerti@172.16.221.1>
|
||||||
Co-authored-by: egg82 <eggys82@gmail.com>
|
Co-authored-by: egg82 <eggys82@gmail.com>
|
||||||
@ -26,13 +26,37 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
zombiesTargetTurtleEggs = getBoolean("zombies-target-turtle-eggs", zombiesTargetTurtleEggs);
|
zombiesTargetTurtleEggs = getBoolean("zombies-target-turtle-eggs", zombiesTargetTurtleEggs);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ public boolean useEigencraftRedstone = false;
|
+ public enum RedstoneImplementation {
|
||||||
+ private void useEigencraftRedstone() {
|
+ VANILLA, EIGENCRAFT
|
||||||
+ useEigencraftRedstone = this.getBoolean("use-faster-eigencraft-redstone", false);
|
+ }
|
||||||
+ if (useEigencraftRedstone) {
|
+ public RedstoneImplementation redstoneImplementation = RedstoneImplementation.VANILLA;
|
||||||
+ log("Using Eigencraft redstone algorithm by theosib.");
|
+ 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 {
|
+ } 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;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
@ -962,21 +986,13 @@ diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.jav
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
|
--- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
|
+++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
|
||||||
@@ -0,0 +0,0 @@
|
|
||||||
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;
|
|
||||||
@@ -0,0 +0,0 @@ public class RedStoneWireBlock extends Block {
|
@@ -0,0 +0,0 @@ public class RedStoneWireBlock extends Block {
|
||||||
return floor.isFaceSturdy(world, pos, Direction.UP) || floor.is(Blocks.HOPPER);
|
return floor.isFaceSturdy(world, pos, Direction.UP) || floor.is(Blocks.HOPPER);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Paper start - Optimize redstone
|
+ // Paper start - Optimize redstone
|
||||||
+ // The bulk of the new functionality is found in RedstoneWireTurbo.java
|
+ // 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
|
+ * Modified version of pre-existing updateSurroundingRedstone, which is called from
|
||||||
@ -984,7 +1000,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ * Note: Added 'source' argument so as to help determine direction of information flow
|
+ * Note: Added 'source' argument so as to help determine direction of information flow
|
||||||
+ */
|
+ */
|
||||||
+ private void updateSurroundingRedstone(Level worldIn, BlockPos pos, BlockState state, BlockPos source) {
|
+ 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);
|
+ turbo.updateSurroundingRedstone(worldIn, pos, state, source);
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
@ -1008,7 +1024,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ int k = worldIn.getBestNeighborSignal(pos1);
|
+ int k = worldIn.getBestNeighborSignal(pos1);
|
||||||
+ this.shouldSignal = true;
|
+ 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.
|
+ // This code is totally redundant to if statements just below the loop.
|
||||||
+ if (k > 0 && k > j - 1) {
|
+ if (k > 0 && k > j - 1) {
|
||||||
+ j = k;
|
+ j = k;
|
||||||
@ -1022,7 +1038,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ // redstone wire will be set to 'k'. If 'k' is already 15, then nothing inside the
|
+ // 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
|
+ // following loop can affect the power level of the wire. Therefore, the loop is
|
||||||
+ // skipped if k is already 15.
|
+ // 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) {
|
+ for (Direction enumfacing : Direction.Plane.HORIZONTAL) {
|
||||||
+ BlockPos blockpos = pos1.relative(enumfacing);
|
+ BlockPos blockpos = pos1.relative(enumfacing);
|
||||||
+ boolean flag = blockpos.getX() != pos2.getX() || blockpos.getZ() != pos2.getZ();
|
+ boolean flag = blockpos.getX() != pos2.getX() || blockpos.getZ() != pos2.getZ();
|
||||||
@ -1041,7 +1057,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ 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.
|
+ // The old code would decrement the wire value only by 1 at a time.
|
||||||
+ if (l > j) {
|
+ if (l > j) {
|
||||||
+ j = l - 1;
|
+ j = l - 1;
|
Loading…
Reference in New Issue
Block a user