commit
72f5fdf619
|
@ -11,7 +11,7 @@ jobs:
|
|||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
# TODO: refactor toolchain version
|
||||
toolchain: 1.49.0
|
||||
toolchain: 1.53.0
|
||||
components: clippy, rustfmt
|
||||
default: true
|
||||
- name: Install dependencies
|
||||
|
@ -49,7 +49,7 @@ jobs:
|
|||
- name: Install Rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: 1.49.0
|
||||
toolchain: 1.53.0
|
||||
components: clippy, rustfmt
|
||||
default: true
|
||||
- name: Build binary
|
||||
|
@ -83,7 +83,7 @@ jobs:
|
|||
- name: Install Rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: 1.49.0
|
||||
toolchain: 1.53.0
|
||||
components: clippy, rustfmt
|
||||
default: true
|
||||
- name: Build binary
|
||||
|
@ -128,7 +128,7 @@ jobs:
|
|||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
# TODO: refactor toolchain version
|
||||
toolchain: 1.49.0
|
||||
toolchain: 1.53.0
|
||||
components: clippy, rustfmt
|
||||
default: true
|
||||
- name: Install wasm-pack
|
||||
|
|
|
@ -3,6 +3,7 @@ name = "stevenarella"
|
|||
version = "0.0.1"
|
||||
authors = [ "Thinkofdeath <thinkofdeath@spigotmc.org>", "iceiix <ice_ix@protonmail.ch>" ]
|
||||
edition = "2018"
|
||||
resolver = "2"
|
||||
description = "Multi-protocol multi-platform Minecraft-compatible client"
|
||||
repository = "https://github.com/iceiix/stevenarella"
|
||||
license = "MIT/Apache-2.0"
|
||||
|
@ -19,6 +20,7 @@ crate-type = ["cdylib", "rlib"]
|
|||
path = "src/main.rs"
|
||||
|
||||
[profile.dev]
|
||||
split-debuginfo = "unpacked"
|
||||
# Steven runs horrendously slow with no optimizations, and often freezes.
|
||||
# However, building with full -O3 optimizations takes too long for a debug build.
|
||||
# Use an -O1 optimization level strikes a good compromise between build and program performance.
|
||||
|
|
|
@ -67,7 +67,7 @@ from [GitHub Actions](https://actions-badge.atrox.dev/iceiix/stevenarella/goto?r
|
|||
|
||||
## Dependencies
|
||||
|
||||
Requires Rust stable version 1.49.0 or newer.
|
||||
Requires Rust stable version 1.53.0 or newer.
|
||||
|
||||
**Debian/Ubuntu**
|
||||
|
||||
|
|
|
@ -5883,7 +5883,9 @@ mod tests {
|
|||
}
|
||||
|
||||
fn can_burn<W: WorldAccess>(world: &W, pos: Position) -> bool {
|
||||
matches!(world.get_block(pos), Block::Planks { .. }
|
||||
matches!(
|
||||
world.get_block(pos),
|
||||
Block::Planks { .. }
|
||||
| Block::DoubleWoodenSlab { .. }
|
||||
| Block::WoodenSlab { .. }
|
||||
| Block::FenceGate { .. }
|
||||
|
@ -5919,11 +5921,15 @@ fn can_burn<W: WorldAccess>(world: &W, pos: Position) -> bool {
|
|||
| Block::Vine { .. }
|
||||
| Block::CoalBlock { .. }
|
||||
| Block::HayBlock { .. }
|
||||
| Block::Carpet { .. })
|
||||
| Block::Carpet { .. }
|
||||
)
|
||||
}
|
||||
|
||||
fn is_snowy<W: WorldAccess>(world: &W, pos: Position) -> bool {
|
||||
matches!(world.get_block(pos.shift(Direction::Up)), Block::Snow { .. } | Block::SnowLayer { .. })
|
||||
matches!(
|
||||
world.get_block(pos.shift(Direction::Up)),
|
||||
Block::Snow { .. } | Block::SnowLayer { .. }
|
||||
)
|
||||
}
|
||||
|
||||
fn can_connect_sides<F: Fn(Block) -> bool, W: WorldAccess>(
|
||||
|
@ -5945,7 +5951,9 @@ fn can_connect<F: Fn(Block) -> bool, W: WorldAccess>(world: &W, pos: Position, f
|
|||
}
|
||||
|
||||
fn can_connect_fence(block: Block) -> bool {
|
||||
matches!(block, Block::Fence { .. }
|
||||
matches!(
|
||||
block,
|
||||
Block::Fence { .. }
|
||||
| Block::SpruceFence { .. }
|
||||
| Block::BirchFence { .. }
|
||||
| Block::JungleFence { .. }
|
||||
|
@ -5956,14 +5964,18 @@ fn can_connect_fence(block: Block) -> bool {
|
|||
| Block::BirchFenceGate { .. }
|
||||
| Block::JungleFenceGate { .. }
|
||||
| Block::DarkOakFenceGate { .. }
|
||||
| Block::AcaciaFenceGate { .. })
|
||||
| Block::AcaciaFenceGate { .. }
|
||||
)
|
||||
}
|
||||
|
||||
fn can_connect_glasspane(block: Block) -> bool {
|
||||
matches!(block, Block::Glass { .. }
|
||||
matches!(
|
||||
block,
|
||||
Block::Glass { .. }
|
||||
| Block::StainedGlass { .. }
|
||||
| Block::GlassPane { .. }
|
||||
| Block::StainedGlassPane { .. })
|
||||
| Block::StainedGlassPane { .. }
|
||||
)
|
||||
}
|
||||
|
||||
fn can_connect_redstone<W: WorldAccess>(world: &W, pos: Position, dir: Direction) -> RedstoneSide {
|
||||
|
@ -6198,7 +6210,12 @@ fn door_collision(facing: Direction, hinge: Side, open: bool) -> Vec<Aabb3<f64>>
|
|||
}
|
||||
|
||||
fn update_repeater_state<W: WorldAccess>(world: &W, pos: Position, facing: Direction) -> bool {
|
||||
let f = |dir| matches!(world.get_block(pos.shift(dir)), Block::RepeaterPowered { .. });
|
||||
let f = |dir| {
|
||||
matches!(
|
||||
world.get_block(pos.shift(dir)),
|
||||
Block::RepeaterPowered { .. }
|
||||
)
|
||||
};
|
||||
|
||||
f(facing.clockwise()) || f(facing.counter_clockwise())
|
||||
}
|
||||
|
|
|
@ -601,8 +601,8 @@ impl ComponentMem {
|
|||
data: vec![],
|
||||
component_size: mem::size_of::<T>(),
|
||||
drop_func: Box::new(|data| unsafe {
|
||||
let mut val: T = mem::MaybeUninit::uninit().assume_init();
|
||||
ptr::copy(data as *mut T, &mut val, 1);
|
||||
let mut val = mem::MaybeUninit::<T>::uninit();
|
||||
ptr::copy(data as *mut T, val.as_mut_ptr(), 1);
|
||||
mem::drop(val);
|
||||
}),
|
||||
}
|
||||
|
|
|
@ -491,20 +491,12 @@ impl Program {
|
|||
|
||||
pub fn uniform_location(&self, name: &str) -> Option<Uniform> {
|
||||
let u = unsafe { glow_context().get_uniform_location(self.0, name) };
|
||||
if let Some(u) = u {
|
||||
Some(Uniform(u))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
u.map(Uniform)
|
||||
}
|
||||
|
||||
pub fn attribute_location(&self, name: &str) -> Option<Attribute> {
|
||||
let a = unsafe { glow_context().get_attrib_location(self.0, name) };
|
||||
if let Some(a) = a {
|
||||
Some(Attribute(a as i32))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
a.map(|a| Attribute(a as i32))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -805,7 +797,7 @@ impl Drop for MappedBuffer {
|
|||
unsafe {
|
||||
glow_context().unmap_buffer(self.target);
|
||||
}
|
||||
mem::forget(mem::replace(&mut self.inner, Vec::new()));
|
||||
mem::forget(std::mem::take(&mut self.inner))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
10
src/main.rs
10
src/main.rs
|
@ -631,11 +631,12 @@ fn handle_window_event<T>(
|
|||
use winit::event::*;
|
||||
match event {
|
||||
Event::MainEventsCleared => return true,
|
||||
Event::DeviceEvent { event, .. } => {
|
||||
if let DeviceEvent::MouseMotion {
|
||||
Event::DeviceEvent {
|
||||
event: DeviceEvent::MouseMotion {
|
||||
delta: (xrel, yrel),
|
||||
} = event
|
||||
{
|
||||
},
|
||||
..
|
||||
} => {
|
||||
let (rx, ry) = if xrel > 1000.0 || yrel > 1000.0 {
|
||||
// Heuristic for if we were passed an absolute value instead of relative
|
||||
// Workaround https://github.com/tomaka/glutin/issues/1084 MouseMotion event returns absolute instead of relative values, when running Linux in a VM
|
||||
|
@ -679,7 +680,6 @@ fn handle_window_event<T>(
|
|||
window.set_cursor_visible(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Event::WindowEvent { event, .. } => {
|
||||
match event {
|
||||
|
|
|
@ -547,7 +547,7 @@ impl Factory {
|
|||
ambient_occlusion: raw.ambient_occlusion,
|
||||
weight: raw.weight,
|
||||
};
|
||||
let elements = ::std::mem::replace(&mut raw.elements, vec![]);
|
||||
let elements = std::mem::take(&mut raw.elements);
|
||||
for el in elements {
|
||||
let all_dirs = Direction::all();
|
||||
for (i, face) in el.faces.iter().enumerate() {
|
||||
|
|
|
@ -1902,8 +1902,7 @@ impl Server {
|
|||
}
|
||||
|
||||
fn load_block_entities(&mut self, block_entities: Vec<Option<crate::nbt::NamedTag>>) {
|
||||
for optional_block_entity in block_entities {
|
||||
if let Some(block_entity) = optional_block_entity {
|
||||
for block_entity in block_entities.into_iter().flatten() {
|
||||
let x = block_entity.1.get("x").unwrap().as_int().unwrap();
|
||||
let y = block_entity.1.get("y").unwrap().as_int().unwrap();
|
||||
let z = block_entity.1.get("z").unwrap().as_int().unwrap();
|
||||
|
@ -1929,7 +1928,6 @@ impl Server {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn on_chunk_data_biomes3d_varint(
|
||||
&mut self,
|
||||
|
|
|
@ -661,15 +661,12 @@ impl World {
|
|||
|
||||
let cpos = CPos(x, z);
|
||||
{
|
||||
let chunk = if new {
|
||||
if new {
|
||||
self.chunks.insert(cpos, Chunk::new(cpos));
|
||||
self.chunks.get_mut(&cpos).unwrap()
|
||||
} else {
|
||||
if !self.chunks.contains_key(&cpos) {
|
||||
} else if !self.chunks.contains_key(&cpos) {
|
||||
return Ok(());
|
||||
}
|
||||
self.chunks.get_mut(&cpos).unwrap()
|
||||
};
|
||||
let chunk = self.chunks.get_mut(&cpos).unwrap();
|
||||
|
||||
for i in 0..16 {
|
||||
if chunk.sections[i].is_none() {
|
||||
|
@ -816,15 +813,12 @@ impl World {
|
|||
) -> Result<(), protocol::Error> {
|
||||
let cpos = CPos(x, z);
|
||||
{
|
||||
let chunk = if new {
|
||||
if new {
|
||||
self.chunks.insert(cpos, Chunk::new(cpos));
|
||||
self.chunks.get_mut(&cpos).unwrap()
|
||||
} else {
|
||||
if !self.chunks.contains_key(&cpos) {
|
||||
} else if !self.chunks.contains_key(&cpos) {
|
||||
return Ok(());
|
||||
}
|
||||
self.chunks.get_mut(&cpos).unwrap()
|
||||
};
|
||||
let chunk = self.chunks.get_mut(&cpos).unwrap();
|
||||
|
||||
// Block type array - whole byte per block
|
||||
let mut block_types = [[0u8; 4096]; 16];
|
||||
|
@ -1015,15 +1009,12 @@ impl World {
|
|||
|
||||
let cpos = CPos(x, z);
|
||||
{
|
||||
let chunk = if new {
|
||||
if new {
|
||||
self.chunks.insert(cpos, Chunk::new(cpos));
|
||||
self.chunks.get_mut(&cpos).unwrap()
|
||||
} else {
|
||||
if !self.chunks.contains_key(&cpos) {
|
||||
} else if !self.chunks.contains_key(&cpos) {
|
||||
return Ok(());
|
||||
}
|
||||
self.chunks.get_mut(&cpos).unwrap()
|
||||
};
|
||||
let chunk = self.chunks.get_mut(&cpos).unwrap();
|
||||
|
||||
for i in 0..16 {
|
||||
if chunk.sections[i].is_none() {
|
||||
|
|
Loading…
Reference in New Issue