forked from GeyserMC/Geyser
Check for instance of TranslationMessage (#722)
Checks for class of custom name ID in case it's translation message.
This commit is contained in:
parent
05024dde8c
commit
18891a22f1
1 changed files with 10 additions and 3 deletions
|
@ -34,6 +34,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerAction;
|
||||||
import com.github.steveice10.mc.protocol.data.game.world.block.BlockFace;
|
import com.github.steveice10.mc.protocol.data.game.world.block.BlockFace;
|
||||||
import com.github.steveice10.mc.protocol.data.game.world.block.BlockState;
|
import com.github.steveice10.mc.protocol.data.game.world.block.BlockState;
|
||||||
import com.github.steveice10.mc.protocol.data.message.TextMessage;
|
import com.github.steveice10.mc.protocol.data.message.TextMessage;
|
||||||
|
import com.github.steveice10.mc.protocol.data.message.TranslationMessage;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerActionPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerActionPacket;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerUseItemPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerUseItemPacket;
|
||||||
import com.nukkitx.math.vector.Vector3f;
|
import com.nukkitx.math.vector.Vector3f;
|
||||||
|
@ -253,9 +254,15 @@ public class Entity {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2: // custom name
|
case 2: // custom name
|
||||||
TextMessage name = (TextMessage) entityMetadata.getValue();
|
if (entityMetadata.getValue() instanceof TextMessage) {
|
||||||
if (name != null)
|
TextMessage name = (TextMessage) entityMetadata.getValue();
|
||||||
metadata.put(EntityData.NAMETAG, MessageUtils.getBedrockMessage(name));
|
if (name != null)
|
||||||
|
metadata.put(EntityData.NAMETAG, MessageUtils.getBedrockMessage(name));
|
||||||
|
} else if (entityMetadata.getValue() instanceof TranslationMessage) {
|
||||||
|
TranslationMessage message = (TranslationMessage) entityMetadata.getValue();
|
||||||
|
if (message != null)
|
||||||
|
metadata.put(EntityData.NAMETAG, MessageUtils.getTranslatedBedrockMessage(message, session.getClientData().getLanguageCode(), true));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 3: // is custom name visible
|
case 3: // is custom name visible
|
||||||
if (!this.is(PlayerEntity.class))
|
if (!this.is(PlayerEntity.class))
|
||||||
|
|
Loading…
Reference in a new issue