Better name protection

This commit is contained in:
ProfMobius committed 2013-12-04 01:01:18 +01:00
1 parent 8df6e59e62
commit 9040f123e8
6 files changed
+27 -26

No files matched your search

+8 -11
View File
@@ -79,18 +79,15 @@ public class CommandDataDump extends CommandBase {
for (TileEntityStats stat: entStats){
ItemStack is = new ItemStack(stat.getID(), 1, stat.getMeta());
ItemStack is;
String name = String.format("te.%d.%d", stat.getID(), stat.getMeta());
String modID = "<UNKNOWN>";
if (is != null) {
try{
name = is.getDisplayName();
modID = ModIdentification.idFromStack(is);
} catch (Exception e){
System.out.printf("Error while grabbing name for %d:%d\n", stat.getID(), stat.getMeta());
}
}
String modID = "<Unknown>";
try{
is = new ItemStack(stat.getID(), 1, stat.getMeta());
name = is.getDisplayName();
modID = ModIdentification.idFromStack(is);
} catch (Exception e) { }
out.write(String.format("%s,%s,%d,%d,%d,%d,%d,%d,%d,%f,%f,%f,%f,%f,%f,%f\n", name,
modID,
@@ -72,7 +72,8 @@ public final class CoordinatesBlock implements ISerializable {
//if (this.isChunk)
// return String.format("%s %s %s", this.dim, this.chunkX, this.chunkZ).hashCode();
//else
return String.format("%s %s %s %s", this.dim, this.x, this.y, this.z).hashCode();
// return String.format("%s %s %s %s", this.dim, this.x, this.y, this.z).hashCode();
return this.dim + 31 * this.x + 877 * this.y + 3187 * this.z;
}
@Override
@@ -55,7 +55,8 @@ public final class CoordinatesChunk implements ISerializable {
//11111111 11111111 11111111 11122222 22222222 22222222 22222200 00000000
public int hashCode() {
return String.format("%s %s %s", this.dim, this.chunkX, this.chunkZ).hashCode();
//return String.format("%s %s %s", this.dim, this.chunkX, this.chunkZ).hashCode();
return this.dim + 31 * this.chunkX + 877 * this.chunkZ;
}
public ChunkCoordIntPair toChunkCoordIntPair(){
@@ -28,7 +28,7 @@ public class TileEntityStats implements ISerializable, Comparable {
}
public void addMeasure(long timing){
dstat.addValue(timing/1000.0);
dstat.addValue((double)timing/1000.0);
}
public double getGeometricMean(){
@@ -60,19 +60,16 @@ public class ScreenTileEntity extends ScreenBase {
for (TileEntityStats data : tes){
ItemStack is = new ItemStack(data.getID(), 1, data.getMeta());
ItemStack is;
String name = String.format("te.%d.%d", data.getID(), data.getMeta());
String modID = "<UNKNOWN>";
if (is != null) {
try{
name = is.getDisplayName();
modID = ModIdentification.idFromStack(is);
} catch (Exception e){
System.out.printf("Error while grabbing name for %d:%d\n", data.getID(), data.getMeta());
}
}
try{
is = new ItemStack(data.getID(), 1, data.getMeta());
name = is.getDisplayName();
modID = ModIdentification.idFromStack(is);
} catch (Exception e) { }
if(modOpis.microseconds)
table.addRow(data,
name,
+7 -2
View File
@@ -276,8 +276,13 @@ public class OverlayMeanTime implements IMwDataProvider {
for (TileEntityStats data : entities){
ItemStack is = new ItemStack(data.getID(), 1, data.getMeta());
String name = is.getDisplayName();
ItemStack is;
String name = String.format("te.%d.%d", data.getID(), data.getMeta());
try{
is = new ItemStack(data.getID(), 1, data.getMeta());
name = is.getDisplayName();
} catch (Exception e) { }
/*
if (name.equals(data.getType()))