mirror of
https://github.com/Pumpkin-MC/Pumpkin.git
synced 2026-08-30 20:14:23 +00:00
update to bedrock 1.21.111 (#1193)
This commit is contained in:
Binary file not shown.
@@ -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
|
||||
|
||||
@@ -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())
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<T: GenerationCache>(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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<T: GenerationCache>(
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ impl FireBlockBase {
|
||||
|
||||
pub async fn is_soul_fire(world: &Arc<World>, 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<World>, block_pos: &BlockPos) -> bool {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ struct Rail {
|
||||
impl Rail {
|
||||
async fn find_with_elevation(world: &World, position: BlockPos) -> Option<Self> {
|
||||
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,
|
||||
|
||||
@@ -138,6 +138,6 @@ async fn get_stair_properties_if_exists(
|
||||
) -> Option<StairsProperties> {
|
||||
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))
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -474,7 +474,7 @@ pub async fn get_random_spawn_mob_at(
|
||||
// TODO Holder<Biome> 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::<f32>() < 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)
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user