Skip to content

Commit

Permalink
Added ice datagen missing from owmii#147
Browse files Browse the repository at this point in the history
Also switched to using new datagen constructors.
  • Loading branch information
BlueAgent committed Feb 13, 2021
1 parent 40d05ca commit 71e90ff
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 6 deletions.
12 changes: 12 additions & 0 deletions src/main/java/owmii/powah/handler/ITags.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@

public class ITags {
public static class Blocks {
// Remove non-dry ice if Forge handles them in the future
public static final Tags.IOptionalNamedTag<Block> ICES = tag("ices");
public static final Tags.IOptionalNamedTag<Block> ICES_ICE = tag("ices/ice");
public static final Tags.IOptionalNamedTag<Block> ICES_PACKED = tag("ices/packed");
public static final Tags.IOptionalNamedTag<Block> ICES_BLUE = tag("ices/blue");
public static final Tags.IOptionalNamedTag<Block> ICES_DRY = tag("ices/dry");
public static final Tags.IOptionalNamedTag<Block> URANINITE_ORE = tag("ores/uraninite");
public static final Tags.IOptionalNamedTag<Block> URANINITE_ORE_POOR = tag("ores/uraninite_poor");
public static final Tags.IOptionalNamedTag<Block> URANINITE_ORE_DENSE = tag("ores/uraninite_dense");
Expand All @@ -20,6 +26,12 @@ private static Tags.IOptionalNamedTag<Block> tag(String name) {
}

public static class Items {
// Remove non-dry ice if Forge handles them in the future
public static final Tags.IOptionalNamedTag<Item> ICES = tag("ices");
public static final Tags.IOptionalNamedTag<Item> ICES_ICE = tag("ices/ice");
public static final Tags.IOptionalNamedTag<Item> ICES_PACKED = tag("ices/packed");
public static final Tags.IOptionalNamedTag<Item> ICES_BLUE = tag("ices/blue");
public static final Tags.IOptionalNamedTag<Item> ICES_DRY = tag("ices/dry");
public static final Tags.IOptionalNamedTag<Item> URANINITE_ORE = tag("ores/uraninite");
public static final Tags.IOptionalNamedTag<Item> URANINITE_ORE_POOR = tag("ores/uraninite_poor");
public static final Tags.IOptionalNamedTag<Item> URANINITE_ORE_DENSE = tag("ores/uraninite_dense");
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/owmii/powah/handler/event/DataEvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.GatherDataEvent;
import owmii.powah.Powah;

@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
public class DataEvents {
@SubscribeEvent
public static void gatherData(GatherDataEvent event) {
DataGenerator generator = event.getGenerator();
TagsProvider.Blocks bp = new TagsProvider.Blocks(generator);
TagsProvider.Blocks bp = new TagsProvider.Blocks(generator, Powah.MOD_ID, event.getExistingFileHelper());
generator.addProvider(bp);
generator.addProvider(new TagsProvider.Items(generator, bp));
generator.addProvider(new TagsProvider.Items(generator, bp, Powah.MOD_ID, event.getExistingFileHelper()));
}
}
25 changes: 21 additions & 4 deletions src/main/java/owmii/powah/handler/event/TagsProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import net.minecraft.data.DataGenerator;
import net.minecraft.data.ItemTagsProvider;
import net.minecraftforge.common.Tags;
import net.minecraftforge.common.data.ExistingFileHelper;
import owmii.powah.block.Blcks;
import owmii.powah.handler.ITags;

Expand All @@ -12,12 +13,20 @@

public class TagsProvider {
public static class Blocks extends BlockTagsProvider {
public Blocks(DataGenerator generatorIn) {
super(generatorIn);
public Blocks(DataGenerator generatorIn, String modId, ExistingFileHelper existingFileHelper) {
super(generatorIn, modId, existingFileHelper);
}

@Override
protected void registerTags() {
// Remove non-dry ice if Forge handles them in the future
getOrCreateBuilder(ITags.Blocks.ICES).addTag(ITags.Blocks.ICES_ICE).addTag(ITags.Blocks.ICES_PACKED).addTag(ITags.Blocks.ICES_BLUE);
getOrCreateBuilder(ITags.Blocks.ICES_ICE).add(net.minecraft.block.Blocks.ICE);
getOrCreateBuilder(ITags.Blocks.ICES_PACKED).add(net.minecraft.block.Blocks.PACKED_ICE);
getOrCreateBuilder(ITags.Blocks.ICES_BLUE).add(net.minecraft.block.Blocks.BLUE_ICE);
getOrCreateBuilder(ITags.Blocks.ICES).addTag(ITags.Blocks.ICES_DRY);
getOrCreateBuilder(ITags.Blocks.ICES_DRY).add(Blcks.DRY_ICE);

getOrCreateBuilder(ORES).add(Blcks.URANINITE_ORE).add(Blcks.URANINITE_ORE_POOR).add(Blcks.URANINITE_ORE_DENSE);
getOrCreateBuilder(ITags.Blocks.URANINITE_ORE).add(Blcks.URANINITE_ORE);
getOrCreateBuilder(ITags.Blocks.URANINITE_ORE_POOR).add(Blcks.URANINITE_ORE_POOR);
Expand All @@ -29,12 +38,20 @@ protected void registerTags() {
}

public static class Items extends ItemTagsProvider {
public Items(DataGenerator dataGenerator, BlockTagsProvider blockTagProvider) {
super(dataGenerator, blockTagProvider);
public Items(DataGenerator dataGenerator, BlockTagsProvider blockTagProvider, String modId, ExistingFileHelper existingFileHelper) {
super(dataGenerator, blockTagProvider, modId, existingFileHelper);
}

@Override
protected void registerTags() {
// Remove non-dry ice if Forge handles them in the future
getOrCreateBuilder(ITags.Items.ICES).addTag(ITags.Items.ICES_ICE).addTag(ITags.Items.ICES_PACKED).addTag(ITags.Items.ICES_BLUE);
getOrCreateBuilder(ITags.Items.ICES_ICE).add(net.minecraft.item.Items.ICE);
getOrCreateBuilder(ITags.Items.ICES_PACKED).add(net.minecraft.item.Items.PACKED_ICE);
getOrCreateBuilder(ITags.Items.ICES_BLUE).add(net.minecraft.item.Items.BLUE_ICE);
getOrCreateBuilder(ITags.Items.ICES).addTag(ITags.Items.ICES_DRY);
getOrCreateBuilder(ITags.Items.ICES_DRY).add(Blcks.DRY_ICE.asItem());

getOrCreateBuilder(Tags.Items.ORES).add(Blcks.URANINITE_ORE.asItem()).add(Blcks.URANINITE_ORE_POOR.asItem()).add(Blcks.URANINITE_ORE_DENSE.asItem());
getOrCreateBuilder(ITags.Items.URANINITE_ORE).add(Blcks.URANINITE_ORE.asItem());
getOrCreateBuilder(ITags.Items.URANINITE_ORE_POOR).add(Blcks.URANINITE_ORE_POOR.asItem());
Expand Down

0 comments on commit 71e90ff

Please sign in to comment.