Code cleanup

This commit is contained in:
Unknown 2018-06-02 19:14:05 +02:00
parent 5f1e250390
commit 42c46fb57b
2 changed files with 17 additions and 11 deletions

View file

@ -7,18 +7,19 @@ import java.util.HashMap;
public enum EnumStarMapEntryType implements IStringSerializable {
UNDEFINED (0, "-undefined-"),
SHIP (1, "ship" ), // a ship core
JUMPGATE (2, "jumpgate" ), // a jump gate
PLANET (3, "planet" ), // a planet (a transition plane allowing to move to another dimension)
STAR (4, "star" ), // a star
STRUCTURE (5, "structure" ), // a structure from WorldGeneration (moon, asteroid field, etc.)
WARP_ECHO (6, "warp_echo" ), // remains of a warp
ACCELERATOR(7, "accelerator"), // an accelerator setup
TRANSPORTER(8, "transporter"); // a transporter room
UNDEFINED (0, "-undefined-", true ),
SHIP (1, "ship" , true ), // a ship core
JUMPGATE (2, "jumpgate" , true ), // a jump gate
PLANET (3, "planet" , true ), // a planet (a transition plane allowing to move to another dimension)
STAR (4, "star" , true ), // a star
STRUCTURE (5, "structure" , true ), // a structure from WorldGeneration (moon, asteroid field, etc.)
WARP_ECHO (6, "warp_echo" , true ), // remains of a warp
ACCELERATOR(7, "accelerator", false), // an accelerator setup
TRANSPORTER(8, "transporter", true ); // a transporter room
private final int id;
private final String name;
private final boolean hasRadarEcho;
// cached values
public static final int length;
@ -31,9 +32,10 @@ public enum EnumStarMapEntryType implements IStringSerializable {
}
}
EnumStarMapEntryType(final int id, final String name) {
EnumStarMapEntryType(final int id, final String name, final boolean hasRadarEcho) {
this.id = id;
this.name = name;
this.hasRadarEcho = hasRadarEcho;
}
public int getId() {
@ -49,4 +51,8 @@ public enum EnumStarMapEntryType implements IStringSerializable {
public static EnumStarMapEntryType getByName(final String name) {
return mapNames.get(name);
}
public boolean hasRadarEcho() {
return hasRadarEcho;
}
}

View file

@ -301,7 +301,7 @@ public class StarMapRegistry {
final int radius2 = radius * radius;
for (final Map.Entry<Integer, CopyOnWriteArraySet<StarMapRegistryItem>> entryDimension : registry.entrySet()) {
for (final StarMapRegistryItem starMapRegistryItem : entryDimension.getValue()) {
if (starMapRegistryItem.type == EnumStarMapEntryType.ACCELERATOR) {
if (!starMapRegistryItem.type.hasRadarEcho()) {
continue;
}
final Vector3 vectorItem = starMapRegistryItem.getUniversalCoordinates(tileEntity.getWorldObj().isRemote);