mirror of
https://github.com/GTNewHorizons/Opis.git
synced 2026-11-22 05:02:17 +00:00
TE names are now properly determined (in most cases)
This commit is contained in:
1 parent
0e5dae88b4
commit
1fa11b41dc
2 files changed
+31
-7
No files matched your search
@@ -8,7 +8,12 @@ import mcp.mobius.opis.data.holders.CoordinatesBlock;
|
||||
import mcp.mobius.opis.data.holders.CoordinatesChunk;
|
||||
import mcp.mobius.opis.data.holders.TileEntityStats;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
|
||||
public class TileEntityManager {
|
||||
public static HashMap<CoordinatesBlock, Class> references = new HashMap<CoordinatesBlock, Class>();
|
||||
@@ -18,13 +23,16 @@ public class TileEntityManager {
|
||||
CoordinatesBlock coord = new CoordinatesBlock(te);
|
||||
|
||||
String teName;
|
||||
|
||||
/*
|
||||
try{
|
||||
teName = te.blockType.getLocalizedName();
|
||||
} catch (Exception e){
|
||||
System.out.printf("%s\n", e);
|
||||
teName = te.getClass().getName();
|
||||
}
|
||||
*/
|
||||
|
||||
teName = te.getClass().getName();
|
||||
|
||||
if (references.containsKey(coord) && references.get(coord) != te.getClass()){
|
||||
@@ -61,8 +69,19 @@ public class TileEntityManager {
|
||||
ArrayList<TileEntityStats> returnList = new ArrayList<TileEntityStats>();
|
||||
|
||||
for (CoordinatesBlock tecoord : TileEntityManager.stats.keySet()){
|
||||
if (coord.equals(new CoordinatesChunk(tecoord)))
|
||||
returnList.add(TileEntityManager.stats.get(tecoord));
|
||||
if (coord.equals(new CoordinatesChunk(tecoord))){
|
||||
TileEntityStats testats = TileEntityManager.stats.get(tecoord);
|
||||
|
||||
World world = DimensionManager.getWorld(tecoord.dim);
|
||||
Block mouseoverBlock = Block.blocksList[world.getBlockId(tecoord.x, tecoord.y, tecoord.z)];
|
||||
|
||||
try{
|
||||
ItemStack pick = new ItemStack(mouseoverBlock, 1, world.getBlockMetadata(tecoord.x, tecoord.y, tecoord.z));
|
||||
testats.setType(pick.getDisplayName());
|
||||
}catch (Exception e){}
|
||||
|
||||
returnList.add(testats);
|
||||
}
|
||||
}
|
||||
|
||||
return returnList;
|
||||
|
||||
@@ -12,13 +12,13 @@ public class TileEntityStats implements ISerializable, Comparable {
|
||||
|
||||
private DescriptiveStatistics stats = new DescriptiveStatistics(100);
|
||||
private CoordinatesBlock coord;
|
||||
private String classname;
|
||||
private String name;
|
||||
private Double geomMean = null;
|
||||
|
||||
|
||||
public TileEntityStats(CoordinatesBlock coord, String teclass){
|
||||
this.coord = coord;
|
||||
this.classname = teclass;
|
||||
this.coord = coord;
|
||||
this.name = teclass;
|
||||
}
|
||||
|
||||
public void addMeasure(long timing){
|
||||
@@ -45,13 +45,18 @@ public class TileEntityStats implements ISerializable, Comparable {
|
||||
}
|
||||
|
||||
public String getType(){
|
||||
return this.classname;
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setType(String name){
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void writeToStream(DataOutputStream stream) throws IOException{
|
||||
this.coord.writeToStream(stream);
|
||||
Packet.writeString(this.classname, stream);
|
||||
Packet.writeString(this.name, stream);
|
||||
stream.writeDouble(this.getGeometricMean());
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user