fixed bugs 71,72,43 and 32

This commit is contained in:
GameHerobrine 2022-09-06 19:22:54 +03:00
parent 7fb11d97fd
commit d02c98b2b3
7 changed files with 31 additions and 19 deletions

View file

@ -154,7 +154,7 @@ class EntityAPI{
"y" => $spawnY,
"z" => $spawnZ,
"Health" => $this->hp[$type],
"isBaby" => 1,
"IsBaby" => 1,
]);
$this->spawnToAll($entityit, $spawnLevel);
$output .= "Baby " . $this->mobName[$type] . " spawned in " . $spawnX . ", " . $spawnY . ", " . $spawnZ . ".";

View file

@ -1812,7 +1812,7 @@ class Player{
}
break;
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)));
$target->data["Sheared"] = 1; //i hope it means sheared right?
$target->updateMetadata();

View file

@ -1,6 +1,14 @@
<?php
class SignPostBlock extends TransparentBlock{
private $faces = array(
2 => 2,
3 => 3,
4 => 4,
5 => 5,
);
public function __construct($meta = 0){
parent::__construct(SIGN_POST, $meta, "Sign Post");
$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){
if($face !== 0){
$faces = array(
2 => 2,
3 => 3,
4 => 4,
5 => 5,
);
if(!isset($faces[$face])){
if($target->isSolid && $face !== 0){
if(!isset($this->faces[$face])){
$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);
return true;
}else{
$this->meta = $faces[$face];
$this->meta = $this->faces[$face];
$this->level->setBlock($block, BlockAPI::get(WALL_SIGN, $this->meta, true, false, true));
return true;
}

View file

@ -57,9 +57,11 @@ class BeetrootBlock extends FlowableBlock{
$drops = array();
if($this->meta >= 0x07){
$drops[] = array(BEETROOT, 0, 1);
$drops[] = array(BEETROOT_SEEDS, 0, mt_rand(0, 3));
}else{
$drops[] = array(BEETROOT_SEEDS, 0, 1);
}
for($i = 0; $i < 3; ++$i){
if(mt_rand(0,15) <= $this->meta){ //a way from 1.4.7
$drops[] = array(BEETROOT_SEEDS, 0, 1);
}
}
return $drops;
}

View file

@ -56,9 +56,12 @@ class CarrotBlock extends FlowableBlock{
public function getDrops(Item $item, Player $player){
$drops = array();
if($this->meta >= 0x07){
$drops[] = array(CARROT, 0, mt_rand(1, 4));
}else{
$drops[] = array(CARROT, 0, 1);
$drops[] = array(CARROT, 0, mt_rand(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;
}

View file

@ -60,7 +60,12 @@ class WheatBlock extends FlowableBlock{
$drops[] = array(WHEAT, 0, 1);
$drops[] = array(WHEAT_SEEDS, 0, mt_rand(0, 3));
}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;
}

View file

@ -2,8 +2,8 @@
class SignItem extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(SIGN, 0, $count, "Sign");
$this->block = BlockAPI::get(SIGN_POST);
$this->maxStackSize = 16;
parent::__construct(SIGN, 0, $count, "Sign");
}
}