Make decoding accessible

This commit is contained in:
Dylan K. Taylor 2017-08-24 10:45:16 +01:00
parent 55e32424a0
commit 90edb8ebe7

View File

@ -47,13 +47,16 @@ class CraftingDataPacket extends DataPacket{
public $entries = []; public $entries = [];
public $cleanRecipes = false; public $cleanRecipes = false;
public $decodedEntries = [];
public function clean(){ public function clean(){
$this->entries = []; $this->entries = [];
$this->decodedEntries = [];
return parent::clean(); return parent::clean();
} }
public function decodePayload(){ public function decodePayload(){
$entries = []; $this->decodedEntries = [];
$recipeCount = $this->getUnsignedVarInt(); $recipeCount = $this->getUnsignedVarInt();
for($i = 0; $i < $recipeCount; ++$i){ for($i = 0; $i < $recipeCount; ++$i){
$entry = []; $entry = [];
@ -105,7 +108,7 @@ class CraftingDataPacket extends DataPacket{
default: default:
throw new \UnexpectedValueException("Unhandled recipe type $recipeType!"); //do not continue attempting to decode throw new \UnexpectedValueException("Unhandled recipe type $recipeType!"); //do not continue attempting to decode
} }
$entries[] = $entry; $this->decodedEntries[] = $entry;
} }
$this->getBool(); //cleanRecipes $this->getBool(); //cleanRecipes
} }