Fixed some fabric warnings
This commit is contained in:
parent
791db59c18
commit
8abcab32ec
4 changed files with 18 additions and 11 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -36,13 +36,14 @@ public class BaseBarrelBlockEntity extends RandomizableContainerBlockEntity {
|
|||
this(BaseBlockEntities.BARREL, blockPos, blockState);
|
||||
}
|
||||
|
||||
public CompoundTag save(CompoundTag tag) {
|
||||
super.save(tag);
|
||||
@Override
|
||||
public void saveAdditional(CompoundTag tag) {
|
||||
super.saveAdditional(tag);
|
||||
if (!this.trySaveLootTable(tag)) {
|
||||
ContainerHelper.saveAllItems(tag, this.inventory);
|
||||
}
|
||||
|
||||
return tag;
|
||||
//return tag;
|
||||
}
|
||||
|
||||
public void load(CompoundTag tag) {
|
||||
|
|
|
@ -54,7 +54,7 @@ public class BaseLeavesBlock extends LeavesBlock implements BlockModelProvider,
|
|||
}
|
||||
|
||||
public BaseLeavesBlock(Block sapling, MaterialColor color, int light) {
|
||||
super(makeLeaves(color).lightLevel(light));
|
||||
super(makeLeaves(color).luminance(light));
|
||||
this.sapling = sapling;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package ru.bclib.integration;
|
||||
|
||||
import net.fabricmc.fabric.api.tag.TagRegistry;
|
||||
import net.fabricmc.fabric.api.tag.TagFactory;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.data.BuiltinRegistries;
|
||||
|
@ -198,12 +198,15 @@ public abstract class ModIntegration {
|
|||
public Tag.Named<Item> getItemTag(String name) {
|
||||
ResourceLocation id = getID(name);
|
||||
Tag<Item> tag = ItemTags.getAllTags().getTag(id);
|
||||
return tag == null ? (Named<Item>) TagRegistry.item(id) : (Named<Item>) tag;
|
||||
|
||||
//return tag == null ? (Named<Item>) TagRegistry.item(id) : (Named<Item>) tag;
|
||||
return tag == null ? (Named<Item>) TagFactory.ITEM.create(id) : (Named<Item>) tag;
|
||||
}
|
||||
|
||||
public Tag.Named<Block> getBlockTag(String name) {
|
||||
ResourceLocation id = getID(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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue