diff options
author | peterbell10 <peterbell10@live.co.uk> | 2018-07-19 23:36:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-19 23:36:46 +0200 |
commit | 211cec621e5e23e0e3a9c5e0880ddea24b6418c3 (patch) | |
tree | cd9c6a44a95baef198e871ca8c94cc7a20c004ad /src/Bindings/ManualBindings_BlockArea.cpp | |
parent | Add unbreaking for armor (#4220) (diff) | |
download | cuberite-211cec621e5e23e0e3a9c5e0880ddea24b6418c3.tar cuberite-211cec621e5e23e0e3a9c5e0880ddea24b6418c3.tar.gz cuberite-211cec621e5e23e0e3a9c5e0880ddea24b6418c3.tar.bz2 cuberite-211cec621e5e23e0e3a9c5e0880ddea24b6418c3.tar.lz cuberite-211cec621e5e23e0e3a9c5e0880ddea24b6418c3.tar.xz cuberite-211cec621e5e23e0e3a9c5e0880ddea24b6418c3.tar.zst cuberite-211cec621e5e23e0e3a9c5e0880ddea24b6418c3.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Bindings/ManualBindings_BlockArea.cpp | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/src/Bindings/ManualBindings_BlockArea.cpp b/src/Bindings/ManualBindings_BlockArea.cpp index 038c571ac..126b35386 100644 --- a/src/Bindings/ManualBindings_BlockArea.cpp +++ b/src/Bindings/ManualBindings_BlockArea.cpp @@ -700,20 +700,23 @@ static int tolua_cBlockArea_Write(lua_State * a_LuaState) // Check and get the overloaded params: Vector3i coords; - int dataTypes = cBlockArea::baTypes | cBlockArea::baMetas | cBlockArea::baBlockEntities; + int dataTypes = 0; auto dataTypesIdx = readVector3iOverloadParams(L, 3, coords, "coords"); - L.GetStackValues(dataTypesIdx, dataTypes); + auto HasDataTypes = L.GetStackValues(dataTypesIdx, dataTypes); // Check the dataType parameter validity: - if (!cBlockArea::IsValidDataTypeCombination(dataTypes)) + if (HasDataTypes) { - return L.ApiParamError("Invalid datatype combination (%d).", dataTypes); - } - if ((self->GetDataTypes() & dataTypes) != dataTypes) - { - return L.ApiParamError("Requesting datatypes not present in the cBlockArea. Got only 0x%02x, requested 0x%02x", - self->GetDataTypes(), dataTypes - ); + if (!cBlockArea::IsValidDataTypeCombination(dataTypes)) + { + return L.ApiParamError("Invalid datatype combination (%d).", dataTypes); + } + if ((self->GetDataTypes() & dataTypes) != dataTypes) + { + return L.ApiParamError("Requesting datatypes not present in the cBlockArea. Got only 0x%02x, requested 0x%02x", + self->GetDataTypes(), dataTypes + ); + } } // Check and adjust the coord params: @@ -735,7 +738,14 @@ static int tolua_cBlockArea_Write(lua_State * a_LuaState) } // Do the actual write: - L.Push(self->Write(*world, coords, dataTypes)); + if (HasDataTypes) + { + L.Push(self->Write(*world, coords, dataTypes)); + } + else + { + L.Push(self->Write(*world, coords)); + } return 1; } |