mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
Renamed NBT tags to have Tag in the name
This commit is contained in:
@ -31,10 +31,10 @@ use pocketmine\item\Item;
|
||||
use pocketmine\level\format\FullChunk;
|
||||
use pocketmine\nbt\NBT;
|
||||
|
||||
use pocketmine\nbt\tag\Compound;
|
||||
use pocketmine\nbt\tag\Enum;
|
||||
use pocketmine\nbt\tag\Short;
|
||||
use pocketmine\nbt\tag\String;
|
||||
use pocketmine\nbt\tag\CompoundTag;
|
||||
use pocketmine\nbt\tag\ListTag;
|
||||
use pocketmine\nbt\tag\ShortTag;
|
||||
use pocketmine\nbt\tag\StringTag;
|
||||
use pocketmine\network\Network;
|
||||
use pocketmine\network\protocol\ContainerSetDataPacket;
|
||||
|
||||
@ -42,12 +42,12 @@ class Furnace extends Tile implements InventoryHolder, Container, Nameable{
|
||||
/** @var FurnaceInventory */
|
||||
protected $inventory;
|
||||
|
||||
public function __construct(FullChunk $chunk, Compound $nbt){
|
||||
public function __construct(FullChunk $chunk, CompoundTag $nbt){
|
||||
parent::__construct($chunk, $nbt);
|
||||
$this->inventory = new FurnaceInventory($this);
|
||||
|
||||
if(!isset($this->namedtag->Items) or !($this->namedtag->Items instanceof Enum)){
|
||||
$this->namedtag->Items = new Enum("Items", []);
|
||||
if(!isset($this->namedtag->Items) or !($this->namedtag->Items instanceof ListTag)){
|
||||
$this->namedtag->Items = new ListTag("Items", []);
|
||||
$this->namedtag->Items->setTagType(NBT::TAG_Compound);
|
||||
}
|
||||
|
||||
@ -56,14 +56,14 @@ class Furnace extends Tile implements InventoryHolder, Container, Nameable{
|
||||
}
|
||||
|
||||
if(!isset($this->namedtag->BurnTime) or $this->namedtag["BurnTime"] < 0){
|
||||
$this->namedtag->BurnTime = new Short("BurnTime", 0);
|
||||
$this->namedtag->BurnTime = new ShortTag("BurnTime", 0);
|
||||
}
|
||||
if(!isset($this->namedtag->CookTime) or $this->namedtag["CookTime"] < 0 or ($this->namedtag["BurnTime"] === 0 and $this->namedtag["CookTime"] > 0)){
|
||||
$this->namedtag->CookTime = new Short("CookTime", 0);
|
||||
$this->namedtag->CookTime = new ShortTag("CookTime", 0);
|
||||
}
|
||||
if(!isset($this->namedtag->MaxTime)){
|
||||
$this->namedtag->MaxTime = new Short("BurnTime", $this->namedtag["BurnTime"]);
|
||||
$this->namedtag->BurnTicks = new Short("BurnTicks", 0);
|
||||
$this->namedtag->MaxTime = new ShortTag("BurnTime", $this->namedtag["BurnTime"]);
|
||||
$this->namedtag->BurnTicks = new ShortTag("BurnTicks", 0);
|
||||
}
|
||||
if($this->namedtag["BurnTime"] > 0){
|
||||
$this->scheduleUpdate();
|
||||
@ -84,7 +84,7 @@ class Furnace extends Tile implements InventoryHolder, Container, Nameable{
|
||||
return;
|
||||
}
|
||||
|
||||
$this->namedtag->CustomName = new String("CustomName", $str);
|
||||
$this->namedtag->CustomName = new StringTag("CustomName", $str);
|
||||
}
|
||||
|
||||
public function close(){
|
||||
@ -97,7 +97,7 @@ class Furnace extends Tile implements InventoryHolder, Container, Nameable{
|
||||
}
|
||||
|
||||
public function saveNBT(){
|
||||
$this->namedtag->Items = new Enum("Items", []);
|
||||
$this->namedtag->Items = new ListTag("Items", []);
|
||||
$this->namedtag->Items->setTagType(NBT::TAG_Compound);
|
||||
for($index = 0; $index < $this->getSize(); ++$index){
|
||||
$this->setItem($index, $this->inventory->getItem($index));
|
||||
@ -187,9 +187,9 @@ class Furnace extends Tile implements InventoryHolder, Container, Nameable{
|
||||
return;
|
||||
}
|
||||
|
||||
$this->namedtag->MaxTime = new Short("MaxTime", $ev->getBurnTime());
|
||||
$this->namedtag->BurnTime = new Short("BurnTime", $ev->getBurnTime());
|
||||
$this->namedtag->BurnTicks = new Short("BurnTicks", 0);
|
||||
$this->namedtag->MaxTime = new ShortTag("MaxTime", $ev->getBurnTime());
|
||||
$this->namedtag->BurnTime = new ShortTag("BurnTime", $ev->getBurnTime());
|
||||
$this->namedtag->BurnTicks = new ShortTag("BurnTicks", 0);
|
||||
if($this->getBlock()->getId() === Item::FURNACE){
|
||||
$this->getLevel()->setBlock($this, Block::get(Item::BURNING_FURNACE, $this->getBlock()->getDamage()), true);
|
||||
}
|
||||
@ -223,11 +223,11 @@ class Furnace extends Tile implements InventoryHolder, Container, Nameable{
|
||||
}
|
||||
|
||||
if($this->namedtag["BurnTime"] > 0){
|
||||
$this->namedtag->BurnTime = new Short("BurnTime", $this->namedtag["BurnTime"] - 1);
|
||||
$this->namedtag->BurnTicks = new Short("BurnTicks", ceil(($this->namedtag["BurnTime"] / $this->namedtag["MaxTime"] * 200)));
|
||||
$this->namedtag->BurnTime = new ShortTag("BurnTime", $this->namedtag["BurnTime"] - 1);
|
||||
$this->namedtag->BurnTicks = new ShortTag("BurnTicks", ceil(($this->namedtag["BurnTime"] / $this->namedtag["MaxTime"] * 200)));
|
||||
|
||||
if($smelt instanceof FurnaceRecipe and $canSmelt){
|
||||
$this->namedtag->CookTime = new Short("CookTime", $this->namedtag["CookTime"] + 1);
|
||||
$this->namedtag->CookTime = new ShortTag("CookTime", $this->namedtag["CookTime"] + 1);
|
||||
if($this->namedtag["CookTime"] >= 200){ //10 seconds
|
||||
$product = Item::get($smelt->getResult()->getId(), $smelt->getResult()->getDamage(), $product->getCount() + 1);
|
||||
|
||||
@ -242,14 +242,14 @@ class Furnace extends Tile implements InventoryHolder, Container, Nameable{
|
||||
$this->inventory->setSmelting($raw);
|
||||
}
|
||||
|
||||
$this->namedtag->CookTime = new Short("CookTime", $this->namedtag["CookTime"] - 200);
|
||||
$this->namedtag->CookTime = new ShortTag("CookTime", $this->namedtag["CookTime"] - 200);
|
||||
}
|
||||
}elseif($this->namedtag["BurnTime"] <= 0){
|
||||
$this->namedtag->BurnTime = new Short("BurnTime", 0);
|
||||
$this->namedtag->CookTime = new Short("CookTime", 0);
|
||||
$this->namedtag->BurnTicks = new Short("BurnTicks", 0);
|
||||
$this->namedtag->BurnTime = new ShortTag("BurnTime", 0);
|
||||
$this->namedtag->CookTime = new ShortTag("CookTime", 0);
|
||||
$this->namedtag->BurnTicks = new ShortTag("BurnTicks", 0);
|
||||
}else{
|
||||
$this->namedtag->CookTime = new Short("CookTime", 0);
|
||||
$this->namedtag->CookTime = new ShortTag("CookTime", 0);
|
||||
}
|
||||
$ret = true;
|
||||
}else{
|
||||
@ -257,9 +257,9 @@ class Furnace extends Tile implements InventoryHolder, Container, Nameable{
|
||||
if($this->getBlock()->getId() === Item::BURNING_FURNACE){
|
||||
$this->getLevel()->setBlock($this, Block::get(Item::FURNACE, $this->getBlock()->getDamage()), true);
|
||||
}
|
||||
$this->namedtag->BurnTime = new Short("BurnTime", 0);
|
||||
$this->namedtag->CookTime = new Short("CookTime", 0);
|
||||
$this->namedtag->BurnTicks = new Short("BurnTicks", 0);
|
||||
$this->namedtag->BurnTime = new ShortTag("BurnTime", 0);
|
||||
$this->namedtag->CookTime = new ShortTag("CookTime", 0);
|
||||
$this->namedtag->BurnTicks = new ShortTag("BurnTicks", 0);
|
||||
}
|
||||
|
||||
foreach($this->getInventory()->getViewers() as $player){
|
||||
|
Reference in New Issue
Block a user