Skip to content

Commit

Permalink
Add < 1.20.60 support
Browse files Browse the repository at this point in the history
  • Loading branch information
dries-c committed Feb 7, 2024
1 parent 8024b88 commit c0df1a0
Show file tree
Hide file tree
Showing 42 changed files with 173 additions and 82 deletions.
9 changes: 5 additions & 4 deletions src/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -1408,13 +1408,14 @@ public function broadcastTitle(string $title, string $subtitle = "", int $fadeIn
*
* @param bool|null $sync Compression on the main thread (true) or workers (false). Default is automatic (null).
*/
public function prepareBatch(string $buffer, Compressor $compressor, ?bool $sync = null, ?TimingsHandler $timings = null) : CompressBatchPromise|string{
public function prepareBatch(string $buffer, PacketSerializerContext $packetSerializerContext, Compressor $compressor, ?bool $sync = null, ?TimingsHandler $timings = null) : CompressBatchPromise|string{
$timings ??= Timings::$playerNetworkSendCompress;
try{
$timings->startTiming();

$threshold = $compressor->getCompressionThreshold();
if($threshold === null || strlen($buffer) < $compressor->getCompressionThreshold()){
$protocolId = $packetSerializerContext->getProtocolId();
if(($threshold === null || strlen($buffer) < $compressor->getCompressionThreshold()) && $protocolId >= ProtocolInfo::PROTOCOL_1_20_60){
$compressionType = CompressionAlgorithm::NONE;
$compressed = $buffer;

Expand All @@ -1423,7 +1424,7 @@ public function prepareBatch(string $buffer, Compressor $compressor, ?bool $sync

if(!$sync && strlen($buffer) >= $this->networkCompressionAsyncThreshold){
$promise = new CompressBatchPromise();
$task = new CompressBatchTask($buffer, $promise, $compressor);
$task = new CompressBatchTask($buffer, $promise, $compressor, $protocolId);
$this->asyncPool->submitTask($task);
return $promise;
}
Expand All @@ -1432,7 +1433,7 @@ public function prepareBatch(string $buffer, Compressor $compressor, ?bool $sync
$compressed = $compressor->compress($buffer);
}

return chr($compressionType) . $compressed;
return ($protocolId >= ProtocolInfo::PROTOCOL_1_20_60 ? chr($compressionType) : '') . $compressed;
}finally{
$timings->stopTiming();
}
Expand Down
5 changes: 5 additions & 0 deletions src/data/bedrock/BedrockDataFiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,19 @@ private function __construct(){
public const BLOCK_ID_TO_ITEM_ID_MAP_1_20_0_JSON = BEDROCK_DATA_PATH . '/block_id_to_item_id_map-1.20.0.json';
public const BLOCK_ID_TO_ITEM_ID_MAP_1_20_10_JSON = BEDROCK_DATA_PATH . '/block_id_to_item_id_map-1.20.10.json';
public const BLOCK_ID_TO_ITEM_ID_MAP_1_20_40_JSON = BEDROCK_DATA_PATH . '/block_id_to_item_id_map-1.20.40.json';
public const BLOCK_ID_TO_ITEM_ID_MAP_1_20_50_JSON = BEDROCK_DATA_PATH . '/block_id_to_item_id_map-1.20.50.json';
public const BLOCK_ID_TO_ITEM_ID_MAP_JSON = BEDROCK_DATA_PATH . '/block_id_to_item_id_map.json';
public const BLOCK_STATE_META_MAP_1_20_0_JSON = BEDROCK_DATA_PATH . '/block_state_meta_map-1.20.0.json';
public const BLOCK_STATE_META_MAP_1_20_10_JSON = BEDROCK_DATA_PATH . '/block_state_meta_map-1.20.10.json';
public const BLOCK_STATE_META_MAP_1_20_30_JSON = BEDROCK_DATA_PATH . '/block_state_meta_map-1.20.30.json';
public const BLOCK_STATE_META_MAP_1_20_40_JSON = BEDROCK_DATA_PATH . '/block_state_meta_map-1.20.40.json';
public const BLOCK_STATE_META_MAP_1_20_50_JSON = BEDROCK_DATA_PATH . '/block_state_meta_map-1.20.50.json';
public const BLOCK_STATE_META_MAP_JSON = BEDROCK_DATA_PATH . '/block_state_meta_map.json';
public const CANONICAL_BLOCK_STATES_1_20_0_NBT = BEDROCK_DATA_PATH . '/canonical_block_states-1.20.0.nbt';
public const CANONICAL_BLOCK_STATES_1_20_10_NBT = BEDROCK_DATA_PATH . '/canonical_block_states-1.20.10.nbt';
public const CANONICAL_BLOCK_STATES_1_20_30_NBT = BEDROCK_DATA_PATH . '/canonical_block_states-1.20.30.nbt';
public const CANONICAL_BLOCK_STATES_1_20_40_NBT = BEDROCK_DATA_PATH . '/canonical_block_states-1.20.40.nbt';
public const CANONICAL_BLOCK_STATES_1_20_50_NBT = BEDROCK_DATA_PATH . '/canonical_block_states-1.20.50.nbt';
public const CANONICAL_BLOCK_STATES_NBT = BEDROCK_DATA_PATH . '/canonical_block_states.nbt';
public const COMMAND_ARG_TYPES_JSON = BEDROCK_DATA_PATH . '/command_arg_types.json';
public const CREATIVEITEMS_JSON = BEDROCK_DATA_PATH . '/creativeitems.json';
Expand All @@ -60,10 +63,12 @@ private function __construct(){
public const R12_TO_CURRENT_BLOCK_MAP_1_20_10_BIN = BEDROCK_DATA_PATH . '/r12_to_current_block_map-1.20.10.bin';
public const R12_TO_CURRENT_BLOCK_MAP_1_20_30_BIN = BEDROCK_DATA_PATH . '/r12_to_current_block_map-1.20.30.bin';
public const R12_TO_CURRENT_BLOCK_MAP_1_20_40_BIN = BEDROCK_DATA_PATH . '/r12_to_current_block_map-1.20.40.bin';
public const R12_TO_CURRENT_BLOCK_MAP_1_20_50_BIN = BEDROCK_DATA_PATH . '/r12_to_current_block_map-1.20.50.bin';
public const R12_TO_CURRENT_BLOCK_MAP_BIN = BEDROCK_DATA_PATH . '/r12_to_current_block_map.bin';
public const R16_TO_CURRENT_ITEM_MAP_JSON = BEDROCK_DATA_PATH . '/r16_to_current_item_map.json';
public const REQUIRED_ITEM_LIST_1_20_0_JSON = BEDROCK_DATA_PATH . '/required_item_list-1.20.0.json';
public const REQUIRED_ITEM_LIST_1_20_10_JSON = BEDROCK_DATA_PATH . '/required_item_list-1.20.10.json';
public const REQUIRED_ITEM_LIST_1_20_40_JSON = BEDROCK_DATA_PATH . '/required_item_list-1.20.40.json';
public const REQUIRED_ITEM_LIST_1_20_50_JSON = BEDROCK_DATA_PATH . '/required_item_list-1.20.50.json';
public const REQUIRED_ITEM_LIST_JSON = BEDROCK_DATA_PATH . '/required_item_list.json';
}
1 change: 1 addition & 0 deletions src/data/bedrock/ItemTagToIdMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ final class ItemTagToIdMap{

private const PATHS = [
ProtocolInfo::CURRENT_PROTOCOL => "",
ProtocolInfo::PROTOCOL_1_20_50 => "",
ProtocolInfo::PROTOCOL_1_20_40 => "-1.20.0",
ProtocolInfo::PROTOCOL_1_20_30 => "-1.20.0",
ProtocolInfo::PROTOCOL_1_20_10 => "-1.20.0",
Expand Down
29 changes: 22 additions & 7 deletions src/network/mcpe/CachedChunk.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@
use BadFunctionCallException;
use pocketmine\network\mcpe\compression\Compressor;
use pocketmine\network\mcpe\protocol\LevelChunkPacket;
use pocketmine\network\mcpe\protocol\ProtocolInfo;
use pocketmine\network\mcpe\protocol\serializer\PacketBatch;
use pocketmine\network\mcpe\protocol\serializer\PacketSerializerContext;
use pocketmine\network\mcpe\protocol\types\ChunkPosition;
use pocketmine\network\mcpe\protocol\types\DimensionIds;
use pocketmine\utils\BinaryStream;
use function chr;
use function count;
use function strlen;

Expand Down Expand Up @@ -79,14 +82,18 @@ public function getHashMap() : array{
return $map;
}

public function compressPackets(int $chunkX, int $chunkZ, string $chunkData, Compressor $compressor, PacketSerializerContext $encoderContext) : void{
/**
* @phpstan-param DimensionIds::* $dimensionId
*/
public function compressPackets(int $chunkX, int $chunkZ, int $dimensionId, string $chunkData, Compressor $compressor, PacketSerializerContext $encoderContext, int $protocolId) : void{
$protocolAddition = $protocolId >= ProtocolInfo::PROTOCOL_1_20_60 ? chr($compressor->getNetworkId()) : '';
$stream = new BinaryStream();
PacketBatch::encodePackets($stream, $encoderContext, [$this->createPacket($chunkX, $chunkZ, $chunkData)]);
$this->packet = $compressor->compress($stream->getBuffer());
PacketBatch::encodePackets($stream, $encoderContext, [$this->createPacket($chunkX, $chunkZ, $dimensionId, $chunkData)]);
$this->packet = $protocolAddition . $compressor->compress($stream->getBuffer());

$stream = new BinaryStream();
PacketBatch::encodePackets($stream, $encoderContext, [$this->createCachablePacket($chunkX, $chunkZ, $chunkData)]);
$this->cachablePacket = $compressor->compress($stream->getBuffer());
PacketBatch::encodePackets($stream, $encoderContext, [$this->createCachablePacket($chunkX, $chunkZ, $dimensionId, $chunkData)]);
$this->cachablePacket = $protocolAddition . $compressor->compress($stream->getBuffer());
}

public function getCacheablePacket() : string{
Expand All @@ -105,7 +112,10 @@ public function getPacket() : string{
return $this->packet;
}

private function createPacket(int $chunkX, int $chunkZ, string $chunkData) : LevelChunkPacket{
/**
* @phpstan-param DimensionIds::* $dimensionId
*/
private function createPacket(int $chunkX, int $chunkZ, int $dimensionId, string $chunkData) : LevelChunkPacket{
$stream = new BinaryStream();

foreach($this->blobs as $subChunk){
Expand All @@ -116,16 +126,21 @@ private function createPacket(int $chunkX, int $chunkZ, string $chunkData) : Lev

return LevelChunkPacket::create(
new ChunkPosition($chunkX, $chunkZ),
$dimensionId,
count($this->hashes),
false,
null,
$stream->getBuffer()
);
}

private function createCachablePacket(int $chunkX, int $chunkZ, string $chunkData) : LevelChunkPacket{
/**
* @phpstan-param DimensionIds::* $dimensionId
*/
private function createCachablePacket(int $chunkX, int $chunkZ, int $dimensionId, string $chunkData) : LevelChunkPacket{
return LevelChunkPacket::create(
new ChunkPosition($chunkX, $chunkZ),
$dimensionId,
count($this->hashes),
false,
$this->getHashes(),
Expand Down
31 changes: 21 additions & 10 deletions src/network/mcpe/NetworkSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -413,21 +413,32 @@ public function handleEncoded(string $payload) : void{

if($this->enableCompression){
Timings::$playerNetworkReceiveDecompress->startTiming();
$compressionType = ord($payload[0]);
$compressed = substr($payload, 1);
if($compressionType === CompressionAlgorithm::NONE){
$decompressed = $compressed;
}elseif($compressionType === $this->compressor->getNetworkId()){
if($this->protocolId >= ProtocolInfo::PROTOCOL_1_20_60){
$compressionType = ord($payload[0]);
$compressed = substr($payload, 1);
if($compressionType === CompressionAlgorithm::NONE){
$decompressed = $compressed;
}elseif($compressionType === $this->compressor->getNetworkId()){
try{
$decompressed = $this->compressor->decompress($compressed);
}catch(DecompressionException $e){
$this->logger->debug("Failed to decompress packet: " . base64_encode($compressed));
throw PacketHandlingException::wrap($e, "Compressed packet batch decode error");
}finally{
Timings::$playerNetworkReceiveDecompress->stopTiming();
}
}else{
throw new PacketHandlingException("Packet compressed with unexpected compression type $compressionType");
}
}else{
try{
$decompressed = $this->compressor->decompress($compressed);
$decompressed = $this->compressor->decompress($payload);
}catch(DecompressionException $e){
$this->logger->debug("Failed to decompress packet: " . base64_encode($compressed));
$this->logger->debug("Failed to decompress packet: " . base64_encode($payload));
throw PacketHandlingException::wrap($e, "Compressed packet batch decode error");
}finally{
Timings::$playerNetworkReceiveDecompress->stopTiming();
}
}else{
throw new PacketHandlingException("Packet compressed with unexpected compression type $compressionType");
}
}else{
$decompressed = $payload;
Expand Down Expand Up @@ -592,7 +603,7 @@ private function flushSendBuffer(bool $immediate = false) : void{
PacketBatch::encodeRaw($stream, $this->sendBuffer);

if($this->enableCompression){
$batch = $this->server->prepareBatch($stream->getBuffer(), $this->compressor, $syncMode, Timings::$playerNetworkSendCompressSessionBuffer);
$batch = $this->server->prepareBatch($stream->getBuffer(), $this->packetSerializerContext, $this->compressor, $syncMode, Timings::$playerNetworkSendCompressSessionBuffer);
}else{
$batch = $stream->getBuffer();
}
Expand Down
2 changes: 1 addition & 1 deletion src/network/mcpe/StandardPacketBroadcaster.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function broadcastPackets(array $recipients, array $packets) : void{
PacketBatch::encodeRaw($stream, $packetBuffers);
$batchBuffer = $stream->getBuffer();

$batch = $this->server->prepareBatch($batchBuffer, $compressor, timings: Timings::$playerNetworkSendCompressBroadcast);
$batch = $this->server->prepareBatch($batchBuffer, $this->protocolContext, $compressor, timings: Timings::$playerNetworkSendCompressBroadcast);
foreach($compressorTargets as $target){
$target->queueCompressed($batch);
}
Expand Down
7 changes: 5 additions & 2 deletions src/network/mcpe/compression/CompressBatchTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

namespace pocketmine\network\mcpe\compression;

use pocketmine\network\mcpe\protocol\ProtocolInfo;
use pocketmine\scheduler\AsyncTask;
use pocketmine\thread\NonThreadSafeValue;
use function chr;
Expand All @@ -37,15 +38,17 @@ class CompressBatchTask extends AsyncTask{
public function __construct(
private string $data,
CompressBatchPromise $promise,
Compressor $compressor
Compressor $compressor,
private int $protocolId
){
$this->compressor = new NonThreadSafeValue($compressor);
$this->storeLocal(self::TLS_KEY_PROMISE, $promise);
}

public function onRun() : void{
$compressor = $this->compressor->deserialize();
$this->setResult(chr($compressor->getNetworkId()) . $compressor->compress($this->data));
$protocolAddition = $this->protocolId >= ProtocolInfo::PROTOCOL_1_20_60 ? chr($compressor->getNetworkId()) : '';
$this->setResult($protocolAddition . $compressor->compress($this->data));
}

public function onCompletion() : void{
Expand Down
4 changes: 4 additions & 0 deletions src/network/mcpe/convert/BlockTranslator.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ final class BlockTranslator{
self::CANONICAL_BLOCK_STATES_PATH => '',
self::BLOCK_STATE_META_MAP_PATH => '',
],
ProtocolInfo::PROTOCOL_1_20_50 => [
self::CANONICAL_BLOCK_STATES_PATH => '-1.20.50',
self::BLOCK_STATE_META_MAP_PATH => '-1.20.50',
],
ProtocolInfo::PROTOCOL_1_20_40 => [
self::CANONICAL_BLOCK_STATES_PATH => '-1.20.40',
self::BLOCK_STATE_META_MAP_PATH => '-1.20.40',
Expand Down
2 changes: 2 additions & 0 deletions src/network/mcpe/convert/ItemTranslator.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ public function fromNetworkId(int $networkId, int $networkMeta, int $networkBloc

public static function getItemSchemaId(int $protocolId) : int{
return match($protocolId){
ProtocolInfo::PROTOCOL_1_20_60 => 161,

ProtocolInfo::PROTOCOL_1_20_50 => 151,

ProtocolInfo::PROTOCOL_1_20_40,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ final class ItemTypeDictionaryFromDataHelper{

private const PATHS = [
ProtocolInfo::CURRENT_PROTOCOL => "",
ProtocolInfo::PROTOCOL_1_20_50 => "-1.20.50",
ProtocolInfo::PROTOCOL_1_20_40 => "-1.20.40",
ProtocolInfo::PROTOCOL_1_20_30 => "-1.20.40",
ProtocolInfo::PROTOCOL_1_20_10 => "-1.20.10",
Expand Down
6 changes: 6 additions & 0 deletions src/network/mcpe/serializer/ChunkSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ public static function serializeSubChunks(Chunk $chunk, int $dimensionId, BlockT
return $subChunks;
}

/**
* @phpstan-param DimensionIds::* $dimensionId
*/
public static function serializeFullChunk(Chunk $chunk, int $dimensionId, TypeConverter $converter, PacketSerializerContext $encoderContext, ?string $tiles = null) : string{
$stream = PacketSerializer::encoder($encoderContext);

Expand All @@ -117,6 +120,9 @@ public static function serializeFullChunk(Chunk $chunk, int $dimensionId, TypeCo
return $stream->getBuffer();
}

/**
* @phpstan-param DimensionIds::* $dimensionId
*/
public static function serializeBiomes(Chunk $chunk, int $dimensionId, PacketSerializer $stream) : void{
[$minSubChunkIndex, $maxSubChunkIndex] = self::getDimensionChunkBounds($dimensionId);
$biomeIdMap = LegacyBiomeIdToStringIdMap::getInstance();
Expand Down
5 changes: 4 additions & 1 deletion src/world/World.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
use pocketmine\world\particle\BlockParticle;
use pocketmine\world\particle\ItemParticle;
use pocketmine\world\particle\Particle;
use pocketmine\world\particle\ProtocolParticle;
use pocketmine\world\sound\BlockPlaceSound;
use pocketmine\world\sound\BlockSound;
use pocketmine\world\sound\Sound;
Expand Down Expand Up @@ -764,10 +765,12 @@ public function addParticle(Vector3 $pos, Particle $particle, ?array $players =
$players = $ev->getRecipients();
}

if($particle instanceof BlockParticle || $particle instanceof ItemParticle){
if($particle instanceof BlockParticle || $particle instanceof ItemParticle || $particle instanceof ProtocolParticle){
$closure = function(TypeConverter $typeConverter) use ($particle, $pos) : array{
if($particle instanceof ItemParticle){
$particle->setItemTranslator($typeConverter->getItemTranslator());
}elseif($particle instanceof ProtocolParticle){
$particle->setProtocolId($typeConverter->getProtocolId());
}else{
$particle->setBlockTranslator($typeConverter->getBlockTranslator());
}
Expand Down
4 changes: 2 additions & 2 deletions src/world/particle/AngryVillagerParticle.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
use pocketmine\network\mcpe\protocol\LevelEventPacket;
use pocketmine\network\mcpe\protocol\types\ParticleIds;

class AngryVillagerParticle implements Particle{
class AngryVillagerParticle extends ProtocolParticle{

public function encode(Vector3 $pos) : array{
return [LevelEventPacket::standardParticle(ParticleIds::VILLAGER_ANGRY, 0, $pos)];
return [LevelEventPacket::standardParticle(ParticleIds::VILLAGER_ANGRY, 0, $pos, $this->protocolId)];
}
}
4 changes: 2 additions & 2 deletions src/world/particle/BlockForceFieldParticle.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
use pocketmine\network\mcpe\protocol\LevelEventPacket;
use pocketmine\network\mcpe\protocol\types\ParticleIds;

class BlockForceFieldParticle implements Particle{
class BlockForceFieldParticle extends ProtocolParticle{
//TODO: proper encode/decode of data
public function __construct(private int $data = 0){}

public function encode(Vector3 $pos) : array{
return [LevelEventPacket::standardParticle(ParticleIds::BLOCK_FORCE_FIELD, $this->data, $pos)];
return [LevelEventPacket::standardParticle(ParticleIds::BLOCK_FORCE_FIELD, $this->data, $pos, $this->protocolId)];
}
}
4 changes: 2 additions & 2 deletions src/world/particle/BubbleParticle.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
use pocketmine\network\mcpe\protocol\LevelEventPacket;
use pocketmine\network\mcpe\protocol\types\ParticleIds;

class BubbleParticle implements Particle{
class BubbleParticle extends ProtocolParticle{

public function encode(Vector3 $pos) : array{
return [LevelEventPacket::standardParticle(ParticleIds::BUBBLE, 0, $pos)];
return [LevelEventPacket::standardParticle(ParticleIds::BUBBLE, 0, $pos, $this->protocolId)];
}
}
4 changes: 2 additions & 2 deletions src/world/particle/CriticalParticle.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
use pocketmine\network\mcpe\protocol\LevelEventPacket;
use pocketmine\network\mcpe\protocol\types\ParticleIds;

class CriticalParticle implements Particle{
class CriticalParticle extends ProtocolParticle{
public function __construct(private int $scale = 2){}

public function encode(Vector3 $pos) : array{
return [LevelEventPacket::standardParticle(ParticleIds::CRITICAL, $this->scale, $pos)];
return [LevelEventPacket::standardParticle(ParticleIds::CRITICAL, $this->scale, $pos, $this->protocolId)];
}
}
4 changes: 2 additions & 2 deletions src/world/particle/DustParticle.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
use pocketmine\network\mcpe\protocol\LevelEventPacket;
use pocketmine\network\mcpe\protocol\types\ParticleIds;

class DustParticle implements Particle{
class DustParticle extends ProtocolParticle{
public function __construct(private Color $color){}

public function encode(Vector3 $pos) : array{
return [LevelEventPacket::standardParticle(ParticleIds::DUST, $this->color->toARGB(), $pos)];
return [LevelEventPacket::standardParticle(ParticleIds::DUST, $this->color->toARGB(), $pos, $this->protocolId)];
}
}
4 changes: 2 additions & 2 deletions src/world/particle/EnchantParticle.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
use pocketmine\network\mcpe\protocol\LevelEventPacket;
use pocketmine\network\mcpe\protocol\types\ParticleIds;

class EnchantParticle implements Particle{
class EnchantParticle extends ProtocolParticle{
public function __construct(private Color $color){}

public function encode(Vector3 $pos) : array{
return [LevelEventPacket::standardParticle(ParticleIds::MOB_SPELL, $this->color->toARGB(), $pos)];
return [LevelEventPacket::standardParticle(ParticleIds::MOB_SPELL, $this->color->toARGB(), $pos, $this->protocolId)];
}
}
4 changes: 2 additions & 2 deletions src/world/particle/EnchantmentTableParticle.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
use pocketmine\network\mcpe\protocol\LevelEventPacket;
use pocketmine\network\mcpe\protocol\types\ParticleIds;

class EnchantmentTableParticle implements Particle{
class EnchantmentTableParticle extends ProtocolParticle{

public function encode(Vector3 $pos) : array{
return [LevelEventPacket::standardParticle(ParticleIds::ENCHANTMENT_TABLE, 0, $pos)];
return [LevelEventPacket::standardParticle(ParticleIds::ENCHANTMENT_TABLE, 0, $pos, $this->protocolId)];
}
}
Loading

0 comments on commit c0df1a0

Please sign in to comment.