BlockTranslator: use less ambiguous function names

This commit is contained in:
Dylan K. Taylor
2023-05-05 14:47:23 +01:00
parent 4f32f5e0b7
commit 289ede669d
15 changed files with 19 additions and 19 deletions

View File

@ -1074,7 +1074,7 @@ class World implements ChunkManager{
$tile = $this->getTileAt($b->x, $b->y, $b->z);
if($tile instanceof Spawnable && count($fakeStateProperties = $tile->getRenderUpdateBugWorkaroundStateProperties($fullBlock)) > 0){
$originalStateData = $blockTranslator->toStateData($fullBlock->getStateId());
$originalStateData = $blockTranslator->internalIdToNetworkStateData($fullBlock->getStateId());
$fakeStateData = new BlockStateData(
$originalStateData->getName(),
array_merge($originalStateData->getStates(), $fakeStateProperties),
@ -1089,7 +1089,7 @@ class World implements ChunkManager{
}
$packets[] = UpdateBlockPacket::create(
$blockPosition,
$blockTranslator->toRuntimeId($fullBlock->getStateId()),
$blockTranslator->internalIdToNetworkId($fullBlock->getStateId()),
UpdateBlockPacket::FLAG_NETWORK,
UpdateBlockPacket::DATA_LAYER_NORMAL
);

View File

@ -34,6 +34,6 @@ class BlockBreakParticle implements Particle{
public function __construct(private Block $b){}
public function encode(Vector3 $pos) : array{
return [LevelEventPacket::create(LevelEvent::PARTICLE_DESTROY, TypeConverter::getInstance()->getBlockTranslator()->toRuntimeId($this->b->getStateId()), $pos)];
return [LevelEventPacket::create(LevelEvent::PARTICLE_DESTROY, TypeConverter::getInstance()->getBlockTranslator()->internalIdToNetworkId($this->b->getStateId()), $pos)];
}
}

View File

@ -39,6 +39,6 @@ class BlockPunchParticle implements Particle{
){}
public function encode(Vector3 $pos) : array{
return [LevelEventPacket::create(LevelEvent::PARTICLE_PUNCH_BLOCK, TypeConverter::getInstance()->getBlockTranslator()->toRuntimeId($this->block->getStateId()) | ($this->face << 24), $pos)];
return [LevelEventPacket::create(LevelEvent::PARTICLE_PUNCH_BLOCK, TypeConverter::getInstance()->getBlockTranslator()->internalIdToNetworkId($this->block->getStateId()) | ($this->face << 24), $pos)];
}
}

View File

@ -95,7 +95,7 @@ class FloatingTextParticle implements Particle{
EntityMetadataProperties::BOUNDING_BOX_WIDTH => new FloatMetadataProperty(0.0),
EntityMetadataProperties::BOUNDING_BOX_HEIGHT => new FloatMetadataProperty(0.0),
EntityMetadataProperties::NAMETAG => new StringMetadataProperty($name),
EntityMetadataProperties::VARIANT => new IntMetadataProperty(TypeConverter::getInstance()->getBlockTranslator()->toRuntimeId(VanillaBlocks::AIR()->getStateId())),
EntityMetadataProperties::VARIANT => new IntMetadataProperty(TypeConverter::getInstance()->getBlockTranslator()->internalIdToNetworkId(VanillaBlocks::AIR()->getStateId())),
EntityMetadataProperties::ALWAYS_SHOW_NAMETAG => new ByteMetadataProperty(1),
];
$p[] = AddActorPacket::create(

View File

@ -33,6 +33,6 @@ class TerrainParticle implements Particle{
public function __construct(private Block $b){}
public function encode(Vector3 $pos) : array{
return [LevelEventPacket::standardParticle(ParticleIds::TERRAIN, TypeConverter::getInstance()->getBlockTranslator()->toRuntimeId($this->b->getStateId()), $pos)];
return [LevelEventPacket::standardParticle(ParticleIds::TERRAIN, TypeConverter::getInstance()->getBlockTranslator()->internalIdToNetworkId($this->b->getStateId()), $pos)];
}
}

View File

@ -33,6 +33,6 @@ class BlockBreakSound implements Sound{
public function __construct(private Block $block){}
public function encode(Vector3 $pos) : array{
return [LevelSoundEventPacket::nonActorSound(LevelSoundEvent::BREAK, $pos, false, TypeConverter::getInstance()->getBlockTranslator()->toRuntimeId($this->block->getStateId()))];
return [LevelSoundEventPacket::nonActorSound(LevelSoundEvent::BREAK, $pos, false, TypeConverter::getInstance()->getBlockTranslator()->internalIdToNetworkId($this->block->getStateId()))];
}
}

View File

@ -33,6 +33,6 @@ class BlockPlaceSound implements Sound{
public function __construct(private Block $block){}
public function encode(Vector3 $pos) : array{
return [LevelSoundEventPacket::nonActorSound(LevelSoundEvent::PLACE, $pos, false, TypeConverter::getInstance()->getBlockTranslator()->toRuntimeId($this->block->getStateId()))];
return [LevelSoundEventPacket::nonActorSound(LevelSoundEvent::PLACE, $pos, false, TypeConverter::getInstance()->getBlockTranslator()->internalIdToNetworkId($this->block->getStateId()))];
}
}

View File

@ -40,7 +40,7 @@ class BlockPunchSound implements Sound{
LevelSoundEvent::HIT,
$pos,
false,
TypeConverter::getInstance()->getBlockTranslator()->toRuntimeId($this->block->getStateId())
TypeConverter::getInstance()->getBlockTranslator()->internalIdToNetworkId($this->block->getStateId())
)];
}
}

View File

@ -43,7 +43,7 @@ class EntityLandSound implements Sound{
return [LevelSoundEventPacket::create(
LevelSoundEvent::LAND,
$pos,
TypeConverter::getInstance()->getBlockTranslator()->toRuntimeId($this->blockLandedOn->getStateId()),
TypeConverter::getInstance()->getBlockTranslator()->internalIdToNetworkId($this->blockLandedOn->getStateId()),
$this->entity::getNetworkTypeId(),
false, //TODO: does isBaby have any relevance here?
false

View File

@ -42,7 +42,7 @@ final class ItemUseOnBlockSound implements Sound{
LevelSoundEvent::ITEM_USE_ON,
$pos,
false,
TypeConverter::getInstance()->getBlockTranslator()->toRuntimeId($this->block->getStateId())
TypeConverter::getInstance()->getBlockTranslator()->internalIdToNetworkId($this->block->getStateId())
)];
}
}