Some network tweaks
This commit is contained in:
parent
1cef920e62
commit
d811141896
4 changed files with 13 additions and 11 deletions
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
package resonantinduction.core;
|
||||
|
||||
import resonantinduction.core.grid.ThreadedGridTicker;
|
||||
import resonantinduction.core.grid.UpdateTicker;
|
||||
import net.minecraft.world.World;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.prefab.ProxyBase;
|
||||
|
|
|
@ -11,7 +11,7 @@ import net.minecraftforge.fluids.BlockFluidFinite;
|
|||
import org.modstats.ModstatInfo;
|
||||
import org.modstats.Modstats;
|
||||
|
||||
import resonantinduction.core.grid.ThreadedGridTicker;
|
||||
import resonantinduction.core.grid.UpdateTicker;
|
||||
import resonantinduction.core.handler.TextureHookHandler;
|
||||
import resonantinduction.core.prefab.part.PacketMultiPart;
|
||||
import resonantinduction.core.resource.BlockDust;
|
||||
|
@ -146,14 +146,14 @@ public class ResonantInduction
|
|||
@EventHandler
|
||||
public void serverStarting(FMLServerStartingEvent event)
|
||||
{
|
||||
if (!ThreadedGridTicker.INSTANCE.isAlive())
|
||||
ThreadedGridTicker.INSTANCE.start();
|
||||
ThreadedGridTicker.INSTANCE.pause = false;
|
||||
if (!UpdateTicker.INSTANCE.isAlive())
|
||||
UpdateTicker.INSTANCE.start();
|
||||
UpdateTicker.INSTANCE.pause = false;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onServerStopping(FMLServerStoppingEvent evt)
|
||||
{
|
||||
ThreadedGridTicker.INSTANCE.pause = true;
|
||||
UpdateTicker.INSTANCE.pause = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ public class TickingGrid<N extends Node> extends NodeGrid<N> implements IUpdate
|
|||
{
|
||||
super(type);
|
||||
add(node);
|
||||
ThreadedGridTicker.addNetwork(this);
|
||||
UpdateTicker.addNetwork(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -20,7 +20,7 @@ public class TickingGrid<N extends Node> extends NodeGrid<N> implements IUpdate
|
|||
@Override
|
||||
public void update()
|
||||
{
|
||||
synchronized (nodes)
|
||||
//synchronized (nodes)
|
||||
{
|
||||
for (Node node : nodes)
|
||||
{
|
||||
|
|
|
@ -15,9 +15,9 @@ import java.util.concurrent.ConcurrentLinkedQueue;
|
|||
*
|
||||
* @author Calclavia
|
||||
*/
|
||||
public class ThreadedGridTicker extends Thread
|
||||
public class UpdateTicker extends Thread
|
||||
{
|
||||
public static final ThreadedGridTicker INSTANCE = new ThreadedGridTicker();
|
||||
public static final UpdateTicker INSTANCE = new UpdateTicker();
|
||||
|
||||
/** For updaters to be ticked. */
|
||||
private final Set<IUpdate> updaters = Collections.newSetFromMap(new WeakHashMap<IUpdate, Boolean>());
|
||||
|
@ -27,7 +27,7 @@ public class ThreadedGridTicker extends Thread
|
|||
|
||||
public boolean pause = false;
|
||||
|
||||
public ThreadedGridTicker()
|
||||
public UpdateTicker()
|
||||
{
|
||||
setName("Universal Electricity");
|
||||
setPriority(MIN_PRIORITY);
|
||||
|
@ -105,6 +105,8 @@ public class ThreadedGridTicker extends Thread
|
|||
MinecraftForge.EVENT_BUS.post(queuedEvents.poll());
|
||||
}
|
||||
}
|
||||
|
||||
last = current;
|
||||
}
|
||||
|
||||
Thread.sleep(50L);
|
Loading…
Reference in a new issue