forked from GeyserMC/Geyser
Only send metadata update once per Java metadata packet (#1022)
While this doesn't fix any bugs, it may be a slight performance enhancement as we aren't sending multiple packets per one Java entity metadata packet.
This commit is contained in:
parent
9097f8547b
commit
a4339be212
2 changed files with 11 additions and 2 deletions
|
@ -262,6 +262,11 @@ public class Entity {
|
||||||
session.sendUpstreamPacket(updateAttributesPacket);
|
session.sendUpstreamPacket(updateAttributesPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Applies the Java metadata to the local Bedrock metadata copy
|
||||||
|
* @param entityMetadata the Java entity metadata
|
||||||
|
* @param session GeyserSession
|
||||||
|
*/
|
||||||
public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) {
|
public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) {
|
||||||
switch (entityMetadata.getId()) {
|
switch (entityMetadata.getId()) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -366,10 +371,12 @@ public class Entity {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateBedrockMetadata(session);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends the Bedrock metadata to the client
|
||||||
|
* @param session GeyserSession
|
||||||
|
*/
|
||||||
public void updateBedrockMetadata(GeyserSession session) {
|
public void updateBedrockMetadata(GeyserSession session) {
|
||||||
if (!valid) return;
|
if (!valid) return;
|
||||||
|
|
||||||
|
|
|
@ -47,5 +47,7 @@ public class JavaEntityMetadataTranslator extends PacketTranslator<ServerEntityM
|
||||||
for (EntityMetadata metadata : packet.getMetadata()) {
|
for (EntityMetadata metadata : packet.getMetadata()) {
|
||||||
entity.updateBedrockMetadata(metadata, session);
|
entity.updateBedrockMetadata(metadata, session);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
entity.updateBedrockMetadata(session);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue