Add a config option for wire transfer rates, closes #40

Fix connectors blowing up when they shouldn't in some cases
This commit is contained in:
malte0811 2018-09-03 20:39:04 +02:00
parent 69c8713853
commit 39ebc86029
6 changed files with 25 additions and 21 deletions

View File

@ -33,6 +33,8 @@ public class IWConfig {
@Comment({"The factor between the IF transfer rate of the wires and the IF transfer rate corresponding to the EU transfer rate.",
"The default value results in the same transfer rates as the standard IE wires"})
public static double wireRatio = .5;
@Comment({"The EU IO rates of the wires. Order is Tin, Copper, Gold, HV, Glass Fiber"})
public static double[] ioRatesEU = {32, 128, 512, 2048, 8192};
@Comment({"Set this to false to completely disable any conversion between IF and EU (default: true)"})
@RequiresMcRestart

View File

@ -149,7 +149,7 @@ public class TileEntityIC2ConnectorTin extends TileEntityImmersiveConnectable im
if (bufferToMachine < maxToMachine) {
maxToMachine = bufferToMachine;
}
potentialIEInputInTick = Math.max(Math.max(potentialIEInputInTick, actualIEInputInTick), getMaxIO());
potentialIEInputInTick = Math.min(Math.max(potentialIEInputInTick, actualIEInputInTick), getMaxIO());
if (potentialIEInputInTick > maxToMachine) {
maxToMachine = potentialIEInputInTick;
}

View File

@ -122,6 +122,21 @@ public class Compat {
}
public static class CompatIC2 extends CompatModule {
@Override
public void preInit() {
loadIC2Tile = (te) -> {
if (!te.getWorld().isRemote) {
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent((IEnergyTile) te));
}
};
unloadIC2Tile = (te) -> {
if (!te.getWorld().isRemote) {
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent((IEnergyTile) te));
}
};
getIC2Item = (type, variant) -> ImmutableList.of(IC2Items.getItem(type, variant));
}
public void init() {
Item tinnedFood = IC2Items.getItem("filled_tin_can").getItem();
ItemStack emptyMug = IC2Items.getItem("mug", "empty");
@ -136,17 +151,6 @@ public class Compat {
return a instanceof IBoxable && ((IBoxable) a).canBeStoredInToolbox(s);
});
MechPartCommutator.originalStack = IC2Items.getItem("te", "kinetic_generator");
loadIC2Tile = (te) -> {
if (!te.getWorld().isRemote) {
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent((IEnergyTile) te));
}
};
unloadIC2Tile = (te) ->{
if (!te.getWorld().isRemote) {
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent((IEnergyTile) te));
}
};
getIC2Item = (type, variant)->ImmutableList.of(IC2Items.getItem(type, variant));
try {
Class<?> teb = Class.forName("ic2.core.block.TileEntityBlock");
Method getPickBlock = teb.getDeclaredMethod("getPickBlock", EntityPlayer.class, RayTraceResult.class);

View File

@ -29,13 +29,12 @@ import java.util.Set;
public final class IC2TRHelper {
public static Ingredient getStack(String type, String variant) {
Set<ItemStack> stacks = new HashSet<>();
if (type.equals("crafting")&&variant.equals("rubber")) {
if (ApiUtils.isExistingOreName("itemRubber")) {
return new OreIngredient("itemRubber");
}
}
stacks.addAll(Compat.getIC2Item.apply(type, variant));
Set<ItemStack> stacks = new HashSet<>(Compat.getIC2Item.apply(type, variant));
if (IndustrialWires.hasTechReborn) {
switch (type) {
case "cable":

View File

@ -36,7 +36,6 @@ public class MixedWireType extends WireType {
public static final String IC2_HV_CAT = "IC_HV";
public static final String IC2_GLASS_CAT = "IC_GLASS";
private final int type;
private final int[] ratesEU = {32, 128, 512, 2048, 8192};
private final int[] ic2Colors = {0xa5bcc7, 0xbc7945, 0xfeff73, 0xb9d6d9, 0xf1f1f1};
private final String[] ic2Names = {"ic2Tin", "ic2Copper", "ic2Gold", "ic2Hv", "ic2Glass",
"ic2TinIns", "ic2CopperIns", "ic2GoldIns"};
@ -84,7 +83,7 @@ public class MixedWireType extends WireType {
}
public double getIORate() {
return ratesEU[type%5] * ConversionUtil.joulesPerEu();
return IWConfig.ioRatesEU[type % 5] * ConversionUtil.joulesPerEu();
}
@Override

View File

@ -1,13 +1,13 @@
{
"conditions" : {
"conversion": "malte0811.industrialWires.crafting.factories.IsConversionEnabled",
"other_bundled_redstone": "malte0811.industrialWires.crafting.factories.OtherBundledRedstone"
"conversion": "malte0811.industrialwires.crafting.factories.IsConversionEnabled",
"other_bundled_redstone": "malte0811.industrialwires.crafting.factories.OtherBundledRedstone"
},
"recipes": {
"component_init": "malte0811.industrialWires.crafting.factories.InitPCFactory",
"wire_coil": "malte0811.industrialWires.crafting.factories.WireCoilFactory"
"component_init": "malte0811.industrialwires.crafting.factories.InitPCFactory",
"wire_coil": "malte0811.industrialwires.crafting.factories.WireCoilFactory"
},
"ingredients": {
"ic2_item": "malte0811.industrialWires.crafting.factories.IC2ItemFactory"
"ic2_item": "malte0811.industrialwires.crafting.factories.IC2ItemFactory"
}
}