mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 03:59:43 +00:00
Merge branch '0.9.5' of https://github.com/kotyaralih/NostalgiaCore into 0.9.5
This commit is contained in:
commit
abe20e8cdf
11 changed files with 135 additions and 6 deletions
|
|
@ -69,6 +69,8 @@ class BlockAPI{
|
|||
[OBSIDIAN, 0],
|
||||
[ICE, 0],
|
||||
[SNOW_BLOCK, 0],
|
||||
[BROWN_MUSHROOM_BLOCK, 0],
|
||||
[RED_MUSHROOM_BLOCK, 0],
|
||||
|
||||
//Decoration
|
||||
[COBBLESTONE_WALL, 0],
|
||||
|
|
@ -165,6 +167,7 @@ class BlockAPI{
|
|||
[CARPET, 9],
|
||||
[CARPET, 8],
|
||||
[END_PORTAL_FRAME, 0],
|
||||
[MONSTER_SPAWNER, 0],
|
||||
|
||||
//Tools
|
||||
[RAIL, 0],
|
||||
|
|
|
|||
|
|
@ -173,8 +173,8 @@ define("TRAPDOOR", 96);
|
|||
define("STONE_BRICKS", 98);
|
||||
define("STONE_BRICK", 98);
|
||||
//ANOTHER STONE BRICKS
|
||||
define("HUGE_BROWN_MUSHROOM", 99);
|
||||
define("HUGE_RED_MUSHROOM", 100);
|
||||
define("BROWN_MUSHROOM_BLOCK", 99);
|
||||
define("RED_MUSHROOM_BLOCK", 100);
|
||||
define("IRON_BAR", 101);
|
||||
define("IRON_BARS", 101);
|
||||
define("GLASS_PANE", 102);
|
||||
|
|
@ -211,7 +211,7 @@ define("JUNGLE_WOODEN_STAIRS", 136);
|
|||
define("COBBLE_WALL", 139);
|
||||
define("STONE_WALL", 139);
|
||||
define("COBBLESTONE_WALL", 139);
|
||||
//MOSSY STONE WALL?
|
||||
define("MOSSY_COBBLESTONE_WALL", "139:1");
|
||||
|
||||
define("CARROT_BLOCK", 141);
|
||||
define("POTATO_BLOCK", 142);
|
||||
|
|
|
|||
|
|
@ -142,6 +142,10 @@ abstract class Block extends Position{
|
|||
LOG2 => "Log2Block",
|
||||
LEAVES2 => "Leaves2Block",
|
||||
END_PORTAL_FRAME => "EndPortalFrameBlock",
|
||||
COCOA => "CocoaBlock",
|
||||
RED_MUSHROOM_BLOCK => "RedMushroomSolidBlock",
|
||||
BROWN_MUSHROOM_BLOCK => "BrownMushroomSolidBlock",
|
||||
MONSTER_SPAWNER => "MonsterSpawnerBlock",
|
||||
);
|
||||
protected $id;
|
||||
protected $meta;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ class LadderBlock extends TransparentBlock{
|
|||
$this->isFullBlock = false;
|
||||
$this->hardness = 2;
|
||||
}
|
||||
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
if($face === 0 || $face === 1){
|
||||
return false; //fix of placing invalid ids without array
|
||||
|
|
@ -20,7 +21,6 @@ class LadderBlock extends TransparentBlock{
|
|||
}
|
||||
|
||||
public function onUpdate($type){
|
||||
|
||||
if($type === BLOCK_UPDATE_NORMAL){
|
||||
$side = $this->getMetadata();
|
||||
$faces = array( //magical tranformation
|
||||
|
|
|
|||
|
|
@ -2,14 +2,15 @@
|
|||
|
||||
class StoneWallBlock extends TransparentBlock{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(STONE_WALL, $meta & 0x01, $meta === 1 ? "Mossy Cobblestone Wall" : "Cobblestone Wall");
|
||||
parent::__construct(COBBLESTONE_WALL, $meta & 0x01, $meta === 1 ? "Mossy Cobblestone Wall" : "Cobblestone Wall");
|
||||
$this->isFullBlock = false;
|
||||
$this->isSolid = false;
|
||||
$this->hardness = 30;
|
||||
}
|
||||
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if($item->isPickaxe()){
|
||||
return [[STONE_WALL, $this->getMetadata(),1]];
|
||||
return [[COBBLESTONE_WALL, $this->getMetadata(), 1]];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
|
|
|||
71
src/material/block/plant/CocoaBlock.php
Normal file
71
src/material/block/plant/CocoaBlock.php
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
|
||||
class CocoaBlock extends FlowableBlock{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(COCOA, $meta, "tile.cocoa.name<");
|
||||
$this->isActivable = true;
|
||||
$this->hardness = 0;
|
||||
}
|
||||
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
if($target->getID() === WOOD and ($target->getMetadata() & 0x03) === 0x03){
|
||||
//$this->meta = $face;
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function onActivate(Item $item, Player $player){
|
||||
if($item->getID() === DYE and $item->getMetadata() === 0x0F){ //Bonemeal
|
||||
$this->meta++;
|
||||
if($this->meta > 0x02){
|
||||
$this->meta = 0x02;
|
||||
}
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
if(($player->gamemode & 0x01) === 0){
|
||||
$player->removeItem(DYE, 0x0F, 1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function onUpdate($type){
|
||||
if($type === BLOCK_UPDATE_NORMAL){
|
||||
/*$side = $this->getMetadata();
|
||||
$faces = array( //magical tranformation
|
||||
3 => 2,
|
||||
2 => 3,
|
||||
5 => 4,
|
||||
4 => 5,
|
||||
);
|
||||
if($this->getSide($faces[$side]) instanceof AirBlock){ //Replace with common break method
|
||||
ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem($this->id, 0, 1));
|
||||
$this->level->setBlock($this, new AirBlock(), true, false, true);
|
||||
return BLOCK_UPDATE_NORMAL;
|
||||
}*/
|
||||
}elseif($type === BLOCK_UPDATE_RANDOM){
|
||||
if(mt_rand(0, 2) == 1){
|
||||
if($this->meta < 0x03){
|
||||
++$this->meta;
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
return BLOCK_UPDATE_RANDOM;
|
||||
}
|
||||
}else{
|
||||
return BLOCK_UPDATE_RANDOM;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getDrops(Item $item, Player $player){
|
||||
$drops = [];
|
||||
if($this->meta >= 0x02){
|
||||
$drops[] = [DYE, 3, mt_rand(1, 4)];
|
||||
}else{
|
||||
$drops[] = [DYE, 3, 1];
|
||||
}
|
||||
return $drops;
|
||||
}
|
||||
}
|
||||
19
src/material/block/solid/BrownMushroomBlock.php
Normal file
19
src/material/block/solid/BrownMushroomBlock.php
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
class BrownMushroomSolidBlock extends SolidBlock{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(BROWN_MUSHROOM_BLOCK, $meta, "Mushroom");
|
||||
$this->hardness = 0.2;
|
||||
}
|
||||
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
//todo
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
}
|
||||
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return [
|
||||
[BROWN_MUSHROOM, 0, mt_rand(0, 2)]
|
||||
];
|
||||
}
|
||||
}
|
||||
12
src/material/block/solid/MonsterSpawnerBlock.php
Normal file
12
src/material/block/solid/MonsterSpawnerBlock.php
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
class MonsterSpawnerBlock extends SolidBlock{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(MONSTER_SPAWNER, $meta, "Monster Spawner");
|
||||
$this->hardness = 5;
|
||||
}
|
||||
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return [];
|
||||
}
|
||||
}
|
||||
19
src/material/block/solid/RedMushroomBlock.php
Normal file
19
src/material/block/solid/RedMushroomBlock.php
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
class RedMushroomSolidBlock extends SolidBlock{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(RED_MUSHROOM_BLOCK, $meta, "Mushroom");
|
||||
$this->hardness = 0.2;
|
||||
}
|
||||
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
//todo
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
}
|
||||
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return [
|
||||
[RED_MUSHROOM, 0, mt_rand(0, 2)]
|
||||
];
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue