Furnaces and Burning items

This commit is contained in:
Shoghi Cervantes 2013-05-25 19:06:31 +02:00
parent 221da1685e
commit f224c26084
10 changed files with 253 additions and 16 deletions

View file

@ -105,6 +105,30 @@ class Item{
return $this->maxStackSize;
}
final public function getFuelTime(){
if(!isset(FuelData::$duration[$this->id])){
return false;
}
return FuelData::$duration[$this->id];
}
final public function getSmeltItem(){
if(!isset(SmeltingData::$product[$this->id])){
return false;
}
if(isset(SmeltingData::$product[$this->id][0]) and !is_array(SmeltingData::$product[$this->id][0])){
return BlockAPI::getItem(SmeltingData::$product[$this->id][0], SmeltingData::$product[$this->id][1]);
}
if(!isset(SmeltingData::$product[$this->id][$this->meta])){
return false;
}
return BlockAPI::getItem(SmeltingData::$product[$this->id][$this->meta][0], SmeltingData::$product[$this->id][$this->meta][1]);
}
final public function isPickaxe(){ //Returns false or level of the pickaxe
switch($this->id){
case IRON_PICKAXE:

View file

@ -96,10 +96,12 @@ class BurningFurnaceBlock extends SolidBlock{
"title" => "Furnace",
));
$slots = array();
for($s = 0; $s < FURNACE_SLOTS; ++$s){
for($s = 0; $s <= FURNACE_SLOTS; ++$s){
$slot = $furnace->getSlot($s);
if($slot->getID() > 0 and $slot->count > 0){
$slots[] = $slot;
}else{
$slots[] = BlockAPI::getItem(AIR, 0, 0);
}
}
$player->dataPacket(MC_CONTAINER_SET_CONTENT, array(

View file

@ -113,10 +113,12 @@ class ChestBlock extends TransparentBlock{
"title" => "Chest",
));
$slots = array();
for($s = 0; $s < CHEST_SLOTS; ++$s){
for($s = 0; $s <= CHEST_SLOTS; ++$s){
$slot = $chest->getSlot($s);
if($slot->getID() > 0 and $slot->count > 0){
$slots[] = $slot;
}else{
$slots[] = BlockAPI::getItem(AIR, 0, 0);
}
}
$player->dataPacket(MC_CONTAINER_SET_CONTENT, array(

View file

@ -27,7 +27,7 @@ the Free Software Foundation, either version 3 of the License, or
class CoalItem extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(COAL, 0, $count, "Coal");
parent::__construct(COAL, $meta & 0x01, $count, "Coal");
}
}