inventory-framework
inventory-framework copied to clipboard
Find a better way to check this "noneMatch" to remove isContainedWithin from bui...
since slot can be re-defined on render and this interceptor runs before it
https://github.com/DevNatan/inventory-framework/blob/9c2b3341cbdfdebd4f68bc87f24497c88720d1c2/inventory-framework-core/src/main/java/me/devnatan/inventoryframework/pipeline/AvailableSlotInterceptor.java#L124
if (context.getContainer().hasItem(slot)) return true;
// we need to check component factories since components don't have been yet rendered
// TODO Find a better way to check this "noneMatch" to remove isContainedWithin from builder
// since slot can be re-defined on render and this interceptor runs before it
return context.getNotRenderedComponents().stream()
.filter(componentFactory -> componentFactory instanceof ItemComponentBuilder)
.map(componentFactory -> (ItemComponentBuilder) componentFactory)
.anyMatch(itemBuilder -> itemBuilder.isContainedWithin(slot));
}
}