chore: move to crates folder

This commit is contained in:
Alexander Medvedev committed 2026-08-06 12:56:40 +02:00
1 parent 5d10c0d8a8
commit cb3660bcd2
3393 files changed
+1270 -741

No files matched your search

@@ -0,0 +1,35 @@
use pumpkin_data::Block;
use pumpkin_util::{math::position::BlockPos, random::RandomGenerator};
use crate::generation::proto_chunk::GenerationCache;
use crate::{
generation::block_state_provider::BlockStateProvider,
world::{BlockAccessor, WorldPortalExt},
};
pub struct SimpleBlockFeature {
pub to_place: BlockStateProvider,
pub schedule_tick: Option<bool>,
}
impl SimpleBlockFeature {
pub fn generate<T: GenerationCache>(
&self,
block_registry: &dyn WorldPortalExt,
chunk: &mut T,
random: &mut RandomGenerator,
pos: BlockPos,
) -> bool {
let state = self.to_place.get(random, pos, chunk, block_registry);
let block = Block::from_state_id(state.id);
let block_accessor: &dyn BlockAccessor = chunk;
if !block_registry.can_place_at(block, state, block_accessor, &pos) {
return false;
}
// TODO: check things..
chunk.set_block_state(&pos.0, state);
// TODO: schedule tick when needed
true
}
}