This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Foone's profile picture

[MC 1.5.1][CC 1.52] Turtle upgrades >127 are not loaded properly

Started by Foone, 21 April 2013 - 04:14 PM
Foone #1
Posted 21 April 2013 - 06:14 PM
ComputerCraft Version Information: CC 1.52, MC 1.5.1 and Forge 7.7.1.644

Description of Bug:

Turtle upgrade IDs are stored in item damage, but not reloaded properly. If the ID is greater than 127, it is forced to 0 when loaded. Since most turtle upgrade IDs are over 127, this means that nearly all turtle upgrades are broken as of 1.52. (Placing the turtle into the world will cause it to be persisted without issue)

This happens because turtle IDs are stored in the high byte of the item damage value, so turtle item IDs > 127 are stored as negative numbers (java shorts are unsigned). Apparently Minecraft 1.5.1 forces IDs to be non-negative on loading, which Minecraft < 1.5 did not.

(Computercraft currently reserves IDs 0-63 for internal use, so out of the original 192 possible values only 64 of them are usable. There appear to be 72 turtle upgrade IDs in use so far, so simply making all the mods pick new IDs won't be possible without collisions.

Steps to Reproduce Bug:

1. Create a turtle upgrade with an ID greater than 127. For example, use OpenCCSensors (ID=180).
2. Put the item in a chest or leave it in your inventory.
3. Exit out of the world (SSP), or log out (with no other players in the area) (SMP)
4. Reopen the world/rejoin.
5. Notice that the turtle has turned into a plain turtle instead of an upgraded turtle.


To confirm the bug exists, I used OpenCCSensor's source and altered the Upgrade ID to be 127 instead of 180. If this fix is made, the problem disappears.
Dlcruz129 #2
Posted 22 April 2013 - 04:50 AM
FML logs, please.
Foone #3
Posted 22 April 2013 - 06:51 AM
http://pastebin.com/4DAKggUx