Skip to content

Commit

Permalink
Reorganize project structure
Browse files Browse the repository at this point in the history
  • Loading branch information
mezz committed Mar 29, 2017
1 parent a48fb4b commit b4aac3a
Show file tree
Hide file tree
Showing 132 changed files with 3,472 additions and 3,514 deletions.
4 changes: 1 addition & 3 deletions src/main/java/com/abahgat/suffixtree/Node.java
Expand Up @@ -161,9 +161,7 @@ private Set<Integer> computeAndCacheCountRecursive() {
ret.add(num);
}
for (Edge e : edges.getValues()) {
for (int num : e.getDest().computeAndCacheCountRecursive()) {
ret.add(num);
}
ret.addAll(e.getDest().computeAndCacheCountRecursive());
}

resultCount = ret.size();
Expand Down
193 changes: 98 additions & 95 deletions src/main/java/mezz/jei/Internal.java
@@ -1,95 +1,98 @@
package mezz.jei;

import javax.annotation.Nullable;

import com.google.common.base.Preconditions;
import mezz.jei.gui.recipes.IngredientLookupMemory;
import mezz.jei.util.ModIdUtil;
import mezz.jei.util.StackHelper;
import mezz.jei.util.color.ColorNamer;

/**
* For JEI internal use only, these are normally accessed from the API.
*/
public class Internal {

private static final ModIdUtil modIdUtil = new ModIdUtil();
@Nullable
private static StackHelper stackHelper;
@Nullable
private static JeiHelpers helpers;
@Nullable
private static JeiRuntime runtime;
@Nullable
private static IngredientRegistry ingredientRegistry;
@Nullable
private static ColorNamer colorNamer;
@Nullable
private static IngredientLookupMemory ingredientLookupMemory;

private Internal() {

}

public static StackHelper getStackHelper() {
Preconditions.checkState(stackHelper != null, "StackHelper has not been created yet.");
return stackHelper;
}

public static void setStackHelper(StackHelper stackHelper) {
Internal.stackHelper = stackHelper;
}

public static ModIdUtil getModIdUtil() {
return modIdUtil;
}

public static JeiHelpers getHelpers() {
Preconditions.checkState(helpers != null, "JeiHelpers has not been created yet.");
return helpers;
}

public static void setHelpers(JeiHelpers helpers) {
Internal.helpers = helpers;
}

@Nullable
public static JeiRuntime getRuntime() {
return runtime;
}

public static void setRuntime(JeiRuntime runtime) {
JeiRuntime jeiRuntime = Internal.runtime;
if (jeiRuntime != null) {
jeiRuntime.close();
}
Internal.runtime = runtime;
}

public static IngredientRegistry getIngredientRegistry() {
Preconditions.checkState(ingredientRegistry != null, "Ingredient Registry has not been created yet.");
return ingredientRegistry;
}

public static void setIngredientRegistry(IngredientRegistry ingredientRegistry) {
Internal.ingredientRegistry = ingredientRegistry;
}

public static ColorNamer getColorNamer() {
Preconditions.checkState(colorNamer != null, "Color Namer has not been created yet.");
return colorNamer;
}

public static void setColorNamer(ColorNamer colorNamer) {
Internal.colorNamer = colorNamer;
}

public static IngredientLookupMemory getIngredientLookupMemory() {
Preconditions.checkState(ingredientLookupMemory != null, "Ingredient Lookup Memory has not been created yet.");
return ingredientLookupMemory;
}

public static void setIngredientLookupMemory(IngredientLookupMemory ingredientLookupMemory) {
Internal.ingredientLookupMemory = ingredientLookupMemory;
}
}
package mezz.jei;

import javax.annotation.Nullable;

import com.google.common.base.Preconditions;
import mezz.jei.color.ColorNamer;
import mezz.jei.gui.ingredients.IngredientLookupMemory;
import mezz.jei.ingredients.IngredientRegistry;
import mezz.jei.runtime.JeiHelpers;
import mezz.jei.runtime.JeiRuntime;
import mezz.jei.startup.ModIdHelper;
import mezz.jei.startup.StackHelper;

/**
* For JEI internal use only, these are normally accessed from the API.
*/
public final class Internal {

private static final ModIdHelper MOD_ID_HELPER = new ModIdHelper();
@Nullable
private static StackHelper stackHelper;
@Nullable
private static JeiHelpers helpers;
@Nullable
private static JeiRuntime runtime;
@Nullable
private static IngredientRegistry ingredientRegistry;
@Nullable
private static ColorNamer colorNamer;
@Nullable
private static IngredientLookupMemory ingredientLookupMemory;

private Internal() {

}

public static StackHelper getStackHelper() {
Preconditions.checkState(stackHelper != null, "StackHelper has not been created yet.");
return stackHelper;
}

public static void setStackHelper(StackHelper stackHelper) {
Internal.stackHelper = stackHelper;
}

public static ModIdHelper getModIdHelper() {
return MOD_ID_HELPER;
}

public static JeiHelpers getHelpers() {
Preconditions.checkState(helpers != null, "JeiHelpers has not been created yet.");
return helpers;
}

public static void setHelpers(JeiHelpers helpers) {
Internal.helpers = helpers;
}

@Nullable
public static JeiRuntime getRuntime() {
return runtime;
}

public static void setRuntime(JeiRuntime runtime) {
JeiRuntime jeiRuntime = Internal.runtime;
if (jeiRuntime != null) {
jeiRuntime.close();
}
Internal.runtime = runtime;
}

public static IngredientRegistry getIngredientRegistry() {
Preconditions.checkState(ingredientRegistry != null, "Ingredient Registry has not been created yet.");
return ingredientRegistry;
}

public static void setIngredientRegistry(IngredientRegistry ingredientRegistry) {
Internal.ingredientRegistry = ingredientRegistry;
}

public static ColorNamer getColorNamer() {
Preconditions.checkState(colorNamer != null, "Color Namer has not been created yet.");
return colorNamer;
}

public static void setColorNamer(ColorNamer colorNamer) {
Internal.colorNamer = colorNamer;
}

public static IngredientLookupMemory getIngredientLookupMemory() {
Preconditions.checkState(ingredientLookupMemory != null, "Ingredient Lookup Memory has not been created yet.");
return ingredientLookupMemory;
}

public static void setIngredientLookupMemory(IngredientLookupMemory ingredientLookupMemory) {
Internal.ingredientLookupMemory = ingredientLookupMemory;
}
}
40 changes: 0 additions & 40 deletions src/main/java/mezz/jei/ItemBlacklist.java

This file was deleted.

3 changes: 2 additions & 1 deletion src/main/java/mezz/jei/JustEnoughItems.java
Expand Up @@ -4,6 +4,7 @@

import mezz.jei.config.Constants;
import mezz.jei.config.SessionData;
import mezz.jei.startup.ProxyCommon;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
Expand All @@ -21,7 +22,7 @@
public class JustEnoughItems {

@SuppressWarnings("NullableProblems")
@SidedProxy(clientSide = "mezz.jei.ProxyCommonClient", serverSide = "mezz.jei.ProxyCommon")
@SidedProxy(clientSide = "mezz.jei.startup.ProxyCommonClient", serverSide = "mezz.jei.startup.ProxyCommon")
private static ProxyCommon proxy;

public static ProxyCommon getProxy() {
Expand Down
Expand Up @@ -21,7 +21,7 @@
/**
* List of built-in recipe category UIDs, so that plugins with their own recipe handlers can use them.
*/
public class VanillaRecipeCategoryUid {
public final class VanillaRecipeCategoryUid {
/**
* The crafting recipe category.
* <p>
Expand Down
@@ -1,4 +1,4 @@
package mezz.jei.util.color;
package mezz.jei.color;

import javax.annotation.Nullable;
import java.awt.Color;
Expand All @@ -23,7 +23,7 @@
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;

public class ColorGetter {
public final class ColorGetter {
private static final String[] defaultColors = new String[]{
"White:EEEEEE",
"LightBlue:7492cc",
Expand Down Expand Up @@ -88,6 +88,7 @@ private static List<Color> unsafeGetColors(ItemStack itemStack, int colorCount)
} else if (item instanceof ItemBlock) {
final ItemBlock itemBlock = (ItemBlock) item;
final Block block = itemBlock.getBlock();
//noinspection ConstantConditions
if (block == null) {
return Collections.emptyList();
}
Expand Down
@@ -1,4 +1,4 @@
package mezz.jei.util.color;
package mezz.jei.color;

import javax.annotation.Nullable;
import java.awt.Color;
Expand Down
@@ -1,4 +1,4 @@
package mezz.jei.util.color;
package mezz.jei.color;

/*
* Java Color Thief
Expand Down
@@ -1,8 +1,8 @@
package mezz.jei.util.color;
package mezz.jei.color;

import java.awt.Color;

public class ColorUtil {
public final class ColorUtil {
private ColorUtil() {

}
Expand Down
@@ -1,4 +1,4 @@
package mezz.jei.util.color;
package mezz.jei.color;

/*
* Java Color Thief
Expand Down
@@ -1,7 +1,7 @@
@ParametersAreNonnullByDefault
@FieldsAreNonnullByDefault
@MethodsReturnNonnullByDefault
package mezz.jei.util.color;
package mezz.jei.color;

import javax.annotation.ParametersAreNonnullByDefault;

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/mezz/jei/config/Config.java
Expand Up @@ -14,19 +14,19 @@
import mezz.jei.Internal;
import mezz.jei.JustEnoughItems;
import mezz.jei.api.ingredients.IIngredientHelper;
import mezz.jei.color.ColorGetter;
import mezz.jei.color.ColorNamer;
import mezz.jei.network.packets.PacketRequestCheatPermission;
import mezz.jei.util.Log;
import mezz.jei.util.Translator;
import mezz.jei.util.color.ColorGetter;
import mezz.jei.util.color.ColorNamer;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.ConfigCategory;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

public class Config {
public final class Config {
private static final String configKeyPrefix = "config.jei";

public static final String CATEGORY_SEARCH = "search";
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/mezz/jei/config/Constants.java
Expand Up @@ -4,7 +4,7 @@

import mezz.jei.util.Translator;

public class Constants {
public final class Constants {
public static final String minecraftModName = "Minecraft";

// Mod info
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/mezz/jei/config/KeyBindings.java
Expand Up @@ -6,7 +6,7 @@
import net.minecraftforge.fml.client.registry.ClientRegistry;
import org.lwjgl.input.Keyboard;

public class KeyBindings {
public final class KeyBindings {
private static final String categoryName = Constants.MOD_ID + " (" + Constants.NAME + ')';

public static final KeyBinding toggleOverlay = new KeyBinding("key.jei.toggleOverlay", KeyConflictContext.GUI, KeyModifier.CONTROL, Keyboard.KEY_O, categoryName);
Expand All @@ -16,6 +16,9 @@ public class KeyBindings {
public static final KeyBinding recipeBack = new KeyBinding("key.jei.recipeBack", KeyConflictContext.GUI, Keyboard.KEY_BACK, categoryName);
public static final KeyBinding toggleCheatMode = new KeyBinding("key.jei.toggleCheatMode", KeyConflictContext.GUI, Keyboard.KEY_NONE, categoryName);

private KeyBindings() {
}

public static void init() {
ClientRegistry.registerKeyBinding(toggleOverlay);
ClientRegistry.registerKeyBinding(focusSearch);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/mezz/jei/config/SessionData.java
Expand Up @@ -8,7 +8,7 @@
import net.minecraft.server.MinecraftServer;
import net.minecraftforge.fml.client.FMLClientHandler;

public class SessionData {
public final class SessionData {
private static boolean jeiOnServer = false;
private static boolean joinedWorld = false;
@Nullable
Expand Down

0 comments on commit b4aac3a

Please sign in to comment.