diff --git a/assets/bedrock_block_states.nbt b/assets/bedrock_block_states.nbt index 463501200..53ba0264b 100644 Binary files a/assets/bedrock_block_states.nbt and b/assets/bedrock_block_states.nbt differ diff --git a/pumpkin-data/build/enchantments.rs b/pumpkin-data/build/enchantments.rs index d6a0b2a8c..d75fe0aa6 100644 --- a/pumpkin-data/build/enchantments.rs +++ b/pumpkin-data/build/enchantments.rs @@ -234,7 +234,7 @@ pub(crate) fn build() -> TokenStream { } pub fn get_fullname(&self, level: i32) -> TextComponent { let mut ret = TextComponent::translate(self.description, []).color_named( - if self.is_tagged_with_by_tag(&EnchantmentTag::MINECRAFT_CURSE) { + if self.has_tag(&EnchantmentTag::MINECRAFT_CURSE) { NamedColor::Red } else { NamedColor::Gray diff --git a/pumpkin-data/build/tag.rs b/pumpkin-data/build/tag.rs index 97233c78c..d704215c0 100644 --- a/pumpkin-data/build/tag.rs +++ b/pumpkin-data/build/tag.rs @@ -233,7 +233,7 @@ pub(crate) fn build() -> TokenStream { Some(items.contains(&self.registry_id())) } - fn is_tagged_with_by_tag(&self, tag: &'static Tag) -> bool { + fn has_tag(&self, tag: &'static Tag) -> bool { tag.1.contains(&self.registry_id()) } diff --git a/pumpkin-inventory/src/crafting/crafting_screen_handler.rs b/pumpkin-inventory/src/crafting/crafting_screen_handler.rs index 34c617430..c7ffc4914 100644 --- a/pumpkin-inventory/src/crafting/crafting_screen_handler.rs +++ b/pumpkin-inventory/src/crafting/crafting_screen_handler.rs @@ -216,7 +216,7 @@ async fn recipe_matches<'a>( if slot.is_empty() || !slot .item - .is_tagged_with_by_tag(&tag::Item::MINECRAFT_DECORATED_POT_INGREDIENTS) + .has_tag(&tag::Item::MINECRAFT_DECORATED_POT_INGREDIENTS) { return None; } diff --git a/pumpkin-world/src/block/entities/hopper.rs b/pumpkin-world/src/block/entities/hopper.rs index 6f239574b..b2553dca8 100644 --- a/pumpkin-world/src/block/entities/hopper.rs +++ b/pumpkin-world/src/block/entities/hopper.rs @@ -185,9 +185,7 @@ impl HopperBlockEntity { return false; } let (block, state) = world.get_block_and_state(pos_up).await; - if !(state.is_solid() - && block.is_tagged_with_by_tag(&tag::Block::MINECRAFT_DOES_NOT_BLOCK_HOPPERS)) - { + if !(state.is_solid() && block.has_tag(&tag::Block::MINECRAFT_DOES_NOT_BLOCK_HOPPERS)) { // TODO getItemsAtAndAbove(level, hopper) return false; } diff --git a/pumpkin-world/src/chunk/mod.rs b/pumpkin-world/src/chunk/mod.rs index b43cf4cf3..393ad194c 100644 --- a/pumpkin-world/src/chunk/mod.rs +++ b/pumpkin-world/src/chunk/mod.rs @@ -523,7 +523,7 @@ impl ChunkData { if !has_found[ChunkHeightmapType::MotionBlockingNoLeaves as usize] && is_motion_blocking - && !block.is_tagged_with_by_tag(&MINECRAFT_LEAVES) + && !block.has_tag(&MINECRAFT_LEAVES) { heightmaps.set( ChunkHeightmapType::MotionBlockingNoLeaves, diff --git a/pumpkin-world/src/generation/feature/features/bamboo.rs b/pumpkin-world/src/generation/feature/features/bamboo.rs index 471f3a1ad..da3d3ba74 100644 --- a/pumpkin-world/src/generation/feature/features/bamboo.rs +++ b/pumpkin-world/src/generation/feature/features/bamboo.rs @@ -44,10 +44,7 @@ impl BambooFeature { z, ); let block = GenerationCache::get_block_state(chunk, &block_below.0); - if !block - .to_block() - .is_tagged_with_by_tag(&tag::Block::MINECRAFT_DIRT) - { + if !block.to_block().has_tag(&tag::Block::MINECRAFT_DIRT) { continue; } chunk.set_block_state(&block_below.0, Block::PODZOL.default_state); diff --git a/pumpkin-world/src/generation/feature/features/coral/mod.rs b/pumpkin-world/src/generation/feature/features/coral/mod.rs index c28597f50..107fcd5c3 100644 --- a/pumpkin-world/src/generation/feature/features/coral/mod.rs +++ b/pumpkin-world/src/generation/feature/features/coral/mod.rs @@ -26,7 +26,7 @@ impl CoralFeature { let block = GenerationCache::get_block_state(chunk, &pos.0).to_block(); let above_block = GenerationCache::get_block_state(chunk, &pos.up().0).to_block(); - if block != &Block::WATER && !block.is_tagged_with_by_tag(&tag::Block::MINECRAFT_CORALS) + if block != &Block::WATER && !block.has_tag(&tag::Block::MINECRAFT_CORALS) || above_block != &Block::WATER { return false; diff --git a/pumpkin-world/src/generation/feature/features/drip_stone/mod.rs b/pumpkin-world/src/generation/feature/features/drip_stone/mod.rs index 521624dc7..92f94c605 100644 --- a/pumpkin-world/src/generation/feature/features/drip_stone/mod.rs +++ b/pumpkin-world/src/generation/feature/features/drip_stone/mod.rs @@ -9,12 +9,12 @@ pub mod small; pub(super) fn can_replace(block: &Block) -> bool { block == &Block::DRIPSTONE_BLOCK - || block.is_tagged_with_by_tag(&tag::Block::MINECRAFT_DRIPSTONE_REPLACEABLE_BLOCKS) + || block.has_tag(&tag::Block::MINECRAFT_DRIPSTONE_REPLACEABLE_BLOCKS) } pub(super) fn gen_dripstone(chunk: &mut T, pos: BlockPos) -> bool { let block = GenerationCache::get_block_state(chunk, &pos.0).to_block(); - if block.is_tagged_with_by_tag(&tag::Block::MINECRAFT_DRIPSTONE_REPLACEABLE_BLOCKS) { + if block.has_tag(&tag::Block::MINECRAFT_DRIPSTONE_REPLACEABLE_BLOCKS) { chunk.set_block_state(&pos.0, Block::DRIPSTONE_BLOCK.default_state); return true; } diff --git a/pumpkin-world/src/generation/feature/features/nether_forest_vegetation.rs b/pumpkin-world/src/generation/feature/features/nether_forest_vegetation.rs index e60e802ea..3b2a1e439 100644 --- a/pumpkin-world/src/generation/feature/features/nether_forest_vegetation.rs +++ b/pumpkin-world/src/generation/feature/features/nether_forest_vegetation.rs @@ -29,10 +29,7 @@ impl NetherForestVegetationFeature { ) -> bool { let state = GenerationCache::get_block_state(chunk, &pos.down().0); - if !state - .to_block() - .is_tagged_with_by_tag(&tag::Block::MINECRAFT_NYLIUM) - { + if !state.to_block().has_tag(&tag::Block::MINECRAFT_NYLIUM) { return false; } let mut result = false; diff --git a/pumpkin-world/src/generation/feature/features/tree/mod.rs b/pumpkin-world/src/generation/feature/features/tree/mod.rs index 3150ae761..65c65300e 100644 --- a/pumpkin-world/src/generation/feature/features/tree/mod.rs +++ b/pumpkin-world/src/generation/feature/features/tree/mod.rs @@ -52,15 +52,15 @@ impl TreeFeature { } pub fn can_replace_or_log(state: &BlockState, block: &Block) -> bool { - Self::can_replace(state, block) || block.is_tagged_with_by_tag(&tag::Block::MINECRAFT_LOGS) + Self::can_replace(state, block) || block.has_tag(&tag::Block::MINECRAFT_LOGS) } pub fn is_air_or_leaves(state: &BlockState, block: &Block) -> bool { - state.is_air() || block.is_tagged_with_by_tag(&tag::Block::MINECRAFT_LEAVES) + state.is_air() || block.has_tag(&tag::Block::MINECRAFT_LEAVES) } pub fn can_replace(state: &BlockState, block: &Block) -> bool { - state.is_air() || block.is_tagged_with_by_tag(&tag::Block::MINECRAFT_REPLACEABLE_BY_TREES) + state.is_air() || block.has_tag(&tag::Block::MINECRAFT_REPLACEABLE_BY_TREES) } fn generate_main( diff --git a/pumpkin-world/src/generation/feature/features/tree/trunk/mod.rs b/pumpkin-world/src/generation/feature/features/tree/trunk/mod.rs index 8b669c864..73f70e468 100644 --- a/pumpkin-world/src/generation/feature/features/tree/trunk/mod.rs +++ b/pumpkin-world/src/generation/feature/features/tree/trunk/mod.rs @@ -51,7 +51,7 @@ impl TrunkPlacer { ) { let block = GenerationCache::get_block_state(chunk, &pos.0).to_block(); if force_dirt - || !(block.is_tagged_with_by_tag(&tag::Block::MINECRAFT_DIRT) + || !(block.has_tag(&tag::Block::MINECRAFT_DIRT) && block != &Block::GRASS_BLOCK && block != &Block::MYCELIUM) { diff --git a/pumpkin-world/src/generation/proto_chunk.rs b/pumpkin-world/src/generation/proto_chunk.rs index 383d8dc4f..f890faaaa 100644 --- a/pumpkin-world/src/generation/proto_chunk.rs +++ b/pumpkin-world/src/generation/proto_chunk.rs @@ -454,7 +454,7 @@ impl ProtoChunk { if blocks_movement(block_state) || block_state.is_liquid() { self.maybe_update_motion_blocking_height_map(pos); let block = Block::from_state_id(block_state.id); - if !block.is_tagged_with_by_tag(&tag::Block::MINECRAFT_LEAVES) { + if !block.has_tag(&tag::Block::MINECRAFT_LEAVES) { { self.maybe_update_motion_blocking_no_leaves_height_map(pos); } diff --git a/pumpkin-world/src/item/categories.rs b/pumpkin-world/src/item/categories.rs index c8d8a004a..e15279af5 100644 --- a/pumpkin-world/src/item/categories.rs +++ b/pumpkin-world/src/item/categories.rs @@ -6,37 +6,31 @@ use crate::item::ItemStack; impl ItemStack { #[inline] pub fn is_sword(&self) -> bool { - self.item - .is_tagged_with_by_tag(&tag::Item::MINECRAFT_SWORDS) + self.item.has_tag(&tag::Item::MINECRAFT_SWORDS) } #[inline] pub fn is_helmet(&self) -> bool { - self.item - .is_tagged_with_by_tag(&tag::Item::MINECRAFT_HEAD_ARMOR) + self.item.has_tag(&tag::Item::MINECRAFT_HEAD_ARMOR) } #[inline] pub fn is_skull(&self) -> bool { - self.item - .is_tagged_with_by_tag(&tag::Item::MINECRAFT_SKULLS) + self.item.has_tag(&tag::Item::MINECRAFT_SKULLS) } #[inline] pub fn is_chestplate(&self) -> bool { - self.item - .is_tagged_with_by_tag(&tag::Item::MINECRAFT_CHEST_ARMOR) + self.item.has_tag(&tag::Item::MINECRAFT_CHEST_ARMOR) } #[inline] pub fn is_leggings(&self) -> bool { - self.item - .is_tagged_with_by_tag(&tag::Item::MINECRAFT_LEG_ARMOR) + self.item.has_tag(&tag::Item::MINECRAFT_LEG_ARMOR) } #[inline] pub fn is_boots(&self) -> bool { - self.item - .is_tagged_with_by_tag(&tag::Item::MINECRAFT_FOOT_ARMOR) + self.item.has_tag(&tag::Item::MINECRAFT_FOOT_ARMOR) } } diff --git a/pumpkin-world/src/item/mod.rs b/pumpkin-world/src/item/mod.rs index 7a4d0182a..d6f8911c4 100644 --- a/pumpkin-world/src/item/mod.rs +++ b/pumpkin-world/src/item/mod.rs @@ -243,7 +243,7 @@ impl ItemStack { }; match &rule.blocks { IDSet::Tag(tag) => { - if block.is_tagged_with_by_tag(tag) { + if block.has_tag(tag) { return speed; } } @@ -271,7 +271,7 @@ impl ItemStack { }; match &rule.blocks { IDSet::Tag(tag) => { - if block.is_tagged_with_by_tag(tag) { + if block.has_tag(tag) { return correct; } } diff --git a/pumpkin-world/src/lib.rs b/pumpkin-world/src/lib.rs index ce860cc27..81db633da 100644 --- a/pumpkin-world/src/lib.rs +++ b/pumpkin-world/src/lib.rs @@ -24,7 +24,7 @@ pub type BlockId = u16; pub type BlockStateId = u16; pub const CURRENT_MC_VERSION: &str = "1.21.9"; -pub const CURRENT_BEDROCK_MC_VERSION: &str = "1.21.100"; +pub const CURRENT_BEDROCK_MC_VERSION: &str = "1.21.111"; #[macro_export] macro_rules! global_path { diff --git a/pumpkin/src/block/blocks/bamboo.rs b/pumpkin/src/block/blocks/bamboo.rs index 46402672d..e5b2fb5bb 100644 --- a/pumpkin/src/block/blocks/bamboo.rs +++ b/pumpkin/src/block/blocks/bamboo.rs @@ -12,6 +12,6 @@ pub struct BambooBlock; impl BlockBehaviour for BambooBlock { async fn can_place_at(&self, args: CanPlaceAtArgs<'_>) -> bool { let block_below = args.block_accessor.get_block(&args.position.down()).await; - block_below.is_tagged_with_by_tag(&tag::Block::MINECRAFT_BAMBOO_PLANTABLE_ON) + block_below.has_tag(&tag::Block::MINECRAFT_BAMBOO_PLANTABLE_ON) } } diff --git a/pumpkin/src/block/blocks/cactus.rs b/pumpkin/src/block/blocks/cactus.rs index ed441f6d9..fddd52f3c 100644 --- a/pumpkin/src/block/blocks/cactus.rs +++ b/pumpkin/src/block/blocks/cactus.rs @@ -103,6 +103,6 @@ async fn can_place_at(world: &dyn BlockAccessor, block_pos: &BlockPos) -> bool { } let block = world.get_block(&block_pos.down()).await; // TODO: use tags - (block == &Block::CACTUS || block.is_tagged_with_by_tag(&tag::Block::MINECRAFT_SAND)) + (block == &Block::CACTUS || block.has_tag(&tag::Block::MINECRAFT_SAND)) && !world.get_block_state(&block_pos.up()).await.is_liquid() } diff --git a/pumpkin/src/block/blocks/chiseled_bookshelf.rs b/pumpkin/src/block/blocks/chiseled_bookshelf.rs index fac76de26..b39ce60ef 100644 --- a/pumpkin/src/block/blocks/chiseled_bookshelf.rs +++ b/pumpkin/src/block/blocks/chiseled_bookshelf.rs @@ -80,7 +80,7 @@ impl BlockBehaviour for ChiseledBookshelfBlock { .lock() .await .get_item() - .is_tagged_with_by_tag(&tag::Item::MINECRAFT_BOOKSHELF_BOOKS) + .has_tag(&tag::Item::MINECRAFT_BOOKSHELF_BOOKS) { return BlockActionResult::PassToDefaultBlockAction; } diff --git a/pumpkin/src/block/blocks/doors.rs b/pumpkin/src/block/blocks/doors.rs index afa517783..bfa42cbce 100644 --- a/pumpkin/src/block/blocks/doors.rs +++ b/pumpkin/src/block/blocks/doors.rs @@ -86,14 +86,14 @@ fn can_open_door(block: &Block) -> bool { // Todo: The sounds should be from BlockSetType fn get_sound(block: &Block, open: bool) -> Sound { if open { - if block.is_tagged_with_by_tag(&tag::Block::MINECRAFT_WOODEN_DOORS) { + if block.has_tag(&tag::Block::MINECRAFT_WOODEN_DOORS) { Sound::BlockWoodenDoorOpen } else if block == &Block::IRON_DOOR { Sound::BlockIronDoorOpen } else { Sound::BlockCopperDoorOpen } - } else if block.is_tagged_with_by_tag(&tag::Block::MINECRAFT_WOODEN_DOORS) { + } else if block.has_tag(&tag::Block::MINECRAFT_WOODEN_DOORS) { Sound::BlockWoodenDoorClose } else if block == &Block::IRON_DOOR { Sound::BlockIronDoorClose @@ -125,13 +125,13 @@ async fn get_hinge( let has_left_door = world .get_block(&left_pos) .await - .is_tagged_with_by_tag(&tag::Block::MINECRAFT_DOORS) + .has_tag(&tag::Block::MINECRAFT_DOORS) && DoorProperties::from_state_id(left_state.id, left_block).half == DoubleBlockHalf::Lower; let has_right_door = world .get_block(&right_pos) .await - .is_tagged_with_by_tag(&tag::Block::MINECRAFT_DOORS) + .has_tag(&tag::Block::MINECRAFT_DOORS) && DoorProperties::from_state_id(right_state.id, right_block).half == DoubleBlockHalf::Lower; diff --git a/pumpkin/src/block/blocks/falling.rs b/pumpkin/src/block/blocks/falling.rs index e08ed3400..6f0c9f414 100644 --- a/pumpkin/src/block/blocks/falling.rs +++ b/pumpkin/src/block/blocks/falling.rs @@ -17,7 +17,7 @@ impl FallingBlock { #[must_use] pub fn can_fall_through(state: &BlockState, block: &Block) -> bool { state.is_air() - || block.is_tagged_with_by_tag(&tag::Block::MINECRAFT_FIRE) + || block.has_tag(&tag::Block::MINECRAFT_FIRE) || state.is_liquid() || state.replaceable() } diff --git a/pumpkin/src/block/blocks/farmland.rs b/pumpkin/src/block/blocks/farmland.rs index 3f9cd3d0f..9547ee328 100644 --- a/pumpkin/src/block/blocks/farmland.rs +++ b/pumpkin/src/block/blocks/farmland.rs @@ -85,7 +85,7 @@ impl BlockBehaviour for FarmlandBlock { .world .get_block(&args.position.up()) .await - .is_tagged_with_by_tag(&tag::Block::MINECRAFT_MAINTAINS_FARMLAND) + .has_tag(&tag::Block::MINECRAFT_MAINTAINS_FARMLAND) { //TODO push entities up args.world diff --git a/pumpkin/src/block/blocks/fence_gates.rs b/pumpkin/src/block/blocks/fence_gates.rs index 96033f2eb..36152bd96 100644 --- a/pumpkin/src/block/blocks/fence_gates.rs +++ b/pumpkin/src/block/blocks/fence_gates.rs @@ -98,8 +98,8 @@ async fn is_in_wall(args: &GetStateForNeighborUpdateArgs<'_>) -> FenceGateProper let neighbor_right = args.world.get_block(&side_offset_right).await; let neighbor_left = args.world.get_block(&side_offset_left).await; - fence_props.in_wall = neighbor_left.is_tagged_with_by_tag(&tag::Block::MINECRAFT_WALLS) - || neighbor_right.is_tagged_with_by_tag(&tag::Block::MINECRAFT_WALLS); + fence_props.in_wall = neighbor_left.has_tag(&tag::Block::MINECRAFT_WALLS) + || neighbor_right.has_tag(&tag::Block::MINECRAFT_WALLS); } fence_props diff --git a/pumpkin/src/block/blocks/fences.rs b/pumpkin/src/block/blocks/fences.rs index 1645a8160..ad7ac63e2 100644 --- a/pumpkin/src/block/blocks/fences.rs +++ b/pumpkin/src/block/blocks/fences.rs @@ -78,7 +78,7 @@ fn connects_to(from: &Block, to: &Block, to_state: &BlockState, direction: Block return true; } - if to.is_tagged_with_by_tag(&tag::Block::C_FENCE_GATES) { + if to.has_tag(&tag::Block::C_FENCE_GATES) { let fence_gate_props = FenceGateProperties::from_state_id(to_state.id, to); if BlockDirection::from_cardinal_direction(fence_gate_props.facing).to_axis() == direction.rotate_clockwise().to_axis() @@ -87,5 +87,5 @@ fn connects_to(from: &Block, to: &Block, to_state: &BlockState, direction: Block } } - *from != Block::NETHER_BRICK_FENCE && to.is_tagged_with_by_tag(&tag::Block::C_FENCES_WOODEN) + *from != Block::NETHER_BRICK_FENCE && to.has_tag(&tag::Block::C_FENCES_WOODEN) } diff --git a/pumpkin/src/block/blocks/fire/mod.rs b/pumpkin/src/block/blocks/fire/mod.rs index d731513a0..1a4b72fe6 100644 --- a/pumpkin/src/block/blocks/fire/mod.rs +++ b/pumpkin/src/block/blocks/fire/mod.rs @@ -41,7 +41,7 @@ impl FireBlockBase { pub async fn is_soul_fire(world: &Arc, block_pos: &BlockPos) -> bool { let block = world.get_block(&block_pos.down()).await; - block.is_tagged_with_by_tag(&tag::Block::MINECRAFT_SOUL_FIRE_BASE_BLOCKS) + block.has_tag(&tag::Block::MINECRAFT_SOUL_FIRE_BASE_BLOCKS) } pub async fn can_place_at(world: &Arc, block_pos: &BlockPos) -> bool { diff --git a/pumpkin/src/block/blocks/fire/soul_fire.rs b/pumpkin/src/block/blocks/fire/soul_fire.rs index 986e5e1bc..697446390 100644 --- a/pumpkin/src/block/blocks/fire/soul_fire.rs +++ b/pumpkin/src/block/blocks/fire/soul_fire.rs @@ -14,7 +14,7 @@ pub struct SoulFireBlock; impl SoulFireBlock { #[must_use] pub fn is_soul_base(block: &Block) -> bool { - block.is_tagged_with_by_tag(&tag::Block::MINECRAFT_SOUL_FIRE_BASE_BLOCKS) + block.has_tag(&tag::Block::MINECRAFT_SOUL_FIRE_BASE_BLOCKS) } } diff --git a/pumpkin/src/block/blocks/glass_panes.rs b/pumpkin/src/block/blocks/glass_panes.rs index 74560ccd3..e733b6ee5 100644 --- a/pumpkin/src/block/blocks/glass_panes.rs +++ b/pumpkin/src/block/blocks/glass_panes.rs @@ -56,9 +56,9 @@ pub async fn compute_pane_state( let connected = other_block == block || other_block_state.is_side_solid(direction.opposite()) - || other_block.is_tagged_with_by_tag(&tag::Block::C_GLASS_PANES) + || other_block.has_tag(&tag::Block::C_GLASS_PANES) || other_block == &Block::IRON_BARS - || other_block.is_tagged_with_by_tag(&tag::Block::MINECRAFT_WALLS); + || other_block.has_tag(&tag::Block::MINECRAFT_WALLS); match direction { BlockDirection::North => pane_props.north = connected, diff --git a/pumpkin/src/block/blocks/iron_bars.rs b/pumpkin/src/block/blocks/iron_bars.rs index 6421eb07a..8bc64c01a 100644 --- a/pumpkin/src/block/blocks/iron_bars.rs +++ b/pumpkin/src/block/blocks/iron_bars.rs @@ -47,8 +47,8 @@ pub async fn compute_bars_state( let connected = other_block == block || other_block_state.is_side_solid(direction.opposite()) - || other_block.is_tagged_with_by_tag(&tag::Block::C_GLASS_PANES) - || other_block.is_tagged_with_by_tag(&tag::Block::MINECRAFT_WALLS); + || other_block.has_tag(&tag::Block::C_GLASS_PANES) + || other_block.has_tag(&tag::Block::MINECRAFT_WALLS); match direction { BlockDirection::North => bars_props.north = connected, diff --git a/pumpkin/src/block/blocks/lanterns.rs b/pumpkin/src/block/blocks/lanterns.rs index efb431df3..0aaa144eb 100644 --- a/pumpkin/src/block/blocks/lanterns.rs +++ b/pumpkin/src/block/blocks/lanterns.rs @@ -68,7 +68,7 @@ async fn can_place_at(world: &World, position: &BlockPos) -> bool { if world .get_block(&position.down()) .await - .is_tagged_with_by_tag(&tag::Block::C_FENCE_GATES) + .has_tag(&tag::Block::C_FENCE_GATES) { let fence_gate_props = pumpkin_data::block_properties::OakFenceGateLikeProperties::from_state_id( @@ -84,5 +84,5 @@ async fn can_place_at(world: &World, position: &BlockPos) -> bool { let block_up_state = world.get_block_state(&position.up()).await; block_down_state.is_center_solid(BlockDirection::Up) || block_up_state.is_center_solid(BlockDirection::Down) - || block_down.is_tagged_with_by_tag(&tag::Block::MINECRAFT_UNSTABLE_BOTTOM_CENTER) + || block_down.has_tag(&tag::Block::MINECRAFT_UNSTABLE_BOTTOM_CENTER) } diff --git a/pumpkin/src/block/blocks/plant/crop/gourds/stem.rs b/pumpkin/src/block/blocks/plant/crop/gourds/stem.rs index a356bfcb3..5045e193e 100644 --- a/pumpkin/src/block/blocks/plant/crop/gourds/stem.rs +++ b/pumpkin/src/block/blocks/plant/crop/gourds/stem.rs @@ -106,7 +106,7 @@ impl BlockBehaviour for StemBlock { let under_block: &Block = args.world.get_block(&plant_block_pos.down()).await; if plant_block_state.is_air() && (under_block == &Block::FARMLAND - || under_block.is_tagged_with_by_tag(&tag::Block::MINECRAFT_DIRT)) + || under_block.has_tag(&tag::Block::MINECRAFT_DIRT)) { let attached_stem = Self::get_attached_stem(dir, block); let gourd = Self::get_gourd(block); diff --git a/pumpkin/src/block/blocks/plant/dry_vegetation.rs b/pumpkin/src/block/blocks/plant/dry_vegetation.rs index 6bb72ac6e..9b196c1bf 100644 --- a/pumpkin/src/block/blocks/plant/dry_vegetation.rs +++ b/pumpkin/src/block/blocks/plant/dry_vegetation.rs @@ -48,6 +48,6 @@ impl PlantBlockBase for DryVegetationBlock { block_pos: &BlockPos, ) -> bool { let block_below = block_accessor.get_block(block_pos).await; - block_below.is_tagged_with_by_tag(&tag::Block::MINECRAFT_DRY_VEGETATION_MAY_PLACE_ON) + block_below.has_tag(&tag::Block::MINECRAFT_DRY_VEGETATION_MAY_PLACE_ON) } } diff --git a/pumpkin/src/block/blocks/plant/flowerbed.rs b/pumpkin/src/block/blocks/plant/flowerbed.rs index cbfb43147..3fb5491d1 100644 --- a/pumpkin/src/block/blocks/plant/flowerbed.rs +++ b/pumpkin/src/block/blocks/plant/flowerbed.rs @@ -30,8 +30,7 @@ impl BlockMetadata for FlowerbedBlock { impl BlockBehaviour for FlowerbedBlock { async fn can_place_at(&self, args: CanPlaceAtArgs<'_>) -> bool { let block_below = args.block_accessor.get_block(&args.position.down()).await; - block_below.is_tagged_with_by_tag(&tag::Block::MINECRAFT_DIRT) - || block_below == &Block::FARMLAND + block_below.has_tag(&tag::Block::MINECRAFT_DIRT) || block_below == &Block::FARMLAND } async fn can_update_at(&self, args: CanUpdateAtArgs<'_>) -> bool { diff --git a/pumpkin/src/block/blocks/plant/mod.rs b/pumpkin/src/block/blocks/plant/mod.rs index 4b7fa34c7..df243d51c 100644 --- a/pumpkin/src/block/blocks/plant/mod.rs +++ b/pumpkin/src/block/blocks/plant/mod.rs @@ -22,7 +22,7 @@ pub mod tall_plant; trait PlantBlockBase { async fn can_plant_on_top(&self, block_accessor: &dyn BlockAccessor, pos: &BlockPos) -> bool { let block = block_accessor.get_block(pos).await; - block.is_tagged_with_by_tag(&tag::Block::MINECRAFT_DIRT) || block == &Block::FARMLAND + block.has_tag(&tag::Block::MINECRAFT_DIRT) || block == &Block::FARMLAND } async fn get_state_for_neighbor_update( diff --git a/pumpkin/src/block/blocks/plant/mushroom_plant.rs b/pumpkin/src/block/blocks/plant/mushroom_plant.rs index f5eaf0a1b..e664f69bb 100644 --- a/pumpkin/src/block/blocks/plant/mushroom_plant.rs +++ b/pumpkin/src/block/blocks/plant/mushroom_plant.rs @@ -44,7 +44,7 @@ impl BlockBehaviour for MushroomPlantBlock { impl PlantBlockBase for MushroomPlantBlock { async fn can_plant_on_top(&self, block_accessor: &dyn BlockAccessor, pos: &BlockPos) -> bool { let block = block_accessor.get_block(pos).await; - block.is_tagged_with_by_tag(&tag::Block::MINECRAFT_MUSHROOM_GROW_BLOCK) + block.has_tag(&tag::Block::MINECRAFT_MUSHROOM_GROW_BLOCK) // TODO: Check light level and isOpaqueFullCube } } diff --git a/pumpkin/src/block/blocks/plant/roots.rs b/pumpkin/src/block/blocks/plant/roots.rs index c7601c6a8..022c44b57 100644 --- a/pumpkin/src/block/blocks/plant/roots.rs +++ b/pumpkin/src/block/blocks/plant/roots.rs @@ -44,9 +44,9 @@ impl BlockBehaviour for RootsBlock { impl PlantBlockBase for RootsBlock { async fn can_plant_on_top(&self, block_accessor: &dyn BlockAccessor, pos: &BlockPos) -> bool { let block_below = block_accessor.get_block(pos).await; - block_below.is_tagged_with_by_tag(&tag::Block::MINECRAFT_NYLIUM) + block_below.has_tag(&tag::Block::MINECRAFT_NYLIUM) || block_below == &Block::SOUL_SOIL - || block_below.is_tagged_with_by_tag(&tag::Block::MINECRAFT_DIRT) + || block_below.has_tag(&tag::Block::MINECRAFT_DIRT) || block_below == &Block::FARMLAND } diff --git a/pumpkin/src/block/blocks/plant/sea_pickles.rs b/pumpkin/src/block/blocks/plant/sea_pickles.rs index cb8293eb7..1e15a966a 100644 --- a/pumpkin/src/block/blocks/plant/sea_pickles.rs +++ b/pumpkin/src/block/blocks/plant/sea_pickles.rs @@ -32,7 +32,7 @@ impl BlockBehaviour for SeaPickleBlock { .world .get_block(&args.position.down()) .await - .is_tagged_with_by_tag(&tag::Block::MINECRAFT_CORAL_BLOCKS) + .has_tag(&tag::Block::MINECRAFT_CORAL_BLOCKS) || !SeaPickleProperties::from_state_id( args.world.get_block_state_id(args.position).await, args.block, @@ -63,7 +63,7 @@ impl BlockBehaviour for SeaPickleBlock { .world .get_block(&lv.down()) .await - .is_tagged_with_by_tag(&tag::Block::MINECRAFT_CORAL_BLOCKS) + .has_tag(&tag::Block::MINECRAFT_CORAL_BLOCKS) { continue; } diff --git a/pumpkin/src/block/blocks/redstone/rails/mod.rs b/pumpkin/src/block/blocks/redstone/rails/mod.rs index a978a3ed5..364071222 100644 --- a/pumpkin/src/block/blocks/redstone/rails/mod.rs +++ b/pumpkin/src/block/blocks/redstone/rails/mod.rs @@ -28,7 +28,7 @@ struct Rail { impl Rail { async fn find_with_elevation(world: &World, position: BlockPos) -> Option { let (block, block_state) = world.get_block_and_state_id(&position).await; - if block.is_tagged_with_by_tag(&tag::Item::MINECRAFT_RAILS) { + if block.has_tag(&tag::Item::MINECRAFT_RAILS) { let properties = RailProperties::new(block_state, block); return Some(Self { block, @@ -40,7 +40,7 @@ impl Rail { let pos = position.up(); let (block, block_state) = world.get_block_and_state_id(&pos).await; - if block.is_tagged_with_by_tag(&tag::Item::MINECRAFT_RAILS) { + if block.has_tag(&tag::Item::MINECRAFT_RAILS) { let properties = RailProperties::new(block_state, block); return Some(Self { block, @@ -52,7 +52,7 @@ impl Rail { let pos = position.down(); let (block, block_state) = world.get_block_and_state_id(&pos).await; - if block.is_tagged_with_by_tag(&tag::Item::MINECRAFT_RAILS) { + if block.has_tag(&tag::Item::MINECRAFT_RAILS) { let properties = RailProperties::new(block_state, block); return Some(Self { block, diff --git a/pumpkin/src/block/blocks/stairs.rs b/pumpkin/src/block/blocks/stairs.rs index 2b8fc0330..8b8a06fbc 100644 --- a/pumpkin/src/block/blocks/stairs.rs +++ b/pumpkin/src/block/blocks/stairs.rs @@ -138,6 +138,6 @@ async fn get_stair_properties_if_exists( ) -> Option { let (block, block_state) = world.get_block_and_state_id(block_pos).await; block - .is_tagged_with_by_tag(&tag::Block::MINECRAFT_STAIRS) + .has_tag(&tag::Block::MINECRAFT_STAIRS) .then(|| StairsProperties::from_state_id(block_state, block)) } diff --git a/pumpkin/src/block/blocks/sugar_cane.rs b/pumpkin/src/block/blocks/sugar_cane.rs index 745b09349..9d4b46c8d 100644 --- a/pumpkin/src/block/blocks/sugar_cane.rs +++ b/pumpkin/src/block/blocks/sugar_cane.rs @@ -92,8 +92,8 @@ async fn can_place_at(block_accessor: &dyn BlockAccessor, block_pos: &BlockPos) return true; } - if block_below.is_tagged_with_by_tag(&tag::Block::MINECRAFT_DIRT) - || block_below.is_tagged_with_by_tag(&tag::Block::MINECRAFT_SAND) + if block_below.has_tag(&tag::Block::MINECRAFT_DIRT) + || block_below.has_tag(&tag::Block::MINECRAFT_SAND) { for direction in HorizontalFacing::all() { let block = block_accessor diff --git a/pumpkin/src/block/blocks/trapdoor.rs b/pumpkin/src/block/blocks/trapdoor.rs index 1595ba3ef..8c9dd61e4 100644 --- a/pumpkin/src/block/blocks/trapdoor.rs +++ b/pumpkin/src/block/blocks/trapdoor.rs @@ -50,14 +50,14 @@ fn can_open_trapdoor(block: &Block) -> bool { // Todo: The sounds should be from BlockSetType fn get_sound(block: &Block, open: bool) -> Sound { if open { - if block.is_tagged_with_by_tag(&tag::Block::MINECRAFT_WOODEN_TRAPDOORS) { + if block.has_tag(&tag::Block::MINECRAFT_WOODEN_TRAPDOORS) { Sound::BlockWoodenTrapdoorOpen } else if block == &Block::IRON_TRAPDOOR { Sound::BlockIronTrapdoorOpen } else { Sound::BlockCopperTrapdoorOpen } - } else if block.is_tagged_with_by_tag(&tag::Block::MINECRAFT_WOODEN_TRAPDOORS) { + } else if block.has_tag(&tag::Block::MINECRAFT_WOODEN_TRAPDOORS) { Sound::BlockWoodenTrapdoorClose } else if block == &Block::IRON_TRAPDOOR { Sound::BlockIronTrapdoorClose diff --git a/pumpkin/src/block/blocks/walls.rs b/pumpkin/src/block/blocks/walls.rs index c136c6961..8e890bddd 100644 --- a/pumpkin/src/block/blocks/walls.rs +++ b/pumpkin/src/block/blocks/walls.rs @@ -61,7 +61,7 @@ pub async fn compute_wall_state( let shape = if connected { let raise = if block_above_state.is_full_cube() { true - } else if block_above.is_tagged_with_by_tag(&tag::Block::MINECRAFT_WALLS) { + } else if block_above.has_tag(&tag::Block::MINECRAFT_WALLS) { let other_props = WallProperties::from_state_id(block_above_state.id, block_above); match direction { HorizontalFacing::North => other_props.north != NorthWallShape::None, @@ -69,8 +69,8 @@ pub async fn compute_wall_state( HorizontalFacing::East => other_props.east != EastWallShape::None, HorizontalFacing::West => other_props.west != WestWallShape::None, } - } else if block_above.is_tagged_with_by_tag(&tag::Block::C_GLASS_PANES) - || block_above.is_tagged_with_by_tag(&tag::Block::MINECRAFT_FENCES) + } else if block_above.has_tag(&tag::Block::C_GLASS_PANES) + || block_above.has_tag(&tag::Block::MINECRAFT_FENCES) || block_above == &Block::IRON_BARS { let other_props = @@ -81,7 +81,7 @@ pub async fn compute_wall_state( HorizontalFacing::East => other_props.east, HorizontalFacing::West => other_props.west, } - } else if block_above.is_tagged_with_by_tag(&tag::Block::MINECRAFT_FENCE_GATES) { + } else if block_above.has_tag(&tag::Block::MINECRAFT_FENCE_GATES) { let other_props = FenceGateProperties::from_state_id(block_above_state.id, block_above); // gate is perp to connected direction @@ -124,10 +124,10 @@ pub async fn compute_wall_state( wall_props.up = if !(cross || connected_north_south || connected_east_west) { true - } else if block_above.is_tagged_with_by_tag(&tag::Block::MINECRAFT_WALLS) { + } else if block_above.has_tag(&tag::Block::MINECRAFT_WALLS) { let other_props = WallProperties::from_state_id(block_above_state.id, block_above); other_props.up - } else if block_above.is_tagged_with_by_tag(&tag::Block::MINECRAFT_FENCE_GATES) { + } else if block_above.has_tag(&tag::Block::MINECRAFT_FENCE_GATES) { let other_props = FenceGateProperties::from_state_id(block_above_state.id, block_above); if other_props.open { false @@ -154,12 +154,12 @@ fn is_connected( || other_block_state.is_side_solid(BlockDirection::from_cardinal_direction( direction.opposite(), )) - || other_block.is_tagged_with_by_tag(&tag::Block::MINECRAFT_WALLS) + || other_block.has_tag(&tag::Block::MINECRAFT_WALLS) || other_block == &Block::IRON_BARS - || other_block.is_tagged_with_by_tag(&tag::Block::C_GLASS_PANES); + || other_block.has_tag(&tag::Block::C_GLASS_PANES); // fence gates do not pass is_side_solid check - if !connected && other_block.is_tagged_with_by_tag(&tag::Block::MINECRAFT_FENCE_GATES) { + if !connected && other_block.has_tag(&tag::Block::MINECRAFT_FENCE_GATES) { let fence_props = FenceGateProperties::from_state_id(other_block_state.id, other_block); if fence_props.facing == direction.rotate_clockwise() || fence_props.facing == direction.rotate_counter_clockwise() diff --git a/pumpkin/src/entity/player.rs b/pumpkin/src/entity/player.rs index 25a0acdcf..3e99c462c 100644 --- a/pumpkin/src/entity/player.rs +++ b/pumpkin/src/entity/player.rs @@ -695,7 +695,7 @@ impl Player { let block = self.world().get_block(&respawn_point.position).await; if respawn_point.dimension == VanillaDimensionType::Overworld - && block.is_tagged_with_by_tag(&tag::Block::MINECRAFT_BEDS) + && block.has_tag(&tag::Block::MINECRAFT_BEDS) { // TODO: calculate respawn position Some((respawn_point.position.to_f64(), respawn_point.yaw)) diff --git a/pumpkin/src/item/items/axe.rs b/pumpkin/src/item/items/axe.rs index 3f9d01cb6..d857a13c1 100644 --- a/pumpkin/src/item/items/axe.rs +++ b/pumpkin/src/item/items/axe.rs @@ -39,7 +39,7 @@ impl ItemBehaviour for AxeItem { // If there is a strip equivalent. if replacement_block != 0 { let new_block = &Block::from_id(replacement_block); - let new_state_id = if block.is_tagged_with_by_tag(&tag::Block::MINECRAFT_LOGS) { + let new_state_id = if block.has_tag(&tag::Block::MINECRAFT_LOGS) { let log_information = world.get_block_state_id(&location).await; let log_props = PaleOakWoodLikeProperties::from_state_id(log_information, block); // create new properties for the new log. @@ -53,7 +53,7 @@ impl ItemBehaviour for AxeItem { new_log_properties.to_state_id(new_block) } // Let's check if It's a door - else if block.is_tagged_with_by_tag(&tag::Block::MINECRAFT_DOORS) { + else if block.has_tag(&tag::Block::MINECRAFT_DOORS) { // get block state of the old log. let door_information = world.get_block_state_id(&location).await; // get the log properties diff --git a/pumpkin/src/item/items/honeycomb.rs b/pumpkin/src/item/items/honeycomb.rs index 312ec695c..0a2a9b718 100644 --- a/pumpkin/src/item/items/honeycomb.rs +++ b/pumpkin/src/item/items/honeycomb.rs @@ -50,8 +50,8 @@ impl ItemBehaviour for HoneyCombItem { // create new properties for the new log. let new_block = &Block::from_id(replacement_block); - let new_state_id = if block.is_tagged_with_by_tag(&tag::Block::MINECRAFT_DOORS) - && block.is_tagged_with_by_tag(&tag::Block::MINECRAFT_DOORS) + let new_state_id = if block.has_tag(&tag::Block::MINECRAFT_DOORS) + && block.has_tag(&tag::Block::MINECRAFT_DOORS) { // get block state of the old log. let door_information = world.get_block_state_id(&location).await; diff --git a/pumpkin/src/item/items/minecart.rs b/pumpkin/src/item/items/minecart.rs index fa287dea6..f6e18a4da 100644 --- a/pumpkin/src/item/items/minecart.rs +++ b/pumpkin/src/item/items/minecart.rs @@ -61,7 +61,7 @@ impl ItemBehaviour for MinecartItem { ) { let world = player.world(); - if !block.is_tagged_with_by_tag(&tag::Block::MINECRAFT_RAILS) { + if !block.has_tag(&tag::Block::MINECRAFT_RAILS) { return; } let state_id = world.get_block_state_id(&location).await; diff --git a/pumpkin/src/world/natural_spawner.rs b/pumpkin/src/world/natural_spawner.rs index b544c0251..c52750375 100644 --- a/pumpkin/src/world/natural_spawner.rs +++ b/pumpkin/src/world/natural_spawner.rs @@ -474,7 +474,7 @@ pub async fn get_random_spawn_mob_at( // TODO Holder holder = level.getBiome(pos); let biome = world.level.get_rough_biome(block_pos).await; if category == &MobCategory::WATER_AMBIENT - && biome.is_tagged_with_by_tag(&MINECRAFT_REDUCE_WATER_AMBIENT_SPAWNS) + && biome.has_tag(&MINECRAFT_REDUCE_WATER_AMBIENT_SPAWNS) && rng().random::() < 0.98f32 { None @@ -542,16 +542,10 @@ pub async fn is_spawn_position_ok( entity_type: &'static EntityType, ) -> bool { match entity_type.spawn_restriction.location { - SpawnLocation::InLava => world - .get_fluid(block_pos) - .await - .is_tagged_with_by_tag(&MINECRAFT_LAVA), + SpawnLocation::InLava => world.get_fluid(block_pos).await.has_tag(&MINECRAFT_LAVA), SpawnLocation::InWater => { // TODO !level.getBlockState(blockPos).isRedstoneConductor(level, blockPos) - world - .get_fluid(block_pos) - .await - .is_tagged_with_by_tag(&MINECRAFT_WATER) + world.get_fluid(block_pos).await.has_tag(&MINECRAFT_WATER) } SpawnLocation::OnGround => { let down = world.get_block_state(&block_pos.down()).await; @@ -575,5 +569,5 @@ pub fn is_valid_empty_spawn_block(state: &'static BlockState) -> bool { return false; } // TODO !entityType.isBlockDangerous(blockState); - !Block::from_state_id(state.id).is_tagged_with_by_tag(&MINECRAFT_PREVENT_MOB_SPAWNING_INSIDE) + !Block::from_state_id(state.id).has_tag(&MINECRAFT_PREVENT_MOB_SPAWNING_INSIDE) } diff --git a/pumpkin/src/world/portal/nether.rs b/pumpkin/src/world/portal/nether.rs index a34784cc7..86e90301f 100644 --- a/pumpkin/src/world/portal/nether.rs +++ b/pumpkin/src/world/portal/nether.rs @@ -245,7 +245,7 @@ impl NetherPortal { /// What is allowed to be inside the Portal frame fn valid_state_inside_portal(block: &Block, state: &BlockState) -> bool { state.is_air() - || block.is_tagged_with_by_tag(&tag::Block::MINECRAFT_FIRE) + || block.has_tag(&tag::Block::MINECRAFT_FIRE) || block == &Block::NETHER_PORTAL } }