Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plat Compat Shenanigans #142

Merged
merged 5 commits into from
Oct 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ FMP_version=1.2.0.345
CCLIB_version=1.1.3.141
NEI_version=1.0.5.120
CCC_version=1.0.7.48
mod_version=9.10.31
alt_version=9, 10, 31
mod_version=9.10.32
alt_version=9, 10, 32
3 changes: 2 additions & 1 deletion src/main/java/mekanism/client/render/MekanismRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ public void onStitch(TextureStitchEvent.Pre event)
GasRegistry.getGas("sulfurTrioxideGas").setIcon(event.map.registerIcon("mekanism:liquid/LiquidSulfurTrioxide"));
GasRegistry.getGas("sulfuricAcid").setIcon(event.map.registerIcon("mekanism:liquid/LiquidSulfuricAcid"));
GasRegistry.getGas("hydrogenChloride").setIcon(event.map.registerIcon("mekanism:liquid/LiquidHydrogenChloride"));
GasRegistry.getGas("liquid" + Resource.OSMIUM.getName()).setIcon(event.map.registerIcon("mekanism:liquid/LiquidOsmium"));
GasRegistry.getGas("liquidOsmium").setIcon(event.map.registerIcon("mekanism:liquid/LiquidOsmium"));
GasRegistry.getGas("liquidPlatinum").setIcon(event.map.registerIcon("mekanism:liquid/LiquidOsmium"));
GasRegistry.getGas("liquidStone").setIcon(event.map.registerIcon("mekanism:liquid/LiquidStone"));
GasRegistry.getGas("ethene").setIcon(event.map.registerIcon("mekanism:liquid/LiquidEthene"));
GasRegistry.getGas("brine").setIcon(event.map.registerIcon("mekanism:liquid/LiquidBrine"));
Expand Down
38 changes: 21 additions & 17 deletions src/main/java/mekanism/common/Mekanism.java
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,14 @@ public class Mekanism

public static Set<Coord4D> activeVibrators = new HashSet<Coord4D>();


/**
* Adds all in-game crafting, smelting and machine recipes.
*/
public void addRecipes()
{
String mekanismMaterial = Resource.OSMIUM.getOredictName();

//Storage Recipes

if (MekanismConfig.recipes.enableCharcoalBlock) {
Expand Down Expand Up @@ -820,7 +823,7 @@ public void addRecipes()
}));

MachineType.ADVANCED_FACTORY.addRecipe(new ShapedMekanismRecipe(MekanismUtils.getFactory(FactoryTier.ADVANCED, type), new Object[]{
"ECE", "oOo", "ECE", Character.valueOf('E'), "alloyAdvanced", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ADVANCED), Character.valueOf('o'), "ingot" + Resource.OSMIUM.getName(), Character.valueOf('O'), MekanismUtils.getFactory(FactoryTier.BASIC, type)
"ECE", "oOo", "ECE", Character.valueOf('E'), "alloyAdvanced", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ADVANCED), Character.valueOf('o'), "ingot" + mekanismMaterial, Character.valueOf('O'), MekanismUtils.getFactory(FactoryTier.BASIC, type)
}));

MachineType.ELITE_FACTORY.addRecipe(new ShapedMekanismRecipe(MekanismUtils.getFactory(FactoryTier.ELITE, type), new Object[]{
Expand Down Expand Up @@ -979,7 +982,7 @@ public void addRecipes()
new ItemStack(MekanismBlocks.PlasticBlock, 1, i), new ItemStack(MekanismBlocks.PlasticBlock, 1, i), new ItemStack(MekanismBlocks.PlasticBlock, 1, i), new ItemStack(Items.glowstone_dust)
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.ReinforcedPlasticBlock, 4, i), new Object[]{
" P ", "POP", " P ", Character.valueOf('P'), new ItemStack(MekanismBlocks.PlasticBlock, 1, i), Character.valueOf('O'), "dust" + Resource.OSMIUM.getName()
" P ", "POP", " P ", Character.valueOf('P'), new ItemStack(MekanismBlocks.PlasticBlock, 1, i), Character.valueOf('O'), "dust" + mekanismMaterial
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.RoadPlasticBlock, 3, i), new Object[]{
"SSS", "PPP", "SSS", Character.valueOf('S'), Blocks.sand, Character.valueOf('P'), new ItemStack(MekanismBlocks.SlickPlasticBlock, 1, i)
Expand Down Expand Up @@ -1222,6 +1225,8 @@ public int getBurnTime(ItemStack fuel)
*/
public void registerOreDict()
{
String mekanismMaterial = Resource.OSMIUM.getOredictName();

//Add specific items to ore dictionary for recipe usage in other mods.
OreDictionary.registerOre("universalCable", new ItemStack(MekanismItems.PartTransmitter, 8, 0));
OreDictionary.registerOre("battery", MekanismItems.EnergyTablet.getUnchargedItem());
Expand Down Expand Up @@ -1252,15 +1257,15 @@ public void registerOreDict()

OreDictionary.registerOre("ingotRefinedObsidian", new ItemStack(MekanismItems.Ingot, 1, 0));

OreDictionary.registerOre("ingot" + Resource.OSMIUM.getName(), new ItemStack(MekanismItems.Ingot, 1, 1));
OreDictionary.registerOre("ingot" + mekanismMaterial, new ItemStack(MekanismItems.Ingot, 1, 1));
OreDictionary.registerOre("ingotBronze", new ItemStack(MekanismItems.Ingot, 1, 2));
OreDictionary.registerOre("ingotRefinedGlowstone", new ItemStack(MekanismItems.Ingot, 1, 3));
OreDictionary.registerOre("ingotSteel", new ItemStack(MekanismItems.Ingot, 1, 4));
OreDictionary.registerOre("ingotCopper", new ItemStack(MekanismItems.Ingot, 1, 5));
OreDictionary.registerOre("ingotTin", new ItemStack(MekanismItems.Ingot, 1, 6));
OreDictionary.registerOre("ingotRefinedLapis", new ItemStack(MekanismItems.Ingot, 1, 7));

OreDictionary.registerOre("block" + Resource.OSMIUM.getName(), new ItemStack(MekanismBlocks.BasicBlock, 1, 0));
OreDictionary.registerOre("block" + mekanismMaterial, new ItemStack(MekanismBlocks.BasicBlock, 1, 0));
OreDictionary.registerOre("blockBronze", new ItemStack(MekanismBlocks.BasicBlock, 1, 1));
OreDictionary.registerOre("blockRefinedObsidian", new ItemStack(MekanismBlocks.BasicBlock, 1, 2));
OreDictionary.registerOre("blockCharcoal", new ItemStack(MekanismBlocks.BasicBlock, 1, 3));
Expand All @@ -1271,11 +1276,11 @@ public void registerOreDict()

for(Resource resource : Resource.values())
{
OreDictionary.registerOre("dust" + resource.getName(), new ItemStack(MekanismItems.Dust, 1, resource.ordinal()));
OreDictionary.registerOre("dustDirty" + resource.getName(), new ItemStack(MekanismItems.DirtyDust, 1, resource.ordinal()));
OreDictionary.registerOre("clump" + resource.getName(), new ItemStack(MekanismItems.Clump, 1, resource.ordinal()));
OreDictionary.registerOre("shard" + resource.getName(), new ItemStack(MekanismItems.Shard, 1, resource.ordinal()));
OreDictionary.registerOre("crystal" + resource.getName(), new ItemStack(MekanismItems.Crystal, 1, resource.ordinal()));
OreDictionary.registerOre("dust" + resource.getOredictName(), new ItemStack(MekanismItems.Dust, 1, resource.ordinal()));
OreDictionary.registerOre("dustDirty" + resource.getOredictName(), new ItemStack(MekanismItems.DirtyDust, 1, resource.ordinal()));
OreDictionary.registerOre("clump" + resource.getOredictName(), new ItemStack(MekanismItems.Clump, 1, resource.ordinal()));
OreDictionary.registerOre("shard" + resource.getOredictName(), new ItemStack(MekanismItems.Shard, 1, resource.ordinal()));
OreDictionary.registerOre("crystal" + resource.getOredictName(), new ItemStack(MekanismItems.Crystal, 1, resource.ordinal()));
}

OreDictionary.registerOre("oreCopper", new ItemStack(MekanismBlocks.OreBlock, 1, 1));
Expand Down Expand Up @@ -1380,7 +1385,11 @@ public void preInit(FMLPreInitializationEvent event)
configurationrecipes = new Configuration(new File("config/mekanism/MekanismRecipes.cfg"));
configurationce = new Configuration(new File("config/mekanism/MekanismCE.cfg"));

//Register tier information
//Load configuration
proxy.loadConfiguration();
proxy.onConfigSync(false);

//Register tier information
Tier.init();

GasRegistry.register(new Gas("hydrogen")).registerFluid();
Expand Down Expand Up @@ -1410,10 +1419,9 @@ public void preInit(FMLPreInitializationEvent event)
FluidRegistry.registerFluid(new Fluid("steam").setGaseous(true));

for(Resource resource : Resource.values()) {
String name = resource.getName();

OreGas clean = (OreGas) GasRegistry.register(new OreGas("clean" + name, "oregas." + name.toLowerCase()).setVisible(false));
GasRegistry.register(new OreGas(name.toLowerCase(), "oregas." + name.toLowerCase()).setCleanGas(clean).setVisible(false));
OreGas clean = (OreGas) GasRegistry.register(new OreGas("clean" + resource.getOredictName(), "oregas." + resource.getOredictName().toLowerCase()).setVisible(false));
GasRegistry.register(new OreGas(resource.getOredictName().toLowerCase(), "oregas." + resource.getOredictName().toLowerCase()).setCleanGas(clean).setVisible(false));
}

//Register Gasifyable Items
Expand Down Expand Up @@ -1475,10 +1483,6 @@ public void init(FMLInitializationEvent event)
//Register with TransmitterNetworkRegistry
TransmitterNetworkRegistry.initiate();

//Load configuration
proxy.loadConfiguration();
proxy.onConfigSync(false);

//Add baby skeleton spawner
if(general.spawnBabySkeletons)
{
Expand Down
30 changes: 27 additions & 3 deletions src/main/java/mekanism/common/Resource.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package mekanism.common;

import static mekanism.api.MekanismConfig.mekce.PlatReplacement;
import mekanism.api.MekanismConfig;

import java.util.Objects;

public enum Resource
{
IRON("Iron"),
GOLD("Gold"),
OSMIUM(PlatReplacement ? "Platinum" : "Osmium"),
OSMIUM("Osmium"),
COPPER("Copper"),
TIN("Tin"),
SILVER("Silver"),
Expand All @@ -19,11 +21,17 @@ private Resource(String s)
name = s;
}

/**
* Returns resource from a String.
* Used to convert Oregas into their physical output
*
*/
public static Resource getFromName(String s)
{
for(Resource r : values())
{
if(r.name.toLowerCase().equals(s.toLowerCase()))
String resourceName = r.getOredictName().toLowerCase();
if(resourceName.equals(s.toLowerCase()))
{
return r;
}
Expand All @@ -32,8 +40,24 @@ public static Resource getFromName(String s)
return null;
}

/**
* Returns the name of a resource.
*
*/
public String getName()
{
return name;
}

/**
* Returns the oredictionary name of a resource.
*
*/
public String getOredictName() {
String oreName = name;
if (MekanismConfig.mekce.PlatReplacement && Objects.equals(oreName, "Osmium"))
oreName = "Platinum";

return oreName;
}
}
3 changes: 1 addition & 2 deletions src/main/java/mekanism/common/integration/MekanismHooks.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import java.util.Map;

import li.cil.oc.api.Driver;
import mekanism.api.MekanismConfig;
import mekanism.api.transmitters.TransmissionType;
import mekanism.common.Mekanism;
import mekanism.common.MekanismItems;
Expand Down Expand Up @@ -103,7 +102,7 @@ public void hookIC2Recipes()
try {
for(Resource resource : Resource.values())
{
Recipes.macerator.addRecipe(new RecipeInputOreDict("clump" + resource.getName()), null, new ItemStack(MekanismItems.DirtyDust, 1, resource.ordinal()));
Recipes.macerator.addRecipe(new RecipeInputOreDict("clump" + resource.getOredictName()), null, new ItemStack(MekanismItems.DirtyDust, 1, resource.ordinal()));
}
} catch(Exception e) {}

Expand Down
Loading
Loading