Preserve relocation structure deduplication

This commit is contained in:
Algent committed 2026-08-03 17:20:41 +02:00
1 parent 45377a81c0
commit ad25d59d47
1 file changed
+8 -1
@@ -280,7 +280,12 @@ class WorldStructs {
false
}
def addStruct(b: BlockStruct) = synchronized {
def addStruct(b: BlockStruct): Unit = synchronized {
var i = 0
while (i < numStructs) {
if (structsArr(i).id == b.id) return
i += 1
}
if (numStructs == structsArr.length) {
val ns = new Array[BlockStruct](structsArr.length * 2)
System.arraycopy(structsArr, 0, ns, 0, numStructs)
@@ -469,6 +474,8 @@ class BlockStruct {
case _ => false
}
override def hashCode() = id
def writeDesc(out: MCDataOutput) {
out.writeFloat(progress.toFloat)
out.writeFloat(speed.toFloat)