Fix dupe with Eigencraft redstone implementation (#2864)

This commit is contained in:
Mark Vainomaa 2020-01-17 04:07:50 +02:00 committed by Zach
parent 5dc6bd450e
commit 701114058c

View File

@ -1,4 +1,4 @@
From 9382064df0fb23829f26cfa668d948625c046239 Mon Sep 17 00:00:00 2001
From 7300336b4ea331e4d37eabd94f391e90cdd03804 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
@ -39,10 +39,10 @@ index dd5e263d7..357c7cf1d 100644
}
diff --git a/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java b/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java
new file mode 100644
index 000000000..cf5661f1c
index 000000000..b69803cbf
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java
@@ -0,0 +1,912 @@
@@ -0,0 +1,915 @@
+package com.destroystokyo.paper.util;
+
+import java.util.List;
@ -938,8 +938,11 @@ index 000000000..cf5661f1c
+ // and set it in the world.
+ // Possible optimization: Don't commit state changes to the world until they
+ // need to be known by some nearby non-redstone-wire block.
+ state = state.set(BlockRedstoneWire.POWER, Integer.valueOf(j));
+ worldIn.setTypeAndData(upd.self, state, 2);
+ BlockPosition pos = new BlockPosition(upd.self.getX(), upd.self.getY(), upd.self.getZ());
+ if (wire.canPlace(null, worldIn, pos)) {
+ state = state.set(BlockRedstoneWire.POWER, Integer.valueOf(j));
+ worldIn.setTypeAndData(upd.self, state, 2);
+ }
+ }
+
+ return state;