The MjApi is still does not support multiple different channels on one tile.
undergroundminer3 opened this issue ยท 3 comments
I would like to make an engine that takes in MJ, Energy2, Energy3, and produce Energy4. In that engine you could put another battery in and dynamically add Energy5 in.
The recent addition of a "kind" of battery is a step towards channelled mjbatteries,
but I need four batteries in one tile.
To make it clear, make MjBattery's kind not have a default,
and add the "kind" argument to both IBatteryProvider,
and MjApi.getMjBatteryField.
An example of what I want, two batteries in a tile:
https://github.com/undergroundminer3/Unequal-Exchange-4-pipes/blob/master/src/main/java/me/undergroundminer3/uee4/bcReplacements/TileEnginePlus.java
I would also like TileGenericPipe be able to hold both MJ,
and any other energy. (not at the same time).
On the side, could we have PipeType made non-enum?
I would like this to work:
https://github.com/undergroundminer3/Unequal-Exchange-4-pipes/blob/master/src/main/java/me/undergroundminer3/uee4/emcAirTransport2/PipeTransportAir.java
(This is a response to #1756)
Alright #1765 should address the requirements, at least with the annotation method. Let us know if that works for you.
I noticed that you mixed the interface and the annotation API:
@Override
public BatteryObject getBattery(final String channel) {
if (channel.equals(EnergyAPI.batteryChannelMJ)) {
return batteryMj;
}
if (channel.equals(Names2.Energy.CHANNEL_EMCAIR)) {
return batteryEmcAir;
}
//no battery for emcheat
//we output heat???
return null;
}
private EnergyAPI.BatteryObject batteryMj;
private EnergyAPI.BatteryObject batteryEmcAir;
private static class AnoymousBatteryAir {
@EnergyBattery(energyChannel = Names2.Energy.CHANNEL_EMCAIR)
double airStored;
}
private static class AnoymousBatteryEnergy {
@EnergyBattery(energyChannel = EnergyAPI.batteryChannelMJ)
double mjStored;
}
Have you tried a pure annotation method?
@EnergyBattery
private EnergyAPI.BatteryObject batteryMj;
@EnergyBattery
private EnergyAPI.BatteryObject batteryEmcAir;
private static class AnoymousBatteryAir {
@EnergyBattery(energyChannel = Names2.Energy.CHANNEL_EMCAIR)
double airStored;
}
private static class AnoymousBatteryEnergy {
@EnergyBattery(energyChannel = EnergyAPI.batteryChannelMJ)
double mjStored;
}
Carrying-on reviewing your comments - I see the code shortcoming indeed. What you really want I guess is something like:
@EnergyBattery(energyChannel = Names2.Energy.CHANNEL_EMCAIR)
private EnergyAPI.BatteryObject batteryMj;
@EnergyBattery(energyChannel = EnergyAPI.batteryChannelMJ)
private EnergyAPI.BatteryObject batteryEmcAir;
I can see why the previous implementation was missing this. On other elements on your feedback:
- it's really important to have a default channel. I still don't see the benefit of not having one.
- agreed on the update on the interface
- the pipes requests (multiple energy in tile pipes and non-enum TilePipe) requires some substantial design - needs to be discussed again for 6.1. But I understand the need.