From 42c46fb57bb65117fc2729b2244a070a131880fe Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 2 Jun 2018 19:14:05 +0200 Subject: [PATCH] Code cleanup --- .../warpdrive/data/EnumStarMapEntryType.java | 26 ++++++++++++------- .../cr0s/warpdrive/data/StarMapRegistry.java | 2 +- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/main/java/cr0s/warpdrive/data/EnumStarMapEntryType.java b/src/main/java/cr0s/warpdrive/data/EnumStarMapEntryType.java index d7ae561f..ae1bff50 100644 --- a/src/main/java/cr0s/warpdrive/data/EnumStarMapEntryType.java +++ b/src/main/java/cr0s/warpdrive/data/EnumStarMapEntryType.java @@ -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; + } } diff --git a/src/main/java/cr0s/warpdrive/data/StarMapRegistry.java b/src/main/java/cr0s/warpdrive/data/StarMapRegistry.java index 630ab254..7c4c597a 100644 --- a/src/main/java/cr0s/warpdrive/data/StarMapRegistry.java +++ b/src/main/java/cr0s/warpdrive/data/StarMapRegistry.java @@ -301,7 +301,7 @@ public class StarMapRegistry { final int radius2 = radius * radius; for (final Map.Entry> 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);