1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 11:45:51 +00:00

Fix energy regulators when exploded

This commit is contained in:
dNiym 2019-08-21 21:50:32 -04:00
parent cb702c078b
commit 2aeefab235

View File

@ -141,12 +141,14 @@ public class EnergyNet extends Network {
EnergyHologram.update(b, "&4No Energy Network found");
}
else {
HashSet<Location> exploded = new HashSet<>();
for (final Location source: input) {
long timestamp = System.currentTimeMillis();
SlimefunItem item = BlockStorage.check(source);
double energy = item.getEnergyTicker().generateEnergy(source, item, BlockStorage.getLocationInfo(source));
if (item.getEnergyTicker().explode(source)) {
exploded.add(source);
BlockStorage.clearBlockInfo(source);
Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance, () -> {
source.getBlock().setType(Material.LAVA);
@ -159,6 +161,8 @@ public class EnergyNet extends Network {
TickerTask.block_timings.put(source, System.currentTimeMillis() - timestamp);
}
input.removeAll(exploded);
for (Location battery: storage) {
supply = supply + ChargableBlock.getCharge(battery);
}