Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package betterwithaddons.config;
- import net.minecraft.world.biome.Biome;
- import net.minecraftforge.common.config.Configuration;
- import net.minecraftforge.common.config.Property;
- import java.util.ArrayList;
- import java.util.List;
- public class ConfigOptionBiomeList {
- String name;
- String section;
- String description;
- int[] defaultValue;
- Property property;
- public ConfigOptionBiomeList(String section, String name, List<Biome> defaultValue, String description) {
- this.name = name;
- this.section = section;
- this.description = description;
- this.defaultValue = toArray(defaultValue);
- }
- public ConfigOptionBiomeList(String section, String name, List<Biome> defaultValue) {
- this(section,name, defaultValue, null);
- }
- public List<Biome> init(Configuration configuration)
- {
- property = configuration.get(section, name, defaultValue);
- property.setComment(description);
- return toList(property.getIntList());
- }
- public List<Biome> getValue()
- {
- return toList(property.getIntList());
- }
- private List<Biome> toList(int[] array)
- {
- ArrayList list = new ArrayList(array.length);
- for(int i : array)
- list.add(Biome.getBiome(i));
- return list;
- }
- private int[] toArray(List<Biome> list)
- {
- int[] array = new int[list.size()];
- for (int i = 0;i < array.length; i++)
- array[i] = Biome.getIdForBiome(list.get(i));
- return array;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement