Some more progress. Updated TODO list. I'm sorry.
This commit is contained in:
parent
a76f5aeeb0
commit
96d4184933
|
@ -1,12 +1,36 @@
|
||||||
// TODO: Multipart blocks
|
// TODO: Tile Entities
|
||||||
// TODO: Tile entities
|
// Skulls
|
||||||
// TODO: Redstone
|
// FlowerPot
|
||||||
// TODO: Skulls
|
// StandingSign
|
||||||
// TODO: FlowerPot
|
// WallSign
|
||||||
// TODO: Repeater lock state update
|
// Chest (DoubleChest)
|
||||||
// TODO: DoublePlants don't face the right direction?
|
// TrappedChest
|
||||||
// TODO: Pumpkin and Melon stem tint
|
// EnderChest
|
||||||
// TODO: Tripwire
|
// StandingBanner
|
||||||
|
// WallBanner
|
||||||
|
// Enchanting Table
|
||||||
|
// EndPortal
|
||||||
|
// Beacon
|
||||||
|
// Barrier
|
||||||
|
// EndGateway
|
||||||
|
// TODO: Blocks
|
||||||
|
// RedstoneWire (Directions/Tint)
|
||||||
|
// RedstoneRepeater (Locked State Update)
|
||||||
|
// Pumpkin_Stem (Tint)
|
||||||
|
// Melon_Stem (Tint)
|
||||||
|
// Tripwirue (State Update)
|
||||||
|
// TripwireHook (Rendering issue)
|
||||||
|
// Fences (Wooden -> Wooden, Netherbrick -> Netherbrick) (Fence -> Solid)
|
||||||
|
// GlassPane (GlassPane -> GlassPlane) (GlassPane -> Solid)
|
||||||
|
// StainedGlassPane (StainedGlassPane -> StainedGlassPane) (StainedGlassPane -> Solid)
|
||||||
|
// CobblestoneWall (CobblestoneWall -> CobblestoneWall) (CobblestoneWall -> Solid)
|
||||||
|
// IronBars (IronBars -> IronBars) (IronBars -> Solid)
|
||||||
|
// FlowingWater
|
||||||
|
// FlowingLava
|
||||||
|
// DoublePlant (Sunflower rendering)
|
||||||
|
// PistonExtension?
|
||||||
|
// Fire (Update State)
|
||||||
|
// Mycelium (Snowy Update State)
|
||||||
|
|
||||||
use std::fmt::{Display, Formatter, Error};
|
use std::fmt::{Display, Formatter, Error};
|
||||||
use collision::{Aabb, Aabb3};
|
use collision::{Aabb, Aabb3};
|
||||||
|
@ -244,7 +268,7 @@ macro_rules! define_blocks {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unused_variables, unreachable_code)]
|
#[allow(unused_variables, unreachable_code)]
|
||||||
pub fn match_multipart(&self, key: &str, val: &str) -> bool{
|
pub fn match_multipart(&self, key: &str, val: &str) -> bool {
|
||||||
match *self {
|
match *self {
|
||||||
$(
|
$(
|
||||||
Block::$name {
|
Block::$name {
|
||||||
|
@ -480,7 +504,7 @@ define_blocks! {
|
||||||
force_shade: false,
|
force_shade: false,
|
||||||
transparent: true,
|
transparent: true,
|
||||||
},
|
},
|
||||||
model { ("minecraft", "water") },
|
model { ("minecraft", "flowing_water") },
|
||||||
}
|
}
|
||||||
Water {
|
Water {
|
||||||
props {
|
props {
|
||||||
|
@ -508,7 +532,7 @@ define_blocks! {
|
||||||
force_shade: false,
|
force_shade: false,
|
||||||
transparent: false,
|
transparent: false,
|
||||||
},
|
},
|
||||||
model { ("minecraft", "lava") },
|
model { ("minecraft", "flowing_lava") },
|
||||||
}
|
}
|
||||||
Lava {
|
Lava {
|
||||||
props {
|
props {
|
||||||
|
@ -1261,6 +1285,14 @@ define_blocks! {
|
||||||
transparent: false,
|
transparent: false,
|
||||||
},
|
},
|
||||||
model { ("minecraft", "fire") },
|
model { ("minecraft", "fire") },
|
||||||
|
multipart (key, val) => match key {
|
||||||
|
"up" => up == (val == "true"),
|
||||||
|
"north" => north == (val == "true"),
|
||||||
|
"south" => south == (val == "south"),
|
||||||
|
"east" => east == (val == "east"),
|
||||||
|
"west" => west == (val == "west"),
|
||||||
|
_ => false,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
MobSpawner {
|
MobSpawner {
|
||||||
props {},
|
props {},
|
||||||
|
@ -1351,6 +1383,18 @@ define_blocks! {
|
||||||
transparent: false,
|
transparent: false,
|
||||||
},
|
},
|
||||||
model { ("minecraft", "redstone_wire") },
|
model { ("minecraft", "redstone_wire") },
|
||||||
|
tint TintType::Foliage,
|
||||||
|
update_state (world, x, y, z) => {
|
||||||
|
let (north, south, east, west) = update_redstone_wire_state(world, x, y, z);
|
||||||
|
Block::RedstoneWire {north: north, south: south, east: east, west:west, power: power}
|
||||||
|
},
|
||||||
|
multipart (key, val) => match key {
|
||||||
|
"north" => val == north.as_string(),
|
||||||
|
"south" => val == south.as_string(),
|
||||||
|
"east" => val == east.as_string(),
|
||||||
|
"west" => val == west.as_string(),
|
||||||
|
_ => false,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
DiamondOre {
|
DiamondOre {
|
||||||
props {},
|
props {},
|
||||||
|
@ -1843,7 +1887,7 @@ define_blocks! {
|
||||||
props {
|
props {
|
||||||
layers: i32 = [1, 2, 3, 4, 5, 6, 7, 8],
|
layers: i32 = [1, 2, 3, 4, 5, 6, 7, 8],
|
||||||
},
|
},
|
||||||
data Some(layers as usize),
|
data Some(layers as usize - 1),
|
||||||
material Material {
|
material Material {
|
||||||
renderable: true,
|
renderable: true,
|
||||||
never_cull: false,
|
never_cull: false,
|
||||||
|
@ -2499,10 +2543,10 @@ define_blocks! {
|
||||||
FenceGate {
|
FenceGate {
|
||||||
props {
|
props {
|
||||||
facing: Direction = [
|
facing: Direction = [
|
||||||
Direction::North,
|
|
||||||
Direction::South,
|
Direction::South,
|
||||||
Direction::East,
|
Direction::West,
|
||||||
Direction::West
|
Direction::North,
|
||||||
|
Direction::East
|
||||||
],
|
],
|
||||||
in_wall: bool = [false, true],
|
in_wall: bool = [false, true],
|
||||||
open: bool = [false, true],
|
open: bool = [false, true],
|
||||||
|
@ -2517,7 +2561,7 @@ define_blocks! {
|
||||||
transparent: false,
|
transparent: false,
|
||||||
},
|
},
|
||||||
model { ("minecraft", "fence_gate") },
|
model { ("minecraft", "fence_gate") },
|
||||||
variant format!("facing={},in_wall={},open={},powered={}", facing.as_string(), in_wall, open, powered),
|
variant format!("facing={},in_wall={},open={}", facing.as_string(), in_wall, open),
|
||||||
}
|
}
|
||||||
BrickStairs {
|
BrickStairs {
|
||||||
props {
|
props {
|
||||||
|
@ -2711,7 +2755,12 @@ define_blocks! {
|
||||||
transparent: false,
|
transparent: false,
|
||||||
},
|
},
|
||||||
model { ("minecraft", "brewing_stand") },
|
model { ("minecraft", "brewing_stand") },
|
||||||
variant format!("has_bottle_0={},has_bottle_1={},has_bottle_2={}", has_bottle_0, has_bottle_1, has_bottle_2),
|
multipart (key, val) => match key {
|
||||||
|
"has_bottle_0" => has_bottle_0,
|
||||||
|
"has_bottle_1" => has_bottle_1,
|
||||||
|
"has_bottle_2" => has_bottle_2,
|
||||||
|
_ => false,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
Cauldron {
|
Cauldron {
|
||||||
props {
|
props {
|
||||||
|
@ -3146,11 +3195,11 @@ define_blocks! {
|
||||||
}
|
}
|
||||||
CobblestoneWall {
|
CobblestoneWall {
|
||||||
props {
|
props {
|
||||||
|
up: bool = [false, true],
|
||||||
north: bool = [false, true],
|
north: bool = [false, true],
|
||||||
south: bool = [false, true],
|
south: bool = [false, true],
|
||||||
east: bool = [false, true],
|
east: bool = [false, true],
|
||||||
west: bool = [false, true],
|
west: bool = [false, true],
|
||||||
up: bool = [false, true],
|
|
||||||
variant: CobblestoneWallVariant = [
|
variant: CobblestoneWallVariant = [
|
||||||
CobblestoneWallVariant::Normal,
|
CobblestoneWallVariant::Normal,
|
||||||
CobblestoneWallVariant::Mossy
|
CobblestoneWallVariant::Mossy
|
||||||
|
@ -3164,7 +3213,23 @@ define_blocks! {
|
||||||
force_shade: false,
|
force_shade: false,
|
||||||
transparent: false,
|
transparent: false,
|
||||||
},
|
},
|
||||||
model { ("minecraft", "cobblestone_wall") },
|
model { ("minecraft", format!("{}_wall", variant.as_string())) },
|
||||||
|
update_state (world, x, y, z) => Block::CobblestoneWall {
|
||||||
|
up: can_connect(world, x, y, z, Direction::Up),
|
||||||
|
north: can_connect(world, x, y, z, Direction::North),
|
||||||
|
south: can_connect(world, x, y, z, Direction::South),
|
||||||
|
east: can_connect(world, x, y, z, Direction::East),
|
||||||
|
west: can_connect(world, x, y, z, Direction::West),
|
||||||
|
variant: variant,
|
||||||
|
},
|
||||||
|
multipart (key, val) => match key {
|
||||||
|
"up" => up == (val == "up"),
|
||||||
|
"north" => north == (val == "true"),
|
||||||
|
"south" => south == (val == "true"),
|
||||||
|
"east" => east == (val == "true"),
|
||||||
|
"west" => west == (val == "true"),
|
||||||
|
_ => false,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
FlowerPot {
|
FlowerPot {
|
||||||
props {
|
props {
|
||||||
|
@ -4178,10 +4243,10 @@ define_blocks! {
|
||||||
SpruceFenceGate {
|
SpruceFenceGate {
|
||||||
props {
|
props {
|
||||||
facing: Direction = [
|
facing: Direction = [
|
||||||
Direction::North,
|
|
||||||
Direction::South,
|
Direction::South,
|
||||||
Direction::East,
|
Direction::West,
|
||||||
Direction::West
|
Direction::North,
|
||||||
|
Direction::East
|
||||||
],
|
],
|
||||||
in_wall: bool = [false, true],
|
in_wall: bool = [false, true],
|
||||||
open: bool = [false, true],
|
open: bool = [false, true],
|
||||||
|
@ -4196,15 +4261,15 @@ define_blocks! {
|
||||||
transparent: false,
|
transparent: false,
|
||||||
},
|
},
|
||||||
model { ("minecraft", "spruce_fence_gate") },
|
model { ("minecraft", "spruce_fence_gate") },
|
||||||
variant format!("facing={},in_wall={},open={},powered={}", facing.as_string(), in_wall, open, powered),
|
variant format!("facing={},in_wall={},open={}", facing.as_string(), in_wall, open),
|
||||||
}
|
}
|
||||||
BirchFenceGate {
|
BirchFenceGate {
|
||||||
props {
|
props {
|
||||||
facing: Direction = [
|
facing: Direction = [
|
||||||
Direction::North,
|
|
||||||
Direction::South,
|
Direction::South,
|
||||||
Direction::East,
|
Direction::West,
|
||||||
Direction::West
|
Direction::North,
|
||||||
|
Direction::East
|
||||||
],
|
],
|
||||||
in_wall: bool = [false, true],
|
in_wall: bool = [false, true],
|
||||||
open: bool = [false, true],
|
open: bool = [false, true],
|
||||||
|
@ -4219,15 +4284,15 @@ define_blocks! {
|
||||||
transparent: false,
|
transparent: false,
|
||||||
},
|
},
|
||||||
model { ("minecraft", "birch_fence_gate") },
|
model { ("minecraft", "birch_fence_gate") },
|
||||||
variant format!("facing={},in_wall={},open={},powered={}", facing.as_string(), in_wall, open, powered),
|
variant format!("facing={},in_wall={},open={}", facing.as_string(), in_wall, open),
|
||||||
}
|
}
|
||||||
JungleFenceGate {
|
JungleFenceGate {
|
||||||
props {
|
props {
|
||||||
facing: Direction = [
|
facing: Direction = [
|
||||||
Direction::North,
|
|
||||||
Direction::South,
|
Direction::South,
|
||||||
Direction::East,
|
Direction::West,
|
||||||
Direction::West
|
Direction::North,
|
||||||
|
Direction::East
|
||||||
],
|
],
|
||||||
in_wall: bool = [false, true],
|
in_wall: bool = [false, true],
|
||||||
open: bool = [false, true],
|
open: bool = [false, true],
|
||||||
|
@ -4242,15 +4307,15 @@ define_blocks! {
|
||||||
transparent: false,
|
transparent: false,
|
||||||
},
|
},
|
||||||
model { ("minecraft", "jungle_fence_gate") },
|
model { ("minecraft", "jungle_fence_gate") },
|
||||||
variant format!("facing={},in_wall={},open={},powered={}", facing.as_string(), in_wall, open, powered),
|
variant format!("facing={},in_wall={},open={}", facing.as_string(), in_wall, open),
|
||||||
}
|
}
|
||||||
DarkOakFenceGate {
|
DarkOakFenceGate {
|
||||||
props {
|
props {
|
||||||
facing: Direction = [
|
facing: Direction = [
|
||||||
Direction::North,
|
|
||||||
Direction::South,
|
Direction::South,
|
||||||
Direction::East,
|
Direction::West,
|
||||||
Direction::West
|
Direction::North,
|
||||||
|
Direction::East
|
||||||
],
|
],
|
||||||
in_wall: bool = [false, true],
|
in_wall: bool = [false, true],
|
||||||
open: bool = [false, true],
|
open: bool = [false, true],
|
||||||
|
@ -4265,15 +4330,15 @@ define_blocks! {
|
||||||
transparent: false,
|
transparent: false,
|
||||||
},
|
},
|
||||||
model { ("minecraft", "dark_oak_fence_gate") },
|
model { ("minecraft", "dark_oak_fence_gate") },
|
||||||
variant format!("facing={},in_wall={},open={},powered={}", facing.as_string(), in_wall, open, powered),
|
variant format!("facing={},in_wall={},open={}", facing.as_string(), in_wall, open),
|
||||||
}
|
}
|
||||||
AcaciaFenceGate {
|
AcaciaFenceGate {
|
||||||
props {
|
props {
|
||||||
facing: Direction = [
|
facing: Direction = [
|
||||||
Direction::North,
|
|
||||||
Direction::South,
|
Direction::South,
|
||||||
Direction::East,
|
Direction::West,
|
||||||
Direction::West
|
Direction::North,
|
||||||
|
Direction::East
|
||||||
],
|
],
|
||||||
in_wall: bool = [false, true],
|
in_wall: bool = [false, true],
|
||||||
open: bool = [false, true],
|
open: bool = [false, true],
|
||||||
|
@ -4288,7 +4353,7 @@ define_blocks! {
|
||||||
transparent: false,
|
transparent: false,
|
||||||
},
|
},
|
||||||
model { ("minecraft", "acacia_fence_gate") },
|
model { ("minecraft", "acacia_fence_gate") },
|
||||||
variant format!("facing={},in_wall={},open={},powered={}", facing.as_string(), in_wall, open, powered),
|
variant format!("facing={},in_wall={},open={}", facing.as_string(), in_wall, open),
|
||||||
}
|
}
|
||||||
SpruceFence {
|
SpruceFence {
|
||||||
props {
|
props {
|
||||||
|
@ -4965,6 +5030,35 @@ fn update_double_plant_state(world: &super::World, x: i32, y: i32, z: i32, ohalf
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn update_redstone_wire_state(world: &super::World, x: i32, y: i32, z: i32) -> (RedstoneSide, RedstoneSide, RedstoneSide, RedstoneSide){
|
||||||
|
let (nx, ny, nz) = Direction::North.get_offset();
|
||||||
|
let (sx, sy, sz) = Direction::South.get_offset();
|
||||||
|
let (ex, ey, ez) = Direction::East.get_offset();
|
||||||
|
let (wx, wy, wz) = Direction::West.get_offset();
|
||||||
|
|
||||||
|
let north = match world.get_block(x + nx, y + ny, z + nz) {
|
||||||
|
RedstoneWire{..} => RedstoneSide::Side,
|
||||||
|
_ => RedstoneSide::None,
|
||||||
|
};
|
||||||
|
|
||||||
|
let south = match world.get_block(x + sx, y + sy, z + sz) {
|
||||||
|
RedstoneWire{..} => RedstoneSide::Side,
|
||||||
|
_ => RedstoneSide::None,
|
||||||
|
};
|
||||||
|
|
||||||
|
let east = match world.get_block(x + ex, y + ey, z + ez) {
|
||||||
|
RedstoneWire{..} => RedstoneSide::Side,
|
||||||
|
_ => RedstoneSide::None,
|
||||||
|
};
|
||||||
|
|
||||||
|
let west = match world.get_block(x + wx, y + wy, y + wz) {
|
||||||
|
RedstoneWire{..} => RedstoneSide::Side,
|
||||||
|
_ => RedstoneSide::None,
|
||||||
|
};
|
||||||
|
|
||||||
|
(north, south, east, west)
|
||||||
|
}
|
||||||
|
|
||||||
fn command_block_data(conditional: bool, facing: Direction) -> Option<usize> {
|
fn command_block_data(conditional: bool, facing: Direction) -> Option<usize> {
|
||||||
let data = match facing {
|
let data = match facing {
|
||||||
Direction::Down => 0,
|
Direction::Down => 0,
|
||||||
|
@ -5533,7 +5627,7 @@ impl RedstoneSide {
|
||||||
pub fn as_string(&self) -> &'static str {
|
pub fn as_string(&self) -> &'static str {
|
||||||
match *self {
|
match *self {
|
||||||
RedstoneSide::None => "none",
|
RedstoneSide::None => "none",
|
||||||
RedstoneSide::Side => "side",
|
RedstoneSide::Side => "side|up",
|
||||||
RedstoneSide::Up => "up",
|
RedstoneSide::Up => "up",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue