Hopefully fixed negative buffer issue

This commit is contained in:
Aidan C. Brady 2015-03-27 17:09:23 -04:00
parent 543d45d57a
commit 07d0c2bfc1
4 changed files with 16 additions and 46 deletions

View file

@ -7,7 +7,6 @@ import java.util.EnumSet;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import mekanism.api.Coord4D;
@ -16,7 +15,6 @@ import mekanism.api.transmitters.IGridTransmitter;
import mekanism.api.transmitters.ITransmitterNetwork;
import mekanism.api.transmitters.TransmissionType;
import mekanism.api.util.ListUtils;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;
@ -328,27 +326,21 @@ public class GasNetwork extends DynamicNetwork<IGasHandler, GasNetwork>
{
Set<IGridTransmitter<GasNetwork>> iterTubes = (Set<IGridTransmitter<GasNetwork>>)transmitters.clone();
Iterator<IGridTransmitter<GasNetwork>> it = iterTubes.iterator();
boolean networkChanged = false;
while(it.hasNext())
{
IGridTransmitter<GasNetwork> conductor = (IGridTransmitter<GasNetwork>)it.next();
IGridTransmitter<GasNetwork> conductor = it.next();
if(conductor == null || conductor.getTile().isInvalid())
{
it.remove();
networkChanged = true;
transmitters.remove(conductor);
removeTransmitter(conductor);
}
else {
conductor.setTransmitterNetwork(this);
}
}
if(networkChanged)
{
updateCapacity();
}
needsUpdate = true;
}
@Override

View file

@ -1,5 +1,8 @@
package mekanism.common;
import ic2.api.energy.EnergyNet;
import ic2.api.energy.tile.IEnergySink;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
@ -7,7 +10,6 @@ import java.util.EnumSet;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import mekanism.api.Coord4D;
@ -19,17 +21,13 @@ import mekanism.api.transmitters.TransmissionType;
import mekanism.api.util.ListUtils;
import mekanism.common.util.CableUtils;
import mekanism.common.util.MekanismUtils;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;
import cofh.api.energy.IEnergyReceiver;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.Event;
import cofh.api.energy.IEnergyReceiver;
import ic2.api.energy.EnergyNet;
import ic2.api.energy.tile.IEnergySink;
public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork>
{
private double lastPowerScale = 0;
@ -304,7 +302,6 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork>
{
Set<IGridTransmitter<EnergyNetwork>> iterCables = (Set<IGridTransmitter<EnergyNetwork>>)transmitters.clone();
Iterator<IGridTransmitter<EnergyNetwork>> it = iterCables.iterator();
boolean networkChanged = false;
while(it.hasNext())
{
@ -312,20 +309,13 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork>
if(conductor == null || conductor.getTile().isInvalid())
{
it.remove();
transmitters.remove(conductor);
networkChanged = true;
removeTransmitter(conductor);
}
else {
conductor.setTransmitterNetwork(this);
}
}
if(networkChanged)
{
updateCapacity();
}
needsUpdate = true;
}

View file

@ -342,8 +342,7 @@ public class FluidNetwork extends DynamicNetwork<IFluidHandler, FluidNetwork>
public synchronized void refresh()
{
Set<IGridTransmitter<FluidNetwork>> iterPipes = (Set<IGridTransmitter<FluidNetwork>>)transmitters.clone();
Iterator it = iterPipes.iterator();
boolean networkChanged = false;
Iterator<IGridTransmitter<FluidNetwork>> it = iterPipes.iterator();
while(it.hasNext())
{
@ -351,19 +350,14 @@ public class FluidNetwork extends DynamicNetwork<IFluidHandler, FluidNetwork>
if(conductor == null || conductor.getTile().isInvalid())
{
it.remove();
networkChanged = true;
transmitters.remove(conductor);
removeTransmitter(conductor);
}
else {
conductor.setTransmitterNetwork(this);
}
}
if(networkChanged)
{
updateCapacity();
}
needsUpdate = true;
}
@Override

View file

@ -137,7 +137,6 @@ public class InventoryNetwork extends DynamicNetwork<IInventory, InventoryNetwor
{
Set<IGridTransmitter<InventoryNetwork>> iterPipes = (Set<IGridTransmitter<InventoryNetwork>>)transmitters.clone();
Iterator it = iterPipes.iterator();
boolean networkChanged = false;
while(it.hasNext())
{
@ -145,19 +144,14 @@ public class InventoryNetwork extends DynamicNetwork<IInventory, InventoryNetwor
if(conductor == null || conductor.getTile().isInvalid())
{
it.remove();
networkChanged = true;
transmitters.remove(conductor);
removeTransmitter(conductor);
}
else {
conductor.setTransmitterNetwork(this);
}
}
if(networkChanged)
{
updateCapacity();
}
needsUpdate = true;
}
@Override