Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
01-14-2014, 04:51 AM
(This post was last modified: 01-14-2014, 04:53 AM by xoft.)
Not really. Wanna write one?
It's quite easy, actually - compile, run (with 2 parameters - incoming port number and outgoing port number) and then connect to the incoming port with the client. ProtoProxy will connect to localhost:outgoing port, which should be a vanilla server, and it logs the entire communication to a logfile.
I regularly use ProtoProxy even with MCServer, so that I can see what our server sends to the client - did we do something wrong to the protocol etc. If the client crashes, I can point a finger at the most likely packets to have caused the crash, since the client disconnects right after that; usually it's the packet right before, sometimes a few packets before that, since it takes time for them to be delivered.
Posts: 4,628
Threads: 115
Joined: Dec 2011
Thanks: 693
Given 494 thank(s) in 423 post(s)
When I connect to the protoproxy port I get this in the server's console: Quote:[19:53:22 INFO]: GameProfile{id='null', name='STR_Warrior'} (/127.0.0.1:52441) lost connection: Internal Exception: io.netty.handler.codec.DecoderException: java.lang.IndexOutOfBoundsException: readerIndex(1) + length(1) exceeds writerIndex(1): UnpooledHeapByteBuf(ridx: 1, widx: 1, cap: 1)
Posts: 254
Threads: 16
Joined: Oct 2013
Thanks: 3
Given 20 thank(s) in 18 post(s)
Is it possible to build ProtoProxy and the other tools with cmake?
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
Not at the moment, but it is planned, as soon as we move the entire Windows build to cmake. Some tools will be windows-only, though - BiomeVisualiser, for example, since it uses raw WinAPI for the windowing stuff.
STR, does that happen immediately, or only after you do something out of the ordinary ("what mcserver doesn't do yet")? Also, is the server running a clean world? It might help if it did (make a copy of the server, one for playing, the other for protoproxying
Also, look at the protoproxy log, it might have some useful insight. It is perfectly possible that something is not right inside protoproxy, just yesterday I found out the kick packet was sent in the wrong direction
Posts: 4,628
Threads: 115
Joined: Dec 2011
Thanks: 693
Given 494 thank(s) in 423 post(s)
It happens when I try to connect to the server via protoproxy.
Posts: 952
Threads: 16
Joined: May 2013
Thanks: 66
Given 105 thank(s) in 89 post(s)
I am able to connect a client to a vanilla server through ProtoProxy alright. As your server, are you using Vanilla or MCS?
Posts: 4,628
Threads: 115
Joined: Dec 2011
Thanks: 693
Given 494 thank(s) in 423 post(s)
Posts: 952
Threads: 16
Joined: May 2013
Thanks: 66
Given 105 thank(s) in 89 post(s)
The following code works for me.
cFastNBTWriter Writer("tag");
Writer.BeginCompound("display");
Writer.AddString("Name", "SuperDerpy!");
Writer.BeginList("Lore", TAG_String);
Writer.AddString("", "LoOoore!");
Writer.EndList();
Writer.EndCompound();
Writer.Finish();
AString Compressed;
CompressStringGZIP(Writer.GetResult().data(), Writer.GetResult().size(), Compressed);
WriteShort(Compressed.size());
WriteBuf(Compressed.data(), Compressed.size());
I recommend to add a new class called cCustomNames that stores names and lore, which implements a function to write them all to NBT. I believe it should be basically similar to Enchantments.cpp. Add all the code into cProtocol172::WriteItem(), not forgetting to adapt some code there that only checks for enchanments, and it should be all good
Do correct me if I have no idea what I'm talking about
Posts: 4,628
Threads: 115
Joined: Dec 2011
Thanks: 693
Given 494 thank(s) in 423 post(s)
01-15-2014, 05:10 AM
(This post was last modified: 01-15-2014, 05:17 AM by NiLSPACE.)
I'll mess with it some more.
No need to create a different class. cEnchantments has it because there can be multiple enchantments on one item (I think) so it would be more manageable, but because an item can only have one custom name I don't think it would be more usefull.
(01-15-2014, 04:55 AM)tigerw Wrote: The following code works for me.
It compiles fine or you actualy get the custom name/lore?
Posts: 254
Threads: 16
Joined: Oct 2013
Thanks: 3
Given 20 thank(s) in 18 post(s)
Does anyone have any experience with c#? I'm trying to write a program, as a test, to connect to MCServer, but I keep getting a connection refused error while MCServer is running.
|