Merge remote-tracking branch 'origin/master' into fabric-1.16
# Conflicts: # src/main/java/appeng/block/spatial/SpatialPylonBlock.java # src/main/java/appeng/client/render/spatial/SpatialPylonBakedModel.java # src/main/java/appeng/core/AppEng.java # src/main/java/appeng/hooks/TickHandler.java # src/main/java/appeng/me/cluster/MBCalculator.java # src/main/java/appeng/me/cluster/implementations/CraftingCPUCluster.java # src/main/java/appeng/me/cluster/implementations/QuantumCluster.java # src/main/java/appeng/me/cluster/implementations/SpatialPylonCluster.java # src/main/java/appeng/me/helpers/AENetworkProxy.java # src/main/java/appeng/tile/networking/CableBusBlockEntity.java # src/main/java/appeng/tile/networking/DenseEnergyCellBlockEntity.java # src/main/java/appeng/tile/qnb/QuantumBridgeBlockEntity.java # src/main/java/appeng/tile/spatial/SpatialPylonBlockEntity.java # src/main/java/appeng/util/Platform.java
This commit is contained in:
+16
-3
@@ -23,16 +23,18 @@ import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.NavigableSet;
|
||||
import java.util.PriorityQueue;
|
||||
import java.util.Queue;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
|
||||
import com.google.common.collect.HashMultiset;
|
||||
import com.google.common.collect.Multiset;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectRBTreeSet;
|
||||
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
@@ -72,10 +74,15 @@ public class EnergyGridCache implements IEnergyGrid {
|
||||
return Double.compare(percent1, percent2);
|
||||
};
|
||||
|
||||
private static final Comparator<IAEPowerStorage> COMPARATOR_HIGHEST_PRIORITY_FIRST = (o1, o2) -> Integer
|
||||
.compare(o2.getPriority(), o1.getPriority());
|
||||
private static final Comparator<IAEPowerStorage> COMPARATOR_LOWEST_PRIORITY_FIRST = (o1, o2) -> Integer
|
||||
.compare(o1.getPriority(), o2.getPriority());
|
||||
|
||||
private final NavigableSet<EnergyThreshold> interests = Sets.newTreeSet();
|
||||
private final double averageLength = 40.0;
|
||||
private final Set<IAEPowerStorage> providers = new LinkedHashSet<>();
|
||||
private final Set<IAEPowerStorage> requesters = new LinkedHashSet<>();
|
||||
private final SortedSet<IAEPowerStorage> providers = new ObjectRBTreeSet<>(COMPARATOR_HIGHEST_PRIORITY_FIRST);
|
||||
private final SortedSet<IAEPowerStorage> requesters = new ObjectRBTreeSet<>(COMPARATOR_LOWEST_PRIORITY_FIRST);
|
||||
private final Multiset<IEnergyGridProvider> energyGridProviders = HashMultiset.create();
|
||||
private final IGrid myGrid;
|
||||
private final HashMap<IGridNode, IEnergyWatcher> watchers = new HashMap<>();
|
||||
@@ -572,6 +579,12 @@ public class EnergyGridCache implements IEnergyGrid {
|
||||
return this.stored;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPriority() {
|
||||
// MIN_VALUE to push it to the back
|
||||
return Integer.MIN_VALUE;
|
||||
}
|
||||
|
||||
private void addCurrentAEPower(double amount) {
|
||||
this.stored += amount;
|
||||
|
||||
|
||||
+32
-20
@@ -82,21 +82,21 @@ public class SpatialPylonCache implements ISpatialCache {
|
||||
int pylonBlocks = 0;
|
||||
for (final SpatialPylonCluster cl : this.clusters.values()) {
|
||||
if (this.captureMax == null) {
|
||||
this.captureMax = cl.getMax().copy();
|
||||
this.captureMax = new DimensionalCoord(cl.getWorld(), cl.getBoundsMax());
|
||||
}
|
||||
if (this.captureMin == null) {
|
||||
this.captureMin = cl.getMin().copy();
|
||||
this.captureMin = new DimensionalCoord(cl.getWorld(), cl.getBoundsMin());
|
||||
}
|
||||
|
||||
pylonBlocks += cl.tileCount();
|
||||
|
||||
this.captureMin.x = Math.min(this.captureMin.x, cl.getMin().x);
|
||||
this.captureMin.y = Math.min(this.captureMin.y, cl.getMin().y);
|
||||
this.captureMin.z = Math.min(this.captureMin.z, cl.getMin().z);
|
||||
this.captureMin.x = Math.min(this.captureMin.x, cl.getBoundsMin().getX());
|
||||
this.captureMin.y = Math.min(this.captureMin.y, cl.getBoundsMin().getY());
|
||||
this.captureMin.z = Math.min(this.captureMin.z, cl.getBoundsMin().getZ());
|
||||
|
||||
this.captureMax.x = Math.max(this.captureMax.x, cl.getMax().x);
|
||||
this.captureMax.y = Math.max(this.captureMax.y, cl.getMax().y);
|
||||
this.captureMax.z = Math.max(this.captureMax.z, cl.getMax().z);
|
||||
this.captureMax.x = Math.max(this.captureMax.x, cl.getBoundsMax().getX());
|
||||
this.captureMax.y = Math.max(this.captureMax.y, cl.getBoundsMax().getY());
|
||||
this.captureMax.z = Math.max(this.captureMax.z, cl.getBoundsMax().getZ());
|
||||
}
|
||||
|
||||
double maxPower = 0;
|
||||
@@ -110,28 +110,40 @@ public class SpatialPylonCache implements ISpatialCache {
|
||||
case X:
|
||||
|
||||
this.isValid = this.isValid
|
||||
&& ((this.captureMax.y == cl.getMin().y || this.captureMin.y == cl.getMax().y)
|
||||
|| (this.captureMax.z == cl.getMin().z || this.captureMin.z == cl.getMax().z))
|
||||
&& ((this.captureMax.y == cl.getMax().y || this.captureMin.y == cl.getMin().y)
|
||||
|| (this.captureMax.z == cl.getMax().z || this.captureMin.z == cl.getMin().z));
|
||||
&& ((this.captureMax.y == cl.getBoundsMin().getY()
|
||||
|| this.captureMin.y == cl.getBoundsMax().getY())
|
||||
|| (this.captureMax.z == cl.getBoundsMin().getZ()
|
||||
|| this.captureMin.z == cl.getBoundsMax().getZ()))
|
||||
&& ((this.captureMax.y == cl.getBoundsMax().getY()
|
||||
|| this.captureMin.y == cl.getBoundsMin().getY())
|
||||
|| (this.captureMax.z == cl.getBoundsMax().getZ()
|
||||
|| this.captureMin.z == cl.getBoundsMin().getZ()));
|
||||
|
||||
break;
|
||||
case Y:
|
||||
|
||||
this.isValid = this.isValid
|
||||
&& ((this.captureMax.x == cl.getMin().x || this.captureMin.x == cl.getMax().x)
|
||||
|| (this.captureMax.z == cl.getMin().z || this.captureMin.z == cl.getMax().z))
|
||||
&& ((this.captureMax.x == cl.getMax().x || this.captureMin.x == cl.getMin().x)
|
||||
|| (this.captureMax.z == cl.getMax().z || this.captureMin.z == cl.getMin().z));
|
||||
&& ((this.captureMax.x == cl.getBoundsMin().getX()
|
||||
|| this.captureMin.x == cl.getBoundsMax().getX())
|
||||
|| (this.captureMax.z == cl.getBoundsMin().getZ()
|
||||
|| this.captureMin.z == cl.getBoundsMax().getZ()))
|
||||
&& ((this.captureMax.x == cl.getBoundsMax().getX()
|
||||
|| this.captureMin.x == cl.getBoundsMin().getX())
|
||||
|| (this.captureMax.z == cl.getBoundsMax().getZ()
|
||||
|| this.captureMin.z == cl.getBoundsMin().getZ()));
|
||||
|
||||
break;
|
||||
case Z:
|
||||
|
||||
this.isValid = this.isValid
|
||||
&& ((this.captureMax.y == cl.getMin().y || this.captureMin.y == cl.getMax().y)
|
||||
|| (this.captureMax.x == cl.getMin().x || this.captureMin.x == cl.getMax().x))
|
||||
&& ((this.captureMax.y == cl.getMax().y || this.captureMin.y == cl.getMin().y)
|
||||
|| (this.captureMax.x == cl.getMax().x || this.captureMin.x == cl.getMin().x));
|
||||
&& ((this.captureMax.y == cl.getBoundsMin().getY()
|
||||
|| this.captureMin.y == cl.getBoundsMax().getY())
|
||||
|| (this.captureMax.x == cl.getBoundsMin().getX()
|
||||
|| this.captureMin.x == cl.getBoundsMax().getX()))
|
||||
&& ((this.captureMax.y == cl.getBoundsMax().getY()
|
||||
|| this.captureMin.y == cl.getBoundsMin().getY())
|
||||
|| (this.captureMax.x == cl.getBoundsMax().getX()
|
||||
|| this.captureMin.x == cl.getBoundsMin().getX()));
|
||||
|
||||
break;
|
||||
case UNFORMED:
|
||||
|
||||
Reference in New Issue
Block a user