fix: block states cause crash for rotatable blocks

This commit is contained in:
MihailRis
2024-05-30 18:17:21 +03:00
parent c9fb33132f
commit 29ca6e969c
3 changed files with 6 additions and 6 deletions
+4 -4
View File
@@ -170,7 +170,7 @@ glm::vec3 PlayerController::selectedBlockPosition;
glm::vec3 PlayerController::selectedPointPosition;
glm::ivec3 PlayerController::selectedBlockNormal;
int PlayerController::selectedBlockId = -1;
int PlayerController::selectedBlockStates = 0;
int PlayerController::selectedBlockRotation = 0;
PlayerController::PlayerController(
Level* level,
@@ -250,7 +250,7 @@ void PlayerController::update(float delta, bool input, bool pause) {
updateInteraction();
} else {
selectedBlockId = -1;
selectedBlockStates = 0;
selectedBlockRotation = 0;
}
}
@@ -365,7 +365,7 @@ void PlayerController::updateInteraction(){
if (vox != nullptr){
player->selectedVoxel = *vox;
selectedBlockId = vox->id;
selectedBlockStates = vox->states;
selectedBlockRotation = vox->rotation();
selectedBlockPosition = iend;
selectedPointPosition = end;
selectedBlockNormal = norm;
@@ -442,7 +442,7 @@ void PlayerController::updateInteraction(){
}
} else {
selectedBlockId = -1;
selectedBlockStates = 0;
selectedBlockRotation = 0;
}
if (rclick) {
if (item->rt.funcsset.on_use) {