More error cleanup, reinstanted IForgeReigstryEntry.

The abstract class will be used as the default, and to enable delegates but we should keep it api simple by keeping the interface.
Removed some patches that didnt get removed in the rebase.
This commit is contained in:
LexManos committed 2018-09-05 20:06:18 -07:00
1 parent ff6fa2cfaf
commit 2798080f60
35 files changed
+200 -472

No files matched your search

@@ -23,7 +23,6 @@ import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.multiplayer.ServerData;
import net.minecraft.client.resources.I18n;
import net.minecraftforge.fml.client.FMLClientHandler;
public class GuiAccessDenied extends GuiScreen
{
@@ -38,17 +37,15 @@ public class GuiAccessDenied extends GuiScreen
@Override
public void initGui()
{
this.buttonList.add(new GuiButton(1, this.width / 2 - 75, this.height - 38, I18n.format("gui.done")));
this.buttonList.add(new GuiButton(1, this.width / 2 - 75, this.height - 38, I18n.format("gui.done"))
{
public void func_194829_a(double p_194829_1_, double p_194829_3_)
{
GuiAccessDenied.this.mc.displayGuiScreen(parent);
}
});
}
@Override
protected void actionPerformed(GuiButton p_73875_1_)
{
if (p_73875_1_.enabled && p_73875_1_.id == 1)
{
FMLClientHandler.instance().showGuiScreen(parent);
}
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks)
{
@@ -19,11 +19,11 @@
package net.minecraftforge.fml.client.gui;
import java.awt.Desktop;
import java.io.File;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n;
import net.minecraftforge.fml.client.FMLClientHandler;
public class GuiBackupFailed extends GuiScreen
{
@@ -38,17 +38,15 @@ public class GuiBackupFailed extends GuiScreen
@Override
public void initGui()
{
this.buttonList.add(new GuiButton(1, this.width / 2 - 75, this.height - 38, I18n.format("gui.done")));
this.buttonList.add(new GuiButton(1, this.width / 2 - 75, this.height - 38, I18n.format("gui.done"))
{
public void func_194829_a(double p_194829_1_, double p_194829_3_)
{
GuiBackupFailed.this.mc.displayGuiScreen(parent);
}
});
}
@Override
protected void actionPerformed(GuiButton p_73875_1_)
{
if (p_73875_1_.enabled && p_73875_1_.id == 1)
{
FMLClientHandler.instance().showGuiScreen(parent);
}
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks)
{
@@ -18,11 +18,8 @@
*/
package net.minecraftforge.fml.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiOptionButton;
import net.minecraft.client.resources.I18n;
import net.minecraftforge.fml.client.FMLClientHandler;
import net.minecraftforge.fml.StartupQuery;
public class GuiConfirmation extends GuiNotification
@@ -35,18 +32,23 @@ public class GuiConfirmation extends GuiNotification
@Override
public void initGui()
{
this.buttonList.add(new GuiOptionButton(0, this.width / 2 - 155, this.height - 38, I18n.format("gui.yes")));
this.buttonList.add(new GuiOptionButton(1, this.width / 2 - 155 + 160, this.height - 38, I18n.format("gui.no")));
}
@Override
protected void actionPerformed(GuiButton button)
{
if (button.enabled && (button.id == 0 || button.id == 1))
this.buttonList.add(new GuiOptionButton(0, this.width / 2 - 155, this.height - 38, I18n.format("gui.yes"))
{
FMLClientHandler.instance().showGuiScreen(null);
query.setResult(button.id == 0);
query.finish();
}
public void func_194829_a(double p_194829_1_, double p_194829_3_)
{
GuiConfirmation.this.mc.displayGuiScreen(null);
query.setResult(true);
query.finish();
}
});
this.buttonList.add(new GuiOptionButton(1, this.width / 2 - 155 + 160, this.height - 38, I18n.format("gui.no"))
{
public void func_194829_a(double p_194829_1_, double p_194829_3_)
{
GuiConfirmation.this.mc.displayGuiScreen(null);
query.setResult(false);
query.finish();
}
});
}
}
@@ -22,14 +22,16 @@ package net.minecraftforge.fml.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiErrorScreen;
import net.minecraft.client.resources.I18n;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.Loader;
import java.awt.*;
import java.io.File;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class GuiErrorBase extends GuiErrorScreen
{
private static final Logger LOGGER = LogManager.getLogger();
static final File minecraftDir = new File(Loader.instance().getConfigDir().getParent());
static final File logFile = new File(minecraftDir, "logs/latest.log");
public GuiErrorBase()
@@ -47,45 +49,44 @@ public class GuiErrorBase extends GuiErrorScreen
{
super.initGui();
this.buttonList.clear();
this.buttonList.add(new GuiButton(10, 50, this.height - 38, this.width / 2 - 55, 20, translateOrDefault("fml.button.open.mods.folder", "Open Mods Folder")));
this.buttonList.add(new GuiButton(10, 50, this.height - 38, this.width / 2 - 55, 20, translateOrDefault("fml.button.open.mods.folder", "Open Mods Folder"))
{
public void func_194829_a(double p_194829_1_, double p_194829_3_)
{
try
{
File modsDir = new File(minecraftDir, "mods");
Desktop.getDesktop().open(modsDir);
}
catch (Exception e)
{
LOGGER.error("Problem opening mods folder", e);
}
}
});
String openFileText = translateOrDefault("fml.button.open.file", "Open %s", logFile.getName());
this.buttonList.add(new GuiButton(11, this.width / 2 + 5, this.height - 38, this.width / 2 - 55, 20, openFileText));
}
@Override
protected void actionPerformed(GuiButton button)
{
if (button.id == 10)
this.buttonList.add(new GuiButton(11, this.width / 2 + 5, this.height - 38, this.width / 2 - 55, 20, openFileText)
{
try
public void func_194829_a(double p_194829_1_, double p_194829_3_)
{
File modsDir = new File(minecraftDir, "mods");
Desktop.getDesktop().open(modsDir);
try
{
Desktop.getDesktop().open(logFile);
}
catch (Exception e)
{
LOGGER.error("Problem opening log file {}", logFile, e);
}
}
catch (Exception e)
{
FMLLog.log.error("Problem opening mods folder", e);
}
}
else if (button.id == 11)
{
try
{
Desktop.getDesktop().open(logFile);
}
catch (Exception e)
{
FMLLog.log.error("Problem opening log file {}", logFile, e);
}
}
});
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks)
{
for(GuiButton button : buttonList)
for (GuiButton button : buttonList)
{
button.drawButton(this.mc, mouseX, mouseY, partialTicks);
button.func_194828_a(mouseX, mouseY, partialTicks);
}
}
}
@@ -24,8 +24,6 @@ import java.util.List;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n;
import net.minecraftforge.fml.client.FMLClientHandler;
import net.minecraftforge.fml.common.MissingModsException;
import net.minecraftforge.fml.common.versioning.ArtifactVersion;
public class GuiModsMissingForServer extends GuiScreen
@@ -40,17 +38,15 @@ public class GuiModsMissingForServer extends GuiScreen
@Override
public void initGui()
{
this.buttonList.add(new GuiButton(1, this.width / 2 - 75, this.height - 38, I18n.format("gui.done")));
this.buttonList.add(new GuiButton(1, this.width / 2 - 75, this.height - 38, I18n.format("gui.done"))
{
public void func_194829_a(double p_194829_1_, double p_194829_3_)
{
GuiModsMissingForServer.this.mc.displayGuiScreen(null);
}
});
}
@Override
protected void actionPerformed(GuiButton p_73875_1_)
{
if (p_73875_1_.enabled && p_73875_1_.id == 1)
{
FMLClientHandler.instance().showGuiScreen(null);
}
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks)
{
@@ -22,7 +22,6 @@ package net.minecraftforge.fml.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n;
import net.minecraftforge.fml.client.FMLClientHandler;
import net.minecraftforge.fml.StartupQuery;
public class GuiNotification extends GuiScreen
@@ -35,17 +34,14 @@ public class GuiNotification extends GuiScreen
@Override
public void initGui()
{
this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height - 38, I18n.format("gui.done")));
}
@Override
protected void actionPerformed(GuiButton button)
{
if (button.enabled && button.id == 0)
this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height - 38, I18n.format("gui.done"))
{
FMLClientHandler.instance().showGuiScreen(null);
query.finish();
}
public void func_194829_a(double p_194829_1_, double p_194829_3_)
{
GuiNotification.this.mc.displayGuiScreen(null);
query.finish();
}
});
}
@Override
@@ -51,7 +51,7 @@ public class ForgeRegistries
public static final IForgeRegistry<PotionType> POTION_TYPES = RegistryManager.ACTIVE.getRegistry(PotionType.class);
public static final IForgeRegistry<Enchantment> ENCHANTMENTS = RegistryManager.ACTIVE.getRegistry(Enchantment.class);
public static final IForgeRegistry<VillagerProfession> VILLAGER_PROFESSIONS = RegistryManager.ACTIVE.getRegistry(VillagerProfession.class);
public static final IForgeRegistry<Entity> ENTITIES = RegistryManager.ACTIVE.getRegistry(Entity.class);
public static final IForgeRegistry<EntityEntry> ENTITIES = RegistryManager.ACTIVE.getRegistry(EntityEntry.class);
public static final IForgeRegistry<IRecipe> RECIPES = RegistryManager.ACTIVE.getRegistry(IRecipe.class);
@@ -29,12 +29,14 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.google.common.io.Files;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonSyntaxException;
import net.minecraftforge.fml.common.FMLLog;
/**
* This is different from the standard maven snapshot metadata.
* Because none of that data is exposed to us as a user of gradle/maven/whatever.
@@ -52,6 +54,7 @@ import net.minecraftforge.fml.common.FMLLog;
*/
public class SnapshotJson implements Comparable<SnapshotJson>
{
private static final Logger LOGGER = LogManager.getLogger();
public static final DateFormat TIMESTAMP = new SimpleDateFormat("yyyyMMdd.hhmmss");
public static final String META_JSON_FILE = "maven-metadata.json";
private static final Gson GSON = new GsonBuilder().create();
@@ -71,11 +74,11 @@ public class SnapshotJson implements Comparable<SnapshotJson>
}
catch (JsonSyntaxException jse)
{
FMLLog.log.info(FMLLog.log.getMessageFactory().newMessage("Failed to parse snapshot json file {}.", target), jse);
LOGGER.info("Failed to parse snapshot json file " + target + ".", jse);
}
catch (IOException ioe)
{
FMLLog.log.info(FMLLog.log.getMessageFactory().newMessage("Failed to read snapshot json file {}.", target), ioe);
LOGGER.info("Failed to read snapshot json file " + target + ".", ioe);
}
return new SnapshotJson();