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

Commit

Permalink
added space mod registrar for moon and mars ore generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinsdar committed Sep 12, 2023
1 parent 8dc5377 commit 1ba7da3
Show file tree
Hide file tree
Showing 5 changed files with 315 additions and 224 deletions.
2 changes: 2 additions & 0 deletions common/src/main/java/muramasa/gregtech/GregTech.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import muramasa.gregtech.data.*;
import muramasa.gregtech.datagen.*;
import muramasa.gregtech.integration.AppliedEnergisticsRegistrar;
import muramasa.gregtech.integration.SpaceModRegistrar;
import muramasa.gregtech.integration.rei.*;
import muramasa.gregtech.loader.crafting.*;
import muramasa.gregtech.loader.items.Circuitry;
Expand Down Expand Up @@ -50,6 +51,7 @@ public GregTech() {
public void onRegistrarInit() {
super.onRegistrarInit();
new AppliedEnergisticsRegistrar();
new SpaceModRegistrar();
LOGGER.info("Loading GregTech");
INSTANCE = this;
ServerHandler.setup();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import muramasa.antimatter.AntimatterAPI;
import muramasa.antimatter.Ref;
import muramasa.antimatter.data.AntimatterMaterialTypes;
import muramasa.antimatter.data.AntimatterMaterials;
import muramasa.antimatter.data.AntimatterStoneTypes;
import muramasa.antimatter.datagen.providers.AntimatterBlockLootProvider;
import muramasa.antimatter.material.Material;
Expand All @@ -15,6 +16,7 @@
import muramasa.gregtech.data.GregTechData;
import muramasa.gregtech.data.Materials;
import muramasa.gregtech.integration.AppliedEnergisticsRegistrar;
import muramasa.gregtech.integration.SpaceModRegistrar;
import net.minecraft.data.DataGenerator;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.enchantment.Enchantments;
Expand Down Expand Up @@ -65,5 +67,8 @@ protected void loot() {
tables.put(AppliedEnergisticsRegistrar.getAe2Block("quartz_ore"), b -> createOreDrop(b, RAW_ORE.get(Materials.CertusQuartz)));
tables.put(AppliedEnergisticsRegistrar.getAe2Block("deepslate_quartz_ore"), b -> createOreDrop(b, RAW_ORE.get(Materials.CertusQuartz)));
}
if (AntimatterAPI.isModLoaded("ad_astra")){
tables.put(SpaceModRegistrar.getSpaceBlock("mars_diamond_ore"), b -> createOreDrop(b, RAW_ORE.get(Diamond)));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package muramasa.gregtech.integration;

import muramasa.antimatter.AntimatterAPI;
import muramasa.antimatter.AntimatterMod;
import muramasa.antimatter.Ref;
import muramasa.antimatter.data.AntimatterStoneTypes;
import muramasa.antimatter.material.Material;
import muramasa.antimatter.ore.StoneType;
import muramasa.antimatter.registration.RegistrationEvent;
import muramasa.antimatter.registration.Side;
import muramasa.antimatter.texture.Texture;
import muramasa.antimatter.util.AntimatterPlatformUtils;
import muramasa.gregtech.GTIRef;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;

import static muramasa.antimatter.data.AntimatterMaterialTypes.ORE;
import static muramasa.antimatter.data.AntimatterMaterials.Diamond;
import static muramasa.antimatter.data.AntimatterMaterials.Iron;

public class SpaceModRegistrar extends AntimatterMod {
public SpaceModRegistrar(){
if (AntimatterPlatformUtils.isFabric()) {
onRegistrarInit();
}
}

@Override
public String getId() {
return "gt_space";
}

@Override
public void onRegistrationEvent(RegistrationEvent event, Side side) {
if (event == RegistrationEvent.DATA_INIT){
AntimatterAPI.register(StoneType.class, new StoneType(GTIRef.ID, "moon_sand", Material.NULL, new Texture(getMod(), "block/moon_sand"), SoundType.SAND, false).setState(getSpaceBlock("moon_sand")).setSandLike(true));
var moonStone = AntimatterAPI.register(StoneType.class, new StoneType(GTIRef.ID, "moon_stone", Material.NULL, new Texture(getMod(), "block/moon_stone"), SoundType.STONE, false).setState(getSpaceBlock("moon_stone")));
AntimatterAPI.register(StoneType.class, new StoneType(GTIRef.ID, "mars_sand", Material.NULL, new Texture(getMod(), "block/mars_sand"), SoundType.SAND, false).setState(getSpaceBlock("mars_sand")).setSandLike(true));
var marsStone = AntimatterAPI.register(StoneType.class, new StoneType(GTIRef.ID, "mars_stone", Material.NULL, new Texture(getMod(), "block/mars_stone"), SoundType.STONE, false).setState(getSpaceBlock("mars_stone")));
if (AntimatterAPI.isModLoaded("ad_astra")){
ORE.replacement(Iron, moonStone, () -> getSpaceBlock("moon_iron_ore").asItem());
ORE.replacement(Iron, marsStone, () -> getSpaceBlock("mars_iron_ore").asItem());
ORE.replacement(Diamond, marsStone, () -> getSpaceBlock("mars_diamond_ore").asItem());
}
}
}

@Override
public boolean isEnabled() {
return (AntimatterAPI.isModLoaded("ad_astra") || AntimatterAPI.isModLoaded("beyond_earth")) && !AntimatterAPI.isModLoaded(Ref.MOD_GC);
}

private static String getMod(){
return AntimatterAPI.isModLoaded("ad_astra") ? "ad_astra" : "beyond_earth";
}

public static Block getSpaceBlock(String id){
return AntimatterPlatformUtils.getBlockFromId(getMod(), id);
}
}
Loading

0 comments on commit 1ba7da3

Please sign in to comment.