mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-20 20:22:33 +00:00
Fix other datagenerators
This commit is contained in:
1 parent
b7aa7134b8
commit
26103c00ae
5 files changed
+50
-38
No files matched your search
@@ -14,6 +14,9 @@ import net.minecraft.item.DyeColor;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tags.*;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
|
||||
import java.lang.invoke.MethodHandle;
|
||||
|
||||
public class ModTags {
|
||||
public static class Items {
|
||||
@@ -184,10 +187,15 @@ public class ModTags {
|
||||
}
|
||||
|
||||
public static class Entities {
|
||||
public static final ITag.INamedTag<EntityType<?>> SHADED_MESA_BLACKLIST = tag("shaded_mesa_blacklist");
|
||||
public static final ITag.INamedTag<EntityType<?>> SHADED_MESA_BLACKLIST;
|
||||
|
||||
private static ITag.INamedTag<EntityType<?>> tag(String name) {
|
||||
return new EntityTypeTags.Wrapper(new ResourceLocation(LibMisc.MOD_ID, name));
|
||||
static {
|
||||
MethodHandle handle = LibObfuscation.getMethod(EntityTypeTags.class, "func_232896_a_", String.class);
|
||||
try {
|
||||
SHADED_MESA_BLACKLIST = (ITag.INamedTag<EntityType<?>>) handle.invokeExact(LibResources.PREFIX_MOD + "shaded_mesa_blacklist");
|
||||
} catch (Throwable throwable) {
|
||||
throw new RuntimeException(throwable);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,62 +35,63 @@ public class BlockTagProvider extends BlockTagsProvider {
|
||||
protected void registerTags() {
|
||||
Predicate<Block> botania = b -> LibMisc.MOD_ID.equals(Registry.BLOCK.getKey(b).getNamespace());
|
||||
|
||||
getBuilder(BlockTags.RAILS).add(ModBlocks.ghostRail);
|
||||
func_240522_a_(BlockTags.RAILS).func_240532_a_(ModBlocks.ghostRail);
|
||||
|
||||
getBuilder(BlockTags.SLABS).add(registry.stream().filter(botania)
|
||||
func_240522_a_(BlockTags.SLABS).func_240534_a_(registry.stream().filter(botania)
|
||||
.filter(b -> b instanceof SlabBlock)
|
||||
.sorted(Comparator.comparing(Registry.BLOCK::getKey))
|
||||
.toArray(Block[]::new));
|
||||
|
||||
getBuilder(BlockTags.STAIRS).add(registry.stream().filter(botania)
|
||||
func_240522_a_(BlockTags.STAIRS).func_240534_a_(registry.stream().filter(botania)
|
||||
.filter(b -> b instanceof StairsBlock)
|
||||
.sorted(Comparator.comparing(Registry.BLOCK::getKey))
|
||||
.toArray(Block[]::new));
|
||||
|
||||
getBuilder(BlockTags.WALLS).add(registry.stream().filter(botania)
|
||||
func_240522_a_(BlockTags.WALLS).func_240534_a_(registry.stream().filter(botania)
|
||||
.filter(b -> b instanceof WallBlock)
|
||||
.sorted(Comparator.comparing(Registry.BLOCK::getKey))
|
||||
.toArray(Block[]::new));
|
||||
|
||||
getBuilder(BlockTags.FENCES).add(registry.stream().filter(botania)
|
||||
func_240522_a_(BlockTags.FENCES).func_240534_a_(registry.stream().filter(botania)
|
||||
.filter(b -> b instanceof FenceBlock)
|
||||
.sorted(Comparator.comparing(Registry.BLOCK::getKey))
|
||||
.toArray(Block[]::new));
|
||||
|
||||
getBuilder(ModTags.Blocks.MUNDANE_FLOATING_FLOWERS).add(
|
||||
func_240522_a_(ModTags.Blocks.MUNDANE_FLOATING_FLOWERS).func_240534_a_(
|
||||
Arrays.stream(DyeColor.values())
|
||||
.map(ModBlocks::getFloatingFlower)
|
||||
.sorted(Comparator.comparing(Registry.BLOCK::getKey))
|
||||
.toArray(Block[]::new)
|
||||
);
|
||||
|
||||
getBuilder(ModTags.Blocks.SPECIAL_FLOATING_FLOWERS).add(registry.stream().filter(botania)
|
||||
func_240522_a_(ModTags.Blocks.SPECIAL_FLOATING_FLOWERS).func_240534_a_(registry.stream().filter(botania)
|
||||
.filter(b -> b instanceof BlockFloatingSpecialFlower)
|
||||
.sorted(Comparator.comparing(Registry.BLOCK::getKey))
|
||||
.toArray(Block[]::new)
|
||||
);
|
||||
|
||||
getBuilder(ModTags.Blocks.FLOATING_FLOWERS).add(ModTags.Blocks.MUNDANE_FLOATING_FLOWERS, ModTags.Blocks.SPECIAL_FLOATING_FLOWERS);
|
||||
func_240522_a_(ModTags.Blocks.FLOATING_FLOWERS).func_240531_a_(ModTags.Blocks.MUNDANE_FLOATING_FLOWERS)
|
||||
.func_240531_a_(ModTags.Blocks.SPECIAL_FLOATING_FLOWERS);
|
||||
|
||||
getBuilder(ModTags.Blocks.MYSTICAL_FLOWERS).add(
|
||||
func_240522_a_(ModTags.Blocks.MYSTICAL_FLOWERS).func_240534_a_(
|
||||
Arrays.stream(DyeColor.values())
|
||||
.map(ModBlocks::getFlower)
|
||||
.sorted(Comparator.comparing(Registry.BLOCK::getKey))
|
||||
.toArray(Block[]::new)
|
||||
);
|
||||
|
||||
getBuilder(ModTags.Blocks.DOUBLE_MYSTICAL_FLOWERS).add(
|
||||
func_240522_a_(ModTags.Blocks.DOUBLE_MYSTICAL_FLOWERS).func_240534_a_(
|
||||
Arrays.stream(DyeColor.values())
|
||||
.map(ModBlocks::getDoubleFlower)
|
||||
.sorted(Comparator.comparing(Registry.BLOCK::getKey))
|
||||
.toArray(Block[]::new)
|
||||
);
|
||||
|
||||
getBuilder(BlockTags.TALL_FLOWERS).add(ModTags.Blocks.DOUBLE_MYSTICAL_FLOWERS);
|
||||
getBuilder(BlockTags.SMALL_FLOWERS).add(ModTags.Blocks.MYSTICAL_FLOWERS);
|
||||
getBuilder(BlockTags.FLOWERS).add(ModTags.Blocks.SPECIAL_FLOWERS);
|
||||
func_240522_a_(BlockTags.TALL_FLOWERS).func_240531_a_(ModTags.Blocks.DOUBLE_MYSTICAL_FLOWERS);
|
||||
func_240522_a_(BlockTags.SMALL_FLOWERS).func_240531_a_(ModTags.Blocks.MYSTICAL_FLOWERS);
|
||||
func_240522_a_(BlockTags.FLOWERS).func_240531_a_(ModTags.Blocks.SPECIAL_FLOWERS);
|
||||
|
||||
getBuilder(BlockTags.IMPERMEABLE).add(ModBlocks.elfGlass, ModBlocks.manaGlass, ModBlocks.bifrost, ModBlocks.bifrostPerm);
|
||||
func_240522_a_(BlockTags.IMPERMEABLE).func_240534_a_(ModBlocks.elfGlass, ModBlocks.manaGlass, ModBlocks.bifrost, ModBlocks.bifrostPerm);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
@@ -16,8 +16,9 @@ public class DataGenerators {
|
||||
public static void gatherData(GatherDataEvent evt) {
|
||||
if (evt.includeServer()) {
|
||||
evt.getGenerator().addProvider(new BlockLootProvider(evt.getGenerator()));
|
||||
evt.getGenerator().addProvider(new BlockTagProvider(evt.getGenerator()));
|
||||
evt.getGenerator().addProvider(new ItemTagProvider(evt.getGenerator()));
|
||||
BlockTagProvider blockTagProvider = new BlockTagProvider(evt.getGenerator());
|
||||
evt.getGenerator().addProvider(blockTagProvider);
|
||||
evt.getGenerator().addProvider(new ItemTagProvider(evt.getGenerator(), blockTagProvider));
|
||||
evt.getGenerator().addProvider(new StonecuttingProvider(evt.getGenerator()));
|
||||
evt.getGenerator().addProvider(new RecipeProvider(evt.getGenerator()));
|
||||
evt.getGenerator().addProvider(new SmeltingProvider(evt.getGenerator()));
|
||||
|
||||
@@ -10,10 +10,12 @@ package vazkii.botania.data;
|
||||
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.ItemTagsProvider;
|
||||
import net.minecraft.data.TagsProvider;
|
||||
import net.minecraft.item.DyeColor;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.tags.ITag;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.tags.Tag;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
@@ -27,32 +29,32 @@ import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
|
||||
public class ItemTagProvider extends ItemTagsProvider {
|
||||
public ItemTagProvider(DataGenerator generatorIn) {
|
||||
super(generatorIn);
|
||||
public ItemTagProvider(DataGenerator generatorIn, BlockTagProvider blockTagProvider) {
|
||||
super(generatorIn, blockTagProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerTags() {
|
||||
this.copy(BlockTags.RAILS, ItemTags.RAILS);
|
||||
this.copy(BlockTags.SLABS, ItemTags.SLABS);
|
||||
this.copy(BlockTags.STAIRS, ItemTags.STAIRS);
|
||||
this.copy(BlockTags.WALLS, ItemTags.WALLS);
|
||||
this.copy(BlockTags.FENCES, ItemTags.FENCES);
|
||||
this.func_240521_a_(BlockTags.RAILS, ItemTags.RAILS);
|
||||
this.func_240521_a_(BlockTags.SLABS, ItemTags.SLABS);
|
||||
this.func_240521_a_(BlockTags.STAIRS, ItemTags.STAIRS);
|
||||
this.func_240521_a_(BlockTags.WALLS, ItemTags.WALLS);
|
||||
this.func_240521_a_(BlockTags.FENCES, ItemTags.FENCES);
|
||||
|
||||
this.getBuilder(ModTags.Items.SHEARS).add(Items.SHEARS).add(ModItems.elementiumShears).add(ModItems.manasteelShears);
|
||||
this.func_240522_a_(ModTags.Items.SHEARS).func_240534_a_(ModItems.elementiumShears, ModItems.manasteelShears);
|
||||
|
||||
this.copy(ModTags.Blocks.MUNDANE_FLOATING_FLOWERS, ModTags.Items.MUNDANE_FLOATING_FLOWERS);
|
||||
this.copy(ModTags.Blocks.SPECIAL_FLOATING_FLOWERS, ModTags.Items.SPECIAL_FLOATING_FLOWERS);
|
||||
this.copy(ModTags.Blocks.FLOATING_FLOWERS, ModTags.Items.FLOATING_FLOWERS);
|
||||
this.copy(ModTags.Blocks.DOUBLE_MYSTICAL_FLOWERS, ModTags.Items.DOUBLE_MYSTICAL_FLOWERS);
|
||||
this.copy(ModTags.Blocks.MYSTICAL_FLOWERS, ModTags.Items.MYSTICAL_FLOWERS);
|
||||
this.func_240521_a_(ModTags.Blocks.MUNDANE_FLOATING_FLOWERS, ModTags.Items.MUNDANE_FLOATING_FLOWERS);
|
||||
this.func_240521_a_(ModTags.Blocks.SPECIAL_FLOATING_FLOWERS, ModTags.Items.SPECIAL_FLOATING_FLOWERS);
|
||||
this.func_240521_a_(ModTags.Blocks.FLOATING_FLOWERS, ModTags.Items.FLOATING_FLOWERS);
|
||||
this.func_240521_a_(ModTags.Blocks.DOUBLE_MYSTICAL_FLOWERS, ModTags.Items.DOUBLE_MYSTICAL_FLOWERS);
|
||||
this.func_240521_a_(ModTags.Blocks.MYSTICAL_FLOWERS, ModTags.Items.MYSTICAL_FLOWERS);
|
||||
|
||||
this.getBuilder(ItemTags.TALL_FLOWERS).add(ModTags.Items.DOUBLE_MYSTICAL_FLOWERS);
|
||||
this.getBuilder(ItemTags.SMALL_FLOWERS).add(ModTags.Items.MYSTICAL_FLOWERS);
|
||||
this.getBuilder(ItemTags.FLOWERS).add(ModTags.Items.SPECIAL_FLOWERS);
|
||||
this.func_240522_a_(ItemTags.TALL_FLOWERS).func_240531_a_(ModTags.Items.DOUBLE_MYSTICAL_FLOWERS);
|
||||
this.func_240522_a_(ItemTags.SMALL_FLOWERS).func_240531_a_(ModTags.Items.MYSTICAL_FLOWERS);
|
||||
this.func_240522_a_(ItemTags.FLOWERS).func_240531_a_(ModTags.Items.SPECIAL_FLOWERS);
|
||||
|
||||
Tag.Builder<Item> builder = getBuilder(ModTags.Items.DYES);
|
||||
Arrays.stream(DyeColor.values()).map(ModItems::getDye).sorted(Comparator.comparing(Registry.ITEM::getKey)).forEach(builder::add);
|
||||
TagsProvider.Builder<Item> builder = func_240522_a_(ModTags.Items.DYES);
|
||||
Arrays.stream(DyeColor.values()).map(ModItems::getDye).sorted(Comparator.comparing(Registry.ITEM::getKey)).forEach(builder::func_240532_a_);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
@@ -139,7 +139,7 @@ public class PetalProvider extends RecipeProvider {
|
||||
}
|
||||
|
||||
private static Ingredient tagIngr(String tag) {
|
||||
return Ingredient.fromTag(new ItemTags.Wrapper(new ResourceLocation(LibMisc.MOD_ID, tag)));
|
||||
return Ingredient.fromTag(ItemTags.makeWrapperTag(prefix(tag).toString()));
|
||||
}
|
||||
|
||||
private static FinishedRecipe make(IItemProvider item, Ingredient... ingredients) {
|
||||
|
||||
Reference in new issue
Block a user