mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-15 01:25:13 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6472f9eede | ||
|
|
cdde638c16 | ||
|
|
d665ee4536 | ||
|
|
5b7b560342 | ||
|
|
66bc8b7137 | ||
|
|
d27f30951a | ||
|
|
a7e6e97d18 | ||
|
|
c30cb80084 | ||
|
|
503fb98712 | ||
|
|
53f303ce4c | ||
|
|
378737a39f | ||
|
|
4c22609b28 | ||
|
|
e9c07c9d17 | ||
|
|
59f1475df0 | ||
|
|
8dcda4e822 | ||
|
|
e337597a3c | ||
|
|
d41c723194 | ||
|
|
7e4e73bc0f | ||
|
|
a8197e0026 | ||
|
|
b96937cb7f | ||
|
|
5450124254 | ||
|
|
fd7ed181de | ||
|
|
ae2866aa8d | ||
|
|
398dc6d786 | ||
|
|
af707f80c8 |
No files matched your search
@@ -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,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()));
|
||||
|
||||
@@ -52,7 +52,7 @@ public abstract class AbstractPoweredTaskEntity extends AbstractPowerConsumerEnt
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return currentTask == null ? false : currentTask.getProgress() >= 0 && hasPower() && redstoneCheckPassed;
|
||||
return currentTask != null && currentTask.getProgress() >= 0 && hasPower() && redstoneCheckPassed;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -224,7 +224,7 @@ public abstract class AbstractPoweredTaskEntity extends AbstractPowerConsumerEnt
|
||||
ItemStack copy = item.copy();
|
||||
// try to add it to existing stacks first
|
||||
for (ItemStack outStack : outputStacks) {
|
||||
if (outStack != null && copy != null) {
|
||||
if (outStack != null) {
|
||||
int num = getNumCanMerge(outStack, copy);
|
||||
outStack.stackSize += num;
|
||||
copy.stackSize -= num;
|
||||
@@ -322,7 +322,7 @@ public abstract class AbstractPoweredTaskEntity extends AbstractPowerConsumerEnt
|
||||
}
|
||||
|
||||
protected int getNumCanMerge(ItemStack itemStack, ItemStack result) {
|
||||
if (!itemStack.isItemEqual(result)) {
|
||||
if (!itemStack.isItemEqual(result) || !ItemStack.areItemStackTagsEqual(itemStack, result)) {
|
||||
return 0;
|
||||
}
|
||||
return Math.min(itemStack.getMaxStackSize() - itemStack.stackSize, result.stackSize);
|
||||
|
||||
@@ -15,7 +15,9 @@ import crazypants.enderio.machine.SlotDefinition;
|
||||
|
||||
public class TileEntityPainter extends AbstractPoweredTaskEntity implements ISidedInventory {
|
||||
|
||||
// private static final short MAX_POWER_USE_PER_TICK = 6;
|
||||
private static final int SLOT_INPUT = 0;
|
||||
private static final int SLOT_PAINT_SOURCE = 1;
|
||||
private static final int SLOT_OUTPUT = 2;
|
||||
|
||||
public TileEntityPainter() {
|
||||
// 0 = input slot, 1 = paint source, 2 = output slot
|
||||
@@ -24,7 +26,8 @@ public class TileEntityPainter extends AbstractPoweredTaskEntity implements ISid
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack itemstack, int j) {
|
||||
return super.canExtractItem(i, itemstack, j) && PainterUtil.isMetadataEquivelent(itemstack, inventory[2]);
|
||||
return super.canExtractItem(i, itemstack, j)
|
||||
&& PainterUtil.isMetadataEquivelent(itemstack, inventory[SLOT_OUTPUT]);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -32,49 +35,44 @@ public class TileEntityPainter extends AbstractPoweredTaskEntity implements ISid
|
||||
return "Auto Painter";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMachineItemValidForSlot(int i, ItemStack itemStack) {
|
||||
if (i > 1) {
|
||||
return false;
|
||||
}
|
||||
if (i == 0) {
|
||||
if (i == SLOT_INPUT) {
|
||||
List<IMachineRecipe> recipes = MachineRecipeRegistry.instance
|
||||
.getRecipesForInput(getMachineName(), MachineRecipeInput.create(i, itemStack));
|
||||
if (inventory[1] == null) {
|
||||
if (inventory[SLOT_PAINT_SOURCE] == null) {
|
||||
return !recipes.isEmpty();
|
||||
} else {
|
||||
for (IMachineRecipe rec : recipes) {
|
||||
if (rec instanceof BasicPainterTemplate) {
|
||||
BasicPainterTemplate temp = (BasicPainterTemplate) rec;
|
||||
if (temp.isValidPaintSource(inventory[1])) {
|
||||
if (rec instanceof BasicPainterTemplate temp) {
|
||||
if (temp.isValidPaintSource(inventory[SLOT_PAINT_SOURCE])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (inventory[0] == null) {
|
||||
Map<String, IMachineRecipe> recipes = MachineRecipeRegistry.instance.getRecipesForMachine(getMachineName());
|
||||
for (IMachineRecipe rec : recipes.values()) {
|
||||
if (rec instanceof BasicPainterTemplate) {
|
||||
BasicPainterTemplate temp = (BasicPainterTemplate) rec;
|
||||
if (temp.isValidPaintSource(itemStack)) {
|
||||
return true;
|
||||
} else if (i == SLOT_PAINT_SOURCE) {
|
||||
if (inventory[SLOT_INPUT] == null) {
|
||||
Map<String, IMachineRecipe> recipes = MachineRecipeRegistry.instance
|
||||
.getRecipesForMachine(getMachineName());
|
||||
for (IMachineRecipe rec : recipes.values()) {
|
||||
if (rec instanceof BasicPainterTemplate temp) {
|
||||
if (temp.isValidPaintSource(itemStack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return PaintSourceValidator.instance.isValidSourceDefault(itemStack);
|
||||
} else {
|
||||
return MachineRecipeRegistry.instance.getRecipeForInputs(
|
||||
getMachineName(),
|
||||
targetInput(),
|
||||
MachineRecipeInput.create(SLOT_PAINT_SOURCE, itemStack)) != null;
|
||||
}
|
||||
return PaintSourceValidator.instance.isValidSourceDefault(itemStack);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return MachineRecipeRegistry.instance.getRecipeForInputs(
|
||||
getMachineName(),
|
||||
i == 0 ? MachineRecipeInput.create(0, itemStack) : targetInput(),
|
||||
i == 1 ? MachineRecipeInput.create(1, itemStack) : paintSource()) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -83,27 +81,10 @@ public class TileEntityPainter extends AbstractPoweredTaskEntity implements ISid
|
||||
}
|
||||
|
||||
private MachineRecipeInput targetInput() {
|
||||
return MachineRecipeInput.create(0, inventory[0]);
|
||||
return MachineRecipeInput.create(SLOT_INPUT, inventory[SLOT_INPUT]);
|
||||
}
|
||||
|
||||
private MachineRecipeInput paintSource() {
|
||||
return MachineRecipeInput.create(1, inventory[1]);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getNumCanMerge(ItemStack itemStack, ItemStack result) {
|
||||
if (result == null || !result.isItemEqual(inventory[2])) {
|
||||
// next result is a different item type
|
||||
return 0;
|
||||
} else if (result.hasTagCompound() && inventory[2].hasTagCompound()) {
|
||||
if (inventory[2].getTagCompound().hasKey("Items")) return 0; // presence of internal items
|
||||
String cookedId = result.getTagCompound().getString(BlockPainter.KEY_SOURCE_BLOCK_ID);
|
||||
String invId = inventory[2].getTagCompound().getString(BlockPainter.KEY_SOURCE_BLOCK_ID);
|
||||
if (!cookedId.equals(invId)) {
|
||||
// next result has a different source item than the current one
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return Math.min(itemStack.getMaxStackSize() - itemStack.stackSize, result.stackSize);
|
||||
return MachineRecipeInput.create(SLOT_PAINT_SOURCE, inventory[SLOT_PAINT_SOURCE]);
|
||||
}
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
@@ -15,8 +15,14 @@ public class SoulBinderEnderCystalRecipe extends AbstractSoulBinderRecipe {
|
||||
Config.soulBinderEnderCystalRF,
|
||||
Config.soulBinderEnderCystalLevels,
|
||||
"SoulBinderEnderCystalRecipe",
|
||||
"SpecialMobs.SpecialEnderman",
|
||||
"Enderman");
|
||||
"Enderman",
|
||||
"SpecialMobs.BlindingEnderman",
|
||||
"SpecialMobs.CursedEnderman",
|
||||
"SpecialMobs.IcyEnderman",
|
||||
"SpecialMobs.LightningEnderman",
|
||||
"SpecialMobs.MiniEnderman",
|
||||
"SpecialMobs.MirageEnderman",
|
||||
"SpecialMobs.ThiefEnderman");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,8 +15,14 @@ public class SoulBinderPrecientCystalRecipe extends AbstractSoulBinderRecipe {
|
||||
Config.soulBinderPrecientCystalRF,
|
||||
Config.soulBinderPrecientCystalLevels,
|
||||
"SoulBinderPrecientCystalRecipe",
|
||||
"SpecialMobs.SpecialEnderman",
|
||||
"Enderman");
|
||||
"Enderman",
|
||||
"SpecialMobs.BlindingEnderman",
|
||||
"SpecialMobs.CursedEnderman",
|
||||
"SpecialMobs.IcyEnderman",
|
||||
"SpecialMobs.LightningEnderman",
|
||||
"SpecialMobs.MiniEnderman",
|
||||
"SpecialMobs.MirageEnderman",
|
||||
"SpecialMobs.ThiefEnderman");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,7 +16,12 @@ public class SoulBinderReanimationRecipe extends AbstractSoulBinderRecipe {
|
||||
Config.soulBinderReanimationLevels,
|
||||
"SoulBinderReanimationRecipe",
|
||||
"Zombie",
|
||||
"SpecialMobs.SpecialZombie");
|
||||
"SpecialMobs.BrutishZombie",
|
||||
"SpecialMobs.FireZombie",
|
||||
"SpecialMobs.FishingZombie",
|
||||
"SpecialMobs.GiantZombie",
|
||||
"SpecialMobs.HungryZombie",
|
||||
"SpecialMobs.PlagueZombie");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,7 +16,13 @@ public class SoulBinderSentientRecipe extends AbstractSoulBinderRecipe {
|
||||
Config.soulBinderReanimationLevels,
|
||||
"SoulBinderSentientRecipe",
|
||||
"Witch",
|
||||
"enderzoo.WitherWitch");
|
||||
"enderzoo.WitherWitch",
|
||||
"SpecialMobs.DominationWitch",
|
||||
"SpecialMobs.RageWitch",
|
||||
"SpecialMobs.ShadowsWitch",
|
||||
"SpecialMobs.UndeadWitch",
|
||||
"SpecialMobs.WildsWitch",
|
||||
"SpecialMobs.WindWitch");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user