Easier handling of meta blocks

This commit is contained in:
Nick 2015-11-17 15:52:31 -08:00
parent fb94914b91
commit 9035f800e2
16 changed files with 436 additions and 277 deletions

View file

@ -0,0 +1,41 @@
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;
@SuppressWarnings("unchecked")
protected PropertyString(String name, String[] values) {
super(name, String.class);
HashSet hashSet = Sets.newHashSet();
hashSet.addAll(Arrays.asList(values));
allowedValues = ImmutableSet.copyOf(hashSet);
}
@Override
public Collection getAllowedValues() {
return allowedValues;
}
public String getName0(String value) {
return value;
}
@Override
public String getName(Comparable value) {
return this.getName0(value.toString());
}
public static PropertyString create(String name, String[] values) {
return new PropertyString(name, values);
}
}