Removed a bunch of TODO and fixed item drops on block update

This commit is contained in:
Shoghi Cervantes
2014-10-13 18:54:34 +02:00
parent 1eec333501
commit b26ee09f76
14 changed files with 26 additions and 131 deletions

View File

@ -363,7 +363,6 @@ class Block extends Position implements Metadatable{
[Item::STONECUTTER, 0],
[Item::CHEST, 0],
[Item::FURNACE, 0],
//TODO: End Portal
[Item::END_PORTAL, 0],
[Item::DANDELION, 0],
[Item::POPPY, 0],

View File

@ -81,9 +81,8 @@ class Carpet extends Flowable{
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->getID() === self::AIR){ //TODO: Replace with common break method
$this->getLevel()->dropItem($this, Item::get($this->id, $this->meta, 1));
$this->getLevel()->setBlock($this, new Air(), true);
if($this->getSide(0)->getID() === self::AIR){
$this->getLevel()->useBreakOn($this);
return Level::BLOCK_UPDATE_NORMAL;
}

View File

@ -49,9 +49,8 @@ class CyanFlower extends Flowable{
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isTransparent === true){ //TODO: Replace with common break method
$this->getLevel()->dropItem($this, Item::get($this->id, 0, 1));
$this->getLevel()->setBlock($this, new Air(), false, false, true);
if($this->getSide(0)->isTransparent === true){
$this->getLevel()->useBreakOn($this);
return Level::BLOCK_UPDATE_NORMAL;
}

View File

@ -49,10 +49,8 @@ class Dandelion extends Flowable{
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isTransparent === true){ //Replace with common break method
//TODO
//Server::getInstance()->api->entity->drop($this, Item::get($this->id));
$this->getLevel()->setBlock($this, new Air(), false, false, true);
if($this->getSide(0)->isTransparent === true){
$this->getLevel()->useBreakOn($this);
return Level::BLOCK_UPDATE_NORMAL;
}

View File

@ -38,10 +38,8 @@ class RedMushroom extends Flowable{
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isTransparent === true){ //Replace with common break method
//TODO
//Server::getInstance()->api->entity->drop($this, Item::get($this->id));
$this->getLevel()->setBlock($this, new Air(), false);
if($this->getSide(0)->isTransparent === true){
$this->getLevel()->useBreakOn($this);
return Level::BLOCK_UPDATE_NORMAL;
}

View File

@ -81,10 +81,8 @@ class Sapling extends Flowable{
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isTransparent === true){ //Replace with common break method
//TODO
//Server::getInstance()->api->entity->drop($this, Item::get($this->id));
$this->getLevel()->setBlock($this, new Air(), false, false, true);
if($this->getSide(0)->isTransparent === true){
$this->getLevel()->useBreakOn($this);
return Level::BLOCK_UPDATE_NORMAL;
}

View File

@ -64,10 +64,8 @@ class SignPost extends Transparent{
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->getID() === self::AIR){ //Replace with common break method
//TODO
//Server::getInstance()->api->entity->drop($this, Item::get(SIGN, 0, 1));
$this->getLevel()->setBlock($this, new Air(), true, true, true);
if($this->getSide(0)->getID() === self::AIR){
$this->getLevel()->useBreakOn($this);
return Level::BLOCK_UPDATE_NORMAL;
}

View File

@ -74,10 +74,8 @@ class Sugarcane extends Flowable{
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
$down = $this->getSide(0);
if($down->isTransparent === true and $down->getID() !== self::SUGARCANE_BLOCK){ //Replace with common break method
//TODO
//Server::getInstance()->api->entity->drop($this, Item::get(SUGARCANE));
$this->getLevel()->setBlock($this, new Air(), false, false, true);
if($down->isTransparent === true and $down->getID() !== self::SUGARCANE_BLOCK){
$this->getLevel()->useBreakOn($this);
return Level::BLOCK_UPDATE_NORMAL;
}