mirror of
https://github.com/PixelGuys/Cubyz.git
synced 2025-08-03 11:17:05 -04:00
Set the placeholder biome before receiving the first biome packet from the server
fixes #1428
This commit is contained in:
parent
b0aa8ea6ea
commit
1fbf5618b9
@ -673,8 +673,6 @@ pub const World = struct { // MARK: World
|
|||||||
|
|
||||||
main.blocks.meshes.generateTextureArray();
|
main.blocks.meshes.generateTextureArray();
|
||||||
main.models.uploadModels();
|
main.models.uploadModels();
|
||||||
self.playerBiome = .init(main.server.terrain.biomes.getPlaceholderBiome());
|
|
||||||
main.audio.setMusic(self.playerBiome.raw.preferredMusic);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn deinit(self: *World) void {
|
pub fn deinit(self: *World) void {
|
||||||
@ -719,6 +717,8 @@ pub const World = struct { // MARK: World
|
|||||||
Player.id = zon.get(u32, "player_id", std.math.maxInt(u32));
|
Player.id = zon.get(u32, "player_id", std.math.maxInt(u32));
|
||||||
Player.inventory = Inventory.init(main.globalAllocator, 32, .normal, .{.playerInventory = Player.id});
|
Player.inventory = Inventory.init(main.globalAllocator, 32, .normal, .{.playerInventory = Player.id});
|
||||||
Player.loadFrom(zon.getChild("player"));
|
Player.loadFrom(zon.getChild("player"));
|
||||||
|
self.playerBiome = .init(main.server.terrain.biomes.getPlaceholderBiome());
|
||||||
|
main.audio.setMusic(self.playerBiome.raw.preferredMusic);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update(self: *World) void {
|
pub fn update(self: *World) void {
|
||||||
|
@ -410,7 +410,7 @@ fn update() void { // MARK: update()
|
|||||||
|
|
||||||
for(userList) |user| {
|
for(userList) |user| {
|
||||||
const pos = @as(Vec3i, @intFromFloat(user.player.pos));
|
const pos = @as(Vec3i, @intFromFloat(user.player.pos));
|
||||||
const biomeId = world.?.getBiome(user.lastPos[0], pos[1], pos[2]).paletteId;
|
const biomeId = world.?.getBiome(pos[0], pos[1], pos[2]).paletteId;
|
||||||
if(biomeId != user.lastSentBiomeId) {
|
if(biomeId != user.lastSentBiomeId) {
|
||||||
user.lastSentBiomeId = biomeId;
|
user.lastSentBiomeId = biomeId;
|
||||||
main.network.Protocols.genericUpdate.sendBiome(user.conn, biomeId);
|
main.network.Protocols.genericUpdate.sendBiome(user.conn, biomeId);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user