Add support for configuring machine energy storage. (#5418)

* Add support for configurable machines storage.

* Make factories and tooltips use machine storage from config. Renaming.

- Renamed config instance members, to reduce redundancy
- Made machines get Storage and Usage from MachineType
- Other miscellaneous cosmetic changes on the matter

* Update ItemBlockMachine.java

* Tweak factories to always have storage needed to run all processes.

* Add storage config to PacketConfigSync.
This commit is contained in:
Matej Zajo Kralik authored and Richard Freimer committed 2019-05-01 13:15:55 -04:00
1 parent 14d60702b6
commit 36aa81dcf4
47 files changed
+305 -169

No files matched your search

@@ -82,7 +82,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo
public TileComponentUpgrade upgradeComponent;
public TileEntityTeleporter() {
super("Teleporter", MachineType.TELEPORTER.baseEnergy);
super("Teleporter", MachineType.TELEPORTER.getStorage());
inventory = NonNullList.withSize(2, ItemStack.EMPTY);
securityComponent = new TileComponentSecurity(this);
@@ -398,13 +398,13 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo
}
public int calculateEnergyCost(Entity entity, Coord4D coords) {
int energyCost = MekanismConfig.current().usage.teleporterBaseUsage.val();
int energyCost = MekanismConfig.current().usage.teleporterBase.val();
if (entity.world.provider.getDimension() != coords.dimensionId) {
energyCost += MekanismConfig.current().usage.teleporterDimensionPenalty.val();
} else {
int distance = (int) entity.getDistance(coords.x, coords.y, coords.z);
energyCost += (distance * MekanismConfig.current().usage.teleporterDistanceUsage.val());
energyCost += (distance * MekanismConfig.current().usage.teleporterDistance.val());
}
return energyCost;