More work on scanner

This commit is contained in:
Technus 2016-09-07 16:38:39 +02:00
parent 6198b220ee
commit 0cb17155d3
3 changed files with 23 additions and 21 deletions

View file

@ -24,6 +24,7 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.Packet; import net.minecraft.network.Packet;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
@ -641,19 +642,19 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
if (mTimeStatistics.length > 0) { if (mTimeStatistics.length > 0) {
double tAverageTime = 0; double tAverageTime = 0;
for (int tTime : mTimeStatistics) tAverageTime += tTime; for (int tTime : mTimeStatistics) tAverageTime += tTime;
tList.add("This particular TileEntity has caused an average CPU-load of ~" + (tAverageTime / mTimeStatistics.length) + "ms over the last " + mTimeStatistics.length + " ticks."); tList.add("Average CPU-load of ~" + (tAverageTime / mTimeStatistics.length) + "ms since " + mTimeStatistics.length + " ticks.");
} }
if (mLagWarningCount > 0) { if (mLagWarningCount > 0) {
tList.add("This TileEntity has also caused " + (mLagWarningCount >= 10 ? "more than 10" : mLagWarningCount) + " Lag Spike Warnings (anything taking longer than " + GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING + "ms) on the Server."); tList.add("Caused " + (mLagWarningCount >= 10 ? "more than 10" : mLagWarningCount) + " Lag Spike Warnings (anything taking longer than " + GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING + "ms) on the Server.");
} }
tList.add("Is" + (mMetaTileEntity.isAccessAllowed(aPlayer) ? " " : " not ") + "accessible for you"); tList.add("Is" + (mMetaTileEntity.isAccessAllowed(aPlayer) ? " " : " not ") + "accessible for you");
} }
if (aLogLevel > 0) { if (aLogLevel > 0) {
if (getSteamCapacity() > 0 && hasSteamEngineUpgrade()) if (getSteamCapacity() > 0 && hasSteamEngineUpgrade())
tList.add(getStoredSteam() + " of " + getSteamCapacity() + " Steam"); tList.add(getStoredSteam() + " of " + getSteamCapacity() + " Steam");
tList.add("Machine is " + (mActive ? "active" : "inactive")); tList.add("Machine is " + (mActive ? EnumChatFormatting.GREEN+"active"+EnumChatFormatting.RESET : EnumChatFormatting.RED+"inactive"+EnumChatFormatting.RESET));
if (!mHasEnoughEnergy) if (!mHasEnoughEnergy)
tList.add("ATTENTION: This Device consumes Energy at a higher Rate than you input. You could insert more to speed up the process."); tList.add(EnumChatFormatting.RED+"ATTENTION: This Device needs more power."+EnumChatFormatting.RESET);
} }
return mMetaTileEntity.getSpecialDebugInfo(this, aPlayer, aLogLevel, tList); return mMetaTileEntity.getSpecialDebugInfo(this, aPlayer, aLogLevel, tList);
} }

View file

@ -166,7 +166,7 @@ public abstract class MetaPipeEntity implements IMetaTileEntity {
tCovered = true; tCovered = true;
} }
//System.out.println("Cover: "+mBaseMetaTileEntity.getCoverIDAtSide(aSide)); //System.out.println("Cover: "+mBaseMetaTileEntity.getCoverIDAtSide(aSide));
//toDo: filter cover ids that actually protect against temperature (rubber/plastic maybe?) //toDo: filter cover ids that actually protect against temperature (rubber/plastic maybe?, more like asbestos)
return tCovered; return tCovered;
} }

View file

@ -52,6 +52,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest; import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraft.world.ChunkPosition; import net.minecraft.world.ChunkPosition;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -1578,12 +1579,12 @@ public class GT_Utility {
tList.add("----- X: " + aX + " Y: " + aY + " Z: " + aZ + " -----"); tList.add("----- X: " + aX + " Y: " + aY + " Z: " + aZ + " -----");
try { try {
if (tTileEntity != null && tTileEntity instanceof IInventory) if (tTileEntity != null && tTileEntity instanceof IInventory)
tList.add("Name: " + ((IInventory) tTileEntity).getInventoryName() + " MetaData: " + aWorld.getBlockMetadata(aX, aY, aZ)); tList.add("Name: " + EnumChatFormatting.BLUE+ ((IInventory) tTileEntity).getInventoryName()+EnumChatFormatting.RESET + " MetaData: " +EnumChatFormatting.AQUA+ aWorld.getBlockMetadata(aX, aY, aZ)+EnumChatFormatting.RESET);
else else
tList.add("Name: " + tBlock.getUnlocalizedName() + " MetaData: " + aWorld.getBlockMetadata(aX, aY, aZ)); tList.add("Name: " +EnumChatFormatting.BLUE+ tBlock.getUnlocalizedName() +EnumChatFormatting.RESET+ " MetaData: " +EnumChatFormatting.AQUA+ aWorld.getBlockMetadata(aX, aY, aZ)+EnumChatFormatting.RESET);
tList.add("Hardness: " + tBlock.getBlockHardness(aWorld, aX, aY, aZ) + " Blast Resistance: " + tBlock.getExplosionResistance(aPlayer, aWorld, aX, aY, aZ, aPlayer.posX, aPlayer.posY, aPlayer.posZ)); tList.add("Hardness: " +EnumChatFormatting.YELLOW+ tBlock.getBlockHardness(aWorld, aX, aY, aZ) +EnumChatFormatting.RESET+ " Blast Resistance: " +EnumChatFormatting.YELLOW+ tBlock.getExplosionResistance(aPlayer, aWorld, aX, aY, aZ, aPlayer.posX, aPlayer.posY, aPlayer.posZ)+EnumChatFormatting.RESET);
if (tBlock.isBeaconBase(aWorld, aX, aY, aZ, aX, aY + 1, aZ)) tList.add("Is valid Beacon Pyramid Material"); if (tBlock.isBeaconBase(aWorld, aX, aY, aZ, aX, aY + 1, aZ)) tList.add(EnumChatFormatting.GOLD+"Is valid Beacon Pyramid Material"+EnumChatFormatting.RESET );
} catch (Throwable e) { } catch (Throwable e) {
if (D1) e.printStackTrace(GT_Log.err); if (D1) e.printStackTrace(GT_Log.err);
} }
@ -1593,7 +1594,7 @@ public class GT_Utility {
rEUAmount += 500; rEUAmount += 500;
FluidTankInfo[] tTanks = ((IFluidHandler) tTileEntity).getTankInfo(ForgeDirection.getOrientation(aSide)); FluidTankInfo[] tTanks = ((IFluidHandler) tTileEntity).getTankInfo(ForgeDirection.getOrientation(aSide));
if (tTanks != null) for (byte i = 0; i < tTanks.length; i++) { if (tTanks != null) for (byte i = 0; i < tTanks.length; i++) {
tList.add("Tank " + i + ": " + GT_Utility.formatNumbers((tTanks[i].fluid == null ? 0 : tTanks[i].fluid.amount)) + " / " + GT_Utility.formatNumbers(tTanks[i].capacity) + " " + getFluidName(tTanks[i].fluid, true)); tList.add("Tank " + i + ": " +EnumChatFormatting.YELLOW+ GT_Utility.formatNumbers((tTanks[i].fluid == null ? 0 : tTanks[i].fluid.amount)) +EnumChatFormatting.RESET+ " / " +EnumChatFormatting.YELLOW+ GT_Utility.formatNumbers(tTanks[i].capacity) + " " + getFluidName(tTanks[i].fluid, true)+EnumChatFormatting.RESET);
} }
} }
} catch (Throwable e) { } catch (Throwable e) {
@ -1610,8 +1611,8 @@ public class GT_Utility {
try { try {
if (tTileEntity instanceof ic2.api.reactor.IReactor) { if (tTileEntity instanceof ic2.api.reactor.IReactor) {
rEUAmount += 500; rEUAmount += 500;
tList.add("Heat: " + ((ic2.api.reactor.IReactor) tTileEntity).getHeat() + "/" + ((ic2.api.reactor.IReactor) tTileEntity).getMaxHeat() tList.add("Heat: " +EnumChatFormatting.RED+ ((ic2.api.reactor.IReactor) tTileEntity).getHeat() +EnumChatFormatting.RESET+ "/" +EnumChatFormatting.RED+ ((ic2.api.reactor.IReactor) tTileEntity).getMaxHeat()+EnumChatFormatting.RESET
+ " HEM: " + ((ic2.api.reactor.IReactor) tTileEntity).getHeatEffectModifier() + " Base EU Output: "/* + ((ic2.api.reactor.IReactor)tTileEntity).getOutput()*/); + " HEM: " +EnumChatFormatting.YELLOW+((ic2.api.reactor.IReactor) tTileEntity).getHeatEffectModifier() +EnumChatFormatting.RESET/*+ " Base EU Output: " + ((ic2.api.reactor.IReactor)tTileEntity).getOutput()*/);//TODO WHAT?
} }
} catch (Throwable e) { } catch (Throwable e) {
if (D1) e.printStackTrace(GT_Log.err); if (D1) e.printStackTrace(GT_Log.err);
@ -1620,7 +1621,7 @@ public class GT_Utility {
if (tTileEntity instanceof ic2.api.tile.IWrenchable) { if (tTileEntity instanceof ic2.api.tile.IWrenchable) {
rEUAmount += 100; rEUAmount += 100;
tList.add("Facing: " + ((ic2.api.tile.IWrenchable) tTileEntity).getFacing() + " / Chance: " + (((ic2.api.tile.IWrenchable) tTileEntity).getWrenchDropRate() * 100) + "%"); tList.add("Facing: " + ((ic2.api.tile.IWrenchable) tTileEntity).getFacing() + " / Chance: " + (((ic2.api.tile.IWrenchable) tTileEntity).getWrenchDropRate() * 100) + "%");
tList.add(((ic2.api.tile.IWrenchable) tTileEntity).wrenchCanRemove(aPlayer) ? "You can remove this with a Wrench" : "You can NOT remove this with a Wrench"); tList.add(((ic2.api.tile.IWrenchable) tTileEntity).wrenchCanRemove(aPlayer) ? EnumChatFormatting.GREEN+"You can remove this with a Wrench"+EnumChatFormatting.RESET : EnumChatFormatting.RED+"You can NOT remove this with a Wrench"+EnumChatFormatting.RESET);
} }
} catch (Throwable e) { } catch (Throwable e) {
if (D1) e.printStackTrace(GT_Log.err); if (D1) e.printStackTrace(GT_Log.err);
@ -1654,7 +1655,7 @@ public class GT_Utility {
try { try {
if (tTileEntity instanceof ic2.api.energy.tile.IEnergyConductor) { if (tTileEntity instanceof ic2.api.energy.tile.IEnergyConductor) {
rEUAmount += 200; rEUAmount += 200;
tList.add("Conduction Loss: " + ((ic2.api.energy.tile.IEnergyConductor) tTileEntity).getConductionLoss()); tList.add("Conduction Loss: " +EnumChatFormatting.YELLOW+ ((ic2.api.energy.tile.IEnergyConductor) tTileEntity).getConductionLoss()+EnumChatFormatting.RESET);
} }
} catch (Throwable e) { } catch (Throwable e) {
if (D1) e.printStackTrace(GT_Log.err); if (D1) e.printStackTrace(GT_Log.err);
@ -1662,7 +1663,7 @@ public class GT_Utility {
try { try {
if (tTileEntity instanceof ic2.api.tile.IEnergyStorage) { if (tTileEntity instanceof ic2.api.tile.IEnergyStorage) {
rEUAmount += 200; rEUAmount += 200;
tList.add("Contained Energy: " + ((ic2.api.tile.IEnergyStorage) tTileEntity).getStored() + " of " + ((ic2.api.tile.IEnergyStorage) tTileEntity).getCapacity()); tList.add("Contained Energy: " +EnumChatFormatting.YELLOW+ ((ic2.api.tile.IEnergyStorage) tTileEntity).getStored() +EnumChatFormatting.RESET+ " of " +EnumChatFormatting.YELLOW+ ((ic2.api.tile.IEnergyStorage) tTileEntity).getCapacity()+EnumChatFormatting.RESET);
//aList.add(((ic2.api.tile.IEnergyStorage)tTileEntity).isTeleporterCompatible(ic2.api.Direction.YP)?"Teleporter Compatible":"Not Teleporter Compatible"); //aList.add(((ic2.api.tile.IEnergyStorage)tTileEntity).isTeleporterCompatible(ic2.api.Direction.YP)?"Teleporter Compatible":"Not Teleporter Compatible");
} }
} catch (Throwable e) { } catch (Throwable e) {
@ -1671,7 +1672,7 @@ public class GT_Utility {
try { try {
if (tTileEntity instanceof IUpgradableMachine) { if (tTileEntity instanceof IUpgradableMachine) {
rEUAmount += 500; rEUAmount += 500;
if (((IUpgradableMachine) tTileEntity).hasMufflerUpgrade()) tList.add("Has Muffler Upgrade"); if (((IUpgradableMachine) tTileEntity).hasMufflerUpgrade()) tList.add(EnumChatFormatting.GRAY+"Has Muffler Upgrade"+EnumChatFormatting.RESET);
} }
} catch (Throwable e) { } catch (Throwable e) {
if (D1) e.printStackTrace(GT_Log.err); if (D1) e.printStackTrace(GT_Log.err);
@ -1681,7 +1682,7 @@ public class GT_Utility {
rEUAmount += 400; rEUAmount += 400;
int tValue = 0; int tValue = 0;
if (0 < (tValue = ((IMachineProgress) tTileEntity).getMaxProgress())) if (0 < (tValue = ((IMachineProgress) tTileEntity).getMaxProgress()))
tList.add("Progress: " + GT_Utility.formatNumbers(tValue) + " / " + GT_Utility.formatNumbers(((IMachineProgress) tTileEntity).getProgress())); tList.add("Progress: " +EnumChatFormatting.YELLOW+ GT_Utility.formatNumbers(tValue) +EnumChatFormatting.RESET+ " / " +EnumChatFormatting.YELLOW+ GT_Utility.formatNumbers(((IMachineProgress) tTileEntity).getProgress())+EnumChatFormatting.RESET);
} }
} catch (Throwable e) { } catch (Throwable e) {
if (D1) e.printStackTrace(GT_Log.err); if (D1) e.printStackTrace(GT_Log.err);
@ -1697,16 +1698,16 @@ public class GT_Utility {
} }
try { try {
if (tTileEntity instanceof IBasicEnergyContainer && ((IBasicEnergyContainer) tTileEntity).getEUCapacity() > 0) { if (tTileEntity instanceof IBasicEnergyContainer && ((IBasicEnergyContainer) tTileEntity).getEUCapacity() > 0) {
tList.add("Max IN: " + ((IBasicEnergyContainer) tTileEntity).getInputVoltage() + " EU"); tList.add("Max IN: " +EnumChatFormatting.RED+ ((IBasicEnergyContainer) tTileEntity).getInputVoltage() +EnumChatFormatting.RESET+ " EU");
tList.add("Max OUT: " + ((IBasicEnergyContainer) tTileEntity).getOutputVoltage() + " EU at " + ((IBasicEnergyContainer) tTileEntity).getOutputAmperage() + " Amperes"); tList.add("Max OUT: " +EnumChatFormatting.RED+ ((IBasicEnergyContainer) tTileEntity).getOutputVoltage() +EnumChatFormatting.RESET+ " EU at " +EnumChatFormatting.RED+ ((IBasicEnergyContainer) tTileEntity).getOutputAmperage() +EnumChatFormatting.RESET+ " Amperes");
tList.add("Energy: " + GT_Utility.formatNumbers(((IBasicEnergyContainer) tTileEntity).getStoredEU()) + " / " + GT_Utility.formatNumbers(((IBasicEnergyContainer) tTileEntity).getEUCapacity()) + "EU"); tList.add("Energy: " +EnumChatFormatting.YELLOW+ GT_Utility.formatNumbers(((IBasicEnergyContainer) tTileEntity).getStoredEU()) +EnumChatFormatting.RESET+ " / " +EnumChatFormatting.YELLOW+ GT_Utility.formatNumbers(((IBasicEnergyContainer) tTileEntity).getEUCapacity()) +EnumChatFormatting.RESET+ "EU");
} }
} catch (Throwable e) { } catch (Throwable e) {
if (D1) e.printStackTrace(GT_Log.err); if (D1) e.printStackTrace(GT_Log.err);
} }
try { try {
if (tTileEntity instanceof IGregTechTileEntity) { if (tTileEntity instanceof IGregTechTileEntity) {
tList.add("Owned by: " + ((IGregTechTileEntity) tTileEntity).getOwnerName()); tList.add("Owned by: " +EnumChatFormatting.BLUE+ ((IGregTechTileEntity) tTileEntity).getOwnerName()+EnumChatFormatting.RESET);
} }
} catch (Throwable e) { } catch (Throwable e) {
if (D1) e.printStackTrace(GT_Log.err); if (D1) e.printStackTrace(GT_Log.err);