2015-11-17 15:52:31 -08:00
|
|
|
package WayofTime.bloodmagic.block.property;
|
|
|
|
|
|
|
|
import com.google.common.collect.ImmutableSet;
|
|
|
|
import com.google.common.collect.Sets;
|
|
|
|
import net.minecraft.block.properties.PropertyHelper;
|
|
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.Collection;
|
|
|
|
import java.util.HashSet;
|
|
|
|
|
|
|
|
public class PropertyString extends PropertyHelper {
|
|
|
|
|
|
|
|
private final ImmutableSet allowedValues;
|
|
|
|
|
|
|
|
protected PropertyString(String name, String[] values) {
|
|
|
|
super(name, String.class);
|
|
|
|
|
2015-12-28 14:04:34 -08:00
|
|
|
HashSet<String> hashSet = Sets.newHashSet();
|
2015-11-17 15:52:31 -08:00
|
|
|
hashSet.addAll(Arrays.asList(values));
|
|
|
|
allowedValues = ImmutableSet.copyOf(hashSet);
|
|
|
|
}
|
|
|
|
|
2015-11-28 18:25:46 -08:00
|
|
|
public static PropertyString create(String name, String[] values) {
|
|
|
|
return new PropertyString(name, values);
|
|
|
|
}
|
|
|
|
|
2015-11-17 15:52:31 -08:00
|
|
|
@Override
|
|
|
|
public Collection getAllowedValues() {
|
|
|
|
return allowedValues;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getName0(String value) {
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getName(Comparable value) {
|
|
|
|
return this.getName0(value.toString());
|
|
|
|
}
|
|
|
|
}
|