Some bugfixes for the small converters
This commit is contained in:
parent
33cc33170e
commit
16c01a8049
|
@ -46,32 +46,36 @@ public class IWConfig {
|
|||
public static double kinPerEu = 4;
|
||||
|
||||
@Comment({"The maximum amount of IF that can be converted to rotational energy", "by one motor in one tick (default: 100)"})
|
||||
@Config.RequiresWorldRestart
|
||||
public static int maxIfToMech = 100;
|
||||
@Comment({"The efficiency of the IF motor. The default value of 0.9 means that 10% of the energy are lost in the conversion."})
|
||||
public static double ifMotorEfficiency = .9;
|
||||
|
||||
@Comment({"The maximum amount of IE rotational energy that can be converted into IC2 kinetic energy", "by one converter in one tick"})
|
||||
@Config.RequiresWorldRestart
|
||||
public static double maxRotToKin = 200;
|
||||
@Comment({"The efficiency of the conversion from IE rotational energy to IC2 kinetic energy"})
|
||||
public static double rotToKinEfficiency = .7;
|
||||
|
||||
@Comment({"The maximum amount of IC2 kinetic energy that can be converted into IE rotational energy", "by one converter in one tick"})
|
||||
@Config.RequiresWorldRestart
|
||||
public static int maxKinToRot = 600;
|
||||
@Comment({"The efficiency of the conversion from IC2 kinetic energy to IE rotational energy"})
|
||||
public static double kinToRotEfficiency = .8;
|
||||
@Comment({"The conversion factor between Joules (the SI unit) and RF. Used for the Marx generator and the rotary converters"})
|
||||
//Default value assumes the IE diesel generator is 200kW
|
||||
public static double joulesPerRF = 200e3/(20*IEConfig.Machines.dieselGen_output);
|
||||
|
||||
@Comment({"The conversion factor between Joules (the SI unit) and RF. Used for the Marx generator and the rotary converters",
|
||||
"With the default value the IE diesel generator produces 200kW"})
|
||||
public static double joulesPerRF = 200e3 / (20 * IEConfig.Machines.dieselGen_output);
|
||||
@Comment({"What energy types can be used with the mechanical multiblock. 0: None (Probably useless),",
|
||||
"1: EU (Currently useless), 2: FE, 3:EU and FE (allows conversion, default)"})
|
||||
public static int multiblockEnergyType = 3;
|
||||
|
||||
public static boolean allowMBFE() {
|
||||
return (multiblockEnergyType&2)!=0;
|
||||
return (multiblockEnergyType & 2) != 0;
|
||||
}
|
||||
|
||||
public static boolean allowMBEU() {
|
||||
return (multiblockEnergyType&1)!=0 && IndustrialWires.hasIC2;
|
||||
return (multiblockEnergyType & 1) != 0 && IndustrialWires.hasIC2;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,4 +99,4 @@ public class IWConfig {
|
|||
ConfigManager.sync(IndustrialWires.MODID, Config.Type.INSTANCE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -39,8 +39,6 @@ import java.util.Map;
|
|||
import static malte0811.industrialWires.util.NBTKeys.*;
|
||||
|
||||
public class TileEntityIEMotor extends TileEntityIWBase implements ITickable, IFluxReceiver, IDirectionalTile {
|
||||
public final double bufferMax = 2 * MechConversion.maxIfToMech * ConversionUtil.rotPerIf();
|
||||
|
||||
private double rotBuffer = 0;
|
||||
private FluxStorage energy = new FluxStorage(20 * MechConversion.maxIfToMech, 2 * MechConversion.maxIfToMech);
|
||||
private EnumFacing dir = EnumFacing.DOWN;
|
||||
|
@ -54,7 +52,8 @@ public class TileEntityIEMotor extends TileEntityIWBase implements ITickable, IF
|
|||
}
|
||||
int max = MechConversion.maxIfToMech;
|
||||
boolean dirty = false;
|
||||
if (rotBuffer < bufferMax && energy.extractEnergy(max, true) > 0) {
|
||||
if (rotBuffer < 2 * MechConversion.maxIfToMech * ConversionUtil.rotPerIf()
|
||||
&& energy.extractEnergy(max, true) > 0) {
|
||||
int extracted = energy.extractEnergy(max, false);
|
||||
rotBuffer += extracted * ConversionUtil.rotPerIf() * MechConversion.ifMotorEfficiency;
|
||||
dirty = true;
|
||||
|
|
|
@ -33,12 +33,10 @@ import static malte0811.industrialWires.util.NBTKeys.BUFFER;
|
|||
import static malte0811.industrialWires.util.NBTKeys.DIRECTION;
|
||||
|
||||
public class TileEntityMechICtoIE extends TileEntityIWBase implements IDirectionalTile, ITickable {
|
||||
EnumFacing dir = EnumFacing.DOWN;
|
||||
int kinBuffer = 0;
|
||||
private final int kinBufMax = 2 * MechConversion.maxKinToRot;
|
||||
private final double maxInsert = ConversionUtil.rotPerKin() * MechConversion.maxKinToRot;
|
||||
BlockPos to;
|
||||
BlockPos from;
|
||||
private EnumFacing dir = EnumFacing.DOWN;
|
||||
private int kinBuffer = 0;
|
||||
private BlockPos to;
|
||||
private BlockPos from;
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
|
@ -52,14 +50,15 @@ public class TileEntityMechICtoIE extends TileEntityIWBase implements IDirection
|
|||
TileEntity teFrom = world.getTileEntity(from);
|
||||
if (teFrom instanceof IKineticSource) {
|
||||
int sourceMax = ((IKineticSource) teFrom).maxrequestkineticenergyTick(dir);
|
||||
int draw = Math.min(kinBufMax - kinBuffer, sourceMax);
|
||||
int draw = Math.min(2 * MechConversion.maxKinToRot - kinBuffer, sourceMax);
|
||||
if (draw > 0) {
|
||||
kinBuffer += ((IKineticSource) teFrom).requestkineticenergy(dir, draw) * MechConversion.kinToRotEfficiency;
|
||||
}
|
||||
}
|
||||
TileEntity teTo = world.getTileEntity(to);
|
||||
if (kinBuffer > 0 && teTo instanceof IRotationAcceptor) {
|
||||
double out = Math.min(maxInsert, ConversionUtil.rotPerKin() * kinBuffer);
|
||||
double out = Math.min(ConversionUtil.rotPerKin() * MechConversion.maxKinToRot,
|
||||
ConversionUtil.rotPerKin() * kinBuffer);
|
||||
((IRotationAcceptor) teTo).inputRotation(out, dir);
|
||||
kinBuffer -= out * ConversionUtil.kinPerRot();
|
||||
}
|
||||
|
|
|
@ -26,14 +26,13 @@ import net.minecraft.util.EnumFacing;
|
|||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import static malte0811.industrialWires.IWConfig.MechConversion.maxRotToKin;
|
||||
import static malte0811.industrialWires.util.NBTKeys.BUFFER;
|
||||
import static malte0811.industrialWires.util.NBTKeys.DIRECTION;
|
||||
|
||||
public class TileEntityMechIEtoIC extends TileEntityIWBase implements IDirectionalTile, IRotationAcceptor, IKineticSource {
|
||||
EnumFacing dir = EnumFacing.DOWN;
|
||||
double rotBuffer = 0;
|
||||
private final double rotBufMax = 2 * MechConversion.maxRotToKin;
|
||||
private final int maxOutput = (int) (ConversionUtil.kinPerRot() * MechConversion.maxRotToKin);
|
||||
private EnumFacing dir = EnumFacing.DOWN;
|
||||
private double rotBuffer = 0;
|
||||
|
||||
@Override
|
||||
public void writeNBT(NBTTagCompound out, boolean updatePacket) {
|
||||
|
@ -85,8 +84,7 @@ public class TileEntityMechIEtoIC extends TileEntityIWBase implements IDirection
|
|||
@Override
|
||||
public int getConnectionBandwidth(EnumFacing f) {
|
||||
if (f == dir) {
|
||||
int stored = (int) (ConversionUtil.kinPerRot() * rotBuffer);
|
||||
return Math.min(maxOutput, stored);
|
||||
return (int) (ConversionUtil.kinPerRot() * rotBuffer);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
@ -102,8 +100,7 @@ public class TileEntityMechIEtoIC extends TileEntityIWBase implements IDirection
|
|||
public int drawKineticEnergy(EnumFacing f, int requested, boolean simulate) {
|
||||
if (f == dir) {
|
||||
int stored = (int) (ConversionUtil.kinPerRot() * rotBuffer);
|
||||
int out = Math.min(maxOutput, stored);
|
||||
out = Math.min(requested, out);
|
||||
int out = Math.min(requested, stored);
|
||||
if (!simulate) {
|
||||
rotBuffer -= out * ConversionUtil.rotPerKin();
|
||||
}
|
||||
|
@ -117,7 +114,7 @@ public class TileEntityMechIEtoIC extends TileEntityIWBase implements IDirection
|
|||
@Override
|
||||
public void inputRotation(double rotation, @Nonnull EnumFacing side) {
|
||||
if (side == dir) {
|
||||
rotBuffer = Math.min(rotBufMax, rotBuffer + rotation);
|
||||
rotBuffer = Math.min(Math.max(rotBuffer, rotation), maxRotToKin);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue