Fixed some fabric warnings

This commit is contained in:
Frank 2021-09-23 15:20:03 +02:00
parent 791db59c18
commit 8abcab32ec
4 changed files with 18 additions and 11 deletions

View file

@ -2,7 +2,8 @@ package ru.bclib.api;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import net.fabricmc.fabric.api.tag.TagRegistry;
import net.fabricmc.fabric.api.tag.TagFactory;
import net.fabricmc.fabric.impl.tag.extension.TagDelegate;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.packs.resources.ResourceManager;
@ -60,7 +61,8 @@ public class TagAPI {
*/
public static <T> Tag.Named<T> makeTag(Supplier<TagCollection<T>> containerSupplier, ResourceLocation id) {
Tag<T> tag = containerSupplier.get().getTag(id);
return tag == null ? TagRegistry.create(id, containerSupplier) : (Named<T>) tag;
//return tag == null ? TagRegistry.create(id, containerSupplier) : (Named<T>) tag;
return tag == null ? new TagDelegate<>(id, containerSupplier) : (Named<T>) tag;
}
/**
@ -116,7 +118,8 @@ public class TagAPI {
public static Tag.Named<Block> getMCBlockTag(String name) {
ResourceLocation id = new ResourceLocation(name);
Tag<Block> tag = BlockTags.getAllTags().getTag(id);
return tag == null ? (Named<Block>) TagRegistry.block(id) : (Named<Block>) tag;
//return tag == null ? (Named<Block>) TagRegistry.block(id) : (Named<Block>) tag;
return tag == null ? (Named<Block>) TagFactory.BLOCK.create(id): (Named<Block>) tag;
}
/**