From 51c9ee0716877d95d730e0ce29b8d450202618fb Mon Sep 17 00:00:00 2001 From: Ruakij Date: Tue, 11 May 2021 11:03:44 +0200 Subject: [PATCH] Fix first placed block having a different list leading to new linked-blocks being out-of-sync (teleport not working and breaking leading to unexpected and undesired states) --- .../linkedBeaconTeleporter/LinkedBeaconTeleporterItem.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/eu/ruekov/ruakij/LinkedBeaconTeleporters/linkedBeaconTeleporter/LinkedBeaconTeleporterItem.java b/src/main/java/eu/ruekov/ruakij/LinkedBeaconTeleporters/linkedBeaconTeleporter/LinkedBeaconTeleporterItem.java index 2bb56d9..2a4808f 100644 --- a/src/main/java/eu/ruekov/ruakij/LinkedBeaconTeleporters/linkedBeaconTeleporter/LinkedBeaconTeleporterItem.java +++ b/src/main/java/eu/ruekov/ruakij/LinkedBeaconTeleporters/linkedBeaconTeleporter/LinkedBeaconTeleporterItem.java @@ -56,6 +56,10 @@ public class LinkedBeaconTeleporterItem extends LinkedBeaconTeleporter { // Block from item LinkedBeaconTeleporterBlock lbtBlock = new LinkedBeaconTeleporterBlock(this.teleporterId(), block); + // Both objects have different lists (as both are new), overwrite block-list with item-list + // FIXME: This seems like a bad design.. maybe only create the list when necessary? (e.g. keep null if no linked objects found) + lbtBlock.linkedBeaconTeleporters = this.linkedBeaconTeleporters; + // Add to list this.linkedBeaconTeleporters.add(lbtBlock);