Compare commits

..
23 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
Fib4ikandM R S E d27f30951a Add redstone signal support for item conduit. (#265)
Co-authored-by: M R S E <[email protected]>
2026-10-06 19:19:44 +02: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
Mykhailo Balaker 8dcda4e822 Prevent fall-through when clicking on the "Show Range" button in Vacuum Chest GUI (#274) 2026-09-27 18:08:03 +00: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
10 changed files with 180 additions and 70 deletions

No files matched your search

+2 -1
View File
@@ -3,7 +3,7 @@
dependencies {
api('com.github.GTNewHorizons:EnderCore:0.5.15:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:ForestryMC:4.11.37:dev')
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.8.148-GTNH:dev')
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.8.130-GTNH:dev')
api("com.github.GTNewHorizons:GTNHLib:0.11.45:dev")
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.63:dev')
api('curse.maven:cofh-lib-220333:2388748') // https://www.curseforge.com/minecraft/mc-mods/cofh-lib/files/2388748
@@ -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());
@@ -320,7 +320,7 @@ public class ConduitUtil {
}
int signalStrength = getInternalSignalForColor(bundle, col);
if (signalStrength < 15 && DyeColor.RED == col && bundle != null && bundle.getEntity() != null) {
if (signalStrength < 15 && bundle != null && bundle.getEntity() != null) {
TileEntity te = bundle.getEntity();
signalStrength = Math
.max(signalStrength, te.getWorldObj().getStrongestIndirectPower(te.xCoord, te.yCoord, te.zCoord));
@@ -175,6 +175,7 @@ public class ItemSettings extends BaseSettingsPanel {
private void updateButtons() {
rsB.onGuiInit();
rsB.setMode(itemConduit.getExtractionRedstoneMode(gui.getDir()));
colorB.onGuiInit();
loopB.onGuiInit();
loopB.setSelected(itemConduit.isSelfFeedEnabled(gui.getDir()));
@@ -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) {
@@ -148,6 +148,7 @@ public class GuiVacuumChest extends GuiContainerBaseEIO {
break;
case RANGE_ID:
te.setShowRange(showRangeB.isSelected());
break;
case ID_WHITELIST:
itemFilter = te.getItemFilter();
if (itemFilter != null) {
@@ -78,16 +78,6 @@ public class NEIEnderIOConfig implements IConfigureNEI {
API.hideItem(new ItemStack(EnderIO.itemGasConduit));
}
API.hideItem(new ItemStack(EnderIO.blockHyperCube));
API.hideItem(new ItemStack(EnderIO.blockNutrientDistillation));
API.hideItem(new ItemStack(EnderIO.blockHootch));
API.hideItem(new ItemStack(EnderIO.blockRocketFuel));
API.hideItem(new ItemStack(EnderIO.blockFireWater));
API.hideItem(new ItemStack(EnderIO.blockLiquidSunshine));
API.hideItem(new ItemStack(EnderIO.blockCloudSeed));
API.hideItem(new ItemStack(EnderIO.blockCloudSeedConcentrated));
API.hideItem(new ItemStack(EnderIO.blockEnderDistillation));
API.hideItem(new ItemStack(EnderIO.blockVapourOfLevity));
}
@Override
@@ -1,5 +1,6 @@
package crazypants.enderio.nei;
import java.awt.Point;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.HashMap;
@@ -8,6 +9,7 @@ import java.util.Map;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
@@ -15,13 +17,17 @@ import net.minecraftforge.fluids.FluidStack;
import org.lwjgl.opengl.GL11;
import com.enderio.core.client.render.RenderUtil;
import com.enderio.core.common.util.FluidUtil;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.ItemStackMap;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.StackInfo;
import codechicken.nei.recipe.GuiCraftingRecipe;
import codechicken.nei.recipe.GuiRecipe;
import codechicken.nei.recipe.GuiUsageRecipe;
import codechicken.nei.recipe.TemplateRecipeHandler;
import crazypants.enderio.fluid.Fluids;
import crazypants.enderio.gui.GuiContainerBaseEIO;
import crazypants.enderio.machine.recipe.IRecipe;
import crazypants.enderio.machine.recipe.RecipeInput;
@@ -32,6 +38,9 @@ import crazypants.util.ColorUtils;
public class VatRecipeHandler extends TemplateRecipeHandler {
private final Rectangle inTankBounds = new Rectangle(25, 1, 15, 47);
private final Rectangle outTankBounds = new Rectangle(127, 1, 15, 47);
public VatRecipeHandler() {}
@Override
@@ -85,7 +94,7 @@ public class VatRecipeHandler extends TemplateRecipeHandler {
@Override
public void loadCraftingRecipes(ItemStack result) {
FluidStack fluid = getFluidFromNeiItem(result);
FluidStack fluid = FluidUtil.getFluidFromItem(result);
if (fluid != null) {
loadCraftingRecipes(fluid);
}
@@ -113,7 +122,7 @@ public class VatRecipeHandler extends TemplateRecipeHandler {
@Override
public void loadUsageRecipes(ItemStack ingredient) {
FluidStack fluid = getFluidFromNeiItem(ingredient);
FluidStack fluid = FluidUtil.getFluidFromItem(ingredient);
if (fluid != null) {
loadUsageRecipes(fluid);
}
@@ -150,37 +159,109 @@ public class VatRecipeHandler extends TemplateRecipeHandler {
@Override
public void drawExtras(int recipeIndex) {
InnerVatRecipe rec = (InnerVatRecipe) arecipes.get(recipeIndex);
if (rec.inFluid != null && rec.inFluid.getFluid() != null) {
RenderUtil.renderGuiTank(
rec.inFluid,
FluidContainerRegistry.BUCKET_VOLUME * 8,
rec.getInputFluidAmount(),
inTankBounds.x,
inTankBounds.y,
0,
inTankBounds.width,
inTankBounds.height);
}
if (rec.result != null && rec.result.getFluid() != null) {
RenderUtil.renderGuiTank(
rec.result,
FluidContainerRegistry.BUCKET_VOLUME * 8,
rec.getResultFluidAmount(),
outTankBounds.x,
outTankBounds.y,
0,
outTankBounds.width,
outTankBounds.height);
}
String energyString = PowerDisplayUtil.formatPower(rec.energy) + " " + PowerDisplayUtil.abrevation();
GuiDraw.drawStringC(energyString, 86, 54, ColorUtils.neiEnergyString.getColor(), false);
Fluid outputFluid = rec.resultFluid.getFluid();
Fluid outputFluid = rec.result.getFluid();
List<PositionedStack> stacks = rec.getIngredients();
for (PositionedStack ps : stacks) {
if (ps instanceof PositionedStack.Tank) {
continue;
}
float mult = VatRecipeManager.getInstance()
.getMultiplierForInput(rec.inFluid.getFluid(), ps.item, outputFluid);
GuiDraw.drawStringC(
"x" + mult,
ps.relx + 8,
ps.rely + 19,
ColorUtils.neiMultiplierString.getColor(),
false);
String str = "x" + mult;
GuiDraw.drawStringC(str, ps.relx + 8, ps.rely + 19, ColorUtils.neiMultiplierString.getColor(), false);
}
}
private static FluidStack getFluidFromNeiItem(ItemStack stack) {
FluidStack fluid = StackInfo.getFluid(stack);
return fluid != null ? fluid : FluidUtil.getFluidFromItem(stack);
@Override
public List<String> handleItemTooltip(GuiRecipe<?> gui, ItemStack stack, List<String> currenttip, int recipeIndex) {
return currenttip;
}
private static FluidStack withAmount(FluidStack fluid, int amount) {
FluidStack copy = fluid.copy();
copy.amount = amount;
return copy;
@Override
public List<String> handleTooltip(GuiRecipe<?> gui, List<String> currenttip, int recipeIndex) {
final InnerVatRecipe rec = (InnerVatRecipe) arecipes.get(recipeIndex);
final Point pos = GuiDraw.getMousePosition();
final Point offset = gui.getRecipePosition(recipeIndex);
final Point relMouse = new Point(pos.x - gui.guiLeft - offset.x, pos.y - gui.guiTop - offset.y);
if (inTankBounds.contains(relMouse) && rec.inFluid != null && rec.inFluid.getFluid() != null) {
currenttip.add(rec.inFluid.getFluid().getLocalizedName(rec.inFluid));
currenttip.add(EnumChatFormatting.GRAY.toString() + rec.getInputFluidAmount() + " " + Fluids.MB());
} else if (outTankBounds.contains(relMouse) && rec.result != null && rec.result.getFluid() != null) {
currenttip.add(rec.result.getFluid().getLocalizedName(rec.result));
currenttip.add(EnumChatFormatting.GRAY.toString() + rec.getResultFluidAmount() + " " + Fluids.MB());
}
return super.handleTooltip(gui, currenttip, recipeIndex);
}
@Override
public boolean mouseClicked(GuiRecipe<?> gui, int button, int recipeIndex) {
if (button == 0) {
if (this.transferFluidTanks(gui, recipeIndex, false)) {
return true;
}
} else if (button == 1) {
if (this.transferFluidTanks(gui, recipeIndex, true)) {
return true;
}
}
return super.mouseClicked(gui, button, recipeIndex);
}
private boolean transferFluidTanks(GuiRecipe<?> gui, int recipeIndex, boolean usage) {
InnerVatRecipe rec = (InnerVatRecipe) arecipes.get(recipeIndex);
Point pos = GuiDraw.getMousePosition();
Point offset = gui.getRecipePosition(recipeIndex);
Point relMouse = new Point(pos.x - gui.guiLeft - offset.x, pos.y - gui.guiTop - offset.y);
if (inTankBounds.contains(relMouse)) {
transferFluidTank(rec.inFluid, usage);
} else if (outTankBounds.contains(relMouse)) {
transferFluidTank(rec.result, usage);
}
return false;
}
private boolean transferFluidTank(FluidStack tank, boolean usage) {
if (tank != null && tank.amount > 0) {
if (usage) {
if (!GuiUsageRecipe.openRecipeGui("liquid", new Object[] { tank.copy() })) {
return false;
}
} else {
if (!GuiCraftingRecipe.openRecipeGui("liquid", new Object[] { tank.copy() })) {
return false;
}
}
return true;
}
return false;
}
public List<ItemStack> getInputs(RecipeInput input) {
@@ -198,32 +279,20 @@ public class VatRecipeHandler extends TemplateRecipeHandler {
public class InnerVatRecipe extends TemplateRecipeHandler.CachedRecipe {
private final List<PositionedStack> inputs = new ArrayList<>();
private final ItemStackMap<Float> firstItemMultiplier = new ItemStackMap<Float>();
private final ItemStackMap<Float> secondItemMultiplier = new ItemStackMap<Float>();
private final ItemStackMap<Float> firstItemMultiplier = new ItemStackMap();
private final ItemStackMap<Float> secondItemMultiplier = new ItemStackMap();
private final Map<FluidStack, Float> fluidMultiplier = new HashMap<>();
private final FluidStack resultFluid;
private final int energy;
private final FluidStack result;
private FluidStack inFluid;
private int inTankIndex = -1;
private int lastInputAmount;
private PositionedStack resultTank;
private int lastResultAmount;
public int getEnergy() {
return energy;
}
@Override
public List<PositionedStack> getIngredients() {
if (this.inTankIndex >= 0) {
int amount = getInputFluidAmount();
if (amount != this.lastInputAmount) {
this.lastInputAmount = amount;
this.inputs.set(this.inTankIndex, createTank(withAmount(this.inFluid, amount), 25, 1));
}
}
return this.inputs;
return getCycledIngredients(cycleticks / 30, this.inputs);
}
public int getInputFluidAmount() {
@@ -252,12 +321,7 @@ public class VatRecipeHandler extends TemplateRecipeHandler {
@Override
public PositionedStack getResult() {
int amount = getResultFluidAmount();
if (amount != this.lastResultAmount || this.resultTank == null) {
this.lastResultAmount = amount;
this.resultTank = createTank(withAmount(this.resultFluid, amount), 127, 1);
}
return this.resultTank;
return null;
}
public InnerVatRecipe(int energy, RecipeInput[] ingredients, FluidStack result) {
@@ -291,28 +355,15 @@ public class VatRecipeHandler extends TemplateRecipeHandler {
}
// Item stacks must stay at indices 0/1: getFirstItemMultiplier()/getSecondItemMultiplier() rely on it.
if (!inputsOne.isEmpty()) {
this.inputs.add(new PositionedStack(inputsOne, 51, 1));
}
if (!inputsTwo.isEmpty()) {
this.inputs.add(new PositionedStack(inputsTwo, 100, 1));
}
this.energy = energy;
this.resultFluid = result;
if (this.inFluid != null) {
this.inTankIndex = this.inputs.size();
this.lastInputAmount = getInputFluidAmount();
this.inputs.add(createTank(withAmount(this.inFluid, this.lastInputAmount), 25, 1));
}
this.lastResultAmount = getResultFluidAmount();
this.resultTank = createTank(withAmount(this.resultFluid, this.lastResultAmount), 127, 1);
}
private static PositionedStack.Tank createTank(FluidStack fluid, int x, int y) {
return new PositionedStack.Tank(fluid, x, y, 15, 47, FluidContainerRegistry.BUCKET_VOLUME * 8);
this.result = result;
}
}
}