mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-23 13:29:40 +00:00
Transmitter networks now keep track of all connected sides of acceptors. This should fix many future bugs, and it will also allow me to implement a better caching system for Logistical Transporters.
This commit is contained in:
1 parent
73f23abc84
commit
d3b5676e43
7 files changed
+215
-95
No files matched your search
@@ -2,6 +2,7 @@ package mekanism.api.transmitters;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
@@ -26,7 +27,7 @@ public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implemen
|
||||
public LinkedHashSet<IGridTransmitter<N>> transmitters = new LinkedHashSet<IGridTransmitter<N>>();
|
||||
|
||||
public HashMap<Coord4D, A> possibleAcceptors = new HashMap<Coord4D, A>();
|
||||
public HashMap<A, ForgeDirection> acceptorDirections = new HashMap<A, ForgeDirection>();
|
||||
public HashMap<Coord4D, EnumSet<ForgeDirection>> acceptorDirections = new HashMap<Coord4D, EnumSet<ForgeDirection>>();
|
||||
|
||||
private List<DelayQueue> updateQueue = new ArrayList<DelayQueue>();
|
||||
|
||||
@@ -64,8 +65,12 @@ public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implemen
|
||||
{
|
||||
if(acceptor.getTileEntity(getWorld()) == null || acceptor.getTileEntity(getWorld()).isInvalid() || transmitter.canConnectToAcceptor(side, true))
|
||||
{
|
||||
possibleAcceptors.remove(acceptor);
|
||||
acceptorDirections.remove(acceptor.getTileEntity(getWorld()));
|
||||
acceptorDirections.get(acceptor).remove(side.getOpposite());
|
||||
|
||||
if(acceptorDirections.get(acceptor).isEmpty())
|
||||
{
|
||||
possibleAcceptors.remove(acceptor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,6 +85,16 @@ public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implemen
|
||||
return transmitters.iterator().next().equals(transmitter);
|
||||
}
|
||||
|
||||
public void addSide(Coord4D acceptor, ForgeDirection side)
|
||||
{
|
||||
if(acceptorDirections.get(acceptor) == null)
|
||||
{
|
||||
acceptorDirections.put(acceptor, EnumSet.noneOf(ForgeDirection.class));
|
||||
}
|
||||
|
||||
acceptorDirections.get(acceptor).add(side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fullRefresh()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user