added unregisterAltarComponent method
This commit is contained in:
parent
b59d5ce5b4
commit
259b631f7d
src
api/java/WayofTime/bloodmagic/api
main/java/WayofTime/bloodmagic/api/impl
|
@ -54,4 +54,24 @@ public interface IBloodMagicAPI {
|
|||
* @param componentType The type of Blood Altar component to register as.
|
||||
*/
|
||||
void registerAltarComponent(@Nonnull IBlockState state, @Nonnull String componentType);
|
||||
|
||||
/**
|
||||
* Removes an {@link IBlockState} from the component mappings
|
||||
* <p>
|
||||
* Valid component types:
|
||||
* <ul>
|
||||
* <li>GLOWSTONE</li>
|
||||
* <li>BLOODSTONE</li>
|
||||
* <li>BEACON</li>
|
||||
* <li>BLOODRUNE</li>
|
||||
* <li>CRYSTAL</li>
|
||||
* <li>NOTAIR</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param state The state to register
|
||||
* @param componentType The type of Blood Altar component to unregister from.
|
||||
*/
|
||||
void unregisterAltarComponent(@Nonnull IBlockState state, @Nonnull String componentType);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -60,6 +60,22 @@ public class BloodMagicAPI implements IBloodMagicAPI {
|
|||
} else BMLog.API.warn("Invalid Altar component type: {}.", componentType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterAltarComponent(@Nonnull IBlockState state, @Nonnull String componentType) {
|
||||
ComponentType component = null;
|
||||
for (ComponentType type : ComponentType.VALUES) {
|
||||
if (type.name().equalsIgnoreCase(componentType)) {
|
||||
component = type;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (component != null) {
|
||||
BMLog.API_VERBOSE.info("Unregistered {} from being a {} altar component.", state, componentType);
|
||||
altarComponents.remove(component, state);
|
||||
} else BMLog.API.warn("Invalid Altar component type: {}.", componentType);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public List<IBlockState> getComponentStates(ComponentType component) {
|
||||
return (List<IBlockState>) altarComponents.get(component);
|
||||
|
|
Loading…
Reference in a new issue