get_staticdata = function(self) local itemstring_length = string.len(self.itemstring) -- If an item with an itemstring of length 65375 is serialized, it -- is too big for serializeString16() – which means it will crash -- the server if the map block with the item entity is unloaded. -- That threshold was determined empirically and might change. if itemstring_length >= 65375 then new_itemstring = string.gsub( self.itemstring, "^(.-) (.-) (.-) (.*)$", "%1 %2 %3" ) minetest.log( "Error", "Overlong itemstring shortened from length " .. itemstring_length .. " for " .. new_itemstring ) self.itemstring = new_itemstring end return minetest.serialize({ itemstring = self.itemstring, always_collect = self.always_collect, age = self.age, _insta_collect = self._insta_collect, _flowing = self._flowing, _removed = self._removed, }) end,