summaryrefslogtreecommitdiffstats
path: root/src/Bindings/DeprecatedBindings.cpp
diff options
context:
space:
mode:
author12xx12 <44411062+12xx12@users.noreply.github.com>2020-09-05 17:07:01 +0200
committerGitHub <noreply@github.com>2020-09-05 17:07:01 +0200
commit2d197e147e4ede9b2b38692a88f620e78feba437 (patch)
tree8b2e90e59898ef4c029d72a696b7bed71c5a2f25 /src/Bindings/DeprecatedBindings.cpp
parentWriteConsoleInput can return FALSE when running as servic (diff)
downloadcuberite-2d197e147e4ede9b2b38692a88f620e78feba437.tar
cuberite-2d197e147e4ede9b2b38692a88f620e78feba437.tar.gz
cuberite-2d197e147e4ede9b2b38692a88f620e78feba437.tar.bz2
cuberite-2d197e147e4ede9b2b38692a88f620e78feba437.tar.lz
cuberite-2d197e147e4ede9b2b38692a88f620e78feba437.tar.xz
cuberite-2d197e147e4ede9b2b38692a88f620e78feba437.tar.zst
cuberite-2d197e147e4ede9b2b38692a88f620e78feba437.zip
Diffstat (limited to 'src/Bindings/DeprecatedBindings.cpp')
-rw-r--r--src/Bindings/DeprecatedBindings.cpp106
1 files changed, 106 insertions, 0 deletions
diff --git a/src/Bindings/DeprecatedBindings.cpp b/src/Bindings/DeprecatedBindings.cpp
index 0d216f94b..3704551eb 100644
--- a/src/Bindings/DeprecatedBindings.cpp
+++ b/src/Bindings/DeprecatedBindings.cpp
@@ -10,6 +10,7 @@
#include "../Entities/Player.h"
#include "LuaState.h"
#include "../BlockInfo.h"
+#include "../BlockEntities/NoteEntity.h"
@@ -468,6 +469,105 @@ static int tolua_set_cItem_m_Lore(lua_State * tolua_S)
+/** function: cNoteEntity: GetNote */
+static int tolua_cNoteEntity_GetPitch(lua_State * tolua_S)
+{
+ cLuaState LuaState(tolua_S);
+
+ if (
+ !LuaState.CheckParamUserType(1, "cNoteEntity") ||
+ !LuaState.CheckParamEnd(2)
+ )
+ {
+ return 0;
+ }
+
+ cNoteEntity * Self = nullptr;
+
+ if (!LuaState.GetStackValues(1, Self))
+ {
+ tolua_error(LuaState, "Failed to read parameters", nullptr);
+ }
+ if (Self == nullptr)
+ {
+ tolua_error(LuaState, "invalid 'self' in function 'GetPitch'", nullptr);
+ }
+ LuaState.Push(Self->GetNote());
+ LOGWARNING("Warning: 'cNoteEntity:GetPitch' function is deprecated. Please use 'cNoteEntity:GetNote' instead.");
+ LuaState.LogStackTrace(0);
+ return 1;
+}
+
+
+
+
+/** function: cNoteEntity: IncrementNote */
+static int tolua_cNoteEntity_IncrementPitch(lua_State * tolua_S)
+{
+ cLuaState LuaState(tolua_S);
+
+ if (
+ !LuaState.CheckParamUserType(1, "cNoteEntity") ||
+ !LuaState.CheckParamEnd(2)
+ )
+ {
+ return 0;
+ }
+
+ cNoteEntity * Self = nullptr;
+
+ if (!LuaState.GetStackValues(1, Self))
+ {
+ tolua_error(LuaState, "Failed to read parameters", nullptr);
+ }
+ if (Self == nullptr)
+ {
+ tolua_error(LuaState, "invalid 'self' in function 'SetPitch'", nullptr);
+ }
+
+ Self->IncrementNote();
+ LOGWARNING("Warning: 'cNoteEntity:IncrementPitch' function is deprecated. Please use 'cNoteEntity:IncrementNote' instead.");
+ LuaState.LogStackTrace(0);
+ return 1;
+}
+
+
+
+
+/** function: cNoteEntity: SetNote */
+static int tolua_cNoteEntity_SetPitch(lua_State * tolua_S)
+{
+ cLuaState LuaState(tolua_S);
+
+ if (
+ !LuaState.CheckParamUserType(1, "cNoteEntity") ||
+ !LuaState.CheckParamNumber(2) ||
+ !LuaState.CheckParamEnd(3)
+ )
+ {
+ return 0;
+ }
+
+ cNoteEntity * Self = nullptr;
+ int Note = -1;
+
+ if (!LuaState.GetStackValues(1, Self, Note))
+ {
+ tolua_error(LuaState, "Failed to read parameters", nullptr);
+ }
+ if (Self == nullptr)
+ {
+ tolua_error(LuaState, "invalid 'self' in function 'SetPitch'", nullptr);
+ }
+
+ Self->SetNote(Note % 25);
+ LOGWARNING("Warning: 'cNoteEntity:SetPitch' function is deprecated. Please use 'cNoteEntity:SetNote' instead.");
+ LuaState.LogStackTrace(0);
+ return 1;
+}
+
+
+
/** function: cWorld:SetSignLines */
static int tolua_cWorld_SetSignLines(lua_State * tolua_S)
@@ -708,6 +808,12 @@ void DeprecatedBindings::Bind(lua_State * tolua_S)
tolua_variable(tolua_S, "m_Lore", tolua_get_cItem_m_Lore, tolua_set_cItem_m_Lore);
tolua_endmodule(tolua_S);
+ tolua_beginmodule(tolua_S, "cNoteEntity");
+ tolua_function(tolua_S, "GetPitch", tolua_cNoteEntity_GetPitch);
+ tolua_function(tolua_S, "IncrementPitch", tolua_cNoteEntity_IncrementPitch);
+ tolua_function(tolua_S, "SetPitch", tolua_cNoteEntity_SetPitch);
+ tolua_endmodule(tolua_S);
+
tolua_beginmodule(tolua_S, "cWorld");
tolua_function(tolua_S, "GrowTree", tolua_cWorld_GrowTree);
tolua_function(tolua_S, "GrowTreeByBiome", tolua_cWorld_GrowTreeByBiome);