]> git.lizzy.rs Git - BoundingBoxOutlineReloaded.git/commitdiff
Cleanup code
authorIrtimaled <irtimaled@gmail.com>
Mon, 18 Mar 2019 05:59:53 +0000 (22:59 -0700)
committerIrtimaled <irtimaled@gmail.com>
Mon, 25 Mar 2019 03:56:28 +0000 (20:56 -0700)
18 files changed:
src/main/java/com/irtimaled/bbor/Main.java
src/main/java/com/irtimaled/bbor/client/ClientProxy.java
src/main/java/com/irtimaled/bbor/client/GetCache.java
src/main/java/com/irtimaled/bbor/client/keyboard/Key.java
src/main/java/com/irtimaled/bbor/common/BoundingBoxCache.java
src/main/java/com/irtimaled/bbor/common/CommonProxy.java
src/main/java/com/irtimaled/bbor/common/VillageProcessor.java
src/main/java/com/irtimaled/bbor/common/chunkProcessors/EndChunkProcessor.java
src/main/java/com/irtimaled/bbor/common/chunkProcessors/OverworldChunkProcessor.java
src/main/java/com/irtimaled/bbor/config/ConfigManager.java
src/main/java/com/irtimaled/bbor/config/Configuration.java
src/main/java/com/irtimaled/bbor/mixin/client/gui/MixinGuiOptions.java
src/main/java/com/irtimaled/bbor/mixin/client/network/MixinNetHandlerLoginClient.java
src/main/java/com/irtimaled/bbor/mixin/client/network/MixinNetHandlerPlayClient.java
src/main/java/com/irtimaled/bbor/mixin/server/management/MixinPlayerList.java
src/main/java/com/irtimaled/bbor/mixin/world/MixinWorldServer.java
src/main/java/com/irtimaled/bbor/server/ServerRunner.java
src/main/java/com/irtimaled/bbor/server/ThrowableConsumer.java

index 66294b1e47bc8158d356fbcab3f47ba322a38aa5..0449b17ae7f08e9f862d69072469fda68685c1ff 100644 (file)
@@ -15,4 +15,4 @@ public class Main {
 
         }
     }
-}
\ No newline at end of file
+}
index 721221cb49248b792bb8df54b196498d8c541697..234edbc864b1da871434a47ccf3a768218692eb3 100644 (file)
@@ -72,6 +72,4 @@ public class ClientProxy extends CommonProxy {
         super.setWorldData(seed, spawnX, spawnZ);
         renderer.setWorldData(seed, spawnX, spawnZ);
     }
-
-
 }
index 20f1644ca4ae3462f706bb2660309d92bb2ca481..332d86ae11326020ba4f6b06112b96709f8fc23b 100644 (file)
@@ -4,4 +4,5 @@ import com.irtimaled.bbor.common.BoundingBoxCache;
 
 import java.util.function.Function;
 
-public interface GetCache extends Function<Integer, BoundingBoxCache> { }
+public interface GetCache extends Function<Integer, BoundingBoxCache> {
+}
index 2bdf5c910da9cc95d5fdc04676e12e221071435c..06179e1f012ce3641201a828e07098d197d55e8f 100644 (file)
@@ -36,7 +36,6 @@ public class Key extends KeyBinding {
         super.bind(input);
     }
 
-
     private int pressDuration = 0;
 
     @Override
index 9d015d9baf9ce906f2402f31880111180180f4eb..03f870d8255570e334950f8b4aef09506fc4a771 100644 (file)
@@ -14,7 +14,7 @@ public class BoundingBoxCache {
         return cache;
     }
 
-    public void clear() {
+    void clear() {
         cache.clear();
     }
 
@@ -27,12 +27,14 @@ public class BoundingBoxCache {
     }
 
     public void addBoundingBox(BoundingBox key) {
+        if(isCached(key)) return;
+
         Set<BoundingBox> boundingBoxes = new HashSet<>();
         boundingBoxes.add(key);
         addBoundingBoxes(key, boundingBoxes);
     }
 
-    public void removeBoundingBox(BoundingBox key) {
+    void removeBoundingBox(BoundingBox key) {
         cache.remove(key);
     }
 }
index 897e72fab7b229abded1cd9d0388fd8b6373c008..30f15d7d77afe89bf596095d23780d931d7c415f 100644 (file)
@@ -157,7 +157,7 @@ public class CommonProxy {
     private void serverWorldTick(WorldServer world) {
         int dimensionId = world.dimension.getType().getId();
         VillageProcessor villageProcessor = villageProcessors.get(dimensionId);
-        if(villageProcessor == null) return;
+        if (villageProcessor == null) return;
 
         villageProcessor.process(world.getVillageCollection());
     }
@@ -171,7 +171,7 @@ public class CommonProxy {
     }
 
     protected void clearCaches() {
-        for(VillageProcessor villageProcessor : villageProcessors.values()) {
+        for (VillageProcessor villageProcessor : villageProcessors.values()) {
             villageProcessor.clear();
         }
         villageProcessors.clear();
index ec90fb679c5cd3650a598167e98317b1cce73759..d3871ad4e843b67af31c093e3721b652bff6fbdd 100644 (file)
@@ -70,4 +70,4 @@ class VillageProcessor {
     void clear() {
         villageCache.clear();
     }
-}
\ No newline at end of file
+}
index bef4268f8f85c4fd268e271c86e1c5075bf8faf4..0a732643e1bb07718e3e119c308fbdd6a1d624c0 100644 (file)
@@ -6,5 +6,6 @@ import com.irtimaled.bbor.common.BoundingBoxType;
 public class EndChunkProcessor extends ChunkProcessor {
     public EndChunkProcessor(BoundingBoxCache boundingBoxCache) {
         super(boundingBoxCache);
-        supportedStructures.add(BoundingBoxType.EndCity);}
+        supportedStructures.add(BoundingBoxType.EndCity);
+    }
 }
index 819a362f94c727246dd71403c89e9b54e6518759..89ef90cbc42a9e8d7b036d488a59d0425221d57b 100644 (file)
@@ -19,5 +19,4 @@ public class OverworldChunkProcessor extends ChunkProcessor {
         supportedStructures.add(BoundingBoxType.Igloo);
         supportedStructures.add(BoundingBoxType.PillagerOutpost);
     }
-
 }
index ec6bb5fd95a781460ae069ea23b0c9ef9d22ea04..08375be9c271930ad28ad721e140287fc6743810 100644 (file)
@@ -93,10 +93,9 @@ public class ConfigManager {
         return config;
     }
 
-    public static void saveConfig()
-    {
+    public static void saveConfig() {
         Configuration config = new Configuration(new File(configDir, "BBOutlineReloaded.cfg"));
-        for(Setting<?> setting : settings) {
+        for (Setting<?> setting : settings) {
             config.put(setting);
         }
         config.save();
index 7d9ca03e0a8bc528522ea75dffb02776390d3e75..fd3d50ccf0cd5501cf7eb67dcd87c809c6371a0d 100644 (file)
@@ -95,9 +95,9 @@ public class Configuration {
         }
         Map<String, Setting<?>> settings = settingsGroup.get(category);
         Setting<?> setting = settings.get(settingName);
-        if(setting == null && category != FALLBACK_CATEGORY)
+        if (setting == null && category != FALLBACK_CATEGORY)
             setting = getFallbackSetting(settingName, settings);
-        if(setting != null && setting.getType() != type) {
+        if (setting != null && setting.getType() != type) {
             setting = null;
         }
         if (setting == null) {
@@ -120,7 +120,7 @@ public class Configuration {
 
     private <T> char getType(T defaultValue) {
         String[] typeNames = defaultValue.getClass().getName().split("[.]");
-        return typeNames[typeNames.length-1].charAt(0);
+        return typeNames[typeNames.length - 1].charAt(0);
     }
 
     void put(Setting<?> setting) {
index b9e31f2fb67581017e775c3a0eac06290db27a67..f559d6665ad214653a38a666bb361726dffaea39 100644 (file)
@@ -15,7 +15,7 @@ public class MixinGuiOptions extends GuiScreen {
     private void initGui(CallbackInfo ci) {
         //shuffle middle buttons up by 12 px to make space
         int top = this.height / 6 + 42;
-        for(GuiButton button : buttons) {
+        for (GuiButton button : buttons) {
             if (button.id != 200 && button.y >= top)
                 button.y -= 12;
         }
index 757ec45e7ebd4277133beef5a14eacbf8f5a8329..c47a3f66c60a62b98d9f634bda137c264b319cc2 100644 (file)
@@ -29,7 +29,7 @@ public abstract class MixinNetHandlerLoginClient {
         }
     }
 
-    @Inject(method = "onDisconnect", at=@At("HEAD"))
+    @Inject(method = "onDisconnect", at = @At("HEAD"))
     private void onDisconnect(CallbackInfo ci) {
         EventBus.publish(new DisconnectedFromRemoteServer());
     }
index 8b93ca461f2e62dfe389fc5ed64228fe560cdc32..bc79776a6ceb656ac39798e4f43bec2e594ae0c8 100644 (file)
@@ -10,7 +10,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
 
 @Mixin(NetHandlerPlayClient.class)
 public class MixinNetHandlerPlayClient {
-    @Inject(method = "onDisconnect", at=@At("HEAD"))
+    @Inject(method = "onDisconnect", at = @At("HEAD"))
     private void onDisconnect(CallbackInfo ci) {
         EventBus.publish(new DisconnectedFromRemoteServer());
     }
index 0b1e00971204da23abe5b01703e7e719a29ecd37..e402f67782326fdaa50331e5982b34292dce1502 100644 (file)
@@ -16,7 +16,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
 public class MixinPlayerList {
     @Inject(method = "playerLoggedIn", at = @At("RETURN"))
     private void playerLoggedIn(EntityPlayerMP player, CallbackInfo ci) {
-        if(player.connection.netManager.getRemoteAddress() instanceof LocalAddress) return;
+        if (player.connection.netManager.getRemoteAddress() instanceof LocalAddress) return;
         EventBus.publish(new PlayerLoggedIn(new ServerPlayer(player)));
     }
 
index ec2add52c9764a62f29aaf6b51827f8a6faf1138..064f85ddea9874f71a0aa8d8a1a59b056c666d84 100644 (file)
@@ -10,9 +10,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
 
 @Mixin(WorldServer.class)
 public class MixinWorldServer {
-    @Inject(method = "tick", at=@At(value = "INVOKE", target = "Lnet/minecraft/village/VillageCollection;tick()V", shift = At.Shift.AFTER))
+    @Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/village/VillageCollection;tick()V", shift = At.Shift.AFTER))
     private void afterVillageTick(CallbackInfo ci) {
-        EventBus.publish(new ServerWorldTick((WorldServer)(Object)this));
+        EventBus.publish(new ServerWorldTick((WorldServer) (Object) this));
     }
-
 }
index 02000a0865dba7ab6a1ea602a50ff29e060533cd..f5bac41a7a3be6f15845e4b2996b3b391bd99680 100644 (file)
@@ -39,7 +39,6 @@ public class ServerRunner {
             Method method = URLClassLoader.class
                     .getDeclaredMethod("addURL", URL.class);
             method.setAccessible(true);
-           // addURLHandle = MethodHandles.lookup().unreflect(method);
             addURL = url -> method.invoke(ClassLoader.getSystemClassLoader(), url);
         } catch (ReflectiveOperationException e) {
             throw new AssertionError(e);
@@ -47,12 +46,7 @@ public class ServerRunner {
     }
 
     private static void addURLToClasspath(File file) throws MalformedURLException {
-        //try {
-            addURL.accept(file.toURI().toURL());
-            //addURLHandle.invoke(ClassLoader.getSystemClassLoader(), file.toURI().toURL());
-        //} catch (Throwable t) {
-       //     throw t instanceof RuntimeException ? (RuntimeException) t : new RuntimeException(t);
-       // }
+        addURL.accept(file.toURI().toURL());
     }
 
     public static void run(String version, List<String> args) throws IOException {
@@ -85,5 +79,4 @@ public class ServerRunner {
 
         return target;
     }
-
 }
index 25e148f1f595302f514eabdbd087eb764224df34..558c7a3224fe1458dd46f3db61bfd711329aaf0a 100644 (file)
@@ -13,4 +13,4 @@ public interface ThrowableConsumer<T> extends Consumer<T> {
     }
 
     void acceptThrows(T elem) throws Throwable;
-}
\ No newline at end of file
+}