fix item hiding although being the only entry in a tag

This commit is contained in:
Relentless 2022-09-16 17:28:58 +02:00
parent 8df653de54
commit b2099a8b58
No known key found for this signature in database
GPG key ID: 759D97B8C6F25265
2 changed files with 4 additions and 5 deletions

View file

@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning].
### Fixed ### Fixed
- a compat issue on Fabric when REI is present - a compat issue on Fabric when REI is present
- items being hidden when they are the only entry in a tag
## [0.0.6] - 2022-09-02 ## [0.0.6] - 2022-09-02

View file

@ -1,7 +1,6 @@
package com.almostreliable.unified.compat; package com.almostreliable.unified.compat;
import com.almostreliable.unified.AlmostUnified; import com.almostreliable.unified.AlmostUnified;
import com.almostreliable.unified.config.Config;
import com.almostreliable.unified.config.UnifyConfig; import com.almostreliable.unified.config.UnifyConfig;
import com.almostreliable.unified.utils.ReplacementMap; import com.almostreliable.unified.utils.ReplacementMap;
import com.almostreliable.unified.utils.TagMap; import com.almostreliable.unified.utils.TagMap;
@ -11,10 +10,7 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import java.util.Collection; import java.util.*;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class HideHelper { public class HideHelper {
@ -26,6 +22,8 @@ public class HideHelper {
return tagMap.getTags().stream().map(unifyTag -> { return tagMap.getTags().stream().map(unifyTag -> {
Collection<ResourceLocation> itemsByTag = tagMap.getItems(unifyTag); Collection<ResourceLocation> itemsByTag = tagMap.getItems(unifyTag);
if (itemsByTag.size() <= 1) return new ArrayList<ItemStack>();
Set<ResourceLocation> replacements = itemsByTag Set<ResourceLocation> replacements = itemsByTag
.stream() .stream()
.map(repMap::getReplacementForItem) .map(repMap::getReplacementForItem)