diff --git a/src/main/java/com/hbm/handler/CompatHandler.java b/src/main/java/com/hbm/handler/CompatHandler.java index fe0b08ca0..2a59c92fe 100644 --- a/src/main/java/com/hbm/handler/CompatHandler.java +++ b/src/main/java/com/hbm/handler/CompatHandler.java @@ -39,14 +39,14 @@ public class CompatHandler { */ public static Object[] steamTypeToInt(FluidType type) { switch(type.getID()) { - default: - return new Object[] {0}; case(4): // Fluids.HOTSTEAM return new Object[] {1}; case(5): // Fluids.SUPERHOTSTEAM return new Object[] {2}; case(6): // Fluids.ULTRAHOTSTEAM return new Object[] {3}; + default: + return new Object[] {0}; } } @@ -57,14 +57,14 @@ public class CompatHandler { */ public static FluidType intToSteamType(int arg) { switch(arg) { - default: - return Fluids.STEAM; case(1): return Fluids.HOTSTEAM; case(2): return Fluids.SUPERHOTSTEAM; case(3): return Fluids.ULTRAHOTSTEAM; + default: + return Fluids.STEAM; } } @@ -72,7 +72,7 @@ public class CompatHandler { * Allows for easy creation of read-only filesystems. Primarily for floppy disks. * (Though maybe reading directly from VOTV drives as filesystems could be implemented. :3) **/ - private static class ReadOnlyFileSystem implements Callable { + protected static class ReadOnlyFileSystem implements Callable { private final String name; @@ -90,7 +90,7 @@ public class CompatHandler { // Floppy disk class. public static class FloppyDisk { // Specifies the callable ReadOnlyFileSystem to allow OC to access the floppy. - public final ReadOnlyFileSystem fs; + protected final ReadOnlyFileSystem fs; // Specifies the color of the floppy disk (0-16 colors defined by OC). public final Byte color; // Set after loading the disk; allows for adding a recipe to the item. @@ -103,7 +103,7 @@ public class CompatHandler { // Disk names will be sanitized before the FileSystem is created. // This only affects the location/directory, not the display name. - // (Prevents filesystems from breaking/crashing due to having file separators, wildcards, etc. + // (Prevents filesystems from breaking/crashing due to having file separators, wildcards, etc.) public static String sanitizeName(String input) { return input.toLowerCase().replaceAll("\\W", ""); } @@ -152,7 +152,7 @@ public class CompatHandler { // begin registering disks Logger logger = LogManager.getLogger("HBM"); logger.info("Loading OpenComputers disks..."); - if(disks.size() == 0) { + if(disks.isEmpty()) { logger.info("No disks registered; see com.hbm.handler.CompatHandler.disks"); return; } @@ -163,13 +163,13 @@ public class CompatHandler { if (fs == null) { // Disk path does NOT exist, and it should not be loaded. - logger.error("Error loading disk: " + s + " at /assets/" + RefStrings.MODID + "/disks/" + disk.fs.name); + logger.error("Error loading disk: {} at /assets/" + RefStrings.MODID + "/disks/{}", s, disk.fs.name); logger.error("This is likely due to the path to the disk being non-existent."); } else { // Disk path DOES exist, and it should be loaded. disk.item = Items.registerFloppy(s, disk.color, disk.fs); // The big part, actually registering the floppies! - logger.info("Registered disk: " + s + " at /assets/" + RefStrings.MODID + "/disks/" + disk.fs.name); + logger.info("Registered disk: {} at /assets/" + RefStrings.MODID + "/disks/{}", s, disk.fs.name); } }); @@ -178,10 +178,10 @@ public class CompatHandler { // OC disk recipes! List floppyDisks = new RecipesCommon.OreDictStack("oc:floppy").toStacks(); - if(floppyDisks.size() > 0) { //check that floppy disks even exist in oredict. + if(!floppyDisks.isEmpty()) { //check that floppy disks even exist in oredict. // Recipes must be initialized here, since if they were initialized in `CraftingManager` then the disk item would not be created yet. - addShapelessAuto(disks.get("PWRangler").item, new Object[] {"oc:floppy", new ItemStack(ModBlocks.pwr_casing)}); + addShapelessAuto(disks.get("PWRangler").item, "oc:floppy", new ItemStack(ModBlocks.pwr_casing)); logger.info("OpenComputers disk recipe added for PWRangler."); } else { diff --git a/src/main/java/com/hbm/handler/neutron/NeutronHandler.java b/src/main/java/com/hbm/handler/neutron/NeutronHandler.java index a6bd17f4f..967ddc90e 100644 --- a/src/main/java/com/hbm/handler/neutron/NeutronHandler.java +++ b/src/main/java/com/hbm/handler/neutron/NeutronHandler.java @@ -2,6 +2,8 @@ package com.hbm.handler.neutron; import com.hbm.tileentity.machine.rbmk.RBMKDials; import com.hbm.util.fauxpointtwelve.BlockPos; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.TickEvent; import net.minecraft.world.World; import java.util.ArrayList; @@ -14,7 +16,11 @@ public class NeutronHandler { private static int ticks = 0; - public static void onWorldTick() { + @SubscribeEvent + public static void onServerTick(TickEvent.ServerTickEvent event) { + if(event.phase != TickEvent.Phase.START) + return; + // Remove `StreamWorld` objects if they have no streams. { // aflghdkljghlkbhfjkghgilurbhlkfjghkffdjgn List toRemove = new ArrayList<>(); diff --git a/src/main/java/com/hbm/main/ModEventHandler.java b/src/main/java/com/hbm/main/ModEventHandler.java index b30c9bfdf..fda12006a 100644 --- a/src/main/java/com/hbm/main/ModEventHandler.java +++ b/src/main/java/com/hbm/main/ModEventHandler.java @@ -18,7 +18,6 @@ import com.hbm.extprop.HbmLivingProps; import com.hbm.extprop.HbmPlayerProps; import com.hbm.handler.*; import com.hbm.handler.HbmKeybinds.EnumKeybind; -import com.hbm.handler.neutron.NeutronHandler; import com.hbm.handler.neutron.NeutronNodeWorld; import com.hbm.handler.pollution.PollutionHandler; import com.hbm.handler.pollution.PollutionHandler.PollutionType; @@ -1176,8 +1175,6 @@ public class ModEventHandler { TileEntityMachineRadarNT.updateSystem(); Nodespace.updateNodespace(); // bob i beg of you i need fluid nodespace :pray: - - NeutronHandler.onWorldTick(); // All neutron interactions } // There is an issue here somewhere... @@ -1205,7 +1202,7 @@ public class ModEventHandler { if(command instanceof CommandGameRule) { if(command.canCommandSenderUseCommand(sender)) { command.processCommand(sender,event.parameters); - RBMKDials.refresh(sender.getEntityWorld()); + RBMKDials.refresh(sender.getEntityWorld()); // Refresh RBMK gamerules. event.setCanceled(true); } }