mirror of
https://github.com/GTNewHorizons/Opis.git
synced 2026-11-20 04:09:41 +00:00
Directory structure for ForgeGradle
This commit is contained in:
1 parent
3d8319dc6b
commit
04764c83c9
214 files changed
+104
-6
No files matched your search
@@ -0,0 +1,39 @@
|
||||
package mcp.mobius.opis.data.profilers;
|
||||
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import mcp.mobius.opis.modOpis;
|
||||
import mcp.mobius.opis.data.profilers.Clock.IClock;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
|
||||
|
||||
public class ProfilerRenderEntity extends ProfilerAbstract {
|
||||
|
||||
public WeakHashMap<Entity, DescriptiveStatistics> data = new WeakHashMap<Entity, DescriptiveStatistics>();
|
||||
private IClock clock = Clock.getNewClock();
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
data.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Object key){
|
||||
Entity entity = (Entity)key;
|
||||
if (!data.containsKey(entity))
|
||||
data.put(entity, new DescriptiveStatistics());
|
||||
|
||||
clock.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(Object key){
|
||||
clock.stop();
|
||||
try{
|
||||
data.get((Entity)key).addValue((double)clock.getDelta());
|
||||
} catch (Exception e) {
|
||||
modOpis.log.warning(String.format("Error while profiling entity %s\n", key));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user