mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-26 15:03:07 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8bc11254a9 | ||
|
|
6472f9eede | ||
|
|
cdde638c16 | ||
|
|
d665ee4536 | ||
|
|
5b7b560342 | ||
|
|
66bc8b7137 | ||
|
|
a7e6e97d18 | ||
|
|
c30cb80084 | ||
|
|
503fb98712 | ||
|
|
53f303ce4c | ||
|
|
378737a39f | ||
|
|
4c22609b28 | ||
|
|
e9c07c9d17 | ||
|
|
59f1475df0 | ||
|
|
d41c723194 | ||
|
|
7e4e73bc0f | ||
|
|
b96937cb7f | ||
|
|
5450124254 | ||
|
|
fd7ed181de | ||
|
|
ae2866aa8d | ||
|
|
398dc6d786 | ||
|
|
af707f80c8 |
No files matched your search
@@ -33,4 +33,5 @@ dependencies {
|
|||||||
compileOnlyApi('com.github.GTNewHorizons:Angelica:2.2.10:api') {transitive = false}
|
compileOnlyApi('com.github.GTNewHorizons:Angelica:2.2.10:api') {transitive = false}
|
||||||
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.7.196:dev")
|
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.7.196:dev")
|
||||||
compileOnly('curse.maven:automagy-222153:2285272')
|
compileOnly('curse.maven:automagy-222153:2285272')
|
||||||
|
compileOnly('com.ruling_0:MaterialLib:0.24.0-mu:dev')
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
// Add any additional repositories for your dependencies here
|
// Add any additional repositories for your dependencies here
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
}
|
}
|
||||||
@@ -134,6 +134,7 @@ import crazypants.enderio.machine.painter.BlockPaintedWall;
|
|||||||
import crazypants.enderio.machine.painter.BlockPainter;
|
import crazypants.enderio.machine.painter.BlockPainter;
|
||||||
import crazypants.enderio.machine.painter.PaintSourceValidator;
|
import crazypants.enderio.machine.painter.PaintSourceValidator;
|
||||||
import crazypants.enderio.machine.ranged.RangeEntity;
|
import crazypants.enderio.machine.ranged.RangeEntity;
|
||||||
|
import crazypants.enderio.machine.recipe.RecipeConfigParser;
|
||||||
import crazypants.enderio.machine.reservoir.BlockReservoir;
|
import crazypants.enderio.machine.reservoir.BlockReservoir;
|
||||||
import crazypants.enderio.machine.slicensplice.BlockSliceAndSplice;
|
import crazypants.enderio.machine.slicensplice.BlockSliceAndSplice;
|
||||||
import crazypants.enderio.machine.slicensplice.SliceAndSpliceRecipeManager;
|
import crazypants.enderio.machine.slicensplice.SliceAndSpliceRecipeManager;
|
||||||
@@ -770,6 +771,7 @@ public class EnderIO {
|
|||||||
FarmersRegistry.addFarmers();
|
FarmersRegistry.addFarmers();
|
||||||
SoulBinderRecipeManager.getInstance().addDefaultRecipes();
|
SoulBinderRecipeManager.getInstance().addDefaultRecipes();
|
||||||
PaintSourceValidator.instance.loadConfig();
|
PaintSourceValidator.instance.loadConfig();
|
||||||
|
RecipeConfigParser.logMaterialLibSummary();
|
||||||
|
|
||||||
if (fluidXpJuice == null) { // should have been registered by open blocks
|
if (fluidXpJuice == null) { // should have been registered by open blocks
|
||||||
fluidXpJuice = FluidRegistry.getFluid(getXPJuiceName());
|
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 com.enderio.core.common.util.OreDictionaryHelper;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.Loader;
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
import crazypants.enderio.Log;
|
import crazypants.enderio.Log;
|
||||||
import crazypants.enderio.machine.crusher.CrusherRecipeManager;
|
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_EXP = "exp";
|
||||||
public static final String AT_ALLOW_MISSING = "allowMissing";
|
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
|
// Log prefix
|
||||||
private static final String LP = "RecipeParser: ";
|
private static final String LP = "RecipeParser: ";
|
||||||
|
|
||||||
@@ -423,7 +432,11 @@ public class RecipeConfigParser extends DefaultHandler {
|
|||||||
String modId = getStringValue(AT_MOD_ID, attributes, null);
|
String modId = getStringValue(AT_MOD_ID, attributes, null);
|
||||||
String name = getStringValue(AT_ITEM_NAME, 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);
|
Item i = GameRegistry.findItem(modId, name);
|
||||||
if (i != null) {
|
if (i != null) {
|
||||||
@@ -447,6 +460,39 @@ public class RecipeConfigParser extends DefaultHandler {
|
|||||||
getIntValue(AT_SLOT, attributes, -1));
|
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) {
|
public static boolean getBooleanValue(String qName, Attributes attributes, boolean def) {
|
||||||
String val = attributes.getValue(qName);
|
String val = attributes.getValue(qName);
|
||||||
if (val == null) {
|
if (val == null) {
|
||||||
|
|||||||
Reference in new issue
Block a user