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)
This commit is contained in:
Ruakij 2021-05-11 11:03:44 +02:00
parent e10eaf9b66
commit 51c9ee0716

View File

@ -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);