From 57d2c15f1264d78cfbbe6805420ff32167d66392 Mon Sep 17 00:00:00 2001 From: Nicholas Novak <34256932+NickyBoy89@users.noreply.github.com> Date: Tue, 5 Dec 2023 14:37:45 -0800 Subject: [PATCH] change: Changed BlockID's encoding to use the default for bytes --- world/data_format.go | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/world/data_format.go b/world/data_format.go index a25f449..02af929 100644 --- a/world/data_format.go +++ b/world/data_format.go @@ -86,37 +86,3 @@ const ( Empty BlockID = iota Generic ) - -func (b *BlockID) UnmarshalJSON(data []byte) error { - idName := string(data) - - if len(idName) < 2 { - return fmt.Errorf("error decoding blockid, input was too short") - } - - switch idName[1 : len(idName)-1] { - case "Empty": - *b = Empty - case "Generic": - *b = Generic - default: - return fmt.Errorf("unknown block id: %s", string(data)) - } - - return nil -} - -func (b BlockID) MarshalJSON() ([]byte, error) { - var encoded []byte - - switch b { - case Empty: - encoded = []byte("\"Empty\"") - case Generic: - encoded = []byte("\"Generic\"") - default: - return []byte{}, fmt.Errorf("could not turn block id %d into data", b) - } - - return encoded, nil -}