Make sure TagProvider Interface is processed for items as well
This commit is contained in:
parent
31ea19552d
commit
8100e59baf
1 changed files with 18 additions and 0 deletions
|
@ -8,6 +8,7 @@ import net.minecraft.client.renderer.RenderType;
|
||||||
import net.minecraft.core.Registry;
|
import net.minecraft.core.Registry;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
|
import ru.bclib.BCLib;
|
||||||
import ru.bclib.api.biomes.BiomeAPI;
|
import ru.bclib.api.biomes.BiomeAPI;
|
||||||
import ru.bclib.api.tag.TagAPI;
|
import ru.bclib.api.tag.TagAPI;
|
||||||
import ru.bclib.api.tag.TagAPI.TagLocation;
|
import ru.bclib.api.tag.TagAPI.TagLocation;
|
||||||
|
@ -55,6 +56,11 @@ public class PostInitAPI {
|
||||||
processBlockClient(block);
|
processBlockClient(block);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
Registry.ITEM.forEach(item -> {
|
||||||
|
processItemCommon(item);
|
||||||
|
});
|
||||||
postInitFunctions = null;
|
postInitFunctions = null;
|
||||||
blockTags = null;
|
blockTags = null;
|
||||||
itemTags = null;
|
itemTags = null;
|
||||||
|
@ -77,6 +83,18 @@ public class PostInitAPI {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void processItemCommon(Item item) {
|
||||||
|
if (item instanceof TagProvider provider){
|
||||||
|
try {
|
||||||
|
provider.addTags(null, itemTags);
|
||||||
|
} catch (NullPointerException ex){
|
||||||
|
BCLib.LOGGER.error(item + " probably tried to access blockTags.", ex);
|
||||||
|
}
|
||||||
|
itemTags.forEach(tag -> TagAPI.addItemTag(tag, item));
|
||||||
|
itemTags.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void processBlockCommon(Block block) {
|
private static void processBlockCommon(Block block) {
|
||||||
if (block instanceof PostInitable) {
|
if (block instanceof PostInitable) {
|
||||||
((PostInitable) block).postInit();
|
((PostInitable) block).postInit();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue