Fixed spawn eggs & buckets on creative ,pde

This commit is contained in:
Shoghi Cervantes 2013-06-06 23:31:46 +02:00
parent 96c11adc89
commit 139d8b38b5
3 changed files with 16 additions and 4 deletions

View File

@ -37,19 +37,25 @@ class BucketItem extends Item{
if($this->meta === AIR){ if($this->meta === AIR){
if($target instanceof LiquidBlock){ if($target instanceof LiquidBlock){
$level->setBlock($target, new AirBlock()); $level->setBlock($target, new AirBlock());
if(($player->gamemode & 0x01) === 0){
$this->meta = ($target instanceof WaterBlock) ? WATER:LAVA; $this->meta = ($target instanceof WaterBlock) ? WATER:LAVA;
}
return true; return true;
} }
}elseif($this->meta === WATER){ }elseif($this->meta === WATER){
if($block->getID() === AIR){ if($block->getID() === AIR){
$level->setBlock($block, new StillWaterBLock()); $level->setBlock($block, new StillWaterBLock());
if(($player->gamemode & 0x01) === 0){
$this->meta = 0; $this->meta = 0;
}
return true; return true;
} }
}elseif($this->meta === LAVA){ }elseif($this->meta === LAVA){
if($block->getID() === AIR){ if($block->getID() === AIR){
$level->setBlock($block, new StillLavaBlock()); $level->setBlock($block, new StillLavaBlock());
if(($player->gamemode & 0x01) === 0){
$this->meta = 0; $this->meta = 0;
}
return true; return true;
} }
} }

View File

@ -45,7 +45,9 @@ class SpawnEggItem extends Item{
); );
$e = ServerAPI::request()->api->entity->add($block->level, ENTITY_MOB, $this->meta, $data); $e = ServerAPI::request()->api->entity->add($block->level, ENTITY_MOB, $this->meta, $data);
ServerAPI::request()->api->entity->spawnToAll($e); ServerAPI::request()->api->entity->spawnToAll($e);
if(($player->gamemode & 0x01) === 0){
--$this->count; --$this->count;
}
return true; return true;
break; break;
} }

View File

@ -530,6 +530,10 @@ class Entity extends Position{
17 => array("type" => 6, "value" => array(0, 0, 0)), 17 => array("type" => 6, "value" => array(0, 0, 0)),
); );
if($this->class === ENTITY_MOB and $this->type === MOB_SHEEP){ if($this->class === ENTITY_MOB and $this->type === MOB_SHEEP){
if(!isset($this->data["Sheared"])){
$this->data["Sheared"] = 0;
$this->data["Color"] = mt_rand(0,15);
}
$d[16]["value"] = (($this->data["Sheared"] == 1 ? 1:0) << 5) | ($this->data["Color"] & 0x0F); $d[16]["value"] = (($this->data["Sheared"] == 1 ? 1:0) << 5) | ($this->data["Color"] & 0x0F);
} }
return $d; return $d;