mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-03 08:39:53 +00:00
Fixed Anvil levels duplicating saved entities
This commit is contained in:
parent
61d84c73d0
commit
25f8e8318b
@ -161,8 +161,7 @@ class Arrow extends Projectile{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function attack($damage, $source = EntityDamageEvent::CAUSE_MAGIC){
|
public function attack($damage, $source = EntityDamageEvent::CAUSE_MAGIC){
|
||||||
$this->setLastDamageCause($source);
|
|
||||||
$this->setHealth($this->getHealth() - $damage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function heal($amount){
|
public function heal($amount){
|
||||||
@ -170,6 +169,7 @@ class Arrow extends Projectile{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function saveNBT(){
|
public function saveNBT(){
|
||||||
|
parent::saveNBT();
|
||||||
$this->namedtag->Age = new Short("Age", $this->age);
|
$this->namedtag->Age = new Short("Age", $this->age);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,6 +114,7 @@ class DroppedItem extends Entity{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function saveNBT(){
|
public function saveNBT(){
|
||||||
|
parent::saveNBT();
|
||||||
$this->namedtag->Item = new Compound("Item", [
|
$this->namedtag->Item = new Compound("Item", [
|
||||||
"id" => new Short("id", $this->item->getID()),
|
"id" => new Short("id", $this->item->getID()),
|
||||||
"Damage" => new Short("Damage", $this->item->getDamage()),
|
"Damage" => new Short("Damage", $this->item->getDamage()),
|
||||||
|
@ -98,49 +98,8 @@ abstract class BaseChunk extends BaseFullChunk implements Chunk{
|
|||||||
$this->biomeColors = array_fill(0, 256, Binary::readInt("\x00\x85\xb2\x4a"));
|
$this->biomeColors = array_fill(0, 256, Binary::readInt("\x00\x85\xb2\x4a"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->provider instanceof LevelProvider){
|
$this->NBTtiles = $tiles;
|
||||||
$this->provider->getLevel()->timings->syncChunkLoadEntitiesTimer->startTiming();
|
$this->NBTentities = $entities;
|
||||||
foreach($entities as $nbt){
|
|
||||||
if($nbt instanceof Compound){
|
|
||||||
if(!isset($nbt->id)){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: add all entities
|
|
||||||
if($nbt->id instanceof String){ //New format
|
|
||||||
switch($nbt["id"]){
|
|
||||||
case "Item":
|
|
||||||
(new DroppedItem($this, $nbt))->spawnToAll();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}else{ //Old format
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$this->getProvider()->getLevel()->timings->syncChunkLoadEntitiesTimer->stopTiming();
|
|
||||||
|
|
||||||
$this->getProvider()->getLevel()->timings->syncChunkLoadTileEntitiesTimer->startTiming();
|
|
||||||
foreach($tiles as $nbt){
|
|
||||||
if($nbt instanceof Compound){
|
|
||||||
if(!isset($nbt->id)){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
switch($nbt["id"]){
|
|
||||||
case Tile::CHEST:
|
|
||||||
new Chest($this, $nbt);
|
|
||||||
break;
|
|
||||||
case Tile::FURNACE:
|
|
||||||
new Furnace($this, $nbt);
|
|
||||||
break;
|
|
||||||
case Tile::SIGN:
|
|
||||||
new Sign($this, $nbt);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$this->getProvider()->getLevel()->timings->syncChunkLoadTileEntitiesTimer->stopTiming();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBlock($x, $y, $z, &$blockId, &$meta = null){
|
public function getBlock($x, $y, $z, &$blockId, &$meta = null){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user