1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-08-31 09:37:56 +00:00

Change how we access tags to be compatible with dedicated server.

Another oversight in the merge.
This commit is contained in:
Toad-Dev
2021-12-15 16:31:59 -08:00
parent ad0080ef32
commit f74a386312

View File

@@ -5,9 +5,10 @@
*/
package dan200.computercraft.shared.peripheral.generic.data;
import net.minecraft.client.Minecraft;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.enchantment.Enchantment;
import net.minecraft.world.level.block.Block;
@@ -34,14 +35,15 @@ public final class DataHelpers
@Nonnull
static Map<String, Boolean> getTags( @Nonnull Block block )
{
Collection<ResourceLocation> tags = Minecraft.getInstance().getConnection().getTags().getOrEmpty( Registry.BLOCK_REGISTRY ).getMatchingTags( block );
Collection<ResourceLocation> tags = BlockTags.getAllTags().getMatchingTags( block );
return getTags( tags );
}
//TODO fix this
@Nonnull
static Map<String, Boolean> getTags( @Nonnull Item item )
{
Collection<ResourceLocation> tags = Minecraft.getInstance().getConnection().getTags().getOrEmpty( Registry.ITEM_REGISTRY ).getMatchingTags( item );
Collection<ResourceLocation> tags = ItemTags.getAllTags().getMatchingTags( item );
return getTags( tags );
}