diff --git a/src/main/java/eu/crushedpixel/replaymod/ReplayMod.java b/src/main/java/eu/crushedpixel/replaymod/ReplayMod.java
index ac225995..85e9c0d2 100755
--- a/src/main/java/eu/crushedpixel/replaymod/ReplayMod.java
+++ b/src/main/java/eu/crushedpixel/replaymod/ReplayMod.java
@@ -9,7 +9,6 @@ import eu.crushedpixel.replaymod.holders.KeyframeSet;
import eu.crushedpixel.replaymod.localization.LocalizedResourcePack;
import eu.crushedpixel.replaymod.online.authentication.AuthenticationHandler;
import eu.crushedpixel.replaymod.recording.ConnectionEventHandler;
-import eu.crushedpixel.replaymod.reflection.MCPNames;
import eu.crushedpixel.replaymod.registry.*;
import eu.crushedpixel.replaymod.renderer.InvisibilityRender;
import eu.crushedpixel.replaymod.renderer.SafeEntityRenderer;
@@ -37,8 +36,6 @@ import org.apache.commons.io.FilenameUtils;
import java.io.File;
import java.io.IOException;
-import java.lang.reflect.Field;
-import java.util.List;
import java.util.Queue;
@Mod(modid = ReplayMod.MODID, version = ReplayMod.VERSION)
@@ -81,16 +78,6 @@ public class ReplayMod {
public static RatedFileHandler ratedFileHandler;
public static SpectatorRenderer spectatorRenderer;
- private static Field defaultResourcePacksField;
- static {
- try {
- defaultResourcePacksField = Minecraft.class.getDeclaredField(MCPNames.field("field_110449_ao"));
- defaultResourcePacksField.setAccessible(true);
- } catch(Exception e) {
- e.printStackTrace();
- }
- }
-
// The instance of your mod that Forge uses.
@Instance(value = "ReplayModID")
public static ReplayMod instance;
@@ -156,9 +143,7 @@ public class ReplayMod {
removeTmcprFiles();
try {
- List rps = (List) defaultResourcePacksField.get(mc);
- rps.add(new LocalizedResourcePack());
- defaultResourcePacksField.set(mc, rps);
+ mc.defaultResourcePacks.add(new LocalizedResourcePack());
mc.refreshResources();
} catch(Exception e) {
e.printStackTrace();
diff --git a/src/main/java/eu/crushedpixel/replaymod/gui/online/GuiUploadFile.java b/src/main/java/eu/crushedpixel/replaymod/gui/online/GuiUploadFile.java
index 6c52f77e..d1b253bb 100755
--- a/src/main/java/eu/crushedpixel/replaymod/gui/online/GuiUploadFile.java
+++ b/src/main/java/eu/crushedpixel/replaymod/gui/online/GuiUploadFile.java
@@ -8,10 +8,9 @@ import eu.crushedpixel.replaymod.gui.GuiConstants;
import eu.crushedpixel.replaymod.gui.replayviewer.GuiReplayViewer;
import eu.crushedpixel.replaymod.online.authentication.AuthenticationHandler;
import eu.crushedpixel.replaymod.recording.ReplayMetaData;
-import eu.crushedpixel.replaymod.reflection.MCPNames;
+import eu.crushedpixel.replaymod.registry.ResourceHelper;
import eu.crushedpixel.replaymod.utils.ImageUtils;
import eu.crushedpixel.replaymod.utils.ReplayFile;
-import eu.crushedpixel.replaymod.registry.ResourceHelper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiButton;
@@ -98,7 +97,7 @@ public class GuiUploadFile extends GuiScreen {
//If thumb is null, set image to placeholder
if(thumb == null) {
try {
- thumb = ImageIO.read(MCPNames.class.getClassLoader().getResourceAsStream("default_thumb.jpg"));
+ thumb = ImageIO.read(GuiUploadFile.class.getClassLoader().getResourceAsStream("default_thumb.jpg"));
} catch(Exception e) {
e.printStackTrace();
}
diff --git a/src/main/java/eu/crushedpixel/replaymod/reflection/MCPNames.java b/src/main/java/eu/crushedpixel/replaymod/reflection/MCPNames.java
deleted file mode 100755
index 87aea821..00000000
--- a/src/main/java/eu/crushedpixel/replaymod/reflection/MCPNames.java
+++ /dev/null
@@ -1,140 +0,0 @@
-package eu.crushedpixel.replaymod.reflection;
-
-import com.google.common.base.Splitter;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
-import com.google.common.io.LineProcessor;
-import net.minecraft.launchwrapper.Launch;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.NoSuchElementException;
-
-/**
- *
A helper class for working with obfuscated field names.
- * In the development environment the mappings file will automatically loaded. You can provide the location of a custom mappings file by
- * providing the system property {@code sevencommons.mappingsFile}.
- *
- * @author diesieben07
- * @author CrushedPixel
- */
-public final class MCPNames {
-
- private static final Map fields;
- private static final Map methods;
-
- static {
- if(use()) {
- InputStream fieldsIs = MCPNames.class.getClassLoader().getResourceAsStream("fields.csv");
- InputStream methodsIs = MCPNames.class.getClassLoader().getResourceAsStream("methods.csv");
-
- fields = readMappings(fieldsIs);
- methods = readMappings(methodsIs);
-
- } else {
- methods = fields = null;
- }
- }
-
- /**
- * Whether the code is running in a development environment or not.
- *
- * @return true if the code is running in development mode (use MCP instead of SRG names)
- */
- public static boolean use() {
- return (Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment");
- }
-
- /**
- * Get the correct name for the given SRG field based on the context.
- *
- * @param srg the SRG name for a field
- * @return the input if the code is running outside of development mode or the matching MCP name otherwise
- */
- public static String field(String srg) {
- if(use()) {
- String mcp = fields.get(srg);
- if(mcp == null) {
- // no mapping
- return srg;
- }
- return mcp;
- } else {
- return srg;
- }
- }
-
- /**
- * Get the correct name for the given SRG method based on the context.
- *
- * @param srg the SRG name for a method
- * @return the input if the code is running outside of development mode or the matching MCP name otherwise
- */
- public static String method(String srg) {
- if(use()) {
- String mcp = methods.get(srg);
- if(mcp == null) {
- // no mapping
- return srg;
- }
- return mcp;
- } else {
- return srg;
- }
- }
-
- private static Map readMappings(InputStream is) {
- try {
- InputStreamReader isr = new InputStreamReader(is);
- BufferedReader br = new BufferedReader(isr);
-
- MCPFileParser fileParser = new MCPFileParser();
-
- while(br.ready()) {
- fileParser.processLine(br.readLine());
- }
-
- return fileParser.getResult();
- } catch(IOException e) {
- throw new RuntimeException("Could not read SRG->MCP mappings", e);
- }
- }
-
- private static class MCPFileParser implements LineProcessor