2018-12-15 23:55:36 -08:00
|
|
|
//
|
|
|
|
// Created by aurailus on 14/12/18.
|
|
|
|
//
|
|
|
|
|
2019-08-24 17:39:35 -07:00
|
|
|
#pragma once
|
2018-12-15 23:55:36 -08:00
|
|
|
|
2020-01-09 21:04:31 -08:00
|
|
|
#include "World.h"
|
|
|
|
|
2020-08-13 00:55:18 -07:00
|
|
|
#include "world/dim/LocalDimension.h"
|
|
|
|
#include "client/conn/ClientNetworkInterpreter.h"
|
2018-12-15 23:55:36 -08:00
|
|
|
|
2020-07-30 22:07:00 -07:00
|
|
|
class Window;
|
2020-11-08 22:57:34 -08:00
|
|
|
|
2020-07-28 14:11:11 -07:00
|
|
|
class Renderer;
|
2020-11-08 22:57:34 -08:00
|
|
|
|
2020-07-30 22:07:00 -07:00
|
|
|
class LocalPlayer;
|
2020-11-08 22:57:34 -08:00
|
|
|
|
2020-07-28 14:11:11 -07:00
|
|
|
class LocalSubgame;
|
2020-11-08 22:57:34 -08:00
|
|
|
|
2020-07-30 22:07:00 -07:00
|
|
|
class LocalInventoryRefs;
|
2020-11-08 22:57:34 -08:00
|
|
|
|
2020-02-20 11:23:12 -08:00
|
|
|
class WorldInterpolationStream;
|
2019-06-04 00:05:52 -07:00
|
|
|
|
2020-01-09 21:04:31 -08:00
|
|
|
class LocalWorld : public World {
|
2020-12-03 16:26:57 -08:00
|
|
|
public:
|
2020-11-08 22:57:34 -08:00
|
|
|
LocalWorld(SubgamePtr game, ServerConnection& conn, Renderer& window);
|
|
|
|
|
|
|
|
void connect();
|
|
|
|
|
|
|
|
bool updatePlayerDimension();
|
|
|
|
|
|
|
|
void update(double delta) override;
|
|
|
|
|
|
|
|
void handleWorldPacket(std::unique_ptr<PacketView> p);
|
|
|
|
|
|
|
|
void handlePlayerEntPacket(std::unique_ptr<PacketView> p);
|
|
|
|
|
2020-12-06 23:34:25 -08:00
|
|
|
void handleModMessage(const std::string& channel, const std::string& message);
|
|
|
|
|
2020-11-08 22:57:34 -08:00
|
|
|
void commitChunk(std::shared_ptr<Chunk> chunk);
|
|
|
|
|
2020-12-03 16:26:57 -08:00
|
|
|
virtual void sendMessage(const std::string& channel, const std::string& message) override;
|
|
|
|
|
2020-11-08 22:57:34 -08:00
|
|
|
virtual DimensionPtr
|
|
|
|
createDimension(const std::string& identifier, std::unordered_set<std::string>& biomes) override;
|
|
|
|
|
|
|
|
DimensionPtr getActiveDimension();
|
|
|
|
|
|
|
|
void setActiveDimension(DimensionPtr);
|
|
|
|
|
|
|
|
PlayerPtr getPlayer();
|
|
|
|
|
|
|
|
virtual InventoryRefsPtr getRefs() override;
|
|
|
|
|
|
|
|
ClientNetworkInterpreter& getNet();
|
|
|
|
|
|
|
|
int renderChunks(Renderer& render);
|
|
|
|
|
|
|
|
void renderEntities(Renderer& renderer);
|
|
|
|
|
|
|
|
int mapBlocksInterpolated = 0;
|
|
|
|
int lastMeshUpdates = 0;
|
2020-12-03 16:26:57 -08:00
|
|
|
|
|
|
|
private:
|
2020-11-08 22:57:34 -08:00
|
|
|
Renderer& renderer;
|
|
|
|
|
|
|
|
ClientNetworkInterpreter net;
|
|
|
|
std::shared_ptr<LocalInventoryRefs> refs;
|
|
|
|
PlayerPtr player;
|
|
|
|
|
|
|
|
std::shared_ptr<LocalDimension> activeDimension = nullptr;
|
|
|
|
|
|
|
|
std::shared_ptr<WorldInterpolationStream> worldGenStream = nullptr;
|
2018-12-15 23:55:36 -08:00
|
|
|
};
|