Skip to content

Commit

Permalink
Merge pull request #2 from caffe3/1.20.1-remove-safe-registrate
Browse files Browse the repository at this point in the history
  • Loading branch information
IThundxr authored Oct 8, 2023
2 parents c6bbbd6 + 4bc1337 commit 875e4e5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 63 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx4G

maven_group = plus.dragons.createdragonlib

mod_version = 1.3.9
mod_version = 1.4.0

# https://fabricmc.net/develop
minecraft_version = 1.20.1
Expand All @@ -17,4 +17,4 @@ parchment_version = 2023.09.03
# https://modrinth.com/mod/create-fabric
create_version = 0.5.1-d-build.1161+mc1.20.1

artifact_minecraft_version = 1.20.1
artifact_minecraft_version = 1.20.1

This file was deleted.

18 changes: 7 additions & 11 deletions src/main/java/plus/dragons/createdragonlib/tag/TagGen.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ of this software and associated documentation files (the "Software"), to deal

import com.simibubi.create.AllTags;
import com.simibubi.create.foundation.data.recipe.Mods;
import com.simibubi.create.Create;
import com.tterrag.registrate.builders.BlockBuilder;
import com.tterrag.registrate.builders.ItemBuilder;
import com.tterrag.registrate.providers.ProviderType;
Expand All @@ -34,7 +35,6 @@ of this software and associated documentation files (the "Software"), to deal
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.material.Fluid;
import plus.dragons.createdragonlib.init.SafeRegistrate;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -45,13 +45,11 @@ of this software and associated documentation files (the "Software"), to deal
public class TagGen {
private static final List<TagGen> READY_TO_GEN = new ArrayList<>();

private SafeRegistrate registrate;
private final List<NonNullConsumer<RegistrateTagsProvider<Block>>> blockTagGen;
private final List<NonNullConsumer<RegistrateTagsProvider<Fluid>>> fluidTagGen;
private final List<NonNullConsumer<RegistrateTagsProvider<Item>>> itemTagGen;

private TagGen(SafeRegistrate registrate, List<NonNullConsumer<RegistrateTagsProvider<Block>>> blockTagGen, List<NonNullConsumer<RegistrateTagsProvider<Fluid>>> fluidTagGen, List<NonNullConsumer<RegistrateTagsProvider<Item>>> itemTagGen) {
this.registrate = registrate;
private TagGen(List<NonNullConsumer<RegistrateTagsProvider<Block>>> blockTagGen, List<NonNullConsumer<RegistrateTagsProvider<Fluid>>> fluidTagGen, List<NonNullConsumer<RegistrateTagsProvider<Item>>> itemTagGen) {
this.blockTagGen = blockTagGen;
this.fluidTagGen = fluidTagGen;
this.itemTagGen = itemTagGen;
Expand All @@ -60,13 +58,13 @@ private TagGen(SafeRegistrate registrate, List<NonNullConsumer<RegistrateTagsPro
public static void genAll() {
for (var tagGen : READY_TO_GEN) {
for (var c : tagGen.blockTagGen) {
tagGen.registrate.addDataGenerator(ProviderType.BLOCK_TAGS, c);
Create.REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, c);
}
for (var c : tagGen.itemTagGen) {
tagGen.registrate.addDataGenerator(ProviderType.ITEM_TAGS, c);
Create.REGISTRATE.addDataGenerator(ProviderType.ITEM_TAGS, c);
}
for (var c : tagGen.fluidTagGen) {
tagGen.registrate.addDataGenerator(ProviderType.FLUID_TAGS, c);
Create.REGISTRATE.addDataGenerator(ProviderType.FLUID_TAGS, c);
}
}
}
Expand All @@ -76,14 +74,12 @@ public void activate() {
}

public static class Builder {
private SafeRegistrate registrate;
private final List<NonNullConsumer<RegistrateTagsProvider<Block>>> blockTagGen = new ArrayList<>();
private final List<NonNullConsumer<RegistrateTagsProvider<Fluid>>> fluidTagGen = new ArrayList<>();
private final List<NonNullConsumer<RegistrateTagsProvider<Item>>> itemTagGen = new ArrayList<>();


public Builder(SafeRegistrate registrate) {
this.registrate = registrate;
public Builder() {
}

public Builder addItemTagFactory(NonNullConsumer<RegistrateTagsProvider<Item>> consumer) {
Expand All @@ -102,7 +98,7 @@ public Builder addFluidTagFactory(NonNullConsumer<RegistrateTagsProvider<Fluid>>
}

public TagGen build() {
return new TagGen(registrate, blockTagGen, fluidTagGen, itemTagGen);
return new TagGen(blockTagGen, fluidTagGen, itemTagGen);
}
}

Expand Down

0 comments on commit 875e4e5

Please sign in to comment.