Compare commits

...
9 Commits
16 changed files with 224 additions and 100 deletions

No files matched your search

+9 -9
View File
@@ -1,14 +1,14 @@
// Add your dependencies here
dependencies {
api('com.github.GTNewHorizons:EnderCore:0.5.14:dev') {transitive = false}
api('com.github.GTNewHorizons:EnderCore:0.5.15:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:ForestryMC:4.11.37:dev')
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.8.129-GTNH:dev')
api("com.github.GTNewHorizons:GTNHLib:0.11.44: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
shadowImplementation('cglib:cglib-nodep:3.3.0')
api("com.github.GTNewHorizons:TinkersConstruct:1.14.106-GTNH:dev")
api("com.github.GTNewHorizons:TinkersConstruct:1.14.107-GTNH:dev")
devOnlyNonPublishable('com.github.GTNewHorizons:waila:1.19.34:dev') {transitive = false}
compileOnly('ganymedes01.etfuturum:Et-Futurum-Requiem:2.6.48-GTNH:dev') {transitive = false}
@@ -16,20 +16,20 @@ dependencies {
compileOnly("com.github.GTNewHorizons:Backhand:1.8.14:dev") { transitive = false }
compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-999-GTNH:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.2.22-GTNH:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.54.122:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.54.129:dev') {transitive = false}
compileOnly("com.github.GTNewHorizons:ModularUI2:2.3.88-1.7.10:dev") {transitive = false}
compileOnly('com.github.GTNewHorizons:Railcraft:9.17.31:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:StorageDrawers:2.2.29-GTNH:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:Chisel:2.17.32-GTNH:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:OpenComputers:1.12.59-GTNH:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:OpenComputers:1.12.61-GTNH:api') {transitive = false}
compileOnly('curse.maven:minefactory-reloaded-66672:2366150') // https://www.curseforge.com/minecraft/mc-mods/minefactory-reloaded/files/2366150
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
compileOnly('curse.maven:ee3-65509:2305023') // https://www.curseforge.com/minecraft/mc-mods/ee3/files/2305023
compileOnly(rfg.deobf('curse.maven:computercraft-67504:2269339')) // https://www.curseforge.com/minecraft/mc-mods/computercraft/files/2269339
compileOnly(rfg.deobf('curse.maven:mekanism-268560:2475797')) // https://www.curseforge.com/minecraft/mc-mods/mekanism/files/2475797
compileOnly(rfg.deobf('maven.modrinth:immibis-microblocks:59.1.2')) // https://modrinth.com/mod/immibis-microblocks/version/59.1.2
compileOnlyApi('com.github.GTNewHorizons:Angelica:2.2.8:api') {transitive = false}
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.7.194:dev")
compileOnly('com.github.GTNewHorizons:BetterBuildersWands:0.13.12-GTNH:dev@jar')
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')
}
@@ -47,6 +47,7 @@ import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import crazypants.enderio.api.IMC;
import crazypants.enderio.betterbuilderswands.PaintedCustomMapping;
import crazypants.enderio.block.BlockDarkSteelAnvil;
import crazypants.enderio.block.BlockDarkSteelLadder;
import crazypants.enderio.block.BlockDarkSteelPressurePlate;
@@ -190,7 +191,8 @@ import crazypants.util.EE3Util;
after:Waila@[1.5.8,);\
after:Thaumcraft;\
after:appliedenergistics2@[rv2-beta-8,);\
after:Railcraft@[9.16.7,)\
after:Railcraft@[9.16.7,);\
after:betterbuilderswands@[0.13.12,)\
""", guiFactory = "crazypants.enderio.config.ConfigFactoryEIO")
public class EnderIO {
@@ -839,6 +841,9 @@ public class EnderIO {
Log.info("Failed to registered Capacitor Banks as Tinkers Construct Flux Upgrades");
}
}
if (Loader.isModLoaded("betterbuilderswands")) {
PaintedCustomMapping.registerMappings();
}
ThaumcraftCompat.load();
}
@@ -0,0 +1,101 @@
package crazypants.enderio.betterbuilderswands;
import java.util.function.BiFunction;
import java.util.function.IntFunction;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import com.github.bsideup.jabel.Desugar;
import crazypants.enderio.EnderIO;
import crazypants.enderio.machine.painter.BlockPaintedCarpet;
import crazypants.enderio.machine.painter.BlockPaintedFence;
import crazypants.enderio.machine.painter.BlockPaintedFenceGate;
import crazypants.enderio.machine.painter.BlockPaintedGlowstone;
import crazypants.enderio.machine.painter.BlockPaintedSlab;
import crazypants.enderio.machine.painter.BlockPaintedStair;
import crazypants.enderio.machine.painter.BlockPaintedWall;
import crazypants.enderio.machine.painter.TileEntityPaintedBlock;
import portablejim.bbw.BetterBuildersWandsMod;
import portablejim.bbw.basics.Point3d;
import portablejim.bbw.core.conversion.ICustomMapping;
import portablejim.bbw.shims.IPlayerShim;
import portablejim.bbw.shims.IWorldShim;
@Desugar
public record PaintedCustomMapping(Block lookBlock, BiFunction<Block, Integer, ItemStack> itemStackGetter, int meta)
implements ICustomMapping {
@Override
public Block getLookBlock() {
return lookBlock;
}
@Override
public int getMeta() {
return meta;
}
@Override
public ItemStack getItems(IWorldShim world, IPlayerShim player, Point3d point) {
if (world.getTile(point) instanceof TileEntityPaintedBlock painted) {
return itemStackGetter.apply(painted.getSourceBlock(), painted.getSourceBlockMetadata());
}
return null;
}
@Override
public boolean shouldCopyTileNBT() {
return true;
}
public static void registerMappings() {
register(
i -> new PaintedCustomMapping(
EnderIO.blockPaintedGlowstone,
BlockPaintedGlowstone::createItemStackForSourceBlock,
i));
register(
i -> new PaintedCustomMapping(
EnderIO.blockPaintedStair,
BlockPaintedStair::createItemStackForSourceBlock,
i));
register(
i -> new PaintedCustomMapping(
EnderIO.blockPaintedFence,
BlockPaintedFence::createItemStackForSourceBlock,
i));
register(
i -> new PaintedCustomMapping(
EnderIO.blockPaintedFenceGate,
BlockPaintedFenceGate::createItemStackForSourceBlock,
i));
register(
i -> new PaintedCustomMapping(
EnderIO.blockPaintedCarpet,
BlockPaintedCarpet::createItemStackForSourceBlock,
i));
register(
i -> new PaintedCustomMapping(
EnderIO.blockPaintedSlab,
BlockPaintedSlab::createItemStackForSourceBlock,
i));
register(
i -> new PaintedCustomMapping(
EnderIO.blockPaintedWall,
BlockPaintedWall::createItemStackForSourceBlock,
i));
register(
i -> new PaintedCustomMapping(
EnderIO.blockPaintedDoubleSlab,
BlockPaintedSlab::createItemStackForSourceBlock,
i));
}
private static void register(IntFunction<ICustomMapping> mapping) {
for (int i = 0; i < 16; i++) {
BetterBuildersWandsMod.instance.mappingManager.setMapping(mapping.apply(i));
}
}
}
@@ -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()));
@@ -47,8 +47,8 @@ public class ExistingItemFilter implements IItemFilter {
private boolean isStackInInventory(NetworkedInventory ni, ItemStack item) {
int[] slots = ni.getInventory().getAccessibleSlotsFromSide(ni.getInventorySide());
for (int i = 0; i < slots.length; i++) {
ItemStack stack = ni.getInventory().getStackInSlot(i);
for (int slot : slots) {
ItemStack stack = ni.getInventory().getStackInSlot(slot);
if (stackEqual(item, stack)) {
return true;
}
@@ -116,8 +116,8 @@ public class ExistingItemFilter implements IItemFilter {
snapshot = new ArrayList<>();
}
int[] slots = ni.getInventory().getAccessibleSlotsFromSide(ni.getInventorySide());
for (int i = 0; i < slots.length; i++) {
ItemStack stack = ni.getInventory().getStackInSlot(i);
for (int slot : slots) {
ItemStack stack = ni.getInventory().getStackInSlot(slot);
if (stack != null && !isStackInSnapshot(stack)) {
snapshot.add(stack);
}
@@ -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);
@@ -152,8 +152,9 @@ public class CrusherRecipeManager {
if (input == null) {
return null;
}
MachineRecipeInput[] machineInputs = { new MachineRecipeInput(0, input) };
for (Recipe recipe : recipes) {
if (recipe.isInputForRecipe(new MachineRecipeInput(0, input))) {
if (recipe.isInputForRecipe(machineInputs)) {
return recipe;
}
}
@@ -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]);
}
}
@@ -31,12 +31,15 @@ public class BasicManyToOneRecipe implements IManyToOneRecipe {
@Override
public boolean isValidRecipeComponents(ItemStack... items) {
List<RecipeInput> inputs = new ArrayList<>(Arrays.asList(recipe.getInputs()));
for (ItemStack is : items) {
List<RecipeInput> inputs = new ArrayList<RecipeInput>(Arrays.asList(recipe.getInputs()));
for (int slot = 0; slot < items.length; slot++) {
ItemStack is = items[slot];
if (is != null) {
RecipeInput remove = null;
for (RecipeInput ri : inputs) {
if (ri.isInput(is)) {
int riSlot = ri.getSlotNumber();
// Match by item type and, if the recipe specifies a slot, also by slot index
if (ri.isInput(is) && (riSlot == -1 || riSlot == slot)) {
remove = ri;
break;
}
@@ -38,38 +38,46 @@ public class Recipe implements IRecipe {
return false;
}
List<RecipeInput> requiredInputs = new ArrayList<>();
for (RecipeInput input : inputs) {
if (input.getFluidInput() != null || input.getInput() != null) {
requiredInputs.add(input.copy());
int[] remaining = new int[inputs.length];
for (int i = 0; i < inputs.length; i++) {
RecipeInput input = inputs[i];
if (input.isFluid()) {
remaining[i] = input.getFluidInput().amount;
} else if (input.getInput() != null) {
remaining[i] = input.getInput().stackSize;
}
}
for (MachineRecipeInput input : machineInputs) {
if (input != null && (input.fluid != null || input.item != null)) {
RecipeInput required = null;
for (int i = 0; i < requiredInputs.size() && required == null; i++) {
RecipeInput tst = requiredInputs.get(i);
if ((tst.isInput(input.item) && tst.getInput().stackSize > 0) || tst.isInput(input.fluid)) {
required = tst;
}
for (MachineRecipeInput machineInput : machineInputs) {
if (machineInput == null || (machineInput.item == null && machineInput.fluid == null)) {
continue;
}
int matchedInput = -1;
for (int i = 0; i < inputs.length; i++) {
if (remaining[i] <= 0) {
continue;
}
if (required == null) {
return false;
}
// reduce the required input quantity by the available amount
if (input.isFluid()) {
required.getFluidInput().amount -= input.fluid.amount;
} else {
required.getInput().stackSize -= input.item.stackSize;
RecipeInput required = inputs[i];
boolean matches = machineInput.isFluid() ? required.isInput(machineInput.fluid)
: required.isInput(machineInput.item);
if (matches) {
matchedInput = i;
break;
}
}
}
for (RecipeInput required : requiredInputs) {
if (required.isFluid() && required.getFluidInput().amount > 0) {
if (matchedInput < 0) {
return false;
} else if (!required.isFluid() && required.getInput().stackSize > 0) {
}
remaining[matchedInput] -= machineInput.isFluid() ? machineInput.fluid.amount : machineInput.item.stackSize;
}
for (int amount : remaining) {
if (amount > 0) {
return false;
}
}
@@ -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) {