Skip to content

Commit

Permalink
Fix potential NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
shedaniel committed Aug 14, 2024
1 parent 02502d5 commit 63cb335
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import me.shedaniel.rei.api.common.display.basic.BasicDisplay;
import me.shedaniel.rei.impl.common.InternalLogger;
import net.minecraft.core.RegistryAccess;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.flag.FeatureFlagSet;
Expand All @@ -37,12 +38,13 @@
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;

public class CreativeModeTabCollectorImpl {
public static Map<CreativeModeTab, Collection<ItemStack>> collectTabs() {
Map<CreativeModeTab, Collection<ItemStack>> map = new LinkedHashMap<>();
FeatureFlagSet featureFlags = FeatureFlags.REGISTRY.allFlags();
CreativeModeTab.ItemDisplayParameters parameters = new CreativeModeTab.ItemDisplayParameters(featureFlags, true, BasicDisplay.registryAccess());
CreativeModeTab.ItemDisplayParameters parameters = new CreativeModeTab.ItemDisplayParameters(featureFlags, true, Objects.requireNonNullElseGet(BasicDisplay.registryAccess(), () -> RegistryAccess.fromRegistryOfRegistries(BuiltInRegistries.REGISTRY)));

for (CreativeModeTab tab : CreativeModeTabs.allTabs()) {
if (tab.getType() != CreativeModeTab.Type.HOTBAR && tab.getType() != CreativeModeTab.Type.INVENTORY) {
Expand Down

0 comments on commit 63cb335

Please sign in to comment.