Cables can now pull energy out of other mods blocks.

This commit is contained in:
modmuss50 2019-09-22 14:17:46 +01:00
parent 7f4fb6d80b
commit b70a938796
2 changed files with 18 additions and 5 deletions

View file

@ -131,12 +131,17 @@ public class CableBlockEntity extends BlockEntity
for (Direction face : Direction.values()) {
BlockEntity blockEntity = world.getBlockEntity(pos.offset(face));
if (blockEntity == null) {
continue;
} else if (Energy.valid(blockEntity)) {
if (blockEntity != null && Energy.valid(blockEntity)) {
if (blockEntity instanceof CableBlockEntity && energy <= Energy.of(blockEntity).side(EnergySide.fromMinecraft(face)).getEnergy()) {
continue;
}
if(!(blockEntity instanceof EnergyStorage)){
//Pull energy out of none TR blocks
if(Energy.of(blockEntity).getMaxOutput() > 0){
Energy.of(blockEntity).into(Energy.of(this)).move();
continue;
}
}
acceptors.add(blockEntity);
if (!sendingFace.contains(face)) {
sendingFace.add(face);