Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Commit

Permalink
made tfc registrar use constant from Ref, fixed it trying to get ore …
Browse files Browse the repository at this point in the history
…objects that don't exist
  • Loading branch information
Trinsdar committed Nov 19, 2023
1 parent d5607cf commit 1766def
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.google.gson.JsonObject;
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
import muramasa.antimatter.AntimatterAPI;
import muramasa.antimatter.Ref;
import muramasa.antimatter.datagen.AntimatterDynamics;
import muramasa.antimatter.ore.BlockOre;
import muramasa.antimatter.registration.IAntimatterObject;
Expand All @@ -24,7 +25,7 @@ public class GregTechTwilightStalctites {
private static Map<Integer, List<ResourceLocation>> hollowHillEntries = new Object2ObjectOpenHashMap<>();

public static void init(){
if (!AntimatterAPI.isModLoaded("twilightforest")) return;
if (!AntimatterAPI.isModLoaded(Ref.MOD_TWILIGHT)) return;
addStalctite("ruby", 2, 6, ORE.get().get(Ruby, STONE).asBlock(), 0.6f, 20);
addStalctite("sapphire", 2, 6, ORE.get().get(Sapphire, STONE).asBlock(), 0.6f, 20);
addStalctite("green_sapphire", 2, 6, ORE.get().get(GreenSapphire, STONE).asBlock(), 0.6f, 20);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import io.github.gregtechintergalactical.gtcore.data.GTCoreBlocks;
import io.github.gregtechintergalactical.gtcore.data.GTCoreTags;
import muramasa.antimatter.AntimatterAPI;
import muramasa.antimatter.Ref;
import muramasa.antimatter.data.AntimatterMaterialTypes;
import muramasa.antimatter.data.AntimatterMaterials;
import muramasa.antimatter.material.Material;
Expand Down Expand Up @@ -46,7 +47,7 @@ public static void init() {
AntimatterMaterialTypes.ROD_LONG.all().forEach(m -> {
addCutterRecipe(ROD_LONG.getMaterialTag(m), ROD.get(m, 2), "rod_" + m.getId(), (int) (m.getMass() * 2), 4);
});
if (!AntimatterAPI.isModLoaded("tfc")){
if (!AntimatterAPI.isModLoaded(Ref.MOD_TFC)){
addWoodRecipe(ItemTags.OAK_LOGS, Items.OAK_PLANKS, 1, "oak_planks", 200, 8);
addWoodRecipe(ItemTags.BIRCH_LOGS, Items.BIRCH_PLANKS, 1, "birch_planks", 200, 8);
addWoodRecipe(ItemTags.SPRUCE_LOGS, Items.SPRUCE_PLANKS, 1, "spruce_planks", 200, 8);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import io.github.gregtechintergalactical.gtcore.data.GTCoreTags;
import io.github.gregtechintergalactical.gtcore.integration.tfc.TFCRubberData;
import muramasa.antimatter.Ref;
import muramasa.antimatter.data.AntimatterMaterialTypes;
import muramasa.antimatter.data.AntimatterMaterials;
import muramasa.antimatter.material.Material;
Expand Down Expand Up @@ -75,14 +76,14 @@ public static void initMaceratorRecipes(){
addMaceratorRecipe(material);
}*/
Helpers.mapOfKeys(net.dries007.tfc.common.blocks.wood.Wood.class, w -> {
CuttingLoader.addWoodRecipe(TagUtils.getItemTag(new ResourceLocation("tfc", w.name().toLowerCase() + "_logs")), AntimatterPlatformUtils.getItemFromID("tfc", "wood/lumber/" + w.name().toLowerCase()), 2, w.name().toLowerCase() + "_lumber", 200, 8);
CuttingLoader.addWoodRecipe(TagUtils.getItemTag(new ResourceLocation(Ref.MOD_TFC, w.name().toLowerCase() + "_logs")), AntimatterPlatformUtils.getItemFromID(Ref.MOD_TFC, "wood/lumber/" + w.name().toLowerCase()), 2, w.name().toLowerCase() + "_lumber", 200, 8);
return true;
});
CuttingLoader.addWoodRecipe(GTCoreTags.RUBBER_LOGS, TFCRubberData.RUBBER_LUMBER, 2, "rubber_lumber", 200, 8);
FLUID_EXTRACTING.RB().ii(RecipeIngredient.of(TagUtils.getItemTag(new ResourceLocation("tfc:seeds")))).fo(SeedOil.getLiquid(10)).add("seed_oil_tfc", 32, 2);
FLUID_EXTRACTING.RB().ii(AntimatterPlatformUtils.getItemFromID("tfc", "food/cod")).fo(FishOil.getLiquid(40)).add("fish_oil_cod_tfc", 16, 4);
FLUID_EXTRACTING.RB().ii(AntimatterPlatformUtils.getItemFromID("tfc", "food/salmon")).fo(FishOil.getLiquid(60)).add("fish_oil_salmon_tfc", 16, 4);
FLUID_EXTRACTING.RB().ii(AntimatterPlatformUtils.getItemFromID("tfc", "food/tropical_fish")).fo(FishOil.getLiquid(70)).add("fish_oil_tropical_fish_tfc", 16, 4);
FLUID_EXTRACTING.RB().ii(AntimatterPlatformUtils.getItemFromID(Ref.MOD_TFC, "food/cod")).fo(FishOil.getLiquid(40)).add("fish_oil_cod_tfc", 16, 4);
FLUID_EXTRACTING.RB().ii(AntimatterPlatformUtils.getItemFromID(Ref.MOD_TFC, "food/salmon")).fo(FishOil.getLiquid(60)).add("fish_oil_salmon_tfc", 16, 4);
FLUID_EXTRACTING.RB().ii(AntimatterPlatformUtils.getItemFromID(Ref.MOD_TFC, "food/tropical_fish")).fo(FishOil.getLiquid(70)).add("fish_oil_tropical_fish_tfc", 16, 4);
}

private static void addMaceratorRecipe(Ore input, Material material){
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package muramasa.gregtech.integration.forge.tfc;

import muramasa.antimatter.AntimatterAPI;
import muramasa.antimatter.Ref;
import muramasa.antimatter.data.AntimatterMaterialTypes;
import muramasa.antimatter.datagen.AntimatterDynamics;
import muramasa.antimatter.datagen.providers.AntimatterBlockTagProvider;
Expand Down Expand Up @@ -47,7 +48,7 @@ public TFCRegistrar(){
}
@Override
public String getId() {
return "tfc";
return Ref.MOD_TFC;
}

@Override
Expand All @@ -69,8 +70,8 @@ public void onRegistrationEvent(RegistrationEvent event, Side side) {
material = AntimatterAPI.register(Material.class, new Material(GTIRef.ID, rock.name().toLowerCase(), rock.color().col, TextureSet.NONE));
material.flags(DUST);
}
AntimatterAPI.register(StoneType.class, new StoneType(GTIRef.ID, "raw_" + rock.name().toLowerCase(), material, new Texture("tfc", "block/rock/raw/" + rock.name().toLowerCase()), SoundType.STONE, false).setStateSupplier(() -> rock.getBlock(Rock.BlockType.RAW).get().defaultBlockState()).setHardnessAndResistance(rock.category().hardness(6.5F), 10.0F).setHarvestLevel(1));
AntimatterAPI.register(StoneType.class, new StoneType(GTIRef.ID, rock.name().toLowerCase() + "_gravel", material, new Texture("tfc", "block/rock/gravel/" + rock.name().toLowerCase()), SoundType.GRAVEL, false).setSandLike(true).setHardnessAndResistance(rock.category().hardness(2.0F)).setStateSupplier(() -> rock.getBlock(Rock.BlockType.GRAVEL).get().defaultBlockState()).setHarvestLevel(1).setRequiresTool(true));
AntimatterAPI.register(StoneType.class, new StoneType(GTIRef.ID, "raw_" + rock.name().toLowerCase(), material, new Texture(Ref.MOD_TFC, "block/rock/raw/" + rock.name().toLowerCase()), SoundType.STONE, false).setStateSupplier(() -> rock.getBlock(Rock.BlockType.RAW).get().defaultBlockState()).setHardnessAndResistance(rock.category().hardness(6.5F), 10.0F).setHarvestLevel(1));
AntimatterAPI.register(StoneType.class, new StoneType(GTIRef.ID, rock.name().toLowerCase() + "_gravel", material, new Texture(Ref.MOD_TFC, "block/rock/gravel/" + rock.name().toLowerCase()), SoundType.GRAVEL, false).setSandLike(true).setHardnessAndResistance(rock.category().hardness(2.0F)).setStateSupplier(() -> rock.getBlock(Rock.BlockType.GRAVEL).get().defaultBlockState()).setHarvestLevel(1).setRequiresTool(true));
return true;
});
Helpers.mapOfKeys(SandBlockType.class, (sand) -> {
Expand All @@ -79,8 +80,8 @@ public void onRegistrationEvent(RegistrationEvent event, Side side) {
material = AntimatterAPI.register(Material.class, new Material(GTIRef.ID, sand.name().toLowerCase() + "_sand", sand.getDustColor(), TextureSet.NONE));
material.flags(DUST);
}
AntimatterAPI.register(StoneType.class, new StoneType(GTIRef.ID, sand.name().toLowerCase() + "_sand", material, new Texture("tfc","block/sand/" + sand.name().toLowerCase()), SoundType.SAND, false)).setSandLike(true).setRequiresTool(true).setFallingDustColor(sand.getDustColor()).setStateSupplier(() -> AntimatterPlatformUtils.getBlockFromId("tfc", "sand/" + sand.name().toLowerCase()).defaultBlockState());
AntimatterAPI.register(StoneType.class, new StoneType(GTIRef.ID, sand.name().toLowerCase() + "_raw_sandstone", material, new Texture("tfc", "block/sandstone/bottom/" + sand.name().toLowerCase()), SoundType.SAND, false).setStateSupplier(() -> AntimatterPlatformUtils.getBlockFromId("tfc", "raw_sandstone/" + sand.name().toLowerCase()).defaultBlockState()));
AntimatterAPI.register(StoneType.class, new StoneType(GTIRef.ID, sand.name().toLowerCase() + "_sand", material, new Texture(Ref.MOD_TFC,"block/sand/" + sand.name().toLowerCase()), SoundType.SAND, false)).setSandLike(true).setRequiresTool(true).setFallingDustColor(sand.getDustColor()).setStateSupplier(() -> AntimatterPlatformUtils.getBlockFromId(Ref.MOD_TFC, "sand/" + sand.name().toLowerCase()).defaultBlockState());
AntimatterAPI.register(StoneType.class, new StoneType(GTIRef.ID, sand.name().toLowerCase() + "_raw_sandstone", material, new Texture(Ref.MOD_TFC, "block/sandstone/bottom/" + sand.name().toLowerCase()), SoundType.SAND, false).setStateSupplier(() -> AntimatterPlatformUtils.getBlockFromId(Ref.MOD_TFC, "raw_sandstone/" + sand.name().toLowerCase()).defaultBlockState()));
return true;
});
AntimatterMaterialTypes.LIQUID.set((m, i) -> {
Expand Down Expand Up @@ -117,22 +118,22 @@ public void registerRecipeLoaders(AntimatterLoaderEvent event){

@SubscribeEvent
public void onProviders(AntimatterProvidersEvent ev) {
ev.event.addProvider("tfc", () -> new AntimatterFluidTagProvider("tfc", "TFC Fluid Tags", false){
ev.event.addProvider(Ref.MOD_TFC, () -> new AntimatterFluidTagProvider(Ref.MOD_TFC, "TFC Fluid Tags", false){
@Override
protected void processTags(String domain) {
super.processTags(domain);
this.tag(TagUtils.getForgelikeFluidTag("salt_water")).add(TFCFluids.SALT_WATER.getSource());
}
});
AntimatterBlockTagProvider[] blockTagProviders = new AntimatterBlockTagProvider[1];
blockTagProviders[0] = new TFCBlockTagProvider( "tfc", "TFC Block Tags", false);
ev.event.addProvider("tfc", () -> new TFCItemTagProvider("tfc", "TFC Item Tags", false, blockTagProviders[0]));
ev.event.addProvider("tfc", () -> blockTagProviders[0]);
blockTagProviders[0] = new TFCBlockTagProvider( Ref.MOD_TFC, "TFC Block Tags", false);
ev.event.addProvider(Ref.MOD_TFC, () -> new TFCItemTagProvider(Ref.MOD_TFC, "TFC Item Tags", false, blockTagProviders[0]));
ev.event.addProvider(Ref.MOD_TFC, () -> blockTagProviders[0]);

}

@Override
public boolean isEnabled() {
return AntimatterAPI.isModLoaded("tfc");
return AntimatterAPI.isModLoaded(Ref.MOD_TFC);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import static muramasa.antimatter.data.AntimatterMaterialTypes.ORE;
import static muramasa.antimatter.data.AntimatterMaterialTypes.ORE_SMALL;
import static muramasa.antimatter.data.AntimatterStoneTypes.BEDROCK;

public class TFCBlockTagProvider extends AntimatterBlockTagProvider {
public TFCBlockTagProvider(String providerDomain, String providerName, boolean replace) {
Expand All @@ -32,7 +33,7 @@ public TFCBlockTagProvider(String providerDomain, String providerName, boolean r
protected void processTags(String domain) {
super.processTags(domain);
ORE.all().forEach(m -> {
AntimatterAPI.all(StoneType.class).forEach(s -> {
AntimatterAPI.all(StoneType.class).stream().filter(s -> s.doesGenerateOre() && s != BEDROCK).forEach(s -> {
Block ore = ORE.get().get(m, s).asBlock();
Block smallOre = ORE_SMALL.get().get(m, s).asBlock();
this.tag(TFCTags.Blocks.CAN_COLLAPSE).add(ore, smallOre);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package muramasa.gregtech.integration.forge.tfc.datagen;

import muramasa.antimatter.AntimatterAPI;
import muramasa.antimatter.Ref;
import muramasa.antimatter.datagen.providers.AntimatterBlockTagProvider;
import muramasa.antimatter.datagen.providers.AntimatterItemTagProvider;
import muramasa.antimatter.material.Material;
Expand All @@ -26,33 +27,33 @@ public TFCItemTagProvider(String providerDomain, String providerName, boolean re
@Override
protected void processTags(String domain) {
super.processTags(domain);
this.tag(TagUtils.getItemTag(new ResourceLocation("tfc", "swords"))).addTag(SWORD.getTag());
this.tag(TagUtils.getItemTag(new ResourceLocation("tfc", "pickaxes"))).addTag(PICKAXE.getTag());
this.tag(TagUtils.getItemTag(new ResourceLocation("tfc", "shovels"))).addTag(SHOVEL.getTag());
this.tag(TagUtils.getItemTag(new ResourceLocation("tfc", "axes"))).addTag(AXE.getTag());
this.tag(TagUtils.getItemTag(new ResourceLocation("tfc", "hoes"))).addTag(HOE.getTag());
this.tag(TagUtils.getItemTag(new ResourceLocation("tfc", "saws"))).addTag(SAW.getTag());
this.tag(TagUtils.getItemTag(new ResourceLocation("tfc", "knives"))).addTag(KNIFE.getTag());
this.tag(TagUtils.getItemTag(new ResourceLocation(Ref.MOD_TFC, "swords"))).addTag(SWORD.getTag());
this.tag(TagUtils.getItemTag(new ResourceLocation(Ref.MOD_TFC, "pickaxes"))).addTag(PICKAXE.getTag());
this.tag(TagUtils.getItemTag(new ResourceLocation(Ref.MOD_TFC, "shovels"))).addTag(SHOVEL.getTag());
this.tag(TagUtils.getItemTag(new ResourceLocation(Ref.MOD_TFC, "axes"))).addTag(AXE.getTag());
this.tag(TagUtils.getItemTag(new ResourceLocation(Ref.MOD_TFC, "hoes"))).addTag(HOE.getTag());
this.tag(TagUtils.getItemTag(new ResourceLocation(Ref.MOD_TFC, "saws"))).addTag(SAW.getTag());
this.tag(TagUtils.getItemTag(new ResourceLocation(Ref.MOD_TFC, "knives"))).addTag(KNIFE.getTag());
Material[] tfcTools = new Material[]{BismuthBronze, BlackBronze, Bronze, Copper, WroughtIron, Steel, BlackSteel, BlueSteel, RedSteel};
AntimatterAPI.all(AntimatterToolType.class).forEach(t -> {
if (t.hasOriginalTag()) {
tag(TagUtils.getItemTag(new ResourceLocation("tfc", "usable_on_tool_rack"))).addTag(t.getTag());
tag(TagUtils.getItemTag(new ResourceLocation(Ref.MOD_TFC, "usable_on_tool_rack"))).addTag(t.getTag());
}
if (!t.isSimple()) return;
for (Material tfcTool : tfcTools) {
ToolData data = MaterialTags.TOOLS.get(tfcTool);
if (data != null && data.toolTypes().contains(t)) {
tag(TagUtils.getItemTag(new ResourceLocation("tfc", "metal_item/" + tfcTool.getId() + "_tools"))).add(t.getToolItem(tfcTool));
tag(TagUtils.getItemTag(new ResourceLocation("tfc", "metal_item/" + tfcTool.getId()))).add(t.getToolItem(tfcTool));
tag(TagUtils.getItemTag(new ResourceLocation(Ref.MOD_TFC, "metal_item/" + tfcTool.getId() + "_tools"))).add(t.getToolItem(tfcTool));
tag(TagUtils.getItemTag(new ResourceLocation(Ref.MOD_TFC, "metal_item/" + tfcTool.getId()))).add(t.getToolItem(tfcTool));
if (t == AXE || t == SWORD){
tag(TagUtils.getItemTag(new ResourceLocation("tfc", "mob_mainhand_weapons"))).add(t.getToolItem(tfcTool));
tag(TagUtils.getItemTag(new ResourceLocation(Ref.MOD_TFC, "mob_mainhand_weapons"))).add(t.getToolItem(tfcTool));
}
}
}

});
/*for (Material material : TFCRegistrar.array) {
this.tag(TagUtils.getItemTag(new ResourceLocation("tfc", "ore_pieces"))).add(GregTech.get(Item.class, "poor_" + material.getId()), GregTech.get(Item.class, "normal_" + material.getId()), GregTech.get(Item.class, "rich_" + material.getId()));
this.tag(TagUtils.getItemTag(new ResourceLocation(Ref.MOD_TFC, "ore_pieces"))).add(GregTech.get(Item.class, "poor_" + material.getId()), GregTech.get(Item.class, "normal_" + material.getId()), GregTech.get(Item.class, "rich_" + material.getId()));
}*/
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package muramasa.gregtech.integration.forge.tfc.ore;

import muramasa.antimatter.Ref;
import muramasa.antimatter.block.BlockBasic;
import muramasa.antimatter.material.Material;
import muramasa.antimatter.texture.Texture;
Expand Down Expand Up @@ -30,6 +31,6 @@ public GTTFCOreBlock(String domain, Material material, Rock rock, Ore.Grade grad
@Override
public Texture[] getTextures() {
String prefix = grade == null ? "" : grade.name().toLowerCase() + "_";
return new Texture[]{new Texture("tfc", "block/rock/raw/" + rock.name().toLowerCase()), new Texture(GTIRef.ID, "block/tfc/ore/" + prefix + material.getId())};
return new Texture[]{new Texture(Ref.MOD_TFC, "block/rock/raw/" + rock.name().toLowerCase()), new Texture(GTIRef.ID, "block/tfc/ore/" + prefix + material.getId())};
}
}

0 comments on commit 1766def

Please sign in to comment.