public class SidedComponentMap extends ComponentMap
| Modifier and Type | Field and Description |
|---|---|
ComponentMap |
down |
ComponentMap |
east |
ComponentMap |
north |
ComponentMap |
south |
ComponentMap |
up |
ComponentMap |
west |
provider| Constructor and Description |
|---|
SidedComponentMap(ComponentProvider<?> provider) |
| Modifier and Type | Method and Description |
|---|---|
<C extends Component> |
add(C component,
Direction... directions)
Adds a component to the provider.
|
<C extends Component> |
add(C component,
Direction direction)
Adds a component to the provider.
|
<C extends Component> |
add(java.lang.Class<C> componentType,
Direction... directions)
Adds a new component based on its superclass or interface using dependency injection.
|
<C extends Component> |
add(java.lang.Class<C> componentType,
Direction direction)
Adds a new component based on its superclass or interface using dependency injection.
|
boolean |
canRemove(java.lang.Class<?> componentType,
Direction direction)
Checks if a component type can be removed from this provider.
|
<C> C |
get(java.lang.Class<C> componentType,
Direction direction)
Gets the component with the specified type.
|
ComponentMap |
getComponents(Direction direction) |
java.util.Map<Direction,ComponentMap> |
getComponentsForDirections() |
<C> java.util.Optional<C> |
getOp(java.lang.Class<C> componentType,
Direction direction)
Gets an optional of the component with the specified type.
|
<C extends Component> |
getOrAdd(C component,
Direction direction)
Adds a component to the block if it is not present.
|
<C> java.util.Set<C> |
getSet(java.lang.Class<C> componentType,
Direction direction)
Gets the set of the components with the specified type.
|
boolean |
has(java.lang.Class<?> componentType,
Direction direction)
Checks if a component type exists in this provider.
|
<C extends Component> |
remove(C component,
Direction direction)
Removes the component from the block.
|
<C extends Component> |
remove(java.lang.Class<C> componentType,
Direction direction)
Removes the component from the provider.
|
add, add, get, getOp, getOrAdd, getSet, has, remove, removeclear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuespublic final ComponentMap up
public final ComponentMap down
public final ComponentMap north
public final ComponentMap south
public final ComponentMap west
public final ComponentMap east
public SidedComponentMap(ComponentProvider<?> provider)
public final java.util.Map<Direction,ComponentMap> getComponentsForDirections()
public final ComponentMap getComponents(Direction direction)
public final <C extends Component> C add(java.lang.Class<C> componentType, Direction direction)
C - The node type.direction - The direction to add the component to.componentType - The interface or abstract class associated with the new component.public final <C extends Component> C add(java.lang.Class<C> componentType, Direction... directions)
C - The node type.directions - The directions to add the component to.componentType - The interface or abstract class associated with the new component.public final <C extends Component> C add(C component, Direction direction)
C - The component type.direction - The direction to add the component to.component - The component to add.ComponentException - when the component already exists on the block.public final <C extends Component> C add(C component, Direction... directions)
C - The component type.component - The component to add.directions - The directions to add the component to.ComponentException - when the component already exists on the block.public final <C extends Component> C getOrAdd(C component, Direction direction)
C - The component type.component - The component to add.direction - The direction to get or add the component to.public final boolean has(java.lang.Class<?> componentType,
Direction direction)
componentType - the component type to check.direction - The direction to check.public final boolean canRemove(java.lang.Class<?> componentType,
Direction direction)
componentType - the component type to check.direction - The direction to check.public final <C extends Component> C remove(C component, Direction direction)
C - The component type.component - the component type.direction - The direction to remove the component from.ComponentException - when the component does not exist.public final <C extends Component> C remove(java.lang.Class<C> componentType, Direction direction)
C - The component type.componentType - the component type.direction - The direction to remove the component from.ComponentException - when the component does not exist.public final <C> java.util.Optional<C> getOp(java.lang.Class<C> componentType,
Direction direction)
C - The component type.componentType - the type to get.direction - The direction to get the component from.Optional.empty().
if the component was not found.public final <C> C get(java.lang.Class<C> componentType,
Direction direction)
C - The component type.componentType - the type to get.direction - The direction to get the component from.ComponentException - if the component doesn't exist.public final <C> java.util.Set<C> getSet(java.lang.Class<C> componentType,
Direction direction)
C - The component type.componentType - the type to get.direction - The direction to get the component from.