mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-19 11:59:25 +00:00
Fixup the config GUI and get things working again.
This commit is contained in:
1 parent
b54bd33332
commit
015ac2547e
23 files changed
+204
-1384
No files matched your search
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2018.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.common;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.google.common.collect.SetMultimap;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.fml.ModContainer;
|
||||
import net.minecraftforge.fml.client.IDisplayableError;
|
||||
import net.minecraftforge.fml.client.gui.GuiDupesFound;
|
||||
|
||||
public class DuplicateModsFoundException extends LoaderException
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
public SetMultimap<ModContainer, File> dupes;
|
||||
|
||||
public DuplicateModsFoundException(SetMultimap<ModContainer, File> dupes) {
|
||||
this.dupes = dupes;
|
||||
}
|
||||
}
|
||||
@@ -1,131 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2018.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.common;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.fml.client.gui.GuiModsMissing;
|
||||
import net.minecraftforge.fml.client.IDisplayableError;
|
||||
import net.minecraftforge.fml.common.versioning.ArtifactVersion;
|
||||
|
||||
import net.minecraftforge.fml.common.EnhancedRuntimeException.WrappedPrintStream;
|
||||
|
||||
public class MissingModsException extends EnhancedRuntimeException implements IDisplayableError
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final String id;
|
||||
private final String name;
|
||||
private final List<MissingModInfo> missingModsInfos;
|
||||
private final String modName;
|
||||
|
||||
public MissingModsException(String id, String name)
|
||||
{
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.missingModsInfos = new ArrayList<>();
|
||||
this.modName = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage()
|
||||
{
|
||||
Set<ArtifactVersion> missingMods = missingModsInfos.stream().map(MissingModInfo::getAcceptedVersion).collect(Collectors.toSet());
|
||||
return String.format("Mod %s (%s) requires %s", id, name, missingMods);
|
||||
}
|
||||
|
||||
public void addMissingMod(ArtifactVersion acceptedVersion, @Nullable ArtifactVersion currentVersion, boolean required)
|
||||
{
|
||||
MissingModInfo missingModInfo = new MissingModInfo(acceptedVersion, currentVersion, required);
|
||||
this.missingModsInfos.add(missingModInfo);
|
||||
}
|
||||
|
||||
public String getModName()
|
||||
{
|
||||
return modName;
|
||||
}
|
||||
|
||||
public List<MissingModInfo> getMissingModInfos()
|
||||
{
|
||||
return Collections.unmodifiableList(this.missingModsInfos);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void printStackTrace(WrappedPrintStream stream)
|
||||
{
|
||||
stream.println("Missing Mods:");
|
||||
for (MissingModInfo info : this.missingModsInfos)
|
||||
{
|
||||
ArtifactVersion acceptedVersion = info.getAcceptedVersion();
|
||||
ArtifactVersion currentVersion = info.getCurrentVersion();
|
||||
String currentString = currentVersion != null ? currentVersion.getVersionString() : "missing";
|
||||
stream.println(String.format("\t%s : need %s: have %s", acceptedVersion.getVersionString(), acceptedVersion.getRangeString(), currentString));
|
||||
}
|
||||
stream.println("");
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public GuiScreen createGui()
|
||||
{
|
||||
return new GuiModsMissing(this);
|
||||
}
|
||||
|
||||
public static class MissingModInfo
|
||||
{
|
||||
private final ArtifactVersion acceptedVersion;
|
||||
@Nullable
|
||||
private final ArtifactVersion currentVersion;
|
||||
private final boolean required;
|
||||
|
||||
private MissingModInfo(ArtifactVersion acceptedVersion, @Nullable ArtifactVersion currentVersion, boolean required)
|
||||
{
|
||||
Preconditions.checkNotNull(acceptedVersion, "acceptedVersion");
|
||||
this.acceptedVersion = acceptedVersion;
|
||||
this.currentVersion = currentVersion;
|
||||
this.required = required;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ArtifactVersion getCurrentVersion()
|
||||
{
|
||||
return currentVersion;
|
||||
}
|
||||
|
||||
public ArtifactVersion getAcceptedVersion()
|
||||
{
|
||||
return acceptedVersion;
|
||||
}
|
||||
|
||||
public boolean isRequired()
|
||||
{
|
||||
return required;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2018.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.common;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.fml.client.IDisplayableError;
|
||||
import net.minecraftforge.fml.client.gui.GuiMultipleModsErrored;
|
||||
|
||||
import net.minecraftforge.fml.common.EnhancedRuntimeException.WrappedPrintStream;
|
||||
|
||||
public class MultipleModsErrored extends EnhancedRuntimeException implements IDisplayableError
|
||||
{
|
||||
public final List<MissingModsException> missingModsExceptions;
|
||||
public MultipleModsErrored(List<MissingModsException> missingModsExceptions)
|
||||
{
|
||||
this.missingModsExceptions = missingModsExceptions;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public GuiScreen createGui()
|
||||
{
|
||||
return new GuiMultipleModsErrored(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void printStackTrace(WrappedPrintStream stream)
|
||||
{
|
||||
for (MissingModsException missingModsException : this.missingModsExceptions)
|
||||
{
|
||||
missingModsException.printStackTrace(stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user