Merge branch 'stable'

This commit is contained in:
Dylan K. Taylor
2019-04-25 18:31:22 +01:00
7 changed files with 33 additions and 476 deletions

View File

@ -30,6 +30,7 @@ use pocketmine\inventory\FurnaceRecipe;
use pocketmine\inventory\ShapedRecipe;
use pocketmine\inventory\ShapelessRecipe;
use pocketmine\item\Item;
use pocketmine\item\ItemFactory;
use pocketmine\network\BadPacketException;
use pocketmine\network\mcpe\handler\SessionHandler;
use pocketmine\network\mcpe\NetworkBinaryStream;
@ -101,10 +102,15 @@ class CraftingDataPacket extends DataPacket implements ClientboundPacket{
break;
case self::ENTRY_FURNACE:
case self::ENTRY_FURNACE_DATA:
$entry["inputId"] = $this->getVarInt();
$inputId = $this->getVarInt();
$inputData = -1;
if($recipeType === self::ENTRY_FURNACE_DATA){
$entry["inputDamage"] = $this->getVarInt();
$inputData = $this->getVarInt();
if($inputData === 0x7fff){
$inputData = -1;
}
}
$entry["input"] = ItemFactory::get($inputId, $inputData);
$entry["output"] = $this->getSlot();
$entry["block"] = $this->getString();

View File

@ -48,9 +48,22 @@ final class RuntimeBlockMapping{
}
public static function init() : void{
$legacyIdMap = json_decode(file_get_contents(\pocketmine\RESOURCE_PATH . "legacy_id_map.json"), true);
$legacyIdMap = json_decode(file_get_contents(\pocketmine\RESOURCE_PATH . "vanilla/block_id_map.json"), true);
self::$bedrockKnownStates = self::randomizeTable(json_decode(file_get_contents(\pocketmine\RESOURCE_PATH . "runtimeid_table.json"), true));
$compressedTable = json_decode(file_get_contents(\pocketmine\RESOURCE_PATH . "vanilla/required_block_states.json"), true);
$decompressed = [];
foreach($compressedTable as $prefix => $entries){
foreach($entries as $shortStringId => $states){
foreach($states as $state){
$decompressed[] = [
"name" => "$prefix:$shortStringId",
"data" => $state
];
}
}
}
self::$bedrockKnownStates = self::randomizeTable($decompressed);
foreach(self::$bedrockKnownStates as $k => $obj){
//this has to use the json offset to make sure the mapping is consistent with what we send over network, even though we aren't using all the entries