Skip to content

Commit

Permalink
Fix conflict with liquid nitrogen in nomi nightly and eventually norm…
Browse files Browse the repository at this point in the history
…al nomi. (#135)

* Change how liquid nitrogen is registered

* Revert accidental rename
  • Loading branch information
Zorbatron authored Jan 20, 2025
1 parent 780f210 commit 1d272e7
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ public final class ZBGTMaterials {

// Elements
public static Material Adamantium;
public static Material LiquidNitrogen;
public static Material Quantium;

// First degree materials
Expand Down Expand Up @@ -71,8 +70,14 @@ public static void init() {
ZBGTSecondDegreeMaterials.register();
ZBGTThirdDegreeMaterials.register();
ZBGTUnknownCompositionMaterials.register();
}

public static void initChanges() {
ZBGTMaterialExtraProperties.init();
ZBGTMaterialExtraFlags.init();
}

ZBGTMaterialExtraProperties.register();
ZBGTMaterialExtraFlags.register();
public static void initLateChanges() {
ZBGTMaterialExtraProperties.initLate();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import static com.zorbatron.zbgt.api.unification.material.ZBGTMaterials.*;
import static com.zorbatron.zbgt.api.util.ZBGTUtility.zbgtId;

import gregtech.api.fluids.FluidBuilder;
import gregtech.api.unification.Elements;
import gregtech.api.unification.material.Material;
import gregtech.api.unification.material.info.MaterialIconSet;

Expand All @@ -21,12 +19,6 @@ public static void register() {
.element(Ad)
.build();

LiquidNitrogen = new Material.Builder(id++, zbgtId("zb_liquid_nitrogen"))
.liquid(new FluidBuilder().temperature(77))
.color(0xE1FAFA)
.element(Elements.N)
.build();

Quantium = new Material.Builder(id++, zbgtId("quantium"))
.dust().ore(true)
.color(0x00d10b).iconSet(MaterialIconSet.SHINY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static void setFlags(List<Material> materials, MaterialFlag... flags) {
}
}

public static void register() {
public static void init() {
doublePlates();
densePlates();
screwsBolts();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,25 @@

public final class ZBGTMaterialExtraProperties {

public static void register() {
public static void init() {
ingots();
fluids();
wires();
dusts();
ores();
}

public static void initLate() {
if (Nitrogen.getProperty(PropertyKey.FLUID).get(FluidStorageKeys.LIQUID) == null) {
Nitrogen.getProperty(PropertyKey.FLUID).enqueueRegistration(FluidStorageKeys.LIQUID,
new FluidBuilder()
.temperature(77)
.color(0x008D8F)
.name("liquid_nitrogen")
.translation("gregtech.fluid.liquid_generic"));
}
}

private static void ingots() {
Material[] materials = { Cerium };

Expand Down
16 changes: 15 additions & 1 deletion src/main/java/com/zorbatron/zbgt/common/CommonProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fml.client.event.ConfigChangedEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.registries.IForgeRegistry;

Expand All @@ -37,6 +38,7 @@
import gregtech.api.cover.CoverDefinition;
import gregtech.api.unification.material.event.MaterialEvent;
import gregtech.api.unification.material.event.MaterialRegistryEvent;
import gregtech.api.unification.material.event.PostMaterialEvent;
import gregtech.api.util.Mods;

@Mod.EventBusSubscriber(modid = ZBGTCore.MODID)
Expand Down Expand Up @@ -101,10 +103,22 @@ public static void registerItems(RegistryEvent.Register<Item> event) {

@SubscribeEvent
public static void registerMaterials(MaterialEvent event) {
ZBGTLog.logger.info("Registering materials and material modifications...");
ZBGTLog.logger.info("Registering materials");
ZBGTMaterials.init();
}

@SubscribeEvent
public static void materialChanges(PostMaterialEvent event) {
ZBGTLog.logger.info("Registering material modifications...");
ZBGTMaterials.initChanges();
}

@SubscribeEvent(priority = EventPriority.LOWEST)
public static void lateMaterialChanges(PostMaterialEvent event) {
ZBGTLog.logger.info("Registering late material modifications...");
ZBGTMaterials.initLateChanges();
}

@SubscribeEvent
public static void createMaterialRegistry(MaterialRegistryEvent event) {
GregTechAPI.materialManager.createRegistry(ZBGTCore.MODID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ private static <T extends IWorldgenDefinition> void addAddonFiles(Path root, @No
root.resolve(FileUtility.slashToNativeSep(definition.getDepositName())));

if (element == null) {
GTLog.logger.error("Addon mod tried to register bad ore definition at {}",
GTLog.logger.error("Addon mod tried to init bad ore definition at {}",
definition.getDepositName());
itemsToRemove.add(definition);
continue;
Expand All @@ -55,7 +55,7 @@ private static <T extends IWorldgenDefinition> void addAddonFiles(Path root, @No
root.resolve(FileUtility.slashToNativeSep(definition.getDepositName())));

if (element == null) {
GTLog.logger.error("Addon mod tried to register bad ore definition at {}",
GTLog.logger.error("Addon mod tried to init bad ore definition at {}",
definition.getDepositName());
itemsToRemove.add(definition);
continue;
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/zorbatron/zbgt/recipe/MaterialRecipes.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.zorbatron.zbgt.api.ZBGTAPI;
import com.zorbatron.zbgt.api.util.ZBGTMods;

import gregtech.api.fluids.store.FluidStorageKeys;
import gregtech.api.recipes.RecipeBuilder;
import gregtech.api.recipes.builders.BlastRecipeBuilder;
import gregtech.api.recipes.builders.SimpleRecipeBuilder;
Expand Down Expand Up @@ -60,7 +61,7 @@ private static void chemicalReactor() {
private static void vacuumFreezer() {
VACUUM_RECIPES.recipeBuilder()
.fluidInputs(Nitrogen.getFluid(1000))
.fluidOutputs(LiquidNitrogen.getFluid(1000))
.fluidOutputs(Nitrogen.getFluid(FluidStorageKeys.LIQUID, 1000))
.EUt(VA[HV]).duration(15)
.buildAndRegister();

Expand Down Expand Up @@ -311,7 +312,7 @@ private static void ebf() {
.buildAndRegister();

RecipeBuilder<BlastRecipeBuilder> aluminumNitrideBuilder = BLAST_RECIPES.recipeBuilder()
.fluidInputs(LiquidNitrogen.getFluid(2000))
.fluidInputs(Nitrogen.getFluid(FluidStorageKeys.LIQUID, 2000))
.output(dust, AluminumNitride, 2)
.fluidOutputs(CarbonMonoxide.getFluid(3000))
.EUt(VA[EV]).duration(20 * 10)
Expand Down

0 comments on commit 1d272e7

Please sign in to comment.