From 69c4be6419c660f114fadff145c085af7e0eb1d0 Mon Sep 17 00:00:00 2001 From: Glease <4586901+Glease@users.noreply.github.com> Date: Thu, 25 Apr 2024 17:02:58 +0800 Subject: [PATCH] add a bit javadoc Signed-off-by: Glease <4586901+Glease@users.noreply.github.com> --- src/main/javadoc/overview.html | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/main/javadoc/overview.html b/src/main/javadoc/overview.html index 96c47577..662aa518 100644 --- a/src/main/javadoc/overview.html +++ b/src/main/javadoc/overview.html @@ -251,5 +251,34 @@ The code for placeBlock() and spawnHint() will be left as an exercise for the re

Please refer to {@link com.gtnewhorizon.structurelib.StructureEvent} to see what events are available.

+

Extending Inventory Utility

+{@link com.gtnewhorizon.structurelib.util.InventoryUtility} is how structurelib survival autoplace pulls item for autoplacing. +It has two key concepts: inventory providers and stack extractors. +

+ Inventory Providers are classes that retrieve an Iterable of ItemStacks for examination, given an EntityPlayerMP as identifier. + They are also responsible for marking the relevant item container as dirty, so changes can be commited to disk properly when world save happens. + Examples include: main player inventory, vanilla ender chest, baubles inventory. StructureLib comes with main player inventory and vanilla ender chest built in. +

+

+ Stack Extractors are classes that retrieve items from another item. + Examples include: Forestry backpacks, ME network over ME Wireless Terminals. +

+

+Both of these are managed internally by {@link com.gtnewhorizon.structurelib.SortedRegistry}. +By default, elements registered will be sorted in lexicographical order in ascending order. +However, facilities in StructureLib will allow an end user to tweak these registries as their wish. +They can disable, reorder, reenable any element within the registry, either in game, at main menu or with the game stopped, +Their changes will be synced to server as well, should they be playing on a dedicated server. +

+

+ This has the following important implications +

+ +Therefore, if your stack extractor can somehow correlate with aonther one, make sure it still works if the calling order is inverted. +At the very least, inform the player about this ordering constraint. +A future StructrueLib refactor to specify this dependency info is possible, but the chance is low.