BloodMagic/src/main/java/WayofTime/bloodmagic/block/property/PropertyString.java

47 lines
1 KiB
Java
Raw Normal View History

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