Update forge for new block API

This commit is contained in:
Kenzie Togami
2018-10-04 17:18:43 -07:00
parent d0ea5121f2
commit ef2c07ca24
10 changed files with 367 additions and 9 deletions

View File

@ -51,6 +51,11 @@ public abstract class AbstractProperty<T> implements Property<T> {
this.name = name;
}
@Override
public String toString() {
return getClass().getSimpleName() + "{name=" + name + "}";
}
@Override
public int hashCode() {
return name.hashCode();

View File

@ -168,6 +168,17 @@ public class BlockType {
return ImmutableList.copyOf(getBlockStatesMap().values());
}
/**
* Gets a state of this BlockType with the given properties.
*
* @return The state, if it exists
*/
public BlockState getState(Map<Property<?>, Object> key) {
BlockState state = getBlockStatesMap().get(key);
checkArgument(state != null, "%s has no state for %s", this, key);
return state;
}
/**
* Gets whether this block type has an item representation.
*