forked from GeyserMC/Geyser
JavaEntityMetadataTranslator: replace stack trace with concise warning (#1086)
* JavaEntityMetadataTranslator: replace stack trace with concise warning Removes the stack trace given when a ClassCastException occurs and replaces it with a friendlier message. Class cast errors will happen since some servers send incorrect values, and apparently it is default Minecraft behavior to ignore them. * Update languages submodule
This commit is contained in:
parent
86f18c9392
commit
11c713dc6f
2 changed files with 14 additions and 2 deletions
|
@ -32,6 +32,7 @@ import org.geysermc.connector.network.translators.Translator;
|
||||||
|
|
||||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
|
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityMetadataPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityMetadataPacket;
|
||||||
|
import org.geysermc.connector.utils.LanguageUtils;
|
||||||
|
|
||||||
@Translator(packet = ServerEntityMetadataPacket.class)
|
@Translator(packet = ServerEntityMetadataPacket.class)
|
||||||
public class JavaEntityMetadataTranslator extends PacketTranslator<ServerEntityMetadataPacket> {
|
public class JavaEntityMetadataTranslator extends PacketTranslator<ServerEntityMetadataPacket> {
|
||||||
|
@ -45,7 +46,18 @@ public class JavaEntityMetadataTranslator extends PacketTranslator<ServerEntityM
|
||||||
if (entity == null) return;
|
if (entity == null) return;
|
||||||
|
|
||||||
for (EntityMetadata metadata : packet.getMetadata()) {
|
for (EntityMetadata metadata : packet.getMetadata()) {
|
||||||
entity.updateBedrockMetadata(metadata, session);
|
try {
|
||||||
|
entity.updateBedrockMetadata(metadata, session);
|
||||||
|
} catch (ClassCastException e) {
|
||||||
|
// Class cast exceptions are really the only ones we're going to get in normal gameplay
|
||||||
|
// Because some entity rewriters forget about some values
|
||||||
|
// Any other errors are actual bugs
|
||||||
|
session.getConnector().getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.network.translator.metadata.failed", metadata, entity.getEntityType()));
|
||||||
|
session.getConnector().getLogger().debug("Entity Java ID: " + entity.getEntityId() + ", Geyser ID: " + entity.getGeyserId());
|
||||||
|
if (session.getConnector().getConfig().isDebugMode()) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
entity.updateBedrockMetadata(session);
|
entity.updateBedrockMetadata(session);
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 65e36478b894af9cec74bc6df6552cb160a0c47d
|
Subproject commit 7cc503e2f7c0871a24beb3a114726d764a4836f1
|
Loading…
Reference in a new issue