Repository navigation
Conversation
| storage.setPosition(x, y, z); | ||
| entity.put(storage); | ||
| }); | ||
| handler(defaultSpawnDataHandler(ClientboundPackets1_19_3.SET_ENTITY_DATA, Types1_19_3.ENTITY_DATA_LIST)); |
There was a problem hiding this comment.
If I understand the reasoning behind your other pr correctly, to fully close that, this should get something similar to your other handler like
mapEntityTypeWithData(EntityTypes1_19_4.PAINTING, EntityTypes1_19_4.PAINTING).spawnEntityData(data -> {
if (!data.has(8) && data.user().getProtocolInfo().serverProtocolVersion().olderThan(ProtocolVersion.v1_21)) {
data.add(new EntityData(8, Types1_19_3.ENTITY_DATA_TYPES.paintingVariantType, 0)); // kebab
}
});(untested)
There was a problem hiding this comment.
Yeah you're right, I can update it in a couple days if that's ok (for those wondering, this would handle the 1.18 client on 1.19-1.21 server case where kebab would not spawn without default data)
There was a problem hiding this comment.
Seems to work fine on a 1.20 server. Correct me if I'm wrong, the version check should be redundant as 1.21 will apply default data before it in the pipeline (it still works with the new 1.21 default on 1.21+ servers)
|
scheduleSend on order-specific packets caused issues in the past iirc, I'd have to look deeper into that, so keeping it as is is better for now. the default spawn handler looks ok for now |
|
scheduleSend should only be used when the code isn't running inside a netty thread (e.g. when sending manual packets in bukkit events outside of the protocol code). Using it doesn't guarnatee any packet order so send+cancel is the right thing to do. |
Fixes #1361.
I recommend viewing the diff commit-wise, the first one is the main change here and is rather simple. The second commit just integrates the default painting fix, so if you're happy with it you can also close #1315 in favor of this :)
I had a few questions/things to note though:
@linkinEntityReplacementis highlighted as red in intellij because the target is protected. I would like to try to keep it though as that's what most protocols will want to usescheduleSend? Does it always send immediately after the current packet or is it unspecified? Cause I'd like to replace the send+cancel dance in the default spawn handler with it, that way you can place the handler anywhere you'd likespawnEntityData, but I'd like a second opinion on it, cause that's the reason why I check if there is a variant already in the painting code. I'm thinking for example, we want an invisible entity but the server entity has non-default flags so the server sends a data for index 0 on spawn, overwriting our defaults. But then again, you'd also need to make sure to handle it for the regular data packets if you care, which is what I do in Rewrite interactions as invisible slimes #1368 for example.