Add client-side custom item creation via server RPCs - #99
Open
codefling-0xf wants to merge 2 commits into
Open
Conversation
added 2 commits
August 22, 2026 23:25
- Items.cs: CreateItem(JSON.Object[, refresh]) builds ItemDefinition + ItemBlueprint at runtime on the client and registers them into ItemManager collections. Server API SendCreate/RemoveCustomItems send JSON arrays over RPC (StringRaw). defaultBlueprints maintained surgically via Add/RemoveDefaultBlueprint (no full bpList rebuild). Cleanup on disconnect via ClientDisconnect -> RemoveCustomItems. - UI.ServerImage.cs: icon sprites set by CRC through the existing image callback system (ItemDefinitionEntry entries, no polling). - CommunityEntity.cs: centralized ClientDisconnect hook + ParseEnum. - Items.Test.cs: citem test commands (customitem_test / customitem_endtest).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds runtime creation of custom
ItemDefinition/ItemBlueprintobjects on the client, driven by server RPCs. Lets servers/plugins ship fully client-side items (craftable, with icons) without bundling assets or touching server-sideItemManager.What's included
CommunityEntity.Items.cs(new)CreateItem(JSON.Object[, refresh])— builds anItemDefinition(and optionalItemBlueprint) on a freshGameObject, registers it intoItemManager.itemList/itemDictionary/itemDictionaryByName, and (when a blueprint is present) intobpList/itemToBlueprint/ingredientToBlueprints/defaultBlueprints.SendCreateCustomItems(player, json)/SendRemoveCustomItems(player, json)— send a JSON array over RPC viaStringRaw(same pattern asAddUI).RPC_CreateCustomItems/RPC_RemoveCustomItems— parse the array, create/remove per entry. UI refresh (LocalPlayer.OnInventoryChanged+UIBlueprints.Refresh) is batched to once per RPC instead of once per item.defaultBlueprintsis maintained surgically (AddDefaultBlueprint/RemoveDefaultBlueprint) — no fullbpListrebuild.RemoveCustomItems()cleanup on disconnect via theClientDisconnectbroadcast hook.CommunityEntity.UI.ServerImage.csItemDefinitionEntrylist onImageRequest(mirrors the existingEntrylist).ApplyTextureToItem(def, crc)registers an entry or applies immediately if the texture is cached;CL_ReceiveFilePngapplies the sprite to all waiting definitions on arrival. No per-frame polling.CommunityEntity.csClientDisconnecthook (callsRemoveCustomItems()) and the singleParseEnum<T>(moved out ofUI.csto resolve a duplicate-definition conflict).Example
Notes
ItemManagerregistration) — intended for client-side UI/crafting features.