fnuecke / oc2

RISC-V VMs in Minecraft.
https://www.curseforge.com/minecraft/mc-mods/oc2
Other
619 stars 77 forks source link

Collection of RPC device documentation changes #243

Open zccafa3 opened 2 years ago

zccafa3 commented 2 years ago

Disclaimer: I have no experience with java, nor have these changes been built and tested locally. So please validate them on your side (I'd be happy to do this myself, but don't know how).

Commits:

_I believe I have checked the documentation for all of the RPC devices. Here is the list of (all?) the RPC device typeNames that I have checked; "robot", "inventory_operations", "block_operations", "redstone", "item_handler", "oc2:computer", "energy_storage", "file_import_export", "sound" The "item_handler" device is the only one without named parameters. This commit provides the parameter names and thus negates the requirement for handling un-named parameters in scripts/lib/*/devices.*. This script will print the documentation for an available device's methods (split at the 80th character):_

d_tn = "item_handler"

for line in str(d_bus.find(type_name=d_tn)).split("\n"):
    doc = ""
    for index, char in enumerate(line):
        if index > 0 and index % 80 == 0:
            doc += "\n"
        doc += char
    print(doc)

Output:

getItemSlotCount(): int
getItemStackInSlot(arg0: int): ItemStack
getItemSlotLimit(arg0: int): int
...

_I have attempted to provide getDeviceDocumentation for BlockOperationsModuleDevice.java following the format of RedstoneInterfaceCardItemDevice.java with the documentation in block_operations_module.md. I would be happy to do the same for all of the remaining devices without getDeviceDocumentation. Please let me know if you would like me to do this, and of course, any and all feedback is appreciated. Given my disclaimer above there's a decent chance I've not done this right. Also, I had to take a guess at the prefferred max line-width._

zccafa3 commented 2 years ago

Hi @CoolCat467, thanks for your response. Ultimately I think that is a question for @fnuecke to answer with how he would like to skin that cat (sorry! 😅). But it is normal for documentation to be written in English by default, and other languages are potentially supported. There are exceptions ofc like if the application is indended to only be used in the native language in which it is written. I assume that the purpose of the src/main/resources/assests/oc2/doc/* md documents is to provide additional language support for the APIs outside of the deployed code (as currently the ability to support has not been implemented within it). Perhaps the final intention is for documentation to only reside outside of the deployed code, to avoid dual maintenance. However, currently device method documentation is supported for some but not all devices (see RedstoneInterfaceCardItemDevice.java for an example of where this has been implemented).