Files
MinecraftForge/src/main/java/net/minecraftforge/client/EnumHelperClient.java
T

77 lines
2.6 KiB
Java
Raw Normal View History

/*
* 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;
import net.minecraft.client.audio.MusicTicker;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.Util.EnumOS;
2016-06-23 02:39:36 -04:00
import net.minecraft.world.GameType;
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
import javax.annotation.Nullable;
2012-08-04 22:45:31 -07:00
public class EnumHelperClient extends EnumHelper
{
private static Class<?>[][] clientTypes =
2012-08-04 22:45:31 -07:00
{
{GameType.class, int.class, String.class, String.class},
{Options.class, String.class, boolean.class, boolean.class},
{EnumOS.class}
2012-08-04 22:45:31 -07:00
};
@Nullable
public static GameType addGameType(String name, int id, String displayName, String shortName)
2012-08-04 22:45:31 -07:00
{
return addEnum(GameType.class, name, id, displayName, shortName);
2012-08-04 22:45:31 -07:00
}
@Nullable
public static Options addOptions(String name, String langName, boolean isSlider, boolean isToggle)
2012-08-04 22:45:31 -07:00
{
return addEnum(Options.class, name, langName, isSlider, isToggle);
2012-08-04 22:45:31 -07:00
}
@Nullable
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);
}
@Nullable
2012-08-04 22:45:31 -07:00
public static EnumOS addOS2(String name)
{
return addEnum(EnumOS.class, name);
}
@Nullable
public static MusicTicker.MusicType addMusicType(String name, SoundEvent sound, int minDelay, int maxDelay)
{
return addEnum(MusicTicker.MusicType.class, name, sound, minDelay, maxDelay);
}
@Nullable
private static <T extends Enum<? >> T addEnum(Class<T> enumType, String enumName, Object... paramValues)
2012-08-04 22:45:31 -07:00
{
return addEnum(clientTypes, enumType, enumName, paramValues);
2012-08-04 22:45:31 -07:00
}
}