Skip to content

feature/block-behaviors#22

Open
MSKatKing wants to merge 14 commits intotemper-mc:masterfrom
MSKatKing:feature/block-updates
Open

feature/block-behaviors#22
MSKatKing wants to merge 14 commits intotemper-mc:masterfrom
MSKatKing:feature/block-updates

Conversation

@MSKatKing
Copy link
Copy Markdown
Contributor

Implements a compile time block behavior system.

@ReCore-sys
Copy link
Copy Markdown
Contributor

@MSKatKing the added docs are helpful, but could you add something to explain how to actually use the new stuff? Like how do we define the block behavior, how would we use the new block behavior once we've defined it, how do we get block properties, etc.

}

/// Returns the translation vector that will get the block that touches this face.
pub fn translation_vec(&self) -> IVec3 {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename to get_normal()

fn decode<R: Read>(reader: &mut R, opts: &NetDecodeOpts) -> Result<Self, NetDecodeError> {
let VarInt(data) = VarInt::decode(reader, opts)?;

match data {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, but it'd probably better to use the enum denominator instead of hardcoding the ids in two places

for (block_pos, block_state) in placed_blocks.blocks {
let placed_blocks = vec![(offset_pos, block_state)];

// let placed_blocks = block_placing::place_item(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-draft PRs shouldn't contain commented-out code in my oppinion

@@ -0,0 +1,14 @@
[package]
name = "temper-block-properties"
version = "0.1.0"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't there a mechanism for workspace cargo.tomls to supply a default version property to all workspace members? same for edition I think

use temper_macros::match_block;

impl BlockBehavior for SlabBlock {
#[inline(always)]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pretty much never manually specify always inline. compiler will do anyways when smart, and especially in this context, not worth it at all

impl BlockStateProperty for i32 {}
impl BlockStateProperty for bool {}

/// Helper macro to implement enum property types. The syntax is simple:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove the "The syntax is simple:"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants