Giter VIP home page Giter VIP logo

Comments (22)

popstarfreas avatar popstarfreas commented on June 1, 2024

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.

from dimensions.

EMREOYUN avatar EMREOYUN commented on June 1, 2024

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?

from dimensions.

popstarfreas avatar popstarfreas commented on June 1, 2024

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.

from dimensions.

EMREOYUN avatar EMREOYUN commented on June 1, 2024

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?

from dimensions.

popstarfreas avatar popstarfreas commented on June 1, 2024

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.

from dimensions.

EMREOYUN avatar EMREOYUN commented on June 1, 2024

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.

from dimensions.

popstarfreas avatar popstarfreas commented on June 1, 2024

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.

from dimensions.

EMREOYUN avatar EMREOYUN commented on June 1, 2024

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. (C:\Users\minecraft\Desktop\Dimensions\build\node_modules\dimensions\listenserver.js:477:24) {
code: 'ERR_OUT_OF_RANGE'
}

What is internal/buffer.js and how i can access that file? I searched on directory but no file found called buffer.js.

from dimensions.

popstarfreas avatar popstarfreas commented on June 1, 2024

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.

from dimensions.

EMREOYUN avatar EMREOYUN commented on June 1, 2024

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.

@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.

from dimensions.

popstarfreas avatar popstarfreas commented on June 1, 2024
  • 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

from dimensions.

EMREOYUN avatar EMREOYUN commented on June 1, 2024
  • 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
  • Yes with GeoIP enabled. But still IP Redirection not works.
  • So how we can edit REST API with counter variables?
  • How we can switch the old packets?

from dimensions.

popstarfreas avatar popstarfreas commented on June 1, 2024
  • 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

from dimensions.

EMREOYUN avatar EMREOYUN commented on June 1, 2024
  • 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
  • Alright, i will try your old code to add IP Ban system onto Dimensions instead of using TShock's one.
  • I will waiting you ;)
  • I will work on it.

from dimensions.

EMREOYUN avatar EMREOYUN commented on June 1, 2024

Closed #61

from dimensions.

EMREOYUN avatar EMREOYUN commented on June 1, 2024

@popstarfreas Well there is no old packet handler in your code. How i can find old handler?

from dimensions.

popstarfreas avatar popstarfreas commented on June 1, 2024

handled = this.handleChatMessage(chatMessage);

you need to add a method that reads the old chat packet and calls the same method that line of code does.

from dimensions.

EMREOYUN avatar EMREOYUN commented on June 1, 2024

handled = this.handleChatMessage(chatMessage);

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 :)

from dimensions.

EMREOYUN avatar EMREOYUN commented on June 1, 2024

@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)?

from dimensions.

EMREOYUN avatar EMREOYUN commented on June 1, 2024

Reopened #61

from dimensions.

EMREOYUN avatar EMREOYUN commented on June 1, 2024

Nvm i solved this myelf

from dimensions.

EMREOYUN avatar EMREOYUN commented on June 1, 2024

Closed #61

from dimensions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.