2016-06-22 23:49:47 -04:00
|
|
|
/*
|
|
|
|
|
* Minecraft Forge
|
|
|
|
|
* Copyright (c) 2016.
|
|
|
|
|
*
|
|
|
|
|
* 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
|
|
|
|
|
*/
|
|
|
|
|
|
2012-08-04 22:45:31 -07:00
|
|
|
package net.minecraftforge.client;
|
|
|
|
|
|
2018-01-18 14:39:14 -06:00
|
|
|
import net.minecraft.client.audio.MusicTicker;
|
|
|
|
|
import net.minecraft.util.SoundEvent;
|
2013-12-09 21:59:12 -08:00
|
|
|
import net.minecraft.util.Util.EnumOS;
|
2016-06-23 02:39:36 -04:00
|
|
|
import net.minecraft.world.GameType;
|
2016-05-24 16:10:47 -07:00
|
|
|
import net.minecraft.client.settings.GameSettings.Options;
|
2013-12-12 23:32:36 -08:00
|
|
|
import net.minecraftforge.common.util.EnumHelper;
|
2012-08-04 22:45:31 -07:00
|
|
|
|
2017-01-11 15:17:56 -08:00
|
|
|
import javax.annotation.Nullable;
|
|
|
|
|
|
2012-08-04 22:45:31 -07:00
|
|
|
public class EnumHelperClient extends EnumHelper
|
|
|
|
|
{
|
2016-03-23 17:34:48 +03:00
|
|
|
private static Class<?>[][] clientTypes =
|
2012-08-04 22:45:31 -07:00
|
|
|
{
|
2016-05-24 16:10:47 -07:00
|
|
|
{GameType.class, int.class, String.class, String.class},
|
2013-12-09 21:59:12 -08:00
|
|
|
{Options.class, String.class, boolean.class, boolean.class},
|
2014-05-28 15:28:40 -07:00
|
|
|
{EnumOS.class}
|
2012-08-04 22:45:31 -07:00
|
|
|
};
|
2016-05-24 16:10:47 -07:00
|
|
|
|
2017-01-11 15:17:56 -08:00
|
|
|
@Nullable
|
2016-05-24 16:10:47 -07:00
|
|
|
public static GameType addGameType(String name, int id, String displayName, String shortName)
|
2012-08-04 22:45:31 -07:00
|
|
|
{
|
2016-05-24 16:10:47 -07:00
|
|
|
return addEnum(GameType.class, name, id, displayName, shortName);
|
2012-08-04 22:45:31 -07:00
|
|
|
}
|
2016-05-24 16:10:47 -07:00
|
|
|
|
2017-01-11 15:17:56 -08:00
|
|
|
@Nullable
|
2013-12-09 21:59:12 -08:00
|
|
|
public static Options addOptions(String name, String langName, boolean isSlider, boolean isToggle)
|
2012-08-04 22:45:31 -07:00
|
|
|
{
|
2013-12-09 21:59:12 -08:00
|
|
|
return addEnum(Options.class, name, langName, isSlider, isToggle);
|
2012-08-04 22:45:31 -07:00
|
|
|
}
|
2016-05-24 16:10:47 -07:00
|
|
|
|
2017-01-11 15:17:56 -08:00
|
|
|
@Nullable
|
2016-05-24 16:10:47 -07:00
|
|
|
public static Options addOptions(String name, String langName, boolean isSlider, boolean isToggle, float valMin, float valMax, float valStep)
|
|
|
|
|
{
|
|
|
|
|
return addEnum(Options.class, name,
|
|
|
|
|
new Class<?>[]{String.class, boolean.class, boolean.class, float.class, float.class, float.class},
|
|
|
|
|
langName, isSlider, isToggle, valMin, valMax, valStep);
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-11 15:17:56 -08:00
|
|
|
@Nullable
|
2012-08-04 22:45:31 -07:00
|
|
|
public static EnumOS addOS2(String name)
|
|
|
|
|
{
|
|
|
|
|
return addEnum(EnumOS.class, name);
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-18 14:39:14 -06:00
|
|
|
@Nullable
|
|
|
|
|
public static MusicTicker.MusicType addMusicType(String name, SoundEvent sound, int minDelay, int maxDelay)
|
|
|
|
|
{
|
|
|
|
|
return addEnum(MusicTicker.MusicType.class, name, sound, minDelay, maxDelay);
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-11 15:17:56 -08:00
|
|
|
@Nullable
|
2016-05-24 16:10:47 -07:00
|
|
|
private static <T extends Enum<? >> T addEnum(Class<T> enumType, String enumName, Object... paramValues)
|
2012-08-04 22:45:31 -07:00
|
|
|
{
|
2016-03-23 17:34:48 +03:00
|
|
|
return addEnum(clientTypes, enumType, enumName, paramValues);
|
2012-08-04 22:45:31 -07:00
|
|
|
}
|
2016-05-24 16:10:47 -07:00
|
|
|
}
|