Some performance-oriented refactoring of TileComponentConfig

Add new type "SideConfig" which is observable, this could come in handy
later.
Add hasSideForData method in componentConfig, which is much more
efficient than calling getSidesForData().contains.
Refactor duplicate calls to getConfig into single instances. getConfig
is a nontrivial method.
This commit is contained in:
Richard Carter committed 2017-07-23 20:14:34 -04:00
1 parent dc6312e1d3
commit bc3274825a
9 files changed
+163 -70

No files matched your search

@@ -60,10 +60,10 @@ public abstract class TileEntityAdvancedElectricMachine<RECIPE extends AdvancedM
*
* @param soundPath - location of the sound effect
* @param name - full name of this machine
* @param perTick - how much energy this machine uses per tick.
* @param secondaryPerTick - how much secondary energy (fuel) this machine uses per tick.
* @param ticksRequired - how many ticks it takes to smelt an item.
* @param maxEnergy - maximum amount of energy this machine can hold.
* @param baseEnergyUsage - how much energy this machine uses per tick.
* @param ticksRequired - how many ticks it takes to smelt an item.
* @param secondaryPerTick - how much secondary energy (fuel) this machine uses per tick.
*/
public TileEntityAdvancedElectricMachine(String soundPath, String name, double maxEnergy, double baseEnergyUsage, int ticksRequired, int secondaryPerTick)
{
@@ -141,7 +141,7 @@ public abstract class TileEntityAdvancedElectricMachine<RECIPE extends AdvancedM
for(TransmissionType transmission : configComponent.transmissions)
{
factory.configComponent.setConfig(transmission, configComponent.getConfig(transmission));
factory.configComponent.setConfig(transmission, configComponent.getConfig(transmission).asByteArray());
factory.configComponent.setEjecting(transmission, configComponent.isEjecting(transmission));
}