Skip to content

Commit

Permalink
unmodifiableview
Browse files Browse the repository at this point in the history
  • Loading branch information
krossgg committed Jan 4, 2025
1 parent b7d765b commit a041c8f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<IMultiController> getControllers();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -78,6 +79,7 @@ public void onControllersUpdated(Set<BlockPos> newPositions, Set<BlockPos> old)
}

@Override
@UnmodifiableView
public SortedSet<IMultiController> getControllers() {
// Necessary to rebuild the set of controllers on client-side
if (controllers.size() != controllerPositions.size()) {
Expand Down

0 comments on commit a041c8f

Please sign in to comment.