mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
entity spawner
This commit is contained in:
parent
5b2c7bc9d0
commit
6fbd52c1a5
4 changed files with 67 additions and 12 deletions
|
|
@ -1432,9 +1432,9 @@ class Player{
|
|||
$this->entity->z = $this->data->get("position")["z"];
|
||||
$pk = new StartGamePacket;
|
||||
$pk->seed = $this->level->getSeed();
|
||||
$pk->spawnX = (int) $spawnPos->x;
|
||||
$pk->spawnY = (int) $spawnPos->y;
|
||||
$pk->spawnZ = (int) $spawnPos->z;
|
||||
$pk->spawnX = (int) $this->spawnPosition->x;
|
||||
$pk->spawnY = (int) $this->spawnPosition->y;
|
||||
$pk->spawnZ = (int) $this->spawnPosition->z;
|
||||
$pk->x = (int) $this->entity->x;
|
||||
$pk->y = (int) $this->entity->y;
|
||||
$pk->z = (int) $this->entity->z;
|
||||
|
|
|
|||
|
|
@ -33,11 +33,4 @@ define("ENTITY_OBJECT", 3);
|
|||
define("ENTITY_ITEM", 4);
|
||||
|
||||
define("ENTITY_FALLING", 5);
|
||||
define("FALLING_SAND", 66);
|
||||
|
||||
//TileEntities
|
||||
define("TILE_SIGN", "Sign");
|
||||
define("TILE_CHEST", "Chest");
|
||||
define("CHEST_SLOTS", 27);
|
||||
define("TILE_FURNACE", "Furnace");
|
||||
define("FURNACE_SLOTS", 3);
|
||||
define("FALLING_SAND", 66);
|
||||
|
|
@ -145,7 +145,7 @@ abstract class Block extends Position{
|
|||
COCOA => "CocoaBlock",
|
||||
RED_MUSHROOM_BLOCK => "RedMushroomSolidBlock",
|
||||
BROWN_MUSHROOM_BLOCK => "BrownMushroomSolidBlock",
|
||||
MONSTER_SPAWNER => "MonsterSpawnerBlock",
|
||||
MONSTER_SPAWNER => "MobSpawnerBlock",
|
||||
VINES => "VinesBlock",
|
||||
MYCELIUM => "MyceliumBlock",
|
||||
);
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ class Tile extends Position{
|
|||
switch($this->class){
|
||||
case TILE_CHEST:
|
||||
case TILE_SIGN:
|
||||
case TILE_MOB_SPAWNER:
|
||||
$this->server->query("UPDATE tiles SET spawnable = 1 WHERE ID = " . $this->id . ";");
|
||||
break;
|
||||
case TILE_FURNACE:
|
||||
|
|
@ -336,6 +337,67 @@ class Tile extends Position{
|
|||
$player = $this->server->api->player->get($player);
|
||||
}
|
||||
switch($this->class){
|
||||
case TILE_MOB_SPAWNER:
|
||||
$nbt = new NBT(); //TODO fix
|
||||
$nbt->write(chr(NBT::TAG_COMPOUND) . "\x00\x00");
|
||||
|
||||
$nbt->write(chr(NBT::TAG_STRING));
|
||||
$nbt->writeTAG_String("id");
|
||||
$nbt->writeTAG_String($this->class);
|
||||
|
||||
$nbt->write(chr(NBT::TAG_INT));
|
||||
$nbt->writeTAG_String("x");
|
||||
$nbt->writeTAG_Int((int) $this->x);
|
||||
|
||||
$nbt->write(chr(NBT::TAG_INT));
|
||||
$nbt->writeTAG_String("y");
|
||||
$nbt->writeTAG_Int((int) $this->y);
|
||||
|
||||
$nbt->write(chr(NBT::TAG_INT));
|
||||
$nbt->writeTAG_String("z");
|
||||
$nbt->writeTAG_Int((int) $this->z);
|
||||
|
||||
$nbt->write(chr(NBT::TAG_INT));
|
||||
$nbt->writeTAG_String("EntityId");
|
||||
$nbt->writeTAG_Int((int) $this->data["EntityId"]);
|
||||
|
||||
$nbt->write(chr(NBT::TAG_SHORT));
|
||||
$nbt->writeTAG_String("Delay");
|
||||
$nbt->writeTAG_SHORT((int) $this->data["Delay"]);
|
||||
|
||||
$nbt->write(chr(NBT::TAG_SHORT));
|
||||
$nbt->writeTAG_String("MinSpawnDelay");
|
||||
$nbt->writeTAG_SHORT((int) $this->data["MinSpawnDelay"]);
|
||||
|
||||
$nbt->write(chr(NBT::TAG_SHORT));
|
||||
$nbt->writeTAG_String("MaxSpawnDelay");
|
||||
$nbt->writeTAG_SHORT((int) $this->data["MaxSpawnDelay"]);
|
||||
|
||||
$nbt->write(chr(NBT::TAG_SHORT));
|
||||
$nbt->writeTAG_String("SpawnCount");
|
||||
$nbt->writeTAG_SHORT((int) $this->data["SpawnCount"]);
|
||||
|
||||
$nbt->write(chr(NBT::TAG_SHORT));
|
||||
$nbt->writeTAG_String("MaxNearbyEntities");
|
||||
$nbt->writeTAG_SHORT((int) $this->data["MaxNearbyEntities"]);
|
||||
|
||||
$nbt->write(chr(NBT::TAG_SHORT));
|
||||
$nbt->writeTAG_String("RequiredPlayerRange");
|
||||
$nbt->writeTAG_SHORT((int) $this->data["RequiredPlayerRange"]);
|
||||
|
||||
$nbt->write(chr(NBT::TAG_SHORT));
|
||||
$nbt->writeTAG_String("SpawnRange");
|
||||
$nbt->writeTAG_SHORT((int) $this->data["SpawnRange"]);
|
||||
|
||||
//console(bin2hex($nbt->binary));
|
||||
|
||||
$pk = new EntityDataPacket;
|
||||
$pk->x = $this->x;
|
||||
$pk->y = $this->y;
|
||||
$pk->z = $this->z;
|
||||
$pk->namedtag = $nbt->binary;
|
||||
$player->dataPacket($pk);
|
||||
break;
|
||||
case TILE_CHEST:
|
||||
$nbt = new NBT();
|
||||
$nbt->write(chr(NBT::TAG_COMPOUND) . "\x00\x00");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue