summaryrefslogtreecommitdiffstats
path: root/src/World.cpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2018-03-08 22:44:17 +0100
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2018-03-08 22:44:17 +0100
commita4d017a3f2b841788f7e47669c0d0cac9c3f31c8 (patch)
treead14b1f27ee9dff35aaed29e67cb3a912bd5bb46 /src/World.cpp
parentSome parsing optimizations (diff)
downloadAltCraft-a4d017a3f2b841788f7e47669c0d0cac9c3f31c8.tar
AltCraft-a4d017a3f2b841788f7e47669c0d0cac9c3f31c8.tar.gz
AltCraft-a4d017a3f2b841788f7e47669c0d0cac9c3f31c8.tar.bz2
AltCraft-a4d017a3f2b841788f7e47669c0d0cac9c3f31c8.tar.lz
AltCraft-a4d017a3f2b841788f7e47669c0d0cac9c3f31c8.tar.xz
AltCraft-a4d017a3f2b841788f7e47669c0d0cac9c3f31c8.tar.zst
AltCraft-a4d017a3f2b841788f7e47669c0d0cac9c3f31c8.zip
Diffstat (limited to '')
-rw-r--r--src/World.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/World.cpp b/src/World.cpp
index 59399f5..67abc02 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -350,10 +350,22 @@ void World::SetBlockId(Vector pos, BlockId block) {
Vector sectionPos(std::floor(pos.x / 16.0),
std::floor(pos.y / 16.0),
std::floor(pos.z / 16.0));
-
+ Vector blockPos = pos - (sectionPos * 16);
Section* section = GetSectionPtr(sectionPos);
- section->SetBlockId(pos - (sectionPos * 16), block);
+ section->SetBlockId(blockPos, block);
PUSH_EVENT("ChunkChanged",sectionPos);
+ if (blockPos.x == 0)
+ PUSH_EVENT("ChunkChangedForce", sectionPos + Vector(-1, 0, 0));
+ if (blockPos.x == 15)
+ PUSH_EVENT("ChunkChangedForce", sectionPos + Vector(1, 0, 0));
+ if (blockPos.y == 0)
+ PUSH_EVENT("ChunkChangedForce", sectionPos + Vector(0, -1, 0));
+ if (blockPos.y == 15)
+ PUSH_EVENT("ChunkChangedForce", sectionPos + Vector(0, 1, 0));
+ if (blockPos.z == 0)
+ PUSH_EVENT("ChunkChangedForce", sectionPos + Vector(0, 0, -1));
+ if (blockPos.z == 15)
+ PUSH_EVENT("ChunkChangedForce", sectionPos + Vector(0, 0, 1));
}
void World::SetBlockLight(Vector pos, unsigned char light) {