mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 14:52:58 +00:00
Induction matrix optimization (#5462)
* Initial work improving performance of Induction Matrix * Have the MatrixData handle more things internally * Internalize more logic in MatrixData * Cleanup readability of two methods * Initial work at queueing energy addition/removal to the matrix. Allows for only reading/writing to the cells once per tick instead of potentially multiple times. * Streamline the energy queuing, add some comments about it, and fix some backwards logic * Improvements to bounds by allowing passing the simulation variable Makes the code cleaner to read * Better handling if something passes a negative value to add/remove * Cleanup UpdateProtocol loopThrough method * Minor cleanup/spacing of UpdateProtocol. Also save queued matrix energy when structure gets destroyed. * Minor cleanup/spacing of various update protocols to improve readability * Minorly improve readability of TileEntityMultiblock * Remove some TODO's as it already properly handles removing/adding cells * Fix creative energy cube output limit * Fix having added extra parenthesis in merge * Add basic comparator support for Induction Port * Cleanup the variables slightly
This commit is contained in:
1 parent
c8d2fbbac8
commit
2809912037
17 files changed
+730
-721
No files matched your search
@@ -15,6 +15,7 @@ import mekanism.common.base.IEnergyWrapper;
|
||||
import mekanism.common.base.target.EnergyAcceptorTarget;
|
||||
import mekanism.common.capabilities.Capabilities;
|
||||
import mekanism.common.integration.ic2.IC2Integration;
|
||||
import mekanism.common.tile.TileEntityInductionPort;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -147,7 +148,12 @@ public final class CableUtils {
|
||||
Set<EnergyAcceptorTarget> targets = new HashSet<>();
|
||||
targets.add(target);
|
||||
double sent = EmitUtils.sendToAcceptors(targets, curHandlers, energyToSend);
|
||||
emitter.setEnergy(emitter.getEnergy() - sent);
|
||||
if (emitter instanceof TileEntityInductionPort) {
|
||||
//Streamline sideless removal method for induction port.
|
||||
((TileEntityInductionPort) emitter).removeEnergy(sent, false);
|
||||
} else {
|
||||
emitter.setEnergy(emitter.getEnergy() - sent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user