#I send a buffer with a message
1 messages · Page 1 of 1 (latest)
?nocode
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
I did provide it
read it in the channel
@rapid creek
?nocode
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
I did
a g a i n p l s
jump to the messages
okay
so
wait lemme send the newest
@SuppressWarnings("UnstableApiUsage")
public static ByteBuf createBuffer(PacketWrapper<?> wrapper, int initialCapacity) {
if (wrapper.buffer != null) throw new AlixException("Incorrect invocation of NettyUtils.createBuffer - buffer exists ");
wrapper.buffer = Unpooled.buffer(initialCapacity);
wrapper.writeVarInt(wrapper.getPacketTypeData().getNativePacketId());
wrapper.write();
return (ByteBuf) wrapper.buffer;
}
public static ByteBuf constBuffer(PacketWrapper<?> wrapper) {
return Unpooled.unreleasableBuffer(Unpooled.unmodifiableBuffer(createBuffer(wrapper, 1)));
}
This is how I create a constant Buffer
with constBuffer and the appriopriate wrapper
how do you make the wrapper
public static ChannelFuture writeConst(ChannelHandlerContext context, ByteBuf constByteBuf) {
ByteBuf send = context.alloc().buffer().writeBytes(constByteBuf);
return context.write(send);
}
public static ChannelFuture writeAndFlushConst(ChannelHandlerContext context, ByteBuf constByteBuf) {
ByteBuf send = context.alloc().buffer().writeBytes(constByteBuf);
return context.writeAndFlush(send);
}
``` is how I send
PacketWrapper.createUniversalWrapper exists
I need to have the #write work correctly
i see
cuz here I write the packet id and then invoke the write
@SuppressWarnings("UnstableApiUsage")
public static ChannelHandlerContext getSilentContext(Channel channel) {
return channel.pipeline().context(PacketEvents.ENCODER_NAME);
}
this is how I get the context
I haven't tested with others and dunno if it's important
but I send an action bar message as the first packet
public static ByteBuf constructConst(String message) {
return constructConst(message, false);
}
public static ByteBuf constructConst(String message, boolean actionBar) {
return NettyUtils.constBuffer(packetWrapper(message, actionBar));
//return newerConstructor ? construct_1_19(message, actionBar) : construct_old(message, actionBar);
}
public static PacketWrapper<?> packetWrapper(String message) {
return packetWrapper(message, false);
}
//From User#sendMessage(Component, ChatType)
public static PacketWrapper<?> packetWrapper(String message, boolean actionBar) {
ServerVersion version = PacketEvents.getAPI().getServerManager().getVersion();
Component component = Component.text(message);
if (version.isNewerThanOrEquals(ServerVersion.V_1_19)) {
return new WrapperPlayServerSystemChatMessage(actionBar, component);
} else {
if (actionBar) return new WrapperPlayServerActionBar(component);
ChatMessage m;
ChatType type = ChatTypes.CHAT;
if (version.isNewerThanOrEquals(ServerVersion.V_1_16))
m = new ChatMessage_v1_16(component, type, new UUID(0L, 0L));
else m = new ChatMessageLegacy(component, type);
return new WrapperPlayServerChatMessage(m);
}
}
like this
the server version is 1.20.1 and so is my mc ver
I use ViaVersion tho
and this is how I write it
nope
okay
yeah I guess only that's left
and I thought that I had studied the source code of yours
the string
what
cuz string theory hehe
uh
so you major physics?
im a high school student
why does that matter
without the u, okay
okay so
@past blade
it works with your
methods
mister munke
yeah idk
cope
u can ask netty
why the difference matters
or whats going on
by providing code
so they can assess the situation
the maintainers ignored me last time
okay
will try
wait
@past blade
doesn't minecraft use like
PacketDataSerializer
or the FriendlyByteBuf instead of
like an UnpooledByteBuf?
FriendlyByteBuf is almost equivalent to our PacketWrapper in packetevents
It is not the buffer, it contains it though.
well you can't write it
you pinged agian btw :)
ye
to annoy u
(kinda)
makes sense
@past blade The problem is probably within packet compression, since that's what the error suggests and what the netty guys told me
Do you have any special measures you take for compression?
Like Via rearranges their handlers
(hehe I ping)
bruh
I found what was wrong
it's so stupid
I was caching the silent context from login start
but compression set is sent after that
and you relocate handlers because of compression
so the context was invalid
BRAH
took me like 4 days to figure it out
yeah i purposely didn't respond
since u pinged me
nahh u are not gonna laugh at me
after pinging me
nah mate
like brah xd
I even asked if you do some stuff regarding compression
monk
what does that even mean?
like the detective?
or the fantasy class?
or maybe a short for "monkey"?
can't tell
i didn't respond
to that
but yes we do
generally speaking we try to emulate viaversion
it'd appear so
hehe
you have no power here, old man
(pls don't block me)
well it works both ways
so u fixed everything?
a
ye
I can now fully use PE by utilizing buffer creation
wrong gif
it dissapeared
lucky its spigotmc
i still could