Added custom block data (example, chests), better deep checking of same NBT

This commit is contained in:
Shoghi Cervantes
2015-08-07 17:24:35 +02:00
parent e9c981b586
commit 696edfd31f
10 changed files with 179 additions and 17 deletions

View File

@ -47,7 +47,7 @@ class Chest extends Spawnable implements InventoryHolder, Container, Nameable{
$this->inventory = new ChestInventory($this);
if(!isset($this->namedtag->Items) or !($this->namedtag->Items instanceof Enum)){
$this->namedtag->Items = new Enum("Inventory", []);
$this->namedtag->Items = new Enum("Items", []);
$this->namedtag->Items->setTagType(NBT::TAG_Compound);
}
@ -91,8 +91,8 @@ class Chest extends Spawnable implements InventoryHolder, Container, Nameable{
*/
protected function getSlotIndex($index){
foreach($this->namedtag->Items as $i => $slot){
if($slot["Slot"] === $index){
return $i;
if((int) $slot["Slot"] === (int) $index){
return (int) $i;
}
}