diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IMultiPart.java b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IMultiPart.java index 8225cd64bb..76d5207029 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IMultiPart.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IMultiPart.java @@ -14,6 +14,7 @@ import net.minecraft.world.level.block.state.BlockState; import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.UnmodifiableView; import java.util.List; import java.util.SortedSet; @@ -43,8 +44,11 @@ default boolean canShared() { boolean isFormed(); /** - * Get all attached controllers + * Get this MultiPart's controllers + * + * @return An Unmodifiable View of the part's controllers */ + @UnmodifiableView SortedSet getControllers(); /** diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/part/MultiblockPartMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/part/MultiblockPartMachine.java index a6b1c3ac16..2e1e9aebe4 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/part/MultiblockPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/part/MultiblockPartMachine.java @@ -17,6 +17,7 @@ import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import it.unimi.dsi.fastutil.objects.ReferenceLinkedOpenHashSet; +import org.jetbrains.annotations.UnmodifiableView; import java.util.Collections; import java.util.List; @@ -78,6 +79,7 @@ public void onControllersUpdated(Set newPositions, Set old) } @Override + @UnmodifiableView public SortedSet getControllers() { // Necessary to rebuild the set of controllers on client-side if (controllers.size() != controllerPositions.size()) {