updated some NBT for tiles

This commit is contained in:
Dylan K. Taylor 2017-10-31 18:22:06 +00:00
parent caf9eaa2da
commit f8e6438efe
5 changed files with 17 additions and 14 deletions

View File

@ -35,8 +35,8 @@ class Bed extends Spawnable{
const TAG_COLOR = "color";
public function __construct(Level $level, CompoundTag $nbt){
if(!$nbt->hasTag(self::TAG_COLOR, ByteTag::class)){
$nbt->setTag(new ByteTag(self::TAG_COLOR, 14)); //default to old red
if(!$nbt->hasTag(self::TAG_COLOR, ByteTag::class)){ //TODO: check PC format
$nbt->setByte(self::TAG_COLOR, 14, true); //default to old red
}
parent::__construct($level, $nbt);
}

View File

@ -37,11 +37,12 @@ class FlowerPot extends Spawnable{
const TAG_ITEM_DATA = "mData";
public function __construct(Level $level, CompoundTag $nbt){
//TODO: check PC format
if(!$nbt->hasTag(self::TAG_ITEM, ShortTag::class)){
$nbt->setTag(new ShortTag(self::TAG_ITEM, 0));
$nbt->setShort(self::TAG_ITEM, 0, true);
}
if(!$nbt->hasTag(self::TAG_ITEM_DATA, IntTag::class)){
$nbt->setTag(new IntTag(self::TAG_ITEM_DATA, 0));
$nbt->setInt(self::TAG_ITEM_DATA, 0, true);
}
parent::__construct($level, $nbt);
}

View File

@ -54,7 +54,7 @@ class Furnace extends Spawnable implements InventoryHolder, Container, Nameable{
public function __construct(Level $level, CompoundTag $nbt){
if(!$nbt->hasTag(self::TAG_BURN_TIME, ShortTag::class) or $nbt->getShort(self::TAG_BURN_TIME) < 0){
$nbt->setTag(new ShortTag(self::TAG_BURN_TIME, 0));
$nbt->setShort(self::TAG_BURN_TIME, 0, true);
}
if(
@ -62,16 +62,16 @@ class Furnace extends Spawnable implements InventoryHolder, Container, Nameable{
$nbt->getShort(self::TAG_COOK_TIME) < 0 or
($nbt->getShort(self::TAG_BURN_TIME) === 0 and $nbt->getShort(self::TAG_COOK_TIME) > 0)
){
$nbt->setTag(new ShortTag(self::TAG_COOK_TIME, 0));
$nbt->setShort(self::TAG_COOK_TIME, 0, true);
}
if(!$nbt->hasTag(self::TAG_MAX_TIME, ShortTag::class)){
$nbt->setTag(new ShortTag(self::TAG_MAX_TIME, $nbt->getShort(self::TAG_BURN_TIME)));
$nbt->setShort(self::TAG_MAX_TIME, $nbt->getShort(self::TAG_BURN_TIME), true);
$nbt->removeTag(self::TAG_BURN_TICKS);
}
if(!$nbt->getTag(self::TAG_BURN_TICKS, ShortTag::class)){
$nbt->setTag(new ShortTag(self::TAG_BURN_TICKS, 0));
$nbt->setShort(self::TAG_BURN_TICKS, 0, true);
}
parent::__construct($level, $nbt);

View File

@ -39,11 +39,11 @@ class ItemFrame extends Spawnable{
public function __construct(Level $level, CompoundTag $nbt){
if(!$nbt->hasTag(self::TAG_ITEM_ROTATION, ByteTag::class)){
$nbt->setTag(new ByteTag(self::TAG_ITEM_ROTATION, 0));
$nbt->setByte(self::TAG_ITEM_ROTATION, 0, true);
}
if(!$nbt->hasTag(self::TAG_ITEM_DROP_CHANCE, FloatTag::class)){
$nbt->setTag(new FloatTag(self::TAG_ITEM_DROP_CHANCE, 1.0));
$nbt->setFloat(self::TAG_ITEM_DROP_CHANCE, 1.0, true);
}
parent::__construct($level, $nbt);

View File

@ -38,15 +38,17 @@ class Skull extends Spawnable{
const TYPE_CREEPER = 4;
const TYPE_DRAGON = 5;
const TAG_SKULL_TYPE = "SkullType";
const TAG_ROT = "Rot";
const TAG_SKULL_TYPE = "SkullType"; //TAG_Byte
const TAG_ROT = "Rot"; //TAG_Byte
const TAG_MOUTH_MOVING = "MouthMoving"; //TAG_Byte
const TAG_MOUTH_TICK_COUNT = "MouthTickCount"; //TAG_Int
public function __construct(Level $level, CompoundTag $nbt){
if(!$nbt->hasTag(self::TAG_SKULL_TYPE, ByteTag::class)){
$nbt->setTag(new ByteTag(self::TAG_SKULL_TYPE, 0));
$nbt->setByte(self::TAG_SKULL_TYPE, 0, true);
}
if(!$nbt->hasTag(self::TAG_ROT, ByteTag::class)){
$nbt->setTag(new ByteTag(self::TAG_ROT, 0));
$nbt->setByte(self::TAG_ROT, 0, true);
}
parent::__construct($level, $nbt);
}