From 2d197e147e4ede9b2b38692a88f620e78feba437 Mon Sep 17 00:00:00 2001 From: 12xx12 <44411062+12xx12@users.noreply.github.com> Date: Sat, 5 Sep 2020 17:07:01 +0200 Subject: Use pitch lookup in noteblock block entity (#4826) - Removed the calculation in the noteblock block entity I did the calculation in python if anyone is interested where the numbers are from Co-authored-by: 12xx12 <12xx12100@gmail.com> --- src/BlockEntities/NoteEntity.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/BlockEntities/NoteEntity.h') diff --git a/src/BlockEntities/NoteEntity.h b/src/BlockEntities/NoteEntity.h index 30dea8811..c5da3b44e 100644 --- a/src/BlockEntities/NoteEntity.h +++ b/src/BlockEntities/NoteEntity.h @@ -40,13 +40,12 @@ public: // tolua_export /** Creates a new note entity. a_World may be nullptr */ cNoteEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World); - virtual ~cNoteEntity() override {} // tolua_begin - char GetPitch(void); - void SetPitch(char a_Pitch); - void IncrementPitch(void); + unsigned char GetNote(void); + void SetNote(unsigned char a_Note); + void IncrementNote(void); void MakeSound(void); // tolua_end @@ -56,10 +55,11 @@ public: // tolua_export virtual bool UsedBy(cPlayer * a_Player) override; virtual void SendTo(cClientHandle &) override {} -private: - char m_Pitch; -} ; // tolua_export - - + /** Returns the relative pitch (used in the protocol) + from a note value between 0 and 24 (used in m_Note). */ + static float PitchFromNote(unsigned char a_Note); +private: + unsigned char m_Note; +} ; // tolua_export -- cgit v1.2.3