Skip to content

Commit

Permalink
Return unmodifiable set
Browse files Browse the repository at this point in the history
  • Loading branch information
TelepathicGrunt committed Jun 23, 2024
1 parent 4fccefd commit baf8eac
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

package net.neoforged.neoforge.event;

import java.util.List;
import it.unimi.dsi.fastutil.objects.ObjectSortedSet;
import it.unimi.dsi.fastutil.objects.ObjectSortedSets;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.flag.FeatureFlagSet;
import net.minecraft.world.item.CreativeModeTab;
Expand Down Expand Up @@ -65,19 +66,19 @@ public boolean hasPermissions() {
}

/**
* The current immutable list of the parent tab entries in the order to be added to the Creative Menu.
* The current immutable ordered set of the parent tab entries in the order to be added to the Creative Menu.
* Purely for querying to see what in it. Please use the other event methods for modifications.
*/
public List<ItemStack> getParentEntries() {
return this.parentEntries.stream().toList();
public ObjectSortedSet<ItemStack> getParentEntries() {
return ObjectSortedSets.unmodifiable(this.parentEntries);
}

/**
* The current immutable list of the search tab entries in the order to be added to the Creative Menu.
* The current immutable ordered set of the search tab entries in the order to be added to the Creative Menu.
* Purely for querying to see what in it. Please use the other event methods for modifications.
*/
public List<ItemStack> getSearchEntries() {
return this.searchEntries.stream().toList();
public ObjectSortedSet<ItemStack> getSearchEntries() {
return ObjectSortedSets.unmodifiable(this.searchEntries);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package net.neoforged.neoforge.unittest;

import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet;
import it.unimi.dsi.fastutil.objects.ObjectSortedSet;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
Expand Down Expand Up @@ -69,10 +70,10 @@ public class CreativeTabOrderTest {
ItemTags.EQUIPPABLE_ENCHANTABLE,
ItemTags.CROSSBOW_ENCHANTABLE,
ItemTags.VANISHING_ENCHANTABLE);
public static List<ItemStack> ingredientsTab;
public static List<ItemStack> searchTab;
public static List<ItemStack> stoneParentTab;
public static List<ItemStack> stoneSearchTab;
public static ObjectSortedSet<ItemStack> ingredientsTab;
public static ObjectSortedSet<ItemStack> searchTab;
public static ObjectSortedSet<ItemStack> stoneParentTab;
public static ObjectSortedSet<ItemStack> stoneSearchTab;
public static boolean stackCountExceptionForAccept = false;
public static boolean stackCountExceptionForPutAfter = false;
public static boolean stackCountExceptionForPutBefore = false;
Expand Down

0 comments on commit baf8eac

Please sign in to comment.