TickHandlers are now enum singletons.

This commit is contained in:
ProfMobius committed 2014-04-09 14:58:51 +02:00
1 parent ceb1b4d6e8
commit 37e6c46d80
4 files changed
+11 -19

No files matched your search

@@ -10,7 +10,7 @@ public class MetaManager {
public static void reset(){
modOpis.profilerRun = false;
modOpis.selectedBlock = null;
OpisServerTickHandler.instance.profilerRunningTicks = 0;
OpisServerTickHandler.INSTANCE.profilerRunningTicks = 0;
ProfilerSection.resetAll(Side.SERVER);
ProfilerSection.desactivateAll(Side.SERVER);
@@ -25,18 +25,13 @@ import cpw.mods.fml.common.TickType;
import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.relauncher.Side;
public class OpisClientTickHandler implements ITickHandler {
public enum OpisClientTickHandler implements ITickHandler {
INSTANCE;
public long profilerUpdateTickCounter = 0;
public long profilerRunningTicks = 0;
public long timer1000 = System.nanoTime();
public static OpisClientTickHandler instance;
public OpisClientTickHandler(){
instance = this;
}
@Override
public void tickStart(EnumSet<TickType> type, Object... tickData) {}
@@ -49,6 +44,8 @@ public class OpisClientTickHandler implements ITickHandler {
timer1000 = System.nanoTime();
}
if (modOpis.profilerRunClient){
((PanelRenderTileEnts)(TabPanelRegistrar.INSTANCE.getTab("opis.client.terender"))).getBtnRunRender().setText("Running...");
((PanelRenderEntities)(TabPanelRegistrar.INSTANCE.getTab("opis.client.entrender"))).getBtnRunRender().setText("Running...");
@@ -40,20 +40,15 @@ import cpw.mods.fml.common.network.Player;
import cpw.mods.fml.relauncher.Side;
import mcp.mobius.mobiuscore.profiler.ProfilerSection;
public class OpisServerTickHandler implements ITickHandler {
public enum OpisServerTickHandler implements ITickHandler {
INSTANCE;
public long profilerUpdateTickCounter = 0;
public int profilerRunningTicks;
public long timer500 = System.nanoTime();
public long timer1000 = System.nanoTime();
public long timer5000 = System.nanoTime();
public static OpisServerTickHandler instance;
public OpisServerTickHandler(){
instance = this;
}
@Override
public void tickStart(EnumSet<TickType> type, Object... tickData) {
}
+2 -2
View File
@@ -134,8 +134,8 @@ public class modOpis {
@EventHandler
public void load(FMLInitializationEvent event) {
TickRegistry.registerTickHandler(new OpisServerTickHandler(), Side.SERVER);
TickRegistry.registerTickHandler(new OpisClientTickHandler(), Side.CLIENT);
TickRegistry.registerTickHandler(OpisServerTickHandler.INSTANCE, Side.SERVER);
TickRegistry.registerTickHandler(OpisClientTickHandler.INSTANCE, Side.CLIENT);
if (lagGenID != -1){
Block blockDemo = new BlockLag(lagGenID, Material.wood);