mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-12 16:59:44 +00:00
CraftingDataPacket: added native return typehints to private methods
This commit is contained in:
parent
260869c0d5
commit
ab57914322
@ -169,7 +169,7 @@ class CraftingDataPacket extends DataPacket{
|
|||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
private static function writeEntry($entry, NetworkBinaryStream $stream, int $pos){
|
private static function writeEntry($entry, NetworkBinaryStream $stream, int $pos) : int{
|
||||||
if($entry instanceof ShapelessRecipe){
|
if($entry instanceof ShapelessRecipe){
|
||||||
return self::writeShapelessRecipe($entry, $stream, $pos);
|
return self::writeShapelessRecipe($entry, $stream, $pos);
|
||||||
}elseif($entry instanceof ShapedRecipe){
|
}elseif($entry instanceof ShapedRecipe){
|
||||||
@ -182,7 +182,7 @@ class CraftingDataPacket extends DataPacket{
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function writeShapelessRecipe(ShapelessRecipe $recipe, NetworkBinaryStream $stream, int $pos){
|
private static function writeShapelessRecipe(ShapelessRecipe $recipe, NetworkBinaryStream $stream, int $pos) : int{
|
||||||
$stream->putString(Binary::writeInt($pos)); //some kind of recipe ID, doesn't matter what it is as long as it's unique
|
$stream->putString(Binary::writeInt($pos)); //some kind of recipe ID, doesn't matter what it is as long as it's unique
|
||||||
$stream->putUnsignedVarInt($recipe->getIngredientCount());
|
$stream->putUnsignedVarInt($recipe->getIngredientCount());
|
||||||
foreach($recipe->getIngredientList() as $item){
|
foreach($recipe->getIngredientList() as $item){
|
||||||
@ -202,7 +202,7 @@ class CraftingDataPacket extends DataPacket{
|
|||||||
return CraftingDataPacket::ENTRY_SHAPELESS;
|
return CraftingDataPacket::ENTRY_SHAPELESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function writeShapedRecipe(ShapedRecipe $recipe, NetworkBinaryStream $stream, int $pos){
|
private static function writeShapedRecipe(ShapedRecipe $recipe, NetworkBinaryStream $stream, int $pos) : int{
|
||||||
$stream->putString(Binary::writeInt($pos)); //some kind of recipe ID, doesn't matter what it is as long as it's unique
|
$stream->putString(Binary::writeInt($pos)); //some kind of recipe ID, doesn't matter what it is as long as it's unique
|
||||||
$stream->putVarInt($recipe->getWidth());
|
$stream->putVarInt($recipe->getWidth());
|
||||||
$stream->putVarInt($recipe->getHeight());
|
$stream->putVarInt($recipe->getHeight());
|
||||||
@ -226,7 +226,7 @@ class CraftingDataPacket extends DataPacket{
|
|||||||
return CraftingDataPacket::ENTRY_SHAPED;
|
return CraftingDataPacket::ENTRY_SHAPED;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function writeFurnaceRecipe(FurnaceRecipe $recipe, NetworkBinaryStream $stream){
|
private static function writeFurnaceRecipe(FurnaceRecipe $recipe, NetworkBinaryStream $stream) : int{
|
||||||
$stream->putVarInt($recipe->getInput()->getId());
|
$stream->putVarInt($recipe->getInput()->getId());
|
||||||
$result = CraftingDataPacket::ENTRY_FURNACE;
|
$result = CraftingDataPacket::ENTRY_FURNACE;
|
||||||
if(!$recipe->getInput()->hasAnyDamageValue()){ //Data recipe
|
if(!$recipe->getInput()->hasAnyDamageValue()){ //Data recipe
|
||||||
|
Loading…
x
Reference in New Issue
Block a user