From 27be94ad1b0fa19477d2be4b42ed2a00eaf9b16d Mon Sep 17 00:00:00 2001 From: ArkQuark <74979909+ArkQuark@users.noreply.github.com> Date: Thu, 16 Jun 2022 18:46:23 +0300 Subject: [PATCH 1/2] Update README.md --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 10341d93..f78ac0d5 100644 --- a/README.md +++ b/README.md @@ -16,14 +16,16 @@ Supported version: 0.8.1 • Player hotbar is saved. -• Advanced cache option. +• Extra options (Only on NostalgiaCore!) -• Server is starting faster. +• Server is starting faster (~0.7 sec). • Vector2 is fixed. • Players can't join as "RCON" or "CONSOLE". +• New many content such NEW entity system and Worked Nether Reactor! + ...and etc. # Download Stable NostalgiaCore From dbc199f34b68ebc2b3c6eb7f7fbb1512025032f2 Mon Sep 17 00:00:00 2001 From: GameHerobrine Date: Thu, 16 Jun 2022 20:53:40 +0300 Subject: [PATCH 2/2] monsters are separated now --- src/API/EntityAPI.php | 1 - src/entity/Entity.php | 76 +---------------------------- src/entity/EntityRegistry.php | 5 ++ src/entity/Monster.php | 10 ++++ src/entity/monster/Creeper.php | 18 +++++++ src/entity/monster/PigZombie.php | 18 +++++++ src/entity/monster/Skeleton.php | 19 ++++++++ src/entity/monster/Spider.php | 18 +++++++ src/entity/monster/Zombie.php | 20 ++++++++ src/material/block/nonfull/Rail.php | 6 +-- 10 files changed, 112 insertions(+), 79 deletions(-) diff --git a/src/API/EntityAPI.php b/src/API/EntityAPI.php index d81a6ee4..946c70b2 100644 --- a/src/API/EntityAPI.php +++ b/src/API/EntityAPI.php @@ -272,7 +272,6 @@ class EntityAPI{ $eid = $this->eCnt++; $efl = EntityRegistry::$entityList->getEntityFromType($type); if($efl instanceof PropertyEntity){ - console(json_encode($data)); $class = $efl->getEntityName(); $this->entities[$eid] = new $class($level, $eid, $efl->getEntityClass(), $efl->getEntityType(), $data); }else{ diff --git a/src/entity/Entity.php b/src/entity/Entity.php index 1928c3eb..9a8b705d 100644 --- a/src/entity/Entity.php +++ b/src/entity/Entity.php @@ -114,38 +114,7 @@ class Entity extends Position{ break; case ENTITY_MOB: switch($this->type){ - //Monsters - case MOB_CREEPER: - $this->setHealth(isset($this->data["Health"]) ? $this->data["Health"]:20, "generic"); - $this->update(); - //$this->setName('Creeper'); - $this->size = 1.6; //not original - break; - case MOB_PIGMAN: - $this->setHealth(isset($this->data["Health"]) ? $this->data["Health"]:20, "generic"); - $this->update(); - //$this->setName('Pigman'); - $this->size = 1.8; //not original - break; - case MOB_SKELETON: - $this->setHealth(isset($this->data["Health"]) ? $this->data["Health"]:20, "generic"); - $this->update(); - //$this->setName('Skeleton'); - $this->size = 1.9; - break; - case MOB_SPIDER: - $this->setHealth(isset($this->data["Health"]) ? $this->data["Health"]:20, "generic"); - $this->update(); - //$this->setName('Spider'); - $this->size = 0.6; //not original - break; - case MOB_ZOMBIE: - $this->setHealth(isset($this->data["Health"]) ? $this->data["Health"]:20, "generic"); - $this->update(); - //$this->setName('Zombie'); - $this->size = 1.95; - break; - default: //no break uwu? + default: $this->setHealth(isset($this->data["Health"]) ? $this->data["Health"]:1, "generic"); $this->update(); //$this->setName((isset($mobs[$this->type]) ? $mobs[$this->type]:$this->type)); @@ -237,34 +206,6 @@ class Entity extends Position{ array(AIR, 0, 0), ); } - switch($this->type){ - - //Monsters - case MOB_ZOMBIE: - return array( - array(CARROT, 0, Utils::chance(0.83) ? 1 : 0), - array(POTATO, 0, Utils::chance(0.83) ? 1 : 0), - array(FEATHER, 0, mt_rand(0,2)), - ); - case MOB_SPIDER: - return array( - array(STRING, 0, mt_rand(0,2)), - ); - case MOB_PIGMAN: - return array( - array(COOKED_PORKCHOP, 0, mt_rand(0,2)), - array(GOLD_INGOT, 0, mt_rand(0,1)), - ); - case MOB_CREEPER: - return array( - array(GUNPOWDER, 0, mt_rand(0,2)), - ); - case MOB_SKELETON: - return array( - array(ARROW, 0, mt_rand(0,2)), - array(BONE, 0, mt_rand(0,2)), - ); - } } return array(); } @@ -306,21 +247,6 @@ class Entity extends Position{ return false; } } - - if($this->class === ENTITY_MOB){ - switch($this->type){ - case MOB_ZOMBIE: - case MOB_CREEPER: - case MOB_PIGMAN: - case MOB_SKELETON: - case MOB_SPIDER: - if($this->server->api->getProperty("spawn-mobs") !== true){ - $this->close(); - return false; - } - break; - } - } if($this->class !== ENTITY_PLAYER and ($this->x <= 0 or $this->z <= 0 or $this->x >= 256 or $this->z >= 256 or $this->y >= 128 or $this->y <= 0)){ $this->close(); diff --git a/src/entity/EntityRegistry.php b/src/entity/EntityRegistry.php index 83e85e55..1baf4798 100644 --- a/src/entity/EntityRegistry.php +++ b/src/entity/EntityRegistry.php @@ -41,6 +41,11 @@ class EntityRegistry{ self::registerEntity(Chicken::class); self::registerEntity(Sheep::class); self::registerEntity(Cow::class); + self::registerEntity(Creeper::class); + self::registerEntity(PigZombie::class); + self::registerEntity(Skeleton::class); + self::registerEntity(Spider::class); + self::registerEntity(Zombie::class); } /*Register an Entity*/ diff --git a/src/entity/Monster.php b/src/entity/Monster.php index e69de29b..1651661a 100644 --- a/src/entity/Monster.php +++ b/src/entity/Monster.php @@ -0,0 +1,10 @@ +server->api->getProperty("spawn-mobs") !== true){ + $this->close(); + return false; + } + } +} \ No newline at end of file diff --git a/src/entity/monster/Creeper.php b/src/entity/monster/Creeper.php index e69de29b..6c00c308 100644 --- a/src/entity/monster/Creeper.php +++ b/src/entity/monster/Creeper.php @@ -0,0 +1,18 @@ +setHealth(isset($this->data["Health"]) ? $this->data["Health"]:20, "generic"); + $this->update(); + //$this->setName('Creeper'); + $this->size = 1.6; //not original + } + + public function getDrops(){ + return array( + array(GUNPOWDER, 0, mt_rand(0,2)), + ); + } +} \ No newline at end of file diff --git a/src/entity/monster/PigZombie.php b/src/entity/monster/PigZombie.php index e69de29b..e0fad1a1 100644 --- a/src/entity/monster/PigZombie.php +++ b/src/entity/monster/PigZombie.php @@ -0,0 +1,18 @@ +setHealth(isset($this->data["Health"]) ? $this->data["Health"] : 20, "generic"); + $this->update(); + //$this->setName('Pigman'); + $this->size = 1.8; //not original + } + + public function getDrops(){ + return array( + array(COOKED_PORKCHOP, 0, mt_rand(0,2)), + array(GOLD_INGOT, 0, mt_rand(0,1)), + ); + } +} \ No newline at end of file diff --git a/src/entity/monster/Skeleton.php b/src/entity/monster/Skeleton.php index e69de29b..75695e13 100644 --- a/src/entity/monster/Skeleton.php +++ b/src/entity/monster/Skeleton.php @@ -0,0 +1,19 @@ +setHealth(isset($this->data["Health"]) ? $this->data["Health"] : 20, "generic"); + $this->update(); + //$this->setName('Skeleton'); + $this->size = 1.9; + } + + public function getDrops(){ + return array( + array(ARROW, 0, mt_rand(0,2)), + array(BONE, 0, mt_rand(0,2)), + ); + } +} \ No newline at end of file diff --git a/src/entity/monster/Spider.php b/src/entity/monster/Spider.php index e69de29b..28e37a6f 100644 --- a/src/entity/monster/Spider.php +++ b/src/entity/monster/Spider.php @@ -0,0 +1,18 @@ +setHealth(isset($this->data["Health"]) ? $this->data["Health"]:20, "generic"); + $this->update(); + //$this->setName('Spider'); + $this->size = 0.6; //not original + } + + public function getDrops(){ + return array( + array(STRING, 0, mt_rand(0,2)), + ); + } +} \ No newline at end of file diff --git a/src/entity/monster/Zombie.php b/src/entity/monster/Zombie.php index e69de29b..7e70bff2 100644 --- a/src/entity/monster/Zombie.php +++ b/src/entity/monster/Zombie.php @@ -0,0 +1,20 @@ +setHealth(isset($this->data["Health"]) ? $this->data["Health"] : 20, "generic"); + $this->update(); + //$this->setName('Zombie'); + $this->size = 1.95; + } + + public function getDrops(){ + return array( + array(CARROT, 0, Utils::chance(0.83) ? 1 : 0), + array(POTATO, 0, Utils::chance(0.83) ? 1 : 0), + array(FEATHER, 0, mt_rand(0,2)), + ); + } +} \ No newline at end of file diff --git a/src/material/block/nonfull/Rail.php b/src/material/block/nonfull/Rail.php index d3c0f1b3..0a4341a7 100644 --- a/src/material/block/nonfull/Rail.php +++ b/src/material/block/nonfull/Rail.php @@ -92,9 +92,9 @@ class RailBlock extends FlowableBlock{ } foreach($deltaY as $y){ $v3 = new Vector3( - $rail.getFloorX() + $blocks[1][0], - $rail.getFloorY() + $y, - $rail.getFloorZ() + $blocks[1][1] + $rail->getFloorX() + $blocks[1][0], + $rail->getFloorY() + $y, + $rail->getFloorZ() + $blocks[1][1] ); $idToConnect = $rail->level->getBlock(v3.getFloorX(), v3.getFloorY(), v3.getFloorZ())->getID(); $metaToConnect = $rail->level->getBlock(v3.getFloorX(), v3.getFloorY(), v3.getFloorZ())->getMetadata();