use of org.terasology.engine.config.PlayerConfig in project Terasology by MovingBlocks.
the class ClientConnectionHandler method sendJoin.
/**
* Sends a join request from the client upstream to the server.
* @param channelHandlerContext
*/
private void sendJoin(ChannelHandlerContext channelHandlerContext) {
Config config = CoreRegistry.get(Config.class);
PlayerConfig playerConfig = CoreRegistry.get(PlayerConfig.class);
NetData.JoinMessage.Builder bldr = NetData.JoinMessage.newBuilder();
NetData.Color.Builder clrbldr = NetData.Color.newBuilder();
bldr.setName(playerConfig.playerName.get());
bldr.setViewDistanceLevel(config.getRendering().getViewDistance().getIndex());
bldr.setColor(clrbldr.setRgba(playerConfig.color.get().rgba()).build());
channelHandlerContext.channel().writeAndFlush(NetData.NetMessage.newBuilder().setJoin(bldr).build());
}
use of org.terasology.engine.config.PlayerConfig in project Terasology by MovingBlocks.
the class GameConfigurationMetric method fetchConfig.
private void fetchConfig() {
Config config = context.get(Config.class);
SystemConfig systemConfig = context.get(SystemConfig.class);
language = systemConfig.locale.get().toString();
PlayerConfig playerConfig = context.get(PlayerConfig.class);
playerHeight = playerConfig.height.get();
playerEyeHeight = playerConfig.eyeHeight.get();
}
use of org.terasology.engine.config.PlayerConfig in project Terasology by MovingBlocks.
the class SetupLocalPlayer method step.
@Override
public boolean step() {
PlayerConfig playerConfig = context.get(PlayerConfig.class);
Client localClient = context.get(NetworkSystem.class).joinLocal(playerConfig.playerName.get(), playerConfig.color.get());
context.get(LocalPlayer.class).setClientEntity(localClient.getEntity());
return true;
}
Aggregations