package codechicken.lib.block.property;

import com.google.common.base.Optional;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
import net.minecraft.block.properties.PropertyHelper;

import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;

/**
 * Created by covers1624 on 2/6/2016.
 */
public class PropertyString extends PropertyHelper<String> {

    private final HashSet<String> valuesSet;

    public PropertyString(String name, Collection<String> values) {
        super(name, String.class);
        valuesSet = new HashSet<String>(values);
    }

    public PropertyString(String name, String... values) {
        super(name, String.class);
        valuesSet = new HashSet<String>();
        Collections.addAll(valuesSet, values);
    }

    public List<String> values() {
        return Lists.newLinkedList(valuesSet);
    }

    @Override
    public Collection<String> getAllowedValues() {
        return ImmutableSet.copyOf(valuesSet);
    }

    @Override
    public Optional<String> parseValue(String value) {
        if (valuesSet.contains(value)) {
            return Optional.of(value);
        }
        return Optional.absent();
    }

    @Override
    public String getName(String value) {
        return value;
    }
}


@@ -120,51 +120,12 @@
 able
-Set;%0Aimport com.google.common.collect.
 List
-s
 ;%0Aim
@@ -198,97 +198,9 @@
 til.
-Collection;%0Aimport java.util.Collections;%0Aimport java.util.HashSet;%0Aimport java.util.List
+*
 ;%0A%0A/
@@ -324,22 +324,19 @@
 e final 
-HashSe
+Lis
 t%3CString
@@ -468,38 +468,41 @@
 valuesSet = new 
-HashSe
+LinkedLis
 t%3CString%3E(values
@@ -633,14 +633,17 @@
 new 
-HashSe
+LinkedLis
 t%3CSt
@@ -759,27 +759,28 @@
 urn 
-Lists.newLinkedList
+ImmutableList.copyOf
 (val
@@ -884,18 +884,19 @@
 mmutable
-Se
+Lis
 t.copyOf

Move property string to use a linked list.