diff options
author | Martin Robertz <dream-master@gmx.net> | 2020-03-03 19:22:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-03 19:22:14 +0100 |
commit | 3bca4b84a8a3c146c658cb238b85658c2e3ca4f0 (patch) | |
tree | be0e584ae0612fe3043cf3377c96063e3cbc2368 /src/main/java/gregtech/common/GT_Proxy.java | |
parent | 60a98a8b69a58a0cdadb38da996f9d3aa0bca252 (diff) | |
parent | a767a4badaf285f3172cff0477acac698c5ada9f (diff) | |
download | GT5-Unofficial-3bca4b84a8a3c146c658cb238b85658c2e3ca4f0.tar.gz GT5-Unofficial-3bca4b84a8a3c146c658cb238b85658c2e3ca4f0.tar.bz2 GT5-Unofficial-3bca4b84a8a3c146c658cb238b85658c2e3ca4f0.zip |
Merge pull request #248 from GTNewHorizons/debug/more_debug_switches
Debug/more debug switches
Diffstat (limited to 'src/main/java/gregtech/common/GT_Proxy.java')
-rw-r--r-- | src/main/java/gregtech/common/GT_Proxy.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java index 234920448d..3b668d805d 100644 --- a/src/main/java/gregtech/common/GT_Proxy.java +++ b/src/main/java/gregtech/common/GT_Proxy.java @@ -88,6 +88,9 @@ import java.io.File; import java.text.DateFormat; import java.util.*; +import static gregtech.api.enums.GT_Values.debugEntityCramming; + + public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { private static final EnumSet<OreGenEvent.GenerateMinable.EventType> PREVENTED_ORES = EnumSet.of(OreGenEvent.GenerateMinable.EventType.COAL, OreGenEvent.GenerateMinable.EventType.IRON, OreGenEvent.GenerateMinable.EventType.GOLD, @@ -1264,6 +1267,11 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { } } if ((aEvent.world.getTotalWorldTime() % 100L == 0L) && ((this.mItemDespawnTime != 6000) || (this.mMaxEqualEntitiesAtOneSpot > 0))) { + long startTime = System.nanoTime(); + double oldX=0, oldY=0, oldZ=0; + if (debugEntityCramming && (aEvent.world.loadedEntityList.size()!=0)) { + GT_Log.out.println("CRAM: Entity list size " + aEvent.world.loadedEntityList.size()); + } for (int i = 0; i < aEvent.world.loadedEntityList.size(); i++) { if ((aEvent.world.loadedEntityList.get(i) instanceof Entity)) { Entity tEntity = (Entity) aEvent.world.loadedEntityList.get(i); @@ -1283,11 +1291,26 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { } } if (tEntityCount > this.mMaxEqualEntitiesAtOneSpot) { + if (debugEntityCramming) { + // Cheeseball way of not receiving a bunch of spam caused by 1 location + // obviously fails if there are crammed entities in more than one spot. + if( tEntity.posX != oldX + && tEntity.posY != oldY + && tEntity.posZ != oldZ ) { + GT_Log.out.println("CRAM: Excess entities: " + tEntityCount + " at X " + tEntity.posX + " Y " + tEntity.posY + " Z " + tEntity.posZ); + oldX = tEntity.posX; + oldY = tEntity.posY; + oldZ = tEntity.posZ; + } + } tEntity.attackEntityFrom(DamageSource.inWall, tEntityCount - this.mMaxEqualEntitiesAtOneSpot); } } } } + if(debugEntityCramming && (aEvent.world.loadedEntityList.size()!=0)) { + GT_Log.out.println("CRAM: Time spent checking " + (System.nanoTime() - startTime )/1000 + " microseconds" ); + } } GT_Pollution.onWorldTick(aEvent); |