mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 19:49:44 +00:00
fence
This commit is contained in:
parent
e3ecebb17b
commit
edcf1d0556
11 changed files with 273 additions and 4 deletions
|
|
@ -139,7 +139,17 @@ class BlockAPI{
|
|||
[WOODEN_DOOR, 0],
|
||||
[TRAPDOOR, 0],
|
||||
[FENCE, 0],
|
||||
[FENCE, 1],
|
||||
[FENCE, 2],
|
||||
[FENCE, 3],
|
||||
[FENCE, 4],
|
||||
[FENCE, 5],
|
||||
[FENCE_GATE, 0],
|
||||
[SPRUCE_FENCE_GATE, 0],
|
||||
[BIRCH_FENCE_GATE, 0],
|
||||
[JUNGLE_FENCE_GATE, 0],
|
||||
[ACACIA_FENCE_GATE, 0],
|
||||
[DARK_OAK_FENCE_GATE, 0],
|
||||
[IRON_BARS, 0],
|
||||
[BED, 0],
|
||||
[BOOKSHELF, 0],
|
||||
|
|
|
|||
|
|
@ -157,6 +157,11 @@ define("REEDS", 83);
|
|||
define("SUGARCANE_BLOCK", 83);
|
||||
|
||||
define("FENCE", 85);
|
||||
define("SPRUCE_FENCE", "85:1");
|
||||
define("BIRCH_FENCE", "85:2");
|
||||
define("JUNGLE_FENCE", "85:3");
|
||||
define("ACACIA_FENCE", "85:4");
|
||||
define("DARK_OAK_FENCE", "85:5");
|
||||
define("PUMPKIN", 86);
|
||||
define("NETHERRACK", 87);
|
||||
define("SOUL_SAND", 88);
|
||||
|
|
@ -184,6 +189,11 @@ define("PUMPKIN_STEM", 104);
|
|||
define("MELON_STEM", 105);
|
||||
define("VINES", 106);
|
||||
define("FENCE_GATE", 107);
|
||||
define("SPRUCE_FENCE_GATE", 183);
|
||||
define("BIRCH_FENCE_GATE", 184);
|
||||
define("JUNGLE_FENCE_GATE", 185);
|
||||
define("ACACIA_FENCE_GATE", 186);
|
||||
define("DARK_OAK_FENCE_GATE", 187);
|
||||
define("BRICK_STAIRS", 108);
|
||||
define("STONE_BRICK_STAIRS", 109);
|
||||
define("MYCELIUM", 110);
|
||||
|
|
|
|||
|
|
@ -151,6 +151,11 @@ abstract class Block extends Position{
|
|||
PODZOL => "PodzolBlock",
|
||||
STAINED_CLAY => "StainedClayBlock",
|
||||
LILY_PAD => "LilypadBlock",
|
||||
SPRUCE_FENCE_GATE => "SpruceFenceGateBlock",
|
||||
BIRCH_FENCE_GATE => "BirchFenceGateBlock",
|
||||
JUNGLE_FENCE_GATE => "JungleFenceGateBlock",
|
||||
ACACIA_FENCE_GATE => "AcaciaFenceGateBlock",
|
||||
DARK_OAK_FENCE_GATE => "DarkOakFenceGate"
|
||||
);
|
||||
protected $id;
|
||||
protected $meta;
|
||||
|
|
|
|||
44
src/material/block/nonfull/AcaciaFenceGateBlock.php
Normal file
44
src/material/block/nonfull/AcaciaFenceGateBlock.php
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
class AcaciaFenceGateBlock extends TransparentBlock{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(ACACIA_FENCE_GATE, $meta, "Acacia Fence Gate");
|
||||
$this->isActivable = true;
|
||||
if(($this->meta & 0x04) === 0x04){
|
||||
$this->isFullBlock = true;
|
||||
}else{
|
||||
$this->isFullBlock = false;
|
||||
}
|
||||
$this->hardness = 15;
|
||||
}
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$faces = array(
|
||||
0 => 3,
|
||||
1 => 0,
|
||||
2 => 1,
|
||||
3 => 2,
|
||||
);
|
||||
$this->meta = $faces[$player->entity->getDirection()] & 0x03;
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
return true;
|
||||
}
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
}
|
||||
public function onActivate(Item $item, Player $player){
|
||||
$this->meta ^= 0x04;
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
$players = ServerAPI::request()->api->player->getAll($this->level);
|
||||
unset($players[$player->CID]);
|
||||
$pk = new LevelEventPacket;
|
||||
$pk->x = $this->x;
|
||||
$pk->y = $this->y;
|
||||
$pk->z = $this->z;
|
||||
$pk->evid = 1003;
|
||||
$pk->data = 0;
|
||||
ServerAPI::request()->api->player->broadcastPacket($players, $pk);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
44
src/material/block/nonfull/BirchFenceGateBlock.php
Normal file
44
src/material/block/nonfull/BirchFenceGateBlock.php
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
class BirchFenceGateBlock extends TransparentBlock{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(BIRCH_FENCE_GATE, $meta, "Birch Fence Gate");
|
||||
$this->isActivable = true;
|
||||
if(($this->meta & 0x04) === 0x04){
|
||||
$this->isFullBlock = true;
|
||||
}else{
|
||||
$this->isFullBlock = false;
|
||||
}
|
||||
$this->hardness = 15;
|
||||
}
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$faces = array(
|
||||
0 => 3,
|
||||
1 => 0,
|
||||
2 => 1,
|
||||
3 => 2,
|
||||
);
|
||||
$this->meta = $faces[$player->entity->getDirection()] & 0x03;
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
return true;
|
||||
}
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
}
|
||||
public function onActivate(Item $item, Player $player){
|
||||
$this->meta ^= 0x04;
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
$players = ServerAPI::request()->api->player->getAll($this->level);
|
||||
unset($players[$player->CID]);
|
||||
$pk = new LevelEventPacket;
|
||||
$pk->x = $this->x;
|
||||
$pk->y = $this->y;
|
||||
$pk->z = $this->z;
|
||||
$pk->evid = 1003;
|
||||
$pk->data = 0;
|
||||
ServerAPI::request()->api->player->broadcastPacket($players, $pk);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
44
src/material/block/nonfull/DarkOakFenceGateBlock.php
Normal file
44
src/material/block/nonfull/DarkOakFenceGateBlock.php
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
class DarkOakFenceGateBlock extends TransparentBlock{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(DARK_OAK_FENCE_GATE, $meta, "Dark Oak Fence Gate");
|
||||
$this->isActivable = true;
|
||||
if(($this->meta & 0x04) === 0x04){
|
||||
$this->isFullBlock = true;
|
||||
}else{
|
||||
$this->isFullBlock = false;
|
||||
}
|
||||
$this->hardness = 15;
|
||||
}
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$faces = array(
|
||||
0 => 3,
|
||||
1 => 0,
|
||||
2 => 1,
|
||||
3 => 2,
|
||||
);
|
||||
$this->meta = $faces[$player->entity->getDirection()] & 0x03;
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
return true;
|
||||
}
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
}
|
||||
public function onActivate(Item $item, Player $player){
|
||||
$this->meta ^= 0x04;
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
$players = ServerAPI::request()->api->player->getAll($this->level);
|
||||
unset($players[$player->CID]);
|
||||
$pk = new LevelEventPacket;
|
||||
$pk->x = $this->x;
|
||||
$pk->y = $this->y;
|
||||
$pk->z = $this->z;
|
||||
$pk->evid = 1003;
|
||||
$pk->data = 0;
|
||||
ServerAPI::request()->api->player->broadcastPacket($players, $pk);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,17 @@
|
|||
<?php
|
||||
|
||||
class FenceBlock extends TransparentBlock{
|
||||
public function __construct(){
|
||||
parent::__construct(FENCE, 0, "Fence");
|
||||
public function __construct($meta){
|
||||
parent::__construct(FENCE, $meta, "Fence");
|
||||
$names = [
|
||||
0 => "Oak Fence",
|
||||
1 => "Spruce Fence",
|
||||
2 => "Birch Fence",
|
||||
3 => "Jungle Fence",
|
||||
4 => "Acacia Fence",
|
||||
5 => "Dark Oak Fence"
|
||||
];
|
||||
$this->name = $names[$this->meta & 0x07];
|
||||
$this->isFullBlock = false;
|
||||
$this->hardness = 15;
|
||||
}
|
||||
|
|
|
|||
44
src/material/block/nonfull/JungleFenceGateBlock.php
Normal file
44
src/material/block/nonfull/JungleFenceGateBlock.php
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
class JungleFenceGateBlock extends TransparentBlock{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(JUNGLE_FENCE_GATE, $meta, "Jungle Fence Gate");
|
||||
$this->isActivable = true;
|
||||
if(($this->meta & 0x04) === 0x04){
|
||||
$this->isFullBlock = true;
|
||||
}else{
|
||||
$this->isFullBlock = false;
|
||||
}
|
||||
$this->hardness = 15;
|
||||
}
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$faces = array(
|
||||
0 => 3,
|
||||
1 => 0,
|
||||
2 => 1,
|
||||
3 => 2,
|
||||
);
|
||||
$this->meta = $faces[$player->entity->getDirection()] & 0x03;
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
return true;
|
||||
}
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
}
|
||||
public function onActivate(Item $item, Player $player){
|
||||
$this->meta ^= 0x04;
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
$players = ServerAPI::request()->api->player->getAll($this->level);
|
||||
unset($players[$player->CID]);
|
||||
$pk = new LevelEventPacket;
|
||||
$pk->x = $this->x;
|
||||
$pk->y = $this->y;
|
||||
$pk->z = $this->z;
|
||||
$pk->evid = 1003;
|
||||
$pk->data = 0;
|
||||
ServerAPI::request()->api->player->broadcastPacket($players, $pk);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
44
src/material/block/nonfull/SpruceFenceGateBlock.php
Normal file
44
src/material/block/nonfull/SpruceFenceGateBlock.php
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
class SpruceFenceGateBlock extends TransparentBlock{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(SPRUCE_FENCE_GATE, $meta, "Spruce Fence Gate");
|
||||
$this->isActivable = true;
|
||||
if(($this->meta & 0x04) === 0x04){
|
||||
$this->isFullBlock = true;
|
||||
}else{
|
||||
$this->isFullBlock = false;
|
||||
}
|
||||
$this->hardness = 15;
|
||||
}
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$faces = array(
|
||||
0 => 3,
|
||||
1 => 0,
|
||||
2 => 1,
|
||||
3 => 2,
|
||||
);
|
||||
$this->meta = $faces[$player->entity->getDirection()] & 0x03;
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
return true;
|
||||
}
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
}
|
||||
public function onActivate(Item $item, Player $player){
|
||||
$this->meta ^= 0x04;
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
$players = ServerAPI::request()->api->player->getAll($this->level);
|
||||
unset($players[$player->CID]);
|
||||
$pk = new LevelEventPacket;
|
||||
$pk->x = $this->x;
|
||||
$pk->y = $this->y;
|
||||
$pk->z = $this->z;
|
||||
$pk->evid = 1003;
|
||||
$pk->data = 0;
|
||||
ServerAPI::request()->api->player->broadcastPacket($players, $pk);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -92,8 +92,18 @@ class CraftingRecipes{
|
|||
//Building
|
||||
"WOOL:?x3,WOODEN_PLANKS:?x3=>BED:0x1",
|
||||
"WOODEN_PLANKS:?x8=>CHEST:0x1",
|
||||
"STICK:?x6=>FENCE:0x2",
|
||||
"STICK:?x4,WOODEN_PLANKS:?x2=>FENCE_GATE:0x1",
|
||||
"STICK:?x2,WOODEN_PLANKS:0x4=>FENCE:0x3",
|
||||
"STICK:?x2,WOODEN_PLANKS:1x4=>FENCE:1x3",
|
||||
"STICK:?x2,WOODEN_PLANKS:2x4=>FENCE:2x3",
|
||||
"STICK:?x2,WOODEN_PLANKS:3x4=>FENCE:3x3",
|
||||
"STICK:?x2,WOODEN_PLANKS:4x4=>FENCE:4x3",
|
||||
"STICK:?x2,WOODEN_PLANKS:5x4=>FENCE:5x3",
|
||||
"STICK:?x4,WOODEN_PLANKS:0x2=>FENCE_GATE:0x1",
|
||||
"STICK:?x4,WOODEN_PLANKS:1x2=>SPRUCE_FENCE_GATE:0x1",
|
||||
"STICK:?x4,WOODEN_PLANKS:2x2=>BIRCH_FENCE_GATE:0x1",
|
||||
"STICK:?x4,WOODEN_PLANKS:3x2=>JUNGLE_FENCE_GATE:0x1",
|
||||
"STICK:?x4,WOODEN_PLANKS:4x2=>ACACIA_FENCE_GATE:0x1",
|
||||
"STICK:?x4,WOODEN_PLANKS:5x2=>DARK_OAK_FENCE_GATE:0x1",
|
||||
"COBBLESTONE:?x8=>FURNACE:0x1",
|
||||
"GLASS:?x6=>GLASS_PANE:0x16",
|
||||
"STICK:?x7=>LADDER:0x2",
|
||||
|
|
|
|||
|
|
@ -16,6 +16,11 @@ class FuelData{
|
|||
STICK => 5,
|
||||
FENCE => 15,
|
||||
FENCE_GATE => 15,
|
||||
SPRUCE_FENCE_GATE => 15,
|
||||
BIRCH_FENCE_GATE => 15,
|
||||
JUNGLE_FENCE_GATE => 15,
|
||||
ACACIA_FENCE_GATE => 15,
|
||||
DARK_OAK_FENCE_GATE => 15,
|
||||
WOODEN_STAIRS => 15,
|
||||
SPRUCE_WOOD_STAIRS => 15,
|
||||
BIRCH_WOOD_STAIRS => 15,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue