TheMindVirus / CC-Modded

CC-Tweaked, Tweaked again as a Java 1.18.2 Mod - Built with GitPod Cloud-Based VS Code Build Environment
Other
0 stars 0 forks source link

peripheral.wrap() from a remote computer uses old type+id reference instead of using getConnectedName() #1

Closed TheMindVirus closed 2 years ago

TheMindVirus commented 2 years ago

The id change worked but the name is still picked up as the type from remote computers. This is somewhat desirable as it doesn't break programs that use it and lets you change the id. However, it would be logical to refer to the device by both "" and "".

id changes only apply after a reboot of the remote computer and newly placed modems default to "null" in the HashMap which is a form of incoherent caching that has remained consistently maintained without change for several years. Potential solutions are to leave it as it is with its current behaviour or make a new alpha version with propagated changes.

TheMindVirus commented 2 years ago

The name of the attached peripheral can be set to the type by default here instead of null: https://github.com/TheMindVirus/CC-Modded/blob/75eec07acb640223f7b744e820dd96dd79d1d740/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/WiredModemLocalPeripheral.java#L68

Updating the name over the network requires the latest version of the mod and a restart of all devices on the network. You may also need to disconnect and reconnect modems to get their name to change.