diff --git a/src/network/mcpe/convert/TypeConverter.php b/src/network/mcpe/convert/TypeConverter.php index 48f2e5eca..c0834e5ee 100644 --- a/src/network/mcpe/convert/TypeConverter.php +++ b/src/network/mcpe/convert/TypeConverter.php @@ -139,7 +139,7 @@ class TypeConverter{ $nbt = clone $itemStack->getNamedTag(); } - $block = $itemStack->getBlock(); + $isBlockItem = $itemStack->getId() < 256; if($itemStack instanceof Durable and $itemStack->getDamage() > 0){ if($nbt !== null){ if(($existing = $nbt->getTag(self::DAMAGE_TAG)) !== null){ @@ -150,7 +150,7 @@ class TypeConverter{ $nbt = new CompoundTag(); } $nbt->setInt(self::DAMAGE_TAG, $itemStack->getDamage()); - }elseif($block->getId() !== BlockLegacyIds::AIR && $itemStack->getMeta() !== 0){ + }elseif($isBlockItem && $itemStack->getMeta() !== 0){ //TODO HACK: This foul-smelling code ensures that we can correctly deserialize an item when the //client sends it back to us, because as of 1.16.220, blockitems quietly discard their metadata //client-side. Aside from being very annoying, this also breaks various server-side behaviours. @@ -161,7 +161,13 @@ class TypeConverter{ } [$id, $meta] = ItemTranslator::getInstance()->toNetworkId($itemStack->getId(), $itemStack->getMeta()); - $blockRuntimeId = $block->getId() === BlockLegacyIds::AIR ? 0 : RuntimeBlockMapping::getInstance()->toRuntimeId($block->getFullId()); + $blockRuntimeId = 0; + if($isBlockItem){ + $block = $itemStack->getBlock(); + if($block->getId() !== BlockLegacyIds::AIR){ + $blockRuntimeId = RuntimeBlockMapping::getInstance()->toRuntimeId($block->getFullId()); + } + } return new ItemStack( $id, diff --git a/src/network/mcpe/protocol/types/ParticleIds.php b/src/network/mcpe/protocol/types/ParticleIds.php index 4ff1da583..9cfb3f3b4 100644 --- a/src/network/mcpe/protocol/types/ParticleIds.php +++ b/src/network/mcpe/protocol/types/ParticleIds.php @@ -28,7 +28,6 @@ final class ParticleIds{ private function __construct(){ //NOOP } - public const BUBBLE = 1; public const BUBBLE_MANUAL = 2; public const CRITICAL = 3; @@ -57,44 +56,57 @@ final class ParticleIds{ public const DRIP_WATER = 26; public const DRIP_LAVA = 27; public const DRIP_HONEY = 28; - public const FALLING_DUST = 29, DUST = 29; - public const MOB_SPELL = 30; - public const MOB_SPELL_AMBIENT = 31; - public const MOB_SPELL_INSTANTANEOUS = 32; - public const INK = 33; - public const SLIME = 34; - public const RAIN_SPLASH = 35; - public const VILLAGER_ANGRY = 36; - public const VILLAGER_HAPPY = 37; - public const ENCHANTMENT_TABLE = 38; - public const TRACKING_EMITTER = 39; - public const NOTE = 40; - public const WITCH_SPELL = 41; - public const CARROT = 42; - public const MOB_APPEARANCE = 43; - public const END_ROD = 44; - public const DRAGONS_BREATH = 45; - public const SPIT = 46; - public const TOTEM = 47; - public const FOOD = 48; - public const FIREWORKS_STARTER = 49; - public const FIREWORKS_SPARK = 50; - public const FIREWORKS_OVERLAY = 51; - public const BALLOON_GAS = 52; - public const COLORED_FLAME = 53; - public const SPARKLER = 54; - public const CONDUIT = 55; - public const BUBBLE_COLUMN_UP = 56; - public const BUBBLE_COLUMN_DOWN = 57; - public const SNEEZE = 58; - public const SHULKER_BULLET = 59; - public const BLEACH = 60; - public const DRAGON_DESTROY_BLOCK = 61; - public const MYCELIUM_DUST = 62; - public const FALLING_RED_DUST = 63; - public const CAMPFIRE_SMOKE = 64; - public const TALL_CAMPFIRE_SMOKE = 65; - public const DRAGON_BREATH_FIRE = 66; - public const DRAGON_BREATH_TRAIL = 67; + public const STALACTITE_DRIP_WATER = 29; + public const STALACTITE_DRIP_LAVA = 30; + public const FALLING_DUST = 31, DUST = 31; + public const MOB_SPELL = 32; + public const MOB_SPELL_AMBIENT = 33; + public const MOB_SPELL_INSTANTANEOUS = 34; + public const INK = 35; + public const SLIME = 36; + public const RAIN_SPLASH = 37; + public const VILLAGER_ANGRY = 38; + public const VILLAGER_HAPPY = 39; + public const ENCHANTMENT_TABLE = 40; + public const TRACKING_EMITTER = 41; + public const NOTE = 42; + public const WITCH_SPELL = 43; + public const CARROT = 44; + public const MOB_APPEARANCE = 45; + public const END_ROD = 46; + public const DRAGONS_BREATH = 47; + public const SPIT = 48; + public const TOTEM = 49; + public const FOOD = 50; + public const FIREWORKS_STARTER = 51; + public const FIREWORKS_SPARK = 52; + public const FIREWORKS_OVERLAY = 53; + public const BALLOON_GAS = 54; + public const COLORED_FLAME = 55; + public const SPARKLER = 56; + public const CONDUIT = 57; + public const BUBBLE_COLUMN_UP = 58; + public const BUBBLE_COLUMN_DOWN = 59; + public const SNEEZE = 60; + public const SHULKER_BULLET = 61; + public const BLEACH = 62; + public const DRAGON_DESTROY_BLOCK = 63; + public const MYCELIUM_DUST = 64; + public const FALLING_RED_DUST = 65; + public const CAMPFIRE_SMOKE = 66; + public const TALL_CAMPFIRE_SMOKE = 67; + public const DRAGON_BREATH_FIRE = 68; + public const DRAGON_BREATH_TRAIL = 69; + public const BLUE_FLAME = 70; + public const SOUL = 71; + public const OBSIDIAN_TEAR = 72; + public const PORTAL_REVERSE = 73; + public const SNOWFLAKE = 74; + public const VIBRATION_SIGNAL = 75; + public const SCULK_SENSOR_REDSTONE = 76; + public const SPORE_BLOSSOM_SHOWER = 77; + public const SPORE_BLOSSOM_AMBIENT = 78; + public const WAX = 79; + public const ELECTRIC_SPARK = 80; }