mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-22 20:49:43 +00:00
fixed bugs 71,72,43 and 32
This commit is contained in:
parent
7fb11d97fd
commit
d02c98b2b3
7 changed files with 31 additions and 19 deletions
|
|
@ -154,7 +154,7 @@ class EntityAPI{
|
||||||
"y" => $spawnY,
|
"y" => $spawnY,
|
||||||
"z" => $spawnZ,
|
"z" => $spawnZ,
|
||||||
"Health" => $this->hp[$type],
|
"Health" => $this->hp[$type],
|
||||||
"isBaby" => 1,
|
"IsBaby" => 1,
|
||||||
]);
|
]);
|
||||||
$this->spawnToAll($entityit, $spawnLevel);
|
$this->spawnToAll($entityit, $spawnLevel);
|
||||||
$output .= "Baby " . $this->mobName[$type] . " spawned in " . $spawnX . ", " . $spawnY . ", " . $spawnZ . ".";
|
$output .= "Baby " . $this->mobName[$type] . " spawned in " . $spawnX . ", " . $spawnY . ", " . $spawnZ . ".";
|
||||||
|
|
|
||||||
|
|
@ -1812,7 +1812,7 @@ class Player{
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MOB_SHEEP:
|
case MOB_SHEEP:
|
||||||
if($slot->getID() === SHEARS && $target->data["Sheared"] === 0){ //not sheared
|
if($slot->getID() === SHEARS && $target->data["Sheared"] === 0 && !$target->isBaby()){ //not sheared
|
||||||
ServerAPI::request()->api->entity->drop(new Position($target->x + 0.5, $target->y, $target->z + 0.5, $target->level), BlockAPI::getItem(WOOL, $target->data["Color"], mt_rand(1, 3)));
|
ServerAPI::request()->api->entity->drop(new Position($target->x + 0.5, $target->y, $target->z + 0.5, $target->level), BlockAPI::getItem(WOOL, $target->data["Color"], mt_rand(1, 3)));
|
||||||
$target->data["Sheared"] = 1; //i hope it means sheared right?
|
$target->data["Sheared"] = 1; //i hope it means sheared right?
|
||||||
$target->updateMetadata();
|
$target->updateMetadata();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,14 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class SignPostBlock extends TransparentBlock{
|
class SignPostBlock extends TransparentBlock{
|
||||||
|
|
||||||
|
private $faces = array(
|
||||||
|
2 => 2,
|
||||||
|
3 => 3,
|
||||||
|
4 => 4,
|
||||||
|
5 => 5,
|
||||||
|
);
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct($meta = 0){
|
||||||
parent::__construct(SIGN_POST, $meta, "Sign Post");
|
parent::__construct(SIGN_POST, $meta, "Sign Post");
|
||||||
$this->isSolid = false;
|
$this->isSolid = false;
|
||||||
|
|
@ -9,19 +17,13 @@ class SignPostBlock extends TransparentBlock{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||||
if($face !== 0){
|
if($target->isSolid && $face !== 0){
|
||||||
$faces = array(
|
if(!isset($this->faces[$face])){
|
||||||
2 => 2,
|
|
||||||
3 => 3,
|
|
||||||
4 => 4,
|
|
||||||
5 => 5,
|
|
||||||
);
|
|
||||||
if(!isset($faces[$face])){
|
|
||||||
$this->meta = floor((($player->entity->yaw + 180) * 16 / 360) + 0.5) & 0x0F;
|
$this->meta = floor((($player->entity->yaw + 180) * 16 / 360) + 0.5) & 0x0F;
|
||||||
$this->level->setBlock($block, BlockAPI::get(SIGN_POST, $this->meta), true, false, true);
|
$this->level->setBlock($block, BlockAPI::get(SIGN_POST, $this->meta), true, false, true);
|
||||||
return true;
|
return true;
|
||||||
}else{
|
}else{
|
||||||
$this->meta = $faces[$face];
|
$this->meta = $this->faces[$face];
|
||||||
$this->level->setBlock($block, BlockAPI::get(WALL_SIGN, $this->meta, true, false, true));
|
$this->level->setBlock($block, BlockAPI::get(WALL_SIGN, $this->meta, true, false, true));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,9 +57,11 @@ class BeetrootBlock extends FlowableBlock{
|
||||||
$drops = array();
|
$drops = array();
|
||||||
if($this->meta >= 0x07){
|
if($this->meta >= 0x07){
|
||||||
$drops[] = array(BEETROOT, 0, 1);
|
$drops[] = array(BEETROOT, 0, 1);
|
||||||
$drops[] = array(BEETROOT_SEEDS, 0, mt_rand(0, 3));
|
}
|
||||||
}else{
|
for($i = 0; $i < 3; ++$i){
|
||||||
$drops[] = array(BEETROOT_SEEDS, 0, 1);
|
if(mt_rand(0,15) <= $this->meta){ //a way from 1.4.7
|
||||||
|
$drops[] = array(BEETROOT_SEEDS, 0, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $drops;
|
return $drops;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,9 +56,12 @@ class CarrotBlock extends FlowableBlock{
|
||||||
public function getDrops(Item $item, Player $player){
|
public function getDrops(Item $item, Player $player){
|
||||||
$drops = array();
|
$drops = array();
|
||||||
if($this->meta >= 0x07){
|
if($this->meta >= 0x07){
|
||||||
$drops[] = array(CARROT, 0, mt_rand(1, 4));
|
$drops[] = array(CARROT, 0, mt_rand(1));
|
||||||
}else{
|
}
|
||||||
$drops[] = array(CARROT, 0, 1);
|
for($i = 0; $i < 3; ++$i){
|
||||||
|
if(mt_rand(0,15) <= $this->meta){ //a way from 1.4.7
|
||||||
|
$drops[] = array(CARROT, 0, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $drops;
|
return $drops;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,12 @@ class WheatBlock extends FlowableBlock{
|
||||||
$drops[] = array(WHEAT, 0, 1);
|
$drops[] = array(WHEAT, 0, 1);
|
||||||
$drops[] = array(WHEAT_SEEDS, 0, mt_rand(0, 3));
|
$drops[] = array(WHEAT_SEEDS, 0, mt_rand(0, 3));
|
||||||
}else{
|
}else{
|
||||||
$drops[] = array(WHEAT_SEEDS, 0, 1);
|
for($i = 0; $i < 3; ++$i){
|
||||||
|
if(mt_rand(0,15) <= $this->meta){ //a way from 1.4.7
|
||||||
|
$drops[] = array(WHEAT_SEEDS, 0, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return $drops;
|
return $drops;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
class SignItem extends Item{
|
class SignItem extends Item{
|
||||||
public function __construct($meta = 0, $count = 1){
|
public function __construct($meta = 0, $count = 1){
|
||||||
|
parent::__construct(SIGN, 0, $count, "Sign");
|
||||||
$this->block = BlockAPI::get(SIGN_POST);
|
$this->block = BlockAPI::get(SIGN_POST);
|
||||||
$this->maxStackSize = 16;
|
$this->maxStackSize = 16;
|
||||||
parent::__construct(SIGN, 0, $count, "Sign");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue