Compare commits

...
21 Commits
Author SHA1 Message Date
Ruling-0 6472f9eede Bump MaterialLib to 0.24.0-mu 2026-10-11 18:25:18 -05:00
Ruling-0 cdde638c16 Bump MaterialLib to 0.21.0-mu 2026-10-09 21:16:29 -05:00
Ruling-0 d665ee4536 Bump MaterialLib to 0.20.0-mu 2026-10-09 19:02:33 -05:00
Ruling-0 5b7b560342 Merge remote-tracking branch 'origin/master' into mu 2026-10-09 18:56:04 -05:00
Ruling-0 66bc8b7137 Bump MaterialLib to 0.19.0-mu 2026-10-06 14:57:27 -05:00
Ruling-0 a7e6e97d18 Bump MaterialLib to 0.18.0-mu 2026-10-04 12:34:45 -05:00
Ruling-0 c30cb80084 Bump MaterialLib to 0.17.0-mu 2026-10-04 12:15:46 -05:00
Ruling-0 503fb98712 Bump MaterialLib to 0.16.0-mu 2026-10-04 02:48:16 -05:00
Ruling-0 53f303ce4c Bump MaterialLib to 0.15.0-mu 2026-09-30 13:01:46 -05:00
Ruling-0 378737a39f Bump MaterialLib to 0.14.0-mu 2026-09-30 11:03:26 -05:00
Ruling-0 4c22609b28 Bump MaterialLib to 0.13.0-mu 2026-09-29 16:57:13 -05:00
Ruling-0 e9c07c9d17 Bump MaterialLib to 0.12.0-mu 2026-09-29 07:22:34 -05:00
Ruling-0 59f1475df0 Merge remote-tracking branch 'origin/master' into mu 2026-09-28 07:38:26 -05:00
Ruling-0 d41c723194 Bump MaterialLib to 0.11.0-mu 2026-09-22 09:54:06 -05:00
Ruling-0 7e4e73bc0f Merge remote-tracking branch 'origin/master' into mu 2026-09-20 11:21:17 -05:00
Ruling-0 b96937cb7f Merge remote-tracking branch 'origin/master' into mu 2026-09-09 12:51:58 -05:00
Ruling-0 5450124254 Bump MaterialLib to 0.10.0-mu 2026-08-29 22:33:22 -05:00
Ruling-0 fd7ed181de Merge remote-tracking branch 'origin/master' into mu 2026-08-29 22:19:19 -05:00
Ruling-0 ae2866aa8d Doc and code style pass 2026-08-20 17:54:40 -05:00
Ruling-0 398dc6d786 Resolve MaterialLib item references in recipe config XML 2026-08-17 20:18:04 -05:00
Ruling-0 af707f80c8 Add MaterialLib as a compile only dependency 2026-08-17 20:18:04 -05:00
5 changed files with 68 additions and 1 deletions

No files matched your search

+1
View File
@@ -32,4 +32,5 @@ dependencies {
compileOnlyApi('com.github.GTNewHorizons:Angelica:2.2.10:api') {transitive = false}
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.7.196:dev")
compileOnly('curse.maven:automagy-222153:2285272')
compileOnly('com.ruling_0:MaterialLib:0.24.0-mu:dev')
}
+1
View File
@@ -1,4 +1,5 @@
// Add any additional repositories for your dependencies here
repositories {
mavenLocal()
}
@@ -133,6 +133,7 @@ import crazypants.enderio.machine.painter.BlockPaintedWall;
import crazypants.enderio.machine.painter.BlockPainter;
import crazypants.enderio.machine.painter.PaintSourceValidator;
import crazypants.enderio.machine.ranged.RangeEntity;
import crazypants.enderio.machine.recipe.RecipeConfigParser;
import crazypants.enderio.machine.reservoir.BlockReservoir;
import crazypants.enderio.machine.slicensplice.BlockSliceAndSplice;
import crazypants.enderio.machine.slicensplice.SliceAndSpliceRecipeManager;
@@ -766,6 +767,7 @@ public class EnderIO {
FarmersRegistry.addFarmers();
SoulBinderRecipeManager.getInstance().addDefaultRecipes();
PaintSourceValidator.instance.loadConfig();
RecipeConfigParser.logMaterialLibSummary();
if (fluidXpJuice == null) { // should have been registered by open blocks
fluidXpJuice = FluidRegistry.getFluid(getXPJuiceName());
@@ -0,0 +1,17 @@
package crazypants.enderio.machine.recipe;
import net.minecraft.item.ItemStack;
import com.ruling_0.materiallib.api.StackResolver;
/// Resolves the stack a `modID="ml"` config entry names. The only EnderIO class referencing MaterialLib types, so
/// the soft dependency classloads only behind a `Loader.isModLoaded` check.
final class MaterialLibStacks {
private MaterialLibStacks() {}
/// The stack of the named material in the named shape, or null when the pair resolves to nothing.
static ItemStack getStack(String materialName, String shapeToken, int stackSize) {
return StackResolver.getStack(materialName, shapeToken, stackSize);
}
}
@@ -28,6 +28,7 @@ import org.xml.sax.helpers.DefaultHandler;
import com.enderio.core.common.util.OreDictionaryHelper;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.registry.GameRegistry;
import crazypants.enderio.Log;
import crazypants.enderio.machine.crusher.CrusherRecipeManager;
@@ -63,6 +64,14 @@ public class RecipeConfigParser extends DefaultHandler {
public static final String AT_EXP = "exp";
public static final String AT_ALLOW_MISSING = "allowMissing";
/// The `modID` under which an `itemName` of the form `<material>:<shape>` names a MaterialLib stack.
private static final String MOD_ID_ML = "ml";
private static final String MATERIAL_LIB_MODID = "materiallib";
private static int materialLibResolved = 0;
private static int materialLibInvalid = 0;
// Log prefix
private static final String LP = "RecipeParser: ";
@@ -423,7 +432,11 @@ public class RecipeConfigParser extends DefaultHandler {
String modId = getStringValue(AT_MOD_ID, attributes, null);
String name = getStringValue(AT_ITEM_NAME, attributes, null);
if (modId != null && name != null) {
if (MOD_ID_ML.equals(modId)) {
res = getMaterialLibStack(name, stackSize);
// A MaterialLib stack carries its material in the metadata, so itemMeta="*" cannot apply.
useMeta = true;
} else if (modId != null && name != null) {
Item i = GameRegistry.findItem(modId, name);
if (i != null) {
@@ -447,6 +460,39 @@ public class RecipeConfigParser extends DefaultHandler {
getIntValue(AT_SLOT, attributes, -1));
}
/// The stack `itemName` names, or null when MaterialLib is absent, the name is malformed, or the pair resolves
/// to nothing.
private static ItemStack getMaterialLibStack(String itemName, int stackSize) {
if (itemName == null || !Loader.isModLoaded(MATERIAL_LIB_MODID)) {
return null;
}
String[] parts = itemName.split(":", -1);
if (parts.length != 2 || parts[0].isEmpty() || parts[1].isEmpty()) {
Log.warn(LP + "Malformed MaterialLib reference \"" + itemName + "\", expected <material>:<shape>");
materialLibInvalid++;
return null;
}
ItemStack res = MaterialLibStacks.getStack(parts[0], parts[1], stackSize);
if (res == null) {
materialLibInvalid++;
} else {
materialLibResolved++;
}
return res;
}
/// Logs how many MaterialLib references the recipe configs named. Call once config loading has finished.
public static void logMaterialLibSummary() {
if (materialLibResolved + materialLibInvalid > 0) {
Log.info(
LP + "Resolved "
+ materialLibResolved
+ " MaterialLib entries ("
+ materialLibInvalid
+ " invalid)");
}
}
public static boolean getBooleanValue(String qName, Attributes attributes, boolean def) {
String val = attributes.getValue(qName);
if (val == null) {