Skip to content

Commit

Permalink
Merge pull request #742 from FTBTeam/1.20.1/dev
Browse files Browse the repository at this point in the history
1.20.1/dev
  • Loading branch information
desht authored Jul 4, 2024
2 parents d22566e + 05b9e64 commit c78001d
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2001.4.7]

### Fixed
* Hopefully fixed problem where items matching a filter (Item Filters or FTB Filter System) don't always get displayed correctly in the GUI
* "Hopefully" because this is a tricky one to reproduce...

## [2001.4.6]

### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.RegistryAccess;
import net.minecraft.nbt.StringTag;
import net.minecraft.server.packs.PackType;
import net.minecraft.util.RandomSource;
Expand Down Expand Up @@ -156,8 +155,12 @@ public static void rebuildCreativeTabs() {
}
}

public static Optional<RegistryAccess> registryAccess() {
return Minecraft.getInstance().level == null ? Optional.empty() : Optional.of(Minecraft.getInstance().level.registryAccess());
public static Optional<CreativeModeTab.ItemDisplayParameters> creativeTabDisplayParams() {
LocalPlayer player = Minecraft.getInstance().player;
if (player != null) {
return Optional.of(new CreativeModeTab.ItemDisplayParameters(player.connection.enabledFeatures(), Minecraft.getInstance().options.operatorItemsTab().get(), player.clientLevel.registryAccess()));
}
return Optional.empty();
}

public static void copyToClipboard(QuestObjectBase qo) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import net.minecraft.world.item.ItemStack;

import java.util.Collection;
import java.util.Collections;

public interface RecipeModHelper {
void refreshAll(Components component);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package dev.ftb.mods.ftbquests.integration.item_filtering;

import com.google.common.collect.ImmutableList;
import dev.ftb.mods.ftbquests.FTBQuests;
import dev.ftb.mods.ftbquests.api.ItemFilterAdapter;
import dev.ftb.mods.ftbquests.api.event.CustomFilterDisplayItemsEvent;
import dev.ftb.mods.ftbquests.client.FTBQuestsClient;
import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.flag.FeatureFlags;
import net.minecraft.world.item.CreativeModeTabs;
import net.minecraft.world.item.ItemStack;
import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -36,9 +36,11 @@ public static List<ItemStack> getCachedDisplayStacks(ItemStack filterStack, Item
}

private static List<ItemStack> computeMatchingStacks(ItemFilterAdapter.Matcher matcher) {
if (CreativeModeTabs.searchTab().getSearchTabDisplayItems().isEmpty()) {
FTBQuestsClient.registryAccess().ifPresent(ra -> CreativeModeTabs.tryRebuildTabContents(FeatureFlags.DEFAULT_FLAGS, true, ra));
}
FTBQuestsClient.creativeTabDisplayParams().ifPresent(params -> {
if (CreativeModeTabs.tryRebuildTabContents(params.enabledFeatures(), params.hasPermissions(), params.holders())) {
FTBQuests.LOGGER.debug("creative tabs rebuilt, search tab now has {} items", CreativeModeTabs.searchTab().getSearchTabDisplayItems().size());
}
});

ImmutableList.Builder<ItemStack> builder = ImmutableList.builder();

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mod_id=ftbquests
archives_base_name=ftb-quests
minecraft_version=1.20.1
# Build time
mod_version=2001.4.6
mod_version=2001.4.7
maven_group=dev.ftb.mods
mod_author=FTB Team
# Curse release
Expand Down

0 comments on commit c78001d

Please sign in to comment.