Make a change to prevent networks leaking on chunk unload.
It seems to have fixed the broken pipe issue as well, please test.
This commit is contained in:
parent
22282fc838
commit
53d8522d42
3 changed files with 11 additions and 5 deletions
|
@ -115,7 +115,7 @@ public class TransmitterNetworkRegistry
|
||||||
|
|
||||||
for(IGridTransmitter invalid : invalidTransmitters)
|
for(IGridTransmitter invalid : invalidTransmitters)
|
||||||
{
|
{
|
||||||
if(!invalid.isOrphan())
|
if(!(invalid.isOrphan() && invalid.isValid()))
|
||||||
{
|
{
|
||||||
DynamicNetwork n = invalid.getTransmitterNetwork();
|
DynamicNetwork n = invalid.getTransmitterNetwork();
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ public class TransmitterNetworkRegistry
|
||||||
case 0:
|
case 0:
|
||||||
if(MekanismAPI.debug)
|
if(MekanismAPI.debug)
|
||||||
{
|
{
|
||||||
logger.info("No networks found. Creating new network");
|
logger.info("No networks found. Creating new network for " + finder.connectedTransmitters.size() + " transmitters");
|
||||||
}
|
}
|
||||||
|
|
||||||
network = startOrphan.createEmptyNetwork();
|
network = startOrphan.createEmptyNetwork();
|
||||||
|
@ -172,7 +172,7 @@ public class TransmitterNetworkRegistry
|
||||||
case 1:
|
case 1:
|
||||||
if(MekanismAPI.debug)
|
if(MekanismAPI.debug)
|
||||||
{
|
{
|
||||||
logger.info("Using single found network");
|
logger.info("Adding " + finder.connectedTransmitters.size() + " transmitters to single found network");
|
||||||
}
|
}
|
||||||
|
|
||||||
network = finder.networksFound.iterator().next();
|
network = finder.networksFound.iterator().next();
|
||||||
|
@ -181,7 +181,7 @@ public class TransmitterNetworkRegistry
|
||||||
default:
|
default:
|
||||||
if(MekanismAPI.debug)
|
if(MekanismAPI.debug)
|
||||||
{
|
{
|
||||||
logger.info("Merging " + finder.networksFound.size() + " networks");
|
logger.info("Merging " + finder.networksFound.size() + " networks with " + finder.connectedTransmitters.size() + " new transmitters");
|
||||||
}
|
}
|
||||||
|
|
||||||
network = startOrphan.mergeNetworks(finder.networksFound);
|
network = startOrphan.mergeNetworks(finder.networksFound);
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class MultipartTransmitter<A, N extends DynamicNetwork<A,N>> extends Tran
|
||||||
@Override
|
@Override
|
||||||
public boolean isValid()
|
public boolean isValid()
|
||||||
{
|
{
|
||||||
return !(getPart().tile() == null || getPart().tile().isInvalid()) && coord().exists(world());
|
return getPart().tile() != null && !getPart().tile().isInvalid() && !getPart().unloaded && coord().exists(world());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -13,6 +13,8 @@ public abstract class PartTransmitter<A, N extends DynamicNetwork<A, N>> extends
|
||||||
{
|
{
|
||||||
public MultipartTransmitter<A, N> transmitterDelegate;
|
public MultipartTransmitter<A, N> transmitterDelegate;
|
||||||
|
|
||||||
|
public boolean unloaded = true;
|
||||||
|
|
||||||
public PartTransmitter()
|
public PartTransmitter()
|
||||||
{
|
{
|
||||||
transmitterDelegate = new MultipartTransmitter<>(this);
|
transmitterDelegate = new MultipartTransmitter<>(this);
|
||||||
|
@ -36,6 +38,8 @@ public abstract class PartTransmitter<A, N extends DynamicNetwork<A, N>> extends
|
||||||
else {
|
else {
|
||||||
MinecraftForge.EVENT_BUS.post(new NetworkClientRequest(tile()));
|
MinecraftForge.EVENT_BUS.post(new NetworkClientRequest(tile()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unloaded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract N createNewNetwork();
|
public abstract N createNewNetwork();
|
||||||
|
@ -47,6 +51,8 @@ public abstract class PartTransmitter<A, N extends DynamicNetwork<A, N>> extends
|
||||||
{
|
{
|
||||||
super.onChunkUnload();
|
super.onChunkUnload();
|
||||||
|
|
||||||
|
unloaded = true;
|
||||||
|
|
||||||
if(!world().isRemote)
|
if(!world().isRemote)
|
||||||
{
|
{
|
||||||
getTransmitter().takeShare();
|
getTransmitter().takeShare();
|
||||||
|
|
Loading…
Reference in a new issue