Remove expensive debugcalls from production code

This commit is contained in:
Erik Broes 2011-11-26 18:27:39 +01:00
parent 9907638130
commit ba608f55e4
4 changed files with 50 additions and 50 deletions

View file

@ -192,7 +192,7 @@ public abstract class Entity {
} }
public void af() { public void af() {
MethodProfiler.a("entityBaseTick"); // MethodProfiler.a("entityBaseTick"); // CraftBukkit -- not in production code
if (this.vehicle != null && this.vehicle.dead) { if (this.vehicle != null && this.vehicle.dead) {
this.vehicle = null; this.vehicle = null;
} }
@ -295,7 +295,7 @@ public abstract class Entity {
} }
this.justCreated = false; this.justCreated = false;
MethodProfiler.a(); // MethodProfiler.a(); // CraftBukkit -- not in production code
} }
protected void av() { protected void av() {
@ -365,7 +365,7 @@ public abstract class Entity {
this.locY = this.boundingBox.b + (double) this.height - (double) this.bL; this.locY = this.boundingBox.b + (double) this.height - (double) this.bL;
this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D; this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D;
} else { } else {
MethodProfiler.a("move"); // MethodProfiler.a("move"); // CraftBukkit -- not in production code
this.bL *= 0.4F; this.bL *= 0.4F;
double d3 = this.locX; double d3 = this.locX;
double d4 = this.locZ; double d4 = this.locZ;
@ -527,8 +527,8 @@ public abstract class Entity {
} }
} }
MethodProfiler.a(); // MethodProfiler.a(); // CraftBukkit -- not in production code
MethodProfiler.a("rest"); // MethodProfiler.a("rest"); // CraftBukkit -- not in production code
this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D; this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D;
this.locY = this.boundingBox.b + (double) this.height - (double) this.bL; this.locY = this.boundingBox.b + (double) this.height - (double) this.bL;
this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D; this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D;
@ -641,7 +641,7 @@ public abstract class Entity {
this.fireTicks = -this.maxFireTicks; this.fireTicks = -this.maxFireTicks;
} }
MethodProfiler.a(); // MethodProfiler.a(); // CraftBukkit -- not in production code
} }
} }

View file

@ -22,7 +22,7 @@ public abstract class EntityCreature extends EntityLiving {
} }
protected void m_() { protected void m_() {
MethodProfiler.a("ai"); // MethodProfiler.a("ai"); // CraftBukkit -- not in production code
if (this.f > 0) { if (this.f > 0) {
--this.f; --this.f;
} }
@ -73,7 +73,7 @@ public abstract class EntityCreature extends EntityLiving {
} }
} }
MethodProfiler.a(); // MethodProfiler.a(); // CraftBukkit -- not in production code
if (!this.e && this.target != null && (this.pathEntity == null || this.random.nextInt(20) == 0)) { if (!this.e && this.target != null && (this.pathEntity == null || this.random.nextInt(20) == 0)) {
this.pathEntity = this.world.findPath(this, this.target, f); this.pathEntity = this.world.findPath(this, this.target, f);
} else if (!this.e && (this.pathEntity == null && this.random.nextInt(180) == 0 || this.random.nextInt(120) == 0 || this.f > 0) && this.aS < 100) { } else if (!this.e && (this.pathEntity == null && this.random.nextInt(180) == 0 || this.random.nextInt(120) == 0 || this.f > 0) && this.aS < 100) {
@ -86,7 +86,7 @@ public abstract class EntityCreature extends EntityLiving {
this.pitch = 0.0F; this.pitch = 0.0F;
if (this.pathEntity != null && this.random.nextInt(100) != 0) { if (this.pathEntity != null && this.random.nextInt(100) != 0) {
MethodProfiler.a("followpath"); // MethodProfiler.a("followpath"); // CraftBukkit -- not in production code
Vec3D vec3d = this.pathEntity.a(this); Vec3D vec3d = this.pathEntity.a(this);
double d0 = (double) (this.length * 2.0F); double d0 = (double) (this.length * 2.0F);
@ -154,7 +154,7 @@ public abstract class EntityCreature extends EntityLiving {
this.aW = true; this.aW = true;
} }
MethodProfiler.a(); // MethodProfiler.a(); // CraftBukkit -- not in production code
} else { } else {
super.m_(); super.m_();
this.pathEntity = null; this.pathEntity = null;
@ -162,7 +162,7 @@ public abstract class EntityCreature extends EntityLiving {
} }
protected void C() { protected void C() {
MethodProfiler.a("stroll"); // MethodProfiler.a("stroll"); // CraftBukkit -- not in production code
boolean flag = false; boolean flag = false;
int i = -1; int i = -1;
int j = -1; int j = -1;
@ -188,7 +188,7 @@ public abstract class EntityCreature extends EntityLiving {
this.pathEntity = this.world.a(this, i, j, k, 10.0F); this.pathEntity = this.world.a(this, i, j, k, 10.0F);
} }
MethodProfiler.a(); // MethodProfiler.a(); // CraftBukkit -- not in production code
} }
protected void a(Entity entity, float f) {} protected void a(Entity entity, float f) {}

View file

@ -128,7 +128,7 @@ public abstract class EntityLiving extends Entity {
public void af() { public void af() {
this.am = this.an; this.am = this.an;
super.af(); super.af();
MethodProfiler.a("mobBaseTick"); // MethodProfiler.a("mobBaseTick"); // CraftBukkit -- not in production code
if (this.random.nextInt(1000) < this.a++) { if (this.random.nextInt(1000) < this.a++) {
this.a = -this.h(); this.a = -this.h();
this.ae(); this.ae();
@ -205,7 +205,7 @@ public abstract class EntityLiving extends Entity {
this.W = this.V; this.W = this.V;
this.lastYaw = this.yaw; this.lastYaw = this.yaw;
this.lastPitch = this.pitch; this.lastPitch = this.pitch;
MethodProfiler.a(); // MethodProfiler.a(); // CraftBukkit -- not in production code
} }
// CraftBukkit start // CraftBukkit start
@ -874,7 +874,7 @@ public abstract class EntityLiving extends Entity {
} }
} }
MethodProfiler.a("ai"); // MethodProfiler.a("ai"); // CraftBukkit -- not in production code
if (this.L()) { if (this.L()) {
this.aW = false; this.aW = false;
this.aT = 0.0F; this.aT = 0.0F;
@ -884,7 +884,7 @@ public abstract class EntityLiving extends Entity {
this.m_(); this.m_();
} }
MethodProfiler.a(); // MethodProfiler.a(); // CraftBukkit -- not in production code
boolean flag = this.az(); boolean flag = this.az();
boolean flag1 = this.aA(); boolean flag1 = this.aA();
@ -909,7 +909,7 @@ public abstract class EntityLiving extends Entity {
this.ak *= this.F(); this.ak *= this.F();
this.a(this.aT, this.aU); this.a(this.aT, this.aU);
this.ak = f; this.ak = f;
MethodProfiler.a("push"); // MethodProfiler.a("push"); // CraftBukkit -- not in production code
List list1 = this.world.b((Entity) this, this.boundingBox.b(0.20000000298023224D, 0.0D, 0.20000000298023224D)); List list1 = this.world.b((Entity) this, this.boundingBox.b(0.20000000298023224D, 0.0D, 0.20000000298023224D));
if (list1 != null && list1.size() > 0) { if (list1 != null && list1.size() > 0) {
@ -922,7 +922,7 @@ public abstract class EntityLiving extends Entity {
} }
} }
MethodProfiler.a(); // MethodProfiler.a(); // CraftBukkit -- not in production code
} }
protected boolean L() { protected boolean L() {

View file

@ -1084,8 +1084,8 @@ public class World implements IBlockAccess {
} }
public void tickEntities() { public void tickEntities() {
MethodProfiler.a("entities"); // MethodProfiler.a("entities"); // CraftBukkit -- not in production code
MethodProfiler.a("global"); // MethodProfiler.a("global"); // CraftBukkit -- not in production code
int i; int i;
Entity entity; Entity entity;
@ -1103,7 +1103,7 @@ public class World implements IBlockAccess {
} }
} }
MethodProfiler.b("remove"); // MethodProfiler.b("remove"); // CraftBukkit -- not in production code
this.entityList.removeAll(this.J); this.entityList.removeAll(this.J);
int j; int j;
@ -1123,7 +1123,7 @@ public class World implements IBlockAccess {
} }
this.J.clear(); this.J.clear();
MethodProfiler.b("regular"); // MethodProfiler.b("regular"); // CraftBukkit -- not in production code
for (i = 0; i < this.entityList.size(); ++i) { for (i = 0; i < this.entityList.size(); ++i) {
entity = (Entity) this.entityList.get(i); entity = (Entity) this.entityList.get(i);
@ -1140,7 +1140,7 @@ public class World implements IBlockAccess {
this.playerJoinedWorld(entity); this.playerJoinedWorld(entity);
} }
MethodProfiler.a("remove"); // MethodProfiler.a("remove"); // CraftBukkit -- not in production code
if (entity.dead) { if (entity.dead) {
j = entity.bX; j = entity.bX;
k = entity.bZ; k = entity.bZ;
@ -1152,10 +1152,10 @@ public class World implements IBlockAccess {
this.d(entity); this.d(entity);
} }
MethodProfiler.a(); // MethodProfiler.a(); // CraftBukkit -- not in production code
} }
MethodProfiler.b("tileEntities"); // MethodProfiler.b("tileEntities"); // CraftBukkit -- not in production code
this.S = true; this.S = true;
Iterator iterator = this.h.iterator(); Iterator iterator = this.h.iterator();
@ -1184,7 +1184,7 @@ public class World implements IBlockAccess {
this.N.clear(); this.N.clear();
} }
MethodProfiler.b("pendingTileEntities"); // MethodProfiler.b("pendingTileEntities"); // CraftBukkit -- not in production code
if (!this.M.isEmpty()) { if (!this.M.isEmpty()) {
Iterator iterator1 = this.M.iterator(); Iterator iterator1 = this.M.iterator();
@ -1217,8 +1217,8 @@ public class World implements IBlockAccess {
this.M.clear(); this.M.clear();
} }
MethodProfiler.a(); // MethodProfiler.a(); // CraftBukkit -- not in production code
MethodProfiler.a(); // MethodProfiler.a(); // CraftBukkit -- not in production code
} }
public void a(Collection collection) { public void a(Collection collection) {
@ -1252,7 +1252,7 @@ public class World implements IBlockAccess {
} }
} }
MethodProfiler.a("chunkCheck"); // MethodProfiler.a("chunkCheck"); // CraftBukkit -- not in production code
if (Double.isNaN(entity.locX) || Double.isInfinite(entity.locX)) { if (Double.isNaN(entity.locX) || Double.isInfinite(entity.locX)) {
entity.locX = entity.bI; entity.locX = entity.bI;
} }
@ -1290,7 +1290,7 @@ public class World implements IBlockAccess {
} }
} }
MethodProfiler.a(); // MethodProfiler.a(); // CraftBukkit -- not in production code
if (flag && entity.bW && entity.passenger != null) { if (flag && entity.bW && entity.passenger != null) {
if (!entity.passenger.dead && entity.passenger.vehicle == entity) { if (!entity.passenger.dead && entity.passenger.vehicle == entity) {
this.playerJoinedWorld(entity.passenger); this.playerJoinedWorld(entity.passenger);
@ -1713,13 +1713,13 @@ public class World implements IBlockAccess {
} }
} }
MethodProfiler.a("mobSpawner"); // MethodProfiler.a("mobSpawner"); // CraftBukkit -- not in production code
// CraftBukkit start - Only call spawner if we have players online and the world allows for mobs or animals // CraftBukkit start - Only call spawner if we have players online and the world allows for mobs or animals
if ((this.allowMonsters || this.allowAnimals) && (this instanceof WorldServer && this.getServer().getHandle().players.size() > 0)) { if ((this.allowMonsters || this.allowAnimals) && (this instanceof WorldServer && this.getServer().getHandle().players.size() > 0)) {
SpawnerCreature.spawnEntities(this, this.allowMonsters, this.allowAnimals && this.worldData.f() % 400L == 0L); SpawnerCreature.spawnEntities(this, this.allowMonsters, this.allowAnimals && this.worldData.f() % 400L == 0L);
} }
// CraftBukkit end // CraftBukkit end
MethodProfiler.b("chunkSource"); // MethodProfiler.b("chunkSource"); // CraftBukkit -- not in production code
this.chunkProvider.unloadChunks(); this.chunkProvider.unloadChunks();
int j = this.a(1.0F); int j = this.a(1.0F);
@ -1729,16 +1729,16 @@ public class World implements IBlockAccess {
i = this.worldData.f() + 1L; i = this.worldData.f() + 1L;
if (i % (long) this.u == 0L) { if (i % (long) this.u == 0L) {
MethodProfiler.b("save"); // MethodProfiler.b("save"); // CraftBukkit -- not in production code
this.save(false, (IProgressUpdate) null); this.save(false, (IProgressUpdate) null);
} }
this.worldData.a(i); this.worldData.a(i);
MethodProfiler.b("tickPending"); // MethodProfiler.b("tickPending"); // CraftBukkit -- not in production code
this.a(false); this.a(false);
MethodProfiler.b("tickTiles"); // MethodProfiler.b("tickTiles"); // CraftBukkit -- not in production code
this.k(); this.k();
MethodProfiler.a(); // MethodProfiler.a(); // CraftBukkit -- not in production code
} }
private void z() { private void z() {
@ -1857,7 +1857,7 @@ public class World implements IBlockAccess {
protected void k() { protected void k() {
this.T.clear(); this.T.clear();
MethodProfiler.a("buildList"); // MethodProfiler.a("buildList"); // CraftBukkit -- not in production code
int i; int i;
int j; int j;
@ -1882,7 +1882,7 @@ public class World implements IBlockAccess {
i = 0; i = 0;
int j1 = 0; int j1 = 0;
MethodProfiler.a(); // MethodProfiler.a(); // CraftBukkit -- not in production code
Iterator iterator = this.T.iterator(); Iterator iterator = this.T.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
@ -1890,12 +1890,12 @@ public class World implements IBlockAccess {
int k1 = chunkcoordintpair.x * 16; int k1 = chunkcoordintpair.x * 16;
j = chunkcoordintpair.z * 16; j = chunkcoordintpair.z * 16;
MethodProfiler.a("getChunk"); // MethodProfiler.a("getChunk"); // CraftBukkit -- not in production code
Chunk chunk = this.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z); Chunk chunk = this.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z);
MethodProfiler.b("tickChunk"); // MethodProfiler.b("tickChunk"); // CraftBukkit -- not in production code
chunk.i(); chunk.i();
MethodProfiler.b("moodSound"); // MethodProfiler.b("moodSound"); // CraftBukkit -- not in production code
int l1; int l1;
int i2; int i2;
int j2; int j2;
@ -1921,7 +1921,7 @@ public class World implements IBlockAccess {
} }
} }
MethodProfiler.b("thunder"); // MethodProfiler.b("thunder"); // CraftBukkit -- not in production code
if (this.random.nextInt(100000) == 0 && this.w() && this.v()) { if (this.random.nextInt(100000) == 0 && this.w() && this.v()) {
this.l = this.l * 3 + 1013904223; this.l = this.l * 3 + 1013904223;
l1 = this.l >> 2; l1 = this.l >> 2;
@ -1934,7 +1934,7 @@ public class World implements IBlockAccess {
} }
} }
MethodProfiler.b("iceandsnow"); // MethodProfiler.b("iceandsnow"); // CraftBukkit -- not in production code
this.l = this.l * 3 + 1013904223; this.l = this.l * 3 + 1013904223;
l1 = this.l >> 2; l1 = this.l >> 2;
i2 = l1 & 15; i2 = l1 & 15;
@ -1966,9 +1966,9 @@ public class World implements IBlockAccess {
// CraftBukkit end // CraftBukkit end
} }
MethodProfiler.b("checkLight"); // MethodProfiler.b("checkLight"); // CraftBukkit -- not in production code
this.s(k1 + this.random.nextInt(16), this.random.nextInt(this.height), j + this.random.nextInt(16)); this.s(k1 + this.random.nextInt(16), this.random.nextInt(this.height), j + this.random.nextInt(16));
MethodProfiler.b("tickTiles"); // MethodProfiler.b("tickTiles"); // CraftBukkit -- not in production code
for (l1 = 0; l1 < 20; ++l1) { for (l1 = 0; l1 < 20; ++l1) {
this.l = this.l * 3 + 1013904223; this.l = this.l * 3 + 1013904223;
@ -1985,7 +1985,7 @@ public class World implements IBlockAccess {
} }
} }
MethodProfiler.a(); // MethodProfiler.a(); // CraftBukkit -- not in production code
} }
} }
@ -2461,7 +2461,7 @@ public class World implements IBlockAccess {
} }
public PathEntity findPath(Entity entity, Entity entity1, float f) { public PathEntity findPath(Entity entity, Entity entity1, float f) {
MethodProfiler.a("pathfind"); // MethodProfiler.a("pathfind"); // CraftBukkit -- not in production code
int i = MathHelper.floor(entity.locX); int i = MathHelper.floor(entity.locX);
int j = MathHelper.floor(entity.locY); int j = MathHelper.floor(entity.locY);
int k = MathHelper.floor(entity.locZ); int k = MathHelper.floor(entity.locZ);
@ -2475,12 +2475,12 @@ public class World implements IBlockAccess {
ChunkCache chunkcache = new ChunkCache(this, i1, j1, k1, l1, i2, j2); ChunkCache chunkcache = new ChunkCache(this, i1, j1, k1, l1, i2, j2);
PathEntity pathentity = (new Pathfinder(chunkcache)).a(entity, entity1, f); PathEntity pathentity = (new Pathfinder(chunkcache)).a(entity, entity1, f);
MethodProfiler.a(); // MethodProfiler.a(); // CraftBukkit -- not in production code
return pathentity; return pathentity;
} }
public PathEntity a(Entity entity, int i, int j, int k, float f) { public PathEntity a(Entity entity, int i, int j, int k, float f) {
MethodProfiler.a("pathfind"); // MethodProfiler.a("pathfind"); // CraftBukkit -- not in production code
int l = MathHelper.floor(entity.locX); int l = MathHelper.floor(entity.locX);
int i1 = MathHelper.floor(entity.locY); int i1 = MathHelper.floor(entity.locY);
int j1 = MathHelper.floor(entity.locZ); int j1 = MathHelper.floor(entity.locZ);
@ -2494,7 +2494,7 @@ public class World implements IBlockAccess {
ChunkCache chunkcache = new ChunkCache(this, l1, i2, j2, k2, l2, i3); ChunkCache chunkcache = new ChunkCache(this, l1, i2, j2, k2, l2, i3);
PathEntity pathentity = (new Pathfinder(chunkcache)).a(entity, i, j, k, f); PathEntity pathentity = (new Pathfinder(chunkcache)).a(entity, i, j, k, f);
MethodProfiler.a(); // MethodProfiler.a(); // CraftBukkit -- not in production code
return pathentity; return pathentity;
} }