Last active
August 31, 2019 18:35
-
-
Save kindlich/b753fc44aabfb8bb7df30656cb3c259c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#loader contenttweaker | |
import mods.contenttweaker.MaterialSystem; | |
import mods.mekatweaker.Gas; | |
import mods.mekatweaker.GasFactory; | |
import mods.mekatweaker.InfuserType; | |
//####################### | |
//### MEKANISM GASSES ### | |
//####################### | |
val gasPartType = MaterialSystem.createPartType("mekanism_gas_type", function(materialPart) { | |
val material = materialPart.getMaterial(); | |
logger.logInfo("Registering Gas MaterialPart with Part " ~ materialPart.getPart().getName() ~ " and Material " ~ material.getName()); | |
var gas = GasFactory.createGas(material.getName().toLowerCase()); | |
gas.setIcon("blocks/gas"); | |
gas.setColor(material.getColor()); | |
gas.setColorize(true); | |
//This way users dont have to add all the names to the lang file themselves, remove this and you will have to localize "gas.<material.getName().toLowerCase()>" | |
game.setLocalization("gas." ~ material.getName().toLowerCase(), material.getName()); | |
gas.register(); | |
}); | |
val gasPart = MaterialSystem.getPartBuilder() | |
.setName("mekanism_gas") | |
.setPartType(gasPartType) | |
.build(); | |
//Set this locale to include the material so that we can identify the name later. | |
game.setLocalization("contenttweaker.part.mekanism_gas", "contenttweaker.part.mekanism_gas_%s"); | |
//############################## | |
//### MEKANISM INFUSER TYPES ### | |
//############################## | |
val infuserPartType = MaterialSystem.createPartType("mekanism_infuser_type", function(materialPart) { | |
val material = materialPart.getMaterial(); | |
logger.logInfo("Registering Infuser MaterialPart with Part " ~ materialPart.getPart().getName() ~ " and Material " ~ material.getName()); | |
InfuserType.addType(material.getName().toUpperCase()); | |
//This way users dont have to add all the names to the lang file themselves, remove this and you will have to localize "gas.<material.getName().toLowerCase()>" | |
game.setLocalization("infuse." ~ material.getName().toLowerCase(), material.getName()); | |
}); | |
val infuserPart = MaterialSystem.getPartBuilder() | |
.setName("mekanism_infuser") | |
.setPartType(infuserPartType) | |
.build(); | |
//Set this locale to include the material so that we can identify the name later. | |
game.setLocalization("contenttweaker.part.mekanism_infuser", "contenttweaker.part.mekanism_infuser_%s"); | |
//############# | |
//### USAGE ### | |
//############# | |
val arakantara = MaterialSystem.getMaterialBuilder().setName("Arakantara").setColor(0xffabcdef).build(); | |
arakantara.registerParts(["mekanism_gas", "ingot", "gear", "mekanism_infuser"] as string[]); | |
val oroborum = MaterialSystem.getMaterialBuilder().setName("Oroborum").setColor(0xff941209).build(); | |
oroborum.registerParts(["mekanism_gas", "ingot", "dust", "mekanism_infuser"] as string[]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#loader crafttweaker | |
import mods.contenttweaker.MaterialSystem; | |
import mods.contenttweaker.MaterialPart; | |
val name = { | |
"%s Ingot" : 10, | |
"%s Dust" : 10, | |
"%s Gear" : 40 | |
} as int[string]; | |
val matParts = MaterialSystem.getMaterialParts(); | |
var infusionTypes = [] as [MaterialPart]; | |
for name, mat in matParts { | |
if(name.matches("contenttweaker\\.part\\.mekanism_infuser_.*")) { | |
infusionTypes += mat; | |
} | |
} | |
print("infusionTypes:"); | |
for type in infusionTypes print("\t" ~ type.getName()); | |
for type in infusionTypes { | |
for regex, infusionAmount in name { | |
val fullName = regex.replaceAll("%s", type.getMaterial().getName()); | |
if(matParts has fullName) { | |
print("Adding " ~ fullName ~ " as Infusion type " ~ type.getMaterial().getName() ~ " * " ~ infusionAmount); | |
mods.mekatweaker.InfuserType.addTypeObject(matParts[fullName].getItemStack(), type.getMaterial().getName().toUpperCase(), infusionAmount); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment