Use field init shorthand, instead of x:x, just x,
https://rust-lang-nursery.github.io/edition-guide/rust-2018/data-types/field-init-shorthand.html find src -name '*.rs' -exec perl -pe 's/\b(\w+): \1,/$1,/g' -i {} \;
This commit is contained in:
parent
2af7307d8b
commit
77cd4ecf35
|
@ -13,9 +13,9 @@ pub struct Position {
|
|||
impl Position {
|
||||
pub fn new(x: i32, y: i32, z: i32) -> Position {
|
||||
Position {
|
||||
x: x,
|
||||
y: y,
|
||||
z: z,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,10 +37,10 @@ impl ChunkBuilder {
|
|||
free.push((i, vec![], vec![]));
|
||||
}
|
||||
ChunkBuilder {
|
||||
threads: threads,
|
||||
threads,
|
||||
free_builders: free,
|
||||
built_recv: built_recv,
|
||||
models: models,
|
||||
built_recv,
|
||||
models,
|
||||
resource_version: 0xFFFF,
|
||||
}
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ impl ChunkBuilder {
|
|||
let mut snapshot = world.capture_snapshot(cx - 2, cy - 2, cz - 2, 20, 20, 20);
|
||||
snapshot.make_relative(-2, -2, -2);
|
||||
self.threads[t_id.0].0.send(BuildReq {
|
||||
snapshot: snapshot,
|
||||
snapshot,
|
||||
position: (x, y, z),
|
||||
solid_buffer: t_id.1,
|
||||
trans_buffer: t_id.2,
|
||||
|
@ -189,12 +189,12 @@ fn build_func(id: usize, models: Arc<RwLock<model::Factory>>, work_recv: mpsc::R
|
|||
let cull_info = build_cull_info(&snapshot);
|
||||
|
||||
built_send.send((id, BuildReply {
|
||||
position: position,
|
||||
solid_buffer: solid_buffer,
|
||||
solid_count: solid_count,
|
||||
trans_buffer: trans_buffer,
|
||||
trans_count: trans_count,
|
||||
cull_info: cull_info,
|
||||
position,
|
||||
solid_buffer,
|
||||
solid_count,
|
||||
trans_buffer,
|
||||
trans_count,
|
||||
cull_info,
|
||||
})).unwrap();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -242,7 +242,7 @@ impl Console {
|
|||
.draw_index(500)
|
||||
.create(ui_container);
|
||||
self.elements = Some(ConsoleElements {
|
||||
background: background,
|
||||
background,
|
||||
lines: vec![],
|
||||
});
|
||||
self.dirty = true;
|
||||
|
|
|
@ -228,7 +228,7 @@ impl Manager {
|
|||
});
|
||||
entity.1 += 1;
|
||||
return Entity {
|
||||
id: id,
|
||||
id,
|
||||
generation: entity.1,
|
||||
}
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ impl Manager {
|
|||
0
|
||||
));
|
||||
Entity {
|
||||
id: id,
|
||||
id,
|
||||
generation: 0,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,8 +57,8 @@ impl SignRenderer {
|
|||
filter: ecs::Filter::new()
|
||||
.with(position)
|
||||
.with(sign_info),
|
||||
position: position,
|
||||
sign_info: sign_info,
|
||||
position,
|
||||
sign_info,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ impl ecs::System for SignRenderer {
|
|||
width: 0.0,
|
||||
offset: 0.0,
|
||||
text: Vec::new(),
|
||||
renderer: renderer,
|
||||
renderer,
|
||||
y_scale: Y_SCALE,
|
||||
x_scale: X_SCALE,
|
||||
};
|
||||
|
|
|
@ -97,8 +97,8 @@ pub struct Rotation {
|
|||
impl Rotation {
|
||||
pub fn new(yaw: f64, pitch: f64) -> Rotation {
|
||||
Rotation {
|
||||
yaw: yaw,
|
||||
pitch: pitch,
|
||||
yaw,
|
||||
pitch,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,8 +115,8 @@ pub struct TargetRotation {
|
|||
impl TargetRotation {
|
||||
pub fn new(yaw: f64, pitch: f64) -> TargetRotation {
|
||||
TargetRotation {
|
||||
yaw: yaw,
|
||||
pitch: pitch,
|
||||
yaw,
|
||||
pitch,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ pub struct Bounds {
|
|||
impl Bounds {
|
||||
pub fn new(bounds: Aabb3<f64>) -> Bounds {
|
||||
Bounds {
|
||||
bounds: bounds,
|
||||
bounds,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,9 +93,9 @@ impl PlayerModel {
|
|||
dirty: false,
|
||||
name: name.to_owned(),
|
||||
|
||||
has_head: has_head,
|
||||
has_name_tag: has_name_tag,
|
||||
first_person: first_person,
|
||||
has_head,
|
||||
has_name_tag,
|
||||
first_person,
|
||||
|
||||
dir: 0,
|
||||
time: 0.0,
|
||||
|
@ -132,11 +132,11 @@ impl PlayerRenderer {
|
|||
.with(position)
|
||||
.with(rotation)
|
||||
.with(light),
|
||||
player_model: player_model,
|
||||
position: position,
|
||||
rotation: rotation,
|
||||
player_model,
|
||||
position,
|
||||
rotation,
|
||||
game_info: m.get_key(),
|
||||
light: light,
|
||||
light,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -386,7 +386,7 @@ impl ecs::System for PlayerRenderer {
|
|||
width: 0.0,
|
||||
offset: 0.0,
|
||||
text: Vec::new(),
|
||||
renderer: renderer,
|
||||
renderer,
|
||||
y_scale: 0.16,
|
||||
x_scale: 0.01,
|
||||
};
|
||||
|
@ -505,13 +505,13 @@ impl MovementHandler {
|
|||
.with(velocity)
|
||||
.with(bounds)
|
||||
.with(rotation),
|
||||
movement: movement,
|
||||
movement,
|
||||
gravity: m.get_key(),
|
||||
gamemode: m.get_key(),
|
||||
position: position,
|
||||
velocity: velocity,
|
||||
bounds: bounds,
|
||||
rotation: rotation,
|
||||
position,
|
||||
velocity,
|
||||
bounds,
|
||||
rotation,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,8 +21,8 @@ impl ApplyVelocity {
|
|||
filter: ecs::Filter::new()
|
||||
.with(position)
|
||||
.with(velocity),
|
||||
position: position,
|
||||
velocity: velocity,
|
||||
position,
|
||||
velocity,
|
||||
movement: m.get_key(),
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ impl ApplyGravity {
|
|||
filter: ecs::Filter::new()
|
||||
.with(gravity)
|
||||
.with(velocity),
|
||||
velocity: velocity,
|
||||
velocity,
|
||||
movement: m.get_key(),
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ impl UpdateLastPosition {
|
|||
UpdateLastPosition {
|
||||
filter: ecs::Filter::new()
|
||||
.with(position),
|
||||
position: position,
|
||||
position,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -136,8 +136,8 @@ impl LerpPosition {
|
|||
filter: ecs::Filter::new()
|
||||
.with(position)
|
||||
.with(target_position),
|
||||
position: position,
|
||||
target_position: target_position,
|
||||
position,
|
||||
target_position,
|
||||
game_info: m.get_key(),
|
||||
}
|
||||
}
|
||||
|
@ -180,8 +180,8 @@ impl LerpRotation {
|
|||
filter: ecs::Filter::new()
|
||||
.with(rotation)
|
||||
.with(target_rotation),
|
||||
rotation: rotation,
|
||||
target_rotation: target_rotation,
|
||||
rotation,
|
||||
target_rotation,
|
||||
game_info: m.get_key(),
|
||||
}
|
||||
}
|
||||
|
@ -238,9 +238,9 @@ impl LightEntity {
|
|||
.with(position)
|
||||
.with(bounds)
|
||||
.with(light),
|
||||
position: position,
|
||||
bounds: bounds,
|
||||
light: light,
|
||||
position,
|
||||
bounds,
|
||||
light,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ impl Component {
|
|||
if let Some(val) = v.as_str() {
|
||||
Component::Text(TextComponent {
|
||||
text: val.to_owned(),
|
||||
modifier: modifier,
|
||||
modifier,
|
||||
})
|
||||
} else if v.get("text").is_some() {
|
||||
Component::Text(TextComponent::from_value(v, modifier))
|
||||
|
@ -49,7 +49,7 @@ impl Component {
|
|||
modifier.color = Some(Color::RGB(255, 0, 0));
|
||||
Component::Text(TextComponent {
|
||||
text: "UNHANDLED".to_owned(),
|
||||
modifier: modifier,
|
||||
modifier,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ impl TextComponent {
|
|||
pub fn from_value(v: &serde_json::Value, modifier: Modifier) -> Self {
|
||||
TextComponent {
|
||||
text: v.get("text").unwrap().as_str().unwrap_or("").to_owned(),
|
||||
modifier: modifier,
|
||||
modifier,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -777,7 +777,7 @@ impl Buffer {
|
|||
unsafe {
|
||||
MappedBuffer {
|
||||
inner: Vec::from_raw_parts(gl::MapBuffer(target, access) as *mut u8, 0, length),
|
||||
target: target,
|
||||
target,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -202,15 +202,15 @@ fn main() {
|
|||
let mut game = Game {
|
||||
server: server::Server::dummy_server(resource_manager.clone()),
|
||||
focused: false,
|
||||
renderer: renderer,
|
||||
screen_sys: screen_sys,
|
||||
renderer,
|
||||
screen_sys,
|
||||
resource_manager: resource_manager.clone(),
|
||||
console: con,
|
||||
vars: vars,
|
||||
vars,
|
||||
should_close: false,
|
||||
chunk_builder: chunk_builder::ChunkBuilder::new(resource_manager, textures),
|
||||
connect_reply: None,
|
||||
sdl: sdl,
|
||||
sdl,
|
||||
};
|
||||
game.renderer.camera.pos = cgmath::Point3::new(0.5, 13.2, 0.5);
|
||||
|
||||
|
|
|
@ -63,8 +63,8 @@ impl Factory {
|
|||
Factory {
|
||||
grass_colors: Factory::load_biome_colors(resources.clone(), "grass"),
|
||||
foliage_colors: Factory::load_biome_colors(resources.clone(), "foliage"),
|
||||
resources: resources,
|
||||
textures: textures,
|
||||
resources,
|
||||
textures,
|
||||
|
||||
models: HashMap::with_hasher(BuildHasherDefault::default()),
|
||||
}
|
||||
|
@ -218,8 +218,8 @@ impl Factory {
|
|||
Self::parse_rules(when, &mut rules);
|
||||
}
|
||||
model.multipart.push(MultipartRule {
|
||||
apply: apply,
|
||||
rules: rules,
|
||||
apply,
|
||||
rules,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -1050,7 +1050,7 @@ pub struct BlockVertex {
|
|||
impl BlockVertex {
|
||||
const fn base(x: f32, y: f32, z: f32, tx: i16, ty: i16) -> BlockVertex {
|
||||
BlockVertex {
|
||||
x: x, y: y, z: z,
|
||||
x, y, z,
|
||||
tx: 0, ty: 0, tw: 0, th: 0,
|
||||
toffsetx: tx, toffsety: ty, tatlas: 0,
|
||||
r: 0, g: 0, b: 0,
|
||||
|
|
|
@ -405,7 +405,7 @@ impl <L: Lengthable, V: Default> LenPrefixed<L, V> {
|
|||
pub fn new(data: Vec<V>) -> LenPrefixed<L, V> {
|
||||
LenPrefixed {
|
||||
len: Default::default(),
|
||||
data: data,
|
||||
data,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -420,7 +420,7 @@ impl <L: Lengthable, V: Serializable> Serializable for LenPrefixed<L, V> {
|
|||
}
|
||||
Result::Ok(LenPrefixed {
|
||||
len: len_data,
|
||||
data: data,
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -461,7 +461,7 @@ impl <L: Lengthable> LenPrefixedBytes<L> {
|
|||
pub fn new(data: Vec<u8>) -> LenPrefixedBytes<L> {
|
||||
LenPrefixedBytes {
|
||||
len: Default::default(),
|
||||
data: data,
|
||||
data,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -474,7 +474,7 @@ impl <L: Lengthable> Serializable for LenPrefixedBytes<L> {
|
|||
buf.take(len as u64).read_to_end(&mut data)?;
|
||||
Result::Ok(LenPrefixedBytes {
|
||||
len: len_data,
|
||||
data: data,
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -765,7 +765,7 @@ impl Conn {
|
|||
};
|
||||
let stream = TcpStream::connect(&*address)?;
|
||||
Result::Ok(Conn {
|
||||
stream: stream,
|
||||
stream,
|
||||
host: parts[0].to_owned(),
|
||||
port: parts[1].parse().unwrap(),
|
||||
direction: Direction::Serverbound,
|
||||
|
@ -875,8 +875,8 @@ impl Conn {
|
|||
let port = self.port;
|
||||
self.write_packet(Handshake {
|
||||
protocol_version: VarInt(SUPPORTED_PROTOCOL),
|
||||
host: host,
|
||||
port: port,
|
||||
host,
|
||||
port,
|
||||
next: VarInt(1),
|
||||
})?;
|
||||
self.state = State::Status;
|
||||
|
|
|
@ -1121,8 +1121,8 @@ impl Serializable for PlayerInfoData {
|
|||
props.push(prop);
|
||||
}
|
||||
let p = PlayerDetail::Add {
|
||||
uuid: uuid,
|
||||
name: name,
|
||||
uuid,
|
||||
name,
|
||||
properties: props,
|
||||
gamemode: Serializable::read_from(buf)?,
|
||||
ping: Serializable::read_from(buf)?,
|
||||
|
@ -1138,19 +1138,19 @@ impl Serializable for PlayerInfoData {
|
|||
}
|
||||
1 => {
|
||||
m.players.push(PlayerDetail::UpdateGamemode {
|
||||
uuid: uuid,
|
||||
uuid,
|
||||
gamemode: Serializable::read_from(buf)?,
|
||||
})
|
||||
}
|
||||
2 => {
|
||||
m.players.push(PlayerDetail::UpdateLatency {
|
||||
uuid: uuid,
|
||||
uuid,
|
||||
ping: Serializable::read_from(buf)?,
|
||||
})
|
||||
}
|
||||
3 => {
|
||||
m.players.push(PlayerDetail::UpdateDisplayName {
|
||||
uuid: uuid,
|
||||
uuid,
|
||||
display: {
|
||||
if bool::read_from(buf)? {
|
||||
Some(Serializable::read_from(buf)?)
|
||||
|
|
|
@ -30,8 +30,8 @@ impl Atlas {
|
|||
a.free_space.push(Rect {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: width,
|
||||
height: height,
|
||||
width,
|
||||
height,
|
||||
});
|
||||
a
|
||||
}
|
||||
|
@ -62,8 +62,8 @@ impl Atlas {
|
|||
let ret = Rect {
|
||||
x: t.x,
|
||||
y: t.y,
|
||||
width: width,
|
||||
height: height,
|
||||
width,
|
||||
height,
|
||||
};
|
||||
|
||||
if width == t.width {
|
||||
|
@ -82,7 +82,7 @@ impl Atlas {
|
|||
Rect {
|
||||
x: t.x,
|
||||
y: t.y + height,
|
||||
width: width,
|
||||
width,
|
||||
height: t.height - height,
|
||||
});
|
||||
target_index += 1;
|
||||
|
|
|
@ -134,31 +134,31 @@ impl Clouds {
|
|||
texture.set_parameter(gl::TEXTURE_2D, gl::TEXTURE_MAG_FILTER, gl::NEAREST);
|
||||
|
||||
Clouds {
|
||||
program: program,
|
||||
program,
|
||||
// Shader props
|
||||
_a_position: a_position,
|
||||
u_perspective_matrix: u_perspective_matrix,
|
||||
u_camera_matrix: u_camera_matrix,
|
||||
u_light_level: u_light_level,
|
||||
u_sky_offset: u_sky_offset,
|
||||
u_offset: u_offset,
|
||||
u_texture_info: u_texture_info,
|
||||
u_atlas: u_atlas,
|
||||
u_textures: u_textures,
|
||||
u_cloud_map: u_cloud_map,
|
||||
u_cloud_offset: u_cloud_offset,
|
||||
u_perspective_matrix,
|
||||
u_camera_matrix,
|
||||
u_light_level,
|
||||
u_sky_offset,
|
||||
u_offset,
|
||||
u_texture_info,
|
||||
u_atlas,
|
||||
u_textures,
|
||||
u_cloud_map,
|
||||
u_cloud_offset,
|
||||
|
||||
array: array,
|
||||
array,
|
||||
_buffer: buffer,
|
||||
|
||||
textures: textures,
|
||||
textures,
|
||||
|
||||
texture: texture,
|
||||
heightmap_data: heightmap_data,
|
||||
texture,
|
||||
heightmap_data,
|
||||
dirty: false,
|
||||
|
||||
offset: 0.0,
|
||||
num_points: num_points,
|
||||
num_points,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -199,15 +199,15 @@ impl Renderer {
|
|||
resource_version: version,
|
||||
model: model::Manager::new(&greg),
|
||||
clouds: clouds::Clouds::new(&greg, textures.clone()),
|
||||
textures: textures,
|
||||
ui: ui,
|
||||
textures,
|
||||
ui,
|
||||
resources: res,
|
||||
gl_texture: tex,
|
||||
texture_layers: 1,
|
||||
|
||||
chunk_shader: chunk_shader,
|
||||
chunk_shader_alpha: chunk_shader_alpha,
|
||||
trans_shader: trans_shader,
|
||||
chunk_shader,
|
||||
chunk_shader_alpha,
|
||||
trans_shader,
|
||||
|
||||
element_buffer: gl::Buffer::new(),
|
||||
element_buffer_size: 0,
|
||||
|
@ -233,7 +233,7 @@ impl Renderer {
|
|||
light_level: 0.8,
|
||||
sky_offset: 1.0,
|
||||
skin_request: skin_req,
|
||||
skin_reply: skin_reply,
|
||||
skin_reply,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -743,15 +743,15 @@ impl TransInfo {
|
|||
shader.position.vertex_pointer(2, gl::FLOAT, false, 8, 0);
|
||||
|
||||
TransInfo {
|
||||
main: main,
|
||||
fb_color: fb_color,
|
||||
main,
|
||||
fb_color,
|
||||
_fb_depth: fb_depth,
|
||||
trans: trans,
|
||||
accum: accum,
|
||||
revealage: revealage,
|
||||
trans,
|
||||
accum,
|
||||
revealage,
|
||||
_depth: trans_depth,
|
||||
|
||||
array: array,
|
||||
array,
|
||||
_buffer: buffer,
|
||||
}
|
||||
}
|
||||
|
@ -1105,9 +1105,9 @@ impl TextureManager {
|
|||
};
|
||||
|
||||
return Some(AnimatedTexture {
|
||||
frames: frames,
|
||||
data: data,
|
||||
interpolate: interpolate,
|
||||
frames,
|
||||
data,
|
||||
interpolate,
|
||||
current_frame: 0,
|
||||
remaining_time: 0.0,
|
||||
texture: self.get_texture("steven:missing_texture").unwrap(),
|
||||
|
@ -1134,7 +1134,7 @@ impl TextureManager {
|
|||
let tex = Texture {
|
||||
name: full_name.clone(),
|
||||
version: self.version,
|
||||
atlas: atlas,
|
||||
atlas,
|
||||
x: rect.x,
|
||||
y: rect.y,
|
||||
width: rect.width,
|
||||
|
@ -1209,8 +1209,8 @@ impl TextureManager {
|
|||
let rect = atlas::Rect {
|
||||
x: tex.x,
|
||||
y: tex.y,
|
||||
width: width,
|
||||
height: height,
|
||||
width,
|
||||
height,
|
||||
};
|
||||
self.pending_uploads.push((tex.atlas, rect, data));
|
||||
let mut t = tex.relative(0.0, 0.0, (width as f32) / (tex.width as f32), (height as f32) / (tex.height as f32));
|
||||
|
|
|
@ -56,8 +56,8 @@ impl Manager {
|
|||
let collection = Collection {
|
||||
shader: ModelShader::new_manual(vert, frag),
|
||||
models: HashMap::with_hasher(BuildHasherDefault::default()),
|
||||
blend_s: blend_s,
|
||||
blend_d: blend_d,
|
||||
blend_s,
|
||||
blend_d,
|
||||
next_id: 0,
|
||||
};
|
||||
self.collections.push(collection);
|
||||
|
@ -102,8 +102,8 @@ impl Manager {
|
|||
block_light: 15.0,
|
||||
sky_light: 15.0,
|
||||
|
||||
array: array,
|
||||
buffer: buffer,
|
||||
array,
|
||||
buffer,
|
||||
buffer_size: 0,
|
||||
count: 0,
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ impl UIState {
|
|||
}
|
||||
|
||||
let mut state = UIState {
|
||||
textures: textures,
|
||||
textures,
|
||||
resources: res,
|
||||
version: 0xFFFF,
|
||||
|
||||
|
@ -116,17 +116,17 @@ impl UIState {
|
|||
prev_size: 0,
|
||||
|
||||
index_type: gl::UNSIGNED_BYTE,
|
||||
array: array,
|
||||
buffer: buffer,
|
||||
index_buffer: index_buffer,
|
||||
array,
|
||||
buffer,
|
||||
index_buffer,
|
||||
max_index: 0,
|
||||
|
||||
shader: shader,
|
||||
shader,
|
||||
|
||||
// Font
|
||||
font_pages: pages,
|
||||
font_character_info: vec![(0, 0); 0x10000],
|
||||
char_map: char_map,
|
||||
char_map,
|
||||
page_width: 0.0,
|
||||
page_height: 0.0,
|
||||
};
|
||||
|
@ -393,7 +393,7 @@ impl UIState {
|
|||
offset += w + 2.0;
|
||||
}
|
||||
UIText {
|
||||
elements: elements,
|
||||
elements,
|
||||
width: (offset - 2.0) * sx,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -202,8 +202,8 @@ impl Manager {
|
|||
position: -UI_HEIGHT,
|
||||
closing: false,
|
||||
progress: 0.0,
|
||||
background: background,
|
||||
progress_bar: progress_bar,
|
||||
background,
|
||||
progress_bar,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -368,7 +368,7 @@ impl Manager {
|
|||
read: res,
|
||||
progress: &progress_info,
|
||||
task_name: "Downloading Core Assets".into(),
|
||||
task_file: task_file,
|
||||
task_file,
|
||||
};
|
||||
io::copy(&mut progress, &mut file).unwrap();
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ impl super::Screen for Connecting {
|
|||
.create(ui_container);
|
||||
|
||||
self.elements = Some(UIElements {
|
||||
logo: logo,
|
||||
logo,
|
||||
_disclaimer: disclaimer,
|
||||
_msg: msg,
|
||||
_connect_msg: connect_msg,
|
||||
|
|
|
@ -38,7 +38,7 @@ impl EditServerEntry {
|
|||
pub fn new(entry_info: Option<(usize, String, String)>) -> EditServerEntry {
|
||||
EditServerEntry {
|
||||
elements: None,
|
||||
entry_info: entry_info,
|
||||
entry_info,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,7 @@ impl super::Screen for EditServerEntry {
|
|||
}
|
||||
|
||||
self.elements = Some(UIElements {
|
||||
logo: logo,
|
||||
logo,
|
||||
_name: server_name,
|
||||
_address: server_address,
|
||||
_done: done,
|
||||
|
|
|
@ -136,19 +136,19 @@ impl super::Screen for Login {
|
|||
try_login.set(refresh);
|
||||
|
||||
self.elements = Some(UIElements {
|
||||
logo: logo,
|
||||
profile: profile,
|
||||
login_btn: login_btn,
|
||||
login_btn_text: login_btn_text,
|
||||
login_error: login_error,
|
||||
try_login: try_login,
|
||||
refresh: refresh,
|
||||
logo,
|
||||
profile,
|
||||
login_btn,
|
||||
login_btn_text,
|
||||
login_error,
|
||||
try_login,
|
||||
refresh,
|
||||
login_res: None,
|
||||
|
||||
_disclaimer: disclaimer,
|
||||
|
||||
username_txt: username_txt,
|
||||
password_txt: password_txt,
|
||||
username_txt,
|
||||
password_txt,
|
||||
});
|
||||
}
|
||||
fn on_deactive(&mut self, _renderer: &mut render::Renderer, _ui_container: &mut ui::Container) {
|
||||
|
|
|
@ -69,7 +69,7 @@ impl ScreenSystem {
|
|||
|
||||
pub fn add_screen(&mut self, screen: Box<Screen>) {
|
||||
self.screens.push(ScreenInfo {
|
||||
screen: screen,
|
||||
screen,
|
||||
init: false,
|
||||
active: false,
|
||||
});
|
||||
|
|
|
@ -92,7 +92,7 @@ impl ServerList {
|
|||
pub fn new(disconnect_reason: Option<Component>) -> ServerList {
|
||||
ServerList {
|
||||
elements: None,
|
||||
disconnect_reason: disconnect_reason,
|
||||
disconnect_reason,
|
||||
needs_reload: Rc::new(RefCell::new(false)),
|
||||
}
|
||||
}
|
||||
|
@ -239,18 +239,18 @@ impl ServerList {
|
|||
}
|
||||
|
||||
let mut server = Server {
|
||||
back: back,
|
||||
offset: offset,
|
||||
back,
|
||||
offset,
|
||||
y: 0.0,
|
||||
done_ping: false,
|
||||
recv: recv,
|
||||
recv,
|
||||
|
||||
motd: motd,
|
||||
ping: ping,
|
||||
players: players,
|
||||
version: version,
|
||||
motd,
|
||||
ping,
|
||||
players,
|
||||
version,
|
||||
|
||||
icon: icon,
|
||||
icon,
|
||||
icon_texture: None,
|
||||
};
|
||||
server.update_position();
|
||||
|
@ -278,7 +278,7 @@ impl ServerList {
|
|||
max: res.0.players.max,
|
||||
protocol_version: res.0.version.protocol,
|
||||
protocol_name: res.0.version.name,
|
||||
favicon: favicon,
|
||||
favicon,
|
||||
}));
|
||||
}
|
||||
Err(err) => {
|
||||
|
@ -406,7 +406,7 @@ impl super::Screen for ServerList {
|
|||
};
|
||||
|
||||
self.elements = Some(UIElements {
|
||||
logo: logo,
|
||||
logo,
|
||||
servers: Vec::new(),
|
||||
|
||||
_add_btn: add,
|
||||
|
|
|
@ -150,7 +150,7 @@ impl super::Screen for SettingsMenu {
|
|||
}
|
||||
|
||||
self.elements = Some(UIElements {
|
||||
background: background,
|
||||
background,
|
||||
_buttons: buttons,
|
||||
});
|
||||
|
||||
|
@ -195,7 +195,7 @@ pub struct VideoSettingsMenu {
|
|||
impl VideoSettingsMenu {
|
||||
pub fn new(vars: Rc<console::Vars>) -> VideoSettingsMenu {
|
||||
VideoSettingsMenu {
|
||||
vars: vars,
|
||||
vars,
|
||||
elements: None,
|
||||
}
|
||||
}
|
||||
|
@ -299,7 +299,7 @@ impl super::Screen for VideoSettingsMenu {
|
|||
}
|
||||
buttons.push(done_button);
|
||||
self.elements = Some(UIElements {
|
||||
background: background,
|
||||
background,
|
||||
_buttons: buttons,
|
||||
});
|
||||
|
||||
|
@ -384,7 +384,7 @@ impl super::Screen for AudioSettingsMenu {
|
|||
buttons.push(done_button);
|
||||
|
||||
self.elements = Some(UIElements {
|
||||
background: background,
|
||||
background,
|
||||
_buttons: buttons,
|
||||
});
|
||||
|
||||
|
|
|
@ -110,8 +110,8 @@ impl Server {
|
|||
let port = conn.port;
|
||||
conn.write_packet(protocol::packet::handshake::serverbound::Handshake {
|
||||
protocol_version: protocol::VarInt(protocol::SUPPORTED_PROTOCOL),
|
||||
host: host,
|
||||
port: port,
|
||||
host,
|
||||
port,
|
||||
next: protocol::VarInt(2),
|
||||
})?;
|
||||
conn.state = protocol::State::Login;
|
||||
|
@ -261,9 +261,9 @@ impl Server {
|
|||
|
||||
let version = resources.read().unwrap().version();
|
||||
Server {
|
||||
uuid: uuid,
|
||||
conn: conn,
|
||||
read_queue: read_queue,
|
||||
uuid,
|
||||
conn,
|
||||
read_queue,
|
||||
disconnect_reason: None,
|
||||
just_disconnected: false,
|
||||
|
||||
|
@ -273,11 +273,11 @@ impl Server {
|
|||
world_time_target: 0.0,
|
||||
tick_time: true,
|
||||
|
||||
version: version,
|
||||
resources: resources,
|
||||
version,
|
||||
resources,
|
||||
|
||||
// Entity accessors
|
||||
game_info: game_info,
|
||||
game_info,
|
||||
player_movement: entities.get_key(),
|
||||
gravity: entities.get_key(),
|
||||
position: entities.get_key(),
|
||||
|
@ -288,7 +288,7 @@ impl Server {
|
|||
target_rotation: entities.get_key(),
|
||||
//
|
||||
|
||||
entities: entities,
|
||||
entities,
|
||||
player: None,
|
||||
entity_map: HashMap::with_hasher(BuildHasherDefault::default()),
|
||||
players: HashMap::with_hasher(BuildHasherDefault::default()),
|
||||
|
@ -494,7 +494,7 @@ impl Server {
|
|||
z: position.position.z,
|
||||
yaw: -(rotation.yaw as f32) * (180.0 / PI),
|
||||
pitch: (-rotation.pitch as f32) * (180.0 / PI) + 180.0,
|
||||
on_ground: on_ground,
|
||||
on_ground,
|
||||
};
|
||||
self.write_packet(packet);
|
||||
}
|
||||
|
@ -749,7 +749,7 @@ impl Server {
|
|||
Add { name, uuid, properties, display, gamemode, ping} => {
|
||||
let info = self.players.entry(uuid.clone()).or_insert(PlayerInfo {
|
||||
name: name.clone(),
|
||||
uuid: uuid,
|
||||
uuid,
|
||||
skin_url: None,
|
||||
|
||||
display_name: display.clone(),
|
||||
|
@ -846,7 +846,7 @@ impl Server {
|
|||
}
|
||||
self.on_block_entity_update(packet::play::clientbound::UpdateBlockEntity {
|
||||
location: Position::new(x, y, z),
|
||||
action: action,
|
||||
action,
|
||||
nbt: Some(block_entity.clone()),
|
||||
});
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ impl Brand {
|
|||
Serializable::write_to(&self.brand, &mut data).unwrap();
|
||||
PluginMessageServerbound {
|
||||
channel: "MC|Brand".into(),
|
||||
data: data,
|
||||
data,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -210,8 +210,8 @@ pub fn trace_ray<F, R>(world: &world::World, max: f64, s: cgmath::Vector3<f64>,
|
|||
};
|
||||
Gen {
|
||||
count: 0,
|
||||
base: base,
|
||||
d: d,
|
||||
base,
|
||||
d,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ impl Map {
|
|||
Map {
|
||||
length: (bits.len()*64 + (size-1)) / size,
|
||||
bit_size: size,
|
||||
bits: bits,
|
||||
bits,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ impl <T: MetaValue> MetadataKey<T> {
|
|||
#[allow(dead_code)]
|
||||
fn new(index: i32) -> MetadataKey<T> {
|
||||
MetadataKey {
|
||||
index: index,
|
||||
index,
|
||||
ty: PhantomData,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -126,10 +126,10 @@ impl Logo {
|
|||
_shadow: shadow_batch,
|
||||
_layer0: layer0,
|
||||
text: txt,
|
||||
text_base_scale: text_base_scale,
|
||||
text_orig_x: text_orig_x,
|
||||
text_base_scale,
|
||||
text_orig_x,
|
||||
text_index: -1,
|
||||
text_strings: text_strings,
|
||||
text_strings,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1021,7 +1021,7 @@ impl UIElement for Formatted {
|
|||
offset: 0.0,
|
||||
text: Vec::new(),
|
||||
max_width: self.max_width,
|
||||
renderer: renderer,
|
||||
renderer,
|
||||
};
|
||||
state.build(&self.text, format::Color::White);
|
||||
self.text_elements = state.text;
|
||||
|
@ -1079,8 +1079,8 @@ impl Formatted {
|
|||
width: 0.0,
|
||||
offset: 0.0,
|
||||
text: Vec::new(),
|
||||
max_width: max_width,
|
||||
renderer: renderer,
|
||||
max_width,
|
||||
renderer,
|
||||
};
|
||||
state.build(text, format::Color::White);
|
||||
(state.width + 2.0, (state.lines + 1) as f64 * 18.0)
|
||||
|
|
|
@ -12,7 +12,7 @@ pub struct Biome {
|
|||
impl Biome {
|
||||
const fn new(id: usize, t: i16, m: i16) -> Biome {
|
||||
Biome {
|
||||
id: id,
|
||||
id,
|
||||
temperature: t,
|
||||
moisture: m*t,
|
||||
}
|
||||
|
|
|
@ -178,8 +178,8 @@ impl World {
|
|||
|
||||
fn update_light(&mut self, pos: Position, ty: LightType) {
|
||||
self.light_updates.push_back(LightUpdate {
|
||||
ty: ty,
|
||||
pos: pos,
|
||||
ty,
|
||||
pos,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -470,8 +470,8 @@ impl World {
|
|||
sky_light: nibble::Array::new((w * h * d) as usize),
|
||||
biomes: vec![0; (w * d) as usize],
|
||||
|
||||
x: x, y: y, z: z,
|
||||
w: w, _h: h, d: d,
|
||||
x, y, z,
|
||||
w, _h: h, d,
|
||||
};
|
||||
for i in 0 .. (w * h * d) as usize {
|
||||
snapshot.sky_light.set(i, 0xF);
|
||||
|
@ -914,7 +914,7 @@ impl Section {
|
|||
let mut section = Section {
|
||||
cull_info: chunk_builder::CullInfo::all_vis(),
|
||||
render_buffer: render::ChunkBuffer::new(),
|
||||
y: y,
|
||||
y,
|
||||
|
||||
blocks: storage::BlockStorage::new(4096),
|
||||
|
||||
|
|
Loading…
Reference in New Issue