Skip to content

Instantly share code, notes, and snippets.

Created July 29, 2016 17:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/e66fa851a5248e5284ef27cadc1603be to your computer and use it in GitHub Desktop.
Save anonymous/e66fa851a5248e5284ef27cadc1603be to your computer and use it in GitHub Desktop.
package com.bigsis.spookjams; //My comments in this class are present in light-colored lines like this one that follow two forward-slashes ("//"). To remove these, go to "Edit > Find/Replace...", add "//.*" to the Find field, and press "Replace All".
public class Reference //This is a collection of constants used throughout the mod to help keep the code cleaner by keeping most variable information stored here in a single location.
{
public static final String MOD_ID = "bssjm"; //Internal name of your mod, it MUST be unique to prevent clashing with other mods.
public static final String NAME = "Big Sister's SpookJam Crash Course Mod"; //The name of your mod as displayed on the Minecraft Mod Detail screen.
public static final String VERSION = "0.1-wheat"; //Your version identifier; you can use numbers, decimals, alpha/beta tags, or you can be like me and get creative (I'm naming my alpha versions after grains and pulses!).
public static final String MINECRAFT_VERSION = "[1.9.4]"; //The version of Minecraft that this mod is compatible with; you can use a static value, or use special syntax to have it be compatible with other Minecraft version variants.
public static final String CLIENT_PROXY_CLASS = "com.bigsis.spookjams.proxy.ClientProxy"; //Pointer to the Minecraft client proxy; references the ClientProxy.java class inside the com.bigsis.spookjams.proxy package.
public static final String SERVER_PROXY_CLASS = "com.bigsis.spookjams.proxy.ServerProxy"; //Pointer to the Minecraft server proxy; references the ServerProxy.java class inside the com.bigsis.spookjams.proxy package.
public static enum SpookjamItems //An enum type is a special data type that enables for a variable to be a set of predefined constants.
{
CHEESE("cheese","ItemCheese"), //We are declaring a CHEESE enum to be its common and system name. The declarations go first before the actual instructions on how to parse this below.
GF_BREAD("gf_bread","ItemGFBread"); //NOTE THE NEW COMMA AFTER THE CHEESE ENUM!!! We are declaring a GF_BREAD enum to be its common and system name. The declarations go first before the actual instructions on how to parse this below.
private String unlocalizedName; //Declare a blank text string to hold the common name variable of this enum.
private String registryName; //Declare a blank text string to hold the system name variable of this enum.
SpookjamItems(String unlocalizedNameTarget, String registryNameTarget) //Instructions on how to parse each enum that is declared (in this example: "CHEESE("cheese","ItemCheese"). Note that two parameters are allotted to this enum.
{
this.unlocalizedName = unlocalizedNameTarget; //Populate unlocalizedName with the first parameter of the enum (in this example, "cheese").
this.registryName = registryNameTarget; //Populate registryName with the second parameter of the enum (in this example, "ItemCheese").
}
public String getUnlocalizedName() //Declare a Get method in order to extract the common name variable of this enum, since it may get referenced again throughout the code.
{
return unlocalizedName; //Have this String method return the common name variable of this enum.
}
public String getRegistryName() //Declare a Get method in order to extract the system name variable of this enum, since it may get referenced again throughout the code.
{
return registryName; //Have this String method return the system name variable of this enum.
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment