Made some more public fields either private or final.

This commit is contained in:
RainWarrior committed 2016-03-24 22:22:21 +03:00
1 parent 756c58d5cb
commit 75032ebf9c
32 files changed
+355 -331

No files matched your search

@@ -29,23 +29,11 @@ import net.minecraftforge.fml.common.eventhandler.Event.HasResult;
@HasResult
public class ConfigChangedEvent extends Event
{
/**
* The Mod ID of the mod whose configuration just changed.
*/
public final String modID;
/**
* Whether or not a world is currently running.
*/
public final boolean isWorldRunning;
/**
* Will be set to true if any elements were changed that require a restart of Minecraft.
*/
public final boolean requiresMcRestart;
/**
* A String identifier for this ConfigChangedEvent.
*/
public final String configID;
private final String modID;
private final boolean isWorldRunning;
private final boolean requiresMcRestart;
private final String configID;
public ConfigChangedEvent(String modID, String configID, boolean isWorldRunning, boolean requiresMcRestart)
{
this.modID = modID;
@@ -53,7 +41,39 @@ public class ConfigChangedEvent extends Event
this.isWorldRunning = isWorldRunning;
this.requiresMcRestart = requiresMcRestart;
}
/**
* The Mod ID of the mod whose configuration just changed.
*/
public String getModID()
{
return modID;
}
/**
* Whether or not a world is currently running.
*/
public boolean isWorldRunning()
{
return isWorldRunning;
}
/**
* Will be set to true if any elements were changed that require a restart of Minecraft.
*/
public boolean isRequiresMcRestart()
{
return requiresMcRestart;
}
/**
* A String identifier for this ConfigChangedEvent.
*/
public String getConfigID()
{
return configID;
}
/**
* This event is intended to be consumed by the mod whose config has been changed. It fires when the Done button
* has been clicked on a GuiConfig screen and the following conditions are met:<br/>
@@ -25,10 +25,10 @@ import net.minecraftforge.fml.common.Mod;
*/
public class FMLFingerprintViolationEvent extends FMLEvent {
public final boolean isDirectory;
public final Set<String> fingerprints;
public final File source;
public final String expectedFingerprint;
private final boolean isDirectory;
private final Set<String> fingerprints;
private final File source;
private final String expectedFingerprint;
public FMLFingerprintViolationEvent(boolean isDirectory, File source, ImmutableSet<String> fingerprints, String expectedFingerprint)
{
@@ -38,4 +38,9 @@ public class FMLFingerprintViolationEvent extends FMLEvent {
this.fingerprints = fingerprints;
this.expectedFingerprint = expectedFingerprint;
}
public boolean isDirectory() { return isDirectory; }
public Set<String> getFingerprints() { return fingerprints; }
public File getSource() { return source; }
public String getExpectedFingerprint() { return expectedFingerprint; }
}
@@ -125,6 +125,7 @@ public class FMLProxyPacket implements Packet<INetHandler> {
}
static final int PART_SIZE = 0x1000000 - 0x50; // Make it a constant so that it gets inlined below.
// FIXME int overflow
public static final int MAX_LENGTH = PART_SIZE * 255;
public List<Packet<INetHandlerPlayClient>> toS3FPackets() throws IOException
{
@@ -90,28 +90,6 @@ public class GameData
return getMain().iBlockRegistry.getObject(new ResourceLocation(modId, name));
}
@Deprecated
static GameRegistry.UniqueIdentifier getUniqueName(Block block)
{
if (block == null)
{
return null;
}
Object name = getMain().iBlockRegistry.getNameForObject(block);
return new GameRegistry.UniqueIdentifier(name);
}
@Deprecated
static GameRegistry.UniqueIdentifier getUniqueName(Item item)
{
if (item == null)
{
return null;
}
Object name = getMain().iItemRegistry.getNameForObject(item);
return new GameRegistry.UniqueIdentifier(name);
}
protected static GameData getMain()
{
return mainData;
@@ -388,112 +388,12 @@ public class GameRegistry
return GameData.findItem(modId, name);
}
/**
* Will be switching to using ResourceLocation, since it's used widely elsewhere
*/
@Deprecated
public static final class UniqueIdentifier
{
public final String modId;
public final String name;
UniqueIdentifier(String modId, String name)
{
this.modId = modId;
this.name = name;
}
public UniqueIdentifier(String string)
{
String[] parts = string.split(":");
this.modId = parts[0];
this.name = parts[1];
}
public UniqueIdentifier(Object obj)
{
if (obj instanceof String)
{
String[] parts = ((String)obj).split(":");
this.modId = parts[0];
this.name = parts[1];
}
else if (obj instanceof ResourceLocation)
{
this.modId = ((ResourceLocation)obj).getResourceDomain();
this.name = ((ResourceLocation)obj).getResourcePath();
}
else
{
throw new IllegalArgumentException("UniqueIdentifier must be a String or ResourceLocation, was " + obj.getClass());
}
}
@Override
public boolean equals(Object obj)
{
if (obj == null)
{
return false;
}
if (obj.getClass() != this.getClass())
{
return false;
}
final UniqueIdentifier other = (UniqueIdentifier)obj;
return Objects.equal(modId, other.modId) && Objects.equal(name, other.name);
}
@Override
public int hashCode()
{
return Objects.hashCode(modId, name);
}
@Override
public String toString()
{
return String.format("%s:%s", modId, name);
}
}
public enum Type
{
BLOCK,
ITEM;
}
/**
* Look up the mod identifier data for a block.
* <p/>
* Note: uniqueness and persistence is only guaranteed by mods using the game registry
* correctly.
*
* @param block to lookup
* @return a {@link UniqueIdentifier} for the block or null
*/
@Deprecated
public static UniqueIdentifier findUniqueIdentifierFor(Block block)
{
return GameData.getUniqueName(block);
}
/**
* Look up the mod identifier data for an item.
* <p/>
* Note: uniqueness and persistence is only guaranteed by mods using the game registry
* correctly.
*
* @param item to lookup
* @return a {@link UniqueIdentifier} for the item or null
*/
@Deprecated
public static UniqueIdentifier findUniqueIdentifierFor(Item item)
{
return GameData.getUniqueName(item);
}
/**
* ObjectHolder can be used to automatically populate public static final fields with entries
* from the registry. These values can then be referred within mod code directly.
@@ -29,7 +29,7 @@ public class FMLInjectionData
static String mccversion;
static String mcpversion;
public static List<String> containers = new ArrayList<String>();
public static final List<String> containers = new ArrayList<String>();
static void build(File mcHome, LaunchClassLoader classLoader)
{
@@ -28,7 +28,7 @@ public class FMLRelaunchLog {
* Our special logger for logging issues to. We copy various assets from the
* Minecraft logger to achieve a similar appearance.
*/
public static FMLRelaunchLog log = new FMLRelaunchLog();
public static final FMLRelaunchLog log = new FMLRelaunchLog();
static File minecraftHome;
private static boolean configured;