fix: block states cause crash for rotatable blocks
This commit is contained in:
parent
c9fb33132f
commit
29ca6e969c
@ -199,7 +199,7 @@ void WorldRenderer::renderBlockSelection(Camera* camera, Shader* linesShader) {
|
||||
const glm::vec3 norm = PlayerController::selectedBlockNormal;
|
||||
|
||||
const std::vector<AABB>& hitboxes = block->rotatable
|
||||
? block->rt.hitboxes[PlayerController::selectedBlockStates]
|
||||
? block->rt.hitboxes[PlayerController::selectedBlockRotation]
|
||||
: block->hitboxes;
|
||||
|
||||
linesShader->use();
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -81,7 +81,7 @@ public:
|
||||
static glm::ivec3 selectedBlockNormal;
|
||||
static glm::vec3 selectedPointPosition;
|
||||
static int selectedBlockId;
|
||||
static int selectedBlockStates;
|
||||
static int selectedBlockRotation;
|
||||
|
||||
PlayerController(
|
||||
Level* level,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user