tterrag1098

Untitled

Mar 20th, 2020
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.54 KB | None | 0 0
  1. tterrag09/08/2019
  2. there's literally no way to support vanilla clients
  3. if you add serializers, vanilla clients break, if you don't forge clients break
  4. they HAVE to match between server and client even if IT SENDS NO DATA
  5. we'll have to implement some kind of client-aware sync where it doesn't send modded command nodes to vanilla clients
  6. this might be beyond what I can do tonight
  7. because really I have no idea where to start
  8. how would you even detect a vanilla client at this point?
  9. LexManos09/08/2019
  10. ..
  11. Or we just nuke the custom argument
  12. and parse it yourself later
  13. tterrag09/08/2019
  14. ugh
  15. but this means any mods that want to be server only can't add custom argument types?
  16. LexManos09/08/2019
  17. You should be able to still give suggestions
  18. tterrag09/08/2019
  19. no wonder plugins in 1.13+ are a fuckin mess
  20. LexManos09/08/2019
  21. Also
  22. why has this not been a issue]
  23. for commands Forge adds using the two argumetns we already have?
  24. ModID/EnumArgument
  25. tterrag09/08/2019
  26. they were removed
  27. at least, the serializers were
  28. not sure how those don't crash tbh
  29. LexManos09/08/2019
  30. No the serializer for enum wass removed
  31. because it required extra data
  32. tterrag09/08/2019
  33. oh you know what
  34. it's because they were at the end of the data, so it probably didn't matter
  35. my argument gets smack in the middle and the buffer offset gets fucked
  36. that's my only guess anyways
  37. LexManos09/08/2019
  38. ... god dammet im gunna have to dig through this myself aint i...
  39. tterrag09/08/2019
  40. don't bother
  41. I'll just move it to a string argument and move on
  42. LexManos09/08/2019
  43. What does it loose functionality wise?
  44. tterrag09/08/2019
  45. wait, it can't be a string argument because strings apparently can't have colons
  46. because MINECRAFT
  47. LexManos09/08/2019
  48. thejn how the fuck does it work now?
  49. tterrag09/08/2019
  50. it doesn't work now, that's why we're here?
  51. LexManos09/08/2019
  52. No
  53. tterrag09/08/2019
  54. I added a whole custom parser to handle the weird backwards compat
  55. LexManos09/08/2019
  56. the vanilla command
  57. tterrag09/08/2019
  58. it's all hardcoded shit
  59. just strings
  60. "Village"
  61. "Mansion"
  62. literals
  63. LexManos09/08/2019
  64. humm
  65. tterrag09/08/2019
  66. so either we disallow namespaces on structures (bad idea)
  67. or...idk
  68. LexManos09/08/2019
  69. running a setup
  70. gunna see what explodes
  71. tterrag09/08/2019
  72. the client data reader is just really dumb here. if it comes across an argument it doesn't know it just says "oh well we'll skip it" except it doesn't read out the buffer data that's there
  73. this needs to be fixed for 1.15
  74. LexManos09/08/2019
  75. 'the buffer data thats there'?
  76. Thats where?
  77. tterrag09/08/2019
  78. put a sentinel between each argument type and flush the remaining unknown data
  79. ok so
  80. when an argument is serialized there's 3 parts
  81. the ID, the data added by the serializer, and the suggestion data
  82. LexManos09/08/2019
  83. But yes, they DO need to add a data size to serialized arguments
  84. oh
  85. what is the format of the packet?
  86. tterrag09/08/2019
  87. on the client, it reads the ID, sees no type registered, then goes "welp nothing I can do" leaving the suggestion data in the buffer
  88. then the next argument starts reading garbage from the suggestion data and everything is fucked
  89. exactly? um
  90. LexManos09/08/2019
  91. which packet is it?
  92. tterrag09/08/2019
  93. byte: flags
  94. varint: child_count
  95. varint[child_count]: children
  96. varint: redirect
  97. string: name
  98. blob: argument serializer data
  99. rl: suggestion provider
  100. that for each argument type
  101. SCommandListPacket
  102. so what gets undefrlowed is the suggestion provider
  103. so the other two arguments are fine because they don't have one
  104. there is no .suggests
  105. which is lame but probably done to avoid this issue, or just out of laziness
  106. but either way it sidesteps the problem. but I cannot leave out the suggestions here, have to keep vanilla parity
  107. the client literally just needs to read the suggestion data regardless (even if just to throw it away)
  108. even if the argument type is unknown on the client, whether or not there is a suggestion provider is encoded in the flags (bit 16)
  109. so really that's the oversight, but we can't patch it. the solution would be to leave off suggestion data for modded argument types being sent to vanilla clients. but I have nfi how to even begin to make that happen. and we should tell mojang about this for 1.15 as it pretty much cripples modded serverside commands
  110. LexManos09/08/2019
  111. Right this wouldnt fix vanilla clients
  112. but we could fix forge by moving the read of the suggestions out of the else check
  113. Mojang should do that.
  114. But for us, to keep compat with vanilla
  115. Don't send suggestions
  116. tterrag09/08/2019
  117. have to, because it's a vanilla command
  118. plus it makes the command rather useless
  119. you'd have to randomly guess at structure names
  120. LexManos09/08/2019
  121. register("resource_location", ResourceLocationArgument.class, new ArgumentSerializer<>(ResourceLocationArgument::resourceLocation));
  122. We cant use that?
  123. tterrag09/08/2019
  124. nope, because I have to handle the legacy stupid names, like "Village"
  125. which is not a valid RL and causes it to choke
  126. LexManos09/08/2019
  127. humm
  128. tterrag09/08/2019
  129. unless we're okay with breaking that
  130. it's technically a behavior change, but I'm not sure anyone would care?
  131. LexManos09/08/2019
  132. wait
  133. what if you stuck the new argument
  134. at the end of the .then chain
  135. tterrag09/08/2019
  136. hm
  137. right
  138. LexManos09/08/2019
  139. and let the previous node handle the non-RL format shit
  140. tterrag09/08/2019
  141. I suppose that would work
  142. sidesteps the problem that WILL crop up again, but that's future us's problem
  143. LexManos09/08/2019
  144. By future us, I hope we can convice @fry to fix the network protocol in 1.15+
  145. tterrag09/08/2019
  146. well yeah, I more mean within 1.14, someone either us or a modder is gonna hit this issue again
  147. LexManos09/08/2019
  148. yes they will
  149. and its shitty
  150. what we CAN do is fix the issue on our end
  151. for Forge clients
  152. tterrag09/08/2019
  153. as proof of concept, yeah
  154. LexManos09/08/2019
  155. and then if OTHER people run into it in their mod, we can say fuck it.
  156. Their mod isnt vanilla compat.
  157. Tho.. we SHOULD have some form of standard test for OUR code.
  158. tterrag09/08/2019
  159. I'm gonna write that patch now while I still have this code here
  160. LexManos09/08/2019
  161. if we have a way to test in just ForgeDev mode.
  162. tterrag09/08/2019
  163. thinking we just do this?
  164. if (argumenttype == null) {
  165. if ((flags & 16) != 0) {
  166. buf.readResourceLocation(); // FORGE: Flush unused suggestion data
  167. }
  168. return null;
  169. } else {
  170. I don't think there's a way to recover the suggestion data in a useful way, since it needs the nonnull argument type
  171. LexManos09/08/2019
  172. its more then that
  173. wait
  174. is it literally just a RL for the suggestions type?
  175. tterrag09/08/2019
  176. yup
  177. LexManos09/08/2019
  178. jesus christ
  179. ya that should be a fix
  180. tterrag09/08/2019
  181. and in our case it's always ask_server
  182. let me test it
  183. LexManos09/08/2019
  184. be sure to test it without this fix
  185. to make sure vanilla can still work
  186. tterrag09/08/2019
  187. yeah
  188. I'll just be removing the argument type again, so I don't see why it wouldn't, but I will test a vanilla client
  189. lookie it works perfectly
  190. [image]
  191. no suggestions but the command runs
  192. (patched client, no registered serializer)
  193. LexManos09/08/2019
  194. even with moving the argument?
  195. tterrag09/08/2019
  196. this is without any changes
  197. the current crashing setup
  198. LexManos09/08/2019
  199. ah ya i wouldnt expect any suggestions
  200. tterrag09/08/2019
  201. nope, this is intended behavior
  202. no way to provide suggestions without an argument type
  203. it's flawed system, ideally they should be separated
  204. there's no real reason why suggestions should depend on the type being serializeable
  205. it's just a list of strings from the server
  206. LexManos09/08/2019
  207. ya
  208. Also, ArgumentTypes should have a length header
  209. so that unknown types can just be nuked from the buffer, and treated as a 'string' type.
  210. tterrag09/08/2019
  211. for sure
  212. can't do that in forge though, it changes protocol :/
  213. LexManos09/08/2019
  214. Wanna file a jira bug on this, and i'll yell at Fry to fix?
  215. tterrag09/08/2019
  216. might have to be tomorrow, I'll already be staying up too late to finish this fix :stuck_out_tongue:
  217. LexManos09/08/2019
  218. In theory, falling back the 'String argument, which asks the server for suggestions' should be safe for literally anything.
  219. tterrag09/08/2019
  220. yeah I don't really see why it isn't just done that way in general
  221. LexManos09/08/2019
  222. Ya no rush, just stuff to yell at them about
  223. tterrag09/08/2019
  224. why does the client give a shit about how to serialize the argument?
  225. I guess for metadata purposes
  226. LexManos09/08/2019
  227. Well we dont need to ask the server to suggest a blockpos
  228. tterrag09/08/2019
  229. but "dumb string" is a sensible fallback
  230. I suppose that's true, it reduces lag
Advertisement
Add Comment
Please, Sign In to add comment