Code improvements

This commit is contained in:
Raoul Van den Berge
2016-06-05 20:13:38 +02:00
parent 58028ffafc
commit 82c74f82b4
4 changed files with 13 additions and 16 deletions

View File

@@ -170,21 +170,18 @@ public class GuiGrid extends GuiBase {
}
public boolean isHoveringOverClear(int mouseX, int mouseY) {
if (grid.getType() == EnumGridType.CRAFTING) {
return inBounds(81, 105, 7, 7, mouseX, mouseY);
} else if (grid.getType() == EnumGridType.PATTERN) {
return inBounds(64, 105, 7, 7, mouseX, mouseY);
switch (grid.getType()) {
case CRAFTING:
return inBounds(81, 105, 7, 7, mouseX, mouseY);
case PATTERN:
return inBounds(64, 105, 7, 7, mouseX, mouseY);
default:
return false;
}
return false;
}
public boolean isHoveringOverCreatePattern(int mouseX, int mouseY) {
if (grid.getType() == EnumGridType.PATTERN) {
return inBounds(152, 124, 16, 16, mouseX, mouseY) && ((TileGrid) grid).mayCreatePattern();
}
return false;
return grid.getType() == EnumGridType.PATTERN && inBounds(152, 124, 16, 16, mouseX, mouseY) && ((TileGrid) grid).mayCreatePattern();
}
@Override
@@ -297,9 +294,9 @@ public class GuiGrid extends GuiBase {
}
if (qty >= 1000000) {
return String.format("%.1f", (float) qty / 1000000).replace(",", ".").replace(".0", "") + "M";
return String.format(Locale.US, "%.1f", Math.floor(qty / 1000000)).replace(".0", "") + "M";
} else if (qty >= 1000) {
return String.format("%.1f", (float) qty / 1000).replace(",", ".").replace(".0", "") + "K";
return String.format(Locale.US, "%.1f", Math.floor(qty / 1000)).replace(".0", "") + "K";
} else if (qty == 1) {
return null;
} else if (qty == 0) {

View File

@@ -1,6 +1,6 @@
package refinedstorage.tile.config;
public class ModeConstants {
public final class ModeConstants {
public static final int WHITELIST = 0;
public static final int BLACKLIST = 1;
}

View File

@@ -4,7 +4,7 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandler;
import refinedstorage.RefinedStorageUtils;
public class ModeFilter {
public final class ModeFilter {
public static boolean respectsMode(IItemHandler filters, IModeConfig mode, int compare, ItemStack stack) {
if (mode.getMode() == ModeConstants.WHITELIST) {
int slots = 0;

View File

@@ -9,7 +9,7 @@ import refinedstorage.tile.TileRelay;
import java.util.Set;
public class ControllerSearcher {
public final class ControllerSearcher {
public static TileController search(World world, BlockPos current, Set<String> visited) {
if (visited.contains(current.getX() + "," + current.getY() + "," + current.getZ())) {
return null;