mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
Removed useless confusing array indices in CompoundTag constructors (#1116)
This commit is contained in:
@ -548,8 +548,8 @@ class Item implements ItemIds, \JsonSerializable{
|
||||
foreach($tag->ench as $k => $entry){
|
||||
if($entry["id"] === $ench->getId()){
|
||||
$tag->ench->{$k} = new CompoundTag("", [
|
||||
"id" => new ShortTag("id", $ench->getId()),
|
||||
"lvl" => new ShortTag("lvl", $ench->getLevel())
|
||||
new ShortTag("id", $ench->getId()),
|
||||
new ShortTag("lvl", $ench->getLevel())
|
||||
]);
|
||||
$found = true;
|
||||
break;
|
||||
@ -558,8 +558,8 @@ class Item implements ItemIds, \JsonSerializable{
|
||||
|
||||
if(!$found){
|
||||
$tag->ench->{count($tag->ench) + 1} = new CompoundTag("", [
|
||||
"id" => new ShortTag("id", $ench->getId()),
|
||||
"lvl" => new ShortTag("lvl", $ench->getLevel())
|
||||
new ShortTag("id", $ench->getId()),
|
||||
new ShortTag("lvl", $ench->getLevel())
|
||||
]);
|
||||
}
|
||||
|
||||
@ -643,7 +643,7 @@ class Item implements ItemIds, \JsonSerializable{
|
||||
$tag->display->Name = new StringTag("Name", $name);
|
||||
}else{
|
||||
$tag->display = new CompoundTag("display", [
|
||||
"Name" => new StringTag("Name", $name)
|
||||
new StringTag("Name", $name)
|
||||
]);
|
||||
}
|
||||
|
||||
@ -1009,9 +1009,9 @@ class Item implements ItemIds, \JsonSerializable{
|
||||
*/
|
||||
public function nbtSerialize(int $slot = -1, string $tagName = "") : CompoundTag{
|
||||
$tag = new CompoundTag($tagName, [
|
||||
"id" => new ShortTag("id", $this->id),
|
||||
"Count" => new ByteTag("Count", Binary::signByte($this->count)),
|
||||
"Damage" => new ShortTag("Damage", $this->meta),
|
||||
new ShortTag("id", $this->id),
|
||||
new ByteTag("Count", Binary::signByte($this->count)),
|
||||
new ShortTag("Damage", $this->meta),
|
||||
]);
|
||||
|
||||
if($this->hasCompoundTag()){
|
||||
|
@ -44,17 +44,17 @@ class SpawnEgg extends Item{
|
||||
|
||||
public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$nbt = new CompoundTag("", [
|
||||
"Pos" => new ListTag("Pos", [
|
||||
new ListTag("Pos", [
|
||||
new DoubleTag("", $block->getX() + 0.5),
|
||||
new DoubleTag("", $block->getY()),
|
||||
new DoubleTag("", $block->getZ() + 0.5)
|
||||
]),
|
||||
"Motion" => new ListTag("Motion", [
|
||||
new ListTag("Motion", [
|
||||
new DoubleTag("", 0),
|
||||
new DoubleTag("", 0),
|
||||
new DoubleTag("", 0)
|
||||
]),
|
||||
"Rotation" => new ListTag("Rotation", [
|
||||
new ListTag("Rotation", [
|
||||
new FloatTag("", lcg_value() * 360),
|
||||
new FloatTag("", 0)
|
||||
]),
|
||||
|
Reference in New Issue
Block a user