Closed EMREOYUN closed 4 years ago
PE? Are you talking about mobile? Dimensions will try to read packets as though they are from a PC client. You would need to update it so that it uses the right format. At this time I don't know what the best approach is. You could simply go through the source and edit the packet handlers and some of the other places it writes packets.
PE? Are you talking about mobile? Dimensions will try to read packets as though they are from a PC client. You would need to update it so that it uses the right format. At this time I don't know what the best approach is. You could simply go through the source and edit the packet handlers and some of the other places it writes packets.
Yes, version code updated but i don't find anything about this offset range. Can you explain how to change it's range?
It's referring to reading from a buffer. It means that when it was reading a packet, it tried to read a byte at index 9 when the maximum index is 8. Likely because some packet (like player info) has more bytes on PC than mobile.
It's referring to reading from a buffer. It means that when it was reading a packet, it tried to read a byte at index 9 when the maximum index is 8. Likely because some packet (like player info) has more bytes on PC than mobile.
So question is how i can manage(change or remove) maximum index value?
That's not what it means. The maximum index value is based on how much data there is to read from the packet. What you need to do is update dimensions where it reads packets to read the mobile packets instead of pc.
That's not what it means. The maximum index value is based on how much data there is to read from the packet. What you need to do is update dimensions where it reads packets to read the mobile packets instead of pc.
How i can do that? Since Mobile Version is hard-coded and we can't make changes on there. Also searched PE TShock Code and only thing i found is buff time changed to Int16 format from Int32 format.
To get the source of the error you can edit
https://github.com/popstarfreas/Dimensions/blob/dev/app/node_modules/dimensions/client.ts#L283
so that it prints out the stacktrace rather than just the message. Maybe just put console.log(e)
. That will tell you which packet it tried to read so you can see what needs to be changed.
RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be >= 0 and <= 8. Received 9
at boundsError (internal/buffer.js:77:9)
at Buffer.readInt16LE (internal/buffer.js:405:5)
at PacketReader.readInt16 (C:\Users\minecraft\Desktop\Dimensions\build\node_modules\dimensions\packets\bufferreader.js:88:34)
at ClientPacketHandler.handlePlayerInventorySlot (C:\Users\minecraft\Desktop\Dimensions\build\node_modules\dimensions\clientpackethandler.js:198:32)
at ClientPacketHandler.handlePacket (C:\Users\minecraft\Desktop\Dimensions\build\node_modules\dimensions\clientpackethandler.js:60:32)
at C:\Users\minecraft\Desktop\Dimensions\build\node_modules\dimensions\client.js:137:57
at arrayEach (C:\Users\minecraft\Desktop\Dimensions\node_modules\lodash\lodash.js:516:11)
at Function.forEach (C:\Users\minecraft\Desktop\Dimensions\node_modules\lodash\lodash.js:9342:14)
at Client.handleDataSend (C:\Users\minecraft\Desktop\Dimensions\build\node_modules\dimensions\client.js:136:19)
at Socket.
What is internal/buffer.js
and how i can access that file? I searched on directory but no file found called buffer.js
.
I don't know your level of expertise, so this may or may not be outside of your current knowledge but that stacktrace starts at the internal node code, which isn't Dimensions. You have to follow it down until you see dimensions, which is where it says PacketReader.readInt16
, that's fine so we know it's trying to read an int16 at bufferreader:88
. What callls that is handlePlayerInventorySlot
at line 198 in the js (the js is likely to have different line numbers than the original typescript code). So the guess here is that in 1.4 slots now use int16 instead of byte for the slot id. So to make it work with the mobile packet version https://github.com/popstarfreas/Dimensions/blob/dev/app/node_modules/dimensions/clientpackethandler.ts#L232 needs to be changed to readByte again.
I don't know your level of expertise, so this may or may not be outside of your current knowledge but that stacktrace starts at the internal node code, which isn't Dimensions. You have to follow it down until you see dimensions, which is where it says
PacketReader.readInt16
, that's fine so we know it's trying to read an int16 atbufferreader:88
. What callls that ishandlePlayerInventorySlot
at line 198 in the js (the js is likely to have different line numbers than the original typescript code). So the guess here is that in 1.4 slots now use int16 instead of byte for the slot id. So to make it work with the mobile packet version https://github.com/popstarfreas/Dimensions/blob/dev/app/node_modules/dimensions/clientpackethandler.ts#L232 needs to be changed to readByte again.
@popstarfreas So after fixing this, i got many many errors but they are also fixed with your guidance. But there is less problems left now:
•IP redirection not works properly. Buffer keep sending buffers original IP(Example: Server runs in 0.0.0.1, Buffer runs in 0.0.0.2, while connecting to server, it shows connected from 0.0.0.2(buffers IP). Not causing problems on gameplay but will big issue on bans). •Rest API not works well. Rest API keeps sending Invalid HTTP Response and how we can make Rest API actually count players in buffer(We need this because we are using counters to websites and status services). •Server Switcher not works well. Typing /servername will sends command to server, not to buffer.
Also big thanks to helping to me. After everything works well, i can send pull request working PE Dimensions to your git.
- The ip thing requires the dimensions plugin. Are you using that?
- I will have to look at REST API again, I made a change and I don't remember if I pushed it here yet
- Not sure about that one other than that the chat packet in mobile might be the old one where dimensions reads the new one
- Well no one has reported issues in normal tshock, so this is a problem you need to resolve
- if I get time I will push the change I made locally
- You have to edit clientpackethandler to add the old chat packet handling
Closed #61
@popstarfreas Well there is no old packet handler in your code. How i can find old handler?
you need to add a method that reads the old chat packet and calls the same method that line of code does.
you need to add a method that reads the old chat packet and calls the same method that line of code does.
That didn't work. Thanks for helping anyway :)
@popstarfreas After tracing the code, i verified this code will not work in Mobile. https://github.com/popstarfreas/Dimensions/blob/dev/app/node_modules/dimensions/clientpackethandler.ts#L108
I changed it with ChatMessage packet but ChatMessage sends null. Did you know what causes this problem(about sending null)?
Reopened #61
Nvm i solved this myelf
Closed #61
Since we are working on PE Terraria Servers; when PE Clients tries to connect, this error shows up:
Client Handle Send Data Error: RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be >= 0 and <= 8. Received 9
How we can fix this in code?